Previous 15994 Revisions Next

r14977 Friday 20th April, 2012 at 09:04:29 UTC by Miodrag Milanović
Sync with MAME r16034 (nw)
[src/emu]device.c device.h diimage.c drawgfx.c machine.c machine.h memory.c memory.h romload.c screen.c
[src/emu/cpu/cubeqcpu]cubeqcpu.c
[src/emu/cpu/esrip]esrip.c
[src/emu/cpu/mb86233]mb86233.c
[src/emu/debug]debugcpu.c dvmemory.c dvmemory.h
[src/emu/imagedev]cartslot.c
[src/emu/machine]laserdsc.c mccs1850.c pls100.c
[src/emu/sound]2610intf.c digitalk.c es5506.c fm.c gaelco.c i5000.c k053260.c k054539.c okim6295.c tms5110.c votrax.c ymz770.c zsg2.c
[src/emu/video]315_5124.c generic.c hd61830.c pc_cga.c tms9927.c
[src/lib/formats]ap2_dsk.c ap2_dsk.h dfi_dsk.c
[src/mame/audio]atarijsa.c cage.c cclimber.c cinemat.c circus.c cyberbal.c dcs.c dkong.c exidy440.c flower.c gomoku.c harddriv.c leland.c m72.c mario.c midway.c midway.h polepos.c segag80r.c segasnd.c seibu.c snes_snd.c snk6502.c suna8.c taito_en.c targ.c williams.c wiping.c
[src/mame/drivers]1942.c 1943.c 20pacgal.c 2mindril.c 39in1.c 3do.c 40love.c 4enraya.c 5clown.c 8080bw.c 88games.c acefruit.c acesp.c adp.c aeroboto.c aerofgt.c airbustr.c albazc.c albazg.c aleck64.c alg.c aliens.c alpha68k.c amaticmg.c ampoker2.c amspdwy.c angelkds.c appoooh.c aquarium.c arcadecl.c arcadia.c argus.c aristmk4.c aristmk5.c aristmk6.c arkanoid.c armedf.c ashnojoe.c asterix.c astinvad.c astrafr.c astrocde.c astrocorp.c astrof.c asuka.c atarig42.c atarisy2.c atarisy4.c atetris.c atvtrack.c avt.c backfire.c badlands.c balsente.c baraduke.c battlex.c battlnts.c bfcobra.c bfm_sc1.c bfm_sc2.c bfm_sc4.c bfm_sc4h.c bfm_sc5.c bigevglf.c bingoc.c bking.c bladestl.c blitz.c blitz68k.c blktiger.c blmbycar.c blockhl.c bnstars.c boogwing.c bottom9.c boxer.c brkthru.c btime.c bublbobl.c buggychl.c bwing.c cabal.c cabaret.c calchase.c calomega.c calorie.c capbowl.c cardline.c carpolo.c carrera.c caswin.c cave.c cb2001.c cbasebal.c cbuster.c ccastles.c cclimber.c cd32.c cdi.c chaknpop.c cham24.c champbas.c champbwl.c chanbara.c chihiro.c chinagat.c chinsan.c chqflag.c chsuper.c cidelsa.c cinemat.c cischeat.c citycon.c cloud9.c clshroad.c cmmb.c cninja.c cntsteer.c cobra.c coinmstr.c coinmvga.c combatsc.c commando.c compgolf.c contra.c coolpool.c coolridr.c cop01.c corona.c cosmic.c cps1.c cps2.c cps3.c crgolf.c crimfght.c crospang.c crshrace.c crystal.c cshooter.c csplayh5.c cultures.c cvs.c cybertnk.c cyclemb.c d9final.c dacholer.c dambustr.c darius.c darkhors.c darkmist.c darkseal.c dassault.c dbz.c dcon.c ddayjlc.c ddenlovr.c ddragon.c ddribble.c dec0.c dec8.c deco156.c deco32.c deco_mlc.c decocass.c deshoros.c dgpix.c discoboy.c djboy.c djmain.c dkong.c dmndrby.c docastle.c dooyong.c dorachan.c dreamwld.c drgnmst.c drmicro.c drw80pkr.c dunhuang.c dwarfd.c dynadice.c dynax.c enigma2.c eolith.c epos.c equites.c esd16.c esh.c esripsys.c ettrivia.c exerion.c exidy.c exidy440.c expro02.c exprraid.c exzisus.c f1gp.c famibox.c fantland.c fastfred.c fastlane.c fcombat.c fcrash.c feversoc.c fgoal.c firebeat.c firefox.c firetrap.c fitfight.c flkatck.c flyball.c forte2.c fortecar.c freekick.c fromanc2.c fromance.c funkball.c funworld.c funybubl.c fuukifg2.c fuukifg3.c gaelco.c gaelco3d.c gaiden.c galaga.c galaxian.c galgame.c galivan.c galpani2.c galpani3.c galpanic.c gamecstl.c gaplus.c gauntlet.c gberet.c gbusters.c gcpinbal.c gei.c ghosteo.c ginganin.c gladiatr.c glass.c gng.c go2000.c goal92.c goindol.c goldnpkr.c goldstar.c gpworld.c groundfx.c gstriker.c gsword.c gticlub.c guab.c gundealr.c gunpey.c gunsmoke.c halleys.c harddriv.c hcastle.c highvdeo.c himesiki.c hitpoker.c hnayayoi.c hng64.c homedata.c homerun.c hornet.c hshavoc.c hvyunit.c hyprduel.c ichiban.c igs009.c igs011.c igs017.c igs_m027.c igspoker.c intrscti.c inufuku.c iqblock.c istellar.c itech32.c itech8.c itgambl2.c itgambl3.c jack.c jackal.c jackie.c jackpool.c jaguar.c jailbrek.c jalmah.c jangou.c jantotsu.c jchan.c jedi.c jokrwild.c jollyjgr.c jongkyo.c jpmimpct.c jpmsys5.c jrpacman.c junofrst.c kaneko16.c kangaroo.c karnov.c kas89.c kchamp.c kickgoal.c kingdrby.c kingobox.c kingpin.c koikoi.c konamigq.c konamigx.c konendev.c ksayakyu.c kungfur.c labyrunr.c ladybug.c lastduel.c lastfght.c lazercmd.c legionna.c leland.c lethal.c liberate.c limenko.c littlerb.c lkage.c looping.c lordgun.c lsasquad.c ltcasino.c luckgrln.c lucky74.c lwings.c m107.c m58.c m62.c m63.c m72.c m79amb.c m90.c m92.c macs.c madalien.c madmotor.c magicard.c magictg.c magtouch.c mainevt.c majorpkr.c malzak.c marinedt.c mastboy.c maxaflex.c maygay1b.c mayumi.c mazerbla.c mcatadv.c mcr.c mcr3.c meadows.c mediagx.c megadrvb.c megaplay.c megasys1.c megatech.c meijinsn.c merit.c meritm.c mermaid.c metalmx.c metro.c mexico86.c midas.c midqslvr.c midvunit.c midzeus.c miniboy7.c mirax.c missb2.c missile.c mitchell.c mjkjidai.c mjsister.c mlanding.c model1.c model2.c model3.c mogura.c momoko.c moo.c mouser.c mpu4.c mpu4vid.c mquake.c mrdo.c ms32.c multfish.c multigam.c murogmbl.c mustache.c mystwarr.c namcofl.c namcoic.c namcona1.c namconb1.c namcos10.c namcos11.c namcos12.c namcos2.c namcos21.c namcos22.c namcos23.c namcos86.c naomi.c naughtyb.c nbmj8688.c nbmj8891.c nbmj8900.c nbmj8991.c nbmj9195.c neodrvr.c neogeo.c neoprint.c nexus3d.c nightgal.c ninjakd2.c ninjaw.c niyanpai.c nmk16.c norautp.c nova2001.c nss.c nwk-tr.c nycaptor.c ohmygod.c ojankohs.c olibochu.c omegrace.c onetwo.c opwolf.c othello.c othunder.c pachifev.c pacman.c panicr.c paradise.c parodius.c pasha2.c pastelg.c pbaction.c pcat_nit.c pcktgal.c pcxt.c pengadvb.c pengo.c peplus.c pgm.c pgm2.c phoenix.c photon.c photon2.c pingpong.c pipedrm.c pipeline.c pirates.c playmark.c pluto5.c plygonet.c pntnpuzl.c pokechmp.c poker72.c polepos.c policetr.c poo.c poolshrk.c popeye.c powerbal.c powerins.c ppmast93.c progolf.c psikyo.c psikyo4.c psikyosh.c psychic5.c pturn.c puckpkmn.c qdrmfgp.c qix.c queen.c quizdna.c quizo.c quizpun2.c quizshow.c r2dx_v33.c rabbit.c raiden.c raiden2.c rainbow.c rampart.c rastan.c redclash.c relief.c renegade.c rltennis.c rmhaihai.c rockrage.c rocnrope.c rohga.c rollerg.c roul.c route16.c royalmah.c rpunch.c rungun.c sandscrp.c sangho.c saturn.c sauro.c savquest.c sbowling.c sbrkout.c scregg.c segac2.c segae.c segag80r.c segahang.c segald.c segaorun.c segas16a.c segas16b.c segas18.c segas24.c segas32.c seibuspi.c seta.c seta2.c sf.c sfbonus.c sfkick.c shangha3.c shangkid.c shootout.c shougi.c sidearms.c sigmab52.c sigmab98.c silkroad.c silvmil.c simpl156.c simpsons.c skimaxx.c skullxbo.c skyarmy.c skyfox.c skykid.c slapfght.c slapshot.c sliver.c slotcarn.c sms.c snesb.c snk.c snk68.c snowbros.c sothello.c spdodgeb.c speedspn.c spiders.c splash.c splus.c spoker.c spool99.c sprcros2.c spy.c srmp2.c srmp5.c srmp6.c srumbler.c ssfindo.c sshangha.c ssingles.c ssrj.c sstrangr.c ssv.c st0016.c starwars.c statriv2.c stv.c su2000.c sub.c subsino.c subsino2.c suna16.c suna8.c supdrapo.c superdq.c superqix.c supertnk.c suprgolf.c suprloco.c suprnova.c suprslam.c surpratk.c system1.c system16.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 taitowlf.c tank8.c tankbust.c taotaido.c targeth.c tatsumi.c tattack.c tbowl.c tcl.c tecmo.c tecmosys.c tehkanwc.c tetrisp2.c thedeep.c thepit.c thief.c thoop2.c thunderx.c tmaster.c tmmjprd.c tmnt.c tmspoker.c tnzs.c toaplan2.c toki.c topspeed.c trackfld.c travrusa.c trucocl.c trvmadns.c trvquest.c tryout.c ttchamp.c tugboat.c tumbleb.c tumblep.c turbo.c tutankhm.c twin16.c twinkle.c umipoker.c undrfire.c unico.c upscope.c usgames.c vaportra.c vball.c vcombat.c vega.c vendetta.c videopkr.c vigilant.c viper.c vmetal.c voyager.c wallc.c wardner.c warpsped.c warriorb.c wc90.c wc90b.c wecleman.c welltris.c wgp.c wheelfir.c whitestar.c williams.c wink.c witch.c wiz.c xain.c xexex.c xmen.c xorworld.c xtom3d.c xxmissio.c yunsun16.c yunsung8.c zaxxon.c zn.c zr107.c
[src/mame/machine]3do.c acitya.c ajax.c archimds.c asteroid.c atari.c awboard.c balsente.c beezer.c bfm_comn.c btime.c bublbobl.c cclimber.c cps2crpt.c dec0.c deco102.c deco156.c decocass.c decocrpt.c fd1089.c fddebug.c gaelco2.c galaxold.c harddriv.c irobot.c jalcrpt.c jumpshot.c kabuki.c kaneko16.c konami1.c konppc.c leland.c mc8123.c md_cart.c megadriv.c mhavoc.c micro3d.c midtunit.c midwunit.c midxunit.c midyunit.c model1.c n64.c namcond1.c namcos1.c namcos2.c naomi.c naomigd.c naomim1.c naomim2.c naomim4.c nb1413m3.c nb1414m4.c neoboot.c neocrypt.c neoprot.c nmk004.c nmk112.c opwolf.c pacplus.c pgmcrypt.c pgmprot1.c pgmprot2.c pgmprot3.c pgmprot4.c pgmprot5.c pgmprot6.c playch10.c qix.c r2crypt.c s16fd.c s24fd.c scramble.c segacrp2.c segacrpt.c segaic16.c segamsys.c segas32.c simpsons.c slapfght.c smpc.c snes.c snes7110.c snesbsx.c snessdd1.c starwars.c stfight.c stvprot.c subsino.c taitosj.c tatsumi.c theglobp.c tnzs.c tx1.c vectrex.c vsnes.c williams.c wrally.c
[src/mame/video]1942.c 1943.c 20pacgal.c 40love.c 8080bw.c aerofgt.c alpha68k.c ambush.c ampoker2.c appoooh.c arabian.c archimds.c argus.c arkanoid.c artmagic.c atarirle.c atarisy1.c avgdvg.c bagman.c balsente.c bankp.c baraduke.c bbusters.c bfm_adr2.c bking.c bladestl.c bogeyman.c bombjack.c bosco.c brkthru.c btime.c bublbobl.c buggychl.c bwing.c calomega.c capbowl.c carjmbre.c carpolo.c cave.c ccastles.c cclimber.c centiped.c chaknpop.c champbas.c changela.c cheekyms.c circusc.c citycon.c cloud9.c clshroad.c combatsc.c compgolf.c contra.c cop01.c cosmic.c cps1.c crbaloon.c crgolf.c cvs.c darkmist.c dcheese.c dday.c ddribble.c deadang.c dec8.c deco_mlc.c deniam.c digdug.c dkong.c docastle.c dogfgt.c dooyong.c dribling.c drmicro.c dynax.c epos.c equites.c espial.c esripsys.c exedexes.c exerion.c exprraid.c f1gp.c fastfred.c fastlane.c fcombat.c finalizr.c firetrap.c firetrk.c flower.c funkybee.c funworld.c fuukifg2.c gaelco3d.c galaga.c galastrm.c galaxian.c galaxold.c galivan.c gaplus.c gberet.c ginganin.c glass.c goldstar.c gomoku.c gotya.c gradius3.c grchamp.c gridlee.c groundfx.c gsword.c gticlub.c gunbustr.c gunsmoke.c gyruss.c hanaawas.c hcastle.c hexion.c higemaru.c hnayayoi.c hng64.c homedata.c homerun.c hyhoo.c hyperspt.c hyprduel.c ikki.c irobot.c ironhors.c itech32.c itech8.c jack.c jackal.c jailbrek.c jedi.c kaneko16.c kangaroo.c karnov.c kchamp.c kingobox.c kncljoe.c konamigx.c konamiic.c konicdev.c kopunch.c ksayakyu.c kyugo.c labyrunr.c ladybug.c lasso.c leland.c lethalj.c liberate.c liberatr.c lockon.c lucky74.c lvcards.c lwings.c m107.c m52.c m57.c m58.c m62.c madalien.c magmax.c mainsnk.c mappy.c marineb.c mario.c markham.c matmania.c mcatadv.c mcr68.c megasys1.c megazone.c mermaid.c metlclsh.c metro.c mexico86.c mikie.c mjkjidai.c model1.c model2.c momoko.c mouser.c mrdo.c mrjong.c munchmo.c mustache.c mw8080bw.c mystston.c mystwarr.c n64.h n8080.c namcofl.c namconb1.c namcos1.c namcos2.c namcos22.c namcos86.c naughtyb.c nbmj8688.c nbmj8891.c nbmj8900.c nbmj8991.c nbmj9195.c neogeo.c niyanpai.c nmk16.c nova2001.c ojankohs.c othunder.c pacland.c pacman.c pandoras.c pastelg.c pcktgal.c pgm.c phoenix.c pingpong.c pitnrun.c playch10.c plygonet.c polepos.c policetr.c pooyan.c popeye.c popper.c portrait.c ppu2c0x.c prehisle.c psikyo.c punchout.c pushman.c quasar.c quizdna.c rallyx.c redalert.c redclash.c retofinv.c rockrage.c rocnrope.c rollrace.c route16.c rungun.c sbasketb.c scotrsht.c sega16sp.c segag80r.c segag80v.c segaic16.c segas32.c seibuspi.c seicross.c seta.c sf.c shangkid.c shaolins.c shisen.c shootout.c sidearms.c sidepckt.c simpsons.c skyfox.c skykid.c skyraid.c snk.c snk6502.c snookr10.c sonson.c spacefb.c spdodgeb.c speedatk.c sprcros2.c srmp2.c ssozumo.c sspeedr.c st0016.c stactics.c stfight.c strnskil.c stvvdp2.c suna8.c superchs.c superqix.c suprloco.c suprnova.c suprridr.c system1.c tagteam.c tail2nos.c taito_z.c taitoic.c taitosj.c tankbatt.c tatsumi.c tceptor.c tecmosys.c terracre.c thedeep.c thepit.c thief.c tigeroad.c timelimt.c timeplt.c tmnt.c tnzs.c toypop.c tp84.c trackfld.c travrusa.c trucocl.c tryout.c tubep.c tunhunt.c turbo.c tx1.c ultratnk.c undrfire.c vball.c vertigo.c vicdual.c vulgus.c wecleman.c williams.c wiping.c wiz.c xevious.c xorworld.c xyonix.c yiear.c zaccaria.c zaxxon.c zodiack.c
[src/mess/audio]spchroms.c svision.c
[src/mess/drivers]a2600.c a5105.c a7000.c abc1600.c abc80.c abc80x.c adam.c alesis.c alphatro.c ami1200.c amiga.c apexc.c applix.c aquarius.c arcadia.c argo.c atari400.c atm.c atom.c avigo.c b16.c bbcbc.c bcs3.c beehive.c beta.c bigbord2.c bmjr.c bml3.c bullet.c bw12.c bw2.c c10.c c64.c camplynx.c ccs2422.c cd2650.c cgenie.c channelf.c chesstrv.c codata.c coleco.c compis.c comquest.c comx35.c cosmicos.c crvision.c czk80.c dectalk.c digel804.c dim68k.c dmv.c dual68.c e01.c ec65.c einstein.c elf.c elwro800.c enterp.c esq1.c exelv.c exp85.c fk1.c fm7.c fmtowns.c fp1100.c fp6000.c gamepock.c gba.c gmaster.c gp2x.c h19.c hec2hrp.c homelab.c homez80.c hp49gp.c ht68k.c huebler.c ip22.c ipds.c iq151.c jr100.c jr200.c jupiter.c k8915.c kyocera.c lc80.c lcmate2.c lynx.c m79152pc.c mc10.c mc1000.c mccpm.c mekd2.c mes.c micronic.c mikromik.c mini2440.c mirage.c mmd1.c mmodular.c mpz80.c msbc1.c mstation.c multi8.c mycom.c mz2000.c mz2500.c n64.c nakajies.c nanos.c nc.c newbrain.c next.c ng_aes.c ngp.c ob68k1a.c okean240.c osbexec.c osi.c palm.c palmz22.c paso1600.c pasogo.c pasopia.c pasopia7.c pb1000.c pc100.c pc2000.c pc4.c pc6001.c pc8001.c pc8401a.c pc8801.c pc88va.c pc9801.c pce220.c pcfx.c pcm.c pcw.c pcw16.c pda600.c pdp1.c pdp11.c pegasus.c pentagon.c phc25.c phunsy.c pk8000.c plan80.c pocketc.c pockstat.c portfoli.c prestige.c prof80.c psion.c pt68k4.c ptcsol.c pv1000.c pv2000.c px4.c px8.c pyl601.c ql.c qtsbc.c qx10.c rex6000.c rt1715.c rx78.c sage2.c sapi1.c scorpion.c scv.c sg1000.c sgi_ip2.c sm1800.c smc777.c socrates.c sorcerer.c spc1000.c spec128.c specpls3.c spectrum.c studio2.c sun1.c sun2.c sun3.c super6.c supracan.c svision.c sys2900.c systec.c tandy2k.c tek405x.c ti89.c ti990_10.c ti99_2.c ti99_4p.c tiki100.c timex.c tmc1800.c tricep.c trs80.c trs80m2.c tsispch.c tutor.c tvc.c tx0.c unior.c univac.c unixpc.c v1050.c v6809.c vc4000.c vg5k.c vic20.c vii.c vip.c vixen.c vt240.c vt520.c vta2000.c vtech1.c x07.c x1.c x68k.c xerox820.c xor100.c z100.c z1013.c z88.c z9001.c zexall.c zrt80.c
[src/mess/formats]ace_ace.c m65_snqk.c studio2_st2.c
[src/mess/machine]a2cffa.c a2diskii.c a2memexp.c a2scsi.c a2thunderclock.c a7800.c abc_fd2.c abc_sio.c advision.c amigacrt.c amstrad.c apple1.c apple2.c apple2gs.c apple3.c at.c ataricrt.c b2m.c bbc.c bebox.c c128.c c16.c c2040.c c64.c c64_dela_ep256.c c64_dela_ep64.c c64_dela_ep7x8.c c64_rex_ep256.c c64_xl80.c c65.c cbmb.c cgenie.c coco12.c coco_fdc.c coco_pak.c comx_clm.c comx_eb.c comx_epr.c comx_fd.c comx_prn.c comx_thm.c comxpl80.c cpc_ssa1.c cs4031.c cuda.c cybiko.c dai.c dgn_beta.c ecb_grip.c egret.c electron.c galaxy.c gamecom.c gb.c genpc.c hec2hrp.c hecdisk2.c hp48.c i82439tx.c intv.c iq151_disc2.c iq151_minigraf.c iq151_ms151a.c iq151_rom.c isa.c jupiter.c kaypro.c kc.c kc_d004.c kc_ram.c kc_rom.c lisa.c llc.c lux10828.c lux21046.c lviv.c lynx.c mac.c mbc55x.c mbee.c mface2.c microtan.c mikro80.c mpc105.c msx.c msx_slot.c mtx.c mz700.c nascom1.c nes.c nes_mmc.c nes_pcb.c nubus.c odyssey2.c ondra.c oric.c orion.c osborne1.c partner.c pc.c pc1251.c pc1350.c pc1401.c pc1403.c pce.c pecom.c pet.c pk8020.c pmd85.c pokemini.c pp01.c primo.c radio86.c rm380z.c rmnimbus.c s100_dj2db.c samcoupe.c sapi1.c sms.c snescart.c sorcerer.c special.c super80.c svi318.c sym1.c tandy1t.c thomflop.c thomson.c ti85.c trs80.c ut88.c vector06.c vtech2.c wswan.c z80ne.c z88_ram.c z88_rom.c zx.c
[src/mess/machine/ti99]bwg.c evpc.c genboard.c grom.c gromport.c hfdc.c horizon.c mapper8.c memex.c myarcmem.c p_code.c samsmem.c spchsyn.c speech8.c ti32kmem.c ti_fdc.c ti_rs232.c tn_ide.c tn_usbsm.c
[src/mess/video]733_asr.c 911_vdt.c a7800.c abc1600.c abc80.c abc800.c abc802.c abc806.c apple2.c avigo.c bbc.c cbmb.c cgc7900.c channelf.c dai.c dgn_beta.c ef9345.h fm7.c fmtowns.c galaxy.c gb.c gime.c intv.c iq151_video32.c iq151_video64.c isa_cga.c isa_ega.c isa_mda.c k1ge.c kaypro.c llc.c mbee.c mc80.c mikro80.c mikromik.c mz80.c newbrain.c osi.c pc1512.c pc4.c pc_aga.c pc_t1t.c pet.c pk8020.c poly88.c radio86.c rm380z.c super80.c thomson.c tmc600.c trs80.c vtvideo.c x68k.c zx.c

src/mame/audio/suna8.c
r14976r14977
5252{
5353   suna8_state *state = device.machine().driver_data<suna8_state>();
5454   running_machine &machine = device.machine();
55   int i, len = machine.region("samples")->bytes();
56   UINT8 *ROM = machine.region("samples")->base();
55   int i, len = machine.root_device().memregion("samples")->bytes();
56   UINT8 *ROM = state->memregion("samples")->base();
5757
5858   state->m_samplebuf = auto_alloc_array(machine, INT16, len);
5959
src/mame/audio/cyberbal.c
r14976r14977
2020   cyberbal_state *state = machine.driver_data<cyberbal_state>();
2121
2222   /* reset the sound system */
23   state->m_bank_base = &machine.region("audiocpu")->base()[0x10000];
24   memory_set_bankptr(machine, "soundbank", &state->m_bank_base[0x0000]);
23   state->m_bank_base = &state->memregion("audiocpu")->base()[0x10000];
24   state->membank("soundbank")->set_base(&state->m_bank_base[0x0000]);
2525   state->m_fast_68k_int = state->m_io_68k_int = 0;
2626   state->m_sound_data_from_68k = state->m_sound_data_from_6502 = 0;
2727   state->m_sound_data_from_68k_ready = state->m_sound_data_from_6502_ready = 0;
r14976r14977
5656
5757WRITE8_MEMBER(cyberbal_state::cyberbal_sound_bank_select_w)
5858{
59   memory_set_bankptr(machine(), "soundbank", &m_bank_base[0x1000 * ((data >> 6) & 3)]);
59   membank("soundbank")->set_base(&m_bank_base[0x1000 * ((data >> 6) & 3)]);
6060   coin_counter_w(machine(), 1, (data >> 5) & 1);
6161   coin_counter_w(machine(), 0, (data >> 4) & 1);
6262   cputag_set_input_line(machine(), "dac", INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
src/mame/audio/atarijsa.c
r14976r14977
133133   test_mask = testmask;
134134
135135   /* predetermine the bank base */
136   rgn = machine.region("jsa")->base();
136   rgn = machine.root_device().memregion("jsa")->base();
137137   bank_base = &rgn[0x03000];
138138   bank_source_data = &rgn[0x10000];
139139
r14976r14977
161161      /* the upper 128k is fixed, the lower 128k is bankswitched */
162162      for (rgn = 0; rgn < ARRAY_LENGTH(regions); rgn++)
163163      {
164         UINT8 *base = machine.region(regions[rgn])->base();
165         if (base != NULL && machine.region(regions[rgn])->bytes() >= 0x80000)
164         UINT8 *base = machine.root_device().memregion(regions[rgn])->base();
165         if (base != NULL && machine.root_device().memregion(regions[rgn])->bytes() >= 0x80000)
166166         {
167167            const char *bank = (rgn != 2) ? "bank12" : "bank14";
168168            const char *bank_plus_1 = (rgn != 2) ? "bank13" : "bank15";
169            memory_configure_bank(machine, bank, 0, 2, base + 0x00000, 0x00000);
170            memory_configure_bank(machine, bank, 2, 2, base + 0x20000, 0x20000);
171            memory_set_bankptr(machine, bank_plus_1, base + 0x60000);
169            machine.root_device().membank(bank)->configure_entries(0, 2, base + 0x00000, 0x00000);
170            machine.root_device().membank(bank)->configure_entries(2, 2, base + 0x20000, 0x20000);
171            machine.root_device().membank(bank_plus_1)->set_base(base + 0x60000);
172172         }
173173      }
174174   }
r14976r14977
548548
549549         /* update the OKI bank */
550550         if (oki6295 != NULL)
551            memory_set_bank(space->machine(), "bank12", (space->machine().memory().bank("bank12")->entry() & 2) | ((data >> 1) & 1));
551            space->machine().root_device().membank("bank12")->set_entry((space->machine().root_device().membank("bank12")->entry() & 2) | ((data >> 1) & 1));
552552
553553         /* update the bank */
554554         memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
r14976r14977
572572
573573         /* update the OKI bank */
574574         if (oki6295 != NULL)
575            memory_set_bank(space->machine(), "bank12", (space->machine().memory().bank("bank12")->entry() & 1) | ((data >> 3) & 2));
575            space->machine().root_device().membank("bank12")->set_entry((space->machine().root_device().membank("bank12")->entry() & 1) | ((data >> 3) & 2));
576576
577577         /* update the volumes */
578578         ym2151_volume = ((data >> 1) & 7) * 100 / 7;
r14976r14977
681681         if ((data&1) == 0) devtag_reset(space->machine(), "ymsnd");
682682
683683         /* update the OKI bank */
684         memory_set_bank(space->machine(), "bank12", (space->machine().memory().bank("bank12")->entry() & 2) | ((data >> 1) & 1));
684         space->machine().root_device().membank("bank12")->set_entry((space->machine().root_device().membank("bank12")->entry() & 2) | ((data >> 1) & 1));
685685
686686         /* update the bank */
687687         memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
r14976r14977
705705            */
706706
707707         /* update the OKI bank */
708         memory_set_bank(space->machine(), "bank12", (space->machine().memory().bank("bank12")->entry() & 1) | ((data >> 3) & 2));
709         memory_set_bank(space->machine(), "bank14", data >> 6);
708         space->machine().root_device().membank("bank12")->set_entry((space->machine().root_device().membank("bank12")->entry() & 1) | ((data >> 3) & 2));
709         space->machine().root_device().membank("bank14")->set_entry(data >> 6);
710710
711711         /* update the volumes */
712712         ym2151_volume = ((data >> 1) & 7) * 100 / 7;
src/mame/audio/cage.c
r14976r14977
165165
166166   state->irqhandler = NULL;
167167
168   memory_set_bankptr(machine, "bank10", machine.region("cageboot")->base());
169   memory_set_bankptr(machine, "bank11", machine.region("cage")->base());
168   machine.root_device().membank("bank10")->set_base(machine.root_device().memregion("cageboot")->base());
169   machine.root_device().membank("bank11")->set_base(machine.root_device().memregion("cage")->base());
170170
171171   state->cpu = machine.device<cpu_device>("cage");
172172   cage_cpu_clock_period = attotime::from_hz(state->cpu->clock());
src/mame/audio/segasnd.c
r14976r14977
155155{
156156   speech_state *state = get_safe_speech(device);
157157
158   state->speech = device->machine().region("speech")->base();
158   state->speech = device->machine().root_device().memregion("speech")->base();
159159}
160160
161161
src/mame/audio/wiping.c
r14976r14977
193193   state->m_num_voices = 8;
194194   state->m_last_channel = state->m_channel_list + state->m_num_voices;
195195
196   state->m_sound_rom = machine.region("samples")->base();
197   state->m_sound_prom = machine.region("soundproms")->base();
196   state->m_sound_rom = machine.root_device().memregion("samples")->base();
197   state->m_sound_prom = machine.root_device().memregion("soundproms")->base();
198198
199199   /* start with sound enabled, many games don't have a sound enable register */
200200   state->m_sound_enable = 1;
src/mame/audio/leland.c
r14976r14977
551551   /* if we have a 2151, install an externally driven DAC stream */
552552   if (state->m_has_ym2151)
553553   {
554      state->m_ext_base = machine.region("dac")->base();
554      state->m_ext_base = machine.root_device().memregion("dac")->base();
555555      state->m_extern_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, NULL, leland_80186_extern_update);
556556   }
557557
src/mame/audio/gomoku.c
r14976r14977
192192   state->m_num_voices = MAX_VOICES;
193193   state->m_last_channel = state->m_channel_list + state->m_num_voices;
194194
195   state->m_sound_rom = machine.region("gomoku")->base();
195   state->m_sound_rom = machine.root_device().memregion("gomoku")->base();
196196
197197   /* start with sound enabled, many games don't have a sound enable register */
198198   state->m_sound_enable = 1;
src/mame/audio/taito_en.c
r14976r14977
4949
5050static WRITE16_HANDLER( f3_es5505_bank_w )
5151{
52   UINT32 max_banks_this_game=(space->machine().region("ensoniq.0")->bytes()/0x200000)-1;
52   UINT32 max_banks_this_game=(space->machine().root_device().memregion("ensoniq.0")->bytes()/0x200000)-1;
5353
5454#if 0
5555{
r14976r14977
222222
223223static WRITE16_HANDLER(es5510_dsp_w)
224224{
225   UINT8 *snd_mem = (UINT8 *)space->machine().region("ensoniq.0")->base();
225   UINT8 *snd_mem = (UINT8 *)space->machine().root_device().memregion("ensoniq.0")->base();
226226
227227//  if (offset>4 && offset!=0x80  && offset!=0xa0  && offset!=0xc0  && offset!=0xe0)
228228//      logerror("%06x: DSP write offset %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
r14976r14977
304304SOUND_RESET( taito_f3_soundsystem_reset )
305305{
306306   /* Sound cpu program loads to 0xc00000 so we use a bank */
307   UINT16 *ROM = (UINT16 *)machine.region("audiocpu")->base();
307   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("audiocpu")->base();
308308   UINT16 *sound_ram = (UINT16 *)machine.memory().shared("share1")->ptr();
309   memory_set_bankptr(machine, "bank1",&ROM[0x80000]);
310   memory_set_bankptr(machine, "bank2",&ROM[0x90000]);
311   memory_set_bankptr(machine, "bank3",&ROM[0xa0000]);
309   machine.root_device().membank("bank1")->set_base(&ROM[0x80000]);
310   machine.root_device().membank("bank2")->set_base(&ROM[0x90000]);
311   machine.root_device().membank("bank3")->set_base(&ROM[0xa0000]);
312312
313313   sound_ram[0]=ROM[0x80000]; /* Stack and Reset vectors */
314314   sound_ram[1]=ROM[0x80001];
src/mame/audio/seibu.c
r14976r14977
106106{
107107   address_space *space = machine.device(cpu)->memory().space(AS_PROGRAM);
108108   UINT8 *decrypt = auto_alloc_array(machine, UINT8, length);
109   UINT8 *rom = machine.region(cpu)->base();
109   UINT8 *rom = machine.root_device().memregion(cpu)->base();
110110   int i;
111111
112112   space->set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt);
r14976r14977
120120   }
121121
122122   if (length > 0x10000)
123      memory_configure_bank_decrypted(machine, "bank1", 0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
123      machine.root_device().membank("bank1")->configure_decrypted_entries(0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
124124}
125125
126126
r14976r14977
190190
191191   state->m_playing = 0;
192192   state->m_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), state, seibu_adpcm_callback);
193   state->m_base = machine.region(intf->rom_region)->base();
193   state->m_base = machine.root_device().memregion(intf->rom_region)->base();
194194   state->m_adpcm.reset();
195195}
196196
r14976r14977
217217
218218void seibu_adpcm_decrypt(running_machine &machine, const char *region)
219219{
220   UINT8 *ROM = machine.region(region)->base();
221   int len = machine.region(region)->bytes();
220   UINT8 *ROM = machine.root_device().memregion(region)->base();
221   int len = machine.root_device().memregion(region)->bytes();
222222   int i;
223223
224224   for (i = 0; i < len; i++)
r14976r14977
346346
347347MACHINE_RESET( seibu_sound )
348348{
349   int romlength = machine.region("audiocpu")->bytes();
350   UINT8 *rom = machine.region("audiocpu")->base();
349   int romlength = machine.root_device().memregion("audiocpu")->bytes();
350   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
351351
352352   sound_cpu = machine.device("audiocpu");
353353   update_irq_lines(machine, VECTOR_INIT);
354354   if (romlength > 0x10000)
355355   {
356      memory_configure_bank(machine, "bank1", 0, (romlength - 0x10000) / 0x8000, rom + 0x10000, 0x8000);
356      machine.root_device().membank("bank1")->configure_entries(0, (romlength - 0x10000) / 0x8000, rom + 0x10000, 0x8000);
357357
358358      /* Denjin Makai definitely needs this at start-up, it never writes to the bankswitch */
359      memory_set_bank(machine, "bank1", 0);
359      machine.root_device().membank("bank1")->set_entry(0);
360360   }
361361}
362362
r14976r14977
367367
368368WRITE8_HANDLER( seibu_bank_w )
369369{
370   memory_set_bank(space->machine(), "bank1", data & 1);
370   space->machine().root_device().membank("bank1")->set_entry(data & 1);
371371}
372372
373373WRITE8_HANDLER( seibu_coin_w )
src/mame/audio/segag80r.c
r14976r14977
488488INLINE void sega005_update_sound_data(running_machine &machine)
489489{
490490   segag80r_state *state = machine.driver_data<segag80r_state>();
491   UINT8 newval = machine.region("005")->base()[state->m_sound_addr];
491   UINT8 newval = state->memregion("005")->base()[state->m_sound_addr];
492492   UINT8 diff = newval ^ state->m_sound_data;
493493
494494   //mame_printf_debug("  [%03X] = %02X\n", state->m_sound_addr, newval);
r14976r14977
589589static STREAM_UPDATE( sega005_stream_update )
590590{
591591   segag80r_state *state = device->machine().driver_data<segag80r_state>();
592   const UINT8 *sound_prom = device->machine().region("proms")->base();
592   const UINT8 *sound_prom = state->memregion("proms")->base();
593593   int i;
594594
595595   /* no implementation yet */
r14976r14977
881881   tms36xx_note_w(tms, 0, data & 15);
882882
883883   /* Top four data lines address an 82S123 ROM that enables/disables voices */
884   enable_val = device->machine().region("prom")->base()[(data & 0xF0) >> 4];
884   enable_val = device->machine().root_device().memregion("prom")->base()[(data & 0xF0) >> 4];
885885   tms3617_enable_w(tms, enable_val >> 2);
886886}
887887
r14976r14977
963963      case 3:
964964         state->m_sound_addr &= 0xfff;
965965         {
966            int numroms = device->machine().region("n7751")->bytes() / 0x1000;
966            int numroms = state->memregion("n7751")->bytes() / 0x1000;
967967            if (!(data & 0x01) && numroms >= 1) state->m_sound_addr |= 0x0000;
968968            if (!(data & 0x02) && numroms >= 2) state->m_sound_addr |= 0x1000;
969969            if (!(data & 0x04) && numroms >= 3) state->m_sound_addr |= 0x2000;
r14976r14977
977977READ8_MEMBER(segag80r_state::n7751_rom_r)
978978{
979979   /* read from BUS */
980   return machine().region("n7751")->base()[m_sound_addr];
980   return memregion("n7751")->base()[m_sound_addr];
981981}
982982
983983
src/mame/audio/flower.c
r14976r14977
190190   /* extract globals from the interface */
191191   state->m_last_channel = state->m_channel_list + 8;
192192
193   state->m_sample_rom = machine.region("sound1")->base();
194   state->m_volume_rom = machine.region("sound2")->base();
193   state->m_sample_rom = machine.root_device().memregion("sound1")->base();
194   state->m_volume_rom = machine.root_device().memregion("sound2")->base();
195195
196196   /* register for savestates */
197197   for (i = 0; i < 8; i++)
src/mame/audio/dcs.c
r14976r14977
821821      /* rev 1: just reset the bank to 0 */
822822      case 1:
823823         dcs.sounddata_bank = 0;
824         memory_set_bank(machine, "databank", 0);
824         machine.root_device().membank("databank")->set_entry(0);
825825         break;
826826
827827      /* rev 2: reset the SDRC ASIC */
r14976r14977
955955   dcs.dmadac[0] = machine.device<dmadac_sound_device>("dac");
956956
957957   /* configure boot and sound ROMs */
958   dcs.bootrom = (UINT16 *)machine.region("dcs")->base();
959   dcs.bootrom_words = machine.region("dcs")->bytes() / 2;
958   dcs.bootrom = (UINT16 *)machine.root_device().memregion("dcs")->base();
959   dcs.bootrom_words = machine.root_device().memregion("dcs")->bytes() / 2;
960960   dcs.sounddata = dcs.bootrom;
961961   dcs.sounddata_words = dcs.bootrom_words;
962962   dcs.sounddata_banks = dcs.sounddata_words / 0x1000;
963   memory_configure_bank(machine, "databank", 0, dcs.sounddata_banks, dcs.sounddata, 0x1000*2);
963   machine.root_device().membank("databank")->configure_entries(0, dcs.sounddata_banks, dcs.sounddata, 0x1000*2);
964964
965965   /* create the timers */
966966   dcs.internal_timer = machine.device<timer_device>("dcs_int_timer");
r14976r14977
10081008   dcs.dmadac[1] = machine.device<dmadac_sound_device>("dac2");
10091009
10101010   /* always boot from the base of "dcs" */
1011   dcs.bootrom = (UINT16 *)machine.region("dcs")->base();
1012   dcs.bootrom_words = machine.region("dcs")->bytes() / 2;
1011   dcs.bootrom = (UINT16 *)machine.root_device().memregion("dcs")->base();
1012   dcs.bootrom_words = machine.root_device().memregion("dcs")->bytes() / 2;
10131013
10141014   /* supports both RAM and ROM variants */
10151015   if (dram_in_mb != 0)
r14976r14977
10241024   }
10251025   dcs.sounddata_banks = dcs.sounddata_words / soundbank_words;
10261026   if (dcs.rev != 2)
1027      memory_configure_bank(machine, "databank", 0, dcs.sounddata_banks, dcs.sounddata, soundbank_words*2);
1027      machine.root_device().membank("databank")->configure_entries(0, dcs.sounddata_banks, dcs.sounddata, soundbank_words*2);
10281028
10291029   /* allocate memory for the SRAM */
10301030   dcs.sram = auto_alloc_array(machine, UINT16, 0x8000*4/2);
r14976r14977
10851085static WRITE16_HANDLER( dcs_data_bank_select_w )
10861086{
10871087   dcs.sounddata_bank = data & 0x7ff;
1088   memory_set_bank(space->machine(), "databank", dcs.sounddata_bank % dcs.sounddata_banks);
1088   space->machine().root_device().membank("databank")->set_entry(dcs.sounddata_bank % dcs.sounddata_banks);
10891089
10901090   /* bit 11 = sound board led */
10911091#if 0
r14976r14977
11121112      {
11131113         /* ROM-based; use the memory page to select from ROM */
11141114         if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
1115            memory_set_bankptr(machine, "rompage", &dcs.sounddata[(SDRC_EPM_PG * pagesize) % dcs.sounddata_words]);
1115            machine.root_device().membank("rompage")->set_base(&dcs.sounddata[(SDRC_EPM_PG * pagesize) % dcs.sounddata_words]);
11161116      }
11171117      else
11181118      {
11191119         /* RAM-based; use the ROM page to select from ROM, and the memory page to select from RAM */
11201120         if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
1121            memory_set_bankptr(machine, "rompage", &dcs.bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % dcs.bootrom_words]);
1121            machine.root_device().membank("rompage")->set_base(&dcs.bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % dcs.bootrom_words]);
11221122         if (SDRC_DM_ST != 0)
1123            memory_set_bankptr(machine, "drampage", &dcs.sounddata[(SDRC_DM_PG * 1024) % dcs.sounddata_words]);
1123            machine.root_device().membank("drampage")->set_base(&dcs.sounddata[(SDRC_DM_PG * 1024) % dcs.sounddata_words]);
11241124      }
11251125   }
11261126}
r14976r14977
13621362      /* offset 2 controls RAM pages */
13631363      case 2:
13641364         dsio.reg[2] = data;
1365         memory_set_bank(space->machine(), "databank", DSIO_DM_PG % dcs.sounddata_banks);
1365         space->machine().root_device().membank("databank")->set_entry(DSIO_DM_PG % dcs.sounddata_banks);
13661366         break;
13671367   }
13681368}
r14976r14977
14291429      /* offset 2 controls RAM pages */
14301430      case 2:
14311431         dsio.reg[2] = data;
1432         memory_set_bank(space->machine(), "databank", DENV_DM_PG % dcs.sounddata_bank);
1432         space->machine().root_device().membank("databank")->set_entry(DENV_DM_PG % dcs.sounddata_bank);
14331433         break;
14341434
14351435      /* offset 3 controls FIFO reset */
src/mame/audio/targ.c
r14976r14977
115115   if ((data & 0x01) && !(port_2_last & 0x01))
116116   {
117117      samples_device *samples = space->machine().device<samples_device>("samples");
118      UINT8 *prom = space->machine().region("targ")->base();
118      UINT8 *prom = space->machine().root_device().memregion("targ")->base();
119119
120120      tone_pointer = (tone_pointer + 1) & 0x0f;
121121
src/mame/audio/cinemat.c
r14976r14977
16121612
16131613   /* this patch prevents the sound ROM from eating itself when command $0A is sent */
16141614   /* on a cube rotate */
1615   machine.region("audiocpu")->base()[0x11dc] = 0x09;
1615   state->memregion("audiocpu")->base()[0x11dc] = 0x09;
16161616}
16171617
16181618
src/mame/audio/circus.c
r14976r14977
174174{
175175
176176   m_clown_z = (data & 0x0f);
177   *(machine().region("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG
177   *(machine().root_device().memregion("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG
178178
179179   /* Bits 4-6 enable/disable trigger different events */
180180   switch (m_game_id)
src/mame/audio/midway.c
r14976r14977
231231   //
232232
233233   // loop over all possible values of the duty cycle
234   UINT8 *prom = machine().region("proms")->base();
234   UINT8 *prom = memregion("proms")->base();
235235   for (int volval = 0; volval < 16; volval++)
236236   {
237237      // loop over all the clocks until we run out; look up in the PROM
r14976r14977
449449
450450
451451//-------------------------------------------------
452//  ROM definitions
453//-------------------------------------------------
454
455ROM_START( midway_ssio )
456   ROM_REGION( 0x0020, "proms", 0 )
457   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
458ROM_END
459
460
461//-------------------------------------------------
462//  device_rom_region - return a pointer to the
463//  the device's ROM definitions
464//-------------------------------------------------
465
466const rom_entry *midway_ssio_device::device_rom_region() const
467{
468   return ROM_NAME(midway_ssio);
469}
470
471
472//-------------------------------------------------
452473//  device_mconfig_additions - return a pointer to
453474//  the device's machine fragment
454475//-------------------------------------------------
src/mame/audio/midway.h
r14976r14977
121121
122122protected:
123123   // device-level overrides
124   virtual const rom_entry *device_rom_region() const;
124125   virtual machine_config_constructor device_mconfig_additions() const;
125126   virtual ioport_constructor device_input_ports() const;
126127   virtual void device_start();
src/mame/audio/snk6502.c
r14976r14977
654654   snk6502_sound_state *state = get_safe_token(device);
655655
656656   state->m_samples = device->machine().device<samples_device>("samples");
657   state->m_ROM = device->machine().region("snk6502")->base();
657   state->m_ROM = device->machine().root_device().memregion("snk6502")->base();
658658
659659   // adjusted
660660   snk6502_set_music_freq(device->machine(), 43000);
src/mame/audio/exidy440.c
r14976r14977
175175   state->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock(), NULL, channel_update);
176176
177177   /* allocate the sample cache */
178   length = machine.region("cvsd")->bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
178   length = machine.root_device().memregion("cvsd")->bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry);
179179   state->sound_cache = (sound_cache_entry *)auto_alloc_array(machine, UINT8, length);
180180
181181   /* determine the hard end of the cache and reset */
r14976r14977
696696      if (current->address == address && current->length == length && current->bits == bits && current->frequency == frequency)
697697         return current->data;
698698
699   return add_to_sound_cache(device, &device->machine().region("cvsd")->base()[address], address, length, bits, frequency);
699   return add_to_sound_cache(device, &device->machine().root_device().memregion("cvsd")->base()[address], address, length, bits, frequency);
700700}
701701
702702
src/mame/audio/cclimber.c
r14976r14977
1717{
1818   running_machine &machine = device.machine();
1919   samplebuf = 0;
20   if (machine.region("samples")->base())
21      samplebuf = auto_alloc_array(machine, INT16, 2 * machine.region("samples")->bytes());
20   if (machine.root_device().memregion("samples")->base())
21      samplebuf = auto_alloc_array(machine, INT16, 2 * machine.root_device().memregion("samples")->bytes());
2222}
2323
2424
2525static void cclimber_play_sample(running_machine &machine, int start,int freq,int volume)
2626{
2727   int len;
28   int romlen = machine.region("samples")->bytes();
29   const UINT8 *rom = machine.region("samples")->base();
28   int romlen = machine.root_device().memregion("samples")->bytes();
29   const UINT8 *rom = machine.root_device().memregion("samples")->base();
3030   samples_device *samples = machine.device<samples_device>("samples");
3131
3232
src/mame/audio/dkong.c
r14976r14977
11161116{
11171117   dkong_state *state = machine.driver_data<dkong_state>();
11181118
1119   state->m_snd_rom = machine.region("soundcpu")->base();
1119   state->m_snd_rom = state->memregion("soundcpu")->base();
11201120}
11211121
11221122
src/mame/audio/harddriv.c
r14976r14977
2424void hdsnd_init(running_machine &machine)
2525{
2626   harddriv_state *state = machine.driver_data<harddriv_state>();
27   state->m_rombase = (UINT8 *)machine.region("serialroms")->base();
28   state->m_romsize = machine.region("serialroms")->bytes();
27   state->m_rombase = (UINT8 *)state->memregion("serialroms")->base();
28   state->m_romsize = state->memregion("serialroms")->bytes();
2929}
3030
3131
src/mame/audio/m72.c
r14976r14977
124124{
125125   m72_audio_state *state = get_safe_token(device);
126126
127   state->samples = device->machine().region("samples")->base();
128   state->samples_size = device->machine().region("samples")->bytes();
127   state->samples = device->machine().root_device().memregion("samples")->base();
128   state->samples_size = device->machine().root_device().memregion("samples")->bytes();
129129   state->space = device->machine().device("soundcpu")->memory().space(AS_IO);
130130   state->dac = device->machine().device("dac");
131131
src/mame/audio/snes_snd.c
r14976r14977
11711171         if ((data & 0x80) != (spc700->ram[0xf1] & 0x80))
11721172         {
11731173            if (data & 0x80)
1174               memcpy(spc700->ipl_region, device->machine().region("user5")->base(), 64);
1174               memcpy(spc700->ipl_region, device->machine().root_device().memregion("user5")->base(), 64);
11751175            else
11761176               memcpy(spc700->ipl_region, &spc700->ram[0xffc0], 64);
11771177         }
r14976r14977
13191319   spc700->ram[0xf1] = 0x80;
13201320
13211321   /* put IPL image at the top of RAM */
1322   memcpy(spc700->ipl_region, machine.region("user5")->base(), 64);
1322   memcpy(spc700->ipl_region, machine.root_device().memregion("user5")->base(), 64);
13231323
13241324   /* Initialize the timers */
13251325   spc700->timer[0] = machine.scheduler().timer_alloc(FUNC(snes_spc_timer), spc700);
src/mame/audio/williams.c
r14976r14977
146146
147147WRITE8_MEMBER(williams_cvsd_sound_device::bank_select_w)
148148{
149   subbank("rombank")->set_entry(data & 0x0f);
149   membank("rombank")->set_entry(data & 0x0f);
150150}
151151
152152
r14976r14977
302302void williams_cvsd_sound_device::device_start()
303303{
304304   // configure master CPU banks
305   UINT8 *rom = subregion("cpu")->base();
305   UINT8 *rom = memregion("cpu")->base();
306306   for (int bank = 0; bank < 16; bank++)
307307   {
308308      //
r14976r14977
311311        //  D3 -> A16
312312        //
313313      offs_t offset = 0x8000 * ((bank >> 2) & 3) + 0x20000 * (bank & 3);
314      subbank("rombank")->configure_entry(bank, &rom[0x10000 + offset]);
314      membank("rombank")->configure_entry(bank, &rom[0x10000 + offset]);
315315   }
316   subbank("rombank")->set_entry(0);
316   membank("rombank")->set_entry(0);
317317
318318   // reset the IRQ state
319319   m_pia->ca1_w(1);
r14976r14977
427427
428428WRITE8_MEMBER(williams_narc_sound_device::master_bank_select_w)
429429{
430   subbank("masterbank")->set_entry(data & 0x0f);
430   membank("masterbank")->set_entry(data & 0x0f);
431431}
432432
433433
r14976r14977
438438
439439WRITE8_MEMBER(williams_narc_sound_device::slave_bank_select_w)
440440{
441   subbank("slavebank")->set_entry(data & 0x0f);
441   membank("slavebank")->set_entry(data & 0x0f);
442442}
443443
444444
r14976r14977
650650void williams_narc_sound_device::device_start()
651651{
652652   // configure master CPU banks
653   UINT8 *rom = subregion("cpu0")->base();
653   UINT8 *rom = memregion("cpu0")->base();
654654   for (int bank = 0; bank < 16; bank++)
655655   {
656656      //
r14976r14977
659659        //  D3 -> A16
660660        //
661661      offs_t offset = 0x8000 * (bank & 1) + 0x10000 * ((bank >> 3) & 1) + 0x20000 * ((bank >> 1) & 3);
662      subbank("masterbank")->configure_entry(bank, &rom[0x10000 + offset]);
662      membank("masterbank")->configure_entry(bank, &rom[0x10000 + offset]);
663663   }
664   subbank("masterupper")->set_base(&rom[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
664   membank("masterupper")->set_base(&rom[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
665665
666666   // configure slave CPU banks
667   rom = subregion("cpu1")->base();
667   rom = memregion("cpu1")->base();
668668   for (int bank = 0; bank < 16; bank++)
669669   {
670670      //
r14976r14977
673673        //  D3 -> A16
674674        //
675675      offs_t offset = 0x8000 * (bank & 1) + 0x10000 * ((bank >> 3) & 1) + 0x20000 * ((bank >> 1) & 3);
676      subbank("slavebank")->configure_entry(bank, &rom[0x10000 + offset]);
676      membank("slavebank")->configure_entry(bank, &rom[0x10000 + offset]);
677677   }
678   subbank("slaveupper")->set_base(&rom[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
678   membank("slaveupper")->set_base(&rom[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
679679
680680   // register for save states
681681   save_item(NAME(m_latch));
r14976r14977
800800
801801WRITE8_MEMBER(williams_adpcm_sound_device::bank_select_w)
802802{
803   subbank("rombank")->set_entry(data & 0x07);
803   membank("rombank")->set_entry(data & 0x07);
804804}
805805
806806
r14976r14977
811811
812812WRITE8_MEMBER(williams_adpcm_sound_device::oki6295_bank_select_w)
813813{
814   subbank("okibank")->set_entry(data & 7);
814   membank("okibank")->set_entry(data & 7);
815815}
816816
817817
r14976r14977
929929void williams_adpcm_sound_device::device_start()
930930{
931931   // configure banks
932   UINT8 *rom = subregion("cpu")->base();
933   subbank("rombank")->configure_entries(0, 8, &rom[0x10000], 0x8000);
934   subbank("romupper")->set_base(&rom[0x10000 + 0x4000 + 7 * 0x8000]);
932   UINT8 *rom = memregion("cpu")->base();
933   membank("rombank")->configure_entries(0, 8, &rom[0x10000], 0x8000);
934   membank("romupper")->set_base(&rom[0x10000 + 0x4000 + 7 * 0x8000]);
935935
936936   // expand ADPCM data
937   rom = subregion("oki")->base();
937   rom = memregion("oki")->base();
938938   // it is assumed that U12 is loaded @ 0x00000 and U13 is loaded @ 0x40000
939   subbank("okibank")->configure_entry(0, &rom[0x40000]);
940   subbank("okibank")->configure_entry(1, &rom[0x40000]);
941   subbank("okibank")->configure_entry(2, &rom[0x20000]);
942   subbank("okibank")->configure_entry(3, &rom[0x00000]);
943   subbank("okibank")->configure_entry(4, &rom[0xe0000]);
944   subbank("okibank")->configure_entry(5, &rom[0xc0000]);
945   subbank("okibank")->configure_entry(6, &rom[0xa0000]);
946   subbank("okibank")->configure_entry(7, &rom[0x80000]);
939   membank("okibank")->configure_entry(0, &rom[0x40000]);
940   membank("okibank")->configure_entry(1, &rom[0x40000]);
941   membank("okibank")->configure_entry(2, &rom[0x20000]);
942   membank("okibank")->configure_entry(3, &rom[0x00000]);
943   membank("okibank")->configure_entry(4, &rom[0xe0000]);
944   membank("okibank")->configure_entry(5, &rom[0xc0000]);
945   membank("okibank")->configure_entry(6, &rom[0xa0000]);
946   membank("okibank")->configure_entry(7, &rom[0x80000]);
947947
948948   // register for save states
949949   save_item(NAME(m_latch));
src/mame/audio/mario.c
r14976r14977
402402   //printf("ea: %d\n", ea);
403403   //cputag_set_input_line(machine, "audiocpu", MCS48_INPUT_EA, (ea) ? ASSERT_LINE : CLEAR_LINE);
404404   if (state->m_eabank != NULL)
405      memory_set_bank(space.machine(), state->m_eabank, ea);
405      state->membank(state->m_eabank)->set_entry(ea);
406406}
407407
408408/****************************************************************
r14976r14977
416416   mario_state   *state = machine.driver_data<mario_state>();
417417   device_t *audiocpu = machine.device("audiocpu");
418418#if USE_8039
419   UINT8 *SND = machine.region("audiocpu")->base();
419   UINT8 *SND = machine.root_device().memregion("audiocpu")->base();
420420
421421   SND[0x1001] = 0x01;
422422#endif
r14976r14977
426426   {
427427      state->m_eabank = "bank1";
428428      audiocpu->memory().space(AS_PROGRAM)->install_read_bank(0x000, 0x7ff, "bank1");
429      memory_configure_bank(machine, "bank1", 0, 1, machine.region("audiocpu")->base(), 0);
430       memory_configure_bank(machine, "bank1", 1, 1, machine.region("audiocpu")->base() + 0x1000, 0x800);
429      state->membank("bank1")->configure_entry(0, machine.root_device().memregion("audiocpu")->base());
430       state->membank("bank1")->configure_entry(1, state->memregion("audiocpu")->base() + 0x1000);
431431   }
432432
433433    state->save_item(NAME(state->m_last));
r14976r14977
482482
483483READ8_MEMBER(mario_state::mario_sh_tune_r)
484484{
485   UINT8 *SND = machine().region("audiocpu")->base();
486   UINT16 mask = machine().region("audiocpu")->bytes()-1;
485   UINT8 *SND = memregion("audiocpu")->base();
486   UINT16 mask = memregion("audiocpu")->bytes()-1;
487487   UINT8 p2 = I8035_P2_R(*&space);
488488
489489   if ((p2 >> 7) & 1)
src/mame/audio/polepos.c
r14976r14977
8080   /* determine the volume */
8181   slot = (state->m_sample_msb >> 3) & 7;
8282   volume = volume_table[slot];
83   base = &device->machine().region("engine")->base()[slot * 0x800];
83   base = &device->machine().root_device().memregion("engine")->base()[slot * 0x800];
8484
8585   /* fill in the sample */
8686   while (samples--)
src/mame/machine/segacrp2.c
r14976r14977
6161
6262
6363   address_space *space = machine.device(cputag)->memory().space(AS_PROGRAM);
64   UINT8 *rom = machine.region(cputag)->base();
64   UINT8 *rom = machine.root_device().memregion(cputag)->base();
6565   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x8000);
6666
6767   space->set_decrypted_region(0x0000, 0x7fff, decrypted);
src/mame/machine/nmk004.c
r14976r14977
175175
176176      if (sample != 0)
177177      {
178         UINT8 *rom = NMK004_state.machine().region((chip == 0) ? "oki1" : "oki2")->base();
178         UINT8 *rom = NMK004_state.machine().root_device().memregion((chip == 0) ? "oki1" : "oki2")->base();
179179         int bank = (byte2 & 0x0c) >> 2;
180180         int vol = (byte2 & 0x70) >> 4;
181181
r14976r14977
10331033   NMK004_state.oki1device = machine.device<okim6295_device>("oki1");
10341034   NMK004_state.oki2device = machine.device<okim6295_device>("oki2");
10351035
1036   NMK004_state.rom = machine.region("audiocpu")->base();
1036   NMK004_state.rom = machine.root_device().memregion("audiocpu")->base();
10371037
10381038   ym2203_control_port_w(NMK004_state.ymdevice, 0, 0x2f);
10391039
src/mame/machine/fd1089.c
r14976r14977
405405static void sys16_decrypt(running_machine &machine, const UINT8 *key,int cputype)
406406{
407407   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
408   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
409   int size = machine.region("maincpu")->bytes();
408   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
409   int size = machine.root_device().memregion("maincpu")->bytes();
410410   int A;
411411   decrypted = auto_alloc_array(machine, UINT16, size/2);
412412
r14976r14977
432432
433433void fd1089a_decrypt(running_machine &machine)
434434{
435   sys16_decrypt(machine, machine.region("fd1089a")->base(), FD1089A);
435   sys16_decrypt(machine, machine.root_device().memregion("fd1089a")->base(), FD1089A);
436436}
437437
438438void fd1089b_decrypt(running_machine &machine)
439439{
440   sys16_decrypt(machine, machine.region("fd1089b")->base(), FD1089B);
440   sys16_decrypt(machine, machine.root_device().memregion("fd1089b")->base(), FD1089B);
441441}
442442
src/mame/machine/stvprot.c
r14976r14977
114114
115115static READ32_HANDLER( twcup98_prot_r )
116116{
117   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
117   UINT32 *ROM = (UINT32 *)space->machine().root_device().memregion("abus")->base();
118118
119119   if(a_bus[0] & 0x00010000)//protection calculation is activated
120120   {
r14976r14977
173173
174174static READ32_HANDLER( sss_prot_r )
175175{
176   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
176   UINT32 *ROM = (UINT32 *)space->machine().root_device().memregion("abus")->base();
177177
178178   if(a_bus[0] & 0x00010000)//protection calculation is activated
179179   {
r14976r14977
238238
239239static READ32_HANDLER( rsgun_prot_r )
240240{
241   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
241   UINT32 *ROM = (UINT32 *)space->machine().root_device().memregion("abus")->base();
242242
243243   if(a_bus[0] & 0x00010000)//protection calculation is activated
244244   {
r14976r14977
313313
314314static READ32_HANDLER( elandore_prot_r )
315315{
316   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
316   UINT32 *ROM = (UINT32 *)space->machine().root_device().memregion("abus")->base();
317317
318318   if(a_bus[0] & 0x00010000)//protection calculation is activated
319319   {
r14976r14977
420420
421421static READ32_HANDLER( ffreveng_prot_r )
422422{
423   UINT32 *ROM = (UINT32 *)space->machine().region("abus")->base();
423   UINT32 *ROM = (UINT32 *)space->machine().root_device().memregion("abus")->base();
424424
425425   if(a_bus[0] & 0x00010000)//protection calculation is activated
426426   {
r14976r14977
485485   if ( offset == 3 && ctrl_index != -1 )
486486   {
487487      UINT32 data = 0;
488      UINT32 *prot_data = (UINT32 *)space->machine().region("user2")->base();
488      UINT32 *prot_data = (UINT32 *)space->machine().root_device().memregion("user2")->base();
489489
490490      data = prot_data[ctrl_index++];
491491
492      if ( ctrl_index >= space->machine().region("user2")->bytes()/4 )
492      if ( ctrl_index >= space->machine().root_device().memregion("user2")->bytes()/4 )
493493      {
494494         ctrl_index = -1;
495495      }
r14976r14977
533533{
534534   // the offsets written to the protection device definitely only refer to 2 of the roms
535535   //  it's a fair assumption to say that only those 2 are connected to the protection device
536   UINT8 *ROM = (UINT8 *)space->machine().region("abus")->base()+0x1000000;
536   UINT8 *ROM = (UINT8 *)space->machine().root_device().memregion("abus")->base()+0x1000000;
537537
538538   if (offset==2)
539539   {
src/mame/machine/snes7110.c
r14976r14977
276276
277277static UINT8 SPC7110Decomp_dataread(SPC7110Decomp *thisptr)
278278{
279   UINT8 *ROM = thisptr->machine().region("cart")->base();
279   UINT8 *ROM = thisptr->machine().root_device().memregion("cart")->base();
280280   UINT32 size = thisptr->rom_size - 0x100000;
281281   while(thisptr->decomp_offset >= size)
282282   {
r14976r14977
10711071static UINT8 spc7110_mmio_read(address_space *space, UINT32 addr)
10721072{
10731073   running_machine &machine = space->machine();
1074   UINT8 *ROM = machine.region("cart")->base();
1074   UINT8 *ROM = machine.root_device().memregion("cart")->base();
10751075
10761076   addr &= 0xffff;
10771077
r14976r14977
12571257
12581258static void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data)
12591259{
1260   UINT8 *ROM = machine.region("cart")->base();
1260   UINT8 *ROM = machine.root_device().memregion("cart")->base();
12611261
12621262   addr &= 0xffff;
12631263
r14976r14977
16431643
16441644static UINT8 spc7110_bank7_read(address_space *space, UINT32 offset)
16451645{
1646   UINT8 *ROM = space->machine().region("cart")->base();
1646   UINT8 *ROM = space->machine().root_device().memregion("cart")->base();
16471647   UINT32 addr = offset & 0x0fffff;
16481648
16491649   switch (offset & 0xf00000)
src/mame/machine/bublbobl.c
r14976r14977
1616{
1717
1818   /* bits 0-2 select ROM bank */
19   memory_set_bank(machine(), "bank1", (data ^ 4) & 7);
19   membank("bank1")->set_entry((data ^ 4) & 7);
2020
2121   /* bit 3 n.c. */
2222
r14976r14977
3737WRITE8_MEMBER(bublbobl_state::tokio_bankswitch_w)
3838{
3939   /* bits 0-2 select ROM bank */
40   memory_set_bank(machine(), "bank1", data & 7);
40   membank("bank1")->set_entry(data & 7);
4141
4242   /* bits 3-7 unknown */
4343}
src/mame/machine/3do.c
r14976r14977
121121      case 0:      /* Boot ROM writes 03180000 here and then starts reading some things */
122122      {
123123         /* disable ROM overlay */
124         memory_set_bank(machine(), "bank1", 0);
124         membank("bank1")->set_entry(0);
125125      }
126126      m_slow2.cg_input = m_slow2.cg_input << 1 | ( data & 0x00000001 );
127127      m_slow2.cg_w_count ++;
src/mame/machine/tnzs.c
r14976r14977
535535DRIVER_INIT( kabukiz )
536536{
537537   tnzs_state *state = machine.driver_data<tnzs_state>();
538   UINT8 *SOUND = machine.region("audiocpu")->base();
538   UINT8 *SOUND = state->memregion("audiocpu")->base();
539539   state->m_mcu_type = MCU_NONE_KABUKIZ;
540540
541   memory_configure_bank(machine, "bank3", 0, 8, &SOUND[0x10000], 0x4000);
541   state->membank("bank3")->configure_entries(0, 8, &SOUND[0x10000], 0x4000);
542542}
543543
544544DRIVER_INIT( insectx )
r14976r14977
659659   tnzs_state *state = machine.driver_data<tnzs_state>();
660660   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
661661
662   memory_set_bank(machine, "bank1", state->m_bank1);
663   memory_set_bank(machine, "bank2", state->m_bank2);
662   state->membank("bank1")->set_entry(state->m_bank1);
663   state->membank("bank2")->set_entry(state->m_bank2);
664664
665665   if (state->m_bank1 <= 1)
666666      space->install_write_bank(0x8000, 0xbfff, "bank1");
r14976r14977
671671MACHINE_START( tnzs )
672672{
673673   tnzs_state *state = machine.driver_data<tnzs_state>();
674   UINT8 *ROM = machine.region("maincpu")->base();
675   UINT8 *SUB = machine.region("sub")->base();
674   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
675   UINT8 *SUB = state->memregion("sub")->base();
676676
677   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
678   memory_configure_bank(machine, "bank2", 0, 4, &SUB[0x10000], 0x2000);
677   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
678   state->membank("bank2")->configure_entries(0, 4, &SUB[0x10000], 0x2000);
679679
680   memory_set_bank(machine, "bank1", 2);
681   memory_set_bank(machine, "bank2", 0);
680   state->membank("bank1")->set_entry(2);
681   state->membank("bank2")->set_entry(0);
682682
683683   state->m_bank1 = 2;
684684   state->m_bank2 = 0;
r14976r14977
709709MACHINE_START( jpopnics )
710710{
711711   tnzs_state *state = machine.driver_data<tnzs_state>();
712   UINT8 *ROM = machine.region("maincpu")->base();
713   UINT8 *SUB = machine.region("sub")->base();
712   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
713   UINT8 *SUB = state->memregion("sub")->base();
714714
715   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
716   memory_configure_bank(machine, "bank2", 0, 4, &SUB[0x10000], 0x2000);
715   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
716   state->membank("bank2")->configure_entries(0, 4, &SUB[0x10000], 0x2000);
717717
718718   state->m_subcpu = machine.device("sub");
719719   state->m_mcu = NULL;
r14976r14977
742742
743743   /* bits 0-2 select RAM/ROM bank */
744744   m_bank1 = data & 0x07;
745   memory_set_bank(machine(), "bank1", m_bank1);
745   membank("bank1")->set_entry(m_bank1);
746746
747747   if (m_bank1 <= 1)
748748      space.install_write_bank(0x8000, 0xbfff, "bank1");
r14976r14977
798798
799799   /* bits 0-1 select ROM bank */
800800   m_bank2 = data & 0x03;
801   memory_set_bank(machine(), "bank2", m_bank2);
801   membank("bank2")->set_entry(m_bank2);
802802}
src/mame/machine/midyunit.c
r14976r14977
250250   int i;
251251
252252   /* load graphics ROMs */
253   base = machine.region("gfx1")->base();
253   base = state->memregion("gfx1")->base();
254254   switch (bpp)
255255   {
256256      case 4:
r14976r14977
298298   {
299299      case SOUND_CVSD_SMALL:
300300         machine.device("cvsd:cpu")->memory().space(AS_PROGRAM)->install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w),state));
301         state->m_cvsd_protection_base = machine.region("cvsdcpu")->base() + 0x10000 + (prot_start - 0x8000);
301         state->m_cvsd_protection_base = machine.root_device().memregion("cvsdcpu")->base() + 0x10000 + (prot_start - 0x8000);
302302         break;
303303
304304      case SOUND_CVSD:
src/mame/machine/naomi.c
r14976r14977
8787static void create_pic_from_retdat(running_machine& machine)
8888{
8989   {
90      UINT8* hexregion = machine.region("pichex")->base();
91      UINT8* retregion = machine.region("picreturn")->base();
92      UINT8* newregion = machine.region("pic")->base();
90      UINT8* hexregion = machine.root_device().memregion("pichex")->base();
91      UINT8* retregion = machine.root_device().memregion("picreturn")->base();
92      UINT8* newregion = machine.root_device().memregion("pic")->base();
9393      int outcount = 0;
9494
9595      if (hexregion && retregion && newregion)
src/mame/machine/asteroid.c
r14976r14977
9696{
9797   if (data & 4)
9898   {
99      memory_set_bankptr(machine(), "bank1", m_ram2);
100      memory_set_bankptr(machine(), "bank2", m_ram1);
99      membank("bank1")->set_base(m_ram2);
100      membank("bank2")->set_base(m_ram1);
101101   }
102102   else
103103   {
104      memory_set_bankptr(machine(), "bank1", m_ram1);
105      memory_set_bankptr(machine(), "bank2", m_ram2);
104      membank("bank1")->set_base(m_ram1);
105      membank("bank2")->set_base(m_ram2);
106106   }
107107
108108   set_led_status (machine(), 0, ~data & 0x02);
r14976r14977
114114{
115115   if (data & 0x80)
116116   {
117      memory_set_bankptr(machine(), "bank1", m_ram2);
118      memory_set_bankptr(machine(), "bank2", m_ram1);
117      membank("bank1")->set_base(m_ram2);
118      membank("bank2")->set_base(m_ram1);
119119   }
120120   else
121121   {
122      memory_set_bankptr(machine(), "bank1", m_ram1);
123      memory_set_bankptr(machine(), "bank2", m_ram2);
122      membank("bank1")->set_base(m_ram1);
123      membank("bank2")->set_base(m_ram2);
124124   }
125125}
126126
src/mame/machine/mhavoc.c
r14976r14977
8787   address_space *space = machine.device("alpha")->memory().space(AS_PROGRAM);
8888   state->m_has_gamma_cpu = (machine.device("gamma") != NULL);
8989
90   memory_configure_bank(machine, "bank1", 0, 1, state->m_zram0, 0);
91   memory_configure_bank(machine, "bank1", 1, 1, state->m_zram1, 0);
92   memory_configure_bank(machine, "bank2", 0, 4, machine.region("alpha")->base() + 0x10000, 0x2000);
90   state->membank("bank1")->configure_entry(0, state->m_zram0);
91   state->membank("bank1")->configure_entry(1, state->m_zram1);
92   state->membank("bank2")->configure_entries(0, 4, state->memregion("alpha")->base() + 0x10000, 0x2000);
9393
9494   /* reset RAM/ROM banks to 0 */
9595   state->mhavoc_ram_banksel_w(*space, 0, 0);
r14976r14977
188188
189189WRITE8_MEMBER(mhavoc_state::mhavoc_ram_banksel_w)
190190{
191   memory_set_bank(machine(), "bank1", data & 1);
191   membank("bank1")->set_entry(data & 1);
192192}
193193
194194
195195WRITE8_MEMBER(mhavoc_state::mhavoc_rom_banksel_w)
196196{
197   memory_set_bank(machine(), "bank2", data & 3);
197   membank("bank2")->set_entry(data & 3);
198198}
199199
200200
src/mame/machine/bfm_comn.c
r14976r14977
2121{
2222   UINT8 *tmp, *rom;
2323
24   rom = machine.region(rom_region)->base();
24   rom = machine.root_device().memregion(rom_region)->base();
2525
2626   tmp = auto_alloc_array(machine, UINT8, 0x10000);
2727   {
src/mame/machine/neoboot.c
r14976r14977
2222void neogeo_bootleg_cx_decrypt( running_machine &machine )
2323{
2424   int i;
25   int cx_size = machine.region( "sprites" )->bytes();
26   UINT8 *rom = machine.region( "sprites" )->base();
25   int cx_size = machine.root_device().memregion( "sprites" )->bytes();
26   UINT8 *rom = machine.root_device().memregion( "sprites" )->base();
2727   UINT8 *buf = auto_alloc_array(machine, UINT8, cx_size );
2828
2929   memcpy( buf, rom, cx_size );
r14976r14977
3838
3939void neogeo_bootleg_sx_decrypt( running_machine &machine, int value )
4040{
41   int sx_size = machine.region( "fixed" )->bytes();
42   UINT8 *rom = machine.region( "fixed" )->base();
41   int sx_size = machine.root_device().memregion( "fixed" )->bytes();
42   UINT8 *rom = machine.root_device().memregion( "fixed" )->base();
4343   int i;
4444
4545   if (value == 1)
r14976r14977
7171void kog_px_decrypt( running_machine &machine )
7272{
7373   /* the protection chip does some *very* strange things to the rom */
74   UINT8 *src = machine.region("maincpu")->base();
74   UINT8 *src = machine.root_device().memregion("maincpu")->base();
7575   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x600000 );
76   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
76   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
7777   int i;
7878   static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD };
7979
r14976r14977
155155static WRITE16_HANDLER( kof10th_custom_w )
156156{
157157   if (!kof10thExtraRAMB[0xFFE]) { // Write to RAM bank A
158      UINT16 *prom = (UINT16*)space->machine().region( "maincpu" )->base();
158      UINT16 *prom = (UINT16*)space->machine().root_device().memregion( "maincpu" )->base();
159159      COMBINE_DATA(&prom[(0xE0000/2) + (offset & 0xFFFF)]);
160160   } else { // Write S data on-the-fly
161      UINT8 *srom = space->machine().region( "fixed" )->base();
161      UINT8 *srom = space->machine().root_device().memregion( "fixed" )->base();
162162      srom[offset] = BITSWAP8(data,7,6,0,4,3,2,1,5);
163163   }
164164}
r14976r14977
169169      if (offset == 0x5FFF8) { // Standard bankswitch
170170         kof10thBankswitch(space, data);
171171      } else if (offset == 0x5FFFC && kof10thExtraRAMB[0xFFC] != data) { // Special bankswitch
172         UINT8 *src = space->machine().region( "maincpu" )->base();
172         UINT8 *src = space->machine().root_device().memregion( "maincpu" )->base();
173173         memcpy (src + 0x10000,  src + ((data & 1) ? 0x810000 : 0x710000), 0xcffff);
174174      }
175175      COMBINE_DATA(&kof10thExtraRAMB[offset & 0xFFF]);
r14976r14977
187187{
188188   int i, j;
189189   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x900000);
190   UINT8 *src = machine.region( "maincpu" )->base();
190   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
191191
192192   memcpy(dst + 0x000000, src + 0x700000, 0x100000); // Correct (Verified in Uni-bios)
193193   memcpy(dst + 0x100000, src + 0x000000, 0x800000);
r14976r14977
215215void decrypt_kf10thep(running_machine &machine)
216216{
217217   int i;
218   UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
219   UINT8  *src = machine.region("maincpu")->base();
220   UINT16 *buf = (UINT16*)machine.region("audiocrypt")->base();
221   UINT8 *srom = (UINT8*)machine.region("fixed")->base();
218   UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
219   UINT8  *src = machine.root_device().memregion("maincpu")->base();
220   UINT16 *buf = (UINT16*)machine.root_device().memregion("audiocrypt")->base();
221   UINT8 *srom = (UINT8*)machine.root_device().memregion("fixed")->base();
222222   UINT8 *sbuf = auto_alloc_array(machine, UINT8, 0x20000);
223223
224224   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x200000);
r14976r14977
256256static void kf2k5uni_px_decrypt( running_machine &machine )
257257{
258258   int i, j, ofst;
259   UINT8 *src = machine.region( "maincpu" )->base();
259   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
260260   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x80);
261261
262262   for (i = 0; i < 0x800000; i+=0x80)
r14976r14977
276276static void kf2k5uni_sx_decrypt( running_machine &machine )
277277{
278278   int i;
279   UINT8 *srom = machine.region( "fixed" )->base();
279   UINT8 *srom = machine.root_device().memregion( "fixed" )->base();
280280
281281   for (i = 0; i < 0x20000; i++)
282282      srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
r14976r14977
285285static void kf2k5uni_mx_decrypt( running_machine &machine )
286286{
287287   int i;
288   UINT8 *mrom = machine.region( "audiocpu" )->base();
288   UINT8 *mrom = machine.root_device().memregion( "audiocpu" )->base();
289289
290290   for (i = 0; i < 0x30000; i++)
291291      mrom[i] = BITSWAP8(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3);
r14976r14977
343343{
344344   int i,j;
345345
346   UINT8 *src = machine.region("maincpu")->base();
346   UINT8 *src = machine.root_device().memregion("maincpu")->base();
347347   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x80);
348348
349349   memmove(src, src + 0x300000, 0x500000);
r14976r14977
366366
367367void kf2k2mp2_px_decrypt( running_machine &machine )
368368{
369   UINT8 *src = machine.region("maincpu")->base();
369   UINT8 *src = machine.root_device().memregion("maincpu")->base();
370370   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x600000);
371371
372372   memcpy (dst + 0x000000, src + 0x1C0000, 0x040000);
r14976r14977
388388   int tilesize=128;
389389
390390   UINT8* rom = auto_alloc_array(machine, UINT8, 16*tilesize);   // 16 tiles buffer
391   UINT8* realrom = machine.region("sprites")->base() + start*tilesize;
391   UINT8* realrom = machine.root_device().memregion("sprites")->base() + start*tilesize;
392392
393393   for (i = 0; i < (end-start)/16; i++) {
394394      for (j = 0; j < 16; j++) {
r14976r14977
441441
442442void decrypt_cthd2003( running_machine &machine )
443443{
444   UINT8 *romdata = machine.region("fixed")->base();
444   UINT8 *romdata = machine.root_device().memregion("fixed")->base();
445445   UINT8 *tmp = auto_alloc_array(machine, UINT8, 8*128*128);
446446
447447   memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
r14976r14977
450450   memcpy(tmp+8*96*128, romdata+8*96*128, 8*32*128);
451451   memcpy(romdata, tmp, 8*128*128);
452452
453   romdata = machine.region("audiocpu")->base()+0x10000;
453   romdata = machine.root_device().memregion("audiocpu")->base()+0x10000;
454454   memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
455455   memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128);
456456   memcpy(tmp+8*64*128, romdata+8*32*128, 8*32*128);
r14976r14977
482482{
483483   /* patches thanks to razoola */
484484   int i;
485   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
485   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
486486
487487   /* special ROM banking handler */
488488   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2ffff0, 0x2fffff, FUNC(cthd2003_bankswitch_w));
r14976r14977
525525
526526static void ct2k3sp_sx_decrypt( running_machine &machine )
527527{
528   int rom_size = machine.region( "fixed" )->bytes();
529   UINT8 *rom = machine.region( "fixed" )->base();
528   int rom_size = machine.root_device().memregion( "fixed" )->bytes();
529   UINT8 *rom = machine.root_device().memregion( "fixed" )->base();
530530   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
531531   int i;
532532   int ofst;
r14976r14977
555555
556556void decrypt_ct2k3sp( running_machine &machine )
557557{
558   UINT8 *romdata = machine.region("audiocpu")->base()+0x10000;
558   UINT8 *romdata = machine.root_device().memregion("audiocpu")->base()+0x10000;
559559   UINT8*tmp = auto_alloc_array(machine, UINT8, 8*128*128);
560560   memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
561561   memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128);
r14976r14977
575575
576576void decrypt_ct2k3sa( running_machine &machine )
577577{
578   UINT8 *romdata = machine.region("audiocpu")->base()+0x10000;
578   UINT8 *romdata = machine.root_device().memregion("audiocpu")->base()+0x10000;
579579   UINT8*tmp = auto_alloc_array(machine, UINT8, 8*128*128);
580580   memcpy(tmp+8*0*128, romdata+8*0*128, 8*32*128);
581581   memcpy(tmp+8*32*128, romdata+8*64*128, 8*32*128);
r14976r14977
592592{
593593   /* patches thanks to razoola - same as for cthd2003*/
594594   int i;
595   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
595   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
596596
597597   // theres still a problem on the character select screen but it seems to be related to cpu core timing issues,
598598   // overclocking the 68k prevents it.
r14976r14977
633633
634634void decrypt_kof2k4se_68k( running_machine &machine )
635635{
636   UINT8 *src = machine.region("maincpu")->base()+0x100000;
636   UINT8 *src = machine.root_device().memregion("maincpu")->base()+0x100000;
637637   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x400000);
638638   int i;
639639   static const int sec[] = {0x300000,0x200000,0x100000,0x000000};
r14976r14977
653653void lans2004_vx_decrypt( running_machine &machine )
654654{
655655   int i;
656   UINT8 *rom = machine.region( "ymsnd" )->base();
656   UINT8 *rom = machine.root_device().memregion( "ymsnd" )->base();
657657   for (i = 0; i < 0xA00000; i++)
658658      rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
659659}
r14976r14977
662662{
663663   /* Descrambling P ROMs - Thanks to Razoola for the info */
664664   int i;
665   UINT8 *src = machine.region( "maincpu" )->base();
666   UINT16 *rom = (UINT16*)machine.region( "maincpu" )->base();
665   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
666   UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base();
667667   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x600000);
668668
669669   {
r14976r14977
742742      0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00
743743   };
744744   int i;
745   int size = machine.region( "maincpu" )->bytes();
746   UINT8 *src = machine.region( "maincpu" )->base();
745   int size = machine.root_device().memregion( "maincpu" )->bytes();
746   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
747747   UINT8 *dst = auto_alloc_array(machine, UINT8,  size );
748748   int ofst;
749749   for( i = 0; i < size / 0x100000; i++ ){
r14976r14977
771771      { 3, 0, 2, 1 },
772772   };
773773   int i;
774   int size = machine.region( "sprites" )->bytes();
775   UINT8 *src = machine.region( "sprites" )->base();
774   int size = machine.root_device().memregion( "sprites" )->bytes();
775   UINT8 *src = machine.root_device().memregion( "sprites" )->base();
776776   UINT8 *dst = auto_alloc_array(machine, UINT8,  size );
777777   int ofst;
778778   memcpy( dst, src, size );
r14976r14977
798798   static const int sec[] = {
799799      0x00, 0x03, 0x02, 0x05, 0x04, 0x01
800800   };
801   int size = machine.region( "maincpu" )->bytes();
802   UINT8 *src = machine.region( "maincpu" )->base();
801   int size = machine.root_device().memregion( "maincpu" )->bytes();
802   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
803803   UINT8 *dst = auto_alloc_array(machine, UINT8,  size );
804804   int i;
805805   int ofst;
r14976r14977
822822void svcplus_px_hack( running_machine &machine )
823823{
824824   /* patched by the protection chip? */
825   UINT8 *src = machine.region( "maincpu" )->base();
825   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
826826   src[ 0x0f8010 ] = 0x40;
827827   src[ 0x0f8011 ] = 0x04;
828828   src[ 0x0f8012 ] = 0x00;
r14976r14977
843843   static const int sec[] = {
844844      0x01, 0x02, 0x03, 0x04, 0x05, 0x00
845845   };
846   int size = machine.region( "maincpu" )->bytes();
847   UINT8 *src = machine.region( "maincpu" )->base();
846   int size = machine.root_device().memregion( "maincpu" )->bytes();
847   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
848848   UINT8 *dst = auto_alloc_array(machine, UINT8,  size );
849849   memcpy( dst, src, size );
850850   for( i = 0; i < 6; i++ ){
r14976r14977
862862   static const int sec[] = {
863863      0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00
864864   };
865   int size = machine.region( "maincpu" )->bytes();
866   UINT8 *src = machine.region( "maincpu" )->base();
865   int size = machine.root_device().memregion( "maincpu" )->bytes();
866   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
867867   UINT8 *dst = auto_alloc_array(machine, UINT8,  size );
868868   int i;
869869   int ofst;
r14976r14977
882882void svcsplus_px_hack( running_machine &machine )
883883{
884884   /* patched by the protection chip? */
885   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
885   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
886886   mem16[0x9e90/2] = 0x000f;
887887   mem16[0x9e92/2] = 0xc9c0;
888888   mem16[0xa10c/2] = 0x4eb9;
r14976r14977
924924      UINT8* cr = (UINT8 *)kof2003_tbl;
925925      UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff1)];
926926      UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)];
927      UINT8* mem = (UINT8 *)space->machine().region("maincpu")->base();
927      UINT8* mem = (UINT8 *)space->machine().root_device().memregion("maincpu")->base();
928928
929929      cr[BYTE_XOR_LE(0x1ff0)] =  0xa0;
930930      cr[BYTE_XOR_LE(0x1ff1)] &= 0xfe;
r14976r14977
942942      UINT8* cr = (UINT8 *)kof2003_tbl;
943943      UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)]<<16)|(cr[BYTE_XOR_LE(0x1ff2)]<<8)|cr[BYTE_XOR_LE(0x1ff0)];
944944      UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)];
945      UINT8* mem = (UINT8 *)space->machine().region("maincpu")->base();
945      UINT8* mem = (UINT8 *)space->machine().root_device().memregion("maincpu")->base();
946946
947947      cr[BYTE_XOR_LE(0x1ff0)] &= 0xfe;
948948      cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f;
r14976r14977
960960   };
961961
962962    int rom_size = 0x800000;
963    UINT8 *rom = machine.region( "maincpu" )->base();
963    UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
964964    UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
965965    memcpy( buf, rom, rom_size );
966966
r14976r14977
982982void kf2k3pl_px_decrypt( running_machine &machine )
983983{
984984   UINT16*tmp = auto_alloc_array(machine, UINT16, 0x100000/2);
985   UINT16*rom = (UINT16*)machine.region( "maincpu" )->base();
985   UINT16*rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base();
986986   int j;
987987   int i;
988988
r14976r14977
10101010void kf2k3upl_px_decrypt( running_machine &machine )
10111011{
10121012   {
1013      UINT8 *src = machine.region("maincpu")->base();
1013      UINT8 *src = machine.root_device().memregion("maincpu")->base();
10141014      memmove(src+0x100000, src, 0x600000);
10151015      memmove(src, src+0x700000, 0x100000);
10161016   }
r14976r14977
10191019
10201020      int ofst;
10211021      int i;
1022      UINT8 *rom = machine.region( "maincpu" )->base() + 0xfe000;
1023      UINT8 *buf = machine.region( "maincpu" )->base() + 0xd0610;
1022      UINT8 *rom = machine.root_device().memregion( "maincpu" )->base() + 0xfe000;
1023      UINT8 *buf = machine.root_device().memregion( "maincpu" )->base() + 0xd0610;
10241024
10251025      for( i = 0; i < 0x2000 / 2; i++ ){
10261026         ofst = (i & 0xff00) + BITSWAP8( (i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5 );
r14976r14977
10401040
10411041void samsho5b_px_decrypt( running_machine &machine )
10421042{
1043   int px_size = machine.region( "maincpu" )->bytes();
1044   UINT8 *rom = machine.region( "maincpu" )->base();
1043   int px_size = machine.root_device().memregion( "maincpu" )->bytes();
1044   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
10451045   UINT8 *buf = auto_alloc_array(machine, UINT8,  px_size );
10461046   int ofst;
10471047   int i;
r14976r14977
10671067
10681068void samsho5b_vx_decrypt( running_machine &machine )
10691069{
1070   int vx_size = machine.region( "ymsnd" )->bytes();
1071   UINT8 *rom = machine.region( "ymsnd" )->base();
1070   int vx_size = machine.root_device().memregion( "ymsnd" )->bytes();
1071   UINT8 *rom = machine.root_device().memregion( "ymsnd" )->base();
10721072   int i;
10731073
10741074   for( i = 0; i < vx_size; i++ )
r14976r14977
10841084void matrimbl_decrypt( running_machine &machine )
10851085{
10861086   /* decrypt Z80 */
1087   UINT8 *rom = machine.region( "audiocpu" )->base()+0x10000;
1087   UINT8 *rom = machine.root_device().memregion( "audiocpu" )->base()+0x10000;
10881088   UINT8 *buf = auto_alloc_array(machine, UINT8,  0x20000 );
10891089   int i, j=0;
10901090   memcpy( buf, rom, 0x20000 );
src/mame/machine/snesbsx.c
r14976r14977
4848static void bsx_update_memory_map(void)
4949{
5050   bsx_state.ram_source = BIT(bsx_state.cart_regs[0x01], 7) ? SNES_BSX_PRAM : SNES_BSX_FLASH;
51//  UINT8 *RAM = (bsx_state.cart_regs[0x01] & 0x80) == 0x00 ? space->machine().region("flash")->base() : bsx_state.pram;
51//  UINT8 *RAM = (bsx_state.cart_regs[0x01] & 0x80) == 0x00 ? space->machine().root_device().memregion("flash")->base() : bsx_state.pram;
5252
5353   logerror("BSX: updated memory map, current RAM: %d", bsx_state.ram_source);
5454   if (!BIT(bsx_state.cart_regs[0x02], 7))
r14976r14977
149149#ifdef UNUSED_FUNCTION
150150static READ8_HANDLER( bsx_flash_read )
151151{
152   UINT8 *FLASH = space->machine().region("flash")->base();
152   UINT8 *FLASH = space->machine().root_device().memregion("flash")->base();
153153
154154   if (offset == 0x0002)
155155   {
src/mame/machine/midtunit.c
r14976r14977
417417   register_state_saving(machine);
418418
419419   /* load the graphics ROMs -- quadruples */
420   base = machine.region("gfx1")->base();
420   base = machine.root_device().memregion("gfx1")->base();
421421   for (i = 0; i < midtunit_gfx_rom_size; i += 4)
422422   {
423423      midtunit_gfx_rom[i + 0] = base[0 * gfx_chunk + i / 4];
r14976r14977
526526   /* sound chip protection (hidden RAM) */
527527   machine.device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_read_bank(0xfbcf, 0xfbf9, "bank7");
528528   machine.device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_write_bank(0xfbcf, 0xfbf9, "bank9");
529   memory_set_bankptr(machine, "bank9", auto_alloc_array(machine, UINT8, 0x80));
529   state->membank("bank9")->set_base(auto_alloc_array(machine, UINT8, 0x80));
530530
531531#if ENABLE_ALL_JDREDD_LEVELS
532532   /* how about the final levels? */
src/mame/machine/konami1.c
r14976r14977
4343UINT8 *konami1_decode(running_machine &machine, const char *cpu)
4444{
4545   address_space *space = machine.device(cpu)->memory().space(AS_PROGRAM);
46   const UINT8 *rom = machine.region(cpu)->base();
47   int size = machine.region(cpu)->bytes();
46   const UINT8 *rom = machine.root_device().memregion(cpu)->base();
47   int size = machine.root_device().memregion(cpu)->bytes();
4848   int A;
4949
5050   UINT8 *decrypted = auto_alloc_array(machine, UINT8, size);
src/mame/machine/namcos1.c
r14976r14977
554554
555555WRITE8_MEMBER(namcos1_state::namcos1_sound_bankswitch_w)
556556{
557   UINT8 *rom = machine().region("audiocpu")->base() + 0xc000;
557   UINT8 *rom = memregion("audiocpu")->base() + 0xc000;
558558
559559   int bank = (data & 0x70) >> 4;
560   memory_set_bankptr(machine(), "bank17",rom + 0x4000 * bank);
560   membank("bank17")->set_base(rom + 0x4000 * bank);
561561}
562562
563563
r14976r14977
677677
678678   /* for BANK handlers , memory direct and OP-code base */
679679   if (handler->bank_pointer)
680      memory_set_bankptr(machine, banktags[banknum], handler->bank_pointer);
680      state->membank(banktags[banknum])->set_base(handler->bank_pointer);
681681
682682   /* read handlers */
683683   if (!handler->bank_handler_r)
r14976r14977
826826
827827   /* PRG0-PRG7 */
828828   {
829      UINT8 *rom = machine.region("user1")->base();
829      UINT8 *rom = machine.root_device().memregion("user1")->base();
830830
831831      namcos1_install_bank(state,0x200,0x3ff,0,rom_w,0,rom);
832832
r14976r14977
920920   /* bit 0-1 : address line A15-A16 */
921921   addr += (data & 3) * 0x8000;
922922
923   memory_set_bankptr(machine(), "bank20", machine().region("mcu")->base() + addr);
923   membank("bank20")->set_base(machine().root_device().memregion("mcu")->base() + addr);
924924}
925925
926926
r14976r14977
997997   state_save_register_global_pointer(machine, state->m_paletteram, 0x8000);
998998
999999   /* Point mcu & sound shared RAM to destination */
1000   memory_set_bankptr(machine,  "bank18", state->m_triram );
1001   memory_set_bankptr(machine,  "bank19", state->m_triram );
1000   state->membank("bank18")->set_base(state->m_triram );
1001   state->membank("bank19")->set_base(state->m_triram );
10021002
10031003   /* build bank elements */
10041004   namcos1_build_banks(machine,specific->key_r,specific->key_w);
r14976r14977
11261126      static const UINT8 target[8] = {0x34,0x37,0x35,0x37,0x96,0x00,0x2e,0xed};
11271127      UINT8 *rombase, *srcptr, *endptr, *scanptr;
11281128
1129      rombase = machine.region("user1")->base();
1129      rombase = machine.root_device().memregion("user1")->base();
11301130      srcptr = rombase + 0x1e000;
11311131      endptr = srcptr + 0xa000;
11321132
src/mame/machine/deco156.c
r14976r14977
124124
125125void deco156_decrypt(running_machine &machine)
126126{
127   UINT32 *rom = (UINT32 *)machine.region("maincpu")->base();
128   int length = machine.region("maincpu")->bytes();
127   UINT32 *rom = (UINT32 *)machine.root_device().memregion("maincpu")->base();
128   int length = machine.root_device().memregion("maincpu")->bytes();
129129   UINT32 *buf = auto_alloc_array(machine, UINT32, length/4);
130130
131131   memcpy(buf, rom, length);
src/mame/machine/nmk112.c
r14976r14977
120120   }
121121   else
122122   {
123      nmk112->rom0 = device->machine().region(intf->rgn0)->base();
124      nmk112->size0 = device->machine().region(intf->rgn0)->bytes() - 0x40000;
123      nmk112->rom0 = device->machine().root_device().memregion(intf->rgn0)->base();
124      nmk112->size0 = device->machine().root_device().memregion(intf->rgn0)->bytes() - 0x40000;
125125   }
126126
127127   if (intf->rgn1 == NULL)
r14976r14977
131131   }
132132   else
133133   {
134      nmk112->rom1 = device->machine().region(intf->rgn1)->base();
135      nmk112->size1 = device->machine().region(intf->rgn1)->bytes() - 0x40000;
134      nmk112->rom1 = device->machine().root_device().memregion(intf->rgn1)->base();
135      nmk112->size1 = device->machine().root_device().memregion(intf->rgn1)->bytes() - 0x40000;
136136   }
137137
138138   nmk112->page_mask = ~intf->disable_page_mask;
src/mame/machine/pgmprot1.c
r14976r14977
386386static void pgm_decode_kovlsqh2_tiles( running_machine &machine )
387387{
388388   int i, j;
389   UINT16 *src = (UINT16 *)(machine.region("tiles")->base() + 0x180000);
389   UINT16 *src = (UINT16 *)(machine.root_device().memregion("tiles")->base() + 0x180000);
390390   UINT16 *dst = auto_alloc_array(machine, UINT16, 0x800000);
391391
392392   for (i = 0; i < 0x800000 / 2; i++)
r14976r14977
421421static void pgm_decode_kovlsqh2_samples( running_machine &machine )
422422{
423423   int i;
424   UINT8 *src = (UINT8 *)(machine.region("ics")->base() + 0x400000);
424   UINT8 *src = (UINT8 *)(machine.root_device().memregion("ics")->base() + 0x400000);
425425
426426   for (i = 0; i < 0x400000; i+=2) {
427427      src[i + 0x000001] = src[i + 0x400001];
r14976r14977
433433static void pgm_decode_kovqhsgs_program( running_machine &machine )
434434{
435435   int i;
436   UINT16 *src = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
436   UINT16 *src = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
437437   UINT16 *dst = auto_alloc_array(machine, UINT16, 0x400000);
438438
439439   for (i = 0; i < 0x400000 / 2; i++)
r14976r14977
451451static void pgm_decode_kovqhsgs2_program( running_machine &machine )
452452{
453453   int i;
454   UINT16 *src = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
454   UINT16 *src = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
455455   UINT16 *dst = auto_alloc_array(machine, UINT16, 0x400000);
456456
457457   for (i = 0; i < 0x400000 / 2; i++)
r14976r14977
472472   pgm_decode_kovqhsgs2_program(machine);
473473   pgm_decode_kovlsqh2_tiles(machine);
474474
475   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x0000000);
476   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x0800000);
477   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x1000000);
478   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x1800000);
479   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x2000000);
480   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x2800000);
481   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprmask")->base() + 0x0000000);
482   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprmask")->base() + 0x0800000);
475   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x0000000);
476   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x0800000);
477   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x1000000);
478   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x1800000);
479   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x2000000);
480   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x2800000);
481   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprmask")->base() + 0x0000000);
482   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprmask")->base() + 0x0800000);
483483
484484   pgm_decode_kovlsqh2_samples(machine);
485485   pgm_basic_init(machine);
r14976r14977
493493   pgm_decode_kovqhsgs_program(machine);
494494   pgm_decode_kovlsqh2_tiles(machine);
495495
496   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x0000000);
497   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x0800000);
498   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x1000000);
499   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x1800000);
500   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x2000000);
501   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprcol")->base() + 0x2800000);
502   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprmask")->base() + 0x0000000);
503   pgm_decode_kovlsqh2_sprites(machine, machine.region("sprmask")->base() + 0x0800000);
496   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x0000000);
497   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x0800000);
498   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x1000000);
499   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x1800000);
500   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x2000000);
501   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprcol")->base() + 0x2800000);
502   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprmask")->base() + 0x0000000);
503   pgm_decode_kovlsqh2_sprites(machine, machine.root_device().memregion("sprmask")->base() + 0x0800000);
504504
505505   pgm_decode_kovlsqh2_samples(machine);
506506   pgm_basic_init(machine);
src/mame/machine/balsente.c
r14976r14977
172172   memset(state->m_noise_position, 0, sizeof(state->m_noise_position));
173173
174174   /* point the banks to bank 0 */
175   numbanks = (machine.region("maincpu")->bytes() > 0x40000) ? 16 : 8;
176   memory_configure_bank(machine, "bank1", 0, numbanks, &machine.region("maincpu")->base()[0x10000], 0x6000);
177   memory_configure_bank(machine, "bank2", 0, numbanks, &machine.region("maincpu")->base()[0x12000], 0x6000);
178   memory_set_bank(space->machine(), "bank1", 0);
179   memory_set_bank(space->machine(), "bank2", 0);
175   numbanks = (machine.root_device().memregion("maincpu")->bytes() > 0x40000) ? 16 : 8;
176   state->membank("bank1")->configure_entries(0, numbanks, &machine.root_device().memregion("maincpu")->base()[0x10000], 0x6000);
177   state->membank("bank2")->configure_entries(0, numbanks, &state->memregion("maincpu")->base()[0x12000], 0x6000);
178   state->membank("bank1")->set_entry(0);
179   state->membank("bank2")->set_entry(0);
180180   machine.device("maincpu")->reset();
181181
182182   /* start a timer to generate interrupts */
r14976r14977
280280WRITE8_MEMBER(balsente_state::balsente_rombank_select_w)
281281{
282282   /* the bank number comes from bits 4-6 */
283   memory_set_bank(machine(), "bank1", (data >> 4) & 7);
284   memory_set_bank(machine(), "bank2", (data >> 4) & 7);
283   membank("bank1")->set_entry((data >> 4) & 7);
284   membank("bank2")->set_entry((data >> 4) & 7);
285285}
286286
287287
r14976r14977
291291   int bank = data & 7;
292292
293293   /* top bit controls which half of the ROMs to use (Name that Tune only) */
294   if (machine().region("maincpu")->bytes() > 0x40000) bank |= (data >> 4) & 8;
294   if (machine().root_device().memregion("maincpu")->bytes() > 0x40000) bank |= (data >> 4) & 8;
295295
296296   /* when they set the AB bank, it appears as though the CD bank is reset */
297297   if (data & 0x20)
298298   {
299      memory_set_bank(machine(), "bank1", bank);
300      memory_set_bank(machine(), "bank2", 6);
299      membank("bank1")->set_entry(bank);
300      membank("bank2")->set_entry(6);
301301   }
302302
303303   /* set both banks */
304304   else
305305   {
306      memory_set_bank(machine(), "bank1", bank);
307      memory_set_bank(machine(), "bank2", bank);
306      membank("bank1")->set_entry(bank);
307      membank("bank2")->set_entry(bank);
308308   }
309309}
310310
src/mame/machine/vsnes.c
r14976r14977
182182   /* count determines the size of the area mapped */
183183   for (i = 0; i < count; i++)
184184   {
185      memory_set_bank(machine, chr_banknames[i + start], vrom_start_bank + i);
185      state->membank(chr_banknames[i + start])->set_entry(vrom_start_bank + i);
186186   }
187187}
188188
r14976r14977
202202
203203   ppu1_space->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt0_r),state), write8_delegate(FUNC(vsnes_state::vsnes_nt0_w),state));
204204
205   state->m_vrom[0] = machine.region("gfx1")->base();
206   state->m_vrom_size[0] = machine.region("gfx1")->bytes();
205   state->m_vrom[0] = machine.root_device().memregion("gfx1")->base();
206   state->m_vrom_size[0] = state->memregion("gfx1")->bytes();
207207   state->m_vrom_banks = state->m_vrom_size[0] / 0x400;
208208
209209   /* establish chr banks */
r14976r14977
214214      for (i = 0; i < 8; i++)
215215      {
216216         ppu1_space->install_read_bank(0x0400 * i, 0x0400 * i + 0x03ff, chr_banknames[i]);
217         memory_configure_bank(machine, chr_banknames[i], 0, state->m_vrom_banks, state->m_vrom[0], 0x400);
217         state->membank(chr_banknames[i])->configure_entries(0, state->m_vrom_banks, state->m_vrom[0], 0x400);
218218      }
219219      v_set_videorom_bank(machine, 0, 8, 0);
220220   }
r14976r14977
227227MACHINE_START( vsdual )
228228{
229229   vsnes_state *state = machine.driver_data<vsnes_state>();
230   state->m_vrom[0] = machine.region("gfx1")->base();
231   state->m_vrom[1] = machine.region("gfx2")->base();
232   state->m_vrom_size[0] = machine.region("gfx1")->bytes();
233   state->m_vrom_size[1] = machine.region("gfx2")->bytes();
230   state->m_vrom[0] = machine.root_device().memregion("gfx1")->base();
231   state->m_vrom[1] = machine.root_device().memregion("gfx2")->base();
232   state->m_vrom_size[0] = machine.root_device().memregion("gfx1")->bytes();
233   state->m_vrom_size[1] = state->memregion("gfx2")->bytes();
234234
235235   /* establish nametable ram */
236236   state->m_nt_ram[0] = auto_alloc_array(machine, UINT8, 0x1000);
r14976r14977
251251   machine.device("ppu1")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank2");
252252   // read only!
253253   machine.device("ppu2")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank3");
254   memory_configure_bank(machine, "bank2", 0, state->m_vrom_size[0] / 0x2000, state->m_vrom[0], 0x2000);
255   memory_configure_bank(machine, "bank3", 0, state->m_vrom_size[1] / 0x2000, state->m_vrom[1], 0x2000);
256   memory_set_bank(machine, "bank2", 0);
257   memory_set_bank(machine, "bank3", 0);
254   state->membank("bank2")->configure_entries(0, state->m_vrom_size[0] / 0x2000, state->m_vrom[0], 0x2000);
255   state->membank("bank3")->configure_entries(0, state->m_vrom_size[1] / 0x2000, state->m_vrom[1], 0x2000);
256   state->membank("bank2")->set_entry(0);
257   state->membank("bank3")->set_entry(0);
258258}
259259
260260/*************************************
r14976r14977
419419      case 2: /* code bank 1 */
420420      case 4: /* code bank 2 */
421421      {
422         UINT8 *prg = machine().region("maincpu")->base();
422         UINT8 *prg = memregion("maincpu")->base();
423423         memcpy(&prg[0x08000 + reg * 0x1000], &prg[bankoffset], 0x2000);
424424      }
425425      break;
r14976r14977
438438{
439439   /* We do manual banking, in case the code falls through */
440440   /* Copy the initial banks */
441   UINT8 *prg = machine.region("maincpu")->base();
441   UINT8 *prg = machine.root_device().memregion("maincpu")->base();
442442   memcpy(&prg[0x08000], &prg[0x18000], 0x8000);
443443
444444   /* banking is done with writes to the $8000-$ffff area */
r14976r14977
454454   int addr;
455455   if((data & 0x04) != m_old_bank)
456456   {
457      UINT8 *prg = machine().region("maincpu")->base();
457      UINT8 *prg = memregion("maincpu")->base();
458458      m_old_bank = data & 0x04;
459459      addr = m_old_bank ? 0x12000: 0x10000;
460460      memcpy(&prg[0x08000], &prg[addr], 0x2000);
r14976r14977
467467{
468468   vsnes_state *state = machine.driver_data<vsnes_state>();
469469   /* set up the default bank */
470   UINT8 *prg = machine.region("maincpu")->base();
470   UINT8 *prg = state->memregion("maincpu")->base();
471471   memcpy (&prg[0x08000], &prg[0x12000], 0x2000);
472472
473473   /* vrom switching is enabled with bit 2 of $4016 */
r14976r14977
562562         case 3:   /* program banking */
563563            {
564564               int bank = (m_drmario_shiftreg & 0x03) * 0x4000;
565               UINT8 *prg = machine().region("maincpu")->base();
565               UINT8 *prg = memregion("maincpu")->base();
566566
567567               if (!m_size16k)
568568               {
r14976r14977
596596   vsnes_state *state = machine.driver_data<vsnes_state>();
597597   /* We do manual banking, in case the code falls through */
598598   /* Copy the initial banks */
599   UINT8 *prg = machine.region("maincpu")->base();
599   UINT8 *prg = state->memregion("maincpu")->base();
600600   memcpy(&prg[0x08000], &prg[0x10000], 0x4000);
601601   memcpy(&prg[0x0c000], &prg[0x1c000], 0x4000);
602602
r14976r14977
613613WRITE8_MEMBER(vsnes_state::vsvram_rom_banking)
614614{
615615   int rombank = 0x10000 + (data & 7) * 0x4000;
616   UINT8 *prg = machine().region("maincpu")->base();
616   UINT8 *prg = memregion("maincpu")->base();
617617
618618   memcpy(&prg[0x08000], &prg[rombank], 0x4000);
619619}
r14976r14977
622622{
623623   vsnes_state *state = machine.driver_data<vsnes_state>();
624624   /* when starting the game, the 1st 16k and the last 16k are loaded into the 2 banks */
625   UINT8 *prg = machine.region("maincpu")->base();
625   UINT8 *prg = state->memregion("maincpu")->base();
626626   memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
627627
628628   /* banking is done with writes to the $8000-$ffff area */
r14976r14977
638638static void mapper4_set_prg( running_machine &machine )
639639{
640640   vsnes_state *state = machine.driver_data<vsnes_state>();
641   UINT8 *prg = machine.region("maincpu")->base();
641   UINT8 *prg = state->memregion("maincpu")->base();
642642   UINT8 prg_flip = (state->m_MMC3_cmd & 0x40) ? 2 : 0;
643643
644644   memcpy(&prg[0x8000], &prg[0x2000 * (state->m_MMC3_prg_bank[0 ^ prg_flip] & state->m_MMC3_prg_mask) + 0x10000], 0x2000);
r14976r14977
773773DRIVER_INIT( MMC3 )
774774{
775775   vsnes_state *state = machine.driver_data<vsnes_state>();
776   UINT8 *prg = machine.region("maincpu")->base();
776   UINT8 *prg = machine.root_device().memregion("maincpu")->base();
777777   state->m_IRQ_enable = state->m_IRQ_count = state->m_IRQ_count_latch = 0;
778   int MMC3_prg_chunks = (machine.region("maincpu")->bytes() - 0x10000) / 0x4000;
778   int MMC3_prg_chunks = (state->memregion("maincpu")->bytes() - 0x10000) / 0x4000;
779779
780780   state->m_MMC3_prg_bank[0] = state->m_MMC3_prg_bank[2] = 0xfe;
781781   state->m_MMC3_prg_bank[1] = state->m_MMC3_prg_bank[3] = 0xff;
r14976r14977
952952
953953      case 0x7000:
954954      {
955         UINT8 *prg = machine().region("maincpu")->base();
955         UINT8 *prg = memregion("maincpu")->base();
956956         memcpy(&prg[0x08000], &prg[0x10000 + data * 0x4000], 0x4000);
957957      }
958958      break;
r14976r14977
967967   /* when starting a mapper 68 game  the first 16K ROM bank in the cart is loaded into $8000
968968    the LAST 16K ROM bank is loaded into $C000. The last 16K of ROM cannot be swapped. */
969969
970   UINT8 *prg = machine.region("maincpu")->base();
970   UINT8 *prg = machine.root_device().memregion("maincpu")->base();
971971   memcpy(&prg[0x08000], &prg[0x10000], 0x4000);
972972   memcpy(&prg[0x0c000], &prg[0x2c000], 0x4000);
973973
r14976r14977
10121012{
10131013   device_t *other_cpu = (&space.device() == machine().device("maincpu")) ? machine().device("sub") : machine().device("maincpu");
10141014   /* switch vrom */
1015   (&space.device() == machine().device("maincpu")) ? memory_set_bank(machine(), "bank2", BIT(data, 2)) : memory_set_bank(machine(), "bank3", BIT(data, 2));
1015   (&space.device() == machine().device("maincpu")) ? membank("bank2")->set_entry(BIT(data, 2)) : membank("bank3")->set_entry(BIT(data, 2));
10161016
10171017   /* bit 1 ( data & 2 ) triggers irq on the other cpu */
10181018   device_set_input_line(other_cpu, 0, (data & 2) ? CLEAR_LINE : ASSERT_LINE);
r14976r14977
10261026
10271027DRIVER_INIT( vsdual )
10281028{
1029   UINT8 *prg = machine.region("maincpu")->base();
1029   UINT8 *prg = machine.root_device().memregion("maincpu")->base();
10301030
10311031   vsnes_state *state = machine.driver_data<vsnes_state>();
10321032   /* vrom switching is enabled with bit 2 of $4016 */
src/mame/machine/megadriv.c
r14976r14977
25602560
25612561         // install the game rom in the normal 0x000000-0x03fffff space used by the genesis - this allows VDP DMA operations to work as they have to be from this area or RAM
25622562         // it should also UNMAP the banked rom area...
2563         space->install_rom(0x0000100, 0x03fffff, space->machine().region("gamecart")->base() + 0x100);
2563         space->install_rom(0x0000100, 0x03fffff, space->machine().root_device().memregion("gamecart")->base() + 0x100);
25642564      }
25652565      else
25662566      {
r14976r14977
25682568
25692569         // this is actually blank / nop area
25702570         // we should also map the banked area back (we don't currently unmap it tho)
2571         space->install_rom(0x0000100, 0x03fffff, space->machine().region("maincpu")->base()+0x100);
2571         space->install_rom(0x0000100, 0x03fffff, space->machine().root_device().memregion("maincpu")->base()+0x100);
25722572      }
25732573
25742574      if((a15106_reg & 4) == 0) // clears the FIFO state
r14976r14977
28602860      if (data & 0x01)
28612861      {
28622862         _32x_adapter_enabled = 1;
2863         space->install_rom(0x0880000, 0x08fffff, space->machine().region("gamecart")->base()); // 'fixed' 512kb rom bank
2863         space->install_rom(0x0880000, 0x08fffff, space->machine().root_device().memregion("gamecart")->base()); // 'fixed' 512kb rom bank
28642864
28652865         space->install_read_bank(0x0900000, 0x09fffff, "bank12"); // 'bankable' 1024kb rom bank
2866         memory_set_bankptr(space->machine(),  "bank12", space->machine().region("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) );
2866         space->machine().root_device().membank("bank12")->set_base(space->machine().root_device().memregion("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) );
28672867
2868         space->install_rom(0x0000000, 0x03fffff, space->machine().region("32x_68k_bios")->base());
2868         space->install_rom(0x0000000, 0x03fffff, space->machine().root_device().memregion("32x_68k_bios")->base());
28692869
28702870         /* VDP area */
28712871         space->install_legacy_readwrite_handler(0x0a15180, 0x0a1518b, FUNC(_32x_common_vdp_regs_r), FUNC(_32x_common_vdp_regs_w)); // common / shared VDP regs
r14976r14977
28812881      {
28822882         _32x_adapter_enabled = 0;
28832883
2884         space->install_rom(0x0000000, 0x03fffff, space->machine().region("gamecart")->base());
2884         space->install_rom(0x0000000, 0x03fffff, space->machine().root_device().memregion("gamecart")->base());
28852885         space->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x000070, 0x000073, FUNC(_32x_68k_hint_vector_r), FUNC(_32x_68k_hint_vector_w)); // h interrupt vector
28862886      }
28872887   }
r14976r14977
29492949      _32x_68k_a15104_reg = (_32x_68k_a15104_reg & 0x00ff) | (data & 0xff00);
29502950   }
29512951
2952   memory_set_bankptr(space->machine(),  "bank12", space->machine().region("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) );
2952   space->machine().root_device().membank("bank12")->set_base(space->machine().root_device().memregion("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) );
29532953}
29542954
29552955/**********************************************************************************************/
r14976r14977
60056005   space->unmap_readwrite        (0x020000,0x3fffff);
60066006
60076007//  space->install_read_bank(0x0020000, 0x003ffff, "scd_4m_prgbank");
6008//  memory_set_bankptr(space->machine(),  "scd_4m_prgbank", segacd_4meg_prgram + segacd_4meg_prgbank * 0x20000 );
6008//  space->machine().root_device().membank("scd_4m_prgbank")->set_base(segacd_4meg_prgram + segacd_4meg_prgbank * 0x20000 );
60096009   space->install_legacy_read_handler (0x0020000, 0x003ffff, FUNC(scd_4m_prgbank_ram_r) );
60106010   space->install_legacy_write_handler (0x0020000, 0x003ffff, FUNC(scd_4m_prgbank_ram_w) );
60116011   segacd_wordram_mapped = 1;
r14976r14977
69226922         int addr = state->m_pmac_read[reg]&0xffff;
69236923         if      ((mode & 0xfff0) == 0x0800) // ROM, inc 1, verified to be correct
69246924         {
6925            UINT16 *ROM = (UINT16 *) space->machine().region("maincpu")->base();
6925            UINT16 *ROM = (UINT16 *) space->machine().root_device().memregion("maincpu")->base();
69266926            state->m_pmac_read[reg] += 1;
69276927            d = ROM[addr|((mode&0xf)<<16)];
69286928         }
r14976r14977
71737173   machine.device("svp")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x438, 0x438, FUNC(svp_speedup_r));
71747174
71757175   state->m_iram = auto_alloc_array(machine, UINT8, 0x800);
7176   memory_set_bankptr(machine,  "bank3", state->m_iram);
7176   state->membank("bank3")->set_base(state->m_iram);
71777177   /* SVP ROM just shares m68k region.. */
7178   ROM = machine.region("maincpu")->base();
7179   memory_set_bankptr(machine,  "bank4", ROM + 0x800);
7178   ROM = state->memregion("maincpu")->base();
7179   state->membank("bank4")->set_base(ROM + 0x800);
71807180
71817181   megadrive_io_read_data_port_ptr   = megadrive_io_read_data_port_svp;
71827182}
r14976r14977
98569856      //printf("GENESIS Sound Z80 cpu found '%s'\n", _genesis_snd_z80_cpu->tag() );
98579857
98589858      genz80.z80_prgram = auto_alloc_array(machine, UINT8, 0x2000);
9859      memory_set_bankptr(machine,  "bank1", genz80.z80_prgram );
9859      machine.root_device().membank("bank1")->set_base(genz80.z80_prgram );
98609860   }
98619861
98629862   /* Look to see if this system has the 32x Master SH2 */
r14976r14977
99339933          some games specify a single address, (start 200001, end 200001)
99349934          this usually means there is serial eeprom instead */
99359935      int i;
9936      UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
9936      UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
99379937
99389938      mame_printf_debug("DEBUG:: Header: Backup RAM string (ignore for games without)\n");
99399939      for (i=0;i<12;i++)
r14976r14977
1005010050
1005110051
1005210052   machine.device(tag)->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, 0x1fff, "bank1");
10053   memory_set_bankptr(machine,  "bank1", genz80.z80_prgram );
10053   machine.root_device().membank("bank1")->set_base(genz80.z80_prgram );
1005410054
1005510055   machine.device(tag)->memory().space(AS_PROGRAM)->install_ram(0x0000, 0x1fff, genz80.z80_prgram);
1005610056
r14976r14977
1009310093
1009410094   if (_32x_adapter_enabled == 0)
1009510095   {
10096      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_rom(0x0000000, 0x03fffff, machine.region("gamecart")->base());
10096      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_rom(0x0000000, 0x03fffff, machine.root_device().memregion("gamecart")->base());
1009710097      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x000070, 0x000073, FUNC(_32x_68k_hint_vector_r), FUNC(_32x_68k_hint_vector_w)); // h interrupt vector
1009810098   };
1009910099
src/mame/machine/taitosj.c
r14976r14977
1919MACHINE_START( taitosj )
2020{
2121   taitosj_state *state = machine.driver_data<taitosj_state>();
22   memory_configure_bank(machine, "bank1", 0, 1, machine.region("maincpu")->base() + 0x6000, 0);
23   memory_configure_bank(machine, "bank1", 1, 1, machine.region("maincpu")->base() + 0x10000, 0);
22   state->membank("bank1")->configure_entry(0, machine.root_device().memregion("maincpu")->base() + 0x6000);
23   state->membank("bank1")->configure_entry(1, state->memregion("maincpu")->base() + 0x10000);
2424
2525   state->save_item(NAME(state->m_fromz80));
2626   state->save_item(NAME(state->m_toz80));
r14976r14977
5858{
5959   coin_lockout_global_w(machine(), ~data & 1);
6060
61   if(data & 0x80) memory_set_bank(machine(), "bank1", 1);
62   else memory_set_bank(machine(), "bank1", 0);
61   if(data & 0x80) membank("bank1")->set_entry(1);
62   else membank("bank1")->set_entry(0);
6363}
6464
6565
src/mame/machine/mc8123.c
r14976r14977
381381   int fixed_length = numbanks == 1 ? 0xc000 : 0x8000;
382382   UINT8 *decrypted1 = auto_alloc_array(machine, UINT8, fixed_length);
383383   UINT8 *decrypted2 = numbanks > 1 ? auto_alloc_array(machine, UINT8, 0x4000 * numbanks) : 0;
384   UINT8 *rom = machine.region(cpu)->base();
385   UINT8 *key = machine.region(keyrgn)->base();
384   UINT8 *rom = machine.root_device().memregion(cpu)->base();
385   UINT8 *key = machine.root_device().memregion(keyrgn)->base();
386386   int A, bank;
387387
388388   space->set_decrypted_region(0x0000, fixed_length-1, decrypted1);
r14976r14977
400400
401401   if (bankname != NULL)
402402   {
403      memory_configure_bank_decrypted(machine, bankname, 0, numbanks, decrypted2, 0x4000);
403      machine.root_device().membank(bankname)->configure_decrypted_entries(0, numbanks, decrypted2, 0x4000);
404404
405405      for (bank = 0; bank < numbanks; ++bank)
406406      {
src/mame/machine/neoprot.c
r14976r14977
119119static WRITE16_HANDLER ( kof98_prot_w )
120120{
121121   /* info from razoola */
122   UINT16* mem16 = (UINT16*)space->machine().region("maincpu")->base();
122   UINT16* mem16 = (UINT16*)space->machine().root_device().memregion("maincpu")->base();
123123
124124   switch (data)
125125   {
r14976r14977
160160void mslugx_install_protection( running_machine &machine )
161161{
162162   int i;
163   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
163   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
164164
165165   for (i = 0;i < (0x100000/2) - 4;i++)
166166   {
src/mame/machine/midwunit.c
r14976r14977
156156   register_state_saving(machine);
157157
158158   /* load the graphics ROMs -- quadruples */
159   midtunit_gfx_rom = base = machine.region("gfx1")->base();
160   len = machine.region("gfx1")->bytes();
159   midtunit_gfx_rom = base = machine.root_device().memregion("gfx1")->base();
160   len = state->memregion("gfx1")->bytes();
161161   for (i = 0; i < len / 0x400000; i++)
162162   {
163163      memcpy(state->m_decode_memory, base, 0x400000);
src/mame/machine/namcos2.c
r14976r14977
154154/* 68000 Shared memory area - Data ROM area                  */
155155/*************************************************************/
156156READ16_HANDLER( namcos2_68k_data_rom_r ){
157   UINT16 *ROM = (UINT16 *)space->machine().region("user1")->base();
157   UINT16 *ROM = (UINT16 *)space->machine().root_device().memregion("user1")->base();
158158   return ROM[offset];
159159}
160160
r14976r14977
709709
710710WRITE8_HANDLER( namcos2_sound_bankselect_w )
711711{
712   UINT8 *RAM=space->machine().region("audiocpu")->base();
713   UINT32 max = (space->machine().region("audiocpu")->bytes() - 0x10000) / 0x4000;
712   UINT8 *RAM=space->machine().root_device().memregion("audiocpu")->base();
713   UINT32 max = (space->machine().root_device().memregion("audiocpu")->bytes() - 0x10000) / 0x4000;
714714   int bank = ( data >> 4 ) % max;   /* 991104.CAB */
715   memory_set_bankptr(space->machine(),  BANKED_SOUND_ROM, &RAM[ 0x10000 + ( 0x4000 * bank ) ] );
715   space->machine().root_device().membank(BANKED_SOUND_ROM)->set_base(&RAM[ 0x10000 + ( 0x4000 * bank ) ] );
716716}
717717
718718/**************************************************************/
src/mame/machine/neocrypt.c
r14976r14977
535535   UINT8 *rom;
536536   int rpos;
537537
538   rom_size = machine.region("sprites")->bytes();
538   rom_size = machine.root_device().memregion("sprites")->bytes();
539539
540540   buf = auto_alloc_array(machine, UINT8, rom_size);
541541
542   rom = machine.region("sprites")->base();
542   rom = machine.root_device().memregion("sprites")->base();
543543
544544   // Data xor
545545   for (rpos = 0;rpos < rom_size/4;rpos++)
r14976r14977
595595void neogeo_sfix_decrypt(running_machine &machine)
596596{
597597   int i;
598   int rom_size = machine.region("sprites")->bytes();
599   int tx_size = machine.region("fixed")->bytes();
600   UINT8 *src = machine.region("sprites")->base()+rom_size-tx_size;
601   UINT8 *dst = machine.region("fixed")->base();
598   int rom_size = machine.root_device().memregion("sprites")->bytes();
599   int tx_size = machine.root_device().memregion("fixed")->bytes();
600   UINT8 *src = machine.root_device().memregion("sprites")->base()+rom_size-tx_size;
601   UINT8 *dst = machine.root_device().memregion("fixed")->base();
602602
603603   for (i = 0;i < tx_size;i++)
604604      dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
r14976r14977
677677   static const UINT8 xorval[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 };
678678   int i;
679679   int ofst;
680   int rom_size = machine.region( "sprites" )->bytes();
681   UINT8 *rom = machine.region( "sprites" )->base();
680   int rom_size = machine.root_device().memregion( "sprites" )->bytes();
681   UINT8 *rom = machine.root_device().memregion( "sprites" )->base();
682682   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
683683
684684   for( i = 0; i < rom_size; i++ )
r14976r14977
710710void svcpcb_s1data_decrypt(running_machine &machine)
711711{
712712   int i;
713   UINT8 *s1 = machine.region( "fixed" )->base();
714   size_t s1_size = machine.region( "fixed" )->bytes();
713   UINT8 *s1 = machine.root_device().memregion( "fixed" )->base();
714   size_t s1_size = machine.root_device().memregion( "fixed" )->bytes();
715715
716716   for( i = 0; i < s1_size; i++ ) // Decrypt S
717717   {
r14976r14977
727727   static const UINT8 xorval[ 4 ] = { 0x34, 0x21, 0xc4, 0xe9 };
728728   int i;
729729   int ofst;
730   int rom_size = machine.region( "sprites" )->bytes();
731   UINT8 *rom = machine.region( "sprites" )->base();
730   int rom_size = machine.root_device().memregion( "sprites" )->bytes();
731   UINT8 *rom = machine.root_device().memregion( "sprites" )->base();
732732   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
733733
734734   for ( i = 0; i < rom_size; i++ )
r14976r14977
758758   UINT8 *src;
759759   UINT8 *dst;
760760   int i;
761   int tx_size = machine.region( "fixed" )->bytes();
762   int srom_size = machine.region( "sprites" )->bytes();
761   int tx_size = machine.root_device().memregion( "fixed" )->bytes();
762   int srom_size = machine.root_device().memregion( "sprites" )->bytes();
763763
764   src = machine.region( "sprites" )->base() + srom_size - 0x1000000 - 0x80000; // Decrypt S
765   dst = machine.region( "fixed" )->base();
764   src = machine.root_device().memregion( "sprites" )->base() + srom_size - 0x1000000 - 0x80000; // Decrypt S
765   dst = machine.root_device().memregion( "fixed" )->base();
766766
767767   for( i = 0; i < tx_size / 2; i++ )
768768   {
769769      dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];
770770   }
771771
772   src = machine.region( "sprites" )->base() + srom_size - 0x80000;
773   dst = machine.region( "fixed" )->base() + 0x80000;
772   src = machine.root_device().memregion( "sprites" )->base() + srom_size - 0x80000;
773   dst = machine.root_device().memregion( "fixed" )->base() + 0x80000;
774774
775775   for( i = 0; i < tx_size / 2; i++ )
776776   {
777777      dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];
778778   }
779779
780   dst = machine.region( "fixed" )->base();
780   dst = machine.root_device().memregion( "fixed" )->base();
781781
782782   for( i = 0; i < tx_size; i++ )
783783   {
r14976r14977
887887
888888void neogeo_cmc50_m1_decrypt(running_machine &machine)
889889{
890   UINT8* rom = machine.region("audiocrypt")->base();
890   UINT8* rom = machine.root_device().memregion("audiocrypt")->base();
891891   size_t rom_size = 0x80000;
892   UINT8* rom2 = machine.region("audiocpu")->base();
892   UINT8* rom2 = machine.root_device().memregion("audiocpu")->base();
893893
894894   UINT8* buffer = auto_alloc_array(machine, UINT8, rom_size);
895895
r14976r14977
956956/* Kof98 uses an early encryption, quite different from the others */
957957void kof98_decrypt_68k(running_machine &machine)
958958{
959   UINT8 *src = machine.region("maincpu")->base();
959   UINT8 *src = machine.root_device().memregion("maincpu")->base();
960960   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x200000);
961961   int i, j, k;
962962   static const UINT32 sec[]={0x000000,0x100000,0x000004,0x100004,0x10000a,0x00000a,0x10000e,0x00000e};
r14976r14977
10061006   UINT16 *rom;
10071007   int i,j;
10081008
1009   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1009   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
10101010   /* swap data lines on the whole ROMs */
10111011   for (i = 0;i < 0x800000/2;i++)
10121012   {
r14976r14977
10251025   }
10261026
10271027   /* swap address lines & relocate fixed part */
1028   rom = (UINT16 *)machine.region("maincpu")->base();
1028   rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
10291029   for (i = 0;i < 0x0c0000/2;i++)
10301030   {
10311031      rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)];
r14976r14977
10391039   int i,j;
10401040
10411041   /* thanks to Razoola and Mr K for the info */
1042   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1042   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
10431043   /* swap data lines on the whole ROMs */
10441044   for (i = 0;i < 0x800000/2;i++)
10451045   {
r14976r14977
10471047   }
10481048
10491049   /* swap address lines & relocate fixed part */
1050   rom = (UINT16 *)machine.region("maincpu")->base();
1050   rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
10511051   for (i = 0;i < 0x0c0000/2;i++)
10521052   {
10531053      rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)];
10541054   }
10551055
10561056   /* swap address lines for the banked part */
1057   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1057   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
10581058   for (i = 0;i < 0x800000/2;i+=0x8000/2)
10591059   {
10601060      UINT16 buffer[0x8000/2];
r14976r14977
10731073   int i,j;
10741074
10751075   /* thanks to Razoola and Mr K for the info */
1076   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1076   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
10771077   /* swap data lines on the whole ROMs */
10781078   for (i = 0;i < 0x800000/2;i++)
10791079   {
r14976r14977
10811081   }
10821082
10831083   /* swap address lines & relocate fixed part */
1084   rom = (UINT16 *)machine.region("maincpu")->base();
1084   rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
10851085   for (i = 0;i < 0x0c0000/2;i++)
10861086   {
10871087      rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)];
10881088   }
10891089
10901090   /* swap address lines for the banked part */
1091   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1091   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
10921092   for (i = 0;i < 0x800000/2;i+=0x8000/2)
10931093   {
10941094      UINT16 buffer[0x8000/2];
r14976r14977
11071107   int i,j;
11081108
11091109   /* thanks to Razoola and Mr K for the info */
1110   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1110   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
11111111   /* swap data lines on the whole ROMs */
11121112   for (i = 0;i < 0x800000/2;i++)
11131113   {
r14976r14977
11151115   }
11161116
11171117   /* swap address lines & relocate fixed part */
1118   rom = (UINT16 *)machine.region("maincpu")->base();
1118   rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
11191119   for (i = 0;i < 0x0c0000/2;i++)
11201120   {
11211121      rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)];
11221122   }
11231123
11241124   /* swap address lines for the banked part */
1125   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1125   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
11261126   for (i = 0;i < 0x800000/2;i+=0x10000/2)
11271127   {
11281128      UINT16 buffer[0x10000/2];
r14976r14977
11411141   int i,j;
11421142
11431143   /* thanks to Razoola and Mr K for the info */
1144   rom = (UINT16 *)(machine.region("maincpu")->base() + 0x100000);
1144   rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x100000);
11451145   /* swap data lines on the whole ROMs */
11461146   for (i = 0;i < 0x800000/2;i++)
11471147   {
r14976r14977
11601160   }
11611161
11621162   /* swap address lines & relocate fixed part */
1163   rom = (UINT16 *)machine.region("maincpu")->base();
1163   rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
11641164   for (i = 0;i < 0x0c0000/2;i++)
11651165   {
11661166      rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
r14976r14977
11731173{
11741174   int i;
11751175   static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000};
1176   UINT8 *src = machine.region("maincpu")->base()+0x100000;
1176   UINT8 *src = machine.root_device().memregion("maincpu")->base()+0x100000;
11771177   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x400000);
11781178   memcpy( dst, src, 0x400000 );
11791179   for( i=0; i<8; ++i )
r14976r14977
11881188{
11891189   int i;
11901190   static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000};
1191   UINT8 *src = machine.region("maincpu")->base()+0x100000;
1191   UINT8 *src = machine.root_device().memregion("maincpu")->base()+0x100000;
11921192   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x400000);
11931193   memcpy( dst, src, 0x400000);
11941194   for( i=0; i<8; ++i )
r14976r14977
12031203{
12041204   int i;
12051205   static const int sec[]={0x000000,0x080000,0x700000,0x680000,0x500000,0x180000,0x200000,0x480000,0x300000,0x780000,0x600000,0x280000,0x100000,0x580000,0x400000,0x380000};
1206   UINT8 *src = machine.region("maincpu")->base();
1206   UINT8 *src = machine.root_device().memregion("maincpu")->base();
12071207   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x800000);
12081208
12091209   memcpy( dst, src, 0x800000 );
r14976r14977
12191219{
12201220   int i;
12211221   static const int sec[]={0x000000,0x080000,0x500000,0x480000,0x600000,0x580000,0x700000,0x280000,0x100000,0x680000,0x400000,0x780000,0x200000,0x380000,0x300000,0x180000};
1222   UINT8 *src = machine.region("maincpu")->base();
1222   UINT8 *src = machine.root_device().memregion("maincpu")->base();
12231223   UINT8 *dst = auto_alloc_array(machine, UINT8, 0x800000);
12241224
12251225   memcpy( dst, src, 0x800000 );
r14976r14977
12391239   int i;
12401240   int ofst;
12411241   int rom_size = 0x800000;
1242   UINT8 *rom = machine.region( "maincpu" )->base();
1242   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
12431243   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
12441244
12451245   for( i = 0; i < 0x100000; i++ )
r14976r14977
12841284   int i;
12851285   int ofst;
12861286   int rom_size = 0x800000;
1287   UINT8 *rom = machine.region( "maincpu" )->base();
1287   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
12881288   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
12891289
12901290   for( i = 0; i < 0x100000; i++ )
r14976r14977
13281328   int i;
13291329   int ofst;
13301330   int rom_size = 0x900000;
1331   UINT8 *rom = machine.region( "maincpu" )->base();
1331   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
13321332   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
13331333
13341334   for (i = 0; i < 0x100000; i++)
r14976r14977
13711371   int i;
13721372   int ofst;
13731373   int rom_size = 0x900000;
1374   UINT8 *rom = machine.region( "maincpu" )->base();
1374   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
13751375   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
13761376
13771377   for (i = 0; i < 0x100000; i++)
r14976r14977
14191419   int i;
14201420   int ofst;
14211421   int rom_size = 0x900000;
1422   UINT8 *rom = machine.region( "maincpu" )->base();
1422   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
14231423   UINT8 *buf = auto_alloc_array(machine, UINT8,  rom_size );
14241424
14251425   for (i = 0; i < 0x100000; i++)
r14976r14977
14691469/* Neo-Pcm2 Drivers for Encrypted V Roms */
14701470void neo_pcm2_snk_1999(running_machine &machine, int value)
14711471{   /* thanks to Elsemi for the NEO-PCM2 info */
1472   UINT16 *rom = (UINT16 *)machine.region("ymsnd")->base();
1473   int size = machine.region("ymsnd")->bytes();
1472   UINT16 *rom = (UINT16 *)machine.root_device().memregion("ymsnd")->base();
1473   int size = machine.root_device().memregion("ymsnd")->bytes();
14741474   int i, j;
14751475
14761476   if( rom != NULL )
r14976r14977
15091509      {0xcb,0x29,0x7d,0x43,0xd2,0x3a,0xc2,0xb4},
15101510      {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62},
15111511      {0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}};
1512   UINT8 *src = machine.region("ymsnd")->base();
1512   UINT8 *src = machine.root_device().memregion("ymsnd")->base();
15131513   UINT8 *buf = auto_alloc_array(machine, UINT8, 0x1000000);
15141514   int i, j, d;
15151515
r14976r14977
15531553      0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9,
15541554      0xd3,0xd2,0x5c,0x5d,0x57,0x56,0xd8,0xd9,
15551555   };
1556   UINT16*src= (UINT16*)machine.region( "mainbios" )->base();
1556   UINT16*src= (UINT16*)machine.root_device().memregion( "mainbios" )->base();
15571557   UINT16*buf= auto_alloc_array(machine, UINT16, 0x80000/2);
15581558   int   a,addr;
15591559
src/mame/machine/pgmprot2.c
r14976r14977
207207   pgm_kov2p_decrypt(machine);
208208   kov2_latch_init(machine);
209209
210   UINT8 *mem8 = (UINT8 *)machine.region("user1")->base();
210   UINT8 *mem8 = (UINT8 *)machine.root_device().memregion("user1")->base();
211211   mem8[0xDE] = 0xC0;
212212   mem8[0xDF] = 0x46;
213213   mem8[0x4ED8] = 0xA8;// B0
r14976r14977
313313DRIVER_INIT( dw2001 )
314314{
315315   //pgm_arm_type2_state *state = machine.driver_data<pgm_arm_type2_state>();
316   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
316   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
317317
318318   pgm_basic_init(machine);
319319   kov2_latch_init(machine);
r14976r14977
330330   mem16[0x11eb04 / 2] = 0x4e71;
331331
332332   /* patch ARM area with fake code */
333   UINT16 *temp16 = (UINT16 *)machine.region("prot")->base();
333   UINT16 *temp16 = (UINT16 *)machine.root_device().memregion("prot")->base();
334334   temp16[(0x0000)/2] = 0xd088;
335335   temp16[(0x0002)/2] = 0xe59f;
336336   temp16[(0x0004)/2] = 0x0680;
r14976r14977
347347DRIVER_INIT( dwpc )
348348{
349349   //pgm_arm_type2_state *state = machine.driver_data<pgm_arm_type2_state>();
350   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
350   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
351351
352352   pgm_basic_init(machine);
353353   kov2_latch_init(machine);
r14976r14977
365365
366366
367367   /* patch ARM area with fake code */
368   UINT16 *temp16 = (UINT16 *)machine.region("prot")->base();
368   UINT16 *temp16 = (UINT16 *)machine.root_device().memregion("prot")->base();
369369   temp16[(0x0000)/2] = 0xd088;
370370   temp16[(0x0002)/2] = 0xe59f;
371371   temp16[(0x0004)/2] = 0x0680;
src/mame/machine/nb1414m4.c
r14976r14977
3131
3232static void nichibutsu_1414m4_dma(address_space *space,UINT16 src,UINT16 dst,UINT16 size, UINT8 condition,UINT8 *vram)
3333{
34   UINT8 * data = (UINT8 *)space->machine().region("blit_data")->base();
34   UINT8 * data = (UINT8 *)space->machine().root_device().memregion("blit_data")->base();
3535   int i;
3636
3737   for(i=0;i<size;i++)
r14976r14977
6161
6262static void insert_coin_msg(address_space *space,UINT8 *vram)
6363{
64   UINT8 * data = (UINT8 *)space->machine().region("blit_data")->base();
64   UINT8 * data = (UINT8 *)space->machine().root_device().memregion("blit_data")->base();
6565   int credit_count = (vram[0xf] & 0xff);
6666   UINT8 fl_cond = space->machine().primary_screen->frame_number() & 0x10; /* for insert coin "flickering" */
6767   UINT16 dst;
r14976r14977
8282
8383static void credit_msg(address_space *space,UINT8 *vram)
8484{
85   UINT8 * data = (UINT8 *)space->machine().region("blit_data")->base();
85   UINT8 * data = (UINT8 *)space->machine().root_device().memregion("blit_data")->base();
8686   int credit_count = (vram[0xf] & 0xff);
8787   UINT8 fl_cond = space->machine().primary_screen->frame_number() & 0x10; /* for insert coin "flickering" */
8888   UINT16 dst;
r14976r14977
112112   int i;
113113   UINT8 first_digit;
114114   UINT8 res;
115   UINT8 * data = (UINT8 *)space->machine().region("blit_data")->base();
115   UINT8 * data = (UINT8 *)space->machine().root_device().memregion("blit_data")->base();
116116
117117   first_digit = 0;
118118
r14976r14977
140140
141141static void nichibutsu_1414m4_0200(address_space *space, UINT16 mcu_cmd,UINT8 *vram)
142142{
143   UINT8 * data = (UINT8 *)space->machine().region("blit_data")->base();
143   UINT8 * data = (UINT8 *)space->machine().root_device().memregion("blit_data")->base();
144144   UINT16 dst;
145145
146146   dst = (data[0x330+((mcu_cmd & 0xf)*2)]<<8)|(data[0x331+((mcu_cmd & 0xf)*2)]&0xff);
r14976r14977
185185*/
186186static void nichibutsu_1414m4_0600(address_space *space, UINT8 is2p,UINT8 *vram)
187187{
188   UINT8 * data = (UINT8 *)space->machine().region("blit_data")->base();
188   UINT8 * data = (UINT8 *)space->machine().root_device().memregion("blit_data")->base();
189189   UINT16 dst;
190190   int i;
191191
r14976r14977
241241
242242static void nichibutsu_1414m4_0e00(address_space *space,UINT16 mcu_cmd,UINT8 *vram)
243243{
244   UINT8 * data = (UINT8 *)space->machine().region("blit_data")->base();
244   UINT8 * data = (UINT8 *)space->machine().root_device().memregion("blit_data")->base();
245245   UINT16 dst;
246246
247247   dst = ((data[0xdf]<<8)|(data[0xe0]&0xff)) & 0x3fff;
src/mame/machine/tx1.c
r14976r14977
421421
422422   tx1_state *state = machine.driver_data<tx1_state>();
423423   math_t &math = state->m_math;
424   const UINT16 *prom = (UINT16*)machine.region("au_data")->base() + (0x8000 >> 1);
424   const UINT16 *prom = (UINT16*)state->memregion("au_data")->base() + (0x8000 >> 1);
425425
426426   for (;;)
427427   {
r14976r14977
479479               data = math.muxlatch;
480480            else if (dsel == 1)
481481            {
482               UINT16 *romdata = (UINT16*)machine.region("au_data")->base();
482               UINT16 *romdata = (UINT16*)machine.root_device().memregion("au_data")->base();
483483               UINT16 addr = get_tx1_datarom_addr(math);
484484               data = romdata[addr];
485485            }
r14976r14977
656656                TODO make this constant somewhere
657657                e.g. math.retval =  math.romptr[ get_tx1_datarom_addr() ];
658658            */
659         UINT16 *romdata = (UINT16*)machine().region("au_data")->base();
659         UINT16 *romdata = (UINT16*)machine().root_device().memregion("au_data")->base();
660660         UINT16 addr = get_tx1_datarom_addr(math);
661661         math.retval = romdata[addr];
662662      }
r14976r14977
804804READ16_MEMBER(tx1_state::tx1_spcs_rom_r)
805805{
806806   math_t &math = m_math;
807   math.cpulatch = *(UINT16*)((UINT8*)machine().region("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
807   math.cpulatch = *(UINT16*)((UINT8*)machine().root_device().memregion("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
808808
809809   if (math.mux == TX1_SEL_ILDEN)
810810   {
r14976r14977
984984
985985   tx1_state *state = machine.driver_data<tx1_state>();
986986   math_t &math = state->m_math;
987   const UINT16 *prom = (UINT16*)machine.region("au_data")->base() + (0x8000 >> 1);
987   const UINT16 *prom = (UINT16*)state->memregion("au_data")->base() + (0x8000 >> 1);
988988
989989   for (;;)
990990   {
r14976r14977
10171017
10181018         if (math.mux == BB_MUX_DPROE)
10191019         {
1020            UINT16 *romdata = (UINT16*)machine.region("au_data")->base();
1020            UINT16 *romdata = (UINT16*)machine.root_device().memregion("au_data")->base();
10211021            UINT16 addr = get_bb_datarom_addr(math);
10221022            kick_sn74s516(machine, &romdata[addr], ins);
10231023         }
r14976r14977
11331133   /* /DPROE */
11341134   else if ((offset & 0xc00) == 0xc00)
11351135   {
1136      UINT16 *romdata = (UINT16*)machine().region("au_data")->base();
1136      UINT16 *romdata = (UINT16*)machine().root_device().memregion("au_data")->base();
11371137      UINT16 addr = get_bb_datarom_addr(math);
11381138
11391139      math.retval = romdata[addr];
r14976r14977
12661266READ16_MEMBER(tx1_state::buggyboy_spcs_rom_r)
12671267{
12681268   math_t &math = m_math;
1269   math.cpulatch = *(UINT16*)((UINT8*)machine().region("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
1269   math.cpulatch = *(UINT16*)((UINT8*)machine().root_device().memregion("math_cpu")->base() + 0xfc000 + 0x1000 + offset*2);
12701270
12711271   if (math.mux == BB_MUX_ILDEN)
12721272   {
src/mame/machine/cclimber.c
r14976r14977
77static void cclimber_decode(running_machine &machine, const UINT8 convtable[8][16])
88{
99   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
10   UINT8 *rom = machine.region("maincpu")->base();
10   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
1111   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
1212   int A;
1313
r14976r14977
6868DRIVER_INIT( ckongb )
6969{
7070   int A;
71   UINT8 *rom = machine.region("maincpu")->base();
71   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
7272
7373   for (A = 0x0000;A < 0x6000;A++) /* all the program ROMs are encrypted */
7474   {
r14976r14977
7979#if CANNONB_HACK
8080static void cannonb_patch(running_machine &machine)
8181{
82   UINT8 *rom = machine.region("maincpu")->base();
82   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
8383
8484   rom[0x2ba0] = 0x21;
8585   rom[0x2ba1] = 0xfb;
r14976r14977
9191DRIVER_INIT( cannonb )
9292{
9393   int A;
94   UINT8 *rom = machine.region("maincpu")->base();
94   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
9595
9696   for (A = 0x0000;A < 0x1000;A++) /* only first ROM is encrypted */
9797   {
src/mame/machine/s24fd.c
r14976r14977
158158
159159   s24_fd1094_cpuregion = (UINT16*)machine.memory().shared("share2")->ptr();
160160   s24_fd1094_cpuregionsize = 0x40000;
161   s24_fd1094_key = machine.region("fd1094key")->base();
161   s24_fd1094_key = machine.root_device().memregion("fd1094key")->base();
162162
163163   /* punt if no key; this allows us to be called even for non-s24_fd1094 games */
164164   if (!s24_fd1094_key)
src/mame/machine/tatsumi.c
r14976r14977
293293
294294READ16_MEMBER(tatsumi_state::tatsumi_v30_68000_r)
295295{
296   const UINT16* rom=(UINT16*)machine().region("sub")->base();
296   const UINT16* rom=(UINT16*)machine().root_device().memregion("sub")->base();
297297
298298logerror("%05X:68000_r(%04X),cw=%04X\n", cpu_get_pc(&space.device()), offset*2, m_control_word);
299299   /* Read from 68k RAM */
r14976r14977
302302      // hack to make roundup 5 boot
303303      if (cpu_get_pc(&space.device())==0xec575)
304304      {
305         UINT8 *dst = machine().region("maincpu")->base();
305         UINT8 *dst = memregion("maincpu")->base();
306306         dst[BYTE_XOR_LE(0xec57a)]=0x46;
307307         dst[BYTE_XOR_LE(0xec57b)]=0x46;
308308
src/mame/machine/segamsys.c
r14976r14977
16131613         //printf("bank ram??\n");
16141614         break;
16151615      case 1:
1616         memcpy(sms_rom+0x0000, space->machine().region("maincpu")->base()+bank*0x4000, 0x4000);
1616         memcpy(sms_rom+0x0000, space->machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000);
16171617         break;
16181618      case 2:
1619         memcpy(sms_rom+0x4000, space->machine().region("maincpu")->base()+bank*0x4000, 0x4000);
1619         memcpy(sms_rom+0x4000, space->machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000);
16201620         break;
16211621      case 3:
1622         memcpy(sms_rom+0x8000, space->machine().region("maincpu")->base()+bank*0x4000, 0x4000);
1622         memcpy(sms_rom+0x8000, space->machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000);
16231623         break;
16241624
16251625   }
r14976r14977
16281628static WRITE8_HANDLER( codemasters_rom_bank_0000_w )
16291629{
16301630   int bank = data&0x1f;
1631   memcpy(sms_rom+0x0000, space->machine().region("maincpu")->base()+bank*0x4000, 0x4000);
1631   memcpy(sms_rom+0x0000, space->machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000);
16321632}
16331633
16341634static WRITE8_HANDLER( codemasters_rom_bank_4000_w )
16351635{
16361636   int bank = data&0x1f;
1637   memcpy(sms_rom+0x4000, space->machine().region("maincpu")->base()+bank*0x4000, 0x4000);
1637   memcpy(sms_rom+0x4000, space->machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000);
16381638}
16391639
16401640static WRITE8_HANDLER( codemasters_rom_bank_8000_w )
16411641{
16421642   int bank = data&0x1f;
1643   memcpy(sms_rom+0x8000, space->machine().region("maincpu")->base()+bank*0x4000, 0x4000);
1643   memcpy(sms_rom+0x8000, space->machine().root_device().memregion("maincpu")->base()+bank*0x4000, 0x4000);
16441644}
16451645
16461646
r14976r14977
16821682   /* fixed rom bank area */
16831683   sms_rom = (UINT8 *)machine.device(tag)->memory().space(AS_PROGRAM)->install_rom(0x0000, 0xbfff, NULL);
16841684
1685   memcpy(sms_rom, machine.region("maincpu")->base(), 0xc000);
1685   memcpy(sms_rom, machine.root_device().memregion("maincpu")->base(), 0xc000);
16861686
16871687   if (mapper == MAPPER_STANDARD )
16881688   {
src/mame/machine/harddriv.c
r14976r14977
5959   atarigen_init(machine);
6060
6161   /* predetermine memory regions */
62   state->m_sim_memory = (UINT16 *)machine.region("user1")->base();
63   state->m_sim_memory_size = machine.region("user1")->bytes() / 2;
62   state->m_sim_memory = (UINT16 *)machine.root_device().memregion("user1")->base();
63   state->m_sim_memory_size = state->memregion("user1")->bytes() / 2;
6464   state->m_adsp_pgm_memory_word = (UINT16 *)(reinterpret_cast<UINT8 *>(state->m_adsp_pgm_memory.target()) + 1);
6565}
6666
src/mame/machine/segacrpt.c
r14976r14977
159159static void lfkp(int mask)
160160{
161161   int A;
162   UINT8 *RAM = machine.region("maincpu")->base();
162   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
163163
164164
165165   for (A = 0x0000;A < 0x8000-14;A++)
r14976r14977
218218   int A;
219219
220220   address_space *space = machine.device(cputag)->memory().space(AS_PROGRAM);
221   int length = machine.region(cputag)->bytes();
221   int length = machine.root_device().memregion(cputag)->bytes();
222222   int cryptlen = MIN(length, 0x8000);
223   UINT8 *rom = machine.region(cputag)->base();
223   UINT8 *rom = machine.root_device().memregion(cputag)->base();
224224   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0xc000);
225225
226226   space->set_decrypted_region(0x0000, cryptlen - 1, decrypted);
r14976r14977
440440   int A;
441441
442442   address_space *space = machine.device(cputag)->memory().space(AS_PROGRAM);
443   UINT8 *rom = machine.region(regiontag)->base();
443   UINT8 *rom = machine.root_device().memregion(regiontag)->base();
444444   int bankstart;
445445   decrypted = auto_alloc_array(machine, UINT8, 0x6000*3);
446446
r14976r14977
471471      rom[A+bankstart] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval);
472472   }
473473
474   memory_configure_bank(machine, "bank1",0,3, machine.region(regiontag)->base(),0x6000);
475   memory_configure_bank_decrypted(machine, "bank1",0,3,decrypted,0x6000);
474   machine.root_device().membank("bank1")->configure_entries(0,3, machine.root_device().memregion(regiontag)->base(),0x6000);
475   machine.root_device().membank("bank1")->configure_decrypted_entries(0,3,decrypted,0x6000);
476476   space->set_decrypted_region(0x0000, 0x5fff, decrypted);
477   memory_set_bank(space->machine(), "bank1", 0);
477   space->machine().root_device().membank("bank1")->set_entry(0);
478478}
479479
480480
r14976r14977
798798   int A;
799799
800800   address_space *space = machine.device(cputag)->memory().space(AS_PROGRAM);
801   UINT8 *rom = machine.region(cputag)->base();
801   UINT8 *rom = machine.root_device().memregion(cputag)->base();
802802   decrypted = auto_alloc_array(machine, UINT8, 0x9000);
803803
804804   for (A = 0x0000;A < 0x9000;A++)
r14976r14977
830830      rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval);
831831   }
832832
833   memory_configure_bank(machine, "bank1",0,8, machine.region(cputag)->base()+0x7000,0x0400);
834   memory_configure_bank_decrypted(machine, "bank1",0,8,decrypted+0x7000,0x0400);
833   machine.root_device().membank("bank1")->configure_entries(0,8, machine.root_device().memregion(cputag)->base()+0x7000,0x0400);
834   machine.root_device().membank("bank1")->configure_decrypted_entries(0,8,decrypted+0x7000,0x0400);
835835   space->set_decrypted_region(0x0000, 0x6bff, decrypted);
836   memory_set_bank(space->machine(), "bank1", 0);
836   machine.root_device().membank("bank1")->set_entry(0);
837837}
838838
839839
src/mame/machine/beezer.c
r14976r14977
176176   }
177177   else
178178   {
179      UINT8 *rom = machine().region("maincpu")->base() + 0x10000;
179      UINT8 *rom = memregion("maincpu")->base() + 0x10000;
180180      space.install_ram(0xc000, 0xcfff, rom + (data & 0x07) * 0x2000 + ((data & 0x08) ? 0x1000: 0));
181181   }
182182}
src/mame/machine/kaneko16.c
r14976r14977
16591659   kaneko16_state *state = machine.driver_data<kaneko16_state>();
16601660   calc3_t &calc3 = state->m_calc3;
16611661   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1662   UINT8* rom = machine.region("cpu1")->base();
1662   UINT8* rom = state->memregion("cpu1")->base();
16631663   UINT8 numregions;
16641664   UINT16 length;
16651665   int local_counter=0;
r14976r14977
19701970{
19711971   kaneko16_state *state = machine.driver_data<kaneko16_state>();
19721972   calc3_t &calc3 = state->m_calc3;
1973   UINT8* rom = machine.region("cpu1")->base();
1973   UINT8* rom = state->memregion("cpu1")->base();
19741974   UINT8 numregions;
19751975
19761976   int x;
r14976r14977
22832283DRIVER_INIT( decrypt_toybox_rom )
22842284{
22852285
2286   UINT8 *src = (UINT8 *)machine.region("mcudata" )->base();
2286   UINT8 *src = (UINT8 *)machine.root_device().memregion("mcudata" )->base();
22872287
22882288   int i;
22892289
r14976r14977
23102310DRIVER_INIT( decrypt_toybox_rom_alt )
23112311{
23122312
2313   UINT8 *src = (UINT8 *)machine.region("mcudata" )->base();
2313   UINT8 *src = (UINT8 *)machine.root_device().memregion("mcudata" )->base();
23142314
23152315   int i;
23162316
r14976r14977
23222322
23232323void toxboy_handle_04_subcommand(running_machine& machine,UINT8 mcu_subcmd, UINT16*mcu_ram)
23242324{
2325   UINT8 *src = (UINT8 *)machine.region("mcudata")->base()+0x10000;
2325   UINT8 *src = (UINT8 *)machine.root_device().memregion("mcudata")->base()+0x10000;
23262326   UINT8* dst = (UINT8 *)mcu_ram;
23272327
23282328   int offs = (mcu_subcmd&0x3f)*8;
src/mame/machine/cps2crpt.c
r14976r14977
633633static void cps2_decrypt(running_machine &machine, const UINT32 *master_key, UINT32 upper_limit)
634634{
635635   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
636   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
637   int length = machine.region("maincpu")->bytes();
636   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
637   int length = machine.root_device().memregion("maincpu")->bytes();
638638   UINT16 *dec = auto_alloc_array(machine, UINT16, length/2);
639639   int i;
640640   UINT32 key1[4];
src/mame/machine/naomim1.c
r14976r14977
3131{
3232   naomi_board::device_start();
3333
34   const UINT8 *key_data = machine().region(key_tag)->base();
34   const UINT8 *key_data = memregion(key_tag)->base();
3535   key = (key_data[0] << 24) | (key_data[1] << 16) | (key_data[2] << 8) | key_data[3];
3636   buffer = auto_alloc_array(machine(), UINT8, BUFFER_SIZE);
3737
src/mame/machine/decocrpt.c
r14976r14977
600600
601601static void deco_decrypt(running_machine &machine,const char *rgntag,const UINT8 *xor_table,const UINT16 *address_table,const UINT8 *swap_table,int remap_only)
602602{
603   UINT16 *rom = (UINT16 *)machine.region(rgntag)->base();
604   int len = machine.region(rgntag)->bytes()/2;
603   UINT16 *rom = (UINT16 *)machine.root_device().memregion(rgntag)->base();
604   int len = machine.root_device().memregion(rgntag)->bytes()/2;
605605   UINT16 *buffer = auto_alloc_array(machine, UINT16, len);
606606   int i;
607607
src/mame/machine/simpsons.c
r14976r14977
6565
6666static KONAMI_SETLINES_CALLBACK( simpsons_banking )
6767{
68   memory_set_bank(device->machine(), "bank1", lines & 0x3f);
68   device->machine().root_device().membank("bank1")->set_entry(lines & 0x3f);
6969}
7070
7171static void simpsons_postload(running_machine &machine)
r14976r14977
118118   state->m_video_bank = 0;
119119
120120   /* init the default banks */
121   memory_configure_bank(machine, "bank1", 0, 64, machine.region("maincpu")->base() + 0x10000, 0x2000);
122   memory_set_bank(machine, "bank1", 0);
121   state->membank("bank1")->configure_entries(0, 64, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
122   state->membank("bank1")->set_entry(0);
123123
124   memory_configure_bank(machine, "bank2", 0, 2, machine.region("audiocpu")->base() + 0x10000, 0);
125   memory_configure_bank(machine, "bank2", 2, 6, machine.region("audiocpu")->base() + 0x10000, 0x4000);
126   memory_set_bank(machine, "bank2", 0);
124   state->membank("bank2")->configure_entries(0, 2, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0);
125   state->membank("bank2")->configure_entries(2, 6, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
126   state->membank("bank2")->set_entry(0);
127127
128128   simpsons_video_banking(machine, 0);
129129}
src/mame/machine/pgmprot3.c
r14976r14977
199199
200200static void pgm_create_dummy_internal_arm_region(running_machine &machine)
201201{
202   UINT16 *temp16 = (UINT16 *)machine.region("prot")->base();
202   UINT16 *temp16 = (UINT16 *)machine.root_device().memregion("prot")->base();
203203
204204   // fill with RX 14
205205   int i;
src/mame/machine/model1.c
r14976r14977
495495static TGP_FUNCTION( track_read_quad )
496496{
497497   model1_state *state = machine.driver_data<model1_state>();
498   const UINT32 *tgp_data = (const UINT32 *)machine.region("user2")->base();
498   const UINT32 *tgp_data = (const UINT32 *)state->memregion("user2")->base();
499499   UINT32 a = fifoin_pop(state);
500500   int offd;
501501
r14976r14977
885885static TGP_FUNCTION( track_read_info )
886886{
887887   model1_state *state = machine.driver_data<model1_state>();
888   const UINT32 *tgp_data = (const UINT32 *)machine.region("user2")->base();
888   const UINT32 *tgp_data = (const UINT32 *)state->memregion("user2")->base();
889889   UINT16 a = fifoin_pop(state);
890890   int offd;
891891
r14976r14977
10391039static TGP_FUNCTION( track_lookup )
10401040{
10411041   model1_state *state = machine.driver_data<model1_state>();
1042   const UINT32 *tgp_data = (const UINT32 *)machine.region("user2")->base();
1042   const UINT32 *tgp_data = (const UINT32 *)state->memregion("user2")->base();
10431043   float a = fifoin_pop_f(state);
10441044   UINT32 b = fifoin_pop(state);
10451045   float c = fifoin_pop_f(state);
src/mame/machine/jalcrpt.c
r14976r14977
44
55void phantasm_rom_decode(running_machine &machine, const char *region)
66{
7   UINT16   *RAM   =   (UINT16 *) machine.region(region)->base();
8   int i,      size   =   machine.region(region)->bytes();
7   UINT16   *RAM   =   (UINT16 *) machine.root_device().memregion(region)->base();
8   int i,      size   =   machine.root_device().memregion(region)->bytes();
99   if (size > 0x40000)   size = 0x40000;
1010
1111   for (i = 0 ; i < size/2 ; i++)
r14976r14977
3838
3939void astyanax_rom_decode(running_machine &machine, const char *region)
4040{
41   UINT16   *RAM   =   (UINT16 *) machine.region(region)->base();
42   int i,      size   =   machine.region(region)->bytes();
41   UINT16   *RAM   =   (UINT16 *) machine.root_device().memregion(region)->base();
42   int i,      size   =   machine.root_device().memregion(region)->bytes();
4343   if (size > 0x40000)   size = 0x40000;
4444
4545   for (i = 0 ; i < size/2 ; i++)
r14976r14977
7272
7373void rodland_rom_decode(running_machine &machine, const char *region)
7474{
75   UINT16   *RAM   =   (UINT16 *) machine.region(region)->base();
76   int i,      size   =   machine.region(region)->bytes();
75   UINT16   *RAM   =   (UINT16 *) machine.root_device().memregion(region)->base();
76   int i,      size   =   machine.root_device().memregion(region)->bytes();
7777   if (size > 0x40000)   size = 0x40000;
7878
7979   for (i = 0 ; i < size/2 ; i++)
r14976r14977
125125
126126   UINT8 *result_data;
127127
128   source_data = machine.region       ( region )->base();
129   source_size = machine.region( region )->bytes();
128   source_data = machine.root_device().memregion       ( region )->base();
129   source_size = machine.root_device().memregion( region )->bytes();
130130
131131   result_data = auto_alloc_array(machine, UINT8, source_size);
132132
r14976r14977
150150
151151   UINT8 *result_data;
152152
153   source_data = machine.region       ( region )->base();
154   source_size = machine.region( region )->bytes();
153   source_data = machine.root_device().memregion       ( region )->base();
154   source_size = machine.root_device().memregion( region )->bytes();
155155
156156   result_data = auto_alloc_array(machine, UINT8, source_size);
157157
r14976r14977
204204
205205   UINT8 *result_data;
206206
207   source_data = machine.region       ( region )->base();
208   source_size = machine.region( region )->bytes();
207   source_data = machine.root_device().memregion       ( region )->base();
208   source_size = machine.root_device().memregion( region )->bytes();
209209
210210   result_data = auto_alloc_array(machine, UINT8, source_size);
211211
src/mame/machine/micro3d.c
r14976r14977
320320      case 0x08:
321321      {
322322         int i;
323         const UINT16 *rom = (UINT16*)machine().region("vertex")->base();
323         const UINT16 *rom = (UINT16*)machine().root_device().memregion("vertex")->base();
324324
325325         for (i = 0; i <= cnt; ++i)
326326         {
r14976r14977
359359      case 0x0c:
360360      {
361361         int i;
362         const UINT16 *rom = (UINT16*)machine().region("vertex")->base();
362         const UINT16 *rom = (UINT16*)machine().root_device().memregion("vertex")->base();
363363
364364         for (i = 0; i <= cnt; ++i)
365365         {
r14976r14977
392392      case 0x0f:
393393      {
394394         int i;
395         const UINT16 *rom = (UINT16*)machine().region("vertex")->base();
395         const UINT16 *rom = (UINT16*)machine().root_device().memregion("vertex")->base();
396396
397397         for (i = 0; i <= cnt; ++i, vtx_addr += 4)
398398         {
src/mame/machine/btime.c
r14976r14977
66
77READ8_MEMBER(btime_state::mmonkey_protection_r)
88{
9   UINT8 *RAM = machine().region("maincpu")->base();
9   UINT8 *RAM = memregion("maincpu")->base();
1010   int ret = 0;
1111
1212   if (offset == 0x0000)
r14976r14977
2323
2424WRITE8_MEMBER(btime_state::mmonkey_protection_w)
2525{
26   UINT8 *RAM = machine().region("maincpu")->base();
26   UINT8 *RAM = memregion("maincpu")->base();
2727
2828   if (offset == 0)
2929   {
src/mame/machine/pacplus.c
r14976r14977
4646
4747   /* CPU ROMs */
4848
49   RAM = machine.region("maincpu")->base();
49   RAM = machine.root_device().memregion("maincpu")->base();
5050   for (i = 0; i < 0x4000; i++)
5151   {
5252      RAM[i] = decrypt(i,RAM[i]);
src/mame/machine/md_cart.c
r14976r14977
194194static WRITE16_HANDLER( genesis_ssf2_bank_w )
195195{
196196   md_cons_state *state = space->machine().driver_data<md_cons_state>();
197   UINT8 *ROM = space->machine().region("maincpu")->base();
197   UINT8 *ROM = state->memregion("maincpu")->base();
198198
199199   if ((state->m_md_cart.ssf2_lastoff != offset) || (state->m_md_cart.ssf2_lastdata != data))
200200   {
r14976r14977
325325   {
326326      case 0:
327327      {
328         UINT8 *ROM = space->machine().region("maincpu")->base();
328         UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
329329         /* printf("%06x data %04x\n",activecpu_get_pc(), data); */
330330         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN + (data & 0xffff) * 0x8000], 0x8000);
331331      }
r14976r14977
355355   md_cons_state *state = space->machine().driver_data<md_cons_state>();
356356   int bankdata = (data >> 9) & 0x7;
357357
358   UINT8 *ROM = space->machine().region("maincpu")->base();
358   UINT8 *ROM = state->memregion("maincpu")->base();
359359
360360   state->m_md_cart.realtec_old_bank_addr = state->m_md_cart.realtec_bank_addr;
361361   state->m_md_cart.realtec_bank_addr = (state->m_md_cart.realtec_bank_addr & 0x7) | bankdata << 3;
r14976r14977
368368{
369369   md_cons_state *state = space->machine().driver_data<md_cons_state>();
370370   int bankdata = (data >> 8) & 0x3;
371   UINT8 *ROM = space->machine().region("maincpu")->base();
371   UINT8 *ROM = state->memregion("maincpu")->base();
372372
373373   state->m_md_cart.realtec_old_bank_addr = state->m_md_cart.realtec_bank_addr;
374374   state->m_md_cart.realtec_bank_addr = (state->m_md_cart.realtec_bank_addr & 0xf8) | bankdata;
r14976r14977
385385 *************************************/
386386static WRITE16_HANDLER( chifi3_bank_w )
387387{
388   UINT8 *ROM = space->machine().region("maincpu")->base();
388   UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
389389
390390   if (data == 0xf100) // *hit player
391391   {
r14976r14977
489489 *************************************/
490490static WRITE16_HANDLER( s19in1_bank )
491491{
492   UINT8 *ROM = space->machine().region("maincpu")->base();
492   UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
493493   memcpy(ROM + 0x000000, ROM + 0x400000 + ((offset << 1) * 0x10000), 0x80000);
494494}
495495
r14976r14977
498498 *************************************/
499499static WRITE16_HANDLER( kaiju_bank_w )
500500{
501   UINT8 *ROM = space->machine().region("maincpu")->base();
501   UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
502502   memcpy(ROM + 0x000000, ROM + 0x400000 + (data & 0x7f) * 0x8000, 0x8000);
503503}
504504
r14976r14977
605605static READ16_HANDLER( radica_bank_select )
606606{
607607   int bank = offset & 0x3f;
608   UINT8 *ROM = space->machine().region("maincpu")->base();
608   UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
609609   memcpy(ROM, ROM + 0x400000 + (bank * 0x10000), 0x400000);
610610   return 0;
611611}
r14976r14977
772772
773773static WRITE16_HANDLER( topfig_bank_w )
774774{
775   UINT8 *ROM = space->machine().region("maincpu")->base();
775   UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
776776   if (data == 0x002a)
777777   {
778778      memcpy(ROM + 0x060000, ROM + 0x570000, 0x8000); // == 0x2e*0x8000?!
r14976r14977
819819 *************************************/
820820static WRITE16_HANDLER( mc_12in1_bank_w )
821821{
822   UINT8 *ROM = space->machine().region("maincpu")->base();
822   UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
823823   logerror("offset %06x", offset << 17);
824824   memcpy(ROM + 0x000000, ROM + VIRGIN_COPY_GEN + ((offset & 0x3f) << 17), 0x100000);
825825}
r14976r14977
854854      return state->m_md_cart.sram[offset];
855855   else
856856   {
857      ROM = space->machine().region("maincpu")->base();
857      ROM = state->memregion("maincpu")->base();
858858      rom_offset = state->m_md_cart.sram_start + (offset << 1);
859859
860860      return (UINT16) ROM[rom_offset] | (ROM[rom_offset + 1] << 8);
r14976r14977
10181018{
10191019   md_cons_state *state = machine.driver_data<md_cons_state>();
10201020   UINT32 mirroraddr;
1021   UINT8 *ROM = machine.region("maincpu")->base();
1021   UINT8 *ROM = state->memregion("maincpu")->base();
10221022
10231023   switch (state->m_md_cart.type)
10241024   {
r14976r14977
12351235         you need to return 1 @ 0xa13002 and 0???1f @ 0xa1303E (it does word reads).
12361236
12371237         */
1238      UINT16 *ROM16 = (UINT16 *)machine.region("maincpu")->base();
1238      UINT16 *ROM16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
12391239
12401240      ROM16[0x0dd19e/2] = 0x47F8;
12411241      ROM16[0x0dd1a0/2] = 0xFFF0;
r14976r14977
12541254         002476:6022
12551255
12561256         */
1257      UINT16 *ROM16 = (UINT16 *)machine.region("maincpu")->base();
1257      UINT16 *ROM16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
12581258
12591259      ROM16[0x06036/2] = 0xE000;
12601260      ROM16[0x02540/2] = 0x6026;
r14976r14977
12741274      //  ROM[0x01ED0/2] = 0xE000;
12751275      //  ROM[0x02540/2] = 0xE000;
12761276
1277      UINT16 *ROM16 = (UINT16 *)machine.region("maincpu")->base();
1277      UINT16 *ROM16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
12781278
12791279      ROM16[0x06036/2] = 0xE000;
12801280   }
r14976r14977
12871287{
12881288   running_machine &machine = image.device().machine();
12891289   md_cons_state *state = machine.driver_data<md_cons_state>();
1290   UINT8 *ROM = machine.region("maincpu")->base();
1290   UINT8 *ROM = state->memregion("maincpu")->base();
12911291   megadriv_backupram = NULL;
12921292   state->m_md_cart.sram = NULL;
12931293   state->m_md_cart.sram_start = state->m_md_cart.sram_end = 0;
r14976r14977
15461546#endif
15471547
15481548   // STEP 1: determine the file type (SMD? MD? BIN?)
1549   rawROM = image.device().machine().region("maincpu")->base();
1549   rawROM = state->memregion("maincpu")->base();
15501550   ROM = rawROM /*+ 512 */;
15511551
15521552   state->m_md_cart.last_loaded_image_length = -1;
r14976r14977
18811881static int megadrive_load_list(device_image_interface &image)
18821882{
18831883   md_cons_state *state = image.device().machine().driver_data<md_cons_state>();
1884   UINT8 *ROM = image.device().machine().region("maincpu")->base();
1884   UINT8 *ROM = state->memregion("maincpu")->base();
18851885   UINT32 length = image.get_software_region_length("rom");
18861886   const char   *pcb_name;
18871887   memcpy(ROM, image.get_software_region("rom"), length);
r14976r14977
19751975
19761976   /* Copy the cart image in the locations the driver expects */
19771977   // Notice that, by using pick_integer, we are sure the code works on both LE and BE machines
1978   ROM16 = (UINT16 *) image.device().machine().region("gamecart")->base();
1978   ROM16 = (UINT16 *) image.device().machine().root_device().memregion("gamecart")->base();
19791979   for (i = 0; i < length; i += 2)
19801980      ROM16[i / 2] = pick_integer_be(temp_copy, i, 2);
19811981
1982   ROM32 = (UINT32 *) image.device().machine().region("gamecart_sh2")->base();
1982   ROM32 = (UINT32 *) image.device().machine().root_device().memregion("gamecart_sh2")->base();
19831983   for (i = 0; i < length; i += 4)
19841984      ROM32[i / 4] = pick_integer_be(temp_copy, i, 4);
19851985
1986   ROM16 = (UINT16 *) image.device().machine().region("maincpu")->base();
1986   ROM16 = (UINT16 *) image.device().machine().root_device().memregion("maincpu")->base();
19871987   for (i = 0x00; i < length; i += 2)
19881988      ROM16[i / 2] = pick_integer_be(temp_copy, i, 2);
19891989
src/mame/machine/playch10.c
r14976r14977
4646MACHINE_START( pc10 )
4747{
4848   playch10_state *state = machine.driver_data<playch10_state>();
49   state->m_vrom = machine.region("gfx2")->base();
49   state->m_vrom = machine.root_device().memregion("gfx2")->base();
5050
5151   /* allocate 4K of nametable ram here */
5252   /* move to individual boards as documentation of actual boards allows */
r14976r14977
6161
6262   nvram_device *nvram = machine.device<nvram_device>("nvram");
6363   if (nvram != NULL)
64      nvram->set_base(machine.region("cart" )->base() + 0x6000, 0x1000);
64      nvram->set_base(state->memregion("cart" )->base() + 0x6000, 0x1000);
6565}
6666
6767MACHINE_START( playch10_hboard )
6868{
6969   playch10_state *state = machine.driver_data<playch10_state>();
70   state->m_vrom = machine.region("gfx2")->base();
70   state->m_vrom = state->memregion("gfx2")->base();
7171
7272   /* allocate 4K of nametable ram here */
7373   /* move to individual boards as documentation of actual boards allows */
r14976r14977
196196      /* is the actual protection memory area                     */
197197      /* setting the whole 0x2000 region every time is a waste    */
198198      /* so we just set $ffff with the current value              */
199      machine().region("maincpu")->base()[0xffff] = pc10_prot_r(space, 0);
199      memregion("maincpu")->base()[0xffff] = pc10_prot_r(space, 0);
200200   }
201201}
202202
r14976r14977
370370   /* yeah, this is probably a horrible assumption to make.*/
371371   /* but the driver is 100% consistant */
372372
373   len = machine.region("gfx2")->bytes();
373   len = state->memregion("gfx2")->bytes();
374374   len /= 0x400;   // convert to KB
375375   len /= size;   // convert to bank resolution
376376   len--;         // convert to mask
r14976r14977
548548         case 3:   /* program banking */
549549            {
550550               int bank = (m_mmc1_shiftreg & m_mmc1_rom_mask) * 0x4000;
551               UINT8 *prg = machine().region("cart")->base();
551               UINT8 *prg = memregion("cart")->base();
552552
553553               if (!size16k)
554554               {
r14976r14977
605605WRITE8_MEMBER(playch10_state::bboard_rom_switch_w)
606606{
607607   int bankoffset = 0x10000 + ((data & 7) * 0x4000);
608   UINT8 *prg = machine().region("cart")->base();
608   UINT8 *prg = memregion("cart")->base();
609609
610610   memcpy(&prg[0x08000], &prg[bankoffset], 0x4000);
611611}
r14976r14977
613613DRIVER_INIT( pcbboard )
614614{
615615   playch10_state *state = machine.driver_data<playch10_state>();
616   UINT8 *prg = machine.region("cart")->base();
616   UINT8 *prg = state->memregion("cart")->base();
617617
618618   /* We do manual banking, in case the code falls through */
619619   /* Copy the initial banks */
r14976r14977
661661DRIVER_INIT( pcdboard )
662662{
663663   playch10_state *state = machine.driver_data<playch10_state>();
664   UINT8 *prg = machine.region("cart")->base();
664   UINT8 *prg = state->memregion("cart")->base();
665665
666666   /* We do manual banking, in case the code falls through */
667667   /* Copy the initial banks */
r14976r14977
736736      case 0x2000: /* code bank switching */
737737         {
738738            int bankoffset = 0x10000 + (data & 0x0f) * 0x2000;
739            UINT8 *prg = machine().region("cart")->base();
739            UINT8 *prg = memregion("cart")->base();
740740            memcpy(&prg[0x08000], &prg[bankoffset], 0x2000);
741741         }
742742      break;
r14976r14977
776776{
777777   playch10_state *state = machine.driver_data<playch10_state>();
778778   ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
779   UINT8 *prg = machine.region("cart")->base();
779   UINT8 *prg = state->memregion("cart")->base();
780780
781781   /* we have no vram, make sure switching games doesn't point to an old allocation */
782782   state->m_vram = NULL;
r14976r14977
804804DRIVER_INIT( pcfboard )
805805{
806806   playch10_state *state = machine.driver_data<playch10_state>();
807   UINT8 *prg = machine.region("cart")->base();
807   UINT8 *prg = state->memregion("cart")->base();
808808
809809   /* we have no vram, make sure switching games doesn't point to an old allocation */
810810   state->m_vram = NULL;
r14976r14977
867867         if (m_gboard_last_bank != (data & 0xc0))
868868         {
869869            int bank;
870            UINT8 *prg = machine().region("cart")->base();
870            UINT8 *prg = memregion("cart")->base();
871871
872872            /* reset the banks */
873873            if (m_gboard_command & 0x40)
r14976r14977
920920
921921               case 6: /* program banking */
922922               {
923                  UINT8 *prg = machine().region("cart")->base();
923                  UINT8 *prg = memregion("cart")->base();
924924                  if (m_gboard_command & 0x40)
925925                  {
926926                     /* high bank */
r14976r14977
945945               case 7: /* program banking */
946946                  {
947947                     /* mid bank */
948                     UINT8 *prg = machine().region("cart")->base();
948                     UINT8 *prg = memregion("cart")->base();
949949                     m_gboard_banks[1] = data & 0x1f;
950950                     bank = m_gboard_banks[1] * 0x2000 + 0x10000;
951951
r14976r14977
991991DRIVER_INIT( pcgboard )
992992{
993993   playch10_state *state = machine.driver_data<playch10_state>();
994   UINT8 *prg = machine.region("cart")->base();
994   UINT8 *prg = state->memregion("cart")->base();
995995   state->m_vram = NULL;
996996
997997   /* We do manual banking, in case the code falls through */
r14976r14977
10321032WRITE8_MEMBER(playch10_state::iboard_rom_switch_w)
10331033{
10341034   int bank = data & 7;
1035   UINT8 *prg = machine().region("cart")->base();
1035   UINT8 *prg = memregion("cart")->base();
10361036
10371037   if (data & 0x10)
10381038      pc10_set_mirroring(PPU_MIRROR_HIGH);
r14976r14977
10451045DRIVER_INIT( pciboard )
10461046{
10471047   playch10_state *state = machine.driver_data<playch10_state>();
1048   UINT8 *prg = machine.region("cart")->base();
1048   UINT8 *prg = state->memregion("cart")->base();
10491049
10501050   /* We do manual banking, in case the code falls through */
10511051   /* Copy the initial banks */
r14976r14977
11151115DRIVER_INIT( pchboard )
11161116{
11171117   playch10_state *state = machine.driver_data<playch10_state>();
1118   UINT8 *prg = machine.region("cart")->base();
1118   UINT8 *prg = state->memregion("cart")->base();
11191119   memcpy(&prg[0x08000], &prg[0x4c000], 0x4000);
11201120   memcpy(&prg[0x0c000], &prg[0x4c000], 0x4000);
11211121
r14976r14977
11421142DRIVER_INIT( pckboard )
11431143{
11441144   playch10_state *state = machine.driver_data<playch10_state>();
1145   UINT8 *prg = machine.region("cart")->base();
1145   UINT8 *prg = state->memregion("cart")->base();
11461146
11471147   /* We do manual banking, in case the code falls through */
11481148   /* Copy the initial banks */
src/mame/machine/s16fd.c
r14976r14977
203203
204204   strcpy(fd1094_cputag, tag);
205205
206   fd1094_cpuregion = (UINT16*)machine.region(fd1094_cputag)->base();
207   fd1094_cpuregionsize = machine.region(fd1094_cputag)->bytes();
208   fd1094_key = machine.region("user1")->base();
206   fd1094_cpuregion = (UINT16*)machine.root_device().memregion(fd1094_cputag)->base();
207   fd1094_cpuregionsize = machine.root_device().memregion(fd1094_cputag)->bytes();
208   fd1094_key = machine.root_device().memregion("user1")->base();
209209   fd1094_set_decrypted = set_decrypted;
210210
211211   /* punt if no key; this allows us to be called even for non-FD1094 games */
r14976r14977
222222
223223   /* key debugging */
224224#if KEY_DEBUGGING
225   if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0 && machine.region("user2")->base() != NULL)
225   if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0 && machine.root_device().memregion("user2")->base() != NULL)
226226   {
227227      fd1094_init_debugging(machine, fd1094_cputag, "user1", "user2", key_changed);
228228   }
src/mame/machine/snessdd1.c
r14976r14977
662662
663663static UINT8 sdd1_read(running_machine& machine, UINT32 addr)
664664{
665   unsigned char *ROM = machine.region("cart")->base();
665   unsigned char *ROM = machine.root_device().memregion("cart")->base();
666666
667667   if(snes_sdd1.sdd1_enable & snes_sdd1.xfer_enable)
668668   {
src/mame/machine/atari.c
r14976r14977
112112      logerror("%s MMU SELFTEST ROM\n", machine.system().name);
113113      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x57ff, "bank2");
114114      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x5000, 0x57ff);
115      memory_set_bankptr(machine, "bank2", machine.region("maincpu")->base() + 0x5000);
115      machine.root_device().membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x5000);
116116   }
117117}
118118
src/mame/machine/naomim2.c
r14976r14977
2020{
2121   naomi_board::device_start();
2222
23   const UINT8 *key_data = machine().region(key_tag)->base();
23   const UINT8 *key_data = memregion(key_tag)->base();
2424   key = (key_data[0] << 24) | (key_data[1] << 16) | (key_data[2] << 8) | key_data[3];
2525
2626   ram = auto_alloc_array(machine(), UINT8, RAM_SIZE);
src/mame/machine/smpc.c
r14976r14977
189189
190190   if(state->m_prev_bankswitch != param)
191191   {
192      game_region = machine.region(banknames[param])->base();
192      game_region = machine.root_device().memregion(banknames[param])->base();
193193
194194      if (game_region)
195         memcpy(machine.region("abus")->base(), game_region, 0x3000000);
195         memcpy(machine.root_device().memregion("abus")->base(), game_region, 0x3000000);
196196      else
197         memset(machine.region("abus")->base(), 0x00, 0x3000000);
197         memset(machine.root_device().memregion("abus")->base(), 0x00, 0x3000000);
198198
199199      state->m_prev_bankswitch = param;
200200   }
src/mame/machine/pgmcrypt.c
r14976r14977
2727{
2828
2929   int i;
30   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
30   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
3131
3232   int rom_size = 0x400000;
3333
r14976r14977
8989{
9090
9191   int i;
92   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
92   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
9393
9494   int rom_size = 0x400000;
9595
r14976r14977
130130{
131131
132132   int i;
133   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
133   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
134134
135135   int rom_size = 0x80000;
136136
r14976r14977
172172{
173173
174174   int i;
175   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
175   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
176176
177177   int rom_size = 0x400000;
178178
r14976r14977
232232{
233233
234234   int i;
235   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
235   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
236236
237237   int rom_size = 0x100000;
238238
r14976r14977
272272//  UINT16 *src=(UINT16 *) (OP_ROM+0x100000);
273273
274274   int i;
275   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
275   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
276276
277277   int rom_size = 0x100000;
278278
r14976r14977
304304//  UINT16 *src=(UINT16 *) (OP_ROM+0x100000);
305305
306306   int i;
307   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
307   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
308308
309309   int rom_size = 0x200000;
310310
r14976r14977
343343void pgm_dfront_decrypt(running_machine &machine)
344344{
345345   int i;
346   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
346   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
347347
348348   int rom_size = 0x400000;
349349
r14976r14977
403403void pgm_ddp2_decrypt(running_machine &machine)
404404{
405405   int i;
406   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
406   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
407407
408408   int rom_size = 0x200000;
409409
r14976r14977
457457void pgm_mm_decrypt(running_machine &machine) // and dw2001
458458{
459459   int i;
460   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
460   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
461461
462462   int rom_size = 0x200000;
463463
r14976r14977
516516void pgm_kov2_decrypt(running_machine &machine)
517517{
518518   int i;
519   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
519   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
520520
521521   int rom_size = 0x200000;
522522
r14976r14977
572572void pgm_kov2p_decrypt(running_machine &machine)
573573{
574574   int i;
575   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
575   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
576576
577577   int rom_size = 0x200000;
578578
r14976r14977
631631void pgm_puzzli2_decrypt(running_machine &machine)
632632{
633633   int i;
634   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
634   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
635635
636636   int rom_size = 0x100000;
637637
r14976r14977
690690void pgm_theglad_decrypt(running_machine &machine)
691691{
692692   int i;
693   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
693   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
694694
695695   int rom_size = 0x200000;
696696
r14976r14977
750750void pgm_oldsplus_decrypt(running_machine &machine)
751751{
752752   int i;
753   unsigned short *src = (unsigned short *)(machine.region("maincpu")->base()+0x100000);
753   unsigned short *src = (unsigned short *)(machine.root_device().memregion("maincpu")->base()+0x100000);
754754
755755   int rom_size = 0x400000;
756756
r14976r14977
810810void pgm_kovshp_decrypt(running_machine &machine)
811811{
812812   int i;
813   unsigned short *src = (unsigned short *)(machine.region("maincpu")->base()+0x100000);
813   unsigned short *src = (unsigned short *)(machine.root_device().memregion("maincpu")->base()+0x100000);
814814
815815   int rom_size = 0x400000;
816816
r14976r14977
870870void pgm_killbldp_decrypt(running_machine &machine)
871871{
872872   int i;
873   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
873   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
874874
875875   int rom_size = 0x200000;
876876
r14976r14977
911911void pgm_svg_decrypt(running_machine &machine)
912912{
913913   int i;
914   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
914   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
915915
916916   int rom_size = 0x800000;
917917
r14976r14977
968968void pgm_svgpcb_decrypt(running_machine &machine)
969969{
970970   int i;
971   UINT16 *src = (UINT16 *)(machine.region("user1")->base());
971   UINT16 *src = (UINT16 *)(machine.root_device().memregion("user1")->base());
972972
973973   int rom_size = 0x800000;
974974
r14976r14977
10141014void pgm_py2k2_decrypt(running_machine &machine) // and ddpdoj/ddpdojbl
10151015{
10161016   int i;
1017   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base()+0x100000);
1017   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base()+0x100000);
10181018
10191019   int rom_size = 0x400000;
10201020
r14976r14977
10601060void pgm_ket_decrypt(running_machine &machine)
10611061{
10621062   int i;
1063   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
1063   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
10641064
10651065   int rom_size = 0x400000;
10661066
r14976r14977
11061106void pgm_espgal_decrypt(running_machine &machine)
11071107{
11081108   int i;
1109   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
1109   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
11101110
11111111   int rom_size = 0x400000;
11121112
r14976r14977
11531153void pgm_happy6_decrypt(running_machine &machine)
11541154{
11551155   int i;
1156   UINT16 *src = (UINT16 *) (machine.region("user1")->base());
1156   UINT16 *src = (UINT16 *) (machine.root_device().memregion("user1")->base());
11571157
11581158   int rom_size = 0x400000;
11591159
src/mame/machine/segas32.c
r14976r14977
3636void decrypt_ga2_protrom(running_machine &machine)
3737{
3838   int i;
39   UINT8 *rom = machine.region("mcu")->base();
39   UINT8 *rom = machine.root_device().memregion("mcu")->base();
4040   UINT8* temp = auto_alloc_array(machine, UINT8, 0x100000);
4141
4242   // make copy of ROM so original can be overwritten
r14976r14977
113113      }
114114      else
115115      {
116         const UINT8 *ROM = machine().region("maincpu")->base();
116         const UINT8 *ROM = memregion("maincpu")->base();
117117         level =  *((ROM + LEVEL_ORDER_ARRAY) + (m_system32_workram[CLEARED_LEVELS / 2] * 2) - 1);
118118         level |= *((ROM + LEVEL_ORDER_ARRAY) + (m_system32_workram[CLEARED_LEVELS / 2] * 2) - 2) << 8;
119119      }
r14976r14977
163163   };
164164   char ret[32];
165165   int curProtType;
166   UINT8 *ROM = machine().region("maincpu")->base();
166   UINT8 *ROM = memregion("maincpu")->base();
167167
168168   switch (offset)
169169   {
src/mame/machine/slapfght.c
r14976r14977
6565
6666WRITE8_MEMBER(slapfght_state::slapfight_port_08_w)
6767{
68   UINT8 *RAM = machine().region("maincpu")->base();
68   UINT8 *RAM = memregion("maincpu")->base();
6969
70   memory_set_bankptr(machine(), "bank1",&RAM[0x10000]);
70   membank("bank1")->set_base(&RAM[0x10000]);
7171}
7272
7373WRITE8_MEMBER(slapfght_state::slapfight_port_09_w)
7474{
75   UINT8 *RAM = machine().region("maincpu")->base();
75   UINT8 *RAM = memregion("maincpu")->base();
7676
77   memory_set_bankptr(machine(), "bank1",&RAM[0x14000]);
77   membank("bank1")->set_base(&RAM[0x14000]);
7878}
7979
8080
src/mame/machine/acitya.c
r14976r14977
2222   int mem;
2323   UINT8 *RAM;
2424
25   RAM = machine.region("maincpu")->base();
25   RAM = machine.root_device().memregion("maincpu")->base();
2626
2727
2828   for (mem=0;mem<0x4000;mem++)
r14976r14977
5858   int mem;
5959   UINT8 *RAM;
6060
61   RAM = machine.region("maincpu")->base();
61   RAM = machine.root_device().memregion("maincpu")->base();
6262
6363   for (mem=0;mem<0x4000;mem++)
6464   {
r14976r14977
9191   int mem;
9292   UINT8 *RAM;
9393
94   RAM = machine.region("maincpu")->base();
94   RAM = machine.root_device().memregion("maincpu")->base();
9595
9696   for (mem=0;mem<0x4000;mem++)
9797   {
r14976r14977
124124   int mem;
125125   UINT8 *RAM;
126126
127   RAM = machine.region("maincpu")->base();
127   RAM = machine.root_device().memregion("maincpu")->base();
128128
129129   for (mem=0;mem<0x4000;mem++)
130130   {
r14976r14977
168168
169169   switch(state->m_counter)
170170   {
171      case 0x08:   memory_set_bank (space->machine(), "bank1", 0);      break;
172      case 0x09:   memory_set_bank (space->machine(), "bank1", 1);      break;
173      case 0x0A:   memory_set_bank (space->machine(), "bank1", 2);      break;
174      case 0x0B:   memory_set_bank (space->machine(), "bank1", 3);      break;
171      case 0x08:   state->membank ("bank1")->set_entry (0);      break;
172      case 0x09:   state->membank ("bank1")->set_entry (1);      break;
173      case 0x0A:   state->membank ("bank1")->set_entry (2);      break;
174      case 0x0B:   state->membank ("bank1")->set_entry (3);      break;
175175      default:
176176         logerror("Invalid counter = %02X\n",state->m_counter);
177177         break;
r14976r14977
184184MACHINE_START( acitya )
185185{
186186   pacman_state *state = machine.driver_data<pacman_state>();
187   UINT8 *RAM = machine.region("maincpu")->base();
187   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
188188
189189   /* While the PAL supports up to 16 decryption methods, only four
190190        are actually used in the PAL.  Therefore, we'll take a little
r14976r14977
194194   acitya_decrypt_rom_A(machine);
195195   acitya_decrypt_rom_B(machine);
196196
197   memory_configure_bank(machine, "bank1", 0, 4, &RAM[0x10000], 0x4000);
197   state->membank("bank1")->configure_entries(0, 4, &RAM[0x10000], 0x4000);
198198
199199   state_save_register_global(machine, state->m_counter);
200200}
r14976r14977
205205   pacman_state *state = machine.driver_data<pacman_state>();
206206   /* The initial state of the counter is 0x0B */
207207   state->m_counter = 0x0B;
208   memory_set_bank(machine, "bank1", 3);
208   state->membank("bank1")->set_entry(3);
209209}
src/mame/machine/pgmprot4.c
r14976r14977
107107        };
108108        */
109109      int x;
110      UINT16 *PROTROM = (UINT16*)machine.region("igs022data")->base();
110      UINT16 *PROTROM = (UINT16*)machine.root_device().memregion("igs022data")->base();
111111
112112      for (x = 0; x < size; x++)
113113      {
114         //UINT16 *RAMDUMP = (UINT16*)space->machine().region("user2")->base();
114         //UINT16 *RAMDUMP = (UINT16*)space->machine().root_device().memregion("user2")->base();
115115         //UINT16 dat = RAMDUMP[dst + x];
116116
117117         UINT16 dat2 = PROTROM[src + x];
118118
119119         UINT8 extraoffset = param&0xfe; // the lowest bit changed the table addressing in tests, see 'rawDataOdd' table instead.. it's still related to the main one, not identical
120         UINT8* dectable = (UINT8*)machine.region("igs022data")->base();//rawDataEven; // the basic decryption table is at the start of the mcu data rom! at least in killbld
120         UINT8* dectable = (UINT8*)machine.root_device().memregion("igs022data")->base();//rawDataEven; // the basic decryption table is at the start of the mcu data rom! at least in killbld
121121         UINT16 extraxor = ((dectable[((x*2)+0+extraoffset)&0xff]) << 8) | (dectable[((x*2)+1+extraoffset)&0xff] << 0);
122122
123123         dat2 = ((dat2 & 0x00ff)<<8) | ((dat2 & 0xff00)>>8);
r14976r14977
148148   {
149149      /* mode 5 seems to be a straight copy */
150150      int x;
151      UINT16 *PROTROM = (UINT16*)machine.region("igs022data")->base();
151      UINT16 *PROTROM = (UINT16*)machine.root_device().memregion("igs022data")->base();
152152      for (x = 0; x < size; x++)
153153      {
154154         UINT16 dat = PROTROM[src + x];
r14976r14977
161161   {
162162      /* mode 6 seems to swap bytes and nibbles */
163163      int x;
164      UINT16 *PROTROM = (UINT16*)machine.region("igs022data")->base();
164      UINT16 *PROTROM = (UINT16*)machine.root_device().memregion("igs022data")->base();
165165      for (x = 0; x < size; x++)
166166      {
167167         UINT16 dat = PROTROM[src + x];
r14976r14977
194194static void IGS022_reset(running_machine& machine)
195195{
196196   int i;
197   UINT16 *PROTROM = (UINT16*)machine.region("igs022data")->base();
197   UINT16 *PROTROM = (UINT16*)machine.root_device().memregion("igs022data")->base();
198198   pgm_022_025_state *state = machine.driver_data<pgm_022_025_state>();
199199   UINT16 tmp;
200200
r14976r14977
534534
535535    {
536536        int x;
537        UINT16 *RAMDUMP = (UINT16*)machine.region("user2")->base();
537        UINT16 *RAMDUMP = (UINT16*)state->memregion("user2")->base();
538538        for (x=0;x<(0x4000/2);x++)
539539        {
540540            state->m_sharedprotram[x] = RAMDUMP[x];
src/mame/machine/decocass.c
r14976r14977
297297   {
298298      offs_t promaddr;
299299      UINT8 save;
300      UINT8 *prom = space->machine().region("dongle")->base();
300      UINT8 *prom = space->machine().root_device().memregion("dongle")->base();
301301
302302      if (state->m_firsttime)
303303      {
r14976r14977
377377   {
378378      offs_t promaddr;
379379      UINT8 save;
380      UINT8 *prom = space->machine().region("dongle")->base();
380      UINT8 *prom = space->machine().root_device().memregion("dongle")->base();
381381
382382      if (state->m_firsttime)
383383      {
r14976r14977
457457   {
458458      offs_t promaddr;
459459      UINT8 save;
460      UINT8 *prom = space->machine().region("dongle")->base();
460      UINT8 *prom = space->machine().root_device().memregion("dongle")->base();
461461
462462      if (state->m_firsttime)
463463      {
r14976r14977
537537   {
538538      offs_t promaddr;
539539      UINT8 save;
540      UINT8 *prom = space->machine().region("dongle")->base();
540      UINT8 *prom = space->machine().root_device().memregion("dongle")->base();
541541
542542      if (state->m_firsttime)
543543      {
r14976r14977
619619   {
620620      offs_t promaddr;
621621      UINT8 save;
622      UINT8 *prom = space->machine().region("dongle")->base();
622      UINT8 *prom = space->machine().root_device().memregion("dongle")->base();
623623
624624      if (state->m_firsttime)
625625      {
r14976r14977
687687   {
688688      if (1 == (offset & 1))
689689      {
690         UINT8 *prom = space->machine().region("dongle")->base();
690         UINT8 *prom = state->memregion("dongle")->base();
691691         data = prom[256 * state->m_type2_d2_latch + state->m_type2_promaddr];
692692         LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, 256 * state->m_type2_d2_latch + state->m_type2_promaddr));
693693      }
r14976r14977
771771   {
772772      if (1 == state->m_type3_pal_19)
773773      {
774         UINT8 *prom = space->machine().region("dongle")->base();
774         UINT8 *prom = state->memregion("dongle")->base();
775775         data = prom[state->m_type3_ctrs];
776776         LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, state->m_type3_ctrs));
777777         if (++state->m_type3_ctrs == 4096)
r14976r14977
10241024   {
10251025      if (state->m_type4_latch)
10261026      {
1027         UINT8 *prom = space->machine().region("dongle")->base();
1027         UINT8 *prom = space->machine().root_device().memregion("dongle")->base();
10281028
10291029         data = prom[state->m_type4_ctrs];
10301030         LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.', state->m_type4_ctrs));
r14976r14977
12881288{
12891289   decocass_state *state = space->machine().driver_data<decocass_state>();
12901290   state->m_de0091_enable = data & 1;
1291   memory_set_bank(space->machine(), "bank1", data & 1);
1291   state->membank("bank1")->set_entry(data & 1);
12921292   /* Perhaps the second row of ROMs is enabled by another bit.
12931293     * There is no way to verify this yet, so for now just look
12941294     * at bit 0 to enable the daughter board at reads between
r14976r14977
16481648MACHINE_RESET( czeroize )
16491649{
16501650   decocass_state *state = machine.driver_data<decocass_state>();
1651   UINT8 *mem = machine.region("dongle")->base();
1651   UINT8 *mem = state->memregion("dongle")->base();
16521652   decocass_reset_common(machine);
16531653   LOG(0,("dongle type #3 (PAL)\n"));
16541654   state->m_dongle_r = decocass_type3_r;
src/mame/machine/konppc.c
r14976r14977
118118{
119119   texture_bank[board] = bank;
120120
121   memory_configure_bank(machine, bank, 0, 2, rom, 0x800000);
121   machine.root_device().membank(bank)->configure_entries(0, 2, rom, 0x800000);
122122}
123123
124124/*****************************************************************************/
r14976r14977
254254            {
255255               int offset = (data & 0x08) ? 1 : 0;
256256
257               memory_set_bank(space->machine(), texture_bank[board], offset);
257               space->machine().root_device().membank(texture_bank[board])->set_entry(offset);
258258            }
259259         }
260260         break;
r14976r14977
268268            {
269269               int offset = (data & 0x08) ? 1 : 0;
270270
271               memory_set_bank(space->machine(), texture_bank[board], offset);
271               space->machine().root_device().membank(texture_bank[board])->set_entry(offset);
272272            }
273273         }
274274         break;
src/mame/machine/irobot.c
r14976r14977
101101
102102WRITE8_MEMBER(irobot_state::irobot_out0_w)
103103{
104   UINT8 *RAM = machine().region("maincpu")->base();
104   UINT8 *RAM = memregion("maincpu")->base();
105105
106106   m_out0 = data;
107107   switch (data & 0x60)
108108   {
109109      case 0:
110         memory_set_bankptr(machine(), "bank2", &RAM[0x1C000]);
110         membank("bank2")->set_base(&RAM[0x1C000]);
111111         break;
112112      case 0x20:
113         memory_set_bankptr(machine(), "bank2", &RAM[0x1C800]);
113         membank("bank2")->set_base(&RAM[0x1C800]);
114114         break;
115115      case 0x40:
116         memory_set_bankptr(machine(), "bank2", &RAM[0x1D000]);
116         membank("bank2")->set_base(&RAM[0x1D000]);
117117         break;
118118   }
119119   m_outx = (data & 0x18) >> 3;
r14976r14977
123123
124124WRITE8_MEMBER(irobot_state::irobot_rom_banksel_w)
125125{
126   UINT8 *RAM = machine().region("maincpu")->base();
126   UINT8 *RAM = memregion("maincpu")->base();
127127
128128   switch ((data & 0x0E) >> 1)
129129   {
130130      case 0:
131         memory_set_bankptr(machine(), "bank1", &RAM[0x10000]);
131         membank("bank1")->set_base(&RAM[0x10000]);
132132         break;
133133      case 1:
134         memory_set_bankptr(machine(), "bank1", &RAM[0x12000]);
134         membank("bank1")->set_base(&RAM[0x12000]);
135135         break;
136136      case 2:
137         memory_set_bankptr(machine(), "bank1", &RAM[0x14000]);
137         membank("bank1")->set_base(&RAM[0x14000]);
138138         break;
139139      case 3:
140         memory_set_bankptr(machine(), "bank1", &RAM[0x16000]);
140         membank("bank1")->set_base(&RAM[0x16000]);
141141         break;
142142      case 4:
143         memory_set_bankptr(machine(), "bank1", &RAM[0x18000]);
143         membank("bank1")->set_base(&RAM[0x18000]);
144144         break;
145145      case 5:
146         memory_set_bankptr(machine(), "bank1", &RAM[0x1A000]);
146         membank("bank1")->set_base(&RAM[0x1A000]);
147147         break;
148148   }
149149   set_led_status(machine(), 0,data & 0x10);
r14976r14977
170170MACHINE_RESET( irobot )
171171{
172172   irobot_state *state = machine.driver_data<irobot_state>();
173   UINT8 *MB = machine.region("mathbox")->base();
173   UINT8 *MB = state->memregion("mathbox")->base();
174174
175175   /* initialize the memory regions */
176176   state->m_mbROM      = MB + 0x00000;
r14976r14977
332332static void load_oproms(running_machine &machine)
333333{
334334   irobot_state *state = machine.driver_data<irobot_state>();
335   UINT8 *MB = machine.region("proms")->base() + 0x20;
335   UINT8 *MB = state->memregion("proms")->base() + 0x20;
336336   int i;
337337
338338   /* allocate RAM */
src/mame/machine/leland.c
r14976r14977
354354   state->m_alternate_bank = 0;
355355
356356   /* initialize the master banks */
357   state->m_master_length = machine.region("master")->bytes();
358   state->m_master_base = machine.region("master")->base();
357   state->m_master_length = machine.root_device().memregion("master")->bytes();
358   state->m_master_base = machine.root_device().memregion("master")->base();
359359   (*state->m_update_master_bank)(machine);
360360
361361   /* initialize the slave banks */
362   state->m_slave_length = machine.region("slave")->bytes();
363   state->m_slave_base = machine.region("slave")->base();
362   state->m_slave_length = machine.root_device().memregion("slave")->bytes();
363   state->m_slave_base = state->memregion("slave")->base();
364364   if (state->m_slave_length > 0x10000)
365      memory_set_bankptr(machine, "bank3", &state->m_slave_base[0x10000]);
365      state->membank("bank3")->set_base(&state->m_slave_base[0x10000]);
366366}
367367
368368
r14976r14977
385385   state->m_master_int_timer->adjust(machine.primary_screen->time_until_pos(8), 8);
386386
387387   /* initialize the XROM */
388   state->m_xrom_length = machine.region("user1")->bytes();
389   state->m_xrom_base = machine.region("user1")->base();
388   state->m_xrom_length = machine.root_device().memregion("user1")->bytes();
389   state->m_xrom_base = machine.root_device().memregion("user1")->base();
390390   state->m_xrom1_addr = 0;
391391   state->m_xrom2_addr = 0;
392392
r14976r14977
400400   state->m_master_bank = 0;
401401
402402   /* initialize the master banks */
403   state->m_master_length = machine.region("master")->bytes();
404   state->m_master_base = machine.region("master")->base();
403   state->m_master_length = machine.root_device().memregion("master")->bytes();
404   state->m_master_base = machine.root_device().memregion("master")->base();
405405   ataxx_bankswitch(machine);
406406
407407   /* initialize the slave banks */
408   state->m_slave_length = machine.region("slave")->bytes();
409   state->m_slave_base = machine.region("slave")->base();
408   state->m_slave_length = machine.root_device().memregion("slave")->bytes();
409   state->m_slave_base = state->memregion("slave")->base();
410410   if (state->m_slave_length > 0x10000)
411      memory_set_bankptr(machine, "bank3", &state->m_slave_base[0x10000]);
411      state->membank("bank3")->set_base(&state->m_slave_base[0x10000]);
412412}
413413
414414
r14976r14977
494494   state->m_battery_ram_enable = ((state->m_sound_port_bank & 0x24) == 0);
495495
496496   address = (!(state->m_sound_port_bank & 0x04)) ? &state->m_master_base[0x10000] : &state->m_master_base[0x1c000];
497   memory_set_bankptr(machine, "bank1", address);
497   state->membank("bank1")->set_base(address);
498498
499499   address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000];
500   memory_set_bankptr(machine, "bank2", address);
500   state->membank("bank2")->set_base(address);
501501}
502502
503503
r14976r14977
510510   state->m_battery_ram_enable = ((state->m_top_board_bank & 0x80) != 0);
511511
512512   address = (!(state->m_alternate_bank & 1)) ? &state->m_master_base[0x02000] : &state->m_master_base[0x12000];
513   memory_set_bankptr(machine, "bank1", address);
513   state->membank("bank1")->set_base(address);
514514
515515   address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000];
516   memory_set_bankptr(machine, "bank2", address);
516   state->membank("bank2")->set_base(address);
517517}
518518
519519
r14976r14977
529529      address = (!(state->m_sound_port_bank & 0x04)) ? &state->m_master_base[0x10000] : &state->m_master_base[0x1c000];
530530   else
531531      address = (!(state->m_top_board_bank & 0x40)) ? &state->m_master_base[0x28000] : &state->m_master_base[0x30000];
532   memory_set_bankptr(machine, "bank1", address);
532   state->membank("bank1")->set_base(address);
533533
534534   address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000];
535   memory_set_bankptr(machine, "bank2", address);
535   state->membank("bank2")->set_base(address);
536536}
537537
538538
r14976r14977
546546   state->m_battery_ram_enable = ((state->m_alternate_bank & 3) == 1);
547547
548548   address = &state->m_master_base[bank_list[state->m_alternate_bank & 3]];
549   memory_set_bankptr(machine, "bank1", address);
549   state->membank("bank1")->set_base(address);
550550
551551   address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000];
552   memory_set_bankptr(machine, "bank2", address);
552   state->membank("bank2")->set_base(address);
553553}
554554
555555
r14976r14977
568568      logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_alternate_bank & 3);
569569      address = &state->m_master_base[bank_list[0]];
570570   }
571   memory_set_bankptr(machine, "bank1", address);
571   state->membank("bank1")->set_base(address);
572572
573573   address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000];
574   memory_set_bankptr(machine, "bank2", address);
574   state->membank("bank2")->set_base(address);
575575}
576576
577577
r14976r14977
590590      logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_alternate_bank & 7);
591591      address = &state->m_master_base[bank_list[0]];
592592   }
593   memory_set_bankptr(machine, "bank1", address);
593   state->membank("bank1")->set_base(address);
594594
595595   address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000];
596   memory_set_bankptr(machine, "bank2", address);
596   state->membank("bank2")->set_base(address);
597597}
598598
599599
r14976r14977
616616      logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_master_bank & 15);
617617      address = &state->m_master_base[bank_list[0]];
618618   }
619   memory_set_bankptr(machine, "bank1", address);
619   state->membank("bank1")->set_base(address);
620620
621621   if (state->m_battery_ram_enable)
622622      address = state->m_battery_ram;
r14976r14977
624624      address = &state->m_ataxx_qram[(state->m_master_bank & 0xc0) << 8];
625625   else
626626      address = &state->m_master_base[0xa000];
627   memory_set_bankptr(machine, "bank2", address);
627   state->membank("bank2")->set_base(address);
628628
629629   state->m_wcol_enable = ((state->m_master_bank & 0x30) == 0x30);
630630}
r14976r14977
13491349      logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 1);
13501350      bankaddress = 0x10000;
13511351   }
1352   memory_set_bankptr(machine(), "bank3", &m_slave_base[bankaddress]);
1352   membank("bank3")->set_base(&m_slave_base[bankaddress]);
13531353
13541354   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data & 1, bankaddress);
13551355}
r14976r14977
13641364      logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 15);
13651365      bankaddress = 0x10000;
13661366   }
1367   memory_set_bankptr(machine(), "bank3", &m_slave_base[bankaddress]);
1367   membank("bank3")->set_base(&m_slave_base[bankaddress]);
13681368
13691369   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data & 15, bankaddress);
13701370}
r14976r14977
13881388      logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 0x3f);
13891389      bankaddress = 0x2000;
13901390   }
1391   memory_set_bankptr(machine(), "bank3", &m_slave_base[bankaddress]);
1391   membank("bank3")->set_base(&m_slave_base[bankaddress]);
13921392
13931393   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data, bankaddress);
13941394}
r14976r14977
14181418void leland_rotate_memory(running_machine &machine, const char *cpuname)
14191419{
14201420   int startaddr = 0x10000;
1421   int banks = (machine.region(cpuname)->bytes() - startaddr) / 0x8000;
1422   UINT8 *ram = machine.region(cpuname)->base();
1421   int banks = (machine.root_device().memregion(cpuname)->bytes() - startaddr) / 0x8000;
1422   UINT8 *ram = machine.root_device().memregion(cpuname)->base();
14231423   UINT8 temp[0x2000];
14241424   int i;
14251425
src/mame/machine/kabuki.c
r14976r14977
162162static void mitchell_decode(running_machine &machine, int swap_key1,int swap_key2,int addr_key,int xor_key)
163163{
164164   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
165   UINT8 *rom = machine.region("maincpu")->base();
166   UINT8 *decrypt = auto_alloc_array(machine, UINT8, machine.region("maincpu")->bytes());
167   int numbanks = (machine.region("maincpu")->bytes() - 0x10000) / 0x4000;
165   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
166   UINT8 *decrypt = auto_alloc_array(machine, UINT8, machine.root_device().memregion("maincpu")->bytes());
167   int numbanks = (machine.root_device().memregion("maincpu")->bytes() - 0x10000) / 0x4000;
168168   int i;
169169
170170   space->set_decrypted_region(0x0000, 0x7fff, decrypt);
r14976r14977
175175   for (i = 0; i < numbanks; i++)
176176      kabuki_decode(rom+i*0x4000,decrypt+i*0x4000,rom+i*0x4000,0x8000,0x4000, swap_key1,swap_key2,addr_key,xor_key);
177177
178   memory_configure_bank_decrypted(machine, "bank1", 0, numbanks, decrypt, 0x4000);
178   machine.root_device().membank("bank1")->configure_decrypted_entries(0, numbanks, decrypt, 0x4000);
179179/*
180180    {
181181        FILE *f;
r14976r14977
204204{
205205   address_space *space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
206206   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
207   UINT8 *rom = machine.region("audiocpu")->base();
207   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
208208
209209   space->set_decrypted_region(0x0000, 0x7fff, decrypt);
210210   kabuki_decode(rom,decrypt,rom,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key);
src/mame/machine/vectrex.c
r14976r14977
6767DEVICE_IMAGE_LOAD(vectrex_cart)
6868{
6969   vectrex_state *state = image.device().machine().driver_data<vectrex_state>();
70   UINT8 *mem = image.device().machine().region("maincpu")->base();
70   UINT8 *mem = state->memregion("maincpu")->base();
7171   if (image.software_entry() == NULL)
7272   {
7373      image.fread( mem, 0x8000);
src/mame/machine/scramble.c
r14976r14977
2626
2727MACHINE_RESET( explorer )
2828{
29   UINT8 *RAM = machine.region("maincpu")->base();
29   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
3030   RAM[0x47ff] = 0; /* If not set, it doesn't reset after the 1st time */
3131
3232   MACHINE_RESET_CALL(galaxold);
r14976r14977
111111       to keep the CPU core happy at the boundaries */
112112
113113   state->m_cavelon_bank = !state->m_cavelon_bank;
114   memory_set_bank(machine, "bank1", state->m_cavelon_bank);
114   state->membank("bank1")->set_entry(state->m_cavelon_bank);
115115}
116116
117117static READ8_HANDLER( cavelon_banksw_r )
r14976r14977
246246   /* extra ROM */
247247   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5800, 0x67ff, "bank1");
248248   machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x5800, 0x67ff);
249   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x5800);
249   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x5800);
250250
251251   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x9008, 0x9008, FUNC(mariner_protection_2_r));
252252   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xb401, 0xb401, FUNC(mariner_protection_1_r));
r14976r14977
262262   UINT8 *ROM;
263263
264264   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
265   ROM = machine.region("audiocpu")->base();
265   ROM = machine.root_device().memregion("audiocpu")->base();
266266   for (A = 0;A < 0x0800;A++)
267267      ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
268268
269269   /* likewise, the 2nd gfx ROM has data lines D0 and D1 swapped. Decode it. */
270   ROM = machine.region("gfx1")->base();
270   ROM = machine.root_device().memregion("gfx1")->base();
271271   for (A = 0x0800;A < 0x1000;A++)
272272      ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
273273}
r14976r14977
278278   UINT8 *ROM;
279279
280280   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
281   ROM = machine.region("audiocpu")->base();
281   ROM = machine.root_device().memregion("audiocpu")->base();
282282   for (A = 0;A < 0x0800;A++)
283283      ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
284284}
r14976r14977
296296   /* A2 -> A3 */
297297   /* A3 -> A1 */
298298
299   RAM = machine.region("maincpu")->base();
299   RAM = machine.root_device().memregion("maincpu")->base();
300300   for (i = 0; i < 0x10000; i += 16)
301301   {
302302      offs_t j;
r14976r14977
322322{
323323   /* protection??? The game jumps into never-neverland here. I think
324324       it just expects a RET there */
325   machine.region("maincpu")->base()[0x2ef9] = 0xc9;
325   machine.root_device().memregion("maincpu")->base()[0x2ef9] = 0xc9;
326326}
327327
328328DRIVER_INIT( cavelon )
329329{
330330   scramble_state *state = machine.driver_data<scramble_state>();
331   UINT8 *ROM = machine.region("maincpu")->base();
331   UINT8 *ROM = state->memregion("maincpu")->base();
332332
333333   /* banked ROM */
334334   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
335   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x00000], 0x10000);
335   state->membank("bank1")->configure_entries(0, 2, &ROM[0x00000], 0x10000);
336336   cavelon_banksw(machine);
337337
338338   /* A15 switches memory banks */
r14976r14977
374374      { 0x80,0x87,0x81,0x87,0x83,0x00,0x84,0x01,0x01,0x86,0x86,0x80,0x86,0x00,0x86,0x86 }
375375   };
376376
377   UINT8 *ROM = machine.region("maincpu")->base();
377   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
378378   int A, ctr = 0, line, col;
379379
380380   for( A = 0; A < 0x4000; A++ )
r14976r14977
422422    *   Optimizations done by Fabio Buffoni
423423    */
424424
425   RAM = machine.region("gfx1")->base();
426   len = machine.region("gfx1")->bytes();
425   RAM = machine.root_device().memregion("gfx1")->base();
426   len = machine.root_device().memregion("gfx1")->bytes();
427427
428428   scratch = alloc_array_or_die(UINT8, len);
429429
r14976r14977
460460    *   Optimizations done by Fabio Buffoni
461461    */
462462
463   RAM = machine.region("gfx1")->base();
464   len = machine.region("gfx1")->bytes();
463   RAM = machine.root_device().memregion("gfx1")->base();
464   len = machine.root_device().memregion("gfx1")->bytes();
465465
466466   scratch = auto_alloc_array(machine, UINT8, len);
467467
r14976r14977
496496    *   Code To Decode Minefield by Mike Balfour and Nicola Salmoria
497497    */
498498
499   RAM = machine.region("gfx1")->base();
500   len = machine.region("gfx1")->bytes();
499   RAM = machine.root_device().memregion("gfx1")->base();
500   len = machine.root_device().memregion("gfx1")->bytes();
501501
502502   scratch = auto_alloc_array(machine, UINT8, len);
503503
r14976r14977
535535    *   Optimizations done by Fabio Buffoni
536536    */
537537
538   RAM = machine.region("gfx1")->base();
539   len = machine.region("gfx1")->bytes();
538   RAM = machine.root_device().memregion("gfx1")->base();
539   len = machine.root_device().memregion("gfx1")->bytes();
540540
541541   scratch = alloc_array_or_die(UINT8, len);
542542
r14976r14977
562562DRIVER_INIT( hustler )
563563{
564564   offs_t A;
565   UINT8 *rom = machine.region("maincpu")->base();
565   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
566566
567567
568568   for (A = 0;A < 0x4000;A++)
r14976r14977
590590
591591   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
592592   {
593      rom = machine.region("audiocpu")->base();
593      rom = machine.root_device().memregion("audiocpu")->base();
594594
595595
596596      for (A = 0;A < 0x0800;A++)
r14976r14977
602602{
603603   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
604604   offs_t A;
605   UINT8 *rom = machine.region("audiocpu")->base();
605   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
606606
607607
608608   for (A = 0;A < 0x0800;A++)
r14976r14977
612612DRIVER_INIT( billiard )
613613{
614614   offs_t A;
615   UINT8 *rom = machine.region("maincpu")->base();
615   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
616616
617617
618618   for (A = 0;A < 0x4000;A++)
r14976r14977
642642
643643   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
644644   {
645      rom = machine.region("audiocpu")->base();
645      rom = machine.root_device().memregion("audiocpu")->base();
646646
647647
648648      for (A = 0;A < 0x0800;A++)
r14976r14977
670670DRIVER_INIT( ad2083 )
671671{
672672   UINT8 c;
673   int i, len = machine.region("maincpu")->bytes();
674   UINT8 *ROM = machine.region("maincpu")->base();
673   int i, len = machine.root_device().memregion("maincpu")->bytes();
674   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
675675
676676   for (i=0; i<len; i++)
677677   {
src/mame/machine/fddebug.c
r14976r14977
482482   key_changed = changed;
483483
484484   /* set up the regions */
485   coderegion = (UINT16 *)machine.region(cpureg)->base();
486   coderegion_words = machine.region(cpureg)->bytes() / 2;
487   keyregion = (UINT8 *)machine.region(keyreg)->base();
488   keystatus = (UINT16 *)machine.region(statreg)->base();
489   keystatus_words = machine.region(statreg)->bytes() / 2;
485   coderegion = (UINT16 *)machine.root_device().memregion(cpureg)->base();
486   coderegion_words = machine.root_device().memregion(cpureg)->bytes() / 2;
487   keyregion = (UINT8 *)machine.root_device().memregion(keyreg)->base();
488   keystatus = (UINT16 *)machine.root_device().memregion(statreg)->base();
489   keystatus_words = machine.root_device().memregion(statreg)->bytes() / 2;
490490   assert(coderegion_words == keystatus_words);
491491
492492   /* allocate memory for the ignore table */
src/mame/machine/midxunit.c
r14976r14977
299299   register_state_saving(machine);
300300
301301   /* load the graphics ROMs -- quadruples */
302   midtunit_gfx_rom = base = machine.region("gfx1")->base();
303   len = machine.region("gfx1")->bytes();
302   midtunit_gfx_rom = base = machine.root_device().memregion("gfx1")->base();
303   len = state->memregion("gfx1")->bytes();
304304   for (i = 0; i < len / 0x200000; i++)
305305   {
306306      memcpy(state->m_decode_memory, base, 0x200000);
src/mame/machine/segaic16.c
r14976r14977
157157      if (region_start >= romsize)
158158         continue;
159159
160      memory_configure_bank_decrypted(machine, readbank, 0, 1, decrypted + region_start, 0);
161      memory_set_bank(machine, readbank, 0);
160      machine.root_device().membank(readbank)->configure_decrypted_entry(0, decrypted + region_start);
161      machine.root_device().membank(readbank)->set_entry(0);
162162   }
163163}
164164
r14976r14977
349349      {
350350         if (rgn->base != NULL)
351351         {
352            memory_configure_bank(machine, readbank, 0, 1, *rgn->base, 0);
353            memory_set_bank(machine, readbank, 0);
352            machine.root_device().membank(readbank)->configure_entry(0, *rgn->base);
353            machine.root_device().membank(readbank)->set_entry(0);
354354         }
355355         else if (rgn->romoffset != ~0)
356356         {
r14976r14977
363363                  decrypted = (UINT8 *)fd1089_get_decrypted_base();
364364            }
365365
366            memory_configure_bank(machine, readbank, 0, 1, chip->cpu->region()->base() + region_start, 0);
366            machine.root_device().membank(readbank)->configure_entry(0, chip->cpu->region()->base() + region_start);
367367            if (decrypted)
368               memory_configure_bank_decrypted(machine, readbank, 0, 1, decrypted + region_start, 0);
368               machine.root_device().membank(readbank)->configure_decrypted_entry(0, decrypted + region_start);
369369
370            memory_set_bank(machine, readbank, 0);
370            machine.root_device().membank(readbank)->set_entry(0);
371371         }
372372      }
373373
src/mame/machine/n64.c
r14976r14977
7171
7272void n64_periphs::device_reset()
7373{
74   UINT32 *cart = (UINT32*)machine().region("user2")->base();
74   UINT32 *cart = (UINT32*)machine().root_device().memregion("user2")->base();
7575
7676   maincpu = machine().device("maincpu");
7777   rspcpu = machine().device("rsp");
r14976r14977
14121412
14131413void n64_periphs::pi_dma_tick()
14141414{
1415   UINT16 *cart16 = (UINT16*)machine().region("user2")->base();
1415   UINT16 *cart16 = (UINT16*)machine().root_device().memregion("user2")->base();
14161416   UINT16 *dram16 = (UINT16*)rdram;
14171417
14181418   UINT32 cart_addr = (pi_cart_addr & 0x0fffffff) >> 1;
r14976r14977
14251425   }
14261426   else if((cart_addr & 0x03000000) == 0x03000000 && dd_present)
14271427   {
1428      cart16 = (UINT16*)machine().region("ddipl")->base();
1428      cart16 = (UINT16*)machine().root_device().memregion("ddipl")->base();
14291429       cart_addr = (pi_cart_addr & 0x003fffff) >> 1;
14301430   }
14311431   else
14321432   {
1433       cart_addr &= ((machine().region("user2")->bytes() >> 1) - 1);
1433       cart_addr &= ((machine().root_device().memregion("user2")->bytes() >> 1) - 1);
14341434   }
14351435
14361436   //printf("%08x Cart, %08x Dram\n", cart_addr << 1, dram_addr << 1); fflush(stdout);
src/mame/machine/stfight.c
r14976r14977
4040{
4141   stfight_state *state = machine.driver_data<stfight_state>();
4242   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
43   UINT8 *rom = machine.region("maincpu")->base();
43   UINT8 *rom = state->memregion("maincpu")->base();
4444   int A;
4545
4646   state->m_decrypt = auto_alloc_array(machine, UINT8, 0x8000);
r14976r14977
103103// - in fact I don't even know how/where it's switched in!
104104WRITE8_MEMBER(stfight_state::stfight_bank_w)
105105{
106   UINT8   *ROM2 = machine().region("maincpu")->base() + 0x10000;
106   UINT8   *ROM2 = memregion("maincpu")->base() + 0x10000;
107107
108   memory_set_bankptr(machine(),  "bank1", &ROM2[data<<14] );
108   membank("bank1")->set_base(&ROM2[data<<14] );
109109}
110110
111111/*
r14976r14977
192192void stfight_adpcm_int(device_t *device)
193193{
194194   stfight_state *state = device->machine().driver_data<stfight_state>();
195   UINT8 *SAMPLES = device->machine().region("adpcm")->base();
195   UINT8 *SAMPLES = state->memregion("adpcm")->base();
196196   int adpcm_data = SAMPLES[state->m_adpcm_data_offs & 0x7fff];
197197
198198    // finished playing sample?
src/mame/machine/pgmprot5.c
r14976r14977
6666
6767DRIVER_INIT( drgw2 )
6868{   /* incomplete? */
69   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
69   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
7070   drgwld2_common_init(machine);
7171   /* These ROM patches are not hacks, the protection device
7272       overlays the normal ROM code, this has been confirmed on a real PCB
r14976r14977
7878
7979DRIVER_INIT( dw2v100x )
8080{
81   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
81   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
8282   drgwld2_common_init(machine);
8383
8484   mem16[0x131084 / 2] = 0x4e93;
r14976r14977
8888
8989DRIVER_INIT( drgw2c )
9090{
91   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
91   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
9292   drgwld2_common_init(machine);
9393   /* These ROM patches are not hacks, the protection device
9494       overlays the normal ROM code, this has been confirmed on a real PCB
r14976r14977
100100
101101DRIVER_INIT( drgw2j )
102102{
103   UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
103   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
104104   drgwld2_common_init(machine);
105105   /* These ROM patches are not hacks, the protection device
106106       overlays the normal ROM code, this has been confirmed on a real PCB
src/mame/machine/awboard.c
r14976r14977
212212   if(!keyregion)
213213      return;
214214
215   const memory_region *kr = machine().region(keyregion);
215   memory_region *kr = memregion(keyregion);
216216   if(!kr)
217217      return;
218218
src/mame/machine/deco102.c
r14976r14977
5151{
5252   int i;
5353   address_space *space = machine.device(cputag)->memory().space(AS_PROGRAM);
54   UINT16 *rom = (UINT16 *)machine.region(cputag)->base();
55   int size = machine.region(cputag)->bytes();
54   UINT16 *rom = (UINT16 *)machine.root_device().memregion(cputag)->base();
55   int size = machine.root_device().memregion(cputag)->bytes();
5656   UINT16 *opcodes = auto_alloc_array(machine, UINT16, size / 2);
5757   UINT16 *buf = auto_alloc_array(machine, UINT16, size / 2);
5858
src/mame/machine/qix.c
r14976r14977
266266
267267WRITE8_MEMBER(qix_state::zookeep_bankswitch_w)
268268{
269   memory_set_bank(machine(), "bank1", (data >> 2) & 1);
269   membank("bank1")->set_entry((data >> 2) & 1);
270270   /* not necessary, but technically correct */
271271   qix_palettebank_w(space, offset, data);
272272}
src/mame/machine/theglobp.c
r14976r14977
7171   int mem;
7272   UINT8 *RAM;
7373
74   RAM = machine.region("maincpu")->base();
74   RAM = machine.root_device().memregion("maincpu")->base();
7575
7676
7777   for (mem=0;mem<0x4000;mem++)
r14976r14977
108108   int mem;
109109   UINT8 *RAM;
110110
111   RAM = machine.region("maincpu")->base();
111   RAM = machine.root_device().memregion("maincpu")->base();
112112
113113   for (mem=0;mem<0x4000;mem++)
114114   {
r14976r14977
143143   int mem;
144144   UINT8 *RAM;
145145
146   RAM = machine.region("maincpu")->base();
146   RAM = machine.root_device().memregion("maincpu")->base();
147147
148148   for (mem=0;mem<0x4000;mem++)
149149   {
r14976r14977
178178   int mem;
179179   UINT8 *RAM;
180180
181   RAM = machine.region("maincpu")->base();
181   RAM = machine.root_device().memregion("maincpu")->base();
182182
183183   for (mem=0;mem<0x4000;mem++)
184184   {
r14976r14977
222222
223223   switch(state->m_counter)
224224   {
225      case 0x08:   memory_set_bank (space->machine(), "bank1", 0);      break;
226      case 0x09:   memory_set_bank (space->machine(), "bank1", 1);      break;
227      case 0x0A:   memory_set_bank (space->machine(), "bank1", 2);      break;
228      case 0x0B:   memory_set_bank (space->machine(), "bank1", 3);      break;
225      case 0x08:   state->membank ("bank1")->set_entry (0);      break;
226      case 0x09:   state->membank ("bank1")->set_entry (1);      break;
227      case 0x0A:   state->membank ("bank1")->set_entry (2);      break;
228      case 0x0B:   state->membank ("bank1")->set_entry (3);      break;
229229      default:
230230         logerror("Invalid counter = %02X\n",state->m_counter);
231231         break;
r14976r14977
238238MACHINE_START( theglobp )
239239{
240240   pacman_state *state = machine.driver_data<pacman_state>();
241   UINT8 *RAM = machine.region("maincpu")->base();
241   UINT8 *RAM = state->memregion("maincpu")->base();
242242
243243   /* While the PAL supports up to 16 decryption methods, only four
244244        are actually used in the PAL.  Therefore, we'll take a little
r14976r14977
248248   theglobp_decrypt_rom_A(machine);
249249   theglobp_decrypt_rom_B(machine);
250250
251   memory_configure_bank(machine, "bank1", 0, 4, &RAM[0x10000], 0x4000);
251   state->membank("bank1")->configure_entries(0, 4, &RAM[0x10000], 0x4000);
252252
253253   state_save_register_global(machine, state->m_counter);
254254}
r14976r14977
259259   pacman_state *state = machine.driver_data<pacman_state>();
260260   /* The initial state of the counter is 0x0A */
261261   state->m_counter = 0x0A;
262   memory_set_bank(machine, "bank1", 2);
262   state->membank("bank1")->set_entry(2);
263263}
src/mame/machine/snes.c
r14976r14977
19981998   UINT16 total_blocks, read_blocks;
19991999   UINT8 *rom;
20002000
2001   rom = machine.region("user3")->base();
2001   rom = machine.root_device().memregion("user3")->base();
20022002   snes_ram = auto_alloc_array_clear(machine, UINT8, 0x1400000);
20032003
20042004   /* all NSS games seem to use MODE 20 */
r14976r14977
20072007   state->m_has_addon_chip = HAS_NONE;
20082008
20092009   /* Find the number of blocks in this ROM */
2010   total_blocks = (machine.region("user3")->bytes() / 0x8000);
2010   total_blocks = (state->memregion("user3")->bytes() / 0x8000);
20112011   read_blocks = 0;
20122012
20132013   /* Loading all the data blocks from cart, we only partially cover banks 0x00 to 0x7f. Therefore, we
r14976r14977
20642064   UINT16 total_blocks, read_blocks;
20652065   UINT8  *rom;
20662066
2067   rom = machine.region("user3")->base();
2067   rom = machine.root_device().memregion("user3")->base();
20682068   snes_ram = auto_alloc_array(machine, UINT8, 0x1400000);
20692069   memset(snes_ram, 0, 0x1400000);
20702070
r14976r14977
20732073   state->m_has_addon_chip = HAS_NONE;
20742074
20752075   /* Find the number of blocks in this ROM */
2076   total_blocks = (machine.region("user3")->bytes() / 0x10000);
2076   total_blocks = (state->memregion("user3")->bytes() / 0x10000);
20772077   read_blocks = 0;
20782078
20792079   /* See above for details about the way we fill banks 0x00 to 0x7f */
src/mame/machine/naomigd.c
r14976r14977
394394
395395   UINT64 key;
396396
397   const UINT8 *picdata = machine().region(pic_tag)->base();
397   const UINT8 *picdata = memregion(pic_tag)->base();
398398
399399   if(picdata) {
400      if(machine().region(pic_tag)->bytes() >= 0x4000) {
400      if(machine().root_device().memregion(pic_tag)->bytes() >= 0x4000) {
401401         printf("Real PIC binary found\n");
402402         for(int i=0;i<7;i++)
403403            name[i] = picdata[0x7c0+i*2];
src/mame/machine/subsino.c
r14976r14977
8585{
8686   int i;
8787   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
88   UINT8* region = machine.region("maincpu")->base();
88   UINT8* region = machine.root_device().memregion("maincpu")->base();
8989
9090   for (i=0;i<0x10000;i++)
9191   {
src/mame/machine/naomim4.c
r14976r14977
4545{
4646   naomi_board::device_start();
4747
48   const UINT8 *key_data = machine().region(key_tag)->base();
48   const UINT8 *key_data = memregion(key_tag)->base();
4949   key = (key_data[2] << 8) | key_data[3];
5050   iv = (key_data[0] << 8) | key_data[1];
5151   buffer = auto_alloc_array(machine(), UINT8, BUFFER_SIZE);
src/mame/machine/gaelco2.c
r14976r14977
2222   int i;
2323
2424   /* get a pointer to the source data */
25   UINT8 *src = (UINT8 *)machine.region(src_reg)->base();
25   UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base();
2626
2727   /* get a pointer to the destination data */
28   UINT8 *dst = (UINT8 *)machine.region(dst_reg)->base();
28   UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base();
2929
3030   /* fill destination areas with the proper data */
3131   for (i = 0; i < length/2; i++){
src/mame/machine/pgmprot6.c
r14976r14977
8686static MACHINE_RESET( olds )
8787{
8888   pgm_028_025_state *state = machine.driver_data<pgm_028_025_state>();
89   UINT16 *mem16 = (UINT16 *)machine.region("user2")->base();
89   UINT16 *mem16 = (UINT16 *)state->memregion("user2")->base();
9090   int i;
9191
9292   MACHINE_RESET_CALL(pgm);
src/mame/machine/archimds.c
r14976r14977
116116static TIMER_CALLBACK( vidc_video_tick )
117117{
118118   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
119   static UINT8 *vram = machine.region("vram")->base();
119   static UINT8 *vram = machine.root_device().memregion("vram")->base();
120120   UINT32 size;
121121
122122   size = vidc_vidend-vidc_vidstart+0x10;
r14976r14977
289289   {
290290      UINT32 *rom;
291291
292      rom = (UINT32 *)space->machine().region("maincpu")->base();
292      rom = (UINT32 *)space->machine().root_device().memregion("maincpu")->base();
293293
294294      return rom[offset & 0x1fffff];
295295   }
r14976r14977
355355   {
356356      UINT32 *rom;
357357
358      rom = (UINT32 *)space->machine().region("maincpu")->base();
358      rom = (UINT32 *)space->machine().root_device().memregion("maincpu")->base();
359359
360360      return rom[offset & 0x1fffff];
361361   }
r14976r14977
406406   // if the boot ROM is mapped in, do some trickery to make it show up
407407   if (memc_latchrom)
408408   {
409      direct.explicit_configure(0x000000, 0x1fffff, 0x1fffff, *direct.space().machine().region("maincpu"));
409      direct.explicit_configure(0x000000, 0x1fffff, 0x1fffff, *direct.space().machine().root_device().memregion("maincpu"));
410410   }
411411   else   // executing from logical memory
412412   {
src/mame/machine/galaxold.c
r14976r14977
154154   if (data)
155155   {
156156      /* swap ROM 2 and 3! */
157      memory_set_bank(machine(), "bank1", 1);
158      memory_set_bank(machine(), "bank2", 0);
157      membank("bank1")->set_entry(1);
158      membank("bank2")->set_entry(0);
159159   }
160160   else
161161   {
162      memory_set_bank(machine(), "bank1", 0);
163      memory_set_bank(machine(), "bank2", 1);
162      membank("bank1")->set_entry(0);
163      membank("bank2")->set_entry(1);
164164   }
165165}
166166
167167DRIVER_INIT( zigzag )
168168{
169   UINT8 *RAM = machine.region("maincpu")->base();
170   memory_configure_bank(machine, "bank1", 0, 2, &RAM[0x2000], 0x1000);
171   memory_configure_bank(machine, "bank2", 0, 2, &RAM[0x2000], 0x1000);
172   memory_set_bank(machine, "bank1", 0);
173   memory_set_bank(machine, "bank2", 1);
169   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
170   machine.root_device().membank("bank1")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
171   machine.root_device().membank("bank2")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
172   machine.root_device().membank("bank1")->set_entry(0);
173   machine.root_device().membank("bank2")->set_entry(1);
174174}
175175
176176
r14976r14977
194194DRIVER_INIT( dingoe )
195195{
196196   offs_t i;
197   UINT8 *rom = machine.region("maincpu")->base();
197   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
198198
199199   for (i = 0; i < 0x3000; i++)
200200   {
r14976r14977
251251{
252252   m__4in1_bank = data & 0x03;
253253   galaxold_gfxbank_w(space, 0, m__4in1_bank);
254   memory_set_bank(machine(), "bank1", m__4in1_bank);
254   membank("bank1")->set_entry(m__4in1_bank);
255255}
256256
257257CUSTOM_INPUT_MEMBER(galaxold_state::_4in1_fake_port_r)
r14976r14977
301301
302302DRIVER_INIT( mooncrst )
303303{
304   offs_t i, len = machine.region("maincpu")->bytes();
305   UINT8 *rom = machine.region("maincpu")->base();
304   offs_t i, len = machine.root_device().memregion("maincpu")->bytes();
305   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
306306
307307
308308   for (i = 0;i < len;i++)
r14976r14977
320320{
321321   offs_t i;
322322   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
323   UINT8 *rom = machine.region("maincpu")->base();
323   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
324324   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
325325
326326   space->set_decrypted_region(0x0000, 0x7fff, decrypt);
r14976r14977
378378      { 1,4,1,4 }
379379   };
380380
381   offs_t i, len = machine.region("maincpu")->bytes();
382   UINT8 *rom = machine.region("maincpu")->base();
381   offs_t i, len = machine.root_device().memregion("maincpu")->bytes();
382   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
383383
384384
385385   for (i = 0; i < len; i++)
r14976r14977
399399{
400400   galaxold_state *state = machine.driver_data<galaxold_state>();
401401   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
402   offs_t i, len = machine.region("maincpu")->bytes();
403   UINT8 *RAM = machine.region("maincpu")->base();
402   offs_t i, len = machine.root_device().memregion("maincpu")->bytes();
403   UINT8 *RAM = state->memregion("maincpu")->base();
404404
405405   /* Decrypt Program Roms */
406406   for (i = 0; i < len; i++)
407407      RAM[i] = RAM[i] ^ (i & 0xff);
408408
409409   /* games are banked at 0x0000 - 0x3fff */
410   memory_configure_bank(machine, "bank1", 0, 4, &RAM[0x10000], 0x4000);
410   state->membank("bank1")->configure_entries(0, 4, &RAM[0x10000], 0x4000);
411411
412412   state->_4in1_bank_w(*space, 0, 0); /* set the initial CPU bank */
413413
src/mame/machine/dec0.c
r14976r14977
351351static void h6280_decrypt(running_machine &machine, const char *cputag)
352352{
353353   int i;
354   UINT8 *RAM = machine.region(cputag)->base();
354   UINT8 *RAM = machine.root_device().memregion(cputag)->base();
355355
356356   /* Read each byte, decrypt it */
357357   for (i = 0x00000; i < 0x10000; i++)
r14976r14977
360360
361361DRIVER_INIT( hippodrm )
362362{
363   UINT8 *RAM = machine.region("sub")->base();
363   UINT8 *RAM = machine.root_device().memregion("sub")->base();
364364   dec0_state *state = machine.driver_data<dec0_state>();
365365   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x180000, 0x180fff, read16_delegate(FUNC(dec0_state::hippodrm_68000_share_r),state), write16_delegate(FUNC(dec0_state::hippodrm_68000_share_w),state));
366366   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xffc800, 0xffcfff, write16_delegate(FUNC(dec0_state::sprite_mirror_w),state));
r14976r14977
376376
377377DRIVER_INIT( slyspy )
378378{
379   UINT8 *RAM = machine.region("audiocpu")->base();
379   UINT8 *RAM = machine.root_device().memregion("audiocpu")->base();
380380
381381   h6280_decrypt(machine, "audiocpu");
382382
src/mame/machine/williams.c
r14976r14977
368368{
369369   williams_state *state = machine.driver_data<williams_state>();
370370   /* configure the memory bank */
371   memory_configure_bank(machine, "bank1", 0, 1, state->m_videoram, 0);
372   memory_configure_bank(machine, "bank1", 1, 1, machine.region("maincpu")->base() + 0x10000, 0);
371   state->membank("bank1")->configure_entry(0, state->m_videoram);
372   state->membank("bank1")->configure_entry(1, state->memregion("maincpu")->base() + 0x10000);
373373
374374   state_save_register_global(machine, state->m_vram_bank);
375375}
r14976r14977
466466{
467467   williams_state *state = machine.driver_data<williams_state>();
468468   /* configure memory banks */
469   memory_configure_bank(machine, "bank1", 0, 1, state->m_videoram, 0);
470   memory_configure_bank(machine, "bank1", 1, 4, machine.region("maincpu")->base() + 0x10000, 0x10000);
469   state->membank("bank1")->configure_entry(0, state->m_videoram);
470   state->membank("bank1")->configure_entries(1, 4, state->memregion("maincpu")->base() + 0x10000, 0x10000);
471471
472472   /* register for save states */
473473   state_save_register_global(machine, state->m_vram_bank);
r14976r14977
504504{
505505   /* VRAM/ROM banking from bit 0 */
506506   m_vram_bank = data & 0x01;
507   memory_set_bank(machine(), "bank1", m_vram_bank);
507   membank("bank1")->set_entry(m_vram_bank);
508508
509509   /* cocktail flip from bit 1 */
510510   m_cocktail = data & 0x02;
r14976r14977
522522      case 0:
523523         space.install_read_bank(0x0000, 0x8fff, "bank1");
524524         space.install_write_bank(0x8000, 0x87ff, "bank4");
525         memory_set_bank(machine(), "bank1", 0);
526         memory_set_bankptr(machine(), "bank4", &m_videoram[0x8000]);
525         membank("bank1")->set_entry(0);
526         membank("bank4")->set_base(&m_videoram[0x8000]);
527527         break;
528528
529529      /* pages 1 and 2 are ROM */
r14976r14977
531531      case 2:
532532         space.install_read_bank(0x0000, 0x8fff, "bank1");
533533         space.install_write_bank(0x8000, 0x87ff, "bank4");
534         memory_set_bank(machine(), "bank1", 1 + ((m_vram_bank & 6) >> 1));
535         memory_set_bankptr(machine(), "bank4", &m_videoram[0x8000]);
534         membank("bank1")->set_entry(1 + ((m_vram_bank & 6) >> 1));
535         membank("bank4")->set_base(&m_videoram[0x8000]);
536536         break;
537537
538538      /* page 3 accesses palette RAM; the remaining areas are as if page 1 ROM was selected */
539539      case 3:
540540         space.install_read_bank(0x8000, 0x87ff, "bank4");
541541         space.install_write_handler(0x8000, 0x87ff, write8_delegate(FUNC(williams_state::williams2_paletteram_w),this));
542         memory_set_bank(machine(), "bank1", 1 + ((m_vram_bank & 4) >> 1));
543         memory_set_bankptr(machine(), "bank4", m_generic_paletteram_8);
542         membank("bank1")->set_entry(1 + ((m_vram_bank & 4) >> 1));
543         membank("bank4")->set_base(m_generic_paletteram_8);
544544         break;
545545   }
546546}
r14976r14977
772772   MACHINE_START_CALL(williams_common);
773773
774774   /* configure the banking and make sure it is reset to 0 */
775   memory_configure_bank(machine, "bank1", 0, 9, &machine.region("maincpu")->base()[0x10000], 0x1000);
775   machine.root_device().membank("bank1")->configure_entries(0, 9, &machine.root_device().memregion("maincpu")->base()[0x10000], 0x1000);
776776
777777   machine.save().register_postload(save_prepost_delegate(FUNC(defender_postload), &machine));
778778}
r14976r14977
819819      case 9:
820820         space.install_read_bank(0xc000, 0xcfff, "bank1");
821821         space.unmap_write(0xc000, 0xcfff);
822         memory_set_bank(machine(), "bank1", m_vram_bank - 1);
822         membank("bank1")->set_entry(m_vram_bank - 1);
823823         break;
824824
825825      /* pages A-F are not connected */
r14976r14977
878878   MACHINE_START_CALL(williams_common);
879879
880880   /* banking is different for blaster */
881   memory_configure_bank(machine, "bank1", 0, 1, state->m_videoram, 0);
882   memory_configure_bank(machine, "bank1", 1, 16, machine.region("maincpu")->base() + 0x18000, 0x4000);
881   state->membank("bank1")->configure_entry(0, state->m_videoram);
882   state->membank("bank1")->configure_entries(1, 16, machine.root_device().memregion("maincpu")->base() + 0x18000, 0x4000);
883883
884   memory_configure_bank(machine, "bank2", 0, 1, state->m_videoram + 0x4000, 0);
885   memory_configure_bank(machine, "bank2", 1, 16, machine.region("maincpu")->base() + 0x10000, 0x0000);
884   state->membank("bank2")->configure_entry(0, state->m_videoram + 0x4000);
885   state->membank("bank2")->configure_entries(1, 16, state->memregion("maincpu")->base() + 0x10000, 0x0000);
886886
887887   state_save_register_global(machine, state->m_blaster_bank);
888888}
r14976r14977
897897INLINE void update_blaster_banking(running_machine &machine)
898898{
899899   williams_state *state = machine.driver_data<williams_state>();
900   memory_set_bank(machine, "bank1", state->m_vram_bank * (state->m_blaster_bank + 1));
901   memory_set_bank(machine, "bank2", state->m_vram_bank * (state->m_blaster_bank + 1));
900   state->membank("bank1")->set_entry(state->m_vram_bank * (state->m_blaster_bank + 1));
901   state->membank("bank2")->set_entry(state->m_vram_bank * (state->m_blaster_bank + 1));
902902}
903903
904904
src/mame/machine/namcond1.c
r14976r14977
2727{
2828   namcond1_state *state = machine.driver_data<namcond1_state>();
2929#ifdef MAME_DEBUG
30    /*UINT8   *ROM = machine.region(REGION_CPU1)->base();*/
30    /*UINT8   *ROM = state->memregion(REGION_CPU1)->base();*/
3131    /*UINT32 debug_trigger_addr;*/
3232    /*int             i;*/
3333
src/mame/machine/r2crypt.c
r14976r14977
220220
221221void raiden2_decrypt_sprites(running_machine &machine)
222222{
223    UINT32 *data = (UINT32 *)machine.region("gfx3")->base();
223    UINT32 *data = (UINT32 *)machine.root_device().memregion("gfx3")->base();
224224    for(int i=0; i<0x800000/4; i++)
225225    {
226226        data[i] = core_decrypt(data[i],
r14976r14977
240240
241241void zeroteam_decrypt_sprites(running_machine &machine)
242242{
243    UINT32 *data = (UINT32 *)machine.region("gfx3")->base();
243    UINT32 *data = (UINT32 *)machine.root_device().memregion("gfx3")->base();
244244    for(int i=0; i<0x400000/4; i++)
245245    {
246246        data[i] = core_decrypt(data[i],
src/mame/machine/opwolf.c
r14976r14977
420420      if (offset == 0x14)
421421      {
422422#if OPWOLF_READ_COINAGE_FROM_ROM
423         UINT16* rom = (UINT16*)machine().region("maincpu")->base();
423         UINT16* rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
424424         UINT32 coin_table[2] = {0, 0};
425425         UINT8 coin_offset[2];
426426         int slot;
src/mame/machine/starwars.c
r14976r14977
8282         break;
8383
8484      case 4:      /* bank switch */
85         memory_set_bank(machine(), "bank1", (data >> 7) & 1);
85         membank("bank1")->set_entry((data >> 7) & 1);
8686         if (m_is_esb)
87            memory_set_bank(machine(), "bank2", (data >> 7) & 1);
87            membank("bank2")->set_entry((data >> 7) & 1);
8888         break;
8989      case 5:      /* reset PRNG */
9090         break;
r14976r14977
153153void starwars_mproc_init(running_machine &machine)
154154{
155155   starwars_state *state = machine.driver_data<starwars_state>();
156   UINT8 *src = machine.region("user2")->base();
156   UINT8 *src = state->memregion("user2")->base();
157157   int cnt, val;
158158
159159   state->m_PROM_STR = auto_alloc_array(machine, UINT8, 1024);
src/mame/machine/nb1413m3.c
r14976r14977
298298   popmessage("Sound ROM %02X:%05X [B1:%02X B2:%02X]", rombank, offset, nb1413m3_sndrombank1, nb1413m3_sndrombank2);
299299#endif
300300
301   if (offset < space->machine().region(nb1413m3_sndromrgntag)->bytes())
302      return space->machine().region(nb1413m3_sndromrgntag)->base()[offset];
301   if (offset < space->machine().root_device().memregion(nb1413m3_sndromrgntag)->bytes())
302      return space->machine().root_device().memregion(nb1413m3_sndromrgntag)->base()[offset];
303303   else
304304   {
305305      popmessage("read past sound ROM length (%05x[%02X])",offset, rombank);
r14976r14977
322322
323323READ8_HANDLER( nb1413m3_gfxrom_r )
324324{
325   UINT8 *GFXROM = space->machine().region("gfx1")->base();
325   UINT8 *GFXROM = space->machine().root_device().memregion("gfx1")->base();
326326
327327   return GFXROM[(0x20000 * (nb1413m3_gfxrombank | ((nb1413m3_sndrombank1 & 0x02) << 3))) + ((0x0200 * nb1413m3_gfxradr_h) + (0x0002 * nb1413m3_gfxradr_l)) + (offset & 0x01)];
328328}
src/mame/machine/jumpshot.c
r14976r14977
4646
4747   /* CPU ROMs */
4848
49   RAM = machine.region("maincpu")->base();
49   RAM = machine.root_device().memregion("maincpu")->base();
5050   for (i = 0; i < 0x4000; i++)
5151   {
5252      RAM[i] = decrypt(i,RAM[i]);
src/mame/machine/wrally.c
r14976r14977
3333
3434WRITE16_MEMBER(wrally_state::OKIM6295_bankswitch_w)
3535{
36   UINT8 *RAM = machine().region("oki")->base();
36   UINT8 *RAM = memregion("oki")->base();
3737
3838   if (ACCESSING_BITS_0_7){
3939      memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000);
src/mame/machine/ajax.c
r14976r14977
4848
4949   /* bank # (ROMS N11 and N12) */
5050   bank += (data & 0x07);
51   memory_set_bank(machine(), "bank2", bank);
51   membank("bank2")->set_entry(bank);
5252}
5353
5454/*  ajax_lamps_w:
r14976r14977
191191   m_firq_enable = data & 0x10;
192192
193193   /* bank # (ROMS G16 and I16) */
194   memory_set_bank(machine(), "bank1", data & 0x0f);
194   membank("bank1")->set_entry(data & 0x0f);
195195}
196196
197197MACHINE_START( ajax )
198198{
199199   ajax_state *state = machine.driver_data<ajax_state>();
200   UINT8 *MAIN = machine.region("maincpu")->base();
201   UINT8 *SUB  = machine.region("sub")->base();
200   UINT8 *MAIN = machine.root_device().memregion("maincpu")->base();
201   UINT8 *SUB  = state->memregion("sub")->base();
202202
203   memory_configure_bank(machine, "bank1", 0,  9,  &SUB[0x10000], 0x2000);
204   memory_configure_bank(machine, "bank2", 0, 12, &MAIN[0x10000], 0x2000);
203   state->membank("bank1")->configure_entries(0,  9,  &SUB[0x10000], 0x2000);
204   state->membank("bank2")->configure_entries(0, 12, &MAIN[0x10000], 0x2000);
205205
206   memory_set_bank(machine, "bank1", 0);
207   memory_set_bank(machine, "bank2", 0);
206   state->membank("bank1")->set_entry(0);
207   state->membank("bank2")->set_entry(0);
208208
209209   state->m_maincpu = machine.device("maincpu");
210210   state->m_audiocpu = machine.device("audiocpu");
src/mame/video/xevious.c
r14976r14977
2626***************************************************************************/
2727PALETTE_INIT( xevious )
2828{
29   const UINT8 *color_prom = machine.region("proms")->base();
29   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3030   int i;
3131   #define TOTAL_COLORS(gfxn) (machine.gfx[gfxn]->total_colors * machine.gfx[gfxn]->color_granularity)
3232
r14976r14977
100100
101101PALETTE_INIT( battles )
102102{
103   const UINT8 *color_prom = machine.region("proms")->base();
103   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
104104   int i;
105105
106106   machine.colortable = colortable_alloc(machine, 128+1);
r14976r14977
320320{
321321   xevious_state *state =  space->machine().driver_data<xevious_state>();
322322
323   UINT8 *rom2a = space->machine().region("gfx4")->base();
323   UINT8 *rom2a = state->memregion("gfx4")->base();
324324   UINT8 *rom2b = rom2a+0x1000;
325325   UINT8 *rom2c = rom2a+0x3000;
326326   int adr_2b,adr_2c;
src/mame/video/deco_mlc.c
r14976r14977
216216   UINT32 *index_ptr=0;
217217   int offs,fx=0,fy=0,x,y,color,colorOffset,sprite,indx,h,w,bx,by,fx1,fy1;
218218   int xoffs,yoffs;
219   UINT8 *rom = machine.region("gfx2")->base() + 0x20000, *index_ptr8;
220   UINT8 *rawrom = machine.region("gfx2")->base();
219   UINT8 *rom = machine.root_device().memregion("gfx2")->base() + 0x20000, *index_ptr8;
220   UINT8 *rawrom = state->memregion("gfx2")->base();
221221   int blockIsTilemapIndex=0;
222222   int sprite2=0,indx2=0,use8bppMode=0;
223223   int yscale,xscale;
src/mame/video/tunhunt.c
r14976r14977
155155    0020:   00 f0 f0 f0 b0 b0 00 f0
156156            00 f0 f0 00 b0 00 f0 f0
157157*/
158   //const UINT8 *color_prom = machine.region( "proms" )->base();
158   //const UINT8 *color_prom = machine.root_device().memregion( "proms" )->base();
159159   tunhunt_state *state = machine.driver_data<tunhunt_state>();
160160   int color;
161161   int shade;
src/mame/video/tryout.c
r14976r14977
1111
1212PALETTE_INIT( tryout )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   int i;
1616
1717   for (i = 0;i < machine.total_colors();i++)
src/mame/video/rungun.c
r14976r14977
8989   assert(gfx_index != MAX_GFX_ELEMENTS);
9090
9191   // decode the ttl layer's gfx
92   machine.gfx[gfx_index] = gfx_element_alloc(machine, &charlayout, machine.region("gfx3")->base(), machine.total_colors() / 16, 0);
92   machine.gfx[gfx_index] = gfx_element_alloc(machine, &charlayout, state->memregion("gfx3")->base(), machine.total_colors() / 16, 0);
9393   state->m_ttl_gfx_index = gfx_index;
9494
9595   // create the tilemap
src/mame/video/skyfox.c
r14976r14977
8989
9090PALETTE_INIT( skyfox )
9191{
92   const UINT8 *color_prom = machine.region("proms")->base();
92   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9393   int i;
9494
9595   for (i = 0; i < 256; i++)
r14976r14977
240240static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
241241{
242242   skyfox_state *state = machine.driver_data<skyfox_state>();
243   UINT8 *RAM = machine.region("gfx2")->base();
243   UINT8 *RAM = state->memregion("gfx2")->base();
244244   int x, y, i;
245245
246246   /* The foreground stars (sprites) move at twice this speed when
src/mame/video/bublbobl.c
r14976r14977
3232
3333   sx = 0;
3434
35   prom = screen.machine().region("proms")->base();
35   prom = state->memregion("proms")->base();
3636   for (offs = 0; offs < state->m_objectram.bytes(); offs += 4)
3737   {
3838      /* skip empty sprites */
src/mame/video/aerofgt.c
r14976r14977
139139   /* sprite maps are hardcoded in this game */
140140
141141   /* enemy sprites use ROM instead of RAM */
142   state->m_spriteram2.set_target(reinterpret_cast<UINT16 *>(machine.region("gfx5")->base()), 0x20000);
142   state->m_spriteram2.set_target(reinterpret_cast<UINT16 *>(state->memregion("gfx5")->base()), 0x20000);
143143
144144   /* front sprites are direct maps */
145145   state->m_spriteram1.set_target(state->m_spriteram2 + state->m_spriteram2.bytes() / 2, 0x4000);
r14976r14977
682682   aerofgt_state *state = machine.driver_data<aerofgt_state>();
683683   int i;
684684   UINT8 *lookup;
685   lookup = machine.region("user1")->base();
685   lookup = state->memregion("user1")->base();
686686   state->m_spritepalettebank = 1;
687687
688688   for (i = state->m_spriteram3.bytes() / 2 - 4; i >= 4; i -= 4)
src/mame/video/rocnrope.c
r14976r14977
3131
3232PALETTE_INIT( rocnrope )
3333{
34   const UINT8 *color_prom = machine.region("proms")->base();
34   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3535   static const int resistances_rg[3] = { 1000, 470, 220 };
3636   static const int resistances_b [2] = { 470, 220 };
3737   double rweights[3], gweights[3], bweights[2];
src/mame/video/docastle.c
r14976r14977
3131
3232PALETTE_INIT( docastle )
3333{
34   const UINT8 *color_prom = machine.region("proms")->base();
34   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3535   int i;
3636
3737   for (i = 0; i < 256; i++)
src/mame/video/mainsnk.c
r14976r14977
44
55PALETTE_INIT( mainsnk )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99   int num_colors = 0x400;
1010
src/mame/video/mystston.c
r14976r14977
7575   static const int resistances_b [2] = { 3300, 1500 };
7676   double weights_rg[3], weights_b[2];
7777
78   UINT8 *color_prom = machine.region("proms")->base();
78   UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7979
8080   compute_resistor_weights(0,   255, -1.0,
8181         3, resistances_rg, weights_rg, 0, 4700,
src/mame/video/yiear.c
r14976r14977
3030
3131PALETTE_INIT( yiear )
3232{
33   const UINT8 *color_prom = machine.region("proms")->base();
33   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3434   int i;
3535
3636   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/nbmj9195.c
r14976r14977
7272{
7373   nbmj9195_state *state = space->machine().driver_data<nbmj9195_state>();
7474   int ret;
75   UINT8 *GFXROM = space->machine().region("gfx1")->base();
75   UINT8 *GFXROM = state->memregion("gfx1")->base();
7676
7777   switch (offset)
7878   {
r14976r14977
209209static void nbmj9195_gfxdraw(running_machine &machine, int vram)
210210{
211211   nbmj9195_state *state = machine.driver_data<nbmj9195_state>();
212   UINT8 *GFX = machine.region("gfx1")->base();
212   UINT8 *GFX = state->memregion("gfx1")->base();
213213   int width = machine.primary_screen->width();
214214
215215   int x, y;
r14976r14977
256256      skipy = -1;
257257   }
258258
259   gfxlen = machine.region("gfx1")->bytes();
259   gfxlen = machine.root_device().memregion("gfx1")->bytes();
260260   gfxaddr = ((state->m_blitter_src_addr[vram] + 2) & 0x00ffffff);
261261
262262   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
src/mame/video/sonson.c
r14976r14977
4141
4242PALETTE_INIT( sonson )
4343{
44   const UINT8 *color_prom = machine.region("proms")->base();
44   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4545   int i;
4646
4747   /* allocate the colortable */
src/mame/video/hcastle.c
r14976r14977
1111
1212PALETTE_INIT( hcastle )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   int chip;
1616
1717   /* allocate the colortable */
src/mame/video/deadang.c
r14976r14977
3939
4040static TILE_GET_INFO( get_pf3_tile_info )
4141{
42   const UINT16 *bgMap = (const UINT16 *)machine.region("gfx6")->base();
42   const UINT16 *bgMap = (const UINT16 *)machine.root_device().memregion("gfx6")->base();
4343   int code= bgMap[tile_index];
4444   SET_TILE_INFO(4,code&0x7ff,code>>12,0);
4545}
4646
4747static TILE_GET_INFO( get_pf2_tile_info )
4848{
49   const UINT16 *bgMap = (const UINT16 *)machine.region("gfx7")->base();
49   const UINT16 *bgMap = (const UINT16 *)machine.root_device().memregion("gfx7")->base();
5050   int code= bgMap[tile_index];
5151   SET_TILE_INFO(3,code&0x7ff,code>>12,0);
5252}
src/mame/video/artmagic.c
r14976r14977
4141VIDEO_START( artmagic )
4242{
4343   artmagic_state *state = machine.driver_data<artmagic_state>();
44   state->m_blitter_base = (UINT16 *)machine.region("gfx1")->base();
45   state->m_blitter_mask = machine.region("gfx1")->bytes()/2 - 1;
44   state->m_blitter_base = (UINT16 *)machine.root_device().memregion("gfx1")->base();
45   state->m_blitter_mask = state->memregion("gfx1")->bytes()/2 - 1;
4646
4747   state_save_register_global_array(machine, state->m_xor);
4848   state_save_register_global(machine, state->m_is_stoneball);
src/mame/video/hexion.c
r14976r14977
5050   state->m_bg_tilemap[1]->set_scrollx(0,-4);
5151   state->m_bg_tilemap[1]->set_scrolly(0,4);
5252
53   state->m_vram[0] = machine.region("maincpu")->base() + 0x30000;
53   state->m_vram[0] = state->memregion("maincpu")->base() + 0x30000;
5454   state->m_vram[1] = state->m_vram[0] + 0x2000;
5555   state->m_unkram = state->m_vram[1] + 0x2000;
5656}
r14976r14977
6565
6666WRITE8_MEMBER(hexion_state::hexion_bankswitch_w)
6767{
68   UINT8 *rom = machine().region("maincpu")->base() + 0x10000;
68   UINT8 *rom = memregion("maincpu")->base() + 0x10000;
6969
7070   /* bits 0-3 select ROM bank */
71   memory_set_bankptr(machine(), "bank1",rom + 0x2000 * (data & 0x0f));
71   membank("bank1")->set_base(rom + 0x2000 * (data & 0x0f));
7272
7373   /* does bit 6 trigger the 052591? */
7474   if (data & 0x40)
r14976r14977
9191{
9292   if (m_gfxrom_select && offset < 0x1000)
9393   {
94      return machine().region("gfx1")->base()[((m_gfxrom_select & 0x7f) << 12) + offset];
94      return memregion("gfx1")->base()[((m_gfxrom_select & 0x7f) << 12) + offset];
9595   }
9696   else if (m_bankctrl == 0)
9797   {
src/mame/video/bking.c
r14976r14977
3030
3131PALETTE_INIT( bking )
3232{
33   const UINT8 *color_prom = machine.region("proms")->base();
33   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3434   static const int resistances_rg[3] = { 220, 390, 820 };
3535   static const int resistances_b [2] = { 220, 390 };
3636   double rweights[3], gweights[3], bweights[2];
r14976r14977
315315
316316      if (latch != 0)
317317      {
318         const UINT8* MASK = screen.machine().region("user1")->base() + 8 * state->m_hit;
318         const UINT8* MASK = screen.machine().root_device().memregion("user1")->base() + 8 * state->m_hit;
319319
320320         int x;
321321         int y;
src/mame/video/arabian.c
r14976r14977
154154VIDEO_START( arabian )
155155{
156156   arabian_state *state = machine.driver_data<arabian_state>();
157   UINT8 *gfxbase = machine.region("gfx1")->base();
157   UINT8 *gfxbase = state->memregion("gfx1")->base();
158158   int offs;
159159
160160   /* allocate a common bitmap to use for both planes */
src/mame/video/labyrunr.c
r14976r14977
44
55PALETTE_INIT( labyrunr )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int pal;
99
1010   /* allocate the colortable */
src/mame/video/thief.c
r14976r14977
161161WRITE8_MEMBER(thief_state::thief_blit_w){
162162   coprocessor_t &thief_coprocessor = m_coprocessor;
163163   int i, offs, xoffset, dy;
164   UINT8 *gfx_rom = machine().region( "gfx1" )->base();
164   UINT8 *gfx_rom = memregion( "gfx1" )->base();
165165   UINT8 x = thief_coprocessor.param[SCREEN_XPOS];
166166   UINT8 y = thief_coprocessor.param[SCREEN_YPOS];
167167   UINT8 width = thief_coprocessor.param[BLIT_WIDTH];
r14976r14977
239239            return thief_coprocessor.image_ram[addr];
240240         }
241241         else {
242            UINT8 *gfx_rom = machine().region( "gfx1" )->base();
242            UINT8 *gfx_rom = memregion( "gfx1" )->base();
243243            addr -= 0x2000;
244244            if( addr<0x6000 ) return gfx_rom[addr];
245245         }
src/mame/video/ccastles.c
r14976r14977
2121   static const int resistances[3] = { 22000, 10000, 4700 };
2222
2323   /* get pointers to our PROMs */
24   state->m_syncprom = machine.region("proms")->base() + 0x000;
25   state->m_wpprom = machine.region("proms")->base() + 0x200;
26   state->m_priprom = machine.region("proms")->base() + 0x300;
24   state->m_syncprom = machine.root_device().memregion("proms")->base() + 0x000;
25   state->m_wpprom = machine.root_device().memregion("proms")->base() + 0x200;
26   state->m_priprom = machine.root_device().memregion("proms")->base() + 0x300;
2727
2828   /* compute the color output resistor weights at startup */
2929   compute_resistor_weights(0,   255, -1.0,
src/mame/video/ambush.c
r14976r14977
2020
2121PALETTE_INIT( ambush )
2222{
23   const UINT8 *color_prom = machine.region("proms")->base();
23   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2424   int i;
2525
2626   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/policetr.c
r14976r14977
2626{
2727   policetr_state *state = machine.driver_data<policetr_state>();
2828   /* the source bitmap is in ROM */
29   state->m_srcbitmap = machine.region("gfx1")->base();
29   state->m_srcbitmap = machine.root_device().memregion("gfx1")->base();
3030
3131   /* compute the height */
32   state->m_srcbitmap_height_mask = (machine.region("gfx1")->bytes() / SRCBITMAP_WIDTH) - 1;
32   state->m_srcbitmap_height_mask = (state->memregion("gfx1")->bytes() / SRCBITMAP_WIDTH) - 1;
3333
3434   /* the destination bitmap is not directly accessible to the CPU */
3535   state->m_dstbitmap = auto_alloc_array(machine, UINT8, DSTBITMAP_WIDTH * DSTBITMAP_HEIGHT);
src/mame/video/seibuspi.c
r14976r14977
508508   for (i = 6000; i < 6016; i++) { state->m_alpha_table[i] = 1; }
509509   for (i = 6128; i < 6144; i++) { state->m_alpha_table[i] = 1; }
510510
511   region_length = machine.region("gfx2")->bytes();
511   region_length = machine.root_device().memregion("gfx2")->bytes();
512512
513513   if (region_length <= 0x300000)
514514   {
src/mame/video/gaplus.c
r14976r14977
2525
2626PALETTE_INIT( gaplus )
2727{
28   const UINT8 *color_prom = machine.region("proms")->base();
28   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2929   int i;
3030
3131   /* allocate the colortable */
src/mame/video/drmicro.c
r14976r14977
6060
6161PALETTE_INIT( drmicro )
6262{
63   const UINT8 *color_prom = machine.region("proms")->base();
63   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6464   int i;
6565
6666   /* allocate the colortable */
src/mame/video/carpolo.c
r14976r14977
6666
6767PALETTE_INIT( carpolo )
6868{
69   const UINT8 *color_prom = machine.region("proms")->base();
69   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7070   int i;
7171
7272   /* thanks to Jarek Burczynski for analyzing the circuit */
r14976r14977
190190
191191static void remap_sprite_code(running_machine &machine, int bank, int code, int *remapped_code, int *flipy)
192192{
193   UINT8* PROM = machine.region("user1")->base();
193   UINT8* PROM = machine.root_device().memregion("user1")->base();
194194
195195   code = (bank << 4) | code;
196196   *remapped_code = PROM[code] & 0x0f;
src/mame/video/speedatk.c
r14976r14977
1010
1111PALETTE_INIT( speedatk )
1212{
13   const UINT8 *color_prom = machine.region("proms")->base();
13   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1414   int i;
1515
1616   /* allocate the colortable */
src/mame/video/system1.c
r14976r14977
291291
292292WRITE8_MEMBER(system1_state::system1_paletteram_w)
293293{
294   const UINT8 *color_prom = machine().region("palette")->base();
294   const UINT8 *color_prom = memregion("palette")->base();
295295   int val,r,g,b;
296296
297297   /*
r14976r14977
363363static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffset)
364364{
365365   system1_state *state = machine.driver_data<system1_state>();
366   UINT32 gfxbanks = machine.region("sprites")->bytes() / 0x8000;
367   const UINT8 *gfxbase = machine.region("sprites")->base();
366   UINT32 gfxbanks = machine.root_device().memregion("sprites")->bytes() / 0x8000;
367   const UINT8 *gfxbase = state->memregion("sprites")->base();
368368   UINT8 *spriteram = state->m_spriteram;
369369   int flipscreen = state->flip_screen();
370370   int spritenum;
r14976r14977
493493static void video_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind16 &fgpixmap, bitmap_ind16 **bgpixmaps, const int *bgrowscroll, int bgyscroll, int spritexoffs)
494494{
495495   system1_state *state = screen.machine().driver_data<system1_state>();
496   const UINT8 *lookup = screen.machine().region("proms")->base();
496   const UINT8 *lookup = state->memregion("proms")->base();
497497   int x, y;
498498
499499   /* first clear the sprite bitmap and draw sprites within this area */
src/mame/video/stvvdp2.c
r14976r14977
68396839   fp=fopen("68k.dmp", "w+b");
68406840   if (fp)
68416841   {
6842      fwrite(machine.region(REGION_CPU3)->base(), 0x100000, 1, fp);
6842      fwrite(machine.root_device().memregion(REGION_CPU3)->base(), 0x100000, 1, fp);
68436843      fclose(fp);
68446844   }
68456845}
src/mame/video/niyanpai.c
r14976r14977
6666{
6767   niyanpai_state *state = machine.driver_data<niyanpai_state>();
6868   int ret;
69   UINT8 *GFXROM = machine.region("gfx1")->base();
69   UINT8 *GFXROM = state->memregion("gfx1")->base();
7070
7171   switch (offset)
7272   {
r14976r14977
180180static void niyanpai_gfxdraw(running_machine &machine, int vram)
181181{
182182   niyanpai_state *state = machine.driver_data<niyanpai_state>();
183   UINT8 *GFX = machine.region("gfx1")->base();
183   UINT8 *GFX = state->memregion("gfx1")->base();
184184   int width = machine.primary_screen->width();
185185
186186   int x, y;
r14976r14977
227227      skipy = -1;
228228   }
229229
230   gfxlen = machine.region("gfx1")->bytes();
230   gfxlen = machine.root_device().memregion("gfx1")->bytes();
231231   gfxaddr = ((state->m_blitter_src_addr[vram] + 2) & 0x00ffffff);
232232
233233   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
src/mame/video/exedexes.c
r14976r14977
1010#include "includes/exedexes.h"
1111
1212
13#define TileMap(offs) (machine.region("gfx5")->base()[offs])
14#define BackTileMap(offs) (machine.region("gfx5")->base()[offs+0x4000])
13#define TileMap(offs) (machine.root_device().memregion("gfx5")->base()[offs])
14#define BackTileMap(offs) (machine.root_device().memregion("gfx5")->base()[offs+0x4000])
1515
1616
1717/***************************************************************************
r14976r14977
3333
3434PALETTE_INIT( exedexes )
3535{
36   const UINT8 *color_prom = machine.region("proms")->base();
36   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3737   int i;
3838
3939   /* allocate the colortable */
r14976r14977
129129
130130static TILE_GET_INFO( get_bg_tile_info )
131131{
132   UINT8 *tilerom = machine.region("gfx5")->base();
132   UINT8 *tilerom = machine.root_device().memregion("gfx5")->base();
133133
134134   int attr = tilerom[tile_index];
135135   int code = attr & 0x3f;
r14976r14977
141141
142142static TILE_GET_INFO( get_fg_tile_info )
143143{
144   int code = machine.region("gfx5")->base()[tile_index];
144   int code = machine.root_device().memregion("gfx5")->base()[tile_index];
145145
146146   SET_TILE_INFO(2, code, 0, 0);
147147}
src/mame/video/jedi.c
r14976r14977
135135   int y;
136136   int background_line_buffer[0x200];   /* RAM chip at 2A */
137137
138   UINT8 *tx_gfx = machine.region("gfx1")->base();
139   UINT8 *bg_gfx = machine.region("gfx2")->base();
140   UINT8 *prom1 = &machine.region("proms")->base()[0x0000 | ((*state->m_smoothing_table & 0x03) << 8)];
141   UINT8 *prom2 = &machine.region("proms")->base()[0x0800 | ((*state->m_smoothing_table & 0x03) << 8)];
138   UINT8 *tx_gfx = machine.root_device().memregion("gfx1")->base();
139   UINT8 *bg_gfx = machine.root_device().memregion("gfx2")->base();
140   UINT8 *prom1 = &machine.root_device().memregion("proms")->base()[0x0000 | ((*state->m_smoothing_table & 0x03) << 8)];
141   UINT8 *prom2 = &machine.root_device().memregion("proms")->base()[0x0800 | ((*state->m_smoothing_table & 0x03) << 8)];
142142   int vscroll = state->m_vscroll;
143143   int hscroll = state->m_hscroll;
144144   int tx_bank = *state->m_foreground_bank;
r14976r14977
234234{
235235   offs_t offs;
236236   UINT8 *spriteram = state->m_spriteram;
237   UINT8 *gfx3 = machine.region("gfx3")->base();
237   UINT8 *gfx3 = machine.root_device().memregion("gfx3")->base();
238238
239239   for (offs = 0x00; offs < 0x30; offs++)
240240   {
src/mame/video/suprnova.c
r14976r14977
626626   state->m_sprite_bitmap.fill(0x0000, cliprect);
627627
628628   if (state->m_alt_enable_sprites)
629      state->m_spritegen->skns_draw_sprites(screen.machine(), state->m_sprite_bitmap, cliprect, state->m_spriteram, state->m_spriteram.bytes(), screen.machine().region("gfx1")->base(), screen.machine().region ("gfx1")->bytes(), state->m_spc_regs );
629      state->m_spritegen->skns_draw_sprites(screen.machine(), state->m_sprite_bitmap, cliprect, state->m_spriteram, state->m_spriteram.bytes(), screen.machine().root_device().memregion("gfx1")->base(), screen.machine().root_device().memregion ("gfx1")->bytes(), state->m_spc_regs );
630630
631631
632632   return 0;
src/mame/video/namcofl.c
r14976r14977
119119
120120VIDEO_START( namcofl )
121121{
122   namco_tilemap_init( machine, NAMCOFL_TILEGFX, machine.region(NAMCOFL_TILEMASKREGION)->base(), TilemapCB );
122   namco_tilemap_init( machine, NAMCOFL_TILEGFX, machine.root_device().memregion(NAMCOFL_TILEMASKREGION)->base(), TilemapCB );
123123   namco_obj_init(machine,NAMCOFL_SPRITEGFX,0x0,FLobjcode2tile);
124124   namco_roz_init(machine,NAMCOFL_ROTGFX,NAMCOFL_ROTMASKREGION);
125125}
src/mame/video/dynax.c
r14976r14977
2828/* 0 B01234 G01234 R01234 */
2929PALETTE_INIT( sprtmtch )
3030{
31   const UINT8 *color_prom = machine.region("proms")->base();
31   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3232   int i;
3333
3434   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
356356{
357357   dynax_state *state = machine.driver_data<dynax_state>();
358358   UINT8 cmd;
359   UINT8 *ROM = machine.region(gfx)->base();
360   size_t ROM_size = machine.region(gfx)->bytes();
359   UINT8 *ROM = machine.root_device().memregion(gfx)->base();
360   size_t ROM_size = state->memregion(gfx)->bytes();
361361
362362   int sx;
363363
r14976r14977
12041204   if (toggle)
12051205   {
12061206      dynax_state *state = machine.driver_data<dynax_state>();
1207      UINT8 *RAM = machine.region( "gfx1" )->base();
1208      size_t size = machine.region( "gfx1" )->bytes();
1207      UINT8 *RAM = machine.root_device().memregion( "gfx1" )->base();
1208      size_t size = state->memregion( "gfx1" )->bytes();
12091209      static int i = 0, c = 0, r = 0;
12101210
12111211      if (machine.input().code_pressed_once(KEYCODE_I))   c = (c - 1) & 0x1f;
src/mame/video/shootout.c
r14976r14977
99
1010PALETTE_INIT( shootout )
1111{
12   const UINT8 *color_prom = machine.region("proms")->base();
12   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1313   int i;
1414
1515
src/mame/video/contra.c
r14976r14977
2222
2323PALETTE_INIT( contra )
2424{
25   const UINT8 *color_prom = machine.region("proms")->base();
25   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2626   int chip;
2727
2828   /* allocate the colortable */
src/mame/video/dribling.c
r14976r14977
1717
1818PALETTE_INIT( dribling )
1919{
20   const UINT8 *prom = machine.region("proms")->base() + 0x400;
20   const UINT8 *prom = machine.root_device().memregion("proms")->base() + 0x400;
2121   int i;
2222
2323   for (i = 0; i < 256; i++)
r14976r14977
6060SCREEN_UPDATE_IND16( dribling )
6161{
6262   dribling_state *state = screen.machine().driver_data<dribling_state>();
63   UINT8 *prombase = screen.machine().region("proms")->base();
64   UINT8 *gfxbase = screen.machine().region("gfx1")->base();
63   UINT8 *prombase = screen.machine().root_device().memregion("proms")->base();
64   UINT8 *gfxbase = state->memregion("gfx1")->base();
6565   int x, y;
6666
6767   /* loop over rows */
src/mame/video/balsente.c
r14976r14977
2222
2323   /* reset the system */
2424   state->m_palettebank_vis = 0;
25   state->m_sprite_bank[0] = machine.region("gfx1")->base();
26   state->m_sprite_bank[1] = machine.region("gfx1")->base() + 0x10000;
25   state->m_sprite_bank[0] = machine.root_device().memregion("gfx1")->base();
26   state->m_sprite_bank[1] = machine.root_device().memregion("gfx1")->base() + 0x10000;
2727
2828   /* determine sprite size */
29   state->m_sprite_data = machine.region("gfx1")->base();
30   state->m_sprite_mask = machine.region("gfx1")->bytes() - 1;
29   state->m_sprite_data = machine.root_device().memregion("gfx1")->base();
30   state->m_sprite_mask = state->memregion("gfx1")->bytes() - 1;
3131
3232   /* register for saving */
3333   state->save_item(NAME(state->m_expanded_videoram));
src/mame/video/itech32.c
r14976r14977
184184      state->m_videoplane[0][i] = state->m_videoplane[1][i] = 0xff;
185185
186186   /* fetch the GROM base */
187   state->m_grom_base = machine.region("gfx1")->base();
188   state->m_grom_size = machine.region("gfx1")->bytes();
187   state->m_grom_base = machine.root_device().memregion("gfx1")->base();
188   state->m_grom_size = state->memregion("gfx1")->bytes();
189189   state->m_grom_bank = 0;
190190   state->m_grom_bank_mask = state->m_grom_size >> 24;
191191   if (state->m_grom_bank_mask == 2)
src/mame/video/mexico86.c
r14976r14977
88   if ((data & 7) > 5)
99      popmessage("Switching to invalid bank!");
1010
11   memory_set_bank(machine(), "bank1", data & 0x07);
11   membank("bank1")->set_entry(data & 0x07);
1212
1313   m_charbank = BIT(data, 5);
1414}
src/mame/video/chaknpop.c
r14976r14977
2424
2525PALETTE_INIT( chaknpop )
2626{
27   const UINT8 *color_prom = machine.region("proms")->base();
27   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2828   int i;
2929
3030   for (i = 0; i < 1024; i++)
r14976r14977
8181      int all_dirty = 0;
8282
8383      m_gfxmode = data;
84      memory_set_bank(machine(), "bank1", (m_gfxmode & GFX_VRAM_BANK) ? 1 : 0);   /* Select 2 banks of 16k */
84      membank("bank1")->set_entry((m_gfxmode & GFX_VRAM_BANK) ? 1 : 0);   /* Select 2 banks of 16k */
8585
8686      if (m_flip_x != (m_gfxmode & GFX_FLIP_X))
8787      {
r14976r14977
154154VIDEO_START( chaknpop )
155155{
156156   chaknpop_state *state = machine.driver_data<chaknpop_state>();
157   UINT8 *RAM = machine.region("maincpu")->base();
157   UINT8 *RAM = state->memregion("maincpu")->base();
158158
159159   /*                          info                       offset             type             w   h  col row */
160160   state->m_tx_tilemap = tilemap_create(machine, chaknpop_get_tx_tile_info, tilemap_scan_rows,   8,  8, 32, 32);
r14976r14977
169169   state->save_pointer(NAME(state->m_vram3), 0x2000);
170170   state->save_pointer(NAME(state->m_vram4), 0x2000);
171171
172   memory_set_bank(machine, "bank1", 0);
172   state->membank("bank1")->set_entry(0);
173173   tx_tilemap_mark_all_dirty(machine);
174174
175175   machine.save().register_postload(save_prepost_delegate(FUNC(tx_tilemap_mark_all_dirty), &machine));
src/mame/video/sspeedr.c
r14976r14977
8383static void draw_track(running_machine &machine, bitmap_ind16 &bitmap)
8484{
8585   sspeedr_state *state = machine.driver_data<sspeedr_state>();
86   const UINT8* p = machine.region("gfx3")->base();
86   const UINT8* p = state->memregion("gfx3")->base();
8787
8888   int x;
8989   int y;
src/mame/video/terracre.c
r14976r14977
3434static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
3535{
3636   terracre_state *state = machine.driver_data<terracre_state>();
37   const UINT8 *spritepalettebank = machine.region("user1")->base();
37   const UINT8 *spritepalettebank = state->memregion("user1")->base();
3838   const gfx_element *pGfx = machine.gfx[2];
3939   const UINT16 *pSource = state->m_spriteram;
4040   int i;
r14976r14977
9595
9696PALETTE_INIT( amazon )
9797{
98   const UINT8 *color_prom = machine.region("proms")->base();
98   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9999   int i;
100100
101101   /* allocate the colortable */
src/mame/video/ddribble.c
r14976r14977
1212
1313PALETTE_INIT( ddribble )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
src/mame/video/mouser.c
r14976r14977
1818
1919PALETTE_INIT( mouser )
2020{
21   const UINT8 *color_prom = machine.region("proms")->base();
21   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2222   int i;
2323
2424   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/undrfire.c
r14976r14977
6868{
6969   undrfire_state *state = machine.driver_data<undrfire_state>();
7070   UINT32 *spriteram32 = state->m_spriteram;
71   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
71   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
7272   int offs, data, tilenum, color, flipx, flipy;
7373   int x, y, priority, dblsize, curx, cury;
7474   int sprites_flipscreen = 0;
r14976r14977
212212{
213213   undrfire_state *state = machine.driver_data<undrfire_state>();
214214   UINT32 *spriteram32 = state->m_spriteram;
215   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
216   UINT8 *spritemapHibit = (UINT8 *)machine.region("user2")->base();
215   UINT16 *spritemap = (UINT16 *)machine.root_device().memregion("user1")->base();
216   UINT8 *spritemapHibit = (UINT8 *)state->memregion("user2")->base();
217217
218218   int offs, data, tilenum, color, flipx, flipy;
219219   int x, y, priority, dblsize, curx, cury;
src/mame/video/vertigo.c
r14976r14977
159159   int i;
160160   UINT64 *mcode;
161161
162   state->m_vectorrom = (UINT16 *)machine.region("user1")->base();
163   mcode = (UINT64 *)machine.region("proms")->base();
162   state->m_vectorrom = (UINT16 *)machine.root_device().memregion("user1")->base();
163   mcode = (UINT64 *)state->memregion("proms")->base();
164164
165165   /* Decode microcode */
166166   for (i = 0; i < MC_LENGTH; i++)
src/mame/video/argus.c
r14976r14977
369369   int voffs;
370370   int offs;
371371
372   UINT8 *VROM1 = machine.region("user1")->base();      /* "ag_15.bin" */
373   UINT8 *VROM2 = machine.region("user2")->base();      /* "ag_16.bin" */
372   UINT8 *VROM1 = machine.root_device().memregion("user1")->base();      /* "ag_15.bin" */
373   UINT8 *VROM2 = state->memregion("user2")->base();      /* "ag_16.bin" */
374374
375375   /* offset in pattern data */
376376   offs = VROM1[vromoffs] | (VROM1[vromoffs + 1] << 8);
src/mame/video/grchamp.c
r14976r14977
1414
1515PALETTE_INIT( grchamp )
1616{
17   const UINT8 *color_prom = machine.region("proms")->base();
17   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1818   static const int resistances[3] = { 100, 270, 470 };
1919   double rweights[3], gweights[3], bweights[2];
2020   grchamp_state *state = machine.driver_data<grchamp_state>();
r14976r14977
245245
246246
247247*/
248   const UINT8 *prom = machine.region("proms")->base() + 0x20;
248   const UINT8 *prom = machine.root_device().memregion("proms")->base() + 0x20;
249249   const gfx_element *gfx;
250250   int change = (state->m_cpu0_out[0] & 0x20) << 3;
251251   int num;
r14976r14977
364364   };
365365
366366   grchamp_state *state = screen.machine().driver_data<grchamp_state>();
367   const UINT8 *amedata = screen.machine().region("gfx5")->base();
368   const UINT8 *headdata = screen.machine().region("gfx6")->base();
369   const UINT8 *pldata = screen.machine().region("gfx7")->base();
367   const UINT8 *amedata = screen.machine().root_device().memregion("gfx5")->base();
368   const UINT8 *headdata = screen.machine().root_device().memregion("gfx6")->base();
369   const UINT8 *pldata = state->memregion("gfx7")->base();
370370   bitmap_ind16 &lpixmap = state->m_left_tilemap->pixmap();
371371   bitmap_ind16 &rpixmap = state->m_right_tilemap->pixmap();
372372   bitmap_ind16 &cpixmap = state->m_center_tilemap->pixmap();
src/mame/video/zaxxon.c
r14976r14977
1717
1818PALETTE_INIT( zaxxon )
1919{
20   const UINT8 *color_prom = machine.region("proms")->base();
20   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2121   zaxxon_state *state = machine.driver_data<zaxxon_state>();
2222   static const int resistances[3] = { 1000, 470, 220 };
2323   double rweights[3], gweights[3], bweights[2];
r14976r14977
6969
7070static TILE_GET_INFO( get_bg_tile_info )
7171{
72   const UINT8 *source = machine.region("tilemap_dat")->base();
73   int size = machine.region("tilemap_dat")->bytes() / 2;
72   const UINT8 *source = machine.root_device().memregion("tilemap_dat")->base();
73   int size = machine.root_device().memregion("tilemap_dat")->bytes() / 2;
7474   int eff_index = tile_index & (size - 1);
7575   int code = source[eff_index] + 256 * (source[eff_index + size] & 3);
7676   int color = source[eff_index + size] >> 4;
src/mame/video/shangkid.c
r14976r14977
4343   }
4444
4545   tileinfo.category =
46      (machine.region( "proms" )->base()[0x800+color*4]==2)?1:0;
46      (machine.root_device().memregion( "proms" )->base()[0x800+color*4]==2)?1:0;
4747}
4848
4949VIDEO_START( shangkid )
r14976r14977
201201
202202PALETTE_INIT( dynamski )
203203{
204   const UINT8 *color_prom = machine.region("proms")->base();
204   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
205205   int i;
206206
207207   /* allocate the colortable */
src/mame/video/trackfld.c
r14976r14977
3131
3232PALETTE_INIT( trackfld )
3333{
34   const UINT8 *color_prom = machine.region("proms")->base();
34   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3535   static const int resistances_rg[3] = { 1000, 470, 220 };
3636   static const int resistances_b [2] = { 470, 220 };
3737   double rweights[3], gweights[3], bweights[2];
src/mame/video/fastfred.c
r14976r14977
2525
2626PALETTE_INIT( fastfred )
2727{
28   const UINT8 *color_prom = machine.region("proms")->base();
28   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2929   static const int resistances[4] = { 1000, 470, 220, 100 };
3030   double rweights[4], gweights[4], bweights[4];
3131   int i;
src/mame/video/karnov.c
r14976r14977
3838
3939PALETTE_INIT( karnov )
4040{
41   const UINT8 *color_prom = machine.region("proms")->base();
41   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4242   int i;
4343
4444   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/lwings.c
r14976r14977
6363{
6464   lwings_state *state = machine.driver_data<lwings_state>();
6565   int code, color;
66   UINT8 *rom = machine.region("gfx5")->base();
67   int mask = machine.region("gfx5")->bytes() - 1;
66   UINT8 *rom = machine.root_device().memregion("gfx5")->base();
67   int mask = state->memregion("gfx5")->bytes() - 1;
6868
6969   tile_index = (tile_index + state->m_bg2_image * 0x20) & mask;
7070   code = rom[tile_index];
src/mame/video/punchout.c
r14976r14977
327327{
328328   punchout_state *state = machine.driver_data<punchout_state>();
329329   int i;
330   const UINT8 *color_prom = machine.region("proms")->base();
330   const UINT8 *color_prom = state->memregion("proms")->base();
331331
332332   // top monitor palette
333333   for (i = 0; i < 0x100; i++)
r14976r14977
347347{
348348   punchout_state *state = machine.driver_data<punchout_state>();
349349   int i;
350   const UINT8 *color_prom = machine.region("proms")->base() + 0x600;
350   const UINT8 *color_prom = state->memregion("proms")->base() + 0x600;
351351
352352   // bottom monitor palette
353353   for (i = 0; i < 0x100; i++)
src/mame/video/kopunch.c
r14976r14977
44
55PALETTE_INIT( kopunch )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99
1010   color_prom += 24;   /* first 24 colors are black */
src/mame/video/finalizr.c
r14976r14977
1212
1313PALETTE_INIT( finalizr )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
src/mame/video/xorworld.c
r14976r14977
1818
1919PALETTE_INIT( xorworld )
2020{
21   const UINT8 *color_prom = machine.region("proms")->base();
21   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2222   int i;
2323
2424   for (i = 0;i < machine.total_colors();i++){
src/mame/video/cclimber.c
r14976r14977
3838***************************************************************************/
3939PALETTE_INIT( cclimber )
4040{
41   const UINT8 *color_prom = machine.region("proms")->base();
41   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4242   static const int resistances_rg[3] = { 1000, 470, 220 };
4343   static const int resistances_b [2] = { 470, 220 };
4444   double weights_rg[3], weights_b[2];
r14976r14977
115115
116116PALETTE_INIT( swimmer )
117117{
118   const UINT8 *color_prom = machine.region("proms")->base();
118   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
119119   int i;
120120
121121   for (i = 0; i < 0x100; i++)
r14976r14977
184184
185185PALETTE_INIT( yamato )
186186{
187   const UINT8 *color_prom = machine.region("proms")->base();
187   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
188188   int i;
189189
190190   /* chars - 12 bits RGB */
r14976r14977
252252
253253PALETTE_INIT( toprollr )
254254{
255   const UINT8 *color_prom = machine.region("proms")->base();
255   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
256256   int i;
257257
258258   for (i = 0; i < 0xa0; i++)
r14976r14977
692692{
693693   cclimber_state *state = screen.machine().driver_data<cclimber_state>();
694694   int i;
695   UINT8 *sky_rom = screen.machine().region("user1")->base() + 0x1200;
695   UINT8 *sky_rom = state->memregion("user1")->base() + 0x1200;
696696
697697   for (i = 0; i < 0x100; i++)
698698   {
src/mame/video/gticlub.c
r14976r14977
8888      {
8989         case 0x0b:      // CG Board ROM read
9090         {
91            UINT16 *rom = (UINT16*)machine.region("gfx1")->base();
91            UINT16 *rom = (UINT16*)machine.root_device().memregion("gfx1")->base();
9292            return rom[K001006_addr[chip] / 2] << 16;
9393         }
9494         case 0x0d:      // Palette RAM read
r14976r14977
239239   int height = machine.primary_screen->height();
240240   K001005_zbuffer = auto_bitmap_ind32_alloc(machine, width, height);
241241
242   gfxrom = machine.region("gfx1")->base();
242   gfxrom = machine.root_device().memregion("gfx1")->base();
243243
244244   K001005_bitmap[0] = auto_bitmap_rgb32_alloc(machine, machine.primary_screen->width(), machine.primary_screen->height());
245245   K001005_bitmap[1] = auto_bitmap_rgb32_alloc(machine, machine.primary_screen->width(), machine.primary_screen->height());
r14976r14977
15391539        int index = (debug_tex_page - 1) * 0x40000;
15401540        int pal = debug_tex_palette & 7;
15411541        int tp = (debug_tex_palette >> 3) & 1;
1542        UINT8 *rom = machine.region("gfx1")->base();
1542        UINT8 *rom = machine.root_device().memregion("gfx1")->base();
15431543
15441544        for (y=0; y < 384; y++)
15451545        {
src/mame/video/dkong.c
r14976r14977
201201
202202PALETTE_INIT( dkong2b)
203203{
204   const UINT8 *color_prom = machine.region("proms")->base();
204   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
205205   dkong_state *state = machine.driver_data<dkong_state>();
206206   rgb_t   *rgb;
207207   int i;
r14976r14977
232232#ifdef UNUSED_FUNCTION
233233PALETTE_INIT( dkong4b )
234234{
235   const UINT8 *color_prom = machine.region("proms")->base();
235   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
236236   dkong_state *state = machine.driver_data<dkong_state>();
237237   int i;
238238   int r,g,b;
r14976r14977
272272
273273PALETTE_INIT( radarscp )
274274{
275   const UINT8 *color_prom = machine.region("proms")->base();
275   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
276276   dkong_state *state = machine.driver_data<dkong_state>();
277277   int i;
278278   int r,g,b;
r14976r14977
337337
338338PALETTE_INIT( radarscp1 )
339339{
340   const UINT8 *color_prom = machine.region("proms")->base();
340   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
341341   dkong_state *state = machine.driver_data<dkong_state>();
342342   int i;
343343   int r,g,b;
r14976r14977
438438
439439PALETTE_INIT( dkong3 )
440440{
441   const UINT8 *color_prom = machine.region("proms")->base();
441   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
442442   dkong_state *state = machine.driver_data<dkong_state>();
443443   rgb_t   *rgb;
444444
r14976r14977
937937   {
938938      case HARDWARE_TRS02:
939939         machine.primary_screen->register_screen_bitmap(state->m_bg_bits);
940         state->m_gfx3 = machine.region("gfx3")->base();
941         state->m_gfx3_len = machine.region("gfx3")->bytes();
940         state->m_gfx3 = machine.root_device().memregion("gfx3")->base();
941         state->m_gfx3_len = machine.root_device().memregion("gfx3")->bytes();
942942          /* fall through */
943943      case HARDWARE_TKG04:
944944      case HARDWARE_TKG02:
r14976r14977
950950         state->m_bg_tilemap->set_scrolldx(0, 128);
951951
952952         machine.primary_screen->register_screen_bitmap(state->m_bg_bits);
953         state->m_gfx4 = machine.region("gfx4")->base();
954         state->m_gfx3 = machine.region("gfx3")->base();
955         state->m_gfx3_len = machine.region("gfx3")->bytes();
953         state->m_gfx4 = machine.root_device().memregion("gfx4")->base();
954         state->m_gfx3 = machine.root_device().memregion("gfx3")->base();
955         state->m_gfx3_len = state->memregion("gfx3")->bytes();
956956
957957         break;
958958      default:
src/mame/video/appoooh.c
r14976r14977
2222
2323PALETTE_INIT( appoooh )
2424{
25   const UINT8 *color_prom = machine.region("proms")->base();
25   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2626   int i;
2727
2828   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
6161
6262PALETTE_INIT( robowres )
6363{
64   const UINT8 *color_prom = machine.region("proms")->base();
64   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6565   int i;
6666
6767   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
195195
196196   /* bit 6 ROM bank select */
197197   {
198      UINT8 *RAM = machine().region("maincpu")->base();
198      UINT8 *RAM = memregion("maincpu")->base();
199199
200      memory_set_bankptr(machine(), "bank1",&RAM[data&0x40 ? 0x10000 : 0x0a000]);
200      membank("bank1")->set_base(&RAM[data&0x40 ? 0x10000 : 0x0a000]);
201201   }
202202
203203   /* bit 7 unknown (used) */
src/mame/video/skyraid.c
r14976r14977
3939static void draw_terrain(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
4040{
4141   skyraid_state *state = machine.driver_data<skyraid_state>();
42   const UINT8* p = machine.region("user1")->base();
42   const UINT8* p = state->memregion("user1")->base();
4343
4444   int x;
4545   int y;
r14976r14977
114114
115115static void draw_trapezoid(running_machine &machine, bitmap_ind16& dst, bitmap_ind16& src)
116116{
117   const UINT8* p = machine.region("user2")->base();
117   const UINT8* p = machine.root_device().memregion("user2")->base();
118118
119119   int x;
120120   int y;
src/mame/video/travrusa.c
r14976r14977
3939
4040PALETTE_INIT( travrusa )
4141{
42   const UINT8 *color_prom = machine.region("proms")->base();
42   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4343   int i;
4444
4545   /* allocate the colortable */
r14976r14977
115115
116116PALETTE_INIT( shtrider )
117117{
118   const UINT8 *color_prom = machine.region("proms")->base();
118   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
119119   int i;
120120
121121   /* allocate the colortable */
src/mame/video/metlclsh.c
r14976r14977
2828   if (data & 1)
2929   {
3030      m_write_mask = 0;
31      memory_set_bankptr(machine(), "bank1", m_bgram);
31      membank("bank1")->set_base(m_bgram);
3232   }
3333   else
3434   {
3535      m_write_mask = 1 << (data >> 1);
36      memory_set_bankptr(machine(), "bank1", m_otherram);
36      membank("bank1")->set_base(m_otherram);
3737   }
3838}
3939
src/mame/video/kaneko16.c
r14976r14977
236236{
237237   kaneko16_state *state = machine.driver_data<kaneko16_state>();
238238   int sx, x,y;
239   UINT8 *RAM   =   machine.region("gfx3")->base();
239   UINT8 *RAM   =   state->memregion("gfx3")->base();
240240
241241   /* Render the hi-color static backgrounds held in the ROMs */
242242
src/mame/video/goldstar.c
r14976r14977
408408
409409   if (state->m_cm_enable_reg &0x04)
410410   {
411      if (screen.machine().region("user1")->base())
411      if (screen.machine().root_device().memregion("user1")->base())
412412      {
413413         const gfx_element *gfx = screen.machine().gfx[2];
414414         int girlyscroll = (INT8)((state->m_cm_girl_scroll & 0xf0));
r14976r14977
451451
452452   if (state->m_cm_enable_reg &0x04)
453453   {
454      if (screen.machine().region("user1")->base())
454      if (screen.machine().root_device().memregion("user1")->base())
455455      {
456456         const gfx_element *gfx = screen.machine().gfx[2];
457457         int girlyscroll = (INT8)((state->m_cm_girl_scroll & 0xf0));
src/mame/video/20pacgal.c
r14976r14977
2525static void get_pens(running_machine &machine, const _20pacgal_state *state, pen_t *pens)
2626{
2727   offs_t offs;
28   UINT8 *color_prom = machine.region("proms")->base() + (NUM_PENS * state->m_game_selected);
28   UINT8 *color_prom = machine.root_device().memregion("proms")->base() + (NUM_PENS * state->m_game_selected);
2929
3030   for (offs = 0; offs < NUM_PENS ;offs++)
3131   {
src/mame/video/seicross.c
r14976r14977
2727***************************************************************************/
2828PALETTE_INIT( seicross )
2929{
30   const UINT8 *color_prom = machine.region("proms")->base();
30   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3131   int i;
3232
3333
src/mame/video/deniam.c
r14976r14977
213213{
214214   deniam_state *state = machine.driver_data<deniam_state>();
215215   int offs;
216   UINT8 *gfx = machine.region("gfx2")->base();
216   UINT8 *gfx = state->memregion("gfx2")->base();
217217
218218   for (offs = state->m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
219219   {
src/mame/video/redalert.c
r14976r14977
5151   double charmap_b_weights[2];
5252   double back_r_weight[1];
5353   double back_gb_weight[1];
54   const UINT8 *prom = machine.region("proms")->base();
54   const UINT8 *prom = machine.root_device().memregion("proms")->base();
5555
5656   scaler = compute_resistor_weights(0, 0xff, -1,
5757                             1, resistances_bitmap,     bitmap_weight,      470, 0,
r14976r14977
116116   double charmap_b_weights[2];
117117   double back_r_weight[1];
118118   double back_gb_weight[1];
119   const UINT8 *prom = machine.region("proms")->base();
119   const UINT8 *prom = machine.root_device().memregion("proms")->base();
120120
121121   scaler = compute_resistor_weights(0, 0xff, -1,
122122                             1, resistances_bitmap,     bitmap_weight,      470, 0,
src/mame/video/prehisle.c
r14976r14977
5959
6060static TILE_GET_INFO( get_bg2_tile_info )
6161{
62   UINT8 *tilerom = machine.region("gfx5")->base();
62   UINT8 *tilerom = machine.root_device().memregion("gfx5")->base();
6363
6464   int offs = tile_index * 2;
6565   int attr = tilerom[offs + 1] + (tilerom[offs] << 8);
src/mame/video/simpsons.c
r14976r14977
9999   {
100100      space->install_read_bank(0x0000, 0x0fff, "bank5");
101101      space->install_write_handler(0x0000, 0x0fff, write8_delegate(FUNC(simpsons_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state));
102      memory_set_bankptr(machine, "bank5", state->m_generic_paletteram_8);
102      state->membank("bank5")->set_base(state->m_generic_paletteram_8);
103103   }
104104   else
105105      space->install_legacy_readwrite_handler(*state->m_k052109, 0x0000, 0x0fff, FUNC(k052109_r), FUNC(k052109_w));
src/mame/video/polepos.c
r14976r14977
2727
2828PALETTE_INIT( polepos )
2929{
30   const UINT8 *color_prom = machine.region("proms")->base();
30   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3131   polepos_state *state = machine.driver_data<polepos_state>();
3232   int i, j;
3333
r14976r14977
348348static void draw_road(running_machine &machine, bitmap_ind16 &bitmap)
349349{
350350   polepos_state *state = machine.driver_data<polepos_state>();
351   const UINT8 *road_control = machine.region("gfx5")->base();
351   const UINT8 *road_control = state->memregion("gfx5")->base();
352352   const UINT8 *road_bits1 = road_control + 0x2000;
353353   const UINT8 *road_bits2 = road_control + 0x4000;
354354   int x, y, i;
r14976r14977
427427{
428428   const gfx_element *gfx = machine.gfx[big ? 3 : 2];
429429   const UINT8 *gfxdata = gfx_element_get_data(gfx, code % gfx->total_elements);
430   UINT8 *scaling_rom = machine.region("gfx6")->base();
430   UINT8 *scaling_rom = machine.root_device().memregion("gfx6")->base();
431431   UINT32 transmask = colortable_get_transpen_mask(machine.colortable, gfx, color, 0x1f);
432432   int coloroffs = gfx->color_base + color * gfx->color_granularity;
433433   int x,y;
src/mame/video/model1.c
r14976r14977
14501450
14511451   state->m_view = auto_alloc_clear(machine, struct view);
14521452
1453   state->m_poly_rom = (UINT32 *)machine.region("user1")->base();
1453   state->m_poly_rom = (UINT32 *)state->memregion("user1")->base();
14541454   state->m_poly_ram = auto_alloc_array_clear(machine, UINT32, 0x400000);
14551455   state->m_tgp_ram = auto_alloc_array_clear(machine, UINT16, 0x100000-0x40000);
14561456   state->m_pointdb = auto_alloc_array_clear(machine, struct point, 1000000*2);
src/mame/video/jackal.c
r14976r14977
1414
1515PALETTE_INIT( jackal )
1616{
17   const UINT8 *color_prom = machine.region("proms")->base();
17   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1818   int i;
1919
2020   /* allocate the colortable */
r14976r14977
6464
6565static TILE_GET_INFO( get_bg_tile_info )
6666{
67   UINT8 *RAM = machine.region("master")->base();
67   UINT8 *RAM = machine.root_device().memregion("master")->base();
6868
6969   int attr = RAM[0x2000 + tile_index];
7070   int code = RAM[0x2400 + tile_index] + ((attr & 0xc0) << 2) + ((attr & 0x30) << 6);
r14976r14977
8383static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
8484{
8585   jackal_state *state = machine.driver_data<jackal_state>();
86   UINT8 *RAM = machine.region("master")->base();
86   UINT8 *RAM = state->memregion("master")->base();
8787   int i;
8888
8989   state->m_scrollram = &RAM[0x0020];
r14976r14977
206206static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
207207{
208208   jackal_state *state = machine.driver_data<jackal_state>();
209   UINT8 *RAM = machine.region("master")->base();
209   UINT8 *RAM = state->memregion("master")->base();
210210   UINT8 *sr, *ss;
211211
212212   if (state->m_videoctrl[0x03] & 0x08)
src/mame/video/mw8080bw.c
r14976r14977
229229
230230   UINT16 cloud_counter = state->m_phantom2_cloud_counter;
231231
232   UINT8 *cloud_region = screen.machine().region("proms")->base();
232   UINT8 *cloud_region = state->memregion("proms")->base();
233233
234234   while (1)
235235   {
src/mame/video/taitoic.c
r14976r14977
39643964   UINT16 roada_line[512], roadb_line[512];
39653965   UINT16 *dst16;
39663966   UINT16 *roada, *roadb;
3967   UINT16 *roadgfx = (UINT16 *)device->machine().region(tc0150rod->gfx_region)->base();
3967   UINT16 *roadgfx = (UINT16 *)device->machine().root_device().memregion(tc0150rod->gfx_region)->base();
39683968
39693969   UINT16 pixel, color, gfx_word;
39703970   UINT16 roada_clipl, roada_clipr, roada_bodyctrl;
src/mame/video/namcos86.c
r14976r14977
3434
3535PALETTE_INIT( namcos86 )
3636{
37   const UINT8 *color_prom = machine.region("proms")->base();
37   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3838   namcos86_state *state = machine.driver_data<namcos86_state>();
3939   int i;
4040   rgb_t palette[512];
src/mame/video/suna8.c
r14976r14977
8383
8484   if (machine.input().code_pressed(KEYCODE_X))
8585   {
86      UINT8 *rom = machine.region("maincpu")->base() + 0x10000 + 0x4000 * state->m_trombank;
86      UINT8 *rom = state->memregion("maincpu")->base() + 0x10000 + 0x4000 * state->m_trombank;
8787      code = rom[ 2 * tile_index + 0 ];
8888      attr = rom[ 2 * tile_index + 1 ];
8989   }
r14976r14977
416416   if (screen.machine().input().code_pressed(KEYCODE_Z) || screen.machine().input().code_pressed(KEYCODE_X))
417417   {
418418      suna8_state *state = screen.machine().driver_data<suna8_state>();
419      int max_tiles = screen.machine().region("gfx1")->bytes() / (0x400 * 0x20);
419      int max_tiles = state->memregion("gfx1")->bytes() / (0x400 * 0x20);
420420
421421      if (screen.machine().input().code_pressed_once(KEYCODE_Q))   { state->m_page--;   screen.machine().tilemap().mark_all_dirty();   }
422422      if (screen.machine().input().code_pressed_once(KEYCODE_W))   { state->m_page++;   screen.machine().tilemap().mark_all_dirty();   }
src/mame/video/btime.c
r14976r14977
3030
3131PALETTE_INIT( btime )
3232{
33   const UINT8 *color_prom = machine.region("proms")->base();
33   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3434   int i;
3535
3636
r14976r14977
8181
8282PALETTE_INIT( lnc )
8383{
84   const UINT8 *color_prom = machine.region("proms")->base();
84   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8585   int i;
8686
8787   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
377377{
378378   btime_state *state = machine.driver_data<btime_state>();
379379   int i;
380   const UINT8 *gfx = machine.region("bg_map")->base();
380   const UINT8 *gfx = state->memregion("bg_map")->base();
381381   int scroll = -(state->m_bnj_scroll2 | ((state->m_bnj_scroll1 & 0x03) << 8));
382382
383383   // One extra iteration for wrap around
src/mame/video/nova2001.c
r14976r14977
1010
1111PALETTE_INIT( nova2001 )
1212{
13   const UINT8 *color_prom = machine.region("proms")->base();
13   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1414   int i;
1515
1616   /* Color #1 is used for palette animation.          */
src/mame/video/cps1.c
r14976r14977
15201520   if (strcmp(gamename, "sf2rb") == 0)
15211521   {
15221522      /* Patch out protection check */
1523      UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1523      UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
15241524      rom[0xe5464 / 2] = 0x6012;
15251525   }
15261526
15271527   if (strcmp(gamename, "sf2rb2") == 0)
15281528   {
15291529      /* Patch out protection check */
1530      UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1530      UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
15311531      rom[0xe5332 / 2] = 0x6014;
15321532   }
15331533
r14976r14977
15381538           by the cpu core as a 32-bit branch. This branch would make the
15391539           game crash (address error, since it would branch to an odd address)
15401540           if location 180ca6 (outside ROM space) isn't 0. Protection check? */
1541      UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1541      UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
15421542      rom[0x11756 / 2] = 0x4e71;
15431543   }
15441544   else if (strcmp(gamename, "ghouls") == 0)
15451545   {
15461546      /* Patch out self-test... it takes forever */
1547      UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1547      UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
15481548      rom[0x61964 / 2] = 0x4ef9;
15491549      rom[0x61966 / 2] = 0x0000;
15501550      rom[0x61968 / 2] = 0x0400;
r14976r14977
17161716
17171717static void cps1_gfx_decode( running_machine &machine )
17181718{
1719   int size = machine.region("gfx")->bytes();
1719   int size = machine.root_device().memregion("gfx")->bytes();
17201720   int i, j, gfxsize;
1721   UINT8 *cps1_gfx = machine.region("gfx")->base();
1721   UINT8 *cps1_gfx = machine.root_device().memregion("gfx")->base();
17221722
17231723   gfxsize = size / 4;
17241724
r14976r14977
17721772static void cps2_gfx_decode( running_machine &machine )
17731773{
17741774   const int banksize = 0x200000;
1775   int size = machine.region("gfx")->bytes();
1775   int size = machine.root_device().memregion("gfx")->bytes();
17761776   int i;
17771777
17781778   for (i = 0; i < size; i += banksize)
1779      unshuffle((UINT64 *)(machine.region("gfx")->base() + i), banksize / 8);
1779      unshuffle((UINT64 *)(machine.root_device().memregion("gfx")->base() + i), banksize / 8);
17801780
17811781   cps1_gfx_decode(machine);
17821782}
r14976r14977
26972697{
26982698   cps_state *state = screen.machine().driver_data<cps_state>();
26992699   int offs;
2700   UINT8 *stars_rom = screen.machine().region("stars")->base();
2700   UINT8 *stars_rom = state->memregion("stars")->base();
27012701
27022702   if (!stars_rom && (state->m_stars_enabled[0] || state->m_stars_enabled[1]))
27032703   {
src/mame/video/wiz.c
r14976r14977
3535***************************************************************************/
3636PALETTE_INIT( wiz )
3737{
38   const UINT8 *color_prom = machine.region("proms")->base();
38   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3939   int i;
4040
4141
src/mame/video/stactics.c
r14976r14977
5959
6060static PALETTE_INIT( stactics )
6161{
62   const UINT8 *color_prom = machine.region("proms")->base();
62   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6363   int i;
6464
6565   for (i = 0; i < 0x400; i++)
r14976r14977
306306static void update_artwork(running_machine &machine, stactics_state *state)
307307{
308308   int i;
309   UINT8 *beam_region = machine.region("user1")->base();
309   UINT8 *beam_region = machine.root_device().memregion("user1")->base();
310310
311311   /* set the lamps first */
312312   output_set_indexed_value("base_lamp", 4, state->m_lamps[0] & 0x01);
src/mame/video/mermaid.c
r14976r14977
44
55PALETTE_INIT( mermaid )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99
1010   /* allocate the colortable */
r14976r14977
3535
3636PALETTE_INIT( rougien )
3737{
38   const UINT8 *color_prom = machine.region("proms")->base();
38   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3939   int i;
4040
4141   /* allocate the colortable */
src/mame/video/gaelco3d.c
r14976r14977
3030     m_screenbits(state.machine().primary_screen->width(), state.machine().primary_screen->height()),
3131     m_zbuffer(state.machine().primary_screen->width(), state.machine().primary_screen->height()),
3232     m_polygons(0),
33     m_texture_size(state.machine().region("gfx1")->bytes()),
34     m_texmask_size(state.machine().region("gfx2")->bytes() * 8),
33     m_texture_size(state.machine().root_device().memregion("gfx1")->bytes()),
34     m_texmask_size(state.machine().root_device().memregion("gfx2")->bytes() * 8),
3535     m_texture(auto_alloc_array(state.machine(), UINT8, m_texture_size)),
3636     m_texmask(auto_alloc_array(state.machine(), UINT8, m_texmask_size))
3737{
r14976r14977
3939   state_save_register_global_bitmap(state.machine(), &m_zbuffer);
4040
4141   /* first expand the pixel data */
42   UINT8 *src = state.machine().region("gfx1")->base();
42   UINT8 *src = state.machine().root_device().memregion("gfx1")->base();
4343   UINT8 *dst = m_texture;
4444   for (int y = 0; y < m_texture_size/4096; y += 2)
4545      for (int x = 0; x < 4096; x += 2)
r14976r14977
5151      }
5252
5353   /* then expand the mask data */
54   src = state.machine().region("gfx2")->base();
54   src = state.machine().root_device().memregion("gfx2")->base();
5555   dst = m_texmask;
5656   for (int y = 0; y < m_texmask_size/4096; y++)
5757      for (int x = 0; x < 4096; x++)
src/mame/video/lethalj.c
r14976r14977
8282   state->m_screenram = auto_alloc_array(machine, UINT16, BLITTER_DEST_WIDTH * BLITTER_DEST_HEIGHT);
8383
8484   /* predetermine blitter info */
85   state->m_blitter_base = (UINT16 *)machine.region("gfx1")->base();
86   state->m_blitter_rows = machine.region("gfx1")->bytes() / (2*BLITTER_SOURCE_WIDTH);
85   state->m_blitter_base = (UINT16 *)machine.root_device().memregion("gfx1")->base();
86   state->m_blitter_rows = state->memregion("gfx1")->bytes() / (2*BLITTER_SOURCE_WIDTH);
8787}
8888
8989
src/mame/video/itech8.c
r14976r14977
175175   state->m_page_select = 0xc0;
176176
177177   /* fetch the GROM base */
178   state->m_grom_base = machine.region("grom")->base();
179   state->m_grom_size = machine.region("grom")->bytes();
178   state->m_grom_base = machine.root_device().memregion("grom")->base();
179   state->m_grom_size = state->memregion("grom")->bytes();
180180}
181181
182182
src/mame/video/galaxian.c
r14976r14977
255255
256256PALETTE_INIT( galaxian )
257257{
258   const UINT8 *color_prom = machine.region("proms")->base();
258   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
259259   galaxian_state *state = machine.driver_data<galaxian_state>();
260260   static const int rgb_resistances[3] = { 1000, 470, 220 };
261261   double rweights[3], gweights[3], bweights[2];
r14976r14977
294294         2, &rgb_resistances[1], bweights, 470, 0);
295295
296296   /* decode the palette first */
297   len = machine.region("proms")->bytes();
297   len = machine.root_device().memregion("proms")->bytes();
298298   for (i = 0; i < len; i++)
299299   {
300300      UINT8 bit0, bit1, bit2, r, g, b;
r14976r14977
10771077void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
10781078{
10791079   galaxian_state *state = machine.driver_data<galaxian_state>();
1080   const UINT8 *prom = machine.region("user1")->base();
1080   const UINT8 *prom = state->memregion("user1")->base();
10811081   rectangle draw;
10821082   int x;
10831083
src/mame/video/bbusters.c
r14976r14977
203203static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const UINT16 *source, int bank, int colval, int colmask)
204204{
205205   bbusters_state *state = machine.driver_data<bbusters_state>();
206   const UINT8 *scale_table=machine.region("user1")->base();
206   const UINT8 *scale_table=state->memregion("user1")->base();
207207   int offs;
208208
209209   for (offs = 0;offs <0x800 ;offs += 4) {
src/mame/video/snk.c
r14976r14977
2727
2828PALETTE_INIT( tnk3 )
2929{
30   const UINT8 *color_prom = machine.region("proms")->base();
30   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3131   int i;
3232   int num_colors = 0x400;
3333
src/mame/video/hyprduel.c
r14976r14977
348348
349349static void expand_gfx1(hyprduel_state &state)
350350{
351   UINT8 *base_gfx = state.machine().region("gfx1")->base();
352   UINT32 length = 2 * state.machine().region("gfx1")->bytes();
351   UINT8 *base_gfx = state.machine().root_device().memregion("gfx1")->base();
352   UINT32 length = 2 * state.machine().root_device().memregion("gfx1")->bytes();
353353   state.m_expanded_gfx1 = auto_alloc_array(state.machine(), UINT8, length);
354354   for (int i = 0; i < length; i += 2)
355355   {
r14976r14977
472472{
473473   hyprduel_state *state = machine.driver_data<hyprduel_state>();
474474   UINT8 *base_gfx4 = state->m_expanded_gfx1;
475   UINT8 *base_gfx8 = machine.region("gfx1")->base();
476   UINT32 gfx_size = machine.region("gfx1")->bytes();
475   UINT8 *base_gfx8 = machine.root_device().memregion("gfx1")->base();
476   UINT32 gfx_size = state->memregion("gfx1")->bytes();
477477
478478   int max_x = machine.primary_screen->width();
479479   int max_y = machine.primary_screen->height();
src/mame/video/namconb1.c
r14976r14977
164164
165165VIDEO_START( namconb1 )
166166{
167   namco_tilemap_init( machine, NAMCONB1_TILEGFX, machine.region(NAMCONB1_TILEMASKREGION)->base(), NB1TilemapCB );
167   namco_tilemap_init( machine, NAMCONB1_TILEGFX, machine.root_device().memregion(NAMCONB1_TILEMASKREGION)->base(), NB1TilemapCB );
168168   namco_obj_init(machine,NAMCONB1_SPRITEGFX,0x0,NB1objcode2tile);
169169} /* namconb1 */
170170
r14976r14977
225225
226226VIDEO_START( namconb2 )
227227{
228   namco_tilemap_init(machine, NAMCONB1_TILEGFX, machine.region(NAMCONB1_TILEMASKREGION)->base(), NB2TilemapCB );
228   namco_tilemap_init(machine, NAMCONB1_TILEGFX, machine.root_device().memregion(NAMCONB1_TILEMASKREGION)->base(), NB2TilemapCB );
229229   namco_obj_init(machine,NAMCONB1_SPRITEGFX,0x0,NB2objcode2tile);
230230   namco_roz_init(machine, NAMCONB1_ROTGFX,NAMCONB1_ROTMASKREGION);
231231} /* namconb2_vh_start */
src/mame/video/calomega.c
r14976r14977
7070
7171PALETTE_INIT( calomega )
7272{
73   const UINT8 *color_prom = machine.region("proms")->base();
73   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7474/*  prom bits
7575    7654 3210
7676    ---- ---x   red component.
src/mame/video/strnskil.c
r14976r14977
1414
1515PALETTE_INIT( strnskil )
1616{
17   const UINT8 *color_prom = machine.region("proms")->base();
17   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1818   int i;
1919
2020   /* allocate the colortable */
r14976r14977
126126{
127127   strnskil_state *state = screen.machine().driver_data<strnskil_state>();
128128   int row;
129   const UINT8 *usr1 = screen.machine().region("user1")->base();
129   const UINT8 *usr1 = state->memregion("user1")->base();
130130
131131   for (row = 0; row < 32; row++)
132132   {
src/mame/video/cosmic.c
r14976r14977
2020{
2121   cosmic_state *state = machine.driver_data<cosmic_state>();
2222   offs_t offs = (state->m_color_registers[0] << 9) | (state->m_color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3);
23   pen_t pen = machine.region("user1")->base()[offs];
23   pen_t pen = state->memregion("user1")->base()[offs];
2424
2525   if (state->m_color_registers[1])
2626      pen >>= 4;
r14976r14977
3232{
3333   cosmic_state *state = machine.driver_data<cosmic_state>();
3434   offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3);
35   pen_t pen = machine.region("user1")->base()[offs];
35   pen_t pen = state->memregion("user1")->base()[offs];
3636
3737   if (state->m_color_registers[1]) // 0 according to the schematics, but that breaks alien formation colors
3838      pen >>= 4;
r14976r14977
4444{
4545   cosmic_state *state = machine.driver_data<cosmic_state>();
4646   offs_t offs = (state->m_color_registers[0] << 8) | (state->m_color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4);
47   pen_t pen = machine.region("user1")->base()[offs];
47   pen_t pen = state->memregion("user1")->base()[offs];
4848
4949   /* the upper 4 bits are for cocktail mode support */
5050   return pen & 0x0f;
r14976r14977
5454{
5555   cosmic_state *state = machine.driver_data<cosmic_state>();
5656   offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4);
57   pen_t pen = machine.region("user1")->base()[offs];
57   pen_t pen = state->memregion("user1")->base()[offs];
5858
5959   if (state->m_color_registers[1])
6060      pen >>= 4;
r14976r14977
7777
7878PALETTE_INIT( panic )
7979{
80   const UINT8 *color_prom = machine.region("proms")->base();
80   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8181   cosmic_state *state = machine.driver_data<cosmic_state>();
8282   int i;
8383
r14976r14977
120120
121121PALETTE_INIT( cosmica )
122122{
123   const UINT8 *color_prom = machine.region("proms")->base();
123   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
124124   cosmic_state *state = machine.driver_data<cosmic_state>();
125125   int i;
126126
r14976r14977
182182
183183PALETTE_INIT( magspot )
184184{
185   const UINT8 *color_prom = machine.region("proms")->base();
185   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
186186   cosmic_state *state = machine.driver_data<cosmic_state>();
187187   int i;
188188
r14976r14977
217217
218218PALETTE_INIT( nomnlnd )
219219{
220   const UINT8 *color_prom = machine.region("proms")->base();
220   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
221221   cosmic_state *state = machine.driver_data<cosmic_state>();
222222   int i;
223223
r14976r14977
324324   cosmic_state *state = screen.machine().driver_data<cosmic_state>();
325325   UINT8 y = 0;
326326   UINT8 map = 0;
327   UINT8 *PROM = screen.machine().region("user2")->base();
327   UINT8 *PROM = state->memregion("user2")->base();
328328
329329   while (1)
330330   {
r14976r14977
373373{
374374   cosmic_state *state = machine.driver_data<cosmic_state>();
375375   UINT8 y;
376   UINT8 *horz_PROM = machine.region("user2")->base();
377   UINT8 *vert_PROM = machine.region("user3")->base();
376   UINT8 *horz_PROM = machine.root_device().memregion("user2")->base();
377   UINT8 *vert_PROM = state->memregion("user3")->base();
378378   offs_t horz_addr = 0;
379379
380380   UINT8 count = 0;
r14976r14977
433433   cosmic_state *state = screen.machine().driver_data<cosmic_state>();
434434   UINT8 y = 0;
435435   UINT8 water = screen.frame_number();
436   UINT8 *PROM = screen.machine().region("user2")->base();
436   UINT8 *PROM = state->memregion("user2")->base();
437437
438438   /* all positioning is via logic gates:
439439
src/mame/video/shaolins.c
r14976r14977
2828***************************************************************************/
2929PALETTE_INIT( shaolins )
3030{
31   const UINT8 *color_prom = machine.region("proms")->base();
31   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3232   static const int resistances[4] = { 2200, 1000, 470, 220 };
3333   double rweights[4], gweights[4], bweights[4];
3434   int i;
src/mame/video/model2.c
r14976r14977
27132713   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_exit), &machine));
27142714
27152715   /* initialize the hardware rasterizer */
2716   model2_3d_init( machine, (UINT16*)machine.region("user3")->base() );
2716   model2_3d_init( machine, (UINT16*)machine.root_device().memregion("user3")->base() );
27172717
27182718   /* initialize the geometry engine */
2719   geo_init( machine, (UINT32*)machine.region("user2")->base() );
2719   geo_init( machine, (UINT32*)state->memregion("user2")->base() );
27202720}
27212721
27222722SCREEN_UPDATE_RGB32(model2)
src/mame/video/wiping.c
r14976r14977
1919
2020PALETTE_INIT( wiping )
2121{
22   const UINT8 *color_prom = machine.region("proms")->base();
22   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2323   static const int resistances_rg[3] = { 1000, 470, 220 };
2424   static const int resistances_b [2] = { 470, 220 };
2525   double rweights[3], gweights[3], bweights[2];
src/mame/video/kyugo.c
r14976r14977
4747{
4848   kyugo_state *state = machine.driver_data<kyugo_state>();
4949
50   state->m_color_codes = machine.region("proms")->base() + 0x300;
50   state->m_color_codes = state->memregion("proms")->base() + 0x300;
5151
5252   state->m_fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
5353   state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
src/mame/video/leland.c
r14976r14977
392392   leland_state *state = screen.machine().driver_data<leland_state>();
393393   int y;
394394
395   const UINT8 *bg_prom = screen.machine().region("user1")->base();
396   const UINT8 *bg_gfx = screen.machine().region("gfx1")->base();
397   offs_t bg_gfx_bank_page_size = screen.machine().region("gfx1")->bytes() / 3;
395   const UINT8 *bg_prom = screen.machine().root_device().memregion("user1")->base();
396   const UINT8 *bg_gfx = screen.machine().root_device().memregion("gfx1")->base();
397   offs_t bg_gfx_bank_page_size = state->memregion("gfx1")->bytes() / 3;
398398   offs_t char_bank = (((state->m_gfxbank >> 4) & 0x03) * 0x2000) & (bg_gfx_bank_page_size - 1);
399399   offs_t prom_bank = ((state->m_gfxbank >> 3) & 0x01) * 0x2000;
400400
r14976r14977
461461   leland_state *state = screen.machine().driver_data<leland_state>();
462462   int y;
463463
464   const UINT8 *bg_gfx = screen.machine().region("gfx1")->base();
465   offs_t bg_gfx_bank_page_size = screen.machine().region("gfx1")->bytes() / 6;
464   const UINT8 *bg_gfx = screen.machine().root_device().memregion("gfx1")->base();
465   offs_t bg_gfx_bank_page_size = state->memregion("gfx1")->bytes() / 6;
466466   offs_t bg_gfx_offs_mask = bg_gfx_bank_page_size - 1;
467467
468468   /* for each scanline in the visible region */
src/mame/video/popeye.c
r14976r14977
115115
116116PALETTE_INIT( popeye )
117117{
118   const UINT8 *color_prom = machine.region("proms")->base();
118   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
119119   popeye_state *state = machine.driver_data<popeye_state>();
120120   state->m_invertmask = 0xff;
121121
r14976r14977
124124
125125PALETTE_INIT( popeyebl )
126126{
127   const UINT8 *color_prom = machine.region("proms")->base();
127   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
128128   popeye_state *state = machine.driver_data<popeye_state>();
129129   state->m_invertmask = 0x00;
130130
r14976r14977
135135{
136136   popeye_state *state = machine.driver_data<popeye_state>();
137137   int i;
138   UINT8 *color_prom = machine.region("proms")->base() + 16 * bank;
138   UINT8 *color_prom = state->memregion("proms")->base() + 16 * bank;
139139
140140   for (i = 0;i < 16;i++)
141141   {
src/mame/video/compgolf.c
r14976r14977
1111
1212PALETTE_INIT( compgolf )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   int i;
1616
1717   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/pushman.c
r14976r14977
1515
1616static TILE_GET_INFO( get_back_tile_info )
1717{
18   UINT8 *bg_map = machine.region("gfx4")->base();
18   UINT8 *bg_map = machine.root_device().memregion("gfx4")->base();
1919   int tile;
2020
2121   tile = bg_map[tile_index << 1] + (bg_map[(tile_index << 1) + 1] << 8);
src/mame/video/espial.c
r14976r14977
3131
3232PALETTE_INIT( espial )
3333{
34   const UINT8 *color_prom = machine.region("proms")->base();
34   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3535   int i;
3636
3737   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/hyperspt.c
r14976r14977
3131
3232PALETTE_INIT( hyperspt )
3333{
34   const UINT8 *color_prom = machine.region("proms")->base();
34   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3535   static const int resistances_rg[3] = { 1000, 470, 220 };
3636   static const int resistances_b[2] = { 470, 220 };
3737   double rweights[3], gweights[3], bweights[2];
src/mame/video/segag80r.c
r14976r14977
153153static TILE_GET_INFO( spaceod_get_tile_info )
154154{
155155   segag80r_state *state = machine.driver_data<segag80r_state>();
156   int code = machine.region("gfx2")->base()[tile_index + 0x1000 * (state->m_spaceod_bg_control >> 6)];
156   int code = state->memregion("gfx2")->base()[tile_index + 0x1000 * (state->m_spaceod_bg_control >> 6)];
157157   SET_TILE_INFO(1, code + 0x100 * ((state->m_spaceod_bg_control >> 2) & 1), 0, 0);
158158}
159159
r14976r14977
169169static TILE_GET_INFO( bg_get_tile_info )
170170{
171171   segag80r_state *state = machine.driver_data<segag80r_state>();
172   int code = machine.region("gfx2")->base()[tile_index];
172   int code = state->memregion("gfx2")->base()[tile_index];
173173   SET_TILE_INFO(1, code + 0x100 * state->m_bg_char_bank, code >> 4, 0);
174174}
175175
r14976r14977
216216
217217      /* background tilemap is effectively 1 screen x n screens */
218218      case G80_BACKGROUND_MONSTERB:
219         state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows,  8,8, 32,machine.region("gfx2")->bytes() / 32);
219         state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows,  8,8, 32,machine.root_device().memregion("gfx2")->bytes() / 32);
220220         break;
221221
222222      /* background tilemap is effectively 4 screens x n screens */
223223      case G80_BACKGROUND_PIGNEWT:
224224      case G80_BACKGROUND_SINDBADM:
225         state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows,  8,8, 128,machine.region("gfx2")->bytes() / 128);
225         state->m_bg_tilemap = tilemap_create(machine, bg_get_tile_info, tilemap_scan_rows,  8,8, 128,machine.root_device().memregion("gfx2")->bytes() / 128);
226226         break;
227227   }
228228
src/mame/video/hnayayoi.c
r14976r14977
130130
131131WRITE8_MEMBER(hnayayoi_state::dynax_blitter_rev1_start_w)
132132{
133   UINT8 *rom = machine().region("gfx1")->base();
134   int romlen = machine().region("gfx1")->bytes();
133   UINT8 *rom = memregion("gfx1")->base();
134   int romlen = memregion("gfx1")->bytes();
135135   int sx = m_blit_dest & 0xff;
136136   int sy = m_blit_dest >> 8;
137137   int x, y;
src/mame/video/tmnt.c
r14976r14977
55static TILE_GET_INFO( glfgreat_get_roz_tile_info )
66{
77   tmnt_state *state = machine.driver_data<tmnt_state>();
8   UINT8 *rom = machine.region("user1")->base();
8   UINT8 *rom = state->memregion("user1")->base();
99   int code;
1010
1111   tile_index += 0x40000 * state->m_glfgreat_roz_rom_bank;
r14976r14977
1717
1818static TILE_GET_INFO( prmrsocr_get_roz_tile_info )
1919{
20   UINT8 *rom = machine.region("user1")->base();
20   UINT8 *rom = machine.root_device().memregion("user1")->base();
2121   int code = rom[tile_index + 0x20000] + 256 * rom[tile_index];
2222
2323   SET_TILE_INFO(0, code & 0x1fff, code >> 13, 0);
r14976r14977
416416{
417417
418418   if (m_glfgreat_roz_rom_mode)
419      return machine().region("gfx3")->base()[m_glfgreat_roz_char_bank * 0x80000 + offset];
419      return memregion("gfx3")->base()[m_glfgreat_roz_char_bank * 0x80000 + offset];
420420   else if (offset < 0x40000)
421421   {
422      UINT8 *usr = machine().region("user1")->base();
422      UINT8 *usr = memregion("user1")->base();
423423      return usr[offset + 0x80000 + m_glfgreat_roz_rom_bank * 0x40000] + 256 * usr[offset + m_glfgreat_roz_rom_bank * 0x40000];
424424   }
425425   else
426      return machine().region("user1")->base()[((offset & 0x3ffff) >> 2) + 0x100000 + m_glfgreat_roz_rom_bank * 0x10000];
426      return memregion("user1")->base()[((offset & 0x3ffff) >> 2) + 0x100000 + m_glfgreat_roz_rom_bank * 0x10000];
427427}
428428
429429WRITE16_MEMBER(tmnt_state::glfgreat_122000_w)
r14976r14977
522522{
523523
524524   if(m_glfgreat_roz_char_bank)
525      return machine().region("gfx3")->base()[offset];
525      return memregion("gfx3")->base()[offset];
526526   else
527527   {
528      UINT8 *usr = machine().region("user1")->base();
528      UINT8 *usr = memregion("user1")->base();
529529      return 256 * usr[offset] + usr[offset + 0x020000];
530530   }
531531}
src/mame/video/zodiack.c
r14976r14977
4848
4949PALETTE_INIT( zodiack )
5050{
51   const UINT8 *color_prom = machine.region("proms")->base();
51   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5252   int i;
5353
5454   /* allocate the colortable */
src/mame/video/pitnrun.c
r14976r14977
100100{
101101   pitnrun_state *state = machine.driver_data<pitnrun_state>();
102102   int x,y,i,b,datapix;
103   UINT8 *ROM = machine.region("user1")->base();
103   UINT8 *ROM = state->memregion("user1")->base();
104104   for(i=0;i<4;i++)
105105    for(y=0;y<128;y++)
106106     for(x=0;x<16;x++)
r14976r14977
117117
118118PALETTE_INIT (pitnrun)
119119{
120   const UINT8 *color_prom = machine.region("proms")->base();
120   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
121121   int i;
122122   int bit0,bit1,bit2,r,g,b;
123123   for (i = 0;i < 32*3; i++)
r14976r14977
219219#ifdef MAME_DEBUG
220220   if (screen.machine().input().code_pressed_once(KEYCODE_Q))
221221   {
222      UINT8 *ROM = screen.machine().region("maincpu")->base();
222      UINT8 *ROM = state->memregion("maincpu")->base();
223223      ROM[0x84f6]=0; /* lap 0 - normal */
224224   }
225225
226226   if (screen.machine().input().code_pressed_once(KEYCODE_W))
227227   {
228      UINT8 *ROM = screen.machine().region("maincpu")->base();
228      UINT8 *ROM = screen.machine().root_device().memregion("maincpu")->base();
229229      ROM[0x84f6]=6; /* lap 6 = spotlight */
230230   }
231231
232232   if (screen.machine().input().code_pressed_once(KEYCODE_E))
233233   {
234      UINT8 *ROM = screen.machine().region("maincpu")->base();
234      UINT8 *ROM = screen.machine().root_device().memregion("maincpu")->base();
235235      ROM[0x84f6]=2; /* lap 3 (trial 2)= lightnings */
236236      ROM[0x8102]=1;
237237   }
src/mame/video/segaic16.c
r14976r14977
14121412static void segaic16_road_hangon_decode(running_machine &machine, struct road_info *info)
14131413{
14141414   int x, y;
1415   const UINT8 *gfx = machine.region("gfx3")->base();
1416   int len = machine.region("gfx3")->bytes();
1415   const UINT8 *gfx = machine.root_device().memregion("gfx3")->base();
1416   int len = machine.root_device().memregion("gfx3")->bytes();
14171417
14181418   /* allocate memory for the unpacked road data */
14191419   info->gfx = auto_alloc_array(machine, UINT8, 256 * 512);
r14976r14977
16731673static void segaic16_road_outrun_decode(running_machine &machine, struct road_info *info)
16741674{
16751675   int x, y;
1676   const UINT8 *gfx = machine.region("gfx3")->base();
1677   int len = machine.region("gfx3")->bytes();
1676   const UINT8 *gfx = machine.root_device().memregion("gfx3")->base();
1677   int len = machine.root_device().memregion("gfx3")->bytes();
16781678
16791679   /* allocate memory for the unpacked road data */
16801680   info->gfx = auto_alloc_array(machine, UINT8, (256 * 2 + 1) * 512);
src/mame/video/liberatr.c
r14976r14977
6868{
6969   UINT16 longitude;
7070
71   const UINT8 *latitude_scale = machine().region("user1")->base();
72   const UINT8 *longitude_scale = machine().region("user2")->base();
71   const UINT8 *latitude_scale = memregion("user1")->base();
72   const UINT8 *longitude_scale = memregion("user2")->base();
7373
7474   /* for each starting longitude */
7575   for (longitude = 0; longitude < 0x100; longitude++)
r14976r14977
212212void liberatr_state::video_start()
213213{
214214   // for each planet in the planet ROMs
215   init_planet(m_planets[0], &machine().region("gfx1")->base()[0x2000]);
216   init_planet(m_planets[1], &machine().region("gfx1")->base()[0x0000]);
215   init_planet(m_planets[0], &machine().root_device().memregion("gfx1")->base()[0x2000]);
216   init_planet(m_planets[1], &machine().root_device().memregion("gfx1")->base()[0x0000]);
217217}
218218
219219
src/mame/video/citycon.c
r14976r14977
3535static TILE_GET_INFO( get_bg_tile_info )
3636{
3737   citycon_state *state = machine.driver_data<citycon_state>();
38   UINT8 *rom = machine.region("gfx4")->base();
38   UINT8 *rom = state->memregion("gfx4")->base();
3939   int code = rom[0x1000 * state->m_bg_image + tile_index];
4040   SET_TILE_INFO(
4141         3 + state->m_bg_image,
src/mame/video/suprridr.c
r14976r14977
5757
5858PALETTE_INIT( suprridr )
5959{
60   const UINT8 *color_prom = machine.region("proms")->base();
60   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6161   int i;
6262
6363   for (i = 0; i < 96; i++)
src/mame/video/psikyo.c
r14976r14977
269269   static const int pri[] = { 0, 0xfc, 0xff, 0xff };
270270   int offs;
271271   UINT16 *spritelist = (UINT16 *)(state->m_spritebuf2 + 0x1800 / 4);
272   UINT8 *TILES = machine.region("spritelut")->base();   // Sprites LUT
273   int TILES_LEN = machine.region("spritelut")->bytes();
272   UINT8 *TILES = machine.root_device().memregion("spritelut")->base();   // Sprites LUT
273   int TILES_LEN = machine.root_device().memregion("spritelut")->bytes();
274274
275275   int width = machine.primary_screen->width();
276276   int height = machine.primary_screen->height();
r14976r14977
388388   static const int pri[] = { 0, 0xfc, 0xff, 0xff };
389389   int offs;
390390   UINT16 *spritelist = (UINT16 *)(state->m_spritebuf2 + 0x1800 / 4);
391   UINT8 *TILES = machine.region("spritelut")->base();   // Sprites LUT
392   int TILES_LEN = machine.region("spritelut")->bytes();
391   UINT8 *TILES = machine.root_device().memregion("spritelut")->base();   // Sprites LUT
392   int TILES_LEN = machine.root_device().memregion("spritelut")->bytes();
393393
394394   int width = machine.primary_screen->width();
395395   int height = machine.primary_screen->height();
src/mame/video/ampoker2.c
r14976r14977
7373
7474PALETTE_INIT( ampoker2 )
7575{
76   const UINT8 *color_prom = machine.region("proms")->base();
76   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7777/*    - bits -
7878      76543210
7979      RRRGGGBB
src/mame/video/pgm.c
r14976r14977
620620   pgm_state *state = machine.driver_data<pgm_state>();
621621   int i;
622622
623   state->m_bdata = machine.region("sprmask")->base();
624   state->m_bdatasize = machine.region("sprmask")->bytes() - 1;
623   state->m_bdata = machine.root_device().memregion("sprmask")->base();
624   state->m_bdatasize = state->memregion("sprmask")->bytes() - 1;
625625   state->m_aoffset = 0;
626626   state->m_boffset = 0;
627627
src/mame/video/capbowl.c
r14976r14977
115115
116116READ8_MEMBER(capbowl_state::bowlrama_blitter_r)
117117{
118   UINT8 data = machine().region("gfx1")->base()[m_blitter_addr];
118   UINT8 data = memregion("gfx1")->base()[m_blitter_addr];
119119   UINT8 result = 0;
120120
121121   switch (offset)
src/mame/video/ikki.c
r14976r14977
1313
1414PALETTE_INIT( ikki )
1515{
16   const UINT8 *color_prom = machine.region("proms")->base();
16   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1717   ikki_state *state = machine.driver_data<ikki_state>();
1818   int i;
1919
r14976r14977
128128{
129129   ikki_state *state = screen.machine().driver_data<ikki_state>();
130130   offs_t offs;
131   UINT8 *VIDEOATTR = screen.machine().region("user1")->base();
131   UINT8 *VIDEOATTR = state->memregion("user1")->base();
132132
133133   /* draw bg layer */
134134
src/mame/video/st0016.c
r14976r14977
186186      UINT32 srcadr=(st0016_vregs[0xa0]|(st0016_vregs[0xa1]<<8)|(st0016_vregs[0xa2]<<16))<<1;
187187      UINT32 dstadr=(st0016_vregs[0xa3]|(st0016_vregs[0xa4]<<8)|(st0016_vregs[0xa5]<<16))<<1;
188188      UINT32 length=((st0016_vregs[0xa6]|(st0016_vregs[0xa7]<<8)|((st0016_vregs[0xa8]&0x1f)<<16))+1)<<1;
189      UINT32 srclen = (machine().region("maincpu")->bytes()-0x10000);
190      UINT8 *mem = machine().region("maincpu")->base();
189      UINT32 srclen = (machine().root_device().memregion("maincpu")->bytes()-0x10000);
190      UINT8 *mem = memregion("maincpu")->base();
191191
192192      srcadr += macs_cart_slot*0x400000;
193193
src/mame/video/sbasketb.c
r14976r14977
2828
2929PALETTE_INIT( sbasketb )
3030{
31   const UINT8 *color_prom = machine.region("proms")->base();
31   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3232   static const int resistances[4] = { 2000, 1000, 470, 220 };
3333   double rweights[4], gweights[4], bweights[4];
3434   int i;
src/mame/video/ksayakyu.c
r14976r14977
3232
3333PALETTE_INIT( ksayakyu )
3434{
35   const UINT8 *prom = machine.region("proms")->base();
35   const UINT8 *prom = machine.root_device().memregion("proms")->base();
3636   int r, g, b, i;
3737
3838   for (i = 0; i < 0x100; i++)
r14976r14977
4747
4848static TILE_GET_INFO( get_ksayakyu_tile_info )
4949{
50   int code = machine.region("user1")->base()[tile_index];
51   int attr = machine.region("user1")->base()[tile_index + 0x2000];
50   int code = machine.root_device().memregion("user1")->base()[tile_index];
51   int attr = machine.root_device().memregion("user1")->base()[tile_index + 0x2000];
5252   code += (attr & 3) << 8;
5353   SET_TILE_INFO(1, code, ((attr >> 2) & 0x0f) * 2, (attr & 0x80) ? TILE_FLIPX : 0);
5454}
src/mame/video/atarirle.c
r14976r14977
273273   atarirle_data *mo = get_safe_token(device);
274274   running_machine &machine = device->machine();
275275   const atarirle_desc *desc = (const atarirle_desc *)device->static_config();
276   const UINT16 *base = (const UINT16 *)machine.region(desc->region)->base();
276   const UINT16 *base = (const UINT16 *)machine.root_device().memregion(desc->region)->base();
277277   int i, width, height;
278278
279279   /* build and allocate the generic tables */
r14976r14977
303303   mo->maxcolors     = desc->maxcolors / 16;
304304
305305   mo->rombase       = base;
306   mo->romlength     = machine.region(desc->region)->bytes();
306   mo->romlength     = machine.root_device().memregion(desc->region)->bytes();
307307   mo->objectcount   = count_objects(base, mo->romlength);
308308
309309   mo->cliprect      = machine.primary_screen->visible_area();
src/mame/video/ironhors.c
r14976r14977
1818
1919PALETTE_INIT( ironhors )
2020{
21   const UINT8 *color_prom = machine.region("proms")->base();
21   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2222   static const int resistances[4] = { 2000, 1000, 470, 220 };
2323   double rweights[4], gweights[4], bweights[4];
2424   int i;
src/mame/video/epos.c
r14976r14977
2525static void get_pens( running_machine &machine, pen_t *pens )
2626{
2727   offs_t i;
28   const UINT8 *prom = machine.region("proms")->base();
29   int len = machine.region("proms")->bytes();
28   const UINT8 *prom = machine.root_device().memregion("proms")->base();
29   int len = machine.root_device().memregion("proms")->bytes();
3030
3131   for (i = 0; i < len; i++)
3232   {
src/mame/video/glass.c
r14976r14977
8484      /* fill the screen bitmap with the current picture */
8585      {
8686         int i, j;
87         UINT8 *gfx = (UINT8 *)machine().region("gfx3")->base();
87         UINT8 *gfx = (UINT8 *)machine().root_device().memregion("gfx3")->base();
8888
8989         gfx = gfx + (m_current_command & 0x07) * 0x10000 + (m_current_command & 0x08) * 0x10000 + 0x140;
9090
src/mame/video/mcatadv.c
r14976r14977
6060
6161   UINT16 *destline;
6262   UINT8 *priline;
63   UINT8 *sprdata = machine.region("gfx1")->base();
64   int sprmask = machine.region("gfx1")->bytes()-1;
63   UINT8 *sprdata = machine.root_device().memregion("gfx1")->base();
64   int sprmask = state->memregion("gfx1")->bytes()-1;
6565
6666   int xstart, xend, xinc;
6767   int ystart, yend, yinc;
src/mame/video/mjkjidai.c
r14976r14977
4949
5050WRITE8_MEMBER(mjkjidai_state::mjkjidai_ctrl_w)
5151{
52   UINT8 *rom = machine().region("maincpu")->base();
52   UINT8 *rom = memregion("maincpu")->base();
5353
5454//  logerror("%04x: port c0 = %02x\n",cpu_get_pc(&space.device()),data);
5555
r14976r14977
6868   /* bits 6-7 select ROM bank */
6969   if (data & 0xc0)
7070   {
71      memory_set_bankptr(machine(), "bank1",rom + 0x10000-0x4000 + ((data & 0xc0) << 8));
71      membank("bank1")->set_base(rom + 0x10000-0x4000 + ((data & 0xc0) << 8));
7272   }
7373   else
7474   {
7575      /* there is code flowing from 7fff to this bank so they have to be contiguous in memory */
76      memory_set_bankptr(machine(), "bank1",rom + 0x08000);
76      membank("bank1")->set_base(rom + 0x08000);
7777   }
7878}
7979
src/mame/video/jailbrek.c
r14976r14977
33
44PALETTE_INIT( jailbrek )
55{
6   const UINT8 *color_prom = machine.region("proms")->base();
6   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
77   int i;
88
99   /* allocate the colortable */
src/mame/video/wecleman.c
r14976r14977
7777{
7878   wecleman_state *state = machine.driver_data<wecleman_state>();
7979   const pen_t *base_pal = machine.pens;
80   UINT8 *base_gfx = machine.region("gfx1")->base();
81   int gfx_max     = machine.region("gfx1")->bytes();
80   UINT8 *base_gfx = machine.root_device().memregion("gfx1")->base();
81   int gfx_max     = state->memregion("gfx1")->bytes();
8282
8383   UINT16 *source = state->m_spriteram;
8484
src/mame/video/bankp.c
r14976r14977
3535
3636PALETTE_INIT( bankp )
3737{
38   const UINT8 *color_prom = machine.region("proms")->base();
38   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3939   int i;
4040
4141   /* allocate the colortable */
src/mame/video/crbaloon.c
r14976r14977
101101   UINT8 color = state->m_spriteram[0] >> 4;
102102   UINT8 sy = state->m_spriteram[2] - 32;
103103
104   UINT8 *gfx = machine.region("gfx2")->base() + (code << 7);
104   UINT8 *gfx = state->memregion("gfx2")->base() + (code << 7);
105105
106106
107107   if (state->flip_screen())
src/mame/video/pastelg.c
r14976r14977
2121******************************************************************************/
2222PALETTE_INIT( pastelg )
2323{
24   const UINT8 *color_prom = machine.region("proms")->base();
24   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2525   int i;
2626   int bit0, bit1, bit2, bit3, r, g, b;
2727
r14976r14977
100100
101101READ8_MEMBER(pastelg_state::threeds_rom_readback_r)
102102{
103   UINT8 *GFX = machine().region("gfx1")->base();
103   UINT8 *GFX = memregion("gfx1")->base();
104104
105105   return GFX[(m_blitter_src_addr | (m_gfxrom << 16)) & 0x3ffff];
106106}
r14976r14977
108108
109109WRITE8_MEMBER(pastelg_state::pastelg_romsel_w)
110110{
111   int gfxlen = machine().region("gfx1")->bytes();
111   int gfxlen = memregion("gfx1")->bytes();
112112   m_gfxrom = ((data & 0xc0) >> 6);
113113   m_palbank = ((data & 0x10) >> 4);
114114   nb1413m3_sndrombank1_w(&space, 0, data);
r14976r14977
158158static void pastelg_gfxdraw(running_machine &machine)
159159{
160160   pastelg_state *state = machine.driver_data<pastelg_state>();
161   UINT8 *GFX = machine.region("gfx1")->base();
161   UINT8 *GFX = state->memregion("gfx1")->base();
162162   int width = machine.primary_screen->width();
163163
164164   int x, y;
r14976r14977
202202      incy = -1;
203203   }
204204
205   gfxlen = machine.region("gfx1")->bytes();
205   gfxlen = machine.root_device().memregion("gfx1")->bytes();
206206   gfxaddr = (state->m_gfxrom << 16) + state->m_blitter_src_addr;
207207
208208   readflag = 0;
src/mame/video/portrait.c
r14976r14977
7777
7878PALETTE_INIT( portrait )
7979{
80   const UINT8 *color_prom = machine.region("proms")->base();
80   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8181   int i;
82   UINT8* lookup = machine.region("tileattr")->base();
82   UINT8* lookup = machine.root_device().memregion("tileattr")->base();
8383
8484   /* allocate the colortable */
8585   machine.colortable = colortable_alloc(machine, 0x40);
src/mame/video/bosco.c
r14976r14977
1616
1717PALETTE_INIT( bosco )
1818{
19   const UINT8 *color_prom = machine.region("proms")->base();
19   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2020   int i;
2121
2222   machine.colortable = colortable_alloc(machine, 32+64);
src/mame/video/munchmo.c
r14976r14977
44
55PALETTE_INIT( mnchmobl )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99
1010   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
8282    the tiles in ROM B2.2B
8383*/
8484   munchmo_state *state = machine.driver_data<munchmo_state>();
85   UINT8 *rom = machine.region("gfx2")->base();
85   UINT8 *rom = state->memregion("gfx2")->base();
8686   const gfx_element *gfx = machine.gfx[1];
8787   int offs;
8888
src/mame/video/funkybee.c
r14976r14977
1111
1212PALETTE_INIT( funkybee )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   int i;
1616
1717   /* first, the character/sprite palette */
src/mame/video/galastrm.c
r14976r14977
9090{
9191   galastrm_state *state = machine.driver_data<galastrm_state>();
9292   UINT32 *spriteram32 = state->m_spriteram;
93   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
93   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
9494   int offs, data, tilenum, color, flipx, flipy;
9595   int x, y, priority, dblsize, curx, cury;
9696   int sprites_flipscreen = 0;
src/mame/video/alpha68k.c
r14976r14977
342342   alpha68k_state *state = machine.driver_data<alpha68k_state>();
343343   UINT16 *spriteram = state->m_spriteram;
344344   int data, offs, mx, my, tile, color, fy, i;
345   UINT8 *color_prom = machine.region("user1")->base();
345   UINT8 *color_prom = state->memregion("user1")->base();
346346   gfx_element *gfx = machine.gfx[0];
347347
348348   for (offs = 0; offs < 0x400; offs += 0x20)
r14976r14977
383383
384384PALETTE_INIT( kyros )
385385{
386   const UINT8 *color_prom = machine.region("proms")->base();
386   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
387387   int i;
388388
389389   /* allocate the colortable */
r14976r14977
411411
412412PALETTE_INIT( paddlem )
413413{
414   const UINT8 *color_prom = machine.region("proms")->base();
414   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
415415   int i;
416416
417417   /* allocate the colortable */
r14976r14977
453453   UINT16 *spriteram = state->m_spriteram;
454454   int offs, mx, my, color, tile, i, bank, fy, fx;
455455   int data;
456   UINT8 *color_prom = machine.region("user1")->base();
456   UINT8 *color_prom = state->memregion("user1")->base();
457457
458458//AT
459459   for (offs = 0; offs < 0x400; offs += 0x20)
src/mame/video/namcos22.c
r14976r14977
861861   }
862862   else
863863   { /* system 22 */
864      const UINT8 *rlut = 0x000+(const UINT8 *)machine.region("user1")->base();
864      const UINT8 *rlut = 0x000+(const UINT8 *)machine.root_device().memregion("user1")->base();
865865      const UINT8 *glut = 0x100+rlut;
866866      const UINT8 *blut = 0x200+rlut;
867867      for( y=0; y<bitmap.height(); y++ )
r14976r14977
27412741   for (code = 0; code < machine.gfx[GFX_TEXTURE_TILE]->total_elements; code++)
27422742      gfx_element_decode(machine.gfx[GFX_TEXTURE_TILE], code);
27432743
2744   Prepare3dTexture(machine, machine.region("textilemap")->base(), machine.gfx[GFX_TEXTURE_TILE]->gfxdata );
2744   Prepare3dTexture(machine, machine.root_device().memregion("textilemap")->base(), machine.gfx[GFX_TEXTURE_TILE]->gfxdata );
27452745   state->m_dirtypal = auto_alloc_array(machine, UINT8, NAMCOS22_PALETTE_SIZE/4);
2746   state->m_mPtRomSize = machine.region("pointrom")->bytes()/3;
2747   state->m_mpPolyL = machine.region("pointrom")->base();
2746   state->m_mPtRomSize = machine.root_device().memregion("pointrom")->bytes()/3;
2747   state->m_mpPolyL = state->memregion("pointrom")->base();
27482748   state->m_mpPolyM = state->m_mpPolyL + state->m_mPtRomSize;
27492749   state->m_mpPolyH = state->m_mpPolyM + state->m_mPtRomSize;
27502750
src/mame/video/redclash.c
r14976r14977
2020
2121PALETTE_INIT( redclash )
2222{
23   const UINT8 *color_prom = machine.region("proms")->base();
23   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2424   int i;
2525
2626   /* allocate the colortable */
src/mame/video/vicdual.c
r14976r14977
8282SCREEN_UPDATE_RGB32( vicdual_color )
8383{
8484   vicdual_state *state = screen.machine().driver_data<vicdual_state>();
85   UINT8 *color_prom = (UINT8 *)screen.machine().region("proms")->base();
85   UINT8 *color_prom = (UINT8 *)state->memregion("proms")->base();
8686   UINT8 x = 0;
8787   UINT8 y = cliprect.min_y;
8888   UINT8 video_data = 0;
src/mame/video/galaxold.c
r14976r14977
77#include "emu.h"
88#include "includes/galaxold.h"
99
10#define STARS_COLOR_BASE      (machine.region("proms")->bytes())
10#define STARS_COLOR_BASE      (machine.root_device().memregion("proms")->bytes())
1111#define BULLETS_COLOR_BASE      (STARS_COLOR_BASE + 64)
1212#define BACKGROUND_COLOR_BASE   (BULLETS_COLOR_BASE + 2)
1313
r14976r14977
9494***************************************************************************/
9595PALETTE_INIT( galaxold )
9696{
97   const UINT8 *color_prom = machine.region("proms")->base();
97   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9898   int i, len;
9999
100100
101101   /* first, the character/sprite palette */
102   len = machine.region("proms")->bytes();
102   len = machine.root_device().memregion("proms")->bytes();
103103   for (i = 0;i < len;i++)
104104   {
105105      int bit0,bit1,bit2,r,g,b;
r14976r14977
169169
170170PALETTE_INIT( rockclim )
171171{
172   const UINT8 *color_prom = machine.region("proms")->base();
172   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
173173   int i, len;
174174
175175
176176   /* first, the character/sprite palette */
177   len = machine.region("proms")->bytes();
177   len = machine.root_device().memregion("proms")->bytes();
178178   for (i = 0;i < len;i++)
179179   {
180180      int bit0,bit1,bit2,r,g,b;
r14976r14977
218218***************************************************************************/
219219PALETTE_INIT( darkplnt )
220220{
221   const UINT8 *color_prom = machine.region("proms")->base();
221   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
222222   int i;
223223
224224
r14976r14977
338338/* swapped r/g/b hook-up */
339339PALETTE_INIT( dambustr )
340340{
341   const UINT8 *color_prom = machine.region("proms")->base();
341   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
342342   int base = BACKGROUND_COLOR_BASE;
343343   int i, len;
344344
345345   /* first, the character/sprite palette */
346   len = machine.region("proms")->bytes();
346   len = machine.root_device().memregion("proms")->bytes();
347347
348348   for (i = 0;i < len;i++)
349349   {
r14976r14977
10431043
10441044   /* bit 0 of the PROM controls character banking */
10451045
1046   prom = machine.region("user2")->base();
1046   prom = machine.root_device().memregion("user2")->base();
10471047
10481048   *code |= ((prom[x] & 0x01) << 8);
10491049}
r14976r14977
12301230                 the green gun if BCG is asserted
12311231       bits 2-7 are unconnected */
12321232
1233   prom = machine.region("user1")->base();
1233   prom = state->memregion("user1")->base();
12341234
12351235   for (x = 0; x < 32; x++)
12361236   {
r14976r14977
13051305       line (column) of the screen.  The first 0x20 bytes for unflipped,
13061306       and the 2nd 0x20 bytes for flipped screen. */
13071307
1308   prom = machine.region("user1")->base();
1308   prom = state->memregion("user1")->base();
13091309
13101310   if (state->m_flipscreen_x)
13111311   {
r14976r14977
16061606
16071607   /* bit 2 of the PROM controls star visibility */
16081608
1609   prom = machine.region("user2")->base();
1609   prom = machine.root_device().memregion("user2")->base();
16101610
16111611   for (offs = 0;offs < STAR_COUNT;offs++)
16121612   {
src/mame/video/centiped.c
r14976r14977
290290
291291PALETTE_INIT( warlords )
292292{
293   const UINT8 *color_prom = machine.region("proms")->base();
293   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
294294   int i;
295295
296296   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
415415   m_generic_paletteram_8[offset] = data;
416416
417417   /* the value passed in is a look-up index into the color PROM */
418   melliped_mazeinv_set_color(machine(), offset, ~machine().region("proms")->base()[~data & 0x0f]);
418   melliped_mazeinv_set_color(machine(), offset, ~machine().root_device().memregion("proms")->base()[~data & 0x0f]);
419419}
420420
421421
src/mame/video/atarisy1.c
r14976r14977
557557static void decode_gfx(running_machine &machine, UINT16 *pflookup, UINT16 *molookup)
558558{
559559   atarisy1_state *state = machine.driver_data<atarisy1_state>();
560   UINT8 *prom1 = &machine.region("proms")->u8(0x000);
561   UINT8 *prom2 = &machine.region("proms")->u8(0x200);
560   UINT8 *prom1 = &machine.root_device().memregion("proms")->u8(0x000);
561   UINT8 *prom2 = &state->memregion("proms")->u8(0x200);
562562   int obj, i;
563563
564564   /* reset the globals */
r14976r14977
649649      return state->m_bank_gfx[bpp - 4][bank_index];
650650
651651   /* if the bank is out of range, call it 0 */
652   const memory_region *tiles = machine.region("tiles");
652   memory_region *tiles = machine.root_device().memregion("tiles");
653653   if (0x80000 * (bank_index - 1) >= tiles->bytes())
654654      return 0;
655655
src/mame/video/tceptor.c
r14976r14977
2020
2121PALETTE_INIT( tceptor )
2222{
23   const UINT8 *color_prom = machine.region("proms")->base();
23   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2424   tceptor_state *state = machine.driver_data<tceptor_state>();
2525   int i;
2626
r14976r14977
243243   };
244244
245245   int gfx_index = state->m_bg;
246   UINT8 *src = machine.region(region)->base() + 0x8000;
246   UINT8 *src = machine.root_device().memregion(region)->base() + 0x8000;
247247   UINT8 *buffer;
248248   int len = 0x8000;
249249   int i;
r14976r14977
261261   auto_free(machine, buffer);
262262
263263   /* decode the graphics */
264   machine.gfx[gfx_index] = gfx_element_alloc(machine, &bg_layout, machine.region(region)->base(), 64, 2048);
264   machine.gfx[gfx_index] = gfx_element_alloc(machine, &bg_layout, machine.root_device().memregion(region)->base(), 64, 2048);
265265}
266266
267267static void decode_sprite(running_machine &machine, int gfx_index, const gfx_layout *layout, const void *data)
r14976r14977
291291      2*16*16
292292   };
293293
294   UINT8 *src = machine.region(region)->base();
295   int len = machine.region(region)->bytes();
294   UINT8 *src = machine.root_device().memregion(region)->base();
295   int len = machine.root_device().memregion(region)->bytes();
296296   UINT8 *dst;
297297   int i, y;
298298
r14976r14977
343343      2*32*32
344344   };
345345
346   UINT8 *src = machine.region(region)->base();
347   int len = machine.region(region)->bytes();
346   UINT8 *src = machine.root_device().memregion(region)->base();
347   int len = machine.root_device().memregion(region)->bytes();
348348   int total = spr32_layout.total;
349349   int size = spr32_layout.charincrement / 8;
350350   UINT8 *dst;
src/mame/video/cop01.c
r14976r14977
1212
1313PALETTE_INIT( cop01 )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
src/mame/video/hanaawas.c
r14976r14977
1717
1818PALETTE_INIT( hanaawas )
1919{
20   const UINT8 *color_prom = machine.region("proms")->base();
20   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2121   int i;
2222
2323   /* allocate the colortable */
src/mame/video/metro.c
r14976r14977
273273
274274static void expand_gfx1(metro_state &state)
275275{
276   UINT8 *base_gfx = state.machine().region("gfx1")->base();
277   UINT32 length = 2 * state.machine().region("gfx1")->bytes();
276   UINT8 *base_gfx = state.machine().root_device().memregion("gfx1")->base();
277   UINT32 length = 2 * state.machine().root_device().memregion("gfx1")->bytes();
278278   state.m_expanded_gfx1 = auto_alloc_array(state.machine(), UINT8, length);
279279   for (int i = 0; i < length; i += 2)
280280   {
r14976r14977
446446{
447447   metro_state *state = machine.driver_data<metro_state>();
448448   UINT8 *base_gfx4 = state->m_expanded_gfx1;
449   UINT8 *base_gfx8 = machine.region("gfx1")->base();
450   UINT32 gfx_size = machine.region("gfx1")->bytes();
449   UINT8 *base_gfx8 = machine.root_device().memregion("gfx1")->base();
450   UINT32 gfx_size = state->memregion("gfx1")->bytes();
451451   const rectangle &visarea = machine.primary_screen->visible_area();
452452
453453   int max_x = visarea.max_x + 1;
src/mame/video/circusc.c
r14976r14977
3232
3333PALETTE_INIT( circusc )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   static const int resistances_rg[3] = { 1000, 470, 220 };
3737   static const int resistances_b [2] = { 470, 220 };
3838   double rweights[3], gweights[3], bweights[2];
src/mame/video/mikie.c
r14976r14977
2828
2929PALETTE_INIT( mikie )
3030{
31   const UINT8 *color_prom = machine.region("proms")->base();
31   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3232   static const int resistances[4] = { 2200, 1000, 470, 220 };
3333   double rweights[4], gweights[4], bweights[4];
3434   int i;
src/mame/video/zaccaria.c
r14976r14977
3535***************************************************************************/
3636PALETTE_INIT( zaccaria )
3737{
38   const UINT8 *color_prom = machine.region("proms")->base();
38   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3939   int i, j, k;
4040   static const int resistances_rg[] = { 1200, 1000, 820 };
4141   static const int resistances_b[]  = { 1000, 820 };
src/mame/video/tagteam.c
r14976r14977
3434
3535PALETTE_INIT( tagteam )
3636{
37   const UINT8 *color_prom = machine.region("proms")->base();
37   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3838   rgb_t *rgb;
3939
4040   rgb = compute_res_net_all(machine, color_prom, &tagteam_decode_info, &tagteam_net_info);
src/mame/video/bagman.c
r14976r14977
4444***************************************************************************/
4545PALETTE_INIT( bagman )
4646{
47   const UINT8 *color_prom = machine.region("proms")->base();
47   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4848   int i;
4949   static const int resistances_rg[3] = { 1000, 470, 220 };
5050   static const int resistances_b [2] = { 470, 220 };
src/mame/video/spacefb.c
r14976r14977
209209{
210210   spacefb_state *state = machine.driver_data<spacefb_state>();
211211   static const double fade_weights[] = { 1.0, 1.5, 2.5, 4.0 };
212   const UINT8 *prom = machine.region("proms")->base();
212   const UINT8 *prom = machine.root_device().memregion("proms")->base();
213213   int i;
214214
215215   for (i = 0; i < NUM_SPRITE_PENS; i++)
r14976r14977
251251   spacefb_state *state = machine.driver_data<spacefb_state>();
252252   UINT8 sy;
253253
254   UINT8 *gfx = machine.region("gfx2")->base();
254   UINT8 *gfx = state->memregion("gfx2")->base();
255255
256256   UINT8 code = state->m_videoram[offs + 0x0200] & 0x3f;
257257   UINT8 y = ~state->m_videoram[offs + 0x0100] - 2;
r14976r14977
303303   spacefb_state *state = machine.driver_data<spacefb_state>();
304304   UINT8 sy;
305305
306   UINT8 *gfx = machine.region("gfx1")->base();
306   UINT8 *gfx = state->memregion("gfx1")->base();
307307
308308   UINT8 code = ~state->m_videoram[offs + 0x0200];
309309   UINT8 color_base = (~state->m_videoram[offs + 0x0300] & 0x0f) << 2;
src/mame/video/m52.c
r14976r14977
1919
2020PALETTE_INIT( m52 )
2121{
22   const UINT8 *color_prom = machine.region("proms")->base();
22   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2323   const UINT8 *char_pal = color_prom + 0x000;
2424   const UINT8 *back_pal = color_prom + 0x200;
2525   const UINT8 *sprite_pal = color_prom + 0x220;
src/mame/video/bfm_adr2.c
r14976r14977
186186   adder2_data_to_sc2       = 0;
187187
188188   {
189      UINT8 *rom = machine.region("adder2")->base();
189      UINT8 *rom = machine.root_device().memregion("adder2")->base();
190190
191      memory_configure_bank(machine, "bank2", 0, 4, &rom[0x00000], 0x08000);
191      machine.root_device().membank("bank2")->configure_entries(0, 4, &rom[0x00000], 0x08000);
192192
193      memory_set_bank(machine, "bank2",0&0x03);
193      machine.root_device().membank("bank2")->set_entry(0&0x03);
194194   }
195195}
196196
r14976r14977
323323
324324static WRITE8_HANDLER( adder2_rom_page_w )
325325{
326   memory_set_bank(space->machine(), "bank2",data&0x03);
326   space->machine().root_device().membank("bank2")->set_entry(data&0x03);
327327}
328328
329329///////////////////////////////////////////////////////////////////////////
r14976r14977
452452{
453453   UINT8 *p;
454454
455   p = machine.region("gfx1")->base();
455   p = machine.root_device().memregion("gfx1")->base();
456456
457457   if ( p )
458458   {
src/mame/video/ojankohs.c
r14976r14977
1919
2020PALETTE_INIT( ojankoy )
2121{
22   const UINT8 *color_prom = machine.region("proms")->base();
22   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2323   int i;
2424   int bit0, bit1, bit2, bit3, bit4, r, g, b;
2525
src/mame/video/n8080.c
r14976r14977
147147   int y;
148148
149149   const UINT8* pRAM = state->m_videoram;
150   const UINT8* pPROM = screen.machine().region("proms")->base();
150   const UINT8* pPROM = state->memregion("proms")->base();
151151
152152   for (y = 0; y < 256; y++)
153153   {
r14976r14977
213213   n8080_state *state = screen.machine().driver_data<n8080_state>();
214214   UINT8 mask = state->flip_screen() ? 0xff : 0x00;
215215
216   const UINT8* pPROM = screen.machine().region("proms")->base();
216   const UINT8* pPROM = state->memregion("proms")->base();
217217
218218   int x;
219219   int y;
src/mame/video/nbmj8891.c
r14976r14977
252252
253253WRITE8_MEMBER(nbmj8891_state::nbmj8891_romsel_w)
254254{
255   int gfxlen = machine().region("gfx1")->bytes();
255   int gfxlen = memregion("gfx1")->bytes();
256256   m_gfxrom = (data & 0x0f);
257257
258258   if ((0x20000 * m_gfxrom) > (gfxlen - 1))
r14976r14977
320320static void nbmj8891_gfxdraw(running_machine &machine)
321321{
322322   nbmj8891_state *state = machine.driver_data<nbmj8891_state>();
323   UINT8 *GFX = machine.region("gfx1")->base();
323   UINT8 *GFX = state->memregion("gfx1")->base();
324324   int width = machine.primary_screen->width();
325325
326326   int x, y;
r14976r14977
359359      skipy = -1;
360360   }
361361
362   gfxlen = machine.region("gfx1")->bytes();
362   gfxlen = machine.root_device().memregion("gfx1")->bytes();
363363   gfxaddr = (state->m_gfxrom << 17) + (state->m_blitter_src_addr << 1);
364364
365365   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
r14976r14977
472472VIDEO_START( nbmj8891_1layer )
473473{
474474   nbmj8891_state *state = machine.driver_data<nbmj8891_state>();
475   UINT8 *CLUT = machine.region("protection")->base();
475   UINT8 *CLUT = state->memregion("protection")->base();
476476   int i;
477477   int width = machine.primary_screen->width();
478478   int height = machine.primary_screen->height();
src/mame/video/kncljoe.c
r14976r14977
1616
1717PALETTE_INIT( kncljoe )
1818{
19   const UINT8 *color_prom = machine.region("proms")->base();
19   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2020   int i;
2121
2222   /* allocate the colortable */
r14976r14977
154154   if (m_sprite_bank != i)
155155   {
156156      m_sprite_bank = i;
157      memset(machine().region("maincpu")->base() + 0xf100, 0, 0x180);
157      memset(machine().root_device().memregion("maincpu")->base() + 0xf100, 0, 0x180);
158158   }
159159}
160160
src/mame/video/spdodgeb.c
r14976r14977
55
66PALETTE_INIT( spdodgeb )
77{
8   const UINT8 *color_prom = machine.region("proms")->base();
8   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
99   int i;
1010
1111
r14976r14977
108108
109109WRITE8_MEMBER(spdodgeb_state::spdodgeb_ctrl_w)
110110{
111   UINT8 *rom = machine().region("maincpu")->base();
111   UINT8 *rom = memregion("maincpu")->base();
112112
113113   /* bit 0 = flip screen */
114114   flip_screen_set(data & 0x01);
115115
116116   /* bit 1 = ROM bank switch */
117   memory_set_bankptr(machine(), "bank1",rom + 0x10000 + 0x4000 * ((~data & 0x02) >> 1));
117   membank("bank1")->set_base(rom + 0x10000 + 0x4000 * ((~data & 0x02) >> 1));
118118
119119   /* bit 2 = scroll high bit */
120120   m_lastscroll = (m_lastscroll & 0x0ff) | ((data & 0x04) << 6);
src/mame/video/liberate.c
r14976r14977
4040static TILE_GET_INFO( get_back_tile_info )
4141{
4242   liberate_state *state = machine.driver_data<liberate_state>();
43   const UINT8 *RAM = machine.region("user1")->base();
43   const UINT8 *RAM = state->memregion("user1")->base();
4444   int tile, bank;
4545
4646   /* Convert tile index of 512x512 to paged format */
r14976r14977
253253
254254PALETTE_INIT( liberate )
255255{
256   const UINT8 *color_prom = machine.region("proms")->base();
256   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
257257   int i, bit0, bit1, bit2, g, r, b;
258258
259259   for (i = 0;i < 32;i++)
src/mame/video/gunsmoke.c
r14976r14977
1818
1919PALETTE_INIT( gunsmoke )
2020{
21   const UINT8 *color_prom = machine.region("proms")->base();
21   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2222   int i;
2323
2424   /* allocate the colortable */
r14976r14977
7979   coin_counter_w(machine(), 0, data & 0x02);
8080
8181   /* bits 2 and 3 select the ROM bank */
82   memory_set_bank(machine(), "bank1", (data & 0x0c) >> 2);
82   membank("bank1")->set_entry((data & 0x0c) >> 2);
8383
8484   /* bit 5 resets the sound CPU? - we ignore it */
8585
r14976r14977
105105
106106static TILE_GET_INFO( get_bg_tile_info )
107107{
108   UINT8 *tilerom = machine.region("gfx4")->base();
108   UINT8 *tilerom = machine.root_device().memregion("gfx4")->base();
109109
110110   int offs = tile_index * 2;
111111   int attr = tilerom[offs + 1];
src/mame/video/turbo.c
r14976r14977
283283
284284static void turbo_prepare_sprites(running_machine &machine, turbo_state *state, UINT8 y, sprite_info *info)
285285{
286   const UINT8 *pr1119 = machine.region("proms")->base() + 0x200;
286   const UINT8 *pr1119 = machine.root_device().memregion("proms")->base() + 0x200;
287287   int sprnum;
288288
289289   /* initialize the line enable signals to 0 */
r14976r14977
349349
350350static UINT32 turbo_get_sprite_bits(running_machine &machine, UINT8 road, sprite_info *sprinfo)
351351{
352   const UINT8 *sprite_gfxdata = machine.region("gfx1")->base();
352   const UINT8 *sprite_gfxdata = machine.root_device().memregion("gfx1")->base();
353353   UINT8 sprlive = sprinfo->lst;
354354   UINT32 sprdata = 0;
355355   int level;
r14976r14977
406406{
407407   turbo_state *state = screen.machine().driver_data<turbo_state>();
408408   bitmap_ind16 &fgpixmap = state->m_fg_tilemap->pixmap();
409   const UINT8 *road_gfxdata = screen.machine().region("gfx3")->base();
410   const UINT8 *prom_base = screen.machine().region("proms")->base();
409   const UINT8 *road_gfxdata = screen.machine().root_device().memregion("gfx3")->base();
410   const UINT8 *prom_base = state->memregion("proms")->base();
411411   const UINT8 *pr1114 = prom_base + 0x000;
412412   const UINT8 *pr1115 = prom_base + 0x020;
413413   const UINT8 *pr1116 = prom_base + 0x040;
r14976r14977
642642
643643static void subroc3d_prepare_sprites(running_machine &machine, turbo_state *state, UINT8 y, sprite_info *info)
644644{
645   const UINT8 *pr1449 = machine.region("proms")->base() + 0x300;
645   const UINT8 *pr1449 = machine.root_device().memregion("proms")->base() + 0x300;
646646   int sprnum;
647647
648648   /* initialize the line enable signals to 0 */
r14976r14977
708708       end is in bit 1, plb in bit 0
709709    */
710710   static const UINT8 plb_end[16] = { 0,1,1,2, 1,1,1,1, 1,1,1,1, 0,1,1,2 };
711   const UINT8 *sprite_gfxdata = machine.region("gfx1")->base();
711   const UINT8 *sprite_gfxdata = machine.root_device().memregion("gfx1")->base();
712712   UINT32 sprdata = 0;
713713   int level;
714714
r14976r14977
761761{
762762   turbo_state *state = screen.machine().driver_data<turbo_state>();
763763   bitmap_ind16 &fgpixmap = state->m_fg_tilemap->pixmap();
764   const UINT8 *prom_base = screen.machine().region("proms")->base();
764   const UINT8 *prom_base = state->memregion("proms")->base();
765765   const UINT8 *pr1419 = prom_base + 0x000;
766766   const UINT8 *pr1620 = prom_base + 0x200;
767767   const UINT8 *pr1450 = prom_base + 0x500;
r14976r14977
861861
862862static void buckrog_prepare_sprites(running_machine &machine, turbo_state *state, UINT8 y, sprite_info *info)
863863{
864   const UINT8 *pr5196 = machine.region("proms")->base() + 0x100;
864   const UINT8 *pr5196 = machine.root_device().memregion("proms")->base() + 0x100;
865865   int sprnum;
866866
867867   /* initialize the line enable signals to 0 */
r14976r14977
928928       end is in bit 1, plb in bit 0
929929    */
930930   static const UINT8 plb_end[16] = { 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,2 };
931   const UINT8 *sprite_gfxdata = machine.region("gfx1")->base();
931   const UINT8 *sprite_gfxdata = machine.root_device().memregion("gfx1")->base();
932932   UINT32 sprdata = 0;
933933   int level;
934934
r14976r14977
981981{
982982   turbo_state *state = screen.machine().driver_data<turbo_state>();
983983   bitmap_ind16 &fgpixmap = state->m_fg_tilemap->pixmap();
984   const UINT8 *bgcolor = screen.machine().region("gfx3")->base();
985   const UINT8 *prom_base = screen.machine().region("proms")->base();
984   const UINT8 *bgcolor = screen.machine().root_device().memregion("gfx3")->base();
985   const UINT8 *prom_base = state->memregion("proms")->base();
986986   const UINT8 *pr5194 = prom_base + 0x000;
987987   const UINT8 *pr5198 = prom_base + 0x500;
988988   const UINT8 *pr5199 = prom_base + 0x700;
src/mame/video/cvs.c
r14976r14977
2727
2828PALETTE_INIT( cvs )
2929{
30   const UINT8 *color_prom = machine.region("proms")->base();
30   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3131   int i, attr;
3232
3333   /* allocate the colortable */
src/mame/video/seta.c
r14976r14977
290290
291291            if (new_bank != m_samples_bank)
292292            {
293               UINT8 *rom = machine().region("x1snd")->base();
294               int samples_len = machine().region("x1snd")->bytes();
293               UINT8 *rom = memregion("x1snd")->base();
294               int samples_len = memregion("x1snd")->bytes();
295295               int addr;
296296
297297               m_samples_bank = new_bank;
r14976r14977
665665// color prom
666666PALETTE_INIT( inttoote )
667667{
668   const UINT8 *color_prom = machine.region("proms")->base();
668   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
669669   int x;
670670   for (x = 0; x < 0x200 ; x++)
671671   {
r14976r14977
684684
685685PALETTE_INIT( usclssic )
686686{
687   const UINT8 *color_prom = machine.region("proms")->base();
687   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
688688   int color, pen;
689689   int x;
690690
src/mame/video/tnzs.c
r14976r14977
3232
3333PALETTE_INIT( arknoid2 )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   int i, col;
3737
3838   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/tp84.c
r14976r14977
4343*/
4444PALETTE_INIT( tp84 )
4545{
46   const UINT8 *color_prom = machine.region("proms")->base();
46   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4747   static const int resistances[4] = { 1000, 470, 220, 100 };
4848   double weights[4];
4949   int i;
src/mame/video/vball.c
r14976r14977
7676
7777   if (bank==state->m_vb_bgprombank) return;
7878
79   color_prom = machine.region("proms")->base() + bank*0x80;
79   color_prom = state->memregion("proms")->base() + bank*0x80;
8080   for (i=0;i<128;i++, color_prom++) {
8181      palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4),
8282                   pal4bit(color_prom[0x800] >> 0));
r14976r14977
9393
9494   if (bank==state->m_vb_spprombank) return;
9595
96   color_prom = machine.region("proms")->base()+0x400 + bank*0x80;
96   color_prom = state->memregion("proms")->base()+0x400 + bank*0x80;
9797   for (i=128;i<256;i++,color_prom++)   {
9898      palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4),
9999                   pal4bit(color_prom[0x800] >> 0));
src/mame/video/higemaru.c
r14976r14977
2121
2222PALETTE_INIT( higemaru )
2323{
24   const UINT8 *color_prom = machine.region("proms")->base();
24   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2525   int i;
2626
2727   /* allocate the colortable */
src/mame/video/plygonet.c
r14976r14977
102102   assert(state->m_ttl_gfx_index != MAX_GFX_ELEMENTS);
103103
104104   /* decode the ttl layer's gfx */
105   machine.gfx[state->m_ttl_gfx_index] = gfx_element_alloc(machine, &charlayout, machine.region("gfx1")->base(), machine.total_colors() / 16, 0);
105   machine.gfx[state->m_ttl_gfx_index] = gfx_element_alloc(machine, &charlayout, machine.root_device().memregion("gfx1")->base(), machine.total_colors() / 16, 0);
106106
107107   /* create the tilemap */
108108   state->m_ttl_tilemap = tilemap_create(machine, ttl_get_tile_info, plygonet_scan,  8, 8, 64, 32);
src/mame/video/cheekyms.c
r14976r14977
1717
1818PALETTE_INIT( cheekyms )
1919{
20   const UINT8 *color_prom = machine.region("proms")->base();
20   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2121   int i, j, bit, r, g, b;
2222
2323   for (i = 0; i < 6; i++)
src/mame/video/magmax.c
r14976r14977
2626***************************************************************************/
2727PALETTE_INIT( magmax )
2828{
29   const UINT8 *color_prom = machine.region("proms")->base();
29   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3030   int i;
3131
3232   /* allocate the colortable */
r14976r14977
6666{
6767   magmax_state *state = machine.driver_data<magmax_state>();
6868   int i,v;
69   UINT8 * prom14D = machine.region("user2")->base();
69   UINT8 * prom14D = state->memregion("user2")->base();
7070
7171   /* Set up save state */
7272   state_save_register_global(machine, state->m_flipscreen);
r14976r14977
101101   else
102102   {
103103      int v;
104      UINT8 * rom18B = screen.machine().region("user1")->base();
104      UINT8 * rom18B = state->memregion("user1")->base();
105105      UINT32 scroll_h = (*state->m_scroll_x) & 0x3fff;
106106      UINT32 scroll_v = (*state->m_scroll_y) & 0xff;
107107
src/mame/video/timelimt.c
r14976r14977
2121***************************************************************************/
2222
2323PALETTE_INIT( timelimt ) {
24   const UINT8 *color_prom = machine.region("proms")->base();
24   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2525   int i;
2626
2727   for (i = 0;i < machine.total_colors();i++)
src/mame/video/1942.c
r14976r14977
2626
2727PALETTE_INIT( 1942 )
2828{
29   const UINT8 *color_prom = machine.region("proms")->base();
29   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3030   rgb_t palette[256];
3131   int i, colorbase;
3232
src/mame/video/bombjack.c
r14976r14977
4343static TILE_GET_INFO( get_bg_tile_info )
4444{
4545   bombjack_state *state = machine.driver_data<bombjack_state>();
46   UINT8 *tilerom = machine.region("gfx4")->base();
46   UINT8 *tilerom = state->memregion("gfx4")->base();
4747
4848   int offs = (state->m_background_image & 0x07) * 0x200 + tile_index;
4949   int code = (state->m_background_image & 0x10) ? tilerom[offs] : 0;
src/mame/video/trucocl.c
r14976r14977
3838
3939PALETTE_INIT( trucocl )
4040{
41   const UINT8 *color_prom = machine.region("proms")->base();
41   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4242   int i;
4343
4444   for (i = 0;i < 32;i++)
src/mame/video/gridlee.c
r14976r14977
2020
2121PALETTE_INIT( gridlee )
2222{
23   const UINT8 *color_prom = machine.region("proms")->base();
23   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2424   int i;
2525
2626   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
158158   }
159159
160160   /* draw the sprite images */
161   gfx = screen.machine().region("gfx1")->base();
161   gfx = screen.machine().root_device().memregion("gfx1")->base();
162162   for (i = 0; i < 32; i++)
163163   {
164164      UINT8 *sprite = state->m_spriteram + i * 4;
src/mame/video/rallyx.c
r14976r14977
5757
5858PALETTE_INIT( rallyx )
5959{
60   const UINT8 *color_prom = machine.region("proms")->base();
60   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6161   static const int resistances_rg[3] = { 1000, 470, 220 };
6262   static const int resistances_b [2] = { 470, 220 };
6363   double rweights[3], gweights[3], bweights[2];
r14976r14977
116116
117117PALETTE_INIT( jungler )
118118{
119   const UINT8 *color_prom = machine.region("proms")->base();
119   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
120120   static const int resistances_rg[3]   = { 1000, 470, 220 };
121121   static const int resistances_b [2]   = { 470, 220 };
122122   static const int resistances_star[3] = { 150, 100 };
src/mame/video/segag80v.c
r14976r14977
110110static void sega_generate_vector_list(running_machine &machine)
111111{
112112   segag80v_state *state = machine.driver_data<segag80v_state>();
113   UINT8 *sintable = machine.region("proms")->base();
113   UINT8 *sintable = state->memregion("proms")->base();
114114   double total_time = 1.0 / (double)IRQ_CLOCK;
115115   UINT16 symaddr = 0;
116116   UINT8 *vectorram = state->m_vectorram;
src/mame/video/carjmbre.c
r14976r14977
3232
3333PALETTE_INIT( carjmbre )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   rgb_t *rgb;
3737
3838   rgb = compute_res_net_all(machine, color_prom, &carjmbre_decode_info, &carjmbre_net_info);
src/mame/video/superchs.c
r14976r14977
5858{
5959   superchs_state *state = machine.driver_data<superchs_state>();
6060   UINT32 *spriteram32 = state->m_spriteram;
61   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
61   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
6262   int offs, data, tilenum, color, flipx, flipy;
6363   int x, y, priority, dblsize, curx, cury;
6464   int sprites_flipscreen = 0;
src/mame/video/flower.c
r14976r14977
66
77PALETTE_INIT( flower )
88{
9   const UINT8 *color_prom = machine.region("proms")->base();
9   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1010   int i;
1111
1212   /* allocate the colortable */
src/mame/video/mrdo.c
r14976r14977
4444
4545PALETTE_INIT( mrdo )
4646{
47   const UINT8 *color_prom = machine.region("proms")->base();
47   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4848   int i;
4949
5050   const int R1 = 150;
src/mame/video/namcos1.c
r14976r14977
121121   namcos1_state *state = machine.driver_data<namcos1_state>();
122122   int i;
123123
124   state->m_tilemap_maskdata = (UINT8 *)machine.region("gfx1")->base();
124   state->m_tilemap_maskdata = (UINT8 *)state->memregion("gfx1")->base();
125125
126126   /* allocate videoram */
127127   state->m_videoram = auto_alloc_array(machine, UINT8, 0x8000);
src/mame/video/m62.c
r14976r14977
199199
200200PALETTE_INIT( m62 )
201201{
202   const UINT8 *color_prom = machine.region("proms")->base();
202   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
203203   m62_state *state = machine.driver_data<m62_state>();
204204   rgb_t *rgb;
205205
r14976r14977
220220
221221PALETTE_INIT( lotlot )
222222{
223   const UINT8 *color_prom = machine.region("proms")->base();
223   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
224224   m62_state *state = machine.driver_data<m62_state>();
225225   rgb_t *rgb;
226226
r14976r14977
241241
242242PALETTE_INIT( battroad )
243243{
244   const UINT8 *color_prom = machine.region("proms")->base();
244   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
245245   m62_state *state = machine.driver_data<m62_state>();
246246   rgb_t *rgb;
247247
r14976r14977
268268
269269PALETTE_INIT( spelunk2 )
270270{
271   const UINT8 *color_prom = machine.region("proms")->base();
271   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
272272   m62_state *state = machine.driver_data<m62_state>();
273273   rgb_t *rgb;
274274
src/mame/video/megazone.c
r14976r14977
3838
3939PALETTE_INIT( megazone )
4040{
41   const UINT8 *color_prom = machine.region("proms")->base();
41   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4242   static const int resistances_rg[3] = { 1000, 470, 220 };
4343   static const int resistances_b [2] = { 470, 220 };
4444   double rweights[3], gweights[3], bweights[2];
src/mame/video/40love.c
r14976r14977
1212
1313PALETTE_INIT( fortyl )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/galaga.c
r14976r14977
326326
327327PALETTE_INIT( galaga )
328328{
329   const UINT8 *color_prom = machine.region("proms")->base();
329   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
330330   int i;
331331
332332   machine.colortable = colortable_alloc(machine, 32+64);
src/mame/video/lasso.c
r14976r14977
6666
6767PALETTE_INIT( lasso )
6868{
69   const UINT8 *color_prom = machine.region("proms")->base();
69   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7070   int i;
7171
7272   for (i = 0; i < 0x40; i++)
r14976r14977
7676
7777PALETTE_INIT( wwjgtin )
7878{
79   const UINT8 *color_prom = machine.region("proms")->base();
79   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8080   int i;
8181
8282   /* allocate the colortable */
r14976r14977
136136
137137static TILE_GET_INFO( wwjgtin_get_track_tile_info )
138138{
139   UINT8 *ROM = machine.region("user1")->base();
139   UINT8 *ROM = machine.root_device().memregion("user1")->base();
140140   int code = ROM[tile_index];
141141   int color = ROM[tile_index + 0x2000];
142142
src/mame/video/nbmj8688.c
r14976r14977
162162
163163WRITE8_MEMBER(nbmj8688_state::mjsikaku_romsel_w)
164164{
165   int gfxlen = machine().region("gfx1")->bytes();
165   int gfxlen = memregion("gfx1")->bytes();
166166   m_mjsikaku_gfxrom = (data & 0x0f);
167167
168168   if ((m_mjsikaku_gfxrom << 17) > (gfxlen - 1))
r14976r14977
176176
177177WRITE8_MEMBER(nbmj8688_state::secolove_romsel_w)
178178{
179   int gfxlen = machine().region("gfx1")->bytes();
179   int gfxlen = memregion("gfx1")->bytes();
180180   m_mjsikaku_gfxrom = ((data & 0xc0) >> 4) + (data & 0x03);
181181   mjsikaku_gfxflag2_w(space, 0, data);
182182
r14976r14977
191191
192192WRITE8_MEMBER(nbmj8688_state::crystalg_romsel_w)
193193{
194   int gfxlen = machine().region("gfx1")->bytes();
194   int gfxlen = memregion("gfx1")->bytes();
195195   m_mjsikaku_gfxrom = (data & 0x03);
196196   mjsikaku_gfxflag2_w(space, 0, data);
197197
r14976r14977
206206
207207WRITE8_MEMBER(nbmj8688_state::seiha_romsel_w)
208208{
209   int gfxlen = machine().region("gfx1")->bytes();
209   int gfxlen = memregion("gfx1")->bytes();
210210   m_mjsikaku_gfxrom = (data & 0x1f);
211211   mjsikaku_gfxflag3_w(space, 0, data);
212212
r14976r14977
274274static void mbmj8688_gfxdraw(running_machine &machine, int gfxtype)
275275{
276276   nbmj8688_state *state = machine.driver_data<nbmj8688_state>();
277   UINT8 *GFX = machine.region("gfx1")->base();
277   UINT8 *GFX = state->memregion("gfx1")->base();
278278
279279   int x, y;
280280   int dx1, dx2, dy;
r14976r14977
317317      skipy = -1;
318318   }
319319
320   gfxlen = machine.region("gfx1")->bytes();
320   gfxlen = machine.root_device().memregion("gfx1")->bytes();
321321   gfxaddr = (state->m_mjsikaku_gfxrom << 17) + (state->m_blitter_src_addr << 1);
322322//popmessage("ADDR:%08X DX:%03d DY:%03d SX:%03d SY:%03d", gfxaddr, startx, starty, sizex, sizey);
323323//if (state->m_blitter_direction_x|state->m_blitter_direction_y) popmessage("ADDR:%08X FX:%01d FY:%01d", gfxaddr, state->m_blitter_direction_x, state->m_blitter_direction_y);
src/mame/video/8080bw.c
r14976r14977
122122
123123   invadpt2_get_pens(pens);
124124
125   prom = screen.machine().region("proms")->base();
125   prom = state->memregion("proms")->base();
126126   color_map_base = state->m_color_map ? &prom[0x0400] : &prom[0x0000];
127127
128128   for (offs = 0; offs < state->m_main_ram.bytes(); offs++)
r14976r14977
154154
155155   invadpt2_get_pens(pens);
156156
157   prom = screen.machine().region("proms")->base();
157   prom = state->memregion("proms")->base();
158158   color_map_base = state->m_color_map ? &prom[0x0400] : &prom[0x0000];
159159
160160   for (offs = 0; offs < state->m_main_ram.bytes(); offs++)
r14976r14977
186186
187187   invadpt2_get_pens(pens);
188188
189   background_map_base = screen.machine().region("proms")->base();
189   background_map_base = state->memregion("proms")->base();
190190
191191   for (offs = 0; offs < state->m_main_ram.bytes(); offs++)
192192   {
r14976r14977
279279
280280   invadpt2_get_pens(pens);
281281
282   color_map_base = screen.machine().region("proms")->base();
283   cloud_gfx = screen.machine().region("user1")->base();
282   color_map_base = screen.machine().root_device().memregion("proms")->base();
283   cloud_gfx = state->memregion("user1")->base();
284284
285285   for (offs = 0; offs < state->m_main_ram.bytes(); offs++)
286286   {
r14976r14977
403403
404404   cosmo_get_pens(pens);
405405
406   prom = screen.machine().region("proms")->base();
406   prom = state->memregion("proms")->base();
407407   color_map_base = state->m_color_map ? &prom[0x0400] : &prom[0x0000];
408408
409409   for (offs = 0; offs < state->m_main_ram.bytes(); offs++)
src/mame/video/othunder.c
r14976r14977
6666static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int y_offs )
6767{
6868   othunder_state *state = machine.driver_data<othunder_state>();
69   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
69   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
7070   UINT16 tile_mask = (machine.gfx[0]->total_elements) - 1;
7171   UINT16 *spriteram16 = state->m_spriteram;
7272   int offs, data, tilenum, color, flipx, flipy;
src/mame/video/ginganin.c
r14976r14977
7676
7777static TILE_GET_INFO( get_bg_tile_info )
7878{
79   UINT8 *gfx = machine.region("gfx5")->base();
79   UINT8 *gfx = machine.root_device().memregion("gfx5")->base();
8080   int code = gfx[2 * tile_index + 0] * 256 + gfx[2 * tile_index + 1];
8181   SET_TILE_INFO(
8282         BG_GFX,
src/mame/video/tail2nos.c
r14976r14977
6262
6363   state->m_bg_tilemap->set_transparent_pen(15);
6464
65   state->m_zoomdata = (UINT16 *)machine.region("gfx3")->base();
65   state->m_zoomdata = (UINT16 *)state->memregion("gfx3")->base();
6666
6767   state->save_pointer(NAME(state->m_zoomdata), 0x20000 / 2);
6868   machine.save().register_postload(save_prepost_delegate(FUNC(tail2nos_postload), &machine));
src/mame/video/mrjong.c
r14976r14977
1818
1919PALETTE_INIT( mrjong )
2020{
21   const UINT8 *color_prom = machine.region("proms")->base();
21   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2222   int i;
2323
2424   /* allocate the colortable */
src/mame/video/quasar.c
r14976r14977
2121
2222PALETTE_INIT( quasar )
2323{
24   const UINT8 *color_prom = machine.region("proms")->base();
24   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2525   int i;
2626
2727   /* allocate the colortable */
src/mame/video/xyonix.c
r14976r14977
33
44PALETTE_INIT( xyonix )
55{
6   const UINT8 *color_prom = machine.region("proms")->base();
6   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
77   int i;
88
99
src/mame/video/1943.c
r14976r14977
4747
4848PALETTE_INIT( 1943 )
4949{
50   const UINT8 *color_prom = machine.region("proms")->base();
50   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5151   int i;
5252
5353   /* allocate the colortable */
r14976r14977
141141   coin_counter_w(machine(), 1, data & 0x02);
142142
143143   /* bits 2, 3 and 4 select the ROM bank */
144   memory_set_bank(machine(), "bank1", (data & 0x1c) >> 2);
144   membank("bank1")->set_entry((data & 0x1c) >> 2);
145145
146146   /* bit 5 resets the sound CPU - we ignore it */
147147
r14976r14977
167167
168168static TILE_GET_INFO( c1943_get_bg2_tile_info )
169169{
170   UINT8 *tilerom = machine.region("gfx5")->base() + 0x8000;
170   UINT8 *tilerom = machine.root_device().memregion("gfx5")->base() + 0x8000;
171171
172172   int offs = tile_index * 2;
173173   int attr = tilerom[offs + 1];
r14976r14977
180180
181181static TILE_GET_INFO( c1943_get_bg_tile_info )
182182{
183   UINT8 *tilerom = machine.region("gfx5")->base();
183   UINT8 *tilerom = machine.root_device().memregion("gfx5")->base();
184184
185185   int offs = tile_index * 2;
186186   int attr = tilerom[offs + 1];
src/mame/video/lucky74.c
r14976r14977
129129   We're constructing a double-sized palette with one half for each state.
130130*/
131131{
132   const UINT8 *color_prom = machine.region("proms")->base();
132   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
133133   int i;
134134   static const int resistances_rgb[4] = { 2000, 1000, 470, 220 };
135135   double weights_r[4], weights_g[4], weights_b[4];
src/mame/video/pacland.c
r14976r14977
9090
9191PALETTE_INIT( pacland )
9292{
93   const UINT8 *color_prom = machine.region("proms")->base();
93   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9494   pacland_state *state = machine.driver_data<pacland_state>();
9595   int i;
9696
r14976r14977
253253WRITE8_MEMBER(pacland_state::pacland_bankswitch_w)
254254{
255255   int bankaddress;
256   UINT8 *RAM = machine().region("maincpu")->base();
256   UINT8 *RAM = memregion("maincpu")->base();
257257
258258   bankaddress = 0x10000 + ((data & 0x07) << 13);
259   memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
259   membank("bank1")->set_base(&RAM[bankaddress]);
260260
261261//  pbc = data & 0x20;
262262
src/mame/video/rollrace.c
r14976r14977
2222***************************************************************************/
2323PALETTE_INIT( rollrace )
2424{
25   const UINT8 *color_prom = machine.region("proms")->base();
25   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2626   int i;
2727
2828
r14976r14977
103103   int sx, sy;
104104   int scroll;
105105   int col;
106   const UINT8 *mem = screen.machine().region("user1")->base();
106   const UINT8 *mem = state->memregion("user1")->base();
107107
108108   /* fill in background colour*/
109109   bitmap.fill(state->m_ra_bkgpen, cliprect);
src/mame/video/popper.c
r14976r14977
4646
4747PALETTE_INIT( popper )
4848{
49   const UINT8 *color_prom = machine.region("proms")->base();
49   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5050   rgb_t   *rgb;
5151
5252   rgb = compute_res_net_all(machine, color_prom, &popper_decode_info, &popper_net_info);
src/mame/video/sidearms.c
r14976r14977
143143VIDEO_START( sidearms )
144144{
145145   sidearms_state *state = machine.driver_data<sidearms_state>();
146   state->m_tilerom = machine.region("gfx4")->base();
146   state->m_tilerom = state->memregion("gfx4")->base();
147147
148148   if (!state->m_gameid)
149149   {
r14976r14977
226226   _vcount_191 = state->m_vcount_191;
227227   _hcount_191 = state->m_hcount_191 & 0xff;
228228
229   sf_rom = machine.region("user1")->base();
229   sf_rom = machine.root_device().memregion("user1")->base();
230230
231231#if 0 // old loop (for reference; easier to read)
232232   if (!flipon)
src/mame/video/jack.c
r14976r14977
110110
111111PALETTE_INIT( joinem )
112112{
113   const UINT8 *color_prom = machine.region("proms")->base();
113   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
114114   int i;
115115
116116   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/dogfgt.c
r14976r14977
1313
1414PALETTE_INIT( dogfgt )
1515{
16   const UINT8 *color_prom = machine.region("proms")->base();
16   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1717   int i;
1818
1919   /* first 16 colors are RAM */
src/mame/video/taitosj.c
r14976r14977
144144{
145145   taitosj_state *state = machine.driver_data<taitosj_state>();
146146   int i;
147   UINT8 *color_prom = machine.region("proms")->base();
147   UINT8 *color_prom = state->memregion("proms")->base();
148148
149149   /* do a simple conversion of the PROM into layer priority order. Note that */
150150   /* this is a simplification, which assumes the PROM encodes a sensible priority */
r14976r14977
204204   offs_t offs = m_gfxpointer[0] | (m_gfxpointer[1] << 8);
205205
206206   if (offs < 0x8000)
207      ret = machine().region("gfx1")->base()[offs];
207      ret = memregion("gfx1")->base()[offs];
208208   else
209209      ret = 0;
210210
src/mame/video/avgdvg.c
r14976r14977
484484
485485   if (vg->pc & 0x2000)
486486   {
487      bank = &vg->machine().region("alpha")->base()[0x18000];
487      bank = &vg->machine().root_device().memregion("alpha")->base()[0x18000];
488488      vg->data = bank[(vg->map << 13) | ((vg->pc ^ 1) & 0x1fff)];
489489   }
490490   else
r14976r14977
12061206static TIMER_CALLBACK( run_state_machine )
12071207{
12081208   int cycles = 0;
1209   UINT8 *state_prom = machine.region("user1")->base();
1209   UINT8 *state_prom = machine.root_device().memregion("user1")->base();
12101210
12111211   while (cycles < VGSLICE)
12121212   {
src/mame/video/kingobox.c
r14976r14977
123123
124124PALETTE_INIT( kingofb )
125125{
126   const UINT8 *color_prom = machine.region("proms")->base();
126   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
127127   palette_init_common(machine, color_prom, kingofb_get_rgb_data);
128128}
129129
130130PALETTE_INIT( ringking )
131131{
132   const UINT8 *color_prom = machine.region("proms")->base();
132   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
133133   palette_init_common(machine, color_prom, ringking_get_rgb_data);
134134}
135135
src/mame/video/galivan.c
r14976r14977
5454
5555PALETTE_INIT( galivan )
5656{
57   const UINT8 *color_prom = machine.region("proms")->base();
57   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5858   int i;
5959
6060   /* allocate the colortable */
r14976r14977
122122
123123static TILE_GET_INFO( get_bg_tile_info )
124124{
125   UINT8 *BGROM = machine.region("gfx4")->base();
125   UINT8 *BGROM = machine.root_device().memregion("gfx4")->base();
126126   int attr = BGROM[tile_index + 0x4000];
127127   int code = BGROM[tile_index] | ((attr & 0x03) << 8);
128128   SET_TILE_INFO(
r14976r14977
147147
148148static TILE_GET_INFO( ninjemak_get_bg_tile_info )
149149{
150   UINT8 *BGROM = machine.region("gfx4")->base();
150   UINT8 *BGROM = machine.root_device().memregion("gfx4")->base();
151151   int attr = BGROM[tile_index + 0x4000];
152152   int code = BGROM[tile_index] | ((attr & 0x03) << 8);
153153   SET_TILE_INFO(
r14976r14977
229229   m_tx_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
230230
231231   /* bit 7 selects one of two ROM banks for c000-dfff */
232   memory_set_bank(machine(), "bank1", (data & 0x80) >> 7);
232   membank("bank1")->set_entry((data & 0x80) >> 7);
233233
234234   /*  logerror("Address: %04X - port 40 = %02x\n", cpu_get_pc(&space.device()), data); */
235235}
r14976r14977
254254   /* bit 5 sprite flag ??? */
255255
256256   /* bit 6, 7 ROM bank select */
257   memory_set_bank(machine(), "bank1", (data & 0xc0) >> 6);
257   membank("bank1")->set_entry((data & 0xc0) >> 6);
258258
259259#if 0
260260   {
r14976r14977
305305static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
306306{
307307   galivan_state *state = machine.driver_data<galivan_state>();
308   const UINT8 *spritepalettebank = machine.region("user1")->base();
308   const UINT8 *spritepalettebank = state->memregion("user1")->base();
309309   UINT8 *spriteram = state->m_spriteram;
310310   int offs;
311311
src/mame/video/esripsys.c
r14976r14977
225225
226226      if (x_flip)
227227      {
228         rom_l = machine.region("8bpp_r")->base();
229         rom_r = machine.region("8bpp_l")->base();
228         rom_l = machine.root_device().memregion("8bpp_r")->base();
229         rom_r = state->memregion("8bpp_l")->base();
230230      }
231231      else
232232      {
233         rom_l = machine.region("8bpp_l")->base();
234         rom_r = machine.region("8bpp_r")->base();
233         rom_l = machine.root_device().memregion("8bpp_l")->base();
234         rom_r = machine.root_device().memregion("8bpp_r")->base();
235235      }
236236
237237      for (cnt = 0; cnt <= fig; cnt++)
r14976r14977
294294   /* 4bpp case */
295295   else
296296   {
297      const UINT8* const rom = machine.region("4bpp")->base();
297      const UINT8* const rom = machine.root_device().memregion("4bpp")->base();
298298      int ptr = 0;
299299      int cnt;
300300      UINT32 lpos = l;
src/mame/video/nbmj8991.c
r14976r14977
7878******************************************************************************/
7979WRITE8_MEMBER(nbmj8991_state::nbmj8991_blitter_w)
8080{
81   int gfxlen = machine().region("gfx1")->bytes();
81   int gfxlen = memregion("gfx1")->bytes();
8282
8383   switch (offset)
8484   {
r14976r14977
180180static void nbmj8991_gfxdraw(running_machine &machine)
181181{
182182   nbmj8991_state *state = machine.driver_data<nbmj8991_state>();
183   UINT8 *GFX = machine.region("gfx1")->base();
183   UINT8 *GFX = state->memregion("gfx1")->base();
184184   int width = machine.primary_screen->width();
185185
186186   int x, y;
r14976r14977
220220      skipy = -1;
221221   }
222222
223   gfxlen = machine.region("gfx1")->bytes();
223   gfxlen = machine.root_device().memregion("gfx1")->bytes();
224224   gfxaddr = (state->m_gfxrom << 17) + (state->m_blitter_src_addr << 1);
225225
226226   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
src/mame/video/f1gp.c
r14976r14977
5252
5353   state->m_fg_tilemap->set_transparent_pen(0xff);
5454
55   state->m_zoomdata = (UINT16 *)machine.region("gfx4")->base();
55   state->m_zoomdata = (UINT16 *)machine.root_device().memregion("gfx4")->base();
5656   gfx_element_set_source(machine.gfx[3], (UINT8 *)state->m_zoomdata);
5757
58//  state->save_pointer(NAME(state->m_zoomdata), machine.region("gfx4")->bytes());
58//  state->save_pointer(NAME(state->m_zoomdata), state->memregion("gfx4")->bytes());
5959}
6060
6161
r14976r14977
6868
6969   state->m_fg_tilemap->set_transparent_pen(0xff);
7070
71   state->m_zoomdata = (UINT16 *)machine.region("gfx4")->base();
71   state->m_zoomdata = (UINT16 *)machine.root_device().memregion("gfx4")->base();
7272   gfx_element_set_source(machine.gfx[3], (UINT8 *)state->m_zoomdata);
7373
74//  state->save_pointer(NAME(state->m_zoomdata), machine.region("gfx4")->bytes());
74//  state->save_pointer(NAME(state->m_zoomdata), state->memregion("gfx4")->bytes());
7575}
7676
7777VIDEO_START( f1gp2 )
src/mame/video/lvcards.c
r14976r14977
1212
1313PALETTE_INIT( ponttehk )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   for ( i = 0; i < machine.total_colors(); i++ )
r14976r14977
4848
4949PALETTE_INIT( lvcards ) //Ever so slightly different, but different enough.
5050{
51   const UINT8 *color_prom = machine.region("proms")->base();
51   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5252   int i;
5353
5454   for ( i = 0; i < machine.total_colors(); i++ )
src/mame/video/namcos2.c
r14976r14977
443443
444444VIDEO_START( namcos2 )
445445{
446   namco_tilemap_init(machine,2,machine.region("gfx4")->base(),TilemapCB);
446   namco_tilemap_init(machine,2,machine.root_device().memregion("gfx4")->base(),TilemapCB);
447447   tilemap_roz = tilemap_create(machine, get_tile_info_roz,tilemap_scan_rows,8,8,256,256);
448448   tilemap_roz->set_transparent_pen(0xff);
449449   DrawSpriteInit(machine);
r14976r14977
492492
493493VIDEO_START( finallap )
494494{
495   namco_tilemap_init(machine,2,machine.region("gfx4")->base(),TilemapCB);
495   namco_tilemap_init(machine,2,machine.root_device().memregion("gfx4")->base(),TilemapCB);
496496   DrawSpriteInit(machine);
497497   namco_road_init(machine, 3);
498498}
r14976r14977
522522
523523VIDEO_START( luckywld )
524524{
525   namco_tilemap_init(machine,2,machine.region("gfx4")->base(),TilemapCB);
525   namco_tilemap_init(machine,2,machine.root_device().memregion("gfx4")->base(),TilemapCB);
526526   namco_obj_init( machine, 0, 0x0, NULL );
527527   if( namcos2_gametype==NAMCOS2_LUCKY_AND_WILD )
528528   {
r14976r14977
563563
564564VIDEO_START( sgunner )
565565{
566   namco_tilemap_init(machine,2,machine.region("gfx4")->base(),TilemapCB);
566   namco_tilemap_init(machine,2,machine.root_device().memregion("gfx4")->base(),TilemapCB);
567567   namco_obj_init( machine, 0, 0x0, NULL );
568568}
569569
r14976r14977
589589
590590VIDEO_START( metlhawk )
591591{
592   namco_tilemap_init(machine,2,machine.region("gfx4")->base(),TilemapCB);
592   namco_tilemap_init(machine,2,machine.root_device().memregion("gfx4")->base(),TilemapCB);
593593   namco_roz_init( machine, 1, "gfx5" );
594594}
595595
src/mame/video/route16.c
r14976r14977
7373   route16_state *state = screen.machine().driver_data<route16_state>();
7474   offs_t offs;
7575
76   UINT8 *color_prom1 = &screen.machine().region("proms")->base()[0x000];
77   UINT8 *color_prom2 = &screen.machine().region("proms")->base()[0x100];
76   UINT8 *color_prom1 = &screen.machine().root_device().memregion("proms")->base()[0x000];
77   UINT8 *color_prom2 = &state->memregion("proms")->base()[0x100];
7878
7979   for (offs = 0; offs < state->m_videoram1.bytes(); offs++)
8080   {
r14976r14977
130130   route16_state *state = machine.driver_data<route16_state>();
131131   offs_t offs;
132132
133   UINT8 *color_prom1 = &machine.region("proms")->base()[0x000];
134   UINT8 *color_prom2 = &machine.region("proms")->base()[0x100];
133   UINT8 *color_prom1 = &machine.root_device().memregion("proms")->base()[0x000];
134   UINT8 *color_prom2 = &state->memregion("proms")->base()[0x100];
135135
136136   for (offs = 0; offs < state->m_videoram1.bytes(); offs++)
137137   {
src/mame/video/tecmosys.c
r14976r14977
112112static void tecmosys_render_sprites_to_bitmap(running_machine &machine, bitmap_rgb32 &bitmap, UINT16 extrax, UINT16 extray )
113113{
114114   tecmosys_state *state = machine.driver_data<tecmosys_state>();
115   UINT8 *gfxsrc    = machine.region       ( "gfx1" )->base();
115   UINT8 *gfxsrc    = state->memregion       ( "gfx1" )->base();
116116   int i;
117117
118118   /* render sprites (with priority information) to temp bitmap */
src/mame/video/snk6502.c
r14976r14977
2424***************************************************************************/
2525PALETTE_INIT( snk6502 )
2626{
27   const UINT8 *color_prom = machine.region("proms")->base();
27   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2828   snk6502_state *state = machine.driver_data<snk6502_state>();
2929   int i;
3030
r14976r14977
210210
211211PALETTE_INIT( satansat )
212212{
213   const UINT8 *color_prom = machine.region("proms")->base();
213   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
214214   snk6502_state *state = machine.driver_data<snk6502_state>();
215215   int i;
216216
src/mame/video/tx1.c
r14976r14977
112112
113113PALETTE_INIT( tx1 )
114114{
115   const UINT8 *color_prom = machine.region("proms")->base();
115   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
116116   int i;
117117
118118   static const res_net_info tx1_net_info =
r14976r14977
236236   UINT8 *chars, *gfx2;
237237
238238   /* 2bpp characters */
239   chars = machine.region("char_tiles")->base();
239   chars = state->memregion("char_tiles")->base();
240240   gfx2 = chars + 0x4000;
241241
242242   /* X scroll value is the last word in char RAM */
r14976r14977
416416   UINT8   pix[2][4][3];
417417
418418   /* Road slice map ROMs */
419   const UINT8 *const gfx3 = machine.region("gfx3")->base();
419   const UINT8 *const gfx3 = machine.root_device().memregion("gfx3")->base();
420420   const UINT8 *const rom_a = gfx3;
421421   const UINT8 *const rom_b = gfx3 + 0x2000;
422422   const UINT8 *const rom_c = gfx3 + 0x4000;
423423
424424   /* Pixel data */
425   const UINT8 *const proms = machine.region("proms")->base();
425   const UINT8 *const proms = state->memregion("proms")->base();
426426   const UINT8 *const prom_a = proms + 0x1100;
427427   const UINT8 *const prom_b = proms + 0x1300;
428428   const UINT8 *const prom_c = proms + 0x1500;
r14976r14977
859859   UINT32 offs;
860860
861861   /* The many lookup table ROMs */
862   const UINT8 *const ic48 = machine.region("user3")->base();
862   const UINT8 *const ic48 = machine.root_device().memregion("user3")->base();
863863   const UINT8 *const ic281 = ic48 + 0x2000;
864864
865   const UINT8 *const proms = machine.region("proms")->base();
865   const UINT8 *const proms = machine.root_device().memregion("proms")->base();
866866   const UINT8 *const ic190 = proms + 0xc00;
867867   const UINT8 *const ic162 = proms + 0xe00;
868868   const UINT8 *const ic25  = proms + 0x1000;
869869
870   const UINT8 *const ic106 = machine.region("obj_map")->base();
870   const UINT8 *const ic106 = machine.root_device().memregion("obj_map")->base();
871871   const UINT8 *const ic73  = ic106 + 0x4000;
872872
873   const UINT8 *const pixdata_rgn = machine.region("obj_tiles")->base();
873   const UINT8 *const pixdata_rgn = state->memregion("obj_tiles")->base();
874874
875875   for (offs = 0x0; offs <= 0x300; offs += 8)
876876   {
r14976r14977
11361136{
11371137   tx1_state *state = machine.driver_data<tx1_state>();
11381138   int x, y;
1139   UINT8 *chr_pal = machine.region("proms")->base() + 0x900;
1139   UINT8 *chr_pal = state->memregion("proms")->base() + 0x900;
11401140
11411141   int x_offset = screen * 256;
11421142
r14976r14977
12491249
12501250PALETTE_INIT( buggyboy )
12511251{
1252   const UINT8 *color_prom = machine.region("proms")->base();
1252   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
12531253   int i;
12541254
12551255   for (i = 0; i < 0x100; i++)
r14976r14977
13001300   UINT32 x_mask;
13011301
13021302   /* 2bpp characters */
1303   chars = machine.region("char_tiles")->base();
1304   gfx2 = machine.region("char_tiles")->base() + 0x4000;
1303   chars = machine.root_device().memregion("char_tiles")->base();
1304   gfx2 = state->memregion("char_tiles")->base() + 0x4000;
13051305
13061306   /* X/Y scroll values are the last word in char RAM */
13071307   if (wide)
r14976r14977
15351535   UINT32 rva20_6;
15361536
15371537   /* ROM/PROM lookup tables */
1538   const UINT8 *rcols = (UINT8*)(machine.region("proms")->base() + 0x1500);
1539   const UINT8 *rom   = machine.region("road")->base();
1538   const UINT8 *rcols = (UINT8*)(machine.root_device().memregion("proms")->base() + 0x1500);
1539   const UINT8 *rom   = state->memregion("road")->base();
15401540   const UINT8 *prom0 = rom + 0x4000;
15411541   const UINT8 *prom1 = rom + 0x4200;
15421542   const UINT8 *prom2 = rom + 0x4400;
r14976r14977
21672167   UINT32 rva20_6;
21682168
21692169   /* ROM/PROM lookup tables */
2170   const UINT8 *rcols = (UINT8*)(machine.region("proms")->base() + 0x1500);
2171   const UINT8 *rom   = machine.region("road")->base();
2170   const UINT8 *rcols = (UINT8*)(machine.root_device().memregion("proms")->base() + 0x1500);
2171   const UINT8 *rom   = state->memregion("road")->base();
21722172   const UINT8 *prom0 = rom + 0x4000;
21732173   const UINT8 *prom1 = rom + 0x4200;
21742174   const UINT8 *prom2 = rom + 0x4400;
r14976r14977
25802580   UINT32 x_stride;
25812581
25822582   /* The many lookup table ROMs */
2583   const UINT8 *const bug13  = (UINT8*)machine.region("obj_luts")->base();
2583   const UINT8 *const bug13  = (UINT8*)machine.root_device().memregion("obj_luts")->base();
25842584   const UINT8 *const bug18s = bug13 + 0x2000;
2585   const UINT8 *const bb8    = (UINT8*)machine.region("proms")->base() + 0x1600;
2585   const UINT8 *const bb8    = (UINT8*)machine.root_device().memregion("proms")->base() + 0x1600;
25862586
2587   const UINT8 *const bug16s = (UINT8*)machine.region("obj_map")->base();
2587   const UINT8 *const bug16s = (UINT8*)machine.root_device().memregion("obj_map")->base();
25882588   const UINT8 *const bug17s = bug16s + 0x8000;
25892589
2590   const UINT8 *const bb9o = (UINT8*)machine.region("proms")->base() + 0x500;
2590   const UINT8 *const bb9o = (UINT8*)machine.root_device().memregion("proms")->base() + 0x500;
25912591   const UINT8 *const bb9e = bb9o + 0x800;
25922592
2593   const UINT8 *const pixdata_rgn = (UINT8*)machine.region("obj_tiles")->base();
2593   const UINT8 *const pixdata_rgn = (UINT8*)state->memregion("obj_tiles")->base();
25942594
25952595   if (wide)
25962596   {
r14976r14977
29312931static void bb_combine_layers(running_machine &machine, bitmap_ind16 &bitmap, int screen)
29322932{
29332933   tx1_state *state = machine.driver_data<tx1_state>();
2934   UINT8 *chr_pal = machine.region("proms")->base() + 0x400;
2934   UINT8 *chr_pal = state->memregion("proms")->base() + 0x400;
29352935   UINT32 bmp_stride;
29362936   UINT32 x_offset;
29372937   UINT32 y;
src/mame/video/pingpong.c
r14976r14977
3232***************************************************************************/
3333PALETTE_INIT( pingpong )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   int i;
3737
3838   /* allocate the colortable */
src/mame/video/gotya.c
r14976r14977
1111
1212PALETTE_INIT( gotya )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   static const int resistances_rg[3] = { 1000, 470, 220 };
1616   static const int resistances_b [2] = { 470, 220 };
1717   double rweights[3], gweights[3], bweights[2];
src/mame/video/tatsumi.c
r14976r14977
973973        Each tile (0x4000 of them) has a lookup table in ROM to build an individual 3-bit palette
974974        from sets of 8 bit palettes!
975975    */
976   const UINT8* tile_cluts = machine.region("gfx4")->base();
976   const UINT8* tile_cluts = machine.root_device().memregion("gfx4")->base();
977977   const bitmap_ind16 &src_bitmap = src->pixmap();
978978   int src_y_mask=ysize-1;
979979   int src_x_mask=xsize-1;
r14976r14977
10081008{
10091009   tatsumi_state *state = machine.driver_data<tatsumi_state>();
10101010   int x, y;
1011   const UINT8 *lut = machine.region("proms")->base();
1011   const UINT8 *lut = state->memregion("proms")->base();
10121012
10131013   UINT16 gva = 0x180; // TODO
10141014   UINT8 sky_val = state->m_apache3_rotate_ctrl[1] & 0xff;
src/mame/video/konamiic.c
r14976r14977
5025021d00     : bits 0 & 1 might enable NMI and FIRQ, not sure
503503         : bit 2 = IRQ enable
5045041d80     : ROM bank selector bits 0-3 = bank 0 bits 4-7 = bank 1
5051e00     : ROM subbank selector for ROM testing
5051e00     : ROM membank selector for ROM testing
5065061e80     : bit 0 = flip screen (applies to tilemaps only, not sprites)
507507         : bit 1 = set by crimfght, mainevt, surpratk, xmen, mia, punkshot, thndrx2, spy
508508         :         it seems to enable tile flip X, however flip X is handled by the
r14976r14977
12871287         break;
12881288   assert(gfx_index != MAX_GFX_ELEMENTS);
12891289
1290   K055673_rom = (UINT16 *)machine.region(gfx_memory_region)->base();
1290   K055673_rom = (UINT16 *)machine.root_device().memregion(gfx_memory_region)->base();
12911291
12921292   /* decode the graphics */
12931293   switch(layout)
12941294   {
12951295   case K055673_LAYOUT_GX:
1296      size4 = (machine.region(gfx_memory_region)->bytes()/(1024*1024))/5;
1296      size4 = (machine.root_device().memregion(gfx_memory_region)->bytes()/(1024*1024))/5;
12971297      size4 *= 4*1024*1024;
12981298      /* set the # of tiles based on the 4bpp section */
12991299      K055673_rom = auto_alloc_array(machine, UINT16, size4 * 5 / 2);
13001300      d = (UINT8 *)K055673_rom;
13011301      // now combine the graphics together to form 5bpp
1302      s1 = machine.region(gfx_memory_region)->base(); // 4bpp area
1302      s1 = machine.root_device().memregion(gfx_memory_region)->base(); // 4bpp area
13031303      s2 = s1 + (size4);    // 1bpp area
13041304      for (i = 0; i < size4; i+= 4)
13051305      {
r14976r14977
13151315      break;
13161316
13171317   case K055673_LAYOUT_RNG:
1318      total = machine.region(gfx_memory_region)->bytes() / (16*16/2);
1318      total = machine.root_device().memregion(gfx_memory_region)->bytes() / (16*16/2);
13191319      decode_gfx(machine, gfx_index, (UINT8 *)K055673_rom, total, &spritelayout2, 4);
13201320      break;
13211321
13221322   case K055673_LAYOUT_LE2:
1323      total = machine.region(gfx_memory_region)->bytes() / (16*16);
1323      total = machine.root_device().memregion(gfx_memory_region)->bytes() / (16*16);
13241324      decode_gfx(machine, gfx_index, (UINT8 *)K055673_rom, total, &spritelayout3, 4);
13251325      break;
13261326
13271327   case K055673_LAYOUT_GX6:
1328      total = machine.region(gfx_memory_region)->bytes() / (16*16*6/8);
1328      total = machine.root_device().memregion(gfx_memory_region)->bytes() / (16*16*6/8);
13291329      decode_gfx(machine, gfx_index, (UINT8 *)K055673_rom, total, &spritelayout4, 4);
13301330      break;
13311331
r14976r14977
14001400// in this window, +0 = 32 bits from one set of ROMs, and +8 = 32 bits from another set
14011401READ16_HANDLER( K055673_rom_word_r )   // 5bpp
14021402{
1403   UINT8 *ROM8 = (UINT8 *)space->machine().region(K053247_memory_region)->base();
1404   UINT16 *ROM = (UINT16 *)space->machine().region(K053247_memory_region)->base();
1405   int size4 = (space->machine().region(K053247_memory_region)->bytes()/(1024*1024))/5;
1403   UINT8 *ROM8 = (UINT8 *)space->machine().root_device().memregion(K053247_memory_region)->base();
1404   UINT16 *ROM = (UINT16 *)space->machine().root_device().memregion(K053247_memory_region)->base();
1405   int size4 = (space->machine().root_device().memregion(K053247_memory_region)->bytes()/(1024*1024))/5;
14061406   int romofs;
14071407
14081408   size4 *= 4*1024*1024;   // get offset to 5th bit
r14976r14977
14381438
14391439READ16_HANDLER( K055673_GX6bpp_rom_word_r )
14401440{
1441   UINT16 *ROM = (UINT16 *)space->machine().region(K053247_memory_region)->base();
1441   UINT16 *ROM = (UINT16 *)space->machine().root_device().memregion(K053247_memory_region)->base();
14421442   int romofs;
14431443
14441444   romofs = K053246_regs[6]<<16 | K053246_regs[7]<<8 | K053246_regs[4];
r14976r14977
20762076   switch (bpp)
20772077   {
20782078      case K056832_BPP_4:
2079         total = machine.region(gfx_memory_region)->bytes() / (i*4);
2080         decode_gfx(machine, gfx_index, machine.region(gfx_memory_region)->base(), total, &charlayout4, 4);
2079         total = machine.root_device().memregion(gfx_memory_region)->bytes() / (i*4);
2080         decode_gfx(machine, gfx_index, machine.root_device().memregion(gfx_memory_region)->base(), total, &charlayout4, 4);
20812081         break;
20822082
20832083      case K056832_BPP_5:
2084         total = machine.region(gfx_memory_region)->bytes() / (i*5);
2085         decode_gfx(machine, gfx_index, machine.region(gfx_memory_region)->base(), total, &charlayout5, 4);
2084         total = machine.root_device().memregion(gfx_memory_region)->bytes() / (i*5);
2085         decode_gfx(machine, gfx_index, machine.root_device().memregion(gfx_memory_region)->base(), total, &charlayout5, 4);
20862086         break;
20872087
20882088      case K056832_BPP_6:
2089         total = machine.region(gfx_memory_region)->bytes() / (i*6);
2090         decode_gfx(machine, gfx_index, machine.region(gfx_memory_region)->base(), total, &charlayout6, 4);
2089         total = machine.root_device().memregion(gfx_memory_region)->bytes() / (i*6);
2090         decode_gfx(machine, gfx_index, machine.root_device().memregion(gfx_memory_region)->base(), total, &charlayout6, 4);
20912091         break;
20922092
20932093      case K056832_BPP_8:
2094         total = machine.region(gfx_memory_region)->bytes() / (i*8);
2095         decode_gfx(machine, gfx_index, machine.region(gfx_memory_region)->base(), total, &charlayout8, 4);
2094         total = machine.root_device().memregion(gfx_memory_region)->bytes() / (i*8);
2095         decode_gfx(machine, gfx_index, machine.root_device().memregion(gfx_memory_region)->base(), total, &charlayout8, 4);
20962096         break;
20972097
20982098      case K056832_BPP_8LE:
2099         total = machine.region(gfx_memory_region)->bytes() / (i*8);
2100         decode_gfx(machine, gfx_index, machine.region(gfx_memory_region)->base(), total, &charlayout8le, 4);
2099         total = machine.root_device().memregion(gfx_memory_region)->bytes() / (i*8);
2100         decode_gfx(machine, gfx_index, machine.root_device().memregion(gfx_memory_region)->base(), total, &charlayout8le, 4);
21012101         break;
21022102
21032103      case K056832_BPP_8TASMAN:
2104         total = machine.region(gfx_memory_region)->bytes() / (i*8);
2105         decode_gfx(machine, gfx_index, machine.region(gfx_memory_region)->base(), total, &charlayout8_tasman, 4);
2104         total = machine.root_device().memregion(gfx_memory_region)->bytes() / (i*8);
2105         decode_gfx(machine, gfx_index, machine.root_device().memregion(gfx_memory_region)->base(), total, &charlayout8_tasman, 4);
21062106         break;
21072107
21082108      case K056832_BPP_4dj:
2109         total = machine.region(gfx_memory_region)->bytes() / (i*4);
2110         decode_gfx(machine, gfx_index, machine.region(gfx_memory_region)->base(), total, &charlayout4dj, 4);
2109         total = machine.root_device().memregion(gfx_memory_region)->bytes() / (i*4);
2110         decode_gfx(machine, gfx_index, machine.root_device().memregion(gfx_memory_region)->base(), total, &charlayout4dj, 4);
21112111         break;
21122112
21132113      default:
r14976r14977
21202120   K056832_gfxnum = gfx_index;
21212121   K056832_callback = callback;
21222122
2123   K056832_rombase = machine.region(gfx_memory_region)->base();
2124   K056832_NumGfxBanks = machine.region(gfx_memory_region)->bytes() / 0x2000;
2123   K056832_rombase = machine.root_device().memregion(gfx_memory_region)->base();
2124   K056832_NumGfxBanks = machine.root_device().memregion(gfx_memory_region)->bytes() / 0x2000;
21252125   K056832_CurGfxBank = 0;
21262126   K056832_use_ext_linescroll = 0;
21272127   K056832_uses_tile_banks = 0;
r14976r14977
22152215   UINT8 *rombase;
22162216   int base, ret;
22172217
2218   rombase = (UINT8 *)machine.region(K056832_memory_region)->base();
2218   rombase = (UINT8 *)machine.root_device().memregion(K056832_memory_region)->base();
22192219
22202220   if ((K056832_rom_half) && (zerosec))
22212221   {
r14976r14977
23052305
23062306   if (!K056832_rombase)
23072307   {
2308      K056832_rombase = space->machine().region(K056832_memory_region)->base();
2308      K056832_rombase = space->machine().root_device().memregion(K056832_memory_region)->base();
23092309   }
23102310
23112311   if (K056832_regsb[2] & 0x8)
src/mame/video/retofinv.c
r14976r14977
1212
1313PALETTE_INIT( retofinv )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
src/mame/video/bogeyman.c
r14976r14977
44
55PALETTE_INIT( bogeyman )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99
1010   /* first 16 colors are RAM */
src/mame/video/srmp2.c
r14976r14977
1111
1212PALETTE_INIT( srmp2 )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   int i;
1616
1717   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
2626
2727PALETTE_INIT( srmp3 )
2828{
29   const UINT8 *color_prom = machine.region("proms")->base();
29   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3030   int i;
3131
3232   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/madalien.c
r14976r14977
1616
1717static PALETTE_INIT( madalien )
1818{
19   const UINT8 *color_prom = machine.region("proms")->base();
19   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2020   int i;
2121
2222   /* allocate the colortable */
r14976r14977
9292static TILE_GET_INFO( get_tile_info_BG_1 )
9393{
9494   madalien_state *state = machine.driver_data<madalien_state>();
95   UINT8 *map = machine.region("user1")->base() + ((*state->m_video_flags & 0x08) << 6);
95   UINT8 *map = state->memregion("user1")->base() + ((*state->m_video_flags & 0x08) << 6);
9696
9797   SET_TILE_INFO(1, map[tile_index], BIT(*state->m_video_flags, 2) ? 2 : 0, 0);
9898}
r14976r14977
101101static TILE_GET_INFO( get_tile_info_BG_2 )
102102{
103103   madalien_state *state = machine.driver_data<madalien_state>();
104   UINT8 *map = machine.region("user1")->base() + ((*state->m_video_flags & 0x08) << 6) + 0x80;
104   UINT8 *map = state->memregion("user1")->base() + ((*state->m_video_flags & 0x08) << 6) + 0x80;
105105
106106   SET_TILE_INFO(1, map[tile_index], BIT(*state->m_video_flags, 2) ? 2 : 0, 0);
107107}
src/mame/video/crgolf.c
r14976r14977
5151static void get_pens( running_machine &machine, pen_t *pens )
5252{
5353   offs_t offs;
54   const UINT8 *prom = machine.region("proms")->base();
54   const UINT8 *prom = machine.root_device().memregion("proms")->base();
5555
5656   for (offs = 0; offs < NUM_PENS; offs++)
5757   {
src/mame/video/firetrap.c
r14976r14977
3636
3737PALETTE_INIT( firetrap )
3838{
39   const UINT8 *color_prom = machine.region("proms")->base();
39   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4040   int i;
4141
4242
src/mame/video/thedeep.c
r14976r14977
8888
8989PALETTE_INIT( thedeep )
9090{
91   const UINT8 *color_prom = machine.region("proms")->base();
91   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9292   int i;
9393   for (i = 0;i < 512;i++)
9494      palette_set_color_rgb(machine,i,pal4bit(color_prom[0x400 + i] >> 0),pal4bit(color_prom[0x400 + i] >> 4),pal4bit(color_prom[0x200 + i] >> 0));
src/mame/video/bladestl.c
r14976r14977
55
66PALETTE_INIT( bladestl )
77{
8   const UINT8 *color_prom = machine.region("proms")->base();
8   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
99   int i;
1010
1111   /* allocate the colortable */
src/mame/video/mcr68.c
r14976r14977
7171VIDEO_START( zwackery )
7272{
7373   mcr68_state *state = machine.driver_data<mcr68_state>();
74   const UINT8 *colordatabase = (const UINT8 *)machine.region("gfx3")->base();
74   const UINT8 *colordatabase = (const UINT8 *)state->memregion("gfx3")->base();
7575   gfx_element *gfx0 = machine.gfx[0];
7676   gfx_element *gfx2 = machine.gfx[2];
7777   UINT8 *srcdata0, *dest0;
src/mame/video/funworld.c
r14976r14977
107107
108108PALETTE_INIT(funworld)
109109{
110   const UINT8 *color_prom = machine.region("proms")->base();
110   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
111111   int i;
112112   static const int resistances_rb[3] = { 1000, 470, 220 };
113113   static const int resistances_g [2] = { 470, 220 };
src/mame/video/gsword.c
r14976r14977
1111
1212static PALETTE_INIT( common )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   int i;
1616
1717   /* characters */
r14976r14977
2929
3030PALETTE_INIT( josvolly )
3131{
32   const UINT8 *color_prom = machine.region("proms")->base();
32   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3333   int i;
3434
3535   /* allocate the colortable */
r14976r14977
5454
5555PALETTE_INIT( gsword )
5656{
57   const UINT8 *color_prom = machine.region("proms")->base();
57   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5858   int i;
5959
6060   /* allocate the colortable */
src/mame/video/nbmj8900.c
r14976r14977
147147{
148148   m_gfxrom = (data & 0x0f);
149149
150   if ((0x20000 * m_gfxrom) > (machine().region("gfx")->bytes() - 1))
150   if ((0x20000 * m_gfxrom) > (machine().root_device().memregion("gfx")->bytes() - 1))
151151   {
152152#ifdef MAME_DEBUG
153153      popmessage("GFXROM BANK OVER!!");
154154#endif
155      m_gfxrom &= (machine().region("gfx")->bytes() / 0x20000 - 1);
155      m_gfxrom &= (machine().root_device().memregion("gfx")->bytes() / 0x20000 - 1);
156156   }
157157}
158158
r14976r14977
211211static void nbmj8900_gfxdraw(running_machine &machine)
212212{
213213   nbmj8900_state *state = machine.driver_data<nbmj8900_state>();
214   unsigned char *GFX = machine.region("gfx")->base();
214   unsigned char *GFX = state->memregion("gfx")->base();
215215
216216   int x, y;
217217   int dx1, dx2, dy1, dy2;
r14976r14977
255255   {
256256      for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
257257      {
258         if ((gfxaddr > (machine.region("gfx")->bytes() - 1)))
258         if ((gfxaddr > (machine.root_device().memregion("gfx")->bytes() - 1)))
259259         {
260260#ifdef MAME_DEBUG
261261            popmessage("GFXROM ADDRESS OVER!!");
262262#endif
263            gfxaddr &= (machine.region("gfx")->bytes() - 1);
263            gfxaddr &= (machine.root_device().memregion("gfx")->bytes() - 1);
264264         }
265265
266266         color = GFX[gfxaddr++];
src/mame/video/mario.c
r14976r14977
6464***************************************************************************/
6565PALETTE_INIT( mario )
6666{
67   const UINT8 *color_prom = machine.region("proms")->base();
67   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6868   rgb_t   *rgb;
6969
7070   rgb = compute_res_net_all(machine, color_prom, &mario_decode_info, &mario_net_info);
src/mame/video/exprraid.c
r14976r14977
4545static TILE_GET_INFO( get_bg_tile_info )
4646{
4747   exprraid_state *state = machine.driver_data<exprraid_state>();
48   UINT8 *tilerom = machine.region("gfx4")->base();
48   UINT8 *tilerom = state->memregion("gfx4")->base();
4949
5050   int data, attr, bank, code, color, flags;
5151   int quadrant = 0, offs;
src/mame/video/naughtyb.c
r14976r14977
5858
5959PALETTE_INIT( naughtyb )
6060{
61   const UINT8 *color_prom = machine.region("proms")->base();
61   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6262   static const int resistances[2] = { 270, 130 };
6363   double weights[2];
6464   int i;
src/mame/video/toypop.c
r14976r14977
2020
2121PALETTE_INIT( toypop )
2222{
23   const UINT8 *color_prom = machine.region("proms")->base();
23   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2424   /* allocate the colortable */
2525   machine.colortable = colortable_alloc(machine, 256);
2626
src/mame/video/momoko.c
r14976r14977
7171   int xx, sx, sy, px, py, dot;
7272   UINT32 gfxadr;
7373   UINT8 d0, d1;
74   UINT8 *BG_GFX = machine.region("gfx2")->base();
74   UINT8 *BG_GFX = machine.root_device().memregion("gfx2")->base();
7575
7676   for (sy = 0; sy < 8; sy++)
7777   {
r14976r14977
107107   int x, y, dx, dy, rx, ry, radr, chr, sy, fx, fy, px, py, offs, col, pri, flip ;
108108   UINT8 *spriteram = state->m_spriteram;
109109
110   UINT8 *BG_MAP     = screen.machine().region("user1")->base();
111   UINT8 *BG_COL_MAP = screen.machine().region("user2")->base();
112   UINT8 *FG_MAP     = screen.machine().region("user3")->base();
113   UINT8 *TEXT_COLOR = screen.machine().region("proms")->base();
110   UINT8 *BG_MAP     = screen.machine().root_device().memregion("user1")->base();
111   UINT8 *BG_COL_MAP = screen.machine().root_device().memregion("user2")->base();
112   UINT8 *FG_MAP     = screen.machine().root_device().memregion("user3")->base();
113   UINT8 *TEXT_COLOR = state->memregion("proms")->base();
114114
115115
116116   flip = state->m_flipscreen ^ (input_port_read(screen.machine(), "FAKE") & 0x01);
src/mame/video/kchamp.c
r14976r14977
1212
1313PALETTE_INIT( kchamp )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i, red, green, blue;
1717
1818   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/digdug.c
r14976r14977
2323
2424PALETTE_INIT( digdug )
2525{
26   const UINT8 *color_prom = machine.region("proms")->base();
26   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2727   int i;
2828
2929   machine.colortable = colortable_alloc(machine, 32);
r14976r14977
9090
9191static TILE_GET_INFO( bg_get_tile_info )
9292{
93   UINT8 *rom = machine.region("gfx4")->base();
93   UINT8 *rom = machine.root_device().memregion("gfx4")->base();
9494   digdug_state *state =  machine.driver_data<digdug_state>();
9595
9696   int code = rom[tile_index | (state->m_bg_select << 10)];
src/mame/video/ultratnk.c
r14976r14977
1111
1212PALETTE_INIT( ultratnk )
1313{
14   const UINT8 *color_prom = machine.region("proms")->base();
14   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1515   /* allocate the colortable */
1616   machine.colortable = colortable_alloc(machine, 4);
1717
src/mame/video/gunbustr.c
r14976r14977
6060{
6161   gunbustr_state *state = machine.driver_data<gunbustr_state>();
6262   UINT32 *spriteram32 = state->m_spriteram;
63   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
63   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
6464   int offs, data, tilenum, color, flipx, flipy;
6565   int x, y, priority, dblsize, curx, cury;
6666   int sprites_flipscreen = 0;
src/mame/video/scotrsht.c
r14976r14977
55/* Similar as Iron Horse */
66PALETTE_INIT( scotrsht )
77{
8   const UINT8 *color_prom = machine.region("proms")->base();
8   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
99   int i;
1010
1111   /* allocate the colortable */
src/mame/video/taito_z.c
r14976r14977
147147static void contcirc_draw_sprites_16x8( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
148148{
149149   taitoz_state *state = machine.driver_data<taitoz_state>();
150   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
150   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
151151   UINT16 *spriteram = state->m_spriteram;
152152   int offs, data, tilenum, color, flipx, flipy;
153153   int x, y, priority, curx, cury;
r14976r14977
242242static void chasehq_draw_sprites_16x16( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
243243{
244244   taitoz_state *state = machine.driver_data<taitoz_state>();
245   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
245   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
246246   UINT16 *spriteram = state->m_spriteram;
247247   int offs, data, tilenum, color, flipx, flipy;
248248   int x, y, priority, curx, cury;
r14976r14977
428428static void bshark_draw_sprites_16x8( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
429429{
430430   taitoz_state *state = machine.driver_data<taitoz_state>();
431   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
431   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
432432   UINT16 *spriteram = state->m_spriteram;
433433   int offs, data, tilenum, color, flipx, flipy;
434434   int x, y, priority, curx, cury;
r14976r14977
524524static void sci_draw_sprites_16x8( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
525525{
526526   taitoz_state *state = machine.driver_data<taitoz_state>();
527   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
527   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
528528   UINT16 *spriteram = state->m_spriteram;
529529   int offs, start_offs, data, tilenum, color, flipx, flipy;
530530   int x, y, priority, curx, cury;
r14976r14977
629629static void aquajack_draw_sprites_16x8(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int y_offs)
630630{
631631   taitoz_state *state = machine.driver_data<taitoz_state>();
632   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
632   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
633633   UINT16 *spriteram = state->m_spriteram;
634634   int offs, data, tilenum, color, flipx, flipy;
635635   int x, y, priority, curx, cury;
r14976r14977
724724static void spacegun_draw_sprites_16x8(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int y_offs)
725725{
726726   taitoz_state *state = machine.driver_data<taitoz_state>();
727   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
727   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
728728   UINT16 *spriteram = state->m_spriteram;
729729   int offs, data, tilenum, color, flipx, flipy;
730730   int x, y, priority, curx, cury;
src/mame/video/phoenix.c
r14976r14977
7878
7979PALETTE_INIT( phoenix )
8080{
81   const UINT8 *color_prom = machine.region("proms")->base();
81   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8282   int i;
8383   rgb_t   *rgb;
8484
r14976r14977
9696
9797PALETTE_INIT( survival )
9898{
99   const UINT8 *color_prom = machine.region("proms")->base();
99   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
100100   int i;
101101   rgb_t   *rgb;
102102
r14976r14977
114114
115115PALETTE_INIT( pleiads )
116116{
117   const UINT8 *color_prom = machine.region("proms")->base();
117   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
118118   int i;
119119   rgb_t   *rgb;
120120
r14976r14977
178178   state->m_videoram_pg[0] = auto_alloc_array(machine, UINT8, 0x1000);
179179   state->m_videoram_pg[1] = auto_alloc_array(machine, UINT8, 0x1000);
180180
181   memory_configure_bank(machine, "bank1", 0, 1, state->m_videoram_pg[0], 0);
182   memory_configure_bank(machine, "bank1", 1, 1, state->m_videoram_pg[1], 0);
183   memory_set_bank(machine, "bank1", 0);
181   state->membank("bank1")->configure_entry(0, state->m_videoram_pg[0]);
182   state->membank("bank1")->configure_entry(1, state->m_videoram_pg[1]);
183   state->membank("bank1")->set_entry(0);
184184
185185   state->m_videoram_pg_index = 0;
186186   state->m_palette_bank = 0;
r14976r14977
226226
227227WRITE8_MEMBER(phoenix_state::phoenix_videoram_w)
228228{
229   UINT8 *rom = machine().region("maincpu")->base();
229   UINT8 *rom = memregion("maincpu")->base();
230230
231231   m_videoram_pg[m_videoram_pg_index][offset] = data;
232232
r14976r14977
249249   {
250250      /* set memory bank */
251251      m_videoram_pg_index = data & 1;
252      memory_set_bank(machine(), "bank1", m_videoram_pg_index);
252      membank("bank1")->set_entry(m_videoram_pg_index);
253253
254254      m_cocktail_mode = m_videoram_pg_index && (input_port_read(machine(), "CAB") & 0x01);
255255
r14976r14977
272272   {
273273      /* set memory bank */
274274      m_videoram_pg_index = data & 1;
275      memory_set_bank(machine(), "bank1", m_videoram_pg_index);
275      membank("bank1")->set_entry(m_videoram_pg_index);
276276
277277      m_cocktail_mode = m_videoram_pg_index && (input_port_read(machine(), "CAB") & 0x01);
278278
src/mame/video/markham.c
r14976r14977
1313
1414PALETTE_INIT( markham )
1515{
16   const UINT8 *color_prom = machine.region("proms")->base();
16   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1717   int i;
1818
1919   /* allocate the colortable */
src/mame/video/superqix.c
r14976r14977
127127   coin_counter_w(machine(), 0,data & 0x02);
128128   coin_counter_w(machine(), 1,data & 0x04);
129129
130   memory_set_bank(machine(), "bank1", (data & 0x08) >> 3);
130   membank("bank1")->set_entry((data & 0x08) >> 3);
131131
132132   m_nmi_mask = data & 0x10;
133133   flip_screen_set(data & 0x20);
r14976r14977
149149   m_nmi_mask = data & 0x08;
150150
151151   /* bits 4-5 control ROM bank */
152   memory_set_bank(machine(), "bank1", (data & 0x30) >> 4);
152   membank("bank1")->set_entry((data & 0x30) >> 4);
153153}
154154
155155
src/mame/video/playch10.c
r14976r14977
1616
1717PALETTE_INIT( playch10 )
1818{
19   const UINT8 *color_prom = machine.region("proms")->base();
19   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2020   ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
2121   int i;
2222
r14976r14977
9393VIDEO_START( playch10 )
9494{
9595   playch10_state *state = machine.driver_data<playch10_state>();
96   const UINT8 *bios = machine.region("maincpu")->base();
96   const UINT8 *bios = state->memregion("maincpu")->base();
9797   state->m_pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
9898
9999   state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
r14976r14977
103103VIDEO_START( playch10_hboard )
104104{
105105   playch10_state *state = machine.driver_data<playch10_state>();
106   const UINT8 *bios = machine.region("maincpu")->base();
106   const UINT8 *bios = state->memregion("maincpu")->base();
107107   state->m_pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
108108
109109   state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
src/mame/video/dday.c
r14976r14977
5050
5151PALETTE_INIT( dday )
5252{
53   const UINT8 *color_prom = machine.region("proms")->base();
53   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5454   int i;
5555
5656   palette_set_shadow_factor(machine, 1.0 / 8);
r14976r14977
187187   int code, sl_flipx, flipx;
188188   UINT8* sl_map;
189189
190   sl_map = &machine.region("user1")->base()[(state->m_sl_image & 0x07) * 0x0200];
190   sl_map = &state->memregion("user1")->base()[(state->m_sl_image & 0x07) * 0x0200];
191191
192192   flipx = (tile_index >> 4) & 0x01;
193193   sl_flipx = (state->m_sl_image >> 3) & 0x01;
src/mame/video/lockon.c
r14976r14977
100100
101101PALETTE_INIT( lockon )
102102{
103   const UINT8 *color_prom = machine.region("proms")->base();
103   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
104104   int i;
105105
106106   for (i = 0; i < 1024; ++i)
r14976r14977
172172   UINT32 y;
173173
174174   /* 3bpp characters */
175   const UINT8 *const gfx1 = machine.region("gfx2")->base();
175   const UINT8 *const gfx1 = state->memregion("gfx2")->base();
176176   const UINT8 *const gfx2 = gfx1 + 0x10000;
177177   const UINT8 *const gfx3 = gfx1 + 0x20000;
178178   const UINT8 *const clut = gfx1 + 0x30000;
r14976r14977
308308   lockon_state *state = machine.driver_data<lockon_state>();
309309
310310   /* ROM pointers */
311   const UINT8 *const gfx_rom  = machine.region("gfx4")->base();
311   const UINT8 *const gfx_rom  = state->memregion("gfx4")->base();
312312   const UINT8 *const lut_rom  = gfx_rom + 0x30000 + ((state->m_ground_ctrl >> 2) & 0x3 ? 0x10000 : 0);
313313   const UINT8 *const clut_rom = gfx_rom + 0x50000;
314314
r14976r14977
435435   UINT32 offs;
436436   lockon_state *state = machine.driver_data<lockon_state>();
437437
438   const UINT8  *const romlut = machine.region("user1")->base();
439   const UINT16 *const chklut = (UINT16*)machine.region("user2")->base();
440   const UINT8  *const gfxrom = machine.region("gfx5")->base();
441   const UINT8  *const sproms = machine.region("proms")->base() + 0x800;
438   const UINT8  *const romlut = state->memregion("user1")->base();
439   const UINT16 *const chklut = (UINT16*)state->memregion("user2")->base();
440   const UINT8  *const gfxrom = state->memregion("gfx5")->base();
441   const UINT8  *const sproms = state->memregion("proms")->base() + 0x800;
442442
443443   for (offs = 0; offs < state->m_objectram_size; offs += 4)
444444   {
r14976r14977
799799static void hud_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
800800{
801801   lockon_state *state = machine.driver_data<lockon_state>();
802   UINT8   *tile_rom = machine.region("gfx3")->base();
802   UINT8   *tile_rom = state->memregion("gfx3")->base();
803803   UINT32 offs;
804804
805805   for (offs = 0x0; offs <= state->m_hudram_size; offs += 2)
src/mame/video/mappy.c
r14976r14977
3232
3333PALETTE_INIT( superpac )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   static const int resistances[3] = { 1000, 470, 220 };
3737   double rweights[3], gweights[3], bweights[2];
3838   int i;
r14976r14977
9292
9393PALETTE_INIT( mappy )
9494{
95   const UINT8 *color_prom = machine.region("proms")->base();
95   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9696   static const int resistances[3] = { 1000, 470, 220 };
9797   double rweights[3], gweights[3], bweights[2];
9898   int i;
r14976r14977
164164
165165PALETTE_INIT( phozon )
166166{
167   const UINT8 *color_prom = machine.region("proms")->base();
167   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
168168   static const int resistances[4] = { 2200, 1000, 470, 220 };
169169   double rweights[4], gweights[4], bweights[4];
170170   int i;
src/mame/video/tigeroad.c
r14976r14977
112112static TILE_GET_INFO( get_bg_tile_info )
113113{
114114   tigeroad_state *state = machine.driver_data<tigeroad_state>();
115   UINT8 *tilerom = machine.region("gfx4")->base();
115   UINT8 *tilerom = state->memregion("gfx4")->base();
116116
117117   int data = tilerom[tile_index];
118118   int attr = tilerom[tile_index + 1];
src/mame/video/segas32.c
r14976r14977
16651665   };
16661666
16671667   bitmap_ind16 &bitmap = *state->m_layer_data[(!state->m_is_multi32 || !(data[3] & 0x0800)) ? MIXER_LAYER_SPRITES_2 : MIXER_LAYER_MULTISPR_2].bitmap;
1668   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x400000;
1669   const UINT32 *spritebase = (const UINT32 *)machine.region("gfx2")->base();
1668   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x400000;
1669   const UINT32 *spritebase = (const UINT32 *)machine.root_device().memregion("gfx2")->base();
16701670
16711671   int indirect = data[0] & 0x2000;
16721672   int indlocal = data[0] & 0x1000;
src/mame/video/quizdna.c
r14976r14977
2929{
3030   quizdna_state *state = machine.driver_data<quizdna_state>();
3131   int code,col,x,y;
32   UINT8 *FG = machine.region("user1")->base();
32   UINT8 *FG = state->memregion("user1")->base();
3333
3434   x = tile_index & 0x1f;
3535   y = FG[(tile_index >> 5) & 0x1f] & 0x3f;
r14976r14977
6565
6666WRITE8_MEMBER(quizdna_state::quizdna_bg_ram_w)
6767{
68   UINT8 *RAM = machine().region("maincpu")->base();
68   UINT8 *RAM = memregion("maincpu")->base();
6969   m_bg_ram[offset] = data;
7070   RAM[0x12000+offset] = data;
7171
r14976r14977
7676{
7777   int i;
7878   int offs = offset & 0xfff;
79   UINT8 *RAM = machine().region("maincpu")->base();
79   UINT8 *RAM = memregion("maincpu")->base();
8080
8181   RAM[0x10000+offs] = data;
8282   RAM[0x11000+offs] = data; /* mirror */
src/mame/video/equites.c
r14976r14977
1010
1111PALETTE_INIT( equites )
1212{
13   const UINT8 *color_prom = machine.region("proms")->base();
13   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1414   int i;
1515
1616   machine.colortable = colortable_alloc(machine, 256);
r14976r14977
3030
3131PALETTE_INIT( splndrbt )
3232{
33   const UINT8 *color_prom = machine.region("proms")->base();
33   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3434   int i;
3535
3636   machine.colortable = colortable_alloc(machine, 256);
r14976r14977
327327static void splndrbt_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
328328{
329329   equites_state *state = machine.driver_data<equites_state>();
330   const UINT8 * const xrom = machine.region("user2")->base();
330   const UINT8 * const xrom = state->memregion("user2")->base();
331331   const UINT8 * const yrom = xrom + 0x100;
332332   const gfx_element* const gfx = machine.gfx[2];
333333   int offs;
r14976r14977
405405   equites_state *state = machine.driver_data<equites_state>();
406406   bitmap_ind16 &src_bitmap = state->m_bg_tilemap->pixmap();
407407   bitmap_ind8 &flags_bitmap = state->m_bg_tilemap->flagsmap();
408   const UINT8 * const xrom = machine.region("user1")->base();
408   const UINT8 * const xrom = state->memregion("user1")->base();
409409   const UINT8 * const yrom = xrom + 0x2000;
410410   int scroll_x = state->m_splndrbt_bg_scrollx;
411411   int scroll_y = state->m_splndrbt_bg_scrolly;
src/mame/video/gradius3.c
r14976r14977
101101
102102READ16_MEMBER(gradius3_state::gradius3_gfxrom_r)
103103{
104   UINT8 *gfxdata = machine().region("gfx2")->base();
104   UINT8 *gfxdata = memregion("gfx2")->base();
105105
106106   return (gfxdata[2 * offset + 1] << 8) | gfxdata[2 * offset];
107107}
src/mame/video/mystwarr.c
r14976r14977
1515// reading the original raw data
1616static void mystwarr_decode_tiles(running_machine &machine)
1717{
18   UINT8 *s = machine.region("gfx1")->base();
19   int len = machine.region("gfx1")->bytes();
18   UINT8 *s = machine.root_device().memregion("gfx1")->base();
19   int len = machine.root_device().memregion("gfx1")->bytes();
2020   UINT8 *pFinish = s+len-3;
2121   UINT8 *d, *decoded;
2222   int gfxnum;
r14976r14977
144144{
145145   mystwarr_state *state = machine.driver_data<mystwarr_state>();
146146   int tileno, colour;
147   UINT8 *ROM = machine.region("gfx4")->base();
147   UINT8 *ROM = state->memregion("gfx4")->base();
148148   UINT8 *dat1 = ROM, *dat2 = ROM + 0x20000, *dat3 = ROM + 0x60000;
149149
150150   tileno = dat3[tile_index] | ((dat2[tile_index]&0x3f)<<8);
r14976r14977
193193{
194194   mystwarr_state *state = machine.driver_data<mystwarr_state>();
195195   int tileno, colour;
196   UINT8 *ROM = machine.region("gfx4")->base();
196   UINT8 *ROM = state->memregion("gfx4")->base();
197197   UINT8 *dat1 = ROM, *dat2 = ROM + 0x40000;
198198
199199   tileno = dat2[tile_index] | ((dat1[tile_index]&0x1f)<<8);
r14976r14977
449449// reference: 223e5c in gaiapolis (ROMs 34j and 36m)
450450READ16_MEMBER(mystwarr_state::gai_053936_tilerom_0_r)
451451{
452   UINT8 *ROM1 = (UINT8 *)machine().region("gfx4")->base();
453   UINT8 *ROM2 = (UINT8 *)machine().region("gfx4")->base();
452   UINT8 *ROM1 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
453   UINT8 *ROM2 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
454454
455455   ROM1 += 0x20000;
456456   ROM2 += 0x20000+0x40000;
r14976r14977
460460
461461READ16_MEMBER(mystwarr_state::ddd_053936_tilerom_0_r)
462462{
463   UINT8 *ROM1 = (UINT8 *)machine().region("gfx4")->base();
464   UINT8 *ROM2 = (UINT8 *)machine().region("gfx4")->base();
463   UINT8 *ROM1 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
464   UINT8 *ROM2 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
465465
466466   ROM2 += 0x40000;
467467
r14976r14977
471471// reference: 223e1a in gaiapolis (ROM 36j)
472472READ16_MEMBER(mystwarr_state::ddd_053936_tilerom_1_r)
473473{
474   UINT8 *ROM = (UINT8 *)machine().region("gfx4")->base();
474   UINT8 *ROM = (UINT8 *)machine().root_device().memregion("gfx4")->base();
475475
476476   return ROM[offset/2];
477477}
r14976r14977
479479// reference: 223db0 in gaiapolis (ROMs 32n, 29n, 26n)
480480READ16_MEMBER(mystwarr_state::gai_053936_tilerom_2_r)
481481{
482   UINT8 *ROM = (UINT8 *)machine().region("gfx3")->base();
482   UINT8 *ROM = (UINT8 *)machine().root_device().memregion("gfx3")->base();
483483
484484   offset += (m_roz_rombank * 0x100000);
485485
r14976r14977
488488
489489READ16_MEMBER(mystwarr_state::ddd_053936_tilerom_2_r)
490490{
491   UINT8 *ROM = (UINT8 *)machine().region("gfx3")->base();
491   UINT8 *ROM = (UINT8 *)machine().root_device().memregion("gfx3")->base();
492492
493493   offset += (m_roz_rombank * 0x100000);
494494
src/mame/video/sega16sp.c
r14976r14977
7878
7979void segaic16_sprites_hangon_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
8080{
81   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000;
82   const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base();
83   const UINT8 *zoom = (const UINT8 *)machine.region("proms")->base();
81   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x10000;
82   const UINT16 *spritebase = (const UINT16 *)machine.root_device().memregion("gfx2")->base();
83   const UINT8 *zoom = (const UINT8 *)machine.root_device().memregion("proms")->base();
8484   sega16sp_state *sega16sp = get_safe_token(device);
8585   UINT16* data = sega16sp->spriteram;
8686
r14976r14977
243243
244244void segaic16_sprites_sharrier_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
245245{
246   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x20000;
247   const UINT32 *spritebase = (const UINT32 *)machine.region("gfx2")->base();
248   const UINT8 *zoom = (const UINT8 *)machine.region("proms")->base();
246   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x20000;
247   const UINT32 *spritebase = (const UINT32 *)machine.root_device().memregion("gfx2")->base();
248   const UINT8 *zoom = (const UINT8 *)machine.root_device().memregion("proms")->base();
249249   sega16sp_state *sega16sp = get_safe_token(device);
250250   UINT16* data = sega16sp->spriteram;
251251
r14976r14977
414414
415415void segaic16_sprites_16a_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
416416{
417   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000;
418   const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base();
417   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x10000;
418   const UINT16 *spritebase = (const UINT16 *)machine.root_device().memregion("gfx2")->base();
419419   sega16sp_state *sega16sp = get_safe_token(device);
420420   UINT16* data = sega16sp->spriteram;
421421
r14976r14977
580580   sega16sp_state *sega16sp = get_safe_token(device);
581581   UINT16* data = sega16sp->spriteram;
582582
583   spritebase = (const UINT16 *)machine.region("gfx2")->base();
583   spritebase = (const UINT16 *)machine.root_device().memregion("gfx2")->base();
584584   if (!spritebase)
585585      return;
586586
587   numbanks = machine.region("gfx2")->bytes() / 0x20000;
587   numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x20000;
588588
589589   /* first scan forward to find the end of the list */
590590   for (data = sega16sp->spriteram; data < sega16sp->spriteram + sega16sp->ramsize/2; data += 8)
r14976r14977
741741
742742void segaic16_sprites_yboard_16b_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
743743{
744   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x20000;
745   const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base();
744   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x20000;
745   const UINT16 *spritebase = (const UINT16 *)machine.root_device().memregion("gfx2")->base();
746746   sega16sp_state *sega16sp = get_safe_token(device);
747747   UINT16* data = sega16sp->spriteram;
748748
r14976r14977
919919
920920static void segaic16_sprites_xboard_outrun_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int type)
921921{
922   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x40000;
923   const UINT32 *spritebase = (const UINT32 *)machine.region("gfx2")->base();
922   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x40000;
923   const UINT32 *spritebase = (const UINT32 *)machine.root_device().memregion("gfx2")->base();
924924   sega16sp_state *sega16sp = get_safe_token(device);
925925   UINT16* data = sega16sp->spriteram;
926926
r14976r14977
10901090
10911091void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
10921092{
1093   UINT8 numbanks = machine.region("gfx1")->bytes() / 0x80000;
1094   const UINT64 *spritebase = (const UINT64 *)machine.region("gfx1")->base();
1093   UINT8 numbanks = machine.root_device().memregion("gfx1")->bytes() / 0x80000;
1094   const UINT64 *spritebase = (const UINT64 *)machine.root_device().memregion("gfx1")->base();
10951095   const UINT16 *rotatebase = segaic16_rotate[0].buffer ? segaic16_rotate[0].buffer : segaic16_rotate[0].rotateram;
10961096   UINT8 visited[0x1000];
10971097   sega16sp_state *sega16sp = get_safe_token(device);
r14976r14977
13841384
13851385void segaic16_sprites_16a_bootleg_wb3bl_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
13861386{
1387   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000;
1388   const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base();
1387   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x10000;
1388   const UINT16 *spritebase = (const UINT16 *)machine.root_device().memregion("gfx2")->base();
13891389   sega16sp_state *sega16sp = get_safe_token(device);
13901390   UINT16* data = sega16sp->spriteram;
13911391
r14976r14977
14071407/* 4 player passing shot is different to this.. */
14081408void segaic16_sprites_16a_bootleg_passhtb_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
14091409{
1410   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000;
1411   const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base();
1410   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x10000;
1411   const UINT16 *spritebase = (const UINT16 *)machine.root_device().memregion("gfx2")->base();
14121412   sega16sp_state *sega16sp = get_safe_token(device);
14131413   UINT16* data = sega16sp->spriteram;
14141414
r14976r14977
14291429
14301430void segaic16_sprites_16a_bootleg_shinobld_draw(running_machine &machine, device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
14311431{
1432   UINT8 numbanks = machine.region("gfx2")->bytes() / 0x10000;
1433   const UINT16 *spritebase = (const UINT16 *)machine.region("gfx2")->base();
1432   UINT8 numbanks = machine.root_device().memregion("gfx2")->bytes() / 0x10000;
1433   const UINT16 *spritebase = (const UINT16 *)machine.root_device().memregion("gfx2")->base();
14341434   sega16sp_state *sega16sp = get_safe_token(device);
14351435   UINT16* data = sega16sp->spriteram;
14361436
src/mame/video/irobot.c
r14976r14977
3939
4040PALETTE_INIT( irobot )
4141{
42   const UINT8 *color_prom = machine.region("proms")->base();
42   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4343   int i;
4444
4545   /* convert the color prom for the text palette */
src/mame/video/skykid.c
r14976r14977
1717
1818PALETTE_INIT( skykid )
1919{
20   const UINT8 *color_prom = machine.region("proms")->base();
20   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2121   int i;
2222
2323   /* allocate the colortable */
src/mame/video/gomoku.c
r14976r14977
2020
2121PALETTE_INIT( gomoku )
2222{
23   const UINT8 *color_prom = machine.region("proms")->base();
23   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2424   int i;
2525   int bit0, bit1, bit2, r, g, b;
2626
r14976r14977
106106VIDEO_START( gomoku )
107107{
108108   gomoku_state *state = machine.driver_data<gomoku_state>();
109   UINT8 *GOMOKU_BG_X = machine.region( "user1" )->base();
110   UINT8 *GOMOKU_BG_Y = machine.region( "user2" )->base();
111   UINT8 *GOMOKU_BG_D = machine.region( "user3" )->base();
109   UINT8 *GOMOKU_BG_X = machine.root_device().memregion( "user1" )->base();
110   UINT8 *GOMOKU_BG_Y = machine.root_device().memregion( "user2" )->base();
111   UINT8 *GOMOKU_BG_D = state->memregion( "user3" )->base();
112112   int x, y;
113113   int bgdata;
114114   int color;
r14976r14977
149149SCREEN_UPDATE_IND16( gomoku )
150150{
151151   gomoku_state *state = screen.machine().driver_data<gomoku_state>();
152   UINT8 *GOMOKU_BG_X = screen.machine().region( "user1" )->base();
153   UINT8 *GOMOKU_BG_Y = screen.machine().region( "user2" )->base();
154   UINT8 *GOMOKU_BG_D = screen.machine().region( "user3" )->base();
152   UINT8 *GOMOKU_BG_X = screen.machine().root_device().memregion( "user1" )->base();
153   UINT8 *GOMOKU_BG_Y = screen.machine().root_device().memregion( "user2" )->base();
154   UINT8 *GOMOKU_BG_D = state->memregion( "user3" )->base();
155155   int x, y;
156156   int bgram;
157157   int bgoffs;
src/mame/video/konicdev.c
r14976r14977
5025021d00     : bits 0 & 1 might enable NMI and FIRQ, not sure
503503         : bit 2 = IRQ enable
5045041d80     : ROM bank selector bits 0-3 = bank 0 bits 4-7 = bank 1
5051e00     : ROM subbank selector for ROM testing
5051e00     : ROM membank selector for ROM testing
5065061e80     : bit 0 = flip screen (applies to tilemaps only, not sprites)
507507         : bit 1 = set by crimfght, mainevt, surpratk, xmen, mia, punkshot, thndrx2, spy
508508         :         it seems to enable tile flip X, however flip X is handled by the
r14976r14977
12131213/* helper function to join two 16-bit ROMs and form a 32-bit data stream */
12141214void konamid_rom_deinterleave_2(running_machine &machine, const char *mem_region)
12151215{
1216   konami_shuffle_16((UINT16 *)machine.region(mem_region)->base(),machine.region(mem_region)->bytes()/2);
1216   konami_shuffle_16((UINT16 *)machine.root_device().memregion(mem_region)->base(),machine.root_device().memregion(mem_region)->bytes()/2);
12171217}
12181218
12191219/* hacked version of rom_deinterleave_2_half for Lethal Enforcers */
12201220void konamid_rom_deinterleave_2_half(running_machine &machine, const char *mem_region)
12211221{
1222   UINT8 *rgn = machine.region(mem_region)->base();
1222   UINT8 *rgn = machine.root_device().memregion(mem_region)->base();
12231223
1224   konami_shuffle_16((UINT16 *)rgn,machine.region(mem_region)->bytes()/4);
1225   konami_shuffle_16((UINT16 *)(rgn+machine.region(mem_region)->bytes()/2),machine.region(mem_region)->bytes()/4);
1224   konami_shuffle_16((UINT16 *)rgn,machine.root_device().memregion(mem_region)->bytes()/4);
1225   konami_shuffle_16((UINT16 *)(rgn+machine.root_device().memregion(mem_region)->bytes()/2),machine.root_device().memregion(mem_region)->bytes()/4);
12261226}
12271227
12281228/* helper function to join four 16-bit ROMs and form a 64-bit data stream */
r14976r14977
12591259      konamid_rom_deinterleave_4(machine, gfx_memory_region);
12601260      break;
12611261   case KONAMI_ROM_SHUFFLE8:
1262      konami_shuffle_8(machine.region(gfx_memory_region)->base(), machine.region(gfx_memory_region)->bytes());
1262      konami_shuffle_8(machine.root_device().memregion(gfx_memory_region)->base(), machine.root_device().memregion(gfx_memory_region)->bytes());
12631263      break;
12641264   }
12651265}
r14976r14977
22282228      k052109->callback(device->machine(), 0, bank, &code, &color, &flags, &priority);
22292229
22302230      addr = (code << 5) + (offset & 0x1f);
2231      addr &= device->machine().region(k052109->memory_region)->bytes() - 1;
2231      addr &= device->machine().root_device().memregion(k052109->memory_region)->bytes() - 1;
22322232
22332233//      logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", cpu_get_pc(&space->device()), offset, k052109->romsubbank, bank, addr);
22342234
2235      return device->machine().region(k052109->memory_region)->base()[addr];
2235      return device->machine().root_device().memregion(k052109->memory_region)->base()[addr];
22362236   }
22372237}
22382238
r14976r14977
26962696   switch (intf->plane_order)
26972697   {
26982698   case NORMAL_PLANE_ORDER:
2699      total = machine.region(intf->gfx_memory_region)->bytes() / 32;
2700      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout, 4);
2699      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 32;
2700      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout, 4);
27012701      break;
27022702
27032703   case GRADIUS3_PLANE_ORDER:
27042704      total = 0x1000;
2705      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout_gradius3, 4);
2705      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout_gradius3, 4);
27062706      break;
27072707
27082708   default:
r14976r14977
28352835   k051960->callback(device->machine(), &code, &color, &pri, &shadow);
28362836
28372837   addr = (code << 7) | (off1 << 2) | byte;
2838   addr &= device->machine().region(k051960->memory_region)->bytes() - 1;
2838   addr &= device->machine().root_device().memregion(k051960->memory_region)->bytes() - 1;
28392839
28402840//  popmessage("%s: addr %06x", device->machine().describe_context(), addr);
28412841
2842   return device->machine().region(k051960->memory_region)->base()[addr];
2842   return device->machine().root_device().memregion(k051960->memory_region)->base()[addr];
28432843}
28442844
28452845READ8_DEVICE_HANDLER( k051960_r )
r14976r14977
32483248   switch (intf->plane_order)
32493249   {
32503250   case NORMAL_PLANE_ORDER:
3251      total = machine.region(intf->gfx_memory_region)->bytes() / 128;
3252      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &spritelayout, 4);
3251      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128;
3252      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout, 4);
32533253      break;
32543254
32553255   case REVERSE_PLANE_ORDER:
3256      total = machine.region(intf->gfx_memory_region)->bytes() / 128;
3257      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &spritelayout_reverse, 4);
3256      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128;
3257      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout_reverse, 4);
32583258      break;
32593259
32603260   case GRADIUS3_PLANE_ORDER:
32613261      total = 0x4000;
3262      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &spritelayout_gradius3, 4);
3262      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout_gradius3, 4);
32633263      break;
32643264
32653265   default:
r14976r14977
34303430      addr = (k053244->rombank << 19) | ((k053244->regs[11] & 0x7) << 18)
34313431         | (k053244->regs[8] << 10) | (k053244->regs[9] << 2)
34323432         | ((offset & 3) ^ 1);
3433      addr &= machine.region(k053244->memory_region)->bytes() - 1;
3433      addr &= machine.root_device().memregion(k053244->memory_region)->bytes() - 1;
34343434
34353435      //  popmessage("%s: offset %02x addr %06x", machine.describe_context(), offset & 3, addr);
34363436
3437      return machine.region(k053244->memory_region)->base()[addr];
3437      return machine.root_device().memregion(k053244->memory_region)->base()[addr];
34383438   }
34393439   else if (offset == 0x06)
34403440   {
r14976r14977
40594059   switch (intf->plane_order)
40604060   {
40614061   case NORMAL_PLANE_ORDER:
4062      total = machine.region(intf->gfx_memory_region)->bytes() / 128;
4063      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &spritelayout, 4);
4062      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128;
4063      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout, 4);
40644064      break;
40654065
40664066   default:
r14976r14977
42844284READ16_DEVICE_HANDLER( k055673_rom_word_r )   // 5bpp
42854285{
42864286   k053247_state *k053246 = k053247_get_safe_token(device);
4287   UINT8 *ROM8 = (UINT8 *)device->machine().region(k053246->memory_region)->base();
4288   UINT16 *ROM = (UINT16 *)device->machine().region(k053246->memory_region)->base();
4289   int size4 = (device->machine().region(k053246->memory_region)->bytes() / (1024 * 1024)) / 5;
4287   UINT8 *ROM8 = (UINT8 *)device->machine().root_device().memregion(k053246->memory_region)->base();
4288   UINT16 *ROM = (UINT16 *)device->machine().root_device().memregion(k053246->memory_region)->base();
4289   int size4 = (device->machine().root_device().memregion(k053246->memory_region)->bytes() / (1024 * 1024)) / 5;
42904290   int romofs;
42914291
42924292   size4 *= 4 * 1024 * 1024;   // get offset to 5th bit
r14976r14977
43234323READ16_DEVICE_HANDLER( k055673_GX6bpp_rom_word_r )
43244324{
43254325   k053247_state *k053246 = k053247_get_safe_token(device);
4326   UINT16 *ROM = (UINT16 *)device->machine().region(k053246->memory_region)->base();
4326   UINT16 *ROM = (UINT16 *)device->machine().root_device().memregion(k053246->memory_region)->base();
43274327   int romofs;
43284328
43294329   romofs = k053246->kx46_regs[6] << 16 | k053246->kx46_regs[7] << 8 | k053246->kx46_regs[4];
r14976r14977
43634363      int addr;
43644364
43654365      addr = (k053246->kx46_regs[6] << 17) | (k053246->kx46_regs[7] << 9) | (k053246->kx46_regs[4] << 1) | ((offset & 1) ^ 1);
4366      addr &= device->machine().region(k053246->memory_region)->bytes() - 1;
4366      addr &= device->machine().root_device().memregion(k053246->memory_region)->bytes() - 1;
43674367//      if (VERBOSE)
43684368//          popmessage("%04x: offset %02x addr %06x", cpu_get_pc(&space->device()), offset, addr);
4369      return device->machine().region(k053246->memory_region)->base()[addr];
4369      return device->machine().root_device().memregion(k053246->memory_region)->base()[addr];
43704370   }
43714371   else
43724372   {
r14976r14977
48954895   switch (intf->plane_order)
48964896   {
48974897   case NORMAL_PLANE_ORDER:
4898      total = machine.region(intf->gfx_memory_region)->bytes() / 128;
4899      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &spritelayout, 4);
4898      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128;
4899      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &spritelayout, 4);
49004900      break;
49014901
49024902   case TASMAN_PLANE_ORDER:
4903      total = machine.region(intf->gfx_memory_region)->bytes() / 128;
4904      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &tasman_16x16_layout, 4);
4903      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128;
4904      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &tasman_16x16_layout, 4);
49054905      break;
49064906
49074907   default:
r14976r14977
49994999
50005000   k053247->screen = machine.device<screen_device>(intf->screen);
50015001
5002   K055673_rom = (UINT16 *)machine.region(intf->gfx_memory_region)->base();
5002   K055673_rom = (UINT16 *)machine.root_device().memregion(intf->gfx_memory_region)->base();
50035003
50045004   /* decode the graphics */
50055005   switch (intf->plane_order)   /* layout would be more correct than plane_order, but we use k053247_interface */
50065006   {
50075007   case K055673_LAYOUT_GX:
5008      size4 = (machine.region(intf->gfx_memory_region)->bytes() / (1024 * 1024)) / 5;
5008      size4 = (machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (1024 * 1024)) / 5;
50095009      size4 *= 4 * 1024 * 1024;
50105010      /* set the # of tiles based on the 4bpp section */
50115011      K055673_rom = auto_alloc_array(machine, UINT16, size4 * 5 / 2);
50125012      d = (UINT8 *)K055673_rom;
50135013      // now combine the graphics together to form 5bpp
5014      s1 = machine.region(intf->gfx_memory_region)->base(); // 4bpp area
5014      s1 = machine.root_device().memregion(intf->gfx_memory_region)->base(); // 4bpp area
50155015      s2 = s1 + (size4);    // 1bpp area
50165016      for (i = 0; i < size4; i+= 4)
50175017      {
r14976r14977
50275027      break;
50285028
50295029   case K055673_LAYOUT_RNG:
5030      total = machine.region(intf->gfx_memory_region)->bytes() / (16 * 16 / 2);
5030      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (16 * 16 / 2);
50315031      decode_gfx(machine, intf->gfx_num, (UINT8 *)K055673_rom, total, &spritelayout2, 4);
50325032      break;
50335033
50345034   case K055673_LAYOUT_LE2:
5035      total = machine.region(intf->gfx_memory_region)->bytes() / (16 * 16);
5035      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (16 * 16);
50365036      decode_gfx(machine, intf->gfx_num, (UINT8 *)K055673_rom, total, &spritelayout3, 4);
50375037      break;
50385038
50395039   case K055673_LAYOUT_GX6:
5040      total = machine.region(intf->gfx_memory_region)->bytes() / (16 * 16 * 6 / 8);
5040      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (16 * 16 * 6 / 8);
50415041      decode_gfx(machine, intf->gfx_num, (UINT8 *)K055673_rom, total, &spritelayout4, 4);
50425042      break;
50435043
r14976r14977
51755175      int addr = offset + (k051316->ctrlram[0x0c] << 11) + (k051316->ctrlram[0x0d] << 19);
51765176      if (k051316->bpp <= 4)
51775177         addr /= 2;
5178      addr &= device->machine().region(k051316->memory_region)->bytes() - 1;
5178      addr &= device->machine().root_device().memregion(k051316->memory_region)->bytes() - 1;
51795179
51805180      //  popmessage("%s: offset %04x addr %04x", device->machine().describe_context(), offset, addr);
51815181
5182      return device->machine().region(k051316->memory_region)->base()[addr];
5182      return device->machine().root_device().memregion(k051316->memory_region)->base()[addr];
51835183   }
51845184   else
51855185   {
r14976r14977
53455345   case -4:
53465346      total = 0x400;
53475347      is_tail2nos = 1;
5348      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout_tail2nos, 4);
5348      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout_tail2nos, 4);
53495349      break;
53505350
53515351   case 4:
5352      total = machine.region(intf->gfx_memory_region)->bytes() / 128;
5353      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout4, 4);
5352      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 128;
5353      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout4, 4);
53545354      break;
53555355
53565356   case 7:
5357      total = machine.region(intf->gfx_memory_region)->bytes() / 256;
5358      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout7, 7);
5357      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 256;
5358      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout7, 7);
53595359      break;
53605360
53615361   case 8:
5362      total = machine.region(intf->gfx_memory_region)->bytes() / 256;
5363      decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout8, 8);
5362      total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 256;
5363      decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout8, 8);
53645364      break;
53655365
53665366   default:
r14976r14977
63816381   UINT8 *rombase;
63826382   int base, ret;
63836383
6384   rombase = (UINT8 *)device->machine().region(k056832->memory_region)->base();
6384   rombase = (UINT8 *)device->machine().root_device().memregion(k056832->memory_region)->base();
63856385
63866386   if ((k056832->rom_half) && (zerosec))
63876387   {
r14976r14977
64636463   int addr = 0x2000 * k056832->cur_gfx_banks + 2 * offset;
64646464
64656465   if (!k056832->rombase)
6466      k056832->rombase = device->machine().region(k056832->memory_region)->base();
6466      k056832->rombase = device->machine().root_device().memregion(k056832->memory_region)->base();
64676467
64686468   return k056832->rombase[addr + 1] | (k056832->rombase[addr] << 8);
64696469}
r14976r14977
64776477   int addr;
64786478
64796479   if (!k056832->rombase)
6480      k056832->rombase = device->machine().region(k056832->memory_region)->base();
6480      k056832->rombase = device->machine().root_device().memregion(k056832->memory_region)->base();
64816481
64826482   if (k056832->regsb[2] & 0x8)
64836483   {
r14976r14977
65406540   int addr = 0x4000 * k056832->cur_gfx_banks + offset;
65416541
65426542   if (!k056832->rombase)
6543      k056832->rombase = device->machine().region(k056832->memory_region)->base();
6543      k056832->rombase = device->machine().root_device().memregion(k056832->memory_region)->base();
65446544
65456545   return k056832->rombase[addr + 2] | (k056832->rombase[addr] << 8);
65466546}
r14976r14977
65516551   int addr = 0x8000 * k056832->cur_gfx_banks + 2 * offset;
65526552
65536553   if (!k056832->rombase)
6554      k056832->rombase = device->machine().region(k056832->memory_region)->base();
6554      k056832->rombase = device->machine().root_device().memregion(k056832->memory_region)->base();
65556555
65566556   return k056832->rombase[addr + 2] | (k056832->rombase[addr] << 8);
65576557}
r14976r14977
65626562   int addr = 0x2000 * k056832->cur_gfx_banks + 2 * offset;
65636563
65646564   if (!k056832->rombase)
6565      k056832->rombase = device->machine().region(k056832->memory_region)->base();
6565      k056832->rombase = device->machine().root_device().memregion(k056832->memory_region)->base();
65666566
65676567   return k056832->rombase[addr + 1] | (k056832->rombase[addr] << 8);
65686568}
r14976r14977
78497849   switch (intf->bpp)
78507850   {
78517851      case K056832_BPP_4:
7852         total = machine.region(intf->gfx_memory_region)->bytes() / (i * 4);
7853         decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout4, 4);
7852         total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (i * 4);
7853         decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout4, 4);
78547854         break;
78557855
78567856      case K056832_BPP_5:
7857         total = machine.region(intf->gfx_memory_region)->bytes() / (i * 5);
7858         decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout5, 4);
7857         total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (i * 5);
7858         decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout5, 4);
78597859         break;
78607860
78617861      case K056832_BPP_6:
7862         total = machine.region(intf->gfx_memory_region)->bytes() / (i * 6);
7863         decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout6, 4);
7862         total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (i * 6);
7863         decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout6, 4);
78647864         break;
78657865
78667866      case K056832_BPP_8:
7867         total = machine.region(intf->gfx_memory_region)->bytes() / (i * 8);
7868         decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout8, 4);
7867         total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (i * 8);
7868         decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout8, 4);
78697869         break;
78707870
78717871      case K056832_BPP_8LE:
7872         total = machine.region(intf->gfx_memory_region)->bytes() / (i * 8);
7873         decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout8le, 4);
7872         total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (i * 8);
7873         decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout8le, 4);
78747874         break;
78757875
78767876      case K056832_BPP_8TASMAN:
7877         total = machine.region(intf->gfx_memory_region)->bytes() / (i * 8);
7878         decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout8_tasman, 4);
7877         total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (i * 8);
7878         decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout8_tasman, 4);
78797879         break;
78807880
78817881      case K056832_BPP_4dj:
7882         total = machine.region(intf->gfx_memory_region)->bytes() / (i * 4);
7883         decode_gfx(machine, intf->gfx_num, machine.region(intf->gfx_memory_region)->base(), total, &charlayout4dj, 4);
7882         total = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / (i * 4);
7883         decode_gfx(machine, intf->gfx_num, machine.root_device().memregion(intf->gfx_memory_region)->base(), total, &charlayout4dj, 4);
78847884         break;
78857885
78867886      default:
r14976r14977
78967896   k056832->gfxnum = intf->gfx_num;
78977897   k056832->callback = intf->callback;
78987898
7899   k056832->rombase = machine.region(intf->gfx_memory_region)->base();
7900   k056832->num_gfx_banks = machine.region(intf->gfx_memory_region)->bytes() / 0x2000;
7899   k056832->rombase = machine.root_device().memregion(intf->gfx_memory_region)->base();
7900   k056832->num_gfx_banks = machine.root_device().memregion(intf->gfx_memory_region)->bytes() / 0x2000;
79017901   k056832->djmain_hack = intf->djmain_hack;
79027902
79037903   k056832->cur_gfx_banks = 0;
r14976r14977
84958495      {
84968496         case 0x0b:      // CG Board ROM read
84978497         {
8498            UINT16 *rom = (UINT16*)device->machine().region(k001006->gfx_region)->base();
8498            UINT16 *rom = (UINT16*)device->machine().root_device().memregion(k001006->gfx_region)->base();
84998499            return rom[k001006->addr / 2] << 16;
85008500         }
85018501         case 0x0d:      // Palette RAM read
r14976r14977
94729472   height = k001005->screen->height();
94739473   k001005->zbuffer = auto_bitmap_ind32_alloc(device->machine(), width, height);
94749474
9475   k001005->gfxrom = device->machine().region(intf->gfx_memory_region)->base();
9475   k001005->gfxrom = device->machine().root_device().memregion(intf->gfx_memory_region)->base();
94769476
94779477   k001005->bitmap[0] = auto_bitmap_rgb32_alloc(device->machine(), k001005->screen->width(), k001005->screen->height());
94789478   k001005->bitmap[1] = auto_bitmap_rgb32_alloc(device->machine(), k001005->screen->width(), k001005->screen->height());
src/mame/video/firetrk.c
r14976r14977
6565
6666PALETTE_INIT( montecar )
6767{
68   const UINT8 *color_prom = machine.region("proms")->base();
68   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6969   firetrk_state *state = machine.driver_data<firetrk_state>();
7070   int i;
7171
src/mame/video/m57.c
r14976r14977
3232
3333PALETTE_INIT( m57 )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   int i;
3737
3838   machine.colortable = colortable_alloc(machine, 32 * 8 + 16);
src/mame/video/mustache.c
r14976r14977
1212
1313PALETTE_INIT(mustache)
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   for (i = 0;i < 256;i++)
src/mame/video/neogeo.c
r14976r14977
271271   neogeo_state *state = machine.driver_data<neogeo_state>();
272272   int x;
273273
274   UINT8* gfx_base = machine.region(state->m_fixed_layer_source ? "fixed" : "fixedbios")->base();
275   UINT32 addr_mask = machine.region(state->m_fixed_layer_source ? "fixed" : "fixedbios")->bytes() - 1;
274   UINT8* gfx_base = machine.root_device().memregion(state->m_fixed_layer_source ? "fixed" : "fixedbios")->base();
275   UINT32 addr_mask = state->memregion(state->m_fixed_layer_source ? "fixed" : "fixedbios")->bytes() - 1;
276276   UINT16 *video_data = &state->m_videoram[0x7000 | (scanline >> 3)];
277277   UINT32 *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND);
278278
r14976r14977
689689       power of 2 */
690690   state->m_sprite_gfx_address_mask = 0xffffffff;
691691
692   len = machine.region("sprites")->bytes();
692   len = state->memregion("sprites")->bytes();
693693
694694   for (bit = 0x80000000; bit != 0; bit >>= 1)
695695   {
r14976r14977
701701
702702   state->m_sprite_gfx = auto_alloc_array_clear(machine, UINT8, state->m_sprite_gfx_address_mask + 1);
703703
704   src = machine.region("sprites")->base();
704   src = machine.root_device().memregion("sprites")->base();
705705   dest = state->m_sprite_gfx;
706706
707707   for (i = 0; i < len; i += 0x80, src += 0x80)
r14976r14977
892892
893893   machine.save().register_postload(save_prepost_delegate(FUNC(regenerate_pens), &machine));
894894
895   state->m_region_zoomy = machine.region("zoomy")->base();
895   state->m_region_zoomy = state->memregion("zoomy")->base();
896896}
897897
898898
src/mame/video/snookr10.c
r14976r14977
5757
5858PALETTE_INIT( snookr10 )
5959{
60   const UINT8 *color_prom = machine.region("proms")->base();
60   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6161   /* GGBBBRRR */
6262
6363   int i;
r14976r14977
118118
119119PALETTE_INIT( apple10 )
120120{
121   const UINT8 *color_prom = machine.region("proms")->base();
121   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
122122   /* GGBBBRRR */
123123
124124   int i, cn;
src/mame/video/konamigx.c
r14976r14977
18631863 static TILE_GET_INFO( get_gx_psac3_tile_info )
18641864 {
18651865   int tileno, colour, flip;
1866   UINT8 *tmap = machine.region("gfx4")->base();
1866   UINT8 *tmap = machine.root_device().memregion("gfx4")->base();
18671867
18681868   int base_index = tile_index;
18691869
r14976r14977
18841884 static TILE_GET_INFO( get_gx_psac3_alt_tile_info )
18851885 {
18861886   int tileno, colour, flip;
1887   UINT8 *tmap = machine.region("gfx4")->base()+0x20000;
1887   UINT8 *tmap = machine.root_device().memregion("gfx4")->base()+0x20000;
18881888
18891889   int base_index = tile_index;
18901890
src/mame/video/sprcros2.c
r14976r14977
99
1010PALETTE_INIT( sprcros2 )
1111{
12   const UINT8 *color_prom = machine.region("proms")->base();
12   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1313   int i;
1414
1515   /* allocate the colortable */
src/mame/video/ladybug.c
r14976r14977
9595
9696PALETTE_INIT( ladybug )
9797{
98   const UINT8 *color_prom = machine.region("proms")->base();
98   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9999   palette_init_common(machine, color_prom, 0x20, 0, 5, 2, 6, 4, 7);
100100}
101101
102102PALETTE_INIT( sraider )
103103{
104   const UINT8 *color_prom = machine.region("proms")->base();
104   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
105105   int i;
106106
107107   /* the resistor net may be probably different than Lady Bug */
src/mame/video/combatsc.c
r14976r14977
1212
1313PALETTE_INIT( combatsc )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int pal;
1717
1818   /* allocate the colortable */
r14976r14977
6363
6464PALETTE_INIT( combatscb )
6565{
66   const UINT8 *color_prom = machine.region("proms")->base();
66   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6767   int pal;
6868
6969   /* allocate the colortable */
src/mame/video/rockrage.c
r14976r14977
44
55PALETTE_INIT( rockrage )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99
1010   /* allocate the colortable */
src/mame/video/ppu2c0x.c
r14976r14977
410410
411411   int R, G, B;
412412
413   UINT8 *palette_data = machine.region("palette")->base();
413   UINT8 *palette_data = machine.root_device().memregion("palette")->base();
414414
415415   /* Loop through the emphasis modes (8 total) */
416416   for (color_emphasis = 0; color_emphasis < 8; color_emphasis++)
src/mame/video/buggychl.c
r14976r14977
166166
167167   g_profiler.start(PROFILER_USER1);
168168
169   gfx = machine.region("gfx2")->base();
169   gfx = state->memregion("gfx2")->base();
170170   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
171171   {
172172      int sx, sy, flipy, zoom, ch, x, px, y;
src/mame/video/pandoras.c
r14976r14977
2323
2424PALETTE_INIT( pandoras )
2525{
26   const UINT8 *color_prom = machine.region("proms")->base();
26   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2727   static const int resistances_rg[3] = { 1000, 470, 220 };
2828   static const int resistances_b [2] = { 470, 220 };
2929   double rweights[3], gweights[3], bweights[2];
src/mame/video/gberet.c
r14976r14977
2323
2424PALETTE_INIT( gberet )
2525{
26   const UINT8 *color_prom = machine.region("proms")->base();
26   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2727   int i;
2828
2929   /* allocate the colortable */
src/mame/video/stfight.c
r14976r14977
3232
3333PALETTE_INIT( stfight )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   int i;
3737
3838   /* allocate the colortable */
r14976r14977
9797
9898static TILE_GET_INFO( get_fg_tile_info )
9999{
100   UINT8   *fgMap = machine.region("gfx5")->base();
100   UINT8   *fgMap = machine.root_device().memregion("gfx5")->base();
101101   int attr,tile_base;
102102
103103   attr = fgMap[0x8000+tile_index];
r14976r14977
120120
121121static TILE_GET_INFO( get_bg_tile_info )
122122{
123   UINT8   *bgMap = machine.region("gfx6")->base();
123   UINT8   *bgMap = machine.root_device().memregion("gfx6")->base();
124124   int attr,tile_bank,tile_base;
125125
126126   attr = bgMap[0x8000+tile_index];
src/mame/video/n64.h
r14976r14977
418418         m_tmem = auto_alloc_array(machine(), UINT8, 0x1000);
419419         memset(m_tmem, 0, 0x1000);
420420
421         UINT8 *normpoint = machine().region("normpoint")->base();
422         UINT8 *normslope = machine().region("normslope")->base();
421         UINT8 *normpoint = machine().root_device().memregion("normpoint")->base();
422         UINT8 *normslope = machine().root_device().memregion("normslope")->base();
423423
424424         for(INT32 i = 0; i < 64; i++)
425425         {
src/mame/video/tubep.c
r14976r14977
133133
134134PALETTE_INIT( tubep )
135135{
136   const UINT8 *color_prom = machine.region("proms")->base();
136   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
137137   tubep_state *state = machine.driver_data<tubep_state>();
138138   int i,r,g,b;
139139
r14976r14977
437437   tubep_state *state = machine.driver_data<tubep_state>();
438438   UINT32   XDOT;
439439   UINT32   YDOT;
440   UINT8 * romCxx  = machine.region("user2")->base()+0x00000;
440   UINT8 * romCxx  = state->memregion("user2")->base()+0x00000;
441441   UINT8 * romD10  = romCxx+0x10000;
442442   UINT8 * romEF13 = romCxx+0x12000;
443443   UINT8 * romHI2  = romCxx+0x14000;
r14976r14977
588588   pen_t pen_base = 32; //change it later
589589
590590   UINT32 v;
591   UINT8 *text_gfx_base = screen.machine().region("gfx1")->base();
592   UINT8 *romBxx = screen.machine().region("user1")->base() + 0x2000*state->m_background_romsel;
591   UINT8 *text_gfx_base = screen.machine().root_device().memregion("gfx1")->base();
592   UINT8 *romBxx = state->memregion("user1")->base() + 0x2000*state->m_background_romsel;
593593
594594   /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect.min_y, cliprect.max_y+1); */
595595
r14976r14977
686686
687687PALETTE_INIT( rjammer )
688688{
689   const UINT8 *color_prom = machine.region("proms")->base();
689   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
690690   int i;
691691
692692   static const int resistors_rg[3] = { 1000, 470, 220 };
r14976r14977
743743   int DISP_ = state->m_DISP^1;
744744
745745   UINT32 v;
746   UINT8 *text_gfx_base = screen.machine().region("gfx1")->base();
747   UINT8 *rom13D  = screen.machine().region("user1")->base();
746   UINT8 *text_gfx_base = screen.machine().root_device().memregion("gfx1")->base();
747   UINT8 *rom13D  = state->memregion("user1")->base();
748748   UINT8 *rom11BD = rom13D+0x1000;
749749   UINT8 *rom19C  = rom13D+0x5000;
750750
src/mame/video/homedata.c
r14976r14977
4141   int dest_addr;
4242   int base_addr;
4343   int opcode, data, num_tiles;
44   UINT8 *pBlitData = space->machine().region("user1")->base() + rom_base;
44   UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
4545
4646   dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
4747      state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
r14976r14977
127127   int flipx;
128128   int source_addr, base_addr;
129129   int dest_addr;
130   UINT8 *pBlitData = space->machine().region("user1")->base() + rom_base;
130   UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
131131
132132   int opcode, data, num_tiles;
133133
r14976r14977
225225   int source_addr;
226226   int dest_addr, base_addr;
227227   int opcode, data, num_tiles;
228   UINT8 *pBlitData = space->machine().region("user1")->base() + rom_base;
228   UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
229229
230230   dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
231231      state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
r14976r14977
315315
316316PALETTE_INIT( mrokumei )
317317{
318   const UINT8 *color_prom = machine.region("proms")->base();
318   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
319319   int i;
320320
321321   /* initialize 555 RGB palette */
r14976r14977
338338
339339PALETTE_INIT( reikaids )
340340{
341   const UINT8 *color_prom = machine.region("proms")->base();
341   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
342342   int i;
343343
344344   /* initialize 555 RGB palette */
r14976r14977
361361
362362PALETTE_INIT( pteacher )
363363{
364   const UINT8 *color_prom = machine.region("proms")->base();
364   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
365365   int i;
366366
367367   /* initialize 555 RGB palette */
r14976r14977
384384
385385PALETTE_INIT( mirderby )
386386{
387   const UINT8 *color_prom = machine.region("proms")->base();
387   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
388388   int i;
389389
390390   for (i = 0; i < 0x100; i++)
r14976r14977
819819
820820WRITE8_MEMBER(homedata_state::pteacher_blitter_start_w)
821821{
822   pteacher_handleblit(&space, (m_blitter_bank >> 5) * 0x10000 & (machine().region("user1")->bytes() - 1));
822   pteacher_handleblit(&space, (m_blitter_bank >> 5) * 0x10000 & (machine().root_device().memregion("user1")->bytes() - 1));
823823}
824824
825825
src/mame/video/pcktgal.c
r14976r14977
44
55PALETTE_INIT( pcktgal )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99
1010   for (i = 0;i < machine.total_colors();i++)
src/mame/video/hyhoo.c
r14976r14977
4141
4242WRITE8_MEMBER(hyhoo_state::hyhoo_romsel_w)
4343{
44   int gfxlen = machine().region("gfx1")->bytes();
44   int gfxlen = memregion("gfx1")->bytes();
4545   m_gfxrom = (((data & 0xc0) >> 4) + (data & 0x03));
4646   m_highcolorflag = data;
4747   nb1413m3_gfxrombank_w(&space, 0, data);
r14976r14977
6464static void hyhoo_gfxdraw(running_machine &machine)
6565{
6666   hyhoo_state *state = machine.driver_data<hyhoo_state>();
67   UINT8 *GFX = machine.region("gfx1")->base();
67   UINT8 *GFX = state->memregion("gfx1")->base();
6868
6969   int x, y;
7070   int dx1, dx2, dy;
r14976r14977
106106      skipy = -1;
107107   }
108108
109   gfxlen = machine.region("gfx1")->bytes();
109   gfxlen = machine.root_device().memregion("gfx1")->bytes();
110110   gfxaddr = (state->m_gfxrom << 17) + (state->m_blitter_src_addr << 1);
111111
112112   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
src/mame/video/hng64.c
r14976r14977
20562056    //////////////////////////////////////////////*/
20572057
20582058   // 3d ROM Offset
2059   UINT16* threeDRoms = (UINT16*)(machine.region("verts")->base());
2059   UINT16* threeDRoms = (UINT16*)(machine.root_device().memregion("verts")->base());
20602060   UINT32  threeDOffset = (((UINT32)packet[2]) << 16) | ((UINT32)packet[3]);
20612061   UINT16* threeDPointer = &threeDRoms[threeDOffset * 3];
20622062
2063   if (threeDOffset >= machine.region("verts")->bytes())
2063   if (threeDOffset >= machine.root_device().memregion("verts")->bytes())
20642064   {
20652065      printf("Strange geometry packet: (ignoring)\n");
20662066      printPacket(packet, 1);
r14976r14977
30153015
30163016   UINT8 paletteEntry = 0;
30173017   float t_coord, s_coord;
3018   const UINT8 *gfx = machine.region("textures")->base();
3018   const UINT8 *gfx = state->memregion("textures")->base();
30193019   const UINT8 *textureOffset = &gfx[prOptions.texIndex * 1024 * 1024];
30203020
30213021   for (; x_start <= x_end; x_start++)
src/mame/video/gyruss.c
r14976r14977
3131
3232PALETTE_INIT( gyruss )
3333{
34   const UINT8 *color_prom = machine.region("proms")->base();
34   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3535   static const int resistances_rg[3] = { 1000, 470, 220 };
3636   static const int resistances_b [2] = { 470, 220 };
3737   double weights_rg[3], weights_b[2];
src/mame/video/groundfx.c
r14976r14977
6464{
6565   groundfx_state *state = machine.driver_data<groundfx_state>();
6666   UINT32 *spriteram32 = state->m_spriteram;
67   UINT16 *spritemap = (UINT16 *)machine.region("user1")->base();
67   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
6868   int offs, data, tilenum, color, flipx, flipy;
6969   int x, y, priority, dblsize, curx, cury;
7070   int sprites_flipscreen = 0;
src/mame/video/fastlane.c
r14976r14977
55
66PALETTE_INIT( fastlane )
77{
8   const UINT8 *color_prom = machine.region("proms")->base();
8   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
99   int pal;
1010
1111   /* allocate the colortable */
src/mame/video/kangaroo.c
r14976r14977
8585         break;
8686
8787      case 8:   /* bank select */
88         memory_set_bank(machine(), "bank1", (data & 0x05) ? 0 : 1);
88         membank("bank1")->set_entry((data & 0x05) ? 0 : 1);
8989         break;
9090   }
9191}
r14976r14977
101101static void blitter_execute( running_machine &machine )
102102{
103103   kangaroo_state *state = machine.driver_data<kangaroo_state>();
104   UINT32 gfxhalfsize = machine.region("gfx1")->bytes() / 2;
105   const UINT8 *gfxbase = machine.region("gfx1")->base();
104   UINT32 gfxhalfsize = machine.root_device().memregion("gfx1")->bytes() / 2;
105   const UINT8 *gfxbase = state->memregion("gfx1")->base();
106106   UINT16 src = state->m_video_control[0] + 256 * state->m_video_control[1];
107107   UINT16 dst = state->m_video_control[2] + 256 * state->m_video_control[3];
108108   UINT8 height = state->m_video_control[5];
src/mame/video/suprloco.c
r14976r14977
3030***************************************************************************/
3131PALETTE_INIT( suprloco )
3232{
33   const UINT8 *color_prom = machine.region("proms")->base();
33   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3434   int i;
3535
3636
r14976r14977
203203      dy = -1;
204204   }
205205
206   gfx2 = machine.region("gfx2")->base();
206   gfx2 = machine.root_device().memregion("gfx2")->base();
207207   for (row = 0;row < height;row++,adjy+=dy)
208208   {
209209      int color1,color2,flipx;
src/mame/video/m58.c
r14976r14977
2121
2222PALETTE_INIT( yard )
2323{
24   const UINT8 *color_prom = machine.region("proms")->base();
24   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2525   const UINT8 *char_lopal = color_prom + 0x000;
2626   const UINT8 *char_hipal = color_prom + 0x100;
2727   const UINT8 *sprite_pal = color_prom + 0x200;
src/mame/video/fcombat.c
r14976r14977
1414
1515   //palno = (tile_index - (tile_index / 32 * 16) * 32 * 16) / 32;
1616
17   tileno = machine.region("user1")->base()[tile_index];
18   palno = 0x18; //machine.region("user2")->base()[tile_index] >> 3;
17   tileno = machine.root_device().memregion("user1")->base()[tile_index];
18   palno = 0x18; //machine.root_device().memregion("user2")->base()[tile_index] >> 3;
1919   SET_TILE_INFO(2, tileno, palno, 0);
2020}
2121
r14976r14977
3939
4040PALETTE_INIT( fcombat )
4141{
42   const UINT8 *color_prom = machine.region("proms")->base();
42   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4343   int i;
4444
4545   /* allocate the colortable */
src/mame/video/marineb.c
r14976r14977
1212
1313PALETTE_INIT( marineb )
1414{
15   const UINT8 *color_prom = machine.region("proms")->base();
15   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1616   int i;
1717
1818   for (i = 0; i < machine.total_colors(); i++)
src/mame/video/timeplt.c
r14976r14977
3939
4040PALETTE_INIT( timeplt )
4141{
42   const UINT8 *color_prom = machine.region("proms")->base();
42   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4343   rgb_t palette[32];
4444   int i;
4545
src/mame/video/fuukifg2.c
r14976r14977
8282#if 0
8383PALETTE_INIT( fuuki16 )
8484{
85   const UINT8 *color_prom = machine.region("proms")->base();
85   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8686   int pen;
8787
8888   /* The game does not initialise the palette at startup. It should
src/mame/video/vulgus.c
r14976r14977
1818
1919PALETTE_INIT( vulgus )
2020{
21   const UINT8 *color_prom = machine.region("proms")->base();
21   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2222   int i;
2323
2424   machine.colortable = colortable_alloc(machine, 256);
src/mame/video/homerun.c
r14976r14977
1515   state->m_tilemap->mark_all_dirty();
1616
1717   data >>= 5;
18   memory_set_bank(device->machine(), "bank1", data & 0x07);
18   state->membank("bank1")->set_entry(data & 0x07);
1919}
2020
2121WRITE8_MEMBER(homerun_state::homerun_videoram_w)
src/mame/video/champbas.c
r14976r14977
2222
2323PALETTE_INIT( champbas )
2424{
25   const UINT8 *color_prom = machine.region("proms")->base();
25   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2626   static const int resistances_rg[3] = { 1000, 470, 220 };
2727   static const int resistances_b [2] = { 470, 220 };
2828   double rweights[3], gweights[3], bweights[2];
r14976r14977
7575
7676PALETTE_INIT( exctsccr )
7777{
78   const UINT8 *color_prom = machine.region("proms")->base();
78   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7979   int i;
8080
8181   /* allocate the colortable */
src/mame/video/baraduke.c
r14976r14977
1717
1818PALETTE_INIT( baraduke )
1919{
20   const UINT8 *color_prom = machine.region("proms")->base();
20   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2121   int i;
2222   int bit0,bit1,bit2,bit3,r,g,b;
2323
src/mame/video/ssozumo.c
r14976r14977
1414
1515PALETTE_INIT( ssozumo )
1616{
17   const UINT8 *color_prom = machine.region("proms")->base();
17   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
1818   int   bit0, bit1, bit2, bit3, r, g, b;
1919   int   i;
2020
src/mame/video/m107.c
r14976r14977
153153   m107_state *state = machine.driver_data<m107_state>();
154154   UINT16 *spriteram = state->m_buffered_spriteram;
155155   int offs;
156   UINT8 *rom = machine.region("user1")->base();
156   UINT8 *rom = state->memregion("user1")->base();
157157
158158   for (offs = 0;offs < 0x800;offs += 4)
159159   {
src/mame/video/matmania.c
r14976r14977
4343***************************************************************************/
4444PALETTE_INIT( matmania )
4545{
46   const UINT8 *color_prom = machine.region("proms")->base();
46   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4747   int i;
4848
4949   for (i = 0; i < 64; i++)
src/mame/video/arkanoid.c
r14976r14977
137137   /* bit 2 - 3 unknown */
138138
139139   /* bit 4 could be the ROM bank selector for 8000-bfff (not sure) */
140   memory_set_bank(machine(), "bank1", ((data & 0x10) >> 4));
140   membank("bank1")->set_entry(((data & 0x10) >> 4));
141141
142142   /* bit 5 = gfx bank */
143143   if (m_gfxbank != ((data & 0x20) >> 5))
src/mame/video/megasys1.c
r14976r14977
753753
754754PALETTE_INIT( megasys1 )
755755{
756   const UINT8 *color_prom = machine.region("proms")->base();
756   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
757757   megasys1_state *state = machine.driver_data<megasys1_state>();
758758   int pri_code, offset, i, order;
759759
src/mame/video/archimds.c
r14976r14977
4343      int count;
4444      int x,y,xi;
4545      UINT8 pen;
46      static UINT8 *vram = screen.machine().region("vram")->base();
46      static UINT8 *vram = screen.machine().root_device().memregion("vram")->base();
4747
4848      count = (0);
4949
src/mame/video/pacman.c
r14976r14977
6363
6464PALETTE_INIT( pacman )
6565{
66   const UINT8 *color_prom = machine.region("proms")->base();
66   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
6767   static const int resistances[3] = { 1000, 470, 220 };
6868   double rweights[3], gweights[3], bweights[2];
6969   int i;
src/mame/video/clshroad.c
r14976r14977
4242
4343PALETTE_INIT( clshroad )
4444{
45   const UINT8 *color_prom = machine.region("proms")->base();
45   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4646   int i;
4747   for (i = 0;i < 256;i++)
4848      palette_set_color_rgb(machine,i,   pal4bit(color_prom[i + 256 * 0]),
r14976r14977
5252
5353PALETTE_INIT( firebatl )
5454{
55   const UINT8 *color_prom = machine.region("proms")->base();
55   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5656   int i;
5757
5858   /* allocate the colortable */
src/mame/video/dcheese.c
r14976r14977
2727
2828PALETTE_INIT( dcheese )
2929{
30   const UINT16 *src = (UINT16 *)machine.region("user1")->base();
30   const UINT16 *src = (UINT16 *)machine.root_device().memregion("user1")->base();
3131   int i;
3232
3333   /* really 65536 colors, but they don't use the later ones so we can stay */
r14976r14977
168168   INT32 dxdy = (INT32)(((state->m_blitter_xparam[6] & 0x0fff) | ((state->m_blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12;
169169   INT32 dydx = (INT32)(((state->m_blitter_yparam[4] & 0x0fff) | ((state->m_blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12;
170170   INT32 dydy = (INT32)(((state->m_blitter_yparam[6] & 0x0fff) | ((state->m_blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12;
171   UINT8 *src = machine.region("gfx1")->base();
172   UINT32 pagemask = (machine.region("gfx1")->bytes() - 1) / 0x40000;
171   UINT8 *src = machine.root_device().memregion("gfx1")->base();
172   UINT32 pagemask = (state->memregion("gfx1")->bytes() - 1) / 0x40000;
173173   int xstart = state->m_blitter_xparam[14];
174174   int xend = state->m_blitter_xparam[15] + 1;
175175   int ystart = state->m_blitter_yparam[14];
src/mame/video/bwing.c
r14976r14977
125125   }
126126
127127   #if BW_DEBUG
128      (machine().region(REGION_CPU1)->base())[0x1b10 + offset] = data;
128      (machine().root_device().memregion(REGION_CPU1)->base())[0x1b10 + offset] = data;
129129   #endif
130130}
131131
r14976r14977
214214
215215   fill_srxlat(state->m_srxlat);
216216
217   state->m_fgdata = machine.region("gpu")->base();
217   state->m_fgdata = state->memregion("gpu")->base();
218218   state->m_bgdata = state->m_fgdata + 0x1000;
219219
220220   for (i = 0; i < 4; i++)
src/mame/video/sf.c
r14976r14977
99
1010static TILE_GET_INFO( get_bg_tile_info )
1111{
12   UINT8 *base = machine.region("gfx5")->base() + 2 * tile_index;
12   UINT8 *base = machine.root_device().memregion("gfx5")->base() + 2 * tile_index;
1313   int attr = base[0x10000];
1414   int color = base[0];
1515   int code = (base[0x10000 + 1] << 8) | base[1];
r14976r14977
2222
2323static TILE_GET_INFO( get_fg_tile_info )
2424{
25   UINT8 *base = machine.region("gfx5")->base() + 0x20000 + 2 * tile_index;
25   UINT8 *base = machine.root_device().memregion("gfx5")->base() + 0x20000 + 2 * tile_index;
2626   int attr = base[0x10000];
2727   int color = base[0];
2828   int code = (base[0x10000 + 1] << 8) | base[1];
src/mame/video/cave.c
r14976r14977
515515{
516516   cave_state *state = machine.driver_data<cave_state>();
517517   pen_t base_pal = 0;
518   const UINT8 *base_gfx = machine.region("sprites")->base();
519   int code_max = machine.region("sprites")->bytes() / (16*16);
518   const UINT8 *base_gfx = machine.root_device().memregion("sprites")->base();
519   int code_max = state->memregion("sprites")->bytes() / (16*16);
520520
521521   UINT16 *source;
522522   UINT16 *finish;
r14976r14977
644644{
645645   cave_state *state = machine.driver_data<cave_state>();
646646   pen_t base_pal = 0;
647   const UINT8 *base_gfx = machine.region("sprites")->base();
648   int code_max = machine.region("sprites")->bytes() / (16*16);
647   const UINT8 *base_gfx = machine.root_device().memregion("sprites")->base();
648   int code_max = state->memregion("sprites")->bytes() / (16*16);
649649
650650   UINT16 *source;
651651   UINT16 *finish;
src/mame/video/dooyong.c
r14976r14977
139139WRITE8_MEMBER(dooyong_state::primella_ctrl_w)
140140{
141141   /* bits 0-2 select ROM bank */
142   memory_set_bank(machine(), "bank1", data & 0x07);
142   membank("bank1")->set_entry(data & 0x07);
143143
144144   /* bit 3 disables tx layer */
145145   m_tx_pri = data & 0x08;
r14976r14977
629629{
630630   dooyong_state *state = machine.driver_data<dooyong_state>();
631631   /* Configure tilemap callbacks */
632   state->m_bg_tilerom = machine.region("gfx5")->base();
633   state->m_fg_tilerom = machine.region("gfx6")->base();
632   state->m_bg_tilerom = machine.root_device().memregion("gfx5")->base();
633   state->m_fg_tilerom = state->memregion("gfx6")->base();
634634   state->m_bg_tilerom2 = NULL;
635635   state->m_fg_tilerom2 = NULL;
636636   state->m_bg_gfx = 2;
r14976r14977
669669{
670670   dooyong_state *state = machine.driver_data<dooyong_state>();
671671   /* Configure tilemap callbacks */
672   state->m_bg_tilerom = machine.region("gfx5")->base();
673   state->m_fg_tilerom = machine.region("gfx6")->base();
672   state->m_bg_tilerom = machine.root_device().memregion("gfx5")->base();
673   state->m_fg_tilerom = state->memregion("gfx6")->base();
674674   state->m_bg_tilerom2 = NULL;
675675   state->m_fg_tilerom2 = NULL;
676676   state->m_bg_gfx = 2;
r14976r14977
708708{
709709   dooyong_state *state = machine.driver_data<dooyong_state>();
710710   /* Configure tilemap callbacks */
711   state->m_bg_tilerom = machine.region("gfx5")->base();
712   state->m_fg_tilerom = machine.region("gfx6")->base();
711   state->m_bg_tilerom = machine.root_device().memregion("gfx5")->base();
712   state->m_fg_tilerom = state->memregion("gfx6")->base();
713713   state->m_bg_tilerom2 = NULL;
714714   state->m_fg_tilerom2 = NULL;
715715   state->m_bg_gfx = 2;
r14976r14977
744744{
745745   dooyong_state *state = machine.driver_data<dooyong_state>();
746746   /* Configure tilemap callbacks */
747   state->m_bg_tilerom = machine.region("gfx3")->base() + 0x78000;
748   state->m_fg_tilerom = machine.region("gfx4")->base() + 0x78000;
749   state->m_fg2_tilerom = machine.region("gfx5")->base() + 0x38000;
747   state->m_bg_tilerom = machine.root_device().memregion("gfx3")->base() + 0x78000;
748   state->m_fg_tilerom = machine.root_device().memregion("gfx4")->base() + 0x78000;
749   state->m_fg2_tilerom = state->memregion("gfx5")->base() + 0x38000;
750750   state->m_bg_tilerom2 = NULL;
751751   state->m_fg_tilerom2 = NULL;
752752   state->m_fg2_tilerom2 = NULL;
r14976r14977
785785{
786786   dooyong_state *state = machine.driver_data<dooyong_state>();
787787   /* Configure tilemap callbacks */
788   state->m_bg_tilerom = machine.region("gfx3")->base() + 0x78000;
789   state->m_fg_tilerom = machine.region("gfx4")->base() + 0x78000;
788   state->m_bg_tilerom = machine.root_device().memregion("gfx3")->base() + 0x78000;
789   state->m_fg_tilerom = state->memregion("gfx4")->base() + 0x78000;
790790   state->m_bg_tilerom2 = NULL;
791791   state->m_fg_tilerom2 = NULL;
792792   state->m_bg_gfx = 2;
r14976r14977
821821{
822822   dooyong_state *state = machine.driver_data<dooyong_state>();
823823   /* Configure tilemap callbacks */
824   state->m_bg_tilerom = machine.region("gfx2")->base() + machine.region("gfx2")->bytes() - 0x8000;
825   state->m_fg_tilerom = machine.region("gfx3")->base() + machine.region("gfx3")->bytes() - 0x8000;
824   state->m_bg_tilerom = machine.root_device().memregion("gfx2")->base() + machine.root_device().memregion("gfx2")->bytes() - 0x8000;
825   state->m_fg_tilerom = machine.root_device().memregion("gfx3")->base() + state->memregion("gfx3")->bytes() - 0x8000;
826826   state->m_bg_tilerom2 = NULL;
827827   state->m_fg_tilerom2 = NULL;
828828   state->m_bg_gfx = 1;
r14976r14977
856856{
857857   dooyong_state *state = machine.driver_data<dooyong_state>();
858858   /* Configure tilemap callbacks */
859   state->m_bg_tilerom = machine.region("gfx5")->base();
860   state->m_bg2_tilerom = machine.region("gfx4")->base();
861   state->m_fg_tilerom = machine.region("gfx3")->base();
862   state->m_fg2_tilerom = machine.region("gfx2")->base();
863   state->m_bg_tilerom2 = machine.region("gfx6")->base() + 0x60000;
864   state->m_bg2_tilerom2 = machine.region("gfx6")->base() + 0x40000;
865   state->m_fg_tilerom2 = machine.region("gfx6")->base() + 0x20000;
866   state->m_fg2_tilerom2 = machine.region("gfx6")->base() + 0x00000;
859   state->m_bg_tilerom = machine.root_device().memregion("gfx5")->base();
860   state->m_bg2_tilerom = machine.root_device().memregion("gfx4")->base();
861   state->m_fg_tilerom = machine.root_device().memregion("gfx3")->base();
862   state->m_fg2_tilerom = machine.root_device().memregion("gfx2")->base();
863   state->m_bg_tilerom2 = machine.root_device().memregion("gfx6")->base() + 0x60000;
864   state->m_bg2_tilerom2 = machine.root_device().memregion("gfx6")->base() + 0x40000;
865   state->m_fg_tilerom2 = machine.root_device().memregion("gfx6")->base() + 0x20000;
866   state->m_fg2_tilerom2 = state->memregion("gfx6")->base() + 0x00000;
867867   state->m_bg_gfx = 4;
868868   state->m_bg2_gfx = 3;
869869   state->m_fg_gfx = 2;
r14976r14977
901901{
902902   dooyong_state *state = machine.driver_data<dooyong_state>();
903903   /* Configure tilemap callbacks */
904   state->m_bg_tilerom = machine.region("gfx2")->base();
904   state->m_bg_tilerom = state->memregion("gfx2")->base();
905905   state->m_bg_gfx = 1;
906906
907907   /* Create tilemaps */
src/mame/video/brkthru.c
r14976r14977
3434
3535PALETTE_INIT( brkthru )
3636{
37   const UINT8 *color_prom = machine.region("proms")->base();
37   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3838   int i;
3939
4040   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
129129   else if (offset == 1)
130130   {
131131      /* bit 0-2 = ROM bank select */
132      memory_set_bank(machine(), "bank1", data & 0x07);
132      membank("bank1")->set_entry(data & 0x07);
133133
134134      /* bit 3-5 = background tiles color code */
135135      if (((data & 0x38) >> 2) != m_bgbasecolor)
src/mame/video/williams.c
r14976r14977
142142VIDEO_START( blaster )
143143{
144144   williams_state *state = machine.driver_data<williams_state>();
145   blitter_init(machine, state->m_blitter_config, machine.region("proms")->base());
145   blitter_init(machine, state->m_blitter_config, state->memregion("proms")->base());
146146   create_palette_lookup(machine);
147147   state_save_register(machine);
148148}
src/mame/video/dec8.c
r14976r14977
7777
7878PALETTE_INIT( ghostb )
7979{
80   const UINT8 *color_prom = machine.region("proms")->base();
80   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8181   int i;
8282
8383   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
140140   switch (offset)
141141   {
142142   case 0: /* Top 3 bits - bank switch, bottom 4 - scroll MSB */
143      memory_set_bank(machine(), "bank1", (data >> 5));
143      membank("bank1")->set_entry((data >> 5));
144144      m_scroll2[0] = data & 0xf;
145145      return;
146146
r14976r14977
160160        Bit 0x40 - Y scroll MSB
161161        Bit 0x80 - Hold subcpu reset line high if clear, else low
162162    */
163   memory_set_bank(machine(), "bank1", data & 0x0f);
163   membank("bank1")->set_entry(data & 0x0f);
164164
165165   m_scroll2[0] = (data >> 5) & 1;
166166   m_scroll2[2] = (data >> 6) & 1;
r14976r14977
175175{
176176
177177   /* Bottom 4 bits - bank switch, Bits 4 & 5 - Scroll MSBs */
178   memory_set_bank(machine(), "bank1", data & 0x0f);
178   membank("bank1")->set_entry(data & 0x0f);
179179
180180   m_scroll2[0] = (data >> 5) & 1;
181181   m_scroll2[2] = (data >> 6) & 1;
src/mame/video/thepit.c
r14976r14977
2828
2929PALETTE_INIT( thepit )
3030{
31   const UINT8 *color_prom = machine.region("proms")->base();
31   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3232   int i;
3333
3434   for (i = 0; i < 32; i++)
r14976r14977
6969
7070PALETTE_INIT( suprmous )
7171{
72   const UINT8 *color_prom = machine.region("proms")->base();
72   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7373   int i;
7474
7575   for (i = 0; i < 32; i++)
src/mame/video/cloud9.c
r14976r14977
2222
2323   /* allocate second bank of videoram */
2424   state->m_videoram = auto_alloc_array(machine, UINT8, 0x8000);
25   memory_set_bankptr(machine, "bank1", state->m_videoram);
25   state->membank("bank1")->set_base(state->m_videoram);
2626
2727   /* get pointers to our PROMs */
28   state->m_syncprom = machine.region("proms")->base() + 0x000;
29   state->m_wpprom = machine.region("proms")->base() + 0x200;
30   state->m_priprom = machine.region("proms")->base() + 0x300;
28   state->m_syncprom = machine.root_device().memregion("proms")->base() + 0x000;
29   state->m_wpprom = machine.root_device().memregion("proms")->base() + 0x200;
30   state->m_priprom = machine.root_device().memregion("proms")->base() + 0x300;
3131
3232   /* compute the color output resistor weights at startup */
3333   compute_resistor_weights(0,   255, -1.0,
src/mame/video/changela.c
r14976r14977
4747   changela_state *state = machine.driver_data<changela_state>();
4848   int sx, i;
4949
50   UINT8* ROM = machine.region("user1")->base();
50   UINT8* ROM = state->memregion("user1")->base();
5151   UINT8* RAM = state->m_spriteram;
5252
5353   for (sx = 0; sx < 256; sx++)
r14976r14977
110110   changela_state *state = machine.driver_data<changela_state>();
111111   int sx, sy;
112112
113   UINT8* ROM = machine.region("gfx2")->base();
113   UINT8* ROM = state->memregion("gfx2")->base();
114114   UINT8* RAM = state->m_videoram;
115115
116116   UINT8 reg[4] = { 0 }; /* 4x4-bit registers (U58, U59) */
r14976r14977
175175   changela_state *state = machine.driver_data<changela_state>();
176176   int sx, i, j;
177177
178   UINT8* ROM = machine.region("user2")->base();
178   UINT8* ROM = machine.root_device().memregion("user2")->base();
179179   UINT8* RAM = state->m_memory_devices + 0x800;
180   UINT8* TILE_ROM = machine.region("gfx1")->base();
180   UINT8* TILE_ROM = machine.root_device().memregion("gfx1")->base();
181181   UINT8* TILE_RAM = state->m_memory_devices + 0x1000;
182   UINT8* PROM = machine.region("proms")->base();
182   UINT8* PROM = state->memregion("proms")->base();
183183
184184   int preload = ((sy < 32) ? 1 : 0);
185185
r14976r14977
355355   int sx, i, j;
356356
357357   /* State machine */
358   UINT8* ROM = machine.region("user2")->base();
358   UINT8* ROM = machine.root_device().memregion("user2")->base();
359359   UINT8* RAM = state->m_memory_devices + 0x840 + 0x40 * tree_num;
360   UINT8* PROM = machine.region("proms")->base();
360   UINT8* PROM = machine.root_device().memregion("proms")->base();
361361
362362   /* Tree Data */
363363   UINT8* RAM2 = state->m_tree_ram + 0x20 * tree_num;
364   UINT8* TILE_ROM = (tree_num ? (machine.region("user3")->base() + 0x1000) : (machine.region("gfx1")->base() + 0x2000));
365   UINT8* TILE_RAM = (tree_num ? (machine.region("user3")->base()) : (state->m_memory_devices + 0x1800));
364   UINT8* TILE_ROM = (tree_num ? (machine.root_device().memregion("user3")->base() + 0x1000) : (machine.root_device().memregion("gfx1")->base() + 0x2000));
365   UINT8* TILE_RAM = (tree_num ? (state->memregion("user3")->base()) : (state->m_memory_devices + 0x1800));
366366
367367   int preload = ((sy < 32) ? 1 : 0);
368368
src/mame/video/pooyan.c
r14976r14977
2929
3030PALETTE_INIT( pooyan )
3131{
32   const UINT8 *color_prom = machine.region("proms")->base();
32   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3333   static const int resistances_rg[3] = { 1000, 470, 220 };
3434   static const int resistances_b [2] = { 470, 220 };
3535   double rweights[3], gweights[3], bweights[2];
src/mame/video/sidepckt.c
r14976r14977
44
55PALETTE_INIT( sidepckt )
66{
7   const UINT8 *color_prom = machine.region("proms")->base();
7   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
88   int i;
99
1010   for (i = 0;i < machine.total_colors();i++)
src/mame/video/tankbatt.c
r14976r14977
1717***************************************************************************/
1818PALETTE_INIT( tankbatt )
1919{
20   const UINT8 *color_prom = machine.region("proms")->base();
20   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
2121   int i;
2222
2323   #define RES_1   0xc0 /* this is a guess */
src/mame/video/exerion.c
r14976r14977
3636
3737PALETTE_INIT( exerion )
3838{
39   const UINT8 *color_prom = machine.region("proms")->base();
39   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4040   static const int resistances_rg[3] = { 1000, 470, 220 };
4141   static const int resistances_b [2] = { 470, 220 };
4242   double rweights[3], gweights[3], bweights[2];
r14976r14977
111111   UINT8 *gfx;
112112
113113   /* get pointers to the mixing and lookup PROMs */
114   state->m_background_mixer = machine.region("proms")->base() + 0x320;
114   state->m_background_mixer = machine.root_device().memregion("proms")->base() + 0x320;
115115
116116   /* allocate memory for the decoded background graphics */
117117   state->m_background_gfx[0] = auto_alloc_array(machine, UINT16, 256 * 256 * 4);
r14976r14977
136136     * Where AA,BB,CC,DD are the 2bpp data for the pixel,and a,b,c,d are the OR
137137     * of these two bits together.
138138     */
139   gfx = machine.region("gfx3")->base();
139   gfx = state->memregion("gfx3")->base();
140140   for (i = 0; i < 4; i++)
141141   {
142142      int y;
src/mame/video/darkmist.c
r14976r14977
1515{
1616   int code,attr,pal;
1717
18   code=machine.region("user1")->base()[tile_index]; /* TTTTTTTT */
19   attr=machine.region("user2")->base()[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */
18   code=machine.root_device().memregion("user1")->base()[tile_index]; /* TTTTTTTT */
19   attr=machine.root_device().memregion("user2")->base()[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */
2020   code+=(attr&3)<<8;
2121   pal=(attr>>4);
2222
r14976r14977
3131{
3232   int code,attr,pal;
3333
34   code=machine.region("user3")->base()[tile_index]; /* TTTTTTTT */
35   attr=machine.region("user4")->base()[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */
34   code=machine.root_device().memregion("user3")->base()[tile_index]; /* TTTTTTTT */
35   attr=machine.root_device().memregion("user4")->base()[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */
3636   pal=attr>>4;
3737
3838   code+=(attr&3)<<8;
r14976r14977
7171
7272PALETTE_INIT(darkmist)
7373{
74   const UINT8 *color_prom = machine.region("proms")->base();
74   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
7575   int i;
7676
7777   /* allocate the colortable */
src/mame/video/shisen.c
r14976r14977
1212{
1313   int bankaddress;
1414   int bank;
15   UINT8 *RAM = machine().region("maincpu")->base();
15   UINT8 *RAM = memregion("maincpu")->base();
1616
1717   if (data & 0xc0) logerror("bank switch %02x\n",data);
1818
1919   /* bits 0-2 select ROM bank */
2020   bankaddress = 0x10000 + (data & 0x07) * 0x4000;
21   memory_set_bankptr(machine(), "bank1", &RAM[bankaddress]);
21   membank("bank1")->set_base(&RAM[bankaddress]);
2222
2323   /* bits 3-5 select gfx bank */
2424   bank = (data & 0x38) >> 3;
src/mame/video/nmk16.c
r14976r14977
638638int nmk16_bioshipbg_sprflip_tx_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
639639{
640640   nmk16_state *state = screen.machine().driver_data<nmk16_state>();
641   UINT16 *tilerom = (UINT16 *)screen.machine().region("gfx5")->base();
641   UINT16 *tilerom = (UINT16 *)state->memregion("gfx5")->base();
642642   int scrollx=-(state->m_bioship_scroll[1] + state->m_bioship_scroll[0]*256);
643643   int scrolly=-(state->m_bioship_scroll[3] + state->m_bioship_scroll[2]*256);
644644
src/mame/drivers/bfcobra.c
r14976r14977
420420   if (addr < 0x10000)
421421   {
422422      /* Is this region fixed? */
423      return (UINT8*)(machine.region("user1")->base() + addr);
423      return (UINT8*)(state->memregion("user1")->base() + addr);
424424   }
425425   else if(addr < 0x20000)
426426   {
427427      addr &= 0xffff;
428428      addr += (state->m_bank_data[0] & 1) ? 0x10000 : 0;
429429
430      return (UINT8*)(machine.region("user1")->base() + addr + ((state->m_bank_data[0] >> 1) * 0x20000));
430      return (UINT8*)(machine.root_device().memregion("user1")->base() + addr + ((state->m_bank_data[0] >> 1) * 0x20000));
431431   }
432432   else if (addr >= 0x20000 && addr < 0x40000)
433433   {
r14976r14977
10231023   {
10241024      UINT32 offset = ((state->m_bank_data[0] >> 1) * 0x20000) + ((0x4000 * data) ^ ((state->m_bank_data[0] & 1) ? 0 : 0x10000));
10251025
1026      memory_set_bankptr(machine, bank_names[num - 1], machine.region("user1")->base() + offset);
1026      state->membank(bank_names[num - 1])->set_base(machine.root_device().memregion("user1")->base() + offset);
10271027   }
10281028   else if (data < 0x10)
10291029   {
1030      memory_set_bankptr(machine, bank_names[num - 1], &state->m_video_ram[(data - 0x08) * 0x4000]);
1030      state->membank(bank_names[num - 1])->set_base(&state->m_video_ram[(data - 0x08) * 0x4000]);
10311031   }
10321032   else
10331033   {
1034      memory_set_bankptr(machine, bank_names[num - 1], &state->m_work_ram[(data - 0x10) * 0x4000]);
1034      state->membank(bank_names[num - 1])->set_base(&state->m_work_ram[(data - 0x10) * 0x4000]);
10351035   }
10361036}
10371037
r14976r14977
11381138            }
11391139
11401140            fdc.offset = (BPT * fdc.track*2) + (fdc.side ? BPT : 0) + (BPS * (fdc.sector-1)) + fdc.byte_pos++;
1141            val = *(machine().region("user2")->base() + fdc.offset);
1141            val = *(machine().root_device().memregion("user2")->base() + fdc.offset);
11421142
11431143            /* Move on to next sector? */
11441144            if (fdc.byte_pos == 1024)
r14976r14977
17061706   UINT8 *tmp;
17071707
17081708   tmp = auto_alloc_array(machine, UINT8, 0x8000);
1709   rom = machine.region("audiocpu")->base() + 0x8000;
1709   rom = machine.root_device().memregion("audiocpu")->base() + 0x8000;
17101710   memcpy(tmp, rom, 0x8000);
17111711
17121712   for (i = 0; i < 0x8000; i++)
r14976r14977
17351735   state->m_bank_data[3] = 0;
17361736
17371737   /* Fixed 16kB ROM region */
1738   memory_set_bankptr(machine, "bank4", machine.region("user1")->base());
1738   state->membank("bank4")->set_base(machine.root_device().memregion("user1")->base());
17391739
17401740   /* TODO: Properly sort out the data ACIA */
17411741   state->m_data_r = 1;
src/mame/drivers/nycaptor.c
r14976r14977
331331WRITE8_MEMBER(nycaptor_state::nycaptor_generic_control_w)
332332{
333333   m_generic_control_reg = data;
334   memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x10000 + ((data&0x08)>>3)*0x4000 );
334   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000 + ((data&0x08)>>3)*0x4000 );
335335}
336336
337337static ADDRESS_MAP_START( nycaptor_master_map, AS_PROGRAM, 8, nycaptor_state )
r14976r14977
436436   int bank = (data >> 2) & 3;
437437
438438   m_generic_control_reg = data;
439   memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x10000 + bank*0x4000 );
439   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000 + bank*0x4000 );
440440}
441441
442442
r14976r14977
13541354{
13551355   nycaptor_state *state = machine.driver_data<nycaptor_state>();
13561356   int i;
1357   UINT8 *rom = machine.region("maincpu")->base();
1357   UINT8 *rom = state->memregion("maincpu")->base();
13581358
13591359   for (i = 0; i < 0x20000; i++)
13601360      rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
r14976r14977
13661366{
13671367   nycaptor_state *state = machine.driver_data<nycaptor_state>();
13681368   int i;
1369   UINT8 *rom = machine.region("maincpu")->base();
1369   UINT8 *rom = state->memregion("maincpu")->base();
13701370
13711371   for (i = 0; i < 0x20000; i++)
13721372      rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
src/mame/drivers/mitchell.c
r14976r14977
150150
151151WRITE8_MEMBER(mitchell_state::pang_bankswitch_w)
152152{
153   memory_set_bank(machine(), "bank1", data & 0x0f);
153   membank("bank1")->set_entry(data & 0x0f);
154154}
155155
156156/*************************************
r14976r14977
21052105static void bootleg_decode( running_machine &machine )
21062106{
21072107   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
2108   space->set_decrypted_region(0x0000, 0x7fff, machine.region("maincpu")->base() + 0x50000);
2109   memory_configure_bank_decrypted(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x60000, 0x4000);
2108   space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x50000);
2109   machine.root_device().membank("bank1")->configure_decrypted_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x60000, 0x4000);
21102110}
21112111
21122112
21132113static void configure_banks( running_machine &machine )
21142114{
2115   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
2115   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
21162116}
21172117
21182118
r14976r14977
21612161   mitchell_state *state = machine.driver_data<mitchell_state>();
21622162   state->m_input_type = 3;
21632163   state->m_nvram_size = 0x80;
2164   state->m_nvram = &machine.region("maincpu")->base()[0xe000];   /* NVRAM */
2164   state->m_nvram = &state->memregion("maincpu")->base()[0xe000];   /* NVRAM */
21652165   spang_decode(machine);
21662166   configure_banks(machine);
21672167}
r14976r14977
21712171   mitchell_state *state = machine.driver_data<mitchell_state>();
21722172   state->m_input_type = 3;
21732173   state->m_nvram_size = 0x80;
2174   state->m_nvram = &machine.region("maincpu")->base()[0xe000];   /* NVRAM */
2174   state->m_nvram = &state->memregion("maincpu")->base()[0xe000];   /* NVRAM */
21752175   bootleg_decode(machine);
21762176   configure_banks(machine);
21772177}
r14976r14977
21812181   mitchell_state *state = machine.driver_data<mitchell_state>();
21822182   state->m_input_type = 3;
21832183   state->m_nvram_size = 0x80;
2184   state->m_nvram = &machine.region("maincpu")->base()[0xe000];   /* NVRAM */
2184   state->m_nvram = &state->memregion("maincpu")->base()[0xe000];   /* NVRAM */
21852185   spangj_decode(machine);
21862186   configure_banks(machine);
21872187}
r14976r14977
21902190   mitchell_state *state = machine.driver_data<mitchell_state>();
21912191   state->m_input_type = 3;
21922192   state->m_nvram_size = 0x80;
2193   state->m_nvram = &machine.region("maincpu")->base()[0xe000];   /* NVRAM */
2193   state->m_nvram = &state->memregion("maincpu")->base()[0xe000];   /* NVRAM */
21942194   sbbros_decode(machine);
21952195   configure_banks(machine);
21962196}
r14976r14977
22552255   mitchell_state *state = machine.driver_data<mitchell_state>();
22562256   state->m_input_type = 2;
22572257   state->m_nvram_size = 0x80;
2258   state->m_nvram = &machine.region("maincpu")->base()[0xff80];   /* NVRAM */
2258   state->m_nvram = &state->memregion("maincpu")->base()[0xff80];   /* NVRAM */
22592259   block_decode(machine);
22602260   configure_banks(machine);
22612261}
r14976r14977
22642264   mitchell_state *state = machine.driver_data<mitchell_state>();
22652265   state->m_input_type = 2;
22662266   state->m_nvram_size = 0x80;
2267   state->m_nvram = &machine.region("maincpu")->base()[0xff80];   /* NVRAM */
2267   state->m_nvram = &state->memregion("maincpu")->base()[0xff80];   /* NVRAM */
22682268   bootleg_decode(machine);
22692269   configure_banks(machine);
22702270}
r14976r14977
22722272static DRIVER_INIT( mstworld )
22732273{
22742274   /* descramble the program rom .. */
2275   int len = machine.region("maincpu")->bytes();
2275   int len = machine.root_device().memregion("maincpu")->bytes();
22762276   UINT8* source = auto_alloc_array(machine, UINT8, len);
2277   UINT8* dst = machine.region("maincpu")->base() ;
2277   UINT8* dst = machine.root_device().memregion("maincpu")->base() ;
22782278   int x;
22792279
22802280   static const int tablebank[]=
src/mame/drivers/blktiger.c
r14976r14977
5454
5555WRITE8_MEMBER(blktiger_state::blktiger_bankswitch_w)
5656{
57   memory_set_bank(machine(), "bank1", data & 0x0f);
57   membank("bank1")->set_entry(data & 0x0f);
5858}
5959
6060WRITE8_MEMBER(blktiger_state::blktiger_coinlockout_w)
r14976r14977
283283   state->m_mcu = machine.device("mcu");
284284
285285   /* configure bankswitching */
286   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
286   state->membank("bank1")->configure_entries(0, 16, state->memregion("maincpu")->base() + 0x10000, 0x4000);
287287
288288   state->save_item(NAME(state->m_scroll_bank));
289289   state->save_item(NAME(state->m_screen_layout));
r14976r14977
301301   blktiger_state *state = machine.driver_data<blktiger_state>();
302302
303303   /* configure bankswitching */
304   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
304   state->membank("bank1")->configure_entries(0, 16, state->memregion("maincpu")->base() + 0x10000, 0x4000);
305305
306306   state->m_scroll_x[0] = 0;
307307   state->m_scroll_x[1] = 0;
src/mame/drivers/deco_mlc.c
r14976r14977
693693static void descramble_sound( running_machine &machine )
694694{
695695   /* the same as simpl156 / heavy smash? */
696   UINT8 *rom = machine.region("ymz")->base();
697   int length = machine.region("ymz")->bytes();
696   UINT8 *rom = machine.root_device().memregion("ymz")->base();
697   int length = machine.root_device().memregion("ymz")->bytes();
698698   UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
699699
700700   UINT32 x;
src/mame/drivers/pasha2.c
r14976r14977
127127               case 0xb000:
128128               case 0xc000:
129129               case 0xd000:
130                  memory_set_bankptr(machine(), "bank1", machine().region("user2")->base() + 0x400 * (bank - 0x8000)); break;
130                  membank("bank1")->set_base(machine().root_device().memregion("user2")->base() + 0x400 * (bank - 0x8000)); break;
131131            }
132132         }
133133      }
r14976r14977
476476   pasha2_state *state = machine.driver_data<pasha2_state>();
477477   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x95744, 0x95747, read16_delegate(FUNC(pasha2_state::pasha2_speedup_r), state));
478478
479   memory_set_bankptr(machine, "bank1", machine.region("user2")->base());
479   state->membank("bank1")->set_base(state->memregion("user2")->base());
480480}
481481
482482GAME( 1998, pasha2, 0, pasha2, pasha2, pasha2, ROT0, "Dong Sung", "Pasha Pasha 2", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
src/mame/drivers/bublbobl.c
r14976r14977
15521552
15531553static void configure_banks( running_machine& machine )
15541554{
1555   UINT8 *ROM = machine.region("maincpu")->base();
1556   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
1555   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1556   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
15571557}
15581558
15591559static DRIVER_INIT( bublbobl )
r14976r14977
15881588{
15891589   // rearrange gfx to original format
15901590   int i;
1591   UINT8* src = machine.region("gfx1")->base();
1591   UINT8* src = machine.root_device().memregion("gfx1")->base();
15921592   for (i = 0; i < 0x40000; i++)
15931593      src[i] = BITSWAP8(src[i],7,6,5,4,0,1,2,3);
15941594
src/mame/drivers/skyfox.c
r14976r14977
432432/* Untangle the graphics: cut each 32x32x8 tile in 16 8x8x8 tiles */
433433static DRIVER_INIT( skyfox )
434434{
435   UINT8 *RAM = machine.region("gfx1")->base();
436   UINT8 *end = RAM + machine.region("gfx1")->bytes();
435   UINT8 *RAM = machine.root_device().memregion("gfx1")->base();
436   UINT8 *end = RAM + machine.root_device().memregion("gfx1")->bytes();
437437   UINT8 buf[32 * 32];
438438
439439   while (RAM < end)
src/mame/drivers/fgoal.c
r14976r14977
4747
4848static PALETTE_INIT( fgoal )
4949{
50   const UINT8 *color_prom = machine.region("proms")->base();
50   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5151   int i;
5252
5353   /* for B/W screens PCB can be jumpered to use lower half of PROM */
src/mame/drivers/docastle.c
r14976r14977
164164{
165165   docastle_state *state = device->machine().driver_data<docastle_state>();
166166
167   if (state->m_adpcm_pos >= device->machine().region("adpcm")->bytes())
167   if (state->m_adpcm_pos >= state->memregion("adpcm")->bytes())
168168   {
169169      state->m_adpcm_idle = 1;
170170      msm5205_reset_w(device, 1);
r14976r14977
176176   }
177177   else
178178   {
179      state->m_adpcm_data = device->machine().region("adpcm")->base()[state->m_adpcm_pos++];
179      state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos++];
180180      msm5205_data_w(device, state->m_adpcm_data >> 4);
181181   }
182182}
src/mame/drivers/coinmstr.c
r14976r14977
141141READ8_MEMBER(coinmstr_state::question_r)
142142{
143143   int address;
144   UINT8 *questions = machine().region("user1")->base();
144   UINT8 *questions = memregion("user1")->base();
145145
146146   switch(m_question_adr[2])
147147   {
r14976r14977
12251225
12261226static DRIVER_INIT( coinmstr )
12271227{
1228   UINT8 *rom = machine.region("user1")->base();
1229   int length = machine.region("user1")->bytes();
1228   UINT8 *rom = machine.root_device().memregion("user1")->base();
1229   int length = machine.root_device().memregion("user1")->bytes();
12301230   UINT8 *buf = auto_alloc_array(machine, UINT8, length);
12311231   int i;
12321232
src/mame/drivers/expro02.c
r14976r14977
314314{
315315   if (ACCESSING_BITS_8_15)
316316   {
317      UINT8 *rom = machine().region("oki")->base();
317      UINT8 *rom = memregion("oki")->base();
318318      memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000);
319319   }
320320}
r14976r14977
751751
752752static DRIVER_INIT(galsnew)
753753{
754   UINT32 *src = (UINT32 *)machine.region("gfx3" )->base();
755   UINT32 *dst = (UINT32 *)machine.region("gfx2" )->base();
754   UINT32 *src = (UINT32 *)machine.root_device().memregion("gfx3" )->base();
755   UINT32 *dst = (UINT32 *)machine.root_device().memregion("gfx2" )->base();
756756   int x, offset;
757757
758758
src/mame/drivers/rampart.c
r14976r14977
479479
480480static DRIVER_INIT( rampart )
481481{
482   UINT8 *rom = machine.region("maincpu")->base();
482   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
483483
484484   memcpy(&rom[0x140000], &rom[0x40000], 0x8000);
485485   atarigen_slapstic_init(machine.device("maincpu"), 0x140000, 0x438000, 118);
src/mame/drivers/magicard.c
r14976r14977
693693static MACHINE_RESET( magicard )
694694{
695695   magicard_state *state = machine.driver_data<magicard_state>();
696   UINT16 *src    = (UINT16*)machine.region("maincpu" )->base();
696   UINT16 *src    = (UINT16*)state->memregion("maincpu" )->base();
697697   UINT16 *dst    = state->m_magicram;
698698   memcpy (dst, src, 0x80000);
699699   machine.device("maincpu")->reset();
src/mame/drivers/bfm_sc1.c
r14976r14977
192192WRITE8_MEMBER(bfm_sc1_state::bankswitch_w)
193193{
194194//  printf("bankswitch %02x\n", data);
195   memory_set_bank(machine(),"bank1",data & 0x03);
195   membank("bank1")->set_entry(data & 0x03);
196196}
197197
198198///////////////////////////////////////////////////////////////////////////
r14976r14977
668668
669669// init rom bank ////////////////////////////////////////////////////////////////////
670670   {
671      UINT8 *rom = machine.region("maincpu")->base();
671      UINT8 *rom = machine.root_device().memregion("maincpu")->base();
672672
673      memory_configure_bank(machine,"bank1", 0, 4, &rom[0x0000], 0x02000);
674      memory_set_bank(machine,"bank1",state->m_defaultbank);
673      state->membank("bank1")->configure_entries(0, 4, &rom[0x0000], 0x02000);
674      state->membank("bank1")->set_entry(state->m_defaultbank);
675675   }
676676}
677677
src/mame/drivers/snowbros.c
r14976r14977
418418   {
419419      case 0x23:
420420      case 0x26:
421      snd = machine.region("oki")->base();
421      snd = machine.root_device().memregion("oki")->base();
422422      memcpy(snd+0x20000, snd+0x80000+0x00000, 0x20000);
423423      state->m_sb3_music_is_playing = 1;
424424      break;
425425
426426      case 0x24:
427      snd = machine.region("oki")->base();
427      snd = machine.root_device().memregion("oki")->base();
428428      memcpy(snd+0x20000, snd+0x80000+0x20000, 0x20000);
429429      state->m_sb3_music_is_playing = 1;
430430      break;
r14976r14977
437437      case 0x2b:
438438      case 0x2c:
439439      case 0x2d:
440      snd = machine.region("oki")->base();
440      snd = state->memregion("oki")->base();
441441      memcpy(snd+0x20000, snd+0x80000+0x40000, 0x20000);
442442      state->m_sb3_music_is_playing = 1;
443443      break;
r14976r14977
15161516static MACHINE_RESET (semiprot)
15171517{
15181518   snowbros_state *state = machine.driver_data<snowbros_state>();
1519   UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
1519   UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
15201520   int i;
15211521
15221522   for (i = 0;i < 0x200/2;i++)
r14976r14977
15261526static MACHINE_RESET (finalttr)
15271527{
15281528   snowbros_state *state = machine.driver_data<snowbros_state>();
1529   UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
1529   UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
15301530   int i;
15311531
15321532   for (i = 0;i < 0x200/2;i++)
r14976r14977
23372337static DRIVER_INIT( moremorp )
23382338{
23392339   //snowbros_state *state = machine.driver_data<snowbros_state>();
2340//  UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
2340//  UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
23412341//  int i;
23422342
23432343//  for (i = 0;i < 0x200/2;i++)
r14976r14977
23522352static DRIVER_INIT( cookbib2 )
23532353{
23542354   //snowbros_state *state = machine.driver_data<snowbros_state>();
2355//  UINT16 *HCROM = (UINT16*)machine.region("maincpu")->base();
2356//  UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
2355//  UINT16 *HCROM = (UINT16*)machine.root_device().memregion("maincpu")->base();
2356//  UINT16 *PROTDATA = (UINT16*)state->memregion("user1")->base();
23572357//  int i;
23582358//  state->m_hyperpac_ram[0xf000/2] = 0x46fc;
23592359//  state->m_hyperpac_ram[0xf002/2] = 0x2700;
r14976r14977
27192719static DRIVER_INIT(4in1boot)
27202720{
27212721   UINT8 *buffer;
2722   UINT8 *src = machine.region("maincpu")->base();
2723   int len = machine.region("maincpu")->bytes();
2722   UINT8 *src = machine.root_device().memregion("maincpu")->base();
2723   int len = machine.root_device().memregion("maincpu")->bytes();
27242724
27252725   /* strange order */
27262726   buffer = auto_alloc_array(machine, UINT8, len);
r14976r14977
27342734      auto_free(machine, buffer);
27352735   }
27362736
2737   src = machine.region("soundcpu")->base();
2738   len = machine.region("soundcpu")->bytes();
2737   src = machine.root_device().memregion("soundcpu")->base();
2738   len = machine.root_device().memregion("soundcpu")->bytes();
27392739
27402740   /* strange order */
27412741   buffer = auto_alloc_array(machine, UINT8, len);
r14976r14977
27532753static DRIVER_INIT(snowbro3)
27542754{
27552755   UINT8 *buffer;
2756   UINT8 *src = machine.region("maincpu")->base();
2757   int len = machine.region("maincpu")->bytes();
2756   UINT8 *src = machine.root_device().memregion("maincpu")->base();
2757   int len = machine.root_device().memregion("maincpu")->bytes();
27582758
27592759   /* strange order */
27602760   buffer = auto_alloc_array(machine, UINT8, len);
src/mame/drivers/nbmj9195.c
r14976r14977
4040
4141WRITE8_MEMBER(nbmj9195_state::nbmj9195_soundbank_w)
4242{
43   UINT8 *SNDROM = machine().region("audiocpu")->base();
43   UINT8 *SNDROM = memregion("audiocpu")->base();
4444
45   memory_set_bankptr(machine(), "bank1", &SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
45   membank("bank1")->set_base(&SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
4646}
4747
4848READ8_MEMBER(nbmj9195_state::nbmj9195_sound_r)
r14976r14977
662662{
663663   nbmj9195_state *state = machine.driver_data<nbmj9195_state>();
664664   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
665   UINT8 *ROM = machine.region("audiocpu")->base();
665   UINT8 *ROM = state->memregion("audiocpu")->base();
666666
667667   // sound program patch
668668   ROM[0x0213] = 0x00;         // DI -> NOP
src/mame/drivers/hcastle.c
r14976r14977
1919
2020WRITE8_MEMBER(hcastle_state::hcastle_bankswitch_w)
2121{
22   memory_set_bank(machine(), "bank1", data & 0x1f);
22   membank("bank1")->set_entry(data & 0x1f);
2323}
2424
2525WRITE8_MEMBER(hcastle_state::hcastle_soundirq_w)
r14976r14977
179179static MACHINE_START( hcastle )
180180{
181181   hcastle_state *state = machine.driver_data<hcastle_state>();
182   UINT8 *ROM = machine.region("maincpu")->base();
182   UINT8 *ROM = state->memregion("maincpu")->base();
183183
184   memory_configure_bank(machine, "bank1", 0, 16, &ROM[0x10000], 0x2000);
184   state->membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x2000);
185185
186186   state->m_audiocpu = machine.device("audiocpu");
187187   state->m_k007121_1 = machine.device("k007121_1");
src/mame/drivers/cntsteer.c
r14976r14977
8585
8686static PALETTE_INIT( zerotrgt )
8787{
88   const UINT8 *color_prom = machine.region("proms")->base();
88   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8989   int i;
9090   for (i = 0; i < machine.total_colors(); i++)
9191   {
r14976r14977
11441144
11451145static void zerotrgt_rearrange_gfx( running_machine &machine, int romsize, int romarea )
11461146{
1147   UINT8 *src = machine.region("gfx4")->base();
1148   UINT8 *dst = machine.region("gfx3")->base();
1147   UINT8 *src = machine.root_device().memregion("gfx4")->base();
1148   UINT8 *dst = machine.root_device().memregion("gfx3")->base();
11491149   int rm;
11501150   int cnt1;
11511151
r14976r14977
11641164#if 0
11651165static DRIVER_INIT( cntsteer )
11661166{
1167   UINT8 *RAM = machine.region("subcpu")->base();
1167   UINT8 *RAM = machine.root_device().memregion("subcpu")->base();
11681168
11691169   RAM[0xc2cf] = 0x43; /* Patch out Cpu 1 ram test - it never ends..?! */
11701170   RAM[0xc2d0] = 0x43;
src/mame/drivers/csplayh5.c
r14976r14977
167167
168168static void csplayh5_soundbank_w(running_machine &machine, int data)
169169{
170   UINT8 *SNDROM = machine.region("audiocpu")->base();
170   UINT8 *SNDROM = machine.root_device().memregion("audiocpu")->base();
171171
172   memory_set_bankptr(machine, "bank1", &SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
172   machine.root_device().membank("bank1")->set_base(&SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
173173}
174174
175175READ8_MEMBER(csplayh5_state::csplayh5_sound_r)
r14976r14977
670670
671671void general_init(running_machine &machine, int patchaddress)
672672{
673   UINT16 *MAINROM = (UINT16 *)machine.region("maincpu")->base();
674   UINT8 *SNDROM = machine.region("audiocpu")->base();
673   UINT16 *MAINROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
674   UINT8 *SNDROM = machine.root_device().memregion("audiocpu")->base();
675675
676676   // initialize sound rom bank
677677   csplayh5_soundbank_w(machine, 0);
src/mame/drivers/nexus3d.c
r14976r14977
263263{
264264   nexus3d_state *state = machine.driver_data<nexus3d_state>();
265265   // the first part of the flash ROM automatically gets copied to RAM
266   memcpy( state->m_mainram, machine.region("user1")->base(), 4 * 1024);
267   state->m_flash_region = machine.region("user1")->base();
266   memcpy( state->m_mainram, machine.root_device().memregion("user1")->base(), 4 * 1024);
267   state->m_flash_region = state->memregion("user1")->base();
268268}
269269
270270GAME( 2005, acheart,  0, nexus3d, nexus3d, nexus3d, ROT0, "Examu", "Arcana Heart",GAME_IS_SKELETON )
src/mame/drivers/bking.c
r14976r14977
5959
6060READ8_MEMBER(bking_state::bking3_extrarom_r)
6161{
62   UINT8 *rom = machine().region("user2")->base();
62   UINT8 *rom = memregion("user2")->base();
6363   return rom[m_addr_h * 256 + m_addr_l];
6464}
6565
src/mame/drivers/labyrunr.c
r14976r14977
3232   if (data & 0xe0) popmessage("bankswitch %02x", data);
3333
3434   /* bits 0-2 = bank number */
35   memory_set_bank(machine(), "bank1", data & 0x07);   // shall we check if data&7 > #banks?
35   membank("bank1")->set_entry(data & 0x07);   // shall we check if data&7 > #banks?
3636
3737   /* bits 3 and 4 are coin counters */
3838   coin_counter_w(machine(), 0, data & 0x08);
r14976r14977
180180static MACHINE_START( labyrunr )
181181{
182182   labyrunr_state *state = machine.driver_data<labyrunr_state>();
183   UINT8 *ROM = machine.region("maincpu")->base();
183   UINT8 *ROM = state->memregion("maincpu")->base();
184184
185   memory_configure_bank(machine, "bank1", 0, 6, &ROM[0x10000], 0x4000);
185   state->membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
186186
187187   state->m_k007121 = machine.device("k007121");
188188}
src/mame/drivers/shougi.c
r14976r14977
133133
134134static PALETTE_INIT( shougi )
135135{
136   const UINT8 *color_prom = machine.region("proms")->base();
136   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
137137   int i;
138138   static const int resistances_b[2]  = { 470, 220 };
139139   static const int resistances_rg[3] = { 1000, 470, 220 };
src/mame/drivers/thief.c
r14976r14977
636636
637637static DRIVER_INIT( thief )
638638{
639   UINT8 *dest = machine.region( "maincpu" )->base();
640   const UINT8 *source = machine.region( "cpu1" )->base();
639   UINT8 *dest = machine.root_device().memregion( "maincpu" )->base();
640   const UINT8 *source = machine.root_device().memregion( "cpu1" )->base();
641641
642642   /* C8 is mapped (banked) in CPU1's address space; it contains Z80 code */
643643   memcpy( &dest[0xe010], &source[0x290], 0x20 );
src/mame/drivers/hornet.c
r14976r14977
597597WRITE32_MEMBER(hornet_state::comm_rombank_w)
598598{
599599   int bank = data >> 24;
600   UINT8 *usr3 = machine().region("user3")->base();
600   UINT8 *usr3 = memregion("user3")->base();
601601   if (usr3 != NULL)
602      memory_set_bank(machine(), "bank1", bank & 0x7f);
602      membank("bank1")->set_entry(bank & 0x7f);
603603}
604604
605605READ32_MEMBER(hornet_state::comm0_unk_r)
r14976r14977
893893
894894static MACHINE_RESET( hornet )
895895{
896   UINT8 *usr3 = machine.region("user3")->base();
897   UINT8 *usr5 = machine.region("user5")->base();
896   UINT8 *usr3 = machine.root_device().memregion("user3")->base();
897   UINT8 *usr5 = machine.root_device().memregion("user5")->base();
898898   if (usr3 != NULL)
899899   {
900      memory_configure_bank(machine, "bank1", 0, machine.region("user3")->bytes() / 0x40000, usr3, 0x40000);
901      memory_set_bank(machine, "bank1", 0);
900      machine.root_device().membank("bank1")->configure_entries(0, machine.root_device().memregion("user3")->bytes() / 0x40000, usr3, 0x40000);
901      machine.root_device().membank("bank1")->set_entry(0);
902902   }
903903
904904   cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
905905
906906   if (usr5)
907      memory_set_bankptr(machine, "bank5", usr5);
907      machine.root_device().membank("bank5")->set_base(usr5);
908908}
909909
910910static double adc12138_input_callback( device_t *device, UINT8 input )
r14976r14977
10141014
10151015static MACHINE_RESET( hornet_2board )
10161016{
1017   UINT8 *usr3 = machine.region("user3")->base();
1018   UINT8 *usr5 = machine.region("user5")->base();
1017   UINT8 *usr3 = machine.root_device().memregion("user3")->base();
1018   UINT8 *usr5 = machine.root_device().memregion("user5")->base();
10191019
10201020   if (usr3 != NULL)
10211021   {
1022      memory_configure_bank(machine, "bank1", 0, machine.region("user3")->bytes() / 0x40000, usr3, 0x40000);
1023      memory_set_bank(machine, "bank1", 0);
1022      machine.root_device().membank("bank1")->configure_entries(0, machine.root_device().memregion("user3")->bytes() / 0x40000, usr3, 0x40000);
1023      machine.root_device().membank("bank1")->set_entry(0);
10241024   }
10251025   cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
10261026   cputag_set_input_line(machine, "dsp2", INPUT_LINE_RESET, ASSERT_LINE);
10271027
10281028   if (usr5)
1029      memory_set_bankptr(machine, "bank5", usr5);
1029      machine.root_device().membank("bank5")->set_base(usr5);
10301030}
10311031
10321032static MACHINE_CONFIG_DERIVED( hornet_2board, hornet )
r14976r14977
12441244{
12451245   hornet_state *state = machine.driver_data<hornet_state>();
12461246   init_konami_cgboard(machine, 1, CGBOARD_TYPE_HORNET);
1247   set_cgboard_texture_bank(machine, 0, "bank5", machine.region("user5")->base());
1247   set_cgboard_texture_bank(machine, 0, "bank5", state->memregion("user5")->base());
12481248
12491249   state->m_led_reg0 = state->m_led_reg1 = 0x7f;
12501250
r14976r14977
12551255{
12561256   hornet_state *state = machine.driver_data<hornet_state>();
12571257   init_konami_cgboard(machine, 2, CGBOARD_TYPE_HORNET);
1258   set_cgboard_texture_bank(machine, 0, "bank5", machine.region("user5")->base());
1259   set_cgboard_texture_bank(machine, 1, "bank6", machine.region("user5")->base());
1258   set_cgboard_texture_bank(machine, 0, "bank5", machine.root_device().memregion("user5")->base());
1259   set_cgboard_texture_bank(machine, 1, "bank6", state->memregion("user5")->base());
12601260
12611261   state->m_led_reg0 = state->m_led_reg1 = 0x7f;
12621262
src/mame/drivers/pipedrm.c
r14976r14977
188188    */
189189
190190   /* set the memory bank on the Z80 using the low 3 bits */
191   memory_set_bank(space->machine(), "bank1", data & 0x7);
191   state->membank("bank1")->set_entry(data & 0x7);
192192
193193   /* map to the fromance gfx register */
194194   state->fromance_gfxreg_w(*space, offset, ((data >> 6) & 0x01) |    /* flipscreen */
r14976r14977
198198
199199static WRITE8_HANDLER( sound_bankswitch_w )
200200{
201   memory_set_bank(space->machine(), "bank2", data & 0x01);
201   space->machine().root_device().membank("bank2")->set_entry(data & 0x01);
202202}
203203
204204
r14976r14977
595595   state->m_subcpu = machine.device("sub");
596596
597597   /* initialize main Z80 bank */
598   memory_configure_bank(machine, "bank1", 0, 8, machine.region("maincpu")->base() + 0x10000, 0x2000);
599   memory_set_bank(machine, "bank1", 0);
598   state->membank("bank1")->configure_entries(0, 8, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
599   state->membank("bank1")->set_entry(0);
600600
601601   /* initialize sound bank */
602   memory_configure_bank(machine, "bank2", 0, 2, machine.region("sub")->base() + 0x10000, 0x8000);
603   memory_set_bank(machine, "bank2", 0);
602   state->membank("bank2")->configure_entries(0, 2, state->memregion("sub")->base() + 0x10000, 0x8000);
603   state->membank("bank2")->set_entry(0);
604604
605605   /* state save */
606606   state->save_item(NAME(state->m_pending_command));
src/mame/drivers/ccastles.c
r14976r14977
191191   rectangle visarea;
192192
193193   /* initialize globals */
194   state->m_syncprom = machine.region("proms")->base() + 0x000;
194   state->m_syncprom = machine.root_device().memregion("proms")->base() + 0x000;
195195
196196   /* find the start of VBLANK in the SYNC PROM */
197197   for (state->m_vblank_start = 0; state->m_vblank_start < 256; state->m_vblank_start++)
r14976r14977
213213   machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
214214
215215   /* configure the ROM banking */
216   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0xa000, 0x6000);
216   state->membank("bank1")->configure_entries(0, 2, state->memregion("maincpu")->base() + 0xa000, 0x6000);
217217
218218   /* create a timer for IRQs and set up the first callback */
219219   state->m_irq_timer = machine.scheduler().timer_alloc(FUNC(clock_irq));
r14976r14977
265265
266266WRITE8_MEMBER(ccastles_state::bankswitch_w)
267267{
268   memory_set_bank(machine(), "bank1", data & 1);
268   membank("bank1")->set_entry(data & 1);
269269}
270270
271271
src/mame/drivers/discoboy.c
r14976r14977
199199#ifdef UNUSED_FUNCTION
200200void discoboy_setrombank( running_machine &machine, UINT8 data )
201201{
202   UINT8 *ROM = machine.region("maincpu")->base();
202   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
203203   data &= 0x2f;
204   memory_set_bankptr(space->machine(), "bank1", &ROM[0x6000 + (data * 0x1000)] );
204   space->machine().root_device().membank("bank1")->set_base(&ROM[0x6000 + (data * 0x1000)] );
205205}
206206#endif
207207
r14976r14977
225225   // discoboy gfxbank
226226   m_gfxbank = data & 0xf0;
227227
228   memory_set_bank(machine(), "bank1", data & 0x07);
228   membank("bank1")->set_entry(data & 0x07);
229229}
230230
231231WRITE8_MEMBER(discoboy_state::discoboy_port_03_w)// sfx? (to sound cpu)
r14976r14977
329329   /* Note: this is bit 5 on yunsung8.c */
330330   msm5205_reset_w(device, (data & 0x08) >> 3);
331331
332   memory_set_bank(device->machine(), "sndbank", data & 0x07);
332   device->machine().root_device().membank("sndbank")->set_entry(data & 0x07);
333333
334334   if (data != (data & (~0x0f)))
335335      logerror("%s: Bank %02X\n", device->machine().describe_context(), data);
r14976r14977
560560static DRIVER_INIT( discoboy )
561561{
562562   discoboy_state *state = machine.driver_data<discoboy_state>();
563   UINT8 *ROM = machine.region("maincpu")->base();
564   UINT8 *AUDIO = machine.region("audiocpu")->base();
563   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
564   UINT8 *AUDIO = state->memregion("audiocpu")->base();
565565
566566   memset(state->m_ram_1, 0, sizeof(state->m_ram_1));
567567   memset(state->m_ram_2, 0, sizeof(state->m_ram_2));
r14976r14977
575575   state->save_item(NAME(state->m_ram_3));
576576   state->save_item(NAME(state->m_ram_4));
577577
578   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
579   memory_set_bank(machine, "bank1", 0);
580   memory_configure_bank(machine, "sndbank", 0, 8, &AUDIO[0x00000], 0x4000);
581   memory_set_bank(machine, "sndbank", 0);
578   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
579   state->membank("bank1")->set_entry(0);
580   state->membank("sndbank")->configure_entries(0, 8, &AUDIO[0x00000], 0x4000);
581   state->membank("sndbank")->set_entry(0);
582582}
583583
584584
src/mame/drivers/mediagx.c
r14976r14977
10451045static MACHINE_RESET(mediagx)
10461046{
10471047   mediagx_state *state = machine.driver_data<mediagx_state>();
1048   UINT8 *rom = machine.region("bios")->base();
1048   UINT8 *rom = state->memregion("bios")->base();
10491049
10501050   device_set_irq_callback(machine.device("maincpu"), irq_callback);
10511051
src/mame/drivers/policetr.c
r14976r14977
186186
187187READ32_MEMBER(policetr_state::bsmt2000_data_r)
188188{
189   return machine().region("bsmt")->base()[m_bsmt_data_bank * 0x10000 + m_bsmt_data_offset] << 8;
189   return memregion("bsmt")->base()[m_bsmt_data_bank * 0x10000 + m_bsmt_data_offset] << 8;
190190}
191191
192192
src/mame/drivers/skimaxx.c
r14976r14977
138138static VIDEO_START( skimaxx )
139139{
140140   skimaxx_state *state = machine.driver_data<skimaxx_state>();
141   state->m_blitter_gfx = (UINT16 *) machine.region( "blitter" )->base();
142   state->m_blitter_gfx_len = machine.region( "blitter" )->bytes() / 2;
141   state->m_blitter_gfx = (UINT16 *) machine.root_device().memregion( "blitter" )->base();
142   state->m_blitter_gfx_len = state->memregion( "blitter" )->bytes() / 2;
143143
144144   state->m_bg_buffer = auto_alloc_array(machine, UINT32, 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 2);   // 2 buffers
145145   state->m_bg_buffer_back  = state->m_bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 0;
146146   state->m_bg_buffer_front = state->m_bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * 1;
147   memory_configure_bank(machine, "bank1", 0, 1, state->m_bg_buffer_back,  0);
148   memory_configure_bank(machine, "bank1", 1, 1, state->m_bg_buffer_front, 0);
147   state->membank("bank1")->configure_entry(0, state->m_bg_buffer_back);
148   state->membank("bank1")->configure_entry(1, state->m_bg_buffer_front);
149149}
150150
151151static SCREEN_UPDATE_IND16( skimaxx )
r14976r14977
265265      m_bg_buffer_back  = m_bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * bank_bg_buffer;
266266      m_bg_buffer_front = m_bg_buffer + 0x400 * 0x100 * sizeof(UINT16) / sizeof(UINT32) * (1 - bank_bg_buffer);
267267
268      memory_set_bank(machine(), "bank1", bank_bg_buffer);
268      membank("bank1")->set_entry(bank_bg_buffer);
269269   }
270270}
271271
src/mame/drivers/megadrvb.c
r14976r14977
659659     * Game does a check @ 1afc00 with work RAM fff57c that makes it play like the original console version (i.e. 8 energy hits instead of 2)
660660     */
661661   #if ENERGY_CONSOLE_MODE
662   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
662   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
663663   rom[0x1afc08/2] = 0x6600;
664664   #endif
665665
r14976r14977
675675// after this decode look like intentional changes
676676static DRIVER_INIT( mk3mdb )
677677{
678   UINT8 *rom = machine.region("maincpu")->base();
678   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
679679
680680   for (int x = 0x000001; x < 0x100001; x += 2)
681681   {
r14976r14977
726726   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x400000, 0x5fffff, "bank5");
727727   machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x400000, 0x5fffff);
728728
729   memory_set_bankptr(machine,  "bank5", machine.region( "maincpu" )->base() + 0x400000 );
729   machine.root_device().membank("bank5")->set_base(machine.root_device().memregion( "maincpu" )->base() + 0x400000 );
730730
731731   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770070, 0x770075, FUNC(ssf2mdb_dsw_r) );
732732
r14976r14977
736736
737737static DRIVER_INIT( srmdb )
738738{
739   UINT8* rom = machine.region("maincpu")->base();
739   UINT8* rom = machine.root_device().memregion("maincpu")->base();
740740
741741   /* todo, reduce bitswaps to single swap */
742742   for (int x = 0x00001; x < 0x40000; x += 2)
src/mame/drivers/gaplus.c
r14976r14977
872872   UINT8 *rom;
873873   int i;
874874
875   rom = machine.region("gfx1")->base();
875   rom = machine.root_device().memregion("gfx1")->base();
876876   for (i = 0;i < 0x2000;i++)
877877      rom[i + 0x2000] = rom[i] >> 4;
878878
879   rom = machine.region("gfx2")->base() + 0x6000;
879   rom = machine.root_device().memregion("gfx2")->base() + 0x6000;
880880   for (i = 0;i < 0x2000;i++)
881881      rom[i + 0x2000] = rom[i] << 4;
882882}
src/mame/drivers/carpolo.c
r14976r14977
331331
332332
333333   /* invert gfx PROM since the bits are active LO */
334   ROM = machine.region("gfx2")->base();
335   len = machine.region("gfx2")->bytes();
334   ROM = machine.root_device().memregion("gfx2")->base();
335   len = machine.root_device().memregion("gfx2")->bytes();
336336   for (i = 0;i < len; i++)
337337      ROM[i] ^= 0x0f;
338338}
src/mame/drivers/coinmvga.c
r14976r14977
872872static DRIVER_INIT( colorama )
873873{
874874   UINT16 *ROM;
875   ROM = (UINT16 *)machine.region("maincpu")->base();
875   ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
876876
877877   // rte in non-irq routines? wtf? patch them to rts...
878878   ROM[0x02B476/2] = 0x5470;
r14976r14977
889889static DRIVER_INIT( cmrltv75 )
890890{
891891   UINT16 *ROM;
892   ROM = (UINT16 *)machine.region("maincpu")->base();
892   ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
893893
894894   // rte in non-irq routines? wtf? patch them to rts...
895895   ROM[0x056fd6/2] = 0x5470;
src/mame/drivers/powerins.c
r14976r14977
4848{
4949   if (ACCESSING_BITS_0_7)
5050   {
51      UINT8 *RAM = machine().region("oki1")->base();
51      UINT8 *RAM = memregion("oki1")->base();
5252      int new_bank = data & 0x7;
5353
5454      if (new_bank != m_oki_bank)
src/mame/drivers/cultures.c
r14976r14977
5757static TILE_GET_INFO( get_bg1_tile_info )
5858{
5959   cultures_state *state = machine.driver_data<cultures_state>();
60   UINT8 *region = machine.region("gfx3")->base() + 0x200000 + 0x80000 * state->m_bg1_bank;
60   UINT8 *region = state->memregion("gfx3")->base() + 0x200000 + 0x80000 * state->m_bg1_bank;
6161   int code = region[tile_index * 2] + (region[tile_index * 2 + 1] << 8);
6262   SET_TILE_INFO(2, code, code >> 12, 0);
6363}
r14976r14977
6565static TILE_GET_INFO( get_bg2_tile_info )
6666{
6767   cultures_state *state = machine.driver_data<cultures_state>();
68   UINT8 *region = machine.region("gfx2")->base() + 0x200000 + 0x80000 * state->m_bg2_bank;
68   UINT8 *region = state->memregion("gfx2")->base() + 0x200000 + 0x80000 * state->m_bg2_bank;
6969   int code = region[tile_index * 2] + (region[tile_index * 2 + 1] << 8);
7070   SET_TILE_INFO(1, code, code >> 12, 0);
7171}
r14976r14977
128128
129129WRITE8_MEMBER(cultures_state::cpu_bankswitch_w)
130130{
131   memory_set_bank(machine(), "bank1", data & 0x0f);
131   membank("bank1")->set_entry(data & 0x0f);
132132   m_video_bank = ~data & 0x20;
133133}
134134
r14976r14977
161161   if (m_old_bank != new_bank)
162162   {
163163      // oki banking
164      UINT8 *src = machine().region("oki")->base() + 0x40000 + 0x20000 * new_bank;
165      UINT8 *dst = machine().region("oki")->base() + 0x20000;
164      UINT8 *src = memregion("oki")->base() + 0x40000 + 0x20000 * new_bank;
165      UINT8 *dst = memregion("oki")->base() + 0x20000;
166166      memcpy(dst, src, 0x20000);
167167
168168      m_old_bank = new_bank;
r14976r14977
370370static MACHINE_START( cultures )
371371{
372372   cultures_state *state = machine.driver_data<cultures_state>();
373   UINT8 *ROM = machine.region("maincpu")->base();
373   UINT8 *ROM = state->memregion("maincpu")->base();
374374
375   memory_configure_bank(machine, "bank1", 0, 16, &ROM[0x0000], 0x4000);
375   state->membank("bank1")->configure_entries(0, 16, &ROM[0x0000], 0x4000);
376376
377377   state->save_item(NAME(state->m_paletteram));
378378   state->save_item(NAME(state->m_old_bank));
src/mame/drivers/5clown.c
r14976r14977
537537
538538static PALETTE_INIT( fclown )
539539{
540   const UINT8 *color_prom = machine.region("proms")->base();
540   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
541541/*
542542    7654 3210
543543    ---- ---x   RED component.
r14976r14977
12051205    /* Decrypting main program */
12061206
12071207   int x;
1208   UINT8 *src = machine.region( "maincpu" )->base();
1208   UINT8 *src = state->memregion( "maincpu" )->base();
12091209
12101210   for (x = 0x0000; x < 0x10000; x++)
12111211   {
r14976r14977
12151215
12161216    /* Decrypting GFX by segments */
12171217
1218   UINT8 *gfx1_src = machine.region( "gfx1" )->base();
1219   UINT8 *gfx2_src = machine.region( "gfx2" )->base();
1218   UINT8 *gfx1_src = machine.root_device().memregion( "gfx1" )->base();
1219   UINT8 *gfx2_src = machine.root_device().memregion( "gfx2" )->base();
12201220
12211221   for (x = 0x2000; x < 0x3000; x++)
12221222   {
r14976r14977
12361236
12371237    /* Decrypting sound samples */
12381238
1239   UINT8 *samples_src = machine.region( "oki6295" )->base();
1239   UINT8 *samples_src = machine.root_device().memregion( "oki6295" )->base();
12401240
12411241   for (x = 0x0000; x < 0x10000; x++)
12421242   {
src/mame/drivers/jedi.c
r14976r14977
162162   state->m_interrupt_timer->adjust(machine.primary_screen->time_until_pos(32), 32);
163163
164164   /* configure the banks */
165   memory_configure_bank(machine, "bank1", 0, 3, machine.region("maincpu")->base() + 0x10000, 0x4000);
165   state->membank("bank1")->configure_entries(0, 3, state->memregion("maincpu")->base() + 0x10000, 0x4000);
166166
167167   /* set up save state */
168168   state->save_item(NAME(state->m_nvram_enabled));
r14976r14977
195195
196196WRITE8_MEMBER(jedi_state::rom_banksel_w)
197197{
198   if (data & 0x01) memory_set_bank(machine(), "bank1", 0);
199   if (data & 0x02) memory_set_bank(machine(), "bank1", 1);
200   if (data & 0x04) memory_set_bank(machine(), "bank1", 2);
198   if (data & 0x01) membank("bank1")->set_entry(0);
199   if (data & 0x02) membank("bank1")->set_entry(1);
200   if (data & 0x04) membank("bank1")->set_entry(2);
201201}
202202
203203
src/mame/drivers/seta2.c
r14976r14977
122122{
123123   if (ACCESSING_BITS_0_7)
124124   {
125      UINT8 *ROM = machine().region( "x1snd" )->base();
126      int banks = (machine().region( "x1snd" )->bytes() - 0x100000) / 0x20000;
125      UINT8 *ROM = memregion( "x1snd" )->base();
126      int banks = (machine().root_device().memregion( "x1snd" )->bytes() - 0x100000) / 0x20000;
127127      if (data >= banks)
128128      {
129129         logerror("CPU #0 PC %06X: invalid sound bank %04X\n",cpu_get_pc(&space.device()),data);
r14976r14977
325325READ16_MEMBER(seta2_state::pzlbowl_protection_r)
326326{
327327   UINT32 address = (space.read_word(0x20ba16) << 16) | space.read_word(0x20ba18);
328   return machine().region("maincpu")->base()[address - 2];
328   return memregion("maincpu")->base()[address - 2];
329329}
330330
331331READ16_MEMBER(seta2_state::pzlbowl_coins_r)
r14976r14977
24082408
24092409static DRIVER_INIT( funcube2 )
24102410{
2411   UINT32 *main_cpu = (UINT32 *) machine.region("maincpu")->base();
2412   UINT16 *sub_cpu  = (UINT16 *) machine.region("sub")->base();
2411   UINT32 *main_cpu = (UINT32 *) machine.root_device().memregion("maincpu")->base();
2412   UINT16 *sub_cpu  = (UINT16 *) machine.root_device().memregion("sub")->base();
24132413
24142414   main_cpu[0xa5c/4] = 0x4e713e3c;       // PIC protection?
24152415   main_cpu[0xa74/4] = 0x4e713e3c;
r14976r14977
24212421
24222422static DRIVER_INIT( funcube3 )
24232423{
2424   UINT32 *main_cpu = (UINT32 *) machine.region("maincpu")->base();
2425   UINT16 *sub_cpu  = (UINT16 *) machine.region("sub")->base();
2424   UINT32 *main_cpu = (UINT32 *) machine.root_device().memregion("maincpu")->base();
2425   UINT16 *sub_cpu  = (UINT16 *) machine.root_device().memregion("sub")->base();
24262426
24272427   main_cpu[0x008bc/4] = 0x4a804e71;
24282428   main_cpu[0x19f0c/4] = 0x4e714e71;
src/mame/drivers/flkatck.c
r14976r14977
3636
3737   /* bits 0-1: bank # */
3838   if ((data & 0x03) != 0x03)   /* for safety */
39      memory_set_bank(machine(), "bank1", data & 0x03);
39      membank("bank1")->set_entry(data & 0x03);
4040}
4141
4242READ8_MEMBER(flkatck_state::flkatck_ls138_r)
r14976r14977
195195static MACHINE_START( flkatck )
196196{
197197   flkatck_state *state = machine.driver_data<flkatck_state>();
198   UINT8 *ROM = machine.region("maincpu")->base();
198   UINT8 *ROM = state->memregion("maincpu")->base();
199199
200   memory_configure_bank(machine, "bank1", 0, 3, &ROM[0x10000], 0x2000);
200   state->membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x2000);
201201
202202   state->m_audiocpu = machine.device("audiocpu");
203203   state->m_k007121 = machine.device("k007121");
src/mame/drivers/contra.c
r14976r14977
3434
3535WRITE8_MEMBER(contra_state::contra_bankswitch_w)
3636{
37   memory_set_bank(machine(), "bank1", data & 0x0f);
37   membank("bank1")->set_entry(data & 0x0f);
3838}
3939
4040WRITE8_MEMBER(contra_state::contra_sh_irqtrigger_w)
r14976r14977
178178static MACHINE_START( contra )
179179{
180180   contra_state *state = machine.driver_data<contra_state>();
181   UINT8 *ROM = machine.region("maincpu")->base();
181   UINT8 *ROM = state->memregion("maincpu")->base();
182182
183   memory_configure_bank(machine, "bank1", 0, 16, &ROM[0x10000], 0x2000);
183   state->membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x2000);
184184
185185   state->m_audiocpu = machine.device("audiocpu");
186186   state->m_k007121_1 = machine.device("k007121_1");
src/mame/drivers/zn.c
r14976r14977
684684
685685WRITE32_MEMBER(zn_state::bank_coh1000c_w)
686686{
687   memory_set_bankptr( machine(), "bank2", machine().region( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
687   membank( "bank2" )->set_base( memregion( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
688688}
689689
690690WRITE8_MEMBER(zn_state::qsound_bankswitch_w)
691691{
692   memory_set_bankptr( machine(), "bank10", machine().region( "audiocpu" )->base() + 0x10000 + ( ( data & 0x0f ) * 0x4000 ) );
692   membank( "bank10" )->set_base( memregion( "audiocpu" )->base() + 0x10000 + ( ( data & 0x0f ) * 0x4000 ) );
693693}
694694
695695static INTERRUPT_GEN( qsound_interrupt )
r14976r14977
728728
729729static MACHINE_RESET( coh1000c )
730730{
731   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* fixed game rom */
732   memory_set_bankptr( machine, "bank2", machine.region( "user2" )->base() + 0x400000 ); /* banked game rom */
733   memory_set_bankptr( machine, "bank3", machine.region( "user3" )->base() ); /* country rom */
731   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* fixed game rom */
732   machine.root_device().membank( "bank2" )->set_base( machine.root_device().memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
733   machine.root_device().membank( "bank3" )->set_base( machine.root_device().memregion( "user3" )->base() ); /* country rom */
734734   zn_machine_init(machine);
735735}
736736
r14976r14977
918918
919919WRITE32_MEMBER(zn_state::bank_coh3002c_w)
920920{
921   memory_set_bankptr( machine(), "bank2", machine().region( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
921   membank( "bank2" )->set_base( memregion( "user2" )->base() + 0x400000 + ( data * 0x400000 ) );
922922}
923923
924924static DRIVER_INIT( coh3002c )
r14976r14977
937937
938938static MACHINE_RESET( coh3002c )
939939{
940   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* fixed game rom */
941   memory_set_bankptr( machine, "bank2", machine.region( "user2" )->base() + 0x400000 ); /* banked game rom */
942   memory_set_bankptr( machine, "bank3", machine.region( "user3" )->base() ); /* country rom */
940   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* fixed game rom */
941   machine.root_device().membank( "bank2" )->set_base( machine.root_device().memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
942   machine.root_device().membank( "bank3" )->set_base( machine.root_device().memregion( "user3" )->base() ); /* country rom */
943943   zn_machine_init(machine);
944944}
945945
r14976r14977
11801180   device_t *mb3773 = machine().device("mb3773");
11811181   mb3773_set_ck(mb3773, (data & 0x20) >> 5);
11821182   verboselog( machine(), 1, "bank_coh1000t_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
1183   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
1183   membank( "bank1" )->set_base( memregion( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
11841184}
11851185
11861186WRITE8_MEMBER(zn_state::fx1a_sound_bankswitch_w)
11871187{
1188   memory_set_bankptr( machine(), "bank10", machine().region( "audiocpu" )->base() + 0x10000 + ( ( ( data - 1 ) & 0x07 ) * 0x4000 ) );
1188   membank( "bank10" )->set_base( memregion( "audiocpu" )->base() + 0x10000 + ( ( ( data - 1 ) & 0x07 ) * 0x4000 ) );
11891189}
11901190
11911191READ32_MEMBER(zn_state::taitofx1a_ymsound_r)
r14976r14977
12251225static MACHINE_RESET( coh1000ta )
12261226{
12271227   zn_state *state = machine.driver_data<zn_state>();
1228   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* banked game rom */
1229   memory_set_bankptr( machine, "bank2", state->m_taitofx1_eeprom1 );
1228   state->membank( "bank1" )->set_base( state->memregion( "user2" )->base() ); /* banked game rom */
1229   state->membank( "bank2" )->set_base( state->m_taitofx1_eeprom1 );
12301230   zn_machine_init(machine);
12311231}
12321232
r14976r14977
13201320{
13211321   zn_state *state = machine.driver_data<zn_state>();
13221322
1323   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* banked game rom */
1324   memory_set_bankptr( machine, "bank2", state->m_taitofx1_eeprom1 );
1325   memory_set_bankptr( machine, "bank3", state->m_taitofx1_eeprom2 );
1323   state->membank( "bank1" )->set_base( state->memregion( "user2" )->base() ); /* banked game rom */
1324   state->membank( "bank2" )->set_base( state->m_taitofx1_eeprom1 );
1325   state->membank( "bank3" )->set_base( state->m_taitofx1_eeprom2 );
13261326   zn_machine_init(machine);
13271327}
13281328
r14976r14977
15051505
15061506static MACHINE_RESET( coh1000w )
15071507{
1508   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* fixed game rom */
1508   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* fixed game rom */
15091509   zn_machine_init(machine);
15101510
15111511   devtag_reset(machine, "ide");
r14976r14977
16701670{
16711671   znsecsel_w( space, offset, data, mem_mask );
16721672
1673   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
1673   membank( "bank1" )->set_base( memregion( "user2" )->base() + ( ( data & 3 ) * 0x800000 ) );
16741674}
16751675
16761676WRITE32_MEMBER(zn_state::coh1002e_latch_w)
r14976r14977
16931693
16941694static MACHINE_RESET( coh1002e )
16951695{
1696   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* banked game rom */
1696   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* banked game rom */
16971697   zn_machine_init(machine);
16981698}
16991699
r14976r14977
17841784   {
17851785      if (ACCESSING_BITS_0_15)
17861786      {
1787         memory_set_bankptr( machine(), "bank2", machine().region( "user2" )->base() + ( ( data & 0xf ) * 0x400000 ) );
1787         membank( "bank2" )->set_base( memregion( "user2" )->base() + ( ( data & 0xf ) * 0x400000 ) );
17881788      }
17891789      else if (ACCESSING_BITS_16_31)
17901790      {
r14976r14977
18391839
18401840static MACHINE_RESET( bam2 )
18411841{
1842   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* fixed game rom */
1843   memory_set_bankptr( machine, "bank2", machine.region( "user2" )->base() + 0x400000 ); /* banked game rom */
1842   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* fixed game rom */
1843   machine.root_device().membank( "bank2" )->set_base( machine.root_device().memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
18441844
18451845   zn_machine_init(machine);
18461846}
r14976r14977
21582158      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1fbfff08, 0x1fbfff0b, read32_delegate(FUNC(zn_state::nbajamex_08_r),state));
21592159      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1fbfff80, 0x1fbfff83, read32_delegate(FUNC(zn_state::nbajamex_80_r),state), write32_delegate(FUNC(zn_state::nbajamex_80_w),state));
21602160
2161      memory_set_bankptr( machine, "bank2", state->m_nbajamex_eeprom ); /* ram/eeprom/?? */
2161      state->membank( "bank2" )->set_base( state->m_nbajamex_eeprom ); /* ram/eeprom/?? */
21622162   }
21632163
21642164   if( ( !strcmp( machine.system().name, "jdredd" ) ) ||
r14976r14977
21762176
21772177static MACHINE_RESET( coh1000a )
21782178{
2179   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* fixed game rom */
2179   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* fixed game rom */
21802180   zn_machine_init(machine);
21812181   if( ( !strcmp( machine.system().name, "jdredd" ) ) ||
21822182      ( !strcmp( machine.system().name, "jdreddb" ) ) )
r14976r14977
23182318
23192319WRITE32_MEMBER(zn_state::coh1001l_bnk_w)
23202320{
2321   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ( ( ( data >> 16 ) & 3 ) * 0x800000 ) );
2321   membank( "bank1" )->set_base( memregion( "user2" )->base() + ( ( ( data >> 16 ) & 3 ) * 0x800000 ) );
23222322}
23232323
23242324static DRIVER_INIT( coh1001l )
r14976r14977
23322332
23332333static MACHINE_RESET( coh1001l )
23342334{
2335   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* banked rom */
2335   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* banked rom */
23362336   zn_machine_init(machine);
23372337}
23382338
r14976r14977
23612361
23622362WRITE32_MEMBER(zn_state::coh1002v_bnk_w)
23632363{
2364   memory_set_bankptr( machine(), "bank2", machine().region( "user3" )->base() + ( data * 0x100000 ) );
2364   membank( "bank2" )->set_base( memregion( "user3" )->base() + ( data * 0x100000 ) );
23652365}
23662366
23672367static DRIVER_INIT( coh1002v )
r14976r14977
23762376
23772377static MACHINE_RESET( coh1002v )
23782378{
2379   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() ); /* fixed game rom */
2380   memory_set_bankptr( machine, "bank2", machine.region( "user3" )->base() ); /* banked rom */
2379   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() ); /* fixed game rom */
2380   machine.root_device().membank( "bank2" )->set_base( machine.root_device().memregion( "user3" )->base() ); /* banked rom */
23812381   zn_machine_init(machine);
23822382}
23832383
r14976r14977
25462546WRITE32_MEMBER(zn_state::coh1002m_bank_w)
25472547{
25482548   verboselog( machine(), 1, "coh1002m_bank_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
2549   memory_set_bankptr( machine(), "bank1", machine().region( "user2" )->base() + ((data>>16) * 0x800000) );
2549   membank( "bank1" )->set_base( memregion( "user2" )->base() + ((data>>16) * 0x800000) );
25502550}
25512551
25522552READ32_MEMBER(zn_state::cbaj_z80_r)
r14976r14977
25802580
25812581static MACHINE_RESET( coh1002m )
25822582{
2583   memory_set_bankptr( machine, "bank1", machine.region( "user2" )->base() );
2583   machine.root_device().membank( "bank1" )->set_base( machine.root_device().memregion( "user2" )->base() );
25842584   zn_machine_init(machine);
25852585}
25862586
src/mame/drivers/paradise.c
r14976r14977
4747WRITE8_MEMBER(paradise_state::paradise_rombank_w)
4848{
4949   int bank = data;
50   int bank_n = machine().region("maincpu")->bytes() / 0x4000 - 1;
50   int bank_n = memregion("maincpu")->bytes() / 0x4000 - 1;
5151
5252   if (bank >= bank_n)
5353   {
r14976r14977
5555      bank %= bank_n;
5656   }
5757
58   memory_set_bank(machine(), "bank1", bank);
58   membank("bank1")->set_entry(bank);
5959}
6060
6161static WRITE8_DEVICE_HANDLER( paradise_okibank_w )
r14976r14977
629629static MACHINE_START( paradise )
630630{
631631   paradise_state *state = machine.driver_data<paradise_state>();
632   int bank_n = machine.region("maincpu")->bytes() / 0x4000 - 1;
633   UINT8 *ROM = machine.region("maincpu")->base();
632   int bank_n = machine.root_device().memregion("maincpu")->bytes() / 0x4000 - 1;
633   UINT8 *ROM = state->memregion("maincpu")->base();
634634
635   memory_configure_bank(machine, "bank1", 0, 3, &ROM[0x00000], 0x4000);
636   memory_configure_bank(machine, "bank1", 3, bank_n - 3, &ROM[0x10000], 0x4000);
635   state->membank("bank1")->configure_entries(0, 3, &ROM[0x00000], 0x4000);
636   state->membank("bank1")->configure_entries(3, bank_n - 3, &ROM[0x10000], 0x4000);
637637
638638   state->save_item(NAME(state->m_palbank));
639639   state->save_item(NAME(state->m_priority));
src/mame/drivers/balsente.c
r14976r14977
20792079
20802080   UINT8 *temp = auto_alloc_array(machine, UINT8, 0x20000);
20812081   {
2082      UINT8 *rom = machine.region("maincpu")->base();
2083      UINT32 len = machine.region("maincpu")->bytes();
2082      UINT8 *rom = machine.root_device().memregion("maincpu")->base();
2083      UINT32 len = machine.root_device().memregion("maincpu")->bytes();
20842084      UINT32 base;
20852085
20862086      for (base = 0x10000; base < len; base += 0x30000)
r14976r14977
21542154static DRIVER_INIT( triviag1 ) { expand_roms(machine, EXPAND_ALL);  config_shooter_adc(machine, FALSE, 0 /* noanalog */); }
21552155static DRIVER_INIT( triviag2 )
21562156{
2157   UINT8 *rom = machine.region("maincpu")->base();
2157   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
21582158   memcpy(&rom[0x20000], &rom[0x28000], 0x4000);
21592159   memcpy(&rom[0x24000], &rom[0x28000], 0x4000);
21602160   expand_roms(machine, EXPAND_NONE); config_shooter_adc(machine, FALSE, 0 /* noanalog */);
src/mame/drivers/galpani3.c
r14976r14977
400400
401401   state->m_sprite_bitmap_1.fill(0x0000, cliprect);
402402
403   state->m_spritegen->skns_draw_sprites(screen.machine(), state->m_sprite_bitmap_1, cliprect, &state->m_spriteram32[0], 0x4000, screen.machine().region("gfx1")->base(), screen.machine().region ("gfx1")->bytes(), state->m_spc_regs );
403   state->m_spritegen->skns_draw_sprites(screen.machine(), state->m_sprite_bitmap_1, cliprect, &state->m_spriteram32[0], 0x4000, screen.machine().root_device().memregion("gfx1")->base(), screen.machine().root_device().memregion ("gfx1")->bytes(), state->m_spc_regs );
404404
405405   // ignoring priority bits for now..
406406   for (y=0;y<240;y++)
r14976r14977
748748{
749749
750750   UINT32 address = m_regs1_address_regs[1]| (m_regs1_address_regs[0]<<16);
751   UINT8* rledata = machine().region("gfx2")->base();
751   UINT8* rledata = memregion("gfx2")->base();
752752
753753   printf("galpani3_regs1_go_w? %08x\n",address );
754754   if ((data==0x2000) || (data==0x3000)) gp3_do_rle(address, m_framebuffer1, rledata);
r14976r14977
766766{
767767
768768   UINT32 address = m_regs2_address_regs[1]| (m_regs2_address_regs[0]<<16);
769   UINT8* rledata = machine().region("gfx2")->base();
769   UINT8* rledata = memregion("gfx2")->base();
770770
771771   printf("galpani3_regs2_go_w? %08x\n", address );
772772
r14976r14977
788788{
789789
790790   UINT32 address =  m_regs3_address_regs[1]| (m_regs3_address_regs[0]<<16);
791   UINT8* rledata = machine().region("gfx2")->base();
791   UINT8* rledata = memregion("gfx2")->base();
792792
793793   printf("galpani3_regs3_go_w? %08x\n",address );
794794
src/mame/drivers/itgambl2.c
r14976r14977
8686{
8787   itgambl2_state *state = screen.machine().driver_data<itgambl2_state>();
8888   int x,y,count;
89   const UINT8 *blit_ram = screen.machine().region("gfx1")->base();
89   const UINT8 *blit_ram = state->memregion("gfx1")->base();
9090
9191   if(screen.machine().input().code_pressed(KEYCODE_Z))
9292      state->m_test_x++;
src/mame/drivers/fitfight.c
r14976r14977
10021002
10031003static DRIVER_INIT( fitfight )
10041004{
1005//  UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
1005//  UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
10061006//  mem16[0x0165B2/2] = 0x4e71; // for now so it boots
10071007   fitfight_state *state = machine.driver_data<fitfight_state>();
10081008   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::fitfight_700000_r),state));
r14976r14977
10111011
10121012static DRIVER_INIT( histryma )
10131013{
1014//  UINT16 *mem16 = (UINT16 *)machine.region("maincpu")->base();
1014//  UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
10151015//  mem16[0x017FDC/2] = 0x4e71; // for now so it boots
10161016   fitfight_state *state = machine.driver_data<fitfight_state>();
10171017   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::histryma_700000_r),state));
src/mame/drivers/ddribble.c
r14976r14977
3535
3636WRITE8_MEMBER(ddribble_state::ddribble_bankswitch_w)
3737{
38   memory_set_bank(machine(), "bank1", data & 0x0f);
38   membank("bank1")->set_entry(data & 0x0f);
3939}
4040
4141
r14976r14977
8282static WRITE8_DEVICE_HANDLER( ddribble_vlm5030_ctrl_w )
8383{
8484   ddribble_state *state = device->machine().driver_data<ddribble_state>();
85   UINT8 *SPEECH_ROM = device->machine().region("vlm")->base();
85   UINT8 *SPEECH_ROM = state->memregion("vlm")->base();
8686
8787   /* b7 : vlm data bus OE   */
8888
r14976r14977
247247static MACHINE_START( ddribble )
248248{
249249   ddribble_state *state = machine.driver_data<ddribble_state>();
250   UINT8 *ROM = machine.region("maincpu")->base();
251   memory_configure_bank(machine, "bank1", 0, 5, &ROM[0x10000], 0x2000);
250   UINT8 *ROM = state->memregion("maincpu")->base();
251   state->membank("bank1")->configure_entries(0, 5, &ROM[0x10000], 0x2000);
252252
253253   state->m_filter1 = machine.device("filter1");
254254   state->m_filter2 = machine.device("filter2");
src/mame/drivers/malzak.c
r14976r14977
153153//  Bit 6 is used only in Malzak II, and is set high after checking
154154//        the selected version
155155//  logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n", cpu_get_pc(machine().device("maincpu")), data);
156   memory_set_bank(machine(), "bank1", (data & 0x40) >> 6);
156   membank("bank1")->set_entry((data & 0x40) >> 6);
157157}
158158
159159WRITE8_MEMBER(malzak_state::port60_w)
r14976r14977
370370{
371371   malzak_state *state = machine.driver_data<malzak_state>();
372372
373   memory_configure_bank(machine, "bank1", 0, 2, machine.region("user2")->base(), 0x400);
373   state->membank("bank1")->configure_entries(0, 2, state->memregion("user2")->base(), 0x400);
374374
375375   state->m_s2636_0 = machine.device("s2636_0");
376376   state->m_s2636_1 = machine.device("s2636_1");
src/mame/drivers/deco32.c
r14976r14977
32463246extern void process_dvi_data(UINT8* dvi_data, int offset, int regionsize);
32473247static DRIVER_INIT( dragngun )
32483248{
3249   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
3250   const UINT8 *SRC_RAM = machine.region("gfx1")->base();
3251   UINT8 *DST_RAM = machine.region("gfx2")->base();
3249   UINT32 *ROM = (UINT32 *)machine.root_device().memregion("maincpu")->base();
3250   const UINT8 *SRC_RAM = machine.root_device().memregion("gfx1")->base();
3251   UINT8 *DST_RAM = machine.root_device().memregion("gfx2")->base();
32523252
32533253   deco74_decrypt_gfx(machine, "gfx1");
32543254   deco74_decrypt_gfx(machine, "gfx2");
r14976r14977
32613261
32623262#if 0
32633263   {
3264      UINT8 *ROM = machine.region("dvi")->base();
3264      UINT8 *ROM = machine.root_device().memregion("dvi")->base();
32653265
32663266      FILE *fp;
32673267      char filename[256];
r14976r14977
32763276#endif
32773277
32783278   // there are DVI headers at 0x000000, 0x580000, 0x800000, 0xB10000, 0xB80000
3279   process_dvi_data(machine.region("dvi")->base(),0x000000, 0x1000000);
3280   process_dvi_data(machine.region("dvi")->base(),0x580000, 0x1000000);
3281   process_dvi_data(machine.region("dvi")->base(),0x800000, 0x1000000);
3282   process_dvi_data(machine.region("dvi")->base(),0xB10000, 0x1000000);
3283   process_dvi_data(machine.region("dvi")->base(),0xB80000, 0x1000000);
3279   process_dvi_data(machine.root_device().memregion("dvi")->base(),0x000000, 0x1000000);
3280   process_dvi_data(machine.root_device().memregion("dvi")->base(),0x580000, 0x1000000);
3281   process_dvi_data(machine.root_device().memregion("dvi")->base(),0x800000, 0x1000000);
3282   process_dvi_data(machine.root_device().memregion("dvi")->base(),0xB10000, 0x1000000);
3283   process_dvi_data(machine.root_device().memregion("dvi")->base(),0xB80000, 0x1000000);
32843284
32853285}
32863286
r14976r14977
32943294
32953295static DRIVER_INIT( lockload )
32963296{
3297   UINT8 *RAM = machine.region("maincpu")->base();
3298//  UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
3297   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
3298//  UINT32 *ROM = (UINT32 *)machine.root_device().memregion("maincpu")->base();
32993299
33003300   deco74_decrypt_gfx(machine, "gfx1");
33013301   deco74_decrypt_gfx(machine, "gfx2");
r14976r14977
33113311
33123312static DRIVER_INIT( tattass )
33133313{
3314   UINT8 *RAM = machine.region("gfx1")->base();
3314   UINT8 *RAM = machine.root_device().memregion("gfx1")->base();
33153315   UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000);
33163316
33173317   /* Reorder bitplanes to make decoding easier */
r14976r14977
33193319   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33203320   memcpy(RAM+0x100000,tmp,0x80000);
33213321
3322   RAM = machine.region("gfx2")->base();
3322   RAM = machine.root_device().memregion("gfx2")->base();
33233323   memcpy(tmp,RAM+0x80000,0x80000);
33243324   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33253325   memcpy(RAM+0x100000,tmp,0x80000);
r14976r14977
33323332
33333333static DRIVER_INIT( nslasher )
33343334{
3335   UINT8 *RAM = machine.region("gfx1")->base();
3335   UINT8 *RAM = machine.root_device().memregion("gfx1")->base();
33363336   UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000);
33373337
33383338   /* Reorder bitplanes to make decoding easier */
r14976r14977
33403340   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33413341   memcpy(RAM+0x100000,tmp,0x80000);
33423342
3343   RAM = machine.region("gfx2")->base();
3343   RAM = machine.root_device().memregion("gfx2")->base();
33443344   memcpy(tmp,RAM+0x80000,0x80000);
33453345   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33463346   memcpy(RAM+0x100000,tmp,0x80000);
src/mame/drivers/midzeus.c
r14976r14977
9292
9393static MACHINE_RESET( midzeus )
9494{
95   memcpy(ram_base, machine.region("user1")->base(), 0x40000*4);
95   memcpy(ram_base, machine.root_device().memregion("user1")->base(), 0x40000*4);
9696   *ram_base <<= 1;
9797   machine.device("maincpu")->reset();
9898
r14976r14977
268268
269269      /* ROM bank selection on Zeus 2 */
270270      case 5:
271         memory_set_bank(machine(), "bank1", bitlatch[offset] & 3);
271         membank("bank1")->set_entry(bitlatch[offset] & 3);
272272         break;
273273
274274      /* unknown purpose; crusnexo/thegrid write 1 at startup */
r14976r14977
14411441{
14421442   dcs2_init(machine, 0, 0);
14431443   midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL);
1444   memory_configure_bank(machine, "bank1", 0, 3, machine.region("user2")->base(), 0x400000*4);
1444   machine.root_device().membank("bank1")->configure_entries(0, 3, machine.root_device().memregion("user2")->base(), 0x400000*4);
14451445   midzeus_state *state = machine.driver_data<midzeus_state>();
14461446   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x9b0004, 0x9b0007, read32_delegate(FUNC(midzeus_state::crusnexo_leds_r),state), write32_delegate(FUNC(midzeus_state::crusnexo_leds_w),state));
14471447   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    (0x8d0009, 0x8d000a, write32_delegate(FUNC(midzeus_state::keypad_select_w),state));
r14976r14977
14521452{
14531453   dcs2_init(machine, 0, 0);
14541454   midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL);
1455   memory_configure_bank(machine, "bank1", 0, 3, machine.region("user2")->base(), 0x400000*4);
1455   machine.root_device().membank("bank1")->configure_entries(0, 3, machine.root_device().memregion("user2")->base(), 0x400000*4);
14561456}
14571457
14581458
src/mame/drivers/argus.c
r14976r14977
176176
177177WRITE8_MEMBER(argus_state::argus_bankselect_w)
178178{
179   UINT8 *RAM = machine().region("maincpu")->base();
179   UINT8 *RAM = memregion("maincpu")->base();
180180   int bankaddress;
181181
182182   bankaddress = 0x10000 + ((data & 7) * 0x4000);
183   memory_set_bankptr(machine(), "bank1", &RAM[bankaddress]);    /* Select 8 banks of 16k */
183   membank("bank1")->set_base(&RAM[bankaddress]);    /* Select 8 banks of 16k */
184184}
185185
186186
src/mame/drivers/drw80pkr.c
r14976r14977
116116   {
117117      m_active_bank = m_active_bank ^ 0x01;
118118
119      memory_set_bank(machine(), "bank1", m_active_bank);
119      membank("bank1")->set_entry(m_active_bank);
120120   }
121121}
122122
r14976r14977
347347
348348static PALETTE_INIT( drw80pkr )
349349{
350   const UINT8 *color_prom = machine.region("proms")->base();
350   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
351351   int j;
352352
353353   for (j = 0; j < machine.total_colors(); j++)
r14976r14977
405405
406406static DRIVER_INIT( drw80pkr )
407407{
408   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base(), 0x1000);
408   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base(), 0x1000);
409409}
410410
411411
src/mame/drivers/superdq.c
r14976r14977
8282
8383static PALETTE_INIT( superdq )
8484{
85   const UINT8 *color_prom = machine.region("proms")->base();
85   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
8686   int i;
8787   static const int resistances[3] = { 820, 390, 200 };
8888   double rweights[3], gweights[3], bweights[2];
src/mame/drivers/zaxxon.c
r14976r14977
14301430
14311431   int A;
14321432   address_space *space = machine.device(cputag)->memory().space(AS_PROGRAM);
1433   UINT8 *rom = machine.region(cputag)->base();
1434   int size = machine.region(cputag)->bytes();
1433   UINT8 *rom = machine.root_device().memregion(cputag)->base();
1434   int size = machine.root_device().memregion(cputag)->bytes();
14351435   UINT8 *decrypt = auto_alloc_array(machine, UINT8, size);
14361436
14371437   space->set_decrypted_region(0x0000, size - 1, decrypt);
src/mame/drivers/shangkid.c
r14976r14977
5858
5959WRITE8_MEMBER(shangkid_state::shangkid_maincpu_bank_w)
6060{
61   memory_set_bank(machine(), "bank1", data & 1);
61   membank("bank1")->set_entry(data & 1);
6262}
6363
6464WRITE8_MEMBER(shangkid_state::shangkid_bbx_enable_w)
r14976r14977
104104         cputag_set_input_line(device->machine(), "audiocpu", 0, HOLD_LINE );
105105   }
106106   else
107      memory_set_bank(device->machine(), "bank2", data ? 0 : 1);
107      state->membank("bank2")->set_entry(data ? 0 : 1);
108108}
109109
110110static WRITE8_DEVICE_HANDLER( ay8910_portb_w )
r14976r14977
134134   state->m_gfx_type = 1;
135135
136136   /* set up banking */
137   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x8000, 0x8000);
138   memory_configure_bank(machine, "bank2", 0, 2, machine.region("audiocpu")->base() + 0x0000, 0x10000);
137   state->membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x8000, 0x8000);
138   state->membank("bank2")->configure_entries(0, 2, state->memregion("audiocpu")->base() + 0x0000, 0x10000);
139139}
140140
141141/***************************************************************************************/
r14976r14977
149149{
150150   cputag_set_input_line(machine, "bbx", INPUT_LINE_HALT, 1 );
151151
152   memory_set_bank(machine, "bank1", 0);
153   memory_set_bank(machine, "bank2", 0);
152   machine.root_device().membank("bank1")->set_entry(0);
153   machine.root_device().membank("bank2")->set_entry(0);
154154}
155155
156156/***************************************************************************************/
src/mame/drivers/norautp.c
r14976r14977
33953395*/
33963396//static DRIVER_INIT( norautrh )
33973397//{
3398//  UINT8 *ROM = machine.region("maincpu")->base();
3398//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
33993399//  ROM[0x1110] = 0x00;
34003400//  ROM[0x1111] = 0x00;
34013401//}
34023402
34033403//static DRIVER_INIT( norautpn )
34043404//{
3405//  UINT8 *ROM = machine.region("maincpu")->base();
3405//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
34063406//  ROM[0x0827] = 0x00;
34073407//  ROM[0x0828] = 0x00;
34083408//}
34093409
34103410//static DRIVER_INIT( norautu )
34113411//{
3412//  UINT8 *ROM = machine.region("maincpu")->base();
3412//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
34133413//  ROM[0x083c] = 0x00;
34143414//  ROM[0x083d] = 0x00;
34153415//  ROM[0x083e] = 0x00;
r14976r14977
34173417
34183418//static DRIVER_INIT( gtipoker )
34193419//{
3420//  UINT8 *ROM = machine.region("maincpu")->base();
3420//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
34213421//  ROM[0x0cc6] = 0x00;
34223422//  ROM[0x0cc7] = 0x00;
34233423//  ROM[0x0cc8] = 0x00;
r14976r14977
34283428
34293429//static DRIVER_INIT( dphl )
34303430//{
3431//  UINT8 *ROM = machine.region("maincpu")->base();
3431//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
34323432//  ROM[0x1510] = 0x00;
34333433//  ROM[0x1511] = 0x00;
34343434//  ROM[0x1512] = 0x00;
r14976r14977
34363436
34373437//static DRIVER_INIT( dphla )
34383438//{
3439//  UINT8 *ROM = machine.region("maincpu")->base();
3439//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
34403440//  ROM[0x0b09] = 0x00;
34413441//  ROM[0x0b0a] = 0x00;
34423442//  ROM[0x0b0b] = 0x00;
r14976r14977
34463446{
34473447/* Attempt to decrypt the program ROM */
34483448
3449//  UINT8 *rom = machine.region("maincpu")->base();
3449//  UINT8 *rom = machine.root_device().memregion("maincpu")->base();
34503450//  UINT8 *buffer;
3451//  int size = 0x2000; //machine.region("maincpu")->bytes();
3451//  int size = 0x2000; //machine.root_device().memregion("maincpu")->bytes();
34523452//  int start = 0;
34533453//  int i;
34543454
r14976r14977
34853485/* Just for debugging purposes */
34863486/*   Should be removed soon    */
34873487{
3488   UINT8 *ROM = machine.region("maincpu")->base();
3488   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
34893489   ROM[0x02f7] = 0xca;
34903490   ROM[0x02f8] = 0x18;
34913491   ROM[0x206c] = 0xff;
r14976r14977
34953495/* Passing the video PPI handshaking lines */
34963496/* Just for debugging purposes */
34973497{
3498//  UINT8 *ROM = machine.region("maincpu")->base();
3498//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
34993499
35003500//  ROM[0x073b] = 0x00;
35013501//  ROM[0x073c] = 0x00;
src/mame/drivers/acesp.c
r14976r14977
12371237
12381238DRIVER_INIT( ace_cr )
12391239{
1240   descramble_crystal(machine.region( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
1240   descramble_crystal(machine.root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
12411241}
12421242
12431243DRIVER_INIT( ace_sp )
src/mame/drivers/fastfred.c
r14976r14977
142142
143143WRITE8_MEMBER(fastfred_state::imago_sprites_dma_w)
144144{
145   UINT8 *rom = (UINT8 *)machine().region("gfx2")->base();
145   UINT8 *rom = (UINT8 *)machine().root_device().memregion("gfx2")->base();
146146   UINT8 sprites_data;
147147
148148   sprites_data = rom[m_imago_sprites_address + 0x2000*0 + m_imago_sprites_bank * 0x1000];
src/mame/drivers/karnov.c
r14976r14977
11531153static DRIVER_INIT( chelnov )
11541154{
11551155   karnov_state *state = machine.driver_data<karnov_state>();
1156   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
1156   UINT16 *RAM = (UINT16 *)state->memregion("maincpu")->base();
11571157
11581158   state->m_microcontroller_id = CHELNOV;
11591159   state->m_coin_mask = 0xe0;
r14976r14977
11641164static DRIVER_INIT( chelnovu )
11651165{
11661166   karnov_state *state = machine.driver_data<karnov_state>();
1167   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
1167   UINT16 *RAM = (UINT16 *)state->memregion("maincpu")->base();
11681168
11691169   state->m_microcontroller_id = CHELNOVU;
11701170   state->m_coin_mask = 0xe0;
r14976r14977
11751175static DRIVER_INIT( chelnovj )
11761176{
11771177   karnov_state *state = machine.driver_data<karnov_state>();
1178   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
1178   UINT16 *RAM = (UINT16 *)state->memregion("maincpu")->base();
11791179
11801180   state->m_microcontroller_id = CHELNOVJ;
11811181   state->m_coin_mask = 0xe0;
src/mame/drivers/lwings.c
r14976r14977
7777   flip_screen_set(~data & 0x01);
7878
7979   /* bits 1 and 2 select ROM bank */
80   memory_set_bank(machine(), "bank1", (data & 0x06) >> 1);
80   membank("bank1")->set_entry((data & 0x06) >> 1);
8181
8282   /* bit 3 enables NMI */
8383   m_nmi_mask = data & 8;
r14976r14977
748748static MACHINE_START( lwings )
749749{
750750   lwings_state *state = machine.driver_data<lwings_state>();
751   UINT8 *ROM = machine.region("maincpu")->base();
751   UINT8 *ROM = state->memregion("maincpu")->base();
752752
753   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
753   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
754754
755755   state->save_item(NAME(state->m_bg2_image));
756756   state->save_item(NAME(state->m_scroll_x));
src/mame/drivers/maxaflex.c
r14976r14977
503503
504504static DRIVER_INIT( a600xl )
505505{
506   UINT8 *rom = machine.region("maincpu")->base();
506   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
507507   memcpy( rom + 0x5000, rom + 0xd000, 0x800 );
508508}
509509
src/mame/drivers/atvtrack.c
r14976r14977
6060#include "cpu/sh4/sh4.h"
6161#include "debugger.h"
6262
63const memory_region *nandregion;
63memory_region *nandregion;
6464int nandcommand[4], nandoffset[4], nandaddressstep, nandaddress[4];
6565UINT32 area1_data[4];
6666
r14976r14977
326326   address_space *as;
327327
328328   nandaddressstep = 0;
329   nandregion = machine.region("maincpu");
329   nandregion = machine.root_device().memregion("maincpu");
330330   as = machine.device("maincpu")->memory().space(AS_PROGRAM);
331331   dst = (UINT8 *)(as->get_write_ptr(0x0c7f0000));
332332   src = nandregion->base()+0x10;
src/mame/drivers/cclimber.c
r14976r14977
248248   m_toprollr_rombank |= (data & 1) << offset;
249249
250250   if (m_toprollr_rombank < 3)
251      memory_set_bank(machine(), "bank1", m_toprollr_rombank);
251      membank("bank1")->set_entry(m_toprollr_rombank);
252252}
253253
254254static MACHINE_RESET( cclimber )
src/mame/drivers/xorworld.c
r14976r14977
223223   /*  patch some strange protection (without this, strange characters appear
224224        after level 5 and some pieces don't rotate properly some times) */
225225
226   UINT16 *rom = (UINT16 *)(machine.region("maincpu")->base() + 0x1390);
226   UINT16 *rom = (UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x1390);
227227
228228   PATCH(0x4239); PATCH(0x00ff); PATCH(0xe196);   /* clr.b $ffe196 */
229229   PATCH(0x4239); PATCH(0x00ff); PATCH(0xe197);   /* clr.b $ffe197 */
src/mame/drivers/forte2.c
r14976r14977
144144static DRIVER_INIT(pesadelo)
145145{
146146   int i;
147   UINT8 *mem = machine.region("maincpu")->base();
148   int memsize = machine.region("maincpu")->bytes();
147   UINT8 *mem = machine.root_device().memregion("maincpu")->base();
148   int memsize = machine.root_device().memregion("maincpu")->bytes();
149149   UINT8 *buf;
150150
151151   // data swap
src/mame/drivers/aliens.c
r14976r14977
230230static MACHINE_START( aliens )
231231{
232232   aliens_state *state = machine.driver_data<aliens_state>();
233   UINT8 *ROM = machine.region("maincpu")->base();
233   UINT8 *ROM = state->memregion("maincpu")->base();
234234
235   memory_configure_bank(machine, "bank1", 0, 20, &ROM[0x10000], 0x2000);
236   memory_set_bank(machine, "bank1", 0);
235   state->membank("bank1")->configure_entries(0, 20, &ROM[0x10000], 0x2000);
236   state->membank("bank1")->set_entry(0);
237237
238238   state->m_maincpu = machine.device("maincpu");
239239   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
545545      bank -= 4;
546546
547547   bank += (lines & 0x0f);
548   memory_set_bank(device->machine(), "bank1", bank);
548   device->machine().root_device().membank("bank1")->set_entry(bank);
549549}
550550
551551GAME( 1990, aliens,   0,      aliens, aliens, 0, ROT0, "Konami", "Aliens (World set 1)", GAME_SUPPORTS_SAVE )
src/mame/drivers/88games.c
r14976r14977
266266static KONAMI_SETLINES_CALLBACK( k88games_banking )
267267{
268268   _88games_state *state = device->machine().driver_data<_88games_state>();
269   UINT8 *RAM = device->machine().region("maincpu")->base();
269   UINT8 *RAM = state->memregion("maincpu")->base();
270270   int offs;
271271
272272   logerror("%04x: bank select %02x\n", cpu_get_pc(device), lines);
r14976r14977
330330   _88games_state *state = machine.driver_data<_88games_state>();
331331
332332   konami_configure_set_lines(machine.device("maincpu"), k88games_banking);
333   state->m_generic_paletteram_8.set_target(&machine.region("maincpu")->base()[0x20000], 0x1000);
333   state->m_generic_paletteram_8.set_target(&state->memregion("maincpu")->base()[0x20000], 0x1000);
334334
335335   state->m_videobank = 0;
336336   state->m_zoomreadroms = 0;
src/mame/drivers/ddenlovr.c
r14976r14977
430430static int blit_draw( running_machine &machine, int src, int sx )
431431{
432432   dynax_state *state = machine.driver_data<dynax_state>();
433   UINT8 *src_data = machine.region("blitter")->base();
434   int src_len = machine.region("blitter")->bytes();
433   UINT8 *src_data = machine.root_device().memregion("blitter")->base();
434   int src_len = state->memregion("blitter")->bytes();
435435   int bit_addr = (src & 0xffffff) * state->m_ddenlovr_blit_rom_bits;   /* convert to bit address */
436436   int pen_size, arg_size, cmd;
437437   int x;
r14976r14977
12351235
12361236READ8_MEMBER(dynax_state::rongrong_gfxrom_r)
12371237{
1238   UINT8 *rom  = machine().region("blitter")->base();
1239   size_t size = machine().region("blitter")->bytes();
1238   UINT8 *rom  = memregion("blitter")->base();
1239   size_t size = memregion("blitter")->bytes();
12401240   int address = m_ddenlovr_blit_address;
12411241
12421242   if (address >= size)
r14976r14977
13091309
13101310#if 0
13111311   static int base = 0x0;
1312   const UINT8 *gfx = screen.machine().region("blitter")->base();
1312   const UINT8 *gfx = screen.machine().root_device().memregion("blitter")->base();
13131313   int next;
13141314   memset(state->m_ddenlovr_pixmap[0], 0, 512 * 512);
13151315   memset(state->m_ddenlovr_pixmap[1], 0, 512 * 512);
r14976r14977
19851985//logerror("%04x: rongrong_select_w %02x\n",cpu_get_pc(&space.device()),data);
19861986
19871987   /* bits 0-4 = **both** ROM bank **AND** input select */
1988   memory_set_bank(machine(), "bank1", data & 0x1f);
1988   membank("bank1")->set_entry(data & 0x1f);
19891989   m_dsw_sel = data;
19901990
19911991   /* bits 5-7 = RAM bank */
1992   memory_set_bank(machine(), "bank2", ((data & 0xe0) >> 5));
1992   membank("bank2")->set_entry(((data & 0xe0) >> 5));
19931993}
19941994
19951995
r14976r14977
20832083
20842084WRITE8_MEMBER(dynax_state::mmpanic_rombank_w)
20852085{
2086   memory_set_bank(machine(), "bank1", data & 0x7);
2086   membank("bank1")->set_entry(data & 0x7);
20872087   /* Bit 4? */
20882088}
20892089
r14976r14977
22442244
22452245   m_dsw_sel = data;
22462246
2247   memory_set_bank(machine(), "bank1", data & 0x0f);
2247   membank("bank1")->set_entry(data & 0x0f);
22482248   // bit 4 selects palette ram at 8000?
2249   memory_set_bank(machine(), "bank2", ((data & 0xe0) >> 5));
2249   membank("bank2")->set_entry(((data & 0xe0) >> 5));
22502250}
22512251
22522252READ8_MEMBER(dynax_state::funkyfig_dsw_r)
r14976r14977
23522352
23532353WRITE8_MEMBER(dynax_state::hanakanz_rombank_w)
23542354{
2355   memory_set_bank(machine(), "bank1", data & 0x0f);
2356   memory_set_bank(machine(), "bank2", ((data & 0xf0) >> 4));
2355   membank("bank1")->set_entry(data & 0x0f);
2356   membank("bank2")->set_entry(((data & 0xf0) >> 4));
23572357}
23582358
23592359static ADDRESS_MAP_START( hanakanz_map, AS_PROGRAM, 8, dynax_state )
r14976r14977
24072407
24082408READ8_MEMBER(dynax_state::hanakanz_gfxrom_r)
24092409{
2410   UINT8 *rom  = machine().region("blitter")->base();
2411   size_t size = machine().region("blitter")->bytes();
2410   UINT8 *rom  = memregion("blitter")->base();
2411   size_t size = memregion("blitter")->bytes();
24122412   int address = (m_ddenlovr_blit_address & 0xffffff) * 2;
24132413
24142414   if (address >= size)
r14976r14977
25852585static void mjchuuka_get_romdata(running_machine &machine)
25862586{
25872587   dynax_state *state = machine.driver_data<dynax_state>();
2588   UINT8 *rom = machine.region("blitter")->base();
2589   size_t size = machine.region("blitter")->bytes();
2588   UINT8 *rom = machine.root_device().memregion("blitter")->base();
2589   size_t size = state->memregion("blitter")->bytes();
25902590   int address = (state->m_ddenlovr_blit_address & 0xffffff) * 2;
25912591
25922592   if (address >= size)
r14976r14977
26992699
27002700WRITE8_MEMBER(dynax_state::mjmyster_rambank_w)
27012701{
2702   memory_set_bank(machine(), "bank2", data & 0x07);
2702   membank("bank2")->set_entry(data & 0x07);
27032703   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data);
27042704}
27052705
r14976r14977
28132813
28142814WRITE8_MEMBER(dynax_state::hginga_rombank_w)
28152815{
2816   memory_set_bank(machine(), "bank1", data & 0x7);
2816   membank("bank1")->set_entry(data & 0x7);
28172817   m_hginga_rombank = data;
28182818}
28192819
28202820// similar to rongrong
28212821READ8_MEMBER(dynax_state::hginga_protection_r)
28222822{
2823   UINT8 *rom = machine().region("maincpu")->base();
2823   UINT8 *rom = memregion("maincpu")->base();
28242824
28252825   if (m_hginga_rombank & 0x10)
28262826      return hanakanz_rand_r(space, 0);
r14976r14977
30463046// similar to rongrong
30473047READ8_MEMBER(dynax_state::hgokou_protection_r)
30483048{
3049   UINT8 *rom = machine().region("maincpu")->base();
3049   UINT8 *rom = memregion("maincpu")->base();
30503050
30513051   if (m_hginga_rombank == 0)
30523052      return hanakanz_rand_r(space, 0);
r14976r14977
31583158   m_dsw_sel = data;
31593159   m_keyb = 0;
31603160
3161   memory_set_bank(machine(), "bank1", data & 0x07);
3162   memory_set_bank(machine(), "bank2", ((data & 0xe0) >> 5));
3161   membank("bank1")->set_entry(data & 0x07);
3162   membank("bank2")->set_entry(((data & 0xe0) >> 5));
31633163}
31643164
31653165
r14976r14977
33833383
33843384WRITE8_MEMBER(dynax_state::mjflove_rombank_w)
33853385{
3386   memory_set_bank(machine(), "bank1", data & 0xf);
3386   membank("bank1")->set_entry(data & 0xf);
33873387}
33883388
33893389static WRITE8_DEVICE_HANDLER( mjflove_okibank_w )
r14976r14977
35563556
35573557WRITE8_MEMBER(dynax_state::sryudens_rambank_w)
35583558{
3559   memory_set_bank(machine(), "bank2", data & 0x0f);
3559   membank("bank2")->set_entry(data & 0x0f);
35603560   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data);
35613561}
35623562
r14976r14977
76137613
76147614static MACHINE_START( rongrong )
76157615{
7616   UINT8 *ROM = machine.region("maincpu")->base();
7617   memory_configure_bank(machine, "bank1", 0, 0x20, &ROM[0x010000], 0x8000);
7618   memory_configure_bank(machine, "bank2", 0, 8,    &ROM[0x110000], 0x1000);
7616   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7617   machine.root_device().membank("bank1")->configure_entries(0, 0x20, &ROM[0x010000], 0x8000);
7618   machine.root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x110000], 0x1000);
76197619
76207620   MACHINE_START_CALL(ddenlovr);
76217621}
76227622
76237623static MACHINE_START( mmpanic )
76247624{
7625   UINT8 *ROM = machine.region("maincpu")->base();
7626   memory_configure_bank(machine, "bank1", 0, 8,    &ROM[0x10000], 0x8000);
7625   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7626   machine.root_device().membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
76277627
76287628   MACHINE_START_CALL(ddenlovr);
76297629}
76307630
76317631static MACHINE_START( funkyfig )
76327632{
7633   UINT8 *ROM = machine.region("maincpu")->base();
7634   memory_configure_bank(machine, "bank1", 0, 0x10, &ROM[0x10000], 0x8000);
7635   memory_configure_bank(machine, "bank2", 0, 8,    &ROM[0x90000], 0x1000);
7633   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7634   machine.root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
7635   machine.root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
76367636
76377637   MACHINE_START_CALL(ddenlovr);
76387638}
76397639
76407640static MACHINE_START( hanakanz )
76417641{
7642   UINT8 *ROM = machine.region("maincpu")->base();
7643   memory_configure_bank(machine, "bank1", 0, 0x10, &ROM[0x10000], 0x8000);
7644   memory_configure_bank(machine, "bank2", 0, 0x10, &ROM[0x90000], 0x1000);
7642   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7643   machine.root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
7644   machine.root_device().membank("bank2")->configure_entries(0, 0x10, &ROM[0x90000], 0x1000);
76457645
76467646   MACHINE_START_CALL(ddenlovr);
76477647}
76487648
76497649static MACHINE_START( mjmyster )
76507650{
7651   UINT8 *ROM = machine.region("maincpu")->base();
7652   memory_configure_bank(machine, "bank1", 0, 8,    &ROM[0x10000], 0x8000);
7653   memory_configure_bank(machine, "bank2", 0, 8,    &ROM[0x90000], 0x1000);
7651   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7652   machine.root_device().membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
7653   machine.root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
76547654
76557655   MACHINE_START_CALL(ddenlovr);
76567656}
76577657
76587658static MACHINE_START( hparadis )
76597659{
7660   UINT8 *ROM = machine.region("maincpu")->base();
7661   memory_configure_bank(machine, "bank1", 0, 8,    &ROM[0x10000], 0x8000);
7662   memory_configure_bank(machine, "bank2", 0, 8,    &ROM[0x50000], 0x1000);
7660   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7661   machine.root_device().membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
7662   machine.root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x50000], 0x1000);
76637663
76647664   MACHINE_START_CALL(ddenlovr);
76657665}
76667666
76677667static MACHINE_START( mjflove )
76687668{
7669   UINT8 *ROM = machine.region("maincpu")->base();
7670   memory_configure_bank(machine, "bank1", 0, 0x10, &ROM[0x10000], 0x8000);
7671   memory_configure_bank(machine, "bank2", 0, 8,    &ROM[0x90000], 0x1000);
7669   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7670   machine.root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
7671   machine.root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
76727672
76737673   MACHINE_START_CALL(ddenlovr);
76747674}
76757675
76767676static MACHINE_START( sryudens )
76777677{
7678   UINT8 *ROM = machine.region("maincpu")->base();
7679   memory_configure_bank(machine, "bank1", 0, 0x10, &ROM[0x10000], 0x8000);
7680   memory_configure_bank(machine, "bank2", 0, 0x10, &ROM[0x90000], 0x1000);
7678   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
7679   machine.root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
7680   machine.root_device().membank("bank2")->configure_entries(0, 0x10, &ROM[0x90000], 0x1000);
76817681
76827682   MACHINE_START_CALL(ddenlovr);
76837683}
src/mame/drivers/chinagat.c
r14976r14977
180180
181181static WRITE8_HANDLER( chinagat_bankswitch_w )
182182{
183   memory_set_bank(space->machine(), "bank1", data & 0x07);   // shall we check (data & 7) < 6 (# of banks)?
183   space->machine().root_device().membank("bank1")->set_entry(data & 0x07);   // shall we check (data & 7) < 6 (# of banks)?
184184}
185185
186186static WRITE8_HANDLER( chinagat_sub_bankswitch_w )
187187{
188   memory_set_bank(space->machine(), "bank4", data & 0x07);   // shall we check (data & 7) < 6 (# of banks)?
188   space->machine().root_device().membank("bank4")->set_entry(data & 0x07);   // shall we check (data & 7) < 6 (# of banks)?
189189}
190190
191191static READ8_HANDLER( saiyugoub1_mcu_command_r )
r14976r14977
224224   ddragon_state *state = device->machine().driver_data<ddragon_state>();
225225
226226   /* i8748 Port 2 write */
227   UINT8 *saiyugoub1_adpcm_rom = device->machine().region("adpcm")->base();
227   UINT8 *saiyugoub1_adpcm_rom = state->memregion("adpcm")->base();
228228
229229   if (data & 0x80)   /* Reset m5205 and disable ADPCM ROM outputs */
230230   {
r14976r14977
531531   state->m_snd_cpu = machine.device("audiocpu");
532532
533533   /* configure banks */
534   memory_configure_bank(machine, "bank1", 0, 8, machine.region("maincpu")->base() + 0x10000, 0x4000);
534   state->membank("bank1")->configure_entries(0, 8, state->memregion("maincpu")->base() + 0x10000, 0x4000);
535535
536536   /* register for save states */
537537   state->save_item(NAME(state->m_scrollx_hi));
r14976r14977
912912static DRIVER_INIT( chinagat )
913913{
914914   ddragon_state *state = machine.driver_data<ddragon_state>();
915   UINT8 *MAIN = machine.region("maincpu")->base();
916   UINT8 *SUB = machine.region("sub")->base();
915   UINT8 *MAIN = machine.root_device().memregion("maincpu")->base();
916   UINT8 *SUB = state->memregion("sub")->base();
917917
918918   state->m_technos_video_hw = 1;
919919   state->m_sprite_irq = M6809_IRQ_LINE;
920920   state->m_sound_irq = INPUT_LINE_NMI;
921921
922   memory_configure_bank(machine, "bank1", 0, 6, &MAIN[0x10000], 0x4000);
923   memory_configure_bank(machine, "bank4", 0, 6, &SUB[0x10000], 0x4000);
922   state->membank("bank1")->configure_entries(0, 6, &MAIN[0x10000], 0x4000);
923   state->membank("bank4")->configure_entries(0, 6, &SUB[0x10000], 0x4000);
924924}
925925
926926
src/mame/drivers/kaneko16.c
r14976r14977
807807static void kaneko16_common_oki_bank_w( running_machine& machine, const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize )
808808{
809809   UINT32 bankaddr;
810   UINT8* samples = machine.region(tag)->base();
811   size_t length = machine.region(tag)->bytes();
810   UINT8* samples = machine.root_device().memregion(tag)->base();
811   size_t length = machine.root_device().memregion(tag)->bytes();
812812
813813   bankaddr = fixedsize + (bankedsize * bank);
814814
815815   if (bankaddr <= (length-bankedsize))
816816   {
817      memory_set_bankptr(machine, bankname, samples + bankaddr);
817      machine.root_device().membank(bankname)->set_base(samples + bankaddr);
818818   }
819819}
820820
r14976r14977
22352235*/
22362236static void kaneko16_unscramble_tiles(running_machine &machine, const char *region)
22372237{
2238   UINT8 *RAM   =   machine.region(region)->base();
2239   int size         =   machine.region(region)->bytes();
2238   UINT8 *RAM   =   machine.root_device().memregion(region)->base();
2239   int size         =   machine.root_device().memregion(region)->bytes();
22402240   int i;
22412241
22422242   if (RAM == NULL)   return;
r14976r14977
22612261   int bank;
22622262   UINT8 *src0;
22632263
2264   if (machine.region(region)->bytes() < 0x40000 * 16)
2264   if (machine.root_device().memregion(region)->bytes() < 0x40000 * 16)
22652265      fatalerror("gtmr SOUND1 region too small");
22662266
22672267   /* bank 0 maps to itself, so we just leave it alone */
2268   src0 = machine.region(region)->base();
2268   src0 = machine.root_device().memregion(region)->base();
22692269   for (bank = 15; bank > 0; bank--)
22702270   {
22712271      UINT8 *srcn = src0 + 0x10000 * (bank < 3 ? 3 : bank);
src/mame/drivers/cybertnk.c
r14976r14977
294294   /* non-tile based spriteram (BARE-BONES, looks pretty complex) */
295295   if(1)
296296   {
297      const UINT8 *blit_ram = screen.machine().region("spr_gfx")->base();
297      const UINT8 *blit_ram = screen.machine().root_device().memregion("spr_gfx")->base();
298298      int offs,x,y,z,xsize,ysize,yi,xi,col_bank,fx,zoom;
299299      UINT32 spr_offs,spr_offs_helper;
300300      int xf,yf,xz,yz;
r14976r14977
426426      if(0) //sprite gfx debug viewer
427427      {
428428         int x,y,count;
429         const UINT8 *blit_ram = screen.machine().region("spr_gfx")->base();
429         const UINT8 *blit_ram = screen.machine().root_device().memregion("spr_gfx")->base();
430430
431431         if(screen.machine().input().code_pressed(KEYCODE_Z))
432432         state->m_test_x++;
r14976r14977
10141014    UINT8* road_data;
10151015    int i;
10161016
1017    road_data = machine.region("road_data")->base();
1017    road_data = machine.root_device().memregion("road_data")->base();
10181018    for (i=0;i < 0x40000;i++)
10191019    {
10201020        road_data[i] = BITSWAP8(road_data[i],3,2,1,0,7,6,5,4);
src/mame/drivers/namcos10.c
r14976r14977
339339
340340READ32_MEMBER(namcos10_state::range_r)
341341{
342   UINT32 data32 = ((const UINT32 *)(machine().region("user1")->base()))[offset+bank_base];
342   UINT32 data32 = ((const UINT32 *)(machine().root_device().memregion("user1")->base()))[offset+bank_base];
343343
344344   UINT16 d16;
345345   if(ACCESSING_BITS_16_31)
r14976r14977
491491static void memn_driver_init( running_machine &machine )
492492{
493493   namcos10_state *state = machine.driver_data<namcos10_state>();
494   UINT8 *BIOS = (UINT8 *)machine.region( "user1" )->base();
495   state->nand_base = (UINT8 *)machine.region( "user2" )->base();
494   UINT8 *BIOS = (UINT8 *)machine.root_device().memregion( "user1" )->base();
495   state->nand_base = (UINT8 *)state->memregion( "user2" )->base();
496496
497497   state->nand_copy( (UINT32 *)( BIOS + 0x0000000 ), 0x08000, 0x001c000 );
498498   state->nand_copy( (UINT32 *)( BIOS + 0x0020000 ), 0x24000, 0x03e0000 );
r14976r14977
503503static void decrypt_bios( running_machine &machine, const char *regionName, int start, int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8,
504504   int b7, int b6, int b5, int b4, int b3, int b2, int b1, int b0 )
505505{
506   const memory_region *region = machine.region( regionName );
506   memory_region *region = machine.root_device().memregion( regionName );
507507   UINT16 *BIOS = (UINT16 *)( region->base() + start );
508508   int len = (region->bytes()-start)/2;
509509
src/mame/drivers/wc90.c
r14976r14977
8383WRITE8_MEMBER(wc90_state::wc90_bankswitch_w)
8484{
8585   int bankaddress;
86   UINT8 *RAM = machine().region("maincpu")->base();
86   UINT8 *RAM = memregion("maincpu")->base();
8787
8888
8989   bankaddress = 0x10000 + ( ( data & 0xf8 ) << 8 );
90   memory_set_bankptr(machine(), "bank1", &RAM[bankaddress] );
90   membank("bank1")->set_base(&RAM[bankaddress] );
9191}
9292
9393WRITE8_MEMBER(wc90_state::wc90_bankswitch1_w)
9494{
9595   int bankaddress;
96   UINT8 *RAM = machine().region("sub")->base();
96   UINT8 *RAM = memregion("sub")->base();
9797
9898
9999   bankaddress = 0x10000 + ( ( data & 0xf8 ) << 8 );
100   memory_set_bankptr(machine(), "bank2", &RAM[bankaddress] );
100   membank("bank2")->set_base(&RAM[bankaddress] );
101101}
102102
103103WRITE8_MEMBER(wc90_state::wc90_sound_command_w)
src/mame/drivers/gauntlet.c
r14976r14977
16211621static void gauntlet_common_init(running_machine &machine, int slapstic, int vindctr2)
16221622{
16231623   gauntlet_state *state = machine.driver_data<gauntlet_state>();
1624   UINT8 *rom = machine.region("maincpu")->base();
1624   UINT8 *rom = state->memregion("maincpu")->base();
16251625   state->m_eeprom_default = NULL;
16261626   atarigen_slapstic_init(machine.device("maincpu"), 0x038000, 0, slapstic);
16271627
r14976r14977
16571657
16581658static DRIVER_INIT( vindctr2 )
16591659{
1660   UINT8 *gfx2_base = machine.region("gfx2")->base();
1660   UINT8 *gfx2_base = machine.root_device().memregion("gfx2")->base();
16611661   UINT8 *data = auto_alloc_array(machine, UINT8, 0x8000);
16621662   int i;
16631663
src/mame/drivers/ms32.c
r14976r14977
13521352
13531353WRITE8_MEMBER(ms32_state::ms32_snd_bank_w)
13541354{
1355   memory_set_bank(machine(), "bank4", (data >> 0) & 0x0F);
1356   memory_set_bank(machine(), "bank5", (data >> 4) & 0x0F);
1355   membank("bank4")->set_entry((data >> 0) & 0x0F);
1356   membank("bank5")->set_entry((data >> 4) & 0x0F);
13571357}
13581358
13591359WRITE8_MEMBER(ms32_state::to_main_w)
r14976r14977
13811381
13821382static MACHINE_RESET( ms32 )
13831383{
1384   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base());
1385   memory_set_bank(machine, "bank4", 0);
1386   memory_set_bank(machine, "bank5", 1);
1384   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());
1385   machine.root_device().membank("bank4")->set_entry(0);
1386   machine.root_device().membank("bank5")->set_entry(1);
13871387   irq_init(machine);
13881388}
13891389
r14976r14977
22022202{
22032203   ms32_state *state = machine.driver_data<ms32_state>();
22042204   state_save_register_global(machine, state->m_to_main);
2205   memory_configure_bank(machine, "bank4", 0, 16, machine.region("audiocpu")->base() + 0x14000, 0x4000);
2206   memory_configure_bank(machine, "bank5", 0, 16, machine.region("audiocpu")->base() + 0x14000, 0x4000);
2205   state->membank("bank4")->configure_entries(0, 16, machine.root_device().memregion("audiocpu")->base() + 0x14000, 0x4000);
2206   state->membank("bank5")->configure_entries(0, 16, state->memregion("audiocpu")->base() + 0x14000, 0x4000);
22072207}
22082208
22092209static DRIVER_INIT( ms32_common )
r14976r14977
22622262static DRIVER_INIT (f1superb)
22632263{
22642264#if 0 // we shouldn't need this hack, something else is wrong, and the x offsets are never copied either, v70 problems??
2265   UINT32 *pROM = (UINT32 *)machine.region("maincpu")->base();
2265   UINT32 *pROM = (UINT32 *)machine.root_device().memregion("maincpu")->base();
22662266   pROM[0x19d04/4]=0x167a021a; // bne->br  : sprite Y offset table is always copied to RAM
22672267#endif
22682268   DRIVER_INIT_CALL(ss92046_01);
src/mame/drivers/mpu4.c
r14976r14977
464464
465465   /* init rom bank, some games don't set this, and will assume bank 0,set 0 */
466466   {
467      UINT8 *rom = machine.region("maincpu")->base();
467      UINT8 *rom = state->memregion("maincpu")->base();
468468
469      memory_configure_bank(machine, "bank1", 0, 8, &rom[0x01000], 0x10000);
469      state->membank("bank1")->configure_entries(0, 8, &rom[0x01000], 0x10000);
470470
471      memory_set_bank(machine, "bank1", 0);
471      state->membank("bank1")->set_entry(0);
472472      machine.device("maincpu")->reset();
473473   }
474474}
r14976r14977
522522//  printf("bank %02x\n", data);
523523
524524   m_pageval = (data & 0x03);
525   memory_set_bank(machine(), "bank1", (m_pageval + (m_pageset ? 4 : 0)) & 0x07);
525   membank("bank1")->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
526526}
527527
528528
529529READ8_MEMBER(mpu4_state::bankswitch_r)
530530{
531   return machine().memory().bank("bank1")->entry();
531   return membank("bank1")->entry();
532532}
533533
534534
535535WRITE8_MEMBER(mpu4_state::bankset_w)
536536{
537537   m_pageval = (data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design?
538   memory_set_bank(machine(), "bank1", (m_pageval + (m_pageset ? 4 : 0)) & 0x07);
538   membank("bank1")->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
539539}
540540
541541
r14976r14977
15601560   if (mstate->m_bwb_bank)
15611561   {
15621562      mstate->m_pageval = state;
1563      memory_set_bank(device->machine(), "bank1", (mstate->m_pageval + (mstate->m_pageset ? 4 : 0)) & 0x07);
1563      mstate->membank("bank1")->set_entry((mstate->m_pageval + (mstate->m_pageset ? 4 : 0)) & 0x07);
15641564   }
15651565}
15661566
r14976r14977
1523315233DRIVER_INIT( crystal )
1523415234{
1523515235   DRIVER_INIT_CALL(m_frkstn);
15236   descramble_crystal(machine.region( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
15236   descramble_crystal(machine.root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
1523715237}
1523815238
1523915239DRIVER_INIT( crystali )
1524015240{
1524115241   DRIVER_INIT_CALL(m_frkstn);
15242   descramble_crystal(machine.region( "maincpu" )->base(), 0x0000, 0x10000, 0xff); // invert after decrypt?!
15242   descramble_crystal(machine.root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0xff); // invert after decrypt?!
1524315243}
1524415244
1524515245
src/mame/drivers/darkseal.c
r14976r14977
471471
472472static DRIVER_INIT( darkseal )
473473{
474   UINT8 *RAM = machine.region("maincpu")->base();
474   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
475475   int i;
476476
477477   for (i=0x00000; i<0x80000; i++)
src/mame/drivers/mcr3.c
r14976r14977
13881388
13891389   ROM_REGION( 0x01000, "gfx3", 0 )
13901390   ROM_LOAD( "cpu_alph.10g", 0x00000, 0x1000, CRC(936dc87f) SHA1(cdf73bea82481fbc300ec5a1fbbe8d662007c56b) )
1391
1392   ROM_REGION( 0x0020, "proms", 0 )
1393   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
13941391ROM_END
13951392
13961393
r14976r14977
14311428
14321429   ROM_REGION( 0x01000, "gfx3", 0 )
14331430   ROM_LOAD( "sh_mb_1.bin",  0x00000, 0x0800, CRC(5c74c9f0) SHA1(e42789d14e5510d1dcf4a30f6bd40a40ab46f7f3) )
1434
1435   ROM_REGION( 0x0020, "proms", 0 )
1436   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
14371431ROM_END
14381432
14391433
r14976r14977
14691463
14701464   ROM_REGION( 0x01000, "gfx3", 0 )
14711465   ROM_LOAD( "crcpu.10g",    0x00000, 0x1000, CRC(6fe53c8d) SHA1(ceb04916af42d58f3173e5986756a0db8be11999) )
1472
1473   ROM_REGION( 0x0020, "proms", 0 )
1474   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
14751466ROM_END
14761467
14771468
r14976r14977
15111502
15121503   ROM_REGION( 0x01000, "gfx3", 0 )
15131504   ROM_LOAD( "ttan.bin",     0x00000, 0x1000, CRC(aa0b1471) SHA1(e3dd69f1a14926c6b709d6b19d9e90a1f0867465) )
1514
1515   ROM_REGION( 0x0020, "proms", 0 )
1516   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
15171505ROM_END
15181506
15191507
src/mame/drivers/pipeline.c
r14976r14977
367367static PALETTE_INIT(pipeline)
368368{
369369   int r,g,b,i,c;
370   UINT8 *prom1 = &machine.region("proms")->base()[0x000];
371   UINT8 *prom2 = &machine.region("proms")->base()[0x100];
370   UINT8 *prom1 = &machine.root_device().memregion("proms")->base()[0x000];
371   UINT8 *prom2 = &machine.root_device().memregion("proms")->base()[0x100];
372372
373373   for(i=0;i<0x100;i++)
374374   {
src/mame/drivers/taito_b.c
r14976r14977
193193
194194WRITE8_MEMBER(taitob_state::bankswitch_w)
195195{
196   memory_set_bank(machine(), "bank1", (data - 1) & 3);
196   membank("bank1")->set_entry((data - 1) & 3);
197197}
198198
199199static TIMER_CALLBACK( rsaga2_interrupt2 )
r14976r14977
27942794#if 0
27952795static void ryujin_patch(void)
27962796{
2797   UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
2797   UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
27982798   rom[ 0x62/2 ] = 1;
27992799   //0 (already in rom) - Taito Corporation 1993
28002800   //1 - Taito America corp with blue FBI logo
r14976r14977
28492849#if 0
28502850static void sbm_patch(void)
28512851{
2852   UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
2852   UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
28532853   rom[ 0x7ffff/2 ] = 2; //US version
28542854}
28552855#endif
r14976r14977
37073707
37083708static DRIVER_INIT( taito_b )
37093709{
3710   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000, 0x4000);
3710   machine.root_device().membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
37113711}
37123712
37133713GAME( 1989, masterw,  0,       masterw,  masterw,  taito_b, ROT270, "Taito Corporation Japan", "Master of Weapon (World)", GAME_SUPPORTS_SAVE )
src/mame/drivers/kungfur.c
r14976r14977
191191static void kfr_adpcm1_int(device_t *device)
192192{
193193   kungfur_state *state = device->machine().driver_data<kungfur_state>();
194   UINT8 *ROM = device->machine().region("adpcm1")->base();
194   UINT8 *ROM = state->memregion("adpcm1")->base();
195195   UINT8 data = ROM[state->m_adpcm_pos[0] & 0x1ffff];
196196
197197   msm5205_data_w(device, state->m_adpcm_sel[0] ? data & 0xf : data >> 4 & 0xf);
r14976r14977
202202static void kfr_adpcm2_int(device_t *device)
203203{
204204   kungfur_state *state = device->machine().driver_data<kungfur_state>();
205   UINT8 *ROM = device->machine().region("adpcm2")->base();
205   UINT8 *ROM = state->memregion("adpcm2")->base();
206206   UINT8 data = ROM[state->m_adpcm_pos[1] & 0x3ffff];
207207
208208   msm5205_data_w(device, state->m_adpcm_sel[1] ? data & 0xf : data >> 4 & 0xf);
src/mame/drivers/viper.c
r14976r14977
19291929   /* configure fast RAM regions for DRC */
19301930   ppcdrc_add_fastram(machine.device("maincpu"), 0x00000000, 0x00ffffff, FALSE, workram);
19311931
1932   ds2430_rom = (UINT8*)machine.region("ds2430")->base();
1932   ds2430_rom = (UINT8*)machine.root_device().memregion("ds2430")->base();
19331933}
19341934
19351935static MACHINE_RESET(viper)
src/mame/drivers/jackal.c
r14976r14977
114114
115115WRITE8_MEMBER(jackal_state::jackal_rambank_w)
116116{
117   UINT8 *rgn = machine().region("master")->base();
117   UINT8 *rgn = memregion("master")->base();
118118
119119   if (data & 0x04)
120120      popmessage("jackal_rambank_w %02x", data);
r14976r14977
124124
125125   m_spritebank = &rgn[((data & 0x08) << 13)];
126126   m_rambank = &rgn[((data & 0x10) << 12)];
127   memory_set_bank(machine(), "bank1", (data & 0x20) ? 1 : 0);
127   membank("bank1")->set_entry((data & 0x20) ? 1 : 0);
128128}
129129
130130
r14976r14977
328328static MACHINE_START( jackal )
329329{
330330   jackal_state *state = machine.driver_data<jackal_state>();
331   UINT8 *ROM = machine.region("master")->base();
331   UINT8 *ROM = state->memregion("master")->base();
332332
333   memory_configure_bank(machine, "bank1", 0, 1, &ROM[0x04000], 0x8000);
334   memory_configure_bank(machine, "bank1", 1, 1, &ROM[0x14000], 0x8000);
335   memory_set_bank(machine, "bank1", 0);
333   state->membank("bank1")->configure_entry(0, &ROM[0x04000]);
334   state->membank("bank1")->configure_entry(1, &ROM[0x14000]);
335   state->membank("bank1")->set_entry(0);
336336
337337   state->m_mastercpu = machine.device("master");
338338   state->m_slavecpu = machine.device("slave");
r14976r14977
343343static MACHINE_RESET( jackal )
344344{
345345   jackal_state *state = machine.driver_data<jackal_state>();
346   UINT8 *rgn = machine.region("master")->base();
346   UINT8 *rgn = state->memregion("master")->base();
347347
348348   // HACK: running at the nominal clock rate, music stops working
349349   // at the beginning of the game. This fixes it.
src/mame/drivers/vaportra.c
r14976r14977
855855
856856static DRIVER_INIT( vaportra )
857857{
858   UINT8 *RAM = machine.region("maincpu")->base();
858   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
859859   int i;
860860
861861   for (i = 0x00000; i < 0x80000; i++)
src/mame/drivers/namcos86.c
r14976r14977
184184
185185WRITE8_MEMBER(namcos86_state::bankswitch1_w)
186186{
187   UINT8 *base = machine().region("cpu1")->base() + 0x10000;
187   UINT8 *base = memregion("cpu1")->base() + 0x10000;
188188
189189   /* if the ROM expansion module is available, don't do anything. This avoids conflict */
190190   /* with bankswitch1_ext_w() in wndrmomo */
191   if (machine().region("user1")->base()) return;
191   if (machine().root_device().memregion("user1")->base()) return;
192192
193   memory_set_bankptr(machine(), "bank1",base + ((data & 0x03) * 0x2000));
193   membank("bank1")->set_base(base + ((data & 0x03) * 0x2000));
194194}
195195
196196WRITE8_MEMBER(namcos86_state::bankswitch1_ext_w)
197197{
198   UINT8 *base = machine().region("user1")->base();
198   UINT8 *base = memregion("user1")->base();
199199
200200   if (base == 0) return;
201201
202   memory_set_bankptr(machine(), "bank1",base + ((data & 0x1f) * 0x2000));
202   membank("bank1")->set_base(base + ((data & 0x1f) * 0x2000));
203203}
204204
205205WRITE8_MEMBER(namcos86_state::bankswitch2_w)
206206{
207   UINT8 *base = machine().region("cpu2")->base() + 0x10000;
207   UINT8 *base = memregion("cpu2")->base() + 0x10000;
208208
209   memory_set_bankptr(machine(), "bank2",base + ((data & 0x03) * 0x2000));
209   membank("bank2")->set_base(base + ((data & 0x03) * 0x2000));
210210}
211211
212212/* Stubs to pass the correct Dip Switch setup to the MCU */
r14976r14977
294294WRITE8_MEMBER(namcos86_state::cus115_w)
295295{
296296   /* make sure the expansion board is present */
297   if (!machine().region("user1")->base())
297   if (!machine().root_device().memregion("user1")->base())
298298   {
299299      popmessage("expansion board not present");
300300      return;
r14976r14977
324324
325325static MACHINE_RESET( namco86 )
326326{
327   UINT8 *base = machine.region("cpu1")->base() + 0x10000;
327   UINT8 *base = machine.root_device().memregion("cpu1")->base() + 0x10000;
328328
329   memory_set_bankptr(machine, "bank1",base);
329   machine.root_device().membank("bank1")->set_base(base);
330330}
331331
332332
r14976r14977
14711471   UINT8 *buffer;
14721472
14731473   /* shuffle tile ROMs so regular gfx unpack routines can be used */
1474   gfx = machine.region("gfx1")->base();
1475   size = machine.region("gfx1")->bytes() * 2 / 3;
1474   gfx = machine.root_device().memregion("gfx1")->base();
1475   size = machine.root_device().memregion("gfx1")->bytes() * 2 / 3;
14761476   buffer = auto_alloc_array(machine, UINT8,  size );
14771477
14781478   {
r14976r14977
14961496      auto_free( machine, buffer );
14971497   }
14981498
1499   gfx = machine.region("gfx2")->base();
1500   size = machine.region("gfx2")->bytes() * 2 / 3;
1499   gfx = machine.root_device().memregion("gfx2")->base();
1500   size = machine.root_device().memregion("gfx2")->bytes() * 2 / 3;
15011501   buffer = auto_alloc_array(machine, UINT8,  size );
15021502
15031503   {
src/mame/drivers/suna8.c
r14976r14977
6060
6161static DRIVER_INIT( hardhead )
6262{
63   UINT8 *rom = machine.region("maincpu")->base();
63   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
6464   int i;
6565
6666   for (i = 0; i < 0x8000; i++)
r14976r14977
7575         rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0) ^ 0x58;
7676   }
7777
78   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
78   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
7979}
8080
8181/* Non encrypted bootleg */
8282static DRIVER_INIT( hardhedb )
8383{
8484   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
85   space->set_decrypted_region(0x0000, 0x7fff, machine.region("maincpu")->base() + 0x48000);
86   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
85   space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x48000);
86   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
8787}
8888
8989/***************************************************************************
r14976r14977
9595static UINT8 *brickzn_decrypt(running_machine &machine)
9696{
9797   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
98   UINT8   *RAM   =   machine.region("maincpu")->base();
99   size_t   size   =   machine.region("maincpu")->bytes();
98   UINT8   *RAM   =   machine.root_device().memregion("maincpu")->base();
99   size_t   size   =   machine.root_device().memregion("maincpu")->bytes();
100100   UINT8   *decrypt = auto_alloc_array(machine, UINT8, size);
101101   int i;
102102
r14976r14977
137137
138138static DRIVER_INIT( brickzn )
139139{
140   UINT8   *RAM   =   machine.region("maincpu")->base();
140   UINT8   *RAM   =   machine.root_device().memregion("maincpu")->base();
141141   UINT8   *decrypt = brickzn_decrypt(machine);
142142   int i;
143143
r14976r14977
162162   decrypt[0x24b5] = 0x00;   // HALT -> NOP
163163   decrypt[0x2583] = 0x00;   // HALT -> NOP
164164
165   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
166   memory_configure_bank_decrypted(machine, "bank1", 0, 16, decrypt + 0x10000, 0x4000);
165   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
166   machine.root_device().membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x10000, 0x4000);
167167}
168168
169169static DRIVER_INIT( brickzn3 )
170170{
171   UINT8   *RAM   =   machine.region("maincpu")->base();
171   UINT8   *RAM   =   machine.root_device().memregion("maincpu")->base();
172172   UINT8   *decrypt = brickzn_decrypt(machine);
173173   int i;
174174
r14976r14977
193193   decrypt[0x2487] = 0x00;   // HALT -> NOP
194194   decrypt[0x256c] = 0x00;   // HALT -> NOP
195195
196   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
197   memory_configure_bank_decrypted(machine, "bank1", 0, 16, decrypt + 0x10000, 0x4000);
196   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
197   machine.root_device().membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x10000, 0x4000);
198198}
199199
200200
r14976r14977
205205static DRIVER_INIT( hardhea2 )
206206{
207207   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
208   UINT8   *RAM   =   machine.region("maincpu")->base();
209   size_t   size   =   machine.region("maincpu")->bytes();
208   UINT8   *RAM   =   machine.root_device().memregion("maincpu")->base();
209   size_t   size   =   machine.root_device().memregion("maincpu")->bytes();
210210   UINT8   *decrypt =   auto_alloc_array(machine, UINT8, size);
211211   UINT8 x;
212212   int i;
r14976r14977
280280         RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41;
281281   }
282282
283   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
284   memory_configure_bank(machine, "bank2", 0, 2, auto_alloc_array(machine, UINT8, 0x2000 * 2), 0x2000);
283   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
284   machine.root_device().membank("bank2")->configure_entries(0, 2, auto_alloc_array(machine, UINT8, 0x2000 * 2), 0x2000);
285285}
286286
287287
r14976r14977
292292static DRIVER_INIT( starfigh )
293293{
294294   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
295   UINT8   *RAM   =   machine.region("maincpu")->base();
296   size_t   size   =   machine.region("maincpu")->bytes();
295   UINT8   *RAM   =   machine.root_device().memregion("maincpu")->base();
296   size_t   size   =   machine.root_device().memregion("maincpu")->bytes();
297297   UINT8   *decrypt =   auto_alloc_array(machine, UINT8, size);
298298   UINT8 x;
299299   int i;
r14976r14977
349349         RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x45;
350350   }
351351
352   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
352   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
353353}
354354
355355
r14976r14977
360360static DRIVER_INIT( sparkman )
361361{
362362   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
363   UINT8   *RAM   =   machine.region("maincpu")->base();
364   size_t   size   =   machine.region("maincpu")->bytes();
363   UINT8   *RAM   =   machine.root_device().memregion("maincpu")->base();
364   size_t   size   =   machine.root_device().memregion("maincpu")->bytes();
365365   UINT8   *decrypt =   auto_alloc_array(machine, UINT8, size);
366366   UINT8 x;
367367   int i;
r14976r14977
417417         RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x44;
418418   }
419419
420   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
420   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
421421}
422422
423423/***************************************************************************
r14976r14977
490490   int bank = data & 0x0f;
491491
492492   if (data & ~0xef)   logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",cpu_get_pc(&space.device()),data);
493   memory_set_bank(machine(), "bank1", bank);
493   membank("bank1")->set_entry(bank);
494494}
495495
496496
r14976r14977
547547
548548   if (data & ~0xf7)   logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",cpu_get_pc(&space.device()),data);
549549
550   memory_set_bank(machine(), "bank1", bank);
550   membank("bank1")->set_entry(bank);
551551
552552   flip_screen_set(data & 0x20);
553553   coin_lockout_w ( machine(), 0,   data & 0x40);
r14976r14977
651651
652652   if (data & ~0x0f)   logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data);
653653
654   memory_set_bank(machine(), "bank1", bank);
654   membank("bank1")->set_entry(bank);
655655   m_rombank = data;
656656}
657657
r14976r14977
727727
728728   if (data & ~0x0f)   logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data);
729729
730   memory_set_bank(machine(), "bank1", bank);
730   membank("bank1")->set_entry(bank);
731731
732732   m_rombank = data;
733733}
r14976r14977
745745
746746WRITE8_MEMBER(suna8_state::hardhea2_rambank_0_w)
747747{
748   memory_set_bank(machine(), "bank2", 0);
748   membank("bank2")->set_entry(0);
749749}
750750
751751WRITE8_MEMBER(suna8_state::hardhea2_rambank_1_w)
752752{
753   memory_set_bank(machine(), "bank2", 1);
753   membank("bank2")->set_entry(1);
754754}
755755
756756
r14976r14977
925925
926926   //if (data & ~0x0f)     logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data);
927927
928   memory_set_bank(machine(), "bank1", bank);
928   membank("bank1")->set_entry(bank);
929929   m_rombank = data;
930930}
931931
r14976r14977
23552355
23562356static DRIVER_INIT( suna8 )
23572357{
2358   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
2358   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
23592359}
23602360
23612361/* Working Games */
src/mame/drivers/chanbara.c
r14976r14977
8888
8989static PALETTE_INIT( chanbara )
9090{
91   const UINT8 *color_prom = machine.region("proms")->base();
91   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9292   int i, red, green, blue;
9393
9494   for (i = 0; i < machine.total_colors(); i++)
r14976r14977
357357
358358   state->flip_screen_set(data & 0x02);
359359
360   memory_set_bank(device->machine(), "bank1", (data & 0x04) >> 2);
360   state->membank("bank1")->set_entry((data & 0x04) >> 2);
361361
362362   //if (data & 0xf8)    printf("chanbara_ay_out_1_w unused bits set %02x\n", data & 0xf8);
363363}
r14976r14977
471471
472472static DRIVER_INIT(chanbara )
473473{
474   UINT8   *src = machine.region("gfx4")->base();
475   UINT8   *dst = machine.region("gfx3")->base() + 0x4000;
476   UINT8   *bg = machine.region("user1")->base();
474   UINT8   *src = machine.root_device().memregion("gfx4")->base();
475   UINT8   *dst = machine.root_device().memregion("gfx3")->base() + 0x4000;
476   UINT8   *bg = machine.root_device().memregion("user1")->base();
477477
478478   int i;
479479   for (i = 0; i < 0x1000; i++)
r14976r14977
484484      dst[i + 0x2000] = (src[i + 0x1000] & 0x0f) << 4;
485485   }
486486
487   memory_configure_bank(machine, "bank1", 0, 2, &bg[0x0000], 0x4000);
487   machine.root_device().membank("bank1")->configure_entries(0, 2, &bg[0x0000], 0x4000);
488488}
489489
490490GAME( 1985, chanbara, 0,  chanbara, chanbara, chanbara, ROT270, "Data East", "Chanbara", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
src/mame/drivers/btime.c
r14976r14977
223223   /* however if the previous instruction was JSR (which caused a write to */
224224   /* the stack), fetch the address of the next instruction. */
225225   addr1 = cpu_get_previouspc(&space->device());
226   src1 = (addr1 < 0x9000) ? state->m_rambase : space->machine().region("maincpu")->base();
226   src1 = (addr1 < 0x9000) ? state->m_rambase : space->machine().root_device().memregion("maincpu")->base();
227227   if (decrypted[addr1] == 0x20)   /* JSR $xxxx */
228228      addr = src1[addr1 + 1] + 256 * src1[addr1 + 2];
229229
230230   /* If the address of the next instruction is xxxx xxx1 xxxx x1xx, decode it. */
231   src = (addr < 0x9000) ? state->m_rambase : space->machine().region("maincpu")->base();
231   src = (addr < 0x9000) ? state->m_rambase : state->memregion("maincpu")->base();
232232   if ((addr & 0x0104) == 0x0104)
233233   {
234234      /* 76543210 -> 65342710 bit rotation */
r14976r14977
20602060{
20612061   address_space *space = machine.device(cputag)->memory().space(AS_PROGRAM);
20622062   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
2063   UINT8 *rom = machine.region(cputag)->base();
2063   UINT8 *rom = machine.root_device().memregion(cputag)->base();
20642064   offs_t addr;
20652065
20662066   space->set_decrypted_region(0x0000, 0xffff, decrypt);
r14976r14977
20752075
20762076READ8_MEMBER(btime_state::wtennis_reset_hack_r)
20772077{
2078   UINT8 *RAM = machine().region("maincpu")->base();
2078   UINT8 *RAM = memregion("maincpu")->base();
20792079
20802080   /* Otherwise the game goes into test mode and there is no way out that I
20812081       can see.  I'm not sure how it can work, it probably somehow has to do
r14976r14977
20892089static void init_rom1(running_machine &machine)
20902090{
20912091   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
2092   UINT8 *rom = machine.region("maincpu")->base();
2092   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
20932093
20942094   decrypted = auto_alloc_array(machine, UINT8, 0x10000);
20952095   space->set_decrypted_region(0x0000, 0xffff, decrypted);
r14976r14977
21102110static DRIVER_INIT( zoar )
21112111{
21122112   btime_state *state = machine.driver_data<btime_state>();
2113   UINT8 *rom = machine.region("maincpu")->base();
2113   UINT8 *rom = state->memregion("maincpu")->base();
21142114
21152115   /* At location 0xD50A is what looks like an undocumented opcode. I tried
21162116       implementing it given what opcode 0x23 should do, but it still didn't
r14976r14977
21252125static DRIVER_INIT( tisland )
21262126{
21272127   btime_state *state = machine.driver_data<btime_state>();
2128   UINT8 *rom = machine.region("maincpu")->base();
2128   UINT8 *rom = state->memregion("maincpu")->base();
21292129
21302130   /* At location 0xa2b6 there's a strange RLA followed by a BPL that reads from an
21312131    unmapped area that causes the game to fail in several circumstances.On the Cassette
r14976r14977
21642164   decrypt_C10707_cpu(machine, "maincpu");
21652165
21662166   machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0200, 0x0fff, "bank10");
2167   memory_set_bankptr(machine, "bank10", machine.region("audiocpu")->base() + 0xe200);
2167   state->membank("bank10")->set_base(state->memregion("audiocpu")->base() + 0xe200);
21682168   state->m_audio_nmi_enable_type = AUDIO_ENABLE_DIRECT;
21692169}
21702170
r14976r14977
21832183   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc15f, 0xc15f, read8_delegate(FUNC(btime_state::wtennis_reset_hack_r),state));
21842184
21852185   machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0200, 0x0fff, "bank10");
2186   memory_set_bankptr(machine, "bank10", machine.region("audiocpu")->base() + 0xe200);
2186   state->membank("bank10")->set_base(state->memregion("audiocpu")->base() + 0xe200);
21872187   state->m_audio_nmi_enable_type = AUDIO_ENABLE_AY8910;
21882188}
21892189
src/mame/drivers/nova2001.c
r14976r14977
980980
981981static void lineswap_gfx_roms(running_machine &machine, const char *region, const int bit)
982982{
983   const int length = machine.region(region)->bytes();
983   const int length = machine.root_device().memregion(region)->bytes();
984984
985   UINT8* const src = machine.region(region)->base();
985   UINT8* const src = machine.root_device().memregion(region)->base();
986986
987987   UINT8* const temp = auto_alloc_array(machine, UINT8, length);
988988
src/mame/drivers/jantotsu.c
r14976r14977
200200
201201static PALETTE_INIT( jantotsu )
202202{
203   const UINT8 *color_prom = machine.region("proms")->base();
203   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
204204   int   bit0, bit1, bit2, r, g, b;
205205   int   i;
206206
r14976r14977
300300   }
301301   else
302302   {
303      UINT8 *ROM = device->machine().region("adpcm")->base();
303      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base();
304304
305305      state->m_adpcm_data = ((state->m_adpcm_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0) >> 4));
306306      msm5205_data_w(device, state->m_adpcm_data & 0xf);
src/mame/drivers/chsuper.c
r14976r14977
267267{
268268   chsuper_state *state = machine.driver_data<chsuper_state>();
269269   UINT8 *buffer;
270   UINT8 *rom = machine.region("gfx1")->base();
270   UINT8 *rom = state->memregion("gfx1")->base();
271271   int i;
272272
273273   state->m_tilexor = 0x7f00;
r14976r14977
290290{
291291   chsuper_state *state = machine.driver_data<chsuper_state>();
292292   UINT8 *buffer;
293   UINT8 *rom = machine.region("gfx1")->base();
293   UINT8 *rom = state->memregion("gfx1")->base();
294294   int i;
295295
296296   state->m_tilexor = 0x0e00;
r14976r14977
313313{
314314   chsuper_state *state = machine.driver_data<chsuper_state>();
315315   UINT8 *buffer;
316   UINT8 *rom = machine.region("gfx1")->base();
316   UINT8 *rom = state->memregion("gfx1")->base();
317317   int i;
318318
319319   state->m_tilexor = 0x1800;
src/mame/drivers/mermaid.c
r14976r14977
419419   }
420420   else
421421   {
422      UINT8 *ROM = device->machine().region("adpcm")->base();
422      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base();
423423
424424      state->m_adpcm_data = ((state->m_adpcm_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0) >> 4));
425425      msm5205_data_w(device, state->m_adpcm_data & 0xf);
src/mame/drivers/gaelco3d.c
r14976r14977
206206   state->m_framenum = 0;
207207
208208   /* boot the ADSP chip */
209   src = (UINT16 *)machine.region("user1")->base();
209   src = (UINT16 *)state->memregion("user1")->base();
210210   for (i = 0; i < (src[3] & 0xff) * 8; i++)
211211   {
212212      UINT32 opcode = ((src[i*4+0] & 0xff) << 16) | ((src[i*4+1] & 0xff) << 8) | (src[i*4+2] & 0xff);
r14976r14977
216216   /* allocate a timer for feeding the autobuffer */
217217   state->m_adsp_autobuffer_timer = machine.device<timer_device>("adsp_timer");
218218
219   memory_configure_bank(machine, "bank1", 0, 256, machine.region("user1")->base(), 0x4000);
220   memory_set_bank(machine, "bank1", 0);
219   state->membank("bank1")->configure_entries(0, 256, machine.root_device().memregion("user1")->base(), 0x4000);
220   state->membank("bank1")->set_entry(0);
221221
222222   /* keep the TMS32031 halted until the code is ready to go */
223223   cputag_set_input_line(machine, "tms", INPUT_LINE_RESET, ASSERT_LINE);
r14976r14977
613613{
614614   if (LOG)
615615      logerror("adsp_rombank_w(%d) = %04X\n", offset, data);
616   memory_set_bank(machine(), "bank1", (offset & 1) * 0x80 + (data & 0x7f));
616   membank("bank1")->set_entry((offset & 1) * 0x80 + (data & 0x7f));
617617}
618618
619619
src/mame/drivers/dcon.c
r14976r14977
375375/***************************************************************************/
376376static DRIVER_INIT( sdgndmps )
377377{
378   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
378   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
379379   RAM[0x1356/2] = 0x4e71; /* beq -> nop */
380380   RAM[0x1358/2] = 0x4e71;
381381
src/mame/drivers/photon2.c
r14976r14977
198198      logerror( "Unknown banking write: %02X\n", data);
199199   }
200200
201   memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x4000*bank );
201   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000*bank );
202202}
203203
204204READ8_MEMBER(photon2_state::photon2_fe_r)
r14976r14977
312312
313313static MACHINE_RESET( photon2 )
314314{
315   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base());
315   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());
316316}
317317
318318static MACHINE_CONFIG_START( photon2, photon2_state )
src/mame/drivers/gstriker.c
r14976r14977
213213
214214WRITE8_MEMBER(gstriker_state::gs_sh_bankswitch_w)
215215{
216   UINT8 *RAM = machine().region("audiocpu")->base();
216   UINT8 *RAM = memregion("audiocpu")->base();
217217   int bankaddress;
218218
219219   bankaddress = 0x10000 + (data & 0x03) * 0x8000;
220   memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
220   membank("bank1")->set_base(&RAM[bankaddress]);
221221}
222222
223223/*** GFX DECODE **************************************************************/
src/mame/drivers/snk.c
r14976r14977
8989  a bug. The service mode functionality is very limited anyway. To get past the
9090  failed ROM test and see the service mode, use this ROM patch:
9191
92    UINT8 *mem = machine.region("maincpu")->base();
92    UINT8 *mem = machine.root_device().memregion("maincpu")->base();
9393    mem[0x3a5d] = mem[0x3a5e] = mem[0x3a5f] = 0;
9494
9595- The "SNK Wave" custom sound circuitry is only actually used by marvins and
src/mame/drivers/highvdeo.c
r14976r14977
243243WRITE16_MEMBER(highvdeo_state::tv_vcf_bankselect_w)
244244{
245245   UINT32 bankaddress;
246   UINT8 *ROM = machine().region("user1")->base();
246   UINT8 *ROM = memregion("user1")->base();
247247
248248   /* bits 0, 1 select the ROM bank */
249249   bankaddress = (data & 0x03) * 0x40000;
250250
251   memory_set_bankptr(machine(), "bank1", &ROM[bankaddress]);
251   membank("bank1")->set_base(&ROM[bankaddress]);
252252}
253253
254254
r14976r14977
378378WRITE16_MEMBER(highvdeo_state::tv_tcf_bankselect_w)
379379{
380380   UINT32 bankaddress;
381   UINT8 *ROM = machine().region("user1")->base();
381   UINT8 *ROM = memregion("user1")->base();
382382
383383   /* bits 0, 1, 2 select the ROM bank */
384384   bankaddress = (data & 0x07) * 0x40000;
385385
386   memory_set_bankptr(machine(), "bank1", &ROM[bankaddress]);
386   membank("bank1")->set_base(&ROM[bankaddress]);
387387}
388388
389389static ADDRESS_MAP_START( tv_tcf_map, AS_PROGRAM, 16, highvdeo_state )
r14976r14977
494494WRITE16_MEMBER(highvdeo_state::brasil_status_w)
495495{
496496   UINT32 bankaddress;
497   UINT8 *ROM = machine().region("user1")->base();
497   UINT8 *ROM = memregion("user1")->base();
498498
499499   switch(data & 3) //data & 7?
500500   {
r14976r14977
505505
506506   bankaddress = (data & 0x07) * 0x40000;
507507
508   memory_set_bankptr(machine(), "bank1", &ROM[bankaddress]);
508   membank("bank1")->set_base(&ROM[bankaddress]);
509509
510510//  popmessage("%04x",data);
511511}
src/mame/drivers/namconb1.c
r14976r14977
608608
609609static DRIVER_INIT( nebulray )
610610{
611   UINT8 *pMem = (UINT8 *)machine.region(NAMCONB1_TILEMASKREGION)->base();
611   UINT8 *pMem = (UINT8 *)machine.root_device().memregion(NAMCONB1_TILEMASKREGION)->base();
612612   size_t numBytes = (0xfe7-0xe6f)*8;
613613   memset( &pMem[0xe6f*8], 0, numBytes );
614614
src/mame/drivers/fcrash.c
r14976r14977
5858   state->m_msm_1->set_output_gain(0, (data & 0x08) ? 0.0 : 1.0);
5959   state->m_msm_2->set_output_gain(0, (data & 0x10) ? 0.0 : 1.0);
6060
61   memory_set_bank(space->machine(), "bank1", data & 0x07);
61   state->membank("bank1")->set_entry(data & 0x07);
6262}
6363
6464static void m5205_int1( device_t *device )
r14976r14977
693693static MACHINE_START( fcrash )
694694{
695695   cps_state *state = machine.driver_data<cps_state>();
696   UINT8 *ROM = machine.region("soundcpu")->base();
696   UINT8 *ROM = state->memregion("soundcpu")->base();
697697
698   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
698   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
699699
700700   state->m_maincpu = machine.device("maincpu");
701701   state->m_audiocpu = machine.device("soundcpu");
src/mame/drivers/othello.c
r14976r14977
100100   UINT32 data_address;
101101   UINT32 tmp;
102102
103   const UINT8 *gfx = device->machine().region("gfx")->base();
103   const UINT8 *gfx = state->memregion("gfx")->base();
104104
105105   for(cx = 0; cx < x_count; ++cx)
106106   {
r14976r14977
283283
284284READ8_MEMBER(othello_state::n7751_rom_r)
285285{
286   return machine().region("n7751data")->base()[m_sound_addr];
286   return memregion("n7751data")->base()[m_sound_addr];
287287}
288288
289289READ8_MEMBER(othello_state::n7751_command_r)
src/mame/drivers/cosmic.c
r14976r14977
15121512   cosmic_state *state = machine.driver_data<cosmic_state>();
15131513   offs_t offs, len;
15141514   UINT8 *rom;
1515   len = machine.region("maincpu")->bytes();
1516   rom = machine.region("maincpu")->base();
1515   len = machine.root_device().memregion("maincpu")->bytes();
1516   rom = state->memregion("maincpu")->base();
15171517   for (offs = 0; offs < len; offs++)
15181518   {
15191519      UINT8 scrambled = rom[offs];
src/mame/drivers/bfm_sc5.c
r14976r14977
1179111791DRIVER_INIT( sc5 )
1179211792{
1179311793   // sc5 roms always start with SC5
11794   UINT8 *src = machine.region( "maincpu" )->base();
11794   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
1179511795//  printf("%02x %02x %02x %02x\n", src[0], src[1], src[2], src[3]);
1179611796   if (((src[0] == 0x20) && (src[2] == 0x43)) || ((src[1] == 0x35) && (src[3] == 0x53)))
1179711797   {
src/mame/drivers/model2.c
r14976r14977
356356static MACHINE_RESET(model2_scsp)
357357{
358358   model2_state *state = machine.driver_data<model2_state>();
359   memory_set_bankptr(machine, "bank4", machine.region("scsp")->base() + 0x200000);
360   memory_set_bankptr(machine, "bank5", machine.region("scsp")->base() + 0x600000);
359   state->membank("bank4")->set_base(machine.root_device().memregion("scsp")->base() + 0x200000);
360   state->membank("bank5")->set_base(machine.root_device().memregion("scsp")->base() + 0x600000);
361361
362362   // copy the 68k vector table into RAM
363   memcpy(state->m_soundram, machine.region("audiocpu")->base() + 0x80000, 16);
363   memcpy(state->m_soundram, state->memregion("audiocpu")->base() + 0x80000, 16);
364364   machine.device("audiocpu")->reset();
365365   scsp_set_ram_base(machine.device("scsp"), state->m_soundram);
366366}
r14976r14977
11531153
11541154READ32_MEMBER(model2_state::maxx_r)
11551155{
1156   UINT32 *ROM = (UINT32 *)machine().region("maincpu")->base();
1156   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("maincpu")->base();
11571157
11581158   if (offset <= 0x1f/4)
11591159   {
r14976r14977
18441844WRITE16_MEMBER(model2_state::model2snd_ctrl)
18451845{
18461846   // handle sample banking
1847   if (machine().region("scsp")->bytes() > 0x800000)
1847   if (machine().root_device().memregion("scsp")->bytes() > 0x800000)
18481848   {
1849      UINT8 *snd = machine().region("scsp")->base();
1849      UINT8 *snd = memregion("scsp")->base();
18501850      if (data & 0x20)
18511851      {
1852         memory_set_bankptr(machine(), "bank4", snd + 0x200000);
1853         memory_set_bankptr(machine(), "bank5", snd + 0x600000);
1852         membank("bank4")->set_base(snd + 0x200000);
1853         membank("bank5")->set_base(snd + 0x600000);
18541854      }
18551855      else
18561856      {
1857         memory_set_bankptr(machine(), "bank4", snd + 0x800000);
1858         memory_set_bankptr(machine(), "bank5", snd + 0xa00000);
1857         membank("bank4")->set_base(snd + 0x800000);
1858         membank("bank5")->set_base(snd + 0xa00000);
18591859      }
18601860   }
18611861}
r14976r14977
51175117static DRIVER_INIT( pltkids )
51185118{
51195119   model2_state *state = machine.driver_data<model2_state>();
5120   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
5120   UINT32 *ROM = (UINT32 *)state->memregion("maincpu")->base();
51215121
51225122   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
51235123   state->m_protstate = state->m_protpos = 0;
r14976r14977
51295129static DRIVER_INIT( zerogun )
51305130{
51315131   model2_state *state = machine.driver_data<model2_state>();
5132   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
5132   UINT32 *ROM = (UINT32 *)state->memregion("maincpu")->base();
51335133
51345134   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
51355135   state->m_protstate = state->m_protpos = 0;
r14976r14977
51735173static DRIVER_INIT( sgt24h )
51745174{
51755175   model2_state *state = machine.driver_data<model2_state>();
5176   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
5176   UINT32 *ROM = (UINT32 *)state->memregion("maincpu")->base();
51775177
51785178   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
51795179   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),state), write32_delegate(FUNC(model2_state::jaleco_network_w),state));
r14976r14977
51965196static DRIVER_INIT( doa )
51975197{
51985198   model2_state *state = machine.driver_data<model2_state>();
5199   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
5199   UINT32 *ROM = (UINT32 *)state->memregion("maincpu")->base();
52005200
52015201   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),state), write32_delegate(FUNC(model2_state::model2_prot_w),state));
52025202   state->m_protstate = state->m_protpos = 0;
src/mame/drivers/majorpkr.c
r14976r14977
566566
567567WRITE8_MEMBER(majorpkr_state::rom_bank_w)
568568{
569   memory_set_bank(machine(), "rom_bank", data & 0x3);
569   membank("rom_bank")->set_entry(data & 0x3);
570570}
571571
572572
r14976r14977
10831083
10841084static DRIVER_INIT( majorpkr )
10851085{
1086   UINT8 * ROM = (UINT8 *)machine.region("maincpu")->base();
1087   memory_configure_bank(machine, "rom_bank", 0, 4, &ROM[0x10000], 0x800);
1086   UINT8 * ROM = (UINT8 *)machine.root_device().memregion("maincpu")->base();
1087   machine.root_device().membank("rom_bank")->configure_entries(0, 4, &ROM[0x10000], 0x800);
10881088}
10891089
10901090
src/mame/drivers/sshangha.c
r14976r14977
492492#if SSHANGHA_HACK
493493   /* This is a hack to allow you to use the extra features
494494         of the first "Unused" Dip Switch (see notes above). */
495   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
495   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
496496   RAM[0x000384/2] = 0x4e71;
497497   RAM[0x000386/2] = 0x4e71;
498498   RAM[0x000388/2] = 0x4e71;
src/mame/drivers/ichiban.c
r14976r14977
104104
105105void ichibanjyan_state::machine_start()
106106{
107   UINT8 *ROM = machine().region("code")->base();
107   UINT8 *ROM = memregion("code")->base();
108108
109   memory_configure_bank(machine(), "bank1", 0, 4, ROM, 0x8000);
109   membank("bank1")->configure_entries(0, 4, ROM, 0x8000);
110110}
111111
112112void ichibanjyan_state::machine_reset()
src/mame/drivers/popeye.c
r14976r14977
620620{
621621   popeye_state *state = machine.driver_data<popeye_state>();
622622   UINT8 *buffer;
623   UINT8 *rom = machine.region("maincpu")->base();
623   UINT8 *rom = state->memregion("maincpu")->base();
624624   int len = 0x10000;
625625
626626   /* decrypt the program ROMs */
r14976r14977
642642{
643643   popeye_state *state = machine.driver_data<popeye_state>();
644644   UINT8 *buffer;
645   UINT8 *rom = machine.region("maincpu")->base();
645   UINT8 *rom = state->memregion("maincpu")->base();
646646   int len = 0x10000;
647647
648648   /* decrypt the program ROMs */
src/mame/drivers/4enraya.c
r14976r14977
7979
8080READ8_MEMBER(_4enraya_state::fenraya_custom_map_r)
8181{
82   UINT8 *prom = machine().region("pal_prom")->base();
82   UINT8 *prom = memregion("pal_prom")->base();
8383   UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf;
8484   UINT8 res;
8585
r14976r14977
8787
8888   if(prom_routing & 1) //ROM5
8989   {
90      UINT8 *rom = machine().region("maincpu")->base();
90      UINT8 *rom = memregion("maincpu")->base();
9191      res |= rom[offset & 0x7fff];
9292   }
9393
9494   if(prom_routing & 2) //ROM4
9595   {
96      UINT8 *rom = machine().region("maincpu")->base();
96      UINT8 *rom = memregion("maincpu")->base();
9797      res |= rom[(offset & 0x7fff) | 0x8000];
9898   }
9999
r14976r14977
112112
113113WRITE8_MEMBER(_4enraya_state::fenraya_custom_map_w)
114114{
115   UINT8 *prom = machine().region("pal_prom")->base();
115   UINT8 *prom = memregion("pal_prom")->base();
116116   UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf;
117117
118118   if(prom_routing & 1) //ROM5
r14976r14977
392392static DRIVER_INIT( unkpacg )
393393{
394394   _4enraya_state *state = machine.driver_data<_4enraya_state>();
395   UINT8 *rom = machine.region("maincpu")->base();
395   UINT8 *rom = state->memregion("maincpu")->base();
396396
397397   state->m_snd_latch_bit = 2;
398398
src/mame/drivers/compgolf.c
r14976r14977
4444   if (m_bank != new_bank)
4545   {
4646      m_bank = new_bank;
47      memory_set_bank(machine(), "bank1", m_bank);
47      membank("bank1")->set_entry(m_bank);
4848   }
4949
5050   m_scrollx_hi = (data & 1) << 8;
r14976r14977
346346
347347static void compgolf_expand_bg(running_machine &machine)
348348{
349   UINT8 *GFXDST = machine.region("gfx2")->base();
350   UINT8 *GFXSRC = machine.region("gfx4")->base();
349   UINT8 *GFXDST = machine.root_device().memregion("gfx2")->base();
350   UINT8 *GFXSRC = machine.root_device().memregion("gfx4")->base();
351351
352352   int x;
353353
r14976r14977
360360
361361static DRIVER_INIT( compgolf )
362362{
363   memory_configure_bank(machine, "bank1", 0, 2, machine.region("user1")->base(), 0x4000);
363   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("user1")->base(), 0x4000);
364364   compgolf_expand_bg(machine);
365365}
366366
src/mame/drivers/cps2.c
r14976r14977
12171217   state->m_audiocpu = machine.device("audiocpu");
12181218
12191219   if (state->m_audiocpu != NULL)   // gigaman2 has no audiocpu
1220      memory_configure_bank(machine, "bank1", 0, (QSOUND_SIZE - 0x10000) / 0x4000, machine.region("audiocpu")->base() + 0x10000, 0x4000);
1220      state->membank("bank1")->configure_entries(0, (QSOUND_SIZE - 0x10000) / 0x4000, state->memregion("audiocpu")->base() + 0x10000, 0x4000);
12211221}
12221222
12231223
r14976r14977
81648164static void gigaman2_gfx_reorder(running_machine &machine)
81658165{
81668166   int i;
8167   int length = machine.region( "gfx" )->bytes();
8168   UINT16 *rom = (UINT16 *)machine.region("gfx")->base();
8167   int length = machine.root_device().memregion( "gfx" )->bytes();
8168   UINT16 *rom = (UINT16 *)machine.root_device().memregion("gfx")->base();
81698169   UINT16 *buf = auto_alloc_array(machine, UINT16, length );
81708170
81718171   memcpy (buf, rom, length);
r14976r14977
81818181{
81828182   cps_state *state = machine.driver_data<cps_state>();
81838183   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
8184   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
8185   int length = machine.region("maincpu")->bytes();
8184   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
8185   int length = state->memregion("maincpu")->bytes();
81868186
81878187   gigaman2_gfx_reorder(machine);
81888188
src/mame/drivers/igs017.c
r14976r14977
219219static void expand_sprites(running_machine &machine)
220220{
221221   igs017_state *state = machine.driver_data<igs017_state>();
222   UINT8 *rom   =   machine.region("sprites")->base();
223   int size   =   machine.region("sprites")->bytes();
222   UINT8 *rom   =   machine.root_device().memregion("sprites")->base();
223   int size   =   state->memregion("sprites")->bytes();
224224   int i;
225225
226226   state->m_sprites_gfx_size   =   size / 2 * 3;
r14976r14977
421421
422422static void decrypt_program_rom(running_machine &machine, int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0)
423423{
424   int length = machine.region("maincpu")->bytes();
425   UINT8 *rom = machine.region("maincpu")->base();
424   int length = machine.root_device().memregion("maincpu")->bytes();
425   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
426426   UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
427427   int i;
428428
r14976r14977
474474
475475static void iqblocka_patch_rom(running_machine &machine)
476476{
477   UINT8 *rom = machine.region("maincpu")->base();
477   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
478478
479479//  rom[0x7b64] = 0xc9;
480480
r14976r14977
515515
516516static void tjsb_decrypt_sprites(running_machine &machine)
517517{
518   int length = machine.region("sprites")->bytes();
519   UINT8 *rom = machine.region("sprites")->base();
518   int length = machine.root_device().memregion("sprites")->bytes();
519   UINT8 *rom = machine.root_device().memregion("sprites")->base();
520520   UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
521521   int i, addr;
522522
r14976r14977
551551static void mgcs_decrypt_program_rom(running_machine &machine)
552552{
553553   int i;
554   UINT16 *src = (UINT16 *)machine.region("maincpu")->base();
554   UINT16 *src = (UINT16 *)machine.root_device().memregion("maincpu")->base();
555555
556556   int rom_size = 0x80000;
557557
r14976r14977
600600
601601static void mgcs_decrypt_tiles(running_machine &machine)
602602{
603   int length = machine.region("tilemaps")->bytes();
604   UINT8 *rom = machine.region("tilemaps")->base();
603   int length = machine.root_device().memregion("tilemaps")->bytes();
604   UINT8 *rom = machine.root_device().memregion("tilemaps")->base();
605605   UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
606606   int i;
607607
r14976r14977
617617
618618static void mgcs_flip_sprites(running_machine &machine)
619619{
620   int length = machine.region("sprites")->bytes();
621   UINT8 *rom = machine.region("sprites")->base();
620   int length = machine.root_device().memregion("sprites")->bytes();
621   UINT8 *rom = machine.root_device().memregion("sprites")->base();
622622   int i;
623623
624624   for (i = 0;i < length;i+=2)
r14976r14977
638638
639639static void mgcs_patch_rom(running_machine &machine)
640640{
641   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
641   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
642642
643643   rom[0x4e036/2] = 0x6006;
644644
r14976r14977
664664// decryption is incomplete, the first part of code doesn't seem right.
665665static DRIVER_INIT( tarzan )
666666{
667   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
667   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
668668   int i;
669669   int size = 0x40000;
670670
r14976r14977
690690// by iq_132
691691static DRIVER_INIT( tarzana )
692692{
693   UINT8 *ROM = machine.region("maincpu")->base();
693   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
694694   int i;
695695   int size = 0x80000;
696696
r14976r14977
763763{
764764   int size = 0x040000;
765765
766   UINT8 *data = machine.region("maincpu")->base();
766   UINT8 *data = machine.root_device().memregion("maincpu")->base();
767767   UINT8 *code = auto_alloc_array(machine, UINT8, size);
768768   memcpy(code, data, size);
769769
r14976r14977
781781static DRIVER_INIT( sdmg2 )
782782{
783783   int i;
784   UINT16 *src = (UINT16 *)machine.region("maincpu")->base();
784   UINT16 *src = (UINT16 *)machine.root_device().memregion("maincpu")->base();
785785
786786   int rom_size = 0x80000;
787787
r14976r14977
838838static DRIVER_INIT( mgdha )
839839{
840840   int i;
841   UINT16 *src = (UINT16 *)machine.region("maincpu")->base();
841   UINT16 *src = (UINT16 *)machine.root_device().memregion("maincpu")->base();
842842
843843   int rom_size = 0x80000;
844844
r14976r14977
873873{
874874   DRIVER_INIT_CALL( mgdha );
875875
876   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
876   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
877877
878878   // additional protection
879879   rom[0x4ad50/2] = 0x4e71;
r14976r14977
885885
886886static void lhzb2_patch_rom(running_machine &machine)
887887{
888   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
888   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
889889
890890   // Prot. checks:
891891   rom[0x14786/2] = 0x6044;   // 014786: 6744    beq $147cc
r14976r14977
896896
897897static void lhzb2_decrypt_tiles(running_machine &machine)
898898{
899   int length = machine.region("tilemaps")->bytes();
900   UINT8 *rom = machine.region("tilemaps")->base();
899   int length = machine.root_device().memregion("tilemaps")->bytes();
900   UINT8 *rom = machine.root_device().memregion("tilemaps")->base();
901901   UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
902902   int i;
903903
r14976r14977
914914
915915static void lhzb2_decrypt_sprites(running_machine &machine)
916916{
917   int length = machine.region("sprites")->bytes();
918   UINT8 *rom = machine.region("sprites")->base();
917   int length = machine.root_device().memregion("sprites")->bytes();
918   UINT8 *rom = machine.root_device().memregion("sprites")->base();
919919   UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
920920   int i, addr;
921921
r14976r14977
940940static DRIVER_INIT( lhzb2 )
941941{
942942   int i;
943   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
943   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
944944
945945   int rom_size = 0x80000;
946946
r14976r14977
10331033
10341034static void lhzb2a_patch_rom(running_machine &machine)
10351035{
1036   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1036   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
10371037
10381038   // Prot. checks:
10391039   rom[0x09c52/2] = 0x6026;   // 009C52: 6726    beq $9c7a
r14976r14977
10491049static DRIVER_INIT( lhzb2a )
10501050{
10511051   int i;
1052   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
1052   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
10531053
10541054   int rom_size = 0x80000;
10551055
r14976r14977
11141114
11151115static void slqz2_patch_rom(running_machine &machine)
11161116{
1117   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1117   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
11181118
11191119   // Prot. checks:
11201120   rom[0x1489c/2] = 0x6044;   // 01489C: 6744    beq $148e2
r14976r14977
11251125
11261126static void slqz2_decrypt_tiles(running_machine &machine)
11271127{
1128   int length = machine.region("tilemaps")->bytes();
1129   UINT8 *rom = machine.region("tilemaps")->base();
1128   int length = machine.root_device().memregion("tilemaps")->bytes();
1129   UINT8 *rom = machine.root_device().memregion("tilemaps")->base();
11301130   UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
11311131   int i;
11321132
r14976r14977
11431143static DRIVER_INIT( slqz2 )
11441144{
11451145   int i;
1146   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
1146   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
11471147
11481148   int rom_size = 0x80000;
11491149
src/mame/drivers/hnayayoi.c
r14976r14977
674674
675675static DRIVER_INIT( hnfubuki )
676676{
677   UINT8 *rom = machine.region("gfx1")->base();
678   int len = machine.region("gfx1")->bytes();
677   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
678   int len = machine.root_device().memregion("gfx1")->bytes();
679679   int i, j;
680680
681681   /* interestingly, the blitter data has a slight encryption */
src/mame/drivers/amaticmg.c
r14976r14977
413413
414414static PALETTE_INIT( amaticmg )
415415{
416   const UINT8 *color_prom = machine.region("proms")->base();
416   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
417417   int   bit0, bit1, bit2 , r, g, b;
418418   int   i;
419419
r14976r14977
440440
441441static PALETTE_INIT( amaticmg3 )
442442{
443   const UINT8 *color_prom = machine.region("proms")->base();
443   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
444444   int   r, g, b;
445445   int   i;
446446
src/mame/drivers/jpmimpct.c
r14976r14977
54495449
54505450   int i;
54515451
5452   UINT8 *src1 = machine.region( "maincpu" )->base();
5453   UINT8 *src2 = machine.region( "encrypted" )->base();
5452   UINT8 *src1 = machine.root_device().memregion( "maincpu" )->base();
5453   UINT8 *src2 = machine.root_device().memregion( "encrypted" )->base();
54545454
54555455   for (i=0;i<0x040000;i++)
54565456   {
src/mame/drivers/namcos12.c
r14976r14977
11591159      m_n_bankoffset = data;
11601160   }
11611161
1162   memory_set_bank( machine(), "bank1", m_n_bankoffset );
1162   membank( "bank1" )->set_entry( m_n_bankoffset );
11631163
11641164   verboselog( machine(), 1, "bankoffset_w( %08x, %08x, %08x ) %08x\n", offset, data, mem_mask, m_n_bankoffset );
11651165}
r14976r14977
12081208      verboselog( state->machine(), 1, "namcos12_rom_read( %08x, %08x ) game %08x\n", n_address, n_size, n_offset );
12091209   }
12101210
1211   source = (UINT16 *) state->machine().region( n_region )->base();
1212   n_romleft = ( state->machine().region( n_region )->bytes() - n_offset ) / 4;
1211   source = (UINT16 *) state->machine().root_device().memregion( n_region )->base();
1212   n_romleft = ( state->machine().root_device().memregion( n_region )->bytes() - n_offset ) / 4;
12131213   if( n_size > n_romleft )
12141214   {
12151215      verboselog( state->machine(), 1, "namcos12_rom_read dma truncated %d to %d passed end of rom\n", n_size, n_romleft );
r14976r14977
13211321
13221322WRITE32_MEMBER(namcos12_state::kcoff_w)
13231323{
1324   memory_set_bankptr( machine(), "bank2", machine().region( "user1" )->base() + 0x20280 );
1324   membank( "bank2" )->set_base( memregion( "user1" )->base() + 0x20280 );
13251325}
13261326
13271327WRITE32_MEMBER(namcos12_state::kcon_w)
13281328{
13291329
1330   memory_set_bankptr( machine(), "bank2", m_kcram );
1330   membank( "bank2" )->set_base( m_kcram );
13311331}
13321332
13331333WRITE32_MEMBER(namcos12_state::tektagt_protection_1_w)
r14976r14977
14291429      space->install_write_handler(0x1f018000, 0x1f018003, write32_delegate(FUNC(namcos12_state::kcoff_w),state));
14301430
14311431      memset( state->m_kcram, 0, sizeof( state->m_kcram ) );
1432      memory_set_bankptr( space->machine(), "bank2", state->m_kcram );
1432      state->membank( "bank2" )->set_base( state->m_kcram );
14331433   }
14341434}
14351435
r14976r14977
16271627
16281628   psx_driver_init(machine);
16291629
1630   memory_configure_bank(machine, "bank1", 0, machine.region( "user2" )->bytes() / 0x200000, machine.region( "user2" )->base(), 0x200000 );
1630   state->membank("bank1")->configure_entries(0, machine.root_device().memregion( "user2" )->bytes() / 0x200000, state->memregion( "user2" )->base(), 0x200000 );
16311631
16321632   state->m_s12_porta = 0;
16331633   state->m_s12_rtcstate = 0;
r14976r14977
16401640   state->m_n_dmaoffset = 0;
16411641   state->m_n_dmabias = 0;
16421642   state->m_n_bankoffset = 0;
1643   memory_set_bank( machine, "bank1", 0 );
1643   state->membank( "bank1" )->set_entry( 0 );
16441644
16451645   state->save_item( NAME(state->m_n_dmaoffset) );
16461646   state->save_item( NAME(state->m_n_dmabias) );
r14976r14977
16521652   DRIVER_INIT_CALL(namcos12);
16531653
16541654   /* patch out wait for dma 5 to complete */
1655   *( (UINT32 *)( machine.region( "user1" )->base() + 0x331c4 ) ) = 0;
1655   *( (UINT32 *)( machine.root_device().memregion( "user1" )->base() + 0x331c4 ) ) = 0;
16561656
16571657   system11gun_install(machine);
16581658}
src/mame/drivers/avt.c
r14976r14977
531531
532532static PALETTE_INIT( avt )
533533{
534   const UINT8 *color_prom = machine.region("proms")->base();
534   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
535535/*  prom bits
536536    7654 3210
537537    ---- ---x   Intensity?.
src/mame/drivers/missb2.c
r14976r14977
7272
7373   sx = 0;
7474
75   prom = screen.machine().region("proms")->base();
75   prom = screen.machine().root_device().memregion("proms")->base();
7676   for (offs = 0; offs < state->m_objectram.bytes(); offs += 4)
7777   {
7878      /* skip empty sprites */
r14976r14977
154154   // I don't know how this is really connected, bit 1 is always high afaik...
155155   bank = ((data & 2) ? 1 : 0) | ((data & 1) ? 4 : 0);
156156
157   memory_set_bank(machine(), "bank2", bank);
158   memory_set_bank(machine(), "bank3", bank);
157   membank("bank2")->set_entry(bank);
158   membank("bank3")->set_entry(bank);
159159}
160160
161161/* Memory Maps */
r14976r14977
573573
574574static void configure_banks( running_machine& machine )
575575{
576   UINT8 *ROM = machine.region("maincpu")->base();
577   UINT8 *SLAVE = machine.region("slave")->base();
576   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
577   UINT8 *SLAVE = machine.root_device().memregion("slave")->base();
578578
579   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
579   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
580580
581581   /* 2009-11 FP: isn't there a way to configure both at once? */
582   memory_configure_bank(machine, "bank2", 0, 7, &SLAVE[0x8000], 0x1000);
583   memory_configure_bank(machine, "bank3", 0, 7, &SLAVE[0x9000], 0x1000);
582   machine.root_device().membank("bank2")->configure_entries(0, 7, &SLAVE[0x8000], 0x1000);
583   machine.root_device().membank("bank3")->configure_entries(0, 7, &SLAVE[0x9000], 0x1000);
584584}
585585
586586static DRIVER_INIT( missb2 )
src/mame/drivers/tehkanwc.c
r14976r14977
195195{
196196   tehkanwc_state *state = device->machine().driver_data<tehkanwc_state>();
197197
198   UINT8 *SAMPLES = device->machine().region("adpcm")->base();
198   UINT8 *SAMPLES = state->memregion("adpcm")->base();
199199   int msm_data = SAMPLES[state->m_msm_data_offs & 0x7fff];
200200
201201   if (state->m_toggle == 0)
r14976r14977
707707        023A: 00          nop
708708    */
709709
710   UINT8 *ROM = machine.region("maincpu")->base();
710   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
711711
712712   ROM[0x0238] = 0x00;
713713   ROM[0x0239] = 0x00;
src/mame/drivers/photon.c
r14976r14977
3333
3434static void pk8000_set_bank(running_machine &machine,UINT8 data)
3535{
36   UINT8 *rom = machine.region("maincpu")->base();
37   UINT8 *ram = machine.region("maincpu")->base();
36   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
37   UINT8 *ram = machine.root_device().memregion("maincpu")->base();
3838   UINT8 block1 = data & 3;
3939   UINT8 block2 = (data >> 2) & 3;
4040   UINT8 block3 = (data >> 4) & 3;
r14976r14977
4242
4343   switch(block1) {
4444      case 0:
45            memory_set_bankptr(machine, "bank1", rom + 0x10000);
46            memory_set_bankptr(machine, "bank5", ram);
45            machine.root_device().membank("bank1")->set_base(rom + 0x10000);
46            machine.root_device().membank("bank5")->set_base(ram);
4747            break;
4848      case 1: break;
4949      case 2: break;
5050      case 3:
51            memory_set_bankptr(machine, "bank1", ram);
52            memory_set_bankptr(machine, "bank5", ram);
51            machine.root_device().membank("bank1")->set_base(ram);
52            machine.root_device().membank("bank5")->set_base(ram);
5353            break;
5454   }
5555
5656   switch(block2) {
5757      case 0:
58            memory_set_bankptr(machine, "bank2", rom + 0x14000);
59            memory_set_bankptr(machine, "bank6", ram + 0x4000);
58            machine.root_device().membank("bank2")->set_base(rom + 0x14000);
59            machine.root_device().membank("bank6")->set_base(ram + 0x4000);
6060            break;
6161      case 1: break;
6262      case 2: break;
6363      case 3:
64            memory_set_bankptr(machine, "bank2", ram + 0x4000);
65            memory_set_bankptr(machine, "bank6", ram + 0x4000);
64            machine.root_device().membank("bank2")->set_base(ram + 0x4000);
65            machine.root_device().membank("bank6")->set_base(ram + 0x4000);
6666            break;
6767   }
6868   switch(block3) {
6969      case 0:
70            memory_set_bankptr(machine, "bank3", rom + 0x18000);
71            memory_set_bankptr(machine, "bank7", ram + 0x8000);
70            machine.root_device().membank("bank3")->set_base(rom + 0x18000);
71            machine.root_device().membank("bank7")->set_base(ram + 0x8000);
7272            break;
7373      case 1: break;
7474      case 2: break;
7575      case 3:
76            memory_set_bankptr(machine, "bank3", ram + 0x8000);
77            memory_set_bankptr(machine, "bank7", ram + 0x8000);
76            machine.root_device().membank("bank3")->set_base(ram + 0x8000);
77            machine.root_device().membank("bank7")->set_base(ram + 0x8000);
7878            break;
7979   }
8080   switch(block4) {
8181      case 0:
82            memory_set_bankptr(machine, "bank4", rom + 0x1c000);
83            memory_set_bankptr(machine, "bank8", ram + 0xc000);
82            machine.root_device().membank("bank4")->set_base(rom + 0x1c000);
83            machine.root_device().membank("bank8")->set_base(ram + 0xc000);
8484            break;
8585      case 1: break;
8686      case 2: break;
8787      case 3:
88            memory_set_bankptr(machine, "bank4", ram + 0xc000);
89            memory_set_bankptr(machine, "bank8", ram + 0xc000);
88            machine.root_device().membank("bank4")->set_base(ram + 0xc000);
89            machine.root_device().membank("bank8")->set_base(ram + 0xc000);
9090            break;
9191   }
9292}
r14976r14977
199199
200200static SCREEN_UPDATE_IND16( photon )
201201{
202   return pk8000_video_update(screen, bitmap, cliprect, screen.machine().region("maincpu")->base());
202   return pk8000_video_update(screen, bitmap, cliprect, screen.machine().root_device().memregion("maincpu")->base());
203203}
204204
205205static MACHINE_CONFIG_START( photon, photon_state )
src/mame/drivers/citycon.c
r14976r14977
338338
339339static DRIVER_INIT( citycon )
340340{
341   UINT8 *rom = machine.region("gfx1")->base();
341   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
342342   int i;
343343
344344   /*
src/mame/drivers/sigmab52.c
r14976r14977
294294
295295WRITE8_MEMBER(sigmab52_state::unk_f710_w)
296296{
297   memory_set_bankptr(machine(), "bank1" ,&machine().region("maincpu")->base()[0x10000 + ((data&0x80)?0x4000:0x0000)]);
297   membank("bank1" )->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + ((data&0x80)?0x4000:0x0000)]);
298298}
299299
300300READ8_MEMBER(sigmab52_state::unk_f721_r)
r14976r14977
542542
543543static MACHINE_START(jwildb52)
544544{
545   memory_set_bankptr(machine, "bank1", &machine.region("maincpu")->base()[0x10000 + 0x0000]);
545   machine.root_device().membank("bank1")->set_base(&machine.root_device().memregion("maincpu")->base()[0x10000 + 0x0000]);
546546
547   memory_set_bankptr(machine, "bank2", &machine.region("maincpu")->base()[0x10000 + 0xf800]);
547   machine.root_device().membank("bank2")->set_base(&machine.root_device().memregion("maincpu")->base()[0x10000 + 0xf800]);
548548
549   memory_set_bankptr(machine, "bank3", &machine.region("maincpu")->base()[0x10000 + 0x8000]);
549   machine.root_device().membank("bank3")->set_base(&machine.root_device().memregion("maincpu")->base()[0x10000 + 0x8000]);
550550
551551/*
552552
r14976r14977
560560*/
561561
562562   {
563      UINT16 *rom = (UINT16*)machine.region("gfx1")->base();
563      UINT16 *rom = (UINT16*)machine.root_device().memregion("gfx1")->base();
564564      int i;
565565
566566      device_t *hd63484 = machine.device("hd63484");
src/mame/drivers/dynadice.c
r14976r14977
294294static DRIVER_INIT( dynadice )
295295{
296296   int i, j;
297   UINT8 *usr1 = machine.region("user1")->base();
298   UINT8 *cpu2 = machine.region("audiocpu")->base();
299   UINT8 *gfx1 = machine.region("gfx1")->base();
300   UINT8 *gfx2 = machine.region("gfx2")->base();
297   UINT8 *usr1 = machine.root_device().memregion("user1")->base();
298   UINT8 *cpu2 = machine.root_device().memregion("audiocpu")->base();
299   UINT8 *gfx1 = machine.root_device().memregion("gfx1")->base();
300   UINT8 *gfx2 = machine.root_device().memregion("gfx2")->base();
301301
302302   cpu2[0x0b] = 0x23;   /* bug in game code  Dec HL -> Inc HL*/
303303
src/mame/drivers/ampoker2.c
r14976r14977
14051405static DRIVER_INIT( rabbitpk )
14061406{
14071407
1408   UINT8 *rom = machine.region("maincpu")->base();
1409   int size = machine.region("maincpu")->bytes();
1408   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
1409   int size = machine.root_device().memregion("maincpu")->bytes();
14101410   int start = 0;
14111411   int i;
14121412
r14976r14977
14571457
14581458*/
14591459
1460   UINT8 *rom = machine.region("maincpu")->base();
1460   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
14611461
14621462   /* NOP'ing the mortal jump... */
14631463   rom[0x154b] = 0x00;
src/mame/drivers/playmark.c
r14976r14977
167167   {
168168      state->m_old_oki_bank = data & 7;
169169
170      if (((state->m_old_oki_bank - 1) * 0x40000) < device->machine().region("oki")->bytes())
170      if (((state->m_old_oki_bank - 1) * 0x40000) < state->memregion("oki")->bytes())
171171      {
172172         downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (state->m_old_oki_bank - 1));
173173      }
r14976r14977
16781678static DRIVER_INIT( bigtwin )
16791679{
16801680   playmark_state *state = machine.driver_data<playmark_state>();
1681   UINT8 *playmark_PICROM_HEX = machine.region("user1")->base();
1682   UINT16 *playmark_PICROM = (UINT16 *)machine.region("audiocpu")->base();
1681   UINT8 *playmark_PICROM_HEX = machine.root_device().memregion("user1")->base();
1682   UINT16 *playmark_PICROM = (UINT16 *)state->memregion("audiocpu")->base();
16831683   INT32 offs, data;
16841684   UINT16 src_pos = 0;
16851685   UINT16 dst_pos = 0;
src/mame/drivers/jangou.c
r14976r14977
8989/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
9090static PALETTE_INIT( jangou )
9191{
92   const UINT8 *color_prom = machine.region("proms")->base();
92   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9393   static const int resistances_rg[3] = { 1000, 470, 220 };
9494   static const int resistances_b [2] = { 470, 220 };
9595   double weights_rg[3], weights_b[2];
r14976r14977
168168
169169static UINT8 jangou_gfx_nibble( running_machine &machine, UINT16 niboffset )
170170{
171   const UINT8 *const blit_rom = machine.region("gfx")->base();
171   const UINT8 *const blit_rom = machine.root_device().memregion("gfx")->base();
172172
173173   if (niboffset & 1)
174174      return (blit_rom[(niboffset >> 1) & 0xffff] & 0xf0) >> 4;
r14976r14977
13711371{
13721372   // this is WRONG
13731373   int A;
1374   UINT8 *ROM = machine.region("cpu0")->base();
1374   UINT8 *ROM = machine.root_device().memregion("cpu0")->base();
13751375
13761376   unsigned char patn1[32] = {
13771377      0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0,
src/mame/drivers/namcos21.c
r14976r14977
313313static INT32
314314ReadPointROMData( running_machine &machine, unsigned offset )
315315{
316   const INT32 *pPointData = (INT32 *)machine.region( "user2" )->base();
316   const INT32 *pPointData = (INT32 *)machine.root_device().memregion( "user2" )->base();
317317   INT32 result = pPointData[offset];
318318   return result;
319319}
r14976r14977
590590InitDSP( running_machine &machine )
591591{
592592   namcos21_state *state = machine.driver_data<namcos21_state>();
593   UINT16 *pMem = (UINT16 *)machine.region("dspmaster")->base();
593   UINT16 *pMem = (UINT16 *)state->memregion("dspmaster")->base();
594594   /**
595595     * DSP BIOS tests "CPU ID" on startup
596596     * "JAPAN (C)1990 NAMCO LTD. by H.F "
r14976r14977
12221222
12231223READ16_MEMBER(namcos21_state::winrun_dsp_pointrom_data_r)
12241224{
1225   UINT16 *ptrom = (UINT16 *)machine().region("user2")->base();
1225   UINT16 *ptrom = (UINT16 *)machine().root_device().memregion("user2")->base();
12261226   return ptrom[m_winrun_pointrom_addr++];
12271227} /* winrun_dsp_pointrom_data_r */
12281228
r14976r14977
12641264
12651265READ16_MEMBER(namcos21_state::gpu_data_r)
12661266{
1267   const UINT16 *pSrc = (UINT16 *)machine().region( "user3" )->base();
1267   const UINT16 *pSrc = (UINT16 *)machine().root_device().memregion( "user3" )->base();
12681268   return pSrc[offset];
12691269}
12701270
r14976r14977
12821282   COMBINE_DATA( &m_winrun_dspbios[offset] );
12831283   if( offset==0xfff )
12841284   {
1285      UINT16 *mem = (UINT16 *)machine().region("dsp")->base();
1285      UINT16 *mem = (UINT16 *)machine().root_device().memregion("dsp")->base();
12861286      memcpy( mem, m_winrun_dspbios, 0x2000 );
12871287      m_winrun_dsp_alive = 1;
12881288   }
r14976r14977
22452245   namcos21_state *state = machine.driver_data<namcos21_state>();
22462246   namcos2_gametype = game_type;
22472247   state->m_pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE);
2248   state->m_mpDataROM = (UINT16 *)machine.region( "user1" )->base();
2248   state->m_mpDataROM = (UINT16 *)state->memregion( "user1" )->base();
22492249   InitDSP(machine);
22502250   state->m_mbNeedsKickstart = 20;
22512251   if( game_type==NAMCOS21_CYBERSLED )
r14976r14977
22572257static DRIVER_INIT( winrun )
22582258{
22592259   namcos21_state *state = machine.driver_data<namcos21_state>();
2260   UINT16 *pMem = (UINT16 *)machine.region("dsp")->base();
2260   UINT16 *pMem = (UINT16 *)machine.root_device().memregion("dsp")->base();
22612261   int pc = 0;
22622262   pMem[pc++] = 0xff80; /* b */
22632263   pMem[pc++] = 0;
r14976r14977
22652265   state->m_winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2);
22662266
22672267   namcos2_gametype = NAMCOS21_WINRUN91;
2268   state->m_mpDataROM = (UINT16 *)machine.region( "user1" )->base();
2268   state->m_mpDataROM = (UINT16 *)state->memregion( "user1" )->base();
22692269   state->m_pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE);
22702270   state->m_pointram_idx = 0;
22712271   state->m_mbNeedsKickstart = 0;
r14976r14977
22892289
22902290static DRIVER_INIT( solvalou )
22912291{
2292   UINT16 *mem = (UINT16 *)machine.region("maincpu")->base();
2292   UINT16 *mem = (UINT16 *)machine.root_device().memregion("maincpu")->base();
22932293   mem[0x20ce4/2+1] = 0x0000; // $200128
22942294   mem[0x20cf4/2+0] = 0x4e71; // 2nd ptr_booting
22952295   mem[0x20cf4/2+1] = 0x4e71;
r14976r14977
23012301static DRIVER_INIT( driveyes )
23022302{
23032303   namcos21_state *state = machine.driver_data<namcos21_state>();
2304   UINT16 *pMem = (UINT16 *)machine.region("dsp")->base();
2304   UINT16 *pMem = (UINT16 *)machine.root_device().memregion("dsp")->base();
23052305   int pc = 0;
23062306   pMem[pc++] = 0xff80; /* b */
23072307   pMem[pc++] = 0;
23082308   state->m_winrun_dspcomram = auto_alloc_array(machine, UINT16, 0x1000*2);
23092309   namcos2_gametype = NAMCOS21_DRIVERS_EYES;
2310   state->m_mpDataROM = (UINT16 *)machine.region( "user1" )->base();
2310   state->m_mpDataROM = (UINT16 *)state->memregion( "user1" )->base();
23112311   state->m_pointram = auto_alloc_array(machine, UINT8, PTRAM_SIZE);
23122312   state->m_pointram_idx = 0;
23132313   state->m_mbNeedsKickstart = 0;
src/mame/drivers/pgm.c
r14976r14977
35703570
35713571static void expand_32x32x5bpp(running_machine &machine)
35723572{
3573   UINT8 *src = machine.region( "tiles" )->base();
3573   UINT8 *src = machine.root_device().memregion( "tiles" )->base();
35743574   gfx_layout glcopy;
35753575   glcopy = *(&pgm32_charlayout);
35763576
3577   size_t  srcsize = machine.region( "tiles" )->bytes();
3577   size_t  srcsize = machine.root_device().memregion( "tiles" )->bytes();
35783578   int cnt, pix;
35793579   size_t gfx2_size_needed = ((srcsize/5)*8)+0x1000;
35803580   UINT8 *dst = auto_alloc_array(machine, UINT8, gfx2_size_needed);
r14976r14977
36133613static void expand_colourdata( running_machine &machine )
36143614{
36153615   pgm_state *state = machine.driver_data<pgm_state>();
3616   UINT8 *src = machine.region( "sprcol" )->base();
3617   size_t srcsize = machine.region( "sprcol" )->bytes();
3616   UINT8 *src = machine.root_device().memregion( "sprcol" )->base();
3617   size_t srcsize = state->memregion( "sprcol" )->bytes();
36183618   int cnt;
36193619   size_t needed = srcsize / 2 * 3;
36203620
r14976r14977
36453645{
36463646   pgm_state *state = machine.driver_data<pgm_state>();
36473647
3648   UINT8 *ROM = machine.region("maincpu")->base();
3649   if (set_bank) memory_set_bankptr(machine, "bank1", &ROM[0x100000]);
3648   UINT8 *ROM = state->memregion("maincpu")->base();
3649   if (set_bank) state->membank("bank1")->set_base(&ROM[0x100000]);
36503650
36513651   expand_32x32x5bpp(machine);
36523652   expand_colourdata(machine);
src/mame/drivers/pengadvb.c
r14976r14977
6060      case 0:
6161         // BIOS
6262         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1" );
63         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base());
63         state->membank("bank1")->set_base(state->memregion("maincpu")->base());
6464         break;
6565
6666      default:
r14976r14977
7575         // BIOS
7676         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x5fff, "bank21" );
7777         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x6000, 0x7fff, "bank22" );
78         memory_set_bankptr(machine, "bank21", machine.region("maincpu")->base() + 0x4000);
79         memory_set_bankptr(machine, "bank22", machine.region("maincpu")->base() + 0x4000 + 0x2000);
78         state->membank("bank21")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000);
79         state->membank("bank22")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000 + 0x2000);
8080         break;
8181
8282      case 1:
8383         // game
8484         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x5fff, "bank21" );
8585         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x6000, 0x7fff, "bank22" );
86         memory_set_bankptr(machine, "bank21", machine.region("game")->base() + state->m_mem_banks[0]*0x2000);
87         memory_set_bankptr(machine, "bank22", machine.region("game")->base() + state->m_mem_banks[1]*0x2000);
86         state->membank("bank21")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[0]*0x2000);
87         state->membank("bank22")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[1]*0x2000);
8888         break;
8989
9090      default:
r14976r14977
9999         // game
100100         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x9fff, "bank31" );
101101         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xbfff, "bank32" );
102         memory_set_bankptr(machine, "bank31", machine.region("game")->base() + state->m_mem_banks[2]*0x2000);
103         memory_set_bankptr(machine, "bank32", machine.region("game")->base() + state->m_mem_banks[3]*0x2000);
102         state->membank("bank31")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[2]*0x2000);
103         state->membank("bank32")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[3]*0x2000);
104104         break;
105105
106106      default:
r14976r14977
114114      case 3:
115115         // RAM
116116         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc000, 0xffff, "bank4" );
117         memory_set_bankptr(machine, "bank4", state->m_main_mem);
117         state->membank("bank4")->set_base(state->m_main_mem);
118118         break;
119119
120120      default:
r14976r14977
289289
290290static void pengadvb_decrypt(running_machine &machine, const char* region)
291291{
292   UINT8 *mem = machine.region(region)->base();
293   int memsize = machine.region(region)->bytes();
292   UINT8 *mem = machine.root_device().memregion(region)->base();
293   int memsize = machine.root_device().memregion(region)->bytes();
294294   UINT8 *buf;
295295   int i;
296296
src/mame/drivers/capbowl.c
r14976r14977
139139WRITE8_MEMBER(capbowl_state::capbowl_rom_select_w)
140140{
141141   // 2009-11 FP: shall we add a check to be sure that bank < 6?
142   memory_set_bank(machine(), "bank1", ((data & 0x0c) >> 1) + (data & 0x01));
142   membank("bank1")->set_entry(((data & 0x0c) >> 1) + (data & 0x01));
143143}
144144
145145
r14976r14977
499499
500500static DRIVER_INIT( capbowl )
501501{
502   UINT8 *ROM = machine.region("maincpu")->base();
502   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
503503
504504   /* configure ROM banks in 0x0000-0x3fff */
505   memory_configure_bank(machine, "bank1", 0, 6, &ROM[0x10000], 0x4000);
505   machine.root_device().membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
506506}
507507
508508
src/mame/drivers/darius.c
r14976r14977
274274static void reset_sound_region( running_machine &machine )
275275{
276276   darius_state *state = machine.driver_data<darius_state>();
277   memory_set_bank(machine, "bank1", state->m_banknum);
277   state->membank("bank1")->set_entry(state->m_banknum);
278278}
279279
280280WRITE8_MEMBER(darius_state::sound_bankswitch_w)
r14976r14977
842842{
843843   darius_state *state = machine.driver_data<darius_state>();
844844
845   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000, 0x8000);
846   memory_configure_bank(machine, "bank1", 4, 1, machine.region("audiocpu")->base(), 0x8000);
847   memory_set_bank(machine, "bank1", 4);
845   state->membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x8000);
846   state->membank("bank1")->configure_entry(4, state->memregion("audiocpu")->base());
847   state->membank("bank1")->set_entry(4);
848848
849849   state->m_maincpu = machine.device("maincpu");
850850   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
12751275static DRIVER_INIT( darius )
12761276{
12771277   /**** setup sound bank image ****/
1278   UINT8 *RAM = machine.region("audiocpu")->base();
1278   UINT8 *RAM = machine.root_device().memregion("audiocpu")->base();
12791279   int  i;
12801280
12811281   for (i = 3; i >= 0; i--)
src/mame/drivers/ssingles.c
r14976r14977
193193   UINT32 tile_address;
194194   UINT16 cell,palette;
195195   UINT8 b0,b1;
196   const UINT8 *gfx = device->machine().region("gfx1")->base();
196   const UINT8 *gfx = state->memregion("gfx1")->base();
197197
198198   for(cx=0;cx<x_count;++cx)
199199   {
r14976r14977
231231   UINT32 tile_address;
232232   UINT16 cell,palette;
233233   UINT8 b0,b1;
234   const UINT8 *gfx = device->machine().region("gfx1")->base();
234   const UINT8 *gfx = state->memregion("gfx1")->base();
235235
236236   for(cx=0;cx<x_count;++cx)
237237   {
r14976r14977
293293
294294WRITE8_MEMBER(ssingles_state::ssingles_videoram_w)
295295{
296   UINT8 *vram = machine().region("vram")->base();
296   UINT8 *vram = memregion("vram")->base();
297297   vram[offset] = data;
298298   m_videoram[offset]=data;
299299}
300300
301301WRITE8_MEMBER(ssingles_state::ssingles_colorram_w)
302302{
303   UINT8 *cram = machine().region("cram")->base();
303   UINT8 *cram = memregion("cram")->base();
304304   cram[offset] = data;
305305   m_colorram[offset]=data;
306306}
src/mame/drivers/sub.c
r14976r14977
386386
387387static PALETTE_INIT( sub )
388388{
389   const UINT8 *color_prom = machine.region("proms")->base();
389   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
390390   int i;
391   UINT8* lookup = machine.region("proms2")->base();
391   UINT8* lookup = machine.root_device().memregion("proms2")->base();
392392
393393   /* allocate the colortable */
394394   machine.colortable = colortable_alloc(machine, 0x100);
src/mame/drivers/cbasebal.c
r14976r14977
3232
3333   /* bits 0-4 select ROM bank */
3434   //logerror("%04x: bankswitch %02x\n", cpu_get_pc(&space.device()), data);
35   memory_set_bank(machine(), "bank1", data & 0x1f);
35   membank("bank1")->set_entry(data & 0x1f);
3636
3737   /* bit 5 used but unknown */
3838
r14976r14977
243243{
244244   cbasebal_state *state = machine.driver_data<cbasebal_state>();
245245
246   memory_configure_bank(machine, "bank1", 0, 32, machine.region("maincpu")->base() + 0x10000, 0x4000);
246   state->membank("bank1")->configure_entries(0, 32, state->memregion("maincpu")->base() + 0x10000, 0x4000);
247247
248248   state->save_item(NAME(state->m_rambank));
249249   state->save_item(NAME(state->m_tilebank));
src/mame/drivers/st0016.c
r14976r14977
7070
7171WRITE8_MEMBER(st0016_state::st0016_rom_bank_w)
7272{
73   memory_set_bankptr(machine(),  "bank1", machine().region("maincpu")->base() + (data* 0x4000) + 0x10000 );
73   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (data* 0x4000) + 0x10000 );
7474   st0016_rom_bank=data;
7575}
7676
r14976r14977
681681static DRIVER_INIT(mayjinsn)
682682{
683683   st0016_game=4|0x80;
684   memory_set_bankptr(machine, "bank2", machine.region("user1")->base());
684   machine.root_device().membank("bank2")->set_base(machine.root_device().memregion("user1")->base());
685685}
686686
687687static DRIVER_INIT(mayjisn2)
688688{
689689   st0016_game=4;
690   memory_set_bankptr(machine, "bank2", machine.region("user1")->base());
690   machine.root_device().membank("bank2")->set_base(machine.root_device().memregion("user1")->base());
691691}
692692
693693/*************************************
src/mame/drivers/skyarmy.c
r14976r14977
8787
8888static PALETTE_INIT( skyarmy )
8989{
90   const UINT8 *color_prom = machine.region("proms")->base();
90   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9191   int i;
9292
9393   for (i = 0;i < 32;i++)
src/mame/drivers/suprgolf.c
r14976r14977
257257static WRITE8_DEVICE_HANDLER( rom_bank_select_w )
258258{
259259   suprgolf_state *state = device->machine().driver_data<suprgolf_state>();
260   UINT8 *region_base = device->machine().region("user1")->base();
260   UINT8 *region_base = state->memregion("user1")->base();
261261
262262   state->m_rom_bank = data;
263263
264264   //popmessage("%08x %02x",((data & 0x3f) * 0x4000),data);
265265
266266//  mame_printf_debug("ROM_BANK 0x8000 - %X @%X\n",data,cpu_get_previouspc(&space->device()));
267   memory_set_bankptr(device->machine(), "bank2", region_base + (data&0x3f ) * 0x4000);
267   state->membank("bank2")->set_base(region_base + (data&0x3f ) * 0x4000);
268268
269269   state->m_msm_nmi_mask = data & 0x40;
270270   state->flip_screen_set(data & 0x80);
r14976r14977
272272
273273WRITE8_MEMBER(suprgolf_state::rom2_bank_select_w)
274274{
275   UINT8 *region_base = machine().region("user2")->base();
275   UINT8 *region_base = memregion("user2")->base();
276276//  mame_printf_debug("ROM_BANK 0x4000 - %X @%X\n",data,cpu_get_previouspc(&space.device()));
277277
278   memory_set_bankptr(machine(), "bank1", region_base + (data&0x0f) * 0x4000);
278   membank("bank1")->set_base(region_base + (data&0x0f) * 0x4000);
279279
280280   if(data & 0xf0)
281281      printf("Rom bank select 2 with data %02x activated\n",data);
r14976r14977
638638
639639static DRIVER_INIT( suprgolf )
640640{
641   UINT8 *ROM = machine.region("user2")->base();
641   UINT8 *ROM = machine.root_device().memregion("user2")->base();
642642
643643   ROM[0x74f4-0x4000] = 0x00;
644644   ROM[0x74f5-0x4000] = 0x00;
src/mame/drivers/ksayakyu.c
r14976r14977
8181        xxxxxxx  - unused ?
8282
8383    */
84   memory_set_bank(machine(), "bank1", data & 0x01);
84   membank("bank1")->set_entry(data & 0x01);
8585}
8686
8787WRITE8_MEMBER(ksayakyu_state::latch_w)
r14976r14977
250250static MACHINE_START( ksayakyu )
251251{
252252   ksayakyu_state *state = machine.driver_data<ksayakyu_state>();
253   UINT8 *ROM = machine.region("maincpu")->base();
253   UINT8 *ROM = state->memregion("maincpu")->base();
254254
255   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x4000);
255   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000);
256256
257257   state->save_item(NAME(state->m_sound_status));
258258   state->save_item(NAME(state->m_video_ctrl));
src/mame/drivers/qix.c
r14976r14977
12781278     ********************************/
12791279
12801280   i = 0;
1281   //patch = machine.region("user1")->base();
1282   rom = machine.region("maincpu")->base();
1281   //patch = machine.root_device().memregion("user1")->base();
1282   rom = machine.root_device().memregion("maincpu")->base();
12831283   decrypted = auto_alloc_array(machine, UINT8, 0x6000);
12841284
12851285   mainspace->set_decrypted_region(0xa000, 0xffff, decrypted);
r14976r14977
12911291   }
12921292
12931293   i = 0;
1294   //patch = machine.region("user2")->base();
1295   rom = machine.region("videocpu")->base();
1294   //patch = machine.root_device().memregion("user2")->base();
1295   rom = machine.root_device().memregion("videocpu")->base();
12961296   decrypted = auto_alloc_array(machine, UINT8, 0x6000);
12971297
12981298   videospace->set_decrypted_region(0xa000, 0xffff, decrypted);
r14976r14977
13081308static DRIVER_INIT( zookeep )
13091309{
13101310   /* configure the banking */
1311   memory_configure_bank(machine, "bank1", 0, 1, machine.region("videocpu")->base() + 0xa000, 0);
1312   memory_configure_bank(machine, "bank1", 1, 1, machine.region("videocpu")->base() + 0x10000, 0);
1313   memory_set_bank(machine, "bank1", 0);
1311   machine.root_device().membank("bank1")->configure_entry(0, machine.root_device().memregion("videocpu")->base() + 0xa000);
1312   machine.root_device().membank("bank1")->configure_entry(1, machine.root_device().memregion("videocpu")->base() + 0x10000);
1313   machine.root_device().membank("bank1")->set_entry(0);
13141314}
13151315
13161316
src/mame/drivers/himesiki.c
r14976r14977
9191
9292WRITE8_MEMBER(himesiki_state::himesiki_rombank_w)
9393{
94   memory_set_bank(machine(), "bank1", ((data & 0x08) >> 3));
94   membank("bank1")->set_entry(((data & 0x08) >> 3));
9595
9696   if (data & 0xf7)
9797      logerror("p06_w %02x\n", data);
r14976r14977
269269static MACHINE_START( himesiki )
270270{
271271   himesiki_state *state = machine.driver_data<himesiki_state>();
272   UINT8 *ROM = machine.region("maincpu")->base();
272   UINT8 *ROM = state->memregion("maincpu")->base();
273273
274   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x4000);
274   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000);
275275
276276   state->m_subcpu = machine.device("sub");
277277
src/mame/drivers/battlex.c
r14976r14977
315315
316316static DRIVER_INIT( battlex )
317317{
318   UINT8 *colormask = machine.region("user1")->base();
319   UINT8 *gfxdata = machine.region("user2")->base();
320   UINT8 *dest = machine.region("gfx1")->base();
318   UINT8 *colormask = machine.root_device().memregion("user1")->base();
319   UINT8 *gfxdata = machine.root_device().memregion("user2")->base();
320   UINT8 *dest = machine.root_device().memregion("gfx1")->base();
321321
322322   int tile, line, bit;
323323
src/mame/drivers/adp.c
r14976r14977
319319
320320   // hack to handle acrt rom
321321   {
322      UINT16 *rom = (UINT16*)machine.region("gfx1")->base();
322      UINT16 *rom = (UINT16*)state->memregion("gfx1")->base();
323323      int i;
324324
325325      device_t *hd63484 = machine.device("hd63484");
r14976r14977
637637
638638READ8_MEMBER(adp_state::h63484_rom_r)
639639{
640   UINT8 *rom = machine().region("gfx1")->base();
640   UINT8 *rom = memregion("gfx1")->base();
641641
642642   return rom[offset];
643643}
src/mame/drivers/konamigq.c
r14976r14977
321321
322322   psx_driver_init(machine);
323323
324   state->m_p_n_pcmram = machine.region( "shared" )->base() + 0x80000;
324   state->m_p_n_pcmram = state->memregion( "shared" )->base() + 0x80000;
325325}
326326
327327static void konamigq_exit(running_machine &machine)
src/mame/drivers/snesb.c
r14976r14977
650650{
651651   snesb_state *state = machine.driver_data<snesb_state>();
652652   INT32 i;
653   UINT8 *rom = machine.region("user3")->base();
653   UINT8 *rom = state->memregion("user3")->base();
654654
655655   for (i = 0; i < 0x400000; i++)
656656   {
r14976r14977
671671static DRIVER_INIT( ffight2b )
672672{
673673   INT32 i;
674   UINT8 *rom = machine.region("user3")->base();
674   UINT8 *rom = machine.root_device().memregion("user3")->base();
675675
676676   for(i = 0; i < 0x200000; i++)
677677   {
r14976r14977
715715static DRIVER_INIT( iron )
716716{
717717   INT32 i;
718   UINT8 *rom = machine.region("user3")->base();
718   UINT8 *rom = machine.root_device().memregion("user3")->base();
719719
720720   for (i = 0; i < 0x140000; i++)
721721   {
r14976r14977
740740
741741static DRIVER_INIT( denseib )
742742{
743   UINT8 *rom = machine.region("user3")->base();
743   UINT8 *rom = machine.root_device().memregion("user3")->base();
744744   INT32 i;
745745
746746   for (i = 0; i < 0x200000; i++)
r14976r14977
790790static DRIVER_INIT( sblast2b )
791791{
792792   int i, cipherText, plainText, newAddress;
793   UINT8 *src = machine.region("user7")->base();
794   UINT8 *dst = machine.region("user3")->base();
793   UINT8 *src = machine.root_device().memregion("user7")->base();
794   UINT8 *dst = machine.root_device().memregion("user3")->base();
795795
796796   for (i =0; i < 0x80000 * 3; i++)
797797   {
r14976r14977
841841static DRIVER_INIT( endless )
842842{
843843   INT32 i;
844   UINT8 *rom = machine.region("user3")->base();
844   UINT8 *rom = machine.root_device().memregion("user3")->base();
845845
846846   /* there is more to this, 0x800 based block swaps? */
847847   for (i = 0; i < 0x200000; i++)
src/mame/drivers/pcxt.c
r14976r14977
109109   pcxt_state *state = screen.machine().driver_data<pcxt_state>();
110110   int x,y;
111111   int yi;
112   const UINT8 *bg_rom = screen.machine().region("gfx2")->base();
112   const UINT8 *bg_rom = state->memregion("gfx2")->base();
113113
114114   //popmessage("%04x",m_start_offs);
115115
r14976r14977
199199   if (newbank != m_bank)
200200   {
201201      m_bank = newbank;
202      memory_set_bankptr(machine(),  "bank1",machine().region("game_prg")->base() + 0x10000 * m_bank );
202      membank("bank1")->set_base(machine().root_device().memregion("game_prg")->base() + 0x10000 * m_bank );
203203   }
204204
205205   m_lastvalue = data;
src/mame/drivers/mcatadv.c
r14976r14977
206206
207207WRITE8_MEMBER(mcatadv_state::mcatadv_sound_bw_w)
208208{
209   memory_set_bank(machine(), "bank1", data);
209   membank("bank1")->set_entry(data);
210210}
211211
212212
r14976r14977
428428static MACHINE_START( mcatadv )
429429{
430430   mcatadv_state *state = machine.driver_data<mcatadv_state>();
431   UINT8 *ROM = machine.region("soundcpu")->base();
431   UINT8 *ROM = state->memregion("soundcpu")->base();
432432
433   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
434   memory_set_bank(machine, "bank1", 1);
433   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
434   state->membank("bank1")->set_entry(1);
435435
436436   state->m_maincpu = machine.device("maincpu");
437437   state->m_soundcpu = machine.device("soundcpu");
src/mame/drivers/toaplan2.c
r14976r14977
431431
432432static DRIVER_INIT( fixeightbl )
433433{
434   UINT8 *ROM = machine.region("oki")->base();
434   UINT8 *ROM = machine.root_device().memregion("oki")->base();
435435
436   memory_configure_bank(machine, "bank1", 0, 5, &ROM[0x30000], 0x10000);
436   machine.root_device().membank("bank1")->configure_entries(0, 5, &ROM[0x30000], 0x10000);
437437}
438438
439439
r14976r14977
447447
448448static DRIVER_INIT( pipibibsbl )
449449{
450   UINT16 *ROM = (UINT16 *)(machine.region("maincpu")->base());
450   UINT16 *ROM = (UINT16 *)(machine.root_device().memregion("maincpu")->base());
451451
452452   for (int i = 0; i < (0x040000/2); i += 4)
453453   {
r14976r14977
461461
462462static DRIVER_INIT( bgaregga )
463463{
464   UINT8 *Z80 = machine.region("audiocpu")->base();
464   UINT8 *Z80 = machine.root_device().memregion("audiocpu")->base();
465465
466466   // seems to only use banks 0x0a to 0x0f
467   memory_configure_bank(machine, "bank1", 8, 8, Z80, 0x4000);
467   machine.root_device().membank("bank1")->configure_entries(8, 8, Z80, 0x4000);
468468}
469469
470470
471471static DRIVER_INIT( batrider )
472472{
473473   toaplan2_state *state = machine.driver_data<toaplan2_state>();
474   UINT8 *Z80 = machine.region("audiocpu")->base();
474   UINT8 *Z80 = state->memregion("audiocpu")->base();
475475
476   memory_configure_bank(machine, "bank1", 0, 16, Z80, 0x4000);
476   state->membank("bank1")->configure_entries(0, 16, Z80, 0x4000);
477477   state->m_sndirq_line = 4;
478478}
479479
r14976r14977
781781   if (ACCESSING_BITS_0_7)
782782   {
783783      data &= 7;
784      if (data <= 4) memory_set_bank(machine(), "bank1", data);
784      if (data <= 4) membank("bank1")->set_entry(data);
785785   }
786786}
787787
r14976r14977
840840
841841WRITE8_MEMBER(toaplan2_state::raizing_z80_bankswitch_w)
842842{
843   memory_set_bank(machine(), "bank1", data & 0x0f);
843   membank("bank1")->set_entry(data & 0x0f);
844844}
845845
846846
r14976r14977
909909
910910READ16_MEMBER(toaplan2_state::batrider_z80rom_r)
911911{
912   UINT8 *Z80 = machine().region("audiocpu")->base();
912   UINT8 *Z80 = memregion("audiocpu")->base();
913913
914914   return Z80[offset];
915915}
src/mame/drivers/cinemat.c
r14976r14977
273273
274274WRITE8_MEMBER(cinemat_state::qb3_ram_bank_w)
275275{
276   memory_set_bank(machine(), "bank1", cpu_get_reg(machine().device("maincpu"), CCPU_P) & 3);
276   membank("bank1")->set_entry(cpu_get_reg(machine().device("maincpu"), CCPU_P) & 3);
277277}
278278
279279
r14976r14977
14871487   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0f, 0x0f, read8_delegate(FUNC(cinemat_state::qb3_frame_r),state));
14881488   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x00, 0x00, write8_delegate(FUNC(cinemat_state::qb3_ram_bank_w),state));
14891489
1490   memory_configure_bank(machine, "bank1", 0, 4, state->m_rambase, 0x100*2);
1490   state->membank("bank1")->configure_entries(0, 4, state->m_rambase, 0x100*2);
14911491}
14921492
14931493
src/mame/drivers/mjkjidai.c
r14976r14977
7474
7575   state->m_playing = 0;
7676   state->m_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), state, mjkjidai_adpcm_callback);
77   state->m_base = machine.region("adpcm")->base();
77   state->m_base = machine.root_device().memregion("adpcm")->base();
7878   state->m_adpcm.reset();
7979}
8080
src/mame/drivers/jailbrek.c
r14976r14977
404404
405405static DRIVER_INIT( jailbrek )
406406{
407   UINT8 *SPEECH_ROM = machine.region("vlm")->base();
407   UINT8 *SPEECH_ROM = machine.root_device().memregion("vlm")->base();
408408   int ind;
409409
410410    /*
r14976r14977
416416       represents address line A13.)
417417    */
418418
419    if (machine.region("vlm")->bytes() == 0x4000)
419    if (machine.root_device().memregion("vlm")->bytes() == 0x4000)
420420    {
421421        for (ind = 0; ind < 0x2000; ++ind)
422422        {
src/mame/drivers/su2000.c
r14976r14977
270270   state->m_pc_ram = auto_alloc_array_clear(machine, UINT32, PC_RAM_SIZE);
271271
272272   /* Conventional memory */
273   memory_set_bankptr(machine, "mem_bank", state->m_pc_ram);
273   state->membank("mem_bank")->set_base(state->m_pc_ram);
274274
275275   /* HMA */
276276   offs_t ram_limit = 0x100000 + PC_RAM_SIZE - 0x0a0000;
277277   space->install_read_bank(0x100000, ram_limit - 1, "hma_bank");
278278   space->install_write_bank(0x100000, ram_limit - 1, "hma_bank");
279   memory_set_bankptr(machine, "hma_bank", state->m_pc_ram + 0xa0000);
279   state->membank("hma_bank")->set_base(state->m_pc_ram + 0xa0000);
280280
281281   device_set_irq_callback(machine.device("maincpu"), pc_irq_callback);
282282
src/mame/drivers/gaelco.c
r14976r14977
6161
6262WRITE16_MEMBER(gaelco_state::OKIM6295_bankswitch_w)
6363{
64   UINT8 *RAM = machine().region("oki")->base();
64   UINT8 *RAM = memregion("oki")->base();
6565
6666   if (ACCESSING_BITS_0_7)
6767   {
src/mame/drivers/wecleman.c
r14976r14977
12181218{
12191219   const char *region       = "gfx1";   // sprites
12201220
1221   const UINT32 len = machine.region(region)->bytes();
1222   UINT8 *src     = machine.region(region)->base() + len / 2 - 1;
1223   UINT8 *dst     = machine.region(region)->base() + len - 1;
1221   const UINT32 len = machine.root_device().memregion(region)->bytes();
1222   UINT8 *src     = machine.root_device().memregion(region)->base() + len / 2 - 1;
1223   UINT8 *dst     = machine.root_device().memregion(region)->base() + len - 1;
12241224
12251225   while(dst > src)
12261226   {
r14976r14977
12511251   wecleman_state *state = machine.driver_data<wecleman_state>();
12521252   int i, len;
12531253   UINT8 *RAM;
1254//  UINT16 *RAM1 = (UINT16 *) machine.region("maincpu")->base();   /* Main CPU patches */
1254//  UINT16 *RAM1 = (UINT16 *) machine.root_device().memregion("maincpu")->base();   /* Main CPU patches */
12551255//  RAM1[0x08c2/2] = 0x601e;    // faster self test
12561256
12571257   /* Decode GFX Roms - Compensate for the address lines scrambling */
r14976r14977
12611261        I hope you'll appreciate this effort!  */
12621262
12631263   /* let's swap even and odd *pixels* of the sprites */
1264   RAM = machine.region("gfx1")->base();
1265   len = machine.region("gfx1")->bytes();
1264   RAM = machine.root_device().memregion("gfx1")->base();
1265   len = state->memregion("gfx1")->bytes();
12661266   for (i = 0; i < len; i ++)
12671267   {
12681268      /* TODO: could be wrong, colors have to be fixed.       */
r14976r14977
12711271      RAM[i] = BITSWAP8(RAM[i],7,0,1,2,3,4,5,6);
12721272   }
12731273
1274   bitswap(machine, machine.region("gfx1")->base(), machine.region("gfx1")->bytes(),
1274   bitswap(machine, machine.root_device().memregion("gfx1")->base(), machine.root_device().memregion("gfx1")->bytes(),
12751275         0,1,20,19,18,17,14,9,16,6,4,7,8,15,10,11,13,5,12,3,2);
12761276
12771277   /* Now we can unpack each nibble of the sprites into a pixel (one byte) */
12781278   wecleman_unpack_sprites(machine);
12791279
12801280   /* Bg & Fg & Txt */
1281   bitswap(machine, machine.region("gfx2")->base(), machine.region("gfx2")->bytes(),
1281   bitswap(machine, machine.root_device().memregion("gfx2")->base(), machine.root_device().memregion("gfx2")->bytes(),
12821282         20,19,18,17,16,15,12,7,14,4,2,5,6,13,8,9,11,3,10,1,0);
12831283
12841284   /* Road */
1285   bitswap(machine, machine.region("gfx3")->base(), machine.region("gfx3")->bytes(),
1285   bitswap(machine, machine.root_device().memregion("gfx3")->base(), machine.root_device().memregion("gfx3")->bytes(),
12861286         20,19,18,17,16,15,14,7,12,4,2,5,6,13,8,9,11,3,10,1,0);
12871287
12881288   state->m_spr_color_offs = 0x40;
r14976r14977
13471347   UINT8 *base, *temp;
13481348   int i;
13491349
1350   base = machine.region("gfx1")->base();   // sprites
1350   base = machine.root_device().memregion("gfx1")->base();   // sprites
13511351   temp = auto_alloc_array(machine, UINT8,  bank_size );
13521352
13531353   for( i = num16_banks; i >0; i-- ){
r14976r14977
13931393static DRIVER_INIT( hotchase )
13941394{
13951395   wecleman_state *state = machine.driver_data<wecleman_state>();
1396//  UINT16 *RAM1 = (UINT16) machine.region("maincpu")->base(); /* Main CPU patches */
1396//  UINT16 *RAM1 = (UINT16) machine.root_device().memregion("maincpu")->base(); /* Main CPU patches */
13971397//  RAM[0x1140/2] = 0x0015; RAM[0x195c/2] = 0x601A; // faster self test
13981398
13991399   UINT8 *RAM;
r14976r14977
14011401   /* Decode GFX Roms */
14021402
14031403   /* Let's swap even and odd bytes of the sprites gfx roms */
1404   RAM = machine.region("gfx1")->base();
1404   RAM = machine.root_device().memregion("gfx1")->base();
14051405
14061406   /* Now we can unpack each nibble of the sprites into a pixel (one byte) */
14071407   hotchase_sprite_decode(machine,3,0x80000*2);   // num banks, bank len
14081408
14091409   /* Let's copy the second half of the fg layer gfx (charset) over the first */
1410   RAM = machine.region("gfx3")->base();
1410   RAM = state->memregion("gfx3")->base();
14111411   memcpy(&RAM[0], &RAM[0x10000/2], 0x10000/2);
14121412
14131413   state->m_spr_color_offs = 0;
src/mame/drivers/kas89.c
r14976r14977
865865static DRIVER_INIT(kas89)
866866{
867867   int i;
868   UINT8 *mem = machine.region("maincpu")->base();
869   int memsize = machine.region("maincpu")->bytes();
868   UINT8 *mem = machine.root_device().memregion("maincpu")->base();
869   int memsize = machine.root_device().memregion("maincpu")->bytes();
870870   UINT8 *buf;
871871
872872   /* Unscrambling data lines */
src/mame/drivers/dmndrby.c
r14976r14977
338338static VIDEO_START(dderby)
339339{
340340   dmndrby_state *state = machine.driver_data<dmndrby_state>();
341   state->m_racetrack_tilemap_rom = machine.region("user1")->base();
341   state->m_racetrack_tilemap_rom = state->memregion("user1")->base();
342342   state->m_racetrack_tilemap = tilemap_create(machine,get_dmndrby_tile_info,tilemap_scan_rows,16,16, 16, 512);
343343   state->m_racetrack_tilemap->mark_all_dirty();
344344
r14976r14977
444444// copied from elsewhere. surely incorrect
445445static PALETTE_INIT( dmnderby )
446446{
447   const UINT8 *color_prom = machine.region("proms")->base();
447   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
448448   static const int resistances_rg[3] = { 1000, 470, 220 };
449449   static const int resistances_b [2] = { 470, 220 };
450450   double rweights[3], gweights[3], bweights[2];
r14976r14977
486486   }
487487
488488   /* color_prom now points to the beginning of the lookup table */
489   color_prom = machine.region("proms2")->base();
489   color_prom = machine.root_device().memregion("proms2")->base();
490490
491491   /* normal tiles use colors 0-15 */
492492   for (i = 0x000; i < 0x300; i++)
src/mame/drivers/voyager.c
r14976r14977
234234         //if (data & 0x10)     // enable RAM access to region 0xf0000 - 0xfffff
235235         if ((data & 0x50) | (data & 0xA0))
236236         {
237            memory_set_bankptr(busdevice->machine(), "bank1", state->m_bios_ram);
237            state->membank("bank1")->set_base(state->m_bios_ram);
238238         }
239239         else            // disable RAM access (reads go to BIOS ROM)
240240         {
r14976r14977
247247            }
248248            #endif
249249
250            //memory_set_bankptr(busdevice->machine(), "bank1", busdevice->machine().region("bios")->base() + 0x10000);
251            memory_set_bankptr(busdevice->machine(), "bank1", busdevice->machine().region("bios")->base());
250            state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x10000);
251            state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base());
252252         }
253253         break;
254254      }
r14976r14977
720720
721721static MACHINE_RESET(voyager)
722722{
723   //memory_set_bankptr(machine, "bank1", machine.region("bios")->base() + 0x10000);
724   memory_set_bankptr(machine, "bank1", machine.region("bios")->base());
723   //machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("bios")->base() + 0x10000);
724   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("bios")->base());
725725}
726726
727727static void set_gate_a20(running_machine &machine, int a20)
src/mame/drivers/lastduel.c
r14976r14977
175175
176176WRITE8_MEMBER(lastduel_state::mg_bankswitch_w)
177177{
178   memory_set_bank(machine(), "bank1", data & 0x01);
178   membank("bank1")->set_entry(data & 0x01);
179179}
180180
181181static ADDRESS_MAP_START( madgear_sound_map, AS_PROGRAM, 8, lastduel_state )
r14976r14977
479479
480480static MACHINE_START( madgear )
481481{
482   UINT8 *ROM = machine.region("audiocpu")->base();
482   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
483483
484   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x4000);
484   machine.root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000);
485485
486486   MACHINE_START_CALL(lastduel);
487487}
src/mame/drivers/cmmb.c
r14976r14977
9595
9696READ8_MEMBER(cmmb_state::cmmb_charram_r)
9797{
98   UINT8 *GFX = machine().region("gfx")->base();
98   UINT8 *GFX = memregion("gfx")->base();
9999
100100   return GFX[offset];
101101}
102102
103103WRITE8_MEMBER(cmmb_state::cmmb_charram_w)
104104{
105   UINT8 *GFX = machine().region("gfx")->base();
105   UINT8 *GFX = memregion("gfx")->base();
106106
107107   GFX[offset] = data;
108108
r14976r14977
137137
138138/*
139139    {
140        UINT8 *ROM = space->machine().region("maincpu")->base();
140        UINT8 *ROM = space->machine().root_device().memregion("maincpu")->base();
141141        UINT32 bankaddress;
142142
143143        bankaddress = 0x10000 + (0x10000 * (data & 0x03));
144        memory_set_bankptr(space->machine(), "bank1", &ROM[bankaddress]);
144        space->machine().root_device().membank("bank1")->set_base(&ROM[bankaddress]);
145145    }
146146*/
147147
r14976r14977
152152   {
153153      case 0x01:
154154         {
155            UINT8 *ROM = machine().region("maincpu")->base();
155            UINT8 *ROM = memregion("maincpu")->base();
156156            UINT32 bankaddress;
157157
158158            bankaddress = 0x1c000 + (0x10000 * (data & 0x03));
159            memory_set_bankptr(machine(), "bank1", &ROM[bankaddress]);
159            membank("bank1")->set_base(&ROM[bankaddress]);
160160         }
161161         break;
162162      case 0x03:
src/mame/drivers/drgnmst.c
r14976r14977
486486
487487static DRIVER_INIT( drgnmst )
488488{
489   UINT8 *drgnmst_PICROM_HEX = machine.region("user1")->base();
490   UINT16 *drgnmst_PICROM = (UINT16 *)machine.region("audiocpu")->base();
491   UINT8 *drgnmst_PCM = machine.region("oki1")->base();
489   UINT8 *drgnmst_PICROM_HEX = machine.root_device().memregion("user1")->base();
490   UINT16 *drgnmst_PICROM = (UINT16 *)machine.root_device().memregion("audiocpu")->base();
491   UINT8 *drgnmst_PCM = machine.root_device().memregion("oki1")->base();
492492   INT32   offs, data;
493493   UINT16  src_pos = 0;
494494   UINT16  dst_pos = 0;
src/mame/drivers/boxer.c
r14976r14977
126126
127127   for (n = 0; n < 2; n++)
128128   {
129      const UINT8* p = machine.region(n == 0 ? "user1" : "user2")->base();
129      const UINT8* p = state->memregion(n == 0 ? "user1" : "user2")->base();
130130
131131      int i, j;
132132
src/mame/drivers/roul.c
r14976r14977
8888
8989static PALETTE_INIT( roul )
9090{
91   const UINT8 *color_prom = machine.region("proms")->base();
91   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9292   int bit6, bit7, bit0, bit1, r, g, b;
9393   int i;
9494
src/mame/drivers/cischeat.c
r14976r14977
17761776*/
17771777static void cischeat_untangle_sprites(running_machine &machine, const char *region)
17781778{
1779   UINT8      *src = machine.region(region)->base();
1780   const UINT8   *end = src + machine.region(region)->bytes();
1779   UINT8      *src = machine.root_device().memregion(region)->base();
1780   const UINT8   *end = src + machine.root_device().memregion(region)->bytes();
17811781
17821782   while (src < end)
17831783   {
src/mame/drivers/freekick.c
r14976r14977
6868
6969WRITE8_MEMBER(freekick_state::pbillrd_bankswitch_w)
7070{
71   memory_set_bank(machine(), "bank1", data & 1);
71   membank("bank1")->set_entry(data & 1);
7272}
7373
7474WRITE8_MEMBER(freekick_state::nmi_enable_w)
r14976r14977
509509static READ8_DEVICE_HANDLER( snd_rom_r )
510510{
511511   freekick_state *state = device->machine().driver_data<freekick_state>();
512   return device->machine().region("user1")->base()[state->m_romaddr & 0x7fff];
512   return state->memregion("user1")->base()[state->m_romaddr & 0x7fff];
513513}
514514
515515static const ppi8255_interface ppi8255_intf[2] =
r14976r14977
599599
600600static MACHINE_START( pbillrd )
601601{
602   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x4000);
602   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
603603
604604   MACHINE_START_CALL(freekick);
605605}
r14976r14977
11001100static DRIVER_INIT(gigasb)
11011101{
11021102   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1103   space->set_decrypted_region(0x0000, 0xbfff, machine.region("maincpu")->base() + 0x10000);
1103   space->set_decrypted_region(0x0000, 0xbfff, machine.root_device().memregion("maincpu")->base() + 0x10000);
11041104}
11051105
11061106
src/mame/drivers/redclash.c
r14976r14977
539539static DRIVER_INIT( redclash )
540540{
541541   int i,j;
542   const UINT8 *src = machine.region("gfx2")->base();
543   UINT8 *dst = machine.region("gfx3")->base();
544   int len = machine.region("gfx3")->bytes();
542   const UINT8 *src = machine.root_device().memregion("gfx2")->base();
543   UINT8 *dst = machine.root_device().memregion("gfx3")->base();
544   int len = machine.root_device().memregion("gfx3")->bytes();
545545
546546   /* rearrange the sprite graphics */
547547   for (i = 0;i < len;i++)
src/mame/drivers/wgp.c
r14976r14977
608608static void reset_sound_region( running_machine &machine )   /* assumes Z80 sandwiched between the 68Ks */
609609{
610610   wgp_state *state = machine.driver_data<wgp_state>();
611   memory_set_bank(machine, "bank10", state->m_banknum);
611   state->membank("bank10")->set_entry(state->m_banknum);
612612}
613613
614614WRITE8_MEMBER(wgp_state::sound_bankswitch_w)
r14976r14977
946946{
947947   wgp_state *state = machine.driver_data<wgp_state>();
948948
949   memory_configure_bank(machine, "bank10", 0, 4, machine.region("audiocpu")->base() + 0xc000, 0x4000);
949   state->membank("bank10")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0xc000, 0x4000);
950950
951951   state->m_maincpu = machine.device("maincpu");
952952   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
12621262#if 0
12631263   /* Patch for coding error that causes corrupt data in
12641264       sprite tilemapping area from $4083c0-847f */
1265   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
1265   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
12661266   ROM[0x25dc / 2] = 0x0602;   // faulty value is 0x0206
12671267#endif
12681268}
r14976r14977
12701270static DRIVER_INIT( wgp2 )
12711271{
12721272   /* Code patches to prevent failure in memory checks */
1273   UINT16 *ROM = (UINT16 *)machine.region("sub")->base();
1273   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("sub")->base();
12741274   ROM[0x8008 / 2] = 0x0;
12751275   ROM[0x8010 / 2] = 0x0;
12761276}
src/mame/drivers/welltris.c
r14976r14977
322322
323323WRITE8_MEMBER(welltris_state::welltris_sh_bankswitch_w)
324324{
325   UINT8 *rom = machine().region("audiocpu")->base() + 0x10000;
325   UINT8 *rom = memregion("audiocpu")->base() + 0x10000;
326326
327   memory_set_bankptr(machine(), "bank1",rom + (data & 0x03) * 0x8000);
327   membank("bank1")->set_base(rom + (data & 0x03) * 0x8000);
328328}
329329
330330
r14976r14977
689689{
690690#if WELLTRIS_4P_HACK
691691   /* A Hack which shows 4 player mode in code which is disabled */
692   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
692   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
693693   RAM[0xB91C/2] = 0x4e71;
694694   RAM[0xB91E/2] = 0x4e71;
695695#endif
src/mame/drivers/scregg.c
r14976r14977
396396{
397397   // rd2.rdh and rd1.rdj are bitswapped, but not rd3.rdg .. are they really from the same board?
398398   int x;
399   UINT8 *src = machine.region( "gfx1" )->base();
399   UINT8 *src = machine.root_device().memregion( "gfx1" )->base();
400400
401401   for (x = 0x2000; x < 0x6000; x++)
402402   {
src/mame/drivers/taitoair.c
r14976r14977
378378static void reset_sound_region( running_machine &machine )
379379{
380380   taitoair_state *state = machine.driver_data<taitoair_state>();
381   memory_set_bank(machine, "bank1", state->m_banknum);
381   state->membank("bank1")->set_entry(state->m_banknum);
382382}
383383
384384WRITE8_MEMBER(taitoair_state::sound_bankswitch_w)
r14976r14977
669669static MACHINE_START( taitoair )
670670{
671671   taitoair_state *state = machine.driver_data<taitoair_state>();
672   UINT8 *ROM = machine.region("audiocpu")->base();
672   UINT8 *ROM = state->memregion("audiocpu")->base();
673673   int i;
674674
675   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0xc000], 0x4000);
675   state->membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
676676
677677   state->m_audiocpu = machine.device("audiocpu");
678678   state->m_dsp = machine.device("dsp");
src/mame/drivers/aquarium.c
r14976r14977
6868
6969WRITE8_MEMBER(aquarium_state::aquarium_z80_bank_w)
7070{
71   memory_set_bank(machine(), "bank1", data & 0x07);
71   membank("bank1")->set_entry(data & 0x07);
7272}
7373
7474static UINT8 aquarium_snd_bitswap( UINT8 scrambled_data )
r14976r14977
239239
240240static DRIVER_INIT( aquarium )
241241{
242   UINT8 *Z80 = machine.region("audiocpu")->base();
242   UINT8 *Z80 = machine.root_device().memregion("audiocpu")->base();
243243
244244   /* The BG tiles are 5bpp, this rearranges the data from
245245       the roms containing the 1bpp data so we can decode it
246246       correctly */
247   UINT8 *DAT2 = machine.region("gfx1")->base() + 0x080000;
248   UINT8 *DAT = machine.region("user1")->base();
247   UINT8 *DAT2 = machine.root_device().memregion("gfx1")->base() + 0x080000;
248   UINT8 *DAT = machine.root_device().memregion("user1")->base();
249249   int len = 0x0200000;
250250
251251   for (len = 0; len < 0x020000; len++)
r14976r14977
260260      DAT2[len * 4 + 2] |= (DAT[len] & 0x01) << 3;
261261   }
262262
263   DAT2 = machine.region("gfx4")->base() + 0x080000;
264   DAT = machine.region("user2")->base();
263   DAT2 = machine.root_device().memregion("gfx4")->base() + 0x080000;
264   DAT = machine.root_device().memregion("user2")->base();
265265
266266   for (len = 0; len < 0x020000; len++)
267267   {
r14976r14977
276276   }
277277
278278   /* configure and set up the sound bank */
279   memory_configure_bank(machine, "bank1", 0, 7, &Z80[0x18000], 0x8000);
280   memory_set_bank(machine, "bank1", 1);
279   machine.root_device().membank("bank1")->configure_entries(0, 7, &Z80[0x18000], 0x8000);
280   machine.root_device().membank("bank1")->set_entry(1);
281281}
282282
283283
src/mame/drivers/metro.c
r14976r14977
397397WRITE8_MEMBER(metro_state::metro_sound_rombank_w)
398398{
399399   int bankaddress;
400   UINT8 *ROM = machine().region("audiocpu")->base();
400   UINT8 *ROM = memregion("audiocpu")->base();
401401
402402   bankaddress = 0x10000-0x4000 + ((data >> 4) & 0x03) * 0x4000;
403403   if (bankaddress < 0x10000) bankaddress = 0x0000;
404404
405   memory_set_bankptr(machine(), "bank1", &ROM[bankaddress]);
405   membank("bank1")->set_base(&ROM[bankaddress]);
406406}
407407
408408WRITE8_MEMBER(metro_state::daitorid_sound_rombank_w)
409409{
410410   int bankaddress;
411   UINT8 *ROM = machine().region("audiocpu")->base();
411   UINT8 *ROM = memregion("audiocpu")->base();
412412
413413   bankaddress = 0x10000-0x4000 + ((data >> 4) & 0x07) * 0x4000;
414414   if (bankaddress < 0x10000) bankaddress = 0x10000;
415415
416   memory_set_bankptr(machine(), "bank1", &ROM[bankaddress]);
416   membank("bank1")->set_base(&ROM[bankaddress]);
417417}
418418
419419
r14976r14977
590590
591591READ16_MEMBER(metro_state::metro_bankedrom_r)
592592{
593   UINT8 *ROM = machine().region("gfx1")->base();
594   size_t len = machine().region("gfx1")->bytes();
593   UINT8 *ROM = memregion("gfx1")->base();
594   size_t len = memregion("gfx1")->bytes();
595595
596596   offset = offset * 2 + 0x10000 * (*m_rombank);
597597
r14976r14977
680680
681681   if (offset == 0x0c / 2)
682682   {
683      UINT8 *src     = machine().region("gfx1")->base();
684      size_t src_len = machine().region("gfx1")->bytes();
683      UINT8 *src     = memregion("gfx1")->base();
684      size_t src_len = memregion("gfx1")->bytes();
685685
686686      UINT32 tmap     = (m_blitter_regs[0x00 / 2] << 16) + m_blitter_regs[0x02 / 2];
687687      UINT32 src_offs = (m_blitter_regs[0x04 / 2] << 16) + m_blitter_regs[0x06 / 2];
r14976r14977
16921692
16931693WRITE8_MEMBER(metro_state::blzntrnd_sh_bankswitch_w)
16941694{
1695   UINT8 *RAM = machine().region("audiocpu")->base();
1695   UINT8 *RAM = memregion("audiocpu")->base();
16961696   int bankaddress;
16971697
16981698   bankaddress = 0x10000 + (data & 0x03) * 0x4000;
1699   memory_set_bankptr(machine(), "bank1", &RAM[bankaddress]);
1699   membank("bank1")->set_base(&RAM[bankaddress]);
17001700}
17011701
17021702static void blzntrnd_irqhandler(device_t *device, int irq)
r14976r14977
59955995{
59965996   metro_state *state = machine.driver_data<metro_state>();
59975997
5998   const size_t len = machine.region("gfx1")->bytes();
5999   UINT8 *src       = machine.region("gfx1")->base();
5998   const size_t len = machine.root_device().memregion("gfx1")->bytes();
5999   UINT8 *src       = state->memregion("gfx1")->base();
60006000   UINT8 *end       = src + len;
60016001
60026002   while (src < end)
r14976r14977
60166016
60176017static DRIVER_INIT( dharmak )
60186018{
6019   UINT8 *src = machine.region( "gfx1" )->base();
6019   UINT8 *src = machine.root_device().memregion( "gfx1" )->base();
60206020   int i;
60216021
60226022   for (i = 0; i < 0x200000; i += 4)
src/mame/drivers/angelkds.c
r14976r14977
140140
141141WRITE8_MEMBER(angelkds_state::angelkds_cpu_bank_write)
142142{
143   memory_set_bank(machine(), "bank1", data & 0x0f);   // shall we check (data & 0x0f) < # of available banks (8 or 10 resp.)?
143   membank("bank1")->set_entry(data & 0x0f);   // shall we check (data & 0x0f) < # of available banks (8 or 10 resp.)?
144144}
145145
146146
r14976r14977
744744
745745static DRIVER_INIT( angelkds )
746746{
747   UINT8 *RAM = machine.region("user1")->base();
748   memory_configure_bank(machine, "bank1", 0, 8, &RAM[0x0000], 0x4000);
747   UINT8 *RAM = machine.root_device().memregion("user1")->base();
748   machine.root_device().membank("bank1")->configure_entries(0, 8, &RAM[0x0000], 0x4000);
749749}
750750
751751static DRIVER_INIT( spcpostn )
752752{
753   UINT8 *RAM = machine.region("user1")->base();
753   UINT8 *RAM = machine.root_device().memregion("user1")->base();
754754
755755   sega_317_0005_decode(machine, "maincpu");
756   memory_configure_bank(machine, "bank1", 0, 10, &RAM[0x0000], 0x4000);
756   machine.root_device().membank("bank1")->configure_entries(0, 10, &RAM[0x0000], 0x4000);
757757}
758758
759759
src/mame/drivers/hshavoc.c
r14976r14977
119119{
120120
121121   int x;
122   UINT16 *src = (UINT16 *)machine.region("maincpu")->base();
122   UINT16 *src = (UINT16 *)machine.root_device().memregion("maincpu")->base();
123123
124124   static const UINT16 typedat[16] = {
125125      1,1,1,1, 1,1,1,1,
src/mame/drivers/jrpacman.c
r14976r14977
392392       { 0,0 }
393393   };
394394
395   UINT8 *RAM = machine.region("maincpu")->base();
395   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
396396   int i, j, A;
397397
398398   for (i = A = 0; table[i].count; i++)
src/mame/drivers/nightgal.c
r14976r14977
112112
113113static UINT8 nightgal_gfx_nibble( running_machine &machine, int niboffset )
114114{
115   UINT8 *blit_rom = machine.region("gfx1")->base();
115   UINT8 *blit_rom = machine.root_device().memregion("gfx1")->base();
116116
117117   if (niboffset & 1)
118118   {
r14976r14977
250250/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
251251static PALETTE_INIT( nightgal )
252252{
253   const UINT8 *color_prom = machine.region("proms")->base();
253   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
254254   static const int resistances_rg[3] = { 1000, 470, 220 };
255255   static const int resistances_b [2] = { 470, 220 };
256256   double weights_rg[3], weights_b[2];
r14976r14977
12261226
12271227static DRIVER_INIT( royalqn )
12281228{
1229   UINT8 *ROM = machine.region("sub")->base();
1229   UINT8 *ROM = machine.root_device().memregion("sub")->base();
12301230
12311231   /* patch open bus / protection */
12321232   ROM[0xc27e] = 0x02;
r14976r14977
12351235
12361236static DRIVER_INIT( ngalsumr )
12371237{
1238   UINT8 *ROM = machine.region("sub")->base();
1238   UINT8 *ROM = machine.root_device().memregion("sub")->base();
12391239
12401240   /* patch protection */
12411241   ROM[0xd6ce] = 0x02;
src/mame/drivers/surpratk.c
r14976r14977
191191static MACHINE_START( surpratk )
192192{
193193   surpratk_state *state = machine.driver_data<surpratk_state>();
194   UINT8 *ROM = machine.region("maincpu")->base();
194   UINT8 *ROM = state->memregion("maincpu")->base();
195195
196   memory_configure_bank(machine, "bank1", 0, 28, &ROM[0x10000], 0x2000);
197   memory_configure_bank(machine, "bank1", 28, 4, &ROM[0x08000], 0x2000);
198   memory_set_bank(machine, "bank1", 0);
196   state->membank("bank1")->configure_entries(0, 28, &ROM[0x10000], 0x2000);
197   state->membank("bank1")->configure_entries(28, 4, &ROM[0x08000], 0x2000);
198   state->membank("bank1")->set_entry(0);
199199
200200   state->m_generic_paletteram_8.allocate(0x1000);
201201
r14976r14977
323323static KONAMI_SETLINES_CALLBACK( surpratk_banking )
324324{
325325   logerror("%04x: setlines %02x\n",cpu_get_pc(device), lines);
326   memory_set_bank(device->machine(), "bank1", lines & 0x1f);
326   device->machine().root_device().membank("bank1")->set_entry(lines & 0x1f);
327327}
328328
329329
src/mame/drivers/jongkyo.c
r14976r14977
124124   if (offset & 1)
125125      m_rom_bank |= mask;
126126
127   memory_set_bank(machine(), "bank1", m_rom_bank);
127   membank("bank1")->set_entry(m_rom_bank);
128128}
129129
130130WRITE8_MEMBER(jongkyo_state::mux_w)
r14976r14977
430430static PALETTE_INIT(jongkyo)
431431{
432432   int i;
433   UINT8* proms = machine.region("proms")->base();
433   UINT8* proms = machine.root_device().memregion("proms")->base();
434434   for (i = 0; i < 0x40; i++)
435435   {
436436      int data = proms[i];
r14976r14977
550550static DRIVER_INIT( jongkyo )
551551{
552552   int i;
553   UINT8 *rom = machine.region("maincpu")->base();
553   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
554554
555555   /* first of all, do a simple bitswap */
556556   for (i = 0x6000; i < 0x9000; ++i)
src/mame/drivers/littlerb.c
r14976r14977
503503   if((scanline % 2) == 0)
504504   {
505505      UINT8 res;
506      UINT8 *sample_rom = timer.machine().region("samples")->base();
506      UINT8 *sample_rom = state->memregion("samples")->base();
507507
508508      res = sample_rom[state->m_sound_pointer_l|(state->m_sound_index_l<<10)|0x40000];
509509      dac_signed_w(state->m_dacl, 0, res);
src/mame/drivers/eolith.c
r14976r14977
13091309   //it fails compares with memories:
13101310   //$4002d338 -> $4002d348 .... $4002d33f -> $4002d34f
13111311   //related with bits 0x100 - 0x200 read at startup from input(0) ?
1312   UINT32 *rombase = (UINT32*)machine.region("maincpu")->base();
1312   UINT32 *rombase = (UINT32*)state->memregion("maincpu")->base();
13131313   rombase[0x14f00/4] = (rombase[0x14f00/4] & 0xffff) | 0x03000000; /* Change BR to NOP */
13141314
13151315   state->m_coin_counter_bit = 0x2000;
r14976r14977
13191319static DRIVER_INIT( hidctch2 )
13201320{
13211321   //it fails compares in memory like in landbrka
1322   UINT32 *rombase = (UINT32*)machine.region("maincpu")->base();
1322   UINT32 *rombase = (UINT32*)machine.root_device().memregion("maincpu")->base();
13231323   rombase[0xbcc8/4] = (rombase[0xbcc8/4] & 0xffff) | 0x03000000; /* Change BR to NOP */
13241324   init_eolith_speedup(machine);
13251325}
src/mame/drivers/namcos23.c
r14976r14977
30703070{
30713071   namcos23_state *state = machine.driver_data<namcos23_state>();
30723072   render_t &render = state->m_render;
3073   state->m_ptrom  = (const UINT32 *)machine.region("pointrom")->base();
3074   state->m_tmlrom = (const UINT16 *)machine.region("textilemapl")->base();
3075   state->m_tmhrom = machine.region("textilemaph")->base();
3076   state->m_texrom = machine.region("textile")->base();
3073   state->m_ptrom  = (const UINT32 *)machine.root_device().memregion("pointrom")->base();
3074   state->m_tmlrom = (const UINT16 *)machine.root_device().memregion("textilemapl")->base();
3075   state->m_tmhrom = machine.root_device().memregion("textilemaph")->base();
3076   state->m_texrom = machine.root_device().memregion("textile")->base();
30773077
3078   state->m_tileid_mask = (machine.region("textilemapl")->bytes()/2 - 1) & ~0xff; // Used for y masking
3079   state->m_tile_mask = machine.region("textile")->bytes()/256 - 1;
3080   state->m_ptrom_limit = machine.region("pointrom")->bytes()/4;
3078   state->m_tileid_mask = (machine.root_device().memregion("textilemapl")->bytes()/2 - 1) & ~0xff; // Used for y masking
3079   state->m_tile_mask = machine.root_device().memregion("textile")->bytes()/256 - 1;
3080   state->m_ptrom_limit = state->memregion("pointrom")->bytes()/4;
30813081
30823082   state->m_mi_rd = state->m_mi_wr = state->m_im_rd = state->m_im_wr = 0;
30833083   state->m_jvssense = 1;
src/mame/drivers/chihiro.c
r14976r14977
884884
885885   logerror("baseboard: read sector lba %08x\n",lba);
886886   off=(lba&0x7ff)*512;
887   data=machine().region("others")->base();
887   data=machine().root_device().memregion("others")->base();
888888   memcpy(buffer,data+off,512);
889889   return 1;
890890}
src/mame/drivers/commando.c
r14976r14977
517517static DRIVER_INIT( commando )
518518{
519519   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
520   UINT8 *rom = machine.region("maincpu")->base();
520   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
521521   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0xc000);
522522   int A;
523523
r14976r14977
537537static DRIVER_INIT( spaceinv )
538538{
539539   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
540   UINT8 *rom = machine.region("maincpu")->base();
540   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
541541   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0xc000);
542542   int A;
543543
src/mame/drivers/atarisy2.c
r14976r14977
336336   COMBINE_DATA(&newword);
337337   m_bankselect[offset] = newword;
338338
339   base = &machine().region("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]];
339   base = &machine().root_device().memregion("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]];
340340   memcpy(offset ? m_rombank2 : m_rombank1, base, 0x2000);
341341}
342342
r14976r14977
31803180{
31813181   int i;
31823182   atarisy2_state *state = machine.driver_data<atarisy2_state>();
3183   UINT8 *cpu1 = machine.region("maincpu")->base();
3183   UINT8 *cpu1 = state->memregion("maincpu")->base();
31843184
31853185   slapstic_init(machine, 105);
31863186
r14976r14977
32163216{
32173217   atarisy2_state *state = machine.driver_data<atarisy2_state>();
32183218   int i;
3219   UINT8 *cpu1 = machine.region("maincpu")->base();
3219   UINT8 *cpu1 = state->memregion("maincpu")->base();
32203220
32213221   slapstic_init(machine, 108);
32223222
r14976r14977
32333233{
32343234   int i;
32353235   atarisy2_state *state = machine.driver_data<atarisy2_state>();
3236   UINT8 *cpu1 = machine.region("maincpu")->base();
3236   UINT8 *cpu1 = state->memregion("maincpu")->base();
32373237
32383238   slapstic_init(machine, 109);
32393239
src/mame/drivers/ninjakd2.c
r14976r14977
175175static MACHINE_RESET( ninjakd2 )
176176{
177177   /* initialize main Z80 bank */
178   memory_configure_bank(machine, "bank1", 0, 8, machine.region("maincpu")->base() + 0x10000, 0x4000);
179   memory_set_bank(machine, "bank1", 0);
178   machine.root_device().membank("bank1")->configure_entries(0, 8, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
179   machine.root_device().membank("bank1")->set_entry(0);
180180}
181181
182182static void robokid_init_banks(running_machine &machine)
183183{
184184   /* initialize main Z80 bank */
185   memory_configure_bank(machine, "bank1", 0,  2, machine.region("maincpu")->base(), 0x4000);
186   memory_configure_bank(machine, "bank1", 2, 14, machine.region("maincpu")->base() + 0x10000, 0x4000);
187   memory_set_bank(machine, "bank1", 0);
185   machine.root_device().membank("bank1")->configure_entries(0,  2, machine.root_device().memregion("maincpu")->base(), 0x4000);
186   machine.root_device().membank("bank1")->configure_entries(2, 14, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
187   machine.root_device().membank("bank1")->set_entry(0);
188188}
189189
190190static MACHINE_RESET( robokid )
r14976r14977
202202
203203WRITE8_MEMBER(ninjakd2_state::ninjakd2_bankselect_w)
204204{
205   memory_set_bank(machine(), "bank1", data & 0x7);
205   membank("bank1")->set_entry(data & 0x7);
206206}
207207
208208WRITE8_MEMBER(ninjakd2_state::robokid_bankselect_w)
209209{
210   memory_set_bank(machine(), "bank1", data & 0xf);
210   membank("bank1")->set_entry(data & 0xf);
211211}
212212
213213
r14976r14977
228228{
229229   ninjakd2_state *state = device.machine().driver_data<ninjakd2_state>();
230230   running_machine &machine = device.machine();
231   const UINT8* const rom = machine.region("pcm")->base();
232   const int length = machine.region("pcm")->bytes();
231   const UINT8* const rom = machine.root_device().memregion("pcm")->base();
232   const int length = state->memregion("pcm")->bytes();
233233   INT16* sampledata = auto_alloc_array(machine, INT16, length);
234234
235235   int i;
r14976r14977
244244WRITE8_MEMBER(ninjakd2_state::ninjakd2_pcm_play_w)
245245{
246246   samples_device *samples = machine().device<samples_device>("pcm");
247   const UINT8* const rom = machine().region("pcm")->base();
247   const UINT8* const rom = memregion("pcm")->base();
248248
249249   // only Ninja Kid II uses this
250250   if (rom)
251251   {
252      const int length = machine().region("pcm")->bytes();
252      const int length = memregion("pcm")->bytes();
253253
254254      const int start = data << 8;
255255
r14976r14977
14251425
14261426static void lineswap_gfx_roms(running_machine &machine, const char *region, const int bit)
14271427{
1428   const int length = machine.region(region)->bytes();
1428   const int length = machine.root_device().memregion(region)->bytes();
14291429
1430   UINT8* const src = machine.region(region)->base();
1430   UINT8* const src = machine.root_device().memregion(region)->base();
14311431
14321432   UINT8* const temp = auto_alloc_array(machine, UINT8, length);
14331433
r14976r14977
14721472static DRIVER_INIT( bootleg )
14731473{
14741474   address_space *space = machine.device("soundcpu")->memory().space(AS_PROGRAM);
1475   space->set_decrypted_region(0x0000, 0x7fff, machine.region("soundcpu")->base() + 0x10000);
1475   space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("soundcpu")->base() + 0x10000);
14761476
14771477   gfx_unscramble(machine);
14781478}
src/mame/drivers/mjsister.c
r14976r14977
166166static TIMER_CALLBACK( dac_callback )
167167{
168168   mjsister_state *state = machine.driver_data<mjsister_state>();
169   UINT8 *DACROM = machine.region("samples")->base();
169   UINT8 *DACROM = state->memregion("samples")->base();
170170
171171   dac_data_w(state->m_dac, DACROM[(state->m_dac_bank * 0x10000 + state->m_dac_adr++) & 0x1ffff]);
172172
r14976r14977
224224   if (tmp != m_colorbank)
225225      m_screen_redraw = 1;
226226
227   memory_set_bank(machine(), "bank1", m_rombank0 * 2 + m_rombank1);
227   membank("bank1")->set_entry(m_rombank0 * 2 + m_rombank1);
228228}
229229
230230WRITE8_MEMBER(mjsister_state::mjsister_banksel2_w)
r14976r14977
242242         logerror("%04x p31_w:%02x\n", cpu_get_pc(&space.device()), data);
243243   }
244244
245   memory_set_bank(machine(), "bank1", m_rombank0 * 2 + m_rombank1);
245   membank("bank1")->set_entry(m_rombank0 * 2 + m_rombank1);
246246}
247247
248248WRITE8_MEMBER(mjsister_state::mjsister_input_sel1_w)
r14976r14977
449449static MACHINE_START( mjsister )
450450{
451451   mjsister_state *state = machine.driver_data<mjsister_state>();
452   UINT8 *ROM = machine.region("maincpu")->base();
452   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
453453
454   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x8000);
454   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x8000);
455455
456456   state->m_maincpu = machine.device("maincpu");
457457   state->m_dac = machine.device("dac");
src/mame/drivers/yunsung8.c
r14976r14977
4949
5050   m_layers_ctrl = data & 0x30;   // Layers enable
5151
52   memory_set_bank(machine(), "bank1", data & 0x07);
52   membank("bank1")->set_entry(data & 0x07);
5353
5454   if (data & ~0x37)
5555      logerror("CPU #0 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
r14976r14977
9898{
9999   msm5205_reset_w(device, data & 0x20);
100100
101   memory_set_bank(device->machine(), "bank2", data & 0x07);
101   device->machine().root_device().membank("bank2")->set_entry(data & 0x07);
102102
103103   if (data != (data & (~0x27)))
104104      logerror("%s: Bank %02X\n", device->machine().describe_context(), data);
r14976r14977
466466static MACHINE_START( yunsung8 )
467467{
468468   yunsung8_state *state = machine.driver_data<yunsung8_state>();
469   UINT8 *MAIN = machine.region("maincpu")->base();
470   UINT8 *AUDIO = machine.region("audiocpu")->base();
469   UINT8 *MAIN = machine.root_device().memregion("maincpu")->base();
470   UINT8 *AUDIO = machine.root_device().memregion("audiocpu")->base();
471471
472472   state->m_videoram_0 = state->m_videoram + 0x0000;   // Ram is banked
473473   state->m_videoram_1 = state->m_videoram + 0x2000;
474474
475   memory_configure_bank(machine, "bank1", 0, 3, &MAIN[0x00000], 0x4000);
476   memory_configure_bank(machine, "bank1", 3, 5, &MAIN[0x10000], 0x4000);
477   memory_configure_bank(machine, "bank2", 0, 3, &AUDIO[0x00000], 0x4000);
478   memory_configure_bank(machine, "bank2", 3, 5, &AUDIO[0x10000], 0x4000);
475   state->membank("bank1")->configure_entries(0, 3, &MAIN[0x00000], 0x4000);
476   state->membank("bank1")->configure_entries(3, 5, &MAIN[0x10000], 0x4000);
477   state->membank("bank2")->configure_entries(0, 3, &AUDIO[0x00000], 0x4000);
478   state->membank("bank2")->configure_entries(3, 5, &AUDIO[0x10000], 0x4000);
479479
480480   state->m_audiocpu = machine.device("audiocpu");
481481
src/mame/drivers/wheelfir.c
r14976r14977
378378      cputag_set_input_line(machine(), "maincpu", 1, HOLD_LINE);
379379
380380      {
381         UINT8 *rom = machine().region("gfx1")->base();
381         UINT8 *rom = memregion("gfx1")->base();
382382
383383         int width = machine().primary_screen->width();
384384         int height = machine().primary_screen->height();
r14976r14977
788788      state->m_zoom_table[i]=-1;
789789   }
790790
791   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
791   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
792792
793793   for(int j=0;j<400;++j)
794794   {
r14976r14977
870870
871871static DRIVER_INIT(wheelfir)
872872{
873   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
873   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
874874   RAM[0xdd3da/2] = 0x4e71; //hack
875875}
876876
src/mame/drivers/jaguar.c
r14976r14977
491491static MACHINE_RESET( cojag )
492492{
493493   cojag_state *state = machine.driver_data<cojag_state>();
494   UINT8 *rom = machine.region("user2")->base();
494   UINT8 *rom = state->memregion("user2")->base();
495495
496496   /* 68020 only: copy the interrupt vectors into RAM */
497497   if (!cojag_is_r3000)
r14976r14977
503503      /* graphics banks */
504504      if (cojag_is_r3000)
505505      {
506         memory_configure_bank(machine, "bank1", 0, 2, rom + 0x800000, 0x400000);
507         memory_set_bank(machine, "bank1", 0);
506         state->membank("bank1")->configure_entries(0, 2, rom + 0x800000, 0x400000);
507         state->membank("bank1")->set_entry(0);
508508      }
509      memory_configure_bank(machine, "bank8", 0, 2, rom + 0x800000, 0x400000);
510      memory_set_bank(machine, "bank8", 0);
509      state->membank("bank8")->configure_entries(0, 2, rom + 0x800000, 0x400000);
510      state->membank("bank8")->set_entry(0);
511511
512512      /* sound banks */
513      memory_configure_bank(machine, "bank2", 0, 8, rom + 0x000000, 0x200000);
514      memory_configure_bank(machine, "bank9", 0, 8, rom + 0x000000, 0x200000);
515      memory_set_bank(machine, "bank2", 0);
516      memory_set_bank(machine, "bank9", 0);
513      state->membank("bank2")->configure_entries(0, 8, rom + 0x000000, 0x200000);
514      state->membank("bank9")->configure_entries(0, 8, rom + 0x000000, 0x200000);
515      state->membank("bank2")->set_entry(0);
516      state->membank("bank9")->set_entry(0);
517517   }
518518
519519   /* clear any spinuntil stuff */
r14976r14977
719719   }
720720
721721   /* adjust banking */
722   if (machine().region("user2")->base())
722   if (machine().root_device().memregion("user2")->base())
723723   {
724      memory_set_bank(machine(), "bank2", (data >> 1) & 7);
725      memory_set_bank(machine(), "bank9", (data >> 1) & 7);
724      membank("bank2")->set_entry((data >> 1) & 7);
725      membank("bank9")->set_entry((data >> 1) & 7);
726726   }
727727
728728   COMBINE_DATA(&m_misc_control_data);
r14976r14977
899899   logerror("%08X:latch_w(%X)\n", cpu_get_previouspc(&space.device()), data);
900900
901901   /* adjust banking */
902   if (machine().region("user2")->base())
902   if (machine().root_device().memregion("user2")->base())
903903   {
904904      if (cojag_is_r3000)
905         memory_set_bank(machine(), "bank1", data & 1);
906      memory_set_bank(machine(), "bank8", data & 1);
905         membank("bank1")->set_entry(data & 1);
906      membank("bank8")->set_entry(data & 1);
907907   }
908908}
909909
r14976r14977
18311831
18321832static void jaguar_fix_endian( running_machine &machine, UINT32 addr, UINT32 size )
18331833{
1834   UINT8 j[4], *RAM = machine.region("maincpu")->base();
1834   UINT8 j[4], *RAM = machine.root_device().memregion("maincpu")->base();
18351835   UINT32 i;
18361836   size += addr;
18371837   logerror("File Loaded to address range %X to %X\n",addr,size-1);
r14976r14977
18711871   memset(jaguar_shared_ram, 0, 0x200000);
18721872   quickload_size = MIN(quickload_size, 0x200000 - quickload_begin);
18731873
1874   image.fread( &image.device().machine().region("maincpu")->base()[quickload_begin], quickload_size);
1874   image.fread( &image.device().machine().root_device().memregion("maincpu")->base()[quickload_begin], quickload_size);
18751875
18761876   jaguar_fix_endian(image.device().machine(), quickload_begin, quickload_size);
18771877
r14976r14977
19161916   {
19171917      memset(jaguar_shared_ram, 0, 0x200000);
19181918      image.fseek(0, SEEK_SET);
1919      image.fread( &image.device().machine().region("maincpu")->base()[start-skip], quickload_size);
1919      image.fread( &image.device().machine().root_device().memregion("maincpu")->base()[start-skip], quickload_size);
19201920      quickload_begin = start;
19211921      jaguar_fix_endian(image.device().machine(), (start-skip)&0xfffffc, quickload_size);
19221922   }
r14976r14977
19551955      }
19561956
19571957      /* Load cart into memory */
1958      image.fread( &image.device().machine().region("maincpu")->base()[0x800000+load_offset], size);
1958      image.fread( &image.device().machine().root_device().memregion("maincpu")->base()[0x800000+load_offset], size);
19591959   }
19601960   else
19611961   {
src/mame/drivers/onetwo.c
r14976r14977
120120
121121WRITE8_MEMBER(onetwo_state::onetwo_cpubank_w)
122122{
123   memory_set_bank(machine(), "bank1", data);
123   membank("bank1")->set_entry(data);
124124}
125125
126126WRITE8_MEMBER(onetwo_state::onetwo_coin_counters_w)
r14976r14977
348348static MACHINE_START( onetwo )
349349{
350350   onetwo_state *state = machine.driver_data<onetwo_state>();
351   UINT8 *ROM = machine.region("maincpu")->base();
351   UINT8 *ROM = state->memregion("maincpu")->base();
352352
353   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
353   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
354354
355355   state->m_maincpu = machine.device("maincpu");
356356   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/gng.c
r14976r14977
3030WRITE8_MEMBER(gng_state::gng_bankswitch_w)
3131{
3232   if (data == 4)
33      memory_set_bank(machine(), "bank1", 4);
33      membank("bank1")->set_entry(4);
3434   else
35      memory_set_bank(machine(), "bank1", (data & 0x03));
35      membank("bank1")->set_entry((data & 0x03));
3636}
3737
3838WRITE8_MEMBER(gng_state::gng_coin_counter_w)
r14976r14977
304304{
305305   gng_state *state = machine.driver_data<gng_state>();
306306
307   UINT8 *rombase = machine.region("maincpu")->base();
308   memory_configure_bank(machine, "bank1", 0, 4, &rombase[0x10000], 0x2000);
309   memory_configure_bank(machine, "bank1", 4, 1, &rombase[0x4000], 0x2000);
307   UINT8 *rombase = state->memregion("maincpu")->base();
308   state->membank("bank1")->configure_entries(0, 4, &rombase[0x10000], 0x2000);
309   state->membank("bank1")->configure_entry(4, &rombase[0x4000]);
310310
311311   state->save_item(NAME(state->m_scrollx));
312312   state->save_item(NAME(state->m_scrolly));
src/mame/drivers/nbmj8891.c
r14976r14977
6161
6262static DRIVER_INIT( gionbana )
6363{
64   UINT8 *prot = machine.region("protection")->base();
64   UINT8 *prot = machine.root_device().memregion("protection")->base();
6565   int i;
6666
6767   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
8585static DRIVER_INIT( omotesnd )
8686{
8787#if 0
88   UINT8 *prot = machine.region("protection")->base();
88   UINT8 *prot = machine.root_device().memregion("protection")->base();
8989   int i;
9090
9191   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
100100#endif
101101
102102#if 1
103   UINT8 *ROM = machine.region("maincpu")->base();
103   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
104104
105105   // Protection ROM check skip
106106   ROM[0x0106] = 0x00;
r14976r14977
135135
136136static DRIVER_INIT( telmahjn )
137137{
138   UINT8 *prot = machine.region("protection")->base();
138   UINT8 *prot = machine.root_device().memregion("protection")->base();
139139   int i;
140140
141141   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
153153
154154static DRIVER_INIT( mgmen89 )
155155{
156   UINT8 *prot = machine.region("protection")->base();
156   UINT8 *prot = machine.root_device().memregion("protection")->base();
157157   int i;
158158
159159   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
171171
172172static DRIVER_INIT( mjfocus )
173173{
174   UINT8 *prot = machine.region("protection")->base();
175   UINT8 *ram = machine.region("maincpu")->base() + 0xf800;
174   UINT8 *prot = machine.root_device().memregion("protection")->base();
175   UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0xf800;
176176   int i;
177177
178178   /* need to clear RAM otherwise it doesn't boot... */
r14976r14977
194194static DRIVER_INIT( mjfocusm )
195195{
196196#if 1
197   UINT8 *ROM = machine.region("maincpu")->base();
197   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
198198
199199   // Protection ROM check skip
200200   ROM[0x014e] = 0x00;
r14976r14977
206206
207207static DRIVER_INIT( scandal )
208208{
209   UINT8 *ROM = machine.region("maincpu")->base();
209   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
210210   int i;
211211
212212   for (i = 0xf800; i < 0x10000; i++) ROM[i] = 0x00;
r14976r14977
223223{
224224   /* they forgot to enable the protection check in this game... */
225225#if 0
226   UINT8 *prot = machine.region("protection")->base();
226   UINT8 *prot = machine.root_device().memregion("protection")->base();
227227   int i;
228228
229   machine.region("maincpu")->base()[0x003d] = 0x01;   // force the protection check to be executed
229   machine.root_device().memregion("maincpu")->base()[0x003d] = 0x01;   // force the protection check to be executed
230230
231231   /* this is one possible way to rearrange the protection ROM data to get the
232232       expected 0xfe1a checksum. It's probably completely wrong! But since the
r14976r14977
284284
285285static DRIVER_INIT( pairsnb )
286286{
287   UINT8 *prot = machine.region("protection")->base();
287   UINT8 *prot = machine.root_device().memregion("protection")->base();
288288   int i;
289289
290290   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
302302
303303static DRIVER_INIT( pairsten )
304304{
305   UINT8 *prot = machine.region("protection")->base();
305   UINT8 *prot = machine.root_device().memregion("protection")->base();
306306   int i;
307307
308308   /* this is one possible way to rearrange the protection ROM data to get the
src/mame/drivers/wc90b.c
r14976r14977
9999WRITE8_MEMBER(wc90b_state::wc90b_bankswitch_w)
100100{
101101   int bankaddress;
102   UINT8 *ROM = machine().region("maincpu")->base();
102   UINT8 *ROM = memregion("maincpu")->base();
103103
104104   bankaddress = 0x10000 + ((data & 0xf8) << 8);
105   memory_set_bankptr(machine(), "bank1",&ROM[bankaddress]);
105   membank("bank1")->set_base(&ROM[bankaddress]);
106106}
107107
108108WRITE8_MEMBER(wc90b_state::wc90b_bankswitch1_w)
109109{
110110   int bankaddress;
111   UINT8 *ROM = machine().region("sub")->base();
111   UINT8 *ROM = memregion("sub")->base();
112112
113113   bankaddress = 0x10000 + ((data & 0xf8) << 8);
114   memory_set_bankptr(machine(), "bank2",&ROM[bankaddress]);
114   membank("bank2")->set_base(&ROM[bankaddress]);
115115}
116116
117117WRITE8_MEMBER(wc90b_state::wc90b_sound_command_w)
r14976r14977
123123static WRITE8_DEVICE_HANDLER( adpcm_control_w )
124124{
125125   int bankaddress;
126   UINT8 *ROM = device->machine().region("audiocpu")->base();
126   UINT8 *ROM = device->machine().root_device().memregion("audiocpu")->base();
127127
128128   /* the code writes either 2 or 3 in the bottom two bits */
129129   bankaddress = 0x10000 + (data & 0x01) * 0x4000;
130   memory_set_bankptr(device->machine(), "bank3",&ROM[bankaddress]);
130   device->machine().root_device().membank("bank3")->set_base(&ROM[bankaddress]);
131131
132132   msm5205_reset_w(device,data & 0x08);
133133}
src/mame/drivers/liberate.c
r14976r14977
2727
2828READ8_MEMBER(liberate_state::deco16_bank_r)
2929{
30   const UINT8 *ROM = machine().region("user1")->base();
30   const UINT8 *ROM = memregion("user1")->base();
3131
3232   /* The tilemap bank can be swapped into main memory */
3333   if (m_bank)
r14976r14977
7676
7777READ8_MEMBER(liberate_state::prosoccr_bank_r)
7878{
79   const UINT8 *ROM = machine().region("user1")->base();
79   const UINT8 *ROM = memregion("user1")->base();
8080
8181   /* The tilemap bank can be swapped into main memory */
8282   if (m_bank)
r14976r14977
105105
106106READ8_MEMBER(liberate_state::prosoccr_charram_r)
107107{
108   UINT8 *SRC_GFX = machine().region("shared_gfx")->base();
108   UINT8 *SRC_GFX = memregion("shared_gfx")->base();
109109
110110   if (m_gfx_rom_readback)
111111   {
r14976r14977
126126
127127WRITE8_MEMBER(liberate_state::prosoccr_charram_w)
128128{
129   UINT8 *FG_GFX = machine().region("fg_gfx")->base();
129   UINT8 *FG_GFX = memregion("fg_gfx")->base();
130130
131131   if (m_bank)
132132   {
r14976r14977
182182
183183READ8_MEMBER(liberate_state::prosport_charram_r)
184184{
185   UINT8 *FG_GFX = machine().region("progolf_fg_gfx")->base();
185   UINT8 *FG_GFX = memregion("progolf_fg_gfx")->base();
186186
187187   switch (offset & 0x1800)
188188   {
r14976r14977
202202
203203WRITE8_MEMBER(liberate_state::prosport_charram_w)
204204{
205   UINT8 *FG_GFX = machine().region("progolf_fg_gfx")->base();
205   UINT8 *FG_GFX = memregion("progolf_fg_gfx")->base();
206206
207207   switch (offset & 0x1800)
208208   {
r14976r14977
13501350{
13511351   address_space *space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
13521352   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
1353   UINT8 *rom = machine.region("audiocpu")->base();
1353   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
13541354   int i;
13551355
13561356   /* Bit swapping on sound cpu - Opcodes only */
r14976r14977
13621362
13631363static DRIVER_INIT( prosport )
13641364{
1365   UINT8 *RAM = machine.region("maincpu")->base();
1365   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
13661366   int i;
13671367
13681368   /* Main cpu has the nibbles swapped */
r14976r14977
13841384   int A;
13851385   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
13861386   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000);
1387   UINT8 *ROM = machine.region("maincpu")->base();
1387   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
13881388
13891389   space->set_decrypted_region(0x0000, 0xffff, decrypted);
13901390
r14976r14977
13951395      decrypted[A] = (decrypted[A] & 0x7d) | ((decrypted[A] & 0x02) << 6) | ((decrypted[A] & 0x80) >> 6);
13961396   }
13971397
1398   memory_configure_bank_decrypted(machine, "bank1", 0, 1, decrypted + 0x8000, 0x10);
1398   machine.root_device().membank("bank1")->configure_decrypted_entry(0, decrypted + 0x8000);
13991399
14001400   sound_cpu_decrypt(machine);
14011401}
src/mame/drivers/gunsmoke.c
r14976r14977
274274static MACHINE_START( gunsmoke )
275275{
276276   gunsmoke_state *state = machine.driver_data<gunsmoke_state>();
277   UINT8 *rombase = machine.region("maincpu")->base();
277   UINT8 *rombase = state->memregion("maincpu")->base();
278278
279   memory_configure_bank(machine, "bank1", 0, 4, &rombase[0x10000], 0x4000);
279   state->membank("bank1")->configure_entries(0, 4, &rombase[0x10000], 0x4000);
280280
281281   state->save_item(NAME(state->m_chon));
282282   state->save_item(NAME(state->m_objon));
src/mame/drivers/seta.c
r14976r14977
29752975
29762976WRITE8_MEMBER(seta_state::sub_bankswitch_w)
29772977{
2978   UINT8 *rom = machine().region("sub")->base();
2978   UINT8 *rom = memregion("sub")->base();
29792979   int bank = data >> 4;
29802980
2981   memory_set_bankptr(machine(), "bank1", &rom[bank * 0x4000 + 0xc000]);
2981   membank("bank1")->set_base(&rom[bank * 0x4000 + 0xc000]);
29822982}
29832983
29842984WRITE8_MEMBER(seta_state::sub_bankswitch_lockout_w)
r14976r14977
1053310533
1053410534static DRIVER_INIT( metafox )
1053510535{
10536   UINT16 *RAM = (UINT16 *) machine.region("maincpu")->base();
10536   UINT16 *RAM = (UINT16 *) machine.root_device().memregion("maincpu")->base();
1053710537
1053810538   /* This game uses the 21c000-21ffff area for protection? */
1053910539//  machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x21c000, 0x21ffff);
r14976r14977
1055610556   rom_size = 0x80000;
1055710557   buf = auto_alloc_array(machine, UINT8, rom_size);
1055810558
10559   rom = machine.region("gfx2")->base() + 0x40000;
10559   rom = machine.root_device().memregion("gfx2")->base() + 0x40000;
1056010560
1056110561   for (rpos = 0; rpos < rom_size/2; rpos++) {
1056210562      buf[rpos+0x40000] = rom[rpos*2];
r14976r14977
1056510565
1056610566   memcpy( rom, buf, rom_size );
1056710567
10568   rom = machine.region("gfx3")->base() + 0x40000;
10568   rom = machine.root_device().memregion("gfx3")->base() + 0x40000;
1056910569
1057010570   for (rpos = 0; rpos < rom_size/2; rpos++) {
1057110571      buf[rpos+0x40000] = rom[rpos*2];
r14976r14977
1059410594
1059510595static DRIVER_INIT( kiwame )
1059610596{
10597   UINT16 *RAM = (UINT16 *) machine.region("maincpu")->base();
10597   UINT16 *RAM = (UINT16 *) machine.root_device().memregion("maincpu")->base();
1059810598
1059910599   /* WARNING: This game writes to the interrupt vector
1060010600       table. Lev 1 routine address is stored at $100 */
r14976r14977
1061610616   UINT8 temp[16];
1061710617   int i,j;
1061810618
10619   src = machine.region("maincpu")->base();
10620   len = machine.region("maincpu")->bytes();
10619   src = machine.root_device().memregion("maincpu")->base();
10620   len = machine.root_device().memregion("maincpu")->bytes();
1062110621   for (i = 0;i < len;i += 16)
1062210622   {
1062310623      memcpy(temp,&src[i],16);
r14976r14977
1064710647static DRIVER_INIT( crazyfgt )
1064810648{
1064910649   //seta_state *state = machine.driver_data<seta_state>();
10650   UINT16 *RAM = (UINT16 *) machine.region("maincpu")->base();
10650   UINT16 *RAM = (UINT16 *) machine.root_device().memregion("maincpu")->base();
1065110651
1065210652   // protection check at boot
1065310653   RAM[0x1078/2] = 0x4e71;
r14976r14977
1066610666static DRIVER_INIT( inttoote )
1066710667{
1066810668   //seta_state *state = machine.driver_data<seta_state>();
10669   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
10669   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
1067010670
1067110671   // missing / unused video regs
1067210672   seta_state *state = machine.driver_data<seta_state>();
r14976r14977
1068210682static DRIVER_INIT( inttootea )
1068310683{
1068410684   //seta_state *state = machine.driver_data<seta_state>();
10685   //UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
10685   //UINT16 *ROM = (UINT16 *)state->memregion( "maincpu" )->base();
1068610686
1068710687   // missing / unused video regs
1068810688   seta_state *state = machine.driver_data<seta_state>();
src/mame/drivers/vball.c
r14976r14977
157157*/
158158WRITE8_MEMBER(vball_state::vb_bankswitch_w)
159159{
160   UINT8 *RAM = machine().region("maincpu")->base();
161   memory_set_bankptr(machine(), "bank1", &RAM[0x10000 + (0x4000 * (data & 1))]);
160   UINT8 *RAM = memregion("maincpu")->base();
161   membank("bank1")->set_base(&RAM[0x10000 + (0x4000 * (data & 1))]);
162162
163163   if (m_gfxset != ((data  & 0x20) ^ 0x20))
164164   {
src/mame/drivers/naomi.c
r14976r14977
73887388
73897389static DRIVER_INIT( atomiswave )
73907390{
7391   UINT64 *ROM = (UINT64 *)machine.region("awflash")->base();
7391   UINT64 *ROM = (UINT64 *)machine.root_device().memregion("awflash")->base();
73927392
73937393   // patch out long startup delay
73947394   ROM[0x98e/8] = (ROM[0x98e/8] & U64(0xffffffffffff)) | (UINT64)0x0009<<48;
src/mame/drivers/stv.c
r14976r14977
401401
402402   /* Program ROM patches, don't understand how to avoid these two checks ... */
403403   {
404      UINT32 *ROM = (UINT32 *)machine.region("game0")->base();
404      UINT32 *ROM = (UINT32 *)state->memregion("game0")->base();
405405
406406      ROM[0x90054/4] = 0x00e00001; // END error
407407
r14976r14977
10981098
10991099static DRIVER_INIT( sanjeon )
11001100{
1101   UINT8 *src    = machine.region       ( "game0" )->base();
1101   UINT8 *src    = machine.root_device().memregion       ( "game0" )->base();
11021102   int x;
11031103
11041104   for (x=0;x<0x3000000;x++)
src/mame/drivers/queen.c
r14976r14977
141141      case 0x59: // PAM0
142142      {
143143         if (data & 0x10)      // enable RAM access to region 0xf0000 - 0xfffff
144            memory_set_bankptr(busdevice->machine(), "bios_bank", state->m_bios_ram);
144            state->membank("bios_bank")->set_base(state->m_bios_ram);
145145         else               // disable RAM access (reads go to BIOS ROM)
146            memory_set_bankptr(busdevice->machine(), "bios_bank", busdevice->machine().region("bios")->base() + 0x10000);
146            state->membank("bios_bank")->set_base(state->memregion("bios")->base() + 0x10000);
147147         break;
148148      }
149149      case 0x5a: // PAM1
150150      {
151151         if (data & 0x1)
152            memory_set_bankptr(busdevice->machine(), "video_bank1", state->m_isa_ram1);
152            state->membank("video_bank1")->set_base(state->m_isa_ram1);
153153         else
154            memory_set_bankptr(busdevice->machine(), "video_bank1", busdevice->machine().region("video_bios")->base() + 0);
154            state->membank("video_bank1")->set_base(state->memregion("video_bios")->base() + 0);
155155
156156         if (data & 0x10)
157            memory_set_bankptr(busdevice->machine(), "video_bank2", state->m_isa_ram2);
157            state->membank("video_bank2")->set_base(state->m_isa_ram2);
158158         else
159            memory_set_bankptr(busdevice->machine(), "video_bank2", busdevice->machine().region("video_bios")->base() + 0x4000);
159            state->membank("video_bank2")->set_base(state->memregion("video_bios")->base() + 0x4000);
160160
161161         break;
162162      }
163163      case 0x5e: // PAM5
164164      {
165165         if (data & 0x1)
166            memory_set_bankptr(busdevice->machine(), "bios_ext1", state->m_bios_ext1_ram);
166            state->membank("bios_ext1")->set_base(state->m_bios_ext1_ram);
167167         else
168            memory_set_bankptr(busdevice->machine(), "bios_ext1", busdevice->machine().region("bios")->base() + 0);
168            state->membank("bios_ext1")->set_base(state->memregion("bios")->base() + 0);
169169
170170         if (data & 0x10)
171            memory_set_bankptr(busdevice->machine(), "bios_ext2", state->m_bios_ext2_ram);
171            state->membank("bios_ext2")->set_base(state->m_bios_ext2_ram);
172172         else
173            memory_set_bankptr(busdevice->machine(), "bios_ext2", busdevice->machine().region("bios")->base() + 0x4000);
173            state->membank("bios_ext2")->set_base(state->memregion("bios")->base() + 0x4000);
174174
175175         break;
176176      }
177177      case 0x5f: // PAM6
178178      {
179179         if (data & 0x1)
180            memory_set_bankptr(busdevice->machine(), "bios_ext3", state->m_bios_ext3_ram);
180            state->membank("bios_ext3")->set_base(state->m_bios_ext3_ram);
181181         else
182            memory_set_bankptr(busdevice->machine(), "bios_ext3", busdevice->machine().region("bios")->base() + 0x8000);
182            state->membank("bios_ext3")->set_base(state->memregion("bios")->base() + 0x8000);
183183
184184         if (data & 0x10)
185            memory_set_bankptr(busdevice->machine(), "bios_ext4", state->m_bios_ext4_ram);
185            state->membank("bios_ext4")->set_base(state->m_bios_ext4_ram);
186186         else
187            memory_set_bankptr(busdevice->machine(), "bios_ext4", busdevice->machine().region("bios")->base() + 0xc000);
187            state->membank("bios_ext4")->set_base(state->memregion("bios")->base() + 0xc000);
188188
189189         break;
190190      }
r14976r14977
658658
659659static MACHINE_RESET( queen )
660660{
661   memory_set_bankptr(machine, "bios_bank", machine.region("bios")->base() + 0x30000);
662   memory_set_bankptr(machine, "bios_ext1", machine.region("bios")->base() + 0x20000);
663   memory_set_bankptr(machine, "bios_ext2", machine.region("bios")->base() + 0x24000);
664   memory_set_bankptr(machine, "bios_ext3", machine.region("bios")->base() + 0x28000);
665   memory_set_bankptr(machine, "bios_ext4", machine.region("bios")->base() + 0x2c000);
666   memory_set_bankptr(machine, "video_bank1", machine.region("video_bios")->base() + 0);
667   memory_set_bankptr(machine, "video_bank2", machine.region("video_bios")->base() + 0x4000);
661   machine.root_device().membank("bios_bank")->set_base(machine.root_device().memregion("bios")->base() + 0x30000);
662   machine.root_device().membank("bios_ext1")->set_base(machine.root_device().memregion("bios")->base() + 0x20000);
663   machine.root_device().membank("bios_ext2")->set_base(machine.root_device().memregion("bios")->base() + 0x24000);
664   machine.root_device().membank("bios_ext3")->set_base(machine.root_device().memregion("bios")->base() + 0x28000);
665   machine.root_device().membank("bios_ext4")->set_base(machine.root_device().memregion("bios")->base() + 0x2c000);
666   machine.root_device().membank("video_bank1")->set_base(machine.root_device().memregion("video_bios")->base() + 0);
667   machine.root_device().membank("video_bank2")->set_base(machine.root_device().memregion("video_bios")->base() + 0x4000);
668668}
669669
670670
src/mame/drivers/megatech.c
r14976r14977
222222   UINT8* game_region;
223223
224224   sprintf(tempname, "game%d", param);
225   game_region = machine.region(tempname)->base();
225   game_region = machine.root_device().memregion(tempname)->base();
226226
227   memcpy(machine.region("maincpu")->base(), game_region, 0x400000);
227   memcpy(state->memregion("maincpu")->base(), game_region, 0x400000);
228228
229229   if (!state->m_cart_is_genesis[param])
230230   {
r14976r14977
252252   printf("megatech_select_game %d\n", param+1);
253253
254254   sprintf(tempname, "game%d", param);
255   game_region = machine.region(tempname)->base();
255   game_region = machine.root_device().memregion(tempname)->base();
256256
257257   cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, ASSERT_LINE);
258258   cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_RESET, ASSERT_LINE);
r14976r14977
274274   else
275275   {
276276      /* no cart.. */
277      memset(machine.region("mtbios")->base() + 0x8000, 0x00, 0x8000);
278      memset(machine.region("maincpu")->base(), 0x00, 0x400000);
277      memset(machine.root_device().memregion("mtbios")->base() + 0x8000, 0x00, 0x8000);
278      memset(machine.root_device().memregion("maincpu")->base(), 0x00, 0x400000);
279279   }
280280
281281   return;
r14976r14977
436436static DRIVER_INIT(mt_crt)
437437{
438438   mtech_state *state = machine.driver_data<mtech_state>();
439   UINT8* pin = machine.region("sms_pin")->base();
439   UINT8* pin = state->memregion("sms_pin")->base();
440440   DRIVER_INIT_CALL(mt_slot);
441441
442442   state->m_cart_is_genesis[0] = !pin[0] ? 1 : 0;;
r14976r14977
556556      return IMAGE_INIT_FAIL;
557557
558558   //printf("load list\n");
559   UINT8 *ROM = image.device().machine().region(this_cart->region)->base();
559   UINT8 *ROM = image.device().machine().root_device().memregion(this_cart->region)->base();
560560   //printf("load list2\n");
561561   UINT32 length = image.get_software_region_length("rom");
562562   memcpy(ROM, image.get_software_region("rom"), length);
src/mame/drivers/champbwl.c
r14976r14977
194194   coin_lockout_w(machine(), 0, ~data & 8);
195195   coin_lockout_w(machine(), 1, ~data & 4);
196196
197   memory_set_bank(machine(), "bank1", (data & 0x30) >> 4);
197   membank("bank1")->set_entry((data & 0x30) >> 4);
198198}
199199
200200static ADDRESS_MAP_START( champbwl_map, AS_PROGRAM, 8, champbwl_state )
r14976r14977
231231   coin_lockout_w(machine(), 0, ~data & 8);   // coin lockout
232232   machine().device<ticket_dispenser_device>("hopper")->write(*&space, 0, (data & 0x04) ? 0x00 : 0x80);   // gift out motor
233233
234   memory_set_bank(machine(), "bank1", (data & 0x30) >> 4);
234   membank("bank1")->set_entry((data & 0x30) >> 4);
235235
236236//  popmessage("%02x", data);
237237}
r14976r14977
430430static MACHINE_START( champbwl )
431431{
432432   champbwl_state *state = machine.driver_data<champbwl_state>();
433   UINT8 *ROM = machine.region("maincpu")->base();
433   UINT8 *ROM = state->memregion("maincpu")->base();
434434
435435   state->m_mcu = NULL;
436436
437   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
437   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
438438
439439   state->save_item(NAME(state->m_screenflip));
440440   state->save_item(NAME(state->m_last_trackball_val));
r14976r14977
530530
531531static MACHINE_START( doraemon )
532532{
533   UINT8 *ROM = machine.region("maincpu")->base();
534   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
533   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
534   machine.root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
535535}
536536
537537static MACHINE_CONFIG_START( doraemon, tnzs_state )
src/mame/drivers/1942.c
r14976r14977
7171
7272WRITE8_MEMBER(_1942_state::c1942_bankswitch_w)
7373{
74   memory_set_bank(machine(), "bank1", data & 0x03);
74   membank("bank1")->set_entry(data & 0x03);
7575}
7676
7777static TIMER_DEVICE_CALLBACK( c1942_scanline )
r14976r14977
505505
506506static DRIVER_INIT( 1942 )
507507{
508   UINT8 *ROM = machine.region("maincpu")->base();
509   memory_configure_bank(machine, "bank1", 0, 3, &ROM[0x10000], 0x4000);
508   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
509   machine.root_device().membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x4000);
510510}
511511
512512
src/mame/drivers/poolshrk.c
r14976r14977
1414
1515static DRIVER_INIT( poolshrk )
1616{
17   UINT8* pSprite = machine.region("gfx1")->base();
18   UINT8* pOffset = machine.region("proms")->base();
17   UINT8* pSprite = machine.root_device().memregion("gfx1")->base();
18   UINT8* pOffset = machine.root_device().memregion("proms")->base();
1919
2020   int i;
2121   int j;
src/mame/drivers/mayumi.c
r14976r14977
9696{
9797   int bank = BIT(data, 7) | (BIT(data, 6) << 1);
9898
99   memory_set_bank(machine(), "bank1", bank);
99   membank("bank1")->set_entry(bank);
100100
101101   m_int_enable = data & 1;
102102
r14976r14977
351351static MACHINE_START( mayumi )
352352{
353353   mayumi_state *state = machine.driver_data<mayumi_state>();
354   UINT8 *ROM = machine.region("maincpu")->base();
354   UINT8 *ROM = state->memregion("maincpu")->base();
355355
356   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
357   memory_set_bank(machine, "bank1", 0);
356   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
357   state->membank("bank1")->set_entry(0);
358358
359359   state->save_item(NAME(state->m_int_enable));
360360   state->save_item(NAME(state->m_input_sel));
src/mame/drivers/raiden.c
r14976r14977
548548static void common_decrypt(running_machine &machine)
549549{
550550
551   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
551   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
552552   int i;
553553
554554   for (i = 0; i < 0x20000; i++)
r14976r14977
560560      RAM[0xc0000/2 + i] = data;
561561   }
562562
563   RAM = (UINT16 *)machine.region("sub")->base();
563   RAM = (UINT16 *)machine.root_device().memregion("sub")->base();
564564
565565   for (i = 0; i < 0x20000; i++)
566566   {
src/mame/drivers/fromanc2.c
r14976r14977
159159WRITE8_MEMBER(fromanc2_state::fromanc2_subcpu_rombank_w)
160160{
161161   // Change ROM BANK
162   memory_set_bank(machine(), "bank1", data & 0x03);
162   membank("bank1")->set_entry(data & 0x03);
163163
164164   // Change RAM BANK
165   memory_set_bank(machine(), "bank2", (data & 0x0c) >> 2);
165   membank("bank2")->set_entry((data & 0x0c) >> 2);
166166}
167167
168168
r14976r14977
524524{
525525   fromanc2_state *state = machine.driver_data<fromanc2_state>();
526526
527   memory_configure_bank(machine, "bank1", 0, 4, machine.region("sub")->base(), 0x4000);
528   memory_configure_bank(machine, "bank2", 0, 1, machine.region("sub")->base() + 0x08000, 0x4000);
529   memory_configure_bank(machine, "bank2", 1, 3, machine.region("sub")->base() + 0x14000, 0x4000);
527   state->membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("sub")->base(), 0x4000);
528   state->membank("bank2")->configure_entry(0, machine.root_device().memregion("sub")->base() + 0x08000);
529   state->membank("bank2")->configure_entries(1, 3, state->memregion("sub")->base() + 0x14000, 0x4000);
530530
531531   MACHINE_START_CALL(fromanc4);
532532
src/mame/drivers/bnstars.c
r14976r14977
14871487   decrypt_ms32_tx(machine, 0x00020,0x7e, "gfx7");
14881488   decrypt_ms32_bg(machine, 0x00001,0x9b, "gfx6");
14891489
1490   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base());
1490   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());
14911491}
14921492
14931493GAME( 1997, bnstars1, 0,        bnstars, bnstars, bnstars, ROT0,   "Jaleco", "Vs. Janshi Brandnew Stars", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
src/mame/drivers/arcadia.c
r14976r14977
104104static WRITE8_DEVICE_HANDLER( arcadia_cia_0_porta_w )
105105{
106106   /* switch banks as appropriate */
107   memory_set_bank(device->machine(), "bank1", data & 1);
107   device->machine().root_device().membank("bank1")->set_entry(data & 1);
108108
109109   /* swap the write handlers between ROM and bank 1 based on the bit */
110110   if ((data & 1) == 0)
r14976r14977
757757
758758INLINE void generic_decode(running_machine &machine, const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0)
759759{
760   UINT16 *rom = (UINT16 *)machine.region(tag)->base();
760   UINT16 *rom = (UINT16 *)machine.root_device().memregion(tag)->base();
761761   int i;
762762
763763   /* only the low byte of ROMs are encrypted in these games */
r14976r14977
766766
767767   #if 0
768768   {
769      UINT8 *ROM = machine.region(tag)->base();
770      int size = machine.region(tag)->bytes();
769      UINT8 *ROM = machine.root_device().memregion(tag)->base();
770      int size = machine.root_device().memregion(tag)->bytes();
771771
772772      FILE *fp;
773773      char filename[256];
r14976r14977
808808   amiga_machine_config(machine, &arcadia_intf);
809809
810810   /* set up memory */
811   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
812   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
811   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
812   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
813813
814814   /* OnePlay bios is encrypted, TenPlay is not */
815   biosrom = (UINT16 *)machine.region("user2")->base();
815   biosrom = (UINT16 *)machine.root_device().memregion("user2")->base();
816816   if (biosrom[0] != 0x4afc)
817817      generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7);
818818}
src/mame/drivers/vmetal.c
r14976r14977
119119   /* game reads the cgrom, result is 7772, verified to be correct on the real board */
120120
121121
122   UINT8 *cgrom = machine().region("gfx1")->base();
122   UINT8 *cgrom = memregion("gfx1")->base();
123123   UINT16 retdat;
124124
125125   offset = offset << 1;
r14976r14977
423423static void expand_gfx1(running_machine &machine)
424424{
425425   metro_state *state = machine.driver_data<metro_state>();
426   UINT8 *base_gfx = machine.region("gfx1")->base();
427   UINT32 length = 2 * machine.region("gfx1")->bytes();
426   UINT8 *base_gfx = machine.root_device().memregion("gfx1")->base();
427   UINT32 length = 2 * state->memregion("gfx1")->bytes();
428428   state->m_expanded_gfx1 = auto_alloc_array(machine, UINT8, length);
429429   for (int i = 0; i < length; i += 2)
430430   {
src/mame/drivers/xain.c
r14976r14977
213213WRITE8_MEMBER(xain_state::xainCPUA_bankswitch_w)
214214{
215215   m_pri = data & 0x7;
216   memory_set_bank(machine(), "bank1", (data >> 3) & 1);
216   membank("bank1")->set_entry((data >> 3) & 1);
217217}
218218
219219WRITE8_MEMBER(xain_state::xainCPUB_bankswitch_w)
220220{
221   memory_set_bank(machine(), "bank2", data & 1);
221   membank("bank2")->set_entry(data & 1);
222222}
223223
224224WRITE8_MEMBER(xain_state::xain_sound_command_w)
r14976r14977
568568
569569static MACHINE_START( xsleena )
570570{
571   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x4000, 0xc000);
572   memory_configure_bank(machine, "bank2", 0, 2, machine.region("sub")->base()  + 0x4000, 0xc000);
573   memory_set_bank(machine, "bank1", 0);
574   memory_set_bank(machine, "bank2", 0);
571   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x4000, 0xc000);
572   machine.root_device().membank("bank2")->configure_entries(0, 2, machine.root_device().memregion("sub")->base()  + 0x4000, 0xc000);
573   machine.root_device().membank("bank1")->set_entry(0);
574   machine.root_device().membank("bank2")->set_entry(0);
575575}
576576
577577static MACHINE_CONFIG_START( xsleena, xain_state )
src/mame/drivers/mrdo.c
r14976r14977
3434/* if a read from this address doesn't return the value it expects. */
3535READ8_MEMBER(mrdo_state::mrdo_SECRE_r)
3636{
37   UINT8 *RAM = machine().region("maincpu")->base();
37   UINT8 *RAM = memregion("maincpu")->base();
3838   return RAM[cpu_get_reg(&space.device(), Z80_HL)];
3939}
4040
src/mame/drivers/gundealr.c
r14976r14977
5353
5454WRITE8_MEMBER(gundealr_state::yamyam_bankswitch_w)
5555{
56   memory_set_bank(machine(), "bank1", data & 0x07);
56   membank("bank1")->set_entry(data & 0x07);
5757}
5858
5959
r14976r14977
364364static MACHINE_START( gundealr )
365365{
366366   gundealr_state *state = machine.driver_data<gundealr_state>();
367   UINT8 *ROM = machine.region("maincpu")->base();
367   UINT8 *ROM = state->memregion("maincpu")->base();
368368
369   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
369   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
370370
371371   state->save_item(NAME(state->m_flipscreen));
372372   state->save_item(NAME(state->m_scroll));
src/mame/drivers/firefox.c
r14976r14977
433433
434434WRITE8_MEMBER(firefox_state::rom_bank_w)
435435{
436   memory_set_bank(machine(), "bank1", data & 0x1f);
436   membank("bank1")->set_entry(data & 0x1f);
437437}
438438
439439WRITE8_MEMBER(firefox_state::main_irq_clear_w)
r14976r14977
481481static MACHINE_START( firefox )
482482{
483483   firefox_state *state = machine.driver_data<firefox_state>();
484   memory_configure_bank(machine, "bank1", 0, 32, machine.region("maincpu")->base() + 0x10000, 0x1000);
484   state->membank("bank1")->configure_entries(0, 32, state->memregion("maincpu")->base() + 0x10000, 0x1000);
485485   state->m_nvram_1c = machine.device<x2212_device>("nvram_1c");
486486   state->m_nvram_1d = machine.device<x2212_device>("nvram_1d");
487487
src/mame/drivers/mainevt.c
r14976r14977
5757{
5858
5959   /* bit 0-1 ROM bank select */
60   memory_set_bank(machine(), "bank1", data & 0x03);
60   membank("bank1")->set_entry(data & 0x03);
6161
6262   /* TODO: bit 5 = select work RAM or palette? */
6363   //palette_selected = data & 0x20;
r14976r14977
412412static MACHINE_START( mainevt )
413413{
414414   mainevt_state *state = machine.driver_data<mainevt_state>();
415   UINT8 *ROM = machine.region("maincpu")->base();
415   UINT8 *ROM = state->memregion("maincpu")->base();
416416
417   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x2000);
417   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000);
418418
419419   state->m_maincpu = machine.device("maincpu");
420420   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/deco156.c
r14976r14977
613613
614614static void descramble_sound( running_machine &machine, const char *tag )
615615{
616   UINT8 *rom = machine.region(tag)->base();
617   int length = machine.region(tag)->bytes();
616   UINT8 *rom = machine.root_device().memregion(tag)->base();
617   int length = machine.root_device().memregion(tag)->bytes();
618618   UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
619619   UINT32 x;
620620
src/mame/drivers/toki.c
r14976r14977
7171static WRITE8_DEVICE_HANDLER( toki_adpcm_control_w )
7272{
7373   int bankaddress;
74   UINT8 *RAM = device->machine().region("audiocpu")->base();
74   UINT8 *RAM = device->machine().root_device().memregion("audiocpu")->base();
7575
7676
7777   /* the code writes either 2 or 3 in the bottom two bits */
7878   bankaddress = 0x10000 + (data & 0x01) * 0x4000;
79   memory_set_bankptr(device->machine(), "bank1",&RAM[bankaddress]);
79   device->machine().root_device().membank("bank1")->set_base(&RAM[bankaddress]);
8080
8181   msm5205_reset_w(device,data & 0x08);
8282}
r14976r14977
738738
739739static DRIVER_INIT( toki )
740740{
741   UINT8 *ROM = machine.region("oki")->base();
741   UINT8 *ROM = machine.root_device().memregion("oki")->base();
742742   UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000);
743743   int i;
744744
r14976r14977
761761   UINT8 *rom;
762762
763763   /* invert the sprite data in the ROMs */
764   len = machine.region("gfx2")->bytes();
765   rom = machine.region("gfx2")->base();
764   len = machine.root_device().memregion("gfx2")->bytes();
765   rom = machine.root_device().memregion("gfx2")->base();
766766   for (i = 0; i < len; i++)
767767      rom[i] ^= 0xff;
768768
769769   /* merge background tile graphics together */
770   len = machine.region("gfx3")->bytes();
771   rom = machine.region("gfx3")->base();
770   len = machine.root_device().memregion("gfx3")->bytes();
771   rom = machine.root_device().memregion("gfx3")->base();
772772   for (offs = 0; offs < len; offs += 0x20000)
773773   {
774774      UINT8 *base = &rom[offs];
r14976r14977
781781         memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800);
782782      }
783783   }
784   len = machine.region("gfx4")->bytes();
785   rom = machine.region("gfx4")->base();
784   len = machine.root_device().memregion("gfx4")->bytes();
785   rom = machine.root_device().memregion("gfx4")->base();
786786   for (offs = 0; offs < len; offs += 0x20000)
787787   {
788788      UINT8 *base = &rom[offs];
r14976r14977
804804   /* Program ROMs are bitswapped */
805805   {
806806      int i;
807      UINT16 *prgrom = (UINT16*)machine.region("maincpu")->base();
807      UINT16 *prgrom = (UINT16*)machine.root_device().memregion("maincpu")->base();
808808
809809      for (i = 0; i < 0x60000/2; i++)
810810      {
r14976r14977
819819   {
820820      address_space *space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
821821      UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x20000);
822      UINT8 *rom = machine.region("audiocpu")->base();
822      UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
823823      int i;
824824
825825      memcpy(decrypt,rom,0x20000);
r14976r14977
834834   }
835835
836836   {
837      UINT8 *ROM = machine.region("oki")->base();
837      UINT8 *ROM = machine.root_device().memregion("oki")->base();
838838      UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x20000);
839839      int i;
840840
src/mame/drivers/dwarfd.c
r14976r14977
12901290   UINT8 *src, *dst;
12911291
12921292   /* expand gfx roms */
1293   src = machine.region("gfx1")->base();
1294   dst = machine.region("gfx2")->base();
1293   src = machine.root_device().memregion("gfx1")->base();
1294   dst = state->memregion("gfx2")->base();
12951295
12961296   for (i = 0; i < 0x4000; i++)
12971297   {
r14976r14977
13041304   }
13051305
13061306   /* use low bit as 'interpolation' bit */
1307   src = machine.region("gfx2")->base();
1307   src = machine.root_device().memregion("gfx2")->base();
13081308   for (i = 0; i < 0x8000; i++)
13091309   {
13101310      if (src[i] & 0x10)
r14976r14977
13351335   DRIVER_INIT_CALL(dwarfd);
13361336
13371337   // hacks for program to proceed
1338   machine.region("maincpu")->base()[0x6564] = 0x00;
1339   machine.region("maincpu")->base()[0x6565] = 0x00;
1338   machine.root_device().memregion("maincpu")->base()[0x6564] = 0x00;
1339   machine.root_device().memregion("maincpu")->base()[0x6565] = 0x00;
13401340
1341   machine.region("maincpu")->base()[0x59b2] = 0x00;
1342   machine.region("maincpu")->base()[0x59b3] = 0x00;
1343   machine.region("maincpu")->base()[0x59b4] = 0x00;
1341   machine.root_device().memregion("maincpu")->base()[0x59b2] = 0x00;
1342   machine.root_device().memregion("maincpu")->base()[0x59b3] = 0x00;
1343   machine.root_device().memregion("maincpu")->base()[0x59b4] = 0x00;
13441344
13451345}
13461346
src/mame/drivers/renegade.c
r14976r14977
165165   renegade_adpcm_state *state = get_safe_token(device);
166166   state->m_playing = 0;
167167   state->m_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock(), state, renegade_adpcm_callback);
168   state->m_base = device->machine().region("adpcm")->base();
168   state->m_base = device->machine().root_device().memregion("adpcm")->base();
169169   state->m_adpcm.reset();
170170}
171171
r14976r14977
240240static void setbank(running_machine &machine)
241241{
242242   renegade_state *state = machine.driver_data<renegade_state>();
243   UINT8 *RAM = machine.region("maincpu")->base();
244   memory_set_bankptr(machine, "bank1", &RAM[state->m_bank ? 0x10000 : 0x4000]);
243   UINT8 *RAM = state->memregion("maincpu")->base();
244   state->membank("bank1")->set_base(&RAM[state->m_bank ? 0x10000 : 0x4000]);
245245}
246246
247247static MACHINE_START( renegade )
src/mame/drivers/junofrst.c
r14976r14977
143143   if (offset == 3)
144144   {
145145      int i;
146      UINT8 *gfx_rom = machine().region("gfx1")->base();
146      UINT8 *gfx_rom = memregion("gfx1")->base();
147147
148148      offs_t src = ((m_blitterdata[2] << 8) | m_blitterdata[3]) & 0xfffc;
149149      offs_t dest = (m_blitterdata[0] << 8) | m_blitterdata[1];
r14976r14977
190190
191191WRITE8_MEMBER(junofrst_state::junofrst_bankselect_w)
192192{
193   memory_set_bank(machine(), "bank1", data & 0x0f);
193   membank("bank1")->set_entry(data & 0x0f);
194194}
195195
196196
r14976r14977
529529{
530530   UINT8 *decrypted = konami1_decode(machine, "maincpu");
531531
532   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x1000);
533   memory_configure_bank_decrypted(machine, "bank1", 0, 16, decrypted + 0x10000, 0x1000);
532   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x1000);
533   machine.root_device().membank("bank1")->configure_decrypted_entries(0, 16, decrypted + 0x10000, 0x1000);
534534}
535535
536536
src/mame/drivers/nbmj8688.c
r14976r14977
6767
6868static DRIVER_INIT( mjcamera )
6969{
70   UINT8 *rom = machine.region("voice")->base() + 0x20000;
71   UINT8 *prot = machine.region("user1")->base();
70   UINT8 *rom = machine.root_device().memregion("voice")->base() + 0x20000;
71   UINT8 *prot = machine.root_device().memregion("user1")->base();
7272   int i;
7373
7474   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
8787static DRIVER_INIT( kanatuen )
8888{
8989   /* uses the same protection data as mjcamer, but a different check */
90   UINT8 *rom = machine.region("voice")->base() + 0x30000;
90   UINT8 *rom = machine.root_device().memregion("voice")->base() + 0x30000;
9191
9292   rom[0x0004] = 0x09;
9393   rom[0x0103] = 0x0e;
r14976r14977
101101{
102102#if 1
103103   /* uses the same protection data as ????, but a different check */
104   UINT8 *rom = machine.region("maincpu")->base();
104   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
105105
106106   rom[0x0149] = 0x00;
107107   rom[0x014a] = 0x00;
r14976r14977
113113
114114static DRIVER_INIT( idhimitu )
115115{
116   UINT8 *rom = machine.region("voice")->base() + 0x20000;
117   UINT8 *prot = machine.region("user1")->base();
116   UINT8 *rom = machine.root_device().memregion("voice")->base() + 0x20000;
117   UINT8 *prot = machine.root_device().memregion("user1")->base();
118118   int i;
119119
120120   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
138138
139139static DRIVER_INIT( kaguya2 )
140140{
141   UINT8 *rom = machine.region("voice")->base() + 0x20000;
142   UINT8 *prot = machine.region("user1")->base();
141   UINT8 *rom = machine.root_device().memregion("voice")->base() + 0x20000;
142   UINT8 *prot = machine.root_device().memregion("user1")->base();
143143   int i;
144144
145145   /* this is one possible way to rearrange the protection ROM data to get the
src/mame/drivers/caswin.c
r14976r14977
274274
275275static PALETTE_INIT( caswin )
276276{
277   const UINT8 *color_prom = machine.region("proms")->base();
277   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
278278   int   bit0, bit1, bit2 , r, g, b;
279279   int   i;
280280
src/mame/drivers/hitpoker.c
r14976r14977
117117
118118READ8_MEMBER(hitpoker_state::hitpoker_vram_r)
119119{
120   UINT8 *ROM = machine().region("maincpu")->base();
120   UINT8 *ROM = memregion("maincpu")->base();
121121
122122   if(m_pic_data & 0x10)
123123      return m_videoram[offset];
r14976r14977
127127
128128WRITE8_MEMBER(hitpoker_state::hitpoker_vram_w)
129129{
130//  UINT8 *ROM = machine().region("maincpu")->base();
130//  UINT8 *ROM = memregion("maincpu")->base();
131131
132132//  if(m_sys_regs[0x00] & 0x10)
133133   m_videoram[offset] = data;
r14976r14977
135135
136136READ8_MEMBER(hitpoker_state::hitpoker_cram_r)
137137{
138   UINT8 *ROM = machine().region("maincpu")->base();
138   UINT8 *ROM = memregion("maincpu")->base();
139139
140140   if(m_pic_data & 0x10)
141141      return m_colorram[offset];
r14976r14977
150150
151151READ8_MEMBER(hitpoker_state::hitpoker_paletteram_r)
152152{
153   UINT8 *ROM = machine().region("maincpu")->base();
153   UINT8 *ROM = memregion("maincpu")->base();
154154
155155   if(m_pic_data & 0x10)
156156      return m_paletteram[offset];
r14976r14977
517517
518518static DRIVER_INIT(hitpoker)
519519{
520   UINT8 *ROM = machine.region("maincpu")->base();
520   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
521521
522522   ROM[0x1220] = 0x01; //patch eeprom write?
523523   ROM[0x1221] = 0x01;
src/mame/drivers/taito_h.c
r14976r14977
231231static void reset_sound_region(running_machine &machine)
232232{
233233   taitoh_state *state = machine.driver_data<taitoh_state>();
234   memory_set_bank(machine, "bank1", state->m_banknum);
234   state->membank("bank1")->set_entry(state->m_banknum);
235235}
236236
237237WRITE8_MEMBER(taitoh_state::sound_bankswitch_w)
r14976r14977
518518static MACHINE_START( taitoh )
519519{
520520   taitoh_state *state = machine.driver_data<taitoh_state>();
521   UINT8 *ROM = machine.region("audiocpu")->base();
521   UINT8 *ROM = state->memregion("audiocpu")->base();
522522
523   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0xc000], 0x4000);
523   state->membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
524524
525525   state->m_audiocpu = machine.device("audiocpu");
526526   state->m_tc0220ioc = machine.device("tc0220ioc");
src/mame/drivers/ginganin.c
r14976r14977
380380   UINT16 *rom;
381381
382382   /* main cpu patches */
383   rom = (UINT16 *)machine.region("maincpu")->base();
383   rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
384384   /* avoid writes to rom getting to the log */
385385   rom[0x408 / 2] = 0x6000;
386386   rom[0x40a / 2] = 0x001c;
r14976r14977
388388
389389   /* sound cpu patches */
390390   /* let's clear the RAM: ROM starts at 0x4000 */
391   memset(machine.region("audiocpu")->base(), 0, 0x800);
391   memset(machine.root_device().memregion("audiocpu")->base(), 0, 0x800);
392392}
393393
394394
src/mame/drivers/tail2nos.c
r14976r14977
2929
3030static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
3131{
32   memory_set_bank(device->machine(), "bank3", data & 0x01);
32   device->machine().root_device().membank("bank3")->set_entry(data & 0x01);
3333}
3434
3535static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, tail2nos_state )
r14976r14977
208208static MACHINE_START( tail2nos )
209209{
210210   tail2nos_state *state = machine.driver_data<tail2nos_state>();
211   UINT8 *ROM = machine.region("audiocpu")->base();
211   UINT8 *ROM = state->memregion("audiocpu")->base();
212212
213   memory_configure_bank(machine, "bank3", 0, 2, &ROM[0x10000], 0x8000);
214   memory_set_bank(machine, "bank3", 0);
213   state->membank("bank3")->configure_entries(0, 2, &ROM[0x10000], 0x8000);
214   state->membank("bank3")->set_entry(0);
215215
216216   state->m_maincpu = machine.device("maincpu");
217217   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
227227   tail2nos_state *state = machine.driver_data<tail2nos_state>();
228228
229229   /* point to the extra ROMs */
230   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
231   memory_set_bankptr(machine, "bank2", machine.region("user2")->base());
230   state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base());
231   state->membank("bank2")->set_base(state->memregion("user2")->base());
232232
233233   state->m_charbank = 0;
234234   state->m_charpalette = 0;
src/mame/drivers/m79amb.c
r14976r14977
290290static DRIVER_INIT( m79amb )
291291{
292292   m79amb_state *state = machine.driver_data<m79amb_state>();
293   UINT8 *rom = machine.region("maincpu")->base();
293   UINT8 *rom = state->memregion("maincpu")->base();
294294   int i, j;
295295
296296   /* PROM data is active low */
src/mame/drivers/slapshot.c
r14976r14977
242242static void reset_sound_region( running_machine &machine )
243243{
244244   slapshot_state *state = machine.driver_data<slapshot_state>();
245   memory_set_bank(machine, "bank10", state->m_banknum);
245   state->membank("bank10")->set_entry(state->m_banknum);
246246}
247247
248248WRITE8_MEMBER(slapshot_state::sound_bankswitch_w)
r14976r14977
524524{
525525   slapshot_state *state = machine.driver_data<slapshot_state>();
526526
527   memory_configure_bank(machine, "bank10", 0, 4, machine.region("audiocpu")->base() + 0xc000, 0x4000);
527   state->membank("bank10")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0xc000, 0x4000);
528528
529529   state->m_maincpu = machine.device("maincpu");
530530   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
730730static DRIVER_INIT( slapshot )
731731{
732732   UINT32 offset,i;
733   UINT8 *gfx = machine.region("gfx2")->base();
734   int size = machine.region("gfx2")->bytes();
733   UINT8 *gfx = machine.root_device().memregion("gfx2")->base();
734   int size = machine.root_device().memregion("gfx2")->bytes();
735735   int data;
736736
737737   offset = size / 2;
src/mame/drivers/meritm.c
r14976r14977
419419   int rombank = (state->m_bank & 0x07) ^ 0x07;
420420
421421   //logerror( "CRT250: Switching banks: rom = %0x (bank = %x)\n", rombank, state->m_bank );
422   memory_set_bank(machine, "bank1", rombank );
422   state->membank("bank1")->set_entry(rombank );
423423};
424424
425425WRITE8_MEMBER(meritm_state::meritm_crt250_bank_w)
r14976r14977
437437           (state->m_psd_a15 & 0x1);
438438
439439   //logerror( "Switching banks: rom = %0x (bank = %x), ram = %0x\n", rombank, state->m_bank, rambank);
440   memory_set_bank(machine, "bank1", rombank );
441   memory_set_bank(machine, "bank2", rombank | 0x01);
442   memory_set_bank(machine, "bank3", rambank);
440   state->membank("bank1")->set_entry(rombank );
441   state->membank("bank2")->set_entry(rombank | 0x01);
442   state->membank("bank3")->set_entry(rambank);
443443};
444444
445445WRITE8_MEMBER(meritm_state::meritm_psd_a15_w)
r14976r14977
484484      return;
485485   }
486486
487   dst = machine().region("maincpu")->base() + 0x70000 + 2;
487   dst = memregion("maincpu")->base() + 0x70000 + 2;
488488
489489   if (data == 0)
490490   {
r14976r14977
513513         default: logerror( "meritm_crt250_questions_bank_w: unknown data = %02x\n", data ); return;
514514      }
515515      logerror( "Reading question byte at %06X\n", questions_address | m_questions_loword_address);
516      *dst = machine().region("extra")->base()[questions_address | m_questions_loword_address];
516      *dst = memregion("extra")->base()[questions_address | m_questions_loword_address];
517517   }
518518};
519519
r14976r14977
989989static MACHINE_START(meritm_crt250)
990990{
991991   meritm_state *state = machine.driver_data<meritm_state>();
992   memory_configure_bank(machine, "bank1", 0, 8, machine.region("maincpu")->base(), 0x10000);
992   state->membank("bank1")->configure_entries(0, 8, state->memregion("maincpu")->base(), 0x10000);
993993   state->m_bank = 0xff;
994994   meritm_crt250_switch_banks(machine);
995995   MACHINE_START_CALL(merit_common);
r14976r14977
10161016   state->m_ram = auto_alloc_array(machine, UINT8,  0x8000 );
10171017   machine.device<nvram_device>("nvram")->set_base(state->m_ram, 0x8000);
10181018   memset(state->m_ram, 0x00, 0x8000);
1019   memory_configure_bank(machine, "bank1", 0, 128, machine.region("maincpu")->base(), 0x8000);
1020   memory_configure_bank(machine, "bank2", 0, 128, machine.region("maincpu")->base(), 0x8000);
1021   memory_configure_bank(machine, "bank3", 0, 4, state->m_ram, 0x2000);
1019   state->membank("bank1")->configure_entries(0, 128, machine.root_device().memregion("maincpu")->base(), 0x8000);
1020   state->membank("bank2")->configure_entries(0, 128, state->memregion("maincpu")->base(), 0x8000);
1021   state->membank("bank3")->configure_entries(0, 4, state->m_ram, 0x2000);
10221022   state->m_bank = 0xff;
10231023   state->m_psd_a15 = 0;
10241024   meritm_switch_banks(machine);
src/mame/drivers/atarisy4.c
r14976r14977
583583   }
584584
585585   data &= 0x3800;
586   memory_set_bankptr(machine(), "dsp0_bank1", &m_shared_ram[0][data]);
586   membank("dsp0_bank1")->set_base(&m_shared_ram[0][data]);
587587   m_dsp_bank[0] = data;
588588}
589589
r14976r14977
617617   }
618618
619619   data &= 0x3800;
620   memory_set_bankptr(machine(), "dsp1_bank1", &m_shared_ram[1][data]);
620   membank("dsp1_bank1")->set_base(&m_shared_ram[1][data]);
621621   m_dsp_bank[1] = data;
622622}
623623
r14976r14977
969969   state->m_shared_ram[0] = auto_alloc_array_clear(machine, UINT16, 0x2000);
970970
971971   /* Populate the 68000 address space with data from the HEX files */
972   load_hexfile(main, machine.region("code")->base());
973   load_hexfile(main, machine.region("data")->base());
972   load_hexfile(main, machine.root_device().memregion("code")->base());
973   load_hexfile(main, machine.root_device().memregion("data")->base());
974974
975975   /* Set up the DSP */
976   memory_set_bankptr(machine, "dsp0_bank0", state->m_shared_ram[0]);
977   memory_set_bankptr(machine, "dsp0_bank1", &state->m_shared_ram[0][0x800]);
978   load_ldafile(machine.device("dsp0")->memory().space(AS_PROGRAM), machine.region("dsp")->base());
976   state->membank("dsp0_bank0")->set_base(state->m_shared_ram[0]);
977   state->membank("dsp0_bank1")->set_base(&state->m_shared_ram[0][0x800]);
978   load_ldafile(machine.device("dsp0")->memory().space(AS_PROGRAM), state->memregion("dsp")->base());
979979}
980980
981981static DRIVER_INIT( airrace )
r14976r14977
986986   state->m_shared_ram[1] = auto_alloc_array_clear(machine, UINT16, 0x4000);
987987
988988   /* Populate RAM with data from the HEX files */
989   load_hexfile(machine.device("maincpu")->memory().space(AS_PROGRAM), machine.region("code")->base());
989   load_hexfile(machine.device("maincpu")->memory().space(AS_PROGRAM), machine.root_device().memregion("code")->base());
990990
991991   /* Set up the first DSP */
992   memory_set_bankptr(machine, "dsp0_bank0", state->m_shared_ram[0]);
993   memory_set_bankptr(machine, "dsp0_bank1", &state->m_shared_ram[0][0x800]);
994   load_ldafile(machine.device("dsp0")->memory().space(AS_PROGRAM), machine.region("dsp")->base());
992   state->membank("dsp0_bank0")->set_base(state->m_shared_ram[0]);
993   state->membank("dsp0_bank1")->set_base(&state->m_shared_ram[0][0x800]);
994   load_ldafile(machine.device("dsp0")->memory().space(AS_PROGRAM), machine.root_device().memregion("dsp")->base());
995995
996996   /* Set up the second DSP */
997   memory_set_bankptr(machine, "dsp1_bank0", state->m_shared_ram[1]);
998   memory_set_bankptr(machine, "dsp1_bank1", &state->m_shared_ram[1][0x800]);
999   load_ldafile(machine.device("dsp1")->memory().space(AS_PROGRAM), machine.region("dsp")->base());
997   state->membank("dsp1_bank0")->set_base(state->m_shared_ram[1]);
998   state->membank("dsp1_bank1")->set_base(&state->m_shared_ram[1][0x800]);
999   load_ldafile(machine.device("dsp1")->memory().space(AS_PROGRAM), state->memregion("dsp")->base());
10001000}
10011001
10021002static MACHINE_RESET( atarisy4 )
src/mame/drivers/lucky74.c
r14976r14977
11301130      if (state->m_adpcm_data == -1)
11311131      {
11321132         /* transferring 1st nibble */
1133         state->m_adpcm_data = device->machine().region("adpcm")->base()[state->m_adpcm_pos];
1133         state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos];
11341134         state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0xffff;
11351135         msm5205_data_w(device, state->m_adpcm_data >> 4);
11361136
src/mame/drivers/cninja.c
r14976r14977
20682068
20692069static void cninja_patch( running_machine &machine )
20702070{
2071   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
2071   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
20722072   int i;
20732073
20742074   for (i = 0; i < 0x80000 / 2; i++)
r14976r14977
21092109
21102110static DRIVER_INIT( mutantf )
21112111{
2112   const UINT8 *src = machine.region("gfx2")->base();
2113   UINT8 *dst = machine.region("gfx1")->base();
2112   const UINT8 *src = machine.root_device().memregion("gfx2")->base();
2113   UINT8 *dst = machine.root_device().memregion("gfx1")->base();
21142114
21152115   /* The 16x16 graphic has some 8x8 chars in it - decode them in GFX1 */
21162116   memcpy(dst + 0x50000, dst + 0x10000, 0x10000);
src/mame/drivers/wardner.c
r14976r14977
152152      int bankaddress = 0;
153153
154154      address_space *mainspace;
155      UINT8 *RAM = machine().region("maincpu")->base();
155      UINT8 *RAM = memregion("maincpu")->base();
156156
157157      mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
158158      m_wardner_membank = data;
r14976r14977
171171            case 6:  bankaddress = 0x30000; break; /* not used */
172172            default: bankaddress = 0x00000; break; /* not used */
173173         }
174         memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
174         membank("bank1")->set_base(&RAM[bankaddress]);
175175      }
176176      else
177177      {
r14976r14977
179179         mainspace->install_read_bank(0xa000, 0xadff, "bank4");
180180         mainspace->install_read_bank(0xae00, 0xafff, "bank2");
181181         mainspace->install_read_bank(0xc000, 0xc7ff, "bank3");
182         memory_set_bankptr(machine(), "bank1", &RAM[0x0000]);
183         memory_set_bankptr(machine(), "bank2", m_rambase_ae00);
184         memory_set_bankptr(machine(), "bank3", m_rambase_c000);
185         memory_set_bankptr(machine(), "bank4", m_generic_paletteram_8);
182         membank("bank1")->set_base(&RAM[0x0000]);
183         membank("bank2")->set_base(m_rambase_ae00);
184         membank("bank3")->set_base(m_rambase_c000);
185         membank("bank4")->set_base(m_generic_paletteram_8);
186186      }
187187   }
188188}
src/mame/drivers/missile.c
r14976r14977
501501   /* ROM? */
502502   else if (address >= 0x5000)
503503   {
504      direct.explicit_configure(0x5000 | offset, 0x7fff | offset, 0x7fff, direct.space().machine().region("maincpu")->base() + 0x5000);
504      direct.explicit_configure(0x5000 | offset, 0x7fff | offset, 0x7fff, direct.space().machine().root_device().memregion("maincpu")->base() + 0x5000);
505505      return ~0;
506506   }
507507
r14976r14977
514514{
515515   missile_state *state = machine.driver_data<missile_state>();
516516   /* initialize globals */
517   state->m_writeprom = machine.region("proms")->base();
517   state->m_writeprom = state->memregion("proms")->base();
518518   state->m_flipscreen = 0;
519519
520520   /* set up an opcode base handler since we use mapped handlers for RAM */
r14976r14977
786786
787787   /* ROM */
788788   else if (offset >= 0x5000)
789      result = machine().region("maincpu")->base()[offset];
789      result = memregion("maincpu")->base()[offset];
790790
791791   /* POKEY */
792792   else if (offset < 0x4800)
r14976r14977
11991199static DRIVER_INIT( suprmatk )
12001200{
12011201   int i;
1202   UINT8 *rom = machine.region("maincpu")->base();
1202   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
12031203
12041204   for (i = 0; i < 0x40; i++)
12051205   {
src/mame/drivers/go2000.c
r14976r14977
7676
7777WRITE8_MEMBER(go2000_state::go2000_pcm_1_bankswitch_w)
7878{
79   memory_set_bank(machine(), "bank1", data & 0x07);
79   membank("bank1")->set_entry(data & 0x07);
8080}
8181
8282static ADDRESS_MAP_START( go2000_sound_map, AS_PROGRAM, 8, go2000_state )
r14976r14977
310310static MACHINE_START( go2000 )
311311{
312312   go2000_state *state = machine.driver_data<go2000_state>();
313   UINT8 *SOUND = machine.region("soundcpu")->base();
313   UINT8 *SOUND = state->memregion("soundcpu")->base();
314314   int i;
315315
316316   for (i = 0; i < 8; i++)
317      memory_configure_bank(machine, "bank1", i, 1, &SOUND[0x00400 + i * 0x10000], 0x10000 - 0x400);
317      state->membank("bank1")->configure_entry(i, &SOUND[0x00400 + i * 0x10000]);
318318
319   memory_set_bank(machine, "bank1", 0);
319   state->membank("bank1")->set_entry(0);
320320
321321   state->m_soundcpu = machine.device("soundcpu");
322322}
src/mame/drivers/jack.c
r14976r14977
109109   // Read the actual byte from question roms
110110   else
111111   {
112      UINT8 *ROM = machine().region("user1")->base();
112      UINT8 *ROM = memregion("user1")->base();
113113      int real_address;
114114
115115      real_address = m_question_address | (offset & 0x3f0) | m_remap_address[offset & 0x0f];
r14976r14977
12981298{
12991299   int A;
13001300   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1301   UINT8 *rom = machine.region("maincpu")->base();
1301   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
13021302   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x4000);
13031303   int data;
13041304
r14976r14977
13731373       code, the protection device is disabled or changes behaviour via
13741374       writes at 0xf000 and 0xf008. -AS
13751375       */
1376   UINT8 *ROM = machine.region("maincpu")->base();
1376   UINT8 *ROM = state->memregion("maincpu")->base();
13771377   ROM[0x13] = 0x01;
13781378   ROM[0x12] = 0x9d;
13791379
r14976r14977
13841384static DRIVER_INIT( striv )
13851385{
13861386   jack_state *state = machine.driver_data<jack_state>();
1387   UINT8 *ROM = machine.region("maincpu")->base();
1387   UINT8 *ROM = state->memregion("maincpu")->base();
13881388   UINT8 data;
13891389   int A;
13901390
src/mame/drivers/vigilant.c
r14976r14977
2626WRITE8_MEMBER(vigilant_state::vigilant_bank_select_w)
2727{
2828   int bankaddress;
29   UINT8 *RAM = machine().region("maincpu")->base();
29   UINT8 *RAM = memregion("maincpu")->base();
3030
3131   bankaddress = 0x10000 + (data & 0x07) * 0x4000;
32   memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
32   membank("bank1")->set_base(&RAM[bankaddress]);
3333}
3434
3535/***************************************************************************
src/mame/drivers/nbmj8991.c
r14976r14977
4949WRITE8_MEMBER(nbmj8991_state::nbmj8991_soundbank_w)
5050{
5151   if (!(data & 0x80)) soundlatch_clear_byte_w(space, 0, 0);
52   memory_set_bank(machine(), "bank1", data & 0x03);
52   membank("bank1")->set_entry(data & 0x03);
5353}
5454
5555WRITE8_MEMBER(nbmj8991_state::nbmj8991_sound_w)
r14976r14977
7070   device_t *audiocpu = machine.device("audiocpu");
7171   if (audiocpu != NULL && audiocpu->type() == Z80)
7272   {
73      memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x8000, 0x8000);
74      memory_set_bank(machine, "bank1", 0);
73      machine.root_device().membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("audiocpu")->base() + 0x8000, 0x8000);
74      machine.root_device().membank("bank1")->set_entry(0);
7575   }
7676   MACHINE_RESET_CALL(nb1413m3);
7777}
r14976r14977
108108
109109static DRIVER_INIT( finalbny )
110110{
111   UINT8 *ROM = machine.region("maincpu")->base();
111   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
112112   int i;
113113
114114   for (i = 0xf800; i < 0x10000; i++) ROM[i] = 0x00;
r14976r14977
134134static DRIVER_INIT( galkaika )
135135{
136136#if 1
137   UINT8 *ROM = machine.region("maincpu")->base();
137   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
138138
139139   // Patch to IM2 -> IM1
140140   ROM[0x0002] = 0x56;
r14976r14977
145145static DRIVER_INIT( tokyogal )
146146{
147147#if 1
148   UINT8 *ROM = machine.region("maincpu")->base();
148   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
149149
150150   // Patch to IM2 -> IM1
151151   ROM[0x0002] = 0x56;
r14976r14977
156156static DRIVER_INIT( tokimbsj )
157157{
158158#if 1
159   UINT8 *ROM = machine.region("maincpu")->base();
159   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
160160
161161   // Patch to IM2 -> IM1
162162   ROM[0x0002] = 0x56;
src/mame/drivers/galivan.c
r14976r14977
380380   galivan_state *state = machine.driver_data<galivan_state>();
381381
382382   /* configure ROM banking */
383   UINT8 *rombase = machine.region("maincpu")->base();
384   memory_configure_bank(machine, "bank1", 0, 2, &rombase[0x10000], 0x2000);
385   memory_set_bank(machine, "bank1", 0);
383   UINT8 *rombase = state->memregion("maincpu")->base();
384   state->membank("bank1")->configure_entries(0, 2, &rombase[0x10000], 0x2000);
385   state->membank("bank1")->set_entry(0);
386386
387387   /* register for saving */
388388   state->save_item(NAME(state->m_scrollx));
r14976r14977
397397   galivan_state *state = machine.driver_data<galivan_state>();
398398
399399   /* configure ROM banking */
400   UINT8 *rombase = machine.region("maincpu")->base();
401   memory_configure_bank(machine, "bank1", 0, 4, &rombase[0x10000], 0x2000);
402   memory_set_bank(machine, "bank1", 0);
400   UINT8 *rombase = state->memregion("maincpu")->base();
401   state->membank("bank1")->configure_entries(0, 4, &rombase[0x10000], 0x2000);
402   state->membank("bank1")->set_entry(0);
403403
404404   /* register for saving */
405405   state->save_item(NAME(state->m_scrollx));
r14976r14977
10341034WRITE8_MEMBER(galivan_state::youmab_extra_bank_w)
10351035{
10361036   if (data == 0xff)
1037      memory_set_bank(machine(), "bank2", 1);
1037      membank("bank2")->set_entry(1);
10381038   else if (data == 0x00)
1039      memory_set_bank(machine(), "bank2", 0);
1039      membank("bank2")->set_entry(0);
10401040   else
10411041      printf("data %03x\n", data);
10421042}
r14976r14977
10851085   galivan_state *state = machine.driver_data<galivan_state>();
10861086   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x82, 0x82, write8_delegate(FUNC(galivan_state::youmab_extra_bank_w),state)); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there
10871087   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x7fff, "bank3");
1088   memory_set_bankptr(machine,  "bank3", machine.region("maincpu")->base());
1088   state->membank("bank3")->set_base(machine.root_device().memregion("maincpu")->base());
10891089
10901090   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xbfff, "bank2");
1091   memory_configure_bank(machine, "bank2", 0, 2, machine.region("user2")->base(), 0x4000);
1092   memory_set_bank(machine, "bank2", 0);
1091   state->membank("bank2")->configure_entries(0, 2, state->memregion("user2")->base(), 0x4000);
1092   state->membank("bank2")->set_entry(0);
10931093
10941094   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x81, 0x81, write8_delegate(FUNC(galivan_state::youmab_81_w),state)); // ?? often, alternating values
10951095   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x84, 0x84, write8_delegate(FUNC(galivan_state::youmab_84_w),state)); // ?? often, sequence..
src/mame/drivers/deshoros.c
r14976r14977
6767   deshoros_state *state = machine.driver_data<deshoros_state>();
6868   if(state->m_bank!=new_bank)
6969   {
70      UINT8 *ROM = machine.region("data")->base();
70      UINT8 *ROM = state->memregion("data")->base();
7171      UINT32 bankaddress;
7272
7373      state->m_bank = new_bank;
7474      bankaddress = 0 + 0x6000 * state->m_bank;
75      memory_set_bankptr(machine, "bank1", &ROM[bankaddress]);
75      state->membank("bank1")->set_base(&ROM[bankaddress]);
7676   }
7777}
7878
src/mame/drivers/igs_m027.c
r14976r14977
254254{
255255   int i;
256256   unsigned rom_size = 0x80000;
257   UINT8 *src = (UINT8 *) (machine.region("gfx1")->base());
257   UINT8 *src = (UINT8 *) (machine.root_device().memregion("gfx1")->base());
258258   UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
259259
260260   for (i=0; i<rom_size; i++)
r14976r14977
758758
759759static void pgm_create_dummy_internal_arm_region(running_machine &machine)
760760{
761   UINT16 *temp16 = (UINT16 *)machine.region("maincpu")->base();
761   UINT16 *temp16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
762762
763763   // fill with RX 14
764764   int i;
r14976r14977
785785{
786786
787787   int i;
788   UINT16 *src = (UINT16 *) machine.region("user1")->base();
788   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
789789
790790   int rom_size = 0x80000;
791791
r14976r14977
831831static void hauntedh_decrypt(running_machine &machine)
832832{
833833   int i;
834   UINT16 *src = (UINT16 *) machine.region("user1")->base();
834   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
835835
836836   int rom_size = 0x080000;
837837
r14976r14977
876876static void chessc2_decrypt(running_machine &machine)
877877{
878878   int i;
879   UINT16 *src = (UINT16 *) machine.region("user1")->base();
879   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
880880
881881   int rom_size = 0x80000;
882882
r14976r14977
921921static void klxyj_decrypt(running_machine &machine)
922922{
923923   int i;
924   UINT16 *src = (UINT16 *) machine.region("user1")->base();
924   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
925925
926926   int rom_size = 0x80000;
927927
r14976r14977
965965static void big2_decrypt(running_machine &machine)
966966{
967967   int i;
968   UINT16 *src = (UINT16 *) machine.region("user1")->base();
968   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
969969
970970   int rom_size = 0x80000;
971971
r14976r14977
10091009static void gonefsh2_decrypt(running_machine &machine)
10101010{
10111011   int i;
1012   UINT16 *src = (UINT16 *) machine.region("user1")->base();
1012   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
10131013
10141014   int rom_size = 0x80000;
10151015
r14976r14977
10531053static void sddz_decrypt(running_machine &machine)
10541054{
10551055   int i;
1056   UINT16 *src = (UINT16 *) machine.region("user1")->base();
1056   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
10571057
10581058   int rom_size = 0x80000;
10591059
r14976r14977
10971097static void lhzb3_decrypt(running_machine &machine)
10981098{
10991099   int i;
1100   UINT16 *src = (UINT16 *) machine.region("user1")->base();
1100   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
11011101
11021102   int rom_size = 0x80000;
11031103
r14976r14977
11411141static void mgfx_decrypt(running_machine &machine)
11421142{
11431143   int i;
1144   UINT16 *src = (UINT16 *) machine.region("user1")->base();
1144   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
11451145
11461146   int rom_size = 0x80000;
11471147
r14976r14977
11851185static void lhzb4_decrypt(running_machine &machine)
11861186{
11871187   int i;
1188   UINT16 *src = (UINT16 *) machine.region("user1")->base();
1188   UINT16 *src = (UINT16 *) machine.root_device().memregion("user1")->base();
11891189
11901190   int rom_size = 0x80000;
11911191
src/mame/drivers/splash.c
r14976r14977
140140
141141WRITE8_MEMBER(splash_state::sound_bank_w)
142142{
143   memory_set_bank(machine(), "sound_bank", data & 0xf);
143   membank("sound_bank")->set_entry(data & 0xf);
144144}
145145
146146
r14976r14977
10161016static DRIVER_INIT( roldfrog )
10171017{
10181018   splash_state *state = machine.driver_data<splash_state>();
1019   UINT8 * ROM = (UINT8 *)machine.region("audiocpu")->base();
1020   memory_configure_bank(machine, "sound_bank", 0, 16, &ROM[0x10000], 0x8000);
1019   UINT8 * ROM = (UINT8 *)state->memregion("audiocpu")->base();
1020   state->membank("sound_bank")->configure_entries(0, 16, &ROM[0x10000], 0x8000);
10211021
10221022   state->m_bitmap_type = 1;
10231023   state->m_sprite_attr2_shift = 8;
r14976r14977
10261026static DRIVER_INIT( rebus )
10271027{
10281028   splash_state *state = machine.driver_data<splash_state>();
1029   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
1029   UINT16 *ROM = (UINT16 *)state->memregion("maincpu")->base();
10301030
10311031   state->m_bitmap_type = 1;
10321032   state->m_sprite_attr2_shift = 0;
r14976r14977
10561056static DRIVER_INIT( funystrp )
10571057{
10581058   splash_state *state = machine.driver_data<splash_state>();
1059   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
1059   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
10601060
10611061   state->m_bitmap_type = 0;
10621062   state->m_sprite_attr2_shift = 0;
r14976r14977
10951095   ROM[0x11730/2] = 0x7001;
10961096   ROM[0x11f80/2] = 0x7001;
10971097
1098   ROM = (UINT16 *)machine.region("audiocpu")->base();
1098   ROM = (UINT16 *)state->memregion("audiocpu")->base();
10991099
1100   memory_configure_bank(machine, "sound_bank", 0, 16, &ROM[0x00000], 0x8000);
1100   state->membank("sound_bank")->configure_entries(0, 16, &ROM[0x00000], 0x8000);
11011101
11021102}
11031103
src/mame/drivers/subsino2.c
r14976r14977
23622362
23632363static DRIVER_INIT( bishjan )
23642364{
2365   UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
2365   UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
23662366
23672367   // patch serial protection test (it always enters test mode on boot otherwise)
23682368   rom[0x042EA/2] = 0x4008;
r14976r14977
24262426
24272427static DRIVER_INIT( expcard )
24282428{
2429   UINT8 *rom = machine.region("maincpu")->base();
2429   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
24302430
24312431   // patch protection test (it always enters test mode on boot otherwise)
24322432   rom[0xed4dc-0xc0000] = 0xeb;
r14976r14977
25242524   subsino_decrypt(machine, crsbingo_bitswaps, crsbingo_xors, 0x8000);
25252525
25262526   // patch serial protection test (it always enters test mode on boot otherwise)
2527   UINT8 *rom = machine.region("maincpu")->base();
2527   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
25282528   rom[0x0cec] = 0x18;
25292529   rom[0xb037] = 0x18;
25302530
r14976r14977
25782578
25792579static DRIVER_INIT( saklove )
25802580{
2581   UINT8 *rom = machine.region("maincpu")->base();
2581   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
25822582
25832583   // patch serial protection test (it always enters test mode on boot otherwise)
25842584   rom[0x0e029] = 0xeb;
r14976r14977
26382638
26392639static DRIVER_INIT( xplan )
26402640{
2641   UINT8 *rom = machine.region("maincpu")->base();
2641   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
26422642
26432643   // patch protection test (it always enters test mode on boot otherwise)
26442644   rom[0xeded9-0xc0000] = 0xeb;
r14976r14977
26982698
26992699static DRIVER_INIT( xtrain )
27002700{
2701   UINT8 *rom = machine.region("maincpu")->base();
2701   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
27022702
27032703   // patch protection test (it always enters test mode on boot otherwise)
27042704   rom[0xe190f-0xc0000] = 0xeb;
r14976r14977
27432743   subsino_decrypt(machine, victor5_bitswaps, victor5_xors, 0x8000);
27442744
27452745   // patch serial protection test (it always enters test mode on boot otherwise)
2746   UINT8 *rom = machine.region("maincpu")->base();
2746   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
27472747   rom[0x0d79] = 0x18;
27482748   rom[0xc1cf] = 0x18;
27492749   rom[0xc2a9] = 0x18;
src/mame/drivers/route16.c
r14976r14977
957957
958958static DRIVER_INIT( route16 )
959959{
960   UINT8 *ROM = machine.region("cpu1")->base();
960   UINT8 *ROM = machine.root_device().memregion("cpu1")->base();
961961   /* Is this actually a bootleg? some of the protection has
962962       been removed */
963963
r14976r14977
972972
973973static DRIVER_INIT( route16a )
974974{
975   UINT8 *ROM = machine.region("cpu1")->base();
975   UINT8 *ROM = machine.root_device().memregion("cpu1")->base();
976976   /* TO DO : Replace these patches with simulation of the protection device */
977977
978978   /* patch the protection */
src/mame/drivers/pgm2.c
r14976r14977
286286
287287static DRIVER_INIT( orleg2 )
288288{
289   UINT16 *src = (UINT16 *)machine.region("spritesa")->base();
289   UINT16 *src = (UINT16 *)machine.root_device().memregion("spritesa")->base();
290290
291291   iga_u12_decode(src, 0x2000000, 0x4761);
292292   iga_u16_decode(src, 0x2000000, 0xc79f);
r14976r14977
294294
295295static DRIVER_INIT( kov2nl )
296296{
297   UINT16 *src = (UINT16 *)machine.region("spritesa")->base();
297   UINT16 *src = (UINT16 *)machine.root_device().memregion("spritesa")->base();
298298
299299   iga_u12_decode(src, 0x2000000, 0xa193);
300300   iga_u16_decode(src, 0x2000000, 0xb780);
src/mame/drivers/m63.c
r14976r14977
180180
181181static PALETTE_INIT( m63 )
182182{
183   const UINT8 *color_prom = machine.region("proms")->base();
183   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
184184   int i;
185185
186186   for (i = 0; i < 256; i++)
r14976r14977
432432   switch (m_p2 & 0xf0)
433433   {
434434      case 0x60:   return soundlatch_byte_r(space, 0); ;
435      case 0x70:   return machine().region("user1")->base()[((m_p1 & 0x1f) << 8) | offset];
435      case 0x70:   return memregion("user1")->base()[((m_p1 & 0x1f) << 8) | offset];
436436   }
437437   return 0xff;
438438}
r14976r14977
696696{
697697   running_machine &machine = device.machine();
698698   m63_state *state = machine.driver_data<m63_state>();
699   int i, len = machine.region("samples")->bytes();
700   UINT8 *ROM = machine.region("samples")->base();
699   int i, len = machine.root_device().memregion("samples")->bytes();
700   UINT8 *ROM = state->memregion("samples")->base();
701701
702702   state->m_samplebuf = auto_alloc_array(machine, INT16, len);
703703   state->save_pointer(NAME(state->m_samplebuf), len);
src/mame/drivers/tecmosys.c
r14976r14977
326326
327327WRITE8_MEMBER(tecmosys_state::tecmosys_z80_bank_w)
328328{
329   memory_set_bank(machine(), "bank1", data);
329   membank("bank1")->set_entry(data);
330330}
331331
332332WRITE8_MEMBER(tecmosys_state::tecmosys_oki_bank_w)
333333{
334334   UINT8 upperbank = (data & 0x30) >> 4;
335335   UINT8 lowerbank = (data & 0x03) >> 0;
336   UINT8* region = machine().region("oki")->base();
336   UINT8* region = memregion("oki")->base();
337337
338338   memcpy( region+0x00000, region+0x80000 + lowerbank * 0x20000, 0x20000  );
339339   memcpy( region+0x20000, region+0x80000 + upperbank * 0x20000, 0x20000  );
r14976r14977
448448static MACHINE_START( tecmosys )
449449{
450450//  tecmosys_state *state = machine.driver_data<tecmosys_state>();
451   memory_configure_bank(machine, "bank1", 0, 16, machine.region("audiocpu")->base(), 0x4000);
451   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("audiocpu")->base(), 0x4000);
452452}
453453
454454static MACHINE_CONFIG_START( deroon, tecmosys_state )
r14976r14977
631631
632632static void tecmosys_descramble(running_machine &machine)
633633{
634   UINT8 *gfxsrc  = machine.region( "gfx1" )->base();
635   size_t srcsize = machine.region( "gfx1" )->bytes();
634   UINT8 *gfxsrc  = machine.root_device().memregion( "gfx1" )->base();
635   size_t srcsize = machine.root_device().memregion( "gfx1" )->bytes();
636636   int i;
637637
638638   for (i=0; i < srcsize; i+=4)
src/mame/drivers/exidy440.c
r14976r14977
308308
309309   /* select the bank and update the bank pointer */
310310   state->m_bank = bank;
311   memory_set_bankptr(machine, "bank1", &machine.region("maincpu")->base()[0x10000 + state->m_bank * 0x4000]);
311   state->membank("bank1")->set_base(&machine.root_device().memregion("maincpu")->base()[0x10000 + state->m_bank * 0x4000]);
312312}
313313
314314
r14976r14977
317317   /* EEROM lives in the upper 8k of bank 15 */
318318   if (m_bank == 15 && offset >= 0x2000)
319319   {
320      machine().region("maincpu")->base()[0x10000 + 15 * 0x4000 + offset] = data;
320      memregion("maincpu")->base()[0x10000 + 15 * 0x4000 + offset] = data;
321321      logerror("W EEROM[%04X] = %02X\n", offset - 0x2000, data);
322322   }
323323
r14976r14977
445445{
446446   exidy440_state *state = machine.driver_data<exidy440_state>();
447447   /* the EEROM lives in the uppermost 8k of the top bank */
448   UINT8 *rom = machine.region("maincpu")->base();
448   UINT8 *rom = state->memregion("maincpu")->base();
449449
450450   state->m_custom = machine.device("custom");
451451   machine.device<nvram_device>("nvram")->set_base(&rom[0x10000 + 15 * 0x4000 + 0x2000], 0x2000);
src/mame/drivers/dassault.c
r14976r14977
830830
831831static DRIVER_INIT( dassault )
832832{
833   const UINT8 *src = machine.region("gfx1")->base();
834   UINT8 *dst = machine.region("gfx2")->base();
833   const UINT8 *src = machine.root_device().memregion("gfx1")->base();
834   UINT8 *dst = machine.root_device().memregion("gfx2")->base();
835835   UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000);
836836
837837   /* Playfield 4 also has access to the char graphics, make things easier
r14976r14977
847847
848848static DRIVER_INIT( thndzone )
849849{
850   const UINT8 *src = machine.region("gfx1")->base();
851   UINT8 *dst = machine.region("gfx2")->base();
850   const UINT8 *src = machine.root_device().memregion("gfx1")->base();
851   UINT8 *dst = machine.root_device().memregion("gfx2")->base();
852852   UINT8 *tmp = auto_alloc_array(machine, UINT8, 0x80000);
853853
854854   /* Playfield 4 also has access to the char graphics, make things easier
src/mame/drivers/dambustr.c
r14976r14977
205205{
206206   int i, j, tmp;
207207   int tmpram[16];
208   UINT8 *rom = machine.region("maincpu")->base();
209   UINT8 *usr = machine.region("user1")->base();
210   UINT8 *gfx = machine.region("gfx1")->base();
208   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
209   UINT8 *usr = machine.root_device().memregion("user1")->base();
210   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
211211
212212   // Bit swap addresses
213213   for(i=0; i<4096*4; i++) {
src/mame/drivers/tatsumi.c
r14976r14977
12841284static DRIVER_INIT( apache3 )
12851285{
12861286   tatsumi_state *state = machine.driver_data<tatsumi_state>();
1287   UINT8 *dst = machine.region("gfx1")->base();
1288   UINT8 *src1 = machine.region("gfx2")->base();
1289   UINT8 *src2 = machine.region("gfx3")->base();
1287   UINT8 *dst = machine.root_device().memregion("gfx1")->base();
1288   UINT8 *src1 = machine.root_device().memregion("gfx2")->base();
1289   UINT8 *src2 = state->memregion("gfx3")->base();
12901290   int i;
12911291
12921292   for (i=0; i<0x100000; i+=32) {
r14976r14977
12991299   }
13001300
13011301   // Copy sprite & palette data out of GFX rom area
1302   state->m_rom_sprite_lookup1 = machine.region("gfx2")->base();
1303   state->m_rom_sprite_lookup2 = machine.region("gfx3")->base();
1304   state->m_rom_clut0 = machine.region("gfx2")->base()+ 0x100000 - 0x800;
1305   state->m_rom_clut1 = machine.region("gfx3")->base()+ 0x100000 - 0x800;
1302   state->m_rom_sprite_lookup1 = machine.root_device().memregion("gfx2")->base();
1303   state->m_rom_sprite_lookup2 = machine.root_device().memregion("gfx3")->base();
1304   state->m_rom_clut0 = machine.root_device().memregion("gfx2")->base()+ 0x100000 - 0x800;
1305   state->m_rom_clut1 = machine.root_device().memregion("gfx3")->base()+ 0x100000 - 0x800;
13061306
13071307   tatsumi_reset(machine);
13081308
r14976r14977
13121312static DRIVER_INIT( roundup5 )
13131313{
13141314   tatsumi_state *state = machine.driver_data<tatsumi_state>();
1315   UINT8 *dst = machine.region("gfx1")->base();
1316   UINT8 *src1 = machine.region("gfx2")->base();
1317   UINT8 *src2 = machine.region("gfx3")->base();
1315   UINT8 *dst = machine.root_device().memregion("gfx1")->base();
1316   UINT8 *src1 = machine.root_device().memregion("gfx2")->base();
1317   UINT8 *src2 = state->memregion("gfx3")->base();
13181318   int i;
13191319
13201320   for (i=0; i<0xc0000; i+=32) {
r14976r14977
13271327   }
13281328
13291329   // Copy sprite & palette data out of GFX rom area
1330   state->m_rom_sprite_lookup1 = machine.region("gfx2")->base();
1331   state->m_rom_sprite_lookup2 = machine.region("gfx3")->base();
1332   state->m_rom_clut0 = machine.region("gfx2")->base()+ 0xc0000 - 0x800;
1333   state->m_rom_clut1 = machine.region("gfx3")->base()+ 0xc0000 - 0x800;
1330   state->m_rom_sprite_lookup1 = machine.root_device().memregion("gfx2")->base();
1331   state->m_rom_sprite_lookup2 = machine.root_device().memregion("gfx3")->base();
1332   state->m_rom_clut0 = machine.root_device().memregion("gfx2")->base()+ 0xc0000 - 0x800;
1333   state->m_rom_clut1 = machine.root_device().memregion("gfx3")->base()+ 0xc0000 - 0x800;
13341334
13351335   tatsumi_reset(machine);
13361336}
r14976r14977
13381338static DRIVER_INIT( cyclwarr )
13391339{
13401340   tatsumi_state *state = machine.driver_data<tatsumi_state>();
1341   UINT8 *dst = machine.region("gfx1")->base();
1342   UINT8 *src1 = machine.region("gfx2")->base();
1343   int len1 = machine.region("gfx2")->bytes();
1344   UINT8 *src2 = machine.region("gfx3")->base();
1345   int len2 = machine.region("gfx3")->bytes();
1341   UINT8 *dst = machine.root_device().memregion("gfx1")->base();
1342   UINT8 *src1 = machine.root_device().memregion("gfx2")->base();
1343   int len1 = machine.root_device().memregion("gfx2")->bytes();
1344   UINT8 *src2 = machine.root_device().memregion("gfx3")->base();
1345   int len2 = state->memregion("gfx3")->bytes();
13461346   int i;
13471347   for (i=0; i<len1; i+=32) {
13481348      memcpy(dst,src1,32);
r14976r14977
13531353      src2+=32;
13541354   }
13551355
1356   dst = machine.region("maincpu")->base();
1356   dst = machine.root_device().memregion("maincpu")->base();
13571357   memcpy(state->m_cyclwarr_cpua_ram,dst,8);
1358   memory_set_bankptr(machine, "bank1", dst);
1358   state->membank("bank1")->set_base(dst);
13591359
1360   dst = machine.region("sub")->base();
1360   dst = machine.root_device().memregion("sub")->base();
13611361   memcpy(state->m_cyclwarr_cpub_ram,dst,8);
1362   memory_set_bankptr(machine, "bank2", dst);
1362   state->membank("bank2")->set_base(dst);
13631363
13641364   // Copy sprite & palette data out of GFX rom area
1365   state->m_rom_sprite_lookup1 = machine.region("gfx2")->base();
1366   state->m_rom_sprite_lookup2 = machine.region("gfx3")->base();
1367   state->m_rom_clut0 = machine.region("gfx2")->base() + len1 - 0x1000;
1368   state->m_rom_clut1 = machine.region("gfx3")->base() + len2 - 0x1000;
1365   state->m_rom_sprite_lookup1 = machine.root_device().memregion("gfx2")->base();
1366   state->m_rom_sprite_lookup2 = machine.root_device().memregion("gfx3")->base();
1367   state->m_rom_clut0 = machine.root_device().memregion("gfx2")->base() + len1 - 0x1000;
1368   state->m_rom_clut1 = machine.root_device().memregion("gfx3")->base() + len2 - 0x1000;
13691369
13701370   tatsumi_reset(machine);
13711371}
src/mame/drivers/blmbycar.c
r14976r14977
4343{
4444   if (ACCESSING_BITS_0_7)
4545   {
46      UINT8 *RAM = machine().region("oki")->base();
46      UINT8 *RAM = memregion("oki")->base();
4747      memcpy(&RAM[0x30000], &RAM[0x40000 + 0x10000 * (data & 0xf)], 0x10000);
4848   }
4949}
r14976r14977
521521
522522static DRIVER_INIT( blmbycar )
523523{
524   UINT16 *RAM  = (UINT16 *) machine.region("maincpu")->base();
525   size_t size = machine.region("maincpu")->bytes() / 2;
524   UINT16 *RAM  = (UINT16 *) machine.root_device().memregion("maincpu")->base();
525   size_t size = machine.root_device().memregion("maincpu")->bytes() / 2;
526526   int i;
527527
528528   for (i = 0; i < size; i++)
src/mame/drivers/gbusters.c
r14976r14977
268268static MACHINE_START( gbusters )
269269{
270270   gbusters_state *state = machine.driver_data<gbusters_state>();
271   UINT8 *ROM = machine.region("maincpu")->base();
271   UINT8 *ROM = state->memregion("maincpu")->base();
272272
273   memory_configure_bank(machine, "bank1", 0, 16, &ROM[0x10000], 0x2000);
274   memory_set_bank(machine, "bank1", 0);
273   state->membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x2000);
274   state->membank("bank1")->set_entry(0);
275275
276276   state->m_generic_paletteram_8.allocate(0x800);
277277
r14976r14977
288288static MACHINE_RESET( gbusters )
289289{
290290   gbusters_state *state = machine.driver_data<gbusters_state>();
291   UINT8 *RAM = machine.region("maincpu")->base();
291   UINT8 *RAM = state->memregion("maincpu")->base();
292292
293293   konami_configure_set_lines(machine.device("maincpu"), gbusters_banking);
294294
r14976r14977
425425static KONAMI_SETLINES_CALLBACK( gbusters_banking )
426426{
427427   /* bits 0-3 ROM bank */
428   memory_set_bank(device->machine(),  "bank1", lines & 0x0f);
428   device->machine().root_device().membank("bank1")->set_entry(lines & 0x0f);
429429
430430   if (lines & 0xf0)
431431   {
src/mame/drivers/megaplay.c
r14976r14977
427427static READ8_HANDLER( bank_r )
428428{
429429   mplay_state *state = space->machine().driver_data<mplay_state>();
430   UINT8* bank = space->machine().region("mtbios")->base();
430   UINT8* bank = state->memregion("mtbios")->base();
431431   UINT32 fulladdress = state->m_mp_bios_bank_addr + offset;
432432
433433   if ((fulladdress >= 0x000000) && (fulladdress <= 0x3fffff)) // ROM Addresses
r14976r14977
450450      }
451451      else
452452      {
453         return space->machine().region("maincpu")->base()[fulladdress ^ 1];
453         return space->machine().root_device().memregion("maincpu")->base()[fulladdress ^ 1];
454454      }
455455   }
456456   else if (fulladdress >= 0xa10000 && fulladdress <= 0xa1001f) // IO Acess
r14976r14977
828828
829829static void mplay_start(running_machine &machine)
830830{
831   UINT8 *src = machine.region("mtbios")->base();
832   UINT8 *instruction_rom = machine.region("user1")->base();
833   UINT8 *game_rom = machine.region("maincpu")->base();
831   UINT8 *src = machine.root_device().memregion("mtbios")->base();
832   UINT8 *instruction_rom = machine.root_device().memregion("user1")->base();
833   UINT8 *game_rom = machine.root_device().memregion("maincpu")->base();
834834   int offs;
835835
836836   memmove(src + 0x10000, src + 0x8000, 0x18000); // move bios..
src/mame/drivers/m72.c
r14976r14977
299299READ8_MEMBER(m72_state::m72_mcu_sample_r)
300300{
301301   UINT8 sample;
302   sample = machine().region("samples")->base()[m_mcu_sample_addr++];
302   sample = memregion("samples")->base()[m_mcu_sample_addr++];
303303   return sample;
304304}
305305
r14976r14977
366366   state->m_protection_ram = auto_alloc_array(machine, UINT16, 0x10000/2);
367367   program->install_read_bank(0xb0000, 0xbffff, "bank1");
368368   program->install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::m72_main_mcu_w),state));
369   memory_set_bankptr(machine, "bank1", state->m_protection_ram);
369   state->membank("bank1")->set_base(state->m_protection_ram);
370370
371371   //io->install_legacy_write_handler(0xc0, 0xc1, FUNC(loht_sample_trigger_w));
372372   io->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::m72_main_mcu_sound_w),state));
r14976r14977
383383     * prefetching on the V30.
384384     */
385385   {
386      UINT8 *rom=machine.region("mcu")->base();
386      UINT8 *rom=state->memregion("mcu")->base();
387387
388388      rom[0x12d+5] += 1; printf(" 5: %d\n", rom[0x12d+5]);
389389      rom[0x12d+8] += 5;  printf(" 8: %d\n", rom[0x12d+8]);
r14976r14977
423423#if 0
424424static int find_sample(int num)
425425{
426   UINT8 *rom = machine.region("samples")->base();
427   int len = machine.region("samples")->bytes();
426   UINT8 *rom = machine.root_device().memregion("samples")->base();
427   int len = machine.root_device().memregion("samples")->bytes();
428428   int addr = 0;
429429
430430   while (num--)
r14976r14977
740740   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xb0000, 0xb0fff, "bank1");
741741   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xb0ffa, 0xb0ffb, read16_delegate(FUNC(m72_state::protection_r),state));
742742   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::protection_w),state));
743   memory_set_bankptr(machine, "bank1", state->m_protection_ram);
743   state->membank("bank1")->set_base(state->m_protection_ram);
744744}
745745
746746static DRIVER_INIT( bchopper )
src/mame/drivers/pokechmp.c
r14976r14977
5353
5454WRITE8_MEMBER(pokechmp_state::pokechmp_bank_w)
5555{
56   UINT8 *RAM = machine().region("maincpu")->base();
56   UINT8 *RAM = memregion("maincpu")->base();
5757
5858   if (data == 0x00)
5959   {
60      memory_set_bankptr(machine(), "bank1",&RAM[0x10000]);
61      memory_set_bankptr(machine(), "bank2",&RAM[0x12000]);
60      membank("bank1")->set_base(&RAM[0x10000]);
61      membank("bank2")->set_base(&RAM[0x12000]);
6262   }
6363   if (data == 0x01)
6464   {
65      memory_set_bankptr(machine(), "bank1",&RAM[0x14000]);
66      memory_set_bankptr(machine(), "bank2",&RAM[0x16000]);
65      membank("bank1")->set_base(&RAM[0x14000]);
66      membank("bank2")->set_base(&RAM[0x16000]);
6767   }
6868   if (data == 0x02)
6969   {
70      memory_set_bankptr(machine(), "bank1",&RAM[0x20000]);
71      memory_set_bankptr(machine(), "bank2",&RAM[0x22000]);
70      membank("bank1")->set_base(&RAM[0x20000]);
71      membank("bank2")->set_base(&RAM[0x22000]);
7272   }
7373
7474   if (data == 0x03)
7575   {
76      memory_set_bankptr(machine(), "bank1",&RAM[0x04000]);
77      memory_set_bankptr(machine(), "bank2",&RAM[0x06000]);
76      membank("bank1")->set_base(&RAM[0x04000]);
77      membank("bank2")->set_base(&RAM[0x06000]);
7878   }
7979}
8080
8181#ifdef UNUSED_FUNCTION
8282WRITE8_MEMBER(pokechmp_state::pokechmp_sound_bank_w)
8383{
84   memory_set_bank(machine(), "bank3", (data >> 2) & 1);
84   membank("bank3")->set_entry((data >> 2) & 1);
8585}
8686#endif
8787
r14976r14977
262262
263263static DRIVER_INIT( pokechmp )
264264{
265   memory_configure_bank(machine, "bank3", 0, 2, machine.region("audiocpu")->base() + 0x10000, 0x4000);
265   machine.root_device().membank("bank3")->configure_entries(0, 2, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
266266}
267267
268268
src/mame/drivers/crgolf.c
r14976r14977
4444
4545WRITE8_MEMBER(crgolf_state::rom_bank_select_w)
4646{
47   memory_set_bank(machine(), "bank1", data & 15);
47   membank("bank1")->set_entry(data & 15);
4848}
4949
5050
r14976r14977
5656   state->m_audiocpu = machine.device("audiocpu");
5757
5858   /* configure the banking */
59   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x2000);
60   memory_set_bank(machine, "bank1", 0);
59   state->membank("bank1")->configure_entries(0, 16, state->memregion("maincpu")->base() + 0x10000, 0x2000);
60   state->membank("bank1")->set_entry(0);
6161
6262   /* register for save states */
6363   state->save_item(NAME(state->m_port_select));
r14976r14977
193193   /* only play back if we have data remaining */
194194   if (state->m_sample_count != 0xff)
195195   {
196      UINT8 data = device->machine().region("adpcm")->base()[state->m_sample_offset >> 1];
196      UINT8 data = state->memregion("adpcm")->base()[state->m_sample_offset >> 1];
197197
198198      /* write the next nibble and advance */
199199      msm5205_data_w(device, (data >> (4 * (~state->m_sample_offset & 1))) & 0x0f);
src/mame/drivers/mastboy.c
r14976r14977
542542
543543      if (bank>0x3) // ROM access
544544      {
545         UINT8 *src    = machine().region( "gfx1" )->base();
545         UINT8 *src    = memregion( "gfx1" )->base();
546546         bank &=0x3;
547547         return src[offset+(bank*0x4000)];
548548      }
r14976r14977
558558      UINT8 *src;
559559      int bank;
560560      bank = m_bank & 0x7f;
561      src = machine().region       ( "user1" )->base() + bank * 0x4000;
561      src = memregion       ( "user1" )->base() + bank * 0x4000;
562562      return src[offset];
563563   }
564564}
r14976r14977
997997static DRIVER_INIT( mastboy )
998998{
999999   mastboy_state *state = machine.driver_data<mastboy_state>();
1000   state->m_vram = machine.region( "gfx1" )->base(); // makes decoding the RAM based tiles easier this way
1000   state->m_vram = state->memregion( "gfx1" )->base(); // makes decoding the RAM based tiles easier this way
10011001}
10021002
10031003GAME( 1991, mastboy,  0,          mastboy, mastboy, mastboy, ROT0, "Gaelco", "Master Boy (Spanish, PCB Rev A)", 0 )
src/mame/drivers/rmhaihai.c
r14976r14977
155155
156156READ8_MEMBER(rmhaihai_state::samples_r)
157157{
158   return machine().region("adpcm")->base()[offset];
158   return memregion("adpcm")->base()[offset];
159159}
160160
161161static WRITE8_DEVICE_HANDLER( adpcm_w )
r14976r14977
181181
182182WRITE8_MEMBER(rmhaihai_state::themj_rombank_w)
183183{
184   UINT8 *rom = machine().region("maincpu")->base() + 0x10000;
184   UINT8 *rom = memregion("maincpu")->base() + 0x10000;
185185   int bank = data & 0x03;
186186logerror("banksw %d\n",bank);
187   memory_set_bankptr(machine(), "bank1", rom + bank*0x4000);
188   memory_set_bankptr(machine(), "bank2", rom + bank*0x4000 + 0x2000);
187   membank("bank1")->set_base(rom + bank*0x4000);
188   membank("bank2")->set_base(rom + bank*0x4000 + 0x2000);
189189}
190190
191191static MACHINE_RESET( themj )
r14976r14977
665665
666666static DRIVER_INIT( rmhaihai )
667667{
668   UINT8 *rom = machine.region("gfx1")->base();
669   int size = machine.region("gfx1")->bytes();
668   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
669   int size = machine.root_device().memregion("gfx1")->bytes();
670670   int a,b;
671671
672672   size /= 2;
src/mame/drivers/topspeed.c
r14976r14977
392392static void reset_sound_region( running_machine &machine )
393393{
394394   topspeed_state *state = machine.driver_data<topspeed_state>();
395   memory_set_bank(machine,  "bank10", state->m_banknum);
395   state->membank("bank10")->set_entry(state->m_banknum);
396396}
397397
398398static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )   /* assumes Z80 sandwiched between 68Ks */
r14976r14977
412412   }
413413   else
414414   {
415      state->m_adpcm_data = device->machine().region("adpcm")->base()[state->m_adpcm_pos];
415      state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos];
416416      state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0x1ffff;
417417      msm5205_data_w(device, state->m_adpcm_data >> 4);
418418   }
r14976r14977
646646{
647647   topspeed_state *state = machine.driver_data<topspeed_state>();
648648
649   memory_configure_bank(machine, "bank10", 0, 4, machine.region("audiocpu")->base() + 0xc000, 0x4000);
649   state->membank("bank10")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0xc000, 0x4000);
650650
651651   state->m_maincpu = machine.device("maincpu");
652652   state->m_subcpu = machine.device("sub");
src/mame/drivers/segae.c
r14976r14977
427427{
428428   m_f7_bank_value = data;
429429
430   memory_set_bankptr(machine(), "vdp1_bank", m_vdp1_vram->base() + ( ( data & 0x80 ) ? 0x4000 : 0 ) );
431   memory_set_bankptr(machine(), "vdp2_bank", m_vdp2_vram->base() + ( ( data & 0x40 ) ? 0x4000 : 0 ) );
430   membank("vdp1_bank")->set_base(m_vdp1_vram->base() + ( ( data & 0x80 ) ? 0x4000 : 0 ) );
431   membank("vdp2_bank")->set_base(m_vdp2_vram->base() + ( ( data & 0x40 ) ? 0x4000 : 0 ) );
432432
433   memory_set_bank(machine(), "bank1", data & 0x0f);
433   membank("bank1")->set_entry(data & 0x0f);
434434}
435435
436436
437437void systeme_state::driver_start()
438438{
439439   /* Allocate video RAM */
440   m_vdp1_vram = machine().region_alloc("vdp1_vram", 2 * 0x4000, 1, ENDIANNESS_LITTLE);
441   m_vdp2_vram = machine().region_alloc("vdp2_vram", 2 * 0x4000, 1, ENDIANNESS_LITTLE);
440   m_vdp1_vram = machine().memory().region_alloc("vdp1_vram", 2 * 0x4000, 1, ENDIANNESS_LITTLE);
441   m_vdp2_vram = machine().memory().region_alloc("vdp2_vram", 2 * 0x4000, 1, ENDIANNESS_LITTLE);
442442
443   memory_configure_bank(machine(), "bank1", 0, 16, machine().region("maincpu")->base() + 0x10000, 0x4000);
443   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
444444
445445   if ( !strcmp( system().name, "ridleofp" ) )
446446   {
src/mame/drivers/amspdwy.c
r14976r14977
9393
9494READ8_MEMBER(amspdwy_state::amspdwy_port_r)
9595{
96   UINT8 *tracks = machine().region("maincpu")->base() + 0x10000;
96   UINT8 *tracks = memregion("maincpu")->base() + 0x10000;
9797   return tracks[offset];
9898}
9999
src/mame/drivers/fantland.c
r14976r14977
368368   if (!state->m_adpcm_playing[voice])
369369      return;
370370
371   rom = device->machine().region("adpcm")->base();
372   len = device->machine().region("adpcm")->bytes() * 2;
371   rom = device->machine().root_device().memregion("adpcm")->base();
372   len = state->memregion("adpcm")->bytes() * 2;
373373
374374   start = state->m_adpcm_addr[0][voice] + state->m_adpcm_nibble[voice];
375375   stop = state->m_adpcm_addr[1][voice];
src/mame/drivers/legionna.c
r14976r14977
21882188static DRIVER_INIT( cupsoc )
21892189{
21902190   #if CUPSOC_DEBUG_MODE
2191   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2191   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
21922192
21932193   /*Press p1 button 3 to enter into debug mode during gameplay*/
21942194   ROM[0xffffb/2] = 0x0000;
r14976r14977
22002200static DRIVER_INIT( denjinmk )
22012201{
22022202   /* problem with audio comms? */
2203   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2203   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
22042204   ROM[0x5fe4/2] = 0x4e71;
22052205}
22062206
22072207static DRIVER_INIT( legiongfx )
22082208{
2209   descramble_legionnaire_gfx( machine, machine.region("gfx5")->base() );
2209   descramble_legionnaire_gfx( machine, machine.root_device().memregion("gfx5")->base() );
22102210}
22112211
22122212
src/mame/drivers/albazc.c
r14976r14977
4040
4141static PALETTE_INIT( hanaroku )
4242{
43   const UINT8 *color_prom = machine.region("proms")->base();
43   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
4444   int i;
4545   int r, g, b;
4646
src/mame/drivers/midas.c
r14976r14977
870870
871871static DRIVER_INIT( livequiz )
872872{
873   UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
873   UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
874874
875875   // PROTECTION CHECKS
876876   rom[0x13345a/2]   =   0x4e75;
src/mame/drivers/aristmk4.c
r14976r14977
15871587/* same as Casino Winner HW */
15881588static PALETTE_INIT( aristmk4 )
15891589{
1590   const UINT8 *color_prom = machine.region("proms")->base();
1590   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
15911591   int i;
15921592
15931593   for (i = 0;i < machine.total_colors();i++)
r14976r14977
16141614static DRIVER_INIT( aristmk4 )
16151615{
16161616   aristmk4_state *state = machine.driver_data<aristmk4_state>();
1617   state->m_shapeRomPtr = (UINT8 *)machine.region("tile_gfx")->base();
1617   state->m_shapeRomPtr = (UINT8 *)state->memregion("tile_gfx")->base();
16181618   memcpy(state->m_shapeRom,state->m_shapeRomPtr,sizeof(state->m_shapeRom)); // back up
16191619   state->m_nvram = auto_alloc_array(machine, UINT8, 0x1000);
16201620}
src/mame/drivers/thunderx.c
r14976r14977
315315
316316WRITE8_MEMBER(thunderx_state::scontra_bankswitch_w)
317317{
318   UINT8 *RAM = machine().region("maincpu")->base();
318   UINT8 *RAM = memregion("maincpu")->base();
319319   int offs;
320320
321321//logerror("%04x: bank switch %02x\n",cpu_get_pc(&space.device()),data);
322322
323323   /* bits 0-3 ROM bank */
324324   offs = 0x10000 + (data & 0x0f)*0x2000;
325   memory_set_bankptr(machine(),  "bank1", &RAM[offs] );
325   membank("bank1")->set_base(&RAM[offs] );
326326
327327   /* bit 4 select work RAM or palette RAM at 5800-5fff */
328328   m_palette_selected = ~data & 0x10;
r14976r14977
624624static MACHINE_START( thunderx )
625625{
626626   thunderx_state *state = machine.driver_data<thunderx_state>();
627   UINT8 *ROM = machine.region("maincpu")->base();
627   UINT8 *ROM = state->memregion("maincpu")->base();
628628
629   memory_configure_bank(machine, "bank1", 0, 12, &ROM[0x10000], 0x2000);
630   memory_configure_bank(machine, "bank1", 12, 4, &ROM[0x08000], 0x2000);
631   memory_set_bank(machine, "bank1", 0);
629   state->membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x2000);
630   state->membank("bank1")->configure_entries(12, 4, &ROM[0x08000], 0x2000);
631   state->membank("bank1")->set_entry(0);
632632
633633   memset(state->m_pmcram, 0, sizeof(state->m_pmcram));
634634
r14976r14977
991991static KONAMI_SETLINES_CALLBACK( thunderx_banking )
992992{
993993   //logerror("thunderx %04x: bank select %02x\n", cpu_get_pc(device->cpu), lines);
994   memory_set_bank(device->machine(),  "bank1", ((lines & 0x0f) ^ 0x08));
994   device->machine().root_device().membank("bank1")->set_entry(((lines & 0x0f) ^ 0x08));
995995}
996996
997997GAME( 1988, scontra,   0,        scontra,  scontra,  0, ROT90, "Konami", "Super Contra", GAME_SUPPORTS_SAVE )
src/mame/drivers/murogmbl.c
r14976r14977
5151
5252static PALETTE_INIT( murogmbl )
5353{
54   const UINT8 *color_prom = machine.region("proms")->base();
54   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5555   int   bit0, bit1, bit2 , r, g, b;
5656   int   i;
5757
src/mame/drivers/sothello.c
r14976r14977
8080
8181WRITE8_MEMBER(sothello_state::bank_w)
8282{
83    UINT8 *RAM = machine().region("maincpu")->base();
83    UINT8 *RAM = memregion("maincpu")->base();
8484    int bank=0;
8585    switch(data^0xff)
8686    {
r14976r14977
8989        case 4: bank=2; break;
9090        case 8: bank=3; break;
9191    }
92    memory_set_bankptr(machine(),"bank1",&RAM[bank*0x4000+0x10000]);
92    membank("bank1")->set_base(&RAM[bank*0x4000+0x10000]);
9393}
9494
9595static TIMER_CALLBACK( subcpu_suspend )
src/mame/drivers/tumbleb.c
r14976r14977
490490/* we use channels 1,2,3 for sound effects, and channel 4 for music */
491491static void tumbleb2_set_music_bank( running_machine &machine, int bank )
492492{
493   UINT8 *oki = machine.region("oki")->base();
493   UINT8 *oki = machine.root_device().memregion("oki")->base();
494494   memcpy(&oki[0x38000], &oki[0x80000 + 0x38000 + 0x8000 * bank], 0x8000);
495495}
496496
r14976r14977
783783
784784WRITE8_MEMBER(tumbleb_state::oki_sound_bank_w)
785785{
786   UINT8 *oki = machine().region("oki")->base();
786   UINT8 *oki = memregion("oki")->base();
787787   memcpy(&oki[0x30000], &oki[(data * 0x10000) + 0x40000], 0x10000);
788788}
789789
r14976r14977
808808
809809WRITE8_MEMBER(tumbleb_state::jumppop_z80_bank_w)
810810{
811   memory_set_bankptr(machine(), "bank1", machine().region("audiocpu")->base() + 0x10000 + (0x4000 * data));
811   membank("bank1")->set_base(machine().root_device().memregion("audiocpu")->base() + 0x10000 + (0x4000 * data));
812812}
813813
814814static ADDRESS_MAP_START( jumppop_sound_map, AS_PROGRAM, 8, tumbleb_state )
r14976r14977
856856
857857WRITE8_MEMBER(tumbleb_state::jumpkids_oki_bank_w)
858858{
859   UINT8* sound1 = machine().region("oki")->base();
860   UINT8* sound2 = machine().region("oki2")->base();
859   UINT8* sound1 = memregion("oki")->base();
860   UINT8* sound2 = memregion("oki2")->base();
861861   int bank = data & 0x03;
862862
863863   memcpy(sound1 + 0x20000, sound2 + bank * 0x20000, 0x20000);
r14976r14977
22272227   tumbleb_state *state = machine.driver_data<tumbleb_state>();
22282228
22292229   /* copy protection data every reset */
2230   UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
2231   int i, len = machine.region("user1")->bytes();
2230   UINT16 *PROTDATA = (UINT16*)machine.root_device().memregion("user1")->base();
2231   int i, len = state->memregion("user1")->bytes();
22322232
22332233   for (i = 0; i < len / 2; i++)
22342234      state->m_mainram[0x000/2 + i] = PROTDATA[i];
r14976r14977
33623362void tumblepb_patch_code(running_machine &machine, UINT16 offset)
33633363{
33643364   /* A hack which enables all Dip Switches effects */
3365   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
3365   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
33663366   RAM[(offset + 0)/2] = 0x0240;
33673367   RAM[(offset + 2)/2] = 0xffff;   // andi.w  #$f3ff, D0
33683368}
r14976r14977
33713371
33723372static void tumblepb_gfx1_rearrange(running_machine &machine)
33733373{
3374   UINT8 *rom = machine.region("gfx1")->base();
3375   int len = machine.region("gfx1")->bytes();
3374   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
3375   int len = machine.root_device().memregion("gfx1")->bytes();
33763376   int i;
33773377
33783378   /* gfx data is in the wrong order */
r14976r14977
34293429   #if FNCYWLD_HACK
34303430   /* This is a hack to allow you to use the extra features
34313431       of the 2 first "Unused" Dip Switch (see notes above). */
3432   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
3432   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
34333433   RAM[0x0005fa/2] = 0x4e71;
34343434   RAM[0x00060a/2] = 0x4e71;
34353435   #endif
r14976r14977
34563456{
34573457
34583458   tumbleb_state *state = machine.driver_data<tumbleb_state>();
3459//  UINT16 *HCROM = (UINT16*)machine.region("maincpu")->base();
3460   UINT16 *PROTDATA = (UINT16*)machine.region("user1")->base();
3461   int i, len = machine.region("user1")->bytes();
3459//  UINT16 *HCROM = (UINT16*)machine.root_device().memregion("maincpu")->base();
3460   UINT16 *PROTDATA = (UINT16*)machine.root_device().memregion("user1")->base();
3461   int i, len = state->memregion("user1")->bytes();
34623462   /* simulate RAM initialization done by the protection MCU */
34633463   /* verified on real hardware */
34643464//  static const UINT16 htchctch_mcu68k[] =
r14976r14977
37103710
37113711static void suprtrio_decrypt_code(running_machine &machine)
37123712{
3713   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
3713   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
37143714   UINT16 *buf = auto_alloc_array(machine, UINT16, 0x80000/2);
37153715   int i;
37163716
r14976r14977
37283728
37293729static void suprtrio_decrypt_gfx(running_machine &machine)
37303730{
3731   UINT16 *rom = (UINT16 *)machine.region("gfx1")->base();
3731   UINT16 *rom = (UINT16 *)machine.root_device().memregion("gfx1")->base();
37323732   UINT16 *buf = auto_alloc_array(machine, UINT16, 0x100000/2);
37333733   int i;
37343734
src/mame/drivers/cd32.c
r14976r14977
5656      data = (data >> 16) & 1;
5757
5858      /* switch banks as appropriate */
59      memory_set_bank(machine(), "bank1", data & 1);
59      membank("bank1")->set_entry(data & 1);
6060
6161      /* swap the write handlers between ROM and bank 1 based on the bit */
6262      if ((data & 1) == 0)
r14976r14977
853853   amiga_machine_config(machine, &cd32_intf);
854854
855855   /* set up memory */
856   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
857   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
856   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
857   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
858858
859859   /* input hack */
860860   state->m_input_hack = NULL;
r14976r14977
14721472   amiga_machine_config(machine, &cd32_intf);
14731473
14741474   /* set up memory */
1475   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
1476   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
1475   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
1476   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
14771477
14781478   /* input hack */
14791479   state->m_input_hack = NULL;
src/mame/drivers/momoko.c
r14976r14977
4949
5050WRITE8_MEMBER(momoko_state::momoko_bg_read_bank_w)
5151{
52   memory_set_bank(machine(), "bank1", data & 0x1f);
52   membank("bank1")->set_entry(data & 0x1f);
5353}
5454
5555/****************************************************************************/
r14976r14977
228228static MACHINE_START( momoko )
229229{
230230   momoko_state *state = machine.driver_data<momoko_state>();
231   UINT8 *BG_MAP = machine.region("user1")->base();
231   UINT8 *BG_MAP = state->memregion("user1")->base();
232232
233   memory_configure_bank(machine, "bank1", 0, 32, &BG_MAP[0x0000], 0x1000);
233   state->membank("bank1")->configure_entries(0, 32, &BG_MAP[0x0000], 0x1000);
234234
235235   state->save_item(NAME(state->m_fg_scrollx));
236236   state->save_item(NAME(state->m_fg_scrolly));
src/mame/drivers/cabaret.c
r14976r14977
361361
362362static DRIVER_INIT( cabaret )
363363{
364   UINT8 *rom = machine.region("maincpu")->base();
364   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
365365   int i;
366366
367367   /* decrypt the program ROM */
src/mame/drivers/kchamp.c
r14976r14977
724724{
725725   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
726726   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000);
727   UINT8 *rom = machine.region("maincpu")->base();
727   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
728728   int A;
729729
730730   space->set_decrypted_region(0x0000, 0xffff, decrypted);
r14976r14977
739739static DRIVER_INIT( kchampvs )
740740{
741741   kchamp_state *state = machine.driver_data<kchamp_state>();
742   UINT8 *rom = machine.region("maincpu")->base();
742   UINT8 *rom = state->memregion("maincpu")->base();
743743   UINT8 *decrypted = decrypt_code(machine);
744744   int A;
745745
src/mame/drivers/olibochu.c
r14976r14977
8787
8888static PALETTE_INIT( olibochu )
8989{
90   const UINT8 *color_prom = machine.region("proms")->base();
90   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9191   int i;
9292
9393   for (i = 0; i < machine.total_colors(); i++)
src/mame/drivers/m90.c
r14976r14977
5151WRITE16_MEMBER(m90_state::quizf1_bankswitch_w)
5252{
5353   if (ACCESSING_BITS_0_7)
54      memory_set_bank(machine(), "bank1", data & 0xf);
54      membank("bank1")->set_entry(data & 0xf);
5555}
5656
5757WRITE16_MEMBER(m90_state::dynablsb_sound_command_w)
r14976r14977
11861186static DRIVER_INIT( quizf1 )
11871187{
11881188   m90_state *state = machine.driver_data<m90_state>();
1189   memory_configure_bank(machine, "bank1", 0, 16, machine.region("user1")->base(), 0x10000);
1189   state->membank("bank1")->configure_entries(0, 16, state->memregion("user1")->base(), 0x10000);
11901190   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x04, 0x05, write16_delegate(FUNC(m90_state::quizf1_bankswitch_w),state));
11911191}
11921192
r14976r14977
11941194
11951195static DRIVER_INIT( bomblord )
11961196{
1197   UINT16 *ROM = (UINT16 *)(machine.region("maincpu")->base());
1197   UINT16 *ROM = (UINT16 *)(machine.root_device().memregion("maincpu")->base());
11981198
11991199   for (int i = 0; i < 0x100000 / 2; i += 4)
12001200   {
src/mame/drivers/tugboat.c
r14976r14977
5151    just four 1k resistors. */
5252static PALETTE_INIT( tugboat )
5353{
54   const UINT8 *color_prom = machine.region("proms")->base();
54   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5555   int i;
5656
5757
src/mame/drivers/kingdrby.c
r14976r14977
954954
955955static PALETTE_INIT(kingdrby)
956956{
957   const UINT8 *color_prom = machine.region("proms")->base();
957   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
958958   int   bit0, bit1, bit2 , r, g, b;
959959   int   i;
960960
r14976r14977
980980
981981static PALETTE_INIT(kingdrbb)
982982{
983   UINT8 *raw_prom = machine.region("raw_prom")->base();
984   UINT8 *prom = machine.region("proms")->base();
983   UINT8 *raw_prom = machine.root_device().memregion("raw_prom")->base();
984   UINT8 *prom = machine.root_device().memregion("proms")->base();
985985   int   bit0, bit1, bit2 , r, g, b;
986986   int   i;
987987
src/mame/drivers/r2dx_v33.c
r14976r14977
227227      if(frame == 5)
228228      {
229229         int i,data;
230         static UINT8 *rom = space->machine().region("mainprg")->base();
230         static UINT8 *rom = space->machine().root_device().memregion("mainprg")->base();
231231
232232         for(i=0;i<0x800;i+=2)
233233         {
r14976r14977
733733
734734static DRIVER_INIT(rdx_v33)
735735{
736   memory_configure_bank(machine, "bank1", 0, 0x20, machine.region("mainprg")->base(), 0x20000);
736   machine.root_device().membank("bank1")->configure_entries(0, 0x20, machine.root_device().memregion("mainprg")->base(), 0x20000);
737737
738738   raiden2_decrypt_sprites(machine);
739739
740   memory_set_bank(machine, "bank1", 1);
740   machine.root_device().membank("bank1")->set_entry(1);
741741}
742742
743743static DRIVER_INIT(nzerotea)
744744{
745   memory_configure_bank(machine, "bank1", 0, 2, machine.region("mainprg")->base(), 0x20000);
745   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("mainprg")->base(), 0x20000);
746746
747747   zeroteam_decrypt_sprites(machine);
748748
749   memory_set_bank(machine, "bank1", 1);
749   machine.root_device().membank("bank1")->set_entry(1);
750750
751751}
752752
src/mame/drivers/phoenix.c
r14976r14977
446446
447447static MACHINE_RESET( phoenix )
448448{
449   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x4000);
449   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000);
450450}
451451
452452
src/mame/drivers/lastfght.c
r14976r14977
148148#if 1
149149   // gfx roms viewer (toggle with enter, use pgup/down to browse)
150150   int x, y, count = 0;
151   UINT8 *gfxdata = screen.machine().region("gfx1")->base();
151   UINT8 *gfxdata = screen.machine().root_device().memregion("gfx1")->base();
152152   UINT8 data;
153153
154154   if (screen.machine().input().code_pressed_once(KEYCODE_ENTER))   state->m_view_roms ^= 1;
r14976r14977
156156   {
157157      if (screen.machine().input().code_pressed_once(KEYCODE_PGDN))   state->m_base += 512 * 256;
158158      if (screen.machine().input().code_pressed_once(KEYCODE_PGUP))   state->m_base -= 512 * 256;
159      state->m_base %= screen.machine().region("gfx1")->bytes();
159      state->m_base %= state->memregion("gfx1")->bytes();
160160
161161      count = state->m_base;
162162
r14976r14977
330330   if (ACCESSING_BITS_8_15)
331331   {
332332      int x, y, addr;
333      UINT8 *gfxdata = machine().region( "gfx1" )->base();
333      UINT8 *gfxdata = memregion( "gfx1" )->base();
334334      bitmap_ind16 &dest = m_bitmap[m_dest];
335335
336336#if 0
r14976r14977
621621
622622static DRIVER_INIT(lastfght)
623623{
624   UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
624   UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
625625
626626   // pass initial check (protection ? hw?)
627627   rom[0x00354 / 2] = 0x403e;
src/mame/drivers/superqix.c
r14976r14977
112112{
113113   superqix_state *state = device.machine().driver_data<superqix_state>();
114114   running_machine &machine = device.machine();
115   UINT8 *src = machine.region("samples")->base();
116   int i, len = machine.region("samples")->bytes();
115   UINT8 *src = machine.root_device().memregion("samples")->base();
116   int i, len = state->memregion("samples")->bytes();
117117
118118   /* convert 8-bit unsigned samples to 8-bit signed */
119119   state->m_samplebuf = auto_alloc_array(machine, INT16, len);
r14976r14977
124124WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w)
125125{
126126   samples_device *samples = machine().device<samples_device>("samples");
127   UINT8 *src = machine().region("samples")->base();
128   int len = machine().region("samples")->bytes();
127   UINT8 *src = memregion("samples")->base();
128   int len = memregion("samples")->bytes();
129129   int start,end;
130130
131131   start = data << 7;
r14976r14977
548548static MACHINE_START( superqix )
549549{
550550   /* configure the banks */
551   memory_configure_bank(machine, "bank1", 0, 4, machine.region("maincpu")->base() + 0x10000, 0x4000);
551   machine.root_device().membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
552552
553553   machine_init_common(machine);
554554}
r14976r14977
556556static MACHINE_START( pbillian )
557557{
558558   /* configure the banks */
559   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x4000);
559   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
560560
561561   machine_init_common(machine);
562562}
r14976r14977
13631363   int i,j;
13641364
13651365   /* decrypt program code; the address lines are shuffled around in a non-trivial way */
1366   src = machine.region("maincpu")->base();
1367   len = machine.region("maincpu")->bytes();
1366   src = machine.root_device().memregion("maincpu")->base();
1367   len = machine.root_device().memregion("maincpu")->bytes();
13681368   for (i = 0;i < len;i += 16)
13691369   {
13701370      memcpy(temp,&src[i],16);
r14976r14977
13831383   }
13841384
13851385   /* decrypt gfx ROMs; simple bit swap on the address lines */
1386   src = machine.region("gfx1")->base();
1387   len = machine.region("gfx1")->bytes();
1386   src = machine.root_device().memregion("gfx1")->base();
1387   len = machine.root_device().memregion("gfx1")->bytes();
13881388   for (i = 0;i < len;i += 16)
13891389   {
13901390      memcpy(temp,&src[i],16);
r14976r14977
13941394      }
13951395   }
13961396
1397   src = machine.region("gfx2")->base();
1398   len = machine.region("gfx2")->bytes();
1397   src = machine.root_device().memregion("gfx2")->base();
1398   len = machine.root_device().memregion("gfx2")->bytes();
13991399   for (i = 0;i < len;i += 16)
14001400   {
14011401      memcpy(temp,&src[i],16);
r14976r14977
14051405      }
14061406   }
14071407
1408   src = machine.region("gfx3")->base();
1409   len = machine.region("gfx3")->bytes();
1408   src = machine.root_device().memregion("gfx3")->base();
1409   len = machine.root_device().memregion("gfx3")->bytes();
14101410   for (i = 0;i < len;i += 16)
14111411   {
14121412      memcpy(temp,&src[i],16);
src/mame/drivers/vega.c
r14976r14977
106106DRIVER_INIT(vegaa)
107107{
108108   UINT8* buf = (UINT8*)malloc(0x10000);
109   UINT8* rom = machine.region("maincpu")->base();
109   UINT8* rom = machine.root_device().memregion("maincpu")->base();
110110   int i;
111111   int count = 0;
112112   // last 0xc bytes of file are just some settings, ignore
src/mame/drivers/bfm_sc4h.c
r14976r14977
568568static MACHINE_START( sc4 )
569569{
570570   sc4_state *state = machine.driver_data<sc4_state>();
571   state->m_cpuregion = (UINT16*)machine.region( "maincpu" )->base();
571   state->m_cpuregion = (UINT16*)state->memregion( "maincpu" )->base();
572572   state->m_mainram = (UINT16*)auto_alloc_array_clear(machine, UINT16, 0x10000);
573573   state->m_duart = machine.device("duart68681");
574574   state->m_ymz = machine.device("ymz");
src/mame/drivers/warpsped.c
r14976r14977
121121   UINT8 code = 0x3f;
122122   if ( tile_index & 1 )
123123   {
124      code = machine.region("starfield")->base()[tile_index >> 1] & 0x3f;
124      code = machine.root_device().memregion("starfield")->base()[tile_index >> 1] & 0x3f;
125125   }
126126   SET_TILE_INFO(1, code, 0, 0);
127127}
src/mame/drivers/rltennis.c
r14976r14977
162162   state->m_screen = machine.device(  "screen");
163163   state->m_dac_1 = machine.device("dac1");
164164   state->m_dac_2 = machine.device("dac2");
165   state->m_samples_1 = machine.region("samples1")->base();
166   state->m_samples_2 = machine.region("samples2")->base();
167   state->m_gfx =  machine.region("gfx1")->base();
165   state->m_samples_1 = machine.root_device().memregion("samples1")->base();
166   state->m_samples_2 = machine.root_device().memregion("samples2")->base();
167   state->m_gfx =  state->memregion("gfx1")->base();
168168   state->m_timer = machine.scheduler().timer_alloc(FUNC(sample_player));
169169}
170170
src/mame/drivers/gei.c
r14976r14977
269269
270270WRITE8_MEMBER(gei_state::banksel_main_w)
271271{
272   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x8000);
272   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x8000);
273273}
274274WRITE8_MEMBER(gei_state::banksel_1_w)
275275{
276   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x10000);
276   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
277277}
278278WRITE8_MEMBER(gei_state::banksel_2_w)
279279{
280   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x18000);
280   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000);
281281}
282282WRITE8_MEMBER(gei_state::banksel_3_w)
283283{
284   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x20000);
284   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x20000);
285285}
286286WRITE8_MEMBER(gei_state::banksel_4_w)
287287{
288   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x28000);
288   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x28000);
289289}
290290WRITE8_MEMBER(gei_state::banksel_5_w)
291291{
292   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x30000);
292   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x30000);
293293}
294294
295295WRITE8_MEMBER(gei_state::banksel_1_1_w)
296296{
297   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x10000);
297   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
298298}
299299WRITE8_MEMBER(gei_state::banksel_2_1_w)
300300{
301   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x14000);
301   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x14000);
302302}
303303WRITE8_MEMBER(gei_state::banksel_3_1_w)
304304{
305   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x18000);
305   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000);
306306}
307307WRITE8_MEMBER(gei_state::banksel_4_1_w)
308308{
309   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x1c000);
309   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1c000);
310310}
311311WRITE8_MEMBER(gei_state::banksel_5_1_w)
312312{
313   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x20000);
313   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x20000);
314314}
315315WRITE8_MEMBER(gei_state::banksel_1_2_w)
316316{
317   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x12000);
317   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x12000);
318318}
319319WRITE8_MEMBER(gei_state::banksel_2_2_w)
320320{
321   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x16000);
321   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x16000);
322322}
323323WRITE8_MEMBER(gei_state::banksel_3_2_w)
324324{
325   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x1a000);
325   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1a000);
326326}
327327WRITE8_MEMBER(gei_state::banksel_4_2_w)
328328{
329   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x1e000);
329   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1e000);
330330}
331331WRITE8_MEMBER(gei_state::banksel_5_2_w)
332332{
333   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x22000);
333   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x22000);
334334}
335335
336336WRITE8_MEMBER(gei_state::geimulti_bank_w)
r14976r14977
358358   }
359359
360360   if (bank != -1)
361      memory_set_bankptr(machine(), "bank1", machine().region("bank")->base() + bank*0x8000);
361      membank("bank1")->set_base(machine().root_device().memregion("bank")->base() + bank*0x8000);
362362}
363363
364364READ8_MEMBER(gei_state::banksel_1_r)
365365{
366   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x10000);
366   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
367367   return 0x03;
368368};
369369
370370READ8_MEMBER(gei_state::banksel_2_r)
371371{
372   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x18000);
372   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000);
373373   return 0x03;
374374}
375375
376376READ8_MEMBER(gei_state::banksel_3_r)
377377{
378   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x20000);
378   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x20000);
379379   return 0x03;
380380}
381381
382382READ8_MEMBER(gei_state::banksel_4_r)
383383{
384   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x28000);
384   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x28000);
385385   return 0x03;
386386}
387387
388388READ8_MEMBER(gei_state::banksel_5_r)
389389{
390   memory_set_bankptr(machine(), "bank1",machine().region("maincpu")->base() + 0x30000);
390   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x30000);
391391   return 0x03;
392392}
393393
r14976r14977
18731873
18741874static DRIVER_INIT( setbank )
18751875{
1876   memory_set_bankptr(machine, "bank1",machine.region("maincpu")->base() + 0x2000);
1876   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x2000);
18771877}
18781878
18791879static DRIVER_INIT( geimulti )
18801880{
1881   memory_set_bankptr(machine, "bank1",machine.region("bank")->base() + 0x0000);
1881   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("bank")->base() + 0x0000);
18821882}
18831883
18841884GAME( 1982, jokpoker, 0,        gselect,  gselect,  setbank, ROT0, "Greyhound Electronics", "Joker Poker (Version 16.03B)",            GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
src/mame/drivers/segas32.c
r14976r14977
11301130WRITE8_MEMBER(segas32_state::sound_bank_lo_w)
11311131{
11321132   m_sound_bank = (m_sound_bank & ~0x3f) | (data & 0x3f);
1133   memory_set_bankptr(machine(), "bank1", machine().region("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
1133   membank("bank1")->set_base(machine().root_device().memregion("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
11341134}
11351135
11361136
11371137WRITE8_MEMBER(segas32_state::sound_bank_hi_w)
11381138{
11391139   m_sound_bank = (m_sound_bank & 0x3f) | ((data & 0x04) << 4) | ((data & 0x03) << 7);
1140   memory_set_bankptr(machine(), "bank1", machine().region("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
1140   membank("bank1")->set_base(machine().root_device().memregion("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
11411141}
11421142
11431143
r14976r14977
41454145{
41464146   segas32_state *state = machine.driver_data<segas32_state>();
41474147   /* Temp. Patch until we emulate the 'Drive Board', thanks to Malice */
4148   UINT16 *pROM = (UINT16 *)machine.region("maincpu")->base();
4148   UINT16 *pROM = (UINT16 *)state->memregion("maincpu")->base();
41494149
41504150   segas32_common_init(machine, read16_delegate(FUNC(segas32_state::analog_custom_io_r),state), write16_delegate(FUNC(segas32_state::analog_custom_io_w),state));
41514151
src/mame/drivers/looping.c
r14976r14977
145145
146146static PALETTE_INIT( looping )
147147{
148   const UINT8 *color_prom = machine.region("proms")->base();
148   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
149149   static const int resistances[3] = { 1000, 470, 220 };
150150   double rweights[3], gweights[3], bweights[2];
151151   int i;
r14976r14977
900900static DRIVER_INIT( looping )
901901{
902902   looping_state *state = machine.driver_data<looping_state>();
903   int length = machine.region("maincpu")->bytes();
904   UINT8 *rom = machine.region("maincpu")->base();
903   int length = machine.root_device().memregion("maincpu")->bytes();
904   UINT8 *rom = state->memregion("maincpu")->base();
905905   int i;
906906
907907   state->m_cop_io = auto_alloc_array(machine, UINT8, 0x08);
src/mame/drivers/slapfght.c
r14976r14977
18291829static DRIVER_INIT( gtstarb1 )
18301830{
18311831   slapfght_state *state = machine.driver_data<slapfght_state>();
1832   UINT8 *ROM = machine.region("maincpu")->base();
1832   UINT8 *ROM = state->memregion("maincpu")->base();
18331833
18341834   state->m_getstar_id = GTSTARB1;
18351835   getstar_init(machine);
src/mame/drivers/badlands.c
r14976r14977
586586   badlands_state *state = machine.driver_data<badlands_state>();
587587
588588   /* initialize the audio system */
589   state->m_bank_base = &machine.region("audiocpu")->base()[0x03000];
590   state->m_bank_source_data = &machine.region("audiocpu")->base()[0x10000];
589   state->m_bank_base = &machine.root_device().memregion("audiocpu")->base()[0x03000];
590   state->m_bank_source_data = &state->memregion("audiocpu")->base()[0x10000];
591591}
592592
593593
src/mame/drivers/psikyosh.c
r14976r14977
380380   if (offset == 4) /* Configure bank for gfx test */
381381   {
382382      if (ACCESSING_BITS_0_15)   // Bank
383         memory_set_bank(machine(), "bank2", m_vidregs[offset] & 0xfff);
383         membank("bank2")->set_entry(m_vidregs[offset] & 0xfff);
384384   }
385385}
386386
r14976r14977
799799
800800   state->m_maincpu = machine.device("maincpu");
801801
802   memory_configure_bank(machine, "bank2", 0, 0x1000, machine.region("gfx1")->base(), 0x20000);
802   state->membank("bank2")->configure_entries(0, 0x1000, state->memregion("gfx1")->base(), 0x20000);
803803}
804804
805805
r14976r14977
12181218
12191219static DRIVER_INIT( daraku )
12201220{
1221   UINT8 *RAM = machine.region("maincpu")->base();
1222   memory_set_bankptr(machine, "bank1", &RAM[0x100000]);
1221   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
1222   machine.root_device().membank("bank1")->set_base(&RAM[0x100000]);
12231223   sh2drc_set_options(machine.device("maincpu"), SH2DRC_FASTEST_OPTIONS);
12241224}
12251225
r14976r14977
12301230
12311231static DRIVER_INIT( gunbird2 )
12321232{
1233   UINT8 *RAM = machine.region("maincpu")->base();
1234   memory_set_bankptr(machine, "bank1", &RAM[0x100000]);
1233   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
1234   machine.root_device().membank("bank1")->set_base(&RAM[0x100000]);
12351235   sh2drc_set_options(machine.device("maincpu"), SH2DRC_FASTEST_OPTIONS);
12361236}
12371237
12381238static DRIVER_INIT( s1945iii )
12391239{
1240   UINT8 *RAM = machine.region("maincpu")->base();
1241   memory_set_bankptr(machine, "bank1", &RAM[0x100000]);
1240   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
1241   machine.root_device().membank("bank1")->set_base(&RAM[0x100000]);
12421242   sh2drc_set_options(machine.device("maincpu"), SH2DRC_FASTEST_OPTIONS);
12431243}
12441244
src/mame/drivers/astinvad.c
r14976r14977
159159static SCREEN_UPDATE_RGB32( astinvad )
160160{
161161   astinvad_state *state = screen.machine().driver_data<astinvad_state>();
162   const UINT8 *color_prom = screen.machine().region("proms")->base();
162   const UINT8 *color_prom = state->memregion("proms")->base();
163163   UINT8 yoffs = state->m_flip_yoffs & state->m_screen_flip;
164164   int x, y;
165165
r14976r14977
179179static SCREEN_UPDATE_RGB32( spaceint )
180180{
181181   astinvad_state *state = screen.machine().driver_data<astinvad_state>();
182   const UINT8 *color_prom = screen.machine().region("proms")->base();
182   const UINT8 *color_prom = state->memregion("proms")->base();
183183   int offs;
184184
185185   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
src/mame/drivers/quizdna.c
r14976r14977
1818
1919WRITE8_MEMBER(quizdna_state::quizdna_rombank_w)
2020{
21   UINT8 *ROM = machine().region("maincpu")->base();
22   memory_set_bankptr(machine(), "bank1",&ROM[0x10000+0x4000*(data & 0x3f)]);
21   UINT8 *ROM = memregion("maincpu")->base();
22   membank("bank1")->set_base(&ROM[0x10000+0x4000*(data & 0x3f)]);
2323}
2424
2525WRITE8_MEMBER(quizdna_state::gekiretu_rombank_w)
2626{
27   UINT8 *ROM = machine().region("maincpu")->base();
28   memory_set_bankptr(machine(), "bank1",&ROM[0x10000+0x4000*((data & 0x3f) ^ 0x0a)]);
27   UINT8 *ROM = memregion("maincpu")->base();
28   membank("bank1")->set_base(&ROM[0x10000+0x4000*((data & 0x3f) ^ 0x0a)]);
2929}
3030
3131/****************************************************************************/
src/mame/drivers/boogwing.c
r14976r14977
573573
574574static DRIVER_INIT( boogwing )
575575{
576   const UINT8* src = machine.region("gfx6")->base();
577   UINT8* dst = machine.region("tiles2")->base() + 0x200000;
576   const UINT8* src = machine.root_device().memregion("gfx6")->base();
577   UINT8* dst = machine.root_device().memregion("tiles2")->base() + 0x200000;
578578
579579   deco56_decrypt_gfx(machine, "tiles1");
580580   deco56_decrypt_gfx(machine, "tiles2");
src/mame/drivers/supertnk.c
r14976r14977
140140
141141   bank_address = 0x10000 + (m_rom_bank * 0x1000);
142142
143   memory_set_bankptr(machine(), "bank1", &machine().region("maincpu")->base()[bank_address]);
143   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[bank_address]);
144144}
145145
146146
r14976r14977
152152
153153   bank_address = 0x10000 + (m_rom_bank * 0x1000);
154154
155   memory_set_bankptr(machine(), "bank1", &machine().region("maincpu")->base()[bank_address]);
155   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[bank_address]);
156156}
157157
158158
r14976r14977
187187{
188188   supertnk_state *state = machine.driver_data<supertnk_state>();
189189   offs_t i;
190   const UINT8 *prom = machine.region("proms")->base();
190   const UINT8 *prom = state->memregion("proms")->base();
191191
192192   for (i = 0; i < NUM_PENS; i++)
193193   {
r14976r14977
490490{
491491   /* decode the TMS9980 ROMs */
492492   offs_t offs;
493   UINT8 *rom = machine.region("maincpu")->base();
494   size_t len = machine.region("maincpu")->bytes();
493   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
494   size_t len = machine.root_device().memregion("maincpu")->bytes();
495495
496496   for (offs = 0; offs < len; offs++)
497497   {
src/mame/drivers/neodrvr.c
r14976r14977
94569456   kof2002_decrypt_68k(machine);
94579457   neo_pcm2_swap(machine, 0);
94589458   neogeo_cmc50_m1_decrypt(machine);
9459   kof2002b_gfx_decrypt(machine, machine.region("sprites")->base(),0x4000000);
9460   kof2002b_gfx_decrypt(machine, machine.region("fixed")->base(),0x20000);
9459   kof2002b_gfx_decrypt(machine, machine.root_device().memregion("sprites")->base(),0x4000000);
9460   kof2002b_gfx_decrypt(machine, machine.root_device().memregion("fixed")->base(),0x20000);
94619461}
94629462
94639463static DRIVER_INIT( kf2k2pls )
r14976r14977
95609560static TIMER_CALLBACK( ms5pcb_bios_timer_callback )
95619561{
95629562   int harddip3 = input_port_read(machine, "HARDDIP") & 1;
9563   memory_set_bankptr(machine, NEOGEO_BANK_BIOS, machine.region("mainbios")->base() + 0x20000 + harddip3 * 0x20000);
9563   machine.root_device().membank(NEOGEO_BANK_BIOS)->set_base(machine.root_device().memregion("mainbios")->base() + 0x20000 + harddip3 * 0x20000);
95649564}
95659565
95669566static DRIVER_INIT( ms5pcb )
r14976r14977
95979597static TIMER_CALLBACK( svcpcb_bios_timer_callback )
95989598{
95999599   int harddip3 = input_port_read(machine, "HARDDIP") & 1;
9600   memory_set_bankptr(machine, NEOGEO_BANK_BIOS, machine.region("mainbios")->base() + 0x20000 + harddip3 * 0x20000);
9600   machine.root_device().membank(NEOGEO_BANK_BIOS)->set_base(machine.root_device().memregion("mainbios")->base() + 0x20000 + harddip3 * 0x20000);
96019601}
96029602
96039603static DRIVER_INIT( svcpcb )
r14976r14977
97009700       incorrect */
97019701   {
97029702      int i;
9703      UINT8* rom = machine.region("audiocpu")->base();
9703      UINT8* rom = state->memregion("audiocpu")->base();
97049704      for (i = 0; i < 0x90000; i++)
97059705      {
97069706         rom[i] = BITSWAP8(rom[i], 5, 6, 1, 4, 3, 0, 7, 2);
r14976r14977
98359835
98369836static READ16_HANDLER( sbp_lowerrom_r )
98379837{
9838   UINT16* rom = (UINT16*)space->machine().region("maincpu")->base();
9838   UINT16* rom = (UINT16*)space->machine().root_device().memregion("maincpu")->base();
98399839   UINT16 origdata = rom[(offset+(0x200/2))];
98409840   UINT16 data =  BITSWAP16(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4);
98419841   int realoffset = 0x200+(offset*2);
r14976r14977
98819881
98829882   /* the game code clears the text overlay used ingame immediately after writing it.. why? protection? sloppy code that the hw ignores? imperfect emulation? */
98839883   {
9884      UINT16* rom = (UINT16*)machine.region("maincpu")->base();
9884      UINT16* rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
98859885
98869886      rom[0x2a6f8/2] = 0x4e71;
98879887      rom[0x2a6fa/2] = 0x4e71;
src/mame/drivers/esh.c
r14976r14977
224224
225225static PALETTE_INIT( esh )
226226{
227   const UINT8 *color_prom = machine.region("proms")->base();
227   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
228228   int i;
229229
230230   /* Oddly enough, the top 4 bits of each byte is 0 */
src/mame/drivers/fromance.c
r14976r14977
112112
113113WRITE8_MEMBER(fromance_state::fromance_rombank_w)
114114{
115   memory_set_bank(machine(), "bank1", data);
115   membank("bank1")->set_entry(data);
116116}
117117
118118
r14976r14977
954954static MACHINE_START( fromance )
955955{
956956   fromance_state *state = machine.driver_data<fromance_state>();
957   UINT8 *ROM = machine.region("sub")->base();
957   UINT8 *ROM = state->memregion("sub")->base();
958958
959   memory_configure_bank(machine, "bank1", 0, 0x100, &ROM[0x10000], 0x4000);
959   state->membank("bank1")->configure_entries(0, 0x100, &ROM[0x10000], 0x4000);
960960
961961   state->m_subcpu = machine.device("sub");
962962
src/mame/drivers/skykid.c
r14976r14977
6969
7070WRITE8_MEMBER(skykid_state::skykid_bankswitch_w)
7171{
72   memory_set_bank(machine(), "bank1", !BIT(offset,11));
72   membank("bank1")->set_entry(!BIT(offset,11));
7373}
7474
7575WRITE8_MEMBER(skykid_state::skykid_irq_1_ctrl_w)
r14976r14977
9292{
9393   skykid_state *state = machine.driver_data<skykid_state>();
9494   /* configure the banks */
95   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x2000);
95   state->membank("bank1")->configure_entries(0, 2, state->memregion("maincpu")->base() + 0x10000, 0x2000);
9696
9797   state_save_register_global(machine, state->m_inputport_selected);
9898}
r14976r14977
638638   int i;
639639
640640   /* unpack the third sprite ROM */
641   rom = machine.region("gfx3")->base() + 0x4000;
641   rom = machine.root_device().memregion("gfx3")->base() + 0x4000;
642642   for (i = 0;i < 0x2000;i++)
643643   {
644644      rom[i + 0x4000] = rom[i];      // sprite set #1, plane 3
src/mame/drivers/halleys.c
r14976r14977
11671167   sram_189 = state->m_generic_paletteram_8;
11681168
11691169   // each of the three 32-byte 6330 PROM is wired to an RGB component output
1170   prom_6330 = machine.region("proms")->base();
1170   prom_6330 = state->memregion("proms")->base();
11711171
11721172   // latch1 holds 8 bits from the selected palette RAM address
11731173   latch1_273 = sram_189[addr];
r14976r14977
21872187
21882188
21892189   // decrypt main program ROM
2190   rom = state->m_cpu1_base = machine.region("maincpu")->base();
2190   rom = state->m_cpu1_base = state->memregion("maincpu")->base();
21912191   buf = state->m_gfx1_base;
21922192
21932193   for (i=0; i<0x10000; i++)
r14976r14977
22002200
22012201
22022202   // swap graphics ROM addresses and unpack each pixel
2203   rom = machine.region("gfx1")->base();
2203   rom = machine.root_device().memregion("gfx1")->base();
22042204   buf = state->m_gfx_plane02;
22052205
22062206   for (i=0xffff; i>=0; i--)
src/mame/drivers/djmain.c
r14976r14977
104104static void sndram_set_bank(running_machine &machine)
105105{
106106   djmain_state *state = machine.driver_data<djmain_state>();
107   state->m_sndram = machine.region("shared")->base() + 0x80000 * state->m_sndram_bank;
107   state->m_sndram = state->memregion("shared")->base() + 0x80000 * state->m_sndram_bank;
108108}
109109
110110WRITE32_MEMBER(djmain_state::sndram_bank_w)
r14976r14977
170170
171171READ32_MEMBER(djmain_state::obj_rom_r)
172172{
173   UINT8 *mem8 = machine().region("gfx1")->base();
173   UINT8 *mem8 = memregion("gfx1")->base();
174174   int bank = m_obj_regs[0x28/4] >> 16;
175175
176176   offset += bank * 0x200;
r14976r14977
207207READ32_MEMBER(djmain_state::v_rom_r)
208208{
209209   device_t *k056832 = machine().device("k056832");
210   UINT8 *mem8 = machine().region("gfx2")->base();
210   UINT8 *mem8 = memregion("gfx2")->base();
211211   int bank = k056832_word_r(k056832, 0x34/2, 0xffff);
212212
213213   offset *= 2;
src/mame/drivers/mustache.c
r14976r14977
252252{
253253   int i;
254254
255   int G1 = machine.region("gfx1")->bytes()/3;
256   int G2 = machine.region("gfx2")->bytes()/2;
257   UINT8 *gfx1 = machine.region("gfx1")->base();
258   UINT8 *gfx2 = machine.region("gfx2")->base();
255   int G1 = machine.root_device().memregion("gfx1")->bytes()/3;
256   int G2 = machine.root_device().memregion("gfx2")->bytes()/2;
257   UINT8 *gfx1 = machine.root_device().memregion("gfx1")->base();
258   UINT8 *gfx2 = machine.root_device().memregion("gfx2")->base();
259259   UINT8 *buf=auto_alloc_array(machine, UINT8, G2*2);
260260
261261   /* BG data lines */
src/mame/drivers/namcoic.c
r14976r14977
11011101      break;
11021102   }
11031103   SET_TILE_INFO( mRozGfxBank,mangle,0/*color*/,0/*flag*/ );
1104   tileinfo.mask_data = 32*tile + (UINT8 *)machine.region( mRozMaskRegion )->base();
1104   tileinfo.mask_data = 32*tile + (UINT8 *)machine.root_device().memregion( mRozMaskRegion )->base();
11051105} /* roz_get_info */
11061106
11071107static
r14976r14977
16041604void
16051605namco_road_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
16061606{
1607   const UINT8 *clut = (const UINT8 *)machine.region("user3")->base();
1607   const UINT8 *clut = (const UINT8 *)machine.root_device().memregion("user3")->base();
16081608   unsigned yscroll;
16091609   int i;
16101610
src/mame/drivers/segas16a.c
r14976r14977
451451    */
452452   segas1x_state *state = space->machine().driver_data<segas1x_state>();
453453
454   int numroms = space->machine().region("n7751data")->bytes() / 0x8000;
454   int numroms = state->memregion("n7751data")->bytes() / 0x8000;
455455   state->m_n7751_rom_address &= 0x3fff;
456456   state->m_n7751_rom_address |= (data & 0x01) << 14;
457457   if (!(data & 0x02) && numroms >= 1) state->m_n7751_rom_address |= 0x00000;
r14976r14977
496496{
497497   /* read from BUS */
498498   segas1x_state *state = space->machine().driver_data<segas1x_state>();
499   return space->machine().region("n7751data")->base()[state->m_n7751_rom_address];
499   return state->memregion("n7751data")->base()[state->m_n7751_rom_address];
500500}
501501
502502
r14976r14977
973973         return maincpu_byte_r(space->machine(), 0x840001 ^ offset);
974974
975975      case 5:
976         return space->machine().region("maincpu")->base()[0x00000 + offset];
976         return space->machine().root_device().memregion("maincpu")->base()[0x00000 + offset];
977977      case 6:
978         return space->machine().region("maincpu")->base()[0x10000 + offset];
978         return space->machine().root_device().memregion("maincpu")->base()[0x10000 + offset];
979979      case 7:
980         return space->machine().region("maincpu")->base()[0x20000 + offset];
980         return state->memregion("maincpu")->base()[0x20000 + offset];
981981
982982      default:
983983         logerror("%03X: MCU movx read mode %02X offset %04X\n",
src/mame/drivers/neogeo.c
r14976r14977
625625static void _set_main_cpu_vector_table_source( running_machine &machine )
626626{
627627   neogeo_state *state = machine.driver_data<neogeo_state>();
628   memory_set_bank(machine, NEOGEO_BANK_VECTORS, state->m_main_cpu_vector_table_source);
628   state->membank(NEOGEO_BANK_VECTORS)->set_entry(state->m_main_cpu_vector_table_source);
629629}
630630
631631
r14976r14977
641641static void _set_main_cpu_bank_address( running_machine &machine )
642642{
643643   neogeo_state *state = machine.driver_data<neogeo_state>();
644   memory_set_bankptr(machine, NEOGEO_BANK_CARTRIDGE, &machine.region("maincpu")->base()[state->m_main_cpu_bank_address]);
644   state->membank(NEOGEO_BANK_CARTRIDGE)->set_base(&state->memregion("maincpu")->base()[state->m_main_cpu_bank_address]);
645645}
646646
647647
r14976r14977
660660WRITE16_MEMBER(neogeo_state::main_cpu_bank_select_w)
661661{
662662   UINT32 bank_address;
663   UINT32 len = machine().region("maincpu")->bytes();
663   UINT32 len = memregion("maincpu")->bytes();
664664
665665   if ((len <= 0x100000) && (data & 0x07))
666666      logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", cpu_get_pc(&space.device()), data);
r14976r14977
684684   address_space *mainspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
685685
686686   /* create vector banks */
687   memory_configure_bank(machine, NEOGEO_BANK_VECTORS, 0, 1, machine.region("mainbios")->base(), 0);
688   memory_configure_bank(machine, NEOGEO_BANK_VECTORS, 1, 1, machine.region("maincpu")->base(), 0);
687   machine.root_device().membank(NEOGEO_BANK_VECTORS)->configure_entry(0, machine.root_device().memregion("mainbios")->base());
688   machine.root_device().membank(NEOGEO_BANK_VECTORS)->configure_entry(1, machine.root_device().memregion("maincpu")->base());
689689
690690   /* set initial main CPU bank */
691   if (machine.region("maincpu")->bytes() > 0x100000)
691   if (machine.root_device().memregion("maincpu")->bytes() > 0x100000)
692692      neogeo_set_main_cpu_bank_address(mainspace, 0x100000);
693693   else
694694      neogeo_set_main_cpu_bank_address(mainspace, 0x000000);
r14976r14977
708708   int region;
709709
710710   for (region = 0; region < 4; region++)
711      memory_set_bank(machine, NEOGEO_BANK_AUDIO_CPU_CART_BANK + region, state->m_audio_cpu_banks[region]);
711      state->membank(NEOGEO_BANK_AUDIO_CPU_CART_BANK + region)->set_entry(state->m_audio_cpu_banks[region]);
712712}
713713
714714
r14976r14977
760760{
761761   neogeo_state *state = space->machine().driver_data<neogeo_state>();
762762
763/*  if (!machine.region("audiobios")->base())   */
763/*  if (!state->memregion("audiobios")->base())   */
764764      state->m_audio_cpu_rom_source = 1;
765765
766   memory_set_bank(space->machine(), NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, state->m_audio_cpu_rom_source);
766   state->membank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK)->set_entry(state->m_audio_cpu_rom_source);
767767
768768   /* reset CPU if the source changed -- this is a guess */
769769   if (state->m_audio_cpu_rom_source != state->m_audio_cpu_rom_source_last)
r14976r14977
795795   UINT32 address_mask;
796796
797797   /* audio bios/cartridge selection */
798   if (machine.region("audiobios")->base())
799      memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 0, 1, machine.region("audiobios")->base(), 0);
800   memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 1, 1, machine.region("audiocpu")->base(), 0);
798   if (machine.root_device().memregion("audiobios")->base())
799      state->membank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK)->configure_entry(0, machine.root_device().memregion("audiobios")->base());
800   state->membank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK)->configure_entry(1, machine.root_device().memregion("audiocpu")->base());
801801
802802   /* audio banking */
803   address_mask = machine.region("audiocpu")->bytes() - 0x10000 - 1;
803   address_mask = machine.root_device().memregion("audiocpu")->bytes() - 0x10000 - 1;
804804
805   rgn = machine.region("audiocpu")->base();
805   rgn = state->memregion("audiocpu")->base();
806806   for (region = 0; region < 4; region++)
807807   {
808808      for (bank = 0; bank < 0x100; bank++)
809809      {
810810         UINT32 bank_address = 0x10000 + (((bank << (11 + region)) & 0x3ffff) & address_mask);
811         memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_CART_BANK + region, bank, 1, &rgn[bank_address], 0);
811         state->membank(NEOGEO_BANK_AUDIO_CPU_CART_BANK + region)->configure_entry(bank, &rgn[bank_address]);
812812      }
813813   }
814814
r14976r14977
990990   machine.device<nvram_device>("saveram")->set_base(save_ram, 0x10000);
991991
992992   /* set the BIOS bank */
993   memory_set_bankptr(machine, NEOGEO_BANK_BIOS, machine.region("mainbios")->base());
993   state->membank(NEOGEO_BANK_BIOS)->set_base(state->memregion("mainbios")->base());
994994
995995   /* set the initial main CPU bank */
996996   main_cpu_banking_init(machine);
r14976r14977
12791279   {
12801280      // create memory regions
12811281      size = image.get_software_region_length("maincpu");
1282      image.device().machine().region_free(":maincpu");
1283      image.device().machine().region_alloc(":maincpu",size, 2, ENDIANNESS_BIG);
1284      memcpy(image.device().machine().region("maincpu")->base(),image.get_software_region("maincpu"),size);
1282      image.device().machine().memory().region_free(":maincpu");
1283      image.device().machine().memory().region_alloc(":maincpu",size, 2, ENDIANNESS_BIG);
1284      memcpy(image.device().machine().root_device().memregion("maincpu")->base(),image.get_software_region("maincpu"),size);
12851285
12861286      // for whatever reason (intentional, or design flaw) software loaded via software lists is swapped in endianess vs. the standard ROM loading, regardless of the above.  Swap it to keep consistency
12871287      for (int i=0; i<size/2;i++)
12881288      {
1289         UINT16* ROM = (UINT16*)image.device().machine().region("maincpu")->base();
1289         UINT16* ROM = (UINT16*)image.device().machine().root_device().memregion("maincpu")->base();
12901290         ROM[i] = ((ROM[i]&0xff00)>>8) | ((ROM[i]&0x00ff)<<8);
12911291      }
12921292
12931293      size = image.get_software_region_length("fixed");
1294      image.device().machine().region_free(":fixed");
1295      image.device().machine().region_alloc(":fixed",size,1, ENDIANNESS_LITTLE);
1296      memcpy(image.device().machine().region("fixed")->base(),image.get_software_region("fixed"),size);
1294      image.device().machine().memory().region_free(":fixed");
1295      image.device().machine().memory().region_alloc(":fixed",size,1, ENDIANNESS_LITTLE);
1296      memcpy(image.device().machine().root_device().memregion("fixed")->base(),image.get_software_region("fixed"),size);
12971297
12981298      if(image.get_software_region("audiocpu") != NULL)
12991299      {
13001300         size = image.get_software_region_length("audiocpu");
1301         image.device().machine().region_free(":audiocpu");
1302         image.device().machine().region_alloc(":audiocpu",size+0x10000,1, ENDIANNESS_LITTLE);
1303         memcpy(image.device().machine().region("audiocpu")->base(),image.get_software_region("audiocpu"),size);
1304         memcpy(image.device().machine().region("audiocpu")->base()+0x10000,image.get_software_region("audiocpu"),size); // avoid reloading in XML, should just improve banking instead tho?
1301         image.device().machine().memory().region_free(":audiocpu");
1302         image.device().machine().memory().region_alloc(":audiocpu",size+0x10000,1, ENDIANNESS_LITTLE);
1303         memcpy(image.device().machine().root_device().memregion("audiocpu")->base(),image.get_software_region("audiocpu"),size);
1304         memcpy(image.device().machine().root_device().memregion("audiocpu")->base()+0x10000,image.get_software_region("audiocpu"),size); // avoid reloading in XML, should just improve banking instead tho?
13051305      }
13061306
13071307
13081308      size = image.get_software_region_length("ymsnd");
1309      image.device().machine().region_free(":ymsnd");
1310      image.device().machine().region_alloc(":ymsnd",size,1, ENDIANNESS_LITTLE);
1311      memcpy(image.device().machine().region("ymsnd")->base(),image.get_software_region("ymsnd"),size);
1309      image.device().machine().memory().region_free(":ymsnd");
1310      image.device().machine().memory().region_alloc(":ymsnd",size,1, ENDIANNESS_LITTLE);
1311      memcpy(image.device().machine().root_device().memregion("ymsnd")->base(),image.get_software_region("ymsnd"),size);
13121312      if(image.get_software_region("ymsnd.deltat") != NULL)
13131313      {
13141314         size = image.get_software_region_length("ymsnd.deltat");
1315         image.device().machine().region_free(":ymsnd.deltat");
1316         image.device().machine().region_alloc(":ymsnd.deltat",size,1, ENDIANNESS_LITTLE);
1317         memcpy(image.device().machine().region("ymsnd.deltat")->base(),image.get_software_region("ymsnd.deltat"),size);
1315         image.device().machine().memory().region_free(":ymsnd.deltat");
1316         image.device().machine().memory().region_alloc(":ymsnd.deltat",size,1, ENDIANNESS_LITTLE);
1317         memcpy(image.device().machine().root_device().memregion("ymsnd.deltat")->base(),image.get_software_region("ymsnd.deltat"),size);
13181318      }
13191319      else
1320         image.device().machine().region_free(":ymsnd.deltat");  // removing the region will fix sound glitches in non-Delta-T games
1320         image.device().machine().memory().region_free(":ymsnd.deltat");  // removing the region will fix sound glitches in non-Delta-T games
13211321      ym->reset();
13221322      size = image.get_software_region_length("sprites");
1323      image.device().machine().region_free(":sprites");
1324      image.device().machine().region_alloc(":sprites",size,1, ENDIANNESS_LITTLE);
1325      memcpy(image.device().machine().region("sprites")->base(),image.get_software_region("sprites"),size);
1323      image.device().machine().memory().region_free(":sprites");
1324      image.device().machine().memory().region_alloc(":sprites",size,1, ENDIANNESS_LITTLE);
1325      memcpy(image.device().machine().root_device().memregion("sprites")->base(),image.get_software_region("sprites"),size);
13261326      if(image.get_software_region("audiocrypt") != NULL)  // encrypted Z80 code
13271327      {
13281328         size = image.get_software_region_length("audiocrypt");
1329         image.device().machine().region_alloc(":audiocrypt",size,1, ENDIANNESS_LITTLE);
1330         memcpy(image.device().machine().region("audiocrypt")->base(),image.get_software_region("audiocrypt"),size);
1329         image.device().machine().memory().region_alloc(":audiocrypt",size,1, ENDIANNESS_LITTLE);
1330         memcpy(image.device().machine().root_device().memregion("audiocrypt")->base(),image.get_software_region("audiocrypt"),size);
13311331         // allocate the audiocpu region to decrypt data into
1332         image.device().machine().region_free(":audiocpu");
1333         image.device().machine().region_alloc(":audiocpu",size+0x10000,1, ENDIANNESS_LITTLE);
1332         image.device().machine().memory().region_free(":audiocpu");
1333         image.device().machine().memory().region_alloc(":audiocpu",size+0x10000,1, ENDIANNESS_LITTLE);
13341334      }
13351335
13361336      // setup cartridge ROM area
13371337      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x000080,0x0fffff,"cart_rom");
1338      memory_set_bankptr(image.device().machine(),"cart_rom",&image.device().machine().region("maincpu")->base()[0x80]);
1338      image.device().machine().root_device().membank("cart_rom")->set_base(&image.device().machine().root_device().memregion("maincpu")->base()[0x80]);
13391339
13401340      // handle possible protection
13411341      mvs_install_protection(image);
src/mame/drivers/segahang.c
r14976r14977
17621762static DRIVER_INIT( endurobl )
17631763{
17641764   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1765   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1765   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
17661766   UINT16 *decrypt = auto_alloc_array(machine, UINT16, 0x40000/2);
17671767
17681768   hangon_generic_init(machine);
r14976r14977
17761776static DRIVER_INIT( endurob2 )
17771777{
17781778   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1779   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
1779   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
17801780   UINT16 *decrypt = auto_alloc_array(machine, UINT16, 0x40000/2);
17811781
17821782   hangon_generic_init(machine);
src/mame/drivers/statriv2.c
r14976r14977
224224
225225READ8_MEMBER(statriv2_state::question_data_r)
226226{
227   const UINT8 *qrom = machine().region("questions")->base();
228   UINT32 qromsize = machine().region("questions")->bytes();
227   const UINT8 *qrom = memregion("questions")->base();
228   UINT32 qromsize = memregion("questions")->bytes();
229229   UINT32 address;
230230
231231   if (m_question_offset_high == 0xff)
r14976r14977
11021102    *                                                   *
11031103    \***************************************************/
11041104
1105   UINT8 *qrom = machine.region("questions")->base();
1106   UINT32 length = machine.region("questions")->bytes();
1105   UINT8 *qrom = machine.root_device().memregion("questions")->base();
1106   UINT32 length = machine.root_device().memregion("questions")->bytes();
11071107   UINT32 address;
11081108
11091109   for (address = 0; address < length; address++)
src/mame/drivers/carrera.c
r14976r14977
283283
284284static PALETTE_INIT(carrera)
285285{
286   const UINT8 *color_prom = machine.region("proms")->base();
286   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
287287   int br_bit0, br_bit1, bit0, bit1, r, g, b;
288288   int   i;
289289
src/mame/drivers/d9final.c
r14976r14977
9292
9393WRITE8_MEMBER(d9final_state::d9final_bank_w)
9494{
95   UINT8 *ROM = machine().region("maincpu")->base();
95   UINT8 *ROM = memregion("maincpu")->base();
9696   UINT32 bankaddress;
9797
9898   bankaddress = 0x10000+(0x4000 * (data & 0x7));
99   memory_set_bankptr(machine(), "bank1", &ROM[bankaddress]);
99   membank("bank1")->set_base(&ROM[bankaddress]);
100100}
101101
102102/* game checks this after three attract cycles, otherwise coin inputs stop to work. */
r14976r14977
273273
274274static MACHINE_RESET( d9final )
275275{
276   UINT8 *ROM = machine.region("maincpu")->base();
276   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
277277
278   memory_set_bankptr(machine, "bank1", &ROM[0x10000]);
278   machine.root_device().membank("bank1")->set_base(&ROM[0x10000]);
279279}
280280
281281static MACHINE_CONFIG_START( d9final, d9final_state )
src/mame/drivers/ladybug.c
r14976r14977
10451045   offs_t i;
10461046   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
10471047   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x6000);
1048   UINT8 *rom = machine.region("maincpu")->base();
1049   UINT8 *table = machine.region("user1")->base();
1048   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
1049   UINT8 *table = machine.root_device().memregion("user1")->base();
10501050
10511051   space->set_decrypted_region(0x0000, 0x5fff, decrypted);
10521052
src/mame/drivers/ttchamp.c
r14976r14977
109109WRITE16_MEMBER(ttchamp_state::pcup_prgbank_w)
110110{
111111    int bank;
112    UINT8 *ROM1 = machine().region("user1")->base();
112    UINT8 *ROM1 = memregion("user1")->base();
113113
114114    if (ACCESSING_BITS_0_7)
115115    {
116116        bank = (data>>4) &0x07;
117        memory_set_bankptr(machine(), "bank2",&ROM1[0x80000*(bank)]);
117        membank("bank2")->set_base(&ROM1[0x80000*(bank)]);
118118    }
119119}
120120#endif
r14976r14977
337337
338338static DRIVER_INIT (ttchamp)
339339{
340   UINT8 *ROM1 = machine.region("user1")->base();
341   memory_set_bankptr(machine, "bank1",&ROM1[0x120000]);
342   memory_set_bankptr(machine, "bank2",&ROM1[0x180000]);
340   UINT8 *ROM1 = machine.root_device().memregion("user1")->base();
341   machine.root_device().membank("bank1")->set_base(&ROM1[0x120000]);
342   machine.root_device().membank("bank2")->set_base(&ROM1[0x180000]);
343343}
344344
345345GAME( 199?, ttchamp, 0,        ttchamp, ttchamp, ttchamp, ROT0,  "Gamart?", "Table Tennis Champions (set 1)", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/aristmk6.c
r14976r14977
3333   aristmk6_state *state = screen.machine().driver_data<aristmk6_state>();
3434
3535   int x,y,count;
36   const UINT8 *blit_ram = screen.machine().region("maincpu")->base();
36   const UINT8 *blit_ram = state->memregion("maincpu")->base();
3737
3838   if(screen.machine().input().code_pressed(KEYCODE_Z))
3939      state->m_test_x++;
src/mame/drivers/buggychl.c
r14976r14977
8888
8989WRITE8_MEMBER(buggychl_state::bankswitch_w)
9090{
91   memory_set_bank(machine(), "bank1", data & 0x07);   // shall we check if data&7 < # banks?
91   membank("bank1")->set_entry(data & 0x07);   // shall we check if data&7 < # banks?
9292}
9393
9494static TIMER_CALLBACK( nmi_callback )
r14976r14977
359359static MACHINE_START( buggychl )
360360{
361361   buggychl_state *state = machine.driver_data<buggychl_state>();
362   UINT8 *ROM = machine.region("maincpu")->base();
362   UINT8 *ROM = state->memregion("maincpu")->base();
363363
364   memory_configure_bank(machine, "bank1", 0, 6, &ROM[0x10000], 0x2000);
364   state->membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x2000);
365365
366366   state->m_audiocpu = machine.device("audiocpu");
367367
src/mame/drivers/taito_f2.c
r14976r14977
591591
592592WRITE8_MEMBER(taitof2_state::sound_bankswitch_w)
593593{
594   memory_set_bank(machine(), "bank2", (data - 1) & 7);
594   membank("bank2")->set_entry((data - 1) & 7);
595595
596596#ifdef MAME_DEBUG
597597   if (((data - 1) & 7) > 2)
r14976r14977
30133013static MACHINE_START( f2 )
30143014{
30153015   MACHINE_START_CALL(common);
3016   memory_configure_bank(machine, "bank2", 0, 8, machine.region("audiocpu")->base() + 0x10000, 0x4000);
3016   machine.root_device().membank("bank2")->configure_entries(0, 8, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
30173017}
30183018
30193019static MACHINE_CONFIG_START( taito_f2, taitof2_state )
r14976r14977
52745274   int i;
52755275   UINT8 data;
52765276   UINT32 offset;
5277   UINT8 *gfx = machine.region("gfx2")->base();
5277   UINT8 *gfx = machine.root_device().memregion("gfx2")->base();
52785278
52795279   offset = 0x100000;
52805280   for (i = 0x180000; i < 0x200000; i++)
r14976r14977
53105310static DRIVER_INIT( mjnquest )
53115311{
53125312   taitof2_state *state = machine.driver_data<taitof2_state>();
5313   int i, len = machine.region("gfx2")->bytes();
5314   UINT8 *gfx = machine.region("gfx2")->base();
5313   int i, len = machine.root_device().memregion("gfx2")->bytes();
5314   UINT8 *gfx = state->memregion("gfx2")->base();
53155315
53165316   /* the bytes in each longword are in reversed order, put them in the
53175317       order used by the other games. */
src/mame/drivers/ddragon.c
r14976r14977
150150   ddragon_state *state = machine.driver_data<ddragon_state>();
151151
152152   /* configure banks */
153   memory_configure_bank(machine, "bank1", 0, 8, machine.region("maincpu")->base() + 0x10000, 0x4000);
153   state->membank("bank1")->configure_entries(0, 8, state->memregion("maincpu")->base() + 0x10000, 0x4000);
154154
155155   state->m_maincpu = machine.device("maincpu");
156156   state->m_sub_cpu = machine.device("sub");
r14976r14977
203203   else if (m_dd_sub_cpu_busy == 0)
204204      device_set_input_line(m_sub_cpu, m_sprite_irq, (m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
205205
206   memory_set_bank(machine(), "bank1", (data & 0xe0) >> 5);
206   membank("bank1")->set_entry((data & 0xe0) >> 5);
207207}
208208
209209
r14976r14977
217217   /* bit 3 unknown */
218218
219219   /* I don't know ... */
220   memory_set_bank(machine(), "bank1", (data & 0x20) >> 5);
220   membank("bank1")->set_entry((data & 0x20) >> 5);
221221}
222222
223223
r14976r14977
263263
264264WRITE8_MEMBER(ddragon_state::darktowr_bankswitch_w)
265265{
266   int oldbank = machine().memory().bank("bank1")->entry();
266   int oldbank = membank("bank1")->entry();
267267   int newbank = (data & 0xe0) >> 5;
268268
269269   m_scrollx_hi = (data & 0x01);
r14976r14977
278278   else if (m_dd_sub_cpu_busy == 0)
279279      device_set_input_line(m_sub_cpu, m_sprite_irq, (m_sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE);
280280
281   memory_set_bank(machine(), "bank1", newbank);
281   membank("bank1")->set_entry(newbank);
282282   if (newbank == 4 && oldbank != 4)
283283      space.install_readwrite_handler(0x4000, 0x7fff, read8_delegate(FUNC(ddragon_state::darktowr_mcu_bank_r),this), write8_delegate(FUNC(ddragon_state::darktowr_mcu_bank_w),this));
284284   else if (newbank != 4 && oldbank == 4)
r14976r14977
465465   }
466466   else
467467   {
468      UINT8 *ROM = device->machine().region("adpcm")->base() + 0x10000 * chip;
468      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base() + 0x10000 * chip;
469469
470470      state->m_adpcm_data[chip] = ROM[state->m_adpcm_pos[chip]++];
471471      msm5205_data_w(device, state->m_adpcm_data[chip] >> 4);
r14976r14977
20232023   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::toffy_bankswitch_w),state));
20242024
20252025   /* the program rom has a simple bitswap encryption */
2026   rom = machine.region("maincpu")->base();
2027   length = machine.region("maincpu")->bytes();
2026   rom = machine.root_device().memregion("maincpu")->base();
2027   length = machine.root_device().memregion("maincpu")->bytes();
20282028   for (i = 0; i < length; i++)
20292029      rom[i] = BITSWAP8(rom[i], 6,7,5,4,3,2,1,0);
20302030
20312031   /* and the fg gfx ... */
2032   rom = machine.region("gfx1")->base();
2033   length = machine.region("gfx1")->bytes();
2032   rom = machine.root_device().memregion("gfx1")->base();
2033   length = machine.root_device().memregion("gfx1")->bytes();
20342034   for (i = 0; i < length; i++)
20352035      rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0);
20362036
20372037   /* and the sprites gfx */
2038   rom = machine.region("gfx2")->base();
2039   length = machine.region("gfx2")->bytes();
2038   rom = machine.root_device().memregion("gfx2")->base();
2039   length = machine.root_device().memregion("gfx2")->bytes();
20402040   for (i = 0; i < length; i++)
20412041      rom[i] = BITSWAP8(rom[i], 7,6,5,4,3,2,0,1);
20422042
20432043   /* and the bg gfx */
2044   rom = machine.region("gfx3")->base();
2045   length = machine.region("gfx3")->bytes();
2044   rom = machine.root_device().memregion("gfx3")->base();
2045   length = state->memregion("gfx3")->bytes();
20462046   for (i = 0; i < length / 2; i++)
20472047   {
20482048      rom[i + 0*length/2] = BITSWAP8(rom[i + 0*length/2], 7,6,1,4,3,2,5,0);
r14976r14977
20582058   int i;
20592059   UINT8 *dst,*src;
20602060
2061   src = machine.region("chars")->base();
2062   dst = machine.region("gfx1")->base();
2061   src = machine.root_device().memregion("chars")->base();
2062   dst = state->memregion("gfx1")->base();
20632063
20642064   for (i = 0; i < 0x8000; i++)
20652065   {
src/mame/drivers/asterix.c
r14976r14977
460460static DRIVER_INIT( asterix )
461461{
462462#if 0
463   *(UINT16 *)(machine.region("maincpu")->base() + 0x07f34) = 0x602a;
464   *(UINT16 *)(machine.region("maincpu")->base() + 0x00008) = 0x0400;
463   *(UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x07f34) = 0x602a;
464   *(UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x00008) = 0x0400;
465465#endif
466466}
467467
src/mame/drivers/goldnpkr.c
r14976r14977
10491049
10501050static PALETTE_INIT( goldnpkr )
10511051{
1052   const UINT8 *color_prom = machine.region("proms")->base();
1052   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
10531053/*  prom bits
10541054    7654 3210
10551055    ---- ---x   red component.
r14976r14977
10931093
10941094static PALETTE_INIT( witchcrd )
10951095{
1096   const UINT8 *color_prom = machine.region("proms")->base();
1096   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
10971097/*
10981098    This hardware has a feature called BLUE KILLER.
10991099    Using the original intensity line, the PCB has a bridge
r14976r14977
11411141
11421142static PALETTE_INIT( wcrdxtnd )
11431143{
1144   const UINT8 *color_prom = machine.region("proms")->base();
1144   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
11451145/*
11461146    Using the original intensity line, the PCB has a bridge
11471147    that allow (as default) turn the background dark blue.
r14976r14977
93689368{
93699369    /* $60bb, NOPing the ORA #$F0 (after read the PIA1 port B */
93709370
9371//  UINT8 *ROM = machine.region("maincpu")->base();
9371//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
93729372
93739373//  ROM[0x60bb] = 0xea;
93749374//  ROM[0x60bc] = 0xea;
r14976r14977
93989398
93999399    /* Attempt to decrypt the MCU program (we're sooo close!) */
94009400
9401   UINT8 *ROM = machine.region("mcu")->base();
9402   int size = machine.region("mcu")->bytes();
9401   UINT8 *ROM = machine.root_device().memregion("mcu")->base();
9402   int size = machine.root_device().memregion("mcu")->bytes();
94039403   int start = 0x0000;
94049404   int i;
94059405
r14976r14977
94179417       after compare with Dallas TK data
94189418    */
94199419
9420   UINT8 *ROM = machine.region("maincpu")->base();
9420   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
94219421
94229422   ROM[0xe097] = 0xea;
94239423   ROM[0xe098] = 0xea;
r14976r14977
94299429       after compare with Dallas TK data
94309430    */
94319431
9432   UINT8 *ROM = machine.region("maincpu")->base();
9432   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
94339433
94349434   ROM[0xe87b] = 0xea;
94359435   ROM[0xe87c] = 0xea;
r14976r14977
94419441       after compare with Dallas TK data
94429442    */
94439443
9444   UINT8 *ROM = machine.region("maincpu")->base();
9444   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
94459445
94469446   ROM[0x453a] = 0xea;
94479447   ROM[0x453b] = 0xea;
r14976r14977
94539453       after compare with Dallas TK data
94549454    */
94559455
9456   UINT8 *ROM = machine.region("maincpu")->base();
9456   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
94579457
94589458   ROM[0xf2c9] = 0xea;
94599459   ROM[0xf2ca] = 0xea;
r14976r14977
94659465       after compare with Dallas TK data
94669466    */
94679467
9468   UINT8 *ROM = machine.region("maincpu")->base();
9468   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
94699469
94709470   ROM[0xdf80] = 0xea;
94719471   ROM[0xdf81] = 0xea;
r14976r14977
94779477       after compare with Dallas TK data
94789478    */
94799479
9480   UINT8 *ROM = machine.region("maincpu")->base();
9480   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
94819481
94829482   ROM[0xe42f] = 0xea;
94839483   ROM[0xe430] = 0xea;
r14976r14977
94899489       after compare with Dallas TK data
94909490    */
94919491
9492   UINT8 *ROM = machine.region("maincpu")->base();
9492   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
94939493
94949494   ROM[0xe442] = 0xea;
94959495   ROM[0xe443] = 0xea;
r14976r14977
95019501       after compare with Dallas TK data
95029502    */
95039503
9504   UINT8 *ROM = machine.region("maincpu")->base();
9504   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95059505
95069506   ROM[0xe4d5] = 0xea;
95079507   ROM[0xe4d6] = 0xea;
r14976r14977
95139513       after compare with Dallas TK data
95149514    */
95159515
9516   UINT8 *ROM = machine.region("maincpu")->base();
9516   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95179517
95189518   ROM[0xe87c] = 0xea;
95199519   ROM[0xe87d] = 0xea;
r14976r14977
95259525       after compare with Dallas TK data
95269526    */
95279527
9528   UINT8 *ROM = machine.region("maincpu")->base();
9528   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95299529
95309530   ROM[0xe7d5] = 0xea;
95319531   ROM[0xe7d6] = 0xea;
r14976r14977
95379537       after compare with Dallas TK data
95389538    */
95399539
9540   UINT8 *ROM = machine.region("maincpu")->base();
9540   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95419541
95429542   ROM[0xe7d9] = 0xea;
95439543   ROM[0xe7da] = 0xea;
r14976r14977
95499549       after compare with Dallas TK data
95509550    */
95519551
9552   UINT8 *ROM = machine.region("maincpu")->base();
9552   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95539553
95549554   ROM[0xe7f7] = 0xea;
95559555   ROM[0xe7f8] = 0xea;
r14976r14977
95619561       after compare with Dallas TK data
95629562    */
95639563
9564   UINT8 *ROM = machine.region("maincpu")->base();
9564   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95659565
95669566   ROM[0xe8a5] = 0xea;
95679567   ROM[0xe8a6] = 0xea;
r14976r14977
95739573       after compare with Dallas TK data
95749574    */
95759575
9576   UINT8 *ROM = machine.region("maincpu")->base();
9576   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95779577
95789578   ROM[0xe955] = 0xea;
95799579   ROM[0xe956] = 0xea;
r14976r14977
95859585       after compare with Dallas TK data
95869586    */
95879587
9588   UINT8 *ROM = machine.region("maincpu")->base();
9588   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
95899589
95909590   ROM[0xee6b] = 0xea;
95919591   ROM[0xee6c] = 0xea;
r14976r14977
95979597       after compare with Dallas TK data
95989598    */
95999599
9600   UINT8 *ROM = machine.region("maincpu")->base();
9600   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
96019601
96029602   ROM[0xf052] = 0xea;
96039603   ROM[0xf053] = 0xea;
r14976r14977
97299729       after compare with a string inside the Dallas TK RAM
97309730    */
97319731
9732   UINT8 *ROM = machine.region("maincpu")->base();
9732   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
97339733
97349734   ROM[0xf2e1] = 0xea;
97359735   ROM[0xf2e2] = 0xea;
src/mame/drivers/ppmast93.c
r14976r14977
171171
172172WRITE8_MEMBER(ppmast93_state::ppmast93_port4_w)
173173{
174   UINT8 *rom = machine().region("maincpu")->base();
174   UINT8 *rom = memregion("maincpu")->base();
175175   int bank;
176176
177177   coin_counter_w(machine(), 0, data & 0x08);
178178   coin_counter_w(machine(), 1, data & 0x10);
179179
180180   bank = data & 0x07;
181   memory_set_bankptr(machine(), "bank1",&rom[0x10000+(bank*0x4000)]);
181   membank("bank1")->set_base(&rom[0x10000+(bank*0x4000)]);
182182}
183183
184184static ADDRESS_MAP_START( ppmast93_cpu1_map, AS_PROGRAM, 8, ppmast93_state )
src/mame/drivers/xxmissio.c
r14976r14977
1616
1717WRITE8_MEMBER(xxmissio_state::xxmissio_bank_sel_w)
1818{
19   memory_set_bank(machine(), "bank1", data & 7);
19   membank("bank1")->set_entry(data & 7);
2020}
2121
2222CUSTOM_INPUT_MEMBER(xxmissio_state::xxmissio_status_r)
r14976r14977
7979
8080static MACHINE_START( xxmissio )
8181{
82   memory_configure_bank(machine, "bank1", 0, 8, machine.region("user1")->base(), 0x4000);
83   memory_set_bank(machine, "bank1", 0);
82   machine.root_device().membank("bank1")->configure_entries(0, 8, machine.root_device().memregion("user1")->base(), 0x4000);
83   machine.root_device().membank("bank1")->set_entry(0);
8484}
8585
8686/****************************************************************************/
src/mame/drivers/moo.c
r14976r14977
180180
181181WRITE8_MEMBER(moo_state::sound_bankswitch_w)
182182{
183   memory_set_bankptr(machine(), "bank1", machine().region("soundcpu")->base() + 0x10000 + (data&0xf)*0x4000);
183   membank("bank1")->set_base(machine().root_device().memregion("soundcpu")->base() + 0x10000 + (data&0xf)*0x4000);
184184}
185185
186186
src/mame/drivers/taito_l.c
r14976r14977
169169      state->m_cur_rambank[i] = 0x80;
170170      state->m_current_notifier[i] = palette_notifier;
171171      state->m_current_base[i] = state->m_palette_ram;
172      memory_set_bankptr(machine, bankname[i], state->m_current_base[i]);
172      state->membank(bankname[i])->set_base(state->m_current_base[i]);
173173   }
174174
175175   state->m_cur_rombank = state->m_cur_rombank2 = 0;
176   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x10000);
176   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x10000);
177177
178178   gfx_element_set_source(machine.gfx[2], state->m_rambanks);
179179
r14976r14977
377377
378378      //logerror("robs %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device()));
379379      m_cur_rombank = data;
380      memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x10000 + 0x2000 * m_cur_rombank);
380      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000 + 0x2000 * m_cur_rombank);
381381   }
382382}
383383
r14976r14977
397397      //logerror("robs2 %02x (%04x)\n", data, cpu_get_pc(&space.device()));
398398
399399      m_cur_rombank2 = data;
400      memory_set_bankptr(machine(), "bank6", machine().region("slave")->base() + 0x10000 + 0x4000 * m_cur_rombank2);
400      membank("bank6")->set_base(machine().root_device().memregion("slave")->base() + 0x10000 + 0x4000 * m_cur_rombank2);
401401   }
402402}
403403
r14976r14977
435435         m_current_notifier[offset] = 0;
436436         m_current_base[offset] = m_empty_ram;
437437      }
438      memory_set_bankptr(machine(), bankname[offset], m_current_base[offset]);
438      membank(bankname[offset])->set_base(m_current_base[offset]);
439439   }
440440}
441441
r14976r14977
596596   }
597597   else
598598   {
599      state->m_adpcm_data = device->machine().region("adpcm")->base()[state->m_adpcm_pos];
599      state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos];
600600      state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0x1ffff;
601601      msm5205_data_w(device, state->m_adpcm_data >> 4);
602602   }
r14976r14977
740740
741741WRITE8_MEMBER(taitol_state::sound_bankswitch_w)
742742{
743   UINT8 *RAM = machine().region("audiocpu")->base();
743   UINT8 *RAM = memregion("audiocpu")->base();
744744   int banknum = (data - 1) & 3;
745745
746   memory_set_bankptr (machine(), "bank7", &RAM [0x10000 + (banknum * 0x4000)]);
746   membank ("bank7")->set_base (&RAM [0x10000 + (banknum * 0x4000)]);
747747}
748748
749749static ADDRESS_MAP_START( raimais_3_map, AS_PROGRAM, 8, taitol_state )
r14976r14977
17841784   if (state->m_cur_bank != (data & 0x03))
17851785   {
17861786      int bankaddress;
1787      UINT8 *RAM = device->machine().region("audiocpu")->base();
1787      UINT8 *RAM = state->memregion("audiocpu")->base();
17881788
17891789      state->m_cur_bank = data & 0x03;
17901790      bankaddress = 0x10000 + (state->m_cur_bank - 1) * 0x4000;
1791      memory_set_bankptr(device->machine(), "bank7", &RAM[bankaddress]);
1791      state->membank("bank7")->set_base(&RAM[bankaddress]);
17921792      //logerror ("YM2203 bank change val=%02x  pc=%04x\n", state->m_cur_bank, cpu_get_pc(&space->device()) );
17931793   }
17941794}
r14976r14977
27222722            v |= 1 << (7 - j);
27232723      tab[i] = v;
27242724   }
2725   p = machine.region("maincpu")->base();
2725   p = machine.root_device().memregion("maincpu")->base();
27262726   for (i = 0; i < 0x20000; i++)
27272727   {
27282728      *p = tab[*p];
src/mame/drivers/groundfx.c
r14976r14977
453453static DRIVER_INIT( groundfx )
454454{
455455   UINT32 offset,i;
456   UINT8 *gfx = machine.region("gfx3")->base();
457   int size=machine.region("gfx3")->bytes();
456   UINT8 *gfx = machine.root_device().memregion("gfx3")->base();
457   int size=machine.root_device().memregion("gfx3")->bytes();
458458   int data;
459459
460460   /* Speedup handlers */
src/mame/drivers/segald.c
r14976r14977
240240WRITE8_MEMBER(segald_state::astron_io_bankswitch_w)
241241{
242242   logerror("Banking 0x%x\n", data);
243   memory_set_bank(machine(), "bank1", data & 0xff);
243   membank("bank1")->set_entry(data & 0xff);
244244}
245245
246246
r14976r14977
597597
598598static DRIVER_INIT( astron )
599599{
600   UINT8 *ROM = machine.region("maincpu")->base();
601   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x8000], 0x4000);
600   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
601   machine.root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x8000], 0x4000);
602602}
603603
604604
src/mame/drivers/suprloco.c
r14976r14977
258258   int i, j, k, color_source, color_dest;
259259   UINT8 *source, *dest, *lookup;
260260
261   source = machine.region("gfx1")->base();
261   source = machine.root_device().memregion("gfx1")->base();
262262   dest   = source + 0x6000;
263   lookup = machine.region("proms")->base() + 0x0200;
263   lookup = machine.root_device().memregion("proms")->base() + 0x0200;
264264
265265   for (i = 0; i < 0x80; i++, lookup += 8)
266266   {
src/mame/drivers/srmp5.c
r14976r14977
268268READ32_MEMBER(srmp5_state::data_r)
269269{
270270   UINT32 data;
271   const UINT8 *usr = machine().region("user2")->base();
271   const UINT8 *usr = memregion("user2")->base();
272272
273273   data=((m_databank>>4)&0xf)*0x100000; //guess
274274   data=usr[data+offset*2]+usr[data+offset*2+1]*256;
src/mame/drivers/m92.c
r14976r14977
252252
253253READ16_MEMBER(m92_state::m92_eeprom_r)
254254{
255   UINT8 *RAM = machine().region("eeprom")->base();
255   UINT8 *RAM = memregion("eeprom")->base();
256256//  logerror("%05x: EEPROM RE %04x\n",cpu_get_pc(&space.device()),offset);
257257   return RAM[offset] | 0xff00;
258258}
259259
260260WRITE16_MEMBER(m92_state::m92_eeprom_w)
261261{
262   UINT8 *RAM = machine().region("eeprom")->base();
262   UINT8 *RAM = memregion("eeprom")->base();
263263//  logerror("%05x: EEPROM WR %04x\n",cpu_get_pc(&space.device()),offset);
264264   if (ACCESSING_BITS_0_7)
265265      RAM[offset] = data;
r14976r14977
281281{
282282   if (ACCESSING_BITS_0_7)
283283   {
284      memory_set_bank(machine(), "bank1", (data & 0x06) >> 1);
284      membank("bank1")->set_entry((data & 0x06) >> 1);
285285      if (data & 0xf9)
286286         logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space.device()), data);
287287   }
r14976r14977
20602060static DRIVER_INIT( m92 )
20612061{
20622062   m92_state *state = machine.driver_data<m92_state>();
2063   UINT8 *ROM = machine.region("maincpu")->base();
2063   UINT8 *ROM = state->memregion("maincpu")->base();
20642064
2065   memory_set_bankptr(machine, "bank1", &ROM[0xa0000]);
2065   state->membank("bank1")->set_base(&ROM[0xa0000]);
20662066
20672067   state->m_game_kludge = 0;
20682068   state->m_irq_vectorbase = 0x80;
r14976r14977
20722072static DRIVER_INIT( m92_alt )
20732073{
20742074   m92_state *state = machine.driver_data<m92_state>();
2075   UINT8 *ROM = machine.region("maincpu")->base();
2075   UINT8 *ROM = state->memregion("maincpu")->base();
20762076
2077   memory_set_bankptr(machine, "bank1", &ROM[0xa0000]);
2077   state->membank("bank1")->set_base(&ROM[0xa0000]);
20782078
20792079   state->m_game_kludge = 0;
20802080   state->m_irq_vectorbase = 0x20;
r14976r14977
20932093static DRIVER_INIT( m92_bank )
20942094{
20952095   m92_state *state = machine.driver_data<m92_state>();
2096   UINT8 *ROM = machine.region("maincpu")->base();
2096   UINT8 *ROM = state->memregion("maincpu")->base();
20972097
2098   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x80000], 0x20000);
2098   state->membank("bank1")->configure_entries(0, 4, &ROM[0x80000], 0x20000);
20992099   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),state));
21002100
21012101   state->m_game_kludge = 0;
r14976r14977
21062106static DRIVER_INIT( majtitl2 )
21072107{
21082108   m92_state *state = machine.driver_data<m92_state>();
2109   UINT8 *ROM = machine.region("maincpu")->base();
2109   UINT8 *ROM = state->memregion("maincpu")->base();
21102110
2111   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x80000], 0x20000);
2111   state->membank("bank1")->configure_entries(0, 4, &ROM[0x80000], 0x20000);
21122112   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),state));
21132113
21142114   /* This game has an eeprom on the game board */
r14976r14977
21222122static DRIVER_INIT( ppan )
21232123{
21242124   m92_state *state = machine.driver_data<m92_state>();
2125   UINT8 *ROM = machine.region("maincpu")->base();
2126   memory_set_bankptr(machine, "bank1", &ROM[0xa0000]);
2125   UINT8 *ROM = state->memregion("maincpu")->base();
2126   state->membank("bank1")->set_base(&ROM[0xa0000]);
21272127
21282128   state->m_game_kludge = 0;
21292129   state->m_irq_vectorbase = 0x80;
src/mame/drivers/m58.c
r14976r14977
434434   // on these sets the content of the sprite color PROM needs reversing
435435   //  are the proms on the other sets from bootleg boards, or hand modified?
436436   UINT8* buffer = auto_alloc_array(machine, UINT8, 0x10);
437   UINT8* region = machine.region("proms")->base();
437   UINT8* region = machine.root_device().memregion("proms")->base();
438438   int i;
439439
440440   for (i=0;i<0x10;i++)
src/mame/drivers/fcombat.c
r14976r14977
100100   int wx = (m_tx + m_fcombat_sh) / 16;
101101   int wy = (m_ty * 2 + m_fcombat_sv) / 16;
102102
103   return machine().region("user2")->base()[wx * 32 * 16 + wy];
103   return memregion("user2")->base()[wx * 32 * 16 + wy];
104104}
105105
106106WRITE8_MEMBER(fcombat_state::ee00_w)
r14976r14977
339339
340340   /* make a temporary copy of the character data */
341341   src = temp;
342   dst = machine.region("gfx1")->base();
343   length = machine.region("gfx1")->bytes();
342   dst = machine.root_device().memregion("gfx1")->base();
343   length = machine.root_device().memregion("gfx1")->bytes();
344344   memcpy(src, dst, length);
345345
346346   /* decode the characters */
r14976r14977
357357
358358   /* make a temporary copy of the sprite data */
359359   src = temp;
360   dst = machine.region("gfx2")->base();
361   length = machine.region("gfx2")->bytes();
360   dst = machine.root_device().memregion("gfx2")->base();
361   length = machine.root_device().memregion("gfx2")->bytes();
362362   memcpy(src, dst, length);
363363
364364   /* decode the sprites */
r14976r14977
378378
379379   /* make a temporary copy of the character data */
380380   src = temp;
381   dst = machine.region("gfx3")->base();
382   length = machine.region("gfx3")->bytes();
381   dst = machine.root_device().memregion("gfx3")->base();
382   length = machine.root_device().memregion("gfx3")->bytes();
383383   memcpy(src, dst, length);
384384
385385   /* decode the characters */
r14976r14977
397397   }
398398
399399   src = temp;
400   dst = machine.region("user1")->base();
401   length = machine.region("user1")->bytes();
400   dst = machine.root_device().memregion("user1")->base();
401   length = machine.root_device().memregion("user1")->bytes();
402402   memcpy(src, dst, length);
403403
404404   for (oldaddr = 0; oldaddr < 32; oldaddr++)
r14976r14977
409409
410410
411411   src = temp;
412   dst = machine.region("user2")->base();
413   length = machine.region("user2")->bytes();
412   dst = machine.root_device().memregion("user2")->base();
413   length = machine.root_device().memregion("user2")->bytes();
414414   memcpy(src, dst, length);
415415
416416   for (oldaddr = 0; oldaddr < 32; oldaddr++)
src/mame/drivers/feversoc.c
r14976r14977
298298
299299static DRIVER_INIT( feversoc )
300300{
301   seibuspi_rise11_sprite_decrypt_feversoc(machine.region("gfx1")->base(), 0x200000);
301   seibuspi_rise11_sprite_decrypt_feversoc(machine.root_device().memregion("gfx1")->base(), 0x200000);
302302}
303303
304304GAME( 2004, feversoc,  0,       feversoc,  feversoc,  feversoc, ROT0, "Seibu Kaihatsu", "Fever Soccer", 0 )
src/mame/drivers/multigam.c
r14976r14977
196196   /* count determines the size of the area mapped in KB */
197197   for (i = 0; i < count; i++, offset += 0x400)
198198   {
199      memory_set_bankptr(machine, banknames[i + start], machine.region("gfx1")->base() + offset);
199      machine.root_device().membank(banknames[i + start])->set_base(machine.root_device().memregion("gfx1")->base() + offset);
200200   }
201201}
202202
r14976r14977
209209   /* count determines the size of the area mapped in KB */
210210   for (i = 0; i < count; i++, offset += 0x400)
211211   {
212      memory_set_bankptr(machine, banknames[i + start], state->m_vram + offset);
212      state->membank(banknames[i + start])->set_base(state->m_vram + offset);
213213   }
214214}
215215
r14976r14977
293293WRITE8_MEMBER(multigam_state::multigam_switch_prg_rom)
294294{
295295   /* switch PRG rom */
296   UINT8* dst = machine().region("maincpu")->base();
297   UINT8* src = machine().region("user1")->base();
296   UINT8* dst = memregion("maincpu")->base();
297   UINT8* src = memregion("user1")->base();
298298
299299   if (data & 0x80)
300300   {
r14976r14977
313313
314314WRITE8_MEMBER(multigam_state::multigam_switch_gfx_rom)
315315{
316   memory_set_bankptr(machine(), "bank1", machine().region("gfx1")->base() + (0x2000 * (data & 0x3f)));
316   membank("bank1")->set_base(machine().root_device().memregion("gfx1")->base() + (0x2000 * (data & 0x3f)));
317317   set_mirroring(data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
318318   m_game_gfx_bank = data;
319319};
r14976r14977
323323{
324324   if (m_game_gfx_bank & 0x80)
325325   {
326      memory_set_bankptr(machine(), "bank1", machine().region("gfx1")->base() + (0x2000 * ((data & 0x3) + (m_game_gfx_bank & 0x3c))));
326      membank("bank1")->set_base(machine().root_device().memregion("gfx1")->base() + (0x2000 * ((data & 0x3) + (m_game_gfx_bank & 0x3c))));
327327   }
328328   else
329329   {
r14976r14977
408408         if (m_multigam3_mmc3_last_bank != (data & 0xc0))
409409         {
410410            int bank;
411            UINT8 *prg = machine().region("maincpu")->base();
411            UINT8 *prg = memregion("maincpu")->base();
412412
413413            /* reset the banks */
414414            if (m_multigam3_mmc3_command & 0x40)
r14976r14977
461461
462462               case 6: /* program banking */
463463               {
464                  UINT8 *prg = machine().region("maincpu")->base();
464                  UINT8 *prg = memregion("maincpu")->base();
465465                  if (m_multigam3_mmc3_command & 0x40)
466466                  {
467467                     /* high bank */
r14976r14977
486486               case 7: /* program banking */
487487                  {
488488                     /* mid bank */
489                     UINT8 *prg = machine().region("maincpu")->base();
489                     UINT8 *prg = memregion("maincpu")->base();
490490
491491                     m_multigam3_mmc3_banks[1] = data & bankmask;
492492                     bank = m_multigam3_mmc3_banks[1] * 0x2000;
r14976r14977
511511      case 0x2001: /* enable ram at $6000 */
512512         if (data & 0x80)
513513         {
514            memory_set_bankptr(machine(), "bank10", m_multigmc_mmc3_6000_ram);
514            membank("bank10")->set_base(m_multigmc_mmc3_6000_ram);
515515         }
516516         else
517517         {
518            memory_set_bankptr(machine(), "bank10", machine().region("maincpu")->base() + 0x6000);
518            membank("bank10")->set_base(machine().root_device().memregion("maincpu")->base() + 0x6000);
519519         }
520520         if (data & 0x40)
521521         {
r14976r14977
544544static void multigam_init_mmc3(running_machine &machine, UINT8 *prg_base, int prg_size, int chr_bank_base)
545545{
546546   multigam_state *state = machine.driver_data<multigam_state>();
547   UINT8* dst = machine.region("maincpu")->base();
547   UINT8* dst = state->memregion("maincpu")->base();
548548
549549   // Tom & Jerry in Super Game III enables 6000 ram, but does not read/write it
550550   // however, it expects ROM from 6000 there (code jumps to $6xxx)
r14976r14977
588588WRITE8_MEMBER(multigam_state::multigm3_switch_prg_rom)
589589{
590590   /* switch PRG rom */
591   UINT8* dst = machine().region("maincpu")->base();
592   UINT8* src = machine().region("user1")->base();
591   UINT8* dst = memregion("maincpu")->base();
592   UINT8* src = memregion("user1")->base();
593593
594594   if (data == 0xa8)
595595   {
r14976r14977
599599   else
600600   {
601601      space.install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigm3_mapper2_w),this) );
602      memory_set_bankptr(machine(), "bank10", machine().region("maincpu")->base() + 0x6000);
602      membank("bank10")->set_base(machine().root_device().memregion("maincpu")->base() + 0x6000);
603603   }
604604
605605   if (data & 0x80)
r14976r14977
651651
652652WRITE8_MEMBER(multigam_state::multigam3_mapper02_rom_switch_w)
653653{
654   UINT8* mem = machine().region("maincpu")->base();
654   UINT8* mem = memregion("maincpu")->base();
655655   int bankmask = (m_mapper02_prg_size/0x4000) - 1;
656656   memcpy(mem + 0x8000, m_mapper02_prg_base + 0x4000*(data & bankmask), 0x4000);
657657}
r14976r14977
660660{
661661   multigam_state *state = machine.driver_data<multigam_state>();
662662   ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
663   UINT8* mem = machine.region("maincpu")->base();
663   UINT8* mem = state->memregion("maincpu")->base();
664664   memcpy(mem + 0x8000, prg_base + prg_size - 0x8000, 0x8000);
665665   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigam3_mapper02_rom_switch_w),state));
666666
r14976r14977
780780         case 3:   /* program banking */
781781            {
782782               int bank = (m_mmc1_shiftreg & m_mmc1_rom_mask) * 0x4000;
783               UINT8 *prg = machine().region("maincpu")->base();
783               UINT8 *prg = memregion("maincpu")->base();
784784
785785               if (!m_size16k)
786786               {
r14976r14977
813813static void multigam_init_mmc1(running_machine &machine, UINT8 *prg_base, int prg_size, int chr_bank_base)
814814{
815815   multigam_state *state = machine.driver_data<multigam_state>();
816   UINT8* dst = machine.region("maincpu")->base();
816   UINT8* dst = state->memregion("maincpu")->base();
817817   ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
818818
819819   memcpy(&dst[0x8000], prg_base + (prg_size - 0x8000), 0x8000);
r14976r14977
856856{
857857   multigam_state *state = machine.driver_data<multigam_state>();
858858   ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
859   UINT8* mem = machine.region("maincpu")->base();
859   UINT8* mem = state->memregion("maincpu")->base();
860860
861861   // video bank
862862   if (state->m_supergm3_chr_bank == 0x10 ||
r14976r14977
865865      // VRAM
866866      ppu->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1");
867867      ppu->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x1fff, "bank1");
868      memory_set_bankptr(machine, "bank1", state->m_vram);
868      state->membank("bank1")->set_base(state->m_vram);
869869
870870      if (state->m_supergm3_chr_bank == 0x40)
871871         state->set_mirroring(PPU_MIRROR_VERT);
r14976r14977
890890   {
891891      // title screen
892892      memcpy(mem + 0x8000, mem + 0x18000, 0x8000);
893      memory_set_bankptr(machine, "bank10", mem + 0x6000);
893      state->membank("bank10")->set_base(mem + 0x6000);
894894      ppu->set_scanline_callback(0);
895895   }
896896   else if ((state->m_supergm3_prg_bank & 0x40) == 0)
897897   {
898898      // mapper 02
899899      multigam_init_mapper02(machine,
900         machine.region("user1")->base() + (state->m_supergm3_prg_bank & 0x1f)*0x20000,
900         machine.root_device().memregion("user1")->base() + (state->m_supergm3_prg_bank & 0x1f)*0x20000,
901901         0x20000);
902902   }
903903   else if (state->m_supergm3_chr_bank & 0x10)
904904   {
905905      // MMC3
906906      multigam_init_mmc3(machine,
907         machine.region("user1")->base() + (state->m_supergm3_prg_bank & 0x1f)*0x20000,
907         machine.root_device().memregion("user1")->base() + (state->m_supergm3_prg_bank & 0x1f)*0x20000,
908908         (state->m_supergm3_prg_bank & 0x20) ? 0x20000 : 0x40000,
909909         (state->m_supergm3_chr_bank & 0x0f)*0x80);
910910   }
r14976r14977
912912   {
913913      //MMC1
914914      multigam_init_mmc1(machine,
915         machine.region("user1")->base() + (state->m_supergm3_prg_bank & 0x1f)*0x20000,
915         machine.root_device().memregion("user1")->base() + (state->m_supergm3_prg_bank & 0x1f)*0x20000,
916916         0x20000,
917917         (state->m_supergm3_chr_bank & 0x0f)*0x80/4 );
918918   }
r14976r14977
11391139
11401140   machine.device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),state), write8_delegate(FUNC(multigam_state::multigam_nt_w),state));
11411141   machine.device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1");
1142   memory_set_bankptr(machine, "bank1", machine.region("gfx1")->base());
1142   state->membank("bank1")->set_base(state->memregion("gfx1")->base());
11431143}
11441144
11451145static MACHINE_START( multigm3 )
r14976r14977
13731373
13741374   const UINT8 decode[16]  = { 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a };
13751375
1376   multigm3_decrypt(machine.region("maincpu")->base(), machine.region("maincpu")->bytes(), decode );
1377   multigm3_decrypt(machine.region("user1")->base(), machine.region("user1")->bytes(), decode );
1376   multigm3_decrypt(machine.root_device().memregion("maincpu")->base(), machine.root_device().memregion("maincpu")->bytes(), decode );
1377   multigm3_decrypt(machine.root_device().memregion("user1")->base(), machine.root_device().memregion("user1")->bytes(), decode );
13781378
13791379   state->m_multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000);
13801380
r14976r14977
13911391   int i;
13921392   int addr;
13931393
1394   rom = machine.region("maincpu")->base();
1394   rom = machine.root_device().memregion("maincpu")->base();
13951395   size = 0x8000;
13961396   memcpy(buf, rom, size);
13971397   for (i = 0; i < size; i++)
r14976r14977
14011401      rom[i] = buf[addr];
14021402   }
14031403
1404   rom = machine.region("user1")->base();
1404   rom = machine.root_device().memregion("user1")->base();
14051405   size = 0x80000;
14061406   memcpy(buf, rom, size);
14071407   for (i = 0; i < size; i++)
r14976r14977
14091409      addr = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,8,11,12,10,9,7,6,5,4,3,2,1,0);
14101410      rom[i] = buf[addr];
14111411   }
1412   rom = machine.region("gfx1")->base();
1412   rom = machine.root_device().memregion("gfx1")->base();
14131413   size = 0x80000;
14141414   memcpy(buf, rom, size);
14151415   for (i = 0; i < size; i++)
src/mame/drivers/fuukifg2.c
r14976r14977
115115WRITE8_MEMBER(fuuki16_state::fuuki16_sound_rombank_w)
116116{
117117   if (data <= 2)
118      memory_set_bank(machine(), "bank1", data);
118      membank("bank1")->set_entry(data);
119119   else
120120      logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", cpu_get_pc(&space.device()), data);
121121}
r14976r14977
441441static MACHINE_START( fuuki16 )
442442{
443443   fuuki16_state *state = machine.driver_data<fuuki16_state>();
444   UINT8 *ROM = machine.region("audiocpu")->base();
444   UINT8 *ROM = state->memregion("audiocpu")->base();
445445
446   memory_configure_bank(machine, "bank1", 0, 3, &ROM[0x10000], 0x8000);
446   state->membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x8000);
447447
448448   state->m_maincpu = machine.device("maincpu");
449449   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/vcombat.c
r14976r14977
439439static DRIVER_INIT( vcombat )
440440{
441441   vcombat_state *state = machine.driver_data<vcombat_state>();
442   UINT8 *ROM = machine.region("maincpu")->base();
442   UINT8 *ROM = state->memregion("maincpu")->base();
443443
444444   /* The two i860s execute out of RAM */
445445   address_space *space = machine.device<i860_device>("vid_0")->space(AS_PROGRAM);
src/mame/drivers/shangha3.c
r14976r14977
5858
5959READ16_MEMBER(shangha3_state::heberpop_gfxrom_r)
6060{
61   UINT8 *ROM = machine().region("gfx1")->base();
61   UINT8 *ROM = memregion("gfx1")->base();
6262
6363   return ROM[2*offset] | (ROM[2*offset+1] << 8);
6464}
src/mame/drivers/39in1.c
r14976r14977
15691569
15701570static MACHINE_START(39in1)
15711571{
1572   UINT8 *ROM = machine.region("maincpu")->base();
1572   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
15731573   int i;
15741574
15751575   for (i = 0; i < 0x80000; i += 2)
src/mame/drivers/fortecar.c
r14976r14977
372372
373373static PALETTE_INIT( fortecar )
374374{
375   const UINT8 *color_prom = machine.region("proms")->base();
375   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
376376/* Video resistors...
377377
378378O1 (LS374) R1K  RED
src/mame/drivers/gunpey.c
r14976r14977
134134{
135135   UINT16 *blit_buffer = m_blit_buffer;
136136   UINT16 *blit_ram = m_blit_ram;
137   UINT8 *blit_rom = machine().region("blit_data")->base();
137   UINT8 *blit_rom = memregion("blit_data")->base();
138138   int x,y;
139139
140140   blit_ram[offset] = data;
r14976r14977
307307static PALETTE_INIT( gunpey )
308308{
309309   int i,r,g,b,val;
310   UINT8 *blit_rom = machine.region("blit_data")->base();
310   UINT8 *blit_rom = machine.root_device().memregion("blit_data")->base();
311311
312312   for (i = 0; i < 512; i+=2)
313313   {
r14976r14977
384384
385385static DRIVER_INIT( gunpey )
386386{
387   UINT8 *rom = machine.region("maincpu")->base();
387   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
388388
389389   /* patch SLOOOOW cycle checks ... */
390390   rom[0x848b5] = 0x7e;
src/mame/drivers/guab.c
r14976r14977
319319{
320320   guab_state *state = machine.driver_data<guab_state>();
321321   struct wd1770 &fdc = state->m_fdc;
322   UINT8* disk = (UINT8*)machine.region("user1")->base();
322   UINT8* disk = (UINT8*)state->memregion("user1")->base();
323323   int more_data = 0;
324324
325325   /*
src/mame/drivers/baraduke.c
r14976r14977
536536   int i;
537537
538538   /* unpack the third tile ROM */
539   rom = machine.region("gfx2")->base() + 0x8000;
539   rom = machine.root_device().memregion("gfx2")->base() + 0x8000;
540540   for (i = 0x2000;i < 0x4000;i++)
541541   {
542542      rom[i + 0x2000] = rom[i];
src/mame/drivers/cyclemb.c
r14976r14977
101101
102102static PALETTE_INIT( cyclemb )
103103{
104   const UINT8 *color_prom = machine.region("proms")->base();
104   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
105105   int i,r,g,b,val;
106106   int bit0,bit1,bit2;
107107
r14976r14977
227227
228228WRITE8_MEMBER(cyclemb_state::cyclemb_bankswitch_w)
229229{
230   memory_set_bank(machine(), "bank1", data & 3);
230   membank("bank1")->set_entry(data & 3);
231231}
232232
233233#if 0
r14976r14977
613613
614614static DRIVER_INIT( cyclemb )
615615{
616   memory_configure_bank(machine, "bank1", 0, 4, machine.region("maincpu")->base() + 0x10000, 0x1000);
616   machine.root_device().membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x1000);
617617}
618618
619619GAME( 1984, cyclemb,  0,   cyclemb,  cyclemb,  cyclemb, ROT0, "Taito Corporation", "Cycle Mahbou (Japan)", GAME_NOT_WORKING )
src/mame/drivers/mcr.c
r14976r14977
17841784   ROM_LOAD( "sfvid.1b",     0x2000, 0x2000, CRC(78801e83) SHA1(23b5811a03fe4ad576c5313d2205203577300159) )
17851785   ROM_LOAD( "sfvid.1d",     0x4000, 0x2000, CRC(4d8445cf) SHA1(fbe427da0e758b79eb2230713f2cd12e6f8bdeb7) )
17861786   ROM_LOAD( "sfvid.1e",     0x6000, 0x2000, CRC(3da25495) SHA1(e7b703bc8caca7497af92efc869c6f1b7dbc8bf1) )
1787
1788   ROM_REGION( 0x0020, "proms", 0 )
1789   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
17901787ROM_END
17911788
17921789
r14976r14977
18141811   ROM_LOAD( "2700b-v2.1d",  0x2000, 0x2000, CRC(565ea97d) SHA1(4a30a371ad407bf774cf08bf528f824675383698) )
18151812   ROM_LOAD( "2800c-v2.1b",  0x4000, 0x2000, CRC(f3be56a1) SHA1(eb3eb0379a918a2959565572d88f9b0f021d1c2a) )
18161813   ROM_LOAD( "2900d-v2.1a",  0x6000, 0x2000, CRC(77da795e) SHA1(ebebc8551e7a7534d89bb8458eb2576713cfbeaf) )
1817
1818   ROM_REGION( 0x0020, "proms", 0 )
1819   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
18201814ROM_END
18211815
18221816ROM_START( kickman )
r14976r14977
18431837   ROM_LOAD( "2700b-v2.1d",  0x2000, 0x2000, CRC(565ea97d) SHA1(4a30a371ad407bf774cf08bf528f824675383698) )
18441838   ROM_LOAD( "2800c-v2.1b",  0x4000, 0x2000, CRC(f3be56a1) SHA1(eb3eb0379a918a2959565572d88f9b0f021d1c2a) )
18451839   ROM_LOAD( "2900d-v2.1a",  0x6000, 0x2000, CRC(77da795e) SHA1(ebebc8551e7a7534d89bb8458eb2576713cfbeaf) )
1846
1847   ROM_REGION( 0x0020, "proms", 0 )
1848   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
18491840ROM_END
18501841
18511842ROM_START( kickc )
r14976r14977
18721863   ROM_LOAD( "2700-b.1d",    0x2000, 0x2000, CRC(78eda36c) SHA1(5cf9da6f364f586f324e7ac529db0dc273498320) )
18731864   ROM_LOAD( "2800-c.1b",    0x4000, 0x2000, CRC(c93e0170) SHA1(a7efdb6fd13dccd8d8d10de61b87585828bde6ac) )
18741865   ROM_LOAD( "2900-d.1a",    0x6000, 0x2000, CRC(91e59383) SHA1(bf87642cc747f1abbd80c6f529adfa60a1d9bc9e) )
1875
1876   ROM_REGION( 0x0020, "proms", 0 )
1877   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
18781866ROM_END
18791867
18801868
r14976r14977
19011889   ROM_LOAD( "sh-fg.01",     0x2000, 0x2000, CRC(ba1a38b4) SHA1(cee5f0a66e40c779f1bfbb4bfafe5301385e7dae) )
19021890   ROM_LOAD( "sh-fg.02",     0x4000, 0x2000, CRC(6b57f6da) SHA1(71165df59dd5ca037116dc0f46fd4f6aac6dbfd1) )
19031891   ROM_LOAD( "sh-fg.03",     0x6000, 0x2000, CRC(37ea9d07) SHA1(82e006b01ee12390308be530d4b68fc2404b6b91) )
1904
1905   ROM_REGION( 0x0020, "proms", 0 )
1906   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )
19071892ROM_END
19081893
19091894ROM_START( shollow2 )
r14976r14977
19291914   ROM_LOAD( "sh-fg.01",     0x2000, 0x2000, CRC(ba1a38b4) SHA1(cee5f0a66e40c779f1bfbb4bfafe5301385e7dae) )
19301915   ROM_LOAD( "sh-fg.02",     0x4000, 0x2000, CRC(6b57f6da) SHA1(71165df59dd5ca037116dc0f46fd4f6aac6dbfd1) )
19311916   ROM_LOAD( "sh-fg.03",     0x6000, 0x2000, CRC(37ea9d07) SHA1(82e006b01ee12390308be530d4b68fc2404b6b91) )
1932
1933   ROM_REGION( 0x0020, "proms", 0 )
1934   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )
19351917ROM_END
19361918
19371919/*
r14976r14977
19621944   ROM_LOAD( "vgc.cb1",     0x4000, 0x2000, CRC(3329f9d4) SHA1(11f4d744374e475d2c5b195a9f70888414529dd3) )
19631945   ROM_LOAD( "vga.a1",      0x6000, 0x2000, CRC(9743f873) SHA1(71ed80ecd8caaf9fce1d7010f95c4678c9bd7102) )
19641946
1965   ROM_REGION( 0x0020, "proms", 0 ) /* PROM's located on the Super Sound I/O Board (90913) */
1966   ROM_LOAD( "9860-07axn-axhd.d12",     0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) ) /* N82S123 */
1967
19681947   ROM_REGION( 0x0005, "scpu_pals", 0) /* PAL's located on the Super CPU Board (90010) */
19691948   ROM_LOAD( "0066-313bx-xxqx.a12.bin", 0x0000, 0x0001, NO_DUMP)
19701949   ROM_LOAD( "0066-315bx-xxqx.b12.bin", 0x0000, 0x0001, NO_DUMP)
r14976r14977
20011980   ROM_LOAD( "vgc.cb1",     0x4000, 0x2000, CRC(3329f9d4) SHA1(11f4d744374e475d2c5b195a9f70888414529dd3) )
20021981   ROM_LOAD( "vga.a1",      0x6000, 0x2000, CRC(9743f873) SHA1(71ed80ecd8caaf9fce1d7010f95c4678c9bd7102) )
20031982
2004   ROM_REGION( 0x0020, "proms", 0 ) /* PROM's located on the Super Sound I/O Board (90913) */
2005   ROM_LOAD( "9860-07axn-axhd.d12",     0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) ) /* N82S123 */
2006
20071983   ROM_REGION( 0x0005, "scpu_pals", 0) /* PAL's located on the Super CPU Board (90010) */
20081984   ROM_LOAD( "0066-313bx-xxqx.a12.bin", 0x0000, 0x0001, NO_DUMP)
20091985   ROM_LOAD( "0066-315bx-xxqx.b12.bin", 0x0000, 0x0001, NO_DUMP)
r14976r14977
20402016   ROM_LOAD( "vgc.cb1",     0x4000, 0x2000, CRC(3329f9d4) SHA1(11f4d744374e475d2c5b195a9f70888414529dd3) )
20412017   ROM_LOAD( "vga.a1",      0x6000, 0x2000, CRC(9743f873) SHA1(71ed80ecd8caaf9fce1d7010f95c4678c9bd7102) )
20422018
2043   ROM_REGION( 0x0020, "proms", 0 ) /* PROM's located on the Super Sound I/O Board (90913) */
2044   ROM_LOAD( "9860-07axn-axhd.d12",     0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) ) /* N82S123 */
2045
20462019   ROM_REGION( 0x0005, "scpu_pals", 0) /* PAL's located on the Super CPU Board (90010) */
20472020   ROM_LOAD( "0066-313bx-xxqx.a12.bin", 0x0000, 0x0001, NO_DUMP)
20482021   ROM_LOAD( "0066-315bx-xxqx.b12.bin", 0x0000, 0x0001, NO_DUMP)
r14976r14977
20792052   ROM_LOAD( "vgc.cb1",      0x4000, 0x2000, CRC(3329f9d4) SHA1(11f4d744374e475d2c5b195a9f70888414529dd3) )
20802053   ROM_LOAD( "vga.a1",       0x6000, 0x2000, CRC(9743f873) SHA1(71ed80ecd8caaf9fce1d7010f95c4678c9bd7102) )
20812054
2082   ROM_REGION( 0x0020, "proms", 0 ) /* PROM's located on the Super Sound I/O Board (90913) */
2083   ROM_LOAD( "9860-07axn-axhd.d12",     0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) ) /* N82S123 */
2084
20852055   ROM_REGION( 0x0005, "scpu_pals", 0) /* PAL's located on the Super CPU Board (90010) */
20862056   ROM_LOAD( "0066-313bx-xxqx.a12.bin", 0x0000, 0x0001, NO_DUMP)
20872057   ROM_LOAD( "0066-315bx-xxqx.b12.bin", 0x0000, 0x0001, NO_DUMP)
r14976r14977
21132083   ROM_LOAD( "kozmkvid.1d",  0x2000, 0x2000, CRC(4e23b35b) SHA1(322221ea207ad0eeb0e711f3af473f71b70f7128) )
21142084   ROM_LOAD( "kozmkvid.1b",  0x4000, 0x2000, CRC(c6041ba7) SHA1(9bd55f06d360657af5c56062053221dd24027978) )
21152085   ROM_LOAD( "kozmkvid.1a",  0x6000, 0x2000, CRC(b57fb0ff) SHA1(e4dde9fb09a0e5051352ba05d776ebbe0cd81504) )
2116
2117   ROM_REGION( 0x0020, "proms", 0 )
2118   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
21192086ROM_END
21202087
21212088
r14976r14977
21412108   ROM_LOAD( "dmanfg1.bin",  0x2000, 0x2000, CRC(16aa4b9b) SHA1(700f7dc3ce20dacce38dc40783b28fc9b4c1443a) )
21422109   ROM_LOAD( "dmanfg2.bin",  0x4000, 0x2000, CRC(4a8e76b8) SHA1(563b9db39940060265b771f3b0c4a2055963cf2b) )
21432110   ROM_LOAD( "dmanfg3.bin",  0x6000, 0x2000, CRC(1f39257e) SHA1(645f9b7e8bd2254167d15567c3bd577d3a574f7d) )
2144
2145   ROM_REGION( 0x0020, "proms", 0 )
2146   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
21472111ROM_END
21482112
21492113
r14976r14977
21682132   ROM_LOAD( "wackovid.1d",  0x2000, 0x2000, CRC(a02f1672) SHA1(1d1b7eada4dae5e31dc1474b13cefd71926cbfc7) )
21692133   ROM_LOAD( "wackovid.1b",  0x4000, 0x2000, CRC(7d899790) SHA1(aa320f4ac41d2a1acec4880a8d95dfe6406e210e) )
21702134   ROM_LOAD( "wackovid.1a",  0x6000, 0x2000, CRC(080be3ad) SHA1(ead2be17d749a15841123e42d434aab573870fba) )
2171
2172   ROM_REGION( 0x0020, "proms", 0 )
2173   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
21742135ROM_END
21752136
21762137
r14976r14977
21952156   ROM_LOAD( "vid_c1",  0x2000, 0x2000, CRC(62ed737b) SHA1(954c1f17da2ceb77e710faf0822d29381b873a07) )
21962157   ROM_LOAD( "vid_b1",  0x4000, 0x2000, CRC(0939921e) SHA1(f52d3475232557959e501f70765a4ad472300e84) )
21972158   ROM_LOAD( "vid_a1",  0x6000, 0x2000, CRC(ef515824) SHA1(983af762733405b96351ef4910f4f4be40c4880e) )
2198
2199   ROM_REGION( 0x0020, "proms", 0 )
2200   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
22012159ROM_END
22022160
22032161ROM_START( twotigerc )
r14976r14977
22212179   ROM_LOAD( "2tgrfg1.bin",  0x2000, 0x2000, CRC(fbcaffa5) SHA1(5145cd7cc08552388b8662b5d159b3af6344c51a) )
22222180   ROM_LOAD( "2tgrfg2.bin",  0x4000, 0x2000, CRC(08e3e1a6) SHA1(c9c5ce072b235a299a3151f984d73bab97289e19) )
22232181   ROM_LOAD( "2tgrfg3.bin",  0x6000, 0x2000, CRC(9b22697b) SHA1(4c3fa30ce1b645ab18c0e53ce0f3754133a267ad) )
2224
2225   ROM_REGION( 0x0020, "proms", 0 )
2226   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
22272182ROM_END
22282183
22292184
r14976r14977
22542209   ROM_LOAD( "a4",           0xa000, 0x2000, CRC(765876a7) SHA1(9c477f5fae068f7e424939652e959711b3ad3a80) )
22552210   ROM_LOAD( "a1",           0xc000, 0x2000, CRC(4af986f8) SHA1(56af9525a404bcf6d76b19318efe541189844210) )
22562211   ROM_LOAD( "a2",           0xe000, 0x2000, CRC(b30cd2a7) SHA1(df1b36a3481fdec49f73d504f23951070c121291) )
2257
2258   ROM_REGION( 0x0020, "proms", 0 )
2259   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
22602212ROM_END
22612213
22622214
r14976r14977
22862238   ROM_LOAD( "tapfg4.bin",   0x14000, 0x4000, CRC(32674ee6) SHA1(402c166d50b4a693959b3f0706a7931a5daef6ce) )
22872239   ROM_LOAD( "tapfg7.bin",   0x18000, 0x4000, CRC(070b4c81) SHA1(95879a455ecfe2e3de7fe2a75078f9e6934960f5) )
22882240   ROM_LOAD( "tapfg6.bin",   0x1c000, 0x4000, CRC(a37aef36) SHA1(a24696f16d467d9eea4f25aef5f4c5ff55bf51ff) )
2289
2290   ROM_REGION( 0x0020, "proms", 0 )
2291   ROM_LOAD( "5784",         0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )
22922241ROM_END
22932242
22942243ROM_START( tappera )
r14976r14977
23172266   ROM_LOAD( "fg4_a4.128",   0x14000, 0x4000, CRC(082a4059) SHA1(52672b853d67432fd80e4612fa54208c225d2444) )
23182267   ROM_LOAD( "fg7_a1.128",   0x18000, 0x4000, CRC(3b476abe) SHA1(6fe170695386fc77310384a5590a7cc3671ae853) )
23192268   ROM_LOAD( "fg6_a2.128",   0x1c000, 0x4000, CRC(6717264c) SHA1(5a6d30974e73f952694b8c09fb3a5393a76db4f2) )
2320
2321   ROM_REGION( 0x0020, "proms", 0 )
2322   ROM_LOAD( "5784",         0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )
23232269ROM_END
23242270
23252271ROM_START( sutapper )
r14976r14977
23482294   ROM_LOAD( "5800",         0x14000, 0x4000, CRC(ebf1f948) SHA1(251cf018da8db11c3844123255082146b22507e5) )
23492295   ROM_LOAD( "5801",         0x18000, 0x4000, CRC(d70defa7) SHA1(e8ceabe94080eb28aa393b97ec54729cf8aba001) )
23502296   ROM_LOAD( "5802",         0x1c000, 0x4000, CRC(d4f114b9) SHA1(58ae647b4fd0f48af4158b85e29c813605d930d3) )
2351
2352   ROM_REGION( 0x0020, "proms", 0 )
2353   ROM_LOAD( "5784",         0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )
23542297ROM_END
23552298
23562299ROM_START( rbtapper )
r14976r14977
23792322   ROM_LOAD( "rbtfg4.bin",   0x14000, 0x4000, CRC(8c79e7d7) SHA1(e2a427324fc1d4422e50a1ab79822aff0290e109) )
23802323   ROM_LOAD( "rbtfg7.bin",   0x18000, 0x4000, CRC(8dbf0c36) SHA1(dab52db0bca13b9f3470060bc3babe4a6c2cdcc8) )
23812324   ROM_LOAD( "rbtfg6.bin",   0x1c000, 0x4000, CRC(441201a0) SHA1(400d390729601610b152e21da55399399830221f) )
2382
2383   ROM_REGION( 0x0020, "proms", 0 )
2384   ROM_LOAD( "5784",         0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )
23852325ROM_END
23862326
23872327
r14976r14977
24102350   ROM_LOAD( "timfg4.bin",   0x14000, 0x4000, CRC(b7105eb7) SHA1(913687f0e5dd105a3dfdc0afd1b5610b27124451) )
24112351   ROM_LOAD( "timfg7.bin",   0x18000, 0x4000, CRC(d9c27475) SHA1(24a7e6200e4f3514d4d3f25b2ffe3338c0c2a495) )
24122352   ROM_LOAD( "timfg6.bin",   0x1c000, 0x4000, CRC(244778e8) SHA1(494bc1e627997cd4f1d5267c5fafd0779ccf9255) )
2413
2414   ROM_REGION( 0x0020, "proms", 0 )
2415   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
24162353ROM_END
24172354
24182355
r14976r14977
24422379   ROM_LOAD( "loc-d.cp7",    0x0a000, 0x2000, CRC(5e8a3ef3) SHA1(74983c922eae1326ecd0ff14000851e0b424cc61) )
24432380   ROM_LOAD( "loc-a.cp0",    0x0c000, 0x2000, CRC(b35f5374) SHA1(3f330ffde52ac57c02dfdf8e105aefcc10f87a0b) )
24442381   ROM_LOAD( "loc-b.cp9",    0x0e000, 0x2000, CRC(565a5c48) SHA1(9dfafd58bd552bfda4e1799a175735ecc1369ba3) )
2445
2446   ROM_REGION( 0x0020, "proms", 0 )
2447   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
24482382ROM_END
24492383
24502384ROM_START( dotrona )
r14976r14977
24732407   ROM_LOAD( "loc-d.cp7",    0x0a000, 0x2000, CRC(5e8a3ef3) SHA1(74983c922eae1326ecd0ff14000851e0b424cc61) )
24742408   ROM_LOAD( "loc-a.cp0",    0x0c000, 0x2000, CRC(b35f5374) SHA1(3f330ffde52ac57c02dfdf8e105aefcc10f87a0b) )
24752409   ROM_LOAD( "loc-b.cp9",    0x0e000, 0x2000, CRC(565a5c48) SHA1(9dfafd58bd552bfda4e1799a175735ecc1369ba3) )
2476
2477   ROM_REGION( 0x0020, "proms", 0 )
2478   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
24792410ROM_END
24802411
24812412ROM_START( dotrone )
r14976r14977
25112442   ROM_LOAD( "loc-b.cp9",    0x0e000, 0x2000, CRC(565a5c48) SHA1(9dfafd58bd552bfda4e1799a175735ecc1369ba3) )
25122443
25132444   ROM_REGION( 0x0040, "proms", 0 )
2514   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
25152445   ROM_LOAD( "edotlamp.u2",  0x0020, 0x0020, CRC(fb58b867) SHA1(45beb55f2c2e9197f091fc06e9a2f595e57e5c93) )   /* lamp sequencer PROM */
25162446ROM_END
25172447
r14976r14977
25502480   ROM_LOAD( "nflvidfg.cp7", 0x0a000, 0x2000, CRC(73f62392) SHA1(18f28be7264f8edff38f8a6aa067eeb1970f544c) )
25512481   ROM_LOAD( "nflvidfg.c10", 0x0c000, 0x2000, CRC(1766dcc7) SHA1(df499e3c66ae702d2d56e6cd095a754665569fcd) )
25522482   ROM_LOAD( "nflvidfg.cp9", 0x0e000, 0x2000, CRC(46558146) SHA1(4bedfae8cf0fcb9d837706ee13fbe3944ab47216) )
2553
2554   ROM_REGION( 0x0020, "proms", 0 )
2555   ROM_LOAD( "5784",         0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )
25562483ROM_END
25572484
25582485
r14976r14977
25812508   ROM_LOAD( "dd_fg-6.a7",   0x14000, 0x4000, CRC(abfb9a8b) SHA1(14ab416bc76db25ad97353c9072048c64ec95344) )
25822509   ROM_LOAD( "dd_fg-3.a10",  0x18000, 0x4000, CRC(801d9b86) SHA1(5a8c72d1060eea1a3ad67b98aa6eff13f6837af6) )
25832510   ROM_LOAD( "dd_fg-7.a9",   0x1c000, 0x4000, CRC(0ec3f60a) SHA1(4176b246b0ea7bce9498c20e12678f16f7173529) )
2584
2585   ROM_REGION( 0x0020, "proms", 0 )
2586   ROM_LOAD( "82s123.12d",   0x0000, 0x0020, CRC(e1281ee9) SHA1(9ac9b01d24affc0ee9227a4364c4fd8f8290343a) )   /* from shollow, assuming it's the same */
25872511ROM_END
25882512
25892513
src/mame/drivers/mpu4vid.c
r14976r14977
21122112
21132113static PALETTE_INIT( dealem )
21142114{
2115   const UINT8 *color_prom = machine.region("proms")->base();
2115   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
21162116   int i, len;
21172117   static const int resistances_rg[3] = { 1000, 470, 220 };
21182118   static const int resistances_b [2] = { 470, 220 };
r14976r14977
21232123         3,   resistances_rg,   weights_g,   1000,   0,
21242124         2,   resistances_b,   weights_b,   1000,   0);
21252125
2126   len = machine.region("proms")->bytes();
2126   len = machine.root_device().memregion("proms")->bytes();
21272127   for (i = 0; i < len; i++)
21282128   {
21292129      int bit0,bit1,bit2,r,g,b;
r14976r14977
28832883void mpu4vid_char_cheat(running_machine& machine, int address)
28842884{
28852885   mpu4_state *state = machine.driver_data<mpu4_state>();
2886   UINT8* cheattable = machine.region( "video" )->base()+address;
2886   UINT8* cheattable = state->memregion( "video" )->base()+address;
28872887   state->m_current_chr_table = blank_data;
28882888   for (int i=0;i<72;i++)
28892889   {
src/mame/drivers/clshroad.c
r14976r14977
472472die once, it would be nice to avoid the hack however
473473
474474*/
475   UINT8 *ROM = machine.region("maincpu")->base();
475   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
476476
477477   ROM[0x05C6] = 0xc3;
478478   ROM[0x05C7] = 0x8d;
src/mame/drivers/chqflag.c
r14976r14977
4040WRITE8_MEMBER(chqflag_state::chqflag_bankswitch_w)
4141{
4242   int bankaddress;
43   UINT8 *RAM = machine().region("maincpu")->base();
43   UINT8 *RAM = memregion("maincpu")->base();
4444
4545   /* bits 0-4 = ROM bank # (0x00-0x11) */
4646   bankaddress = 0x10000 + (data & 0x1f) * 0x4000;
47   memory_set_bankptr(machine(), "bank4", &RAM[bankaddress]);
47   membank("bank4")->set_base(&RAM[bankaddress]);
4848
4949   /* bit 5 = memory bank select */
5050   if (data & 0x20)
5151   {
5252      space.install_read_bank(0x1800, 0x1fff, "bank5");
5353      space.install_write_handler(0x1800, 0x1fff, write8_delegate(FUNC(driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_be_w),this));
54      memory_set_bankptr(machine(), "bank5", m_generic_paletteram_8);
54      membank("bank5")->set_base(m_generic_paletteram_8);
5555
5656      if (m_k051316_readroms)
5757         space.install_legacy_readwrite_handler(*m_k051316_1, 0x1000, 0x17ff, FUNC(k051316_rom_r), FUNC(k051316_w));   /* 051316 #1 (ROM test) */
r14976r14977
322322static MACHINE_START( chqflag )
323323{
324324   chqflag_state *state = machine.driver_data<chqflag_state>();
325   UINT8 *ROM = machine.region("maincpu")->base();
325   UINT8 *ROM = state->memregion("maincpu")->base();
326326
327   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x2000);
327   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000);
328328
329329   state->m_maincpu = machine.device("maincpu");
330330   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/lsasquad.c
r14976r14977
155155WRITE8_MEMBER(lsasquad_state::lsasquad_bankswitch_w)
156156{
157157   /* bits 0-2 select ROM bank */
158   memory_set_bank(machine(), "bank1", data & 0x07);
158   membank("bank1")->set_entry(data & 0x07);
159159
160160   /* bit 3 is zeroed on startup, maybe reset sound CPU */
161161
r14976r14977
567567static MACHINE_START( lsasquad )
568568{
569569   lsasquad_state *state = machine.driver_data<lsasquad_state>();
570   UINT8 *ROM = machine.region("maincpu")->base();
570   UINT8 *ROM = state->memregion("maincpu")->base();
571571
572   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x2000);
572   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x2000);
573573
574574   state->m_maincpu = machine.device("maincpu");
575575   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/dooyong.c
r14976r14977
8686
8787WRITE8_MEMBER(dooyong_state::lastday_bankswitch_w)
8888{
89   memory_set_bank(machine(), "bank1", data & 0x07);
89   membank("bank1")->set_entry(data & 0x07);
9090
9191   if (data & 0xf8) popmessage("bankswitch %02x",data);
9292}
9393
9494static MACHINE_START( lastday )
9595{
96   memory_configure_bank(machine, "bank1", 0, 8, machine.region("maincpu")->base() + 0x10000, 0x4000);
96   machine.root_device().membank("bank1")->configure_entries(0, 8, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
9797}
9898
9999WRITE8_MEMBER(dooyong_state::flip_screen_w)
src/mame/drivers/cham24.c
r14976r14977
191191   UINT32 prg_bank_page_size = (offset >> 12) & 0x01;
192192   UINT32 gfx_mirroring = (offset >> 13) & 0x01;
193193
194   UINT8* dst = machine().region("maincpu")->base();
195   UINT8* src = machine().region("user1")->base();
194   UINT8* dst = memregion("maincpu")->base();
195   UINT8* src = memregion("user1")->base();
196196
197197   // switch PPU VROM bank
198   memory_set_bankptr(machine(), "bank1", machine().region("gfx1")->base() + (0x2000 * gfx_bank));
198   membank("bank1")->set_base(machine().root_device().memregion("gfx1")->base() + (0x2000 * gfx_bank));
199199
200200   // set gfx mirroring
201201   cham24_set_mirroring(machine(), gfx_mirroring != 0 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
r14976r14977
304304{
305305   cham24_state *state = machine.driver_data<cham24_state>();
306306   /* switch PRG rom */
307   UINT8* dst = machine.region("maincpu")->base();
308   UINT8* src = machine.region("user1")->base();
307   UINT8* dst = machine.root_device().memregion("maincpu")->base();
308   UINT8* src = machine.root_device().memregion("user1")->base();
309309
310310   memcpy(&dst[0x8000], &src[0x0f8000], 0x4000);
311311   memcpy(&dst[0xc000], &src[0x0f8000], 0x4000);
312312
313313   /* uses 8K swapping, all ROM!*/
314314   machine.device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1");
315   memory_set_bankptr(machine, "bank1", machine.region("gfx1")->base());
315   state->membank("bank1")->set_base(state->memregion("gfx1")->base());
316316
317317   /* need nametable ram, though. I doubt this uses more than 2k, but it starts up configured for 4 */
318318   state->m_nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
src/mame/drivers/silvmil.c
r14976r14977
409409
410410static void tumblepb_gfx1_rearrange(running_machine &machine)
411411{
412   UINT8 *rom = machine.region("gfx1")->base();
413   int len = machine.region("gfx1")->bytes();
412   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
413   int len = machine.root_device().memregion("gfx1")->bytes();
414414   int i;
415415
416416   /* gfx data is in the wrong order */
src/mame/drivers/brkthru.c
r14976r14977
660660
661661static DRIVER_INIT( brkthru )
662662{
663   UINT8 *ROM = machine.region("maincpu")->base();
664   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x2000);
663   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
664   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x2000);
665665}
666666
667667/*************************************
src/mame/drivers/thepit.c
r14976r14977
10801080   // Read the actual byte from question roms
10811081   else if((offset & 0xc00) == 0xc00)
10821082   {
1083      UINT8 *ROM = machine().region("user1")->base();
1083      UINT8 *ROM = memregion("user1")->base();
10841084      int real_address;
10851085
10861086      real_address = (0x8000 * m_question_rom) | m_question_address | (offset & 0x3f0) | m_remap_address[offset & 0x0f];
src/mame/drivers/trvmadns.c
r14976r14977
9898   }
9999   else if((data & 0xf0) == 0x80 || (data & 0xf0) == 0x90)
100100   {
101      rom = machine().region("user2")->base();
101      rom = memregion("user2")->base();
102102
103103      switch(data & 0xf)
104104      {
r14976r14977
114114
115115      address |= (data & 0x10) ? 0x10000 : 0;
116116
117      memory_set_bankptr(machine(), "bank1", &rom[address]);
118      memory_set_bankptr(machine(), "bank2", &rom[address + 0x1000]);
117      membank("bank1")->set_base(&rom[address]);
118      membank("bank2")->set_base(&rom[address + 0x1000]);
119119   }
120120   else
121121   {
r14976r14977
126126            //logerror("port80 = %02X\n",data);
127127         }
128128
129      rom = machine().region("user1")->base();
129      rom = memregion("user1")->base();
130130
131131      /*
132132        7
r14976r14977
154154
155155//      logerror("add = %X\n",address);
156156
157      memory_set_bankptr(machine(), "bank1", &rom[address]);
157      membank("bank1")->set_base(&rom[address]);
158158   }
159159}
160160
src/mame/drivers/cloud9.c
r14976r14977
160160   rectangle visarea;
161161
162162   /* initialize globals */
163   state->m_syncprom = machine.region("proms")->base() + 0x000;
163   state->m_syncprom = state->memregion("proms")->base() + 0x000;
164164
165165   /* find the start of VBLANK in the SYNC PROM */
166166   for (state->m_vblank_start = 0; state->m_vblank_start < 256; state->m_vblank_start++)
src/mame/drivers/rpunch.c
r14976r14977
132132
133133static MACHINE_RESET( rpunch )
134134{
135   UINT8 *snd = machine.region("upd")->base();
135   UINT8 *snd = machine.root_device().memregion("upd")->base();
136136   memcpy(snd, snd + 0x20000, 0x20000);
137137}
138138
r14976r14977
198198   rpunch_state *state = device->machine().driver_data<rpunch_state>();
199199   if ((data & 1) != state->m_upd_rom_bank)
200200   {
201      UINT8 *snd = device->machine().region("upd")->base();
201      UINT8 *snd = state->memregion("upd")->base();
202202      state->m_upd_rom_bank = data & 1;
203203      memcpy(snd, snd + 0x20000 * (state->m_upd_rom_bank + 1), 0x20000);
204204   }
src/mame/drivers/albazg.c
r14976r14977
178178   if( state->m_bank != new_bank)
179179   {
180180      state->m_bank = new_bank;
181      memory_set_bank(device->machine(), "bank1", state->m_bank);
181      state->membank("bank1")->set_entry(state->m_bank);
182182   }
183183
184184   state->m_mux_data = data & ~0xc0;
r14976r14977
357357static MACHINE_START( yumefuda )
358358{
359359   albazg_state *state = machine.driver_data<albazg_state>();
360   UINT8 *ROM = machine.region("maincpu")->base();
360   UINT8 *ROM = state->memregion("maincpu")->base();
361361
362   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x2000);
362   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000);
363363
364364   state->save_item(NAME(state->m_mux_data));
365365   state->save_item(NAME(state->m_bank));
src/mame/drivers/bingoc.c
r14976r14977
100100    ---- --x- sound rom banking
101101    ---- ---x start-stop sample
102102    */
103   UINT8 *upd = device->machine().region("upd")->base();
103   UINT8 *upd = device->machine().root_device().memregion("upd")->base();
104104   memcpy(&upd[0x00000], &upd[0x20000 + (((data & 2)>>1) * 0x20000)], 0x20000);
105105   upd7759_start_w(device, data & 1);
106106//  printf("%02x\n",data);
src/mame/drivers/sstrangr.c
r14976r14977
9292
9393   get_pens(pens);
9494
95   color_map_base = &screen.machine().region("proms")->base()[state->m_flip_screen ? 0x0000 : 0x0200];
95   color_map_base = &state->memregion("proms")->base()[state->m_flip_screen ? 0x0000 : 0x0200];
9696
9797   for (offs = 0; offs < 0x2000; offs++)
9898   {
src/mame/drivers/backfire.c
r14976r14977
667667
668668static void descramble_sound( running_machine &machine )
669669{
670   UINT8 *rom = machine.region("ymz")->base();
670   UINT8 *rom = machine.root_device().memregion("ymz")->base();
671671   int length = 0x200000; // only the first rom is swapped on backfire!
672672   UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
673673   UINT32 x;
src/mame/drivers/starwars.c
r14976r14977
502502   starwars_mproc_init(machine);
503503
504504   /* initialize banking */
505   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x6000, 0x10000 - 0x6000);
506   memory_set_bank(machine, "bank1", 0);
505   state->membank("bank1")->configure_entries(0, 2, state->memregion("maincpu")->base() + 0x6000, 0x10000 - 0x6000);
506   state->membank("bank1")->set_entry(0);
507507}
508508
509509
510510static DRIVER_INIT( esb )
511511{
512512   starwars_state *state = machine.driver_data<starwars_state>();
513   UINT8 *rom = machine.region("maincpu")->base();
513   UINT8 *rom = state->memregion("maincpu")->base();
514514
515515   /* init the slapstic */
516516   slapstic_init(machine, 101);
r14976r14977
532532   starwars_mproc_init(machine);
533533
534534   /* initialize banking */
535   memory_configure_bank(machine, "bank1", 0, 2, rom + 0x6000, 0x10000 - 0x6000);
536   memory_set_bank(machine, "bank1", 0);
537   memory_configure_bank(machine, "bank2", 0, 2, rom + 0xa000, 0x1c000 - 0xa000);
538   memory_set_bank(machine, "bank2", 0);
535   state->membank("bank1")->configure_entries(0, 2, rom + 0x6000, 0x10000 - 0x6000);
536   state->membank("bank1")->set_entry(0);
537   state->membank("bank2")->configure_entries(0, 2, rom + 0xa000, 0x1c000 - 0xa000);
538   state->membank("bank2")->set_entry(0);
539539
540540   /* additional globals for state saving */
541541   state->save_item(NAME(state->m_slapstic_current_bank));
src/mame/drivers/exerion.c
r14976r14977
165165{
166166   exerion_state *state = device->machine().driver_data<exerion_state>();
167167   /* pull the expected value from the ROM */
168   state->m_porta = device->machine().region("maincpu")->base()[0x5f76];
168   state->m_porta = state->memregion("maincpu")->base()[0x5f76];
169169   state->m_portb = data;
170170
171171   logerror("Port B = %02X\n", data);
r14976r14977
175175READ8_MEMBER(exerion_state::exerion_protection_r)
176176{
177177   if (cpu_get_pc(&space.device()) == 0x4143)
178      return machine().region("maincpu")->base()[0x33c0 + (m_main_ram[0xd] << 2) + offset];
178      return memregion("maincpu")->base()[0x33c0 + (m_main_ram[0xd] << 2) + offset];
179179   else
180180      return m_main_ram[0x8 + offset];
181181}
r14976r14977
558558
559559   /* make a temporary copy of the character data */
560560   src = temp;
561   dst = machine.region("gfx1")->base();
562   length = machine.region("gfx1")->bytes();
561   dst = machine.root_device().memregion("gfx1")->base();
562   length = machine.root_device().memregion("gfx1")->bytes();
563563   memcpy(src, dst, length);
564564
565565   /* decode the characters */
r14976r14977
576576
577577   /* make a temporary copy of the sprite data */
578578   src = temp;
579   dst = machine.region("gfx2")->base();
580   length = machine.region("gfx2")->bytes();
579   dst = machine.root_device().memregion("gfx2")->base();
580   length = machine.root_device().memregion("gfx2")->bytes();
581581   memcpy(src, dst, length);
582582
583583   /* decode the sprites */
r14976r14977
599599
600600static DRIVER_INIT( exerionb )
601601{
602   UINT8 *ram = machine.region("maincpu")->base();
602   UINT8 *ram = machine.root_device().memregion("maincpu")->base();
603603   int addr;
604604
605605   /* the program ROMs have data lines D1 and D2 swapped. Decode them. */
src/mame/drivers/savquest.c
r14976r14977
106106      {
107107         if (data & 0x10)      // enable RAM access to region 0xf0000 - 0xfffff
108108         {
109            memory_set_bankptr(busdevice->machine(), "bank1", state->m_bios_ram);
109            state->membank("bank1")->set_base(state->m_bios_ram);
110110         }
111111         else               // disable RAM access (reads go to BIOS ROM)
112112         {
113            memory_set_bankptr(busdevice->machine(), "bank1", busdevice->machine().region("bios")->base() + 0x20000);
113            state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x20000);
114114         }
115115         break;
116116      }
r14976r14977
531531
532532static MACHINE_RESET( savquest )
533533{
534   memory_set_bankptr(machine, "bank1", machine.region("bios")->base() + 0x20000);
534   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("bios")->base() + 0x20000);
535535}
536536
537537
src/mame/drivers/segas18.c
r14976r14977
429429   /* sprite banking */
430430   else
431431   {
432      int maxbanks = space->machine().region("gfx2")->bytes() / 0x40000;
432      int maxbanks = space->machine().root_device().memregion("gfx2")->bytes() / 0x40000;
433433      if (data >= maxbanks)
434434         data = 255;
435435      segaic16_sprites_set_bank(space->machine(), 0, (offset - 8) * 2 + 0, data * 2 + 0);
r14976r14977
587587
588588static WRITE8_HANDLER( soundbank_w )
589589{
590   memory_set_bankptr(space->machine(), "bank1", space->machine().region("soundcpu")->base() + 0x10000 + 0x2000 * data);
590   space->machine().root_device().membank("bank1")->set_base(space->machine().root_device().memregion("soundcpu")->base() + 0x10000 + 0x2000 * data);
591591}
592592
593593
src/mame/drivers/astrocorp.c
r14976r14977
10081008static DRIVER_INIT( showhand )
10091009{
10101010#if 0
1011   UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
1011   UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
10121012
10131013   rom[0x0a1a/2] = 0x6000;   // hopper jam
10141014
r14976r14977
10241024static DRIVER_INIT( showhanc )
10251025{
10261026#if 0
1027   UINT16 *rom = (UINT16*)machine.region("maincpu")->base();
1027   UINT16 *rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
10281028
10291029   rom[0x14d4/2] = 0x4e71;   // enable full test mode
10301030   rom[0x14d6/2] = 0x4e71;   // ""
src/mame/drivers/ltcasino.c
r14976r14977
712712static DRIVER_INIT(mv4in1)
713713{
714714   int i;
715   UINT8 *rom = machine.region("maincpu")->base();
715   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
716716   for(i=0;i<0x10000;i++)
717717      rom[i]=BITSWAP8(rom[i],7,6,5,4,3,1,2,0);
718718}
src/mame/drivers/meijinsn.c
r14976r14977
248248
249249static PALETTE_INIT( meijinsn )
250250{
251   const UINT8 *color_prom = machine.region("proms")->base();
251   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
252252   int i;
253253   static const int resistances_b[2]  = { 470, 220 };
254254   static const int resistances_rg[3] = { 1000, 470, 220 };
src/mame/drivers/coolridr.c
r14976r14977
683683   COMBINE_DATA(&m_h1_charram[offset]);
684684
685685   {
686      UINT8 *gfx = machine().region("ram_gfx")->base();
686      UINT8 *gfx = memregion("ram_gfx")->base();
687687
688688      gfx[offset*4+0] = (m_h1_charram[offset] & 0xff000000) >> 24;
689689      gfx[offset*4+1] = (m_h1_charram[offset] & 0x00ff0000) >> 16;
src/mame/drivers/blitz.c
r14976r14977
364364
365365static PALETTE_INIT( megadpkr )
366366{
367   const UINT8 *color_prom = machine.region("proms")->base();
367   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
368368/*
369369    This hardware has a feature called BLUE KILLER.
370370    Using the original intensity line, the PCB has a bridge
src/mame/drivers/cobra.c
r14976r14977
20722072   {
20732073      int i;
20742074      UINT32 sum = 0;
2075      UINT32 *rom = (UINT32*)machine.region("user1")->base();
2075      UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
20762076
20772077      //rom[(0x02218^4) / 4] = 0x60000000;        // skip connect_grphcpu()...
20782078
r14976r14977
20952095
20962096   // rom hacks for sub board...
20972097   {
2098      UINT32 *rom = (UINT32*)machine.region("user2")->base();
2098      UINT32 *rom = (UINT32*)machine.root_device().memregion("user2")->base();
20992099
21002100      rom[0x62094 / 4] = 0x60000000;         // skip hardcheck()...
21012101   }
r14976r14977
21062106      int i;
21072107      UINT32 sum = 0;
21082108
2109      UINT32 *rom = (UINT32*)machine.region("user3")->base();
2109      UINT32 *rom = (UINT32*)machine.root_device().memregion("user3")->base();
21102110
21112111      rom[(0x022d4^4) / 4] = 0x60000000;      // skip init_raster() for now ...
21122112
src/mame/drivers/tutankhm.c
r14976r14977
8989
9090WRITE8_MEMBER(tutankhm_state::tutankhm_bankselect_w)
9191{
92   memory_set_bank(machine(), "bank1", data & 0x0f);
92   membank("bank1")->set_entry(data & 0x0f);
9393}
9494
9595
r14976r14977
198198{
199199   tutankhm_state *state = machine.driver_data<tutankhm_state>();
200200
201   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x1000);
201   state->membank("bank1")->configure_entries(0, 16, state->memregion("maincpu")->base() + 0x10000, 0x1000);
202202
203203   state->m_maincpu = machine.device<cpu_device>("maincpu");
204204
src/mame/drivers/targeth.c
r14976r14977
5151
5252WRITE16_MEMBER(targeth_state::OKIM6295_bankswitch_w)
5353{
54   UINT8 *RAM = machine().region("oki")->base();
54   UINT8 *RAM = memregion("oki")->base();
5555
5656   if (ACCESSING_BITS_0_7){
5757      memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000);
src/mame/drivers/intrscti.c
r14976r14977
131131
132132static DRIVER_INIT( intrscti )
133133{
134   UINT8 *cpu = machine.region( "maincpu" )->base();
134   UINT8 *cpu = machine.root_device().memregion( "maincpu" )->base();
135135   int i;
136136   for (i=0x8000;i<0x8fff;i++)
137137   {
src/mame/drivers/rainbow.c
r14976r14977
397397
398398static WRITE8_DEVICE_HANDLER( bankswitch_w )
399399{
400   memory_set_bank(device->machine(), "bank1", data & 3);
400   device->machine().root_device().membank("bank1")->set_entry(data & 3);
401401}
402402
403403READ8_MEMBER(rbisland_state::jumping_latch_r)
r14976r14977
875875
876876static DRIVER_INIT( rbisland )
877877{
878   UINT8 *ROM = machine.region("audiocpu")->base();
878   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
879879
880   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0xc000], 0x4000);
880   machine.root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
881881
882882   rbisland_cchip_init(machine, 0);
883883}
884884
885885static DRIVER_INIT( rbislande )
886886{
887   UINT8 *ROM = machine.region("audiocpu")->base();
887   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
888888
889   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0xc000], 0x4000);
889   machine.root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
890890
891891   rbisland_cchip_init(machine, 1);
892892}
src/mame/drivers/tryout.c
r14976r14977
4545
4646WRITE8_MEMBER(tryout_state::tryout_bankswitch_w)
4747{
48   UINT8 *RAM = machine().region("maincpu")->base();
48   UINT8 *RAM = memregion("maincpu")->base();
4949   int bankaddress;
5050
5151   bankaddress = 0x10000 + (data & 0x01) * 0x2000;
52   memory_set_bankptr(machine(), "bank1", &RAM[bankaddress]);
52   membank("bank1")->set_base(&RAM[bankaddress]);
5353}
5454
5555static ADDRESS_MAP_START( main_cpu, AS_PROGRAM, 8, tryout_state )
src/mame/drivers/rungun.c
r14976r14977
220220
221221   m_z80_control = data;
222222
223   memory_set_bank(machine(), "bank2", data & 0x07);
223   membank("bank2")->set_entry(data & 0x07);
224224
225225   if (data & 0x10)
226226      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
r14976r14977
366366static MACHINE_START( rng )
367367{
368368   rungun_state *state = machine.driver_data<rungun_state>();
369   UINT8 *ROM = machine.region("soundcpu")->base();
369   UINT8 *ROM = state->memregion("soundcpu")->base();
370370
371   memory_configure_bank(machine, "bank2", 0, 8, &ROM[0x10000], 0x4000);
371   state->membank("bank2")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
372372
373373   state->m_maincpu = machine.device("maincpu");
374374   state->m_audiocpu = machine.device("soundcpu");
src/mame/drivers/sfbonus.c
r14976r14977
10801080
10811081WRITE8_MEMBER(sfbonus_state::sfbonus_bank_w)
10821082{
1083   UINT8 *ROM = machine().region("maincpu")->base();
1083   UINT8 *ROM = memregion("maincpu")->base();
10841084   UINT8 bank;
10851085
10861086   bank = data & 7;
10871087
1088   memory_set_bankptr(machine(), "bank1", &ROM[bank * 0x10000]);
1088   membank("bank1")->set_base(&ROM[bank * 0x10000]);
10891089}
10901090
10911091
r14976r14977
12141214
12151215static MACHINE_RESET( sfbonus )
12161216{
1217   UINT8 *ROM = machine.region("maincpu")->base();
1217   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
12181218
1219   memory_set_bankptr(machine, "bank1", &ROM[0]);
1219   machine.root_device().membank("bank1")->set_base(&ROM[0]);
12201220}
12211221
12221222static NVRAM_HANDLER( sfbonus )
r14976r14977
12331233      }
12341234      else
12351235      {
1236         UINT8* defaultram = machine.region("defaults")->base();
1236         UINT8* defaultram = machine.root_device().memregion("defaults")->base();
12371237         memset(state->m_nvram,0x00,state->m_nvram.bytes());
12381238
12391239         if (defaultram)
12401240            if ((defaultram[0x02]==0x00) && (defaultram[0x03]==0x00)) // hack! rom region optional regions get cleared with garbage if no rom is present, this is not good!
1241               memcpy(state->m_nvram, machine.region("defaults")->base(), machine.region("defaults")->bytes());
1241               memcpy(state->m_nvram, machine.root_device().memregion("defaults")->base(), machine.root_device().memregion("defaults")->bytes());
12421242      }
12431243   }
12441244}
r14976r14977
57335733
57345734   // dummy.rom helper
57355735   {
5736      UINT8 *ROM = machine.region("maincpu")->base();
5737      int length = machine.region("maincpu")->bytes();
5738      UINT8* ROM2 = machine.region("user1")->base();
5736      UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
5737      int length = machine.root_device().memregion("maincpu")->bytes();
5738      UINT8* ROM2 = state->memregion("user1")->base();
57395739
57405740      if (ROM2)
57415741      {
r14976r14977
57855785{
57865786
57875787   int i;
5788   UINT8 *ROM = machine.region("maincpu")->base();
5788   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
57895789
5790   for(i = 0; i < machine.region("maincpu")->bytes(); i++)
5790   for(i = 0; i < machine.root_device().memregion("maincpu")->bytes(); i++)
57915791   {
57925792      UINT8 x = ROM[i];
57935793
src/mame/drivers/crystal.c
r14976r14977
286286
287287   m_Bank = (data >> 1) & 7;
288288   if (m_Bank <= 2)
289      memory_set_bankptr(machine(), "bank1", machine().region("user1")->base() + m_Bank * 0x1000000);
289      membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + m_Bank * 0x1000000);
290290   else
291      memory_set_bankptr(machine(), "bank1", machine().region("user2")->base());
291      membank("bank1")->set_base(machine().root_device().memregion("user2")->base());
292292}
293293
294294static TIMER_CALLBACK( Timercb )
r14976r14977
368368   {
369369      if (m_Bank <= 2)
370370      {
371         UINT32 *ptr = (UINT32*)(machine().region("user1")->base() + m_Bank * 0x1000000);
371         UINT32 *ptr = (UINT32*)(machine().root_device().memregion("user1")->base() + m_Bank * 0x1000000);
372372         return ptr[0];
373373      }
374374      else
r14976r14977
567567   crystal_state *state = machine.driver_data<crystal_state>();
568568
569569   if (state->m_Bank <= 2)
570      memory_set_bankptr(machine, "bank1", machine.region("user1")->base() + state->m_Bank * 0x1000000);
570      state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base() + state->m_Bank * 0x1000000);
571571   else
572      memory_set_bankptr(machine, "bank1", machine.region("user2")->base());
572      state->membank("bank1")->set_base(state->memregion("user2")->base());
573573}
574574
575575static MACHINE_START( crystal )
r14976r14977
613613   state->m_IntHigh = 0;
614614   device_set_irq_callback(machine.device("maincpu"), icallback);
615615   state->m_Bank = 0;
616   memory_set_bankptr(machine, "bank1", machine.region("user1")->base() + 0);
616   state->membank("bank1")->set_base(state->memregion("user1")->base() + 0);
617617   state->m_FlashCmd = 0xff;
618618   state->m_OldPort4 = 0;
619619
r14976r14977
960960
961961static DRIVER_INIT(crysking)
962962{
963   UINT16 *Rom = (UINT16*) machine.region("user1")->base();
963   UINT16 *Rom = (UINT16*) machine.root_device().memregion("user1")->base();
964964
965965   //patch the data feed by the protection
966966
r14976r14977
979979
980980static DRIVER_INIT(evosocc)
981981{
982   UINT16 *Rom = (UINT16*) machine.region("user1")->base();
982   UINT16 *Rom = (UINT16*) machine.root_device().memregion("user1")->base();
983983   Rom += 0x1000000 * 2 / 2;
984984
985985   Rom[WORD_XOR_LE(0x97388E/2)] = 0x90FC;   //PUSH R2..R7
r14976r14977
997997
998998static DRIVER_INIT(topbladv)
999999{
1000   UINT16 *Rom = (UINT16*) machine.region("user1")->base();
1000   UINT16 *Rom = (UINT16*) machine.root_device().memregion("user1")->base();
10011001
10021002   Rom[WORD_XOR_LE(0x12d7a/2)] = 0x90FC;   //PUSH R7-R6-R5-R4-R3-R2
10031003   Rom[WORD_XOR_LE(0x12d7c/2)] = 0x9001;   //PUSH R0
r14976r14977
10151015
10161016static DRIVER_INIT(officeye)
10171017{
1018   UINT16 *Rom = (UINT16*) machine.region("user1")->base();
1018   UINT16 *Rom = (UINT16*) machine.root_device().memregion("user1")->base();
10191019
10201020   Rom[WORD_XOR_LE(0x9c9e/2)] = 0x901C;   //PUSH R4-R3-R2
10211021   Rom[WORD_XOR_LE(0x9ca0/2)] = 0x9001;   //PUSH R0
src/mame/drivers/madmotor.c
r14976r14977
351351
352352static DRIVER_INIT( madmotor )
353353{
354   UINT8 *rom = machine.region("maincpu")->base();
354   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
355355   int i;
356356
357357   for (i = 0x00000;i < 0x80000;i++)
src/mame/drivers/chinsan.c
r14976r14977
7878
7979static PALETTE_INIT( chinsan )
8080{
81   UINT8 *src = machine.region( "color_proms" )->base();
81   UINT8 *src = machine.root_device().memregion( "color_proms" )->base();
8282   int i;
8383
8484   for (i = 0; i < 0x100; i++)
r14976r14977
119119
120120WRITE8_MEMBER(chinsan_state::ctrl_w)
121121{
122   memory_set_bank(machine(), "bank1", data >> 6);
122   membank("bank1")->set_entry(data >> 6);
123123}
124124
125125static WRITE8_DEVICE_HANDLER( ym_port_w1 )
r14976r14977
541541   }
542542   else
543543   {
544      UINT8 *ROM = device->machine().region("adpcm")->base();
544      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base();
545545
546546      state->m_adpcm_data = ((state->m_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0) >> 4));
547547      msm5205_data_w(device, state->m_adpcm_data & 0xf);
r14976r14977
571571{
572572   chinsan_state *state = machine.driver_data<chinsan_state>();
573573
574   memory_configure_bank(machine, "bank1", 0, 4, machine.region("maincpu")->base() + 0x10000, 0x4000);
574   state->membank("bank1")->configure_entries(0, 4, state->memregion("maincpu")->base() + 0x10000, 0x4000);
575575
576576   state->save_item(NAME(state->m_adpcm_idle));
577577   state->save_item(NAME(state->m_port_select));
src/mame/drivers/famibox.c
r14976r14977
257257      if ( bank == famicombox_banks[i].bank ||
258258          famicombox_banks[i].bank == 0 )
259259      {
260         memory_set_bankptr(machine, "cpubank1", machine.region(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset);
261         memory_set_bankptr(machine, "cpubank2", machine.region(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset);
262         memory_set_bankptr(machine, "ppubank1", machine.region(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset);
260         machine.root_device().membank("cpubank1")->set_base(machine.root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset);
261         machine.root_device().membank("cpubank2")->set_base(machine.root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset);
262         machine.root_device().membank("ppubank1")->set_base(machine.root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset);
263263         break;
264264      }
265265   }
src/mame/drivers/cshooter.c
r14976r14977
239239
240240WRITE8_MEMBER(cshooter_state::bank_w)
241241{
242   memory_set_bankptr(machine(), "bank1",&machine().region("user1")->base()[0x4000*((data>>4)&3)]);
242   membank("bank1")->set_base(&machine().root_device().memregion("user1")->base()[0x4000*((data>>4)&3)]);
243243}
244244
245245
r14976r14977
665665static DRIVER_INIT( cshooter )
666666{
667667   /* temp so it boots */
668   UINT8 *rom = machine.region("maincpu")->base();
668   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
669669
670670   rom[0xa2] = 0x00;
671671   rom[0xa3] = 0x00;
672672   rom[0xa4] = 0x00;
673   memory_set_bankptr(machine, "bank1",&machine.region("user1")->base()[0]);
673   machine.root_device().membank("bank1")->set_base(&machine.root_device().memregion("user1")->base()[0]);
674674}
675675
676676static DRIVER_INIT( cshootere )
677677{
678678   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
679679   int A;
680   UINT8 *rom = machine.region("maincpu")->base();
680   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
681681   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
682682
683683   space->set_decrypted_region(0x0000, 0x7fff, decrypt);
r14976r14977
707707         rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0);
708708   }
709709
710   memory_set_bankptr(machine, "bank1",&machine.region("user1")->base()[0]);
710   machine.root_device().membank("bank1")->set_base(&machine.root_device().memregion("user1")->base()[0]);
711711   seibu_sound_decrypt(machine,"audiocpu",0x2000);
712712}
713713
src/mame/drivers/aerofgt.c
r14976r14977
107107
108108WRITE8_MEMBER(aerofgt_state::aerofgt_sh_bankswitch_w)
109109{
110   memory_set_bank(machine(), "bank1", data & 0x03);
110   membank("bank1")->set_entry(data & 0x03);
111111}
112112
113113
r14976r14977
129129
130130WRITE8_MEMBER(aerofgt_state::aerfboot_okim6295_banking_w)
131131{
132   UINT8 *oki = machine().region("oki")->base();
132   UINT8 *oki = memregion("oki")->base();
133133   /*bit 2 (0x4) setted too?*/
134134   if (data & 0x4)
135135      memcpy(&oki[0x20000], &oki[((data & 0x3) * 0x20000) + 0x40000], 0x20000);
r14976r14977
13021302
13031303static MACHINE_START( aerofgt )
13041304{
1305   UINT8 *rom = machine.region("audiocpu")->base();
1305   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
13061306
1307   memory_configure_bank(machine, "bank1", 0, 4, &rom[0x10000], 0x8000);
1307   machine.root_device().membank("bank1")->configure_entries(0, 4, &rom[0x10000], 0x8000);
13081308
13091309   MACHINE_START_CALL(common);
13101310}
r14976r14977
13191319{
13201320   MACHINE_RESET_CALL(common);
13211321
1322   memory_set_bank(machine, "bank1", 0);   /* needed by spinlbrk */
1322   machine.root_device().membank("bank1")->set_entry(0);   /* needed by spinlbrk */
13231323}
13241324
13251325static MACHINE_CONFIG_START( pspikes, aerofgt_state )
src/mame/drivers/rocnrope.c
r14976r14977
2525/* Roc'n'Rope has the IRQ vectors in RAM. The rom contains $FFFF at this address! */
2626WRITE8_MEMBER(rocnrope_state::rocnrope_interrupt_vector_w)
2727{
28   UINT8 *RAM = machine().region("maincpu")->base();
28   UINT8 *RAM = memregion("maincpu")->base();
2929
3030   RAM[0xfff2 + offset] = data;
3131}
src/mame/drivers/maygay1b.c
r14976r14977
44204420   //AM_RANGE(0x2420, 0x2421) AM_WRITE(latch_ch2_w ) // oki
44214421   // if there is no OKI region disable writes here, the rom might be missing, so alert user
44224422
4423   UINT8 *okirom = machine.region( "oki" )->base();
4423   UINT8 *okirom = machine.root_device().memregion( "oki" )->base();
44244424
44254425   if (!okirom) {
44264426      maygay1b_state *state = machine.driver_data<maygay1b_state>();
r14976r14977
44294429   // print out the rom id / header info to give us some hints
44304430   // note this isn't always correct, alley cat has 'Calpsyo' still in the ident string?
44314431   {
4432      UINT8 *cpu = machine.region( "maincpu" )->base();
4432      UINT8 *cpu = machine.root_device().memregion( "maincpu" )->base();
44334433      int base = 0xff20;
44344434      for (int i=0;i<14;i++)
44354435      {
src/mame/drivers/twinkle.c
r14976r14977
712712
713713READ16_MEMBER(twinkle_state::twinkle_waveram_r)
714714{
715   UINT16 *waveram = (UINT16 *)machine().region("rfsnd")->base();
715   UINT16 *waveram = (UINT16 *)machine().root_device().memregion("rfsnd")->base();
716716
717717   return waveram[offset];
718718}
719719
720720WRITE16_MEMBER(twinkle_state::twinkle_waveram_w)
721721{
722   UINT16 *waveram = (UINT16 *)machine().region("rfsnd")->base();
722   UINT16 *waveram = (UINT16 *)machine().root_device().memregion("rfsnd")->base();
723723
724724   COMBINE_DATA(&waveram[offset]);
725725}
src/mame/drivers/spool99.c
r14976r14977
159159
160160READ8_MEMBER(spool99_state::spool99_io_r)
161161{
162   UINT8 *ROM = machine().region("maincpu")->base();
162   UINT8 *ROM = memregion("maincpu")->base();
163163
164164//  if(!(io_switch))
165165   {
r14976r14977
229229
230230READ8_MEMBER(spool99_state::vcarn_io_r)
231231{
232   UINT8 *ROM = machine().region("maincpu")->base();
232   UINT8 *ROM = memregion("maincpu")->base();
233233
234234//  if(!(io_switch))
235235   {
r14976r14977
419419{
420420   spool99_state *state = machine.driver_data<spool99_state>();
421421
422   UINT8 *ROM = machine.region("maincpu")->base();
422   UINT8 *ROM = state->memregion("maincpu")->base();
423423//  vram = auto_alloc_array(machine, UINT8, 0x2000);
424424   memcpy(state->m_main, ROM, 0x100);
425425}
src/mame/drivers/simpl156.c
r14976r14977
10221022
10231023static DRIVER_INIT( simpl156 )
10241024{
1025   UINT8 *rom = machine.region("okimusic")->base();
1026   int length = machine.region("okimusic")->bytes();
1025   UINT8 *rom = machine.root_device().memregion("okimusic")->base();
1026   int length = machine.root_device().memregion("okimusic")->bytes();
10271027   UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
10281028
10291029   UINT32 x;
src/mame/drivers/battlnts.c
r14976r14977
4040WRITE8_MEMBER(battlnts_state::battlnts_bankswitch_w)
4141{
4242   /* bits 6 & 7 = bank number */
43   memory_set_bank(machine(), "bank1", (data & 0xc0) >> 6);
43   membank("bank1")->set_entry((data & 0xc0) >> 6);
4444
4545   /* bits 4 & 5 = coin counters */
4646   coin_counter_w(machine(), 0, data & 0x10);
r14976r14977
224224static MACHINE_START( battlnts )
225225{
226226   battlnts_state *state = machine.driver_data<battlnts_state>();
227   UINT8 *ROM = machine.region("maincpu")->base();
227   UINT8 *ROM = state->memregion("maincpu")->base();
228228
229   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
229   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
230230
231231   state->m_audiocpu = machine.device("audiocpu");
232232   state->m_k007342 = machine.device("k007342");
r14976r14977
404404static DRIVER_INIT( rackemup )
405405{
406406   /* rearrange char ROM */
407   shuffle(machine.region("gfx1")->base(), machine.region("gfx1")->bytes());
407   shuffle(machine.root_device().memregion("gfx1")->base(), machine.root_device().memregion("gfx1")->bytes());
408408}
409409
410410
src/mame/drivers/multfish.c
r14976r14977
333333
334334WRITE8_MEMBER(multfish_state::multfish_bank_w)
335335{
336   memory_set_bank(machine(), "bank1", data & 0x0f);
336   membank("bank1")->set_entry(data & 0x0f);
337337}
338338
339339static READ8_DEVICE_HANDLER( multfish_timekeeper_r )
r14976r14977
471471*/
472472
473473   UINT32 i,j,jscr,romoffset;
474   UINT8 *multfish_gfx = machine.region("gfx")->base();
474   UINT8 *multfish_gfx = machine.root_device().memregion("gfx")->base();
475475   UINT8 *temprom = auto_alloc_array(machine, UINT8, multfish_ROM_SIZE);
476476
477477
r14976r14977
543543
544544static void lottery_decode(running_machine &machine, UINT8 xor12, UINT8 xor34, UINT8 xor56, UINT8 xor78, UINT32 xor_addr)
545545{
546   UINT8 *multfish_gfx = machine.region("gfx")->base();
546   UINT8 *multfish_gfx = machine.root_device().memregion("gfx")->base();
547547   UINT8 *temprom = auto_alloc_array(machine, UINT8, multfish_ROM_SIZE);
548548
549549   /* ROMs decode */
r14976r14977
584584
585585static void ent_decode(running_machine &machine, UINT8 xor12, UINT8 xor34, UINT8 xor56, UINT8 xor78, UINT32 xor_addr)
586586{
587   UINT8 *multfish_gfx = machine.region("gfx")->base();
587   UINT8 *multfish_gfx = machine.root_device().memregion("gfx")->base();
588588   UINT8 *temprom = auto_alloc_array(machine, UINT8, multfish_ROM_SIZE);
589589
590590   /* ROMs decode */
r14976r14977
10091009{
10101010   multfish_state *state = machine.driver_data<multfish_state>();
10111011
1012   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base(), 0x4000);
1013   memory_set_bank(machine, "bank1", 0);
1012   state->membank("bank1")->configure_entries(0, 16, state->memregion("maincpu")->base(), 0x4000);
1013   state->membank("bank1")->set_entry(0);
10141014
10151015   state->m_disp_enable = 0;
10161016   state->m_rambk = 0;
src/mame/drivers/galpani2.c
r14976r14977
275275
276276static WRITE8_DEVICE_HANDLER( galpani2_oki1_bank_w )
277277{
278   UINT8 *ROM = device->machine().region("oki1")->base();
278   UINT8 *ROM = device->machine().root_device().memregion("oki1")->base();
279279   logerror("%s : %s bank %08X\n",device->machine().describe_context(),device->tag(),data);
280280   memcpy(ROM + 0x30000, ROM + 0x40000 + 0x10000 * (~data & 0xf), 0x10000);
281281}
r14976r14977
349349
350350READ16_MEMBER(galpani2_state::galpani2_bankedrom_r)
351351{
352   UINT16 *ROM = (UINT16 *) machine().region( "user1" )->base();
353   size_t    len = machine().region( "user1" )->bytes() / 2;
352   UINT16 *ROM = (UINT16 *) memregion( "user1" )->base();
353   size_t    len = memregion( "user1" )->bytes() / 2;
354354
355355   offset += (0x800000/2) * (*m_rombank & 0x0003);
356356
src/mame/drivers/midqslvr.c
r14976r14977
132132      case 0x59: // PAM0
133133      {
134134         if (data & 0x10)      // enable RAM access to region 0xf0000 - 0xfffff
135            memory_set_bankptr(busdevice->machine(), "bios_bank", state->m_bios_ram);
135            state->membank("bios_bank")->set_base(state->m_bios_ram);
136136         else               // disable RAM access (reads go to BIOS ROM)
137            memory_set_bankptr(busdevice->machine(), "bios_bank", busdevice->machine().region("bios")->base() + 0x70000);
137            state->membank("bios_bank")->set_base(state->memregion("bios")->base() + 0x70000);
138138         break;
139139      }
140140      case 0x5a: // PAM1
141141      {
142142         if (data & 0x1)
143            memory_set_bankptr(busdevice->machine(), "video_bank1", state->m_isa_ram1);
143            state->membank("video_bank1")->set_base(state->m_isa_ram1);
144144         else
145            memory_set_bankptr(busdevice->machine(), "video_bank1", busdevice->machine().region("video_bios")->base() + 0);
145            state->membank("video_bank1")->set_base(state->memregion("video_bios")->base() + 0);
146146
147147         if (data & 0x10)
148            memory_set_bankptr(busdevice->machine(), "video_bank2", state->m_isa_ram2);
148            state->membank("video_bank2")->set_base(state->m_isa_ram2);
149149         else
150            memory_set_bankptr(busdevice->machine(), "video_bank2", busdevice->machine().region("video_bios")->base() + 0x4000);
150            state->membank("video_bank2")->set_base(state->memregion("video_bios")->base() + 0x4000);
151151
152152         break;
153153      }
154154      case 0x5e: // PAM5
155155      {
156156         if (data & 0x1)
157            memory_set_bankptr(busdevice->machine(), "bios_ext1", state->m_bios_ext1_ram);
157            state->membank("bios_ext1")->set_base(state->m_bios_ext1_ram);
158158         else
159            memory_set_bankptr(busdevice->machine(), "bios_ext1", busdevice->machine().region("bios")->base() + 0x60000);
159            state->membank("bios_ext1")->set_base(state->memregion("bios")->base() + 0x60000);
160160
161161         if (data & 0x10)
162            memory_set_bankptr(busdevice->machine(), "bios_ext2", state->m_bios_ext2_ram);
162            state->membank("bios_ext2")->set_base(state->m_bios_ext2_ram);
163163         else
164            memory_set_bankptr(busdevice->machine(), "bios_ext2", busdevice->machine().region("bios")->base() + 0x64000);
164            state->membank("bios_ext2")->set_base(state->memregion("bios")->base() + 0x64000);
165165
166166         break;
167167      }
168168      case 0x5f: // PAM6
169169      {
170170         if (data & 0x1)
171            memory_set_bankptr(busdevice->machine(), "bios_ext3", state->m_bios_ext3_ram);
171            state->membank("bios_ext3")->set_base(state->m_bios_ext3_ram);
172172         else
173            memory_set_bankptr(busdevice->machine(), "bios_ext3", busdevice->machine().region("bios")->base() + 0x68000);
173            state->membank("bios_ext3")->set_base(state->memregion("bios")->base() + 0x68000);
174174
175175         if (data & 0x10)
176            memory_set_bankptr(busdevice->machine(), "bios_ext4", state->m_bios_ext4_ram);
176            state->membank("bios_ext4")->set_base(state->m_bios_ext4_ram);
177177         else
178            memory_set_bankptr(busdevice->machine(), "bios_ext4", busdevice->machine().region("bios")->base() + 0x6c000);
178            state->membank("bios_ext4")->set_base(state->memregion("bios")->base() + 0x6c000);
179179
180180         break;
181181      }
r14976r14977
674674
675675static MACHINE_RESET( midqslvr )
676676{
677   memory_set_bankptr(machine, "bios_bank", machine.region("bios")->base() + 0x70000);
678   memory_set_bankptr(machine, "bios_ext1", machine.region("bios")->base() + 0x60000);
679   memory_set_bankptr(machine, "bios_ext2", machine.region("bios")->base() + 0x64000);
680   memory_set_bankptr(machine, "bios_ext3", machine.region("bios")->base() + 0x68000);
681   memory_set_bankptr(machine, "bios_ext4", machine.region("bios")->base() + 0x6c000);
682   memory_set_bankptr(machine, "video_bank1", machine.region("video_bios")->base() + 0);
683   memory_set_bankptr(machine, "video_bank2", machine.region("video_bios")->base() + 0x4000);
677   machine.root_device().membank("bios_bank")->set_base(machine.root_device().memregion("bios")->base() + 0x70000);
678   machine.root_device().membank("bios_ext1")->set_base(machine.root_device().memregion("bios")->base() + 0x60000);
679   machine.root_device().membank("bios_ext2")->set_base(machine.root_device().memregion("bios")->base() + 0x64000);
680   machine.root_device().membank("bios_ext3")->set_base(machine.root_device().memregion("bios")->base() + 0x68000);
681   machine.root_device().membank("bios_ext4")->set_base(machine.root_device().memregion("bios")->base() + 0x6c000);
682   machine.root_device().membank("video_bank1")->set_base(machine.root_device().memregion("video_bios")->base() + 0);
683   machine.root_device().membank("video_bank2")->set_base(machine.root_device().memregion("video_bios")->base() + 0x4000);
684684}
685685
686686
src/mame/drivers/seibuspi.c
r14976r14977
979979   if ((data & 7) != m_z80_lastbank)
980980   {
981981      m_z80_lastbank = (data & 7);
982      memory_set_bankptr(machine(), "bank4", m_z80_rom + (0x8000 * m_z80_lastbank));
982      membank("bank4")->set_base(m_z80_rom + (0x8000 * m_z80_lastbank));
983983   }
984984}
985985
r14976r14977
995995
996996READ32_MEMBER(seibuspi_state::soundrom_r)
997997{
998   UINT8 *sound = (UINT8*)machine().region("user2")->base();
999   UINT16 *sound16 = (UINT16*)machine().region("user2")->base();
998   UINT8 *sound = (UINT8*)machine().root_device().memregion("user2")->base();
999   UINT16 *sound16 = (UINT16*)machine().root_device().memregion("user2")->base();
10001000
10011001   if (mem_mask == 0x000000ff)
10021002   {
r14976r14977
18121812{
18131813   seibuspi_state *state = machine.driver_data<seibuspi_state>();
18141814   int i;
1815   UINT8 *sound = machine.region("ymf")->base();
1815   UINT8 *sound = machine.root_device().memregion("ymf")->base();
18161816
1817   UINT8 *rombase = machine.region("user1")->base();
1817   UINT8 *rombase = state->memregion("user1")->base();
18181818   UINT8 flash_data = rombase[0x1ffffc];
18191819
18201820   cputag_set_input_line(machine, "soundcpu", INPUT_LINE_RESET, ASSERT_LINE );
r14976r14977
18241824   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00000688, 0x0000068b, write32_delegate(FUNC(seibuspi_state::z80_prg_fifo_w),state));
18251825   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0000068c, 0x0000068f, write32_delegate(FUNC(seibuspi_state::z80_enable_w),state));
18261826
1827   memory_set_bankptr(machine, "bank4", state->m_z80_rom);
1828   memory_set_bankptr(machine, "bank5", state->m_z80_rom);
1827   state->membank("bank4")->set_base(state->m_z80_rom);
1828   state->membank("bank5")->set_base(state->m_z80_rom);
18291829
18301830   /* If the first value doesn't match, the game shows a checksum error */
18311831   /* If any of the other values are wrong, the game goes to update mode */
r14976r14977
18971897static MACHINE_RESET( sxx2f )
18981898{
18991899   seibuspi_state *state = machine.driver_data<seibuspi_state>();
1900   UINT8 *rom = machine.region("soundcpu")->base();
1900   UINT8 *rom = state->memregion("soundcpu")->base();
19011901
1902   memory_set_bankptr(machine, "bank4", state->m_z80_rom);
1903   memory_set_bankptr(machine, "bank5", state->m_z80_rom);
1902   state->membank("bank4")->set_base(state->m_z80_rom);
1903   state->membank("bank5")->set_base(state->m_z80_rom);
19041904
19051905   memcpy(state->m_z80_rom, rom, 0x40000);
19061906
r14976r14977
20752075   state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0");
20762076   state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1");
20772077
2078   seibuspi_text_decrypt(machine.region("gfx1")->base());
2079   seibuspi_bg_decrypt(machine.region("gfx2")->base(), machine.region("gfx2")->bytes());
2080   seibuspi_sprite_decrypt(machine.region("gfx3")->base(), 0x400000);
2078   seibuspi_text_decrypt(machine.root_device().memregion("gfx1")->base());
2079   seibuspi_bg_decrypt(machine.root_device().memregion("gfx2")->base(), machine.root_device().memregion("gfx2")->bytes());
2080   seibuspi_sprite_decrypt(state->memregion("gfx3")->base(), 0x400000);
20812081}
20822082
20832083static DRIVER_INIT( rdft )
r14976r14977
21462146   state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1");
21472147
21482148   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0282AC, 0x0282AF, read32_delegate(FUNC(seibuspi_state::rf2_speedup_r),state));
2149   seibuspi_rise10_text_decrypt(machine.region("gfx1")->base());
2150   seibuspi_rise10_bg_decrypt(machine.region("gfx2")->base(), machine.region("gfx2")->bytes());
2151   seibuspi_rise10_sprite_decrypt(machine.region("gfx3")->base(), 0x600000);
2149   seibuspi_rise10_text_decrypt(machine.root_device().memregion("gfx1")->base());
2150   seibuspi_rise10_bg_decrypt(machine.root_device().memregion("gfx2")->base(), machine.root_device().memregion("gfx2")->bytes());
2151   seibuspi_rise10_sprite_decrypt(state->memregion("gfx3")->base(), 0x600000);
21522152
21532153   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),state));
21542154}
r14976r14977
21712171   state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1");
21722172
21732173   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x002894c, 0x002894f, read32_delegate(FUNC(seibuspi_state::rfjet_speedup_r),state));
2174   seibuspi_rise11_text_decrypt(machine.region("gfx1")->base());
2175   seibuspi_rise11_bg_decrypt(machine.region("gfx2")->base(), machine.region("gfx2")->bytes());
2176   seibuspi_rise11_sprite_decrypt_rfjet(machine.region("gfx3")->base(), 0x800000);
2174   seibuspi_rise11_text_decrypt(machine.root_device().memregion("gfx1")->base());
2175   seibuspi_rise11_bg_decrypt(machine.root_device().memregion("gfx2")->base(), machine.root_device().memregion("gfx2")->bytes());
2176   seibuspi_rise11_sprite_decrypt_rfjet(state->memregion("gfx3")->base(), 0x800000);
21772177
21782178   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),state));
21792179}
r14976r14977
22372237static DRIVER_INIT( sys386f2 )
22382238{
22392239   int i, j;
2240   UINT16 *src = (UINT16 *)machine.region("gfx3")->base();
2240   UINT16 *src = (UINT16 *)machine.root_device().memregion("gfx3")->base();
22412241   UINT16 tmp[0x40 / 2], Offset;
22422242
22432243   // sprite_reorder() only
2244   for(i = 0; i < machine.region("gfx3")->bytes() / 0x40; i++)
2244   for(i = 0; i < machine.root_device().memregion("gfx3")->bytes() / 0x40; i++)
22452245   {
22462246      memcpy(tmp, src, 0x40);
22472247
src/mame/drivers/coolpool.c
r14976r14977
534534
535535READ16_MEMBER(coolpool_state::dsp_rom_r)
536536{
537   UINT8 *rom = machine().region("user2")->base();
537   UINT8 *rom = memregion("user2")->base();
538538
539   return rom[m_iop_romaddr & (machine().region("user2")->bytes() - 1)];
539   return rom[m_iop_romaddr & (machine().root_device().memregion("user2")->bytes() - 1)];
540540}
541541
542542
r14976r14977
11991199   UINT16 *rom;
12001200
12011201   /* decrypt the main program ROMs */
1202   rom = (UINT16 *)machine.region("user1")->base();
1203   len = machine.region("user1")->bytes();
1202   rom = (UINT16 *)machine.root_device().memregion("user1")->base();
1203   len = machine.root_device().memregion("user1")->bytes();
12041204   for (a = 0;a < len/2;a++)
12051205   {
12061206      int hi,lo,nhi,nlo;
r14976r14977
12231223   }
12241224
12251225   /* decrypt the sub data ROMs */
1226   rom = (UINT16 *)machine.region("user2")->base();
1227   len = machine.region("user2")->bytes();
1226   rom = (UINT16 *)machine.root_device().memregion("user2")->base();
1227   len = machine.root_device().memregion("user2")->bytes();
12281228   for (a = 1;a < len/2;a+=4)
12291229   {
12301230      /* just swap bits 1 and 2 of the address */
src/mame/drivers/sauro.c
r14976r14977
554554   /* This game doesn't like all memory to be initialized to zero, it won't
555555       initialize the high scores */
556556
557   UINT8 *RAM = machine.region("maincpu")->base();
557   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
558558
559559   memset(&RAM[0xe000], 0, 0x100);
560560   RAM[0xe000] = 1;
src/mame/drivers/drmicro.c
r14976r14977
4545static void pcm_w(device_t *device)
4646{
4747   drmicro_state *state = device->machine().driver_data<drmicro_state>();
48   UINT8 *PCM = device->machine().region("adpcm")->base();
48   UINT8 *PCM = state->memregion("adpcm")->base();
4949
5050   int data = PCM[state->m_pcm_adr / 2];
5151
src/mame/drivers/astrafr.c
r14976r14977
19631963
19641964static DRIVER_INIT( astradec )
19651965{
1966   astra_addresslines( (UINT16*)machine.region( "maincpu" )->base(), machine.region( "maincpu" )->bytes(), 0 );
1966   astra_addresslines( (UINT16*)machine.root_device().memregion( "maincpu" )->base(), machine.root_device().memregion( "maincpu" )->bytes(), 0 );
19671967}
19681968
19691969
19701970
19711971static DRIVER_INIT( astradec_dual )
19721972{
1973   astra_addresslines( (UINT16*)machine.region( "maincpu" )->base(), machine.region( "maincpu" )->bytes(), 0 );
1974   astra_addresslines( (UINT16*)machine.region( "slavecpu" )->base(), machine.region( "slavecpu" )->bytes(), 0 );
1973   astra_addresslines( (UINT16*)machine.root_device().memregion( "maincpu" )->base(), machine.root_device().memregion( "maincpu" )->bytes(), 0 );
1974   astra_addresslines( (UINT16*)machine.root_device().memregion( "slavecpu" )->base(), machine.root_device().memregion( "slavecpu" )->bytes(), 0 );
19751975}
19761976
19771977static DRIVER_INIT( astradec_sml )
19781978{
1979   astra_addresslines( (UINT16*)machine.region( "maincpu" )->base(), machine.region( "maincpu" )->bytes(), 1 );
1979   astra_addresslines( (UINT16*)machine.root_device().memregion( "maincpu" )->base(), machine.root_device().memregion( "maincpu" )->bytes(), 1 );
19801980}
19811981
19821982static DRIVER_INIT( astradec_sml_dual )
19831983{
1984   astra_addresslines( (UINT16*)machine.region( "maincpu" )->base(), machine.region( "maincpu" )->bytes(), 1 );
1985   astra_addresslines( (UINT16*)machine.region( "slavecpu" )->base(), machine.region( "slavecpu" )->bytes(), 1 );
1984   astra_addresslines( (UINT16*)machine.root_device().memregion( "maincpu" )->base(), machine.root_device().memregion( "maincpu" )->bytes(), 1 );
1985   astra_addresslines( (UINT16*)machine.root_device().memregion( "slavecpu" )->base(), machine.root_device().memregion( "slavecpu" )->bytes(), 1 );
19861986}
19871987
19881988// Single games?
src/mame/drivers/system1.c
r14976r14977
356356static MACHINE_START( system1 )
357357{
358358   system1_state *state = machine.driver_data<system1_state>();
359   UINT32 numbanks = (machine.region("maincpu")->bytes() - 0x10000) / 0x4000;
359   UINT32 numbanks = (machine.root_device().memregion("maincpu")->bytes() - 0x10000) / 0x4000;
360360
361361   if (numbanks > 0)
362      memory_configure_bank(machine, "bank1", 0, numbanks, machine.region("maincpu")->base() + 0x10000, 0x4000);
362      state->membank("bank1")->configure_entries(0, numbanks, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
363363   else
364      memory_configure_bank(machine, "bank1", 0, 1, machine.region("maincpu")->base() + 0x8000, 0);
365   memory_set_bank(machine, "bank1", 0);
364      state->membank("bank1")->configure_entry(0, state->memregion("maincpu")->base() + 0x8000);
365   state->membank("bank1")->set_entry(0);
366366
367367   z80_set_cycle_tables(machine.device("maincpu"), cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex);
368368
r14976r14977
400400static void bank44_custom_w(running_machine &machine, UINT8 data, UINT8 prevdata)
401401{
402402   /* bank bits are bits 6 and 2 */
403   memory_set_bank(machine, "bank1", ((data & 0x40) >> 5) | ((data & 0x04) >> 2));
403   machine.root_device().membank("bank1")->set_entry(((data & 0x40) >> 5) | ((data & 0x04) >> 2));
404404}
405405
406406
407407static void bank0c_custom_w(running_machine &machine, UINT8 data, UINT8 prevdata)
408408{
409409   /* bank bits are bits 3 and 2 */
410   memory_set_bank(machine, "bank1", (data & 0x0c) >> 2);
410   machine.root_device().membank("bank1")->set_entry((data & 0x0c) >> 2);
411411}
412412
413413
r14976r14977
583583         return machine().device<z80_device>("maincpu")->space(AS_PROGRAM)->read_byte(offset);
584584
585585      case 1:
586         return machine().region("maincpu")->base()[offset + 0x10000];
586         return memregion("maincpu")->base()[offset + 0x10000];
587587
588588      case 2:
589589         return machine().device<z80_device>("maincpu")->space(AS_IO)->read_byte(offset);
r14976r14977
46514651
46524652   /* additionally to the usual protection, all the program ROMs have data lines */
46534653   /* D0 and D1 swapped. */
4654   rom = machine.region("maincpu")->base();
4654   rom = machine.root_device().memregion("maincpu")->base();
46554655   for (A = 0;A < 0xc000;A++)
46564656      rom[A] = (rom[A] & 0xfc) | ((rom[A] & 1) << 1) | ((rom[A] & 2) >> 1);
46574657
46584658   /* the tile gfx ROMs are mangled as well: */
4659   rom = machine.region("tiles")->base();
4659   rom = machine.root_device().memregion("tiles")->base();
46604660
46614661   /* the first ROM has data lines D0 and D6 swapped. */
46624662   for (A = 0x0000;A < 0x4000;A++)
r14976r14977
46914691READ8_MEMBER(system1_state::nob_start_r)
46924692{
46934693   /* in reality, it's likely some M1-dependent behavior */
4694   return (cpu_get_pc(&space.device()) <= 0x0003) ? 0x80 : machine().region("maincpu")->base()[1];
4694   return (cpu_get_pc(&space.device()) <= 0x0003) ? 0x80 : memregion("maincpu")->base()[1];
46954695}
46964696
46974697static DRIVER_INIT( nob )
r14976r14977
47174717   /* Patch to get PRG ROMS ('T', 'R' and 'S) status as "GOOD" in the "test mode" */
47184718   /* not really needed */
47194719
4720//  UINT8 *ROM = machine.region("maincpu")->base();
4720//  UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
47214721
47224722//  ROM[0x3296] = 0x18;     // 'jr' instead of 'jr z' - 'T' (PRG Main ROM)
47234723//  ROM[0x32be] = 0x18;     // 'jr' instead of 'jr z' - 'R' (Banked ROM 1)
r14976r14977
47304730
47314731   /* Patch to get sound in later levels(the program enters into a tight loop)*/
47324732   address_space *iospace = machine.device("maincpu")->memory().space(AS_IO);
4733   UINT8 *ROM2 = machine.region("soundcpu")->base();
4733   UINT8 *ROM2 = machine.root_device().memregion("soundcpu")->base();
47344734
47354735   ROM2[0x02f9] = 0x28;//'jr z' instead of 'jr'
47364736
r14976r14977
47474747static DRIVER_INIT( bootleg )
47484748{
47494749   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
4750   space->set_decrypted_region(0x0000, 0x7fff, machine.region("maincpu")->base() + 0x10000);
4750   space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x10000);
47514751   DRIVER_INIT_CALL(bank00);
47524752}
47534753
r14976r14977
47554755static DRIVER_INIT( bootsys2 )
47564756{
47574757   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
4758   space->set_decrypted_region(0x0000, 0x7fff, machine.region("maincpu")->base() + 0x20000);
4759   memory_configure_bank_decrypted(machine, "bank1", 0, 4, machine.region("maincpu")->base() + 0x30000, 0x4000);
4758   space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x20000);
4759   machine.root_device().membank("bank1")->configure_decrypted_entries(0, 4, machine.root_device().memregion("maincpu")->base() + 0x30000, 0x4000);
47604760   DRIVER_INIT_CALL(bank0c);
47614761}
47624762
47634763static DRIVER_INIT( choplift )
47644764{
4765   UINT8 *mcurom = machine.region("mcu")->base();
4765   UINT8 *mcurom = machine.root_device().memregion("mcu")->base();
47664766
47674767   /* the ROM dump we have is bad; the following patches make it work */
47684768   mcurom[0x100] = 0x55;      /* D5 in current dump */
src/mame/drivers/quizo.c
r14976r14977
5151
5252static PALETTE_INIT(quizo)
5353{
54   const UINT8 *color_prom = machine.region("proms")->base();
54   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
5555   int i;
5656   for (i = 0;i < 16;i++)
5757   {
r14976r14977
129129      data=0;
130130   }
131131   m_port60=data;
132   memory_set_bankptr(machine(),  "bank1", &machine().region("user1")->base()[rombankLookup[data]*0x4000] );
132   membank("bank1")->set_base(&machine().root_device().memregion("user1")->base()[rombankLookup[data]*0x4000] );
133133}
134134
135135static ADDRESS_MAP_START( memmap, AS_PROGRAM, 8, quizo_state )
src/mame/drivers/niyanpai.c
r14976r14977
5555
5656static void niyanpai_soundbank_w(running_machine &machine, int data)
5757{
58   UINT8 *SNDROM = machine.region("audiocpu")->base();
58   UINT8 *SNDROM = machine.root_device().memregion("audiocpu")->base();
5959
60   memory_set_bankptr(machine, "bank1", &SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
60   machine.root_device().membank("bank1")->set_base(&SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
6161}
6262
6363READ8_MEMBER(niyanpai_state::niyanpai_sound_r)
r14976r14977
266266static DRIVER_INIT( niyanpai )
267267{
268268   niyanpai_state *state = machine.driver_data<niyanpai_state>();
269   UINT8 *SNDROM = machine.region("audiocpu")->base();
269   UINT8 *SNDROM = state->memregion("audiocpu")->base();
270270
271271   // sound program patch
272272   SNDROM[0x0213] = 0x00;         // DI -> NOP
src/mame/drivers/bfm_sc2.c
r14976r14977
378378   // init rom bank ////////////////////////////////////////////////////////
379379
380380   {
381      UINT8 *rom = machine.region("maincpu")->base();
381      UINT8 *rom = machine.root_device().memregion("maincpu")->base();
382382
383      memory_configure_bank(machine, "bank1", 0, 4, &rom[0x00000], 0x02000);
383      state->membank("bank1")->configure_entries(0, 4, &rom[0x00000], 0x02000);
384384
385      memory_set_bank(machine, "bank1",3);
385      state->membank("bank1")->set_entry(3);
386386   }
387387}
388388
r14976r14977
476476
477477WRITE8_MEMBER(bfm_sc2_state::bankswitch_w)
478478{
479   memory_set_bank(machine(), "bank1",data & 0x03);
479   membank("bank1")->set_entry(data & 0x03);
480480}
481481
482482///////////////////////////////////////////////////////////////////////////
r14976r14977
22042204   bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
22052205   UINT8 *pal;
22062206
2207   pal = machine.region("proms")->base();
2207   pal = state->memregion("proms")->base();
22082208   if ( pal )
22092209   {
22102210      memcpy(state->m_key, pal, 8);
src/mame/drivers/tmmjprd.c
r14976r14977
290290static SCREEN_UPDATE_IND16( tmmjprd_left )
291291{
292292   tmmjprd_state *state = screen.machine().driver_data<tmmjprd_state>();
293   UINT8* gfxroms = screen.machine().region("gfx2")->base();
293   UINT8* gfxroms = state->memregion("gfx2")->base();
294294
295295   bitmap.fill(get_black_pen(screen.machine()), cliprect);
296296
r14976r14977
325325static SCREEN_UPDATE_IND16( tmmjprd_right )
326326{
327327   tmmjprd_state *state = screen.machine().driver_data<tmmjprd_state>();
328   UINT8* gfxroms = screen.machine().region("gfx2")->base();
328   UINT8* gfxroms = state->memregion("gfx2")->base();
329329
330330   bitmap.fill(get_black_pen(screen.machine()), cliprect);
331331
r14976r14977
385385static void tmmjprd_do_blit(running_machine &machine)
386386{
387387   tmmjprd_state *state = machine.driver_data<tmmjprd_state>();
388   UINT8 *blt_data = machine.region("gfx1")->base();
388   UINT8 *blt_data = state->memregion("gfx1")->base();
389389   int blt_source = (tmmjprd_blitterregs[0]&0x000fffff)>>0;
390390   int blt_column = (tmmjprd_blitterregs[1]&0x00ff0000)>>16;
391391   int blt_line   = (tmmjprd_blitterregs[1]&0x000000ff);
src/mame/drivers/suprnova.c
r14976r14977
431431   else
432432      hit.disconnect= 0;
433433
434   memory_set_bankptr(machine, "bank1",machine.region("user1")->base());
434   state->membank("bank1")->set_base(state->memregion("user1")->base());
435435}
436436
437437
r14976r14977
665665
666666WRITE32_MEMBER(skns_state::skns_v3t_w)
667667{
668   UINT8 *btiles = machine().region("gfx3")->base();
668   UINT8 *btiles = memregion("gfx3")->base();
669669
670670   COMBINE_DATA(&m_v3t_ram[offset]);
671671
src/mame/drivers/witch.c
r14976r14977
380380
381381         if(newbank != m_bank)
382382         {
383            UINT8 *ROM = machine().region("maincpu")->base();
383            UINT8 *ROM = memregion("maincpu")->base();
384384            m_bank = newbank;
385385            ROM = &ROM[0x10000+0x8000 * newbank + UNBANKED_SIZE];
386            memory_set_bankptr(machine(), "bank1",ROM);
386            membank("bank1")->set_base(ROM);
387387         }
388388      }
389389      break;
r14976r14977
419419   case 0x25e:
420420      return offset;//enough to pass...
421421  }
422  return machine().region("sub")->base()[0x7000+offset];
422  return memregion("sub")->base()[0x7000+offset];
423423}
424424
425425/*
r14976r14977
870870static DRIVER_INIT(witch)
871871{
872872   witch_state *state = machine.driver_data<witch_state>();
873   UINT8 *ROM = (UINT8 *)machine.region("maincpu")->base();
874   memory_set_bankptr(machine, "bank1", &ROM[0x10000+UNBANKED_SIZE]);
873   UINT8 *ROM = (UINT8 *)state->memregion("maincpu")->base();
874   state->membank("bank1")->set_base(&ROM[0x10000+UNBANKED_SIZE]);
875875
876876   machine.device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x7000, 0x700f, read8_delegate(FUNC(witch_state::prot_read_700x), state));
877877   state->m_bank = -1;
src/mame/drivers/namcofl.c
r14976r14977
187187   {
188188      if (data == 0)   // RAM at 00000000, ROM at 10000000
189189      {
190         memory_set_bankptr(machine(),  "bank1", m_workram );
191         memory_set_bankptr(machine(),  "bank2", machine().region("maincpu")->base() );
190         membank("bank1")->set_base(m_workram );
191         membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() );
192192      }
193193      else      // ROM at 00000000, RAM at 10000000
194194      {
195         memory_set_bankptr(machine(),  "bank1", machine().region("maincpu")->base() );
196         memory_set_bankptr(machine(),  "bank2", m_workram );
195         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() );
196         membank("bank2")->set_base(m_workram );
197197      }
198198   }
199199}
r14976r14977
580580   machine.scheduler().timer_set(machine.primary_screen->time_until_pos(machine.primary_screen->visible_area().max_y + 3), FUNC(network_interrupt_callback));
581581   machine.scheduler().timer_set(machine.primary_screen->time_until_pos(machine.primary_screen->visible_area().max_y + 1), FUNC(vblank_interrupt_callback));
582582
583   memory_set_bankptr(machine,  "bank1", machine.region("maincpu")->base() );
584   memory_set_bankptr(machine,  "bank2", state->m_workram );
583   state->membank("bank1")->set_base(state->memregion("maincpu")->base() );
584   state->membank("bank2")->set_base(state->m_workram );
585585
586586   memset(state->m_workram, 0x00, 0x100000);
587587}
r14976r14977
811811   namcofl_state *state = machine.driver_data<namcofl_state>();
812812   state->m_workram = auto_alloc_array(machine, UINT32, 0x100000/4);
813813
814   memory_set_bankptr(machine,  "bank1", machine.region("maincpu")->base() );
815   memory_set_bankptr(machine,  "bank2", state->m_workram );
814   state->membank("bank1")->set_base(state->memregion("maincpu")->base() );
815   state->membank("bank2")->set_base(state->m_workram );
816816}
817817
818818static DRIVER_INIT(speedrcr)
src/mame/drivers/luckgrln.c
r14976r14977
10261026{
10271027   int i;
10281028   UINT8 x,v;
1029   UINT8* rom = machine.region("rom_data")->base();
1029   UINT8* rom = machine.root_device().memregion("rom_data")->base();
10301030
10311031   for (i=0;i<0x20000;i++)
10321032   {
r14976r14977
10531053   #endif
10541054
10551055   // ??
1056//  memory_set_bankptr(machine, "bank1",&rom[0x010000]);
1056//  machine.root_device().membank("bank1")->set_base(&rom[0x010000]);
10571057}
10581058
10591059
src/mame/drivers/dynax.c
r14976r14977
266266
267267WRITE8_MEMBER(dynax_state::dynax_rombank_w)
268268{
269   memory_set_bank(machine(), "bank1", data & 0x0f);
269   membank("bank1")->set_entry(data & 0x0f);
270270}
271271
272272WRITE8_MEMBER(dynax_state::jantouki_sound_rombank_w)
273273{
274   memory_set_bank(machine(), "bank2", data);
274   membank("bank2")->set_entry(data);
275275}
276276
277277
278278WRITE8_MEMBER(dynax_state::hnoridur_rombank_w)
279279{
280   int bank_n = (machine().region("maincpu")->bytes() - 0x10000) / 0x8000;
280   int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
281281
282282   //logerror("%04x: rom bank = %02x\n", cpu_get_pc(&space.device()), data);
283283   if (data < bank_n)
284      memory_set_bank(machine(), "bank1", data);
284      membank("bank1")->set_entry(data);
285285   else
286286      logerror("rom_bank = %02x (larger than the maximum bank %02x)\n", data, bank_n);
287287   m_hnoridur_bank = data;
r14976r14977
314314      // hnoridur: R/W RAM
315315      case 0x18:
316316      {
317         UINT8 *RAM = machine().region("maincpu")->base() + 0x10000 + m_hnoridur_bank * 0x8000;
317         UINT8 *RAM = memregion("maincpu")->base() + 0x10000 + m_hnoridur_bank * 0x8000;
318318         RAM[offset] = data;
319319         return;
320320      }
r14976r14977
749749
750750WRITE8_MEMBER(dynax_state::yarunara_rombank_w)
751751{
752       int bank_n = (machine().region("maincpu")->bytes() - 0x10000) / 0x8000;
752       int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
753753
754754       //logerror("%04x: rom bank = %02x\n", cpu_get_pc(&space.device()), data);
755755       if (data < bank_n)
756               memory_set_bank(machine(), "bank1", data);
756               membank("bank1")->set_entry(data);
757757       else
758758               logerror("rom_bank = %02x (larger than the maximum bank %02x)\n",data, bank_n);
759759       m_hnoridur_bank = data;
r14976r14977
969969
970970WRITE8_MEMBER(dynax_state::jantouki_rombank_w)
971971{
972   memory_set_bank(machine(), "bank1", data & 0x0f);
972   membank("bank1")->set_entry(data & 0x0f);
973973   set_led_status(machine(), 0, data & 0x10);   // maybe
974974}
975975
r14976r14977
11901190WRITE8_MEMBER(dynax_state::htengoku_rombank_w)
11911191{
11921192
1193   memory_set_bank(machine(), "bank1", data & 0x07);
1193   membank("bank1")->set_entry(data & 0x07);
11941194   m_hnoridur_bank = data;
11951195}
11961196
r14976r14977
13701370static void tenkai_update_rombank( running_machine &machine )
13711371{
13721372   dynax_state *state = machine.driver_data<dynax_state>();
1373   state->m_romptr = machine.region("maincpu")->base() + 0x10000 + 0x8000 * state->m_rombank;
1373   state->m_romptr = state->memregion("maincpu")->base() + 0x10000 + 0x8000 * state->m_rombank;
13741374//  logerror("rombank = %02x\n", state->m_rombank);
13751375}
13761376
r14976r14977
15691569{
15701570   dynax_state *state = machine.driver_data<dynax_state>();
15711571   state->m_rombank = data;
1572   state->m_romptr = machine.region("maincpu")->base() + 0x8000 + state->m_rombank * 0x8000;
1572   state->m_romptr = state->memregion("maincpu")->base() + 0x8000 + state->m_rombank * 0x8000;
15731573}
15741574
15751575WRITE8_MEMBER(dynax_state::gekisha_p4_w)
r14976r14977
42394239
42404240static MACHINE_START( hanamai )
42414241{
4242   UINT8 *ROM = machine.region("maincpu")->base();
4243   memory_configure_bank(machine, "bank1", 0, 0x10, &ROM[0x8000], 0x8000);
4242   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
4243   machine.root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x8000], 0x8000);
42444244
42454245   MACHINE_START_CALL(dynax);
42464246}
42474247
42484248static MACHINE_START( hnoridur )
42494249{
4250   UINT8 *ROM = machine.region("maincpu")->base();
4251   int bank_n = (machine.region("maincpu")->bytes() - 0x10000) / 0x8000;
4250   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
4251   int bank_n = (machine.root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
42524252
4253   memory_configure_bank(machine, "bank1", 0, bank_n, &ROM[0x10000], 0x8000);
4253   machine.root_device().membank("bank1")->configure_entries(0, bank_n, &ROM[0x10000], 0x8000);
42544254
42554255   MACHINE_START_CALL(dynax);
42564256}
42574257
42584258static MACHINE_START( htengoku )
42594259{
4260   UINT8 *ROM = machine.region("maincpu")->base();
4260   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
42614261
4262   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x8000);
4262   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x8000);
42634263
42644264   MACHINE_START_CALL(dynax);
42654265}
r14976r14977
46304630static MACHINE_START( jantouki )
46314631{
46324632   dynax_state *state = machine.driver_data<dynax_state>();
4633   UINT8 *MAIN = machine.region("maincpu")->base();
4634   UINT8 *SOUND = machine.region("soundcpu")->base();
4633   UINT8 *MAIN = machine.root_device().memregion("maincpu")->base();
4634   UINT8 *SOUND = state->memregion("soundcpu")->base();
46354635
4636   memory_configure_bank(machine, "bank1", 0, 0x10, &MAIN[0x8000],  0x8000);
4637   memory_configure_bank(machine, "bank2", 0, 12,   &SOUND[0x8000], 0x8000);
4636   state->membank("bank1")->configure_entries(0, 0x10, &MAIN[0x8000],  0x8000);
4637   state->membank("bank2")->configure_entries(0, 12,   &SOUND[0x8000], 0x8000);
46384638
46394639   state->m_top_scr = machine.device("top");
46404640   state->m_bot_scr = machine.device("bottom");
r14976r14977
53615361static DRIVER_INIT( blktouch )
53625362{
53635363   // fearsome encryption ;-)
5364   UINT8   *src = (UINT8 *)machine.region("maincpu")->base();
5364   UINT8   *src = (UINT8 *)machine.root_device().memregion("maincpu")->base();
53655365   int i;
53665366
53675367   for (i = 0; i < 0x90000; i++)
r14976r14977
53705370
53715371   }
53725372
5373   src = (UINT8 *)machine.region("gfx1")->base();
5373   src = (UINT8 *)machine.root_device().memregion("gfx1")->base();
53745374
53755375   for (i = 0; i < 0xc0000; i++)
53765376   {
r14976r14977
53835383{
53845384   /* Address lines scrambling on 1 z80 rom */
53855385   int i;
5386   UINT8   *gfx = (UINT8 *)machine.region("gfx1")->base();
5387   UINT8   *rom = machine.region("maincpu")->base() + 0x28000, *end = rom + 0x10000;
5386   UINT8   *gfx = (UINT8 *)machine.root_device().memregion("gfx1")->base();
5387   UINT8   *rom = machine.root_device().memregion("maincpu")->base() + 0x28000, *end = rom + 0x10000;
53885388   for ( ; rom < end; rom += 8)
53895389   {
53905390      UINT8 temp[8];
r14976r14977
61016101static DRIVER_INIT( mjelct3 )
61026102{
61036103   int i;
6104   UINT8   *rom = machine.region("maincpu")->base();
6105   size_t  size = machine.region("maincpu")->bytes();
6104   UINT8   *rom = machine.root_device().memregion("maincpu")->base();
6105   size_t  size = machine.root_device().memregion("maincpu")->bytes();
61066106   UINT8   *rom1 = auto_alloc_array(machine, UINT8, size);
61076107
61086108   memcpy(rom1, rom, size);
r14976r14977
61146114static DRIVER_INIT( mjelct3a )
61156115{
61166116   int i, j;
6117   UINT8   *rom = machine.region("maincpu")->base();
6118   size_t  size = machine.region("maincpu")->bytes();
6117   UINT8   *rom = machine.root_device().memregion("maincpu")->base();
6118   size_t  size = machine.root_device().memregion("maincpu")->bytes();
61196119   UINT8   *rom1 = auto_alloc_array(machine, UINT8, size);
61206120
61216121   memcpy(rom1, rom, size);
src/mame/drivers/sigmab98.c
r14976r14977
347347         if (data >= 0x18)
348348            logerror("%s: unknown rom bank = %02x\n", machine().describe_context(), data);
349349         else
350            memory_set_bank(machine(), "rombank", data);
350            membank("rombank")->set_entry(data);
351351         break;
352352
353353      default:
r14976r14977
386386         switch (data)
387387         {
388388            case 0x32:
389               memory_set_bank(machine(), "rambank", 0);
389               membank("rambank")->set_entry(0);
390390               break;
391391            case 0x36:
392               memory_set_bank(machine(), "rambank", 1);
392               membank("rambank")->set_entry(1);
393393               break;
394394            default:
395395               logerror("%s: unknown ram bank = %02x\n", machine().describe_context(), data);
r14976r14977
542542      return;
543543   }
544544
545   UINT8 *rom = machine().region("maincpu")->base();
545   UINT8 *rom = memregion("maincpu")->base();
546546   switch ( m_reg )
547547   {
548548      case 0x0f:
549549         m_rombank = data;
550550         switch (data)
551551         {
552            case 0x10:   memory_set_bankptr(machine(), "rombank", rom + 0x400 + 0x4000);   break;
553            case 0x14:   memory_set_bankptr(machine(), "rombank", rom + 0x400 + 0x8000);   break;
554            case 0x18:   memory_set_bankptr(machine(), "rombank", rom + 0x400 + 0xc000);   break;
552            case 0x10:   membank("rombank")->set_base(rom + 0x400 + 0x4000);   break;
553            case 0x14:   membank("rombank")->set_base(rom + 0x400 + 0x8000);   break;
554            case 0x18:   membank("rombank")->set_base(rom + 0x400 + 0xc000);   break;
555555            default:
556556               logerror("%s: unknown rom bank = %02x, reg = %02x\n", machine().describe_context(), data, m_reg);
557557         }
r14976r14977
602602               logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", machine().describe_context(), data, m_reg2);
603603               return;
604604         }
605         memory_set_bank(machine(), "rambank", bank);
605         membank("rambank")->set_entry(bank);
606606         if ( (bank == 1) || (bank == 2) || (bank == 3) )
607            memory_set_bank(machine(), "sprbank", bank-1);
607            membank("sprbank")->set_entry(bank-1);
608608         break;
609609
610610      default:
r14976r14977
898898      case 0x1d:
899899      case 0x1e:
900900      case 0x1f:
901         return machine().region("maincpu")->base()[offset + 0xb400 + 0x1000 * (m_rombank-0x10)];
901         return memregion("maincpu")->base()[offset + 0xb400 + 0x1000 * (m_rombank-0x10)];
902902
903903      case 0x65:   // SPRITERAM
904904         if (offset < 0x1000)
r14976r14977
10101010      return;
10111011   }
10121012
1013   UINT8 *rom = machine().region("maincpu")->base();
1013   UINT8 *rom = memregion("maincpu")->base();
10141014   switch ( m_reg )
10151015   {
10161016      case 0x0d:
r14976r14977
10181018         switch (data)
10191019         {
10201020            case 0x11:   // 3800 IS ROM
1021               memory_set_bankptr(machine(), "rombank0", rom + 0x4c00);
1022               memory_set_bankptr(machine(), "rombank1", rom + 0x5c00);
1023               memory_set_bankptr(machine(), "sprbank0", m_spriteram + 0x1000*4);   // scratch
1024               memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*4);   // scratch
1021               membank("rombank0")->set_base(rom + 0x4c00);
1022               membank("rombank1")->set_base(rom + 0x5c00);
1023               membank("sprbank0")->set_base(m_spriteram + 0x1000*4);   // scratch
1024               membank("sprbank1")->set_base(m_spriteram + 0x1000*4);   // scratch
10251025               break;
10261026
10271027            default:
r14976r14977
10341034         switch (data)
10351035         {
10361036            case 0x14:   // 3800 IS ROM
1037               memory_set_bankptr(machine(), "rombank0", rom + 0x8000);
1038               memory_set_bankptr(machine(), "rombank1", rom + 0x9000);
1039               memory_set_bankptr(machine(), "sprbank0", m_spriteram + 0x1000*4);   // scratch
1040               memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*4);   // scratch
1037               membank("rombank0")->set_base(rom + 0x8000);
1038               membank("rombank1")->set_base(rom + 0x9000);
1039               membank("sprbank0")->set_base(m_spriteram + 0x1000*4);   // scratch
1040               membank("sprbank1")->set_base(m_spriteram + 0x1000*4);   // scratch
10411041               break;
10421042
10431043            default:
r14976r14977
10501050         switch (data)
10511051         {
10521052            case 0x0f:   // 3800 IS ROM
1053               memory_set_bankptr(machine(), "rombank0", rom + 0x3400);
1054               memory_set_bankptr(machine(), "rombank1", rom + 0x4400);
1055               memory_set_bankptr(machine(), "sprbank0", m_spriteram + 0x1000*4);   // scratch
1056               memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*4);   // scratch
1053               membank("rombank0")->set_base(rom + 0x3400);
1054               membank("rombank1")->set_base(rom + 0x4400);
1055               membank("sprbank0")->set_base(m_spriteram + 0x1000*4);   // scratch
1056               membank("sprbank1")->set_base(m_spriteram + 0x1000*4);   // scratch
10571057               break;
10581058
10591059            case 0x12:   // 3800 IS ROM
1060               memory_set_bankptr(machine(), "rombank0", rom + 0x6400);
1061               memory_set_bankptr(machine(), "rombank1", rom + 0x7400);
1062               memory_set_bankptr(machine(), "sprbank0", m_spriteram + 0x1000*4);   // scratch
1063               memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*4);   // scratch
1060               membank("rombank0")->set_base(rom + 0x6400);
1061               membank("rombank1")->set_base(rom + 0x7400);
1062               membank("sprbank0")->set_base(m_spriteram + 0x1000*4);   // scratch
1063               membank("sprbank1")->set_base(m_spriteram + 0x1000*4);   // scratch
10641064               break;
10651065
10661066            // used in test mode:
1067//              case 0x5c:  memory_set_bankptr(machine(), "rombank", rom + 0x400 + 0x0000);    break;  // 3800 IS RAM! (8000 bytes)
1067//              case 0x5c:  membank("rombank")->set_base(rom + 0x400 + 0x0000);    break;  // 3800 IS RAM! (8000 bytes)
10681068
10691069            case 0x5e:   // 3800 IS RAM! (1404 bytes)
1070               memory_set_bankptr(machine(), "rombank0", m_spriteram + 0x1000*1);
1071               memory_set_bankptr(machine(), "sprbank0", m_spriteram + 0x1000*1);
1072               memory_set_bankptr(machine(), "rombank1", m_spriteram + 0x1000*2);
1073               memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*2);
1070               membank("rombank0")->set_base(m_spriteram + 0x1000*1);
1071               membank("sprbank0")->set_base(m_spriteram + 0x1000*1);
1072               membank("rombank1")->set_base(m_spriteram + 0x1000*2);
1073               membank("sprbank1")->set_base(m_spriteram + 0x1000*2);
10741074               break;
10751075
10761076            case 0x6c:   // 3800 IS RAM! (1000 bytes) - SPRITERAM
1077               memory_set_bankptr(machine(), "rombank0", m_spriteram);
1078               memory_set_bankptr(machine(), "sprbank0", m_spriteram);
1079//                  memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*4);    // scratch
1077               membank("rombank0")->set_base(m_spriteram);
1078               membank("sprbank0")->set_base(m_spriteram);
1079//                  membank("sprbank1")->set_base(m_spriteram + 0x1000*4);    // scratch
10801080               break;
10811081
10821082            default:
r14976r14977
10891089         switch (data)
10901090         {
10911091            case 0x14:   // 3800 IS ROM
1092               memory_set_bankptr(machine(), "rombank0", rom + 0x8800);
1093               memory_set_bankptr(machine(), "rombank1", rom + 0x9800);
1094               memory_set_bankptr(machine(), "sprbank0", m_spriteram + 0x1000*4);   // scratch
1095               memory_set_bankptr(machine(), "sprbank1", m_spriteram + 0x1000*4);   // scratch
1092               membank("rombank0")->set_base(rom + 0x8800);
1093               membank("rombank1")->set_base(rom + 0x9800);
1094               membank("sprbank0")->set_base(m_spriteram + 0x1000*4);   // scratch
1095               membank("sprbank1")->set_base(m_spriteram + 0x1000*4);   // scratch
10961096               break;
10971097
10981098            default:
r14976r14977
11391139         m_rambank = data;
11401140         switch (data)
11411141         {
1142            case 0x52:   memory_set_bankptr(machine(), "palbank", m_nvram);                           break;
1143            case 0x64:   memory_set_bankptr(machine(), "palbank", m_generic_paletteram_8);   break;
1142            case 0x52:   membank("palbank")->set_base(m_nvram);                           break;
1143            case 0x64:   membank("palbank")->set_base(m_generic_paletteram_8);   break;
11441144            default:
11451145               logerror("%s: unknown ram bank = %02x, reg2 = %02x\n", machine().describe_context(), data, m_reg2);
11461146               return;
r14976r14977
13741374      case 0x1d:
13751375      case 0x1e:
13761376      case 0x1f:
1377         return machine().region("maincpu")->base()[offset + 0xc400 + 0x1000 * (m_rombank-0x10)];
1377         return memregion("maincpu")->base()[offset + 0xc400 + 0x1000 * (m_rombank-0x10)];
13781378
13791379      case 0x64:   // SPRITERAM
13801380         if (offset < 0x1000)
r14976r14977
18971897
18981898static DRIVER_INIT( gegege )
18991899{
1900   UINT8 *rom = machine.region("maincpu")->base();
1900   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
19011901
19021902   // Protection?
19031903   rom[0x0bdd] = 0xc9;
r14976r14977
19151915   rom[0x8165] = 0x00;
19161916
19171917   // ROM banks
1918   memory_configure_bank(machine, "rombank", 0, 0x18, rom + 0x8000, 0x1000);
1919   memory_set_bank(machine, "rombank", 0);
1918   machine.root_device().membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
1919   machine.root_device().membank("rombank")->set_entry(0);
19201920
19211921   // RAM banks
19221922   UINT8 *bankedram = auto_alloc_array(machine, UINT8, 0x800 * 2);
19231923
1924   memory_configure_bank(machine, "rambank", 0, 2, bankedram, 0x800);
1925   memory_set_bank(machine, "rambank", 0);
1924   machine.root_device().membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
1925   machine.root_device().membank("rambank")->set_entry(0);
19261926}
19271927
19281928
r14976r14977
19461946
19471947static DRIVER_INIT( pepsiman )
19481948{
1949   UINT8 *rom = machine.region("maincpu")->base();
1949   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
19501950
19511951   // Protection?
19521952   rom[0x058a] = 0xc9;
r14976r14977
19641964   rom[0x8165] = 0x00;
19651965
19661966   // ROM banks
1967   memory_configure_bank(machine, "rombank", 0, 0x18, rom + 0x8000, 0x1000);
1968   memory_set_bank(machine, "rombank", 0);
1967   machine.root_device().membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
1968   machine.root_device().membank("rombank")->set_entry(0);
19691969
19701970   // RAM banks
19711971   UINT8 *bankedram = auto_alloc_array(machine, UINT8, 0x800 * 2);
19721972
1973   memory_configure_bank(machine, "rambank", 0, 2, bankedram, 0x800);
1974   memory_set_bank(machine, "rambank", 0);
1973   machine.root_device().membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
1974   machine.root_device().membank("rambank")->set_entry(0);
19751975}
19761976
19771977
r14976r14977
19971997
19981998static DRIVER_INIT( ucytokyu )
19991999{
2000   UINT8 *rom = machine.region("maincpu")->base();
2000   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
20012001
20022002   // Protection?
20032003   rom[0x0bfa] = 0xc9;
r14976r14977
20152015   rom[0x8165] = 0x00;
20162016
20172017   // ROM banks
2018   memory_configure_bank(machine, "rombank", 0, 0x18, rom + 0x8000, 0x1000);
2019   memory_set_bank(machine, "rombank", 0);
2018   machine.root_device().membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
2019   machine.root_device().membank("rombank")->set_entry(0);
20202020
20212021   // RAM banks
20222022   UINT8 *bankedram = auto_alloc_array(machine, UINT8, 0x800 * 2);
20232023
2024   memory_configure_bank(machine, "rambank", 0, 2, bankedram, 0x800);
2025   memory_set_bank(machine, "rambank", 0);
2024   machine.root_device().membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
2025   machine.root_device().membank("rambank")->set_entry(0);
20262026}
20272027
20282028
r14976r14977
21102110   sigmab98_state *state = machine.driver_data<sigmab98_state>();
21112111   // RAM banks
21122112   UINT8 *bankedram = auto_alloc_array(machine, UINT8, 0x1000 * 5);
2113   memory_configure_bank(machine, "rambank", 0, 1, state->m_nvram,     0x1000);
2114   memory_configure_bank(machine, "rambank", 1, 4, bankedram, 0x1000);
2115   memory_set_bank(machine, "rambank", 0);
2113   state->membank("rambank")->configure_entry(0, state->m_nvram);
2114   state->membank("rambank")->configure_entries(1, 4, bankedram, 0x1000);
2115   state->membank("rambank")->set_entry(0);
21162116
21172117   state->m_spriteram.allocate(0x1000 * 5);
21182118   memset(state->m_spriteram, 0, 0x1000 * 5);
2119   memory_configure_bank(machine, "sprbank", 0, 5, state->m_spriteram, 0x1000);
2120   memory_set_bank(machine, "sprbank", 0);
2119   state->membank("sprbank")->configure_entries(0, 5, state->m_spriteram, 0x1000);
2120   state->membank("sprbank")->set_entry(0);
21212121
21222122   state->m_vblank_vector = 0x00; // increment counter
21232123   state->m_timer0_vector = 0x1c; // read hopper state
r14976r14977
21502150{
21512151   sigmab98_state *state = machine.driver_data<sigmab98_state>();
21522152   // ROM banks
2153   UINT8 *rom = machine.region("maincpu")->base();
2154   memory_set_bankptr(machine, "rombank0", rom + 0x3400);
2155   memory_set_bankptr(machine, "rombank1", rom + 0x4400);
2153   UINT8 *rom = state->memregion("maincpu")->base();
2154   state->membank("rombank0")->set_base(rom + 0x3400);
2155   state->membank("rombank1")->set_base(rom + 0x4400);
21562156   state->m_rombank = 0x0f;
21572157
21582158   // RAM banks
21592159   state->m_generic_paletteram_8.allocate(0x3000);
21602160   memset(state->m_generic_paletteram_8, 0, 0x3000);
2161   memory_set_bankptr(machine, "palbank", state->m_generic_paletteram_8);
2161   state->membank("palbank")->set_base(state->m_generic_paletteram_8);
21622162   state->m_rambank = 0x64;
21632163
21642164   state->m_spriteram.allocate(0x1000 * 5);
21652165   memset(state->m_spriteram, 0, 0x1000 * 5);
2166   memory_set_bankptr(machine, "sprbank0",  state->m_spriteram + 0x1000*4);   // scratch
2167   memory_set_bankptr(machine, "sprbank1",  state->m_spriteram + 0x1000*4);   // scratch
2166   state->membank("sprbank0")->set_base(state->m_spriteram + 0x1000*4);   // scratch
2167   state->membank("sprbank1")->set_base(state->m_spriteram + 0x1000*4);   // scratch
21682168
21692169   state->m_vblank_vector = 0x00;
21702170   state->m_timer0_vector = 0x02;
src/mame/drivers/shootout.c
r14976r14977
4343
4444WRITE8_MEMBER(shootout_state::shootout_bankswitch_w)
4545{
46   memory_set_bank(machine(), "bank1", data & 0x0f);
46   membank("bank1")->set_entry(data & 0x0f);
4747}
4848
4949WRITE8_MEMBER(shootout_state::sound_cpu_command_w)
r14976r14977
409409static DRIVER_INIT( shootout )
410410{
411411   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
412   int length = machine.region("maincpu")->bytes();
412   int length = machine.root_device().memregion("maincpu")->bytes();
413413   UINT8 *decrypt = auto_alloc_array(machine, UINT8, length - 0x8000);
414   UINT8 *rom = machine.region("maincpu")->base();
414   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
415415   int A;
416416
417417   space->set_decrypted_region(0x8000, 0xffff, decrypt);
r14976r14977
419419   for (A = 0x8000;A < length;A++)
420420      decrypt[A-0x8000] = (rom[A] & 0x9f) | ((rom[A] & 0x40) >> 1) | ((rom[A] & 0x20) << 1);
421421
422   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
423   memory_configure_bank_decrypted(machine, "bank1", 0, 16, decrypt + 0x8000, 0x4000);
422   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
423   machine.root_device().membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x8000, 0x4000);
424424}
425425
426426static DRIVER_INIT( shootouj )
427427{
428   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x4000);
428   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
429429}
430430
431431
src/mame/drivers/itech32.c
r14976r14977
625625
626626WRITE8_MEMBER(itech32_state::sound_bank_w)
627627{
628   memory_set_bankptr(machine(), "bank1", &machine().region("soundcpu")->base()[0x10000 + data * 0x4000]);
628   membank("bank1")->set_base(&machine().root_device().memregion("soundcpu")->base()[0x10000 + data * 0x4000]);
629629}
630630
631631
src/mame/drivers/mexico86.c
r14976r14977
421421static MACHINE_START( mexico86 )
422422{
423423   mexico86_state *state = machine.driver_data<mexico86_state>();
424   UINT8 *ROM = machine.region("maincpu")->base();
424   UINT8 *ROM = state->memregion("maincpu")->base();
425425
426   memory_configure_bank(machine, "bank1", 0, 6, &ROM[0x10000], 0x4000);
426   state->membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
427427
428428   state->m_maincpu = machine.device("maincpu");
429429   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/calchase.c
r14976r14977
339339         //if (data & 0x10)     // enable RAM access to region 0xf0000 - 0xfffff
340340         if ((data & 0x50) | (data & 0xA0))
341341         {
342            memory_set_bankptr(busdevice->machine(), "bank1", state->m_bios_ram);
342            state->membank("bank1")->set_base(state->m_bios_ram);
343343         }
344344         else            // disable RAM access (reads go to BIOS ROM)
345345         {
r14976r14977
352352            }
353353            #endif
354354
355            //memory_set_bankptr(busdevice->machine(), "bank1", busdevice->machine().region("bios")->base() + 0x10000);
356            memory_set_bankptr(busdevice->machine(), "bank1", busdevice->machine().region("bios")->base());
355            state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x10000);
356            state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base());
357357         }
358358         break;
359359      }
r14976r14977
865865
866866static MACHINE_RESET(calchase)
867867{
868   //memory_set_bankptr(machine, "bank1", machine.region("bios")->base() + 0x10000);
869   memory_set_bankptr(machine, "bank1", machine.region("bios")->base());
868   //machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("bios")->base() + 0x10000);
869   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("bios")->base());
870870}
871871
872872static void set_gate_a20(running_machine &machine, int a20)
src/mame/drivers/chaknpop.c
r14976r14977
346346static MACHINE_START( chaknpop )
347347{
348348   chaknpop_state *state = machine.driver_data<chaknpop_state>();
349   UINT8 *ROM = machine.region("maincpu")->base();
349   UINT8 *ROM = state->memregion("maincpu")->base();
350350
351   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x4000);
351   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000);
352352
353353   state->save_item(NAME(state->m_gfxmode));
354354   state->save_item(NAME(state->m_flip_x));
src/mame/drivers/ashnojoe.c
r14976r14977
287287
288288static WRITE8_DEVICE_HANDLER( ym2203_write_b )
289289{
290   memory_set_bank(device->machine(), "bank4", data & 0x0f);
290   device->machine().root_device().membank("bank4")->set_entry(data & 0x0f);
291291}
292292
293293static const ym2203_interface ym2203_config =
r14976r14977
462462
463463static DRIVER_INIT( ashnojoe )
464464{
465   UINT8 *ROM = machine.region("adpcm")->base();
466   memory_configure_bank(machine, "bank4", 0, 16, &ROM[0x00000], 0x8000);
465   UINT8 *ROM = machine.root_device().memregion("adpcm")->base();
466   machine.root_device().membank("bank4")->configure_entries(0, 16, &ROM[0x00000], 0x8000);
467467
468   memory_set_bank(machine, "bank4", 0);
468   machine.root_device().membank("bank4")->set_entry(0);
469469}
470470
471471GAME( 1990, scessjoe, 0,        ashnojoe, ashnojoe, ashnojoe, ROT0, "Wave / Taito Corporation", "Success Joe (World)",   GAME_SUPPORTS_SAVE )
src/mame/drivers/mouser.c
r14976r14977
295295
296296   offs_t i;
297297   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
298   UINT8 *rom = machine.region("maincpu")->base();
298   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
299299   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x6000);
300   UINT8 *table = machine.region("user1")->base();
300   UINT8 *table = machine.root_device().memregion("user1")->base();
301301
302302   space->set_decrypted_region(0x0000, 0x5fff, decrypted);
303303
src/mame/drivers/undrfire.c
r14976r14977
970970static DRIVER_INIT( undrfire )
971971{
972972   UINT32 offset,i;
973   UINT8 *gfx = machine.region("gfx3")->base();
974   int size=machine.region("gfx3")->bytes();
973   UINT8 *gfx = machine.root_device().memregion("gfx3")->base();
974   int size=machine.root_device().memregion("gfx3")->bytes();
975975   int data;
976976
977977   /* make piv tile GFX format suitable for gfxdecode */
r14976r14977
999999static DRIVER_INIT( cbombers )
10001000{
10011001   UINT32 offset,i;
1002   UINT8 *gfx = machine.region("gfx3")->base();
1003   int size=machine.region("gfx3")->bytes();
1002   UINT8 *gfx = machine.root_device().memregion("gfx3")->base();
1003   int size=machine.root_device().memregion("gfx3")->bytes();
10041004   int data;
10051005
10061006
src/mame/drivers/lkage.c
r14976r14977
159159
160160READ8_MEMBER(lkage_state::port_fetch_r)
161161{
162   return machine().region("user1")->base()[offset];
162   return memregion("user1")->base()[offset];
163163}
164164
165165static ADDRESS_MAP_START( lkage_io_map, AS_IO, 8, lkage_state )
src/mame/drivers/gaiden.c
r14976r14977
15191519static void descramble_drgnbowl_gfx(running_machine &machine)
15201520{
15211521   int i;
1522   UINT8 *ROM = machine.region("maincpu")->base();
1523   size_t size = machine.region("maincpu")->bytes();
1522   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1523   size_t size = machine.root_device().memregion("maincpu")->bytes();
15241524   UINT8 *buffer = auto_alloc_array(machine, UINT8, size);
15251525
15261526   memcpy(buffer, ROM, size);
r14976r14977
15361536
15371537   auto_free(machine, buffer);
15381538
1539   ROM = machine.region("gfx2")->base();
1540   size = machine.region("gfx2")->bytes();
1539   ROM = machine.root_device().memregion("gfx2")->base();
1540   size = machine.root_device().memregion("gfx2")->bytes();
15411541   buffer = auto_alloc_array(machine, UINT8, size);
15421542
15431543   memcpy(buffer,ROM,size);
r14976r14977
16071607static DRIVER_INIT(mastninj)
16081608{
16091609   // rearrange the graphic roms into a format that MAME can decode
1610   descramble_mastninj_gfx(machine, machine.region("gfx2")->base());
1611   descramble_mastninj_gfx(machine, machine.region("gfx3")->base());
1610   descramble_mastninj_gfx(machine, machine.root_device().memregion("gfx2")->base());
1611   descramble_mastninj_gfx(machine, machine.root_device().memregion("gfx3")->base());
16121612   DRIVER_INIT_CALL(shadoww);
16131613}
16141614
src/mame/drivers/aleck64.c
r14976r14977
837837
838838static DRIVER_INIT( aleck64 )
839839{
840   UINT8 *rom = machine.region("user2")->base();
840   UINT8 *rom = machine.root_device().memregion("user2")->base();
841841
842842   rom[0x67c] = 0;
843843   rom[0x67d] = 0;
src/mame/drivers/quizshow.c
r14976r14977
425425
426426static DRIVER_INIT( quizshow )
427427{
428   UINT8 *gfxdata = machine.region("user1")->base();
429   UINT8 *dest = machine.region("gfx1")->base();
428   UINT8 *gfxdata = machine.root_device().memregion("user1")->base();
429   UINT8 *dest = machine.root_device().memregion("gfx1")->base();
430430
431431   int tile, line;
432432
src/mame/drivers/trackfld.c
r14976r14977
211211   {
212212      if((data & 1 << i) == 0) // check first bit active low, change ROM bank according to the correlated bit
213213      {
214         memory_set_bank(machine(), "bank1", i);
214         membank("bank1")->set_entry(i);
215215         return;
216216      }
217217   }
r14976r14977
14241424static DRIVER_INIT( atlantol )
14251425{
14261426   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1427   UINT8 *rom = machine.region("maincpu")->base();
1427   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
14281428   UINT8 *decrypt;
14291429   int A;
14301430
r14976r14977
14461446   space->install_read_bank(0x1380, 0x17ff, "bank11");
14471447   space->install_read_bank(0x2000, 0x27ff, "bank12");
14481448   space->install_read_bank(0x4000, 0x5fff, "bank13");
1449   memory_set_bankptr(machine, "bank10", &rom[0x0000]);
1450   memory_set_bankptr(machine, "bank11", &rom[0x1380]);
1451   memory_set_bankptr(machine, "bank12", &rom[0x2000]);
1452   memory_set_bankptr(machine, "bank13", &rom[0x4000]);
1449   state->membank("bank10")->set_base(&rom[0x0000]);
1450   state->membank("bank11")->set_base(&rom[0x1380]);
1451   state->membank("bank12")->set_base(&rom[0x2000]);
1452   state->membank("bank13")->set_base(&rom[0x4000]);
14531453}
14541454
14551455static DRIVER_INIT( mastkin )
14561456{
1457   UINT8 *prom = machine.region("proms")->base();
1457   UINT8 *prom = machine.root_device().memregion("proms")->base();
14581458   int i;
14591459
14601460   /* build a fake palette so the screen won't be all black */
r14976r14977
14751475
14761476static DRIVER_INIT( wizzquiz )
14771477{
1478   UINT8 *ROM = machine.region("maincpu")->base() + 0xe000;
1478   UINT8 *ROM = machine.root_device().memregion("maincpu")->base() + 0xe000;
14791479   int i;
14801480
14811481   /* decrypt program rom */
14821482   for (i = 0; i < 0x2000; i++)
14831483      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
14841484
1485   ROM = machine.region("user1")->base();
1485   ROM = machine.root_device().memregion("user1")->base();
14861486
14871487   /* decrypt questions roms */
14881488   for (i = 0; i < 0x40000; i++)
14891489      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
14901490
1491   memory_configure_bank(machine, "bank1", 0, 8, ROM, 0x8000);
1491   machine.root_device().membank("bank1")->configure_entries(0, 8, ROM, 0x8000);
14921492}
14931493
14941494
src/mame/drivers/astrof.c
r14976r14977
205205   offs_t i;
206206   UINT8 bank = (state->m_astrof_palette_bank ? 0x10 : 0x00);
207207   UINT8 config = input_port_read_safe(machine, "FAKE", 0x00);
208   UINT8 *prom = machine.region("proms")->base();
208   UINT8 *prom = state->memregion("proms")->base();
209209
210210   /* a common wire hack to the pcb causes the prom halves to be inverted */
211211   /* this results in e.g. astrof background being black */
r14976r14977
239239static void tomahawk_get_pens( running_machine &machine, pen_t *pens )
240240{
241241   offs_t i;
242   UINT8 *prom = machine.region("proms")->base();
242   UINT8 *prom = machine.root_device().memregion("proms")->base();
243243   UINT8 config = input_port_read_safe(machine, "FAKE", 0x00);
244244
245245   for (i = 0; i < TOMAHAWK_NUM_PENS; i++)
r14976r14977
12891289static DRIVER_INIT( abattle )
12901290{
12911291   /* use the protection PROM to decrypt the ROMs */
1292   UINT8 *rom = machine.region("maincpu")->base();
1293   UINT8 *prom = machine.region("user1")->base();
1292   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
1293   UINT8 *prom = machine.root_device().memregion("user1")->base();
12941294   int i;
12951295
12961296   for(i = 0xd000; i < 0x10000; i++)
r14976r14977
13051305
13061306static DRIVER_INIT( afire )
13071307{
1308   UINT8 *rom = machine.region("maincpu")->base();
1308   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
13091309   int i;
13101310
13111311   for(i = 0xd000; i < 0x10000; i++)
r14976r14977
13201320
13211321static DRIVER_INIT( sstarbtl )
13221322{
1323   UINT8 *rom = machine.region("maincpu")->base();
1323   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
13241324   int i;
13251325
13261326   for(i = 0xd000; i < 0x10000; i++)
src/mame/drivers/tecmo.c
r14976r14977
5555WRITE8_MEMBER(tecmo_state::tecmo_bankswitch_w)
5656{
5757   int bankaddress;
58   UINT8 *RAM = machine().region("maincpu")->base();
58   UINT8 *RAM = memregion("maincpu")->base();
5959
6060
6161   bankaddress = 0x10000 + ((data & 0xf8) << 8);
62   memory_set_bankptr(machine(), "bank1", &RAM[bankaddress]);
62   membank("bank1")->set_base(&RAM[bankaddress]);
6363}
6464
6565WRITE8_MEMBER(tecmo_state::tecmo_sound_command_w)
r14976r14977
8686{
8787   tecmo_state *state = device->machine().driver_data<tecmo_state>();
8888   if (state->m_adpcm_pos >= state->m_adpcm_end ||
89            state->m_adpcm_pos >= device->machine().region("adpcm")->bytes())
89            state->m_adpcm_pos >= state->memregion("adpcm")->bytes())
9090      msm5205_reset_w(device,1);
9191   else if (state->m_adpcm_data != -1)
9292   {
r14976r14977
9595   }
9696   else
9797   {
98      UINT8 *ROM = device->machine().region("adpcm")->base();
98      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base();
9999
100100      state->m_adpcm_data = ROM[state->m_adpcm_pos++];
101101      msm5205_data_w(device,state->m_adpcm_data >> 4);
src/mame/drivers/magictg.c
r14976r14977
229229
230230void magictg_state::machine_reset()
231231{
232   UINT8 *adsp_boot = (UINT8*)machine().region("adsp")->base();
232   UINT8 *adsp_boot = (UINT8*)machine().root_device().memregion("adsp")->base();
233233
234234   zr36120_reset();
235235
r14976r14977
752752         if (data > 0)
753753         {
754754            address_space* addr_space;
755            UINT8* adsp_rom = (UINT8*)space.machine().region("adsp")->base();
755            UINT8* adsp_rom = (UINT8*)space.machine().root_device().memregion("adsp")->base();
756756
757757            UINT32 page = (m_adsp_regs.bdma_control >> 8) & 0xff;
758758            UINT32 dir = (m_adsp_regs.bdma_control >> 2) & 1;
src/mame/drivers/xtom3d.c
r14976r14977
145145      case 0x59: // PAM0
146146      {
147147         if (data & 0x10)      // enable RAM access to region 0xf0000 - 0xfffff
148            memory_set_bankptr(busdevice->machine(), "bios_bank", state->m_bios_ram);
148            state->membank("bios_bank")->set_base(state->m_bios_ram);
149149         else               // disable RAM access (reads go to BIOS ROM)
150            memory_set_bankptr(busdevice->machine(), "bios_bank", busdevice->machine().region("bios")->base() + 0x10000);
150            state->membank("bios_bank")->set_base(state->memregion("bios")->base() + 0x10000);
151151         break;
152152      }
153153      case 0x5a: // PAM1
154154      {
155155         if (data & 0x1)
156            memory_set_bankptr(busdevice->machine(), "video_bank1", state->m_isa_ram1);
156            state->membank("video_bank1")->set_base(state->m_isa_ram1);
157157         else
158            memory_set_bankptr(busdevice->machine(), "video_bank1", busdevice->machine().region("video_bios")->base() + 0);
158            state->membank("video_bank1")->set_base(state->memregion("video_bios")->base() + 0);
159159
160160         if (data & 0x10)
161            memory_set_bankptr(busdevice->machine(), "video_bank2", state->m_isa_ram2);
161            state->membank("video_bank2")->set_base(state->m_isa_ram2);
162162         else
163            memory_set_bankptr(busdevice->machine(), "video_bank2", busdevice->machine().region("video_bios")->base() + 0x4000);
163            state->membank("video_bank2")->set_base(state->memregion("video_bios")->base() + 0x4000);
164164
165165         break;
166166      }
167167      case 0x5e: // PAM5
168168      {
169169         if (data & 0x1)
170            memory_set_bankptr(busdevice->machine(), "bios_ext1", state->m_bios_ext1_ram);
170            state->membank("bios_ext1")->set_base(state->m_bios_ext1_ram);
171171         else
172            memory_set_bankptr(busdevice->machine(), "bios_ext1", busdevice->machine().region("bios")->base() + 0);
172            state->membank("bios_ext1")->set_base(state->memregion("bios")->base() + 0);
173173
174174         if (data & 0x10)
175            memory_set_bankptr(busdevice->machine(), "bios_ext2", state->m_bios_ext2_ram);
175            state->membank("bios_ext2")->set_base(state->m_bios_ext2_ram);
176176         else
177            memory_set_bankptr(busdevice->machine(), "bios_ext2", busdevice->machine().region("bios")->base() + 0x4000);
177            state->membank("bios_ext2")->set_base(state->memregion("bios")->base() + 0x4000);
178178
179179         break;
180180      }
181181      case 0x5f: // PAM6
182182      {
183183         if (data & 0x1)
184            memory_set_bankptr(busdevice->machine(), "bios_ext3", state->m_bios_ext3_ram);
184            state->membank("bios_ext3")->set_base(state->m_bios_ext3_ram);
185185         else
186            memory_set_bankptr(busdevice->machine(), "bios_ext3", busdevice->machine().region("bios")->base() + 0x8000);
186            state->membank("bios_ext3")->set_base(state->memregion("bios")->base() + 0x8000);
187187
188188         if (data & 0x10)
189            memory_set_bankptr(busdevice->machine(), "bios_ext4", state->m_bios_ext4_ram);
189            state->membank("bios_ext4")->set_base(state->m_bios_ext4_ram);
190190         else
191            memory_set_bankptr(busdevice->machine(), "bios_ext4", busdevice->machine().region("bios")->base() + 0xc000);
191            state->membank("bios_ext4")->set_base(state->memregion("bios")->base() + 0xc000);
192192
193193         break;
194194      }
r14976r14977
666666
667667static MACHINE_RESET( xtom3d )
668668{
669   memory_set_bankptr(machine, "bios_bank", machine.region("bios")->base() + 0x10000);
670   memory_set_bankptr(machine, "bios_ext1", machine.region("bios")->base() + 0);
671   memory_set_bankptr(machine, "bios_ext2", machine.region("bios")->base() + 0x4000);
672   memory_set_bankptr(machine, "bios_ext3", machine.region("bios")->base() + 0x8000);
673   memory_set_bankptr(machine, "bios_ext4", machine.region("bios")->base() + 0xc000);
674   memory_set_bankptr(machine, "video_bank1", machine.region("video_bios")->base() + 0);
675   memory_set_bankptr(machine, "video_bank2", machine.region("video_bios")->base() + 0x4000);
669   machine.root_device().membank("bios_bank")->set_base(machine.root_device().memregion("bios")->base() + 0x10000);
670   machine.root_device().membank("bios_ext1")->set_base(machine.root_device().memregion("bios")->base() + 0);
671   machine.root_device().membank("bios_ext2")->set_base(machine.root_device().memregion("bios")->base() + 0x4000);
672   machine.root_device().membank("bios_ext3")->set_base(machine.root_device().memregion("bios")->base() + 0x8000);
673   machine.root_device().membank("bios_ext4")->set_base(machine.root_device().memregion("bios")->base() + 0xc000);
674   machine.root_device().membank("video_bank1")->set_base(machine.root_device().memregion("video_bios")->base() + 0);
675   machine.root_device().membank("video_bank2")->set_base(machine.root_device().memregion("video_bios")->base() + 0x4000);
676676}
677677
678678
src/mame/drivers/galpanic.c
r14976r14977
170170
171171   if (ACCESSING_BITS_8_15)
172172   {
173      UINT8 *rom = machine().region("oki")->base();
173      UINT8 *rom = memregion("oki")->base();
174174
175175      memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000);
176176
r14976r14977
183183{
184184   if (ACCESSING_BITS_8_15)
185185   {
186      UINT8 *rom = machine().region("oki")->base();
186      UINT8 *rom = memregion("oki")->base();
187187
188188      memcpy(&rom[0x30000],&rom[0x40000 + ((data >> 8) & 0x0f) * 0x10000],0x10000);
189189   }
src/mame/drivers/speedspn.c
r14976r14977
6565{
6666   /* is this weird banking some form of protection? */
6767
68   UINT8 *rom = machine().region("maincpu")->base();
68   UINT8 *rom = memregion("maincpu")->base();
6969   int addr;
7070
7171   switch (data)
r14976r14977
8585         break;
8686   }
8787
88   memory_set_bankptr(machine(), "bank1",&rom[addr + 0x8000]);
88   membank("bank1")->set_base(&rom[addr + 0x8000]);
8989}
9090
9191/*** SOUND RELATED ***********************************************************/
src/mame/drivers/enigma2.c
r14976r14977
208208   pen_t pens[NUM_PENS];
209209
210210   const rectangle &visarea = screen.visible_area();
211   UINT8 *prom = screen.machine().region("proms")->base();
211   UINT8 *prom = state->memregion("proms")->base();
212212   UINT8 *color_map_base = state->m_flip_screen ? &prom[0x0400] : &prom[0x0000];
213213   UINT8 *star_map_base = (state->m_blink_count & 0x08) ? &prom[0x0c00] : &prom[0x0800];
214214
r14976r14977
707707static DRIVER_INIT(enigma2)
708708{
709709   offs_t i;
710   UINT8 *rom = machine.region("audiocpu")->base();
710   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
711711
712712   for(i = 0; i < 0x2000; i++)
713713   {
src/mame/drivers/videopkr.c
r14976r14977
400400
401401static PALETTE_INIT( videopkr )
402402{
403   const UINT8 *color_prom = machine.region("proms")->base();
403   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
404404   int j;
405405
406406   for (j = 0; j < machine.total_colors(); j++)
r14976r14977
427427
428428static PALETTE_INIT( babypkr )
429429{
430   const UINT8 *color_prom = machine.region("proms")->base();
430   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
431431   int j;
432432
433433   for (j = 0; j < machine.total_colors(); j++)
r14976r14977
458458
459459static PALETTE_INIT( fortune1 )
460460{
461   const UINT8 *color_prom = machine.region("proms")->base();
461   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
462462   int j;
463463
464464   for (j = 0; j < machine.total_colors(); j++)
src/mame/drivers/igspoker.c
r14976r14977
343343
344344READ8_MEMBER(igspoker_state::exp_rom_r)
345345{
346   UINT8 *rom = machine().region("maincpu")->base();
346   UINT8 *rom = memregion("maincpu")->base();
347347   return rom[offset+0x10000];
348348}
349349
r14976r14977
19191919static DRIVER_INIT( cpoker )
19201920{
19211921   int A;
1922   UINT8 *rom = machine.region("maincpu")->base();
1922   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
19231923
19241924
19251925   for (A = 0;A < 0x10000;A++)
r14976r14977
19331933
19341934static DRIVER_INIT( cpokert )
19351935{
1936   UINT8 *rom = machine.region("maincpu")->base();
1936   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
19371937   int i;
19381938
19391939   /* decrypt the program ROM */
r14976r14977
19631963static DRIVER_INIT( cska )
19641964{
19651965   int A;
1966   UINT8 *rom = machine.region("maincpu")->base();
1966   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
19671967
19681968
19691969   for (A = 0;A < 0x10000;A++)
r14976r14977
19801980static DRIVER_INIT( igs_ncs )
19811981{
19821982   int A;
1983   UINT8 *rom = machine.region("maincpu")->base();
1983   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
19841984
19851985
19861986   for (A = 0;A < 0x10000;A++)
r14976r14977
21412141
21422142static DRIVER_INIT( igs_ncs2 )
21432143{
2144   UINT8 *src = (UINT8 *) (machine.region("maincpu")->base());
2144   UINT8 *src = (UINT8 *) (machine.root_device().memregion("maincpu")->base());
21452145   int i;
21462146
21472147   for(i = 0; i < 0x10000; i++)
r14976r14977
22182218   int length;
22192219   UINT8 *rom;
22202220
2221   rom = machine.region("maincpu")->base();
2222   length = machine.region("maincpu")->bytes();
2221   rom = machine.root_device().memregion("maincpu")->base();
2222   length = machine.root_device().memregion("maincpu")->bytes();
22232223   for (A = 0;A < length;A++)
22242224   {
22252225      if ((A & 0x09C0) == 0x0880) rom[A] ^= 0x20;
r14976r14977
22822282   UINT8 *tmp;
22832283   UINT8 *rom;
22842284
2285   rom = machine.region("maincpu")->base();
2286   length = machine.region("maincpu")->bytes();
2285   rom = machine.root_device().memregion("maincpu")->base();
2286   length = machine.root_device().memregion("maincpu")->bytes();
22872287   for (A = 0;A < length;A++)
22882288   {
22892289      if ((A & 0x09C0) == 0x0880) rom[A] ^= 0x20;
r14976r14977
23122312   rom[0xeed] = 0xc3;
23132313
23142314   /* Descramble graphic */
2315   rom = machine.region("gfx1")->base();
2316   length = machine.region("gfx1")->bytes();
2315   rom = machine.root_device().memregion("gfx1")->base();
2316   length = machine.root_device().memregion("gfx1")->bytes();
23172317   tmp = auto_alloc_array(machine, UINT8, length);
23182318   memcpy(tmp,rom,length);
23192319   for (A = 0;A < length;A++)
r14976r14977
23612361static DRIVER_INIT( cpokerpk )
23622362{
23632363   int A;
2364   UINT8 *rom = machine.region("maincpu")->base();
2364   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
23652365
23662366   for (A=0x0714; A < 0xF000; A+=0x1000)
23672367      rom[A] ^= 0x20;
r14976r14977
24152415static DRIVER_INIT( pktet346 )
24162416{
24172417   int A;
2418   UINT8 *rom = machine.region("maincpu")->base();
2418   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
24192419
24202420
24212421   for (A = 0;A < 0x10000;A++)
src/mame/drivers/segaorun.c
r14976r14977
21262126   state->m_custom_io_w = outrun_custom_io_w;
21272127
21282128   /* main CPU: swap bits 11,12 and 6,7 */
2129   word = (UINT16 *)machine.region("maincpu")->base();
2130   length = machine.region("maincpu")->bytes() / 2;
2129   word = (UINT16 *)machine.root_device().memregion("maincpu")->base();
2130   length = machine.root_device().memregion("maincpu")->bytes() / 2;
21312131   for (i = 0; i < length; i++)
21322132      word[i] = BITSWAP16(word[i], 15,14,11,12,13,10,9,8,6,7,5,4,3,2,1,0);
21332133
21342134   /* sub CPU: swap bits 14,15 and 2,3 */
2135   word = (UINT16 *)machine.region("sub")->base();
2136   length = machine.region("sub")->bytes() / 2;
2135   word = (UINT16 *)machine.root_device().memregion("sub")->base();
2136   length = machine.root_device().memregion("sub")->bytes() / 2;
21372137   for (i = 0; i < length; i++)
21382138      word[i] = BITSWAP16(word[i], 14,15,13,12,11,10,9,8,7,6,5,4,2,3,1,0);
21392139
21402140   /* road gfx */
21412141   /* rom a-2.bin: swap bits 6,7 */
21422142   /* rom a-3.bin: swap bits 5,6 */
2143   byte = machine.region("gfx3")->base();
2144   length = machine.region("gfx3")->bytes() / 2;
2143   byte = machine.root_device().memregion("gfx3")->base();
2144   length = machine.root_device().memregion("gfx3")->bytes() / 2;
21452145   for (i = 0; i < length; i++)
21462146   {
21472147      byte[i]        = BITSWAP8(byte[i],        6,7,5,4,3,2,1,0);
r14976r14977
21492149   }
21502150
21512151   /* Z80 code: swap bits 5,6 */
2152   byte = machine.region("soundcpu")->base();
2153   length = machine.region("soundcpu")->bytes();
2152   byte = machine.root_device().memregion("soundcpu")->base();
2153   length = machine.root_device().memregion("soundcpu")->bytes();
21542154   for (i = 0; i < length; i++)
21552155      byte[i] = BITSWAP8(byte[i], 7,5,6,4,3,2,1,0);
21562156}
src/mame/drivers/koikoi.c
r14976r14977
8787
8888static PALETTE_INIT( koikoi )
8989{
90   const UINT8 *color_prom = machine.region("proms")->base();
90   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9191   int i;
9292
9393   /* allocate the colortable */
src/mame/drivers/gticlub.c
r14976r14977
11651165
11661166   state->m_sharc_dataram_0 = auto_alloc_array(machine, UINT32, 0x100000/4);
11671167
1168   K001005_preprocess_texture_data(machine.region("gfx1")->base(), machine.region("gfx1")->bytes(), 1);
1168   K001005_preprocess_texture_data(machine.root_device().memregion("gfx1")->base(), state->memregion("gfx1")->bytes(), 1);
11691169}
11701170
11711171static DRIVER_INIT(hangplt)
r14976r14977
11731173   gticlub_state *state = machine.driver_data<gticlub_state>();
11741174
11751175   init_konami_cgboard(machine, 2, CGBOARD_TYPE_HANGPLT);
1176   set_cgboard_texture_bank(machine, 0, "bank5", machine.region("user5")->base());
1177   set_cgboard_texture_bank(machine, 1, "bank6", machine.region("user5")->base());
1176   set_cgboard_texture_bank(machine, 0, "bank5", machine.root_device().memregion("user5")->base());
1177   set_cgboard_texture_bank(machine, 1, "bank6", state->memregion("user5")->base());
11781178
11791179   state->m_sharc_dataram_0 = auto_alloc_array(machine, UINT32, 0x100000/4);
11801180   state->m_sharc_dataram_1 = auto_alloc_array(machine, UINT32, 0x100000/4);
src/mame/drivers/mazerbla.c
r14976r14977
361361{
362362   m_gfx_rom_bank = data;
363363
364   memory_set_bankptr(machine(),  "bank1", machine().region("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
364   membank("bank1")->set_base(machine().root_device().memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
365365}
366366
367367WRITE8_MEMBER(mazerbla_state::cfb_rom_bank_sel_w_gg)/* great guns */
368368{
369369   m_gfx_rom_bank = data >> 1;
370370
371   memory_set_bankptr(machine(),  "bank1", machine().region("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
371   membank("bank1")->set_base(machine().root_device().memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
372372}
373373
374374
r14976r14977
411411
412412READ8_MEMBER(mazerbla_state::vcu_set_gfx_addr_r)
413413{
414   UINT8 * rom = machine().region("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000;
414   UINT8 * rom = memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000;
415415   int offs;
416416   int x, y;
417417   int bits = 0;
r14976r14977
557557
558558READ8_MEMBER(mazerbla_state::vcu_set_clr_addr_r)
559559{
560   UINT8 * rom = machine().region("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000;
560   UINT8 * rom = memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000;
561561   int offs;
562562   int x, y;
563563   int bits = 0;
r14976r14977
17131713static DRIVER_INIT( greatgun )
17141714{
17151715   mazerbla_state *state = machine.driver_data<mazerbla_state>();
1716   UINT8 *rom = machine.region("sub2")->base();
1716   UINT8 *rom = state->memregion("sub2")->base();
17171717
17181718   state->m_game_id = GREATGUN;
17191719
src/mame/drivers/namcona1.c
r14976r14977
10671067static void init_namcona1( running_machine &machine, int gametype )
10681068{
10691069   namcona1_state *state = machine.driver_data<namcona1_state>();
1070   UINT16 *pMem = (UINT16 *)machine.region( "maincpu" )->base();
1070   UINT16 *pMem = (UINT16 *)state->memregion( "maincpu" )->base();
10711071
10721072   state->m_gametype = gametype;
10731073   state->m_mpBank0 = &pMem[0x80000/2];
src/mame/drivers/armedf.c
r14976r14977
20852085#if LEGION_HACK
20862086   /* This is a hack to allow you to use the extra features
20872087         of 3 of the "Unused" Dip Switches (see notes above). */
2088   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
2088   UINT16 *RAM = (UINT16 *)state->memregion("maincpu")->base();
20892089   RAM[0x0001d6 / 2] = 0x0001;
20902090   /* To avoid checksum error */
20912091   RAM[0x000488 / 2] = 0x4e71;
r14976r14977
21022102#if LEGION_HACK
21032103   /* This is a hack to allow you to use the extra features
21042104         of 3 of the "Unused" Dip Switches (see notes above). */
2105   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
2105   UINT16 *RAM = (UINT16 *)state->memregion("maincpu")->base();
21062106   RAM[0x0001d6/2] = 0x0001;
21072107   /* No need to patch the checksum routine (see notes) ! */
21082108#endif
src/mame/drivers/cdi.c
r14976r14977
199199static MACHINE_RESET( cdi )
200200{
201201    cdi_state *state = machine.driver_data<cdi_state>();
202    UINT16 *src   = (UINT16*)machine.region("maincpu")->base();
202    UINT16 *src   = (UINT16*)state->memregion("maincpu")->base();
203203    UINT16 *dst   = state->m_planea;
204204    //device_t *cdrom_dev = machine.device("cdrom");
205205    memcpy(dst, src, 0x8);
src/mame/drivers/itgambl3.c
r14976r14977
7474{
7575   itgambl3_state *state = screen.machine().driver_data<itgambl3_state>();
7676   int x,y,count;
77   const UINT8 *blit_ram = screen.machine().region("gfx1")->base();
77   const UINT8 *blit_ram = state->memregion("gfx1")->base();
7878
7979   if(screen.machine().input().code_pressed(KEYCODE_Z))
8080      state->m_test_x++;
src/mame/drivers/dkong.c
r14976r14977
424424static MACHINE_START( s2650 )
425425{
426426    dkong_state *state = machine.driver_data<dkong_state>();
427    UINT8   *p = machine.region("user1")->base();
427    UINT8   *p = state->memregion("user1")->base();
428428    const char *game_name = machine.system().name;
429429    int i;
430430
r14976r14977
487487static MACHINE_RESET( strtheat )
488488{
489489    dkong_state *state = machine.driver_data<dkong_state>();
490    UINT8 *ROM = machine.region("maincpu")->base();
490    UINT8 *ROM = state->memregion("maincpu")->base();
491491
492492    MACHINE_RESET_CALL(dkong);
493493
494494    /* The initial state of the counter is 0x08 */
495    memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
495    state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
496496    state->m_decrypt_counter = 0x08;
497    memory_set_bank(machine, "bank1", 0);
497    state->membank("bank1")->set_entry(0);
498498}
499499
500500static MACHINE_RESET( drakton )
501501{
502502    dkong_state *state = machine.driver_data<dkong_state>();
503    UINT8 *ROM = machine.region("maincpu")->base();
503    UINT8 *ROM = state->memregion("maincpu")->base();
504504
505505    MACHINE_RESET_CALL(dkong);
506506
507507    /* The initial state of the counter is 0x09 */
508    memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
508    state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
509509    state->m_decrypt_counter = 0x09;
510    memory_set_bank(machine, "bank1", 1);
510    state->membank("bank1")->set_entry(1);
511511}
512512
513513
r14976r14977
627627
628628    switch(m_decrypt_counter)
629629    {
630        case 0x08:  memory_set_bank(machine(), "bank1", 0);      break;
631        case 0x09:  memory_set_bank(machine(), "bank1", 1);      break;
632        case 0x0A:  memory_set_bank(machine(), "bank1", 2);      break;
633        case 0x0B:  memory_set_bank(machine(), "bank1", 3);      break;
630        case 0x08:  membank("bank1")->set_entry(0);      break;
631        case 0x09:  membank("bank1")->set_entry(1);      break;
632        case 0x0A:  membank("bank1")->set_entry(2);      break;
633        case 0x0B:  membank("bank1")->set_entry(3);      break;
634634        default:
635635            logerror("Invalid counter = %02X\n",m_decrypt_counter);
636636            break;
r14976r14977
16181618
16191619WRITE8_MEMBER(dkong_state::braze_a15_w)
16201620{
1621   memory_set_bank(machine(), "bank1", data & 0x01);
1622   memory_set_bank(machine(), "bank2", data & 0x01);
1621   membank("bank1")->set_entry(data & 0x01);
1622   membank("bank2")->set_entry(data & 0x01);
16231623}
16241624
16251625static WRITE8_DEVICE_HANDLER( braze_eeprom_w )
r14976r14977
16371637   UINT32 mem;
16381638   UINT32 newmem;
16391639
1640   ROM = machine.region("braze")->base();
1640   ROM = machine.root_device().memregion("braze")->base();
16411641
16421642   for (mem=0;mem<0x10000;mem++)
16431643   {
r14976r14977
30653065    UINT8 *ROM;
30663066    int mem;
30673067
3068    ROM = machine.region("maincpu")->base();
3068    ROM = machine.root_device().memregion("maincpu")->base();
30693069
30703070    for (mem=0;mem<0x4000;mem++)
30713071    {
r14976r14977
30913091static DRIVER_INIT( herodk )
30923092{
30933093    int A;
3094    UINT8 *rom = machine.region("maincpu")->base();
3094    UINT8 *rom = machine.root_device().memregion("maincpu")->base();
30953095
30963096    /* swap data lines D3 and D4 */
30973097    for (A = 0;A < 0x8000;A++)
r14976r14977
31743174
31753175   braze_decrypt_rom(machine, decrypted);
31763176
3177   memory_configure_bank(machine,"bank1", 0, 2, &decrypted[0], 0x8000);
3178   memory_set_bank(machine,"bank1", 0);
3179   memory_configure_bank(machine,"bank2", 0, 2, &decrypted[0], 0x8000);
3180   memory_set_bank(machine,"bank2", 0);
3177   state->membank("bank1")->configure_entries(0, 2, &decrypted[0], 0x8000);
3178   state->membank("bank1")->set_entry(0);
3179   state->membank("bank2")->configure_entries(0, 2, &decrypted[0], 0x8000);
3180   state->membank("bank2")->set_entry(0);
31813181}
31823182
31833183static DRIVER_INIT( dkingjr )
31843184{
3185   UINT8 *prom = machine.region("proms")->base();
3185   UINT8 *prom = machine.root_device().memregion("proms")->base();
31863186   for( int i=0; i<0x200; ++i)
31873187   {
31883188      prom[i]^=0xff; // invert color data
src/mame/drivers/acefruit.c
r14976r14977
604604
605605static DRIVER_INIT( sidewndr )
606606{
607   UINT8 *ROM = machine.region( "maincpu" )->base();
607   UINT8 *ROM = machine.root_device().memregion( "maincpu" )->base();
608608   /* replace "ret nc" ( 0xd0 ) with "di" */
609609   ROM[ 0 ] = 0xf3;
610610   /* this is either a bad dump or the cpu core should set the carry flag on reset */
src/mame/drivers/appoooh.c
r14976r14977
177177   {
178178      if (state->m_adpcm_data == 0xffffffff)
179179      {
180         UINT8 *RAM = device->machine().region("adpcm")->base();
180         UINT8 *RAM = state->memregion("adpcm")->base();
181181
182182         state->m_adpcm_data = RAM[state->m_adpcm_address++];
183183         msm5205_data_w(device, state->m_adpcm_data >> 4);
r14976r14977
604604static DRIVER_INIT(robowresb)
605605{
606606   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
607   space->set_decrypted_region(0x0000, 0x7fff, machine.region("maincpu")->base() + 0x1c000);
607   space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x1c000);
608608}
609609
610610
src/mame/drivers/travrusa.c
r14976r14977
453453static DRIVER_INIT( motorace )
454454{
455455   int A, j;
456   UINT8 *rom = machine.region("maincpu")->base();
456   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
457457   UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x2000);
458458
459459   memcpy(buffer, rom, 0x2000);
r14976r14977
471471static DRIVER_INIT( shtridra )
472472{
473473   int A;
474   UINT8 *rom = machine.region("maincpu")->base();
474   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
475475
476476   /* D3/D4  and  D5/D6 swapped */
477477   for (A = 0; A < 0x2000; A++)
src/mame/drivers/goldstar.c
r14976r14977
59465946   for (i = 0; i < 0x100; i++)
59475947   {
59485948      UINT8 data;
5949      UINT8*proms = machine.region("proms")->base();
5949      UINT8*proms = machine.root_device().memregion("proms")->base();
59505950
59515951      data = proms[0x000 + i] | (proms[0x100 + i] << 4);
59525952
r14976r14977
59615961   {
59625962      int r,g,b;
59635963
5964      UINT8*proms = machine.region("proms")->base();
5964      UINT8*proms = machine.root_device().memregion("proms")->base();
59655965
59665966      b = proms[0x000 + i] << 4;
59675967      g = proms[0x100 + i] << 4;
r14976r14977
59795979   UINT8 data;
59805980   UINT8 *proms;
59815981
5982   proms = machine.region("proms")->base();
5982   proms = machine.root_device().memregion("proms")->base();
59835983   for (i = 0; i < 0x100; i++)
59845984   {
59855985
r14976r14977
59885988      palette_set_color_rgb(machine, i, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
59895989   }
59905990
5991   proms = machine.region("proms2")->base();
5991   proms = machine.root_device().memregion("proms2")->base();
59925992   for (i=0; i < 0x20; i++)
59935993   {
59945994      data = proms[i];
r14976r14977
63616361   {
63626362      int r,g,b;
63636363
6364      UINT8*proms = machine.region("proms")->base();
6364      UINT8*proms = machine.root_device().memregion("proms")->base();
63656365
63666366      b = proms[0x000 + i] << 4;
63676367      g = proms[0x100 + i] << 4;
r14976r14977
84338433static DRIVER_INIT(magoddsc)
84348434{
84358435   int A;
8436   UINT8 *ROM = machine.region("maincpu")->base();
8436   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
84378437
84388438   for (A = 0;A < 0x8000;A++)
84398439   {
r14976r14977
1005810058static DRIVER_INIT(goldstar)
1005910059{
1006010060   int A;
10061   UINT8 *ROM = machine.region("maincpu")->base();
10061   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1006210062
1006310063   for (A = 0;A < 0x10000;A++)
1006410064   {
r14976r14977
1014310143
1014410144static DRIVER_INIT( chry10 )
1014510145{
10146   UINT8 *ROM = machine.region("maincpu")->base();
10147   int size = machine.region("maincpu")->bytes();
10146   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
10147   int size = machine.root_device().memregion("maincpu")->bytes();
1014810148   int start = 0;
1014910149
1015010150   int i;
r14976r14977
1016710167
1016810168static DRIVER_INIT( cb3 )
1016910169{
10170   UINT8 *ROM = machine.region("maincpu")->base();
10171   int size = machine.region("maincpu")->bytes();
10170   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
10171   int size = machine.root_device().memregion("maincpu")->bytes();
1017210172   int start = 0;
1017310173
1017410174   int i;
r14976r14977
1018610186static DRIVER_INIT( chrygld )
1018710187{
1018810188   int A;
10189   UINT8 *ROM = machine.region("maincpu")->base();
10189   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1019010190   do_blockswaps(machine, ROM);
1019110191
1019210192   // a data bitswap
r14976r14977
1020210202
1020310203static DRIVER_INIT(cm)
1020410204{
10205   UINT8 *ROM = machine.region("maincpu")->base();
10205   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1020610206
1020710207/*  forcing PPI mode 0 for all, and A, B & C as input.
1020810208    the mixed modes 2-0 are not working properly.
r14976r14977
1021310213
1021410214static DRIVER_INIT(cmv4)
1021510215{
10216   UINT8 *ROM = machine.region("maincpu")->base();
10216   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1021710217
1021810218/*  forcing PPI mode 0 for all, and A, B & C as input.
1021910219    the mixed modes 2-0 are not working properly.
r14976r14977
1022410224
1022510225static DRIVER_INIT(cmast91)
1022610226{
10227   UINT8 *ROM = machine.region("maincpu")->base();
10227   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1022810228
1022910229/*  forcing PPI mode 0 for all, and A, B & C as input.
1023010230    the mixed modes 2-0 are not working properly.
r14976r14977
1023510235
1023610236static DRIVER_INIT(lucky8a)
1023710237{
10238   UINT8 *ROM = machine.region("maincpu")->base();
10238   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1023910239
1024010240   ROM[0x0010] = 0x21;
1024110241}
r14976r14977
1024310243static DRIVER_INIT( nfb96sea )
1024410244{
1024510245   int i;
10246   UINT8 *ROM = machine.region("maincpu")->base();
10246   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1024710247
1024810248   for (i = 0;i < 0x10000;i++)
1024910249   {
r14976r14977
1027610276static DRIVER_INIT( schery97 )
1027710277{
1027810278   int i;
10279   UINT8 *ROM = machine.region("maincpu")->base();
10279   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1028010280   for (i = 0;i < 0x10000;i++)
1028110281   {
1028210282      UINT8 x = ROM[i];
r14976r14977
1030410304static DRIVER_INIT( schery97a )
1030510305{
1030610306   int i;
10307   UINT8 *ROM = machine.region("maincpu")->base();
10307   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1030810308   for (i = 0;i < 0x10000;i++)
1030910309   {
1031010310      UINT8 x = ROM[i];
r14976r14977
1033310333static DRIVER_INIT( skill98 )
1033410334{
1033510335   int i;
10336   UINT8 *ROM = machine.region("maincpu")->base();
10336   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1033710337   for (i = 0;i < 0x10000;i++)
1033810338   {
1033910339      UINT8 x = ROM[i];
r14976r14977
1036010360static DRIVER_INIT( nfb96_c1 )
1036110361{
1036210362   int i;
10363   UINT8 *ROM = machine.region("maincpu")->base();
10363   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1036410364   for (i = 0;i < 0x10000;i++)
1036510365   {
1036610366      UINT8 x = ROM[i];
r14976r14977
1038710387static DRIVER_INIT( nfb96_c2 )
1038810388{
1038910389   int i;
10390   UINT8 *ROM = machine.region("maincpu")->base();
10390   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1039110391   for (i = 0;i < 0x10000;i++)
1039210392   {
1039310393      UINT8 x = ROM[i];
r14976r14977
1042410424static DRIVER_INIT( nfb96_d )
1042510425{
1042610426   int i;
10427   UINT8 *ROM = machine.region("maincpu")->base();
10427   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1042810428   for (i = 0;i < 0x10000;i++)
1042910429   {
1043010430      UINT8 x = ROM[i];
r14976r14977
1045710457static DRIVER_INIT( nfb96_dk )
1045810458{
1045910459   int i;
10460   UINT8 *ROM = machine.region("maincpu")->base();
10460   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1046110461   for (i = 0;i < 0x10000;i++)
1046210462   {
1046310463      UINT8 x = ROM[i];
r14976r14977
1048910489static DRIVER_INIT( rp35 )
1049010490{
1049110491   int i;
10492   UINT8 *ROM = machine.region("maincpu")->base();
10492   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1049310493   for (i = 0;i < 0x10000;i++)
1049410494   {
1049510495      UINT8 x = ROM[i];
r14976r14977
1051710517static DRIVER_INIT( rp36 )
1051810518{
1051910519   int i;
10520   UINT8 *ROM = machine.region("maincpu")->base();
10520   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1052110521   for (i = 0;i < 0x10000;i++)
1052210522   {
1052310523      UINT8 x = ROM[i];
r14976r14977
1054510545static DRIVER_INIT( rp36c3 )
1054610546{
1054710547   int i;
10548   UINT8 *ROM = machine.region("maincpu")->base();
10548   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1054910549   for (i = 0;i < 0x10000;i++)
1055010550   {
1055110551      UINT8 x = ROM[i];
r14976r14977
1057910579static DRIVER_INIT( po33 )
1058010580{
1058110581   int i;
10582   UINT8 *ROM = machine.region("maincpu")->base();
10582   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1058310583   for (i = 0;i < 0x10000;i++)
1058410584   {
1058510585      UINT8 x = ROM[i];
r14976r14977
1061310613static DRIVER_INIT( match133 )
1061410614{
1061510615   int i;
10616   UINT8 *ROM = machine.region("maincpu")->base();
10616   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1061710617   for (i = 0;i < 0x10000;i++)
1061810618   {
1061910619      UINT8 x = ROM[i];
r14976r14977
1063710637static DRIVER_INIT(cherrys)
1063810638{
1063910639   int i;
10640   UINT8 *ROM = machine.region("maincpu")->base();
10640   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1064110641
1064210642   unsigned char rawData[256] = {
1064310643      0xCC, 0xCD, 0xCE, 0xCF, 0xC8, 0xC9, 0xCA, 0xCB, 0xC4, 0xC5, 0xC6, 0xC7,
r14976r14977
1067410674/* todo: remove these patches! */
1067510675static DRIVER_INIT( unkch1 )
1067610676{
10677   UINT8 *ROM = machine.region("maincpu")->base();
10677   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1067810678   ROM[0x9d52] = 0x00;
1067910679   ROM[0x9d53] = 0x00;
1068010680}
1068110681
1068210682static DRIVER_INIT( unkch3 )
1068310683{
10684   UINT8 *ROM = machine.region("maincpu")->base();
10684   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1068510685   ROM[0x9b86] = 0x00;
1068610686   ROM[0x9b87] = 0x00;
1068710687}
1068810688
1068910689static DRIVER_INIT( unkch4 )
1069010690{
10691   UINT8 *ROM = machine.region("maincpu")->base();
10691   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
1069210692   ROM[0x9a6e] = 0x00;
1069310693   ROM[0x9a6f] = 0x00;
1069410694}
src/mame/drivers/dbz.c
r14976r14977
504504{
505505   UINT16 *ROM;
506506
507   ROM = (UINT16 *)machine.region("maincpu")->base();
507   ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
508508
509509   // nop out dbz1's mask rom test
510510   // tile ROM test
src/mame/drivers/20pacgal.c
r14976r14977
144144   _20pacgal_state *state =  machine.driver_data<_20pacgal_state>();
145145   if (state->m_game_selected == 0)
146146   {
147      UINT8 *rom = machine.region("maincpu")->base();
148      memory_set_bankptr(machine, "bank1", rom + 0x08000);
147      UINT8 *rom = state->memregion("maincpu")->base();
148      state->membank("bank1")->set_base(rom + 0x08000);
149149   }
150150   else
151      memory_set_bankptr(machine, "bank1", state->m_ram_48000);
151      state->membank("bank1")->set_base(state->m_ram_48000);
152152}
153153
154154WRITE8_MEMBER(_20pacgal_state::ram_bank_select_w)
src/mame/drivers/system16.c
r14976r14977
389389
390390WRITE8_MEMBER(segas1x_bootleg_state::tturfbl_soundbank_w)
391391{
392   UINT8 *mem = machine().region("soundcpu")->base();
392   UINT8 *mem = memregion("soundcpu")->base();
393393
394394   switch(data)
395395   {
r14976r14977
460460
461461static WRITE8_DEVICE_HANDLER( upd7759_bank_w ) //*
462462{
463   int offs, size = device->machine().region("soundcpu")->bytes() - 0x10000;
463   int offs, size = device->machine().root_device().memregion("soundcpu")->bytes() - 0x10000;
464464
465465   upd7759_reset_w(device, data & 0x40);
466466   offs = 0x10000 + (data * 0x4000) % size;
467   memory_set_bankptr(device->machine(), "bank1", device->machine().region("soundcpu")->base() + offs);
467   device->machine().root_device().membank("bank1")->set_base(device->machine().root_device().memregion("soundcpu")->base() + offs);
468468}
469469
470470
r14976r14977
10391039
10401040WRITE8_MEMBER(segas1x_bootleg_state::sys18_soundbank_w)
10411041{
1042   UINT8 *mem = machine().region("soundcpu")->base();
1042   UINT8 *mem = memregion("soundcpu")->base();
10431043   int rom = (data >> 6) & 3;
10441044   int bank = (data & 0x3f);
10451045   int mask = m_sound_info[rom * 2 + 0];
r14976r14977
12031203
12041204WRITE8_MEMBER(segas1x_bootleg_state::shdancbl_bankctrl_w)
12051205{
1206   UINT8 *mem = machine().region("soundcpu")->base();
1206   UINT8 *mem = memregion("soundcpu")->base();
12071207
12081208   switch (data)
12091209   {
r14976r14977
33493349{
33503350   segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>();
33513351   int i;
3352   UINT8 *ROM = machine.region("maincpu")->base();
3353   UINT8 *KEY = machine.region("decryption")->base();
3352   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3353   UINT8 *KEY = state->memregion("decryption")->base();
33543354   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
33553355   UINT8 data[0x1000];
33563356
r14976r14977
33933393   // decrypt
33943394   DRIVER_INIT_CALL( goldnaxeb1 );
33953395
3396   ROM2 = (UINT16*)machine.region("maincpu")->base();
3396   ROM2 = (UINT16*)state->memregion("maincpu")->base();
33973397   decrypted_region2 = (UINT16*)state->m_decrypted_region;
33983398
33993399   // patch interrupt vector
r14976r14977
34083408
34093409static DRIVER_INIT( bayrouteb2 )
34103410{
3411   UINT8 *mem = machine.region("soundcpu")->base();
3411   UINT8 *mem = machine.root_device().memregion("soundcpu")->base();
34123412
34133413   memcpy(mem, mem + 0x10000, 0x8000);
34143414
r14976r14977
34263426
34273427static DRIVER_INIT( tturfbl )
34283428{
3429   UINT8 *mem = machine.region("soundcpu")->base();
3429   UINT8 *mem = machine.root_device().memregion("soundcpu")->base();
34303430
34313431   memcpy(mem, mem + 0x10000, 0x8000);
34323432
r14976r14977
34623462/* Tetris-based */
34633463static DRIVER_INIT( beautyb )
34643464{
3465   UINT16*rom = (UINT16*)machine.region( "maincpu" )->base();
3465   UINT16*rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base();
34663466   int x;
34673467
34683468   for (x = 0; x < 0x8000; x++)
r14976r14977
34813481static DRIVER_INIT( shdancbl )
34823482{
34833483   segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>();
3484   UINT8 *mem = machine.region("soundcpu")->base();;
3484   UINT8 *mem = state->memregion("soundcpu")->base();;
34853485
34863486   /* Copy first 32K of IC45 to Z80 address space */
34873487   memcpy(mem, mem + 0x10000, 0x8000);
r14976r14977
34963496static DRIVER_INIT( mwalkbl )
34973497{
34983498   segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>();
3499   UINT8 *RAM =  machine.region("soundcpu")->base();
3499   UINT8 *RAM =  state->memregion("soundcpu")->base();
35003500   static const int mwalk_sound_info[]  =
35013501   {
35023502      0x0f, 0x00000, // ROM #1 = 128K
r14976r14977
35183518static DRIVER_INIT( astormbl )
35193519{
35203520   segas1x_bootleg_state *state = machine.driver_data<segas1x_bootleg_state>();
3521   UINT8 *RAM =  machine.region("soundcpu")->base();
3521   UINT8 *RAM =  state->memregion("soundcpu")->base();
35223522   static const int astormbl_sound_info[]  =
35233523   {
35243524      0x0f, 0x00000, // ROM #1 = 128K
src/mame/drivers/limenko.c
r14976r14977
371371   limenko_state *state = machine.driver_data<limenko_state>();
372372   int i;
373373
374   UINT8 *base_gfx   = machine.region("gfx1")->base();
375   UINT8 *gfx_max   = base_gfx + machine.region("gfx1")->bytes();
374   UINT8 *base_gfx   = machine.root_device().memregion("gfx1")->base();
375   UINT8 *gfx_max   = base_gfx + state->memregion("gfx1")->bytes();
376376
377377   UINT8 *gfxdata;
378378   gfx_element gfx(machine);
r14976r14977
10661066static DRIVER_INIT( spotty )
10671067{
10681068   limenko_state *state = machine.driver_data<limenko_state>();
1069   UINT8 *dst    = machine.region("gfx1")->base();
1070   UINT8 *src    = machine.region("user2")->base();
1069   UINT8 *dst    = machine.root_device().memregion("gfx1")->base();
1070   UINT8 *src    = state->memregion("user2")->base();
10711071   int x;
10721072
10731073   /* expand 4bpp roms to 8bpp space */
src/mame/drivers/pengo.c
r14976r14977
692692   };
693693   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
694694   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
695   UINT8 *rom = machine.region("maincpu")->base();
695   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
696696   int A;
697697
698698   space->set_decrypted_region(0x0000, 0x7fff, decrypt);
src/mame/drivers/whitestar.c
r14976r14977
9898
9999WRITE8_MEMBER(whitestar_state::bank_w)
100100{
101   memory_set_bankptr(machine(), "bank1", machine().region("user1")->base() + (data & 0x1f) * 0x4000);
101   membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + (data & 0x1f) * 0x4000);
102102}
103103
104104WRITE8_MEMBER(whitestar_state::dmd_bank_w)
105105{
106   memory_set_bankptr(machine(), "dmd_bank1", machine().region("dmdcpu")->base() + (data & 0x1f) * 0x4000);
106   membank("dmd_bank1")->set_base(machine().root_device().memregion("dmdcpu")->base() + (data & 0x1f) * 0x4000);
107107}
108108
109109READ8_MEMBER(whitestar_state::dmd_latch_r)
r14976r14977
170170
171171static MACHINE_RESET( whitestar )
172172{
173   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
174   memory_set_bankptr(machine, "dmd_bank1", machine.region("dmdcpu")->base());
173   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("user1")->base());
174   machine.root_device().membank("dmd_bank1")->set_base(machine.root_device().memregion("dmdcpu")->base());
175175}
176176
177177static DRIVER_INIT( whitestar )
src/mame/drivers/simpsons.c
r14976r14977
108108
109109WRITE8_MEMBER(simpsons_state::z80_bankswitch_w)
110110{
111   memory_set_bank(machine(), "bank2", data & 7);
111   membank("bank2")->set_entry(data & 7);
112112}
113113
114114#if 0
src/mame/drivers/bfm_sc4.c
r14976r14977
6363   // search for the title
6464   const int strlength = 14;
6565   char title_string[] = "PROJECT NUMBER";
66   UINT8 *src = machine.region( "maincpu" )->base();
67   int size = machine.region( "maincpu" )->bytes();
66   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
67   int size = machine.root_device().memregion( "maincpu" )->bytes();
6868
6969   int search_start = 0;
7070   int search_step = 1;
r14976r14977
194194
195195DRIVER_INIT( sc4 )
196196{
197   UINT8 *src = machine.region( "maincpu" )->base();
197   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
198198   // SC4 identification sequence 0x80 0x00 0xf0 0x7d
199199   if (((src[0] == 0x80) && (src[2] == 0xf0)) || ((src[1] == 0x00) && (src[3] == 0x7d)))
200200   {
r14976r14977
233233{
234234   DRIVER_INIT_CALL( sc4 );
235235   sc4_state *state = machine.driver_data<sc4_state>();
236   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
236   UINT16 *rom = (UINT16 *)state->memregion("maincpu")->base();
237237   find_mbus(state, rom);
238238}
239239
src/mame/drivers/model1.c
r14976r14977
664664   if(ACCESSING_BITS_0_7) {
665665      switch(data & 0xf) {
666666      case 0x1: // 100000-1fffff data roms banking
667         memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x1000000 + 0x100000*((data >> 4) & 0xf));
667         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1000000 + 0x100000*((data >> 4) & 0xf));
668668         logerror("BANK %x\n", 0x1000000 + 0x100000*((data >> 4) & 0xf));
669669         break;
670670      case 0x2: // 200000-2fffff data roms banking (unused, all known games have only one bank)
r14976r14977
735735static MACHINE_RESET(model1)
736736{
737737   model1_state *state = machine.driver_data<model1_state>();
738   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x1000000);
738   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x1000000);
739739   irq_init(machine);
740740   model1_tgp_reset(machine, !strcmp(machine.system().name, "swa") || !strcmp(machine.system().name, "wingwar") || !strcmp(machine.system().name, "wingwaru") || !strcmp(machine.system().name, "wingwarj"));
741741   if (!strcmp(machine.system().name, "swa"))
r14976r14977
755755static MACHINE_RESET(model1_vr)
756756{
757757   model1_state *state = machine.driver_data<model1_state>();
758   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x1000000);
758   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x1000000);
759759   irq_init(machine);
760760   model1_vr_tgp_reset(machine);
761761   state->m_sound_irq = 3;
src/mame/drivers/polepos.c
r14976r14977
378378
379379static READ8_DEVICE_HANDLER( namco_52xx_rom_r )
380380{
381   UINT32 length = device->machine().region("52xx")->bytes();
381   UINT32 length = device->machine().root_device().memregion("52xx")->bytes();
382382logerror("ROM @ %04X\n", offset);
383   return (offset < length) ? device->machine().region("52xx")->base()[offset] : 0xff;
383   return (offset < length) ? device->machine().root_device().memregion("52xx")->base()[offset] : 0xff;
384384}
385385
386386static READ8_DEVICE_HANDLER( namco_52xx_si_r )
src/mame/drivers/tank8.c
r14976r14977
464464
465465static DRIVER_INIT( decode )
466466{
467   const UINT8* DECODE = machine.region("user1")->base();
467   const UINT8* DECODE = machine.root_device().memregion("user1")->base();
468468
469   UINT8* p1 = machine.region("maincpu")->base() + 0x00000;
470   UINT8* p2 = machine.region("maincpu")->base() + 0x10000;
469   UINT8* p1 = machine.root_device().memregion("maincpu")->base() + 0x00000;
470   UINT8* p2 = machine.root_device().memregion("maincpu")->base() + 0x10000;
471471
472472   int i;
473473
src/mame/drivers/galgame.c
r14976r14977
397397static DRIVER_INIT(galaxygame)
398398{
399399   address_space *main = machine.device("maincpu")->memory().space(AS_PROGRAM);
400   UINT8 *code = machine.region("code")->base();
400   UINT8 *code = machine.root_device().memregion("code")->base();
401401
402402   int filepos = 0, linepos, linelen;
403403   UINT8 line[256];
src/mame/drivers/poo.c
r14976r14977
291291
292292static PALETTE_INIT( unclepoo )
293293{
294   const UINT8 *color_prom = machine.region("proms")->base();
294   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
295295   int i,r,g,b,val;
296296   int bit0,bit1,bit2;
297297
src/mame/drivers/qdrmfgp.c
r14976r14977
119119READ16_MEMBER(qdrmfgp_state::v_rom_r)
120120{
121121   device_t *k056832 = machine().device("k056832");
122   UINT8 *mem8 = machine().region("gfx1")->base();
122   UINT8 *mem8 = memregion("gfx1")->base();
123123   int bank = k056832_word_r(k056832, 0x34/2, 0xffff);
124124
125125   offset += bank * 0x800 * 4;
r14976r14977
650650static MACHINE_RESET( qdrmfgp )
651651{
652652   qdrmfgp_state *state = machine.driver_data<qdrmfgp_state>();
653   state->m_sndram = machine.region("konami")->base() + 0x100000;
653   state->m_sndram = state->memregion("konami")->base() + 0x100000;
654654
655655   /* reset the IDE controller */
656656   state->m_gp2_irq_control = 0;
src/mame/drivers/cps1.c
r14976r14977
281281
282282WRITE8_MEMBER(cps_state::cps1_snd_bankswitch_w)
283283{
284   memory_set_bank(machine(), "bank1", data & 0x01);
284   membank("bank1")->set_entry(data & 0x01);
285285}
286286
287287static WRITE8_DEVICE_HANDLER( cps1_oki_pin7_w )
r14976r14977
348348
349349READ16_MEMBER(cps_state::qsound_rom_r)
350350{
351   UINT8 *rom = machine().region("user1")->base();
351   UINT8 *rom = memregion("user1")->base();
352352
353353   if (rom)
354354      return rom[offset] | 0xff00;
r14976r14977
387387{
388388   /* Z80 bank register for music note data. It's odd that it isn't encrypted though. */
389389   int bank = data & 0x0f;
390   if ((0x10000 + (bank * 0x4000)) >= machine().region("audiocpu")->bytes())
390   if ((0x10000 + (bank * 0x4000)) >= memregion("audiocpu")->bytes())
391391   {
392392      logerror("WARNING: Q sound bank overflow (%02x)\n", data);
393393      bank = 0;
394394   }
395395
396   memory_set_bank(machine(), "bank1", bank);
396   membank("bank1")->set_entry(bank);
397397}
398398
399399
r14976r14977
30403040static MACHINE_START( cps1 )
30413041{
30423042   MACHINE_START_CALL(common);
3043   memory_configure_bank(machine, "bank1", 0, 2, machine.region("audiocpu")->base() + 0x10000, 0x4000);
3043   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
30443044}
30453045
30463046static MACHINE_START( qsound )
30473047{
30483048   MACHINE_START_CALL(common);
3049   memory_configure_bank(machine, "bank1", 0, 6, machine.region("audiocpu")->base() + 0x10000, 0x4000);
3049   machine.root_device().membank("bank1")->configure_entries(0, 6, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
30503050}
30513051
30523052static MACHINE_CONFIG_START( cps1_10MHz, cps_state )
r14976r14977
1077610776
1077710777static DRIVER_INIT( pang3 )
1077810778{
10779   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
10779   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
1078010780   int A, src, dst;
1078110781
1078210782   for (A = 0x80000; A < 0x100000; A += 2)
r14976r14977
1080610806static DRIVER_INIT( sf2mdt )
1080710807{
1080810808   int i;
10809   UINT32 gfx_size = machine.region( "gfx" )->bytes();
10810   UINT8 *rom = machine.region( "gfx" )->base();
10809   UINT32 gfx_size = machine.root_device().memregion( "gfx" )->bytes();
10810   UINT8 *rom = machine.root_device().memregion( "gfx" )->base();
1081110811   UINT8 tmp;
1081210812
1081310813   for( i = 0; i < gfx_size; i += 8 )
src/mame/drivers/yunsun16.c
r14976r14977
106106   if (ACCESSING_BITS_0_7)
107107   {
108108      int bank = data & 3;
109      UINT8 *dst   = machine().region("oki")->base();
109      UINT8 *dst   = memregion("oki")->base();
110110      UINT8 *src   = dst + 0x80000 + 0x20000 * bank;
111111      memcpy(dst + 0x20000, src, 0x20000);
112112   }
src/mame/drivers/wiz.c
r14976r14977
10701070      { 5,7,3, 0x28 }
10711071   };
10721072   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1073   UINT8 *rom = machine.region("maincpu")->base();
1074   int size = machine.region("maincpu")->bytes();
1073   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
1074   int size = machine.root_device().memregion("maincpu")->bytes();
10751075   UINT8 *decrypt = auto_alloc_array(machine, UINT8, size);
10761076   int A;
10771077   const UINT8 *tbl;
src/mame/drivers/calorie.c
r14976r14977
117117static TILE_GET_INFO( get_bg_tile_info )
118118{
119119   calorie_state *state = machine.driver_data<calorie_state>();
120   UINT8 *src = machine.region("user1")->base();
120   UINT8 *src = state->memregion("user1")->base();
121121   int bg_base = (state->m_bg_bank & 0x0f) * 0x200;
122122   int code  = src[bg_base + tile_index] | (((src[bg_base + tile_index + 0x100]) & 0x10) << 4);
123123   int color = src[bg_base + tile_index + 0x100] & 0x0f;
r14976r14977
556556static DRIVER_INIT( calorieb )
557557{
558558   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
559   space->set_decrypted_region(0x0000, 0x7fff, machine.region("maincpu")->base() + 0x10000);
559   space->set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x10000);
560560}
561561
562562
src/mame/drivers/namcos11.c
r14976r14977
617617
618618INLINE void bankswitch_rom8( address_space *space, const char *bank, int n_data )
619619{
620   memory_set_bank( space->machine(), bank, ( ( n_data & 0xc0 ) >> 4 ) + ( n_data & 0x03 ) );
620   space->machine().root_device().membank( bank )->set_entry( ( ( n_data & 0xc0 ) >> 4 ) + ( n_data & 0x03 ) );
621621}
622622
623623static const char * const bankname[] = { "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7", "bank8" };
r14976r14977
656656   namcos11_state *state = space->machine().driver_data<namcos11_state>();
657657
658658   /* todo: verify behaviour */
659   memory_set_bank( space->machine(), bank, ( ( ( ( n_data & 0xc0 ) >> 3 ) + ( n_data & 0x07 ) ) ^ state->m_n_bankoffset ) );
659   state->membank( bank )->set_entry( ( ( ( ( n_data & 0xc0 ) >> 3 ) + ( n_data & 0x07 ) ) ^ state->m_n_bankoffset ) );
660660}
661661
662662WRITE32_MEMBER(namcos11_state::bankswitch_rom64_w)
r14976r14977
877877
878878   // init banks
879879   int bank;
880   UINT32 len = machine.region( "user2" )->bytes();
881   UINT8 *rgn = machine.region( "user2" )->base();
880   UINT32 len = machine.root_device().memregion( "user2" )->bytes();
881   UINT8 *rgn = machine.root_device().memregion( "user2" )->base();
882882
883883   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f000000, 0x1f0fffff, "bank1" );
884884   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f100000, 0x1f1fffff, "bank2" );
r14976r14977
891891
892892   for (bank = 0; bank < 8; bank++)
893893   {
894      memory_configure_bank(machine, bankname[bank], 0, len / ( 1024 * 1024 ), rgn, 1024 * 1024 );
895      memory_set_bank(machine, bankname[bank], 0 );
894      state->membank(bankname[bank])->configure_entries(0, len / ( 1024 * 1024 ), rgn, 1024 * 1024 );
895      state->membank(bankname[bank])->set_entry(0 );
896896   }
897897
898898   if (n_daughterboard == 32)
src/mame/drivers/itech8.c
r14976r14977
657657   /* make sure bank 0 is selected */
658658   if (main_cpu_type == M6809 || main_cpu_type == HD6309)
659659   {
660      memory_set_bankptr(machine, "bank1", &machine.region("maincpu")->base()[0x4000]);
660      state->membank("bank1")->set_base(&state->memregion("maincpu")->base()[0x4000]);
661661      machine.device("maincpu")->reset();
662662   }
663663
r14976r14977
705705{
706706   /* bit 0x20 on address 7 controls CPU banking */
707707   if (offset / 2 == 7)
708      memory_set_bankptr(machine(), "bank1", &machine().region("maincpu")->base()[0x4000 + 0xc000 * ((data >> 5) & 1)]);
708      membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x4000 + 0xc000 * ((data >> 5) & 1)]);
709709
710710   /* the rest is handled by the video hardware */
711711   itech8_blitter_w(space, offset, data);
r14976r14977
715715WRITE8_MEMBER(itech8_state::rimrockn_bank_w)
716716{
717717   /* banking is controlled here instead of by the blitter output */
718   memory_set_bankptr(machine(), "bank1", &machine().region("maincpu")->base()[0x4000 + 0xc000 * (data & 3)]);
718   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x4000 + 0xc000 * (data & 3)]);
719719}
720720
721721
src/mame/drivers/galaxian.c
r14976r14977
843843{
844844   // read from a rom (which one?? "a-3e.k3" from audiocpu ($2700-$2fff) looks very suspicious)
845845   galaxian_state *state = machine.driver_data<galaxian_state>();
846   UINT8 *rom = machine.region("audiocpu")->base();
846   UINT8 *rom = state->memregion("audiocpu")->base();
847847   state->m_protection_result = rom[0x2000 | (state->m_protection_state & 0x1fff)]; // probably needs a BITSWAP8
848848
849849   // and an irq on the main z80 afterwards
r14976r14977
10871087   m_gmgalax_selected_game = newval;
10881088
10891089   /* select the bank and graphics bank based on it */
1090   memory_set_bank(machine(), "bank1", m_gmgalax_selected_game);
1090   membank("bank1")->set_entry(m_gmgalax_selected_game);
10911091   galaxian_gfxbank_w(*space, 0, m_gmgalax_selected_game);
10921092
10931093   /* reset the stars */
r14976r14977
11161116
11171117WRITE8_MEMBER(galaxian_state::zigzag_bankswap_w)
11181118{
1119   memory_set_bank(machine(), "bank1", data & 1);
1120   memory_set_bank(machine(), "bank2", ~data & 1);
1119   membank("bank1")->set_entry(data & 1);
1120   membank("bank2")->set_entry(~data & 1);
11211121}
11221122
11231123
r14976r14977
25332533
25342534static void decode_mooncrst(running_machine &machine, int length, UINT8 *dest)
25352535{
2536   UINT8 *rom = machine.region("maincpu")->base();
2536   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
25372537   int offs;
25382538
25392539   for (offs = 0; offs < length; offs++)
r14976r14977
25952595      { 0,2,0,2 },
25962596      { 1,4,1,4 }
25972597   };
2598   UINT8 *rombase = machine.region("maincpu")->base();
2599   UINT32 romlength = machine.region("maincpu")->bytes();
2598   UINT8 *rombase = machine.root_device().memregion("maincpu")->base();
2599   UINT32 romlength = machine.root_device().memregion("maincpu")->bytes();
26002600   UINT32 offs;
26012601
26022602   for (offs = 0; offs < romlength; offs++)
r14976r14977
26122612
26132613static void decode_dingoe(running_machine &machine)
26142614{
2615   UINT8 *rombase = machine.region("maincpu")->base();
2616   UINT32 romlength = machine.region("maincpu")->bytes();
2615   UINT8 *rombase = machine.root_device().memregion("maincpu")->base();
2616   UINT32 romlength = machine.root_device().memregion("maincpu")->bytes();
26172617   UINT32 offs;
26182618
26192619   for (offs = 0; offs < romlength; offs++)
r14976r14977
26352635
26362636static void decode_frogger_sound(running_machine &machine)
26372637{
2638   UINT8 *rombase = machine.region("audiocpu")->base();
2638   UINT8 *rombase = machine.root_device().memregion("audiocpu")->base();
26392639   UINT32 offs;
26402640
26412641   /* the first ROM of the sound CPU has data lines D0 and D1 swapped */
r14976r14977
26462646
26472647static void decode_frogger_gfx(running_machine &machine)
26482648{
2649   UINT8 *rombase = machine.region("gfx1")->base();
2649   UINT8 *rombase = machine.root_device().memregion("gfx1")->base();
26502650   UINT32 offs;
26512651
26522652   /* the 2nd gfx ROM has data lines D0 and D1 swapped */
r14976r14977
26572657
26582658static void decode_anteater_gfx(running_machine &machine)
26592659{
2660   UINT32 romlength = machine.region("gfx1")->bytes();
2661   UINT8 *rombase = machine.region("gfx1")->base();
2660   UINT32 romlength = machine.root_device().memregion("gfx1")->bytes();
2661   UINT8 *rombase = machine.root_device().memregion("gfx1")->base();
26622662   UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength);
26632663   UINT32 offs;
26642664
r14976r14977
26772677
26782678static void decode_losttomb_gfx(running_machine &machine)
26792679{
2680   UINT32 romlength = machine.region("gfx1")->bytes();
2681   UINT8 *rombase = machine.region("gfx1")->base();
2680   UINT32 romlength = machine.root_device().memregion("gfx1")->bytes();
2681   UINT8 *rombase = machine.root_device().memregion("gfx1")->base();
26822682   UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength);
26832683   UINT32 offs;
26842684
r14976r14977
27022702
27032703   /* Deryption worked out by hand by Chris Hardy. */
27042704
2705   RAM = machine.region("maincpu")->base();
2705   RAM = machine.root_device().memregion("maincpu")->base();
27062706
27072707   for (i = 0;i < 0x1000;i++)
27082708   {
r14976r14977
28102810
28112811   /* ROM is banked */
28122812   space->install_read_bank(0x0000, 0x3fff, "bank1");
2813   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x4000);
2813   machine.root_device().membank("bank1")->configure_entries(0, 2, state->memregion("maincpu")->base() + 0x10000, 0x4000);
28142814
28152815   /* callback when the game select is toggled */
28162816   state->gmgalax_game_changed(*machine.m_portlist.first()->fieldlist().first(), NULL, 0, 0);
r14976r14977
28692869   common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
28702870
28712871   /* decrypt program code */
2872   decode_mooncrst(machine, 0x8000, machine.region("maincpu")->base());
2872   decode_mooncrst(machine, 0x8000, machine.root_device().memregion("maincpu")->base());
28732873}
28742874
28752875
r14976r14977
29392939   int x;
29402940
29412941   sprintf(tmp,"game_%d_cpu", bank);
2942   srcregion = machine.region(tmp)->base();
2943   dstregion = machine.region("maincpu")->base();
2942   srcregion = machine.root_device().memregion(tmp)->base();
2943   dstregion = machine.root_device().memregion("maincpu")->base();
29442944   memcpy(dstregion, srcregion, 0x4000);
29452945
29462946   sprintf(tmp,"game_%d_temp", bank);
2947   srcregion = machine.region(tmp)->base();
2948   dstregion = machine.region("gfx1")->base();
2947   srcregion = machine.root_device().memregion(tmp)->base();
2948   dstregion = machine.root_device().memregion("gfx1")->base();
29492949   memcpy(dstregion, srcregion, 0x2000);
2950   dstregion = machine.region("gfx2")->base();
2950   dstregion = machine.root_device().memregion("gfx2")->base();
29512951   memcpy(dstregion, srcregion, 0x2000);
29522952
29532953   if (from_game)
r14976r14977
29652965   }
29662966
29672967   sprintf(tmp,"game_%d_prom", bank);
2968   srcregion = machine.region(tmp)->base();
2969   dstregion = machine.region("proms")->base();
2968   srcregion = machine.root_device().memregion(tmp)->base();
2969   dstregion = machine.root_device().memregion("proms")->base();
29702970   memcpy(dstregion, srcregion, 0x20);
29712971
29722972   PALETTE_INIT_CALL(galaxian);
r14976r14977
30263026   /* make ROMs 2 & 3 swappable */
30273027   space->install_read_bank(0x2000, 0x2fff, "bank1");
30283028   space->install_read_bank(0x3000, 0x3fff, "bank2");
3029   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x2000, 0x1000);
3030   memory_configure_bank(machine, "bank2", 0, 2, machine.region("maincpu")->base() + 0x2000, 0x1000);
3029   state->membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x2000, 0x1000);
3030   state->membank("bank2")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x2000, 0x1000);
30313031
30323032   /* also re-install the fixed ROM area as a bank in order to inform the memory system that
30333033       the fixed area only extends to 0x1fff */
30343034   space->install_read_bank(0x0000, 0x1fff, "bank3");
3035   memory_set_bankptr(machine, "bank3", machine.region("maincpu")->base() + 0x0000);
3035   state->membank("bank3")->set_base(state->memregion("maincpu")->base() + 0x0000);
30363036
30373037   /* handler for doing the swaps */
30383038   space->install_write_handler(0x7002, 0x7002, 0, 0x07f8, write8_delegate(FUNC(galaxian_state::zigzag_bankswap_w),state));
r14976r14977
31473147   space->install_ram(0x8000, 0x87ff);
31483148
31493149   /* extend ROM */
3150   space->install_rom(0x0000, 0x5fff, machine.region("maincpu")->base());
3150   space->install_rom(0x0000, 0x5fff, state->memregion("maincpu")->base());
31513151}
31523152
31533153
r14976r14977
31623162   space->install_ram(0x8000, 0x87ff);
31633163
31643164   /* extend ROM */
3165   space->install_rom(0x0000, 0x7fff, machine.region("maincpu")->base());
3165   space->install_rom(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base());
31663166}
31673167
31683168
31693169static void mshuttle_decode(running_machine &machine, const UINT8 convtable[8][16])
31703170{
31713171   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
3172   UINT8 *rom = machine.region("maincpu")->base();
3172   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
31733173   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
31743174   int A;
31753175
r14976r14977
32713271      3, 7, 7, 7   // ok!
32723272   };
32733273
3274   UINT8* romdata = machine.region("maincpu")->base();
3275   assert(machine.region("maincpu")->bytes() == 0x8000);
3274   UINT8* romdata = machine.root_device().memregion("maincpu")->base();
3275   assert(machine.root_device().memregion("maincpu")->bytes() == 0x8000);
32763276   UINT8 buf[0x8000];
32773277   memcpy(buf, romdata, 0x8000);
32783278
r14976r14977
33123312   space->install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),state));
33133313
33143314   /* extra ROM */
3315   space->install_rom(0x5000, 0x67ff, machine.region("maincpu")->base() + 0x5000);
3315   space->install_rom(0x5000, 0x67ff, state->memregion("maincpu")->base() + 0x5000);
33163316
33173317   /* install RAM at $4000-$4800 */
33183318   space->install_ram(0x4000, 0x47ff);
r14976r14977
33373337   space->unmap_write(0xb004, 0xb004, 0, 0x07f8);
33383338
33393339   /* extend ROM */
3340   space->install_rom(0x0000, 0x47ff, machine.region("maincpu")->base());
3340   space->install_rom(0x0000, 0x47ff, state->memregion("maincpu")->base());
33413341}
33423342
33433343/*************************************
r14976r14977
33963396
33973397   /* sound board has space for extra ROM */
33983398   machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
3399   memory_set_bankptr(machine, "bank1", machine.region("audiocpu")->base());
3399   state->membank("bank1")->set_base(state->memregion("audiocpu")->base());
34003400}
34013401
34023402
r14976r14977
35023502
35033503   /* extra ROM */
35043504   space->install_read_bank(0x5800, 0x67ff, "bank1");
3505   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x5800);
3505   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x5800);
35063506
35073507   /* no background related */
35083508//  space->nop_write(0x6803, 0x6803);
r14976r14977
35103510   machine.device("audiocpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3000, 0x3000, read8_delegate(FUNC(galaxian_state::scorpion_digitalker_intr_r),state));
35113511/*
35123512{
3513    const UINT8 *rom = machine.region("speech")->base();
3513    const UINT8 *rom = state->memregion("speech")->base();
35143514    int i;
35153515
35163516    for (i = 0; i < 0x2c; i++)
src/mame/drivers/kickgoal.c
r14976r14977
810810static DRIVER_INIT( kickgoal )
811811{
812812#if 0 /* we should find a real fix instead  */
813   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
813   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
814814
815815   /* fix "bug" that prevents game from writing to EEPROM */
816816   rom[0x12b0/2] = 0x0001;
src/mame/drivers/hyprduel.c
r14976r14977
201201
202202READ16_MEMBER(hyprduel_state::hyprduel_bankedrom_r)
203203{
204   UINT8 *ROM = machine().region("gfx1")->base();
205   size_t  len = machine().region("gfx1")->bytes();
204   UINT8 *ROM = memregion("gfx1")->base();
205   size_t  len = memregion("gfx1")->bytes();
206206
207207   offset = offset * 2 + 0x10000 * (*m_rombank);
208208
r14976r14977
286286
287287   if (offset == 0xc / 2)
288288   {
289      UINT8 *src = machine().region("gfx1")->base();
290      size_t  src_len = machine().region("gfx1")->bytes();
289      UINT8 *src = memregion("gfx1")->base();
290      size_t  src_len = memregion("gfx1")->bytes();
291291
292292      UINT32 tmap = (m_blitter_regs[0x00 / 2] << 16) + m_blitter_regs[0x02 / 2];
293293      UINT32 src_offs = (m_blitter_regs[0x04 / 2] << 16) + m_blitter_regs[0x06 / 2];
src/mame/drivers/arcadecl.c
r14976r14977
398398
399399static DRIVER_INIT( sparkz )
400400{
401   memset(machine.region("gfx1")->base(), 0, machine.region("gfx1")->bytes());
401   memset(machine.root_device().memregion("gfx1")->base(), 0, machine.root_device().memregion("gfx1")->bytes());
402402}
403403
404404
src/mame/drivers/suprslam.c
r14976r14977
114114
115115WRITE8_MEMBER(suprslam_state::suprslam_sh_bankswitch_w)
116116{
117   UINT8 *RAM = machine().region("audiocpu")->base();
117   UINT8 *RAM = memregion("audiocpu")->base();
118118   int bankaddress;
119119
120120   bankaddress = 0x10000 + (data & 0x03) * 0x8000;
121   memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
121   membank("bank1")->set_base(&RAM[bankaddress]);
122122}
123123
124124/*** MEMORY MAPS *************************************************************/
src/mame/drivers/calomega.c
r14976r14977
39183918{
39193919   /* background color is adjusted through RGB pots */
39203920   int x;
3921   UINT8 *BPR = machine.region( "proms" )->base();
3921   UINT8 *BPR = machine.root_device().memregion( "proms" )->base();
39223922
39233923   for (x = 0x0000; x < 0x0400; x++)
39243924   {
r14976r14977
39303930static DRIVER_INIT( elgrande )
39313931{
39323932   int x;
3933   UINT8 *BPR = machine.region( "proms" )->base();
3933   UINT8 *BPR = machine.root_device().memregion( "proms" )->base();
39343934
39353935   /* background color is adjusted through RGB pots */
39363936   for (x = 0x0000; x < 0x0400; x++)
r14976r14977
39443944{
39453945   /* background color is adjusted through RGB pots */
39463946   int x;
3947   UINT8 *BPR = machine.region( "proms" )->base();
3947   UINT8 *BPR = machine.root_device().memregion( "proms" )->base();
39483948
39493949   for (x = 0x0000; x < 0x0400; x++)
39503950   {
r14976r14977
39573957{
39583958   /* background color is adjusted through RGB pots */
39593959   int x;
3960   UINT8 *BPR = machine.region( "proms" )->base();
3960   UINT8 *BPR = machine.root_device().memregion( "proms" )->base();
39613961
39623962   for (x = 0x0000; x < 0x0400; x++)
39633963   {
r14976r14977
39693969       Start = $2042;  NMI = $26f8;
39703970       Also a fake vector at $3ff8-$3ff9. The code checks these values to continue.
39713971    */
3972   UINT8 *PRGROM = machine.region( "maincpu" )->base();
3972   UINT8 *PRGROM = machine.root_device().memregion( "maincpu" )->base();
39733973
39743974   PRGROM[0x3ff8] = 0x8e; /* checked by code */
39753975   PRGROM[0x3ff9] = 0x97; /* checked by code */
src/mame/drivers/sfkick.c
r14976r14977
108108   {
109109      case 0: /* bios */
110110      {
111         UINT8 *mem = machine.region("bios")->base();
112         memory_set_bankptr(machine,"bank1", mem);
113         memory_set_bankptr(machine,"bank2", mem+0x2000);
111         UINT8 *mem = state->memregion("bios")->base();
112         state->membank("bank1")->set_base(mem);
113         state->membank("bank2")->set_base(mem+0x2000);
114114      }
115115      break;
116116
117117      case 1: /* ext rom */
118118      {
119         UINT8 *mem = machine.region("extrom")->base();
120         memory_set_bankptr(machine,"bank1", mem+0x4000);
121         memory_set_bankptr(machine,"bank2", mem+0x6000);
119         UINT8 *mem = machine.root_device().memregion("extrom")->base();
120         state->membank("bank1")->set_base(mem+0x4000);
121         state->membank("bank2")->set_base(mem+0x6000);
122122      }
123123      break;
124124
125125      case 2: /* banked */
126126      {
127         UINT8 *mem = machine.region("banked")->base();
128         memory_set_bankptr(machine,"bank1", mem+0x2000*state->m_bank[0]);
129         memory_set_bankptr(machine,"bank2", mem+0x2000*state->m_bank[1]);
127         UINT8 *mem = machine.root_device().memregion("banked")->base();
128         state->membank("bank1")->set_base(mem+0x2000*state->m_bank[0]);
129         state->membank("bank2")->set_base(mem+0x2000*state->m_bank[1]);
130130      }
131131      break;
132132
133133      case 3: /* unknown */
134134      {
135         UINT8 *mem = machine.region("banked")->base();
136         memory_set_bankptr(machine,"bank1", mem+0x18000);
137         memory_set_bankptr(machine,"bank2", mem+0x18000);
135         UINT8 *mem = machine.root_device().memregion("banked")->base();
136         state->membank("bank1")->set_base(mem+0x18000);
137         state->membank("bank2")->set_base(mem+0x18000);
138138      }
139139      break;
140140   }
r14976r14977
144144   {
145145      case 0: /* bios - upper part */
146146      {
147         UINT8 *mem = machine.region("bios")->base();
148         memory_set_bankptr(machine,"bank3", mem+0x4000);
149         memory_set_bankptr(machine,"bank4", mem+0x6000);
147         UINT8 *mem = machine.root_device().memregion("bios")->base();
148         state->membank("bank3")->set_base(mem+0x4000);
149         state->membank("bank4")->set_base(mem+0x6000);
150150      }
151151      break;
152152
153153      case 1:  /* unknown */
154154      case 3:
155155      {
156         UINT8 *mem = machine.region("banked")->base();
157         memory_set_bankptr(machine,"bank3", mem+0x18000);
158         memory_set_bankptr(machine,"bank4", mem+0x18000);
156         UINT8 *mem = machine.root_device().memregion("banked")->base();
157         state->membank("bank3")->set_base(mem+0x18000);
158         state->membank("bank4")->set_base(mem+0x18000);
159159      }
160160      break;
161161
162162      case 2: /* banked */
163163      {
164         UINT8 *mem = machine.region("banked")->base();
165         memory_set_bankptr(machine,"bank3", mem+0x2000*state->m_bank[2]);
166         memory_set_bankptr(machine,"bank4", mem+0x2000*state->m_bank[3]);
164         UINT8 *mem = machine.root_device().memregion("banked")->base();
165         state->membank("bank3")->set_base(mem+0x2000*state->m_bank[2]);
166         state->membank("bank4")->set_base(mem+0x2000*state->m_bank[3]);
167167      }
168168      break;
169169   }
r14976r14977
173173   {
174174      case 0: /* cartridge */
175175      {
176         UINT8 *mem = machine.region("cartridge")->base();
177         memory_set_bankptr(machine,"bank5", mem+0x4000);
178         memory_set_bankptr(machine,"bank6", mem+0x6000);
176         UINT8 *mem = machine.root_device().memregion("cartridge")->base();
177         state->membank("bank5")->set_base(mem+0x4000);
178         state->membank("bank6")->set_base(mem+0x6000);
179179      }
180180      break;
181181
182182      case 1: /* unknown */
183183      case 3:
184184      {
185         UINT8 *mem = machine.region("banked")->base();
186         memory_set_bankptr(machine,"bank5", mem+0x18000);
187         memory_set_bankptr(machine,"bank6", mem+0x18000);
185         UINT8 *mem = machine.root_device().memregion("banked")->base();
186         state->membank("bank5")->set_base(mem+0x18000);
187         state->membank("bank6")->set_base(mem+0x18000);
188188      }
189189      break;
190190
191191      case 2: /* banked */
192192      {
193         UINT8 *mem = machine.region("banked")->base();
194         memory_set_bankptr(machine,"bank5", mem+0x2000*state->m_bank[4]);
195         memory_set_bankptr(machine,"bank6", mem+0x2000*state->m_bank[5]);
193         UINT8 *mem = machine.root_device().memregion("banked")->base();
194         state->membank("bank5")->set_base(mem+0x2000*state->m_bank[4]);
195         state->membank("bank6")->set_base(mem+0x2000*state->m_bank[5]);
196196      }
197197      break;
198198   }
r14976r14977
203203      case 0: /* unknown */
204204      case 1:
205205      {
206         UINT8 *mem = machine.region("banked")->base();
207         memory_set_bankptr(machine,"bank7", mem+0x18000);
208         memory_set_bankptr(machine,"bank8", mem+0x18000);
206         UINT8 *mem = machine.root_device().memregion("banked")->base();
207         state->membank("bank7")->set_base(mem+0x18000);
208         state->membank("bank8")->set_base(mem+0x18000);
209209      }
210210      break;
211211
212212      case 2: /* banked */
213213      {
214         UINT8 *mem = machine.region("banked")->base();
215         memory_set_bankptr(machine,"bank7", mem+0x2000*state->m_bank[6]);
216         memory_set_bankptr(machine,"bank8", mem+0x2000*state->m_bank[7]);
214         UINT8 *mem = machine.root_device().memregion("banked")->base();
215         state->membank("bank7")->set_base(mem+0x2000*state->m_bank[6]);
216         state->membank("bank8")->set_base(mem+0x2000*state->m_bank[7]);
217217      }
218218      break;
219219
220220      case 3: /* RAM */
221221      {
222         memory_set_bankptr(machine,"bank7", state->m_main_mem);
223         memory_set_bankptr(machine,"bank8", state->m_main_mem+0x2000);
222         state->membank("bank7")->set_base(state->m_main_mem);
223         state->membank("bank8")->set_base(state->m_main_mem+0x2000);
224224      }
225225      break;
226226   }
src/mame/drivers/dgpix.c
r14976r14977
7777
7878READ32_MEMBER(dgpix_state::flash_r)
7979{
80   UINT32 *ROM = (UINT32 *)machine().region("user1")->base();
80   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("user1")->base();
8181
8282   if(offset >= (0x2000000 - m_flash_roms * 0x400000) / 4)
8383   {
r14976r14977
114114      if(data == 0xd0d00000)
115115      {
116116         // point to game settings
117         UINT8 *rom = (UINT8 *)machine().region("user1")->base() + offset*4;
117         UINT8 *rom = (UINT8 *)machine().root_device().memregion("user1")->base() + offset*4;
118118
119119         // erase one block
120120         memset(rom, 0xff, 0x10000);
r14976r14977
132132      }
133133      else
134134      {
135         UINT16 *rom = (UINT16 *)machine().region("user1")->base();
135         UINT16 *rom = (UINT16 *)machine().root_device().memregion("user1")->base();
136136
137137         // write game settings
138138
r14976r14977
223223   if (read_or_write)
224224   {
225225      // point to game settings
226      UINT8 *rom = (UINT8 *)machine.region("user1")->base() + 0x1c00000 + 0x360000;
226      UINT8 *rom = (UINT8 *)machine.root_device().memregion("user1")->base() + 0x1c00000 + 0x360000;
227227      UINT8 tmp[0x40000];
228228      int i;
229229
r14976r14977
236236   else if (file)
237237   {
238238      // point to game settings
239      UINT8 *rom = (UINT8 *)machine.region("user1")->base() + 0x1c00000 + 0x360000;
239      UINT8 *rom = (UINT8 *)machine.root_device().memregion("user1")->base() + 0x1c00000 + 0x360000;
240240      UINT8 tmp[0x40000];
241241      int i;
242242
r14976r14977
574574static DRIVER_INIT( xfiles )
575575{
576576   dgpix_state *state = machine.driver_data<dgpix_state>();
577   UINT8 *rom = (UINT8 *)machine.region("user1")->base() + 0x1c00000;
577   UINT8 *rom = (UINT8 *)state->memregion("user1")->base() + 0x1c00000;
578578
579579   rom[BYTE4_XOR_BE(0x3aa92e)] = 3;
580580   rom[BYTE4_XOR_BE(0x3aa92f)] = 0;
r14976r14977
592592static DRIVER_INIT( kdynastg )
593593{
594594   dgpix_state *state = machine.driver_data<dgpix_state>();
595   UINT8 *rom = (UINT8 *)machine.region("user1")->base() + 0x1c00000;
595   UINT8 *rom = (UINT8 *)state->memregion("user1")->base() + 0x1c00000;
596596
597597   rom[BYTE4_XOR_BE(0x3aaa10)] = 3; // 129f0 - nopped call
598598   rom[BYTE4_XOR_BE(0x3aaa11)] = 0;
src/mame/drivers/atetris.c
r14976r14977
486486static DRIVER_INIT( atetris )
487487{
488488   atetris_state *state = machine.driver_data<atetris_state>();
489   UINT8 *rgn = machine.region("maincpu")->base();
489   UINT8 *rgn = state->memregion("maincpu")->base();
490490
491491   slapstic_init(machine, 101);
492492   state->m_slapstic_source = &rgn[0x10000];
src/mame/drivers/sangho.c
r14976r14977
7373      case 0:
7474         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
7575         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x3fff, "bank5");
76         memory_set_bankptr(machine, "bank1", state->m_ram);
77         memory_set_bankptr(machine, "bank5", state->m_ram);
76         state->membank("bank1")->set_base(state->m_ram);
77         state->membank("bank5")->set_base(state->m_ram);
7878         break;
7979      case 2:
8080         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
8181         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x3fff);
82         memory_set_bankptr(machine, "bank1", machine.region("user1")->base()+ 0x10000);
82         state->membank("bank1")->set_base(state->memregion("user1")->base()+ 0x10000);
8383         break;
8484      case 1:
8585      case 3:
r14976r14977
9595      case 0:
9696         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank2");
9797         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x4000, 0x7fff, "bank6");
98         memory_set_bankptr(machine, "bank2", state->m_ram + 0x4000);
99         memory_set_bankptr(machine, "bank6", state->m_ram + 0x4000);
98         state->membank("bank2")->set_base(state->m_ram + 0x4000);
99         state->membank("bank6")->set_base(state->m_ram + 0x4000);
100100         break;
101101      case 2:
102102         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank2");
103103         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x4000, 0x7fff);
104         memory_set_bankptr(machine, "bank2", machine.region("user1")->base()+ 0x18000);
104         state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base()+ 0x18000);
105105         break;
106106      case 3:
107107         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank2");
108108         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x4000, 0x7fff);
109         memory_set_bankptr(machine, "bank2", machine.region("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000) + 0x4000);
109         state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000) + 0x4000);
110110         break;
111111      case 1:
112112         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0x4000, 0x7fff);
r14976r14977
121121      case 0:
122122         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xbfff, "bank3");
123123         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x8000, 0xbfff, "bank7");
124         memory_set_bankptr(machine, "bank3", state->m_ram + 0x8000);
125         memory_set_bankptr(machine, "bank7", state->m_ram + 0x8000);
124         state->membank("bank3")->set_base(state->m_ram + 0x8000);
125         state->membank("bank7")->set_base(state->m_ram + 0x8000);
126126         break;
127127      case 3:
128128         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xbfff, "bank3");
129129         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0xbfff);
130         memory_set_bankptr(machine, "bank3", machine.region("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000));
130         state->membank("bank3")->set_base(machine.root_device().memregion("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000));
131131         break;
132132      case 1:
133133      case 2:
r14976r14977
143143      case 0:
144144         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc000, 0xffff, "bank4");
145145         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0xc000, 0xffff, "bank8");
146         memory_set_bankptr(machine, "bank4", state->m_ram + 0xc000);
147         memory_set_bankptr(machine, "bank8", state->m_ram + 0xc000);
146         state->membank("bank4")->set_base(state->m_ram + 0xc000);
147         state->membank("bank8")->set_base(state->m_ram + 0xc000);
148148         break;
149149      case 1:
150150      case 2:
r14976r14977
191191      if (banknum & 0x80)
192192      {
193193         // ram
194         memory_set_bankptr(machine, read_bank_name, &state->m_ram[(banknum & 0x7f) * 0x4000]);
194         state->membank(read_bank_name)->set_base(&state->m_ram[(banknum & 0x7f) * 0x4000]);
195195         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(bank*0x4000, (bank+1)*0x4000 - 1, write_bank_name );
196         memory_set_bankptr(machine, write_bank_name, &state->m_ram[(banknum & 0x7f) * 0x4000]);
196         state->membank(write_bank_name)->set_base(&state->m_ram[(banknum & 0x7f) * 0x4000]);
197197      }
198198      else
199199      {
200200         // rom 0
201         memory_set_bankptr(machine, read_bank_name, machine.region("user1")->base()+0x4000*banknum);
201         state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x4000*banknum);
202202         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
203203      }
204204   }
205205   else if (banktype == 0x82)
206206   {
207      memory_set_bankptr(machine, read_bank_name, machine.region("user1")->base()+0x20000+banknum*0x4000);
207      state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x20000+banknum*0x4000);
208208      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
209209   }
210210   else if (banktype == 0x80)
211211   {
212      memory_set_bankptr(machine, read_bank_name, machine.region("user1")->base()+0x120000+banknum*0x4000);
212      state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x120000+banknum*0x4000);
213213      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
214214   }
215215   else
src/mame/drivers/pachifev.c
r14976r14977
261261    }
262262    else
263263    {
264        UINT8 *ROM = device->machine().region("adpcm")->base();
264        UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base();
265265
266266        state->m_adpcm_data = ((state->m_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0)>>4) );
267267        msm5205_data_w(device,state->m_adpcm_data & 0xf);
src/mame/drivers/leland.c
r14976r14977
19951995   leland_state *state = machine.driver_data<leland_state>();
19961996   /* master CPU bankswitching */
19971997   state->m_update_master_bank = cerberus_bankswitch;
1998   memory_set_bankptr(machine, "bank1", machine.region("master")->base() + 0x2000);
1999   memory_set_bankptr(machine, "bank2", machine.region("master")->base() + 0xa000);
2000   memory_set_bankptr(machine, "bank3", machine.region("slave")->base() + 0x2000);
1998   state->membank("bank1")->set_base(state->memregion("master")->base() + 0x2000);
1999   state->membank("bank2")->set_base(state->memregion("master")->base() + 0xa000);
2000   state->membank("bank3")->set_base(state->memregion("slave")->base() + 0x2000);
20012001
20022002   /* set up the master CPU I/O ports */
20032003   init_master_ports(machine, 0x40, 0x80);
src/mame/drivers/lazercmd.c
r14976r14977
789789static DRIVER_INIT( lazercmd )
790790{
791791   int i, y;
792   UINT8 *gfx = machine.region("gfx1")->base();
792   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
793793
794794/******************************************************************
795795 * To show the maze bit #6 and #7 of the video ram are used.
r14976r14977
818818static DRIVER_INIT( medlanes )
819819{
820820   int i, y;
821   UINT8 *gfx = machine.region("gfx1")->base();
821   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
822822
823823/******************************************************************
824824 * To show the maze bit #6 and #7 of the video ram are used.
r14976r14977
847847static DRIVER_INIT( bbonk )
848848{
849849   int i, y;
850   UINT8 *gfx = machine.region("gfx1")->base();
850   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
851851
852852/******************************************************************
853853 * To show the maze bit #6 and #7 of the video ram are used.
src/mame/drivers/pcat_nit.c
r14976r14977
158158
159159      if ( data & 0x80 )
160160      {
161         memory_set_bank(machine(), "rombank", (data & 0x3f) | 0x40 );
161         membank("rombank")->set_entry((data & 0x3f) | 0x40 );
162162      }
163163      else
164164      {
165         memory_set_bank(machine(), "rombank", data & 0x3f );
165         membank("rombank")->set_entry(data & 0x3f );
166166      }
167167   }
168168   else
r14976r14977
172172
173173      space.install_readwrite_bank(0x000d8000, 0x000d9fff, "nvrambank" );
174174
175      memory_set_bankptr(machine(), "nvrambank", m_banked_nvram);
175      membank("nvrambank")->set_base(m_banked_nvram);
176176
177177   }
178178}
r14976r14977
232232
233233   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, streetg2_set_keyb_int);
234234
235   memory_configure_bank(machine, "rombank", 0, 0x80, machine.region("game_prg")->base(), 0x8000 );
236   memory_set_bank(machine, "rombank", 0);
235   machine.root_device().membank("rombank")->configure_entries(0, 0x80, machine.root_device().memregion("game_prg")->base(), 0x8000 );
236   machine.root_device().membank("rombank")->set_entry(0);
237237
238238   //microtouch_init(machine, pcat_nit_microtouch_tx_callback, NULL);
239239}
src/mame/drivers/lordgun.c
r14976r14977
5757static DRIVER_INIT( lordgun )
5858{
5959   int i;
60   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
60   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
6161
6262   // Decryption
6363
r14976r14977
8282// From XingXing:
8383static DRIVER_INIT( aliencha )
8484{
85   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
85   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
8686
8787   // Protection
8888
r14976r14977
106106
107107static DRIVER_INIT( alienchac )
108108{
109   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
109   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
110110
111111   // Protection
112112
src/mame/drivers/segag80r.c
r14976r14977
14051405
14061406   /* expand the background ROMs; A11/A12 of each ROM is independently controlled via */
14071407   /* banking */
1408   dest = machine.region(region)->base();
1408   dest = machine.root_device().memregion(region)->base();
14091409   temp = auto_alloc_array(machine, UINT8, 0x4000);
14101410   memcpy(temp, dest, 0x4000);
14111411
src/mame/drivers/tmnt.c
r14976r14977
236236
237237WRITE8_MEMBER(tmnt_state::prmrsocr_audio_bankswitch_w)
238238{
239   memory_set_bank(machine(), "bank1", data & 7);
239   membank("bank1")->set_entry(data & 7);
240240}
241241
242242
r14976r14977
278278   running_machine &machine = device.machine();
279279   tmnt_state *state = machine.driver_data<tmnt_state>();
280280   int i;
281   UINT8 *source = machine.region("title")->base();
281   UINT8 *source = state->memregion("title")->base();
282282
283283   state->save_item(NAME(state->m_sampledata));
284284
r14976r14977
925925      CellSrc = m_tmnt2_1c0800[0x00] | (m_tmnt2_1c0800[0x01] << 16 );
926926//        if (CellDest >= 0x180000 && CellDest < 0x183fe0) {
927927      CellVar -= 0x104000;
928      src = (UINT16 *)(machine().region("maincpu")->base() + CellSrc);
928      src = (UINT16 *)(machine().root_device().memregion("maincpu")->base() + CellSrc);
929929
930930      CellVar >>= 1;
931931
r14976r14977
26042604static MACHINE_START( prmrsocr )
26052605{
26062606   MACHINE_START_CALL(common);
2607   UINT8 *ROM = machine.region("audiocpu")->base();
2608   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
2607   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
2608   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
26092609}
26102610
26112611static MACHINE_CONFIG_START( prmrsocr, tmnt_state )
r14976r14977
40794079        be shuffled around because the ROMs are connected differently to the
40804080        051962 custom IC.
40814081    */
4082   gfxdata = machine.region("gfx1")->base();
4083   len = machine.region("gfx1")->bytes();
4082   gfxdata = machine.root_device().memregion("gfx1")->base();
4083   len = machine.root_device().memregion("gfx1")->bytes();
40844084   for (i = 0; i < len; i += 4)
40854085   {
40864086      for (j = 0; j < 4; j++)
r14976r14977
41004100        be shuffled around because the ROMs are connected differently to the
41014101        051937 custom IC.
41024102    */
4103   gfxdata = machine.region("gfx2")->base();
4104   len = machine.region("gfx2")->bytes();
4103   gfxdata = machine.root_device().memregion("gfx2")->base();
4104   len = machine.root_device().memregion("gfx2")->bytes();
41054105   for (i = 0; i < len; i += 4)
41064106   {
41074107      for (j = 0; j < 4; j++)
r14976r14977
41724172        be shuffled around because the ROMs are connected differently to the
41734173        051962 custom IC.
41744174    */
4175   gfxdata = machine.region("gfx1")->base();
4176   len = machine.region("gfx1")->bytes();
4175   gfxdata = machine.root_device().memregion("gfx1")->base();
4176   len = machine.root_device().memregion("gfx1")->bytes();
41774177   for (i = 0; i < len; i += 4)
41784178   {
41794179      for (j = 0; j < 4; j++)
r14976r14977
41934193        be shuffled around because the ROMs are connected differently to the
41944194        051937 custom IC.
41954195    */
4196   gfxdata = machine.region("gfx2")->base();
4197   len = machine.region("gfx2")->bytes();
4196   gfxdata = machine.root_device().memregion("gfx2")->base();
4197   len = machine.root_device().memregion("gfx2")->bytes();
41984198   for (i = 0; i < len; i += 4)
41994199   {
42004200      for (j = 0; j < 4; j++)
r14976r14977
42114211
42124212   temp = auto_alloc_array(machine, UINT8, len);
42134213   memcpy(temp, gfxdata, len);
4214   code_conv_table = &machine.region("proms")->base()[0x0000];
4214   code_conv_table = &machine.root_device().memregion("proms")->base()[0x0000];
42154215   for (A = 0; A < len / 4; A++)
42164216   {
42174217#define CA0 0
src/mame/drivers/raiden2.c
r14976r14977
613613
614614//  case 0x6ca:
615615//      logerror("select bank %d %04x\n", (data >> 15) & 1, data);
616//      memory_set_bank(space.machine(), "bank1", (data >> 15) & 1);
616//      space.machine().root_device().membank("bank1")->set_entry((data >> 15) & 1);
617617
618618
619619static void combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask)
r14976r14977
813813
814814      /* probably bit 3 is from 6c9 */
815815      /* TODO: this doesn't work! */
816      memory_set_bank(space.machine(), "mainbank", 8 | (cop_bank & 0x7000) >> 12);
816      space.machine().root_device().membank("mainbank")->set_entry(8 | (cop_bank & 0x7000) >> 12);
817817   }
818818}
819819
r14976r14977
10591059   sprcpt_init();
10601060   MACHINE_RESET_CALL(seibu_sound);
10611061
1062   memory_set_bank(machine, "mainbank", 1);
1062   state->membank("mainbank")->set_entry(1);
10631063
10641064   state->prg_bank = 0;
10651065   //cop_init();
r14976r14977
10721072   sprcpt_init();
10731073   MACHINE_RESET_CALL(seibu_sound);
10741074
1075   memory_set_bank(machine, "mainbank", 8);
1075   state->membank("mainbank")->set_entry(8);
10761076
10771077   state->prg_bank = 0x08;
10781078
r14976r14977
10881088   sprcpt_init();
10891089   MACHINE_RESET_CALL(seibu_sound);
10901090
1091   memory_set_bank(machine, "mainbank", 1);
1091   state->membank("mainbank")->set_entry(1);
10921092
10931093   state->prg_bank = 0;
10941094   //cop_init();
r14976r14977
11031103   sprcpt_init();
11041104   MACHINE_RESET_CALL(seibu_sound);
11051105
1106   //memory_set_bank(machine, "mainbank", 1);
1106   state->membank("mainbank")->set_entry(1);
11071107
11081108   //cop_init();
11091109}
r14976r14977
11221122{
11231123   if(ACCESSING_BITS_8_15) {
11241124      logerror("select bank %d %04x\n", (data >> 15) & 1, data);
1125      memory_set_bank(space.machine(), "mainbank", !((data >> 15) & 1));
1125      space.machine().root_device().membank("mainbank")->set_entry(!((data >> 15) & 1));
11261126      prg_bank = ((data >> 15) & 1);
11271127   }
11281128}
r14976r14977
28942894
28952895static DRIVER_INIT (raiden2)
28962896{
2897   memory_configure_bank(machine, "mainbank", 0, 2, machine.region("mainprg")->base(), 0x20000);
2897   machine.root_device().membank("mainbank")->configure_entries(0, 2, machine.root_device().memregion("mainprg")->base(), 0x20000);
28982898   raiden2_decrypt_sprites(machine);
28992899}
29002900
29012901static DRIVER_INIT (raidendx)
29022902{
2903   memory_configure_bank(machine, "mainbank", 0, 0x10, machine.region("mainprg")->base(), 0x20000);
2903   machine.root_device().membank("mainbank")->configure_entries(0, 0x10, machine.root_device().memregion("mainprg")->base(), 0x20000);
29042904   raiden2_decrypt_sprites(machine);
29052905}
29062906
29072907static DRIVER_INIT (xsedae)
29082908{
29092909   /* doesn't have banking */
2910   //memory_configure_bank(machine, "mainbank", 0, 2, machine.region("mainprg")->base(), 0x20000);
2910   //machine.root_device().membank("mainbank")->configure_entries(0, 2, machine.root_device().memregion("mainprg")->base(), 0x20000);
29112911}
29122912
29132913static DRIVER_INIT (zeroteam)
29142914{
2915   memory_configure_bank(machine, "mainbank", 0, 2, machine.region("mainprg")->base(), 0x20000);
2915   machine.root_device().membank("mainbank")->configure_entries(0, 2, machine.root_device().memregion("mainprg")->base(), 0x20000);
29162916   zeroteam_decrypt_sprites(machine);
29172917}
29182918
src/mame/drivers/mogura.c
r14976r14977
3232
3333static PALETTE_INIT( mogura )
3434{
35   const UINT8 *color_prom = machine.region("proms")->base();
35   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
3636   int i, j;
3737
3838   j = 0;
src/mame/drivers/taitojc.c
r14976r14977
919919
920920READ16_MEMBER(taitojc_state::dsp_rom_r)
921921{
922   UINT16 *rom = (UINT16*)machine().region("gfx2")->base();
922   UINT16 *rom = (UINT16*)machine().root_device().memregion("gfx2")->base();
923923   UINT16 data = rom[m_dsp_rom_pos++];
924924
925925   //mame_printf_debug("dsp_rom_r:  %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space.device()));
src/mame/drivers/magtouch.c
r14976r14977
158158   switch(offset)
159159   {
160160      case 6:
161         memory_set_bank(machine(), "rombank", data & 0x7f );
161         membank("rombank")->set_entry(data & 0x7f );
162162         break;
163163   }
164164}
r14976r14977
201201
202202   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, magtouch_set_keyb_int);
203203
204   memory_configure_bank(machine, "rombank", 0, 0x80, machine.region("game_prg")->base(), 0x8000 );
205   memory_set_bank(machine, "rombank", 0);
204   machine.root_device().membank("rombank")->configure_entries(0, 0x80, machine.root_device().memregion("game_prg")->base(), 0x8000 );
205   machine.root_device().membank("rombank")->set_entry(0);
206206
207207//  microtouch_init(machine, magtouch_microtouch_tx_callback, NULL);
208208}
src/mame/drivers/igs009.c
r14976r14977
783783static DRIVER_INIT( jingbell )
784784{
785785   int i;
786   UINT8 *rom  = (UINT8 *)machine.region("maincpu")->base();
787   size_t size = machine.region("maincpu")->bytes();
786   UINT8 *rom  = (UINT8 *)machine.root_device().memregion("maincpu")->base();
787   size_t size = machine.root_device().memregion("maincpu")->bytes();
788788
789789   for (i=0; i<size; i++)
790790   {
src/mame/drivers/spy.c
r14976r14977
161161   else
162162      bank = ((data & 0x0e) >> 1);
163163
164   memory_set_bank(machine(), "bank1", bank);
164   membank("bank1")->set_entry(bank);
165165}
166166
167167static void spy_collision( running_machine &machine )
r14976r14977
498498static MACHINE_START( spy )
499499{
500500   spy_state *state = machine.driver_data<spy_state>();
501   UINT8 *ROM = machine.region("maincpu")->base();
501   UINT8 *ROM = state->memregion("maincpu")->base();
502502
503   memory_configure_bank(machine, "bank1", 0, 12, &ROM[0x10000], 0x2000);
503   state->membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x2000);
504504
505505   state->m_generic_paletteram_8.allocate(0x800);
506506   memset(state->m_pmcram, 0, sizeof(state->m_pmcram));
src/mame/drivers/blitz68k.c
r14976r14977
242242
243243WRITE16_MEMBER(blitz68k_state::blit_copy_w)
244244{
245   UINT8 *blit_rom = machine().region("blitter")->base();
245   UINT8 *blit_rom = memregion("blitter")->base();
246246   UINT32 blit_dst_xpos;
247247   UINT32 blit_dst_ypos;
248248   int x,y,x_size,y_size;
r14976r14977
430430
431431WRITE8_MEMBER(blitz68k_state::blit_draw_w)
432432{
433   UINT8 *blit_rom  = machine().region("blitter")->base();
434   int blit_romsize = machine().region("blitter")->bytes();
433   UINT8 *blit_rom  = memregion("blitter")->base();
434   int blit_romsize = memregion("blitter")->bytes();
435435   UINT32 blit_dst_xpos;
436436   UINT32 blit_dst_ypos;
437437   int x, y, x_size, y_size;
r14976r14977
26902690
26912691static DRIVER_INIT( bankrob )
26922692{
2693   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2693   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
26942694
26952695   // WRONG C8 #1
26962696   ROM[0xb5e0/2] = 0x6028;
r14976r14977
27052705
27062706static DRIVER_INIT( bankroba )
27072707{
2708   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2708   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27092709
27102710   // WRONG C8 #1
27112711   ROM[0x11e4e/2] = 0x6028;
r14976r14977
27202720
27212721static DRIVER_INIT( cjffruit )
27222722{
2723   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2723   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27242724
27252725   // WRONG C8 #1
27262726   ROM[0xf564/2] = 0x6028;
r14976r14977
27312731
27322732static DRIVER_INIT( deucesw2 )
27332733{
2734   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2734   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27352735
27362736   // WRONG C8 #1
27372737   ROM[0x8fe4/2] = 0x6020;
r14976r14977
27422742
27432743static DRIVER_INIT( dualgame )
27442744{
2745   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2745   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27462746
27472747   // WRONG C8 #1
27482748   ROM[0xa518/2] = 0x6024;
r14976r14977
27532753
27542754static DRIVER_INIT( hermit )
27552755{
2756   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2756   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27572757
27582758   // WRONG C8 #1
27592759   ROM[0xdeba/2] = 0x602e;
r14976r14977
27702770
27712771static DRIVER_INIT( maxidbl )
27722772{
2773   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2773   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27742774
27752775   // WRONG C8 #1
27762776   ROM[0xb384/2] = 0x6036;
r14976r14977
27812781
27822782static DRIVER_INIT( megadblj )
27832783{
2784   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2784   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27852785
27862786   // WRONG C8 #1
27872787   ROM[0xe21c/2] = 0x6040;
r14976r14977
27922792
27932793static DRIVER_INIT( megadble )
27942794{
2795   UINT16 *ROM = (UINT16 *)machine.region("maincpu")->base();
2795   UINT16 *ROM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
27962796
27972797   // WRONG C8 #1
27982798   ROM[0xcfc2/2] = 0x4e71;
src/mame/drivers/psikyo.c
r14976r14977
337337      // not at all sure about this, it seems to write 0 too often
338338      UINT8 bank = (data & 0x00ff0000) >> 16;
339339      if (bank < 4)
340         memory_set_bank(machine(), "okibank", bank);
340         membank("okibank")->set_entry(bank);
341341   }
342342
343343   if (ACCESSING_BITS_8_15)
r14976r14977
403403
404404WRITE8_MEMBER(psikyo_state::sngkace_sound_bankswitch_w)
405405{
406   memory_set_bank(machine(), "bank1", data & 0x03);
406   membank("bank1")->set_entry(data & 0x03);
407407}
408408
409409static ADDRESS_MAP_START( sngkace_sound_map, AS_PROGRAM, 8, psikyo_state )
r14976r14977
427427
428428WRITE8_MEMBER(psikyo_state::gunbird_sound_bankswitch_w)
429429{
430   memory_set_bank(machine(), "bank1", (data >> 4) & 0x03);
430   membank("bank1")->set_entry((data >> 4) & 0x03);
431431}
432432
433433static ADDRESS_MAP_START( gunbird_sound_map, AS_PROGRAM, 8, psikyo_state )
r14976r14977
18111811   psikyo_state *state = machine.driver_data<psikyo_state>();
18121812
18131813   {
1814      UINT8 *RAM = machine.region("ymsnd")->base();
1815      int len = machine.region("ymsnd")->bytes();
1814      UINT8 *RAM = machine.root_device().memregion("ymsnd")->base();
1815      int len = state->memregion("ymsnd")->bytes();
18161816      int i;
18171817
18181818      /* Bit 6&7 of the samples are swapped. Naughty, naughty... */
r14976r14977
18321832   state->m_ka302c_banking = 0; // SH201B doesn't have any gfx banking
18331833
18341834   /* setup audiocpu banks */
1835   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000, 0x8000);
1835   state->membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x8000);
18361836
18371837   /* Enable other regions */
18381838#if 0
18391839   if (!strcmp(machine.system().name,"sngkace"))
18401840   {
1841      UINT8 *ROM   =   machine.region("maincpu")->base();
1841      UINT8 *ROM   =   machine.root_device().memregion("maincpu")->base();
18421842      ROM[0x995] = 0x4e;
18431843      ROM[0x994] = 0x71;
18441844      ROM[0x997] = 0x4e;
r14976r14977
18921892
18931893   /* setup audiocpu banks */
18941894   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1895   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1895   state->membank("bank1")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
18961896}
18971897
18981898static DRIVER_INIT( gunbird )
r14976r14977
19091909
19101910   /* setup audiocpu banks */
19111911   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1912   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1912   state->membank("bank1")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
19131913}
19141914
19151915
r14976r14977
19331933
19341934   /* setup audiocpu banks */
19351935   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1936   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1936   state->membank("bank1")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
19371937}
19381938
19391939static DRIVER_INIT( s1945a )
r14976r14977
19561956
19571957   /* setup audiocpu banks */
19581958   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1959   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1959   state->membank("bank1")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
19601960}
19611961
19621962static DRIVER_INIT( s1945j )
r14976r14977
19791979
19801980   /* setup audiocpu banks */
19811981   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1982   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1982   state->membank("bank1")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
19831983}
19841984
19851985static DRIVER_INIT( s1945jn )
r14976r14977
19961996
19971997   /* setup audiocpu banks */
19981998   /* The banked rom is seen at 8200-ffff, so the last 0x200 bytes of the rom not reachable. */
1999   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
1999   state->membank("bank1")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000 + 0x200, 0x8000);
20002000}
20012001
20022002static DRIVER_INIT( s1945bl )
r14976r14977
20112011
20122012   state->m_ka302c_banking = 1;
20132013
2014   memory_configure_bank(machine, "okibank", 0, 4, machine.region("oki")->base() + 0x30000, 0x10000);
2015   memory_set_bank(machine, "okibank", 0);
2014   state->membank("okibank")->configure_entries(0, 4, state->memregion("oki")->base() + 0x30000, 0x10000);
2015   state->membank("okibank")->set_entry(0);
20162016}
20172017
20182018
src/mame/drivers/dacholer.c
r14976r14977
606606/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
607607static PALETTE_INIT( dacholer )
608608{
609   const UINT8 *color_prom = machine.region("proms")->base();
609   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
610610   static const int resistances_rg[3] = { 1000, 470, 220 };
611611   static const int resistances_b [2] = { 470, 220 };
612612   double weights_rg[3], weights_b[2];
src/mame/drivers/esd16.c
r14976r14977
226226   int bank = data & 0xf;
227227   if (data != bank)   logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", cpu_get_pc(&space.device()), data);
228228   if (bank >= 3)   bank += 1;
229   memory_set_bank(machine(), "bank1", bank);
229   membank("bank1")->set_entry(bank);
230230}
231231
232232static ADDRESS_MAP_START( multchmp_sound_map, AS_PROGRAM, 8, esd16_state )
r14976r14977
518518static MACHINE_START( esd16 )
519519{
520520   esd16_state *state = machine.driver_data<esd16_state>();
521   UINT8 *AUDIO = machine.region("audiocpu")->base();
521   UINT8 *AUDIO = state->memregion("audiocpu")->base();
522522
523   memory_configure_bank(machine, "bank1", 0, 17, &AUDIO[0x0000], 0x4000);
523   state->membank("bank1")->configure_entries(0, 17, &AUDIO[0x0000], 0x4000);
524524
525525   state->m_audio_cpu = machine.device("audiocpu");
526526   state->m_eeprom = machine.device<eeprom_device>("eeprom");
src/mame/drivers/model3.c
r14976r14977
12771277   state->m_sound_irq_enable = 0;
12781278   state->m_sound_timer->adjust(attotime::never);
12791279
1280   memory_set_bankptr(machine,  "bank1", machine.region( "user1" )->base() + 0x800000 ); /* banked CROM */
1280   state->membank("bank1")->set_base(machine.root_device().memregion( "user1" )->base() + 0x800000 ); /* banked CROM */
12811281
1282   memory_set_bankptr(machine, "bank4", machine.region("samples")->base() + 0x200000);
1283   memory_set_bankptr(machine, "bank5", machine.region("samples")->base() + 0x600000);
1282   state->membank("bank4")->set_base(machine.root_device().memregion("samples")->base() + 0x200000);
1283   state->membank("bank5")->set_base(machine.root_device().memregion("samples")->base() + 0x600000);
12841284
12851285   // copy the 68k vector table into RAM
1286   memcpy(state->m_soundram, machine.region("audiocpu")->base()+0x80000, 16);
1286   memcpy(state->m_soundram, state->memregion("audiocpu")->base()+0x80000, 16);
12871287   machine.device("audiocpu")->reset();
12881288
12891289   model3_machine_init(machine, step);   // step 1.5
r14976r14977
15891589            data >>= 56;
15901590            data = (~data) & 0x7;
15911591
1592            memory_set_bankptr(machine(),  "bank1", machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1592            membank("bank1")->set_base(machine().root_device().memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
15931593         }
15941594         if (ACCESSING_BITS_24_31)
15951595         {
r14976r14977
18451845   {
18461846      data >>= 56;
18471847      data = (~data) & 0xf;
1848      memory_set_bankptr(machine(),  "bank1", machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1849      memory_set_bankptr(machine(),  "bank2", machine().region( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1848      membank("bank1")->set_base(machine().root_device().memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1849      membank("bank2")->set_base(machine().root_device().memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
18501850   }
18511851}
18521852
r14976r14977
50445044WRITE16_MEMBER(model3_state::model3snd_ctrl)
50455045{
50465046   // handle sample banking
5047   if (machine().region("scsp2")->bytes() > 0x800000)
5047   if (machine().root_device().memregion("scsp2")->bytes() > 0x800000)
50485048   {
5049      UINT8 *snd = machine().region("scsp2")->base();
5049      UINT8 *snd = memregion("scsp2")->base();
50505050      if (data & 0x20)
50515051      {
5052         memory_set_bankptr(machine(), "bank4", snd + 0x200000);
5053         memory_set_bankptr(machine(), "bank5", snd + 0x600000);
5052         membank("bank4")->set_base(snd + 0x200000);
5053         membank("bank5")->set_base(snd + 0x600000);
50545054      }
50555055      else
50565056      {
5057         memory_set_bankptr(machine(), "bank4", snd + 0x800000);
5058         memory_set_bankptr(machine(), "bank5", snd + 0xa00000);
5057         membank("bank4")->set_base(snd + 0x800000);
5058         membank("bank5")->set_base(snd + 0xa00000);
50595059      }
50605060   }
50615061}
r14976r14977
53025302   model3_state *state = machine.driver_data<model3_state>();
53035303   int start;
53045304   int i,j,x;
5305   UINT16 *vrom1 = (UINT16*)machine.region("user3")->base();
5306   UINT16 *vrom2 = (UINT16*)machine.region("user4")->base();
5307   int vrom_length = machine.region("user3")->bytes();
5305   UINT16 *vrom1 = (UINT16*)machine.root_device().memregion("user3")->base();
5306   UINT16 *vrom2 = (UINT16*)machine.root_device().memregion("user4")->base();
5307   int vrom_length = state->memregion("user3")->bytes();
53085308   UINT16 *vrom;
53095309
53105310   state->m_vrom = auto_alloc_array(machine, UINT32, 0x4000000/4);
r14976r14977
53695369static DRIVER_INIT( lostwsga )
53705370{
53715371   model3_state *state = machine.driver_data<model3_state>();
5372   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5372   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
53735373
53745374   DRIVER_INIT_CALL(model3_15);
53755375   /* TODO: there's an M68K device at 0xC0000000 - FF, maybe lightgun controls ? */
r14976r14977
53815381static DRIVER_INIT( scud )
53825382{
53835383   model3_state *state = machine.driver_data<model3_state>();
5384   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5384   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
53855385
53865386   DRIVER_INIT_CALL(model3_15);
53875387   /* TODO: network device at 0xC0000000 - FF */
r14976r14977
53945394static DRIVER_INIT( scudp )
53955395{
53965396   model3_state *state = machine.driver_data<model3_state>();
5397   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5397   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
53985398
53995399   DRIVER_INIT_CALL(model3_15);
54005400   /* TODO: network device at 0xC0000000 - FF */
r14976r14977
54125412static DRIVER_INIT( lemans24 )
54135413{
54145414   model3_state *state = machine.driver_data<model3_state>();
5415   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5415   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
54165416   DRIVER_INIT_CALL(model3_15);
54175417
54185418   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),state), write64_delegate(FUNC(model3_state::scsi_w),state));
r14976r14977
54265426
54275427static DRIVER_INIT( vf3 )
54285428{
5429   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5429   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
54305430
54315431   DRIVER_INIT_CALL(model3_10);
54325432
r14976r14977
54405440static DRIVER_INIT( vs215 )
54415441{
54425442   model3_state *state = machine.driver_data<model3_state>();
5443   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5443   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
54445444
54455445   rom[(0x70dde0^4)/4] = 0x60000000;
54465446   rom[(0x70e6f0^4)/4] = 0x60000000;
r14976r14977
54615461static DRIVER_INIT( vs29815 )
54625462{
54635463   model3_state *state = machine.driver_data<model3_state>();
5464   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5464   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
54655465
54665466   rom[(0x6028ec^4)/4] = 0x60000000;
54675467   rom[(0x60290c^4)/4] = 0x60000000;
r14976r14977
54815481static DRIVER_INIT( bass )
54825482{
54835483   model3_state *state = machine.driver_data<model3_state>();
5484   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5484   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
54855485
54865486   rom[(0x7999a8^4)/4] = 0x60000000;
54875487   rom[(0x7999c8^4)/4] = 0x60000000;
r14976r14977
55135513
55145514static DRIVER_INIT( vs2 )
55155515{
5516   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5516   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
55175517
55185518   DRIVER_INIT_CALL(model3_20);
55195519
r14976r14977
55235523
55245524static DRIVER_INIT( vs298 )
55255525{
5526   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5526   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
55275527
55285528   DRIVER_INIT_CALL(model3_20);
55295529
r14976r14977
55345534
55355535static DRIVER_INIT( vs2v991 )
55365536{
5537   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5537   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
55385538
55395539   DRIVER_INIT_CALL(model3_20);
55405540
r14976r14977
55445544
55455545static DRIVER_INIT( vs299b )
55465546{
5547   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5547   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
55485548
55495549   DRIVER_INIT_CALL(model3_20);
55505550
r14976r14977
55545554
55555555static DRIVER_INIT( vs299a )
55565556{
5557   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5557   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
55585558
55595559   DRIVER_INIT_CALL(model3_20);
55605560
r14976r14977
55645564
55655565static DRIVER_INIT( vs299 )
55665566{
5567   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5567   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
55685568
55695569   DRIVER_INIT_CALL(model3_20);
55705570
r14976r14977
55755575static DRIVER_INIT( harley )
55765576{
55775577   model3_state *state = machine.driver_data<model3_state>();
5578   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5578   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
55795579   DRIVER_INIT_CALL(model3_20);
55805580
55815581   state->m_network_ram = auto_alloc_array_clear(machine, UINT64, 0x10000);
r14976r14977
55915591static DRIVER_INIT( harleyb )
55925592{
55935593   model3_state *state = machine.driver_data<model3_state>();
5594   //UINT32 *rom = (UINT32*)machine.region("user1")->base();
5594   //UINT32 *rom = (UINT32*)state->memregion("user1")->base();
55955595   DRIVER_INIT_CALL(model3_20);
55965596
55975597   state->m_network_ram = auto_alloc_array_clear(machine, UINT64, 0x10000);
r14976r14977
56075607
56085608static DRIVER_INIT( srally2 )
56095609{
5610   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5610   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
56115611   DRIVER_INIT_CALL(model3_20);
56125612
56135613   rom[(0x7c0c4^4)/4] = 0x60000000;
r14976r14977
56175617
56185618static DRIVER_INIT( swtrilgy )
56195619{
5620   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5620   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
56215621   DRIVER_INIT_CALL(model3_20);
56225622
56235623   rom[(0xf0e48^4)/4] = 0x60000000;
r14976r14977
56285628
56295629static DRIVER_INIT( swtrilga )
56305630{
5631   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5631   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
56325632   DRIVER_INIT_CALL(model3_20);
56335633
56345634   rom[(0xf6dd0^4)/4] = 0x60000000;
r14976r14977
56365636
56375637static DRIVER_INIT( von2 )
56385638{
5639   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5639   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
56405640   DRIVER_INIT_CALL(model3_20);
56415641
56425642   rom[(0x189168^4)/4] = 0x60000000;
r14976r14977
56485648
56495649static DRIVER_INIT( dirtdvls )
56505650{
5651   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5651   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
56525652   DRIVER_INIT_CALL(model3_20);
56535653
56545654   rom[(0x0600a0^4)/4] = 0x60000000;
r14976r14977
56625662static DRIVER_INIT( daytona2 )
56635663{
56645664   model3_state *state = machine.driver_data<model3_state>();
5665   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5665   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
56665666   DRIVER_INIT_CALL(model3_20);
56675667
56685668   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),state));
r14976r14977
56775677static DRIVER_INIT( dayto2pe )
56785678{
56795679   model3_state *state = machine.driver_data<model3_state>();
5680   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5680   UINT32 *rom = (UINT32*)state->memregion("user1")->base();
56815681   DRIVER_INIT_CALL(model3_20);
56825682
56835683   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),state));
r14976r14977
56925692
56935693static DRIVER_INIT( spikeout )
56945694{
5695   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5695   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
56965696   DRIVER_INIT_CALL(model3_20);
56975697
56985698   rom[(0x6059cc^4)/4] = 0x60000000;
r14976r14977
57015701
57025702static DRIVER_INIT( spikeofe )
57035703{
5704   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5704   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
57055705   DRIVER_INIT_CALL(model3_20);
57065706
57075707   rom[(0x6059cc^4)/4] = 0x60000000;
r14976r14977
57105710
57115711static DRIVER_INIT( eca )
57125712{
5713   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5713   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
57145714   DRIVER_INIT_CALL(model3_20);
57155715
57165716   rom[(0x535580^4)/4] = 0x60000000;
r14976r14977
57205720
57215721static DRIVER_INIT( skichamp )
57225722{
5723   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5723   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
57245724   DRIVER_INIT_CALL(model3_20);
57255725
57265726   rom[(0x5263c8^4)/4] = 0x60000000;
r14976r14977
57315731
57325732static DRIVER_INIT( oceanhun )
57335733{
5734   UINT32 *rom = (UINT32*)machine.region("user1")->base();
5734   UINT32 *rom = (UINT32*)machine.root_device().memregion("user1")->base();
57355735   DRIVER_INIT_CALL(model3_20);
57365736
57375737   rom[(0x57995c^4)/4] = 0x60000000;   // decrementer
src/mame/drivers/iqblock.c
r14976r14977
9595
9696READ8_MEMBER(iqblock_state::extrarom_r)
9797{
98   return machine().region("user1")->base()[offset];
98   return memregion("user1")->base()[offset];
9999}
100100
101101
r14976r14977
431431static DRIVER_INIT( iqblock )
432432{
433433   iqblock_state *state = machine.driver_data<iqblock_state>();
434   UINT8 *rom = machine.region("maincpu")->base();
434   UINT8 *rom = state->memregion("maincpu")->base();
435435   int i;
436436
437437   /* decrypt the program ROM */
r14976r14977
454454static DRIVER_INIT( grndtour )
455455{
456456   iqblock_state *state = machine.driver_data<iqblock_state>();
457   UINT8 *rom = machine.region("maincpu")->base();
457   UINT8 *rom = state->memregion("maincpu")->base();
458458   int i;
459459
460460   /* decrypt the program ROM */
src/mame/drivers/cb2001.c
r14976r14977
776776   {
777777      int r,g,b;
778778
779      UINT8*proms = machine.region("proms")->base();
780      int length = machine.region("proms")->bytes();
779      UINT8*proms = machine.root_device().memregion("proms")->base();
780      int length = machine.root_device().memregion("proms")->bytes();
781781      UINT16 dat;
782782
783783      dat = (proms[0x000+i] << 8) | proms[0x200+i];
src/mame/drivers/xexex.c
r14976r14977
237237static void reset_sound_region(running_machine &machine)
238238{
239239   xexex_state *state = machine.driver_data<xexex_state>();
240   memory_set_bank(machine, "bank2", state->m_cur_sound_region & 0x07);
240   state->membank("bank2")->set_entry(state->m_cur_sound_region & 0x07);
241241}
242242
243243WRITE8_MEMBER(xexex_state::sound_bankswitch_w)
r14976r14977
456456static MACHINE_START( xexex )
457457{
458458   xexex_state *state = machine.driver_data<xexex_state>();
459   UINT8 *ROM = machine.region("audiocpu")->base();
459   UINT8 *ROM = state->memregion("audiocpu")->base();
460460
461   memory_configure_bank(machine, "bank2", 0, 8, &ROM[0x10000], 0x4000);
462   memory_set_bank(machine, "bank2", 0);
461   state->membank("bank2")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
462   state->membank("bank2")->set_entry(0);
463463
464464   state->m_maincpu = machine.device("maincpu");
465465   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
684684   if (!strcmp(machine.system().name, "xexex"))
685685   {
686686      // Invulnerability
687//      *(UINT16 *)(machine.region("maincpu")->base() + 0x648d4) = 0x4a79;
688//      *(UINT16 *)(machine.region("maincpu")->base() + 0x00008) = 0x5500;
687//      *(UINT16 *)(machine.root_device().memregion("maincpu")->base() + 0x648d4) = 0x4a79;
688//      *(UINT16 *)(state->memregion("maincpu")->base() + 0x00008) = 0x5500;
689689      state->m_strip_0x1a = 1;
690690   }
691691}
src/mame/drivers/wallc.c
r14976r14977
9494
9595static PALETTE_INIT( wallc )
9696{
97   const UINT8 *color_prom = machine.region("proms")->base();
97   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9898   int i;
9999
100100   static const int resistances_rg[2] = { 330, 220 };
r14976r14977
259259   UINT8 c;
260260   UINT32 i;
261261
262   UINT8 *ROM = machine.region("maincpu")->base();
262   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
263263
264264   for (i=0; i<0x2000*2; i++)
265265   {
r14976r14977
274274   UINT8 c;
275275   UINT32 i;
276276
277   UINT8 *ROM = machine.region("maincpu")->base();
277   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
278278
279279   for (i=0; i<0x4000; i++)
280280   {
src/mame/drivers/marinedt.c
r14976r14977
187187   //xxxx---- unknown
188188   //----xxxx x pos in tile ram
189189
190   UINT8 *RAM = machine().region("maincpu")->base();
190   UINT8 *RAM = memregion("maincpu")->base();
191191
192192   if (RAM[0x430e])
193193      --m_cx;
r14976r14977
445445
446446static PALETTE_INIT( marinedt )
447447{
448   const UINT8 *color_prom = machine.region("proms")->base();
448   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
449449   int i,r,b,g;
450450
451451   for (i = 0; i < machine.total_colors(); i++)
src/mame/drivers/skullxbo.c
r14976r14977
619619static DRIVER_INIT( skullxbo )
620620{
621621   atarijsa_init(machine, "FF5802", 0x0080);
622   memset(machine.region("gfx1")->base() + 0x170000, 0, 0x20000);
622   memset(machine.root_device().memregion("gfx1")->base() + 0x170000, 0, 0x20000);
623623}
624624
625625
src/mame/drivers/sliver.c
r14976r14977
165165{
166166   sliver_state *state = machine.driver_data<sliver_state>();
167167   int tmpptr=0;
168   const UINT8 *rom = machine.region("user1")->base();
168   const UINT8 *rom = state->memregion("user1")->base();
169169
170170   while (tmpptr < state->m_fptr)
171171   {
r14976r14977
239239      cinfo.err = jpeg_std_error(&jerr);
240240      jpeg_create_decompress(&cinfo);
241241
242      jpeg_mem_src(&cinfo, machine.region("user2")->base()+addr, machine.region("user2")->bytes()-addr);
242      jpeg_mem_src(&cinfo, machine.root_device().memregion("user2")->base()+addr, machine.root_device().memregion("user2")->bytes()-addr);
243243
244244      jpeg_read_header(&cinfo, TRUE);
245245      jpeg_start_decompress(&cinfo);
r14976r14977
349349
350350WRITE8_MEMBER(sliver_state::oki_setbank)
351351{
352   UINT8 *sound = machine().region("oki")->base();
352   UINT8 *sound = memregion("oki")->base();
353353   int bank=(data^0xff)&3; //xor or not ?
354354   memcpy(sound+0x20000, sound+0x100000+0x20000*bank, 0x20000);
355355}
src/mame/drivers/epos.c
r14976r14977
4444
4545//  logerror("PC %08x: ctr=%04x\n",cpu_get_pc(&space.device()), m_counter);
4646
47   memory_set_bank(machine(), "bank1", m_counter);
47   membank("bank1")->set_entry(m_counter);
4848
4949   // is the 2nd bank changed by the counter or it always uses the 1st key?
5050}
r14976r14977
101101*/
102102static WRITE8_DEVICE_HANDLER( write_prtc )
103103{
104   memory_set_bank(device->machine(), "bank2", data & 0x01);
104   device->machine().root_device().membank("bank2")->set_entry(data & 0x01);
105105}
106106
107107static const ppi8255_interface ppi8255_intf =
r14976r14977
381381
382382static MACHINE_START( dealer )
383383{
384   UINT8 *ROM = machine.region("maincpu")->base();
385   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x0000], 0x10000);
386   memory_configure_bank(machine, "bank2", 0, 2, &ROM[0x6000], 0x1000);
384   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
385   machine.root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x0000], 0x10000);
386   machine.root_device().membank("bank2")->configure_entries(0, 2, &ROM[0x6000], 0x1000);
387387
388   memory_set_bank(machine, "bank1", 0);
389   memory_set_bank(machine, "bank2", 0);
388   machine.root_device().membank("bank1")->set_entry(0);
389   machine.root_device().membank("bank2")->set_entry(0);
390390
391391   MACHINE_START_CALL(epos);
392392}
r14976r14977
607607
608608static DRIVER_INIT( dealer )
609609{
610   UINT8 *rom = machine.region("maincpu")->base();
610   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
611611   int A;
612612
613613   /* Key 0 */
src/mame/drivers/cps3.c
r14976r14977
663663{
664664   cps3_state *state = machine.driver_data<cps3_state>();
665665   int i;
666   UINT32 *coderegion = (UINT32*)machine.region("user1")->base();
666   UINT32 *coderegion = (UINT32*)machine.root_device().memregion("user1")->base();
667667
668   state->m_decrypted_bios = (UINT32*)machine.region("user1")->base();
668   state->m_decrypted_bios = (UINT32*)state->memregion("user1")->base();
669669
670670   for (i=0;i<0x80000;i+=4)
671671   {
r14976r14977
701701   state->m_altEncryption = altEncryption;
702702
703703   // cache pointers to regions
704   state->m_user4region = machine.region("user4")->base();
705   state->m_user5region = machine.region("user5")->base();
704   state->m_user4region = machine.root_device().memregion("user4")->base();
705   state->m_user5region = state->memregion("user5")->base();
706706
707707   if (!state->m_user4region) state->m_user4region = auto_alloc_array(machine, UINT8, USER4REGION_LENGTH);
708708   if (!state->m_user5region) state->m_user5region = auto_alloc_array(machine, UINT8, USER5REGION_LENGTH);
r14976r14977
12831283   /* BIOS ROM */
12841284   if (address < 0x80000)
12851285   {
1286      direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, *direct.space().machine().region("user1"));
1286      direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, *direct.space().machine().root_device().memregion("user1"));
12871287      return ~0;
12881288   }
12891289   /* RAM */
r14976r14977
32713271    OCEANIA 7
32723272    ASIA NCD 8
32733273
3274    UINT32 *rom =  (UINT32*)machine.region ( "user1" )->base();
3274    UINT32 *rom =  (UINT32*)machine.root_device().memregion ( "user1" )->base();
32753275    rom[0x1fed8/4]^=0x00000001; // clear region to 0 (invalid)
32763276    rom[0x1fed8/4]^=0x00000008; // region 8 - ASIA NO CD - doesn't actually skip the CD
32773277                                // test on startup, only during game, must be another flag
r14976r14977
32963296
32973297    // bios rom also lists korea, but game rom does not.
32983298
3299    UINT32 *rom =  (UINT32*)machine.region ( "user1" )->base();
3299    UINT32 *rom =  (UINT32*)machine.root_device().memregion ( "user1" )->base();
33003300    rom[0x1fec8/4]^=0x00000001; // region (clear region)
33013301    rom[0x1fec8/4]^=0x00000008; // region
33023302    rom[0x1fecc/4]^=0x01000000; // nocd - this ONLY skips the cd check in the bios test
r14976r14977
33183318    OCEANIA 7
33193319    ASIA 8
33203320
3321    UINT32 *rom =  (UINT32*)machine.region ( "user1" )->base();
3321    UINT32 *rom =  (UINT32*)machine.root_device().memregion ( "user1" )->base();
33223322    rom[0x1fec8/4]^=0x00000001; // region (clear region)
33233323    rom[0x1fec8/4]^=0x00000008; // region
33243324    rom[0x1fecc/4]^=0x01000000; // nocd - this ONLY skips the cd check in the bios test
r14976r14977
33423342
33433343    DEVELOPMENT VERSION add 0x70 mask!
33443344
3345    UINT32 *rom =  (UINT32*)machine.region ( "user1" )->base();
3345    UINT32 *rom =  (UINT32*)machine.root_device().memregion ( "user1" )->base();
33463346    rom[0x1fec8/4]^=0x00000001; // region hack (clear jpn)
33473347
33483348    rom[0x1fec8/4]^=0x00000004; // region
r14976r14977
33633363    BRAZIL 6
33643364    OCEANIA 7
33653365
3366    UINT32 *rom =  (UINT32*)machine.region ( "user1" )->base();
3366    UINT32 *rom =  (UINT32*)machine.root_device().memregion ( "user1" )->base();
33673367    rom[0x1fec8/4]^=0x00000004; // region (clear region)
33683368    rom[0x1fec8/4]^=0x00000001; // region
33693369    rom[0x1fecc/4]^=0x01000000; // nocd
r14976r14977
33853385
33863386    DEVELOPMENT VERSION add 0x70 mask!
33873387
3388    UINT32 *rom =  (UINT32*)machine.region ( "user1" )->base();
3388    UINT32 *rom =  (UINT32*)machine.root_device().memregion ( "user1" )->base();
33893389    rom[0x1fec8/4]^=0x00000001; // region (clear jpn)
33903390    rom[0x1fec8/4]^=0x00000002; // region
33913391    rom[0x1fec8/4]^=0x00000070; // DEV mode
src/mame/drivers/glass.c
r14976r14977
5454
5555WRITE16_MEMBER(glass_state::OKIM6295_bankswitch_w)
5656{
57   UINT8 *RAM = machine().region("oki")->base();
57   UINT8 *RAM = memregion("oki")->base();
5858
5959   if (ACCESSING_BITS_0_7)
6060      memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f) * 0x10000], 0x10000);
r14976r14977
297297   int i;
298298
299299   /* get a pointer to the source data */
300   UINT8 *src = (UINT8 *)machine.region(src_reg)->base();
300   UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base();
301301
302302   /* get a pointer to the destination data */
303   UINT8 *dst = (UINT8 *)machine.region(dst_reg)->base();
303   UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base();
304304
305305   /* fill destination areas with the proper data */
306306   for (i = 0; i < length / 2; i++)
src/mame/drivers/spiders.c
r14976r14977
545545
546546   if (state->m_gfx_rom_ctrl_mode)
547547   {
548      UINT8 *rom = device->machine().region("gfx1")->base();
548      UINT8 *rom = state->memregion("gfx1")->base();
549549
550550      ret = rom[state->m_gfx_rom_address];
551551
src/mame/drivers/subsino.c
r14976r14977
548548
549549static PALETTE_INIT( subsino_2proms )
550550{
551   const UINT8 *color_prom = machine.region("proms")->base();
551   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
552552   int i,r,g,b,val;
553553   int bit0,bit1,bit2;
554554
r14976r14977
575575
576576static PALETTE_INIT( subsino_3proms )
577577{
578   const UINT8 *color_prom = machine.region("proms")->base();
578   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
579579   int i,r,g,b,val;
580580   int bit0,bit1,bit2;
581581
r14976r14977
33623362
33633363static DRIVER_INIT( smoto16 )
33643364{
3365   UINT8 *rom = machine.region( "maincpu" )->base();
3365   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
33663366   rom[0x12d0] = 0x20;   // "ERROR 951010"
33673367}
33683368
r14976r14977
35123512
35133513static DRIVER_INIT( smoto20 )
35143514{
3515   UINT8 *rom = machine.region( "maincpu" )->base();
3515   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
35163516   rom[0x12e1] = 0x20;   // "ERROR 951010"
35173517}
35183518
35193519static DRIVER_INIT( tisub )
35203520{
3521   UINT8 *rom = machine.region( "maincpu" )->base();
3521   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
35223522
35233523   DRIVER_INIT_CALL(victor5);
35243524
r14976r14977
35333533
35343534static DRIVER_INIT( tisuba )
35353535{
3536   UINT8 *rom = machine.region( "maincpu" )->base();
3536   UINT8 *rom = machine.root_device().memregion( "maincpu" )->base();
35373537
35383538   DRIVER_INIT_CALL(victor5);
35393539
r14976r14977
35493549static DRIVER_INIT( stisub )
35503550{
35513551   subsino_state *state = machine.driver_data<subsino_state>();
3552   UINT8 *rom = machine.region( "maincpu" )->base();
3552   UINT8 *rom = state->memregion( "maincpu" )->base();
35533553   rom[0x1005] = 0x1d; //patch protection check
35543554   rom[0x7ab] = 0x18; //patch "winning protection" check
35553555   rom[0x957] = 0x18; //patch "losing protection" check
src/mame/drivers/jchan.c
r14976r14977
394394   state->m_sprite_bitmap_1->fill(0x0000, cliprect);
395395   state->m_sprite_bitmap_2->fill(0x0000, cliprect);
396396
397   state->m_spritegen1->skns_draw_sprites(screen.machine(), *state->m_sprite_bitmap_1, cliprect, state->m_sprite_ram32_1, 0x4000, screen.machine().region("gfx1")->base(), screen.machine().region ("gfx1")->bytes(), state->m_sprite_regs32_1 );
398   state->m_spritegen2->skns_draw_sprites(screen.machine(), *state->m_sprite_bitmap_2, cliprect, state->m_sprite_ram32_2, 0x4000, screen.machine().region("gfx2")->base(), screen.machine().region ("gfx2")->bytes(), state->m_sprite_regs32_2 );
397   state->m_spritegen1->skns_draw_sprites(screen.machine(), *state->m_sprite_bitmap_1, cliprect, state->m_sprite_ram32_1, 0x4000, screen.machine().root_device().memregion("gfx1")->base(), screen.machine().root_device().memregion ("gfx1")->bytes(), state->m_sprite_regs32_1 );
398   state->m_spritegen2->skns_draw_sprites(screen.machine(), *state->m_sprite_bitmap_2, cliprect, state->m_sprite_ram32_2, 0x4000, screen.machine().root_device().memregion("gfx2")->base(), state->memregion ("gfx2")->bytes(), state->m_sprite_regs32_2 );
399399
400400   // ignoring priority bits for now - might use alpha too, check 0x8000 of palette writes
401401   for (y=0;y<240;y++)
src/mame/drivers/mlanding.c
r14976r14977
271271static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
272272{
273273   data=0;
274   memory_set_bankptr(device->machine(),  "bank1", device->machine().region("audiocpu")->base() + ((data) & 0x03) * 0x4000 + 0x10000 );
274   device->machine().root_device().membank("bank1")->set_base(device->machine().root_device().memregion("audiocpu")->base() + ((data) & 0x03) * 0x4000 + 0x10000 );
275275}
276276
277277static void ml_msm5205_vck(device_t *device)
r14976r14977
288288   }
289289   else
290290   {
291      UINT8 *ROM = device->machine().region("adpcm")->base();
291      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base();
292292
293293      state->m_adpcm_data = ((state->m_trigger ? (ROM[state->m_adpcm_pos] & 0x0f) : (ROM[state->m_adpcm_pos] & 0xf0)>>4) );
294294      msm5205_data_w(device,state->m_adpcm_data & 0xf);
r14976r14977
846846
847847static DRIVER_INIT(mlanding)
848848{
849//  UINT8 *rom = machine.region("sub")->base();
849//  UINT8 *rom = machine.root_device().memregion("sub")->base();
850850//  rom[0x88b]=0x4e;
851851//  rom[0x88a]=0x71;
852852}
src/mame/drivers/tankbust.c
r14976r14977
9999   case 7: /* 0xe007 bankswitch */
100100      /* bank 1 at 0x6000-9fff = from 0x10000 when bit0=0 else from 0x14000 */
101101      /* bank 2 at 0xa000-bfff = from 0x18000 when bit0=0 else from 0x1a000 */
102      memory_set_bankptr(machine(),  "bank1", machine().region("maincpu")->base() + 0x10000 + ((data&1) * 0x4000) );
103      memory_set_bankptr(machine(),  "bank2", machine().region("maincpu")->base() + 0x18000 + ((data&1) * 0x2000) ); /* verified (the game will reset after the "game over" otherwise) */
102      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000 + ((data&1) * 0x4000) );
103      membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000 + ((data&1) * 0x2000) ); /* verified (the game will reset after the "game over" otherwise) */
104104      break;
105105   }
106106}
r14976r14977
115115
116116static PALETTE_INIT( tankbust )
117117{
118   const UINT8 *color_prom = machine.region("proms")->base();
118   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
119119   int i;
120120
121121   for (i = 0; i < 128; i++)
src/mame/drivers/neoprint.c
r14976r14977
273273
274274READ16_MEMBER(neoprint_state::rom_window_r)
275275{
276   UINT16 *rom = (UINT16 *)machine().region("maincpu")->base();
276   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
277277
278278   return rom[offset | 0x80000/2 | m_bank_val*0x40000/2];
279279}
r14976r14977
592592/* FIXME: get rid of these two, probably something to do with irq3 and camera / printer devices */
593593static DRIVER_INIT( npcartv1 )
594594{
595   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
595   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
596596
597597   ROM[0x1260/2] = 0x4e71;
598598
r14976r14977
602602
603603static DRIVER_INIT( 98best44 )
604604{
605   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
605   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
606606
607607   ROM[0x1312/2] = 0x4e71;
608608}
609609
610610static DRIVER_INIT( nprsp )
611611{
612   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
612   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
613613
614614   ROM[0x13a4/2] = 0x4e71;
615615   ROM[0x13bc/2] = 0x4e71;
src/mame/drivers/pastelg.c
r14976r14977
4545
4646READ8_MEMBER(pastelg_state::pastelg_sndrom_r)
4747{
48   UINT8 *ROM = machine().region("voice")->base();
48   UINT8 *ROM = memregion("voice")->base();
4949
5050   return ROM[pastelg_blitter_src_addr_r(&space) & 0x7fff];
5151}
src/mame/drivers/tetrisp2.c
r14976r14977
117117
118118WRITE16_MEMBER(tetrisp2_state::rockn_adpcmbank_w)
119119{
120   UINT8 *SNDROM = machine().region("ymz")->base();
120   UINT8 *SNDROM = memregion("ymz")->base();
121121   int bank;
122122
123123   m_rockn_adpcmbank = data;
r14976r14977
134134
135135WRITE16_MEMBER(tetrisp2_state::rockn2_adpcmbank_w)
136136{
137   UINT8 *SNDROM = machine().region("ymz")->base();
137   UINT8 *SNDROM = memregion("ymz")->base();
138138   int bank;
139139
140140   char banktable[9][3]=
r14976r14977
181181
182182   if (ACCESSING_BITS_0_7)
183183   {
184      UINT8 *rom = machine().region("okisource")->base();
184      UINT8 *rom = memregion("okisource")->base();
185185
186186      if (data & 0x04)
187187      {
188188         m_bank_lo = data & 0x03;
189189
190         memcpy(machine().region("oki")->base(), rom + (m_bank_lo * 0x80000), 0x20000);
190         memcpy(machine().root_device().memregion("oki")->base(), rom + (m_bank_lo * 0x80000), 0x20000);
191191
192192//          logerror("PC:%06X sound bank_lo = %02X\n",cpu_get_pc(&space.device()),m_bank_lo);
193193      }
r14976r14977
195195      {
196196         m_bank_hi = data & 0x03;
197197
198         memcpy(machine().region("oki")->base() + 0x20000, rom + (m_bank_lo * 0x80000) + (m_bank_hi * 0x20000), 0x20000);
198         memcpy(machine().root_device().memregion("oki")->base() + 0x20000, rom + (m_bank_lo * 0x80000) + (m_bank_hi * 0x20000), 0x20000);
199199
200200//          logerror("PC:%06X sound bank_hi = %02X\n",cpu_get_pc(&space.device()),m_bank_hi);
201201      }
src/mame/drivers/alpha68k.c
r14976r14977
738738
739739WRITE8_MEMBER(alpha68k_state::sound_bank_w)
740740{
741   memory_set_bank(machine(), "bank7", data);
741   membank("bank7")->set_entry(data);
742742}
743743
744744static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, alpha68k_state )
r14976r14977
19031903static MACHINE_START( alpha68k_V )
19041904{
19051905   alpha68k_state *state = machine.driver_data<alpha68k_state>();
1906   UINT8 *ROM = machine.region("audiocpu")->base();
1906   UINT8 *ROM = state->memregion("audiocpu")->base();
19071907
1908   memory_configure_bank(machine, "bank7", 0, 32, &ROM[0x10000], 0x4000);
1908   state->membank("bank7")->configure_entries(0, 32, &ROM[0x10000], 0x4000);
19091909
19101910   MACHINE_START_CALL(common);
19111911
r14976r14977
19391939static MACHINE_START( alpha68k_II )
19401940{
19411941   alpha68k_state *state = machine.driver_data<alpha68k_state>();
1942   UINT8 *ROM = machine.region("audiocpu")->base();
1942   UINT8 *ROM = state->memregion("audiocpu")->base();
19431943
1944   memory_configure_bank(machine, "bank7", 0, 28, &ROM[0x10000], 0x4000);
1944   state->membank("bank7")->configure_entries(0, 28, &ROM[0x10000], 0x4000);
19451945
19461946   MACHINE_START_CALL(common);
19471947
r14976r14977
32223222static DRIVER_INIT( skysoldr )
32233223{
32243224   alpha68k_state *state = machine.driver_data<alpha68k_state>();
3225   memory_set_bankptr(machine, "bank8", (machine.region("user1")->base()) + 0x40000);
3225   state->membank("bank8")->set_base((state->memregion("user1")->base()) + 0x40000);
32263226   state->m_invert_controls = 0;
32273227   state->m_microcontroller_id = 0;
32283228   state->m_coin_id = 0x22 | (0x22 << 8);
r14976r14977
32413241static DRIVER_INIT( goldmedla )
32423242{
32433243   alpha68k_state *state = machine.driver_data<alpha68k_state>();
3244   memory_set_bankptr(machine, "bank8", machine.region("maincpu")->base() + 0x20000);
3244   state->membank("bank8")->set_base(state->memregion("maincpu")->base() + 0x20000);
32453245   state->m_invert_controls = 0;
32463246   state->m_microcontroller_id = 0x8803; //Guess - routine to handle coinage is the same as in 'goldmedl'
32473247   state->m_coin_id = 0x23 | (0x24 << 8);
r14976r14977
32693269static DRIVER_INIT( gangwarsu )
32703270{
32713271   alpha68k_state *state = machine.driver_data<alpha68k_state>();
3272   memory_set_bankptr(machine, "bank8", machine.region("user1")->base());
3272   state->membank("bank8")->set_base(state->memregion("user1")->base());
32733273   state->m_invert_controls = 0;
32743274   state->m_microcontroller_id = 0x8512;
32753275   state->m_coin_id = 0x23 | (0x24 << 8);
r14976r14977
32793279static DRIVER_INIT( gangwars )
32803280{
32813281   alpha68k_state *state = machine.driver_data<alpha68k_state>();
3282   memory_set_bankptr(machine, "bank8", machine.region("user1")->base());
3282   state->membank("bank8")->set_base(state->memregion("user1")->base());
32833283   state->m_invert_controls = 0;
32843284   state->m_microcontroller_id = 0x8512;
32853285   state->m_coin_id = 0x23 | (0x24 << 8);
r14976r14977
32893289static DRIVER_INIT( sbasebal )
32903290{
32913291   alpha68k_state *state = machine.driver_data<alpha68k_state>();
3292   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
3292   UINT16 *rom = (UINT16 *)state->memregion("maincpu")->base();
32933293
32943294   /* Patch protection check, it does a divide by zero because the MCU is trying to
32953295       calculate the ball speed when a strike is scored, notice that current emulation
src/mame/drivers/tmaster.c
r14976r14977
380380   tmaster_state *state = machine.driver_data<tmaster_state>();
381381   int x,y,x0,x1,y0,y1,dx,dy,flipx,flipy,sx,sy,sw,sh, addr, mode, layer,buffer, color;
382382
383   UINT8 *gfxdata   =   machine.region( "blitter" )->base() + state->m_gfx_offs;
383   UINT8 *gfxdata   =   state->memregion( "blitter" )->base() + state->m_gfx_offs;
384384
385385   UINT16 pen;
386386
r14976r14977
642642// Sound
643643READ16_MEMBER(tmaster_state::galgames_okiram_r)
644644{
645   return machine().region("oki")->base()[offset] | 0xff00;
645   return memregion("oki")->base()[offset] | 0xff00;
646646}
647647WRITE16_MEMBER(tmaster_state::galgames_okiram_w)
648648{
649649   if (ACCESSING_BITS_0_7)
650      machine().region("oki")->base()[offset] = data & 0xff;
650      memregion("oki")->base()[offset] = data & 0xff;
651651}
652652
653653// Carts (preliminary, PIC communication is not implemented)
r14976r14977
659659
660660   state->m_gfx_offs = 0x200000 * cart;
661661
662   if (machine.memory().bank(GALGAMES_BANK_000000_R) == GALGAMES_RAM)
663      memory_set_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_ROM0 + state->m_galgames_cart);   // rom
662   if (state->membank(GALGAMES_BANK_000000_R)->entry() == GALGAMES_RAM)
663      state->membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_ROM0 + state->m_galgames_cart);   // rom
664664
665   memory_set_bank(machine, GALGAMES_BANK_240000_R, GALGAMES_ROM0 + state->m_galgames_cart);   // rom
665   state->membank(GALGAMES_BANK_240000_R)->set_entry(GALGAMES_ROM0 + state->m_galgames_cart);   // rom
666666}
667667
668668WRITE16_MEMBER(tmaster_state::galgames_cart_sel_w)
r14976r14977
712712      // ROM/RAM banking
713713      if ((data & 0xf7) == 0x05)
714714      {
715         memory_set_bank(machine(), GALGAMES_BANK_000000_R, GALGAMES_RAM);   // ram
715         membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_RAM);   // ram
716716         galgames_update_rombank(machine(), m_galgames_cart);
717717         logerror("%06x: romram bank = %04x\n", cpu_get_pc(&space.device()), data);
718718      }
719719      else
720720      {
721         memory_set_bank(machine(), GALGAMES_BANK_000000_R, GALGAMES_ROM0);   // rom
722         memory_set_bank(machine(), GALGAMES_BANK_200000_R, GALGAMES_RAM);   // ram
721         membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_ROM0);   // rom
722         membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_RAM);   // ram
723723         logerror("%06x: unknown romram bank = %04x\n", cpu_get_pc(&space.device()), data);
724724      }
725725   }
r14976r14977
882882{
883883   tmaster_state *state = machine.driver_data<tmaster_state>();
884884   state->m_gfx_offs = 0;
885   state->m_gfx_size = machine.region("blitter")->bytes();
885   state->m_gfx_size = state->memregion("blitter")->bytes();
886886
887887   state->m_duart68681 = machine.device( "duart68681" );
888888}
r14976r14977
951951   state->m_gfx_offs = 0;
952952   state->m_gfx_size = 0x200000;
953953
954   memory_set_bank(machine, GALGAMES_BANK_000000_R, GALGAMES_ROM0);   // rom
955   memory_set_bank(machine, GALGAMES_BANK_000000_W, GALGAMES_RAM);      // ram
954   state->membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_ROM0);   // rom
955   state->membank(GALGAMES_BANK_000000_W)->set_entry(GALGAMES_RAM);      // ram
956956
957   memory_set_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_RAM);      // ram
958   memory_set_bank(machine, GALGAMES_BANK_200000_W, GALGAMES_RAM);      // ram
957   state->membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_RAM);      // ram
958   state->membank(GALGAMES_BANK_200000_W)->set_entry(GALGAMES_RAM);      // ram
959959
960   memory_set_bank(machine, GALGAMES_BANK_240000_R, GALGAMES_ROM0);   // rom
960   state->membank(GALGAMES_BANK_240000_R)->set_entry(GALGAMES_ROM0);   // rom
961961
962962   galgames_update_rombank(machine, 0);
963963
r14976r14977
16211621
16221622static DRIVER_INIT( tm4k )
16231623{
1624   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1624   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
16251625
16261626   // protection
16271627   ROM[0x834ce/2] = 0x4e75;
r14976r14977
16421642
16431643static DRIVER_INIT( tm4ka )
16441644{
1645   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1645   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
16461646
16471647   // protection
16481648   ROM[0x83476/2] = 0x4e75;
r14976r14977
16641664
16651665static DRIVER_INIT( tm4kb )
16661666{
1667   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1667   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
16681668
16691669   // protection
16701670   ROM[0x82b7a/2] = 0x4e75;
r14976r14977
16851685
16861686static DRIVER_INIT( tm5k )
16871687{
1688   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1688   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
16891689
16901690   // protection
16911691   ROM[0x96002/2] = 0x4e75;
r14976r14977
17081708
17091709static DRIVER_INIT( tm5kca )
17101710{
1711   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1711   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
17121712
17131713   // protection
17141714   ROM[0x95ffe/2] = 0x4e75;
r14976r14977
17201720
17211721static DRIVER_INIT( tm5ka )
17221722{
1723   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1723   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
17241724
17251725   // protection
17261726   ROM[0x96b30/2] = 0x4e75;
r14976r14977
17411741
17421742static DRIVER_INIT( tm7k )
17431743{
1744   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1744   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
17451745
17461746   // protection
17471747   ROM[0x81730/2] = 0x4e75;
r14976r14977
17641764
17651765static DRIVER_INIT( tm7ka )
17661766{
1767   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1767   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
17681768
17691769   // protection
17701770   ROM[0x81594/2] = 0x4e75;
r14976r14977
17871787
17881788static DRIVER_INIT( tm7keval ) /* kit came with a security key labeled A-21657-004, which is a TM5000 key */
17891789{
1790   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1790   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
17911791
17921792   // protection
17931793   ROM[0x8949e/2] = 0x4e75;
r14976r14977
18101810
18111811static DRIVER_INIT( tm8k )
18121812{
1813   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1813   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
18141814
18151815   // protection
18161816   ROM[0x78b70/2] = 0x4e75;
r14976r14977
18341834static DRIVER_INIT( galgames )
18351835{
18361836   tmaster_state *state = machine.driver_data<tmaster_state>();
1837   UINT8 *ROM   =   machine.region("maincpu")->base();
1837   UINT8 *ROM   =   machine.root_device().memregion("maincpu")->base();
18381838   int cart;
18391839
18401840   // RAM bank at 0x000000-0x03ffff and 0x200000-0x23ffff
18411841   // ROM bank at 0x000000-0x1fffff and 0x200000-0x3fffff (bios)
18421842
1843   memory_configure_bank(machine, GALGAMES_BANK_000000_R, GALGAMES_RAM,  1, state->m_galgames_ram, 0x40000);
1844   memory_configure_bank(machine, GALGAMES_BANK_000000_R, GALGAMES_ROM0, 1, ROM+0x000000, 0x40000);
1843   state->membank(GALGAMES_BANK_000000_R)->configure_entry(GALGAMES_RAM,  state->m_galgames_ram);
1844   state->membank(GALGAMES_BANK_000000_R)->configure_entry(GALGAMES_ROM0, ROM+0x000000);
18451845
1846   memory_configure_bank(machine, GALGAMES_BANK_000000_W, GALGAMES_RAM,  1, state->m_galgames_ram, 0x40000);
1846   state->membank(GALGAMES_BANK_000000_W)->configure_entry(GALGAMES_RAM,  state->m_galgames_ram);
18471847
1848   memory_configure_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_RAM,  1, state->m_galgames_ram, 0x40000);
1849   memory_configure_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_ROM0, 1, ROM+0x000000, 0x40000);
1848   state->membank(GALGAMES_BANK_200000_R)->configure_entry(GALGAMES_RAM,  state->m_galgames_ram);
1849   state->membank(GALGAMES_BANK_200000_R)->configure_entry(GALGAMES_ROM0, ROM+0x000000);
18501850
1851   memory_configure_bank(machine, GALGAMES_BANK_200000_W, GALGAMES_RAM,  1, state->m_galgames_ram, 0x40000);
1851   state->membank(GALGAMES_BANK_200000_W)->configure_entry(GALGAMES_RAM,  state->m_galgames_ram);
18521852
1853   memory_configure_bank(machine, GALGAMES_BANK_240000_R, GALGAMES_ROM0, 1, ROM+0x040000, 0x1c0000);
1853   state->membank(GALGAMES_BANK_240000_R)->configure_entry(GALGAMES_ROM0, ROM+0x040000);
18541854
18551855   // More ROM banks at 0x200000-0x3fffff (carts)
18561856
18571857   for (cart = 1; cart <= 4; cart++)
18581858   {
1859      UINT8 *CART = machine.region("maincpu")->base();
1859      UINT8 *CART = machine.root_device().memregion("maincpu")->base();
18601860
1861      if  (0x200000 * (cart+1) <= machine.region("maincpu")->bytes())
1861      if  (0x200000 * (cart+1) <= state->memregion("maincpu")->bytes())
18621862         CART += 0x200000 * cart;
18631863
1864      memory_configure_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_ROM0+cart, 1, CART,          0x40000);
1865      memory_configure_bank(machine, GALGAMES_BANK_240000_R, GALGAMES_ROM0+cart, 1, CART+0x040000, 0x1c0000);
1864      state->membank(GALGAMES_BANK_200000_R)->configure_entry(GALGAMES_ROM0+cart, CART);
1865      state->membank(GALGAMES_BANK_240000_R)->configure_entry(GALGAMES_ROM0+cart, CART+0x040000);
18661866   }
18671867}
18681868
18691869static DRIVER_INIT( galgame2 )
18701870{
1871   UINT16 *ROM = (UINT16 *)machine.region( "maincpu" )->base();
1871   UINT16 *ROM = (UINT16 *)machine.root_device().memregion( "maincpu" )->base();
18721872
18731873   // Patch BIOS to see the game code as first cartridge (until the PIC therein is emulated)
18741874   ROM[0x118da/2] = 0x4a06;
src/mame/drivers/tcl.c
r14976r14977
189189   /* only the first part is decrypted (and verified)*/
190190
191191   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
192   UINT8 *dest = machine.region("maincpu")->base();
193   int len = machine.region("maincpu")->bytes();
192   UINT8 *dest = machine.root_device().memregion("maincpu")->base();
193   int len = machine.root_device().memregion("maincpu")->bytes();
194194   UINT8 *src = auto_alloc_array(machine, UINT8, len);
195195
196196   int i,idx=0;
src/mame/drivers/namcos22.c
r14976r14977
19331933      else
19341934      {
19351935         memset( state->m_nvmem, 0x00, state->m_nvmem.bytes() );
1936         if (machine.region("nvram")->bytes() == state->m_nvmem.bytes())
1936         if (machine.root_device().memregion("nvram")->bytes() == state->m_nvmem.bytes())
19371937         {
1938            UINT8* nvram = machine.region("nvram")->base();
1938            UINT8* nvram = machine.root_device().memregion("nvram")->base();
19391939
19401940            for( i=0; i<state->m_nvmem.bytes()/4; i++ )
19411941            {
r14976r14977
55385538
55395539static DRIVER_INIT( propcycl )
55405540{
5541   UINT32 *pROM = (UINT32 *)machine.region("maincpu")->base();
5541   UINT32 *pROM = (UINT32 *)machine.root_device().memregion("maincpu")->base();
55425542
55435543   /* patch out strange routine (uninitialized-eprom related?) */
55445544   pROM[0x1992C/4] = 0x4E754E75;
src/mame/drivers/flyball.c
r14976r14977
389389   int i;
390390
391391   /* address bits 0 through 8 are inverted */
392   UINT8* ROM = machine.region("maincpu")->base() + 0x2000;
392   UINT8* ROM = state->memregion("maincpu")->base() + 0x2000;
393393
394394   for (i = 0; i < 0x1000; i++)
395395      state->m_rombase[i] = ROM[i ^ 0x1ff];
src/mame/drivers/pluto5.c
r14976r14977
499499
500500static DRIVER_INIT( hb )
501501{
502   astra_addresslines( (UINT16*)machine.region( "maincpu" )->base(), machine.region( "maincpu" )->bytes(), 0 );
502   astra_addresslines( (UINT16*)machine.root_device().memregion( "maincpu" )->base(), machine.root_device().memregion( "maincpu" )->bytes(), 0 );
503503
504504   #if 0
505505   {
506      UINT8* ROM = machine.region( "maincpu" )->base();
506      UINT8* ROM = machine.root_device().memregion( "maincpu" )->base();
507507      FILE *fp;
508508      char filename[256];
509509      sprintf(filename,"%s", machine.system().name);
510510      fp=fopen(filename, "w+b");
511511      if (fp)
512512      {
513         fwrite(ROM,  machine.region( "maincpu" )->bytes(), 1, fp);
513         fwrite(ROM,  machine.root_device().memregion( "maincpu" )->bytes(), 1, fp);
514514         fclose(fp);
515515      }
516516   }
src/mame/drivers/pturn.c
r14976r14977
143143{
144144   pturn_state *state = machine.driver_data<pturn_state>();
145145   int tileno,palno;
146   tileno = machine.region("user1")->base()[tile_index];
146   tileno = state->memregion("user1")->base()[tile_index];
147147   palno=state->m_bgpalette;
148148   if(palno==1)
149149   {
src/mame/drivers/dec0.c
r14976r14977
30383038
30393039static DRIVER_INIT( convert_robocop_gfx4_to_automat )
30403040{
3041   UINT8* R = machine.region("gfx4")->base();
3041   UINT8* R = machine.root_device().memregion("gfx4")->base();
30423042   int i;
30433043
30443044   for (i=0;i<0x80000;i++)
src/mame/drivers/ssv.c
r14976r14977
326326   ssv_state *state = machine.driver_data<ssv_state>();
327327   state->m_requested_int = 0;
328328   device_set_irq_callback(machine.device("maincpu"), ssv_irq_callback);
329   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
329   state->membank("bank1")->set_base(state->memregion("user1")->base());
330330}
331331
332332
r14976r14977
549549         UINT32 dst   =   (gdfs_blitram[0xc4/2] + (gdfs_blitram[0xc6/2] << 16)) << 4;
550550         UINT32 len   =   (gdfs_blitram[0xc8/2]) << 4;
551551
552         UINT8 *rom   =   machine().region("gfx2")->base();
553         size_t size   =   machine().region("gfx2")->bytes();
552         UINT8 *rom   =   memregion("gfx2")->base();
553         size_t size   =   memregion("gfx2")->bytes();
554554
555555         if ( (src+len <= size) && (dst+len <= 4 * 0x100000) )
556556         {
r14976r14977
962962
963963READ16_MEMBER(ssv_state::eaglshot_gfxrom_r)
964964{
965   UINT8 *rom   =   machine().region("gfx1")->base();
966   size_t size   =   machine().region("gfx1")->bytes();
965   UINT8 *rom   =   memregion("gfx1")->base();
966   size_t size   =   memregion("gfx1")->bytes();
967967
968968   offset = offset * 2 + m_gfxrom_select * 0x200000;
969969
r14976r14977
26482648// massages the data from the BPMicro-compatible dump to runnable form
26492649static void init_st010(running_machine &machine)
26502650{
2651   UINT8 *dspsrc = (UINT8 *)machine.region("st010")->base();
2652   UINT32 *dspprg = (UINT32 *)machine.region("dspprg")->base();
2653   UINT16 *dspdata = (UINT16 *)machine.region("dspdata")->base();
2651   UINT8 *dspsrc = (UINT8 *)machine.root_device().memregion("st010")->base();
2652   UINT32 *dspprg = (UINT32 *)machine.root_device().memregion("dspprg")->base();
2653   UINT16 *dspdata = (UINT16 *)machine.root_device().memregion("dspdata")->base();
26542654
26552655   // copy DSP program
26562656   for (int i = 0; i < 0x10000; i+= 4)
r14976r14977
26772677static DRIVER_INIT( mslider )         {   init_ssv(machine, 0);   }
26782678static DRIVER_INIT( ryorioh )         {   init_ssv(machine, 0);   }
26792679static DRIVER_INIT( srmp4 )         {   init_ssv(machine, 0);
2680//  ((UINT16 *)machine.region("user1")->base())[0x2b38/2] = 0x037a;   /* patch to see gal test mode */
2680//  ((UINT16 *)machine.root_device().memregion("user1")->base())[0x2b38/2] = 0x037a;   /* patch to see gal test mode */
26812681}
26822682static DRIVER_INIT( srmp7 )         {   init_ssv(machine, 0);   }
26832683static DRIVER_INIT( stmblade )      {   init_ssv(machine, 0); init_st010(machine); }
src/mame/drivers/atarig42.c
r14976r14977
826826
827827   /* it looks like they jsr to $80000 as some kind of protection */
828828   /* put an RTS there so we don't die */
829   *(UINT16 *)&machine.region("maincpu")->base()[0x80000] = 0x4E75;
829   *(UINT16 *)&state->memregion("maincpu")->base()[0x80000] = 0x4E75;
830830
831831   address_space *main = machine.device<m68000_device>("maincpu")->space(AS_PROGRAM);
832832   state->m_sloop_base = main->install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),state), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),state));
src/mame/drivers/cop01.c
r14976r14977
654654#if MIGHTGUY_HACK
655655   /* This is a hack to fix the game code to get a fully working
656656       "Starting Area" fake Dip Switch */
657   UINT8 *RAM = (UINT8 *)machine.region("maincpu")->base();
657   UINT8 *RAM = (UINT8 *)machine.root_device().memregion("maincpu")->base();
658658   RAM[0x00e4] = 0x07;   // rlca
659659   RAM[0x00e5] = 0x07;   // rlca
660660   RAM[0x00e6] = 0x07;   // rlca
src/mame/drivers/kingpin.c
r14976r14977
178178   kingpin_state *state = machine.driver_data<kingpin_state>();
179179
180180   /* Hacks to keep the emu a'runnin */
181   state->m_code_base = machine.region("maincpu")->base();
181   state->m_code_base = state->memregion("maincpu")->base();
182182   state->m_code_base[0x17d4] = 0xc3;   /* Maybe sound related? */
183183}
184184
src/mame/drivers/midvunit.c
r14976r14977
5656   dcs_reset_w(machine, 1);
5757   dcs_reset_w(machine, 0);
5858
59   memcpy(state->m_ram_base, machine.region("user1")->base(), 0x20000*4);
59   memcpy(state->m_ram_base, state->memregion("user1")->base(), 0x20000*4);
6060   machine.device("maincpu")->reset();
6161
6262   state->m_timer[0] = machine.device<timer_device>("timer0");
r14976r14977
7070   dcs_reset_w(machine, 1);
7171   dcs_reset_w(machine, 0);
7272
73   memcpy(state->m_ram_base, machine.region("user1")->base(), 0x20000*4);
73   memcpy(state->m_ram_base, state->memregion("user1")->base(), 0x20000*4);
7474   machine.device("maincpu")->reset();
7575
7676   state->m_timer[0] = machine.device<timer_device>("timer0");
src/mame/drivers/usgames.c
r14976r14977
3333
3434WRITE8_MEMBER(usgames_state::usgames_rombank_w)
3535{
36   UINT8 *RAM = machine().region("maincpu")->base();
36   UINT8 *RAM = memregion("maincpu")->base();
3737
3838//  logerror ("BANK WRITE? -%02x-\n",data);
3939//popmessage("%02x",data);
4040
41   memory_set_bankptr(machine(),  "bank1",&RAM[ 0x10000 + 0x4000 * data] );
41   membank("bank1")->set_base(&RAM[ 0x10000 + 0x4000 * data] );
4242}
4343
4444WRITE8_MEMBER(usgames_state::lamps1_w)
src/mame/drivers/opwolf.c
r14976r14977
346346
347347static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
348348{
349   memory_set_bank(device->machine(), "bank10", (data - 1) & 0x03);
349   device->machine().root_device().membank("bank10")->set_entry((data - 1) & 0x03);
350350}
351351
352352/***********************************************************
r14976r14977
476476   }
477477   else
478478   {
479      state->m_adpcm_data[chip] = device->machine().region("adpcm")->base()[state->m_adpcm_pos[chip]];
479      state->m_adpcm_data[chip] = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos[chip]];
480480      state->m_adpcm_pos[chip] = (state->m_adpcm_pos[chip] + 1) & 0x7ffff;
481481      msm5205_data_w(device, state->m_adpcm_data[chip] >> 4);
482482   }
r14976r14977
979979static DRIVER_INIT( opwolf )
980980{
981981   opwolf_state *state = machine.driver_data<opwolf_state>();
982   UINT16* rom = (UINT16*)machine.region("maincpu")->base();
982   UINT16* rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
983983
984984   state->m_opwolf_region = rom[0x03fffe / 2] & 0xff;
985985
r14976r14977
989989   state->m_opwolf_gun_xoffs = 0xec - (rom[0x03ffb0 / 2] & 0xff);
990990   state->m_opwolf_gun_yoffs = 0x1c - (rom[0x03ffae / 2] & 0xff);
991991
992   memory_configure_bank(machine, "bank10", 0, 4, machine.region("audiocpu")->base() + 0x10000, 0x4000);
992   state->membank("bank10")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000, 0x4000);
993993}
994994
995995
996996static DRIVER_INIT( opwolfb )
997997{
998998   opwolf_state *state = machine.driver_data<opwolf_state>();
999   UINT16* rom = (UINT16*)machine.region("maincpu")->base();
999   UINT16* rom = (UINT16*)machine.root_device().memregion("maincpu")->base();
10001000
10011001   state->m_opwolf_region = rom[0x03fffe / 2] & 0xff;
10021002
r14976r14977
10041004   state->m_opwolf_gun_xoffs = -2;
10051005   state->m_opwolf_gun_yoffs = 17;
10061006
1007   memory_configure_bank(machine, "bank10", 0, 4, machine.region("audiocpu")->base() + 0x10000, 0x4000);
1007   state->membank("bank10")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000, 0x4000);
10081008}
10091009
10101010
src/mame/drivers/suna16.c
r14976r14977
260260
261261WRITE8_MEMBER(suna16_state::bssoccer_pcm_1_bankswitch_w)
262262{
263   UINT8 *RAM = machine().region("pcm1")->base();
263   UINT8 *RAM = memregion("pcm1")->base();
264264   int bank = data & 7;
265265   if (bank & ~7)   logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data);
266   memory_set_bankptr(machine(), "bank1", &RAM[bank * 0x10000 + 0x1000]);
266   membank("bank1")->set_base(&RAM[bank * 0x10000 + 0x1000]);
267267}
268268
269269WRITE8_MEMBER(suna16_state::bssoccer_pcm_2_bankswitch_w)
270270{
271   UINT8 *RAM = machine().region("pcm2")->base();
271   UINT8 *RAM = memregion("pcm2")->base();
272272   int bank = data & 7;
273273   if (bank & ~7)   logerror("CPU#3 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data);
274   memory_set_bankptr(machine(), "bank2", &RAM[bank * 0x10000 + 0x1000]);
274   membank("bank2")->set_base(&RAM[bank * 0x10000 + 0x1000]);
275275}
276276
277277
r14976r14977
322322
323323WRITE8_MEMBER(suna16_state::uballoon_pcm_1_bankswitch_w)
324324{
325   UINT8 *RAM = machine().region("pcm1")->base();
325   UINT8 *RAM = memregion("pcm1")->base();
326326   int bank = data & 1;
327327   if (bank & ~1)   logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data);
328   memory_set_bankptr(machine(), "bank1", &RAM[bank * 0x10000 + 0x400]);
328   membank("bank1")->set_base(&RAM[bank * 0x10000 + 0x400]);
329329}
330330
331331/* Memory maps: Yes, *no* RAM */
r14976r14977
10871087
10881088static DRIVER_INIT( uballoon )
10891089{
1090   UINT16 *RAM = (UINT16 *) machine.region("maincpu")->base();
1090   UINT16 *RAM = (UINT16 *) machine.root_device().memregion("maincpu")->base();
10911091
10921092   // Patch out the protection checks
10931093   RAM[0x0113c/2] = 0x4e71;   // bne $646
src/mame/drivers/firebeat.c
r14976r14977
19561956   firebeat_state *state = machine.driver_data<firebeat_state>();
19571957   void *cd;
19581958   int i;
1959   UINT8 *sound = machine.region("ymz")->base();
1959   UINT8 *sound = state->memregion("ymz")->base();
19601960
19611961   for (i=0; i < 0x200000; i++)
19621962   {
r14976r14977
22252225static void init_firebeat(running_machine &machine)
22262226{
22272227   firebeat_state *state = machine.driver_data<firebeat_state>();
2228   UINT8 *rom = machine.region("user2")->base();
2228   UINT8 *rom = state->memregion("user2")->base();
22292229
22302230   atapi_init(machine);
22312231
src/mame/drivers/bigevglf.c
r14976r14977
7070/* d0-d3 connect to A11-A14 of the ROMs (via ls273 latch)
7171   d4-d7 select one of ROMs (via ls273(above) and then ls154)
7272*/
73   memory_set_bank(machine(), "bank1", m_beg_bank & 0xff); /* empty sockets for IC37-IC44 ROMS */
73   membank("bank1")->set_entry(m_beg_bank & 0xff); /* empty sockets for IC37-IC44 ROMS */
7474}
7575
7676static TIMER_CALLBACK( from_sound_latch_callback )
r14976r14977
619619
620620static DRIVER_INIT( bigevglf )
621621{
622   UINT8 *ROM = machine.region("maincpu")->base();
623   memory_configure_bank(machine, "bank1", 0, 0xff, &ROM[0x10000], 0x800);
622   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
623   machine.root_device().membank("bank1")->configure_entries(0, 0xff, &ROM[0x10000], 0x800);
624624}
625625
626626GAME( 1986, bigevglf,  0,        bigevglf, bigevglf, bigevglf, ROT270, "Taito America Corporation", "Big Event Golf (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
src/mame/drivers/inufuku.c
r14976r14977
102102
103103WRITE8_MEMBER(inufuku_state::inufuku_soundrombank_w)
104104{
105   memory_set_bank(machine(), "bank1", data & 0x03);
105   membank("bank1")->set_entry(data & 0x03);
106106}
107107
108108/******************************************************************************
r14976r14977
314314static MACHINE_START( inufuku )
315315{
316316   inufuku_state *state = machine.driver_data<inufuku_state>();
317   UINT8 *ROM = machine.region("audiocpu")->base();
317   UINT8 *ROM = state->memregion("audiocpu")->base();
318318
319   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x8000);
320   memory_set_bank(machine, "bank1", 0);
319   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x8000);
320   state->membank("bank1")->set_entry(0);
321321
322322   state->m_audiocpu = machine.device("audiocpu");
323323
src/mame/drivers/tattack.c
r14976r14977
238238static DRIVER_INIT(tattack)
239239{
240240
241   UINT8 *rom = machine.region("maincpu")->base();
241   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
242242
243243   rom[0x1b4]=0;
244244   rom[0x1b5]=0;
src/mame/drivers/cbuster.c
r14976r14977
530530
531531static DRIVER_INIT( twocrude )
532532{
533   UINT8 *RAM = machine.region("maincpu")->base();
533   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
534534   UINT8 *PTR;
535535   int i, j;
536536
r14976r14977
547547   }
548548
549549   /* Rearrange the 'extra' sprite bank to be in the same format as main sprites */
550   RAM = machine.region("gfx3")->base() + 0x080000;
551   PTR = machine.region("gfx3")->base() + 0x140000;
550   RAM = machine.root_device().memregion("gfx3")->base() + 0x080000;
551   PTR = machine.root_device().memregion("gfx3")->base() + 0x140000;
552552   for (i = 0; i < 0x20000; i += 64)
553553   {
554554      for (j = 0; j < 16; j += 1)
src/mame/drivers/ghosteo.c
r14976r14977
269269      break;
270270      case NAND_M_READ :
271271      {
272         UINT8 *flash = (UINT8 *)device->machine().region( "user1")->base();
272         UINT8 *flash = (UINT8 *)device->machine().root_device().memregion( "user1")->base();
273273         if (nand.byte_addr < 0x200)
274274         {
275275            data = *(flash + nand.page_addr * 0x200 + nand.byte_addr);
src/mame/drivers/dunhuang.c
r14976r14977
346346
347347   m_block_h = data;
348348
349   tile_addr = machine().region("gfx2")->base() + ((m_block_addr_hi << 8) + m_block_addr_lo) * 4;
349   tile_addr = memregion("gfx2")->base() + ((m_block_addr_hi << 8) + m_block_addr_lo) * 4;
350350
351351   switch (m_block_dest)
352352   {
r14976r14977
466466   // ?                data & 0x01
467467   // ?                data & 0x02
468468
469   memory_set_bank(machine(), "bank1", ((data >> 2) & 0x7));
469   membank("bank1")->set_entry(((data >> 2) & 0x7));
470470
471471   // COIN OUT:        data & 0x20
472472   coin_counter_w(machine(), 0,   data & 0x40);
r14976r14977
766766static MACHINE_START( dunhuang )
767767{
768768   dunhuang_state *state = machine.driver_data<dunhuang_state>();
769   UINT8 *ROM = machine.region("maincpu")->base();
769   UINT8 *ROM = state->memregion("maincpu")->base();
770770
771   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x8000);
771   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x8000);
772772
773773   state->save_item(NAME(state->m_written));
774774   state->save_item(NAME(state->m_written2));
src/mame/drivers/ojankohs.c
r14976r14977
4141
4242WRITE8_MEMBER(ojankohs_state::ojankohs_rombank_w)
4343{
44   memory_set_bank(machine(), "bank1", data & 0x3f);
44   membank("bank1")->set_entry(data & 0x3f);
4545}
4646
4747WRITE8_MEMBER(ojankohs_state::ojankoy_rombank_w)
4848{
4949
50   memory_set_bank(machine(), "bank1", data & 0x1f);
50   membank("bank1")->set_entry(data & 0x1f);
5151
5252   m_adpcm_reset = BIT(data, 5);
5353   if (!m_adpcm_reset)
r14976r14977
9595WRITE8_MEMBER(ojankohs_state::ojankoc_ctrl_w)
9696{
9797
98   memory_set_bank(machine(), "bank1", data & 0x0f);
98   membank("bank1")->set_entry(data & 0x0f);
9999
100100   m_adpcm_reset = BIT(data, 4);
101101   msm5205_reset_w(m_msm, !BIT(data, 4));
r14976r14977
808808
809809static MACHINE_START( ojankohs )
810810{
811   UINT8 *ROM = machine.region("maincpu")->base();
811   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
812812
813   memory_configure_bank(machine, "bank1", 0, 0x40, &ROM[0x10000], 0x4000);
813   machine.root_device().membank("bank1")->configure_entries(0, 0x40, &ROM[0x10000], 0x4000);
814814
815815   MACHINE_START_CALL(common);
816816}
817817
818818static MACHINE_START( ojankoy )
819819{
820   UINT8 *ROM = machine.region("maincpu")->base();
820   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
821821
822   memory_configure_bank(machine, "bank1", 0, 0x20, &ROM[0x10000], 0x4000);
822   machine.root_device().membank("bank1")->configure_entries(0, 0x20, &ROM[0x10000], 0x4000);
823823
824824   MACHINE_START_CALL(common);
825825}
826826
827827static MACHINE_START( ojankoc )
828828{
829   UINT8 *ROM = machine.region("user1")->base();
829   UINT8 *ROM = machine.root_device().memregion("user1")->base();
830830
831   memory_configure_bank(machine, "bank1", 0, 0x10, &ROM[0x0000], 0x8000);
831   machine.root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x0000], 0x8000);
832832
833833   MACHINE_START_CALL(common);
834834}
src/mame/drivers/3do.c
r14976r14977
135135
136136   state->m_maincpu = downcast<legacy_cpu_device*>( machine.device("maincpu") );
137137
138   memory_set_bankptr(machine, "bank2",machine.region("user1")->base());
138   state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base());
139139
140140   /* configure overlay */
141   memory_configure_bank(machine, "bank1", 0, 1, state->m_dram, 0);
142   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
141   state->membank("bank1")->configure_entry(0, state->m_dram);
142   state->membank("bank1")->configure_entry(1, state->memregion("user1")->base());
143143
144144   /* start with overlay enabled */
145   memory_set_bank(machine, "bank1", 1);
145   state->membank("bank1")->set_entry(1);
146146
147147   _3do_slow2_init(machine);
148148   _3do_madam_init(machine);
src/mame/drivers/spdodgeb.c
r14976r14977
7878   }
7979   else
8080   {
81      UINT8 *ROM = device->machine().region("adpcm")->base() + 0x10000 * chip;
81      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base() + 0x10000 * chip;
8282
8383      state->m_adpcm_data[chip] = ROM[state->m_adpcm_pos[chip]++];
8484      msm5205_data_w(device,state->m_adpcm_data[chip] >> 4);
src/mame/drivers/turbo.c
r14976r14977
16271627      2,1,2,1    /* 0x5000-0x5fff */
16281628   };
16291629
1630   UINT8 *RAM = machine.region("maincpu")->base();
1630   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
16311631   int offs, i, j;
16321632   UINT8 src;
16331633
src/mame/drivers/cvs.c
r14976r14977
426426{
427427   cvs_state *state = device->machine().driver_data<cvs_state>();
428428   running_machine &machine = device->machine();
429   UINT8 *ROM = machine.region("speechdata")->base();
429   UINT8 *ROM = machine.root_device().memregion("speechdata")->base();
430430   int bit;
431431
432432   /* before reading the bit, clamp the address to the region length */
433   state->m_speech_rom_bit_address = state->m_speech_rom_bit_address & ((machine.region("speechdata")->bytes() * 8) - 1);
433   state->m_speech_rom_bit_address = state->m_speech_rom_bit_address & ((state->memregion("speechdata")->bytes() * 8) - 1);
434434   bit = (ROM[state->m_speech_rom_bit_address >> 3] >> (state->m_speech_rom_bit_address & 0x07)) & 0x01;
435435
436436   /* prepare for next bit */
r14976r14977
15951595
15961596static DRIVER_INIT( huncholy )
15971597{
1598   UINT8 *ROM = machine.region("maincpu")->base();
1598   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
15991599
16001600   /* patch out protection */
16011601   ROM[0x0082] = 0xc0;
r14976r14977
16151615
16161616static DRIVER_INIT( hunchbaka )
16171617{
1618   UINT8 *ROM = machine.region("maincpu")->base();
1618   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
16191619
16201620   offs_t offs;
16211621
r14976r14977
16271627
16281628static DRIVER_INIT( superbik )
16291629{
1630   UINT8 *ROM = machine.region("maincpu")->base();
1630   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
16311631
16321632   /* patch out protection */
16331633   ROM[0x0079] = 0xc0;
r14976r14977
16551655
16561656static DRIVER_INIT( hero )
16571657{
1658   UINT8 *ROM = machine.region("maincpu")->base();
1658   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
16591659
16601660   /* patch out protection */
16611661   ROM[0x0087] = 0xc0;
r14976r14977
16771677
16781678static DRIVER_INIT( raiders )
16791679{
1680   UINT8 *ROM = machine.region("maincpu")->base();
1680   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
16811681
16821682   offs_t offs;
16831683
src/mame/drivers/trvquest.c
r14976r14977
4545{
4646   gameplan_state *state = space->machine().driver_data<gameplan_state>();
4747
48   return space->machine().region("questions")->base()[*state->m_trvquest_question * 0x2000 + offset];
48   return state->memregion("questions")->base()[*state->m_trvquest_question * 0x2000 + offset];
4949}
5050
5151static WRITE8_DEVICE_HANDLER( trvquest_coin_w )
src/mame/drivers/tnzs.c
r14976r14977
639639   int start, size;
640640   int i, n;
641641
642   src = machine.region("samples")->base() + 0x0090;
642   src = state->memregion("samples")->base() + 0x0090;
643643   for (i = 0; i < MAX_SAMPLES; i++)
644644   {
645645      start = (src[(i * 2) + 1] * 256) + src[(i * 2)];
r14976r14977
738738{
739739   // to avoid the write when the sound chip is initialized
740740   if (data != 0xff)
741      memory_set_bank(device->machine(), "bank3", data & 0x07);
741      device->machine().root_device().membank("bank3")->set_entry(data & 0x07);
742742}
743743
744744static WRITE8_DEVICE_HANDLER( kabukiz_sample_w )
r14976r14977
903903WRITE8_MEMBER(tnzs_state::jpopnics_subbankswitch_w)
904904{
905905   /* bits 0-1 select ROM bank */
906   memory_set_bank(machine(), "bank2", data & 0x03);
906   membank("bank2")->set_entry(data & 0x03);
907907}
908908
909909static ADDRESS_MAP_START( jpopnics_sub_map, AS_PROGRAM, 8, tnzs_state )
src/mame/drivers/rohga.c
r14976r14977
15581558
15591559static DRIVER_INIT( schmeisr )
15601560{
1561   const UINT8 *src = machine.region("gfx2")->base();
1562   UINT8 *dst = machine.region("gfx1")->base();
1561   const UINT8 *src = machine.root_device().memregion("gfx2")->base();
1562   UINT8 *dst = machine.root_device().memregion("gfx1")->base();
15631563
15641564   memcpy(dst, src, 0x20000);
15651565   memcpy(dst + 0x20000, src + 0x80000, 0x20000);
src/mame/drivers/plygonet.c
r14976r14977
135135READ32_MEMBER(polygonet_state::ttl_rom_r)
136136{
137137   UINT32 *ROM;
138   ROM = (UINT32 *)machine().region("gfx1")->base();
138   ROM = (UINT32 *)machine().root_device().memregion("gfx1")->base();
139139
140140   return ROM[offset];
141141}
r14976r14977
144144READ32_MEMBER(polygonet_state::psac_rom_r)
145145{
146146   UINT32 *ROM;
147   ROM = (UINT32 *)machine().region("gfx2")->base();
147   ROM = (UINT32 *)machine().root_device().memregion("gfx2")->base();
148148
149149   return ROM[offset];
150150}
r14976r14977
545545static void reset_sound_region(running_machine &machine)
546546{
547547   polygonet_state *state = machine.driver_data<polygonet_state>();
548   memory_set_bankptr(machine, "bank2", machine.region("soundcpu")->base() + 0x10000 + state->m_cur_sound_region*0x4000);
548   state->membank("bank2")->set_base(state->memregion("soundcpu")->base() + 0x10000 + state->m_cur_sound_region*0x4000);
549549}
550550
551551WRITE8_MEMBER(polygonet_state::sound_bankswitch_w)
src/mame/drivers/progolf.c
r14976r14977
212212READ8_MEMBER(progolf_state::progolf_videoram_r)
213213{
214214   UINT8 *videoram = m_videoram;
215   UINT8 *gfx_rom = machine().region("gfx1")->base();
215   UINT8 *gfx_rom = memregion("gfx1")->base();
216216
217217   if (offset >= 0x0800)
218218   {
r14976r14977
389389
390390static PALETTE_INIT( progolf )
391391{
392   const UINT8 *color_prom = machine.region("proms")->base();
392   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
393393   int i;
394394
395395   for (i = 0;i < machine.total_colors();i++)
r14976r14977
502502{
503503   int A;
504504   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
505   UINT8 *rom = machine.region("maincpu")->base();
505   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
506506   UINT8* decrypted = auto_alloc_array(machine, UINT8, 0x10000);
507507
508508   space->set_decrypted_region(0x0000,0xffff, decrypted);
r14976r14977
516516{
517517   int A;
518518   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
519   UINT8 *rom = machine.region("maincpu")->base();
519   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
520520   UINT8* decrypted = auto_alloc_array(machine, UINT8, 0x10000);
521521
522522   space->set_decrypted_region(0x0000,0xffff, decrypted);
src/mame/drivers/powerbal.c
r14976r14977
7070   {
7171      int addr = 0x40000 * ((data & 3) - 1);
7272
73      if (addr < device->machine().region("oki")->bytes())
73      if (addr < device->machine().root_device().memregion("oki")->bytes())
7474         downcast<okim6295_device *>(device)->set_bank_base(addr);
7575   }
7676}
src/mame/drivers/jackie.c
r14976r14977
346346
347347READ8_MEMBER(jackie_state::expram_r)
348348{
349   UINT8 *rom = machine().region("gfx3")->base();
349   UINT8 *rom = memregion("gfx3")->base();
350350
351351   offset += m_exp_bank * 0x8000;
352352//  logerror("PC %06X: %04x = %02x\n",cpu_get_pc(&space.device()),offset,rom[offset]);
r14976r14977
540540{
541541
542542   int A;
543   UINT8 *rom = machine.region("maincpu")->base();
543   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
544544
545545   for (A = 0;A < 0xf000;A++)
546546   {
src/mame/drivers/warriorb.c
r14976r14977
167167static void reset_sound_region( running_machine &machine )
168168{
169169   warriorb_state *state = machine.driver_data<warriorb_state>();
170   memory_set_bank(machine, "bank10", state->m_banknum);
170   state->membank("bank10")->set_entry(state->m_banknum);
171171}
172172
173173WRITE8_MEMBER(warriorb_state::sound_bankswitch_w)
r14976r14977
542542{
543543   warriorb_state *state = machine.driver_data<warriorb_state>();
544544
545   memory_configure_bank(machine, "bank10", 0, 8, machine.region("audiocpu")->base() + 0xc000, 0x4000);
545   state->membank("bank10")->configure_entries(0, 8, state->memregion("audiocpu")->base() + 0xc000, 0x4000);
546546
547547   state->m_maincpu = machine.device("maincpu");
548548   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/goal92.c
r14976r14977
6969
7070static WRITE8_DEVICE_HANDLER( adpcm_control_w )
7171{
72   memory_set_bank(device->machine(), "bank1", data & 0x01);
72   device->machine().root_device().membank("bank1")->set_entry(data & 0x01);
7373
7474   msm5205_reset_w(device, data & 0x08);
7575}
r14976r14977
291291static MACHINE_START( goal92 )
292292{
293293   goal92_state *state = machine.driver_data<goal92_state>();
294   UINT8 *ROM = machine.region("audiocpu")->base();
294   UINT8 *ROM = state->memregion("audiocpu")->base();
295295
296   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x4000);
296   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000);
297297
298298   state->m_audiocpu = machine.device("audiocpu");
299299
src/mame/drivers/alg.c
r14976r14977
225225   address_space *space = device->machine().device("maincpu")->memory().space(AS_PROGRAM);
226226
227227   /* switch banks as appropriate */
228   memory_set_bank(device->machine(), "bank1", data & 1);
228   device->machine().root_device().membank("bank1")->set_entry(data & 1);
229229
230230   /* swap the write handlers between ROM and bank 1 based on the bit */
231231   if ((data & 1) == 0)
r14976r14977
699699   amiga_machine_config(machine, &alg_intf);
700700
701701   /* set up memory */
702   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
703   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
702   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
703   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
704704}
705705
706706
r14976r14977
713713
714714static DRIVER_INIT( palr1 )
715715{
716   UINT32 length = machine.region("user2")->bytes();
717   UINT8 *rom = machine.region("user2")->base();
716   UINT32 length = machine.root_device().memregion("user2")->bytes();
717   UINT8 *rom = machine.root_device().memregion("user2")->base();
718718   UINT8 *original = auto_alloc_array(machine, UINT8, length);
719719   UINT32 srcaddr;
720720
r14976r14977
733733
734734static DRIVER_INIT( palr3 )
735735{
736   UINT32 length = machine.region("user2")->bytes();
737   UINT8 *rom = machine.region("user2")->base();
736   UINT32 length = machine.root_device().memregion("user2")->bytes();
737   UINT8 *rom = machine.root_device().memregion("user2")->base();
738738   UINT8 *original = auto_alloc_array(machine, UINT8, length);
739739   UINT32 srcaddr;
740740
r14976r14977
752752
753753static DRIVER_INIT( palr6 )
754754{
755   UINT32 length = machine.region("user2")->bytes();
756   UINT8 *rom = machine.region("user2")->base();
755   UINT32 length = machine.root_device().memregion("user2")->bytes();
756   UINT8 *rom = machine.root_device().memregion("user2")->base();
757757   UINT8 *original = auto_alloc_array(machine, UINT8, length);
758758   UINT32 srcaddr;
759759
r14976r14977
774774static DRIVER_INIT( aplatoon )
775775{
776776   /* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */
777   UINT8 *rom = machine.region("user2")->base();
777   UINT8 *rom = machine.root_device().memregion("user2")->base();
778778   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x40000);
779779   int i;
780780
src/mame/drivers/trucocl.c
r14976r14977
5252static WRITE8_DEVICE_HANDLER( audio_dac_w )
5353{
5454   trucocl_state *state = device->machine().driver_data<trucocl_state>();
55   UINT8 *rom = device->machine().region("maincpu")->base();
55   UINT8 *rom = state->memregion("maincpu")->base();
5656   int   dac_address = ( data & 0xf0 ) << 8;
5757   int   sel = ( ( (~data) >> 1 ) & 2 ) | ( data & 1 );
5858
src/mame/drivers/unico.c
r14976r14977
9191           contains garbage. Indeed, only banks 0&1 are used */
9292
9393      int bank = (data >> 8 ) & 1;
94      UINT8 *dst   = machine().region("oki")->base();
94      UINT8 *dst   = memregion("oki")->base();
9595      UINT8 *src   = dst + 0x80000 + 0x20000 + 0x20000 * bank;
9696      memcpy(dst + 0x20000, src, 0x20000);
9797
r14976r14977
180180   if (ACCESSING_BITS_24_31)
181181   {
182182      int bank = ((data >> 24) & 3) % 4;
183      UINT8 *dst   = machine().region("oki1")->base();
183      UINT8 *dst   = memregion("oki1")->base();
184184      UINT8 *src   = dst + 0x80000 + 0x20000 + 0x20000 * bank;
185185      memcpy(dst + 0x20000, src, 0x20000);
186186   }
src/mame/drivers/blockhl.c
r14976r14977
189189static MACHINE_START( blockhl )
190190{
191191   blockhl_state *state = machine.driver_data<blockhl_state>();
192   UINT8 *ROM = machine.region("maincpu")->base();
192   UINT8 *ROM = state->memregion("maincpu")->base();
193193
194   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x2000);
194   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000);
195195
196196   state->m_maincpu = machine.device("maincpu");
197197   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
318318
319319   /* bits 0-1 = ROM bank */
320320   state->m_rombank = lines & 0x03;
321   memory_set_bank(device->machine(), "bank1", state->m_rombank);
321   state->membank("bank1")->set_entry(state->m_rombank);
322322
323323   /* bits 3/4 = coin counters */
324324   coin_counter_w(device->machine(), 0, lines & 0x08);
src/mame/drivers/gcpinbal.c
r14976r14977
214214   }
215215   else
216216   {
217      UINT8 *ROM = device->machine().region("msm")->base();
217      UINT8 *ROM = device->machine().root_device().memregion("msm")->base();
218218
219219      state->m_adpcm_data = ((state->m_adpcm_trigger ? (ROM[state->m_adpcm_start] & 0x0f) : (ROM[state->m_adpcm_start] & 0xf0) >> 4));
220220      msm5205_data_w(device, state->m_adpcm_data & 0xf);
src/mame/drivers/bottom9.c
r14976r14977
110110   else
111111      bank = ((data & 0x0e) >> 1);
112112
113   memory_set_bank(machine(), "bank1", bank);
113   membank("bank1")->set_entry(bank);
114114}
115115
116116WRITE8_MEMBER(bottom9_state::bottom9_1f90_w)
r14976r14977
322322static MACHINE_START( bottom9 )
323323{
324324   bottom9_state *state = machine.driver_data<bottom9_state>();
325   UINT8 *ROM = machine.region("maincpu")->base();
325   UINT8 *ROM = state->memregion("maincpu")->base();
326326
327   memory_configure_bank(machine, "bank1", 0, 12, &ROM[0x10000], 0x2000);
327   state->membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x2000);
328328
329329   state->m_maincpu = machine.device("maincpu");
330330   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/dreamwld.c
r14976r14977
168168   const gfx_element *gfx = machine.gfx[0];
169169   UINT32 *source = state->m_spritebuf1;
170170   UINT32 *finish = state->m_spritebuf1 + 0x1000 / 4;
171   UINT16 *redirect = (UINT16 *)machine.region("spritelut")->base();
171   UINT16 *redirect = (UINT16 *)state->memregion("spritelut")->base();
172172
173173   while (source < finish)
174174   {
r14976r14977
408408   //printf("protection read %04x\n", count);
409409   //count++;
410410
411   UINT8 *protdata = machine().region("user1")->base();
412   size_t protsize = machine().region("user1")->bytes();
411   UINT8 *protdata = memregion("user1")->base();
412   size_t protsize = memregion("user1")->bytes();
413413   UINT8 dat = protdata[(m_protindex++) % protsize];
414414
415415   // real hw returns 00 after end of data, I haven't checked if it's possible to overflow the read counter
r14976r14977
421421
422422WRITE32_MEMBER(dreamwld_state::dreamwld_6295_0_bank_w)
423423{
424   UINT8 *sound = machine().region("oki1")->base();
424   UINT8 *sound = memregion("oki1")->base();
425425
426426   if (ACCESSING_BITS_0_7)
427427      memcpy(sound + 0x30000, sound + 0xb0000 + 0x10000 * (data&0x3), 0x10000);
r14976r14977
431431
432432WRITE32_MEMBER(dreamwld_state::dreamwld_6295_1_bank_w)
433433{
434   UINT8 *sound = machine().region("oki2")->base();
434   UINT8 *sound = memregion("oki2")->base();
435435
436436   if (ACCESSING_BITS_0_7)
437437      memcpy(sound + 0x30000, sound + 0xb0000 + 0x10000 * (data&0x3), 0x10000);
src/mame/drivers/astrocde.c
r14976r14977
428428
429429   /* set the main banking */
430430   prog_space->install_read_bank(0x4000, 0xbfff, "bank1");
431   memory_set_bankptr(machine(), "bank1", machine().region("user1")->base() + 0x8000 * bank);
431   membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + 0x8000 * bank);
432432
433433   /* bank 0 reads video RAM in the 4000-7FFF range */
434434   if (bank == 0)
435435      prog_space->install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r),this));
436436
437437   /* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */
438   if ((data & 0x80) && machine().region("user2")->base() != NULL)
438   if ((data & 0x80) && memregion("user2")->base() != NULL)
439439   {
440440      /* Note: There is a jumper which could change the base offset to 0xa8 instead */
441441      bank = data - 0x80;
r14976r14977
444444      if (bank < 0x28)
445445      {
446446         prog_space->install_read_bank(0x4000, 0x7fff, "bank2");
447         memory_set_bankptr(machine(), "bank2", machine().region("user2")->base() + 0x4000 * bank);
447         membank("bank2")->set_base(machine().root_device().memregion("user2")->base() + 0x4000 * bank);
448448      }
449449      else
450450         prog_space->unmap_read(0x4000, 0x7fff);
src/mame/drivers/m62.c
r14976r14977
9090
9191      /* swap to bank #1 on second read */
9292      if (m_ldrun2_bankswap == 0)
93         memory_set_bank(machine(), "bank1", 1);
93         membank("bank1")->set_entry(1);
9494   }
9595   return 0;
9696}
r14976r14977
114114         logerror("unknown bank select %02x\n",data);
115115         return;
116116      }
117      memory_set_bank(machine(), "bank1", banks[data - 1]);
117      membank("bank1")->set_entry(banks[data - 1]);
118118   }
119119   else
120120   {
r14976r14977
143143
144144WRITE8_MEMBER(m62_state::ldrun4_bankswitch_w)
145145{
146   memory_set_bank(machine(), "bank1", data & 0x01);
146   membank("bank1")->set_entry(data & 0x01);
147147}
148148
149149WRITE8_MEMBER(m62_state::kidniki_bankswitch_w)
150150{
151   memory_set_bank(machine(), "bank1", data & 0x0f);
151   membank("bank1")->set_entry(data & 0x0f);
152152}
153153
154154#define battroad_bankswitch_w kidniki_bankswitch_w
155155
156156WRITE8_MEMBER(m62_state::spelunkr_bankswitch_w)
157157{
158   memory_set_bank(machine(), "bank1", data & 0x03);
158   membank("bank1")->set_entry(data & 0x03);
159159}
160160
161161WRITE8_MEMBER(m62_state::spelunk2_bankswitch_w)
162162{
163   memory_set_bank(machine(), "bank1", (data & 0xc0) >> 6);
164   memory_set_bank(machine(), "bank2", (data & 0x3c) >> 2);
163   membank("bank1")->set_entry((data & 0xc0) >> 6);
164   membank("bank2")->set_entry((data & 0x3c) >> 2);
165165}
166166
167167WRITE8_MEMBER(m62_state::youjyudn_bankswitch_w)
168168{
169   memory_set_bank(machine(), "bank1", data & 0x01);
169   membank("bank1")->set_entry(data & 0x01);
170170}
171171
172172
r14976r14977
21582158static DRIVER_INIT( battroad )
21592159{
21602160   /* configure memory banks */
2161   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x2000);
2161   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
21622162}
21632163
21642164static DRIVER_INIT( ldrun2 )
21652165{
21662166   /* configure memory banks */
2167   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x2000);
2167   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
21682168}
21692169
21702170static DRIVER_INIT( ldrun4 )
21712171{
21722172   /* configure memory banks */
2173   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x4000);
2173   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
21742174}
21752175
21762176static DRIVER_INIT( kidniki )
21772177{
2178   UINT8 *ROM = machine.region("maincpu")->base();
2178   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
21792179
21802180   /* in Kid Niki, bank 0 has code falling from 7fff to 8000, */
21812181   /* so I have to copy it there because bank switching wouldn't catch it */
21822182   memcpy(ROM + 0x08000, ROM + 0x10000, 0x2000);
21832183
21842184   /* configure memory banks */
2185   memory_configure_bank(machine, "bank1", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x2000);
2185   machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
21862186}
21872187
21882188static DRIVER_INIT( spelunkr )
21892189{
21902190   /* configure memory banks */
2191   memory_configure_bank(machine, "bank1", 0, 4, machine.region("maincpu")->base() + 0x10000, 0x2000);
2191   machine.root_device().membank("bank1")->configure_entries(0, 4, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
21922192}
21932193
21942194static DRIVER_INIT( spelunk2 )
21952195{
21962196   /* configure memory banks */
2197   memory_configure_bank(machine, "bank1", 0,  4, machine.region("maincpu")->base() + 0x20000, 0x1000);
2198   memory_configure_bank(machine, "bank2", 0, 16, machine.region("maincpu")->base() + 0x10000, 0x1000);
2197   machine.root_device().membank("bank1")->configure_entries(0,  4, machine.root_device().memregion("maincpu")->base() + 0x20000, 0x1000);
2198   machine.root_device().membank("bank2")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x1000);
21992199}
22002200
22012201static DRIVER_INIT( youjyudn )
22022202{
22032203   /* configure memory banks */
2204   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x10000, 0x4000);
2204   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
22052205}
22062206
22072207GAME( 1984, kungfum,  0,        kungfum,  kungfum,  0,        ROT0,   "Irem", "Kung-Fu Master", GAME_SUPPORTS_SAVE )
src/mame/drivers/40love.c
r14976r14977
274274//      popmessage("WRONG BANK SELECT = %x !!!!\n",data);
275275   }
276276
277   memory_set_bank(machine(), "bank1", data & 1);
277   membank("bank1")->set_entry(data & 1);
278278}
279279
280280WRITE8_MEMBER(fortyl_state::pix1_w)
r14976r14977
566566static DRIVER_INIT( undoukai )
567567{
568568   fortyl_state *state = machine.driver_data<fortyl_state>();
569   UINT8 *ROM = machine.region("maincpu")->base();
570   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x2000);
569   UINT8 *ROM = state->memregion("maincpu")->base();
570   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000);
571571
572572   state->m_pix_color[0] = 0x000;
573573   state->m_pix_color[1] = 0x1e3;
r14976r14977
578578static DRIVER_INIT( 40love )
579579{
580580   fortyl_state *state = machine.driver_data<fortyl_state>();
581   UINT8 *ROM = machine.region("maincpu")->base();
582   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x2000);
581   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
582   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000);
583583
584584   #if 0
585585      /* character ROM hack
586586            to show a white line on the opponent side */
587587
588      UINT8 *ROM = machine.region("gfx2")->base();
588      UINT8 *ROM = state->memregion("gfx2")->base();
589589      int adr = 0x10 * 0x022b;
590590      ROM[adr + 0x000a] = 0x00;
591591      ROM[adr + 0x000b] = 0x00;
src/mame/drivers/galaga.c
r14976r14977
809809
810810static READ8_DEVICE_HANDLER( namco_52xx_rom_r )
811811{
812   UINT32 length = device->machine().region("52xx")->bytes();
812   UINT32 length = device->machine().root_device().memregion("52xx")->bytes();
813813//printf("ROM read %04X\n", offset);
814814   if (!(offset & 0x1000))
815815      offset = (offset & 0xfff) | 0x0000;
r14976r14977
819819      offset = (offset & 0xfff) | 0x2000;
820820   else if (!(offset & 0x8000))
821821      offset = (offset & 0xfff) | 0x3000;
822   return (offset < length) ? device->machine().region("52xx")->base()[offset] : 0xff;
822   return (offset < length) ? device->machine().root_device().memregion("52xx")->base()[offset] : 0xff;
823823}
824824
825825static READ8_DEVICE_HANDLER( namco_52xx_si_r )
r14976r14977
32603260static DRIVER_INIT (galaga)
32613261{
32623262   /* swap bytes for flipped character so we can decode them together with normal characters */
3263   UINT8 *rom = machine.region("gfx1")->base();
3264   int i, len = machine.region("gfx1")->bytes();
3263   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
3264   int i, len = machine.root_device().memregion("gfx1")->bytes();
32653265
32663266   for (i = 0;i < len;i++)
32673267   {
r14976r14977
32893289   UINT8 *rom;
32903290   int i;
32913291
3292   rom = machine.region("gfx3")->base() + 0x5000;
3292   rom = machine.root_device().memregion("gfx3")->base() + 0x5000;
32933293   for (i = 0;i < 0x2000;i++)
32943294      rom[i + 0x2000] = rom[i] >> 4;
32953295}
r14976r14977
33013301
33023302
33033303   /* convert one of the sprite ROMs to the format used by Xevious */
3304   rom = machine.region("gfx3")->base();
3304   rom = machine.root_device().memregion("gfx3")->base();
33053305   for (A = 0x5000;A < 0x7000;A++)
33063306   {
33073307      rom[A] = BITSWAP8(rom[A],1,3,5,7,0,2,4,6);
33083308   }
33093309
33103310   /* convert one of tile map ROMs to the format used by Xevious */
3311   rom = machine.region("gfx4")->base();
3311   rom = machine.root_device().memregion("gfx4")->base();
33123312   for (A = 0x0000;A < 0x1000;A++)
33133313   {
33143314      rom[A] = BITSWAP8(rom[A],3,7,5,1,2,6,4,0);
src/mame/drivers/panicr.c
r14976r14977
9393
9494static PALETTE_INIT( panicr )
9595{
96   const UINT8 *color_prom = machine.region("proms")->base();
96   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
9797   int i;
9898
9999   /* allocate the colortable */
r14976r14977
151151{
152152   int code,attr;
153153
154   code=machine.region("user1")->base()[tile_index];
155   attr=machine.region("user2")->base()[tile_index];
154   code=machine.root_device().memregion("user1")->base()[tile_index];
155   attr=machine.root_device().memregion("user2")->base()[tile_index];
156156   code+=((attr&7)<<8);
157157   SET_TILE_INFO(
158158      1,
r14976r14977
469469   int size;
470470   int i;
471471
472   rom = machine.region("gfx1")->base();
473   size = machine.region("gfx1")->bytes();
472   rom = machine.root_device().memregion("gfx1")->base();
473   size = machine.root_device().memregion("gfx1")->bytes();
474474
475475   // text data lines
476476   for (i = 0;i < size/2;i++)
r14976r14977
492492   }
493493
494494
495   rom = machine.region("gfx2")->base();
496   size = machine.region("gfx2")->bytes();
495   rom = machine.root_device().memregion("gfx2")->base();
496   size = machine.root_device().memregion("gfx2")->bytes();
497497
498498   // tiles data lines
499499   for (i = 0;i < size/4;i++)
r14976r14977
519519   }
520520
521521
522   rom = machine.region("gfx3")->base();
523   size = machine.region("gfx3")->bytes();
522   rom = machine.root_device().memregion("gfx3")->base();
523   size = machine.root_device().memregion("gfx3")->bytes();
524524
525525   // sprites data lines
526526   for (i = 0;i < size/2;i++)
r14976r14977
545545
546546   //rearrange  bg tilemaps a bit....
547547
548   rom = machine.region("user1")->base();
549   size = machine.region("user1")->bytes();
548   rom = machine.root_device().memregion("user1")->base();
549   size = machine.root_device().memregion("user1")->bytes();
550550   memcpy(buf,rom, size);
551551
552552   {
r14976r14977
558558         }
559559   }
560560
561   rom = machine.region("user2")->base();
562   size = machine.region("user2")->bytes();
561   rom = machine.root_device().memregion("user2")->base();
562   size = machine.root_device().memregion("user2")->bytes();
563563
564564   memcpy(buf,rom, size);
565565   {
src/mame/drivers/istellar.c
r14976r14977
274274
275275static PALETTE_INIT( istellar )
276276{
277   const UINT8 *color_prom = machine.region("proms")->base();
277   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
278278   int i;
279279
280280   /* Oddly enough, the top 4 bits of each byte is 0 */
src/mame/drivers/macs.c
r14976r14977
9898
9999WRITE8_MEMBER(macs_state::rambank_w)
100100{
101   memory_set_bankptr(machine(),  "bank3", &m_ram1[0x10000+(data&1)*0x800] );
101   membank("bank3")->set_base(&m_ram1[0x10000+(data&1)*0x800] );
102102}
103103
104104READ8_MEMBER(macs_state::macs_input_r)
r14976r14977
136136
137137WRITE8_MEMBER(macs_state::macs_rom_bank_w)
138138{
139   memory_set_bankptr(machine(),  "bank1", machine().region("maincpu")->base() + (data* 0x4000) + 0x10000 + macs_cart_slot*0x400000 );
139   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (data* 0x4000) + 0x10000 + macs_cart_slot*0x400000 );
140140
141141   m_st0016_rom_bank=data;
142142}
143143
144144WRITE8_MEMBER(macs_state::macs_output_w)
145145{
146   UINT8 *ROM = machine().region("maincpu")->base();
146   UINT8 *ROM = memregion("maincpu")->base();
147147
148148   switch(offset)
149149   {
r14976r14977
158158      {
159159         /* FIXME: dunno if this RAM bank is right, DASM tracking made on the POST screens indicates that there's just one RAM bank,
160160                      but then MACS2 games locks up. */
161         memory_set_bankptr(machine(),  "bank3", &m_ram1[((data&0x20)>>5)*0x1000+0x000] );
161         membank("bank3")->set_base(&m_ram1[((data&0x20)>>5)*0x1000+0x000] );
162162
163163         macs_cart_slot = (data & 0xc) >> 2;
164164
165         memory_set_bankptr(machine(),  "bank4", &ROM[macs_cart_slot*0x400000+0x10000] );
165         membank("bank4")->set_base(&ROM[macs_cart_slot*0x400000+0x10000] );
166166      }
167167
168      memory_set_bankptr(machine(),  "bank2", &m_ram1[((data&0x20)>>5)*0x1000+0x800] );
168      membank("bank2")->set_base(&m_ram1[((data&0x20)>>5)*0x1000+0x800] );
169169      break;
170170      case 2: m_mux_data = data; break;
171171
r14976r14977
676676        730E: ED B0         ldir
677677        ...
678678*/
679      memcpy(macs_ram1 + 0x0e9f, machine.region("user1")->base()+0x7327, 0xc7);
680      memcpy(macs_ram1 + 0x1e9f, machine.region("user1")->base()+0x7327, 0xc7);
679      memcpy(macs_ram1 + 0x0e9f, machine.root_device().memregion("user1")->base()+0x7327, 0xc7);
680      memcpy(macs_ram1 + 0x1e9f, machine.root_device().memregion("user1")->base()+0x7327, 0xc7);
681681
682      memcpy(macs_ram1 + 0x0800, machine.region("user1")->base()+0x73fa, 0x507);
683      memcpy(macs_ram1 + 0x1800, machine.region("user1")->base()+0x73fa, 0x507);
682      memcpy(macs_ram1 + 0x0800, machine.root_device().memregion("user1")->base()+0x73fa, 0x507);
683      memcpy(macs_ram1 + 0x1800, state->memregion("user1")->base()+0x73fa, 0x507);
684684
685685#define MAKEJMP(n,m)   macs_ram2[(n) - 0xe800 + 0]=0xc3;\
686686                  macs_ram2[(n) - 0xe800 + 1]=(m)&0xff;\
r14976r14977
716716      macs_ram1[0x1ff9]=0x07;
717717      #endif
718718
719      memory_set_bankptr(machine,  "bank1", machine.region("maincpu")->base() + 0x10000 );
720      memory_set_bankptr(machine,  "bank2", macs_ram1+0x800);
721      memory_set_bankptr(machine,  "bank3", macs_ram1+0x10000);
722      memory_set_bankptr(machine,  "bank4", machine.region("maincpu")->base() );
719      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x10000 );
720      state->membank("bank2")->set_base(macs_ram1+0x800);
721      state->membank("bank3")->set_base(macs_ram1+0x10000);
722      state->membank("bank4")->set_base(machine.root_device().memregion("maincpu")->base() );
723723}
724724
725725static DRIVER_INIT(macs)
src/mame/drivers/sbowling.c
r14976r14977
7575static TILE_GET_INFO( get_sb_tile_info )
7676{
7777   sbowling_state *state = machine.driver_data<sbowling_state>();
78   UINT8 *rom = machine.region("user1")->base();
78   UINT8 *rom = state->memregion("user1")->base();
7979   int tileno = rom[tile_index + state->m_bgmap * 1024];
8080
8181   SET_TILE_INFO(0, tileno, 0, 0);
r14976r14977
342342
343343static PALETTE_INIT( sbowling )
344344{
345   const UINT8 *color_prom = machine.region("proms")->base();
345   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
346346   int i;
347347
348348   static const int resistances_rg[3] = { 470, 270, 100 };
src/mame/drivers/psychic5.c
r14976r14977
354354
355355WRITE8_MEMBER(psychic5_state::psychic5_bankselect_w)
356356{
357   UINT8 *RAM = machine().region("maincpu")->base();
357   UINT8 *RAM = memregion("maincpu")->base();
358358   int bankaddress;
359359
360360   if (m_bank_latch != data)
361361   {
362362      m_bank_latch = data;
363363      bankaddress = 0x10000 + ((data & 3) * 0x4000);
364      memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);    /* Select 4 banks of 16k */
364      membank("bank1")->set_base(&RAM[bankaddress]);    /* Select 4 banks of 16k */
365365   }
366366}
367367
368368WRITE8_MEMBER(psychic5_state::bombsa_bankselect_w)
369369{
370   UINT8 *RAM = machine().region("maincpu")->base();
370   UINT8 *RAM = memregion("maincpu")->base();
371371   int bankaddress;
372372
373373   if (m_bank_latch != data)
374374   {
375375      m_bank_latch = data;
376376      bankaddress = 0x10000 + ((data & 7) * 0x4000);
377      memory_set_bankptr(machine(), "bank1", &RAM[bankaddress]);    /* Select 8 banks of 16k */
377      membank("bank1")->set_base(&RAM[bankaddress]);    /* Select 8 banks of 16k */
378378   }
379379}
380380
src/mame/drivers/8080bw.c
r14976r14977
21622162/* decrypt function for vortex */
21632163static DRIVER_INIT( vortex )
21642164{
2165   UINT8 *rom = machine.region("maincpu")->base();
2166   int length = machine.region("maincpu")->bytes();
2165   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
2166   int length = machine.root_device().memregion("maincpu")->bytes();
21672167   UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
21682168   UINT32 x;
21692169   for (x = 0; x < length; x++)
src/mame/drivers/othunder.c
r14976r14977
393393static void reset_sound_region( running_machine &machine )
394394{
395395   othunder_state *state = machine.driver_data<othunder_state>();
396   memory_set_bank(machine, "bank10", state->m_banknum);
396   state->membank("bank10")->set_entry(state->m_banknum);
397397}
398398
399399
r14976r14977
674674{
675675   othunder_state *state = machine.driver_data<othunder_state>();
676676
677   memory_configure_bank(machine, "bank10", 0, 4, machine.region("audiocpu")->base() + 0xc000, 0x4000);
677   state->membank("bank10")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0xc000, 0x4000);
678678
679679   state->m_maincpu = machine.device("maincpu");
680680   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/1943.c
r14976r14977
643643
644644static DRIVER_INIT( 1943 )
645645{
646   UINT8 *ROM = machine.region("maincpu")->base();
647   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
646   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
647   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
648648}
649649
650650READ8_MEMBER(_1943_state::_1943b_c007_r){ return 0; }
src/mame/drivers/psikyo4.c
r14976r14977
319319   if (offset == 2) /* Configure bank for gfx test */
320320   {
321321      if (ACCESSING_BITS_0_15)   // Bank
322         memory_set_bankptr(machine(), "bank2", machine().region("gfx1")->base() + 0x2000 * (m_vidregs[offset] & 0x1fff)); /* Bank comes from vidregs */
322         membank("bank2")->set_base(machine().root_device().memregion("gfx1")->base() + 0x2000 * (m_vidregs[offset] & 0x1fff)); /* Bank comes from vidregs */
323323   }
324324}
325325
r14976r14977
328328static void set_hotgmck_pcm_bank( running_machine &machine, int n )
329329{
330330   psikyo4_state *state = machine.driver_data<psikyo4_state>();
331   UINT8 *ymf_pcmbank = machine.region("ymf")->base() + 0x200000;
332   UINT8 *pcm_rom = machine.region("ymfsource")->base();
331   UINT8 *ymf_pcmbank = machine.root_device().memregion("ymf")->base() + 0x200000;
332   UINT8 *pcm_rom = state->memregion("ymfsource")->base();
333333
334334   memcpy(ymf_pcmbank + n * 0x100000, pcm_rom + PCM_BANK_NO_LEGACY(n) * 0x100000, 0x100000);
335335}
r14976r14977
955955static void install_hotgmck_pcm_bank(running_machine &machine)
956956{
957957   psikyo4_state *state = machine.driver_data<psikyo4_state>();
958   UINT8 *ymf_pcm = machine.region("ymf")->base();
959   UINT8 *pcm_rom = machine.region("ymfsource")->base();
958   UINT8 *ymf_pcm = machine.root_device().memregion("ymf")->base();
959   UINT8 *pcm_rom = state->memregion("ymfsource")->base();
960960
961961   memcpy(ymf_pcm, pcm_rom, 0x200000);
962962
r14976r14977
970970
971971static DRIVER_INIT( hotgmck )
972972{
973   UINT8 *RAM = machine.region("maincpu")->base();
974   memory_set_bankptr(machine, "bank1", &RAM[0x100000]);
973   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
974   machine.root_device().membank("bank1")->set_base(&RAM[0x100000]);
975975   install_hotgmck_pcm_bank(machine);   // Banked PCM ROM
976976}
977977
src/mame/drivers/nss.c
r14976r14977
394394
395395   if(m_m50458_rom_bank)
396396   {
397      UINT8 *gfx_rom = machine().region("m50458_gfx")->base();
397      UINT8 *gfx_rom = memregion("m50458_gfx")->base();
398398
399399      return gfx_rom[offset & 0xfff];
400400   }
401401   else
402402   {
403      UINT8 *gfx_ram = machine().region("m50458_vram")->base();
403      UINT8 *gfx_ram = memregion("m50458_vram")->base();
404404
405405      return gfx_ram[offset & 0xfff];
406406   }
r14976r14977
415415      logerror("Warning: write to M50458 GFX ROM!\n");
416416   else
417417   {
418      UINT8 *gfx_ram = machine().region("m50458_vram")->base();
418      UINT8 *gfx_ram = memregion("m50458_vram")->base();
419419
420420      gfx_ram[offset & 0xfff] = data;
421421   }
r14976r14977
481481    ---- ---x BIOS bankswitch
482482    */
483483
484   memory_set_bank(machine(), "bank1", data & 1);
484   membank("bank1")->set_entry(data & 1);
485485   m_m50458_rom_bank = data & 4;
486486}
487487
r14976r14977
510510static MACHINE_START( nss )
511511{
512512   nss_state *state = machine.driver_data<nss_state>();
513   UINT8 *ROM = machine.region("bios")->base();
513   UINT8 *ROM = state->memregion("bios")->base();
514514
515   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x8000);
516   memory_set_bank(machine, "bank1", 0);
515   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x8000);
516   state->membank("bank1")->set_entry(0);
517517
518518   state->m_m50458_rom_bank = 0;
519519
src/mame/drivers/taito_x.c
r14976r14977
412412{
413413   taitox_state *state = machine.driver_data<taitox_state>();
414414
415   memory_set_bankptr(machine,  "bank2", machine.region("audiocpu")->base() + (state->m_banknum * 0x4000) + 0x10000 );
415   state->membank("bank2")->set_base(state->memregion("audiocpu")->base() + (state->m_banknum * 0x4000) + 0x10000 );
416416}
417417
418418WRITE8_MEMBER(taitox_state::sound_bankswitch_w)
src/mame/drivers/djboy.c
r14976r14977
179179{
180180
181181   data ^= m_bankxor;
182   memory_set_bank(machine(), "bank1", data);
183   memory_set_bank(machine(), "bank4", 0); /* unsure if/how this area is banked */
182   membank("bank1")->set_entry(data);
183   membank("bank4")->set_entry(0); /* unsure if/how this area is banked */
184184}
185185
186186/******************************************************************************/
r14976r14977
202202   case 0x01:
203203   case 0x02:
204204   case 0x03:
205      memory_set_bank(machine(), "bank2", (data & 0xf));
205      membank("bank2")->set_entry((data & 0xf));
206206      break;
207207
208208   /* bs101.6w */
r14976r14977
214214   case 0x0d:
215215   case 0x0e:
216216   case 0x0f:
217      memory_set_bank(machine(), "bank2", (data & 0xf) - 4);
217      membank("bank2")->set_entry((data & 0xf) - 4);
218218      break;
219219
220220   default:
r14976r14977
238238
239239WRITE8_MEMBER(djboy_state::cpu2_bankswitch_w)
240240{
241   memory_set_bank(machine(), "bank3", data);   // shall we check data<0x07?
241   membank("bank3")->set_entry(data);   // shall we check data<0x07?
242242}
243243
244244/******************************************************************************/
r14976r14977
522522static MACHINE_START( djboy )
523523{
524524   djboy_state *state = machine.driver_data<djboy_state>();
525   UINT8 *MAIN = machine.region("maincpu")->base();
526   UINT8 *CPU1 = machine.region("cpu1")->base();
527   UINT8 *CPU2 = machine.region("cpu2")->base();
525   UINT8 *MAIN = machine.root_device().memregion("maincpu")->base();
526   UINT8 *CPU1 = machine.root_device().memregion("cpu1")->base();
527   UINT8 *CPU2 = state->memregion("cpu2")->base();
528528
529   memory_configure_bank(machine, "bank1", 0, 4,  &MAIN[0x00000], 0x2000);
530   memory_configure_bank(machine, "bank1", 4, 28, &MAIN[0x10000], 0x2000);
531   memory_configure_bank(machine, "bank2", 0, 2,  &CPU1[0x00000], 0x4000);
532   memory_configure_bank(machine, "bank2", 2, 10, &CPU1[0x10000], 0x4000);
533   memory_configure_bank(machine, "bank3", 0, 3,  &CPU2[0x00000], 0x4000);
534   memory_configure_bank(machine, "bank3", 3, 5,  &CPU2[0x10000], 0x4000);
535   memory_configure_bank(machine, "bank4", 0, 1,  &MAIN[0x10000], 0x3000); /* unsure if/how this area is banked */
529   state->membank("bank1")->configure_entries(0, 4,  &MAIN[0x00000], 0x2000);
530   state->membank("bank1")->configure_entries(4, 28, &MAIN[0x10000], 0x2000);
531   state->membank("bank2")->configure_entries(0, 2,  &CPU1[0x00000], 0x4000);
532   state->membank("bank2")->configure_entries(2, 10, &CPU1[0x10000], 0x4000);
533   state->membank("bank3")->configure_entries(0, 3,  &CPU2[0x00000], 0x4000);
534   state->membank("bank3")->configure_entries(3, 5,  &CPU2[0x10000], 0x4000);
535   state->membank("bank4")->configure_entry(0, &MAIN[0x10000]); /* unsure if/how this area is banked */
536536
537537   state->m_maincpu = machine.device("maincpu");
538538   state->m_cpu1 = machine.device("cpu1");
src/mame/drivers/sidearms.c
r14976r14977
4444WRITE8_MEMBER(sidearms_state::sidearms_bankswitch_w)
4545{
4646   int bankaddress;
47   UINT8 *RAM = machine().region("maincpu")->base();
47   UINT8 *RAM = memregion("maincpu")->base();
4848
4949
5050   /* bits 0 and 1 select the ROM bank */
5151   bankaddress = 0x10000 + (data & 0x0f) * 0x4000;
52   memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
52   membank("bank1")->set_base(&RAM[bankaddress]);
5353}
5454
5555
r14976r14977
124124WRITE8_MEMBER(sidearms_state::whizz_bankswitch_w)
125125{
126126   int bankaddress;
127   UINT8 *RAM = machine().region("maincpu")->base();
127   UINT8 *RAM = memregion("maincpu")->base();
128128   int bank = 0;
129129
130130   switch (data & 0xC0)
r14976r14977
136136   }
137137
138138   bankaddress = 0x10000 + bank * 0x4000;
139   memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
139   membank("bank1")->set_base(&RAM[bankaddress]);
140140}
141141
142142static ADDRESS_MAP_START( whizz_map, AS_PROGRAM, 8, sidearms_state )
src/mame/drivers/tumblep.c
r14976r14977
389389void tumblep_patch_code(UINT16 offset)
390390{
391391   /* A hack which enables all Dip Switches effects */
392   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
392   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
393393   RAM[(offset + 0)/2] = 0x0240;
394394   RAM[(offset + 2)/2] = 0xffff;   // andi.w  #$f3ff, D0
395395}
src/mame/drivers/kingobox.c
r14976r14977
788788static DRIVER_INIT( ringking3 )
789789{
790790   int i;
791   UINT8 *RAM = machine.region("proms")->base();
791   UINT8 *RAM = machine.root_device().memregion("proms")->base();
792792
793793   /* expand the first color PROM to look like the kingofb ones... */
794794   for (i = 0; i < 0x100; i++)
r14976r14977
798798static DRIVER_INIT( ringkingw )
799799{
800800   int i,j,k;
801   UINT8 *PROMS = machine.region("proms")->base();
802   UINT8 *USER1 = machine.region("user1")->base();
801   UINT8 *PROMS = machine.root_device().memregion("proms")->base();
802   UINT8 *USER1 = machine.root_device().memregion("user1")->base();
803803
804804   /* change the PROMs encode in a simple format to use kingofb decode */
805805   for(i = 0, j = 0; j < 0x40; i++, j++)
src/mame/drivers/esripsys.c
r14976r14977
104104WRITE8_MEMBER(esripsys_state::g_status_w)
105105{
106106   int bankaddress;
107   UINT8 *rom = machine().region("game_cpu")->base();
107   UINT8 *rom = memregion("game_cpu")->base();
108108
109109   m_g_status = data;
110110
111111   bankaddress = 0x10000 + (data & 0x03) * 0x10000;
112   memory_set_bankptr(machine(), "bank1", &rom[bankaddress]);
112   membank("bank1")->set_base(&rom[bankaddress]);
113113
114114   cputag_set_input_line(machine(), "frame_cpu", M6809_FIRQ_LINE, data & 0x10 ? CLEAR_LINE : ASSERT_LINE);
115115   cputag_set_input_line(machine(), "frame_cpu", INPUT_LINE_NMI,  data & 0x80 ? CLEAR_LINE : ASSERT_LINE);
r14976r14977
491491
492492WRITE8_MEMBER(esripsys_state::s_200f_w)
493493{
494   UINT8 *rom = machine().region("sound_data")->base();
494   UINT8 *rom = memregion("sound_data")->base();
495495   int rombank = data & 0x20 ? 0x2000 : 0;
496496
497497   /* Bit 6 -> Reset latch U56A */
r14976r14977
506506      m_u56b = 1;
507507
508508   /* Speech data resides in the upper 8kB of the ROMs */
509   memory_set_bankptr(machine(), "bank2", &rom[0x0000 + rombank]);
510   memory_set_bankptr(machine(), "bank3", &rom[0x4000 + rombank]);
511   memory_set_bankptr(machine(), "bank4", &rom[0x8000 + rombank]);
509   membank("bank2")->set_base(&rom[0x0000 + rombank]);
510   membank("bank3")->set_base(&rom[0x4000 + rombank]);
511   membank("bank4")->set_base(&rom[0x8000 + rombank]);
512512
513513   m_s_to_g_latch2 = data;
514514}
r14976r14977
645645static DRIVER_INIT( esripsys )
646646{
647647   esripsys_state *state = machine.driver_data<esripsys_state>();
648   UINT8 *rom = machine.region("sound_data")->base();
648   UINT8 *rom = state->memregion("sound_data")->base();
649649
650650   state->m_fdt_a = auto_alloc_array(machine, UINT8, FDT_RAM_SIZE);
651651   state->m_fdt_b = auto_alloc_array(machine, UINT8, FDT_RAM_SIZE);
r14976r14977
653653
654654   machine.device<nvram_device>("nvram")->set_base(state->m_cmos_ram, CMOS_RAM_SIZE);
655655
656   memory_set_bankptr(machine, "bank2", &rom[0x0000]);
657   memory_set_bankptr(machine, "bank3", &rom[0x4000]);
658   memory_set_bankptr(machine, "bank4", &rom[0x8000]);
656   state->membank("bank2")->set_base(&rom[0x0000]);
657   state->membank("bank3")->set_base(&rom[0x4000]);
658   state->membank("bank4")->set_base(&rom[0x8000]);
659659
660660   /* Register stuff for state saving */
661661   state_save_register_global_pointer(machine, state->m_fdt_a, FDT_RAM_SIZE);
src/mame/drivers/ettrivia.c
r14976r14977
8787
8888READ8_MEMBER(ettrivia_state::ettrivia_question_r)
8989{
90   UINT8 *QUESTIONS = machine().region("user1")->base();
90   UINT8 *QUESTIONS = memregion("user1")->base();
9191   return QUESTIONS[offset + 0x10000 * m_question_bank];
9292}
9393
r14976r14977
215215
216216static PALETTE_INIT( ettrivia )
217217{
218   const UINT8 *color_prom = machine.region("proms")->base();
218   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
219219   static const int resistances[2] = { 270, 130 };
220220   double weights[2];
221221   int i;
src/mame/drivers/jalmah.c
r14976r14977
353353static void jalmah_priority_system(running_machine &machine)
354354{
355355   jalmah_state *state = machine.driver_data<jalmah_state>();
356   UINT8 *pri_rom = machine.region("user1")->base();
356   UINT8 *pri_rom = state->memregion("user1")->base();
357357   UINT8 i;
358358   UINT8 prinum[0x10];
359359
r14976r14977
950950{
951951   if(ACCESSING_BITS_0_7)
952952   {
953      UINT8 *oki = machine().region("oki")->base();
953      UINT8 *oki = memregion("oki")->base();
954954
955955      m_oki_rom = data & 1;
956956
r14976r14977
967967{
968968   if(ACCESSING_BITS_0_7)
969969   {
970      UINT8 *oki = machine().region("oki")->base();
970      UINT8 *oki = memregion("oki")->base();
971971
972972      m_oki_bank = data & 3;
973973
src/mame/drivers/f1gp.c
r14976r14977
4343
4444READ16_MEMBER(f1gp_state::extrarom_r)
4545{
46   UINT8 *rom = machine().region("user1")->base();
46   UINT8 *rom = memregion("user1")->base();
4747
4848   offset *= 2;
4949
r14976r14977
5252
5353READ16_MEMBER(f1gp_state::extrarom2_r)
5454{
55   UINT8 *rom = machine().region("user2")->base();
55   UINT8 *rom = memregion("user2")->base();
5656
5757   offset *= 2;
5858
r14976r14977
6161
6262WRITE8_MEMBER(f1gp_state::f1gp_sh_bankswitch_w)
6363{
64   memory_set_bank(machine(), "bank1", data & 0x01);
64   membank("bank1")->set_entry(data & 0x01);
6565}
6666
6767
r14976r14977
166166    if(old_bank != new_bank && new_bank < 5)
167167    {
168168        // oki banking
169        UINT8 *src = machine().region("oki")->base() + 0x40000 + 0x10000 * new_bank;
170        UINT8 *dst = machine().region("oki")->base() + 0x30000;
169        UINT8 *src = memregion("oki")->base() + 0x40000 + 0x10000 * new_bank;
170        UINT8 *dst = memregion("oki")->base() + 0x30000;
171171        memcpy(dst, src, 0x10000);
172172
173173        old_bank = new_bank;
r14976r14977
427427static MACHINE_START( f1gp )
428428{
429429   f1gp_state *state = machine.driver_data<f1gp_state>();
430   UINT8 *ROM = machine.region("audiocpu")->base();
430   UINT8 *ROM = state->memregion("audiocpu")->base();
431431
432   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x8000);
432   state->membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x8000);
433433
434434   state->m_audiocpu = machine.device("audiocpu");
435435   state->m_k053936 = machine.device("k053936");
src/mame/drivers/supdrapo.c
r14976r14977
126126/*Maybe bit 2 & 3 of the second color prom are intensity bits? */
127127static PALETTE_INIT( sdpoker )
128128{
129   const UINT8 *color_prom = machine.region("proms")->base();
129   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
130130   int   bit0, bit1, bit2 , r, g, b;
131131   int   i;
132132
src/mame/drivers/namcos2.c
r14976r14977
51005100{
51015101   /* unscramble sprites */
51025102   int i, j, k, l;
5103   UINT8 *data = machine.region("gfx1")->base();
5103   UINT8 *data = machine.root_device().memregion("gfx1")->base();
51045104   for(i=0; i<0x200000; i+=32*32)
51055105   {
51065106      for(j=0; j<32*32; j+=32*4)
r14976r14977
52175217
52185218
52195219static DRIVER_INIT( luckywld ){
5220   UINT8 *pData = (UINT8 *)machine.region( "gfx5" )->base();
5220   UINT8 *pData = (UINT8 *)machine.root_device().memregion( "gfx5" )->base();
52215221   int i;
52225222   for( i=0; i<32*0x4000; i++ )
52235223   { /* unscramble gfx mask */
src/mame/drivers/exzisus.c
r14976r14977
4848
4949WRITE8_MEMBER(exzisus_state::exzisus_cpua_bankswitch_w)
5050{
51   UINT8 *RAM = machine().region("cpua")->base();
51   UINT8 *RAM = memregion("cpua")->base();
5252
5353   if ( (data & 0x0f) != m_cpua_bank )
5454   {
5555      m_cpua_bank = data & 0x0f;
5656      if (m_cpua_bank >= 2)
5757      {
58         memory_set_bankptr(machine(),  "bank2", &RAM[ 0x10000 + ( (m_cpua_bank - 2) * 0x4000 ) ] );
58         membank("bank2")->set_base(&RAM[ 0x10000 + ( (m_cpua_bank - 2) * 0x4000 ) ] );
5959      }
6060   }
6161
r14976r14977
6464
6565WRITE8_MEMBER(exzisus_state::exzisus_cpub_bankswitch_w)
6666{
67   UINT8 *RAM = machine().region("cpub")->base();
67   UINT8 *RAM = memregion("cpub")->base();
6868
6969   if ( (data & 0x0f) != m_cpub_bank )
7070   {
7171      m_cpub_bank = data & 0x0f;
7272      if (m_cpub_bank >= 2)
7373      {
74         memory_set_bankptr(machine(),  "bank1", &RAM[ 0x10000 + ( (m_cpub_bank - 2) * 0x4000 ) ] );
74         membank("bank1")->set_base(&RAM[ 0x10000 + ( (m_cpub_bank - 2) * 0x4000 ) ] );
7575      }
7676   }
7777
r14976r14977
117117// the RAM check to work
118118static DRIVER_INIT( exzisus )
119119{
120   UINT8 *RAM = machine.region("cpua")->base();
120   UINT8 *RAM = machine.root_device().memregion("cpua")->base();
121121
122122   /* Fix WORK RAM error */
123123   RAM[0x67fd] = 0x18;
src/mame/drivers/merit.c
r14976r14977
100100
101101READ8_MEMBER(merit_state::questions_r)
102102{
103   UINT8 *questions = machine().region("user1")->base();
103   UINT8 *questions = memregion("user1")->base();
104104   int address;
105105
106106   switch(m_question_address >> 16)
r14976r14977
220220   UINT16 x = 0;
221221   int rlen;
222222
223   gfx[0] = device->machine().region("gfx1")->base();
224   gfx[1] = device->machine().region("gfx2")->base();
225   rlen = device->machine().region("gfx2")->bytes();
223   gfx[0] = device->machine().root_device().memregion("gfx1")->base();
224   gfx[1] = device->machine().root_device().memregion("gfx2")->base();
225   rlen = state->memregion("gfx2")->bytes();
226226
227227   //ma = ma ^ 0x7ff;
228228   for (cx = 0; cx < x_count; cx++)
r14976r14977
335335{
336336   if ( data == 0 )
337337   {
338      memory_set_bank(machine(), "bank1", 1);
339      memory_set_bank(machine(), "bank2", 1);
338      membank("bank1")->set_entry(1);
339      membank("bank2")->set_entry(1);
340340   }
341341   else if ( data == 0xff )
342342   {
343      memory_set_bank(machine(), "bank1", 0);
344      memory_set_bank(machine(), "bank2", 0);
343      membank("bank1")->set_entry(0);
344      membank("bank2")->set_entry(0);
345345   }
346346   else
347347   {
r14976r14977
12151215static MACHINE_START(casino5)
12161216{
12171217   MACHINE_START_CALL(merit);
1218   memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base() + 0x2000, 0x2000);
1219   memory_configure_bank(machine, "bank2", 0, 2, machine.region("maincpu")->base() + 0x6000, 0x2000);
1220   memory_set_bank(machine, "bank1", 0);
1221   memory_set_bank(machine, "bank2", 0);
1218   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x2000, 0x2000);
1219   machine.root_device().membank("bank2")->configure_entries(0, 2, machine.root_device().memregion("maincpu")->base() + 0x6000, 0x2000);
1220   machine.root_device().membank("bank1")->set_entry(0);
1221   machine.root_device().membank("bank2")->set_entry(0);
12221222}
12231223
12241224static MACHINE_CONFIG_START( pitboss, merit_state )
r14976r14977
20212021
20222022static DRIVER_INIT( couple )
20232023{
2024   UINT8 *ROM = machine.region("maincpu")->base();
2024   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
20252025
20262026   #if 0 //quick rom compare test
20272027   {
r14976r14977
20412041      dumpers it's just the way it is,a.k.a. it's an "hardware" banking.
20422042      update 20060118 by f205v: now we have 3 dumps from 3 different boards and they
20432043      all behave the same...*/
2044   memory_set_bankptr(machine, "bank1",ROM + 0x10000 + (0x2000 * 2));
2044   machine.root_device().membank("bank1")->set_base(ROM + 0x10000 + (0x2000 * 2));
20452045}
20462046
20472047static DRIVER_INIT( dtrvwz5 )
20482048{
20492049   merit_state *state = machine.driver_data<merit_state>();
20502050   int i;
2051   UINT8 *ROM = machine.region("maincpu")->base();
2051   UINT8 *ROM = state->memregion("maincpu")->base();
20522052   /* fill b000 - b0ff with ret 0xc9 */
20532053   for ( i = 0xb000; i < 0xb100; i++ )
20542054      ROM[i] = 0xc9;
src/mame/drivers/pingpong.c
r14976r14977
3636      static const char * const bankname[] = { "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7", "bank8" };
3737      const char *bank = bankname[data & 7];
3838      int bankaddr = m_question_addr_high | ((data - 0x60) * 0x100);
39      UINT8 *questions = machine().region("user1")->base() + bankaddr;
40      memory_set_bankptr(machine(), bank,questions);
39      UINT8 *questions = memregion("user1")->base() + bankaddr;
40      membank(bank)->set_base(questions);
4141
4242   }
4343}
r14976r14977
559559
560560static DRIVER_INIT( merlinmm )
561561{
562   UINT8 *ROM = machine.region("maincpu")->base();
562   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
563563   int i;
564564
565565   /* decrypt program code */
r14976r14977
573573   int i;
574574
575575   /* decrypt program code */
576   ROM = machine.region("maincpu")->base();
576   ROM = machine.root_device().memregion("maincpu")->base();
577577   for( i = 0; i < 0x4000; i++ )
578578      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
579579
580580   /* decrypt questions */
581   ROM = machine.region("user1")->base();
581   ROM = machine.root_device().memregion("user1")->base();
582582   for( i = 0; i < 0x40000; i++ )
583583      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
584584
r14976r14977
598598   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5700, 0x57ff, "bank8");
599599
600600   // setup default banks
601   memory_set_bankptr(machine, "bank1", machine.region("user1")->base() + 0x100*0 );
602   memory_set_bankptr(machine, "bank2", machine.region("user1")->base() + 0x100*1 );
603   memory_set_bankptr(machine, "bank3", machine.region("user1")->base() + 0x100*2 );
604   memory_set_bankptr(machine, "bank4", machine.region("user1")->base() + 0x100*3 );
605   memory_set_bankptr(machine, "bank5", machine.region("user1")->base() + 0x100*4 );
606   memory_set_bankptr(machine, "bank6", machine.region("user1")->base() + 0x100*5 );
607   memory_set_bankptr(machine, "bank7", machine.region("user1")->base() + 0x100*6 );
608   memory_set_bankptr(machine, "bank8", machine.region("user1")->base() + 0x100*7 );
601   state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base() + 0x100*0 );
602   state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base() + 0x100*1 );
603   state->membank("bank3")->set_base(machine.root_device().memregion("user1")->base() + 0x100*2 );
604   state->membank("bank4")->set_base(machine.root_device().memregion("user1")->base() + 0x100*3 );
605   state->membank("bank5")->set_base(machine.root_device().memregion("user1")->base() + 0x100*4 );
606   state->membank("bank6")->set_base(machine.root_device().memregion("user1")->base() + 0x100*5 );
607   state->membank("bank7")->set_base(machine.root_device().memregion("user1")->base() + 0x100*6 );
608   state->membank("bank8")->set_base(state->memregion("user1")->base() + 0x100*7 );
609609}
610610
611611
src/mame/drivers/ssrj.c
r14976r14977
3737static MACHINE_RESET(ssrj)
3838{
3939   ssrj_state *state = machine.driver_data<ssrj_state>();
40   UINT8 *rom = machine.region("maincpu")->base();
40   UINT8 *rom = state->memregion("maincpu")->base();
4141
4242   memset(&rom[0xc000], 0 ,0x3fff); /* req for some control types */
4343   state->m_oldport = 0x80;
src/mame/drivers/meadows.c
r14976r14977
872872      0x01,0x80, 0x03,0xc0, 0x03,0xc0, 0x01,0x80
873873   };
874874   int i;
875   UINT8 *gfx2 = machine.region("gfx2")->base();
876   UINT8 *gfx3 = machine.region("gfx3")->base();
877   UINT8 *gfx4 = machine.region("gfx4")->base();
878   UINT8 *gfx5 = machine.region("gfx5")->base();
879   int len3 = machine.region("gfx3")->bytes();
880   int len4 = machine.region("gfx4")->bytes();
875   UINT8 *gfx2 = machine.root_device().memregion("gfx2")->base();
876   UINT8 *gfx3 = machine.root_device().memregion("gfx3")->base();
877   UINT8 *gfx4 = machine.root_device().memregion("gfx4")->base();
878   UINT8 *gfx5 = machine.root_device().memregion("gfx5")->base();
879   int len3 = machine.root_device().memregion("gfx3")->bytes();
880   int len4 = machine.root_device().memregion("gfx4")->bytes();
881881
882882   memcpy(gfx3,gfx2,len3);
883883
r14976r14977
896896   UINT8 *mem;
897897
898898   /* create an inverted copy of the graphics data */
899   mem = machine.region("gfx1")->base();
900   length = machine.region("gfx1")->bytes();
899   mem = machine.root_device().memregion("gfx1")->base();
900   length = machine.root_device().memregion("gfx1")->bytes();
901901   for (i = 0; i < length/2; i++)
902902      mem[i] = ~mem[i + length/2];
903903}
src/mame/drivers/sms.c
r14976r14977
248248
249249WRITE8_MEMBER(smsmfg_state::bankswitch_w)
250250{
251   memory_set_bank(machine(), "bank1", data);
251   membank("bank1")->set_entry(data);
252252}
253253
254254/*************************************
r14976r14977
533533static MACHINE_START( sms )
534534{
535535   smsmfg_state *state = machine.driver_data<smsmfg_state>();
536   memory_configure_bank(machine, "bank1", 0, 16, machine.region("questions")->base(), 0x4000);
536   state->membank("bank1")->configure_entries(0, 16, state->memregion("questions")->base(), 0x4000);
537537
538538   state_save_register_global(machine, state->m_communication_port_status);
539539   state_save_register_global_array(machine, state->m_communication_port);
src/mame/drivers/harddriv.c
r14976r14977
39243924static void init_dsk(running_machine &machine)
39253925{
39263926   harddriv_state *state = machine.driver_data<harddriv_state>();
3927   UINT8 *usr3 = machine.region("user3")->base();
3927   UINT8 *usr3 = state->memregion("user3")->base();
39283928
39293929   /* install ASIC61 */
39303930   state->m_maincpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x85c000, 0x85c7ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w));
r14976r14977
39583958static void init_dsk2(running_machine &machine)
39593959{
39603960   harddriv_state *state = machine.driver_data<harddriv_state>();
3961   UINT8 *usr3 = machine.region("user3")->base();
3961   UINT8 *usr3 = state->memregion("user3")->base();
39623962
39633963   /* install ASIC65 */
39643964   state->m_maincpu->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x824000, 0x824003, FUNC(asic65_data_w));
src/mame/drivers/spoker.c
r14976r14977
575575static DRIVER_INIT( spk116it )
576576{
577577   int A;
578   UINT8 *rom = machine.region("maincpu")->base();
578   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
579579
580580
581581   for (A = 0;A < 0x10000;A++)
r14976r14977
682682
683683static DRIVER_INIT( 3super8 )
684684{
685   UINT8 *ROM = machine.region("maincpu")->base();
685   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
686686   int i;
687687
688688   /* Decryption is probably done using one macrocell/output on an address decoding pal which we do not have a dump of */
r14976r14977
700700
701701   /* cheesy hack: take gfx roms from spk116it and rearrange them for this game needs */
702702   {
703      UINT8 *src = machine.region("rep_gfx")->base();
704      UINT8 *dst = machine.region("gfx1")->base();
703      UINT8 *src = machine.root_device().memregion("rep_gfx")->base();
704      UINT8 *dst = machine.root_device().memregion("gfx1")->base();
705705      UINT8 x;
706706
707707      for(x=0;x<3;x++)
src/mame/drivers/srmp2.c
r14976r14977
171171*/
172172
173173   srmp2_state *state = device->machine().driver_data<srmp2_state>();
174   UINT8 *ROM = device->machine().region("adpcm")->base();
174   UINT8 *ROM = state->memregion("adpcm")->base();
175175
176176   state->m_adpcm_sptr = (ROM[((state->m_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8);
177177   state->m_adpcm_eptr = (ROM[((state->m_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8);
r14976r14977
195195*/
196196
197197   srmp2_state *state = device->machine().driver_data<srmp2_state>();
198   UINT8 *ROM = device->machine().region("adpcm")->base();
198   UINT8 *ROM = state->memregion("adpcm")->base();
199199
200200   state->m_adpcm_sptr = (ROM[((state->m_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8);
201201   state->m_adpcm_eptr = (ROM[((state->m_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8);
r14976r14977
212212static void srmp2_adpcm_int(device_t *device)
213213{
214214   srmp2_state *state = device->machine().driver_data<srmp2_state>();
215   UINT8 *ROM = device->machine().region("adpcm")->base();
215   UINT8 *ROM = state->memregion("adpcm")->base();
216216
217217   if (state->m_adpcm_sptr)
218218   {
r14976r14977
357357    xxx- ---- : ADPCM ROM bank
358358*/
359359
360   UINT8 *ROM = machine().region("maincpu")->base();
360   UINT8 *ROM = memregion("maincpu")->base();
361361   int addr;
362362
363363   m_adpcm_bank = ((data & 0xe0) >> 5);
r14976r14977
365365   if (data & 0x1f) addr = ((0x10000 + (0x2000 * (data & 0x0f))) - 0x8000);
366366   else addr = 0x10000;
367367
368   memory_set_bankptr(machine(), "bank1", &ROM[addr]);
368   membank("bank1")->set_base(&ROM[addr]);
369369}
370370
371371/**************************************************************************
r14976r14977
507507    xxx- ---- : ADPCM ROM bank
508508*/
509509
510   UINT8 *ROM = machine().region("maincpu")->base();
510   UINT8 *ROM = memregion("maincpu")->base();
511511   int addr;
512512
513513   m_adpcm_bank = ((data & 0xe0) >> 5);
r14976r14977
515515   if (data & 0x1f) addr = ((0x10000 + (0x2000 * (data & 0x1f))) - 0x8000);
516516   else addr = 0x10000;
517517
518   memory_set_bankptr(machine(), "bank1", &ROM[addr]);
518   membank("bank1")->set_base(&ROM[addr]);
519519}
520520
521521static ADDRESS_MAP_START( rmgoldyh_io_map, AS_IO, 8, srmp2_state )
src/mame/drivers/ohmygod.c
r14976r14977
2222
2323   if (ACCESSING_BITS_0_7)
2424   {
25      UINT8 *rom = machine().region("oki")->base();
25      UINT8 *rom = memregion("oki")->base();
2626
2727      /* ADPCM bank switch */
2828      if (m_sndbank != ((data >> m_adpcm_bank_shift) & 0x0f))
r14976r14977
306306static MACHINE_RESET( ohmygod )
307307{
308308   ohmygod_state *state = machine.driver_data<ohmygod_state>();
309   UINT8 *rom = machine.region("oki")->base();
309   UINT8 *rom = state->memregion("oki")->base();
310310
311311   state->m_sndbank = 0;
312312   memcpy(rom + 0x20000, rom + 0x40000 + 0x20000 * state->m_sndbank, 0x20000);
src/mame/drivers/snk68.c
r14976r14977
10401040
10411041static DRIVER_INIT( searchar )
10421042{
1043   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
1043   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("user1")->base());
10441044}
10451045
10461046/******************************************************************************/
src/mame/drivers/aeroboto.c
r14976r14977
227227{
228228   aeroboto_state *state = machine.driver_data<aeroboto_state>();
229229
230   state->m_stars_rom = machine.region("gfx2")->base();
231   state->m_stars_length = machine.region("gfx2")->bytes();
230   state->m_stars_rom = machine.root_device().memregion("gfx2")->base();
231   state->m_stars_length = state->memregion("gfx2")->bytes();
232232
233233   state->save_item(NAME(state->m_disable_irq));
234234   state->save_item(NAME(state->m_count));
src/mame/drivers/madalien.c
r14976r14977
2525
2626INLINE UINT8 shift_common(running_machine &machine, UINT8 hi, UINT8 lo)
2727{
28   const UINT8 *table = machine.region("user2")->base();
28   const UINT8 *table = machine.root_device().memregion("user2")->base();
2929
3030   return table[((hi & 0x07) << 8) | lo];
3131}
src/mame/drivers/firetrap.c
r14976r14977
183183
184184WRITE8_MEMBER(firetrap_state::firetrap_bankselect_w)
185185{
186   memory_set_bank(machine(), "bank1", data & 0x03);
186   membank("bank1")->set_entry(data & 0x03);
187187}
188188
189189READ8_MEMBER(firetrap_state::firetrap_8751_bootleg_r)
r14976r14977
315315
316316WRITE8_MEMBER(firetrap_state::firetrap_sound_bankselect_w)
317317{
318   memory_set_bank(machine(), "bank2", data & 0x01);
318   membank("bank2")->set_entry(data & 0x01);
319319}
320320
321321static void firetrap_adpcm_int( device_t *device )
r14976r14977
593593static MACHINE_START( firetrap )
594594{
595595   firetrap_state *state = machine.driver_data<firetrap_state>();
596   UINT8 *MAIN = machine.region("maincpu")->base();
597   UINT8 *SOUND = machine.region("audiocpu")->base();
596   UINT8 *MAIN = machine.root_device().memregion("maincpu")->base();
597   UINT8 *SOUND = state->memregion("audiocpu")->base();
598598
599599   state->m_maincpu = machine.device("maincpu");
600600   state->m_audiocpu = machine.device("audiocpu");
601601   state->m_msm = machine.device("msm");
602602
603   memory_configure_bank(machine, "bank1", 0, 4, &MAIN[0x10000], 0x4000);
604   memory_configure_bank(machine, "bank2", 0, 2, &SOUND[0x10000], 0x4000);
603   state->membank("bank1")->configure_entries(0, 4, &MAIN[0x10000], 0x4000);
604   state->membank("bank2")->configure_entries(0, 2, &SOUND[0x10000], 0x4000);
605605
606606   state->save_item(NAME(state->m_i8751_current_command));
607607   state->save_item(NAME(state->m_sound_irq_enable));
src/mame/drivers/thedeep.c
r14976r14977
5353static MACHINE_RESET( thedeep )
5454{
5555   thedeep_state *state = machine.driver_data<thedeep_state>();
56   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x10000 + 0 * 0x4000);
56   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x10000 + 0 * 0x4000);
5757   state->m_scroll[0] = 0;
5858   state->m_scroll[1] = 0;
5959   state->m_scroll[2] = 0;
r14976r14977
8686         int new_rombank = m_protection_command & 3;
8787         if (m_rombank == new_rombank)   break;
8888         m_rombank = new_rombank;
89         rom = machine().region("maincpu")->base();
90         memory_set_bankptr(machine(), "bank1", rom + 0x10000 + m_rombank * 0x4000);
89         rom = memregion("maincpu")->base();
90         membank("bank1")->set_base(rom + 0x10000 + m_rombank * 0x4000);
9191         /* there's code which falls through from the fixed ROM to bank #1, I have to */
9292         /* copy it there otherwise the CPU bank switching support will not catch it. */
9393         memcpy(rom + 0x08000, rom + 0x10000 + m_rombank * 0x4000, 0x4000);
r14976r14977
116116// d166-d174:   hl = (hl + 2*a)
117117// d175-d181:   hl *= e (e must be non zero)
118118// d182-d19a:   hl /= de
119            m_protection_data = machine().region("mcu")->base()[0x185+m_protection_index++];
119            m_protection_data = memregion("mcu")->base()[0x185+m_protection_index++];
120120         else
121121            m_protection_data = 0xc9;
122122
r14976r14977
197197   if (state->m_rombank == new_rombank)
198198      return;
199199   state->m_rombank = new_rombank;
200   rom = machine.region("maincpu")->base();
201   memory_set_bankptr(machine, "bank1", rom + 0x10000 + state->m_rombank * 0x4000);
200   rom = state->memregion("maincpu")->base();
201   state->membank("bank1")->set_base(rom + 0x10000 + state->m_rombank * 0x4000);
202202   /* there's code which falls through from the fixed ROM to bank #1, I have to */
203203   /* copy it there otherwise the CPU bank switching support will not catch it. */
204204   memcpy(rom + 0x08000, rom + 0x10000 + state->m_rombank * 0x4000, 0x4000);
src/mame/drivers/zr107.c
r14976r14977
838838   state->m_led_reg0 = state->m_led_reg1 = 0x7f;
839839   state->m_ccu_vcth = state->m_ccu_vctl = 0;
840840
841   K001005_preprocess_texture_data(machine.region("gfx1")->base(), machine.region("gfx1")->bytes(), 0);
841   K001005_preprocess_texture_data(machine.root_device().memregion("gfx1")->base(), state->memregion("gfx1")->bytes(), 0);
842842}
843843
844844static DRIVER_INIT(zr107)
src/mame/drivers/sbrkout.c
r14976r14977
9999{
100100   sbrkout_state *state = machine.driver_data<sbrkout_state>();
101101   UINT8 *videoram = state->m_videoram;
102   memory_set_bankptr(machine, "bank1", &videoram[0x380]);
102   state->membank("bank1")->set_base(&videoram[0x380]);
103103   state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback));
104104   state->m_pot_timer = machine.scheduler().timer_alloc(FUNC(pot_trigger_callback));
105105
src/mame/drivers/bladestl.c
r14976r14977
8080   /* bit 4 = relay (???) */
8181
8282   /* bits 5-6 = bank number */
83   memory_set_bank(machine(), "bank1", (data & 0x60) >> 5);
83   membank("bank1")->set_entry((data & 0x60) >> 5);
8484
8585   /* bit 7 = select sprite bank */
8686   m_spritebank = (data & 0x80) << 3;
r14976r14977
301301static MACHINE_START( bladestl )
302302{
303303   bladestl_state *state = machine.driver_data<bladestl_state>();
304   UINT8 *ROM = machine.region("maincpu")->base();
304   UINT8 *ROM = state->memregion("maincpu")->base();
305305
306   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x2000);
306   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000);
307307
308308   state->m_audiocpu = machine.device("audiocpu");
309309   state->m_k007342 = machine.device("k007342");
src/mame/drivers/srumbler.c
r14976r14977
2828      that as well to be 100% accurate.
2929     */
3030   int i;
31   UINT8 *ROM = machine().region("user1")->base();
32   UINT8 *prom1 = machine().region("proms")->base() + (data & 0xf0);
33   UINT8 *prom2 = machine().region("proms")->base() + 0x100 + ((data & 0x0f) << 4);
31   UINT8 *ROM = memregion("user1")->base();
32   UINT8 *prom1 = memregion("proms")->base() + (data & 0xf0);
33   UINT8 *prom2 = memregion("proms")->base() + 0x100 + ((data & 0x0f) << 4);
3434
3535   for (i = 0x05;i < 0x10;i++)
3636   {
r14976r14977
3939      /* bit 2 of prom1 selects ROM or RAM - not supported */
4040
4141      sprintf(bankname, "%04x", i*0x1000);
42      memory_set_bankptr(machine(), bankname,&ROM[bank*0x1000]);
42      membank(bankname)->set_base(&ROM[bank*0x1000]);
4343   }
4444}
4545
src/mame/drivers/pbaction.c
r14976r14977
481481static DRIVER_INIT( pbactio3 )
482482{
483483   int i;
484   UINT8 *rom = machine.region("maincpu")->base();
484   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
485485
486486   /* first of all, do a simple bitswap */
487487   for (i = 0; i < 0xc000; i++)
src/mame/drivers/funworld.c
r14976r14977
867867
868868READ8_MEMBER(funworld_state::questions_r)
869869{
870   UINT8* quiz = machine().region("questions")->base();
870   UINT8* quiz = memregion("questions")->base();
871871   int extraoffset = ((funquiz_question_bank & 0x1f) * 0x8000);
872872
873873   // if 0x80 is set, read the 2nd half of the question rom (contains header info)
r14976r14977
43464346*****************************************************************************************************/
43474347
43484348   int x, na, nb, nad, nbd;
4349   UINT8 *src = machine.region( "gfx1" )->base();
4349   UINT8 *src = machine.root_device().memregion( "gfx1" )->base();
43504350
43514351
43524352   for (x=0x0000; x < 0x10000; x++)
r14976r14977
43764376
43774377******************************************************************/
43784378{
4379   UINT8 *ROM = machine.region("maincpu")->base();
4379   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
43804380
43814381   ROM[0xc1c6] = 0x92;
43824382}
r14976r14977
43854385/*** same as blue TAB PCB, with the magicd2a patch ***/
43864386{
43874387   int x, na, nb, nad, nbd;
4388   UINT8 *src = machine.region( "gfx1" )->base();
4389   UINT8 *ROM = machine.region("maincpu")->base();
4388   UINT8 *src = machine.root_device().memregion( "gfx1" )->base();
4389   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
43904390
43914391   for (x=0x0000; x < 0x10000; x++)
43924392   {
r14976r14977
44054405static DRIVER_INIT( soccernw )
44064406{
44074407/* temporary patch to avoid hardware errors for debug purposes */
4408   UINT8 *ROM = machine.region("maincpu")->base();
4408   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
44094409
44104410   ROM[0x80b2] = 0xa9;
44114411   ROM[0x80b3] = 0x00;
r14976r14977
44404440
44414441*************************************************/
44424442{
4443   UINT8 *rom = machine.region("maincpu")->base();
4444   int size = machine.region("maincpu")->bytes();
4443   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
4444   int size = machine.root_device().memregion("maincpu")->bytes();
44454445   int start = 0x8000;
44464446
4447   UINT8 *gfxrom = machine.region("gfx1")->base();
4448   int sizeg = machine.region("gfx1")->bytes();
4447   UINT8 *gfxrom = machine.root_device().memregion("gfx1")->base();
4448   int sizeg = machine.root_device().memregion("gfx1")->bytes();
44494449   int startg = 0;
44504450
4451   UINT8 *prom = machine.region("proms")->base();
4452   int sizep = machine.region("proms")->bytes();
4451   UINT8 *prom = machine.root_device().memregion("proms")->base();
4452   int sizep = machine.root_device().memregion("proms")->bytes();
44534453   int startp = 0;
44544454
44554455   UINT8 *buffer;
r14976r14977
45344534
45354535******************************************************/
45364536{
4537   UINT8 *ROM = machine.region("maincpu")->base();
4537   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
45384538   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
45394539
45404540   int x;
r14976r14977
45534553      ROM[x+0x10000] = code;
45544554   }
45554555
4556   space->set_decrypted_region(0x8000, 0xffff, machine.region("maincpu")->base() + 0x18000);
4556   space->set_decrypted_region(0x8000, 0xffff, machine.root_device().memregion("maincpu")->base() + 0x18000);
45574557}
45584558
45594559static DRIVER_INIT( royalcdc )
r14976r14977
45674567
45684568******************************************************/
45694569
4570   UINT8 *ROM = machine.region("maincpu")->base();
4570   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
45714571   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
45724572
45734573   int x;
r14976r14977
46064606      ROM[x+0x10000] = code;
46074607   }
46084608
4609   space->set_decrypted_region(0x6000, 0xffff, machine.region("maincpu")->base() + 0x16000);
4609   space->set_decrypted_region(0x6000, 0xffff, machine.root_device().memregion("maincpu")->base() + 0x16000);
46104610}
46114611
46124612
src/mame/drivers/jackpool.c
r14976r14977
296296
297297static DRIVER_INIT( jackpool )
298298{
299   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
299   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
300300
301301   /* patch NVRAM routine */
302302   rom[0x9040/2] = 0x6602;
src/mame/drivers/gsword.c
r14976r14977
903903static DRIVER_INIT( gsword )
904904{
905905#if 0
906   UINT8 *ROM2 = machine.region("sub")->base();
906   UINT8 *ROM2 = machine.root_device().memregion("sub")->base();
907907   ROM2[0x1da] = 0xc3; /* patch for rom self check */
908908
909909   ROM2[0x71e] = 0;    /* patch for sound protection or time out function */
r14976r14977
919919static DRIVER_INIT( gsword2 )
920920{
921921#if 0
922   UINT8 *ROM2 = machine.region("sub")->base();
922   UINT8 *ROM2 = machine.root_device().memregion("sub")->base();
923923
924924   ROM2[0x1da] = 0xc3; /* patch for rom self check */
925925   ROM2[0x726] = 0;    /* patch for sound protection or time out function */
src/mame/drivers/nbmj8900.c
r14976r14977
4545static DRIVER_INIT( ohpaipee )
4646{
4747#if 0
48   UINT8 *prot = machine.region("protdata")->base();
48   UINT8 *prot = machine.root_device().memregion("protdata")->base();
4949   int i;
5050
5151   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
5959      prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
6060   }
6161#else
62   unsigned char *ROM = machine.region("maincpu")->base();
62   unsigned char *ROM = machine.root_device().memregion("maincpu")->base();
6363
6464   // Protection ROM check skip
6565   ROM[0x00e4] = 0x00;
r14976r14977
7878static DRIVER_INIT( togenkyo )
7979{
8080#if 0
81   UINT8 *prot = machine.region("protdata")->base();
81   UINT8 *prot = machine.root_device().memregion("protdata")->base();
8282   int i;
8383
8484   /* this is one possible way to rearrange the protection ROM data to get the
r14976r14977
9191      prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
9292   }
9393#else
94   unsigned char *ROM = machine.region("maincpu")->base();
94   unsigned char *ROM = machine.root_device().memregion("maincpu")->base();
9595
9696   // Protection ROM check skip
9797   ROM[0x010b] = 0x00;
src/mame/drivers/xmen.c
r14976r14977
9797static void sound_reset_bank( running_machine &machine )
9898{
9999   xmen_state *state = machine.driver_data<xmen_state>();
100   memory_set_bank(machine, "bank4", state->m_sound_curbank & 0x07);
100   state->membank("bank4")->set_entry(state->m_sound_curbank & 0x07);
101101}
102102
103103WRITE8_MEMBER(xmen_state::sound_bankswitch_w)
r14976r14977
295295static MACHINE_START( xmen )
296296{
297297   xmen_state *state = machine.driver_data<xmen_state>();
298   UINT8 *ROM = machine.region("audiocpu")->base();
298   UINT8 *ROM = state->memregion("audiocpu")->base();
299299
300   memory_configure_bank(machine, "bank4", 0, 8, &ROM[0x10000], 0x4000);
301   memory_set_bank(machine, "bank4", 0);
300   state->membank("bank4")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
301   state->membank("bank4")->set_entry(0);
302302
303303   state->m_maincpu = machine.device("maincpu");
304304   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/silkroad.c
r14976r14977
327327       verified as correct... problem with the original which the gfx
328328       hardware didn't care about? */
329329
330   UINT8 *src = machine.region("gfx1")->base()+0x1000000;
330   UINT8 *src = machine.root_device().memregion("gfx1")->base()+0x1000000;
331331   int len = 0x0200000;
332332   UINT8 *buffer;
333333
src/mame/drivers/wink.c
r14976r14977
411411static DRIVER_INIT( wink )
412412{
413413   UINT32 i;
414   UINT8 *ROM = machine.region("maincpu")->base();
414   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
415415   UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x8000);
416416
417417   // protection module reverse engineered by HIGHWAYMAN
src/mame/drivers/lethal.c
r14976r14977
234234
235235WRITE8_MEMBER(lethal_state::le_bankswitch_w)
236236{
237   memory_set_bank(machine(), "bank1", data);
237   membank("bank1")->set_entry(data);
238238}
239239
240240READ8_MEMBER(lethal_state::le_4800_r)
r14976r14977
579579static MACHINE_START( lethalen )
580580{
581581   lethal_state *state = machine.driver_data<lethal_state>();
582   UINT8 *ROM = machine.region("maincpu")->base();
582   UINT8 *ROM = state->memregion("maincpu")->base();
583583
584   memory_configure_bank(machine, "bank1", 0, 0x20, &ROM[0x10000], 0x2000);
585   memory_set_bank(machine, "bank1", 0);
584   state->membank("bank1")->configure_entries(0, 0x20, &ROM[0x10000], 0x2000);
585   state->membank("bank1")->set_entry(0);
586586
587587   state->m_generic_paletteram_8.allocate(0x3800 + 0x02);
588588
r14976r14977
601601static MACHINE_RESET( lethalen )
602602{
603603   lethal_state *state = machine.driver_data<lethal_state>();
604   UINT8 *prgrom = (UINT8 *)machine.region("maincpu")->base();
604   UINT8 *prgrom = (UINT8 *)state->memregion("maincpu")->base();
605605   int i;
606606
607   memory_set_bankptr(machine, "bank2", &prgrom[0x48000]);
607   state->membank("bank2")->set_base(&prgrom[0x48000]);
608608   /* force reset again to read proper reset vector */
609609   machine.device("maincpu")->reset();
610610
src/mame/drivers/exprraid.c
r14976r14977
732732{
733733   /* Expand the background rom so we can use regular decode routines */
734734
735   UINT8   *gfx = machine.region("gfx3")->base();
735   UINT8   *gfx = machine.root_device().memregion("gfx3")->base();
736736   int offs = 0x10000 - 0x1000;
737737   int i;
738738
r14976r14977
751751
752752static DRIVER_INIT( wexpress )
753753{
754   UINT8 *rom = machine.region("maincpu")->base();
754   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
755755
756756   /* HACK: this set uses M6502 irq vectors but DECO CPU-16 opcodes??? */
757757   rom[0xfff7] = rom[0xfffa];
src/mame/drivers/2mindril.c
r14976r14977
495495{
496496   UINT8 lsb,msb;
497497   UINT32 offset,i;
498   UINT8 *gfx = machine.region("gfx2")->base();
499   int size=machine.region("gfx2")->bytes();
498   UINT8 *gfx = machine.root_device().memregion("gfx2")->base();
499   int size=machine.root_device().memregion("gfx2")->bytes();
500500   int data;
501501
502502   /* Setup ROM formats:
r14976r14977
528528      offset+=4;
529529   }
530530
531   gfx = machine.region("gfx1")->base();
532   size=machine.region("gfx1")->bytes();
531   gfx = machine.root_device().memregion("gfx1")->base();
532   size=machine.root_device().memregion("gfx1")->bytes();
533533
534534   offset = size/2;
535535   for (i = size/2+size/4; i<size; i++)
src/mame/drivers/naughtyb.c
r14976r14977
846846
847847READ8_MEMBER(naughtyb_state::trvmstr_questions_r)
848848{
849   return machine().region("user1")->base()[m_question_offset];
849   return memregion("user1")->base()[m_question_offset];
850850}
851851
852852WRITE8_MEMBER(naughtyb_state::trvmstr_questions_w)
src/mame/drivers/corona.c
r14976r14977
353353
354354static PALETTE_INIT( winner )
355355{
356   const UINT8 *color_prom = machine.region("proms")->base();
356   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
357357   int bit6, bit7, bit0, bit1, r, g, b;
358358   int i;
359359
src/mame/drivers/taitowlf.c
r14976r14977
7373static SCREEN_UPDATE_RGB32( taitowlf )
7474{
7575   int x,y,count;
76   const UINT8 *blit_ram = screen.machine().region("user5")->base();
76   const UINT8 *blit_ram = screen.machine().root_device().memregion("user5")->base();
7777
7878   bitmap.fill(get_black_pen(screen.machine()), cliprect);
7979
r14976r14977
144144      {
145145         if (data & 0x10)      // enable RAM access to region 0xf0000 - 0xfffff
146146         {
147            memory_set_bankptr(busdevice->machine(), "bank1", state->m_bios_ram);
147            state->membank("bank1")->set_base(state->m_bios_ram);
148148         }
149149         else               // disable RAM access (reads go to BIOS ROM)
150150         {
151            memory_set_bankptr(busdevice->machine(), "bank1", busdevice->machine().region("user1")->base() + 0x30000);
151            state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("user1")->base() + 0x30000);
152152         }
153153         break;
154154      }
r14976r14977
539539
540540static MACHINE_RESET(taitowlf)
541541{
542   memory_set_bankptr(machine, "bank1", machine.region("user1")->base() + 0x30000);
542   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("user1")->base() + 0x30000);
543543}
544544
545545
src/mame/drivers/taito_z.c
r14976r14977
14171417static void reset_sound_region( running_machine &machine )
14181418{
14191419   taitoz_state *state = machine.driver_data<taitoz_state>();
1420   memory_set_bank(machine,  "bank10", state->m_banknum);
1420   state->membank("bank10")->set_entry(state->m_banknum);
14211421}
14221422
14231423WRITE8_MEMBER(taitoz_state::sound_bankswitch_w)
r14976r14977
30603060
30613061static MACHINE_START( taitoz )
30623062{
3063   int banks = (machine.region("audiocpu")->bytes() - 0xc000) / 0x4000;
3063   int banks = (machine.root_device().memregion("audiocpu")->bytes() - 0xc000) / 0x4000;
30643064
3065   memory_configure_bank(machine, "bank10", 0, banks, machine.region("audiocpu")->base() + 0xc000, 0x4000);
3065   machine.root_device().membank("bank10")->configure_entries(0, banks, machine.root_device().memregion("audiocpu")->base() + 0xc000, 0x4000);
30663066
30673067   machine.save().register_postload(save_prepost_delegate(FUNC(taitoz_postload), &machine));
30683068
src/mame/drivers/rastan.c
r14976r14977
163163
164164static WRITE8_DEVICE_HANDLER( rastan_bankswitch_w )
165165{
166   memory_set_bank(device->machine(),  "bank1", data & 3);
166   device->machine().root_device().membank("bank1")->set_entry(data & 3);
167167}
168168
169169
r14976r14977
177177   }
178178   else
179179   {
180      state->m_adpcm_data = device->machine().region("adpcm")->base()[state->m_adpcm_pos];
180      state->m_adpcm_data = device->machine().root_device().memregion("adpcm")->base()[state->m_adpcm_pos];
181181      state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0xffff;
182182      msm5205_data_w(device, state->m_adpcm_data >> 4);
183183   }
r14976r14977
359359static MACHINE_START( rastan )
360360{
361361   rastan_state *state = machine.driver_data<rastan_state>();
362   UINT8 *ROM = machine.region("audiocpu")->base();
362   UINT8 *ROM = state->memregion("audiocpu")->base();
363363
364   memory_configure_bank(machine, "bank1", 0, 1, &ROM[0x00000], 0x4000);
365   memory_configure_bank(machine, "bank1", 1, 3, &ROM[0x10000], 0x4000);
364   state->membank("bank1")->configure_entry(0, &ROM[0x00000]);
365   state->membank("bank1")->configure_entries(1, 3, &ROM[0x10000], 0x4000);
366366
367367   state->m_maincpu = machine.device("maincpu");
368368   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/pntnpuzl.c
r14976r14977
378378
379379static DRIVER_INIT(pip)
380380{
381//  UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
381//  UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
382382//  rom[0x2696/2] = 0x4e71;
383383//  rom[0x26a0/2] = 0x4e71;
384384   pc_vga_init(machine, vga_setting, NULL);
src/mame/drivers/funkball.c
r14976r14977
490490
491491   if(m_flash_data_cmd == 0xff)
492492   {
493      UINT8 *ROM = machine().region(m_flash_cmd & 0x80 ? "prg_flash" : "data_flash")->base();
493      UINT8 *ROM = memregion(m_flash_cmd & 0x80 ? "prg_flash" : "data_flash")->base();
494494
495495      return ROM[offset + (m_flash_addr << 16)];
496496   }
r14976r14977
534534      for(i=0;i<8;i++)
535535      {
536536         if (data & 0x1 << i*4)      // enable RAM access to region 0xe0000 - 0xfffff
537            memory_set_bankptr(machine(), banknames[i], m_bios_ram + (0x4000 * i));
537            membank(banknames[i])->set_base(m_bios_ram + (0x4000 * i));
538538         else               // disable RAM access (reads go to BIOS ROM)
539            memory_set_bankptr(machine(), banknames[i], machine().region("bios")->base() + (0x4000 * i));
539            membank(banknames[i])->set_base(machine().root_device().memregion("bios")->base() + (0x4000 * i));
540540      }
541541   }
542542}
r14976r14977
11181118static MACHINE_RESET( funkball )
11191119{
11201120   funkball_state *state = machine.driver_data<funkball_state>();
1121   memory_set_bankptr(machine, "bios_ext1", machine.region("bios")->base() + 0x00000);
1122   memory_set_bankptr(machine, "bios_ext2", machine.region("bios")->base() + 0x04000);
1123   memory_set_bankptr(machine, "bios_ext3", machine.region("bios")->base() + 0x08000);
1124   memory_set_bankptr(machine, "bios_ext4", machine.region("bios")->base() + 0x0c000);
1125   memory_set_bankptr(machine, "bios_bank1", machine.region("bios")->base() + 0x10000);
1126   memory_set_bankptr(machine, "bios_bank2", machine.region("bios")->base() + 0x14000);
1127   memory_set_bankptr(machine, "bios_bank3", machine.region("bios")->base() + 0x18000);
1128   memory_set_bankptr(machine, "bios_bank4", machine.region("bios")->base() + 0x1c000);
1121   state->membank("bios_ext1")->set_base(machine.root_device().memregion("bios")->base() + 0x00000);
1122   state->membank("bios_ext2")->set_base(machine.root_device().memregion("bios")->base() + 0x04000);
1123   state->membank("bios_ext3")->set_base(machine.root_device().memregion("bios")->base() + 0x08000);
1124   state->membank("bios_ext4")->set_base(machine.root_device().memregion("bios")->base() + 0x0c000);
1125   state->membank("bios_bank1")->set_base(machine.root_device().memregion("bios")->base() + 0x10000);
1126   state->membank("bios_bank2")->set_base(machine.root_device().memregion("bios")->base() + 0x14000);
1127   state->membank("bios_bank3")->set_base(machine.root_device().memregion("bios")->base() + 0x18000);
1128   state->membank("bios_bank4")->set_base(state->memregion("bios")->base() + 0x1c000);
11291129   state->m_voodoo_pci_regs.base_addr = 0xff000000;
11301130}
11311131
src/mame/drivers/aristmk5.c
r14976r14977
289289
290290         4 pages of 32k for each sram chip.
291291    */
292    memory_set_bank(machine(),"sram_bank", (data & 0xc0) >> 6);
293    memory_set_bank(machine(),"sram_bank_nz", (data & 0xc0) >> 6);
292    membank("sram_bank")->set_entry((data & 0xc0) >> 6);
293    membank("sram_bank_nz")->set_entry((data & 0xc0) >> 6);
294294}
295295
296296/* U.S games have no dram emulator enabled */
r14976r14977
359359
360360static DRIVER_INIT( aristmk5 )
361361{
362   UINT8 *SRAM    = machine.region("sram")->base();
363   UINT8 *SRAM_NZ = machine.region("sram")->base();
362   UINT8 *SRAM    = machine.root_device().memregion("sram")->base();
363   UINT8 *SRAM_NZ = machine.root_device().memregion("sram")->base();
364364
365365   archimedes_driver_init(machine);
366366
367   memory_configure_bank(machine, "sram_bank", 0, 4,    &SRAM[0],    0x20000);
368   memory_configure_bank(machine, "sram_bank_nz", 0, 4, &SRAM_NZ[0], 0x20000);
367   machine.root_device().membank("sram_bank")->configure_entries(0, 4,    &SRAM[0],    0x20000);
368   machine.root_device().membank("sram_bank_nz")->configure_entries(0, 4, &SRAM_NZ[0], 0x20000);
369369}
370370
371371
r14976r14977
392392
393393   /* load the roms according to what the operator wants */
394394   {
395      UINT8 *ROM = machine.region("maincpu")->base();
396      UINT8 *PRG;// = machine.region("prg_code")->base();
395      UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
396      UINT8 *PRG;// = state->memregion("prg_code")->base();
397397      int i;
398398      UINT8 op_mode;
399399      static const char *const rom_region[] = { "set_chip_4.04", "set_chip_4.4", "clear_chip", "game_prg" };
400400
401401      op_mode = input_port_read(machine, "ROM_LOAD");
402402
403      PRG = machine.region(rom_region[op_mode & 3])->base();
403      PRG = machine.root_device().memregion(rom_region[op_mode & 3])->base();
404404
405405      if(PRG!=NULL)
406406
src/mame/drivers/tmspoker.c
r14976r14977
293293
294294static MACHINE_START( tmspoker )
295295{
296   UINT8 *ROM = machine.region("maincpu")->base();
297   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0], 0x1000);
296   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
297   machine.root_device().membank("bank1")->configure_entries(0, 2, &ROM[0], 0x1000);
298298}
299299
300300
r14976r14977
304304
305305   popmessage("ROM Bank: %02X", seldsw);
306306
307   memory_set_bank(machine, "bank1", seldsw);
307   machine.root_device().membank("bank1")->set_entry(seldsw);
308308}
309309
310310
r14976r14977
615615{
616616   /* decode the TMS9980 ROMs */
617617   offs_t offs;
618   UINT8 *rom = machine.region("maincpu")->base();
619   const size_t len = machine.region("maincpu")->bytes();
618   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
619   const size_t len = machine.root_device().memregion("maincpu")->bytes();
620620
621621   for (offs = 0; offs < len; offs++)
622622   {
src/mame/drivers/metalmx.c
r14976r14977
770770
771771static DRIVER_INIT( metalmx )
772772{
773   UINT8 *adsp_boot = (UINT8*)machine.region("adsp")->base();
773   UINT8 *adsp_boot = (UINT8*)machine.root_device().memregion("adsp")->base();
774774   metalmx_state *state = machine.driver_data<metalmx_state>();
775775
776776   state->m_adsp->load_boot_data(adsp_boot, state->m_adsp_internal_program_ram);
src/mame/drivers/konendev.c
r14976r14977
161161
162162DRIVER_INIT( konendev )
163163{
164   UINT8 *src = machine.region( "maincpu" )->base();
165   size_t  srcsize = machine.region( "maincpu" )->bytes();
164   UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
165   size_t  srcsize = machine.root_device().memregion( "maincpu" )->bytes();
166166   for (int i = 0; i < srcsize; i += 2)
167167   {
168168      int temp = src[i];
src/mame/drivers/darkhors.c
r14976r14977
962962
963963static DRIVER_INIT( darkhors )
964964{
965   UINT32 *rom    = (UINT32 *) machine.region("maincpu")->base();
966//   UINT8  *eeprom = (UINT8 *)  machine.region("eeprom")->base();
965   UINT32 *rom    = (UINT32 *) machine.root_device().memregion("maincpu")->base();
966//   UINT8  *eeprom = (UINT8 *)  machine.root_device().memregion("eeprom")->base();
967967//   int i;
968968
969969#if 1
src/mame/drivers/upscope.c
r14976r14977
8787static WRITE8_DEVICE_HANDLER( upscope_cia_0_porta_w )
8888{
8989   /* switch banks as appropriate */
90   memory_set_bank(device->machine(), "bank1", data & 1);
90   device->machine().root_device().membank("bank1")->set_entry(data & 1);
9191
9292   /* swap the write handlers between ROM and bank 1 based on the bit */
9393   if ((data & 1) == 0)
r14976r14977
404404   machine.device<nvram_device>("nvram")->set_base(state->m_nvram, sizeof(state->m_nvram));
405405
406406   /* set up memory */
407   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
408   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
407   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
408   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
409409}
410410
411411
src/mame/drivers/equites.c
r14976r14977
18571857
18581858static void unpack_block( running_machine &machine, const char *region, int offset, int size )
18591859{
1860   UINT8 *rom = machine.region(region)->base();
1860   UINT8 *rom = machine.root_device().memregion(region)->base();
18611861   int i;
18621862
18631863   for (i = 0; i < size; ++i)
src/mame/drivers/mirax.c
r14976r14977
130130
131131static PALETTE_INIT( mirax )
132132{
133   const UINT8 *color_prom = machine.region("proms")->base();
133   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
134134   int i;
135135
136136   for (i = 0;i < machine.total_colors();i++)
r14976r14977
535535static DRIVER_INIT( mirax )
536536{
537537   mirax_state *state = machine.driver_data<mirax_state>();
538   UINT8 *DATA = machine.region("data_code")->base();
539   UINT8 *ROM = machine.region("maincpu")->base();
538   UINT8 *DATA = machine.root_device().memregion("data_code")->base();
539   UINT8 *ROM = state->memregion("maincpu")->base();
540540   int i;
541541
542542   for(i=0x0000;i<0x4000;i++)
src/mame/drivers/cardline.c
r14976r14977
186186
187187static PALETTE_INIT(cardline)
188188{
189   const UINT8 *color_prom = machine.region("proms")->base();
189   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
190190   int i,r,g,b,data;
191191   int bit0,bit1,bit2;
192192   for (i = 0;i < machine.total_colors();i++)
src/mame/drivers/omegrace.c
r14976r14977
589589
590590static DRIVER_INIT( omegrace )
591591{
592   int i, len = machine.region("user1")->bytes();
593   UINT8 *prom = machine.region("user1")->base();
592   int i, len = machine.root_device().memregion("user1")->bytes();
593   UINT8 *prom = machine.root_device().memregion("user1")->base();
594594
595595   /* Omega Race has two pairs of the state PROM output
596596     * lines swapped before going into the decoder.
src/mame/drivers/decocass.c
r14976r14977
14511451{
14521452   decocass_state *state = machine.driver_data<decocass_state>();
14531453   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1454   UINT8 *rom = machine.region("maincpu")->base();
1454   UINT8 *rom = state->memregion("maincpu")->base();
14551455   int A;
14561456
14571457   /* allocate memory and mark all RAM regions with their decrypted pointers */
r14976r14977
14751475static DRIVER_INIT( decocrom )
14761476{
14771477   decocass_state *state = machine.driver_data<decocass_state>();
1478   int romlength = machine.region("user3")->bytes();
1479   UINT8 *rom = machine.region("user3")->base();
1478   int romlength = machine.root_device().memregion("user3")->bytes();
1479   UINT8 *rom = machine.root_device().memregion("user3")->base();
14801480   int i;
14811481
14821482   state->m_decrypted2 = auto_alloc_array(machine, UINT8, romlength);
r14976r14977
14911491   /* convert charram to a banked ROM */
14921492   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x6000, 0xafff, "bank1");
14931493   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6000, 0xafff, FUNC(decocass_de0091_w));
1494   memory_configure_bank(machine, "bank1", 0, 1, state->m_charram, 0);
1495   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user3")->base(), 0);
1496   memory_configure_bank_decrypted(machine, "bank1", 0, 1, &state->m_decrypted[0x6000], 0);
1497   memory_configure_bank_decrypted(machine, "bank1", 1, 1, state->m_decrypted2, 0);
1498   memory_set_bank(machine, "bank1", 0);
1494   state->membank("bank1")->configure_entry(0, state->m_charram);
1495   state->membank("bank1")->configure_entry(1, state->memregion("user3")->base());
1496   state->membank("bank1")->configure_decrypted_entry(0, &state->m_decrypted[0x6000]);
1497   state->membank("bank1")->configure_decrypted_entry(1, state->m_decrypted2);
1498   state->membank("bank1")->set_entry(0);
14991499
15001500   /* install the bank selector */
15011501   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xe900, 0xe900, FUNC(decocass_e900_w));
src/mame/drivers/mystwarr.c
r14976r14977
557557static void reset_sound_region(running_machine &machine)
558558{
559559   mystwarr_state *state = machine.driver_data<mystwarr_state>();
560   memory_set_bankptr(machine, "bank2", machine.region("soundcpu")->base() + 0x10000 + state->m_cur_sound_region*0x4000);
560   state->membank("bank2")->set_base(state->memregion("soundcpu")->base() + 0x10000 + state->m_cur_sound_region*0x4000);
561561}
562562
563563WRITE8_MEMBER(mystwarr_state::sound_bankswitch_w)
src/mame/drivers/jollyjgr.c
r14976r14977
402402
403403static PALETTE_INIT( jollyjgr )
404404{
405   const UINT8 *color_prom = machine.region("proms")->base();
405   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
406406   int i;
407407
408408   /* tilemap / sprites palette */
src/mame/drivers/ssfindo.c
r14976r14977
485485
486486READ32_MEMBER(ssfindo_state::io_r)
487487{
488   UINT16 *FLASH = (UINT16 *)machine().region("user2")->base(); //16 bit - WORD access
488   UINT16 *FLASH = (UINT16 *)machine().root_device().memregion("user2")->base(); //16 bit - WORD access
489489
490490   int adr=m_flashAdr*0x200+(m_flashOffset);
491491
src/mame/drivers/segas24.c
r14976r14977
433433            break;
434434         case 0x9:
435435            logerror("Read multiple [%02x] %d..%d side %d track %d\n", data, fdc_sector, fdc_sector+fdc_data-1, data & 8 ? 1 : 0, fdc_phys_track);
436            fdc_pt = machine().region("floppy")->base() + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0));
436            fdc_pt = memregion("floppy")->base() + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0));
437437            fdc_span = track_size;
438438            fdc_status = 3;
439439            fdc_drq = 1;
r14976r14977
441441            break;
442442         case 0xb:
443443            logerror("Write multiple [%02x] %d..%d side %d track %d\n", data, fdc_sector, fdc_sector+fdc_data-1, data & 8 ? 1 : 0, fdc_phys_track);
444            fdc_pt = machine().region("floppy")->base() + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0));
444            fdc_pt = memregion("floppy")->base() + track_size*(2*fdc_phys_track+(data & 8 ? 1 : 0));
445445            fdc_span = track_size;
446446            fdc_status = 3;
447447            fdc_drq = 1;
r14976r14977
712712
713713void segas24_state::reset_bank()
714714{
715   if (machine().region("romboard")->base())
715   if (machine().root_device().memregion("romboard")->base())
716716   {
717      memory_set_bank(machine(), "bank1", curbank & 15);
718      memory_set_bank(machine(), "bank2", curbank & 15);
717      membank("bank1")->set_entry(curbank & 15);
718      membank("bank2")->set_entry(curbank & 15);
719719   }
720720}
721721
r14976r14977
12621262{
12631263   segas24_state *state = machine.driver_data<segas24_state>();
12641264   if (state->track_size)
1265      machine.device<nvram_device>("floppy_nvram")->set_base(machine.region("floppy")->base(), 2*state->track_size);
1265      machine.device<nvram_device>("floppy_nvram")->set_base(machine.root_device().memregion("floppy")->base(), 2*state->track_size);
12661266
1267   UINT8 *usr1 = machine.region("romboard")->base();
1267   UINT8 *usr1 = state->memregion("romboard")->base();
12681268   if (usr1)
12691269   {
1270      memory_configure_bank(machine, "bank1", 0, 16, usr1, 0x40000);
1271      memory_configure_bank(machine, "bank2", 0, 16, usr1, 0x40000);
1270      state->membank("bank1")->configure_entries(0, 16, usr1, 0x40000);
1271      state->membank("bank2")->configure_entries(0, 16, usr1, 0x40000);
12721272   }
12731273
12741274   state->vtile = machine.device<segas24_tile>("tile");
src/mame/drivers/peplus.c
r14976r14977
285285static void peplus_load_superdata(running_machine &machine, const char *bank_name)
286286{
287287   peplus_state *state = machine.driver_data<peplus_state>();
288    UINT8 *super_data = machine.region(bank_name)->base();
288    UINT8 *super_data = state->memregion(bank_name)->base();
289289
290290    /* Distribute Superboard Data */
291291    memcpy(state->m_s3000_ram, &super_data[0x3000], 0x1000);
r14976r14977
700700
701701static PALETTE_INIT( peplus )
702702{
703   const UINT8 *color_prom = machine.region("proms")->base();
703   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
704704/*  prom bits
705705    7654 3210
706706    ---- -xxx   red component.
src/mame/drivers/ddayjlc.c
r14976r14977
203203   if (m_bgadr > 2)
204204      m_bgadr = 0;
205205
206   memory_set_bank(machine(), "bank1", m_bgadr);
206   membank("bank1")->set_entry(m_bgadr);
207207}
208208
209209WRITE8_MEMBER(ddayjlc_state::sound_w)
r14976r14977
486486
487487static PALETTE_INIT( ddayjlc )
488488{
489   const UINT8 *color_prom = machine.region("proms")->base();
489   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
490490   int i,r,g,b,val;
491491   int bit0,bit1,bit2;
492492
r14976r14977
675675      UINT8 *src, *dst, *temp;
676676      temp = auto_alloc_array(machine, UINT8, 0x10000);
677677      src = temp;
678      dst = machine.region("gfx1")->base();
679      length = machine.region("gfx1")->bytes();
678      dst = machine.root_device().memregion("gfx1")->base();
679      length = machine.root_device().memregion("gfx1")->bytes();
680680      memcpy(src, dst, length);
681681      newadr = 0;
682682      oldaddr = 0;
r14976r14977
690690      auto_free(machine, temp);
691691   }
692692
693   memory_configure_bank(machine, "bank1", 0, 3, machine.region("user1")->base(), 0x4000);
694   memory_set_bank(machine, "bank1", 0);
693   machine.root_device().membank("bank1")->configure_entries(0, 3, machine.root_device().memregion("user1")->base(), 0x4000);
694   machine.root_device().membank("bank1")->set_entry(0);
695695}
696696
697697GAME( 1984, ddayjlc,  0,       ddayjlc, ddayjlc, ddayjlc, ROT90, "Jaleco", "D-Day (Jaleco set 1)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
src/mame/drivers/sprcros2.c
r14976r14977
6464
6565WRITE8_MEMBER(sprcros2_state::sprcros2_m_port7_w)
6666{
67   UINT8 *RAM = machine().region("master")->base();
67   UINT8 *RAM = memregion("master")->base();
6868
6969   //76543210
7070   //x------- unused
r14976r14977
7676   //-------x nmi enable
7777
7878   if((m_port7^data)&0x40)
79      memory_set_bankptr(machine(), "bank1",&RAM[0x10000+((data&0x40)<<7)]);
79      membank("bank1")->set_base(&RAM[0x10000+((data&0x40)<<7)]);
8080
8181   machine().tilemap().set_flip_all(data&0x02?(TILEMAP_FLIPX|TILEMAP_FLIPY):0 );
8282
r14976r14977
8585
8686WRITE8_MEMBER(sprcros2_state::sprcros2_s_port3_w)
8787{
88   UINT8 *RAM = machine().region("slave")->base();
88   UINT8 *RAM = memregion("slave")->base();
8989
9090   //76543210
9191   //xxxx---- unused
r14976r14977
9494   //-------x nmi enable
9595
9696   if((m_s_port3^data)&0x08)
97      memory_set_bankptr(machine(), "bank2",&RAM[0x10000+((data&0x08)<<10)]);
97      membank("bank2")->set_base(&RAM[0x10000+((data&0x08)<<10)]);
9898
9999   m_s_port3 = data;
100100}
src/mame/drivers/konamigx.c
r14976r14977
923923
924924READ32_MEMBER(konamigx_state::type1_roz_r1)
925925{
926   UINT32 *ROM = (UINT32 *)machine().region("gfx3")->base();
926   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("gfx3")->base();
927927
928928   return ROM[offset];
929929}
930930
931931READ32_MEMBER(konamigx_state::type1_roz_r2)
932932{
933   UINT32 *ROM = (UINT32 *)machine().region("gfx3")->base();
933   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("gfx3")->base();
934934
935935   ROM += (0x600000/2);
936936
r14976r14977
37543754
37553755            case 2:   // tkmmpzdm hack
37563756   {
3757      UINT32 *rom = (UINT32*)machine.region("maincpu")->base();
3757      UINT32 *rom = (UINT32*)state->memregion("maincpu")->base();
37583758
37593759      // The display is initialized after POST but the copyright screen disabled
37603760      // planes B,C,D and didn't bother restoring them. I've spent a good
src/mame/drivers/dorachan.c
r14976r14977
8888
8989   get_pens(pens);
9090
91   color_map_base = screen.machine().region("proms")->base();
91   color_map_base = state->memregion("proms")->base();
9292
9393   for (offs = 0; offs < state->m_videoram.bytes(); offs++)
9494   {
src/mame/drivers/parodius.c
r14976r14977
248248static MACHINE_START( parodius )
249249{
250250   parodius_state *state = machine.driver_data<parodius_state>();
251   UINT8 *ROM = machine.region("maincpu")->base();
251   UINT8 *ROM = state->memregion("maincpu")->base();
252252
253   memory_configure_bank(machine, "bank1", 0, 14, &ROM[0x10000], 0x4000);
254   memory_configure_bank(machine, "bank1", 14, 2, &ROM[0x08000], 0x4000);
255   memory_set_bank(machine, "bank1", 0);
253   state->membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
254   state->membank("bank1")->configure_entries(14, 2, &ROM[0x08000], 0x4000);
255   state->membank("bank1")->set_entry(0);
256256
257257   state->m_generic_paletteram_8.allocate(0x1000);
258258
r14976r14977
407407   if (lines & 0xf0)
408408      logerror("%04x: setlines %02x\n", cpu_get_pc(device), lines);
409409
410   memory_set_bank(device->machine(),  "bank1", (lines & 0x0f) ^ 0x0f);
410   device->machine().root_device().membank("bank1")->set_entry((lines & 0x0f) ^ 0x0f);
411411}
412412
413413GAME( 1990, parodius,  0,        parodius, parodius, 0, ROT0, "Konami", "Parodius DA! (World, set 1)", GAME_SUPPORTS_SAVE )
src/mame/drivers/combatsc.c
r14976r14977
199199   }
200200
201201   if (data & 0x10)
202      memory_set_bank(machine(), "bank1", (data & 0x0e) >> 1);
202      membank("bank1")->set_entry((data & 0x0e) >> 1);
203203   else
204      memory_set_bank(machine(), "bank1", 8 + (data & 1));
204      membank("bank1")->set_entry(8 + (data & 1));
205205}
206206
207207WRITE8_MEMBER(combatsc_state::combatscb_io_w)
r14976r14977
237237      m_bank_select = data;
238238
239239      if (data & 0x10)
240         memory_set_bank(machine(), "bank1", (data & 0x0e) >> 1);
240         membank("bank1")->set_entry((data & 0x0e) >> 1);
241241      else
242         memory_set_bank(machine(), "bank1", 8 + (data & 1));
242         membank("bank1")->set_entry(8 + (data & 1));
243243
244244      if (data == 0x1f)
245245      {
246         memory_set_bank(machine(), "bank1", 8 + (data & 1));
246         membank("bank1")->set_entry(8 + (data & 1));
247247         space.install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(combatsc_state::combatscb_io_w),this));
248248         space.install_read_handler(0x4400, 0x4403, read8_delegate(FUNC(combatsc_state::combatscb_io_r),this));/* IO RAM & Video Registers */
249249      }
r14976r14977
690690static MACHINE_START( combatsc )
691691{
692692   combatsc_state *state = machine.driver_data<combatsc_state>();
693   UINT8 *MEM = machine.region("maincpu")->base() + 0x38000;
693   UINT8 *MEM = machine.root_device().memregion("maincpu")->base() + 0x38000;
694694
695695   state->m_io_ram  = MEM + 0x0000;
696696   state->m_page[0] = MEM + 0x4000;
r14976r14977
702702   state->m_k007121_1 = machine.device("k007121_1");
703703   state->m_k007121_2 = machine.device("k007121_2");
704704
705   memory_configure_bank(machine, "bank1", 0, 10, machine.region("maincpu")->base() + 0x10000, 0x4000);
705   state->membank("bank1")->configure_entries(0, 10, state->memregion("maincpu")->base() + 0x10000, 0x4000);
706706
707707   state->save_item(NAME(state->m_priority));
708708   state->save_item(NAME(state->m_vreg));
src/mame/drivers/rockrage.c
r14976r14977
6767WRITE8_MEMBER(rockrage_state::rockrage_bankswitch_w)
6868{
6969   /* bits 4-6 = bank number */
70   memory_set_bank(machine(), "bank1", (data & 0x70) >> 4);
70   membank("bank1")->set_entry((data & 0x70) >> 4);
7171
7272   /* bits 0 & 1 = coin counters */
7373   coin_counter_w(machine(), 0,data & 0x01);
r14976r14977
237237static MACHINE_START( rockrage )
238238{
239239   rockrage_state *state = machine.driver_data<rockrage_state>();
240   UINT8 *ROM = machine.region("maincpu")->base();
240   UINT8 *ROM = state->memregion("maincpu")->base();
241241
242   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x2000);
242   state->membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x2000);
243243
244244   state->m_audiocpu = machine.device("audiocpu");
245245   state->m_k007342 = machine.device("k007342");
src/mame/drivers/quizpun2.c
r14976r14977
249249
250250      case STATE_EEPROM_R:      // EEPROM read
251251      {
252         UINT8 *eeprom = machine().region("eeprom")->base();
252         UINT8 *eeprom = memregion("eeprom")->base();
253253         ret = eeprom[prot.addr];
254254         break;
255255      }
r14976r14977
276276   {
277277      case STATE_EEPROM_W:
278278      {
279         UINT8 *eeprom = machine().region("eeprom")->base();
279         UINT8 *eeprom = memregion("eeprom")->base();
280280         eeprom[prot.addr] = data;
281281         prot.addr++;
282282         if ((prot.addr % 8) == 0)
r14976r14977
343343
344344WRITE8_MEMBER(quizpun2_state::quizpun2_rombank_w)
345345{
346   UINT8 *ROM = machine().region("maincpu")->base();
347   memory_set_bankptr(machine(),  "bank1", &ROM[ 0x10000 + 0x2000 * (data & 0x1f) ] );
346   UINT8 *ROM = memregion("maincpu")->base();
347   membank("bank1")->set_base(&ROM[ 0x10000 + 0x2000 * (data & 0x1f) ] );
348348}
349349
350350WRITE8_MEMBER(quizpun2_state::quizpun2_irq_ack)
src/mame/drivers/segac2.c
r14976r14977
118118
119119   /* determine how many sound banks */
120120   state->m_sound_banks = 0;
121   if (machine.region("upd")->base())
122      state->m_sound_banks = machine.region("upd")->bytes() / 0x20000;
121   if (machine.root_device().memregion("upd")->base())
122      state->m_sound_banks = state->memregion("upd")->bytes() / 0x20000;
123123
124124   /* reset the protection */
125125   state->m_prot_write_buf = 0;
r14976r14977
20882088static DRIVER_INIT( ichirjbl )
20892089{
20902090   /* when did this actually work? - the protection is patched but the new check fails? */
2091   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
2091   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
20922092   rom[0x390/2] = 0x6600;
20932093
20942094   segac2_common_init(machine, NULL);
src/mame/drivers/splus.c
r14976r14977
578578{
579579   splus_state *state = machine.driver_data<splus_state>();
580580
581   UINT8 *reel_data = machine.region( "reeldata" )->base();
581   UINT8 *reel_data = state->memregion( "reeldata" )->base();
582582
583583    // Load Reel Data
584584    memcpy(state->m_reel_ram, &reel_data[0x0000], 0x2000);
src/mame/drivers/gberet.c
r14976r14977
122122   coin_counter_w(machine(), 1, data & 2);
123123
124124   /* bits 5-7 = ROM bank select */
125   memory_set_bank(machine(), "bank1", ((data & 0xe0) >> 5));
125   membank("bank1")->set_entry(((data & 0xe0) >> 5));
126126}
127127
128128WRITE8_MEMBER(gberet_state::gberet_flipscreen_w)
r14976r14977
573573
574574static DRIVER_INIT( mrgoemon )
575575{
576   UINT8 *ROM = machine.region("maincpu")->base();
577   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x800);
576   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
577   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x800);
578578}
579579
580580
src/mame/drivers/sandscrp.c
r14976r14977
269269
270270WRITE8_MEMBER(sandscrp_state::sandscrp_bankswitch_w)
271271{
272   UINT8 *RAM = machine().region("maincpu")->base();
272   UINT8 *RAM = memregion("maincpu")->base();
273273   int bank = data & 0x07;
274274
275275   if ( bank != data )   logerror("CPU #1 - PC %04X: Bank %02X\n",cpu_get_pc(&space.device()),data);
r14976r14977
277277   if (bank < 3)   RAM = &RAM[0x4000 * bank];
278278   else         RAM = &RAM[0x4000 * (bank-3) + 0x10000];
279279
280   memory_set_bankptr(machine(), "bank1", RAM);
280   membank("bank1")->set_base(RAM);
281281}
282282
283283READ8_MEMBER(sandscrp_state::sandscrp_latchstatus_r)
src/mame/drivers/gpworld.c
r14976r14977
125125
126126   int i;
127127
128   UINT8 *GFX = machine.region("gfx2")->base();
128   UINT8 *GFX = state->memregion("gfx2")->base();
129129
130130   /* Heisted from Daphne which heisted it from MAME */
131131   for (i = 0; i < 0x800; i += 8)
src/mame/drivers/exidy.c
r14976r14977
185185
186186WRITE8_MEMBER(exidy_state::fax_bank_select_w)
187187{
188   UINT8 *RAM = machine().region("maincpu")->base();
188   UINT8 *RAM = memregion("maincpu")->base();
189189
190   memory_set_bankptr(machine(), "bank1", &RAM[0x10000 + (0x2000 * (data & 0x1f))]);
190   membank("bank1")->set_base(&RAM[0x10000 + (0x2000 * (data & 0x1f))]);
191191   if ((data & 0x1f) > 0x17)
192192      logerror("Banking to unpopulated ROM bank %02X!\n",data & 0x1f);
193193}
r14976r14977
14701470
14711471   /* the ROM is actually mapped high */
14721472   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xf800, 0xffff, "bank1");
1473   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0xf800);
1473   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0xf800);
14741474}
14751475
14761476
src/mame/drivers/homedata.c
r14976r14977
291291   if (m_sndbank & 4)
292292      return(soundlatch_byte_r(space, 0));
293293   else
294      return machine().region("audiocpu")->base()[0x10000 + offset + (m_sndbank & 1) * 0x10000];
294      return memregion("audiocpu")->base()[0x10000 + offset + (m_sndbank & 1) * 0x10000];
295295}
296296
297297WRITE8_MEMBER(homedata_state::mrokumei_sound_bank_w)
r14976r14977
355355      */
356356//  logerror("%04x: port C wr %02x (STATUS %d DATA %d)\n", cpu_get_pc(&space.device()), data, BIT(data, 2), BIT(data, 6));
357357
358   memory_set_bank(machine(), "bank2", data & 0x03);
358   membank("bank2")->set_entry(data & 0x03);
359359
360360   coin_counter_w(machine(), 0, ~data & 0x80);
361361
r14976r14977
494494
495495   //  logerror("%04x: port C wr %02x\n", cpu_get_pc(&space.device()), data);
496496
497   memory_set_bank(machine(), "bank2", (data & 0x0c) >> 2);
497   membank("bank2")->set_entry((data & 0x0c) >> 2);
498498
499499   coin_counter_w(machine(), 0, ~data & 0x80);
500500
r14976r14977
509509
510510WRITE8_MEMBER(homedata_state::bankswitch_w)
511511{
512   int last_bank = (machine().region("maincpu")->bytes() - 0x10000) / 0x4000;
512   int last_bank = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x4000;
513513
514514   /* last bank is fixed and is #0 for us, other banks start from #1 (hence data+1 below)*/
515515   if (data < last_bank)
516      memory_set_bank(machine(), "bank1", data + 1);
516      membank("bank1")->set_entry(data + 1);
517517   else
518      memory_set_bank(machine(), "bank1", 0);
518      membank("bank1")->set_entry(0);
519519}
520520
521521
r14976r14977
11491149static MACHINE_START( reikaids )
11501150{
11511151   homedata_state *state = machine.driver_data<homedata_state>();
1152   UINT8 *ROM = machine.region("maincpu")->base();
1152   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
11531153
1154   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0xc000], 0x4000);
1155   memory_configure_bank(machine, "bank2", 0, 4, machine.region("audiocpu")->base(), 0x10000);
1154   state->membank("bank1")->configure_entries(0, 8, &ROM[0xc000], 0x4000);
1155   state->membank("bank2")->configure_entries(0, 4, state->memregion("audiocpu")->base(), 0x10000);
11561156
11571157   MACHINE_START_CALL(homedata);
11581158
r14976r14977
11661166static MACHINE_START( pteacher )
11671167{
11681168   homedata_state *state = machine.driver_data<homedata_state>();
1169   UINT8 *ROM = machine.region("maincpu")->base();
1169   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
11701170
1171   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0xc000], 0x4000);
1172   memory_configure_bank(machine, "bank2", 0, 4, machine.region("audiocpu")->base(), 0x10000);
1171   state->membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
1172   state->membank("bank2")->configure_entries(0, 4, state->memregion("audiocpu")->base(), 0x10000);
11731173
11741174   MACHINE_START_CALL(homedata);
11751175
src/mame/drivers/pcktgal.c
r14976r14977
2424
2525WRITE8_MEMBER(pcktgal_state::pcktgal_bank_w)
2626{
27   UINT8 *RAM = machine().region("maincpu")->base();
27   UINT8 *RAM = memregion("maincpu")->base();
2828
29   if (data & 1) { memory_set_bankptr(machine(), "bank1", &RAM[0x4000]); }
30   else { memory_set_bankptr(machine(), "bank1", &RAM[0x10000]); }
29   if (data & 1) { membank("bank1")->set_base(&RAM[0x4000]); }
30   else { membank("bank1")->set_base(&RAM[0x10000]); }
3131
32   if (data & 2) { memory_set_bankptr(machine(), "bank2", &RAM[0x6000]); }
33   else { memory_set_bankptr(machine(), "bank2", &RAM[0x12000]); }
32   if (data & 2) { membank("bank2")->set_base(&RAM[0x6000]); }
33   else { membank("bank2")->set_base(&RAM[0x12000]); }
3434}
3535
3636WRITE8_MEMBER(pcktgal_state::pcktgal_sound_bank_w)
3737{
38   memory_set_bank(machine(), "bank3", (data >> 2) & 1);
38   membank("bank3")->set_entry((data >> 2) & 1);
3939}
4040
4141WRITE8_MEMBER(pcktgal_state::pcktgal_sound_w)
r14976r14977
413413   int A;
414414   address_space *space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
415415   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000);
416   UINT8 *rom = machine.region("audiocpu")->base();
416   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
417417
418418   space->set_decrypted_region(0x8000, 0xffff, decrypted);
419419
r14976r14977
421421   for (A = 0x8000;A < 0x18000;A++)
422422      decrypted[A-0x8000] = (rom[A] & 0x9f) | ((rom[A] & 0x20) << 1) | ((rom[A] & 0x40) >> 1);
423423
424   memory_configure_bank(machine, "bank3", 0, 2, machine.region("audiocpu")->base() + 0x10000, 0x4000);
425   memory_configure_bank_decrypted(machine, "bank3", 0, 2, &decrypted[0x8000], 0x4000);
424   machine.root_device().membank("bank3")->configure_entries(0, 2, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
425   machine.root_device().membank("bank3")->configure_decrypted_entries(0, 2, &decrypted[0x8000], 0x4000);
426426}
427427
428428static DRIVER_INIT( graphics )
429429{
430   UINT8 *rom = machine.region("gfx1")->base();
431   int len = machine.region("gfx1")->bytes();
430   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
431   int len = machine.root_device().memregion("gfx1")->bytes();
432432   int i,j,temp[16];
433433
434   memory_configure_bank(machine, "bank3", 0, 2, machine.region("audiocpu")->base() + 0x10000, 0x4000);
434   machine.root_device().membank("bank3")->configure_entries(0, 2, machine.root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
435435
436436   /* Tile graphics roms have some swapped lines, original version only */
437437   for (i = 0x00000;i < len;i += 32)
src/mame/drivers/jokrwild.c
r14976r14977
553553*****************************************************************************/
554554{
555555   int i, offs;
556   UINT8 *srcp = machine.region( "maincpu" )->base();
556   UINT8 *srcp = machine.root_device().memregion( "maincpu" )->base();
557557
558558   for (i = 0x8000; i < 0x10000; i++)
559559   {
src/mame/drivers/hng64.c
r14976r14977
15231523
15241524static DRIVER_INIT( hng64_reorder_gfx )
15251525{
1526   hng64_reorder(machine, machine.region("scrtile")->base(), machine.region("scrtile")->bytes());
1526   hng64_reorder(machine, machine.root_device().memregion("scrtile")->base(), machine.root_device().memregion("scrtile")->bytes());
15271527}
15281528
15291529#define HACK_REGION
15301530#ifdef HACK_REGION
15311531static void hng64_patch_bios_region(running_machine& machine, int region)
15321532{
1533   UINT8 *rom = machine.region("user1")->base();
1533   UINT8 *rom = machine.root_device().memregion("user1")->base();
15341534
15351535   if ((rom[0x4000]==0xff) && (rom[0x4001] == 0xff))
15361536   {
r14976r14977
15761576{
15771577   hng64_state *state = machine.driver_data<hng64_state>();
15781578
1579   /* FILE* fp = fopen("/tmp/test.bin", "wb"); fwrite(machine.region("verts")->base(), 1, 0x0c00000*2, fp); fclose(fp); */
1579   /* FILE* fp = fopen("/tmp/test.bin", "wb"); fwrite(state->memregion("verts")->base(), 1, 0x0c00000*2, fp); fclose(fp); */
15801580   DRIVER_INIT_CALL(hng64_fght);
15811581   state->m_mcu_type = FIGHT_MCU;
15821582}
r14976r14977
16611661{
16621662   hng64_state *state = machine.driver_data<hng64_state>();
16631663   int i;
1664   const UINT8 *rom = machine.region("user2")->base();
1664   const UINT8 *rom = state->memregion("user2")->base();
16651665
16661666   /* Sound CPU */
16671667   UINT8 *RAM = (UINT8*)state->m_soundram;
1668   memory_set_bankptr(machine, "bank1",&RAM[0x1e0000]);
1669   memory_set_bankptr(machine, "bank2",&RAM[0x001000]); // where..
1668   state->membank("bank1")->set_base(&RAM[0x1e0000]);
1669   state->membank("bank2")->set_base(&RAM[0x001000]); // where..
16701670   cputag_set_input_line(machine, "audiocpu", INPUT_LINE_HALT, ASSERT_LINE);
16711671   cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
16721672
src/mame/drivers/gladiatr.c
r14976r14977
194194/*Rom bankswitching*/
195195WRITE8_MEMBER(gladiatr_state::gladiatr_bankswitch_w)
196196{
197   UINT8 *rom = machine().region("maincpu")->base() + 0x10000;
197   UINT8 *rom = memregion("maincpu")->base() + 0x10000;
198198
199   memory_set_bankptr(machine(), "bank1", rom + 0x6000 * (data & 0x01));
199   membank("bank1")->set_base(rom + 0x6000 * (data & 0x01));
200200}
201201
202202
r14976r14977
256256   TAITO8741_start(&gladiator_8741interface);
257257   /* 6809 bank memory set */
258258   {
259      UINT8 *rom = machine.region("audiocpu")->base() + 0x10000;
260      memory_set_bankptr(machine, "bank2",rom);
259      UINT8 *rom = machine.root_device().memregion("audiocpu")->base() + 0x10000;
260      machine.root_device().membank("bank2")->set_base(rom);
261261      machine.device("audiocpu")->reset();
262262   }
263263}
r14976r14977
279279/*Sound Functions*/
280280static WRITE8_DEVICE_HANDLER( glad_adpcm_w )
281281{
282   UINT8 *rom = device->machine().region("audiocpu")->base() + 0x10000;
282   UINT8 *rom = device->machine().root_device().memregion("audiocpu")->base() + 0x10000;
283283
284284   /* bit6 = bank offset */
285   memory_set_bankptr(device->machine(), "bank2",rom + ((data & 0x40) ? 0xc000 : 0));
285   device->machine().root_device().membank("bank2")->set_base(rom + ((data & 0x40) ? 0xc000 : 0));
286286
287287   msm5205_data_w(device,data);         /* bit0..3  */
288288   msm5205_reset_w(device,(data>>5)&1); /* bit 5    */
r14976r14977
956956   UINT8 *rom;
957957   int i,j;
958958
959   rom = machine.region("gfx2")->base();
959   rom = machine.root_device().memregion("gfx2")->base();
960960   // unpack 3bpp graphics
961961   for (j = 3; j >= 0; j--)
962962   {
r14976r14977
970970   swap_block(rom + 0x14000, rom + 0x18000, 0x4000);
971971
972972
973   rom = machine.region("gfx3")->base();
973   rom = machine.root_device().memregion("gfx3")->base();
974974   // unpack 3bpp graphics
975975   for (j = 5; j >= 0; j--)
976976   {
r14976r14977
987987   swap_block(rom + 0x24000, rom + 0x28000, 0x4000);
988988
989989   /* make sure bank is valid in cpu-reset */
990   rom = machine.region("audiocpu")->base() + 0x10000;
991   memory_set_bankptr(machine, "bank2",rom);
990   rom = machine.root_device().memregion("audiocpu")->base() + 0x10000;
991   machine.root_device().membank("bank2")->set_base(rom);
992992}
993993
994994
r14976r14977
10051005   UINT8 *rom;
10061006   int i,j;
10071007
1008   rom = machine.region("gfx2")->base();
1008   rom = machine.root_device().memregion("gfx2")->base();
10091009   // unpack 3bpp graphics
10101010   for (i = 0; i < 0x2000; i++)
10111011   {
10121012      rom[i+0x2000] = rom[i] >> 4;
10131013   }
10141014
1015   rom = machine.region("gfx3")->base();
1015   rom = machine.root_device().memregion("gfx3")->base();
10161016   // unpack 3bpp graphics
10171017   for (j = 1; j >= 0; j--)
10181018   {
src/mame/drivers/puckpkmn.c
r14976r14977
260260
261261static DRIVER_INIT( puckpkmn )
262262{
263   UINT8 *rom = machine.region("maincpu")->base();
264   size_t len = machine.region("maincpu")->bytes();
263   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
264   size_t len = machine.root_device().memregion("maincpu")->bytes();
265265   int i;
266266
267267   for (i = 0; i < len; i++)
src/mame/drivers/poker72.c
r14976r14977
7777
7878WRITE8_MEMBER(poker72_state::output_w)
7979{
80   UINT8 *ROM = machine().region("maincpu")->base();
80   UINT8 *ROM = memregion("maincpu")->base();
8181
8282   printf("%02x\n",data);
8383
8484/*  if((data & 0xc) == 0xc)
85        memory_set_bankptr(machine(), "bank1", &ROM[0x10000]);
85        membank("bank1")->set_base(&ROM[0x10000]);
8686    else*/
8787   if(data & 8)
88      memory_set_bankptr(machine(), "bank1", &ROM[0x08000]);
88      membank("bank1")->set_base(&ROM[0x08000]);
8989   else
90      memory_set_bankptr(machine(), "bank1", &ROM[0x00000]);
90      membank("bank1")->set_base(&ROM[0x00000]);
9191}
9292
9393WRITE8_MEMBER(poker72_state::tile_bank_w)
r14976r14977
339339
340340static MACHINE_RESET( poker72 )
341341{
342   UINT8 *ROM = machine.region("maincpu")->base();
342   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
343343
344   memory_set_bankptr(machine, "bank1", &ROM[0]);
344   machine.root_device().membank("bank1")->set_base(&ROM[0]);
345345}
346346
347347static MACHINE_CONFIG_START( poker72, poker72_state )
r14976r14977
393393
394394static DRIVER_INIT( poker72 )
395395{
396   UINT8 *rom = machine.region("maincpu")->base();
396   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
397397
398398   rom[0x4a9] = 0x28;
399399}
src/mame/drivers/goindol.c
r14976r14977
2626WRITE8_MEMBER(goindol_state::goindol_bankswitch_w)
2727{
2828
29   memory_set_bank(machine(), "bank1", data & 0x03);
29   membank("bank1")->set_entry(data & 0x03);
3030
3131   if (m_char_bank != ((data & 0x10) >> 4))
3232   {
r14976r14977
220220static MACHINE_START( goindol )
221221{
222222   goindol_state *state = machine.driver_data<goindol_state>();
223   UINT8 *ROM = machine.region("maincpu")->base();
223   UINT8 *ROM = state->memregion("maincpu")->base();
224224
225   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
225   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
226226
227227   state->save_item(NAME(state->m_char_bank));
228228   state->save_item(NAME(state->m_prot_toggle));
r14976r14977
383383
384384static DRIVER_INIT( goindol )
385385{
386   UINT8 *rom = machine.region("maincpu")->base();
386   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
387387
388388
389389   /* I hope that's all patches to avoid protection */
src/mame/drivers/umipoker.c
r14976r14977
149149
150150READ8_MEMBER(umipoker_state::z80_rom_readback_r)
151151{
152   UINT8 *ROM = machine().region("audiocpu")->base();
152   UINT8 *ROM = memregion("audiocpu")->base();
153153
154154   return ROM[offset];
155155}
src/mame/drivers/fastlane.c
r14976r14977
4545   coin_counter_w(machine(), 1,data & 0x02);
4646
4747   /* bits 2 & 3 = bank number */
48   memory_set_bank(machine(), "bank1", (data & 0x0c) >> 2);
48   membank("bank1")->set_entry((data & 0x0c) >> 2);
4949
5050   /* bit 4: bank # for the 007232 (chip 2) */
5151   k007232_set_bank(m_konami2, 0 + ((data & 0x10) >> 4), 2 + ((data & 0x10) >> 4));
r14976r14977
194194static MACHINE_START( fastlane )
195195{
196196   fastlane_state *state = machine.driver_data<fastlane_state>();
197   UINT8 *ROM = machine.region("maincpu")->base();
197   UINT8 *ROM = state->memregion("maincpu")->base();
198198
199   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
199   state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
200200
201201   state->m_konami2 = machine.device("konami2");
202202   state->m_k007121 = machine.device("k007121");
src/mame/drivers/gamecstl.c
r14976r14977
216216      {
217217         if (data & 0x10)      // enable RAM access to region 0xf0000 - 0xfffff
218218         {
219            memory_set_bankptr(busdevice->machine(), "bank1", state->m_bios_ram);
219            state->membank("bank1")->set_base(state->m_bios_ram);
220220         }
221221         else               // disable RAM access (reads go to BIOS ROM)
222222         {
223            memory_set_bankptr(busdevice->machine(), "bank1", busdevice->machine().region("bios")->base() + 0x30000);
223            state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x30000);
224224         }
225225         break;
226226      }
r14976r14977
614614
615615static MACHINE_RESET(gamecstl)
616616{
617   memory_set_bankptr(machine, "bank1", machine.region("bios")->base() + 0x30000);
617   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("bios")->base() + 0x30000);
618618
619619   device_set_irq_callback(machine.device("maincpu"), irq_callback);
620620}
src/mame/drivers/kangaroo.c
r14976r14977
174174
175175static MACHINE_START( kangaroo )
176176{
177   memory_configure_bank(machine, "bank1", 0, 2, machine.region("gfx1")->base(), 0x2000);
177   machine.root_device().membank("bank1")->configure_entries(0, 2, machine.root_device().memregion("gfx1")->base(), 0x2000);
178178}
179179
180180
src/mame/drivers/cabal.c
r14976r14977
844844{
845845   address_space *space = machine.device(cpu)->memory().space(AS_PROGRAM);
846846   UINT8 *decrypt = auto_alloc_array(machine, UINT8, length);
847   UINT8 *rom = machine.region(cpu)->base();
847   UINT8 *rom = machine.root_device().memregion(cpu)->base();
848848
849849   space->set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt);
850850
851851   memcpy(decrypt, rom+length, length);
852852
853853   if (length > 0x10000)
854      memory_configure_bank_decrypted(machine, "bank1", 0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
854      machine.root_device().membank("bank1")->configure_decrypted_entries(0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
855855}
856856
857857
src/mame/drivers/cidelsa.c
r14976r14977
4545
4646   int bank = BIT(data, 3);
4747
48   memory_set_bank(machine(), "bank1", bank);
48   membank("bank1")->set_entry(bank);
4949}
5050
5151WRITE8_MEMBER( draco_state::sound_g_w )
r14976r14977
441441void draco_state::machine_start()
442442{
443443   /* setup COP402 memory banking */
444   memory_configure_bank(machine(), "bank1", 0, 2, machine().region(COP402N_TAG)->base(), 0x400);
445   memory_set_bank(machine(), "bank1", 0);
444   membank("bank1")->configure_entries(0, 2, memregion(COP402N_TAG)->base(), 0x400);
445   membank("bank1")->set_entry(0);
446446
447447   /* register for state saving */
448448   save_item(NAME(m_reset));
src/mame/drivers/vendetta.c
r14976r14977
171171      space->install_read_bank(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, "bank4" );
172172      space->install_write_handler(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, write8_delegate(FUNC(vendetta_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state) );
173173      space->install_legacy_readwrite_handler(*state->m_k053246, state->m_video_banking_base + 0x0000, state->m_video_banking_base + 0x0fff, FUNC(k053247_r), FUNC(k053247_w) );
174      memory_set_bankptr(machine, "bank4", state->m_generic_paletteram_8);
174      state->membank("bank4")->set_base(state->m_generic_paletteram_8);
175175   }
176176   else
177177   {
r14976r14977
459459static MACHINE_START( vendetta )
460460{
461461   vendetta_state *state = machine.driver_data<vendetta_state>();
462   UINT8 *ROM = machine.region("maincpu")->base();
462   UINT8 *ROM = state->memregion("maincpu")->base();
463463
464   memory_configure_bank(machine, "bank1", 0, 28, &ROM[0x10000], 0x2000);
465   memory_set_bank(machine, "bank1", 0);
464   state->membank("bank1")->configure_entries(0, 28, &ROM[0x10000], 0x2000);
465   state->membank("bank1")->set_entry(0);
466466
467467   state->m_generic_paletteram_8.allocate(0x1000);
468468
r14976r14977
786786   if (lines >= 0x1c)
787787      logerror("PC = %04x : Unknown bank selected %02x\n", cpu_get_pc(device), lines);
788788   else
789      memory_set_bank(device->machine(), "bank1", lines);
789      device->machine().root_device().membank("bank1")->set_entry(lines);
790790}
791791
792792static DRIVER_INIT( vendetta )
src/mame/drivers/segas16b.c
r14976r14977
13191319static WRITE8_DEVICE_HANDLER( upd7759_control_w )
13201320{
13211321   segas1x_state *state = device->machine().driver_data<segas1x_state>();
1322   int size = device->machine().region("soundcpu")->bytes() - 0x10000;
1322   int size = state->memregion("soundcpu")->bytes() - 0x10000;
13231323   if (size > 0)
13241324   {
13251325      int bankoffs = 0;
r14976r14977
13761376            bankoffs += (data & 0x07) * 0x04000;
13771377            break;
13781378      }
1379      memory_set_bankptr(device->machine(), "bank1", device->machine().region("soundcpu")->base() + 0x10000 + (bankoffs % size));
1379      state->membank("bank1")->set_base(device->machine().root_device().memregion("soundcpu")->base() + 0x10000 + (bankoffs % size));
13801380   }
13811381}
13821382
r14976r14977
68226822// when reading from this port the data is xored by a fixed value depending on the cart
68236823static READ16_HANDLER( isgsm_cart_data_r )
68246824{
6825   int size = space->machine().region("gamecart_rgn")->bytes();
6826   UINT8* rgn = space->machine().region("gamecart_rgn")->base();
6825   int size = space->machine().root_device().memregion("gamecart_rgn")->bytes();
6826   UINT8* rgn = space->machine().root_device().memregion("gamecart_rgn")->base();
68276827
68286828   isgsm_cart_addr++;
68296829
r14976r14977
68476847
68486848   switch (isgsm_type&0x0f)
68496849   {
6850      case 0x0: dest = space->machine().region("gfx2")->base();
6850      case 0x0: dest = space->machine().root_device().memregion("gfx2")->base();
68516851         break;
68526852
6853      case 0x1: dest = space->machine().region("gfx1")->base();
6853      case 0x1: dest = space->machine().root_device().memregion("gfx1")->base();
68546854         break;
68556855
6856      case 0x2: dest = space->machine().region("soundcpu")->base();
6856      case 0x2: dest = space->machine().root_device().memregion("soundcpu")->base();
68576857         break;
68586858
6859      case 0x3: dest = space->machine().region("maincpu")->base();
6859      case 0x3: dest = space->machine().root_device().memregion("maincpu")->base();
68606860         break;
68616861
68626862      default: // no other cases?
r14976r14977
69676967
69686968         dest[isgsm_addr] = byte;
69696969
6970         if (dest == space->machine().region("gfx1")->base())
6970         if (dest == space->machine().root_device().memregion("gfx1")->base())
69716971         {
69726972
69736973            // we need to re-decode the tiles if writing to this area to keep MAME happy
r14976r14977
70617061   // other values on real hw have strange results, change memory mapping etc??
70627062   if (data==1)
70637063   {
7064      memory_set_bankptr(space->machine(),ISGSM_MAIN_BANK, space->machine().region("maincpu")->base());
7064      space->machine().root_device().membank(ISGSM_MAIN_BANK)->set_base(space->machine().root_device().memregion("maincpu")->base());
70657065   }
70667066}
70677067
70687068static MACHINE_START( isgsm )
70697069{
7070   memory_set_bankptr(machine,ISGSM_CART_BANK, machine.region("gamecart_rgn")->base());
7071   memory_set_bankptr(machine,ISGSM_MAIN_BANK, machine.region("bios")->base());
7070   machine.root_device().membank(ISGSM_CART_BANK)->set_base(machine.root_device().memregion("gamecart_rgn")->base());
7071   machine.root_device().membank(ISGSM_MAIN_BANK)->set_base(machine.root_device().memregion("bios")->base());
70727072}
70737073
70747074static ADDRESS_MAP_START( isgsm_map, AS_PROGRAM, 16, segas1x_state )
r14976r14977
72197219   for (int i = 0; i < 16; i++)
72207220      segaic16_sprites_set_bank(machine, 0, i, i);
72217221
7222   memory_set_bankptr(machine,ISGSM_CART_BANK, machine.region("gamecart_rgn")->base());
7223   memory_set_bankptr(machine,ISGSM_MAIN_BANK, machine.region("bios")->base());
7222   machine.root_device().membank(ISGSM_CART_BANK)->set_base(machine.root_device().memregion("gamecart_rgn")->base());
7223   machine.root_device().membank(ISGSM_MAIN_BANK)->set_base(machine.root_device().memregion("bios")->base());
72247224   devtag_reset( machine, "maincpu" );
72257225}
72267226
r14976r14977
72487248
72497249   // decrypt the bios...
72507250   UINT16* temp = (UINT16*)malloc(0x20000);
7251   UINT16* rom = (UINT16*)machine.region("bios")->base();
7251   UINT16* rom = (UINT16*)machine.root_device().memregion("bios")->base();
72527252   int i;
72537253
72547254   for (i=0;i<0x10000;i++)
r14976r14977
72657265   DRIVER_INIT_CALL( isgsm );
72667266
72677267   UINT16* temp = (UINT16*)malloc(0x200000);
7268   UINT16* rom = (UINT16*)machine.region("gamecart_rgn")->base();
7268   UINT16* rom = (UINT16*)machine.root_device().memregion("gamecart_rgn")->base();
72697269   int i;
72707270
72717271   for (i=0;i<0x100000;i++)
r14976r14977
72857285   DRIVER_INIT_CALL( isgsm );
72867286
72877287   UINT16* temp = (UINT16*)malloc(0x80000);
7288   UINT16* rom = (UINT16*)machine.region("gamecart_rgn")->base();
7288   UINT16* rom = (UINT16*)machine.root_device().memregion("gamecart_rgn")->base();
72897289   int i;
72907290
72917291   for (i=0;i<0x80000/2;i++)
src/mame/drivers/thoop2.c
r14976r14977
5151
5252WRITE16_MEMBER(thoop2_state::OKIM6295_bankswitch_w)
5353{
54   UINT8 *RAM = machine().region("oki")->base();
54   UINT8 *RAM = memregion("oki")->base();
5555
5656   if (ACCESSING_BITS_0_7){
5757      memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000);
src/mame/drivers/saturn.c
r14976r14977
21542154
21552155static DEVICE_IMAGE_LOAD( sat_cart )
21562156{
2157   UINT8 *ROM = image.device().machine().region("maincpu")->base()+0x080000;
2157   UINT8 *ROM = image.device().machine().root_device().memregion("maincpu")->base()+0x080000;
21582158   UINT32 length;
21592159
21602160   if (image.software_entry() != NULL)
r14976r14977
23592359   if (image.software_entry() == NULL)
23602360      return IMAGE_INIT_FAIL;
23612361
2362   UINT8 *ROM = image.device().machine().region(this_cart->region)->base();
2362   UINT8 *ROM = image.device().machine().root_device().memregion(this_cart->region)->base();
23632363   UINT32 length = image.get_software_region_length("rom");
23642364
23652365   memcpy(ROM, image.get_software_region("rom"), length);
src/mame/drivers/nwk-tr.c
r14976r14977
739739{
740740   nwktr_state *state = machine.driver_data<nwktr_state>();
741741   init_konami_cgboard(machine, 1, CGBOARD_TYPE_NWKTR);
742   set_cgboard_texture_bank(machine, 0, "bank5", machine.region("user5")->base());
742   set_cgboard_texture_bank(machine, 0, "bank5", state->memregion("user5")->base());
743743
744744   state->m_sharc_dataram = auto_alloc_array(machine, UINT32, 0x100000/4);
745745   state->m_led_reg0 = state->m_led_reg1 = 0x7f;
src/mame/drivers/taotaido.c
r14976r14977
123123
124124WRITE8_MEMBER(taotaido_state::taotaido_sh_bankswitch_w)
125125{
126   UINT8 *rom = machine().region("audiocpu")->base() + 0x10000;
126   UINT8 *rom = memregion("audiocpu")->base() + 0x10000;
127127
128   memory_set_bankptr(machine(), "bank1",rom + (data & 0x03) * 0x8000);
128   membank("bank1")->set_base(rom + (data & 0x03) * 0x8000);
129129}
130130
131131static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, taotaido_state )
src/mame/drivers/relief.c
r14976r14977
444444
445445static DRIVER_INIT( relief )
446446{
447   UINT8 *sound_base = machine.region("oki")->base();
447   UINT8 *sound_base = machine.root_device().memregion("oki")->base();
448448
449449   /* expand the ADPCM data to avoid lots of memcpy's during gameplay */
450450   /* the upper 128k is fixed, the lower 128k is bankswitched */
src/mame/drivers/taito_f3.c
r14976r14977
121121WRITE32_MEMBER(taito_f3_state::f3_sound_bankswitch_w)
122122{
123123   if (m_f3_game==KIRAMEKI) {
124      UINT16 *rom = (UINT16 *)machine().region("audiocpu")->base();
124      UINT16 *rom = (UINT16 *)machine().root_device().memregion("audiocpu")->base();
125125      UINT32 idx;
126126
127127      idx = (offset << 1) & 0x1e;
r14976r14977
133133
134134      /* Banks are 0x20000 bytes each, divide by two to get data16
135135        pointer rather than byte pointer */
136      memory_set_bankptr(machine(), "bank2", &rom[(idx*0x20000)/2 + 0x80000]);
136      membank("bank2")->set_base(&rom[(idx*0x20000)/2 + 0x80000]);
137137
138138   } else {
139139      logerror("Sound bankswitch in unsupported game\n");
r14976r14977
36663666{
36673667   UINT8 lsb,msb;
36683668   UINT32 offset,i;
3669   UINT8 *gfx = machine.region("gfx2")->base();
3670   int size=machine.region("gfx2")->bytes();
3669   UINT8 *gfx = machine.root_device().memregion("gfx2")->base();
3670   int size=machine.root_device().memregion("gfx2")->bytes();
36713671   int data;
36723672
36733673   /* Setup ROM formats:
r14976r14977
36993699      offset+=4;
37003700   }
37013701
3702   gfx = machine.region("gfx1")->base();
3703   size=machine.region("gfx1")->bytes();
3702   gfx = machine.root_device().memregion("gfx1")->base();
3703   size=machine.root_device().memregion("gfx1")->bytes();
37043704
37053705   offset = size/2;
37063706   for (i = size/2+size/4; i<size; i++)
r14976r14977
37813781static DRIVER_INIT( scfinals )
37823782{
37833783   taito_f3_state *state = machine.driver_data<taito_f3_state>();
3784   UINT32 *RAM = (UINT32 *)machine.region("maincpu")->base();
3784   UINT32 *RAM = (UINT32 *)state->memregion("maincpu")->base();
37853785
37863786   /* Doesn't boot without this - eprom related? */
37873787    RAM[0x5af0/4]=0x4e710000|(RAM[0x5af0/4]&0xffff);
r14976r14977
38683868   //if (mem_mask==0x000000ff) downcast<okim6295_device *>(device)->write(0,data&0xff);
38693869   if (ACCESSING_BITS_16_23)
38703870   {
3871      UINT8 *snd = machine().region("oki")->base();
3871      UINT8 *snd = memregion("oki")->base();
38723872      int bank = (data & 0x000f0000) >> 16;
38733873      // almost certainly wrong
38743874      memcpy(snd+0x30000, snd+0x80000+0x30000+bank*0x10000, 0x10000);
r14976r14977
38893889   /* expand gfx rom */
38903890   {
38913891      int i;
3892      UINT8 *gfx = machine.region("gfx2")->base();
3892      UINT8 *gfx = state->memregion("gfx2")->base();
38933893
38943894      for (i=0x200000;i<0x400000; i+=4)
38953895      {
r14976r14977
39413941static DRIVER_INIT( landmkrp )
39423942{
39433943   taito_f3_state *state = machine.driver_data<taito_f3_state>();
3944   UINT32 *RAM = (UINT32 *)machine.region("maincpu")->base();
3944   UINT32 *RAM = (UINT32 *)state->memregion("maincpu")->base();
39453945
39463946   /* For some reason the least significant byte in the last 2 long words of
39473947    ROM is swapped.  As the roms have been verified ok, I assume this is some
r14976r14977
39893989   // which eventually causes the game to crash
39903990   //  -- protection check?? or some kind of checksum fail?
39913991
3992   UINT32 *ROM = (UINT32 *)machine.region("maincpu")->base();
3992   UINT32 *ROM = (UINT32 *)state->memregion("maincpu")->base();
39933993
39943994   /* protection? */
39953995    ROM[0x40090/4]=0x00004e71|(ROM[0x40090/4]&0xffff0000);
src/mame/drivers/jpmsys5.c
r14976r14977
249249
250250WRITE16_MEMBER(jpmsys5_state::rombank_w)
251251{
252   UINT8 *rom = machine().region("maincpu")->base();
252   UINT8 *rom = memregion("maincpu")->base();
253253   data &= 0x1f;
254   memory_set_bankptr(machine(), "bank1", &rom[0x20000 + 0x20000 * data]);
254   membank("bank1")->set_base(&rom[0x20000 + 0x20000 * data]);
255255}
256256
257257READ16_MEMBER(jpmsys5_state::coins_r)
r14976r14977
643643static MACHINE_START( jpmsys5v )
644644{
645645   jpmsys5_state *state = machine.driver_data<jpmsys5_state>();
646   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base()+0x20000);
646   state->membank("bank1")->set_base(state->memregion("maincpu")->base()+0x20000);
647647   state->m_touch_timer = machine.scheduler().timer_alloc(FUNC(touch_cb));
648648}
649649
r14976r14977
794794
795795static MACHINE_START( jpmsys5 )
796796{
797   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base()+0x20000);
797   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base()+0x20000);
798798}
799799
800800static MACHINE_RESET( jpmsys5 )
src/mame/drivers/homerun.c
r14976r14977
193193static MACHINE_START( homerun )
194194{
195195   homerun_state *state = machine.driver_data<homerun_state>();
196   UINT8 *ROM = machine.region("maincpu")->base();
196   UINT8 *ROM = state->memregion("maincpu")->base();
197197
198   memory_configure_bank(machine, "bank1", 0, 1, &ROM[0x00000], 0x4000);
199   memory_configure_bank(machine, "bank1", 1, 7, &ROM[0x10000], 0x4000);
198   state->membank("bank1")->configure_entry(0, &ROM[0x00000]);
199   state->membank("bank1")->configure_entries(1, 7, &ROM[0x10000], 0x4000);
200200
201201   state->save_item(NAME(state->m_gfx_ctrl));
202202   state->save_item(NAME(state->m_gc_up));
src/mame/drivers/champbas.c
r14976r14977
11771177static DRIVER_INIT(champbas)
11781178{
11791179   // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding
1180   UINT8 *rom1 = machine.region("gfx1")->base();
1181   UINT8 *rom2 = machine.region("gfx2")->base();
1182   int len = machine.region("gfx1")->bytes();
1180   UINT8 *rom1 = machine.root_device().memregion("gfx1")->base();
1181   UINT8 *rom2 = machine.root_device().memregion("gfx2")->base();
1182   int len = machine.root_device().memregion("gfx1")->bytes();
11831183   int i;
11841184
11851185   for (i = 0; i < len/2; ++i)
r14976r14977
11941194static DRIVER_INIT( exctsccr )
11951195{
11961196   // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding
1197   UINT8 *rom1 = machine.region("gfx1")->base();
1198   UINT8 *rom2 = machine.region("gfx2")->base();
1197   UINT8 *rom1 = machine.root_device().memregion("gfx1")->base();
1198   UINT8 *rom2 = machine.root_device().memregion("gfx2")->base();
11991199   int i;
12001200
12011201   // planes 0,1
src/mame/drivers/m107.c
r14976r14977
8383{
8484   if (ACCESSING_BITS_0_7)
8585   {
86      memory_set_bank(machine(), "bank1", (data & 0x06) >> 1);
86      membank("bank1")->set_entry((data & 0x06) >> 1);
8787      if (data & 0xf9)
8888         logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space.device()), data);
8989   }
r14976r14977
964964static DRIVER_INIT( firebarr )
965965{
966966   m107_state *state = machine.driver_data<m107_state>();
967   UINT8 *ROM = machine.region("maincpu")->base();
967   UINT8 *ROM = state->memregion("maincpu")->base();
968968
969   memory_set_bankptr(machine, "bank1", &ROM[0xa0000]);
969   state->membank("bank1")->set_base(&ROM[0xa0000]);
970970
971971   state->m_irq_vectorbase = 0x20;
972972   state->m_spritesystem = 1;
r14976r14977
975975static DRIVER_INIT( dsoccr94 )
976976{
977977   m107_state *state = machine.driver_data<m107_state>();
978   UINT8 *ROM = machine.region("maincpu")->base();
978   UINT8 *ROM = state->memregion("maincpu")->base();
979979
980   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x80000], 0x20000);
980   state->membank("bank1")->configure_entries(0, 4, &ROM[0x80000], 0x20000);
981981   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x07, write16_delegate(FUNC(m107_state::m107_bankswitch_w),state));
982982
983983   state->m_irq_vectorbase = 0x80;
src/mame/drivers/ninjaw.c
r14976r14977
355355static void reset_sound_region( running_machine &machine )
356356{
357357   ninjaw_state *state = machine.driver_data<ninjaw_state>();
358   memory_set_bank(machine, "bank10", state->m_banknum);
358   state->membank("bank10")->set_entry(state->m_banknum);
359359}
360360
361361WRITE8_MEMBER(ninjaw_state::sound_bankswitch_w)
r14976r14977
757757{
758758   ninjaw_state *state = machine.driver_data<ninjaw_state>();
759759
760   memory_configure_bank(machine, "bank10", 0, 8, machine.region("audiocpu")->base() + 0xc000, 0x4000);
760   state->membank("bank10")->configure_entries(0, 8, state->memregion("audiocpu")->base() + 0xc000, 0x4000);
761761
762762   state->m_maincpu = machine.device("maincpu");
763763   state->m_audiocpu = machine.device("audiocpu");
src/mame/drivers/arkanoid.c
r14976r14977
15801580   arkanoid_state *state = machine.driver_data<arkanoid_state>();
15811581   // the graphics on this bootleg have the data scrambled
15821582   int tile;
1583   UINT8* srcgfx = machine.region("gfx1")->base();
1583   UINT8* srcgfx = state->memregion("gfx1")->base();
15841584   UINT8* buffer = auto_alloc_array(machine, UINT8, 0x18000);
15851585
15861586   for (tile = 0; tile < 0x3000; tile++)
r14976r14977
16431643static DRIVER_INIT( tetrsark )
16441644{
16451645   arkanoid_state *state = machine.driver_data<arkanoid_state>();
1646   UINT8 *ROM = machine.region("maincpu")->base();
1646   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
16471647   int x;
16481648
16491649   for (x = 0; x < 0x8000; x++)
r14976r14977
16571657
16581658static DRIVER_INIT( hexa )
16591659{
1660   UINT8 *RAM = machine.region("maincpu")->base();
1660   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
16611661#if 0
16621662
16631663
r14976r14977
16711671   RAM[0x0126] = 0x00;
16721672#endif
16731673
1674   memory_configure_bank(machine, "bank1", 0, 2, &RAM[0x10000], 0x4000);
1674   machine.root_device().membank("bank1")->configure_entries(0, 2, &RAM[0x10000], 0x4000);
16751675}
16761676
16771677
src/mame/drivers/twin16.c
r14976r14977
8888
8989READ16_MEMBER(twin16_state::extra_rom_r)
9090{
91   return ((UINT16 *)machine().region("gfx3")->base())[offset];
91   return ((UINT16 *)machine().root_device().memregion("gfx3")->base())[offset];
9292}
9393
9494READ16_MEMBER(twin16_state::twin16_gfx_rom1_r)
r14976r14977
13051305   int i;
13061306   UINT16 *temp = auto_alloc_array(machine, UINT16, 0x200000/2);
13071307
1308   state->m_gfx_rom = (UINT16 *)machine.region("gfx2")->base();
1308   state->m_gfx_rom = (UINT16 *)state->memregion("gfx2")->base();
13091309   memcpy( temp, state->m_gfx_rom, 0x200000 );
13101310
13111311   for( i=0; i<0x080000; i++ )
src/mame/drivers/megasys1.c
r14976r14977
13801380
13811381   if ((m_protection_val & 0x90) == 0x90)
13821382   {
1383      UINT8 *RAM = machine().region("oki1")->base();
1383      UINT8 *RAM = memregion("oki1")->base();
13841384      int new_bank = (m_protection_val & 0x7) % 7;
13851385
13861386      if (m_bank != new_bank)
r14976r14977
35873587
35883588static void rodlandj_gfx_unmangle(running_machine &machine, const char *region)
35893589{
3590   UINT8 *rom = machine.region(region)->base();
3591   int size = machine.region(region)->bytes();
3590   UINT8 *rom = machine.root_device().memregion(region)->base();
3591   int size = machine.root_device().memregion(region)->bytes();
35923592   UINT8 *buffer;
35933593   int i;
35943594
r14976r14977
36193619
36203620static void jitsupro_gfx_unmangle(running_machine &machine, const char *region)
36213621{
3622   UINT8 *rom = machine.region(region)->base();
3623   int size = machine.region(region)->bytes();
3622   UINT8 *rom = machine.root_device().memregion(region)->base();
3623   int size = machine.root_device().memregion(region)->bytes();
36243624   UINT8 *buffer;
36253625   int i;
36263626
r14976r14977
36733673static DRIVER_INIT( 64street )
36743674{
36753675   megasys1_state *state = machine.driver_data<megasys1_state>();
3676//  UINT16 *RAM = (UINT16 *) machine.region("maincpu")->base();
3676//  UINT16 *RAM = (UINT16 *) state->memregion("maincpu")->base();
36773677//  RAM[0x006b8/2] = 0x6004;        // d8001 test
36783678//  RAM[0x10EDE/2] = 0x6012;        // watchdog
36793679
r14976r14977
36863686
36873687READ16_MEMBER(megasys1_state::megasys1A_mcu_hs_r)
36883688{
3689   UINT16 *ROM  = (UINT16 *) machine().region("maincpu")->base();
3689   UINT16 *ROM  = (UINT16 *) memregion("maincpu")->base();
36903690
36913691   if(m_mcu_hs && ((m_mcu_hs_ram[8/2] << 6) & 0x3ffc0) == ((offset*2) & 0x3ffc0))
36923692   {
r14976r14977
38273827
38283828READ16_MEMBER(megasys1_state::iganinju_mcu_hs_r)
38293829{
3830   UINT16 *ROM  = (UINT16 *) machine().region("maincpu")->base();
3830   UINT16 *ROM  = (UINT16 *) memregion("maincpu")->base();
38313831
38323832   if(m_mcu_hs && ((m_mcu_hs_ram[8/2] << 6) & 0x3ffc0) == ((offset*2) & 0x3ffc0))
38333833   {
r14976r14977
38673867
38683868   phantasm_rom_decode(machine, "maincpu");
38693869
3870   //RAM  = (UINT16 *) machine.region("maincpu")->base();
3870   //RAM  = (UINT16 *) machine.root_device().memregion("maincpu")->base();
38713871   megasys1_state *state = machine.driver_data<megasys1_state>();
38723872   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_r),state));
38733873   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x2f000, 0x2f009, write16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_w),state));
r14976r14977
38873887{
38883888   device_t *oki1 = machine.device("oki1");
38893889   device_t *oki2 = machine.device("oki2");
3890   //UINT16 *RAM  = (UINT16 *) machine.region("maincpu")->base();
3890   //UINT16 *RAM  = (UINT16 *) machine.root_device().memregion("maincpu")->base();
38913891
38923892   astyanax_rom_decode(machine, "maincpu");      // Code
38933893
r14976r14977
39553955
39563956READ16_MEMBER(megasys1_state::stdragon_mcu_hs_r)
39573957{
3958   UINT16 *ROM  = (UINT16 *) machine().region("maincpu")->base();
3958   UINT16 *ROM  = (UINT16 *) memregion("maincpu")->base();
39593959
39603960   if(m_mcu_hs && ((m_mcu_hs_ram[8/2] << 6) & 0x3ffc0) == ((offset*2) & 0x3ffc0))
39613961   {
r14976r14977
40264026static DRIVER_INIT( monkelf )
40274027{
40284028   megasys1_state *state = machine.driver_data<megasys1_state>();
4029   UINT16 *ROM = (UINT16*)machine.region("maincpu")->base();
4029   UINT16 *ROM = (UINT16*)state->memregion("maincpu")->base();
40304030   ROM[0x00744/2] = 0x4e71; // weird check, 0xe000e R is a port-based trap?
40314031
40324032   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe0000, 0xe000f, read16_delegate(FUNC(megasys1_state::monkelf_input_r),state));
src/mame/drivers/crshrace.c
r14976r14977
138138
139139READ16_MEMBER(crshrace_state::extrarom1_r)
140140{
141   UINT8 *rom = machine().region("user1")->base();
141   UINT8 *rom = memregion("user1")->base();
142142
143143   offset *= 2;
144144
r14976r14977
147147
148148READ16_MEMBER(crshrace_state::extrarom2_r)
149149{
150   UINT8 *rom = machine().region("user2")->base();
150   UINT8 *rom = memregion("user2")->base();
151151
152152   offset *= 2;
153153
r14976r14977
156156
157157WRITE8_MEMBER(crshrace_state::crshrace_sh_bankswitch_w)
158158{
159   memory_set_bank(machine(), "bank1", data & 0x03);
159   membank("bank1")->set_entry(data & 0x03);
160160}
161161
162162WRITE16_MEMBER(crshrace_state::sound_command_w)
r14976r14977
442442{
443443   crshrace_state *state = machine.driver_data<crshrace_state>();
444444
445   memory_configure_bank(machine, "bank1", 0, 4, machine.region("audiocpu")->base() + 0x10000, 0x8000);
445   state->membank("bank1")->configure_entries(0, 4, state->memregion("audiocpu")->base() + 0x10000, 0x8000);
446446
447447   state->save_item(NAME(state->m_roz_bank));
448448   state->save_item(NAME(state->m_gfxctrl));
r14976r14977
577577void crshrace_patch_code( UINT16 offset )
578578{
579579   /* A hack which shows 3 player mode in code which is disabled */
580   UINT16 *RAM = (UINT16 *)machine.region("maincpu")->base();
580   UINT16 *RAM = (UINT16 *)machine.root_device().memregion("maincpu")->base();
581581   RAM[(offset + 0)/2] = 0x4e71;
582582   RAM[(offset + 2)/2] = 0x4e71;
583583   RAM[(offset + 4)/2] = 0x4e71;
src/mame/drivers/airbustr.c
r14976r14977
266266
267267WRITE8_MEMBER(airbustr_state::master_bankswitch_w)
268268{
269   memory_set_bank(machine(), "bank1", data & 0x07);
269   membank("bank1")->set_entry(data & 0x07);
270270}
271271
272272WRITE8_MEMBER(airbustr_state::slave_bankswitch_w)
273273{
274274
275   memory_set_bank(machine(), "bank2", data & 0x07);
275   membank("bank2")->set_entry(data & 0x07);
276276
277277   flip_screen_set(data & 0x10);
278278
r14976r14977
282282
283283WRITE8_MEMBER(airbustr_state::sound_bankswitch_w)
284284{
285   memory_set_bank(machine(), "bank3", data & 0x07);
285   membank("bank3")->set_entry(data & 0x07);
286286}
287287
288288READ8_MEMBER(airbustr_state::soundcommand_status_r)
r14976r14977
571571static MACHINE_START( airbustr )
572572{
573573   airbustr_state *state = machine.driver_data<airbustr_state>();
574   UINT8 *MASTER = machine.region("master")->base();
575   UINT8 *SLAVE = machine.region("slave")->base();
576   UINT8 *AUDIO = machine.region("audiocpu")->base();
574   UINT8 *MASTER = machine.root_device().memregion("master")->base();
575   UINT8 *SLAVE = machine.root_device().memregion("slave")->base();
576   UINT8 *AUDIO = state->memregion("audiocpu")->base();
577577
578   memory_configure_bank(machine, "bank1", 0, 3, &MASTER[0x00000], 0x4000);
579   memory_configure_bank(machine, "bank1", 3, 5, &MASTER[0x10000], 0x4000);
580   memory_configure_bank(machine, "bank2", 0, 3, &SLAVE[0x00000], 0x4000);
581   memory_configure_bank(machine, "bank2", 3, 5, &SLAVE[0x10000], 0x4000);
582   memory_configure_bank(machine, "bank3", 0, 3, &AUDIO[0x00000], 0x4000);
583   memory_configure_bank(machine, "bank3", 3, 5, &AUDIO[0x10000], 0x4000);
578   state->membank("bank1")->configure_entries(0, 3, &MASTER[0x00000], 0x4000);
579   state->membank("bank1")->configure_entries(3, 5, &MASTER[0x10000], 0x4000);
580   state->membank("bank2")->configure_entries(0, 3, &SLAVE[0x00000], 0x4000);
581   state->membank("bank2")->configure_entries(3, 5, &SLAVE[0x10000], 0x4000);
582   state->membank("bank3")->configure_entries(0, 3, &AUDIO[0x00000], 0x4000);
583   state->membank("bank3")->configure_entries(3, 5, &AUDIO[0x10000], 0x4000);
584584
585585   state->m_master = machine.device("master");
586586   state->m_slave = machine.device("slave");
r14976r14977
607607   state->m_fg_scrolly = 0;
608608   state->m_highbits = 0;
609609
610   memory_set_bank(machine, "bank1", 0x02);
611   memory_set_bank(machine, "bank2", 0x02);
612   memory_set_bank(machine, "bank3", 0x02);
610   state->membank("bank1")->set_entry(0x02);
611   state->membank("bank2")->set_entry(0x02);
612   state->membank("bank3")->set_entry(0x02);
613613}
614614
615615/* Machine Driver */
src/mame/drivers/pacman.c
r14976r14977
373373
374374static MACHINE_RESET( mschamp )
375375{
376   UINT8 *rom = machine.region("maincpu")->base() + 0x10000;
376   UINT8 *rom = machine.root_device().memregion("maincpu")->base() + 0x10000;
377377   int whichbank = input_port_read(machine, "GAME") & 1;
378378
379   memory_configure_bank(machine, "bank1", 0, 2, &rom[0x0000], 0x8000);
380   memory_configure_bank(machine, "bank2", 0, 2, &rom[0x4000], 0x8000);
379   machine.root_device().membank("bank1")->configure_entries(0, 2, &rom[0x0000], 0x8000);
380   machine.root_device().membank("bank2")->configure_entries(0, 2, &rom[0x4000], 0x8000);
381381
382   memory_set_bank(machine, "bank1", whichbank);
383   memory_set_bank(machine, "bank2", whichbank);
382   machine.root_device().membank("bank1")->set_entry(whichbank);
383   machine.root_device().membank("bank2")->set_entry(whichbank);
384384}
385385
386386
r14976r14977
650650READ8_MEMBER(pacman_state::bigbucks_question_r)
651651{
652652
653   UINT8 *question = machine().region("user1")->base();
653   UINT8 *question = memregion("user1")->base();
654654   UINT8 ret;
655655
656656   ret = question[(m_bigbucks_bank << 16) | (offset ^ 0xffff)];
r14976r14977
671671
672672WRITE8_MEMBER(pacman_state::porky_banking_w)
673673{
674   memory_set_bank(machine(), "bank1", data & 1);
675   memory_set_bank(machine(), "bank2", data & 1);
676   memory_set_bank(machine(), "bank3", data & 1);
677   memory_set_bank(machine(), "bank4", data & 1);
674   membank("bank1")->set_entry(data & 1);
675   membank("bank2")->set_entry(data & 1);
676   membank("bank3")->set_entry(data & 1);
677   membank("bank4")->set_entry(data & 1);
678678}
679679
680680READ8_MEMBER(pacman_state::drivfrcp_port1_r)
r14976r14977
754754
755755READ8_MEMBER(pacman_state::rocktrv2_question_r)
756756{
757   UINT8 *question = machine().region("user1")->base();
757   UINT8 *question = memregion("user1")->base();
758758
759759   return question[offset | (m_rocktrv2_question_bank * 0x8000)];
760760}
r14976r14977
839839  vias required to lay out the aux PCB.
840840*/
841841
842#define mspacman_enable_decode_latch(m)  memory_set_bank(m, "bank1", 1)
843#define mspacman_disable_decode_latch(m) memory_set_bank(m, "bank1", 0)
842#define mspacman_enable_decode_latch(m)  m.root_device().membank("bank1")->set_entry(1)
843#define mspacman_disable_decode_latch(m) m.root_device().membank("bank1")->set_entry(0)
844844
845845// any access to these ROM addresses disables the decoder, and all you see is the original Pac-Man code
846READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x0038){ mspacman_disable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x0038]; }
847READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x03b0){ mspacman_disable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x03b0]; }
848READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x1600){ mspacman_disable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x1600]; }
849READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x2120){ mspacman_disable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x2120]; }
850READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x3ff0){ mspacman_disable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x3ff0]; }
851READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x8000){ mspacman_disable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x8000]; }
852READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x97f0){ mspacman_disable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x97f0]; }
846READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x0038){ mspacman_disable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x0038]; }
847READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x03b0){ mspacman_disable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x03b0]; }
848READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x1600){ mspacman_disable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x1600]; }
849READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x2120){ mspacman_disable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x2120]; }
850READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x3ff0){ mspacman_disable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x3ff0]; }
851READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x8000){ mspacman_disable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x8000]; }
852READ8_MEMBER(pacman_state::mspacman_disable_decode_r_0x97f0){ mspacman_disable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x97f0]; }
853853WRITE8_MEMBER(pacman_state::mspacman_disable_decode_w){ mspacman_disable_decode_latch(machine()); }
854854
855855// any access to these ROM addresses enables the decoder, and you'll see the Ms. Pac-Man code
856READ8_MEMBER(pacman_state::mspacman_enable_decode_r_0x3ff8){ mspacman_enable_decode_latch(machine()); return machine().region("maincpu")->base()[offset+0x3ff8+0x10000]; }
856READ8_MEMBER(pacman_state::mspacman_enable_decode_r_0x3ff8){ mspacman_enable_decode_latch(machine()); return memregion("maincpu")->base()[offset+0x3ff8+0x10000]; }
857857WRITE8_MEMBER(pacman_state::mspacman_enable_decode_w){ mspacman_enable_decode_latch(machine()); }
858858
859859
r14976r14977
54665466{
54675467   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
54685468   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
5469   UINT8 *rom = machine.region("maincpu")->base();
5469   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
54705470
54715471   /* patch protection using a copy of the opcodes so ROM checksum */
54725472   /* tests will not fail */
r14976r14977
54995499{
55005500   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
55015501   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
5502   UINT8 *rom = machine.region("maincpu")->base();
5502   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
55035503
55045504   /* patch protection using a copy of the opcodes so ROM checksum */
55055505   /* tests will not fail */
r14976r14977
55355535
55365536   int i, j;
55375537   UINT8 *RAM, temp;
5538   int length = machine.region("gfx1")->bytes()/2;
5538   int length = machine.root_device().memregion("gfx1")->bytes()/2;
55395539
55405540   /* Characters */
5541   RAM = machine.region("gfx1")->base();
5541   RAM = machine.root_device().memregion("gfx1")->base();
55425542   for (i = 0;i < length;i += 0x10)
55435543   {
55445544      for (j = 0; j < 8; j++)
r14976r14977
55505550   }
55515551
55525552   /* Sprites */
5553   RAM = machine.region("gfx1")->base()+length;
5553   RAM = machine.root_device().memregion("gfx1")->base()+length;
55545554   for (i = 0;i < length;i += 0x20)
55555555   {
55565556      for (j = 0; j < 8; j++)
r14976r14977
55885588   /* CPU ROMs */
55895589
55905590   /* Data lines D3 and D5 swapped */
5591   RAM = machine.region("maincpu")->base();
5591   RAM = machine.root_device().memregion("maincpu")->base();
55925592   for (i = 0; i < 0x4000; i++)
55935593   {
55945594      RAM[i] = BITSWAP8(RAM[i],7,6,3,4,5,2,1,0);
r14976r14977
55985598   /* Graphics ROMs */
55995599
56005600   /* Data lines D4 and D6 and address lines A0 and A2 are swapped */
5601   RAM = machine.region("gfx1")->base();
5602   len = machine.region("gfx1")->bytes();
5601   RAM = machine.root_device().memregion("gfx1")->base();
5602   len = machine.root_device().memregion("gfx1")->bytes();
56035603   for (i = 0;i < len;i += 8)
56045604      eyes_decode(&RAM[i]);
56055605}
r14976r14977
56725672   /* CPU ROMs */
56735673
56745674   /* Pac-Man code is in low bank */
5675   ROM = machine.region("maincpu")->base();
5675   ROM = machine.root_device().memregion("maincpu")->base();
56765676
56775677   /* decrypted Ms. Pac-Man code is in high bank */
5678   DROM = &machine.region("maincpu")->base()[0x10000];
5678   DROM = &machine.root_device().memregion("maincpu")->base()[0x10000];
56795679
56805680   /* copy ROMs into decrypted bank */
56815681   for (i = 0; i < 0x1000; i++)
r14976r14977
57105710   }
57115711
57125712   /* initialize the banks */
5713   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x00000], 0x10000);
5714   memory_set_bank(machine, "bank1", 1);
5713   machine.root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x00000], 0x10000);
5714   machine.root_device().membank("bank1")->set_entry(1);
57155715}
57165716
57175717static DRIVER_INIT( woodpek )
r14976r14977
57225722   /* Graphics ROMs */
57235723
57245724   /* Data lines D4 and D6 and address lines A0 and A2 are swapped */
5725   RAM = machine.region("gfx1")->base();
5726   len = machine.region("gfx1")->bytes();
5725   RAM = machine.root_device().memregion("gfx1")->base();
5726   len = machine.root_device().memregion("gfx1")->bytes();
57275727   for (i = 0;i < len;i += 8)
57285728      eyes_decode(&RAM[i]);
57295729}
r14976r14977
57405740
57415741static DRIVER_INIT( drivfrcp )
57425742{
5743   UINT8 *ROM = machine.region("maincpu")->base();
5744   memory_set_bankptr(machine, "bank1", &ROM[0 * 0x2000]);
5745   memory_set_bankptr(machine, "bank2", &ROM[1 * 0x2000]);
5746   memory_set_bankptr(machine, "bank3", &ROM[2 * 0x2000]);
5747   memory_set_bankptr(machine, "bank4", &ROM[3 * 0x2000]);
5743   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
5744   machine.root_device().membank("bank1")->set_base(&ROM[0 * 0x2000]);
5745   machine.root_device().membank("bank2")->set_base(&ROM[1 * 0x2000]);
5746   machine.root_device().membank("bank3")->set_base(&ROM[2 * 0x2000]);
5747   machine.root_device().membank("bank4")->set_base(&ROM[3 * 0x2000]);
57485748}
57495749
57505750static DRIVER_INIT( 8bpm )
57515751{
5752   UINT8 *ROM = machine.region("maincpu")->base();
5752   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
57535753   int i;
57545754
57555755   /* Data lines D0 and D6 swapped */
r14976r14977
57585758      ROM[i] = BITSWAP8(ROM[i],7,0,5,4,3,2,1,6);
57595759   }
57605760
5761   memory_set_bankptr(machine, "bank1", &ROM[0 * 0x2000]);
5762   memory_set_bankptr(machine, "bank2", &ROM[1 * 0x2000]);
5763   memory_set_bankptr(machine, "bank3", &ROM[2 * 0x2000]);
5764   memory_set_bankptr(machine, "bank4", &ROM[3 * 0x2000]);
5761   machine.root_device().membank("bank1")->set_base(&ROM[0 * 0x2000]);
5762   machine.root_device().membank("bank2")->set_base(&ROM[1 * 0x2000]);
5763   machine.root_device().membank("bank3")->set_base(&ROM[2 * 0x2000]);
5764   machine.root_device().membank("bank4")->set_base(&ROM[3 * 0x2000]);
57655765}
57665766
57675767static DRIVER_INIT( porky )
57685768{
5769   UINT8 *ROM = machine.region("maincpu")->base();
5769   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
57705770   int i;
57715771
57725772   /* Data lines D0 and D4 swapped */
r14976r14977
57755775      ROM[i] = BITSWAP8(ROM[i],7,6,5,0,3,2,1,4);
57765776   }
57775777
5778   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0 * 0x2000], 0x8000);
5779   memory_configure_bank(machine, "bank2", 0, 2, &ROM[1 * 0x2000], 0x8000);
5780   memory_configure_bank(machine, "bank3", 0, 2, &ROM[2 * 0x2000], 0x8000);
5781   memory_configure_bank(machine, "bank4", 0, 2, &ROM[3 * 0x2000], 0x8000);
5778   machine.root_device().membank("bank1")->configure_entries(0, 2, &ROM[0 * 0x2000], 0x8000);
5779   machine.root_device().membank("bank2")->configure_entries(0, 2, &ROM[1 * 0x2000], 0x8000);
5780   machine.root_device().membank("bank3")->configure_entries(0, 2, &ROM[2 * 0x2000], 0x8000);
5781   machine.root_device().membank("bank4")->configure_entries(0, 2, &ROM[3 * 0x2000], 0x8000);
57825782
5783   memory_set_bank(machine, "bank1", 0);
5784   memory_set_bank(machine, "bank2", 0);
5785   memory_set_bank(machine, "bank3", 0);
5786   memory_set_bank(machine, "bank4", 0);
5783   machine.root_device().membank("bank1")->set_entry(0);
5784   machine.root_device().membank("bank2")->set_entry(0);
5785   machine.root_device().membank("bank3")->set_entry(0);
5786   machine.root_device().membank("bank4")->set_entry(0);
57875787}
57885788
57895789static DRIVER_INIT( rocktrv2 )
57905790{
57915791   /* hack to pass the rom check for the bad rom */
5792   UINT8 *ROM = machine.region("maincpu")->base();
5792   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
57935793
57945794   ROM[0x7ffe] = 0xa7;
57955795   ROM[0x7fee] = 0x6d;
r14976r14977
58015801static DRIVER_INIT( mspacmbe )
58025802{
58035803   UINT8 temp;
5804   UINT8 *RAM = machine.region("maincpu")->base();
5804   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
58055805   int i;
58065806
58075807   /* Address lines A1 and A0 swapped if A2=0 */
src/mame/drivers/igs011.c
r14976r14977
415415   UINT8 trans_pen, clear_pen, pen_hi, *dest;
416416   UINT8 pen = 0;
417417
418   UINT8 *gfx      =   machine().region("blitter")->base();
419   UINT8 *gfx2      =   machine().region("blitter_hi")->base();
420   int gfx_size   =   machine().region("blitter")->bytes();
421   int gfx2_size   =   machine().region("blitter_hi")->bytes();
418   UINT8 *gfx      =   memregion("blitter")->base();
419   UINT8 *gfx2      =   memregion("blitter_hi")->base();
420   int gfx_size   =   memregion("blitter")->bytes();
421   int gfx2_size   =   memregion("blitter_hi")->bytes();
422422
423423   const rectangle &clip = machine().primary_screen->visible_area();
424424
r14976r14977
559559static void wlcc_decrypt(running_machine &machine)
560560{
561561   int i;
562   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
562   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
563563
564564   int rom_size = 0x80000;
565565
r14976r14977
583583static void lhb_decrypt(running_machine &machine)
584584{
585585   int i;
586   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
586   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
587587
588588   int rom_size = 0x80000;
589589
r14976r14977
608608static void drgnwrld_type3_decrypt(running_machine &machine)
609609{
610610   int i;
611   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
611   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
612612
613613   int rom_size = 0x80000;
614614
r14976r14977
636636static void drgnwrld_type2_decrypt(running_machine &machine)
637637{
638638   int i;
639   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
639   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
640640
641641   int rom_size = 0x80000;
642642
r14976r14977
669669static void drgnwrld_type1_decrypt(running_machine &machine)
670670{
671671   int i;
672   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
672   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
673673
674674   int rom_size = 0x80000;
675675
r14976r14977
699699{
700700   int i,j;
701701   int rom_size = 0x80000;
702   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
702   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
703703   UINT16 *result_data = auto_alloc_array(machine, UINT16, rom_size/2);
704704
705705   for (i=0; i<rom_size/2; i++)
r14976r14977
740740
741741   int i,j;
742742   int rom_size = 0x80000;
743   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
743   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
744744   UINT16 *result_data = auto_alloc_array(machine, UINT16, rom_size/2);
745745
746746   for (i=0; i<rom_size/2; i++)
r14976r14977
770770static void vbowlj_decrypt(running_machine &machine)
771771{
772772   int i;
773   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
773   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
774774
775775   int rom_size = 0x80000;
776776
r14976r14977
804804static void dbc_decrypt(running_machine &machine)
805805{
806806   int i;
807   UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
807   UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
808808
809809   int rom_size = 0x80000;
810810
r14976r14977
854854static void ryukobou_decrypt(running_machine &machine)
855855{
856856   int i;
857   UINT16 *src = (UINT16 *) machine.region("maincpu")->base();
857   UINT16 *src = (UINT16 *) machine.root_device().memregion("maincpu")->base();
858858   int rom_size = 0x80000;
859859
860860   for (i=0; i<rom_size/2; i++)
r14976r14977
886886{
887887   int i;
888888   unsigned rom_size = 0x200000;
889   UINT8 *src = (UINT8 *) (machine.region("blitter")->base());
889   UINT8 *src = (UINT8 *) (machine.root_device().memregion("blitter")->base());
890890   UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
891891
892892   for (i=0; i<rom_size; i++)
r14976r14977
901901{
902902   int i;
903903   unsigned rom_size = 0x400000;
904   UINT8 *src = (UINT8 *) (machine.region("blitter")->base());
904   UINT8 *src = (UINT8 *) (machine.root_device().memregion("blitter")->base());
905905   UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
906906
907907   for (i=0; i<rom_size; i++)
r14976r14977
10141014//  m_prot2 = 0x00;
10151015
10161016   address_space *sp = machine().device("maincpu")->memory().space(AS_PROGRAM);
1017   UINT8 *rom = machine().region("maincpu")->base();
1017   UINT8 *rom = memregion("maincpu")->base();
10181018
10191019   // Plug previous address range with ROM access
10201020   sp->install_rom(m_prot1_addr + 0, m_prot1_addr + 9, rom + m_prot1_addr);
r14976r14977
17571757// V0400O
17581758static DRIVER_INIT( drgnwrld )
17591759{
1760//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1760//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
17611761
17621762   drgnwrld_type1_decrypt(machine);
17631763   drgnwrld_gfx_decrypt(machine);
r14976r14977
17831783
17841784static DRIVER_INIT( drgnwrldv30 )
17851785{
1786//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1786//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
17871787
17881788   drgnwrld_type1_decrypt(machine);
17891789   drgnwrld_gfx_decrypt(machine);
r14976r14977
18081808
18091809static DRIVER_INIT( drgnwrldv21 )
18101810{
1811//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1811//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
18121812
18131813   drgnwrld_type2_decrypt(machine);
18141814   drgnwrld_gfx_decrypt(machine);
r14976r14977
18381838
18391839static DRIVER_INIT( drgnwrldv21j )
18401840{
1841//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1841//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
18421842
18431843   drgnwrld_type3_decrypt(machine);
18441844   drgnwrld_gfx_decrypt(machine);
r14976r14977
18651865
18661866static DRIVER_INIT( drgnwrldv20j )
18671867{
1868//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1868//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
18691869
18701870   drgnwrld_type3_decrypt(machine);
18711871   drgnwrld_gfx_decrypt(machine);
r14976r14977
19031903
19041904static DRIVER_INIT( drgnwrldv10c )
19051905{
1906//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1906//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
19071907
19081908   drgnwrld_type1_decrypt(machine);
19091909   drgnwrld_gfx_decrypt(machine);
r14976r14977
19291929
19301930static DRIVER_INIT( lhb )
19311931{
1932//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1932//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
19331933
19341934   lhb_decrypt(machine);
19351935
r14976r14977
19391939
19401940static DRIVER_INIT( lhbv33c )
19411941{
1942//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1942//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
19431943
19441944   lhb_decrypt(machine);
19451945
r14976r14977
19491949
19501950static DRIVER_INIT( dbc )
19511951{
1952//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1952//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
19531953
19541954   dbc_decrypt(machine);
19551955
r14976r14977
19791979
19801980static DRIVER_INIT( ryukobou )
19811981{
1982//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1982//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
19831983
19841984   ryukobou_decrypt(machine);
19851985
r14976r14977
19931993
19941994static DRIVER_INIT( xymg )
19951995{
1996//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1996//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
19971997
19981998   lhb_decrypt(machine);
19991999/*
r14976r14977
20272027
20282028static DRIVER_INIT( wlcc )
20292029{
2030//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2030//  UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
20312031
20322032   wlcc_decrypt(machine);
20332033/*
r14976r14977
20512051
20522052static DRIVER_INIT( lhb2 )
20532053{
2054   UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2054   UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
20552055
20562056   lhb2_decrypt(machine);
20572057   lhb2_decrypt_gfx(machine);
r14976r14977
20732073
20742074static DRIVER_INIT( vbowl )
20752075{
2076   UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2077   UINT8  *gfx = (UINT8 *)  machine.region("blitter")->base();
2076   UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
2077   UINT8  *gfx = (UINT8 *)  machine.root_device().memregion("blitter")->base();
20782078   int i;
20792079
20802080   vbowlj_decrypt(machine);
r14976r14977
20982098
20992099static DRIVER_INIT( vbowlj )
21002100{
2101   UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2102   UINT8  *gfx = (UINT8 *)  machine.region("blitter")->base();
2101   UINT16 *rom = (UINT16 *) machine.root_device().memregion("maincpu")->base();
2102   UINT8  *gfx = (UINT8 *)  machine.root_device().memregion("blitter")->base();
21032103   int i;
21042104
21052105   vbowlj_decrypt(machine);
src/mame/drivers/bwing.c
r14976r14977
586586{
587587   bwing_state *state = machine.driver_data<bwing_state>();
588588
589   state->m_bwp123_membase[0] = machine.region("maincpu")->base();
590   state->m_bwp123_membase[1] = machine.region("sub")->base();
591   state->m_bwp123_membase[2] = machine.region("audiocpu")->base();
589   state->m_bwp123_membase[0] = machine.root_device().memregion("maincpu")->base();
590   state->m_bwp123_membase[1] = machine.root_device().memregion("sub")->base();
591   state->m_bwp123_membase[2] = state->memregion("audiocpu")->base();
592592
593593   fix_bwp3(machine);
594594}
src/mame/drivers/srmp6.c
r14976r14977
333333
334334      case 0x5e/2: // bank switch, used by ROM check
335335      {
336         const UINT8 *rom = machine().region("nile")->base();
336         const UINT8 *rom = memregion("nile")->base();
337337         LOG(("%x\n",data));
338         memory_set_bankptr(machine(), "bank1",(UINT16 *)(rom + (data & 0x0f)*0x200000));
338         membank("bank1")->set_base((UINT16 *)(rom + (data & 0x0f)*0x200000));
339339         break;
340340      }
341341
r14976r14977
418418   COMBINE_DATA(&dmaram[offset]);
419419   if (offset==13 && dmaram[offset]==0x40)
420420   {
421      const UINT8 *rom = machine().region("nile")->base();
421      const UINT8 *rom = memregion("nile")->base();
422422      UINT32 srctab=2*((((UINT32)dmaram[5])<<16)|dmaram[4]);
423423      UINT32 srcdata=2*((((UINT32)dmaram[11])<<16)|dmaram[10]);
424424      UINT32 len=4*(((((UINT32)dmaram[7]&3)<<16)|dmaram[6])+1); //??? WRONG!
src/mame/drivers/sf.c
r14976r14977
173173
174174WRITE8_MEMBER(sf_state::sound2_bank_w)
175175{
176   memory_set_bankptr(machine(), "bank1", machine().region("audio2")->base() + 0x8000 * (data + 1));
176   membank("bank1")->set_base(machine().root_device().memregion("audio2")->base() + 0x8000 * (data + 1));
177177}
178178
179179
src/mame/drivers/cave.c
r14976r14977
10471047   if (data & ~0x0f)
10481048      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
10491049
1050   memory_set_bank(machine(), "bank2", data & 0x0f);
1050   membank("bank2")->set_entry(data & 0x0f);
10511051}
10521052
10531053WRITE8_MEMBER(cave_state::hotdogst_okibank_w)
10541054{
10551055   int bank1 = (data >> 0) & 0x3;
10561056   int bank2 = (data >> 4) & 0x3;
1057   memory_set_bank(machine(), "bank3", bank1);
1058   memory_set_bank(machine(), "bank4", bank2);
1057   membank("bank3")->set_entry(bank1);
1058   membank("bank4")->set_entry(bank2);
10591059}
10601060
10611061static ADDRESS_MAP_START( hotdogst_sound_map, AS_PROGRAM, 8, cave_state )
r14976r14977
10841084   if (data & ~0x07)
10851085      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
10861086
1087   memory_set_bank(machine(), "bank2", data & 0x07);
1087   membank("bank2")->set_entry(data & 0x07);
10881088}
10891089
10901090static ADDRESS_MAP_START( mazinger_sound_map, AS_PROGRAM, 8, cave_state )
r14976r14977
11151115   if (data & ~0x0f)
11161116      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
11171117
1118   memory_set_bank(machine(), "bank1", data & 0x0f);
1118   membank("bank1")->set_entry(data & 0x0f);
11191119}
11201120
11211121WRITE8_MEMBER(cave_state::metmqstr_okibank0_w)
11221122{
11231123   int bank1 = (data >> 0) & 0x7;
11241124   int bank2 = (data >> 4) & 0x7;
1125   memory_set_bank(machine(), "bank3", bank1);
1126   memory_set_bank(machine(), "bank4", bank2);
1125   membank("bank3")->set_entry(bank1);
1126   membank("bank4")->set_entry(bank2);
11271127}
11281128
11291129WRITE8_MEMBER(cave_state::metmqstr_okibank1_w)
11301130{
11311131   int bank1 = (data >> 0) & 0x7;
11321132   int bank2 = (data >> 4) & 0x7;
1133   memory_set_bank(machine(), "bank5", bank1);
1134   memory_set_bank(machine(), "bank6", bank2);
1133   membank("bank5")->set_entry(bank1);
1134   membank("bank6")->set_entry(bank2);
11351135}
11361136
11371137static ADDRESS_MAP_START( metmqstr_sound_map, AS_PROGRAM, 8, cave_state )
r14976r14977
11631163   if (data & ~0x07)
11641164      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
11651165
1166   memory_set_bank(machine(), "bank1", data & 0x07);
1166   membank("bank1")->set_entry(data & 0x07);
11671167}
11681168
11691169static ADDRESS_MAP_START( pwrinst2_sound_map, AS_PROGRAM, 8, cave_state )
r14976r14977
12051205   if (data & ~0x1f)
12061206      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
12071207
1208   memory_set_bank(machine(), "bank1", data & 0x1f);
1208   membank("bank1")->set_entry(data & 0x1f);
12091209}
12101210
12111211WRITE8_MEMBER(cave_state::sailormn_okibank0_w)
12121212{
12131213   int bank1 = (data >> 0) & 0xf;
12141214   int bank2 = (data >> 4) & 0xf;
1215   memory_set_bank(machine(), "bank3", bank1);
1216   memory_set_bank(machine(), "bank4", bank2);
1215   membank("bank3")->set_entry(bank1);
1216   membank("bank4")->set_entry(bank2);
12171217}
12181218
12191219WRITE8_MEMBER(cave_state::sailormn_okibank1_w)
12201220{
12211221   int bank1 = (data >> 0) & 0xf;
12221222   int bank2 = (data >> 4) & 0xf;
1223   memory_set_bank(machine(), "bank5", bank1);
1224   memory_set_bank(machine(), "bank6", bank2);
1223   membank("bank5")->set_entry(bank1);
1224   membank("bank6")->set_entry(bank2);
12251225}
12261226
12271227static ADDRESS_MAP_START( sailormn_sound_map, AS_PROGRAM, 8, cave_state )
r14976r14977
25852585/* 4 bits -> 8 bits. Even and odd pixels are swapped */
25862586static void unpack_sprites(running_machine &machine)
25872587{
2588   const UINT32 len   =   machine.region("sprites")->bytes();
2589   UINT8 *rgn         =   machine.region       ("sprites")->base();
2588   const UINT32 len   =   machine.root_device().memregion("sprites")->bytes();
2589   UINT8 *rgn         =   machine.root_device().memregion       ("sprites")->base();
25902590   UINT8 *src         =   rgn + len / 2 - 1;
25912591   UINT8 *dst         =   rgn + len - 1;
25922592
r14976r14977
26022602/* 4 bits -> 8 bits. Even and odd pixels and even and odd words, are swapped */
26032603static void ddonpach_unpack_sprites(running_machine &machine)
26042604{
2605   const UINT32 len   =   machine.region("sprites")->bytes();
2606   UINT8 *rgn         =   machine.region       ("sprites")->base();
2605   const UINT32 len   =   machine.root_device().memregion("sprites")->bytes();
2606   UINT8 *rgn         =   machine.root_device().memregion       ("sprites")->base();
26072607   UINT8 *src         =   rgn + len / 2 - 1;
26082608   UINT8 *dst         =   rgn + len - 1;
26092609
r14976r14977
26262626/* 2 pages of 4 bits -> 8 bits */
26272627static void esprade_unpack_sprites(running_machine &machine)
26282628{
2629   UINT8 *src      =   machine.region("sprites")->base();
2630   UINT8 *dst      =   src + machine.region("sprites")->bytes();
2629   UINT8 *src      =   machine.root_device().memregion("sprites")->base();
2630   UINT8 *dst      =   src + machine.root_device().memregion("sprites")->bytes();
26312631
26322632   while(src < dst)
26332633   {
r14976r14977
44154415   Expand the 2 bit part into a 4 bit layout, so we can decode it */
44164416static void sailormn_unpack_tiles( running_machine &machine, const char *region )
44174417{
4418   const UINT32 len   =   machine.region(region)->bytes();
4419   UINT8 *rgn      =   machine.region(region)->base();
4418   const UINT32 len   =   machine.root_device().memregion(region)->bytes();
4419   UINT8 *rgn      =   machine.root_device().memregion(region)->base();
44204420   UINT8 *src      =   rgn + (len/4)*3 - 1;
44214421   UINT8 *dst      =   rgn + (len/4)*4 - 2;
44224422
r14976r14977
44464446
44474447static DRIVER_INIT( agallet )
44484448{
4449   UINT8 *ROM = machine.region("audiocpu")->base();
4449   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
44504450   init_cave(machine);
44514451
4452   memory_configure_bank(machine, "bank1", 0, 0x02, &ROM[0x00000], 0x4000);
4453   memory_configure_bank(machine, "bank1", 2, 0x1e, &ROM[0x10000], 0x4000);
4452   machine.root_device().membank("bank1")->configure_entries(0, 0x02, &ROM[0x00000], 0x4000);
4453   machine.root_device().membank("bank1")->configure_entries(2, 0x1e, &ROM[0x10000], 0x4000);
44544454
4455   ROM = machine.region("oki1")->base();
4456   memory_configure_bank(machine, "bank3", 0, 0x10, &ROM[0x00000], 0x20000);
4457   memory_configure_bank(machine, "bank4", 0, 0x10, &ROM[0x00000], 0x20000);
4455   ROM = machine.root_device().memregion("oki1")->base();
4456   machine.root_device().membank("bank3")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4457   machine.root_device().membank("bank4")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
44584458
4459   ROM = machine.region("oki2")->base();
4460   memory_configure_bank(machine, "bank5", 0, 0x10, &ROM[0x00000], 0x20000);
4461   memory_configure_bank(machine, "bank6", 0, 0x10, &ROM[0x00000], 0x20000);
4459   ROM = machine.root_device().memregion("oki2")->base();
4460   machine.root_device().membank("bank5")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4461   machine.root_device().membank("bank6")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
44624462
44634463   sailormn_unpack_tiles(machine, "layer2");
44644464
r14976r14977
45144514
45154515#if 0      //ROM PATCH
45164516   {
4517      UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
4517      UINT16 *rom = (UINT16 *)state->memregion("maincpu")->base();
45184518      rom[0x118A/2] = 0x4e71;         //palette fix   118A: 5548              SUBQ.W  #2,A0       --> NOP
45194519   }
45204520#endif
r14976r14977
45444544static DRIVER_INIT( hotdogst )
45454545{
45464546   cave_state *state = machine.driver_data<cave_state>();
4547   UINT8 *ROM = machine.region("audiocpu")->base();
4547   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
45484548
45494549   init_cave(machine);
45504550
4551   memory_configure_bank(machine, "bank2", 0, 0x2, &ROM[0x00000], 0x4000);
4552   memory_configure_bank(machine, "bank2", 2, 0xe, &ROM[0x10000], 0x4000);
4551   state->membank("bank2")->configure_entries(0, 0x2, &ROM[0x00000], 0x4000);
4552   state->membank("bank2")->configure_entries(2, 0xe, &ROM[0x10000], 0x4000);
45534553
4554   ROM = machine.region("oki")->base();
4555   memory_configure_bank(machine, "bank3", 0, 4, &ROM[0x00000], 0x20000);
4556   memory_configure_bank(machine, "bank4", 0, 4, &ROM[0x00000], 0x20000);
4554   ROM = state->memregion("oki")->base();
4555   state->membank("bank3")->configure_entries(0, 4, &ROM[0x00000], 0x20000);
4556   state->membank("bank4")->configure_entries(0, 4, &ROM[0x00000], 0x20000);
45574557
45584558   unpack_sprites(machine);
45594559   state->m_spritetype[0] = 2;   // Normal sprites with different position handling
r14976r14977
45634563static DRIVER_INIT( mazinger )
45644564{
45654565   cave_state *state = machine.driver_data<cave_state>();
4566   UINT8 *ROM = machine.region("audiocpu")->base();
4566   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
45674567   UINT8 *buffer;
4568   UINT8 *src = machine.region("sprites")->base();
4569   int len = machine.region("sprites")->bytes();
4568   UINT8 *src = machine.root_device().memregion("sprites")->base();
4569   int len = machine.root_device().memregion("sprites")->bytes();
45704570
45714571   init_cave(machine);
45724572
4573   memory_configure_bank(machine, "bank2", 0, 2, &ROM[0x00000], 0x4000);
4574   memory_configure_bank(machine, "bank2", 2, 6, &ROM[0x10000], 0x4000);
4573   state->membank("bank2")->configure_entries(0, 2, &ROM[0x00000], 0x4000);
4574   state->membank("bank2")->configure_entries(2, 6, &ROM[0x10000], 0x4000);
45754575
4576   ROM = machine.region("oki")->base();
4577   memory_configure_bank(machine, "bank3", 0, 4, &ROM[0x00000], 0x20000);
4578   memory_configure_bank(machine, "bank4", 0, 4, &ROM[0x00000], 0x20000);
4576   ROM = state->memregion("oki")->base();
4577   state->membank("bank3")->configure_entries(0, 4, &ROM[0x00000], 0x20000);
4578   state->membank("bank4")->configure_entries(0, 4, &ROM[0x00000], 0x20000);
45794579
45804580   /* decrypt sprites */
45814581   buffer = auto_alloc_array(machine, UINT8, len);
r14976r14977
45934593   state->m_time_vblank_irq = 2100;
45944594
45954595   /* setup extra ROM */
4596   memory_set_bankptr(machine, "bank1",machine.region("user1")->base());
4596   state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base());
45974597}
45984598
45994599
46004600static DRIVER_INIT( metmqstr )
46014601{
46024602   cave_state *state = machine.driver_data<cave_state>();
4603   UINT8 *ROM = machine.region("audiocpu")->base();
4603   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
46044604
46054605   init_cave(machine);
46064606
4607   memory_configure_bank(machine, "bank1", 0, 0x2, &ROM[0x00000], 0x4000);
4608   memory_configure_bank(machine, "bank1", 2, 0xe, &ROM[0x10000], 0x4000);
4607   state->membank("bank1")->configure_entries(0, 0x2, &ROM[0x00000], 0x4000);
4608   state->membank("bank1")->configure_entries(2, 0xe, &ROM[0x10000], 0x4000);
46094609
4610   ROM = machine.region("oki1")->base();
4611   memory_configure_bank(machine, "bank3", 0, 8, &ROM[0x00000], 0x20000);
4612   memory_configure_bank(machine, "bank4", 0, 8, &ROM[0x00000], 0x20000);
4610   ROM = machine.root_device().memregion("oki1")->base();
4611   state->membank("bank3")->configure_entries(0, 8, &ROM[0x00000], 0x20000);
4612   state->membank("bank4")->configure_entries(0, 8, &ROM[0x00000], 0x20000);
46134613
4614   ROM = machine.region("oki2")->base();
4615   memory_configure_bank(machine, "bank5", 0, 8, &ROM[0x00000], 0x20000);
4616   memory_configure_bank(machine, "bank6", 0, 8, &ROM[0x00000], 0x20000);
4614   ROM = state->memregion("oki2")->base();
4615   state->membank("bank5")->configure_entries(0, 8, &ROM[0x00000], 0x20000);
4616   state->membank("bank6")->configure_entries(0, 8, &ROM[0x00000], 0x20000);
46174617
46184618   unpack_sprites(machine);
46194619   state->m_spritetype[0] = 2;   // Normal sprites with different position handling
r14976r14977
46254625static DRIVER_INIT( pwrinst2j )
46264626{
46274627   cave_state *state = machine.driver_data<cave_state>();
4628   UINT8 *ROM = machine.region("audiocpu")->base();
4628   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
46294629   UINT8 *buffer;
4630   UINT8 *src = machine.region("sprites")->base();
4631   int len = machine.region("sprites")->bytes();
4630   UINT8 *src = machine.root_device().memregion("sprites")->base();
4631   int len = state->memregion("sprites")->bytes();
46324632   int i, j;
46334633
46344634   init_cave(machine);
46354635
4636   memory_configure_bank(machine, "bank1", 0, 3, &ROM[0x00000], 0x4000);
4637   memory_configure_bank(machine, "bank1", 3, 5, &ROM[0x10000], 0x4000);
4636   state->membank("bank1")->configure_entries(0, 3, &ROM[0x00000], 0x4000);
4637   state->membank("bank1")->configure_entries(3, 5, &ROM[0x10000], 0x4000);
46384638
46394639   buffer = auto_alloc_array(machine, UINT8, len);
46404640   {
r14976r14977
46644664
46654665#if 1      //ROM PATCH
46664666   {
4667      UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
4667      UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
46684668      rom[0xd46c / 2] = 0xd482;         // kurara dash fix  0xd400 -> 0xd482
46694669   }
46704670#endif
r14976r14977
46744674static DRIVER_INIT( sailormn )
46754675{
46764676   cave_state *state = machine.driver_data<cave_state>();
4677   UINT8 *ROM = machine.region("audiocpu")->base();
4677   UINT8 *ROM = machine.root_device().memregion("audiocpu")->base();
46784678   UINT8 *buffer;
4679   UINT8 *src = machine.region("sprites")->base();
4680   int len = machine.region("sprites")->bytes();
4679   UINT8 *src = machine.root_device().memregion("sprites")->base();
4680   int len = machine.root_device().memregion("sprites")->bytes();
46814681
46824682   init_cave(machine);
46834683
4684   memory_configure_bank(machine, "bank1", 0, 0x02, &ROM[0x00000], 0x4000);
4685   memory_configure_bank(machine, "bank1", 2, 0x1e, &ROM[0x10000], 0x4000);
4684   state->membank("bank1")->configure_entries(0, 0x02, &ROM[0x00000], 0x4000);
4685   state->membank("bank1")->configure_entries(2, 0x1e, &ROM[0x10000], 0x4000);
46864686
4687   ROM = machine.region("oki1")->base();
4688   memory_configure_bank(machine, "bank3", 0, 0x10, &ROM[0x00000], 0x20000);
4689   memory_configure_bank(machine, "bank4", 0, 0x10, &ROM[0x00000], 0x20000);
4687   ROM = machine.root_device().memregion("oki1")->base();
4688   state->membank("bank3")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4689   state->membank("bank4")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
46904690
4691   ROM = machine.region("oki2")->base();
4692   memory_configure_bank(machine, "bank5", 0, 0x10, &ROM[0x00000], 0x20000);
4693   memory_configure_bank(machine, "bank6", 0, 0x10, &ROM[0x00000], 0x20000);
4691   ROM = state->memregion("oki2")->base();
4692   state->membank("bank5")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4693   state->membank("bank6")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
46944694
46954695   /* decrypt sprites */
46964696   buffer = auto_alloc_array(machine, UINT8, len);
src/mame/drivers/williams.c
r14976r14977
534534   space->install_read_handler     (0xc800, 0xcbff, 0, 0x03e0, read8_delegate(FUNC(williams_state::williams_video_counter_r),state));
535535   space->install_readwrite_handler(0xcc00, 0xcc03, 0, 0x03e0, read8_delegate(FUNC(pia6821_device::read), pia_1), write8_delegate(FUNC(pia6821_device::write), pia_1));
536536   space->install_readwrite_handler(0xcc04, 0xcc07, 0, 0x03e0, read8_delegate(FUNC(pia6821_device::read), pia_0), write8_delegate(FUNC(pia6821_device::write), pia_0));
537   memory_set_bankptr(space->machine(), "bank3", space->machine().driver_data<williams_state>()->m_nvram);
538   memory_set_bankptr(space->machine(), "bank4", space->machine().driver_data<williams_state>()->m_generic_paletteram_8);
537   state->membank("bank3")->set_base(space->machine().driver_data<williams_state>()->m_nvram);
538   state->membank("bank4")->set_base(space->machine().driver_data<williams_state>()->m_generic_paletteram_8);
539539}
540540
541541
r14976r14977
27302730static DRIVER_INIT( defndjeu )
27312731{
27322732   williams_state *state = machine.driver_data<williams_state>();
2733   UINT8 *rom = machine.region("maincpu")->base();
2733   UINT8 *rom = state->memregion("maincpu")->base();
27342734   int i;
27352735
27362736   CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
src/mame/drivers/dec8.c
r14976r14977
443443
444444WRITE8_MEMBER(dec8_state::dec8_bank_w)
445445{
446   memory_set_bank(machine(), "bank1", data & 0x0f);
446   membank("bank1")->set_entry(data & 0x0f);
447447}
448448
449449/* Used by Ghostbusters, Meikyuu Hunter G & Gondomania */
r14976r14977
457457       Bits 4-7: Bank switch
458458    */
459459
460   memory_set_bank(machine(), "bank1", data >> 4);
460   membank("bank1")->set_entry(data >> 4);
461461
462462   if ((data&1)==0) device_set_input_line(m_maincpu, M6809_IRQ_LINE, CLEAR_LINE);
463463   if (data & 2) m_nmi_enable =1; else m_nmi_enable = 0;
r14976r14977
473473        Bit 0x40 - Unused.
474474        Bit 0x80 - Hold subcpu reset line high if clear, else low?  (Not needed anyway)
475475    */
476   memory_set_bank(machine(), "bank1", data & 0x0f);
476   membank("bank1")->set_entry(data & 0x0f);
477477}
478478
479479WRITE8_MEMBER(dec8_state::dec8_sound_w)
r14976r14977
506506
507507WRITE8_MEMBER(dec8_state::csilver_sound_bank_w)
508508{
509   memory_set_bank(machine(), "bank3", (data & 0x08) >> 3);
509   membank("bank3")->set_entry((data & 0x08) >> 3);
510510}
511511
512512/******************************************************************************/
r14976r14977
35483548   UINT8 *rom;
35493549
35503550   /* bits 5 and 6 of the opcodes are swapped */
3551   rom = machine.region("audiocpu")->base();
3551   rom = state->memregion("audiocpu")->base();
35523552   decrypt = auto_alloc_array(machine, UINT8, 0x8000);
35533553
35543554   space->set_decrypted_region(0x8000, 0xffff, decrypt);
r14976r14977
35623562/* Below, I set up the correct number of banks depending on the "maincpu" region size */
35633563static DRIVER_INIT( lastmisn )
35643564{
3565   UINT8 *ROM = machine.region("maincpu")->base();
3566   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
3565   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3566   machine.root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
35673567   DRIVER_INIT_CALL( dec8 );
35683568}
35693569
35703570static DRIVER_INIT( shackled )
35713571{
3572   UINT8 *ROM = machine.region("maincpu")->base();
3573   memory_configure_bank(machine, "bank1", 0, 14, &ROM[0x10000], 0x4000);
3572   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3573   machine.root_device().membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
35743574   DRIVER_INIT_CALL( dec8 );
35753575}
35763576
35773577static DRIVER_INIT( gondo )
35783578{
3579   UINT8 *ROM = machine.region("maincpu")->base();
3580   memory_configure_bank(machine, "bank1", 0, 12, &ROM[0x10000], 0x4000);
3579   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3580   machine.root_device().membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x4000);
35813581   DRIVER_INIT_CALL( dec8 );
35823582}
35833583
35843584static DRIVER_INIT( garyoret )
35853585{
3586   UINT8 *ROM = machine.region("maincpu")->base();
3587   memory_configure_bank(machine, "bank1", 0, 16, &ROM[0x10000], 0x4000);
3586   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3587   machine.root_device().membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x4000);
35883588   DRIVER_INIT_CALL( dec8 );
35893589}
35903590
35913591static DRIVER_INIT( ghostb )
35923592{
3593   UINT8 *ROM = machine.region("maincpu")->base();
3594   UINT8 *RAM = machine.region("proms")->base();
3593   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3594   UINT8 *RAM = machine.root_device().memregion("proms")->base();
35953595
35963596   /* Blank out unused garbage in colour prom to avoid colour overflow */
35973597   memset(RAM + 0x20, 0, 0xe0);
35983598
3599   memory_configure_bank(machine, "bank1", 0, 16, &ROM[0x10000], 0x4000);
3599   machine.root_device().membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x4000);
36003600   DRIVER_INIT_CALL(deco222);
36013601}
36023602
36033603static DRIVER_INIT( meikyuh )
36043604{
3605   UINT8 *ROM = machine.region("maincpu")->base();
3606   UINT8 *RAM = machine.region("proms")->base();
3605   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3606   UINT8 *RAM = machine.root_device().memregion("proms")->base();
36073607
36083608   /* Blank out unused garbage in colour prom to avoid colour overflow */
36093609   memset(RAM + 0x20, 0, 0xe0);
36103610
3611   memory_configure_bank(machine, "bank1", 0, 12, &ROM[0x10000], 0x4000);
3611   machine.root_device().membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x4000);
36123612   DRIVER_INIT_CALL( dec8 );
36133613}
36143614
36153615static DRIVER_INIT( csilver )
36163616{
3617   UINT8 *ROM = machine.region("maincpu")->base();
3618   UINT8 *RAM = machine.region("audiocpu")->base();
3617   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3618   UINT8 *RAM = machine.root_device().memregion("audiocpu")->base();
36193619
3620   memory_configure_bank(machine, "bank1", 0, 14, &ROM[0x10000], 0x4000);
3621   memory_configure_bank(machine, "bank3", 0, 2, &RAM[0x10000], 0x4000);
3620   machine.root_device().membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
3621   machine.root_device().membank("bank3")->configure_entries(0, 2, &RAM[0x10000], 0x4000);
36223622   DRIVER_INIT_CALL( dec8 );
36233623}
36243624
36253625static DRIVER_INIT( oscar )
36263626{
3627   UINT8 *ROM = machine.region("maincpu")->base();
3628   memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
3627   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3628   machine.root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
36293629   DRIVER_INIT_CALL( deco222 );
36303630}
36313631
36323632static DRIVER_INIT( srdarwin )
36333633{
3634   UINT8 *ROM = machine.region("maincpu")->base();
3635   memory_configure_bank(machine, "bank1", 0, 6, &ROM[0x10000], 0x4000);
3634   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3635   machine.root_device().membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
36363636   DRIVER_INIT_CALL( deco222 );
36373637}
36383638
36393639static DRIVER_INIT( cobracom )
36403640{
3641   UINT8 *ROM = machine.region("maincpu")->base();
3642   memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
3641   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
3642   machine.root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
36433643   DRIVER_INIT_CALL( dec8 );
36443644}
36453645
src/mame/drivers/fuukifg3.c
r14976r14977
267267
268268WRITE8_MEMBER(fuuki32_state::fuuki32_sound_bw_w)
269269{
270   memory_set_bank(machine(), "bank1", data);
270   membank("bank1")->set_entry(data);
271271}
272272
273273READ8_MEMBER(fuuki32_state::snd_z80_r)
r14976r14977
550550static MACHINE_START( fuuki32 )
551551{
552552   fuuki32_state *state = machine.driver_data<fuuki32_state>();
553   UINT8 *ROM = machine.region("soundcpu")->base();
553   UINT8 *ROM = state->memregion("soundcpu")->base();
554554
555   memory_configure_bank(machine, "bank1", 0, 0x10, &ROM[0x10000], 0x8000);
555   state->membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
556556
557557   state->m_maincpu = machine.device("maincpu");
558558   state->m_audiocpu = machine.device("soundcpu");
src/mame/drivers/slotcarn.c
r14976r14977
112112   UINT16 x = 0;
113113   int rlen;
114114
115   gfx[0] = device->machine().region("gfx1")->base();
116   gfx[1] = device->machine().region("gfx2")->base();
117   rlen = device->machine().region("gfx2")->bytes();
115   gfx[0] = device->machine().root_device().memregion("gfx1")->base();
116   gfx[1] = device->machine().root_device().memregion("gfx2")->base();
117   rlen = state->memregion("gfx2")->bytes();
118118
119119   //ma = ma ^ 0x7ff;
120120   for (cx = 0; cx < x_count; cx++)
src/mame/drivers/tbowl.c
r14976r14977
3434WRITE8_MEMBER(tbowl_state::tbowlb_bankswitch_w)
3535{
3636   int bankaddress;
37   UINT8 *RAM = machine().region("maincpu")->base();
37   UINT8 *RAM = memregion("maincpu")->base();
3838
3939
4040   bankaddress = 0x10000 + ((data & 0xf8) << 8);
41   memory_set_bankptr(machine(), "bank1",&RAM[bankaddress]);
41   membank("bank1")->set_base(&RAM[bankaddress]);
4242}
4343
4444WRITE8_MEMBER(tbowl_state::tbowlc_bankswitch_w)
4545{
4646   int bankaddress;
47   UINT8 *RAM = machine().region("sub")->base();
47   UINT8 *RAM = memregion("sub")->base();
4848
4949
5050   bankaddress = 0x10000 + ((data & 0xf8) << 8);
5151
5252
53   memory_set_bankptr(machine(), "bank2", &RAM[bankaddress]);
53   membank("bank2")->set_base(&RAM[bankaddress]);
5454}
5555
5656/*** Shared Ram Handlers
r14976r14977
166166   tbowl_state *state = device->machine().driver_data<tbowl_state>();
167167   int num = (strcmp(device->tag(), ":msm1") == 0) ? 0 : 1;
168168   if (state->m_adpcm_pos[num] >= state->m_adpcm_end[num] ||
169            state->m_adpcm_pos[num] >= device->machine().region("adpcm")->bytes()/2)
169            state->m_adpcm_pos[num] >= state->memregion("adpcm")->bytes()/2)
170170      msm5205_reset_w(device,1);
171171   else if (state->m_adpcm_data[num] != -1)
172172   {
r14976r14977
175175   }
176176   else
177177   {
178      UINT8 *ROM = device->machine().region("adpcm")->base() + 0x10000 * num;
178      UINT8 *ROM = device->machine().root_device().memregion("adpcm")->base() + 0x10000 * num;
179179
180180      state->m_adpcm_data[num] = ROM[state->m_adpcm_pos[num]++];
181181      msm5205_data_w(device,state->m_adpcm_data[num] >> 4);
src/mame/drivers/rabbit.c
r14976r14977
520520/* rom bank is used when testing roms, not currently hooked up */
521521WRITE32_MEMBER(rabbit_state::rabbit_rombank_w)
522522{
523   UINT8 *dataroms = machine().region("gfx1")->base();
523   UINT8 *dataroms = memregion("gfx1")->base();
524524#if 0
525525   int bank;
526526   printf("rabbit rombank %08x\n",data);
527527   bank = data & 0x3ff;
528528
529   memory_set_bankptr(machine(), "bank1",&dataroms[0x40000*(bank&0x3ff)]);
529   membank("bank1")->set_base(&dataroms[0x40000*(bank&0x3ff)]);
530530#else
531   memory_set_bankptr(machine(), "bank1",&dataroms[0]);
531   membank("bank1")->set_base(&dataroms[0]);
532532#endif
533533
534534}
r14976r14977
546546static void rabbit_do_blit(running_machine &machine)
547547{
548548   rabbit_state *state = machine.driver_data<rabbit_state>();
549   UINT8 *blt_data = machine.region("gfx1")->base();
549   UINT8 *blt_data = state->memregion("gfx1")->base();
550550   int blt_source = (state->m_blitterregs[0]&0x000fffff)>>0;
551551   int blt_column = (state->m_blitterregs[1]&0x00ff0000)>>16;
552552   int blt_line   = (state->m_blitterregs[1]&0x000000ff);
src/mame/drivers/crimfght.c
r14976r14977
255255static MACHINE_START( crimfght )
256256{
257257   crimfght_state *state = machine.driver_data<crimfght_state>();
258   UINT8 *ROM = machine.region("maincpu")->base();
258   UINT8 *ROM = state->memregion("maincpu")->base();
259259
260   memory_configure_bank(machine, "bank2", 0, 12, &ROM[0x10000], 0x2000);
261   memory_set_bank(machine, "bank2", 0);
260   state->membank("bank2")->configure_entries(0, 12, &ROM[0x10000], 0x2000);
261   state->membank("bank2")->set_entry(0);
262262
263263   state->m_maincpu = machine.device("maincpu");
264264   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
408408   {
409409      device->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x03ff, "bank3");
410410      device->memory().space(AS_PROGRAM)->install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(crimfght_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state));
411      memory_set_bankptr(device->machine(), "bank3", state->m_generic_paletteram_8);
411      state->membank("bank3")->set_base(state->m_generic_paletteram_8);
412412   }
413413   else
414414      device->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, 0x03ff, "bank1");                        /* RAM */
r14976r14977
416416   /* bit 6 = enable char ROM reading through the video RAM */
417417   k052109_set_rmrd_line(state->m_k052109, (lines & 0x40) ? ASSERT_LINE : CLEAR_LINE);
418418
419   memory_set_bank(device->machine(), "bank2", lines & 0x0f);
419   state->membank("bank2")->set_entry(lines & 0x0f);
420420}
421421
422422GAME( 1989, crimfght,  0,        crimfght, crimfght, 0, ROT0, "Konami", "Crime Fighters (US 4 players)", GAME_SUPPORTS_SAVE )
src/mame/drivers/asuka.c
r14976r14977
249249
250250WRITE8_MEMBER(asuka_state::sound_bankswitch_w)
251251{
252   memory_set_bank(machine(), "bank1", data & 0x03);
252   membank("bank1")->set_entry(data & 0x03);
253253}
254254
255255static WRITE8_DEVICE_HANDLER( sound_bankswitch_2151_w )
256256{
257   memory_set_bank(device->machine(),  "bank1", data & 0x03);
257   device->machine().root_device().membank("bank1")->set_entry(data & 0x03);
258258}
259259
260260
r14976r14977
270270   }
271271   else
272272   {
273      state->m_adpcm_data = device->machine().region("ymsnd")->base()[state->m_adpcm_pos];
273      state->m_adpcm_data = device->machine().root_device().memregion("ymsnd")->base()[state->m_adpcm_pos];
274274      state->m_adpcm_pos = (state->m_adpcm_pos + 1) & 0xffff;
275275      msm5205_data_w(device, state->m_adpcm_data >> 4);
276276   }
r14976r14977
842842   state->m_tc0100scn = machine.device("tc0100scn");
843843
844844   /* configure the banks */
845   memory_configure_bank(machine, "bank1", 0, 1, machine.region("audiocpu")->base(), 0);
846   memory_configure_bank(machine, "bank1", 1, 3, machine.region("audiocpu")->base() + 0x10000, 0x04000);
845   state->membank("bank1")->configure_entry(0, machine.root_device().memregion("audiocpu")->base());
846   state->membank("bank1")->configure_entries(1, 3, state->memregion("audiocpu")->base() + 0x10000, 0x04000);
847847
848848   state->save_item(NAME(state->m_adpcm_pos));
849849   state->save_item(NAME(state->m_adpcm_data));
src/mame/drivers/rollerg.c
r14976r14977
249249static MACHINE_START( rollerg )
250250{
251251   rollerg_state *state = machine.driver_data<rollerg_state>();
252   UINT8 *ROM = machine.region("maincpu")->base();
252   UINT8 *ROM = state->memregion("maincpu")->base();
253253
254   memory_configure_bank(machine, "bank1", 0, 6, &ROM[0x10000], 0x4000);
255   memory_configure_bank(machine, "bank1", 6, 2, &ROM[0x10000], 0x4000);
256   memory_set_bank(machine, "bank1", 0);
254   state->membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
255   state->membank("bank1")->configure_entries(6, 2, &ROM[0x10000], 0x4000);
256   state->membank("bank1")->set_entry(0);
257257
258258   state->m_maincpu = machine.device("maincpu");
259259   state->m_audiocpu = machine.device("audiocpu");
r14976r14977
372372
373373static KONAMI_SETLINES_CALLBACK( rollerg_banking )
374374{
375   memory_set_bank(device->machine(), "bank1", lines & 0x07);
375   device->machine().root_device().membank("bank1")->set_entry(lines & 0x07);
376376}
377377
378378
src/mame/drivers/hvyunit.c
r14976r14977
216216
217217WRITE8_MEMBER(hvyunit_state::master_bankswitch_w)
218218{
219   unsigned char *ROM = machine().region("master")->base();
219   unsigned char *ROM = memregion("master")->base();
220220   int bank = data & 7;
221221   ROM = &ROM[0x4000 * bank];
222   memory_set_bankptr(machine(), "bank1", ROM);
222   membank("bank1")->set_base(ROM);
223223}
224224
225225WRITE8_MEMBER(hvyunit_state::mermaid_data_w)
r14976r14977
275275WRITE8_MEMBER(hvyunit_state::slave_bankswitch_w)
276276{
277277
278   unsigned char *ROM = machine().region("slave")->base();
278   unsigned char *ROM = memregion("slave")->base();
279279   int bank = (data & 0x03);
280280   m_port0_data = data;
281281   ROM = &ROM[0x4000 * bank];
282282
283   memory_set_bankptr(machine(), "bank2", ROM);
283   membank("bank2")->set_base(ROM);
284284}
285285
286286WRITE8_MEMBER(hvyunit_state::hu_scrollx_w)
r14976r14977
308308
309309WRITE8_MEMBER(hvyunit_state::sound_bankswitch_w)
310310{
311   unsigned char *ROM = machine().region("soundcpu")->base();
311   unsigned char *ROM = memregion("soundcpu")->base();
312312   int bank = data & 0x3;
313313   ROM = &ROM[0x4000 * bank];
314314
315   memory_set_bankptr(machine(), "bank3", ROM);
315   membank("bank3")->set_base(ROM);
316316}
317317
318318
src/mame/drivers/pirates.c
r14976r14977
342342    UINT16 *buf, *rom;
343343    int i;
344344
345    rom_size = machine.region("maincpu")->bytes();
345    rom_size = machine.root_device().memregion("maincpu")->bytes();
346346
347347    buf = auto_alloc_array(machine, UINT16, rom_size/2);
348348
349    rom = (UINT16 *)machine.region("maincpu")->base();
349    rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
350350    memcpy (buf, rom, rom_size);
351351
352352    for (i=0; i<rom_size/2; i++)
r14976r14977
371371    UINT8 *buf, *rom;
372372    int i;
373373
374    rom_size = machine.region("gfx1")->bytes();
374    rom_size = machine.root_device().memregion("gfx1")->bytes();
375375
376376    buf = auto_alloc_array(machine, UINT8, rom_size);
377377
378    rom = machine.region("gfx1")->base();
378    rom = machine.root_device().memregion("gfx1")->base();
379379    memcpy (buf, rom, rom_size);
380380
381381    for (i=0; i<rom_size/4; i++)
r14976r14977
395395    UINT8 *buf, *rom;
396396    int i;
397397
398    rom_size = machine.region("gfx2")->bytes();
398    rom_size = machine.root_device().memregion("gfx2")->bytes();
399399
400400    buf = auto_alloc_array(machine, UINT8, rom_size);
401401
402    rom = machine.region("gfx2")->base();
402    rom = machine.root_device().memregion("gfx2")->base();
403403    memcpy (buf, rom, rom_size);
404404
405405    for (i=0; i<rom_size/4; i++)
r14976r14977
420420    UINT8 *buf, *rom;
421421    int i;
422422
423    rom_size = machine.region("oki")->bytes();
423    rom_size = machine.root_device().memregion("oki")->bytes();
424424
425425    buf = auto_alloc_array(machine, UINT8, rom_size);
426426
427    rom = machine.region("oki")->base();
427    rom = machine.root_device().memregion("oki")->base();
428428    memcpy (buf, rom, rom_size);
429429
430430    for (i=0; i<rom_size; i++)
r14976r14977
438438
439439static DRIVER_INIT( pirates )
440440{
441   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
441   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
442442
443443   pirates_decrypt_68k(machine);
444444   pirates_decrypt_p(machine);
src/mame/drivers/royalmah.c
r14976r14977
196196static PALETTE_INIT( royalmah )
197197{
198198   offs_t i;
199   const UINT8 *prom = machine.region("proms")->base();
200   int len = machine.region("proms")->bytes();
199   const UINT8 *prom = machine.root_device().memregion("proms")->base();
200   int len = machine.root_device().memregion("proms")->bytes();
201201
202202   for (i = 0; i < len; i++)
203203   {
r14976r14977
231231static PALETTE_INIT( mjderngr )
232232{
233233   offs_t i;
234   const UINT8 *prom = machine.region("proms")->base();
235   int len = machine.region("proms")->bytes();
234   const UINT8 *prom = machine.root_device().memregion("proms")->base();
235   int len = machine.root_device().memregion("proms")->bytes();
236236
237237   for (i = 0; i < len / 2; i++)
238238   {
r14976r14977
386386
387387WRITE8_MEMBER(royalmah_state::suzume_bank_w)
388388{
389   UINT8 *rom = machine().region("maincpu")->base();
389   UINT8 *rom = memregion("maincpu")->base();
390390   int address;
391391
392392   m_suzume_bank = data;
r14976r14977
396396   /* bits 6, 4 and 3 used for something input related? */
397397
398398   address = 0x10000 + (data & 0x07) * 0x8000;
399   memory_set_bankptr(machine(), "bank1",&rom[address]);
399   membank("bank1")->set_base(&rom[address]);
400400}
401401
402402
403403WRITE8_MEMBER(royalmah_state::mjapinky_bank_w)
404404{
405   UINT8 *ROM = machine().region("maincpu")->base();
405   UINT8 *ROM = memregion("maincpu")->base();
406406   m_rombank = data;
407   memory_set_bankptr(machine(), "bank1",ROM + 0x10000 + 0x8000 * data);
407   membank("bank1")->set_base(ROM + 0x10000 + 0x8000 * data);
408408}
409409
410410WRITE8_MEMBER(royalmah_state::mjapinky_palbank_w)
r14976r14977
418418READ8_MEMBER(royalmah_state::mjapinky_dsw_r)
419419{
420420   if (m_rombank == 0x0e)   return input_port_read(machine(), "DSW3");
421   else               return *(machine().region("maincpu")->base() + 0x10000 + 0x8000 * m_rombank);
421   else               return *(machine().root_device().memregion("maincpu")->base() + 0x10000 + 0x8000 * m_rombank);
422422}
423423
424424WRITE8_MEMBER(royalmah_state::tontonb_bank_w)
425425{
426   UINT8 *rom = machine().region("maincpu")->base();
426   UINT8 *rom = memregion("maincpu")->base();
427427   int address;
428428
429429logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data);
r14976r14977
434434
435435   address = 0x10000 + data * 0x8000;
436436
437   memory_set_bankptr(machine(), "bank1",&rom[address]);
437   membank("bank1")->set_base(&rom[address]);
438438}
439439
440440
441441/* bits 5 and 6 seem to affect which Dip Switch to read in 'majs101b' */
442442WRITE8_MEMBER(royalmah_state::dynax_bank_w)
443443{
444   UINT8 *rom = machine().region("maincpu")->base();
444   UINT8 *rom = memregion("maincpu")->base();
445445   int address;
446446
447447//logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data);
r14976r14977
452452
453453   address = 0x10000 + data * 0x8000;
454454
455   memory_set_bankptr(machine(), "bank1",&rom[address]);
455   membank("bank1")->set_base(&rom[address]);
456456}
457457
458458READ8_MEMBER(royalmah_state::daisyari_dsw_r)
r14976r14977
470470
471471WRITE8_MEMBER(royalmah_state::daisyari_bank_w)
472472{
473   UINT8 *rom = machine().region("maincpu")->base();
473   UINT8 *rom = memregion("maincpu")->base();
474474   int address;
475475
476476   m_dsw_select = (data & 0xc);
r14976r14977
478478   address = 0x10000 + ((data & 0x30)>>4) * 0x10000 + (data & 0x1) * 0x8000;
479479//  printf("%08x %02x\n",address,data);
480480
481   memory_set_bankptr(machine(), "bank1",&rom[address]);
481   membank("bank1")->set_base(&rom[address]);
482482
483483   /* bit 1 used too but unknown purpose. */
484484}
r14976r14977
498498
499499WRITE8_MEMBER(royalmah_state::mjclub_bank_w)
500500{
501   UINT8 *rom = machine().region("maincpu")->base();
501   UINT8 *rom = memregion("maincpu")->base();
502502   int address;
503503
504504   m_dsw_select = data & 0xc0;
r14976r14977
508508   address = 0x10000 + data * 0x8000;
509509//  printf("%08x\n",address);
510510
511   memory_set_bankptr(machine(), "bank1",&rom[address]);
511   membank("bank1")->set_base(&rom[address]);
512512
513513   /* bit 5 used too but unknown purpose. */
514514}
r14976r14977
727727
728728READ8_MEMBER(royalmah_state::jansou_6403_r)
729729{
730   UINT8 *GFXROM = machine().region("gfx1")->base();
730   UINT8 *GFXROM = memregion("gfx1")->base();
731731   int d0 = GFXROM[m_gfx_adr];
732732   int d1 = GFXROM[m_gfx_adr+1];
733733   int c0 = m_jansou_colortable[d1 & 0x0f] & 0x0f;
r14976r14977
828828
829829WRITE8_MEMBER(royalmah_state::janptr96_rombank_w)
830830{
831   UINT8 *ROM = machine().region("maincpu")->base();
832   memory_set_bankptr(machine(), "bank1",ROM + 0x10000 + 0x8000 * data);
831   UINT8 *ROM = memregion("maincpu")->base();
832   membank("bank1")->set_base(ROM + 0x10000 + 0x8000 * data);
833833}
834834
835835WRITE8_MEMBER(royalmah_state::janptr96_rambank_w)
836836{
837   memory_set_bankptr(machine(), "bank2", m_janptr96_nvram + 0x1000 + 0x1000 * data);
837   membank("bank2")->set_base(m_janptr96_nvram + 0x1000 + 0x1000 * data);
838838}
839839
840840READ8_MEMBER(royalmah_state::janptr96_unknown_r)
r14976r14977
880880READ8_MEMBER(royalmah_state::mjifb_rom_io_r)
881881{
882882   if (m_mjifb_rom_enable)
883      return ((UINT8*)(machine().region("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
883      return ((UINT8*)(machine().root_device().memregion("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
884884
885885   offset += 0x8000;
886886
r14976r14977
989989READ8_MEMBER(royalmah_state::mjdejavu_rom_io_r)
990990{
991991   if (m_mjifb_rom_enable)
992      return ((UINT8*)(machine().region("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
992      return ((UINT8*)(machine().root_device().memregion("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
993993
994994   offset += 0x8000;
995995
r14976r14977
10501050static void mjtensin_update_rombank(running_machine &machine)
10511051{
10521052   royalmah_state *state = machine.driver_data<royalmah_state>();
1053   memory_set_bankptr(machine,  "bank1", machine.region("maincpu")->base() + 0x10000 + state->m_rombank * 0x8000 );
1053   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x10000 + state->m_rombank * 0x8000 );
10541054}
10551055WRITE8_MEMBER(royalmah_state::mjtensin_p4_w)
10561056{
r14976r14977
10921092static void cafetime_update_rombank(running_machine &machine)
10931093{
10941094   royalmah_state *state = machine.driver_data<royalmah_state>();
1095   memory_set_bankptr(machine,  "bank1", machine.region("maincpu")->base() + 0x10000 + state->m_rombank * 0x8000 );
1095   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x10000 + state->m_rombank * 0x8000 );
10961096}
10971097WRITE8_MEMBER(royalmah_state::cafetime_p4_w)
10981098{
r14976r14977
11771177READ8_MEMBER(royalmah_state::mjvegasa_rom_io_r)
11781178{
11791179   if ((m_rombank & 0x70) != 0x70)
1180      return machine().region("maincpu")->base()[0x10000 + m_rombank * 0x8000 + offset];
1180      return memregion("maincpu")->base()[0x10000 + m_rombank * 0x8000 + offset];
11811181
11821182   offset += 0x8000;
11831183
r14976r14977
47104710ROM_END
47114711
47124712
4713static DRIVER_INIT( ippatsu )   {   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x8000 );   }
4713static DRIVER_INIT( ippatsu )   {   machine.root_device().membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x8000 );   }
47144714
47154715static DRIVER_INIT( janptr96 )
47164716{
47174717   royalmah_state *state = machine.driver_data<royalmah_state>();
47184718   state->m_janptr96_nvram = auto_alloc_array(machine, UINT8, 0x1000 * 9);
4719   memory_set_bankptr(machine, "bank3", state->m_janptr96_nvram);
4719   state->membank("bank3")->set_base(state->m_janptr96_nvram);
47204720   machine.device<nvram_device>("nvram")->set_base(state->m_janptr96_nvram, 0x1000 * 9);
47214721}
47224722
src/mame/drivers/crospang.c
r14976r14977
562562
563563static void tumblepb_gfx1_rearrange(running_machine &machine)
564564{
565   UINT8 *rom = machine.region("gfx1")->base();
566   int len = machine.region("gfx1")->bytes();
565   UINT8 *rom = machine.root_device().memregion("gfx1")->base();
566   int len = machine.root_device().memregion("gfx1")->bytes();
567567   int i;
568568
569569   /* gfx data is in the wrong order */
src/mame/drivers/darkmist.c
r14976r14977
3232WRITE8_MEMBER(darkmist_state::darkmist_hw_w)
3333{
3434   m_hw=data;
35   memory_set_bankptr(machine(), "bank1",&machine().region("maincpu")->base()[0x010000+((data&0x80)?0x4000:0)]);
35   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x010000+((data&0x80)?0x4000:0)]);
3636}
3737
3838static ADDRESS_MAP_START( memmap, AS_PROGRAM, 8, darkmist_state )
r14976r14977
320320   int size;
321321   int i;
322322
323   rom = machine.region("gfx1")->base();
324   size = machine.region("gfx1")->bytes();
323   rom = machine.root_device().memregion("gfx1")->base();
324   size = machine.root_device().memregion("gfx1")->bytes();
325325
326326   /* data lines */
327327   for (i = 0;i < size/2;i++)
r14976r14977
343343   }
344344
345345
346   rom = machine.region("gfx2")->base();
347   size = machine.region("gfx2")->bytes();
346   rom = machine.root_device().memregion("gfx2")->base();
347   size = machine.root_device().memregion("gfx2")->bytes();
348348
349349   /* data lines */
350350   for (i = 0;i < size/2;i++)
r14976r14977
366366   }
367367
368368
369   rom = machine.region("gfx3")->base();
370   size = machine.region("gfx3")->bytes();
369   rom = machine.root_device().memregion("gfx3")->base();
370   size = machine.root_device().memregion("gfx3")->bytes();
371371
372372   /* data lines */
373373   for (i = 0;i < size/2;i++)
r14976r14977
394394static void decrypt_snd(running_machine &machine)
395395{
396396   int i;
397   UINT8 *ROM = machine.region("t5182")->base();
397   UINT8 *ROM = machine.root_device().memregion("t5182")->base();
398398
399399   for(i=0x8000;i<0x10000;i++)
400400      ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0);
r14976r14977
404404{
405405   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
406406   int i, len;
407   UINT8 *ROM = machine.region("maincpu")->base();
407   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
408408   UINT8 *buffer = auto_alloc_array(machine, UINT8, 0x10000);
409409   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
410410
r14976r14977
437437   }
438438
439439   space->set_decrypted_region(0x0000, 0x7fff, decrypt);
440   memory_set_bankptr(space->machine(), "bank1",&ROM[0x010000]);
440   space->machine().root_device().membank("bank1")->set_base(&ROM[0x010000]);
441441
442442   /* adr line swaps */
443   ROM = machine.region("user1")->base();
444   len = machine.region("user1")->bytes();
443   ROM = machine.root_device().memregion("user1")->base();
444   len = machine.root_device().memregion("user1")->bytes();
445445   memcpy( buffer, ROM, len );
446446
447447   for(i=0;i<len;i++)
r14976r14977
449449      ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,6,5,4,3,2,14,13,12,11,8,7,1,0,10,9)];
450450   }
451451
452   ROM = machine.region("user2")->base();
453   len = machine.region("user2")->bytes();
452   ROM = machine.root_device().memregion("user2")->base();
453   len = machine.root_device().memregion("user2")->bytes();
454454   memcpy( buffer, ROM, len );
455455   for(i=0;i<len;i++)
456456   {
457457      ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,6,5,4,3,2,14,13,12,11,8,7,1,0,10,9)];
458458   }
459459
460   ROM = machine.region("user3")->base();
461   len = machine.region("user3")->bytes();
460   ROM = machine.root_device().memregion("user3")->base();
461   len = machine.root_device().memregion("user3")->bytes();
462462   memcpy( buffer, ROM, len );
463463   for(i=0;i<len;i++)
464464   {
465465      ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14 ,5,4,3,2,11,10,9,8,13,12,1,0,7,6)];
466466   }
467467
468   ROM = machine.region("user4")->base();
469   len = machine.region("user4")->bytes();
468   ROM = machine.root_device().memregion("user4")->base();
469   len = machine.root_device().memregion("user4")->bytes();
470470   memcpy( buffer, ROM, len );
471471   for(i=0;i<len;i++)
472472   {
src/mame/drivers/mquake.c
r14976r14977
3535static WRITE8_DEVICE_HANDLER( mquake_cia_0_porta_w )
3636{
3737   /* switch banks as appropriate */
38   memory_set_bank(device->machine(), "bank1", data & 1);
38   device->machine().root_device().membank("bank1")->set_entry(data & 1);
3939
4040   /* swap the write handlers between ROM and bank 1 based on the bit */
4141   if ((data & 1) == 0)
r14976r14977
8787
8888static READ8_HANDLER( es5503_sample_r )
8989{
90   UINT8 *rom = space->machine().region("es5503")->base();
90   UINT8 *rom = space->machine().root_device().memregion("es5503")->base();
9191   es5503_device *es5503 = space->machine().device<es5503_device>("es5503");
9292
9393   return rom[offset + (es5503->get_channel_strobe() * 0x10000)];
r14976r14977
444444   amiga_machine_config(machine, &mquake_intf);
445445
446446   /* set up memory */
447   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
448   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
447   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
448   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
449449}
450450
451451
src/mame/drivers/funybubl.c
r14976r14977
5656
5757WRITE8_MEMBER(funybubl_state::funybubl_vidram_bank_w)
5858{
59   memory_set_bank(machine(), "bank1", data & 1);
59   membank("bank1")->set_entry(data & 1);
6060}
6161
6262WRITE8_MEMBER(funybubl_state::funybubl_cpurombank_w)
6363{
64   memory_set_bank(machine(), "bank2", data & 0x3f);   // should we add a check that (data&0x3f) < #banks?
64   membank("bank2")->set_entry(data & 0x3f);   // should we add a check that (data&0x3f) < #banks?
6565}
6666
6767
r14976r14977
202202static MACHINE_START( funybubl )
203203{
204204   funybubl_state *state = machine.driver_data<funybubl_state>();
205   UINT8 *ROM = machine.region("maincpu")->base();
205   UINT8 *ROM = state->memregion("maincpu")->base();
206206
207207   state->m_audiocpu = machine.device("audiocpu");
208208
209209   state->save_item(NAME(state->m_banked_vram));
210210
211   memory_configure_bank(machine, "bank1", 0, 2, &state->m_banked_vram[0x0000], 0x1000);
212   memory_configure_bank(machine, "bank2", 0, 0x10, &ROM[0x10000], 0x4000);
211   state->membank("bank1")->configure_entries(0, 2, &state->m_banked_vram[0x0000], 0x1000);
212   state->membank("bank2")->configure_entries(0, 0x10, &ROM[0x10000], 0x4000);
213213
214   memory_set_bank(machine, "bank1", 0);
214   state->membank("bank1")->set_entry(0);
215215}
216216
217217
src/mame/drivers/nmk16.c
r14976r14977
214214
215215WRITE8_MEMBER(nmk16_state::ssmissin_soundbank_w)
216216{
217   UINT8 *rom = machine().region("oki1")->base();
217   UINT8 *rom = memregion("oki1")->base();
218218   int bank;
219219
220220   bank = data & 0x3;
r14976r14977
275275
276276WRITE8_MEMBER(nmk16_state::macross2_sound_bank_w)
277277{
278   UINT8 *rom = machine().region("audiocpu")->base() + 0x10000;
278   UINT8 *rom = memregion("audiocpu")->base() + 0x10000;
279279
280   memory_set_bankptr(machine(), "bank1",rom + (data & 0x07) * 0x4000);
280   membank("bank1")->set_base(rom + (data & 0x07) * 0x4000);
281281}
282282
283283WRITE8_MEMBER(nmk16_state::tharrier_oki6295_bankswitch_0_w)
284284{
285   UINT8 *rom = machine().region("oki1")->base();
285   UINT8 *rom = memregion("oki1")->base();
286286
287287   data &= 3;
288288   if (data != 3)
r14976r14977
291291
292292WRITE8_MEMBER(nmk16_state::tharrier_oki6295_bankswitch_1_w)
293293{
294   UINT8 *rom = machine().region("oki2")->base();
294   UINT8 *rom = memregion("oki2")->base();
295295
296296   data &= 3;
297297   if (data != 3)
r14976r14977
10671067
10681068WRITE8_MEMBER(nmk16_state::raphero_sound_rombank_w)
10691069{
1070   memory_set_bankptr(machine(), "bank1",machine().region("audiocpu")->base() + 0x10000 + (data & 0x07) * 0x4000);
1070   membank("bank1")->set_base(machine().root_device().memregion("audiocpu")->base() + 0x10000 + (data & 0x07) * 0x4000);
10711071}
10721072
10731073static ADDRESS_MAP_START( raphero_sound_mem_map, AS_PROGRAM, 8, nmk16_state )
r14976r14977
44064406
44074407
44084408   /* background */
4409   rom = machine.region("gfx2")->base();
4410   len = machine.region("gfx2")->bytes();
4409   rom = machine.root_device().memregion("gfx2")->base();
4410   len = machine.root_device().memregion("gfx2")->bytes();
44114411   for (A = 0;A < len;A++)
44124412   {
44134413      rom[A] = decode_byte( rom[A], decode_data_bg[bjtwin_address_map_bg0(A)]);
44144414   }
44154415
44164416   /* sprites */
4417   rom = machine.region("gfx3")->base();
4418   len = machine.region("gfx3")->bytes();
4417   rom = machine.root_device().memregion("gfx3")->base();
4418   len = machine.root_device().memregion("gfx3")->bytes();
44194419   for (A = 0;A < len;A += 2)
44204420   {
44214421      UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_sprite[bjtwin_address_map_sprites(A)]);
r14976r14977
44444444      {0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
44454445   };
44464446
4447   rom = machine.region("maincpu")->base();
4448   len = machine.region("maincpu")->bytes();
4447   rom = machine.root_device().memregion("maincpu")->base();
4448   len = machine.root_device().memregion("maincpu")->bytes();
44494449   for (A = 0;A < len;A += 2)
44504450   {
44514451      int h = A+NATIVE_ENDIAN_VALUE_LE_BE(1,0), l = A+NATIVE_ENDIAN_VALUE_LE_BE(0,1);
r14976r14977
44544454      rom[l] = tmp & 0xff;
44554455   }
44564456
4457   rom = machine.region("gfx2")->base();
4458   len = machine.region("gfx2")->bytes();
4457   rom = machine.root_device().memregion("gfx2")->base();
4458   len = machine.root_device().memregion("gfx2")->bytes();
44594459   for (A = 0;A < len;A++)
44604460   {
44614461      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
44624462   }
44634463
4464   rom = machine.region("gfx3")->base();
4465   len = machine.region("gfx3")->bytes();
4464   rom = machine.root_device().memregion("gfx3")->base();
4465   len = machine.root_device().memregion("gfx3")->bytes();
44664466   for (A = 0;A < len;A++)
44674467   {
44684468      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
r14976r14977
44814481      {0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
44824482   };
44834483
4484   rom = machine.region("gfx2")->base();
4485   len = machine.region("gfx2")->bytes();
4484   rom = machine.root_device().memregion("gfx2")->base();
4485   len = machine.root_device().memregion("gfx2")->bytes();
44864486   for (A = 0;A < len;A++)
44874487   {
44884488      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
44894489   }
44904490
4491   rom = machine.region("gfx3")->base();
4492   len = machine.region("gfx3")->bytes();
4491   rom = machine.root_device().memregion("gfx3")->base();
4492   len = machine.root_device().memregion("gfx3")->bytes();
44934493   for (A = 0;A < len;A++)
44944494   {
44954495      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
r14976r14977
45044504
45054505static DRIVER_INIT( hachamf )
45064506{
4507   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
4507   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
45084508
45094509   //rom[0x0006/2] = 0x7dc2;   /* replace reset vector with the "real" one */
45104510
r14976r14977
45154515
45164516static DRIVER_INIT( tdragonb )
45174517{
4518   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
4518   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
45194519
45204520   decode_tdragonb(machine);
45214521
r14976r14977
45264526
45274527static DRIVER_INIT( tdragon )
45284528{
4529   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
4529   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
45304530
45314531   //rom[0x94b0/2] = 0; /* Patch out JMP to shared memory (protection) */
45324532   //rom[0x94b2/2] = 0x92f4;
r14976r14977
45604560 *  008F7E: 207C 000F 9000           movea.l #$f9000, A0
45614561 */
45624562#if 0
4563   UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
4563   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
45644564   rom[0x09172/2] = 0x6006;    /* patch checksum error */
45654565   rom[0x08f74/2] = 0x4e71;
45664566#endif
r14976r14977
49744974   int a11, int a10, int a9, int a8, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0 )
49754975{
49764976   int i;
4977   UINT8 *RAM = machine.region( "maincpu" )->base();
4978   size_t  size = machine.region( "maincpu" )->bytes();
4977   UINT8 *RAM = machine.root_device().memregion( "maincpu" )->base();
4978   size_t  size = machine.root_device().memregion( "maincpu" )->bytes();
49794979   UINT8 *buffer = auto_alloc_array(machine, UINT8,  size );
49804980
49814981   memcpy( buffer, RAM, size );
src/mame/drivers/miniboy7.c
r14976r14977
219219
220220static PALETTE_INIT( miniboy7 )
221221{
222   const UINT8 *color_prom = machine.region("proms")->base();
222   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
223223/*  FIXME... Can't get the correct palette.
224224    sometimes RGB bits are inverted, disregarding the 4th bit.
225225
src/emu/debug/debugcpu.c
r14976r14977
12851285
12861286static UINT64 expression_read_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size)
12871287{
1288   const memory_region *region = machine.region(rgntag);
1288   memory_region *region = machine.root_device().memregion(rgntag);
12891289   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
12901290
12911291   /* make sure we get a valid base before proceeding */
r14976r14977
14621462static void expression_write_memory_region(running_machine &machine, const char *rgntag, offs_t address, int size, UINT64 data)
14631463{
14641464   debugcpu_private *global = machine.debugcpu_data;
1465   const memory_region *region = machine.region(rgntag);
1465   memory_region *region = machine.root_device().memregion(rgntag);
14661466
14671467   /* make sure we get a valid base before proceeding */
14681468   if (region != NULL)
r14976r14977
15711571      case EXPSPACE_REGION:
15721572         if (name == NULL)
15731573            return expression_error::MISSING_MEMORY_NAME;
1574         if (machine.region(name)->base() == NULL)
1574         if (machine.root_device().memregion(name)->base() == NULL)
15751575            return expression_error::INVALID_MEMORY_NAME;
15761576         break;
15771577
src/emu/debug/dvmemory.c
r14976r14977
8484{
8585}
8686
87debug_view_memory_source::debug_view_memory_source(const char *name, const memory_region &region)
87debug_view_memory_source::debug_view_memory_source(const char *name, memory_region &region)
8888   : debug_view_source(name),
8989     m_space(NULL),
9090     m_memintf(NULL),
r14976r14977
165165      }
166166
167167   // then add all the memory regions
168   for (const memory_region *region = machine().first_region(); region != NULL; region = region->next())
168   for (memory_region *region = machine().memory().first_region(); region != NULL; region = region->next())
169169   {
170170      name.printf("Region '%s'", region->name());
171171      m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *region)));
r14976r14977
707707
708708// hack for FD1094 editing
709709#ifdef FD1094_HACK
710   if (source.m_base == machine().region("user2"))
710   if (source.m_base == machine().root_device().memregion("user2"))
711711   {
712712      extern void fd1094_regenerate_key(running_machine &machine);
713713      fd1094_regenerate_key(machine());
src/emu/debug/dvmemory.h
r14976r14977
5353   friend class debug_view_memory;
5454
5555   debug_view_memory_source(const char *name, address_space &space);
56   debug_view_memory_source(const char *name, const memory_region &region);
56   debug_view_memory_source(const char *name, memory_region &region);
5757   debug_view_memory_source(const char *name, void *base, int element_size, int num_elements);
5858
5959public:
src/emu/cpu/cubeqcpu/cubeqcpu.c
r14976r14977
279279   memset(cpustate, 0, sizeof(*cpustate));
280280
281281   cpustate->dac_w = _config->dac_w;
282   cpustate->sound_data = (UINT16*)device->machine().region(_config->sound_data_region)->base();
282   cpustate->sound_data = (UINT16*)device->machine().root_device().memregion(_config->sound_data_region)->base();
283283
284284   cpustate->device = device;
285285   cpustate->program = device->space(AS_PROGRAM);
src/emu/cpu/esrip/esrip.c
r14976r14977
256256   /* Register configuration structure callbacks */
257257   cpustate->fdt_r = _config->fdt_r;
258258   cpustate->fdt_w = _config->fdt_w;
259   cpustate->lbrm = (UINT8*)device->machine().region(_config->lbrm_prom)->base();
259   cpustate->lbrm = (UINT8*)device->machine().root_device().memregion(_config->lbrm_prom)->base();
260260   cpustate->status_in = _config->status_in;
261261   cpustate->draw = _config->draw;
262262
src/emu/cpu/mb86233/mb86233.c
r14976r14977
119119   {
120120      cpustate->fifo_read_cb = _config->fifo_read_cb;
121121      cpustate->fifo_write_cb = _config->fifo_write_cb;
122      cpustate->Tables = (UINT32*) device->machine().region(_config->tablergn)->base();
122      cpustate->Tables = (UINT32*) device->machine().root_device().memregion(_config->tablergn)->base();
123123   }
124124
125125   cpustate->RAM = auto_alloc_array(device->machine(), UINT32, 2 * 0x200);      /* 2x 2KB */
src/emu/video/pc_cga.c
r14976r14977
292292   memset(&cga, 0, sizeof(cga));
293293   cga.update_row = NULL;
294294
295   cga.chr_gen = machine.region( "gfx1" )->base() + 0x1000;
295   cga.chr_gen = machine.root_device().memregion( "gfx1" )->base() + 0x1000;
296296
297297   state_save_register_item(machine, "pccga", NULL, 0, cga.mode_control);
298298   state_save_register_item(machine, "pccga", NULL, 0, cga.color_select);
r14976r14977
340340   cga.videoram = auto_alloc_array(machine, UINT8, 0x4000);
341341   cga.is_superimpose = 0;
342342
343   memory_set_bankptr(machine,"bank11", cga.videoram);
343   machine.root_device().membank("bank11")->set_base(cga.videoram);
344344}
345345
346346
r14976r14977
381381   cga.videoram = auto_alloc_array(machine, UINT8, 0x8000);
382382   cga.is_superimpose = 0;
383383
384   memory_set_bankptr(machine,"bank11", cga.videoram);
384   machine.root_device().membank("bank11")->set_base(cga.videoram);
385385}
386386
387387SCREEN_UPDATE_RGB32( mc6845_cga )
388388{
389   UINT8 *gfx = screen.machine().region("gfx1")->base();
389   UINT8 *gfx = screen.machine().root_device().memregion("gfx1")->base();
390390   mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME);
391391   mc6845->screen_update( screen, bitmap, cliprect);
392392
r14976r14977
407407static VIDEO_START( cga_poisk2 )
408408{
409409   VIDEO_START_CALL(pc_cga);
410   cga.chr_gen = machine.region( "gfx1" )->base() + 0x0000;
410   cga.chr_gen = machine.root_device().memregion( "gfx1" )->base() + 0x0000;
411411}
412412
413413static SCREEN_UPDATE_RGB32( cga_poisk2 )
414414{
415   UINT8 *gfx = screen.machine().region("gfx1")->base();
415   UINT8 *gfx = screen.machine().root_device().memregion("gfx1")->base();
416416   mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME);
417417   mc6845->screen_update( screen, bitmap, cliprect);
418418
r14976r14977
11031103
11041104static WRITE8_HANDLER ( char_ram_w )
11051105{
1106   UINT8 *gfx = space->machine().region("gfx1")->base();
1106   UINT8 *gfx = space->machine().root_device().memregion("gfx1")->base();
11071107   logerror("write char ram %04x %02x\n",offset,data);
11081108   gfx[offset + 0x0000] = data;
11091109   gfx[offset + 0x0800] = data;
r14976r14977
11161116
11171117static READ8_HANDLER ( char_ram_r )
11181118{
1119   UINT8 *gfx = space->machine().region("gfx1")->base();
1119   UINT8 *gfx = space->machine().root_device().memregion("gfx1")->base();
11201120   return gfx[offset];
11211121}
11221122
r14976r14977
14851485      }
14861486      else
14871487      {
1488         memory_set_bankptr(space->machine(),"bank1", videoram + videoram_offset[0]);
1488         space->machine().root_device().membank("bank1")->set_base(videoram + videoram_offset[0]);
14891489      }
14901490      cga.mode_control = data;
14911491      switch( cga.mode_control & 0x3F )
r14976r14977
15431543      pc1512.read = data;
15441544      if ( ( cga.mode_control & 0x12 ) == 0x12 )
15451545      {
1546         memory_set_bankptr(space->machine(),"bank1", videoram + videoram_offset[data & 3]);
1546         space->machine().root_device().membank("bank1")->set_base(videoram + videoram_offset[data & 3]);
15471547      }
15481548      break;
15491549
r14976r14977
16181618   address_space *io_space = machine.firstcpu->memory().space( AS_IO );
16191619
16201620   space->install_read_bank( 0xb8000, 0xbbfff, 0, 0x0C000, "bank1" );
1621   memory_set_bankptr(machine, "bank1", cga.videoram + videoram_offset[0]);
1621   machine.root_device().membank("bank1")->set_base(cga.videoram + videoram_offset[0]);
16221622   space->install_legacy_write_handler( 0xb8000, 0xbbfff, 0, 0x0C000, FUNC(pc1512_videoram16le_w) );
16231623
16241624   io_space->install_legacy_read_handler( 0x3d0, 0x3df, FUNC(pc1512_16le_r) );
r14976r14977
16291629
16301630static SCREEN_UPDATE_RGB32( mc6845_pc1512 )
16311631{
1632   UINT8 *gfx = screen.machine().region("gfx1")->base();
1632   UINT8 *gfx = screen.machine().root_device().memregion("gfx1")->base();
16331633   mc6845_device *mc6845 = screen.machine().device<mc6845_device>(CGA_MC6845_NAME);
16341634   mc6845->screen_update(screen, bitmap, cliprect);
16351635
src/emu/video/tms9927.c
r14976r14977
274274      /* get the self-load PROM */
275275      if (tms->intf->selfload_region != NULL)
276276      {
277         tms->selfload = device->machine().region(tms->intf->selfload_region)->base();
277         tms->selfload = device->machine().root_device().memregion(tms->intf->selfload_region)->base();
278278         assert(tms->selfload != NULL);
279279      }
280280   }
src/emu/video/generic.c
r14976r14977
160160
161161PALETTE_INIT( RRRR_GGGG_BBBB )
162162{
163   const UINT8 *color_prom = machine.region("proms")->base();
163   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
164164   int i;
165165
166166   for (i = 0; i < machine.total_colors(); i++)
src/emu/video/hd61830.c
r14976r14977
478478               addr = 160*7 + (md - 0xe0) * 11 + cl;
479479            }
480480
481            data = subregion("hd61830")->u8(addr);
481            data = memregion("hd61830")->u8(addr);
482482         }
483483
484484         int cursor = m_mcr & MODE_CURSOR;
src/emu/video/315_5124.c
r14976r14977
16161616
16171617   /* Allocate video RAM */
16181618   astring tempstring;
1619   m_CRAM = machine().region_alloc(subtag(tempstring,"vdp_cram"), SEGA315_5378_CRAM_SIZE, 1, ENDIANNESS_LITTLE);
1619   m_CRAM = machine().memory().region_alloc(subtag(tempstring,"vdp_cram"), SEGA315_5378_CRAM_SIZE, 1, ENDIANNESS_LITTLE);
16201620   m_line_buffer = auto_alloc_array(machine(), int, 256 * 5);
16211621
16221622   m_frame_timing = (m_is_pal) ? pal_192 : ntsc_192;
src/emu/diimage.c
r14976r14977
422422      return NULL;
423423
424424   sprintf( full_tag, "%s:%s", device().tag(), tag );
425   return device().machine().region( full_tag )->base();
425   return device().machine().root_device().memregion( full_tag )->base();
426426}
427427
428428
r14976r14977
435435    char full_tag[256];
436436
437437    sprintf( full_tag, "%s:%s", device().tag(), tag );
438    return device().machine().region( full_tag )->bytes();
438    return device().machine().root_device().memregion( full_tag )->bytes();
439439}
440440
441441
src/emu/machine.c
r14976r14977
150150     m_config(_config),
151151     m_system(_config.gamedrv()),
152152     m_osd(osd),
153     m_regionlist(m_respool),
154     m_save(*this),
155     m_scheduler(*this),
156     m_memory(NULL),
157153     m_cheat(NULL),
158154     m_render(NULL),
159155     m_input(NULL),
r14976r14977
176172     m_saveload_schedule(SLS_NONE),
177173     m_saveload_schedule_time(attotime::zero),
178174     m_saveload_searchpath(NULL),
179     m_logerror_list(m_respool)
175     m_logerror_list(m_respool),
176
177     m_save(*this),
178     m_memory(*this),
179     m_scheduler(*this)
180180{
181181   memset(gfx, 0, sizeof(gfx));
182182   memset(&m_base_time, 0, sizeof(m_base_time));
r14976r14977
276276   // first load ROMs, then populate memory, and finally initialize CPUs
277277   // these operations must proceed in this order
278278   rom_init(*this);
279   m_memory = auto_alloc(*this, memory_manager(*this));
279   m_memory.initialize();
280280   m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this));
281281   save().save_item(NAME(m_watchdog_enabled));
282282   save().save_item(NAME(m_watchdog_counter));
r14976r14977
606606
607607
608608//-------------------------------------------------
609//  region_alloc - allocates memory for a region
610//-------------------------------------------------
611
612memory_region *running_machine::region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian)
613{
614mame_printf_verbose("Region '%s' created\n", name);
615    // make sure we don't have a region of the same name; also find the end of the list
616    memory_region *info = m_regionlist.find(name);
617    if (info != NULL)
618      fatalerror("region_alloc called with duplicate region name \"%s\"\n", name);
619
620   // allocate the region
621   return &m_regionlist.append(name, *auto_alloc(*this, memory_region(*this, name, length, width, endian)));
622}
623
624
625//-------------------------------------------------
626//  region_free - releases memory for a region
627//-------------------------------------------------
628
629void running_machine::region_free(const char *name)
630{
631   m_regionlist.remove(name);
632}
633
634
635//-------------------------------------------------
636609//  add_notifier - add a notifier of the
637610//  given type
638611//-------------------------------------------------
r14976r14977
10591032
10601033
10611034
1062/***************************************************************************
1063    MEMORY REGIONS
1064***************************************************************************/
1065
1066//-------------------------------------------------
1067//  memory_region - constructor
1068//-------------------------------------------------
1069
1070memory_region::memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian)
1071   : m_machine(machine),
1072     m_next(NULL),
1073     m_name(name),
1074     m_length(length),
1075     m_width(width),
1076     m_endianness(endian)
1077{
1078   assert(width == 1 || width == 2 || width == 4 || width == 8);
1079   m_base.u8 = auto_alloc_array(machine, UINT8, length);
1080}
1081
1082
1083//-------------------------------------------------
1084//  ~memory_region - destructor
1085//-------------------------------------------------
1086
1087memory_region::~memory_region()
1088{
1089   auto_free(machine(), m_base.v);
1090}
1091
1092
1093
10941035//**************************************************************************
10951036//  CALLBACK ITEMS
10961037//**************************************************************************
src/emu/sound/tms5110.c
r14976r14977
14151415
14161416   tms->rom = *device->region();
14171417   assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No rom region found");
1418   tms->prom = device->machine().region(tms->intf->prom_region)->base();
1418   tms->prom = device->machine().root_device().memregion(tms->intf->prom_region)->base();
14191419   assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No prom region found");
14201420
14211421   tms->device = device;
src/emu/sound/k054539.c
r14976r14977
317317   cur_ptr = 0;
318318   memset(ram, 0, 0x4000);
319319
320   const memory_region *reg = (rgnoverride != NULL) ? machine().region(rgnoverride) : region();
320   memory_region *reg = (rgnoverride != NULL) ? machine().root_device().memregion(rgnoverride) : region();
321321   rom = *reg;
322322   rom_size = reg->bytes();
323323   rom_mask = 0xffffffffU;
src/emu/sound/digitalk.c
r14976r14977
648648{
649649   digitalker *dg = get_safe_token(device);
650650   dg->device = device;
651   dg->rom = device->machine().region(device->tag())->base();
651   dg->rom = device->machine().root_device().memregion(device->tag())->base();
652652   dg->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/4, dg, digitalker_update);
653653   dg->dac_index = 128;
654654   dg->data = 0xff;
src/emu/sound/ymz770.c
r14976r14977
733733      channels[i].decoder = new amm;
734734   }
735735
736   rom_base = device().machine().region(":ymz770")->base();
736   rom_base = device().machine().root_device().memregion(":ymz770")->base();
737737
738738   save_item(NAME(cur_reg));
739739   for (int i = 0; i < 8; i++)
src/emu/sound/votrax.c
r14976r14977
11671167   m_master_clock_freq = clock();
11681168   m_stream = stream_alloc(0, 1, m_master_clock_freq / 16);
11691169   m_phoneme_timer = timer_alloc();
1170   m_rom = subregion("phoneme")->base();
1170   m_rom = memregion("phoneme")->base();
11711171
11721172   // reset inputs
11731173   m_inflection = 0;
src/emu/sound/i5000.c
r14976r14977
4343   // create the stream
4444   m_stream = machine().sound().stream_alloc(*this, 0, 2, clock() / 0x400, this);
4545
46   m_rom_base = (UINT16 *)device().machine().region(":i5000snd")->base();
47   m_rom_mask = device().machine().region(":i5000snd")->bytes() / 2 - 1;
46   m_rom_base = (UINT16 *)device().machine().root_device().memregion(":i5000snd")->base();
47   m_rom_mask = device().machine().root_device().memregion(":i5000snd")->bytes() / 2 - 1;
4848}
4949
5050
src/emu/sound/2610intf.c
r14976r14977
164164   pcmbufa  = *device->region();
165165   pcmsizea = device->region()->bytes();
166166   name.printf("%s.deltat", device->tag());
167   pcmbufb  = (void *)(device->machine().region(name)->base());
168   pcmsizeb = device->machine().region(name)->bytes();
167   pcmbufb  = (void *)(device->machine().root_device().memregion(name)->base());
168   pcmsizeb = device->machine().root_device().memregion(name)->bytes();
169169   if (pcmbufb == NULL || pcmsizeb == 0)
170170   {
171171      pcmbufb = pcmbufa;
src/emu/sound/gaelco.c
r14976r14977
260260      info->banks[j] = intf->banks[j];
261261   }
262262   info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 8000, info, gaelco_update);
263   info->snd_data = (UINT8 *)device->machine().region(intf->gfxregion)->base();
263   info->snd_data = (UINT8 *)device->machine().root_device().memregion(intf->gfxregion)->base();
264264   if (info->snd_data == NULL)
265265      info->snd_data = *device->region();
266266
src/emu/sound/fm.c
r14976r14977
42304230
42314231   /* setup PCM buffers again */
42324232   name.printf("%s",dev->tag());
4233   F2610->pcmbuf   = (const UINT8 *)dev->machine().region(name)->base();
4234   F2610->pcm_size = dev->machine().region(name)->bytes();
4233   F2610->pcmbuf   = (const UINT8 *)dev->machine().root_device().memregion(name)->base();
4234   F2610->pcm_size = dev->machine().root_device().memregion(name)->bytes();
42354235   name.printf("%s.deltat",dev->tag());
4236   F2610->deltaT.memory = (UINT8 *)dev->machine().region(name)->base();
4236   F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name)->base();
42374237   if(F2610->deltaT.memory == NULL)
42384238   {
42394239      F2610->deltaT.memory = (UINT8*)F2610->pcmbuf;
42404240      F2610->deltaT.memory_size = F2610->pcm_size;
42414241   }
42424242   else
4243      F2610->deltaT.memory_size = dev->machine().region(name)->bytes();
4243      F2610->deltaT.memory_size = dev->machine().root_device().memregion(name)->bytes();
42444244
42454245   /* Reset Prescaler */
42464246   OPNSetPres( OPN, 6*24, 6*24, 4*2); /* OPN 1/6 , SSG 1/4 */
src/emu/sound/okim6295.c
r14976r14977
228228   if (m_bank_installed)
229229   {
230230      m_bank_offs = base;
231      memory_set_bankptr(machine(), tag(), m_region->base() + base);
231      membank(tag())->set_base(m_region->base() + base);
232232   }
233233}
234234
src/emu/sound/zsg2.c
r14976r14977
228228
229229   info->stream = device->machine().sound().stream_alloc(*device, 0, 2, info->sample_rate, info, update_stereo);
230230
231   info->bank_samples = device->machine().region(intf->samplergn)->base();
231   info->bank_samples = device->machine().root_device().memregion(intf->samplergn)->base();
232232}
233233
234234/**************************************************************************
src/emu/sound/es5506.c
r14976r14977
913913   chip->stream = device->machine().sound().stream_alloc(*device, 0, 2, device->clock() / (16*32), chip, es5506_update);
914914
915915   /* initialize the regions */
916   chip->region_base[0] = intf->region0 ? (UINT16 *)device->machine().region(intf->region0)->base() : NULL;
917   chip->region_base[1] = intf->region1 ? (UINT16 *)device->machine().region(intf->region1)->base() : NULL;
918   chip->region_base[2] = intf->region2 ? (UINT16 *)device->machine().region(intf->region2)->base() : NULL;
919   chip->region_base[3] = intf->region3 ? (UINT16 *)device->machine().region(intf->region3)->base() : NULL;
916   chip->region_base[0] = intf->region0 ? (UINT16 *)device->machine().root_device().memregion(intf->region0)->base() : NULL;
917   chip->region_base[1] = intf->region1 ? (UINT16 *)device->machine().root_device().memregion(intf->region1)->base() : NULL;
918   chip->region_base[2] = intf->region2 ? (UINT16 *)device->machine().root_device().memregion(intf->region2)->base() : NULL;
919   chip->region_base[3] = intf->region3 ? (UINT16 *)device->machine().root_device().memregion(intf->region3)->base() : NULL;
920920
921921   /* initialize the rest of the structure */
922922   chip->device = device;
src/emu/sound/k053260.c
r14976r14977
221221
222222   ic->mode = 0;
223223
224   const memory_region *region = (ic->intf->rgnoverride != NULL) ? device->machine().region(ic->intf->rgnoverride) : device->region();
224   memory_region *region = (ic->intf->rgnoverride != NULL) ? device->machine().root_device().memregion(ic->intf->rgnoverride) : device->region();
225225
226226   ic->rom = *region;
227227   ic->rom_size = region->bytes();
src/emu/machine.h
r14976r14977
160160typedef struct _generic_machine_private generic_machine_private;
161161
162162
163// ======================> memory_region
164
165// memory region object; should eventually be renamed memory_region
166class memory_region
167{
168   DISABLE_COPYING(memory_region);
169
170   friend class running_machine;
171   friend class simple_list<memory_region>;
172   friend resource_pool_object<memory_region>::~resource_pool_object();
173
174   // construction/destruction
175   memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian);
176   ~memory_region();
177
178public:
179   // getters
180   running_machine &machine() const { return m_machine; }
181   memory_region *next() const { return m_next; }
182   UINT8 *base() const { return (this != NULL) ? m_base.u8 : NULL; }
183   UINT8 *end() const { return (this != NULL) ? m_base.u8 + m_length : NULL; }
184   UINT32 bytes() const { return (this != NULL) ? m_length : 0; }
185   const char *name() const { return m_name; }
186
187   // flag expansion
188   endianness_t endianness() const { return m_endianness; }
189   UINT8 width() const { return m_width; }
190
191   // data access
192   UINT8 &u8(offs_t offset = 0) const { return m_base.u8[offset]; }
193   UINT16 &u16(offs_t offset = 0) const { return m_base.u16[offset]; }
194   UINT32 &u32(offs_t offset = 0) const { return m_base.u32[offset]; }
195   UINT64 &u64(offs_t offset = 0) const { return m_base.u64[offset]; }
196
197   // allow passing a region for any common pointer
198   operator void *() const { return (this != NULL) ? m_base.v : NULL; }
199   operator INT8 *() const { return (this != NULL) ? m_base.i8 : NULL; }
200   operator UINT8 *() const { return (this != NULL) ? m_base.u8 : NULL; }
201   operator INT16 *() const { return (this != NULL) ? m_base.i16 : NULL; }
202   operator UINT16 *() const { return (this != NULL) ? m_base.u16 : NULL; }
203   operator INT32 *() const { return (this != NULL) ? m_base.i32 : NULL; }
204   operator UINT32 *() const { return (this != NULL) ? m_base.u32 : NULL; }
205   operator INT64 *() const { return (this != NULL) ? m_base.i64 : NULL; }
206   operator UINT64 *() const { return (this != NULL) ? m_base.u64 : NULL; }
207
208private:
209   // internal data
210   running_machine &      m_machine;
211   memory_region *         m_next;
212   astring               m_name;
213   generic_ptr            m_base;
214   UINT32               m_length;
215   UINT8               m_width;
216   endianness_t         m_endianness;
217};
218
219
220
221163// ======================> system_time
222164
223165// system time description, both local and UTC
r14976r14977
279221   resource_pool &respool() { return m_respool; }
280222   device_scheduler &scheduler() { return m_scheduler; }
281223   save_manager &save() { return m_save; }
282   memory_manager &memory() { assert(m_memory != NULL); return *m_memory; }
224   memory_manager &memory() { return m_memory; }
283225   cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; }
284226   render_manager &render() const { assert(m_render != NULL); return *m_render; }
285227   input_manager &input() const { assert(m_input != NULL); return *m_input; }
r14976r14977
302244
303245   // additional helpers
304246   emu_options &options() const { return m_config.options(); }
305   memory_region *first_region() const { return m_regionlist.first(); }
306247   attotime time() const { return m_scheduler.time(); }
307248   bool scheduled_event_pending() const { return m_exit_pending || m_hard_reset_pending; }
308249
r14976r14977
310251   inline device_t *device(const char *tag) { return root_device().subdevice(tag); }
311252   template<class _DeviceClass> inline _DeviceClass *device(const char *tag) { return downcast<_DeviceClass *>(device(tag)); }
312253   inline const input_port_config *port(const char *tag);
313   inline const memory_region *region(const char *tag);
314254
315255   // configuration helpers
316256   device_t &add_dynamic_device(device_t &owner, device_type type, const char *tag, UINT32 clock);
r14976r14977
337277   void base_datetime(system_time &systime);
338278   void current_datetime(system_time &systime);
339279
340   // regions
341   memory_region *region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian);
342   void region_free(const char *name);
343
344280   // watchdog control
345281   void watchdog_reset();
346282   void watchdog_enable(bool enable = true);
r14976r14977
404340   const game_driver &      m_system;            // reference to the definition of the game machine
405341   osd_interface &         m_osd;               // reference to OSD system
406342
407   // embedded managers and objects
408   tagged_list<memory_region> m_regionlist;      // list of memory regions
409   save_manager         m_save;               // save manager
410   device_scheduler      m_scheduler;         // scheduler object
411
412343   // managers
413   memory_manager *      m_memory;            // internal data from memory.c
414344   cheat_manager *         m_cheat;            // internal data from cheat.c
415345   render_manager *      m_render;            // internal data from render.c
416346   input_manager *         m_input;            // internal data from input.c
r14976r14977
484414      logerror_callback         m_func;
485415   };
486416   simple_list<logerror_callback_item> m_logerror_list;
417
418   // embedded managers and objects
419   save_manager         m_save;               // save manager
420   memory_manager         m_memory;            // memory manager
421   device_scheduler      m_scheduler;         // scheduler object
487422};
488423
489424
r14976r14977
503438   return m_portlist.find(root_device().subtag(fulltag, tag).cstr());
504439}
505440
506inline const memory_region *running_machine::region(const char *tag)
507{
508   // if tag begins with a :, it's absolute
509   if (tag[0] == ':')
510      return m_regionlist.find(tag);
511441
512   // otherwise, compute it relative to the root device
513   astring fulltag;
514   return m_regionlist.find(root_device().subtag(fulltag, tag).cstr());
515}
516
517
518442#endif   /* __MACHINE_H__ */
src/emu/romload.c
r14976r14977
518518
519519static void region_post_process(rom_load_data *romdata, const char *rgntag, bool invert)
520520{
521   const memory_region *region = romdata->machine().region(rgntag);
521   memory_region *region = romdata->machine().root_device().memregion(rgntag);
522522   UINT8 *base;
523523   int i, j;
524524
r14976r14977
832832      fatalerror("Error in RomModule definition: COPY has an invalid length\n");
833833
834834   /* make sure the source was valid */
835   const memory_region *region = romdata->machine().region(srcrgntag);
835   memory_region *region = romdata->machine().root_device().memregion(srcrgntag);
836836   if (region == NULL)
837837      fatalerror("Error in RomModule definition: COPY from an invalid region\n");
838838
r14976r14977
13281328      /* if this is a device region, override with the device width and endianness */
13291329      endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE;
13301330      UINT8 width = ROMREGION_GETWIDTH(region) / 8;
1331      const memory_region *memregion = romdata->machine().region(regiontag);
1331      memory_region *memregion = romdata->machine().root_device().memregion(regiontag);
13321332      if (memregion != NULL)
13331333      {
13341334         if (romdata->machine().device(regiontag) != NULL)
13351335            normalize_flags_for_device(romdata->machine(), regiontag, width, endianness);
13361336
13371337         /* clear old region (todo: should be moved to an image unload function) */
1338         romdata->machine().region_free(memregion->name());
1338         romdata->machine().memory().region_free(memregion->name());
13391339      }
13401340
13411341      /* remember the base and length */
1342      romdata->region = romdata->machine().region_alloc(regiontag, regionlength, width, endianness);
1342      romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness);
13431343      LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
13441344
13451345      /* clear the region if it's requested */
r14976r14977
14041404               normalize_flags_for_device(romdata->machine(), regiontag, width, endianness);
14051405
14061406            /* remember the base and length */
1407            romdata->region = romdata->machine().region_alloc(regiontag, regionlength, width, endianness);
1407            romdata->region = romdata->machine().memory().region_alloc(regiontag, regionlength, width, endianness);
14081408            LOG(("Allocated %X bytes @ %p\n", romdata->region->bytes(), romdata->region->base()));
14091409
14101410            /* clear the region if it's requested */
src/emu/imagedev/cartslot.c
r14976r14977
7878   offset = ROM_GETOFFSET(roment);
7979   size = ROM_GETLENGTH(roment);
8080   flags = ROM_GETFLAGS(roment);
81   ptr = ((UINT8 *) device().machine().region(region)->base()) + offset;
81   ptr = ((UINT8 *) device().machine().root_device().memregion(region)->base()) + offset;
8282
8383   if (load)
8484   {
src/emu/device.c
r14976r14977
186186
187187
188188//-------------------------------------------------
189//  subregion - return a pointer to the region
189//  memregion - return a pointer to the region
190190//  info for a given region
191191//-------------------------------------------------
192192
193const memory_region *device_t::subregion(const char *_tag) const
193memory_region *device_t::memregion(const char *_tag) const
194194{
195195   // safety first
196196   if (this == NULL)
r14976r14977
198198
199199   // build a fully-qualified name and look it up
200200   astring fullpath;
201   return machine().region(subtag(fullpath, _tag));
201   return machine().memory().region(subtag(fullpath, _tag));
202202}
203203
204204
205205//-------------------------------------------------
206//  subregion - return a pointer to the memory
206//  memregion - return a pointer to the memory
207207//  bank info for a given bank
208208//-------------------------------------------------
209209
210memory_bank *device_t::subbank(const char *_tag) const
210memory_bank *device_t::membank(const char *_tag) const
211211{
212212   // safety first
213213   if (this == NULL)
r14976r14977
397397void device_t::start()
398398{
399399   // populate the machine and the region field
400   m_region = machine().region(tag());
400   m_region = machine().root_device().memregion(tag());
401401
402402   // find all the registered devices
403403   bool allfound = true;
src/emu/device.h
r14976r14977
183183   device_t *first_subdevice() const { return m_subdevice_list.first(); }
184184   astring &subtag(astring &dest, const char *tag) const;
185185   astring &siblingtag(astring &dest, const char *tag) const { return (this != NULL && m_owner != NULL) ? m_owner->subtag(dest, tag) : dest.cpy(tag); }
186   const memory_region *subregion(const char *tag) const;
187   memory_bank *subbank(const char *tag) const;
186   memory_region *memregion(const char *tag) const;
187   memory_bank *membank(const char *tag) const;
188188   device_t *subdevice(const char *tag) const;
189189   device_t *siblingdevice(const char *tag) const;
190190   template<class _DeviceClass> inline _DeviceClass *subdevice(const char *tag) const { return downcast<_DeviceClass *>(subdevice(tag)); }
191191   template<class _DeviceClass> inline _DeviceClass *siblingdevice(const char *tag) const { return downcast<_DeviceClass *>(siblingdevice(tag)); }
192   const memory_region *region() const { return m_region; }
192   memory_region *region() const { return m_region; }
193193
194194   // configuration helpers
195195   static void static_set_clock(device_t &device, UINT32 clock);
r14976r14977
296296   attoseconds_t         m_attoseconds_per_clock;// period in attoseconds
297297
298298   device_debug *         m_debug;
299   const memory_region *   m_region;            // our device-local region
299   memory_region *         m_region;            // our device-local region
300300   const machine_config &   m_machine_config;      // reference to the machine's configuration
301301   const void *         m_static_config;      // static device configuration
302302   const input_device_default *m_input_defaults;   // devices input ports default overrides
src/emu/memory.c
r14976r14977
14991499
15001500
15011501//**************************************************************************
1502//  CORE SYSTEM OPERATIONS
1502//  MEMORY MANAGER
15031503//**************************************************************************
15041504
15051505//-------------------------------------------------
1506//  memory_init - initialize the memory system
1506//  memory_manager - constructor
15071507//-------------------------------------------------
15081508
15091509memory_manager::memory_manager(running_machine &machine)
r14976r14977
15131513{
15141514   memset(m_bank_ptr, 0, sizeof(m_bank_ptr));
15151515   memset(m_bankd_ptr, 0, sizeof(m_bankd_ptr));
1516}
15161517
1518
1519//-------------------------------------------------
1520//  initialize - initialize the memory system
1521//-------------------------------------------------
1522
1523void memory_manager::initialize()
1524{
15171525   // loop over devices and spaces within each device
1518   memory_interface_iterator iter(machine.root_device());
1526   memory_interface_iterator iter(machine().root_device());
15191527   for (device_memory_interface *memory = iter.first(); memory != NULL; memory = iter.next())
15201528      for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
15211529      {
r14976r14977
15421550      space->locate_memory();
15431551
15441552   // register a callback to reset banks when reloading state
1545   machine.save().register_postload(save_prepost_delegate(FUNC(memory_manager::bank_reattach), this));
1553   machine().save().register_postload(save_prepost_delegate(FUNC(memory_manager::bank_reattach), this));
15461554
15471555   // dump the final memory configuration
1548   generate_memdump(machine);
1556   generate_memdump(machine());
15491557
15501558   // we are now initialized
15511559   m_initialized = true;
15521560}
15531561
15541562
1555
1556//**************************************************************************
1557//  MEMORY BANKING
1558//**************************************************************************
1559
15601563//-------------------------------------------------
15611564//  shared - get a pointer to a shared memory
15621565//  region by tag
r14976r14977
16041607
16051608
16061609//-------------------------------------------------
1610//  region_alloc - allocates memory for a region
1611//-------------------------------------------------
1612
1613memory_region *memory_manager::region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian)
1614{
1615mame_printf_verbose("Region '%s' created\n", name);
1616    // make sure we don't have a region of the same name; also find the end of the list
1617    memory_region *info = m_regionlist.find(name);
1618    if (info != NULL)
1619      fatalerror("region_alloc called with duplicate region name \"%s\"\n", name);
1620
1621   // allocate the region
1622   return &m_regionlist.append(name, *global_alloc(memory_region(machine(), name, length, width, endian)));
1623}
1624
1625
1626//-------------------------------------------------
1627//  region_free - releases memory for a region
1628//-------------------------------------------------
1629
1630void memory_manager::region_free(const char *name)
1631{
1632   m_regionlist.remove(name);
1633}
1634
1635
1636//-------------------------------------------------
16071637//  generate_memdump - internal memory dump
16081638//-------------------------------------------------
16091639
r14976r14977
17891819
17901820void address_space::prepare_map()
17911821{
1792   const memory_region *devregion = (m_spacenum == AS_0) ? machine().region(m_device.tag()) : NULL;
1822   memory_region *devregion = (m_spacenum == AS_0) ? machine().root_device().memregion(m_device.tag()) : NULL;
17931823   UINT32 devregionsize = (devregion != NULL) ? devregion->bytes() : 0;
17941824
17951825   // allocate the address map
r14976r14977
18481878         device().siblingtag(fulltag, entry->m_region);
18491879
18501880         // find the region
1851         const memory_region *region = machine().region(fulltag);
1881         memory_region *region = machine().root_device().memregion(fulltag);
18521882         if (region == NULL)
18531883            fatalerror("Error: device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"", m_device.tag(), m_name, entry->m_addrstart, entry->m_addrend, entry->m_region);
18541884
r14976r14977
18651895         device().siblingtag(fulltag, entry->m_region);
18661896
18671897         // set the memory address
1868         entry->m_memory = machine().region(fulltag.cstr())->base() + entry->m_rgnoffs;
1898         entry->m_memory = machine().root_device().memregion(fulltag.cstr())->base() + entry->m_rgnoffs;
18691899      }
18701900   }
18711901
r14976r14977
28652895      return true;
28662896
28672897   // if we're reading from RAM or from ROM outside of address space 0 or its region, then yes, we do need backing
2868   const memory_region *region = machine().region(m_device.tag());
2898   memory_region *region = machine().root_device().memregion(m_device.tag());
28692899   if (entry->m_read.m_type == AMH_RAM ||
28702900      (entry->m_read.m_type == AMH_ROM && (m_spacenum != AS_0 || region == NULL || entry->m_addrstart >= region->bytes())))
28712901      return true;
r14976r14977
41434173   }
41444174
41454175   // register for saving, but only if we're not part of a memory region
4146   const memory_region *region;
4147   for (region = space.machine().first_region(); region != NULL; region = region->next())
4176   memory_region *region;
4177   for (region = space.machine().memory().first_region(); region != NULL; region = region->next())
41484178      if (m_data >= region->base() && (m_data + (byteend - bytestart + 1)) < region->end())
41494179      {
41504180         VPRINTF(("skipping save of this memory block as it is covered by a memory region\n"));
r14976r14977
44164446
44174447
44184448//**************************************************************************
4449//  MEMORY REGIONS
4450//**************************************************************************
4451
4452//-------------------------------------------------
4453//  memory_region - constructor
4454//-------------------------------------------------
4455
4456memory_region::memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian)
4457   : m_machine(machine),
4458     m_next(NULL),
4459     m_name(name),
4460     m_buffer(length),
4461     m_width(width),
4462     m_endianness(endian)
4463{
4464   assert(width == 1 || width == 2 || width == 4 || width == 8);
4465}
4466
4467
4468
4469//**************************************************************************
44194470//  HANDLER ENTRY
44204471//**************************************************************************
44214472
r14976r14977
55385589{
55395590   m_legacy_info.handler.space64(m_legacy_info.object.space, offset, data, mask);
55405591}
5541
5542
5543
5544// configure the addresses for a bank
5545void memory_configure_bank(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) { machine.root_device().subbank(tag)->configure_entries(startentry, numentries, base, stride); }
5546
5547// configure the decrypted addresses for a bank
5548void memory_configure_bank_decrypted(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) { machine.root_device().subbank(tag)->configure_decrypted_entries(startentry, numentries, base, stride); }
5549
5550// select one pre-configured entry to be the new bank base
5551void memory_set_bank(running_machine &machine, const char *tag, int entrynum) { machine.root_device().subbank(tag)->set_entry(entrynum); }
5552
5553// set the absolute address of a bank base
5554void memory_set_bankptr(running_machine &machine, const char *tag, void *base) { machine.root_device().subbank(tag)->set_base(base); }
src/emu/memory.h
r14976r14977
740740};
741741
742742
743// ======================> memory_region
744
745// memory region object
746class memory_region
747{
748   DISABLE_COPYING(memory_region);
749
750   friend class memory_manager;
751   friend class simple_list<memory_region>;
752   friend resource_pool_object<memory_region>::~resource_pool_object();
753
754   // construction/destruction
755   memory_region(running_machine &machine, const char *name, UINT32 length, UINT8 width, endianness_t endian);
756
757public:
758   // getters
759   running_machine &machine() const { return m_machine; }
760   memory_region *next() const { return m_next; }
761   UINT8 *base() { return (this != NULL) ? &m_buffer[0] : NULL; }
762   UINT8 *end() { return (this != NULL) ? base() + m_buffer.count() : NULL; }
763   UINT32 bytes() const { return (this != NULL) ? m_buffer.count() : 0; }
764   const char *name() const { return m_name; }
765
766   // flag expansion
767   endianness_t endianness() const { return m_endianness; }
768   UINT8 width() const { return m_width; }
769
770   // data access
771   UINT8 &u8(offs_t offset = 0) { return m_buffer[offset]; }
772   UINT16 &u16(offs_t offset = 0) { return reinterpret_cast<UINT16 *>(base())[offset]; }
773   UINT32 &u32(offs_t offset = 0) { return reinterpret_cast<UINT32 *>(base())[offset]; }
774   UINT64 &u64(offs_t offset = 0) { return reinterpret_cast<UINT64 *>(base())[offset]; }
775
776   // allow passing a region for any common pointer
777   operator void *() { return (this != NULL) ? reinterpret_cast<void *>(base()) : NULL; }
778   operator INT8 *() { return (this != NULL) ? reinterpret_cast<INT8 *>(base()) : NULL; }
779   operator UINT8 *() { return (this != NULL) ? reinterpret_cast<UINT8 *>(base()) : NULL; }
780   operator INT16 *() { return (this != NULL) ? reinterpret_cast<INT16 *>(base()) : NULL; }
781   operator UINT16 *() { return (this != NULL) ? reinterpret_cast<UINT16 *>(base()) : NULL; }
782   operator INT32 *() { return (this != NULL) ? reinterpret_cast<INT32 *>(base()) : NULL; }
783   operator UINT32 *() { return (this != NULL) ? reinterpret_cast<UINT32 *>(base()) : NULL; }
784   operator INT64 *() { return (this != NULL) ? reinterpret_cast<INT64 *>(base()) : NULL; }
785   operator UINT64 *() { return (this != NULL) ? reinterpret_cast<UINT64 *>(base()) : NULL; }
786
787private:
788   // internal data
789   running_machine &      m_machine;
790   memory_region *         m_next;
791   astring               m_name;
792   dynamic_buffer         m_buffer;
793   UINT8               m_width;
794   endianness_t         m_endianness;
795};
796
797
798
743799// ======================> memory_manager
744800
745801// holds internal state for the memory system
746802class memory_manager
747803{
748804   friend class address_space;
805   friend class address_table;
806   friend class device_t;
807   friend class memory_block;
749808
750809public:
751810   // construction/destruction
752811   memory_manager(running_machine &machine);
812   void initialize();
753813
754814   // getters
755815   running_machine &machine() const { return m_machine; }
756816   address_space *first_space() const { return m_spacelist.first(); }
757   memory_bank *first_bank() const { return m_banklist.first(); }
758   memory_bank *bank(const char *tag) const { return m_bankmap.find_hash_only(tag); }
817   memory_region *first_region() const { return m_regionlist.first(); }
759818
760819   // get a pointer to a shared memory region by tag
761820   memory_share *shared(const char *tag);
r14976r14977
767826   // pointers to a bank pointer (internal usage only)
768827   UINT8 **bank_pointer_addr(UINT8 index, bool decrypted = false) { return decrypted ? &m_bankd_ptr[index] : &m_bank_ptr[index]; }
769828
829   // regions
830   memory_region *region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian);
831   void region_free(const char *name);
832
770833private:
771834   // internal helpers
835   memory_bank *first_bank() const { return m_banklist.first(); }
836   memory_bank *bank(const char *tag) const { return m_bankmap.find(tag); }
837   memory_region *region(const char *tag) { return m_regionlist.find(tag); }
772838   void bank_reattach();
773839
774840   // internal state
r14976r14977
786852   UINT8                  m_banknext;            // next bank to allocate
787853
788854   tagged_list<memory_share>   m_sharelist;         // map for share lookups
855
856   tagged_list<memory_region>    m_regionlist;         // list of memory regions
789857};
790858
791859
r14976r14977
892960
893961
894962//**************************************************************************
895//  GLOBAL VARIABLES
896//**************************************************************************
897
898extern const char *const address_space_names[ADDRESS_SPACES];
899
900
901
902//**************************************************************************
903//  FUNCTION PROTOTYPES FOR CORE MEMORY FUNCTIONS
904//**************************************************************************
905
906// configure the addresses for a bank
907void memory_configure_bank(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(5);
908
909// configure the decrypted addresses for a bank
910void memory_configure_bank_decrypted(running_machine &machine, const char *tag, int startentry, int numentries, void *base, offs_t stride) ATTR_NONNULL(5);
911
912// select one pre-configured entry to be the new bank base
913void memory_set_bank(running_machine &machine, const char *tag, int entrynum);
914
915// set the absolute address of a bank base
916void memory_set_bankptr(running_machine &machine, const char *tag, void *base) ATTR_NONNULL(3);
917
918
919
920//**************************************************************************
921963//  INLINE FUNCTIONS
922964//**************************************************************************
923965
src/emu/machine/pls100.c
r14976r14977
3131inline void pls100_device::parse_fusemap()
3232{
3333   jed_data jed;
34   jedbin_parse(machine().region(tag())->base(), machine().region(tag())->bytes(), &jed);
34   jedbin_parse(machine().root_device().memregion(tag())->base(), machine().root_device().memregion(tag())->bytes(), &jed);
3535   UINT32 fusenum = 0;
3636   m_xor = 0;
3737 
r14976r14977
113113void pls100_device::device_start()
114114{
115115   // parse fusemap
116   assert(machine().region(tag()) != NULL);
116   assert(machine().root_device().memregion(tag()) != NULL);
117117   parse_fusemap();
118118 
119119   // register for state saving
src/emu/machine/laserdsc.c
r14976r14977
294294
295295//-------------------------------------------------
296296//  static_set_overlay - set the overlay visible
297//  subregion
297//  memregion
298298//-------------------------------------------------
299299
300300void laserdisc_device::static_set_overlay_clip(device_t &device, INT32 minx, INT32 maxx, INT32 miny, INT32 maxy)
src/emu/machine/mccs1850.c
r14976r14977
371371{
372372   memset(m_ram, 0xff, RAM_SIZE);
373373
374   if (machine().region(tag()) != NULL)
374   if (machine().root_device().memregion(tag()) != NULL)
375375   {
376      UINT8 *nvram = machine().region(tag())->base();
376      UINT8 *nvram = machine().root_device().memregion(tag())->base();
377377
378378      // initialize NVRAM
379379      memcpy(m_ram, nvram, 0x20);
src/emu/screen.c
r14976r14977
951951   scaledvis.min_y = m_visarea.min_y * m_burnin.height() / m_height;
952952   scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height;
953953
954   // wrap a bitmap around the subregion we care about
954   // wrap a bitmap around the memregion we care about
955955   bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height());
956956   int srcwidth = m_burnin.width();
957957   int srcheight = m_burnin.height();
src/emu/drawgfx.c
r14976r14977
9494   for (curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != NULL; curgfx++)
9595   {
9696      const gfx_decode_entry *gfxdecode = &gfxdecodeinfo[curgfx];
97      const memory_region *region = (gfxdecode->memory_region != NULL) ? machine.region(gfxdecode->memory_region) : NULL;
97      memory_region *region = (gfxdecode->memory_region != NULL) ? machine.root_device().memregion(gfxdecode->memory_region) : NULL;
9898      UINT32 region_length = (region != NULL) ? (8 * region->bytes()) : 0;
9999      const UINT8 *region_base = (region != NULL) ? region->base() : NULL;
100100      UINT32 xscale = (gfxdecode->xscale == 0) ? 1 : gfxdecode->xscale;
src/lib/formats/dfi_dsk.c
r14976r14977
3434#include "emu.h"
3535#include "dfi_dsk.h"
3636#include <zlib.h>
37#define NUMBER_OF_MULTIREADS 1
3837
3938dfi_format::dfi_format() : floppy_image_format_t()
4039{
r14976r14977
4746
4847const char *dfi_format::description() const
4948{
50   return "DiscFerret flux dump format";
49   return "DiskFerret flux dump format";
5150}
5251
5352const char *dfi_format::extensions() const
r14976r14977
10099      tsize--; // Drop the extra 0x00 at the end
101100
102101      int index_time = 0;
103      int index_count = 0;
104102      int total_time = 0;
105103      for(int i=0; i<tsize; i++) {
106104         UINT8 v = data[i];
r14976r14977
108106            total_time += 0x7f;
109107         else {
110108            total_time += v & 0x7f;
111            if((v & 0x80) && (index_count<NUMBER_OF_MULTIREADS)) {
112               index_time = total_time;///NUMBER_OF_MULTIREADS;
113               index_count++;
114            }
109            if((v & 0x80) && !index_time)
110               index_time = total_time;
115111         }
116112      }
117113
r14976r14977
124120      image->set_track_size(track, head, tsize);
125121
126122      int cur_time = 0;
127      index_count = 0;
128      int index_polarity = 0;
129123      UINT32 mg = floppy_image::MG_A;
130124      UINT32 *buf = image->get_buffer(track, head);
131125      int tpos = 0;
132126      buf[tpos++] = mg;
133127      for(int i=0; i<tsize; i++) {
134128         UINT8 v = data[i];
135         if((v & 0x7f) == 0x7f) // 0x7F or 0xFF: no transition, but a carry
129         if((v & 0x7f) == 0x7f)
136130            cur_time += 0x7f;
137         else if((v & 0x80) == 0) { // 0x00-0x7E: not an index or carry, add the number and store transition
131         else {
138132            cur_time += v & 0x7f;
133            if(v & 0x80)
134               break;
139135            mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
140136            buf[tpos++] = mg | UINT32(200000000ULL*cur_time/index_time);
141         } else if(v & 0x80) { // 0x80-0xFF an index, note the index (TODO: actually do this!) and do not add number
142            index_polarity ^= 1;
143            index_count += index_polarity;
144            if (index_count == NUMBER_OF_MULTIREADS) break;
145137         }
146138      }
147139      image->set_track_size(track, head, tpos);
src/lib/formats/ap2_dsk.c
r14976r14977
11/*********************************************************************
22
3   ap2_dsk.c
3    ap2_dsk.c
44
5   Apple II disk images
5    Apple II disk images
66
77*********************************************************************/
88
r14976r14977
511511      SECTOR_LENGTH([256])
512512      FIRST_SECTOR_ID([0]))
513513LEGACY_FLOPPY_OPTIONS_END
514
515/***************************************************************************
516
517   New implementation
518
519****************************************************************************
520
521   Copyright Olivier Galibert, Lord Nightmare and Balrog
522   All rights reserved.
523
524   Redistribution and use in source and binary forms, with or without
525   modification, are permitted provided that the following conditions are
526   met:
527
528      * Redistributions of source code must retain the above copyright
529        notice, this list of conditions and the following disclaimer.
530      * Redistributions in binary form must reproduce the above copyright
531        notice, this list of conditions and the following disclaimer in
532        the documentation and/or other materials provided with the
533        distribution.
534      * Neither the name 'MAME' nor the names of its contributors may be
535        used to endorse or promote products derived from this software
536        without specific prior written permission.
537
538   THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
539   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
540   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
541   DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
542   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
543   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
544   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
545   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
546   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
547   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
548   POSSIBILITY OF SUCH DAMAGE.
549
550****************************************************************************/
551
552
553a2_16sect_format::a2_16sect_format() : floppy_image_format_t()
554{
555}
556
557const char *a2_16sect_format::name() const
558{
559      return "a2_16sect";
560}
561
562const char *a2_16sect_format::description() const
563{
564      return "Apple II 16-sector dsk image";
565}
566
567const char *a2_16sect_format::extensions() const
568{
569      return "dsk";
570}
571
572bool a2_16sect_format::supports_save() const
573{
574      return true;
575}
576
577int a2_16sect_format::identify(io_generic *io, UINT32 form_factor)
578{
579      int size = io_generic_size(io);
580      int expected_size = 35 * 16 * 256;
581      return size == expected_size;
582}
583
584const floppy_image_format_t::desc_e a2_16sect_format::mac_gcr[] = {
585      { SECTOR_LOOP_START, 0, -1 },
586      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
587      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
588      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
589      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
590      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
591      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
592      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
593      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
594      {   RAWBITS, 0xd5aa96, 24 },
595      {   CRC_MACHEAD_START, 0 },
596      {     TRACK_ID_GCR6 },
597      {     SECTOR_ID_GCR6 },
598      {     TRACK_HEAD_ID_GCR6 },
599      {     SECTOR_INFO_GCR6 },
600      {   CRC_END, 0 },
601      {   CRC, 0 },
602      {   RAWBITS, 0xdeaaff, 24 },
603      {   RAWBITS, 0xff3fcf, 24 }, { RAWBITS, 0xf3fcff, 24 },
604      {   RAWBITS, 0xd5aaad, 24 },
605      {   SECTOR_ID_GCR6 },
606      {   SECTOR_DATA_MAC, -1 },
607      {   RAWBITS, 0xdeaaff, 24 },
608      {   RAWBITS, 0xff, 8 },
609      { SECTOR_LOOP_END },
610      { END },
611};
612
613
614bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
615{
616
617      UINT8 sector_data[(256)*16];
618      memset(sector_data, 0, sizeof(sector_data));
619
620      desc_s sectors[16];
621      int format = 0;
622      int pos_data = 0;
623
624      int head_count = 1;
625
626      for(int track=0; track < 35; track++) {
627            for(int head=0; head < head_count; head++) {
628                  for(int si=0; si<16; si++) {
629                        UINT8 *data = sector_data + (256)*si;
630                        sectors[si].data = data;
631                        sectors[si].size = 256;
632                        sectors[si].sector_id = si;
633                        sectors[si].sector_info = format;
634                        io_generic_read(io, data, pos_data, 256);
635                        pos_data += 256;
636                  }
637                  generate_track(mac_gcr, track, head, sectors, 16, 3104*16, image);
638            }
639      }
640      return true;
641}
642
643UINT8 a2_16sect_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
644{
645      UINT8 v = 0;
646      int w1 = wrap;
647      while(wrap != w1+2 && !(v & 0x80)) {
648            v = v << 1 | ((buf[pos >> 3] >> (7-(pos & 7))) & 1);
649            pos++;
650            if(pos == ts) {
651                  pos = 0;
652                  wrap++;
653            }
654      }
655      return v;
656}
657
658void a2_16sect_format::update_chk(const UINT8 *data, int size, UINT32 &chk)
659{
660}
661
662bool a2_16sect_format::save(io_generic *io, floppy_image *image)
663{
664      int g_tracks, g_heads;
665      int visualgrid[16][35]; // visualizer grid, cleared/initialized below
666#define NOTFOUND 0
667#define ADDRFOUND 1
668#define ADDRGOOD 2
669#define DATAFOUND 4
670#define DATAGOOD 8
671#define DATAPOST 16
672      for (int i = 0; i < 16; i++) {
673         for (int j = 0; j < 35; j++) {
674            visualgrid[i][j] = 0;
675         }
676      }
677      image->get_actual_geometry(g_tracks, g_heads);
678
679      int head = 0;
680
681      int pos_data = 0;
682
683      for(int track=0; track < 70; track+=2) {
684            UINT8 sectdata[(256)*16];
685            memset(sectdata, 0, sizeof(sectdata));
686            int nsect = 16;
687            UINT8 buf[130000]; // originally 13000, multiread dfi disks need larger
688            int ts;
689fprintf(stderr,"DEBUG: a2_16sect_format::save() about to generate bitstream from physical track %d (logical %d)...", track, track/2);
690            generate_bitstream_from_track(track, head, 200000000/(3104*nsect*1), buf, ts, image); // 3104 needs tweaking, *3 is 3x multiread from a dfi disk
691fprintf(stderr,"done.\n");
692            int pos = 0;
693            int wrap = 0;
694            int hb = 0;
695            for(;;) {
696                  UINT8 v = gb(buf, ts, pos, wrap);
697                  if(v == 0xff)
698                        hb = 1;
699                  else if(hb == 1 && v == 0xd5)
700                        hb = 2;
701                  else if(hb == 2 && v == 0xaa)
702                        hb = 3;
703                  else if(hb == 3 && v == 0x96)
704                        hb = 4;
705                  else
706                        hb = 0;
707
708                  if(hb == 4) {
709                        UINT8 h[11];
710                        for(int i=0; i<11; i++)
711                              h[i] = gb(buf, ts, pos, wrap);
712                        //UINT8 v2 = gcr6bw_tb[h[2]];
713                        UINT8 vl = gcr4_decode(h[0],h[1]);
714                        UINT8 tr = gcr4_decode(h[2],h[3]);
715                        UINT8 se = gcr4_decode(h[4],h[5]);
716                        UINT8 chk = gcr4_decode(h[6],h[7]);
717                        UINT32 post = (h[8]<<16)|(h[9]<<8)|h[10];
718                        printf("Address Mark:\tVolume %d, Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s\n", vl, tr, se, chk, (chk ^ vl ^ tr ^ se)==0?"OK":"BAD", post, (post&0xFFFF00)==0xDEAA00?"OK":"BAD");
719                        if (tr == track/2 && se < nsect) {
720                              visualgrid[se][track/2] |= ADDRFOUND;
721                              visualgrid[se][track/2] |= (chk ^ vl ^ tr ^ se)==0?ADDRGOOD:0;
722                              int opos = pos;
723                              int owrap = wrap;
724                              hb = 0;
725                              for(int i=0; i<20 && hb != 4; i++) {
726                                    v = gb(buf, ts, pos, wrap);
727                                    if(v == 0xff)
728                                          hb = 1;
729                                    else if(hb == 1 && v == 0xd5)
730                                          hb = 2;
731                                    else if(hb == 2 && v == 0xaa)
732                                          hb = 3;
733                                    else if(hb == 3 && v == 0xad)
734                                          hb = 4;
735                                    else
736                                          hb = 0;
737                              }
738                              if(hb == 4) {
739                                    visualgrid[se][track/2] |= DATAFOUND;
740                                    UINT8 *dest = sectdata+(256)*se;
741                                    UINT8 data[0x157];
742                                    UINT32 dpost = 0;
743                                    UINT8 c = 0;
744                                    // first read in sector and decode to 6bit form
745                                    for(int i=0; i<0x156; i++) {
746                                          data[i] = gcr6bw_tb[gb(buf, ts, pos, wrap)] ^ c;
747                                          c = data[i];
748                                    //   printf("%02x ", c);
749                                    //   if (((i&0xf)+1)==0x10) printf("\n");
750                                    }
751                                    // read the checksum byte
752                                    data[0x156] = gcr6bw_tb[gb(buf,ts,pos,wrap)];
753                                    // now read the postamble bytes
754                                    for(int i=0; i<3; i++) {
755                                          dpost <<= 8;
756                                          dpost |= gb(buf, ts, pos, wrap);
757                                    }
758                                    // next combine in the upper 2 bits of each byte
759                                    UINT8 bit_swap[4] = { 0, 2, 1, 3 };
760                                    for(int i=0; i<0x56; i++)
761                                          data[i+0x056] = data[i+0x056]<<2 |  bit_swap[data[i]&3];
762                                    for(int i=0; i<0x56; i++)
763                                          data[i+0x0ac] = data[i+0x0ac]<<2 |  bit_swap[(data[i]>>2)&3];
764                                    for(int i=0; i<0x54; i++)
765                                          data[i+0x102] = data[i+0x102]<<2 |  bit_swap[(data[i]>>4)&3];
766                                    // now decode it into 256 bytes
767                                    // but only write it if the bitfield of the track shows datagood is NOT set.
768                                    // if it is set we don't want to overwrite a guaranteed good read with a bad one
769                                    if ((visualgrid[se][track/2]&DATAGOOD)==0) {
770                                       // TODO:
771                                       // if the current read is good but the postamble isn't, write it in.
772                                       // if the current read isn't good but the postamble is, its better than nothing.
773                                       // if the current read isn't good and neither is the postamble but nothing better
774                                       // has been written before, write it anyway.
775                                       for(int i=0x56; i<0x156; i++) {
776                                          UINT8 dv = data[i];
777                                          *dest++ = dv;
778                                       }
779                                    }
780                                    // do some checking
781                                    if ((data[0x156] != c) || (dpost&0xFFFF00)!=0xDEAA00) {
782                                    printf("Data Mark:\tChecksum xpctd %d found %d: %s, Postamble %03X: %s\n", data[0x156], c, (data[0x156]==c)?"OK":"BAD", dpost, (dpost&0xFFFF00)==0xDEAA00?"OK":"BAD");
783                                    }
784                                    else visualgrid[se][track/2] |= DATAGOOD;
785                              } else {
786                                    pos = opos;
787                                    wrap = owrap;
788                              }
789                        }
790                        hb = 0;
791                  }
792                  if(wrap)
793                        break;
794            }
795            for(int i=0; i<nsect; i++) {
796                  //if(nsect>0) printf("t%d,", track);
797                  UINT8 *data = sectdata + (256)*i;
798                  io_generic_write(io, data, pos_data, 256);
799                  pos_data += 256;
800            }
801            //printf("\n");
802      }
803      // display a little table of which sectors decoded ok
804      for (int j = 0; j < 35; j++) {
805         printf("T%2d: ",j);
806         for (int i = 0; i < 16; i++) {
807            if (visualgrid[i][j] == NOTFOUND) printf("-NF-");
808            else {
809            if (visualgrid[i][j] & ADDRFOUND) printf("a"); else printf(" ");
810            if (visualgrid[i][j] & ADDRGOOD) printf("A"); else printf(" ");
811            if (visualgrid[i][j] & DATAFOUND) printf("d"); else printf(" ");
812            if (visualgrid[i][j] & DATAGOOD) printf("D"); else printf(" ");
813            }
814            printf(" ");
815         }
816         printf("\n");
817      }
818
819      return true;
820}
821
822const floppy_format_type FLOPPY_A216S_FORMAT = &floppy_image_format_creator<a2_16sect_format>;
No newline at end of file
src/lib/formats/ap2_dsk.h
r14976r14977
11/*********************************************************************
22
3   ap2_dsk.h
3    ap2_dsk.h
44
5   Apple II disk images
5    Apple II disk images
66
77*********************************************************************/
88
r14976r14977
1414
1515/***************************************************************************
1616
17   Constants
17    Constants
1818
1919***************************************************************************/
2020
21#define APPLE2_NIBBLE_SIZE                      416
22#define APPLE2_SMALL_NIBBLE_SIZE        374
23#define APPLE2_TRACK_COUNT                      35
24#define APPLE2_SECTOR_COUNT                     16
25#define APPLE2_SECTOR_SIZE                      256
21#define APPLE2_NIBBLE_SIZE         416
22#define APPLE2_SMALL_NIBBLE_SIZE   374
23#define APPLE2_TRACK_COUNT         35
24#define APPLE2_SECTOR_COUNT         16
25#define APPLE2_SECTOR_SIZE         256
2626
2727
2828
r14976r14977
3030
3131LEGACY_FLOPPY_OPTIONS_EXTERN(apple2);
3232
33// new style code
34
35class a2_16sect_format : public floppy_image_format_t
36{
37public:
38      a2_16sect_format();
39
40      virtual int identify(io_generic *io, UINT32 form_factor);
41      virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
42      virtual bool save(io_generic *io, floppy_image *image);
43
44      virtual const char *name() const;
45      virtual const char *description() const;
46      virtual const char *extensions() const;
47      virtual bool supports_save() const;
48
49private:
50      static const desc_e mac_gcr[];
51
52      UINT8 gb(const UINT8 *buf, int ts, int &pos, int &wrap);
53      void update_chk(const UINT8 *data, int size, UINT32 &chk);
54};
55
56extern const floppy_format_type FLOPPY_A216S_FORMAT;
57
58#endif /* AP2_DISK_H */
No newline at end of file
33#endif /* AP2_DISK_H */
src/mess/audio/spchroms.c
r14976r14977
3333   }
3434   else
3535   {   /* speech ROM */
36      speechrom_data = machine.region(intf->memory_region)->base();
36      speechrom_data = machine.root_device().memregion(intf->memory_region)->base();
3737      /* take region length */
38      speechROMlen = machine.region(intf->memory_region)->bytes();
38      speechROMlen = machine.root_device().memregion(intf->memory_region)->bytes();
3939   }
4040}
4141
src/mess/audio/svision.c
r14976r14977
258258         UINT16 addr = state->dma.start + (unsigned) state->dma.pos / 2;
259259         if (addr >= 0x8000 && addr < 0xc000)
260260         {
261            sample = device->machine().region("user1")->base()[(addr & 0x3fff) | state->dma.ca14to16];
261            sample = device->machine().root_device().memregion("user1")->base()[(addr & 0x3fff) | state->dma.ca14to16];
262262         }
263263         else
264264         {
src/mess/machine/dgn_beta.c
r14976r14977
315315      }
316316
317317      state->m_PageRegs[state->m_TaskReg][Page].memory=readbank;
318      memory_set_bankptr(machine, page_num,readbank);
318      state->membank(page_num)->set_base(readbank);
319319
320320      LOG_BANK_UPDATE(("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)(FPTR)readbank));
321321      LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",state->m_TaskReg,Page));
322      LOG_BANK_UPDATE(("memory_set_bankptr(%X)\n",Page+1));
322      //LOG_BANK_UPDATE(("%X)\n",state->membank(Page+1)));
323323      LOG_BANK_UPDATE(("memory_install_write8_handler CPU=0\n"));
324324      LOG_BANK_UPDATE(("memory_install_write8_handler CPU=1\n"));
325325   }
r14976r14977
333333   int      Idx;
334334
335335   LOG_DEFAULT_TASK(("SetDefaultTask()\n"));
336   if (VERBOSE) debug_console_printf(machine, "Set Default task\n");
336   //if (VERBOSE) debug_console_printf(machine)->set_base("Set Default task\n");
337337
338338   state->m_TaskReg=NoPagingTask;
339339
r14976r14977
10631063
10641064    logerror("MACHINE_RESET( dgnbeta )\n");
10651065
1066   state->m_system_rom = machine.region(MAINCPU_TAG)->base();
1066   state->m_system_rom = state->memregion(MAINCPU_TAG)->base();
10671067
10681068   /* Make sure CPU 1 is started out halted ! */
10691069   cputag_set_input_line(machine, DMACPU_TAG, INPUT_LINE_HALT, ASSERT_LINE);
src/mess/machine/ataricrt.c
r14976r14977
4040static void a800_setbank(running_machine &machine, int cart_mounted)
4141{
4242   offs_t ram_top;
43
4443   // take care of 0x0000-0x7fff: RAM or NOP
4544   ram_top = MIN(machine.device<ram_device>(RAM_TAG)->size(), 0x8000) - 1;
4645   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, ram_top, "0000");
47   memory_set_bankptr(machine, "0000", machine.device<ram_device>(RAM_TAG)->pointer());
46   machine.root_device().membank("0000")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
4847
4948   // take care of 0x8000-0x9fff: A800 -> either right slot or RAM or NOP, others -> RAM or NOP
5049   // is there anything in the right slot?
5150   if (cart_mounted & RIGHT_CARTSLOT_MOUNTED)
5251   {
5352      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x9fff, "8000");
54      memory_set_bankptr(machine, "8000", machine.region("rslot")->base());
53      machine.root_device().membank("8000")->set_base(machine.root_device().memregion("rslot")->base());
5554      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0x9fff);
5655   }
5756   else if (a800_cart_type != BBSB)
r14976r14977
6059      if (ram_top > 0x8000)
6160      {
6261         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x8000, ram_top, "8000");
63         memory_set_bankptr(machine, "8000", machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
62         machine.root_device().membank("8000")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
6463      }
6564   }
6665
r14976r14977
7372         if (a800_cart_type == A800_16K)
7473         {
7574            machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x9fff, "8000");
76            memory_set_bankptr(machine, "8000", machine.region("lslot")->base());
75            machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base());
7776            machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0x9fff);
7877
79            memcpy(machine.region("maincpu")->base() + 0x10000, machine.region("lslot")->base() + 0x2000, 0x2000);
78            memcpy(machine.root_device().memregion("maincpu")->base() + 0x10000, machine.root_device().memregion("lslot")->base() + 0x2000, 0x2000);
8079         }
8180         else if (a800_cart_type == A800_8K)
82            memcpy(machine.region("maincpu")->base() + 0x10000, machine.region("lslot")->base(), 0x2000);
81            memcpy(machine.root_device().memregion("maincpu")->base() + 0x10000, machine.root_device().memregion("lslot")->base(), 0x2000);
8382         else
8483            fatalerror("This type of cart is not supported yet in this driver. Please use a400 or a800.\n");
8584      }
8685      else if (a800_cart_type == A800_16K)
8786      {
88         memory_set_bankptr(machine, "8000", machine.region("lslot")->base());
89         memory_set_bankptr(machine, "a000", machine.region("lslot")->base() + 0x2000);
87         machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base());
88         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base() + 0x2000);
9089         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0xbfff);
9190      }
9291      else if (a800_cart_type == BBSB)
r14976r14977
9493         // this requires separate banking in 0x8000 & 0x9000!
9594         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x8fff, "8000");
9695         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x9000, 0x9fff, "9000");
97         memory_set_bankptr(machine, "8000", machine.region("lslot")->base() + 0x0000);
98         memory_set_bankptr(machine, "9000", machine.region("lslot")->base() + 0x4000);
99         memory_set_bankptr(machine, "a000", machine.region("lslot")->base() + 0x8000);
96         machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base() + 0x0000);
97         machine.root_device().membank("9000")->set_base(machine.root_device().memregion("lslot")->base() + 0x4000);
98         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base() + 0x8000);
10099         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
101100      }
102101      else if (a800_cart_type == OSS_034M)
r14976r14977
104103         // this requires separate banking in 0xa000 & 0xb000!
105104         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xafff, "a000");
106105         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xb000, 0xbfff, "b000");
107         memory_set_bankptr(machine, "b000", machine.region("lslot")->base() + 0x3000);
106         machine.root_device().membank("b000")->set_base(machine.root_device().memregion("lslot")->base() + 0x3000);
108107         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
109108      }
110109      else if (a800_cart_type == OSS_M091)
r14976r14977
112111         // this requires separate banking in 0xa000 & 0xb000!
113112         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xafff, "a000");
114113         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xb000, 0xbfff, "b000");
115         memory_set_bankptr(machine, "b000", machine.region("lslot")->base());
114         machine.root_device().membank("b000")->set_base(machine.root_device().memregion("lslot")->base());
116115         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
117116      }
118117      else if (a800_cart_type == XEGS_32K)
119118      {
120         memory_set_bankptr(machine, "8000", machine.region("lslot")->base());
121         memory_set_bankptr(machine, "a000", machine.region("lslot")->base() + 0x6000);
119         machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base());
120         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base() + 0x6000);
122121         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0xbfff);
123122      }
124123      else
125124      {
126         memory_set_bankptr(machine, "a000", machine.region("lslot")->base());
125         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base());
127126         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
128127      }
129128   }
r14976r14977
173172{
174173   //  printf("written %x\n", data);
175174   int bank = data & 0x03;
176   memory_set_bankptr(space->machine(), "8000", space->machine().region("lslot")->base() + bank * 0x2000);
175   space->machine().root_device().membank("8000")->set_base(space->machine().root_device().memregion("lslot")->base() + bank * 0x2000);
177176}
178177
179178static WRITE8_HANDLER( w64_bank_w )
r14976r14977
181180//  printf("write to %x\n", offset);
182181
183182   if (offset < 8)
184      memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + offset * 0x2000);
183      space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + offset * 0x2000);
185184   else
186      memory_set_bankptr(space->machine(), "a000", space->machine().region("maincpu")->base());
185      space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("maincpu")->base());
187186   // FIXME: writes to 0x8-0xf should disable the cart
188187}
189188
r14976r14977
193192//  printf("write to %x\n", offset);
194193
195194   if (offset < 8)
196      memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + (7 - offset) * 0x2000);
195      space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + (7 - offset) * 0x2000);
197196   else
198      memory_set_bankptr(space->machine(), "a000", space->machine().region("maincpu")->base());
197      space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("maincpu")->base());
199198   // FIXME: writes to 0x8-0xf should disable the cart
200199}
201200
r14976r14977
203202{
204203//  printf("write to %x\n", 0x8000 + offset);
205204   if (offset >= 0xff6 && offset <= 0xff9)
206      memory_set_bankptr(space->machine(), "8000", space->machine().region("lslot")->base() + 0x0000 + (offset - 0xff6) * 0x1000);
205      space->machine().root_device().membank("8000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x0000 + (offset - 0xff6) * 0x1000);
207206}
208207
209208static WRITE8_HANDLER( bbsb_bankh_w )
210209{
211210//  printf("write to %x\n", 0x9000 + offset);
212211   if (offset >= 0xff6 && offset <= 0xff9)
213      memory_set_bankptr(space->machine(), "9000", space->machine().region("lslot")->base() + 0x4000 + (offset - 0xff6) * 0x1000);
212      space->machine().root_device().membank("9000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x4000 + (offset - 0xff6) * 0x1000);
214213}
215214
216215static WRITE8_HANDLER( oss_034m_w )
r14976r14977
219218   {
220219      case 0:
221220      case 1:
222         memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base());
223         memory_set_bankptr(space->machine(), "b000", space->machine().region("lslot")->base() + 0x3000);
221         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base());
222         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x3000);
224223         break;
225224      case 2:
226225      case 6:
227226         // docs says this should put 0xff in the 0xa000 bank -> let's point to the end of the cart
228         memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + 0x4000);
229         memory_set_bankptr(space->machine(), "b000", space->machine().region("lslot")->base() + 0x3000);
227         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x4000);
228         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x3000);
230229         break;
231230      case 3:
232231      case 7:
233         memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + 0x1000);
234         memory_set_bankptr(space->machine(), "b000", space->machine().region("lslot")->base() + 0x3000);
232         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x1000);
233         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x3000);
235234         break;
236235      case 4:
237236      case 5:
238         memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + 0x2000);
239         memory_set_bankptr(space->machine(), "b000", space->machine().region("lslot")->base() + 0x3000);
237         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x2000);
238         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x3000);
240239         break;
241240      default:
242         memory_set_bankptr(space->machine(), "a000", space->machine().region("maincpu")->base() + 0xa000);
243         memory_set_bankptr(space->machine(), "b000", space->machine().region("maincpu")->base() + 0xb000);
241         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("maincpu")->base() + 0xa000);
242         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("maincpu")->base() + 0xb000);
244243         break;
245244   }
246245}
r14976r14977
250249   switch (offset & 0x09)
251250   {
252251      case 0:
253         memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + 0x1000);
254         memory_set_bankptr(space->machine(), "b000", space->machine().region("lslot")->base());
252         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x1000);
253         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("lslot")->base());
255254         break;
256255      case 1:
257         memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + 0x3000);
258         memory_set_bankptr(space->machine(), "b000", space->machine().region("lslot")->base());
256         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x3000);
257         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("lslot")->base());
259258         break;
260259      case 8:
261         memory_set_bankptr(space->machine(), "a000", space->machine().region("maincpu")->base() + 0xa000);
262         memory_set_bankptr(space->machine(), "b000", space->machine().region("maincpu")->base() + 0xb000);
260         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("maincpu")->base() + 0xa000);
261         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("maincpu")->base() + 0xb000);
263262         break;
264263      case 9:
265         memory_set_bankptr(space->machine(), "a000", space->machine().region("lslot")->base() + 0x2000);
266         memory_set_bankptr(space->machine(), "b000", space->machine().region("lslot")->base());
264         space->machine().root_device().membank("a000")->set_base(space->machine().root_device().memregion("lslot")->base() + 0x2000);
265         space->machine().root_device().membank("b000")->set_base(space->machine().root_device().memregion("lslot")->base());
267266         break;
268267   }
269268}
r14976r14977
285284static READ8_HANDLER( bbsb_bankl_r )
286285{
287286   // return data from the selected bank (0,1,2,3)
288   UINT8 *mem = space->machine().region("lslot")->base();
287   UINT8 *mem = space->machine().root_device().memregion("lslot")->base();
289288   return &mem[0x0000 + bbsb_bankl * 0x1000];
290289}
291290
292291static READ8_HANDLER( bbsb_bankh_r )
293292{
294293   // return data from the selected bank (4,5,6,7)
295   UINT8 *mem = space->machine().region("lslot")->base();
294   UINT8 *mem = space->machine().root_device().memregion("lslot")->base();
296295   return &mem[0x4000 + bbsb_bankh * 0x1000];
297296}
298297#endif
r14976r14977
516515         size -= 0x10;
517516         start = 0x10;
518517      }
519      image.fread(image.device().machine().region("lslot")->base(), size - start);
518      image.fread(image.device().machine().root_device().memregion("lslot")->base(), size - start);
520519   }
521520   else
522521   {
523522      size = image.get_software_region_length("rom");
524      memcpy(image.device().machine().region("lslot")->base(), image.get_software_region("rom"), size);
523      memcpy(image.device().machine().root_device().memregion("lslot")->base(), image.get_software_region("rom"), size);
525524   }
526525
527526   a800_cart_loaded |= (size > 0x0000) ? 1 : 0;
r14976r14977
548547         size -= 0x10;
549548         start = 0x10;
550549      }
551      image.fread(image.device().machine().region("rslot")->base(), size - start);
550      image.fread(image.device().machine().root_device().memregion("rslot")->base(), size - start);
552551   }
553552   else
554553   {
555554      size = image.get_software_region_length("rom");
556      memcpy(image.device().machine().region("rslot")->base(), image.get_software_region("rom"), size);
555      memcpy(image.device().machine().root_device().memregion("rslot")->base(), image.get_software_region("rom"), size);
557556   }
558557
559558   a800_cart_loaded |= (size > 0x0000) ? 2 : 0;
r14976r14977
604603
605604DEVICE_IMAGE_LOAD( a5200_cart )
606605{
607   UINT8 *mem = image.device().machine().region("maincpu")->base();
606   UINT8 *mem = image.device().machine().root_device().memregion("maincpu")->base();
608607   UINT32 size;
609608   bool A13_mirr = FALSE;
610609
r14976r14977
644643
645644DEVICE_IMAGE_UNLOAD( a5200_cart )
646645{
647   UINT8 *mem = image.device().machine().region("maincpu")->base();
646   UINT8 *mem = image.device().machine().root_device().memregion("maincpu")->base();
648647   /* zap the cartridge memory (again) */
649648   memset(&mem[0x4000], 0x00, 0x8000);
650649}
r14976r14977
660659
661660static WRITE8_HANDLER( xegs_bankswitch )
662661{
663   UINT8 *cart = space->machine().region("user1")->base();
662   UINT8 *cart = space->machine().root_device().memregion("user1")->base();
664663   data &= xegs_banks - 1;
665   memory_set_bankptr(space->machine(), "bank0", cart + data * 0x2000);
664   space->machine().root_device().membank("bank0")->set_base(cart + data * 0x2000);
666665}
667666
668667MACHINE_START( xegs )
669668{
670669   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
671   UINT8 *cart = space->machine().region("user1")->base();
672   UINT8 *cpu  = space->machine().region("maincpu")->base();
670   UINT8 *cart = space->machine().root_device().memregion("user1")->base();
671   UINT8 *cpu  = space->machine().root_device().memregion("maincpu")->base();
673672
674673   atari_machine_start(machine);
675674   space->install_legacy_write_handler(0xd500, 0xd5ff, FUNC(xegs_bankswitch));
676675
677676   if (xegs_cart)
678677   {
679      memory_set_bankptr(machine, "bank0", cart);
680      memory_set_bankptr(machine, "bank1", cart + (xegs_banks - 1) * 0x2000);
678      machine.root_device().membank("bank0")->set_base(cart);
679      machine.root_device().membank("bank1")->set_base(cart + (xegs_banks - 1) * 0x2000);
681680   }
682681   else
683682   {
684683      // point to built-in Missile Command (this does not work well, though... FIXME!!)
685      memory_set_bankptr(machine, "bank0", cpu + 0x10000);
686      memory_set_bankptr(machine, "bank1", cpu + 0x10000);
684      machine.root_device().membank("bank0")->set_base(cpu + 0x10000);
685      machine.root_device().membank("bank1")->set_base(cpu + 0x10000);
687686   }
688687}
689688
690689DEVICE_IMAGE_LOAD( xegs_cart )
691690{
692691   UINT32 size;
693   UINT8 *ptr = image.device().machine().region("user1")->base();
692   UINT8 *ptr = image.device().machine().root_device().memregion("user1")->base();
694693
695694   if (image.software_entry() == NULL)
696695   {
src/mess/machine/apple3.c
r14976r14977
275275static void apple3_setbank(running_machine &machine,const char *mame_bank, UINT16 bank, offs_t offset)
276276{
277277   UINT8 *ptr;
278
278   apple3_state *state = machine.driver_data<apple3_state>();
279279   ptr = apple3_bankaddr(machine,bank, offset);
280   memory_set_bankptr(machine, mame_bank, ptr);
280   state->membank(mame_bank)->set_base(ptr);
281281
282282   if (LOG_MEMORY)
283283   {
r14976r14977
438438   else
439439      space->install_write_bank(0xF000, 0xFFFF, "bank7");
440440   if (state->m_via_0_a & 0x01)
441      memory_set_bankptr(machine,"bank7", machine.region("maincpu")->base());
441      state->membank("bank7")->set_base(machine.root_device().memregion("maincpu")->base());
442442   else
443443      apple3_setbank(machine,"bank7", ~0, 0x7000);
444444
r14976r14977
632632   else if (addr != (UINT8 *) ~0)
633633      result = *addr;
634634   else
635      result = machine().region("maincpu")->base()[offset % machine().region("maincpu")->bytes()];
635      result = memregion("maincpu")->base()[offset % memregion("maincpu")->bytes()];
636636   return result;
637637}
638638
r14976r14977
718718{
719719   apple3_state *state = machine.driver_data<apple3_state>();
720720   /* hack to get around VIA problem */
721   machine.region("maincpu")->base()[0x0685] = 0x00;
721   state->memregion("maincpu")->base()[0x0685] = 0x00;
722722
723723   state->m_enable_mask = 0;
724724   apple3_update_drives(machine.device("fdc"));
src/mess/machine/dai.c
r14976r14977
3737
3838static void dai_update_memory(running_machine &machine, int dai_rom_bank)
3939{
40   memory_set_bank(machine, "bank2", dai_rom_bank);
40   dai_state *state = machine.driver_data<dai_state>();
41   state->membank("bank2")->set_entry(dai_rom_bank);
4142}
4243
4344static TIMER_CALLBACK(dai_bootstrap_callback)
r14976r14977
147148   state->m_sound = machine.device("custom");
148149   state->m_tms5501 = machine.device("tms5501");
149150
150   memory_configure_bank(machine, "bank2", 0, 4, machine.region("maincpu")->base() + 0x010000, 0x1000);
151   state->membank("bank2")->configure_entries(0, 4, state->memregion("maincpu")->base() + 0x010000, 0x1000);
151152   machine.scheduler().timer_set(attotime::zero, FUNC(dai_bootstrap_callback));
152153   machine.scheduler().timer_pulse(attotime::from_hz(100), FUNC(dai_timer));   /* timer for tms5501 */
153154}
154155
155156MACHINE_RESET( dai )
156157{
157   memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
158   dai_state *state = machine.driver_data<dai_state>();
159   state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
158160}
159161
160162/***************************************************************************
src/mess/machine/cbmb.c
r14976r14977
283283static void cbmb_common_driver_init( running_machine &machine )
284284{
285285   cbmb_state *state = machine.driver_data<cbmb_state>();
286   state->m_chargen = machine.region("maincpu")->base() + 0x100000;
286   state->m_chargen = state->memregion("maincpu")->base() + 0x100000;
287287   /*    memset(c64_memory, 0, 0xfd00); */
288288
289289   machine.scheduler().timer_pulse(attotime::from_msec(10), FUNC(cbmb_frame_interrupt));
r14976r14977
472472{
473473   UINT32 size = image.length();
474474   const char *filetype = image.filetype();
475   UINT8 *cbmb_memory = image.device().machine().region("maincpu")->base();
475   UINT8 *cbmb_memory = image.device().machine().root_device().memregion("maincpu")->base();
476476   int address = 0;
477477
478478   /* Assign loading address according to extension */
src/mess/machine/mbee.c
r14976r14977
266266   address_space *mem = m_maincpu->memory().space(AS_PROGRAM);
267267
268268   // primary low banks
269   memory_set_bank(machine(), "boot", (data & 3) | ((data & 0x20) >> 3));
270   memory_set_bank(machine(), "bank1", (data & 3) | ((data & 0x20) >> 3));
269   membank("boot")->set_entry((data & 3) | ((data & 0x20) >> 3));
270   membank("bank1")->set_entry((data & 3) | ((data & 0x20) >> 3));
271271
272272   // 9000-EFFF
273   memory_set_bank(machine(), "bank9", (data & 4) ? 1 : 0);
273   membank("bank9")->set_entry((data & 4) ? 1 : 0);
274274
275275   // 8000-8FFF, F000-FFFF
276276   mem->unmap_readwrite (0x8000, 0x87ff);
r14976r14977
285285         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
286286         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
287287         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
288         memory_set_bank(machine(), "bank8l", 0); // rom
289         memory_set_bank(machine(), "bank8h", 0); // rom
288         membank("bank8l")->set_entry(0); // rom
289         membank("bank8h")->set_entry(0); // rom
290290         break;
291291      case 0x04:
292292         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
293293         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
294294         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
295295         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
296         memory_set_bank(machine(), "bank8l", 1); // ram
297         memory_set_bank(machine(), "bank8h", 1); // ram
296         membank("bank8l")->set_entry(1); // ram
297         membank("bank8h")->set_entry(1); // ram
298298         break;
299299      case 0x08:
300300      case 0x18:
r14976r14977
302302         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
303303         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
304304         mem->install_read_bank (0xf800, 0xffff, "bankfh");
305         memory_set_bank(machine(), "bank8l", 0); // rom
306         memory_set_bank(machine(), "bank8h", 0); // rom
307         memory_set_bank(machine(), "bankfl", 0); // ram
308         memory_set_bank(machine(), "bankfh", 0); // ram
305         membank("bank8l")->set_entry(0); // rom
306         membank("bank8h")->set_entry(0); // rom
307         membank("bankfl")->set_entry(0); // ram
308         membank("bankfh")->set_entry(0); // ram
309309         break;
310310      case 0x0c:
311311      case 0x1c:
r14976r14977
313313         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
314314         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
315315         mem->install_read_bank (0xf800, 0xffff, "bankfh");
316         memory_set_bank(machine(), "bank8l", 1); // ram
317         memory_set_bank(machine(), "bank8h", 1); // ram
318         memory_set_bank(machine(), "bankfl", 0); // ram
319         memory_set_bank(machine(), "bankfh", 0); // ram
316         membank("bank8l")->set_entry(1); // ram
317         membank("bank8h")->set_entry(1); // ram
318         membank("bankfl")->set_entry(0); // ram
319         membank("bankfh")->set_entry(0); // ram
320320         break;
321321      case 0x10:
322322      case 0x14:
r14976r14977
324324         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
325325         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
326326         mem->install_read_bank (0xf800, 0xffff, "bankfh");
327         memory_set_bank(machine(), "bankfl", 0); // ram
328         memory_set_bank(machine(), "bankfh", 0); // ram
327         membank("bankfl")->set_entry(0); // ram
328         membank("bankfh")->set_entry(0); // ram
329329         break;
330330   }
331331}
r14976r14977
348348   address_space *mem = m_maincpu->memory().space(AS_PROGRAM);
349349
350350   // primary low banks
351   memory_set_bank(machine(), "boot", (data & 3));
352   memory_set_bank(machine(), "bank1", (data & 3));
351   membank("boot")->set_entry((data & 3));
352   membank("bank1")->set_entry((data & 3));
353353
354354   // 9000-EFFF
355   memory_set_bank(machine(), "bank9", (data & 4) ? 1 : 0);
355   membank("bank9")->set_entry((data & 4) ? 1 : 0);
356356
357357   // 8000-8FFF, F000-FFFF
358358   mem->unmap_readwrite (0x8000, 0x87ff);
r14976r14977
367367         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
368368         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
369369         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
370         memory_set_bank(machine(), "bank8l", 0); // rom
371         memory_set_bank(machine(), "bank8h", 0); // rom
370         membank("bank8l")->set_entry(0); // rom
371         membank("bank8h")->set_entry(0); // rom
372372         break;
373373      case 0x04:
374374         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
375375         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
376376         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
377377         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
378         memory_set_bank(machine(), "bank8l", 1); // ram
379         memory_set_bank(machine(), "bank8h", 1); // ram
378         membank("bank8l")->set_entry(1); // ram
379         membank("bank8h")->set_entry(1); // ram
380380         break;
381381      case 0x08:
382382      case 0x18:
r14976r14977
384384         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
385385         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
386386         mem->install_read_bank (0xf800, 0xffff, "bankfh");
387         memory_set_bank(machine(), "bank8l", 0); // rom
388         memory_set_bank(machine(), "bank8h", 0); // rom
389         memory_set_bank(machine(), "bankfl", 0); // ram
390         memory_set_bank(machine(), "bankfh", 0); // ram
387         membank("bank8l")->set_entry(0); // rom
388         membank("bank8h")->set_entry(0); // rom
389         membank("bankfl")->set_entry(0); // ram
390         membank("bankfh")->set_entry(0); // ram
391391         break;
392392      case 0x0c:
393393      case 0x1c:
r14976r14977
395395         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
396396         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
397397         mem->install_read_bank (0xf800, 0xffff, "bankfh");
398         memory_set_bank(machine(), "bank8l", 1); // ram
399         memory_set_bank(machine(), "bank8h", 1); // ram
400         memory_set_bank(machine(), "bankfl", 0); // ram
401         memory_set_bank(machine(), "bankfh", 0); // ram
398         membank("bank8l")->set_entry(1); // ram
399         membank("bank8h")->set_entry(1); // ram
400         membank("bankfl")->set_entry(0); // ram
401         membank("bankfh")->set_entry(0); // ram
402402         break;
403403      case 0x10:
404404      case 0x14:
r14976r14977
406406         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
407407         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
408408         mem->install_read_bank (0xf800, 0xffff, "bankfh");
409         memory_set_bank(machine(), "bankfl", 0); // ram
410         memory_set_bank(machine(), "bankfh", 0); // ram
409         membank("bankfl")->set_entry(0); // ram
410         membank("bankfh")->set_entry(0); // ram
411411         break;
412412   }
413413}
r14976r14977
428428{
429429   if BIT(data, 2)
430430   {
431      memory_set_bank(machine(), "boot", 0);
432      memory_set_bank(machine(), "bankl", 0);
433      memory_set_bank(machine(), "bankh", 0);
431      membank("boot")->set_entry(0);
432      membank("bankl")->set_entry(0);
433      membank("bankh")->set_entry(0);
434434   }
435435   else
436436   {
437      memory_set_bank(machine(), "bankl", 1);
438      memory_set_bank(machine(), "bankh", 1);
437      membank("bankl")->set_entry(1);
438      membank("bankh")->set_entry(1);
439439   }
440440}
441441
r14976r14977
464464WRITE8_MEMBER( mbee_state::mbeeic_0a_w )
465465{
466466   m_0a = data;
467   memory_set_bank(machine(), "pak", data & 15);
467   membank("pak")->set_entry(data & 15);
468468}
469469
470470READ8_MEMBER( mbee_state::mbeepc_telcom_low_r )
471471{
472472/* Read of port 0A - set Telcom rom to first half */
473   memory_set_bank(machine(), "telcom", 0);
473   membank("telcom")->set_entry(0);
474474   return m_0a;
475475}
476476
477477READ8_MEMBER( mbee_state::mbeepc_telcom_high_r )
478478{
479479/* Read of port 10A - set Telcom rom to 2nd half */
480   memory_set_bank(machine(), "telcom", 1);
480   membank("telcom")->set_entry(1);
481481   return m_0a;
482482}
483483
r14976r14977
497497/* after the first 4 bytes have been read from ROM, switch the ram back in */
498498static TIMER_CALLBACK( mbee_reset )
499499{
500   memory_set_bank(machine, "boot", 0);
500   mbee_state *state = machine.driver_data<mbee_state>();
501   state->membank("boot")->set_entry(0);
501502}
502503
503504static void machine_reset_common_disk(running_machine &machine)
r14976r14977
510511
511512MACHINE_RESET( mbee )
512513{
513   memory_set_bank(machine, "boot", 1);
514   mbee_state *state = machine.driver_data<mbee_state>();
515   state->membank("boot")->set_entry(1);
514516   machine.scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
515517}
516518
517519MACHINE_RESET( mbee56 )
518520{
521   mbee_state *state = machine.driver_data<mbee_state>();
519522   machine_reset_common_disk(machine);
520   memory_set_bank(machine, "boot", 1);
523   state->membank("boot")->set_entry(1);
521524   machine.scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
522525}
523526
524527MACHINE_RESET( mbee64 )
525528{
529   mbee_state *state = machine.driver_data<mbee_state>();
526530   machine_reset_common_disk(machine);
527   memory_set_bank(machine, "boot", 1);
528   memory_set_bank(machine, "bankl", 1);
529   memory_set_bank(machine, "bankh", 1);
531   state->membank("boot")->set_entry(1);
532   state->membank("bankl")->set_entry(1);
533   state->membank("bankh")->set_entry(1);
530534}
531535
532536MACHINE_RESET( mbee128 )
r14976r14977
535539   address_space *mem = machine.device("maincpu")->memory().space(AS_PROGRAM);
536540   machine_reset_common_disk(machine);
537541   state->mbee128_50_w(*mem,0,0); // set banks to default
538   memory_set_bank(machine, "boot", 4); // boot time
542   state->membank("boot")->set_entry(4); // boot time
539543}
540544
541545MACHINE_RESET( mbee256 )
r14976r14977
547551   for (i = 0; i < 15; i++) state->m_mbee256_was_pressed[i] = 0;
548552   state->m_mbee256_q_pos = 0;
549553   state->mbee256_50_w(*mem,0,0); // set banks to default
550   memory_set_bank(machine, "boot", 8); // boot time
554   state->membank("boot")->set_entry(8); // boot time
551555   machine.scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
552556}
553557
r14976r14977
557561   UINT8 i;
558562   for (i = 0; i < 15; i++) state->m_mbee256_was_pressed[i] = 0;
559563   state->m_mbee256_q_pos = 0;
560   memory_set_bank(machine, "boot", 1);
564   state->membank("boot")->set_entry(1);
561565   machine.scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
562566}
563567
r14976r14977
588592DRIVER_INIT( mbee )
589593{
590594   mbee_state *state = machine.driver_data<mbee_state>();
591   UINT8 *RAM = machine.region("maincpu")->base();
592   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x8000);
595   UINT8 *RAM = state->memregion("maincpu")->base();
596   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000);
593597   state->m_size = 0x4000;
594598}
595599
596600DRIVER_INIT( mbeeic )
597601{
598602   mbee_state *state = machine.driver_data<mbee_state>();
599   UINT8 *RAM = machine.region("maincpu")->base();
600   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x8000);
603   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
604   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000);
601605
602   RAM = machine.region("pakrom")->base();
603   memory_configure_bank(machine, "pak", 0, 16, &RAM[0x0000], 0x2000);
606   RAM = state->memregion("pakrom")->base();
607   state->membank("pak")->configure_entries(0, 16, &RAM[0x0000], 0x2000);
604608
605   memory_set_bank(machine, "pak", 0);
609   state->membank("pak")->set_entry(0);
606610   state->m_size = 0x8000;
607611}
608612
609613DRIVER_INIT( mbeepc )
610614{
611615   mbee_state *state = machine.driver_data<mbee_state>();
612   UINT8 *RAM = machine.region("maincpu")->base();
613   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x8000);
616   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
617   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000);
614618
615   RAM = machine.region("telcomrom")->base();
616   memory_configure_bank(machine, "telcom", 0, 2, &RAM[0x0000], 0x1000);
619   RAM = machine.root_device().memregion("telcomrom")->base();
620   state->membank("telcom")->configure_entries(0, 2, &RAM[0x0000], 0x1000);
617621
618   RAM = machine.region("pakrom")->base();
619   memory_configure_bank(machine, "pak", 0, 16, &RAM[0x0000], 0x2000);
622   RAM = state->memregion("pakrom")->base();
623   state->membank("pak")->configure_entries(0, 16, &RAM[0x0000], 0x2000);
620624
621   memory_set_bank(machine, "pak", 0);
622   memory_set_bank(machine, "telcom", 0);
625   state->membank("pak")->set_entry(0);
626   state->membank("telcom")->set_entry(0);
623627   state->m_size = 0x8000;
624628}
625629
626630DRIVER_INIT( mbeepc85 )
627631{
628632   mbee_state *state = machine.driver_data<mbee_state>();
629   UINT8 *RAM = machine.region("maincpu")->base();
630   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x8000);
633   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
634   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000);
631635
632   RAM = machine.region("telcomrom")->base();
633   memory_configure_bank(machine, "telcom", 0, 2, &RAM[0x0000], 0x1000);
636   RAM = machine.root_device().memregion("telcomrom")->base();
637   state->membank("telcom")->configure_entries(0, 2, &RAM[0x0000], 0x1000);
634638
635   RAM = machine.region("pakrom")->base();
636   memory_configure_bank(machine, "pak", 0, 16, &RAM[0x0000], 0x2000);
639   RAM = state->memregion("pakrom")->base();
640   state->membank("pak")->configure_entries(0, 16, &RAM[0x0000], 0x2000);
637641
638   memory_set_bank(machine, "pak", 5);
639   memory_set_bank(machine, "telcom", 0);
642   state->membank("pak")->set_entry(5);
643   state->membank("telcom")->set_entry(0);
640644   state->m_size = 0x8000;
641645}
642646
643647DRIVER_INIT( mbeeppc )
644648{
645649   mbee_state *state = machine.driver_data<mbee_state>();
646   UINT8 *RAM = machine.region("maincpu")->base();
647   memory_configure_bank(machine, "boot", 0, 1, &RAM[0x0000], 0x0000);
650   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
651   state->membank("boot")->configure_entry(0, &RAM[0x0000]);
648652
649   RAM = machine.region("basicrom")->base();
650   memory_configure_bank(machine, "basic", 0, 2, &RAM[0x0000], 0x2000);
651   memory_configure_bank(machine, "boot", 1, 1, &RAM[0x0000], 0x0000);
653   RAM = machine.root_device().memregion("basicrom")->base();
654   state->membank("basic")->configure_entries(0, 2, &RAM[0x0000], 0x2000);
655   state->membank("boot")->configure_entry(1, &RAM[0x0000]);
652656
653   RAM = machine.region("telcomrom")->base();
654   memory_configure_bank(machine, "telcom", 0, 2, &RAM[0x0000], 0x1000);
657   RAM = machine.root_device().memregion("telcomrom")->base();
658   state->membank("telcom")->configure_entries(0, 2, &RAM[0x0000], 0x1000);
655659
656   RAM = machine.region("pakrom")->base();
657   memory_configure_bank(machine, "pak", 0, 16, &RAM[0x0000], 0x2000);
660   RAM = state->memregion("pakrom")->base();
661   state->membank("pak")->configure_entries(0, 16, &RAM[0x0000], 0x2000);
658662
659   memory_set_bank(machine, "pak", 5);
660   memory_set_bank(machine, "telcom", 0);
661   memory_set_bank(machine, "basic", 0);
663   state->membank("pak")->set_entry(5);
664   state->membank("telcom")->set_entry(0);
665   state->membank("basic")->set_entry(0);
662666   state->m_size = 0x8000;
663667}
664668
665669DRIVER_INIT( mbee56 )
666670{
667671   mbee_state *state = machine.driver_data<mbee_state>();
668   UINT8 *RAM = machine.region("maincpu")->base();
669   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xe000);
672   UINT8 *RAM = state->memregion("maincpu")->base();
673   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000);
670674   state->m_size = 0xe000;
671675}
672676
673677DRIVER_INIT( mbee64 )
674678{
675679   mbee_state *state = machine.driver_data<mbee_state>();
676   UINT8 *RAM = machine.region("maincpu")->base();
677   memory_configure_bank(machine, "boot", 0, 1, &RAM[0x0000], 0x0000);
678   memory_configure_bank(machine, "bankl", 0, 1, &RAM[0x1000], 0x0000);
679   memory_configure_bank(machine, "bankl", 1, 1, &RAM[0x9000], 0x0000);
680   memory_configure_bank(machine, "bankh", 0, 1, &RAM[0x8000], 0x0000);
680   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
681   state->membank("boot")->configure_entry(0, &RAM[0x0000]);
682   state->membank("bankl")->configure_entry(0, &RAM[0x1000]);
683   state->membank("bankl")->configure_entry(1, &RAM[0x9000]);
684   state->membank("bankh")->configure_entry(0, &RAM[0x8000]);
681685
682   RAM = machine.region("bootrom")->base();
683   memory_configure_bank(machine, "bankh", 1, 1, &RAM[0x0000], 0x0000);
684   memory_configure_bank(machine, "boot", 1, 1, &RAM[0x0000], 0x0000);
686   RAM = state->memregion("bootrom")->base();
687   state->membank("bankh")->configure_entry(1, &RAM[0x0000]);
688   state->membank("boot")->configure_entry(1, &RAM[0x0000]);
685689
686690   state->m_size = 0xf000;
687691}
r14976r14977
689693DRIVER_INIT( mbee128 )
690694{
691695   mbee_state *state = machine.driver_data<mbee_state>();
692   UINT8 *RAM = machine.region("maincpu")->base();
693   memory_configure_bank(machine, "boot", 0, 4, &RAM[0x0000], 0x8000); // standard banks 0000
694   memory_configure_bank(machine, "bank1", 0, 4, &RAM[0x1000], 0x8000); // standard banks 1000
695   memory_configure_bank(machine, "bank8l", 1, 1, &RAM[0x0000], 0x0000); // shadow ram
696   memory_configure_bank(machine, "bank8h", 1, 1, &RAM[0x0800], 0x0000); // shadow ram
697   memory_configure_bank(machine, "bank9", 1, 1, &RAM[0x1000], 0x0000); // shadow ram
698   memory_configure_bank(machine, "bankfl", 0, 1, &RAM[0xf000], 0x0000); // shadow ram
699   memory_configure_bank(machine, "bankfh", 0, 1, &RAM[0xf800], 0x0000); // shadow ram
696   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
697   state->membank("boot")->configure_entries(0, 4, &RAM[0x0000], 0x8000); // standard banks 0000
698   state->membank("bank1")->configure_entries(0, 4, &RAM[0x1000], 0x8000); // standard banks 1000
699   state->membank("bank8l")->configure_entry(1, &RAM[0x0000]); // shadow ram
700   state->membank("bank8h")->configure_entry(1, &RAM[0x0800]); // shadow ram
701   state->membank("bank9")->configure_entry(1, &RAM[0x1000]); // shadow ram
702   state->membank("bankfl")->configure_entry(0, &RAM[0xf000]); // shadow ram
703   state->membank("bankfh")->configure_entry(0, &RAM[0xf800]); // shadow ram
700704
701   RAM = machine.region("bootrom")->base();
702   memory_configure_bank(machine, "bank9", 0, 1, &RAM[0x1000], 0x0000); // rom
703   memory_configure_bank(machine, "boot", 4, 1, &RAM[0x0000], 0x0000); // rom at boot for 4usec
704   memory_configure_bank(machine, "bank8l", 0, 1, &RAM[0x0000], 0x0000); // rom
705   memory_configure_bank(machine, "bank8h", 0, 1, &RAM[0x0800], 0x0000); // rom
705   RAM = state->memregion("bootrom")->base();
706   state->membank("bank9")->configure_entry(0, &RAM[0x1000]); // rom
707   state->membank("boot")->configure_entry(4, &RAM[0x0000]); // rom at boot for 4usec
708   state->membank("bank8l")->configure_entry(0, &RAM[0x0000]); // rom
709   state->membank("bank8h")->configure_entry(0, &RAM[0x0800]); // rom
706710
707711   state->m_size = 0x8000;
708712}
r14976r14977
710714DRIVER_INIT( mbee256 )
711715{
712716   mbee_state *state = machine.driver_data<mbee_state>();
713   UINT8 *RAM = machine.region("maincpu")->base();
714   memory_configure_bank(machine, "boot", 0, 8, &RAM[0x0000], 0x8000); // standard banks 0000
715   memory_configure_bank(machine, "bank1", 0, 8, &RAM[0x1000], 0x8000); // standard banks 1000
716   memory_configure_bank(machine, "bank8l", 1, 1, &RAM[0x0000], 0x0000); // shadow ram
717   memory_configure_bank(machine, "bank8h", 1, 1, &RAM[0x0800], 0x0000); // shadow ram
718   memory_configure_bank(machine, "bank9", 1, 1, &RAM[0x1000], 0x0000); // shadow ram
719   memory_configure_bank(machine, "bankfl", 0, 1, &RAM[0xf000], 0x0000); // shadow ram
720   memory_configure_bank(machine, "bankfh", 0, 1, &RAM[0xf800], 0x0000); // shadow ram
717   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
718   state->membank("boot")->configure_entries(0, 8, &RAM[0x0000], 0x8000); // standard banks 0000
719   state->membank("bank1")->configure_entries(0, 8, &RAM[0x1000], 0x8000); // standard banks 1000
720   state->membank("bank8l")->configure_entry(1, &RAM[0x0000]); // shadow ram
721   state->membank("bank8h")->configure_entry(1, &RAM[0x0800]); // shadow ram
722   state->membank("bank9")->configure_entry(1, &RAM[0x1000]); // shadow ram
723   state->membank("bankfl")->configure_entry(0, &RAM[0xf000]); // shadow ram
724   state->membank("bankfh")->configure_entry(0, &RAM[0xf800]); // shadow ram
721725
722   RAM = machine.region("bootrom")->base();
723   memory_configure_bank(machine, "bank9", 0, 1, &RAM[0x1000], 0x0000); // rom
724   memory_configure_bank(machine, "boot", 8, 1, &RAM[0x0000], 0x0000); // rom at boot for 4usec
725   memory_configure_bank(machine, "bank8l", 0, 1, &RAM[0x0000], 0x0000); // rom
726   memory_configure_bank(machine, "bank8h", 0, 1, &RAM[0x0800], 0x0000); // rom
726   RAM = state->memregion("bootrom")->base();
727   state->membank("bank9")->configure_entry(0, &RAM[0x1000]); // rom
728   state->membank("boot")->configure_entry(8, &RAM[0x0000]); // rom at boot for 4usec
729   state->membank("bank8l")->configure_entry(0, &RAM[0x0000]); // rom
730   state->membank("bank8h")->configure_entry(0, &RAM[0x0800]); // rom
727731
728732   machine.scheduler().timer_pulse(attotime::from_hz(1), FUNC(mbee_rtc_irq));   /* timer for rtc */
729733   machine.scheduler().timer_pulse(attotime::from_hz(25), FUNC(mbee256_kbd));   /* timer for kbd */
r14976r14977
734738DRIVER_INIT( mbeett )
735739{
736740   mbee_state *state = machine.driver_data<mbee_state>();
737   UINT8 *RAM = machine.region("maincpu")->base();
738   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x8000);
741   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
742   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000);
739743
740   RAM = machine.region("telcomrom")->base();
741   memory_configure_bank(machine, "telcom", 0, 2, &RAM[0x0000], 0x1000);
744   RAM = machine.root_device().memregion("telcomrom")->base();
745   state->membank("telcom")->configure_entries(0, 2, &RAM[0x0000], 0x1000);
742746
743   RAM = machine.region("pakrom")->base();
744   memory_configure_bank(machine, "pak", 0, 16, &RAM[0x0000], 0x2000);
747   RAM = state->memregion("pakrom")->base();
748   state->membank("pak")->configure_entries(0, 16, &RAM[0x0000], 0x2000);
745749
746   memory_set_bank(machine, "pak", 5);
747   memory_set_bank(machine, "telcom", 0);
750   state->membank("pak")->set_entry(5);
751   state->membank("telcom")->set_entry(0);
748752
749753   machine.scheduler().timer_pulse(attotime::from_hz(1), FUNC(mbee_rtc_irq));   /* timer for rtc */
750754   machine.scheduler().timer_pulse(attotime::from_hz(25), FUNC(mbee256_kbd));   /* timer for kbd */
src/mess/machine/msx_slot.c
r14976r14977
3535   switch (page)
3636   {
3737   case 1:
38      memory_set_bankptr (machine,"bank1", mem);
38      state->membank ("bank1")->set_base (mem);
3939      break;
4040   case 2:
41      memory_set_bankptr (machine,"bank2", mem);
41      state->membank ("bank2")->set_base (mem);
4242      break;
4343   case 3:
44      memory_set_bankptr (machine,"bank3", mem);
44      state->membank ("bank3")->set_base (mem);
4545      break;
4646   case 4:
47      memory_set_bankptr (machine,"bank4", mem);
48      memory_set_bankptr (machine,"bank5", mem + 0x1ff8);
47      state->membank ("bank4")->set_base (mem);
48      state->membank ("bank5")->set_base (mem + 0x1ff8);
4949      space->install_read_bank(0x7ff8, 0x7fff, "bank5");
5050      break;
5151   case 5:
52      memory_set_bankptr (machine,"bank6", mem);
53      memory_set_bankptr (machine,"bank7", mem + 0x1800);
52      state->membank ("bank6")->set_base (mem);
53      state->membank ("bank7")->set_base (mem + 0x1800);
5454      space->install_read_bank(0x9800, 0x9fff, "bank7");
5555      break;
5656   case 6:
57      memory_set_bankptr (machine,"bank8", mem);
58      memory_set_bankptr (machine,"bank9", mem + 0x1800);
57      state->membank ("bank8")->set_base (mem);
58      state->membank ("bank9")->set_base (mem + 0x1800);
5959      space->install_read_bank(0xb800, 0xbfff, "bank9");
6060      break;
6161   case 7:
62      memory_set_bankptr (machine,"bank10", mem);
62      state->membank ("bank10")->set_base (mem);
6363      break;
6464   case 8:
65      memory_set_bankptr (machine,"bank11", mem);
65      state->membank ("bank11")->set_base (mem);
6666      state->m_top_page = mem;
6767      break;
6868   }
src/mess/machine/pc1350.c
r14976r14977
105105   machine.scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1350_power_up));
106106
107107   space->install_readwrite_bank(0x6000, 0x6fff, "bank1");
108   memory_set_bankptr(machine, "bank1", &machine.device<ram_device>(RAM_TAG)->pointer()[0x0000]);
108   state->membank("bank1")->set_base(&machine.device<ram_device>(RAM_TAG)->pointer()[0x0000]);
109109
110110   if (machine.device<ram_device>(RAM_TAG)->size() >= 0x3000)
111111   {
112112      space->install_readwrite_bank(0x4000, 0x5fff, "bank2");
113      memory_set_bankptr(machine, "bank2", &machine.device<ram_device>(RAM_TAG)->pointer()[0x1000]);
113      state->membank("bank2")->set_base(&machine.device<ram_device>(RAM_TAG)->pointer()[0x1000]);
114114   }
115115   else
116116   {
r14976r14977
120120   if (machine.device<ram_device>(RAM_TAG)->size() >= 0x5000)
121121   {
122122      space->install_readwrite_bank(0x2000, 0x3fff, "bank3");
123      memory_set_bankptr(machine, "bank3", &machine.device<ram_device>(RAM_TAG)->pointer()[0x3000]);
123      state->membank("bank3")->set_base(&machine.device<ram_device>(RAM_TAG)->pointer()[0x3000]);
124124   }
125125   else
126126   {
r14976r14977
128128   }
129129
130130   device_t *main_cpu = machine.device("maincpu");
131   UINT8 *ram = machine.region("maincpu")->base() + 0x2000;
131   UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x2000;
132132   UINT8 *cpu = sc61860_internal_ram(main_cpu);
133133
134134   machine.device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
src/mess/machine/pokemini.c
r14976r14977
13961396      image.fseek(0x2100, SEEK_SET);
13971397      size -= 0x2100;
13981398
1399      if (size != image.fread( image.device().machine().region("maincpu")->base() + 0x2100, size))
1399      if (size != image.fread( image.device().machine().root_device().memregion("maincpu")->base() + 0x2100, size))
14001400      {
14011401         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error occurred while reading ROM image");
14021402         return IMAGE_INIT_FAIL;
r14976r14977
14061406   {
14071407      UINT8 *cart_rom = image.get_software_region("rom");
14081408      UINT32 cart_rom_size = image.get_software_region_length("rom");
1409      memcpy(image.device().machine().region("maincpu")->base() + 0x2100, cart_rom + 0x2100, cart_rom_size - 0x2100);
1409      memcpy(image.device().machine().root_device().memregion("maincpu")->base() + 0x2100, cart_rom + 0x2100, cart_rom_size - 0x2100);
14101410   }
14111411
14121412   return IMAGE_INIT_PASS;
src/mess/machine/gamecom.c
r14976r14977
77
88static TIMER_CALLBACK(gamecom_clock_timer_callback)
99{
10   UINT8 * RAM = machine.region("maincpu")->base();
10   UINT8 * RAM = machine.root_device().memregion("maincpu")->base();
1111   UINT8 val = ( ( RAM[SM8521_CLKT] & 0x3F ) + 1 ) & 0x3F;
1212   RAM[SM8521_CLKT] = ( RAM[SM8521_CLKT] & 0xC0 ) | val;
1313   cputag_set_input_line(machine, "maincpu", CK_INT, ASSERT_LINE );
r14976r14977
1616MACHINE_RESET( gamecom )
1717{
1818   gamecom_state *state = machine.driver_data<gamecom_state>();
19   UINT8 *rom = machine.region("kernel")->base();
20   memory_set_bankptr( machine, "bank1", rom );
21   memory_set_bankptr( machine, "bank2", rom );
22   memory_set_bankptr( machine, "bank3", rom );
23   memory_set_bankptr( machine, "bank4", rom );
19   UINT8 *rom = state->memregion("kernel")->base();
20   state->membank( "bank1" )->set_base( rom );
21   state->membank( "bank2" )->set_base( rom );
22   state->membank( "bank3" )->set_base( rom );
23   state->membank( "bank4" )->set_base( rom );
2424
2525   state->m_cartridge = NULL;
2626}
r14976r14977
3232   if (data < 0x20)
3333   {
3434      /* select internal ROM bank */
35      memory_set_bankptr( machine(), bank, machine().region("kernel")->base() + (data << 13) );
35      membank( bank )->set_base( memregion("kernel")->base() + (data << 13) );
3636   }
3737   else
3838   {
3939      /* select cartridge bank */
4040      if ( m_cartridge )
41         memory_set_bankptr( machine(), bank, m_cartridge + ( data << 13 ) );
41         membank( bank )->set_base( m_cartridge + ( data << 13 ) );
4242   }
4343}
4444
r14976r14977
345345void gamecom_handle_dma( device_t *device, int cycles )
346346{
347347   gamecom_state *state = device->machine().driver_data<gamecom_state>();
348   UINT8 * RAM = device->machine().region("maincpu")->base();
348   UINT8 * RAM = device->machine().root_device().memregion("maincpu")->base();
349349   UINT8 data = RAM[SM8521_DMC];
350350   state->m_dma.overwrite_mode = data & 0x01;
351351   state->m_dma.transfer_mode = data & 0x06;
r14976r14977
391391      state->m_dma.source_width = 64;
392392      state->m_dma.source_mask = 0x3FFF;
393393      if ( RAM[SM8521_DMBR] < 16 )
394         state->m_dma.source_bank = device->machine().region("kernel")->base() + (RAM[SM8521_DMBR] << 14);
394         state->m_dma.source_bank = state->memregion("kernel")->base() + (RAM[SM8521_DMBR] << 14);
395395      else
396396      if (state->m_cartridge)
397397         state->m_dma.source_bank = state->m_cartridge + (RAM[SM8521_DMBR] << 14);
r14976r14977
504504void gamecom_update_timers( device_t *device, int cycles )
505505{
506506   gamecom_state *state = device->machine().driver_data<gamecom_state>();
507   UINT8 * RAM = device->machine().region("maincpu")->base();
507   UINT8 * RAM = state->memregion("maincpu")->base();
508508   if ( state->m_timer[0].enabled )
509509   {
510510      state->m_timer[0].state_count += cycles;
r14976r14977
539539{
540540   gamecom_state *state = machine.driver_data<gamecom_state>();
541541   state->m_clock_timer = machine.scheduler().timer_alloc(FUNC(gamecom_clock_timer_callback));
542   state->m_p_ram = machine.region("maincpu")->base(); // required here because pio_w gets called before machine_reset
542   state->m_p_ram = state->memregion("maincpu")->base(); // required here because pio_w gets called before machine_reset
543543}
544544
545545DEVICE_IMAGE_LOAD( gamecom_cart1 )
r14976r14977
548548   UINT32 filesize;
549549   UINT32 load_offset = 0;
550550
551   state->m_cartridge1 = image.device().machine().region("cart1")->base();
551   state->m_cartridge1 = state->memregion("cart1")->base();
552552
553553   if (image.software_entry() == NULL)
554554      filesize = image.length();
r14976r14977
595595   UINT32 filesize;
596596   UINT32 load_offset = 0;
597597
598   state->m_cartridge2 = image.device().machine().region("cart2")->base();
598   state->m_cartridge2 = state->memregion("cart2")->base();
599599
600600//  if (image.software_entry() == NULL)
601601      filesize = image.length();
src/mess/machine/coco_pak.c
r14976r14977
113113
114114UINT8* coco_pak_device::get_cart_base()
115115{
116   return subregion(CARTSLOT_TAG)->base();
116   return memregion(CARTSLOT_TAG)->base();
117117}
118118
119119/***************************************************************************
r14976r14977
169169{
170170   UINT64 pos;
171171   UINT32 i;
172   UINT8 *rom = subregion(CARTSLOT_TAG)->base();
173   UINT32 rom_length = subregion(CARTSLOT_TAG)->bytes();
172   UINT8 *rom = memregion(CARTSLOT_TAG)->base();
173   UINT32 rom_length = memregion(CARTSLOT_TAG)->bytes();
174174
175175   pos = (bank * 0x4000) % m_cart->length();
176176
src/mess/machine/pmd85.c
r14976r14977
3333
3434   if (state->m_startup_mem_map)
3535   {
36      UINT8 *mem = machine.region("maincpu")->base();
36      UINT8 *mem = state->memregion("maincpu")->base();
3737
3838      space->unmap_write(0x0000, 0x0fff);
3939      space->nop_write(0x1000, 0x1fff);
r14976r14977
4343      space->nop_read(0x1000, 0x1fff);
4444      space->nop_read(0x3000, 0x3fff);
4545
46      memory_set_bankptr(machine, "bank1", mem + 0x010000);
47      memory_set_bankptr(machine, "bank3", mem + 0x010000);
48      memory_set_bankptr(machine, "bank5", ram + 0xc000);
46      state->membank("bank1")->set_base(mem + 0x010000);
47      state->membank("bank3")->set_base(mem + 0x010000);
48      state->membank("bank5")->set_base(ram + 0xc000);
4949
50      memory_set_bankptr(machine, "bank6", mem + 0x010000);
51      memory_set_bankptr(machine, "bank7", mem + 0x010000);
52      memory_set_bankptr(machine, "bank8", ram + 0xc000);
50      state->membank("bank6")->set_base(mem + 0x010000);
51      state->membank("bank7")->set_base(mem + 0x010000);
52      state->membank("bank8")->set_base(ram + 0xc000);
5353   }
5454   else
5555   {
r14976r14977
6262      space->install_read_bank(0x1000, 0x1fff, "bank2");
6363      space->install_read_bank(0x3000, 0x3fff, "bank4");
6464
65      memory_set_bankptr(machine, "bank1", ram);
66      memory_set_bankptr(machine, "bank2", ram + 0x1000);
67      memory_set_bankptr(machine, "bank3", ram + 0x2000);
68      memory_set_bankptr(machine, "bank4", ram + 0x3000);
69      memory_set_bankptr(machine, "bank5", ram + 0x4000);
65      state->membank("bank1")->set_base(ram);
66      state->membank("bank2")->set_base(ram + 0x1000);
67      state->membank("bank3")->set_base(ram + 0x2000);
68      state->membank("bank4")->set_base(ram + 0x3000);
69      state->membank("bank5")->set_base(ram + 0x4000);
7070   }
7171}
7272
r14976r14977
7878
7979   if (state->m_startup_mem_map)
8080   {
81      UINT8 *mem = machine.region("maincpu")->base();
81      UINT8 *mem = state->memregion("maincpu")->base();
8282
8383      space->unmap_write(0x0000, 0x0fff);
8484      space->unmap_write(0x2000, 0x2fff);
8585
86      memory_set_bankptr(machine, "bank1", mem + 0x010000);
87      memory_set_bankptr(machine, "bank2", ram + 0x9000);
88      memory_set_bankptr(machine, "bank3", mem + 0x010000);
89      memory_set_bankptr(machine, "bank4", ram + 0xb000);
90      memory_set_bankptr(machine, "bank5", ram + 0xc000);
91      memory_set_bankptr(machine, "bank6", mem + 0x010000);
92      memory_set_bankptr(machine, "bank7", ram + 0x9000);
93      memory_set_bankptr(machine, "bank8", mem + 0x010000);
94      memory_set_bankptr(machine, "bank9", ram + 0xb000);
95      memory_set_bankptr(machine, "bank10", ram + 0xc000);
86      state->membank("bank1")->set_base(mem + 0x010000);
87      state->membank("bank2")->set_base(ram + 0x9000);
88      state->membank("bank3")->set_base(mem + 0x010000);
89      state->membank("bank4")->set_base(ram + 0xb000);
90      state->membank("bank5")->set_base(ram + 0xc000);
91      state->membank("bank6")->set_base(mem + 0x010000);
92      state->membank("bank7")->set_base(ram + 0x9000);
93      state->membank("bank8")->set_base(mem + 0x010000);
94      state->membank("bank9")->set_base(ram + 0xb000);
95      state->membank("bank10")->set_base(ram + 0xc000);
9696
9797   }
9898   else
r14976r14977
100100      space->install_write_bank(0x0000, 0x0fff, "bank1");
101101      space->install_write_bank(0x2000, 0x2fff, "bank3");
102102
103      memory_set_bankptr(machine, "bank1", ram);
104      memory_set_bankptr(machine, "bank2", ram + 0x1000);
105      memory_set_bankptr(machine, "bank3", ram + 0x2000);
106      memory_set_bankptr(machine, "bank4", ram + 0x5000);
107      memory_set_bankptr(machine, "bank5", ram + 0x4000);
103      state->membank("bank1")->set_base(ram);
104      state->membank("bank2")->set_base(ram + 0x1000);
105      state->membank("bank3")->set_base(ram + 0x2000);
106      state->membank("bank4")->set_base(ram + 0x5000);
107      state->membank("bank5")->set_base(ram + 0x4000);
108108   }
109109}
110110
111111static void pmd853_update_memory(running_machine &machine)
112112{
113113   pmd85_state *state = machine.driver_data<pmd85_state>();
114   UINT8 *mem = machine.region("maincpu")->base();
114   UINT8 *mem = state->memregion("maincpu")->base();
115115   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
116116
117117   if (state->m_startup_mem_map)
118118   {
119      memory_set_bankptr(machine, "bank1", mem + 0x010000);
120      memory_set_bankptr(machine, "bank2", mem + 0x010000);
121      memory_set_bankptr(machine, "bank3", mem + 0x010000);
122      memory_set_bankptr(machine, "bank4", mem + 0x010000);
123      memory_set_bankptr(machine, "bank5", mem + 0x010000);
124      memory_set_bankptr(machine, "bank6", mem + 0x010000);
125      memory_set_bankptr(machine, "bank7", mem + 0x010000);
126      memory_set_bankptr(machine, "bank8", mem + 0x010000);
127      memory_set_bankptr(machine, "bank9", ram);
128      memory_set_bankptr(machine, "bank10", ram + 0x2000);
129      memory_set_bankptr(machine, "bank11", ram + 0x4000);
130      memory_set_bankptr(machine, "bank12", ram + 0x6000);
131      memory_set_bankptr(machine, "bank13", ram + 0x8000);
132      memory_set_bankptr(machine, "bank14", ram + 0xa000);
133      memory_set_bankptr(machine, "bank15", ram + 0xc000);
134      memory_set_bankptr(machine, "bank16", ram + 0xe000);
119      state->membank("bank1")->set_base(mem + 0x010000);
120      state->membank("bank2")->set_base(mem + 0x010000);
121      state->membank("bank3")->set_base(mem + 0x010000);
122      state->membank("bank4")->set_base(mem + 0x010000);
123      state->membank("bank5")->set_base(mem + 0x010000);
124      state->membank("bank6")->set_base(mem + 0x010000);
125      state->membank("bank7")->set_base(mem + 0x010000);
126      state->membank("bank8")->set_base(mem + 0x010000);
127      state->membank("bank9")->set_base(ram);
128      state->membank("bank10")->set_base(ram + 0x2000);
129      state->membank("bank11")->set_base(ram + 0x4000);
130      state->membank("bank12")->set_base(ram + 0x6000);
131      state->membank("bank13")->set_base(ram + 0x8000);
132      state->membank("bank14")->set_base(ram + 0xa000);
133      state->membank("bank15")->set_base(ram + 0xc000);
134      state->membank("bank16")->set_base(ram + 0xe000);
135135   }
136136   else
137137   {
138      memory_set_bankptr(machine,  "bank1", ram);
139      memory_set_bankptr(machine,  "bank2", ram + 0x2000);
140      memory_set_bankptr(machine,  "bank3", ram + 0x4000);
141      memory_set_bankptr(machine,  "bank4", ram + 0x6000);
142      memory_set_bankptr(machine,  "bank5", ram + 0x8000);
143      memory_set_bankptr(machine,  "bank6", ram + 0xa000);
144      memory_set_bankptr(machine,  "bank7", ram + 0xc000);
145      memory_set_bankptr(machine,  "bank8", state->m_pmd853_memory_mapping ? mem + 0x010000 : ram + 0xe000);
138      state->membank("bank1")->set_base(ram);
139      state->membank("bank2")->set_base(ram + 0x2000);
140      state->membank("bank3")->set_base(ram + 0x4000);
141      state->membank("bank4")->set_base(ram + 0x6000);
142      state->membank("bank5")->set_base(ram + 0x8000);
143      state->membank("bank6")->set_base(ram + 0xa000);
144      state->membank("bank7")->set_base(ram + 0xc000);
145      state->membank("bank8")->set_base(state->m_pmd853_memory_mapping ? mem + 0x010000 : ram + 0xe000);
146146   }
147147}
148148
r14976r14977
154154
155155   if (state->m_startup_mem_map)
156156   {
157      UINT8 *mem = machine.region("maincpu")->base();
157      UINT8 *mem = state->memregion("maincpu")->base();
158158
159159      space->unmap_write(0x0000, 0x0fff);
160160      space->unmap_write(0x1000, 0x33ff);
161161      space->nop_write(0x3400, 0x3fff);
162162
163      memory_set_bankptr(machine, "bank1", mem + 0x010000);
164      memory_set_bankptr(machine, "bank2", mem + 0x011000);
165      memory_set_bankptr(machine, "bank4", ram + 0xc000);
166      memory_set_bankptr(machine, "bank5", mem + 0x010000);
167      memory_set_bankptr(machine, "bank6", mem + 0x011000);
168      memory_set_bankptr(machine, "bank7", ram + 0xc000);
163      state->membank("bank1")->set_base(mem + 0x010000);
164      state->membank("bank2")->set_base(mem + 0x011000);
165      state->membank("bank4")->set_base(ram + 0xc000);
166      state->membank("bank5")->set_base(mem + 0x010000);
167      state->membank("bank6")->set_base(mem + 0x011000);
168      state->membank("bank7")->set_base(ram + 0xc000);
169169   }
170170   else
171171   {
r14976r14977
173173      space->install_write_bank(0x1000, 0x33ff, "bank2");
174174      space->install_write_bank(0x3400, 0x3fff, "bank3");
175175
176      memory_set_bankptr(machine, "bank1", ram);
177      memory_set_bankptr(machine, "bank2", ram + 0x1000);
178      memory_set_bankptr(machine, "bank3", ram + 0x3400);
179      memory_set_bankptr(machine, "bank4", ram + 0x4000);
176      state->membank("bank1")->set_base(ram);
177      state->membank("bank2")->set_base(ram + 0x1000);
178      state->membank("bank3")->set_base(ram + 0x3400);
179      state->membank("bank4")->set_base(ram + 0x4000);
180180   }
181181}
182182
r14976r14977
188188
189189   if (state->m_startup_mem_map)
190190   {
191      UINT8 *mem = machine.region("maincpu")->base();
191      UINT8 *mem = state->memregion("maincpu")->base();
192192
193193      space->unmap_write(0x0000, 0x3fff);
194194
195      memory_set_bankptr(machine, "bank1", mem + 0x010000);
196      memory_set_bankptr(machine, "bank2", ram + 0xc000);
197      memory_set_bankptr(machine, "bank3", mem + 0x010000);
198      memory_set_bankptr(machine, "bank4", ram + 0xc000);
195      state->membank("bank1")->set_base(mem + 0x010000);
196      state->membank("bank2")->set_base(ram + 0xc000);
197      state->membank("bank3")->set_base(mem + 0x010000);
198      state->membank("bank4")->set_base(ram + 0xc000);
199199   }
200200   else
201201   {
202202      space->install_write_bank(0x0000, 0x3fff, "bank1");
203203
204      memory_set_bankptr(machine, "bank1", ram);
205      memory_set_bankptr(machine, "bank2", ram + 0x4000);
204      state->membank("bank1")->set_base(ram);
205      state->membank("bank2")->set_base(ram + 0x4000);
206206   }
207207}
208208
r14976r14977
210210{
211211   pmd85_state *state = machine.driver_data<pmd85_state>();
212212   address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM);
213   UINT8 *mem = machine.region("maincpu")->base();
213   UINT8 *mem = state->memregion("maincpu")->base();
214214   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
215215
216216   if (state->m_startup_mem_map)
217217   {
218218      space->unmap_write(0x0000, 0x3fff);
219219
220      memory_set_bankptr(machine, "bank1", mem + 0x010000);
221      memory_set_bankptr(machine, "bank2", ram + 0x4000);
222      memory_set_bankptr(machine, "bank3", mem + 0x010000);
223      memory_set_bankptr(machine, "bank4", ram + 0xc000);
220      state->membank("bank1")->set_base(mem + 0x010000);
221      state->membank("bank2")->set_base(ram + 0x4000);
222      state->membank("bank3")->set_base(mem + 0x010000);
223      state->membank("bank4")->set_base(ram + 0xc000);
224224   }
225225   else
226226   {
227227      space->install_write_bank(0x0000, 0x3fff, "bank1");
228      memory_set_bankptr(machine, "bank1", ram);
229      memory_set_bankptr(machine, "bank2", ram + 0x4000);
228      state->membank("bank1")->set_base(ram);
229      state->membank("bank2")->set_base(ram + 0x4000);
230230   }
231231}
232232
r14976r14977
459459static READ8_DEVICE_HANDLER ( pmd85_ppi_3_porta_r )
460460{
461461   pmd85_state *state = device->machine().driver_data<pmd85_state>();
462   if (device->machine().region("user1")->base() != NULL)
463      return device->machine().region("user1")->base()[state->m_ppi_port_outputs[3][1] | (state->m_ppi_port_outputs[3][2] << 8)];
462   if (device->machine().root_device().memregion("user1")->base() != NULL)
463      return state->memregion("user1")->base()[state->m_ppi_port_outputs[3][1] | (state->m_ppi_port_outputs[3][2] << 8)];
464464   else
465465      return 0;
466466}
src/mess/machine/egret.c
r14976r14977
379379   save_item(NAME(disk_pram));
380380
381381   astring tempstring;
382   UINT8 *rom = device().machine().region(device().subtag(tempstring, EGRET_CPU_TAG))->base();
382   UINT8 *rom = device().machine().root_device().memregion(device().subtag(tempstring, EGRET_CPU_TAG))->base();
383383
384384    if (rom)
385385    {
src/mess/machine/c2040.c
r14976r14977
14641464inline void base_c2040_device::initialize(int drives)
14651465{
14661466   // find GCR ROM
1467   m_gcr = subregion("gcr")->base();
1467   m_gcr = memregion("gcr")->base();
14681468
14691469   // install image callbacks
14701470   m_unit[0].m_image = m_image0;
src/mess/machine/c16.c
r14976r14977
106106static void c16_bankswitch( running_machine &machine )
107107{
108108   c16_state *state = machine.driver_data<c16_state>();
109   UINT8 *rom = machine.region("maincpu")->base();
110   memory_set_bankptr(machine, "bank9", state->m_messram->pointer());
109   UINT8 *rom = state->memregion("maincpu")->base();
110   state->membank("bank9")->set_base(state->m_messram->pointer());
111111
112112   switch (state->m_lowrom)
113113   {
114114   case 0:
115      memory_set_bankptr(machine, "bank2", rom + 0x10000);
115      state->membank("bank2")->set_base(rom + 0x10000);
116116      break;
117117   case 1:
118      memory_set_bankptr(machine, "bank2", rom + 0x18000);
118      state->membank("bank2")->set_base(rom + 0x18000);
119119      break;
120120   case 2:
121      memory_set_bankptr(machine, "bank2", rom + 0x20000);
121      state->membank("bank2")->set_base(rom + 0x20000);
122122      break;
123123   case 3:
124      memory_set_bankptr(machine, "bank2", rom + 0x28000);
124      state->membank("bank2")->set_base(rom + 0x28000);
125125      break;
126126   }
127127
128128   switch (state->m_highrom)
129129   {
130130   case 0:
131      memory_set_bankptr(machine, "bank3", rom + 0x14000);
132      memory_set_bankptr(machine, "bank8", rom + 0x17f20);
131      state->membank("bank3")->set_base(rom + 0x14000);
132      state->membank("bank8")->set_base(rom + 0x17f20);
133133      break;
134134   case 1:
135      memory_set_bankptr(machine, "bank3", rom + 0x1c000);
136      memory_set_bankptr(machine, "bank8", rom + 0x1ff20);
135      state->membank("bank3")->set_base(rom + 0x1c000);
136      state->membank("bank8")->set_base(rom + 0x1ff20);
137137      break;
138138   case 2:
139      memory_set_bankptr(machine, "bank3", rom + 0x24000);
140      memory_set_bankptr(machine, "bank8", rom + 0x27f20);
139      state->membank("bank3")->set_base(rom + 0x24000);
140      state->membank("bank8")->set_base(rom + 0x27f20);
141141      break;
142142   case 3:
143      memory_set_bankptr(machine, "bank3", rom + 0x2c000);
144      memory_set_bankptr(machine, "bank8", rom + 0x2ff20);
143      state->membank("bank3")->set_base(rom + 0x2c000);
144      state->membank("bank8")->set_base(rom + 0x2ff20);
145145      break;
146146   }
147   memory_set_bankptr(machine, "bank4", rom + 0x17c00);
147   state->membank("bank4")->set_base(rom + 0x17c00);
148148}
149149
150150WRITE8_HANDLER( c16_switch_to_rom )
r14976r14977
186186
187187   ted7360_rom_switch_w(state->m_ted7360, 0);
188188
189   memory_set_bankptr(space->machine(), "bank2", ram + (0x8000 % ram_size));
190   memory_set_bankptr(space->machine(), "bank3", ram + (0xc000 % ram_size));
191   memory_set_bankptr(space->machine(), "bank4", ram + (0xfc00 % ram_size));
192   memory_set_bankptr(space->machine(), "bank8", ram + (0xff20 % ram_size));
189   state->membank("bank2")->set_base(ram + (0x8000 % ram_size));
190   state->membank("bank3")->set_base(ram + (0xc000 % ram_size));
191   state->membank("bank4")->set_base(ram + (0xfc00 % ram_size));
192   state->membank("bank8")->set_base(ram + (0xff20 % ram_size));
193193}
194194
195195UINT8 c16_read_keyboard( running_machine &machine, int databus )
r14976r14977
396396static void c16_common_driver_init( running_machine &machine )
397397{
398398   c16_state *state = machine.driver_data<c16_state>();
399   UINT8 *rom = machine.region("maincpu")->base();
399   UINT8 *rom = state->memregion("maincpu")->base();
400400
401401   /* initial bankswitch (notice that TED7360 is init to ROM) */
402   memory_set_bankptr(machine, "bank2", rom + 0x10000);
403   memory_set_bankptr(machine, "bank3", rom + 0x14000);
404   memory_set_bankptr(machine, "bank4", rom + 0x17c00);
405   memory_set_bankptr(machine, "bank8", rom + 0x17f20);
402   state->membank("bank2")->set_base(rom + 0x10000);
403   state->membank("bank3")->set_base(rom + 0x14000);
404   state->membank("bank4")->set_base(rom + 0x17c00);
405   state->membank("bank8")->set_base(rom + 0x17f20);
406406
407407   state->m_mem10000 = rom + 0x10000;
408408   state->m_mem14000 = rom + 0x14000;
r14976r14977
466466
467467   if (state->m_pal)
468468   {
469      memory_set_bankptr(machine, "bank1", ram + (0x4000 % ram_size));
469      state->membank("bank1")->set_base(ram + (0x4000 % ram_size));
470470
471      memory_set_bankptr(machine, "bank5", ram + (0x4000 % ram_size));
472      memory_set_bankptr(machine, "bank6", ram + (0x8000 % ram_size));
473      memory_set_bankptr(machine, "bank7", ram + (0xc000 % ram_size));
471      state->membank("bank5")->set_base(ram + (0x4000 % ram_size));
472      state->membank("bank6")->set_base(ram + (0x8000 % ram_size));
473      state->membank("bank7")->set_base(ram + (0xc000 % ram_size));
474474
475475      space->install_write_bank(0xff20, 0xff3d,"bank10");
476476      space->install_write_bank(0xff40, 0xffff, "bank11");
477      memory_set_bankptr(machine, "bank10", ram + (0xff20 % ram_size));
478      memory_set_bankptr(machine, "bank11", ram + (0xff40 % ram_size));
477      state->membank("bank10")->set_base(ram + (0xff20 % ram_size));
478      state->membank("bank11")->set_base(ram + (0xff40 % ram_size));
479479   }
480480   else
481481   {
482482      space->install_write_bank(0x4000, 0xfcff, "bank10");
483      memory_set_bankptr(machine, "bank10", ram + (0x4000 % ram_size));
483      state->membank("bank10")->set_base(ram + (0x4000 % ram_size));
484484   }
485485}
486486
r14976r14977
622622
623623static void plus4_software_list_cartridge_load(device_image_interface &image)
624624{
625   UINT8 *mem = image.device().machine().region("maincpu")->base();
625   UINT8 *mem = image.device().machine().root_device().memregion("maincpu")->base();
626626
627627   size_t size = image.get_software_region_length("c1l");
628628   if (size)
r14976r14977
643643
644644static int plus4_crt_load( device_image_interface &image )
645645{
646   UINT8 *mem = image.device().machine().region("maincpu")->base();
646   UINT8 *mem = image.device().machine().root_device().memregion("maincpu")->base();
647647   int size = image.length(), test;
648648   const char *filetype;
649649   int address = 0;
src/mess/machine/at.c
r14976r14977
296296
297297static void init_at_common(running_machine &machine)
298298{
299   at_state *st = machine.driver_data<at_state>();
299   at_state *state = machine.driver_data<at_state>();
300300   address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM);
301301
302302   // The CS4031 chipset does this itself
303303   if (machine.device("cs4031") == NULL)
304304   {
305305      /* MESS managed RAM */
306      memory_set_bankptr(machine, "bank10", machine.device<ram_device>(RAM_TAG)->pointer());
306      state->membank("bank10")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
307307
308308      if (machine.device<ram_device>(RAM_TAG)->size() > 0x0a0000)
309309      {
310310         offs_t ram_limit = 0x100000 + machine.device<ram_device>(RAM_TAG)->size() - 0x0a0000;
311311         space->install_read_bank(0x100000,  ram_limit - 1, "bank1");
312312         space->install_write_bank(0x100000,  ram_limit - 1, "bank1");
313         memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer() + 0xa0000);
313         state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xa0000);
314314      }
315315   }
316316
317   st->m_at_offset1 = 0xff;
317   state->m_at_offset1 = 0xff;
318318}
319319
320320DRIVER_INIT( atcga )
src/mess/machine/electron.c
r14976r14977
155155
156156READ8_MEMBER(electron_state::electron_ula_r)
157157{
158   UINT8 data = ((UINT8 *)machine().region("user1")->base())[0x43E00 + offset];
158   UINT8 data = ((UINT8 *)machine().root_device().memregion("user1")->base())[0x43E00 + offset];
159159   switch ( offset & 0x0f )
160160   {
161161   case 0x00:   /* Interrupt status */
r14976r14977
217217         {
218218            space.install_read_bank( 0x8000, 0xbfff, "bank2");
219219         }
220         memory_set_bank(machine(), "bank2", m_ula.rompage);
220         membank("bank2")->set_entry(m_ula.rompage);
221221      }
222222      if ( data & 0x10 )
223223      {
r14976r14977
325325static void electron_reset(running_machine &machine)
326326{
327327   electron_state *state = machine.driver_data<electron_state>();
328   memory_set_bank(machine, "bank2", 0);
328   state->membank("bank2")->set_entry(0);
329329
330330   state->m_ula.communication_mode = 0x04;
331331   state->m_ula.screen_mode = 0;
r14976r14977
343343MACHINE_START( electron )
344344{
345345   electron_state *state = machine.driver_data<electron_state>();
346   memory_configure_bank(machine, "bank2", 0, 16, machine.region("user1")->base(), 0x4000);
346   state->membank("bank2")->configure_entries(0, 16, state->memregion("user1")->base(), 0x4000);
347347
348348   state->m_ula.interrupt_status = 0x82;
349349   state->m_ula.interrupt_control = 0x00;
src/mess/machine/orion.c
r14976r14977
3030static READ8_DEVICE_HANDLER (orion_romdisk_porta_r )
3131{
3232   orion_state *state = device->machine().driver_data<orion_state>();
33   UINT8 *romdisk = device->machine().region("maincpu")->base() + 0x10000;
33   UINT8 *romdisk = state->memregion("maincpu")->base() + 0x10000;
3434   return romdisk[state->m_romdisk_msb*256+state->m_romdisk_lsb];
3535}
3636
r14976r14977
150150{
151151   if (data!=m_orion128_memory_page )
152152   {
153      memory_set_bankptr(machine(), "bank1", machine().device<ram_device>(RAM_TAG)->pointer() + (data & 3) * 0x10000);
153      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + (data & 3) * 0x10000);
154154      m_orion128_memory_page = (data & 3);
155155   }
156156}
r14976r14977
161161   state->m_orion128_video_page = 0;
162162   state->m_orion128_video_mode = 0;
163163   state->m_orion128_memory_page = -1;
164   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0xf800);
165   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000);
164   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0xf800);
165   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000);
166166   state->m_orion128_video_width = SCREEN_WIDTH_384;
167167   orion_set_video_mode(machine,384);
168168   radio86_init_keyboard(machine);
r14976r14977
279279   space->install_write_bank(0x0000, 0x3fff, "bank1");
280280   if ((state->m_orionz80_dispatcher & 0x80)==0)
281281   { // dispatcher on
282      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000 * bank_select + segment_select * 0x4000 );
282      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000 * bank_select + segment_select * 0x4000 );
283283   }
284284   else
285285   { // dispatcher off
286      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000 * state->m_orionz80_memory_page);
286      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000 * state->m_orionz80_memory_page);
287287   }
288288
289   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000 + 0x10000 * state->m_orionz80_memory_page);
289   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000 + 0x10000 * state->m_orionz80_memory_page);
290290
291291   if ((state->m_orionz80_dispatcher & 0x20) == 0)
292292   {
r14976r14977
304304      space->unmap_write(0xfc00, 0xfeff);
305305      space->install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),state));
306306
307      memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000);
308      memory_set_bankptr(machine, "bank5", machine.region("maincpu")->base() + 0xf800);
307      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000);
308      state->membank("bank5")->set_base(machine.root_device().memregion("maincpu")->base() + 0xf800);
309309
310310   }
311311   else
312312   {
313313      /* if it is full memory access */
314      memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000 + 0x10000 * state->m_orionz80_memory_page);
315      memory_set_bankptr(machine, "bank4", machine.device<ram_device>(RAM_TAG)->pointer() + 0xf400 + 0x10000 * state->m_orionz80_memory_page);
316      memory_set_bankptr(machine, "bank5", machine.device<ram_device>(RAM_TAG)->pointer() + 0xf800 + 0x10000 * state->m_orionz80_memory_page);
314      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000 + 0x10000 * state->m_orionz80_memory_page);
315      state->membank("bank4")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf400 + 0x10000 * state->m_orionz80_memory_page);
316      state->membank("bank5")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf800 + 0x10000 * state->m_orionz80_memory_page);
317317   }
318318}
319319
r14976r14977
353353   space->install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),state));
354354
355355
356   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0xf800);
357   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
358   memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000);
359   memory_set_bankptr(machine, "bank5", machine.region("maincpu")->base() + 0xf800);
356   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0xf800);
357   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
358   state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xf000);
359   state->membank("bank5")->set_base(state->memregion("maincpu")->base() + 0xf800);
360360
361361
362362   state->m_orion128_video_page = 0;
r14976r14977
438438
439439   if ((state->m_orionpro_dispatcher & 0x01)==0x00)
440440   {   // RAM0 segment disabled
441      memory_set_bankptr(machine, "bank1", ram + 0x10000 * page);
442      memory_set_bankptr(machine, "bank2", ram + 0x10000 * page + 0x2000);
441      state->membank("bank1")->set_base(ram + 0x10000 * page);
442      state->membank("bank2")->set_base(ram + 0x10000 * page + 0x2000);
443443   }
444444   else
445445   {
446      memory_set_bankptr(machine, "bank1", ram + (state->m_orionpro_ram0_segment & 31) * 0x4000);
447      memory_set_bankptr(machine, "bank2", ram + (state->m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000);
446      state->membank("bank1")->set_base(ram + (state->m_orionpro_ram0_segment & 31) * 0x4000);
447      state->membank("bank2")->set_base(ram + (state->m_orionpro_ram0_segment & 31) * 0x4000 + 0x2000);
448448   }
449449   if ((state->m_orionpro_dispatcher & 0x10)==0x10)
450450   {   // ROM1 enabled
451451      space->unmap_write(0x0000, 0x1fff);
452      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x20000);
452      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x20000);
453453   }
454454   if ((state->m_orionpro_dispatcher & 0x08)==0x08)
455455   {   // ROM2 enabled
456456      space->unmap_write(0x2000, 0x3fff);
457      memory_set_bankptr(machine, "bank2", machine.region("maincpu")->base() + 0x22000 + (state->m_orionpro_rom2_segment & 7) * 0x2000);
457      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x22000 + (state->m_orionpro_rom2_segment & 7) * 0x2000);
458458   }
459459
460460   if ((state->m_orionpro_dispatcher & 0x02)==0x00)
461461   {   // RAM1 segment disabled
462      memory_set_bankptr(machine, "bank3", ram + 0x10000 * page + 0x4000);
462      state->membank("bank3")->set_base(ram + 0x10000 * page + 0x4000);
463463   }
464464   else
465465   {
466      memory_set_bankptr(machine, "bank3", ram + (state->m_orionpro_ram1_segment & 31) * 0x4000);
466      state->membank("bank3")->set_base(ram + (state->m_orionpro_ram1_segment & 31) * 0x4000);
467467   }
468468
469469   if ((state->m_orionpro_dispatcher & 0x04)==0x00)
470470   {   // RAM2 segment disabled
471      memory_set_bankptr(machine, "bank4", ram + 0x10000 * page + 0x8000);
471      state->membank("bank4")->set_base(ram + 0x10000 * page + 0x8000);
472472   }
473473   else
474474   {
475      memory_set_bankptr(machine, "bank4", ram + (state->m_orionpro_ram2_segment & 31) * 0x4000);
475      state->membank("bank4")->set_base(ram + (state->m_orionpro_ram2_segment & 31) * 0x4000);
476476   }
477477
478   memory_set_bankptr(machine, "bank5", ram + 0x10000 * page + 0xc000);
478   state->membank("bank5")->set_base(ram + 0x10000 * page + 0xc000);
479479
480480   if (is128)
481481   {
482      memory_set_bankptr(machine, "bank6", ram + 0x10000 * 0 + 0xf000);
482      state->membank("bank6")->set_base(ram + 0x10000 * 0 + 0xf000);
483483
484484      space->install_write_handler(0xf400, 0xf4ff, write8_delegate(FUNC(orion_state::orion128_system_w),state));
485485      space->install_write_handler(0xf500, 0xf5ff, write8_delegate(FUNC(orion_state::orion128_romdisk_w),state));
r14976r14977
497497      space->install_write_handler(0xff00, 0xffff, write8_delegate(FUNC(orion_state::orionz80_sound_w),state));
498498
499499
500      memory_set_bankptr(machine, "bank8", ram + 0x10000 * 0 + 0xf800);
500      state->membank("bank8")->set_base(ram + 0x10000 * 0 + 0xf800);
501501   }
502502   else
503503   {
504504      if ((state->m_orionpro_dispatcher & 0x40)==0x40)
505505      {   // FIX F000 enabled
506         memory_set_bankptr(machine, "bank6", ram + 0x10000 * 0 + 0xf000);
507         memory_set_bankptr(machine, "bank7", ram + 0x10000 * 0 + 0xf400);
508         memory_set_bankptr(machine, "bank8", ram + 0x10000 * 0 + 0xf800);
506         state->membank("bank6")->set_base(ram + 0x10000 * 0 + 0xf000);
507         state->membank("bank7")->set_base(ram + 0x10000 * 0 + 0xf400);
508         state->membank("bank8")->set_base(ram + 0x10000 * 0 + 0xf800);
509509      }
510510      else
511511      {
512         memory_set_bankptr(machine, "bank6", ram + 0x10000 * page + 0xf000);
513         memory_set_bankptr(machine, "bank7", ram + 0x10000 * page + 0xf400);
514         memory_set_bankptr(machine, "bank8", ram + 0x10000 * page + 0xf800);
512         state->membank("bank6")->set_base(ram + 0x10000 * page + 0xf000);
513         state->membank("bank7")->set_base(ram + 0x10000 * page + 0xf400);
514         state->membank("bank8")->set_base(ram + 0x10000 * page + 0xf800);
515515      }
516516   }
517517}
src/mess/machine/cpc_ssa1.c
r14976r14977
190190   address_space* space = cpu->memory().space(AS_IO);
191191   m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
192192
193   m_rom = subregion("sp0256")->base();
193   m_rom = memregion("sp0256")->base();
194194
195195//  m_sp0256_device = subdevice("sp0256");
196196
r14976r14977
204204   address_space* space = cpu->memory().space(AS_IO);
205205   m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
206206
207   m_rom = subregion("sp0256")->base();
207   m_rom = memregion("sp0256")->base();
208208
209209//  m_sp0256_device = subdevice("sp0256");
210210
src/mess/machine/kc_ram.c
r14976r14977
6060{
6161   m_slot = dynamic_cast<kcexp_slot_device *>(owner());
6262
63   m_ram = machine().region_alloc(tag(), get_ram_size(), 1, ENDIANNESS_LITTLE)->base();
63   m_ram = machine().memory().region_alloc(tag(), get_ram_size(), 1, ENDIANNESS_LITTLE)->base();
6464   memset(m_ram, 0, get_ram_size());
6565}
6666
src/mess/machine/a7800.c
r14976r14977
7373{
7474   a7800_state *state = machine.driver_data<a7800_state>();
7575   address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM);
76   state->m_ROM = machine.region("maincpu")->base();
76   state->m_ROM = state->memregion("maincpu")->base();
7777   state->m_ispal = ispal;
7878   state->m_lines = lines;
7979   state->m_p1_one_button = 1;
8080   state->m_p2_one_button = 1;
8181
8282   /* standard banks */
83   memory_set_bankptr(machine, "bank5", &state->m_ROM[0x2040]);      /* RAM0 */
84   memory_set_bankptr(machine, "bank6", &state->m_ROM[0x2140]);      /* RAM1 */
85   memory_set_bankptr(machine, "bank7", &state->m_ROM[0x2000]);      /* MAINRAM */
83   state->membank("bank5")->set_base(&state->m_ROM[0x2040]);      /* RAM0 */
84   state->membank("bank6")->set_base(&state->m_ROM[0x2140]);      /* RAM1 */
85   state->membank("bank7")->set_base(&state->m_ROM[0x2000]);      /* MAINRAM */
8686
8787   /* Brutal hack put in as a consequence of new memory system; fix this */
8888   space->install_readwrite_bank(0x0480, 0x04FF,"bank10");
89   memory_set_bankptr(machine, "bank10", state->m_ROM + 0x0480);
89   state->membank("bank10")->set_base(state->m_ROM + 0x0480);
9090   space->install_readwrite_bank(0x1800, 0x27FF, "bank11");
91   memory_set_bankptr(machine, "bank11", state->m_ROM + 0x1800);
91   state->membank("bank11")->set_base(state->m_ROM + 0x1800);
9292}
9393
9494
r14976r14977
115115   state->m_maria_flag = 0;
116116
117117   /* set banks to default states */
118   memory = machine.region("maincpu")->base();
119   memory_set_bankptr(machine,  "bank1", memory + 0x4000 );
120   memory_set_bankptr(machine,  "bank2", memory + 0x8000 );
121   memory_set_bankptr(machine,  "bank3", memory + 0xA000 );
122   memory_set_bankptr(machine,  "bank4", memory + 0xC000 );
118   memory = state->memregion("maincpu")->base();
119   state->membank("bank1")->set_base(memory + 0x4000 );
120   state->membank("bank2")->set_base(memory + 0x8000 );
121   state->membank("bank3")->set_base(memory + 0xA000 );
122   state->membank("bank4")->set_base(memory + 0xC000 );
123123
124124   /* pokey cartridge */
125125   if (state->m_cart_type & 0x01)
r14976r14977
197197DEVICE_START( a7800_cart )
198198{
199199   a7800_state *state = device->machine().driver_data<a7800_state>();
200   UINT8 *memory = device->machine().region("maincpu")->base();
200   UINT8 *memory = state->memregion("maincpu")->base();
201201
202202   state->m_bios_bkup = NULL;
203203   state->m_cart_bkup = NULL;
r14976r14977
257257   a7800_state *state = image.device().machine().driver_data<a7800_state>();
258258   UINT32 len = 0, start = 0;
259259   unsigned char header[128];
260   UINT8 *memory = image.device().machine().region("maincpu")->base();
260   UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
261261   const char   *pcb_name;
262262
263263   // detect cart type either from xml or from header
r14976r14977
402402
403403WRITE8_MEMBER(a7800_state::a7800_cart_w)
404404{
405   UINT8 *memory = machine().region("maincpu")->base();
405   UINT8 *memory = memregion("maincpu")->base();
406406
407407   if(offset < 0x4000)
408408   {
r14976r14977
432432      {
433433         data &= 0x07;
434434      }
435      memory_set_bankptr(machine(), "bank2",memory + 0x10000 + (data << 14));
436      memory_set_bankptr(machine(), "bank3",memory + 0x12000 + (data << 14));
435      membank("bank2")->set_base(memory + 0x10000 + (data << 14));
436      membank("bank3")->set_base(memory + 0x12000 + (data << 14));
437437   /*  logerror("BANK SEL: %d\n",data); */
438438   }
439439   else if(( m_cart_type == MBANK_TYPE_ABSOLUTE ) &&( offset == 0x4000 ) )
r14976r14977
442442      /*logerror( "F18 BANK SEL: %d\n", data );*/
443443      if( data & 1 )
444444      {
445         memory_set_bankptr(machine(), "bank1",memory + 0x10000 );
445         membank("bank1")->set_base(memory + 0x10000 );
446446      }
447447      else if( data & 2 )
448448      {
449         memory_set_bankptr(machine(), "bank1",memory + 0x14000 );
449         membank("bank1")->set_base(memory + 0x14000 );
450450      }
451451   }
452452   else if(( m_cart_type == MBANK_TYPE_ACTIVISION ) &&( offset >= 0xBF80 ) )
r14976r14977
456456
457457      /*logerror( "Activision BANK SEL: %d\n", data );*/
458458
459      memory_set_bankptr(machine(),  "bank3", memory + 0x10000 + ( data << 14 ) );
460      memory_set_bankptr(machine(),  "bank4", memory + 0x12000 + ( data << 14 ) );
459      membank("bank3")->set_base(memory + 0x10000 + ( data << 14 ) );
460      membank("bank4")->set_base(memory + 0x12000 + ( data << 14 ) );
461461   }
462462}
463463
src/mess/machine/nascom1.c
r14976r14977
263263
264264DRIVER_INIT( nascom1 )
265265{
266   nascom1_state *state = machine.driver_data<nascom1_state>();
266267   switch (machine.device<ram_device>(RAM_TAG)->size())
267268   {
268269   case 1 * 1024:
r14976r14977
275276         0x1400, 0x4fff, "bank1");
276277      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(
277278         0x5000, 0xafff);
278      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
279      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
279280      break;
280281
281282   case 32 * 1024:
r14976r14977
283284         0x1400, 0x8fff, "bank1");
284285      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(
285286         0x9000, 0xafff);
286      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
287      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
287288      break;
288289
289290   case 40 * 1024:
290291      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(
291292         0x1400, 0xafff, "bank1");
292      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
293      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
293294      break;
294295   }
295296}
src/mess/machine/microtan.c
r14976r14977
514514DRIVER_INIT( microtan )
515515{
516516   microtan_state *state = machine.driver_data<microtan_state>();
517    UINT8 *dst = machine.region("gfx2")->base();
517    UINT8 *dst = state->memregion("gfx2")->base();
518518    int i;
519519    address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
520520
src/mess/machine/cs4031.c
r14976r14977
127127
128128   device_t *cpu = machine().device(m_cputag);
129129   m_space = cpu->memory().space(AS_PROGRAM);
130   m_isa = machine().region(m_isatag)->base();
131   m_bios = machine().region(m_biostag)->base();
130   m_isa = memregion(m_isatag)->base();
131   m_bios = memregion(m_biostag)->base();
132132
133133   m_ram = ram_dev->pointer();
134134   UINT32 ram_size = ram_dev->size();
r14976r14977
173173         logerror("ROM read from %x to %x\n", start, end);
174174
175175      m_space->install_read_bank(start, end, region);
176      memory_set_bankptr(m_space->machine(), region, m_bios + start);
176      membank(region)->set_base(m_bios + start);
177177   }
178178   else if (!BIT(m_registers[SHADOW_READ], index) && !BIT(m_registers[ROMCS], index))
179179   {
r14976r14977
181181         logerror("ISA read from %x to %x\n", start, end);
182182
183183      m_space->install_read_bank(start, end, region);
184      memory_set_bankptr(m_space->machine(), region, m_isa + start - 0xc0000);
184      membank(region)->set_base(m_isa + start - 0xc0000);
185185   }
186186   else if (BIT(m_registers[SHADOW_READ], index))
187187   {
r14976r14977
189189         logerror("RAM read from %x to %x\n", start, end);
190190
191191      m_space->install_read_bank(start, end, region);
192      memory_set_bankptr(m_space->machine(), region, m_ram + start);
192      membank(region)->set_base(m_ram + start);
193193   }
194194   else
195195   {
r14976r14977
208208         logerror("ROM write from %x to %x\n", start, end);
209209
210210      m_space->install_write_bank(start, end, region);
211      memory_set_bankptr(m_space->machine(), region, m_bios + start);
211      membank(region)->set_base(m_bios + start);
212212   }
213213   else if (!BIT(m_registers[SHADOW_WRITE], index) && !BIT(m_registers[ROMCS], index))
214214   {
r14976r14977
216216         logerror("ISA write from %x to %x\n", start, end);
217217
218218      m_space->install_write_bank(start, end, region);
219      memory_set_bankptr(m_space->machine(), region, m_isa + start - 0xc0000);
219      membank(region)->set_base(m_isa + start - 0xc0000);
220220   }
221221   else if (BIT(m_registers[SHADOW_WRITE], index))
222222   {
r14976r14977
224224         logerror("RAM write from %x to %x\n", start, end);
225225
226226      m_space->install_write_bank(start, end, region);
227      memory_set_bankptr(m_space->machine(), region, m_ram + start);
227      membank(region)->set_base(m_ram + start);
228228   }
229229   else
230230   {
src/mess/machine/hecdisk2.c
r14976r14977
149149   upd765_reset_w(machine.device("upd765"), 1);
150150   upd765_reset_w(machine.device("upd765"), 0);
151151   // Select ROM memory to cold restart
152   memory_set_bank(machine, "bank3", DISCII_BANK_ROM);
152   state->membank("bank3")->set_entry(DISCII_BANK_ROM);
153153
154154   // Clear the Hardware's buffers
155155   state->m_hector_disc2_data_r_ready=0x0;   /* =ff when PC2 = true and data in read buffer (state->m_hector_disc2_data_read) */
r14976r14977
165165/*****************************************************************************/
166166READ8_HANDLER( hector_disc2_io00_port_r)
167167{
168   hec2hrp_state *state = space->machine().driver_data<hec2hrp_state>();
168169   /* Switch Disc 2 to RAM to let full RAM acces */
169   memory_set_bank(space->machine(), "bank3", DISCII_BANK_RAM);
170   state->membank("bank3")->set_entry(DISCII_BANK_RAM);
170171   return 0;
171172}
172173WRITE8_HANDLER( hector_disc2_io00_port_w)
173174{
175   hec2hrp_state *state = space->machine().driver_data<hec2hrp_state>();
174176   /* Switch Disc 2 to RAM to let full RAM acces */
175   memory_set_bank(space->machine(), "bank3", DISCII_BANK_RAM);
177   state->membank("bank3")->set_entry(DISCII_BANK_RAM);
176178}
177179READ8_HANDLER( hector_disc2_io20_port_r)
178180{
src/mess/machine/samcoupe.c
r14976r14977
2626{
2727   char bank[10];
2828   sprintf(bank,"bank%d",bank_num);
29
29   samcoupe_state *state = space->machine().driver_data<samcoupe_state>();
3030   if (memory)
3131   {
32      memory_set_bankptr(space->machine(), bank, memory);
32      state->membank(bank)->set_base(memory);
3333      space->install_read_bank (((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF, bank);
3434      if (is_readonly) {
3535         space->unmap_write(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF);
r14976r14977
6969{
7070   samcoupe_state *state = space->machine().driver_data<samcoupe_state>();
7171   const int PAGE_MASK = ((space->machine().device<ram_device>(RAM_TAG)->size() & 0xfffff) / 0x4000) - 1;
72   UINT8 *rom = space->machine().region("maincpu")->base();
72   UINT8 *rom = state->memregion("maincpu")->base();
7373   UINT8 *memory;
7474   int is_readonly;
7575
src/mess/machine/comx_fd.c
r14976r14977
187187{
188188   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
189189
190   m_rom = subregion("c000")->base();
190   m_rom = memregion("c000")->base();
191191
192192   // state saving
193193   save_item(NAME(m_ds));
src/mess/machine/trs80.c
r14976r14977
217217
218218   /* get address space instead of io space */
219219   address_space *mem = m_maincpu->memory().space(AS_PROGRAM);
220   UINT8 *base = machine().region("maincpu")->base();
220   UINT8 *base = memregion("maincpu")->base();
221221
222222   m_mode = (m_mode & 0x73) | (data & 0x8c);
223223
r14976r14977
231231         if (m_model4 & 4)   /* Model 4P gets RAM while Model 4 gets ROM */
232232         {
233233            if (m_model4 & 8)
234               memory_set_bankptr(machine(), "bank1", base);
234               membank("bank1")->set_base(base);
235235            else
236               memory_set_bankptr(machine(), "bank1", base + 0x10000);
236               membank("bank1")->set_base(base + 0x10000);
237237
238            memory_set_bankptr(machine(), "bank2", base + 0x11000);
239            memory_set_bankptr(machine(), "bank4", base + 0x137ea);
238            membank("bank2")->set_base(base + 0x11000);
239            membank("bank4")->set_base(base + 0x137ea);
240240         }
241241         else
242242         {
243            memory_set_bankptr(machine(), "bank1", base);
244            memory_set_bankptr(machine(), "bank2", base + 0x01000);
245            memory_set_bankptr(machine(), "bank4", base + 0x037ea);
243            membank("bank1")->set_base(base);
244            membank("bank2")->set_base(base + 0x01000);
245            membank("bank4")->set_base(base + 0x037ea);
246246         }
247247
248         memory_set_bankptr(machine(), "bank7", base + 0x14000);
249         memory_set_bankptr(machine(), "bank8", base + 0x1f400);
250         memory_set_bankptr(machine(), "bank9", base + 0x1f800);
251         memory_set_bankptr(machine(), "bank11", base + 0x05000);
252         memory_set_bankptr(machine(), "bank12", base + 0x06000);
253         memory_set_bankptr(machine(), "bank14", base + 0x09000);
254         memory_set_bankptr(machine(), "bank15", base + 0x0a000);
255         memory_set_bankptr(machine(), "bank17", base + 0x14000);
256         memory_set_bankptr(machine(), "bank18", base + 0x1f400);
257         memory_set_bankptr(machine(), "bank19", base + 0x1f800);
248         membank("bank7")->set_base(base + 0x14000);
249         membank("bank8")->set_base(base + 0x1f400);
250         membank("bank9")->set_base(base + 0x1f800);
251         membank("bank11")->set_base(base + 0x05000);
252         membank("bank12")->set_base(base + 0x06000);
253         membank("bank14")->set_base(base + 0x09000);
254         membank("bank15")->set_base(base + 0x0a000);
255         membank("bank17")->set_base(base + 0x14000);
256         membank("bank18")->set_base(base + 0x1f400);
257         membank("bank19")->set_base(base + 0x1f800);
258258         mem->install_readwrite_handler (0x37e8, 0x37e9, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this));   /* 3 & 13 */
259259         mem->install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 5 */
260260         mem->install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 6 & 16 */
r14976r14977
265265         if (m_model4 & 4)   /* Model 4P gets RAM while Model 4 gets ROM */
266266         {
267267            if (m_model4 & 8)
268               memory_set_bankptr(machine(), "bank1", base);
268               membank("bank1")->set_base(base);
269269            else
270               memory_set_bankptr(machine(), "bank1", base + 0x10000);
270               membank("bank1")->set_base(base + 0x10000);
271271
272            memory_set_bankptr(machine(), "bank2", base + 0x11000);
273            memory_set_bankptr(machine(), "bank3", base + 0x137e8);
274            memory_set_bankptr(machine(), "bank4", base + 0x137ea);
272            membank("bank2")->set_base(base + 0x11000);
273            membank("bank3")->set_base(base + 0x137e8);
274            membank("bank4")->set_base(base + 0x137ea);
275275         }
276276         else
277277         {
278            memory_set_bankptr(machine(), "bank1", base);
279            memory_set_bankptr(machine(), "bank2", base + 0x01000);
280            memory_set_bankptr(machine(), "bank3", base + 0x037e8);
281            memory_set_bankptr(machine(), "bank4", base + 0x037ea);
278            membank("bank1")->set_base(base);
279            membank("bank2")->set_base(base + 0x01000);
280            membank("bank3")->set_base(base + 0x037e8);
281            membank("bank4")->set_base(base + 0x037ea);
282282         }
283283
284         memory_set_bankptr(machine(), "bank7", base + 0x14000);
285         memory_set_bankptr(machine(), "bank8", base + 0x1f400);
286         memory_set_bankptr(machine(), "bank9", base + 0x1f800);
287         memory_set_bankptr(machine(), "bank11", base + 0x10000);
288         memory_set_bankptr(machine(), "bank12", base + 0x11000);
289         memory_set_bankptr(machine(), "bank13", base + 0x137e8);
290         memory_set_bankptr(machine(), "bank14", base + 0x137ea);
291         memory_set_bankptr(machine(), "bank15", base + 0x0a000);
292         memory_set_bankptr(machine(), "bank17", base + 0x14000);
293         memory_set_bankptr(machine(), "bank18", base + 0x1f400);
294         memory_set_bankptr(machine(), "bank19", base + 0x1f800);
284         membank("bank7")->set_base(base + 0x14000);
285         membank("bank8")->set_base(base + 0x1f400);
286         membank("bank9")->set_base(base + 0x1f800);
287         membank("bank11")->set_base(base + 0x10000);
288         membank("bank12")->set_base(base + 0x11000);
289         membank("bank13")->set_base(base + 0x137e8);
290         membank("bank14")->set_base(base + 0x137ea);
291         membank("bank15")->set_base(base + 0x0a000);
292         membank("bank17")->set_base(base + 0x14000);
293         membank("bank18")->set_base(base + 0x1f400);
294         membank("bank19")->set_base(base + 0x1f800);
295295         mem->install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 5 */
296296         mem->install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 6 & 16 */
297297         break;
298298
299299      case 2:   /* keyboard and video are moved to high memory, and the rest is ram */
300         memory_set_bankptr(machine(), "bank1", base + 0x10000);
301         memory_set_bankptr(machine(), "bank2", base + 0x11000);
302         memory_set_bankptr(machine(), "bank3", base + 0x137e8);
303         memory_set_bankptr(machine(), "bank4", base + 0x137ea);
304         memory_set_bankptr(machine(), "bank5", base + 0x13800);
305         memory_set_bankptr(machine(), "bank6", base + 0x13c00);
306         memory_set_bankptr(machine(), "bank7", base + 0x14000);
307         memory_set_bankptr(machine(), "bank11", base + 0x10000);
308         memory_set_bankptr(machine(), "bank12", base + 0x11000);
309         memory_set_bankptr(machine(), "bank13", base + 0x137e8);
310         memory_set_bankptr(machine(), "bank14", base + 0x137ea);
311         memory_set_bankptr(machine(), "bank15", base + 0x13800);
312         memory_set_bankptr(machine(), "bank16", base + 0x13c00);
313         memory_set_bankptr(machine(), "bank17", base + 0x14000);
314         memory_set_bankptr(machine(), "bank18", base + 0x0a000);
300         membank("bank1")->set_base(base + 0x10000);
301         membank("bank2")->set_base(base + 0x11000);
302         membank("bank3")->set_base(base + 0x137e8);
303         membank("bank4")->set_base(base + 0x137ea);
304         membank("bank5")->set_base(base + 0x13800);
305         membank("bank6")->set_base(base + 0x13c00);
306         membank("bank7")->set_base(base + 0x14000);
307         membank("bank11")->set_base(base + 0x10000);
308         membank("bank12")->set_base(base + 0x11000);
309         membank("bank13")->set_base(base + 0x137e8);
310         membank("bank14")->set_base(base + 0x137ea);
311         membank("bank15")->set_base(base + 0x13800);
312         membank("bank16")->set_base(base + 0x13c00);
313         membank("bank17")->set_base(base + 0x14000);
314         membank("bank18")->set_base(base + 0x0a000);
315315         mem->install_read_handler (0xf400, 0xf7ff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 8 */
316316         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 9 & 19 */
317317         m_model4++;
318318         break;
319319
320320      case 3:   /* 64k of ram */
321         memory_set_bankptr(machine(), "bank1", base + 0x10000);
322         memory_set_bankptr(machine(), "bank2", base + 0x11000);
323         memory_set_bankptr(machine(), "bank3", base + 0x137e8);
324         memory_set_bankptr(machine(), "bank4", base + 0x137ea);
325         memory_set_bankptr(machine(), "bank5", base + 0x13800);
326         memory_set_bankptr(machine(), "bank6", base + 0x13c00);
327         memory_set_bankptr(machine(), "bank7", base + 0x14000);
328         memory_set_bankptr(machine(), "bank8", base + 0x1f400);
329         memory_set_bankptr(machine(), "bank9", base + 0x1f800);
330         memory_set_bankptr(machine(), "bank11", base + 0x10000);
331         memory_set_bankptr(machine(), "bank12", base + 0x11000);
332         memory_set_bankptr(machine(), "bank13", base + 0x137e8);
333         memory_set_bankptr(machine(), "bank14", base + 0x137ea);
334         memory_set_bankptr(machine(), "bank15", base + 0x13800);
335         memory_set_bankptr(machine(), "bank16", base + 0x13c00);
336         memory_set_bankptr(machine(), "bank17", base + 0x14000);
337         memory_set_bankptr(machine(), "bank18", base + 0x1f400);
338         memory_set_bankptr(machine(), "bank19", base + 0x1f800);
321         membank("bank1")->set_base(base + 0x10000);
322         membank("bank2")->set_base(base + 0x11000);
323         membank("bank3")->set_base(base + 0x137e8);
324         membank("bank4")->set_base(base + 0x137ea);
325         membank("bank5")->set_base(base + 0x13800);
326         membank("bank6")->set_base(base + 0x13c00);
327         membank("bank7")->set_base(base + 0x14000);
328         membank("bank8")->set_base(base + 0x1f400);
329         membank("bank9")->set_base(base + 0x1f800);
330         membank("bank11")->set_base(base + 0x10000);
331         membank("bank12")->set_base(base + 0x11000);
332         membank("bank13")->set_base(base + 0x137e8);
333         membank("bank14")->set_base(base + 0x137ea);
334         membank("bank15")->set_base(base + 0x13800);
335         membank("bank16")->set_base(base + 0x13c00);
336         membank("bank17")->set_base(base + 0x14000);
337         membank("bank18")->set_base(base + 0x1f400);
338         membank("bank19")->set_base(base + 0x1f800);
339339         break;
340340   }
341341}
r14976r14977
362362      switch (m_model4 & 8)
363363      {
364364         case 0:      /* Read-only RAM replaces rom */
365            memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x10000);
365            membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
366366            break;
367367         case 8:      /* Normal setup - rom enabled */
368            memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base());
368            membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
369369            break;
370370      }
371371   }
r14976r14977
574574   {
575575      mem->unmap_readwrite (0x0000, 0x3fff);
576576      mem->install_read_bank (0x0000, 0x2fff, "bank1");
577      memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base());
577      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
578578      mem->install_readwrite_handler (0x37e0, 0x37e3, read8_delegate(FUNC(trs80_state::trs80_irq_status_r), this), write8_delegate(FUNC(trs80_state::trs80_motor_w), this));
579579      mem->install_readwrite_handler (0x37e8, 0x37eb, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this));
580580      mem->install_read_handler (0x37ec, 0x37ec, read8_delegate(FUNC(trs80_state::trs80_wd179x_r), this));
src/mess/machine/primo.c
r14976r14977
5252   {
5353      case 0x00:   /* Original ROM */
5454         space->unmap_write(0x0000, 0x3fff);
55         memory_set_bankptr(machine,"bank1", machine.region("maincpu")->base()+0x10000);
55         state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base()+0x10000);
5656         break;
5757      case 0x01:   /* EPROM extension 1 */
5858         space->unmap_write(0x0000, 0x3fff);
59         memory_set_bankptr(machine,"bank1", machine.region("maincpu")->base()+0x14000);
59         state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base()+0x14000);
6060         break;
6161      case 0x02:   /* RAM */
6262         space->install_write_bank(0x0000, 0x3fff, "bank1");
63         memory_set_bankptr(machine,"bank1", machine.region("maincpu")->base());
63         state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());
6464         break;
6565      case 0x03:   /* EPROM extension 2 */
6666         space->unmap_write(0x0000, 0x3fff);
67         memory_set_bankptr(machine,"bank1", machine.region("maincpu")->base()+0x18000);
67         state->membank("bank1")->set_base(state->memregion("maincpu")->base()+0x18000);
6868         break;
6969   }
7070   logerror ("Memory update: %02x\n", state->m_port_FD);
src/mess/machine/mface2.c
r14976r14977
110110      return;
111111
112112   t.cat(":multiface");
113   multiface_rom = machine().region(t)->base();
113   multiface_rom = memregion(t)->base();
114114
115115   if ((m_multiface_flags & MULTIFACE_RAM_ROM_ENABLED)!=0 && m_romdis != 0)
116116   {
117117      /* set bank addressess */
118      memory_set_bankptr(machine(),"bank1", multiface_rom);
119      memory_set_bankptr(machine(),"bank2", m_multiface_ram);
120      memory_set_bankptr(machine(),"bank9", multiface_rom);
121      memory_set_bankptr(machine(),"bank10", m_multiface_ram);
118      membank("bank1")->set_base(multiface_rom);
119      membank("bank2")->set_base(m_multiface_ram);
120      membank("bank9")->set_base(multiface_rom);
121      membank("bank10")->set_base(m_multiface_ram);
122122   }
123123}
124124
src/mess/machine/svi318.c
r14976r14977
9191DEVICE_IMAGE_LOAD( svi318_cart )
9292{
9393   svi318_state *state = image.device().machine().driver_data<svi318_state>();
94   UINT8 *p = image.device().machine().region("user1")->base();
94   UINT8 *p = state->memregion("user1")->base();
9595   UINT32 size;
9696
9797   if (image.software_entry() == NULL)
r14976r14977
373373   svi318_state *state = machine.driver_data<svi318_state>();
374374   /* 2K RAM, but allocating 4KB to make banking easier */
375375   /* The upper 2KB will be set to FFs and will never be written to */
376   state->m_svi.svi806_ram = machine.region_alloc("gfx2", 0x1000, 1, ENDIANNESS_LITTLE );
376   state->m_svi.svi806_ram = machine.memory().region_alloc("gfx2", 0x1000, 1, ENDIANNESS_LITTLE );
377377   memset( state->m_svi.svi806_ram->base(), 0x00, 0x800 );
378378   memset( state->m_svi.svi806_ram->base() + 0x800, 0xFF, 0x800 );
379   state->m_svi.svi806_gfx = machine.region("gfx1")->base();
379   state->m_svi.svi806_gfx = state->memregion("gfx1")->base();
380380}
381381
382382
r14976r14977
651651   switch( state->m_svi.bankLow )
652652   {
653653   case SVI_INTERNAL:
654      state->m_svi.bankLow_ptr = machine.region("maincpu")->base();
654      state->m_svi.bankLow_ptr = state->memregion("maincpu")->base();
655655      break;
656656   case SVI_CART:
657657      if ( state->m_pcart )
r14976r14977
731731      }
732732   }
733733
734   memory_set_bankptr(machine, "bank1", state->m_svi.bankLow_ptr );
735   memory_set_bankptr(machine, "bank2", state->m_svi.bankHigh1_ptr );
736   memory_set_bankptr(machine, "bank3", state->m_svi.bankHigh2_ptr );
734   state->membank("bank1")->set_base(state->m_svi.bankLow_ptr );
735   state->membank("bank2")->set_base(state->m_svi.bankHigh1_ptr );
736   state->membank("bank3")->set_base(state->m_svi.bankHigh2_ptr );
737737
738738   /* SVI-806 80 column card specific banking */
739739   if ( state->m_svi.svi806_present )
740740   {
741741      if ( state->m_svi.svi806_ram_enabled )
742742      {
743         memory_set_bankptr(machine, "bank4", state->m_svi.svi806_ram );
743         state->membank("bank4")->set_base(state->m_svi.svi806_ram );
744744      }
745745      else
746746      {
747         memory_set_bankptr(machine, "bank4", state->m_svi.bankHigh2_ptr + 0x3000 );
747         state->membank("bank4")->set_base(state->m_svi.bankHigh2_ptr + 0x3000 );
748748      }
749749   }
750750}
src/mess/machine/c64_xl80.c
r14976r14977
188188void c64_xl80_device::device_start()
189189{
190190   // find memory regions
191   m_char_rom = subregion(HD46505SP_TAG)->base();
191   m_char_rom = memregion(HD46505SP_TAG)->base();
192192   c64_ram_pointer(machine(), RAM_SIZE);
193193
194194   // state saving
src/mess/machine/wswan.c
r14976r14977
248248   memset( &state->m_sound_dma, 0, sizeof( state->m_sound_dma ) );
249249
250250   /* Switch in the banks */
251   memory_set_bankptr( machine, "bank2", state->m_ROMMap[(state->m_ROMBanks - 1) & (state->m_ROMBanks - 1)] );
252   memory_set_bankptr( machine, "bank3", state->m_ROMMap[(state->m_ROMBanks - 1) & (state->m_ROMBanks - 1)] );
253   memory_set_bankptr( machine, "bank4", state->m_ROMMap[(state->m_ROMBanks - 12) & (state->m_ROMBanks - 1)] );
254   memory_set_bankptr( machine, "bank5", state->m_ROMMap[(state->m_ROMBanks - 11) & (state->m_ROMBanks - 1)] );
255   memory_set_bankptr( machine, "bank6", state->m_ROMMap[(state->m_ROMBanks - 10) & (state->m_ROMBanks - 1)] );
256   memory_set_bankptr( machine, "bank7", state->m_ROMMap[(state->m_ROMBanks - 9) & (state->m_ROMBanks - 1)] );
257   memory_set_bankptr( machine, "bank8", state->m_ROMMap[(state->m_ROMBanks - 8) & (state->m_ROMBanks - 1)] );
258   memory_set_bankptr( machine, "bank9", state->m_ROMMap[(state->m_ROMBanks - 7) & (state->m_ROMBanks - 1)] );
259   memory_set_bankptr( machine, "bank10", state->m_ROMMap[(state->m_ROMBanks - 6) & (state->m_ROMBanks - 1)] );
260   memory_set_bankptr( machine, "bank11", state->m_ROMMap[(state->m_ROMBanks - 5) & (state->m_ROMBanks - 1)] );
261   memory_set_bankptr( machine, "bank12", state->m_ROMMap[(state->m_ROMBanks - 4) & (state->m_ROMBanks - 1)] );
262   memory_set_bankptr( machine, "bank13", state->m_ROMMap[(state->m_ROMBanks - 3) & (state->m_ROMBanks - 1)] );
263   memory_set_bankptr( machine, "bank14", state->m_ROMMap[(state->m_ROMBanks - 2) & (state->m_ROMBanks - 1)] );
251   state->membank( "bank2" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 1) & (state->m_ROMBanks - 1)] );
252   state->membank( "bank3" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 1) & (state->m_ROMBanks - 1)] );
253   state->membank( "bank4" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 12) & (state->m_ROMBanks - 1)] );
254   state->membank( "bank5" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 11) & (state->m_ROMBanks - 1)] );
255   state->membank( "bank6" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 10) & (state->m_ROMBanks - 1)] );
256   state->membank( "bank7" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 9) & (state->m_ROMBanks - 1)] );
257   state->membank( "bank8" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 8) & (state->m_ROMBanks - 1)] );
258   state->membank( "bank9" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 7) & (state->m_ROMBanks - 1)] );
259   state->membank( "bank10" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 6) & (state->m_ROMBanks - 1)] );
260   state->membank( "bank11" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 5) & (state->m_ROMBanks - 1)] );
261   state->membank( "bank12" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 4) & (state->m_ROMBanks - 1)] );
262   state->membank( "bank13" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 3) & (state->m_ROMBanks - 1)] );
263   state->membank( "bank14" )->set_base( state->m_ROMMap[(state->m_ROMBanks - 2) & (state->m_ROMBanks - 1)] );
264264   state->m_bios_disabled = 0;
265   memory_set_bankptr( machine, "bank15", state->m_ws_bios_bank );
266//  memory_set_bankptr( machine, 15, state->m_ROMMap[(state->m_ROMBanks - 1) & (state->m_ROMBanks - 1)] );
265   state->membank( "bank15" )->set_base( state->m_ws_bios_bank );
266//  state->membank( 15 )->set_base( state->m_ROMMap[(state->m_ROMBanks - 1) & (state->m_ROMBanks - 1)] );
267267}
268268
269269READ8_MEMBER( wswan_state::wswan_sram_r )
r14976r14977
848848         if ( ( data & 0x01 ) && !m_bios_disabled )
849849         {
850850            m_bios_disabled = 1;
851            memory_set_bankptr( machine(), "bank15", m_ROMMap[ ( ( ( m_ws_portram[0xc0] & 0x0F ) << 4 ) | 15 ) & ( m_ROMBanks - 1 ) ] );
851            membank( "bank15" )->set_base( m_ROMMap[ ( ( ( m_ws_portram[0xc0] & 0x0F ) << 4 ) | 15 ) & ( m_ROMBanks - 1 ) ] );
852852         }
853853         break;
854854      case 0xa2:   /* Timer control
r14976r14977
10461046                   Bit 0-3 - ROM bank base register for banks 4-15
10471047                   Bit 4-7 - Unknown
10481048                */
1049         memory_set_bankptr( machine(), "bank4", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 4 ) & ( m_ROMBanks - 1 ) ] );
1050         memory_set_bankptr( machine(), "bank5", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 5 ) & ( m_ROMBanks - 1 ) ] );
1051         memory_set_bankptr( machine(), "bank6", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 6 ) & ( m_ROMBanks - 1 ) ] );
1052         memory_set_bankptr( machine(), "bank7", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 7 ) & ( m_ROMBanks - 1 ) ] );
1053         memory_set_bankptr( machine(), "bank8", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 8 ) & ( m_ROMBanks - 1 ) ] );
1054         memory_set_bankptr( machine(), "bank9", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 9 ) & ( m_ROMBanks - 1 ) ] );
1055         memory_set_bankptr( machine(), "bank10", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 10 ) & ( m_ROMBanks - 1 ) ] );
1056         memory_set_bankptr( machine(), "bank11", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 11 ) & ( m_ROMBanks - 1 ) ] );
1057         memory_set_bankptr( machine(), "bank12", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 12 ) & ( m_ROMBanks - 1 ) ] );
1058         memory_set_bankptr( machine(), "bank13", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 13 ) & ( m_ROMBanks - 1 ) ] );
1059         memory_set_bankptr( machine(), "bank14", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 14 ) & ( m_ROMBanks - 1 ) ] );
1049         membank( "bank4" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 4 ) & ( m_ROMBanks - 1 ) ] );
1050         membank( "bank5" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 5 ) & ( m_ROMBanks - 1 ) ] );
1051         membank( "bank6" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 6 ) & ( m_ROMBanks - 1 ) ] );
1052         membank( "bank7" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 7 ) & ( m_ROMBanks - 1 ) ] );
1053         membank( "bank8" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 8 ) & ( m_ROMBanks - 1 ) ] );
1054         membank( "bank9" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 9 ) & ( m_ROMBanks - 1 ) ] );
1055         membank( "bank10" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 10 ) & ( m_ROMBanks - 1 ) ] );
1056         membank( "bank11" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 11 ) & ( m_ROMBanks - 1 ) ] );
1057         membank( "bank12" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 12 ) & ( m_ROMBanks - 1 ) ] );
1058         membank( "bank13" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 13 ) & ( m_ROMBanks - 1 ) ] );
1059         membank( "bank14" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 14 ) & ( m_ROMBanks - 1 ) ] );
10601060         if ( m_bios_disabled )
10611061         {
1062            memory_set_bankptr( machine(), "bank15", m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 15 ) & ( m_ROMBanks - 1 ) ] );
1062            membank( "bank15" )->set_base( m_ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 15 ) & ( m_ROMBanks - 1 ) ] );
10631063         }
10641064         break;
10651065      case 0xc1:   /* SRAM bank select
r14976r14977
10731073      case 0xc2:   /* ROM bank select for segment 2 (0x20000 - 0x2ffff)
10741074                   Bit 0-7 - ROM bank for segment 2
10751075                */
1076         memory_set_bankptr( machine(), "bank2", m_ROMMap[ data & ( m_ROMBanks - 1 ) ]);
1076         membank( "bank2" )->set_base( m_ROMMap[ data & ( m_ROMBanks - 1 ) ]);
10771077         break;
10781078      case 0xc3:   /* ROM bank select for segment 3 (0x30000-0x3ffff)
10791079                   Bit 0-7 - ROM bank for segment 3
10801080                */
1081         memory_set_bankptr( machine(), "bank3", m_ROMMap[ data & ( m_ROMBanks - 1 ) ]);
1081         membank( "bank3" )->set_base( m_ROMMap[ data & ( m_ROMBanks - 1 ) ]);
10821082         break;
10831083      case 0xc6:   /* EEPROM address lower bits port/EEPROM address and command port
10841084                   1KBit EEPROM:
src/mess/machine/z80ne.c
r14976r14977
7878
7979DRIVER_INIT( z80ne )
8080{
81   z80ne_state *state = machine.driver_data<z80ne_state>();
8182   /* first two entries point to rom on reset */
82   UINT8 *RAM = machine.region("z80ne")->base();
83   memory_configure_bank(machine, "bank1", 0, 1, &RAM[0x00000], 0x0400); /* RAM   at 0x0000 */
84   memory_configure_bank(machine, "bank1", 1, 1, &RAM[0x14000], 0x0400); /* ep382 at 0x0000 */
85   memory_configure_bank(machine, "bank2", 0, 1, &RAM[0x14000], 0x0400); /* ep382 at 0x8000 */
83   UINT8 *RAM = state->memregion("z80ne")->base();
84   state->membank("bank1")->configure_entry(0, &RAM[0x00000]); /* RAM   at 0x0000 */
85   state->membank("bank1")->configure_entry(1, &RAM[0x14000]); /* ep382 at 0x0000 */
86   state->membank("bank2")->configure_entry(0, &RAM[0x14000]); /* ep382 at 0x8000 */
8687}
8788
8889DRIVER_INIT( z80net )
r14976r14977
9697
9798DRIVER_INIT( z80netf )
9899{
100   z80ne_state *state = machine.driver_data<z80ne_state>();
99101   /* first two entries point to rom on reset */
100   UINT8 *RAM = machine.region("z80ne")->base();
101   memory_configure_bank(machine, "bank1", 0, 1, &RAM[0x00000], 0x0400); /* RAM   at 0x0000-0x03FF */
102   memory_configure_bank(machine, "bank1", 1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0x0000-0x03FF */
103   memory_configure_bank(machine, "bank1", 4, 1, &RAM[0x14000], 0x0400); /* ep382 at 0x0000-0x03FF */
104   memory_configure_bank(machine, "bank1", 5, 1, &RAM[0x10000], 0x0400); /* ep548 at 0x0000-0x03FF */
102   UINT8 *RAM = state->memregion("z80ne")->base();
103   state->membank("bank1")->configure_entry(0, &RAM[0x00000]); /* RAM   at 0x0000-0x03FF */
104   state->membank("bank1")->configure_entries(1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0x0000-0x03FF */
105   state->membank("bank1")->configure_entry(4, &RAM[0x14000]); /* ep382 at 0x0000-0x03FF */
106   state->membank("bank1")->configure_entry(5, &RAM[0x10000]); /* ep548 at 0x0000-0x03FF */
105107
106   memory_configure_bank(machine, "bank2", 0, 1, &RAM[0x00400], 0x3C00); /* RAM   at 0x0400 */
107   memory_configure_bank(machine, "bank2", 1, 1, &RAM[0x10400], 0x3C00); /* ep548 at 0x0400-0x3FFF */
108   state->membank("bank2")->configure_entry(0, &RAM[0x00400]); /* RAM   at 0x0400 */
109   state->membank("bank2")->configure_entry(1, &RAM[0x10400]); /* ep548 at 0x0400-0x3FFF */
108110
109   memory_configure_bank(machine, "bank3", 0, 1, &RAM[0x08000], 0x0400); /* RAM   at 0x8000 */
110   memory_configure_bank(machine, "bank3", 1, 1, &RAM[0x14000], 0x0400); /* ep382 at 0x8000 */
111   state->membank("bank3")->configure_entry(0, &RAM[0x08000]); /* RAM   at 0x8000 */
112   state->membank("bank3")->configure_entry(1, &RAM[0x14000]); /* ep382 at 0x8000 */
111113
112   memory_configure_bank(machine, "bank4", 0, 1, &RAM[0x0F000], 0x0400); /* RAM   at 0xF000 */
113   memory_configure_bank(machine, "bank4", 1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0xF000 */
114   state->membank("bank4")->configure_entry(0, &RAM[0x0F000]); /* RAM   at 0xF000 */
115   state->membank("bank4")->configure_entries(1, 3, &RAM[0x14400], 0x0400); /* ep390, ep1390, ep2390 at 0xF000 */
114116
115117}
116118
r14976r14977
199201      /* remove this callback */
200202      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
201203      /* and switch to RAM bank at address 0x0000 */
202      memory_set_bank( machine, "bank1", 0 ); /* RAM at 0x0000 (bank 1) */
204      state->membank( "bank1" )->set_entry( 0 ); /* RAM at 0x0000 (bank 1) */
203205   }
204206   return address;
205207}
r14976r14977
218220   address_space *space = machine.device("z80ne")->memory().space(AS_PROGRAM);
219221
220222   /* switch to ROM bank at address 0x0000 */
221    memory_set_bank(machine, "bank1", 1);
222    memory_set_bank(machine, "bank2", 0);  /* ep382 at 0x8000 */
223    state->membank("bank1")->set_entry(1);
224    state->membank("bank2")->set_entry(0);  /* ep382 at 0x8000 */
223225
224226   /* after the first 3 bytes have been read from ROM, switch the RAM back in */
225227   state->m_reset_delay_counter = 2;
r14976r14977
236238   case 0x01: /* EP382 Hex Monitor */
237239      if (VERBOSE)
238240         logerror("reset_lx390_banking: banking ep382\n");
239       memory_set_bank(machine, "bank1", 4);  /* ep382 at 0x0000 for 3 cycles, then RAM */
240       memory_set_bank(machine, "bank2", 0);  /* RAM   at 0x0400 */
241       memory_set_bank(machine, "bank3", 1);  /* ep382 at 0x8000 */
242       memory_set_bank(machine, "bank4", 0);  /* RAM   at 0xF000 */
241       state->membank("bank1")->set_entry(4);  /* ep382 at 0x0000 for 3 cycles, then RAM */
242       state->membank("bank2")->set_entry(0);  /* RAM   at 0x0400 */
243       state->membank("bank3")->set_entry(1);  /* ep382 at 0x8000 */
244       state->membank("bank4")->set_entry(0);  /* RAM   at 0xF000 */
243245      /* after the first 3 bytes have been read from ROM, switch the RAM back in */
244246      state->m_reset_delay_counter = 2;
245247      space->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_reset_delay_count), &machine));
r14976r14977
247249   case 0x02: /* EP548  16k BASIC */
248250      if (VERBOSE)
249251         logerror("reset_lx390_banking: banking ep548\n");
250       memory_set_bank(machine, "bank1", 5);  /* ep548 at 0x0000-0x03FF */
251       memory_set_bank(machine, "bank2", 1);  /* ep548 at 0x0400-0x3FFF */
252       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
253       memory_set_bank(machine, "bank4", 0);  /* RAM   at 0xF000 */
252       state->membank("bank1")->set_entry(5);  /* ep548 at 0x0000-0x03FF */
253       state->membank("bank2")->set_entry(1);  /* ep548 at 0x0400-0x3FFF */
254       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
255       state->membank("bank4")->set_entry(0);  /* RAM   at 0xF000 */
254256      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
255257       break;
256258   case 0x03: /* EP390  Boot Loader for 5.5k floppy BASIC */
257259      if (VERBOSE)
258260         logerror("reset_lx390_banking: banking ep390\n");
259       memory_set_bank(machine, "bank1", 1);  /* ep390 at 0x0000-0 x03FF for 3 cycles, then RAM */
260       memory_set_bank(machine, "bank2", 0);  /* RAM   at 0x0400-0x3FFF */
261       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
262       memory_set_bank(machine, "bank4", 1);  /* ep390 at 0xF000 */
261       state->membank("bank1")->set_entry(1);  /* ep390 at 0x0000-0 x03FF for 3 cycles, then RAM */
262       state->membank("bank2")->set_entry(0);  /* RAM   at 0x0400-0x3FFF */
263       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
264       state->membank("bank4")->set_entry(1);  /* ep390 at 0xF000 */
263265      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
264266       break;
265267   case 0x04: /* EP1390 Boot Loader for NE DOS 1.0/1.5 */
266268      if (VERBOSE)
267269         logerror("reset_lx390_banking: banking ep1390\n");
268       memory_set_bank(machine, "bank1", 2);  /* ep1390 at 0x0000-0x03FF for 3 cycles, then RAM */
269       memory_set_bank(machine, "bank2", 0);  /* RAM   at 0x0400-0x3FFF */
270       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
271       memory_set_bank(machine, "bank4", 2);  /* ep1390 at 0xF000 */
270       state->membank("bank1")->set_entry(2);  /* ep1390 at 0x0000-0x03FF for 3 cycles, then RAM */
271       state->membank("bank2")->set_entry(0);  /* RAM   at 0x0400-0x3FFF */
272       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
273       state->membank("bank4")->set_entry(2);  /* ep1390 at 0xF000 */
272274      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
273275       break;
274276   case 0x05: /* EP2390 Boot Loader for NE DOS G.1 */
275277      if (VERBOSE)
276278         logerror("reset_lx390_banking: banking ep2390\n");
277       memory_set_bank(machine, "bank1", 3);  /* ep2390 at 0x0000-0x03FF for 3 cycles, then RAM */
278       memory_set_bank(machine, "bank2", 0);  /* RAM   at 0x0400-0x3FFF */
279       memory_set_bank(machine, "bank3", 0);  /* RAM   at 0x8000 */
280       memory_set_bank(machine, "bank4", 3);  /* ep2390 at 0xF000 */
279       state->membank("bank1")->set_entry(3);  /* ep2390 at 0x0000-0x03FF for 3 cycles, then RAM */
280       state->membank("bank2")->set_entry(0);  /* RAM   at 0x0400-0x3FFF */
281       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
282       state->membank("bank4")->set_entry(3);  /* ep2390 at 0xF000 */
281283      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_default), &machine));
282284       break;
283285   }
r14976r14977
704706}
705707
706708READ8_DEVICE_HANDLER(lx390_reset_bank)
707{
709{   
710   z80ne_state *state = device->machine().driver_data<z80ne_state>();
708711   offs_t pc;
709712
710713   /* if PC is not in range, we are under integrated debugger control, DON'T SWAP */
r14976r14977
712715   if((pc >= 0xf000) && (pc <=0xffff))
713716   {
714717      LOG(("lx390_reset_bank, reset memory bank 1\n"));
715      memory_set_bank(device->machine(), "bank1", 0); /* RAM at 0x0000 (bank 1) */
718      state->membank("bank1")->set_entry(0); /* RAM at 0x0000 (bank 1) */
716719   }
717720   else
718721   {
src/mess/machine/apple2gs.c
r14976r14977
552552               break;
553553
554554            case 0x07:   /* synchronize */
555               if (machine.region("maincpu")->bytes() == 0x40000)   /* HACK */
555               if (state->memregion("maincpu")->bytes() == 0x40000)   /* HACK */
556556                  state->m_adb_command_length = 8;
557557               else
558558                  state->m_adb_command_length = 4;
r14976r14977
827827
828828         if (state->m_sndglu_ctrl & 0x40)   // docram access
829829         {
830            UINT8 *docram = space->machine().region("es5503")->base();
830            UINT8 *docram = state->memregion("es5503")->base();
831831            state->m_sndglu_dummy_read = docram[state->m_sndglu_addr];
832832         }
833833         else
r14976r14977
868868      case 1:   // data write
869869         if (state->m_sndglu_ctrl & 0x40)   // docram access
870870         {
871            UINT8 *docram = space->machine().region("es5503")->base();
871            UINT8 *docram = space->machine().root_device().memregion("es5503")->base();
872872            docram[state->m_sndglu_addr] = data;
873873         }
874874         else
r14976r14977
10471047      case 0x74: case 0x75: case 0x76: case 0x77:
10481048      case 0x78: case 0x79: case 0x7a: case 0x7b:
10491049      case 0x7c: case 0x7d: case 0x7e: case 0x7f:
1050         offset |= (space->machine().region("maincpu")->bytes() - 1) & ~0x3FFF;
1051         result = space->machine().region("maincpu")->base()[offset];
1050         offset |= (space->machine().root_device().memregion("maincpu")->bytes() - 1) & ~0x3FFF;
1051         result = space->machine().root_device().memregion("maincpu")->base()[offset];
10521052         break;
10531053
10541054      case 0x21:   /* C021 - MONOCOLOR */
r14976r14977
15371537   assert(address >= 0xC000);
15381538   assert(address <= 0xCFFF);
15391539
1540   rom = machine.region("maincpu")->base();
1541   rom += 0x030000 % machine.region("maincpu")->bytes();
1540   rom = machine.root_device().memregion("maincpu")->base();
1541   rom += 0x030000 % machine.root_device().memregion("maincpu")->bytes();
15421542   return &rom[address];
15431543}
15441544
r14976r14977
17591759
17601760      // ROM 03 hardware: the quoted "1 MB" for a base machine doesn't include banks e0/e1, so map accordingly
17611761      space->install_readwrite_bank(0x010000, ramsize - 1, "bank1");
1762      memory_set_bankptr(machine,"bank1", machine.device<ram_device>(RAM_TAG)->pointer() + 0x010000);
1762      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x010000);
17631763
17641764      space->install_legacy_read_handler( ramsize, 0xdfffff, FUNC(apple2gs_bank_echo_r));
17651765      state->m_echo_bank = (ramsize >> 16);
r14976r14977
17701770
17711771      // ROM 00/01 hardware: the quoted "256K" for a base machine *does* include banks e0/e1.
17721772      space->install_readwrite_bank(0x010000, ramsize - 1 + 0x10000, "bank1");
1773      memory_set_bankptr(machine,"bank1", machine.device<ram_device>(RAM_TAG)->pointer() + 0x010000);
1773      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x010000);
17741774
17751775      space->install_legacy_read_handler( ramsize + 0x10000, 0xdfffff, FUNC(apple2gs_bank_echo_r));
17761776      state->m_echo_bank = (ramsize+0x10000) >> 16;
r14976r14977
17831783   space->install_legacy_write_handler(0xe02000, 0xe03fff, FUNC(apple2gs_E02xxx_w));
17841784   space->install_legacy_write_handler(0xe10400, 0xe107ff, FUNC(apple2gs_E104xx_w));
17851785   space->install_legacy_write_handler(0xe12000, 0xe13fff, FUNC(apple2gs_E12xxx_w));
1786   memory_set_bankptr(machine,"bank2", state->m_slowmem);
1786   state->membank("bank2")->set_base(state->m_slowmem);
17871787
17881788   /* install alternate ROM bank */
1789   begin = 0x1000000 - machine.region("maincpu")->bytes();
1789   begin = 0x1000000 - machine.root_device().memregion("maincpu")->bytes();
17901790   end = 0xffffff;
17911791   space->install_read_bank(begin, end, "bank3");
1792   memory_set_bankptr(machine,"bank3", machine.region("maincpu")->base());
1792   state->membank("bank3")->set_base(machine.root_device().memregion("maincpu")->base());
17931793
17941794   /* install new xxC000-xxCFFF handlers */
17951795   space->install_legacy_read_handler(0x00c000, 0x00cfff, FUNC(apple2gs_00Cxxx_r));
src/mess/machine/comx_thm.c
r14976r14977
5858{
5959   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
6060
61   m_rom = subregion("c000")->base();
61   m_rom = memregion("c000")->base();
6262}
6363
6464
src/mess/machine/mpc105.c
r14976r14977
119119            if (m_bank_base > 0)
120120            {
121121               sprintf(bank_str,"bank%d",bank + m_bank_base);
122               memory_set_bankptr(machine(), bank_str, machine().device<ram_device>(RAM_TAG)->pointer());
122               membank(bank_str)->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
123123            }
124124         }
125125      }
src/mess/machine/iq151_minigraf.c
r14976r14977
5757
5858void iq151_minigraf_device::device_start()
5959{
60   m_rom = (UINT8*)subregion("minigraf")->base();
60   m_rom = (UINT8*)memregion("minigraf")->base();
6161
6262   // allocate a bitmap for represent the paper
6363   m_paper = auto_bitmap_ind16_alloc(machine(), PAPER_WIDTH, PAPER_HEIGHT);
src/mess/machine/iq151_rom.c
r14976r14977
5151
5252void iq151_rom_device::device_start()
5353{
54   m_rom = (UINT8*)subregion("rom")->base();
54   m_rom = (UINT8*)memregion("rom")->base();
5555}
5656
5757//-------------------------------------------------
src/mess/machine/nes.c
r14976r14977
4141   int prg_banks = (state->m_prg_chunks == 1) ? (2 * 2) : (state->m_prg_chunks * 2);
4242   int i;
4343
44   state->m_rom = machine.region("maincpu")->base();
45   state->m_ciram = machine.region("ciram")->base();
44   state->m_rom = machine.root_device().memregion("maincpu")->base();
45   state->m_ciram = machine.root_device().memregion("ciram")->base();
4646   // other pointers got set in the loading routine
4747
4848   /* Brutal hack put in as a consequence of the new memory system; we really need to fix the NES code */
r14976r14977
5151   machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0, 0x1fff, FUNC(nes_chr_r), FUNC(nes_chr_w));
5252   machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2000, 0x3eff, FUNC(nes_nt_r), FUNC(nes_nt_w));
5353
54   memory_set_bankptr(machine, "bank10", state->m_rom);
54   state->membank("bank10")->set_base(state->m_rom);
5555
5656   /* If there is Disk Expansion and no cart has been loaded, setup memory accordingly */
5757   if (state->m_disk_expansion && state->m_pcb_id == NO_BOARD)
r14976r14977
7575      space->install_write_handler(0x4020, 0x402f, write8_delegate(FUNC(nes_state::nes_fds_w),state));
7676      space->install_write_bank(0x6000, 0xdfff, "bank2");
7777
78      memory_set_bankptr(machine, "bank1", &state->m_rom[0xe000]);
79      memory_set_bankptr(machine, "bank2", state->m_fds_ram);
78      state->membank("bank1")->set_base(&state->m_rom[0xe000]);
79      state->membank("bank2")->set_base(state->m_fds_ram);
8080      return;
8181   }
8282
r14976r14977
9393   /* configure banks 1-4 */
9494   for (i = 0; i < 4; i++)
9595   {
96      memory_configure_bank(machine, bank_names[i], 0, prg_banks, state->m_prg, 0x2000);
96      state->membank(bank_names[i])->configure_entries(0, prg_banks, state->m_prg, 0x2000);
9797      // some mappers (e.g. MMC5) can map PRG RAM in  0x8000-0xffff as well
9898      if (state->m_prg_ram)
99         memory_configure_bank(machine, bank_names[i], prg_banks, state->m_wram_size / 0x2000, state->m_wram, 0x2000);
99         state->membank(bank_names[i])->configure_entries(prg_banks, state->m_wram_size / 0x2000, state->m_wram, 0x2000);
100100      // however, at start we point to PRG ROM
101      memory_set_bank(machine, bank_names[i], i);
101      state->membank(bank_names[i])->set_entry(i);
102102      state->m_prg_bank[i] = i;
103103   }
104104
105105   /* bank 5 configuration is more delicate, since it can have PRG RAM, PRG ROM or SRAM mapped to it */
106106   /* we first map PRG ROM banks, then the battery bank (if a battery is present), and finally PRG RAM (state->m_wram) */
107   memory_configure_bank(machine, "bank5", 0, prg_banks, state->m_prg, 0x2000);
107   state->membank("bank5")->configure_entries(0, prg_banks, state->m_prg, 0x2000);
108108   state->m_battery_bank5_start = prg_banks;
109109   state->m_prgram_bank5_start = prg_banks;
110110   state->m_empty_bank5_start = prg_banks;
r14976r14977
114114   {
115115      UINT32 bank_size = (state->m_battery_size > 0x2000) ? 0x2000 : state->m_battery_size;
116116      int bank_num = (state->m_battery_size > 0x2000) ? state->m_battery_size / 0x2000 : 1;
117      memory_configure_bank(machine, "bank5", prg_banks, bank_num, state->m_battery_ram, bank_size);
117      state->membank("bank5")->configure_entries(prg_banks, bank_num, state->m_battery_ram, bank_size);
118118      state->m_prgram_bank5_start += bank_num;
119119      state->m_empty_bank5_start += bank_num;
120120   }
121121   /* add prg ram. */
122122   if (state->m_prg_ram)
123123   {
124      memory_configure_bank(machine, "bank5", state->m_prgram_bank5_start, state->m_wram_size / 0x2000, state->m_wram, 0x2000);
124      state->membank("bank5")->configure_entries(state->m_prgram_bank5_start, state->m_wram_size / 0x2000, state->m_wram, 0x2000);
125125      state->m_empty_bank5_start += state->m_wram_size / 0x2000;
126126   }
127127
128   memory_configure_bank(machine, "bank5", state->m_empty_bank5_start, 1, state->m_rom + 0x6000, 0x2000);
128   state->membank("bank5")->configure_entry(state->m_empty_bank5_start, state->m_rom + 0x6000);
129129
130130   /* if we have any additional PRG RAM, point bank5 to its first bank */
131131   if (state->m_battery || state->m_prg_ram)
r14976r14977
133133   else
134134      state->m_prg_bank[4] = state->m_empty_bank5_start; // or shall we point to "maincpu" region at 0x6000? point is that we should never access this region if no sram or wram is present!
135135
136   memory_set_bank(machine, "bank5", state->m_prg_bank[4]);
136   state->membank("bank5")->set_entry(state->m_prg_bank[4]);
137137
138138   if (state->m_four_screen_vram)
139139   {
r14976r14977
228228
229229static void nes_banks_restore(nes_state *state)
230230{
231   memory_set_bank(state->machine(), "bank1", state->m_prg_bank[0]);
232   memory_set_bank(state->machine(), "bank2", state->m_prg_bank[1]);
233   memory_set_bank(state->machine(), "bank3", state->m_prg_bank[2]);
234   memory_set_bank(state->machine(), "bank4", state->m_prg_bank[3]);
235   memory_set_bank(state->machine(), "bank5", state->m_prg_bank[4]);
231   state->membank("bank1")->set_entry(state->m_prg_bank[0]);
232   state->membank("bank2")->set_entry(state->m_prg_bank[1]);
233   state->membank("bank3")->set_entry(state->m_prg_bank[2]);
234   state->membank("bank4")->set_entry(state->m_prg_bank[3]);
235   state->membank("bank5")->set_entry(state->m_prg_bank[4]);
236236}
237237
238238static void nes_state_register( running_machine &machine )
src/mess/machine/lux21046.c
r14976r14977
395395   save_item(NAME(m_force_busy));
396396
397397   // patch out sector skew table
398/*  UINT8 *rom = subregion(Z80_TAG)->base();
398/*  UINT8 *rom = memregion(Z80_TAG)->base();
399399
400400    for (int i = 0; i < 16; i++)
401401        rom[0x2dd3 + i] = i + 1;*/
src/mess/machine/nes_mmc.c
r14976r14977
260260      bank &= (state->m_wram_size / 0x2000) - 1;
261261      state->m_prg_bank[4] = state->m_prgram_bank5_start + bank;
262262   }
263   memory_set_bank(machine, "bank5", state->m_prg_bank[4]);
263   state->membank("bank5")->set_entry(state->m_prg_bank[4]);
264264}
265265
266266INLINE void prg_bank_refresh( running_machine &machine )
267267{
268268   nes_state *state = machine.driver_data<nes_state>();
269   memory_set_bank(machine, "bank1", state->m_prg_bank[0]);
270   memory_set_bank(machine, "bank2", state->m_prg_bank[1]);
271   memory_set_bank(machine, "bank3", state->m_prg_bank[2]);
272   memory_set_bank(machine, "bank4", state->m_prg_bank[3]);
269   state->membank("bank1")->set_entry(state->m_prg_bank[0]);
270   state->membank("bank2")->set_entry(state->m_prg_bank[1]);
271   state->membank("bank3")->set_entry(state->m_prg_bank[2]);
272   state->membank("bank4")->set_entry(state->m_prg_bank[3]);
273273}
274274
275275/* PRG ROM in 8K, 16K or 32K blocks */
r14976r14977
371371   bank &= ((state->m_prg_chunks << 1) - 1);
372372
373373   state->m_prg_bank[4] = bank;
374   memory_set_bank(machine, "bank5", state->m_prg_bank[4]);
374   state->membank("bank5")->set_entry(state->m_prg_bank[4]);
375375}
376376
377377/* We also define an additional helper to map 8k PRG-ROM to one of the banks (passed as parameter) */
src/mess/machine/sym1.c
r14976r14977
306306       so that the CPU can find its reset vectors */
307307   machine.device( "maincpu")->memory().space( AS_PROGRAM )->install_read_bank(0xf800, 0xffff, "bank1");
308308   machine.device( "maincpu")->memory().space( AS_PROGRAM )->nop_write(0xf800, 0xffff);
309   memory_set_bankptr(machine, "bank1", state->m_monitor + 0x800);
309   state->membank("bank1")->set_base(state->m_monitor + 0x800);
310310   machine.device("maincpu")->reset();
311311}
src/mess/machine/ondra.c
r14976r14977
4040static void ondra_update_banks(running_machine &machine)
4141{
4242   ondra_state *state = machine.driver_data<ondra_state>();
43   UINT8 *mem = machine.region("maincpu")->base();
43   UINT8 *mem = state->memregion("maincpu")->base();
4444   if (state->m_bank1_status==0) {
4545      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x3fff);
46      memory_set_bankptr(machine, "bank1", mem + 0x010000);
46      state->membank("bank1")->set_base(mem + 0x010000);
4747   } else {
4848      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x3fff, "bank1");
49      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer() + 0x0000);
49      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x0000);
5050   }
51   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
51   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
5252   if (state->m_bank2_status==0) {
5353      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xe000, 0xffff, "bank3");
54      memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0xe000);
54      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xe000);
5555   } else {
5656      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xe000, 0xffff);
5757      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler (0xe000, 0xffff, read8_delegate(FUNC(ondra_state::ondra_keyboard_r),state));
src/mess/machine/kaypro.c
r14976r14977
4848   {
4949      mem->unmap_readwrite (0x0000, 0x3fff);
5050      mem->install_read_bank (0x0000, 0x0fff, "bank1");
51      memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base());
51      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
5252      mem->install_readwrite_handler (0x3000, 0x3fff, read8_delegate(FUNC(kaypro_state::kaypro_videoram_r), this), write8_delegate(FUNC(kaypro_state::kaypro_videoram_w), this));
5353   }
5454   else
r14976r14977
5656      mem->unmap_readwrite(0x0000, 0x3fff);
5757      mem->install_read_bank (0x0000, 0x3fff, "bank2");
5858      mem->install_write_bank (0x0000, 0x3fff, "bank3");
59      memory_set_bankptr(machine(), "bank2", machine().region("rambank")->base());
60      memory_set_bankptr(machine(), "bank3", machine().region("rambank")->base());
59      membank("bank2")->set_base(machine().root_device().memregion("rambank")->base());
60      membank("bank3")->set_base(machine().root_device().memregion("rambank")->base());
6161   }
6262
6363   wd17xx_dden_w(m_fdc, BIT(data, 5));
r14976r14977
161161   {
162162      mem->unmap_readwrite (0x0000, 0x3fff);
163163      mem->install_read_bank (0x0000, 0x1fff, "bank1");
164      memory_set_bankptr(mem->machine(), "bank1", mem->machine().region("maincpu")->base());
164      membank("bank1")->set_base(mem->machine().root_device().memregion("maincpu")->base());
165165   }
166166   else
167167   {
168168      mem->unmap_readwrite (0x0000, 0x3fff);
169169      mem->install_read_bank (0x0000, 0x3fff, "bank2");
170170      mem->install_write_bank (0x0000, 0x3fff, "bank3");
171      memory_set_bankptr(mem->machine(), "bank2", mem->machine().region("rambank")->base());
172      memory_set_bankptr(mem->machine(), "bank3", mem->machine().region("rambank")->base());
171      membank("bank2")->set_base(mem->machine().root_device().memregion("rambank")->base());
172      membank("bank3")->set_base(mem->machine().root_device().memregion("rambank")->base());
173173   }
174174
175175   wd17xx_dden_w(m_fdc, BIT(data, 5));
r14976r14977
375375{
376376   kaypro_state *state = image.device().machine().driver_data<kaypro_state>();
377377   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
378   UINT8 *RAM = image.device().machine().region("rambank")->base();
378   UINT8 *RAM = state->memregion("rambank")->base();
379379   UINT16 i;
380380   UINT8 data;
381381
r14976r14977
398398{
399399   kaypro_state *state = image.device().machine().driver_data<kaypro_state>();
400400   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
401   UINT8 *RAM = image.device().machine().region("rambank")->base();
401   UINT8 *RAM = state->memregion("rambank")->base();
402402   UINT16 i;
403403   UINT8 data;
404404
src/mess/machine/partner.c
r14976r14977
5454   sprintf(bank,"bank%d",bank_num);
5555   switch(state->m_win_mem_page) {
5656      case 2 : // FDD BIOS
57            memory_set_bankptr(machine, bank, rom + 0x16000 + offset);
57            state->membank(bank)->set_base(rom + 0x16000 + offset);
5858            break;
5959      case 4 : // MCPG BIOS
60            memory_set_bankptr(machine, bank, rom + 0x14000 + offset);
60            state->membank(bank)->set_base(rom + 0x14000 + offset);
6161            break;
6262      default : // BIOS
63            memory_set_bankptr(machine, bank, rom + 0x10000 + offset);
63            state->membank(bank)->set_base(rom + 0x10000 + offset);
6464            break;
6565   }
6666}
r14976r14977
7272   sprintf(bank,"bank%d",bank_num);
7373   switch(state->m_win_mem_page) {
7474      case 4 : // MCPG FONT
75            memory_set_bankptr(machine, bank, rom + 0x18000 + offset);
75            state->membank(bank)->set_base(rom + 0x18000 + offset);
7676            break;
7777      default : // BIOS
78            memory_set_bankptr(machine, bank, rom + 0x10000 + offset);
78            state->membank(bank)->set_base(rom + 0x10000 + offset);
7979            break;
8080   }
8181}
r14976r14977
137137            // Timer
138138            break;
139139      default : // BIOS
140            memory_set_bankptr(machine, "bank11", rom + 0x10000);
140            state->membank("bank11")->set_base(rom + 0x10000);
141141            break;
142142   }
143143}
r14976r14977
145145{
146146   partner_state *state = machine.driver_data<partner_state>();
147147   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
148   UINT8 *rom = machine.region("maincpu")->base();
148   UINT8 *rom = state->memregion("maincpu")->base();
149149   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
150150
151151   space->install_write_bank(0x0000, 0x07ff, "bank1");
r14976r14977
166166   // BANK 1 (0x0000 - 0x07ff)
167167   if (state->m_mem_page==0) {
168168      space->unmap_write(0x0000, 0x07ff);
169      memory_set_bankptr(machine, "bank1", rom + 0x10000);
169      state->membank("bank1")->set_base(rom + 0x10000);
170170   } else {
171171      if (state->m_mem_page==7) {
172         memory_set_bankptr(machine, "bank1", ram + 0x8000);
172         state->membank("bank1")->set_base(ram + 0x8000);
173173      } else {
174         memory_set_bankptr(machine, "bank1", ram + 0x0000);
174         state->membank("bank1")->set_base(ram + 0x0000);
175175      }
176176   }
177177
178178   // BANK 2 (0x0800 - 0x3fff)
179179   if (state->m_mem_page==7) {
180      memory_set_bankptr(machine, "bank2", ram + 0x8800);
180      state->membank("bank2")->set_base(ram + 0x8800);
181181   } else {
182      memory_set_bankptr(machine, "bank2", ram + 0x0800);
182      state->membank("bank2")->set_base(ram + 0x0800);
183183   }
184184
185185   // BANK 3 (0x4000 - 0x5fff)
186186   if (state->m_mem_page==7) {
187      memory_set_bankptr(machine, "bank3", ram + 0xC000);
187      state->membank("bank3")->set_base(ram + 0xC000);
188188   } else {
189189      if (state->m_mem_page==10) {
190190         //window 1
191191         space->unmap_write(0x4000, 0x5fff);
192192         partner_window_1(machine, 3, 0, rom);
193193      } else {
194         memory_set_bankptr(machine, "bank3", ram + 0x4000);
194         state->membank("bank3")->set_base(ram + 0x4000);
195195      }
196196   }
197197
198198   // BANK 4 (0x6000 - 0x7fff)
199199   if (state->m_mem_page==7) {
200      memory_set_bankptr(machine, "bank4", ram + 0xe000);
200      state->membank("bank4")->set_base(ram + 0xe000);
201201   } else {
202      memory_set_bankptr(machine, "bank4", ram + 0x6000);
202      state->membank("bank4")->set_base(ram + 0x6000);
203203   }
204204
205205   // BANK 5 (0x8000 - 0x9fff)
r14976r14977
217217            partner_window_1(machine, 5, 0, rom);
218218            break;
219219      case 7:
220            memory_set_bankptr(machine, "bank5", ram + 0x0000);
220            state->membank("bank5")->set_base(ram + 0x0000);
221221            break;
222222      default:
223            memory_set_bankptr(machine, "bank5", ram + 0x8000);
223            state->membank("bank5")->set_base(ram + 0x8000);
224224            break;
225225   }
226226
r14976r14977
236236      case 8:
237237            //BASIC
238238            space->unmap_write(0xa000, 0xb7ff);
239            memory_set_bankptr(machine, "bank6", rom + 0x12000); // BASIC
239            state->membank("bank6")->set_base(rom + 0x12000); // BASIC
240240            break;
241241      case 7:
242            memory_set_bankptr(machine, "bank6", ram + 0x2000);
242            state->membank("bank6")->set_base(ram + 0x2000);
243243            break;
244244      default:
245            memory_set_bankptr(machine, "bank6", ram + 0xa000);
245            state->membank("bank6")->set_base(ram + 0xa000);
246246            break;
247247   }
248248
r14976r14977
259259      case 8:
260260            //BASIC
261261            space->unmap_write(0xb800, 0xbfff);
262            memory_set_bankptr(machine, "bank7", rom + 0x13800); // BASIC
262            state->membank("bank7")->set_base(rom + 0x13800); // BASIC
263263            break;
264264      case 7:
265            memory_set_bankptr(machine, "bank7", ram + 0x3800);
265            state->membank("bank7")->set_base(ram + 0x3800);
266266            break;
267267      default:
268            memory_set_bankptr(machine, "bank7", ram + 0xb800);
268            state->membank("bank7")->set_base(ram + 0xb800);
269269            break;
270270   }
271271
272272   // BANK 8 (0xc000 - 0xc7ff)
273273   switch (state->m_mem_page) {
274274      case 7:
275            memory_set_bankptr(machine, "bank8", ram + 0x4000);
275            state->membank("bank8")->set_base(ram + 0x4000);
276276            break;
277277      case 8:
278278      case 10:
279279            space->unmap_write(0xc000, 0xc7ff);
280            memory_set_bankptr(machine, "bank8", rom + 0x10000);
280            state->membank("bank8")->set_base(rom + 0x10000);
281281            break;
282282      default:
283            memory_set_bankptr(machine, "bank8", ram + 0xc000);
283            state->membank("bank8")->set_base(ram + 0xc000);
284284            break;
285285   }
286286
287287   // BANK 9 (0xc800 - 0xcfff)
288288   switch (state->m_mem_page) {
289289      case 7:
290            memory_set_bankptr(machine, "bank9", ram + 0x4800);
290            state->membank("bank9")->set_base(ram + 0x4800);
291291            break;
292292      case 8:
293293      case 9:
r14976r14977
297297            break;
298298      case 10:
299299            space->unmap_write(0xc800, 0xcfff);
300            memory_set_bankptr(machine, "bank9", rom + 0x10800);
300            state->membank("bank9")->set_base(rom + 0x10800);
301301            break;
302302      default:
303            memory_set_bankptr(machine, "bank9", ram + 0xc800);
303            state->membank("bank9")->set_base(ram + 0xc800);
304304            break;
305305   }
306306
307307   // BANK 10 (0xd000 - 0xd7ff)
308308   switch (state->m_mem_page) {
309309      case 7:
310            memory_set_bankptr(machine, "bank10", ram + 0x5000);
310            state->membank("bank10")->set_base(ram + 0x5000);
311311            break;
312312      case 8:
313313      case 9:
r14976r14977
316316            partner_window_2(machine, 10, 0x0800, rom);
317317            break;
318318      default:
319            memory_set_bankptr(machine, "bank10", ram + 0xd000);
319            state->membank("bank10")->set_base(ram + 0xd000);
320320            break;
321321   }
322322
r14976r14977
325325
326326   // BANK 12 (0xe000 - 0xe7ff)
327327   if (state->m_mem_page==1) {
328      memory_set_bankptr(machine, "bank12", rom + 0x10000);
328      state->membank("bank12")->set_base(rom + 0x10000);
329329   } else {
330330      //window 1
331331      partner_window_1(machine, 12, 0, rom);
r14976r14977
341341            break;
342342      default:
343343            // BIOS
344            memory_set_bankptr(machine, "bank13", rom + 0x10800);
344            state->membank("bank13")->set_base(rom + 0x10800);
345345            break;
346346   }
347347}
src/mess/machine/hec2hrp.c
r14976r14977
171171         /*General purpose port (0x08) for the minidisk I/O */
172172         {
173173         // Rom page bank switching
174         memory_set_bank(machine(), "bank2",BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC );
174         membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC );
175175
176176         // Set drive number
177177         if (BIT(data, 6)) wd17xx_set_drive(fdc, 0);  // Set the correct drive number 0
r14976r14977
190190{
191191   if (offset==0x00)   {   /* 0x800 et 0x000=> video page, HR*/
192192                     if (isHectoreXtend(machine()))
193                        memory_set_bank(machine(), "bank1", HECTOR_BANK_VIDEO);
193                        membank("bank1")->set_entry(HECTOR_BANK_VIDEO);
194194                     if (m_flag_clk ==1)
195195                     {
196196                        m_flag_clk=0;
r14976r14977
200200   if (offset==0x04)   {   /* 0x804 => video page, BR*/
201201                     m_hector_flag_hr=0;
202202                     if (isHectoreXtend(machine()))
203                        memory_set_bank(machine(), "bank1", HECTOR_BANK_VIDEO);
203                        membank("bank1")->set_entry(HECTOR_BANK_VIDEO);
204204                     if (m_flag_clk ==0)
205205                     {
206206                        m_flag_clk=1;
r14976r14977
209209                  }
210210   if (offset==0x08)   {   /* 0x808 => base page, HR*/
211211                     if (isHectoreXtend(machine()))
212                        memory_set_bank(machine(), "bank1", HECTOR_BANK_PROG);
212                        membank("bank1")->set_entry(HECTOR_BANK_PROG);
213213                     if (m_flag_clk ==1)
214214                     {
215215                        m_flag_clk=0;
r14976r14977
220220   if (offset==0x0c)   {   /* 0x80c => base page, BR*/
221221                     m_hector_flag_hr=0;
222222                     if (isHectoreXtend(machine()))
223                        memory_set_bank(machine(), "bank1", HECTOR_BANK_PROG);
223                        membank("bank1")->set_entry(HECTOR_BANK_PROG);
224224                     if (m_flag_clk ==0)
225225                     {
226226                        m_flag_clk=1;
r14976r14977
252252            m_hector_flag_hr=1;
253253            if (isHectoreXtend(machine()))
254254               {
255                  memory_set_bank(machine(), "bank1", HECTOR_BANK_PROG);
256                  memory_set_bank(machine(), "bank2", HECTORMX_BANK_PAGE0);
255                  membank("bank1")->set_entry(HECTOR_BANK_PROG);
256                  membank("bank2")->set_entry(HECTORMX_BANK_PAGE0);
257257               }
258258            //RESET DISC II unit
259259            if (isHectorWithDisc2(machine()) )
r14976r14977
567567{
568568/* Bank switching on several address */
569569   if ((offset &0x0ff) == 0x40) /* Port page 0*/
570      memory_set_bank(machine(), "bank2", HECTORMX_BANK_PAGE0);
570      membank("bank2")->set_entry(HECTORMX_BANK_PAGE0);
571571   if ((offset &0x0ff) == 0x41) /* Port page 1*/
572572   {
573      memory_set_bank(machine(), "bank2", HECTORMX_BANK_PAGE1);
573      membank("bank2")->set_entry(HECTORMX_BANK_PAGE1);
574574      m_hector_flag_80c=0;
575575   }
576576   if ((offset &0x0ff) == 0x44) /* Port page 2  => 42 pour MX80*/
577      memory_set_bank(machine(), "bank2", HECTORMX_BANK_PAGE2);
577      membank("bank2")->set_entry(HECTORMX_BANK_PAGE2);
578578   if ((offset &0x0ff) == 0x49) /* Port screen resolution*/
579579      m_hector_flag_80c=0;/* No 80c in 40c !*/
580580}
r14976r14977
583583WRITE8_MEMBER(hec2hrp_state::hector_mx80_io_port_w)
584584{
585585   if ((offset &0x0ff) == 0x40) /* Port page 0*/
586      memory_set_bank(machine(), "bank2", HECTORMX_BANK_PAGE0);
586      membank("bank2")->set_entry(HECTORMX_BANK_PAGE0);
587587   if ((offset &0x0ff) == 0x41) /* Port page 1*/
588588   {
589      memory_set_bank(machine(), "bank2", HECTORMX_BANK_PAGE1);
589      membank("bank2")->set_entry(HECTORMX_BANK_PAGE1);
590590      m_hector_flag_80c=0;
591591   }
592592   if ((offset &0x0ff) == 0x42) /* Port page 2  => port different du MX40*/
593      memory_set_bank(machine(), "bank2", HECTORMX_BANK_PAGE2);
593      membank("bank2")->set_entry(HECTORMX_BANK_PAGE2);
594594   if ((offset &0x0ff) == 0x49) /* Port screen resolution*/
595595      m_hector_flag_80c=1;
596596}
src/mess/machine/bebox.c
r14976r14977
10711071   cputag_set_input_line(machine, "ppc1", INPUT_LINE_RESET, CLEAR_LINE);
10721072   cputag_set_input_line(machine, "ppc2", INPUT_LINE_RESET, ASSERT_LINE);
10731073
1074   memcpy(machine.device<fujitsu_29f016a_device>("flash")->space()->get_read_ptr(0),machine.region("user1")->base(),0x200000);
1074   memcpy(machine.device<fujitsu_29f016a_device>("flash")->space()->get_read_ptr(0),state->memregion("user1")->base(),0x200000);
10751075}
10761076
10771077static void bebox_exit(running_machine &machine)
r14976r14977
10891089
10901090DRIVER_INIT( bebox )
10911091{
1092   bebox_state *state = machine.driver_data<bebox_state>();
10921093   address_space *space_0 = machine.device("ppc1")->memory().space(AS_PROGRAM);
10931094   address_space *space_1 = machine.device("ppc2")->memory().space(AS_PROGRAM);
10941095   offs_t vram_begin;
10951096   offs_t vram_end;
10961097
10971098   /* set up boot and flash ROM */
1098   memory_set_bankptr(machine, "bank2", machine.region("user2")->base());
1099   state->membank("bank2")->set_base(machine.root_device().memregion("user2")->base());
10991100
11001101   /* install MESS managed RAM */
11011102   space_0->install_readwrite_bank(0, machine.device<ram_device>(RAM_TAG)->size() - 1, 0, 0x02000000, "bank3");
11021103   space_1->install_readwrite_bank(0, machine.device<ram_device>(RAM_TAG)->size() - 1, 0, 0x02000000, "bank3");
1103   memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer());
1104   state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
11041105
11051106   kbdc8042_init(machine, &bebox_8042_interface);
11061107
r14976r14977
11291130         U64(0x4E80042000000000)
11301131      };
11311132      space_1->install_read_bank(0x9421FFF0, 0x9421FFFF, "bank1");
1132      memory_set_bankptr(machine, "bank1", ops);
1133      state->membank("bank1")->set_base(ops);
11331134   }
11341135}
src/mess/machine/intv.c
r14976r14977
1616   COMBINE_DATA(&m_intvkbd_dualport_ram[offset]);
1717
1818   /* copy the LSB over to the 6502 OP RAM, in case they are opcodes */
19   RAM    = machine().region("keyboard")->base();
19   RAM    = memregion("keyboard")->base();
2020   RAM[offset] = (UINT8) (data >> 0);
2121}
2222
r14976r14977
3333   m_intvkbd_dualport_ram[offset] |= ((UINT16) data) << 0;
3434
3535   /* copy over to the 6502 OP RAM, in case they are opcodes */
36   RAM    = machine().region("keyboard")->base();
36   RAM    = memregion("keyboard")->base();
3737   RAM[offset] = data;
3838}
3939
r14976r14977
338338   {
339339      if (data == 0x2A50)
340340      {
341         memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + (0x2000 << 1));
341         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (0x2000 << 1));
342342      }
343343      else if (data == 0x2A51)
344344      {
345         memory_set_bankptr(machine(), "bank1", machine().region("ecs_rom")->base() + (0x2000 << 1));
345         membank("bank1")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x2000 << 1));
346346      }
347347   }
348348}
r14976r14977
353353   {
354354      if (data == 0x7A50)
355355      {
356         memory_set_bankptr(machine(), "bank2", machine().region("ecs_rom")->base() + (0x7000 << 1)); // ECS ROM at 0x7000 is on page 1
356         membank("bank2")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x7000 << 1)); // ECS ROM at 0x7000 is on page 1
357357      }
358358      else if (data == 0x7A51 )
359359      {
360         memory_set_bankptr(machine(), "bank2", machine().region("maincpu")->base() + (0x7000 << 1));
360         membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + (0x7000 << 1));
361361      }
362362   }
363363}
r14976r14977
368368   {
369369      if (data == 0xEA50)
370370      {
371         memory_set_bankptr(machine(), "bank3", machine().region("maincpu")->base() + (0xE000 << 1));
371         membank("bank3")->set_base(machine().root_device().memregion("maincpu")->base() + (0xE000 << 1));
372372      }
373373      else if (data == 0xEA51)
374374      {
375         memory_set_bankptr(machine(), "bank3", machine().region("ecs_rom")->base() + (0xE000 << 1));
375         membank("bank3")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0xE000 << 1));
376376      }
377377   }
378378}
r14976r14977
384384   {
385385      if (data == 0xFA50)
386386      {
387         memory_set_bankptr(machine(), "bank4", machine().region("maincpu")->base() + (0xF000 << 1));
387         membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + (0xF000 << 1));
388388      }
389389      else if (data == 0xFA51)
390390      {
391         memory_set_bankptr(machine(), "bank4", machine().region("ecs_rom")->base() + (0xF000 << 1));
391         membank("bank4")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0xF000 << 1));
392392      }
393393   }
394394}
r14976r14977
408408   UINT8 high_byte;
409409   UINT8 low_byte;
410410
411   UINT8 *memory = image.device().machine().region("maincpu")->base();
411   UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
412412   intv_state *state = image.device().machine().driver_data<intv_state>();
413413   address_space *program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
414414   const char *filetype = image.filetype();
r14976r14977
554554   {
555555      UINT16 offset[] = {0x4800, 0x5000, 0x6000, 0x7000, 0x9000, 0xa000, 0xc000, 0xd000, 0xf000};
556556      const char* region_name[] = {"4800", "5000", "6000", "7000", "9000", "A000", "C000", "D000", "F000"};
557      UINT8 *memory = image.device().machine().region("maincpu")->base();
557      UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
558558      intv_state *state = image.device().machine().driver_data<intv_state>();
559559      address_space *program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
560560
r14976r14977
577577      }
578578      // deal with wsmlb paged rom
579579
580      UINT8 *ecs_rom_region = image.device().machine().region("ecs_rom")->base();
580      UINT8 *ecs_rom_region = image.device().machine().root_device().memregion("ecs_rom")->base();
581581      size = image.get_software_region_length("F000_bank1");
582582      if (size && ecs_rom_region) // only load if ecs is plugged in (should probably be done a different way)
583583      {
r14976r14977
632632
633633MACHINE_RESET( intvecs )
634634{
635   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + (0x2000 << 1));
636   memory_set_bankptr(machine, "bank2", machine.region("ecs_rom")->base() + (0x7000 << 1));
637   memory_set_bankptr(machine, "bank3", machine.region("maincpu")->base() + (0xE000 << 1));
638   memory_set_bankptr(machine, "bank4", machine.region("maincpu")->base() + (0xF000 << 1));
635   intv_state *state = machine.driver_data<intv_state>();
636   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + (0x2000 << 1));
637   state->membank("bank2")->set_base(machine.root_device().memregion("ecs_rom")->base() + (0x7000 << 1));
638   state->membank("bank3")->set_base(machine.root_device().memregion("maincpu")->base() + (0xE000 << 1));
639   state->membank("bank4")->set_base(machine.root_device().memregion("maincpu")->base() + (0xF000 << 1));
639640
640641   device_set_input_line_vector(machine.device("maincpu"), CP1610_RESET, 0x1000);
641642
r14976r14977
830831   {
831832      /* First, initialize these as empty so that the intellivision
832833         * will think that the playcable is not attached */
833      UINT8 *memory = image.device().machine().region("maincpu")->base();
834      UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
834835
835836      /* assume playcable is absent */
836837      memory[0x4800 << 1] = 0xff;
r14976r14977
841842
842843   if (strcmp(image.device().tag(),":cart2") == 0) /* Keyboard component cartridge slot */
843844   {
844      UINT8 *memory = image.device().machine().region("keyboard")->base();
845      UINT8 *memory = image.device().machine().root_device().memregion("keyboard")->base();
845846
846847      /* Assume an 8K cart, like BASIC */
847848      image.fread( &memory[0xe000], 0x2000);
src/mess/machine/a2scsi.c
r14976r14977
112112   set_a2bus_device();
113113
114114   astring tempstring;
115   m_rom = device().machine().region(this->subtag(tempstring, SCSI_ROM_REGION))->base();
115   m_rom = device().machine().root_device().memregion(this->subtag(tempstring, SCSI_ROM_REGION))->base();
116116
117117    memset(m_ram, 0, 8192);
118118
src/mess/machine/mikro80.c
r14976r14977
1818{
1919   mikro80_state *state = machine.driver_data<mikro80_state>();
2020   /* set initialy ROM to be visible on first bank */
21   UINT8 *RAM = machine.region("maincpu")->base();
21   UINT8 *RAM = state->memregion("maincpu")->base();
2222   memset(RAM,0x0000,0x0800); // make frist page empty by default
23   memory_configure_bank(machine, "bank1", 1, 2, RAM, 0x0000);
24   memory_configure_bank(machine, "bank1", 0, 2, RAM, 0xf800);
23   state->membank("bank1")->configure_entries(1, 2, RAM, 0x0000);
24   state->membank("bank1")->configure_entries(0, 2, RAM, 0xf800);
2525   state->m_key_mask = 0x7f;
2626}
2727
r14976r14977
7373
7474static TIMER_CALLBACK( mikro80_reset )
7575{
76   memory_set_bank(machine,"bank1", 0);
76   mikro80_state *state = machine.driver_data<mikro80_state>();
77   state->membank("bank1")->set_entry(0);
7778}
7879
7980MACHINE_RESET( mikro80 )
8081{
8182   mikro80_state *state = machine.driver_data<mikro80_state>();
8283   machine.scheduler().timer_set(attotime::from_usec(10), FUNC(mikro80_reset));
83   memory_set_bank(machine, "bank1", 1);
84   state->membank("bank1")->set_entry(1);
8485   state->m_keyboard_mask = 0;
8586}
8687
src/mess/machine/nubus.c
r14976r14977
235235   m_maincpu = machine().device(m_cputag);
236236   address_space *space = m_maincpu->memory().space(AS_PROGRAM);
237237   space->install_readwrite_bank(start, end, mask, mirror, tag );
238   memory_set_bankptr(machine(), tag, data);
238   membank(tag)->set_base(data);
239239}
240240
241241void nubus_device::set_irq_line(int slot, int state)
r14976r14977
336336   UINT8 *newrom = NULL;
337337
338338   astring tempstring;
339   UINT8 *rom = device().machine().region(dev->subtag(tempstring, romregion))->base();
340   UINT32 romlen = device().machine().region(dev->subtag(tempstring, romregion))->bytes();
339   UINT8 *rom = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->base();
340   UINT32 romlen = device().machine().root_device().memregion(dev->subtag(tempstring, romregion))->bytes();
341341
342342//  printf("ROM length is %x, last bytes are %02x %02x\n", romlen, rom[romlen-2], rom[romlen-1]);
343343
src/mess/machine/a2diskii.c
r14976r14977
114114   set_a2bus_device();
115115
116116   astring tempstring;
117   m_rom = device().machine().region(this->subtag(tempstring, DISKII_ROM_REGION))->base();
117   m_rom = device().machine().root_device().memregion(this->subtag(tempstring, DISKII_ROM_REGION))->base();
118118}
119119
120120void a2bus_floppy_device::device_reset()
src/mess/machine/ut88.c
r14976r14977
1919DRIVER_INIT(ut88)
2020{
2121   /* set initially ROM to be visible on first bank */
22   UINT8 *RAM = machine.region("maincpu")->base();
22   ut88_state *state = machine.driver_data<ut88_state>();
23   UINT8 *RAM = state->memregion("maincpu")->base();
2324   memset(RAM,0x0000,0x0800); // make first page empty by default
24   memory_configure_bank(machine, "bank1", 1, 2, RAM, 0x0000);
25   memory_configure_bank(machine, "bank1", 0, 2, RAM, 0xf800);
25   state->membank("bank1")->configure_entries(1, 2, RAM, 0x0000);
26   state->membank("bank1")->configure_entries(0, 2, RAM, 0xf800);
2627}
2728
2829READ8_MEMBER( ut88_state::ut88_8255_portb_r )
r14976r14977
6263
6364static TIMER_CALLBACK( ut88_reset )
6465{
65   memory_set_bank(machine, "bank1", 0);
66   ut88_state *state = machine.driver_data<ut88_state>();
67   state->membank("bank1")->set_entry(0);
6668}
6769
6870MACHINE_RESET( ut88 )
6971{
7072   ut88_state *state = machine.driver_data<ut88_state>();
7173   machine.scheduler().timer_set(attotime::from_usec(10), FUNC(ut88_reset));
72   memory_set_bank(machine, "bank1", 1);
74   state->membank("bank1")->set_entry(1);
7375   state->m_keyboard_mask = 0;
7476}
7577
r14976r14977
101103READ8_MEMBER( ut88_state::ut88mini_keyboard_r )
102104{
103105   // This is real keyboard implementation
104   UINT8 *keyrom1 = machine().region("proms")->base();
105   UINT8 *keyrom2 = machine().region("proms")->base()+100;
106   UINT8 *keyrom1 = memregion("proms")->base();
107   UINT8 *keyrom2 = memregion("proms")->base()+100;
106108
107109   UINT8 key = keyrom2[input_port_read(machine(), "LINE1")];
108110
src/mess/machine/comx_epr.c
r14976r14977
6464{
6565   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
6666
67   m_rom = subregion("f800")->base();
68   m_eprom = subregion("eprom")->base();
67   m_rom = memregion("f800")->base();
68   m_eprom = memregion("eprom")->base();
6969
7070   // state saving
7171   save_item(NAME(m_select));
src/mess/machine/snescart.c
r14976r14977
642642
643643   if ((state->m_has_addon_chip >= HAS_DSP1) && (state->m_has_addon_chip <= HAS_DSP4))
644644   {
645      UINT8 *dspsrc = (UINT8 *)(*machine.region("addons"));
646      UINT32 *dspprg = (UINT32 *)(*machine.region("dspprg"));
647      UINT16 *dspdata = (UINT16 *)(*machine.region("dspdata"));
645      UINT8 *dspsrc = (UINT8 *)(*machine.root_device().memregion("addons"));
646      UINT32 *dspprg = (UINT32 *)(*machine.root_device().memregion("dspprg"));
647      UINT16 *dspdata = (UINT16 *)(*machine.root_device().memregion("dspdata"));
648648
649649      // copy DSP program
650650      for (int i = 0; i < 0x2000; i+= 4)
r14976r14977
662662
663663   if ((state->m_has_addon_chip == HAS_ST010) || (state->m_has_addon_chip == HAS_ST011))
664664   {
665      UINT8 *dspsrc = (UINT8 *)(*machine.region("addons"));
666      UINT32 *dspprg = (UINT32 *)(*machine.region("dspprg"));
667      UINT16 *dspdata = (UINT16 *)(*machine.region("dspdata"));
665      UINT8 *dspsrc = (UINT8 *)(*machine.root_device().memregion("addons"));
666      UINT32 *dspprg = (UINT32 *)(*machine.root_device().memregion("dspprg"));
667      UINT16 *dspdata = (UINT16 *)(*machine.root_device().memregion("dspdata"));
668668
669669      // copy DSP program
670670      for (int i = 0; i < 0x10000; i+= 4)
r14976r14977
766766   address_space *space = machine.device( "maincpu")->memory().space( AS_PROGRAM );
767767   int total_blocks, read_blocks, has_bsx_slot = 0, st_bios = 0;
768768   UINT32 offset, int_header_offs;
769   UINT8 *ROM = image.device().machine().region("cart")->base();
769   UINT8 *ROM = state->memregion("cart")->base();
770770
771771   if (image.software_entry() == NULL)
772772      state->m_cart_size = image.length();
r14976r14977
11511151   int total_blocks, read_blocks;
11521152   int st_bios = 0, slot_id = 0;
11531153   UINT32 offset, st_data_offset = 0;
1154   UINT8 *ROM = image.device().machine().region(image.device().tag())->base();
1154   UINT8 *ROM = image.device().machine().root_device().memregion(image.device().tag())->base();
11551155
1156   snes_ram = machine.region("maincpu")->base();
1156   snes_ram = state->memregion("maincpu")->base();
11571157
11581158   if (strcmp(image.device().tag(), ":slot_a") == 0)
11591159   {
r14976r14977
12561256   int total_blocks, read_blocks;
12571257   int has_bsx_slot = 0;
12581258   UINT32 offset, int_header_offs;
1259   UINT8 *ROM = image.device().machine().region("cart")->base();
1259   UINT8 *ROM = state->memregion("cart")->base();
12601260
12611261   if (image.software_entry() == NULL)
12621262      state->m_cart_size = image.length();
r14976r14977
13561356   running_machine &machine = image.device().machine();
13571357   snes_state *state = machine.driver_data<snes_state>();
13581358   UINT32 offset, int_header_offs;
1359   UINT8 *ROM = image.device().machine().region("flash")->base();
1359   UINT8 *ROM = state->memregion("flash")->base();
13601360
13611361   if (image.software_entry() == NULL)
13621362      state->m_cart_size = image.length();
r14976r14977
14541454
14551455DRIVER_INIT( snes_mess )
14561456{
1457   snes_ram = machine.region("maincpu")->base();
1457   snes_ram = machine.root_device().memregion("maincpu")->base();
14581458   memset(snes_ram, 0, 0x1000000);
14591459}
14601460
14611461DRIVER_INIT( snesst )
14621462{
14631463   snes_state *state = machine.driver_data<snes_state>();
1464   UINT8 *STBIOS = machine.region("sufami")->base();
1464   UINT8 *STBIOS = state->memregion("sufami")->base();
14651465   int i, j;
14661466
14671467   state->m_cart[0].slot_in_use = 0;
src/mess/machine/z88_ram.c
r14976r14977
7676
7777void z88_32k_ram_device::device_start()
7878{
79   m_ram = machine().region_alloc(tag(), get_cart_size(), 1, ENDIANNESS_LITTLE)->base();
79   m_ram = machine().memory().region_alloc(tag(), get_cart_size(), 1, ENDIANNESS_LITTLE)->base();
8080   memset(m_ram, 0, get_cart_size());
8181}
8282
src/mess/machine/c64.c
r14976r14977
466466   {
467467         state->m_io_enabled = 1;      // charen has no effect in ultimax_mode
468468
469         memory_set_bankptr(machine, "bank1", state->m_roml);
470         memory_set_bankptr(machine, "bank3", state->m_memory + 0xa000);
471         memory_set_bankptr(machine, "bank4", state->m_romh);
469         state->membank("bank1")->set_base(state->m_roml);
470         state->membank("bank3")->set_base(state->m_memory + 0xa000);
471         state->membank("bank4")->set_base(state->m_romh);
472472         machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xe000, 0xffff);
473473   }
474474   else
r14976r14977
476476      /* 0x8000-0x9000 */
477477      if (loram && hiram && !state->m_exrom)
478478      {
479         memory_set_bankptr(machine, "bank1", state->m_roml);
479         state->membank("bank1")->set_base(state->m_roml);
480480      }
481481      else
482482      {
483         memory_set_bankptr(machine, "bank1", state->m_memory + 0x8000);
483         state->membank("bank1")->set_base(state->m_memory + 0x8000);
484484      }
485485
486486      /* 0xa000 */
487487      if (hiram && !state->m_game && !state->m_exrom)
488         memory_set_bankptr(machine, "bank3", state->m_romh);
488         state->membank("bank3")->set_base(state->m_romh);
489489
490490      else if (loram && hiram && state->m_game)
491         memory_set_bankptr(machine, "bank3", state->m_basic);
491         state->membank("bank3")->set_base(state->m_basic);
492492
493493      else
494         memory_set_bankptr(machine, "bank3", state->m_memory + 0xa000);
494         state->membank("bank3")->set_base(state->m_memory + 0xa000);
495495
496496      /* 0xd000 */
497497      // RAM
r14976r14977
521521      }
522522
523523      /* 0xe000-0xf000 */
524      memory_set_bankptr(machine, "bank4", hiram ? state->m_kernal : state->m_memory + 0xe000);
525      memory_set_bankptr(machine, "bank5", state->m_memory + 0xe000);
524      state->membank("bank4")->set_base(hiram ? state->m_kernal : state->m_memory + 0xe000);
525      state->membank("bank5")->set_base(state->m_memory + 0xe000);
526526   }
527527
528528   /* make sure the opbase function gets called each time */
r14976r14977
759759
760760   if (!state->m_ultimax)
761761   {
762      UINT8 *mem = machine.region("maincpu")->base();
762      UINT8 *mem = state->memregion("maincpu")->base();
763763      state->m_basic    = mem + 0x10000;
764764      state->m_kernal   = mem + 0x12000;
765765      state->m_chargen  = mem + 0x14000;
r14976r14977
10261026   const char *filetype = image.filetype();
10271027   int address = 0, new_start = 0;
10281028   // int lbank_end_addr = 0, hbank_end_addr = 0;
1029   UINT8 *cart_cpy = image.device().machine().region("user1")->base();
1029   UINT8 *cart_cpy = state->memregion("user1")->base();
10301030
10311031   /* We support .crt files */
10321032   if (!mame_stricmp(filetype, "crt"))
r14976r14977
12881288
12891289INLINE void load_cartridge_region(device_image_interface &image, const char *name, offs_t offset, size_t size)
12901290{
1291   UINT8 *cart = image.device().machine().region("user1")->base();
1291   UINT8 *cart = image.device().machine().root_device().memregion("user1")->base();
12921292   UINT8 *rom = image.get_software_region(name);
12931293   memcpy(cart + offset, rom, size);
12941294}
r14976r14977
12961296INLINE void map_cartridge_roml(running_machine &machine, offs_t offset)
12971297{
12981298   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
1299   UINT8 *cart = machine.region("user1")->base();
1299   UINT8 *cart = state->memregion("user1")->base();
13001300   memcpy(state->m_roml, cart + offset, 0x2000);
13011301}
13021302
13031303INLINE void map_cartridge_romh(running_machine &machine, offs_t offset)
13041304{
13051305   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
1306   UINT8 *cart = machine.region("user1")->base();
1306   UINT8 *cart = state->memregion("user1")->base();
13071307   memcpy(state->m_romh, cart + offset, 0x2000);
13081308}
13091309
r14976r14977
13481348
13491349   UINT8 *roml = image.get_software_region("roml");
13501350   UINT8 *romh = image.get_software_region("romh");
1351   UINT8 *decrypted = image.device().machine().region("user1")->base();
1351   UINT8 *decrypted = image.device().machine().root_device().memregion("user1")->base();
13521352
13531353   // decrypt ROMs
13541354   for (offs_t offset = 0; offset < 0x2000; offset++)
r14976r14977
13981398      BITSWAP8(_data,7,6,5,4,0,1,2,3)
13991399
14001400   UINT8 *roml = image.get_software_region("roml");
1401   UINT8 *decrypted = image.device().machine().region("user1")->base();
1401   UINT8 *decrypted = image.device().machine().root_device().memregion("user1")->base();
14021402
14031403   // decrypt ROMs
14041404   for (offs_t offset = 0; offset < 0x20000; offset++)
r14976r14977
14641464    */
14651465
14661466   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
1467   UINT8 *cart = space->machine().region("user1")->base();
1467   UINT8 *cart = state->memregion("user1")->base();
14681468
14691469   if (data == 0xff)
14701470   {
r14976r14977
15161516static WRITE8_HANDLER( multiscreen_bank_w )
15171517{
15181518   legacy_c64_state *state = space->machine().driver_data<legacy_c64_state>();
1519   UINT8 *cart = space->machine().region("user1")->base();
1519   UINT8 *cart = state->memregion("user1")->base();
15201520   int bank = data & 0x0f;
15211521   offs_t address = bank * 0x4000;
15221522
r14976r14977
17151715   // not working:
17161716
17171717   UINT8 bank = data & 0x3f;
1718   UINT8 *cart = space->machine().region("user1")->base();
1718   UINT8 *cart = state->memregion("user1")->base();
17191719
17201720   if (data & 0x40)
17211721   {
r14976r14977
17451745   // not working: Pang, Robocop 2, Toki
17461746
17471747   UINT8 bank = data & 0x3f;
1748   UINT8 *cart = space->machine().region("user1")->base();
1748   UINT8 *cart = state->memregion("user1")->base();
17491749
17501750   switch (state->m_cart.bank[bank].addr)
17511751   {
r14976r14977
17801780   // not working:
17811781
17821782   UINT8 bank = data & 0x39, real_bank = 0;
1783   UINT8 *cart = space->machine().region("user1")->base();
1783   UINT8 *cart = state->memregion("user1")->base();
17841784
17851785   /* This should be written after the bankswitch has happened. We log it to see if it is really working */
17861786   if (data == 0x86)
r14976r14977
18101810   // not working:
18111811
18121812   UINT8 bank = data & 0x03, bit2 = data & 0x04;
1813   UINT8 *cart = space->machine().region("user1")->base();
1813   UINT8 *cart = state->memregion("user1")->base();
18141814
18151815   if (data & 0x04)
18161816   {
r14976r14977
18491849   // not working: The Last Ninja Remix
18501850
18511851   UINT8 bank = offset & 0xff;
1852   UINT8 *cart = space->machine().region("user1")->base();
1852   UINT8 *cart = state->memregion("user1")->base();
18531853
18541854   if (bank > 0x3f)
18551855      logerror("Warning: This cart type should have at most 64 banks and the cart looked for bank %d... Something strange is going on!\n", bank);
r14976r14977
18731873   // not working:
18741874
18751875   UINT8 bank = offset & 0xff;
1876   UINT8 *cart = space->machine().region("user1")->base();
1876   UINT8 *cart = state->memregion("user1")->base();
18771877
18781878   if (bank > 0xf)
18791879      logerror("Warning: This cart type should have 16 banks and the cart looked for bank %d... Something strange is going on!\n", bank);
r14976r14977
18981898   // not working:
18991899
19001900   UINT8 bank;
1901   UINT8 *cart = space->machine().region("user1")->base();
1901   UINT8 *cart = state->memregion("user1")->base();
19021902
19031903   if (offset < 0x1000)
19041904      bank = 0;
r14976r14977
19211921   // not working:
19221922
19231923   UINT8 bank = data & 0x7f;
1924   UINT8 *cart = space->machine().region("user1")->base();
1924   UINT8 *cart = state->memregion("user1")->base();
19251925
19261926   if (data & 0x80)
19271927   {
r14976r14977
19441944   // not working:
19451945
19461946   UINT8 bank = data & 0x83;
1947   UINT8 *cart = space->machine().region("user1")->base();
1947   UINT8 *cart = state->memregion("user1")->base();
19481948
19491949   /* only valid values 0x80, 0x81, 0x82, 0x83 */
19501950   if (!(bank & 0x80))
src/mess/machine/pc.c
r14976r14977
980980
981981void mess_init_pc_common(running_machine &machine, UINT32 flags, void (*set_keyb_int_func)(running_machine &, int), void (*set_hdc_int_func)(running_machine &,int,int))
982982{
983   pc_state *state = machine.driver_data<pc_state>();
983984   if ( set_keyb_int_func != NULL )
984985      init_pc_common(machine, flags, set_keyb_int_func);
985986
986987   /* MESS managed RAM */
987988   if ( machine.device<ram_device>(RAM_TAG)->pointer() )
988      memory_set_bankptr( machine, "bank10", machine.device<ram_device>(RAM_TAG)->pointer() );
989      state->membank( "bank10" )->set_base( machine.device<ram_device>(RAM_TAG)->pointer() );
989990}
990991
991992
r14976r14977
10161017
10171018DRIVER_INIT( europc )
10181019{
1019   UINT8 *gfx = &machine.region("gfx1")->base()[0x8000];
1020   UINT8 *rom = &machine.region("maincpu")->base()[0];
1020   UINT8 *gfx = &machine.root_device().memregion("gfx1")->base()[0x8000];
1021   UINT8 *rom = &machine.root_device().memregion("maincpu")->base()[0];
10211022   int i;
10221023
10231024    /* just a plain bit pattern for graphics data generation */
r14976r14977
10491050
10501051DRIVER_INIT( pc200 )
10511052{
1052   UINT8 *gfx = &machine.region("gfx1")->base()[0x8000];
1053   UINT8 *gfx = &machine.root_device().memregion("gfx1")->base()[0x8000];
10531054   int i;
10541055
10551056    /* just a plain bit pattern for graphics data generation */
r14976r14977
10611062
10621063DRIVER_INIT( ppc512 )
10631064{
1064   UINT8 *gfx = &machine.region("gfx1")->base()[0x8000];
1065   UINT8 *gfx = &machine.root_device().memregion("gfx1")->base()[0x8000];
10651066   int i;
10661067
10671068    /* just a plain bit pattern for graphics data generation */
r14976r14977
10721073}
10731074DRIVER_INIT( pc1512 )
10741075{
1075   UINT8 *gfx = &machine.region("gfx1")->base()[0x8000];
1076   UINT8 *gfx = &machine.root_device().memregion("gfx1")->base()[0x8000];
10761077   int i;
10771078
10781079    /* just a plain bit pattern for graphics data generation */
r14976r14977
12061207
12071208      size = image.get_software_region_length("rom" );
12081209
1209      memcpy( image.device().machine().region("maincpu")->base() + address, cart, size );
1210      memcpy( image.device().machine().root_device().memregion("maincpu")->base() + address, cart, size );
12101211   }
12111212   else
12121213   {
r14976r14977
12351236      }
12361237
12371238      /* Read the cartridge contents */
1238      if ( ( image_size - 0x200 ) != image.fread(image.device().machine().region("maincpu")->base() + address, image_size - 0x200 ) )
1239      if ( ( image_size - 0x200 ) != image.fread(image.device().machine().root_device().memregion("maincpu")->base() + address, image_size - 0x200 ) )
12391240      {
12401241         image.seterror(IMAGE_ERROR_UNSUPPORTED, "Unable to read cartridge contents" );
12411242         return IMAGE_INIT_FAIL;
src/mess/machine/pecom.c
r14976r14977
2727
2828MACHINE_RESET( pecom )
2929{
30   UINT8 *rom = machine.region(CDP1802_TAG)->base();
30   UINT8 *rom = machine.root_device().memregion(CDP1802_TAG)->base();
3131   address_space *space = machine.device(CDP1802_TAG)->memory().space(AS_PROGRAM);
3232
3333   pecom_state *state = machine.driver_data<pecom_state>();
r14976r14977
3838   space->unmap_write(0xf800, 0xffff);
3939   space->install_read_bank (0xf000, 0xf7ff, "bank3");
4040   space->install_read_bank (0xf800, 0xffff, "bank4");
41   memory_set_bankptr(machine, "bank1", rom + 0x8000);
42   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
43   memory_set_bankptr(machine, "bank3", rom + 0xf000);
44   memory_set_bankptr(machine, "bank4", rom + 0xf800);
41   state->membank("bank1")->set_base(rom + 0x8000);
42   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
43   state->membank("bank3")->set_base(rom + 0xf000);
44   state->membank("bank4")->set_base(rom + 0xf800);
4545
4646   state->m_reset = 0;
4747   state->m_dma = 0;
r14976r14977
7171WRITE8_MEMBER(pecom_state::pecom_bank_w)
7272{
7373   address_space *space2 = machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM);
74   UINT8 *rom = machine().region(CDP1802_TAG)->base();
74   UINT8 *rom = memregion(CDP1802_TAG)->base();
7575   machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x3fff, "bank1");
76   memory_set_bankptr(machine(), "bank1", machine().device<ram_device>(RAM_TAG)->pointer() + 0x0000);
76   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x0000);
7777
7878   if (data==2)
7979   {
r14976r14977
8888      space2->unmap_write(0xf800, 0xffff);
8989      space2->install_read_bank (0xf000, 0xf7ff, "bank3");
9090      space2->install_read_bank (0xf800, 0xffff, "bank4");
91      memory_set_bankptr(machine(), "bank3", rom + 0xf000);
92      memory_set_bankptr(machine(), "bank4", rom + 0xf800);
91      membank("bank3")->set_base(rom + 0xf000);
92      membank("bank4")->set_base(rom + 0xf800);
9393   }
9494}
9595
src/mess/machine/pce.c
r14976r14977
111111
112112WRITE8_MEMBER(pce_state::pce_sf2_banking_w)
113113{
114   memory_set_bankptr( machine(), "bank2", machine().region("user1")->base() + offset * 0x080000 + 0x080000 );
115   memory_set_bankptr( machine(), "bank3", machine().region("user1")->base() + offset * 0x080000 + 0x088000 );
116   memory_set_bankptr( machine(), "bank4", machine().region("user1")->base() + offset * 0x080000 + 0x0D0000 );
114   membank( "bank2" )->set_base( memregion("user1")->base() + offset * 0x080000 + 0x080000 );
115   membank( "bank3" )->set_base( memregion("user1")->base() + offset * 0x080000 + 0x088000 );
116   membank( "bank4" )->set_base( memregion("user1")->base() + offset * 0x080000 + 0x0D0000 );
117117}
118118
119119WRITE8_MEMBER(pce_state::pce_cartridge_ram_w)
r14976r14977
131131   logerror("*** DEVICE_IMAGE_LOAD(pce_cart) : %s\n", image.filename());
132132
133133   /* open file to get size */
134   ROM = image.device().machine().region("user1")->base();
134   ROM = state->memregion("user1")->base();
135135
136136   if (image.software_entry() == NULL)
137137      size = image.length();
r14976r14977
212212         memcpy(ROM + 0x080000, ROM, 0x080000);
213213   }
214214
215   memory_set_bankptr(image.device().machine(), "bank1", ROM);
216   memory_set_bankptr(image.device().machine(), "bank2", ROM + 0x080000);
217   memory_set_bankptr(image.device().machine(), "bank3", ROM + 0x088000);
218   memory_set_bankptr(image.device().machine(), "bank4", ROM + 0x0d0000);
215   state->membank("bank1")->set_base(ROM);
216   state->membank("bank2")->set_base(ROM + 0x080000);
217   state->membank("bank3")->set_base(ROM + 0x088000);
218   state->membank("bank4")->set_base(ROM + 0x0d0000);
219219
220220   /* Check for Street fighter 2 */
221221   if (size == PCE_ROM_MAXSIZE)
r14976r14977
227227   if (!memcmp(ROM + 0x1F26, "POPULOUS", 8))
228228   {
229229      state->m_cartridge_ram = auto_alloc_array(image.device().machine(), UINT8, 0x8000);
230      memory_set_bankptr(image.device().machine(), "bank2", state->m_cartridge_ram);
230      state->membank("bank2")->set_base(state->m_cartridge_ram);
231231      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x080000, 0x087FFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state));
232232   }
233233
r14976r14977
242242      if(state->m_sys3_card)
243243      {
244244         state->m_cartridge_ram = auto_alloc_array(image.device().machine(), UINT8, 0x30000);
245         memory_set_bankptr(image.device().machine(), "bank4", state->m_cartridge_ram);
245         state->membank("bank4")->set_base(state->m_cartridge_ram);
246246         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0D0000, 0x0FFFFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state));
247247         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x080000, 0x087FFF, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),state),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),state));
248248      }
r14976r14977
380380{
381381   pce_state *state = machine.driver_data<pce_state>();
382382   pce_cd_t &pce_cd = state->m_cd;
383   memory_set_bankptr( machine, "bank10", pce_cd.bram + ( pce_cd.bram_locked ? PCE_BRAM_SIZE : 0 ) );
383   state->membank( "bank10" )->set_base( pce_cd.bram + ( pce_cd.bram_locked ? PCE_BRAM_SIZE : 0 ) );
384384}
385385
386386static void adpcm_stop(running_machine &machine, UINT8 irq_flag)
src/mess/machine/kc_rom.c
r14976r14977
6060void kc_8k_device::device_start()
6161{
6262   m_slot = dynamic_cast<kcexp_slot_device *>(owner());
63   m_rom = subregion(REGION_TAG)->base();
63   m_rom = memregion(REGION_TAG)->base();
6464}
6565
6666//-------------------------------------------------
src/mess/machine/bbc.c
r14976r14977
3636/* for the model A just address the 4 on board ROM sockets */
3737WRITE8_MEMBER(bbc_state::bbc_page_selecta_w)
3838{
39   memory_set_bankptr(machine(),"bank4",machine().region("user1")->base()+((data&0x03)<<14));
39   membank("bank4")->set_base(machine().root_device().memregion("user1")->base()+((data&0x03)<<14));
4040}
4141
4242
4343WRITE8_MEMBER(bbc_state::bbc_memorya1_w)
4444{
45   machine().region("maincpu")->base()[offset]=data;
45   memregion("maincpu")->base()[offset]=data;
4646}
4747
4848/*************************
r14976r14977
5656   m_rombank=data&0x0f;
5757   if (m_rombank!=1)
5858   {
59      memory_set_bankptr(machine(), "bank4", machine().region("user1")->base() + (m_rombank << 14));
59      membank("bank4")->set_base(machine().root_device().memregion("user1")->base() + (m_rombank << 14));
6060   }
6161   else
6262   {
63      memory_set_bankptr(machine(), "bank4", machine().region("user2")->base() + ((m_DFSType) << 14));
63      membank("bank4")->set_base(machine().root_device().memregion("user2")->base() + ((m_DFSType) << 14));
6464   }
6565}
6666
r14976r14977
6969{
7070   if (m_RAMSize)
7171   {
72      machine().region("maincpu")->base()[offset + 0x4000] = data;
72      memregion("maincpu")->base()[offset + 0x4000] = data;
7373   }
7474   else
7575   {
76      machine().region("maincpu")->base()[offset] = data;
76      memregion("maincpu")->base()[offset] = data;
7777   }
7878
7979}
r14976r14977
9393   if (m_rombank == 1)
9494   {
9595      // special DFS case for Acorn DFS E00 Hack that can write to the DFS RAM Bank;
96      if (m_DFSType == 3) machine().region("user2")->base()[((m_DFSType) << 14) + offset] = data;
96      if (m_DFSType == 3) memregion("user2")->base()[((m_DFSType) << 14) + offset] = data;
9797   } else
9898   {
9999      switch (m_SWRAMtype)
100100      {
101         case 1:   if (bbc_SWRAMtype1[m_userport]) machine().region("user1")->base()[(m_userport << 14) + offset] = data;
102         case 2:   if (bbc_SWRAMtype2[m_rombank])  machine().region("user1")->base()[(m_rombank << 14) + offset] = data;
103         case 3:   if (bbc_SWRAMtype3[m_rombank])  machine().region("user1")->base()[(m_rombank << 14) + offset] = data;
101         case 1:   if (bbc_SWRAMtype1[m_userport]) memregion("user1")->base()[(m_userport << 14) + offset] = data;
102         case 2:   if (bbc_SWRAMtype2[m_rombank])  memregion("user1")->base()[(m_rombank << 14) + offset] = data;
103         case 3:   if (bbc_SWRAMtype3[m_rombank])  memregion("user1")->base()[(m_rombank << 14) + offset] = data;
104104      }
105105   }
106106}
r14976r14977
137137      if (m_pagedRAM)
138138      {
139139         /* if paged ram then set 8000 to afff to read from the ram 8000 to afff */
140         memory_set_bankptr(machine(), "bank4", machine().region("maincpu")->base() + 0x8000);
140         membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + 0x8000);
141141      }
142142      else
143143      {
144144         /* if paged rom then set the rom to be read from 8000 to afff */
145         memory_set_bankptr(machine(), "bank4", machine().region("user1")->base() + (m_rombank << 14));
145         membank("bank4")->set_base(machine().root_device().memregion("user1")->base() + (m_rombank << 14));
146146      };
147147
148148      /* set the rom to be read from b000 to bfff */
149      memory_set_bank(machine(), "bank6", m_rombank);
149      membank("bank6")->set_entry(m_rombank);
150150   }
151151   else
152152   {
r14976r14977
154154      m_vdusel=(data>>7)&0x01;
155155      bbcbp_setvideoshadow(machine(), m_vdusel);
156156      //need to make the video display do a full screen refresh for the new memory area
157      memory_set_bankptr(machine(), "bank2", machine().region("maincpu")->base()+0x3000);
157      membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base()+0x3000);
158158   }
159159}
160160
r14976r14977
165165
166166WRITE8_MEMBER(bbc_state::bbc_memorybp1_w)
167167{
168   machine().region("maincpu")->base()[offset]=data;
168   memregion("maincpu")->base()[offset]=data;
169169}
170170
171171
r14976r14977
182182DIRECT_UPDATE_HANDLER( bbcbp_direct_handler )
183183{
184184   bbc_state *state = machine.driver_data<bbc_state>();
185   UINT8 *ram = machine.region("maincpu")->base();
185   UINT8 *ram = state->memregion("maincpu")->base();
186186   if (state->m_vdusel == 0)
187187   {
188188      // not in shadow ram mode so just read normal ram
189      memory_set_bankptr(machine, "bank2", ram + 0x3000);
189      state->membank("bank2")->set_base(ram + 0x3000);
190190   }
191191   else
192192   {
193193      if (vdudriverset(machine))
194194      {
195195         // if VDUDriver set then read from shadow ram
196         memory_set_bankptr(machine, "bank2", ram + 0xb000);
196         state->membank("bank2")->set_base(ram + 0xb000);
197197      }
198198      else
199199      {
200200         // else read from normal ram
201         memory_set_bankptr(machine, "bank2", ram + 0x3000);
201         state->membank("bank2")->set_base(ram + 0x3000);
202202      }
203203   }
204204   return address;
r14976r14977
207207
208208WRITE8_MEMBER(bbc_state::bbc_memorybp2_w)
209209{
210   UINT8 *ram = machine().region("maincpu")->base();
210   UINT8 *ram = memregion("maincpu")->base();
211211   if (m_vdusel==0)
212212   {
213213      // not in shadow ram mode so just write to normal ram
r14976r14977
235235{
236236   if (m_pagedRAM)
237237   {
238      machine().region("maincpu")->base()[offset+0x8000]=data;
238      memregion("maincpu")->base()[offset+0x8000]=data;
239239   }
240240}
241241
r14976r14977
255255{
256256   if (m_pagedRAM)
257257   {
258      machine().region("maincpu")->base()[offset+0x8000]=data;
258      memregion("maincpu")->base()[offset+0x8000]=data;
259259   }
260260   else
261261   {
262262      if (bbc_b_plus_sideways_ram_banks[m_rombank])
263263      {
264         machine().region("user1")->base()[offset+(m_rombank<<14)]=data;
264         memregion("user1")->base()[offset+(m_rombank<<14)]=data;
265265      }
266266   }
267267}
r14976r14977
270270{
271271   if (bbc_b_plus_sideways_ram_banks[m_rombank])
272272   {
273      machine().region("user1")->base()[offset+(m_rombank<<14)+0x3000]=data;
273      memregion("user1")->base()[offset+(m_rombank<<14)+0x3000]=data;
274274   }
275275}
276276
r14976r14977
360360
361361   if (m_ACCCON_Y)
362362   {
363      memory_set_bankptr(machine(), "bank7", machine().region("maincpu")->base() + 0x9000);
363      membank("bank7")->set_base(machine().root_device().memregion("maincpu")->base() + 0x9000);
364364   }
365365   else
366366   {
367      memory_set_bankptr(machine(), "bank7", machine().region("user1")->base() + 0x40000);
367      membank("bank7")->set_base(machine().root_device().memregion("user1")->base() + 0x40000);
368368   }
369369
370370   bbcbp_setvideoshadow(machine(), m_ACCCON_D);
r14976r14977
372372
373373   if (m_ACCCON_X)
374374   {
375      memory_set_bankptr(machine(), "bank2", machine().region( "maincpu" )->base() + 0xb000 );
375      membank("bank2")->set_base(machine().root_device().memregion( "maincpu" )->base() + 0xb000 );
376376   }
377377   else
378378   {
379      memory_set_bankptr(machine(), "bank2", machine().region( "maincpu" )->base() + 0x3000 );
379      membank("bank2")->set_base(machine().root_device().memregion( "maincpu" )->base() + 0x3000 );
380380   }
381381
382382   /* ACCCON_TST controls paging of rom reads in the 0xFC00-0xFEFF reigon */
r14976r14977
384384   /* if 1 the the ROM is paged in for reads but writes still go to I/O   */
385385   if (m_ACCCON_TST)
386386   {
387      memory_set_bankptr(machine(), "bank8", machine().region("user1")->base()+0x43c00);
387      membank("bank8")->set_base(machine().root_device().memregion("user1")->base()+0x43c00);
388388      space.install_read_bank(0xFC00,0xFEFF,"bank8");
389389   }
390390   else
r14976r14977
410410
411411   if (m_pagedRAM)
412412   {
413      memory_set_bankptr(machine(), "bank4", machine().region("maincpu")->base() + 0x8000);
414      memory_set_bank(machine(), "bank5", m_rombank);
413      membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + 0x8000);
414      membank("bank5")->set_entry(m_rombank);
415415   }
416416   else
417417   {
418      memory_set_bankptr(machine(), "bank4", machine().region("user1")->base() + ((m_rombank) << 14));
419      memory_set_bank(machine(), "bank5", m_rombank);
418      membank("bank4")->set_base(machine().root_device().memregion("user1")->base() + ((m_rombank) << 14));
419      membank("bank5")->set_entry(m_rombank);
420420   }
421421}
422422
r14976r14977
424424
425425WRITE8_MEMBER(bbc_state::bbc_memorybm1_w)
426426{
427   machine().region("maincpu")->base()[offset] = data;
427   memregion("maincpu")->base()[offset] = data;
428428}
429429
430430
r14976r14977
433433   bbc_state *state = machine.driver_data<bbc_state>();
434434   if (state->m_ACCCON_X)
435435   {
436      memory_set_bankptr( machine, "bank2", machine.region( "maincpu" )->base() + 0xb000 );
436      state->membank( "bank2" )->set_base( state->memregion( "maincpu" )->base() + 0xb000 );
437437   }
438438   else
439439   {
440440      if (state->m_ACCCON_E && bbcm_vdudriverset(machine))
441441      {
442         memory_set_bankptr( machine, "bank2", machine.region( "maincpu" )->base() + 0xb000 );
442         state->membank( "bank2" )->set_base( machine.root_device().memregion( "maincpu" )->base() + 0xb000 );
443443      }
444444      else
445445      {
446         memory_set_bankptr( machine, "bank2", machine.region( "maincpu" )->base() + 0x3000 );
446         state->membank( "bank2" )->set_base( machine.root_device().memregion( "maincpu" )->base() + 0x3000 );
447447      }
448448   }
449449
r14976r14977
454454
455455WRITE8_MEMBER(bbc_state::bbc_memorybm2_w)
456456{
457   UINT8 *ram = machine().region("maincpu")->base();
457   UINT8 *ram = memregion("maincpu")->base();
458458   if (m_ACCCON_X)
459459   {
460460      ram[offset + 0xb000] = data;
r14976r14977
482482{
483483   if (m_pagedRAM)
484484   {
485      machine().region("maincpu")->base()[offset+0x8000]=data;
485      memregion("maincpu")->base()[offset+0x8000]=data;
486486   }
487487   else
488488   {
489489      if (bbc_master_sideways_ram_banks[m_rombank])
490490      {
491         machine().region("user1")->base()[offset+(m_rombank<<14)]=data;
491         memregion("user1")->base()[offset+(m_rombank<<14)]=data;
492492      }
493493   }
494494}
r14976r14977
498498{
499499   if (bbc_master_sideways_ram_banks[m_rombank])
500500   {
501      machine().region("user1")->base()[offset+(m_rombank<<14)+0x1000]=data;
501      memregion("user1")->base()[offset+(m_rombank<<14)+0x1000]=data;
502502   }
503503}
504504
r14976r14977
507507{
508508   if (m_ACCCON_Y)
509509   {
510      machine().region("maincpu")->base()[offset+0x9000]=data;
510      memregion("maincpu")->base()[offset+0x9000]=data;
511511   }
512512}
513513
r14976r14977
542542   /* Now handled in bbcm_ACCCON_write PHS - 2008-10-11 */
543543//  if ( m_ACCCON_TST )
544544//  {
545//      return machine().region("user1")->base()[offset+0x43c00];
545//      return memregion("user1")->base()[offset+0x43c00];
546546//  };
547547
548548   if (offset<=0x0ff) /* FRED */
r14976r14977
17411741      }
17421742      else
17431743      {
1744         return machine().region("disks")->base()[offset + (m_opusbank << 8)];
1744         return memregion("disks")->base()[offset + (m_opusbank << 8)];
17451745      }
17461746   }
17471747   return 0xff;
r14976r14977
17831783      }
17841784      else
17851785      {
1786         machine().region("disks")->base()[offset + (m_opusbank << 8)] = data;
1786         memregion("disks")->base()[offset + (m_opusbank << 8)] = data;
17871787      }
17881788   }
17891789}
r14976r14977
19281928***************************************/
19291929DEVICE_IMAGE_LOAD( bbcb_cart )
19301930{
1931   UINT8 *mem = image.device().machine().region("user1")->base();
1931   UINT8 *mem = image.device().machine().root_device().memregion("user1")->base();
19321932   int size, read_;
19331933   int addr = 0;
19341934   int index = 0;
r14976r14977
20052005MACHINE_RESET( bbca )
20062006{
20072007   bbc_state *state = machine.driver_data<bbc_state>();
2008   UINT8 *ram = machine.region("maincpu")->base();
2008   UINT8 *ram = machine.root_device().memregion("maincpu")->base();
20092009   state->m_RAMSize = 1;
2010   memory_set_bankptr(machine, "bank1",ram);
2011   memory_set_bankptr(machine, "bank3",ram);
2010   state->membank("bank1")->set_base(ram);
2011   state->membank("bank3")->set_base(ram);
20122012
2013   memory_set_bankptr(machine, "bank4",machine.region("user1")->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2014   memory_set_bankptr(machine, "bank7",machine.region("user1")->base()+0x10000);  /* bank 7 points at the OS rom  from c000 to ffff */
2013   state->membank("bank4")->set_base(machine.root_device().memregion("user1")->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2014   state->membank("bank7")->set_base(state->memregion("user1")->base()+0x10000);  /* bank 7 points at the OS rom  from c000 to ffff */
20152015
20162016   bbcb_IC32_initialise(state);
20172017}
r14976r14977
20402040MACHINE_RESET( bbcb )
20412041{
20422042   bbc_state *state = machine.driver_data<bbc_state>();
2043   UINT8 *ram = machine.region("maincpu")->base();
2043   UINT8 *ram = state->memregion("maincpu")->base();
20442044   state->m_DFSType=    (input_port_read(machine, "BBCCONFIG") >> 0) & 0x07;
20452045   state->m_SWRAMtype = (input_port_read(machine, "BBCCONFIG") >> 3) & 0x03;
20462046   state->m_RAMSize=    (input_port_read(machine, "BBCCONFIG") >> 5) & 0x01;
20472047
2048   memory_set_bankptr(machine, "bank1",ram);
2048   state->membank("bank1")->set_base(ram);
20492049   if (state->m_RAMSize)
20502050   {
20512051      /* 32K Model B */
2052      memory_set_bankptr(machine, "bank3", ram + 0x4000);
2052      state->membank("bank3")->set_base(ram + 0x4000);
20532053      state->m_memorySize=32;
20542054   }
20552055   else
20562056   {
20572057      /* 16K just repeat the lower 16K*/
2058      memory_set_bankptr(machine, "bank3", ram);
2058      state->membank("bank3")->set_base(ram);
20592059      state->m_memorySize=16;
20602060   }
20612061
2062   memory_set_bankptr(machine, "bank4", machine.region("user1")->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2063   memory_set_bankptr(machine, "bank7", machine.region("user1")->base() + 0x40000);  /* bank 7 points at the OS rom  from c000 to ffff */
2062   state->membank("bank4")->set_base(machine.root_device().memregion("user1")->base());          /* bank 4 is the paged ROMs     from 8000 to bfff */
2063   state->membank("bank7")->set_base(machine.root_device().memregion("user1")->base() + 0x40000);  /* bank 7 points at the OS rom  from c000 to ffff */
20642064
20652065   bbcb_IC32_initialise(state);
20662066
r14976r14977
20842084   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(bbcbp_direct_handler), &machine));
20852085
20862086   /* bank 6 is the paged ROMs     from b000 to bfff */
2087   memory_configure_bank(machine, "bank6", 0, 16, machine.region("user1")->base() + 0x3000, 1<<14);
2087   state->membank("bank6")->configure_entries(0, 16, state->memregion("user1")->base() + 0x3000, 1<<14);
20882088}
20892089
20902090MACHINE_RESET( bbcbp )
20912091{
20922092   bbc_state *state = machine.driver_data<bbc_state>();
2093   memory_set_bankptr(machine, "bank1",machine.region("maincpu")->base());
2094   memory_set_bankptr(machine, "bank2",machine.region("maincpu")->base()+0x03000);  /* bank 2 screen/shadow ram     from 3000 to 7fff */
2095   memory_set_bankptr(machine, "bank4",machine.region("user1")->base());         /* bank 4 is paged ROM or RAM   from 8000 to afff */
2096   memory_set_bank(machine, "bank6", 0);
2097   memory_set_bankptr(machine, "bank7",machine.region("user1")->base()+0x40000); /* bank 7 points at the OS rom  from c000 to ffff */
2093   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());
2094   state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base()+0x03000);  /* bank 2 screen/shadow ram     from 3000 to 7fff */
2095   state->membank("bank4")->set_base(machine.root_device().memregion("user1")->base());         /* bank 4 is paged ROM or RAM   from 8000 to afff */
2096   state->membank("bank6")->set_entry(0);
2097   state->membank("bank7")->set_base(state->memregion("user1")->base()+0x40000); /* bank 7 points at the OS rom  from c000 to ffff */
20982098
20992099   bbcb_IC32_initialise(state);
21002100
r14976r14977
21122112   machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(bbcm_direct_handler), &machine));
21132113
21142114   /* bank 5 is the paged ROMs     from 9000 to bfff */
2115   memory_configure_bank(machine, "bank5", 0, 16, machine.region("user1")->base()+0x01000, 1<<14);
2115   state->membank("bank5")->configure_entries(0, 16, machine.root_device().memregion("user1")->base()+0x01000, 1<<14);
21162116
21172117   /* Set ROM/IO bank to point to rom */
2118   memory_set_bankptr( machine, "bank8", machine.region("user1")->base()+0x43c00);
2118   state->membank( "bank8" )->set_base( state->memregion("user1")->base()+0x43c00);
21192119   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xFC00, 0xFEFF, "bank8");
21202120}
21212121
21222122MACHINE_RESET( bbcm )
21232123{
21242124   bbc_state *state = machine.driver_data<bbc_state>();
2125   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base());         /* bank 1 regular lower ram     from 0000 to 2fff */
2126   memory_set_bankptr(machine, "bank2", machine.region("maincpu")->base() + 0x3000);   /* bank 2 screen/shadow ram     from 3000 to 7fff */
2127   memory_set_bankptr(machine, "bank4", machine.region("user1")->base());         /* bank 4 is paged ROM or RAM   from 8000 to 8fff */
2128   memory_set_bank(machine, "bank5", 0);
2129   memory_set_bankptr(machine, "bank7", machine.region("user1")->base() + 0x40000); /* bank 6 OS rom of RAM          from c000 to dfff */
2125   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());         /* bank 1 regular lower ram     from 0000 to 2fff */
2126   state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x3000);   /* bank 2 screen/shadow ram     from 3000 to 7fff */
2127   state->membank("bank4")->set_base(machine.root_device().memregion("user1")->base());         /* bank 4 is paged ROM or RAM   from 8000 to 8fff */
2128   state->membank("bank5")->set_entry(0);
2129   state->membank("bank7")->set_base(state->memregion("user1")->base() + 0x40000); /* bank 6 OS rom of RAM          from c000 to dfff */
21302130
21312131   bbcb_IC32_initialise(state);
21322132
src/mess/machine/comx_clm.c
r14976r14977
210210{
211211   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
212212
213   m_rom = subregion("c000")->base();
214   m_char_rom = subregion(MC6845_TAG)->base();
213   m_rom = memregion("c000")->base();
214   m_char_rom = memregion(MC6845_TAG)->base();
215215   m_video_ram = auto_alloc_array(machine(), UINT8, VIDEORAM_SIZE);
216216
217217   // state saving
src/mess/machine/comxpl80.c
r14976r14977
243243      // read data from font ROM
244244      int font_rom = (input_port_read(*this, "FONT") & 0x03) * 0x2000;
245245
246      m_plotter_data = machine().region("gfx2")->base()[font_rom | m_font_addr];
246      m_plotter_data = memregion("gfx2")->base()[font_rom | m_font_addr];
247247   }
248248
249249   if (!BIT(data, 6))
src/mess/machine/cuda.c
r14976r14977
419419   save_item(NAME(disk_pram));
420420
421421   astring tempstring;
422   UINT8 *rom = device().machine().region(device().subtag(tempstring, CUDA_CPU_TAG))->base();
422   UINT8 *rom = device().machine().root_device().memregion(device().subtag(tempstring, CUDA_CPU_TAG))->base();
423423
424424    if (rom)
425425    {
src/mess/machine/hp48.c
r14976r14977
797797
798798      if ( state->m_modules[i].data )
799799      {
800         memory_set_bankptr( space->machine(), bank, state->m_modules[i].data );
800         state->membank( bank )->set_base( state->m_modules[i].data );
801801      }
802802
803803      if ( i == 0 )
r14976r14977
11341134   /* ROM load */
11351135   rom_size = HP48_S_SERIES ? (256 * 1024) : (512 * 1024);
11361136   rom = auto_alloc_array(machine, UINT8, 2 * rom_size);
1137   hp48_decode_nibble( rom, machine.region( "maincpu" )->base(), rom_size );
1137   hp48_decode_nibble( rom, state->memregion( "maincpu" )->base(), rom_size );
11381138
11391139   /* init state */
11401140   memset( ram, 0, 2 * ram_size );
src/mess/machine/c65.c
r14976r14977
665665
666666      if (data == 0x00) {
667667         space->install_readwrite_bank(expansion_ram_begin, expansion_ram_end,"bank16");
668         memory_set_bankptr(space->machine(), "bank16", space->machine().device<ram_device>(RAM_TAG)->pointer() + 128*1024);
668         state->membank("bank16")->set_base(space->machine().device<ram_device>(RAM_TAG)->pointer() + 128*1024);
669669      } else {
670670         space->nop_readwrite(expansion_ram_begin, expansion_ram_end);
671671      }
r14976r14977
817817   {
818818      if (value & 1)
819819      {
820         memory_set_bankptr(machine, "bank8", state->m_colorram + 0x400);
821         memory_set_bankptr(machine, "bank9", state->m_colorram + 0x400);
820         state->membank("bank8")->set_base(state->m_colorram + 0x400);
821         state->membank("bank9")->set_base(state->m_colorram + 0x400);
822822         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0dc00, 0x0dfff, "bank8");
823823         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0dc00, 0x0dfff, "bank9");
824824      }
r14976r14977
833833#if 0
834834   /* cartridge roms !?*/
835835   if (value & 0x08)
836      memory_set_bankptr(machine, "bank1", state->m_roml);
836      state->membank("bank1")->set_base(state->m_roml);
837837   else
838      memory_set_bankptr(machine, "bank1", state->m_memory + 0x8000);
838      state->membank("bank1")->set_base(state->m_memory + 0x8000);
839839
840840   if (value & 0x10)
841      memory_set_bankptr(machine, "bank2", state->m_basic);
841      state->membank("bank2")->set_base(state->m_basic);
842842   else
843      memory_set_bankptr(machine, "bank2", state->m_memory + 0xa000);
843      state->membank("bank2")->set_base(state->m_memory + 0xa000);
844844#endif
845845   if ((state->m_old_value^value) & 0x20)
846846   {
847847   /* bankswitching faulty when doing actual page */
848848      if (value & 0x20)
849         memory_set_bankptr(machine, "bank3", state->m_interface);
849         state->membank("bank3")->set_base(state->m_interface);
850850      else
851         memory_set_bankptr(machine, "bank3", state->m_memory + 0xc000);
851         state->membank("bank3")->set_base(state->m_memory + 0xc000);
852852   }
853853   state->m_charset_select = value & 0x40;
854854#if 0
855855   /* cartridge roms !?*/
856856   if (value & 0x80)
857      memory_set_bankptr(machine, "bank8", state->m_kernal);
857      state->membank("bank8")->set_base(state->m_kernal);
858858   else
859      memory_set_bankptr(machine, "bank6", state->m_memory + 0xe000);
859      state->membank("bank6")->set_base(state->m_memory + 0xe000);
860860#endif
861861   state->m_old_value = value;
862862}
r14976r14977
876876   charen = (data & 4) ? 1 : 0;
877877
878878   if ((!state->m_game && state->m_exrom) || (loram && hiram && !state->m_exrom))
879      memory_set_bankptr(machine, "bank1", state->m_roml);
879      state->membank("bank1")->set_base(state->m_roml);
880880   else
881      memory_set_bankptr(machine, "bank1", state->m_memory + 0x8000);
881      state->membank("bank1")->set_base(state->m_memory + 0x8000);
882882
883883   if ((!state->m_game && state->m_exrom && hiram) || (!state->m_exrom))
884      memory_set_bankptr(machine, "bank2", state->m_romh);
884      state->membank("bank2")->set_base(state->m_romh);
885885   else if (loram && hiram)
886      memory_set_bankptr(machine, "bank2", state->m_basic);
886      state->membank("bank2")->set_base(state->m_basic);
887887   else
888      memory_set_bankptr(machine, "bank2", state->m_memory + 0xa000);
888      state->membank("bank2")->set_base(state->m_memory + 0xa000);
889889
890890   if ((!state->m_game && state->m_exrom) || (charen && (loram || hiram)))
891891   {
892892      state->m_io_on = 1;
893      memory_set_bankptr(machine, "bank6", state->m_colorram);
894      memory_set_bankptr(machine, "bank7", state->m_colorram);
893      state->membank("bank6")->set_base(state->m_colorram);
894      state->membank("bank7")->set_base(state->m_colorram);
895895
896896      if (state->m_io_dc00_on)
897897      {
r14976r14977
902902      {
903903         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0dc00, 0x0dfff, "bank8");
904904         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0dc00, 0x0dfff, "bank9");
905         memory_set_bankptr(machine, "bank8", state->m_colorram + 0x400);
906         memory_set_bankptr(machine, "bank9", state->m_colorram + 0x400);
905         state->membank("bank8")->set_base(state->m_colorram + 0x400);
906         state->membank("bank9")->set_base(state->m_colorram + 0x400);
907907      }
908908      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0d000, 0x0d7ff, FUNC(c65_read_io));
909909      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0d000, 0x0d7ff, FUNC(c65_write_io));
r14976r14977
911911   else
912912   {
913913      state->m_io_on = 0;
914      memory_set_bankptr(machine, "bank5", state->m_memory + 0xd000);
915      memory_set_bankptr(machine, "bank7", state->m_memory + 0xd800);
916      memory_set_bankptr(machine, "bank9", state->m_memory + 0xdc00);
914      state->membank("bank5")->set_base(state->m_memory + 0xd000);
915      state->membank("bank7")->set_base(state->m_memory + 0xd800);
916      state->membank("bank9")->set_base(state->m_memory + 0xdc00);
917917      if (!charen && (loram || hiram))
918918      {
919         memory_set_bankptr(machine, "bank4", state->m_chargen);
920         memory_set_bankptr(machine, "bank6", state->m_chargen + 0x800);
921         memory_set_bankptr(machine, "bank8", state->m_chargen + 0xc00);
919         state->membank("bank4")->set_base(state->m_chargen);
920         state->membank("bank6")->set_base(state->m_chargen + 0x800);
921         state->membank("bank8")->set_base(state->m_chargen + 0xc00);
922922      }
923923      else
924924      {
925         memory_set_bankptr(machine, "bank4", state->m_memory + 0xd000);
926         memory_set_bankptr(machine, "bank6", state->m_memory + 0xd800);
927         memory_set_bankptr(machine, "bank8", state->m_memory + 0xdc00);
925         state->membank("bank4")->set_base(state->m_memory + 0xd000);
926         state->membank("bank6")->set_base(state->m_memory + 0xd800);
927         state->membank("bank8")->set_base(state->m_memory + 0xdc00);
928928      }
929929      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0d000, 0x0d7ff, "bank4");
930930      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0d000, 0x0d7ff, "bank5");
r14976r14977
932932
933933   if (!state->m_game && state->m_exrom)
934934   {
935      memory_set_bankptr(machine, "bank10", state->m_romh);
935      state->membank("bank10")->set_base(state->m_romh);
936936   }
937937   else
938938   {
939939      if (hiram)
940940      {
941         memory_set_bankptr(machine, "bank10", state->m_kernal);
941         state->membank("bank10")->set_base(state->m_kernal);
942942      }
943943      else
944944      {
945         memory_set_bankptr(machine, "bank10", state->m_memory + 0xe000);
945         state->membank("bank10")->set_base(state->m_memory + 0xe000);
946946      }
947947   }
948948   state->m_old_data = data;
r14976r14977
997997{
998998   c65_state *state = machine.driver_data<c65_state>();
999999   state->m_memory = auto_alloc_array_clear(machine, UINT8, 0x10000);
1000   memory_set_bankptr(machine, "bank11", state->m_memory + 0x00000);
1001   memory_set_bankptr(machine, "bank12", state->m_memory + 0x08000);
1002   memory_set_bankptr(machine, "bank13", state->m_memory + 0x0a000);
1003   memory_set_bankptr(machine, "bank14", state->m_memory + 0x0c000);
1004   memory_set_bankptr(machine, "bank15", state->m_memory + 0x0e000);
1000   state->membank("bank11")->set_base(state->m_memory + 0x00000);
1001   state->membank("bank12")->set_base(state->m_memory + 0x08000);
1002   state->membank("bank13")->set_base(state->m_memory + 0x0a000);
1003   state->membank("bank14")->set_base(state->m_memory + 0x0c000);
1004   state->membank("bank15")->set_base(state->m_memory + 0x0e000);
10051005
10061006   cbm_common_init();
10071007   state->m_keyline = 0xff;
src/mess/machine/abc_sio.c
r14976r14977
190190 
191191   if (offset >= 0x4000 && offset < 0x5000) // TODO where is this mapped?
192192   {
193      data = subregion("abc80")->base()[offset & 0xfff];
193      data = memregion("abc80")->base()[offset & 0xfff];
194194   }
195195 
196196   return data;
src/mess/machine/rm380z.c
r14976r14977
283283void rm380z_state::config_memory_map()
284284{
285285   address_space *program = m_maincpu->space(AS_PROGRAM);
286   UINT8 *rom = machine().region(RM380Z_MAINCPU_TAG)->base();
286   UINT8 *rom = memregion(RM380Z_MAINCPU_TAG)->base();
287287   UINT8* m_ram_p = m_messram->pointer();
288288
289289   if ( RM380Z_PORTS_ENABLED_HIGH )
src/mess/machine/ti99/grom.c
r14976r14977
281281   m_waddr_LSB = false;
282282   m_buffer = 0;
283283
284   m_memptr = owner()->subregion(m_regionname)->base();
284   m_memptr = owner()->memregion(m_regionname)->base();
285285   assert (m_memptr!=NULL);
286286
287287   m_memptr += m_offset_reg;
src/mess/machine/ti99/gromport.c
r14976r14977
982982
983983   UINT8* grom_ptr;
984984
985   const memory_region *regg;
986   const memory_region *regr;
987   const memory_region *regr2;
985   memory_region *regg;
986   memory_region *regr;
987   memory_region *regr2;
988988
989989   m_pcb->m_grom_size = m_softlist? get_software_region_length("grom_socket") : m_rpk->get_resource_length("grom_socket");
990990   if (VERBOSE>6) LOG("gromport: grom_socket.size=0x%04x\n", m_pcb->m_grom_size);
991991
992992   if (m_pcb->m_grom_size > 0)
993993   {
994      regg = subregion("grom_contents");
994      regg = memregion("grom_contents");
995995      grom_ptr = m_softlist? get_software_region("grom_socket") : (UINT8*)m_rpk->get_contents_of_socket("grom_socket");
996996      memcpy(regg->base(), grom_ptr, m_pcb->m_grom_size);
997997
r14976r14977
10121012   m_pcb->m_rom_size = m_softlist? get_software_region_length("rom_socket") : m_rpk->get_resource_length("rom_socket");
10131013   if (m_pcb->m_rom_size > 0)
10141014   {
1015      regr = subregion("rom_contents");
1015      regr = memregion("rom_contents");
10161016      m_pcb->m_rom_ptr = m_softlist? get_software_region("rom_socket") : (UINT8*)m_rpk->get_contents_of_socket("rom_socket");
10171017      memcpy(regr->base(), m_pcb->m_rom_ptr, m_pcb->m_rom_size);
10181018   }
r14976r14977
10211021   if (rom2_length > 0)
10221022   {
10231023      // sizes do not differ between rom and rom2
1024      regr2 = subregion("rom2_contents");
1024      regr2 = memregion("rom2_contents");
10251025      m_pcb->m_rom2_ptr = m_softlist? get_software_region("rom2_socket") : (UINT8*)m_rpk->get_contents_of_socket("rom2_socket");
10261026      memcpy(regr2->base(), m_pcb->m_rom2_ptr, rom2_length);
10271027   }
src/mess/machine/ti99/genboard.c
r14976r14977
817817   // This is a preliminary setting; the initial context switch occurs before
818818   // device_reset. Luckily, the reset vector at >0000/>0002 is the same for
819819   // all variants of the boot eprom.
820   m_eprom = machine().region("maincpu")->base();
820   m_eprom = memregion("maincpu")->base();
821821
822   m_sram = machine().region(SRAM_TAG)->base();
823   m_dram = machine().region(DRAM_TAG)->base();
822   m_sram = memregion(SRAM_TAG)->base();
823   m_dram = memregion(DRAM_TAG)->base();
824824
825825   m_geneve_mode = false;
826826   m_direct_mode = true;
r14976r14977
857857      {
858858      case GENEVE_098:
859859         if (VERBOSE>0) LOG("geneve: Using 0.98 boot eprom\n");
860         m_eprom = machine().region("maincpu")->base() + 0x4000;
860         m_eprom = memregion("maincpu")->base() + 0x4000;
861861         break;
862862      case GENEVE_100:
863863         if (VERBOSE>0) LOG("geneve: Using 1.00 boot eprom\n");
864         m_eprom = machine().region("maincpu")->base();
864         m_eprom = memregion("maincpu")->base();
865865         break;
866866      }
867867   }
868868   else
869869   {
870870      if (VERBOSE>0) LOG("geneve: Using GenMod modification\n");
871      m_eprom = machine().region("maincpu")->base() + 0x8000;
871      m_eprom = memregion("maincpu")->base() + 0x8000;
872872      if (m_eprom[0] != 0xf0)
873873      {
874874         fatalerror("genboard: GenMod boot rom missing.\n");
src/mess/machine/ti99/ti_fdc.c
r14976r14977
262262void ti_fdc_device::device_start(void)
263263{
264264   if (VERBOSE>5) LOG("ti_fdc: TI FDC start\n");
265   m_dsrrom = subregion(DSRROM)->base();
265   m_dsrrom = memregion(DSRROM)->base();
266266   m_motor_on_timer = timer_alloc(MOTOR_TIMER);
267267   m_controller = subdevice(FDC_TAG);
268268
src/mess/machine/ti99/p_code.c
r14976r14977
248248   m_grom[5] = static_cast<ti99_grom_device*>(subdevice(PGROM5_TAG));
249249   m_grom[6] = static_cast<ti99_grom_device*>(subdevice(PGROM6_TAG));
250250   m_grom[7] = static_cast<ti99_grom_device*>(subdevice(PGROM7_TAG));
251   m_rom = subregion(PCODE_ROM_TAG)->base();
251   m_rom = memregion(PCODE_ROM_TAG)->base();
252252}
253253
254254void ti_pcode_card_device::device_reset()
src/mess/machine/ti99/tn_usbsm.c
r14976r14977
266266
267267void nouspikel_usb_smartmedia_device::device_start()
268268{
269   m_ram = (UINT16*)(*subregion(BUFFER_TAG));
269   m_ram = (UINT16*)(*memregion(BUFFER_TAG));
270270   /* auto_alloc_array(device->machine(), UINT16, 0x100000/2); */
271271   m_smartmedia = subdevice<smartmedia_image_device>("smartmedia");
272272   m_strata = subdevice("strata");
src/mess/machine/ti99/ti32kmem.c
r14976r14977
9292
9393void ti_32k_expcard_device::device_start(void)
9494{
95   m_ram_ptr = subregion(RAMREGION)->base();
95   m_ram_ptr = memregion(RAMREGION)->base();
9696   m_cru_base = 0;
9797}
9898
src/mess/machine/ti99/evpc.c
r14976r14977
306306
307307void snug_enhanced_video_device::device_start()
308308{
309   m_dsrrom = subregion(DSRROM)->base();
309   m_dsrrom = memregion(DSRROM)->base();
310310   m_novram = (UINT8*)malloc(NOVRAM_SIZE);
311311}
312312
src/mess/machine/ti99/speech8.c
r14976r14977
183183
184184void ti998_spsyn_device::device_reset()
185185{
186   m_speechrom = subregion(SPEECHROM_TAG)->base();
187   m_sprom_length = subregion(SPEECHROM_TAG)->bytes();
186   m_speechrom = memregion(SPEECHROM_TAG)->base();
187   m_sprom_length = memregion(SPEECHROM_TAG)->bytes();
188188   m_sprom_address = 0;
189189   m_load_pointer = 0;
190190   m_rombits_count = 0;
src/mess/machine/ti99/tn_ide.c
r14976r14977
301301   m_rtc = subdevice<rtc65271_device>("ide_rtc");
302302   m_ide = subdevice("ide");
303303
304   m_ram = subregion(BUFFER_TAG)->base();
304   m_ram = memregion(BUFFER_TAG)->base();
305305   m_sram_enable_dip = false; // TODO: what is this?
306306}
307307
src/mess/machine/ti99/samsmem.c
r14976r14977
113113void sams_memory_expansion_device::device_start()
114114{
115115   if (VERBOSE>5) LOG("SuperAMS: start\n");
116   m_ram = subregion(RAMREGION)->base();
116   m_ram = memregion(RAMREGION)->base();
117117}
118118
119119void sams_memory_expansion_device::device_reset()
src/mess/machine/ti99/hfdc.c
r14976r14977
498498   if (VERBOSE>5) LOG("hfdc: start\n");
499499   m_hdc9234 = static_cast<smc92x4_device *>(subdevice(FDC_TAG));
500500   m_clock = subdevice(CLOCK_TAG);
501   m_dsrrom = subregion(DSRROM)->base();
502   m_buffer_ram = subregion(BUFFER)->base();
501   m_dsrrom = memregion(DSRROM)->base();
502   m_buffer_ram = memregion(BUFFER)->base();
503503
504504   m_motor_on_timer = timer_alloc(MOTOR_TIMER);
505505
src/mess/machine/ti99/ti_rs232.c
r14976r14977
10251025
10261026void ti_rs232_pio_device::device_start()
10271027{
1028   m_dsrrom = subregion(DSRROM)->base();
1028   m_dsrrom = memregion(DSRROM)->base();
10291029   m_uart[0] = subdevice<tms9902_device>("tms9902_0");
10301030   m_uart[1] = subdevice<tms9902_device>("tms9902_1");
10311031   m_serdev[0] = subdevice<ti_rs232_attached_device>("serdev0");
src/mess/machine/ti99/myarcmem.c
r14976r14977
182182void myarc_memory_expansion_device::device_start()
183183{
184184   if (VERBOSE>5) LOG("myarc memexp: start\n");
185   m_dsrrom = subregion(DSRROM)->base();
186   m_ram = subregion(RAMREGION)->base();
185   m_dsrrom = memregion(DSRROM)->base();
186   m_ram = memregion(RAMREGION)->base();
187187}
188188
189189void myarc_memory_expansion_device::device_reset()
src/mess/machine/ti99/memex.c
r14976r14977
115115
116116void geneve_memex_device::device_start()
117117{
118   m_ram = subregion(RAMREGION)->base();
118   m_ram = memregion(RAMREGION)->base();
119119}
120120
121121void geneve_memex_device::device_reset()
src/mess/machine/ti99/mapper8.c
r14976r14977
447447   if (VERBOSE>5) LOG("ti99_8: Starting mapper\n");
448448
449449   const mapper8_list_entry *entry = reinterpret_cast<const mapper8_list_entry *>(static_config());
450   m_sram = machine().region(SRAM_TAG)->base();
451   m_dram = machine().region(DRAM_TAG)->base();
452   m_rom  = machine().region("maincpu")->base();
450   m_sram = memregion(SRAM_TAG)->base();
451   m_dram = memregion(DRAM_TAG)->base();
452   m_rom  = memregion("maincpu")->base();
453453
454454   // Clear the lists
455455   m_logcomp.reset();
src/mess/machine/ti99/bwg.c
r14976r14977
383383void snug_bwg_device::device_start(void)
384384{
385385   if (VERBOSE>5) LOG("bwg: BWG start\n");
386   m_dsrrom = subregion(DSRROM)->base();
387   m_buffer_ram = subregion(BUFFER)->base();
386   m_dsrrom = memregion(DSRROM)->base();
387   m_buffer_ram = memregion(BUFFER)->base();
388388   m_motor_on_timer = timer_alloc(MOTOR_TIMER);
389389   m_controller = subdevice(FDC_TAG);
390390   m_clock = subdevice(CLOCK_TAG);
src/mess/machine/ti99/spchsyn.c
r14976r14977
189189
190190void ti_speech_synthesizer_device::device_reset()
191191{
192   m_speechrom = subregion(SPEECHROM_TAG)->base();
193   m_sprom_length = subregion(SPEECHROM_TAG)->bytes();
192   m_speechrom = memregion(SPEECHROM_TAG)->base();
193   m_sprom_length = memregion(SPEECHROM_TAG)->bytes();
194194   m_sprom_address = 0;
195195   m_load_pointer = 0;
196196   m_rombits_count = 0;
src/mess/machine/ti99/horizon.c
r14976r14977
331331 
332332void horizon_ramdisk_device::device_start(void)
333333{
334   m_nvram = subregion(NVRAMREGION)->base();
335   m_ram = subregion(RAMREGION)->base();
334   m_nvram = memregion(NVRAMREGION)->base();
335   m_ram = memregion(RAMREGION)->base();
336336   m_ros = m_nvram + MAXRAM_SIZE - 8192;
337337   m_cru_horizon = 0;
338338   m_cru_phoenix = 0;
src/mess/machine/abc_fd2.c
r14976r14977
220220 
221221   if (offset >= 0x6000 && offset < 0x6400) // TODO is this mirrored?
222222   {
223      data = subregion("abc80")->base()[offset & 0x3ff];
223      data = memregion("abc80")->base()[offset & 0x3ff];
224224   }
225225 
226226   return data;
src/mess/machine/a2cffa.c
r14976r14977
109109   set_a2bus_device();
110110
111111   astring tempstring;
112   m_rom = device().machine().region(this->subtag(tempstring, CFFA2_ROM_REGION))->base();
112   m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CFFA2_ROM_REGION))->base();
113113
114114   // patch default setting so slave device is enabled
115115   m_rom[0x801] = 4;
src/mess/machine/s100_dj2db.c
r14976r14977
278278{
279279   m_s100 = machine().device<s100_device>("s100");
280280
281   m_rom = subregion("dj2db")->base();
281   m_rom = memregion("dj2db")->base();
282282   m_ram = auto_alloc_array(machine(), UINT8, 0x400);
283283
284284   // find floppy devices
src/mess/machine/gb.c
r14976r14977
125125
126126static void gb_rom16_0000( running_machine &machine, UINT8 *addr )
127127{
128   memory_set_bankptr( machine, "bank5", addr );
129   memory_set_bankptr( machine, "bank10", addr + 0x0100 );
130   memory_set_bankptr( machine, "bank6", addr + 0x0200 );
131   memory_set_bankptr( machine, "bank11", addr + 0x0900 );
128   gb_state *state = machine.driver_data<gb_state>();
129   state->membank( "bank5" )->set_base( addr );
130   state->membank( "bank10" )->set_base( addr + 0x0100 );
131   state->membank( "bank6" )->set_base( addr + 0x0200 );
132   state->membank( "bank11" )->set_base( addr + 0x0900 );
132133}
133134
134135static void gb_rom16_4000( running_machine &machine, UINT8 *addr )
135136{
136   memory_set_bankptr( machine, "bank1", addr );
137   memory_set_bankptr( machine, "bank4", addr + 0x2000 );
137   gb_state *state = machine.driver_data<gb_state>();
138   state->membank( "bank1" )->set_base( addr );
139   state->membank( "bank4" )->set_base( addr + 0x2000 );
138140}
139141
140142static void gb_rom8_4000( running_machine &machine, UINT8 *addr )
141143{
142   memory_set_bankptr( machine, "bank1", addr );
144   gb_state *state = machine.driver_data<gb_state>();
145   state->membank( "bank1" )->set_base( addr );
143146}
144147
145148static void gb_rom8_6000( running_machine &machine, UINT8 *addr )
146149{
147   memory_set_bankptr( machine, "bank4", addr );
150   gb_state *state = machine.driver_data<gb_state>();
151   state->membank( "bank4" )->set_base( addr );
148152}
149153
150154static void gb_init(running_machine &machine)
r14976r14977
163167      if ( state->m_MBCType != MBC_MEGADUCK )
164168      {
165169         gb_rom16_4000( machine, state->m_ROMMap[state->m_ROMBank] );
166         memory_set_bankptr (machine, "bank2", state->m_RAMMap[state->m_RAMBank] ? state->m_RAMMap[state->m_RAMBank] : state->m_gb_dummy_ram_bank);
170         state->membank ("bank2")->set_base (state->m_RAMMap[state->m_RAMBank] ? state->m_RAMMap[state->m_RAMBank] : state->m_gb_dummy_ram_bank);
167171      }
168172      else
169173      {
170         memory_set_bankptr( machine, "bank1", state->m_ROMMap[state->m_ROMBank] );
171         memory_set_bankptr( machine, "bank10", state->m_ROMMap[0] );
174         state->membank( "bank1" )->set_base( state->m_ROMMap[state->m_ROMBank] );
175         state->membank( "bank10" )->set_base( state->m_ROMMap[0] );
172176      }
173177   }
174178
r14976r14977
275279   gb_rom16_0000( machine, state->m_ROMMap[state->m_ROMBank00] );
276280
277281   /* Enable BIOS rom */
278   memory_set_bankptr(machine, "bank5", machine.region("maincpu")->base() );
282   state->membank("bank5")->set_base(state->memregion("maincpu")->base() );
279283
280284   state->m_divcount = 0x0004;
281285}
r14976r14977
309313   gb_rom16_0000( machine, state->m_ROMMap[state->m_ROMBank00] ? state->m_ROMMap[state->m_ROMBank00] : state->m_gb_dummy_rom_bank );
310314
311315   /* Enable BIOS rom */
312   memory_set_bankptr(machine, "bank5", machine.region("maincpu")->base() );
316   state->membank("bank5")->set_base(state->memregion("maincpu")->base() );
313317
314318   memset( state->m_sgb_tile_data, 0, 0x2000 );
315319
r14976r14977
366370   gb_rom16_0000( machine, state->m_ROMMap[state->m_ROMBank00] ? state->m_ROMMap[state->m_ROMBank00] : state->m_gb_dummy_rom_bank );
367371
368372   /* Enable BIOS rom */
369   memory_set_bankptr(machine, "bank5", machine.region("maincpu")->base() );
370   memory_set_bankptr(machine, "bank6", machine.region("maincpu")->base() + 0x100 );
373   state->membank("bank5")->set_base(machine.root_device().memregion("maincpu")->base() );
374   state->membank("bank6")->set_base(state->memregion("maincpu")->base() + 0x100 );
371375
372376   /* Allocate memory for internal ram */
373377   for( ii = 0; ii < 8; ii++ )
r14976r14977
395399{
396400   gb_state *state = machine.driver_data<gb_state>();
397401   gb_rom16_4000( machine, state->m_ROMMap[ state->m_ROMBank ] );
398   memory_set_bankptr( machine, "bank2", state->m_RAMMap[ state->m_MBC1Mode ? ( state->m_ROMBank >> 5 ) : 0 ] );
402   state->membank( "bank2" )->set_base( state->m_RAMMap[ state->m_MBC1Mode ? ( state->m_ROMBank >> 5 ) : 0 ] );
399403}
400404
401405WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc1)
r14976r14977
527531   logerror( "0x%04X: wisdom tree mapper write to address 0x%04X\n", cpu_get_pc( &space.device() ), offset );
528532   /* The address determines the bank to select */
529533   m_ROMBank = ( offset << 1 ) & 0x1FF;
530   memory_set_bankptr( machine(), "bank5", m_ROMMap[ m_ROMBank ] );
531   memory_set_bankptr( machine(), "bank10", m_ROMMap[ m_ROMBank ] + 0x0100 );
534   membank( "bank5" )->set_base( m_ROMMap[ m_ROMBank ] );
535   membank( "bank10" )->set_base( m_ROMMap[ m_ROMBank ] + 0x0100 );
532536   gb_rom16_4000( machine(), m_ROMMap[ m_ROMBank + 1 ] );
533537}
534538
r14976r14977
554558         if ( data < 5 )
555559         {
556560            memset( m_MBC3RTCData, m_MBC3RTCMap[m_MBC3RTCBank], 0x2000 );
557            memory_set_bankptr( machine(), "bank2", m_MBC3RTCData );
561            membank( "bank2" )->set_base( m_MBC3RTCData );
558562         }
559563      }
560564   }
r14976r14977
563567      m_RAMBank = data & 0x3;
564568      m_MBC3RTCBank = 0xFF;
565569      /* Switch banks */
566      memory_set_bankptr( machine(), "bank2", m_RAMMap[m_RAMBank] );
570      membank( "bank2" )->set_base( m_RAMMap[m_RAMBank] );
567571   }
568572}
569573
r14976r14977
577581   }
578582   m_RAMBank = data;
579583   /* Switch banks */
580   memory_set_bankptr (machine(), "bank2", m_RAMMap[m_RAMBank] );
584   membank ("bank2")->set_base (m_RAMMap[m_RAMBank] );
581585}
582586
583587WRITE8_MEMBER(gb_state::gb_ram_enable)
r14976r14977
671675         break;
672676      case 0x0A:      /* Are we ready for the next command? */
673677         m_MBC3RTCData[0] = 0x01;
674         memory_set_bankptr( machine(), "bank2", m_MBC3RTCData );
678         membank( "bank2" )->set_base( m_MBC3RTCData );
675679         break;
676680      case 0x0C:      /* Data read register lo */
677681         m_MBC3RTCData[0] = m_gbTama5Byte & 0x0F;
r14976r14977
697701   if ( data & 0x40 )
698702   {
699703      m_mmm01_bank_offset = m_mmm01_reg1;
700      memory_set_bankptr( machine(), "bank5", m_ROMMap[ m_mmm01_bank_offset ] );
701      memory_set_bankptr( machine(), "bank10", m_ROMMap[ m_mmm01_bank_offset ] + 0x0100 );
704      membank( "bank5" )->set_base( m_ROMMap[ m_mmm01_bank_offset ] );
705      membank( "bank10" )->set_base( m_ROMMap[ m_mmm01_bank_offset ] + 0x0100 );
702706      gb_rom16_4000( machine(), m_ROMMap[ m_mmm01_bank_offset + m_mmm01_bank ] );
703707   }
704708}
r14976r14977
744748      gb_rom16_0000( machine, state->m_ROMMap[ state->m_ROMBank & 0x30 ] );
745749   }
746750   gb_rom16_4000( machine, state->m_ROMMap[ state->m_ROMBank ] );
747   memory_set_bankptr( machine, "bank2", state->m_RAMMap[ state->m_MBC1Mode ? ( state->m_ROMBank >> 5 ) : 0 ] );
751   state->membank( "bank2" )->set_base( state->m_RAMMap[ state->m_MBC1Mode ? ( state->m_ROMBank >> 5 ) : 0 ] );
748752}
749753
750754WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc1_kor)
r14976r14977
19871991         m_GBC_RAMBank = data & 0x7;
19881992         if ( ! m_GBC_RAMBank )
19891993            m_GBC_RAMBank = 1;
1990         memory_set_bankptr (machine(), "bank3", m_GBC_RAMMap[m_GBC_RAMBank]);
1994         membank ("bank3")->set_base (m_GBC_RAMMap[m_GBC_RAMBank]);
19911995         break;
19921996      default:
19931997         break;
r14976r14977
21482152      m_ROMBank = data & m_ROMMask;
21492153
21502154      /* Switch banks */
2151      memory_set_bankptr (machine(), "bank1", m_ROMMap[m_ROMBank]);
2155      membank ("bank1")->set_base (m_ROMMap[m_ROMBank]);
21522156   }
21532157}
21542158
r14976r14977
21592163      m_ROMBank = (data << 1) & m_ROMMask;
21602164
21612165      /* Switch banks */
2162      memory_set_bankptr( machine(), "bank10", m_ROMMap[m_ROMBank]);
2163      memory_set_bankptr( machine(), "bank1", m_ROMMap[m_ROMBank + 1]);
2166      membank( "bank10" )->set_base( m_ROMMap[m_ROMBank]);
2167      membank( "bank1" )->set_base( m_ROMMap[m_ROMBank + 1]);
21642168   }
21652169}
21662170
src/mess/machine/radio86.c
r14976r14977
2727/* Driver initialization */
2828DRIVER_INIT(radio86)
2929{
30   radio86_state *state = machine.driver_data<radio86_state>();
3031   /* set initialy ROM to be visible on first bank */
31   UINT8 *RAM = machine.region("maincpu")->base();
32   UINT8 *RAM = state->memregion("maincpu")->base();
3233   memset(RAM,0x0000,0x1000); // make frist page empty by default
33   memory_configure_bank(machine, "bank1", 1, 2, RAM, 0x0000);
34   memory_configure_bank(machine, "bank1", 0, 2, RAM, 0xf800);
34   state->membank("bank1")->configure_entries(1, 2, RAM, 0x0000);
35   state->membank("bank1")->configure_entries(0, 2, RAM, 0xf800);
3536   radio86_init_keyboard(machine);
3637}
3738
r14976r14977
157158
158159static TIMER_CALLBACK( radio86_reset )
159160{
160   memory_set_bank(machine, "bank1", 0);
161   radio86_state *state = machine.driver_data<radio86_state>();
162   state->membank("bank1")->set_entry(0);
161163}
162164
163165
r14976r14977
180182{
181183   radio86_state *state = machine.driver_data<radio86_state>();
182184   machine.scheduler().timer_set(attotime::from_usec(10), FUNC(radio86_reset));
183   memory_set_bank(machine, "bank1", 1);
185   state->membank("bank1")->set_entry(1);
184186
185187   state->m_keyboard_mask = 0;
186188   state->m_disk_sel = 0;
r14976r14977
195197static READ8_DEVICE_HANDLER (radio86_romdisk_porta_r )
196198{
197199   radio86_state *state = device->machine().driver_data<radio86_state>();
198   UINT8 *romdisk = device->machine().region("maincpu")->base() + 0x10000;
200   UINT8 *romdisk = state->memregion("maincpu")->base() + 0x10000;
199201   if ((state->m_disk_sel & 0x0f) ==0) {
200202      return romdisk[state->m_romdisk_msb*256+state->m_romdisk_lsb];
201203   } else {
src/mess/machine/advision.c
r14976r14977
2828void advision_state::machine_start()
2929{
3030   /* configure EA banking */
31   memory_configure_bank(machine(), "bank1", 0, 1, machine().region("bios")->base(), 0);
32   memory_configure_bank(machine(), "bank1", 1, 1, machine().region(I8048_TAG)->base(), 0);
31   membank("bank1")->configure_entry(0, memregion("bios")->base());
32   membank("bank1")->configure_entry(1, memregion(I8048_TAG)->base());
3333   m_maincpu->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, 0x03ff, "bank1");
34   memory_set_bank(machine(), "bank1", 0);
34   membank("bank1")->set_entry(0);
3535
3636   /* allocate external RAM */
3737   m_ext_ram = auto_alloc_array(machine(), UINT8, 0x400);
r14976r14977
4141{
4242   /* enable internal ROM */
4343   device_set_input_line(m_maincpu, MCS48_INPUT_EA, CLEAR_LINE);
44   memory_set_bank(machine(), "bank1", 0);
44   membank("bank1")->set_entry(0);
4545
4646   /* reset sound CPU */
4747   device_set_input_line(m_soundcpu, INPUT_LINE_RESET, ASSERT_LINE);
r14976r14977
6060
6161   device_set_input_line(m_maincpu, MCS48_INPUT_EA, ea ? ASSERT_LINE : CLEAR_LINE);
6262
63   memory_set_bank(machine(), "bank1", ea);
63   membank("bank1")->set_entry(ea);
6464
6565   m_rambank = (data & 0x03) << 8;
6666}
src/mess/machine/b2m.c
r14976r14977
5353   space->install_write_bank(0x7000, 0xdfff, "bank4");
5454   space->install_write_bank(0xe000, 0xffff, "bank5");
5555
56   rom = machine.region("maincpu")->base();
56   rom = state->memregion("maincpu")->base();
5757   switch(bank) {
5858      case 0 :
5959      case 1 :
6060                  space->unmap_write(0xe000, 0xffff);
6161
62                  memory_set_bankptr(machine, "bank1", ram);
63                  memory_set_bankptr(machine, "bank2", ram + 0x2800);
64                  memory_set_bankptr(machine, "bank3", ram + 0x3000);
65                  memory_set_bankptr(machine, "bank4", ram + 0x7000);
66                  memory_set_bankptr(machine, "bank5", rom + 0x10000);
62                  state->membank("bank1")->set_base(ram);
63                  state->membank("bank2")->set_base(ram + 0x2800);
64                  state->membank("bank3")->set_base(ram + 0x3000);
65                  state->membank("bank4")->set_base(ram + 0x7000);
66                  state->membank("bank5")->set_base(rom + 0x10000);
6767                  break;
6868#if 0
6969      case 1 :
7070                  space->unmap_write(0x3000, 0x6fff);
7171                  space->unmap_write(0xe000, 0xffff);
7272
73                  memory_set_bankptr(machine, "bank1", ram);
74                  memory_set_bankptr(machine, "bank2", ram + 0x2800);
75                  memory_set_bankptr(machine, "bank3", rom + 0x12000);
76                  memory_set_bankptr(machine, "bank4", rom + 0x16000);
77                  memory_set_bankptr(machine, "bank5", rom + 0x10000);
73                  state->membank("bank1")->set_base(ram);
74                  state->membank("bank2")->set_base(ram + 0x2800);
75                  state->membank("bank3")->set_base(rom + 0x12000);
76                  state->membank("bank4")->set_base(rom + 0x16000);
77                  state->membank("bank5")->set_base(rom + 0x10000);
7878                  break;
7979#endif
8080      case 2 :
8181                  space->unmap_write(0x2800, 0x2fff);
8282                  space->unmap_write(0xe000, 0xffff);
8383
84                  memory_set_bankptr(machine, "bank1", ram);
84                  state->membank("bank1")->set_base(ram);
8585                  space->install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state));
86                  memory_set_bankptr(machine, "bank3", ram + 0x10000);
87                  memory_set_bankptr(machine, "bank4", ram + 0x7000);
88                  memory_set_bankptr(machine, "bank5", rom + 0x10000);
86                  state->membank("bank3")->set_base(ram + 0x10000);
87                  state->membank("bank4")->set_base(ram + 0x7000);
88                  state->membank("bank5")->set_base(rom + 0x10000);
8989                  break;
9090      case 3 :
9191                  space->unmap_write(0x2800, 0x2fff);
9292                  space->unmap_write(0xe000, 0xffff);
9393
94                  memory_set_bankptr(machine, "bank1", ram);
94                  state->membank("bank1")->set_base(ram);
9595                  space->install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state));
96                  memory_set_bankptr(machine, "bank3", ram + 0x14000);
97                  memory_set_bankptr(machine, "bank4", ram + 0x7000);
98                  memory_set_bankptr(machine, "bank5", rom + 0x10000);
96                  state->membank("bank3")->set_base(ram + 0x14000);
97                  state->membank("bank4")->set_base(ram + 0x7000);
98                  state->membank("bank5")->set_base(rom + 0x10000);
9999                  break;
100100      case 4 :
101101                  space->unmap_write(0x2800, 0x2fff);
102102                  space->unmap_write(0xe000, 0xffff);
103103
104                  memory_set_bankptr(machine, "bank1", ram);
104                  state->membank("bank1")->set_base(ram);
105105                  space->install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state));
106                  memory_set_bankptr(machine, "bank3", ram + 0x18000);
107                  memory_set_bankptr(machine, "bank4", ram + 0x7000);
108                  memory_set_bankptr(machine, "bank5", rom + 0x10000);
106                  state->membank("bank3")->set_base(ram + 0x18000);
107                  state->membank("bank4")->set_base(ram + 0x7000);
108                  state->membank("bank5")->set_base(rom + 0x10000);
109109
110110                  break;
111111      case 5 :
112112                  space->unmap_write(0x2800, 0x2fff);
113113                  space->unmap_write(0xe000, 0xffff);
114114
115                  memory_set_bankptr(machine, "bank1", ram);
115                  state->membank("bank1")->set_base(ram);
116116                  space->install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state));
117                  memory_set_bankptr(machine, "bank3", ram + 0x1c000);
118                  memory_set_bankptr(machine, "bank4", ram + 0x7000);
119                  memory_set_bankptr(machine, "bank5", rom + 0x10000);
117                  state->membank("bank3")->set_base(ram + 0x1c000);
118                  state->membank("bank4")->set_base(ram + 0x7000);
119                  state->membank("bank5")->set_base(rom + 0x10000);
120120
121121                  break;
122122      case 6 :
123                  memory_set_bankptr(machine, "bank1", ram);
124                  memory_set_bankptr(machine, "bank2", ram + 0x2800);
125                  memory_set_bankptr(machine, "bank3", ram + 0x3000);
126                  memory_set_bankptr(machine, "bank4", ram + 0x7000);
127                  memory_set_bankptr(machine, "bank5", ram + 0xe000);
123                  state->membank("bank1")->set_base(ram);
124                  state->membank("bank2")->set_base(ram + 0x2800);
125                  state->membank("bank3")->set_base(ram + 0x3000);
126                  state->membank("bank4")->set_base(ram + 0x7000);
127                  state->membank("bank5")->set_base(ram + 0xe000);
128128                  break;
129129      case 7 :
130130                  space->unmap_write(0x0000, 0x27ff);
r14976r14977
133133                  space->unmap_write(0x7000, 0xdfff);
134134                  space->unmap_write(0xe000, 0xffff);
135135
136                  memory_set_bankptr(machine, "bank1", rom + 0x10000);
137                  memory_set_bankptr(machine, "bank2", rom + 0x10000);
138                  memory_set_bankptr(machine, "bank3", rom + 0x10000);
139                  memory_set_bankptr(machine, "bank4", rom + 0x10000);
140                  memory_set_bankptr(machine, "bank5", rom + 0x10000);
136                  state->membank("bank1")->set_base(rom + 0x10000);
137                  state->membank("bank2")->set_base(rom + 0x10000);
138                  state->membank("bank3")->set_base(rom + 0x10000);
139                  state->membank("bank4")->set_base(rom + 0x10000);
140                  state->membank("bank5")->set_base(rom + 0x10000);
141141                  break;
142142   }
143143}
r14976r14977
245245{
246246   b2m_state *state = device->machine().driver_data<b2m_state>();
247247
248   UINT8 *romdisk = device->machine().region("maincpu")->base() + 0x12000;
248   UINT8 *romdisk = state->memregion("maincpu")->base() + 0x12000;
249249   return romdisk[state->m_b2m_romdisk_msb*256+state->m_b2m_romdisk_lsb];
250250}
251251
src/mess/machine/thomson.c
r14976r14977
401401DEVICE_IMAGE_LOAD( to7_cartridge )
402402{
403403   int i,j;
404   UINT8* pos = image.device().machine().region("maincpu" )->base() + 0x10000;
404   UINT8* pos = image.device().machine().root_device().memregion("maincpu" )->base() + 0x10000;
405405   offs_t size = image.length();
406406   char name[129];
407407
r14976r14977
457457   if ( bank != old_cart_bank )
458458      LOG_BANK(( "to7_update_cart_bank: CART is cartridge bank %i\n", bank ));
459459
460   memory_set_bank( machine, THOM_CART_BANK, bank );
460   machine.root_device().membank( THOM_CART_BANK )->set_entry( bank );
461461   old_cart_bank = bank;
462462}
463463
r14976r14977
485485/* read signal to 0000-0003 generates a bank switch */
486486READ8_HANDLER ( to7_cartridge_r )
487487{
488   UINT8* pos = space->machine().region( "maincpu" )->base() + 0x10000;
488   UINT8* pos = space->machine().root_device().memregion( "maincpu" )->base() + 0x10000;
489489   UINT8 data = pos[offset + (thom_cart_bank % thom_cart_nb_banks) * 0x4000];
490490   thom_cart_bank = offset & 3;
491491   to7_update_cart_bank(space->machine());
r14976r14977
14731473MACHINE_START ( to7 )
14741474{
14751475   address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1476   UINT8* mem = machine.region("maincpu")->base();
1476   UINT8* mem = machine.root_device().memregion("maincpu")->base();
14771477   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
14781478
14791479   LOG (( "to7: machine start called\n" ));
r14976r14977
14881488   /* memory */
14891489   thom_cart_bank = 0;
14901490   thom_vram = ram;
1491   memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, ram + 0x4000, 0x2000 );
1492   memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 );
1493   memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 );
1494   memory_set_bank( machine, THOM_BASE_BANK, 0 );
1495   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
1496   memory_set_bank( machine, THOM_CART_BANK, 0 );
1491   machine.root_device().membank( THOM_BASE_BANK )->configure_entry( 0, ram + 0x4000);
1492   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0, 2, thom_vram, 0x2000 );
1493   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 );
1494   machine.root_device().membank( THOM_BASE_BANK )->set_entry( 0 );
1495   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
1496   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
14971497
14981498   if ( machine.device<ram_device>(RAM_TAG)->size() > 24*1024 )
14991499   {
r14976r14977
15021502      int extram = machine.device<ram_device>(RAM_TAG)->size() - 24*1024;
15031503      space->install_write_bank(0x8000, 0x8000 + extram - 1, THOM_RAM_BANK);
15041504      space->install_read_bank(0x8000, 0x8000 + extram - 1, THOM_RAM_BANK );
1505      memory_configure_bank( machine, THOM_RAM_BANK,  0, 1, ram + 0x6000, extram );
1506      memory_set_bank( machine, THOM_RAM_BANK, 0 );
1505      machine.root_device().membank( THOM_RAM_BANK )->configure_entry( 0, ram + 0x6000);
1506      machine.root_device().membank( THOM_RAM_BANK )->set_entry( 0 );
15071507   }
15081508
15091509   /* force 2 topmost color bits to 1 */
r14976r14977
15821582
15831583   if ( machine.device<ram_device>(RAM_TAG)->size() == 128*1024 || bank < 2 )
15841584   {
1585      memory_set_bank( machine, THOM_RAM_BANK, bank );
1585      machine.root_device().membank( THOM_RAM_BANK )->set_entry( bank );
15861586      space->install_write_bank(0xa000, 0xdfff, THOM_RAM_BANK);
15871587   }
15881588   else
r14976r14977
17291729
17301730MACHINE_START ( to770 )
17311731{
1732   UINT8* mem = machine.region("maincpu")->base();
1732   UINT8* mem = machine.root_device().memregion("maincpu")->base();
17331733   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
17341734
17351735   LOG (( "to770: machine start called\n" ));
r14976r14977
17441744   /* memory */
17451745   thom_cart_bank = 0;
17461746   thom_vram = ram;
1747   memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, ram + 0x4000, 0x4000 );
1748   memory_configure_bank( machine, THOM_RAM_BANK,  0, 6, ram + 0x8000, 0x4000 );
1749   memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 );
1750   memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 );
1751   memory_set_bank( machine, THOM_BASE_BANK, 0 );
1752   memory_set_bank( machine, THOM_RAM_BANK,  0 );
1753   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
1754   memory_set_bank( machine, THOM_CART_BANK, 0 );
1747   machine.root_device().membank( THOM_BASE_BANK )->configure_entry( 0, ram + 0x4000);
1748   machine.root_device().membank( THOM_RAM_BANK )->configure_entries( 0, 6, ram + 0x8000, 0x4000 );
1749   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0, 2, thom_vram, 0x2000 );
1750   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 );
1751   machine.root_device().membank( THOM_BASE_BANK )->set_entry( 0 );
1752   machine.root_device().membank( THOM_RAM_BANK )->set_entry( 0 );
1753   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
1754   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
17551755
17561756   /* save-state */
17571757   state_save_register_global( machine, thom_cart_nb_banks );
r14976r14977
19301930
19311931DEVICE_IMAGE_LOAD( mo5_cartridge )
19321932{
1933   UINT8* pos = image.device().machine().region("maincpu")->base() + 0x10000;
1933   UINT8* pos = image.device().machine().root_device().memregion("maincpu")->base() + 0x10000;
19341934   UINT64 size = image.length();
19351935   int i,j;
19361936   char name[129];
r14976r14977
20152015      if ( bank != old_cart_bank )
20162016         LOG_BANK(( "mo5_update_cart_bank: CART is internal / cartridge bank %i\n", thom_cart_bank ));
20172017   }
2018   memory_set_bank( machine, THOM_CART_BANK, bank );
2018   machine.root_device().membank( THOM_CART_BANK )->set_entry( bank );
20192019   old_cart_bank = bank;
20202020}
20212021
r14976r14977
20432043/* read signal to bffc-bfff generates a bank switch */
20442044READ8_HANDLER ( mo5_cartridge_r )
20452045{
2046   UINT8* pos = space->machine().region( "maincpu" )->base() + 0x10000;
2046   UINT8* pos = space->machine().root_device().memregion( "maincpu" )->base() + 0x10000;
20472047   UINT8 data = pos[offset + 0xbffc + (thom_cart_bank % thom_cart_nb_banks) * 0x4000];
20482048   thom_cart_bank = offset & 3;
20492049   mo5_update_cart_bank(space->machine());
r14976r14977
21012101
21022102MACHINE_START ( mo5 )
21032103{
2104   UINT8* mem = machine.region("maincpu")->base();
2104   UINT8* mem = machine.root_device().memregion("maincpu")->base();
21052105   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
21062106
21072107   LOG (( "mo5: machine start called\n" ));
r14976r14977
21182118   thom_cart_bank = 0;
21192119   mo5_reg_cart = 0;
21202120   thom_vram = ram;
2121   memory_configure_bank( machine, THOM_BASE_BANK, 0, 1, ram + 0x4000, 0x8000 );
2122   memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 );
2123   memory_configure_bank( machine, THOM_CART_BANK, 4, 4, ram + 0xc000, 0x4000 );
2124   memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, thom_vram, 0x2000 );
2125   memory_set_bank( machine, THOM_BASE_BANK, 0 );
2126   memory_set_bank( machine, THOM_CART_BANK, 0 );
2127   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
2121   machine.root_device().membank( THOM_BASE_BANK )->configure_entry( 0, ram + 0x4000);
2122   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 );
2123   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 4, 4, ram + 0xc000, 0x4000 );
2124   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0, 2, thom_vram, 0x2000 );
2125   machine.root_device().membank( THOM_BASE_BANK )->set_entry( 0 );
2126   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
2127   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
21282128
21292129   /* save-state */
21302130   state_save_register_global( machine, thom_cart_nb_banks );
r14976r14977
23792379      break;
23802380   }
23812381
2382   memory_set_bank( machine, THOM_CART_BANK, bank );
2382   machine.root_device().membank( THOM_CART_BANK )->set_entry( bank );
23832383   old_cart_bank = bank;
23842384}
23852385
r14976r14977
24122412/* read signal to 0000-0003 generates a bank switch */
24132413READ8_HANDLER ( to9_cartridge_r )
24142414{
2415   UINT8* pos = space->machine().region( "maincpu" )->base() + 0x10000;
2415   UINT8* pos = space->machine().root_device().memregion( "maincpu" )->base() + 0x10000;
24162416   UINT8 data = pos[offset + (thom_cart_bank % thom_cart_nb_banks) * 0x4000];
24172417   thom_cart_bank = offset & 3;
24182418   to9_update_cart_bank(space->machine());
r14976r14977
24562456
24572457   if ( machine.device<ram_device>(RAM_TAG)->size() == 192*1024 || bank < 6 )
24582458   {
2459      memory_set_bank( machine, THOM_RAM_BANK, bank );
2459      machine.root_device().membank( THOM_RAM_BANK )->set_entry( bank );
24602460      space->install_write_bank( 0xa000, 0xdfff, THOM_RAM_BANK);
24612461   }
24622462   else
r14976r14977
30653065
30663066MACHINE_START ( to9 )
30673067{
3068   UINT8* mem = machine.region("maincpu")->base();
3068   UINT8* mem = machine.root_device().memregion("maincpu")->base();
30693069   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
30703070
30713071   LOG (( "to9: machine start called\n" ));
r14976r14977
30823082   /* memory */
30833083   thom_vram = ram;
30843084   thom_cart_bank = 0;
3085   memory_configure_bank( machine, THOM_VRAM_BANK, 0,  2, thom_vram, 0x2000 );
3086   memory_configure_bank( machine, THOM_CART_BANK, 0, 12, mem + 0x10000, 0x4000 );
3087   memory_configure_bank( machine, THOM_BASE_BANK, 0,  1, ram + 0x4000, 0x4000 );
3088   memory_configure_bank( machine, THOM_RAM_BANK,  0, 10, ram + 0x8000, 0x4000 );
3089   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
3090   memory_set_bank( machine, THOM_CART_BANK, 0 );
3091   memory_set_bank( machine, THOM_BASE_BANK, 0 );
3092   memory_set_bank( machine, THOM_RAM_BANK,  0 );
3085   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0,  2, thom_vram, 0x2000 );
3086   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0, 12, mem + 0x10000, 0x4000 );
3087   machine.root_device().membank( THOM_BASE_BANK )->configure_entry( 0,  ram + 0x4000);
3088   machine.root_device().membank( THOM_RAM_BANK )->configure_entries( 0, 10, ram + 0x8000, 0x4000 );
3089   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
3090   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
3091   machine.root_device().membank( THOM_BASE_BANK )->set_entry( 0 );
3092   machine.root_device().membank( THOM_RAM_BANK )->set_entry( 0 );
30933093
30943094   /* save-state */
30953095   state_save_register_global( machine, thom_cart_nb_banks );
r14976r14977
34673467      LOG_BANK(( "to8_update_floppy_bank: floppy ROM is %s bank %i\n",
34683468           (to8_reg_sys1 & 0x80) ? "external" : "internal",
34693469           bank % TO7_NB_FLOP_BANK ));
3470   memory_set_bank( machine, THOM_FLOP_BANK, bank );
3470   machine.root_device().membank( THOM_FLOP_BANK )->set_entry( bank );
34713471   old_floppy_bank = bank;
34723472}
34733473
r14976r14977
35243524   to8_data_vpage = bank;
35253525   if ( machine.device<ram_device>(RAM_TAG)->size() == 512*1024 || to8_data_vpage < 16 )
35263526   {
3527      memory_set_bank( machine, TO8_DATA_LO, to8_data_vpage );
3528      memory_set_bank( machine, TO8_DATA_HI, to8_data_vpage );
3527      machine.root_device().membank( TO8_DATA_LO )->set_entry( to8_data_vpage );
3528      machine.root_device().membank( TO8_DATA_HI )->set_entry( to8_data_vpage );
35293529
35303530      if (to8_data_vpage <= 4) {
35313531         space->install_legacy_write_handler( 0xa000, 0xbfff, FUNC(to8_data_lo_w));
r14976r14977
36043604
36053605   if ( machine.device<ram_device>(RAM_TAG)->size() == 512*1024 || bank < 16 )
36063606   {
3607      memory_set_bank( machine, THOM_CART_BANK, bank );
3607      machine.root_device().membank( THOM_CART_BANK )->set_entry( bank );
36083608   }
36093609
36103610   old_cart_bank = bank;
r14976r14977
36383638/* read signal to 0000-0003 generates a bank switch */
36393639READ8_HANDLER ( to8_cartridge_r )
36403640{
3641   UINT8* pos = space->machine().region( "maincpu" )->base() + 0x10000;
3641   UINT8* pos = space->machine().root_device().memregion( "maincpu" )->base() + 0x10000;
36423642   UINT8 data = pos[offset + (thom_cart_bank % thom_cart_nb_banks) * 0x4000];
36433643   thom_cart_bank = offset & 3;
36443644   to8_update_cart_bank(space->machine());
r14976r14977
36523652
36533653static void to8_floppy_init( running_machine &machine )
36543654{
3655   UINT8* mem = machine.region("maincpu")->base();
3655   UINT8* mem = machine.root_device().memregion("maincpu")->base();
36563656   to7_floppy_init( machine, mem + 0x34000 );
36573657}
36583658
r14976r14977
36603660
36613661static void to8_floppy_reset( running_machine &machine )
36623662{
3663   UINT8* mem = machine.region("maincpu")->base();
3663   UINT8* mem = machine.root_device().memregion("maincpu")->base();
36643664   to7_floppy_reset(machine);
36653665   if ( THOM_FLOPPY_INT )
36663666      thmfc_floppy_reset(machine);
3667   memory_configure_bank( machine, THOM_FLOP_BANK, TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 );
3667   machine.root_device().membank( THOM_FLOP_BANK )->configure_entries( TO7_NB_FLOP_BANK, 2, mem + 0x30000, 0x2000 );
36683668}
36693669
36703670
r14976r14977
39623962   int ack = (data & 0x20) ? 1 : 0;       /* bit 5: keyboard ACK */
39633963   to8_bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank*/
39643964   thom_set_mode_point( device->machine(), data & 1 );       /* bit 0: video bank switch */
3965   memory_set_bank( device->machine(), TO8_BIOS_BANK, to8_bios_bank );
3965   device->machine().root_device().membank( TO8_BIOS_BANK )->set_entry( to8_bios_bank );
39663966   to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */
39673967   to8_update_floppy_bank(device->machine());
39683968   to8_update_cart_bank(device->machine());
r14976r14977
40514051   to8_update_ram_bank(machine);
40524052   to8_update_cart_bank(machine);
40534053   to8_update_floppy_bank(machine);
4054   memory_set_bank( machine, TO8_BIOS_BANK, 0 );
4054   machine.root_device().membank( TO8_BIOS_BANK )->set_entry( 0 );
40554055   /* thom_cart_bank not reset */
40564056}
40574057
r14976r14977
40594059
40604060MACHINE_START ( to8 )
40614061{
4062   UINT8* mem = machine.region("maincpu")->base();
4062   UINT8* mem = machine.root_device().memregion("maincpu")->base();
40634063   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
40644064
40654065   LOG (( "to8: machine start called\n" ));
r14976r14977
40764076   /* memory */
40774077   thom_cart_bank = 0;
40784078   thom_vram = ram;
4079   memory_configure_bank( machine, THOM_CART_BANK, 0,  8, mem + 0x10000, 0x4000 );
4080   memory_configure_bank( machine, THOM_CART_BANK, 8, 32, ram, 0x4000 );
4081   memory_configure_bank( machine, THOM_VRAM_BANK, 0,  2, ram, 0x2000 );
4082   memory_configure_bank( machine, TO8_SYS_LO,     0,  1, ram + 0x6000, 0x4000 );
4083   memory_configure_bank( machine, TO8_SYS_HI,     0,  1, ram + 0x4000, 0x4000 );
4084   memory_configure_bank( machine, TO8_DATA_LO,    0, 32, ram + 0x2000, 0x4000 );
4085   memory_configure_bank( machine, TO8_DATA_HI,    0, 32, ram + 0x0000, 0x4000 );
4086   memory_configure_bank( machine, TO8_BIOS_BANK,  0,  2, mem + 0x30800, 0x2000 );
4087   memory_set_bank( machine, THOM_CART_BANK, 0 );
4088   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
4089   memory_set_bank( machine, TO8_SYS_LO,  0 );
4090   memory_set_bank( machine, TO8_SYS_HI,  0 );
4091   memory_set_bank( machine, TO8_DATA_LO, 0 );
4092   memory_set_bank( machine, TO8_DATA_HI, 0 );
4093   memory_set_bank( machine, TO8_BIOS_BANK, 0 );
4079   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0,  8, mem + 0x10000, 0x4000 );
4080   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 8, 32, ram, 0x4000 );
4081   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0,  2, ram, 0x2000 );
4082   machine.root_device().membank( TO8_SYS_LO )->configure_entry( 0,  ram + 0x6000);
4083   machine.root_device().membank( TO8_SYS_HI )->configure_entry( 0,  ram + 0x4000);
4084   machine.root_device().membank( TO8_DATA_LO )->configure_entries( 0, 32, ram + 0x2000, 0x4000 );
4085   machine.root_device().membank( TO8_DATA_HI )->configure_entries( 0, 32, ram + 0x0000, 0x4000 );
4086   machine.root_device().membank( TO8_BIOS_BANK )->configure_entries( 0,  2, mem + 0x30800, 0x2000 );
4087   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
4088   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
4089   machine.root_device().membank( TO8_SYS_LO )->set_entry( 0 );
4090   machine.root_device().membank( TO8_SYS_HI )->set_entry( 0 );
4091   machine.root_device().membank( TO8_DATA_LO )->set_entry( 0 );
4092   machine.root_device().membank( TO8_DATA_HI )->set_entry( 0 );
4093   machine.root_device().membank( TO8_BIOS_BANK )->set_entry( 0 );
40944094
40954095   /* save-state */
40964096   state_save_register_global( machine, thom_cart_nb_banks );
r14976r14977
41604160{
41614161   int bios_bank = (data & 0x10) ? 1 : 0; /* bit 4: BIOS bank */
41624162   thom_set_mode_point( device->machine(), data & 1 );       /* bit 0: video bank switch */
4163   memory_set_bank( device->machine(), TO8_BIOS_BANK, bios_bank );
4163   device->machine().root_device().membank( TO8_BIOS_BANK )->set_entry( bios_bank );
41644164   to8_soft_select = (data & 0x04) ? 1 : 0; /* bit 2: internal ROM select */
41654165   to8_update_floppy_bank(device->machine());
41664166   to8_update_cart_bank(device->machine());
r14976r14977
42224222   to8_update_ram_bank(machine);
42234223   to8_update_cart_bank(machine);
42244224   to8_update_floppy_bank(machine);
4225   memory_set_bank( machine, TO8_BIOS_BANK, 0 );
4225   machine.root_device().membank( TO8_BIOS_BANK )->set_entry( 0 );
42264226   /* thom_cart_bank not reset */
42274227}
42284228
r14976r14977
42304230
42314231MACHINE_START ( to9p )
42324232{
4233   UINT8* mem = machine.region("maincpu")->base();
4233   UINT8* mem = machine.root_device().memregion("maincpu")->base();
42344234   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
42354235
42364236   LOG (( "to9p: machine start called\n" ));
r14976r14977
42474247   /* memory */
42484248   thom_cart_bank = 0;
42494249   thom_vram = ram;
4250   memory_configure_bank( machine, THOM_CART_BANK, 0,  8, mem + 0x10000, 0x4000 );
4251   memory_configure_bank( machine, THOM_CART_BANK, 8, 32, ram, 0x4000 );
4252   memory_configure_bank( machine, THOM_VRAM_BANK, 0,  2, ram, 0x2000 );
4253   memory_configure_bank( machine, TO8_SYS_LO,     0,  1, ram + 0x6000, 0x4000 );
4254   memory_configure_bank( machine, TO8_SYS_HI,     0,  1, ram + 0x4000, 0x4000 );
4255   memory_configure_bank( machine, TO8_DATA_LO,    0, 32, ram + 0x2000, 0x4000 );
4256   memory_configure_bank( machine, TO8_DATA_HI,    0, 32, ram + 0x0000, 0x4000 );
4257   memory_configure_bank( machine, TO8_BIOS_BANK,  0,  2, mem + 0x30800, 0x2000 );
4258   memory_set_bank( machine, THOM_CART_BANK, 0 );
4259   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
4260   memory_set_bank( machine, TO8_SYS_LO,  0 );
4261   memory_set_bank( machine, TO8_SYS_HI,  0 );
4262   memory_set_bank( machine, TO8_DATA_LO, 0 );
4263   memory_set_bank( machine, TO8_DATA_HI, 0 );
4264   memory_set_bank( machine, TO8_BIOS_BANK, 0 );
4250   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0,  8, mem + 0x10000, 0x4000 );
4251   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 8, 32, ram, 0x4000 );
4252   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0,  2, ram, 0x2000 );
4253   machine.root_device().membank( TO8_SYS_LO )->configure_entry( 0,  ram + 0x6000);
4254   machine.root_device().membank( TO8_SYS_HI )->configure_entry( 0,  ram + 0x4000);
4255   machine.root_device().membank( TO8_DATA_LO )->configure_entries( 0, 32, ram + 0x2000, 0x4000 );
4256   machine.root_device().membank( TO8_DATA_HI )->configure_entries( 0, 32, ram + 0x0000, 0x4000 );
4257   machine.root_device().membank( TO8_BIOS_BANK )->configure_entries( 0,  2, mem + 0x30800, 0x2000 );
4258   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
4259   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
4260   machine.root_device().membank( TO8_SYS_LO )->set_entry( 0 );
4261   machine.root_device().membank( TO8_SYS_HI )->set_entry( 0 );
4262   machine.root_device().membank( TO8_DATA_LO )->set_entry( 0 );
4263   machine.root_device().membank( TO8_DATA_HI )->set_entry( 0 );
4264   machine.root_device().membank( TO8_BIOS_BANK )->set_entry( 0 );
42654265
42664266   /* save-state */
42674267   state_save_register_global( machine, thom_cart_nb_banks );
r14976r14977
43054305         LOG_BANK(( "mo6_update_ram_bank: select bank %i (new style)\n", bank ));
43064306   }
43074307   to8_data_vpage = bank;
4308   memory_set_bank( machine, TO8_DATA_LO, to8_data_vpage );
4309   memory_set_bank( machine, TO8_DATA_HI, to8_data_vpage );
4308   machine.root_device().membank( TO8_DATA_LO )->set_entry( to8_data_vpage );
4309   machine.root_device().membank( TO8_DATA_HI )->set_entry( to8_data_vpage );
43104310}
43114311
43124312
r14976r14977
43994399   }
44004400
44014401   old_cart_bank = bank;
4402   memory_set_bank( machine, THOM_CART_BANK, bank );
4403   memory_set_bank( machine, TO8_BIOS_BANK, b );
4402   machine.root_device().membank( THOM_CART_BANK )->set_entry( bank );
4403   machine.root_device().membank( TO8_BIOS_BANK )->set_entry( b );
44044404}
44054405
44064406
r14976r14977
44274427/* read signal generates a bank switch */
44284428READ8_HANDLER ( mo6_cartridge_r )
44294429{
4430   UINT8* pos = space->machine().region( "maincpu" )->base() + 0x10000;
4430   UINT8* pos = space->machine().root_device().memregion( "maincpu" )->base() + 0x10000;
44314431   UINT8 data = pos[offset + 0xbffc + (thom_cart_bank % thom_cart_nb_banks) * 0x4000];
44324432   thom_cart_bank = offset & 3;
44334433   mo6_update_cart_bank(space->machine());
r14976r14977
48534853
48544854MACHINE_START ( mo6 )
48554855{
4856   UINT8* mem = machine.region("maincpu")->base();
4856   UINT8* mem = machine.root_device().memregion("maincpu")->base();
48574857   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
48584858
48594859   LOG (( "mo6: machine start called\n" ));
r14976r14977
48714871   thom_cart_bank = 0;
48724872   mo5_reg_cart = 0;
48734873   thom_vram = ram;
4874   memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 );
4875   memory_configure_bank( machine, THOM_CART_BANK, 4, 2, mem + 0x1f000, 0x4000 );
4876   memory_configure_bank( machine, THOM_CART_BANK, 6, 2, mem + 0x28000, 0x4000 );
4877   memory_configure_bank( machine, THOM_CART_BANK, 8, 8, ram, 0x4000 );
4878   memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, ram, 0x2000 );
4879   memory_configure_bank( machine, TO8_SYS_LO,     0, 1, ram + 0x6000, 0x4000 );
4880   memory_configure_bank( machine, TO8_SYS_HI,     0, 1, ram + 0x4000, 0x4000 );
4881   memory_configure_bank( machine, TO8_DATA_LO,    0, 8, ram + 0x2000, 0x4000 );
4882   memory_configure_bank( machine, TO8_DATA_HI,    0, 8, ram + 0x0000, 0x4000 );
4883   memory_configure_bank( machine, TO8_BIOS_BANK,  0, 2, mem + 0x23000, 0x4000 );
4884   memory_set_bank( machine, THOM_CART_BANK, 0 );
4885   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
4886   memory_set_bank( machine, TO8_SYS_LO,  0 );
4887   memory_set_bank( machine, TO8_SYS_HI,  0 );
4888   memory_set_bank( machine, TO8_DATA_LO, 0 );
4889   memory_set_bank( machine, TO8_DATA_HI, 0 );
4890   memory_set_bank( machine, TO8_BIOS_BANK, 0 );
4874   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 );
4875   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 4, 2, mem + 0x1f000, 0x4000 );
4876   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 6, 2, mem + 0x28000, 0x4000 );
4877   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 8, 8, ram, 0x4000 );
4878   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0, 2, ram, 0x2000 );
4879   machine.root_device().membank( TO8_SYS_LO )->configure_entry( 0, ram + 0x6000);
4880   machine.root_device().membank( TO8_SYS_HI )->configure_entry( 0, ram + 0x4000);
4881   machine.root_device().membank( TO8_DATA_LO )->configure_entries( 0, 8, ram + 0x2000, 0x4000 );
4882   machine.root_device().membank( TO8_DATA_HI )->configure_entries( 0, 8, ram + 0x0000, 0x4000 );
4883   machine.root_device().membank( TO8_BIOS_BANK )->configure_entries( 0, 2, mem + 0x23000, 0x4000 );
4884   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
4885   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
4886   machine.root_device().membank( TO8_SYS_LO )->set_entry( 0 );
4887   machine.root_device().membank( TO8_SYS_HI )->set_entry( 0 );
4888   machine.root_device().membank( TO8_DATA_LO )->set_entry( 0 );
4889   machine.root_device().membank( TO8_DATA_HI )->set_entry( 0 );
4890   machine.root_device().membank( TO8_BIOS_BANK )->set_entry( 0 );
48914891
48924892   /* save-state */
48934893   state_save_register_global( machine, thom_cart_nb_banks );
r14976r14977
51145114
51155115MACHINE_START ( mo5nr )
51165116{
5117   UINT8* mem = machine.region("maincpu")->base();
5117   UINT8* mem = machine.root_device().memregion("maincpu")->base();
51185118   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
51195119
51205120   LOG (( "mo5nr: machine start called\n" ));
r14976r14977
51325132   thom_cart_bank = 0;
51335133   mo5_reg_cart = 0;
51345134   thom_vram = ram;
5135   memory_configure_bank( machine, THOM_CART_BANK, 0, 4, mem + 0x10000, 0x4000 );
5136   memory_configure_bank( machine, THOM_CART_BANK, 4, 2, mem + 0x1f000, 0x4000 );
5137   memory_configure_bank( machine, THOM_CART_BANK, 6, 2, mem + 0x28000, 0x4000 );
5138   memory_configure_bank( machine, THOM_CART_BANK, 8, 8, ram, 0x4000 );
5139   memory_configure_bank( machine, THOM_VRAM_BANK, 0, 2, ram, 0x2000 );
5140   memory_configure_bank( machine, TO8_SYS_LO,     0, 1, ram + 0x6000, 0x4000 );
5141   memory_configure_bank( machine, TO8_SYS_HI,     0, 1, ram + 0x4000, 0x4000 );
5142   memory_configure_bank( machine, TO8_DATA_LO,    0, 8, ram + 0x2000, 0x4000 );
5143   memory_configure_bank( machine, TO8_DATA_HI,    0, 8, ram + 0x0000, 0x4000 );
5144   memory_configure_bank( machine, TO8_BIOS_BANK,  0, 2, mem + 0x23000, 0x4000 );
5145   memory_set_bank( machine, THOM_CART_BANK, 0 );
5146   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
5147   memory_set_bank( machine, TO8_SYS_LO,  0 );
5148   memory_set_bank( machine, TO8_SYS_HI,  0 );
5149   memory_set_bank( machine, TO8_DATA_LO, 0 );
5150   memory_set_bank( machine, TO8_DATA_HI, 0 );
5151   memory_set_bank( machine, TO8_BIOS_BANK, 0 );
5135   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 0, 4, mem + 0x10000, 0x4000 );
5136   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 4, 2, mem + 0x1f000, 0x4000 );
5137   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 6, 2, mem + 0x28000, 0x4000 );
5138   machine.root_device().membank( THOM_CART_BANK )->configure_entries( 8, 8, ram, 0x4000 );
5139   machine.root_device().membank( THOM_VRAM_BANK )->configure_entries( 0, 2, ram, 0x2000 );
5140   machine.root_device().membank( TO8_SYS_LO )->configure_entry( 0, ram + 0x6000);
5141   machine.root_device().membank( TO8_SYS_HI )->configure_entry( 0, ram + 0x4000);
5142   machine.root_device().membank( TO8_DATA_LO )->configure_entries( 0, 8, ram + 0x2000, 0x4000 );
5143   machine.root_device().membank( TO8_DATA_HI )->configure_entries( 0, 8, ram + 0x0000, 0x4000 );
5144   machine.root_device().membank( TO8_BIOS_BANK )->configure_entries( 0, 2, mem + 0x23000, 0x4000 );
5145   machine.root_device().membank( THOM_CART_BANK )->set_entry( 0 );
5146   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
5147   machine.root_device().membank( TO8_SYS_LO )->set_entry( 0 );
5148   machine.root_device().membank( TO8_SYS_HI )->set_entry( 0 );
5149   machine.root_device().membank( TO8_DATA_LO )->set_entry( 0 );
5150   machine.root_device().membank( TO8_DATA_HI )->set_entry( 0 );
5151   machine.root_device().membank( TO8_BIOS_BANK )->set_entry( 0 );
51525152
51535153   /* save-state */
51545154   state_save_register_global( machine, thom_cart_nb_banks );
src/mess/machine/coco_fdc.c
r14976r14977
249249
250250UINT8* coco_fdc_device::get_cart_base()
251251{
252   return subregion("eprom")->base();
252   return memregion("eprom")->base();
253253}
254254
255255/*-------------------------------------------------
src/mess/machine/c128.c
r14976r14977
496496   charen = (data & 4) ? 1 : 0;
497497
498498   if ((!state->m_game && state->m_exrom) || (loram && hiram && !state->m_exrom))
499      memory_set_bankptr(machine, "bank8", state->m_roml);
499      state->membank("bank8")->set_base(state->m_roml);
500500   else
501      memory_set_bankptr(machine, "bank8", state->m_memory + 0x8000);
501      state->membank("bank8")->set_base(state->m_memory + 0x8000);
502502
503503   if ((!state->m_game && state->m_exrom && hiram) || (!state->m_exrom))
504      memory_set_bankptr(machine, "bank9", state->m_romh);
504      state->membank("bank9")->set_base(state->m_romh);
505505   else if (loram && hiram)
506      memory_set_bankptr(machine, "bank9", state->m_basic);
506      state->membank("bank9")->set_base(state->m_basic);
507507   else
508      memory_set_bankptr(machine, "bank9", state->m_memory + 0xa000);
508      state->membank("bank9")->set_base(state->m_memory + 0xa000);
509509
510510   if ((!state->m_game && state->m_exrom) || (charen && (loram || hiram)))
511511   {
r14976r14977
517517      machine.device("m8502")->memory().space(AS_PROGRAM)->install_read_bank(0xd000, 0xdfff, "bank5");
518518      state->m_write_io = 0;
519519      if ((!charen && (loram || hiram)))
520         memory_set_bankptr(machine, "bank13", state->m_chargen);
520         state->membank("bank13")->set_base(state->m_chargen);
521521      else
522         memory_set_bankptr(machine, "bank13", state->m_memory + 0xd000);
522         state->membank("bank13")->set_base(state->m_memory + 0xd000);
523523   }
524524
525525   if (!state->m_game && state->m_exrom)
526526   {
527      memory_set_bankptr(machine, "bank14", state->m_romh);
528      memory_set_bankptr(machine, "bank15", state->m_romh+0x1f00);
529      memory_set_bankptr(machine, "bank16", state->m_romh+0x1f05);
527      state->membank("bank14")->set_base(state->m_romh);
528      state->membank("bank15")->set_base(state->m_romh+0x1f00);
529      state->membank("bank16")->set_base(state->m_romh+0x1f05);
530530   }
531531   else
532532   {
533533      if (hiram)
534534      {
535         memory_set_bankptr(machine, "bank14", state->m_kernal);
536         memory_set_bankptr(machine, "bank15", state->m_kernal+0x1f00);
537         memory_set_bankptr(machine, "bank16", state->m_kernal+0x1f05);
535         state->membank("bank14")->set_base(state->m_kernal);
536         state->membank("bank15")->set_base(state->m_kernal+0x1f00);
537         state->membank("bank16")->set_base(state->m_kernal+0x1f05);
538538      }
539539      else
540540      {
541         memory_set_bankptr(machine, "bank14", state->m_memory + 0xe000);
542         memory_set_bankptr(machine, "bank15", state->m_memory + 0xff00);
543         memory_set_bankptr(machine, "bank16", state->m_memory + 0xff05);
541         state->membank("bank14")->set_base(state->m_memory + 0xe000);
542         state->membank("bank15")->set_base(state->m_memory + 0xff00);
543         state->membank("bank16")->set_base(state->m_memory + 0xff05);
544544      }
545545   }
546546   state->m_old_data = data;
r14976r14977
556556    state->m_ram = state->m_memory + MMU_RAM_ADDR;
557557    state->m_va1617 = MMU_VIC_ADDR;
558558#if 1
559    memory_set_bankptr(machine, "bank10", state->m_z80);
560    memory_set_bankptr(machine, "bank11", state->m_ram + 0x1000);
559    state->membank("bank10")->set_base(state->m_z80);
560    state->membank("bank11")->set_base(state->m_ram + 0x1000);
561561    if ( (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x02 ) && (MMU_RAM_ADDR >= 0x40000))
562562        || (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x00) && (MMU_RAM_ADDR >= 0x20000)) )
563563       state->m_ram = NULL;
r14976r14977
568568       state->m_ram_bottom = 0;
569569
570570    if (MMU_RAM_ADDR==0) { /* this is used in z80 mode for rom on/off switching !*/
571       memory_set_bankptr(machine, "bank10", state->m_z80);
572       memory_set_bankptr(machine, "bank11", state->m_z80 + 0x400);
571       state->membank("bank10")->set_base(state->m_z80);
572       state->membank("bank11")->set_base(state->m_z80 + 0x400);
573573    }
574574    else
575575    {
576       memory_set_bankptr(machine, "bank10", (state->m_ram_bottom > 0 ? state->m_memory : state->m_ram));
577       memory_set_bankptr(machine, "bank11", (state->m_ram_bottom > 0x400 ? state->m_memory : state->m_ram) + 0x400);
576       state->membank("bank10")->set_base((state->m_ram_bottom > 0 ? state->m_memory : state->m_ram));
577       state->membank("bank11")->set_base((state->m_ram_bottom > 0x400 ? state->m_memory : state->m_ram) + 0x400);
578578    }
579579
580    memory_set_bankptr(machine, "bank1", (state->m_ram_bottom > 0 ? state->m_memory : state->m_ram));
581    memory_set_bankptr(machine, "bank2", (state->m_ram_bottom > 0x400 ? state->m_memory : state->m_ram) + 0x400);
580    state->membank("bank1")->set_base((state->m_ram_bottom > 0 ? state->m_memory : state->m_ram));
581    state->membank("bank2")->set_base((state->m_ram_bottom > 0x400 ? state->m_memory : state->m_ram) + 0x400);
582582
583    memory_set_bankptr(machine, "bank3", (state->m_ram_bottom > 0x1000 ? state->m_memory : state->m_ram) + 0x1000);
584    memory_set_bankptr(machine, "bank4", (state->m_ram_bottom > 0x2000 ? state->m_memory : state->m_ram) + 0x2000);
585    memory_set_bankptr(machine, "bank5", state->m_ram + 0x4000);
583    state->membank("bank3")->set_base((state->m_ram_bottom > 0x1000 ? state->m_memory : state->m_ram) + 0x1000);
584    state->membank("bank4")->set_base((state->m_ram_bottom > 0x2000 ? state->m_memory : state->m_ram) + 0x2000);
585    state->membank("bank5")->set_base(state->m_ram + 0x4000);
586586
587587    if (MMU_TOP)
588588       state->m_ram_top = 0x10000 - MMU_SIZE;
r14976r14977
590590       state->m_ram_top = 0x10000;
591591
592592    if (state->m_ram_top > 0xc000)
593      memory_set_bankptr(machine, "bank6", state->m_ram + 0xc000);
593      state->membank("bank6")->set_base(state->m_ram + 0xc000);
594594    else
595      memory_set_bankptr(machine, "bank6", state->m_memory + 0xc000);
595      state->membank("bank6")->set_base(state->m_memory + 0xc000);
596596
597597    if (state->m_ram_top > 0xe000)
598      memory_set_bankptr(machine, "bank7", state->m_ram + 0xe000);
598      state->membank("bank7")->set_base(state->m_ram + 0xe000);
599599    else
600      memory_set_bankptr(machine, "bank7", state->m_memory + 0xd000);
600      state->membank("bank7")->set_base(state->m_memory + 0xd000);
601601
602602    if (state->m_ram_top > 0xf000)
603      memory_set_bankptr(machine, "bank8", state->m_ram + 0xf000);
603      state->membank("bank8")->set_base(state->m_ram + 0xf000);
604604    else
605      memory_set_bankptr(machine, "bank8", state->m_memory + 0xe000);
605      state->membank("bank8")->set_base(state->m_memory + 0xe000);
606606
607607    if (state->m_ram_top > 0xff05)
608      memory_set_bankptr(machine, "bank9", state->m_ram + 0xff05);
608      state->membank("bank9")->set_base(state->m_ram + 0xff05);
609609    else
610      memory_set_bankptr(machine, "bank9", state->m_memory + 0xff05);
610      state->membank("bank9")->set_base(state->m_memory + 0xff05);
611611
612612    if ( (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x02 ) && (MMU_RAM_ADDR >= 0x40000))
613613        || (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x00) && (MMU_RAM_ADDR >= 0x20000)) )
r14976r14977
627627      state->m_ram_bottom = 0;
628628      state->m_ram_top = 0x10000;
629629
630      memory_set_bankptr(machine, "bank1", state->m_memory);
631      memory_set_bankptr(machine, "bank2", state->m_memory + 0x100);
630      state->membank("bank1")->set_base(state->m_memory);
631      state->membank("bank2")->set_base(state->m_memory + 0x100);
632632
633      memory_set_bankptr(machine, "bank3", state->m_memory + 0x200);
634      memory_set_bankptr(machine, "bank4", state->m_memory + 0x400);
635      memory_set_bankptr(machine, "bank5", state->m_memory + 0x1000);
636      memory_set_bankptr(machine, "bank6", state->m_memory + 0x2000);
633      state->membank("bank3")->set_base(state->m_memory + 0x200);
634      state->membank("bank4")->set_base(state->m_memory + 0x400);
635      state->membank("bank5")->set_base(state->m_memory + 0x1000);
636      state->membank("bank6")->set_base(state->m_memory + 0x2000);
637637
638      memory_set_bankptr(machine, "bank7", state->m_memory + 0x4000);
638      state->membank("bank7")->set_base(state->m_memory + 0x4000);
639639
640      memory_set_bankptr(machine, "bank12", state->m_memory + 0xc000);
640      state->membank("bank12")->set_base(state->m_memory + 0xc000);
641641
642642      c128_bankswitch_64(machine, reset);
643643   }
r14976r14977
645645   {
646646      state->m_ram = state->m_memory + MMU_RAM_ADDR;
647647      state->m_va1617 = MMU_VIC_ADDR;
648      memory_set_bankptr(machine, "bank1", state->m_memory + state->m_mmu_page0);
649      memory_set_bankptr(machine, "bank2", state->m_memory + state->m_mmu_page1);
648      state->membank("bank1")->set_base(state->m_memory + state->m_mmu_page0);
649      state->membank("bank2")->set_base(state->m_memory + state->m_mmu_page1);
650650      if (MMU_BOTTOM)
651651         {
652652            state->m_ram_bottom = MMU_SIZE;
653653         }
654654      else
655655         state->m_ram_bottom = 0;
656      memory_set_bankptr(machine, "bank3", (state->m_ram_bottom > 0x200 ? state->m_memory : state->m_ram) + 0x200);
657      memory_set_bankptr(machine, "bank4", (state->m_ram_bottom > 0x400 ? state->m_memory : state->m_ram) + 0x400);
658      memory_set_bankptr(machine, "bank5", (state->m_ram_bottom > 0x1000 ? state->m_memory : state->m_ram) + 0x1000);
659      memory_set_bankptr(machine, "bank6", (state->m_ram_bottom > 0x2000 ? state->m_memory : state->m_ram) + 0x2000);
656      state->membank("bank3")->set_base((state->m_ram_bottom > 0x200 ? state->m_memory : state->m_ram) + 0x200);
657      state->membank("bank4")->set_base((state->m_ram_bottom > 0x400 ? state->m_memory : state->m_ram) + 0x400);
658      state->membank("bank5")->set_base((state->m_ram_bottom > 0x1000 ? state->m_memory : state->m_ram) + 0x1000);
659      state->membank("bank6")->set_base((state->m_ram_bottom > 0x2000 ? state->m_memory : state->m_ram) + 0x2000);
660660
661661      if (MMU_RAM_LO)
662662      {
663         memory_set_bankptr(machine, "bank7", state->m_ram + 0x4000);
663         state->membank("bank7")->set_base(state->m_ram + 0x4000);
664664      }
665665      else
666666      {
667         memory_set_bankptr(machine, "bank7", state->m_c128_basic);
667         state->membank("bank7")->set_base(state->m_c128_basic);
668668      }
669669
670670      if (MMU_RAM_MID)
671671      {
672         memory_set_bankptr(machine, "bank8", state->m_ram + 0x8000);
673         memory_set_bankptr(machine, "bank9", state->m_ram + 0xa000);
672         state->membank("bank8")->set_base(state->m_ram + 0x8000);
673         state->membank("bank9")->set_base(state->m_ram + 0xa000);
674674      }
675675      else if (MMU_ROM_MID)
676676      {
677         memory_set_bankptr(machine, "bank8", state->m_c128_basic + 0x4000);
678         memory_set_bankptr(machine, "bank9", state->m_c128_basic + 0x6000);
677         state->membank("bank8")->set_base(state->m_c128_basic + 0x4000);
678         state->membank("bank9")->set_base(state->m_c128_basic + 0x6000);
679679      }
680680      else if (MMU_INTERNAL_ROM_MID)
681681      {
682         memory_set_bankptr(machine, "bank8", state->m_internal_function);
683         memory_set_bankptr(machine, "bank9", state->m_internal_function + 0x2000);
682         state->membank("bank8")->set_base(state->m_internal_function);
683         state->membank("bank9")->set_base(state->m_internal_function + 0x2000);
684684      }
685685      else
686686      {
687         memory_set_bankptr(machine, "bank8", state->m_external_function);
688         memory_set_bankptr(machine, "bank9", state->m_external_function + 0x2000);
687         state->membank("bank8")->set_base(state->m_external_function);
688         state->membank("bank9")->set_base(state->m_external_function + 0x2000);
689689      }
690690
691691      if (MMU_TOP)
r14976r14977
713713      {
714714         if (state->m_ram_top > 0xc000)
715715         {
716            memory_set_bankptr(machine, "bank12", state->m_ram + 0xc000);
716            state->membank("bank12")->set_base(state->m_ram + 0xc000);
717717         }
718718         else
719719         {
720            memory_set_bankptr(machine, "bank12", state->m_memory + 0xc000);
720            state->membank("bank12")->set_base(state->m_memory + 0xc000);
721721         }
722722         if (!MMU_IO_ON)
723723         {
724724            if (state->m_ram_top > 0xd000)
725725            {
726               memory_set_bankptr(machine, "bank13", state->m_ram + 0xd000);
726               state->membank("bank13")->set_base(state->m_ram + 0xd000);
727727            }
728728            else
729729            {
730               memory_set_bankptr(machine, "bank13", state->m_memory + 0xd000);
730               state->membank("bank13")->set_base(state->m_memory + 0xd000);
731731            }
732732         }
733733         if (state->m_ram_top > 0xe000)
734734         {
735            memory_set_bankptr(machine, "bank14", state->m_ram + 0xe000);
735            state->membank("bank14")->set_base(state->m_ram + 0xe000);
736736         }
737737         else
738738         {
739            memory_set_bankptr(machine, "bank14", state->m_memory + 0xe000);
739            state->membank("bank14")->set_base(state->m_memory + 0xe000);
740740         }
741741         if (state->m_ram_top > 0xff05)
742742         {
743            memory_set_bankptr(machine, "bank16", state->m_ram + 0xff05);
743            state->membank("bank16")->set_base(state->m_ram + 0xff05);
744744         }
745745         else
746746         {
747            memory_set_bankptr(machine, "bank16", state->m_memory + 0xff05);
747            state->membank("bank16")->set_base(state->m_memory + 0xff05);
748748         }
749749      }
750750      else if (MMU_ROM_HI)
751751      {
752         memory_set_bankptr(machine, "bank12", state->m_editor);
752         state->membank("bank12")->set_base(state->m_editor);
753753         if (!MMU_IO_ON) {
754            memory_set_bankptr(machine, "bank13", state->m_c128_chargen);
754            state->membank("bank13")->set_base(state->m_c128_chargen);
755755         }
756         memory_set_bankptr(machine, "bank14", state->m_c128_kernal);
757         memory_set_bankptr(machine, "bank16", state->m_c128_kernal + 0x1f05);
756         state->membank("bank14")->set_base(state->m_c128_kernal);
757         state->membank("bank16")->set_base(state->m_c128_kernal + 0x1f05);
758758      }
759759      else if (MMU_INTERNAL_ROM_HI)
760760      {
761         memory_set_bankptr(machine, "bank12", state->m_internal_function);
761         state->membank("bank12")->set_base(state->m_internal_function);
762762         if (!MMU_IO_ON) {
763            memory_set_bankptr(machine, "bank13", state->m_internal_function + 0x1000);
763            state->membank("bank13")->set_base(state->m_internal_function + 0x1000);
764764         }
765         memory_set_bankptr(machine, "bank14", state->m_internal_function + 0x2000);
766         memory_set_bankptr(machine, "bank16", state->m_internal_function + 0x3f05);
765         state->membank("bank14")->set_base(state->m_internal_function + 0x2000);
766         state->membank("bank16")->set_base(state->m_internal_function + 0x3f05);
767767      }
768768      else                  /*if (MMU_EXTERNAL_ROM_HI) */
769769      {
770         memory_set_bankptr(machine, "bank12", state->m_external_function);
770         state->membank("bank12")->set_base(state->m_external_function);
771771         if (!MMU_IO_ON) {
772            memory_set_bankptr(machine, "bank13", state->m_external_function + 0x1000);
772            state->membank("bank13")->set_base(state->m_external_function + 0x1000);
773773         }
774         memory_set_bankptr(machine, "bank14", state->m_external_function + 0x2000);
775         memory_set_bankptr(machine, "bank16", state->m_external_function + 0x3f05);
774         state->membank("bank14")->set_base(state->m_external_function + 0x2000);
775         state->membank("bank16")->set_base(state->m_external_function + 0x3f05);
776776      }
777777
778778      if ( (( (input_port_read(machine, "SPECIAL") & 0x06) == 0x02 ) && (MMU_RAM_ADDR >= 0x40000))
r14976r14977
11391139static void c128_common_driver_init( running_machine &machine )
11401140{
11411141   c128_state *state = machine.driver_data<c128_state>();
1142   UINT8 *gfx=machine.region("gfx1")->base();
1143   UINT8 *ram = machine.region("maincpu")->base();
1142   UINT8 *gfx=machine.root_device().memregion("gfx1")->base();
1143   UINT8 *ram = state->memregion("maincpu")->base();
11441144   int i;
11451145
11461146   state->m_memory = ram;
src/mess/machine/coco12.c
r14976r14977
4242   cococart_slot_device *cart = m_cococart;
4343   UINT8 *ram = m_ram->pointer();
4444   UINT32 ram_size = m_ram->size();
45   UINT8 *rom = machine().region(MAINCPU_TAG)->base();
45   UINT8 *rom = memregion(MAINCPU_TAG)->base();
4646   UINT8 *cart_rom = cart->get_cart_base();
4747 
4848   m_sam->configure_bank(0, ram, ram_size, false);         // $0000-$7FFF
src/mess/machine/thomflop.c
r14976r14977
17601760
17611761void to7_floppy_init ( running_machine &machine, void* base )
17621762{
1763   memory_configure_bank( machine, THOM_FLOP_BANK, 0, TO7_NB_FLOP_BANK, base, 0x800 );
1763   machine.root_device().membank( THOM_FLOP_BANK )->configure_entries( 0, TO7_NB_FLOP_BANK, base, 0x800 );
17641764   state_save_register_global( machine, to7_controller_type );
17651765   state_save_register_global( machine, to7_floppy_bank );
17661766   to7_5p14sd_init(machine);
r14976r14977
18091809      break;
18101810   }
18111811
1812   memory_set_bank( machine, THOM_FLOP_BANK, to7_floppy_bank );
1812   machine.root_device().membank( THOM_FLOP_BANK )->set_entry( to7_floppy_bank );
18131813}
18141814
18151815
r14976r14977
18571857      if ( offset == 8 )
18581858      {
18591859         to7_floppy_bank = 3 + (data & 3);
1860         memory_set_bank( space->machine(), THOM_FLOP_BANK, to7_floppy_bank );
1860         space->machine().root_device().membank( THOM_FLOP_BANK )->set_entry( to7_floppy_bank );
18611861         VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 ));
18621862      }
18631863      else
r14976r14977
18871887void to9_floppy_init( running_machine &machine, void* int_base, void* ext_base )
18881888{
18891889   to7_floppy_init( machine, ext_base );
1890   memory_configure_bank( machine, THOM_FLOP_BANK, TO7_NB_FLOP_BANK, 1, int_base, 0x800 );
1890   machine.root_device().membank( THOM_FLOP_BANK )->configure_entry( TO7_NB_FLOP_BANK, int_base);
18911891}
18921892
18931893
r14976r14977
19031903   {
19041904      LOG(( "to9_floppy_reset: internal controller\n" ));
19051905      to7_5p14_reset(machine);
1906      memory_set_bank( machine, THOM_FLOP_BANK, TO7_NB_FLOP_BANK );
1906      machine.root_device().membank( THOM_FLOP_BANK )->set_entry( TO7_NB_FLOP_BANK );
19071907   }
19081908}
19091909
src/mess/machine/pet.c
r14976r14977
490490      if (data & 0x20)
491491      {
492492         state->m_pet80_bank1_base = state->m_memory + 0x8000;
493         memory_set_bankptr(space->machine(), "bank1", state->m_pet80_bank1_base);
493         state->membank("bank1")->set_base(state->m_pet80_bank1_base);
494494         space->install_legacy_write_handler(0x8000, 0x8fff, FUNC(pet80_bank1_w));
495495      }
496496      else
r14976r14977
516516         if (!(data & 0x20))
517517         {
518518            state->m_pet80_bank1_base = state->m_memory + 0x14000;
519            memory_set_bankptr(space->machine(), "bank1", state->m_pet80_bank1_base);
519            state->membank("bank1")->set_base(state->m_pet80_bank1_base);
520520         }
521         memory_set_bankptr(space->machine(), "bank2", state->m_memory + 0x15000);
522         memory_set_bankptr(space->machine(), "bank3", state->m_memory + 0x16000);
523         memory_set_bankptr(space->machine(), "bank4", state->m_memory + 0x17000);
521         state->membank("bank2")->set_base(state->m_memory + 0x15000);
522         state->membank("bank3")->set_base(state->m_memory + 0x16000);
523         state->membank("bank4")->set_base(state->m_memory + 0x17000);
524524      }
525525      else
526526      {
527527         if (!(data & 0x20))
528528         {
529529            state->m_pet80_bank1_base = state->m_memory + 0x10000;
530            memory_set_bankptr(space->machine(), "bank1", state->m_pet80_bank1_base);
530            state->membank("bank1")->set_base(state->m_pet80_bank1_base);
531531         }
532         memory_set_bankptr(space->machine(), "bank2", state->m_memory + 0x11000);
533         memory_set_bankptr(space->machine(), "bank3", state->m_memory + 0x12000);
534         memory_set_bankptr(space->machine(), "bank4", state->m_memory + 0x13000);
532         state->membank("bank2")->set_base(state->m_memory + 0x11000);
533         state->membank("bank3")->set_base(state->m_memory + 0x12000);
534         state->membank("bank4")->set_base(state->m_memory + 0x13000);
535535      }
536536
537537      if (data & 8)
538538      {
539539         if (!(data & 0x40))
540540         {
541            memory_set_bankptr(space->machine(), "bank7", state->m_memory + 0x1e800);
541            state->membank("bank7")->set_base(state->m_memory + 0x1e800);
542542         }
543         memory_set_bankptr(space->machine(), "bank6", state->m_memory + 0x1c000);
544         memory_set_bankptr(space->machine(), "bank8", state->m_memory + 0x1f000);
545         memory_set_bankptr(space->machine(), "bank9", state->m_memory + 0x1fff1);
543         state->membank("bank6")->set_base(state->m_memory + 0x1c000);
544         state->membank("bank8")->set_base(state->m_memory + 0x1f000);
545         state->membank("bank9")->set_base(state->m_memory + 0x1fff1);
546546      }
547547      else
548548      {
549549         if (!(data & 0x40))
550550         {
551            memory_set_bankptr(space->machine(), "bank7", state->m_memory+ 0x1a800);
551            state->membank("bank7")->set_base(state->m_memory+ 0x1a800);
552552         }
553         memory_set_bankptr(space->machine(), "bank6", state->m_memory + 0x18000);
554         memory_set_bankptr(space->machine(), "bank8", state->m_memory + 0x1b000);
555         memory_set_bankptr(space->machine(), "bank9", state->m_memory + 0x1bff1);
553         state->membank("bank6")->set_base(state->m_memory + 0x18000);
554         state->membank("bank8")->set_base(state->m_memory + 0x1b000);
555         state->membank("bank9")->set_base(state->m_memory + 0x1bff1);
556556      }
557557   }
558558   else
559559   {
560560      state->m_pet80_bank1_base = state->m_memory + 0x8000;
561      memory_set_bankptr(space->machine(), "bank1", state->m_pet80_bank1_base );
561      state->membank("bank1")->set_base(state->m_pet80_bank1_base );
562562      space->install_legacy_write_handler(0x8000, 0x8fff, FUNC(pet80_bank1_w));
563563
564      memory_set_bankptr(space->machine(), "bank2", state->m_memory + 0x9000);
564      state->membank("bank2")->set_base(state->m_memory + 0x9000);
565565      space->unmap_write(0x9000, 0x9fff);
566566
567      memory_set_bankptr(space->machine(), "bank3", state->m_memory + 0xa000);
567      state->membank("bank3")->set_base(state->m_memory + 0xa000);
568568      space->unmap_write(0xa000, 0xafff);
569569
570      memory_set_bankptr(space->machine(), "bank4", state->m_memory + 0xb000);
570      state->membank("bank4")->set_base(state->m_memory + 0xb000);
571571      space->unmap_write(0xb000, 0xbfff);
572572
573      memory_set_bankptr(space->machine(), "bank6", state->m_memory + 0xc000);
573      state->membank("bank6")->set_base(state->m_memory + 0xc000);
574574      space->unmap_write(0xc000, 0xe7ff);
575575
576576      space->install_legacy_read_handler(0xe800, 0xefff, FUNC(cbm8096_io_r));
577577      space->install_legacy_write_handler(0xe800, 0xefff, FUNC(cbm8096_io_w));
578578
579      memory_set_bankptr(space->machine(), "bank8", state->m_memory + 0xf000);
579      state->membank("bank8")->set_base(state->m_memory + 0xf000);
580580      space->unmap_write(0xf000, 0xffef);
581581
582      memory_set_bankptr(space->machine(), "bank9", state->m_memory + 0xfff1);
582      state->membank("bank9")->set_base(state->m_memory + 0xfff1);
583583      space->unmap_write(0xfff1, 0xffff);
584584   }
585585}
r14976r14977
606606      case 4:
607607      case 5:
608608         state->m_spet.bank = data & 0xf;
609         memory_configure_bank(space->machine(), "bank1", 0, 16, state->m_supermemory, 0x1000);
610         memory_set_bank(space->machine(), "bank1", state->m_spet.bank);
609         state->membank("bank1")->configure_entries(0, 16, state->m_supermemory, 0x1000);
610         state->membank("bank1")->set_entry(state->m_spet.bank);
611611         /* 7 low writeprotects systemlatch */
612612         break;
613613
r14976r14977
657657   state->m_cbm8096 = 0;
658658
659659   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, machine.device<ram_device>(RAM_TAG)->size() - 1, "bank10");
660   memory_set_bankptr(machine, "bank10", state->m_memory);
660   state->membank("bank10")->set_base(state->m_memory);
661661
662662   if (machine.device<ram_device>(RAM_TAG)->size() < 0x8000)
663663   {
r14976r14977
699699DRIVER_INIT( pet80 )
700700{
701701   pet_state *state = machine.driver_data<pet_state>();
702   state->m_memory.set_target(machine.region("maincpu")->base(),state->m_memory.bytes());
702   state->m_memory.set_target(state->memregion("maincpu")->base(),state->m_memory.bytes());
703703
704704   pet_common_driver_init(machine);
705705   state->m_cbm8096 = 1;
r14976r14977
717717
718718   state->m_supermemory = auto_alloc_array(machine, UINT8, 0x10000);
719719
720   memory_configure_bank(machine, "bank1", 0, 16, state->m_supermemory, 0x1000);
721   memory_set_bank(machine, "bank1", 0);
720   state->membank("bank1")->configure_entries(0, 16, state->m_supermemory, 0x1000);
721   state->membank("bank1")->set_entry(0);
722722
723723   superpet_vh_init(machine);
724724}
src/mess/machine/oric.c
r14976r14977
478478
479479   space->install_write_handler(0x0300, 0x030f, write8_delegate(FUNC(oric_state::oric_IO_w),state));
480480   space->install_legacy_write_handler(*fdc, 0x0310, 0x031f, FUNC(applefdc_w));
481   memory_set_bankptr(machine, "bank4",   machine.region("maincpu")->base() + 0x014000 + 0x020);
481   state->membank("bank4")->set_base(   state->memregion("maincpu")->base() + 0x014000 + 0x020);
482482}
483483
484484
r14976r14977
551551/*  logerror("apple 2 interface v2 rom page: %01x\n",(offset & 0x02)>>1); */
552552
553553   /* bit 0 is 0 for page 0, 1 for page 1 */
554   memory_set_bankptr(machine(), "bank4", machine().region("maincpu")->base() + 0x014000 + 0x0100 + (((offset & 0x02)>>1)<<8));
554   membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + 0x014000 + 0x0100 + (((offset & 0x02)>>1)<<8));
555555
556556   oric_enable_memory(machine(), 1, 3, TRUE, TRUE);
557557
r14976r14977
563563      /* logerror("apple 2 interface v2: rom enabled\n"); */
564564
565565      /* enable rom */
566      rom_ptr = machine().region("maincpu")->base() + 0x010000;
567      memory_set_bankptr(machine(), "bank1", rom_ptr);
568      memory_set_bankptr(machine(), "bank2", rom_ptr+0x02000);
569      memory_set_bankptr(machine(), "bank3", rom_ptr+0x03800);
570      memory_set_bankptr(machine(), "bank5", m_ram_0x0c000);
571      memory_set_bankptr(machine(), "bank6", m_ram_0x0c000+0x02000);
572      memory_set_bankptr(machine(), "bank7", m_ram_0x0c000+0x03800);
566      rom_ptr = memregion("maincpu")->base() + 0x010000;
567      membank("bank1")->set_base(rom_ptr);
568      membank("bank2")->set_base(rom_ptr+0x02000);
569      membank("bank3")->set_base(rom_ptr+0x03800);
570      membank("bank5")->set_base(m_ram_0x0c000);
571      membank("bank6")->set_base(m_ram_0x0c000+0x02000);
572      membank("bank7")->set_base(m_ram_0x0c000+0x03800);
573573   }
574574   else
575575   {
576576      /*logerror("apple 2 interface v2: ram enabled\n"); */
577577
578578      /* enable ram */
579      memory_set_bankptr(machine(), "bank1", m_ram_0x0c000);
580      memory_set_bankptr(machine(), "bank2", m_ram_0x0c000+0x02000);
581      memory_set_bankptr(machine(), "bank3", m_ram_0x0c000+0x03800);
582      memory_set_bankptr(machine(), "bank5", m_ram_0x0c000);
583      memory_set_bankptr(machine(), "bank6", m_ram_0x0c000+0x02000);
584      memory_set_bankptr(machine(), "bank7", m_ram_0x0c000+0x03800);
579      membank("bank1")->set_base(m_ram_0x0c000);
580      membank("bank2")->set_base(m_ram_0x0c000+0x02000);
581      membank("bank3")->set_base(m_ram_0x0c000+0x03800);
582      membank("bank5")->set_base(m_ram_0x0c000);
583      membank("bank6")->set_base(m_ram_0x0c000+0x02000);
584      membank("bank7")->set_base(m_ram_0x0c000+0x03800);
585585   }
586586}
587587
r14976r14977
642642
643643         oric_enable_memory(machine, 1, 3, TRUE, FALSE);
644644
645         rom_ptr = machine.region("maincpu")->base() + 0x010000;
646         memory_set_bankptr(machine, "bank1", rom_ptr);
647         memory_set_bankptr(machine, "bank2", rom_ptr+0x02000);
648         memory_set_bankptr(machine, "bank3", rom_ptr+0x03800);
645         rom_ptr = state->memregion("maincpu")->base() + 0x010000;
646         state->membank("bank1")->set_base(rom_ptr);
647         state->membank("bank2")->set_base(rom_ptr+0x02000);
648         state->membank("bank3")->set_base(rom_ptr+0x03800);
649649      }
650650      else
651651      {
r14976r14977
653653
654654         oric_enable_memory(machine, 1, 3, TRUE, TRUE);
655655
656         memory_set_bankptr(machine, "bank1", state->m_ram_0x0c000);
657         memory_set_bankptr(machine, "bank2", state->m_ram_0x0c000+0x02000);
658         memory_set_bankptr(machine, "bank3", state->m_ram_0x0c000+0x03800);
659         memory_set_bankptr(machine, "bank5", state->m_ram_0x0c000);
660         memory_set_bankptr(machine, "bank6", state->m_ram_0x0c000+0x02000);
661         memory_set_bankptr(machine, "bank7", state->m_ram_0x0c000+0x03800);
656         state->membank("bank1")->set_base(state->m_ram_0x0c000);
657         state->membank("bank2")->set_base(state->m_ram_0x0c000+0x02000);
658         state->membank("bank3")->set_base(state->m_ram_0x0c000+0x03800);
659         state->membank("bank5")->set_base(state->m_ram_0x0c000);
660         state->membank("bank6")->set_base(state->m_ram_0x0c000+0x02000);
661         state->membank("bank7")->set_base(state->m_ram_0x0c000+0x03800);
662662      }
663663   }
664664   else
r14976r14977
677677         /*logerror("&c000-&f8ff is ram!\n"); */
678678         oric_enable_memory(machine, 1, 2, TRUE, TRUE);
679679
680         memory_set_bankptr(machine, "bank1", state->m_ram_0x0c000);
681         memory_set_bankptr(machine, "bank2", state->m_ram_0x0c000+0x02000);
682         memory_set_bankptr(machine, "bank5", state->m_ram_0x0c000);
683         memory_set_bankptr(machine, "bank6", state->m_ram_0x0c000+0x02000);
680         state->membank("bank1")->set_base(state->m_ram_0x0c000);
681         state->membank("bank2")->set_base(state->m_ram_0x0c000+0x02000);
682         state->membank("bank5")->set_base(state->m_ram_0x0c000);
683         state->membank("bank6")->set_base(state->m_ram_0x0c000+0x02000);
684684      }
685685
686686      {
r14976r14977
690690         /*logerror("&f800-&ffff is jasmin rom\n"); */
691691         /* jasmin rom enabled */
692692         oric_enable_memory(machine, 3, 3, TRUE, TRUE);
693         rom_ptr = machine.region("maincpu")->base() + 0x010000+0x04000+0x02000;
694         memory_set_bankptr(machine, "bank3", rom_ptr);
695         memory_set_bankptr(machine, "bank7", rom_ptr);
693         rom_ptr = machine.root_device().memregion("maincpu")->base() + 0x010000+0x04000+0x02000;
694         state->membank("bank3")->set_base(rom_ptr);
695         state->membank("bank7")->set_base(rom_ptr);
696696      }
697697   }
698698}
r14976r14977
871871      /*logerror("&c000-&dfff is ram\n"); */
872872      /* rom disabled enable ram */
873873      oric_enable_memory(machine, 1, 1, TRUE, TRUE);
874      memory_set_bankptr(machine, "bank1", state->m_ram_0x0c000);
875      memory_set_bankptr(machine, "bank5", state->m_ram_0x0c000);
874      state->membank("bank1")->set_base(state->m_ram_0x0c000);
875      state->membank("bank5")->set_base(state->m_ram_0x0c000);
876876   }
877877   else
878878   {
r14976r14977
880880      /*logerror("&c000-&dfff is os rom\n"); */
881881      /* basic rom */
882882      oric_enable_memory(machine, 1, 1, TRUE, FALSE);
883      rom_ptr = machine.region("maincpu")->base() + 0x010000;
884      memory_set_bankptr(machine, "bank1", rom_ptr);
885      memory_set_bankptr(machine, "bank5", rom_ptr);
883      rom_ptr = machine.root_device().memregion("maincpu")->base() + 0x010000;
884      state->membank("bank1")->set_base(rom_ptr);
885      state->membank("bank5")->set_base(rom_ptr);
886886   }
887887
888888   /* for 0x0e000-0x0ffff */
r14976r14977
893893      /*logerror("&e000-&ffff is os rom\n"); */
894894      /* basic rom */
895895      oric_enable_memory(machine, 2, 3, TRUE, FALSE);
896      rom_ptr = machine.region("maincpu")->base() + 0x010000;
897      memory_set_bankptr(machine, "bank2", rom_ptr+0x02000);
898      memory_set_bankptr(machine, "bank3", rom_ptr+0x03800);
899      memory_set_bankptr(machine, "bank6", rom_ptr+0x02000);
900      memory_set_bankptr(machine, "bank7", rom_ptr+0x03800);
896      rom_ptr = machine.root_device().memregion("maincpu")->base() + 0x010000;
897      state->membank("bank2")->set_base(rom_ptr+0x02000);
898      state->membank("bank3")->set_base(rom_ptr+0x03800);
899      state->membank("bank6")->set_base(rom_ptr+0x02000);
900      state->membank("bank7")->set_base(rom_ptr+0x03800);
901901
902902   }
903903   else
r14976r14977
909909         /*logerror("&e000-&ffff is disk rom\n"); */
910910         oric_enable_memory(machine, 2, 3, TRUE, FALSE);
911911         /* enable rom of microdisc interface */
912         rom_ptr = machine.region("maincpu")->base() + 0x014000;
913         memory_set_bankptr(machine, "bank2", rom_ptr);
914         memory_set_bankptr(machine, "bank3", rom_ptr+0x01800);
912         rom_ptr = machine.root_device().memregion("maincpu")->base() + 0x014000;
913         state->membank("bank2")->set_base(rom_ptr);
914         state->membank("bank3")->set_base(rom_ptr+0x01800);
915915      }
916916      else
917917      {
918918         /*logerror("&e000-&ffff is ram\n"); */
919919         /* rom disabled enable ram */
920920         oric_enable_memory(machine, 2, 3, TRUE, TRUE);
921         memory_set_bankptr(machine, "bank2", state->m_ram_0x0c000+0x02000);
922         memory_set_bankptr(machine, "bank3", state->m_ram_0x0c000+0x03800);
923         memory_set_bankptr(machine, "bank6", state->m_ram_0x0c000+0x02000);
924         memory_set_bankptr(machine, "bank7", state->m_ram_0x0c000+0x03800);
921         state->membank("bank2")->set_base(state->m_ram_0x0c000+0x02000);
922         state->membank("bank3")->set_base(state->m_ram_0x0c000+0x03800);
923         state->membank("bank6")->set_base(state->m_ram_0x0c000+0x02000);
924         state->membank("bank7")->set_base(state->m_ram_0x0c000+0x03800);
925925      }
926926   }
927927}
r14976r14977
11111111
11121112         /* os rom */
11131113         oric_enable_memory(machine, 1, 3, TRUE, FALSE);
1114         rom_ptr = machine.region("maincpu")->base() + 0x010000;
1115         memory_set_bankptr(machine, "bank1", rom_ptr);
1116         memory_set_bankptr(machine, "bank2", rom_ptr+0x02000);
1117         memory_set_bankptr(machine, "bank3", rom_ptr+0x03800);
1118         memory_set_bankptr(machine, "bank5", rom_ptr);
1119         memory_set_bankptr(machine, "bank6", rom_ptr+0x02000);
1120         memory_set_bankptr(machine, "bank7", rom_ptr+0x03800);
1114         rom_ptr = state->memregion("maincpu")->base() + 0x010000;
1115         state->membank("bank1")->set_base(rom_ptr);
1116         state->membank("bank2")->set_base(rom_ptr+0x02000);
1117         state->membank("bank3")->set_base(rom_ptr+0x03800);
1118         state->membank("bank5")->set_base(rom_ptr);
1119         state->membank("bank6")->set_base(rom_ptr+0x02000);
1120         state->membank("bank7")->set_base(rom_ptr+0x03800);
11211121
11221122
11231123         if (disc_interface_id==ORIC_FLOPPY_INTERFACE_APPLE2)
r14976r14977
12951295   {
12961296      case TELESTRAT_MEM_BLOCK_RAM:
12971297      {
1298         memory_set_bankptr(machine, "bank1", mem_block->ptr);
1299         memory_set_bankptr(machine, "bank2", mem_block->ptr);
1298         state->membank("bank1")->set_base(mem_block->ptr);
1299         state->membank("bank2")->set_base(mem_block->ptr);
13001300         space->install_read_bank(0xc000, 0xffff, "bank1");
13011301         space->install_write_bank(0xc000, 0xffff, "bank2");
13021302      }
r14976r14977
13041304
13051305      case TELESTRAT_MEM_BLOCK_ROM:
13061306      {
1307         memory_set_bankptr(machine, "bank1", mem_block->ptr);
1307         state->membank("bank1")->set_base(mem_block->ptr);
13081308         space->install_read_bank(0xc000, 0xffff, "bank1");
13091309         space->nop_write(0xc000, 0xffff);
13101310      }
r14976r14977
14221422MACHINE_START( telestrat )
14231423{
14241424   oric_state *state = machine.driver_data<oric_state>();
1425   UINT8 *mem = machine.region("maincpu")->base();
1425   UINT8 *mem = state->memregion("maincpu")->base();
14261426
14271427   oric_common_init_machine(machine);
14281428
src/mess/machine/genpc.c
r14976r14977
634634   install_device_write(this,    0x00a0, 0x00a1, 0, 0, FUNC(nmi_enable_w));
635635   /* MESS managed RAM */
636636   if ( machine().device<ram_device>(RAM_TAG)->pointer() )
637      memory_set_bankptr( machine(), "bank10", machine().device<ram_device>(RAM_TAG)->pointer() );
637      membank( "bank10" )->set_base( machine().device<ram_device>(RAM_TAG)->pointer() );
638638}
639639
640640IRQ_CALLBACK(ibm5160_mb_device::pc_irq_callback)
src/mess/machine/vector06.c
r14976r14977
6666
6767READ8_MEMBER( vector06_state::vector06_romdisk_portb_r )
6868{
69   UINT8 *romdisk = machine().region("maincpu")->base() + 0x18000;
69   UINT8 *romdisk = memregion("maincpu")->base() + 0x18000;
7070   UINT16 addr = (m_romdisk_msb | m_romdisk_lsb) & 0x7fff;
7171   return romdisk[addr];
7272}
r14976r14977
139139
140140static TIMER_CALLBACK( reset_check_callback )
141141{
142   vector06_state *state = machine.driver_data<vector06_state>();
142143   UINT8 val = input_port_read(machine, "RESET");
143144
144145   if (BIT(val, 0))
145146   {
146      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x10000);
147      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x10000);
147148      machine.device("maincpu")->reset();
148149   }
149150
150151   if (BIT(val, 1))
151152   {
152      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer() + 0x0000);
153      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x0000);
153154      machine.device("maincpu")->reset();
154155   }
155156}
r14976r14977
178179   space->install_read_bank (0x8000, 0xffff, "bank3");
179180   space->install_write_bank(0x8000, 0xffff, "bank4");
180181
181   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x10000);
182   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0x0000);
183   memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
184   memory_set_bankptr(machine, "bank4", machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
182   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x10000);
183   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x0000);
184   state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
185   state->membank("bank4")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
185186
186187   state->m_keyboard_mask = 0;
187188   state->m_color_index = 0;
src/mess/machine/a2thunderclock.c
r14976r14977
106106   set_a2bus_device();
107107
108108   astring tempstring;
109   m_rom = device().machine().region(this->subtag(tempstring, THUNDERCLOCK_ROM_REGION))->base();
109   m_rom = device().machine().root_device().memregion(this->subtag(tempstring, THUNDERCLOCK_ROM_REGION))->base();
110110
111111   save_item(NAME(m_dataout));
112112}
src/mess/machine/sorcerer.c
r14976r14977
134134/* after the first 4 bytes have been read from ROM, switch the ram back in */
135135static TIMER_CALLBACK( sorcerer_reset )
136136{
137   memory_set_bank(machine, "boot", 0);
137   sorcerer_state *state = machine.driver_data<sorcerer_state>();
138   state->membank("boot")->set_entry(0);
138139}
139140
140141WRITE8_MEMBER(sorcerer_state::sorcerer_fc_w)
r14976r14977
305306SNAPSHOT_LOAD(sorcerer)
306307{
307308   device_t *cpu = image.device().machine().device("maincpu");
308   UINT8 *RAM = image.device().machine().region(cpu->tag())->base();
309   UINT8 *RAM = image.device().machine().root_device().memregion(cpu->tag())->base();
309310   address_space *space = cpu->memory().space(AS_PROGRAM);
310311   UINT8 header[28];
311312   unsigned char s_byte;
r14976r14977
421422   state->m_fe = 0xff;
422423   state->sorcerer_fe_w(*space, 0, 0, 0xff);
423424
424   memory_set_bank(machine, "boot", 1);
425   state->membank("boot")->set_entry(1);
425426   machine.scheduler().timer_set(attotime::from_usec(10), FUNC(sorcerer_reset));
426427}
src/mess/machine/sapi1.c
r14976r14977
4545{
4646   sapi1_state *state = machine.driver_data<sapi1_state>();
4747   state->m_keyboard_mask = 0;
48   memory_set_bank(machine, "bank1", 1);
48   state->membank("bank1")->set_entry(1);
4949}
5050
5151DRIVER_INIT( sapizps3 )
5252{
53   UINT8 *RAM = machine.region("maincpu")->base();
54   memory_configure_bank(machine, "bank1", 0, 2, &RAM[0x0000], 0xf800);
53   sapi1_state *state = machine.driver_data<sapi1_state>();
54   UINT8 *RAM = state->memregion("maincpu")->base();
55   state->membank("bank1")->configure_entries(0, 2, &RAM[0x0000], 0xf800);
5556}
src/mess/machine/amigacrt.c
r14976r14977
4040
4141static int check_kickstart_12_13( running_machine &machine, const char *cart_name )
4242{
43   UINT16 * ksmem = (UINT16 *)(*machine.region( "user1" ));
43   UINT16 * ksmem = (UINT16 *)(*machine.root_device().memregion( "user1" ));
4444
4545   if ( ksmem[2] == 0x00FC )
4646      return 1;
r14976r14977
138138
139139static void amiga_ar1_init( running_machine &machine )
140140{
141   amiga_state *state = machine.driver_data<amiga_state>();
141142   void *ar_ram;
142143
143144   /* check kickstart version */
r14976r14977
159160   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x9fc000, 0x9fffff, "bank3");
160161
161162   /* Configure Banks */
162   memory_set_bankptr(machine, "bank2", machine.region("user2")->base());
163   memory_set_bankptr(machine, "bank3", ar_ram);
163   state->membank("bank2")->set_base(machine.root_device().memregion("user2")->base());
164   state->membank("bank3")->set_base(ar_ram);
164165
165166   amigacrt.ar1_spurious = 0;
166167
r14976r14977
221222static READ16_HANDLER( amiga_ar23_mode_r )
222223{
223224   amiga_state *state = space->machine().driver_data<amiga_state>();
224   UINT16 *mem = (UINT16 *)(*space->machine().region( "user2" ));
225   UINT16 *mem = (UINT16 *)(*state->memregion( "user2" ));
225226
226227   if ( ACCESSING_BITS_0_7 )
227228   {
r14976r14977
232233      {
233234         UINT32 mirror_mask = state->m_chip_ram.bytes();
234235
235         memory_set_bank(space->machine(), "bank1", 0);
236         state->membank("bank1")->set_entry(0);
236237
237238         while( (mirror_mask<<1) < 0x100000 )
238239         {
r14976r14977
279280      }
280281
281282      /* overlay the cart rom's in chipram */
282      memory_set_bank(machine, "bank1", 2);
283      state->membank("bank1")->set_entry(2);
283284
284285      /* writes go to chipram */
285286      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x000000, state->m_chip_ram.bytes() - 1, FUNC(amiga_ar23_chipmem_w));
r14976r14977
382383   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x400000, 0x400003, 0, mirror, FUNC(amiga_ar23_mode_w));
383384
384385   /* Configure Banks */
385   memory_set_bankptr(machine, "bank2", machine.region("user2")->base());
386   memory_set_bankptr(machine, "bank3", ar_ram);
386   state->membank("bank2")->set_base(machine.root_device().memregion("user2")->base());
387   state->membank("bank3")->set_base(ar_ram);
387388
388   memory_configure_bank(machine, "bank1", 0, 2, state->m_chip_ram, 0);
389   memory_configure_bank(machine, "bank1", 1, 2, machine.region("user1")->base(), 0);
390   memory_configure_bank(machine, "bank1", 2, 2, machine.region("user2")->base(), 0);
389   state->membank("bank1")->configure_entries(0, 2, state->m_chip_ram, 0);
390   state->membank("bank1")->configure_entries(1, 2, machine.root_device().memregion("user1")->base(), 0);
391   state->membank("bank1")->configure_entries(2, 2, machine.root_device().memregion("user2")->base(), 0);
391392
392393   amigacrt.ar23_mode = 3;
393394}
r14976r14977
401402void amiga_cart_init( running_machine &machine )
402403{
403404   /* see what is there */
404   UINT16 *mem = (UINT16 *)(*machine.region( "user2" ));
405   UINT16 *mem = (UINT16 *)(*machine.root_device().memregion( "user2" ));
405406
406407   amigacrt.cart_type = -1;
407408
src/mess/machine/osborne1.c
r14976r14977
152152   }
153153   if ( m_bank2_enabled )
154154   {
155      memory_set_bankptr(machine(),"bank1", machine().region("maincpu")->base() );
156      memory_set_bankptr(machine(),"bank2", m_empty_4K );
157      memory_set_bankptr(machine(),"bank3", m_empty_4K );
155      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() );
156      membank("bank2")->set_base(m_empty_4K );
157      membank("bank3")->set_base(m_empty_4K );
158158   }
159159   else
160160   {
161      memory_set_bankptr(machine(),"bank1", machine().device<ram_device>(RAM_TAG)->pointer() );
162      memory_set_bankptr(machine(),"bank2", machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000 );
163      memory_set_bankptr(machine(),"bank3", machine().device<ram_device>(RAM_TAG)->pointer() + 0x3000 );
161      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() );
162      membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000 );
163      membank("bank3")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x3000 );
164164   }
165165   m_bank4_ptr = machine().device<ram_device>(RAM_TAG)->pointer() + ( ( m_bank3_enabled ) ? 0x10000 : 0xF000 );
166   memory_set_bankptr(machine(),"bank4", m_bank4_ptr );
166   membank("bank4")->set_base(m_bank4_ptr );
167167   m_bankswitch = offset;
168168   m_in_irq_handler = 0;
169169}
r14976r14977
383383   state->m_pia_1_irq_state = FALSE;
384384   state->m_in_irq_handler = 0;
385385
386   state->m_p_chargen = machine.region( "chargen" )->base();
386   state->m_p_chargen = state->memregion( "chargen" )->base();
387387
388388   memset( machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000, 0xFF, 0x1000 );
389389
src/mess/machine/amstrad.c
r14976r14977
284284and not supported by this driver */
285285PALETTE_INIT( kccomp )
286286{
287   const UINT8 *color_prom = machine.region("proms")->base();
287   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
288288   int i;
289289
290290   color_prom = color_prom+0x018000;
r14976r14977
332332   int i;
333333
334334   /* CPC Colour data is stored in the colour ROM (RFCOLDAT.BIN) at 0x140-0x17f */
335   unsigned char* pal = machine.region("user4")->base();
335   unsigned char* pal = machine.root_device().memregion("user4")->base();
336336
337337   for(i=0; i<32; i++)
338338   {
r14976r14977
11731173   {
11741174      if ((state->m_gate_array.mrer & (1<<2)) == 0 && state->m_gate_array.romdis == 0)
11751175      {
1176         bank_base = &machine.region("maincpu")->base()[0x010000];
1176         bank_base = &state->memregion("maincpu")->base()[0x010000];
11771177      }
11781178      else
11791179      {
r14976r14977
11821182         else
11831183            bank_base = state->m_AmstradCPC_RamBanks[0];
11841184      }
1185      memory_set_bankptr(machine,"bank1", bank_base);
1186      memory_set_bankptr(machine,"bank2", bank_base+0x02000);
1185      state->membank("bank1")->set_base(bank_base);
1186      state->membank("bank2")->set_base(bank_base+0x02000);
11871187   }
11881188   else  // CPC+/GX4000
11891189   {
r14976r14977
12061206
12071207      if(state->m_AmstradCPC_RamBanks[0] != NULL)
12081208      {
1209         memory_set_bankptr(machine,"bank1", state->m_AmstradCPC_RamBanks[0]);
1210         memory_set_bankptr(machine,"bank2", state->m_AmstradCPC_RamBanks[0]+0x2000);
1211         memory_set_bankptr(machine,"bank3", state->m_AmstradCPC_RamBanks[1]);
1212         memory_set_bankptr(machine,"bank4", state->m_AmstradCPC_RamBanks[1]+0x2000);
1213         memory_set_bankptr(machine,"bank5", state->m_AmstradCPC_RamBanks[2]);
1214         memory_set_bankptr(machine,"bank6", state->m_AmstradCPC_RamBanks[2]+0x2000);
1209         state->membank("bank1")->set_base(state->m_AmstradCPC_RamBanks[0]);
1210         state->membank("bank2")->set_base(state->m_AmstradCPC_RamBanks[0]+0x2000);
1211         state->membank("bank3")->set_base(state->m_AmstradCPC_RamBanks[1]);
1212         state->membank("bank4")->set_base(state->m_AmstradCPC_RamBanks[1]+0x2000);
1213         state->membank("bank5")->set_base(state->m_AmstradCPC_RamBanks[2]);
1214         state->membank("bank6")->set_base(state->m_AmstradCPC_RamBanks[2]+0x2000);
12151215      }
12161216
12171217      if ( (state->m_gate_array.mrer & (1<<2)) == 0 && state->m_gate_array.romdis == 0)
r14976r14977
12191219         if ( state->m_asic.enabled )
12201220         {
12211221//              logerror("L-ROM: Lower ROM enabled, cart bank %i\n", state->m_asic.rmr2 & 0x07 );
1222            bank_base = &machine.region("maincpu")->base()[0x4000 * ( state->m_asic.rmr2 & 0x07 )];
1222            bank_base = &machine.root_device().memregion("maincpu")->base()[0x4000 * ( state->m_asic.rmr2 & 0x07 )];
12231223            switch( state->m_asic.rmr2 & 0x18 )
12241224            {
12251225            case 0x00:
12261226//                  logerror("L-ROM: located at &0000\n");
1227               memory_set_bankptr(machine,"bank1", bank_base);
1228               memory_set_bankptr(machine,"bank2", bank_base+0x02000);
1227               state->membank("bank1")->set_base(bank_base);
1228               state->membank("bank2")->set_base(bank_base+0x02000);
12291229               break;
12301230            case 0x08:
12311231//                  logerror("L-ROM: located at &4000\n");
1232               memory_set_bankptr(machine,"bank3", bank_base);
1233               memory_set_bankptr(machine,"bank4", bank_base+0x02000);
1232               state->membank("bank3")->set_base(bank_base);
1233               state->membank("bank4")->set_base(bank_base+0x02000);
12341234               break;
12351235            case 0x10:
12361236//                  logerror("L-ROM: located at &8000\n");
1237               memory_set_bankptr(machine,"bank5", bank_base);
1238               memory_set_bankptr(machine,"bank6", bank_base+0x02000);
1237               state->membank("bank5")->set_base(bank_base);
1238               state->membank("bank6")->set_base(bank_base+0x02000);
12391239               break;
12401240            case 0x18:
12411241//                  logerror("L-ROM: located at &0000, ASIC registers enabled\n");
1242               memory_set_bankptr(machine,"bank1", bank_base);
1243               memory_set_bankptr(machine,"bank2", bank_base+0x02000);
1242               state->membank("bank1")->set_base(bank_base);
1243               state->membank("bank2")->set_base(bank_base+0x02000);
12441244               break;
12451245            }
12461246         }
12471247         else
12481248         {
1249            memory_set_bankptr( machine, "bank1", machine.region( "maincpu" )->base() );
1250            memory_set_bankptr( machine, "bank2", machine.region( "maincpu" )->base() + 0x2000 );
1249            state->membank( "bank1" )->set_base( machine.root_device().memregion( "maincpu" )->base() );
1250            state->membank( "bank2" )->set_base( machine.root_device().memregion( "maincpu" )->base() + 0x2000 );
12511251         }
12521252      }
12531253   }
r14976r14977
12771277
12781278   if (bank_base)
12791279   {
1280      memory_set_bankptr(machine,"bank7", bank_base);
1281      memory_set_bankptr(machine,"bank8", bank_base+0x2000);
1280      state->membank("bank7")->set_base(bank_base);
1281      state->membank("bank8")->set_base(bank_base+0x2000);
12821282   }
12831283}
12841284
r14976r14977
17251725      switch(page)
17261726      {
17271727      case 0:  /* 0x0000 - 0x3fff */
1728         memory_set_bankptr(machine(),"bank1",ram+ramptr);
1729         memory_set_bankptr(machine(),"bank2",ram+ramptr+0x2000);
1730         memory_set_bankptr(machine(),"bank9",ram+ramptr);
1731         memory_set_bankptr(machine(),"bank10",ram+ramptr+0x2000);
1728         membank("bank1")->set_base(ram+ramptr);
1729         membank("bank2")->set_base(ram+ramptr+0x2000);
1730         membank("bank9")->set_base(ram+ramptr);
1731         membank("bank10")->set_base(ram+ramptr+0x2000);
17321732         m_Aleste_RamBanks[0] = ram+ramptr;
17331733         m_aleste_active_page[0] = data;
17341734         logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x0000\n",ramptr,rampage);
17351735         break;
17361736      case 1:  /* 0x4000 - 0x7fff */
1737         memory_set_bankptr(machine(),"bank3",ram+ramptr);
1738         memory_set_bankptr(machine(),"bank4",ram+ramptr+0x2000);
1739         memory_set_bankptr(machine(),"bank11",ram+ramptr);
1740         memory_set_bankptr(machine(),"bank12",ram+ramptr+0x2000);
1737         membank("bank3")->set_base(ram+ramptr);
1738         membank("bank4")->set_base(ram+ramptr+0x2000);
1739         membank("bank11")->set_base(ram+ramptr);
1740         membank("bank12")->set_base(ram+ramptr+0x2000);
17411741         m_Aleste_RamBanks[1] = ram+ramptr;
17421742         m_aleste_active_page[1] = data;
17431743         logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x4000\n",ramptr,rampage);
17441744         break;
17451745      case 2:  /* 0x8000 - 0xbfff */
1746         memory_set_bankptr(machine(),"bank5",ram+ramptr);
1747         memory_set_bankptr(machine(),"bank6",ram+ramptr+0x2000);
1748         memory_set_bankptr(machine(),"bank13",ram+ramptr);
1749         memory_set_bankptr(machine(),"bank14",ram+ramptr+0x2000);
1746         membank("bank5")->set_base(ram+ramptr);
1747         membank("bank6")->set_base(ram+ramptr+0x2000);
1748         membank("bank13")->set_base(ram+ramptr);
1749         membank("bank14")->set_base(ram+ramptr+0x2000);
17501750         m_Aleste_RamBanks[2] = ram+ramptr;
17511751         m_aleste_active_page[2] = data;
17521752         logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x8000\n",ramptr,rampage);
17531753         break;
17541754      case 3:  /* 0xc000 - 0xffff */
1755         memory_set_bankptr(machine(),"bank7",ram+ramptr);
1756         memory_set_bankptr(machine(),"bank8",ram+ramptr+0x2000);
1757         memory_set_bankptr(machine(),"bank15",ram+ramptr);
1758         memory_set_bankptr(machine(),"bank16",ram+ramptr+0x2000);
1755         membank("bank7")->set_base(ram+ramptr);
1756         membank("bank8")->set_base(ram+ramptr+0x2000);
1757         membank("bank15")->set_base(ram+ramptr);
1758         membank("bank16")->set_base(ram+ramptr+0x2000);
17591759         m_Aleste_RamBanks[3] = ram+ramptr;
17601760         m_aleste_active_page[3] = data;
17611761         logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0xc000\n",ramptr,rampage);
r14976r14977
23142314   {
23152315      if(state->m_aleste_mode & 0x04)
23162316      {
2317         memory_set_bankptr(machine,"bank3", state->m_Aleste_RamBanks[1]);
2318         memory_set_bankptr(machine,"bank4", state->m_Aleste_RamBanks[1]+0x2000);
2317         state->membank("bank3")->set_base(state->m_Aleste_RamBanks[1]);
2318         state->membank("bank4")->set_base(state->m_Aleste_RamBanks[1]+0x2000);
23192319         /* bank 2 - 0x08000..0x0bfff */
2320         memory_set_bankptr(machine,"bank5", state->m_Aleste_RamBanks[2]);
2321         memory_set_bankptr(machine,"bank6", state->m_Aleste_RamBanks[2]+0x2000);
2320         state->membank("bank5")->set_base(state->m_Aleste_RamBanks[2]);
2321         state->membank("bank6")->set_base(state->m_Aleste_RamBanks[2]+0x2000);
23222322      }
23232323      else
23242324      {
2325         memory_set_bankptr(machine,"bank3", state->m_AmstradCPC_RamBanks[1]);
2326         memory_set_bankptr(machine,"bank4", state->m_AmstradCPC_RamBanks[1]+0x2000);
2325         state->membank("bank3")->set_base(state->m_AmstradCPC_RamBanks[1]);
2326         state->membank("bank4")->set_base(state->m_AmstradCPC_RamBanks[1]+0x2000);
23272327         /* bank 2 - 0x08000..0x0bfff */
2328         memory_set_bankptr(machine,"bank5", state->m_AmstradCPC_RamBanks[2]);
2329         memory_set_bankptr(machine,"bank6", state->m_AmstradCPC_RamBanks[2]+0x2000);
2328         state->membank("bank5")->set_base(state->m_AmstradCPC_RamBanks[2]);
2329         state->membank("bank6")->set_base(state->m_AmstradCPC_RamBanks[2]+0x2000);
23302330      }
23312331   }
23322332   else
r14976r14977
23382338   /* other banks */
23392339   if(state->m_aleste_mode & 0x04)
23402340   {
2341      memory_set_bankptr(machine,"bank9", state->m_Aleste_RamBanks[0]);
2342      memory_set_bankptr(machine,"bank10", state->m_Aleste_RamBanks[0]+0x2000);
2343      memory_set_bankptr(machine,"bank11", state->m_Aleste_RamBanks[1]);
2344      memory_set_bankptr(machine,"bank12", state->m_Aleste_RamBanks[1]+0x2000);
2345      memory_set_bankptr(machine,"bank13", state->m_Aleste_RamBanks[2]);
2346      memory_set_bankptr(machine,"bank14", state->m_Aleste_RamBanks[2]+0x2000);
2347      memory_set_bankptr(machine,"bank15", state->m_Aleste_RamBanks[3]);
2348      memory_set_bankptr(machine,"bank16", state->m_Aleste_RamBanks[3]+0x2000);
2341      state->membank("bank9")->set_base(state->m_Aleste_RamBanks[0]);
2342      state->membank("bank10")->set_base(state->m_Aleste_RamBanks[0]+0x2000);
2343      state->membank("bank11")->set_base(state->m_Aleste_RamBanks[1]);
2344      state->membank("bank12")->set_base(state->m_Aleste_RamBanks[1]+0x2000);
2345      state->membank("bank13")->set_base(state->m_Aleste_RamBanks[2]);
2346      state->membank("bank14")->set_base(state->m_Aleste_RamBanks[2]+0x2000);
2347      state->membank("bank15")->set_base(state->m_Aleste_RamBanks[3]);
2348      state->membank("bank16")->set_base(state->m_Aleste_RamBanks[3]+0x2000);
23492349   }
23502350   else
23512351   {
2352      memory_set_bankptr(machine,"bank9", state->m_AmstradCPC_RamBanks[0]);
2353      memory_set_bankptr(machine,"bank10", state->m_AmstradCPC_RamBanks[0]+0x2000);
2354      memory_set_bankptr(machine,"bank11", state->m_AmstradCPC_RamBanks[1]);
2355      memory_set_bankptr(machine,"bank12", state->m_AmstradCPC_RamBanks[1]+0x2000);
2356      memory_set_bankptr(machine,"bank13", state->m_AmstradCPC_RamBanks[2]);
2357      memory_set_bankptr(machine,"bank14", state->m_AmstradCPC_RamBanks[2]+0x2000);
2358      memory_set_bankptr(machine,"bank15", state->m_AmstradCPC_RamBanks[3]);
2359      memory_set_bankptr(machine,"bank16", state->m_AmstradCPC_RamBanks[3]+0x2000);
2352      state->membank("bank9")->set_base(state->m_AmstradCPC_RamBanks[0]);
2353      state->membank("bank10")->set_base(state->m_AmstradCPC_RamBanks[0]+0x2000);
2354      state->membank("bank11")->set_base(state->m_AmstradCPC_RamBanks[1]);
2355      state->membank("bank12")->set_base(state->m_AmstradCPC_RamBanks[1]+0x2000);
2356      state->membank("bank13")->set_base(state->m_AmstradCPC_RamBanks[2]);
2357      state->membank("bank14")->set_base(state->m_AmstradCPC_RamBanks[2]+0x2000);
2358      state->membank("bank15")->set_base(state->m_AmstradCPC_RamBanks[3]);
2359      state->membank("bank16")->set_base(state->m_AmstradCPC_RamBanks[3]+0x2000);
23602360   }
23612361
23622362   /* multiface hardware enabled? */
r14976r14977
29122912{
29132913   amstrad_state *state = machine.driver_data<amstrad_state>();
29142914   int i;
2915   UINT8 *rom = machine.region("maincpu")->base();
2915   UINT8 *rom = state->memregion("maincpu")->base();
29162916
29172917   for (i=0; i<256; i++)
29182918   {
r14976r14977
29362936MACHINE_START( plus )
29372937{
29382938   amstrad_state *state = machine.driver_data<amstrad_state>();
2939   state->m_asic.ram = machine.region("user1")->base();  // 16kB RAM for ASIC, memory-mapped registers.
2939   state->m_asic.ram = state->memregion("user1")->base();  // 16kB RAM for ASIC, memory-mapped registers.
29402940   state->m_system_type = SYSTEM_PLUS;
29412941}
29422942
r14976r14977
29452945{
29462946   amstrad_state *state = machine.driver_data<amstrad_state>();
29472947   int i;
2948   UINT8 *rom = machine.region("maincpu")->base();
2948   UINT8 *rom = state->memregion("maincpu")->base();
29492949
29502950   for (i=0; i<128; i++)  // fill ROM table
29512951   {
r14976r14977
29832983MACHINE_START( gx4000 )
29842984{
29852985   amstrad_state *state = machine.driver_data<amstrad_state>();
2986   state->m_asic.ram = machine.region("user1")->base();  // 16kB RAM for ASIC, memory-mapped registers.
2986   state->m_asic.ram = state->memregion("user1")->base();  // 16kB RAM for ASIC, memory-mapped registers.
29872987   state->m_system_type = SYSTEM_GX4000;
29882988}
29892989
r14976r14977
29912991{
29922992   amstrad_state *state = machine.driver_data<amstrad_state>();
29932993   int i;
2994   UINT8 *rom = machine.region("maincpu")->base();
2994   UINT8 *rom = state->memregion("maincpu")->base();
29952995
29962996   for (i=0; i<128; i++)  // fill ROM table
29972997   {
r14976r14977
30373037{
30383038   amstrad_state *state = machine.driver_data<amstrad_state>();
30393039   int i;
3040   UINT8 *rom = machine.region("maincpu")->base();
3040   UINT8 *rom = state->memregion("maincpu")->base();
30413041
30423042   for (i=0; i<256; i++)
30433043   {
r14976r14977
30673067{
30683068   amstrad_state *state = machine.driver_data<amstrad_state>();
30693069   int i;
3070   UINT8 *rom = machine.region("maincpu")->base();
3070   UINT8 *rom = state->memregion("maincpu")->base();
30713071
30723072   for (i=0; i<256; i++)
30733073   {
r14976r14977
31283128   int chunksize;                // chunk length, calcaulated from the above
31293129   int ramblock;                 // 16k RAM block chunk is to be loaded in to
31303130   unsigned int bytes_to_read;   // total bytes to read, as mame_feof doesn't react to EOF without trying to go past it.
3131   unsigned char* mem = image.device().machine().region("maincpu")->base();
3131   unsigned char* mem = image.device().machine().root_device().memregion("maincpu")->base();
31323132
31333133   if (image.software_entry() == NULL)
31343134   {
src/mess/machine/sms.c
r14976r14977
8484   case 0x0000:
8585      m_banking_cart[1] = bank_start;
8686      m_banking_cart[2] = bank_start + 0x400;
87      memory_set_bankptr(machine(), "bank1", m_banking_cart[1]);
88      memory_set_bankptr(machine(), "bank2", m_banking_cart[2]);
87      membank("bank1")->set_base(m_banking_cart[1]);
88      membank("bank2")->set_base(m_banking_cart[2]);
8989      break;
9090
9191   case 0x0400:
9292      m_banking_cart[2] = bank_start + 0x400;
93      memory_set_bankptr(machine(), "bank2", m_banking_cart[2]);
93      membank("bank2")->set_base(m_banking_cart[2]);
9494      break;
9595
9696   case 0x2000:
9797      m_banking_cart[7] = bank_start;
98      memory_set_bankptr(machine(), "bank7", m_banking_cart[7]);
98      membank("bank7")->set_base(m_banking_cart[7]);
9999      break;
100100
101101   case 0x4000:
102102      m_banking_cart[3] = bank_start;
103      memory_set_bankptr(machine(), "bank3", m_banking_cart[3]);
103      membank("bank3")->set_base(m_banking_cart[3]);
104104      break;
105105
106106   case 0x6000:
107107      m_banking_cart[4] = bank_start;
108      memory_set_bankptr(machine(), "bank4", m_banking_cart[4]);
108      membank("bank4")->set_base(m_banking_cart[4]);
109109      break;
110110
111111   case 0x8000:
112112      m_banking_cart[5] = bank_start;
113      memory_set_bankptr(machine(), "bank5", m_banking_cart[5]);
113      membank("bank5")->set_base(m_banking_cart[5]);
114114      break;
115115
116116   case 0xA000:
117117      m_banking_cart[6] = bank_start;
118      memory_set_bankptr(machine(), "bank6", m_banking_cart[6]);
118      membank("bank6")->set_base(m_banking_cart[6]);
119119      break;
120120
121121   default:
r14976r14977
169169   {
170170   case 0x0000:
171171      m_banking_bios[1] = bank_start;
172      memory_set_bankptr(machine(), "bank1", m_banking_bios[1]);
172      membank("bank1")->set_base(m_banking_bios[1]);
173173      break;
174174
175175   case 0x0400:
r14976r14977
178178         break;
179179      }
180180      m_banking_bios[2] = bank_start + 0x400;
181      memory_set_bankptr(machine(), "bank2", m_banking_bios[2]);
181      membank("bank2")->set_base(m_banking_bios[2]);
182182      break;
183183
184184   case 0x2000:
r14976r14977
187187         break;
188188      }
189189      m_banking_bios[7] = bank_start;
190      memory_set_bankptr(machine(), "bank7", m_banking_bios[7]);
190      membank("bank7")->set_base(m_banking_bios[7]);
191191      break;
192192
193193   case 0x4000:
r14976r14977
196196         break;
197197      }
198198      m_banking_bios[3] = bank_start;
199      memory_set_bankptr(machine(), "bank3", m_banking_bios[3]);
199      membank("bank3")->set_base(m_banking_bios[3]);
200200      break;
201201
202202   case 0x6000:
r14976r14977
205205         break;
206206      }
207207      m_banking_bios[4] = bank_start;
208      memory_set_bankptr(machine(), "bank4", m_banking_bios[4]);
208      membank("bank4")->set_base(m_banking_bios[4]);
209209      break;
210210
211211   case 0x8000:
r14976r14977
214214         break;
215215      }
216216      m_banking_bios[5] = bank_start;
217      memory_set_bankptr(machine(), "bank5", m_banking_bios[5]);
217      membank("bank5")->set_base(m_banking_bios[5]);
218218      break;
219219
220220   case 0xA000:
r14976r14977
223223         break;
224224      }
225225      m_banking_bios[6] = bank_start;
226      memory_set_bankptr(machine(), "bank6", m_banking_bios[6]);
226      membank("bank6")->set_base(m_banking_bios[6]);
227227      break;
228228
229229   default:
r14976r14977
10191019            {
10201020               sram = m_cartridge[m_current_cartridge].cartSRAM;
10211021            }
1022            memory_set_bankptr(machine(),  "bank5", sram);
1023            memory_set_bankptr(machine(),  "bank6", sram + 0x2000);
1022            membank("bank5")->set_base(sram);
1023            membank("bank6")->set_base(sram + 0x2000);
10241024         }
10251025      }
10261026      else /* it's rom */
r14976r14977
11551155      if (data & 0x80)
11561156      {
11571157         m_cartridge[m_current_cartridge].ram_page = data & 0x07;
1158         memory_set_bankptr(machine(), "bank6", m_cartridge[m_current_cartridge].cartRAM + m_cartridge[m_current_cartridge].ram_page * 0x2000);
1158         membank("bank6")->set_base(m_cartridge[m_current_cartridge].cartRAM + m_cartridge[m_current_cartridge].ram_page * 0x2000);
11591159      }
11601160      else
11611161      {
11621162         map_cart_16k( 0x4000, data );
1163         memory_set_bankptr(machine(), "bank6", m_banking_cart[5] + 0x2000);
1163         membank("bank6")->set_base(m_banking_cart[5] + 0x2000);
11641164      }
11651165   }
11661166}
r14976r14977
12851285         if (!m_cartridge[m_current_cartridge].ROM)
12861286            return;
12871287         m_banking_cart[5] = m_cartridge[m_current_cartridge].ROM + page * 0x4000;
1288         memory_set_bankptr(machine(), "bank5", m_banking_cart[5]);
1289         memory_set_bankptr(machine(), "bank6", m_banking_cart[5] + 0x2000);
1288         membank("bank5")->set_base(m_banking_cart[5]);
1289         membank("bank6")->set_base(m_banking_cart[5] + 0x2000);
12901290         LOG(("rom 2 paged in %x (Codemasters mapper).\n", page));
12911291      }
12921292      else if (m_cartridge[m_current_cartridge].features & CF_ONCART_RAM)
r14976r14977
13661366static void setup_rom( address_space *space )
13671367{
13681368   sms_state *state = space->machine().driver_data<sms_state>();
1369   running_machine &machine = space->machine();
1370
1369   
13711370   /* 1. set up bank pointers to point to nothing */
1372   memory_set_bankptr(machine, "bank1", state->m_banking_none);
1373   memory_set_bankptr(machine, "bank2", state->m_banking_none);
1374   memory_set_bankptr(machine, "bank7", state->m_banking_none);
1375   memory_set_bankptr(machine, "bank3", state->m_banking_none);
1376   memory_set_bankptr(machine, "bank4", state->m_banking_none);
1377   memory_set_bankptr(machine, "bank5", state->m_banking_none);
1378   memory_set_bankptr(machine, "bank6", state->m_banking_none);
1371   state->membank("bank1")->set_base(state->m_banking_none);
1372   state->membank("bank2")->set_base(state->m_banking_none);
1373   state->membank("bank7")->set_base(state->m_banking_none);
1374   state->membank("bank3")->set_base(state->m_banking_none);
1375   state->membank("bank4")->set_base(state->m_banking_none);
1376   state->membank("bank5")->set_base(state->m_banking_none);
1377   state->membank("bank6")->set_base(state->m_banking_none);
13791378
13801379   /* 2. check and set up expansion port */
13811380   if (!(state->m_bios_port & IO_EXPANSION) && (state->m_bios_port & IO_CARTRIDGE) && (state->m_bios_port & IO_CARD))
r14976r14977
13961395   /* Out Run Europa initially writes a value to port 3E where IO_CARTRIDGE, IO_EXPANSION and IO_CARD are reset */
13971396   if ((!(state->m_bios_port & IO_CARTRIDGE)) || state->m_is_gamegear)
13981397   {
1399      memory_set_bankptr(machine, "bank1", state->m_banking_cart[1]);
1400      memory_set_bankptr(machine, "bank2", state->m_banking_cart[2]);
1401      memory_set_bankptr(machine, "bank7", state->m_banking_cart[7]);
1402      memory_set_bankptr(machine, "bank3", state->m_banking_cart[3]);
1403      memory_set_bankptr(machine, "bank4", state->m_banking_cart[3] + 0x2000);
1404      memory_set_bankptr(machine, "bank5", state->m_banking_cart[5]);
1405      memory_set_bankptr(machine, "bank6", state->m_banking_cart[5] + 0x2000);
1398      state->membank("bank1")->set_base(state->m_banking_cart[1]);
1399      state->membank("bank2")->set_base(state->m_banking_cart[2]);
1400      state->membank("bank7")->set_base(state->m_banking_cart[7]);
1401      state->membank("bank3")->set_base(state->m_banking_cart[3]);
1402      state->membank("bank4")->set_base(state->m_banking_cart[3] + 0x2000);
1403      state->membank("bank5")->set_base(state->m_banking_cart[5]);
1404      state->membank("bank6")->set_base(state->m_banking_cart[5] + 0x2000);
14061405      logerror("Switched in cartridge rom.\n");
14071406   }
14081407
r14976r14977
14121411      /* 0x0400 bioses */
14131412      if (state->m_has_bios_0400)
14141413      {
1415         memory_set_bankptr(machine, "bank1", state->m_banking_bios[1]);
1414         state->membank("bank1")->set_base(state->m_banking_bios[1]);
14161415         logerror("Switched in 0x0400 bios.\n");
14171416      }
14181417      /* 0x2000 bioses */
14191418      if (state->m_has_bios_2000)
14201419      {
1421         memory_set_bankptr(machine, "bank1", state->m_banking_bios[1]);
1422         memory_set_bankptr(machine, "bank2", state->m_banking_bios[2]);
1420         state->membank("bank1")->set_base(state->m_banking_bios[1]);
1421         state->membank("bank2")->set_base(state->m_banking_bios[2]);
14231422         logerror("Switched in 0x2000 bios.\n");
14241423      }
14251424      if (state->m_has_bios_full)
14261425      {
1427         memory_set_bankptr(machine, "bank1", state->m_banking_bios[1]);
1428         memory_set_bankptr(machine, "bank2", state->m_banking_bios[2]);
1429         memory_set_bankptr(machine, "bank7", state->m_banking_bios[7]);
1430         memory_set_bankptr(machine, "bank3", state->m_banking_bios[3]);
1431         memory_set_bankptr(machine, "bank4", state->m_banking_bios[3] + 0x2000);
1432         memory_set_bankptr(machine, "bank5", state->m_banking_bios[5]);
1433         memory_set_bankptr(machine, "bank6", state->m_banking_bios[5] + 0x2000);
1426         state->membank("bank1")->set_base(state->m_banking_bios[1]);
1427         state->membank("bank2")->set_base(state->m_banking_bios[2]);
1428         state->membank("bank7")->set_base(state->m_banking_bios[7]);
1429         state->membank("bank3")->set_base(state->m_banking_bios[3]);
1430         state->membank("bank4")->set_base(state->m_banking_bios[3] + 0x2000);
1431         state->membank("bank5")->set_base(state->m_banking_bios[5]);
1432         state->membank("bank6")->set_base(state->m_banking_bios[5] + 0x2000);
14341433         logerror("Switched in full bios.\n");
14351434      }
14361435   }
14371436
14381437   if (state->m_cartridge[state->m_current_cartridge].features & CF_ONCART_RAM)
14391438   {
1440      memory_set_bankptr(machine, "bank5", state->m_cartridge[state->m_current_cartridge].cartRAM);
1441      memory_set_bankptr(machine, "bank6", state->m_cartridge[state->m_current_cartridge].cartRAM);
1439      state->membank("bank5")->set_base(state->m_cartridge[state->m_current_cartridge].cartRAM);
1440      state->membank("bank6")->set_base(state->m_cartridge[state->m_current_cartridge].cartRAM);
14421441   }
14431442}
14441443
r14976r14977
18901889static void setup_banks( running_machine &machine )
18911890{
18921891   sms_state *state = machine.driver_data<sms_state>();
1893   UINT8 *mem = machine.region("maincpu")->base();
1892   UINT8 *mem = machine.root_device().memregion("maincpu")->base();
18941893   state->m_banking_none = mem;
18951894   state->m_banking_bios[1] = state->m_banking_cart[1] = mem;
18961895   state->m_banking_bios[2] = state->m_banking_cart[2] = mem;
r14976r14977
19001899   state->m_banking_bios[6] = state->m_banking_cart[6] = mem;
19011900   state->m_banking_bios[7] = state->m_banking_cart[7] = mem;
19021901
1903   state->m_BIOS = machine.region("user1")->base();
1902   state->m_BIOS = machine.root_device().memregion("user1")->base();
19041903
1905   state->m_bios_page_count = (state->m_BIOS ? machine.region("user1")->bytes() / 0x4000 : 0);
1904   state->m_bios_page_count = (state->m_BIOS ? state->memregion("user1")->bytes() / 0x4000 : 0);
19061905
19071906   setup_cart_banks(machine);
19081907
r14976r14977
20632062      m_current_cartridge = slot;
20642063
20652064   setup_cart_banks(machine());
2066   memory_set_bankptr(machine(), "bank10", m_banking_cart[3] + 0x2000);
2065   membank("bank10")->set_base(m_banking_cart[3] + 0x2000);
20672066   setup_rom(&space);
20682067}
20692068
src/mess/machine/nes_pcb.c
r14976r14977
17291729         {
17301730            state->m_prg_bank[0] = state->m_prg_chunks + (bank1 & 0x06);
17311731            state->m_prg_bank[1] = state->m_prg_chunks + (bank1 & 0x06) + 1;
1732            memory_set_bank(machine, "bank1", state->m_prg_bank[0]);
1733            memory_set_bank(machine, "bank2", state->m_prg_bank[1]);
1732            state->membank("bank1")->set_entry(state->m_prg_bank[0]);
1733            state->membank("bank2")->set_entry(state->m_prg_bank[1]);
17341734         }
17351735         else
17361736            prg16_89ab(machine, bank1 >> 1);
r14976r14977
17471747         {
17481748            state->m_prg_bank[0] = state->m_prg_chunks + (bank1 & 0x06);
17491749            state->m_prg_bank[1] = state->m_prg_chunks + (bank1 & 0x06) + 1;
1750            memory_set_bank(machine, "bank1", state->m_prg_bank[0]);
1751            memory_set_bank(machine, "bank2", state->m_prg_bank[1]);
1750            state->membank("bank1")->set_entry(state->m_prg_bank[0]);
1751            state->membank("bank2")->set_entry(state->m_prg_bank[1]);
17521752         }
17531753         else
17541754            prg16_89ab(machine, (bank1 & 0x7f) >> 1);
r14976r14977
17561756         if (!BIT(bank3, 7))
17571757         {
17581758            state->m_prg_bank[2] = state->m_prg_chunks + (bank3 & 0x07);
1759            memory_set_bank(machine, "bank3", state->m_prg_bank[2]);
1759            state->membank("bank3")->set_entry(state->m_prg_bank[2]);
17601760         }
17611761         else
17621762            prg8_cd(machine, bank3 & 0x7f);
r14976r14977
17731773         if (!BIT(bank1, 7))
17741774         {
17751775            state->m_prg_bank[0] = state->m_prg_chunks + (bank1 & 0x07);
1776            memory_set_bank(machine, "bank1", state->m_prg_bank[0]);
1776            state->membank("bank1")->set_entry(state->m_prg_bank[0]);
17771777         }
17781778         else
17791779            prg8_89(machine, bank1 & 0x7f);
r14976r14977
17811781         if (!BIT(bank2, 7))
17821782         {
17831783            state->m_prg_bank[1] = state->m_prg_chunks + (bank2 & 0x07);
1784            memory_set_bank(machine, "bank2", state->m_prg_bank[1]);
1784            state->membank("bank2")->set_entry(state->m_prg_bank[1]);
17851785         }
17861786         else
17871787            prg8_ab(machine, bank2 & 0x7f);
r14976r14977
17891789         if (!BIT(bank3, 7))
17901790         {
17911791            state->m_prg_bank[2] = state->m_prg_chunks + (bank3 & 0x07);
1792            memory_set_bank(machine, "bank3", state->m_prg_bank[2]);
1792            state->membank("bank3")->set_entry(state->m_prg_bank[2]);
17931793         }
17941794         else
17951795            prg8_cd(machine, bank3 & 0x7f);
r14976r14977
25002500               // is PRG RAM
25012501               space->install_write_bank(0x6000, 0x7fff, "bank5");
25022502               state->m_prg_bank[4] = state->m_battery_bank5_start + (data & 0x3f);
2503               memory_set_bank(space->machine(), "bank5", state->m_prg_bank[4]);
2503               state->membank("bank5")->set_entry(state->m_prg_bank[4]);
25042504            }
25052505            break;
25062506
r14976r14977
88548854      {
88558855         if (bank * 2 >= state->m_prg_chunks)
88568856         {
8857            memory_set_bankptr(space->machine(), "bank3", state->m_wram);
8858            memory_set_bankptr(space->machine(), "bank4", state->m_wram);
8857            state->membank("bank3")->set_base(state->m_wram);
8858            state->membank("bank4")->set_base(state->m_wram);
88598859         }
88608860         else
88618861         {
r14976r14977
88678867      {
88688868         if (bank * 2 >= state->m_prg_chunks)
88698869         {
8870            memory_set_bankptr(space->machine(), "bank1", state->m_wram);
8871            memory_set_bankptr(space->machine(), "bank2", state->m_wram);
8870            state->membank("bank1")->set_base(state->m_wram);
8871            state->membank("bank2")->set_base(state->m_wram);
88728872         }
88738873         else
88748874         {
r14976r14977
88818881   {
88828882      if (bank * 2 >= state->m_prg_chunks)
88838883      {
8884         memory_set_bankptr(space->machine(), "bank1", state->m_wram);
8885         memory_set_bankptr(space->machine(), "bank2", state->m_wram);
8886         memory_set_bankptr(space->machine(), "bank3", state->m_wram);
8887         memory_set_bankptr(space->machine(), "bank4", state->m_wram);
8884         state->membank("bank1")->set_base(state->m_wram);
8885         state->membank("bank2")->set_base(state->m_wram);
8886         state->membank("bank3")->set_base(state->m_wram);
8887         state->membank("bank4")->set_base(state->m_wram);
88888888      }
88898889      else
88908890      {
src/mess/machine/llc.c
r14976r14977
112112
113113MACHINE_RESET( llc2 )
114114{
115   llc_state *state = machine.driver_data<llc_state>();
115116   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
116117
117118   space->unmap_write(0x0000, 0x3fff);
118   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base());
119   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base());
119120
120121   space->unmap_write(0x4000, 0x5fff);
121   memory_set_bankptr(machine, "bank2", machine.region("maincpu")->base() + 0x4000);
122   state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000);
122123
123124   space->unmap_write(0x6000, 0xbfff);
124   memory_set_bankptr(machine, "bank3", machine.region("maincpu")->base() + 0x6000);
125   state->membank("bank3")->set_base(machine.root_device().memregion("maincpu")->base() + 0x6000);
125126
126127   space->install_write_bank(0xc000, 0xffff, "bank4");
127   memory_set_bankptr(machine, "bank4", machine.device<ram_device>(RAM_TAG)->pointer() + 0xc000);
128   state->membank("bank4")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xc000);
128129
129130}
130131
r14976r14977
134135   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
135136
136137   mem_space->install_write_bank(0x0000, 0xbfff, "bank1");
137   memory_set_bankptr(machine(), "bank1", ram);
138   membank("bank1")->set_base(ram);
138139
139140   mem_space->install_write_bank(0x4000, 0x5fff, "bank2");
140   memory_set_bankptr(machine(), "bank2", ram + 0x4000);
141   membank("bank2")->set_base(ram + 0x4000);
141142
142143   mem_space->install_write_bank(0x6000, 0xbfff, "bank3");
143   memory_set_bankptr(machine(), "bank3", ram + 0x6000);
144   membank("bank3")->set_base(ram + 0x6000);
144145
145146   mem_space->install_write_bank(0xc000, 0xffff, "bank4");
146   memory_set_bankptr(machine(), "bank4", ram + 0xc000);
147   membank("bank4")->set_base(ram + 0xc000);
147148
148149}
149150
r14976r14977
153154   address_space *mem_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
154155   if (data & 0x02) {
155156      mem_space->unmap_write(0x4000, 0x5fff);
156      memory_set_bankptr(machine(), "bank2", machine().region("maincpu")->base() + 0x10000);
157      membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
157158   } else {
158159      mem_space->install_write_bank(0x4000, 0x5fff, "bank2");
159      memory_set_bankptr(machine(), "bank2", machine().device<ram_device>(RAM_TAG)->pointer() + 0x4000);
160      membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x4000);
160161   }
161162
162163}
r14976r14977
178179}
179180static READ8_DEVICE_HANDLER (llc2_port_a_r)
180181{
181   UINT8 *k7659 = device->machine().region("k7659")->base();
182   UINT8 *k7659 = device->machine().root_device().memregion("k7659")->base();
182183   UINT8 retVal = 0;
183184   UINT8 a1 = input_port_read(device->machine(), "A1");
184185   UINT8 a2 = input_port_read(device->machine(), "A2");
src/mess/machine/odyssey2.c
r14976r14977
1919   switch ( state->m_cart_size ) {
2020   case 12288:
2121      /* 12KB cart support (for instance, KTAA as released) */
22      memory_set_bankptr( machine, "bank1", machine.region("user1")->base() + (state->m_p1 & 0x03) * 0xC00 );
23      memory_set_bankptr( machine, "bank2", machine.region("user1")->base() + (state->m_p1 & 0x03) * 0xC00 + 0x800 );
22      state->membank( "bank1" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0xC00 );
23      state->membank( "bank2" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0xC00 + 0x800 );
2424      break;
2525   case 16384:
2626      /* 16KB cart support (for instance, full sized version KTAA) */
27      memory_set_bankptr( machine, "bank1", machine.region("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0x400 );
28      memory_set_bankptr( machine, "bank2", machine.region("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0xC00 );
27      state->membank( "bank1" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0x400 );
28      state->membank( "bank2" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0xC00 );
2929      break;
3030   default:
31      memory_set_bankptr(machine, "bank1", machine.region("user1")->base() + (state->m_p1 & 0x03) * 0x800);
32      memory_set_bankptr(machine, "bank2", machine.region("user1")->base() + (state->m_p1 & 0x03) * 0x800 );
31      state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x800);
32      state->membank("bank2")->set_base(state->memregion("user1")->base() + (state->m_p1 & 0x03) * 0x800 );
3333      break;
3434   }
3535}
r14976r14977
4848   odyssey2_state *state = machine.driver_data<odyssey2_state>();
4949   int i;
5050   int size = 0;
51   UINT8 *gfx = machine.region("gfx1")->base();
51   UINT8 *gfx = state->memregion("gfx1")->base();
5252   device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart"));
5353
5454   state->m_ram        = auto_alloc_array(machine, UINT8, 256);
src/mess/machine/kc_d004.c
r14976r14977
142142
143143void kc_d004_device::device_start()
144144{
145   m_rom  = subregion(Z80_TAG)->base();
145   m_rom  = memregion(Z80_TAG)->base();
146146
147147   m_reset_timer = timer_alloc(TIMER_RESET);
148148   m_tc_clear_timer = timer_alloc(TIMER_TC_CLEAR);
src/mess/machine/tandy1t.c
r14976r14977
245245
246246static void tandy1000_set_bios_bank( running_machine &machine )
247247{
248   memory_set_bankptr( machine, "bank11", machine.region("maincpu")->base() + ( tandy.bios_bank & 0x07 ) * 0x10000 );
248   machine.root_device().membank( "bank11" )->set_base( machine.root_device().memregion("maincpu")->base() + ( tandy.bios_bank & 0x07 ) * 0x10000 );
249249}
250250
251251
src/mess/machine/ti85.c
r14976r14977
4040
4141inline void ti8x_update_bank(address_space *space, UINT8 bank, UINT8 *base, UINT8 page, bool is_ram)
4242{
43   ti85_state *state = space->machine().driver_data<ti85_state>();
4344   static const char *const tag[] = {"bank1", "bank2", "bank3", "bank4"};
4445
45   memory_set_bankptr(space->machine(), tag[bank&3], base + (0x4000 * page));
46   state->membank(tag[bank&3])->set_base(base + (0x4000 * page));
4647
4748   if (is_ram)
4849      space->install_write_bank(bank * 0x4000, bank * 0x4000 + 0x3fff, tag[bank&3]);
r14976r14977
5354static void update_ti85_memory (running_machine &machine)
5455{
5556   ti85_state *state = machine.driver_data<ti85_state>();
56   memory_set_bankptr(machine, "bank2", state->m_bios + 0x004000*state->m_ti8x_memory_page_1);
57   state->membank("bank2")->set_base(state->m_bios + 0x004000*state->m_ti8x_memory_page_1);
5758}
5859
5960static void update_ti83p_memory (running_machine &machine)
r14976r14977
113114{
114115   ti85_state *state = machine.driver_data<ti85_state>();
115116   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
116   state->m_bios = machine.region("bios")->base();
117   state->m_bios = state->memregion("bios")->base();
117118
118119   state->m_timer_interrupt_mask = 0;
119120   state->m_timer_interrupt_status = 0;
r14976r14977
135136
136137   space->unmap_write(0x0000, 0x3fff);
137138   space->unmap_write(0x4000, 0x7fff);
138   memory_set_bankptr(machine, "bank1", state->m_bios);
139   memory_set_bankptr(machine, "bank2", state->m_bios + 0x04000);
139   state->membank("bank1")->set_base(state->m_bios);
140   state->membank("bank2")->set_base(state->m_bios + 0x04000);
140141}
141142
142143MACHINE_RESET( ti85 )
r14976r14977
152153{
153154   ti85_state *state = machine.driver_data<ti85_state>();
154155   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
155   state->m_bios = machine.region("bios")->base();
156   state->m_bios = state->memregion("bios")->base();
156157
157158   state->m_timer_interrupt_mask = 0;
158159   state->m_timer_interrupt_status = 0;
r14976r14977
177178   space->unmap_write(0x4000, 0x7fff);
178179   space->unmap_write(0x8000, 0xbfff);
179180
180   memory_set_bankptr(machine, "bank1", state->m_bios);
181   memory_set_bankptr(machine, "bank2", state->m_bios);
182   memory_set_bankptr(machine, "bank3", state->m_bios);
183   memory_set_bankptr(machine, "bank4", state->m_ti8x_ram);
181   state->membank("bank1")->set_base(state->m_bios);
182   state->membank("bank2")->set_base(state->m_bios);
183   state->membank("bank3")->set_base(state->m_bios);
184   state->membank("bank4")->set_base(state->m_ti8x_ram);
184185
185186   machine.scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback));
186187
r14976r14977
191192{
192193   ti85_state *state = machine.driver_data<ti85_state>();
193194   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
194   state->m_bios = machine.region("bios")->base();
195   state->m_bios = state->memregion("bios")->base();
195196
196197   state->m_timer_interrupt_mask = 0;
197198   state->m_timer_interrupt_status = 0;
r14976r14977
214215
215216   space->unmap_write(0x0000, 0x3fff);
216217
217   memory_set_bankptr(machine, "bank1", state->m_bios);
218   memory_set_bankptr(machine, "bank2", state->m_bios + 0x04000);
218   state->membank("bank1")->set_base(state->m_bios);
219   state->membank("bank2")->set_base(state->m_bios + 0x04000);
219220
220   memory_set_bankptr(machine, "bank4", state->m_ti8x_ram);
221   state->membank("bank4")->set_base(state->m_ti8x_ram);
221222
222223   machine.scheduler().timer_pulse(attotime::from_hz(200), FUNC(ti85_timer_callback));
223224}
src/mess/machine/galaxy.c
r14976r14977
155155
156156DRIVER_INIT( galaxy )
157157{
158   galaxy_state *state = machine.driver_data<galaxy_state>();
158159   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
159160   space->install_readwrite_bank( 0x2800, 0x2800 + machine.device<ram_device>(RAM_TAG)->size() - 1, "bank1");
160   memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
161   state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
161162
162163   if (machine.device<ram_device>(RAM_TAG)->size() < (6 + 48) * 1024)
163164   {
r14976r14977
183184   space->nop_write(0x1000, 0x1fff);
184185
185186   if (input_port_read(machine, "ROM2"))
186      memory_set_bankptr(machine,"bank10", machine.region("maincpu")->base() + 0x1000);
187      state->membank("bank10")->set_base(machine.root_device().memregion("maincpu")->base() + 0x1000);
187188
188189   device_set_irq_callback(machine.device("maincpu"), galaxy_irq_callback);
189190   state->m_interrupts_enabled = TRUE;
r14976r14977
197198MACHINE_RESET( galaxyp )
198199{
199200   galaxy_state *state = machine.driver_data<galaxy_state>();
200   UINT8 *ROM = machine.region("maincpu")->base();
201   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
201202   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
202203
203204   device_set_irq_callback(machine.device("maincpu"), galaxy_irq_callback);
r14976r14977
209210
210211   space->install_read_bank(0xe000, 0xefff, "bank11");
211212   space->nop_write(0xe000, 0xefff);
212   memory_set_bankptr(machine,"bank11", machine.region("maincpu")->base() + 0xe000);
213   state->membank("bank11")->set_base(state->memregion("maincpu")->base() + 0xe000);
213214   state->m_interrupts_enabled = TRUE;
214215}
src/mess/machine/vtech2.c
r14976r14977
8484DRIVER_INIT(laser)
8585{
8686   vtech2_state *state = machine.driver_data<vtech2_state>();
87   UINT8 *gfx = machine.region("gfx2")->base();
87   UINT8 *gfx = machine.root_device().memregion("gfx2")->base();
8888   int i;
8989
9090   state->m_laser_track_x2[0] = state->m_laser_track_x2[1] = 80;
r14976r14977
9595      gfx[i] = i;
9696
9797   state->m_laser_latch = -1;
98   state->m_mem = machine.region("maincpu")->base();
98   state->m_mem = state->memregion("maincpu")->base();
9999
100100   for (i = 0; i < ARRAY_LENGTH(state->m_laser_bank); i++)
101101      state->m_laser_bank[i] = -1;
r14976r14977
162162      else
163163      {
164164         sprintf(bank,"bank%d",offset+1);
165         memory_set_bankptr(machine(), bank, &m_mem[0x4000*m_laser_bank[offset]]);
165         membank(bank)->set_base(&m_mem[0x4000*m_laser_bank[offset]]);
166166         if( m_laser_bank_mask & (1 << data) )
167167         {
168168            /* video RAM bank selected? */
src/mess/machine/zx.c
r14976r14977
2020
2121WRITE8_MEMBER(zx_state::zx_ram_w)
2222{
23   UINT8 *RAM = machine().region("maincpu")->base();
23   UINT8 *RAM = memregion("maincpu")->base();
2424   RAM[offset + 0x4000] = data;
2525
2626   if (data & 0x40)
r14976r14977
3838/* I know this looks really pointless... but it has to be here */
3939READ8_MEMBER( zx_state::zx_ram_r )
4040{
41   UINT8 *RAM = machine().region("maincpu")->base();
41   UINT8 *RAM = memregion("maincpu")->base();
4242   return RAM[offset | 0xc000];
4343}
4444
r14976r14977
4949
5050   space->install_read_bank(0x4000, 0x4000 + machine.device<ram_device>(RAM_TAG)->size() - 1, "bank1");
5151   space->install_write_handler(0x4000, 0x4000 + machine.device<ram_device>(RAM_TAG)->size() - 1, write8_delegate(FUNC(zx_state::zx_ram_w),state));
52   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x4000);
52   state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x4000);
5353}
5454
5555DIRECT_UPDATE_HANDLER( zx_setdirect )
src/mess/machine/pc1401.c
r14976r14977
117117MACHINE_START( pc1401 )
118118{
119119   device_t *main_cpu = machine.device("maincpu");
120   UINT8 *ram = machine.region("maincpu")->base() + 0x2000;
120   UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x2000;
121121   UINT8 *cpu = sc61860_internal_ram(main_cpu);
122122
123123   machine.device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
r14976r14977
134134{
135135   pc1401_state *state = machine.driver_data<pc1401_state>();
136136   int i;
137   UINT8 *gfx=machine.region("gfx1")->base();
137   UINT8 *gfx=state->memregion("gfx1")->base();
138138#if 0
139139   static const char sucker[]={
140140      /* this routine dump the memory (start 0)
src/mess/machine/comx_prn.c
r14976r14977
6464{
6565   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
6666
67   m_rom = subregion("c000")->base();
67   m_rom = memregion("c000")->base();
6868}
6969
7070
src/mess/machine/mac.c
r14976r14977
211211static void mac_install_memory(running_machine &machine, offs_t memory_begin, offs_t memory_end,
212212   offs_t memory_size, void *memory_data, int is_rom, const char *bank)
213213{
214   mac_state *state = machine.driver_data<mac_state>();
214215   address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM);
215216   offs_t memory_mask;
216217
r14976r14977
227228      space->install_read_bank(memory_begin, memory_end, memory_mask, 0, bank);
228229   }
229230
230   memory_set_bankptr(machine, bank, memory_data);
231   state->membank(bank)->set_base(memory_data);
231232
232233   if (LOG_MEMORY)
233234   {
r14976r14977
389390   if (is_rom)
390391   {
391392      /* ROM mirror */
392      memory_size = machine().region("bootrom")->bytes();
393      memory_data = machine().region("bootrom")->base();
393      memory_size = memregion("bootrom")->bytes();
394      memory_data = memregion("bootrom")->base();
394395      is_rom = TRUE;
395396   }
396397   else
r14976r14977
468469      if (overlay)
469470      {
470471         /* ROM mirror */
471         memory_size = machine().region("bootrom")->bytes();
472         memory_data = machine().region("bootrom")->base();
472         memory_size = memregion("bootrom")->bytes();
473         memory_data = memregion("bootrom")->base();
473474         is_rom = TRUE;
474475      }
475476      else
r14976r14977
20962097
20972098      /* set up ROM at 0x400000-0x43ffff (-0x5fffff for mac 128k/512k/512ke) */
20982099      mac_install_memory(machine, 0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff,
2099         machine.region("bootrom")->bytes(), machine.region("bootrom")->base(), TRUE, "bank3");
2100         machine.root_device().memregion("bootrom")->bytes(), machine.root_device().memregion("bootrom")->base(), TRUE, "bank3");
21002101   }
21012102
21022103   mac->m_overlay = -1;
src/mess/machine/z88_rom.c
r14976r14977
6565
6666void z88_32k_rom_device::device_start()
6767{
68   m_rom = machine().region_alloc(tag(), get_cart_size(), 1, ENDIANNESS_LITTLE)->base();
68   m_rom = machine().memory().region_alloc(tag(), get_cart_size(), 1, ENDIANNESS_LITTLE)->base();
6969}
7070
7171/*-------------------------------------------------
src/mess/machine/iq151_ms151a.c
r14976r14977
5656
5757void iq151_ms151a_device::device_start()
5858{
59   m_rom = (UINT8*)subregion("ms151a")->base();
59   m_rom = (UINT8*)memregion("ms151a")->base();
6060
6161   // allocate a bitmap for represent the paper
6262   m_paper = auto_bitmap_ind16_alloc(machine(), PAPER_WIDTH, PAPER_HEIGHT);
src/mess/machine/msx.c
r14976r14977
891891               /* Check whether the optional FM-PAC rom is present */
892892               option = 0x10000;
893893               size = 0x10000;
894               mem = machine.region("maincpu")->base() + option;
895               if (machine.region("maincpu")->bytes() >= size + option && mem[0] == 'A' && mem[1] == 'B') {
894               mem = machine.root_device().memregion("maincpu")->base() + option;
895               if (machine.root_device().memregion("maincpu")->bytes() >= size + option && mem[0] == 'A' && mem[1] == 'B') {
896896                  slot = &msx_slot_list[SLOT_FMPAC];
897897               }
898898               else {
r14976r14977
906906
907907            case MSX_MEM_HANDLER:
908908            case MSX_MEM_ROM:
909               mem = machine.region("maincpu")->base() + option;
909               mem = machine.root_device().memregion("maincpu")->base() + option;
910910               break;
911911            case MSX_MEM_RAM:
912912               mem = NULL;
r14976r14977
931931         }
932932         break;
933933      case MSX_LAYOUT_KANJI_ENTRY:
934         state->m_kanji_mem = machine.region("maincpu")->base() + layout->option;
934         state->m_kanji_mem = machine.root_device().memregion("maincpu")->base() + layout->option;
935935         break;
936936      case MSX_LAYOUT_RAMIO_SET_BITS_ENTRY:
937937         state->m_ramio_set_bits = (UINT8)layout->option;
src/mess/machine/mz700.c
r14976r14977
153153   /* switch in cgrom */
154154   spc->install_read_bank(0x1000, 0x1fff, "bank2");
155155   spc->nop_write(0x1000, 0x1fff);
156   memory_set_bankptr(machine(), "bank2", machine().region("monitor")->base() + 0x1000);
156   membank("bank2")->set_base(machine().root_device().memregion("monitor")->base() + 0x1000);
157157
158158   if (m_mz700_mode)
159159   {
160160      /* cgram from 0xc000 to 0xcfff */
161161      spc->install_read_bank(0xc000, 0xcfff, "bank6");
162162      spc->install_write_handler(0xc000, 0xcfff, write8_delegate(FUNC(mz_state::mz800_cgram_w),this));
163      memory_set_bankptr(machine(), "bank6", m_cgram);
163      membank("bank6")->set_base(m_cgram);
164164   }
165165   else
166166   {
r14976r14977
168168      {
169169         /* vram from 0x8000 to 0xbfff */
170170         spc->install_readwrite_bank(0x8000, 0xbfff, "bank4");
171         memory_set_bankptr(machine(), "bank4", videoram);
171         membank("bank4")->set_base(videoram);
172172      }
173173      else
174174      {
175175         /* vram from 0x8000 to 0x9fff */
176176         spc->install_readwrite_bank(0x8000, 0x9fff, "bank4");
177         memory_set_bankptr(machine(), "bank4", videoram);
177         membank("bank4")->set_base(videoram);
178178
179179         /* ram from 0xa000 to 0xbfff */
180180         spc->install_readwrite_bank(0xa000, 0xbfff, "bank5");
181         memory_set_bankptr(machine(), "bank5", machine().device<ram_device>(RAM_TAG)->pointer() + 0xa000);
181         membank("bank5")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xa000);
182182      }
183183   }
184184
r14976r14977
190190   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
191191
192192   spc->install_readwrite_bank(0x0000, 0x0fff, "bank1");
193   memory_set_bankptr(machine(), "bank1", machine().device<ram_device>(RAM_TAG)->pointer());
193   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
194194}
195195
196196WRITE8_MEMBER(mz_state::mz800_bank_0_w)
r14976r14977
198198   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
199199
200200   spc->install_readwrite_bank(0x0000, 0x7fff, "bank1");
201   memory_set_bankptr(machine(), "bank1", machine().device<ram_device>(RAM_TAG)->pointer());
201   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
202202}
203203
204204READ8_MEMBER(mz_state::mz800_bank_1_r)
r14976r14977
207207
208208   /* switch in ram from 0x1000 to 0x1fff */
209209   spc->install_readwrite_bank(0x1000, 0x1fff, "bank2");
210   memory_set_bankptr(machine(), "bank2", machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
210   membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
211211
212212   if (m_mz700_mode)
213213   {
214214      /* ram from 0xc000 to 0xcfff */
215215      spc->install_readwrite_bank(0xc000, 0xcfff, "bank6");
216      memory_set_bankptr(machine(), "bank6", machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
216      membank("bank6")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
217217   }
218218   else
219219   {
220220      /* ram from 0x8000 to 0xbfff */
221221      spc->install_readwrite_bank(0x8000, 0xbfff, "bank4");
222      memory_set_bankptr(machine(), "bank4", machine().device<ram_device>(RAM_TAG)->pointer() + 0x8000);
222      membank("bank4")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x8000);
223223   }
224224
225225   return 0xff;
r14976r14977
235235      if (!m_mz700_ram_lock)
236236      {
237237         spc->install_readwrite_bank(0xd000, 0xffff, "bank7");
238         memory_set_bankptr(machine(), "bank7", machine().device<ram_device>(RAM_TAG)->pointer() + 0xd000);
238         membank("bank7")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xd000);
239239         m_mz700_ram_vram = FALSE;
240240      }
241241   }
r14976r14977
245245      if (!m_mz800_ram_lock)
246246      {
247247         spc->install_readwrite_bank(0xe000, 0xffff, "bank8");
248         memory_set_bankptr(machine(), "bank8", machine().device<ram_device>(RAM_TAG)->pointer() + 0xe000);
248         membank("bank8")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xe000);
249249         m_mz800_ram_monitor = FALSE;
250250      }
251251   }
r14976r14977
257257
258258   spc->install_read_bank(0x0000, 0x0fff, "bank1");
259259   spc->nop_write(0x0000, 0x0fff);
260   memory_set_bankptr(machine(), "bank1", machine().region("monitor")->base());
260   membank("bank1")->set_base(machine().root_device().memregion("monitor")->base());
261261}
262262
263263WRITE8_MEMBER(mz_state::mz700_bank_3_w)
r14976r14977
271271      {
272272         /* switch in videoram */
273273         spc->install_readwrite_bank(0xd000, 0xd7ff, "bank7");
274         memory_set_bankptr(machine(), "bank7", videoram);
274         membank("bank7")->set_base(videoram);
275275
276276         /* switch in colorram */
277277         spc->install_readwrite_bank(0xd800, 0xdfff, "bank9");
278         memory_set_bankptr(machine(), "bank9", m_colorram);
278         membank("bank9")->set_base(m_colorram);
279279
280280         m_mz700_ram_vram = TRUE;
281281
r14976r14977
301301         /* switch in mz800 monitor rom if not locked */
302302         spc->install_read_bank(0xe000, 0xffff, "bank8");
303303         spc->nop_write(0xe000, 0xffff);
304         memory_set_bankptr(machine(), "bank8", machine().region("monitor")->base() + 0x2000);
304         membank("bank8")->set_base(machine().root_device().memregion("monitor")->base() + 0x2000);
305305         m_mz800_ram_monitor = TRUE;
306306      }
307307   }
r14976r14977
320320
321321      /* rest is ram is always ram in mz700 mode */
322322      spc->install_readwrite_bank(0x1000, 0xcfff, "bank2");
323      memory_set_bankptr(machine(), "bank2", machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
323      membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
324324   }
325325   else
326326   {
327327      /* monitor rom and cgrom */
328328      spc->install_read_bank(0x0000, 0x1fff, "bank1");
329329      spc->nop_write(0x0000, 0x1fff);
330      memory_set_bankptr(machine(), "bank1", machine().region("monitor")->base());
330      membank("bank1")->set_base(machine().root_device().memregion("monitor")->base());
331331
332332      /* ram from 0x2000 to 0x7fff */
333333      spc->install_readwrite_bank(0x2000, 0x7fff, "bank3");
334      memory_set_bankptr(machine(), "bank3", machine().device<ram_device>(RAM_TAG)->pointer());
334      membank("bank3")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
335335
336336      if (m_hires_mode)
337337      {
338338         /* vram from 0x8000 to 0xbfff */
339339         spc->install_readwrite_bank(0x8000, 0xbfff, "bank4");
340         memory_set_bankptr(machine(), "bank4", videoram);
340         membank("bank4")->set_base(videoram);
341341      }
342342      else
343343      {
344344         /* vram from 0x8000 to 0x9fff */
345345         spc->install_readwrite_bank(0x8000, 0x9fff, "bank4");
346         memory_set_bankptr(machine(), "bank4", videoram);
346         membank("bank4")->set_base(videoram);
347347
348348         /* ram from 0xa000 to 0xbfff */
349349         spc->install_readwrite_bank(0xa000, 0xbfff, "bank5");
350         memory_set_bankptr(machine(), "bank5", machine().device<ram_device>(RAM_TAG)->pointer() + 0xa000);
350         membank("bank5")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xa000);
351351      }
352352
353353      /* ram from 0xc000 to 0xdfff */
354354      spc->install_readwrite_bank(0xc000, 0xdfff, "bank6");
355      memory_set_bankptr(machine(), "bank6", machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
355      membank("bank6")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
356356
357357      /* mz800 monitor rom from 0xe000 to 0xffff */
358358      spc->install_read_bank(0xe000, 0xffff, "bank8");
359359      spc->nop_write(0xe000, 0xffff);
360      memory_set_bankptr(machine(), "bank8", machine().region("monitor")->base() + 0x2000);
360      membank("bank8")->set_base(machine().root_device().memregion("monitor")->base() + 0x2000);
361361      m_mz800_ram_monitor = TRUE;
362362
363363      m_mz800_ram_lock = FALSE; /* reset lock? */
r14976r14977
600600/* port EA */
601601READ8_MEMBER(mz_state::mz800_ramdisk_r)
602602{
603   UINT8 *mem = space.machine().region("user1")->base();
603   UINT8 *mem = space.machine().root_device().memregion("user1")->base();
604604   UINT8 data = mem[m_mz800_ramaddr];
605605   LOG(2,"mz800_ramdisk_r",("[%04X] -> %02X\n", m_mz800_ramaddr, data),machine());
606606   if (m_mz800_ramaddr++ == 0)
r14976r14977
651651/* port EA */
652652WRITE8_MEMBER(mz_state::mz800_ramdisk_w)
653653{
654   UINT8 *mem = machine().region("user1")->base();
654   UINT8 *mem = memregion("user1")->base();
655655   LOG(2,"mz800_ramdisk_w",("[%04X] <- %02X\n", m_mz800_ramaddr, data),machine());
656656   mem[m_mz800_ramaddr] = data;
657657   if (m_mz800_ramaddr++ == 0)
src/mess/machine/a2memexp.c
r14976r14977
105105   set_a2bus_device();
106106
107107   astring tempstring;
108   m_rom = device().machine().region(this->subtag(tempstring, MEMEXP_ROM_REGION))->base();
108   m_rom = device().machine().root_device().memregion(this->subtag(tempstring, MEMEXP_ROM_REGION))->base();
109109
110110    memset(m_ram, 0xff, 1024*1024*sizeof(UINT8));
111111
src/mess/machine/lisa.c
r14976r14977
10021002DRIVER_INIT( lisa2 )
10031003{
10041004   lisa_state *state = machine.driver_data<lisa_state>();
1005   state->m_ram_ptr = machine.region("maincpu")->base() + RAM_OFFSET;
1006   state->m_rom_ptr = machine.region("maincpu")->base() + ROM_OFFSET;
1005   state->m_ram_ptr = machine.root_device().memregion("maincpu")->base() + RAM_OFFSET;
1006   state->m_rom_ptr = state->memregion("maincpu")->base() + ROM_OFFSET;
10071007   state->m_model = lisa2;
10081008   state->m_features.has_fast_timers = 0;
10091009   state->m_features.floppy_hardware = sony_lisa2;
r14976r14977
10161016DRIVER_INIT( lisa210 )
10171017{
10181018   lisa_state *state = machine.driver_data<lisa_state>();
1019   state->m_ram_ptr = machine.region("maincpu")->base() + RAM_OFFSET;
1020   state->m_rom_ptr = machine.region("maincpu")->base() + ROM_OFFSET;
1019   state->m_ram_ptr = machine.root_device().memregion("maincpu")->base() + RAM_OFFSET;
1020   state->m_rom_ptr = state->memregion("maincpu")->base() + ROM_OFFSET;
10211021   state->m_model = lisa210;
10221022   state->m_features.has_fast_timers = 1;
10231023   state->m_features.floppy_hardware = sony_lisa210;
r14976r14977
10301030DRIVER_INIT( mac_xl )
10311031{
10321032   lisa_state *state = machine.driver_data<lisa_state>();
1033   state->m_ram_ptr = machine.region("maincpu")->base() + RAM_OFFSET;
1034   state->m_rom_ptr = machine.region("maincpu")->base() + ROM_OFFSET;
1033   state->m_ram_ptr = machine.root_device().memregion("maincpu")->base() + RAM_OFFSET;
1034   state->m_rom_ptr = state->memregion("maincpu")->base() + ROM_OFFSET;
10351035   state->m_model = mac_xl;
10361036   state->m_features.has_fast_timers = 1;
10371037   state->m_features.floppy_hardware = sony_lisa210;
r14976r14977
10531053MACHINE_RESET( lisa )
10541054{
10551055   lisa_state *state = machine.driver_data<lisa_state>();
1056   state->m_ram_ptr = machine.region("maincpu")->base() + RAM_OFFSET;
1057   state->m_rom_ptr = machine.region("maincpu")->base() + ROM_OFFSET;
1058   state->m_videoROM_ptr = machine.region("gfx1")->base();
1056   state->m_ram_ptr = machine.root_device().memregion("maincpu")->base() + RAM_OFFSET;
1057   state->m_rom_ptr = machine.root_device().memregion("maincpu")->base() + ROM_OFFSET;
1058   state->m_videoROM_ptr = state->memregion("gfx1")->base();
10591059
10601060//  machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(lisa_OPbaseoverride, *machine));
10611061//  m68k_set_reset_callback(machine.device("maincpu"), /*lisa_reset_instr_callback*/NULL);
src/mess/machine/lynx.c
r14976r14977
10391039         value = input_port_read(machine(), "PAUSE");
10401040         break;
10411041      case RCART:
1042         value = *(machine().region("user1")->base() + (m_suzy.high * m_granularity) + m_suzy.low);
1042         value = *(machine().root_device().memregion("user1")->base() + (m_suzy.high * m_granularity) + m_suzy.low);
10431043         m_suzy.low = (m_suzy.low + 1) & (m_granularity - 1);
10441044         break;
10451045      //case RCART_BANK1: /* we need bank 1 emulation!!! */
r14976r14977
19171917   }
19181918
19191919   if (data & 1)
1920      memory_set_bankptr(machine(), "bank1", m_mem_fc00);
1920      membank("bank1")->set_base(m_mem_fc00);
19211921   if (data & 2)
1922      memory_set_bankptr(machine(), "bank2", m_mem_fd00);
1923   memory_set_bank(machine(), "bank3", (data & 4) ? 1 : 0);
1924   memory_set_bank(machine(), "bank4", (data & 8) ? 1 : 0);
1922      membank("bank2")->set_base(m_mem_fd00);
1923   membank("bank3")->set_entry((data & 4) ? 1 : 0);
1924   membank("bank4")->set_entry((data & 8) ? 1 : 0);
19251925}
19261926
19271927static void lynx_reset(running_machine &machine)
r14976r14977
19721972   state->save_pointer(NAME(state->m_mem_fe00.target()), state->m_mem_fe00.bytes());
19731973   machine.save().register_postload(save_prepost_delegate(FUNC(lynx_postload), state));
19741974
1975   memory_configure_bank(machine, "bank3", 0, 1, machine.region("maincpu")->base() + 0x0000, 0);
1976   memory_configure_bank(machine, "bank3", 1, 1, state->m_mem_fe00, 0);
1977   memory_configure_bank(machine, "bank4", 0, 1, machine.region("maincpu")->base() + 0x01fa, 0);
1978   memory_configure_bank(machine, "bank4", 1, 1, state->m_mem_fffa, 0);
1975   state->membank("bank3")->configure_entry(0, machine.root_device().memregion("maincpu")->base() + 0x0000);
1976   state->membank("bank3")->configure_entry(1, state->m_mem_fe00);
1977   state->membank("bank4")->configure_entry(0, state->memregion("maincpu")->base() + 0x01fa);
1978   state->membank("bank4")->configure_entry(1, state->m_mem_fffa);
19791979
19801980   state->m_audio = machine.device("custom");
19811981
r14976r14977
20442044    512, 1024 or 2048 bytes. Commercial roms use all 256 banks.*/
20452045
20462046   lynx_state *state = image.device().machine().driver_data<lynx_state>();
2047   UINT8 *rom = image.device().machine().region("user1")->base();
2047   UINT8 *rom = state->memregion("user1")->base();
20482048   UINT32 size;
20492049   UINT8 header[0x40];
20502050
src/mess/machine/cgenie.c
r14976r14977
5050   cgenie_state *state = machine.driver_data<cgenie_state>();
5151   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
5252   device_t *ay8910 = machine.device("ay8910");
53   UINT8 *ROM = machine.region("maincpu")->base();
53   UINT8 *ROM = state->memregion("maincpu")->base();
5454
5555   /* reset the AY8910 to be quiet, since the cgenie BIOS doesn't */
5656   AYWriteReg(0, 0, 0);
r14976r14977
8787      {
8888         space->install_read_bank(0xc000, 0xdfff, "bank10");
8989         space->nop_write(0xc000, 0xdfff);
90         memory_set_bankptr(machine, "bank10", &ROM[0x0c000]);
90         state->membank("bank10")->set_base(&ROM[0x0c000]);
9191         logerror("cgenie DOS enabled\n");
9292         memcpy(&ROM[0x0c000],&ROM[0x10000], 0x2000);
9393      }
r14976r14977
101101   {
102102      space->nop_readwrite(0xc000, 0xdfff);
103103      logerror("cgenie DOS disabled\n");
104      memset(&machine.region("maincpu")->base()[0x0c000], 0x00, 0x2000);
104      memset(&machine.root_device().memregion("maincpu")->base()[0x0c000], 0x00, 0x2000);
105105   }
106106
107107   /* copy EXT ROM, if enabled or wipe out that memory area */
r14976r14977
109109   {
110110      space->install_rom(0xe000, 0xefff, 0); // mess 0135u3 need to check
111111      logerror("cgenie EXT enabled\n");
112      memcpy(&machine.region("maincpu")->base()[0x0e000],
113            &machine.region("maincpu")->base()[0x12000], 0x1000);
112      memcpy(&machine.root_device().memregion("maincpu")->base()[0x0e000],
113            &machine.root_device().memregion("maincpu")->base()[0x12000], 0x1000);
114114   }
115115   else
116116   {
117117      space->nop_readwrite(0xe000, 0xefff);
118118      logerror("cgenie EXT disabled\n");
119      memset(&machine.region("maincpu")->base()[0x0e000], 0x00, 0x1000);
119      memset(&machine.root_device().memregion("maincpu")->base()[0x0e000], 0x00, 0x1000);
120120   }
121121
122122   state->m_cass_level = 0;
r14976r14977
127127{
128128   cgenie_state *state = machine.driver_data<cgenie_state>();
129129   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
130   UINT8 *gfx = machine.region("gfx2")->base();
130   UINT8 *gfx = state->memregion("gfx2")->base();
131131   int i;
132132
133133   /* initialize static variables */
r14976r14977
152152   space->install_read_bank(0x4000, 0x4000 + machine.device<ram_device>(RAM_TAG)->size() - 1, "bank1");
153153   space->install_legacy_write_handler(0x4000, 0x4000 + machine.device<ram_device>(RAM_TAG)->size() - 1, FUNC(cgenie_videoram_w));
154154   state->m_videoram = machine.device<ram_device>(RAM_TAG)->pointer();
155   memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
155   state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
156156   machine.scheduler().timer_pulse(attotime::from_hz(11025), FUNC(handle_cassette_input));
157157}
158158
src/mess/machine/super80.c
r14976r14977
100100/* after the first 4 bytes have been read from ROM, switch the ram back in */
101101static TIMER_CALLBACK( super80_reset )
102102{
103   memory_set_bank(machine, "boot", 0);
103   super80_state *state = machine.driver_data<super80_state>();
104   state->membank("boot")->set_entry(0);
104105}
105106
106107static TIMER_CALLBACK( super80_halfspeed )
r14976r14977
202203{
203204   m_shared=0xff;
204205   machine().scheduler().timer_set(attotime::from_usec(10), FUNC(super80_reset));
205   memory_set_bank(machine(), "boot", 1);
206   membank("boot")->set_entry(1);
206207}
207208
208209static void driver_init_common( running_machine &machine )
209210{
210   UINT8 *RAM = machine.region("maincpu")->base();
211   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xc000);
211   super80_state *state = machine.driver_data<super80_state>();
212   UINT8 *RAM = state->memregion("maincpu")->base();
213   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000);
212214   machine.scheduler().timer_pulse(attotime::from_hz(200000), FUNC(super80_timer));   /* timer for keyboard and cassette */
213215}
214216
src/mess/machine/isa.c
r14976r14977
316316{
317317   address_space *space = m_maincpu->memory().space(AS_PROGRAM);
318318   space->install_readwrite_bank(start, end, mask, mirror, tag );
319   memory_set_bankptr(machine(), tag, data);
319   membank(tag)->set_base(data);
320320}
321321
322322void isa8_device::unmap_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror)
r14976r14977
328328void isa8_device::install_rom(device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, const char *region)
329329{
330330   astring tempstring;
331   if (machine().region("isa")) {
332      UINT8 *src = machine().region(dev->subtag(tempstring, region))->base();
333      UINT8 *dest = machine().region("isa")->base() + start - 0xc0000;
331   if (machine().root_device().memregion("isa")) {
332      UINT8 *src = memregion(dev->subtag(tempstring, region))->base();
333      UINT8 *dest = memregion("isa")->base() + start - 0xc0000;
334334      memcpy(dest,src, end - start + 1);
335335   } else {
336336      address_space *space = m_maincpu->memory().space(AS_PROGRAM);
337337      space->install_read_bank(start, end, mask, mirror, tag);
338338      space->unmap_write(start, end, mask, mirror);
339      memory_set_bankptr(machine(), tag, machine().region(dev->subtag(tempstring, region))->base());
339      membank(tag)->set_base(machine().root_device().memregion(dev->subtag(tempstring, region))->base());
340340   }
341341}
342342
src/mess/machine/i82439tx.c
r14976r14977
293293   i82439tx->space = cpu->memory().space(AS_PROGRAM);
294294
295295   /* get rom region */
296   i82439tx->rom = device->machine().region(config->rom_region)->base();
296   i82439tx->rom = device->machine().root_device().memregion(config->rom_region)->base();
297297
298298   /* setup save states */
299299   device->save_item(NAME(i82439tx->regs));
src/mess/machine/c64_dela_ep64.c
r14976r14977
8383 
8484void c64_dela_ep64_cartridge_device::device_start()
8585{
86   m_rom = subregion("rom")->base();
86   m_rom = memregion("rom")->base();
8787 
8888   // state saving
8989   save_item(NAME(m_bank));
src/mess/machine/lviv.c
r14976r14977
3131
3232   if (state->m_ppi_port_outputs[0][2] & 0x02)
3333   {
34      memory_set_bankptr(machine,"bank1", ram);
35      memory_set_bankptr(machine,"bank2", ram + 0x4000);
34      state->membank("bank1")->set_base(ram);
35      state->membank("bank2")->set_base(ram + 0x4000);
3636   }
3737   else
3838   {
39      memory_set_bankptr(machine,"bank1", ram + 0x8000);
40      memory_set_bankptr(machine,"bank2", ram + 0xc000);
39      state->membank("bank1")->set_base(ram + 0x8000);
40      state->membank("bank2")->set_base(ram + 0xc000);
4141   }
4242}
4343
r14976r14977
184184      cpuspace->install_write_bank(0x8000, 0xbfff, "bank3");
185185      cpuspace->unmap_write(0xC000, 0xffff);
186186
187      memory_set_bankptr(machine(),"bank1", ram);
188      memory_set_bankptr(machine(),"bank2", ram + 0x4000);
189      memory_set_bankptr(machine(),"bank3", ram + 0x8000);
190      memory_set_bankptr(machine(),"bank4", machine().region("maincpu")->base() + 0x010000);
187      membank("bank1")->set_base(ram);
188      membank("bank2")->set_base(ram + 0x4000);
189      membank("bank3")->set_base(ram + 0x8000);
190      membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + 0x010000);
191191   }
192192   else
193193   {
r14976r14977
247247   space->unmap_write(0x8000, 0xbfff);
248248   space->unmap_write(0xC000, 0xffff);
249249
250   mem = machine.region("maincpu")->base();
251   memory_set_bankptr(machine,"bank1", mem + 0x010000);
252   memory_set_bankptr(machine,"bank2", mem + 0x010000);
253   memory_set_bankptr(machine,"bank3", mem + 0x010000);
254   memory_set_bankptr(machine,"bank4", mem + 0x010000);
250   mem = state->memregion("maincpu")->base();
251   state->membank("bank1")->set_base(mem + 0x010000);
252   state->membank("bank2")->set_base(mem + 0x010000);
253   state->membank("bank3")->set_base(mem + 0x010000);
254   state->membank("bank4")->set_base(mem + 0x010000);
255255
256256   /*machine.scheduler().timer_pulse(TIME_IN_NSEC(200), FUNC(lviv_draw_pixel));*/
257257
src/mess/machine/c64_dela_ep256.c
r14976r14977
102102 
103103void c64_dela_ep256_cartridge_device::device_start()
104104{
105   m_rom = subregion("rom")->base();
105   m_rom = memregion("rom")->base();
106106 
107107   // state saving
108108   save_item(NAME(m_bank));
src/mess/machine/mbc55x.c
r14976r14977
362362
363363      if(bankno<nobanks)
364364      {
365         memory_set_bankptr(machine, bank, map_base);
365         state->membank(bank)->set_base(map_base);
366366         space->install_readwrite_bank(bank_base, bank_base+(RAM_BANK_SIZE-1), bank);
367367         logerror("Mapping bank %d at %05X to RAM\n",bankno,bank_base);
368368      }
r14976r14977
374374   }
375375
376376   // Graphics red and blue plane memory mapping, green is in main memory
377   memory_set_bankptr(machine, RED_PLANE_TAG, &state->m_video_mem[RED_PLANE_OFFSET]);
377   state->membank(RED_PLANE_TAG)->set_base(&state->m_video_mem[RED_PLANE_OFFSET]);
378378   space->install_readwrite_bank(RED_PLANE_MEMBASE, RED_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), RED_PLANE_TAG);
379   memory_set_bankptr(machine, BLUE_PLANE_TAG, &state->m_video_mem[BLUE_PLANE_OFFSET]);
379   state->membank(BLUE_PLANE_TAG)->set_base(&state->m_video_mem[BLUE_PLANE_OFFSET]);
380380   space->install_readwrite_bank(BLUE_PLANE_MEMBASE, BLUE_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), BLUE_PLANE_TAG);
381381}
382382
src/mess/machine/pc1403.c
r14976r14977
3030   logerror ("asic write %.4x %.2x\n",offset, data);
3131   break;
3232    case 2/*0x3c00*/:
33   memory_set_bankptr(space->machine(), "bank1", space->machine().region("user1")->base()+((data&7)<<14));
33   state->membank("bank1")->set_base(state->memregion("user1")->base()+((data&7)<<14));
3434   logerror ("asic write %.4x %.2x\n",offset, data);
3535   break;
3636    case 3/*0x3e00*/: break;
r14976r14977
145145MACHINE_START( pc1403 )
146146{
147147   device_t *main_cpu = machine.device("maincpu");
148   UINT8 *ram = machine.region("maincpu")->base() + 0x8000;
148   UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x8000;
149149   UINT8 *cpu = sc61860_internal_ram(main_cpu);
150150
151151   machine.device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
r14976r14977
162162{
163163   pc1403_state *state = machine.driver_data<pc1403_state>();
164164   int i;
165   UINT8 *gfx=machine.region("gfx1")->base();
165   UINT8 *gfx=machine.root_device().memregion("gfx1")->base();
166166
167167   for (i=0; i<128; i++) gfx[i]=i;
168168
169169   state->m_power = 1;
170170   machine.scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1403_power_up));
171171
172   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
172   state->membank("bank1")->set_base(state->memregion("user1")->base());
173173}
src/mess/machine/apple1.c
r14976r14977
143143
144144DRIVER_INIT( apple1 )
145145{
146   apple1_state *state = machine.driver_data<apple1_state>();
146147   address_space* space = machine.device("maincpu")->memory().space(AS_PROGRAM);
147148   /* Set up the handlers for MESS's dynamically-sized RAM. */
148149   space->install_readwrite_bank(0x0000, machine.device<ram_device>(RAM_TAG)->size() - 1, "bank1");
149   memory_set_bankptr(machine,"bank1", machine.device<ram_device>(RAM_TAG)->pointer());
150   state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
150151
151152   /* Poll the keyboard input ports periodically.  These include both
152153       ordinary keys and the RESET and CLEAR SCREEN pushbutton
src/mess/machine/iq151_disc2.c
r14976r14977
8080
8181void iq151_disc2_device::device_start()
8282{
83   m_rom = (UINT8*)subregion("disc2")->base();
83   m_rom = (UINT8*)memregion("disc2")->base();
8484}
8585
8686//-------------------------------------------------
src/mess/machine/c64_rex_ep256.c
r14976r14977
102102 
103103void c64_rex_ep256_cartridge_device::device_start()
104104{
105   m_rom = subregion("rom")->base();
105   m_rom = memregion("rom")->base();
106106 
107107   // state saving
108108   save_item(NAME(m_bank));
src/mess/machine/mtx.c
r14976r14977
7373        7       RELCPMH
7474
7575    */
76
76   mtx_state *state = machine.driver_data<mtx_state>();
7777   address_space *program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM);
7878   ram_device *messram = machine.device<ram_device>(RAM_TAG);
7979
r14976r14977
8282   UINT8 ram_page = data >> 0 & 0x0f;
8383
8484   /* set rom bank (switches between basic and assembler rom or cartridges) */
85   memory_set_bank(machine, "bank2", rom_page);
85   state->membank("bank2")->set_entry(rom_page);
8686
8787   /* set ram bank, for invalid pages a nop-handler will be installed */
8888   if (ram_page >= messram->size()/0x8000)
r14976r14977
9494   {
9595      program->nop_readwrite(0x4000, 0x7fff);
9696      program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
97      memory_set_bank(machine, "bank4", ram_page);
97      state->membank("bank4")->set_entry(ram_page);
9898   }
9999   else
100100   {
101101      program->install_readwrite_bank(0x4000, 0x7fff, "bank3");
102102      program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
103      memory_set_bank(machine, "bank3", ram_page);
104      memory_set_bank(machine, "bank4", ram_page);
103      state->membank("bank3")->set_entry(ram_page);
104      state->membank("bank4")->set_entry(ram_page);
105105   }
106106}
107107
r14976r14977
383383   state->m_cassette = machine.device<cassette_image_device>(CASSETTE_TAG);
384384
385385   /* configure memory */
386   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
387   memory_configure_bank(machine, "bank2", 0, 8, machine.region("user2")->base(), 0x2000);
388   memory_configure_bank(machine, "bank3", 0, messram->size()/0x4000/2, messram->pointer(), 0x4000);
389   memory_configure_bank(machine, "bank4", 0, messram->size()/0x4000/2, messram->pointer() + messram->size()/2, 0x4000);
386   state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base());
387   state->membank("bank2")->configure_entries(0, 8, state->memregion("user2")->base(), 0x2000);
388   state->membank("bank3")->configure_entries(0, messram->size()/0x4000/2, messram->pointer(), 0x4000);
389   state->membank("bank4")->configure_entries(0, messram->size()/0x4000/2, messram->pointer() + messram->size()/2, 0x4000);
390390}
391391
392392/*-------------------------------------------------
src/mess/machine/lux10828.c
r14976r14977
429429   save_item(NAME(m_sel1));
430430
431431   // patch out protection checks
432   UINT8 *rom = subregion("abc830")->base();
432   UINT8 *rom = memregion("abc830")->base();
433433   rom[0x00fa] = 0xff;
434434   rom[0x0336] = 0xff;
435435   rom[0x0718] = 0xff;
src/mess/machine/special.c
r14976r14977
1515/* Driver initialization */
1616DRIVER_INIT(special)
1717{
18   special_state *state = machine.driver_data<special_state>();
1819   /* set initialy ROM to be visible on first bank */
19   UINT8 *RAM = machine.region("maincpu")->base();
20   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
2021   memset(RAM,0x0000,0x3000); // make first page empty by default
21   memory_configure_bank(machine, "bank1", 1, 2, RAM, 0x0000);
22   memory_configure_bank(machine, "bank1", 0, 2, RAM, 0xc000);
22   state->membank("bank1")->configure_entries(1, 2, RAM, 0x0000);
23   state->membank("bank1")->configure_entries(0, 2, RAM, 0xc000);
2324}
2425
2526READ8_MEMBER( special_state::specialist_8255_porta_r )
r14976r14977
103104
104105static TIMER_CALLBACK( special_reset )
105106{
106   memory_set_bank(machine, "bank1", 0);
107   special_state *state = machine.driver_data<special_state>();
108   state->membank("bank1")->set_entry(0);
107109}
108110
109111
110112MACHINE_RESET( special )
111113{
114   special_state *state = machine.driver_data<special_state>();
112115   machine.scheduler().timer_set(attotime::from_usec(10), FUNC(special_reset));
113   memory_set_bank(machine, "bank1", 1);
116   state->membank("bank1")->set_entry(1);
114117}
115118
116119
r14976r14977
140143
141144   space->install_write_bank(0xc000, 0xffbf, "bank3");
142145   space->install_write_bank(0xffc0, 0xffdf, "bank4");
143   memory_set_bankptr(machine(), "bank4", ram + 0xffc0);
146   membank("bank4")->set_base(ram + 0xffc0);
144147   switch(i)
145148   {
146149      case 0 :
147150         space->install_write_bank(0x0000, 0x8fff, "bank1");
148151         space->install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(special_state::video_memory_w), this));
149152
150         memory_set_bankptr(machine(), "bank1", ram);
151         memory_set_bankptr(machine(), "bank2", ram + 0x9000);
152         memory_set_bankptr(machine(), "bank3", ram + 0xc000);
153         membank("bank1")->set_base(ram);
154         membank("bank2")->set_base(ram + 0x9000);
155         membank("bank3")->set_base(ram + 0xc000);
153156         break;
154157      case 1 :
155158         space->install_write_bank(0x0000, 0x8fff, "bank1");
156159         space->install_write_bank(0x9000, 0xbfff, "bank2");
157160
158         memory_set_bankptr(machine(), "bank1", ram + 0x10000);
159         memory_set_bankptr(machine(), "bank2", ram + 0x19000);
160         memory_set_bankptr(machine(), "bank3", ram + 0x1c000);
161         membank("bank1")->set_base(ram + 0x10000);
162         membank("bank2")->set_base(ram + 0x19000);
163         membank("bank3")->set_base(ram + 0x1c000);
161164         break;
162165      case 2 :
163166         space->unmap_write(0x0000, 0x8fff);
164167         space->unmap_write(0x9000, 0xbfff);
165168
166         memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x10000);
167         memory_set_bankptr(machine(), "bank2", machine().region("maincpu")->base() + 0x19000);
169         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
170         membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x19000);
168171
169172         if (data & 0x80)
170            memory_set_bankptr(machine(), "bank3", ram + 0x1c000);
173            membank("bank3")->set_base(ram + 0x1c000);
171174         else
172            memory_set_bankptr(machine(), "bank3", ram + 0xc000);
175            membank("bank3")->set_base(ram + 0xc000);
173176
174177         break;
175178   }
r14976r14977
272275   UINT8 bank2 = (m_RR_register >> 2) & 3;
273276   UINT8 bank3 = (m_RR_register >> 4) & 3;
274277   UINT8 bank4 = (m_RR_register >> 6) & 3;
275   UINT8 *mem = machine().region("maincpu")->base();
278   UINT8 *mem = memregion("maincpu")->base();
276279   UINT8 *ram = m_ram->pointer();
277280   address_space *space = m_maincpu->memory().space(AS_PROGRAM);
278281
r14976r14977
288291      case   1:
289292      case   2:
290293      case   3:
291         memory_set_bankptr(machine(), "bank1", ram + 0x10000*(bank1-1));
294         membank("bank1")->set_base(ram + 0x10000*(bank1-1));
292295         break;
293296      case   0:
294297         space->unmap_write(0x0000, 0x3fff);
295         memory_set_bankptr(machine(), "bank1", mem + 0x10000);
298         membank("bank1")->set_base(mem + 0x10000);
296299         break;
297300   }
298301   switch(bank2)
r14976r14977
300303      case   1:
301304      case   2:
302305      case   3:
303         memory_set_bankptr(machine(), "bank2", ram + 0x10000*(bank2-1) + 0x4000);
306         membank("bank2")->set_base(ram + 0x10000*(bank2-1) + 0x4000);
304307         break;
305308      case   0:
306309         space->unmap_write(0x4000, 0x8fff);
307         memory_set_bankptr(machine(), "bank2", mem + 0x14000);
310         membank("bank2")->set_base(mem + 0x14000);
308311         break;
309312   }
310313   switch(bank3)
r14976r14977
312315      case   1:
313316      case   2:
314317      case   3:
315         memory_set_bankptr(machine(), "bank3", ram + 0x10000*(bank3-1) + 0x9000);
318         membank("bank3")->set_base(ram + 0x10000*(bank3-1) + 0x9000);
316319         break;
317320      case   0:
318321         space->unmap_write(0x9000, 0xbfff);
319         memory_set_bankptr(machine(), "bank3", mem + 0x19000);
322         membank("bank3")->set_base(mem + 0x19000);
320323         break;
321324   }
322325   switch(bank4)
r14976r14977
324327      case   1:
325328      case   2:
326329      case   3:
327         memory_set_bankptr(machine(), "bank4", ram + 0x10000*(bank4-1) + 0x0c000);
328         memory_set_bankptr(machine(), "bank5", ram + 0x10000*(bank4-1) + 0x0f000);
329         memory_set_bankptr(machine(), "bank6", ram + 0x10000*(bank4-1) + 0x0f800);
330         membank("bank4")->set_base(ram + 0x10000*(bank4-1) + 0x0c000);
331         membank("bank5")->set_base(ram + 0x10000*(bank4-1) + 0x0f000);
332         membank("bank6")->set_base(ram + 0x10000*(bank4-1) + 0x0f800);
330333         break;
331334      case   0:
332335         space->unmap_write(0xc000, 0xefff);
333         memory_set_bankptr(machine(), "bank4", mem + 0x1c000);
336         membank("bank4")->set_base(mem + 0x1c000);
334337         space->unmap_write(0xf000, 0xf7ff);
335338         space->nop_read(0xf000, 0xf7ff);
336339         space->install_readwrite_handler(0xf800, 0xf803, 0, 0x7fc, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi));
src/mess/machine/jupiter.c
r14976r14977
2929
3030SNAPSHOT_LOAD(jupiter)
3131{
32   UINT8 *RAM = image.device().machine().region("maincpu")->base();
32   UINT8 *RAM = image.device().machine().root_device().memregion("maincpu")->base();
3333   device_t *cpu = image.device().machine().device("maincpu");
3434   address_space *space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
3535   unsigned char jupiter_repeat, jupiter_byte, loop;
src/mess/machine/rmnimbus.c
r14976r14977
20502050        {
20512051            map_base=(ramsel==0x07) ? map_blocks[map_blockno] : &map_blocks[map_blockno][block_ofs*1024];
20522052
2053            memory_set_bankptr(machine, bank, map_base);
2053            state->membank(bank)->set_base(map_base);
20542054            space->install_readwrite_bank(memmap[blockno].start, memmap[blockno].end, bank);
20552055            //if(LOG_RAM) logerror(", base=%X\n",(int)map_base);
20562056        }
src/mess/machine/cybiko.c
r14976r14977
4242{
4343   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(start, start + size - 1, 0, mirror - size, "bank1");
4444   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(start, start + size - 1, 0, mirror - size, "bank1");
45   memory_set_bankptr( machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
45   machine.root_device().membank( "bank1" )->set_base( machine.device<ram_device>(RAM_TAG)->pointer());
4646}
4747
4848DRIVER_INIT( cybikov1 )
r14976r14977
202202   nvram_system_load( machine, "flash1", cybiko_at45dbxx_load, 1);
203203   // multi-purpose flash
204204   nvram_system_load( machine, "flash2", cybiko_sst39vfx_load, 1);
205   memory_set_bankptr( machine, "bank2", sst39vfx_get_base(flash2));
205   machine.root_device().membank( "bank2" )->set_base( sst39vfx_get_base(flash2));
206206   // serial port
207207   cybiko_rs232_init(machine);
208208   // other
r14976r14977
217217   nvram_system_load( machine, "rtc", cybiko_pcf8593_load, 0);
218218   // multi-purpose flash
219219   nvram_system_load( machine, "flash2", cybiko_sst39vfx_load, 1);
220   memory_set_bankptr( machine, "bank2", sst39vfx_get_base(flash2));
220   machine.root_device().membank( "bank2" )->set_base( sst39vfx_get_base(flash2));
221221   // ramdisk
222222   nvram_system_load( machine, "ramdisk", cybiko_ramdisk_load, 0);
223223   // serial port
src/mess/machine/pp01.c
r14976r14977
8484static void pp01_set_memory(running_machine &machine,UINT8 block, UINT8 data)
8585{
8686   pp01_state *state = machine.driver_data<pp01_state>();
87   UINT8 *mem = machine.region("maincpu")->base();
87   UINT8 *mem = state->memregion("maincpu")->base();
8888   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
8989   UINT16 startaddr = block*0x1000;
9090   UINT16 endaddr   = ((block+1)*0x1000)-1;
r14976r14977
119119               break;
120120      }
121121
122      memory_set_bankptr(machine, bank, machine.device<ram_device>(RAM_TAG)->pointer() + (data & 0x0F)* 0x1000);
122      state->membank(bank)->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + (data & 0x0F)* 0x1000);
123123   } else if (data>=0xF8) {
124124      space->install_read_bank (startaddr, endaddr, bank);
125125      space->unmap_write(startaddr, endaddr);
126      memory_set_bankptr(machine, bank, mem + ((data & 0x0F)-8)* 0x1000+0x10000);
126      state->membank(bank)->set_base(mem + ((data & 0x0F)-8)* 0x1000+0x10000);
127127   } else {
128128      logerror("%02x %02x\n",block,data);
129129      space->unmap_readwrite (startaddr, endaddr);
src/mess/machine/apple2.c
r14976r14977
124124   }
125125
126126   /* get critical info */
127   rom = machine.region("maincpu")->base();
128   rom_length = machine.region("maincpu")->bytes() & ~0xFFF;
127   rom = machine.root_device().memregion("maincpu")->base();
128   rom_length = machine.root_device().memregion("maincpu")->bytes() & ~0xFFF;
129129
130130   /* loop through the entire memory map */
131131   bank = state->m_mem_config.first_bank;
r14976r14977
226226         /* set the memory bank */
227227         if (rbase)
228228         {
229            memory_set_bankptr(machine, rbank, rbase);
229            state->membank(rbank)->set_base(rbase);
230230         }
231231
232232         /* record the current settings */
r14976r14977
322322         /* set the memory bank */
323323         if (wbase)
324324         {
325            memory_set_bankptr(machine, wbank, wbase);
325            state->membank(wbank)->set_base(wbase);
326326         }
327327
328328         /* record the current settings */
r14976r14977
441441   UINT32 rom_length, slot_length;
442442
443443   // find slot_ram if any
444   rom = machine.region("maincpu")->base();
445   rom_length = machine.region("maincpu")->bytes() & ~0xFFF;
446   slot_length = machine.region("maincpu")->bytes() - rom_length;
444   rom = machine.root_device().memregion("maincpu")->base();
445   rom_length = machine.root_device().memregion("maincpu")->bytes() & ~0xFFF;
446   slot_length = state->memregion("maincpu")->bytes() - rom_length;
447447   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
448448
449449   if (slot_ram)
r14976r14977
492492   UINT32 rom_length, slot_length;
493493
494494   // find slot_ram if any
495   rom = space->machine().region("maincpu")->base();
496   rom_length = space->machine().region("maincpu")->bytes() & ~0xFFF;
497   slot_length = space->machine().region("maincpu")->bytes() - rom_length;
495   rom = space->machine().root_device().memregion("maincpu")->base();
496   rom_length = space->machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
497   slot_length = state->memregion("maincpu")->bytes() - rom_length;
498498   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
499499
500500   slotnum = ((offset>>8) & 0xf) + 1;
r14976r14977
547547   UINT32 rom_length, slot_length;
548548
549549   // find slot_ram if any
550   rom = space->machine().region("maincpu")->base();
551   rom_length = space->machine().region("maincpu")->bytes() & ~0xFFF;
552   slot_length = space->machine().region("maincpu")->bytes() - rom_length;
550   rom = space->machine().root_device().memregion("maincpu")->base();
551   rom_length = space->machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
552   slot_length = state->memregion("maincpu")->bytes() - rom_length;
553553   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
554554
555555   slotnum = 3;
r14976r14977
604604   UINT32 rom_length, slot_length;
605605
606606   // find slot_ram if any
607   rom = space->machine().region("maincpu")->base();
608   rom_length = space->machine().region("maincpu")->bytes() & ~0xFFF;
609   slot_length = space->machine().region("maincpu")->bytes() - rom_length;
607   rom = space->machine().root_device().memregion("maincpu")->base();
608   rom_length = space->machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
609   slot_length = state->memregion("maincpu")->bytes() - rom_length;
610610   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
611611
612612   slotnum = ((offset>>8) & 0xf) + 4;
r14976r14977
16861686   state->m_a2_set = 0;
16871687
16881688   /* disable VAR_ROMSWITCH if the ROM is only 16k */
1689   if (machine.region("maincpu")->bytes() < 0x8000)
1689   if (state->memregion("maincpu")->bytes() < 0x8000)
16901690      state->m_a2_mask &= ~VAR_ROMSWITCH;
16911691
16921692   if (machine.device<ram_device>(RAM_TAG)->size() <= 64*1024)
src/mess/machine/ecb_grip.c
r14976r14977
749749   m_video_ram = auto_alloc_array(machine(), UINT8, VIDEORAM_SIZE);
750750
751751   // setup GRIP memory banking
752   memory_configure_bank(machine(), "videoram", 0, 2, m_video_ram, 0x8000);
753   memory_set_bank(machine(), "videoram", 0);
752   membank("videoram")->configure_entries(0, 2, m_video_ram, 0x8000);
753   membank("videoram")->set_entry(0);
754754
755755   // allocate keyboard scan timer
756756   m_kb_timer = timer_alloc();
r14976r14977
773773    grip_device::machine_start();
774774
775775    // setup ROM banking
776    memory_configure_bank(machine(), "eprom", 0, 2, machine().region(Z80_TAG)->base(), 0x4000);
777    memory_set_bank(*this, "eprom", 0);
776    membank("eprom")->configure_entries(0, 2, memregion(Z80_TAG)->base(), 0x4000);
777    *this.root_device().membank("eprom")->set_entry(0);
778778
779779    // register for state saving
780780    save_item(NAME(m_dpage));
r14976r14977
842842{
843843   m_page = BIT(data, 7);
844844
845   memory_set_bank(machine(), "videoram", m_page);
845   membank("videoram")->set_entry(m_page);
846846}
847847
848848
r14976r14977
956956
957957WRITE8_MEMBER( grip5_state::eprom_w )
958958{
959    memory_set_bank(machine(), "eprom", BIT(data, 0));
959    membank("eprom")->set_entry(BIT(data, 0));
960960}
961961
962962
src/mess/machine/pc1251.c
r14976r14977
9393MACHINE_START( pc1251 )
9494{
9595   device_t *main_cpu = machine.device("maincpu");
96   UINT8 *ram = machine.region("maincpu")->base() + 0x8000;
96   UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x8000;
9797   UINT8 *cpu = sc61860_internal_ram(main_cpu);
9898
9999   machine.device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
r14976r14977
110110{
111111   pc1251_state *state = machine.driver_data<pc1251_state>();
112112   int i;
113   UINT8 *gfx = machine.region("gfx1")->base();
113   UINT8 *gfx = state->memregion("gfx1")->base();
114114   for (i=0; i<128; i++) gfx[i]=i;
115115
116116   state->m_power = 1;
src/mess/machine/comx_eb.c
r14976r14977
254254      m_ef4[slot] = CLEAR_LINE;
255255   }
256256
257   m_rom = subregion("e000")->base();
257   m_rom = memregion("e000")->base();
258258}
259259
260260
src/mess/machine/c64_dela_ep7x8.c
r14976r14977
9898 
9999void c64_dela_ep7x8_cartridge_device::device_start()
100100{
101   m_rom = subregion("rom")->base();
101   m_rom = memregion("rom")->base();
102102 
103103   // state saving
104104   save_item(NAME(m_bank));
src/mess/machine/pk8020.c
r14976r14977
232232{
233233   pk8020_state *state = machine.driver_data<pk8020_state>();
234234   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
235   UINT8 *mem = machine.region("maincpu")->base();
235   UINT8 *mem = state->memregion("maincpu")->base();
236236   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
237237
238238   switch(data & 0x1F) {
r14976r14977
241241                  // ROM
242242                  space->install_read_bank (0x0000, 0x37ff, "bank1");
243243                  space->install_write_bank(0x0000, 0x37ff, "bank2");
244                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
245                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
244                  state->membank("bank1")->set_base(mem + 0x10000);
245                  state->membank("bank2")->set_base(ram + 0x0000);
246246                  // Keyboard
247247                  space->install_read_handler (0x3800, 0x39ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
248248                  space->install_write_bank(0x3800, 0x39ff, "bank3");
249                  memory_set_bankptr(machine, "bank3", ram + 0x3800);
249                  state->membank("bank3")->set_base(ram + 0x3800);
250250                  // System reg
251251                  space->install_read_handler (0x3a00, 0x3aff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
252252                  space->install_write_handler(0x3a00, 0x3aff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
259259                  // RAM
260260                  space->install_read_bank (0x4000, 0xffff, "bank4");
261261                  space->install_write_bank(0x4000, 0xffff, "bank5");
262                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
263                  memory_set_bankptr(machine, "bank5", ram + 0x4000);
262                  state->membank("bank4")->set_base(ram + 0x4000);
263                  state->membank("bank5")->set_base(ram + 0x4000);
264264               }
265265               break;
266266      case 0x01 : {
267267                  // ROM
268268                  space->install_read_bank (0x0000, 0x1fff, "bank1");
269269                  space->install_write_bank(0x0000, 0x1fff, "bank2");
270                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
271                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
270                  state->membank("bank1")->set_base(mem + 0x10000);
271                  state->membank("bank2")->set_base(ram + 0x0000);
272272                  // RAM
273273                  space->install_read_bank (0x2000, 0xffff, "bank3");
274274                  space->install_write_bank(0x2000, 0xffff, "bank4");
275                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
276                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
275                  state->membank("bank3")->set_base(ram + 0x2000);
276                  state->membank("bank4")->set_base(ram + 0x2000);
277277               }
278278               break;
279279      case 0x02 : {
280280                  // ROM
281281                  space->install_read_bank (0x0000, 0x3fff, "bank1");
282282                  space->install_write_bank(0x0000, 0x3fff, "bank2");
283                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
284                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
283                  state->membank("bank1")->set_base(mem + 0x10000);
284                  state->membank("bank2")->set_base(ram + 0x0000);
285285                  // RAM
286286                  space->install_read_bank (0x4000, 0xffff, "bank3");
287287                  space->install_write_bank(0x4000, 0xffff, "bank4");
288                  memory_set_bankptr(machine, "bank3", ram + 0x4000);
289                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
288                  state->membank("bank3")->set_base(ram + 0x4000);
289                  state->membank("bank4")->set_base(ram + 0x4000);
290290               }
291291               break;
292292      case 0x03 : {
293293                  // RAM
294294                  space->install_read_bank (0x0000, 0xffff, "bank1");
295295                  space->install_write_bank(0x0000, 0xffff, "bank2");
296                  memory_set_bankptr(machine, "bank1", ram);
297                  memory_set_bankptr(machine, "bank2", ram);
296                  state->membank("bank1")->set_base(ram);
297                  state->membank("bank2")->set_base(ram);
298298               }
299299               break;
300300      case 0x04 :
r14976r14977
303303                  // ROM
304304                  space->install_read_bank (0x0000, 0x1fff, "bank1");
305305                  space->install_write_bank(0x0000, 0x1fff, "bank2");
306                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
307                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
306                  state->membank("bank1")->set_base(mem + 0x10000);
307                  state->membank("bank2")->set_base(ram + 0x0000);
308308                  // RAM
309309                  space->install_read_bank (0x2000, 0xf7ff, "bank3");
310310                  space->install_write_bank(0x2000, 0xf7ff, "bank4");
311                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
312                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
311                  state->membank("bank3")->set_base(ram + 0x2000);
312                  state->membank("bank4")->set_base(ram + 0x2000);
313313                  // Keyboard
314314                  space->install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
315315                  space->install_write_bank(0xf800, 0xf9ff, "bank5");
316                  memory_set_bankptr(machine, "bank5", ram + 0xf800);
316                  state->membank("bank5")->set_base(ram + 0xf800);
317317                  // System reg
318318                  space->install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
319319                  space->install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
330330                  // ROM
331331                  space->install_read_bank (0x0000, 0x3fff, "bank1");
332332                  space->install_write_bank(0x0000, 0x3fff, "bank2");
333                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
334                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
333                  state->membank("bank1")->set_base(mem + 0x10000);
334                  state->membank("bank2")->set_base(ram + 0x0000);
335335                  // RAM
336336                  space->install_read_bank (0x4000, 0xf7ff, "bank3");
337337                  space->install_write_bank(0x4000, 0xf7ff, "bank4");
338                  memory_set_bankptr(machine, "bank3", ram + 0x4000);
339                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
338                  state->membank("bank3")->set_base(ram + 0x4000);
339                  state->membank("bank4")->set_base(ram + 0x4000);
340340                  // Keyboard
341341                  space->install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
342342                  space->install_write_bank(0xf800, 0xf9ff, "bank5");
343                  memory_set_bankptr(machine, "bank5", ram + 0xf800);
343                  state->membank("bank5")->set_base(ram + 0xf800);
344344                  // System reg
345345                  space->install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
346346                  space->install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
357357                  // RAM
358358                  space->install_read_bank (0x0000, 0xf7ff, "bank1");
359359                  space->install_write_bank(0x0000, 0xf7ff, "bank2");
360                  memory_set_bankptr(machine, "bank1", ram);
361                  memory_set_bankptr(machine, "bank2", ram);
360                  state->membank("bank1")->set_base(ram);
361                  state->membank("bank2")->set_base(ram);
362362                  // Keyboard
363363                  space->install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
364364                  space->install_write_bank(0xf800, 0xf9ff, "bank3");
365                  memory_set_bankptr(machine, "bank3", ram + 0xf800);
365                  state->membank("bank3")->set_base(ram + 0xf800);
366366                  // System reg
367367                  space->install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
368368                  space->install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
379379                  // ROM
380380                  space->install_read_bank (0x0000, 0x3fff, "bank1");
381381                  space->install_write_bank(0x0000, 0x3fff, "bank2");
382                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
383                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
382                  state->membank("bank1")->set_base(mem + 0x10000);
383                  state->membank("bank2")->set_base(ram + 0x0000);
384384                  // Keyboard
385385                  space->install_read_handler (0x3800, 0x39ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
386386                  space->install_write_bank(0x3800, 0x39ff, "bank3");
387                  memory_set_bankptr(machine, "bank3", ram + 0x3800);
387                  state->membank("bank3")->set_base(ram + 0x3800);
388388                  // System reg
389389                  space->install_read_handler (0x3a00, 0x3aff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
390390                  space->install_write_handler(0x3a00, 0x3aff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
397397                  // RAM
398398                  space->install_read_bank (0x4000, 0xbfff, "bank4");
399399                  space->install_write_bank(0x4000, 0xbfff, "bank5");
400                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
401                  memory_set_bankptr(machine, "bank5", ram + 0x4000);
400                  state->membank("bank4")->set_base(ram + 0x4000);
401                  state->membank("bank5")->set_base(ram + 0x4000);
402402                  // Video RAM
403403                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
404404                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
r14976r14977
410410                  // ROM
411411                  space->install_read_bank (0x0000, 0x1fff, "bank1");
412412                  space->install_write_bank(0x0000, 0x1fff, "bank2");
413                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
414                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
413                  state->membank("bank1")->set_base(mem + 0x10000);
414                  state->membank("bank2")->set_base(ram + 0x0000);
415415                  // RAM
416416                  space->install_read_bank (0x2000, 0xbfff, "bank3");
417417                  space->install_write_bank(0x2000, 0xbfff, "bank4");
418                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
419                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
418                  state->membank("bank3")->set_base(ram + 0x2000);
419                  state->membank("bank4")->set_base(ram + 0x2000);
420420                  // Video RAM
421421                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
422422                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
r14976r14977
427427                  // ROM
428428                  space->install_read_bank (0x0000, 0x3fff, "bank1");
429429                  space->install_write_bank(0x0000, 0x3fff, "bank2");
430                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
431                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
430                  state->membank("bank1")->set_base(mem + 0x10000);
431                  state->membank("bank2")->set_base(ram + 0x0000);
432432                  // RAM
433433                  space->install_read_bank (0x4000, 0xbfff, "bank3");
434434                  space->install_write_bank(0x4000, 0xbfff, "bank4");
435                  memory_set_bankptr(machine, "bank3", ram + 0x4000);
436                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
435                  state->membank("bank3")->set_base(ram + 0x4000);
436                  state->membank("bank4")->set_base(ram + 0x4000);
437437                  // Video RAM
438438                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
439439                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
r14976r14977
444444                  // RAM
445445                  space->install_read_bank (0x0000, 0xbfff, "bank1");
446446                  space->install_write_bank(0x0000, 0xbfff, "bank2");
447                  memory_set_bankptr(machine, "bank1", ram + 0x0000);
448                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
447                  state->membank("bank1")->set_base(ram + 0x0000);
448                  state->membank("bank2")->set_base(ram + 0x0000);
449449                  // Video RAM
450450                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
451451                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
r14976r14977
457457                  // ROM
458458                  space->install_read_bank (0x0000, 0x1fff, "bank1");
459459                  space->install_write_bank(0x0000, 0x1fff, "bank2");
460                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
461                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
460                  state->membank("bank1")->set_base(mem + 0x10000);
461                  state->membank("bank2")->set_base(ram + 0x0000);
462462                  // RAM
463463                  space->install_read_bank (0x2000, 0x3fff, "bank3");
464464                  space->install_write_bank(0x2000, 0x3fff, "bank4");
465                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
466                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
465                  state->membank("bank3")->set_base(ram + 0x2000);
466                  state->membank("bank4")->set_base(ram + 0x2000);
467467                  // Video RAM
468468                  space->install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
469469                  space->install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
470470                  // RAM
471471                  space->install_read_bank (0x8000, 0xfdff, "bank5");
472472                  space->install_write_bank(0x8000, 0xfdff, "bank6");
473                  memory_set_bankptr(machine, "bank5", ram + 0x8000);
474                  memory_set_bankptr(machine, "bank6", ram + 0x8000);
473                  state->membank("bank5")->set_base(ram + 0x8000);
474                  state->membank("bank6")->set_base(ram + 0x8000);
475475                  // Devices
476476                  space->install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),state));
477477                  space->install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),state));
r14976r14977
485485                  // ROM
486486                  space->install_read_bank (0x0000, 0x3fff, "bank1");
487487                  space->install_write_bank(0x0000, 0x3fff, "bank2");
488                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
489                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
488                  state->membank("bank1")->set_base(mem + 0x10000);
489                  state->membank("bank2")->set_base(ram + 0x0000);
490490                  // Video RAM
491491                  space->install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
492492                  space->install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
493493                  // RAM
494494                  space->install_read_bank (0x8000, 0xfdff, "bank5");
495495                  space->install_write_bank(0x8000, 0xfdff, "bank6");
496                  memory_set_bankptr(machine, "bank5", ram + 0x8000);
497                  memory_set_bankptr(machine, "bank6", ram + 0x8000);
496                  state->membank("bank5")->set_base(ram + 0x8000);
497                  state->membank("bank6")->set_base(ram + 0x8000);
498498                  // Devices
499499                  space->install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),state));
500500                  space->install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),state));
r14976r14977
508508                  // RAM
509509                  space->install_read_bank (0x0000, 0x3fff, "bank1");
510510                  space->install_write_bank(0x0000, 0x3fff, "bank2");
511                  memory_set_bankptr(machine, "bank1", ram + 0x0000);
512                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
511                  state->membank("bank1")->set_base(ram + 0x0000);
512                  state->membank("bank2")->set_base(ram + 0x0000);
513513                  // Video RAM
514514                  space->install_read_handler (0x4000, 0x7fff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
515515                  space->install_write_handler(0x4000, 0x7fff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
516516                  // RAM
517517                  space->install_read_bank (0x8000, 0xfdff, "bank3");
518518                  space->install_write_bank(0x8000, 0xfdff, "bank4");
519                  memory_set_bankptr(machine, "bank3", ram + 0x8000);
520                  memory_set_bankptr(machine, "bank4", ram + 0x8000);
519                  state->membank("bank3")->set_base(ram + 0x8000);
520                  state->membank("bank4")->set_base(ram + 0x8000);
521521                  // Devices
522522                  space->install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),state));
523523                  space->install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),state));
r14976r14977
531531                  // ROM
532532                  space->install_read_bank (0x0000, 0x5fff, "bank1");
533533                  space->install_write_bank(0x0000, 0x5fff, "bank2");
534                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
535                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
534                  state->membank("bank1")->set_base(mem + 0x10000);
535                  state->membank("bank2")->set_base(ram + 0x0000);
536536                  // RAM
537537                  space->install_read_bank (0x6000, 0xf7ff, "bank3");
538538                  space->install_write_bank(0x6000, 0xf7ff, "bank4");
539                  memory_set_bankptr(machine, "bank3", ram + 0x6000);
540                  memory_set_bankptr(machine, "bank4", ram + 0x6000);
539                  state->membank("bank3")->set_base(ram + 0x6000);
540                  state->membank("bank4")->set_base(ram + 0x6000);
541541                  // Keyboard
542542                  space->install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
543543                  space->install_write_bank(0xf800, 0xf9ff, "bank5");
544                  memory_set_bankptr(machine, "bank5", ram + 0xf800);
544                  state->membank("bank5")->set_base(ram + 0xf800);
545545                  // System reg
546546                  space->install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
547547                  space->install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
558558                  // ROM
559559                  space->install_read_bank (0x0000, 0x1fff, "bank1");
560560                  space->install_write_bank(0x0000, 0x1fff, "bank2");
561                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
562                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
561                  state->membank("bank1")->set_base(mem + 0x10000);
562                  state->membank("bank2")->set_base(ram + 0x0000);
563563                  // RAM
564564                  space->install_read_bank (0x2000, 0xf7ff, "bank3");
565565                  space->install_write_bank(0x2000, 0xf7ff, "bank4");
566                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
567                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
566                  state->membank("bank3")->set_base(ram + 0x2000);
567                  state->membank("bank4")->set_base(ram + 0x2000);
568568                  // Keyboard
569569                  space->install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
570570                  space->install_write_bank(0xf800, 0xf9ff, "bank5");
571                  memory_set_bankptr(machine, "bank5", ram + 0xf800);
571                  state->membank("bank5")->set_base(ram + 0xf800);
572572                  // System reg
573573                  space->install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
574574                  space->install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
585585                  // ROM
586586                  space->install_read_bank (0x0000, 0x3fff, "bank1");
587587                  space->install_write_bank(0x0000, 0x3fff, "bank2");
588                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
589                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
588                  state->membank("bank1")->set_base(mem + 0x10000);
589                  state->membank("bank2")->set_base(ram + 0x0000);
590590                  // RAM
591591                  space->install_read_bank (0x4000, 0xf7ff, "bank3");
592592                  space->install_write_bank(0x4000, 0xf7ff, "bank4");
593                  memory_set_bankptr(machine, "bank3", ram + 0x4000);
594                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
593                  state->membank("bank3")->set_base(ram + 0x4000);
594                  state->membank("bank4")->set_base(ram + 0x4000);
595595                  // Keyboard
596596                  space->install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
597597                  space->install_write_bank(0xf800, 0xf9ff, "bank5");
598                  memory_set_bankptr(machine, "bank5", ram + 0xf800);
598                  state->membank("bank5")->set_base(ram + 0xf800);
599599                  // System reg
600600                  space->install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
601601                  space->install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
612612                  // RAM
613613                  space->install_read_bank (0x0000, 0xf7ff, "bank1");
614614                  space->install_write_bank(0x0000, 0xf7ff, "bank2");
615                  memory_set_bankptr(machine, "bank1", ram + 0x0000);
616                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
615                  state->membank("bank1")->set_base(ram + 0x0000);
616                  state->membank("bank2")->set_base(ram + 0x0000);
617617                  // Keyboard
618618                  space->install_read_handler (0xf800, 0xf9ff, read8_delegate(FUNC(pk8020_state::keyboard_r),state));
619619                  space->install_write_bank(0xf800, 0xf9ff, "bank3");
620                  memory_set_bankptr(machine, "bank3", ram + 0xf800);
620                  state->membank("bank3")->set_base(ram + 0xf800);
621621                  // System reg
622622                  space->install_read_handler (0xfa00, 0xfaff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
623623                  space->install_write_handler(0xfa00, 0xfaff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
634634                  // ROM
635635                  space->install_read_bank (0x0000, 0x5fff, "bank1");
636636                  space->install_write_bank(0x0000, 0x5fff, "bank2");
637                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
638                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
637                  state->membank("bank1")->set_base(mem + 0x10000);
638                  state->membank("bank2")->set_base(ram + 0x0000);
639639                  // RAM
640640                  space->install_read_bank (0x6000, 0xfdff, "bank3");
641641                  space->install_write_bank(0x6000, 0xfdff, "bank4");
642                  memory_set_bankptr(machine, "bank3", ram + 0x6000);
643                  memory_set_bankptr(machine, "bank4", ram + 0x6000);
642                  state->membank("bank3")->set_base(ram + 0x6000);
643                  state->membank("bank4")->set_base(ram + 0x6000);
644644                  // Devices
645645                  space->install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),state));
646646                  space->install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),state));
r14976r14977
654654                  // ROM
655655                  space->install_read_bank (0x0000, 0x1fff, "bank1");
656656                  space->install_write_bank(0x0000, 0x1fff, "bank2");
657                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
658                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
657                  state->membank("bank1")->set_base(mem + 0x10000);
658                  state->membank("bank2")->set_base(ram + 0x0000);
659659                  // RAM
660660                  space->install_read_bank (0x2000, 0xfdff, "bank3");
661661                  space->install_write_bank(0x2000, 0xfdff, "bank4");
662                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
663                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
662                  state->membank("bank3")->set_base(ram + 0x2000);
663                  state->membank("bank4")->set_base(ram + 0x2000);
664664                  // Devices
665665                  space->install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),state));
666666                  space->install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),state));
r14976r14977
674674                  // ROM
675675                  space->install_read_bank (0x0000, 0x3fff, "bank1");
676676                  space->install_write_bank(0x0000, 0x3fff, "bank2");
677                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
678                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
677                  state->membank("bank1")->set_base(mem + 0x10000);
678                  state->membank("bank2")->set_base(ram + 0x0000);
679679                  // RAM
680680                  space->install_read_bank (0x4000, 0xfdff, "bank3");
681681                  space->install_write_bank(0x4000, 0xfdff, "bank4");
682                  memory_set_bankptr(machine, "bank3", ram + 0x4000);
683                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
682                  state->membank("bank3")->set_base(ram + 0x4000);
683                  state->membank("bank4")->set_base(ram + 0x4000);
684684                  // Devices
685685                  space->install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),state));
686686                  space->install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),state));
r14976r14977
694694                  // RAM
695695                  space->install_read_bank (0x0000, 0xfdff, "bank1");
696696                  space->install_write_bank(0x0000, 0xfdff, "bank2");
697                  memory_set_bankptr(machine, "bank1", ram);
698                  memory_set_bankptr(machine, "bank2", ram);
697                  state->membank("bank1")->set_base(ram);
698                  state->membank("bank2")->set_base(ram);
699699                  // Devices
700700                  space->install_read_handler (0xfe00, 0xfeff, read8_delegate(FUNC(pk8020_state::devices_r),state));
701701                  space->install_write_handler(0xfe00, 0xfeff, write8_delegate(FUNC(pk8020_state::devices_w),state));
r14976r14977
709709                  // ROM
710710                  space->install_read_bank (0x0000, 0x5fff, "bank1");
711711                  space->install_write_bank(0x0000, 0x5fff, "bank2");
712                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
713                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
712                  state->membank("bank1")->set_base(mem + 0x10000);
713                  state->membank("bank2")->set_base(ram + 0x0000);
714714                  // RAM
715715                  space->install_read_bank (0x6000, 0xbeff, "bank3");
716716                  space->install_write_bank(0x6000, 0xbeff, "bank4");
717                  memory_set_bankptr(machine, "bank3", ram + 0x6000);
718                  memory_set_bankptr(machine, "bank4", ram + 0x6000);
717                  state->membank("bank3")->set_base(ram + 0x6000);
718                  state->membank("bank4")->set_base(ram + 0x6000);
719719                  // System reg
720720                  space->install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
721721                  space->install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
729729                  // ROM
730730                  space->install_read_bank (0x0000, 0x1fff, "bank1");
731731                  space->install_write_bank(0x0000, 0x1fff, "bank2");
732                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
733                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
732                  state->membank("bank1")->set_base(mem + 0x10000);
733                  state->membank("bank2")->set_base(ram + 0x0000);
734734                  // RAM
735735                  space->install_read_bank (0x2000, 0xbeff, "bank3");
736736                  space->install_write_bank(0x2000, 0xbeff, "bank4");
737                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
738                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
737                  state->membank("bank3")->set_base(ram + 0x2000);
738                  state->membank("bank4")->set_base(ram + 0x2000);
739739                  // System reg
740740                  space->install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
741741                  space->install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
749749                  // ROM
750750                  space->install_read_bank (0x0000, 0x3fff, "bank1");
751751                  space->install_write_bank(0x0000, 0x3fff, "bank2");
752                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
753                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
752                  state->membank("bank1")->set_base(mem + 0x10000);
753                  state->membank("bank2")->set_base(ram + 0x0000);
754754                  // RAM
755755                  space->install_read_bank (0x4000, 0xbeff, "bank3");
756756                  space->install_write_bank(0x4000, 0xbeff, "bank4");
757                  memory_set_bankptr(machine, "bank3", ram + 0x4000);
758                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
757                  state->membank("bank3")->set_base(ram + 0x4000);
758                  state->membank("bank4")->set_base(ram + 0x4000);
759759                  // System reg
760760                  space->install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
761761                  space->install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
769769                  // RAM
770770                  space->install_read_bank (0x0000, 0xbeff, "bank1");
771771                  space->install_write_bank(0x0000, 0xbeff, "bank2");
772                  memory_set_bankptr(machine, "bank1", ram);
773                  memory_set_bankptr(machine, "bank2", ram);
772                  state->membank("bank1")->set_base(ram);
773                  state->membank("bank2")->set_base(ram);
774774                  // System reg
775775                  space->install_read_handler (0xbf00, 0xbfff, read8_delegate(FUNC(pk8020_state::sysreg_r),state));
776776                  space->install_write_handler(0xbf00, 0xbfff, write8_delegate(FUNC(pk8020_state::sysreg_w),state));
r14976r14977
784784                  // ROM
785785                  space->install_read_bank (0x0000, 0x5fff, "bank1");
786786                  space->install_write_bank(0x0000, 0x5fff, "bank2");
787                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
788                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
787                  state->membank("bank1")->set_base(mem + 0x10000);
788                  state->membank("bank2")->set_base(ram + 0x0000);
789789                  // RAM
790790                  space->install_read_bank (0x6000, 0xbfff, "bank3");
791791                  space->install_write_bank(0x6000, 0xbfff, "bank4");
792                  memory_set_bankptr(machine, "bank3", ram + 0x6000);
793                  memory_set_bankptr(machine, "bank4", ram + 0x6000);
792                  state->membank("bank3")->set_base(ram + 0x6000);
793                  state->membank("bank4")->set_base(ram + 0x6000);
794794                  // Video RAM
795795                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
796796                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
r14976r14977
801801                  // ROM
802802                  space->install_read_bank (0x0000, 0x1fff, "bank1");
803803                  space->install_write_bank(0x0000, 0x1fff, "bank2");
804                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
805                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
804                  state->membank("bank1")->set_base(mem + 0x10000);
805                  state->membank("bank2")->set_base(ram + 0x0000);
806806                  // RAM
807807                  space->install_read_bank (0x2000, 0xbfff, "bank3");
808808                  space->install_write_bank(0x2000, 0xbfff, "bank4");
809                  memory_set_bankptr(machine, "bank3", ram + 0x2000);
810                  memory_set_bankptr(machine, "bank4", ram + 0x2000);
809                  state->membank("bank3")->set_base(ram + 0x2000);
810                  state->membank("bank4")->set_base(ram + 0x2000);
811811                  // Video RAM
812812                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
813813                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
r14976r14977
818818                  // ROM
819819                  space->install_read_bank (0x0000, 0x3fff, "bank1");
820820                  space->install_write_bank(0x0000, 0x3fff, "bank2");
821                  memory_set_bankptr(machine, "bank1", mem + 0x10000);
822                  memory_set_bankptr(machine, "bank2", ram + 0x0000);
821                  state->membank("bank1")->set_base(mem + 0x10000);
822                  state->membank("bank2")->set_base(ram + 0x0000);
823823                  // RAM
824824                  space->install_read_bank (0x4000, 0xbfff, "bank3");
825825                  space->install_write_bank(0x4000, 0xbfff, "bank4");
826                  memory_set_bankptr(machine, "bank3", ram + 0x4000);
827                  memory_set_bankptr(machine, "bank4", ram + 0x4000);
826                  state->membank("bank3")->set_base(ram + 0x4000);
827                  state->membank("bank4")->set_base(ram + 0x4000);
828828                  // Video RAM
829829                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
830830                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
r14976r14977
835835                  // RAM
836836                  space->install_read_bank (0x0000, 0xbfff, "bank1");
837837                  space->install_write_bank(0x0000, 0xbfff, "bank2");
838                  memory_set_bankptr(machine, "bank1", ram);
839                  memory_set_bankptr(machine, "bank2", ram);
838                  state->membank("bank1")->set_base(ram);
839                  state->membank("bank2")->set_base(ram);
840840                  // Video RAM
841841                  space->install_read_handler (0xc000, 0xffff, read8_delegate(FUNC(pk8020_state::gzu_r),state));
842842                  space->install_write_handler(0xc000, 0xffff, write8_delegate(FUNC(pk8020_state::gzu_w),state));
src/mess/machine/kc.c
r14976r14977
299299
300300      /* yes; set address of bank */
301301      space->install_read_bank(0x0000, 0x3fff, "bank1");
302      memory_set_bankptr(machine(), "bank1", m_ram_base);
302      membank("bank1")->set_base(m_ram_base);
303303
304304      /* write protect ram? */
305305      if ((m_pio_data[0] & (1<<3)) == 0)
r14976r14977
345345{
346346   address_space *space = m_maincpu->memory().space( AS_PROGRAM );
347347
348   if ((m_pio_data[0] & (1<<7)) && machine().region("basic")->base() != NULL)
348   if ((m_pio_data[0] & (1<<7)) && memregion("basic")->base() != NULL)
349349   {
350350      /* BASIC takes next priority */
351351           LOG(("BASIC rom 0x0c000\n"));
352352
353        memory_set_bankptr(machine(), "bank4", machine().region("basic")->base());
353        membank("bank4")->set_base(machine().root_device().memregion("basic")->base());
354354      space->install_read_bank(0xc000, 0xdfff, "bank4");
355355      space->unmap_write(0xc000, 0xdfff);
356356   }
r14976r14977
373373      /* enable CAOS rom in memory range 0x0e000-0x0ffff */
374374      LOG(("CAOS rom 0x0e000\n"));
375375      /* read will access the rom */
376      memory_set_bankptr(machine(), "bank5", machine().region("caos")->base() + 0x2000);
376      membank("bank5")->set_base(machine().root_device().memregion("caos")->base() + 0x2000);
377377      space->install_read_bank(0xe000, 0xffff, "bank5");
378378      space->unmap_write(0xe000, 0xffff);
379379   }
r14976r14977
397397        /* IRM enabled */
398398        LOG(("IRM enabled\n"));
399399
400      memory_set_bankptr(machine(), "bank3", m_ram_base + 0x4000);
400      membank("bank3")->set_base(m_ram_base + 0x4000);
401401      space->install_readwrite_bank(0x8000, 0xbfff, "bank3");
402402    }
403403    else
r14976r14977
423423      /* yes */
424424      space->install_read_bank(0x4000, 0x7fff, "bank2");
425425      /* set address of bank */
426      memory_set_bankptr(machine(), "bank2", m_ram_base + 0x4000);
426      membank("bank2")->set_base(m_ram_base + 0x4000);
427427
428428      /* write protect ram? */
429429      if ((m_port_86_data & (1<<1)) == 0)
r14976r14977
462462      /* CAOS rom takes priority */
463463      LOG(("CAOS rom 0x0c000\n"));
464464
465      memory_set_bankptr(machine(), "bank4", machine().region("caos")->base());
465      membank("bank4")->set_base(machine().root_device().memregion("caos")->base());
466466      space->install_read_bank(0xc000, 0xdfff, "bank4");
467467      space->unmap_write(0xc000, 0xdfff);
468468   }
r14976r14977
473473         /* BASIC takes next priority */
474474         LOG(("BASIC rom 0x0c000\n"));
475475
476         int bank = machine().region("basic")->bytes() == 0x8000 ? (m_port_86_data>>5) & 0x03 : 0;
476         int bank = memregion("basic")->bytes() == 0x8000 ? (m_port_86_data>>5) & 0x03 : 0;
477477
478         memory_set_bankptr(machine(), "bank4", machine().region("basic")->base() + (bank << 13));
478         membank("bank4")->set_base(machine().root_device().memregion("basic")->base() + (bank << 13));
479479         space->install_read_bank(0xc000, 0xdfff, "bank4");
480480         space->unmap_write(0xc000, 0xdfff);
481481      }
r14976r14977
500500
501501      UINT8* ram_page = (UINT8*)kc85_4_get_video_ram_base(machine(), (m_port_84_data & 0x04), (m_port_84_data & 0x02));
502502
503      memory_set_bankptr(machine(), "bank3", ram_page);
503      membank("bank3")->set_base(ram_page);
504504      space->install_readwrite_bank(0x8000, 0xa7ff, "bank3");
505505
506506      ram_page = (UINT8*)kc85_4_get_video_ram_base(machine(), 0, 0);
507507
508      memory_set_bankptr(machine(), "bank6", ram_page + 0x2800);
508      membank("bank6")->set_base(ram_page + 0x2800);
509509      space->install_readwrite_bank(0xa800, 0xbfff, "bank6");
510510   }
511511    else if (m_pio_data[1] & (1<<5))
r14976r14977
530530         mem_ptr = m_ram_base + (ram8_block<<14);
531531      }
532532
533      memory_set_bankptr(machine(), "bank3", mem_ptr);
534      memory_set_bankptr(machine(), "bank6", mem_ptr + 0x2800);
533      membank("bank3")->set_base(mem_ptr);
534      membank("bank6")->set_base(mem_ptr + 0x2800);
535535      space->install_read_bank(0x8000, 0xa7ff, "bank3");
536536      space->install_read_bank(0xa800, 0xbfff, "bank6");
537537
src/mess/video/zx.c
r14976r14977
128128   zx_state *state = machine.driver_data<zx_state>();
129129   screen_device *screen = machine.first_screen();
130130   int offs0 = offs & 0x7fff;
131   UINT8 *rom = machine.region("maincpu")->base();
131   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
132132   UINT8 chr = rom[offs0];
133133
134134   if ((!state->m_ula_irq_active) && (chr == 0x76))
r14976r14977
143143      else
144144         creg = cpu_get_reg(machine.device("maincpu"), Z80_C);
145145
146      chrgen = machine.region(region)->base();
146      chrgen = state->memregion(region)->base();
147147
148148      if ((++state->m_ula_scanline_count == screen->height()) || (creg == 32))
149149      {
src/mess/video/dgn_beta.c
r14976r14977
105105   int i;
106106   if(IsTextMode)
107107   {
108      UINT8 *chr_gen = device->machine().region("gfx1")->base();
108      UINT8 *chr_gen = state->memregion("gfx1")->base();
109109      for ( i = 0; i < x_count; i++ )
110110      {
111111         UINT32 offset = ( ( ma + i ) | ((state->m_GCtrl & GCtrlAddrLines)<<8)) << 1;
src/mess/video/911_vdt.c
r14976r14977
178178void vdt911_init(running_machine &machine)
179179{
180180   UINT8 *base;
181   UINT8 *chr = machine.region(vdt911_chr_region)->base();
181   UINT8 *chr = machine.root_device().memregion(vdt911_chr_region)->base();
182182
183183   /* set up US character definitions */
184184   base = chr+vdt911_US_chr_offset;
src/mess/video/dai.c
r14976r14977
6161   address_space *space = screen.machine().device("maincpu")->memory().space(AS_PROGRAM);
6262   int i, j, k, l;
6363
64   UINT8* char_rom = screen.machine().region("gfx1")->base();
64   UINT8* char_rom = state->memregion("gfx1")->base();
6565
6666   UINT16 dai_video_memory_start = 0xbfff;
6767   UINT16 dai_scan_lines = 604;   /* scan lines of PAL tv */
src/mess/video/isa_mda.c
r14976r14977
197197   m_pixel = 0;
198198
199199   astring tempstring;
200   m_chr_gen = machine().region(subtag(tempstring, "gfx1"))->base();
200   m_chr_gen = memregion(subtag(tempstring, "gfx1"))->base();
201201}
202202
203203/***************************************************************************
r14976r14977
598598   m_configuration_switch = 0;
599599
600600   astring tempstring;
601   m_chr_gen = machine().region(subtag(tempstring, "gfx1"))->base();
601   m_chr_gen = memregion(subtag(tempstring, "gfx1"))->base();
602602}
603603
604604/***************************************************************************
src/mess/video/rm380z.c
r14976r14977
382382
383383void rm380z_state::update_screen(bitmap_ind16 &bitmap)
384384{
385   unsigned char* pChar=machine().region("chargen")->base();
385   unsigned char* pChar=machine().root_device().memregion("chargen")->base();
386386
387387   int lineWidth=0x80;
388388   int ncols=80;
src/mess/video/cbmb.c
r14976r14977
1616
1717void cbm600_vh_init(running_machine &machine)
1818{
19   UINT8 *gfx = machine.region("gfx1")->base();
19   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
2020   int i;
2121
2222   /* inversion logic on board */
r14976r14977
2929
3030void cbm700_vh_init(running_machine &machine)
3131{
32   UINT8 *gfx = machine.region("gfx1")->base();
32   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
3333   int i;
3434   for (i=0; i<0x800; i++) {
3535      gfx[0x1000+i]=gfx[0x800+i];
src/mess/video/mc80.c
r14976r14977
140140VIDEO_START( mc8030 )
141141{
142142   mc80_state *state = machine.driver_data<mc80_state>();
143   state->m_p_videoram.set_target(machine.region("vram")->base(),state->m_p_videoram.bytes());
143   state->m_p_videoram.set_target(state->memregion("vram")->base(),state->m_p_videoram.bytes());
144144}
145145
146146SCREEN_UPDATE_IND16( mc8030 )
src/mess/video/mbee.c
r14976r14977
152152    d3..d0 select state->m_videoram bank */
153153
154154   m_1c = data;
155   memory_set_bank(machine(), "basic", BIT(data, 5));
155   membank("basic")->set_entry(BIT(data, 5));
156156}
157157
158158WRITE8_MEMBER( mbee_state::mbee256_1c_w )
r14976r14977
333333   case 12:
334334      data &= 0x3f; // select alternate character set
335335      if( m_sy6545_reg[12] != data )
336         memcpy(m_p_gfxram, machine().region("gfx")->base() + (((data & 0x30) == 0x20) << 11), 0x800);
336         memcpy(m_p_gfxram, memregion("gfx")->base() + (((data & 0x30) == 0x20) << 11), 0x800);
337337      break;
338338   case 31:
339339                /* This firstly pushes the contents of the transparent registers onto the MA lines,
r14976r14977
362362VIDEO_START( mbee )
363363{
364364   mbee_state *state = machine.driver_data<mbee_state>();
365   state->m_p_videoram = machine.region("videoram")->base();
366   state->m_p_gfxram = machine.region("gfx")->base()+0x1000;
365   state->m_p_videoram = machine.root_device().memregion("videoram")->base();
366   state->m_p_gfxram = state->memregion("gfx")->base()+0x1000;
367367   state->m_is_premium = 0;
368368}
369369
370370VIDEO_START( mbeeic )
371371{
372372   mbee_state *state = machine.driver_data<mbee_state>();
373   state->m_p_videoram = machine.region("videoram")->base();
374   state->m_p_colorram = machine.region("colorram")->base();
375   state->m_p_gfxram = machine.region("gfx")->base()+0x1000;
373   state->m_p_videoram = machine.root_device().memregion("videoram")->base();
374   state->m_p_colorram = machine.root_device().memregion("colorram")->base();
375   state->m_p_gfxram = state->memregion("gfx")->base()+0x1000;
376376   state->m_is_premium = 0;
377377}
378378
379379VIDEO_START( mbeeppc )
380380{
381381   mbee_state *state = machine.driver_data<mbee_state>();
382   state->m_p_videoram = machine.region("videoram")->base();
383   state->m_p_colorram = machine.region("colorram")->base();
384   state->m_p_gfxram = machine.region("gfx")->base()+0x1000;
385   state->m_p_attribram = machine.region("attrib")->base();
382   state->m_p_videoram = machine.root_device().memregion("videoram")->base();
383   state->m_p_colorram = machine.root_device().memregion("colorram")->base();
384   state->m_p_gfxram = machine.root_device().memregion("gfx")->base()+0x1000;
385   state->m_p_attribram = state->memregion("attrib")->base();
386386   state->m_is_premium = 1;
387387}
388388
r14976r14977
556556
557557PALETTE_INIT( mbeeic )
558558{
559   const UINT8 *color_prom = machine.region("proms")->base();
559   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
560560   UINT16 i;
561561   UINT8 r, b, g, k;
562562   UINT8 level[] = { 0, 0x80, 0xff, 0xff };   /* off, half, full intensity */
r14976r14977
584584
585585PALETTE_INIT( mbeepc85b )
586586{
587   const UINT8 *color_prom = machine.region("proms")->base();
587   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
588588   UINT16 i;
589589   UINT8 r, b, g, k;
590590   UINT8 level[] = { 0, 0x80, 0x80, 0xff };   /* off, half, full intensity */
src/mess/video/pc1512.c
r14976r14977
561561void pc1512_state::video_start()
562562{
563563   // find memory regions
564   m_char_rom = machine().region(AMS40041_TAG)->base();
564   m_char_rom = memregion(AMS40041_TAG)->base();
565565
566566   // allocate memory
567567   m_video_ram = auto_alloc_array(machine(), UINT8, 0x10000);
src/mess/video/isa_cga.c
r14976r14977
732732   }
733733
734734   astring tempstring;
735   m_chr_gen_base = machine().region(subtag(tempstring, "gfx1"))->base();
735   m_chr_gen_base = memregion(subtag(tempstring, "gfx1"))->base();
736736   m_chr_gen = m_chr_gen_base + m_chr_gen_offset[1];
737737}
738738
r14976r14977
18581858      }
18591859      else
18601860      {
1861         memory_set_bankptr(machine(),"bank1", m_vram + isa8_cga_pc1512_device::vram_offset[0]);
1861         membank("bank1")->set_base(m_vram + isa8_cga_pc1512_device::vram_offset[0]);
18621862      }
18631863      m_mode_control = data;
18641864      switch( m_mode_control & 0x3F )
r14976r14977
19161916      m_read = data;
19171917      if ( ( m_mode_control & 0x12 ) == 0x12 )
19181918      {
1919         memory_set_bankptr(machine(),"bank1", m_vram + isa8_cga_pc1512_device::vram_offset[data & 3]);
1919         membank("bank1")->set_base(m_vram + isa8_cga_pc1512_device::vram_offset[data & 3]);
19201920      }
19211921      break;
19221922
r14976r14977
20312031      m_mc6845_locked_register[i] = 0;
20322032   }
20332033
2034   memory_set_bankptr(machine(), "bank1", m_vram + isa8_cga_pc1512_device::vram_offset[0]);
2034   membank("bank1")->set_base(m_vram + isa8_cga_pc1512_device::vram_offset[0]);
20352035}
20362036
src/mess/video/isa_ega.c
r14976r14977
598598      palette_set_color_rgb( machine(), i, r, g, b );
599599   }
600600   astring tempstring;
601   UINT8   *dst = machine().region(subtag(tempstring, "user2" ))->base() + 0x0000;
602   UINT8   *src = machine().region(subtag(tempstring, "user1" ))->base() + 0x3fff;
601   UINT8   *dst = memregion(subtag(tempstring, "user2" ))->base() + 0x0000;
602   UINT8   *src = memregion(subtag(tempstring, "user1" ))->base() + 0x3fff;
603603   int      i;
604604
605605   /* Perform the EGA bios address line swaps */
src/mess/video/gb.c
r14976r14977
12351235   if (mode == GB_VIDEO_CGB) vram_size = 0x4000;
12361236
12371237   /* free regions if already allocated */
1238   if (machine.region("gfx1")->base())      machine.region_free(":gfx1");
1239   if (machine.region("gfx2")->base())      machine.region_free(":gfx2");
1238   if (state->memregion("gfx1")->base())      machine.memory().region_free(":gfx1");
1239   if (state->memregion("gfx2")->base())      machine.memory().region_free(":gfx2");
12401240
1241   state->m_lcd.gb_vram = machine.region_alloc(":gfx1", vram_size, 1, ENDIANNESS_LITTLE );
1242   state->m_lcd.gb_oam = machine.region_alloc(":gfx2", 0x100, 1, ENDIANNESS_LITTLE );
1241   state->m_lcd.gb_vram = machine.memory().region_alloc(":gfx1", vram_size, 1, ENDIANNESS_LITTLE );
1242   state->m_lcd.gb_oam = machine.memory().region_alloc(":gfx2", 0x100, 1, ENDIANNESS_LITTLE );
12431243   memset( state->m_lcd.gb_vram->base(), 0, vram_size );
12441244
12451245   state->m_lcd.gb_vram_ptr = state->m_lcd.gb_vram->base();
src/mess/video/iq151_video64.c
r14976r14977
6060
6161void iq151_video64_device::device_start()
6262{
63   m_videoram = (UINT8*)subregion("videoram")->base();
64   m_chargen = (UINT8*)subregion("chargen")->base();
63   m_videoram = (UINT8*)memregion("videoram")->base();
64   m_chargen = (UINT8*)memregion("chargen")->base();
6565
6666   machine().gfx[0] = gfx_element_alloc(machine(), &iq151_video64_charlayout, m_chargen, 1, 0);
6767}
src/mess/video/tmc600.c
r14976r14977
115115   m_color_ram = auto_alloc_array(machine(), UINT8, TMC600_PAGE_RAM_SIZE);
116116
117117   // find memory regions
118   m_char_rom = machine().region("chargen")->base();
118   m_char_rom = memregion("chargen")->base();
119119
120120   // register for state saving
121121   save_pointer(NAME(m_color_ram), TMC600_PAGE_RAM_SIZE);
src/mess/video/radio86.c
r14976r14977
2727   radio86_state *state = device->machine().driver_data<radio86_state>();
2828   int i;
2929   bitmap_ind16 &bitmap = state->m_bitmap;
30   UINT8 *charmap = device->machine().region("gfx1")->base();
30   UINT8 *charmap = state->memregion("gfx1")->base();
3131   UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
3232   if (vsp) {
3333      pixels = 0;
r14976r14977
4949   radio86_state *state = device->machine().driver_data<radio86_state>();
5050   int i;
5151   bitmap_ind16 &bitmap = state->m_bitmap;
52   UINT8 *charmap = device->machine().region("gfx1")->base() + (state->m_mikrosha_font_page & 1) * 0x400;
52   UINT8 *charmap = state->memregion("gfx1")->base() + (state->m_mikrosha_font_page & 1) * 0x400;
5353   UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
5454   if (vsp) {
5555      pixels = 0;
r14976r14977
7070   radio86_state *state = device->machine().driver_data<radio86_state>();
7171   int i;
7272   bitmap_ind16 &bitmap = state->m_bitmap;
73   UINT8 *charmap = device->machine().region("gfx1")->base() + (gpa & 1) * 0x400;
73   UINT8 *charmap = state->memregion("gfx1")->base() + (gpa & 1) * 0x400;
7474   UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
7575   if (vsp) {
7676      pixels = 0;
r14976r14977
9191   radio86_state *state = device->machine().driver_data<radio86_state>();
9292   int i;
9393   bitmap_ind16 &bitmap = state->m_bitmap;
94   UINT8 *charmap = device->machine().region("gfx1")->base() + 0x400 * (gpa * 2 + hlgt);
94   UINT8 *charmap = state->memregion("gfx1")->base() + 0x400 * (gpa * 2 + hlgt);
9595   UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
9696   if (vsp) {
9797      pixels = 0;
src/mess/video/abc800.c
r14976r14977
9292void abc800_state::video_start()
9393{
9494   // find memory regions
95   m_char_rom = machine().region(MC6845_TAG)->base();
96   m_fgctl_prom = machine().region("hru2")->base();
95   m_char_rom = memregion(MC6845_TAG)->base();
96   m_fgctl_prom = memregion("hru2")->base();
9797
9898   // register for state saving
9999   save_item(NAME(m_hrs));
src/mess/video/thomson.c
r14976r14977
870870{
871871   assert( point >= 0 && point <= 1 );
872872   thom_mode_point = ( ! point ) * 0x2000;
873   memory_set_bank( machine, THOM_VRAM_BANK, ! point );
873   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( ! point );
874874}
875875
876876
r14976r14977
11491149
11501150   thom_mode_point = 0;
11511151   state_save_register_global(machine,  thom_mode_point );
1152   memory_set_bank( machine, THOM_VRAM_BANK, 0 );
1152   machine.root_device().membank( THOM_VRAM_BANK )->set_entry( 0 );
11531153
11541154   thom_floppy_rcount = 0;
11551155   thom_floppy_wcount = 0;
src/mess/video/abc80.c
r14976r14977
204204   m_video_ram = auto_alloc_array(machine(), UINT8, 0x400);
205205
206206   // find memory regions
207   m_char_rom = machine().region("chargen")->base();
208   m_hsync_prom = machine().region("hsync")->base();
209   m_vsync_prom = machine().region("vsync")->base();
210   m_line_prom = machine().region("line")->base();
211   m_attr_prom = machine().region("attr")->base();
207   m_char_rom = memregion("chargen")->base();
208   m_hsync_prom = memregion("hsync")->base();
209   m_vsync_prom = memregion("vsync")->base();
210   m_line_prom = memregion("line")->base();
211   m_attr_prom = memregion("attr")->base();
212212
213213   // register for state saving
214214   save_item(NAME(m_blink));
src/mess/video/x68k.c
r14976r14977
10881088         break;
10891089
10901090   /* create the char set (gfx will then be updated dynamically from RAM) */
1091   machine.gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_8, machine.region("user1")->base(), 32, 0);
1091   machine.gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_8, machine.root_device().memregion("user1")->base(), 32, 0);
10921092
10931093   gfx_index++;
10941094
1095   machine.gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_16, machine.region("user1")->base(), 32, 0);
1095   machine.gfx[gfx_index] = gfx_element_alloc(machine, &x68k_pcg_16, state->memregion("user1")->base(), 32, 0);
10961096   machine.gfx[gfx_index]->total_colors = 32;
10971097
10981098   /* Tilemaps */
r14976r14977
11501150      rect.max_y = cliprect.max_y;
11511151
11521152   // update tiles
1153   //rom = screen.machine().region("user1")->base();
1153   //rom = screen.machine().root_device().memregion("user1")->base();
11541154   for(x=0;x<256;x++)
11551155   {
11561156      if(state->m_video.tile16_dirty[x] != 0)
src/mess/video/kaypro.c
r14976r14977
316316VIDEO_START( kaypro )
317317{
318318   kaypro_state *state = machine.driver_data<kaypro_state>();
319   state->m_p_chargen = machine.region("chargen")->base();
319   state->m_p_chargen = state->memregion("chargen")->base();
320320}
src/mess/video/super80.c
r14976r14977
9595   super80_state *state = screen.machine().driver_data<super80_state>();
9696   UINT8 y,ra,chr=32,gfx,screen_on=0;
9797   UINT16 sy=0,ma=state->m_vidpg,x;
98   UINT8 *RAM = screen.machine().region("maincpu")->base();
98   UINT8 *RAM = state->memregion("maincpu")->base();
9999
100100   output_set_value("cass_led",(state->m_shared & 0x20) ? 1 : 0);
101101
r14976r14977
137137   super80_state *state = screen.machine().driver_data<super80_state>();
138138   UINT8 y,ra,chr=32,gfx,screen_on=0;
139139   UINT16 sy=0,ma=state->m_vidpg,x;
140   UINT8 *RAM = screen.machine().region("maincpu")->base();
140   UINT8 *RAM = state->memregion("maincpu")->base();
141141
142142   output_set_value("cass_led",(state->m_shared & 0x20) ? 1 : 0);
143143
r14976r14977
179179   super80_state *state = screen.machine().driver_data<super80_state>();
180180   UINT8 y,ra,chr=32,gfx,screen_on=0;
181181   UINT16 sy=0,ma=state->m_vidpg,x;
182   UINT8 *RAM = screen.machine().region("maincpu")->base();
182   UINT8 *RAM = state->memregion("maincpu")->base();
183183
184184   output_set_value("cass_led",(state->m_shared & 0x20) ? 1 : 0);
185185
r14976r14977
222222   UINT8 y,ra,chr=32,gfx,screen_on=0;
223223   UINT16 sy=0,ma=state->m_vidpg,x;
224224   UINT8 col, bg=0, fg=0, options=input_port_read(screen.machine(), "CONFIG");
225   UINT8 *RAM = screen.machine().region("maincpu")->base();
225   UINT8 *RAM = state->memregion("maincpu")->base();
226226
227227   /* get selected character generator */
228228   UINT8 cgen = state->m_current_charset ^ ((options & 0x10)>>4);   /* bit 0 of port F1 and cgen config switch */
r14976r14977
284284{
285285   super80_state *state = machine.driver_data<super80_state>();
286286   state->m_vidpg = 0xfe00;
287   state->m_p_chargen = machine.region("chargen")->base();
287   state->m_p_chargen = state->memregion("chargen")->base();
288288}
289289
290290/**************************** I/O PORTS *****************************************************************/
r14976r14977
381381VIDEO_START( super80v )
382382{
383383   super80_state *state = machine.driver_data<super80_state>();
384   state->m_p_pcgram = machine.region("maincpu")->base()+0xf000;
385   state->m_p_videoram = machine.region("videoram")->base();
386   state->m_p_colorram = machine.region("colorram")->base();
384   state->m_p_pcgram = machine.root_device().memregion("maincpu")->base()+0xf000;
385   state->m_p_videoram = machine.root_device().memregion("videoram")->base();
386   state->m_p_colorram = state->memregion("colorram")->base();
387387}
388388
389389SCREEN_UPDATE_RGB32( super80v )
src/mess/video/mikromik.c
r14976r14977
9999void mm1_state::video_start()
100100{
101101   // find memory regions
102   m_char_rom = machine().region("chargen")->base();
102   m_char_rom = memregion("chargen")->base();
103103
104104   machine().primary_screen->register_screen_bitmap(m_bitmap);
105105}
src/mess/video/pc4.c
r14976r14977
3333                  else
3434                  {
3535                     //draw CGROM characters
36                     bitmap.pix16(l*9 + y, i*6 + x) = BIT(machine().region("charset")->base()[m_ddram[char_pos]*8+y], 4-x);
36                     bitmap.pix16(l*9 + y, i*6 + x) = BIT(machine().root_device().memregion("charset")->base()[m_ddram[char_pos]*8+y], 4-x);
3737
3838                  }
3939
src/mess/video/pet.c
r14976r14977
1212
1313void pet_vh_init (running_machine &machine)
1414{
15   UINT8 *gfx = machine.region("gfx1")->base();
15   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
1616   int i;
1717
1818   /* inversion logic on board */
r14976r14977
2626
2727void pet80_vh_init (running_machine &machine)
2828{
29   UINT8 *gfx = machine.region("gfx1")->base();
29   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
3030   int i;
3131
3232   /* inversion logic on board */
r14976r14977
4545
4646void superpet_vh_init (running_machine &machine)
4747{
48   UINT8 *gfx = machine.region("gfx1")->base();
48   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
4949   int i;
5050
5151   for (i=0; i<0x400; i++) {
src/mess/video/osi.c
r14976r14977
5959         {
6060            UINT8 videoram_data = m_video_ram[videoram_addr];
6161            UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
62            UINT8 charrom_data = machine().region("chargen")->base()[charrom_addr];
62            UINT8 charrom_data = memregion("chargen")->base()[charrom_addr];
6363
6464            for (bit = 0; bit < 8; bit++)
6565            {
r14976r14977
9292         {
9393            UINT8 videoram_data = m_video_ram[videoram_addr];
9494            UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
95            UINT8 charrom_data = machine().region("chargen")->base()[charrom_addr];
95            UINT8 charrom_data = memregion("chargen")->base()[charrom_addr];
9696
9797            for (bit = 0; bit < 8; bit++)
9898            {
r14976r14977
132132      {
133133         UINT8 videoram_data = m_video_ram[videoram_addr++];
134134         UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
135         UINT8 charrom_data = machine().region("chargen")->base()[charrom_addr];
135         UINT8 charrom_data = memregion("chargen")->base()[charrom_addr];
136136
137137         for (bit = 0; bit < 8; bit++)
138138         {
src/mess/video/cgc7900.c
r14976r14977
191191void cgc7900_state::video_start()
192192{
193193   /* find memory regions */
194   m_char_rom = machine().region("gfx1")->base();
194   m_char_rom = memregion("gfx1")->base();
195195}
196196
197197/*-------------------------------------------------
src/mess/video/channelf.c
r14976r14977
3737VIDEO_START( channelf )
3838{
3939   channelf_state *state = machine.driver_data<channelf_state>();
40   state->m_p_videoram = machine.region("vram")->base();
40   state->m_p_videoram = state->memregion("vram")->base();
4141}
4242
4343static int recalc_palette_offset(int reg1, int reg2)
src/mess/video/vtvideo.c
r14976r14977
413413   vt->screen = device->machine().device<screen_device>(intf->screen_tag);
414414   assert(vt->screen != NULL);
415415
416   vt->gfx = device->machine().region(intf->char_rom_region_tag)->base();
416   vt->gfx = device->machine().root_device().memregion(intf->char_rom_region_tag)->base();
417417   assert(vt->gfx != NULL);
418418
419419   // LBA7 is scan line frequency update
src/mess/video/pc_t1t.c
r14976r14977
703703{
704704   if (pcjr.bank != data)
705705   {
706      UINT8 *ram = machine.region("maincpu")->base();
706      UINT8 *ram = machine.root_device().memregion("maincpu")->base();
707707      int dram, vram;
708708      pcjr.bank = data;
709709   /* it seems the video ram is mapped to the last 128K of main memory */
r14976r14977
746746         dram = ((data & 0x07) << 14);
747747         vram = ((data & 0x38) << (14-3));
748748      }
749      memory_set_bankptr( machine, "bank14", machine.device<ram_device>(RAM_TAG)->pointer() + vram );
749      machine.root_device().membank( "bank14" )->set_base( machine.device<ram_device>(RAM_TAG)->pointer() + vram );
750750      pcjr.displayram = machine.device<ram_device>(RAM_TAG)->pointer() + dram;
751751      pc_pcjr_mode_switch(machine);
752752   }
r14976r14977
932932   address_space *space = machine.firstcpu->memory().space(AS_PROGRAM);
933933   address_space *spaceio = machine.firstcpu->memory().space(AS_IO);
934934
935   pcjr.chr_gen = machine.region("gfx1")->base();
935   pcjr.chr_gen = machine.root_device().memregion("gfx1")->base();
936936   pcjr.update_row = NULL;
937937   pcjr.bank = 0;
938938   pcjr.chr_size = 16;
r14976r14977
962962   int buswidth;
963963   address_space *spaceio = machine.firstcpu->memory().space(AS_IO);
964964
965   pcjr.chr_gen = machine.region("gfx1")->base();
965   pcjr.chr_gen = machine.root_device().memregion("gfx1")->base();
966966   pcjr.update_row = NULL;
967967   pcjr.bank = 0;
968968   pcjr.mode_control = 0x08;
src/mess/video/iq151_video32.c
r14976r14977
6060
6161void iq151_video32_device::device_start()
6262{
63   m_videoram = (UINT8*)subregion("videoram")->base();
64   m_chargen = (UINT8*)subregion("chargen")->base();
63   m_videoram = (UINT8*)memregion("videoram")->base();
64   m_chargen = (UINT8*)memregion("chargen")->base();
6565
6666   machine().gfx[0] = gfx_element_alloc(machine(), &iq151_video32_charlayout, m_chargen, 1, 0);
6767}
src/mess/video/fmtowns.c
r14976r14977
249249
250250READ8_MEMBER( towns_state::towns_video_cff80_r )
251251{
252   UINT8* ROM = space.machine().region("user")->base();
252   UINT8* ROM = space.machine().root_device().memregion("user")->base();
253253
254254   switch(offset)
255255   {
r14976r14977
592592READ8_MEMBER(towns_state::towns_spriteram_low_r)
593593{
594594   UINT8* RAM = m_messram->pointer();
595   UINT8* ROM = space.machine().region("user")->base();
595   UINT8* ROM = space.machine().root_device().memregion("user")->base();
596596
597597   if(offset < 0x1000)
598598   {  // 0xc8000-0xc8fff
r14976r14977
16551655   UINT8 colour;
16561656   UINT8 data;
16571657   UINT8 temp;
1658   UINT8* font_rom = machine.region("user")->base();
1658   UINT8* font_rom = state->memregion("user")->base();
16591659   int a,b;
16601660
16611661   // all characters are 16 pixels high
src/mess/video/a7800.c
r14976r14977
321321{
322322   a7800_state *state = timer.machine().driver_data<a7800_state>();
323323   int frame_scanline;
324   UINT8 *ROM = timer.machine().region("maincpu")->base();
324   UINT8 *ROM = timer.machine().root_device().memregion("maincpu")->base();
325325   address_space* space = timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
326326
327327   state->m_maria_scanline++;
r14976r14977
442442
443443READ8_MEMBER(a7800_state::a7800_MARIA_r)
444444{
445   UINT8 *ROM = machine().region("maincpu")->base();
445   UINT8 *ROM = memregion("maincpu")->base();
446446   switch (offset)
447447   {
448448      case 0x08:
r14976r14977
456456
457457WRITE8_MEMBER(a7800_state::a7800_MARIA_w)
458458{
459   UINT8 *ROM = machine().region("maincpu")->base();
459   UINT8 *ROM = memregion("maincpu")->base();
460460   switch (offset)
461461   {
462462      case 0x00:
src/mess/video/newbrain.c
r14976r14977
44void newbrain_state::video_start()
55{
66   /* find memory regions */
7   m_char_rom = machine().region("chargen")->base();
7   m_char_rom = memregion("chargen")->base();
88
99   /* register for state saving */
1010   save_item(NAME(m_tvcnsl));
src/mess/video/pc_aga.c
r14976r14977
722722
723723   memset( &aga, 0, sizeof( aga ) );
724724   aga.mode = AGA_COLOR;
725   aga.mda_chr_gen = machine.region("gfx1")->base() + 0x1000;
726   aga.cga_chr_gen = machine.region("gfx1")->base();
725   aga.mda_chr_gen = machine.root_device().memregion("gfx1")->base() + 0x1000;
726   aga.cga_chr_gen = machine.root_device().memregion("gfx1")->base();
727727   aga.videoram = auto_alloc_array(machine, UINT8, 0x10000);
728728}
729729
r14976r14977
756756   memset( &aga, 0, sizeof( aga ) );
757757
758758   aga.mode = AGA_COLOR;
759   aga.mda_chr_gen = machine.region("gfx1")->base();
760   aga.cga_chr_gen = machine.region("gfx1")->base() + 0x1000;
759   aga.mda_chr_gen = machine.root_device().memregion("gfx1")->base();
760   aga.cga_chr_gen = machine.root_device().memregion("gfx1")->base() + 0x1000;
761761   aga.videoram = auto_alloc_array(machine, UINT8, 0x10000);
762762}
763763
src/mess/video/intv.c
r14976r14977
173173   INT32 xInc;
174174   INT32 i, j, k;
175175
176   UINT8* memory = machine.region("maincpu")->base();
176   UINT8* memory = state->memregion("maincpu")->base();
177177
178178   for (i = 0; i < STIC_MOBS; i++)
179179   {
r14976r14977
240240   INT16 w, h, nextx, nexty;
241241   UINT8 csPtr = 0;
242242   UINT16 nextCard;
243   UINT8 *ram = machine.region("maincpu")->base();
243   UINT8 *ram = state->memregion("maincpu")->base();
244244
245245   for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE;
246246       h < STIC_BACKTAB_HEIGHT;
r14976r14977
311311   UINT8 j, isGrom, fgcolor, bgcolor;
312312   UINT16 nextCard, memoryLocation;
313313   UINT8* memory;
314   UINT8* ram = machine.region("maincpu")->base();
314   UINT8* ram = state->memregion("maincpu")->base();
315315
316316   for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE;
317317       h < STIC_BACKTAB_HEIGHT;
src/mess/video/ef9345.h
r14976r14977
8989   static const device_timer_id BUSY_TIMER = 0;
9090   static const device_timer_id BLINKING_TIMER = 1;
9191
92   const memory_region *m_charset;
92   memory_region *m_charset;
9393   address_space *m_videoram;
9494
9595   screen_device *m_screen;            //screen we are acting on
src/mess/video/mikro80.c
r14976r14977
1818SCREEN_UPDATE_IND16( mikro80 )
1919{
2020   mikro80_state *state = screen.machine().driver_data<mikro80_state>();
21   UINT8 *gfx = screen.machine().region("gfx1")->base();
21   UINT8 *gfx = state->memregion("gfx1")->base();
2222   int x,y,b;
2323
2424   for(y = 0; y < 32*8; y++ )
src/mess/video/mz80.c
r14976r14977
3434VIDEO_START( mz80k )
3535{
3636   mz80_state *state = machine.driver_data<mz80_state>();
37   state->m_p_chargen = machine.region("chargen")->base();
37   state->m_p_chargen = state->memregion("chargen")->base();
3838}
3939
4040SCREEN_UPDATE_IND16( mz80k )
src/mess/video/poly88.c
r14976r14977
2424VIDEO_START( poly88 )
2525{
2626   poly88_state *state = machine.driver_data<poly88_state>();
27   state->m_FNT = machine.region("chargen")->base();
27   state->m_FNT = state->memregion("chargen")->base();
2828}
2929
3030SCREEN_UPDATE_IND16( poly88 )
src/mess/video/avigo.c
r14976r14977
6969   m_screen_column = 0;
7070
7171   /* allocate video memory */
72   m_video_memory = machine().region_alloc( "videoram", (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1, 1, ENDIANNESS_LITTLE )->base();
72   m_video_memory = machine().memory().region_alloc( "videoram", (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1, 1, ENDIANNESS_LITTLE )->base();
7373   memset(m_video_memory, 0, (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1);
7474
7575   save_pointer(NAME(m_video_memory), (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1);
src/mess/video/llc.c
r14976r14977
2020   llc_state *state = screen.machine().driver_data<llc_state>();
2121   UINT8 code,disp;
2222   int y, x, b,c,inv;
23   UINT8 *gfx = screen.machine().region("gfx1")->base();
23   UINT8 *gfx = state->memregion("gfx1")->base();
2424
2525   for (x = 0; x < 64; x++)
2626   {
r14976r14977
5252   llc_state *state = screen.machine().driver_data<llc_state>();
5353   UINT8 code,disp;
5454   int y, x, b,c;
55   UINT8 *gfx = screen.machine().region("gfx1")->base();
55   UINT8 *gfx = state->memregion("gfx1")->base();
5656
5757   for (x = 0; x < 64; x++)
5858   {
src/mess/video/abc802.c
r14976r14977
210210void abc802_state::video_start()
211211{
212212   // find memory regions
213   m_char_rom = machine().region(MC6845_TAG)->base();
213   m_char_rom = memregion(MC6845_TAG)->base();
214214
215215   // register for state saving
216216   save_item(NAME(m_flshclk_ctr));
src/mess/video/trs80.c
r14976r14977
4545VIDEO_START( trs80 )
4646{
4747   trs80_state *state = machine.driver_data<trs80_state>();
48   state->m_p_chargen = machine.region("chargen")->base();
48   state->m_p_chargen = state->memregion("chargen")->base();
4949   state->m_size_store = 0xff;
5050   state->m_mode &= 2;
5151}
src/mess/video/apple2.c
r14976r14977
142142   int row, col;
143143   UINT32 start_address = (page ? 0x0800 : 0x0400);
144144   UINT32 address;
145   const UINT8 *textgfx_data = machine.region("gfx1")->base();
146   UINT32 textgfx_datalen = machine.region("gfx1")->bytes();
145   const UINT8 *textgfx_data = machine.root_device().memregion("gfx1")->base();
146   UINT32 textgfx_datalen = state->memregion("gfx1")->bytes();
147147   UINT32 my_a2 = effective_a2(state);
148148
149149   /* perform adjustments */
r14976r14977
346346   state->m_fgcolor = 15;
347347   state->m_bgcolor = 0;
348348   state->m_flash = 0;
349   apple2_font = machine.region("gfx1")->base();
350   state->m_alt_charset_value = machine.region("gfx1")->bytes() / 16;
349   apple2_font = machine.root_device().memregion("gfx1")->base();
350   state->m_alt_charset_value = machine.root_device().memregion("gfx1")->bytes() / 16;
351351   state->m_a2_videoram = vram;
352352
353353   /* 2^3 dependent pixels * 2 color sets * 2 offsets */
r14976r14977
382382
383383   /* Fix for Ivel Ultra */
384384   if (!strcmp(machine.system().name, "ivelultr")) {
385      int len = machine.region("gfx1")->bytes();
385      int len = machine.root_device().memregion("gfx1")->bytes();
386386      for (i = 0; i < len; i++)
387387      {
388388         apple2_font[i] = BITSWAP8(apple2_font[i],  7, 7, 6, 5, 4, 3, 2, 1);
r14976r14977
397397      || !strcmp(machine.system().name, "ace100")
398398      || !strcmp(machine.system().name, "apple2jp"))
399399   {
400      int len = machine.region("gfx1")->bytes();
400      int len = machine.root_device().memregion("gfx1")->bytes();
401401      for (i = 0; i < len; i++)
402402      {
403403         apple2_font[i] = BITSWAP8(apple2_font[i], 7, 0, 1, 2, 3, 4, 5, 6);
src/mess/video/abc806.c
r14976r14977
475475   m_40 = 1;
476476
477477   // find memory regions
478   m_char_rom = machine().region(MC6845_TAG)->base();
479   m_rad_prom = machine().region("rad")->base();
480   m_hru2_prom = machine().region("hru2")->base();
478   m_char_rom = memregion(MC6845_TAG)->base();
479   m_rad_prom = memregion("rad")->base();
480   m_hru2_prom = memregion("hru2")->base();
481481
482482   // allocate memory
483483   m_char_ram.allocate(ABC806_CHAR_RAM_SIZE);
src/mess/video/abc1600.c
r14976r14977
10551055   m_video_ram = auto_alloc_array(machine(), UINT16, VIDEORAM_SIZE);
10561056
10571057   // find memory regions
1058   m_wrmsk_rom = machine().region("wrmsk")->base();
1059   m_shinf_rom = machine().region("shinf")->base();
1060   m_drmsk_rom = machine().region("drmsk")->base();
1058   m_wrmsk_rom = memregion("wrmsk")->base();
1059   m_shinf_rom = memregion("shinf")->base();
1060   m_drmsk_rom = memregion("drmsk")->base();
10611061
10621062   // state saving
10631063   save_pointer(NAME(m_video_ram), VIDEORAM_SIZE);
src/mess/video/733_asr.c
r14976r14977
157157      0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00
158158   };
159159
160   dst = machine.region(asr733_chr_region)->base();
160   dst = machine.root_device().memregion(asr733_chr_region)->base();
161161
162162   memcpy(dst, fontdata6x8, asrfontdata_size);
163163}
src/mess/video/gime.c
r14976r14977
158158   m_res_in_floating_bus_func.resolve(config->m_in_floating_bus_func, *this);
159159 
160160   /* set up ROM/RAM pointers */
161   m_rom = machine().region(config->m_maincpu_tag)->base();
161   m_rom = memregion(config->m_maincpu_tag)->base();
162162   m_cart_rom = m_cart_device->get_cart_base();
163163 
164164   /* populate palettes */
r14976r14977
602602   memory += offset;
603603 
604604   /* set the banks */
605   memory_set_bankptr(machine(), rbank, memory);
606   memory_set_bankptr(machine(), wbank, is_read_only ? m_dummy_bank : memory);
605   membank(rbank)->set_base(memory);
606   membank(wbank)->set_base(is_read_only ? m_dummy_bank : memory);
607607}
608608 
609609 
src/mess/video/pk8020.c
r14976r14977
1919{
2020   pk8020_state *state = screen.machine().driver_data<pk8020_state>();
2121   int y, x, b, j;
22   UINT8 *gfx = screen.machine().region("gfx1")->base();
22   UINT8 *gfx = state->memregion("gfx1")->base();
2323   UINT8 *ram = screen.machine().device<ram_device>(RAM_TAG)->pointer();
2424
2525   for (y = 0; y < 16; y++)
src/mess/video/galaxy.c
r14976r14977
2020   int y, x;
2121   if (state->m_interrupts_enabled == TRUE)
2222   {
23      UINT8 *gfx = machine.region("gfx1")->base();
23      UINT8 *gfx = state->memregion("gfx1")->base();
2424      UINT8 dat = (state->m_latch_value & 0x3c) >> 2;
2525      if ((state->m_gal_cnt >= 48 * 2) && (state->m_gal_cnt < 48 * 210))  // display on screen just state->m_first 208 lines
2626      {
src/mess/video/bbc.c
r14976r14977
340340   bbc_state *state = machine.driver_data<bbc_state>();
341341   if (vdusel)
342342   {
343      state->m_BBC_Video_RAM= machine.region("maincpu")->base()+0x8000;
343      state->m_BBC_Video_RAM= state->memregion("maincpu")->base()+0x8000;
344344   } else {
345      state->m_BBC_Video_RAM= machine.region("maincpu")->base();
345      state->m_BBC_Video_RAM= machine.root_device().memregion("maincpu")->base();
346346   }
347347}
348348
r14976r14977
362362   set_pixel_lookup(state);
363363   state->m_saa505x = machine.device("saa505x");
364364
365   state->m_BBC_Video_RAM = machine.region("maincpu")->base();
365   state->m_BBC_Video_RAM = state->memregion("maincpu")->base();
366366   state->m_memorySize=memorySize;
367367
368368}
src/mess/video/k1ge.c
r14976r14977
831831   k1ge->timer = device->machine().scheduler().timer_alloc(FUNC(k1ge_timer_callback), (void *) device );
832832   k1ge->hblank_on_timer = device->machine().scheduler().timer_alloc(FUNC(k1ge_hblank_on_timer_callback), (void *) device );
833833   k1ge->screen = device->machine().device<screen_device>(k1ge->intf->screen_tag);
834   k1ge->vram = device->machine().region( k1ge->intf->vram_tag )->base();
834   k1ge->vram = device->machine().root_device().memregion( k1ge->intf->vram_tag )->base();
835835   k1ge->bitmap = auto_bitmap_ind16_alloc( device->machine(), k1ge->screen->width(), k1ge->screen->height() );
836836   k1ge->draw = k1ge_draw;
837837}
src/mess/video/fm7.c
r14976r14977
10851085
10861086WRITE8_MEMBER(fm7_state::fm77av_video_flags_w)
10871087{
1088   UINT8* RAM = machine().region("subsyscg")->base();
1088   UINT8* RAM = memregion("subsyscg")->base();
10891089
10901090   m_video.cgrom = data & 0x03;
1091   memory_set_bankptr(machine(),"bank20",RAM+(m_video.cgrom*0x800));
1091   membank("bank20")->set_base(RAM+(m_video.cgrom*0x800));
10921092   m_video.fine_offset = data & 0x04;
10931093   m_video.active_video_page = data & 0x20;
10941094   m_video.display_video_page = data & 0x40;
r14976r14977
11421142 */
11431143WRITE8_MEMBER(fm7_state::fm77av_sub_bank_w)
11441144{
1145//  UINT8* RAM = machine().region("sub")->base();
1145//  UINT8* RAM = memregion("sub")->base();
11461146   UINT8* ROM;
11471147
11481148   if((data & 0x03) == (m_sb_prev & 0x03))
r14976r14977
11521152   switch (data & 0x03)
11531153   {
11541154      case 0x00:  // Type C, 640x200 (as used on the FM-7)
1155         ROM = machine().region("subsys_c")->base();
1156      //  memory_set_bankptr(machine(),20,ROM);
1157         memory_set_bankptr(machine(),"bank21",ROM+0x800);
1155         ROM = memregion("subsys_c")->base();
1156      //  membank(20)->set_base(ROM);
1157         membank("bank21")->set_base(ROM+0x800);
11581158         logerror("VID: Sub ROM Type C selected\n");
11591159         break;
11601160      case 0x01:  // Type A, 640x200
1161         ROM = machine().region("subsys_a")->base();
1162      //  memory_set_bankptr(machine(),20,RAM+0xd800);
1163         memory_set_bankptr(machine(),"bank21",ROM);
1161         ROM = memregion("subsys_a")->base();
1162      //  membank(20)->set_base(RAM+0xd800);
1163         membank("bank21")->set_base(ROM);
11641164         logerror("VID: Sub ROM Type A selected\n");
11651165         break;
11661166      case 0x02:  // Type B, 320x200
1167         ROM = machine().region("subsys_b")->base();
1168      //  memory_set_bankptr(machine(),20,RAM+0xd800);
1169         memory_set_bankptr(machine(),"bank21",ROM);
1167         ROM = memregion("subsys_b")->base();
1168      //  membank(20)->set_base(RAM+0xd800);
1169         membank("bank21")->set_base(ROM);
11701170         logerror("VID: Sub ROM Type B selected\n");
11711171         break;
11721172      case 0x03:  // CG Font?
1173         ROM = machine().region("subsyscg")->base();
1174      //  memory_set_bankptr(machine(),20,RAM+0xd800);
1175         memory_set_bankptr(machine(),"bank21",ROM);
1173         ROM = memregion("subsyscg")->base();
1174      //  membank(20)->set_base(RAM+0xd800);
1175         membank("bank21")->set_base(ROM);
11761176         logerror("VID: Sub ROM CG selected\n");
11771177         break;
11781178   }
r14976r14977
13681368// called when banked into main CPU space by the MMR, available only if sub CPU is halted
13691369READ8_MEMBER(fm7_state::fm7_sub_ram_ports_banked_r)
13701370{
1371   UINT8* RAM = machine().region("maincpu")->base();
1371   UINT8* RAM = memregion("maincpu")->base();
13721372   UINT8* ROM;
13731373
13741374   if(!m_video.sub_halt)
r14976r14977
13821382      return RAM[0x1d000+offset];
13831383   if(offset > 0x800) // CGROM
13841384   {
1385      ROM = machine().region("subsyscg")->base();
1385      ROM = memregion("subsyscg")->base();
13861386      return ROM[(m_video.cgrom*0x800)+(offset-0x800)];
13871387   }
13881388
r14976r14977
14201420
14211421WRITE8_MEMBER(fm7_state::fm7_sub_ram_ports_banked_w)
14221422{
1423   UINT8* RAM = machine().region("maincpu")->base();
1423   UINT8* RAM = memregion("maincpu")->base();
14241424
14251425   if(!m_video.sub_halt)
14261426      return;
r14976r14977
14761476
14771477READ8_MEMBER(fm7_state::fm7_console_ram_banked_r)
14781478{
1479   UINT8* RAM = machine().region("maincpu")->base();
1479   UINT8* RAM = memregion("maincpu")->base();
14801480
14811481   if(!m_video.sub_halt)
14821482      return 0xff;
r14976r14977
14861486
14871487WRITE8_MEMBER(fm7_state::fm7_console_ram_banked_w)
14881488{
1489   UINT8* RAM = machine().region("maincpu")->base();
1489   UINT8* RAM = memregion("maincpu")->base();
14901490
14911491   if(!m_video.sub_halt)
14921492      return;
src/mess/formats/ace_ace.c
r14976r14977
2626SNAPSHOT_LOAD( ace )
2727{
2828   cpu_device *cpu = image.device().machine().firstcpu;
29   UINT8 *RAM = image.device().machine().region(cpu->tag())->base();
29   UINT8 *RAM = image.device().machine().root_device().memregion(cpu->tag())->base();
3030   address_space *space = cpu->memory().space(AS_PROGRAM);
3131   unsigned char ace_repeat, ace_byte, loop;
3232   int done=0, ace_index=0x2000;
src/mess/formats/m65_snqk.c
r14976r14977
218218static void microtan_snapshot_copy(running_machine &machine, UINT8 *snapshot_buff, int snapshot_size)
219219{
220220   microtan_state *state = machine.driver_data<microtan_state>();
221    UINT8 *RAM = machine.region("maincpu")->base();
221    UINT8 *RAM = state->memregion("maincpu")->base();
222222    address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
223223    via6522_device *via_0 = machine.device<via6522_device>("via6522_0");
224224    via6522_device *via_1 = machine.device<via6522_device>("via6522_1");
src/mess/formats/studio2_st2.c
r14976r14977
7373   for (int block = 0; block < (header.blocks - 1); block++)
7474   {
7575      UINT16 offset = header.page[block] << 8;
76      UINT8 *ptr = ((UINT8 *) image.device().machine().region(CDP1802_TAG)->base()) + offset;
76      UINT8 *ptr = ((UINT8 *) image.device().machine().root_device().memregion(CDP1802_TAG)->base()) + offset;
7777
7878      if (LOG) logerror("ST2 Reading block %u to %04x\n", block, offset);
7979
src/mess/drivers/vip.c
r14976r14977
659659   }
660660
661661   /* enable ROM all through address space */
662   program->install_rom(0x0000, 0x01ff, 0, 0xfe00, machine().region(CDP1802_TAG)->base());
662   program->install_rom(0x0000, 0x01ff, 0, 0xfe00, memregion(CDP1802_TAG)->base());
663663}
664664
665665/* Machine Drivers */
r14976r14977
740740
741741static QUICKLOAD_LOAD( vip )
742742{
743   UINT8 *ptr = image.device().machine().region(CDP1802_TAG)->base();
743   UINT8 *ptr = image.device().machine().root_device().memregion(CDP1802_TAG)->base();
744744   UINT8 *chip8_ptr = NULL;
745745   int chip8_size = 0;
746746   int size = image.length();
r14976r14977
748748   if (strcmp(image.filetype(), "c8") == 0)
749749   {
750750      /* CHIP-8 program */
751      chip8_ptr = image.device().machine().region("chip8")->base();
752      chip8_size = image.device().machine().region("chip8")->bytes();
751      chip8_ptr = image.device().machine().root_device().memregion("chip8")->base();
752      chip8_size = image.device().machine().root_device().memregion("chip8")->bytes();
753753   }
754754   else if (strcmp(image.filename(), "c8x") == 0)
755755   {
756756      /* CHIP-8X program */
757      chip8_ptr = image.device().machine().region("chip8x")->base();
758      chip8_size = image.device().machine().region("chip8x")->bytes();
757      chip8_ptr = image.device().machine().root_device().memregion("chip8x")->base();
758      chip8_size = image.device().machine().root_device().memregion("chip8x")->bytes();
759759   }
760760
761761   if ((size + chip8_size) > image.device().machine().device<ram_device>(RAM_TAG)->size())
src/mess/drivers/comquest.c
r14976r14977
205205
206206static MACHINE_RESET( comquest )
207207{
208//  UINT8 *mem=machine.region("user1")->base();
209//  memory_set_bankptr(machine, 1,mem+0x00000);
208//  UINT8 *mem=machine.root_device().memregion("user1")->base();
209//  state->membank(1)->set_base(mem+0x00000);
210210}
211211
212212static const UINT32 amask= 0xffff;
src/mess/drivers/plan80.c
r14976r14977
144144/* after the first 4 bytes have been read from ROM, switch the ram back in */
145145static TIMER_CALLBACK( plan80_boot )
146146{
147   memory_set_bank(machine, "boot", 0);
147   plan80_state *state = machine.driver_data<plan80_state>();
148   state->membank("boot")->set_entry(0);
148149}
149150
150151MACHINE_RESET_MEMBER( plan80_state )
151152{
152   memory_set_bank(machine(), "boot", 1);
153   membank("boot")->set_entry(1);
153154   machine().scheduler().timer_set(attotime::from_usec(10), FUNC(plan80_boot));
154155}
155156
156157DRIVER_INIT( plan80 )
157158{
158   UINT8 *RAM = machine.region("maincpu")->base();
159   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xf800);
159   plan80_state *state = machine.driver_data<plan80_state>();
160   UINT8 *RAM = state->memregion("maincpu")->base();
161   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf800);
160162}
161163
162164VIDEO_START_MEMBER( plan80_state )
163165{
164   m_p_chargen = machine().region("chargen")->base();
166   m_p_chargen = memregion("chargen")->base();
165167}
166168
167169SCREEN_UPDATE16_MEMBER( plan80_state )
src/mess/drivers/pb1000.c
r14976r14977
303303   m_gatearray[offset] = data&0xff;
304304
305305   if (m_gatearray[0])
306      memory_set_bankptr(machine(), "bank1", machine().region("card1")->base());
306      membank("bank1")->set_base(machine().root_device().memregion("card1")->base());
307307   else if (m_gatearray[1])
308      memory_set_bankptr(machine(), "bank1", machine().region("card2")->base());
308      membank("bank1")->set_base(machine().root_device().memregion("card2")->base());
309309   else
310      memory_set_bankptr(machine(), "bank1", machine().region("rom")->base());
310      membank("bank1")->set_base(machine().root_device().memregion("rom")->base());
311311}
312312
313313static void lcd_control(hd61700_cpu_device &device, UINT8 data)
r14976r14977
489489
490490void pb1000_state::machine_start()
491491{
492   memory_set_bankptr(machine(), "bank1", machine().region("rom")->base());
492   membank("bank1")->set_base(machine().root_device().memregion("rom")->base());
493493
494494   m_kb_timer = machine().scheduler().timer_alloc(FUNC(keyboard_timer));
495495   m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192));
src/mess/drivers/pdp1.c
r14976r14977
655655   };
656656
657657   /* set up our font */
658   dst = machine.region("gfx1")->base();
658   dst = machine.root_device().memregion("gfx1")->base();
659659   memcpy(dst, fontdata6x8, pdp1_fontdata_size);
660660
661661   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_machine_stop),&machine));
src/mess/drivers/elf.c
r14976r14977
245245   /* setup memory banking */
246246   program->install_read_bank(0x0000, 0x00ff, "bank1");
247247   program->install_write_handler(0x0000, 0x00ff, write8_delegate(FUNC(elf2_state::memory_w), this));
248   memory_configure_bank(machine(), "bank1", 0, 1, m_ram->pointer(), 0);
249   memory_set_bank(machine(), "bank1", 0);
248   membank("bank1")->configure_entry(0, m_ram->pointer());
249   membank("bank1")->set_entry(0);
250250
251251   /* register for state saving */
252252   save_item(NAME(m_data));
src/mess/drivers/dectalk.c
r14976r14977
268268static void dectalk_x2212_store( running_machine &machine )
269269{
270270   dectalk_state *state = machine.driver_data<dectalk_state>();
271   UINT8 *nvram = machine.region("nvram")->base();
271   UINT8 *nvram = state->memregion("nvram")->base();
272272   int i;
273273   for (i = 0; i < 256; i++)
274274   nvram[i] = state->m_x2214_sram[i];
r14976r14977
280280static void dectalk_x2212_recall( running_machine &machine )
281281{
282282   dectalk_state *state = machine.driver_data<dectalk_state>();
283   UINT8 *nvram = machine.region("nvram")->base();
283   UINT8 *nvram = state->memregion("nvram")->base();
284284   int i;
285285   for (i = 0; i < 256; i++)
286286   state->m_x2214_sram[i] = nvram[i];
src/mess/drivers/homelab.c
r14976r14977
177177
178178VIDEO_START_MEMBER( homelab_state )
179179{
180   m_p_chargen = machine().region("chargen")->base();
180   m_p_chargen = memregion("chargen")->base();
181181}
182182
183183static SCREEN_UPDATE_IND16( homelab )
src/mess/drivers/vt520.c
r14976r14977
5050
5151static MACHINE_RESET(vt520)
5252{
53   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
54   UINT8 *rom = machine.region("maincpu")->base();
53   vt520_state *state = machine.driver_data<vt520_state>();
54   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);   
55   UINT8 *rom = state->memregion("maincpu")->base();
5556   space->unmap_write(0x0000, 0xffff);
56   memory_set_bankptr(machine, "bank1", rom + 0x70000);
57   state->membank("bank1")->set_base(rom + 0x70000);
5758}
5859
5960static VIDEO_START( vt520 )
src/mess/drivers/pc8401a.c
r14976r14977
8686         /* internal ROM */
8787         program->install_read_bank(0x0000, 0x7fff, "bank1");
8888         program->unmap_write(0x0000, 0x7fff);
89         memory_set_bank(machine(), "bank1", rombank);
89         membank("bank1")->set_entry(rombank);
9090      }
9191      else
9292      {
r14976r14977
9898
9999   case 1: /* RAM 0000H to 7FFFH */
100100      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
101      memory_set_bank(machine(), "bank1", 4);
101      membank("bank1")->set_entry(4);
102102      //logerror("0x0000-0x7fff = RAM 0-7fff\n");
103103      break;
104104
105105   case 2:   /* RAM 8000H to FFFFH */
106106      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
107      memory_set_bank(machine(), "bank1", 5);
107      membank("bank1")->set_entry(5);
108108      //logerror("0x0000-0x7fff = RAM 8000-ffff\n");
109109      break;
110110
r14976r14977
117117   {
118118   case 0: /* cell addresses 0000H to 3FFFH */
119119      program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
120      memory_set_bank(machine(), "bank3", 0);
120      membank("bank3")->set_entry(0);
121121      //logerror("0x8000-0xbfff = RAM 0-3fff\n");
122122      break;
123123
124124   case 1: /* cell addresses 4000H to 7FFFH */
125125      program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
126      memory_set_bank(machine(), "bank3", 1);
126      membank("bank3")->set_entry(1);
127127      //logerror("0x8000-0xbfff = RAM 4000-7fff\n");
128128      break;
129129
130130   case 2: /* cell addresses 8000H to BFFFH */
131131      program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
132      memory_set_bank(machine(), "bank3", 2);
132      membank("bank3")->set_entry(2);
133133      //logerror("0x8000-0xbfff = RAM 8000-bfff\n");
134134      break;
135135
r14976r14977
137137      if (m_ram->size() > 64)
138138      {
139139         program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
140         memory_set_bank(machine(), "bank3", 3); // TODO or 4
140         membank("bank3")->set_entry(3); // TODO or 4
141141      }
142142      else
143143      {
r14976r14977
152152      /* CRT video RAM */
153153      program->install_readwrite_bank(0xc000, 0xdfff, "bank4");
154154      program->unmap_readwrite(0xe000, 0xe7ff);
155      memory_set_bank(machine(), "bank4", 1);
155      membank("bank4")->set_entry(1);
156156      //logerror("0xc000-0xdfff = video RAM\n");
157157   }
158158   else
159159   {
160160      /* RAM */
161161      program->install_readwrite_bank(0xc000, 0xe7ff, "bank4");
162      memory_set_bank(machine(), "bank4", 0);
162      membank("bank4")->set_entry(0);
163163      //logerror("0xc000-0e7fff = RAM c000-e7fff\n");
164164   }
165165}
r14976r14977
261261
262262READ8_MEMBER( pc8401a_state::io_rom_data_r )
263263{
264   UINT8 *iorom = machine().region("iorom")->base();
264   UINT8 *iorom = memregion("iorom")->base();
265265
266266   //logerror("I/O ROM read from %05x\n", m_io_addr);
267267
r14976r14977
496496   UINT8 *ram = m_ram->pointer();
497497
498498   /* set up A0/A1 memory banking */
499   memory_configure_bank(machine(), "bank1", 0, 4, machine().region(Z80_TAG)->base(), 0x8000);
500   memory_configure_bank(machine(), "bank1", 4, 2, ram, 0x8000);
501   memory_set_bank(machine(), "bank1", 0);
499   membank("bank1")->configure_entries(0, 4, memregion(Z80_TAG)->base(), 0x8000);
500   membank("bank1")->configure_entries(4, 2, ram, 0x8000);
501   membank("bank1")->set_entry(0);
502502
503503   /* set up A2 memory banking */
504   memory_configure_bank(machine(), "bank3", 0, 5, ram, 0x4000);
505   memory_set_bank(machine(), "bank3", 0);
504   membank("bank3")->configure_entries(0, 5, ram, 0x4000);
505   membank("bank3")->set_entry(0);
506506
507507   /* set up A3 memory banking */
508   memory_configure_bank(machine(), "bank4", 0, 1, ram + 0xc000, 0);
509   memory_configure_bank(machine(), "bank4", 1, 1, m_crt_ram, 0);
510   memory_set_bank(machine(), "bank4", 0);
508   membank("bank4")->configure_entry(0, ram + 0xc000);
509   membank("bank4")->configure_entry(1, m_crt_ram);
510   membank("bank4")->set_entry(0);
511511
512512   /* set up A4 memory banking */
513   memory_configure_bank(machine(), "bank5", 0, 1, ram + 0xe800, 0);
514   memory_set_bank(machine(), "bank5", 0);
513   membank("bank5")->configure_entry(0, ram + 0xe800);
514   membank("bank5")->set_entry(0);
515515
516516   /* bank switch */
517517   bankswitch(0);
src/mess/drivers/pc100.c
r14976r14977
332332   pc100_state *state = machine.driver_data<pc100_state>();
333333
334334   device_set_irq_callback(machine.device("maincpu"), pc100_irq_callback);
335   state->m_kanji_rom = (UINT16 *)(*machine.region("kanji"));
336   state->m_vram = (UINT16 *)(*machine.region("vram"));
335   state->m_kanji_rom = (UINT16 *)(*machine.root_device().memregion("kanji"));
336   state->m_vram = (UINT16 *)(*state->memregion("vram"));
337337}
338338
339339static MACHINE_RESET(pc100)
src/mess/drivers/atari400.c
r14976r14977
746746
747747static void a800xl_mmu(running_machine &machine, UINT8 new_mmu)
748748{
749   UINT8 *base = machine.region("maincpu")->base();
749   UINT8 *base = machine.root_device().memregion("maincpu")->base();
750750   UINT8 *base1, *base2, *base3, *base4;
751751
752752   /* check if memory C000-FFFF changed */
r14976r14977
768768      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xc000, 0xcfff, "bank3");
769769      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xd800, 0xffff, "bank4");
770770   }
771   memory_set_bankptr(machine, "bank3", base3);
772   memory_set_bankptr(machine, "bank4", base4);
771   machine.root_device().membank("bank3")->set_base(base3);
772   machine.root_device().membank("bank4")->set_base(base4);
773773
774774   /* check if BASIC changed */
775775   if( new_mmu & 0x02 )
r14976r14977
786786      base1 = base + 0x10000;  /* 8K BASIC */
787787   }
788788
789   memory_set_bankptr(machine, "bank1", base1);
789   machine.root_device().membank("bank1")->set_base(base1);
790790
791791   /* check if self-test ROM changed */
792792   if( new_mmu & 0x80 )
r14976r14977
802802      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x5000, 0x57ff);
803803      base2 = base + 0x15000;  /* 0x0800 bytes */
804804   }
805   memory_set_bankptr(machine, "bank2", base2);
805   machine.root_device().membank("bank2")->set_base(base2);
806806}
807807
808808/* BASIC was available in a separate cart, so we don't test it */
809809static void a1200xl_mmu(running_machine &machine, UINT8 new_mmu)
810810{
811   UINT8 *base = machine.region("maincpu")->base();
811   UINT8 *base = machine.root_device().memregion("maincpu")->base();
812812   UINT8 *base2, *base3, *base4;
813813
814814   /* check if memory C000-FFFF changed */
r14976r14977
830830      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xc000, 0xcfff, "bank3");
831831      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xd800, 0xffff, "bank4");
832832   }
833   memory_set_bankptr(machine, "bank3", base3);
834   memory_set_bankptr(machine, "bank4", base4);
833   machine.root_device().membank("bank3")->set_base(base3);
834   machine.root_device().membank("bank4")->set_base(base4);
835835
836836   /* check if self-test ROM changed */
837837   if( new_mmu & 0x80 )
r14976r14977
847847      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x57ff, "bank2");
848848      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x5000, 0x57ff);
849849   }
850   memory_set_bankptr(machine, "bank2", base2);
850   machine.root_device().membank("bank2")->set_base(base2);
851851}
852852
853853static void xegs_mmu(running_machine &machine, UINT8 new_mmu)
854854{
855   UINT8 *base = machine.region("maincpu")->base();
855   UINT8 *base = machine.root_device().memregion("maincpu")->base();
856856   UINT8 *base2, *base3, *base4;
857857
858858   /* check if memory C000-FFFF changed */
r14976r14977
874874      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xc000, 0xcfff, "bank3");
875875      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xd800, 0xffff, "bank4");
876876   }
877   memory_set_bankptr(machine, "bank3", base3);
878   memory_set_bankptr(machine, "bank4", base4);
877   machine.root_device().membank("bank3")->set_base(base3);
878   machine.root_device().membank("bank4")->set_base(base4);
879879
880880
881881   /* check if self-test ROM changed */
r14976r14977
892892      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x5000, 0x57ff);
893893      base2 = base + 0x15000;  /* 0x0800 bytes */
894894   }
895   memory_set_bankptr(machine, "bank2", base2);
895   machine.root_device().membank("bank2")->set_base(base2);
896896}
897897
898898/**************************************************************
r14976r14977
14661466
14671467static DRIVER_INIT( a600xl )
14681468{
1469   UINT8 *rom = machine.region("maincpu")->base();
1469   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
14701470   memcpy( rom + 0x5000, rom + 0xd000, 0x800 );
14711471}
14721472
src/mess/drivers/pc9801.c
r14976r14977
392392   m_tvram = auto_alloc_array(machine(), UINT8, 0x4000);
393393
394394   // find memory regions
395   m_char_rom = machine().region("chargen")->base();
395   m_char_rom = memregion("chargen")->base();
396396}
397397
398398UINT32 pc9801_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
r14976r14977
914914      {
915915         case 0x09://cg window font read
916916         {
917            UINT8 *pcg = machine().region("pcg")->base();
917            UINT8 *pcg = memregion("pcg")->base();
918918
919919            return pcg[((m_font_addr & 0x7f7f) << 4) | m_font_lr | (m_font_line & 0x0f)];
920920         }
r14976r14977
980980            return;
981981         case 0x09: //cg window font write
982982         {
983            UINT8 *pcg = machine().region("pcg")->base();
983            UINT8 *pcg = memregion("pcg")->base();
984984
985985            pcg[((m_font_addr & 0x7f7f) << 4) | m_font_lr | m_font_line] = data;
986986            return;
r14976r14977
11981198
11991199READ8_MEMBER(pc9801_state::pc9801rs_wram_r)
12001200{
1201   UINT8 *WRAM = machine().region("wram")->base();
1201   UINT8 *WRAM = memregion("wram")->base();
12021202
12031203   return WRAM[offset];
12041204}
12051205
12061206WRITE8_MEMBER(pc9801_state::pc9801rs_wram_w)
12071207{
1208   UINT8 *WRAM = machine().region("wram")->base();
1208   UINT8 *WRAM = memregion("wram")->base();
12091209
12101210   WRAM[offset] = data;
12111211}
12121212
12131213READ8_MEMBER(pc9801_state::pc9801rs_ex_wram_r)
12141214{
1215   UINT8 *EX_WRAM = machine().region("ex_wram")->base();
1215   UINT8 *EX_WRAM = memregion("ex_wram")->base();
12161216
12171217   return EX_WRAM[offset];
12181218}
12191219
12201220WRITE8_MEMBER(pc9801_state::pc9801rs_ex_wram_w)
12211221{
1222   UINT8 *EX_WRAM = machine().region("ex_wram")->base();
1222   UINT8 *EX_WRAM = memregion("ex_wram")->base();
12231223
12241224   EX_WRAM[offset] = data;
12251225}
12261226
12271227READ8_MEMBER(pc9801_state::pc9801rs_ipl_r)
12281228{
1229   UINT8 *ROM = machine().region("ipl")->base();
1229   UINT8 *ROM = memregion("ipl")->base();
12301230
12311231   return ROM[(offset & 0x1ffff)+(m_rom_bank*0x20000)];
12321232}
r14976r14977
12341234READ8_MEMBER(pc9801_state::pc9801rs_knjram_r)
12351235{
12361236
1237   UINT8 *KNJRAM = machine().region("kanji")->base();
1237   UINT8 *KNJRAM = memregion("kanji")->base();
12381238
12391239   return KNJRAM[offset];
12401240}
12411241
12421242WRITE8_MEMBER(pc9801_state::pc9801rs_knjram_w)
12431243{
1244   UINT8 *KNJRAM = machine().region("kanji")->base();
1244   UINT8 *KNJRAM = memregion("kanji")->base();
12451245
12461246   KNJRAM[offset] = data;
12471247}
r14976r14977
24362436   {
24372437      UINT8 op_mode;
24382438      UINT8 *ROM;
2439      UINT8 *PRG = machine.region("fdc_data")->base();
2439      UINT8 *PRG = machine.root_device().memregion("fdc_data")->base();
24402440      int i;
24412441
2442      ROM = machine.region("fdc_bios_2dd")->base();
2442      ROM = machine.root_device().memregion("fdc_bios_2dd")->base();
24432443      op_mode = (input_port_read(machine, "ROM_LOAD") & 2) >> 1;
24442444
24452445      for(i=0;i<0x1000;i++)
24462446         ROM[i] = PRG[i+op_mode*0x8000];
24472447
2448      ROM = machine.region("fdc_bios_2hd")->base();
2448      ROM = machine.root_device().memregion("fdc_bios_2hd")->base();
24492449      op_mode = input_port_read(machine, "ROM_LOAD") & 1;
24502450
24512451      for(i=0;i<0x1000;i++)
src/mess/drivers/nakajies.c
r14976r14977
356356         m_bank_base[i] = m_rom_base + ( ( ( ( m_bank[i] & 0x0f ) ^ 0xf ) << 17 ) % m_rom_size );
357357      }
358358   }
359   memory_set_bankptr( machine(), "bank0", m_bank_base[0] );
360   memory_set_bankptr( machine(), "bank1", m_bank_base[1] );
361   memory_set_bankptr( machine(), "bank2", m_bank_base[2] );
362   memory_set_bankptr( machine(), "bank3", m_bank_base[3] );
363   memory_set_bankptr( machine(), "bank4", m_bank_base[4] );
364   memory_set_bankptr( machine(), "bank5", m_bank_base[5] );
365   memory_set_bankptr( machine(), "bank6", m_bank_base[6] );
366   memory_set_bankptr( machine(), "bank7", m_bank_base[7] );
359   membank( "bank0" )->set_base( m_bank_base[0] );
360   membank( "bank1" )->set_base( m_bank_base[1] );
361   membank( "bank2" )->set_base( m_bank_base[2] );
362   membank( "bank3" )->set_base( m_bank_base[3] );
363   membank( "bank4" )->set_base( m_bank_base[4] );
364   membank( "bank5" )->set_base( m_bank_base[5] );
365   membank( "bank6" )->set_base( m_bank_base[6] );
366   membank( "bank7" )->set_base( m_bank_base[7] );
367367}
368368
369369void nakajies_state::bank_w( UINT8 banknr, offs_t offset, UINT8 data )
r14976r14977
623623
624624void nakajies_state::machine_start()
625625{
626   m_rom_base = machine().region("bios")->base();
627   m_rom_size = machine().region("bios")->bytes();
626   m_rom_base = memregion("bios")->base();
627   m_rom_size = memregion("bios")->bytes();
628628
629629   const char *gamename = machine().system().name;
630630
r14976r14977
633633   {
634634      m_ram_size = 256 * 1024;
635635   }
636   m_ram_base = machine().region_alloc( "mainram", m_ram_size, 1, ENDIANNESS_LITTLE )->base();
636   m_ram_base = machine().memory().region_alloc( "mainram", m_ram_size, 1, ENDIANNESS_LITTLE )->base();
637637}
638638
639639
src/mess/drivers/mz2000.c
r14976r14977
7474static SCREEN_UPDATE_IND16( mz2000 )
7575{
7676   mz2000_state *state = screen.machine().driver_data<mz2000_state>();
77   UINT8 *tvram = screen.machine().region("tvram")->base();
78   UINT8 *gvram = screen.machine().region("gvram")->base();
79   UINT8 *gfx_data = screen.machine().region("chargen")->base();
77   UINT8 *tvram = screen.machine().root_device().memregion("tvram")->base();
78   UINT8 *gvram = screen.machine().root_device().memregion("gvram")->base();
79   UINT8 *gfx_data = state->memregion("chargen")->base();
8080   int x,y,xi,yi;
8181   UINT8 x_size;
8282   UINT32 count;
r14976r14977
170170
171171READ8_MEMBER(mz2000_state::mz2000_ipl_r)
172172{
173   UINT8 *ipl = machine().region("ipl")->base();
173   UINT8 *ipl = memregion("ipl")->base();
174174
175175   return ipl[offset];
176176}
177177
178178READ8_MEMBER(mz2000_state::mz2000_wram_r)
179179{
180   UINT8 *wram = machine().region("wram")->base();
180   UINT8 *wram = memregion("wram")->base();
181181
182182   return wram[offset];
183183}
184184
185185WRITE8_MEMBER(mz2000_state::mz2000_wram_w)
186186{
187   UINT8 *wram = machine().region("wram")->base();
187   UINT8 *wram = memregion("wram")->base();
188188
189189   wram[offset] = data;
190190}
191191
192192READ8_MEMBER(mz2000_state::mz2000_tvram_r)
193193{
194   UINT8 *tvram = machine().region("tvram")->base();
194   UINT8 *tvram = memregion("tvram")->base();
195195
196196   return tvram[offset];
197197}
198198
199199WRITE8_MEMBER(mz2000_state::mz2000_tvram_w)
200200{
201   UINT8 *tvram = machine().region("tvram")->base();
201   UINT8 *tvram = memregion("tvram")->base();
202202
203203   tvram[offset] = data;
204204}
205205
206206READ8_MEMBER(mz2000_state::mz2000_gvram_r)
207207{
208   UINT8 *gvram = machine().region("gvram")->base();
208   UINT8 *gvram = memregion("gvram")->base();
209209
210210   return gvram[offset+m_gvram_bank*0x4000];
211211}
212212
213213WRITE8_MEMBER(mz2000_state::mz2000_gvram_w)
214214{
215   UINT8 *gvram = machine().region("gvram")->base();
215   UINT8 *gvram = memregion("gvram")->base();
216216
217217   gvram[offset+m_gvram_bank*0x4000] = data;
218218}
src/mess/drivers/osbexec.c
r14976r14977
7878      if ( m_pia0_porta & 0x01 )
7979         m_ram_0000 += 0x10000;
8080
81      memory_set_bankptr( machine, "0000", m_ram_0000 + 0x0000 );
82      memory_set_bankptr( machine, "2000", m_ram_0000 + 0x2000 );
83      memory_set_bankptr( machine, "4000", m_ram_0000 + 0x4000 );
81      membank( "0000" )->set_base( m_ram_0000 + 0x0000 );
82      membank( "2000" )->set_base( m_ram_0000 + 0x2000 );
83      membank( "4000" )->set_base( m_ram_0000 + 0x4000 );
8484      m_ram_c000 = m_ram_0000 + 0xc000;
85      memory_set_bankptr( machine, "e000", m_ram_0000 + 0xe000 );
85      membank( "e000" )->set_base( m_ram_0000 + 0xe000 );
8686
8787      if ( m_pia0_porta & 0x80 )
8888      {
89         memory_set_bankptr( machine, "0000", machine.region("maincpu")->base());
89         membank( "0000" )->set_base( memregion("maincpu")->base());
9090         /* When BIOS is enabled 2000-3FFF is set to the "ROM RAM" */
91         memory_set_bankptr( machine, "2000", ram_ptr + 0x20000 );
91         membank( "2000" )->set_base( ram_ptr + 0x20000 );
9292      }
9393
9494      if ( m_pia0_porta & 0x40 )
r14976r14977
606606{
607607   osbexec_state *state = machine.driver_data<osbexec_state>();
608608
609   state->m_fontram_region = machine.region_alloc( "fontram", 0x1000, 1, ENDIANNESS_LITTLE);
610   state->m_vram_region = machine.region_alloc( "vram", 0x2000, 1, ENDIANNESS_LITTLE );
609   state->m_fontram_region = machine.memory().region_alloc( "fontram", 0x1000, 1, ENDIANNESS_LITTLE);
610   state->m_vram_region = machine.memory().region_alloc( "vram", 0x2000, 1, ENDIANNESS_LITTLE );
611611   state->m_vram = state->m_vram_region->base();
612612   state->m_fontram = state->m_fontram_region->base();
613613
src/mess/drivers/z100.c
r14976r14977
814814
815815static DRIVER_INIT( z100 )
816816{
817   UINT8 *ROM = machine.region("ipl")->base();
817   UINT8 *ROM = machine.root_device().memregion("ipl")->base();
818818
819819   ROM[0xfc116 & 0x3fff] = 0x90; // patch parity IRQ check
820820   ROM[0xfc117 & 0x3fff] = 0x90;
src/mess/drivers/v6809.c
r14976r14977
229229static VIDEO_START( v6809 )
230230{
231231   v6809_state *state = machine.driver_data<v6809_state>();
232   state->m_p_chargen = machine.region("chargen")->base();
233   state->m_p_videoram = machine.region("videoram")->base();
232   state->m_p_chargen = machine.root_device().memregion("chargen")->base();
233   state->m_p_videoram = state->memregion("videoram")->base();
234234}
235235
236236static const mc6845_interface v6809_crtc = {
src/mess/drivers/mmd1.c
r14976r14977
360360
361361READ8_MEMBER( mmd1_state::mmd2_bank_r )
362362{
363   memory_set_bank(machine(), "bank1", offset);
364   memory_set_bank(machine(), "bank2", offset);
365   memory_set_bank(machine(), "bank3", offset);
366   memory_set_bank(machine(), "bank4", offset);
367   memory_set_bank(machine(), "bank5", offset);
368   memory_set_bank(machine(), "bank6", offset);
369   memory_set_bank(machine(), "bank7", offset);
370   memory_set_bank(machine(), "bank8", offset);
363   membank("bank1")->set_entry(offset);
364   membank("bank2")->set_entry(offset);
365   membank("bank3")->set_entry(offset);
366   membank("bank4")->set_entry(offset);
367   membank("bank5")->set_entry(offset);
368   membank("bank6")->set_entry(offset);
369   membank("bank7")->set_entry(offset);
370   membank("bank8")->set_entry(offset);
371371   return 0xff;
372372}
373373
r14976r14977
446446
447447static MACHINE_RESET( mmd2 )
448448{
449   memory_set_bank(machine, "bank1", 0);
450   memory_set_bank(machine, "bank2", 0);
451   memory_set_bank(machine, "bank3", 0);
452   memory_set_bank(machine, "bank4", 0);
453   memory_set_bank(machine, "bank5", 0);
454   memory_set_bank(machine, "bank6", 0);
455   memory_set_bank(machine, "bank7", 0);
456   memory_set_bank(machine, "bank8", 0);
449   mmd1_state *state = machine.driver_data<mmd1_state>();
450   state->membank("bank1")->set_entry(0);
451   state->membank("bank2")->set_entry(0);
452   state->membank("bank3")->set_entry(0);
453   state->membank("bank4")->set_entry(0);
454   state->membank("bank5")->set_entry(0);
455   state->membank("bank6")->set_entry(0);
456   state->membank("bank7")->set_entry(0);
457   state->membank("bank8")->set_entry(0);
457458}
458459
459460DRIVER_INIT( mmd2 )
r14976r14977
462463We preset all banks here, so that bankswitching will incur no speed penalty.
4634640000/0400 indicate ROMs, D800/DC00/E400 indicate RAM, 8000 is a dummy write area for ROM banks.
464465*/
465
466   UINT8 *p_ram = machine.region("maincpu")->base();
467   memory_configure_bank(machine, "bank1", 0, 1, &p_ram[0x0000], 0);
468   memory_configure_bank(machine, "bank1", 1, 1, &p_ram[0xd800], 0);
469   memory_configure_bank(machine, "bank1", 2, 1, &p_ram[0x0c00], 0);
470   memory_configure_bank(machine, "bank2", 0, 1, &p_ram[0x8000], 0);
471   memory_configure_bank(machine, "bank2", 1, 1, &p_ram[0xd800], 0);
472   memory_configure_bank(machine, "bank2", 2, 1, &p_ram[0x8000], 0);
473   memory_configure_bank(machine, "bank3", 0, 1, &p_ram[0x0400], 0);
474   memory_configure_bank(machine, "bank3", 1, 1, &p_ram[0xdc00], 0);
475   memory_configure_bank(machine, "bank3", 2, 1, &p_ram[0xdc00], 0);
476   memory_configure_bank(machine, "bank4", 0, 1, &p_ram[0x8000], 0);
477   memory_configure_bank(machine, "bank4", 1, 1, &p_ram[0xdc00], 0);
478   memory_configure_bank(machine, "bank4", 2, 1, &p_ram[0xdc00], 0);
479   memory_configure_bank(machine, "bank5", 0, 1, &p_ram[0xd800], 0);
480   memory_configure_bank(machine, "bank5", 1, 1, &p_ram[0x0000], 0);
481   memory_configure_bank(machine, "bank5", 2, 1, &p_ram[0x0000], 0);
482   memory_configure_bank(machine, "bank6", 0, 1, &p_ram[0xd800], 0);
483   memory_configure_bank(machine, "bank6", 1, 1, &p_ram[0x8000], 0);
484   memory_configure_bank(machine, "bank6", 2, 1, &p_ram[0x8000], 0);
485   memory_configure_bank(machine, "bank7", 0, 1, &p_ram[0xe400], 0);
486   memory_configure_bank(machine, "bank7", 1, 1, &p_ram[0x0c00], 0);
487   memory_configure_bank(machine, "bank7", 2, 1, &p_ram[0xd800], 0);
488   memory_configure_bank(machine, "bank8", 0, 1, &p_ram[0xe400], 0);
489   memory_configure_bank(machine, "bank8", 1, 1, &p_ram[0x8000], 0);
490   memory_configure_bank(machine, "bank8", 2, 1, &p_ram[0xd800], 0);
466   mmd1_state *state = machine.driver_data<mmd1_state>();
467   UINT8 *p_ram = machine.root_device().memregion("maincpu")->base();
468   state->membank("bank1")->configure_entry(0, &p_ram[0x0000]);
469   state->membank("bank1")->configure_entry(1, &p_ram[0xd800]);
470   state->membank("bank1")->configure_entry(2, &p_ram[0x0c00]);
471   state->membank("bank2")->configure_entry(0, &p_ram[0x8000]);
472   state->membank("bank2")->configure_entry(1, &p_ram[0xd800]);
473   state->membank("bank2")->configure_entry(2, &p_ram[0x8000]);
474   state->membank("bank3")->configure_entry(0, &p_ram[0x0400]);
475   state->membank("bank3")->configure_entry(1, &p_ram[0xdc00]);
476   state->membank("bank3")->configure_entry(2, &p_ram[0xdc00]);
477   state->membank("bank4")->configure_entry(0, &p_ram[0x8000]);
478   state->membank("bank4")->configure_entry(1, &p_ram[0xdc00]);
479   state->membank("bank4")->configure_entry(2, &p_ram[0xdc00]);
480   state->membank("bank5")->configure_entry(0, &p_ram[0xd800]);
481   state->membank("bank5")->configure_entry(1, &p_ram[0x0000]);
482   state->membank("bank5")->configure_entry(2, &p_ram[0x0000]);
483   state->membank("bank6")->configure_entry(0, &p_ram[0xd800]);
484   state->membank("bank6")->configure_entry(1, &p_ram[0x8000]);
485   state->membank("bank6")->configure_entry(2, &p_ram[0x8000]);
486   state->membank("bank7")->configure_entry(0, &p_ram[0xe400]);
487   state->membank("bank7")->configure_entry(1, &p_ram[0x0c00]);
488   state->membank("bank7")->configure_entry(2, &p_ram[0xd800]);
489   state->membank("bank8")->configure_entry(0, &p_ram[0xe400]);
490   state->membank("bank8")->configure_entry(1, &p_ram[0x8000]);
491   state->membank("bank8")->configure_entry(2, &p_ram[0xd800]);
491492}
492493
493494static MACHINE_CONFIG_START( mmd1, mmd1_state )
src/mess/drivers/mc1000.c
r14976r14977
2929   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
3030
3131   /* MC6845 video RAM */
32   memory_set_bank(machine(), "bank2", m_mc6845_bank);
32   membank("bank2")->set_entry(m_mc6845_bank);
3333
3434   /* extended RAM */
3535   if (m_ram->size() > 16*1024)
r14976r14977
5858      program->install_readwrite_bank(0x8000, 0x97ff, "bank4");
5959   }
6060
61   memory_set_bank(machine(), "bank4", m_mc6847_bank);
61   membank("bank4")->set_entry(m_mc6847_bank);
6262
6363   /* extended RAM */
6464   if (m_ram->size() > 16*1024)
r14976r14977
326326   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
327327
328328   /* setup memory banking */
329   UINT8 *rom = machine().region(Z80_TAG)->base();
329   UINT8 *rom = memregion(Z80_TAG)->base();
330330
331331   program->install_readwrite_bank(0x0000, 0x1fff, "bank1");
332   memory_configure_bank(machine(), "bank1", 0, 1, rom, 0);
333   memory_configure_bank(machine(), "bank1", 1, 1, rom + 0xc000, 0);
334   memory_set_bank(machine(), "bank1", 1);
332   membank("bank1")->configure_entry(0, rom);
333   membank("bank1")->configure_entry(1, rom + 0xc000);
334   membank("bank1")->set_entry(1);
335335
336336   m_rom0000 = 1;
337337
338338   program->install_readwrite_bank(0x2000, 0x27ff, "bank2");
339   memory_configure_bank(machine(), "bank2", 0, 1, rom + 0x2000, 0);
340   memory_configure_bank(machine(), "bank2", 1, 1, m_mc6845_video_ram, 0);
341   memory_set_bank(machine(), "bank2", 0);
339   membank("bank2")->configure_entry(0, rom + 0x2000);
340   membank("bank2")->configure_entry(1, m_mc6845_video_ram);
341   membank("bank2")->set_entry(0);
342342
343   memory_configure_bank(machine(), "bank3", 0, 1, rom + 0x4000, 0);
344   memory_set_bank(machine(), "bank3", 0);
343   membank("bank3")->configure_entry(0, rom + 0x4000);
344   membank("bank3")->set_entry(0);
345345
346   memory_configure_bank(machine(), "bank4", 0, 1, m_mc6847_video_ram, 0);
347   memory_configure_bank(machine(), "bank4", 1, 1, rom + 0x8000, 0);
348   memory_set_bank(machine(), "bank4", 0);
346   membank("bank4")->configure_entry(0, m_mc6847_video_ram);
347   membank("bank4")->configure_entry(1, rom + 0x8000);
348   membank("bank4")->set_entry(0);
349349
350   memory_configure_bank(machine(), "bank5", 0, 1, rom + 0x9800, 0);
351   memory_set_bank(machine(), "bank5", 0);
350   membank("bank5")->configure_entry(0, rom + 0x9800);
351   membank("bank5")->set_entry(0);
352352
353353   bankswitch();
354354
r14976r14977
363363
364364void mc1000_state::machine_reset()
365365{
366   memory_set_bank(machine(), "bank1", 1);
366   membank("bank1")->set_entry(1);
367367
368368   m_rom0000 = 1;
369369}
r14976r14977
488488   {
489489      if (address >= 0xc000)
490490      {
491         memory_set_bank(machine(), "bank1", 0);
491         membank("bank1")->set_entry(0);
492492         m_rom0000 = 0;
493493      }
494494   }
src/mess/drivers/pt68k4.c
r14976r14977
3939static MACHINE_RESET(pt68k4)
4040{
4141   pt68k4_state *state = machine.driver_data<pt68k4_state>();
42   UINT8* user1 = machine.region("user1")->base();
42   UINT8* user1 = state->memregion("user1")->base();
4343
4444   memcpy((UINT8*)state->m_p_ram.target(), user1, 8);
4545
src/mess/drivers/adam.c
r14976r14977
258258      if (BIT(m_adamnet, 1))
259259      {
260260         program->unmap_readwrite(0x0000, 0x5fff);
261         program->install_rom(0x6000, 0x7fff, machine().region("wp")->base() + 0x8000);
261         program->install_rom(0x6000, 0x7fff, memregion("wp")->base() + 0x8000);
262262      }
263263      else
264264      {
265         program->install_rom(0x0000, 0x7fff, machine().region("wp")->base());
265         program->install_rom(0x0000, 0x7fff, memregion("wp")->base());
266266      }
267267      break;
268268
r14976r14977
278278      break;
279279
280280   case LO_OS7_ROM_INTERNAL_RAM:
281      program->install_rom(0x0000, 0x1fff, machine().region("os7")->base());
281      program->install_rom(0x0000, 0x1fff, memregion("os7")->base());
282282      program->install_ram(0x2000, 0x7fff, ram + 0x2000);
283283      break;
284284   }
r14976r14977
290290      break;
291291
292292   case HI_ROM_EXPANSION:
293      program->install_rom(0x8000, 0xffff, machine().region("xrom")->base());
293      program->install_rom(0x8000, 0xffff, memregion("xrom")->base());
294294      break;
295295
296296   case HI_RAM_EXPANSION:
297297      if (m_game)
298298      {
299         program->install_rom(0x8000, 0xffff, machine().region("cart")->base());
299         program->install_rom(0x8000, 0xffff, memregion("cart")->base());
300300      }
301301      else
302302      {
r14976r14977
308308      break;
309309
310310   case HI_CARTRIDGE_ROM:
311      program->install_rom(0x8000, 0xffff, machine().region("cart")->base());
311      program->install_rom(0x8000, 0xffff, memregion("cart")->base());
312312      break;
313313   }
314314}
src/mess/drivers/msbc1.c
r14976r14977
6666void msbc1_state::machine_reset()
6767{
6868   void *ram = machine().firstcpu->memory().space(AS_PROGRAM)->get_write_ptr(0);
69   UINT8 *rom = machine().region(MC68000R12_TAG)->base();
69   UINT8 *rom = memregion(MC68000R12_TAG)->base();
7070
7171   memcpy(ram, rom, 8);
7272
src/mess/drivers/unixpc.c
r14976r14977
6666   if (BIT(data, 15))
6767      space.install_ram(0x000000, 0x3fffff, m_ram->pointer());
6868   else
69      space.install_rom(0x000000, 0x3fffff, space.machine().region("bootrom")->base());
69      space.install_rom(0x000000, 0x3fffff, space.machine().root_device().memregion("bootrom")->base());
7070}
7171
7272void unixpc_state::machine_reset()
src/mess/drivers/mini2440.c
r14976r14977
170170   state->m_nand = machine.device<nand_device>( "nand");
171171   state->m_dac[0] = machine.device( "dac1");
172172   state->m_dac[1] = machine.device( "dac2");
173   state->m_nand->set_data_ptr(machine.region("nand")->base());
173   state->m_nand->set_data_ptr(state->memregion("nand")->base());
174174}
175175 
176176static MACHINE_RESET( mini2440 )
src/mess/drivers/pc88va.c
r14976r14977
110110static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
111111{
112112   pc88va_state *state = machine.driver_data<pc88va_state>();
113   UINT16 *tvram = (UINT16 *)(*machine.region("tvram"));
113   UINT16 *tvram = (UINT16 *)(*state->memregion("tvram"));
114114   int offs,i;
115115
116116   offs = state->m_tsp.spr_offset;
r14976r14977
220220static void draw_text(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
221221{
222222   pc88va_state *state = machine.driver_data<pc88va_state>();
223   UINT8 *tvram = machine.region("tvram")->base();
224   UINT8 *kanji = machine.region("kanji")->base();
223   UINT8 *tvram = machine.root_device().memregion("tvram")->base();
224   UINT8 *kanji = state->memregion("kanji")->base();
225225   int xi,yi;
226226   int x,y;
227227   int res_x,res_y;
r14976r14977
463463         return 0xffff;
464464      case 1: // TVRAM
465465      {
466         UINT16 *tvram = (UINT16 *)(*machine().region("tvram"));
466         UINT16 *tvram = (UINT16 *)(*machine().root_device().memregion("tvram"));
467467
468468         if(((offset*2) & 0x30000) == 0)
469469            return tvram[offset];
r14976r14977
472472      }
473473      case 4:
474474      {
475         UINT16 *gvram = (UINT16 *)(*machine().region("gvram"));
475         UINT16 *gvram = (UINT16 *)(*machine().root_device().memregion("gvram"));
476476
477477         return gvram[offset];
478478      }
479479      case 8: // kanji ROM
480480      case 9:
481481      {
482         UINT16 *knj_ram = (UINT16 *)(*machine().region("kanji"));
482         UINT16 *knj_ram = (UINT16 *)(*machine().root_device().memregion("kanji"));
483483         UINT32 knj_offset;
484484
485485         knj_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000));
r14976r14977
495495      case 0xc: // Dictionary ROM
496496      case 0xd:
497497      {
498         UINT16 *dic_rom = (UINT16 *)(*machine().region("dictionary"));
498         UINT16 *dic_rom = (UINT16 *)(*machine().root_device().memregion("dictionary"));
499499         UINT32 dic_offset;
500500
501501         dic_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000));
r14976r14977
515515         break;
516516      case 1: // TVRAM
517517      {
518         UINT16 *tvram = (UINT16 *)(*machine().region("tvram"));
518         UINT16 *tvram = (UINT16 *)(*machine().root_device().memregion("tvram"));
519519
520520         if(((offset*2) & 0x30000) == 0)
521521            COMBINE_DATA(&tvram[offset]);
r14976r14977
523523      break;
524524      case 4: // TVRAM
525525      {
526         UINT16 *gvram = (UINT16 *)(*machine().region("gvram"));
526         UINT16 *gvram = (UINT16 *)(*machine().root_device().memregion("gvram"));
527527
528528         COMBINE_DATA(&gvram[offset]);
529529      }
r14976r14977
531531      case 8: // kanji ROM, backup RAM at 0xb0000 - 0xb3fff
532532      case 9:
533533      {
534         UINT16 *knj_ram = (UINT16 *)(*machine().region("kanji"));
534         UINT16 *knj_ram = (UINT16 *)(*machine().root_device().memregion("kanji"));
535535         UINT32 knj_offset;
536536
537537         knj_offset = ((offset) + (((m_bank_reg & 0x100) >> 8)*0x20000));
r14976r14977
886886
887887   /* RBC1 */
888888   {
889      UINT8 *ROM10 = machine().region("rom10")->base();
889      UINT8 *ROM10 = memregion("rom10")->base();
890890
891891      if((m_bank_reg & 0xe0) == 0x00)
892         memory_set_bankptr(machine(), "rom10_bank", &ROM10[(m_bank_reg & 0x10) ? 0x10000 : 0x00000]);
892         membank("rom10_bank")->set_base(&ROM10[(m_bank_reg & 0x10) ? 0x10000 : 0x00000]);
893893   }
894894
895895   /* RBC0 */
896896   {
897      UINT8 *ROM00 = machine().region("rom00")->base();
897      UINT8 *ROM00 = memregion("rom00")->base();
898898
899      memory_set_bankptr(machine(), "rom00_bank", &ROM00[(m_bank_reg & 0xf)*0x10000]); // TODO: docs says that only 0 - 5 are used, dunno why ...
899      membank("rom00_bank")->set_base(&ROM00[(m_bank_reg & 0xf)*0x10000]); // TODO: docs says that only 0 - 5 are used, dunno why ...
900900   }
901901}
902902
r14976r14977
10641064
10651065READ8_MEMBER(pc88va_state::backupram_dsw_r)
10661066{
1067   UINT16 *knj_ram = (UINT16 *)(*machine().region("kanji"));
1067   UINT16 *knj_ram = (UINT16 *)(*machine().root_device().memregion("kanji"));
10681068
10691069   if(offset == 0)
10701070      return knj_ram[(0x50000 + 0x1fc2) / 2] & 0xff;
r14976r14977
15331533static MACHINE_RESET( pc88va )
15341534{
15351535   pc88va_state *state = machine.driver_data<pc88va_state>();
1536   UINT8 *ROM00 = machine.region("rom00")->base();
1537   UINT8 *ROM10 = machine.region("rom10")->base();
1536   UINT8 *ROM00 = machine.root_device().memregion("rom00")->base();
1537   UINT8 *ROM10 = state->memregion("rom10")->base();
15381538
1539   memory_set_bankptr(machine, "rom10_bank", &ROM10[0x00000]);
1540   memory_set_bankptr(machine, "rom00_bank", &ROM00[0x00000]);
1539   state->membank("rom10_bank")->set_base(&ROM10[0x00000]);
1540   state->membank("rom00_bank")->set_base(&ROM00[0x00000]);
15411541
15421542   state->m_bank_reg = 0x4100;
15431543   state->m_backupram_wp = 1;
src/mess/drivers/pc6001.c
r14976r14977
367367static void draw_tile_text(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847)
368368{
369369   int xi,yi,pen,fgcol,color;
370   UINT8 *gfx_data = machine.region("gfx1")->base();
370   UINT8 *gfx_data = machine.root_device().memregion("gfx1")->base();
371371
372372   for(yi=0;yi<12;yi++)
373373   {
r14976r14977
570570   else if(state->m_exgfx_text_mode)
571571   {
572572      int xi,yi,pen,fgcol,bgcol,color;
573      UINT8 *gfx_data = screen.machine().region("gfx1")->base();
573      UINT8 *gfx_data = screen.machine().root_device().memregion("gfx1")->base();
574574
575575      for(y=0;y<20;y++)
576576      {
r14976r14977
619619   pc6001_state *state = screen.machine().driver_data<pc6001_state>();
620620   int x,y,tile,attr;
621621   int xi,yi,pen,fgcol,bgcol,color;
622   UINT8 *gfx_data = screen.machine().region("gfx1")->base();
622   UINT8 *gfx_data = state->memregion("gfx1")->base();
623623
624624
625625   if(state->m_sr_video_mode & 8) // text mode
r14976r14977
760760
761761static UINT8 pc6001_get_char_rom(running_machine &machine, UINT8 ch, int line)
762762{
763   UINT8 *gfx = machine.region("gfx1")->base();
763   UINT8 *gfx = machine.root_device().memregion("gfx1")->base();
764764   return gfx[ch*16+line];
765765}
766766#endif
r14976r14977
801801      m_port_c_8255 |= 0xa8;
802802
803803      {
804         UINT8 *gfx_data = machine().region("gfx1")->base();
805         UINT8 *ext_rom = machine().region("cart_img")->base();
804         UINT8 *gfx_data = memregion("gfx1")->base();
805         UINT8 *ext_rom = memregion("cart_img")->base();
806806
807807         //printf("%02x\n",data);
808808
809809         if((data & 0x0f) == 0x05)
810            memory_set_bankptr(machine(), "bank1", &ext_rom[0x2000]);
810            membank("bank1")->set_base(&ext_rom[0x2000]);
811811         if((data & 0x0f) == 0x04)
812            memory_set_bankptr(machine(), "bank1", &gfx_data[0]);
812            membank("bank1")->set_base(&gfx_data[0]);
813813      }
814814   }
815815   m_ppi->write(space,offset,data);
r14976r14977
10151015
10161016WRITE8_MEMBER(pc6001_state::pc6001m2_bank_r0_w)
10171017{
1018   UINT8 *ROM = machine().region("maincpu")->base();
1019   UINT8 *gfx_data = machine().region("gfx1")->base();
1018   UINT8 *ROM = memregion("maincpu")->base();
1019   UINT8 *gfx_data = memregion("gfx1")->base();
10201020
10211021//  bankaddress = 0x10000 + (0x4000 * ((data & 0x40)>>6));
1022//  memory_set_bankptr(machine(), 1, &ROM[bankaddress]);
1022//  membank(1)->set_base(&ROM[bankaddress]);
10231023
10241024   m_bank_r0 = data;
10251025
10261026//  printf("%02x BANK | %02x\n",data,m_bank_opt);
1027   memory_set_bankptr(machine(), "bank1", &ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][0]]);
1028   memory_set_bankptr(machine(), "bank2", &ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][1]]);
1029   memory_set_bankptr(machine(), "bank3", &ROM[banksw_table_r0[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
1027   membank("bank1")->set_base(&ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][0]]);
1028   membank("bank2")->set_base(&ROM[banksw_table_r0[(data & 0xf)+(m_bank_opt*0x10)][1]]);
1029   membank("bank3")->set_base(&ROM[banksw_table_r0[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
10301030   if(!m_gfx_bank_on)
1031      memory_set_bankptr(machine(), "bank4", &ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
1031      membank("bank4")->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
10321032   else
1033      memory_set_bankptr(machine(), "bank4", &gfx_data[m_cgrom_bank_addr]);
1033      membank("bank4")->set_base(&gfx_data[m_cgrom_bank_addr]);
10341034}
10351035
10361036WRITE8_MEMBER(pc6001_state::pc6001m2_bank_r1_w)
10371037{
1038   UINT8 *ROM = machine().region("maincpu")->base();
1038   UINT8 *ROM = memregion("maincpu")->base();
10391039
10401040//  bankaddress = 0x10000 + (0x4000 * ((data & 0x40)>>6));
1041//  memory_set_bankptr(machine(), 1, &ROM[bankaddress]);
1041//  membank(1)->set_base(&ROM[bankaddress]);
10421042
10431043   m_bank_r1 = data;
10441044
10451045//  printf("%02x BANK\n",data);
1046   memory_set_bankptr(machine(), "bank5", &ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][0]]);
1047   memory_set_bankptr(machine(), "bank6", &ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][1]]);
1048   memory_set_bankptr(machine(), "bank7", &ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
1049   memory_set_bankptr(machine(), "bank8", &ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
1046   membank("bank5")->set_base(&ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][0]]);
1047   membank("bank6")->set_base(&ROM[banksw_table_r1[(data & 0xf)+(m_bank_opt*0x10)][1]]);
1048   membank("bank7")->set_base(&ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
1049   membank("bank8")->set_base(&ROM[banksw_table_r1[((data & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
10501050}
10511051
10521052WRITE8_MEMBER(pc6001_state::pc6001m2_bank_w0_w)
r14976r14977
10561056
10571057WRITE8_MEMBER(pc6001_state::pc6001m2_opt_bank_w)
10581058{
1059   UINT8 *ROM = machine().region("maincpu")->base();
1060   UINT8 *gfx_data = machine().region("gfx1")->base();
1059   UINT8 *ROM = memregion("maincpu")->base();
1060   UINT8 *gfx_data = memregion("gfx1")->base();
10611061
10621062   /*
10631063    0 - TVROM / VOICE ROM
r14976r14977
10671067    */
10681068   m_bank_opt = data & 3;
10691069
1070   memory_set_bankptr(machine(), "bank1", &ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][0]]);
1071   memory_set_bankptr(machine(), "bank2", &ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][1]]);
1072   memory_set_bankptr(machine(), "bank3", &ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
1070   membank("bank1")->set_base(&ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][0]]);
1071   membank("bank2")->set_base(&ROM[banksw_table_r0[(m_bank_r0 & 0xf)+(m_bank_opt*0x10)][1]]);
1072   membank("bank3")->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
10731073   if(!m_gfx_bank_on)
1074      memory_set_bankptr(machine(), "bank4", &ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
1074      membank("bank4")->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
10751075   else
1076      memory_set_bankptr(machine(), "bank4", &gfx_data[m_cgrom_bank_addr]);
1077   memory_set_bankptr(machine(), "bank4", &ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
1078   memory_set_bankptr(machine(), "bank5", &ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][0]]);
1079   memory_set_bankptr(machine(), "bank6", &ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][1]]);
1080   memory_set_bankptr(machine(), "bank7", &ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
1081   memory_set_bankptr(machine(), "bank8", &ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
1076      membank("bank4")->set_base(&gfx_data[m_cgrom_bank_addr]);
1077   membank("bank4")->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
1078   membank("bank5")->set_base(&ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][0]]);
1079   membank("bank6")->set_base(&ROM[banksw_table_r1[(m_bank_r1 & 0xf)+(m_bank_opt*0x10)][1]]);
1080   membank("bank7")->set_base(&ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][2]]);
1081   membank("bank8")->set_base(&ROM[banksw_table_r1[((m_bank_r1 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
10821082
10831083}
10841084
10851085WRITE8_MEMBER(pc6001_state::work_ram0_w)
10861086{
1087   UINT8 *ROM = machine().region("maincpu")->base();
1087   UINT8 *ROM = memregion("maincpu")->base();
10881088   ROM[offset+((m_bank_w & 0x01) ? WRAM(0) : EXWRAM(0))] = data;
10891089}
10901090
10911091WRITE8_MEMBER(pc6001_state::work_ram1_w)
10921092{
1093   UINT8 *ROM = machine().region("maincpu")->base();
1093   UINT8 *ROM = memregion("maincpu")->base();
10941094   ROM[offset+((m_bank_w & 0x01) ? WRAM(1) : EXWRAM(1))] = data;
10951095}
10961096
10971097WRITE8_MEMBER(pc6001_state::work_ram2_w)
10981098{
1099   UINT8 *ROM = machine().region("maincpu")->base();
1099   UINT8 *ROM = memregion("maincpu")->base();
11001100   ROM[offset+((m_bank_w & 0x04) ? WRAM(2) : EXWRAM(2))] = data;
11011101}
11021102
11031103WRITE8_MEMBER(pc6001_state::work_ram3_w)
11041104{
1105   UINT8 *ROM = machine().region("maincpu")->base();
1105   UINT8 *ROM = memregion("maincpu")->base();
11061106   ROM[offset+((m_bank_w & 0x04) ? WRAM(3) : EXWRAM(3))] = data;
11071107}
11081108
11091109WRITE8_MEMBER(pc6001_state::work_ram4_w)
11101110{
1111   UINT8 *ROM = machine().region("maincpu")->base();
1111   UINT8 *ROM = memregion("maincpu")->base();
11121112   ROM[offset+((m_bank_w & 0x10) ? WRAM(4) : EXWRAM(4))] = data;
11131113}
11141114
11151115WRITE8_MEMBER(pc6001_state::work_ram5_w)
11161116{
1117   UINT8 *ROM = machine().region("maincpu")->base();
1117   UINT8 *ROM = memregion("maincpu")->base();
11181118   ROM[offset+((m_bank_w & 0x10) ? WRAM(5) : EXWRAM(5))] = data;
11191119}
11201120
11211121WRITE8_MEMBER(pc6001_state::work_ram6_w)
11221122{
1123   UINT8 *ROM = machine().region("maincpu")->base();
1123   UINT8 *ROM = memregion("maincpu")->base();
11241124   ROM[offset+((m_bank_w & 0x40) ? WRAM(6) : EXWRAM(6))] = data;
11251125}
11261126
11271127WRITE8_MEMBER(pc6001_state::work_ram7_w)
11281128{
1129   UINT8 *ROM = machine().region("maincpu")->base();
1129   UINT8 *ROM = memregion("maincpu")->base();
11301130   ROM[offset+((m_bank_w & 0x40) ? WRAM(7) : EXWRAM(7))] = data;
11311131}
11321132
r14976r14977
11511151      m_port_c_8255 |= 0xa8;
11521152
11531153      {
1154         UINT8 *ROM = machine().region("maincpu")->base();
1155         UINT8 *gfx_data = machine().region("gfx1")->base();
1154         UINT8 *ROM = memregion("maincpu")->base();
1155         UINT8 *gfx_data = memregion("gfx1")->base();
11561156
11571157         //printf("%02x\n",data);
11581158
11591159         if((data & 0x0f) == 0x05)
11601160         {
11611161            m_gfx_bank_on = 0;
1162            memory_set_bankptr(machine(), "bank4", &ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
1162            membank("bank4")->set_base(&ROM[banksw_table_r0[((m_bank_r0 & 0xf0)>>4)+(m_bank_opt*0x10)][3]]);
11631163         }
11641164         if((data & 0x0f) == 0x04)
11651165         {
11661166            m_gfx_bank_on = 1;
1167            memory_set_bankptr(machine(), "bank4", &gfx_data[m_cgrom_bank_addr]);
1167            membank("bank4")->set_base(&gfx_data[m_cgrom_bank_addr]);
11681168         }
11691169      }
11701170   }
r14976r14977
11741174static void vram_bank_change(running_machine &machine,UINT8 vram_bank)
11751175{
11761176   pc6001_state *state = machine.driver_data<pc6001_state>();
1177   UINT8 *work_ram = machine.region("maincpu")->base();
1177   UINT8 *work_ram = state->memregion("maincpu")->base();
11781178
11791179//  popmessage("%02x",vram_bank);
11801180
r14976r14977
14811481WRITE8_MEMBER(pc6001_state::pc6001sr_bank_rn_w)
14821482{
14831483   static const char *const bank_name[8] = { "bank1","bank2","bank3", "bank4", "bank5", "bank6", "bank7", "bank8" };
1484   UINT8 *ROM = machine().region("maincpu")->base();
1484   UINT8 *ROM = memregion("maincpu")->base();
14851485   UINT8 bank_num;
14861486
14871487   m_sr_bank_r[offset] = data;
r14976r14977
14891489
14901490   switch(data & 0xf0)
14911491   {
1492      case 0xf0: memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_SYSROM_1(bank_num)]); break;
1493      case 0xe0: memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_SYSROM_2(bank_num)]); break;
1494      case 0xd0: memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_CGROM1(bank_num)]); break;
1495      case 0xc0: memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_EXROM0(bank_num)]); break;
1496      case 0xb0: memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_EXROM1(bank_num)]); break;
1497      case 0x20: memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_EXRAM0(bank_num)]); break;
1498      case 0x00: memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_WRAM0(bank_num)]); break;
1499      default:   memory_set_bankptr(machine(), bank_name[offset], &ROM[SR_NULL(bank_num)]); break;
1492      case 0xf0: membank(bank_name[offset])->set_base(&ROM[SR_SYSROM_1(bank_num)]); break;
1493      case 0xe0: membank(bank_name[offset])->set_base(&ROM[SR_SYSROM_2(bank_num)]); break;
1494      case 0xd0: membank(bank_name[offset])->set_base(&ROM[SR_CGROM1(bank_num)]); break;
1495      case 0xc0: membank(bank_name[offset])->set_base(&ROM[SR_EXROM0(bank_num)]); break;
1496      case 0xb0: membank(bank_name[offset])->set_base(&ROM[SR_EXROM1(bank_num)]); break;
1497      case 0x20: membank(bank_name[offset])->set_base(&ROM[SR_EXRAM0(bank_num)]); break;
1498      case 0x00: membank(bank_name[offset])->set_base(&ROM[SR_WRAM0(bank_num)]); break;
1499      default:   membank(bank_name[offset])->set_base(&ROM[SR_NULL(bank_num)]); break;
15001500   }
15011501}
15021502
r14976r14977
15121512
15131513#define SR_WRAM_BANK_W(_v_) \
15141514{ \
1515   UINT8 *ROM = machine().region("maincpu")->base(); \
1515   UINT8 *ROM = memregion("maincpu")->base(); \
15161516   UINT8 bank_num; \
15171517   bank_num = m_sr_bank_w[_v_] & 0x0f; \
15181518   if((m_sr_bank_w[_v_] & 0xf0) != 0x20) \
r14976r14977
15401540
15411541WRITE8_MEMBER(pc6001_state::pc6001sr_vram_bank_w)
15421542{
1543   UINT8 *work_ram = machine().region("maincpu")->base();
1543   UINT8 *work_ram = memregion("maincpu")->base();
15441544
15451545   m_video_ram = work_ram + 0x70000 + ((data & 0x0f)*0x1000);
15461546}
r14976r14977
15911591
15921592      if(0)
15931593      {
1594         UINT8 *gfx_data = machine().region("gfx1")->base();
1595         UINT8 *ext_rom = machine().region("cart_img")->base();
1594         UINT8 *gfx_data = memregion("gfx1")->base();
1595         UINT8 *ext_rom = memregion("cart_img")->base();
15961596
15971597         //printf("%02x\n",data);
15981598
15991599         if((data & 0x0f) == 0x05)
1600            memory_set_bankptr(machine(), "bank1", &ext_rom[0x2000]);
1600            membank("bank1")->set_base(&ext_rom[0x2000]);
16011601         if((data & 0x0f) == 0x04)
1602            memory_set_bankptr(machine(), "bank1", &gfx_data[0]);
1602            membank("bank1")->set_base(&gfx_data[0]);
16031603      }
16041604   }
16051605   m_ppi->write(space,offset,data);
r14976r14977
20022002      else
20032003         cas_data_i>>=1;
20042004      #else
2005         UINT8 *cas_data = timer.machine().region("cas")->base();
2005         UINT8 *cas_data = timer.machine().root_device().memregion("cas")->base();
20062006
20072007         state->m_cur_keycode = cas_data[state->m_cas_offset++];
20082008         popmessage("%04x %04x",state->m_cas_offset,state->m_cas_maxsize);
r14976r14977
20732073static MACHINE_RESET(pc6001)
20742074{
20752075   pc6001_state *state = machine.driver_data<pc6001_state>();
2076   UINT8 *work_ram = machine.region("maincpu")->base();
2076   UINT8 *work_ram = state->memregion("maincpu")->base();
20772077
20782078   state->m_video_ram =  work_ram + 0xc000;
20792079
r14976r14977
20912091static MACHINE_RESET(pc6001m2)
20922092{
20932093   pc6001_state *state = machine.driver_data<pc6001_state>();
2094   UINT8 *work_ram = machine.region("maincpu")->base();
2094   UINT8 *work_ram = machine.root_device().memregion("maincpu")->base();
20952095
20962096   state->m_video_ram = work_ram + 0xc000 + 0x28000;
20972097
r14976r14977
21032103
21042104   /* set default bankswitch */
21052105   {
2106      UINT8 *ROM = machine.region("maincpu")->base();
2106      UINT8 *ROM = state->memregion("maincpu")->base();
21072107      state->m_bank_r0 = 0x71;
2108      memory_set_bankptr(machine, "bank1", &ROM[BASICROM(0)]);
2109      memory_set_bankptr(machine, "bank2", &ROM[BASICROM(1)]);
2110      memory_set_bankptr(machine, "bank3", &ROM[EXROM(0)]);
2111      memory_set_bankptr(machine, "bank4", &ROM[EXROM(1)]);
2108      state->membank("bank1")->set_base(&ROM[BASICROM(0)]);
2109      state->membank("bank2")->set_base(&ROM[BASICROM(1)]);
2110      state->membank("bank3")->set_base(&ROM[EXROM(0)]);
2111      state->membank("bank4")->set_base(&ROM[EXROM(1)]);
21122112      state->m_bank_r1 = 0xdd;
2113      memory_set_bankptr(machine, "bank5", &ROM[WRAM(4)]);
2114      memory_set_bankptr(machine, "bank6", &ROM[WRAM(5)]);
2115      memory_set_bankptr(machine, "bank7", &ROM[WRAM(6)]);
2116      memory_set_bankptr(machine, "bank8", &ROM[WRAM(7)]);
2113      state->membank("bank5")->set_base(&ROM[WRAM(4)]);
2114      state->membank("bank6")->set_base(&ROM[WRAM(5)]);
2115      state->membank("bank7")->set_base(&ROM[WRAM(6)]);
2116      state->membank("bank8")->set_base(&ROM[WRAM(7)]);
21172117      state->m_bank_opt = 0x02; //tv rom
21182118      state->m_bank_w = 0x50; //enable write to work ram 4,5,6,7
21192119      state->m_gfx_bank_on = 0;
r14976r14977
21272127static MACHINE_RESET(pc6001sr)
21282128{
21292129   pc6001_state *state = machine.driver_data<pc6001_state>();
2130   UINT8 *work_ram = machine.region("maincpu")->base();
2130   UINT8 *work_ram = machine.root_device().memregion("maincpu")->base();
21312131
21322132   state->m_video_ram = work_ram + 0x70000;
21332133
r14976r14977
21392139
21402140   /* set default bankswitch */
21412141   {
2142      UINT8 *ROM = machine.region("maincpu")->base();
2143      state->m_sr_bank_r[0] = 0xf8; memory_set_bankptr(machine, "bank1", &ROM[SR_SYSROM_1(0x08)]);
2144      state->m_sr_bank_r[1] = 0xfa; memory_set_bankptr(machine, "bank2", &ROM[SR_SYSROM_1(0x0a)]);
2145      state->m_sr_bank_r[2] = 0xb0; memory_set_bankptr(machine, "bank3", &ROM[SR_EXROM1(0x00)]);
2146      state->m_sr_bank_r[3] = 0xc0; memory_set_bankptr(machine, "bank4", &ROM[SR_EXROM0(0x00)]);
2147      state->m_sr_bank_r[4] = 0x08; memory_set_bankptr(machine, "bank5", &ROM[SR_WRAM0(0x08)]);
2148      state->m_sr_bank_r[5] = 0x0a; memory_set_bankptr(machine, "bank6", &ROM[SR_WRAM0(0x0a)]);
2149      state->m_sr_bank_r[6] = 0x0c; memory_set_bankptr(machine, "bank7", &ROM[SR_WRAM0(0x0c)]);
2150      state->m_sr_bank_r[7] = 0x0e; memory_set_bankptr(machine, "bank8", &ROM[SR_WRAM0(0x0e)]);
2142      UINT8 *ROM = state->memregion("maincpu")->base();
2143      state->m_sr_bank_r[0] = 0xf8; state->membank("bank1")->set_base(&ROM[SR_SYSROM_1(0x08)]);
2144      state->m_sr_bank_r[1] = 0xfa; state->membank("bank2")->set_base(&ROM[SR_SYSROM_1(0x0a)]);
2145      state->m_sr_bank_r[2] = 0xb0; state->membank("bank3")->set_base(&ROM[SR_EXROM1(0x00)]);
2146      state->m_sr_bank_r[3] = 0xc0; state->membank("bank4")->set_base(&ROM[SR_EXROM0(0x00)]);
2147      state->m_sr_bank_r[4] = 0x08; state->membank("bank5")->set_base(&ROM[SR_WRAM0(0x08)]);
2148      state->m_sr_bank_r[5] = 0x0a; state->membank("bank6")->set_base(&ROM[SR_WRAM0(0x0a)]);
2149      state->m_sr_bank_r[6] = 0x0c; state->membank("bank7")->set_base(&ROM[SR_WRAM0(0x0c)]);
2150      state->m_sr_bank_r[7] = 0x0e; state->membank("bank8")->set_base(&ROM[SR_WRAM0(0x0e)]);
21512151//      state->m_bank_opt = 0x02; //tv rom
21522152
21532153      /* enable default work RAM writes */
r14976r14977
22372237static DEVICE_IMAGE_LOAD( pc6001_cass )
22382238{
22392239   pc6001_state *state = image.device().machine().driver_data<pc6001_state>();
2240   UINT8 *cas = image.device().machine().region("cas")->base();
2240   UINT8 *cas = state->memregion("cas")->base();
22412241   UINT32 size;
22422242
22432243   size = image.length();
src/mess/drivers/mycom.c
r14976r14977
117117
118118VIDEO_START_MEMBER( mycom_state )
119119{
120   m_p_videoram = machine().region("vram")->base();
121   m_p_chargen = machine().region("chargen")->base();
120   m_p_videoram = memregion("vram")->base();
121   m_p_chargen = memregion("chargen")->base();
122122}
123123
124124static MC6845_UPDATE_ROW( mycom_update_row )
r14976r14977
181181{
182182   switch(data)
183183   {
184      case 0x00: memory_set_bank(machine(), "boot", 1); break;
185      case 0x01: memory_set_bank(machine(), "boot", 0); break;
184      case 0x00: membank("boot")->set_entry(1); break;
185      case 0x01: membank("boot")->set_entry(0); break;
186186      case 0x02: m_upper_sw = 0x10000; break;
187187      case 0x03: m_upper_sw = 0x0c000; break;
188188   }
r14976r14977
537537
538538MACHINE_START_MEMBER(mycom_state)
539539{
540   m_p_ram = machine().region("maincpu")->base();
540   m_p_ram = memregion("maincpu")->base();
541541}
542542
543543MACHINE_RESET_MEMBER(mycom_state)
544544{
545   memory_set_bank(machine(), "boot", 1);
545   membank("boot")->set_entry(1);
546546   m_upper_sw = 0x10000;
547547   m_0a = 0;
548548}
549549
550550static DRIVER_INIT( mycom )
551551{
552   UINT8 *RAM = machine.region("maincpu")->base();
553   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x10000);
552   mycom_state *state = machine.driver_data<mycom_state>();
553   UINT8 *RAM = state->memregion("maincpu")->base();
554   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x10000);
554555}
555556
556557static MACHINE_CONFIG_START( mycom, mycom_state )
src/mess/drivers/spc1000.c
r14976r14977
5252{
5353   m_IPLK = m_IPLK ? 0 : 1;
5454   if (m_IPLK == 1) {
55      UINT8 *mem = machine().region("maincpu")->base();
56      memory_set_bankptr(machine(), "bank1", mem);
57      memory_set_bankptr(machine(), "bank3", mem);
55      UINT8 *mem = memregion("maincpu")->base();
56      membank("bank1")->set_base(mem);
57      membank("bank3")->set_base(mem);
5858   } else {
5959      UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
60      memory_set_bankptr(machine(), "bank1", ram);
61      memory_set_bankptr(machine(), "bank3", ram + 0x8000);
60      membank("bank1")->set_base(ram);
61      membank("bank3")->set_base(ram + 0x8000);
6262   }
6363}
6464
r14976r14977
6666{
6767   m_IPLK = m_IPLK ? 0 : 1;
6868   if (m_IPLK == 1) {
69      UINT8 *mem = machine().region("maincpu")->base();
70      memory_set_bankptr(machine(), "bank1", mem);
71      memory_set_bankptr(machine(), "bank3", mem);
69      UINT8 *mem = memregion("maincpu")->base();
70      membank("bank1")->set_base(mem);
71      membank("bank3")->set_base(mem);
7272   } else {
7373      UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
74      memory_set_bankptr(machine(), "bank1", ram);
75      memory_set_bankptr(machine(), "bank3", ram + 0x8000);
74      membank("bank1")->set_base(ram);
75      membank("bank3")->set_base(ram + 0x8000);
7676   }
7777   return 0;
7878}
r14976r14977
225225{
226226   spc1000_state *state = machine.driver_data<spc1000_state>();
227227   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
228   UINT8 *mem = machine.region("maincpu")->base();
228   UINT8 *mem = state->memregion("maincpu")->base();
229229   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
230230
231231   space->install_read_bank(0x0000, 0x7fff, "bank1");
r14976r14977
234234   space->install_write_bank(0x0000, 0x7fff, "bank2");
235235   space->install_write_bank(0x8000, 0xffff, "bank4");
236236
237   memory_set_bankptr(machine, "bank1", mem);
238   memory_set_bankptr(machine, "bank2", ram);
239   memory_set_bankptr(machine, "bank3", mem);
240   memory_set_bankptr(machine, "bank4", ram + 0x8000);
237   state->membank("bank1")->set_base(mem);
238   state->membank("bank2")->set_base(ram);
239   state->membank("bank3")->set_base(mem);
240   state->membank("bank4")->set_base(ram + 0x8000);
241241
242242   state->m_IPLK = 1;
243243}
src/mess/drivers/vii.c
r14976r14977
547547
548548void vii_state::vii_switch_bank(UINT32 bank)
549549{
550   UINT8 *cart = machine().region("cart")->base();
550   UINT8 *cart = memregion("cart")->base();
551551
552552   if(bank != m_current_bank)
553553   {
r14976r14977
917917static DEVICE_IMAGE_LOAD( vii_cart )
918918{
919919   vii_state *state = image.device().machine().driver_data<vii_state>();
920   UINT8 *cart = image.device().machine().region( "cart" )->base();
920   UINT8 *cart = state->memregion( "cart" )->base();
921921   if (image.software_entry() == NULL)
922922   {
923923      int size = image.length();
r14976r14977
951951static DEVICE_IMAGE_LOAD( vsmile_cart )
952952{
953953   vii_state *state = image.device().machine().driver_data<vii_state>();
954   UINT8 *cart = image.device().machine().region( "cart" )->base();
954   UINT8 *cart = state->memregion( "cart" )->base();
955955   if (image.software_entry() == NULL)
956956   {
957957      int size = image.length();
r14976r14977
996996   state->m_controller_input[6] = 0xff;
997997   state->m_controller_input[7] = 0;
998998
999   UINT8 *rom = machine.region( "cart" )->base();
999   UINT8 *rom = state->memregion( "cart" )->base();
10001000   if (rom)
10011001   { // to prevent batman crash
10021002      memcpy(state->m_p_cart, rom + 0x4000*2, (0x400000 - 0x4000) * 2);
src/mess/drivers/x1.c
r14976r14977
343343         int width = BIT(state->m_avram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 7);
344344         int height = BIT(state->m_avram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 6);
345345         int pcg_bank = BIT(state->m_avram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 5);
346         UINT8 *gfx_data = machine.region(pcg_bank ? "pcg" : "cgrom")->base();
346         UINT8 *gfx_data = machine.root_device().memregion(pcg_bank ? "pcg" : "cgrom")->base();
347347         int   knj_enable = 0;
348348         int knj_side = 0;
349349         int knj_bank = 0;
r14976r14977
357357            knj_bank = state->m_kvram[((x+y*x_size)+mc6845_start_addr) & 0x7ff] & 0x0f;
358358            if(knj_enable)
359359            {
360               gfx_data = machine.region("kanji")->base();
360               gfx_data = state->memregion("kanji")->base();
361361               tile = ((tile + (knj_bank << 8)) << 1) + (knj_side & 1);
362362            }
363363         }
r14976r14977
965965
966966READ8_MEMBER( x1_state::x1_rom_r )
967967{
968   UINT8 *rom = machine().region("cart_img")->base();
968   UINT8 *rom = memregion("cart_img")->base();
969969
970970//  printf("%06x\n",m_rom_index[0]<<16|m_rom_index[1]<<8|m_rom_index[2]<<0);
971971
r14976r14977
11231123
11241124   if(addr == 0 && m_scrn_reg.pcg_mode) // Kanji ROM read, X1Turbo only
11251125   {
1126      gfx_data = machine().region("kanji")->base();
1126      gfx_data = memregion("kanji")->base();
11271127      pcg_offset = (m_tvram[check_chr_addr()]+(m_kvram[check_chr_addr()]<<8)) & 0xfff;
11281128      pcg_offset*=0x20;
11291129      pcg_offset+=(offset & 0x0f);
r14976r14977
11361136      UINT8 y_char_size;
11371137
11381138      /* addr == 0 reads from the ANK rom */
1139      gfx_data = machine().region((addr == 0) ? "cgrom" : "pcg")->base();
1139      gfx_data = memregion((addr == 0) ? "cgrom" : "pcg")->base();
11401140      y_char_size = ((m_crtc_vreg[9]+1) > 8) ? 8 : m_crtc_vreg[9]+1;
11411141      if(y_char_size == 0) { y_char_size = 1; }
11421142      pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8;
r14976r14977
11511151WRITE8_MEMBER( x1_state::x1_pcg_w )
11521152{
11531153   int addr,pcg_offset;
1154   UINT8 *PCG_RAM = machine().region("pcg")->base();
1154   UINT8 *PCG_RAM = memregion("pcg")->base();
11551155
11561156   addr = (offset & 0x300) >> 8;
11571157
r14976r14977
14461446
14471447READ8_MEMBER( x1_state::x1_kanji_r )
14481448{
1449   UINT8 *kanji_rom = machine().region("kanji")->base();
1449   UINT8 *kanji_rom = memregion("kanji")->base();
14501450   UINT8 res;
14511451
14521452   res = kanji_rom[jis_convert(m_kanji_addr & 0xfff0)+(offset*0x10)+(m_kanji_addr & 0xf)];
r14976r14977
14891489
14901490READ8_MEMBER( x1_state::x1_emm_r )
14911491{
1492   UINT8 *emm_ram = machine().region("emm")->base();
1492   UINT8 *emm_ram = memregion("emm")->base();
14931493   UINT8 res;
14941494
14951495   if(offset & ~3)
r14976r14977
15141514
15151515WRITE8_MEMBER( x1_state::x1_emm_w )
15161516{
1517   UINT8 *emm_ram = machine().region("emm")->base();
1517   UINT8 *emm_ram = memregion("emm")->base();
15181518
15191519   if(offset & ~3)
15201520   {
r14976r14977
15451545
15461546WRITE8_MEMBER( x1_state::x1turbo_bank_w )
15471547{
1548   //UINT8 *RAM = machine().region("x1_cpu")->base();
1548   //UINT8 *RAM = memregion("x1_cpu")->base();
15491549   /*
15501550    --x- ---- BML5: latch bit (doesn't have any real function)
15511551    ---x ---- BMCS: select bank RAM, active low
r14976r14977
15591559/* TODO: waitstate penalties */
15601560READ8_MEMBER( x1_state::x1_mem_r )
15611561{
1562   UINT8 *wram = machine().region("wram")->base();
1562   UINT8 *wram = memregion("wram")->base();
15631563
15641564   if((offset & 0x8000) == 0 && (m_ram_bank == 0))
15651565   {
1566      UINT8 *ipl = machine().region("ipl")->base();
1566      UINT8 *ipl = memregion("ipl")->base();
15671567      return ipl[offset]; //ROM
15681568   }
15691569
r14976r14977
15721572
15731573WRITE8_MEMBER( x1_state::x1_mem_w )
15741574{
1575   UINT8 *wram = machine().region("wram")->base();
1575   UINT8 *wram = memregion("wram")->base();
15761576
15771577   wram[offset] = data; //RAM
15781578}
r14976r14977
15811581{
15821582   if((m_ex_bank & 0x10) == 0)
15831583   {
1584      UINT8 *wram = machine().region("wram")->base();
1584      UINT8 *wram = memregion("wram")->base();
15851585
15861586      return wram[offset+((m_ex_bank & 0xf)*0x10000)];
15871587   }
r14976r14977
15931593{
15941594   if((m_ex_bank & 0x10) == 0)
15951595   {
1596      UINT8 *wram = machine().region("wram")->base();
1596      UINT8 *wram = memregion("wram")->base();
15971597
15981598      wram[offset+((m_ex_bank & 0xf)*0x10000)] = data; //RAM
15991599   }
r14976r14977
24682468MACHINE_RESET( x1 )
24692469{
24702470   x1_state *state = machine.driver_data<x1_state>();
2471   //UINT8 *ROM = machine.region("x1_cpu")->base();
2472   UINT8 *PCG_RAM = machine.region("pcg")->base();
2471   //UINT8 *ROM = machine.root_device().memregion("x1_cpu")->base();
2472   UINT8 *PCG_RAM = state->memregion("pcg")->base();
24732473   int i;
24742474
24752475   memset(state->m_gfx_bitmap_ram,0x00,0xc000*2);
r14976r14977
27642764DRIVER_INIT( x1_kanji )
27652765{
27662766   UINT32 i,j,k,l;
2767   UINT8 *kanji = machine.region("kanji")->base();
2768   UINT8 *raw_kanji = machine.region("raw_kanji")->base();
2767   UINT8 *kanji = machine.root_device().memregion("kanji")->base();
2768   UINT8 *raw_kanji = machine.root_device().memregion("raw_kanji")->base();
27692769
27702770   k = 0;
27712771   for(l=0;l<2;l++)
src/mess/drivers/sun3.c
r14976r14977
247247
248248MACHINE_RESET_MEMBER(sun3_state)
249249{
250   UINT8* user1 = machine().region("user1")->base();
250   UINT8* user1 = memregion("user1")->base();
251251
252252   memcpy((UINT8*)m_p_ram.target(),user1,0x10000);
253253
src/mess/drivers/pocketc.c
r14976r14977
798798static MACHINE_START( pc1260 )
799799{
800800   device_t *main_cpu = machine.device("maincpu");
801   UINT8 *ram = machine.region("maincpu")->base() + 0x4000;
801   UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x4000;
802802   UINT8 *cpu = sc61860_internal_ram(main_cpu);
803803
804804   machine.device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
src/mess/drivers/xor100.c
r14976r14977
6666      if (m_bank < banks)
6767      {
6868         program->install_write_bank(0x0000, 0xffff, "bank1");
69         memory_set_bank(machine(), "bank1", 1 + m_bank);
69         membank("bank1")->set_entry(1 + m_bank);
7070      }
7171      else
7272      {
r14976r14977
7575
7676      program->install_read_bank(0x0000, 0xf7ff, 0x07ff, 0, "bank2");
7777      program->install_read_bank(0xf800, 0xffff, "bank3");
78      memory_set_bank(machine(), "bank2", 0);
79      memory_set_bank(machine(), "bank3", 0);
78      membank("bank2")->set_entry(0);
79      membank("bank3")->set_entry(0);
8080      break;
8181
8282   case EPROM_F800:
r14976r14977
8484      {
8585         program->install_write_bank(0x0000, 0xffff, "bank1");
8686         program->install_read_bank(0x0000, 0xf7ff, "bank2");
87         memory_set_bank(machine(), "bank1", 1 + m_bank);
88         memory_set_bank(machine(), "bank2", 1 + m_bank);
87         membank("bank1")->set_entry(1 + m_bank);
88         membank("bank2")->set_entry(1 + m_bank);
8989      }
9090      else
9191      {
r14976r14977
9494      }
9595
9696      program->install_read_bank(0xf800, 0xffff, "bank3");
97      memory_set_bank(machine(), "bank3", 0);
97      membank("bank3")->set_entry(0);
9898      break;
9999
100100   case EPROM_OFF:
r14976r14977
103103         program->install_write_bank(0x0000, 0xffff, "bank1");
104104         program->install_read_bank(0x0000, 0xf7ff, "bank2");
105105         program->install_read_bank(0xf800, 0xffff, "bank3");
106         memory_set_bank(machine(), "bank1", 1 + m_bank);
107         memory_set_bank(machine(), "bank2", 1 + m_bank);
108         memory_set_bank(machine(), "bank3", 1 + m_bank);
106         membank("bank1")->set_entry(1 + m_bank);
107         membank("bank2")->set_entry(1 + m_bank);
108         membank("bank3")->set_entry(1 + m_bank);
109109      }
110110      else
111111      {
r14976r14977
536536{
537537   int banks = m_ram->size() / 0x10000;
538538   UINT8 *ram = m_ram->pointer();
539   UINT8 *rom = machine().region(Z80_TAG)->base();
539   UINT8 *rom = memregion(Z80_TAG)->base();
540540
541541   /* setup memory banking */
542   memory_configure_bank(machine(), "bank1", 1, banks, ram, 0x10000);
543   memory_configure_bank(machine(), "bank2", 0, 1, rom, 0);
544   memory_configure_bank(machine(), "bank2", 1, banks, ram, 0x10000);
545   memory_configure_bank(machine(), "bank3", 0, 1, rom, 0);
546   memory_configure_bank(machine(), "bank3", 1, banks, ram + 0xf800, 0x10000);
542   membank("bank1")->configure_entries(1, banks, ram, 0x10000);
543   membank("bank2")->configure_entry(0, rom);
544   membank("bank2")->configure_entries(1, banks, ram, 0x10000);
545   membank("bank3")->configure_entry(0, rom);
546   membank("bank3")->configure_entries(1, banks, ram + 0xf800, 0x10000);
547547
548548   /* register for state saving */
549549   save_item(NAME(m_mode));
src/mess/drivers/palm.c
r14976r14977
122122   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
123123   space->install_read_bank (0x000000, machine.device<ram_device>(RAM_TAG)->size() - 1, machine.device<ram_device>(RAM_TAG)->size() - 1, 0, "bank1");
124124   space->install_write_bank(0x000000, machine.device<ram_device>(RAM_TAG)->size() - 1, machine.device<ram_device>(RAM_TAG)->size() - 1, 0, "bank1");
125   memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
125   state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
126126
127127   state->save_item(NAME(state->m_port_f_latch));
128128   state->save_item(NAME(state->m_spim_data));
r14976r14977
134134static MACHINE_RESET( palm )
135135{
136136    // Copy boot ROM
137   UINT8* bios = machine.region("bios")->base();
137   UINT8* bios = machine.root_device().memregion("bios")->base();
138138   memset(machine.device<ram_device>(RAM_TAG)->pointer(), 0, machine.device<ram_device>(RAM_TAG)->size());
139139   memcpy(machine.device<ram_device>(RAM_TAG)->pointer(), bios, 0x20000);
140140
src/mess/drivers/fp1100.c
r14976r14977
147147{
148148   if(m_mem_bank == 0 && offset <= 0x8fff)
149149   {
150      UINT8 *ipl = machine().region("ipl")->base();
150      UINT8 *ipl = memregion("ipl")->base();
151151      return ipl[offset];
152152   }
153153
src/mess/drivers/beehive.c
r14976r14977
232232
233233VIDEO_START_MEMBER( beehive_state )
234234{
235   m_p_chargen = machine().region("chargen")->base();
235   m_p_chargen = memregion("chargen")->base();
236236}
237237
238238/* This system appears to have inline attribute bytes of unknown meaning.
src/mess/drivers/vic20.c
r14976r14977
785785void vic20_state::machine_start()
786786{
787787   // find memory regions
788   m_basic = machine().region("basic")->base();
789   m_kernal = machine().region("kernal")->base();
790   m_charom = machine().region("charom")->base();
788   m_basic = memregion("basic")->base();
789   m_kernal = memregion("kernal")->base();
790   m_charom = memregion("charom")->base();
791791
792792   // allocate memory
793793   m_color_ram = auto_alloc_array(machine(), UINT8, 0x400);
src/mess/drivers/arcadia.c
r14976r14977
453453
454454static DEVICE_IMAGE_LOAD( arcadia_cart )
455455{
456   UINT8 *rom = image.device().machine().region("maincpu")->base();
456   UINT8 *rom = image.device().machine().root_device().memregion("maincpu")->base();
457457   int size;
458458
459459   memset(rom, 0, 0x8000);
r14976r14977
461461   {
462462      size = image.length();
463463
464      if (size > image.device().machine().region("maincpu")->bytes())
465         size = image.device().machine().region("maincpu")->bytes();
464      if (size > image.device().machine().root_device().memregion("maincpu")->bytes())
465         size = image.device().machine().root_device().memregion("maincpu")->bytes();
466466
467467      if (image.fread(rom, size) != size)
468468         return IMAGE_INIT_FAIL;
r14976r14977
733733static DRIVER_INIT( arcadia )
734734{
735735   int i;
736   UINT8 *gfx=machine.region("gfx1")->base();
736   UINT8 *gfx=machine.root_device().memregion("gfx1")->base();
737737   for (i=0; i<256; i++) gfx[i]=i;
738738#if 0
739739   // this is here to allow developement of some simple testroutines
740740   // for a real console
741741   {
742      UINT8 *rom=machine.region("maincpu")->base();
742      UINT8 *rom=machine.root_device().memregion("maincpu")->base();
743743      /* this is a simple routine to display all rom characters
744744           on the display for a snapshot */
745745      static const UINT8 prog[]={ // address 0 of course
src/mess/drivers/lcmate2.c
r14976r14977
8484
8585WRITE8_MEMBER( lcmate2_state::bankswitch_w )
8686{
87   memory_set_bank(machine(), "rombank", data&0x0f);
87   membank("rombank")->set_entry(data&0x0f);
8888}
8989
9090static ADDRESS_MAP_START(lcmate2_mem, AS_PROGRAM, 8, lcmate2_state)
r14976r14977
199199
200200void lcmate2_state::machine_start()
201201{
202   memory_configure_bank(machine(), "rombank", 0, 0x10, (UINT8*)machine().region("maincpu")->base(), 0x4000);
202   membank("rombank")->configure_entries(0, 0x10, (UINT8*)machine().root_device().memregion("maincpu")->base(), 0x4000);
203203}
204204
205205static const hd44780_interface lcmate2_display =
src/mess/drivers/smc777.c
r14976r14977
9595   smc777_state *state = screen.machine().driver_data<smc777_state>();
9696   int x,y,yi;
9797   UINT16 count;
98   UINT8 *vram = screen.machine().region("vram")->base();
99   UINT8 *attr = screen.machine().region("attr")->base();
100   UINT8 *gram = screen.machine().region("fbuf")->base();
98   UINT8 *vram = screen.machine().root_device().memregion("vram")->base();
99   UINT8 *attr = screen.machine().root_device().memregion("attr")->base();
100   UINT8 *gram = state->memregion("fbuf")->base();
101101   int x_width;
102102
103103   bitmap.fill(screen.machine().pens[state->m_backdrop_pen], cliprect);
r14976r14977
181181         {
182182            for(xi=0;xi<8;xi++)
183183            {
184               UINT8 *gfx_data = screen.machine().region("pcg")->base();
184               UINT8 *gfx_data = screen.machine().root_device().memregion("pcg")->base();
185185               int pen;
186186
187187               pen = ((gfx_data[tile*8+yi]>>(7-xi)) & 1) ? (color+state->m_pal_mode) : bk_pen;
r14976r14977
246246
247247READ8_MEMBER(smc777_state::smc777_vram_r)
248248{
249   UINT8 *vram = machine().region("vram")->base();
249   UINT8 *vram = memregion("vram")->base();
250250   UINT16 vram_index;
251251
252252   vram_index  = ((offset & 0x0007) << 8);
r14976r14977
257257
258258READ8_MEMBER(smc777_state::smc777_attr_r)
259259{
260   UINT8 *attr = machine().region("attr")->base();
260   UINT8 *attr = memregion("attr")->base();
261261   UINT16 vram_index;
262262
263263   vram_index  = ((offset & 0x0007) << 8);
r14976r14977
268268
269269READ8_MEMBER(smc777_state::smc777_pcg_r)
270270{
271   UINT8 *pcg = machine().region("pcg")->base();
271   UINT8 *pcg = memregion("pcg")->base();
272272   UINT16 vram_index;
273273
274274   vram_index  = ((offset & 0x0007) << 8);
r14976r14977
279279
280280WRITE8_MEMBER(smc777_state::smc777_vram_w)
281281{
282   UINT8 *vram = machine().region("vram")->base();
282   UINT8 *vram = memregion("vram")->base();
283283   UINT16 vram_index;
284284
285285   vram_index  = ((offset & 0x0007) << 8);
r14976r14977
290290
291291WRITE8_MEMBER(smc777_state::smc777_attr_w)
292292{
293   UINT8 *attr = machine().region("attr")->base();
293   UINT8 *attr = memregion("attr")->base();
294294   UINT16 vram_index;
295295
296296   vram_index  = ((offset & 0x0007) << 8);
r14976r14977
301301
302302WRITE8_MEMBER(smc777_state::smc777_pcg_w)
303303{
304   UINT8 *pcg = machine().region("pcg")->base();
304   UINT8 *pcg = memregion("pcg")->base();
305305   UINT16 vram_index;
306306
307307   vram_index  = ((offset & 0x0007) << 8);
r14976r14977
314314
315315READ8_MEMBER(smc777_state::smc777_fbuf_r)
316316{
317   UINT8 *fbuf = machine().region("fbuf")->base();
317   UINT8 *fbuf = memregion("fbuf")->base();
318318   UINT16 vram_index;
319319
320320   vram_index  = ((offset & 0x007f) << 8);
r14976r14977
325325
326326WRITE8_MEMBER(smc777_state::smc777_fbuf_w)
327327{
328   UINT8 *fbuf = machine().region("fbuf")->base();
328   UINT8 *fbuf = memregion("fbuf")->base();
329329   UINT16 vram_index;
330330
331331   vram_index  = ((offset & 0x00ff) << 8);
r14976r14977
570570
571571READ8_MEMBER(smc777_state::smc777_mem_r)
572572{
573   UINT8 *wram = machine().region("wram")->base();
574   UINT8 *bios = machine().region("bios")->base();
573   UINT8 *wram = memregion("wram")->base();
574   UINT8 *bios = memregion("bios")->base();
575575   UINT8 z80_r;
576576
577577   if(m_raminh_prefetch != 0xff) //do the bankswitch AFTER that the prefetch instruction is executed (FIXME: this is an hackish implementation)
r14976r14977
593593
594594WRITE8_MEMBER(smc777_state::smc777_mem_w)
595595{
596   UINT8 *wram = machine().region("wram")->base();
596   UINT8 *wram = memregion("wram")->base();
597597
598598   wram[offset] = data;
599599}
src/mess/drivers/bcs3.c
r14976r14977
216216
217217VIDEO_START_MEMBER( bcs3_state )
218218{
219   m_p_chargen = machine().region("chargen")->base();
219   m_p_chargen = memregion("chargen")->base();
220220}
221221
222222static SCREEN_UPDATE_IND16( bcs3 )
src/mess/drivers/scorpion.c
r14976r14977
190190
191191   state->m_screen_location = messram + ((state->m_port_7ffd_data & 8) ? (7<<14) : (5<<14));
192192
193   memory_set_bankptr(machine, "bank4", messram + (((state->m_port_7ffd_data & 0x07) | ((state->m_port_1ffd_data & 0x10)>>1)) * 0x4000));
193   state->membank("bank4")->set_base(messram + (((state->m_port_7ffd_data & 0x07) | ((state->m_port_1ffd_data & 0x10)>>1)) * 0x4000));
194194
195195   if ((state->m_port_1ffd_data & 0x01)==0x01)
196196   {
197197      state->m_ram_0000 = messram+(8<<14);
198      memory_set_bankptr(machine, "bank1", messram+(8<<14));
198      state->membank("bank1")->set_base(messram+(8<<14));
199199      logerror("RAM\n");
200200   }
201201   else
r14976r14977
208208      {
209209         state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ? 1 : 0;
210210      }
211      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
211      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
212212   }
213213
214214
r14976r14977
243243         state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ? 1 : 0;
244244         betadisk_disable(beta);
245245         state->m_ram_disabled_by_beta = 1;
246         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
246         state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
247247      }
248248   }
249249   else if (((pc & 0xff00) == 0x3d00) && (state->m_ROMSelection==1))
r14976r14977
254254   if(address<=0x3fff)
255255   {
256256      state->m_ram_disabled_by_beta = 1;
257      direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
258      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
257      direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.root_device().memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
258      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
259259      return ~0;
260260   }
261261   return address;
r14976r14977
333333   memset(messram,0,256*1024);
334334
335335   /* Bank 5 is always in 0x4000 - 0x7fff */
336   memory_set_bankptr(machine, "bank2", messram + (5<<14));
336   state->membank("bank2")->set_base(messram + (5<<14));
337337
338338   /* Bank 2 is always in 0x8000 - 0xbfff */
339   memory_set_bankptr(machine, "bank3", messram + (2<<14));
339   state->membank("bank3")->set_base(messram + (2<<14));
340340
341341   state->m_port_7ffd_data = 0;
342342   state->m_port_1ffd_data = 0;
src/mess/drivers/abc80.c
r14976r14977
350350   }
351351   else if (!(mmu & MMU_ROM))
352352   {
353      data = machine().region(Z80_TAG)->base()[offset & 0x3fff];
353      data = memregion(Z80_TAG)->base()[offset & 0x3fff];
354354   }
355355   else if (mmu & MMU_VRAMS)
356356   {
r14976r14977
664664void abc80_state::machine_start()
665665{
666666   // find memory regions
667   m_mmu_rom = machine().region("mmu")->base();
667   m_mmu_rom = memregion("mmu")->base();
668668
669669   // register for state saving
670670   save_item(NAME(m_key_data));
src/mess/drivers/zexall.c
r14976r14977
6363{
6464// rom is self-modifying, so need to refresh it on each run
6565   zexall_state *state = machine.driver_data<zexall_state>();
66   UINT8 *rom = machine.region("romcode")->base();
66   UINT8 *rom = state->memregion("romcode")->base();
6767   UINT8 *ram = state->m_main_ram;
6868   /* fill main ram with zexall code */
6969   memcpy(ram, rom, 0x228a);
src/mess/drivers/spectrum.c
r14976r14977
689689         return IMAGE_INIT_FAIL;
690690      }
691691
692      if (image.fread(image.device().machine().region("maincpu")->base(), filesize) != filesize)
692      if (image.fread(image.device().machine().root_device().memregion("maincpu")->base(), filesize) != filesize)
693693      {
694694         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error loading file");
695695         return IMAGE_INIT_FAIL;
r14976r14977
698698   else
699699   {
700700      filesize = image.get_software_region_length("rom");
701      memcpy(image.device().machine().region("maincpu")->base(), image.get_software_region("rom"), filesize);
701      memcpy(image.device().machine().root_device().memregion("maincpu")->base(), image.get_software_region("rom"), filesize);
702702   }
703703   return IMAGE_INIT_PASS;
704704}
src/mess/drivers/sg1000.c
r14976r14977
663663   case 40 * 1024:
664664      program->install_read_bank(0x8000, 0x9fff, "bank1");
665665      program->unmap_write(0x8000, 0x9fff);
666      memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base() + 0x8000, 0);
667      memory_set_bank(machine(), "bank1", 0);
666      membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base() + 0x8000);
667      membank("bank1")->set_entry(0);
668668      break;
669669
670670   case 48 * 1024:
671671      program->install_read_bank(0x8000, 0xbfff, "bank1");
672672      program->unmap_write(0x8000, 0xbfff);
673      memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base() + 0x8000, 0);
674      memory_set_bank(machine(), "bank1", 0);
673      membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base() + 0x8000);
674      membank("bank1")->set_entry(0);
675675      break;
676676
677677   default:
r14976r14977
699699   running_machine &machine = image.device().machine();
700700   sg1000_state *state = machine.driver_data<sg1000_state>();
701701   address_space *program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM);
702   UINT8 *ptr = machine.region(Z80_TAG)->base();
702   UINT8 *ptr = state->memregion(Z80_TAG)->base();
703703   UINT32 ram_size = 0x400;
704704   bool install_2000_ram = false;
705705   UINT32 size;
r14976r14977
813813   running_machine &machine = image.device().machine();
814814   sg1000_state *state = machine.driver_data<sg1000_state>();
815815   UINT32 size;
816   UINT8 *ptr = machine.region(Z80_TAG)->base();
816   UINT8 *ptr = state->memregion(Z80_TAG)->base();
817817
818818   if (image.software_entry() == NULL)
819819   {
r14976r14977
869869{
870870   running_machine &machine = image.device().machine();
871871   sc3000_state *state = machine.driver_data<sc3000_state>();
872   UINT8 *ptr = machine.region(Z80_TAG)->base();
872   UINT8 *ptr = state->memregion(Z80_TAG)->base();
873873   UINT32 size;
874874
875875   if (image.software_entry() == NULL)
r14976r14977
947947   }
948948
949949   /* ROM selection */
950   memory_set_bank(machine(), "bank1", BIT(data, 6));
950   membank("bank1")->set_entry(BIT(data, 6));
951951
952952   /* printer strobe */
953953   m_centronics->strobe_w(BIT(data, 7));
r14976r14977
10321032
10331033static TIMER_CALLBACK( lightgun_tick )
10341034{
1035   UINT8 *rom = machine.region(Z80_TAG)->base();
1035   UINT8 *rom = machine.root_device().memregion(Z80_TAG)->base();
10361036
10371037   if (IS_CARTRIDGE_TV_DRAW(rom))
10381038   {
r14976r14977
10811081void sf7000_state::machine_start()
10821082{
10831083   /* configure memory banking */
1084   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base(), 0);
1085   memory_configure_bank(machine(), "bank1", 1, 1, m_ram->pointer(), 0);
1086   memory_configure_bank(machine(), "bank2", 0, 1, m_ram->pointer(), 0);
1084   membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base());
1085   membank("bank1")->configure_entry(1, m_ram->pointer());
1086   membank("bank2")->configure_entry(0, m_ram->pointer());
10871087
10881088   /* register for state saving */
10891089   save_item(NAME(m_keylatch));
r14976r14977
10971097
10981098void sf7000_state::machine_reset()
10991099{
1100   memory_set_bank(machine(), "bank1", 0);
1101   memory_set_bank(machine(), "bank2", 0);
1100   membank("bank1")->set_entry(0);
1101   membank("bank2")->set_entry(0);
11021102}
11031103
11041104/***************************************************************************
src/mess/drivers/tx0.c
r14976r14977
7070   };
7171
7272   /* set up our font */
73   dst = machine.region("gfx1")->base();
73   dst = machine.root_device().memregion("gfx1")->base();
7474
7575   memcpy(dst, fontdata6x8, tx0_fontdata_size);
7676}
src/mess/drivers/ip22.c
r14976r14977
895895      data ^= 0xffffffff;
896896   }
897897
898   // if banks 0 or 1 have 2 subbanks, also kill it, we only want 128 MB
898   // if banks 0 or 1 have 2 membanks, also kill it, we only want 128 MB
899899   if (sgi_mc_r(&space, 0xc0/4, 0xffffffff) & 0x40004000)
900900   {
901901      // a random perturbation so the memory test fails
r14976r14977
12261226   machine.scheduler().timer_set(attotime::from_msec(1), FUNC(ip22_timer));
12271227
12281228   // set up low RAM mirror
1229   memory_set_bankptr(machine, "bank1", state->m_mainram);
1229   state->membank("bank1")->set_base(state->m_mainram);
12301230
12311231   state->m_PBUS_DMA.nActive = 0;
12321232
src/mess/drivers/px8.c
r14976r14977
7777{
7878   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
7979   UINT8 *ram = m_ram->pointer();
80   UINT8 *ipl_rom = machine().region(UPD70008_TAG)->base();
80   UINT8 *ipl_rom = memregion(UPD70008_TAG)->base();
8181
8282   if (!m_bank0)
8383   {
src/mess/drivers/phc25.c
r14976r14977
322322void phc25_state::video_start()
323323{
324324   /* find memory regions */
325   m_char_rom = machine().region(Z80_TAG)->base() + 0x5000;
325   m_char_rom = memregion(Z80_TAG)->base() + 0x5000;
326326}
327327
328328/* AY-3-8910 Interface */
src/mess/drivers/mikromik.c
r14976r14977
131131      }
132132      else if (!(mmu & MMU_CE0))
133133      {
134         data = machine().region(I8085A_TAG)->base()[offset & 0x1fff];
134         data = memregion(I8085A_TAG)->base()[offset & 0x1fff];
135135      }
136136      else if (!(mmu & MMU_CE1))
137137      {
138         data = machine().region(I8085A_TAG)->base()[0x2000 + (offset & 0x1fff)];
138         data = memregion(I8085A_TAG)->base()[0x2000 + (offset & 0x1fff)];
139139      }
140140   }
141141
r14976r14977
735735void mm1_state::machine_start()
736736{
737737   // find memory regions
738   m_mmu_rom = machine().region("address")->base();
739   m_key_rom = machine().region("keyboard")->base();
738   m_mmu_rom = memregion("address")->base();
739   m_key_rom = memregion("keyboard")->base();
740740
741741   // register for state saving
742742   save_item(NAME(m_sense));
src/mess/drivers/spec128.c
r14976r14977
213213      ram_page = state->m_port_7ffd_data & 0x07;
214214      ram_data = messram + (ram_page<<14);
215215
216      memory_set_bankptr(machine, "bank4", ram_data);
216      state->membank("bank4")->set_base(ram_data);
217217   }
218218
219219   /* ROM switching */
r14976r14977
221221
222222   /* rom 0 is 128K rom, rom 1 is 48 BASIC */
223223
224   ChosenROM = machine.region("maincpu")->base() + 0x010000 + (ROMSelection<<14);
224   ChosenROM = machine.root_device().memregion("maincpu")->base() + 0x010000 + (ROMSelection<<14);
225225
226   memory_set_bankptr(machine, "bank1", ChosenROM);
226   state->membank("bank1")->set_base(ChosenROM);
227227}
228228
229229static  READ8_HANDLER ( spectrum_128_ula_r )
r14976r14977
261261   /* 0x0000-0x3fff always holds ROM */
262262
263263   /* Bank 5 is always in 0x4000 - 0x7fff */
264   memory_set_bankptr(machine, "bank2", messram + (5<<14));
264   state->membank("bank2")->set_base(messram + (5<<14));
265265
266266   /* Bank 2 is always in 0x8000 - 0xbfff */
267   memory_set_bankptr(machine, "bank3", messram + (2<<14));
267   state->membank("bank3")->set_base(messram + (2<<14));
268268
269269   MACHINE_RESET_CALL(spectrum);
270270
src/mess/drivers/phunsy.c
r14976r14977
7676   switch( m_u_bank )
7777   {
7878   case 0x00:   /* RAM */
79      memory_set_bankptr( machine(), "bank1", m_ram_1800 );
79      membank( "bank1" )->set_base( m_ram_1800 );
8080      break;
8181   case 0x01:   /* MDCR program */
8282   case 0x02:   /* Disassembler */
8383   case 0x03:   /* Label handler */
84      memory_set_bankptr( machine(), "bank1", machine().region("maincpu")->base() + ( 0x800 * m_u_bank ) );
84      membank( "bank1" )->set_base( memregion("maincpu")->base() + ( 0x800 * m_u_bank ) );
8585      break;
8686   default:   /* Not used */
8787      break;
8888   }
8989
90   memory_set_bankptr( machine(), "bank2", machine().region("ram_4000")->base() + 0x4000 * m_q_bank );
90   membank( "bank2" )->set_base( memregion("ram_4000")->base() + 0x4000 * m_q_bank );
9191}
9292
9393
r14976r14977
182182
183183MACHINE_RESET_MEMBER(phunsy_state)
184184{
185   memory_set_bankptr( machine(), "bank1", m_ram_1800 );
186   memory_set_bankptr( machine(), "bank2", machine().region("ram_4000")->base() );
185   membank( "bank1" )->set_base( m_ram_1800 );
186   membank( "bank2" )->set_base( memregion("ram_4000")->base() );
187187
188188   m_u_bank = 0;
189189   m_q_bank = 0;
r14976r14977
204204
205205VIDEO_START_MEMBER( phunsy_state )
206206{
207   m_p_chargen = machine().region( "chargen" )->base();
207   m_p_chargen = memregion( "chargen" )->base();
208208}
209209
210210
src/mess/drivers/a2600.c
r14976r14977
115115
116116
117117
118#define CART machine.region("user1")->base()
118#define CART machine.root_device().memregion("user1")->base()
119119
120120#define MASTER_CLOCK_NTSC   3579545
121121#define MASTER_CLOCK_PAL   3546894
r14976r14977
579579{
580580   a2600_state *state = machine.driver_data<a2600_state>();
581581   state->m_bank_base[1] = CART + 0x1000 * offset;
582   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
582   state->membank("bank1")->set_base(state->m_bank_base[1]);
583583}
584584static void modeFA_switch(running_machine &machine, UINT16 offset, UINT8 data)
585585{
586586   a2600_state *state = machine.driver_data<a2600_state>();
587587   state->m_bank_base[1] = CART + 0x1000 * offset;
588   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
588   state->membank("bank1")->set_base(state->m_bank_base[1]);
589589}
590590static void modeF6_switch(running_machine &machine, UINT16 offset, UINT8 data)
591591{
592592   a2600_state *state = machine.driver_data<a2600_state>();
593593   state->m_bank_base[1] = CART + 0x1000 * offset;
594   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
594   state->membank("bank1")->set_base(state->m_bank_base[1]);
595595}
596596static void modeF4_switch(running_machine &machine, UINT16 offset, UINT8 data)
597597{
598598   a2600_state *state = machine.driver_data<a2600_state>();
599599   state->m_bank_base[1] = CART + 0x1000 * offset;
600   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
600   state->membank("bank1")->set_base(state->m_bank_base[1]);
601601}
602602static void mode3F_switch(running_machine &machine, UINT16 offset, UINT8 data)
603603{
604604   a2600_state *state = machine.driver_data<a2600_state>();
605605   state->m_bank_base[1] = CART + 0x800 * (data & (state->m_number_banks - 1));
606   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
606   state->membank("bank1")->set_base(state->m_bank_base[1]);
607607}
608608static void modeUA_switch(running_machine &machine, UINT16 offset, UINT8 data)
609609{
610610   a2600_state *state = machine.driver_data<a2600_state>();
611611   state->m_bank_base[1] = CART + (offset >> 6) * 0x1000;
612   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
612   state->membank("bank1")->set_base(state->m_bank_base[1]);
613613}
614614static void modeE0_switch(running_machine &machine, UINT16 offset, UINT8 data)
615615{
r14976r14977
618618   char bank_name[10];
619619   sprintf(bank_name,"bank%d",bank);
620620   state->m_bank_base[bank] = CART + 0x400 * (offset & 7);
621   memory_set_bankptr(machine,bank_name, state->m_bank_base[bank]);
621   state->membank(bank_name)->set_base(state->m_bank_base[bank]);
622622}
623623static void modeE7_switch(running_machine &machine, UINT16 offset, UINT8 data)
624624{
625625   a2600_state *state = machine.driver_data<a2600_state>();
626626   state->m_bank_base[1] = CART + 0x800 * offset;
627   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
627   state->membank("bank1")->set_base(state->m_bank_base[1]);
628628}
629629static void modeE7_RAM_switch(running_machine &machine, UINT16 offset, UINT8 data)
630630{
631631   a2600_state *state = machine.driver_data<a2600_state>();
632   memory_set_bankptr(machine,"bank9", state->m_extra_RAM->base() + (4 + offset) * 256 );
632   state->membank("bank9")->set_base(state->m_extra_RAM->base() + (4 + offset) * 256 );
633633}
634634static void modeDC_switch(running_machine &machine, UINT16 offset, UINT8 data)
635635{
636636   a2600_state *state = machine.driver_data<a2600_state>();
637637   state->m_bank_base[1] = CART + 0x1000 * next_bank(state);
638   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
638   state->membank("bank1")->set_base(state->m_bank_base[1]);
639639}
640640static void mode3E_switch(running_machine &machine, UINT16 offset, UINT8 data)
641641{
642642   a2600_state *state = machine.driver_data<a2600_state>();
643643   state->m_bank_base[1] = CART + 0x800 * (data & (state->m_number_banks - 1));
644   memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
644   state->membank("bank1")->set_base(state->m_bank_base[1]);
645645   state->m_mode3E_ram_enabled = 0;
646646}
647647static void mode3E_RAM_switch(running_machine &machine, UINT16 offset, UINT8 data)
648648{
649649   a2600_state *state = machine.driver_data<a2600_state>();
650650   state->m_ram_base = state->m_extra_RAM->base() + 0x200 * ( data & 0x3F );
651   memory_set_bankptr(machine,"bank1", state->m_ram_base );
651   state->membank("bank1")->set_base(state->m_ram_base );
652652   state->m_mode3E_ram_enabled = 1;
653653}
654654static void modeFV_switch(running_machine &machine, UINT16 offset, UINT8 data)
r14976r14977
660660      state->m_FVlocked = 1;
661661      state->m_current_bank = state->m_current_bank ^ 0x01;
662662      state->m_bank_base[1] = CART + 0x1000 * state->m_current_bank;
663      memory_set_bankptr(machine,"bank1", state->m_bank_base[1]);
663      state->membank("bank1")->set_base(state->m_bank_base[1]);
664664   }
665665}
666666static void modeJVP_switch(running_machine &machine, UINT16 offset, UINT8 data)
r14976r14977
677677      break;
678678   }
679679   state->m_bank_base[1] = CART + 0x1000 * state->m_current_bank;
680   memory_set_bankptr(machine, "bank1", state->m_bank_base[1] );
680   state->membank("bank1")->set_base(state->m_bank_base[1] );
681681}
682682
683683
r14976r14977
816816      {
817817      case 0x00:
818818         m_bank_base[1] = m_extra_RAM->base() + 2 * 0x800;
819         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? machine().region("maincpu")->base() + 0x1800 : machine().region("user1")->base();
819         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? memregion("maincpu")->base() + 0x1800 : memregion("user1")->base();
820820         m_modeSS_high_ram_enabled = 0;
821821         break;
822822      case 0x04:
823823         m_bank_base[1] = m_extra_RAM->base();
824         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? machine().region("maincpu")->base() + 0x1800 : machine().region("user1")->base();
824         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? memregion("maincpu")->base() + 0x1800 : memregion("user1")->base();
825825         m_modeSS_high_ram_enabled = 0;
826826         break;
827827      case 0x08:
r14976r14977
836836         break;
837837      case 0x10:
838838         m_bank_base[1] = m_extra_RAM->base() + 2 * 0x800;
839         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? machine().region("maincpu")->base() + 0x1800 : machine().region("user1")->base();
839         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? memregion("maincpu")->base() + 0x1800 : memregion("user1")->base();
840840         m_modeSS_high_ram_enabled = 0;
841841         break;
842842      case 0x14:
843843         m_bank_base[1] = m_extra_RAM->base() + 0x800;
844         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? machine().region("maincpu")->base() + 0x1800 : machine().region("user1")->base();
844         m_bank_base[2] = ( m_modeSS_byte & 0x01 ) ? memregion("maincpu")->base() + 0x1800 : memregion("user1")->base();
845845         m_modeSS_high_ram_enabled = 0;
846846         break;
847847      case 0x18:
r14976r14977
855855         m_modeSS_high_ram_enabled = 1;
856856         break;
857857      }
858      memory_set_bankptr(machine(), "bank1", m_bank_base[1] );
859      memory_set_bankptr(machine(), "bank2", m_bank_base[2] );
858      membank("bank1")->set_base(m_bank_base[1] );
859      membank("bank2")->set_base(m_bank_base[2] );
860860   }
861861   else if ( offset == 0xFF9 )
862862   {
r14976r14977
10151015   }
10161016   else
10171017   {
1018      UINT8   display_data = machine().region("user1")->base()[0x2000 + ( ~ ( ( m_dpc.df[data_fetcher].low | ( m_dpc.df[data_fetcher].high << 8 ) ) ) & 0x7FF ) ];
1018      UINT8   display_data = memregion("user1")->base()[0x2000 + ( ~ ( ( m_dpc.df[data_fetcher].low | ( m_dpc.df[data_fetcher].high << 8 ) ) ) & 0x7FF ) ];
10191019
10201020      switch( offset & 0x38 )
10211021      {
r14976r14977
11221122      /* Still cheating a bit here by looking bit 13 of the address..., but the high byte of the
11231123           cpu should be the last byte that was on the data bus and so should determine the bank
11241124           we should switch in. */
1125      m_bank_base[1] = machine().region("user1")->base() + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
1126      memory_set_bankptr(machine(), "bank1", m_bank_base[1] );
1125      m_bank_base[1] = memregion("user1")->base() + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
1126      membank("bank1")->set_base(m_bank_base[1] );
11271127      /* and restore old opbase handler */
11281128      machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(m_FE_old_opbase_handler);
11291129   }
r14976r14977
12911291         0x1000 + (i + 1) * 0x1000 / count - 1, handler[i]);
12921292
12931293      state->m_bank_base[i + 1] = cart + init;
1294      memory_set_bankptr(machine,handler[i], state->m_bank_base[i + 1]);
1294      state->membank(handler[i])->set_base(state->m_bank_base[i + 1]);
12951295   }
12961296}
12971297
r14976r14977
15841584   a2600_state *state = machine.driver_data<a2600_state>();
15851585   screen_device *screen = machine.first_screen();
15861586   state->m_current_screen_height = screen->height();
1587   state->m_extra_RAM = machine.region_alloc("user2", 0x8600, 1, ENDIANNESS_LITTLE);
1587   state->m_extra_RAM = machine.memory().region_alloc("user2", 0x8600, 1, ENDIANNESS_LITTLE);
15881588   memset( state->m_riot_ram, 0x00, 0x80 );
15891589   state->m_current_reset_bank_counter = 0xFF;
15901590   state->m_dpc.oscillator = machine.scheduler().timer_alloc(FUNC(modeDPC_timer_callback));
r14976r14977
19561956      space->install_write_handler(0x1fe8, 0x1feb, write8_delegate(FUNC(a2600_state::modeE7_RAM_switch_w),state));
19571957      space->install_read_handler(0x1fe8, 0x1feb, read8_delegate(FUNC(a2600_state::modeE7_RAM_switch_r),state));
19581958      space->install_readwrite_bank(0x1800, 0x18ff, "bank9");
1959      memory_set_bankptr(machine, "bank9", state->m_extra_RAM->base() + 4 * 256 );
1959      state->membank("bank9")->set_base(state->m_extra_RAM->base() + 4 * 256 );
19601960      break;
19611961
19621962   case modeDC:
r14976r14977
19791979      space->install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(a2600_state::modeSS_r),state));
19801980      state->m_bank_base[1] = state->m_extra_RAM->base() + 2 * 0x800;
19811981      state->m_bank_base[2] = CART;
1982      memory_set_bankptr(machine, "bank1", state->m_bank_base[1] );
1983      memory_set_bankptr(machine, "bank2", state->m_bank_base[2] );
1982      state->membank("bank1")->set_base(state->m_bank_base[1] );
1983      state->membank("bank2")->set_base(state->m_bank_base[2] );
19841984      state->m_modeSS_write_enabled = 0;
19851985      state->m_modeSS_byte_started = 0;
19861986      space->set_direct_update_handler(direct_update_delegate(FUNC(a2600_state::modeSS_opbase), state));
r14976r14977
20122012      break;
20132013
20142014   case mode32in1:
2015      memory_set_bankptr(machine, "bank1", CART + state->m_current_reset_bank_counter * 0x800 );
2016      memory_set_bankptr(machine, "bank2", CART + state->m_current_reset_bank_counter * 0x800 );
2015      state->membank("bank1")->set_base(CART + state->m_current_reset_bank_counter * 0x800 );
2016      state->membank("bank2")->set_base(CART + state->m_current_reset_bank_counter * 0x800 );
20172017      break;
20182018
20192019   case modeJVP:
r14976r14977
20292029      space->install_write_bank(0x1000, 0x10ff, "bank9");
20302030      space->install_read_bank(0x1100, 0x11ff, "bank9");
20312031
2032      memory_set_bankptr(machine,"bank9", state->m_extra_RAM->base());
2032      state->membank("bank9")->set_base(state->m_extra_RAM->base());
20332033   }
20342034
20352035   if (state->m_banking_mode == modeCV)
r14976r14977
20372037      space->install_write_bank(0x1400, 0x17ff, "bank9");
20382038      space->install_read_bank(0x1000, 0x13ff, "bank9");
20392039
2040      memory_set_bankptr(machine,"bank9", state->m_extra_RAM->base());
2040      state->membank("bank9")->set_base(state->m_extra_RAM->base());
20412041   }
20422042
20432043   if (chip)
r14976r14977
20452045      space->install_write_bank(0x1000, 0x107f, "bank9");
20462046      space->install_read_bank(0x1080, 0x10ff, "bank9");
20472047
2048      memory_set_bankptr(machine,"bank9", state->m_extra_RAM->base());
2048      state->membank("bank9")->set_base(state->m_extra_RAM->base());
20492049   }
20502050
20512051   /* Banks may have changed, reset the cpu so it uses the correct reset vector */
src/mess/drivers/pcw.c
r14976r14977
253253      space->install_read_bank(block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff,block_name);
254254//      LOG(("MEM: read block %i -> bank %i\n",block,bank));
255255   }
256   memory_set_bankptr(machine, block_name, machine.device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine.device<ram_device>(RAM_TAG)->size()));
256   state->membank(block_name)->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine.device<ram_device>(RAM_TAG)->size()));
257257}
258258
259259
260260
261261static void pcw_update_write_memory_block(running_machine &machine, int block, int bank)
262262{
263   pcw_state *state = machine.driver_data<pcw_state>();
263264   char block_name[10];
264265
265266   sprintf(block_name,"bank%d",block+5);
266   memory_set_bankptr(machine, block_name, machine.device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine.device<ram_device>(RAM_TAG)->size()));
267   state->membank(block_name)->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine.device<ram_device>(RAM_TAG)->size()));
267268//  LOG(("MEM: write block %i -> bank %i\n",block,bank));
268269}
269270
r14976r14977
343344    {
344345        unsigned char *FakeROM;
345346
346        FakeROM = &machine.region("maincpu")->base()[0x010000];
347        FakeROM = &machine.root_device().memregion("maincpu")->base()[0x010000];
347348
348        memory_set_bankptr(machine, "bank1", FakeROM);
349        state->membank("bank1")->set_base(FakeROM);
349350    }*/
350351}
351352
r14976r14977
10501051static MACHINE_RESET( pcw )
10511052{
10521053   pcw_state *state = machine.driver_data<pcw_state>();
1053   UINT8* code = machine.region("printer_mcu")->base();
1054   UINT8* code = state->memregion("printer_mcu")->base();
10541055   int x;
10551056   /* ram paging is actually undefined at power-on */
10561057
src/mess/drivers/studio2.c
r14976r14977
437437      // WARNING: list code currently assume that cart mapping starts at 0x400.
438438      // the five dumps currently available work like this, but the .st2 format
439439      // allows for more freedom... how was the content of a real cart mapped?
440      UINT8 *ptr = ((UINT8 *) image.device().machine().region(CDP1802_TAG)->base()) + 0x400;
440      UINT8 *ptr = ((UINT8 *) image.device().machine().root_device().memregion(CDP1802_TAG)->base()) + 0x400;
441441      memcpy(ptr, image.get_software_region("rom"), image.get_software_region_length("rom"));
442442      return IMAGE_INIT_PASS;
443443   }
src/mess/drivers/osi.c
r14976r14977
640640   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
641641
642642   /* configure RAM banking */
643   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(M6502_TAG)->base(), 0);
644   memory_set_bank(machine(), "bank1", 0);
643   membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base());
644   membank("bank1")->set_entry(0);
645645
646646   switch (m_ram->size())
647647   {
r14976r14977
665665   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
666666
667667   /* configure RAM banking */
668   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(M6502_TAG)->base(), 0);
669   memory_set_bank(machine(), "bank1", 0);
668   membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base());
669   membank("bank1")->set_entry(0);
670670
671671   switch (m_ram->size())
672672   {
src/mess/drivers/mekd2.c
r14976r14977
299299   static const char magic[] = "MEK6800D2";
300300   char buff[9];
301301   UINT16 addr, size;
302   UINT8 ident, *RAM = image.device().machine().region("maincpu")->base();
302   UINT8 ident, *RAM = image.device().machine().root_device().memregion("maincpu")->base();
303303
304304   image.fread( buff, sizeof (buff));
305305   if (memcmp(buff, magic, sizeof (buff)))
src/mess/drivers/rt1715.c
r14976r14977
109109
110110static MACHINE_START( rt1715 )
111111{
112   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0x0800);
113   memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer());
112   rt1715_state *state = machine.driver_data<rt1715_state>();
113   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x0800);
114   state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
114115}
115116
116117static MACHINE_RESET( rt1715 )
117118{
119   rt1715_state *state = machine.driver_data<rt1715_state>();
118120   /* on reset, enable ROM */
119   memory_set_bankptr(machine, "bank1", machine.region("ipl")->base());
121   state->membank("bank1")->set_base(state->memregion("ipl")->base());
120122}
121123
122124WRITE8_MEMBER(rt1715_state::rt1715_rom_disable)
r14976r14977
124126   logerror("%s: rt1715_set_bank %02x\n", machine().describe_context(), data);
125127
126128   /* disable ROM, enable RAM */
127   memory_set_bankptr(machine(), "bank1", machine().device<ram_device>(RAM_TAG)->pointer());
129   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
128130}
129131
130132/***************************************************************************
src/mess/drivers/dual68.c
r14976r14977
6363static MACHINE_RESET(dual68)
6464{
6565   dual68_state *state = machine.driver_data<dual68_state>();
66   UINT8* user1 = machine.region("user1")->base();
66   UINT8* user1 = state->memregion("user1")->base();
6767
6868   memcpy((UINT8*)state->m_p_ram.target(),user1,0x2000);
6969
src/mess/drivers/rex6000.c
r14976r14977
450450   m_flash[3] = machine().device<fujitsu_29dl16x_device>("flash1b");
451451
452452   m_ram_base = m_ram->pointer();
453   memory_set_bankptr(machine(), "ram", m_ram_base + 0x4000);
453   membank("ram")->set_base(m_ram_base + 0x4000);
454454}
455455void rex6000_state::machine_reset()
456456{
src/mess/drivers/mirage.c
r14976r14977
7878void mirage_state::machine_reset()
7979{
8080   last_sndram_bank = 0;
81   memory_set_bankptr(machine(), "sndbank", machine().region("es5503")->base() );
81   membank("sndbank")->set_base(machine().root_device().memregion("es5503")->base() );
8282}
8383
8484static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state )
r14976r14977
112112static WRITE8_DEVICE_HANDLER( mirage_via_write_portb )
113113{
114114   int bank = 0;
115    mirage_state *mirage = device->machine().driver_data<mirage_state>();
115    mirage_state *state = device->machine().driver_data<mirage_state>();
116116
117117   // handle sound RAM bank switching
118118   bank = (data & 2) ? (64*1024) : 0;
119119   bank += (data & 1) ? (32*1024) : 0;
120   if (bank != mirage->last_sndram_bank)
120   if (bank != state->last_sndram_bank)
121121   {
122      mirage->last_sndram_bank = bank;
123      memory_set_bankptr(device->machine(), "sndbank", device->machine().region("es5503")->base() + bank);
122      state->last_sndram_bank = bank;
123      state->membank("sndbank")->set_base(device->machine().root_device().memregion("es5503")->base() + bank);
124124   }
125125}
126126
src/mess/drivers/v1050.c
r14976r14977
130130   if (BIT(m_bank, 0))
131131   {
132132      program->install_readwrite_bank(0x0000, 0x1fff, "bank1");
133      memory_set_bank(machine(), "bank1", bank);
133      membank("bank1")->set_entry(bank);
134134   }
135135   else
136136   {
137137      program->install_read_bank(0x0000, 0x1fff, "bank1");
138138      program->unmap_write(0x0000, 0x1fff);
139      memory_set_bank(machine(), "bank1", 3);
139      membank("bank1")->set_entry(3);
140140   }
141141
142   memory_set_bank(machine(), "bank2", bank);
142   membank("bank2")->set_entry(bank);
143143
144144   if (bank == 2)
145145   {
r14976r14977
149149   {
150150      program->install_readwrite_bank(0x4000, 0x7fff, "bank3");
151151      program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
152      memory_set_bank(machine(), "bank3", bank);
153      memory_set_bank(machine(), "bank4", bank);
152      membank("bank3")->set_entry(bank);
153      membank("bank4")->set_entry(bank);
154154   }
155155
156   memory_set_bank(machine(), "bank5", bank);
156   membank("bank5")->set_entry(bank);
157157}
158158
159159// Keyboard HACK
r14976r14977
10441044   // setup memory banking
10451045   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
10461046
1047   memory_configure_bank(machine(), "bank1", 0, 2, ram, 0x10000);
1048   memory_configure_bank(machine(), "bank1", 2, 1, ram + 0x1c000, 0);
1049   memory_configure_bank(machine(), "bank1", 3, 1, machine().region(Z80_TAG)->base(), 0);
1047   membank("bank1")->configure_entries(0, 2, ram, 0x10000);
1048   membank("bank1")->configure_entry(2, ram + 0x1c000);
1049   membank("bank1")->configure_entry(3, memregion(Z80_TAG)->base());
10501050
10511051   program->install_readwrite_bank(0x2000, 0x3fff, "bank2");
1052   memory_configure_bank(machine(), "bank2", 0, 2, ram + 0x2000, 0x10000);
1053   memory_configure_bank(machine(), "bank2", 2, 1, ram + 0x1e000, 0);
1052   membank("bank2")->configure_entries(0, 2, ram + 0x2000, 0x10000);
1053   membank("bank2")->configure_entry(2, ram + 0x1e000);
10541054
10551055   program->install_readwrite_bank(0x4000, 0x7fff, "bank3");
1056   memory_configure_bank(machine(), "bank3", 0, 2, ram + 0x4000, 0x10000);
1056   membank("bank3")->configure_entries(0, 2, ram + 0x4000, 0x10000);
10571057
10581058   program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
1059   memory_configure_bank(machine(), "bank4", 0, 2, ram + 0x8000, 0x10000);
1059   membank("bank4")->configure_entries(0, 2, ram + 0x8000, 0x10000);
10601060
10611061   program->install_readwrite_bank(0xc000, 0xffff, "bank5");
1062   memory_configure_bank(machine(), "bank5", 0, 3, ram + 0xc000, 0);
1062   membank("bank5")->configure_entries(0, 3, ram + 0xc000, 0);
10631063
10641064   bankswitch();
10651065
src/mess/drivers/ql.c
r14976r14977
309309      space.unmap_readwrite(0x0c0000, 0x0fffff);
310310
311311   // Setup trumcard rom mapped to rom so unlink us
312   space.install_rom(0x010000, 0x018000, &machine().region(M68008_TAG)->base()[TRUMP_ROM_BASE]);
312   space.install_rom(0x010000, 0x018000, &machine().root_device().memregion(M68008_TAG)->base()[TRUMP_ROM_BASE]);
313313
314   return machine().region(M68008_TAG)->base()[TRUMP_ROM_BASE+offset];
314   return memregion(M68008_TAG)->base()[TRUMP_ROM_BASE+offset];
315315}
316316
317317READ8_MEMBER( ql_state::cart_rom_r )
318318{
319319   // Setup trumcard rom mapped in at $c0000
320   space.install_rom(0x0c0000, 0x0c8000, &machine().region(M68008_TAG)->base()[TRUMP_ROM_BASE]);
320   space.install_rom(0x0c0000, 0x0c8000, &machine().root_device().memregion(M68008_TAG)->base()[TRUMP_ROM_BASE]);
321321
322322   // Setup cart rom to rom handler, so unlink us
323   space.install_rom(0x0c000, 0x0ffff, &machine().region(M68008_TAG)->base()[CART_ROM_BASE]);
323   space.install_rom(0x0c000, 0x0ffff, &machine().root_device().memregion(M68008_TAG)->base()[CART_ROM_BASE]);
324324
325   return machine().region(M68008_TAG)->base()[CART_ROM_BASE+offset];
325   return memregion(M68008_TAG)->base()[CART_ROM_BASE+offset];
326326}
327327
328328void ql_state::trump_card_set_control(UINT8 data)
r14976r14977
978978   {
979979      case DISK_TYPE_SANDY :
980980         logerror("Configuring SandySuperDisk\n");
981         program->install_rom(0x0c0000, 0x0c3fff, &machine().region(M68008_TAG)->base()[SANDY_ROM_BASE]);
981         program->install_rom(0x0c0000, 0x0c3fff, &machine().root_device().memregion(M68008_TAG)->base()[SANDY_ROM_BASE]);
982982         program->install_read_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this));
983983         program->install_write_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this));
984984         m_disk_io_base=SANDY_IO_BASE;
src/mess/drivers/ti990_10.c
r14976r14977
294294   /* load specific ti990/12 rom page */
295295   const int page = 3;
296296
297   memmove(machine.region("maincpu")->base()+0x1FFC00, machine.region("maincpu")->base()+0x1FFC00+(page*0x400), 0x400);
297   memmove(machine.root_device().memregion("maincpu")->base()+0x1FFC00, machine.root_device().memregion("maincpu")->base()+0x1FFC00+(page*0x400), 0x400);
298298#endif
299299   vdt911_init(machine);
300300}
src/mess/drivers/amiga.c
r14976r14977
536536{
537537   amiga_state *state = device->machine().driver_data<amiga_state>();
538538   /* switch banks as appropriate */
539   memory_set_bank(device->machine(), "bank1", data & 1);
539   state->membank("bank1")->set_entry(data & 1);
540540
541541   /* swap the write handlers between ROM and bank 1 based on the bit */
542542   if ((data & 1) == 0) {
r14976r14977
550550      device->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x000000, state->m_chip_ram.bytes() - 1, 0, mirror_mask, "bank1");
551551
552552      /* if there is a cart region, check for cart overlay */
553      if (device->machine().region("user2")->base() != NULL)
553      if (device->machine().root_device().memregion("user2")->base() != NULL)
554554         amiga_cart_check_overlay(device->machine());
555555   }
556556   else
r14976r14977
621621   amiga_machine_config(machine, &amiga_intf);
622622
623623   /* set up memory */
624   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
625   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
624   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
625   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
626626
627627   /* initialize cartridge (if present) */
628628   amiga_cart_init(machine);
r14976r14977
653653   amiga_machine_config(machine, &amiga_intf);
654654
655655   /* set up memory */
656   memory_configure_bank(1, 0, 1, state->m_chip_ram, 0);
657   memory_configure_bank(1, 1, 1, machine.region("user1")->base(), 0);
656   1.root_device().membank(0)->configure_entries(1, state->m_chip_ram, 0);
657   1.root_device().membank(1)->configure_entries(1, machine.root_device().memregion("user1")->base(), 0);
658658
659659   /* initialize Action Replay (if present) */
660660   amiga_cart_init(machine);
r14976r14977
682682   amiga_machine_config(machine, &amiga_intf);
683683
684684   /* set up memory */
685   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
686   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
685   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
686   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
687687
688688   /* initialize keyboard - in cdtv we can use a standard Amiga keyboard*/
689689   amigakbd_init(machine);
src/mess/drivers/sorcerer.c
r14976r14977
346346{
347347   UINT8 y,ra,chr,gfx;
348348   UINT16 sy=0,ma=0xf080,x;
349   UINT8 *RAM = screen.machine().region("maincpu")->base();
349   UINT8 *RAM = screen.machine().root_device().memregion("maincpu")->base();
350350
351351   for (y = 0; y < 30; y++)
352352   {
r14976r14977
483483
484484static DRIVER_INIT( sorcerer )
485485{
486   UINT8 *RAM = machine.region("maincpu")->base();
487   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xe000);
486   sorcerer_state *state = machine.driver_data<sorcerer_state>();
487   UINT8 *RAM = state->memregion("maincpu")->base();
488   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000);
488489}
489490
490491/***************************************************************************
src/mess/drivers/abc80x.c
r14976r14977
211211   else
212212   {
213213      // BASIC ROM selected
214      program->install_rom(0x0000, 0x3fff, machine().region(Z80_TAG)->base());
214      program->install_rom(0x0000, 0x3fff, memregion(Z80_TAG)->base());
215215   }
216216}
217217
r14976r14977
227227   if (m_lrs)
228228   {
229229      // ROM and video RAM selected
230      program->install_rom(0x0000, 0x77ff, machine().region(Z80_TAG)->base());
230      program->install_rom(0x0000, 0x77ff, memregion(Z80_TAG)->base());
231231      program->install_ram(0x7800, 0x7fff, m_char_ram);
232232   }
233233   else
r14976r14977
266266         //logerror("%04x-%04x: Video RAM %04x (32K)\n", start_addr, end_addr, videoram_offset);
267267
268268         program->install_readwrite_bank(start_addr, end_addr, bank_name);
269         memory_configure_bank(machine(), bank_name, 1, 1, m_video_ram + videoram_offset, 0);
270         memory_set_bank(machine(), bank_name, 1);
269         membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset);
270         membank(bank_name)->set_entry(1);
271271      }
272272
273273      for (bank = 9; bank <= 16; bank++)
r14976r14977
280280         //logerror("%04x-%04x: Work RAM (32K)\n", start_addr, end_addr);
281281
282282         program->install_readwrite_bank(start_addr, end_addr, bank_name);
283         memory_set_bank(machine(), bank_name, 0);
283         membank(bank_name)->set_entry(0);
284284      }
285285   }
286286   else
r14976r14977
300300            //logerror("%04x-%04x: Video RAM %04x (4K)\n", start_addr, end_addr, videoram_offset);
301301
302302            program->install_readwrite_bank(start_addr, end_addr, bank_name);
303            memory_configure_bank(machine(), bank_name, 1, 1, m_video_ram + videoram_offset, 0);
304            memory_set_bank(machine(), bank_name, 1);
303            membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset);
304            membank(bank_name)->set_entry(1);
305305         }
306306         else
307307         {
r14976r14977
315315
316316               program->install_read_bank(start_addr, end_addr, bank_name);
317317               program->unmap_write(start_addr, end_addr);
318               memory_set_bank(machine(), bank_name, 0);
318               membank(bank_name)->set_entry(0);
319319               break;
320320
321321            case 8:
r14976r14977
325325               program->install_read_bank(0x7000, 0x77ff, bank_name);
326326               program->unmap_write(0x7000, 0x77ff);
327327               program->install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate(FUNC(abc806_state::charram_r),this), write8_delegate(FUNC(abc806_state::charram_w),this));
328               memory_set_bank(machine(), bank_name, 0);
328               membank(bank_name)->set_entry(0);
329329               break;
330330
331331            default:
r14976r14977
333333               //logerror("%04x-%04x: Work RAM (4K)\n", start_addr, end_addr);
334334
335335               program->install_readwrite_bank(start_addr, end_addr, bank_name);
336               memory_set_bank(machine(), bank_name, 0);
336               membank(bank_name)->set_entry(0);
337337               break;
338338            }
339339         }
r14976r14977
366366            program->install_readwrite_bank(start_addr, end_addr, bank_name);
367367         }
368368
369         memory_configure_bank(machine(), bank_name, 1, 1, m_video_ram + videoram_offset, 0);
370         memory_set_bank(machine(), bank_name, 1);
369         membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset);
370         membank(bank_name)->set_entry(1);
371371      }
372372   }
373373}
r14976r14977
994994
995995void abc806_state::machine_start()
996996{
997   UINT8 *mem = machine().region(Z80_TAG)->base();
997   UINT8 *mem = memregion(Z80_TAG)->base();
998998   UINT32 videoram_size = m_ram->size() - (32 * 1024);
999999   int bank;
10001000   char bank_name[10];
r14976r14977
10051005   for (bank = 1; bank <= 16; bank++)
10061006   {
10071007      sprintf(bank_name,"bank%d",bank);
1008      memory_configure_bank(machine(), bank_name, 0, 1, mem + (0x1000 * (bank - 1)), 0);
1009      memory_configure_bank(machine(), bank_name, 1, 1, m_video_ram, 0);
1010      memory_set_bank(machine(), bank_name, 0);
1008      membank(bank_name)->configure_entry(0, mem + (0x1000 * (bank - 1)));
1009      membank(bank_name)->configure_entry(1, m_video_ram);
1010      membank(bank_name)->set_entry(0);
10111011   }
10121012
10131013   // register for state saving
r14976r14977
10341034   for (bank = 1; bank <= 16; bank++)
10351035   {
10361036      sprintf(bank_name,"bank%d",bank);
1037      memory_set_bank(machine(), bank_name, 0);
1037      membank(bank_name)->set_entry(0);
10381038   }
10391039
10401040   bankswitch();
r14976r14977
14151415{
14161416   if (address >= 0x7c00 && address < 0x8000)
14171417   {
1418      direct.explicit_configure(0x7c00, 0x7fff, 0x3ff, machine().region(Z80_TAG)->base() + 0x7c00);
1418      direct.explicit_configure(0x7c00, 0x7fff, 0x3ff, memregion(Z80_TAG)->base() + 0x7c00);
14191419
14201420      if (!m_fetch_charram)
14211421      {
r14976r14977
14511451{
14521452   if (address >= 0x7800 && address < 0x8000)
14531453   {
1454      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine().region(Z80_TAG)->base() + 0x7800);
1454      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, memregion(Z80_TAG)->base() + 0x7800);
14551455
14561456      if (!m_fetch_charram)
14571457      {
r14976r14977
14891489   {
14901490      if (address >= 0x7800 && address < 0x8000)
14911491      {
1492         direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine().region(Z80_TAG)->base() + 0x7800);
1492         direct.explicit_configure(0x7800, 0x7fff, 0x7ff, memregion(Z80_TAG)->base() + 0x7800);
14931493         return ~0;
14941494      }
14951495   }
r14976r14977
15131513{   
15141514   if (address >= 0x7800 && address < 0x8000)
15151515   {
1516      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, machine().region(Z80_TAG)->base() + 0x7800);
1516      direct.explicit_configure(0x7800, 0x7fff, 0x7ff, memregion(Z80_TAG)->base() + 0x7800);
15171517
15181518      if (!m_fetch_charram)
15191519      {
src/mess/drivers/a7000.c
r14976r14977
265265   int x_size,y_size,x_start,y_start;
266266   int x,y,xi;
267267   UINT32 count;
268   UINT8 *vram = machine().region("vram")->base();
268   UINT8 *vram = memregion("vram")->base();
269269
270270   bitmap.fill(machine().pens[0x100], cliprect);
271271
r14976r14977
609609   UINT32 dst = 0;
610610   UINT32 size = m_viddma_addr_end;
611611   UINT32 dma_index;
612   UINT8 *vram = machine().region("vram")->base();
612   UINT8 *vram = memregion("vram")->base();
613613
614614   /* TODO: this should actually be a qword transfer */
615615   for(dma_index = 0;dma_index < size;dma_index++)
src/mess/drivers/qx10.c
r14976r14977
248248
249249   if (!m_memprom)
250250   {
251      memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base());
251      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
252252   }
253253   else
254254   {
255      memory_set_bankptr(machine(), "bank1", machine().device<ram_device>(RAM_TAG)->pointer() + drambank*64*1024);
255      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + drambank*64*1024);
256256   }
257257   if (m_memcmos)
258258   {
259      memory_set_bankptr(machine(), "bank2", m_cmosram);
259      membank("bank2")->set_base(m_cmosram);
260260   }
261261   else
262262   {
263      memory_set_bankptr(machine(), "bank2", machine().device<ram_device>(RAM_TAG)->pointer() + drambank*64*1024 + 32*1024);
263      membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + drambank*64*1024 + 32*1024);
264264   }
265265}
266266
r14976r14977
958958   //m_video_ram = auto_alloc_array_clear(machine(), UINT8, 0x60000);
959959
960960   // find memory regions
961   m_char_rom = machine().region("chargen")->base();
961   m_char_rom = memregion("chargen")->base();
962962}
963963
964964static UPD7220_INTERFACE( hgdc_intf )
src/mess/drivers/bigbord2.c
r14976r14977
178178   if (bank)
179179   {
180180      /* ROM */
181      program->install_rom(0x0000, 0x0fff, machine.region("monitor")->base());
181      program->install_rom(0x0000, 0x0fff, machine.root_device().memregion("monitor")->base());
182182      program->unmap_readwrite(0x1000, 0x1fff);
183183      program->install_ram(0x3000, 0x3fff, m_videoram);
184184   }
r14976r14977
442442void bigbord2_state::video_start()
443443{
444444   /* find memory regions */
445   m_char_rom = machine().region("chargen")->base();
445   m_char_rom = memregion("chargen")->base();
446446}
447447
448448
src/mess/drivers/tvc.c
r14976r14977
3737
3838static void tvc_set_mem_page(running_machine &machine, UINT8 data)
3939{
40   tvc_state *state = machine.driver_data<tvc_state>();
4041   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
4142   switch(data & 0x18) {
4243      case 0x00 : // system ROM selected
4344            space->install_read_bank(0x0000, 0x3fff, "bank1");
4445            space->unmap_write(0x0000, 0x3fff);
45            memory_set_bankptr(space->machine(), "bank1", machine.region("sys")->base());
46            state->membank("bank1")->set_base(machine.root_device().memregion("sys")->base());
4647            break;
4748      case 0x08 : // Cart ROM selected
4849            space->install_read_bank(0x0000, 0x3fff, "bank1");
4950            space->unmap_write(0x0000, 0x3fff);
50            memory_set_bankptr(space->machine(), "bank1", machine.region("cart")->base());
51            state->membank("bank1")->set_base(machine.root_device().memregion("cart")->base());
5152            break;
5253      case 0x10 : // RAM selected
5354            space->install_readwrite_bank(0x0000, 0x3fff, "bank1");
54            memory_set_bankptr(space->machine(), "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
55            state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
5556            break;
5657   }
5758   // Bank 2 is always RAM
58   memory_set_bankptr(space->machine(), "bank2", machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
59   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
5960   if ((data & 0x20)==0) {
6061      // Video RAM
61      memory_set_bankptr(space->machine(), "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000);
62      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x10000);
6263   } else {
6364      // System RAM page 3
64      memory_set_bankptr(space->machine(), "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
65      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
6566   }
6667   switch(data & 0xc0) {
6768      case 0x00 : // Cart ROM selected
6869            space->install_read_bank(0xc000, 0xffff, "bank4");
6970            space->unmap_write(0xc000, 0xffff);
70            memory_set_bankptr(space->machine(), "bank4", machine.region("cart")->base());
71            state->membank("bank4")->set_base(machine.root_device().memregion("cart")->base());
7172            break;
7273      case 0x40 : // System ROM selected
7374            space->install_read_bank(0xc000, 0xffff, "bank4");
7475            space->unmap_write(0xc000, 0xffff);
75            memory_set_bankptr(space->machine(), "bank4", machine.region("sys")->base());
76            state->membank("bank4")->set_base(machine.root_device().memregion("sys")->base());
7677            break;
7778      case 0x80 : // RAM selected
7879            space->install_readwrite_bank(0xc000, 0xffff, "bank4");
79            memory_set_bankptr(space->machine(), "bank4", machine.device<ram_device>(RAM_TAG)->pointer()+0xc000);
80            state->membank("bank4")->set_base(machine.device<ram_device>(RAM_TAG)->pointer()+0xc000);
8081            break;
8182      case 0xc0 : // External ROM selected
8283            space->install_read_bank(0xc000, 0xffff, "bank4");
8384            space->unmap_write(0xc000, 0xffff);
84            memory_set_bankptr(space->machine(), "bank4", machine.region("ext")->base());
85            state->membank("bank4")->set_base(machine.root_device().memregion("ext")->base());
8586            break;
8687
8788   }
src/mess/drivers/tmc1800.c
r14976r14977
169169{
170170   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
171171   UINT8 *ram = m_ram->pointer();
172   UINT8 *rom = machine().region(CDP1802_TAG)->base();
172   UINT8 *rom = memregion(CDP1802_TAG)->base();
173173
174174   if (m_roc)
175175   {
r14976r14977
746746
747747   /* enable ROM */
748748   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
749   UINT8 *rom = machine().region(CDP1802_TAG)->base();
749   UINT8 *rom = memregion(CDP1802_TAG)->base();
750750   program->install_rom(0x0000, 0x01ff, 0, 0x7e00, rom);
751751}
752752
r14976r14977
763763
764764static QUICKLOAD_LOAD( tmc1800 )
765765{
766   UINT8 *ptr = image.device().machine().region(CDP1802_TAG)->base();
766   UINT8 *ptr = image.device().machine().root_device().memregion(CDP1802_TAG)->base();
767767   int size = image.length();
768768
769769   if (size > image.device().machine().device<ram_device>(RAM_TAG)->size())
src/mess/drivers/crvision.c
r14976r14977
847847   UINT32 size;
848848   UINT8 *temp_copy;
849849   running_machine &machine = image.device().machine();
850   UINT8 *mem = machine.region(M6502_TAG)->base();
850   crvision_state *state = machine.driver_data<crvision_state>();
851   UINT8 *mem = state->memregion(M6502_TAG)->base();
851852   address_space *program = machine.device(M6502_TAG)->memory().space(AS_PROGRAM);
852853
853854   if (image.software_entry() == NULL)
r14976r14977
940941      return IMAGE_INIT_FAIL;
941942   }
942943
943   memory_configure_bank(machine, "bank1", 0, 1, mem + 0x8000, 0);
944   memory_set_bank(machine, "bank1", 0);
944   state->membank("bank1")->configure_entry(0, mem + 0x8000);
945   state->membank("bank1")->set_entry(0);
945946
946   memory_configure_bank(machine, "bank2", 0, 1, mem + 0x4000, 0);
947   memory_set_bank(machine, "bank2", 0);
947   state->membank("bank2")->configure_entry(0, mem + 0x4000);
948   state->membank("bank2")->set_entry(0);
948949
949950   auto_free(machine, temp_copy);
950951
src/mess/drivers/fmtowns.c
r14976r14977
157157   // TODO: init serial ROM contents
158158   int x;
159159   static const UINT8 code[8] = { 0x04,0x65,0x54,0xA4,0x95,0x45,0x35,0x5F };
160   UINT8* srom = machine.region("serial")->base();
160   UINT8* srom = machine.root_device().memregion("serial")->base();
161161
162162   memset(m_towns_serial_rom,0,256/8);
163163
r14976r14977
11301130
11311131void towns_state::towns_update_video_banks(address_space& space)
11321132{
1133   towns_state *state = space.machine().driver_data<towns_state>();
11331134   UINT8* ROM;
11341135
11351136   if(m_towns_mainmem_enable != 0)  // first MB is RAM
11361137   {
1137      ROM = space.machine().region("user")->base();
1138      ROM = state->memregion("user")->base();
11381139
1139//      memory_set_bankptr(space.machine(),1,m_messram->pointer()+0xc0000);
1140//      memory_set_bankptr(space.machine(),2,m_messram->pointer()+0xc8000);
1141//      memory_set_bankptr(space.machine(),3,m_messram->pointer()+0xc9000);
1142//      memory_set_bankptr(space.machine(),4,m_messram->pointer()+0xca000);
1143//      memory_set_bankptr(space.machine(),5,m_messram->pointer()+0xca000);
1144//      memory_set_bankptr(space.machine(),10,m_messram->pointer()+0xca800);
1145      memory_set_bankptr(space.machine(),"bank6",m_messram->pointer()+0xcb000);
1146      memory_set_bankptr(space.machine(),"bank7",m_messram->pointer()+0xcb000);
1140//      state->membank(1)->set_base(m_messram->pointer()+0xc0000);
1141//      state->membank(2)->set_base(m_messram->pointer()+0xc8000);
1142//      state->membank(3)->set_base(m_messram->pointer()+0xc9000);
1143//      state->membank(4)->set_base(m_messram->pointer()+0xca000);
1144//      state->membank(5)->set_base(m_messram->pointer()+0xca000);
1145//      state->membank(10)->set_base(m_messram->pointer()+0xca800);
1146      state->membank("bank6")->set_base(m_messram->pointer()+0xcb000);
1147      state->membank("bank7")->set_base(m_messram->pointer()+0xcb000);
11471148      if(m_towns_system_port & 0x02)
1148         memory_set_bankptr(space.machine(),"bank11",m_messram->pointer()+0xf8000);
1149         state->membank("bank11")->set_base(m_messram->pointer()+0xf8000);
11491150      else
1150         memory_set_bankptr(space.machine(),"bank11",ROM+0x238000);
1151      memory_set_bankptr(space.machine(),"bank12",m_messram->pointer()+0xf8000);
1151         state->membank("bank11")->set_base(ROM+0x238000);
1152      state->membank("bank12")->set_base(m_messram->pointer()+0xf8000);
11521153      return;
11531154   }
11541155   else  // enable I/O ports and VRAM
11551156   {
1156      ROM = space.machine().region("user")->base();
1157      ROM = state->memregion("user")->base();
11571158
1158//      memory_set_bankptr(space.machine(),1,towns_gfxvram+(towns_vram_rplane*0x8000));
1159//      memory_set_bankptr(space.machine(),2,towns_txtvram);
1160//      memory_set_bankptr(space.machine(),3,state->m_messram->pointer()+0xc9000);
1159//      state->membank(1)->set_base(towns_gfxvram+(towns_vram_rplane*0x8000));
1160//      state->membank(2)->set_base(towns_txtvram);
1161//      state->membank(3)->set_base(state->m_messram->pointer()+0xc9000);
11611162//      if(towns_ankcg_enable != 0)
1162//          memory_set_bankptr(space.machine(),4,ROM+0x180000+0x3d000);  // ANK CG 8x8
1163//          state->membank(4)->set_base(ROM+0x180000+0x3d000);  // ANK CG 8x8
11631164//      else
1164//          memory_set_bankptr(space.machine(),4,towns_txtvram+0x2000);
1165//      memory_set_bankptr(space.machine(),5,towns_txtvram+0x2000);
1166//      memory_set_bankptr(space.machine(),10,state->m_messram->pointer()+0xca800);
1165//          state->membank(4)->set_base(towns_txtvram+0x2000);
1166//      state->membank(5)->set_base(towns_txtvram+0x2000);
1167//      state->membank(10)->set_base(state->m_messram->pointer()+0xca800);
11671168      if(m_towns_ankcg_enable != 0)
1168         memory_set_bankptr(space.machine(),"bank6",ROM+0x180000+0x3d800);  // ANK CG 8x16
1169         state->membank("bank6")->set_base(ROM+0x180000+0x3d800);  // ANK CG 8x16
11691170      else
1170         memory_set_bankptr(space.machine(),"bank6",m_messram->pointer()+0xcb000);
1171      memory_set_bankptr(space.machine(),"bank7",m_messram->pointer()+0xcb000);
1171         state->membank("bank6")->set_base(m_messram->pointer()+0xcb000);
1172      state->membank("bank7")->set_base(m_messram->pointer()+0xcb000);
11721173      if(m_towns_system_port & 0x02)
1173         memory_set_bankptr(space.machine(),"bank11",m_messram->pointer()+0xf8000);
1174         state->membank("bank11")->set_base(m_messram->pointer()+0xf8000);
11741175      else
1175         memory_set_bankptr(space.machine(),"bank11",ROM+0x238000);
1176      memory_set_bankptr(space.machine(),"bank12",m_messram->pointer()+0xf8000);
1176         state->membank("bank11")->set_base(ROM+0x238000);
1177      state->membank("bank12")->set_base(m_messram->pointer()+0xf8000);
11771178      return;
11781179   }
11791180}
src/mess/drivers/mz2500.c
r14976r14977
218218static void draw_80x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr)
219219{
220220   mz2500_state *state = machine.driver_data<mz2500_state>();
221   UINT8 *vram = machine.region("maincpu")->base();
221   UINT8 *vram = machine.root_device().memregion("maincpu")->base();
222222   int x,y,count,xi,yi;
223223   UINT8 *gfx_data;
224224   UINT8 y_step;
r14976r14977
243243         int inv_col = (attr & 0x40) >> 6;
244244
245245         if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms
246            gfx_data = machine.region("pcg")->base();
246            gfx_data = machine.root_device().memregion("pcg")->base();
247247         else if(gfx_sel == 0x80)
248248         {
249            gfx_data = machine.region("kanji")->base();
249            gfx_data = state->memregion("kanji")->base();
250250            tile|= tile_bank << 8;
251251            if(y_step == 2)
252252               tile &= 0x3ffe;
253253         }
254254         else if(gfx_sel == 0xc0)
255255         {
256            gfx_data = machine.region("kanji")->base();
256            gfx_data = machine.root_device().memregion("kanji")->base();
257257            tile|= (tile_bank << 8);
258258            if(y_step == 2)
259259               tile &= 0x3ffe;
r14976r14977
261261         }
262262         else
263263         {
264            gfx_data = machine.region("pcg")->base();
264            gfx_data = machine.root_device().memregion("pcg")->base();
265265         }
266266
267267         for(yi=0;yi<8*y_step;yi++)
r14976r14977
309309static void draw_40x25(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr)
310310{
311311   mz2500_state *state = machine.driver_data<mz2500_state>();
312   UINT8 *vram = machine.region("maincpu")->base();
312   UINT8 *vram = machine.root_device().memregion("maincpu")->base();
313313   int x,y,count,xi,yi;
314314   UINT8 *gfx_data;
315315   UINT8 y_step;
r14976r14977
335335         int inv_col = (attr & 0x40) >> 6;
336336
337337         if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms
338            gfx_data = machine.region("pcg")->base();
338            gfx_data = machine.root_device().memregion("pcg")->base();
339339         else if(gfx_sel == 0x80)
340340         {
341            gfx_data = machine.region("kanji")->base();
341            gfx_data = state->memregion("kanji")->base();
342342            tile|= tile_bank << 8;
343343            if(y_step == 2)
344344               tile &= 0x3ffe;
345345         }
346346         else if(gfx_sel == 0xc0)
347347         {
348            gfx_data = machine.region("kanji")->base();
348            gfx_data = machine.root_device().memregion("kanji")->base();
349349            tile|= (tile_bank << 8);
350350            if(y_step == 2)
351351               tile &= 0x3ffe;
r14976r14977
353353         }
354354         else
355355         {
356            gfx_data = machine.region("pcg")->base();
356            gfx_data = machine.root_device().memregion("pcg")->base();
357357         }
358358
359359         for(yi=0;yi<8*y_step;yi++)
r14976r14977
399399
400400static void draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
401401{
402   //mz2500_state *state = machine.driver_data<mz2500_state>();
402   mz2500_state *state = machine.driver_data<mz2500_state>();
403403   UINT32 count;
404   UINT8 *vram = machine.region("maincpu")->base();
404   UINT8 *vram = state->memregion("maincpu")->base();
405405   UINT8 pen,pen_bit[2];
406406   int x,y,xi,pen_i;
407407   int res_x,res_y;
r14976r14977
443443{
444444   mz2500_state *state = machine.driver_data<mz2500_state>();
445445   UINT32 count;
446   UINT8 *vram = machine.region("maincpu")->base();
446   UINT8 *vram = state->memregion("maincpu")->base();
447447   UINT8 pen,pen_bit[4];
448448   int x,y,xi,pen_i;
449449   UINT32 wa_reg;
r14976r14977
501501{
502502   mz2500_state *state = machine.driver_data<mz2500_state>();
503503   UINT32 count;
504   UINT8 *vram = machine.region("maincpu")->base();
504   UINT8 *vram = state->memregion("maincpu")->base();
505505   UINT8 pen,pen_bit[8];
506506   int x,y,xi,pen_i;
507507   UINT32 wa_reg;
r14976r14977
733733
734734UINT8 mz2500_state::mz2500_ram_read(UINT16 offset, UINT8 bank_num)
735735{
736   UINT8 *ram = machine().region("maincpu")->base();
736   UINT8 *ram = memregion("maincpu")->base();
737737   UINT8 cur_bank = m_bank_val[bank_num];
738738
739739   switch(cur_bank)
r14976r14977
768768      {
769769         if(m_kanji_bank & 0x80) //kanji ROM
770770         {
771            UINT8 *knj_rom = machine().region("kanji")->base();
771            UINT8 *knj_rom = memregion("kanji")->base();
772772
773773            return knj_rom[(offset & 0x7ff)+((m_kanji_bank & 0x7f)*0x800)];
774774         }
775775         else //PCG RAM
776776         {
777            UINT8 *pcg_ram = machine().region("pcg")->base();
777            UINT8 *pcg_ram = memregion("pcg")->base();
778778
779779            return pcg_ram[offset];
780780         }
r14976r14977
782782      break;
783783      case 0x3a:
784784      {
785         UINT8 *dic_rom = machine().region("dictionary")->base();
785         UINT8 *dic_rom = memregion("dictionary")->base();
786786
787787         return dic_rom[(offset & 0x1fff) + ((m_dic_bank & 0x1f)*0x2000)];
788788      }
r14976r14977
792792      case 0x3e:
793793      case 0x3f:
794794      {
795         UINT8 *phone_rom = machine().region("phone")->base();
795         UINT8 *phone_rom = memregion("phone")->base();
796796
797797         return phone_rom[offset+(cur_bank & 3)*0x2000];
798798      }
r14976r14977
805805
806806void mz2500_state::mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num)
807807{
808   UINT8 *ram = machine().region("maincpu")->base();
808   UINT8 *ram = memregion("maincpu")->base();
809809   UINT8 cur_bank = m_bank_val[bank_num];
810810
811811//  if(cur_bank >= 0x30 && cur_bank <= 0x33)
r14976r14977
898898         }
899899         else //PCG RAM
900900         {
901            UINT8 *pcg_ram = machine().region("pcg")->base();
901            UINT8 *pcg_ram = memregion("pcg")->base();
902902            pcg_ram[offset] = data;
903903            if((offset & 0x1800) == 0x0000)
904904               gfx_element_mark_dirty(machine().gfx[3], (offset) >> 3);
r14976r14977
967967
968968WRITE8_MEMBER(mz2500_state::mz2500_bank_data_w)
969969{
970//  UINT8 *ROM = machine().region("maincpu")->base();
970//  UINT8 *ROM = memregion("maincpu")->base();
971971//  static const char *const bank_name[] = { "bank0", "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7" };
972972
973973   m_bank_val[m_bank_addr] = data & 0x3f;
r14976r14977
975975//  if((data*2) >= 0x70)
976976//  printf("%s %02x\n",bank_name[m_bank_addr],m_bank_val[m_bank_addr]*2);
977977
978//  memory_set_bankptr(machine(), bank_name[m_bank_addr], &ROM[m_bank_val[m_bank_addr]*0x2000]);
978//  membank(bank_name[m_bank_addr])->set_base(&ROM[m_bank_val[m_bank_addr]*0x2000]);
979979
980980   m_bank_addr++;
981981   m_bank_addr&=7;
r14976r14977
12071207
12081208READ8_MEMBER(mz2500_state::mz2500_rom_r)
12091209{
1210   UINT8 *rom = machine().region("rom")->base();
1210   UINT8 *rom = memregion("rom")->base();
12111211   UINT8 res;
12121212
12131213   m_lrom_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
r14976r14977
13401340   if((m_cg_reg_index & 0x1f) == 0x05 && (m_cg_reg[0x05] & 0xc0) == 0x80) //clear bitmap buffer
13411341   {
13421342      UINT32 i;
1343      UINT8 *vram = machine().region("maincpu")->base();
1343      UINT8 *vram = memregion("maincpu")->base();
13441344      UINT32 layer_bank;
13451345
13461346      layer_bank = (m_cg_reg[0x0e] & 0x80) ? 0x10000 : 0x00000;
r14976r14977
14261426
14271427READ8_MEMBER(mz2500_state::mz2500_kanji_r)
14281428{
1429   UINT8 *knj2_rom = machine().region("kanji2")->base();
1429   UINT8 *knj2_rom = memregion("kanji2")->base();
14301430
14311431   printf("Read from kanji 2 ROM\n");
14321432
r14976r14977
14551455
14561456READ8_MEMBER(mz2500_state::mz2500_emm_data_r)
14571457{
1458   UINT8 *emm_ram = machine().region("emm")->base();
1458   UINT8 *emm_ram = memregion("emm")->base();
14591459   UINT8 emm_lo_index;
14601460
14611461   emm_lo_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
r14976r14977
14791479
14801480WRITE8_MEMBER(mz2500_state::mz2500_emm_data_w)
14811481{
1482   UINT8 *emm_ram = machine().region("emm")->base();
1482   UINT8 *emm_ram = memregion("emm")->base();
14831483   UINT8 emm_lo_index;
14841484
14851485   emm_lo_index = (cpu_get_reg(machine().device("maincpu"), Z80_B));
r14976r14977
17181718static MACHINE_RESET(mz2500)
17191719{
17201720   mz2500_state *state = machine.driver_data<mz2500_state>();
1721   UINT8 *RAM = machine.region("maincpu")->base();
1722   UINT8 *IPL = machine.region("ipl")->base();
1721   UINT8 *RAM = machine.root_device().memregion("maincpu")->base();
1722   UINT8 *IPL = state->memregion("ipl")->base();
17231723   UINT32 i;
17241724
17251725   mz2500_reset(state, IPL_RESET);
src/mess/drivers/gmaster.c
r14976r14977
1717    UINT8 data = 0;
1818    if (m_gmachine.ports[2] & 1)
1919   {
20      data = machine().region("maincpu")->base()[0x4000 + offset];
20      data = memregion("maincpu")->base()[0x4000 + offset];
2121      logerror("%.4x external memory %.4x read %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data);
2222    }
2323   else
r14976r14977
4444{
4545    if (m_gmachine.ports[2] & 1)
4646   {
47      machine().region("maincpu")->base()[0x4000 + offset] = data;
47      memregion("maincpu")->base()[0x4000 + offset] = data;
4848      logerror("%.4x external memory %.4x written %.2x\n", (int)cpu_get_reg(&space.device(), CPUINFO_INT_PC), 0x4000 + offset, data);
4949   }
5050   else
src/mess/drivers/newbrain.c
r14976r14977
8686      case 0:
8787         /* ROM */
8888         memory_install_rom_helper(program, bank_name, bank_start, bank_end);
89         memory_configure_bank(machine(), bank_name, 0, 1, machine().region("eim")->base() + eim_bank_start, 0);
89         membank(bank_name)->configure_entry(0, memregion("eim")->base() + eim_bank_start);
9090         break;
9191
9292      case 2:
9393         /* RAM */
9494         memory_install_ram_helper(program, bank_name, bank_start, bank_end);
95         memory_configure_bank(machine(), bank_name, 0, 1, m_eim_ram + eim_bank_start, 0);
95         membank(bank_name)->configure_entry(0, m_eim_ram + eim_bank_start);
9696         break;
9797
9898      default:
r14976r14977
118118      {
119119         /* all banks point to ROM at 0xe000 */
120120         memory_install_rom_helper(program, bank_name, bank_start, bank_end);
121         memory_configure_bank(machine(), bank_name, 0, 1, machine().region(Z80_TAG)->base() + 0xe000, 0);
121         membank(bank_name)->configure_entry(0, memregion(Z80_TAG)->base() + 0xe000);
122122      }
123123      else
124124      {
125         memory_configure_bank(machine(), bank_name, 0, 1, machine().region(Z80_TAG)->base() + bank_start, 0);
125         membank(bank_name)->configure_entry(0, memregion(Z80_TAG)->base() + bank_start);
126126
127127         if (bank < 5)
128128         {
r14976r14977
132132         else if (bank == 5)
133133         {
134134            /* 0x8000-0x9fff */
135            if (machine().region("eim")->base())
135            if (machine().root_device().memregion("eim")->base())
136136            {
137137               /* expansion interface ROM */
138138               memory_install_rom_helper(program, bank_name, bank_start, bank_end);
139               memory_configure_bank(machine(), bank_name, 0, 1, machine().region("eim")->base() + 0x4000, 0);
139               membank(bank_name)->configure_entry(0, memregion("eim")->base() + 0x4000);
140140            }
141141            else
142142            {
143143               /* mirror of 0xa000-0xbfff */
144               if (machine().region(Z80_TAG)->base()[0xa001] == 0)
144               if (machine().root_device().memregion(Z80_TAG)->base()[0xa001] == 0)
145145               {
146146                  /* unmapped on the M model */
147147                  memory_install_unmapped(program, bank_name, bank_start, bank_end);
r14976r14977
152152                  memory_install_rom_helper(program, bank_name, bank_start, bank_end);
153153               }
154154
155               memory_configure_bank(machine(), bank_name, 0, 1, machine().region(Z80_TAG)->base() + 0xa000, 0);
155               membank(bank_name)->configure_entry(0, memregion(Z80_TAG)->base() + 0xa000);
156156            }
157157         }
158158         else if (bank == 6)
159159         {
160160            /* 0xa000-0xbfff */
161            if (machine().region(Z80_TAG)->base()[0xa001] == 0)
161            if (machine().root_device().memregion(Z80_TAG)->base()[0xa001] == 0)
162162            {
163163               /* unmapped on the M model */
164164               memory_install_unmapped(program, bank_name, bank_start, bank_end);
r14976r14977
176176         }
177177      }
178178
179      memory_set_bank(machine(), bank_name, 0);
179      membank(bank_name)->set_entry(0);
180180   }
181181}
182182
src/mess/drivers/qtsbc.c
r14976r14977
6666
6767MACHINE_RESET_MEMBER(qtsbc_state)
6868{
69   UINT8* bios = machine().region("maincpu")->base()+0x10000;
69   UINT8* bios = memregion("maincpu")->base()+0x10000;
7070   memcpy(m_p_ram, bios, 0x800);
7171}
7272
src/mess/drivers/sapi1.c
r14976r14977
2727/* switch out the rom shadow */
2828WRITE8_MEMBER( sapi1_state::sapi3_00_w )
2929{
30   memory_set_bank(machine(), "bank1", 0);
30   membank("bank1")->set_entry(0);
3131}
3232
3333READ8_MEMBER( sapi1_state::sapi2_keyboard_status_r)
src/mess/drivers/einstein.c
r14976r14977
112112{
113113   einstein_state *einstein = device->machine().driver_data<einstein_state>();
114114   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
115   UINT8 *data = device->machine().region("gfx1")->base();
115   UINT8 *data = device->machine().root_device().memregion("gfx1")->base();
116116   UINT8 char_code, data_byte;
117117   int i, x;
118118
r14976r14977
306306
307307static void einstein_page_rom(running_machine &machine)
308308{
309   einstein_state *einstein = machine.driver_data<einstein_state>();
310   memory_set_bankptr(machine, "bank1", einstein->m_rom_enabled ? machine.region("bios")->base() : machine.device<ram_device>(RAM_TAG)->pointer());
309   einstein_state *state = machine.driver_data<einstein_state>();
310   state->membank("bank1")->set_base(state->m_rom_enabled ? machine.root_device().memregion("bios")->base() : machine.device<ram_device>(RAM_TAG)->pointer());
311311}
312312
313313/* writing to this port is a simple trigger, and switches between RAM and ROM */
r14976r14977
421421
422422static MACHINE_RESET( einstein )
423423{
424   einstein_state *einstein = machine.driver_data<einstein_state>();
424   einstein_state *state = machine.driver_data<einstein_state>();
425425   //device_t *floppy;
426426   //UINT8 config = input_port_read(machine, "config");
427427
428428   /* save pointers to our devices */
429   einstein->m_color_screen = machine.device("screen");
430   einstein->m_ctc = machine.device(IC_I058);
429   state->m_color_screen = machine.device("screen");
430   state->m_ctc = machine.device(IC_I058);
431431
432432   /* initialize memory mapping */
433   memory_set_bankptr(machine, "bank2", machine.device<ram_device>(RAM_TAG)->pointer());
434   memory_set_bankptr(machine, "bank3", machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
435   einstein->m_rom_enabled = 1;
433   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
434   state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
435   state->m_rom_enabled = 1;
436436   einstein_page_rom(machine);
437437
438438   /* a reset causes the fire int, adc int, keyboard int mask
439439    to be set to 1, which causes all these to be DISABLED */
440   einstein->m_interrupt = 0;
441   einstein->m_interrupt_mask = 0;
440   state->m_interrupt = 0;
441   state->m_interrupt_mask = 0;
442442
443   einstein->m_ctc_trigger = 0;
443   state->m_ctc_trigger = 0;
444444
445445   /* configure floppy drives */
446446/*  floppy_type_t type_80 = FLOPPY_STANDARD_5_25_DSHD;
src/mess/drivers/ti99_2.c
r14976r14977
115115   state->m_ROM_paged = 1;
116116}
117117
118#define TI99_2_32_ROMPAGE0 (machine().region("maincpu")->base()+0x4000)
119#define TI99_2_32_ROMPAGE1 (machine().region("maincpu")->base()+0x10000)
118#define TI99_2_32_ROMPAGE0 (machine().root_device().memregion("maincpu")->base()+0x4000)
119#define TI99_2_32_ROMPAGE1 (machine().root_device().memregion("maincpu")->base()+0x10000)
120120
121121static MACHINE_RESET( ti99_2 )
122122{
123123   ti99_2_state *state = machine.driver_data<ti99_2_state>();
124124   state->m_irq_state = ASSERT_LINE;
125125   if (! state->m_ROM_paged)
126      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base()+0x4000);
126      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base()+0x4000);
127127   else
128      memory_set_bankptr(machine, "bank1", (machine.region("maincpu")->base()+0x4000));
128      state->membank("bank1")->set_base((state->memregion("maincpu")->base()+0x4000));
129129}
130130
131131static INTERRUPT_GEN( ti99_2_vblank_interrupt )
r14976r14977
237237   /* now, we handle ROM paging */
238238   if (m_ROM_paged)
239239   {   /* if we have paged ROMs, page according to S0 keyboard interface line */
240      memory_set_bankptr(machine(), "bank1", (m_KeyRow == 0) ? TI99_2_32_ROMPAGE1 : TI99_2_32_ROMPAGE0);
240      membank("bank1")->set_base((m_KeyRow == 0) ? TI99_2_32_ROMPAGE1 : TI99_2_32_ROMPAGE0);
241241   }
242242}
243243
src/mess/drivers/fk1.c
r14976r14977
299299   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
300300
301301   space_mem->install_write_bank(0x0000, 0x3fff, "bank1");
302   memory_set_bankptr(machine(), "bank1", ram);
303   memory_set_bankptr(machine(), "bank2", ram + 0x4000);
302   membank("bank1")->set_base(ram);
303   membank("bank2")->set_base(ram + 0x4000);
304304   return 0;
305305}
306306
r14976r14977
308308{
309309   address_space *space_mem = m_maincpu->memory().space(AS_PROGRAM);
310310   space_mem->unmap_write(0x0000, 0x3fff);
311   memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base());
312   memory_set_bankptr(machine(), "bank2", machine().device<ram_device>(RAM_TAG)->pointer() + 0x10000);
311   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
312   membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x10000);
313313   return 0;
314314}
315315
r14976r14977
429429   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
430430
431431   space->unmap_write(0x0000, 0x3fff);
432   memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base()); // ROM
433   memory_set_bankptr(machine(), "bank2", ram + 0x10000); // VRAM
434   memory_set_bankptr(machine(), "bank3", ram + 0x8000);
435   memory_set_bankptr(machine(), "bank4", ram + 0xc000);
432   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()); // ROM
433   membank("bank2")->set_base(ram + 0x10000); // VRAM
434   membank("bank3")->set_base(ram + 0x8000);
435   membank("bank4")->set_base(ram + 0xc000);
436436
437437   device_set_irq_callback(machine().device("maincpu"), fk1_irq_callback);
438438}
src/mess/drivers/ccs2422.c
r14976r14977
7272
7373MACHINE_RESET_MEMBER(ccs2422_state)
7474{
75   UINT8* user1 = machine().region("user1")->base();
75   UINT8* user1 = memregion("user1")->base();
7676   memcpy((UINT8*)m_ccs_ram, user1, 0x0800);
7777
7878   // this should be rom/ram banking
src/mess/drivers/multi8.c
r14976r14977
9494
9595   state->m_vram_bank = 8;
9696   state->m_bw_mode = 0;
97   state->m_p_chargen = machine.region("chargen")->base();
97   state->m_p_chargen = state->memregion("chargen")->base();
9898}
9999
100100static void multi8_draw_pixel(running_machine &machine, bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width)
r14976r14977
644644static MACHINE_START(multi8)
645645{
646646   multi8_state *state = machine.driver_data<multi8_state>();
647   state->m_p_vram = machine.region("vram")->base();
648   state->m_p_wram = machine.region("wram")->base();
649   state->m_p_kanji = machine.region("kanji")->base();
647   state->m_p_vram = machine.root_device().memregion("vram")->base();
648   state->m_p_wram = machine.root_device().memregion("wram")->base();
649   state->m_p_kanji = state->memregion("kanji")->base();
650650}
651651
652652static MACHINE_RESET(multi8)
src/mess/drivers/mes.c
r14976r14977
5353
5454VIDEO_START_MEMBER( mes_state )
5555{
56   m_p_chargen = machine().region("chargen")->base();
56   m_p_chargen = memregion("chargen")->base();
5757}
5858
5959/* This system appears to have 2 screens. Not implemented.
src/mess/drivers/bullet.c
r14976r14977
104104
105105   if (!m_brom && !BIT(offset, 5))
106106   {
107      data = machine().region(Z80_TAG)->base()[offset & 0x1f];
107      data = memregion(Z80_TAG)->base()[offset & 0x1f];
108108   }
109109   else
110110   {
r14976r14977
329329
330330   if (!m_rome && !BIT(offset, 5))
331331   {
332      data = machine().region(Z80_TAG)->base()[offset & 0x1f];
332      data = memregion(Z80_TAG)->base()[offset & 0x1f];
333333   }
334334   else
335335   {
src/mess/drivers/vtech1.c
r14976r14977
595595
596596   if (data >= 1)
597597      if ((data <= 3 && m_ram_size == 66*1024) || (m_ram_size == 4098*1024))
598         memory_set_bank(machine(), "bank3", data - 1);
598         membank("bank3")->set_entry(data - 1);
599599}
600600
601601WRITE8_MEMBER(vtech1_state::vtech1_video_bank_w)
602602{
603603   logerror("vtech1_video_bank_w $%02X\n", data);
604   memory_set_bank(machine(), "bank4", data & 0x03);
604   membank("bank4")->set_entry(data & 0x03);
605605}
606606
607607
r14976r14977
626626
627627static DRIVER_INIT( vtech1 )
628628{
629   vtech1_state *vtech1 = machine.driver_data<vtech1_state>();
629   vtech1_state *state = machine.driver_data<vtech1_state>();
630630   address_space *prg = machine.device("maincpu")->memory().space(AS_PROGRAM);
631631   int id;
632632
633633   /* ram */
634   vtech1->m_ram = machine.device<ram_device>(RAM_TAG)->pointer();
635   vtech1->m_ram_size = machine.device<ram_device>(RAM_TAG)->size();
634   state->m_ram = machine.device<ram_device>(RAM_TAG)->pointer();
635   state->m_ram_size = machine.device<ram_device>(RAM_TAG)->size();
636636
637637   /* setup memory banking */
638   memory_set_bankptr(machine, "bank1", vtech1->m_ram);
638   state->membank("bank1")->set_base(state->m_ram);
639639
640640   /* 16k memory expansion? */
641   if (vtech1->m_ram_size == 18*1024 || vtech1->m_ram_size == 22*1024 || vtech1->m_ram_size == 32*1024)
641   if (state->m_ram_size == 18*1024 || state->m_ram_size == 22*1024 || state->m_ram_size == 32*1024)
642642   {
643      offs_t base = 0x7800 + (vtech1->m_ram_size - 0x4000);
643      offs_t base = 0x7800 + (state->m_ram_size - 0x4000);
644644      prg->install_readwrite_bank(base, base + 0x3fff, "bank2");
645      memory_set_bankptr(machine, "bank2", vtech1->m_ram + base - 0x7800);
645      state->membank("bank2")->set_base(state->m_ram + base - 0x7800);
646646   }
647647
648648   /* 64k expansion? */
649   if (vtech1->m_ram_size >= 66*1024)
649   if (state->m_ram_size >= 66*1024)
650650   {
651651      /* install fixed first bank */
652652      prg->install_readwrite_bank(0x8000, 0xbfff, "bank2");
653      memory_set_bankptr(machine, "bank2", vtech1->m_ram + 0x800);
653      state->membank("bank2")->set_base(state->m_ram + 0x800);
654654
655655      /* install the others, dynamically banked in */
656656      prg->install_readwrite_bank(0xc000, 0xffff, "bank3");
657      memory_configure_bank(machine, "bank3", 0, (vtech1->m_ram_size - 0x4800) / 0x4000, vtech1->m_ram + 0x4800, 0x4000);
658      memory_set_bank(machine, "bank3", 0);
657      state->membank("bank3")->configure_entries(0, (state->m_ram_size - 0x4800) / 0x4000, state->m_ram + 0x4800, 0x4000);
658      state->membank("bank3")->set_entry(0);
659659   }
660660
661661   /* initialize floppy */
662   vtech1->m_drive = -1;
663   vtech1->m_fdc_track_x2[0] = 80;
664   vtech1->m_fdc_track_x2[1] = 80;
665   vtech1->m_fdc_wrprot[0] = 0x80;
666   vtech1->m_fdc_wrprot[1] = 0x80;
667   vtech1->m_fdc_status = 0;
668   vtech1->m_fdc_edge = 0;
669   vtech1->m_fdc_bits = 8;
670   vtech1->m_fdc_start = 0;
671   vtech1->m_fdc_write = 0;
672   vtech1->m_fdc_offs = 0;
673   vtech1->m_fdc_latch = 0;
662   state->m_drive = -1;
663   state->m_fdc_track_x2[0] = 80;
664   state->m_fdc_track_x2[1] = 80;
665   state->m_fdc_wrprot[0] = 0x80;
666   state->m_fdc_wrprot[1] = 0x80;
667   state->m_fdc_status = 0;
668   state->m_fdc_edge = 0;
669   state->m_fdc_bits = 8;
670   state->m_fdc_start = 0;
671   state->m_fdc_write = 0;
672   state->m_fdc_offs = 0;
673   state->m_fdc_latch = 0;
674674
675675   for(id=0;id<2;id++)
676676   {
r14976r14977
680680
681681static DRIVER_INIT( vtech1h )
682682{
683   vtech1_state *vtech1 = machine.driver_data<vtech1_state>();
683   vtech1_state *state = machine.driver_data<vtech1_state>();
684684   address_space *prg = machine.device("maincpu")->memory().space(AS_PROGRAM);
685685
686686   DRIVER_INIT_CALL(vtech1);
687687
688688   /* the SHRG mod replaces the standard videoram chip with an 8k chip */
689   //vtech1->m_videoram_size = 0x2000;
690   //vtech1->m_videoram = auto_alloc_array(machine, UINT8, vtech1->m_videoram_size);
689   //state->m_videoram_size = 0x2000;
690   //state->m_videoram = auto_alloc_array(machine, UINT8, state->m_videoram_size);
691691
692692   prg->install_readwrite_bank(0x7000, 0x77ff, "bank4");
693   memory_configure_bank(machine, "bank4", 0, 4, vtech1->m_videoram, 0x800);
694   memory_set_bank(machine, "bank4", 0);
693   state->membank("bank4")->configure_entries(0, 4, state->m_videoram, 0x800);
694   state->membank("bank4")->set_entry(0);
695695}
696696
697697/***************************************************************************
src/mess/drivers/pda600.c
r14976r14977
109109
110110void pda600_state::video_start()
111111{
112   m_video_ram = machine().region("videoram")->base();
112   m_video_ram = memregion("videoram")->base();
113113}
114114
115115UINT32 pda600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
src/mess/drivers/camplynx.c
r14976r14977
112112WRITE8_MEMBER( camplynx_state::lynx48k_bank_w )
113113{
114114   if (!data)
115      memory_set_bank(machine(), "bank1", 0);
115      membank("bank1")->set_entry(0);
116116   else
117117   if (data & 2)
118      memory_set_bank(machine(), "bank1", 1);
118      membank("bank1")->set_entry(1);
119119   else
120120   if (data & 4)
121      memory_set_bank(machine(), "bank1", 2);
121      membank("bank1")->set_entry(2);
122122   else
123123      logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data);
124124}
r14976r14977
127127{
128128   /* get address space */
129129   address_space *mem = m_maincpu->memory().space(AS_PROGRAM);
130   UINT8 *base = mem->machine().region("maincpu")->base();
130   UINT8 *base = mem->machine().root_device().memregion("maincpu")->base();
131131
132132   /* Set read banks */
133133   UINT8 bank = data & 0x0f;
134134
135135   if (!bank)
136136   {
137      memory_set_bankptr(mem->machine(), "bank1", base + 0x00000);
138      memory_set_bankptr(mem->machine(), "bank2", base + 0x02000);
139      memory_set_bankptr(mem->machine(), "bank3", base + 0x04000);
140      memory_set_bankptr(mem->machine(), "bank4", base + 0x16000);
141      memory_set_bankptr(mem->machine(), "bank5", base + 0x18000);
142      memory_set_bankptr(mem->machine(), "bank6", base + 0x1a000);
143      memory_set_bankptr(mem->machine(), "bank7", base + 0x0c000);
144      memory_set_bankptr(mem->machine(), "bank8", base + 0x0e000);
137      membank("bank1")->set_base(base + 0x00000);
138      membank("bank2")->set_base(base + 0x02000);
139      membank("bank3")->set_base(base + 0x04000);
140      membank("bank4")->set_base(base + 0x16000);
141      membank("bank5")->set_base(base + 0x18000);
142      membank("bank6")->set_base(base + 0x1a000);
143      membank("bank7")->set_base(base + 0x0c000);
144      membank("bank8")->set_base(base + 0x0e000);
145145   }
146146   else
147147   if (bank == 0x0e)
148148   {
149      memory_set_bankptr(mem->machine(), "bank1", base + 0x20000);
150      memory_set_bankptr(mem->machine(), "bank2", base + 0x22000);
151      memory_set_bankptr(mem->machine(), "bank3", base + 0x24000);
152      memory_set_bankptr(mem->machine(), "bank4", base + 0x26000);
153      memory_set_bankptr(mem->machine(), "bank5", base + 0x28000);
154      memory_set_bankptr(mem->machine(), "bank6", base + 0x2a000);
155      memory_set_bankptr(mem->machine(), "bank7", base + 0x2c000);
156      memory_set_bankptr(mem->machine(), "bank8", base + 0x2e000);
149      membank("bank1")->set_base(base + 0x20000);
150      membank("bank2")->set_base(base + 0x22000);
151      membank("bank3")->set_base(base + 0x24000);
152      membank("bank4")->set_base(base + 0x26000);
153      membank("bank5")->set_base(base + 0x28000);
154      membank("bank6")->set_base(base + 0x2a000);
155      membank("bank7")->set_base(base + 0x2c000);
156      membank("bank8")->set_base(base + 0x2e000);
157157   }
158158   else
159159      logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data);
r14976r14977
163163
164164   if (!bank)
165165   {
166      memory_set_bankptr(mem->machine(), "bank11", base + 0x10000);
167      memory_set_bankptr(mem->machine(), "bank12", base + 0x12000);
168      memory_set_bankptr(mem->machine(), "bank13", base + 0x14000);
169      memory_set_bankptr(mem->machine(), "bank14", base + 0x16000);
170      memory_set_bankptr(mem->machine(), "bank15", base + 0x18000);
171      memory_set_bankptr(mem->machine(), "bank16", base + 0x1a000);
172      memory_set_bankptr(mem->machine(), "bank17", base + 0x1c000);
173      memory_set_bankptr(mem->machine(), "bank18", base + 0x1e000);
166      membank("bank11")->set_base(base + 0x10000);
167      membank("bank12")->set_base(base + 0x12000);
168      membank("bank13")->set_base(base + 0x14000);
169      membank("bank14")->set_base(base + 0x16000);
170      membank("bank15")->set_base(base + 0x18000);
171      membank("bank16")->set_base(base + 0x1a000);
172      membank("bank17")->set_base(base + 0x1c000);
173      membank("bank18")->set_base(base + 0x1e000);
174174   }
175175   else
176176   if (bank == 0xc0)
177177   {
178      memory_set_bankptr(mem->machine(), "bank11", base + 0x20000);
179      memory_set_bankptr(mem->machine(), "bank12", base + 0x22000);
180      memory_set_bankptr(mem->machine(), "bank13", base + 0x24000);
181      memory_set_bankptr(mem->machine(), "bank14", base + 0x26000);
182      memory_set_bankptr(mem->machine(), "bank15", base + 0x28000);
183      memory_set_bankptr(mem->machine(), "bank16", base + 0x2a000);
184      memory_set_bankptr(mem->machine(), "bank17", base + 0x2c000);
185      memory_set_bankptr(mem->machine(), "bank18", base + 0x2e000);
178      membank("bank11")->set_base(base + 0x20000);
179      membank("bank12")->set_base(base + 0x22000);
180      membank("bank13")->set_base(base + 0x24000);
181      membank("bank14")->set_base(base + 0x26000);
182      membank("bank15")->set_base(base + 0x28000);
183      membank("bank16")->set_base(base + 0x2a000);
184      membank("bank17")->set_base(base + 0x2c000);
185      membank("bank18")->set_base(base + 0x2e000);
186186   }
187187   else
188188      logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data);
r14976r14977
379379
380380static MC6845_UPDATE_ROW( lynx48k_update_row )
381381{
382   UINT8 *RAM = device->machine().region("maincpu")->base();
382   UINT8 *RAM = device->machine().root_device().memregion("maincpu")->base();
383383   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
384384   UINT8 r,g,b;
385385   UINT32 x, *p = &bitmap.pix32(y);
r14976r14977
403403
404404static MC6845_UPDATE_ROW( lynx128k_update_row )
405405{
406   UINT8 *RAM = device->machine().region("maincpu")->base();
406   UINT8 *RAM = device->machine().root_device().memregion("maincpu")->base();
407407   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
408408   UINT8 r,g,b;
409409   UINT32 x, *p = &bitmap.pix32(y);
r14976r14977
514514
515515static DRIVER_INIT( lynx48k )
516516{
517   UINT8 *RAM = machine.region("maincpu")->base();
518   memory_configure_bank(machine, "bank1", 0, 3, &RAM[0x8000],  0x8000);
517   camplynx_state *state = machine.driver_data<camplynx_state>();
518   UINT8 *RAM = state->memregion("maincpu")->base();
519   state->membank("bank1")->configure_entries(0, 3, &RAM[0x8000],  0x8000);
519520}
520521
521522
src/mess/drivers/ng_aes.c
r14976r14977
557557static void _set_main_cpu_vector_table_source( running_machine &machine )
558558{
559559   neogeo_state *state = machine.driver_data<neogeo_state>();
560   memory_set_bank(machine, NEOGEO_BANK_VECTORS, state->m_main_cpu_vector_table_source);
560   state->membank(NEOGEO_BANK_VECTORS)->set_entry(state->m_main_cpu_vector_table_source);
561561}
562562
563563
r14976r14977
573573static void _set_main_cpu_bank_address( running_machine &machine )
574574{
575575   neogeo_state *state = machine.driver_data<neogeo_state>();
576   memory_set_bankptr(machine, NEOGEO_BANK_CARTRIDGE, &machine.region("maincpu")->base()[state->m_main_cpu_bank_address]);
576   state->membank(NEOGEO_BANK_CARTRIDGE)->set_base(&state->memregion("maincpu")->base()[state->m_main_cpu_bank_address]);
577577}
578578
579579
r14976r14977
581581WRITE16_MEMBER(ng_aes_state::main_cpu_bank_select_w)
582582{
583583   UINT32 bank_address;
584   UINT32 len = machine().region("maincpu")->bytes();
584   UINT32 len = memregion("maincpu")->bytes();
585585
586586   if ((len <= 0x100000) && (data & 0x07))
587587      logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", cpu_get_pc(&space.device()), data);
r14976r14977
602602
603603static void main_cpu_banking_init( running_machine &machine )
604604{
605   ng_aes_state *state = machine.driver_data<ng_aes_state>();
605606   address_space *mainspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
606607
607608   /* create vector banks */
608   memory_configure_bank(machine, NEOGEO_BANK_VECTORS, 0, 1, machine.region("mainbios")->base(), 0);
609   memory_configure_bank(machine, NEOGEO_BANK_VECTORS, 1, 1, machine.region("maincpu")->base(), 0);
609   state->membank(NEOGEO_BANK_VECTORS)->configure_entry(0, machine.root_device().memregion("mainbios")->base());
610   state->membank(NEOGEO_BANK_VECTORS)->configure_entry(1, machine.root_device().memregion("maincpu")->base());
610611
611612   /* set initial main CPU bank */
612   if (machine.region("maincpu")->bytes() > 0x100000)
613   if (machine.root_device().memregion("maincpu")->bytes() > 0x100000)
613614      neogeo_set_main_cpu_bank_address(mainspace, 0x100000);
614615   else
615616      neogeo_set_main_cpu_bank_address(mainspace, 0x000000);
r14976r14977
629630   int region;
630631
631632   for (region = 0; region < 4; region++)
632      memory_set_bank(machine, NEOGEO_BANK_AUDIO_CPU_CART_BANK + region, state->m_audio_cpu_banks[region]);
633      state->membank(NEOGEO_BANK_AUDIO_CPU_CART_BANK + region)->set_entry(state->m_audio_cpu_banks[region]);
633634}
634635
635636
r14976r14977
681682{
682683   neogeo_state *state = space->machine().driver_data<neogeo_state>();
683684
684/*  if (!machine.region("audiobios")->base())   */
685/*  if (!state->memregion("audiobios")->base())   */
685686      state->m_audio_cpu_rom_source = 1;
686687
687   memory_set_bank(space->machine(), NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, state->m_audio_cpu_rom_source);
688   state->membank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK)->set_entry(state->m_audio_cpu_rom_source);
688689
689690   /* reset CPU if the source changed -- this is a guess */
690691   if (state->m_audio_cpu_rom_source != state->m_audio_cpu_rom_source_last)
r14976r14977
716717   UINT32 address_mask;
717718
718719   /* audio bios/cartridge selection */
719   if (machine.region("audiobios")->base())
720      memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 0, 1, machine.region("audiobios")->base(), 0);
721   memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 1, 1, machine.region("audiocpu")->base(), 0);
720   if (machine.root_device().memregion("audiobios")->base())
721      state->membank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK)->configure_entry(0, machine.root_device().memregion("audiobios")->base());
722   state->membank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK)->configure_entry(1, machine.root_device().memregion("audiocpu")->base());
722723
723724   /* audio banking */
724   address_mask = machine.region("audiocpu")->bytes() - 0x10000 - 1;
725   address_mask = machine.root_device().memregion("audiocpu")->bytes() - 0x10000 - 1;
725726
726   rgn = machine.region("audiocpu")->base();
727   rgn = state->memregion("audiocpu")->base();
727728   for (region = 0; region < 4; region++)
728729   {
729730      for (bank = 0; bank < 0x100; bank++)
730731      {
731732         UINT32 bank_address = 0x10000 + (((bank << (11 + region)) & 0x3ffff) & address_mask);
732         memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_CART_BANK + region, bank, 1, &rgn[bank_address], 0);
733         state->membank(NEOGEO_BANK_AUDIO_CPU_CART_BANK + region)->configure_entry(bank, &rgn[bank_address]);
733734      }
734735   }
735736
r14976r14977
10011002READ16_MEMBER(ng_aes_state::neocd_transfer_r)
10021003{
10031004   UINT16 ret = 0x0000;
1004   UINT8* Z80 = machine().region("audiocpu")->base();
1005   UINT8* PCM = machine().region("ymsnd")->base();
1006   UINT8* FIX = machine().region("fixed")->base();
1007   UINT16* SPR = (UINT16*)(*machine().region("sprites"));
1005   UINT8* Z80 = memregion("audiocpu")->base();
1006   UINT8* PCM = memregion("ymsnd")->base();
1007   UINT8* FIX = memregion("fixed")->base();
1008   UINT16* SPR = (UINT16*)(*machine().root_device().memregion("sprites"));
10081009
10091010   switch(m_neocd_ctrl.area_sel)
10101011   {
r14976r14977
10271028
10281029WRITE16_MEMBER(ng_aes_state::neocd_transfer_w)
10291030{
1030   UINT8* Z80 = machine().region("audiocpu")->base();
1031   UINT8* PCM = machine().region("ymsnd")->base();
1032   UINT8* FIX = machine().region("fixed")->base();
1033   UINT16* SPR = (UINT16*)(*machine().region("sprites"));
1031   UINT8* Z80 = memregion("audiocpu")->base();
1032   UINT8* PCM = memregion("ymsnd")->base();
1033   UINT8* FIX = memregion("fixed")->base();
1034   UINT16* SPR = (UINT16*)(*machine().root_device().memregion("sprites"));
10341035
10351036   switch(m_neocd_ctrl.area_sel)
10361037   {
r14976r14977
11501151   neogeo_state *state = machine.driver_data<neogeo_state>();
11511152
11521153   /* set the BIOS bank */
1153   memory_set_bankptr(machine, NEOGEO_BANK_BIOS, machine.region("mainbios")->base());
1154   state->membank(NEOGEO_BANK_BIOS)->set_base(state->memregion("mainbios")->base());
11541155
11551156   /* set the initial main CPU bank */
11561157   main_cpu_banking_init(machine);
r14976r14977
12051206static MACHINE_START(neocd)
12061207{
12071208   ng_aes_state *state = machine.driver_data<ng_aes_state>();
1208   UINT8* ROM = machine.region("mainbios")->base();
1209   UINT8* RAM = machine.region("maincpu")->base();
1210   UINT8* Z80bios = machine.region("audiobios")->base();
1211   UINT8* FIXbios = machine.region("fixedbios")->base();
1209   UINT8* ROM = machine.root_device().memregion("mainbios")->base();
1210   UINT8* RAM = machine.root_device().memregion("maincpu")->base();
1211   UINT8* Z80bios = machine.root_device().memregion("audiobios")->base();
1212   UINT8* FIXbios = state->memregion("fixedbios")->base();
12121213   int x;
12131214
12141215   common_machine_start(machine);
src/mess/drivers/bml3.c
r14976r14977
131131static VIDEO_START( bml3 )
132132{
133133   bml3_state *state = machine.driver_data<bml3_state>();
134   state->m_p_chargen = machine.region("chargen")->base();
134   state->m_p_chargen = state->memregion("chargen")->base();
135135}
136136
137137static SCREEN_UPDATE_IND16( bml3 )
r14976r14977
140140   int x,y,count;
141141   int xi,yi;
142142   int width; //,height;
143   UINT8 *vram = screen.machine().region("vram")->base();
143   UINT8 *vram = state->memregion("vram")->base();
144144
145145   count = 0x0000;
146146
r14976r14977
274274
275275READ8_MEMBER( bml3_state::bml3_vram_r )
276276{
277   UINT8 *vram = machine().region("vram")->base();
277   UINT8 *vram = memregion("vram")->base();
278278
279279   /* TODO: this presumably also triggers an attr latch read, unsure yet */
280280   m_attr_latch = vram[offset+0x4000];
r14976r14977
284284
285285WRITE8_MEMBER( bml3_state::bml3_vram_w )
286286{
287   UINT8 *vram = machine().region("vram")->base();
287   UINT8 *vram = memregion("vram")->base();
288288
289289   vram[offset] = data;
290290   vram[offset+0x4000] = m_attr_latch;
r14976r14977
637637   address_space *mem = m_maincpu->memory().space(AS_PROGRAM);
638638
639639   /* defaults */
640   mem->install_rom(0xa000, 0xfeff,mem->machine().
641      region("maincpu")->base() + 0xa000);
642   mem->install_rom(0xfff0, 0xffff,mem->machine().
643      region("maincpu")->base() + 0xfff0);
644   mem->install_write_handler(0xa000, 0xbfff, 0, 0,
645      write8_delegate(FUNC(bml3_state::bml3_a000_w), this),
646      0);
647   mem->install_write_handler(0xc000, 0xdfff, 0, 0,
648      write8_delegate(FUNC(bml3_state::bml3_c000_w), this),
649      0);
650   mem->install_write_handler(0xe000, 0xefff, 0, 0,
651      write8_delegate(FUNC(bml3_state::bml3_e000_w), this),
652      0);
653   mem->install_write_handler(0xf000, 0xfeff, 0, 0,
654      write8_delegate(FUNC(bml3_state::bml3_f000_w), this),
655      0);
656   mem->install_write_handler(0xfff0, 0xffff, 0, 0,
657      write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),
658      0);
640   mem->install_rom(0xa000, 0xfeff,mem->machine().root_device().memregion("maincpu")->base() + 0xa000);
641   mem->install_rom(0xfff0, 0xffff,mem->machine().root_device().memregion("maincpu")->base() + 0xfff0);
642   mem->install_write_handler(0xa000, 0xbfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_a000_w), this),0);
643   mem->install_write_handler(0xc000, 0xdfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_c000_w), this),0);
644   mem->install_write_handler(0xe000, 0xefff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_e000_w), this),0);
645   mem->install_write_handler(0xf000, 0xfeff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_f000_w), this),0);
646   mem->install_write_handler(0xfff0, 0xffff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),0);
659647
660648   m_firq_mask = -1; // disable firq
661649}
r14976r14977
737725      else
738726      {
739727         mem->install_rom(0xa000, 0xbfff,
740            mem->machine().region("maincpu")->base() + 0xa000);
728            mem->machine().root_device().memregion("maincpu")->base() + 0xa000);
741729         mem->install_write_handler(0xa000, 0xbfff, 0, 0,
742730            write8_delegate(FUNC(bml3_state::bml3_a000_w), this),
743731            0);
r14976r14977
755743      else
756744      {
757745         mem->install_rom(0xc000, 0xdfff,
758            mem->machine().region("maincpu")->base() + 0xc000);
746            mem->machine().root_device().memregion("maincpu")->base() + 0xc000);
759747         mem->install_write_handler(0xc000, 0xdfff, 0, 0,
760748            write8_delegate(FUNC(bml3_state::bml3_c000_w), this),
761749            0);
r14976r14977
773761      else
774762      {
775763         mem->install_rom(0xe000, 0xefff,
776            mem->machine().region("maincpu")->base() + 0xe000);
764            mem->machine().root_device().memregion("maincpu")->base() + 0xe000);
777765         mem->install_write_handler(0xe000, 0xefff, 0, 0,
778766            write8_delegate(FUNC(bml3_state::bml3_e000_w), this),
779767            0);
r14976r14977
789777   else
790778   {
791779      mem->install_rom(0xf000, 0xfeff,
792         mem->machine().region("maincpu")->base() + 0xf000);
780         mem->machine().root_device().memregion("maincpu")->base() + 0xf000);
793781      mem->install_write_handler(0xf000, 0xfeff, 0, 0,
794782         write8_delegate(FUNC(bml3_state::bml3_f000_w), this),
795783         0);
r14976r14977
804792   else
805793   {
806794      mem->install_rom(0xfff0, 0xffff,
807         mem->machine().region("maincpu")->base() + 0xfff0);
795         mem->machine().root_device().memregion("maincpu")->base() + 0xfff0);
808796      mem->install_write_handler(0xfff0, 0xffff, 0, 0,
809797         write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),
810798         0);
src/mess/drivers/kyocera.c
r14976r14977
123123      program->unmap_write(0x0000, 0x7fff);
124124   }
125125
126   memory_set_bank(machine(), "bank1", rom_bank);
126   membank("bank1")->set_entry(rom_bank);
127127
128128   switch (ram_bank)
129129   {
r14976r14977
158158      break;
159159   }
160160
161   memory_set_bank(machine(), "bank2", ram_bank);
161   membank("bank2")->set_entry(ram_bank);
162162}
163163
164164WRITE8_MEMBER( pc8201_state::bank_w )
r14976r14977
391391
392392   if (m_rom_sel)
393393   {
394      data = machine().region("option")->base()[m_rom_addr & 0x1ffff];
394      data = memregion("option")->base()[m_rom_addr & 0x1ffff];
395395   }
396396
397397   return data;
r14976r14977
435435    */
436436
437437   /* ROM bank selection */
438   memory_set_bank(machine(), "bank1", BIT(data, 0));
438   membank("bank1")->set_entry(BIT(data, 0));
439439
440440   /* printer strobe */
441441   m_centronics->strobe_w(BIT(data, 1));
r14976r14977
470470   {
471471      program->install_read_bank(0x0000, 0x7fff, "bank1");
472472      program->unmap_write(0x0000, 0x7fff);
473      memory_set_bank(machine(), "bank1", rom_bank);
473      membank("bank1")->set_entry(rom_bank);
474474   }
475475
476476   if (m_ram->size() < ((ram_bank + 1) * 24 * 1024))
r14976r14977
481481   else
482482   {
483483      program->install_readwrite_bank(0xa000, 0xffff, "bank2");
484      memory_set_bank(machine(), "bank2", ram_bank);
484      membank("bank2")->set_entry(ram_bank);
485485   }
486486}
487487
r14976r14977
11361136   /* configure ROM banking */
11371137   program->install_read_bank(0x0000, 0x7fff, "bank1");
11381138   program->unmap_write(0x0000, 0x7fff);
1139   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(I8085_TAG)->base(), 0);
1140   memory_configure_bank(machine(), "bank1", 1, 1, machine().region("option")->base(), 0);
1141   memory_set_bank(machine(), "bank1", 0);
1139   membank("bank1")->configure_entry(0, memregion(I8085_TAG)->base());
1140   membank("bank1")->configure_entry(1, memregion("option")->base());
1141   membank("bank1")->set_entry(0);
11421142
11431143   /* configure RAM banking */
11441144   switch (m_ram->size())
r14976r14977
11531153      break;
11541154   }
11551155
1156   memory_configure_bank(machine(), "bank2", 0, 1, m_ram->pointer(), 0);
1157   memory_set_bank(machine(), "bank2", 0);
1156   membank("bank2")->configure_entry(0, m_ram->pointer());
1157   membank("bank2")->set_entry(0);
11581158
11591159   /* register for state saving */
11601160   save_item(NAME(m_bank));
r14976r14977
11721172   m_rtc->oe_w(1);
11731173
11741174   /* configure ROM banking */
1175   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(I8085_TAG)->base(), 0);
1176   memory_configure_bank(machine(), "bank1", 1, 1, machine().region("option")->base(), 0);
1177   memory_configure_bank(machine(), "bank1", 2, 2, ram + 0x8000, 0x8000);
1178   memory_set_bank(machine(), "bank1", 0);
1175   membank("bank1")->configure_entry(0, memregion(I8085_TAG)->base());
1176   membank("bank1")->configure_entry(1, memregion("option")->base());
1177   membank("bank1")->configure_entries(2, 2, ram + 0x8000, 0x8000);
1178   membank("bank1")->set_entry(0);
11791179
11801180   /* configure RAM banking */
1181   memory_configure_bank(machine(), "bank2", 0, 1, ram, 0);
1182   memory_configure_bank(machine(), "bank2", 2, 2, ram + 0x8000, 0x8000);
1183   memory_set_bank(machine(), "bank2", 0);
1181   membank("bank2")->configure_entry(0, ram);
1182   membank("bank2")->configure_entries(2, 2, ram + 0x8000, 0x8000);
1183   membank("bank2")->set_entry(0);
11841184
11851185   bankswitch(0);
11861186
r14976r14977
12031203   /* configure ROM banking */
12041204   program->install_read_bank(0x0000, 0x7fff, "bank1");
12051205   program->unmap_write(0x0000, 0x7fff);
1206   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(I8085_TAG)->base(), 0);
1207   memory_configure_bank(machine(), "bank1", 1, 1, machine().region("option")->base(), 0);
1208   memory_set_bank(machine(), "bank1", 0);
1206   membank("bank1")->configure_entry(0, memregion(I8085_TAG)->base());
1207   membank("bank1")->configure_entry(1, memregion("option")->base());
1208   membank("bank1")->set_entry(0);
12091209
12101210   /* configure RAM banking */
12111211   switch (m_ram->size())
r14976r14977
12301230      break;
12311231   }
12321232
1233   memory_configure_bank(machine(), "bank2", 0, 1, m_ram->pointer(), 0);
1234   memory_set_bank(machine(), "bank2", 0);
1233   membank("bank2")->configure_entry(0, m_ram->pointer());
1234   membank("bank2")->set_entry(0);
12351235
12361236   /* register for state saving */
12371237   save_item(NAME(m_bank));
r14976r14977
12431243void tandy200_state::machine_start()
12441244{
12451245   /* configure ROM banking */
1246   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(I8085_TAG)->base(), 0);
1247   memory_configure_bank(machine(), "bank1", 1, 1, machine().region(I8085_TAG)->base() + 0x10000, 0);
1248   memory_configure_bank(machine(), "bank1", 2, 1, machine().region("option")->base(), 0);
1249   memory_set_bank(machine(), "bank1", 0);
1246   membank("bank1")->configure_entry(0, memregion(I8085_TAG)->base());
1247   membank("bank1")->configure_entry(1, memregion(I8085_TAG)->base() + 0x10000);
1248   membank("bank1")->configure_entry(2, memregion("option")->base());
1249   membank("bank1")->set_entry(0);
12501250
12511251   /* configure RAM banking */
1252   memory_configure_bank(machine(), "bank2", 0, 3, m_ram->pointer(), 0x6000);
1253   memory_set_bank(machine(), "bank2", 0);
1252   membank("bank2")->configure_entries(0, 3, m_ram->pointer(), 0x6000);
1253   membank("bank2")->set_entry(0);
12541254
12551255   /* register for state saving */
12561256   save_item(NAME(m_bank));
src/mess/drivers/mccpm.c
r14976r14977
112112
113113MACHINE_RESET_MEMBER( mccpm_state )
114114{
115   UINT8* bios = machine().region("maincpu")->base();
115   UINT8* bios = memregion("maincpu")->base();
116116   memcpy(m_p_ram, bios, 0x1000);
117117}
118118
src/mess/drivers/systec.c
r14976r14977
9393
9494static MACHINE_RESET(systec)
9595{
96   UINT8 *m_p_maincpu = machine.region("maincpu")->base();
97   UINT8 *m_p_roms = machine.region("roms")->base();
96   UINT8 *m_p_maincpu = machine.root_device().memregion("maincpu")->base();
97   UINT8 *m_p_roms = machine.root_device().memregion("roms")->base();
9898   memcpy(m_p_maincpu, m_p_roms, 0x2000);
9999}
100100
src/mess/drivers/tutor.c
r14976r14977
225225   tutor_state *state = machine.driver_data<tutor_state>();
226226   state->m_tape_interrupt_timer = machine.scheduler().timer_alloc(FUNC(tape_interrupt_handler));
227227
228   memory_configure_bank(machine, "bank1", 0, 1, machine.region("maincpu")->base() + basic_base, 0);
229   memory_configure_bank(machine, "bank1", 1, 1, machine.region("maincpu")->base() + cartridge_base, 0);
230   memory_set_bank(machine, "bank1", 0);
228   state->membank("bank1")->configure_entry(0, machine.root_device().memregion("maincpu")->base() + basic_base);
229   state->membank("bank1")->configure_entry(1, state->memregion("maincpu")->base() + cartridge_base);
230   state->membank("bank1")->set_entry(0);
231231}
232232
233233
234234static DRIVER_INIT(pyuuta)
235235{
236236   DRIVER_INIT_CALL(tutor);
237   memory_set_bank(machine, "bank1", 1);
237   tutor_state *state = machine.driver_data<tutor_state>();
238   state->membank("bank1")->set_entry(1);
238239}
239240
240241
r14976r14977
296297static DEVICE_IMAGE_LOAD( tutor_cart )
297298{
298299   UINT32 size;
299   UINT8 *ptr = image.device().machine().region("maincpu")->base();
300   UINT8 *ptr = image.device().machine().root_device().memregion("maincpu")->base();
300301
301302   if (image.software_entry() == NULL)
302303   {
r14976r14977
315316
316317static DEVICE_IMAGE_UNLOAD( tutor_cart )
317318{
318   memset(image.device().machine().region("maincpu")->base() + cartridge_base, 0, 0x6000);
319   memset(image.device().machine().root_device().memregion("maincpu")->base() + cartridge_base, 0, 0x6000);
319320}
320321
321322/*
r14976r14977
363364   case 0x08:
364365      /* disable cartridge ROM, enable BASIC ROM at base >8000 */
365366      m_cartridge_enable = 0;
366      memory_set_bank(machine(), "bank1", 0);
367      membank("bank1")->set_entry(0);
367368      break;
368369
369370   case 0x0c:
370371      /* enable cartridge ROM, disable BASIC ROM at base >8000 */
371372      m_cartridge_enable = 1;
372      memory_set_bank(machine(), "bank1", 1);
373      membank("bank1")->set_entry(1);
373374      break;
374375
375376   default:
src/mess/drivers/z1013.c
r14976r14977
187187VIDEO_START( z1013 )
188188{
189189   z1013_state *state = machine.driver_data<z1013_state>();
190   state->m_p_chargen = machine.region("chargen")->base();
190   state->m_p_chargen = state->memregion("chargen")->base();
191191}
192192
193193SCREEN_UPDATE_IND16( z1013 )
src/mess/drivers/comx35.c
r14976r14977
2424
2525READ8_MEMBER( comx35_state::mem_r )
2626{
27   UINT8 *rom = machine().region(CDP1802_TAG)->base();
27   UINT8 *rom = memregion(CDP1802_TAG)->base();
2828   UINT8 *ram = m_ram->pointer();
2929   int extrom = 1;
3030
src/mess/drivers/trs80.c
r14976r14977
892892   trs80_state *state = machine.driver_data<trs80_state>();
893893   state->m_mode = 0;
894894   state->m_model4 = 2;
895   state->m_p_videoram.set_target(machine.region("maincpu")->base()+0x4000,state->m_p_videoram.bytes());
895   state->m_p_videoram.set_target(state->memregion("maincpu")->base()+0x4000,state->m_p_videoram.bytes());
896896}
897897
898898static DRIVER_INIT( trs80m4p )
r14976r14977
900900   trs80_state *state = machine.driver_data<trs80_state>();
901901   state->m_mode = 0;
902902   state->m_model4 = 4;
903   state->m_p_videoram.set_target(machine.region("maincpu")->base()+0x4000,state->m_p_videoram.bytes());
903   state->m_p_videoram.set_target(state->memregion("maincpu")->base()+0x4000,state->m_p_videoram.bytes());
904904}
905905
906906static DRIVER_INIT( lnw80 )
r14976r14977
908908   trs80_state *state = machine.driver_data<trs80_state>();
909909   state->m_mode = 0;
910910   state->m_model4 = 0;
911   state->m_p_gfxram = machine.region("gfx2")->base();
912   state->m_p_videoram.set_target(machine.region("maincpu")->base()+0x4000,state->m_p_videoram.bytes());
911   state->m_p_gfxram = machine.root_device().memregion("gfx2")->base();
912   state->m_p_videoram.set_target(state->memregion("maincpu")->base()+0x4000,state->m_p_videoram.bytes());
913913}
914914
915915/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT    INIT         COMPANY           FULLNAME */
src/mess/drivers/digel804.c
r14976r14977
174174   state->m_powerfail_state = 1; // "O11"
175175   state->m_chipinsert_state = 0; // PIN
176176   state->m_ram_bank = 0;
177   memory_set_bankptr( machine, "bankedram", machine.region("user_ram")->base() + ( state->m_ram_bank * 0x10000 ));
177   state->membank( "bankedram" )->set_base( state->memregion("user_ram")->base() + ( state->m_ram_bank * 0x10000 ));
178178   machine.scheduler().timer_set(attotime::from_hz(10000), FUNC(ep804_kbd_callback));
179179}
180180
r14976r14977
290290   m_ram_bank = data&7;
291291   if ((data&0xF8)!=0)
292292      logerror("Digel804: port 0x43 ram bank had unexpected data %02x written to it!\n", data);
293   memory_set_bankptr( machine(), "bankedram", machine().region("user_ram")->base() + ( m_ram_bank * 0x10000 ));
293   membank( "bankedram" )->set_base( memregion("user_ram")->base() + ( m_ram_bank * 0x10000 ));
294294
295295}
296296
src/mess/drivers/tiki100.c
r14976r14977
5959         program->install_readwrite_handler(0x0000, 0x7fff, read8_delegate(FUNC(tiki100_state::gfxram_r), this), write8_delegate(FUNC(tiki100_state::gfxram_w), this));
6060         program->install_readwrite_bank(0x8000, 0xffff, "bank3");
6161
62         memory_set_bank(machine(), "bank1", BANK_VIDEO_RAM);
63         memory_set_bank(machine(), "bank2", BANK_VIDEO_RAM);
64         memory_set_bank(machine(), "bank3", BANK_RAM);
62         membank("bank1")->set_entry(BANK_VIDEO_RAM);
63         membank("bank2")->set_entry(BANK_VIDEO_RAM);
64         membank("bank3")->set_entry(BANK_RAM);
6565      }
6666   }
6767   else
r14976r14977
7474         program->install_readwrite_bank(0x4000, 0x7fff, "bank2");
7575         program->install_readwrite_bank(0x8000, 0xffff, "bank3");
7676
77         memory_set_bank(machine(), "bank1", BANK_ROM);
78         memory_set_bank(machine(), "bank2", BANK_RAM);
79         memory_set_bank(machine(), "bank3", BANK_RAM);
77         membank("bank1")->set_entry(BANK_ROM);
78         membank("bank2")->set_entry(BANK_RAM);
79         membank("bank3")->set_entry(BANK_RAM);
8080      }
8181      else
8282      {
r14976r14977
8585         program->install_readwrite_bank(0x4000, 0x7fff, "bank2");
8686         program->install_readwrite_bank(0x8000, 0xffff, "bank3");
8787
88         memory_set_bank(machine(), "bank1", BANK_RAM);
89         memory_set_bank(machine(), "bank2", BANK_RAM);
90         memory_set_bank(machine(), "bank3", BANK_RAM);
88         membank("bank1")->set_entry(BANK_RAM);
89         membank("bank2")->set_entry(BANK_RAM);
90         membank("bank3")->set_entry(BANK_RAM);
9191      }
9292   }
9393}
r14976r14977
554554   /* setup memory banking */
555555   UINT8 *ram = m_ram->pointer();
556556
557   memory_configure_bank(machine(), "bank1", BANK_ROM, 1, machine().region(Z80_TAG)->base(), 0);
558   memory_configure_bank(machine(), "bank1", BANK_RAM, 1, ram, 0);
559   memory_configure_bank(machine(), "bank1", BANK_VIDEO_RAM, 1, m_video_ram, 0);
557   membank("bank1")->configure_entry(BANK_ROM, memregion(Z80_TAG)->base());
558   membank("bank1")->configure_entry(BANK_RAM, ram);
559   membank("bank1")->configure_entry(BANK_VIDEO_RAM, m_video_ram);
560560
561   memory_configure_bank(machine(), "bank2", BANK_RAM, 1, ram + 0x4000, 0);
562   memory_configure_bank(machine(), "bank2", BANK_VIDEO_RAM, 1, m_video_ram + 0x4000, 0);
561   membank("bank2")->configure_entry(BANK_RAM, ram + 0x4000);
562   membank("bank2")->configure_entry(BANK_VIDEO_RAM, m_video_ram + 0x4000);
563563
564   memory_configure_bank(machine(), "bank3", BANK_RAM, 1, ram + 0x8000, 0);
564   membank("bank3")->configure_entry(BANK_RAM, ram + 0x8000);
565565
566566   bankswitch();
567567
src/mess/drivers/atm.c
r14976r14977
4343      {
4444         m_ROMSelection = ((m_port_7ffd_data>>4) & 0x01) ? 1 : 0;
4545         betadisk_disable(beta);
46         memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x010000 + (m_ROMSelection<<14));
46         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x010000 + (m_ROMSelection<<14));
4747      }
4848   }
4949   else if (((pc & 0xff00) == 0x3d00) && (m_ROMSelection==1))
r14976r14977
5656   if(address<=0x3fff)
5757   {
5858      if (m_ROMSelection == 3) {
59         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine().region("maincpu")->base() + 0x018000);
60         memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x018000);
59         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, memregion("maincpu")->base() + 0x018000);
60         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x018000);
6161      } else {
62         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine().region("maincpu")->base() + 0x010000 + (m_ROMSelection<<14));
63         memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base() + 0x010000 + (m_ROMSelection<<14));
62         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, memregion("maincpu")->base() + 0x010000 + (m_ROMSelection<<14));
63         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x010000 + (m_ROMSelection<<14));
6464      }
6565      return ~0;
6666   }
r14976r14977
7575
7676   state->m_screen_location = messram + ((state->m_port_7ffd_data & 8) ? (7<<14) : (5<<14));
7777
78   memory_set_bankptr(machine, "bank4", messram + ((state->m_port_7ffd_data & 0x07) * 0x4000));
78   state->membank("bank4")->set_base(messram + ((state->m_port_7ffd_data & 0x07) * 0x4000));
7979
8080   if (beta->started() && betadisk_is_active(beta) && !( state->m_port_7ffd_data & 0x10 ) )
8181   {
r14976r14977
8686      state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ;
8787   }
8888   /* rom 0 is 128K rom, rom 1 is 48 BASIC */
89   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
89   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
9090}
9191
9292WRITE8_MEMBER(atm_state::atm_port_7ffd_w)
r14976r14977
135135   memset(messram,0,128*1024);
136136
137137   /* Bank 5 is always in 0x4000 - 0x7fff */
138   memory_set_bankptr(machine, "bank2", messram + (5<<14));
138   state->membank("bank2")->set_base(messram + (5<<14));
139139
140140   /* Bank 2 is always in 0x8000 - 0xbfff */
141   memory_set_bankptr(machine, "bank3", messram + (2<<14));
141   state->membank("bank3")->set_base(messram + (2<<14));
142142
143143   state->m_port_7ffd_data = 0;
144144   state->m_port_1ffd_data = -1;
src/mess/drivers/tricep.c
r14976r14977
5656static MACHINE_RESET(tricep)
5757{
5858   tricep_state *state = machine.driver_data<tricep_state>();
59   UINT8* user1 = machine.region("user1")->base();
59   UINT8* user1 = state->memregion("user1")->base();
6060
6161   memcpy((UINT8*)state->m_p_ram.target(),user1,0x2000);
6262
src/mess/drivers/pockstat.c
r14976r14977
789789         if(m_ftlb_regs.entry[index] == bank)
790790         {
791791            //printf( "Address %08x is assigned to %08x in entry %d\n", 0x02000000 + (offset << 2), index * 0x2000 + ((offset << 2) & 0x1fff), index );
792            return machine().region("flash")->u32(index * (0x2000/4) + (offset & (0x1fff/4)));
792            return memregion("flash")->u32(index * (0x2000/4) + (offset & (0x1fff/4)));
793793         }
794794      }
795795   }
796   return machine().region("flash")->u32(offset & 0x7fff);
796   return memregion("flash")->u32(offset & 0x7fff);
797797}
798798
799799
r14976r14977
819819   if(m_ps_flash_write_count)
820820   {
821821      m_ps_flash_write_count--;
822      COMBINE_DATA(&((UINT32*)(*machine().region("flash")))[offset]);
822      COMBINE_DATA(&((UINT32*)(*machine().root_device().memregion("flash")))[offset]);
823823   }
824824}
825825
r14976r14977
958958static DEVICE_IMAGE_LOAD( pockstat_flash )
959959{
960960   int i, length;
961   UINT8 *cart = image.device().machine().region("flash")->base();
961   UINT8 *cart = image.device().machine().root_device().memregion("flash")->base();
962962   static const char *gme_id = "123-456-STD";
963963
964964   length = image.fread( cart, 0x20f40);
src/mess/drivers/homez80.c
r14976r14977
220220
221221VIDEO_START_MEMBER( homez80_state )
222222{
223   m_p_chargen = machine().region("chargen")->base();
223   m_p_chargen = memregion("chargen")->base();
224224}
225225
226226SCREEN_UPDATE16_MEMBER( homez80_state )
src/mess/drivers/abc1600.c
r14976r14977
846846   if (!BOOTE && !A19 && !A18 && !A17)
847847   {
848848      // _BOOTCE
849      UINT8 *rom = machine().region(MC68008P8_TAG)->base();
849      UINT8 *rom = memregion(MC68008P8_TAG)->base();
850850      data = rom[offset & 0x3fff];
851851   }
852852   else if (A19 && !m_ifc2 && !FC1)
src/mess/drivers/sage2.c
r14976r14977
4848
4949   if (m_reset || (offset >= 0xfe0000))
5050   {
51      data = machine().region(M68000_TAG)->base()[offset & 0x1fff];
51      data = memregion(M68000_TAG)->base()[offset & 0x1fff];
5252   }
5353   else if (offset < 0x080000)
5454   {
r14976r14977
663663   program->set_direct_update_handler(direct_update_delegate(FUNC(sage2_direct_update_handler), &machine));
664664
665665   // patch out i8251 test
666   machine.region(M68000_TAG)->base()[0x1be8] = 0xd6;
667   machine.region(M68000_TAG)->base()[0x1be9] = 0x4e;
666   machine.root_device().memregion(M68000_TAG)->base()[0x1be8] = 0xd6;
667   machine.root_device().memregion(M68000_TAG)->base()[0x1be9] = 0x4e;
668668}
669669
670670
src/mess/drivers/ob68k1a.c
r14976r14977
314314
315315   // set reset vector
316316   void *ram = program->get_write_ptr(0);
317   UINT8 *rom = machine().region(MC68000L10_TAG)->base();
317   UINT8 *rom = memregion(MC68000L10_TAG)->base();
318318
319319   memcpy(ram, rom, 8);
320320
src/mess/drivers/fp6000.c
r14976r14977
7777   fp6000_state *state = screen.machine().driver_data<fp6000_state>();
7878   int x,y;
7979   int xi,yi;
80   UINT8 *gfx_rom = screen.machine().region("pcg")->base();
80   UINT8 *gfx_rom = state->memregion("pcg")->base();
8181   UINT32 count;
8282
8383   count = 0;
r14976r14977
277277{
278278   fp6000_state *state = machine.driver_data<fp6000_state>();
279279
280   state->m_char_rom = machine.region("pcg")->base();
280   state->m_char_rom = state->memregion("pcg")->base();
281281   state->m_mc6845 = machine.device<mc6845_device>("crtc");
282282}
283283
src/mess/drivers/tandy2k.c
r14976r14977
677677   program->install_ram(0x00000, ram_size - 1, ram);
678678
679679   // patch out i186 relocation register check
680   UINT8 *rom = machine().region(I80186_TAG)->base();
680   UINT8 *rom = memregion(I80186_TAG)->base();
681681   rom[0x1f16] = 0x90;
682682   rom[0x1f17] = 0x90;
683683
src/mess/drivers/x07.c
r14976r14977
333333      break;
334334   case 0x1c:   //UDC Init
335335      {
336         memcpy(m_t6834_ram + 0x200, (UINT8*)machine().region("gfx1")->base() + 0x400, 0x100);
337         memcpy(m_t6834_ram + 0x300, (UINT8*)machine().region("gfx1")->base() + 0x700, 0x100);
336         memcpy(m_t6834_ram + 0x200, (UINT8*)machine().root_device().memregion("gfx1")->base() + 0x400, 0x100);
337         memcpy(m_t6834_ram + 0x300, (UINT8*)machine().root_device().memregion("gfx1")->base() + 0x700, 0x100);
338338      }
339339      break;
340340
r14976r14977
900900   }
901901   else                     //charset
902902   {
903      return machine().region("gfx1")->base()[pos];
903      return memregion("gfx1")->base()[pos];
904904   }
905905}
906906
r14976r14977
10471047
10481048   if (image.software_entry() == NULL)
10491049   {
1050      UINT8 *rom = machine.region_alloc( "card", image.length(), 1, ENDIANNESS_LITTLE )->base();
1050      UINT8 *rom = machine.memory().region_alloc( "card", image.length(), 1, ENDIANNESS_LITTLE )->base();
10511051      image.fread(rom, image.length());
10521052
10531053      space->install_ram(ram_size, ram_size + 0xfff);
r14976r14977
13531353            strcpy((char*)state->m_t6834_ram + udk_offset[i], udk_ini[i]);
13541354
13551355         //copy default chars in the UDC
1356         memcpy(state->m_t6834_ram + 0x200, (UINT8*)machine.region("gfx1")->base() + 0x400, 0x100);
1357         memcpy(state->m_t6834_ram + 0x300, (UINT8*)machine.region("gfx1")->base() + 0x700, 0x100);
1356         memcpy(state->m_t6834_ram + 0x200, (UINT8*)machine.root_device().memregion("gfx1")->base() + 0x400, 0x100);
1357         memcpy(state->m_t6834_ram + 0x300, (UINT8*)machine.root_device().memregion("gfx1")->base() + 0x700, 0x100);
13581358         state->m_warm_start = 0;
13591359      }
13601360   }
src/mess/drivers/nanos.c
r14976r14977
272272
273273VIDEO_START_MEMBER( nanos_state )
274274{
275   m_p_chargen = machine().region("chargen")->base();
275   m_p_chargen = memregion("chargen")->base();
276276}
277277
278278SCREEN_UPDATE16_MEMBER( nanos_state )
r14976r14977
341341   nanos_state *state = device->machine().driver_data<nanos_state>();
342342   state->m_key_command = BIT(data,1);
343343   if (BIT(data,7)) {
344      memory_set_bankptr(device->machine(), "bank1", device->machine().region("maincpu")->base());
344      state->membank("bank1")->set_base(state->memregion("maincpu")->base());
345345   } else {
346      memory_set_bankptr(device->machine(), "bank1", device->machine().device<ram_device>(RAM_TAG)->pointer());
346      state->membank("bank1")->set_base(device->machine().device<ram_device>(RAM_TAG)->pointer());
347347   }
348348}
349349
r14976r14977
455455   space->install_write_bank(0x0000, 0x0fff, "bank3");
456456   space->install_write_bank(0x1000, 0xffff, "bank2");
457457
458   memory_set_bankptr(machine(), "bank1", machine().region("maincpu")->base());
459   memory_set_bankptr(machine(), "bank2", machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
460   memory_set_bankptr(machine(), "bank3", machine().device<ram_device>(RAM_TAG)->pointer());
458   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
459   membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
460   membank("bank3")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
461461
462462   floppy_mon_w(floppy_get_device(space->machine(), 0), CLEAR_LINE);
463463   floppy_drive_set_ready_state(floppy_get_device(space->machine(), 0), 1,1);
src/mess/drivers/gp2x.c
r14976r14977
202202
203203READ32_MEMBER( gp2x_state::nand_r )
204204{
205   UINT32 *ROM = (UINT32 *)(*machine().region("maincpu"));
205   UINT32 *ROM = (UINT32 *)(*machine().root_device().memregion("maincpu"));
206206   UINT32 ret;
207207
208208   if (offset == 0)
src/mess/drivers/k8915.c
r14976r14977
5757{
5858// seems to switch ram and rom around.
5959   if (data == 0x87)
60      memory_set_bank(machine(), "boot", 0); // ram at 0000
60      membank("boot")->set_entry(0); // ram at 0000
6161   else
62      memory_set_bank(machine(), "boot", 1); // rom at 0000
62      membank("boot")->set_entry(1); // rom at 0000
6363}
6464
6565static ADDRESS_MAP_START(k8915_mem, AS_PROGRAM, 8, k8915_state)
r14976r14977
8282
8383MACHINE_RESET_MEMBER(k8915_state)
8484{
85   memory_set_bank(machine(), "boot", 1);
85   membank("boot")->set_entry(1);
8686}
8787
8888static DRIVER_INIT(k8915)
8989{
90   UINT8 *RAM = machine.region("maincpu")->base();
91   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x10000);
90   k8915_state *state = machine.driver_data<k8915_state>();
91   UINT8 *RAM = state->memregion("maincpu")->base();
92   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x10000);
9293}
9394
9495VIDEO_START_MEMBER( k8915_state )
9596{
96   m_p_chargen = machine().region("chargen")->base();
97   m_p_chargen = memregion("chargen")->base();
9798}
9899
99100SCREEN_UPDATE16_MEMBER( k8915_state )
src/mess/drivers/z9001.c
r14976r14977
9595
9696VIDEO_START_MEMBER( z9001_state )
9797{
98   m_p_chargen = machine().region("chargen")->base();
98   m_p_chargen = memregion("chargen")->base();
9999}
100100
101101static SCREEN_UPDATE_IND16( z9001 )
src/mess/drivers/pasopia7.c
r14976r14977
199199
200200static void draw_cg4_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
201201{
202   UINT8 *vram = machine.region("vram")->base();
202   UINT8 *vram = machine.root_device().memregion("vram")->base();
203203   int x,y,xi,yi;
204204   int count;
205205
r14976r14977
231231static void draw_tv_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
232232{
233233   pasopia7_state *state = machine.driver_data<pasopia7_state>();
234   UINT8 *vram = machine.region("vram")->base();
235   UINT8 *gfx_data = machine.region("font")->base();
234   UINT8 *vram = machine.root_device().memregion("vram")->base();
235   UINT8 *gfx_data = state->memregion("font")->base();
236236   int x,y,xi,yi;
237237   int count;
238238
r14976r14977
290290static void draw_mixed_screen(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int width)
291291{
292292   pasopia7_state *state = machine.driver_data<pasopia7_state>();
293   UINT8 *vram = machine.region("vram")->base();
294   UINT8 *gfx_data = machine.region("font")->base();
293   UINT8 *vram = machine.root_device().memregion("vram")->base();
294   UINT8 *gfx_data = state->memregion("font")->base();
295295   int x,y,xi,yi;
296296   int count;
297297
r14976r14977
391391
392392READ8_MEMBER( pasopia7_state::vram_r )
393393{
394   UINT8 *vram = machine().region("vram")->base();
394   UINT8 *vram = memregion("vram")->base();
395395   UINT8 res;
396396
397397   if (m_vram_sel == 0)
398398   {
399      UINT8 *work_ram = machine().region("maincpu")->base();
399      UINT8 *work_ram = memregion("maincpu")->base();
400400
401401      return work_ram[offset+0x8000];
402402   }
r14976r14977
421421
422422WRITE8_MEMBER( pasopia7_state::vram_w )
423423{
424   UINT8 *vram = machine().region("vram")->base();
424   UINT8 *vram = memregion("vram")->base();
425425
426426   if (m_vram_sel)
427427   {
r14976r14977
444444   }
445445   else
446446   {
447      UINT8 *work_ram = machine().region("maincpu")->base();
447      UINT8 *work_ram = memregion("maincpu")->base();
448448
449449      work_ram[offset+0x8000] = data;
450450   }
r14976r14977
452452
453453WRITE8_MEMBER( pasopia7_state::pasopia7_memory_ctrl_w )
454454{
455   UINT8 *work_ram = machine().region("maincpu")->base();
456   UINT8 *basic = machine().region("basic")->base();
455   UINT8 *work_ram = memregion("maincpu")->base();
456   UINT8 *basic = memregion("basic")->base();
457457
458458   switch(data & 3)
459459   {
460460      case 0:
461461      case 3: //select Basic ROM
462         memory_set_bankptr(machine(), "bank1", basic    + 0x00000);
463         memory_set_bankptr(machine(), "bank2", basic    + 0x04000);
462         membank("bank1")->set_base(basic    + 0x00000);
463         membank("bank2")->set_base(basic    + 0x04000);
464464         break;
465465      case 1: //select Basic ROM + BIOS ROM
466         memory_set_bankptr(machine(), "bank1", basic    + 0x00000);
467         memory_set_bankptr(machine(), "bank2", work_ram + 0x10000);
466         membank("bank1")->set_base(basic    + 0x00000);
467         membank("bank2")->set_base(work_ram + 0x10000);
468468         break;
469469      case 2: //select Work RAM
470         memory_set_bankptr(machine(), "bank1", work_ram + 0x00000);
471         memory_set_bankptr(machine(), "bank2", work_ram + 0x04000);
470         membank("bank1")->set_base(work_ram + 0x00000);
471         membank("bank2")->set_base(work_ram + 0x04000);
472472         break;
473473   }
474474
r14976r14977
510510         {
511511            UINT8 *pac2_ram;
512512
513            pac2_ram = machine().region(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base();
513            pac2_ram = memregion(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base();
514514
515515            pac2_ram[m_pac2_index[(m_pac2_bank_select-3) & 1]] = data;
516516         }
r14976r14977
545545      {
546546         UINT8 *pac2_ram;
547547
548         pac2_ram = machine().region(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base();
548         pac2_ram = memregion(((m_pac2_bank_select-3) & 1) ? "rampac2" : "rampac1")->base();
549549
550550         return pac2_ram[m_pac2_index[(m_pac2_bank_select-3) & 1]];
551551      }
552552      else if(m_pac2_bank_select == 2)
553553      {
554         UINT8 *kanji_rom = machine().region("kanji")->base();
554         UINT8 *kanji_rom = memregion("kanji")->base();
555555
556556         return kanji_rom[m_kanji_index];
557557      }
r14976r14977
567567/* writes always occurs to the RAM banks, even if the ROMs are selected. */
568568WRITE8_MEMBER( pasopia7_state::ram_bank_w )
569569{
570   UINT8 *work_ram = machine().region("maincpu")->base();
570   UINT8 *work_ram = memregion("maincpu")->base();
571571
572572   work_ram[offset] = data;
573573}
r14976r14977
991991static MACHINE_RESET( pasopia7 )
992992{
993993   pasopia7_state *state = machine.driver_data<pasopia7_state>();
994   UINT8 *bios = machine.region("maincpu")->base();
994   UINT8 *bios = state->memregion("maincpu")->base();
995995
996   memory_set_bankptr(machine, "bank1", bios + 0x10000);
997   memory_set_bankptr(machine, "bank2", bios + 0x10000);
998//  memory_set_bankptr(machine, "bank3", bios + 0x10000);
999//  memory_set_bankptr(machine, "bank4", bios + 0x10000);
996   state->membank("bank1")->set_base(bios + 0x10000);
997   state->membank("bank2")->set_base(bios + 0x10000);
998//  state->membank("bank3")->set_base(bios + 0x10000);
999//  state->membank("bank4")->set_base(bios + 0x10000);
10001000
10011001   state->m_nmi_reset |= 4;
10021002}
src/mess/drivers/c10.c
r14976r14977
5656/* after the first 4 bytes have been read from ROM, switch the ram back in */
5757static TIMER_CALLBACK( c10_reset )
5858{
59   memory_set_bank(machine, "boot", 0);
59   c10_state *state = machine.driver_data<c10_state>();
60   state->membank("boot")->set_entry(0);
6061}
6162
6263MACHINE_RESET_MEMBER(c10_state)
6364{
64   memory_set_bank(machine(), "boot", 1);
65   membank("boot")->set_entry(1);
6566   machine().scheduler().timer_set(attotime::from_usec(4), FUNC(c10_reset));
6667}
6768
6869VIDEO_START_MEMBER( c10_state )
6970{
70   m_p_chargen = machine().region("chargen")->base();
71   m_p_chargen = memregion("chargen")->base();
7172}
7273
7374/* This system appears to have inline attribute bytes of unknown meaning.
r14976r14977
161162
162163DRIVER_INIT( c10 )
163164{
164   UINT8 *RAM = machine.region("maincpu")->base();
165   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0x8000);
165   c10_state *state = machine.driver_data<c10_state>();
166   UINT8 *RAM = state->memregion("maincpu")->base();
167   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0x8000);
166168}
167169
168170/* ROM definition */
src/mess/drivers/gamepock.c
r14976r14977
4747
4848static DEVICE_START(gamepock_cart)
4949{
50   memory_set_bankptr( device->machine(), "bank1", device->machine().region("user1" )->base() );
50   gamepock_state *state = device->machine().driver_data<gamepock_state>();
51   state->membank( "bank1" )->set_base( state->memregion("user1" )->base() );
5152}
5253
5354
5455static DEVICE_IMAGE_LOAD(gamepock_cart) {
55   UINT8 *cart = image.device().machine().region("user1" )->base();
56   gamepock_state *state = image.device().machine().driver_data<gamepock_state>();
57   UINT8 *cart = state->memregion("user1" )->base();
5658
5759   if ( image.software_entry() == NULL )
5860   {
r14976r14977
6769      cart = image.get_software_region( "rom" );
6870   }
6971
70   memory_set_bankptr( image.device().machine(), "bank1", cart );
72   state->membank( "bank1" )->set_base( cart );
7173
7274   return IMAGE_INIT_PASS;
7375}
src/mess/drivers/huebler.c
r14976r14977
222222void amu880_state::video_start()
223223{
224224   // find memory regions
225   m_char_rom = machine().region("chargen")->base();
225   m_char_rom = memregion("chargen")->base();
226226}
227227
228228UINT32 amu880_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
r14976r14977
350350void amu880_state::machine_start()
351351{
352352   /* find memory regions */
353   m_kb_rom = machine().region("keyboard")->base();
353   m_kb_rom = memregion("keyboard")->base();
354354
355355   /* register for state saving */
356356   save_item(NAME(m_key_d6));
src/mess/drivers/sm1800.c
r14976r14977
104104   int i;
105105   sm1800_state *state = device->machine().driver_data<sm1800_state>();
106106   bitmap_ind16 &bitmap = state->m_bitmap;
107   UINT8 *charmap = device->machine().region("chargen")->base();
107   UINT8 *charmap = state->memregion("chargen")->base();
108108   UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
109109   if (vsp)
110110      pixels = 0;
src/mess/drivers/fm7.c
r14976r14977
288288
289289READ8_MEMBER(fm7_state::vector_r)
290290{
291   UINT8* RAM = machine().region("maincpu")->base();
292   UINT8* ROM = machine().region("init")->base();
291   UINT8* RAM = memregion("maincpu")->base();
292   UINT8* ROM = memregion("init")->base();
293293
294294   if(m_init_rom_en)
295295      return ROM[0x1ff0+offset];
r14976r14977
304304
305305WRITE8_MEMBER(fm7_state::vector_w)
306306{
307   UINT8* RAM = machine().region("maincpu")->base();
307   UINT8* RAM = memregion("maincpu")->base();
308308
309309   if(m_type == SYS_FM7)
310310      RAM[0xfff0+offset] = data;
r14976r14977
342342 */
343343READ8_MEMBER(fm7_state::fm7_rom_en_r)
344344{
345   UINT8* RAM = machine().region("maincpu")->base();
345   UINT8* RAM = memregion("maincpu")->base();
346346
347347   m_basic_rom_en = 1;
348348   if(m_type == SYS_FM7)
349349   {
350350      space.install_read_bank(0x8000,0xfbff,"bank1");
351351      space.nop_write(0x8000,0xfbff);
352      memory_set_bankptr(machine(),"bank1",RAM+0x38000);
352      membank("bank1")->set_base(RAM+0x38000);
353353   }
354354   else
355355      fm7_mmr_refresh(&space);
r14976r14977
359359
360360WRITE8_MEMBER(fm7_state::fm7_rom_en_w)
361361{
362   UINT8* RAM = machine().region("maincpu")->base();
362   UINT8* RAM = memregion("maincpu")->base();
363363
364364   m_basic_rom_en = 0;
365365   if(m_type == SYS_FM7)
366366   {
367367      space.install_readwrite_bank(0x8000,0xfbff,"bank1");
368      memory_set_bankptr(machine(),"bank1",RAM+0x8000);
368      membank("bank1")->set_base(RAM+0x8000);
369369   }
370370   else
371371      fm7_mmr_refresh(&space);
r14976r14977
988988static void fm7_update_bank(address_space* space, int bank, UINT8 physical)
989989{
990990   fm7_state *state = space->machine().driver_data<fm7_state>();
991   UINT8* RAM = space->machine().region("maincpu")->base();
991   UINT8* RAM = state->memregion("maincpu")->base();
992992   UINT16 size = 0xfff;
993993   char bank_name[10];
994994
r14976r14977
10381038            space->install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vramB_r),state),write8_delegate(FUNC(fm7_state::fm7_vramB_w),state));
10391039            break;
10401040      }
1041//      memory_set_bankptr(space->machine(),bank+1,RAM+(physical<<12)-0x10000);
1041//      state->membank(bank+1)->set_base(RAM+(physical<<12)-0x10000);
10421042      return;
10431043   }
10441044   if(physical == 0x1c)
r14976r14977
10551055   {
10561056      if(state->m_init_rom_en && (state->m_type == SYS_FM11 || state->m_type == SYS_FM16))
10571057      {
1058         RAM = space->machine().region("init")->base();
1058         RAM = space->machine().root_device().memregion("init")->base();
10591059         space->install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name);
10601060         space->nop_write(bank*0x1000,(bank*0x1000)+size);
1061         memory_set_bankptr(space->machine(),bank_name,RAM+(physical<<12)-0x35000);
1061         state->membank(bank_name)->set_base(RAM+(physical<<12)-0x35000);
10621062         return;
10631063      }
10641064   }
r14976r14977
10661066   {
10671067      if(state->m_init_rom_en && (state->m_type != SYS_FM11 || state->m_type != SYS_FM16))
10681068      {
1069         RAM = space->machine().region("init")->base();
1069         RAM = space->machine().root_device().memregion("init")->base();
10701070         space->install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name);
10711071         space->nop_write(bank*0x1000,(bank*0x1000)+size);
1072         memory_set_bankptr(space->machine(),bank_name,RAM+(physical<<12)-0x36000);
1072         state->membank(bank_name)->set_base(RAM+(physical<<12)-0x36000);
10731073         return;
10741074      }
10751075   }
r14976r14977
10771077   {
10781078      if(state->m_basic_rom_en && (state->m_type != SYS_FM11 || state->m_type != SYS_FM16))
10791079      {
1080         RAM = space->machine().region("fbasic")->base();
1080         RAM = space->machine().root_device().memregion("fbasic")->base();
10811081         space->install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name);
10821082         space->nop_write(bank*0x1000,(bank*0x1000)+size);
1083         memory_set_bankptr(space->machine(),bank_name,RAM+(physical<<12)-0x38000);
1083         state->membank(bank_name)->set_base(RAM+(physical<<12)-0x38000);
10841084         return;
10851085      }
10861086   }
10871087   space->install_readwrite_bank(bank*0x1000,(bank*0x1000)+size,bank_name);
1088   memory_set_bankptr(space->machine(),bank_name,RAM+(physical<<12));
1088   state->membank(bank_name)->set_base(RAM+(physical<<12));
10891089}
10901090
10911091static void fm7_mmr_refresh(address_space* space)
r14976r14977
10931093   fm7_state *state = space->machine().driver_data<fm7_state>();
10941094   int x;
10951095   UINT16 window_addr;
1096   UINT8* RAM = space->machine().region("maincpu")->base();
1096   UINT8* RAM = state->memregion("maincpu")->base();
10971097
10981098   if(state->m_mmr.enabled)
10991099   {
r14976r14977
11161116//      if(window_addr < 0xfc00)
11171117      {
11181118         space->install_readwrite_bank(0x7c00,0x7fff,"bank24");
1119         memory_set_bankptr(space->machine(),"bank24",RAM+window_addr);
1119         state->membank("bank24")->set_base(RAM+window_addr);
11201120      }
11211121   }
11221122}
r14976r14977
11641164 */
11651165READ8_MEMBER(fm7_state::fm7_kanji_r)
11661166{
1167   UINT8* KROM = machine().region("kanji1")->base();
1167   UINT8* KROM = memregion("kanji1")->base();
11681168   UINT32 addr = m_kanji_address << 1;
11691169
11701170   switch(offset)
r14976r14977
18461846   fm7_state *state = machine.driver_data<fm7_state>();
18471847   // The FM-7 has no initialisation ROM, and no other obvious
18481848   // way to set the reset vector, so for now this will have to do.
1849   UINT8* RAM = machine.region("maincpu")->base();
1849   UINT8* RAM = state->memregion("maincpu")->base();
18501850
18511851   RAM[0xfffe] = 0xfe;
18521852   RAM[0xffff] = 0x00;
r14976r14977
18611861static MACHINE_START(fm77av)
18621862{
18631863   fm7_state *state = machine.driver_data<fm7_state>();
1864   UINT8* RAM = machine.region("maincpu")->base();
1865   UINT8* ROM = machine.region("init")->base();
1864   UINT8* RAM = machine.root_device().memregion("maincpu")->base();
1865   UINT8* ROM = machine.root_device().memregion("init")->base();
18661866
18671867   memset(state->m_shared_ram,0xff,0x80);
18681868
r14976r14977
18701870   memcpy(RAM+0x3fff0,ROM+0x1ff0,16);
18711871
18721872   state->m_video.subrom = 0;  // default sub CPU ROM is type C.
1873   RAM = machine.region("subsyscg")->base();
1874   memory_set_bankptr(machine,"bank20",RAM);
1875   RAM = machine.region("subsys_c")->base();
1876   memory_set_bankptr(machine,"bank21",RAM+0x800);
1873   RAM = machine.root_device().memregion("subsyscg")->base();
1874   state->membank("bank20")->set_base(RAM);
1875   RAM = state->memregion("subsys_c")->base();
1876   state->membank("bank21")->set_base(RAM+0x800);
18771877
18781878   state->m_type = SYS_FM77AV;
18791879   beep_set_frequency(machine.device(BEEPER_TAG),1200);
r14976r14977
18831883static MACHINE_START(fm11)
18841884{
18851885   fm7_state *state = machine.driver_data<fm7_state>();
1886   UINT8* RAM = machine.region("maincpu")->base();
1887   UINT8* ROM = machine.region("init")->base();
1886   UINT8* RAM = machine.root_device().memregion("maincpu")->base();
1887   UINT8* ROM = state->memregion("init")->base();
18881888
18891889   memset(state->m_shared_ram,0xff,0x80);
18901890   state->m_type = SYS_FM11;
r14976r14977
19061906static MACHINE_RESET(fm7)
19071907{
19081908   fm7_state *state = machine.driver_data<fm7_state>();
1909   UINT8* RAM = machine.region("maincpu")->base();
1910   UINT8* ROM = machine.region("init")->base();
1909   UINT8* RAM = machine.root_device().memregion("maincpu")->base();
1910   UINT8* ROM = state->memregion("init")->base();
19111911
19121912   state->m_timer->adjust(attotime::from_nsec(2034500),0,attotime::from_nsec(2034500));
19131913   state->m_subtimer->adjust(attotime::from_msec(20),0,attotime::from_msec(20));
r14976r14977
19381938   else
19391939      state->m_init_rom_en = 0;
19401940   if(state->m_type == SYS_FM7)
1941      memory_set_bankptr(machine,"bank1",RAM+0x38000);
1941      state->membank("bank1")->set_base(RAM+0x38000);
19421942   state->m_key_delay = 700;  // 700ms on FM-7
19431943   state->m_key_repeat = 70;  // 70ms on FM-7
19441944   state->m_break_flag = 0;
r14976r14977
19581958   {
19591959      if(!(input_port_read(machine,"DSW") & 0x02))
19601960      {  // DOS mode
1961         memory_set_bankptr(machine,"bank17",machine.region("dos")->base());
1961         state->membank("bank17")->set_base(machine.root_device().memregion("dos")->base());
19621962      }
19631963      else
19641964      {  // BASIC mode
1965         memory_set_bankptr(machine,"bank17",machine.region("basic")->base());
1965         state->membank("bank17")->set_base(machine.root_device().memregion("basic")->base());
19661966      }
19671967   }
19681968   if(state->m_type == SYS_FM77AV || state->m_type == SYS_FM77AV40EX || state->m_type == SYS_FM11)
src/mess/drivers/compis.c
r14976r14977
8686{
8787   compis_state *state = screen.machine().driver_data<compis_state>();
8888   UINT8 *m_p_chargen;
89   m_p_chargen = screen.machine().region("maincpu")->base()+0xca70; //bios0
89   m_p_chargen = state->memregion("maincpu")->base()+0xca70; //bios0
9090   if (m_p_chargen[0x214] != 0x08) m_p_chargen+= 0x10; //bios1
9191   UINT8 y,ra,chr,gfx;
9292   UINT16 sy=0,ma=0,x;
src/mess/drivers/jr100.c
r14976r14977
175175   jr100_state *state = screen.machine().driver_data<jr100_state>();
176176   int x,y,xi,yi;
177177
178   UINT8 *rom_pcg = screen.machine().region("maincpu")->base() + 0xe000;
178   UINT8 *rom_pcg = state->memregion("maincpu")->base() + 0xe000;
179179   for (y = 0; y < 24; y++)
180180   {
181181      for (x = 0; x < 32; x++)
src/mess/drivers/czk80.c
r14976r14977
7676
7777MACHINE_RESET_MEMBER(czk80_state)
7878{
79   UINT8* bios = machine().region("maincpu")->base() + 0xe000;
79   UINT8* bios = memregion("maincpu")->base() + 0xe000;
8080   memcpy(m_p_ram, bios, 0x2000);
8181   memcpy(m_p_ram+0xe000, bios, 0x2000);
8282}
src/mess/drivers/exp85.c
r14976r14977
184184   /* setup memory banking */
185185   program->install_read_bank(0x0000, 0x07ff, "bank1");
186186   program->unmap_write(0x0000, 0x07ff);
187   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(I8085A_TAG)->base() + 0xf000, 0);
188   memory_configure_bank(machine(), "bank1", 1, 1, machine().region(I8085A_TAG)->base(), 0);
189   memory_set_bank(machine(), "bank1", 0);
187   membank("bank1")->configure_entry(0, memregion(I8085A_TAG)->base() + 0xf000);
188   membank("bank1")->configure_entry(1, memregion(I8085A_TAG)->base());
189   membank("bank1")->set_entry(0);
190190}
191191
192192/* Machine Driver */
src/mess/drivers/esq1.c
r14976r14977
8989static MACHINE_RESET( esq1 )
9090{
9191   // set default OSROM banking
92   memory_set_bankptr(machine, "osbank", machine.region("osrom")->base() );
92   esq1_state *state = machine.driver_data<esq1_state>();
93   state->membank("osbank")->set_base(machine.root_device().memregion("osrom")->base() );
9394}
9495
9596static ADDRESS_MAP_START( esq1_map, AS_PROGRAM, 8, esq1_state )
r14976r14977
129130static void duart_output(device_t *device, UINT8 data)
130131{
131132   int bank = ((data >> 1) & 0x7);
132
133   esq1_state *state = device->machine().driver_data<esq1_state>();
133134//  printf("DP [%02x]: %d mlo %d mhi %d tape %d\n", data, data&1, (data>>4)&1, (data>>5)&1, (data>>6)&3);
134135//  printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, cpu_get_pc(device->machine().firstcpu));
135   memory_set_bankptr(device->machine(), "osbank", device->machine().region("osrom")->base() + (bank * 0x1000) );
136   state->membank("osbank")->set_base(device->machine().root_device().memregion("osrom")->base() + (bank * 0x1000) );
136137}
137138
138139static void duart_tx(device_t *device, int channel, UINT8 data)
src/mess/drivers/ami1200.c
r14976r14977
5555      data = (data >> 16) & 1;
5656
5757      /* switch banks as appropriate */
58      memory_set_bank(machine(), "bank1", data & 1);
58      membank("bank1")->set_entry(data & 1);
5959
6060      /* swap the write handlers between ROM and bank 1 based on the bit */
6161      if ((data & 1) == 0)
r14976r14977
400400   amiga_machine_config(machine, &cd32_intf);
401401
402402   /* set up memory */
403   memory_configure_bank(machine, "bank1", 0, 1, state->m_chip_ram, 0);
404   memory_configure_bank(machine, "bank1", 1, 1, machine.region("user1")->base(), 0);
403   state->membank("bank1")->configure_entry(0, state->m_chip_ram);
404   state->membank("bank1")->configure_entry(1, machine.root_device().memregion("user1")->base());
405405
406406   /* initialize keyboard */
407407   amigakbd_init(machine);
src/mess/drivers/hp49gp.c
r14976r14977
267267static DRIVER_INIT( hp49gp )
268268{
269269   hp49gp_state *hp49gp = machine.driver_data<hp49gp_state>();
270   UINT8 *rom = (UINT8 *)machine.region( "maincpu")->base();
270   UINT8 *rom = (UINT8 *)machine.root_device().memregion( "maincpu")->base();
271271   memcpy( hp49gp->m_steppingstone, rom, 1024);
272272   lcd_spi_init( machine);
273273}
src/mess/drivers/trs80m2.c
r14976r14977
130130   {
131131      if (m_boot_rom)
132132      {
133         data = machine().region(Z80_TAG)->base()[offset];
133         data = memregion(Z80_TAG)->base()[offset];
134134      }
135135      else
136136      {
r14976r14977
625625void trs80m2_state::video_start()
626626{
627627   // find memory regions
628   m_char_rom = machine().region(MC6845_TAG)->base();
628   m_char_rom = memregion(MC6845_TAG)->base();
629629
630630   // allocate memory
631631   m_video_ram = auto_alloc_array(machine(), UINT8, 0x800);
src/mess/drivers/pdp11.c
r14976r14977
219219static MACHINE_RESET(pdp11)
220220{
221221   // Load M9301-YA
222   UINT8* user1 = machine.region("user1")->base();
223   UINT8* maincpu = machine.region("maincpu")->base();
222   UINT8* user1 = machine.root_device().memregion("user1")->base();
223   UINT8* maincpu = machine.root_device().memregion("maincpu")->base();
224224   int i;
225225
226226   for(i=0;i<0x100;i++) {
r14976r14977
263263static MACHINE_RESET(pdp11ub2)
264264{
265265   // Load M9312
266   UINT8* user1 = machine.region("consproms")->base() + input_port_read(machine,"CONSPROM") * 0x0400;
267   UINT8* maincpu = machine.region("maincpu")->base();
266   UINT8* user1 = machine.root_device().memregion("consproms")->base() + input_port_read(machine,"CONSPROM") * 0x0400;
267   UINT8* maincpu = machine.root_device().memregion("maincpu")->base();
268268
269269   //0165000
270270   load9312prom(maincpu + 0165000,user1,0x100);
r14976r14977
281281   }
282282
283283   //0173000
284   load9312prom(maincpu + 0173000,machine.region("devproms")->base() + input_port_read(machine,"DEVPROM1") * 0x0200,0x080);
284   load9312prom(maincpu + 0173000,machine.root_device().memregion("devproms")->base() + input_port_read(machine,"DEVPROM1") * 0x0200,0x080);
285285   //0173200
286   load9312prom(maincpu + 0173200,machine.region("devproms")->base() + input_port_read(machine,"DEVPROM2") * 0x0200,0x080);
286   load9312prom(maincpu + 0173200,machine.root_device().memregion("devproms")->base() + input_port_read(machine,"DEVPROM2") * 0x0200,0x080);
287287   //0173400
288   load9312prom(maincpu + 0173400,machine.region("devproms")->base() + input_port_read(machine,"DEVPROM3") * 0x0200,0x080);
288   load9312prom(maincpu + 0173400,machine.root_device().memregion("devproms")->base() + input_port_read(machine,"DEVPROM3") * 0x0200,0x080);
289289   //0173600
290   load9312prom(maincpu + 0173600,machine.region("devproms")->base() + input_port_read(machine,"DEVPROM4") * 0x0200,0x080);
290   load9312prom(maincpu + 0173600,machine.root_device().memregion("devproms")->base() + input_port_read(machine,"DEVPROM4") * 0x0200,0x080);
291291
292292}
293293
src/mess/drivers/pv1000.c
r14976r14977
5757
5858WRITE8_MEMBER( pv1000_state::pv1000_gfxram_w )
5959{
60   UINT8 *gfxram = machine().region( "gfxram" )->base();
60   UINT8 *gfxram = memregion( "gfxram" )->base();
6161
6262   gfxram[ offset ] = data;
6363   gfx_element_mark_dirty(machine().gfx[1], offset/32);
r14976r14977
170170
171171static DEVICE_IMAGE_LOAD( pv1000_cart )
172172{
173   UINT8 *cart = image.device().machine().region("cart")->base();
173   UINT8 *cart = image.device().machine().root_device().memregion("cart")->base();
174174   UINT32 size;
175175
176176   if (image.software_entry() == NULL)
src/mess/drivers/palmz22.c
r14976r14977
242242   palmz22_state *state = machine.driver_data<palmz22_state>();
243243   state->m_s3c2410 = machine.device( "s3c2410");
244244   state->m_nand = machine.device<nand_device>("nand");
245   state->m_nand->set_data_ptr( machine.region("nand")->base());
245   state->m_nand->set_data_ptr( state->memregion("nand")->base());
246246}
247247 
248248static MACHINE_RESET( palmz22 )
src/mess/drivers/a5105.c
r14976r14977
229229      switch (m_memsel[0])
230230      {
231231      case 0:
232         memory_set_bankptr(machine(), "bank1", m_rom_base);
232         membank("bank1")->set_base(m_rom_base);
233233         prog->install_read_bank(0x0000, 0x3fff, "bank1");
234234         prog->unmap_write(0x0000, 0x3fff);
235235         break;
236236      case 2:
237         memory_set_bankptr(machine(), "bank1", m_ram_base);
237         membank("bank1")->set_base(m_ram_base);
238238         prog->install_readwrite_bank(0x0000, 0x3fff, "bank1");
239239         break;
240240      default:
r14976r14977
250250      switch (m_memsel[1])
251251      {
252252      case 0:
253         memory_set_bankptr(machine(), "bank2", m_rom_base + 0x4000);
253         membank("bank2")->set_base(m_rom_base + 0x4000);
254254         prog->install_read_bank(0x4000, 0x7fff, "bank2");
255255         prog->unmap_write(0x4000, 0x4000);
256256         break;
257257      case 1:
258         memory_set_bankptr(machine(), "bank2", machine().region("k5651")->base());
258         membank("bank2")->set_base(machine().root_device().memregion("k5651")->base());
259259         prog->install_read_bank(0x4000, 0x7fff, "bank2");
260260         prog->unmap_write(0x4000, 0x4000);
261261         break;
262262      case 2:
263         memory_set_bankptr(machine(), "bank2", m_ram_base + 0x4000);
263         membank("bank2")->set_base(m_ram_base + 0x4000);
264264         prog->install_readwrite_bank(0x4000, 0x7fff, "bank2");
265265         break;
266266      default:
r14976r14977
276276      switch (m_memsel[2])
277277      {
278278      case 0:
279         memory_set_bankptr(machine(), "bank3", m_rom_base + 0x8000);
279         membank("bank3")->set_base(m_rom_base + 0x8000);
280280         prog->install_read_bank(0x8000, 0xbfff, "bank3");
281281         prog->unmap_write(0x8000, 0xbfff);
282282         break;
283283      case 2:
284         memory_set_bankptr(machine(), "bank3", m_ram_base + 0x8000);
284         membank("bank3")->set_base(m_ram_base + 0x8000);
285285         prog->install_readwrite_bank(0x8000, 0xbfff, "bank3");
286286         break;
287287      default:
r14976r14977
297297      switch (m_memsel[3])
298298      {
299299      case 2:
300         memory_set_bankptr(machine(), "bank4", m_ram_base + 0xc000);
300         membank("bank4")->set_base(m_ram_base + 0xc000);
301301         prog->install_readwrite_bank(0xc000, 0xffff, "bank4");
302302         break;
303303      default:
r14976r14977
460460   beep_set_frequency(m_beep, 500);
461461
462462   m_ram_base = (UINT8*)machine().device<ram_device>(RAM_TAG)->pointer();
463   m_rom_base = (UINT8*)machine().region("maincpu")->base();
463   m_rom_base = (UINT8*)machine().root_device().memregion("maincpu")->base();
464464
465   memory_set_bankptr(machine(), "bank1", m_rom_base);
466   memory_set_bankptr(machine(), "bank2", m_rom_base + 0x4000);
467   memory_set_bankptr(machine(), "bank3", m_ram_base);
468   memory_set_bankptr(machine(), "bank4", m_ram_base + 0x4000);
465   membank("bank1")->set_base(m_rom_base);
466   membank("bank2")->set_base(m_rom_base + 0x4000);
467   membank("bank3")->set_base(m_ram_base);
468   membank("bank4")->set_base(m_ram_base + 0x4000);
469469}
470470
471471
r14976r14977
503503VIDEO_START_MEMBER( a5105_state )
504504{
505505   // find memory regions
506   m_char_rom = machine().region("pcg")->base();
506   m_char_rom = memregion("pcg")->base();
507507}
508508
509509static UPD7220_INTERFACE( hgdc_intf )
src/mess/drivers/applix.c
r14976r14977
105105static MACHINE_RESET(applix)
106106{
107107   applix_state *state = machine.driver_data<applix_state>();
108   UINT8* RAM = machine.region("maincpu")->base();
108   UINT8* RAM = state->memregion("maincpu")->base();
109109   memcpy(state->m_base, RAM+0x500000, 16);
110110   machine.device("maincpu")->reset();
111111}
src/mess/drivers/nc.c
r14976r14977
344344
345345         mem_bank = mem_bank & state->m_membank_rom_mask;
346346
347         addr = (machine.region("maincpu")->base()+0x010000) + (mem_bank<<14);
347         addr = (state->memregion("maincpu")->base()+0x010000) + (mem_bank<<14);
348348
349         memory_set_bankptr(machine, bank1, addr);
349         state->membank(bank1)->set_base(addr);
350350
351351         space->nop_write((bank * 0x4000), (bank * 0x4000) + 0x3fff);
352352         LOG(("BANK %d: ROM %d\n",bank,mem_bank));
r14976r14977
362362
363363         addr = machine.device<ram_device>(RAM_TAG)->pointer() + (mem_bank<<14);
364364
365         memory_set_bankptr(machine, bank1, addr);
366         memory_set_bankptr(machine, bank5, addr);
365         state->membank(bank1)->set_base(addr);
366         state->membank(bank5)->set_base(addr);
367367
368368         space->install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]);
369369         LOG(("BANK %d: RAM\n",bank));
r14976r14977
381381            mem_bank = mem_bank & state->m_membank_card_ram_mask;
382382            addr = state->m_card_ram + (mem_bank<<14);
383383
384            memory_set_bankptr(machine, bank1, addr);
384            state->membank(bank1)->set_base(addr);
385385
386386            /* write enabled? */
387387            if (input_port_read(machine, "EXTRA") & 0x02)
388388            {
389389               /* yes */
390               memory_set_bankptr(machine, bank5, addr);
390               state->membank(bank5)->set_base(addr);
391391
392392               space->install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]);
393393            }
src/mess/drivers/bw12.c
r14976r14977
7777      break;
7878   }
7979
80   memory_set_bank(machine(), "bank1", m_bank);
80   membank("bank1")->set_entry(m_bank);
8181}
8282
8383void bw12_state::floppy_motor_off()
r14976r14977
405405void bw12_state::video_start()
406406{
407407   /* find memory regions */
408   m_char_rom = machine().region("chargen")->base();
408   m_char_rom = memregion("chargen")->base();
409409}
410410
411411/* UPD765 Interface */
r14976r14977
634634void bw12_state::machine_start()
635635{
636636   /* setup memory banking */
637   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base(), 0);
638   memory_configure_bank(machine(), "bank1", 1, 1, m_ram->pointer(), 0);
639   memory_configure_bank(machine(), "bank1", 2, 2, m_ram->pointer() + 0x10000, 0x8000);
637   membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base());
638   membank("bank1")->configure_entry(1, m_ram->pointer());
639   membank("bank1")->configure_entries(2, 2, m_ram->pointer() + 0x10000, 0x8000);
640640
641641   /* register for state saving */
642642   save_item(NAME(m_bank));
src/mess/drivers/pentagon.c
r14976r14977
2121      {
2222         state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ? 1 : 0;
2323         betadisk_disable(beta);
24         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
24         state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
2525      }
2626   } else if (((pc & 0xff00) == 0x3d00) && (state->m_ROMSelection==1))
2727   {
r14976r14977
3434   {
3535      if (state->m_ROMSelection == 3) {
3636         if (beta->started()) {
37            direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("beta:beta")->base());
38            memory_set_bankptr(machine, "bank1", machine.region("beta:beta")->base());
37            direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.root_device().memregion("beta:beta")->base());
38            state->membank("bank1")->set_base(machine.root_device().memregion("beta:beta")->base());
3939         }
4040      } else {
41         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
42         memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
41         direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine.root_device().memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
42         state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
4343      }
4444      return ~0;
4545   }
r14976r14977
5353   UINT8 *messram = machine.device<ram_device>(RAM_TAG)->pointer();
5454   state->m_screen_location = messram + ((state->m_port_7ffd_data & 8) ? (7<<14) : (5<<14));
5555
56   memory_set_bankptr(machine, "bank4", messram + ((state->m_port_7ffd_data & 0x07) * 0x4000));
56   state->membank("bank4")->set_base(messram + ((state->m_port_7ffd_data & 0x07) * 0x4000));
5757
5858   if (beta->started() && betadisk_is_active(beta) && !( state->m_port_7ffd_data & 0x10 ) )
5959   {
r14976r14977
6969      state->m_ROMSelection = ((state->m_port_7ffd_data>>4) & 0x01) ;
7070   }
7171   /* rom 0 is 128K rom, rom 1 is 48 BASIC */
72   memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
72   state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x010000 + (state->m_ROMSelection<<14));
7373}
7474
7575static WRITE8_HANDLER(pentagon_port_7ffd_w)
r14976r14977
119119   memset(messram,0,128*1024);
120120
121121   /* Bank 5 is always in 0x4000 - 0x7fff */
122   memory_set_bankptr(machine, "bank2", messram + (5<<14));
122   state->membank("bank2")->set_base(messram + (5<<14));
123123
124124   /* Bank 2 is always in 0x8000 - 0xbfff */
125   memory_set_bankptr(machine, "bank3", messram + (2<<14));
125   state->membank("bank3")->set_base(messram + (2<<14));
126126
127127   state->m_port_7ffd_data = 0;
128128   state->m_port_1ffd_data = -1;
src/mess/drivers/pk8000.c
r14976r14977
3838
3939static void pk8000_set_bank(running_machine &machine,UINT8 data)
4040{
41   UINT8 *rom = machine.region("maincpu")->base();
41   pk8000_state *state = machine.driver_data<pk8000_state>();
42   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
4243   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
4344   UINT8 block1 = data & 3;
4445   UINT8 block2 = (data >> 2) & 3;
r14976r14977
4748
4849   switch(block1) {
4950      case 0:
50            memory_set_bankptr(machine, "bank1", rom + 0x10000);
51            memory_set_bankptr(machine, "bank5", ram);
51            state->membank("bank1")->set_base(rom + 0x10000);
52            state->membank("bank5")->set_base(ram);
5253            break;
5354      case 1: break;
5455      case 2: break;
5556      case 3:
56            memory_set_bankptr(machine, "bank1", ram);
57            memory_set_bankptr(machine, "bank5", ram);
57            state->membank("bank1")->set_base(ram);
58            state->membank("bank5")->set_base(ram);
5859            break;
5960   }
6061
6162   switch(block2) {
6263      case 0:
63            memory_set_bankptr(machine, "bank2", rom + 0x14000);
64            memory_set_bankptr(machine, "bank6", ram + 0x4000);
64            state->membank("bank2")->set_base(rom + 0x14000);
65            state->membank("bank6")->set_base(ram + 0x4000);
6566            break;
6667      case 1: break;
6768      case 2: break;
6869      case 3:
69            memory_set_bankptr(machine, "bank2", ram + 0x4000);
70            memory_set_bankptr(machine, "bank6", ram + 0x4000);
70            state->membank("bank2")->set_base(ram + 0x4000);
71            state->membank("bank6")->set_base(ram + 0x4000);
7172            break;
7273   }
7374   switch(block3) {
7475      case 0:
75            memory_set_bankptr(machine, "bank3", rom + 0x18000);
76            memory_set_bankptr(machine, "bank7", ram + 0x8000);
76            state->membank("bank3")->set_base(rom + 0x18000);
77            state->membank("bank7")->set_base(ram + 0x8000);
7778            break;
7879      case 1: break;
7980      case 2: break;
8081      case 3:
81            memory_set_bankptr(machine, "bank3", ram + 0x8000);
82            memory_set_bankptr(machine, "bank7", ram + 0x8000);
82            state->membank("bank3")->set_base(ram + 0x8000);
83            state->membank("bank7")->set_base(ram + 0x8000);
8384            break;
8485   }
8586   switch(block4) {
8687      case 0:
87            memory_set_bankptr(machine, "bank4", rom + 0x1c000);
88            memory_set_bankptr(machine, "bank8", ram + 0xc000);
88            state->membank("bank4")->set_base(rom + 0x1c000);
89            state->membank("bank8")->set_base(ram + 0xc000);
8990            break;
9091      case 1: break;
9192      case 2: break;
9293      case 3:
93            memory_set_bankptr(machine, "bank4", ram + 0xc000);
94            memory_set_bankptr(machine, "bank8", ram + 0xc000);
94            state->membank("bank4")->set_base(ram + 0xc000);
95            state->membank("bank8")->set_base(ram + 0xc000);
9596            break;
9697   }
9798}
src/mess/drivers/prestige.c
r14976r14977
125125   switch (offset)
126126   {
127127   case 0:
128      memory_set_bank(machine(), "bank1", data & 0x3f);
128      membank("bank1")->set_entry(data & 0x3f);
129129      break;
130130
131131   case 1:
132132      if (m_bank[5] & 0x08)
133         memory_set_bank(machine(), "bank2", 0x40 + (data & 1));
133         membank("bank2")->set_entry(0x40 + (data & 1));
134134      else
135         memory_set_bank(machine(), "bank2", data & 0x3f);
135         membank("bank2")->set_entry(data & 0x3f);
136136      break;
137137
138138   case 2:
139139      if (m_bank[5] & 0x04)
140         memory_set_bank(machine(), "bank3", 0x40 + (data & 1));
140         membank("bank3")->set_entry(0x40 + (data & 1));
141141      else
142         memory_set_bank(machine(), "bank3", data & 0x3f);
142         membank("bank3")->set_entry(data & 0x3f);
143143      break;
144144
145145   case 3:
146146      if (m_bank[5] & 0x02)
147         memory_set_bank(machine(), "bank4", 0x04 + (data & 0x03));
147         membank("bank4")->set_entry(0x04 + (data & 0x03));
148148      else
149         memory_set_bank(machine(), "bank4", data & 0x03);
149         membank("bank4")->set_entry(data & 0x03);
150150      break;
151151
152152   case 4:
153      memory_set_bank(machine(), "bank5", data & 0x03);
153      membank("bank5")->set_entry(data & 0x03);
154154      break;
155155
156156   case 5:
r14976r14977
419419
420420   device_set_irq_callback(m_maincpu, prestige_int_ack);
421421
422   memory_configure_bank(machine(), "bank1", 0, 64, machine().region("maincpu")->base(), 0x4000);
423   memory_configure_bank(machine(), "bank2", 0, 64, machine().region("maincpu")->base(), 0x4000);
424   memory_configure_bank(machine(), "bank2", 64, 2, machine().region("cart")->base(), 0x4000);
425   memory_configure_bank(machine(), "bank3", 0, 64, machine().region("maincpu")->base(), 0x4000);
426   memory_configure_bank(machine(), "bank3", 64, 2, machine().region("cart")->base(), 0x4000);
427   memory_configure_bank(machine(), "bank4", 0, 4, ram, 0x2000);
428   memory_configure_bank(machine(), "bank4", 4, 4, machine().region("cart")->base(), 0x2000);
429   memory_configure_bank(machine(), "bank5", 0, 4, ram, 0x2000);
422   membank("bank1")->configure_entries(0, 64, memregion("maincpu")->base(), 0x4000);
423   membank("bank2")->configure_entries(0, 64, memregion("maincpu")->base(), 0x4000);
424   membank("bank2")->configure_entries(64, 2, memregion("cart")->base(), 0x4000);
425   membank("bank3")->configure_entries(0, 64, memregion("maincpu")->base(), 0x4000);
426   membank("bank3")->configure_entries(64, 2, memregion("cart")->base(), 0x4000);
427   membank("bank4")->configure_entries(0, 4, ram, 0x2000);
428   membank("bank4")->configure_entries(4, 4, memregion("cart")->base(), 0x2000);
429   membank("bank5")->configure_entries(0, 4, ram, 0x2000);
430430
431   memory_set_bank(machine(), "bank1", 0);
432   memory_set_bank(machine(), "bank2", 0);
433   memory_set_bank(machine(), "bank3", 0);
434   memory_set_bank(machine(), "bank4", 0);
435   memory_set_bank(machine(), "bank5", 0);
431   membank("bank1")->set_entry(0);
432   membank("bank2")->set_entry(0);
433   membank("bank3")->set_entry(0);
434   membank("bank4")->set_entry(0);
435   membank("bank5")->set_entry(0);
436436
437437   //pointer to the videoram
438438   m_vram = ram;
src/mess/drivers/okean240.c
r14976r14977
358358/* after the first 6 bytes have been read from ROM, switch the ram back in */
359359static TIMER_CALLBACK( okean240_boot )
360360{
361   memory_set_bank(machine, "boot", 0);
361   okean240_state *state = machine.driver_data<okean240_state>();
362   state->membank("boot")->set_entry(0);
362363}
363364
364365MACHINE_RESET_MEMBER( okean240_state )
365366{
366367   machine().scheduler().timer_set(attotime::from_usec(10), FUNC(okean240_boot));
367   memory_set_bank(machine(), "boot", 1);
368   membank("boot")->set_entry(1);
368369   m_term_data = 0;
369370   m_j = 0;
370371   m_scroll = 0;
r14976r14977
382383
383384DRIVER_INIT( okean240 )
384385{
385   UINT8 *RAM = machine.region("maincpu")->base();
386   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xe000);
386   okean240_state *state = machine.driver_data<okean240_state>();
387   UINT8 *RAM = state->memregion("maincpu")->base();
388   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000);
387389}
388390
389391VIDEO_START_MEMBER( okean240_state )
src/mess/drivers/ngp.c
r14976r14977
634634static DEVICE_START( ngp_cart )
635635{
636636   ngp_state *state = device->machine().driver_data<ngp_state>();
637   UINT8 *cart = device->machine().region("cart")->base();
637   UINT8 *cart = state->memregion("cart")->base();
638638
639639   state->m_flash_chip[0].present = 0;
640640   state->m_flash_chip[0].state = F_READ;
r14976r14977
661661         return IMAGE_INIT_FAIL;
662662      }
663663
664      if (image.fread( image.device().machine().region("cart")->base(), filesize) != filesize)
664      if (image.fread( image.device().machine().root_device().memregion("cart")->base(), filesize) != filesize)
665665      {
666666         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error loading file");
667667         return IMAGE_INIT_FAIL;
r14976r14977
670670   else
671671   {
672672      filesize = image.get_software_region_length("rom");
673      memcpy(image.device().machine().region("cart")->base(), image.get_software_region("rom"), filesize);
673      memcpy(image.device().machine().root_device().memregion("cart")->base(), image.get_software_region("rom"), filesize);
674674   }
675675
676   //printf("%2x%2x - %x - %x\n", (unsigned int) image.device().machine().region("cart")->u8(0x20), (unsigned int) image.device().machine().region("cart")->u8(0x21),
677   //        (unsigned int) image.device().machine().region("cart")->u8(0x22), (unsigned int) image.device().machine().region("cart")->u8(0x23));
676   //printf("%2x%2x - %x - %x\n", (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x20), (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x21),
677   //        (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x22), (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x23));
678678   state->m_flash_chip[0].manufacturer_id = 0x98;
679679   switch( filesize )
680680   {
src/mess/drivers/z88.c
r14976r14977
6868      m_maincpu->memory().space(AS_PROGRAM)->install_read_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
6969      m_maincpu->memory().space(AS_PROGRAM)->unmap_write(bank<<14, (bank<<14) + 0x3fff);
7070
71      memory_set_bank(machine(), bank_tag, page);
71      membank(bank_tag)->set_entry(page);
7272   }
7373   else if (page < 0x40)   // internal RAM
7474   {
r14976r14977
7878         m_maincpu->memory().space(AS_PROGRAM)->install_readwrite_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
7979
8080         // set the bank
81         memory_set_bank(machine(), bank_tag, page);
81         membank(bank_tag)->set_entry(page);
8282      }
8383      else
8484      {
r14976r14977
119119      else
120120         m_maincpu->memory().space(AS_PROGRAM)->unmap_write(0, 0x1fff);
121121
122      memory_set_bank(machine(), "bank1", rams & 1);
122      membank("bank1")->set_entry(rams & 1);
123123   }
124124}
125125
r14976r14977
245245
246246void z88_state::machine_start()
247247{
248   m_bios = (UINT8*)machine().region("bios")->base();
248   m_bios = (UINT8*)machine().root_device().memregion("bios")->base();
249249   m_ram_base = (UINT8*)m_ram->pointer();
250250
251251   // configure the memory banks
252   memory_configure_bank(machine(), "bank1", 0, 1, m_bios, 0);
253   memory_configure_bank(machine(), "bank1", 1, 1, m_ram_base,  0);
254   memory_configure_bank(machine(), "bank2", 0, 32, m_bios, 0x4000);
255   memory_configure_bank(machine(), "bank3", 0, 32, m_bios, 0x4000);
256   memory_configure_bank(machine(), "bank4", 0, 32, m_bios, 0x4000);
257   memory_configure_bank(machine(), "bank5", 0, 32, m_bios, 0x4000);
258   memory_configure_bank(machine(), "bank2", 32, m_ram->size()>>14, m_ram_base, 0x4000);
259   memory_configure_bank(machine(), "bank3", 32, m_ram->size()>>14, m_ram_base, 0x4000);
260   memory_configure_bank(machine(), "bank4", 32, m_ram->size()>>14, m_ram_base, 0x4000);
261   memory_configure_bank(machine(), "bank5", 32, m_ram->size()>>14, m_ram_base, 0x4000);
252   membank("bank1")->configure_entry(0, m_bios);
253   membank("bank1")->configure_entry(1, m_ram_base);
254   membank("bank2")->configure_entries(0, 32, m_bios, 0x4000);
255   membank("bank3")->configure_entries(0, 32, m_bios, 0x4000);
256   membank("bank4")->configure_entries(0, 32, m_bios, 0x4000);
257   membank("bank5")->configure_entries(0, 32, m_bios, 0x4000);
258   membank("bank2")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000);
259   membank("bank3")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000);
260   membank("bank4")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000);
261   membank("bank5")->configure_entries(32, m_ram->size()>>14, m_ram_base, 0x4000);
262262
263263   m_carts[1] = machine().device<z88cart_slot_device>("slot1");
264264   m_carts[2] = machine().device<z88cart_slot_device>("slot2");
src/mess/drivers/pce220.c
r14976r14977
310310
311311   m_bank_num = data;
312312
313   memory_set_bank(machine(), "bank3", bank3);
314   memory_set_bank(machine(), "bank4", bank4);
313   membank("bank3")->set_entry(bank3);
314   membank("bank4")->set_entry(bank4);
315315}
316316
317317WRITE8_MEMBER( pce220_state::ram_bank_w )
318318{
319319   UINT8 bank = BIT(data,2);
320320
321   memory_set_bank(machine(), "bank1", bank);
322   memory_set_bank(machine(), "bank2", bank);
321   membank("bank1")->set_entry(bank);
322   membank("bank2")->set_entry(bank);
323323}
324324
325325READ8_MEMBER( pce220_state::timer_r )
r14976r14977
339339   {
340340      address_space *space_prg = m_maincpu->memory().space(AS_PROGRAM);
341341      space_prg->install_write_bank(0x0000, 0x3fff, "bank1");
342      memory_set_bank(machine(), "bank1", 0);
342      membank("bank1")->set_entry(0);
343343   }
344344}
345345
r14976r14977
474474   if (data < 0x16)
475475   {
476476      space_prg->install_read_bank(0xc000, 0xffff, "bank4");
477      memory_set_bank(machine(), "bank4", data);
477      membank("bank4")->set_entry(data);
478478   }
479479   else
480480   {
r14976r14977
843843
844844void pce220_state::machine_start()
845845{
846   UINT8 *rom = machine().region("user1")->base();
846   UINT8 *rom = memregion("user1")->base();
847847   UINT8 *ram = m_ram->pointer();
848848
849   memory_configure_bank(machine(), "bank1", 0, 2, ram + 0x0000, 0x8000);
850   memory_configure_bank(machine(), "bank2", 0, 2, ram + 0x4000, 0x8000);
851   memory_configure_bank(machine(), "bank3", 0, 8, rom, 0x4000);
852   memory_configure_bank(machine(), "bank4", 0, 8, rom, 0x4000);
849   membank("bank1")->configure_entries(0, 2, ram + 0x0000, 0x8000);
850   membank("bank2")->configure_entries(0, 2, ram + 0x4000, 0x8000);
851   membank("bank3")->configure_entries(0, 8, rom, 0x4000);
852   membank("bank4")->configure_entries(0, 8, rom, 0x4000);
853853
854   m_vram = (UINT8*)machine().region("lcd_vram")->base();
854   m_vram = (UINT8*)machine().root_device().memregion("lcd_vram")->base();
855855
856856   machine().device<nvram_device>("nvram")->set_base(ram, m_ram->size());
857857}
858858
859859void pcg850v_state::machine_start()
860860{
861   UINT8 *rom = machine().region("user1")->base();
861   UINT8 *rom = memregion("user1")->base();
862862   UINT8 *ram = m_ram->pointer();
863863
864   memory_configure_bank(machine(), "bank1", 0, 2, ram + 0x0000, 0x8000);
865   memory_configure_bank(machine(), "bank2", 0, 2, ram + 0x4000, 0x8000);
866   memory_configure_bank(machine(), "bank3", 0, 22, rom, 0x4000);
867   memory_configure_bank(machine(), "bank4", 0, 22, rom, 0x4000);
864   membank("bank1")->configure_entries(0, 2, ram + 0x0000, 0x8000);
865   membank("bank2")->configure_entries(0, 2, ram + 0x4000, 0x8000);
866   membank("bank3")->configure_entries(0, 22, rom, 0x4000);
867   membank("bank4")->configure_entries(0, 22, rom, 0x4000);
868868
869   m_vram = (UINT8*)machine().region("lcd_vram")->base();
869   m_vram = (UINT8*)machine().root_device().memregion("lcd_vram")->base();
870870   machine().device<nvram_device>("nvram")->set_base(ram, m_ram->size());
871871}
872872
r14976r14977
876876   space->unmap_write(0x0000, 0x3fff);
877877
878878   // install the boot code into the first bank
879   memory_set_bankptr(machine(), "bank1", machine().region("user1")->base() + 0x0000);
879   membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + 0x0000);
880880
881881   m_lcd_index_row = 0;
882882   m_lcd_index_col = 0;
src/mess/drivers/sgi_ip2.c
r14976r14977
543543static DRIVER_INIT( sgi_ip2 )
544544{
545545   sgi_ip2_state *state = machine.driver_data<sgi_ip2_state>();
546   UINT32 *src = (UINT32*)(*machine.region("user1"));
546   UINT32 *src = (UINT32*)(*state->memregion("user1"));
547547   UINT32 *dst = state->m_mainram;
548548   memcpy(dst, src, 8);
549549
src/mess/drivers/pcw16.c
r14976r14977
423423      {
424424         /* lower 4 banks are write protected. Use the rom
425425            loaded */
426         mem_ptr = &machine.region("maincpu")->base()[0x010000];
426         mem_ptr = &state->memregion("maincpu")->base()[0x010000];
427427      }
428428      else
429429      {
r14976r14977
454454   state->m_mem_ptr[bank] = (char*)mem_ptr;
455455   sprintf(bank1,"bank%d",(bank+1));
456456   sprintf(bank2,"bank%d",(bank+5));
457   memory_set_bankptr(machine, bank1, mem_ptr);
458   memory_set_bankptr(machine, bank2, mem_ptr);
457   state->membank(bank1)->set_base(mem_ptr);
458   state->membank(bank2)->set_base(mem_ptr);
459459
460460   if ((bank_id & 0x080)==0)
461461   {
src/mess/drivers/ht68k.c
r14976r14977
7272static MACHINE_RESET(ht68k)
7373{
7474   ht68k_state *state = machine.driver_data<ht68k_state>();
75   UINT8* user1 = machine.region("user1")->base();
75   UINT8* user1 = state->memregion("user1")->base();
7676
7777   memcpy((UINT8*)state->m_p_ram.target(),user1,0x8000);
7878
src/mess/drivers/paso1600.c
r14976r14977
7575static VIDEO_START( paso1600 )
7676{
7777   paso1600_state *state = machine.driver_data<paso1600_state>();
78   state->m_p_chargen = machine.region("chargen")->base();
79   state->m_p_pcg = machine.region("pcg")->base();
78   state->m_p_chargen = machine.root_device().memregion("chargen")->base();
79   state->m_p_pcg = state->memregion("pcg")->base();
8080}
8181
8282static SCREEN_UPDATE_IND16( paso1600 )
src/mess/drivers/next.c
r14976r14977
11511151
11521152      /*
11531153
1154    UINT32 *rom = (UINT32 *)(machine.region("user1")->base());
1154    UINT32 *rom = (UINT32 *)(machine.root_device().memregion("user1")->base());
11551155    rom[0x3f48/4] = 0x2f017000; // memory test funcall
11561156    rom[0x3f4c/4] = 0x4e712400;
11571157    rom[0x00b8/4] = 0x001a4e71; // rom checksum
11581158    rom[0x00bc/4] = 0x4e714e71;
11591159
11601160v74
1161    UINT32 *rom = (UINT32 *)(machine.region("user1")->base());
1161    UINT32 *rom = (UINT32 *)(machine.root_device().memregion("user1")->base());
11621162    rom[0x329c/4] = 0x70004e71; // memory test funcall
11631163    rom[0x32a0/4] = 0x4e712400;
11641164    rom[0x03f8/4] = 0x001a4e71; // rom checksum
src/mess/drivers/prof80.c
r14976r14977
5050{
5151   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
5252   UINT8 *ram = m_ram->pointer();
53   UINT8 *rom = machine().region(Z80_TAG)->base();
53   UINT8 *rom = memregion(Z80_TAG)->base();
5454   int bank;
5555
5656   for (bank = 0; bank < 16; bank++)
src/mess/drivers/vt240.c
r14976r14977
199199/* Driver */
200200static DRIVER_INIT( vt240 )
201201{
202   UINT8 *ROM = machine.region("ipl")->base();
202   UINT8 *ROM = machine.root_device().memregion("ipl")->base();
203203
204204   /* patch T11 check */
205205   ROM[0x09d] = 0x00;
src/mess/drivers/pasogo.c
r14976r14977
177177
178178      if (log)
179179         logerror("%.5x vg230 %02x read %.2x\n",(int) cpu_get_pc(m_maincpu),vg230->index,data);
180      //    data=machine.region("maincpu")->base()[0x4000+offset];
180      //    data=machine.root_device().memregion("maincpu")->base()[0x4000+offset];
181181   }
182182   else
183183      data=vg230->index;
r14976r14977
191191
192192   if (offset&1)
193193   {
194      //  machine.region("maincpu")->base()[0x4000+offset]=data;
194      //  machine.root_device().memregion("maincpu")->base()[0x4000+offset]=data;
195195      vg230->data[vg230->index]=data;
196196      switch (vg230->index)
197197      {
r14976r14977
295295      case 0: /*external*/
296296      case 1: /*ram*/
297297         sprintf(bank,"bank%d",ems->index+1);
298         memory_set_bankptr( machine(), bank, machine().region("maincpu")->base() + (ems->mapper[ems->index].address&0xfffff) );
298         membank( bank )->set_base( memregion("maincpu")->base() + (ems->mapper[ems->index].address&0xfffff) );
299299         break;
300300      case 3: /* rom 1 */
301301      case 4: /* pc card a */
r14976r14977
304304         break;
305305      case 2:
306306         sprintf(bank,"bank%d",ems->index+1);
307         memory_set_bankptr( machine(),  bank, machine().region("user1")->base() + (ems->mapper[ems->index].address&0xfffff) );
307         membank( bank )->set_base( memregion("user1")->base() + (ems->mapper[ems->index].address&0xfffff) );
308308         break;
309309      }
310310      break;
r14976r14977
392392static SCREEN_UPDATE_IND16( pasogo )
393393{
394394   //static int width=-1,height=-1;
395   UINT8 *rom = screen.machine().region("maincpu")->base()+0xb8000;
395   UINT8 *rom = screen.machine().root_device().memregion("maincpu")->base()+0xb8000;
396396   static const UINT16 c[]={ 3, 0 };
397397   int x,y;
398398//  plot_box(bitmap, 0, 0, 64/*bitmap.width*/, bitmap.height, 0);
r14976r14977
547547   pasogo_state *state = machine.driver_data<pasogo_state>();
548548   vg230_init(machine);
549549   memset(&state->m_ems, 0, sizeof(state->m_ems));
550   memory_set_bankptr( machine, "bank27", machine.region("user1")->base() + 0x00000 );
551   memory_set_bankptr( machine, "bank28", machine.region("maincpu")->base() + 0xb8000/*?*/ );
550   state->membank( "bank27" )->set_base( machine.root_device().memregion("user1")->base() + 0x00000 );
551   state->membank( "bank28" )->set_base( state->memregion("maincpu")->base() + 0xb8000/*?*/ );
552552}
553553
554554//    YEAR   NAME    PARENT  COMPAT    MACHINE   INPUT     INIT      COMPANY  FULLNAME          FLAGS
src/mess/drivers/sys2900.c
r14976r14977
6767/* after the first 4 bytes have been read from ROM, switch the ram back in */
6868static TIMER_CALLBACK( sys2900_boot )
6969{
70   memory_set_bank(machine, "boot", 0);
70   sys2900_state *state = machine.driver_data<sys2900_state>();
71   state->membank("boot")->set_entry(0);
7172}
7273
7374static MACHINE_RESET(sys2900)
7475{
75   memory_set_bank(machine, "boot", 1);
76   sys2900_state *state = machine.driver_data<sys2900_state>();
77   state->membank("boot")->set_entry(1);
7678   machine.scheduler().timer_set(attotime::from_usec(5), FUNC(sys2900_boot));
7779}
7880
7981DRIVER_INIT( sys2900 )
8082{
81   UINT8 *RAM = machine.region("maincpu")->base();
82   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xf000);
83   sys2900_state *state = machine.driver_data<sys2900_state>();
84   UINT8 *RAM = state->memregion("maincpu")->base();
85   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf000);
8386}
8487
8588static VIDEO_START( sys2900 )
src/mess/drivers/lynx.c
r14976r14977
143143   device_t *cpu = image.device().machine().device("maincpu");
144144   address_space *space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
145145   UINT8 *data = NULL;
146   UINT8 *rom = image.device().machine().region("maincpu")->base();
146   UINT8 *rom = image.device().machine().root_device().memregion("maincpu")->base();
147147   UINT8 header[10]; // 80 08 dw Start dw Len B S 9 3
148148   UINT16 start, length;
149149   int i;
src/mess/drivers/aquarius.c
r14976r14977
185185
186186READ8_MEMBER(aquarius_state::cartridge_r)
187187{
188   UINT8 *rom = machine().region("maincpu")->base() + 0xc000;
188   UINT8 *rom = memregion("maincpu")->base() + 0xc000;
189189   return rom[offset] ^ m_scrambler;
190190}
191191
r14976r14977
213213
214214static DRIVER_INIT( aquarius )
215215{
216   aquarius_state *state = machine.driver_data<aquarius_state>();
216217   /* install expansion memory if available */
217218   if (machine.device<ram_device>(RAM_TAG)->size() > 0x1000)
218219   {
219220      address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
220221
221222      space->install_readwrite_bank(0x4000, 0x4000 + machine.device<ram_device>(RAM_TAG)->size() - 0x1000 - 1, "bank1");
222      memory_set_bankptr(machine, "bank1", machine.device<ram_device>(RAM_TAG)->pointer());
223      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
223224   }
224225}
225226
src/mess/drivers/cgenie.c
r14976r14977
710710                spt = pd_list[i].SPT / heads;
711711                dir_sector = pd_list[i].DDSL * pd_list[i].GATM * pd_list[i].GPL + pd_list[i].SPT;
712712                dir_length = pd_list[i].DDGA * pd_list[i].GPL;
713                memcpy(image.device().machine().region("maincpu")->base() + 0x5A71 + floppy_get_drive(image) * sizeof(PDRIVE), &pd_list[i], sizeof(PDRIVE));
713                memcpy(image.device().machine().root_device().memregion("maincpu")->base() + 0x5A71 + floppy_get_drive(image) * sizeof(PDRIVE), &pd_list[i], sizeof(PDRIVE));
714714                break;
715715            }
716716        }
src/mess/drivers/codata.c
r14976r14977
3939static MACHINE_RESET(codata)
4040{
4141   codata_state *state = machine.driver_data<codata_state>();
42   UINT8* RAM = machine.region("user1")->base();
42   UINT8* RAM = state->memregion("user1")->base();
4343   memcpy(state->m_p_base, RAM, 16);
4444   machine.device("maincpu")->reset();
4545}
src/mess/drivers/pasopia.c
r14976r14977
7474{
7575   pasopia_state *state = device->machine().driver_data<pasopia_state>();
7676   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
77   UINT8 *m_p_chargen = device->machine().region("chargen")->base();
77   UINT8 *m_p_chargen = state->memregion("chargen")->base();
7878   UINT8 chr,gfx,fg=7,bg=0; // colours need to be determined
7979   UINT16 mem,x;
8080   UINT32 *p = &bitmap.pix32(y);
r14976r14977
104104WRITE8_MEMBER( pasopia_state::pasopia_ctrl_w )
105105{
106106   m_ram_bank = BIT(data, 1);
107   memory_set_bank(machine(), "bank1", m_ram_bank);
107   membank("bank1")->set_entry(m_ram_bank);
108108}
109109
110110static ADDRESS_MAP_START(pasopia_map, AS_PROGRAM, 8, pasopia_state)
r14976r14977
136136static MACHINE_START(pasopia)
137137{
138138   pasopia_state *state = machine.driver_data<pasopia_state>();
139   state->m_p_vram = machine.region("vram")->base();
139   state->m_p_vram = state->memregion("vram")->base();
140140   state->m_hblank = 0;
141   memory_set_bank(machine, "bank1", 0);
142   memory_set_bank(machine, "bank2", 0);
141   state->membank("bank1")->set_entry(0);
142   state->membank("bank2")->set_entry(0);
143143}
144144
145145static MACHINE_RESET(pasopia)
r14976r14977
331331We preset all banks here, so that bankswitching will incur no speed penalty.
3323320000 indicates ROMs, 10000 indicates RAM.
333333*/
334
335   UINT8 *p_ram = machine.region("maincpu")->base();
336   memory_configure_bank(machine, "bank1", 0, 2, &p_ram[0x00000], 0x10000);
337   memory_configure_bank(machine, "bank2", 0, 1, &p_ram[0x10000], 0);
334   pasopia_state *state = machine.driver_data<pasopia_state>();
335   UINT8 *p_ram = state->memregion("maincpu")->base();
336   state->membank("bank1")->configure_entries(0, 2, &p_ram[0x00000], 0x10000);
337   state->membank("bank2")->configure_entry(0, &p_ram[0x10000]);
338338}
339339
340340static MACHINE_CONFIG_START( pasopia, pasopia_state )
src/mess/drivers/specpls3.c
r14976r14977
238238         ram_page = state->m_port_7ffd_data & 0x07;
239239         ram_data = messram + (ram_page<<14);
240240
241         memory_set_bankptr(machine, "bank4", ram_data);
241         state->membank("bank4")->set_base(ram_data);
242242
243243         logerror("RAM at 0xc000: %02x\n", ram_page);
244244
245245         /* Reset memory between 0x4000 - 0xbfff in case extended paging was being used */
246246         /* Bank 5 in 0x4000 - 0x7fff */
247         memory_set_bankptr(machine, "bank2", messram + (5 << 14));
247         state->membank("bank2")->set_base(messram + (5 << 14));
248248
249249         /* Bank 2 in 0x8000 - 0xbfff */
250         memory_set_bankptr(machine, "bank3", messram + (2 << 14));
250         state->membank("bank3")->set_base(messram + (2 << 14));
251251
252252
253253         ROMSelection = ((state->m_port_7ffd_data >> 4) & 0x01) |
r14976r14977
255255
256256         /* rom 0 is editor, rom 1 is syntax, rom 2 is DOS, rom 3 is 48 BASIC */
257257
258         ChosenROM = machine.region("maincpu")->base() + 0x010000 + (ROMSelection << 14);
258         ChosenROM = machine.root_device().memregion("maincpu")->base() + 0x010000 + (ROMSelection << 14);
259259
260         memory_set_bankptr(machine, "bank1", ChosenROM);
260         state->membank("bank1")->set_base(ChosenROM);
261261         space->unmap_write(0x0000, 0x3fff);
262262
263263         logerror("rom switch: %02x\n", ROMSelection);
r14976r14977
275275         memory_selection = &spectrum_plus3_memory_selections[(MemorySelection << 2)];
276276
277277         ram_data = messram + (memory_selection[0] << 14);
278         memory_set_bankptr(machine, "bank1", ram_data);
278         state->membank("bank1")->set_base(ram_data);
279279         /* allow writes to 0x0000-0x03fff */
280280         space->install_write_bank(0x0000, 0x3fff, "bank1");
281281
282282         ram_data = messram + (memory_selection[1] << 14);
283         memory_set_bankptr(machine, "bank2", ram_data);
283         state->membank("bank2")->set_base(ram_data);
284284
285285         ram_data = messram + (memory_selection[2] << 14);
286         memory_set_bankptr(machine, "bank3", ram_data);
286         state->membank("bank3")->set_base(ram_data);
287287
288288         ram_data = messram + (memory_selection[3] << 14);
289         memory_set_bankptr(machine, "bank4", ram_data);
289         state->membank("bank4")->set_base(ram_data);
290290
291291         logerror("extended memory paging: %02x\n", MemorySelection);
292292   }
src/mess/drivers/apexc.c
r14976r14977
9696   /* load RAM contents */
9797   m_writable = !is_readonly();
9898
99   fread( machine().region("maincpu")->base(), /*0x8000*/0x1000);
99   fread( memregion("maincpu")->base(), /*0x8000*/0x1000);
100100#ifdef LSB_FIRST
101101   {   /* fix endianness */
102102      UINT32 *RAM;
103103      int i;
104104
105      RAM = (UINT32 *)(*machine().region("maincpu"));
105      RAM = (UINT32 *)(*machine().root_device().memregion("maincpu"));
106106
107107      for (i=0; i < /*0x2000*/0x0400; i++)
108108         RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]);
r14976r14977
126126         UINT32 *RAM;
127127         int i;
128128
129         RAM = (UINT32 *)(*machine().region("maincpu"));
129         RAM = (UINT32 *)(*machine().root_device().memregion("maincpu"));
130130
131131         for (i=0; i < /*0x2000*/0x0400; i++)
132132            RAM[i] = BIG_ENDIANIZE_INT32(RAM[i]);
133133      }
134134#endif
135135      /* write */
136      fwrite(machine().region("maincpu")->base(), /*0x8000*/0x1000);
136      fwrite(machine().root_device().memregion("maincpu")->base(), /*0x8000*/0x1000);
137137   }
138138}
139139
r14976r14977
823823      0x00
824824   };
825825
826   dst = machine.region("gfx1")->base();
826   dst = machine.root_device().memregion("gfx1")->base();
827827
828828   memcpy(dst, fontdata6x8, apexcfontdata_size);
829829}
src/mess/drivers/x68k.c
r14976r14977
25692569       more or less do the same job */
25702570
25712571   int drive;
2572   UINT8* romdata = machine.region("user2")->base();
2572   UINT8* romdata = state->memregion("user2")->base();
25732573   attotime irq_time;
25742574
25752575   memset(machine.device<ram_device>(RAM_TAG)->pointer(),0,machine.device<ram_device>(RAM_TAG)->size());
r14976r14977
26402640   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
26412641   x68k_state *state = machine.driver_data<x68k_state>();
26422642   /*  Install RAM handlers  */
2643   state->m_spriteram = (UINT16*)(*machine.region("user1"));
2643   state->m_spriteram = (UINT16*)(*state->memregion("user1"));
26442644   space->install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_emptyram_r));
26452645   space->install_legacy_write_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_emptyram_w));
26462646   space->install_readwrite_bank(0x000000,machine.device<ram_device>(RAM_TAG)->size()-1,0xffffffff,0,"bank1");
2647   memory_set_bankptr(machine, "bank1",machine.device<ram_device>(RAM_TAG)->pointer());
2647   state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
26482648   space->install_legacy_read_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram_r));
26492649   space->install_legacy_write_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram_w));
2650   memory_set_bankptr(machine, "bank2",state->m_gvram);  // so that code in VRAM is executable - needed for Terra Cresta
2650   state->membank("bank2")->set_base(state->m_gvram);  // so that code in VRAM is executable - needed for Terra Cresta
26512651   space->install_legacy_read_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram_r));
26522652   space->install_legacy_write_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram_w));
2653   memory_set_bankptr(machine, "bank3",state->m_tvram);  // so that code in VRAM is executable - needed for Terra Cresta
2653   state->membank("bank3")->set_base(state->m_tvram);  // so that code in VRAM is executable - needed for Terra Cresta
26542654   space->install_legacy_read_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram_r));
26552655   space->install_legacy_write_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram_w));
2656   memory_set_bankptr(machine, "bank4",state->m_nvram);  // so that code in SRAM is executable, there is an option for booting from SRAM
2656   state->membank("bank4")->set_base(state->m_nvram);  // so that code in SRAM is executable, there is an option for booting from SRAM
26572657
26582658   // start keyboard timer
26592659   state->m_kb_timer->adjust(attotime::zero, 0, attotime::from_msec(5));  // every 5ms
r14976r14977
26712671   address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
26722672   x68030_state *state = machine.driver_data<x68030_state>();
26732673   /*  Install RAM handlers  */
2674   state->m_spriteram = (UINT16*)(*machine.region("user1"));
2674   state->m_spriteram = (UINT16*)(*state->memregion("user1"));
26752675   space->install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_rom0_r),0xffffffff);
26762676   space->install_legacy_write_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_rom0_w),0xffffffff);
26772677   space->install_readwrite_bank(0x000000,machine.device<ram_device>(RAM_TAG)->size()-1,0xffffffff,0,"bank1");
2678   memory_set_bankptr(machine, "bank1",machine.device<ram_device>(RAM_TAG)->pointer());
2678   state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
26792679   space->install_legacy_read_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram32_r));
26802680   space->install_legacy_write_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram32_w));
2681   memory_set_bankptr(machine, "bank2",state->m_gvram);  // so that code in VRAM is executable - needed for Terra Cresta
2681   state->membank("bank2")->set_base(state->m_gvram);  // so that code in VRAM is executable - needed for Terra Cresta
26822682   space->install_legacy_read_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram32_r));
26832683   space->install_legacy_write_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram32_w));
2684   memory_set_bankptr(machine, "bank3",state->m_tvram);  // so that code in VRAM is executable - needed for Terra Cresta
2684   state->membank("bank3")->set_base(state->m_tvram);  // so that code in VRAM is executable - needed for Terra Cresta
26852685   space->install_legacy_read_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram32_r));
26862686   space->install_legacy_write_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram32_w));
2687   memory_set_bankptr(machine, "bank4",state->m_nvram);  // so that code in SRAM is executable, there is an option for booting from SRAM
2687   state->membank("bank4")->set_base(state->m_nvram);  // so that code in SRAM is executable, there is an option for booting from SRAM
26882688
26892689   // start keyboard timer
26902690   state->m_kb_timer->adjust(attotime::zero, 0, attotime::from_msec(5));  // every 5ms
r14976r14977
27002700static DRIVER_INIT( x68000 )
27012701{
27022702   x68k_state *state = machine.driver_data<x68k_state>();
2703   unsigned char* rom = machine.region("maincpu")->base();
2704   unsigned char* user2 = machine.region("user2")->base();
2703   unsigned char* rom = machine.root_device().memregion("maincpu")->base();
2704   unsigned char* user2 = machine.root_device().memregion("user2")->base();
27052705   //FIXME
27062706//   state->m_gvram = auto_alloc_array(machine, UINT16, 0x080000/sizeof(UINT16));
27072707//   state->m_tvram = auto_alloc_array(machine, UINT16, 0x080000/sizeof(UINT16));
r14976r14977
27112711
27122712#ifdef USE_PREDEFINED_SRAM
27132713   {
2714      unsigned char* ramptr = machine.region("user3")->base();
2714      unsigned char* ramptr = state->memregion("user3")->base();
27152715      memcpy(state->m_sram,ramptr,0x4000);
27162716   }
27172717#endif
src/mess/drivers/pc2000.c
r14976r14977
7474
7575WRITE8_MEMBER( pc2000_state::rombank1_w )
7676{
77   memory_set_bank(machine(), "bank1", data & 0x0f);
77   membank("bank1")->set_entry(data & 0x0f);
7878}
7979
8080WRITE8_MEMBER( pc2000_state::rombank2_w )
8181{
8282   if (data == 0x80)
8383   {
84      memory_set_bank(machine(), "bank2", data & 0x10);   //cartridge
84      membank("bank2")->set_entry(data & 0x10);   //cartridge
8585   }
8686   else
8787   {
88      memory_set_bank(machine(), "bank2", data & 0x0f);
88      membank("bank2")->set_entry(data & 0x0f);
8989   }
9090}
9191
r14976r14977
280280
281281void pc2000_state::machine_start()
282282{
283   UINT8 *bios = machine().region("bios")->base();
284   UINT8 *cart = machine().region("cart")->base();
283   UINT8 *bios = memregion("bios")->base();
284   UINT8 *cart = memregion("cart")->base();
285285
286   memory_configure_bank(machine(), "bank1", 0, 0x10, bios, 0x4000);
287   memory_configure_bank(machine(), "bank2", 0, 0x10, bios, 0x4000);
288   memory_configure_bank(machine(), "bank2", 0x10, 1, cart, 0x4000);
286   membank("bank1")->configure_entries(0, 0x10, bios, 0x4000);
287   membank("bank2")->configure_entries(0, 0x10, bios, 0x4000);
288   membank("bank2")->configure_entry(0x10, cart);
289289}
290290
291291void pc2000_state::machine_reset()
292292{
293293   //set the initial bank
294   memory_set_bank(machine(), "bank1", 0);
295   memory_set_bank(machine(), "bank2", 0);
294   membank("bank1")->set_entry(0);
295   membank("bank2")->set_entry(0);
296296}
297297
298298static PALETTE_INIT( pc2000 )
src/mess/drivers/n64.c
r14976r14977
163163{
164164   int i, length;
165165   n64_periphs *periphs = image.device().machine().device<n64_periphs>("rcp");
166   UINT8 *cart = image.device().machine().region("user2")->base();
166   UINT8 *cart = image.device().machine().root_device().memregion("user2")->base();
167167
168168   if (image.software_entry() == NULL)
169169   {
r14976r14977
235235{
236236   MACHINE_START_CALL( n64 );
237237
238   UINT8 *ipl = machine.region("ddipl")->base();
238   UINT8 *ipl = machine.root_device().memregion("ddipl")->base();
239239
240240   for (int i = 0; i < 0x400000; i += 4)
241241   {
src/mess/drivers/beta.c
r14976r14977
122122   default:
123123      if (!m_eprom_oe && !m_eprom_ce)
124124      {
125         data = machine().region(EPROM_TAG)->base()[m_eprom_addr & 0x7ff];
125         data = memregion(EPROM_TAG)->base()[m_eprom_addr & 0x7ff];
126126         popmessage("EPROM read %04x = %02x\n", m_eprom_addr & 0x7ff, data);
127127      }
128128   }
r14976r14977
209209   if (BIT(data, 6) && (!BIT(m_old_data, 7) && BIT(data, 7)))
210210   {
211211      popmessage("EPROM write %04x = %02x\n", m_eprom_addr & 0x7ff, m_eprom_data);
212      machine().region(EPROM_TAG)->base()[m_eprom_addr & 0x7ff] &= m_eprom_data;
212      memregion(EPROM_TAG)->base()[m_eprom_addr & 0x7ff] &= m_eprom_data;
213213   }
214214
215215   m_old_data = data;
r14976r14977
228228
229229static DEVICE_IMAGE_UNLOAD( beta_eprom )
230230{
231   UINT8 *ptr = image.device().machine().region(EPROM_TAG)->base();
231   UINT8 *ptr = image.device().machine().root_device().memregion(EPROM_TAG)->base();
232232
233233   image.fwrite(ptr, 0x800);
234234}
src/mess/drivers/pc8001.c
r14976r14977
315315void pc8001_state::video_start()
316316{
317317   // find memory regions
318   m_char_rom = machine().region("chargen")->base();
318   m_char_rom = memregion("chargen")->base();
319319}
320320
321321/* uPD3301 Interface */
r14976r14977
463463   /* setup memory banking */
464464   UINT8 *ram = m_ram->pointer();
465465
466   memory_configure_bank(machine(), "bank1", 1, 1, machine().region("n80")->base(), 0);
466   membank("bank1")->configure_entry(1, memregion("n80")->base());
467467   program->install_read_bank(0x0000, 0x5fff, "bank1");
468468   program->unmap_write(0x0000, 0x5fff);
469469
470470   switch (m_ram->size())
471471   {
472472   case 16*1024:
473      memory_configure_bank(machine(), "bank3", 0, 1, ram, 0);
473      membank("bank3")->configure_entry(0, ram);
474474      program->unmap_readwrite(0x6000, 0xbfff);
475475      program->unmap_readwrite(0x8000, 0xbfff);
476476      program->install_readwrite_bank(0xc000, 0xffff, "bank3");
477477      break;
478478
479479   case 32*1024:
480      memory_configure_bank(machine(), "bank3", 0, 1, ram, 0);
480      membank("bank3")->configure_entry(0, ram);
481481      program->unmap_readwrite(0x6000, 0xbfff);
482482      program->install_readwrite_bank(0x8000, 0xffff, "bank3");
483483      break;
484484
485485   case 64*1024:
486      memory_configure_bank(machine(), "bank1", 0, 1, ram, 0);
487      memory_configure_bank(machine(), "bank2", 0, 1, ram + 0x6000, 0);
488      memory_configure_bank(machine(), "bank3", 0, 1, ram + 0x8000, 0);
486      membank("bank1")->configure_entry(0, ram);
487      membank("bank2")->configure_entry(0, ram + 0x6000);
488      membank("bank3")->configure_entry(0, ram + 0x8000);
489489      program->install_readwrite_bank(0x0000, 0x5fff, "bank1");
490490      program->install_readwrite_bank(0x6000, 0xbfff, "bank2");
491491      program->install_readwrite_bank(0x8000, 0xffff, "bank3");
492      memory_set_bank(machine(), "bank2", 0);
492      membank("bank2")->set_entry(0);
493493      break;
494494   }
495495
496   memory_set_bank(machine(), "bank1", 1);
497   memory_set_bank(machine(), "bank3", 0);
496   membank("bank1")->set_entry(1);
497   membank("bank3")->set_entry(0);
498498
499499   /* register for state saving */
500500   save_item(NAME(m_width80));
src/mess/drivers/px4.c
r14976r14977
493493/* helper function to map rom capsules */
494494static void install_rom_capsule(address_space *space, int size, const char *region)
495495{
496   px4_state *px4 = space->machine().driver_data<px4_state>();
496   px4_state *state = space->machine().driver_data<px4_state>();
497497
498498   /* ram, part 1 */
499499   space->install_readwrite_bank(0x0000, 0xdfff - size, "bank1");
500   memory_set_bankptr(space->machine(), "bank1", px4->m_ram->pointer());
500   state->membank("bank1")->set_base(state->m_ram->pointer());
501501
502502   /* actual rom data, part 1 */
503503   space->install_read_bank(0xe000 - size, 0xffff - size, "bank2");
504504   space->nop_write(0xe000 - size, 0xffff - size);
505   memory_set_bankptr(space->machine(), "bank2", space->machine().region(region)->base() + (size - 0x2000));
505   state->membank("bank2")->set_base(space->machine().root_device().memregion(region)->base() + (size - 0x2000));
506506
507507   /* rom data, part 2 */
508508   if (size != 0x2000)
509509   {
510510      space->install_read_bank(0x10000 - size, 0xdfff, "bank3");
511511      space->nop_write(0x10000 - size, 0xdfff);
512      memory_set_bankptr(space->machine(), "bank3", space->machine().region(region)->base());
512      state->membank("bank3")->set_base(space->machine().root_device().memregion(region)->base());
513513   }
514514
515515   /* ram, continued */
516516   space->install_readwrite_bank(0xe000, 0xffff, "bank4");
517   memory_set_bankptr(space->machine(), "bank4", px4->m_ram->pointer() + 0xe000);
517   state->membank("bank4")->set_base(state->m_ram->pointer() + 0xe000);
518518}
519519
520520/* bank register */
r14976r14977
534534      /* system bank */
535535      space_program->install_read_bank(0x0000, 0x7fff, "bank1");
536536      space_program->nop_write(0x0000, 0x7fff);
537      memory_set_bankptr(machine(), "bank1", machine().region("os")->base());
537      membank("bank1")->set_base(machine().root_device().memregion("os")->base());
538538      space_program->install_readwrite_bank(0x8000, 0xffff, "bank2");
539      memory_set_bankptr(machine(), "bank2", m_ram->pointer() + 0x8000);
539      membank("bank2")->set_base(m_ram->pointer() + 0x8000);
540540      break;
541541
542542   case 0x04:
543543      /* memory */
544544      space_program->install_readwrite_bank(0x0000, 0xffff, "bank1");
545      memory_set_bankptr(machine(), "bank1", m_ram->pointer());
545      membank("bank1")->set_base(m_ram->pointer());
546546      break;
547547
548548   case 0x08: install_rom_capsule(space_program, 0x2000, "capsule1"); break;
r14976r14977
993993   else if (m_ramdisk_address < 0x40000)
994994   {
995995      /* read from rom */
996      ret = machine().region("ramdisk")->base()[m_ramdisk_address];
996      ret = memregion("ramdisk")->base()[m_ramdisk_address];
997997   }
998998
999999   m_ramdisk_address = (m_ramdisk_address & 0xffff00) | ((m_ramdisk_address & 0xff) + 1);
r14976r14977
10711071
10721072static DRIVER_INIT( px4 )
10731073{
1074   px4_state *px4 = machine.driver_data<px4_state>();
1074   px4_state *state = machine.driver_data<px4_state>();
10751075
10761076   /* find devices */
1077   px4->m_ram = machine.device<ram_device>(RAM_TAG);
1077   state->m_ram = machine.device<ram_device>(RAM_TAG);
10781078
10791079   /* init 7508 */
1080   px4->m_one_sec_int_enabled = TRUE;
1081   px4->m_key_int_enabled = TRUE;
1082   px4->m_alarm_int_enabled = TRUE;
1080   state->m_one_sec_int_enabled = TRUE;
1081   state->m_key_int_enabled = TRUE;
1082   state->m_alarm_int_enabled = TRUE;
10831083
10841084   /* art */
1085   px4->m_receive_timer = machine.scheduler().timer_alloc(FUNC(receive_data));
1086   px4->m_transmit_timer = machine.scheduler().timer_alloc(FUNC(transmit_data));
1085   state->m_receive_timer = machine.scheduler().timer_alloc(FUNC(receive_data));
1086   state->m_transmit_timer = machine.scheduler().timer_alloc(FUNC(transmit_data));
10871087
10881088   /* printer */
1089   px4->m_centronics = machine.device<centronics_device>("centronics");
1089   state->m_centronics = machine.device<centronics_device>("centronics");
10901090
10911091   /* external cassette or barcode reader */
1092   px4->m_ext_cas_timer = machine.scheduler().timer_alloc(FUNC(ext_cassette_read));
1093   px4->m_ext_cas = machine.device<cassette_image_device>("extcas");
1094   px4->m_ear_last_state = 0;
1092   state->m_ext_cas_timer = machine.scheduler().timer_alloc(FUNC(ext_cassette_read));
1093   state->m_ext_cas = machine.device<cassette_image_device>("extcas");
1094   state->m_ear_last_state = 0;
10951095
10961096   /* external devices */
1097   px4->m_sio_device = machine.device("floppy");
1098   px4->m_rs232c_device = NULL;
1097   state->m_sio_device = machine.device("floppy");
1098   state->m_rs232c_device = NULL;
10991099
11001100   /* map os rom and last half of memory */
1101   memory_set_bankptr(machine, "bank1", machine.region("os")->base());
1102   memory_set_bankptr(machine, "bank2", px4->m_ram->pointer() + 0x8000);
1101   state->membank("bank1")->set_base(machine.root_device().memregion("os")->base());
1102   state->membank("bank2")->set_base(state->m_ram->pointer() + 0x8000);
11031103}
11041104
11051105static DRIVER_INIT( px4p )
src/mess/drivers/mmodular.c
r14976r14977
995995// patch LCD delay loop on the 68030 machines until waitstates and/or opcode timings are fixed in MAME core
996996// patches gen32 gen32_41 gen32_oc lond030
997997
998   UINT8 *rom = machine.region("maincpu")->base();
998   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
999999
10001000   if(rom[0x870] == 0x0c && rom[0x871] == 0x78) {
10011001      if (!strcmp(machine.system().name,"gen32_oc")) {
src/mess/drivers/alesis.c
r14976r14977
144144static DRIVER_INIT( hr16 )
145145{
146146   int i;
147   UINT8 *ROM = machine.region("maincpu")->base();
148   UINT8 *orig = machine.region("user1")->base();
147   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
148   UINT8 *orig = machine.root_device().memregion("user1")->base();
149149   for (i = 0; i < 0x8000; i++)
150150   {
151151      ROM[BITSWAP16(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i];
src/mess/drivers/pc8801.c
r14976r14977
324324{
325325   int x,y,xi;
326326   UINT32 count;
327   UINT8 *gvram = machine.region("gvram")->base();
327   UINT8 *gvram = machine.root_device().memregion("gvram")->base();
328328
329329   count = 0;
330330
r14976r14977
356356   pc8801_state *state = machine.driver_data<pc8801_state>();
357357   int x,y,xi;
358358   UINT32 count;
359   UINT8 *gvram = machine.region("gvram")->base();
359   UINT8 *gvram = state->memregion("gvram")->base();
360360
361361   count = 0;
362362
r14976r14977
436436static UINT8 extract_text_attribute(running_machine &machine,UINT32 address,int x)
437437{
438438   pc8801_state *state = machine.driver_data<pc8801_state>();
439   UINT8 *vram = machine.region("wram")->base();
439   UINT8 *vram = state->memregion("wram")->base();
440440   int i;
441441   int fifo_size;
442442
r14976r14977
466466{
467467   pc8801_state *state = machine.driver_data<pc8801_state>();
468468   int xi,yi;
469   UINT8 *vram = machine.region("wram")->base();
469   UINT8 *vram = state->memregion("wram")->base();
470470   UINT8 is_cursor;
471471   UINT8 y_height;
472472
r14976r14977
499499            else
500500            {
501501               UINT8 char_data;
502               UINT8 *gfx_rom = machine.region("gfx1")->base();
502               UINT8 *gfx_rom = machine.root_device().memregion("gfx1")->base();
503503
504504               if(yi >= 8 || secret)
505505                  char_data = 0;
r14976r14977
692692READ8_MEMBER(pc8801_state::pc8801_alu_r)
693693{
694694   int i;
695   UINT8 *gvram = machine().region("gvram")->base();
695   UINT8 *gvram = memregion("gvram")->base();
696696   UINT8 b,r,g;
697697
698698   /* store data to ALU regs */
r14976r14977
712712WRITE8_MEMBER(pc8801_state::pc8801_alu_w)
713713{
714714   int i;
715   UINT8 *gvram = machine().region("gvram")->base();
715   UINT8 *gvram = memregion("gvram")->base();
716716
717717   switch(m_alu_ctrl2 & 0x30) // alu write mode
718718   {
r14976r14977
755755
756756READ8_MEMBER(pc8801_state::pc8801_wram_r)
757757{
758   UINT8 *work_ram = machine().region("wram")->base();
758   UINT8 *work_ram = memregion("wram")->base();
759759
760760   return work_ram[offset];
761761}
762762
763763WRITE8_MEMBER(pc8801_state::pc8801_wram_w)
764764{
765   UINT8 *work_ram = machine().region("wram")->base();
765   UINT8 *work_ram = memregion("wram")->base();
766766
767767   work_ram[offset] = data;
768768}
769769
770770READ8_MEMBER(pc8801_state::pc8801_ext_wram_r)
771771{
772   UINT8 *ext_work_ram = machine().region("ewram")->base();
772   UINT8 *ext_work_ram = memregion("ewram")->base();
773773
774774   /* TODO: check max range here */
775775
r14976r14977
778778
779779WRITE8_MEMBER(pc8801_state::pc8801_ext_wram_w)
780780{
781   UINT8 *ext_work_ram = machine().region("ewram")->base();
781   UINT8 *ext_work_ram = memregion("ewram")->base();
782782
783783   /* TODO: check max range here */
784784
r14976r14977
787787
788788READ8_MEMBER(pc8801_state::pc8801_nbasic_rom_r)
789789{
790   UINT8 *n80_rom = machine().region("n80rom")->base();
790   UINT8 *n80_rom = memregion("n80rom")->base();
791791
792792   return n80_rom[offset];
793793}
794794
795795READ8_MEMBER(pc8801_state::pc8801_n88basic_rom_r)
796796{
797   UINT8 *n88_rom = machine().region("n88rom")->base();
797   UINT8 *n88_rom = memregion("n88rom")->base();
798798
799799   return n88_rom[offset];
800800}
801801
802802READ8_MEMBER(pc8801_state::pc8801_gvram_r)
803803{
804   UINT8 *gvram = machine().region("gvram")->base();
804   UINT8 *gvram = memregion("gvram")->base();
805805
806806   return gvram[offset];
807807}
808808
809809WRITE8_MEMBER(pc8801_state::pc8801_gvram_w)
810810{
811   UINT8 *gvram = machine().region("gvram")->base();
811   UINT8 *gvram = memregion("gvram")->base();
812812
813813   gvram[offset] = data;
814814}
815815
816816READ8_MEMBER(pc8801_state::pc8801_high_wram_r)
817817{
818   UINT8 *hi_work_ram = machine().region("hiwram")->base();
818   UINT8 *hi_work_ram = memregion("hiwram")->base();
819819
820820   return hi_work_ram[offset];
821821}
822822
823823WRITE8_MEMBER(pc8801_state::pc8801_high_wram_w)
824824{
825   UINT8 *hi_work_ram = machine().region("hiwram")->base();
825   UINT8 *hi_work_ram = memregion("hiwram")->base();
826826
827827   hi_work_ram[offset] = data;
828828}
829829
830830READ8_MEMBER(pc8801_state::pc8801ma_dic_r)
831831{
832   UINT8 *dic_rom = machine().region("dictionary")->base();
832   UINT8 *dic_rom = memregion("dictionary")->base();
833833
834834   return dic_rom[offset];
835835}
836836
837837READ8_MEMBER(pc8801_state::pc8801_cdbios_rom_r)
838838{
839   UINT8 *cdrom_bios = machine().region("cdrom")->base();
839   UINT8 *cdrom_bios = memregion("cdrom")->base();
840840
841841   return cdrom_bios[offset];
842842}
r14976r14977
13351335
13361336READ8_MEMBER(pc8801_state::pc8801_kanji_r)
13371337{
1338   UINT8 *knj_rom = machine().region("kanji")->base();
1338   UINT8 *knj_rom = memregion("kanji")->base();
13391339   if((offset & 2) == 0)
13401340      return knj_rom[m_knj_addr[0]*2+((offset & 1) ^ 1)];
13411341
r14976r14977
13501350
13511351READ8_MEMBER(pc8801_state::pc8801_kanji_lv2_r)
13521352{
1353   UINT8 *knj_rom = machine().region("kanji")->base() + 0x20000;
1353   UINT8 *knj_rom = memregion("kanji")->base() + 0x20000;
13541354   if((offset & 2) == 0)
13551355      return knj_rom[m_knj_addr[1]*2+((offset & 1) ^ 1)];
13561356
src/mess/drivers/socrates.c
r14976r14977
127127static void socrates_set_rom_bank( running_machine &machine )
128128{
129129   socrates_state *state = machine.driver_data<socrates_state>();
130   memory_set_bankptr( machine, "bank1", machine.region("maincpu")->base() + ( state->m_rom_bank * 0x4000 ));
130   state->membank( "bank1" )->set_base( state->memregion("maincpu")->base() + ( state->m_rom_bank * 0x4000 ));
131131}
132132
133133static void socrates_set_ram_bank( running_machine &machine )
134134{
135135   socrates_state *state = machine.driver_data<socrates_state>();
136   memory_set_bankptr( machine, "bank2", machine.region("vram")->base() + ( (state->m_ram_bank&0x3) * 0x4000 )); // window 0
137   memory_set_bankptr( machine, "bank3", machine.region("vram")->base() + ( ((state->m_ram_bank&0xC)>>2) * 0x4000 )); // window 1
136   state->membank( "bank2" )->set_base( machine.root_device().memregion("vram")->base() + ( (state->m_ram_bank&0x3) * 0x4000 )); // window 0
137   state->membank( "bank3" )->set_base( state->memregion("vram")->base() + ( ((state->m_ram_bank&0xC)>>2) * 0x4000 )); // window 1
138138}
139139
140140static void socrates_update_kb( running_machine &machine )
r14976r14977
220220
221221static DRIVER_INIT( socrates )
222222{
223   UINT8 *gfx = machine.region("vram")->base();
223   UINT8 *gfx = machine.root_device().memregion("vram")->base();
224224   int i;
225225    /* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */
226226    for (i = 0; i < 0x10000; i++)
r14976r14977
275275// bit 2 - speech chip bit 2
276276// bit 1 - speech chip bit 1
277277// bit 0 - speech chip bit 0
278UINT8 *speechromint = machine().region("speechint")->base();
279UINT8 *speechromext = machine().region("speechext")->base();
278UINT8 *speechromint = memregion("speechint")->base();
279UINT8 *speechromext = memregion("speechext")->base();
280280   int temp = 0;
281281   temp |= (m_speech_running)?0x80:0;
282282   temp |= 0x40; // unknown
r14976r14977
588588static VIDEO_START( socrates )
589589{
590590   socrates_state *state = machine.driver_data<socrates_state>();
591   state->m_videoram = machine.region("vram")->base();
591   state->m_videoram = state->memregion("vram")->base();
592592   state->m_scroll_offset = 0;
593593}
594594
src/mess/drivers/univac.c
r14976r14977
4949
5050READ8_MEMBER( univac_state::uts20_vram_r )
5151{
52   UINT8 *RAM = machine().region("maincpu")->base();
52   UINT8 *RAM = memregion("maincpu")->base();
5353   return RAM[offset | ((m_screen_num) ? 0xe000 : 0xc000)];
5454}
5555
5656WRITE8_MEMBER( univac_state::uts20_vram_w )
5757{
58   UINT8 *RAM = machine().region("maincpu")->base();
58   UINT8 *RAM = memregion("maincpu")->base();
5959   RAM[offset | ((m_screen_num) ? 0xe000 : 0xc000)] = data;
6060}
6161
r14976r14977
8686
8787VIDEO_START_MEMBER(univac_state)
8888{
89   m_p_chargen = machine().region("chargen")->base();
89   m_p_chargen = memregion("chargen")->base();
9090}
9191
9292SCREEN_UPDATE16_MEMBER(univac_state)
9393{
9494   UINT8 y,ra,chr,gfx;
9595   UINT16 sy=0,ma=0,x;
96   UINT8 *videoram = machine().region("maincpu")->base()+((m_screen_num) ? 0xe000 : 0xc000);
96   UINT8 *videoram = memregion("maincpu")->base()+((m_screen_num) ? 0xe000 : 0xc000);
9797
9898   m_framecnt++;
9999
src/mess/drivers/pc4.c
r14976r14977
4444WRITE8_MEMBER( pc4_state::bank_w )
4545{
4646   //printf("set bank %x\n", data);
47   memory_set_bank(machine(), "rombank", data&0x07);
47   membank("rombank")->set_entry(data&0x07);
4848}
4949
5050WRITE8_MEMBER( pc4_state::beep_w )
r14976r14977
179179
180180void pc4_state::machine_start()
181181{
182   UINT8* rom_base = (UINT8 *)machine().region("maincpu")->base();
182   UINT8* rom_base = (UINT8 *)machine().root_device().memregion("maincpu")->base();
183183
184   memory_configure_bank(machine(), "rombank", 0, 8, rom_base, 0x4000);
185   memory_set_bank(machine(), "rombank", 0);
184   membank("rombank")->configure_entries(0, 8, rom_base, 0x4000);
185   membank("rombank")->set_entry(0);
186186
187187   m_busy_timer = timer_alloc(BUSY_TIMER);
188188   m_blink_timer = timer_alloc(BLINKING_TIMER);
src/mess/drivers/timex.c
r14976r14977
235235   UINT8 timex_cart_chunks = timex_cart->chunks;
236236   UINT8 *DOCK = timex_cart->data;
237237
238   ExROM = machine.region("maincpu")->base() + 0x014000;
238   ExROM = state->memregion("maincpu")->base() + 0x014000;
239239
240240   if (state->m_port_f4_data & 0x01)
241241   {
r14976r14977
243243      {
244244            space->install_read_bank(0x0000, 0x1fff, "bank1");
245245            space->unmap_write(0x0000, 0x1fff);
246            memory_set_bankptr(machine, "bank1", ExROM);
246            state->membank("bank1")->set_base(ExROM);
247247            logerror("0000-1fff EXROM\n");
248248      }
249249      else
250250      {
251251         if (timex_cart_type == TIMEX_CART_DOCK)
252252         {
253            memory_set_bankptr(machine, "bank1", DOCK);
253            state->membank("bank1")->set_base(DOCK);
254254            space->install_read_bank(0x0000, 0x1fff, "bank1");
255255            if (timex_cart_chunks&0x01)
256256               space->install_write_bank(0x0000, 0x1fff, "bank9");
r14976r14977
269269   }
270270   else
271271   {
272      ChosenROM = machine.region("maincpu")->base() + 0x010000;
273      memory_set_bankptr(machine, "bank1", ChosenROM);
272      ChosenROM = machine.root_device().memregion("maincpu")->base() + 0x010000;
273      state->membank("bank1")->set_base(ChosenROM);
274274      space->install_read_bank(0x0000, 0x1fff, "bank1");
275275      space->unmap_write(0x0000, 0x1fff);
276276      logerror("0000-1fff HOME\n");
r14976r14977
280280   {
281281      if (state->m_port_ff_data & 0x80)
282282      {
283         memory_set_bankptr(machine, "bank2", ExROM);
283         state->membank("bank2")->set_base(ExROM);
284284         space->install_read_bank(0x2000, 0x3fff, "bank2");
285285         space->unmap_write(0x2000, 0x3fff);
286286         logerror("2000-3fff EXROM\n");
r14976r14977
289289      {
290290         if (timex_cart_type == TIMEX_CART_DOCK)
291291         {
292            memory_set_bankptr(machine, "bank2", DOCK+0x2000);
292            state->membank("bank2")->set_base(DOCK+0x2000);
293293            space->install_read_bank(0x2000, 0x3fff, "bank2");
294294            if (timex_cart_chunks&0x02)
295295               space->install_write_bank(0x2000, 0x3fff, "bank10");
r14976r14977
307307   }
308308   else
309309   {
310      ChosenROM = machine.region("maincpu")->base() + 0x012000;
311      memory_set_bankptr(machine, "bank2", ChosenROM);
310      ChosenROM = machine.root_device().memregion("maincpu")->base() + 0x012000;
311      state->membank("bank2")->set_base(ChosenROM);
312312      space->install_read_bank(0x2000, 0x3fff, "bank2");
313313      space->unmap_write(0x2000, 0x3fff);
314314      logerror("2000-3fff HOME\n");
r14976r14977
318318   {
319319      if (state->m_port_ff_data & 0x80)
320320      {
321         memory_set_bankptr(machine, "bank3", ExROM);
321         state->membank("bank3")->set_base(ExROM);
322322         space->install_read_bank(0x4000, 0x5fff, "bank3");
323323         space->unmap_write(0x4000, 0x5fff);
324324         logerror("4000-5fff EXROM\n");
r14976r14977
327327      {
328328         if (timex_cart_type == TIMEX_CART_DOCK)
329329         {
330            memory_set_bankptr(machine, "bank3", DOCK+0x4000);
330            state->membank("bank3")->set_base(DOCK+0x4000);
331331            space->install_read_bank(0x4000, 0x5fff, "bank3");
332332            if (timex_cart_chunks&0x04)
333333               space->install_write_bank(0x4000, 0x5fff, "bank11");
r14976r14977
344344   }
345345   else
346346   {
347      memory_set_bankptr(machine, "bank3", messram);
348      memory_set_bankptr(machine, "bank11", messram);
347      state->membank("bank3")->set_base(messram);
348      state->membank("bank11")->set_base(messram);
349349      space->install_read_bank(0x4000, 0x5fff, "bank3");
350350      space->install_write_bank(0x4000, 0x5fff, "bank11");
351351      logerror("4000-5fff RAM\n");
r14976r14977
355355   {
356356      if (state->m_port_ff_data & 0x80)
357357      {
358         memory_set_bankptr(machine, "bank4", ExROM);
358         state->membank("bank4")->set_base(ExROM);
359359         space->install_read_bank(0x6000, 0x7fff, "bank4");
360360         space->unmap_write(0x6000, 0x7fff);
361361         logerror("6000-7fff EXROM\n");
r14976r14977
364364      {
365365            if (timex_cart_type == TIMEX_CART_DOCK)
366366            {
367               memory_set_bankptr(machine, "bank4", DOCK+0x6000);
367               state->membank("bank4")->set_base(DOCK+0x6000);
368368               space->install_read_bank(0x6000, 0x7fff, "bank4");
369369               if (timex_cart_chunks&0x08)
370370                  space->install_write_bank(0x6000, 0x7fff, "bank12");
r14976r14977
381381   }
382382   else
383383   {
384      memory_set_bankptr(machine, "bank4", messram + 0x2000);
385      memory_set_bankptr(machine, "bank12", messram + 0x2000);
384      state->membank("bank4")->set_base(messram + 0x2000);
385      state->membank("bank12")->set_base(messram + 0x2000);
386386      space->install_read_bank(0x6000, 0x7fff, "bank4");
387387      space->install_write_bank(0x6000, 0x7fff, "bank12");
388388      logerror("6000-7fff RAM\n");
r14976r14977
392392   {
393393      if (state->m_port_ff_data & 0x80)
394394      {
395         memory_set_bankptr(machine, "bank5", ExROM);
395         state->membank("bank5")->set_base(ExROM);
396396         space->install_read_bank(0x8000, 0x9fff, "bank5");
397397         space->unmap_write(0x8000, 0x9fff);
398398         logerror("8000-9fff EXROM\n");
r14976r14977
401401      {
402402         if (timex_cart_type == TIMEX_CART_DOCK)
403403         {
404            memory_set_bankptr(machine, "bank5", DOCK+0x8000);
404            state->membank("bank5")->set_base(DOCK+0x8000);
405405            space->install_read_bank(0x8000, 0x9fff,"bank5");
406406            if (timex_cart_chunks&0x10)
407407               space->install_write_bank(0x8000, 0x9fff,"bank13");
r14976r14977
418418   }
419419   else
420420   {
421      memory_set_bankptr(machine, "bank5", messram + 0x4000);
422      memory_set_bankptr(machine, "bank13", messram + 0x4000);
421      state->membank("bank5")->set_base(messram + 0x4000);
422      state->membank("bank13")->set_base(messram + 0x4000);
423423      space->install_read_bank(0x8000, 0x9fff,"bank5");
424424      space->install_write_bank(0x8000, 0x9fff,"bank13");
425425      logerror("8000-9fff RAM\n");
r14976r14977
429429   {
430430      if (state->m_port_ff_data & 0x80)
431431      {
432         memory_set_bankptr(machine, "bank6", ExROM);
432         state->membank("bank6")->set_base(ExROM);
433433         space->install_read_bank(0xa000, 0xbfff, "bank6");
434434         space->unmap_write(0xa000, 0xbfff);
435435         logerror("a000-bfff EXROM\n");
r14976r14977
438438      {
439439         if (timex_cart_type == TIMEX_CART_DOCK)
440440         {
441            memory_set_bankptr(machine, "bank6", DOCK+0xa000);
441            state->membank("bank6")->set_base(DOCK+0xa000);
442442            space->install_read_bank(0xa000, 0xbfff, "bank6");
443443            if (timex_cart_chunks&0x20)
444444               space->install_write_bank(0xa000, 0xbfff, "bank14");
r14976r14977
456456   }
457457   else
458458   {
459      memory_set_bankptr(machine, "bank6", messram + 0x6000);
460      memory_set_bankptr(machine, "bank14", messram + 0x6000);
459      state->membank("bank6")->set_base(messram + 0x6000);
460      state->membank("bank14")->set_base(messram + 0x6000);
461461      space->install_read_bank(0xa000, 0xbfff, "bank6");
462462      space->install_write_bank(0xa000, 0xbfff, "bank14");
463463      logerror("a000-bfff RAM\n");
r14976r14977
467467   {
468468      if (state->m_port_ff_data & 0x80)
469469      {
470         memory_set_bankptr(machine, "bank7", ExROM);
470         state->membank("bank7")->set_base(ExROM);
471471         space->install_read_bank(0xc000, 0xdfff, "bank7");
472472         space->unmap_write(0xc000, 0xdfff);
473473         logerror("c000-dfff EXROM\n");
r14976r14977
476476      {
477477         if (timex_cart_type == TIMEX_CART_DOCK)
478478         {
479            memory_set_bankptr(machine, "bank7", DOCK+0xc000);
479            state->membank("bank7")->set_base(DOCK+0xc000);
480480            space->install_read_bank(0xc000, 0xdfff, "bank7");
481481            if (timex_cart_chunks&0x40)
482482               space->install_write_bank(0xc000, 0xdfff, "bank15");
r14976r14977
493493   }
494494   else
495495   {
496      memory_set_bankptr(machine, "bank7", messram + 0x8000);
497      memory_set_bankptr(machine, "bank15", messram + 0x8000);
496      state->membank("bank7")->set_base(messram + 0x8000);
497      state->membank("bank15")->set_base(messram + 0x8000);
498498      space->install_read_bank(0xc000, 0xdfff, "bank7");
499499      space->install_write_bank(0xc000, 0xdfff, "bank15");
500500      logerror("c000-dfff RAM\n");
r14976r14977
504504   {
505505      if (state->m_port_ff_data & 0x80)
506506      {
507         memory_set_bankptr(machine, "bank8", ExROM);
507         state->membank("bank8")->set_base(ExROM);
508508         space->install_read_bank(0xe000, 0xffff, "bank8");
509509         space->unmap_write(0xe000, 0xffff);
510510         logerror("e000-ffff EXROM\n");
r14976r14977
513513      {
514514         if (timex_cart_type == TIMEX_CART_DOCK)
515515         {
516            memory_set_bankptr(machine, "bank8", DOCK+0xe000);
516            state->membank("bank8")->set_base(DOCK+0xe000);
517517            space->install_read_bank(0xe000, 0xffff, "bank8");
518518            if (timex_cart_chunks&0x80)
519519               space->install_write_bank(0xe000, 0xffff, "bank16");
r14976r14977
530530   }
531531   else
532532   {
533      memory_set_bankptr(machine, "bank8", messram + 0xa000);
534      memory_set_bankptr(machine, "bank16", messram + 0xa000);
533      state->membank("bank8")->set_base(messram + 0xa000);
534      state->membank("bank16")->set_base(messram + 0xa000);
535535      space->install_read_bank(0xe000, 0xffff, "bank8");
536536      space->install_write_bank(0xe000, 0xffff, "bank16");
537537      logerror("e000-ffff RAM\n");
r14976r14977
603603   spectrum_state *state = machine.driver_data<spectrum_state>();
604604   UINT8 *messram = machine.device<ram_device>(RAM_TAG)->pointer();
605605
606   memory_set_bankptr(machine, "bank1", messram);
607   memory_set_bankptr(machine, "bank2", messram);
606   state->membank("bank1")->set_base(messram);
607   state->membank("bank2")->set_base(messram);
608608   state->m_port_ff_data = 0;
609609   state->m_port_f4_data = -1;
610610   MACHINE_RESET_CALL(spectrum);
src/mess/drivers/bw2.c
r14976r14977
115115      break;
116116   }
117117
118   memory_set_bank(machine(), "bank1", m_bank);
118   membank("bank1")->set_entry(m_bank);
119119}
120120
121121void bw2_state::ramcard_bankswitch(UINT8 data)
r14976r14977
195195      break;
196196   }
197197
198   memory_set_bank(machine(), "bank1", m_bank);
198   membank("bank1")->set_entry(m_bank);
199199}
200200
201201WRITE8_MEMBER( bw2_state::ramcard_bank_w )
r14976r14977
214214      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
215215   }
216216
217   memory_configure_bank(machine(), "bank1", BANK_RAMCARD_RAM, 1, m_ramcard_ram + bank_offset, 0);
218   memory_set_bank(machine(), "bank1", m_bank);
217   membank("bank1")->configure_entry(BANK_RAMCARD_RAM, m_ramcard_ram + bank_offset);
218   membank("bank1")->set_entry(m_bank);
219219}
220220
221221/* Floppy */
r14976r14977
622622   m_ramcard_ram = auto_alloc_array(machine(), UINT8, BW2_RAMCARD_SIZE);
623623
624624   /* memory banking */
625   memory_configure_bank(machine(), "bank1", BANK_RAM1, 1, m_ram->pointer(), 0);
626   memory_configure_bank(machine(), "bank1", BANK_VRAM, 1, m_video_ram, 0);
627   memory_configure_bank(machine(), "bank1", BANK_ROM, 1, machine().region("ic1")->base(), 0);
625   membank("bank1")->configure_entry(BANK_RAM1, m_ram->pointer());
626   membank("bank1")->configure_entry(BANK_VRAM, m_video_ram);
627   membank("bank1")->configure_entry(BANK_ROM, memregion("ic1")->base());
628628
629629   /* register for state saving */
630630   save_item(NAME(m_kb_row));
r14976r14977
644644   {
645645      // RAMCARD installed
646646
647      memory_configure_bank(machine(), "bank1", BANK_RAMCARD_ROM, 1, machine().region("ramcard")->base(), 0);
648      memory_configure_bank(machine(), "bank1", BANK_RAM3, 2, m_ram->pointer() + 0x8000, 0x8000);
649      memory_configure_bank(machine(), "bank1", BANK_RAMCARD_RAM, 1, m_ramcard_ram, 0);
650      memory_configure_bank(machine(), "bank1", BANK_RAM6, 1, m_ram->pointer() + 0x18000, 0);
647      membank("bank1")->configure_entry(BANK_RAMCARD_ROM, memregion("ramcard")->base());
648      membank("bank1")->configure_entries(BANK_RAM3, 2, m_ram->pointer() + 0x8000, 0x8000);
649      membank("bank1")->configure_entry(BANK_RAMCARD_RAM, m_ramcard_ram);
650      membank("bank1")->configure_entry(BANK_RAM6, m_ram->pointer() + 0x18000);
651651
652652      io->install_write_handler(0x30, 0x30, 0, 0x0f, write8_delegate(FUNC(bw2_state::ramcard_bank_w), this), 0);
653653   }
r14976r14977
655655   {
656656      // no RAMCARD
657657
658      memory_configure_bank(machine(), "bank1", BANK_RAM2, 5, m_ram->pointer() + 0x8000, 0x8000);
658      membank("bank1")->configure_entries(BANK_RAM2, 5, m_ram->pointer() + 0x8000, 0x8000);
659659
660660      io->unmap_write(0x30, 0x30, 0, 0x0f);
661661   }
662662
663   memory_set_bank(machine(), "bank1", BANK_ROM);
663   membank("bank1")->set_entry(BANK_ROM);
664664}
665665
666666static MACHINE_CONFIG_START( bw2, bw2_state )
src/mess/drivers/jr200.c
r14976r14977
154154               }
155155               else // tile mode
156156               {
157                  gfx_data = screen.machine().region(attr & 0x40 ? "pcg" : "gfx_ram")->base();
157                  gfx_data = screen.machine().root_device().memregion(attr & 0x40 ? "pcg" : "gfx_ram")->base();
158158
159159                  pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1) ? (attr & 0x7) : ((attr & 0x38) >> 3);
160160               }
r14976r14977
170170
171171READ8_MEMBER(jr200_state::jr200_pcg_1_r)
172172{
173   UINT8 *pcg = machine().region("pcg")->base();
173   UINT8 *pcg = memregion("pcg")->base();
174174
175175   return pcg[offset+0x000];
176176}
177177
178178READ8_MEMBER(jr200_state::jr200_pcg_2_r)
179179{
180   UINT8 *pcg = machine().region("pcg")->base();
180   UINT8 *pcg = memregion("pcg")->base();
181181
182182   return pcg[offset+0x400];
183183}
184184
185185WRITE8_MEMBER(jr200_state::jr200_pcg_1_w)
186186{
187   UINT8 *pcg = machine().region("pcg")->base();
187   UINT8 *pcg = memregion("pcg")->base();
188188
189189   pcg[offset+0x000] = data;
190190   gfx_element_mark_dirty(machine().gfx[1], (offset+0x000) >> 3);
r14976r14977
192192
193193WRITE8_MEMBER(jr200_state::jr200_pcg_2_w)
194194{
195   UINT8 *pcg = machine().region("pcg")->base();
195   UINT8 *pcg = memregion("pcg")->base();
196196
197197   pcg[offset+0x400] = data;
198198   gfx_element_mark_dirty(machine().gfx[1], (offset+0x400) >> 3);
r14976r14977
200200
201201READ8_MEMBER(jr200_state::jr200_bios_char_r)
202202{
203   UINT8 *gfx = machine().region("gfx_ram")->base();
203   UINT8 *gfx = memregion("gfx_ram")->base();
204204
205205   return gfx[offset];
206206}
r14976r14977
208208
209209WRITE8_MEMBER(jr200_state::jr200_bios_char_w)
210210{
211//  UINT8 *gfx = machine().region("gfx_ram")->base();
211//  UINT8 *gfx = memregion("gfx_ram")->base();
212212
213213   /* TODO: writing is presumably controlled by an I/O bit */
214214//  gfx[offset] = data;
r14976r14977
487487static MACHINE_RESET(jr200)
488488{
489489   jr200_state *state = machine.driver_data<jr200_state>();
490   UINT8 *gfx_rom = machine.region("gfx_rom")->base();
491   UINT8 *gfx_ram = machine.region("gfx_ram")->base();
490   UINT8 *gfx_rom = machine.root_device().memregion("gfx_rom")->base();
491   UINT8 *gfx_ram = state->memregion("gfx_ram")->base();
492492   int i;
493493   memset(state->m_mn1271_ram,0,0x800);
494494
src/mess/drivers/enterp.c
r14976r14977
3333
3434static void enterprise_update_memory_page(address_space *space, offs_t page, int index)
3535{
36   ep_state *state = space->machine().driver_data<ep_state>();
3637   int start = (page - 1) * 0x4000;
3738   int end = (page - 1) * 0x4000 + 0x3fff;
3839   char page_num[10];
r14976r14977
4647   case 0x03:
4748      space->install_read_bank(start, end, page_num);
4849      space->nop_write(start, end);
49      memory_set_bankptr(space->machine(), page_num, space->machine().region("exos")->base() + (index * 0x4000));
50      state->membank(page_num)->set_base(space->machine().root_device().memregion("exos")->base() + (index * 0x4000));
5051      break;
5152
5253   case 0x04:
r14976r14977
5556   case 0x07:
5657      space->install_read_bank(start, end, page_num);
5758      space->nop_write(start, end);
58      memory_set_bankptr(space->machine(), page_num, space->machine().region("cartridges")->base() + ((index - 0x04) * 0x4000));
59      state->membank(page_num)->set_base(space->machine().root_device().memregion("cartridges")->base() + ((index - 0x04) * 0x4000));
5960      break;
6061
6162   case 0x20:
6263   case 0x21:
6364      space->install_read_bank(start, end, page_num);
6465      space->nop_write(start, end);
65      memory_set_bankptr(space->machine(), page_num, space->machine().region("exdos")->base() + ((index - 0x20) * 0x4000));
66      state->membank(page_num)->set_base(space->machine().root_device().memregion("exdos")->base() + ((index - 0x20) * 0x4000));
6667      break;
6768
6869   case 0xf8:
r14976r14977
7374      if (space->machine().device<ram_device>(RAM_TAG)->size() == 128*1024)
7475      {
7576         space->install_readwrite_bank(start, end, page_num);
76         memory_set_bankptr(space->machine(), page_num, space->machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xf4) * 0x4000);
77         state->membank(page_num)->set_base(space->machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xf4) * 0x4000);
7778      }
7879      else
7980      {
r14976r14977
8788   case 0xff:
8889      /* basic 64k ram */
8990      space->install_readwrite_bank(start, end, page_num);
90      memory_set_bankptr(space->machine(), page_num, space->machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xfc) * 0x4000);
91      state->membank(page_num)->set_base(space->machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xfc) * 0x4000);
9192      break;
9293
9394   default:
src/mess/drivers/portfoli.c
r14976r14977
443443   if (BIT(data, 0))
444444   {
445445      // system ROM
446      UINT8 *rom = machine().region(M80C88A_TAG)->base();
446      UINT8 *rom = memregion(M80C88A_TAG)->base();
447447      program->install_rom(0xc0000, 0xdffff, rom);
448448   }
449449   else
r14976r14977
658658static READ8_DEVICE_HANDLER( hd61830_rd_r )
659659{
660660   UINT16 address = ((offset & 0xff) << 3) | ((offset >> 12) & 0x07);
661   UINT8 data = device->machine().region(HD61830_TAG)->base()[address];
661   UINT8 data = device->machine().root_device().memregion(HD61830_TAG)->base()[address];
662662
663663   return data;
664664}
src/mess/drivers/mc10.c
r14976r14977
247247
248248static DRIVER_INIT( mc10 )
249249{
250   mc10_state *mc10 = machine.driver_data<mc10_state>();
250   mc10_state *state = machine.driver_data<mc10_state>();
251251   address_space *prg = machine.device("maincpu")->memory().space(AS_PROGRAM);
252252
253253   /* initialize keyboard strobe */
254   mc10->m_keyboard_strobe = 0x00;
254   state->m_keyboard_strobe = 0x00;
255255
256256   /* initialize memory */
257   mc10->m_ram_base = mc10->m_ram->pointer();
258   mc10->m_ram_size = mc10->m_ram->size();
259   mc10->m_pr_state = PRINTER_WAIT;
257   state->m_ram_base = state->m_ram->pointer();
258   state->m_ram_size = state->m_ram->size();
259   state->m_pr_state = PRINTER_WAIT;
260260
261   memory_set_bankptr(machine, "bank1", mc10->m_ram_base);
261   state->membank("bank1")->set_base(state->m_ram_base);
262262
263263   /* initialize memory expansion */
264   if (mc10->m_ram_size == 20*1024)
265      memory_set_bankptr(machine, "bank2", mc10->m_ram_base + 0x1000);
266   else if (mc10->m_ram_size == 24*1024)
267      memory_set_bankptr(machine, "bank2", mc10->m_ram_base + 0x2000);
268   else  if (mc10->m_ram_size != 32*1024)      //ensure that is not alice90
264   if (state->m_ram_size == 20*1024)
265      state->membank("bank2")->set_base(state->m_ram_base + 0x1000);
266   else if (state->m_ram_size == 24*1024)
267      state->membank("bank2")->set_base(state->m_ram_base + 0x2000);
268   else  if (state->m_ram_size != 32*1024)      //ensure that is not alice90
269269      prg->nop_readwrite(0x5000, 0x8fff);
270270
271271   /* register for state saving */
272   state_save_register_global(machine, mc10->m_keyboard_strobe);
272   state_save_register_global(machine, state->m_keyboard_strobe);
273273
274274   //for alice32 force port4 DDR to 0xff at startup
275275   if (!strcmp(machine.system().name, "alice32") || !strcmp(machine.system().name, "alice90"))
src/mess/drivers/atom.c
r14976r14977
125125{
126126   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
127127
128   UINT8 *eprom = machine().region(EXTROM_TAG)->base() + (m_eprom << 12);
128   UINT8 *eprom = memregion(EXTROM_TAG)->base() + (m_eprom << 12);
129129
130130   program->install_rom(0xa000, 0xafff, eprom);
131131}
r14976r14977
750750
751751   /* With the following, we mirror the cart in the whole memory region */
752752   for (i = 0; i < mirror; i++)
753      memcpy(image.device().machine().region(this_cart->region)->base() + this_cart->offset + i * size, temp_copy, size);
753      memcpy(image.device().machine().root_device().memregion(this_cart->region)->base() + this_cart->offset + i * size, temp_copy, size);
754754
755755   auto_free(image.device().machine(), temp_copy);
756756
src/mess/drivers/dim68k.c
r14976r14977
202202
203203MACHINE_RESET_MEMBER(dim68k_state)
204204{
205   UINT8* ROM = machine().region("bootrom")->base();
205   UINT8* ROM = memregion("bootrom")->base();
206206
207207   memcpy((UINT8*)m_ram.target(), ROM, 0x2000);
208208
r14976r14977
211211
212212VIDEO_START_MEMBER( dim68k_state )
213213{
214   m_p_chargen = machine().region("chargen")->base();
214   m_p_chargen = memregion("chargen")->base();
215215}
216216
217217// Text-only; graphics isn't emulated yet. Need to find out if hardware cursor is used.
src/mess/drivers/coleco.c
r14976r14977
269269
270270   m_maincpu->set_input_line_vector(INPUT_LINE_IRQ0, 0xff);
271271
272   memset(&machine().region(Z80_TAG)->base()[0x6000], 0xff, 0x400);   // initialize RAM
272   memset(&machine().root_device().memregion(Z80_TAG)->base()[0x6000], 0xff, 0x400);   // initialize RAM
273273}
274274
275275//static int coleco_cart_verify(const UINT8 *cartdata, size_t size)
r14976r14977
287287
288288static DEVICE_IMAGE_LOAD( czz50_cart )
289289{
290   UINT8 *ptr = image.device().machine().region(Z80_TAG)->base() + 0x8000;
290   UINT8 *ptr = image.device().machine().root_device().memregion(Z80_TAG)->base() + 0x8000;
291291   UINT32 size;
292292
293293   if (image.software_entry() == NULL)
src/mess/drivers/lc80.c
r14976r14977
300300   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
301301
302302   /* setup memory banking */
303   memory_configure_bank(machine(), "bank1", 0, 1, machine().region(Z80_TAG)->base(), 0); // TODO
304   memory_configure_bank(machine(), "bank1", 1, 1, machine().region(Z80_TAG)->base(), 0);
305   memory_set_bank(machine(), "bank1", 1);
303   membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base()); // TODO
304   membank("bank1")->configure_entry(1, memregion(Z80_TAG)->base());
305   membank("bank1")->set_entry(1);
306306
307   memory_configure_bank(machine(), "bank2", 0, 1, machine().region(Z80_TAG)->base() + 0x800, 0); // TODO
308   memory_configure_bank(machine(), "bank2", 1, 1, machine().region(Z80_TAG)->base() + 0x800, 0);
309   memory_set_bank(machine(), "bank2", 1);
307   membank("bank2")->configure_entry(0, memregion(Z80_TAG)->base() + 0x800); // TODO
308   membank("bank2")->configure_entry(1, memregion(Z80_TAG)->base() + 0x800);
309   membank("bank2")->set_entry(1);
310310
311   memory_configure_bank(machine(), "bank3", 0, 1, machine().region(Z80_TAG)->base() + 0x1000, 0); // TODO
312   memory_configure_bank(machine(), "bank3", 1, 1, machine().region(Z80_TAG)->base() + 0x1000, 0);
313   memory_set_bank(machine(), "bank3", 1);
311   membank("bank3")->configure_entry(0, memregion(Z80_TAG)->base() + 0x1000); // TODO
312   membank("bank3")->configure_entry(1, memregion(Z80_TAG)->base() + 0x1000);
313   membank("bank3")->set_entry(1);
314314
315   memory_configure_bank(machine(), "bank4", 0, 1, machine().region(Z80_TAG)->base() + 0x2000, 0);
316   memory_set_bank(machine(), "bank4", 0);
315   membank("bank4")->configure_entry(0, memregion(Z80_TAG)->base() + 0x2000);
316   membank("bank4")->set_entry(0);
317317
318318   program->install_readwrite_bank(0x0000, 0x07ff, "bank1");
319319   program->install_readwrite_bank(0x0800, 0x0fff, "bank2");
src/mess/drivers/rx78.c
r14976r14977
114114
115115SCREEN_UPDATE16_MEMBER( rx78_state )
116116{
117   UINT8 *vram = machine().region("vram")->base();
117   UINT8 *vram = memregion("vram")->base();
118118   int x,y,count;
119119
120120   bitmap.fill(16, cliprect);
r14976r14977
192192
193193READ8_MEMBER( rx78_state::rx78_vram_r )
194194{
195   UINT8 *vram = machine().region("vram")->base();
195   UINT8 *vram = memregion("vram")->base();
196196
197197   if(m_vram_read_bank == 0 || m_vram_read_bank > 6)
198198      return 0xff;
r14976r14977
202202
203203WRITE8_MEMBER( rx78_state::rx78_vram_w )
204204{
205   UINT8 *vram = machine().region("vram")->base();
205   UINT8 *vram = memregion("vram")->base();
206206
207207   if(m_vram_write_bank & 0x01) { vram[offset + 0 * 0x2000] = data; }
208208   if(m_vram_write_bank & 0x02) { vram[offset + 1 * 0x2000] = data; }
r14976r14977
416416
417417static DEVICE_IMAGE_LOAD( rx78_cart )
418418{
419   UINT8 *cart = image.device().machine().region("cart_img")->base();
419   UINT8 *cart = image.device().machine().root_device().memregion("cart_img")->base();
420420   UINT32 size;
421421
422422   if (image.software_entry() == NULL)
src/mess/drivers/supracan.c
r14976r14977
400400   supracan_state *state = machine.driver_data<supracan_state>();
401401   state->m_sprite_final_bitmap.allocate(1024, 1024, BITMAP_FORMAT_IND16);
402402
403   state->m_vram = (UINT16*)(*machine.region("ram_gfx"));
404   state->m_vram_swapped = (UINT16*)(*machine.region("ram_gfx2"));
405   state->m_vram_addr_swapped = (UINT8*)(*machine.region("ram_gfx3")); // hack for 1bpp layer at startup
403   state->m_vram = (UINT16*)(*machine.root_device().memregion("ram_gfx"));
404   state->m_vram_swapped = (UINT16*)(*machine.root_device().memregion("ram_gfx2"));
405   state->m_vram_addr_swapped = (UINT8*)(*state->memregion("ram_gfx3")); // hack for 1bpp layer at startup
406406
407407   state->m_tilemap_sizes[0][0] = tilemap_create(machine, get_supracan_tilemap0_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
408408   state->m_tilemap_sizes[0][1] = tilemap_create(machine, get_supracan_tilemap0_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
r14976r14977
17351735
17361736static DEVICE_IMAGE_LOAD( supracan_cart )
17371737{
1738   UINT8 *cart = image.device().machine().region("cart")->base();
1738   UINT8 *cart = image.device().machine().root_device().memregion("cart")->base();
17391739   UINT32 size = 0;
17401740
17411741   if (image.software_entry() == NULL)
src/mess/drivers/channelf.c
r14976r14977
230230         return IMAGE_INIT_FAIL;
231231      }
232232
233      if (image.fread( image.device().machine().region("maincpu")->base() + 0x0800, size) != size)
233      if (image.fread( image.device().machine().root_device().memregion("maincpu")->base() + 0x0800, size) != size)
234234      {
235235         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
236236         return IMAGE_INIT_FAIL;
r14976r14977
240240   else
241241   {
242242      size = image.get_software_region_length("rom");
243      memcpy(image.device().machine().region("maincpu")->base() + 0x0800, image.get_software_region("rom"), size);
243      memcpy(image.device().machine().root_device().memregion("maincpu")->base() + 0x0800, image.get_software_region("rom"), size);
244244   }
245245
246246   return IMAGE_INIT_PASS;
src/mess/drivers/hec2hrp.c
r14976r14977
308308/*****************************************************************************/
309309{
310310   hec2hrp_state *state = machine.driver_data<hec2hrp_state>();
311   UINT8 *RAM   = machine.region("maincpu"  )->base();   // pointer to mess ram
311   UINT8 *RAM   = machine.root_device().memregion("maincpu"  )->base();   // pointer to mess ram
312312   //Patch rom possible !
313313   //RAMD2[0xff6b] = 0x0ff; // force verbose mode hector !
314314
315315   // Memory install for bank switching
316   memory_configure_bank(machine, "bank1", HECTOR_BANK_PROG , 1, &RAM[0xc000]   , 0); // Mess ram
317   memory_configure_bank(machine, "bank1", HECTOR_BANK_VIDEO, 1, state->m_hector_videoram_hrx, 0); // Video ram
316   state->membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000]   ); // Mess ram
317   state->membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, state->m_hector_videoram_hrx); // Video ram
318318
319319   // Set bank HECTOR_BANK_PROG as basic bank
320   memory_set_bank(machine, "bank1", HECTOR_BANK_PROG);
320   state->membank("bank1")->set_entry(HECTOR_BANK_PROG);
321321
322322/******************************************************SPECIFIQUE MX ***************************/
323   memory_configure_bank(machine, "bank2", HECTORMX_BANK_PAGE0 , 1, &RAM[0x0000]                    , 0); // Mess ram
324   memory_configure_bank(machine, "bank2", HECTORMX_BANK_PAGE1 , 1, machine.region("page1")->base() , 0); // Rom page 1
325   memory_configure_bank(machine, "bank2", HECTORMX_BANK_PAGE2 , 1, machine.region("page2")->base() , 0); // Rom page 2
326   memory_set_bank(machine, "bank2", HECTORMX_BANK_PAGE0);
323   state->membank("bank2")->configure_entry(HECTORMX_BANK_PAGE0 , &RAM[0x0000]                    ); // Mess ram
324   state->membank("bank2")->configure_entry(HECTORMX_BANK_PAGE1 , machine.root_device().memregion("page1")->base() ); // Rom page 1
325   state->membank("bank2")->configure_entry(HECTORMX_BANK_PAGE2 , machine.root_device().memregion("page2")->base() ); // Rom page 2
326   state->membank("bank2")->set_entry(HECTORMX_BANK_PAGE0);
327327/******************************************************SPECIFIQUE MX ***************************/
328328
329329/*************************************************SPECIFIQUE DISK II ***************************/
330   memory_configure_bank(machine, "bank3", DISCII_BANK_ROM , 1, machine.region("rom_disc2")->base() , 0); // ROM
331   memory_configure_bank(machine, "bank3", DISCII_BANK_RAM , 1, machine.region("disc2mem" )->base() , 0); // RAM
332   memory_set_bank(machine, "bank3", DISCII_BANK_ROM);
330   state->membank("bank3")->configure_entry(DISCII_BANK_ROM , machine.root_device().memregion("rom_disc2")->base() ); // ROM
331   state->membank("bank3")->configure_entry(DISCII_BANK_RAM , state->memregion("disc2mem" )->base() ); // RAM
332   state->membank("bank3")->set_entry(DISCII_BANK_ROM);
333333/*************************************************SPECIFIQUE DISK II ***************************/
334334
335335   // As video HR ram is in bank, use extern memory
r14976r14977
344344//minidisc
345345{
346346   hec2hrp_state *state = machine.driver_data<hec2hrp_state>();
347   UINT8 *RAM   = machine.region("maincpu"  )->base();   // pointer to mess ram
347   UINT8 *RAM   = machine.root_device().memregion("maincpu"  )->base();   // pointer to mess ram
348348
349349   // Memory install for bank switching
350   memory_configure_bank(machine, "bank1", HECTOR_BANK_PROG , 1, &RAM[0xc000]   , 0); // Mess ram
351   memory_configure_bank(machine, "bank1", HECTOR_BANK_VIDEO, 1, state->m_hector_videoram_hrx, 0); // Video ram
350   state->membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000]   ); // Mess ram
351   state->membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, state->m_hector_videoram_hrx); // Video ram
352352
353353   // Set bank HECTOR_BANK_PROG as basic bank
354   memory_set_bank(machine, "bank1", HECTOR_BANK_PROG);
354   state->membank("bank1")->set_entry(HECTOR_BANK_PROG);
355355   //Here the bank 5 is not used for the language switch but for the floppy ROM.....
356356   /******************************************************SPECIFIQUE Mini disque ***************************/
357   memory_configure_bank(machine, "bank2", HECTOR_BANK_BASE , 1, &RAM[0x0000]                    , 0); // Rom base page
358   memory_configure_bank(machine, "bank2", HECTOR_BANK_DISC , 1, machine.region("page2")->base() , 0); // Rom page mini disc
359   memory_set_bank(machine, "bank2", HECTOR_BANK_BASE);
357   state->membank("bank2")->configure_entry(HECTOR_BANK_BASE , &RAM[0x0000]                    ); // Rom base page
358   state->membank("bank2")->configure_entry(HECTOR_BANK_DISC , state->memregion("page2")->base() ); // Rom page mini disc
359   state->membank("bank2")->set_entry(HECTOR_BANK_BASE);
360360   /******************************************************SPECIFIQUE Mini disque ***************************/
361361
362362   // As video HR ram is in bank, use extern memory
r14976r14977
367367}
368368static MACHINE_RESET(hec2hrx)
369369{
370   hec2hrp_state *state = machine.driver_data<hec2hrp_state>();
370371   //Hector Memory
371   memory_set_bank(machine, "bank1", HECTOR_BANK_PROG);
372   memory_set_bank(machine, "bank2", HECTORMX_BANK_PAGE0);
372   state->membank("bank1")->set_entry(HECTOR_BANK_PROG);
373   state->membank("bank2")->set_entry(HECTORMX_BANK_PAGE0);
373374   //DISK II Memory
374   memory_set_bank(machine, "bank3", DISCII_BANK_ROM);
375   state->membank("bank3")->set_entry(DISCII_BANK_ROM);
375376
376377   // Machines init
377378   hector_reset(machine, 1, 1);
r14976r14977
380381//minidisc
381382static MACHINE_RESET(hec2mdhrx)
382383{
384   hec2hrp_state *state = machine.driver_data<hec2hrp_state>();
383385   //Hector Memory
384   memory_set_bank(machine, "bank1", HECTOR_BANK_PROG);
385   memory_set_bank(machine, "bank2", HECTORMX_BANK_PAGE0);
386   state->membank("bank1")->set_entry(HECTOR_BANK_PROG);
387   state->membank("bank2")->set_entry(HECTORMX_BANK_PAGE0);
386388
387389   // Machines init
388390   hector_reset(machine, 1, 0);
src/mess/drivers/unior.c
r14976r14977
244244static VIDEO_START( unior )
245245{
246246   unior_state *state = machine.driver_data<unior_state>();
247   state->m_p_chargen = machine.region("chargen")->base();
248   state->m_p_vram = machine.region("vram")->base();
247   state->m_p_chargen = machine.root_device().memregion("chargen")->base();
248   state->m_p_vram = state->memregion("vram")->base();
249249}
250250
251251static SCREEN_UPDATE_IND16( unior )
src/mess/drivers/ec65.c
r14976r14977
155155static VIDEO_START( ec65 )
156156{
157157   ec65_state *state = machine.driver_data<ec65_state>();
158   state->m_p_chargen = machine.region("chargen")->base();
158   state->m_p_chargen = state->memregion("chargen")->base();
159159}
160160
161161static MC6845_UPDATE_ROW( ec65_update_row )
src/mess/drivers/cd2650.c
r14976r14977
9090
9191VIDEO_START_MEMBER(cd2650_state)
9292{
93   m_p_chargen = machine().region("chargen")->base();
93   m_p_chargen = memregion("chargen")->base();
9494}
9595
9696SCREEN_UPDATE16_MEMBER(cd2650_state)
src/mess/drivers/tek405x.c
r14976r14977
125125   switch (lbs)
126126   {
127127   case LBS_RBC:
128      program->install_rom(0x8800, 0xa7ff, machine().region(MC6800_TAG)->base() + 0x800);
128      program->install_rom(0x8800, 0xa7ff, memregion(MC6800_TAG)->base() + 0x800);
129129      break;
130130
131131   case LBS_BSOFL:
132      program->install_rom(0x8800, 0xa7ff, machine().region("020_0147_00")->base());
132      program->install_rom(0x8800, 0xa7ff, memregion("020_0147_00")->base());
133133      break;
134134
135135   case LBS_BSCOM:
136      program->install_rom(0x8800, 0xa7ff, machine().region("672_0799_08")->base());
136      program->install_rom(0x8800, 0xa7ff, memregion("672_0799_08")->base());
137137      break;
138138
139139   default:
src/mess/drivers/pegasus.c
r14976r14977
320320
321321VIDEO_START_MEMBER( pegasus_state )
322322{
323   m_p_chargen = machine().region("chargen")->base();
323   m_p_chargen = memregion("chargen")->base();
324324}
325325
326326static const UINT8 mcm6571a_shift[] =
r14976r14977
420420    multipart roms will have. */
421421static void pegasus_decrypt_rom( running_machine &machine, UINT16 addr )
422422{
423   UINT8 b, *ROM = machine.region("maincpu")->base();
423   UINT8 b, *ROM = machine.root_device().memregion("maincpu")->base();
424424   UINT16 i, j;
425425   UINT8 buff[0x1000];
426426   if (ROM[addr] == 0x02)
r14976r14977
439439
440440static DEVICE_IMAGE_LOAD( pegasus_cart_1 )
441441{
442   image.fread(image.device().machine().region("maincpu")->base() + 0x0000, 0x1000);
442   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x0000, 0x1000);
443443   pegasus_decrypt_rom( image.device().machine(), 0x0000 );
444444
445445   return IMAGE_INIT_PASS;
r14976r14977
447447
448448static DEVICE_IMAGE_LOAD( pegasus_cart_2 )
449449{
450   image.fread(image.device().machine().region("maincpu")->base() + 0x1000, 0x1000);
450   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x1000, 0x1000);
451451   pegasus_decrypt_rom( image.device().machine(), 0x1000 );
452452
453453   return IMAGE_INIT_PASS;
r14976r14977
455455
456456static DEVICE_IMAGE_LOAD( pegasus_cart_3 )
457457{
458   image.fread(image.device().machine().region("maincpu")->base() + 0x2000, 0x1000);
458   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x2000, 0x1000);
459459   pegasus_decrypt_rom( image.device().machine(), 0x2000 );
460460
461461   return IMAGE_INIT_PASS;
r14976r14977
463463
464464static DEVICE_IMAGE_LOAD( pegasus_cart_4 )
465465{
466   image.fread(image.device().machine().region("maincpu")->base() + 0xc000, 0x1000);
466   image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0xc000, 0x1000);
467467   pegasus_decrypt_rom( image.device().machine(), 0xc000 );
468468
469469   return IMAGE_INIT_PASS;
r14976r14977
471471
472472static DEVICE_IMAGE_LOAD( pegasus_cart_5 )
473473{
474   image.fread( image.device().machine().region("maincpu")->base() + 0xd000, 0x1000);
474   image.fread( image.device().machine().root_device().memregion("maincpu")->base() + 0xd000, 0x1000);
475475   pegasus_decrypt_rom( image.device().machine(), 0xd000 );
476476
477477   return IMAGE_INIT_PASS;
r14976r14977
479479
480480MACHINE_START_MEMBER( pegasus_state )
481481{
482   m_p_pcgram = machine().region("pcg")->base();
482   m_p_pcgram = memregion("pcg")->base();
483483}
484484
485485MACHINE_RESET_MEMBER( pegasus_state )
src/mess/drivers/vg5k.c
r14976r14977
324324
325325static DRIVER_INIT( vg5k )
326326{
327   UINT8 *FNT = machine.region("ef9345")->base();
327   UINT8 *FNT = machine.root_device().memregion("ef9345")->base();
328328   UINT16 a,b,c,d,dest=0x2000;
329329
330330   /* Unscramble the chargen rom as the format is too complex for gfxdecode to handle unaided */
src/mess/drivers/tsispch.c
r14976r14977
278278
279279DRIVER_INIT( prose2k )
280280{
281   UINT8 *dspsrc = (UINT8 *)(*machine.region("dspprgload"));
282   UINT32 *dspprg = (UINT32 *)(*machine.region("dspprg"));
281   UINT8 *dspsrc = (UINT8 *)(*machine.root_device().memregion("dspprgload"));
282   UINT32 *dspprg = (UINT32 *)(*machine.root_device().memregion("dspprg"));
283283   fprintf(stderr,"driver init\n");
284284    // unpack 24 bit 7720 data into 32 bit space and shuffle it so it can run as 7725 code
285285   // data format as-is in dspsrc: (L = always 0, X = doesn't matter)
src/mess/drivers/elwro800.c
r14976r14977
106106
107107static void elwro800jr_mmu_w(running_machine &machine, UINT8 data)
108108{
109   UINT8 *prom = machine.region("proms")->base() + 0x200;
109   UINT8 *prom = machine.root_device().memregion("proms")->base() + 0x200;
110110   UINT8 *messram = machine.device<ram_device>(RAM_TAG)->pointer();
111111   UINT8 cs;
112112   UINT8 ls175;
r14976r14977
118118   if (!BIT(cs,0))
119119   {
120120      // rom BAS0
121      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x0000); /* BAS0 ROM */
121      state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x0000); /* BAS0 ROM */
122122      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x0000, 0x1fff);
123123      state->m_ram_at_0000 = 0;
124124   }
125125   else if (!BIT(cs,4))
126126   {
127127      // rom BOOT
128      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x4000); /* BOOT ROM */
128      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000); /* BOOT ROM */
129129      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x0000, 0x1fff);
130130      state->m_ram_at_0000 = 0;
131131   }
132132   else
133133   {
134134      // RAM
135      memory_set_bankptr(machine, "bank1", messram);
135      state->membank("bank1")->set_base(messram);
136136      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x1fff, "bank1");
137137      state->m_ram_at_0000 = 1;
138138   }
r14976r14977
140140   cs = prom[((0x2000 >> 10) | (ls175 << 6)) & 0x1ff];
141141   if (!BIT(cs,1))
142142   {
143      memory_set_bankptr(machine, "bank2", machine.region("maincpu")->base() + 0x2000);   /* BAS1 ROM */
143      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x2000);   /* BAS1 ROM */
144144      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x2000, 0x3fff);
145145   }
146146   else
147147   {
148      memory_set_bankptr(machine, "bank2", messram + 0x2000); /* RAM */
148      state->membank("bank2")->set_base(messram + 0x2000); /* RAM */
149149      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x2000, 0x3fff, "bank2");
150150   }
151151
r14976r14977
225225
226226READ8_MEMBER(elwro800_state::elwro800jr_io_r)
227227{
228   UINT8 *prom = machine().region("proms")->base();
228   UINT8 *prom = memregion("proms")->base();
229229   UINT8 cs = prom[offset & 0x1ff];
230230
231231   if (!BIT(cs,0))
r14976r14977
321321
322322WRITE8_MEMBER(elwro800_state::elwro800jr_io_w)
323323{
324   UINT8 *prom = machine().region("proms")->base();
324   UINT8 *prom = memregion("proms")->base();
325325   UINT8 cs = prom[offset & 0x1ff];
326326
327327   if (!BIT(cs,0))
r14976r14977
515515   state->m_df_on_databus = 0xdf;
516516   memset(messram, 0, 64*1024);
517517
518   memory_set_bankptr(machine, "bank3", messram + 0x4000);
518   state->membank("bank3")->set_base(messram + 0x4000);
519519
520520   state->m_port_7ffd_data = 0;
521521   state->m_port_1ffd_data = -1;
src/mess/drivers/jupiter.c
r14976r14977
133133
134134VIDEO_START_MEMBER( jupiter3_state )
135135{
136   m_p_chargen = machine().region("chargen")->base();
136   m_p_chargen = memregion("chargen")->base();
137137}
138138
139139SCREEN_UPDATE_MEMBER( jupiter3_state )
r14976r14977
240240
241241void jupiter3_state::machine_reset()
242242{
243   UINT8* ROM = machine().region(Z80_TAG)->base();
243   UINT8* ROM = memregion(Z80_TAG)->base();
244244   memcpy(m_p_ram, ROM, 0x1000);
245245   cpu_set_reg(m_maincpu, STATE_GENPC, 0xe000);
246246}
r14976r14977
348348
349349static DRIVER_INIT( jupiter )
350350{
351   UINT8 *rom = machine.region(MCM6571AP_TAG)->base();
351   UINT8 *rom = machine.root_device().memregion(MCM6571AP_TAG)->base();
352352   UINT8 inverted[0x1000];
353353
354354   memcpy(inverted, rom, 0x1000);
r14976r14977
370370
371371static DRIVER_INIT( jupiter3 )
372372{
373   UINT8 *rom = machine.region(Z80_TAG)->base();
373   UINT8 *rom = machine.root_device().memregion(Z80_TAG)->base();
374374   UINT8 inverted[0x1000];
375375
376376   memcpy(inverted, rom, 0x1000);
src/mess/drivers/exelv.c
r14976r14977
503503
504504void exelv_state::machine_start()
505505{
506   UINT8 *rom = machine().region("user1")->base() + 0x0200;
507   memory_configure_bank(machine(), "bank1", 0, 1, rom, 0x8000 - 0x200);
508   memory_set_bank(machine(), "bank1", 0);
506   UINT8 *rom = memregion("user1")->base() + 0x0200;
507   membank("bank1")->configure_entry(0, rom);
508   membank("bank1")->set_entry(0);
509509
510510   /* register for state saving */
511511   save_item(NAME(m_tms7020_porta));
src/mess/drivers/sun1.c
r14976r14977
112112
113113MACHINE_RESET_MEMBER(sun1_state)
114114{
115   UINT8* user1 = machine().region("user1")->base();
115   UINT8* user1 = memregion("user1")->base();
116116
117117   memcpy((UINT8*)m_p_ram.target(),user1,0x4000);
118118
src/mess/drivers/m79152pc.c
r14976r14977
4949static VIDEO_START( m79152pc )
5050{
5151   m79152pc_state *state = machine.driver_data<m79152pc_state>();
52   state->m_p_chargen = machine.region("chargen")->base()+4;
52   state->m_p_chargen = state->memregion("chargen")->base()+4;
5353}
5454
5555static SCREEN_UPDATE_IND16( m79152pc )
src/mess/drivers/pv2000.c
r14976r14977
356356   state->m_keyb_column = 0;
357357
358358   device_set_input_line_vector(machine.device("maincpu"), INPUT_LINE_IRQ0, 0xff);
359   memset(&machine.region("maincpu")->base()[0x7000], 0xff, 0x1000);   // initialize RAM
359   memset(&state->memregion("maincpu")->base()[0x7000], 0xff, 0x1000);   // initialize RAM
360360}
361361
362362static DEVICE_IMAGE_LOAD( pv2000_cart )
363363{
364   UINT8 *cart = image.device().machine().region("maincpu")->base() + 0xC000;
364   UINT8 *cart = image.device().machine().root_device().memregion("maincpu")->base() + 0xC000;
365365   UINT32 size;
366366
367367   if (image.software_entry() == NULL)
src/mess/drivers/pyl601.c
r14976r14977
6060   {
6161      int chip = (data >> 4) % 5;
6262      int page = data & 7;
63      memory_set_bankptr(machine(), "bank2", machine().region("romdisk")->base() + chip*0x10000 + page * 0x2000);
63      membank("bank2")->set_base(machine().root_device().memregion("romdisk")->base() + chip*0x10000 + page * 0x2000);
6464   }
6565   else
6666   {
67      memory_set_bankptr(machine(), "bank2", machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
67      membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
6868   }
6969}
7070
r14976r14977
120120READ8_MEMBER(pyl601_state::keycheck_r)
121121{
122122   UINT8 retVal = 0x3f;
123   UINT8 *keyboard = machine().region("keyboard")->base();
123   UINT8 *keyboard = memregion("keyboard")->base();
124124   UINT16 row1 = input_port_read(machine(), "ROW1");
125125   UINT16 row2 = input_port_read(machine(), "ROW2");
126126   UINT16 row3 = input_port_read(machine(), "ROW3");
r14976r14977
347347   pyl601_state *state = machine.driver_data<pyl601_state>();
348348   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
349349   state->m_key_code = 0xff;
350   memory_set_bankptr(machine, "bank1", ram + 0x0000);
351   memory_set_bankptr(machine, "bank2", ram + 0xc000);
352   memory_set_bankptr(machine, "bank3", ram + 0xe000);
353   memory_set_bankptr(machine, "bank4", ram + 0xe700);
354   memory_set_bankptr(machine, "bank5", machine.region("maincpu")->base() + 0xf000);
355   memory_set_bankptr(machine, "bank6", ram + 0xf000);
350   state->membank("bank1")->set_base(ram + 0x0000);
351   state->membank("bank2")->set_base(ram + 0xc000);
352   state->membank("bank3")->set_base(ram + 0xe000);
353   state->membank("bank4")->set_base(ram + 0xe700);
354   state->membank("bank5")->set_base(state->memregion("maincpu")->base() + 0xf000);
355   state->membank("bank6")->set_base(ram + 0xf000);
356356
357357   machine.device("maincpu")->reset();
358358}
r14976r14977
365365{
366366   pyl601_state *state = device->machine().driver_data<pyl601_state>();
367367   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
368   UINT8 *charrom = device->machine().region("gfx1")->base();
368   UINT8 *charrom = state->memregion("gfx1")->base();
369369
370370   int column, bit, i;
371371   UINT8 data;
r14976r14977
412412{
413413   pyl601_state *state = device->machine().driver_data<pyl601_state>();
414414   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
415   UINT8 *charrom = device->machine().region("gfx1")->base();
415   UINT8 *charrom = state->memregion("gfx1")->base();
416416
417417   int column, bit, i;
418418   UINT8 data;
src/mess/drivers/scv.c
r14976r14977
227227   {
228228   case 0:
229229   case 0x2000:
230      memory_set_bankptr( machine, "bank0", state->m_cart_rom );
231      memory_set_bankptr( machine, "bank1", state->m_cart_rom );
232      memory_set_bankptr( machine, "bank2", state->m_cart_rom );
233      memory_set_bankptr( machine, "bank3", state->m_cart_rom );
234      memory_set_bankptr( machine, "bank4", state->m_cart_rom + 0x1000 );
230      state->membank( "bank0" )->set_base( state->m_cart_rom );
231      state->membank( "bank1" )->set_base( state->m_cart_rom );
232      state->membank( "bank2" )->set_base( state->m_cart_rom );
233      state->membank( "bank3" )->set_base( state->m_cart_rom );
234      state->membank( "bank4" )->set_base( state->m_cart_rom + 0x1000 );
235235      break;
236236   case 0x4000:
237      memory_set_bankptr( machine, "bank0", state->m_cart_rom );
238      memory_set_bankptr( machine, "bank1", state->m_cart_rom + 0x2000 );
239      memory_set_bankptr( machine, "bank2", state->m_cart_rom );
240      memory_set_bankptr( machine, "bank3", state->m_cart_rom + 0x2000 );
241      memory_set_bankptr( machine, "bank4", state->m_cart_rom + 0x3000 );
237      state->membank( "bank0" )->set_base( state->m_cart_rom );
238      state->membank( "bank1" )->set_base( state->m_cart_rom + 0x2000 );
239      state->membank( "bank2" )->set_base( state->m_cart_rom );
240      state->membank( "bank3" )->set_base( state->m_cart_rom + 0x2000 );
241      state->membank( "bank4" )->set_base( state->m_cart_rom + 0x3000 );
242242      break;
243243   case 0x8000:
244      memory_set_bankptr( machine, "bank0", state->m_cart_rom );
245      memory_set_bankptr( machine, "bank1", state->m_cart_rom + 0x2000 );
246      memory_set_bankptr( machine, "bank2", state->m_cart_rom + 0x4000 );
247      memory_set_bankptr( machine, "bank3", state->m_cart_rom + 0x6000 );
248      memory_set_bankptr( machine, "bank4", state->m_cart_rom + 0x7000 );
244      state->membank( "bank0" )->set_base( state->m_cart_rom );
245      state->membank( "bank1" )->set_base( state->m_cart_rom + 0x2000 );
246      state->membank( "bank2" )->set_base( state->m_cart_rom + 0x4000 );
247      state->membank( "bank3" )->set_base( state->m_cart_rom + 0x6000 );
248      state->membank( "bank4" )->set_base( state->m_cart_rom + 0x7000 );
249249      break;
250250   case 0x10000:
251      memory_set_bankptr( machine, "bank0", state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0x8000 : 0 ) );
252      memory_set_bankptr( machine, "bank1", state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xa000 : 0x2000 ) );
253      memory_set_bankptr( machine, "bank2", state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xc000 : 0x4000 ) );
254      memory_set_bankptr( machine, "bank3", state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xe000 : 0x6000 ) );
255      memory_set_bankptr( machine, "bank4", state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xf000 : 0x7000 ) );
251      state->membank( "bank0" )->set_base( state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0x8000 : 0 ) );
252      state->membank( "bank1" )->set_base( state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xa000 : 0x2000 ) );
253      state->membank( "bank2" )->set_base( state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xc000 : 0x4000 ) );
254      state->membank( "bank3" )->set_base( state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xe000 : 0x6000 ) );
255      state->membank( "bank4" )->set_base( state->m_cart_rom + ( ( state->m_portc & 0x20 ) ? 0xf000 : 0x7000 ) );
256256      break;
257257   case 0x20000:   /* Pole Position 2 */
258258      int base = ( ( state->m_portc >> 5 ) & 0x03 ) * 0x8000 ;
259      memory_set_bankptr( machine, "bank0", state->m_cart_rom + base + 0 );
260      memory_set_bankptr( machine, "bank1", state->m_cart_rom + base + 0x2000 );
261      memory_set_bankptr( machine, "bank2", state->m_cart_rom + base + 0x4000 );
262      memory_set_bankptr( machine, "bank3", state->m_cart_rom + base + 0x6000 );
263      memory_set_bankptr( machine, "bank4", state->m_cart_rom + base + 0x7000 );
259      state->membank( "bank0" )->set_base( state->m_cart_rom + base + 0 );
260      state->membank( "bank1" )->set_base( state->m_cart_rom + base + 0x2000 );
261      state->membank( "bank2" )->set_base( state->m_cart_rom + base + 0x4000 );
262      state->membank( "bank3" )->set_base( state->m_cart_rom + base + 0x6000 );
263      state->membank( "bank4" )->set_base( state->m_cart_rom + base + 0x7000 );
264264      /* On-cart RAM is enabled when PC6 is high */
265265      if ( state->m_cart_ram && state->m_portc & 0x40 )
266266      {
267267         state->m_cart_ram_enabled = true;
268         memory_set_bankptr( machine, "bank4", state->m_cart_ram );
268         state->membank( "bank4" )->set_base( state->m_cart_ram );
269269      }
270270      break;
271271   }
r14976r14977
275275   {
276276      if ( state->m_cart_ram_size == 0x1000 )
277277      {
278         memory_set_bankptr( machine, "bank4", state->m_cart_ram );
278         state->membank( "bank4" )->set_base( state->m_cart_ram );
279279      }
280280      else
281281      {
282         memory_set_bankptr( machine, "bank3", state->m_cart_ram );
283         memory_set_bankptr( machine, "bank4", state->m_cart_ram + 0x1000 );
282         state->membank( "bank3" )->set_base( state->m_cart_ram );
283         state->membank( "bank4" )->set_base( state->m_cart_ram + 0x1000 );
284284      }
285285      state->m_cart_ram_enabled = true;
286286   }
r14976r14977
302302{
303303   scv_state *state = device->machine().driver_data<scv_state>();
304304
305   state->m_cart_rom = device->machine().region( "cart" )->base();
305   state->m_cart_rom = state->memregion( "cart" )->base();
306306   state->m_cart_rom_size = 0;
307307   state->m_cart_ram = NULL;
308308   state->m_cart_ram_size = 0;
r14976r14977
317317
318318   if ( image.software_entry() == NULL )
319319   {
320      UINT8 *cart = image.device().machine().region( "cart" )->base();
320      UINT8 *cart = image.device().machine().root_device().memregion( "cart" )->base();
321321      int size = image.length();
322322
323      if ( size > image.device().machine().region( "cart" )->bytes() )
323      if ( size > state->memregion( "cart" )->bytes() )
324324      {
325325         image.seterror( IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size" );
326326         return IMAGE_INIT_FAIL;
r14976r14977
582582         if ( text_x && text_y )
583583         {
584584            /* Text mode */
585            UINT8 *char_data = screen.machine().region( "charrom" )->base() + ( d & 0x7f ) * 8;
585            UINT8 *char_data = state->memregion( "charrom" )->base() + ( d & 0x7f ) * 8;
586586            draw_text( bitmap, x * 8, y * 16, char_data, fg, bg );
587587         }
588588         else
src/mess/drivers/mstation.c
r14976r14977
193193         break;
194194      case 1: // banked RAM
195195         sprintf(bank_tag,"bank%d", bank);
196         memory_set_bankptr(machine(), bank_tag, m_ram_base + (((bank == 1 ? m_bank1[0] : m_bank2[0]) & 0x07)<<14));
196         membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1[0] : m_bank2[0]) & 0x07)<<14));
197197         program->install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag);
198198         active_flash = -1;
199199         break;
r14976r14977
437437   m_flashes[1] = machine().device<intelfsh8_device>("flash1");
438438
439439   // allocate the videoram
440   m_vram = (UINT8*)machine().region_alloc( "vram", 9600, 1, ENDIANNESS_LITTLE )->base();
440   m_vram = (UINT8*)machine().memory().region_alloc( "vram", 9600, 1, ENDIANNESS_LITTLE )->base();
441441   m_ram_base = (UINT8*)machine().device<ram_device>(RAM_TAG)->pointer();
442442
443443   // map firsh RAM bank at 0xc000-0xffff
444   memory_set_bankptr(machine(), "sysram", m_ram_base);
444   membank("sysram")->set_base(m_ram_base);
445445}
446446
447447
src/mess/drivers/iq151.c
r14976r14977
156156
157157WRITE8_MEMBER(iq151_state::boot_bank_w)
158158{
159   memory_set_bank(machine(), "boot", data & 1);
159   membank("boot")->set_entry(data & 1);
160160}
161161
162162
r14976r14977
348348{
349349   iq151_state *state = machine.driver_data<iq151_state>();
350350
351   UINT8 *RAM = machine.region("maincpu")->base();
352   memory_configure_bank(machine, "boot", 0, 1, RAM + 0xf800, 0);
353   memory_configure_bank(machine, "boot", 1, 1, RAM + 0x0000, 0);
351   UINT8 *RAM = state->memregion("maincpu")->base();
352   state->membank("boot")->configure_entry(0, RAM + 0xf800);
353   state->membank("boot")->configure_entry(1, RAM + 0x0000);
354354
355355   device_set_irq_callback(state->m_maincpu, iq151_irq_callback);
356356
r14976r14977
364364
365365MACHINE_RESET_MEMBER( iq151_state )
366366{
367   memory_set_bank(machine(), "boot", 0);
367   membank("boot")->set_entry(0);
368368
369369   m_vblank_irq_state = 0;
370370}
src/mess/drivers/pcfx.c
r14976r14977
5555
5656void pcfx_state::machine_reset()
5757{
58   memory_set_bankptr( machine(), "bank1", machine().region("user1")->base() );
58   membank( "bank1" )->set_base( memregion("user1")->base() );
5959}
6060
6161UINT32 pcfx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
src/mess/drivers/h19.c
r14976r14977
297297
298298VIDEO_START_MEMBER( h19_state )
299299{
300   m_p_chargen = machine().region("chargen")->base();
300   m_p_chargen = memregion("chargen")->base();
301301}
302302
303303static MC6845_UPDATE_ROW( h19_update_row )
src/mess/drivers/avigo.c
r14976r14977
173173
174174      case 0x01: // banked RAM
175175         sprintf(bank_tag,"bank%d", bank);
176         memory_set_bankptr(machine(), bank_tag, m_ram_base + (((bank == 1 ? m_bank1_l : m_bank2_l) & 0x07)<<14));
176         membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1_l : m_bank2_l) & 0x07)<<14));
177177         space->install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag);
178178         active_flash = -1;
179179         break;
r14976r14977
246246   /* if is a cold start initialize flash contents */
247247   if (!m_warm_start)
248248   {
249      memcpy(m_flashes[0]->space()->get_read_ptr(0), machine().region("bios")->base() + 0x000000, 0x100000);
250      memcpy(m_flashes[1]->space()->get_read_ptr(0), machine().region("bios")->base() + 0x100000, 0x100000);
249      memcpy(m_flashes[0]->space()->get_read_ptr(0), memregion("bios")->base() + 0x000000, 0x100000);
250      memcpy(m_flashes[1]->space()->get_read_ptr(0), memregion("bios")->base() + 0x100000, 0x100000);
251251   }
252252
253253   m_irq = 0;
r14976r14977
267267   m_ram_base = (UINT8*)m_ram->pointer();
268268
269269   // bank3 always first ram bank
270   memory_set_bankptr(machine(), "bank3", m_ram_base);
270   membank("bank3")->set_base(m_ram_base);
271271
272272   /* keep machine pointers to flash devices */
273273   m_flashes[0] = machine().device<intelfsh8_device>("flash0");
src/mess/drivers/mpz80.c
r14976r14977
163163READ8_MEMBER( mpz80_state::mmu_r )
164164{
165165   m_addr = get_address(offset);
166   UINT8 *rom = machine().region(Z80_TAG)->base();
166   UINT8 *rom = memregion(Z80_TAG)->base();
167167   UINT8 data = 0;
168168
169169   if (m_pretrap)
r14976r14977
831831{
832832   if (m_trap && address >= m_trap_start && address <= m_trap_start + 0xf)
833833   {
834      direct.explicit_configure(m_trap_start, m_trap_start + 0xf, 0xf, machine().region(Z80_TAG)->base() + ((m_trap_reset << 10) | 0x3f0));
834      direct.explicit_configure(m_trap_start, m_trap_start + 0xf, 0xf, memregion(Z80_TAG)->base() + ((m_trap_reset << 10) | 0x3f0));
835835      return ~0;
836836   }
837837
src/mess/drivers/super6.c
r14976r14977
3232{
3333   address_space *program = m_maincpu->memory().space(AS_PROGRAM);
3434   UINT8 *ram = m_ram->pointer();
35   UINT8 *rom = machine().region(Z80_TAG)->base();
35   UINT8 *rom = memregion(Z80_TAG)->base();
3636
3737   // power on jump
3838   if (!BIT(m_bank0, 6)) {   program->install_rom(0x0000, 0x07ff, 0, 0xf800, rom); return; }
src/mess/drivers/e01.c
r14976r14977
9595
9696READ8_MEMBER( e01_state::ram_select_r )
9797{
98   memory_set_bank(machine(), "bank1", 0);
99   memory_set_bank(machine(), "bank3", 0);
98   membank("bank1")->set_entry(0);
99   membank("bank3")->set_entry(0);
100100
101101   return 0;
102102}
r14976r14977
359359void e01_state::machine_start()
360360{
361361   UINT8 *ram = m_ram->pointer();
362   UINT8 *rom = machine().region(R65C102_TAG)->base();
362   UINT8 *rom = memregion(R65C102_TAG)->base();
363363
364364   /* setup memory banking */
365   memory_configure_bank(machine(), "bank1", 0, 1, ram, 0);
366   memory_configure_bank(machine(), "bank1", 1, 1, rom, 0);
367   memory_set_bank(machine(), "bank1", 1);
365   membank("bank1")->configure_entry(0, ram);
366   membank("bank1")->configure_entry(1, rom);
367   membank("bank1")->set_entry(1);
368368
369   memory_configure_bank(machine(), "bank2", 0, 1, ram, 0);
370   memory_set_bank(machine(), "bank2", 0);
369   membank("bank2")->configure_entry(0, ram);
370   membank("bank2")->set_entry(0);
371371
372   memory_configure_bank(machine(), "bank3", 0, 1, ram + 0xfd00, 0);
373   memory_configure_bank(machine(), "bank3", 1, 1, rom + 0xfd00, 0);
374   memory_set_bank(machine(), "bank3", 1);
372   membank("bank3")->configure_entry(0, ram + 0xfd00);
373   membank("bank3")->configure_entry(1, rom + 0xfd00);
374   membank("bank3")->set_entry(1);
375375
376   memory_configure_bank(machine(), "bank4", 0, 1, ram + 0xfd00, 0);
377   memory_set_bank(machine(), "bank4", 0);
376   membank("bank4")->configure_entry(0, ram + 0xfd00);
377   membank("bank4")->set_entry(0);
378378
379379   /* register for state saving */
380380   save_item(NAME(m_adlc_ie));
r14976r14977
392392
393393void e01_state::machine_reset()
394394{
395   memory_set_bank(machine(), "bank1", 1);
396   memory_set_bank(machine(), "bank3", 1);
395   membank("bank1")->set_entry(1);
396   membank("bank3")->set_entry(1);
397397}
398398
399399/***************************************************************************
src/mess/drivers/zrt80.c
r14976r14977
190190
191191VIDEO_START_MEMBER( zrt80_state )
192192{
193   m_p_chargen = machine().region("chargen")->base();
193   m_p_chargen = memregion("chargen")->base();
194194}
195195
196196static MC6845_UPDATE_ROW( zrt80_update_row )
src/mess/drivers/svision.c
r14976r14977
129129         break;
130130      case 0x26: /* bits 5,6 memory management for a000? */
131131         logerror("%.6f svision write %04x %02x\n", machine().time().as_double(),offset,data);
132         memory_set_bankptr(machine(), "bank1", machine().region("user1")->base() + ((m_reg[0x26] & 0xe0) << 9));
132         membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + ((m_reg[0x26] & 0xe0) << 9));
133133         svision_irq(machine());
134134         break;
135135      case 0x23: /* delta hero irq routine write */
r14976r14977
430430   state->m_sound = machine.device("custom");
431431   state->m_dma_finished = svision_dma_finished(state->m_sound);
432432   state->m_pet.on = FALSE;
433   memory_set_bankptr(machine, "bank2", machine.region("user1")->base() + 0x1c000);
433   state->membank("bank2")->set_base(state->memregion("user1")->base() + 0x1c000);
434434}
435435
436436static DRIVER_INIT( svisions )
r14976r14977
439439   state->m_svision.timer1 = machine.scheduler().timer_alloc(FUNC(svision_timer));
440440   state->m_sound = machine.device("custom");
441441   state->m_dma_finished = svision_dma_finished(state->m_sound);
442   memory_set_bankptr(machine, "bank2", machine.region("user1")->base() + 0x1c000);
442   state->membank("bank2")->set_base(state->memregion("user1")->base() + 0x1c000);
443443   state->m_svision.timer1 = machine.scheduler().timer_alloc(FUNC(svision_timer));
444444   state->m_pet.on = TRUE;
445445   state->m_pet.timer = machine.scheduler().timer_alloc(FUNC(svision_pet_timer));
r14976r14977
456456      size = image.length();
457457      temp_copy = auto_alloc_array(image.device().machine(), UINT8, size);
458458
459      if (size > image.device().machine().region("user1")->bytes())
459      if (size > image.device().machine().root_device().memregion("user1")->bytes())
460460      {
461461         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
462462         auto_free(image.device().machine(), temp_copy);
r14976r14977
477477      memcpy(temp_copy, image.get_software_region("rom"), size);
478478   }
479479
480   mirror = image.device().machine().region("user1")->bytes() / size;
480   mirror = image.device().machine().root_device().memregion("user1")->bytes() / size;
481481
482482   /* With the following, we mirror the cart in the whole "user1" memory region */
483483   for (i = 0; i < mirror; i++)
484      memcpy(image.device().machine().region("user1")->base() + i * size, temp_copy, size);
484      memcpy(image.device().machine().root_device().memregion("user1")->base() + i * size, temp_copy, size);
485485
486486   auto_free(image.device().machine(), temp_copy);
487487
r14976r14977
493493   svision_state *state = machine.driver_data<svision_state>();
494494   state->m_svision.timer_shot = FALSE;
495495   *state->m_dma_finished = FALSE;
496   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
496   state->membank("bank1")->set_base(state->memregion("user1")->base());
497497}
498498
499499
r14976r14977
502502   svision_state *state = machine.driver_data<svision_state>();
503503   state->m_svision.timer_shot = FALSE;
504504   *state->m_dma_finished = FALSE;
505   memory_set_bankptr(machine, "bank1", machine.region("user1")->base());
505   state->membank("bank1")->set_base(state->memregion("user1")->base());
506506   state->m_tvlink.palette_on = FALSE;
507507
508508   memset(state->m_reg + 0x800, 0xff, 0x40); // normally done from state->m_tvlink microcontroller
src/mess/drivers/c64.c
r14976r14977
10221022   cbm_common_init();
10231023
10241024   // find memory regions
1025   m_basic = machine().region("basic")->base();
1026   m_kernal = machine().region("kernal")->base();
1027   m_charom = machine().region("charom")->base();
1025   m_basic = memregion("basic")->base();
1026   m_kernal = memregion("kernal")->base();
1027   m_charom = memregion("charom")->base();
10281028
10291029   // allocate memory
10301030   m_color_ram = auto_alloc_array(machine(), UINT8, 0x400);
r14976r14977
10551055   c64_state::machine_start();
10561056
10571057   // find memory regions
1058   m_basic = machine().region(M6510_TAG)->base();
1059   m_kernal = machine().region(M6510_TAG)->base() + 0x2000;
1058   m_basic = memregion(M6510_TAG)->base();
1059   m_kernal = memregion(M6510_TAG)->base() + 0x2000;
10601060}
10611061
10621062
src/mess/drivers/vta2000.c
r14976r14977
5353static VIDEO_START( vta2000 )
5454{
5555   vta2000_state *state = machine.driver_data<vta2000_state>();
56   state->m_p_chargen = machine.region("chargen")->base();
57   state->m_p_videoram = machine.region("maincpu")->base()+0x8000;
56   state->m_p_chargen = machine.root_device().memregion("chargen")->base();
57   state->m_p_videoram = state->memregion("maincpu")->base()+0x8000;
5858}
5959
6060static SCREEN_UPDATE_IND16( vta2000 )
src/mess/drivers/ti89.c
r14976r14977
145145   }
146146   else
147147   {
148      UINT16 *rom_base = (UINT16 *)(*space.machine().region("flash"));
148      UINT16 *rom_base = (UINT16 *)(*space.machine().root_device().memregion("flash"));
149149
150150      return rom_base[offset];
151151   }
r14976r14977
420420
421421void ti68k_state::machine_start()
422422{
423   UINT16 *rom = (UINT16 *)(*machine().region("flash"));
423   UINT16 *rom = (UINT16 *)(*machine().root_device().memregion("flash"));
424424   int i;
425425
426426   m_flash_mem = !((rom[0x32] & 0x0f) != 0);
src/mess/drivers/ipds.c
r14976r14977
8989   int i;
9090   ipds_state *state = device->machine().driver_data<ipds_state>();
9191   bitmap_ind16 &bitmap = state->m_bitmap;
92   UINT8 *charmap = device->machine().region("chargen")->base();
92   UINT8 *charmap = state->memregion("chargen")->base();
9393   UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
9494
9595   if (vsp)
src/mess/drivers/xerox820.c
r14976r14977
147147   if (bank)
148148   {
149149      /* ROM */
150      program->install_rom(0x0000, 0x0fff, machine().region("monitor")->base());
150      program->install_rom(0x0000, 0x0fff, memregion("monitor")->base());
151151      program->unmap_readwrite(0x1000, 0x1fff);
152152      program->install_ram(0x3000, 0x3fff, m_video_ram);
153153   }
r14976r14977
166166   if (bank)
167167   {
168168      /* ROM */
169      program->install_rom(0x0000, 0x17ff, machine().region("monitor")->base());
169      program->install_rom(0x0000, 0x17ff, memregion("monitor")->base());
170170      program->unmap_readwrite(0x1800, 0x2fff);
171171      program->install_ram(0x3000, 0x3fff, m_video_ram);
172172      program->unmap_readwrite(0x4000, 0xbfff);
r14976r14977
624624void xerox820_state::video_start()
625625{
626626   /* find memory regions */
627   m_char_rom = machine().region("chargen")->base();
627   m_char_rom = memregion("chargen")->base();
628628}
629629
630630
src/mess/drivers/chesstrv.c
r14976r14977
202202
203203void chesstrv_state::machine_start()
204204{
205   m_ram = machine().region("ram")->base();
205   m_ram = memregion("ram")->base();
206206
207207   save_item(NAME(m_ram_addr));
208208   save_item(NAME(m_matrix));
src/mess/drivers/ti99_4p.c
r14976r14977
749749   driver->m_cassette = static_cast<cassette_image_device*>(machine.device(CASSETTE_TAG));
750750   driver->m_tms9901 = static_cast<tms9901_device*>(machine.device(TMS9901_TAG));
751751
752   driver->m_ram = (UINT16*)(*machine.region(SAMSMEM_TAG));
753   driver->m_scratchpad = (UINT16*)(*machine.region(PADMEM_TAG));
752   driver->m_ram = (UINT16*)(*machine.root_device().memregion(SAMSMEM_TAG));
753   driver->m_scratchpad = (UINT16*)(*machine.root_device().memregion(PADMEM_TAG));
754754
755755   driver->m_peribox->senila(CLEAR_LINE);
756756   driver->m_peribox->senilb(CLEAR_LINE);
757757
758   UINT16 *rom = (UINT16*)(*machine.region("maincpu"));
758   UINT16 *rom = (UINT16*)(*machine.root_device().memregion("maincpu"));
759759   driver->m_rom0  = rom + 0x2000;
760760   driver->m_dsr   = rom + 0x6000;
761761   driver->m_rom6a = rom + 0x3000;
src/mess/drivers/micronic.c
r14976r14977
163163{
164164   if (data < 2)
165165   {
166      memory_set_bank(machine(), "bank1", data);
166      membank("bank1")->set_entry(data);
167167      m_maincpu->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x7fff);
168168   }
169169   else
170170   {
171      memory_set_bank(machine(), "bank1", (data <= m_banks_num) ? data : m_banks_num);
171      membank("bank1")->set_entry((data <= m_banks_num) ? data : m_banks_num);
172172      m_maincpu->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x7fff, "bank1");
173173   }
174174}
r14976r14977
329329void micronic_state::machine_start()
330330{
331331   /* ROM banks */
332   memory_configure_bank(machine(), "bank1", 0x00, 0x02, machine().region(Z80_TAG)->base(), 0x10000);
332   membank("bank1")->configure_entries(0x00, 0x02, memregion(Z80_TAG)->base(), 0x10000);
333333
334334   /* RAM banks */
335335   m_banks_num = (m_ram->size()>>15) + 1;
336   memory_configure_bank(machine(), "bank1", 0x02, m_banks_num - 1, m_ram->pointer(), 0x8000);
336   membank("bank1")->configure_entries(0x02, m_banks_num - 1, m_ram->pointer(), 0x8000);
337337
338338   /* register for state saving */
339339//  save_item(NAME(state->));
r14976r14977
341341
342342void micronic_state::machine_reset()
343343{
344   memory_set_bank(machine(), "bank1", 0);
344   membank("bank1")->set_entry(0);
345345   m_maincpu->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x7fff);
346346}
347347
src/mess/drivers/ptcsol.c
r14976r14977
529529/* after the first 4 bytes have been read from ROM, switch the ram back in */
530530static TIMER_CALLBACK( sol20_boot )
531531{
532   memory_set_bank(machine, "boot", 0);
532   sol20_state *state = machine.driver_data<sol20_state>();
533   state->membank("boot")->set_entry(0);
533534}
534535
535536MACHINE_START_MEMBER( sol20_state )
r14976r14977
585586   ay31015_set_transmitter_clock( m_uart_s, s_clock);
586587
587588   // boot-bank
588   memory_set_bank(machine(), "boot", 1);
589   membank("boot")->set_entry(1);
589590   machine().scheduler().timer_set(attotime::from_usec(9), FUNC(sol20_boot));
590591}
591592
592593static DRIVER_INIT( sol20 )
593594{
594   UINT8 *RAM = machine.region("maincpu")->base();
595   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xc000);
595   sol20_state *state = machine.driver_data<sol20_state>();
596   UINT8 *RAM = state->memregion("maincpu")->base();
597   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000);
596598}
597599
598600VIDEO_START_MEMBER( sol20_state )
599601{
600   m_p_chargen = machine().region("chargen")->base();
602   m_p_chargen = memregion("chargen")->base();
601603}
602604
603605SCREEN_UPDATE16_MEMBER( sol20_state )
src/mess/drivers/alphatro.c
r14976r14977
135135
136136VIDEO_START_MEMBER( alphatro_state )
137137{
138   m_p_chargen = machine().region("chargen")->base();
138   m_p_chargen = memregion("chargen")->base();
139139}
140140
141141static MC6845_UPDATE_ROW( alphatro_update_row )
r14976r14977
351351{
352352   // do what the IPL does
353353   //  UINT8* RAM = machine().device<ram_device>("ram")->pointer();
354   UINT8* ROM = machine().region("maincpu")->base();
354   UINT8* ROM = memregion("maincpu")->base();
355355   cpu_set_reg(m_maincpu, STATE_GENPC, 0xe000);
356356   memcpy(m_p_ram, ROM, 0xf000); // copy BASIC to RAM, which the undumped IPL is supposed to do.
357357   memcpy(m_p_videoram, ROM+0x1000, 0x1000);
358   //  memory_set_bankptr(machine(), "bank1", RAM);
358   //  membank("bank1")->set_base(RAM);
359359
360360   // probably not correct, exact meaning of port is unknown, vblank/vsync is too slow.
361361   m_sys_timer->adjust(attotime::from_usec(10),0,attotime::from_usec(10));
src/mess/drivers/vc4000.c
r14976r14977
190190static DEVICE_IMAGE_LOAD( vc4000_cart )
191191{
192192   running_machine &machine = image.device().machine();
193   vc4000_state *state = machine.driver_data<vc4000_state>();
193194   address_space *memspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
194195   UINT32 size;
195196
r14976r14977
204205   if (size > 0x1000)   /* 6k rom + 1k ram - Chess2 only */
205206   {
206207      memspace->install_read_bank(0x0800, 0x15ff, "bank1");   /* extra rom */
207      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x1000);
208      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x1000);
208209
209210      memspace->install_readwrite_bank(0x1800, 0x1bff, "bank2");   /* ram */
210      memory_set_bankptr(machine, "bank2", machine.region("maincpu")->base() + 0x1800);
211      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x1800);
211212   }
212213   else if (size > 0x0800)   /* some 4k roms have 1k of mirrored ram */
213214   {
214215      memspace->install_read_bank(0x0800, 0x0fff, "bank1");   /* extra rom */
215      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x0800);
216      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x0800);
216217
217218      memspace->install_readwrite_bank(0x1000, 0x15ff, 0, 0x800, "bank2"); /* ram */
218      memory_set_bankptr(machine, "bank2", machine.region("maincpu")->base() + 0x1000);
219      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x1000);
219220   }
220221   else if (size == 0x0800)   /* 2k roms + 2k ram - Hobby Module(Radofin) and elektor TVGC*/
221222   {
222223      memspace->install_readwrite_bank(0x0800, 0x0fff, "bank1"); /* ram */
223      memory_set_bankptr(machine, "bank1", machine.region("maincpu")->base() + 0x0800);
224      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x0800);
224225   }
225226
226227   if (size > 0)
227228   {
228229      if (image.software_entry() == NULL)
229230      {
230         if (image.fread( machine.region("maincpu")->base(), size) != size)
231         if (image.fread( machine.root_device().memregion("maincpu")->base(), size) != size)
231232            return IMAGE_INIT_FAIL;
232233      }
233234      else
234         memcpy(machine.region("maincpu")->base(), image.get_software_region("rom"), size);
235         memcpy(machine.root_device().memregion("maincpu")->base(), image.get_software_region("rom"), size);
235236   }
236237
237238   return IMAGE_INIT_PASS;
src/mess/drivers/cosmicos.c
r14976r14977
532532
533533static QUICKLOAD_LOAD( cosmicos )
534534{
535   UINT8 *ptr = image.device().machine().region(CDP1802_TAG)->base();
535   UINT8 *ptr = image.device().machine().root_device().memregion(CDP1802_TAG)->base();
536536   int size = image.length();
537537
538538   /* load image to RAM */
r14976r14977
615615   if (m_boot)
616616   {
617617      /* force A6 and A7 high */
618      direct.explicit_configure(0x0000, 0xffff, 0x3f3f, machine().region(CDP1802_TAG)->base() + 0xc0);
618      direct.explicit_configure(0x0000, 0xffff, 0x3f3f, memregion(CDP1802_TAG)->base() + 0xc0);
619619      return ~0;
620620   }
621621
src/mess/drivers/pcm.c
r14976r14977
208208
209209VIDEO_START_MEMBER( pcm_state )
210210{
211   m_p_chargen = machine().region("chargen")->base();
211   m_p_chargen = memregion("chargen")->base();
212212}
213213
214214SCREEN_UPDATE16_MEMBER( pcm_state )
src/mess/drivers/dmv.c
r14976r14977
8282static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
8383{
8484   dmv_state *state = device->machine().driver_data<dmv_state>();
85   UINT8 * chargen = state->machine().region("maincpu")->base() + 0x1000;
85   UINT8 * chargen = state->memregion("maincpu")->base() + 0x1000;
8686
8787   for( int x = 0; x < pitch; x++ )
8888   {
src/mess/drivers/sun2.c
r14976r14977
102102
103103MACHINE_RESET_MEMBER(sun2_state)
104104{
105   UINT8* user1 = machine().region("user1")->base();
105   UINT8* user1 = memregion("user1")->base();
106106
107107   memcpy((UINT8*)m_p_ram.target(),user1,0x8000);
108108
src/mess/drivers/b16.c
r14976r14977
6666VIDEO_START_MEMBER( b16_state )
6767{
6868   // find memory regions
69   m_char_rom = machine().region("pcg")->base();
69   m_char_rom = memregion("pcg")->base();
7070}
7171
7272
r14976r14977
7575   b16_state *state = machine().driver_data<b16_state>();
7676   int x,y;
7777   int xi,yi;
78   UINT8 *gfx_rom = machine().region("pcg")->base();
78   UINT8 *gfx_rom = memregion("pcg")->base();
7979
8080   for(y=0;y<mc6845_v_display;y++)
8181   {
src/mess/drivers/argo.c
r14976r14977
5858{
5959   UINT8 *RAM;
6060   if (m_ram_ctrl)
61      RAM = machine().region("videoram")->base();
61      RAM = memregion("videoram")->base();
6262   else
63      RAM = machine().region("extraram")->base();
63      RAM = memregion("extraram")->base();
6464
6565   RAM[offset] = data;
6666}
r14976r14977
103103   case 0xE8: // hardware scroll - we should use ports E0,E1,E2,E3
104104      if ((m_scroll_ctrl == 2) & (data == 0xe3))
105105      {
106         UINT8 *RAM = machine().region("videoram")->base();
106         UINT8 *RAM = memregion("videoram")->base();
107107         m_scroll_ctrl = 0;
108108         memcpy(RAM, RAM+80, 24*80);
109109      }
r14976r14977
253253/* after the first 4 bytes have been read from ROM, switch the ram back in */
254254static TIMER_CALLBACK( argo_boot )
255255{
256   memory_set_bank(machine, "boot", 0);
256   argo_state *state = machine.driver_data<argo_state>();
257   state->membank("boot")->set_entry(0);
257258}
258259
259260MACHINE_RESET_MEMBER(argo_state)
260261{
261   memory_set_bank(machine(), "boot", 1);
262   membank("boot")->set_entry(1);
262263   machine().scheduler().timer_set(attotime::from_usec(5), FUNC(argo_boot));
263264}
264265
265266DRIVER_INIT( argo )
266267{
267   UINT8 *RAM = machine.region("maincpu")->base();
268   memory_configure_bank(machine, "boot", 0, 2, &RAM[0x0000], 0xf800);
268   argo_state *state = machine.driver_data<argo_state>();
269   UINT8 *RAM = state->memregion("maincpu")->base();
270   state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xf800);
269271}
270272
271273VIDEO_START_MEMBER( argo_state )
272274{
273   m_p_chargen = machine().region("chargen")->base();
275   m_p_chargen = memregion("chargen")->base();
274276}
275277
276278SCREEN_UPDATE16_MEMBER( argo_state )
r14976r14977
325327      else
326328      {
327329         ma=0;
328         p_vram = machine().region("videoram")->base();
330         p_vram = memregion("videoram")->base();
329331      }
330332   }
331333   return 0;
src/mess/drivers/psion.c
r14976r14977
5757
5858void psion_state::update_banks(running_machine &machine)
5959{
60   psion_state *state = machine.driver_data<psion_state>();
6061   if (m_ram_bank < m_ram_bank_count && m_ram_bank_count)
61      memory_set_bank(machine, "rambank", m_ram_bank);
62      state->membank("rambank")->set_entry(m_ram_bank);
6263
6364   if (m_rom_bank < m_rom_bank_count && m_rom_bank_count)
64      memory_set_bank(machine, "rombank", m_rom_bank);
65      state->membank("rombank")->set_entry(m_rom_bank);
6566}
6667
6768WRITE8_MEMBER( psion_state::hd63701_int_reg_w )
r14976r14977
402403
403404   if (m_rom_bank_count)
404405   {
405      UINT8* rom_base = (UINT8 *)machine().region("maincpu")->base();
406      UINT8* rom_base = (UINT8 *)machine().root_device().memregion("maincpu")->base();
406407
407      memory_configure_bank(machine(), "rombank", 0, 1, rom_base + 0x8000, 0x4000);
408      memory_configure_bank(machine(), "rombank", 1, m_rom_bank_count-1, rom_base + 0x10000, 0x4000);
409      memory_set_bank(machine(), "rombank", 0);
408      membank("rombank")->configure_entry(0, rom_base + 0x8000);
409      membank("rombank")->configure_entries(1, m_rom_bank_count-1, rom_base + 0x10000, 0x4000);
410      membank("rombank")->set_entry(0);
410411   }
411412
412413   if (m_ram_bank_count)
413414   {
414415      m_paged_ram = auto_alloc_array(machine(), UINT8, m_ram_bank_count * 0x4000);
415      memory_configure_bank(machine(), "rambank", 0, m_ram_bank_count, m_paged_ram, 0x4000);
416      memory_set_bank(machine(), "rambank", 0);
416      membank("rambank")->configure_entries(0, m_ram_bank_count, m_paged_ram, 0x4000);
417      membank("rambank")->set_entry(0);
417418   }
418419
419420   save_item(NAME(m_kb_counter));
src/mess/drivers/gba.c
r14976r14977
19461946
19471947READ32_MEMBER(gba_state::gba_bios_r)
19481948{
1949   UINT32 *rom = (UINT32 *)(*machine().region("maincpu"));
1949   UINT32 *rom = (UINT32 *)(*machine().root_device().memregion("maincpu"));
19501950   if (m_bios_protected != 0)
19511951   {
19521952      offset = (m_bios_last_address + 8) / 4;
r14976r14977
29302930static UINT32 gba_fix_wrong_chip(running_machine &machine, UINT32 cart_size, UINT32 chip)
29312931{
29322932   char game_code[5] = { 0 };
2933   UINT8 *ROM = machine.region("cartridge")->base();
2933   UINT8 *ROM = machine.root_device().memregion("cartridge")->base();
29342934
29352935   if (cart_size >= 0xAC + 4)
29362936   {
r14976r14977
30123012
30133013static DEVICE_IMAGE_LOAD( gba_cart )
30143014{
3015   UINT8 *ROM = image.device().machine().region("cartridge")->base();
3015   UINT8 *ROM = image.device().machine().root_device().memregion("cartridge")->base();
30163016   UINT32 cart_size;
30173017   UINT32 chip = 0;
30183018   gba_state *state = image.device().machine().driver_data<gba_state>();
src/mess/drivers/vixen.c
r14976r14977
9191{
9292   logerror("CTL %u\n", data);
9393
94   memory_set_bank(machine(), "bank3", BIT(data, 0));
94   membank("bank3")->set_entry(BIT(data, 0));
9595}
9696
9797
r14976r14977
412412void vixen_state::video_start()
413413{
414414   // find memory regions
415   m_sync_rom = machine().region("video")->base();
416   m_char_rom = machine().region("chargen")->base();
415   m_sync_rom = memregion("video")->base();
416   m_char_rom = memregion("chargen")->base();
417417
418418   // register for state saving
419419   save_item(NAME(m_alt));
r14976r14977
783783   // configure memory banking
784784   UINT8 *ram = m_ram->pointer();
785785
786   memory_configure_bank(machine(), "bank1", 0, 1, ram, 0);
787   memory_configure_bank(machine(), "bank1", 1, 1, machine().region(Z8400A_TAG)->base(), 0);
786   membank("bank1")->configure_entry(0, ram);
787   membank("bank1")->configure_entry(1, memregion(Z8400A_TAG)->base());
788788
789   memory_configure_bank(machine(), "bank2", 0, 1, ram, 0);
790   memory_configure_bank(machine(), "bank2", 1, 1, m_video_ram, 0);
789   membank("bank2")->configure_entry(0, ram);
790   membank("bank2")->configure_entry(1, m_video_ram);
791791
792   memory_configure_bank(machine(), "bank3", 0, 1, m_video_ram, 0);
793   memory_configure_bank(machine(), "bank3", 1, 1, machine().region(Z8400A_TAG)->base(), 0);
792   membank("bank3")->configure_entry(0, m_video_ram);
793   membank("bank3")->configure_entry(1, memregion(Z8400A_TAG)->base());
794794
795   memory_configure_bank(machine(), "bank4", 0, 1, m_video_ram, 0);
795   membank("bank4")->configure_entry(0, m_video_ram);
796796
797797   // register for state saving
798798   save_item(NAME(m_reset));
r14976r14977
814814   program->install_read_bank(0x0000, 0xefff, 0xfff, 0, "bank1");
815815   program->install_write_bank(0x0000, 0xefff, 0xfff, 0, "bank2");
816816
817   memory_set_bank(machine(), "bank1", 1);
818   memory_set_bank(machine(), "bank2", 1);
819   memory_set_bank(machine(), "bank3", 1);
817   membank("bank1")->set_entry(1);
818   membank("bank2")->set_entry(1);
819   membank("bank3")->set_entry(1);
820820
821821   m_reset = 1;
822822
r14976r14977
917917         program->install_read_bank(0x0000, 0xefff, "bank1");
918918         program->install_write_bank(0x0000, 0xefff, "bank2");
919919
920         memory_set_bank(machine, "bank1", 0);
921         memory_set_bank(machine, "bank2", 0);
920         state->membank("bank1")->set_entry(0);
921         state->membank("bank2")->set_entry(0);
922922
923923         state->m_reset = 0;
924924      }
925925
926      direct.explicit_configure(0xf000, 0xffff, 0xfff, machine.region(Z8400A_TAG)->base());
926      direct.explicit_configure(0xf000, 0xffff, 0xfff, machine.root_device().memregion(Z8400A_TAG)->base());
927927
928928      return ~0;
929929   }
src/mess/drivers/bmjr.c
r14976r14977
5454static VIDEO_START( bmjr )
5555{
5656   bmjr_state *state = machine.driver_data<bmjr_state>();
57   state->m_p_chargen = machine.region("chargen")->base();
57   state->m_p_chargen = state->memregion("chargen")->base();
5858}
5959
6060static SCREEN_UPDATE_IND16( bmjr )
src/mess/drivers/bbcbc.c
r14976r14977
129129
130130static DEVICE_START( bbcbc_cart )
131131{
132   UINT8 *cart = device->machine().region("maincpu" )->base() + 0x4000;
132   UINT8 *cart = device->machine().root_device().memregion("maincpu" )->base() + 0x4000;
133133
134134   memset( cart, 0xFF, 0x8000 );
135135}
r14976r14977
137137
138138static DEVICE_IMAGE_LOAD( bbcbc_cart )
139139{
140   UINT8 *cart = image.device().machine().region("maincpu" )->base() + 0x4000;
140   UINT8 *cart = image.device().machine().root_device().memregion("maincpu" )->base() + 0x4000;
141141
142142   if ( image.software_entry() == NULL )
143143   {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team