Previous 199869 Revisions Next

r21034 Wednesday 13th February, 2013 at 15:41:03 UTC by Miodrag Milanović
Removal of not needed machine().root_device() (nw)
[src/mame/drivers]1942.c 1943.c 2mindril.c 39in1.c 5clown.c 8080bw.c acefruit.c acesp.c aerofgt.c albazc.c aleck64.c alg.c amaticmg.c ampoker2.c amspdwy.c angelkds.c appoooh.c aquarium.c arcadecl.c arcadia.c aristmk4.c aristmk5.c arkanoid.c ashnojoe.c asterix.c astrafr.c astrocde.c astrocorp.c astrof.c asuka.c atvtrack.c avt.c backfire.c balsente.c baraduke.c battlex.c battlnts.c berzerk.c bfcobra.c bfm_ad5.c bfm_sc1.c bfm_sc2.c bfm_sc4.c bfm_sc5sw.c bfmsys85.c bigevglf.c bingoc.c blitz.c blitz68k.c blmbycar.c bmcbowl.c boogwing.c brkthru.c bublbobl.c bzone.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 cbuster.c cd32.c centiped.c cham24.c champbas.c champbwl.c chanbara.c chihiro.c chinsan.c cischeat.c citycon.c clayshoo.c clshroad.c cmmb.c cninja.c cntsteer.c cobra.c coinmstr.c coinmvga.c commando.c compgolf.c coolpool.c cop01.c corona.c cps1.c cps3.c crospang.c crshrace.c crystal.c cshooter.c cvs.c cybertnk.c cyclemb.c d9final.c dacholer.c dambustr.c darius.c darkmist.c darkseal.c dassault.c dbz.c dcon.c ddayjlc.c ddealer.c ddenlovr.c dec8.c deco156.c deco32.c deco_mlc.c decocass.c discoboy.c dkong.c dmndrby.c dooyong.c dragrace.c drgnmst.c drw80pkr.c dwarfd.c dynadice.c dynax.c enigma2.c eolith.c epos.c equites.c esh.c ettrivia.c exerion.c exidy440.c expro02.c exprraid.c exzisus.c famibox.c fastfred.c fcombat.c fcrash.c feversoc.c fgoal.c firebeat.c fitfight.c flipjack.c foodf.c forte2.c fortecar.c freekick.c funkball.c funworld.c gaelco3d.c gaiden.c galaga.c galaxian.c galgame.c galpani2.c galpani3.c gamecstl.c gaplus.c gauntlet.c gberet.c gei.c ghosteo.c ginganin.c glass.c goal92.c goindol.c goldnpkr.c goldstar.c grchamp.c groundfx.c gticlub.c gundealr.c gunpey.c halleys.c hitme.c hitpoker.c hnayayoi.c hng64.c homedata.c hornet.c hshavoc.c igs009.c igs011.c igs017.c igs_m027.c igspoker.c intrscti.c istellar.c itech32.c itech8.c jack.c jackie.c jackpool.c jailbrek.c jangou.c jantotsu.c jchan.c jclub2.c jokrwild.c jollyjgr.c jongkyo.c jpmsys5.c jrpacman.c junofrst.c kaneko16.c kangaroo.c kas89.c kchamp.c kickgoal.c kingdrby.c kingobox.c koikoi.c konamigx.c konendev.c kontest.c ksys573.c ladybug.c lastduel.c lastfght.c lazercmd.c legionna.c liberate.c looping.c lordgun.c ltcasino.c luckgrln.c m58.c m62.c m63.c m72.c m90.c macs.c madalien.c madmotor.c magictg.c magtouch.c majorpkr.c mappy.c marinedt.c maxaflex.c maygay1b.c maygayep.c mazerbla.c mcr68.c meadows.c megasys1.c megatech.c meijinsn.c merit.c metalmx.c metro.c meyc8088.c midas.c midqslvr.c midzeus.c miniboy7.c mirax.c missb2.c missile.c mitchell.c mlanding.c model1.c model2.c model3.c mogura.c moo.c mouser.c mpu3.c mpu4dealem.c mpu4hw.c mpu4mod2sw.c mpu4mod4yam.c mpu4sw.c mquake.c ms32.c multfish.c multigam.c murogmbl.c mustache.c mw8080bw.c namcofl.c namconb1.c namcos10.c namcos12.c namcos2.c namcos21.c namcos22.c namcos23.c namcos86.c naomi.c nbmj8688.c nbmj8891.c nbmj8900.c nbmj8991.c neodrvr.c neogeo.c neoprint.c nightgal.c ninjakd2.c niyanpai.c nmk16.c norautp.c nova2001.c nycaptor.c ojankohs.c olibochu.c omegrace.c opwolf.c pacman.c panicr.c pasha2.c pbaction.c pcat_nit.c pcktgal.c pcxt.c pengadvb.c pengo.c peplus.c pgm2.c phoenix.c photon.c photon2.c pingpong.c pipedrm.c pipeline.c pirates.c pluto5.c plygonet.c pntnpuzl.c pokechmp.c poker72.c polepos.c poolshrk.c progolf.c psikyo.c psikyo4.c psikyosh.c puckpkmn.c qix.c quantum.c queen.c quizo.c quizshow.c r2dx_v33.c raiden.c raiden2.c rainbow.c rampart.c rastan.c rastersp.c re900.c redalert.c redclash.c relief.c rmhaihai.c rohga.c roul.c route16.c royalmah.c rpunch.c runaway.c sangho.c saturn.c sauro.c savquest.c sbowling.c scregg.c segag80r.c segald.c segas24.c segas32.c seibuspi.c seta.c seta2.c sf.c sfbonus.c sfkick.c shangkid.c shootout.c shougi.c sigmab52.c sigmab98.c silkroad.c silvmil.c simpl156.c skullxbo.c skyarmy.c skyfox.c skykid.c slapshot.c sliver.c snesb.c snk68.c snowbros.c spdodgeb.c speedatk.c spiders.c spoker.c sprint2.c sprint4.c sprint8.c srmp2.c sshangha.c ssv.c st0016.c stactics.c starshp1.c statriv2.c stv.c sub.c subsino.c subsino2.c suna8.c supdrapo.c supercrd.c superdq.c superqix.c supertnk.c suprgolf.c suprloco.c system1.c system16.c tail2nos.c taito_b.c taito_f2.c taito_f3.c taito_l.c taito_z.c tank8.c tankbust.c tatsumi.c tattack.c taxidriv.c tcl.c tecmosys.c tehkanwc.c tempest.c tetrisp2.c thedeep.c thief.c tmaster.c tmnt.c tmspoker.c tnzs.c toaplan2.c toki.c toratora.c tourtabl.c toypop.c trackfld.c travrusa.c triforce.c ttchamp.c tugboat.c tumbleb.c tumblep.c tunhunt.c turbo.c twin16.c twinkle.c uapce.c ultratnk.c undrfire.c upscope.c vaportra.c vega.c vicdual.c videopkr.c viper.c voyager.c wallc.c wardner.c warpsped.c warpwarp.c wc90b.c wecleman.c welltris.c wgp.c wheelfir.c whitestar.c wink.c wiz.c xain.c xorworld.c xtom3d.c xxmissio.c xyonix.c yunsung8.c zaxxon.c zn.c
[src/mame/machine]asteroid.c balsente.c carpolo.c cclimber.c dc-ctrl.c dec0.c gaelco2.c galaxold.c jvs13551.c leland.c mcr68.c megacd.c megadriv.c mexico86.c micro3d.c n64.c naomigd.c naomim1.c naomim2.c naomim4.c opwolf.c pcecommn.c rainbow.c scramble.c segas32.c simpsons.c snesbsx.c subs.c tatsumi.c tnzs.c tx1.c vertigo.c vsnes.c williams.c xevious.c
[src/mame/video]1942.c 1943.c 20pacgal.c 40love.c 8080bw.c alpha68k.c ambush.c ampoker2.c appoooh.c archimds.c atari.c atarisy1.c bagman.c bankp.c baraduke.c bking.c bladestl.c bogeyman.c bosco.c brkthru.c btime.c bwing.c calomega.c canyon.c carjmbre.c carpolo.c ccastles.c cclimber.c centiped.c chaknpop.c champbas.c cheekyms.c cinemat.c circusc.c cloud9.c clshroad.c combatsc.c compgolf.c contra.c cop01.c cosmic.c cps1.c crgolf.c cvs.c darkmist.c dc.c dcheese.c dday.c ddribble.c deadang.c dec8.c decocass.c digdug.c dkong.c docastle.c dogfgt.c dribling.c drmicro.c dynax.c epos.c equites.c espial.c exedexes.c exerion.c exidy440.c fastfred.c fastlane.c fcombat.c fgoal.c finalizr.c firetrap.c firetrk.c flower.c funkybee.c funworld.c fuukifg2.c gaelco3d.c galaga.c galaxian.c galaxold.c galivan.c gaplus.c gberet.c ginganin.c glass.c goldstar.c gomoku.c gotya.c grchamp.c gridlee.c gsword.c gunsmoke.c gyruss.c hanaawas.c hcastle.c higemaru.c homedata.c hyhoo.c hyperspt.c hyprduel.c ikki.c irobot.c ironhors.c jack.c jackal.c jailbrek.c jedi.c karnov.c kchamp.c kingobox.c kncljoe.c konamigx.c kopunch.c ksayakyu.c labyrunr.c ladybug.c lasso.c lazercmd.c leland.c lethalj.c liberate.c liberatr.c lockon.c lucky74.c lvcards.c m52.c m57.c m58.c m62.c m92.c madalien.c magmax.c mainsnk.c mappy.c marineb.c mario.c markham.c matmania.c mcd212.c megasys1.c megazone.c mermaid.c metro.c mikie.c momoko.c mouser.c mrdo.c mrjong.c munchmo.c mustache.c mystston.c mystwarr.c n8080.c namcofl.c namconb1.c namcos86.c naughtyb.c nbmj8688.c nbmj8891.c nbmj8900.c nbmj8991.c nbmj9195.c niyanpai.c nova2001.c ojankohs.c orbit.c pacland.c pacman.c pandoras.c pastelg.c pcktgal.c phoenix.c pingpong.c pitnrun.c playch10.c plygonet.c polepos.c pooyan.c popeye.c popper.c portrait.c prehisle.c psikyo.c pushman.c quasar.c rallyx.c redalert.c redclash.c retofinv.c rockrage.c rocnrope.c rollrace.c route16.c sbasketb.c scotrsht.c segag80r.c segas32.c seibuspi.c seicross.c seta.c sf.c shangkid.c shaolins.c shisen.c shootout.c sidearms.c sidepckt.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 st0016.c stactics.c stfight.c strnskil.c suprloco.c suprnova.c suprridr.c tagteam.c tankbatt.c tceptor.c terracre.c thedeep.c thepit.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 vulgus.c wiping.c wiz.c xevious.c xorworld.c xyonix.c yiear.c zaccaria.c zaxxon.c zodiack.c

trunk/src/mame/machine/jvs13551.c
r21033r21034
148148      return false;
149149   jvs_outputs = vals[0] & 0x3f;
150150   logerror("837-13551: output %02x\n", jvs_outputs);
151   machine().root_device().ioport(port_tag[11])->write_safe(jvs_outputs, 0x3f);
151   ioport(port_tag[11])->write_safe(jvs_outputs, 0x3f);
152152   return true;
153153}
154154
trunk/src/mame/machine/naomigd.c
r21033r21034
394394
395395   UINT64 key;
396396
397   const UINT8 *picdata = machine().root_device().memregion(pic_tag)->base();
397   const UINT8 *picdata = memregion(pic_tag)->base();
398398
399399   if(picdata) {
400      if(machine().root_device().memregion(pic_tag)->bytes() >= 0x4000) {
400      if(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];
trunk/src/mame/machine/williams.c
r21033r21034
628628READ8_MEMBER(williams_state::williams_49way_port_0_r)
629629{
630630   static const UINT8 translate49[7] = { 0x0, 0x4, 0x6, 0x7, 0xb, 0x9, 0x8 };
631   return (translate49[machine().root_device().ioport("49WAYX")->read() >> 4] << 4) | translate49[machine().root_device().ioport("49WAYY")->read() >> 4];
631   return (translate49[ioport("49WAYX")->read() >> 4] << 4) | translate49[ioport("49WAYY")->read() >> 4];
632632}
633633
634634
r21033r21034
745745   MACHINE_START_CALL_MEMBER(williams_common);
746746
747747   /* configure the banking and make sure it is reset to 0 */
748   machine().root_device().membank("bank1")->configure_entries(0, 9, &machine().root_device().memregion("maincpu")->base()[0x10000], 0x1000);
748   membank("bank1")->configure_entries(0, 9, &memregion("maincpu")->base()[0x10000], 0x1000);
749749
750750   machine().save().register_postload(save_prepost_delegate(FUNC(williams_state::defender_postload), this));
751751}
r21033r21034
916916READ8_MEMBER(williams_state::tshoot_input_port_0_3_r)
917917{
918918   /* merge in the gun inputs with the standard data */
919   int data = machine().root_device().ioport("IN0")->read();
919   int data = ioport("IN0")->read();
920920   int gun = (data & 0x3f) ^ ((data & 0x3f) >> 1);
921921   return (data & 0xc0) | gun;
922922
trunk/src/mame/machine/naomim4.c
r21033r21034
4545{
4646   naomi_board::device_start();
4747
48   const UINT8 *key_data = machine().root_device().memregion(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);
trunk/src/mame/machine/tx1.c
r21033r21034
656656             TODO make this constant somewhere
657657             e.g. math.retval =  math.romptr[ get_tx1_datarom_addr() ];
658658         */
659         UINT16 *romdata = (UINT16*)machine().root_device().memregion("au_data")->base();
659         UINT16 *romdata = (UINT16*)memregion("au_data")->base();
660660         UINT16 addr = get_tx1_datarom_addr(math);
661661         math.retval = romdata[addr];
662662      }
r21033r21034
803803READ16_MEMBER(tx1_state::tx1_spcs_rom_r)
804804{
805805   math_t &math = m_math;
806   math.cpulatch = *(UINT16*)((UINT8*)machine().root_device().memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2);
806   math.cpulatch = *(UINT16*)((UINT8*)memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2);
807807
808808   if (math.mux == TX1_SEL_ILDEN)
809809   {
r21033r21034
11321132   /* /DPROE */
11331133   else if ((offset & 0xc00) == 0xc00)
11341134   {
1135      UINT16 *romdata = (UINT16*)machine().root_device().memregion("au_data")->base();
1135      UINT16 *romdata = (UINT16*)memregion("au_data")->base();
11361136      UINT16 addr = get_bb_datarom_addr(math);
11371137
11381138      math.retval = romdata[addr];
r21033r21034
12651265READ16_MEMBER(tx1_state::buggyboy_spcs_rom_r)
12661266{
12671267   math_t &math = m_math;
1268   math.cpulatch = *(UINT16*)((UINT8*)machine().root_device().memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2);
1268   math.cpulatch = *(UINT16*)((UINT8*)memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2);
12691269
12701270   if (math.mux == BB_MUX_ILDEN)
12711271   {
trunk/src/mame/machine/gaelco2.c
r21033r21034
2222   int i;
2323
2424   /* get a pointer to the source data */
25   UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base();
25   UINT8 *src = (UINT8 *)memregion(src_reg)->base();
2626
2727   /* get a pointer to the destination data */
28   UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base();
28   UINT8 *dst = (UINT8 *)memregion(dst_reg)->base();
2929
3030   /* fill destination areas with the proper data */
3131   for (i = 0; i < length/2; i++){
trunk/src/mame/machine/asteroid.c
r21033r21034
1616INTERRUPT_GEN_MEMBER(asteroid_state::asteroid_interrupt)
1717{
1818   /* Turn off interrupts if self-test is enabled */
19   if (!(machine().root_device().ioport("IN0")->read() & 0x80))
19   if (!(ioport("IN0")->read() & 0x80))
2020      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
2121}
2222
2323INTERRUPT_GEN_MEMBER(asteroid_state::asterock_interrupt)
2424{
2525   /* Turn off interrupts if self-test is enabled */
26   if ((machine().root_device().ioport("IN0")->read() & 0x80))
26   if ((ioport("IN0")->read() & 0x80))
2727      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
2828}
2929
3030INTERRUPT_GEN_MEMBER(asteroid_state::llander_interrupt)
3131{
3232   /* Turn off interrupts if self-test is enabled */
33   if (machine().root_device().ioport("IN0")->read() & 0x02)
33   if (ioport("IN0")->read() & 0x02)
3434      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
3535}
3636
trunk/src/mame/machine/rainbow.c
r21033r21034
756756   coin_counter_w(machine(), 1, m_CRAM[0][8] & 0x20);
757757   coin_counter_w(machine(), 0, m_CRAM[0][8] & 0x10);
758758
759   m_CRAM[0][3] = machine().root_device().ioport("800007")->read();    /* STARTn + SERVICE1 */
760   m_CRAM[0][4] = machine().root_device().ioport("800009")->read();    /* COINn */
761   m_CRAM[0][5] = machine().root_device().ioport("80000B")->read();    /* Player controls + TILT */
762   m_CRAM[0][6] = machine().root_device().ioport("80000D")->read();    /* Player controls (cocktail) */
759   m_CRAM[0][3] = ioport("800007")->read();    /* STARTn + SERVICE1 */
760   m_CRAM[0][4] = ioport("800009")->read();    /* COINn */
761   m_CRAM[0][5] = ioport("80000B")->read();    /* Player controls + TILT */
762   m_CRAM[0][6] = ioport("80000D")->read();    /* Player controls (cocktail) */
763763}
764764
765765/*************************************
trunk/src/mame/machine/xevious.c
r21033r21034
165165   switch ( offset )
166166   {
167167      default:
168      case 0: return ~BITSWAP8(machine().root_device().ioport("IN0H")->read(),7,6,5,4,2,3,1,0);
169      case 1: return ~machine().root_device().ioport("IN1L")->read();
170      case 2: return ~machine().root_device().ioport("IN1H")->read();
171      case 3: return ~machine().root_device().ioport("IN0L")->read();
168      case 0: return ~BITSWAP8(ioport("IN0H")->read(),7,6,5,4,2,3,1,0);
169      case 1: return ~ioport("IN1L")->read();
170      case 2: return ~ioport("IN1H")->read();
171      case 3: return ~ioport("IN0L")->read();
172172   }
173173}
174174
trunk/src/mame/machine/opwolf.c
r21033r21034
416416      if (offset == 0x14)
417417      {
418418#if OPWOLF_READ_COINAGE_FROM_ROM
419         UINT16* rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
419         UINT16* rom = (UINT16*)memregion("maincpu")->base();
420420         UINT32 coin_table[2] = {0, 0};
421421         UINT8 coin_offset[2];
422422         int slot;
trunk/src/mame/machine/balsente.c
r21033r21034
5252      /* we latch the beam values on the first interrupt after VBLANK */
5353      if (param == 64)
5454      {
55         m_shooter_x = machine().root_device().ioport("FAKEX")->read();
56         m_shooter_y = machine().root_device().ioport("FAKEY")->read();
55         m_shooter_x = ioport("FAKEX")->read();
56         m_shooter_y = ioport("FAKEY")->read();
5757      }
5858
5959      /* which bits get returned depends on which scanline we're at */
r21033r21034
278278   int bank = data & 7;
279279
280280   /* top bit controls which half of the ROMs to use (Name that Tune only) */
281   if (machine().root_device().memregion("maincpu")->bytes() > 0x40000) bank |= (data >> 4) & 8;
281   if (memregion("maincpu")->bytes() > 0x40000) bank |= (data >> 4) & 8;
282282
283283   /* when they set the AB bank, it appears as though the CD bank is reset */
284284   if (data & 0x20)
r21033r21034
548548   /* ports are read once a frame, just at varying intervals. To get around this, we */
549549   /* read all the analog inputs at VBLANK time and just return the cached values. */
550550   for (i = 0; i < 4; i++)
551      m_analog_input_data[i] = machine().root_device().ioport(analog[i])->read();
551      m_analog_input_data[i] = ioport(analog[i])->read();
552552}
553553
554554
trunk/src/mame/machine/megadriv.c
r21033r21034
12101210      //printf("GENESIS Sound Z80 cpu found '%s'\n", _genesis_snd_z80_cpu->tag() );
12111211
12121212      genz80.z80_prgram = auto_alloc_array(machine(), UINT8, 0x2000);
1213      machine().root_device().membank("bank1")->set_base(genz80.z80_prgram );
1213      membank("bank1")->set_base(genz80.z80_prgram );
12141214   }
12151215
12161216   /* Look to see if this system has the 32x Master SH2 */
r21033r21034
12601260        some games specify a single address, (start 200001, end 200001)
12611261        this usually means there is serial eeprom instead */
12621262      int i;
1263      UINT16 *rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
1263      UINT16 *rom = (UINT16*)memregion("maincpu")->base();
12641264
12651265      mame_printf_debug("DEBUG:: Header: Backup RAM string (ignore for games without)\n");
12661266      for (i=0;i<12;i++)
r21033r21034
13791379{
13801380   md_base_state *state = screen.machine().driver_data<md_base_state>();
13811381
1382   if (screen.machine().root_device().ioport(":RESET")->read_safe(0x00) & 0x01)
1382   if (screen.ioport(":RESET")->read_safe(0x00) & 0x01)
13831383      screen.machine().device(":maincpu")->execute().set_input_line(INPUT_LINE_RESET, PULSE_LINE);
13841384
13851385   // rising edge
trunk/src/mame/machine/mexico86.c
r21033r21034
6565      int i;
6666      int coin_curr;
6767
68      coin_curr = ~machine().root_device().ioport("IN0")->read() & 1;
68      coin_curr = ~ioport("IN0")->read() & 1;
6969      if (coin_curr && !m_coin_last && m_protection_ram[0x01] < 9)
7070      {
7171         m_protection_ram[0x01]++;    // increase credits counter
r21033r21034
7575
7676      m_protection_ram[0x04] = 0x3c;   // coin inputs
7777
78      m_protection_ram[0x02] = BITSWAP8(machine().root_device().ioport("IN1")->read(), 7,6,5,4,2,3,1,0); // player 1
79      m_protection_ram[0x03] = BITSWAP8(machine().root_device().ioport("IN2")->read(), 7,6,5,4,2,3,1,0); // player 2
78      m_protection_ram[0x02] = BITSWAP8(ioport("IN1")->read(), 7,6,5,4,2,3,1,0); // player 1
79      m_protection_ram[0x03] = BITSWAP8(ioport("IN2")->read(), 7,6,5,4,2,3,1,0); // player 2
8080
8181      if (m_protection_ram[0x19] == 0xaa)  // player 2 active
8282         m_protection_ram[0x1b] = m_protection_ram[0x03];
trunk/src/mame/machine/snesbsx.c
r21033r21034
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().root_device().memregion("flash")->base() : bsx_state.pram;
51//  UINT8 *RAM = (bsx_state.cart_regs[0x01] & 0x80) == 0x00 ? space.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))
r21033r21034
148148#ifdef UNUSED_FUNCTION
149149static READ8_HANDLER( bsx_flash_read )
150150{
151   UINT8 *FLASH = space.machine().root_device().memregion("flash")->base();
151   UINT8 *FLASH = space.memregion("flash")->base();
152152
153153   if (offset == 0x0002)
154154   {
trunk/src/mame/machine/carpolo.c
r21033r21034
238238         case 3: movement_flip_flop = m_ttl7474_1a_1;    dir_flip_flop = m_ttl7474_1a_2; break;
239239      }
240240
241      port_value = machine().root_device().ioport(portnames[player])->read();
241      port_value = ioport(portnames[player])->read();
242242
243243      if (port_value != m_last_wheel_value[player])
244244      {
r21033r21034
256256
257257
258258   /* finally read the accelerator pedals */
259   port_value = machine().root_device().ioport("PEDALS")->read();
259   port_value = ioport("PEDALS")->read();
260260
261261   for (player = 0; player < 4; player++)
262262   {
trunk/src/mame/machine/n64.c
r21033r21034
7070
7171void n64_periphs::device_reset()
7272{
73   UINT32 *cart = (UINT32*)machine().root_device().memregion("user2")->base();
73   UINT32 *cart = (UINT32*)memregion("user2")->base();
7474
7575   maincpu = machine().device("maincpu");
7676   rspcpu = machine().device("rsp");
r21033r21034
14111411
14121412void n64_periphs::pi_dma_tick()
14131413{
1414   UINT16 *cart16 = (UINT16*)machine().root_device().memregion("user2")->base();
1414   UINT16 *cart16 = (UINT16*)memregion("user2")->base();
14151415   UINT16 *dram16 = (UINT16*)rdram;
14161416
14171417   UINT32 cart_addr = (pi_cart_addr & 0x0fffffff) >> 1;
r21033r21034
14241424   }
14251425   else if((cart_addr & 0x03000000) == 0x03000000 && dd_present)
14261426   {
1427      cart16 = (UINT16*)machine().root_device().memregion("ddipl")->base();
1427      cart16 = (UINT16*)memregion("ddipl")->base();
14281428      cart_addr = (pi_cart_addr & 0x003fffff) >> 1;
14291429   }
14301430   else
14311431   {
1432      cart_addr &= ((machine().root_device().memregion("user2")->bytes() >> 1) - 1);
1432      cart_addr &= ((memregion("user2")->bytes() >> 1) - 1);
14331433   }
14341434
14351435   //printf("%08x Cart, %08x Dram\n", cart_addr << 1, dram_addr << 1); fflush(stdout);
r21033r21034
17801780            case 1: //p2 inputs
17811781            {
17821782               //printf("Read p%d inputs\n", channel + 1);
1783               buttons = machine().root_device().ioport(portnames[(channel*3) + 0])->read();
1784               x = machine().root_device().ioport(portnames[(channel*3) + 1])->read() - 128;
1785               y = machine().root_device().ioport(portnames[(channel*3) + 2])->read() - 128;
1783               buttons = ioport(portnames[(channel*3) + 0])->read();
1784               x = ioport(portnames[(channel*3) + 1])->read() - 128;
1785               y = ioport(portnames[(channel*3) + 2])->read() - 128;
17861786
17871787               rdata[0] = (buttons >> 8) & 0xff;
17881788               rdata[1] = (buttons >> 0) & 0xff;
trunk/src/mame/machine/cclimber.c
r21033r21034
77void cclimber_state::cclimber_decode(const UINT8 convtable[8][16])
88{
99   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
10   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
10   UINT8 *rom = memregion("maincpu")->base();
1111   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000);
1212   int A;
1313
r21033r21034
6868DRIVER_INIT_MEMBER(cclimber_state,ckongb)
6969{
7070   int A;
71   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
71   UINT8 *rom = memregion("maincpu")->base();
7272
7373   for (A = 0x0000;A < 0x6000;A++) /* all the program ROMs are encrypted */
7474   {
r21033r21034
7979#if CANNONB_HACK
8080void ::cannonb_patch()
8181{
82   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
82   UINT8 *rom = memregion("maincpu")->base();
8383
8484   rom[0x2ba0] = 0x21;
8585   rom[0x2ba1] = 0xfb;
r21033r21034
9191DRIVER_INIT_MEMBER(cclimber_state,cannonb)
9292{
9393   int A;
94   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
94   UINT8 *rom = memregion("maincpu")->base();
9595
9696   for (A = 0x0000;A < 0x1000;A++) /* only first ROM is encrypted */
9797   {
trunk/src/mame/machine/dec0.c
r21033r21034
347347void dec0_state::h6280_decrypt(const char *cputag)
348348{
349349   int i;
350   UINT8 *RAM = machine().root_device().memregion(cputag)->base();
350   UINT8 *RAM = memregion(cputag)->base();
351351
352352   /* Read each byte, decrypt it */
353353   for (i = 0x00000; i < 0x10000; i++)
r21033r21034
356356
357357DRIVER_INIT_MEMBER(dec0_state,hippodrm)
358358{
359   UINT8 *RAM = machine().root_device().memregion("sub")->base();
359   UINT8 *RAM = memregion("sub")->base();
360360   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x180000, 0x180fff, read16_delegate(FUNC(dec0_state::hippodrm_68000_share_r),this), write16_delegate(FUNC(dec0_state::hippodrm_68000_share_w),this));
361361   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xffc800, 0xffcfff, write16_delegate(FUNC(dec0_state::sprite_mirror_w),this));
362362
r21033r21034
371371
372372DRIVER_INIT_MEMBER(dec0_state,slyspy)
373373{
374   UINT8 *RAM = machine().root_device().memregion("audiocpu")->base();
374   UINT8 *RAM = memregion("audiocpu")->base();
375375
376376   h6280_decrypt("audiocpu");
377377
trunk/src/mame/machine/vertigo.c
r21033r21034
141141INTERRUPT_GEN_MEMBER(vertigo_state::vertigo_interrupt)
142142{
143143   /* Coin inputs cause IRQ6 */
144   if ((machine().root_device().ioport("COIN")->read() & 0x7) < 0x7)
144   if ((ioport("COIN")->read() & 0x7) < 0x7)
145145      update_irq_encoder(INPUT_LINE_IRQ6, ASSERT_LINE);
146146}
147147
trunk/src/mame/machine/simpsons.c
r21033r21034
111111   m_video_bank = 0;
112112
113113   /* init the default banks */
114   membank("bank1")->configure_entries(0, 64, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
114   membank("bank1")->configure_entries(0, 64, memregion("maincpu")->base() + 0x10000, 0x2000);
115115   membank("bank1")->set_entry(0);
116116
117   membank("bank2")->configure_entries(0, 2, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0);
118   membank("bank2")->configure_entries(2, 6, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
117   membank("bank2")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0);
118   membank("bank2")->configure_entries(2, 6, memregion("audiocpu")->base() + 0x10000, 0x4000);
119119   membank("bank2")->set_entry(0);
120120
121121   simpsons_video_banking(0);
trunk/src/mame/machine/subs.c
r21033r21034
2525INTERRUPT_GEN_MEMBER(subs_state::subs_interrupt)
2626{
2727   /* only do NMI interrupt if not in TEST mode */
28   if ((machine().root_device().ioport("IN1")->read() & 0x40)==0x40)
28   if ((ioport("IN1")->read() & 0x40)==0x40)
2929      device.execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
3030}
3131
trunk/src/mame/machine/tatsumi.c
r21033r21034
293293
294294READ16_MEMBER(tatsumi_state::tatsumi_v30_68000_r)
295295{
296   const UINT16* rom=(UINT16*)machine().root_device().memregion("sub")->base();
296   const UINT16* rom=(UINT16*)memregion("sub")->base();
297297
298298logerror("%05X:68000_r(%04X),cw=%04X\n", space.device().safe_pc(), offset*2, m_control_word);
299299   /* Read from 68k RAM */
trunk/src/mame/machine/tnzs.c
r21033r21034
673673MACHINE_START_MEMBER(tnzs_state,jpopnics)
674674{
675675   UINT8 *SUB = memregion("sub")->base();
676   m_ROM = machine().root_device().memregion("maincpu")->base();
676   m_ROM = memregion("maincpu")->base();
677677   m_bankedram = auto_alloc_array(machine(), UINT8, 0x8000); // 2 banks of 0x4000
678678
679679   membank("subbank")->configure_entries(0, 4, &SUB[0x08000], 0x2000);
trunk/src/mame/machine/naomim1.c
r21033r21034
3131{
3232   naomi_board::device_start();
3333
34   const UINT8 *key_data = machine().root_device().memregion(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
trunk/src/mame/machine/dc-ctrl.c
r21033r21034
7272{
7373   dest[0] = 0x20000000; // Controller
7474   dest[1] =
75      ((machine().root_device().ioport(port_tag[2]) != NULL) ? 0x010000 : 0) |
76      ((machine().root_device().ioport(port_tag[3]) != NULL) ? 0x020000 : 0) |
77      ((machine().root_device().ioport(port_tag[4]) != NULL) ? 0x040000 : 0) |
78      ((machine().root_device().ioport(port_tag[5]) != NULL) ? 0x080000 : 0) |
79      ((machine().root_device().ioport(port_tag[6]) != NULL) ? 0x100000 : 0) |
80      ((machine().root_device().ioport(port_tag[7]) != NULL) ? 0x200000 : 0) |
81      (machine().root_device().ioport(port_tag[0])->active_safe(0) << 8) |
82      machine().root_device().ioport(port_tag[1])->active_safe(0); // 1st function - controller
75      ((ioport(port_tag[2]) != NULL) ? 0x010000 : 0) |
76      ((ioport(port_tag[3]) != NULL) ? 0x020000 : 0) |
77      ((ioport(port_tag[4]) != NULL) ? 0x040000 : 0) |
78      ((ioport(port_tag[5]) != NULL) ? 0x080000 : 0) |
79      ((ioport(port_tag[6]) != NULL) ? 0x100000 : 0) |
80      ((ioport(port_tag[7]) != NULL) ? 0x200000 : 0) |
81      (ioport(port_tag[0])->active_safe(0) << 8) |
82      ioport(port_tag[1])->active_safe(0); // 1st function - controller
8383   dest[2] = 0; // No 2nd function
8484   dest[3] = 0; // No 3rd function
8585   dest[4] = 0x00ff; // Every region, no expansion
trunk/src/mame/machine/vsnes.c
r21033r21034
427427{
428428   /* We do manual banking, in case the code falls through */
429429   /* Copy the initial banks */
430   UINT8 *prg = machine().root_device().memregion("maincpu")->base();
430   UINT8 *prg = memregion("maincpu")->base();
431431   memcpy(&prg[0x08000], &prg[0x18000], 0x8000);
432432
433433   /* banking is done with writes to the $8000-$ffff area */
r21033r21034
944944   /* when starting a mapper 68 game  the first 16K ROM bank in the cart is loaded into $8000
945945   the LAST 16K ROM bank is loaded into $C000. The last 16K of ROM cannot be swapped. */
946946
947   UINT8 *prg = machine().root_device().memregion("maincpu")->base();
947   UINT8 *prg = memregion("maincpu")->base();
948948   memcpy(&prg[0x08000], &prg[0x10000], 0x4000);
949949   memcpy(&prg[0x0c000], &prg[0x2c000], 0x4000);
950950
r21033r21034
10011001
10021002DRIVER_INIT_MEMBER(vsnes_state,vsdual)
10031003{
1004   UINT8 *prg = machine().root_device().memregion("maincpu")->base();
1004   UINT8 *prg = memregion("maincpu")->base();
10051005
10061006   /* vrom switching is enabled with bit 2 of $4016 */
10071007   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(vsnes_state::vsdual_vrom_banking),this));
trunk/src/mame/machine/micro3d.c
r21033r21034
313313      case 0x08:
314314      {
315315         int i;
316         const UINT16 *rom = (UINT16*)machine().root_device().memregion("vertex")->base();
316         const UINT16 *rom = (UINT16*)memregion("vertex")->base();
317317
318318         for (i = 0; i <= cnt; ++i)
319319         {
r21033r21034
352352      case 0x0c:
353353      {
354354         int i;
355         const UINT16 *rom = (UINT16*)machine().root_device().memregion("vertex")->base();
355         const UINT16 *rom = (UINT16*)memregion("vertex")->base();
356356
357357         for (i = 0; i <= cnt; ++i)
358358         {
r21033r21034
385385      case 0x0f:
386386      {
387387         int i;
388         const UINT16 *rom = (UINT16*)machine().root_device().memregion("vertex")->base();
388         const UINT16 *rom = (UINT16*)memregion("vertex")->base();
389389
390390         for (i = 0; i <= cnt; ++i, vtx_addr += 4)
391391         {
trunk/src/mame/machine/megacd.c
r21033r21034
15761576
15771577   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
15781578
1579   segacd_font_bits = reinterpret_cast<UINT16 *>(machine().root_device().memshare(":segacd:segacd_font")->ptr());
1580   segacd_backupram = reinterpret_cast<UINT16 *>(machine().root_device().memshare(":segacd:backupram")->ptr());
1581   segacd_dataram = reinterpret_cast<UINT16 *>(machine().root_device().memshare(":segacd:dataram")->ptr());
1582//  segacd_dataram2 = reinterpret_cast<UINT16 *>(machine().root_device().memshare(":segacd:dataram2")->ptr());
1583   segacd_4meg_prgram = reinterpret_cast<UINT16 *>(machine().root_device().memshare(":segacd:segacd_program")->ptr());
1579   segacd_font_bits = reinterpret_cast<UINT16 *>(memshare(":segacd:segacd_font")->ptr());
1580   segacd_backupram = reinterpret_cast<UINT16 *>(memshare(":segacd:backupram")->ptr());
1581   segacd_dataram = reinterpret_cast<UINT16 *>(memshare(":segacd:dataram")->ptr());
1582//  segacd_dataram2 = reinterpret_cast<UINT16 *>(memshare(":segacd:dataram2")->ptr());
1583   segacd_4meg_prgram = reinterpret_cast<UINT16 *>(memshare(":segacd:segacd_program")->ptr());
15841584
15851585   segacd_4meg_prgbank = 0;
15861586
trunk/src/mame/machine/scramble.c
r21033r21034
2525
2626MACHINE_RESET_MEMBER(scramble_state,explorer)
2727{
28   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
28   UINT8 *RAM = memregion("maincpu")->base();
2929   RAM[0x47ff] = 0; /* If not set, it doesn't reset after the 1st time */
3030
3131   MACHINE_RESET_CALL_MEMBER(galaxold);
r21033r21034
188188   /* extra ROM */
189189   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5800, 0x67ff, "bank1");
190190   machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x5800, 0x67ff);
191   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x5800);
191   membank("bank1")->set_base(memregion("maincpu")->base() + 0x5800);
192192
193193   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x9008, 0x9008, read8_delegate(FUNC(scramble_state::mariner_protection_2_r),this));
194194   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xb401, 0xb401, read8_delegate(FUNC(scramble_state::mariner_protection_1_r),this));
r21033r21034
204204   UINT8 *ROM;
205205
206206   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
207   ROM = machine().root_device().memregion("audiocpu")->base();
207   ROM = memregion("audiocpu")->base();
208208   for (A = 0;A < 0x0800;A++)
209209      ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
210210
211211   /* likewise, the 2nd gfx ROM has data lines D0 and D1 swapped. Decode it. */
212   ROM = machine().root_device().memregion("gfx1")->base();
212   ROM = memregion("gfx1")->base();
213213   for (A = 0x0800;A < 0x1000;A++)
214214      ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
215215}
r21033r21034
220220   UINT8 *ROM;
221221
222222   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
223   ROM = machine().root_device().memregion("audiocpu")->base();
223   ROM = memregion("audiocpu")->base();
224224   for (A = 0;A < 0x0800;A++)
225225      ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
226226}
r21033r21034
238238   /* A2 -> A3 */
239239   /* A3 -> A1 */
240240
241   RAM = machine().root_device().memregion("maincpu")->base();
241   RAM = memregion("maincpu")->base();
242242   for (i = 0; i < 0x10000; i += 16)
243243   {
244244      offs_t j;
r21033r21034
264264{
265265   /* protection??? The game jumps into never-neverland here. I think
266266      it just expects a RET there */
267   machine().root_device().memregion("maincpu")->base()[0x2ef9] = 0xc9;
267   memregion("maincpu")->base()[0x2ef9] = 0xc9;
268268}
269269
270270DRIVER_INIT_MEMBER(scramble_state,cavelon)
r21033r21034
314314      { 0x80,0x87,0x81,0x87,0x83,0x00,0x84,0x01,0x01,0x86,0x86,0x80,0x86,0x00,0x86,0x86 }
315315   };
316316
317   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
317   UINT8 *ROM = memregion("maincpu")->base();
318318   int A, ctr = 0, line, col;
319319
320320   for( A = 0; A < 0x4000; A++ )
r21033r21034
359359   *   Optimizations done by Fabio Buffoni
360360   */
361361
362   RAM = machine().root_device().memregion("gfx1")->base();
363   len = machine().root_device().memregion("gfx1")->bytes();
362   RAM = memregion("gfx1")->base();
363   len = memregion("gfx1")->bytes();
364364
365365   scratch = alloc_array_or_die(UINT8, len);
366366
r21033r21034
397397   *   Optimizations done by Fabio Buffoni
398398   */
399399
400   RAM = machine().root_device().memregion("gfx1")->base();
401   len = machine().root_device().memregion("gfx1")->bytes();
400   RAM = memregion("gfx1")->base();
401   len = memregion("gfx1")->bytes();
402402
403403   scratch = auto_alloc_array(machine(), UINT8, len);
404404
r21033r21034
433433   *   Code To Decode Minefield by Mike Balfour and Nicola Salmoria
434434   */
435435
436   RAM = machine().root_device().memregion("gfx1")->base();
437   len = machine().root_device().memregion("gfx1")->bytes();
436   RAM = memregion("gfx1")->base();
437   len = memregion("gfx1")->bytes();
438438
439439   scratch = auto_alloc_array(machine(), UINT8, len);
440440
r21033r21034
472472   *   Optimizations done by Fabio Buffoni
473473   */
474474
475   RAM = machine().root_device().memregion("gfx1")->base();
476   len = machine().root_device().memregion("gfx1")->bytes();
475   RAM = memregion("gfx1")->base();
476   len = memregion("gfx1")->bytes();
477477
478478   scratch = alloc_array_or_die(UINT8, len);
479479
r21033r21034
499499DRIVER_INIT_MEMBER(scramble_state,hustler)
500500{
501501   offs_t A;
502   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
502   UINT8 *rom = memregion("maincpu")->base();
503503
504504
505505   for (A = 0;A < 0x4000;A++)
r21033r21034
527527
528528   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
529529   {
530      rom = machine().root_device().memregion("audiocpu")->base();
530      rom = memregion("audiocpu")->base();
531531
532532
533533      for (A = 0;A < 0x0800;A++)
r21033r21034
539539{
540540   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
541541   offs_t A;
542   UINT8 *rom = machine().root_device().memregion("audiocpu")->base();
542   UINT8 *rom = memregion("audiocpu")->base();
543543
544544
545545   for (A = 0;A < 0x0800;A++)
r21033r21034
549549DRIVER_INIT_MEMBER(scramble_state,billiard)
550550{
551551   offs_t A;
552   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
552   UINT8 *rom = memregion("maincpu")->base();
553553
554554
555555   for (A = 0;A < 0x4000;A++)
r21033r21034
579579
580580   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
581581   {
582      rom = machine().root_device().memregion("audiocpu")->base();
582      rom = memregion("audiocpu")->base();
583583
584584
585585      for (A = 0;A < 0x0800;A++)
r21033r21034
607607DRIVER_INIT_MEMBER(scramble_state,ad2083)
608608{
609609   UINT8 c;
610   int i, len = machine().root_device().memregion("maincpu")->bytes();
611   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
610   int i, len = memregion("maincpu")->bytes();
611   UINT8 *ROM = memregion("maincpu")->base();
612612
613613   for (i=0; i<len; i++)
614614   {
r21033r21034
672672
673673DRIVER_INIT_MEMBER(scramble_state,harem)
674674{
675   UINT8 *ROM      =   machine().root_device().memregion("maincpu")->base() + 0x8000;
675   UINT8 *ROM      =   memregion("maincpu")->base() + 0x8000;
676676   size_t size     =   0x2000;
677677
678678   UINT8 *data     =   m_harem_decrypted_data      = auto_alloc_array(machine(), UINT8, size * 3);
trunk/src/mame/machine/naomim2.c
r21033r21034
2020{
2121   naomi_board::device_start();
2222
23   const UINT8 *key_data = machine().root_device().memregion(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);
trunk/src/mame/machine/segas32.c
r21033r21034
3636void segas32_state::decrypt_ga2_protrom()
3737{
3838   int i;
39   UINT8 *rom = machine().root_device().memregion("mcu")->base();
39   UINT8 *rom = memregion("mcu")->base();
4040   UINT8* temp = auto_alloc_array(machine(), UINT8, 0x100000);
4141
4242   // make copy of ROM so original can be overwritten
trunk/src/mame/machine/pcecommn.c
r21033r21034
3838
3939UINT8 pce_common_state::joy_read()
4040{
41   return machine().root_device().ioport("JOY")->read();
41   return ioport("JOY")->read();
4242}
4343
4444READ8_MEMBER(pce_common_state::pce_joystick_r)
trunk/src/mame/machine/mcr68.c
r21033r21034
2020
2121READ8_MEMBER(mcr68_state::zwackery_port_1_r)
2222{
23   UINT8 ret = machine().root_device().ioport("IN1")->read();
23   UINT8 ret = ioport("IN1")->read();
2424
2525   downcast<pia6821_device *>(machine().device("pia1"))->set_port_a_z_mask(ret);
2626
r21033r21034
3030
3131READ8_MEMBER(mcr68_state::zwackery_port_3_r)
3232{
33   UINT8 ret = machine().root_device().ioport("IN3")->read();
33   UINT8 ret = ioport("IN3")->read();
3434
3535   downcast<pia6821_device *>(machine().device("pia2"))->set_port_a_z_mask(ret);
3636
trunk/src/mame/machine/galaxold.c
r21033r21034
164164
165165DRIVER_INIT_MEMBER(galaxold_state,zigzag)
166166{
167   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
168   machine().root_device().membank("bank1")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
169   machine().root_device().membank("bank2")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
170   machine().root_device().membank("bank1")->set_entry(0);
171   machine().root_device().membank("bank2")->set_entry(1);
167   UINT8 *RAM = memregion("maincpu")->base();
168   membank("bank1")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
169   membank("bank2")->configure_entries(0, 2, &RAM[0x2000], 0x1000);
170   membank("bank1")->set_entry(0);
171   membank("bank2")->set_entry(1);
172172}
173173
174174
r21033r21034
192192DRIVER_INIT_MEMBER(galaxold_state,dingoe)
193193{
194194   offs_t i;
195   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
195   UINT8 *rom = memregion("maincpu")->base();
196196
197197   for (i = 0; i < 0x3000; i++)
198198   {
r21033r21034
299299
300300DRIVER_INIT_MEMBER(galaxold_state,mooncrst)
301301{
302   offs_t i, len = machine().root_device().memregion("maincpu")->bytes();
303   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
302   offs_t i, len = memregion("maincpu")->bytes();
303   UINT8 *rom = memregion("maincpu")->base();
304304
305305
306306   for (i = 0;i < len;i++)
r21033r21034
318318{
319319   offs_t i;
320320   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
321   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
321   UINT8 *rom = memregion("maincpu")->base();
322322   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
323323
324324   space.set_decrypted_region(0x0000, 0x7fff, decrypt);
r21033r21034
376376      { 1,4,1,4 }
377377   };
378378
379   offs_t i, len = machine().root_device().memregion("maincpu")->bytes();
380   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
379   offs_t i, len = memregion("maincpu")->bytes();
380   UINT8 *rom = memregion("maincpu")->base();
381381
382382
383383   for (i = 0; i < len; i++)
r21033r21034
427427   int i;
428428
429429   // patch char supposed to be space
430   UINT8 *gfxrom = machine().root_device().memregion("gfx1")->base();
430   UINT8 *gfxrom = memregion("gfx1")->base();
431431   for (i = 0; i < 8; i++)
432432   {
433433      gfxrom[i] = 0;
trunk/src/mame/machine/leland.c
r21033r21034
445445INTERRUPT_GEN_MEMBER(leland_state::leland_master_interrupt)
446446{
447447   /* check for coins here */
448   if ((machine().root_device().ioport("IN1")->read() & 0x0e) != 0x0e)
448   if ((ioport("IN1")->read() & 0x0e) != 0x0e)
449449      device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
450450}
451451
r21033r21034
810810
811811READ8_MEMBER(leland_state::ataxx_eeprom_r)
812812{
813   int port = machine().root_device().ioport("IN2")->read();
813   int port = ioport("IN2")->read();
814814   if (LOG_EEPROM) logerror("%s:EE read\n", machine().describe_context());
815815   return port;
816816}
r21033r21034
14001400void leland_state::leland_rotate_memory(const char *cpuname)
14011401{
14021402   int startaddr = 0x10000;
1403   int banks = (machine().root_device().memregion(cpuname)->bytes() - startaddr) / 0x8000;
1404   UINT8 *ram = machine().root_device().memregion(cpuname)->base();
1403   int banks = (memregion(cpuname)->bytes() - startaddr) / 0x8000;
1404   UINT8 *ram = memregion(cpuname)->base();
14051405   UINT8 temp[0x2000];
14061406   int i;
14071407
trunk/src/mame/video/turbo.c
r21033r21034
264264
265265void turbo_state::turbo_prepare_sprites(UINT8 y, sprite_info *info)
266266{
267   const UINT8 *pr1119 = machine().root_device().memregion("proms")->base() + 0x200;
267   const UINT8 *pr1119 = memregion("proms")->base() + 0x200;
268268   int sprnum;
269269
270270   /* initialize the line enable signals to 0 */
r21033r21034
322322                 VR1 = 310 Ohm
323323                 VR2 = 910 Ohm
324324         */
325         info->step[level] = sprite_xscale(xscale, 1.0e3 * machine().root_device().ioport("VR1")->read() / 100.0, 1.0e3 * machine().root_device().ioport("VR2")->read() / 100.0, 100e-12);
325         info->step[level] = sprite_xscale(xscale, 1.0e3 * ioport("VR1")->read() / 100.0, 1.0e3 * ioport("VR2")->read() / 100.0, 100e-12);
326326      }
327327   }
328328}
r21033r21034
385385UINT32 turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
386386{
387387   bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap();
388   const UINT8 *road_gfxdata = machine().root_device().memregion("gfx3")->base();
388   const UINT8 *road_gfxdata = memregion("gfx3")->base();
389389   const UINT8 *prom_base = memregion("proms")->base();
390390   const UINT8 *pr1114 = prom_base + 0x000;
391391   const UINT8 *pr1115 = prom_base + 0x020;
r21033r21034
621621
622622void turbo_state::subroc3d_prepare_sprites(UINT8 y, sprite_info *info)
623623{
624   const UINT8 *pr1449 = machine().root_device().memregion("proms")->base() + 0x300;
624   const UINT8 *pr1449 = memregion("proms")->base() + 0x300;
625625   int sprnum;
626626
627627   /* initialize the line enable signals to 0 */
r21033r21034
838838
839839void turbo_state::buckrog_prepare_sprites(UINT8 y, sprite_info *info)
840840{
841   const UINT8 *pr5196 = machine().root_device().memregion("proms")->base() + 0x100;
841   const UINT8 *pr5196 = memregion("proms")->base() + 0x100;
842842   int sprnum;
843843
844844   /* initialize the line enable signals to 0 */
r21033r21034
956956UINT32 turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
957957{
958958   bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap();
959   const UINT8 *bgcolor = machine().root_device().memregion("gfx3")->base();
959   const UINT8 *bgcolor = memregion("gfx3")->base();
960960   const UINT8 *prom_base = memregion("proms")->base();
961961   const UINT8 *pr5194 = prom_base + 0x000;
962962   const UINT8 *pr5198 = prom_base + 0x500;
trunk/src/mame/video/sidepckt.c
r21033r21034
44
55void sidepckt_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99
1010   for (i = 0;i < machine().total_colors();i++)
trunk/src/mame/video/kopunch.c
r21033r21034
44
55void kopunch_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99
1010   color_prom += 24;   /* first 24 colors are black */
trunk/src/mame/video/tankbatt.c
r21033r21034
1717***************************************************************************/
1818void tankbatt_state::palette_init()
1919{
20   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
20   const UINT8 *color_prom = memregion("proms")->base();
2121   int i;
2222
2323   #define RES_1   0xc0 /* this is a guess */
trunk/src/mame/video/psikyo.c
r21033r21034
261261   static const int pri[] = { 0, 0xfc, 0xff, 0xff };
262262   int offs;
263263   UINT16 *spritelist = (UINT16 *)(m_spritebuf2 + 0x1800 / 4);
264   UINT8 *TILES = machine().root_device().memregion("spritelut")->base();    // Sprites LUT
265   int TILES_LEN = machine().root_device().memregion("spritelut")->bytes();
264   UINT8 *TILES = memregion("spritelut")->base();    // Sprites LUT
265   int TILES_LEN = memregion("spritelut")->bytes();
266266
267267   int width = machine().primary_screen->width();
268268   int height = machine().primary_screen->height();
r21033r21034
379379   static const int pri[] = { 0, 0xfc, 0xff, 0xff };
380380   int offs;
381381   UINT16 *spritelist = (UINT16 *)(m_spritebuf2 + 0x1800 / 4);
382   UINT8 *TILES = machine().root_device().memregion("spritelut")->base();    // Sprites LUT
383   int TILES_LEN = machine().root_device().memregion("spritelut")->bytes();
382   UINT8 *TILES = memregion("spritelut")->base();    // Sprites LUT
383   int TILES_LEN = memregion("spritelut")->bytes();
384384
385385   int width = machine().primary_screen->width();
386386   int height = machine().primary_screen->height();
r21033r21034
523523
524524   tilemap_t *tmptilemap0, *tmptilemap1;
525525
526   flip_screen_set(~machine().root_device().ioport("DSW")->read() & 0x00010000);       // hardwired to a DSW bit
526   flip_screen_set(~ioport("DSW")->read() & 0x00010000);       // hardwired to a DSW bit
527527
528528   /* Layers enable (not quite right) */
529529
r21033r21034
696696
697697   tilemap_t *tmptilemap0, *tmptilemap1;
698698
699   flip_screen_set(~machine().root_device().ioport("DSW")->read() & 0x00010000);       // hardwired to a DSW bit
699   flip_screen_set(~ioport("DSW")->read() & 0x00010000);       // hardwired to a DSW bit
700700
701701   /* Layers enable (not quite right) */
702702
trunk/src/mame/video/darkmist.c
r21033r21034
1515{
1616   int code,attr,pal;
1717
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) */
18   code=memregion("user1")->base()[tile_index]; /* TTTTTTTT */
19   attr=memregion("user2")->base()[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */
2020   code+=(attr&3)<<8;
2121   pal=(attr>>4);
2222
r21033r21034
3131{
3232   int code,attr,pal;
3333
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) */
34   code=memregion("user3")->base()[tile_index]; /* TTTTTTTT */
35   attr=memregion("user4")->base()[tile_index]; /* -PPP--TT - FIXED BITS (0xxx00xx) */
3636   pal=attr>>4;
3737
3838   code+=(attr&3)<<8;
r21033r21034
7070
7171void darkmist_state::palette_init()
7272{
73   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
73   const UINT8 *color_prom = memregion("proms")->base();
7474   int i;
7575
7676   /* allocate the colortable */
trunk/src/mame/video/st0016.c
r21033r21034
185185      UINT32 srcadr=(st0016_vregs[0xa0]|(st0016_vregs[0xa1]<<8)|(st0016_vregs[0xa2]<<16))<<1;
186186      UINT32 dstadr=(st0016_vregs[0xa3]|(st0016_vregs[0xa4]<<8)|(st0016_vregs[0xa5]<<16))<<1;
187187      UINT32 length=((st0016_vregs[0xa6]|(st0016_vregs[0xa7]<<8)|((st0016_vregs[0xa8]&0x1f)<<16))+1)<<1;
188      UINT32 srclen = (machine().root_device().memregion("maincpu")->bytes());
188      UINT32 srclen = (memregion("maincpu")->bytes());
189189      UINT8 *mem = memregion("maincpu")->base();
190190
191191      srcadr += macs_cart_slot*0x400000;
trunk/src/mame/video/appoooh.c
r21033r21034
2222
2323PALETTE_INIT_MEMBER(appoooh_state,appoooh)
2424{
25   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
25   const UINT8 *color_prom = memregion("proms")->base();
2626   int i;
2727
2828   for (i = 0; i < machine().total_colors(); i++)
r21033r21034
6161
6262PALETTE_INIT_MEMBER(appoooh_state,robowres)
6363{
64   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
64   const UINT8 *color_prom = memregion("proms")->base();
6565   int i;
6666
6767   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/skyraid.c
r21033r21034
108108
109109void skyraid_state::draw_trapezoid(bitmap_ind16& dst, bitmap_ind16& src)
110110{
111   const UINT8* p = machine().root_device().memregion("user2")->base();
111   const UINT8* p = memregion("user2")->base();
112112
113113   int x;
114114   int y;
trunk/src/mame/video/dday.c
r21033r21034
4747
4848void dday_state::palette_init()
4949{
50   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
50   const UINT8 *color_prom = memregion("proms")->base();
5151   int i;
5252
5353   palette_set_shadow_factor(machine(), 1.0 / 8);
trunk/src/mame/video/rocnrope.c
r21033r21034
3131
3232void rocnrope_state::palette_init()
3333{
34   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
34   const UINT8 *color_prom = 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];
trunk/src/mame/video/docastle.c
r21033r21034
3131
3232void docastle_state::palette_init()
3333{
34   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
34   const UINT8 *color_prom = memregion("proms")->base();
3535   int i;
3636
3737   for (i = 0; i < 256; i++)
trunk/src/mame/video/mystston.c
r21033r21034
7474   static const int resistances_b [2] = { 3300, 1500 };
7575   double weights_rg[3], weights_b[2];
7676
77   UINT8 *color_prom = machine().root_device().memregion("proms")->base();
77   UINT8 *color_prom = memregion("proms")->base();
7878
7979   compute_resistor_weights(0, 255, -1.0,
8080         3, resistances_rg, weights_rg, 0, 4700,
r21033r21034
244244
245245UINT32 mystston_state::screen_update_mystston(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
246246{
247   int flip = (*m_video_control & 0x80) ^ ((machine().root_device().ioport("DSW1")->read() & 0x20) << 2);
247   int flip = (*m_video_control & 0x80) ^ ((ioport("DSW1")->read() & 0x20) << 2);
248248
249249   set_palette();
250250
trunk/src/mame/video/nbmj9195.c
r21033r21034
242242      skipy = -1;
243243   }
244244
245   gfxlen = machine().root_device().memregion("gfx1")->bytes();
245   gfxlen = memregion("gfx1")->bytes();
246246   gfxaddr = ((m_blitter_src_addr[vram] + 2) & 0x00ffffff);
247247
248248   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
trunk/src/mame/video/polepos.c
r21033r21034
2727
2828PALETTE_INIT_MEMBER(polepos_state,polepos)
2929{
30   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
30   const UINT8 *color_prom = memregion("proms")->base();
3131   int i, j;
3232
3333   /* allocate the colortable */
r21033r21034
421421{
422422   gfx_element *gfx = machine().gfx[big ? 3 : 2];
423423   const UINT8 *gfxdata = gfx->get_data(code % gfx->elements());
424   UINT8 *scaling_rom = machine().root_device().memregion("gfx6")->base();
424   UINT8 *scaling_rom = memregion("gfx6")->base();
425425   UINT32 transmask = colortable_get_transpen_mask(machine().colortable, gfx, color, 0x1f);
426426   int coloroffs = gfx->colorbase() + color * gfx->granularity();
427427   int x,y;
trunk/src/mame/video/lasso.c
r21033r21034
6666
6767void lasso_state::palette_init()
6868{
69   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
69   const UINT8 *color_prom = memregion("proms")->base();
7070   int i;
7171
7272   for (i = 0; i < 0x40; i++)
r21033r21034
7676
7777PALETTE_INIT_MEMBER(lasso_state,wwjgtin)
7878{
79   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
79   const UINT8 *color_prom = memregion("proms")->base();
8080   int i;
8181
8282   /* allocate the colortable */
r21033r21034
134134
135135TILE_GET_INFO_MEMBER(lasso_state::wwjgtin_get_track_tile_info)
136136{
137   UINT8 *ROM = machine().root_device().memregion("user1")->base();
137   UINT8 *ROM = memregion("user1")->base();
138138   int code = ROM[tile_index];
139139   int color = ROM[tile_index + 0x2000];
140140
trunk/src/mame/video/labyrunr.c
r21033r21034
44
55void labyrunr_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int pal;
99
1010   /* allocate the colortable */
trunk/src/mame/video/ccastles.c
r21033r21034
2020   static const int resistances[3] = { 22000, 10000, 4700 };
2121
2222   /* get pointers to our PROMs */
23   m_syncprom = machine().root_device().memregion("proms")->base() + 0x000;
24   m_wpprom = machine().root_device().memregion("proms")->base() + 0x200;
25   m_priprom = machine().root_device().memregion("proms")->base() + 0x300;
23   m_syncprom = memregion("proms")->base() + 0x000;
24   m_wpprom = memregion("proms")->base() + 0x200;
25   m_priprom = memregion("proms")->base() + 0x300;
2626
2727   /* compute the color output resistor weights at startup */
2828   compute_resistor_weights(0, 255, -1.0,
trunk/src/mame/video/mermaid.c
r21033r21034
44
55void mermaid_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99
1010   /* allocate the colortable */
r21033r21034
3535
3636PALETTE_INIT_MEMBER(mermaid_state,rougien)
3737{
38   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
38   const UINT8 *color_prom = memregion("proms")->base();
3939   int i;
4040
4141   /* allocate the colortable */
trunk/src/mame/video/lethalj.c
r21033r21034
2727   int width = visarea.width();
2828   int height = visarea.height();
2929
30   *x = ((machine().root_device().ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255;
31   *y = ((machine().root_device().ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255;
30   *x = ((ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255;
31   *y = ((ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255;
3232}
3333
3434
trunk/src/mame/video/seibuspi.c
r21033r21034
500500   for (i = 6000; i < 6016; i++) { m_alpha_table[i] = 1; }
501501   for (i = 6128; i < 6144; i++) { m_alpha_table[i] = 1; }
502502
503   region_length = machine().root_device().memregion("gfx2")->bytes();
503   region_length = memregion("gfx2")->bytes();
504504
505505   if (region_length <= 0x300000)
506506   {
trunk/src/mame/video/speedatk.c
r21033r21034
1010
1111void speedatk_state::palette_init()
1212{
13   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
13   const UINT8 *color_prom = memregion("proms")->base();
1414   int i;
1515
1616   /* allocate the colortable */
trunk/src/mame/video/niyanpai.c
r21033r21034
214214      skipy = -1;
215215   }
216216
217   gfxlen = machine().root_device().memregion("gfx1")->bytes();
217   gfxlen = memregion("gfx1")->bytes();
218218   gfxaddr = ((m_blitter_src_addr[vram] + 2) & 0x00ffffff);
219219
220220   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
trunk/src/mame/video/exedexes.c
r21033r21034
3333
3434void exedexes_state::palette_init()
3535{
36   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
36   const UINT8 *color_prom = memregion("proms")->base();
3737   int i;
3838
3939   /* allocate the colortable */
r21033r21034
125125
126126TILE_GET_INFO_MEMBER(exedexes_state::get_bg_tile_info)
127127{
128   UINT8 *tilerom = machine().root_device().memregion("gfx5")->base();
128   UINT8 *tilerom = memregion("gfx5")->base();
129129
130130   int attr = tilerom[tile_index];
131131   int code = attr & 0x3f;
r21033r21034
137137
138138TILE_GET_INFO_MEMBER(exedexes_state::get_fg_tile_info)
139139{
140   int code = machine().root_device().memregion("gfx5")->base()[tile_index];
140   int code = memregion("gfx5")->base()[tile_index];
141141
142142   SET_TILE_INFO_MEMBER(2, code, 0, 0);
143143}
trunk/src/mame/video/suprnova.c
r21033r21034
612612   m_sprite_bitmap.fill(0x0000, cliprect);
613613
614614   if (m_alt_enable_sprites)
615      m_spritegen->skns_draw_sprites(machine(), m_sprite_bitmap, cliprect, m_spriteram, m_spriteram.bytes(), machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion ("gfx1")->bytes(), m_spc_regs );
615      m_spritegen->skns_draw_sprites(machine(), m_sprite_bitmap, cliprect, m_spriteram, m_spriteram.bytes(), memregion("gfx1")->base(), memregion ("gfx1")->bytes(), m_spc_regs );
616616
617617
618618   return 0;
trunk/src/mame/video/gotya.c
r21033r21034
1111
1212void gotya_state::palette_init()
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = 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];
trunk/src/mame/video/shootout.c
r21033r21034
99
1010void shootout_state::palette_init()
1111{
12   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
12   const UINT8 *color_prom = memregion("proms")->base();
1313   int i;
1414
1515
trunk/src/mame/video/bagman.c
r21033r21034
4444***************************************************************************/
4545PALETTE_INIT_MEMBER(bagman_state,bagman)
4646{
47   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
47   const UINT8 *color_prom = 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 };
trunk/src/mame/video/dribling.c
r21033r21034
1717
1818void dribling_state::palette_init()
1919{
20   const UINT8 *prom = machine().root_device().memregion("proms")->base() + 0x400;
20   const UINT8 *prom = memregion("proms")->base() + 0x400;
2121   int i;
2222
2323   for (i = 0; i < 256; i++)
r21033r21034
5858
5959UINT32 dribling_state::screen_update_dribling(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
6060{
61   UINT8 *prombase = machine().root_device().memregion("proms")->base();
61   UINT8 *prombase = memregion("proms")->base();
6262   UINT8 *gfxbase = memregion("gfx1")->base();
6363   int x, y;
6464
trunk/src/mame/video/chaknpop.c
r21033r21034
2424
2525void chaknpop_state::palette_init()
2626{
27   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
27   const UINT8 *color_prom = memregion("proms")->base();
2828   int i;
2929
3030   for (i = 0; i < 1024; i++)
trunk/src/mame/video/srmp2.c
r21033r21034
1111
1212PALETTE_INIT_MEMBER(srmp2_state,srmp2)
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = memregion("proms")->base();
1515   int i;
1616
1717   for (i = 0; i < machine().total_colors(); i++)
r21033r21034
2626
2727PALETTE_INIT_MEMBER(srmp2_state,srmp3)
2828{
29   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
29   const UINT8 *color_prom = memregion("proms")->base();
3030   int i;
3131
3232   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/ddribble.c
r21033r21034
1212
1313void ddribble_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
trunk/src/mame/video/terracre.c
r21033r21034
9090
9191void terracre_state::palette_init()
9292{
93   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
93   const UINT8 *color_prom = memregion("proms")->base();
9494   int i;
9595
9696   /* allocate the colortable */
trunk/src/mame/video/pushman.c
r21033r21034
1515
1616TILE_GET_INFO_MEMBER(pushman_state::get_back_tile_info)
1717{
18   UINT8 *bg_map = machine().root_device().memregion("gfx4")->base();
18   UINT8 *bg_map = memregion("gfx4")->base();
1919   int tile;
2020
2121   tile = bg_map[tile_index << 1] + (bg_map[(tile_index << 1) + 1] << 8);
trunk/src/mame/video/undrfire.c
r21033r21034
465465   /* See if we should draw artificial gun targets */
466466   /* (not yet implemented...) */
467467
468   if (machine().root_device().ioport("FAKE")->read() & 0x1)   /* Fake DSW */
468   if (ioport("FAKE")->read() & 0x1)   /* Fake DSW */
469469   {
470470      popmessage("Gunsights on");
471471   }
trunk/src/mame/video/zodiack.c
r21033r21034
4848
4949PALETTE_INIT_MEMBER(zodiack_state,zodiack)
5050{
51   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
51   const UINT8 *color_prom = memregion("proms")->base();
5252   int i;
5353
5454   /* allocate the colortable */
trunk/src/mame/video/shangkid.c
r21033r21034
4242   }
4343
4444   tileinfo.category =
45      (machine().root_device().memregion( "proms" )->base()[0x800+color*4]==2)?1:0;
45      (memregion( "proms" )->base()[0x800+color*4]==2)?1:0;
4646}
4747
4848VIDEO_START_MEMBER(shangkid_state,shangkid)
r21033r21034
195195
196196PALETTE_INIT_MEMBER(shangkid_state,dynamski)
197197{
198   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
198   const UINT8 *color_prom = memregion("proms")->base();
199199   int i;
200200
201201   /* allocate the colortable */
trunk/src/mame/video/trackfld.c
r21033r21034
3131
3232PALETTE_INIT_MEMBER(trackfld_state,trackfld)
3333{
34   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
34   const UINT8 *color_prom = 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];
trunk/src/mame/video/fastfred.c
r21033r21034
2525
2626PALETTE_INIT_MEMBER(fastfred_state,fastfred)
2727{
28   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
28   const UINT8 *color_prom = memregion("proms")->base();
2929   static const int resistances[4] = { 1000, 470, 220, 100 };
3030   double rweights[4], gweights[4], bweights[4];
3131   int i;
trunk/src/mame/video/pitnrun.c
r21033r21034
114114
115115void pitnrun_state::palette_init()
116116{
117   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
117   const UINT8 *color_prom = memregion("proms")->base();
118118   int i;
119119   int bit0,bit1,bit2,r,g,b;
120120   for (i = 0;i < 32*3; i++)
r21033r21034
218218
219219   if (machine().input().code_pressed_once(KEYCODE_W))
220220   {
221      UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
221      UINT8 *ROM = memregion("maincpu")->base();
222222      ROM[0x84f6]=6; /* lap 6 = spotlight */
223223   }
224224
225225   if (machine().input().code_pressed_once(KEYCODE_E))
226226   {
227      UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
227      UINT8 *ROM = memregion("maincpu")->base();
228228      ROM[0x84f6]=2; /* lap 3 (trial 2)= lightnings */
229229      ROM[0x8102]=1;
230230   }
trunk/src/mame/video/mario.c
r21033r21034
6464***************************************************************************/
6565void mario_state::palette_init()
6666{
67   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
67   const UINT8 *color_prom = memregion("proms")->base();
6868   rgb_t   *rgb;
6969
7070   rgb = compute_res_net_all(machine(), color_prom, &mario_decode_info, &mario_net_info);
r21033r21034
199199{
200200   int t;
201201
202   t = machine().root_device().ioport("MONITOR")->read();
202   t = ioport("MONITOR")->read();
203203   if (t != m_monitor)
204204   {
205205      m_monitor = t;
trunk/src/mame/video/magmax.c
r21033r21034
2626***************************************************************************/
2727void magmax_state::palette_init()
2828{
29   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
29   const UINT8 *color_prom = memregion("proms")->base();
3030   int i;
3131
3232   /* allocate the colortable */
trunk/src/mame/video/finalizr.c
r21033r21034
1212
1313void finalizr_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
trunk/src/mame/video/xorworld.c
r21033r21034
1818
1919void xorworld_state::palette_init()
2020{
21   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
21   const UINT8 *color_prom = memregion("proms")->base();
2222   int i;
2323
2424   for (i = 0;i < machine().total_colors();i++){
trunk/src/mame/video/cclimber.c
r21033r21034
3838***************************************************************************/
3939PALETTE_INIT_MEMBER(cclimber_state,cclimber)
4040{
41   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
41   const UINT8 *color_prom = 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];
r21033r21034
115115
116116PALETTE_INIT_MEMBER(cclimber_state,swimmer)
117117{
118   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
118   const UINT8 *color_prom = memregion("proms")->base();
119119   int i;
120120
121121   for (i = 0; i < 0x100; i++)
r21033r21034
184184
185185PALETTE_INIT_MEMBER(cclimber_state,yamato)
186186{
187   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
187   const UINT8 *color_prom = memregion("proms")->base();
188188   int i;
189189
190190   /* chars - 12 bits RGB */
r21033r21034
252252
253253PALETTE_INIT_MEMBER(cclimber_state,toprollr)
254254{
255   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
255   const UINT8 *color_prom = memregion("proms")->base();
256256   int i;
257257
258258   for (i = 0; i < 0xa0; i++)
trunk/src/mame/video/travrusa.c
r21033r21034
3939
4040void travrusa_state::palette_init()
4141{
42   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
42   const UINT8 *color_prom = memregion("proms")->base();
4343   int i;
4444
4545   /* allocate the colortable */
r21033r21034
115115
116116PALETTE_INIT_MEMBER(travrusa_state,shtrider)
117117{
118   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
118   const UINT8 *color_prom = memregion("proms")->base();
119119   int i;
120120
121121   /* allocate the colortable */
trunk/src/mame/video/rallyx.c
r21033r21034
5757
5858PALETTE_INIT_MEMBER(rallyx_state,rallyx)
5959{
60   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
60   const UINT8 *color_prom = 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];
r21033r21034
116116
117117PALETTE_INIT_MEMBER(rallyx_state,jungler)
118118{
119   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
119   const UINT8 *color_prom = 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 };
trunk/src/mame/video/goldstar.c
r21033r21034
377377
378378   if (m_cm_enable_reg &0x04)
379379   {
380      if (machine().root_device().memregion("user1")->base())
380      if (memregion("user1")->base())
381381      {
382382         gfx_element *gfx = machine().gfx[2];
383383         int girlyscroll = (INT8)((m_cm_girl_scroll & 0xf0));
r21033r21034
419419
420420   if (m_cm_enable_reg &0x04)
421421   {
422      if (machine().root_device().memregion("user1")->base())
422      if (memregion("user1")->base())
423423      {
424424         gfx_element *gfx = machine().gfx[2];
425425         int girlyscroll = (INT8)((m_cm_girl_scroll & 0xf0));
trunk/src/mame/video/cinemat.c
r21033r21034
227227
228228UINT32 cinemat_state::screen_update_spacewar(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
229229{
230   int sw_option = machine().root_device().ioport("INPUTS")->read();
230   int sw_option = ioport("INPUTS")->read();
231231
232232   screen_update_cinemat(screen, bitmap, cliprect);
233233
trunk/src/mame/video/dec8.c
r21033r21034
7777
7878PALETTE_INIT_MEMBER(dec8_state,ghostb)
7979{
80   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
80   const UINT8 *color_prom = memregion("proms")->base();
8181   int i;
8282
8383   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/dc.c
r21033r21034
26612661      pvr_drawframebuffer(machine(),bitmap,cliprect);
26622662
26632663   // update this here so we only do string lookup once per frame
2664   debug_dip_status = machine().root_device().ioport("MAMEDEBUG")->read();
2664   debug_dip_status = ioport("MAMEDEBUG")->read();
26652665
26662666   return 0;
26672667}
trunk/src/mame/video/mappy.c
r21033r21034
3232
3333PALETTE_INIT_MEMBER(mappy_state,superpac)
3434{
35   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *color_prom = memregion("proms")->base();
3636   static const int resistances[3] = { 1000, 470, 220 };
3737   double rweights[3], gweights[3], bweights[2];
3838   int i;
r21033r21034
9292
9393PALETTE_INIT_MEMBER(mappy_state,mappy)
9494{
95   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
95   const UINT8 *color_prom = memregion("proms")->base();
9696   static const int resistances[3] = { 1000, 470, 220 };
9797   double rweights[3], gweights[3], bweights[2];
9898   int i;
r21033r21034
164164
165165PALETTE_INIT_MEMBER(mappy_state,phozon)
166166{
167   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
167   const UINT8 *color_prom = memregion("proms")->base();
168168   static const int resistances[4] = { 2200, 1000, 470, 220 };
169169   double rweights[4], gweights[4], bweights[4];
170170   int i;
trunk/src/mame/video/20pacgal.c
r21033r21034
2525void _20pacgal_state::get_pens(pen_t *pens)
2626{
2727   offs_t offs;
28   UINT8 *color_prom = machine().root_device().memregion("proms")->base() + (NUM_PENS * m_game_selected);
28   UINT8 *color_prom = memregion("proms")->base() + (NUM_PENS * m_game_selected);
2929
3030   for (offs = 0; offs < NUM_PENS ;offs++)
3131   {
trunk/src/mame/video/seicross.c
r21033r21034
2727***************************************************************************/
2828void seicross_state::palette_init()
2929{
30   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
30   const UINT8 *color_prom = memregion("proms")->base();
3131   int i;
3232
3333
trunk/src/mame/video/flower.c
r21033r21034
66
77void flower_state::palette_init()
88{
9   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
9   const UINT8 *color_prom = memregion("proms")->base();
1010   int i;
1111
1212   /* allocate the colortable */
trunk/src/mame/video/pastelg.c
r21033r21034
1616******************************************************************************/
1717void pastelg_state::palette_init()
1818{
19   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
19   const UINT8 *color_prom = memregion("proms")->base();
2020   int i;
2121   int bit0, bit1, bit2, bit3, r, g, b;
2222
r21033r21034
194194      incy = -1;
195195   }
196196
197   gfxlen = machine().root_device().memregion("gfx1")->bytes();
197   gfxlen = memregion("gfx1")->bytes();
198198   gfxaddr = (m_gfxrom << 16) + m_blitter_src_addr;
199199
200200   readflag = 0;
trunk/src/mame/video/atari.c
r21033r21034
774774
775775   copybitmap(bitmap, *antic.bitmap, 0, 0, 0, 0, cliprect);
776776
777   new_tv_artifacts = screen.machine().root_device().ioport("artifacts")->read_safe(0);
777   new_tv_artifacts = screen.ioport("artifacts")->read_safe(0);
778778   if( tv_artifacts != new_tv_artifacts )
779779   {
780780      tv_artifacts = new_tv_artifacts;
trunk/src/mame/video/redalert.c
r21033r21034
5151   double charmap_b_weights[2];
5252   double back_r_weight[1];
5353   double back_gb_weight[1];
54   const UINT8 *prom = machine().root_device().memregion("proms")->base();
54   const UINT8 *prom = memregion("proms")->base();
5555
5656   scaler = compute_resistor_weights(0, 0xff, -1,
5757                              1, resistances_bitmap,     bitmap_weight,      470, 0,
r21033r21034
116116   double charmap_b_weights[2];
117117   double back_r_weight[1];
118118   double back_gb_weight[1];
119   const UINT8 *prom = machine().root_device().memregion("proms")->base();
119   const UINT8 *prom = memregion("proms")->base();
120120
121121   scaler = compute_resistor_weights(0, 0xff, -1,
122122                              1, resistances_bitmap,     bitmap_weight,      470, 0,
trunk/src/mame/video/munchmo.c
r21033r21034
44
55void munchmo_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99
1010   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/40love.c
r21033r21034
1212
1313void fortyl_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/prehisle.c
r21033r21034
5656
5757TILE_GET_INFO_MEMBER(prehisle_state::get_bg2_tile_info)
5858{
59   UINT8 *tilerom = machine().root_device().memregion("gfx5")->base();
59   UINT8 *tilerom = memregion("gfx5")->base();
6060
6161   int offs = tile_index * 2;
6262   int attr = tilerom[offs + 1] + (tilerom[offs] << 8);
trunk/src/mame/video/galaga.c
r21033r21034
325325
326326PALETTE_INIT_MEMBER(galaga_state,galaga)
327327{
328   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
328   const UINT8 *color_prom = memregion("proms")->base();
329329   int i;
330330
331331   machine().colortable = colortable_alloc(machine(), 32+64);
trunk/src/mame/video/8080bw.c
r21033r21034
268268
269269   invadpt2_get_pens(pens);
270270
271   color_map_base = machine().root_device().memregion("proms")->base();
271   color_map_base = memregion("proms")->base();
272272   cloud_gfx = memregion("user1")->base();
273273
274274   for (offs = 0; offs < m_main_ram.bytes(); offs++)
trunk/src/mame/video/quasar.c
r21033r21034
2121
2222PALETTE_INIT_MEMBER(quasar_state,quasar)
2323{
24   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
24   const UINT8 *color_prom = memregion("proms")->base();
2525   int i;
2626
2727   /* allocate the colortable */
trunk/src/mame/video/mrjong.c
r21033r21034
1818
1919void mrjong_state::palette_init()
2020{
21   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
21   const UINT8 *color_prom = memregion("proms")->base();
2222   int i;
2323
2424   /* allocate the colortable */
trunk/src/mame/video/namcos86.c
r21033r21034
3434
3535void namcos86_state::palette_init()
3636{
37   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
37   const UINT8 *color_prom = memregion("proms")->base();
3838   int i;
3939   rgb_t palette[512];
4040
trunk/src/mame/video/xyonix.c
r21033r21034
33
44void xyonix_state::palette_init()
55{
6   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
6   const UINT8 *color_prom = memregion("proms")->base();
77   int i;
88
99
trunk/src/mame/video/popper.c
r21033r21034
4646
4747void popper_state::palette_init()
4848{
49   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
49   const UINT8 *color_prom = memregion("proms")->base();
5050   rgb_t   *rgb;
5151
5252   rgb = compute_res_net_all(machine(), color_prom, &popper_decode_info, &popper_net_info);
trunk/src/mame/video/nova2001.c
r21033r21034
1010
1111PALETTE_INIT_MEMBER(nova2001_state,nova2001)
1212{
13   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
13   const UINT8 *color_prom = memregion("proms")->base();
1414   int i;
1515
1616   /* Color #1 is used for palette animation.          */
trunk/src/mame/video/dogfgt.c
r21033r21034
1313
1414void dogfgt_state::palette_init()
1515{
16   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
16   const UINT8 *color_prom = memregion("proms")->base();
1717   int i;
1818
1919   /* first 16 colors are RAM */
trunk/src/mame/video/stactics.c
r21033r21034
5959
6060PALETTE_INIT_MEMBER(stactics_state,stactics)
6161{
62   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
62   const UINT8 *color_prom = memregion("proms")->base();
6363   int i;
6464
6565   for (i = 0; i < 0x400; i++)
r21033r21034
299299void stactics_state::update_artwork()
300300{
301301   int i;
302   UINT8 *beam_region = machine().root_device().memregion("user1")->base();
302   UINT8 *beam_region = memregion("user1")->base();
303303
304304   /* set the lamps first */
305305   output_set_indexed_value("base_lamp", 4, m_lamps[0] & 0x01);
trunk/src/mame/video/tceptor.c
r21033r21034
2020
2121void tceptor_state::palette_init()
2222{
23   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
23   const UINT8 *color_prom = memregion("proms")->base();
2424   int i;
2525
2626   /* allocate the colortable */
r21033r21034
238238   };
239239
240240   int gfx_index = m_bg;
241   UINT8 *src = machine().root_device().memregion(region)->base() + 0x8000;
241   UINT8 *src = memregion(region)->base() + 0x8000;
242242   UINT8 *buffer;
243243   int len = 0x8000;
244244   int i;
r21033r21034
256256   auto_free(machine(), buffer);
257257
258258   /* decode the graphics */
259   machine().gfx[gfx_index] = auto_alloc(machine(), gfx_element(machine(), bg_layout, machine().root_device().memregion(region)->base(), 64, 2048));
259   machine().gfx[gfx_index] = auto_alloc(machine(), gfx_element(machine(), bg_layout, memregion(region)->base(), 64, 2048));
260260}
261261
262262void tceptor_state::decode_sprite(int gfx_index, const gfx_layout *layout, const void *data)
r21033r21034
285285      2*16*16
286286   };
287287
288   UINT8 *src = machine().root_device().memregion(region)->base();
289   int len = machine().root_device().memregion(region)->bytes();
288   UINT8 *src = memregion(region)->base();
289   int len = memregion(region)->bytes();
290290   UINT8 *dst;
291291   int i, y;
292292
r21033r21034
336336      2*32*32
337337   };
338338
339   UINT8 *src = machine().root_device().memregion(region)->base();
340   int len = machine().root_device().memregion(region)->bytes();
339   UINT8 *src = memregion(region)->base();
340   int len = memregion(region)->bytes();
341341   int total = spr32_layout.total;
342342   int size = spr32_layout.charincrement / 8;
343343   UINT8 *dst;
trunk/src/mame/video/gaelco3d.c
r21033r21034
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().root_device().memregion("gfx1")->bytes()),
34      m_texmask_size(state.machine().root_device().memregion("gfx2")->bytes() * 8),
33      m_texture_size(state.memregion("gfx1")->bytes()),
34      m_texmask_size(state.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{
r21033r21034
3939   state_save_register_global_bitmap(state.machine(), &m_zbuffer);
4040
4141   /* first expand the pixel data */
42   UINT8 *src = state.machine().root_device().memregion("gfx1")->base();
42   UINT8 *src = state.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)
r21033r21034
5151      }
5252
5353   /* then expand the mask data */
54   src = state.machine().root_device().memregion("gfx2")->base();
54   src = state.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++)
trunk/src/mame/video/galaxian.c
r21033r21034
235235
236236void galaxian_state::palette_init()
237237{
238   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
238   const UINT8 *color_prom = memregion("proms")->base();
239239   static const int rgb_resistances[3] = { 1000, 470, 220 };
240240   double rweights[3], gweights[3], bweights[2];
241241   int i, minval, midval, maxval, len;
r21033r21034
273273         2, &rgb_resistances[1], bweights, 470, 0);
274274
275275   /* decode the palette first */
276   len = machine().root_device().memregion("proms")->bytes();
276   len = memregion("proms")->bytes();
277277   for (i = 0; i < len; i++)
278278   {
279279      UINT8 bit0, bit1, bit2, r, g, b;
trunk/src/mame/video/canyon.c
r21033r21034
7676   draw_bombs(bitmap, cliprect);
7777
7878   /* watchdog is disabled during service mode */
79   machine().watchdog_enable(!(machine().root_device().ioport("IN2")->read() & 0x10));
79   machine().watchdog_enable(!(ioport("IN2")->read() & 0x10));
8080
8181   return 0;
8282}
trunk/src/mame/video/circusc.c
r21033r21034
3232
3333void circusc_state::palette_init()
3434{
35   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *color_prom = 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];
trunk/src/mame/video/hyprduel.c
r21033r21034
339339
340340void hyprduel_state::expand_gfx1(hyprduel_state &state)
341341{
342   UINT8 *base_gfx = state.machine().root_device().memregion("gfx1")->base();
343   UINT32 length = 2 * state.machine().root_device().memregion("gfx1")->bytes();
342   UINT8 *base_gfx = state.memregion("gfx1")->base();
343   UINT32 length = 2 * state.memregion("gfx1")->bytes();
344344   state.m_expanded_gfx1 = auto_alloc_array(state.machine(), UINT8, length);
345345   for (int i = 0; i < length; i += 2)
346346   {
trunk/src/mame/video/namconb1.c
r21033r21034
163163
164164VIDEO_START_MEMBER(namconb1_state,namconb1)
165165{
166   namco_tilemap_init(NAMCONB1_TILEGFX, machine().root_device().memregion(NAMCONB1_TILEMASKREGION)->base(), NB1TilemapCB );
166   namco_tilemap_init(NAMCONB1_TILEGFX, memregion(NAMCONB1_TILEMASKREGION)->base(), NB1TilemapCB );
167167   c355_obj_init(NAMCONB1_SPRITEGFX,0x0,namcos2_shared_state::c355_obj_code2tile_delegate(FUNC(NB1objcode2tile), &machine()));
168168} /* namconb1 */
169169
r21033r21034
223223
224224VIDEO_START_MEMBER(namconb1_state,namconb2)
225225{
226   namco_tilemap_init(NAMCONB1_TILEGFX, machine().root_device().memregion(NAMCONB1_TILEMASKREGION)->base(), NB2TilemapCB );
226   namco_tilemap_init(NAMCONB1_TILEGFX, memregion(NAMCONB1_TILEMASKREGION)->base(), NB2TilemapCB );
227227   c355_obj_init(NAMCONB1_SPRITEGFX,0x0,namcos2_shared_state::c355_obj_code2tile_delegate(FUNC(NB2objcode2tile), &machine()));
228228   c169_roz_init(NAMCONB1_ROTGFX,NAMCONB1_ROTMASKREGION);
229229} /* namconb2_vh_start */
trunk/src/mame/video/calomega.c
r21033r21034
6767
6868void calomega_state::palette_init()
6969{
70   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
70   const UINT8 *color_prom = memregion("proms")->base();
7171/*  prom bits
7272    7654 3210
7373    ---- ---x   red component.
trunk/src/mame/video/strnskil.c
r21033r21034
1414
1515void strnskil_state::palette_init()
1616{
17   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
17   const UINT8 *color_prom = memregion("proms")->base();
1818   int i;
1919
2020   /* allocate the colortable */
trunk/src/mame/video/tubep.c
r21033r21034
133133
134134PALETTE_INIT_MEMBER(tubep_state,tubep)
135135{
136   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
136   const UINT8 *color_prom = memregion("proms")->base();
137137   int i,r,g,b;
138138
139139   /* background/sprites palette variables */
r21033r21034
582582   pen_t pen_base = 32; //change it later
583583
584584   UINT32 v;
585   UINT8 *text_gfx_base = machine().root_device().memregion("gfx1")->base();
585   UINT8 *text_gfx_base = memregion("gfx1")->base();
586586   UINT8 *romBxx = memregion("user1")->base() + 0x2000*m_background_romsel;
587587
588588   /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect.min_y, cliprect.max_y+1); */
r21033r21034
680680
681681PALETTE_INIT_MEMBER(tubep_state,rjammer)
682682{
683   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
683   const UINT8 *color_prom = memregion("proms")->base();
684684   int i;
685685
686686   static const int resistors_rg[3] = { 1000, 470, 220 };
r21033r21034
736736   int DISP_ = m_DISP^1;
737737
738738   UINT32 v;
739   UINT8 *text_gfx_base = machine().root_device().memregion("gfx1")->base();
739   UINT8 *text_gfx_base = memregion("gfx1")->base();
740740   UINT8 *rom13D  = memregion("user1")->base();
741741   UINT8 *rom11BD = rom13D+0x1000;
742742   UINT8 *rom19C  = rom13D+0x5000;
trunk/src/mame/video/shaolins.c
r21033r21034
2828***************************************************************************/
2929void shaolins_state::palette_init()
3030{
31   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
31   const UINT8 *color_prom = memregion("proms")->base();
3232   static const int resistances[4] = { 2200, 1000, 470, 220 };
3333   double rweights[4], gweights[4], bweights[4];
3434   int i;
trunk/src/mame/video/tagteam.c
r21033r21034
3434
3535void tagteam_state::palette_init()
3636{
37   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
37   const UINT8 *color_prom = memregion("proms")->base();
3838   rgb_t *rgb;
3939
4040   rgb = compute_res_net_all(machine(), color_prom, &tagteam_decode_info, &tagteam_net_info);
trunk/src/mame/video/hyhoo.c
r21033r21034
102102      skipy = -1;
103103   }
104104
105   gfxlen = machine().root_device().memregion("gfx1")->bytes();
105   gfxlen = memregion("gfx1")->bytes();
106106   gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1);
107107
108108   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
trunk/src/mame/video/lazercmd.c
r21033r21034
2929   int xbit, ybit, size;
3030
3131   size = 2;
32   if (machine().root_device().ioport("DSW")->read() & 0x40)
32   if (ioport("DSW")->read() & 0x40)
3333   {
3434      size = 4;
3535   }
r21033r21034
5454{
5555   int i, x, y;
5656
57   int video_inverted = machine().root_device().ioport("DSW")->read() & 0x20;
57   int video_inverted = ioport("DSW")->read() & 0x20;
5858
5959   /* The first row of characters are invisible */
6060   for (i = 0; i < (VERT_RES - 1) * HORZ_RES; i++)
trunk/src/mame/video/spacefb.c
r21033r21034
207207void spacefb_state::get_sprite_pens(pen_t *pens)
208208{
209209   static const double fade_weights[] = { 1.0, 1.5, 2.5, 4.0 };
210   const UINT8 *prom = machine().root_device().memregion("proms")->base();
210   const UINT8 *prom = memregion("proms")->base();
211211   int i;
212212
213213   for (i = 0; i < NUM_SPRITE_PENS; i++)
trunk/src/mame/video/compgolf.c
r21033r21034
1111
1212void compgolf_state::palette_init()
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = memregion("proms")->base();
1515   int i;
1616
1717   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/wiz.c
r21033r21034
3434***************************************************************************/
3535void wiz_state::palette_init()
3636{
37   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
37   const UINT8 *color_prom = memregion("proms")->base();
3838   int i;
3939
4040
trunk/src/mame/video/crgolf.c
r21033r21034
5050void crgolf_state::get_pens( pen_t *pens )
5151{
5252   offs_t offs;
53   const UINT8 *prom = machine().root_device().memregion("proms")->base();
53   const UINT8 *prom = memregion("proms")->base();
5454
5555   for (offs = 0; offs < NUM_PENS; offs++)
5656   {
trunk/src/mame/video/hyperspt.c
r21033r21034
3131
3232void hyperspt_state::palette_init()
3333{
34   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
34   const UINT8 *color_prom = 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];
trunk/src/mame/video/segag80r.c
r21033r21034
209209
210210      /* background tilemap is effectively 1 screen x n screens */
211211      case G80_BACKGROUND_MONSTERB:
212         m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(segag80r_state::bg_get_tile_info),this), TILEMAP_SCAN_ROWS,  8,8, 32,machine().root_device().memregion("gfx2")->bytes() / 32);
212         m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(segag80r_state::bg_get_tile_info),this), TILEMAP_SCAN_ROWS,  8,8, 32,memregion("gfx2")->bytes() / 32);
213213         break;
214214
215215      /* background tilemap is effectively 4 screens x n screens */
216216      case G80_BACKGROUND_PIGNEWT:
217217      case G80_BACKGROUND_SINDBADM:
218         m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(segag80r_state::bg_get_tile_info),this), TILEMAP_SCAN_ROWS,  8,8, 128,machine().root_device().memregion("gfx2")->bytes() / 128);
218         m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(segag80r_state::bg_get_tile_info),this), TILEMAP_SCAN_ROWS,  8,8, 128,memregion("gfx2")->bytes() / 128);
219219         break;
220220   }
221221
trunk/src/mame/video/kncljoe.c
r21033r21034
1616
1717void kncljoe_state::palette_init()
1818{
19   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
19   const UINT8 *color_prom = memregion("proms")->base();
2020   int i;
2121
2222   /* allocate the colortable */
r21033r21034
152152   if (m_sprite_bank != i)
153153   {
154154      m_sprite_bank = i;
155      memset(machine().root_device().memregion("maincpu")->base() + 0xf100, 0, 0x180);
155      memset(memregion("maincpu")->base() + 0xf100, 0, 0x180);
156156   }
157157}
158158
trunk/src/mame/video/snk.c
r21033r21034
2727
2828PALETTE_INIT_MEMBER(snk_state,tnk3)
2929{
30   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
30   const UINT8 *color_prom = memregion("proms")->base();
3131   int i;
3232   int num_colors = 0x400;
3333
trunk/src/mame/video/liberatr.c
r21033r21034
212212void liberatr_state::video_start()
213213{
214214   // for each planet in the planet ROMs
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]);
215   init_planet(m_planets[0], &memregion("gfx1")->base()[0x2000]);
216   init_planet(m_planets[1], &memregion("gfx1")->base()[0x0000]);
217217}
218218
219219
trunk/src/mame/video/gsword.c
r21033r21034
1111
1212PALETTE_INIT_MEMBER(gsword_state,josvolly)
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = memregion("proms")->base();
1515   int i;
1616
1717   /* allocate the colortable */
r21033r21034
4545
4646PALETTE_INIT_MEMBER(gsword_state,gsword)
4747{
48   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
48   const UINT8 *color_prom = memregion("proms")->base();
4949   int i;
5050
5151   /* allocate the colortable */
trunk/src/mame/video/suprridr.c
r21033r21034
5454
5555void suprridr_state::palette_init()
5656{
57   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
57   const UINT8 *color_prom = memregion("proms")->base();
5858   int i;
5959
6060   for (i = 0; i < 96; i++)
trunk/src/mame/video/jedi.c
r21033r21034
131131   int y;
132132   int background_line_buffer[0x200];  /* RAM chip at 2A */
133133
134   UINT8 *tx_gfx = machine().root_device().memregion("gfx1")->base();
135   UINT8 *bg_gfx = machine().root_device().memregion("gfx2")->base();
136   UINT8 *prom1 = &machine().root_device().memregion("proms")->base()[0x0000 | ((*m_smoothing_table & 0x03) << 8)];
137   UINT8 *prom2 = &machine().root_device().memregion("proms")->base()[0x0800 | ((*m_smoothing_table & 0x03) << 8)];
134   UINT8 *tx_gfx = memregion("gfx1")->base();
135   UINT8 *bg_gfx = memregion("gfx2")->base();
136   UINT8 *prom1 = &memregion("proms")->base()[0x0000 | ((*m_smoothing_table & 0x03) << 8)];
137   UINT8 *prom2 = &memregion("proms")->base()[0x0800 | ((*m_smoothing_table & 0x03) << 8)];
138138   int vscroll = m_vscroll;
139139   int hscroll = m_hscroll;
140140   int tx_bank = *m_foreground_bank;
r21033r21034
230230{
231231   offs_t offs;
232232   UINT8 *spriteram = m_spriteram;
233   UINT8 *gfx3 = machine().root_device().memregion("gfx3")->base();
233   UINT8 *gfx3 = memregion("gfx3")->base();
234234
235235   for (offs = 0x00; offs < 0x30; offs++)
236236   {
trunk/src/mame/video/ampoker2.c
r21033r21034
7373
7474void ampoker2_state::palette_init()
7575{
76   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
76   const UINT8 *color_prom = memregion("proms")->base();
7777/*    - bits -
7878      76543210
7979      RRRGGGBB
trunk/src/mame/video/toypop.c
r21033r21034
2020
2121void toypop_state::palette_init()
2222{
23   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
23   const UINT8 *color_prom = memregion("proms")->base();
2424   /* allocate the colortable */
2525   machine().colortable = colortable_alloc(machine(), 256);
2626
trunk/src/mame/video/sbasketb.c
r21033r21034
2828
2929void sbasketb_state::palette_init()
3030{
31   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
31   const UINT8 *color_prom = memregion("proms")->base();
3232   static const int resistances[4] = { 2000, 1000, 470, 220 };
3333   double rweights[4], gweights[4], bweights[4];
3434   int i;
trunk/src/mame/video/ksayakyu.c
r21033r21034
3232
3333void ksayakyu_state::palette_init()
3434{
35   const UINT8 *prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *prom = memregion("proms")->base();
3636   int r, g, b, i;
3737
3838   for (i = 0; i < 0x100; i++)
r21033r21034
4747
4848TILE_GET_INFO_MEMBER(ksayakyu_state::get_ksayakyu_tile_info)
4949{
50   int code = machine().root_device().memregion("user1")->base()[tile_index];
51   int attr = machine().root_device().memregion("user1")->base()[tile_index + 0x2000];
50   int code = memregion("user1")->base()[tile_index];
51   int attr = memregion("user1")->base()[tile_index + 0x2000];
5252   code += (attr & 3) << 8;
5353   SET_TILE_INFO_MEMBER(1, code, ((attr >> 2) & 0x0f) * 2, (attr & 0x80) ? TILE_FLIPX : 0);
5454}
trunk/src/mame/video/momoko.c
r21033r21034
7171   int xx, sx, sy, px, py, dot;
7272   UINT32 gfxadr;
7373   UINT8 d0, d1;
74   UINT8 *BG_GFX = machine().root_device().memregion("gfx2")->base();
74   UINT8 *BG_GFX = memregion("gfx2")->base();
7575
7676   for (sy = 0; sy < 8; sy++)
7777   {
r21033r21034
106106   int x, y, dx, dy, rx, ry, radr, chr, sy, fx, fy, px, py, offs, col, pri, flip ;
107107   UINT8 *spriteram = m_spriteram;
108108
109   UINT8 *BG_MAP     = machine().root_device().memregion("user1")->base();
110   UINT8 *BG_COL_MAP = machine().root_device().memregion("user2")->base();
111   UINT8 *FG_MAP     = machine().root_device().memregion("user3")->base();
109   UINT8 *BG_MAP     = memregion("user1")->base();
110   UINT8 *BG_COL_MAP = memregion("user2")->base();
111   UINT8 *FG_MAP     = memregion("user3")->base();
112112   UINT8 *TEXT_COLOR = memregion("proms")->base();
113113
114114
115   flip = m_flipscreen ^ (machine().root_device().ioport("FAKE")->read() & 0x01);
115   flip = m_flipscreen ^ (ioport("FAKE")->read() & 0x01);
116116
117117   /* draw BG layer */
118118   dx = (7 - m_bg_scrollx[0]) & 7;
trunk/src/mame/video/ironhors.c
r21033r21034
1818
1919void ironhors_state::palette_init()
2020{
21   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
21   const UINT8 *color_prom = memregion("proms")->base();
2222   static const int resistances[4] = { 2000, 1000, 470, 220 };
2323   double rweights[4], gweights[4], bweights[4];
2424   int i;
trunk/src/mame/video/digdug.c
r21033r21034
2323
2424PALETTE_INIT_MEMBER(digdug_state,digdug)
2525{
26   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
26   const UINT8 *color_prom = memregion("proms")->base();
2727   int i;
2828
2929   machine().colortable = colortable_alloc(machine(), 32);
r21033r21034
9090
9191TILE_GET_INFO_MEMBER(digdug_state::bg_get_tile_info)
9292{
93   UINT8 *rom = machine().root_device().memregion("gfx4")->base();
93   UINT8 *rom = memregion("gfx4")->base();
9494
9595   int code = rom[tile_index | (m_bg_select << 10)];
9696   /* when the background is "disabled", it is actually still drawn, but using
trunk/src/mame/video/kchamp.c
r21033r21034
1212
1313void kchamp_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i, red, green, blue;
1717
1818   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/bwing.c
r21033r21034
125125   }
126126
127127   #if BW_DEBUG
128      (machine().root_device().memregion(REGION_CPU1)->base())[0x1b10 + offset] = data;
128      (memregion(REGION_CPU1)->base())[0x1b10 + offset] = data;
129129   #endif
130130}
131131
trunk/src/mame/video/gridlee.c
r21033r21034
2020
2121void gridlee_state::palette_init()
2222{
23   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
23   const UINT8 *color_prom = memregion("proms")->base();
2424   int i;
2525
2626   for (i = 0; i < machine().total_colors(); i++)
r21033r21034
155155   }
156156
157157   /* draw the sprite images */
158   gfx = machine().root_device().memregion("gfx1")->base();
158   gfx = memregion("gfx1")->base();
159159   for (i = 0; i < 32; i++)
160160   {
161161      UINT8 *sprite = m_spriteram + i * 4;
trunk/src/mame/video/trucocl.c
r21033r21034
3838
3939void trucocl_state::palette_init()
4040{
41   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
41   const UINT8 *color_prom = memregion("proms")->base();
4242   int i;
4343
4444   for (i = 0;i < 32;i++)
trunk/src/mame/video/jailbrek.c
r21033r21034
33
44void jailbrek_state::palette_init()
55{
6   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
6   const UINT8 *color_prom = memregion("proms")->base();
77   int i;
88
99   /* allocate the colortable */
trunk/src/mame/video/lockon.c
r21033r21034
9898
9999void lockon_state::palette_init()
100100{
101   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
101   const UINT8 *color_prom = memregion("proms")->base();
102102   int i;
103103
104104   for (i = 0; i < 1024; ++i)
trunk/src/mame/video/portrait.c
r21033r21034
7474
7575void portrait_state::palette_init()
7676{
77   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
77   const UINT8 *color_prom = memregion("proms")->base();
7878   int i;
79   UINT8* lookup = machine().root_device().memregion("tileattr")->base();
79   UINT8* lookup = memregion("tileattr")->base();
8080
8181   /* allocate the colortable */
8282   machine().colortable = colortable_alloc(machine(), 0x40);
trunk/src/mame/video/funkybee.c
r21033r21034
1111
1212void funkybee_state::palette_init()
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = memregion("proms")->base();
1515   int i;
1616
1717   /* first, the character/sprite palette */
trunk/src/mame/video/alpha68k.c
r21033r21034
369369
370370PALETTE_INIT_MEMBER(alpha68k_state,kyros)
371371{
372   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
372   const UINT8 *color_prom = memregion("proms")->base();
373373   int i;
374374
375375   /* allocate the colortable */
r21033r21034
397397
398398PALETTE_INIT_MEMBER(alpha68k_state,paddlem)
399399{
400   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
400   const UINT8 *color_prom = memregion("proms")->base();
401401   int i;
402402
403403   /* allocate the colortable */
trunk/src/mame/video/redclash.c
r21033r21034
2020
2121PALETTE_INIT_MEMBER(ladybug_state,redclash)
2222{
23   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
23   const UINT8 *color_prom = memregion("proms")->base();
2424   int i;
2525
2626   /* allocate the colortable */
trunk/src/mame/video/centiped.c
r21033r21034
278278
279279PALETTE_INIT_MEMBER(centiped_state,warlords)
280280{
281   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
281   const UINT8 *color_prom = memregion("proms")->base();
282282   int i;
283283
284284   for (i = 0; i < machine().total_colors(); i++)
r21033r21034
403403   m_generic_paletteram_8[offset] = data;
404404
405405   /* the value passed in is a look-up index into the color PROM */
406   milliped_set_color(offset, ~machine().root_device().memregion("proms")->base()[~data & 0x0f]);
406   milliped_set_color(offset, ~memregion("proms")->base()[~data & 0x0f]);
407407}
408408
409409
r21033r21034
448448UINT32 centiped_state::screen_update_warlords(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
449449{
450450   UINT8 *spriteram = m_spriteram;
451   int upright_mode = machine().root_device().ioport("IN0")->read() & 0x80;
451   int upright_mode = ioport("IN0")->read() & 0x80;
452452   int offs;
453453
454454   /* if the cocktail/upright switch flipped, force refresh */
trunk/src/mame/video/galaxold.c
r21033r21034
77#include "emu.h"
88#include "includes/galaxold.h"
99
10#define STARS_COLOR_BASE        (machine().root_device().memregion("proms")->bytes())
10#define STARS_COLOR_BASE        (memregion("proms")->bytes())
1111#define BULLETS_COLOR_BASE      (STARS_COLOR_BASE + 64)
1212#define BACKGROUND_COLOR_BASE   (BULLETS_COLOR_BASE + 2)
1313
r21033r21034
4545***************************************************************************/
4646PALETTE_INIT_MEMBER(galaxold_state,galaxold)
4747{
48   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
48   const UINT8 *color_prom = memregion("proms")->base();
4949   int i, len;
5050
5151
5252   /* first, the character/sprite palette */
53   len = machine().root_device().memregion("proms")->bytes();
53   len = memregion("proms")->bytes();
5454   for (i = 0;i < len;i++)
5555   {
5656      int bit0,bit1,bit2,r,g,b;
r21033r21034
120120
121121PALETTE_INIT_MEMBER(galaxold_state,rockclim)
122122{
123   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
123   const UINT8 *color_prom = memregion("proms")->base();
124124   int i, len;
125125
126126
127127   /* first, the character/sprite palette */
128   len = machine().root_device().memregion("proms")->bytes();
128   len = memregion("proms")->bytes();
129129   for (i = 0;i < len;i++)
130130   {
131131      int bit0,bit1,bit2,r,g,b;
r21033r21034
169169***************************************************************************/
170170PALETTE_INIT_MEMBER(galaxold_state,darkplnt)
171171{
172   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
172   const UINT8 *color_prom = memregion("proms")->base();
173173   int i;
174174
175175
r21033r21034
289289/* swapped r/g/b hook-up */
290290PALETTE_INIT_MEMBER(galaxold_state,dambustr)
291291{
292   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
292   const UINT8 *color_prom = memregion("proms")->base();
293293   int base = BACKGROUND_COLOR_BASE;
294294   int i, len;
295295
296296   /* first, the character/sprite palette */
297   len = machine().root_device().memregion("proms")->bytes();
297   len = memregion("proms")->bytes();
298298
299299   for (i = 0;i < len;i++)
300300   {
r21033r21034
10011001
10021002   /* bit 0 of the PROM controls character banking */
10031003
1004   prom = machine().root_device().memregion("user2")->base();
1004   prom = memregion("user2")->base();
10051005
10061006   *code |= ((prom[x] & 0x01) << 8);
10071007}
r21033r21034
15451545
15461546   /* bit 2 of the PROM controls star visibility */
15471547
1548   prom = machine().root_device().memregion("user2")->base();
1548   prom = memregion("user2")->base();
15491549
15501550   for (offs = 0;offs < STAR_COUNT;offs++)
15511551   {
trunk/src/mame/video/atarisy1.c
r21033r21034
627627      return m_bank_gfx[bpp - 4][bank_index];
628628
629629   /* if the bank is out of range, call it 0 */
630   memory_region *tiles = machine().root_device().memregion("tiles");
630   memory_region *tiles = memregion("tiles");
631631   if (0x80000 * (bank_index - 1) >= tiles->bytes())
632632      return 0;
633633
trunk/src/mame/video/irobot.c
r21033r21034
3939
4040void irobot_state::palette_init()
4141{
42   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
42   const UINT8 *color_prom = memregion("proms")->base();
4343   int i;
4444
4545   /* convert the color prom for the text palette */
trunk/src/mame/video/skykid.c
r21033r21034
1717
1818void skykid_state::palette_init()
1919{
20   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
20   const UINT8 *color_prom = memregion("proms")->base();
2121   int i;
2222
2323   /* allocate the colortable */
trunk/src/mame/video/gomoku.c
r21033r21034
2020
2121void gomoku_state::palette_init()
2222{
23   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
23   const UINT8 *color_prom = memregion("proms")->base();
2424   int i;
2525   int bit0, bit1, bit2, r, g, b;
2626
r21033r21034
146146
147147UINT32 gomoku_state::screen_update_gomoku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
148148{
149   UINT8 *GOMOKU_BG_X = machine().root_device().memregion( "user1" )->base();
150   UINT8 *GOMOKU_BG_Y = machine().root_device().memregion( "user2" )->base();
149   UINT8 *GOMOKU_BG_X = memregion( "user1" )->base();
150   UINT8 *GOMOKU_BG_Y = memregion( "user2" )->base();
151151   UINT8 *GOMOKU_BG_D = memregion( "user3" )->base();
152152   int x, y;
153153   int bgram;
trunk/src/mame/video/pacland.c
r21033r21034
8989
9090void pacland_state::palette_init()
9191{
92   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
92   const UINT8 *color_prom = memregion("proms")->base();
9393   int i;
9494
9595   /* allocate the colortable */
trunk/src/mame/video/lucky74.c
r21033r21034
129129   We're constructing a double-sized palette with one half for each state.
130130*/
131131{
132   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
132   const UINT8 *color_prom = 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];
trunk/src/mame/video/galivan.c
r21033r21034
5454
5555void galivan_state::palette_init()
5656{
57   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
57   const UINT8 *color_prom = memregion("proms")->base();
5858   int i;
5959
6060   /* allocate the colortable */
r21033r21034
122122
123123TILE_GET_INFO_MEMBER(galivan_state::get_bg_tile_info)
124124{
125   UINT8 *BGROM = machine().root_device().memregion("gfx4")->base();
125   UINT8 *BGROM = memregion("gfx4")->base();
126126   int attr = BGROM[tile_index + 0x4000];
127127   int code = BGROM[tile_index] | ((attr & 0x03) << 8);
128128   SET_TILE_INFO_MEMBER(
r21033r21034
146146
147147TILE_GET_INFO_MEMBER(galivan_state::ninjemak_get_bg_tile_info)
148148{
149   UINT8 *BGROM = machine().root_device().memregion("gfx4")->base();
149   UINT8 *BGROM = memregion("gfx4")->base();
150150   int attr = BGROM[tile_index + 0x4000];
151151   int code = BGROM[tile_index] | ((attr & 0x03) << 8);
152152   SET_TILE_INFO_MEMBER(
trunk/src/mame/video/hanaawas.c
r21033r21034
1717
1818void hanaawas_state::palette_init()
1919{
20   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
20   const UINT8 *color_prom = memregion("proms")->base();
2121   int i;
2222
2323   /* allocate the colortable */
trunk/src/mame/video/fgoal.c
r21033r21034
4646
4747   /* draw color overlay foreground and background */
4848
49   if (m_fgoal_player == 1 && (machine().root_device().ioport("IN1")->read() & 0x40))
49   if (m_fgoal_player == 1 && (ioport("IN1")->read() & 0x40))
5050   {
5151      drawgfxzoom_opaque(m_fgbitmap, cliprect, machine().gfx[0],
5252         0, (m_fgoal_player << 2) | m_current_color,
trunk/src/mame/video/lvcards.c
r21033r21034
1212
1313PALETTE_INIT_MEMBER(lvcards_state,ponttehk)
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   for ( i = 0; i < machine().total_colors(); i++ )
r21033r21034
4848
4949void lvcards_state::palette_init()//Ever so slightly different, but different enough.
5050{
51   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
51   const UINT8 *color_prom = memregion("proms")->base();
5252   int i;
5353
5454   for ( i = 0; i < machine().total_colors(); i++ )
trunk/src/mame/video/route16.c
r21033r21034
7272{
7373   offs_t offs;
7474
75   UINT8 *color_prom1 = &machine().root_device().memregion("proms")->base()[0x000];
75   UINT8 *color_prom1 = &memregion("proms")->base()[0x000];
7676   UINT8 *color_prom2 = &memregion("proms")->base()[0x100];
7777
7878   for (offs = 0; offs < m_videoram1.bytes(); offs++)
trunk/src/mame/video/gberet.c
r21033r21034
2323
2424PALETTE_INIT_MEMBER(gberet_state,gberet)
2525{
26   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
26   const UINT8 *color_prom = memregion("proms")->base();
2727   int i;
2828
2929   /* allocate the colortable */
trunk/src/mame/video/snk6502.c
r21033r21034
2424***************************************************************************/
2525PALETTE_INIT_MEMBER(snk6502_state,snk6502)
2626{
27   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
27   const UINT8 *color_prom = memregion("proms")->base();
2828   int i;
2929
3030   for (i = 0; i < machine().total_colors(); i++)
r21033r21034
195195
196196PALETTE_INIT_MEMBER(snk6502_state,satansat)
197197{
198   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
198   const UINT8 *color_prom = memregion("proms")->base();
199199   int i;
200200
201201   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/yiear.c
r21033r21034
3030
3131void yiear_state::palette_init()
3232{
33   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
33   const UINT8 *color_prom = memregion("proms")->base();
3434   int i;
3535
3636   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/zaccaria.c
r21033r21034
3535***************************************************************************/
3636void zaccaria_state::palette_init()
3737{
38   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
38   const UINT8 *color_prom = 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 };
trunk/src/mame/video/bking.c
r21033r21034
3030
3131void bking_state::palette_init()
3232{
33   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
33   const UINT8 *color_prom = 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];
r21033r21034
307307
308308      if (latch != 0)
309309      {
310         const UINT8* MASK = machine().root_device().memregion("user1")->base() + 8 * m_hit;
310         const UINT8* MASK = memregion("user1")->base() + 8 * m_hit;
311311
312312         int x;
313313         int y;
trunk/src/mame/video/gyruss.c
r21033r21034
3131
3232void gyruss_state::palette_init()
3333{
34   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
34   const UINT8 *color_prom = 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];
trunk/src/mame/video/cps1.c
r21033r21034
15311531         by the cpu core as a 32-bit branch. This branch would make the
15321532         game crash (address error, since it would branch to an odd address)
15331533         if location 180ca6 (outside ROM space) isn't 0. Protection check? */
1534      UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
1534      UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
15351535      rom[0x11756 / 2] = 0x4e71;
15361536   }
15371537   else if (strcmp(gamename, "ghouls") == 0)
15381538   {
15391539      /* Patch out self-test... it takes forever */
1540      UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
1540      UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
15411541      rom[0x61964 / 2] = 0x4ef9;
15421542      rom[0x61966 / 2] = 0x0000;
15431543      rom[0x61968 / 2] = 0x0400;
trunk/src/mame/video/ojankohs.c
r21033r21034
1919
2020PALETTE_INIT_MEMBER(ojankohs_state,ojankoy)
2121{
22   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
22   const UINT8 *color_prom = memregion("proms")->base();
2323   int i;
2424   int bit0, bit1, bit2, bit3, bit4, r, g, b;
2525
trunk/src/mame/video/thedeep.c
r21033r21034
8686
8787void thedeep_state::palette_init()
8888{
89   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
89   const UINT8 *color_prom = memregion("proms")->base();
9090   int i;
9191   for (i = 0;i < 512;i++)
9292      palette_set_color_rgb(machine(),i,pal4bit(color_prom[0x400 + i] >> 0),pal4bit(color_prom[0x400 + i] >> 4),pal4bit(color_prom[0x200 + i] >> 0));
trunk/src/mame/video/orbit.c
r21033r21034
7777
7878UINT32 orbit_state::screen_update_orbit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
7979{
80   m_flip_screen = machine().root_device().ioport("DSW2")->read() & 8;
80   m_flip_screen = ioport("DSW2")->read() & 8;
8181
8282   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
8383
trunk/src/mame/video/nbmj8891.c
r21033r21034
350350      skipy = -1;
351351   }
352352
353   gfxlen = machine().root_device().memregion("gfx1")->bytes();
353   gfxlen = memregion("gfx1")->bytes();
354354   gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1);
355355
356356   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
trunk/src/mame/video/vulgus.c
r21033r21034
1818
1919void vulgus_state::palette_init()
2020{
21   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
21   const UINT8 *color_prom = memregion("proms")->base();
2222   int i;
2323
2424   machine().colortable = colortable_alloc(machine(), 256);
trunk/src/mame/video/spdodgeb.c
r21033r21034
55
66void spdodgeb_state::palette_init()
77{
8   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
8   const UINT8 *color_prom = memregion("proms")->base();
99   int i;
1010
1111
trunk/src/mame/video/liberate.c
r21033r21034
247247
248248PALETTE_INIT_MEMBER(liberate_state,liberate)
249249{
250   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
250   const UINT8 *color_prom = memregion("proms")->base();
251251   int i, bit0, bit1, bit2, g, r, b;
252252
253253   for (i = 0;i < 32;i++)
trunk/src/mame/video/gunsmoke.c
r21033r21034
1818
1919void gunsmoke_state::palette_init()
2020{
21   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
21   const UINT8 *color_prom = memregion("proms")->base();
2222   int i;
2323
2424   /* allocate the colortable */
r21033r21034
103103
104104TILE_GET_INFO_MEMBER(gunsmoke_state::get_bg_tile_info)
105105{
106   UINT8 *tilerom = machine().root_device().memregion("gfx4")->base();
106   UINT8 *tilerom = memregion("gfx4")->base();
107107
108108   int offs = tile_index * 2;
109109   int attr = tilerom[offs + 1];
trunk/src/mame/video/plygonet.c
r21033r21034
9999   assert(m_ttl_gfx_index != MAX_GFX_ELEMENTS);
100100
101101   /* decode the ttl layer's gfx */
102   machine().gfx[m_ttl_gfx_index] = auto_alloc(machine(), gfx_element(machine(), charlayout, machine().root_device().memregion("gfx1")->base(), machine().total_colors() / 16, 0));
102   machine().gfx[m_ttl_gfx_index] = auto_alloc(machine(), gfx_element(machine(), charlayout, memregion("gfx1")->base(), machine().total_colors() / 16, 0));
103103
104104   /* create the tilemap */
105105   m_ttl_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(polygonet_state::ttl_get_tile_info),this), tilemap_mapper_delegate(FUNC(polygonet_state::plygonet_scan),this),  8, 8, 64, 32);
trunk/src/mame/video/higemaru.c
r21033r21034
2121
2222void higemaru_state::palette_init()
2323{
24   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
24   const UINT8 *color_prom = memregion("proms")->base();
2525   int i;
2626
2727   /* allocate the colortable */
trunk/src/mame/video/cheekyms.c
r21033r21034
1717
1818void cheekyms_state::palette_init()
1919{
20   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
20   const UINT8 *color_prom = memregion("proms")->base();
2121   int i, j, bit, r, g, b;
2222
2323   for (i = 0; i < 6; i++)
trunk/src/mame/video/dynax.c
r21033r21034
2828/* x B01234 G01234 R01234 */
2929PALETTE_INIT_MEMBER(dynax_state,sprtmtch)
3030{
31   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
31   const UINT8 *color_prom = memregion("proms")->base();
3232   if (!color_prom)
3333      return;
3434
r21033r21034
4646/* x xB0123 xG0123 xR0123 */
4747PALETTE_INIT_MEMBER(dynax_state,janyuki)
4848{
49   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
49   const UINT8 *color_prom = memregion("proms")->base();
5050   if (!color_prom)
5151      return;
5252
trunk/src/mame/video/timelimt.c
r21033r21034
2121***************************************************************************/
2222
2323void timelimt_state::palette_init(){
24   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
24   const UINT8 *color_prom = memregion("proms")->base();
2525   int i;
2626
2727   for (i = 0;i < machine().total_colors();i++)
trunk/src/mame/video/pacman.c
r21033r21034
6363
6464PALETTE_INIT_MEMBER(pacman_state,pacman)
6565{
66   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
66   const UINT8 *color_prom = memregion("proms")->base();
6767   static const int resistances[3] = { 1000, 470, 220 };
6868   double rweights[3], gweights[3], bweights[2];
6969   int i;
trunk/src/mame/video/m52.c
r21033r21034
1919
2020void m52_state::palette_init()
2121{
22   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
22   const UINT8 *color_prom = 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;
trunk/src/mame/video/phoenix.c
r21033r21034
7878
7979PALETTE_INIT_MEMBER(phoenix_state,phoenix)
8080{
81   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
81   const UINT8 *color_prom = memregion("proms")->base();
8282   int i;
8383   rgb_t   *rgb;
8484
r21033r21034
9696
9797PALETTE_INIT_MEMBER(phoenix_state,survival)
9898{
99   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
99   const UINT8 *color_prom = memregion("proms")->base();
100100   int i;
101101   rgb_t   *rgb;
102102
r21033r21034
114114
115115PALETTE_INIT_MEMBER(phoenix_state,pleiads)
116116{
117   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
117   const UINT8 *color_prom = memregion("proms")->base();
118118   int i;
119119   rgb_t   *rgb;
120120
trunk/src/mame/video/markham.c
r21033r21034
1313
1414void markham_state::palette_init()
1515{
16   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
16   const UINT8 *color_prom = memregion("proms")->base();
1717   int i;
1818
1919   /* allocate the colortable */
trunk/src/mame/video/tmnt.c
r21033r21034
1616
1717TILE_GET_INFO_MEMBER(tmnt_state::prmrsocr_get_roz_tile_info)
1818{
19   UINT8 *rom = machine().root_device().memregion("user1")->base();
19   UINT8 *rom = memregion("user1")->base();
2020   int code = rom[tile_index + 0x20000] + 256 * rom[tile_index];
2121
2222   SET_TILE_INFO_MEMBER(0, code & 0x1fff, code >> 13, 0);
trunk/src/mame/video/carjmbre.c
r21033r21034
3232
3333void carjmbre_state::palette_init()
3434{
35   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *color_prom = memregion("proms")->base();
3636   rgb_t *rgb;
3737
3838   rgb = compute_res_net_all(machine(), color_prom, &carjmbre_decode_info, &carjmbre_net_info);
trunk/src/mame/video/cvs.c
r21033r21034
2727
2828PALETTE_INIT_MEMBER(cvs_state,cvs)
2929{
30   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
30   const UINT8 *color_prom = memregion("proms")->base();
3131   int i, attr;
3232
3333   /* allocate the colortable */
trunk/src/mame/video/thepit.c
r21033r21034
2828
2929void thepit_state::palette_init()
3030{
31   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
31   const UINT8 *color_prom = memregion("proms")->base();
3232   int i;
3333
3434   for (i = 0; i < 32; i++)
r21033r21034
6969
7070PALETTE_INIT_MEMBER(thepit_state,suprmous)
7171{
72   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
72   const UINT8 *color_prom = memregion("proms")->base();
7373   int i;
7474
7575   for (i = 0; i < 32; i++)
trunk/src/mame/video/cloud9.c
r21033r21034
2424   membank("bank1")->set_base(m_videoram);
2525
2626   /* get pointers to our PROMs */
27   m_syncprom = machine().root_device().memregion("proms")->base() + 0x000;
28   m_wpprom = machine().root_device().memregion("proms")->base() + 0x200;
29   m_priprom = machine().root_device().memregion("proms")->base() + 0x300;
27   m_syncprom = memregion("proms")->base() + 0x000;
28   m_wpprom = memregion("proms")->base() + 0x200;
29   m_priprom = memregion("proms")->base() + 0x300;
3030
3131   /* compute the color output resistor weights at startup */
3232   compute_resistor_weights(0, 255, -1.0,
trunk/src/mame/video/pooyan.c
r21033r21034
2929
3030void pooyan_state::palette_init()
3131{
32   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
32   const UINT8 *color_prom = 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];
trunk/src/mame/video/megazone.c
r21033r21034
3838
3939void megazone_state::palette_init()
4040{
41   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
41   const UINT8 *color_prom = 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];
trunk/src/mame/video/segas32.c
r21033r21034
16231623   };
16241624
16251625   bitmap_ind16 &bitmap = *m_layer_data[(!m_is_multi32 || !(data[3] & 0x0800)) ? MIXER_LAYER_SPRITES_2 : MIXER_LAYER_MULTISPR_2].bitmap;
1626   UINT8 numbanks = machine().root_device().memregion("gfx2")->bytes() / 0x400000;
1627   const UINT32 *spritebase = (const UINT32 *)machine().root_device().memregion("gfx2")->base();
1626   UINT8 numbanks = memregion("gfx2")->bytes() / 0x400000;
1627   const UINT32 *spritebase = (const UINT32 *)memregion("gfx2")->base();
16281628
16291629   int indirect = data[0] & 0x2000;
16301630   int indlocal = data[0] & 0x1000;
trunk/src/mame/video/equites.c
r21033r21034
1010
1111PALETTE_INIT_MEMBER(equites_state,equites)
1212{
13   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
13   const UINT8 *color_prom = memregion("proms")->base();
1414   int i;
1515
1616   machine().colortable = colortable_alloc(machine(), 256);
r21033r21034
3030
3131PALETTE_INIT_MEMBER(equites_state,splndrbt)
3232{
33   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
33   const UINT8 *color_prom = memregion("proms")->base();
3434   int i;
3535
3636   machine().colortable = colortable_alloc(machine(), 256);
trunk/src/mame/video/nbmj8688.c
r21033r21034
313313      skipy = -1;
314314   }
315315
316   gfxlen = machine().root_device().memregion("gfx1")->bytes();
316   gfxlen = memregion("gfx1")->bytes();
317317   gfxaddr = (m_mjsikaku_gfxrom << 17) + (m_blitter_src_addr << 1);
318318
319319//popmessage("ADDR:%08X DX:%03d DY:%03d SX:%03d SY:%03d", gfxaddr, startx, starty, sizex, sizey);
trunk/src/mame/video/ikki.c
r21033r21034
1313
1414void ikki_state::palette_init()
1515{
16   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
16   const UINT8 *color_prom = memregion("proms")->base();
1717   int i;
1818
1919   /* allocate the colortable - extra pen for the punch through pen */
trunk/src/mame/video/shisen.c
r21033r21034
6060   // on Irem boards, screen flip is handled in both hardware and software.
6161   // this game doesn't have cocktail mode so if there's software control we don't
6262   // know where it is mapped.
63   flip_screen_set(~machine().root_device().ioport("DSW2")->read() & 1);
63   flip_screen_set(~ioport("DSW2")->read() & 1);
6464
6565
6666   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
trunk/src/mame/video/ginganin.c
r21033r21034
7676
7777TILE_GET_INFO_MEMBER(ginganin_state::get_bg_tile_info)
7878{
79   UINT8 *gfx = machine().root_device().memregion("gfx5")->base();
79   UINT8 *gfx = memregion("gfx5")->base();
8080   int code = gfx[2 * tile_index + 0] * 256 + gfx[2 * tile_index + 1];
8181   SET_TILE_INFO_MEMBER(
8282         BG_GFX,
trunk/src/mame/video/dkong.c
r21033r21034
205205
206206PALETTE_INIT_MEMBER(dkong_state,dkong2b)
207207{
208   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
208   const UINT8 *color_prom = memregion("proms")->base();
209209   rgb_t   *rgb;
210210   int i;
211211
r21033r21034
235235#ifdef UNUSED_FUNCTION
236236PALETTE_INIT_MEMBER(dkong_state,dkong4b)
237237{
238   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
238   const UINT8 *color_prom = memregion("proms")->base();
239239   int i;
240240   int r,g,b;
241241
r21033r21034
273273
274274PALETTE_INIT_MEMBER(dkong_state,radarscp)
275275{
276   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
276   const UINT8 *color_prom = memregion("proms")->base();
277277   int i;
278278   int r,g,b;
279279
r21033r21034
336336
337337PALETTE_INIT_MEMBER(dkong_state,radarscp1)
338338{
339   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
339   const UINT8 *color_prom = memregion("proms")->base();
340340   int i;
341341   int r,g,b;
342342
r21033r21034
435435
436436PALETTE_INIT_MEMBER(dkong_state,dkong3)
437437{
438   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
438   const UINT8 *color_prom = memregion("proms")->base();
439439   rgb_t   *rgb;
440440
441441   rgb = compute_res_net_all(machine(), color_prom, &dkong3_decode_info, &dkong3_net_info);
trunk/src/mame/video/rollrace.c
r21033r21034
2222***************************************************************************/
2323void rollrace_state::palette_init()
2424{
25   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
25   const UINT8 *color_prom = memregion("proms")->base();
2626   int i;
2727
2828
trunk/src/mame/video/epos.c
r21033r21034
2525void epos_state::get_pens( pen_t *pens )
2626{
2727   offs_t i;
28   const UINT8 *prom = machine().root_device().memregion("proms")->base();
29   int len = machine().root_device().memregion("proms")->bytes();
28   const UINT8 *prom = memregion("proms")->base();
29   int len = memregion("proms")->bytes();
3030
3131   for (i = 0; i < len; i++)
3232   {
trunk/src/mame/video/firetrk.c
r21033r21034
6464
6565PALETTE_INIT_MEMBER(firetrk_state,montecar)
6666{
67   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
67   const UINT8 *color_prom = memregion("proms")->base();
6868   int i;
6969
7070   static const UINT8 colortable_source[] =
trunk/src/mame/video/tryout.c
r21033r21034
1111
1212void tryout_state::palette_init()
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = memregion("proms")->base();
1515   int i;
1616
1717   for (i = 0;i < machine().total_colors();i++)
trunk/src/mame/video/sidearms.c
r21033r21034
217217   _vcount_191 = m_vcount_191;
218218   _hcount_191 = m_hcount_191 & 0xff;
219219
220   sf_rom = machine().root_device().memregion("user1")->base();
220   sf_rom = memregion("user1")->base();
221221
222222#if 0 // old loop (for reference; easier to read)
223223   if (!flipon)
trunk/src/mame/video/kingobox.c
r21033r21034
123123
124124PALETTE_INIT_MEMBER(kingofb_state,kingofb)
125125{
126   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
126   const UINT8 *color_prom = memregion("proms")->base();
127127   palette_init_common(color_prom, &kingofb_state::kingofb_get_rgb_data);
128128}
129129
130130PALETTE_INIT_MEMBER(kingofb_state,ringking)
131131{
132   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
132   const UINT8 *color_prom = memregion("proms")->base();
133133   palette_init_common(color_prom, &kingofb_state::ringking_get_rgb_data);
134134}
135135
trunk/src/mame/video/nbmj8991.c
r21033r21034
211211      skipy = -1;
212212   }
213213
214   gfxlen = machine().root_device().memregion("gfx1")->bytes();
214   gfxlen = memregion("gfx1")->bytes();
215215   gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1);
216216
217217   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
trunk/src/mame/video/skyfox.c
r21033r21034
8888
8989void skyfox_state::palette_init()
9090{
91   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
91   const UINT8 *color_prom = memregion("proms")->base();
9292   int i;
9393
9494   for (i = 0; i < 256; i++)
trunk/src/mame/video/ladybug.c
r21033r21034
9595
9696PALETTE_INIT_MEMBER(ladybug_state,ladybug)
9797{
98   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
98   const UINT8 *color_prom = memregion("proms")->base();
9999   palette_init_common(machine(), color_prom, 0x20, 0, 5, 2, 6, 4, 7);
100100}
101101
102102PALETTE_INIT_MEMBER(ladybug_state,sraider)
103103{
104   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
104   const UINT8 *color_prom = memregion("proms")->base();
105105   int i;
106106
107107   /* the resistor net may be probably different than Lady Bug */
trunk/src/mame/video/mcd212.c
r21033r21034
10861086
10871087void mcd212_device::mix_lines(UINT8 *plane_a_r, UINT8 *plane_a_g, UINT8 *plane_a_b, UINT8 *plane_b_r, UINT8 *plane_b_g, UINT8 *plane_b_b, UINT32 *out)
10881088{
1089   UINT8 debug_mode = machine().root_device().ioport("DEBUG")->read();
1089   UINT8 debug_mode = ioport("DEBUG")->read();
10901090   UINT8 global_plane_a_disable = debug_mode & 1;
10911091   UINT8 global_plane_b_disable = debug_mode & 2;
10921092   UINT8 debug_backdrop_enable = debug_mode & 4;
trunk/src/mame/video/m62.c
r21033r21034
199199
200200void m62_state::palette_init()
201201{
202   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
202   const UINT8 *color_prom = memregion("proms")->base();
203203   rgb_t *rgb;
204204
205205   rgb = compute_res_net_all(machine(), color_prom, &m62_tile_decode_info, &m62_tile_net_info);
r21033r21034
219219
220220PALETTE_INIT_MEMBER(m62_state,lotlot)
221221{
222   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
222   const UINT8 *color_prom = memregion("proms")->base();
223223   rgb_t *rgb;
224224
225225   rgb = compute_res_net_all(machine(), color_prom, &lotlot_tile_decode_info, &m62_tile_net_info);
r21033r21034
239239
240240PALETTE_INIT_MEMBER(m62_state,battroad)
241241{
242   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
242   const UINT8 *color_prom = memregion("proms")->base();
243243   rgb_t *rgb;
244244
245245   // m62 palette
r21033r21034
265265
266266PALETTE_INIT_MEMBER(m62_state,spelunk2)
267267{
268   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
268   const UINT8 *color_prom = memregion("proms")->base();
269269   rgb_t *rgb;
270270
271271   rgb = compute_res_net_all(machine(), color_prom, &spelunk2_tile_decode_info, &m62_tile_net_info);
trunk/src/mame/video/stfight.c
r21033r21034
3232
3333void stfight_state::palette_init()
3434{
35   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *color_prom = memregion("proms")->base();
3636   int i;
3737
3838   /* allocate the colortable */
r21033r21034
9696
9797TILE_GET_INFO_MEMBER(stfight_state::get_fg_tile_info)
9898{
99   UINT8   *fgMap = machine().root_device().memregion("gfx5")->base();
99   UINT8   *fgMap = memregion("gfx5")->base();
100100   int attr,tile_base;
101101
102102   attr = fgMap[0x8000+tile_index];
r21033r21034
119119
120120TILE_GET_INFO_MEMBER(stfight_state::get_bg_tile_info)
121121{
122   UINT8   *bgMap = machine().root_device().memregion("gfx6")->base();
122   UINT8   *bgMap = memregion("gfx6")->base();
123123   int attr,tile_bank,tile_base;
124124
125125   attr = bgMap[0x8000+tile_index];
trunk/src/mame/video/exidy440.c
r21033r21034
423423   {
424424      int i;
425425
426      int beamx = ((machine().root_device().ioport("AN0")->read() & 0xff) * (HBSTART - HBEND)) >> 8;
427      int beamy = ((machine().root_device().ioport("AN1")->read() & 0xff) * (VBSTART - VBEND)) >> 8;
426      int beamx = ((ioport("AN0")->read() & 0xff) * (HBSTART - HBEND)) >> 8;
427      int beamy = ((ioport("AN1")->read() & 0xff) * (VBSTART - VBEND)) >> 8;
428428
429429      /* The timing of this FIRQ is very important. The games look for an FIRQ
430430          and then wait about 650 cycles, clear the old FIRQ, and wait a
trunk/src/mame/video/sonson.c
r21033r21034
4141
4242void sonson_state::palette_init()
4343{
44   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
44   const UINT8 *color_prom = memregion("proms")->base();
4545   int i;
4646
4747   /* allocate the colortable */
trunk/src/mame/video/pingpong.c
r21033r21034
3232***************************************************************************/
3333void pingpong_state::palette_init()
3434{
35   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *color_prom = memregion("proms")->base();
3636   int i;
3737
3838   /* allocate the colortable */
trunk/src/mame/video/pcktgal.c
r21033r21034
44
55void pcktgal_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99
1010   for (i = 0;i < machine().total_colors();i++)
trunk/src/mame/video/retofinv.c
r21033r21034
1212
1313void retofinv_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
trunk/src/mame/video/btime.c
r21033r21034
3030
3131PALETTE_INIT_MEMBER(btime_state,btime)
3232{
33   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
33   const UINT8 *color_prom = memregion("proms")->base();
3434   int i;
3535
3636
r21033r21034
8181
8282PALETTE_INIT_MEMBER(btime_state,lnc)
8383{
84   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
84   const UINT8 *color_prom = memregion("proms")->base();
8585   int i;
8686
8787   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/bogeyman.c
r21033r21034
44
55void bogeyman_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99
1010   /* first 16 colors are RAM */
trunk/src/mame/video/madalien.c
r21033r21034
1616
1717PALETTE_INIT_MEMBER(madalien_state,madalien)
1818{
19   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
19   const UINT8 *color_prom = memregion("proms")->base();
2020   int i;
2121
2222   /* allocate the colortable */
r21033r21034
248248
249249UINT32 madalien_state::screen_update_madalien(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
250250{
251   int flip = BIT(machine().root_device().ioport("DSW")->read(), 6) && BIT(*m_video_control, 0);
251   int flip = BIT(ioport("DSW")->read(), 6) && BIT(*m_video_control, 0);
252252
253253   // bits #0 and #1 define scrolling mode
254254   //
trunk/src/mame/video/fcombat.c
r21033r21034
1414
1515   //palno = (tile_index - (tile_index / 32 * 16) * 32 * 16) / 32;
1616
17   tileno = machine().root_device().memregion("user1")->base()[tile_index];
18   palno = 0x18; //machine().root_device().memregion("user2")->base()[tile_index] >> 3;
17   tileno = memregion("user1")->base()[tile_index];
18   palno = 0x18; //memregion("user2")->base()[tile_index] >> 3;
1919   SET_TILE_INFO_MEMBER(2, tileno, palno, 0);
2020}
2121
r21033r21034
3939
4040void fcombat_state::palette_init()
4141{
42   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
42   const UINT8 *color_prom = memregion("proms")->base();
4343   int i;
4444
4545   /* allocate the colortable */
trunk/src/mame/video/firetrap.c
r21033r21034
3636
3737void firetrap_state::palette_init()
3838{
39   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
39   const UINT8 *color_prom = memregion("proms")->base();
4040   int i;
4141
4242
trunk/src/mame/video/marineb.c
r21033r21034
1212
1313void marineb_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/timeplt.c
r21033r21034
3939
4040void timeplt_state::palette_init()
4141{
42   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
42   const UINT8 *color_prom = memregion("proms")->base();
4343   rgb_t palette[32];
4444   int i;
4545
trunk/src/mame/video/ambush.c
r21033r21034
2020
2121void ambush_state::palette_init()
2222{
23   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
23   const UINT8 *color_prom = memregion("proms")->base();
2424   int i;
2525
2626   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/bladestl.c
r21033r21034
55
66void bladestl_state::palette_init()
77{
8   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
8   const UINT8 *color_prom = memregion("proms")->base();
99   int i;
1010
1111   /* allocate the colortable */
trunk/src/mame/video/gaplus.c
r21033r21034
2525
2626void gaplus_state::palette_init()
2727{
28   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
28   const UINT8 *color_prom = memregion("proms")->base();
2929   int i;
3030
3131   /* allocate the colortable */
trunk/src/mame/video/funworld.c
r21033r21034
5050
5151PALETTE_INIT_MEMBER(funworld_state,funworld)
5252{
53   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
53   const UINT8 *color_prom = memregion("proms")->base();
5454   int i;
5555   static const int resistances_rb[3] = { 1000, 470, 220 };
5656   static const int resistances_g [2] = { 470, 220 };
trunk/src/mame/video/nbmj8900.c
r21033r21034
143143{
144144   m_gfxrom = (data & 0x0f);
145145
146   if ((0x20000 * m_gfxrom) > (machine().root_device().memregion("gfx")->bytes() - 1))
146   if ((0x20000 * m_gfxrom) > (memregion("gfx")->bytes() - 1))
147147   {
148148#ifdef MAME_DEBUG
149149      popmessage("GFXROM BANK OVER!!");
150150#endif
151      m_gfxrom &= (machine().root_device().memregion("gfx")->bytes() / 0x20000 - 1);
151      m_gfxrom &= (memregion("gfx")->bytes() / 0x20000 - 1);
152152   }
153153}
154154
r21033r21034
247247   {
248248      for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
249249      {
250         if ((gfxaddr > (machine().root_device().memregion("gfx")->bytes() - 1)))
250         if ((gfxaddr > (memregion("gfx")->bytes() - 1)))
251251         {
252252#ifdef MAME_DEBUG
253253            popmessage("GFXROM ADDRESS OVER!!");
254254#endif
255            gfxaddr &= (machine().root_device().memregion("gfx")->bytes() - 1);
255            gfxaddr &= (memregion("gfx")->bytes() - 1);
256256         }
257257
258258         color = GFX[gfxaddr++];
trunk/src/mame/video/tx1.c
r21033r21034
111111
112112PALETTE_INIT_MEMBER(tx1_state,tx1)
113113{
114   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
114   const UINT8 *color_prom = memregion("proms")->base();
115115   int i;
116116
117117   static const res_net_info tx1_net_info =
r21033r21034
12431243
12441244PALETTE_INIT_MEMBER(tx1_state,buggyboy)
12451245{
1246   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
1246   const UINT8 *color_prom = memregion("proms")->base();
12471247   int i;
12481248
12491249   for (i = 0; i < 0x100; i++)
trunk/src/mame/video/ssozumo.c
r21033r21034
1414
1515void ssozumo_state::palette_init()
1616{
17   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
17   const UINT8 *color_prom = memregion("proms")->base();
1818   int bit0, bit1, bit2, bit3, r, g, b;
1919   int i;
2020
trunk/src/mame/video/naughtyb.c
r21033r21034
5858
5959void naughtyb_state::palette_init()
6060{
61   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
61   const UINT8 *color_prom = memregion("proms")->base();
6262   static const int resistances[2] = { 270, 130 };
6363   double weights[2];
6464   int i;
trunk/src/mame/video/contra.c
r21033r21034
2222
2323void contra_state::palette_init()
2424{
25   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
25   const UINT8 *color_prom = memregion("proms")->base();
2626   int chip;
2727
2828   /* allocate the colortable */
trunk/src/mame/video/dcheese.c
r21033r21034
2727
2828void dcheese_state::palette_init()
2929{
30   const UINT16 *src = (UINT16 *)machine().root_device().memregion("user1")->base();
30   const UINT16 *src = (UINT16 *)memregion("user1")->base();
3131   int i;
3232
3333   /* really 65536 colors, but they don't use the later ones so we can stay */
trunk/src/mame/video/ultratnk.c
r21033r21034
1111
1212void ultratnk_state::palette_init()
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = memregion("proms")->base();
1515   /* allocate the colortable */
1616   machine().colortable = colortable_alloc(machine(), 4);
1717
trunk/src/mame/video/scotrsht.c
r21033r21034
55/* Similar as Iron Horse */
66void scotrsht_state::palette_init()
77{
8   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
8   const UINT8 *color_prom = memregion("proms")->base();
99   int i;
1010
1111   /* allocate the colortable */
trunk/src/mame/video/mouser.c
r21033r21034
1818
1919void mouser_state::palette_init()
2020{
21   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
21   const UINT8 *color_prom = memregion("proms")->base();
2222   int i;
2323
2424   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/playch10.c
r21033r21034
1616
1717void playch10_state::palette_init()
1818{
19   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
19   const UINT8 *color_prom = memregion("proms")->base();
2020   ppu2c0x_device *ppu = machine().device<ppu2c0x_device>("ppu");
2121   int i;
2222
trunk/src/mame/video/brkthru.c
r21033r21034
3434
3535void brkthru_state::palette_init()
3636{
37   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
37   const UINT8 *color_prom = memregion("proms")->base();
3838   int i;
3939
4040   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/zaxxon.c
r21033r21034
1717
1818void zaxxon_state::palette_init()
1919{
20   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
20   const UINT8 *color_prom = memregion("proms")->base();
2121   static const int resistances[3] = { 1000, 470, 220 };
2222   double rweights[3], gweights[3], bweights[2];
2323   int i;
r21033r21034
6868
6969TILE_GET_INFO_MEMBER(zaxxon_state::get_bg_tile_info)
7070{
71   const UINT8 *source = machine().root_device().memregion("tilemap_dat")->base();
72   int size = machine().root_device().memregion("tilemap_dat")->bytes() / 2;
71   const UINT8 *source = memregion("tilemap_dat")->base();
72   int size = memregion("tilemap_dat")->bytes() / 2;
7373   int eff_index = tile_index & (size - 1);
7474   int code = source[eff_index] + 256 * (source[eff_index + size] & 3);
7575   int color = source[eff_index + size] >> 4;
trunk/src/mame/video/seta.c
r21033r21034
652652// color prom
653653PALETTE_INIT_MEMBER(seta_state,inttoote)
654654{
655   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
655   const UINT8 *color_prom = memregion("proms")->base();
656656   int x;
657657   for (x = 0; x < 0x200 ; x++)
658658   {
r21033r21034
671671
672672PALETTE_INIT_MEMBER(seta_state,usclssic)
673673{
674   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
674   const UINT8 *color_prom = memregion("proms")->base();
675675   int color, pen;
676676   int x;
677677
trunk/src/mame/video/tnzs.c
r21033r21034
3232
3333PALETTE_INIT_MEMBER(tnzs_state,arknoid2)
3434{
35   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *color_prom = memregion("proms")->base();
3636   int i, col;
3737
3838   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/tp84.c
r21033r21034
4343*/
4444void tp84_state::palette_init()
4545{
46   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
46   const UINT8 *color_prom = memregion("proms")->base();
4747   static const int resistances[4] = { 1000, 470, 220, 100 };
4848   double weights[4];
4949   int i;
trunk/src/mame/video/karnov.c
r21033r21034
3838
3939void karnov_state::palette_init()
4040{
41   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
41   const UINT8 *color_prom = memregion("proms")->base();
4242   int i;
4343
4444   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/exerion.c
r21033r21034
3636
3737void exerion_state::palette_init()
3838{
39   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
39   const UINT8 *color_prom = 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];
trunk/src/mame/video/decocass.c
r21033r21034
688688{
689689   /* THIS CODE SHOULD NOT BE IN SCREEN UPDATE !! */
690690
691   if (0xc0 != (machine().root_device().ioport("IN2")->read() & 0xc0))  /* coin slots assert an NMI */
691   if (0xc0 != (ioport("IN2")->read() & 0xc0))  /* coin slots assert an NMI */
692692      m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
693693
694694   if (0 == (m_watchdog_flip & 0x04))
trunk/src/mame/video/mystwarr.c
r21033r21034
437437// reference: 223e5c in gaiapolis (ROMs 34j and 36m)
438438READ16_MEMBER(mystwarr_state::gai_053936_tilerom_0_r)
439439{
440   UINT8 *ROM1 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
441   UINT8 *ROM2 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
440   UINT8 *ROM1 = (UINT8 *)memregion("gfx4")->base();
441   UINT8 *ROM2 = (UINT8 *)memregion("gfx4")->base();
442442
443443   ROM1 += 0x20000;
444444   ROM2 += 0x20000+0x40000;
r21033r21034
448448
449449READ16_MEMBER(mystwarr_state::ddd_053936_tilerom_0_r)
450450{
451   UINT8 *ROM1 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
452   UINT8 *ROM2 = (UINT8 *)machine().root_device().memregion("gfx4")->base();
451   UINT8 *ROM1 = (UINT8 *)memregion("gfx4")->base();
452   UINT8 *ROM2 = (UINT8 *)memregion("gfx4")->base();
453453
454454   ROM2 += 0x40000;
455455
r21033r21034
459459// reference: 223e1a in gaiapolis (ROM 36j)
460460READ16_MEMBER(mystwarr_state::ddd_053936_tilerom_1_r)
461461{
462   UINT8 *ROM = (UINT8 *)machine().root_device().memregion("gfx4")->base();
462   UINT8 *ROM = (UINT8 *)memregion("gfx4")->base();
463463
464464   return ROM[offset/2];
465465}
r21033r21034
467467// reference: 223db0 in gaiapolis (ROMs 32n, 29n, 26n)
468468READ16_MEMBER(mystwarr_state::gai_053936_tilerom_2_r)
469469{
470   UINT8 *ROM = (UINT8 *)machine().root_device().memregion("gfx3")->base();
470   UINT8 *ROM = (UINT8 *)memregion("gfx3")->base();
471471
472472   offset += (m_roz_rombank * 0x100000);
473473
r21033r21034
476476
477477READ16_MEMBER(mystwarr_state::ddd_053936_tilerom_2_r)
478478{
479   UINT8 *ROM = (UINT8 *)machine().root_device().memregion("gfx3")->base();
479   UINT8 *ROM = (UINT8 *)memregion("gfx3")->base();
480480
481481   offset += (m_roz_rombank * 0x100000);
482482
trunk/src/mame/video/1942.c
r21033r21034
2626
2727void _1942_state::palette_init()
2828{
29   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
29   const UINT8 *color_prom = memregion("proms")->base();
3030   rgb_t palette[256];
3131   int i, colorbase;
3232
trunk/src/mame/video/xevious.c
r21033r21034
2626***************************************************************************/
2727PALETTE_INIT_MEMBER(xevious_state,xevious)
2828{
29   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
29   const UINT8 *color_prom = memregion("proms")->base();
3030   int i;
3131   #define TOTAL_COLORS(gfxn) (machine().gfx[gfxn]->colors() * machine().gfx[gfxn]->granularity())
3232
r21033r21034
100100
101101PALETTE_INIT_MEMBER(xevious_state,battles)
102102{
103   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
103   const UINT8 *color_prom = memregion("proms")->base();
104104   int i;
105105
106106   machine().colortable = colortable_alloc(machine(), 128+1);
trunk/src/mame/video/tunhunt.c
r21033r21034
152152    0020:   00 f0 f0 f0 b0 b0 00 f0
153153            00 f0 f0 00 b0 00 f0 f0
154154*/
155   //const UINT8 *color_prom = machine().root_device().memregion( "proms" )->base();
155   //const UINT8 *color_prom = memregion( "proms" )->base();
156156   int color;
157157   int shade;
158158   int i;
trunk/src/mame/video/sf.c
r21033r21034
99
1010TILE_GET_INFO_MEMBER(sf_state::get_bg_tile_info)
1111{
12   UINT8 *base = machine().root_device().memregion("gfx5")->base() + 2 * tile_index;
12   UINT8 *base = 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];
r21033r21034
2222
2323TILE_GET_INFO_MEMBER(sf_state::get_fg_tile_info)
2424{
25   UINT8 *base = machine().root_device().memregion("gfx5")->base() + 0x20000 + 2 * tile_index;
25   UINT8 *base = 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];
trunk/src/mame/video/glass.c
r21033r21034
8282      /* fill the screen bitmap with the current picture */
8383      {
8484         int i, j;
85         UINT8 *gfx = (UINT8 *)machine().root_device().memregion("gfx3")->base();
85         UINT8 *gfx = (UINT8 *)memregion("gfx3")->base();
8686
8787         gfx = gfx + (m_current_command & 0x07) * 0x10000 + (m_current_command & 0x08) * 0x10000 + 0x140;
8888
trunk/src/mame/video/mustache.c
r21033r21034
1212
1313void mustache_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   for (i = 0;i < 256;i++)
trunk/src/mame/video/snookr10.c
r21033r21034
5757
5858void snookr10_state::palette_init()
5959{
60   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
60   const UINT8 *color_prom = memregion("proms")->base();
6161   /* GGBBBRRR */
6262
6363   int i;
r21033r21034
117117
118118PALETTE_INIT_MEMBER(snookr10_state,apple10)
119119{
120   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
120   const UINT8 *color_prom = memregion("proms")->base();
121121   /* GGBBBRRR */
122122
123123   int i, cn;
trunk/src/mame/video/konamigx.c
r21033r21034
18721872TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac3_tile_info)
18731873   {
18741874   int tileno, colour, flip;
1875   UINT8 *tmap = machine().root_device().memregion("gfx4")->base();
1875   UINT8 *tmap = memregion("gfx4")->base();
18761876
18771877   int base_index = tile_index;
18781878
r21033r21034
18931893TILE_GET_INFO_MEMBER(konamigx_state::get_gx_psac3_alt_tile_info)
18941894   {
18951895   int tileno, colour, flip;
1896   UINT8 *tmap = machine().root_device().memregion("gfx4")->base()+0x20000;
1896   UINT8 *tmap = memregion("gfx4")->base()+0x20000;
18971897
18981898   int base_index = tile_index;
18991899
trunk/src/mame/video/sprcros2.c
r21033r21034
99
1010void sprcros2_state::palette_init()
1111{
12   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
12   const UINT8 *color_prom = memregion("proms")->base();
1313   int i;
1414
1515   /* allocate the colortable */
trunk/src/mame/video/bankp.c
r21033r21034
3535
3636void bankp_state::palette_init()
3737{
38   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
38   const UINT8 *color_prom = memregion("proms")->base();
3939   int i;
4040
4141   /* allocate the colortable */
trunk/src/mame/video/combatsc.c
r21033r21034
1212
1313PALETTE_INIT_MEMBER(combatsc_state,combatsc)
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int pal;
1717
1818   /* allocate the colortable */
r21033r21034
6363
6464PALETTE_INIT_MEMBER(combatsc_state,combatscb)
6565{
66   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
66   const UINT8 *color_prom = memregion("proms")->base();
6767   int pal;
6868
6969   /* allocate the colortable */
trunk/src/mame/video/rockrage.c
r21033r21034
44
55void rockrage_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99
1010   /* allocate the colortable */
trunk/src/mame/video/mainsnk.c
r21033r21034
44
55void mainsnk_state::palette_init()
66{
7   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
7   const UINT8 *color_prom = memregion("proms")->base();
88   int i;
99   int num_colors = 0x400;
1010
trunk/src/mame/video/mrdo.c
r21033r21034
4444
4545void mrdo_state::palette_init()
4646{
47   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
47   const UINT8 *color_prom = memregion("proms")->base();
4848   int i;
4949
5050   const int R1 = 150;
trunk/src/mame/video/bosco.c
r21033r21034
1616
1717PALETTE_INIT_MEMBER(bosco_state,bosco)
1818{
19   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
19   const UINT8 *color_prom = memregion("proms")->base();
2020   int i;
2121
2222   machine().colortable = colortable_alloc(machine(), 32+64);
trunk/src/mame/video/pandoras.c
r21033r21034
2323
2424void pandoras_state::palette_init()
2525{
26   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
26   const UINT8 *color_prom = 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];
trunk/src/mame/video/homedata.c
r21033r21034
312312
313313PALETTE_INIT_MEMBER(homedata_state,mrokumei)
314314{
315   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
315   const UINT8 *color_prom = memregion("proms")->base();
316316   int i;
317317
318318   /* initialize 555 RGB palette */
r21033r21034
335335
336336PALETTE_INIT_MEMBER(homedata_state,reikaids)
337337{
338   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
338   const UINT8 *color_prom = memregion("proms")->base();
339339   int i;
340340
341341   /* initialize 555 RGB palette */
r21033r21034
358358
359359PALETTE_INIT_MEMBER(homedata_state,pteacher)
360360{
361   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
361   const UINT8 *color_prom = memregion("proms")->base();
362362   int i;
363363
364364   /* initialize 555 RGB palette */
r21033r21034
381381
382382PALETTE_INIT_MEMBER(homedata_state,mirderby)
383383{
384   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
384   const UINT8 *color_prom = memregion("proms")->base();
385385   int i;
386386
387387   for (i = 0; i < 0x100; i++)
r21033r21034
780780
781781WRITE8_MEMBER(homedata_state::pteacher_blitter_start_w)
782782{
783   pteacher_handleblit(space, (m_blitter_bank >> 5) * 0x10000 & (machine().root_device().memregion("user1")->bytes() - 1));
783   pteacher_handleblit(space, (m_blitter_bank >> 5) * 0x10000 & (memregion("user1")->bytes() - 1));
784784}
785785
786786
trunk/src/mame/video/deadang.c
r21033r21034
3939
4040TILE_GET_INFO_MEMBER(deadang_state::get_pf3_tile_info)
4141{
42   const UINT16 *bgMap = (const UINT16 *)machine().root_device().memregion("gfx6")->base();
42   const UINT16 *bgMap = (const UINT16 *)memregion("gfx6")->base();
4343   int code= bgMap[tile_index];
4444   SET_TILE_INFO_MEMBER(4,code&0x7ff,code>>12,0);
4545}
4646
4747TILE_GET_INFO_MEMBER(deadang_state::get_pf2_tile_info)
4848{
49   const UINT16 *bgMap = (const UINT16 *)machine().root_device().memregion("gfx7")->base();
49   const UINT16 *bgMap = (const UINT16 *)memregion("gfx7")->base();
5050   int code= bgMap[tile_index];
5151   SET_TILE_INFO_MEMBER(3,code&0x7ff,code>>12,0);
5252}
trunk/src/mame/video/hcastle.c
r21033r21034
1111
1212void hcastle_state::palette_init()
1313{
14   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
14   const UINT8 *color_prom = memregion("proms")->base();
1515   int chip;
1616
1717   /* allocate the colortable */
trunk/src/mame/video/jackal.c
r21033r21034
1414
1515void jackal_state::palette_init()
1616{
17   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
17   const UINT8 *color_prom = memregion("proms")->base();
1818   int i;
1919
2020   /* allocate the colortable */
r21033r21034
6262
6363TILE_GET_INFO_MEMBER(jackal_state::get_bg_tile_info)
6464{
65   UINT8 *RAM = machine().root_device().memregion("master")->base();
65   UINT8 *RAM = memregion("master")->base();
6666
6767   int attr = RAM[0x2000 + tile_index];
6868   int code = RAM[0x2400 + tile_index] + ((attr & 0xc0) << 2) + ((attr & 0x30) << 6);
trunk/src/mame/video/fastlane.c
r21033r21034
55
66void fastlane_state::palette_init()
77{
8   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
8   const UINT8 *color_prom = memregion("proms")->base();
99   int pal;
1010
1111   /* allocate the colortable */
trunk/src/mame/video/1943.c
r21033r21034
4747
4848void _1943_state::palette_init()
4949{
50   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
50   const UINT8 *color_prom = memregion("proms")->base();
5151   int i;
5252
5353   /* allocate the colortable */
r21033r21034
163163
164164TILE_GET_INFO_MEMBER(_1943_state::c1943_get_bg2_tile_info)
165165{
166   UINT8 *tilerom = machine().root_device().memregion("gfx5")->base() + 0x8000;
166   UINT8 *tilerom = memregion("gfx5")->base() + 0x8000;
167167
168168   int offs = tile_index * 2;
169169   int attr = tilerom[offs + 1];
r21033r21034
176176
177177TILE_GET_INFO_MEMBER(_1943_state::c1943_get_bg_tile_info)
178178{
179   UINT8 *tilerom = machine().root_device().memregion("gfx5")->base();
179   UINT8 *tilerom = memregion("gfx5")->base();
180180
181181   int offs = tile_index * 2;
182182   int attr = tilerom[offs + 1];
trunk/src/mame/video/suprloco.c
r21033r21034
3030***************************************************************************/
3131void suprloco_state::palette_init()
3232{
33   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
33   const UINT8 *color_prom = memregion("proms")->base();
3434   int i;
3535
3636
r21033r21034
200200      dy = -1;
201201   }
202202
203   gfx2 = machine().root_device().memregion("gfx2")->base();
203   gfx2 = memregion("gfx2")->base();
204204   for (row = 0;row < height;row++,adjy+=dy)
205205   {
206206      int color1,color2,flipx;
trunk/src/mame/video/jack.c
r21033r21034
146146
147147PALETTE_INIT_MEMBER(jack_state,joinem)
148148{
149   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
149   const UINT8 *color_prom = memregion("proms")->base();
150150   int i;
151151
152152   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/m57.c
r21033r21034
3232
3333void m57_state::palette_init()
3434{
35   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
35   const UINT8 *color_prom = memregion("proms")->base();
3636   int i;
3737
3838   machine().colortable = colortable_alloc(machine(), 32 * 8 + 16);
trunk/src/mame/video/cop01.c
r21033r21034
1212
1313void cop01_state::palette_init()
1414{
15   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
15   const UINT8 *color_prom = memregion("proms")->base();
1616   int i;
1717
1818   /* allocate the colortable */
trunk/src/mame/video/fuukifg2.c
r21033r21034
8080#if 0
8181PALETTE_INIT_MEMBER(fuuki16_state,fuuki16)
8282{
83   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
83   const UINT8 *color_prom = memregion("proms")->base();
8484   int pen;
8585
8686   /* The game does not initialise the palette at startup. It should
trunk/src/mame/video/metro.c
r21033r21034
263263
264264void metro_state::expand_gfx1()
265265{
266   UINT8 *base_gfx =   machine().root_device().memregion("gfx1")->base();
267   UINT32 length   =   machine().root_device().memregion("gfx1")->bytes() * 2;
266   UINT8 *base_gfx =   memregion("gfx1")->base();
267   UINT32 length   =   memregion("gfx1")->bytes() * 2;
268268
269269   m_expanded_gfx1 = auto_alloc_array(machine(), UINT8, length);
270270
trunk/src/mame/video/mikie.c
r21033r21034
2828
2929void mikie_state::palette_init()
3030{
31   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
31   const UINT8 *color_prom = memregion("proms")->base();
3232   static const int resistances[4] = { 2200, 1000, 470, 220 };
3333   double rweights[4], gweights[4], bweights[4];
3434   int i;
trunk/src/mame/video/drmicro.c
r21033r21034
5858
5959void drmicro_state::palette_init()
6060{
61   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
61   const UINT8 *color_prom = memregion("proms")->base();
6262   int i;
6363
6464   /* allocate the colortable */
trunk/src/mame/video/carpolo.c
r21033r21034
6666
6767void carpolo_state::palette_init()
6868{
69   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
69   const UINT8 *color_prom = memregion("proms")->base();
7070   int i;
7171
7272   /* thanks to Jarek Burczynski for analyzing the circuit */
r21033r21034
188188
189189void carpolo_state::remap_sprite_code(int bank, int code, int *remapped_code, int *flipy)
190190{
191   UINT8* PROM = machine().root_device().memregion("user1")->base();
191   UINT8* PROM = memregion("user1")->base();
192192
193193   code = (bank << 4) | code;
194194   *remapped_code = PROM[code] & 0x0f;
trunk/src/mame/video/cosmic.c
r21033r21034
7777
7878PALETTE_INIT_MEMBER(cosmic_state,panic)
7979{
80   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
80   const UINT8 *color_prom = memregion("proms")->base();
8181   int i;
8282
8383   /* allocate the colortable */
r21033r21034
119119
120120PALETTE_INIT_MEMBER(cosmic_state,cosmica)
121121{
122   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
122   const UINT8 *color_prom = memregion("proms")->base();
123123   int i;
124124
125125   /* allocate the colortable */
r21033r21034
179179
180180PALETTE_INIT_MEMBER(cosmic_state,magspot)
181181{
182   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
182   const UINT8 *color_prom = memregion("proms")->base();
183183   int i;
184184
185185   /* allocate the colortable */
r21033r21034
213213
214214PALETTE_INIT_MEMBER(cosmic_state,nomnlnd)
215215{
216   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
216   const UINT8 *color_prom = memregion("proms")->base();
217217   int i;
218218
219219   /* allocate the colortable */
trunk/src/mame/video/champbas.c
r21033r21034
2222
2323PALETTE_INIT_MEMBER(champbas_state,champbas)
2424{
25   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
25   const UINT8 *color_prom = 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];
r21033r21034
7575
7676PALETTE_INIT_MEMBER(champbas_state,exctsccr)
7777{
78   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
78   const UINT8 *color_prom = memregion("proms")->base();
7979   int i;
8080
8181   /* allocate the colortable */
trunk/src/mame/video/baraduke.c
r21033r21034
1717
1818void baraduke_state::palette_init()
1919{
20   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
20   const UINT8 *color_prom = memregion("proms")->base();
2121   int i;
2222   int bit0,bit1,bit2,bit3,r,g,b;
2323
trunk/src/mame/video/namcofl.c
r21033r21034
118118
119119VIDEO_START_MEMBER(namcofl_state,namcofl)
120120{
121   namco_tilemap_init(NAMCOFL_TILEGFX, machine().root_device().memregion(NAMCOFL_TILEMASKREGION)->base(), TilemapCB );
121   namco_tilemap_init(NAMCOFL_TILEGFX, memregion(NAMCOFL_TILEMASKREGION)->base(), TilemapCB );
122122   c355_obj_init(NAMCOFL_SPRITEGFX,0x0,namcos2_shared_state::c355_obj_code2tile_delegate(FUNC(FLobjcode2tile), &machine()));
123123   c169_roz_init(NAMCOFL_ROTGFX,NAMCOFL_ROTMASKREGION);
124124}
trunk/src/mame/video/matmania.c
r21033r21034
4343***************************************************************************/
4444void matmania_state::palette_init()
4545{
46   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
46   const UINT8 *color_prom = memregion("proms")->base();
4747   int i;
4848
4949   for (i = 0; i < 64; i++)
trunk/src/mame/video/megasys1.c
r21033r21034
744744
745745PALETTE_INIT_MEMBER(megasys1_state,megasys1)
746746{
747   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
747   const UINT8 *color_prom = memregion("proms")->base();
748748   int pri_code, offset, i, order;
749749
750750   /* First check if we have an hand-crafted priority scheme
trunk/src/mame/video/archimds.c
r21033r21034
3939      int count;
4040      int x,y,xi;
4141      UINT8 pen;
42      static UINT8 *vram = machine().root_device().memregion("vram")->base();
42      static UINT8 *vram = memregion("vram")->base();
4343
4444      count = (0);
4545
trunk/src/mame/video/wiping.c
r21033r21034
1919
2020void wiping_state::palette_init()
2121{
22   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
22   const UINT8 *color_prom = 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];
trunk/src/mame/video/leland.c
r21033r21034
384384{
385385   int y;
386386
387   const UINT8 *bg_prom = machine().root_device().memregion("user1")->base();
388   const UINT8 *bg_gfx = machine().root_device().memregion("gfx1")->base();
387   const UINT8 *bg_prom = memregion("user1")->base();
388   const UINT8 *bg_gfx = memregion("gfx1")->base();
389389   offs_t bg_gfx_bank_page_size = memregion("gfx1")->bytes() / 3;
390390   offs_t char_bank = (((m_gfxbank >> 4) & 0x03) * 0x2000) & (bg_gfx_bank_page_size - 1);
391391   offs_t prom_bank = ((m_gfxbank >> 3) & 0x01) * 0x2000;
r21033r21034
452452{
453453   int y;
454454
455   const UINT8 *bg_gfx = machine().root_device().memregion("gfx1")->base();
455   const UINT8 *bg_gfx = memregion("gfx1")->base();
456456   offs_t bg_gfx_bank_page_size = memregion("gfx1")->bytes() / 6;
457457   offs_t bg_gfx_offs_mask = bg_gfx_bank_page_size - 1;
458458
trunk/src/mame/video/clshroad.c
r21033r21034
4242
4343PALETTE_INIT_MEMBER(clshroad_state,clshroad)
4444{
45   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
45   const UINT8 *color_prom = 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]),
r21033r21034
5252
5353PALETTE_INIT_MEMBER(clshroad_state,firebatl)
5454{
55   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
55   const UINT8 *color_prom = memregion("proms")->base();
5656   int i;
5757
5858   /* allocate the colortable */
trunk/src/mame/video/popeye.c
r21033r21034
114114
115115void popeye_state::palette_init()
116116{
117   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
117   const UINT8 *color_prom = memregion("proms")->base();
118118   m_invertmask = 0xff;
119119
120120   convert_color_prom(color_prom);
r21033r21034
122122
123123PALETTE_INIT_MEMBER(popeye_state,popeyebl)
124124{
125   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
125   const UINT8 *color_prom = memregion("proms")->base();
126126   m_invertmask = 0x00;
127127
128128   convert_color_prom(color_prom);
trunk/src/mame/video/m92.c
r21033r21034
536536   draw_sprites(bitmap, cliprect);
537537
538538   /* Flipscreen appears hardwired to the dipswitch - strange */
539   if (machine().root_device().ioport("DSW")->read() & 0x100)
539   if (ioport("DSW")->read() & 0x100)
540540      flip_screen_set(0);
541541   else
542542      flip_screen_set(1);
r21033r21034
553553   ppan_draw_sprites(bitmap, cliprect);
554554
555555   /* Flipscreen appears hardwired to the dipswitch - strange */
556   if (machine().root_device().ioport("DSW")->read() & 0x100)
556   if (ioport("DSW")->read() & 0x100)
557557      flip_screen_set(0);
558558   else
559559      flip_screen_set(1);
trunk/src/mame/video/m58.c
r21033r21034
2121
2222void m58_state::palette_init()
2323{
24   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
24   const UINT8 *color_prom = 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;
trunk/src/mame/video/n8080.c
r21033r21034
239239
240240UINT32 n8080_state::screen_update_helifire(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
241241{
242   int SUN_BRIGHTNESS = machine().root_device().ioport("POT0")->read();
243   int SEA_BRIGHTNESS = machine().root_device().ioport("POT1")->read();
242   int SUN_BRIGHTNESS = ioport("POT0")->read();
243   int SEA_BRIGHTNESS = ioport("POT1")->read();
244244
245245   static const int wave[8] = { 0, 1, 2, 2, 2, 1, 0, 0 };
246246
trunk/src/mame/video/espial.c
r21033r21034
3131
3232void espial_state::palette_init()
3333{
34   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
34   const UINT8 *color_prom = memregion("proms")->base();
3535   int i;
3636
3737   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/video/grchamp.c
r21033r21034
1414
1515void grchamp_state::palette_init()
1616{
17   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
17   const UINT8 *color_prom = memregion("proms")->base();
1818   static const int resistances[3] = { 100, 270, 470 };
1919   double rweights[3], gweights[3], bweights[2];
2020   int i;
r21033r21034
238238
239239
240240*/
241   const UINT8 *prom = machine().root_device().memregion("proms")->base() + 0x20;
241   const UINT8 *prom = memregion("proms")->base() + 0x20;
242242   gfx_element *gfx;
243243   int change = (m_cpu0_out[0] & 0x20) << 3;
244244   int num;
r21033r21034
356356      MAKE_RGB(RGB_MAX,RGB_MAX,RGB_MAX)
357357   };
358358
359   const UINT8 *amedata = machine().root_device().memregion("gfx5")->base();
360   const UINT8 *headdata = machine().root_device().memregion("gfx6")->base();
359   const UINT8 *amedata = memregion("gfx5")->base();
360   const UINT8 *headdata = memregion("gfx6")->base();
361361   const UINT8 *pldata = memregion("gfx7")->base();
362362   bitmap_ind16 &lpixmap = m_left_tilemap->pixmap();
363363   bitmap_ind16 &rpixmap = m_right_tilemap->pixmap();
trunk/src/mame/drivers/carrera.c
r21033r21034
284284
285285void carrera_state::palette_init()
286286{
287   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
287   const UINT8 *color_prom = memregion("proms")->base();
288288   int br_bit0, br_bit1, bit0, bit1, r, g, b;
289289   int i;
290290
trunk/src/mame/drivers/madmotor.c
r21033r21034
332332
333333DRIVER_INIT_MEMBER(madmotor_state,madmotor)
334334{
335   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
335   UINT8 *rom = memregion("maincpu")->base();
336336   int i;
337337
338338   for (i = 0x00000;i < 0x80000;i++)
trunk/src/mame/drivers/dcon.c
r21033r21034
376376/***************************************************************************/
377377DRIVER_INIT_MEMBER(dcon_state,sdgndmps)
378378{
379   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
379   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
380380   RAM[0x1356/2] = 0x4e71; /* beq -> nop */
381381   RAM[0x1358/2] = 0x4e71;
382382
trunk/src/mame/drivers/cshooter.c
r21033r21034
243243
244244WRITE8_MEMBER(cshooter_state::bank_w)
245245{
246   membank("bank1")->set_base(&machine().root_device().memregion("user1")->base()[0x4000*((data>>4)&3)]);
246   membank("bank1")->set_base(&memregion("user1")->base()[0x4000*((data>>4)&3)]);
247247}
248248
249249
r21033r21034
667667DRIVER_INIT_MEMBER(cshooter_state,cshooter)
668668{
669669   /* temp so it boots */
670   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
670   UINT8 *rom = memregion("maincpu")->base();
671671
672672   rom[0xa2] = 0x00;
673673   rom[0xa3] = 0x00;
674674   rom[0xa4] = 0x00;
675   machine().root_device().membank("bank1")->set_base(&machine().root_device().memregion("user1")->base()[0]);
675   membank("bank1")->set_base(&memregion("user1")->base()[0]);
676676}
677677
678678DRIVER_INIT_MEMBER(cshooter_state,cshootere)
679679{
680680   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
681681   int A;
682   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
682   UINT8 *rom = memregion("maincpu")->base();
683683   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
684684
685685   space.set_decrypted_region(0x0000, 0x7fff, decrypt);
r21033r21034
709709         rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0);
710710   }
711711
712   machine().root_device().membank("bank1")->set_base(&machine().root_device().memregion("user1")->base()[0]);
712   membank("bank1")->set_base(&memregion("user1")->base()[0]);
713713   seibu_sound_decrypt(machine(),"audiocpu",0x2000);
714714}
715715
trunk/src/mame/drivers/d9final.c
r21033r21034
274274
275275void d9final_state::machine_reset()
276276{
277   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
277   UINT8 *ROM = memregion("maincpu")->base();
278278
279   machine().root_device().membank("bank1")->set_base(&ROM[0x10000]);
279   membank("bank1")->set_base(&ROM[0x10000]);
280280}
281281
282282static MACHINE_CONFIG_START( d9final, d9final_state )
trunk/src/mame/drivers/metro.c
r21033r21034
63396339
63406340DRIVER_INIT_MEMBER(metro_state,dharmak)
63416341{
6342   UINT8 *src = machine().root_device().memregion( "gfx1" )->base();
6342   UINT8 *src = memregion( "gfx1" )->base();
63436343   int i;
63446344
63456345   for (i = 0; i < 0x200000; i += 4)
trunk/src/mame/drivers/ladybug.c
r21033r21034
10661066   offs_t i;
10671067   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
10681068   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
1069   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1070   UINT8 *table = machine().root_device().memregion("user1")->base();
1069   UINT8 *rom = memregion("maincpu")->base();
1070   UINT8 *table = memregion("user1")->base();
10711071
10721072   space.set_decrypted_region(0x0000, 0x5fff, decrypted);
10731073
trunk/src/mame/drivers/ttchamp.c
r21033r21034
373373
374374DRIVER_INIT_MEMBER(ttchamp_state,ttchamp)
375375{
376   UINT8 *ROM1 = machine().root_device().memregion("user1")->base();
377   machine().root_device().membank("bank1")->set_base(&ROM1[0x100000]);
378   machine().root_device().membank("bank2")->set_base(&ROM1[0x180000]);
376   UINT8 *ROM1 = memregion("user1")->base();
377   membank("bank1")->set_base(&ROM1[0x100000]);
378   membank("bank2")->set_base(&ROM1[0x180000]);
379379}
380380
381381GAME( 199?, ttchamp, 0,        ttchamp, ttchamp, ttchamp_state, ttchamp, ROT0,  "Gamart?", "Table Tennis Champions (set 1)", GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/mame/drivers/maygay1b.c
r21033r21034
900900   //AM_RANGE(0x2420, 0x2421) AM_WRITE(latch_ch2_w ) // oki
901901   // if there is no OKI region disable writes here, the rom might be missing, so alert user
902902
903   UINT8 *okirom = machine().root_device().memregion( "msm6376" )->base();
903   UINT8 *okirom = memregion( "msm6376" )->base();
904904
905905   if (!okirom) {
906906      machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2420, 0x2421, write8_delegate(FUNC(maygay1b_state::m1ab_no_oki_w), this));
r21033r21034
908908   // print out the rom id / header info to give us some hints
909909   // note this isn't always correct, alley cat has 'Calpsyo' still in the ident string?
910910   {
911      UINT8 *cpu = machine().root_device().memregion( "maincpu" )->base();
911      UINT8 *cpu = memregion( "maincpu" )->base();
912912      int base = 0xff20;
913913      for (int i=0;i<14;i++)
914914      {
trunk/src/mame/drivers/whitestar.c
r21033r21034
102102
103103WRITE8_MEMBER(whitestar_state::bank_w)
104104{
105   membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + (data & 0x1f) * 0x4000);
105   membank("bank1")->set_base(memregion("user1")->base() + (data & 0x1f) * 0x4000);
106106}
107107
108108WRITE8_MEMBER(whitestar_state::dmd_bank_w)
109109{
110   membank("dmd_bank1")->set_base(machine().root_device().memregion("dmdcpu")->base() + (data & 0x1f) * 0x4000);
110   membank("dmd_bank1")->set_base(memregion("dmdcpu")->base() + (data & 0x1f) * 0x4000);
111111}
112112
113113READ8_MEMBER(whitestar_state::dmd_latch_r)
r21033r21034
174174
175175void whitestar_state::machine_reset()
176176{
177   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("user1")->base());
178   machine().root_device().membank("dmd_bank1")->set_base(machine().root_device().memregion("dmdcpu")->base());
177   membank("bank1")->set_base(memregion("user1")->base());
178   membank("dmd_bank1")->set_base(memregion("dmdcpu")->base());
179179}
180180
181181DRIVER_INIT_MEMBER(whitestar_state,whitestar)
trunk/src/mame/drivers/asterix.c
r21033r21034
451451DRIVER_INIT_MEMBER(asterix_state,asterix)
452452{
453453#if 0
454   *(UINT16 *)(machine().root_device().memregion("maincpu")->base() + 0x07f34) = 0x602a;
455   *(UINT16 *)(machine().root_device().memregion("maincpu")->base() + 0x00008) = 0x0400;
454   *(UINT16 *)(memregion("maincpu")->base() + 0x07f34) = 0x602a;
455   *(UINT16 *)(memregion("maincpu")->base() + 0x00008) = 0x0400;
456456#endif
457457}
458458
trunk/src/mame/drivers/simpl156.c
r21033r21034
10201020
10211021DRIVER_INIT_MEMBER(simpl156_state,simpl156)
10221022{
1023   UINT8 *rom = machine().root_device().memregion("okimusic")->base();
1024   int length = machine().root_device().memregion("okimusic")->bytes();
1023   UINT8 *rom = memregion("okimusic")->base();
1024   int length = memregion("okimusic")->bytes();
10251025   UINT8 *buf1 = auto_alloc_array(machine(), UINT8, length);
10261026
10271027   UINT32 x;
trunk/src/mame/drivers/battlnts.c
r21033r21034
413413DRIVER_INIT_MEMBER(battlnts_state,rackemup)
414414{
415415   /* rearrange char ROM */
416   shuffle(machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion("gfx1")->bytes());
416   shuffle(memregion("gfx1")->base(), memregion("gfx1")->bytes());
417417}
418418
419419
trunk/src/mame/drivers/multfish.c
r21033r21034
491491*/
492492
493493   UINT32 i,j,jscr,romoffset;
494   UINT8 *multfish_gfx = machine().root_device().memregion("gfx")->base();
494   UINT8 *multfish_gfx = memregion("gfx")->base();
495495   UINT8 *temprom = auto_alloc_array(machine(), UINT8, multfish_ROM_SIZE);
496496
497497
trunk/src/mame/drivers/taito_l.c
r21033r21034
168168   }
169169
170170   m_cur_rombank = m_cur_rombank2 = 0;
171   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
171   membank("bank1")->set_base(memregion("maincpu")->base());
172172
173173   machine().gfx[2]->set_source(m_rambanks);
174174
r21033r21034
359359
360360      //logerror("robs %d, %02x (%04x)\n", offset, data, space.device().safe_pc());
361361      m_cur_rombank = data;
362      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x2000 * m_cur_rombank);
362      membank("bank1")->set_base(memregion("maincpu")->base() + 0x2000 * m_cur_rombank);
363363   }
364364}
365365
r21033r21034
378378      //logerror("robs2 %02x (%04x)\n", data, space.device().safe_pc());
379379
380380      m_cur_rombank2 = data;
381      membank("bank6")->set_base(machine().root_device().memregion("slave")->base() + 0x4000 * m_cur_rombank2);
381      membank("bank6")->set_base(memregion("slave")->base() + 0x4000 * m_cur_rombank2);
382382   }
383383}
384384
r21033r21034
26512651            v |= 1 << (7 - j);
26522652      tab[i] = v;
26532653   }
2654   p = machine().root_device().memregion("maincpu")->base();
2654   p = memregion("maincpu")->base();
26552655   for (i = 0; i < 0x10000; i++)
26562656   {
26572657      *p = tab[*p];
trunk/src/mame/drivers/galpani2.c
r21033r21034
267267
268268WRITE8_MEMBER(galpani2_state::galpani2_oki1_bank_w)
269269{
270   UINT8 *ROM = machine().root_device().memregion("oki1")->base();
270   UINT8 *ROM = memregion("oki1")->base();
271271   logerror("%s : %s bank %08X\n",machine().describe_context(),tag(),data);
272272   memcpy(ROM + 0x30000, ROM + 0x40000 + 0x10000 * (~data & 0xf), 0x10000);
273273}
trunk/src/mame/drivers/midqslvr.c
r21033r21034
669669
670670void midqslvr_state::machine_reset()
671671{
672   machine().root_device().membank("bios_bank")->set_base(machine().root_device().memregion("bios")->base() + 0x70000);
673   machine().root_device().membank("bios_ext1")->set_base(machine().root_device().memregion("bios")->base() + 0x60000);
674   machine().root_device().membank("bios_ext2")->set_base(machine().root_device().memregion("bios")->base() + 0x64000);
675   machine().root_device().membank("bios_ext3")->set_base(machine().root_device().memregion("bios")->base() + 0x68000);
676   machine().root_device().membank("bios_ext4")->set_base(machine().root_device().memregion("bios")->base() + 0x6c000);
677   machine().root_device().membank("video_bank1")->set_base(machine().root_device().memregion("video_bios")->base() + 0);
678   machine().root_device().membank("video_bank2")->set_base(machine().root_device().memregion("video_bios")->base() + 0x4000);
672   membank("bios_bank")->set_base(memregion("bios")->base() + 0x70000);
673   membank("bios_ext1")->set_base(memregion("bios")->base() + 0x60000);
674   membank("bios_ext2")->set_base(memregion("bios")->base() + 0x64000);
675   membank("bios_ext3")->set_base(memregion("bios")->base() + 0x68000);
676   membank("bios_ext4")->set_base(memregion("bios")->base() + 0x6c000);
677   membank("video_bank1")->set_base(memregion("video_bios")->base() + 0);
678   membank("video_bank2")->set_base(memregion("video_bios")->base() + 0x4000);
679679}
680680
681681static MACHINE_CONFIG_START( midqslvr, midqslvr_state )
trunk/src/mame/drivers/sf.c
r21033r21034
172172
173173WRITE8_MEMBER(sf_state::sound2_bank_w)
174174{
175   membank("bank1")->set_base(machine().root_device().memregion("audio2")->base() + 0x8000 * (data + 1));
175   membank("bank1")->set_base(memregion("audio2")->base() + 0x8000 * (data + 1));
176176}
177177
178178
trunk/src/mame/drivers/dragrace.c
r21033r21034
1919
2020   for (i = 0; i < 2; i++)
2121   {
22      switch (machine().root_device().ioport(portnames[i])->read())
22      switch (ioport(portnames[i])->read())
2323      {
2424      case 0x01: m_gear[i] = 1; break;
2525      case 0x02: m_gear[i] = 2; break;
r21033r21034
3030   }
3131
3232   /* watchdog is disabled during service mode */
33   machine().watchdog_enable(machine().root_device().ioport("IN0")->read() & 0x20);
33   machine().watchdog_enable(ioport("IN0")->read() & 0x20);
3434}
3535
3636
trunk/src/mame/drivers/fcombat.c
r21033r21034
329329
330330   /* make a temporary copy of the character data */
331331   src = temp;
332   dst = machine().root_device().memregion("gfx1")->base();
333   length = machine().root_device().memregion("gfx1")->bytes();
332   dst = memregion("gfx1")->base();
333   length = memregion("gfx1")->bytes();
334334   memcpy(src, dst, length);
335335
336336   /* decode the characters */
r21033r21034
347347
348348   /* make a temporary copy of the sprite data */
349349   src = temp;
350   dst = machine().root_device().memregion("gfx2")->base();
351   length = machine().root_device().memregion("gfx2")->bytes();
350   dst = memregion("gfx2")->base();
351   length = memregion("gfx2")->bytes();
352352   memcpy(src, dst, length);
353353
354354   /* decode the sprites */
r21033r21034
368368
369369   /* make a temporary copy of the character data */
370370   src = temp;
371   dst = machine().root_device().memregion("gfx3")->base();
372   length = machine().root_device().memregion("gfx3")->bytes();
371   dst = memregion("gfx3")->base();
372   length = memregion("gfx3")->bytes();
373373   memcpy(src, dst, length);
374374
375375   /* decode the characters */
r21033r21034
387387   }
388388
389389   src = temp;
390   dst = machine().root_device().memregion("user1")->base();
391   length = machine().root_device().memregion("user1")->bytes();
390   dst = memregion("user1")->base();
391   length = memregion("user1")->bytes();
392392   memcpy(src, dst, length);
393393
394394   for (oldaddr = 0; oldaddr < 32; oldaddr++)
r21033r21034
399399
400400
401401   src = temp;
402   dst = machine().root_device().memregion("user2")->base();
403   length = machine().root_device().memregion("user2")->bytes();
402   dst = memregion("user2")->base();
403   length = memregion("user2")->bytes();
404404   memcpy(src, dst, length);
405405
406406   for (oldaddr = 0; oldaddr < 32; oldaddr++)
trunk/src/mame/drivers/jclub2.c
r21033r21034
995995   // the eeprom contains the game ID, which must be valid for it to boot
996996   // is there a way (key sequence) to reprogram it??
997997   // I bet the original sets need similar get further in their boot sequence
998   UINT8  *eeprom = (UINT8 *)  machine().root_device().memregion("eeprom")->base();
998   UINT8  *eeprom = (UINT8 *)  memregion("eeprom")->base();
999999   if (eeprom != NULL)
10001000   {
1001      size_t len = machine().root_device().memregion("eeprom")->bytes();
1001      size_t len = memregion("eeprom")->bytes();
10021002      UINT8* temp = (UINT8*)auto_alloc_array(machine(), UINT8, len);
10031003      int i;
10041004      for (i = 0; i < len; i++)
trunk/src/mame/drivers/seibuspi.c
r21033r21034
992992
993993READ32_MEMBER(seibuspi_state::soundrom_r)
994994{
995   UINT8 *sound = (UINT8*)machine().root_device().memregion("user2")->base();
996   UINT16 *sound16 = (UINT16*)machine().root_device().memregion("user2")->base();
995   UINT8 *sound = (UINT8*)memregion("user2")->base();
996   UINT16 *sound16 = (UINT16*)memregion("user2")->base();
997997
998998   if (mem_mask == 0x000000ff)
999999   {
r21033r21034
22172217DRIVER_INIT_MEMBER(seibuspi_state,sys386f2)
22182218{
22192219   int i, j;
2220   UINT16 *src = (UINT16 *)machine().root_device().memregion("gfx3")->base();
2220   UINT16 *src = (UINT16 *)memregion("gfx3")->base();
22212221   UINT16 tmp[0x40 / 2], Offset;
22222222
22232223   // sprite_reorder() only
2224   for(i = 0; i < machine().root_device().memregion("gfx3")->bytes() / 0x40; i++)
2224   for(i = 0; i < memregion("gfx3")->bytes() / 0x40; i++)
22252225   {
22262226      memcpy(tmp, src, 0x40);
22272227
trunk/src/mame/drivers/wc90b.c
r21033r21034
124124{
125125   device_t *device = machine().device("msm");
126126   int bankaddress;
127   UINT8 *ROM = machine().root_device().memregion("audiocpu")->base();
127   UINT8 *ROM = memregion("audiocpu")->base();
128128
129129   /* the code writes either 2 or 3 in the bottom two bits */
130130   bankaddress = 0x10000 + (data & 0x01) * 0x4000;
131   machine().root_device().membank("bank3")->set_base(&ROM[bankaddress]);
131   membank("bank3")->set_base(&ROM[bankaddress]);
132132
133133   msm5205_reset_w(device,data & 0x08);
134134}
trunk/src/mame/drivers/coolpool.c
r21033r21034
519519{
520520   UINT8 *rom = memregion("user2")->base();
521521
522   return rom[m_iop_romaddr & (machine().root_device().memregion("user2")->bytes() - 1)];
522   return rom[m_iop_romaddr & (memregion("user2")->bytes() - 1)];
523523}
524524
525525
r21033r21034
11771177   UINT16 *rom;
11781178
11791179   /* decrypt the main program ROMs */
1180   rom = (UINT16 *)machine().root_device().memregion("user1")->base();
1181   len = machine().root_device().memregion("user1")->bytes();
1180   rom = (UINT16 *)memregion("user1")->base();
1181   len = memregion("user1")->bytes();
11821182   for (a = 0;a < len/2;a++)
11831183   {
11841184      int hi,lo,nhi,nlo;
r21033r21034
12011201   }
12021202
12031203   /* decrypt the sub data ROMs */
1204   rom = (UINT16 *)machine().root_device().memregion("user2")->base();
1205   len = machine().root_device().memregion("user2")->bytes();
1204   rom = (UINT16 *)memregion("user2")->base();
1205   len = memregion("user2")->bytes();
12061206   for (a = 1;a < len/2;a+=4)
12071207   {
12081208      /* just swap bits 1 and 2 of the address */
trunk/src/mame/drivers/albazc.c
r21033r21034
4444
4545void albazc_state::palette_init()
4646{
47   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
47   const UINT8 *color_prom = memregion("proms")->base();
4848   int i;
4949   int r, g, b;
5050
trunk/src/mame/drivers/naomi.c
r21033r21034
75197519
75207520DRIVER_INIT_MEMBER(dc_state,atomiswave)
75217521{
7522   UINT64 *ROM = (UINT64 *)machine().root_device().memregion("awflash")->base();
7522   UINT64 *ROM = (UINT64 *)memregion("awflash")->base();
75237523
75247524   // patch out long startup delay
75257525   ROM[0x98e/8] = (ROM[0x98e/8] & U64(0xffffffffffff)) | (UINT64)0x0009<<48;
trunk/src/mame/drivers/niyanpai.c
r21033r21034
5050
5151void niyanpai_state::niyanpai_soundbank_w(int data)
5252{
53   UINT8 *SNDROM = machine().root_device().memregion("audiocpu")->base();
53   UINT8 *SNDROM = memregion("audiocpu")->base();
5454
55   machine().root_device().membank("bank1")->set_base(&SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
55   membank("bank1")->set_base(&SNDROM[0x08000 + (0x8000 * (data & 0x03))]);
5656}
5757
5858READ8_MEMBER(niyanpai_state::niyanpai_sound_r)
trunk/src/mame/drivers/queen.c
r21033r21034
528528
529529void queen_state::machine_reset()
530530{
531   machine().root_device().membank("bios_bank")->set_base(machine().root_device().memregion("bios")->base() + 0x30000);
532   machine().root_device().membank("bios_ext")->set_base(machine().root_device().memregion("bios")->base() + 0x20000);
531   membank("bios_bank")->set_base(memregion("bios")->base() + 0x30000);
532   membank("bios_ext")->set_base(memregion("bios")->base() + 0x20000);
533533}
534534
535535
trunk/src/mame/drivers/cyclemb.c
r21033r21034
127127
128128void cyclemb_state::palette_init()
129129{
130   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
130   const UINT8 *color_prom = memregion("proms")->base();
131131   int i,r,g,b,val;
132132   int bit0,bit1,bit2;
133133
r21033r21034
10201020
10211021DRIVER_INIT_MEMBER(cyclemb_state,cyclemb)
10221022{
1023   machine().root_device().membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x1000);
1023   membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x1000);
10241024   m_dsw_pc_hack = 0x760;
10251025}
10261026
10271027DRIVER_INIT_MEMBER(cyclemb_state,skydest)
10281028{
1029   machine().root_device().membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x1000);
1029   membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x1000);
10301030   m_dsw_pc_hack = 0x554;
10311031}
10321032
trunk/src/mame/drivers/luckgrln.c
r21033r21034
10271027{
10281028   int i;
10291029   UINT8 x,v;
1030   UINT8* rom = machine().root_device().memregion("rom_data")->base();
1030   UINT8* rom = memregion("rom_data")->base();
10311031
10321032   for (i=0;i<0x20000;i++)
10331033   {
r21033r21034
10541054   #endif
10551055
10561056   // ??
1057//  machine().root_device().membank("bank1")->set_base(&rom[0x010000]);
1057//  membank("bank1")->set_base(&rom[0x010000]);
10581058}
10591059
10601060
trunk/src/mame/drivers/sigmab98.c
r21033r21034
19111911
19121912DRIVER_INIT_MEMBER(sigmab98_state,gegege)
19131913{
1914   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1914   UINT8 *rom = memregion("maincpu")->base();
19151915
19161916   // Protection?
19171917   rom[0x0bdd] = 0xc9;
r21033r21034
19291929   rom[0x8165] = 0x00;
19301930
19311931   // ROM banks
1932   machine().root_device().membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
1933   machine().root_device().membank("rombank")->set_entry(0);
1932   membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
1933   membank("rombank")->set_entry(0);
19341934
19351935   // RAM banks
19361936   UINT8 *bankedram = auto_alloc_array(machine(), UINT8, 0x800 * 2);
19371937
1938   machine().root_device().membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
1939   machine().root_device().membank("rambank")->set_entry(0);
1938   membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
1939   membank("rambank")->set_entry(0);
19401940}
19411941
19421942
r21033r21034
19601960
19611961DRIVER_INIT_MEMBER(sigmab98_state,pepsiman)
19621962{
1963   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1963   UINT8 *rom = memregion("maincpu")->base();
19641964
19651965   // Protection?
19661966   rom[0x058a] = 0xc9;
r21033r21034
19781978   rom[0x8165] = 0x00;
19791979
19801980   // ROM banks
1981   machine().root_device().membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
1982   machine().root_device().membank("rombank")->set_entry(0);
1981   membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
1982   membank("rombank")->set_entry(0);
19831983
19841984   // RAM banks
19851985   UINT8 *bankedram = auto_alloc_array(machine(), UINT8, 0x800 * 2);
19861986
1987   machine().root_device().membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
1988   machine().root_device().membank("rambank")->set_entry(0);
1987   membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
1988   membank("rambank")->set_entry(0);
19891989}
19901990
19911991
r21033r21034
20112011
20122012DRIVER_INIT_MEMBER(sigmab98_state,ucytokyu)
20132013{
2014   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2014   UINT8 *rom = memregion("maincpu")->base();
20152015
20162016   // Protection?
20172017   rom[0x0bfa] = 0xc9;
r21033r21034
20292029   rom[0x8165] = 0x00;
20302030
20312031   // ROM banks
2032   machine().root_device().membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
2033   machine().root_device().membank("rombank")->set_entry(0);
2032   membank("rombank")->configure_entries(0, 0x18, rom + 0x8000, 0x1000);
2033   membank("rombank")->set_entry(0);
20342034
20352035   // RAM banks
20362036   UINT8 *bankedram = auto_alloc_array(machine(), UINT8, 0x800 * 2);
20372037
2038   machine().root_device().membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
2039   machine().root_device().membank("rambank")->set_entry(0);
2038   membank("rambank")->configure_entries(0, 2, bankedram, 0x800);
2039   membank("rambank")->set_entry(0);
20402040}
20412041
20422042
trunk/src/mame/drivers/shootout.c
r21033r21034
413413
414414DRIVER_INIT_MEMBER(shootout_state,shootout)
415415{
416   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
416   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
417417}
418418
419419
trunk/src/mame/drivers/toypop.c
r21033r21034
486486
487487***************************************************************************/
488488
489READ8_MEMBER(toypop_state::dipA_l){ return machine().root_device().ioport("DSW1")->read(); }                // dips A
490READ8_MEMBER(toypop_state::dipA_h){ return machine().root_device().ioport("DSW1")->read() >> 4; }           // dips A
491READ8_MEMBER(toypop_state::dipB_l){ return machine().root_device().ioport("DSW2")->read(); }                // dips B
492READ8_MEMBER(toypop_state::dipB_h){ return machine().root_device().ioport("DSW2")->read() >> 4; }           // dips B
489READ8_MEMBER(toypop_state::dipA_l){ return ioport("DSW1")->read(); }                // dips A
490READ8_MEMBER(toypop_state::dipA_h){ return ioport("DSW1")->read() >> 4; }           // dips A
491READ8_MEMBER(toypop_state::dipB_l){ return ioport("DSW2")->read(); }                // dips B
492READ8_MEMBER(toypop_state::dipB_h){ return ioport("DSW2")->read() >> 4; }           // dips B
493493
494494WRITE8_MEMBER(toypop_state::out_coin0)
495495{
trunk/src/mame/drivers/kchamp.c
r21033r21034
709709{
710710   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
711711   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x10000);
712   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
712   UINT8 *rom = memregion("maincpu")->base();
713713   int A;
714714
715715   space.set_decrypted_region(0x0000, 0xffff, decrypted);
trunk/src/mame/drivers/calchase.c
r21033r21034
886886
887887void calchase_state::machine_reset()
888888{
889   //machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("bios")->base() + 0x10000);
890   machine().root_device().membank("bios_bank")->set_base(machine().root_device().memregion("bios")->base() + 0x10000);
891   machine().root_device().membank("bios_ext")->set_base(machine().root_device().memregion("bios")->base() + 0);
889   //membank("bank1")->set_base(memregion("bios")->base() + 0x10000);
890   membank("bios_bank")->set_base(memregion("bios")->base() + 0x10000);
891   membank("bios_ext")->set_base(memregion("bios")->base() + 0);
892892}
893893
894894static void set_gate_a20(running_machine &machine, int a20)
trunk/src/mame/drivers/ashnojoe.c
r21033r21034
288288
289289WRITE8_MEMBER(ashnojoe_state::ym2203_write_b)
290290{
291   machine().root_device().membank("bank4")->set_entry(data & 0x0f);
291   membank("bank4")->set_entry(data & 0x0f);
292292}
293293
294294static const ym2203_interface ym2203_config =
r21033r21034
456456
457457DRIVER_INIT_MEMBER(ashnojoe_state,ashnojoe)
458458{
459   UINT8 *ROM = machine().root_device().memregion("adpcm")->base();
460   machine().root_device().membank("bank4")->configure_entries(0, 16, &ROM[0x00000], 0x8000);
459   UINT8 *ROM = memregion("adpcm")->base();
460   membank("bank4")->configure_entries(0, 16, &ROM[0x00000], 0x8000);
461461
462   machine().root_device().membank("bank4")->set_entry(0);
462   membank("bank4")->set_entry(0);
463463}
464464
465465GAME( 1990, scessjoe, 0,        ashnojoe, ashnojoe, ashnojoe_state, ashnojoe, ROT0, "Wave / Taito Corporation", "Success Joe (World)",   GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/pcxt.c
r21033r21034
225225   if (newbank != m_bank)
226226   {
227227      m_bank = newbank;
228      membank("bank1")->set_base(machine().root_device().memregion("game_prg")->base() + 0x10000 * m_bank );
228      membank("bank1")->set_base(memregion("game_prg")->base() + 0x10000 * m_bank );
229229   }
230230
231231   m_lastvalue = data;
trunk/src/mame/drivers/undrfire.c
r21033r21034
967967DRIVER_INIT_MEMBER(undrfire_state,undrfire)
968968{
969969   UINT32 offset,i;
970   UINT8 *gfx = machine().root_device().memregion("gfx3")->base();
971   int size=machine().root_device().memregion("gfx3")->bytes();
970   UINT8 *gfx = memregion("gfx3")->base();
971   int size=memregion("gfx3")->bytes();
972972   int data;
973973
974974   /* make piv tile GFX format suitable for gfxdecode */
r21033r21034
996996DRIVER_INIT_MEMBER(undrfire_state,cbombers)
997997{
998998   UINT32 offset,i;
999   UINT8 *gfx = machine().root_device().memregion("gfx3")->base();
1000   int size=machine().root_device().memregion("gfx3")->bytes();
999   UINT8 *gfx = memregion("gfx3")->base();
1000   int size=memregion("gfx3")->bytes();
10011001   int data;
10021002
10031003
trunk/src/mame/drivers/dooyong.c
r21033r21034
9393
9494MACHINE_START_MEMBER(dooyong_state,lastday)
9595{
96   machine().root_device().membank("bank1")->configure_entries(0, 8, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
96   membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000);
9797}
9898
9999WRITE8_MEMBER(dooyong_state::flip_screen_w)
trunk/src/mame/drivers/silvmil.c
r21033r21034
397397
398398void silvmil_state::tumblepb_gfx1_rearrange()
399399{
400   UINT8 *rom = machine().root_device().memregion("gfx1")->base();
401   int len = machine().root_device().memregion("gfx1")->bytes();
400   UINT8 *rom = memregion("gfx1")->base();
401   int len = memregion("gfx1")->bytes();
402402   int i;
403403
404404   /* gfx data is in the wrong order */
trunk/src/mame/drivers/brkthru.c
r21033r21034
644644
645645DRIVER_INIT_MEMBER(brkthru_state,brkthru)
646646{
647   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
648   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x2000);
647   UINT8 *ROM = memregion("maincpu")->base();
648   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x2000);
649649}
650650
651651/*************************************
trunk/src/mame/drivers/quizshow.c
r21033r21034
422422
423423DRIVER_INIT_MEMBER(quizshow_state,quizshow)
424424{
425   UINT8 *gfxdata = machine().root_device().memregion("user1")->base();
426   UINT8 *dest = machine().root_device().memregion("gfx1")->base();
425   UINT8 *gfxdata = memregion("user1")->base();
426   UINT8 *dest = memregion("gfx1")->base();
427427
428428   int tile, line;
429429
trunk/src/mame/drivers/trackfld.c
r21033r21034
14381438DRIVER_INIT_MEMBER(trackfld_state,atlantol)
14391439{
14401440   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
1441   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1441   UINT8 *rom = memregion("maincpu")->base();
14421442   UINT8 *decrypt;
14431443   int A;
14441444
r21033r21034
14671467
14681468DRIVER_INIT_MEMBER(trackfld_state,mastkin)
14691469{
1470   UINT8 *prom = machine().root_device().memregion("proms")->base();
1470   UINT8 *prom = memregion("proms")->base();
14711471   int i;
14721472
14731473   /* build a fake palette so the screen won't be all black */
r21033r21034
14881488
14891489DRIVER_INIT_MEMBER(trackfld_state,wizzquiz)
14901490{
1491   UINT8 *ROM = machine().root_device().memregion("maincpu")->base() + 0xe000;
1491   UINT8 *ROM = memregion("maincpu")->base() + 0xe000;
14921492   int i;
14931493
14941494   /* decrypt program rom */
14951495   for (i = 0; i < 0x2000; i++)
14961496      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
14971497
1498   ROM = machine().root_device().memregion("user1")->base();
1498   ROM = memregion("user1")->base();
14991499
15001500   /* decrypt questions roms */
15011501   for (i = 0; i < 0x40000; i++)
15021502      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
15031503
1504   machine().root_device().membank("bank1")->configure_entries(0, 8, ROM, 0x8000);
1504   membank("bank1")->configure_entries(0, 8, ROM, 0x8000);
15051505}
15061506
15071507
trunk/src/mame/drivers/exerion.c
r21033r21034
549549
550550   /* make a temporary copy of the character data */
551551   src = temp;
552   dst = machine().root_device().memregion("gfx1")->base();
553   length = machine().root_device().memregion("gfx1")->bytes();
552   dst = memregion("gfx1")->base();
553   length = memregion("gfx1")->bytes();
554554   memcpy(src, dst, length);
555555
556556   /* decode the characters */
r21033r21034
567567
568568   /* make a temporary copy of the sprite data */
569569   src = temp;
570   dst = machine().root_device().memregion("gfx2")->base();
571   length = machine().root_device().memregion("gfx2")->bytes();
570   dst = memregion("gfx2")->base();
571   length = memregion("gfx2")->bytes();
572572   memcpy(src, dst, length);
573573
574574   /* decode the sprites */
r21033r21034
590590
591591DRIVER_INIT_MEMBER(exerion_state,exerionb)
592592{
593   UINT8 *ram = machine().root_device().memregion("maincpu")->base();
593   UINT8 *ram = memregion("maincpu")->base();
594594   int addr;
595595
596596   /* the program ROMs have data lines D1 and D2 swapped. Decode them. */
trunk/src/mame/drivers/cmmb.c
r21033r21034
143143
144144/*
145145    {
146        UINT8 *ROM = space.machine().root_device().memregion("maincpu")->base();
146        UINT8 *ROM = space.memregion("maincpu")->base();
147147        UINT32 bankaddress;
148148
149149        bankaddress = 0x10000 + (0x10000 * (data & 0x03));
150        space.machine().root_device().membank("bank1")->set_base(&ROM[bankaddress]);
150        space.membank("bank1")->set_base(&ROM[bankaddress]);
151151    }
152152*/
153153
trunk/src/mame/drivers/roul.c
r21033r21034
9191
9292void roul_state::palette_init()
9393{
94   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
94   const UINT8 *color_prom = memregion("proms")->base();
9595   int bit6, bit7, bit0, bit1, r, g, b;
9696   int i;
9797
trunk/src/mame/drivers/igspoker.c
r21033r21034
19261926DRIVER_INIT_MEMBER(igspoker_state,cpoker)
19271927{
19281928   int A;
1929   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1929   UINT8 *rom = memregion("maincpu")->base();
19301930
19311931
19321932   for (A = 0;A < 0x10000;A++)
r21033r21034
19401940
19411941DRIVER_INIT_MEMBER(igspoker_state,cpokert)
19421942{
1943   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1943   UINT8 *rom = memregion("maincpu")->base();
19441944   int i;
19451945
19461946   /* decrypt the program ROM */
r21033r21034
19701970DRIVER_INIT_MEMBER(igspoker_state,cska)
19711971{
19721972   int A;
1973   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1973   UINT8 *rom = memregion("maincpu")->base();
19741974
19751975
19761976   for (A = 0;A < 0x10000;A++)
r21033r21034
19871987DRIVER_INIT_MEMBER(igspoker_state,igs_ncs)
19881988{
19891989   int A;
1990   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1990   UINT8 *rom = memregion("maincpu")->base();
19911991
19921992
19931993   for (A = 0;A < 0x10000;A++)
r21033r21034
21482148
21492149DRIVER_INIT_MEMBER(igspoker_state,igs_ncs2)
21502150{
2151   UINT8 *src = (UINT8 *) (machine().root_device().memregion("maincpu")->base());
2151   UINT8 *src = (UINT8 *) (memregion("maincpu")->base());
21522152   int i;
21532153
21542154   for(i = 0; i < 0x10000; i++)
r21033r21034
22252225   int length;
22262226   UINT8 *rom;
22272227
2228   rom = machine().root_device().memregion("maincpu")->base();
2229   length = machine().root_device().memregion("maincpu")->bytes();
2228   rom = memregion("maincpu")->base();
2229   length = memregion("maincpu")->bytes();
22302230   for (A = 0;A < length;A++)
22312231   {
22322232      if ((A & 0x09C0) == 0x0880) rom[A] ^= 0x20;
r21033r21034
22892289   UINT8 *tmp;
22902290   UINT8 *rom;
22912291
2292   rom = machine().root_device().memregion("maincpu")->base();
2293   length = machine().root_device().memregion("maincpu")->bytes();
2292   rom = memregion("maincpu")->base();
2293   length = memregion("maincpu")->bytes();
22942294   for (A = 0;A < length;A++)
22952295   {
22962296      if ((A & 0x09C0) == 0x0880) rom[A] ^= 0x20;
r21033r21034
23192319   rom[0xeed] = 0xc3;
23202320
23212321   /* Descramble graphic */
2322   rom = machine().root_device().memregion("gfx1")->base();
2323   length = machine().root_device().memregion("gfx1")->bytes();
2322   rom = memregion("gfx1")->base();
2323   length = memregion("gfx1")->bytes();
23242324   tmp = auto_alloc_array(machine(), UINT8, length);
23252325   memcpy(tmp,rom,length);
23262326   for (A = 0;A < length;A++)
r21033r21034
23682368DRIVER_INIT_MEMBER(igspoker_state,cpokerpk)
23692369{
23702370   int A;
2371   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2371   UINT8 *rom = memregion("maincpu")->base();
23722372
23732373   for (A=0x0714; A < 0xF000; A+=0x1000)
23742374      rom[A] ^= 0x20;
r21033r21034
24222422DRIVER_INIT_MEMBER(igspoker_state,pktet346)
24232423{
24242424   int A;
2425   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2425   UINT8 *rom = memregion("maincpu")->base();
24262426
24272427
24282428   for (A = 0;A < 0x10000;A++)
trunk/src/mame/drivers/videopkr.c
r21033r21034
412412
413413void videopkr_state::palette_init()
414414{
415   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
415   const UINT8 *color_prom = memregion("proms")->base();
416416   int j;
417417
418418   for (j = 0; j < machine().total_colors(); j++)
r21033r21034
439439
440440PALETTE_INIT_MEMBER(videopkr_state,babypkr)
441441{
442   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
442   const UINT8 *color_prom = memregion("proms")->base();
443443   int j;
444444
445445   for (j = 0; j < machine().total_colors(); j++)
r21033r21034
470470
471471PALETTE_INIT_MEMBER(videopkr_state,fortune1)
472472{
473   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
473   const UINT8 *color_prom = memregion("proms")->base();
474474   int j;
475475
476476   for (j = 0; j < machine().total_colors(); j++)
trunk/src/mame/drivers/mazerbla.c
r21033r21034
369369{
370370   m_gfx_rom_bank = data;
371371
372   membank("bank1")->set_base(machine().root_device().memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
372   membank("bank1")->set_base(memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
373373}
374374
375375WRITE8_MEMBER(mazerbla_state::cfb_rom_bank_sel_w_gg)/* great guns */
376376{
377377   m_gfx_rom_bank = data >> 1;
378378
379   membank("bank1")->set_base(machine().root_device().memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
379   membank("bank1")->set_base(memregion("sub2")->base() + (m_gfx_rom_bank * 0x2000) + 0x10000);
380380}
381381
382382
trunk/src/mame/drivers/skykid.c
r21033r21034
630630   int i;
631631
632632   /* unpack the third sprite ROM */
633   rom = machine().root_device().memregion("gfx3")->base() + 0x4000;
633   rom = memregion("gfx3")->base() + 0x4000;
634634   for (i = 0;i < 0x2000;i++)
635635   {
636636      rom[i + 0x4000] = rom[i];       // sprite set #1, plane 3
trunk/src/mame/drivers/rainbow.c
r21033r21034
396396
397397WRITE8_MEMBER(rbisland_state::bankswitch_w)
398398{
399   machine().root_device().membank("bank1")->set_entry(data & 3);
399   membank("bank1")->set_entry(data & 3);
400400}
401401
402402READ8_MEMBER(rbisland_state::jumping_latch_r)
r21033r21034
852852
853853DRIVER_INIT_MEMBER(rbisland_state,rbisland)
854854{
855   UINT8 *ROM = machine().root_device().memregion("audiocpu")->base();
855   UINT8 *ROM = memregion("audiocpu")->base();
856856
857   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
857   membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
858858
859859   rbisland_cchip_init(0);
860860}
861861
862862DRIVER_INIT_MEMBER(rbisland_state,rbislande)
863863{
864   UINT8 *ROM = machine().root_device().memregion("audiocpu")->base();
864   UINT8 *ROM = memregion("audiocpu")->base();
865865
866   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
866   membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
867867
868868   rbisland_cchip_init(1);
869869}
trunk/src/mame/drivers/acefruit.c
r21033r21034
604604
605605DRIVER_INIT_MEMBER(acefruit_state,sidewndr)
606606{
607   UINT8 *ROM = machine().root_device().memregion( "maincpu" )->base();
607   UINT8 *ROM = 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 */
trunk/src/mame/drivers/tunhunt.c
r21033r21034
9090
9191READ8_MEMBER(tunhunt_state::dsw2_0r)
9292{
93   return (machine().root_device().ioport("DSW")->read()&0x0100)?0x80:0x00;
93   return (ioport("DSW")->read()&0x0100)?0x80:0x00;
9494}
9595
9696
9797READ8_MEMBER(tunhunt_state::dsw2_1r)
9898{
99   return (machine().root_device().ioport("DSW")->read()&0x0200)?0x80:0x00;
99   return (ioport("DSW")->read()&0x0200)?0x80:0x00;
100100}
101101
102102
103103READ8_MEMBER(tunhunt_state::dsw2_2r)
104104{
105   return (machine().root_device().ioport("DSW")->read()&0x0400)?0x80:0x00;
105   return (ioport("DSW")->read()&0x0400)?0x80:0x00;
106106}
107107
108108
109109READ8_MEMBER(tunhunt_state::dsw2_3r)
110110{
111   return (machine().root_device().ioport("DSW")->read()&0x0800)?0x80:0x00;
111   return (ioport("DSW")->read()&0x0800)?0x80:0x00;
112112}
113113
114114
115115READ8_MEMBER(tunhunt_state::dsw2_4r)
116116{
117   return (machine().root_device().ioport("DSW")->read()&0x1000)?0x80:0x00;
117   return (ioport("DSW")->read()&0x1000)?0x80:0x00;
118118}
119119
120120
trunk/src/mame/drivers/travrusa.c
r21033r21034
448448DRIVER_INIT_MEMBER(travrusa_state,motorace)
449449{
450450   int A, j;
451   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
451   UINT8 *rom = memregion("maincpu")->base();
452452   UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x2000);
453453
454454   memcpy(buffer, rom, 0x2000);
r21033r21034
466466DRIVER_INIT_MEMBER(travrusa_state,shtridra)
467467{
468468   int A;
469   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
469   UINT8 *rom = memregion("maincpu")->base();
470470
471471   /* D3/D4  and  D5/D6 swapped */
472472   for (A = 0; A < 0x2000; A++)
trunk/src/mame/drivers/neogeo.c
r21033r21034
654654void neogeo_state::neogeo_main_cpu_banking_init()
655655{
656656   /* create vector banks */
657   m_bank_vectors->configure_entry(0, machine().root_device().memregion("mainbios")->base());
657   m_bank_vectors->configure_entry(0, memregion("mainbios")->base());
658658   m_bank_vectors->configure_entry(1, m_region_maincpu->base());
659659
660660   if (m_is_cartsys)
r21033r21034
12981298         size = image.get_software_region_length("audiocpu");
12991299         machine().memory().region_free(":audiocpu");
13001300         machine().memory().region_alloc(":audiocpu",size+0x10000,1, ENDIANNESS_LITTLE);
1301         memcpy(machine().root_device().memregion("audiocpu")->base(),image.get_software_region("audiocpu"),size);
1302         memcpy(machine().root_device().memregion("audiocpu")->base()+0x10000,image.get_software_region("audiocpu"),size); // avoid reloading in XML, should just improve banking instead tho?
1301         memcpy(memregion("audiocpu")->base(),image.get_software_region("audiocpu"),size);
1302         memcpy(memregion("audiocpu")->base()+0x10000,image.get_software_region("audiocpu"),size); // avoid reloading in XML, should just improve banking instead tho?
13031303      }
13041304
13051305
13061306      size = image.get_software_region_length("ymsnd");
13071307      machine().memory().region_free(":ymsnd");
13081308      machine().memory().region_alloc(":ymsnd",size,1, ENDIANNESS_LITTLE);
1309      memcpy(machine().root_device().memregion("ymsnd")->base(),image.get_software_region("ymsnd"),size);
1309      memcpy(memregion("ymsnd")->base(),image.get_software_region("ymsnd"),size);
13101310      if(image.get_software_region("ymsnd.deltat") != NULL)
13111311      {
13121312         size = image.get_software_region_length("ymsnd.deltat");
13131313         machine().memory().region_free(":ymsnd.deltat");
13141314         machine().memory().region_alloc(":ymsnd.deltat",size,1, ENDIANNESS_LITTLE);
1315         memcpy(machine().root_device().memregion("ymsnd.deltat")->base(),image.get_software_region("ymsnd.deltat"),size);
1315         memcpy(memregion("ymsnd.deltat")->base(),image.get_software_region("ymsnd.deltat"),size);
13161316      }
13171317      else
13181318         machine().memory().region_free(":ymsnd.deltat");  // removing the region will fix sound glitches in non-Delta-T games
r21033r21034
13201320      size = image.get_software_region_length("sprites");
13211321      machine().memory().region_free(":sprites");
13221322      machine().memory().region_alloc(":sprites",size,1, ENDIANNESS_LITTLE);
1323      memcpy(machine().root_device().memregion("sprites")->base(),image.get_software_region("sprites"),size);
1323      memcpy(memregion("sprites")->base(),image.get_software_region("sprites"),size);
13241324      // Reset the reference to the region
13251325      m_region_sprites.findit();
13261326      if(image.get_software_region("audiocrypt") != NULL)  // encrypted Z80 code
13271327      {
13281328         size = image.get_software_region_length("audiocrypt");
13291329         machine().memory().region_alloc(":audiocrypt",size,1, ENDIANNESS_LITTLE);
1330         memcpy(machine().root_device().memregion("audiocrypt")->base(),image.get_software_region("audiocrypt"),size);
1330         memcpy(memregion("audiocrypt")->base(),image.get_software_region("audiocrypt"),size);
13311331         // allocate the audiocpu region to decrypt data into
13321332         machine().memory().region_free(":audiocpu");
13331333         machine().memory().region_alloc(":audiocpu",size+0x10000,1, ENDIANNESS_LITTLE);
r21033r21034
13351335
13361336      // setup cartridge ROM area
13371337      m_maincpu->space(AS_PROGRAM).install_read_bank(0x000080,0x0fffff,"cart_rom");
1338      machine().root_device().membank("cart_rom")->set_base(m_region_maincpu->base() + 0x80);
1338      membank("cart_rom")->set_base(m_region_maincpu->base() + 0x80);
13391339
13401340      // handle possible protection
13411341      mvs_install_protection(image);
trunk/src/mame/drivers/goldstar.c
r21033r21034
61836183   for (i = 0; i < 0x100; i++)
61846184   {
61856185      UINT8 data;
6186      UINT8*proms = machine().root_device().memregion("proms")->base();
6186      UINT8*proms = memregion("proms")->base();
61876187
61886188      data = proms[0x000 + i] | (proms[0x100 + i] << 4);
61896189
r21033r21034
61986198   {
61996199      int r,g,b;
62006200
6201      UINT8*proms = machine().root_device().memregion("proms")->base();
6201      UINT8*proms = memregion("proms")->base();
62026202
62036203      b = proms[0x000 + i] << 4;
62046204      g = proms[0x100 + i] << 4;
r21033r21034
62166216   UINT8 data;
62176217   UINT8 *proms;
62186218
6219   proms = machine().root_device().memregion("proms")->base();
6219   proms = memregion("proms")->base();
62206220   for (i = 0; i < 0x100; i++)
62216221   {
62226222      data = proms[0x000 + i] | (proms[0x100 + i] << 4);
r21033r21034
62246224      palette_set_color_rgb(machine(), i, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
62256225   }
62266226
6227   proms = machine().root_device().memregion("proms2")->base();
6227   proms = memregion("proms2")->base();
62286228   for (i=0; i < 0x20; i++)
62296229   {
62306230      data = proms[i];
r21033r21034
66016601   {
66026602      int r,g,b;
66036603
6604      UINT8*proms = machine().root_device().memregion("proms")->base();
6604      UINT8*proms = memregion("proms")->base();
66056605
66066606      b = proms[0x000 + i] << 4;
66076607      g = proms[0x100 + i] << 4;
r21033r21034
87288728DRIVER_INIT_MEMBER(goldstar_state,magoddsc)
87298729{
87308730   int A;
8731   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8731   UINT8 *ROM = memregion("maincpu")->base();
87328732
87338733   for (A = 0;A < 0x8000;A++)
87348734   {
r21033r21034
99809980DRIVER_INIT_MEMBER(goldstar_state,fb2010)
99819981{
99829982   int i;
9983   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9983   UINT8 *ROM = memregion("maincpu")->base();
99849984   for (i = 0;i < 0x10000;i++)
99859985   {
99869986      UINT8 x = ROM[i];
r21033r21034
1089310893DRIVER_INIT_MEMBER(goldstar_state,goldstar)
1089410894{
1089510895   int A;
10896   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
10896   UINT8 *ROM = memregion("maincpu")->base();
1089710897
1089810898   for (A = 0;A < 0x10000;A++)
1089910899   {
r21033r21034
1097810978
1097910979DRIVER_INIT_MEMBER(goldstar_state,chry10)
1098010980{
10981   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
10982   int size = machine().root_device().memregion("maincpu")->bytes();
10981   UINT8 *ROM = memregion("maincpu")->base();
10982   int size = memregion("maincpu")->bytes();
1098310983   int start = 0;
1098410984
1098510985   int i;
r21033r21034
1100211002
1100311003DRIVER_INIT_MEMBER(goldstar_state,cb3)
1100411004{
11005   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11006   int size = machine().root_device().memregion("maincpu")->bytes();
11005   UINT8 *ROM = memregion("maincpu")->base();
11006   int size = memregion("maincpu")->bytes();
1100711007   int start = 0;
1100811008
1100911009   int i;
r21033r21034
1102111021DRIVER_INIT_MEMBER(goldstar_state,chrygld)
1102211022{
1102311023   int A;
11024   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11024   UINT8 *ROM = memregion("maincpu")->base();
1102511025   do_blockswaps(ROM);
1102611026
1102711027   // a data bitswap
r21033r21034
1103711037
1103811038DRIVER_INIT_MEMBER(goldstar_state,cm)
1103911039{
11040   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11040   UINT8 *ROM = memregion("maincpu")->base();
1104111041
1104211042/*  forcing PPI mode 0 for all, and A, B & C as input.
1104311043    the mixed modes 2-0 are not working properly.
r21033r21034
1104811048
1104911049DRIVER_INIT_MEMBER(goldstar_state,cmv4)
1105011050{
11051   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11051   UINT8 *ROM = memregion("maincpu")->base();
1105211052
1105311053/*  forcing PPI mode 0 for all, and A, B & C as input.
1105411054    the mixed modes 2-0 are not working properly.
r21033r21034
1105911059
1106011060DRIVER_INIT_MEMBER(goldstar_state,cmast91)
1106111061{
11062   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11062   UINT8 *ROM = memregion("maincpu")->base();
1106311063
1106411064/*  forcing PPI mode 0 for all, and A, B & C as input.
1106511065    the mixed modes 2-0 are not working properly.
r21033r21034
1107011070
1107111071DRIVER_INIT_MEMBER(goldstar_state,lucky8a)
1107211072{
11073   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11073   UINT8 *ROM = memregion("maincpu")->base();
1107411074
1107511075   ROM[0x0010] = 0x21;
1107611076}
r21033r21034
1107811078DRIVER_INIT_MEMBER(goldstar_state,nfb96sea)
1107911079{
1108011080   int i;
11081   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11081   UINT8 *ROM = memregion("maincpu")->base();
1108211082
1108311083   for (i = 0;i < 0x10000;i++)
1108411084   {
r21033r21034
1111111111DRIVER_INIT_MEMBER(goldstar_state,schery97)
1111211112{
1111311113   int i;
11114   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11114   UINT8 *ROM = memregion("maincpu")->base();
1111511115   for (i = 0;i < 0x10000;i++)
1111611116   {
1111711117      UINT8 x = ROM[i];
r21033r21034
1113811138DRIVER_INIT_MEMBER(goldstar_state,schery97a)
1113911139{
1114011140   int i;
11141   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11141   UINT8 *ROM = memregion("maincpu")->base();
1114211142   for (i = 0;i < 0x10000;i++)
1114311143   {
1114411144      UINT8 x = ROM[i];
r21033r21034
1116611166DRIVER_INIT_MEMBER(goldstar_state,skill98)
1116711167{
1116811168   int i;
11169   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11169   UINT8 *ROM = memregion("maincpu")->base();
1117011170   for (i = 0;i < 0x10000;i++)
1117111171   {
1117211172      UINT8 x = ROM[i];
r21033r21034
1119211192DRIVER_INIT_MEMBER(goldstar_state,nfb96_c1)
1119311193{
1119411194   int i;
11195   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11195   UINT8 *ROM = memregion("maincpu")->base();
1119611196   for (i = 0;i < 0x10000;i++)
1119711197   {
1119811198      UINT8 x = ROM[i];
r21033r21034
1121811218DRIVER_INIT_MEMBER(goldstar_state,nfb96_c2)
1121911219{
1122011220   int i;
11221   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11221   UINT8 *ROM = memregion("maincpu")->base();
1122211222   for (i = 0;i < 0x10000;i++)
1122311223   {
1122411224      UINT8 x = ROM[i];
r21033r21034
1125411254DRIVER_INIT_MEMBER(goldstar_state,nfb96_d)
1125511255{
1125611256   int i;
11257   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11257   UINT8 *ROM = memregion("maincpu")->base();
1125811258   for (i = 0;i < 0x10000;i++)
1125911259   {
1126011260      UINT8 x = ROM[i];
r21033r21034
1128611286DRIVER_INIT_MEMBER(goldstar_state,nfb96_dk)
1128711287{
1128811288   int i;
11289   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11289   UINT8 *ROM = memregion("maincpu")->base();
1129011290   for (i = 0;i < 0x10000;i++)
1129111291   {
1129211292      UINT8 x = ROM[i];
r21033r21034
1131711317DRIVER_INIT_MEMBER(goldstar_state,rp35)
1131811318{
1131911319   int i;
11320   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11320   UINT8 *ROM = memregion("maincpu")->base();
1132111321   for (i = 0;i < 0x10000;i++)
1132211322   {
1132311323      UINT8 x = ROM[i];
r21033r21034
1134411344DRIVER_INIT_MEMBER(goldstar_state,rp36)
1134511345{
1134611346   int i;
11347   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11347   UINT8 *ROM = memregion("maincpu")->base();
1134811348   for (i = 0;i < 0x10000;i++)
1134911349   {
1135011350      UINT8 x = ROM[i];
r21033r21034
1137111371DRIVER_INIT_MEMBER(goldstar_state,rp36c3)
1137211372{
1137311373   int i;
11374   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11374   UINT8 *ROM = memregion("maincpu")->base();
1137511375   for (i = 0;i < 0x10000;i++)
1137611376   {
1137711377      UINT8 x = ROM[i];
r21033r21034
1140411404DRIVER_INIT_MEMBER(goldstar_state,po33)
1140511405{
1140611406   int i;
11407   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11407   UINT8 *ROM = memregion("maincpu")->base();
1140811408   for (i = 0;i < 0x10000;i++)
1140911409   {
1141011410      UINT8 x = ROM[i];
r21033r21034
1143711437DRIVER_INIT_MEMBER(goldstar_state,match133)
1143811438{
1143911439   int i;
11440   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11440   UINT8 *ROM = memregion("maincpu")->base();
1144111441   for (i = 0;i < 0x10000;i++)
1144211442   {
1144311443      UINT8 x = ROM[i];
r21033r21034
1146011460DRIVER_INIT_MEMBER(goldstar_state,cherrys)
1146111461{
1146211462   int i;
11463   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11463   UINT8 *ROM = memregion("maincpu")->base();
1146411464
1146511465   unsigned char rawData[256] = {
1146611466      0xCC, 0xCD, 0xCE, 0xCF, 0xC8, 0xC9, 0xCA, 0xCB, 0xC4, 0xC5, 0xC6, 0xC7,
r21033r21034
1149711497/* todo: remove these patches! */
1149811498DRIVER_INIT_MEMBER(goldstar_state,unkch1)
1149911499{
11500   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11500   UINT8 *ROM = memregion("maincpu")->base();
1150111501   ROM[0x9d52] = 0x00;
1150211502   ROM[0x9d53] = 0x00;
1150311503}
1150411504
1150511505DRIVER_INIT_MEMBER(goldstar_state,unkch3)
1150611506{
11507   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11507   UINT8 *ROM = memregion("maincpu")->base();
1150811508   ROM[0x9b86] = 0x00;
1150911509   ROM[0x9b87] = 0x00;
1151011510}
1151111511
1151211512DRIVER_INIT_MEMBER(goldstar_state,unkch4)
1151311513{
11514   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
11514   UINT8 *ROM = memregion("maincpu")->base();
1151511515   ROM[0x9a6e] = 0x00;
1151611516   ROM[0x9a6f] = 0x00;
1151711517}
trunk/src/mame/drivers/sfbonus.c
r21033r21034
13381338
13391339void sfbonus_state::machine_reset()
13401340{
1341   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1341   UINT8 *ROM = memregion("maincpu")->base();
13421342
1343   machine().root_device().membank("bank1")->set_base(&ROM[0]);
1343   membank("bank1")->set_base(&ROM[0]);
13441344}
13451345
13461346
r21033r21034
58885888                  UINT8 xor7, UINT8 b70, UINT8 b71, UINT8 b72, UINT8 b73, UINT8 b74, UINT8 b75, UINT8 b76,UINT8 b77 )
58895889{
58905890   int i;
5891   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
5891   UINT8 *ROM = memregion("maincpu")->base();
58925892
5893   for(i = 0; i < machine().root_device().memregion("maincpu")->bytes(); i++)
5893   for(i = 0; i < memregion("maincpu")->bytes(); i++)
58945894   {
58955895      UINT8 x = ROM[i];
58965896
trunk/src/mame/drivers/crystal.c
r21033r21034
298298{
299299   m_Bank = (data >> 1) & 7;
300300   if (m_Bank <= 2)
301      membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + m_Bank * 0x1000000);
301      membank("bank1")->set_base(memregion("user1")->base() + m_Bank * 0x1000000);
302302   else
303      membank("bank1")->set_base(machine().root_device().memregion("user2")->base());
303      membank("bank1")->set_base(memregion("user2")->base());
304304}
305305
306306TIMER_CALLBACK_MEMBER(crystal_state::Timercb)
r21033r21034
376376   {
377377      if (m_Bank <= 2)
378378      {
379         UINT32 *ptr = (UINT32*)(machine().root_device().memregion("user1")->base() + m_Bank * 0x1000000);
379         UINT32 *ptr = (UINT32*)(memregion("user1")->base() + m_Bank * 0x1000000);
380380         return ptr[0];
381381      }
382382      else
r21033r21034
955955
956956DRIVER_INIT_MEMBER(crystal_state,crysking)
957957{
958   UINT16 *Rom = (UINT16*) machine().root_device().memregion("user1")->base();
958   UINT16 *Rom = (UINT16*) memregion("user1")->base();
959959
960960   //patch the data feed by the protection
961961
r21033r21034
974974
975975DRIVER_INIT_MEMBER(crystal_state,evosocc)
976976{
977   UINT16 *Rom = (UINT16*) machine().root_device().memregion("user1")->base();
977   UINT16 *Rom = (UINT16*) memregion("user1")->base();
978978   Rom += 0x1000000 * 2 / 2;
979979
980980   Rom[WORD_XOR_LE(0x97388E/2)] = 0x90FC;  //PUSH R2..R7
r21033r21034
992992
993993DRIVER_INIT_MEMBER(crystal_state,topbladv)
994994{
995   UINT16 *Rom = (UINT16*) machine().root_device().memregion("user1")->base();
995   UINT16 *Rom = (UINT16*) memregion("user1")->base();
996996
997997   Rom[WORD_XOR_LE(0x12d7a/2)] = 0x90FC;   //PUSH R7-R6-R5-R4-R3-R2
998998   Rom[WORD_XOR_LE(0x12d7c/2)] = 0x9001;   //PUSH R0
r21033r21034
10101010
10111011DRIVER_INIT_MEMBER(crystal_state,officeye)
10121012{
1013   UINT16 *Rom = (UINT16*) machine().root_device().memregion("user1")->base();
1013   UINT16 *Rom = (UINT16*) memregion("user1")->base();
10141014
10151015   Rom[WORD_XOR_LE(0x9c9e/2)] = 0x901C;    //PUSH R4-R3-R2
10161016   Rom[WORD_XOR_LE(0x9ca0/2)] = 0x9001;    //PUSH R0
trunk/src/mame/drivers/tempest.c
r21033r21034
354354
355355READ8_MEMBER(tempest_state::input_port_1_bit_r)
356356{
357   return (machine().root_device().ioport("IN1/DSW0")->read() & (1 << offset)) ? 0 : 228;
357   return (ioport("IN1/DSW0")->read() & (1 << offset)) ? 0 : 228;
358358}
359359
360360
361361READ8_MEMBER(tempest_state::input_port_2_bit_r)
362362{
363   return (machine().root_device().ioport("IN2")->read() & (1 << offset)) ? 0 : 228;
363   return (ioport("IN2")->read() & (1 << offset)) ? 0 : 228;
364364}
365365
366366
trunk/src/mame/drivers/chinsan.c
r21033r21034
8787
8888void chinsan_state::palette_init()
8989{
90   UINT8 *src = machine().root_device().memregion( "color_proms" )->base();
90   UINT8 *src = memregion( "color_proms" )->base();
9191   int i;
9292
9393   for (i = 0; i < 0x100; i++)
trunk/src/mame/drivers/famibox.c
r21033r21034
272272      if ( bank == famicombox_banks[i].bank ||
273273            famicombox_banks[i].bank == 0 )
274274      {
275         machine().root_device().membank("cpubank1")->set_base(machine().root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset);
276         machine().root_device().membank("cpubank2")->set_base(machine().root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset);
277         machine().root_device().membank("ppubank1")->set_base(machine().root_device().memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset);
275         membank("cpubank1")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset);
276         membank("cpubank2")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset);
277         membank("ppubank1")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset);
278278         break;
279279      }
280280   }
trunk/src/mame/drivers/aerofgt.c
r21033r21034
13001300
13011301MACHINE_START_MEMBER(aerofgt_state,aerofgt)
13021302{
1303   UINT8 *rom = machine().root_device().memregion("audiocpu")->base();
1303   UINT8 *rom = memregion("audiocpu")->base();
13041304
1305   machine().root_device().membank("bank1")->configure_entries(0, 4, &rom[0x10000], 0x8000);
1305   membank("bank1")->configure_entries(0, 4, &rom[0x10000], 0x8000);
13061306
13071307   MACHINE_START_CALL_MEMBER(common);
13081308}
r21033r21034
13161316{
13171317   MACHINE_RESET_CALL_MEMBER(common);
13181318
1319   machine().root_device().membank("bank1")->set_entry(0); /* needed by spinlbrk */
1319   membank("bank1")->set_entry(0); /* needed by spinlbrk */
13201320}
13211321
13221322static MACHINE_CONFIG_START( pspikes, aerofgt_state )
trunk/src/mame/drivers/system16.c
r21033r21034
456456WRITE8_MEMBER(segas1x_bootleg_state::upd7759_bank_w)//*
457457{
458458   device_t *device = machine().device("7759");
459   int offs, size = machine().root_device().memregion("soundcpu")->bytes() - 0x10000;
459   int offs, size = memregion("soundcpu")->bytes() - 0x10000;
460460
461461   upd7759_reset_w(device, data & 0x40);
462462   offs = 0x10000 + (data * 0x4000) % size;
463   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("soundcpu")->base() + offs);
463   membank("bank1")->set_base(memregion("soundcpu")->base() + offs);
464464}
465465
466466
r21033r21034
33263326
33273327DRIVER_INIT_MEMBER(segas1x_bootleg_state,bayrouteb2)
33283328{
3329   UINT8 *mem = machine().root_device().memregion("soundcpu")->base();
3329   UINT8 *mem = memregion("soundcpu")->base();
33303330
33313331   memcpy(mem, mem + 0x10000, 0x8000);
33323332
r21033r21034
33423342
33433343DRIVER_INIT_MEMBER(segas1x_bootleg_state,tturfbl)
33443344{
3345   UINT8 *mem = machine().root_device().memregion("soundcpu")->base();
3345   UINT8 *mem = memregion("soundcpu")->base();
33463346
33473347   memcpy(mem, mem + 0x10000, 0x8000);
33483348
r21033r21034
33743374/* Tetris-based */
33753375DRIVER_INIT_MEMBER(segas1x_bootleg_state,beautyb)
33763376{
3377   UINT16*rom = (UINT16*)machine().root_device().memregion( "maincpu" )->base();
3377   UINT16*rom = (UINT16*)memregion( "maincpu" )->base();
33783378   int x;
33793379
33803380   for (x = 0; x < 0x8000; x++)
trunk/src/mame/drivers/twinkle.c
r21033r21034
711711
712712READ16_MEMBER(twinkle_state::twinkle_waveram_r)
713713{
714   UINT16 *waveram = (UINT16 *)machine().root_device().memregion("rfsnd")->base();
714   UINT16 *waveram = (UINT16 *)memregion("rfsnd")->base();
715715
716716   return waveram[offset];
717717}
718718
719719WRITE16_MEMBER(twinkle_state::twinkle_waveram_w)
720720{
721   UINT16 *waveram = (UINT16 *)machine().root_device().memregion("rfsnd")->base();
721   UINT16 *waveram = (UINT16 *)memregion("rfsnd")->base();
722722
723723   COMBINE_DATA(&waveram[offset]);
724724}
trunk/src/mame/drivers/zn.c
r21033r21034
640640
641641MACHINE_RESET_MEMBER(zn_state,coh1000c)
642642{
643   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* fixed game rom */
644   machine().root_device().membank( "bank2" )->set_base( machine().root_device().memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
645   machine().root_device().membank( "bank3" )->set_base( machine().root_device().memregion( "user3" )->base() ); /* country rom */
643   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* fixed game rom */
644   membank( "bank2" )->set_base( memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
645   membank( "bank3" )->set_base( memregion( "user3" )->base() ); /* country rom */
646646}
647647
648648static ADDRESS_MAP_START( qsound_map, AS_PROGRAM, 8, zn_state )
r21033r21034
847847
848848MACHINE_RESET_MEMBER(zn_state,coh3002c)
849849{
850   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* fixed game rom */
851   machine().root_device().membank( "bank2" )->set_base( machine().root_device().memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
852   machine().root_device().membank( "bank3" )->set_base( machine().root_device().memregion( "user3" )->base() ); /* country rom */
850   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* fixed game rom */
851   membank( "bank2" )->set_base( memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
852   membank( "bank3" )->set_base( memregion( "user3" )->base() ); /* country rom */
853853}
854854
855855static MACHINE_CONFIG_DERIVED( coh3002c, zn2 )
r21033r21034
13981398
13991399MACHINE_RESET_MEMBER(zn_state,coh1000w)
14001400{
1401   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* fixed game rom */
1401   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* fixed game rom */
14021402
14031403   machine().device("ide")->reset();
14041404}
r21033r21034
15851585
15861586MACHINE_RESET_MEMBER(zn_state,coh1002e)
15871587{
1588   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* banked game rom */
1588   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* banked game rom */
15891589}
15901590
15911591static ADDRESS_MAP_START( psarc_snd_map, AS_PROGRAM, 16, zn_state )
r21033r21034
17271727
17281728MACHINE_RESET_MEMBER(zn_state,bam2)
17291729{
1730   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* fixed game rom */
1731   machine().root_device().membank( "bank2" )->set_base( machine().root_device().memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
1730   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* fixed game rom */
1731   membank( "bank2" )->set_base( memregion( "user2" )->base() + 0x400000 ); /* banked game rom */
17321732}
17331733
17341734static MACHINE_CONFIG_DERIVED( bam2, zn1_2mb_vram )
r21033r21034
19741974
19751975      if( state->m_jdredd_gun_mux == 0 )
19761976      {
1977         x = state->machine().root_device().ioport("GUN1X")->read();
1978         y = state->machine().root_device().ioport("GUN1Y")->read();
1977         x = state->ioport("GUN1X")->read();
1978         y = state->ioport("GUN1Y")->read();
19791979      }
19801980      else
19811981      {
1982         x = state->machine().root_device().ioport("GUN2X")->read();
1983         y = state->machine().root_device().ioport("GUN2Y")->read();
1982         x = state->ioport("GUN2X")->read();
1983         y = state->ioport("GUN2Y")->read();
19841984      }
19851985
19861986      if( x > 0x393 && x < 0xcb2 &&
r21033r21034
20532053
20542054MACHINE_RESET_MEMBER(zn_state,coh1000a)
20552055{
2056   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* fixed game rom */
2056   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* fixed game rom */
20572057   if( ( !strcmp( machine().system().name, "jdredd" ) ) ||
20582058      ( !strcmp( machine().system().name, "jdreddb" ) ) )
20592059   {
r21033r21034
22082208
22092209MACHINE_RESET_MEMBER(zn_state,coh1001l)
22102210{
2211   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* banked rom */
2211   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* banked rom */
22122212}
22132213
22142214static MACHINE_CONFIG_DERIVED( coh1001l, zn1_2mb_vram )
r21033r21034
22502250
22512251MACHINE_RESET_MEMBER(zn_state,coh1002v)
22522252{
2253   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() ); /* fixed game rom */
2254   machine().root_device().membank( "bank2" )->set_base( machine().root_device().memregion( "user3" )->base() ); /* banked rom */
2253   membank( "bank1" )->set_base( memregion( "user2" )->base() ); /* fixed game rom */
2254   membank( "bank2" )->set_base( memregion( "user3" )->base() ); /* banked rom */
22552255}
22562256
22572257static MACHINE_CONFIG_DERIVED( coh1002v, zn1_2mb_vram )
r21033r21034
24522452
24532453MACHINE_RESET_MEMBER(zn_state,coh1002m)
24542454{
2455   machine().root_device().membank( "bank1" )->set_base( machine().root_device().memregion( "user2" )->base() );
2455   membank( "bank1" )->set_base( memregion( "user2" )->base() );
24562456}
24572457
24582458READ8_MEMBER(zn_state::cbaj_z80_latch_r)
trunk/src/mame/drivers/segald.c
r21033r21034
591591
592592DRIVER_INIT_MEMBER(segald_state,astron)
593593{
594   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
595   machine().root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x8000], 0x4000);
594   UINT8 *ROM = memregion("maincpu")->base();
595   membank("bank1")->configure_entries(0, 2, &ROM[0x8000], 0x4000);
596596}
597597
598598
trunk/src/mame/drivers/sprint2.c
r21033r21034
8585
8686         m_dial[i] += delta;
8787
88         switch (machine().root_device().ioport(i ? "GEAR_P2" : "GEAR_P1")->read() & 15)
88         switch (ioport(i ? "GEAR_P2" : "GEAR_P1")->read() & 15)
8989         {
9090         case 1: m_gear[i] = 1; break;
9191         case 2: m_gear[i] = 2; break;
trunk/src/mame/drivers/stactics.c
r21033r21034
7878      /* monitor motor under joystick control */
7979   if (*m_motor_on & 0x01)
8080   {
81      int ip3 = machine().root_device().ioport("IN3")->read();
82      int ip4 = machine().root_device().ioport("FAKE")->read();
81      int ip3 = ioport("IN3")->read();
82      int ip4 = ioport("FAKE")->read();
8383
8484      /* up */
8585      if (((ip4 & 0x01) == 0) && (m_vert_pos > -128))
trunk/src/mame/drivers/galaxian.c
r21033r21034
25152515
25162516void galaxian_state::decode_mooncrst(int length, UINT8 *dest)
25172517{
2518   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2518   UINT8 *rom = memregion("maincpu")->base();
25192519   int offs;
25202520
25212521   for (offs = 0; offs < length; offs++)
r21033r21034
25772577      { 0,2,0,2 },
25782578      { 1,4,1,4 }
25792579   };
2580   UINT8 *rombase = machine().root_device().memregion("maincpu")->base();
2581   UINT32 romlength = machine().root_device().memregion("maincpu")->bytes();
2580   UINT8 *rombase = memregion("maincpu")->base();
2581   UINT32 romlength = memregion("maincpu")->bytes();
25822582   UINT32 offs;
25832583
25842584   for (offs = 0; offs < romlength; offs++)
r21033r21034
25942594
25952595void galaxian_state::decode_dingoe()
25962596{
2597   UINT8 *rombase = machine().root_device().memregion("maincpu")->base();
2598   UINT32 romlength = machine().root_device().memregion("maincpu")->bytes();
2597   UINT8 *rombase = memregion("maincpu")->base();
2598   UINT32 romlength = memregion("maincpu")->bytes();
25992599   UINT32 offs;
26002600
26012601   for (offs = 0; offs < romlength; offs++)
r21033r21034
26172617
26182618void galaxian_state::decode_frogger_sound()
26192619{
2620   UINT8 *rombase = machine().root_device().memregion("audiocpu")->base();
2620   UINT8 *rombase = memregion("audiocpu")->base();
26212621   UINT32 offs;
26222622
26232623   /* the first ROM of the sound CPU has data lines D0 and D1 swapped */
r21033r21034
26282628
26292629void galaxian_state::decode_frogger_gfx()
26302630{
2631   UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
2631   UINT8 *rombase = memregion("gfx1")->base();
26322632   UINT32 offs;
26332633
26342634   /* the 2nd gfx ROM has data lines D0 and D1 swapped */
r21033r21034
26392639
26402640void galaxian_state::decode_anteater_gfx()
26412641{
2642   UINT32 romlength = machine().root_device().memregion("gfx1")->bytes();
2643   UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
2642   UINT32 romlength = memregion("gfx1")->bytes();
2643   UINT8 *rombase = memregion("gfx1")->base();
26442644   UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength);
26452645   UINT32 offs;
26462646
r21033r21034
26592659
26602660void galaxian_state::decode_losttomb_gfx()
26612661{
2662   UINT32 romlength = machine().root_device().memregion("gfx1")->bytes();
2663   UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
2662   UINT32 romlength = memregion("gfx1")->bytes();
2663   UINT8 *rombase = memregion("gfx1")->base();
26642664   UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength);
26652665   UINT32 offs;
26662666
r21033r21034
26842684
26852685   /* Deryption worked out by hand by Chris Hardy. */
26862686
2687   RAM = machine().root_device().memregion("maincpu")->base();
2687   RAM = memregion("maincpu")->base();
26882688
26892689   for (i = 0;i < 0x1000;i++)
26902690   {
r21033r21034
28432843   common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
28442844
28452845   /* decrypt program code */
2846   decode_mooncrst(0x8000, machine().root_device().memregion("maincpu")->base());
2846   decode_mooncrst(0x8000, memregion("maincpu")->base());
28472847}
28482848
28492849
r21033r21034
31253125   space.install_ram(0x8000, 0x87ff);
31263126
31273127   /* extend ROM */
3128   space.install_rom(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base());
3128   space.install_rom(0x0000, 0x7fff, memregion("maincpu")->base());
31293129}
31303130
31313131
31323132void galaxian_state::mshuttle_decode(const UINT8 convtable[8][16])
31333133{
31343134   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
3135   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
3135   UINT8 *rom = memregion("maincpu")->base();
31363136   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000);
31373137   int A;
31383138
r21033r21034
32303230      3, 7, 7, 7  // ok!
32313231   };
32323232
3233   UINT8* romdata = machine().root_device().memregion("maincpu")->base();
3234   assert(machine().root_device().memregion("maincpu")->bytes() == 0x8000);
3233   UINT8* romdata = memregion("maincpu")->base();
3234   assert(memregion("maincpu")->bytes() == 0x8000);
32353235   UINT8 buf[0x8000];
32363236   memcpy(buf, romdata, 0x8000);
32373237
trunk/src/mame/drivers/kickgoal.c
r21033r21034
775775DRIVER_INIT_MEMBER(kickgoal_state,kickgoal)
776776{
777777#if 0 /* we should find a real fix instead  */
778   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
778   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
779779
780780   /* fix "bug" that prevents game from writing to EEPROM */
781781   rom[0x12b0/2] = 0x0001;
trunk/src/mame/drivers/avt.c
r21033r21034
533533
534534void avt_state::palette_init()
535535{
536   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
536   const UINT8 *color_prom = memregion("proms")->base();
537537/*  prom bits
538538    7654 3210
539539    ---- ---x   Intensity?.
trunk/src/mame/drivers/seta.c
r21033r21034
15781578
15791579READ8_MEMBER(seta_state::dsw1_r)
15801580{
1581   return (machine().root_device().ioport("DSW")->read() >> 8) & 0xff;
1581   return (ioport("DSW")->read() >> 8) & 0xff;
15821582}
15831583
15841584READ8_MEMBER(seta_state::dsw2_r)
15851585{
1586   return (machine().root_device().ioport("DSW")->read() >> 0) & 0xff;
1586   return (ioport("DSW")->read() >> 0) & 0xff;
15871587}
15881588
15891589
r21033r21034
1075910759
1076010760DRIVER_INIT_MEMBER(seta_state,metafox)
1076110761{
10762   UINT16 *RAM = (UINT16 *) machine().root_device().memregion("maincpu")->base();
10762   UINT16 *RAM = (UINT16 *) memregion("maincpu")->base();
1076310763
1076410764   /* This game uses the 21c000-21ffff area for protection? */
1076510765//  machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x21c000, 0x21ffff);
r21033r21034
1078210782   rom_size = 0x80000;
1078310783   buf = auto_alloc_array(machine(), UINT8, rom_size);
1078410784
10785   rom = machine().root_device().memregion("gfx2")->base() + 0x40000;
10785   rom = memregion("gfx2")->base() + 0x40000;
1078610786
1078710787   for (rpos = 0; rpos < rom_size/2; rpos++) {
1078810788      buf[rpos+0x40000] = rom[rpos*2];
r21033r21034
1079110791
1079210792   memcpy( rom, buf, rom_size );
1079310793
10794   rom = machine().root_device().memregion("gfx3")->base() + 0x40000;
10794   rom = memregion("gfx3")->base() + 0x40000;
1079510795
1079610796   for (rpos = 0; rpos < rom_size/2; rpos++) {
1079710797      buf[rpos+0x40000] = rom[rpos*2];
r21033r21034
1081910819
1082010820DRIVER_INIT_MEMBER(seta_state,kiwame)
1082110821{
10822   UINT16 *RAM = (UINT16 *) machine().root_device().memregion("maincpu")->base();
10822   UINT16 *RAM = (UINT16 *) memregion("maincpu")->base();
1082310823
1082410824   /* WARNING: This game writes to the interrupt vector
1082510825      table. Lev 1 routine address is stored at $100 */
r21033r21034
1084110841   UINT8 temp[16];
1084210842   int i,j;
1084310843
10844   src = machine().root_device().memregion("maincpu")->base();
10845   len = machine().root_device().memregion("maincpu")->bytes();
10844   src = memregion("maincpu")->base();
10845   len = memregion("maincpu")->bytes();
1084610846   for (i = 0;i < len;i += 16)
1084710847   {
1084810848      memcpy(temp,&src[i],16);
trunk/src/mame/drivers/midas.c
r21033r21034
870870
871871DRIVER_INIT_MEMBER(midas_state,livequiz)
872872{
873   UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
873   UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
874874
875875   // PROTECTION CHECKS
876876   rom[0x13345a/2] =   0x4e75;
trunk/src/mame/drivers/arcadecl.c
r21033r21034
387387
388388DRIVER_INIT_MEMBER(arcadecl_state,sparkz)
389389{
390   memset(machine().root_device().memregion("gfx1")->base(), 0, machine().root_device().memregion("gfx1")->bytes());
390   memset(memregion("gfx1")->base(), 0, memregion("gfx1")->bytes());
391391}
392392
393393
trunk/src/mame/drivers/astrafr.c
r21033r21034
21142114
21152115DRIVER_INIT_MEMBER(astrafr_state,astradec)
21162116{
2117   astra_addresslines( (UINT16*)machine().root_device().memregion( "maincpu" )->base(), machine().root_device().memregion( "maincpu" )->bytes(), 0 );
2117   astra_addresslines( (UINT16*)memregion( "maincpu" )->base(), memregion( "maincpu" )->bytes(), 0 );
21182118}
21192119
21202120
21212121
21222122DRIVER_INIT_MEMBER(astrafr_state,astradec_dual)
21232123{
2124   astra_addresslines( (UINT16*)machine().root_device().memregion( "maincpu" )->base(), machine().root_device().memregion( "maincpu" )->bytes(), 0 );
2125   astra_addresslines( (UINT16*)machine().root_device().memregion( "slavecpu" )->base(), machine().root_device().memregion( "slavecpu" )->bytes(), 0 );
2124   astra_addresslines( (UINT16*)memregion( "maincpu" )->base(), memregion( "maincpu" )->bytes(), 0 );
2125   astra_addresslines( (UINT16*)memregion( "slavecpu" )->base(), memregion( "slavecpu" )->bytes(), 0 );
21262126}
21272127
21282128DRIVER_INIT_MEMBER(astrafr_state,astradec_sml)
21292129{
2130   astra_addresslines( (UINT16*)machine().root_device().memregion( "maincpu" )->base(), machine().root_device().memregion( "maincpu" )->bytes(), 1 );
2130   astra_addresslines( (UINT16*)memregion( "maincpu" )->base(), memregion( "maincpu" )->bytes(), 1 );
21312131}
21322132
21332133DRIVER_INIT_MEMBER(astrafr_state,astradec_sml_dual)
21342134{
2135   astra_addresslines( (UINT16*)machine().root_device().memregion( "maincpu" )->base(), machine().root_device().memregion( "maincpu" )->bytes(), 1 );
2136   astra_addresslines( (UINT16*)machine().root_device().memregion( "slavecpu" )->base(), machine().root_device().memregion( "slavecpu" )->bytes(), 1 );
2135   astra_addresslines( (UINT16*)memregion( "maincpu" )->base(), memregion( "maincpu" )->bytes(), 1 );
2136   astra_addresslines( (UINT16*)memregion( "slavecpu" )->base(), memregion( "slavecpu" )->bytes(), 1 );
21372137}
21382138
21392139// Single games?
trunk/src/mame/drivers/system1.c
r21033r21034
397397void system1_state::bank44_custom_w(UINT8 data, UINT8 prevdata)
398398{
399399   /* bank bits are bits 6 and 2 */
400   machine().root_device().membank("bank1")->set_entry(((data & 0x40) >> 5) | ((data & 0x04) >> 2));
400   membank("bank1")->set_entry(((data & 0x40) >> 5) | ((data & 0x04) >> 2));
401401}
402402
403403
404404void system1_state::bank0c_custom_w(UINT8 data, UINT8 prevdata)
405405{
406406   /* bank bits are bits 3 and 2 */
407   machine().root_device().membank("bank1")->set_entry((data & 0x0c) >> 2);
407   membank("bank1")->set_entry((data & 0x0c) >> 2);
408408}
409409
410410
r21033r21034
47354735
47364736   /* additionally to the usual protection, all the program ROMs have data lines */
47374737   /* D0 and D1 swapped. */
4738   rom = machine().root_device().memregion("maincpu")->base();
4738   rom = memregion("maincpu")->base();
47394739   for (A = 0;A < 0xc000;A++)
47404740      rom[A] = (rom[A] & 0xfc) | ((rom[A] & 1) << 1) | ((rom[A] & 2) >> 1);
47414741
47424742   /* the tile gfx ROMs are mangled as well: */
4743   rom = machine().root_device().memregion("tiles")->base();
4743   rom = memregion("tiles")->base();
47444744
47454745   /* the first ROM has data lines D0 and D6 swapped. */
47464746   for (A = 0x0000;A < 0x4000;A++)
r21033r21034
48004800   /* Patch to get PRG ROMS ('T', 'R' and 'S) status as "GOOD" in the "test mode" */
48014801   /* not really needed */
48024802
4803//  UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4803//  UINT8 *ROM = memregion("maincpu")->base();
48044804
48054805//  ROM[0x3296] = 0x18;     // 'jr' instead of 'jr z' - 'T' (PRG Main ROM)
48064806//  ROM[0x32be] = 0x18;     // 'jr' instead of 'jr z' - 'R' (Banked ROM 1)
r21033r21034
48134813
48144814   /* Patch to get sound in later levels(the program enters into a tight loop)*/
48154815   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
4816   UINT8 *ROM2 = machine().root_device().memregion("soundcpu")->base();
4816   UINT8 *ROM2 = memregion("soundcpu")->base();
48174817
48184818   ROM2[0x02f9] = 0x28;//'jr z' instead of 'jr'
48194819
r21033r21034
48294829DRIVER_INIT_MEMBER(system1_state,bootleg)
48304830{
48314831   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4832   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x10000);
4832   space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x10000);
48334833   DRIVER_INIT_CALL(bank00);
48344834}
48354835
r21033r21034
48374837DRIVER_INIT_MEMBER(system1_state,bootsys2)
48384838{
48394839   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4840   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x20000);
4841   machine().root_device().membank("bank1")->configure_decrypted_entries(0, 4, machine().root_device().memregion("maincpu")->base() + 0x30000, 0x4000);
4840   space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x20000);
4841   membank("bank1")->configure_decrypted_entries(0, 4, memregion("maincpu")->base() + 0x30000, 0x4000);
48424842   DRIVER_INIT_CALL(bank0c);
48434843}
48444844
48454845DRIVER_INIT_MEMBER(system1_state,choplift)
48464846{
4847   UINT8 *mcurom = machine().root_device().memregion("mcu")->base();
4847   UINT8 *mcurom = memregion("mcu")->base();
48484848
48494849   /* the ROM dump we have is bad; the following patches make it work */
48504850   mcurom[0x100] = 0x55;       /* D5 in current dump */
trunk/src/mame/drivers/gunpey.c
r21033r21034
338338void gunpey_state::palette_init()
339339{
340340   int i,r,g,b,val;
341   UINT8 *blit_rom = machine().root_device().memregion("blit_data")->base();
341   UINT8 *blit_rom = memregion("blit_data")->base();
342342
343343   for (i = 0; i < 512; i+=2)
344344   {
r21033r21034
413413
414414DRIVER_INIT_MEMBER(gunpey_state,gunpey)
415415{
416   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
416   UINT8 *rom = memregion("maincpu")->base();
417417
418418   /* patch SLOOOOW cycle checks ... */
419419   rom[0x848b5] = 0x7e;
trunk/src/mame/drivers/calomega.c
r21033r21034
661661WRITE_LINE_MEMBER(calomega_state::tx_rx_clk)
662662{
663663   int trx_clk;
664   UINT8 dsw2 = machine().root_device().ioport("SW2")->read();
664   UINT8 dsw2 = ioport("SW2")->read();
665665   trx_clk = UART_CLOCK * dsw2 / 128;
666666   acia6850_device *acia = machine().device<acia6850_device>("acia6850_0");
667667   acia->set_rx_clock(trx_clk);
r21033r21034
679679      case 0x80: return ioport("IN0-3")->read();
680680   }
681681
682   return machine().root_device().ioport("FRQ")->read();   /* bit7 used for 50/60 Hz selector */
682   return ioport("FRQ")->read();   /* bit7 used for 50/60 Hz selector */
683683}
684684
685685WRITE8_MEMBER(calomega_state::s903_mux_w)
r21033r21034
699699      case 0x08: return ioport("IN0-3")->read();
700700   }
701701
702   return machine().root_device().ioport("FRQ")->read();   /* bit6 used for 50/60 Hz selector */
702   return ioport("FRQ")->read();   /* bit6 used for 50/60 Hz selector */
703703}
704704
705705WRITE8_MEMBER(calomega_state::s905_mux_w)
r21033r21034
714714{
715715   /* Valid input port. Each polled value is stored at $0538 */
716716   logerror("PIA0: Port A in\n");
717   return machine().root_device().ioport("IN0")->read();
717   return ioport("IN0")->read();
718718}
719719
720720READ8_MEMBER(calomega_state::pia0_bin_r)
r21033r21034
39093909{
39103910   /* background color is adjusted through RGB pots */
39113911   int x;
3912   UINT8 *BPR = machine().root_device().memregion( "proms" )->base();
3912   UINT8 *BPR = memregion( "proms" )->base();
39133913
39143914   for (x = 0x0000; x < 0x0400; x++)
39153915   {
r21033r21034
39213921DRIVER_INIT_MEMBER(calomega_state,elgrande)
39223922{
39233923   int x;
3924   UINT8 *BPR = machine().root_device().memregion( "proms" )->base();
3924   UINT8 *BPR = memregion( "proms" )->base();
39253925
39263926   /* background color is adjusted through RGB pots */
39273927   for (x = 0x0000; x < 0x0400; x++)
r21033r21034
39353935{
39363936   /* background color is adjusted through RGB pots */
39373937   int x;
3938   UINT8 *BPR = machine().root_device().memregion( "proms" )->base();
3938   UINT8 *BPR = memregion( "proms" )->base();
39393939
39403940   for (x = 0x0000; x < 0x0400; x++)
39413941   {
r21033r21034
39483948{
39493949   /* background color is adjusted through RGB pots */
39503950   int x;
3951   UINT8 *BPR = machine().root_device().memregion( "proms" )->base();
3951   UINT8 *BPR = memregion( "proms" )->base();
39523952
39533953   for (x = 0x0000; x < 0x0400; x++)
39543954   {
r21033r21034
39603960      Start = $2042;  NMI = $26f8;
39613961      Also a fake vector at $3ff8-$3ff9. The code checks these values to continue.
39623962   */
3963   UINT8 *PRGROM = machine().root_device().memregion( "maincpu" )->base();
3963   UINT8 *PRGROM = memregion( "maincpu" )->base();
39643964
39653965   PRGROM[0x3ff8] = 0x8e; /* checked by code */
39663966   PRGROM[0x3ff9] = 0x97; /* checked by code */
trunk/src/mame/drivers/bfm_sc2.c
r21033r21034
407407   // init rom bank ////////////////////////////////////////////////////////
408408
409409   {
410      UINT8 *rom = machine().root_device().memregion("maincpu")->base();
410      UINT8 *rom = memregion("maincpu")->base();
411411
412412      membank("bank1")->configure_entries(0, 4, &rom[0x00000], 0x02000);
413413
r21033r21034
21922192{
21932193   // search for the project string to find the title (usually just at ff00)
21942194   char title_string[4][32] = { "PROJECT NUMBER", "PROJECT PR", "PROJECT ", "CASH ON THE NILE 2" };
2195   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
2196   int size = machine().root_device().memregion( "maincpu" )->bytes();
2195   UINT8 *src = memregion( "maincpu" )->base();
2196   int size = memregion( "maincpu" )->bytes();
21972197
21982198   for (int search=0;search<4;search++)
21992199   {
trunk/src/mame/drivers/namcofl.c
r21033r21034
187187      if (data == 0)  // RAM at 00000000, ROM at 10000000
188188      {
189189         membank("bank1")->set_base(m_workram );
190         membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() );
190         membank("bank2")->set_base(memregion("maincpu")->base() );
191191      }
192192      else        // ROM at 00000000, RAM at 10000000
193193      {
194         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() );
194         membank("bank1")->set_base(memregion("maincpu")->base() );
195195         membank("bank2")->set_base(m_workram );
196196      }
197197   }
trunk/src/mame/drivers/sub.c
r21033r21034
388388
389389void sub_state::palette_init()
390390{
391   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
391   const UINT8 *color_prom = memregion("proms")->base();
392392   int i;
393   UINT8* lookup = machine().root_device().memregion("proms2")->base();
393   UINT8* lookup = memregion("proms2")->base();
394394
395395   /* allocate the colortable */
396396   machine().colortable = colortable_alloc(machine(), 0x100);
trunk/src/mame/drivers/bfm_ad5.c
r21033r21034
2020DRIVER_INIT_MEMBER(adder5_state,ad5)
2121{
2222   // sc5 roms always start with SC5
23   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
23   UINT8 *src = memregion( "maincpu" )->base();
2424//  printf("%02x %02x %02x %02x\n", src[0], src[1], src[2], src[3]);
2525   if (((src[0] == 0x20) && (src[2] == 0x43)) || ((src[1] == 0x35) && (src[3] == 0x53)))
2626   {
trunk/src/mame/drivers/1942.c
r21033r21034
497497
498498DRIVER_INIT_MEMBER(_1942_state,1942)
499499{
500   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
501   machine().root_device().membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x4000);
500   UINT8 *ROM = memregion("maincpu")->base();
501   membank("bank1")->configure_entries(0, 3, &ROM[0x10000], 0x4000);
502502}
503503
504504
trunk/src/mame/drivers/pcat_nit.c
r21033r21034
236236
237237   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, streetg2_set_keyb_int);
238238
239   machine().root_device().membank("rombank")->configure_entries(0, 0x80, machine().root_device().memregion("game_prg")->base(), 0x8000 );
240   machine().root_device().membank("rombank")->set_entry(0);
239   membank("rombank")->configure_entries(0, 0x80, memregion("game_prg")->base(), 0x8000 );
240   membank("rombank")->set_entry(0);
241241
242242   //microtouch_init(machine(), pcat_nit_microtouch_tx_callback, NULL);
243243}
trunk/src/mame/drivers/lazercmd.c
r21033r21034
771771DRIVER_INIT_MEMBER(lazercmd_state,lazercmd)
772772{
773773   int i, y;
774   UINT8 *gfx = machine().root_device().memregion("gfx1")->base();
774   UINT8 *gfx = memregion("gfx1")->base();
775775
776776/******************************************************************
777777 * To show the maze bit #6 and #7 of the video ram are used.
r21033r21034
800800DRIVER_INIT_MEMBER(lazercmd_state,medlanes)
801801{
802802   int i, y;
803   UINT8 *gfx = machine().root_device().memregion("gfx1")->base();
803   UINT8 *gfx = memregion("gfx1")->base();
804804
805805/******************************************************************
806806 * To show the maze bit #6 and #7 of the video ram are used.
r21033r21034
829829DRIVER_INIT_MEMBER(lazercmd_state,bbonk)
830830{
831831   int i, y;
832   UINT8 *gfx = machine().root_device().memregion("gfx1")->base();
832   UINT8 *gfx = memregion("gfx1")->base();
833833
834834/******************************************************************
835835 * To show the maze bit #6 and #7 of the video ram are used.
trunk/src/mame/drivers/qix.c
r21033r21034
12771277    ********************************/
12781278
12791279   i = 0;
1280   //patch = machine().root_device().memregion("user1")->base();
1281   rom = machine().root_device().memregion("maincpu")->base();
1280   //patch = memregion("user1")->base();
1281   rom = memregion("maincpu")->base();
12821282   decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
12831283
12841284   mainspace.set_decrypted_region(0xa000, 0xffff, decrypted);
r21033r21034
12901290   }
12911291
12921292   i = 0;
1293   //patch = machine().root_device().memregion("user2")->base();
1294   rom = machine().root_device().memregion("videocpu")->base();
1293   //patch = memregion("user2")->base();
1294   rom = memregion("videocpu")->base();
12951295   decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
12961296
12971297   videospace.set_decrypted_region(0xa000, 0xffff, decrypted);
r21033r21034
13071307DRIVER_INIT_MEMBER(qix_state,zookeep)
13081308{
13091309   /* configure the banking */
1310   machine().root_device().membank("bank1")->configure_entry(0, machine().root_device().memregion("videocpu")->base() + 0xa000);
1311   machine().root_device().membank("bank1")->configure_entry(1, machine().root_device().memregion("videocpu")->base() + 0x10000);
1312   machine().root_device().membank("bank1")->set_entry(0);
1310   membank("bank1")->configure_entry(0, memregion("videocpu")->base() + 0xa000);
1311   membank("bank1")->configure_entry(1, memregion("videocpu")->base() + 0x10000);
1312   membank("bank1")->set_entry(0);
13131313}
13141314
13151315
trunk/src/mame/drivers/itech32.c
r21033r21034
631631
632632WRITE8_MEMBER(itech32_state::sound_bank_w)
633633{
634   membank("bank1")->set_base(&machine().root_device().memregion("soundcpu")->base()[0x10000 + data * 0x4000]);
634   membank("bank1")->set_base(&memregion("soundcpu")->base()[0x10000 + data * 0x4000]);
635635}
636636
637637
trunk/src/mame/drivers/cham24.c
r21033r21034
207207   UINT8* src = memregion("user1")->base();
208208
209209   // switch PPU VROM bank
210   membank("bank1")->set_base(machine().root_device().memregion("gfx1")->base() + (0x2000 * gfx_bank));
210   membank("bank1")->set_base(memregion("gfx1")->base() + (0x2000 * gfx_bank));
211211
212212   // set gfx mirroring
213213   cham24_set_mirroring(gfx_mirroring != 0 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
trunk/src/mame/drivers/segag80r.c
r21033r21034
14201420
14211421   /* expand the background ROMs; A11/A12 of each ROM is independently controlled via */
14221422   /* banking */
1423   dest = machine().root_device().memregion(region)->base();
1423   dest = memregion(region)->base();
14241424   temp = auto_alloc_array(machine(), UINT8, 0x4000);
14251425   memcpy(temp, dest, 0x4000);
14261426
trunk/src/mame/drivers/grchamp.c
r21033r21034
7979void grchamp_state::machine_reset()
8080{
8181   /* if the coin system is 1 way, lock Coin B (Page 40) */
82   coin_lockout_w(machine(), 1, (machine().root_device().ioport("DSWB")->read() & 0x10) ? 1 : 0);
82   coin_lockout_w(machine(), 1, (ioport("DSWB")->read() & 0x10) ? 1 : 0);
8383}
8484
8585
trunk/src/mame/drivers/aleck64.c
r21033r21034
834834
835835DRIVER_INIT_MEMBER(n64_state,aleck64)
836836{
837   UINT8 *rom = machine().root_device().memregion("user2")->base();
837   UINT8 *rom = memregion("user2")->base();
838838
839839   rom[0x67c] = 0;
840840   rom[0x67d] = 0;
trunk/src/mame/drivers/xain.c
r21033r21034
567567
568568void xain_state::machine_start()
569569{
570   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x4000, 0xc000);
571   machine().root_device().membank("bank2")->configure_entries(0, 2, machine().root_device().memregion("sub")->base()  + 0x4000, 0xc000);
572   machine().root_device().membank("bank1")->set_entry(0);
573   machine().root_device().membank("bank2")->set_entry(0);
570   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x4000, 0xc000);
571   membank("bank2")->configure_entries(0, 2, memregion("sub")->base()  + 0x4000, 0xc000);
572   membank("bank1")->set_entry(0);
573   membank("bank2")->set_entry(0);
574574}
575575
576576static MACHINE_CONFIG_START( xsleena, xain_state )
trunk/src/mame/drivers/rpunch.c
r21033r21034
131131
132132void rpunch_state::machine_reset()
133133{
134   UINT8 *snd = machine().root_device().memregion("upd")->base();
134   UINT8 *snd = memregion("upd")->base();
135135   memcpy(snd, snd + 0x20000, 0x20000);
136136}
137137
trunk/src/mame/drivers/bingoc.c
r21033r21034
102102   ---- --x- sound rom banking
103103   ---- ---x start-stop sample
104104   */
105   UINT8 *upd = machine().root_device().memregion("upd")->base();
105   UINT8 *upd = memregion("upd")->base();
106106   memcpy(&upd[0x00000], &upd[0x20000 + (((data & 2)>>1) * 0x20000)], 0x20000);
107107   upd7759_start_w(device, data & 1);
108108//  printf("%02x\n",data);
trunk/src/mame/drivers/toki.c
r21033r21034
7272{
7373   device_t *device = machine().device("msm");
7474   int bankaddress;
75   UINT8 *RAM = machine().root_device().memregion("audiocpu")->base();
75   UINT8 *RAM = memregion("audiocpu")->base();
7676
7777
7878   /* the code writes either 2 or 3 in the bottom two bits */
7979   bankaddress = 0x10000 + (data & 0x01) * 0x4000;
80   machine().root_device().membank("bank1")->set_base(&RAM[bankaddress]);
80   membank("bank1")->set_base(&RAM[bankaddress]);
8181
8282   msm5205_reset_w(device,data & 0x08);
8383}
r21033r21034
787787
788788DRIVER_INIT_MEMBER(toki_state,toki)
789789{
790   UINT8 *ROM = machine().root_device().memregion("oki")->base();
790   UINT8 *ROM = memregion("oki")->base();
791791   UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x20000);
792792   int i;
793793
r21033r21034
810810   UINT8 *rom;
811811
812812   /* merge background tile graphics together */
813   len = machine().root_device().memregion("gfx3")->bytes();
814   rom = machine().root_device().memregion("gfx3")->base();
813   len = memregion("gfx3")->bytes();
814   rom = memregion("gfx3")->base();
815815   for (offs = 0; offs < len; offs += 0x20000)
816816   {
817817      UINT8 *base = &rom[offs];
r21033r21034
824824         memcpy (&base[0x18000 + i * 0x800], &temp[0x1800 + i * 0x2000], 0x800);
825825      }
826826   }
827   len = machine().root_device().memregion("gfx4")->bytes();
828   rom = machine().root_device().memregion("gfx4")->base();
827   len = memregion("gfx4")->bytes();
828   rom = memregion("gfx4")->base();
829829   for (offs = 0; offs < len; offs += 0x20000)
830830   {
831831      UINT8 *base = &rom[offs];
r21033r21034
847847   /* Program ROMs are bitswapped */
848848   {
849849      int i;
850      UINT16 *prgrom = (UINT16*)machine().root_device().memregion("maincpu")->base();
850      UINT16 *prgrom = (UINT16*)memregion("maincpu")->base();
851851
852852      for (i = 0; i < 0x60000/2; i++)
853853      {
r21033r21034
862862   {
863863      address_space &space = machine().device("audiocpu")->memory().space(AS_PROGRAM);
864864      UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x20000);
865      UINT8 *rom = machine().root_device().memregion("audiocpu")->base();
865      UINT8 *rom = memregion("audiocpu")->base();
866866      int i;
867867
868868      memcpy(decrypt,rom,0x20000);
r21033r21034
877877   }
878878
879879   {
880      UINT8 *ROM = machine().root_device().memregion("oki")->base();
880      UINT8 *ROM = memregion("oki")->base();
881881      UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x20000);
882882      int i;
883883
trunk/src/mame/drivers/magtouch.c
r21033r21034
205205
206206   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, magtouch_set_keyb_int);
207207
208   machine().root_device().membank("rombank")->configure_entries(0, 0x80, machine().root_device().memregion("game_prg")->base(), 0x8000 );
209   machine().root_device().membank("rombank")->set_entry(0);
208   membank("rombank")->configure_entries(0, 0x80, memregion("game_prg")->base(), 0x8000 );
209   membank("rombank")->set_entry(0);
210210
211211//  microtouch_init(machine(), magtouch_microtouch_tx_callback, NULL);
212212}
trunk/src/mame/drivers/magictg.c
r21033r21034
232232
233233void magictg_state::machine_reset()
234234{
235   UINT8 *adsp_boot = (UINT8*)machine().root_device().memregion("adsp")->base();
235   UINT8 *adsp_boot = (UINT8*)memregion("adsp")->base();
236236
237237   zr36120_reset();
238238
r21033r21034
751751
752752         if (data > 0)
753753         {
754            UINT8* adsp_rom = (UINT8*)space.machine().root_device().memregion("adsp")->base();
754            UINT8* adsp_rom = (UINT8*)memregion("adsp")->base();
755755
756756            UINT32 page = (m_adsp_regs.bdma_control >> 8) & 0xff;
757757            UINT32 dir = (m_adsp_regs.bdma_control >> 2) & 1;
trunk/src/mame/drivers/blitz68k.c
r21033r21034
17691769//  for(i=0;i<8;i+=2)
17701770//      m_nvram[((0x8a0)+i)/2] = 0;
17711771   /*finally, read the inputs*/
1772   m_nvram[0x89e/2] = machine().root_device().ioport("MENU")->read() & 0xffff;
1773   m_nvram[0x8a0/2] = machine().root_device().ioport("STAT")->read() & 0xffff;
1774   m_nvram[0x8a2/2] = machine().root_device().ioport("BET_DEAL")->read() & 0xffff;
1775   m_nvram[0x8a4/2] = machine().root_device().ioport("TAKE_DOUBLE")->read() & 0xffff;
1776   m_nvram[0x8a6/2] = machine().root_device().ioport("SMALL_BIG")->read() & 0xffff;
1777   m_nvram[0x8a8/2] = machine().root_device().ioport("CANCEL_HOLD1")->read() & 0xffff;
1778   m_nvram[0x8aa/2] = machine().root_device().ioport("HOLD2_HOLD3")->read() & 0xffff;
1779   m_nvram[0x8ac/2] = machine().root_device().ioport("HOLD4_HOLD5")->read() & 0xffff;
1772   m_nvram[0x89e/2] = ioport("MENU")->read() & 0xffff;
1773   m_nvram[0x8a0/2] = ioport("STAT")->read() & 0xffff;
1774   m_nvram[0x8a2/2] = ioport("BET_DEAL")->read() & 0xffff;
1775   m_nvram[0x8a4/2] = ioport("TAKE_DOUBLE")->read() & 0xffff;
1776   m_nvram[0x8a6/2] = ioport("SMALL_BIG")->read() & 0xffff;
1777   m_nvram[0x8a8/2] = ioport("CANCEL_HOLD1")->read() & 0xffff;
1778   m_nvram[0x8aa/2] = ioport("HOLD2_HOLD3")->read() & 0xffff;
1779   m_nvram[0x8ac/2] = ioport("HOLD4_HOLD5")->read() & 0xffff;
17801780}
17811781
17821782
r21033r21034
27842784
27852785DRIVER_INIT_MEMBER(blitz68k_state,bankrob)
27862786{
2787   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2787   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
27882788
27892789   // WRONG C8 #1
27902790   ROM[0xb5e0/2] = 0x6028;
r21033r21034
27992799
28002800DRIVER_INIT_MEMBER(blitz68k_state,bankroba)
28012801{
2802   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2802   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28032803
28042804   // WRONG C8 #1
28052805   ROM[0x11e4e/2] = 0x6028;
r21033r21034
28142814
28152815DRIVER_INIT_MEMBER(blitz68k_state,cj3play)
28162816{
2817   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2817   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28182818
28192819   // WRONG C8 #1
28202820   ROM[0x7064/2] = 0x6028;
r21033r21034
28302830
28312831DRIVER_INIT_MEMBER(blitz68k_state,cjffruit)
28322832{
2833   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2833   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28342834
28352835   // WRONG C8 #1
28362836   ROM[0xf564/2] = 0x6028;
r21033r21034
28412841
28422842DRIVER_INIT_MEMBER(blitz68k_state,deucesw2)
28432843{
2844   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2844   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28452845
28462846   // WRONG C8 #1
28472847   ROM[0x8fe4/2] = 0x6020;
r21033r21034
28522852
28532853DRIVER_INIT_MEMBER(blitz68k_state,dualgame)
28542854{
2855   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2855   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28562856
28572857   // WRONG C8 #1
28582858   ROM[0xa518/2] = 0x6024;
r21033r21034
28632863
28642864DRIVER_INIT_MEMBER(blitz68k_state,hermit)
28652865{
2866   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2866   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28672867
28682868   // WRONG C8 #1
28692869   ROM[0xdeba/2] = 0x602e;
r21033r21034
28802880
28812881DRIVER_INIT_MEMBER(blitz68k_state,maxidbl)
28822882{
2883   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2883   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28842884
28852885   // WRONG C8 #1
28862886   ROM[0xb384/2] = 0x6036;
r21033r21034
28912891
28922892DRIVER_INIT_MEMBER(blitz68k_state,megadblj)
28932893{
2894   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2894   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
28952895
28962896   // WRONG C8 #1
28972897   ROM[0xe21c/2] = 0x6040;
r21033r21034
29022902
29032903DRIVER_INIT_MEMBER(blitz68k_state,megadble)
29042904{
2905   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2905   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
29062906
29072907   // WRONG C8 #1
29082908   ROM[0xcfc2/2] = 0x4e71;
trunk/src/mame/drivers/dacholer.c
r21033r21034
604604/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
605605void dacholer_state::palette_init()
606606{
607   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
607   const UINT8 *color_prom = memregion("proms")->base();
608608   static const int resistances_rg[3] = { 1000, 470, 220 };
609609   static const int resistances_b [2] = { 470, 220 };
610610   double weights_rg[3], weights_b[2];
trunk/src/mame/drivers/enigma2.c
r21033r21034
707707DRIVER_INIT_MEMBER(enigma2_state,enigma2)
708708{
709709   offs_t i;
710   UINT8 *rom = machine().root_device().memregion("audiocpu")->base();
710   UINT8 *rom = memregion("audiocpu")->base();
711711
712712   for(i = 0; i < 0x2000; i++)
713713   {
trunk/src/mame/drivers/mpu4hw.c
r21033r21034
25832583   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
25842584   DRIVER_INIT_CALL(m4default);
25852585
2586   int size = machine().root_device().memregion( "maincpu" )->bytes();
2586   int size = memregion( "maincpu" )->bytes();
25872587   if (size<=0x10000)
25882588   {
25892589      printf("extended banking selected on set <=0x10000 in size, ignoring");
r21033r21034
26432643DRIVER_INIT_MEMBER(mpu4_state,crystal)
26442644{
26452645   DRIVER_INIT_CALL(m_frkstn);
2646   descramble_crystal(machine().root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
2646   descramble_crystal(memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
26472647}
26482648
26492649DRIVER_INIT_MEMBER(mpu4_state,crystali)
26502650{
26512651   DRIVER_INIT_CALL(m_frkstn);
2652   descramble_crystal(machine().root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0xff); // invert after decrypt?!
2652   descramble_crystal(memregion( "maincpu" )->base(), 0x0000, 0x10000, 0xff); // invert after decrypt?!
26532653}
26542654
26552655/* generate a 50 Hz signal (based on an RC time) */
trunk/src/mame/drivers/gticlub.c
r21033r21034
12641264   init_hangplt_common();
12651265
12661266   // workaround for lock/unlock errors
1267   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
1267   UINT32 *rom = (UINT32*)memregion("user1")->base();
12681268   rom[(0x153ac^4) / 4] = 0x4e800020;
12691269   rom[(0x15428^4) / 4] = 0x4e800020;
12701270}
r21033r21034
12741274   init_hangplt_common();
12751275
12761276   // workaround for lock/unlock errors
1277   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
1277   UINT32 *rom = (UINT32*)memregion("user1")->base();
12781278   rom[(0x153d0^4) / 4] = 0x4e800020;
12791279   rom[(0x15428^4) / 4] = 0x4e800020;
12801280}
trunk/src/mame/drivers/wgp.c
r21033r21034
12481248#if 0
12491249   /* Patch for coding error that causes corrupt data in
12501250      sprite tilemapping area from $4083c0-847f */
1251   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
1251   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
12521252   ROM[0x25dc / 2] = 0x0602;   // faulty value is 0x0206
12531253#endif
12541254}
r21033r21034
12561256DRIVER_INIT_MEMBER(wgp_state,wgp2)
12571257{
12581258   /* Code patches to prevent failure in memory checks */
1259   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("sub")->base();
1259   UINT16 *ROM = (UINT16 *)memregion("sub")->base();
12601260   ROM[0x8008 / 2] = 0x0;
12611261   ROM[0x8010 / 2] = 0x0;
12621262}
trunk/src/mame/drivers/skullxbo.c
r21033r21034
607607DRIVER_INIT_MEMBER(skullxbo_state,skullxbo)
608608{
609609   atarijsa_init(machine(), "FF5802", 0x0080);
610   memset(machine().root_device().memregion("gfx1")->base() + 0x170000, 0, 0x20000);
610   memset(memregion("gfx1")->base() + 0x170000, 0, 0x20000);
611611}
612612
613613
trunk/src/mame/drivers/marinedt.c
r21033r21034
449449
450450void marinedt_state::palette_init()
451451{
452   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
452   const UINT8 *color_prom = memregion("proms")->base();
453453   int i,r,b,g;
454454
455455   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/drivers/sprint4.c
r21033r21034
5656   };
5757   UINT8 lever[4] =
5858   {
59      machine().root_device().ioport("LEVER1")->read(),
60      machine().root_device().ioport("LEVER2")->read(),
61      machine().root_device().ioport("LEVER3")->read(),
62      machine().root_device().ioport("LEVER4")->read()
59      ioport("LEVER1")->read(),
60      ioport("LEVER2")->read(),
61      ioport("LEVER3")->read(),
62      ioport("LEVER4")->read()
6363   };
6464
6565   int i;
r21033r21034
9898
9999   /* NMI and watchdog are disabled during service mode */
100100
101   machine().watchdog_enable(machine().root_device().ioport("IN0")->read() & 0x40);
101   machine().watchdog_enable(ioport("IN0")->read() & 0x40);
102102
103   if (machine().root_device().ioport("IN0")->read() & 0x40)
103   if (ioport("IN0")->read() & 0x40)
104104      machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
105105
106106   machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(sprint4_state::nmi_callback),this), scanline);
trunk/src/mame/drivers/appoooh.c
r21033r21034
609609DRIVER_INIT_MEMBER(appoooh_state,robowresb)
610610{
611611   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
612   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x1c000);
612   space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x1c000);
613613}
614614
615615
trunk/src/mame/drivers/jack.c
r21033r21034
14441444{
14451445   int A;
14461446   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
1447   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1447   UINT8 *rom = memregion("maincpu")->base();
14481448   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x4000);
14491449   int data;
14501450
trunk/src/mame/drivers/mlanding.c
r21033r21034
277277WRITE8_MEMBER(mlanding_state::sound_bankswitch_w)
278278{
279279   data=0;
280   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("audiocpu")->base() + ((data) & 0x03) * 0x4000 + 0x10000 );
280   membank("bank1")->set_base(memregion("audiocpu")->base() + ((data) & 0x03) * 0x4000 + 0x10000 );
281281}
282282
283283static void ml_msm5205_vck(device_t *device)
r21033r21034
838838
839839DRIVER_INIT_MEMBER(mlanding_state,mlanding)
840840{
841//  UINT8 *rom = machine().root_device().memregion("sub")->base();
841//  UINT8 *rom = memregion("sub")->base();
842842//  rom[0x88b]=0x4e;
843843//  rom[0x88a]=0x71;
844844}
trunk/src/mame/drivers/tankbust.c
r21033r21034
9696   case 7: /* 0xe007 bankswitch */
9797      /* bank 1 at 0x6000-9fff = from 0x10000 when bit0=0 else from 0x14000 */
9898      /* bank 2 at 0xa000-bfff = from 0x18000 when bit0=0 else from 0x1a000 */
99      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000 + ((data&1) * 0x4000) );
100      membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000 + ((data&1) * 0x2000) ); /* verified (the game will reset after the "game over" otherwise) */
99      membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000 + ((data&1) * 0x4000) );
100      membank("bank2")->set_base(memregion("maincpu")->base() + 0x18000 + ((data&1) * 0x2000) ); /* verified (the game will reset after the "game over" otherwise) */
101101      break;
102102   }
103103}
r21033r21034
112112
113113void tankbust_state::palette_init()
114114{
115   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
115   const UINT8 *color_prom = memregion("proms")->base();
116116   int i;
117117
118118   for (i = 0; i < 128; i++)
trunk/src/mame/drivers/neoprint.c
r21033r21034
278278
279279READ16_MEMBER(neoprint_state::rom_window_r)
280280{
281   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
281   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
282282
283283   return rom[offset | 0x80000/2 | m_bank_val*0x40000/2];
284284}
r21033r21034
594594/* FIXME: get rid of these two, probably something to do with irq3 and camera / printer devices */
595595DRIVER_INIT_MEMBER(neoprint_state,npcartv1)
596596{
597   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
597   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
598598
599599   ROM[0x1260/2] = 0x4e71;
600600
r21033r21034
604604
605605DRIVER_INIT_MEMBER(neoprint_state,98best44)
606606{
607   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
607   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
608608
609609   ROM[0x1312/2] = 0x4e71;
610610}
611611
612612DRIVER_INIT_MEMBER(neoprint_state,nprsp)
613613{
614   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
614   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
615615
616616   ROM[0x13a4/2] = 0x4e71;
617617   ROM[0x13bc/2] = 0x4e71;
trunk/src/mame/drivers/mpu4sw.c
r21033r21034
3131{
3232   // many original barcrest / bwb sets have identification info around here
3333   // this helps with sorting
34   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
35   int size = machine().root_device().memregion( "maincpu" )->bytes();
34   UINT8 *src = memregion( "maincpu" )->base();
35   int size = memregion( "maincpu" )->bytes();
3636
3737   for (int j=0;j<size;j+=0x10000)
3838   {
trunk/src/mame/drivers/pgm2.c
r21033r21034
390390
391391DRIVER_INIT_MEMBER(pgm2_state,orleg2)
392392{
393   UINT16 *src = (UINT16 *)machine().root_device().memregion("spritesa")->base();
393   UINT16 *src = (UINT16 *)memregion("spritesa")->base();
394394
395395   iga_u12_decode(src, 0x2000000, 0x4761);
396396   iga_u16_decode(src, 0x2000000, 0xc79f);
r21033r21034
398398
399399DRIVER_INIT_MEMBER(pgm2_state,kov2nl)
400400{
401   UINT16 *src = (UINT16 *)machine().root_device().memregion("spritesa")->base();
401   UINT16 *src = (UINT16 *)memregion("spritesa")->base();
402402
403403   iga_u12_decode(src, 0x2000000, 0xa193);
404404   iga_u16_decode(src, 0x2000000, 0xb780);
r21033r21034
406406
407407DRIVER_INIT_MEMBER(pgm2_state,ddpdojh)
408408{
409   UINT16 *src = (UINT16 *)machine().root_device().memregion("spritesa")->base();
409   UINT16 *src = (UINT16 *)memregion("spritesa")->base();
410410
411411   iga_u12_decode(src, 0x800000, 0x1e96);
412412   iga_u16_decode(src, 0x800000, 0x869c);
r21033r21034
416416
417417DRIVER_INIT_MEMBER(pgm2_state,kov3)
418418{
419   UINT16 *src = (UINT16 *)machine().root_device().memregion("spritesa")->base();
419   UINT16 *src = (UINT16 *)memregion("spritesa")->base();
420420
421421   iga_u12_decode(src, 0x2000000, 0x956d);
422422   iga_u16_decode(src, 0x2000000, 0x3d17);
trunk/src/mame/drivers/tetrisp2.c
r21033r21034
186186      {
187187         m_bank_lo = data & 0x03;
188188
189         memcpy(machine().root_device().memregion("oki")->base(), rom + (m_bank_lo * 0x80000), 0x20000);
189         memcpy(memregion("oki")->base(), rom + (m_bank_lo * 0x80000), 0x20000);
190190
191191//          logerror("PC:%06X sound bank_lo = %02X\n",space.device().safe_pc(),m_bank_lo);
192192      }
r21033r21034
194194      {
195195         m_bank_hi = data & 0x03;
196196
197         memcpy(machine().root_device().memregion("oki")->base() + 0x20000, rom + (m_bank_lo * 0x80000) + (m_bank_hi * 0x20000), 0x20000);
197         memcpy(memregion("oki")->base() + 0x20000, rom + (m_bank_lo * 0x80000) + (m_bank_hi * 0x20000), 0x20000);
198198
199199//          logerror("PC:%06X sound bank_hi = %02X\n",space.device().safe_pc(),m_bank_hi);
200200      }
trunk/src/mame/drivers/bfm_sc4.c
r21033r21034
224224
225225DRIVER_INIT_MEMBER(sc4_state,sc4)
226226{
227   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
227   UINT8 *src = memregion( "maincpu" )->base();
228228   // SC4 identification sequence 0x80 0x00 0xf0 0x7d
229229   if (((src[0] == 0x80) && (src[2] == 0xf0)) || ((src[1] == 0x00) && (src[3] == 0x7d)))
230230   {
trunk/src/mame/drivers/polepos.c
r21033r21034
340340}
341341
342342
343CUSTOM_INPUT_MEMBER(polepos_state::high_port_r){ return field.machine().root_device().ioport((const char *)param)->read() >> 4; }
344CUSTOM_INPUT_MEMBER(polepos_state::low_port_r){ return field.machine().root_device().ioport((const char *)param)->read() & 0x0f; }
343CUSTOM_INPUT_MEMBER(polepos_state::high_port_r){ return ioport((const char *)param)->read() >> 4; }
344CUSTOM_INPUT_MEMBER(polepos_state::low_port_r){ return ioport((const char *)param)->read() & 0x0f; }
345345CUSTOM_INPUT_MEMBER(polepos_state::auto_start_r)
346346{
347347   return m_auto_start_mask;
r21033r21034
378378
379379READ8_MEMBER(polepos_state::namco_52xx_rom_r)
380380{
381   UINT32 length = machine().root_device().memregion("52xx")->bytes();
381   UINT32 length = memregion("52xx")->bytes();
382382logerror("ROM @ %04X\n", offset);
383   return (offset < length) ? machine().root_device().memregion("52xx")->base()[offset] : 0xff;
383   return (offset < length) ? memregion("52xx")->base()[offset] : 0xff;
384384}
385385
386386READ8_MEMBER(polepos_state::namco_52xx_si_r)
trunk/src/mame/drivers/namcos22.c
r21033r21034
53675367
53685368DRIVER_INIT_MEMBER(namcos22_state,propcycl)
53695369{
5370   UINT32 *pROM = (UINT32 *)machine().root_device().memregion("maincpu")->base();
5370   UINT32 *pROM = (UINT32 *)memregion("maincpu")->base();
53715371
53725372   /* patch out strange routine (uninitialized-eprom related?) */
53735373   pROM[0x1992C/4] = 0x4E754E75;
trunk/src/mame/drivers/galgame.c
r21033r21034
396396DRIVER_INIT_MEMBER(galaxygame_state,galaxygame)
397397{
398398   address_space &main = machine().device("maincpu")->memory().space(AS_PROGRAM);
399   UINT8 *code = machine().root_device().memregion("code")->base();
399   UINT8 *code = memregion("code")->base();
400400
401401   int filepos = 0, linepos, linelen;
402402   UINT8 line[256];
trunk/src/mame/drivers/calorie.c
r21033r21034
552552DRIVER_INIT_MEMBER(calorie_state,calorieb)
553553{
554554   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
555   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x10000);
555   space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x10000);
556556}
557557
558558
trunk/src/mame/drivers/rastersp.c
r21033r21034
155155
156156   m_palette = auto_alloc_array(machine(), UINT16, 0x8000);
157157
158   machine().root_device().membank("bank1")->set_base(m_dram);
159   machine().root_device().membank("bank2")->set_base(&m_dram[0x10000/4]);
160   machine().root_device().membank("bank3")->set_base(&m_dram[0x300000/4]);
158   membank("bank1")->set_base(m_dram);
159   membank("bank2")->set_base(&m_dram[0x10000/4]);
160   membank("bank3")->set_base(&m_dram[0x300000/4]);
161161
162162#if USE_SPEEDUP_HACK
163163   machine().device("dsp")->memory().space(AS_PROGRAM).install_read_handler(0x809923, 0x809923, read32_delegate(FUNC(rastersp_state::dsp_speedup_r), this));
trunk/src/mame/drivers/39in1.c
r21033r21034
15451545
15461546void _39in1_state::machine_start()
15471547{
1548   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1548   UINT8 *ROM = memregion("maincpu")->base();
15491549   int i;
15501550
15511551   for (i = 0; i < 0x80000; i += 2)
r21033r21034
15581558
15591559MACHINE_START_MEMBER(_39in1_state,60in1)
15601560{
1561   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1561   UINT8 *ROM = memregion("maincpu")->base();
15621562   int i;
15631563
15641564   for (i = 0; i < 0x80000; i += 2)
trunk/src/mame/drivers/stv.c
r21033r21034
10621062   if (image.software_entry() == NULL)
10631063      return IMAGE_INIT_FAIL;
10641064
1065   UINT8 *ROM = image.device().machine().root_device().memregion(this_cart->region)->base();
1065   UINT8 *ROM = image.device().memregion(this_cart->region)->base();
10661066   UINT32 length = image.get_software_region_length("rom");
10671067
10681068   memcpy(ROM, image.get_software_region("rom"), length);
r21033r21034
15651565
15661566DRIVER_INIT_MEMBER(saturn_state,sanjeon)
15671567{
1568   UINT8 *src    = machine().root_device().memregion       ( "game0" )->base();
1568   UINT8 *src    = memregion       ( "game0" )->base();
15691569   int x;
15701570
15711571   for (x=0;x<0x3000000;x++)
trunk/src/mame/drivers/clayshoo.c
r21033r21034
6464   UINT8 ret = 0;
6565
6666   /* read fake port and remap the buttons to 2 bits */
67   UINT8   raw = machine().root_device().ioport("FAKE")->read();
67   UINT8   raw = ioport("FAKE")->read();
6868
6969   if (raw & (1 << (bit + 1)))
7070      ret = 0x03;     /* expert */
trunk/src/mame/drivers/firebeat.c
r21033r21034
837837
838838   if (ACCESSING_BITS_24_31)
839839   {
840      r |= (machine().root_device().ioport("IN0")->read() & 0xff) << 24;
840      r |= (ioport("IN0")->read() & 0xff) << 24;
841841   }
842842   if (ACCESSING_BITS_8_15)
843843   {
844      r |= (machine().root_device().ioport("IN1")->read() & 0xff) << 8;
844      r |= (ioport("IN1")->read() & 0xff) << 8;
845845   }
846846   if (ACCESSING_BITS_0_7)
847847   {
848      r |= (machine().root_device().ioport("IN2")->read() & 0xff);
848      r |= (ioport("IN2")->read() & 0xff);
849849   }
850850
851851   return r;
r21033r21034
855855{
856856   if (offset == 0)
857857   {
858      return machine().root_device().ioport("SENSOR1")->read() | 0x01000100;
858      return ioport("SENSOR1")->read() | 0x01000100;
859859   }
860860   else
861861   {
862      return machine().root_device().ioport("SENSOR2")->read() | 0x01000100;
862      return ioport("SENSOR2")->read() | 0x01000100;
863863   }
864864}
865865
r21033r21034
14631463{
14641464   if (offset == 0)        // Keyboard Wheel (P1)
14651465   {
1466      return space.machine().root_device().ioport("WHEEL_P1")->read() << 24;
1466      return ioport("WHEEL_P1")->read() << 24;
14671467   }
14681468   else if (offset == 2)   // Keyboard Wheel (P2)
14691469   {
1470      return space.machine().root_device().ioport("WHEEL_P2")->read() << 24;
1470      return ioport("WHEEL_P2")->read() << 24;
14711471   }
14721472
14731473   return 0;
r21033r21034
15561556
15571557   for (keyboard=0; keyboard < 2; keyboard++)
15581558   {
1559      UINT32 kbstate = machine().root_device().ioport(keynames[keyboard])->read();
1559      UINT32 kbstate = ioport(keynames[keyboard])->read();
15601560      int uart_channel = kb_uart_channel[keyboard];
15611561
15621562      if (kbstate != m_keyboard_state[keyboard])
trunk/src/mame/drivers/bigevglf.c
r21033r21034
608608
609609DRIVER_INIT_MEMBER(bigevglf_state,bigevglf)
610610{
611   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
612   machine().root_device().membank("bank1")->configure_entries(0, 0xff, &ROM[0x10000], 0x800);
611   UINT8 *ROM = memregion("maincpu")->base();
612   membank("bank1")->configure_entries(0, 0xff, &ROM[0x10000], 0x800);
613613}
614614
615615GAME( 1986, bigevglf,  0,        bigevglf, bigevglf, bigevglf_state, bigevglf, ROT270, "Taito America Corporation", "Big Event Golf (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/bmcbowl.c
r21033r21034
241241
242242READ8_MEMBER(bmcbowl_state::via_b_in)
243243{
244   return machine().root_device().ioport("IN3")->read();
244   return ioport("IN3")->read();
245245}
246246
247247
trunk/src/mame/drivers/bfm_sc5sw.c
r21033r21034
1261812618DRIVER_INIT_MEMBER(bfm_sc5_state,sc5)
1261912619{
1262012620   // sc5 roms always start with SC5
12621   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
12621   UINT8 *src = memregion( "maincpu" )->base();
1262212622//  printf("%02x %02x %02x %02x\n", src[0], src[1], src[2], src[3]);
1262312623   if (((src[0] == 0x20) && (src[2] == 0x43)) || ((src[1] == 0x35) && (src[3] == 0x53)))
1262412624   {
trunk/src/mame/drivers/cd32.c
r21033r21034
867867
868868   /* set up memory */
869869   m_bank1->configure_entry(0, m_chip_ram);
870   m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base());
870   m_bank1->configure_entry(1, memregion("user1")->base());
871871
872872   /* input hack */
873873   m_input_hack = NULL;
r21033r21034
14781478
14791479   /* set up memory */
14801480   m_bank1->configure_entry(0, m_chip_ram);
1481   m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base());
1481   m_bank1->configure_entry(1, memregion("user1")->base());
14821482
14831483   /* input hack */
14841484   m_input_hack = NULL;
trunk/src/mame/drivers/mouser.c
r21033r21034
285285
286286   offs_t i;
287287   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
288   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
288   UINT8 *rom = memregion("maincpu")->base();
289289   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
290   UINT8 *table = machine().root_device().memregion("user1")->base();
290   UINT8 *table = memregion("user1")->base();
291291
292292   space.set_decrypted_region(0x0000, 0x5fff, decrypted);
293293
trunk/src/mame/drivers/lordgun.c
r21033r21034
10601060DRIVER_INIT_MEMBER(lordgun_state,lordgun)
10611061{
10621062   int i;
1063   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
1063   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
10641064   int rom_size = 0x100000;
10651065
10661066   for(i = 0; i < rom_size/2; i++)
trunk/src/mame/drivers/ojankohs.c
r21033r21034
806806
807807MACHINE_START_MEMBER(ojankohs_state,ojankohs)
808808{
809   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
809   UINT8 *ROM = memregion("maincpu")->base();
810810
811   machine().root_device().membank("bank1")->configure_entries(0, 0x40, &ROM[0x10000], 0x4000);
811   membank("bank1")->configure_entries(0, 0x40, &ROM[0x10000], 0x4000);
812812
813813   MACHINE_START_CALL_MEMBER(common);
814814}
815815
816816MACHINE_START_MEMBER(ojankohs_state,ojankoy)
817817{
818   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
818   UINT8 *ROM = memregion("maincpu")->base();
819819
820   machine().root_device().membank("bank1")->configure_entries(0, 0x20, &ROM[0x10000], 0x4000);
820   membank("bank1")->configure_entries(0, 0x20, &ROM[0x10000], 0x4000);
821821
822822   MACHINE_START_CALL_MEMBER(common);
823823}
824824
825825MACHINE_START_MEMBER(ojankohs_state,ojankoc)
826826{
827   UINT8 *ROM = machine().root_device().memregion("user1")->base();
827   UINT8 *ROM = memregion("user1")->base();
828828
829   machine().root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x0000], 0x8000);
829   membank("bank1")->configure_entries(0, 0x10, &ROM[0x0000], 0x8000);
830830
831831   MACHINE_START_CALL_MEMBER(common);
832832}
trunk/src/mame/drivers/vega.c
r21033r21034
788788
789789READ8_MEMBER(vega_state::randomizer )
790790{
791   return (machine().root_device().ioport("IN1")->read()&7)|(machine().rand()&(~7));
791   return (ioport("IN1")->read()&7)|(machine().rand()&(~7));
792792}
793793
794794
r21033r21034
900900
901901DRIVER_INIT_MEMBER(vega_state, vega)
902902{
903   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
904   machine().root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x1000], 0x800);
903   UINT8 *ROM = memregion("maincpu")->base();
904   membank("bank1")->configure_entries(0, 2, &ROM[0x1000], 0x800);
905905}
906906
907907GAME( 1982, vega,   0, vega, vega, vega_state, vega, ROT270, "Olympia", "Vega", 0 )
trunk/src/mame/drivers/raiden2.c
r21033r21034
697697
698698//  case 0x6ca:
699699//      logerror("select bank %d %04x\n", (data >> 15) & 1, data);
700//      space.machine().root_device().membank("bank1")->set_entry((data >> 15) & 1);
700//      space.membank("bank1")->set_entry((data >> 15) & 1);
701701
702702
703703void raiden2_state::combine32(UINT32 *val, int offset, UINT16 data, UINT16 mem_mask)
r21033r21034
928928
929929      /* probably bit 3 is from 6c9 */
930930      /* TODO: this doesn't work! */
931      space.machine().root_device().membank("mainbank")->set_entry(8 | (cop_bank & 0x7000) >> 12);
931      membank("mainbank")->set_entry(8 | (cop_bank & 0x7000) >> 12);
932932   }
933933}
934934
r21033r21034
12271227{
12281228   if(ACCESSING_BITS_8_15) {
12291229      logerror("select bank %d %04x\n", (data >> 15) & 1, data);
1230      space.machine().root_device().membank("mainbank")->set_entry(!((data >> 15) & 1));
1230      membank("mainbank")->set_entry(!((data >> 15) & 1));
12311231      prg_bank = ((data >> 15) & 1);
12321232   }
12331233}
r21033r21034
31003100
31013101DRIVER_INIT_MEMBER(raiden2_state,raiden2)
31023102{
3103   machine().root_device().membank("mainbank")->configure_entries(0, 2, machine().root_device().memregion("mainprg")->base(), 0x20000);
3103   membank("mainbank")->configure_entries(0, 2, memregion("mainprg")->base(), 0x20000);
31043104   raiden2_decrypt_sprites(machine());
31053105}
31063106
31073107DRIVER_INIT_MEMBER(raiden2_state,raidendx)
31083108{
3109   machine().root_device().membank("mainbank")->configure_entries(0, 0x10, machine().root_device().memregion("mainprg")->base(), 0x20000);
3109   membank("mainbank")->configure_entries(0, 0x10, memregion("mainprg")->base(), 0x20000);
31103110   raiden2_decrypt_sprites(machine());
31113111}
31123112
31133113DRIVER_INIT_MEMBER(raiden2_state,xsedae)
31143114{
31153115   /* doesn't have banking */
3116   //machine().root_device().membank("mainbank")->configure_entries(0, 2, machine().root_device().memregion("mainprg")->base(), 0x20000);
3116   //membank("mainbank")->configure_entries(0, 2, memregion("mainprg")->base(), 0x20000);
31173117}
31183118
31193119DRIVER_INIT_MEMBER(raiden2_state,zeroteam)
31203120{
3121   machine().root_device().membank("mainbank")->configure_entries(0, 2, machine().root_device().memregion("mainprg")->base(), 0x20000);
3121   membank("mainbank")->configure_entries(0, 2, memregion("mainprg")->base(), 0x20000);
31223122   zeroteam_decrypt_sprites(machine());
31233123}
31243124
trunk/src/mame/drivers/gaiden.c
r21033r21034
15091509void gaiden_state::descramble_drgnbowl_gfx()
15101510{
15111511   int i;
1512   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1513   size_t size = machine().root_device().memregion("maincpu")->bytes();
1512   UINT8 *ROM = memregion("maincpu")->base();
1513   size_t size = memregion("maincpu")->bytes();
15141514   UINT8 *buffer = auto_alloc_array(machine(), UINT8, size);
15151515
15161516   memcpy(buffer, ROM, size);
r21033r21034
15261526
15271527   auto_free(machine(), buffer);
15281528
1529   ROM = machine().root_device().memregion("gfx2")->base();
1530   size = machine().root_device().memregion("gfx2")->bytes();
1529   ROM = memregion("gfx2")->base();
1530   size = memregion("gfx2")->bytes();
15311531   buffer = auto_alloc_array(machine(), UINT8, size);
15321532
15331533   memcpy(buffer,ROM,size);
r21033r21034
15951595DRIVER_INIT_MEMBER(gaiden_state,mastninj)
15961596{
15971597   // rearrange the graphic roms into a format that MAME can decode
1598   descramble_mastninj_gfx(machine().root_device().memregion("gfx2")->base());
1599   descramble_mastninj_gfx(machine().root_device().memregion("gfx3")->base());
1598   descramble_mastninj_gfx(memregion("gfx2")->base());
1599   descramble_mastninj_gfx(memregion("gfx3")->base());
16001600   DRIVER_INIT_CALL(shadoww);
16011601}
16021602
trunk/src/mame/drivers/spdodgeb.c
r21033r21034
132132   {
133133      int curr[2];
134134
135      curr[p] = machine().root_device().ioport(p ? "P2" : "P1")->read() & 0x30;
135      curr[p] = ioport(p ? "P2" : "P1")->read() & 0x30;
136136
137137      if (m_jumped[p]) buttons[p] = 0; /* jump only momentarily flips the buttons */
138138      else buttons[p] = curr[p];
r21033r21034
143143      m_prev[p] = curr[p];
144144   }
145145
146   m_inputs[0] = machine().root_device().ioport("P1")->read() & 0xcf;
147   m_inputs[1] = machine().root_device().ioport("P2")->read() & 0x0f;
146   m_inputs[0] = ioport("P1")->read() & 0xcf;
147   m_inputs[1] = ioport("P2")->read() & 0x0f;
148148   m_inputs[2] = m_running[0] | buttons[0];
149149   m_inputs[3] = m_running[1] | buttons[1];
150150}
trunk/src/mame/drivers/astrof.c
r21033r21034
231231void astrof_state::tomahawk_get_pens( pen_t *pens )
232232{
233233   offs_t i;
234   UINT8 *prom = machine().root_device().memregion("proms")->base();
235   UINT8 config = machine().root_device().ioport("FAKE")->read_safe(0x00);
234   UINT8 *prom = memregion("proms")->base();
235   UINT8 config = ioport("FAKE")->read_safe(0x00);
236236
237237   for (i = 0; i < TOMAHAWK_NUM_PENS; i++)
238238   {
r21033r21034
12581258DRIVER_INIT_MEMBER(astrof_state,abattle)
12591259{
12601260   /* use the protection PROM to decrypt the ROMs */
1261   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1262   UINT8 *prom = machine().root_device().memregion("user1")->base();
1261   UINT8 *rom = memregion("maincpu")->base();
1262   UINT8 *prom = memregion("user1")->base();
12631263   int i;
12641264
12651265   for(i = 0xd000; i < 0x10000; i++)
r21033r21034
12731273
12741274DRIVER_INIT_MEMBER(astrof_state,afire)
12751275{
1276   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1276   UINT8 *rom = memregion("maincpu")->base();
12771277   int i;
12781278
12791279   for(i = 0xd000; i < 0x10000; i++)
r21033r21034
12871287
12881288DRIVER_INIT_MEMBER(astrof_state,sstarbtl)
12891289{
1290   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1290   UINT8 *rom = memregion("maincpu")->base();
12911291   int i;
12921292
12931293   for(i = 0xd000; i < 0x10000; i++)
trunk/src/mame/drivers/ddealer.c
r21033r21034
312312{
313313   /*coin/credit simulation*/
314314   /*$fe002 is used,might be for multiple coins for one credit settings.*/
315   m_coin_input = (~(machine().root_device().ioport("IN0")->read()));
315   m_coin_input = (~(ioport("IN0")->read()));
316316
317317   if (m_coin_input & 0x01)//coin 1
318318   {
trunk/src/mame/drivers/plygonet.c
r21033r21034
111111   }
112112   else
113113   {
114      UINT8 lowInputBits = machine().root_device().ioport("IN1")->read();
115      UINT8 highInputBits = machine().root_device().ioport("IN0")->read();
114      UINT8 lowInputBits = ioport("IN1")->read();
115      UINT8 highInputBits = ioport("IN0")->read();
116116      return ((highInputBits << 24) | (lowInputBits << 16));
117117   }
118118
r21033r21034
136136READ32_MEMBER(polygonet_state::ttl_rom_r)
137137{
138138   UINT32 *ROM;
139   ROM = (UINT32 *)machine().root_device().memregion("gfx1")->base();
139   ROM = (UINT32 *)memregion("gfx1")->base();
140140
141141   return ROM[offset];
142142}
r21033r21034
145145READ32_MEMBER(polygonet_state::psac_rom_r)
146146{
147147   UINT32 *ROM;
148   ROM = (UINT32 *)machine().root_device().memregion("gfx2")->base();
148   ROM = (UINT32 *)memregion("gfx2")->base();
149149
150150   return ROM[offset];
151151}
trunk/src/mame/drivers/berzerk.c
r21033r21034
432432   int color;
433433   double color_weights[2];
434434
435   if (machine().root_device().ioport(MONITOR_TYPE_PORT_TAG)->read() == 0)
435   if (ioport(MONITOR_TYPE_PORT_TAG)->read() == 0)
436436      compute_resistor_weights(0, 0xff, -1.0,
437437                           2, resistances_wg, color_weights, 0, 270,
438438                           2, resistances_wg, color_weights, 0, 270,
trunk/src/mame/drivers/xtom3d.c
r21033r21034
661661
662662void xtom3d_state::machine_reset()
663663{
664   machine().root_device().membank("bios_bank")->set_base(machine().root_device().memregion("bios")->base() + 0x10000);
665   machine().root_device().membank("bios_ext1")->set_base(machine().root_device().memregion("bios")->base() + 0);
666   machine().root_device().membank("bios_ext2")->set_base(machine().root_device().memregion("bios")->base() + 0x4000);
667   machine().root_device().membank("bios_ext3")->set_base(machine().root_device().memregion("bios")->base() + 0x8000);
668   machine().root_device().membank("bios_ext4")->set_base(machine().root_device().memregion("bios")->base() + 0xc000);
669   machine().root_device().membank("video_bank1")->set_base(machine().root_device().memregion("video_bios")->base() + 0);
670   machine().root_device().membank("video_bank2")->set_base(machine().root_device().memregion("video_bios")->base() + 0x4000);
664   membank("bios_bank")->set_base(memregion("bios")->base() + 0x10000);
665   membank("bios_ext1")->set_base(memregion("bios")->base() + 0);
666   membank("bios_ext2")->set_base(memregion("bios")->base() + 0x4000);
667   membank("bios_ext3")->set_base(memregion("bios")->base() + 0x8000);
668   membank("bios_ext4")->set_base(memregion("bios")->base() + 0xc000);
669   membank("video_bank1")->set_base(memregion("video_bios")->base() + 0);
670   membank("video_bank2")->set_base(memregion("video_bios")->base() + 0x4000);
671671}
672672
673673static MACHINE_CONFIG_START( xtom3d, xtom3d_state )
trunk/src/mame/drivers/blitz.c
r21033r21034
369369
370370void blitz_state::palette_init()
371371{
372   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
372   const UINT8 *color_prom = memregion("proms")->base();
373373/*
374374    This hardware has a feature called BLUE KILLER.
375375    Using the original intensity line, the PCB has a bridge
trunk/src/mame/drivers/koikoi.c
r21033r21034
9494
9595void koikoi_state::palette_init()
9696{
97   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
97   const UINT8 *color_prom = memregion("proms")->base();
9898   int i;
9999
100100   /* allocate the colortable */
trunk/src/mame/drivers/cobra.c
r21033r21034
33353335
33363336   // rom hacks for sub board...
33373337   {
3338      UINT32 *rom = (UINT32*)machine().root_device().memregion("user2")->base();
3338      UINT32 *rom = (UINT32*)memregion("user2")->base();
33393339
33403340      rom[0x62094 / 4] = 0x60000000;          // skip hardcheck()...
33413341   }
r21033r21034
33463346      int i;
33473347      UINT32 sum = 0;
33483348
3349      UINT32 *rom = (UINT32*)machine().root_device().memregion("user3")->base();
3349      UINT32 *rom = (UINT32*)memregion("user3")->base();
33503350
33513351      rom[(0x022d4^4) / 4] = 0x60000000;      // skip init_raster() for now ...
33523352
r21033r21034
33673367
33683368   // fill in M48T58 data for now...
33693369   {
3370      UINT8 *rom = (UINT8*)machine().root_device().memregion("m48t58")->base();
3370      UINT8 *rom = (UINT8*)memregion("m48t58")->base();
33713371      rom[0x00] = 0x47;       // G
33723372      rom[0x01] = 0x4e;       // N        // N = 2-player, Q = 1-player?
33733373      rom[0x02] = 0x36;       // 6
r21033r21034
34173417
34183418   // rom hacks for sub board...
34193419   {
3420      UINT32 *rom = (UINT32*)machine().root_device().memregion("user2")->base();
3420      UINT32 *rom = (UINT32*)memregion("user2")->base();
34213421
34223422      rom[0x62094 / 4] = 0x60000000;          // skip hardcheck()...
34233423      rom[0x62ddc / 4] = 0x60000000;          // skip lanc_hardcheck()
r21033r21034
34433443      int i;
34443444      UINT32 sum = 0;
34453445
3446      UINT32 *rom = (UINT32*)machine().root_device().memregion("user3")->base();
3446      UINT32 *rom = (UINT32*)memregion("user3")->base();
34473447
34483448      rom[(0x02448^4) / 4] = 0x60000000;      // skip init_raster() for now ...
34493449
r21033r21034
34653465
34663466   // fill in M48T58 data for now...
34673467   {
3468      UINT8 *rom = (UINT8*)machine().root_device().memregion("m48t58")->base();
3468      UINT8 *rom = (UINT8*)memregion("m48t58")->base();
34693469      rom[0x00] = 0x47;       // G
34703470      rom[0x01] = 0x59;       // Y
34713471      rom[0x02] = 0x36;       // 6
trunk/src/mame/drivers/spiders.c
r21033r21034
275275   /* update the different PIA pins from the input ports */
276276
277277   /* CA1 - copy of PA1 (COIN1) */
278   pia1->ca1_w(machine().root_device().ioport("IN0")->read() & 0x02);
278   pia1->ca1_w(ioport("IN0")->read() & 0x02);
279279
280280   /* CA2 - copy of PA0 (SERVICE1) */
281   pia1->ca2_w(machine().root_device().ioport("IN0")->read() & 0x01);
281   pia1->ca2_w(ioport("IN0")->read() & 0x01);
282282
283283   /* CB1 - (crosshatch) */
284   pia1->cb1_w(machine().root_device().ioport("XHATCH")->read());
284   pia1->cb1_w(ioport("XHATCH")->read());
285285
286286   /* CB2 - NOT CONNECTED */
287287}
trunk/src/mame/drivers/subsino.c
r21033r21034
575575
576576PALETTE_INIT_MEMBER(subsino_state,subsino_2proms)
577577{
578   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
578   const UINT8 *color_prom = memregion("proms")->base();
579579   int i,r,g,b,val;
580580   int bit0,bit1,bit2;
581581
r21033r21034
602602
603603PALETTE_INIT_MEMBER(subsino_state,subsino_3proms)
604604{
605   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
605   const UINT8 *color_prom = memregion("proms")->base();
606606   int i,r,g,b,val;
607607   int bit0,bit1,bit2;
608608
r21033r21034
35293529
35303530DRIVER_INIT_MEMBER(subsino_state,smoto16)
35313531{
3532   UINT8 *rom = machine().root_device().memregion( "maincpu" )->base();
3532   UINT8 *rom = memregion( "maincpu" )->base();
35333533   rom[0x12d0] = 0x20; // "ERROR 951010"
35343534}
35353535
r21033r21034
37503750
37513751DRIVER_INIT_MEMBER(subsino_state,smoto20)
37523752{
3753   UINT8 *rom = machine().root_device().memregion( "maincpu" )->base();
3753   UINT8 *rom = memregion( "maincpu" )->base();
37543754   rom[0x12e1] = 0x20; // "ERROR 951010"
37553755}
37563756
37573757DRIVER_INIT_MEMBER(subsino_state,tisub)
37583758{
3759   UINT8 *rom = machine().root_device().memregion( "maincpu" )->base();
3759   UINT8 *rom = memregion( "maincpu" )->base();
37603760
37613761   DRIVER_INIT_CALL(victor5);
37623762
r21033r21034
37713771
37723772DRIVER_INIT_MEMBER(subsino_state,tisuba)
37733773{
3774   UINT8 *rom = machine().root_device().memregion( "maincpu" )->base();
3774   UINT8 *rom = memregion( "maincpu" )->base();
37753775
37763776   DRIVER_INIT_CALL(victor5);
37773777
trunk/src/mame/drivers/supercrd.c
r21033r21034
190190
191191PALETTE_INIT_MEMBER(supercrd_state, supercrd)
192192{
193   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
193   const UINT8 *color_prom = memregion("proms")->base();
194194   int i;
195195   static const int resistances_rb[3] = { 1000, 470, 220 };
196196   static const int resistances_g [2] = { 470, 220 };
trunk/src/mame/drivers/astrocde.c
r21033r21034
430430
431431   /* set the main banking */
432432   prog_space.install_read_bank(0x4000, 0xbfff, "bank1");
433   membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + 0x8000 * bank);
433   membank("bank1")->set_base(memregion("user1")->base() + 0x8000 * bank);
434434
435435   /* bank 0 reads video RAM in the 4000-7FFF range */
436436   if (bank == 0)
r21033r21034
446446      if (bank < 0x28)
447447      {
448448         prog_space.install_read_bank(0x4000, 0x7fff, "bank2");
449         membank("bank2")->set_base(machine().root_device().memregion("user2")->base() + 0x4000 * bank);
449         membank("bank2")->set_base(memregion("user2")->base() + 0x4000 * bank);
450450      }
451451      else
452452         prog_space.unmap_read(0x4000, 0x7fff);
trunk/src/mame/drivers/m63.c
r21033r21034
192192
193193PALETTE_INIT_MEMBER(m63_state,m63)
194194{
195   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
195   const UINT8 *color_prom = memregion("proms")->base();
196196   int i;
197197
198198   for (i = 0; i < 256; i++)
trunk/src/mame/drivers/hitme.c
r21033r21034
6868UINT32 hitme_state::screen_update_hitme(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
6969{
7070   /* the card width resistor comes from an input port, scaled to the range 0-25 kOhms */
71   double width_resist = machine().root_device().ioport("WIDTH")->read() * 25000 / 100;
71   double width_resist = ioport("WIDTH")->read() * 25000 / 100;
7272   /* this triggers a oneshot for the following length of time */
7373   double width_duration = 0.45 * 1000e-12 * width_resist;
7474   /* the dot clock runs at the standard horizontal frequency * 320+16 clocks per scanline */
r21033r21034
130130{
131131   static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
132132
133   UINT8 val = machine().root_device().ioport(portnames[port])->read();
133   UINT8 val = ioport(portnames[port])->read();
134134   if (machine().time() > m_timeout_time)
135135      val ^= 0x80;
136136   return val;
trunk/src/mame/drivers/bzone.c
r21033r21034
245245
246246INTERRUPT_GEN_MEMBER(bzone_state::bzone_interrupt)
247247{
248   if (machine().root_device().ioport("IN0")->read() & 0x10)
248   if (ioport("IN0")->read() & 0x10)
249249      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
250250}
251251
trunk/src/mame/drivers/istellar.c
r21033r21034
267267
268268void istellar_state::palette_init()
269269{
270   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
270   const UINT8 *color_prom = memregion("proms")->base();
271271   int i;
272272
273273   for (i = 0; i < machine().total_colors(); i++)
r21033r21034
406406
407407   #if 0
408408   {
409      UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
409      UINT8 *ROM = memregion("maincpu")->base();
410410
411411      ROM[0x4465] = 0x00;
412412      ROM[0x4466] = 0x00;
trunk/src/mame/drivers/tmaster.c
r21033r21034
16511651
16521652DRIVER_INIT_MEMBER(tmaster_state,tm4k)
16531653{
1654   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1654   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
16551655
16561656   // protection
16571657   ROM[0x834ce/2] = 0x4e75;
r21033r21034
16721672
16731673DRIVER_INIT_MEMBER(tmaster_state,tm4ka)
16741674{
1675   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1675   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
16761676
16771677   // protection
16781678   ROM[0x83476/2] = 0x4e75;
r21033r21034
16941694
16951695DRIVER_INIT_MEMBER(tmaster_state,tm4kca)
16961696{
1697   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1697   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
16981698
16991699   // protection
17001700   ROM[0x83470/2] = 0x4e75;
r21033r21034
17161716
17171717DRIVER_INIT_MEMBER(tmaster_state,tm4kb)
17181718{
1719   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1719   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
17201720
17211721   // protection
17221722   ROM[0x82b7a/2] = 0x4e75;
r21033r21034
17371737
17381738DRIVER_INIT_MEMBER(tmaster_state,tm5k)
17391739{
1740   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1740   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
17411741
17421742   // protection
17431743   ROM[0x96002/2] = 0x4e75;
r21033r21034
17601760
17611761DRIVER_INIT_MEMBER(tmaster_state,tm5kca)
17621762{
1763   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1763   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
17641764
17651765   // protection
17661766   ROM[0x95ffe/2] = 0x4e75;
r21033r21034
17721772
17731773DRIVER_INIT_MEMBER(tmaster_state,tm5ka)
17741774{
1775   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1775   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
17761776
17771777   // protection
17781778   ROM[0x96b30/2] = 0x4e75;
r21033r21034
17931793
17941794DRIVER_INIT_MEMBER(tmaster_state,tm7k)
17951795{
1796   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1796   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
17971797
17981798   // protection
17991799   ROM[0x81730/2] = 0x4e75;
r21033r21034
18161816
18171817DRIVER_INIT_MEMBER(tmaster_state,tm7ka)
18181818{
1819   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1819   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
18201820
18211821   // protection
18221822   ROM[0x81594/2] = 0x4e75;
r21033r21034
18391839
18401840DRIVER_INIT_MEMBER(tmaster_state,tm7keval)
18411841{
1842   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1842   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
18431843
18441844   // protection
18451845   ROM[0x8949e/2] = 0x4e75;
r21033r21034
18621862
18631863DRIVER_INIT_MEMBER(tmaster_state,tm8k)
18641864{
1865   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1865   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
18661866
18671867   // protection
18681868   ROM[0x78b70/2] = 0x4e75;
r21033r21034
19191919
19201920DRIVER_INIT_MEMBER(tmaster_state,galgame2)
19211921{
1922   UINT16 *ROM = (UINT16 *)machine().root_device().memregion( "maincpu" )->base();
1922   UINT16 *ROM = (UINT16 *)memregion( "maincpu" )->base();
19231923
19241924   // Patch BIOS to see the game code as first cartridge (until the PIC therein is emulated)
19251925   ROM[0x118da/2] = 0x4a06;
trunk/src/mame/drivers/model1.c
r21033r21034
686686   if(ACCESSING_BITS_0_7) {
687687      switch(data & 0xf) {
688688      case 0x1: // 100000-1fffff data roms banking
689         membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1000000 + 0x100000*((data >> 4) & 0xf));
689         membank("bank1")->set_base(memregion("maincpu")->base() + 0x1000000 + 0x100000*((data >> 4) & 0xf));
690690         logerror("BANK %x\n", 0x1000000 + 0x100000*((data >> 4) & 0xf));
691691         break;
692692      case 0x2: // 200000-2fffff data roms banking (unused, all known games have only one bank)
trunk/src/mame/drivers/sbowling.c
r21033r21034
338338
339339void sbowling_state::palette_init()
340340{
341   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
341   const UINT8 *color_prom = memregion("proms")->base();
342342   int i;
343343
344344   static const int resistances_rg[3] = { 470, 270, 100 };
trunk/src/mame/drivers/m72.c
r21033r21034
414414#if 0
415415int m72_state::find_sample(int num)
416416{
417   UINT8 *rom = machine().root_device().memregion("samples")->base();
418   int len = machine().root_device().memregion("samples")->bytes();
417   UINT8 *rom = memregion("samples")->base();
418   int len = memregion("samples")->bytes();
419419   int addr = 0;
420420
421421   while (num--)
trunk/src/mame/drivers/sprint8.c
r21033r21034
3030
3131   for (i = 0; i < 8; i++)
3232   {
33      UINT8 val = machine().root_device().ioport(dialnames[i])->read() >> 4;
33      UINT8 val = ioport(dialnames[i])->read() >> 4;
3434
3535      signed char delta = (val - m_dial[i]) & 15;
3636
trunk/src/mame/drivers/kingobox.c
r21033r21034
778778DRIVER_INIT_MEMBER(kingofb_state,ringking3)
779779{
780780   int i;
781   UINT8 *RAM = machine().root_device().memregion("proms")->base();
781   UINT8 *RAM = memregion("proms")->base();
782782
783783   /* expand the first color PROM to look like the kingofb ones... */
784784   for (i = 0; i < 0x100; i++)
r21033r21034
788788DRIVER_INIT_MEMBER(kingofb_state,ringkingw)
789789{
790790   int i,j,k;
791   UINT8 *PROMS = machine().root_device().memregion("proms")->base();
792   UINT8 *USER1 = machine().root_device().memregion("user1")->base();
791   UINT8 *PROMS = memregion("proms")->base();
792   UINT8 *USER1 = memregion("user1")->base();
793793
794794   /* change the PROMs encode in a simple format to use kingofb decode */
795795   for(i = 0, j = 0; j < 0x40; i++, j++)
trunk/src/mame/drivers/bfmsys85.c
r21033r21034
681681{
682682   // search for the project string to find the title (usually just at ff00)
683683   char title_string[7][32] = { "PROJECT NUMBER", "PROJECT PR", "PROJECT ", "CASH ON THE NILE 2", "PR6121", "CHINA TOWN\x0d\x0a", "PROJECTNUMBER" };
684   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
685   int size = machine().root_device().memregion( "maincpu" )->bytes();
684   UINT8 *src = memregion( "maincpu" )->base();
685   int size = memregion( "maincpu" )->bytes();
686686
687687   for (int search=0;search<7;search++)
688688   {
trunk/src/mame/drivers/itech8.c
r21033r21034
703703{
704704   /* bit 0x20 on address 7 controls CPU banking */
705705   if (offset / 2 == 7)
706      membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x4000 + 0xc000 * ((data >> 5) & 1)]);
706      membank("bank1")->set_base(&memregion("maincpu")->base()[0x4000 + 0xc000 * ((data >> 5) & 1)]);
707707
708708   /* the rest is handled by the video hardware */
709709   itech8_blitter_w(space, offset, data);
r21033r21034
713713WRITE8_MEMBER(itech8_state::rimrockn_bank_w)
714714{
715715   /* banking is controlled here instead of by the blitter output */
716   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x4000 + 0xc000 * (data & 3)]);
716   membank("bank1")->set_base(&memregion("maincpu")->base()[0x4000 + 0xc000 * (data & 3)]);
717717}
718718
719719
trunk/src/mame/drivers/ettrivia.c
r21033r21034
219219
220220void ettrivia_state::palette_init()
221221{
222   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
222   const UINT8 *color_prom = memregion("proms")->base();
223223   static const int resistances[2] = { 270, 130 };
224224   double weights[2];
225225   int i;
r21033r21034
292292
293293INTERRUPT_GEN_MEMBER(ettrivia_state::ettrivia_interrupt)
294294{
295   if( machine().root_device().ioport("COIN")->read() & 0x01 )
295   if( ioport("COIN")->read() & 0x01 )
296296      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
297297   else
298298      device.execute().set_input_line(0, HOLD_LINE);
trunk/src/mame/drivers/sauro.c
r21033r21034
555555   /* This game doesn't like all memory to be initialized to zero, it won't
556556      initialize the high scores */
557557
558   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
558   UINT8 *RAM = memregion("maincpu")->base();
559559
560560   memset(&RAM[0xe000], 0, 0x100);
561561   RAM[0xe000] = 1;
trunk/src/mame/drivers/supdrapo.c
r21033r21034
132132/*Maybe bit 2 & 3 of the second color prom are intensity bits? */
133133void supdrapo_state::palette_init()
134134{
135   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
135   const UINT8 *color_prom = memregion("proms")->base();
136136   int bit0, bit1, bit2 , r, g, b;
137137   int i;
138138
trunk/src/mame/drivers/quizo.c
r21033r21034
5454
5555void quizo_state::palette_init()
5656{
57   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
57   const UINT8 *color_prom = memregion("proms")->base();
5858   int i;
5959   for (i = 0;i < 16;i++)
6060   {
r21033r21034
131131      data=0;
132132   }
133133   m_port60=data;
134   membank("bank1")->set_base(&machine().root_device().memregion("user1")->base()[rombankLookup[data]*0x4000] );
134   membank("bank1")->set_base(&memregion("user1")->base()[rombankLookup[data]*0x4000] );
135135}
136136
137137static ADDRESS_MAP_START( memmap, AS_PROGRAM, 8, quizo_state )
trunk/src/mame/drivers/sfkick.c
r21033r21034
122122
123123      case 1: /* ext rom */
124124      {
125         UINT8 *mem = machine().root_device().memregion("extrom")->base();
125         UINT8 *mem = memregion("extrom")->base();
126126         membank("bank1")->set_base(mem+0x4000);
127127         membank("bank2")->set_base(mem+0x6000);
128128      }
r21033r21034
130130
131131      case 2: /* banked */
132132      {
133         UINT8 *mem = machine().root_device().memregion("banked")->base();
133         UINT8 *mem = memregion("banked")->base();
134134         membank("bank1")->set_base(mem+0x2000*m_bank[0]);
135135         membank("bank2")->set_base(mem+0x2000*m_bank[1]);
136136      }
r21033r21034
138138
139139      case 3: /* unknown */
140140      {
141         UINT8 *mem = machine().root_device().memregion("banked")->base();
141         UINT8 *mem = memregion("banked")->base();
142142         membank("bank1")->set_base(mem+0x18000);
143143         membank("bank2")->set_base(mem+0x18000);
144144      }
r21033r21034
150150   {
151151      case 0: /* bios - upper part */
152152      {
153         UINT8 *mem = machine().root_device().memregion("bios")->base();
153         UINT8 *mem = memregion("bios")->base();
154154         membank("bank3")->set_base(mem+0x4000);
155155         membank("bank4")->set_base(mem+0x6000);
156156      }
r21033r21034
159159      case 1:  /* unknown */
160160      case 3:
161161      {
162         UINT8 *mem = machine().root_device().memregion("banked")->base();
162         UINT8 *mem = memregion("banked")->base();
163163         membank("bank3")->set_base(mem+0x18000);
164164         membank("bank4")->set_base(mem+0x18000);
165165      }
r21033r21034
167167
168168      case 2: /* banked */
169169      {
170         UINT8 *mem = machine().root_device().memregion("banked")->base();
170         UINT8 *mem = memregion("banked")->base();
171171         membank("bank3")->set_base(mem+0x2000*m_bank[2]);
172172         membank("bank4")->set_base(mem+0x2000*m_bank[3]);
173173      }
r21033r21034
179179   {
180180      case 0: /* cartridge */
181181      {
182         UINT8 *mem = machine().root_device().memregion("cartridge")->base();
182         UINT8 *mem = memregion("cartridge")->base();
183183         membank("bank5")->set_base(mem+0x4000);
184184         membank("bank6")->set_base(mem+0x6000);
185185      }
r21033r21034
188188      case 1: /* unknown */
189189      case 3:
190190      {
191         UINT8 *mem = machine().root_device().memregion("banked")->base();
191         UINT8 *mem = memregion("banked")->base();
192192         membank("bank5")->set_base(mem+0x18000);
193193         membank("bank6")->set_base(mem+0x18000);
194194      }
r21033r21034
196196
197197      case 2: /* banked */
198198      {
199         UINT8 *mem = machine().root_device().memregion("banked")->base();
199         UINT8 *mem = memregion("banked")->base();
200200         membank("bank5")->set_base(mem+0x2000*m_bank[4]);
201201         membank("bank6")->set_base(mem+0x2000*m_bank[5]);
202202      }
r21033r21034
209209      case 0: /* unknown */
210210      case 1:
211211      {
212         UINT8 *mem = machine().root_device().memregion("banked")->base();
212         UINT8 *mem = memregion("banked")->base();
213213         membank("bank7")->set_base(mem+0x18000);
214214         membank("bank8")->set_base(mem+0x18000);
215215      }
r21033r21034
217217
218218      case 2: /* banked */
219219      {
220         UINT8 *mem = machine().root_device().memregion("banked")->base();
220         UINT8 *mem = memregion("banked")->base();
221221         membank("bank7")->set_base(mem+0x2000*m_bank[6]);
222222         membank("bank8")->set_base(mem+0x2000*m_bank[7]);
223223      }
trunk/src/mame/drivers/sangho.c
r21033r21034
112112      case 2:
113113         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
114114         machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
115         membank("bank2")->set_base(machine().root_device().memregion("user1")->base()+ 0x18000);
115         membank("bank2")->set_base(memregion("user1")->base()+ 0x18000);
116116         break;
117117      case 3:
118118         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
119119         machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
120         membank("bank2")->set_base(machine().root_device().memregion("user1")->base()+ 0x20000 + (m_pzlestar_rom_bank*0x8000) + 0x4000);
120         membank("bank2")->set_base(memregion("user1")->base()+ 0x20000 + (m_pzlestar_rom_bank*0x8000) + 0x4000);
121121         break;
122122      case 1:
123123         machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x4000, 0x7fff);
r21033r21034
138138      case 3:
139139         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank3");
140140         machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
141         membank("bank3")->set_base(machine().root_device().memregion("user1")->base()+ 0x20000 + (m_pzlestar_rom_bank*0x8000));
141         membank("bank3")->set_base(memregion("user1")->base()+ 0x20000 + (m_pzlestar_rom_bank*0x8000));
142142         break;
143143      case 1:
144144      case 2:
r21033r21034
208208      else
209209      {
210210         // rom 0
211         membank(read_bank_name)->set_base(machine().root_device().memregion("user1")->base()+0x4000*banknum);
211         membank(read_bank_name)->set_base(memregion("user1")->base()+0x4000*banknum);
212212         machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
213213      }
214214   }
215215   else if (banktype == 0x82)
216216   {
217      membank(read_bank_name)->set_base(machine().root_device().memregion("user1")->base()+0x20000+banknum*0x4000);
217      membank(read_bank_name)->set_base(memregion("user1")->base()+0x20000+banknum*0x4000);
218218      machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
219219   }
220220   else if (banktype == 0x80)
221221   {
222      membank(read_bank_name)->set_base(machine().root_device().memregion("user1")->base()+0x120000+banknum*0x4000);
222      membank(read_bank_name)->set_base(memregion("user1")->base()+0x120000+banknum*0x4000);
223223      machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
224224   }
225225   else
trunk/src/mame/drivers/pingpong.c
r21033r21034
572572
573573DRIVER_INIT_MEMBER(pingpong_state,merlinmm)
574574{
575   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
575   UINT8 *ROM = memregion("maincpu")->base();
576576   int i;
577577
578578   /* decrypt program code */
r21033r21034
586586   int i;
587587
588588   /* decrypt program code */
589   ROM = machine().root_device().memregion("maincpu")->base();
589   ROM = memregion("maincpu")->base();
590590   for( i = 0; i < 0x4000; i++ )
591591      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
592592
593593   /* decrypt questions */
594   ROM = machine().root_device().memregion("user1")->base();
594   ROM = memregion("user1")->base();
595595   for( i = 0; i < 0x40000; i++ )
596596      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
597597
trunk/src/mame/drivers/dynax.c
r21033r21034
275275
276276WRITE8_MEMBER(dynax_state::hnoridur_rombank_w)
277277{
278   int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
278   int bank_n = (memregion("maincpu")->bytes() - 0x10000) / 0x8000;
279279
280280   //logerror("%04x: rom bank = %02x\n", space.device().safe_pc(), data);
281281   if (data < bank_n)
r21033r21034
743743
744744WRITE8_MEMBER(dynax_state::yarunara_rombank_w)
745745{
746      int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
746      int bank_n = (memregion("maincpu")->bytes() - 0x10000) / 0x8000;
747747
748748      //logerror("%04x: rom bank = %02x\n", space.device().safe_pc(), data);
749749      if (data < bank_n)
r21033r21034
43174317
43184318MACHINE_START_MEMBER(dynax_state,hanamai)
43194319{
4320   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4321   machine().root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x8000], 0x8000);
4320   UINT8 *ROM = memregion("maincpu")->base();
4321   membank("bank1")->configure_entries(0, 0x10, &ROM[0x8000], 0x8000);
43224322
43234323   MACHINE_START_CALL_MEMBER(dynax);
43244324}
43254325
43264326MACHINE_START_MEMBER(dynax_state,hnoridur)
43274327{
4328   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4329   int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
4328   UINT8 *ROM = memregion("maincpu")->base();
4329   int bank_n = (memregion("maincpu")->bytes() - 0x10000) / 0x8000;
43304330
4331   machine().root_device().membank("bank1")->configure_entries(0, bank_n, &ROM[0x10000], 0x8000);
4331   membank("bank1")->configure_entries(0, bank_n, &ROM[0x10000], 0x8000);
43324332
43334333   MACHINE_START_CALL_MEMBER(dynax);
43344334}
43354335
43364336MACHINE_START_MEMBER(dynax_state,htengoku)
43374337{
4338   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4338   UINT8 *ROM = memregion("maincpu")->base();
43394339
4340   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x8000);
4340   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x8000);
43414341
43424342   MACHINE_START_CALL_MEMBER(dynax);
43434343}
r21033r21034
54325432DRIVER_INIT_MEMBER(dynax_state,blktouch)
54335433{
54345434   // fearsome encryption ;-)
5435   UINT8   *src = (UINT8 *)machine().root_device().memregion("maincpu")->base();
5435   UINT8   *src = (UINT8 *)memregion("maincpu")->base();
54365436   int i;
54375437
54385438   for (i = 0; i < 0x90000; i++)
r21033r21034
54415441
54425442   }
54435443
5444   src = (UINT8 *)machine().root_device().memregion("gfx1")->base();
5444   src = (UINT8 *)memregion("gfx1")->base();
54455445
54465446   for (i = 0; i < 0xc0000; i++)
54475447   {
r21033r21034
54545454{
54555455   /* Address lines scrambling on 1 z80 rom */
54565456   int i;
5457   UINT8   *gfx = (UINT8 *)machine().root_device().memregion("gfx1")->base();
5458   UINT8   *rom = machine().root_device().memregion("maincpu")->base() + 0x28000, *end = rom + 0x10000;
5457   UINT8   *gfx = (UINT8 *)memregion("gfx1")->base();
5458   UINT8   *rom = memregion("maincpu")->base() + 0x28000, *end = rom + 0x10000;
54595459   for ( ; rom < end; rom += 8)
54605460   {
54615461      UINT8 temp[8];
r21033r21034
62656265DRIVER_INIT_MEMBER(dynax_state,mjelct3)
62666266{
62676267   int i;
6268   UINT8   *rom = machine().root_device().memregion("maincpu")->base();
6269   size_t  size = machine().root_device().memregion("maincpu")->bytes();
6268   UINT8   *rom = memregion("maincpu")->base();
6269   size_t  size = memregion("maincpu")->bytes();
62706270   UINT8   *rom1 = auto_alloc_array(machine(), UINT8, size);
62716271
62726272   memcpy(rom1, rom, size);
r21033r21034
62786278DRIVER_INIT_MEMBER(dynax_state,mjelct3a)
62796279{
62806280   int i, j;
6281   UINT8   *rom = machine().root_device().memregion("maincpu")->base();
6282   size_t  size = machine().root_device().memregion("maincpu")->bytes();
6281   UINT8   *rom = memregion("maincpu")->base();
6282   size_t  size = memregion("maincpu")->bytes();
62836283   UINT8   *rom1 = auto_alloc_array(machine(), UINT8, size);
62846284
62856285   memcpy(rom1, rom, size);
trunk/src/mame/drivers/tattack.c
r21033r21034
237237
238238DRIVER_INIT_MEMBER(tattack_state,tattack)
239239{
240   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
240   UINT8 *rom = memregion("maincpu")->base();
241241
242242   rom[0x1b4]=0;
243243   rom[0x1b5]=0;
trunk/src/mame/drivers/m90.c
r21033r21034
11791179
11801180DRIVER_INIT_MEMBER(m90_state,bomblord)
11811181{
1182   UINT16 *ROM = (UINT16 *)(machine().root_device().memregion("maincpu")->base());
1182   UINT16 *ROM = (UINT16 *)(memregion("maincpu")->base());
11831183
11841184   for (int i = 0; i < 0x100000 / 2; i += 4)
11851185   {
trunk/src/mame/drivers/cbuster.c
r21033r21034
510510
511511DRIVER_INIT_MEMBER(cbuster_state,twocrude)
512512{
513   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
513   UINT8 *RAM = memregion("maincpu")->base();
514514   UINT8 *PTR;
515515   int i, j;
516516
r21033r21034
527527   }
528528
529529   /* Rearrange the 'extra' sprite bank to be in the same format as main sprites */
530   RAM = machine().root_device().memregion("gfx3")->base() + 0x080000;
531   PTR = machine().root_device().memregion("gfx3")->base() + 0x140000;
530   RAM = memregion("gfx3")->base() + 0x080000;
531   PTR = memregion("gfx3")->base() + 0x140000;
532532   for (i = 0; i < 0x20000; i += 64)
533533   {
534534      for (j = 0; j < 16; j += 1)
trunk/src/mame/drivers/ghosteo.c
r21033r21034
382382   UINT32 data = 0xFFFFFFFF;
383383   switch (port_g)
384384   {
385      case 0x8 : data = machine().root_device().ioport( "10000000-08")->read(); break;
386      case 0x9 : data = machine().root_device().ioport( "10000000-09")->read(); break;
387      case 0xA : data = machine().root_device().ioport( "10000000-0A")->read(); break;
388      case 0xB : data = machine().root_device().ioport( "10000000-0B")->read(); break;
389      case 0xC : data = machine().root_device().ioport( "10000000-0C")->read(); break;
385      case 0x8 : data = ioport( "10000000-08")->read(); break;
386      case 0x9 : data = ioport( "10000000-09")->read(); break;
387      case 0xA : data = ioport( "10000000-0A")->read(); break;
388      case 0xB : data = ioport( "10000000-0B")->read(); break;
389      case 0xC : data = ioport( "10000000-0C")->read(); break;
390390   }
391391//  logerror( "touryuu_port_10000000_r (%08X) -> %08X\n", port_g, data);
392392   return data;
r21033r21034
591591
592592void ghosteo_state::machine_start()
593593{
594   m_flash = (UINT8 *)machine().root_device().memregion( "user1")->base();
594   m_flash = (UINT8 *)memregion( "user1")->base();
595595}
596596
597597void ghosteo_state::machine_reset()
trunk/src/mame/drivers/madalien.c
r21033r21034
2525
2626inline UINT8 madalien_state::shift_common(UINT8 hi, UINT8 lo)
2727{
28   const UINT8 *table = machine().root_device().memregion("user2")->base();
28   const UINT8 *table = memregion("user2")->base();
2929
3030   return table[((hi & 0x07) << 8) | lo];
3131}
trunk/src/mame/drivers/flipjack.c
r21033r21034
135135void flipjack_state::palette_init()
136136{
137137   // from prom
138   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
138   const UINT8 *color_prom = memregion("proms")->base();
139139   for (int i = 0; i < 0x40; i++)
140140   {
141141      palette_set_color_rgb(machine(), 2*i+1, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
r21033r21034
463463
464464void flipjack_state::machine_start()
465465{
466   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
467   machine().root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000);
466   UINT8 *ROM = memregion("maincpu")->base();
467   membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000);
468468   membank("bank1")->set_entry(0);
469469
470470   save_item(NAME(m_soundlatch));
trunk/src/mame/drivers/mogura.c
r21033r21034
3737
3838void mogura_state::palette_init()
3939{
40   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
40   const UINT8 *color_prom = memregion("proms")->base();
4141   int i, j;
4242
4343   j = 0;
trunk/src/mame/drivers/pbaction.c
r21033r21034
470470DRIVER_INIT_MEMBER(pbaction_state,pbactio3)
471471{
472472   int i;
473   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
473   UINT8 *rom = memregion("maincpu")->base();
474474
475475   /* first of all, do a simple bitswap */
476476   for (i = 0; i < 0xc000; i++)
trunk/src/mame/drivers/funworld.c
r21033r21034
49214921*****************************************************************************************************/
49224922
49234923   int x, na, nb, nad, nbd;
4924   UINT8 *src = machine().root_device().memregion( "gfx1" )->base();
4924   UINT8 *src = memregion( "gfx1" )->base();
49254925
49264926
49274927   for (x=0x0000; x < 0x10000; x++)
r21033r21034
49524952
49534953******************************************************************/
49544954{
4955   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4955   UINT8 *ROM = memregion("maincpu")->base();
49564956
49574957   ROM[0xc1c6] = 0x92;
49584958}
r21033r21034
49624962/*** same as blue TAB PCB, with the magicd2a patch ***/
49634963{
49644964   int x, na, nb, nad, nbd;
4965   UINT8 *src = machine().root_device().memregion( "gfx1" )->base();
4966   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4965   UINT8 *src = memregion( "gfx1" )->base();
4966   UINT8 *ROM = memregion("maincpu")->base();
49674967
49684968   for (x=0x0000; x < 0x10000; x++)
49694969   {
r21033r21034
49834983DRIVER_INIT_MEMBER(funworld_state, soccernw)
49844984{
49854985/* temporary patch to avoid hardware errors for debug purposes */
4986   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4986   UINT8 *ROM = memregion("maincpu")->base();
49874987
49884988   ROM[0x80b2] = 0xa9;
49894989   ROM[0x80b3] = 0x00;
r21033r21034
50195019
50205020*************************************************/
50215021{
5022   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
5023   int size = machine().root_device().memregion("maincpu")->bytes();
5022   UINT8 *rom = memregion("maincpu")->base();
5023   int size = memregion("maincpu")->bytes();
50245024   int start = 0x8000;
50255025
5026   UINT8 *gfxrom = machine().root_device().memregion("gfx1")->base();
5027   int sizeg = machine().root_device().memregion("gfx1")->bytes();
5026   UINT8 *gfxrom = memregion("gfx1")->base();
5027   int sizeg = memregion("gfx1")->bytes();
50285028   int startg = 0;
50295029
5030   UINT8 *prom = machine().root_device().memregion("proms")->base();
5031   int sizep = machine().root_device().memregion("proms")->bytes();
5030   UINT8 *prom = memregion("proms")->base();
5031   int sizep = memregion("proms")->bytes();
50325032   int startp = 0;
50335033
50345034   UINT8 *buffer;
r21033r21034
51145114
51155115******************************************************/
51165116{
5117   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
5117   UINT8 *ROM = memregion("maincpu")->base();
51185118   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
51195119
51205120   int x;
r21033r21034
51335133      ROM[x+0x10000] = code;
51345134   }
51355135
5136   space.set_decrypted_region(0x8000, 0xffff, machine().root_device().memregion("maincpu")->base() + 0x18000);
5136   space.set_decrypted_region(0x8000, 0xffff, memregion("maincpu")->base() + 0x18000);
51375137}
51385138
51395139
r21033r21034
51485148
51495149******************************************************/
51505150
5151   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
5151   UINT8 *ROM = memregion("maincpu")->base();
51525152   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
51535153
51545154   int x;
r21033r21034
51875187      ROM[x+0x10000] = code;
51885188   }
51895189
5190   space.set_decrypted_region(0x6000, 0xffff, machine().root_device().memregion("maincpu")->base() + 0x16000);
5190   space.set_decrypted_region(0x6000, 0xffff, memregion("maincpu")->base() + 0x16000);
51915191}
51925192
51935193
r21033r21034
52085208
52095209******************************************************/
52105210{
5211   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
5212   int size = machine().root_device().memregion("maincpu")->bytes();
5211   UINT8 *rom = memregion("maincpu")->base();
5212   int size = memregion("maincpu")->bytes();
52135213   int start = 0x8000;
52145214
5215   UINT8 *gfxrom = machine().root_device().memregion("gfx1")->base();
5216   int sizeg = machine().root_device().memregion("gfx1")->bytes();
5215   UINT8 *gfxrom = memregion("gfx1")->base();
5216   int sizeg = memregion("gfx1")->bytes();
52175217   int startg = 0;
52185218
52195219   UINT8 *buffer;
r21033r21034
52725272
52735273*********************************************************/
52745274{
5275   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
5276   int size = machine().root_device().memregion("maincpu")->bytes();
5275   UINT8 *rom = memregion("maincpu")->base();
5276   int size = memregion("maincpu")->bytes();
52775277   int start = 0x8000;
52785278
52795279   UINT8 *buffer;
r21033r21034
52995299   *****************************/
53005300
53015301   int x, na, nb, nad, nbd;
5302   UINT8 *src = machine().root_device().memregion( "gfx1" )->base();
5303   //UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
5302   UINT8 *src = memregion( "gfx1" )->base();
5303   //UINT8 *ROM = memregion("maincpu")->base();
53045304
53055305   for (x=0x0000; x < 0x10000; x++)
53065306   {
trunk/src/mame/drivers/jackpool.c
r21033r21034
298298
299299DRIVER_INIT_MEMBER(jackpool_state,jackpool)
300300{
301   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
301   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
302302
303303   /* patch NVRAM routine */
304304   rom[0x9040/2] = 0x6602;
trunk/src/mame/drivers/gei.c
r21033r21034
278278
279279WRITE8_MEMBER(gei_state::banksel_main_w)
280280{
281   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x8000);
281   membank("bank1")->set_base(memregion("maincpu")->base() + 0x8000);
282282}
283283WRITE8_MEMBER(gei_state::banksel_1_w)
284284{
285   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
285   membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000);
286286}
287287WRITE8_MEMBER(gei_state::banksel_2_w)
288288{
289   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000);
289   membank("bank1")->set_base(memregion("maincpu")->base() + 0x18000);
290290}
291291WRITE8_MEMBER(gei_state::banksel_3_w)
292292{
293   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x20000);
293   membank("bank1")->set_base(memregion("maincpu")->base() + 0x20000);
294294}
295295WRITE8_MEMBER(gei_state::banksel_4_w)
296296{
297   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x28000);
297   membank("bank1")->set_base(memregion("maincpu")->base() + 0x28000);
298298}
299299WRITE8_MEMBER(gei_state::banksel_5_w)
300300{
301   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x30000);
301   membank("bank1")->set_base(memregion("maincpu")->base() + 0x30000);
302302}
303303
304304WRITE8_MEMBER(gei_state::banksel_1_1_w)
305305{
306   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
306   membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000);
307307}
308308WRITE8_MEMBER(gei_state::banksel_2_1_w)
309309{
310   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x14000);
310   membank("bank1")->set_base(memregion("maincpu")->base() + 0x14000);
311311}
312312WRITE8_MEMBER(gei_state::banksel_3_1_w)
313313{
314   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000);
314   membank("bank1")->set_base(memregion("maincpu")->base() + 0x18000);
315315}
316316WRITE8_MEMBER(gei_state::banksel_4_1_w)
317317{
318   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1c000);
318   membank("bank1")->set_base(memregion("maincpu")->base() + 0x1c000);
319319}
320320WRITE8_MEMBER(gei_state::banksel_5_1_w)
321321{
322   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x20000);
322   membank("bank1")->set_base(memregion("maincpu")->base() + 0x20000);
323323}
324324WRITE8_MEMBER(gei_state::banksel_1_2_w)
325325{
326   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x12000);
326   membank("bank1")->set_base(memregion("maincpu")->base() + 0x12000);
327327}
328328WRITE8_MEMBER(gei_state::banksel_2_2_w)
329329{
330   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x16000);
330   membank("bank1")->set_base(memregion("maincpu")->base() + 0x16000);
331331}
332332WRITE8_MEMBER(gei_state::banksel_3_2_w)
333333{
334   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1a000);
334   membank("bank1")->set_base(memregion("maincpu")->base() + 0x1a000);
335335}
336336WRITE8_MEMBER(gei_state::banksel_4_2_w)
337337{
338   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x1e000);
338   membank("bank1")->set_base(memregion("maincpu")->base() + 0x1e000);
339339}
340340WRITE8_MEMBER(gei_state::banksel_5_2_w)
341341{
342   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x22000);
342   membank("bank1")->set_base(memregion("maincpu")->base() + 0x22000);
343343}
344344
345345WRITE8_MEMBER(gei_state::geimulti_bank_w)
r21033r21034
367367   }
368368
369369   if (bank != -1)
370      membank("bank1")->set_base(machine().root_device().memregion("bank")->base() + bank*0x8000);
370      membank("bank1")->set_base(memregion("bank")->base() + bank*0x8000);
371371}
372372
373373READ8_MEMBER(gei_state::banksel_1_r)
374374{
375   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
375   membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000);
376376   return 0x03;
377377};
378378
379379READ8_MEMBER(gei_state::banksel_2_r)
380380{
381   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x18000);
381   membank("bank1")->set_base(memregion("maincpu")->base() + 0x18000);
382382   return 0x03;
383383}
384384
385385READ8_MEMBER(gei_state::banksel_3_r)
386386{
387   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x20000);
387   membank("bank1")->set_base(memregion("maincpu")->base() + 0x20000);
388388   return 0x03;
389389}
390390
391391READ8_MEMBER(gei_state::banksel_4_r)
392392{
393   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x28000);
393   membank("bank1")->set_base(memregion("maincpu")->base() + 0x28000);
394394   return 0x03;
395395}
396396
397397READ8_MEMBER(gei_state::banksel_5_r)
398398{
399   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x30000);
399   membank("bank1")->set_base(memregion("maincpu")->base() + 0x30000);
400400   return 0x03;
401401}
402402
r21033r21034
18921892
18931893DRIVER_INIT_MEMBER(gei_state,setbank)
18941894{
1895   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x2000);
1895   membank("bank1")->set_base(memregion("maincpu")->base() + 0x2000);
18961896}
18971897
18981898DRIVER_INIT_MEMBER(gei_state,geimulti)
18991899{
1900   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("bank")->base() + 0x0000);
1900   membank("bank1")->set_base(memregion("bank")->base() + 0x0000);
19011901}
19021902
19031903GAME( 1982, jokpoker, 0,        gselect,  gselect, gei_state,  setbank, ROT0, "Greyhound Electronics", "Joker Poker (Version 16.03B)",            GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
trunk/src/mame/drivers/nbmj8900.c
r21033r21034
3535DRIVER_INIT_MEMBER(nbmj8900_state,ohpaipee)
3636{
3737#if 0
38   UINT8 *prot = machine().root_device().memregion("protdata")->base();
38   UINT8 *prot = memregion("protdata")->base();
3939   int i;
4040
4141   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
4949      prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
5050   }
5151#else
52   unsigned char *ROM = machine().root_device().memregion("maincpu")->base();
52   unsigned char *ROM = memregion("maincpu")->base();
5353
5454   // Protection ROM check skip
5555   ROM[0x00e4] = 0x00;
r21033r21034
6666DRIVER_INIT_MEMBER(nbmj8900_state,togenkyo)
6767{
6868#if 0
69   UINT8 *prot = machine().root_device().memregion("protdata")->base();
69   UINT8 *prot = memregion("protdata")->base();
7070   int i;
7171
7272   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
7979      prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
8080   }
8181#else
82   unsigned char *ROM = machine().root_device().memregion("maincpu")->base();
82   unsigned char *ROM = memregion("maincpu")->base();
8383
8484   // Protection ROM check skip
8585   ROM[0x010b] = 0x00;
trunk/src/mame/drivers/progolf.c
r21033r21034
386386
387387void progolf_state::palette_init()
388388{
389   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
389   const UINT8 *color_prom = memregion("proms")->base();
390390   int i;
391391
392392   for (i = 0;i < machine().total_colors();i++)
trunk/src/mame/drivers/silkroad.c
r21033r21034
315315      verified as correct... problem with the original which the gfx hardware
316316      didn't care about? Ideally it should be checked against a different PCB */
317317
318   UINT8 *src = machine().root_device().memregion("gfx1")->base()+0x1000000;
318   UINT8 *src = memregion("gfx1")->base()+0x1000000;
319319   int len = 0x0200000;
320320   UINT8 *buffer;
321321
trunk/src/mame/drivers/igs009.c
r21033r21034
844844DRIVER_INIT_MEMBER(igs009_state,jingbell)
845845{
846846   int i;
847   UINT8 *rom  = (UINT8 *)machine().root_device().memregion("maincpu")->base();
848   size_t size = machine().root_device().memregion("maincpu")->bytes();
847   UINT8 *rom  = (UINT8 *)memregion("maincpu")->base();
848   size_t size = memregion("maincpu")->bytes();
849849
850850   for (i=0; i<size; i++)
851851   {
trunk/src/mame/drivers/exprraid.c
r21033r21034
799799{
800800   /* Expand the background rom so we can use regular decode routines */
801801
802   UINT8   *gfx = machine().root_device().memregion("gfx3")->base();
802   UINT8   *gfx = memregion("gfx3")->base();
803803   int offs = 0x10000 - 0x1000;
804804   int i;
805805
r21033r21034
818818
819819DRIVER_INIT_MEMBER(exprraid_state,wexpressb)
820820{
821   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
821   UINT8 *rom = memregion("maincpu")->base();
822822
823823   /* HACK: this set uses M6502 irq vectors but DECO CPU-16 opcodes??? */
824824   rom[0xfff7] = rom[0xfffa];
trunk/src/mame/drivers/psikyo.c
r21033r21034
18151815   m_ka302c_banking = 0; // SH201B doesn't have any gfx banking
18161816
18171817   /* setup audiocpu banks */
1818   membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x8000);
1818   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000, 0x8000);
18191819
18201820   /* Enable other regions */
18211821#if 0
18221822   if (!strcmp(machine().system().name,"sngkace"))
18231823   {
1824      UINT8 *ROM  =   machine().root_device().memregion("maincpu")->base();
1824      UINT8 *ROM  =   memregion("maincpu")->base();
18251825      ROM[0x995] = 0x4e;
18261826      ROM[0x994] = 0x71;
18271827      ROM[0x997] = 0x4e;
trunk/src/mame/drivers/esh.c
r21033r21034
229229
230230void esh_state::palette_init()
231231{
232   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
232   const UINT8 *color_prom = memregion("proms")->base();
233233   int i;
234234
235235   /* Oddly enough, the top 4 bits of each byte is 0 */
trunk/src/mame/drivers/2mindril.c
r21033r21034
490490{
491491   UINT8 lsb,msb;
492492   UINT32 offset,i;
493   UINT8 *gfx = machine().root_device().memregion("gfx2")->base();
494   int size=machine().root_device().memregion("gfx2")->bytes();
493   UINT8 *gfx = memregion("gfx2")->base();
494   int size=memregion("gfx2")->bytes();
495495   int data;
496496
497497   /* Setup ROM formats:
r21033r21034
523523      offset+=4;
524524   }
525525
526   gfx = machine().root_device().memregion("gfx1")->base();
527   size=machine().root_device().memregion("gfx1")->bytes();
526   gfx = memregion("gfx1")->base();
527   size=memregion("gfx1")->bytes();
528528
529529   offset = size/2;
530530   for (i = size/2+size/4; i<size; i++)
trunk/src/mame/drivers/model3.c
r21033r21034
15721572            data >>= 56;
15731573            data = (~data) & 0x7;
15741574
1575            membank("bank1")->set_base(machine().root_device().memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1575            membank("bank1")->set_base(memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
15761576         }
15771577         if (ACCESSING_BITS_24_31)
15781578         {
r21033r21034
18321832   {
18331833      data >>= 56;
18341834      data = (~data) & 0xf;
1835      membank("bank1")->set_base(machine().root_device().memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1836      membank("bank2")->set_base(machine().root_device().memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1835      membank("bank1")->set_base(memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
1836      membank("bank2")->set_base(memregion( "user1" )->base() + 0x800000 + (data * 0x800000)); /* banked CROM */
18371837   }
18381838}
18391839
r21033r21034
52575257WRITE16_MEMBER(model3_state::model3snd_ctrl)
52585258{
52595259   // handle sample banking
5260   if (machine().root_device().memregion("scsp2")->bytes() > 0x800000)
5260   if (memregion("scsp2")->bytes() > 0x800000)
52615261   {
52625262      UINT8 *snd = memregion("scsp2")->base();
52635263      if (data & 0x20)
r21033r21034
56625662
56635663DRIVER_INIT_MEMBER(model3_state,vf3)
56645664{
5665   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5665   UINT32 *rom = (UINT32*)memregion("user1")->base();
56665666
56675667   DRIVER_INIT_CALL(model3_10);
56685668
r21033r21034
57455745
57465746DRIVER_INIT_MEMBER(model3_state,vs2)
57475747{
5748   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5748   UINT32 *rom = (UINT32*)memregion("user1")->base();
57495749
57505750   DRIVER_INIT_CALL(model3_20);
57515751
r21033r21034
57555755
57565756DRIVER_INIT_MEMBER(model3_state,vs298)
57575757{
5758   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5758   UINT32 *rom = (UINT32*)memregion("user1")->base();
57595759
57605760   DRIVER_INIT_CALL(model3_20);
57615761
r21033r21034
57665766
57675767DRIVER_INIT_MEMBER(model3_state,vs2v991)
57685768{
5769   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5769   UINT32 *rom = (UINT32*)memregion("user1")->base();
57705770
57715771   DRIVER_INIT_CALL(model3_20);
57725772
r21033r21034
57765776
57775777DRIVER_INIT_MEMBER(model3_state,vs299b)
57785778{
5779   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5779   UINT32 *rom = (UINT32*)memregion("user1")->base();
57805780
57815781   DRIVER_INIT_CALL(model3_20);
57825782
r21033r21034
57865786
57875787DRIVER_INIT_MEMBER(model3_state,vs299a)
57885788{
5789   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5789   UINT32 *rom = (UINT32*)memregion("user1")->base();
57905790
57915791   DRIVER_INIT_CALL(model3_20);
57925792
r21033r21034
57965796
57975797DRIVER_INIT_MEMBER(model3_state,vs299)
57985798{
5799   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5799   UINT32 *rom = (UINT32*)memregion("user1")->base();
58005800
58015801   DRIVER_INIT_CALL(model3_20);
58025802
r21033r21034
58375837
58385838DRIVER_INIT_MEMBER(model3_state,srally2)
58395839{
5840   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5840   UINT32 *rom = (UINT32*)memregion("user1")->base();
58415841   DRIVER_INIT_CALL(model3_20);
58425842
58435843   rom[(0x7c0c4^4)/4] = 0x60000000;
r21033r21034
58475847
58485848DRIVER_INIT_MEMBER(model3_state,swtrilgy)
58495849{
5850   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5850   UINT32 *rom = (UINT32*)memregion("user1")->base();
58515851   DRIVER_INIT_CALL(model3_20);
58525852
58535853   rom[(0xf0e48^4)/4] = 0x60000000;
r21033r21034
58585858
58595859DRIVER_INIT_MEMBER(model3_state,swtrilga)
58605860{
5861   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5861   UINT32 *rom = (UINT32*)memregion("user1")->base();
58625862   DRIVER_INIT_CALL(model3_20);
58635863
58645864   rom[(0xf6dd0^4)/4] = 0x60000000;
r21033r21034
58665866
58675867DRIVER_INIT_MEMBER(model3_state,von2)
58685868{
5869   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5869   UINT32 *rom = (UINT32*)memregion("user1")->base();
58705870   DRIVER_INIT_CALL(model3_20);
58715871
58725872   rom[(0x189168^4)/4] = 0x60000000;
r21033r21034
58785878
58795879DRIVER_INIT_MEMBER(model3_state,dirtdvls)
58805880{
5881   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5881   UINT32 *rom = (UINT32*)memregion("user1")->base();
58825882   DRIVER_INIT_CALL(model3_20);
58835883
58845884   rom[(0x0600a0^4)/4] = 0x60000000;
r21033r21034
59205920
59215921DRIVER_INIT_MEMBER(model3_state,spikeout)
59225922{
5923   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5923   UINT32 *rom = (UINT32*)memregion("user1")->base();
59245924   DRIVER_INIT_CALL(model3_20);
59255925
59265926   rom[(0x6059cc^4)/4] = 0x60000000;
r21033r21034
59295929
59305930DRIVER_INIT_MEMBER(model3_state,spikeofe)
59315931{
5932   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5932   UINT32 *rom = (UINT32*)memregion("user1")->base();
59335933   DRIVER_INIT_CALL(model3_20);
59345934
59355935   rom[(0x6059cc^4)/4] = 0x60000000;
r21033r21034
59385938
59395939DRIVER_INIT_MEMBER(model3_state,eca)
59405940{
5941   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5941   UINT32 *rom = (UINT32*)memregion("user1")->base();
59425942   DRIVER_INIT_CALL(model3_20);
59435943
59445944   rom[(0x535580^4)/4] = 0x60000000;
r21033r21034
59485948
59495949DRIVER_INIT_MEMBER(model3_state,skichamp)
59505950{
5951   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5951   UINT32 *rom = (UINT32*)memregion("user1")->base();
59525952   DRIVER_INIT_CALL(model3_20);
59535953
59545954   rom[(0x5263c8^4)/4] = 0x60000000;
r21033r21034
59595959
59605960DRIVER_INIT_MEMBER(model3_state,oceanhun)
59615961{
5962   UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base();
5962   UINT32 *rom = (UINT32*)memregion("user1")->base();
59635963   DRIVER_INIT_CALL(model3_20);
59645964
59655965   rom[(0x57995c^4)/4] = 0x60000000;   // decrementer
trunk/src/mame/drivers/cb2001.c
r21033r21034
778778   {
779779      int r,g,b;
780780
781      UINT8*proms = machine().root_device().memregion("proms")->base();
782      int length = machine().root_device().memregion("proms")->bytes();
781      UINT8*proms = memregion("proms")->base();
782      int length = memregion("proms")->bytes();
783783      UINT16 dat;
784784
785785      dat = (proms[0x000+i] << 8) | proms[0x200+i];
trunk/src/mame/drivers/dkong.c
r21033r21034
16111611   UINT32 mem;
16121612   UINT32 newmem;
16131613
1614   ROM = machine().root_device().memregion("braze")->base();
1614   ROM = memregion("braze")->base();
16151615
16161616   for (mem=0;mem<0x10000;mem++)
16171617   {
r21033r21034
30303030   UINT8 *ROM;
30313031   int mem;
30323032
3033   ROM = machine().root_device().memregion("maincpu")->base();
3033   ROM = memregion("maincpu")->base();
30343034
30353035   for (mem=0;mem<0x4000;mem++)
30363036   {
r21033r21034
30563056DRIVER_INIT_MEMBER(dkong_state,herodk)
30573057{
30583058   int A;
3059   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
3059   UINT8 *rom = memregion("maincpu")->base();
30603060
30613061   /* swap data lines D3 and D4 */
30623062   for (A = 0;A < 0x8000;A++)
r21033r21034
31443144
31453145DRIVER_INIT_MEMBER(dkong_state,dkingjr)
31463146{
3147   UINT8 *prom = machine().root_device().memregion("proms")->base();
3147   UINT8 *prom = memregion("proms")->base();
31483148   for( int i=0; i<0x200; ++i)
31493149   {
31503150      prom[i]^=0xff; // invert color data
trunk/src/mame/drivers/sliver.c
r21033r21034
238238      cinfo.err = jpeg_std_error(&jerr);
239239      jpeg_create_decompress(&cinfo);
240240
241      jpeg_mem_src(&cinfo, machine().root_device().memregion("user2")->base()+addr, machine().root_device().memregion("user2")->bytes()-addr);
241      jpeg_mem_src(&cinfo, memregion("user2")->base()+addr, memregion("user2")->bytes()-addr);
242242
243243      jpeg_read_header(&cinfo, TRUE);
244244      jpeg_start_decompress(&cinfo);
trunk/src/mame/drivers/pntnpuzl.c
r21033r21034
380380
381381DRIVER_INIT_MEMBER(pntnpuzl_state,pip)
382382{
383//  UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
383//  UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
384384//  rom[0x2696/2] = 0x4e71;
385385//  rom[0x26a0/2] = 0x4e71;
386386
trunk/src/mame/drivers/funkball.c
r21033r21034
543543         if (data & 0x1 << i*4)      // enable RAM access to region 0xe0000 - 0xfffff
544544            membank(banknames[i])->set_base(m_bios_ram + (0x4000 * i));
545545         else                    // disable RAM access (reads go to BIOS ROM)
546            membank(banknames[i])->set_base(machine().root_device().memregion("bios")->base() + (0x4000 * i));
546            membank(banknames[i])->set_base(memregion("bios")->base() + (0x4000 * i));
547547      }
548548   }
549549}
trunk/src/mame/drivers/aristmk5.c
r21033r21034
361361
362362DRIVER_INIT_MEMBER(aristmk5_state,aristmk5)
363363{
364   UINT8 *SRAM    = machine().root_device().memregion("sram")->base();
365   UINT8 *SRAM_NZ = machine().root_device().memregion("sram")->base();
364   UINT8 *SRAM    = memregion("sram")->base();
365   UINT8 *SRAM_NZ = memregion("sram")->base();
366366
367367   archimedes_driver_init();
368368
369   machine().root_device().membank("sram_bank")->configure_entries(0, 4,    &SRAM[0],    0x20000);
370   machine().root_device().membank("sram_bank_nz")->configure_entries(0, 4, &SRAM_NZ[0], 0x20000);
369   membank("sram_bank")->configure_entries(0, 4,    &SRAM[0],    0x20000);
370   membank("sram_bank_nz")->configure_entries(0, 4, &SRAM_NZ[0], 0x20000);
371371}
372372
373373
r21033r21034
398398      UINT8 op_mode;
399399      static const char *const rom_region[] = { "set_chip_4.04", "set_chip_4.4", "clear_chip", "game_prg" };
400400
401      op_mode = machine().root_device().ioport("ROM_LOAD")->read();
401      op_mode = ioport("ROM_LOAD")->read();
402402
403      PRG = machine().root_device().memregion(rom_region[op_mode & 3])->base();
403      PRG = memregion(rom_region[op_mode & 3])->base();
404404
405405      if(PRG!=NULL)
406406
trunk/src/mame/drivers/tmspoker.c
r21033r21034
298298
299299void tmspoker_state::machine_start()
300300{
301   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
302   machine().root_device().membank("bank1")->configure_entries(0, 2, &ROM[0], 0x1000);
301   UINT8 *ROM = memregion("maincpu")->base();
302   membank("bank1")->configure_entries(0, 2, &ROM[0], 0x1000);
303303}
304304
305305
306306void tmspoker_state::machine_reset()
307307{
308   UINT8 seldsw = (machine().root_device().ioport("SELDSW")->read() );
308   UINT8 seldsw = (ioport("SELDSW")->read() );
309309
310310   popmessage("ROM Bank: %02X", seldsw);
311311
312   machine().root_device().membank("bank1")->set_entry(seldsw);
312   membank("bank1")->set_entry(seldsw);
313313}
314314
315315
r21033r21034
617617{
618618   /* decode the TMS9980 ROMs */
619619   offs_t offs;
620   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
621   const size_t len = machine().root_device().memregion("maincpu")->bytes();
620   UINT8 *rom = memregion("maincpu")->base();
621   const size_t len = memregion("maincpu")->bytes();
622622
623623   for (offs = 0; offs < len; offs++)
624624   {
trunk/src/mame/drivers/pengo.c
r21033r21034
691691   };
692692   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
693693   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
694   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
694   UINT8 *rom = memregion("maincpu")->base();
695695   int A;
696696
697697   space.set_decrypted_region(0x0000, 0x7fff, decrypt);
trunk/src/mame/drivers/konendev.c
r21033r21034
165165
166166DRIVER_INIT_MEMBER(konendev_state,konendev)
167167{
168   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
169   size_t  srcsize = machine().root_device().memregion( "maincpu" )->bytes();
168   UINT8 *src = memregion( "maincpu" )->base();
169   size_t  srcsize = memregion( "maincpu" )->bytes();
170170   for (int i = 0; i < srcsize; i += 2)
171171   {
172172      int temp = src[i];
trunk/src/mame/drivers/cardline.c
r21033r21034
187187
188188void cardline_state::palette_init()
189189{
190   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
190   const UINT8 *color_prom = memregion("proms")->base();
191191   int i,r,g,b,data;
192192   int bit0,bit1,bit2;
193193   for (i = 0;i < machine().total_colors();i++)
trunk/src/mame/drivers/omegrace.c
r21033r21034
590590
591591DRIVER_INIT_MEMBER(omegrace_state,omegrace)
592592{
593   int i, len = machine().root_device().memregion("user1")->bytes();
594   UINT8 *prom = machine().root_device().memregion("user1")->base();
593   int i, len = memregion("user1")->bytes();
594   UINT8 *prom = memregion("user1")->base();
595595
596596   /* Omega Race has two pairs of the state PROM output
597597    * lines swapped before going into the decoder.
trunk/src/mame/drivers/decocass.c
r21033r21034
16071607   if(offset & 6)
16081608      return decocass_input_r(space,offset);
16091609
1610   res = machine().root_device().ioport(portnames[offset & 1][m_mux_data])->read();
1610   res = ioport(portnames[offset & 1][m_mux_data])->read();
16111611
16121612   return res;
16131613}
trunk/src/mame/drivers/tank8.c
r21033r21034
465465
466466DRIVER_INIT_MEMBER(tank8_state,decode)
467467{
468   const UINT8* DECODE = machine().root_device().memregion("user1")->base();
468   const UINT8* DECODE = memregion("user1")->base();
469469
470   UINT8* p1 = machine().root_device().memregion("maincpu")->base() + 0x00000;
471   UINT8* p2 = machine().root_device().memregion("maincpu")->base() + 0x10000;
470   UINT8* p1 = memregion("maincpu")->base() + 0x00000;
471   UINT8* p2 = memregion("maincpu")->base() + 0x10000;
472472
473473   int i;
474474
trunk/src/mame/drivers/pluto5.c
r21033r21034
835835
836836DRIVER_INIT_MEMBER(pluto5_state,hb)
837837{
838   astra_addresslines( (UINT16*)machine().root_device().memregion( "maincpu" )->base(), machine().root_device().memregion( "maincpu" )->bytes(), 0 );
838   astra_addresslines( (UINT16*)memregion( "maincpu" )->base(), memregion( "maincpu" )->bytes(), 0 );
839839
840840   #if 0
841841   {
842      UINT8* ROM = machine().root_device().memregion( "maincpu" )->base();
842      UINT8* ROM = memregion( "maincpu" )->base();
843843      FILE *fp;
844844      char filename[256];
845845      sprintf(filename,"%s", machine().system().name);
846846      fp=fopen(filename, "w+b");
847847      if (fp)
848848      {
849         fwrite(ROM,  machine().root_device().memregion( "maincpu" )->bytes(), 1, fp);
849         fwrite(ROM,  memregion( "maincpu" )->bytes(), 1, fp);
850850         fclose(fp);
851851      }
852852   }
trunk/src/mame/drivers/moo.c
r21033r21034
177177
178178WRITE8_MEMBER(moo_state::sound_bankswitch_w)
179179{
180   membank("bank1")->set_base(machine().root_device().memregion("soundcpu")->base() + 0x10000 + (data&0xf)*0x4000);
180   membank("bank1")->set_base(memregion("soundcpu")->base() + 0x10000 + (data&0xf)*0x4000);
181181}
182182
183183
trunk/src/mame/drivers/jollyjgr.c
r21033r21034
409409
410410void jollyjgr_state::palette_init()
411411{
412   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
412   const UINT8 *color_prom = memregion("proms")->base();
413413   int i;
414414
415415   /* tilemap / sprites palette */
trunk/src/mame/drivers/psikyo4.c
r21033r21034
183183{
184184   if (ACCESSING_BITS_16_31)
185185   {
186      return machine().root_device().ioport("JP4")->read();
186      return ioport("JP4")->read();
187187   }
188188
189189//  logerror("Unk EEPROM read mask %x\n", mem_mask);
r21033r21034
318318   if (offset == 2) /* Configure bank for gfx test */
319319   {
320320      if (ACCESSING_BITS_0_15)    // Bank
321         membank("bank2")->set_base(machine().root_device().memregion("gfx1")->base() + 0x2000 * (m_vidregs[offset] & 0x1fff)); /* Bank comes from vidregs */
321         membank("bank2")->set_base(memregion("gfx1")->base() + 0x2000 * (m_vidregs[offset] & 0x1fff)); /* Bank comes from vidregs */
322322   }
323323}
324324
r21033r21034
960960
961961DRIVER_INIT_MEMBER(psikyo4_state,hotgmck)
962962{
963   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
964   machine().root_device().membank("bank1")->set_base(&RAM[0x100000]);
963   UINT8 *RAM = memregion("maincpu")->base();
964   membank("bank1")->set_base(&RAM[0x100000]);
965965   install_hotgmck_pcm_bank();    // Banked PCM ROM
966966}
967967
trunk/src/mame/drivers/tumblep.c
r21033r21034
375375void ::tumblep_patch_code(UINT16 offset)
376376{
377377   /* A hack which enables all Dip Switches effects */
378   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
378   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
379379   RAM[(offset + 0)/2] = 0x0240;
380380   RAM[(offset + 2)/2] = 0xffff;   // andi.w  #$f3ff, D0
381381}
trunk/src/mame/drivers/m58.c
r21033r21034
432432   // on these sets the content of the sprite color PROM needs reversing
433433   //  are the proms on the other sets from bootleg boards, or hand modified?
434434   UINT8* buffer = auto_alloc_array(machine(), UINT8, 0x10);
435   UINT8* region = machine().root_device().memregion("proms")->base();
435   UINT8* region = memregion("proms")->base();
436436   int i;
437437
438438   for (i=0;i<0x10;i++)
trunk/src/mame/drivers/triforce.c
r21033r21034
521521   /* set conservative DRC options */
522522   ppcdrc_set_options(machine().device("maincpu"), PPCDRC_COMPATIBLE_OPTIONS);
523523
524   UINT8 *rom = (UINT8*)machine().root_device().memregion("maincpu")->base();
524   UINT8 *rom = (UINT8*)memregion("maincpu")->base();
525525   descrambler(&rom[0x100], 0x1afe00);
526526}
527527
trunk/src/mame/drivers/konamigx.c
r21033r21034
918918
919919READ32_MEMBER(konamigx_state::type1_roz_r1)
920920{
921   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("gfx3")->base();
921   UINT32 *ROM = (UINT32 *)memregion("gfx3")->base();
922922
923923   return ROM[offset];
924924}
925925
926926READ32_MEMBER(konamigx_state::type1_roz_r2)
927927{
928   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("gfx3")->base();
928   UINT32 *ROM = (UINT32 *)memregion("gfx3")->base();
929929
930930   ROM += (0x600000/2);
931931
trunk/src/mame/drivers/namcos2.c
r21033r21034
51635163{
51645164   /* unscramble sprites */
51655165   int i, j, k, l;
5166   UINT8 *data = machine().root_device().memregion("gfx1")->base();
5166   UINT8 *data = memregion("gfx1")->base();
51675167   for(i=0; i<0x200000; i+=32*32)
51685168   {
51695169      for(j=0; j<32*32; j+=32*4)
r21033r21034
52965296
52975297DRIVER_INIT_MEMBER(namcos2_state,luckywld)
52985298{
5299   UINT8 *pData = (UINT8 *)machine().root_device().memregion( "gfx5" )->base();
5299   UINT8 *pData = (UINT8 *)memregion( "gfx5" )->base();
53005300   int i;
53015301   for( i=0; i<32*0x4000; i++ )
53025302   { /* unscramble gfx mask */
trunk/src/mame/drivers/opwolf.c
r21033r21034
346346
347347WRITE8_MEMBER(opwolf_state::sound_bankswitch_w)
348348{
349   machine().root_device().membank("bank10")->set_entry((data - 1) & 0x03);
349   membank("bank10")->set_entry((data - 1) & 0x03);
350350}
351351
352352/***********************************************************
trunk/src/mame/drivers/exzisus.c
r21033r21034
117117// the RAM check to work
118118DRIVER_INIT_MEMBER(exzisus_state,exzisus)
119119{
120   UINT8 *RAM = machine().root_device().memregion("cpua")->base();
120   UINT8 *RAM = memregion("cpua")->base();
121121
122122   /* Fix WORK RAM error */
123123   RAM[0x67fd] = 0x18;
trunk/src/mame/drivers/homedata.c
r21033r21034
506506
507507WRITE8_MEMBER(homedata_state::bankswitch_w)
508508{
509   int last_bank = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x4000;
509   int last_bank = (memregion("maincpu")->bytes() - 0x10000) / 0x4000;
510510
511511   /* last bank is fixed and is #0 for us, other banks start from #1 (hence data+1 below)*/
512512   if (data < last_bank)
trunk/src/mame/drivers/jokrwild.c
r21033r21034
556556*****************************************************************************/
557557{
558558   int i, offs;
559   UINT8 *srcp = machine().root_device().memregion( "maincpu" )->base();
559   UINT8 *srcp = memregion( "maincpu" )->base();
560560
561561   for (i = 0x8000; i < 0x10000; i++)
562562   {
trunk/src/mame/drivers/puckpkmn.c
r21033r21034
376376
377377DRIVER_INIT_MEMBER(md_boot_state,puckpkmn)
378378{
379   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
380   size_t len = machine().root_device().memregion("maincpu")->bytes();
379   UINT8 *rom = memregion("maincpu")->base();
380   size_t len = memregion("maincpu")->bytes();
381381   int i;
382382
383383   for (i = 0; i < len; i++)
trunk/src/mame/drivers/meadows.c
r21033r21034
862862      0x01,0x80, 0x03,0xc0, 0x03,0xc0, 0x01,0x80
863863   };
864864   int i;
865   UINT8 *gfx2 = machine().root_device().memregion("gfx2")->base();
866   UINT8 *gfx3 = machine().root_device().memregion("gfx3")->base();
867   UINT8 *gfx4 = machine().root_device().memregion("gfx4")->base();
868   UINT8 *gfx5 = machine().root_device().memregion("gfx5")->base();
869   int len3 = machine().root_device().memregion("gfx3")->bytes();
870   int len4 = machine().root_device().memregion("gfx4")->bytes();
865   UINT8 *gfx2 = memregion("gfx2")->base();
866   UINT8 *gfx3 = memregion("gfx3")->base();
867   UINT8 *gfx4 = memregion("gfx4")->base();
868   UINT8 *gfx5 = memregion("gfx5")->base();
869   int len3 = memregion("gfx3")->bytes();
870   int len4 = memregion("gfx4")->bytes();
871871
872872   memcpy(gfx3,gfx2,len3);
873873
r21033r21034
886886   UINT8 *mem;
887887
888888   /* create an inverted copy of the graphics data */
889   mem = machine().root_device().memregion("gfx1")->base();
890   length = machine().root_device().memregion("gfx1")->bytes();
889   mem = memregion("gfx1")->base();
890   length = memregion("gfx1")->bytes();
891891   for (i = 0; i < length/2; i++)
892892      mem[i] = ~mem[i + length/2];
893893}
trunk/src/mame/drivers/gamecstl.c
r21033r21034
620620
621621void gamecstl_state::machine_reset()
622622{
623   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("bios")->base() + 0x30000);
623   membank("bank1")->set_base(memregion("bios")->base() + 0x30000);
624624
625625   machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(gamecstl_state::irq_callback),this));
626626}
trunk/src/mame/drivers/kangaroo.c
r21033r21034
174174
175175void kangaroo_state::machine_start()
176176{
177   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("gfx1")->base(), 0x2000);
177   membank("bank1")->configure_entries(0, 2, memregion("gfx1")->base(), 0x2000);
178178}
179179
180180
trunk/src/mame/drivers/thedeep.c
r21033r21034
412412   {
413413      if (m_protection_command != 0x59)
414414      {
415         int coins = machine().root_device().ioport("MCU")->read();
415         int coins = ioport("MCU")->read();
416416         if      (coins & 1) m_protection_data = 1;
417417         else if (coins & 2) m_protection_data = 2;
418418         else if (coins & 4) m_protection_data = 3;
trunk/src/mame/drivers/mpu3.c
r21033r21034
379379      case 2:
380380      case 3:
381381      {
382         data = (machine().root_device().ioport(portnames[m_input_strobe])->read()<<2);
382         data = (ioport(portnames[m_input_strobe])->read()<<2);
383383         break;
384384      }
385385      case 4://DIL1
386386      case 6://DIL2
387387      {
388         swizzle = (machine().root_device().ioport(portnames[m_input_strobe])->read());
388         swizzle = (ioport(portnames[m_input_strobe])->read());
389389         data = (((swizzle & 0x01) << 7) + ((swizzle & 0x02) << 5) + ((swizzle & 0x04) << 3)
390390               + ((swizzle & 0x08) << 1) +((swizzle & 0x10) >> 1) + ((swizzle & 0x20) >> 3));
391391         break;
r21033r21034
393393      case 5://DIL1
394394      case 7://DIL2
395395      {
396         swizzle = (machine().root_device().ioport(portnames[m_input_strobe])->read());
396         swizzle = (ioport(portnames[m_input_strobe])->read());
397397         data = (((swizzle & 0x80) >> 1) + ((swizzle & 0x40) << 1));
398398         break;
399399      }
trunk/src/mame/drivers/ksys573.c
r21033r21034
12851285      }
12861286   }
12871287
1288   machine().root_device().ioport("OUT1")->write_safe( data, mem_mask );
1288   ioport("OUT1")->write_safe( data, mem_mask );
12891289}
12901290
12911291READ32_MEMBER(ksys573_state::security_r)
r21033r21034
14471447   {
14481448      /* patch out security-plate error */
14491449
1450      UINT32 *p_n_psxram = (UINT32 *)state->machine().root_device().memshare("share1")->ptr();
1450      UINT32 *p_n_psxram = (UINT32 *)state->memshare("share1")->ptr();
14511451
14521452      /* install cd */
14531453
r21033r21034
14711471   {
14721472      /* patch out security-plate error */
14731473
1474      UINT32 *p_n_psxram = (UINT32 *)state->machine().root_device().memshare("share1")->ptr();
1474      UINT32 *p_n_psxram = (UINT32 *)state->memshare("share1")->ptr();
14751475      /* 8001f850: jal $8003221c */
14761476      if( p_n_psxram[ 0x1f850 / 4 ] == 0x0c00c887 )
14771477      {
trunk/src/mame/drivers/taito_f3.c
r21033r21034
121121WRITE32_MEMBER(taito_f3_state::f3_sound_bankswitch_w)
122122{
123123   if (m_f3_game==KIRAMEKI) {
124      UINT16 *rom = (UINT16 *)machine().root_device().memregion("audiocpu")->base();
124      UINT16 *rom = (UINT16 *)memregion("audiocpu")->base();
125125      UINT32 idx;
126126
127127      idx = (offset << 1) & 0x1e;
trunk/src/mame/drivers/champbas.c
r21033r21034
12081208DRIVER_INIT_MEMBER(champbas_state,champbas)
12091209{
12101210   // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding
1211   UINT8 *rom1 = machine().root_device().memregion("gfx1")->base();
1212   UINT8 *rom2 = machine().root_device().memregion("gfx2")->base();
1213   int len = machine().root_device().memregion("gfx1")->bytes();
1211   UINT8 *rom1 = memregion("gfx1")->base();
1212   UINT8 *rom2 = memregion("gfx2")->base();
1213   int len = memregion("gfx1")->bytes();
12141214   int i;
12151215
12161216   for (i = 0; i < len/2; ++i)
r21033r21034
12251225DRIVER_INIT_MEMBER(champbas_state,exctsccr)
12261226{
12271227   // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding
1228   UINT8 *rom1 = machine().root_device().memregion("gfx1")->base();
1229   UINT8 *rom2 = machine().root_device().memregion("gfx2")->base();
1228   UINT8 *rom1 = memregion("gfx1")->base();
1229   UINT8 *rom2 = memregion("gfx2")->base();
12301230   int i;
12311231
12321232   // planes 0,1
trunk/src/mame/drivers/jackie.c
r21033r21034
541541DRIVER_INIT_MEMBER(jackie_state,jackie)
542542{
543543   int A;
544   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
544   UINT8 *rom = memregion("maincpu")->base();
545545
546546   for (A = 0;A < 0xf000;A++)
547547   {
trunk/src/mame/drivers/arkanoid.c
r21033r21034
16681668
16691669DRIVER_INIT_MEMBER(arkanoid_state,hexa)
16701670{
1671   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
1671   UINT8 *RAM = memregion("maincpu")->base();
16721672#if 0
16731673
16741674
r21033r21034
16821682   RAM[0x0126] = 0x00;
16831683#endif
16841684
1685   machine().root_device().membank("bank1")->configure_entries(0, 2, &RAM[0x10000], 0x4000);
1685   membank("bank1")->configure_entries(0, 2, &RAM[0x10000], 0x4000);
16861686}
16871687
16881688DRIVER_INIT_MEMBER(arkanoid_state,brixian)
16891689{
1690   UINT8 *RAM = machine().root_device().memregion("protdata")->base();
1690   UINT8 *RAM = memregion("protdata")->base();
16911691
16921692   for (int i=0x000;i<0x200;i++)
16931693      m_protram[i+0x600] = RAM[i];
trunk/src/mame/drivers/megasys1.c
r21033r21034
36103610
36113611void megasys1_state::rodlandj_gfx_unmangle(const char *region)
36123612{
3613   UINT8 *rom = machine().root_device().memregion(region)->base();
3614   int size = machine().root_device().memregion(region)->bytes();
3613   UINT8 *rom = memregion(region)->base();
3614   int size = memregion(region)->bytes();
36153615   UINT8 *buffer;
36163616   int i;
36173617
r21033r21034
36423642
36433643void megasys1_state::jitsupro_gfx_unmangle(const char *region)
36443644{
3645   UINT8 *rom = machine().root_device().memregion(region)->base();
3646   int size = machine().root_device().memregion(region)->bytes();
3645   UINT8 *rom = memregion(region)->base();
3646   int size = memregion(region)->bytes();
36473647   UINT8 *buffer;
36483648   int i;
36493649
r21033r21034
36693669
36703670void megasys1_state::stdragona_gfx_unmangle(const char *region)
36713671{
3672   UINT8 *rom = machine().root_device().memregion(region)->base();
3673   int size = machine().root_device().memregion(region)->bytes();
3672   UINT8 *rom = memregion(region)->base();
3673   int size = memregion(region)->bytes();
36743674   UINT8 *buffer;
36753675   int i;
36763676
r21033r21034
39003900
39013901   phantasm_rom_decode(machine(), "maincpu");
39023902
3903   //ROM  = (UINT16 *) machine().root_device().memregion("maincpu")->base();
3903   //ROM  = (UINT16 *) memregion("maincpu")->base();
39043904   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_r),this));
39053905   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2f000, 0x2f009, write16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_w),this));
39063906
r21033r21034
39233923
39243924DRIVER_INIT_MEMBER(megasys1_state,jitsupro)
39253925{
3926   //UINT16 *ROM  = (UINT16 *) machine().root_device().memregion("maincpu")->base();
3926   //UINT16 *ROM  = (UINT16 *) memregion("maincpu")->base();
39273927
39283928   astyanax_rom_decode(machine(), "maincpu");      // Code
39293929
trunk/src/mame/drivers/crshrace.c
r21033r21034
573573void crshrace_state::crshrace_patch_code( UINT16 offset )
574574{
575575   /* A hack which shows 3 player mode in code which is disabled */
576   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
576   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
577577   RAM[(offset + 0)/2] = 0x4e71;
578578   RAM[(offset + 2)/2] = 0x4e71;
579579   RAM[(offset + 4)/2] = 0x4e71;
trunk/src/mame/drivers/goal92.c
r21033r21034
7070WRITE8_MEMBER(goal92_state::adpcm_control_w)
7171{
7272   device_t *device = machine().device("msm");
73   machine().root_device().membank("bank1")->set_entry(data & 0x01);
73   membank("bank1")->set_entry(data & 0x01);
7474
7575   msm5205_reset_w(device, data & 0x08);
7676}
trunk/src/mame/drivers/wallc.c
r21033r21034
100100
101101void wallc_state::palette_init()
102102{
103   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
103   const UINT8 *color_prom = memregion("proms")->base();
104104   int i;
105105
106106   static const int resistances_rg[2] = { 330, 220 };
r21033r21034
262262   UINT8 c;
263263   UINT32 i;
264264
265   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
265   UINT8 *ROM = memregion("maincpu")->base();
266266
267267   for (i=0; i<0x2000*2; i++)
268268   {
r21033r21034
277277   UINT8 c;
278278   UINT32 i;
279279
280   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
280   UINT8 *ROM = memregion("maincpu")->base();
281281
282282   for (i=0; i<0x4000; i++)
283283   {
trunk/src/mame/drivers/glass.c
r21033r21034
289289   int i;
290290
291291   /* get a pointer to the source data */
292   UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base();
292   UINT8 *src = (UINT8 *)memregion(src_reg)->base();
293293
294294   /* get a pointer to the destination data */
295   UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base();
295   UINT8 *dst = (UINT8 *)memregion(dst_reg)->base();
296296
297297   /* fill destination areas with the proper data */
298298   for (i = 0; i < length / 2; i++)
trunk/src/mame/drivers/taito_z.c
r21033r21034
30523052
30533053MACHINE_START_MEMBER(taitoz_state,taitoz)
30543054{
3055   int banks = (machine().root_device().memregion("audiocpu")->bytes() - 0xc000) / 0x4000;
3055   int banks = (memregion("audiocpu")->bytes() - 0xc000) / 0x4000;
30563056
3057   machine().root_device().membank("bank10")->configure_entries(0, banks, machine().root_device().memregion("audiocpu")->base() + 0xc000, 0x4000);
3057   membank("bank10")->configure_entries(0, banks, memregion("audiocpu")->base() + 0xc000, 0x4000);
30583058
30593059   machine().save().register_postload(save_prepost_delegate(FUNC(taitoz_state::taitoz_postload), this));
30603060
trunk/src/mame/drivers/jchan.c
r21033r21034
319319   m_sprite_bitmap_1->fill(0x0000, cliprect);
320320   m_sprite_bitmap_2->fill(0x0000, cliprect);
321321
322   m_spritegen1->skns_draw_sprites(machine(), *m_sprite_bitmap_1, cliprect, m_sprite_ram32_1, 0x4000, machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion ("gfx1")->bytes(), m_sprite_regs32_1 );
323   m_spritegen2->skns_draw_sprites(machine(), *m_sprite_bitmap_2, cliprect, m_sprite_ram32_2, 0x4000, machine().root_device().memregion("gfx2")->base(), memregion ("gfx2")->bytes(), m_sprite_regs32_2 );
322   m_spritegen1->skns_draw_sprites(machine(), *m_sprite_bitmap_1, cliprect, m_sprite_ram32_1, 0x4000, memregion("gfx1")->base(), memregion ("gfx1")->bytes(), m_sprite_regs32_1 );
323   m_spritegen2->skns_draw_sprites(machine(), *m_sprite_bitmap_2, cliprect, m_sprite_ram32_2, 0x4000, memregion("gfx2")->base(), memregion ("gfx2")->bytes(), m_sprite_regs32_2 );
324324
325325   // ignoring priority bits for now - might use alpha too, check 0x8000 of palette writes
326326   for (y=0;y<240;y++)
trunk/src/mame/drivers/metalmx.c
r21033r21034
757757
758758DRIVER_INIT_MEMBER(metalmx_state,metalmx)
759759{
760   UINT8 *adsp_boot = (UINT8*)machine().root_device().memregion("adsp")->base();
760   UINT8 *adsp_boot = (UINT8*)memregion("adsp")->base();
761761
762762   m_adsp->load_boot_data(adsp_boot, m_adsp_internal_program_ram);
763763
trunk/src/mame/drivers/royalmah.c
r21033r21034
210210void royalmah_state::palette_init()
211211{
212212   offs_t i;
213   const UINT8 *prom = machine().root_device().memregion("proms")->base();
214   int len = machine().root_device().memregion("proms")->bytes();
213   const UINT8 *prom = memregion("proms")->base();
214   int len = memregion("proms")->bytes();
215215
216216   for (i = 0; i < len; i++)
217217   {
r21033r21034
245245PALETTE_INIT_MEMBER(royalmah_state,mjderngr)
246246{
247247   offs_t i;
248   const UINT8 *prom = machine().root_device().memregion("proms")->base();
249   int len = machine().root_device().memregion("proms")->bytes();
248   const UINT8 *prom = memregion("proms")->base();
249   int len = memregion("proms")->bytes();
250250
251251   for (i = 0; i < len / 2; i++)
252252   {
r21033r21034
429429READ8_MEMBER(royalmah_state::mjapinky_dsw_r)
430430{
431431   if (m_rombank == 0x0e)  return ioport("DSW3")->read();
432   else                    return *(machine().root_device().memregion("maincpu")->base() + 0x10000 + 0x8000 * m_rombank);
432   else                    return *(memregion("maincpu")->base() + 0x10000 + 0x8000 * m_rombank);
433433}
434434
435435WRITE8_MEMBER(royalmah_state::tontonb_bank_w)
r21033r21034
891891READ8_MEMBER(royalmah_state::mjifb_rom_io_r)
892892{
893893   if (m_mjifb_rom_enable)
894      return ((UINT8*)(machine().root_device().memregion("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
894      return ((UINT8*)(memregion("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
895895
896896   offset += 0x8000;
897897
r21033r21034
10001000READ8_MEMBER(royalmah_state::mjdejavu_rom_io_r)
10011001{
10021002   if (m_mjifb_rom_enable)
1003      return ((UINT8*)(machine().root_device().memregion("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
1003      return ((UINT8*)(memregion("maincpu")->base() + 0x10000 + m_rombank * 0x4000))[offset];
10041004
10051005   offset += 0x8000;
10061006
r21033r21034
47124712
47134713DRIVER_INIT_MEMBER(royalmah_state,ippatsu)
47144714{
4715   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x8000 );
4715   membank("bank1")->set_base(memregion("maincpu")->base() + 0x8000 );
47164716}
47174717
47184718DRIVER_INIT_MEMBER(royalmah_state,janptr96)
trunk/src/mame/drivers/crospang.c
r21033r21034
555555
556556void crospang_state::tumblepb_gfx1_rearrange()
557557{
558   UINT8 *rom = machine().root_device().memregion("gfx1")->base();
559   int len = machine().root_device().memregion("gfx1")->bytes();
558   UINT8 *rom = memregion("gfx1")->base();
559   int len = memregion("gfx1")->bytes();
560560   int i;
561561
562562   /* gfx data is in the wrong order */
trunk/src/mame/drivers/panicr.c
r21033r21034
117117
118118void panicr_state::palette_init()
119119{
120   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
120   const UINT8 *color_prom = memregion("proms")->base();
121121   int i;
122122
123123   /* allocate the colortable */
r21033r21034
176176{
177177   int code,attr;
178178
179   code=machine().root_device().memregion("user1")->base()[tile_index];
180   attr=machine().root_device().memregion("user2")->base()[tile_index];
179   code=memregion("user1")->base()[tile_index];
180   attr=memregion("user2")->base()[tile_index];
181181   code+=((attr&7)<<8);
182182   SET_TILE_INFO_MEMBER(
183183      1,
r21033r21034
190190{
191191   int code,attr;
192192
193   code=machine().root_device().memregion("user1")->base()[tile_index];
194   attr=machine().root_device().memregion("user2")->base()[tile_index];
193   code=memregion("user1")->base()[tile_index];
194   attr=memregion("user2")->base()[tile_index];
195195   code+=((attr&7)<<8);
196196   SET_TILE_INFO_MEMBER(
197197      2,
r21033r21034
620620
621621   t5182_init(machine());
622622
623   rom = machine().root_device().memregion("gfx1")->base();
624   size = machine().root_device().memregion("gfx1")->bytes();
623   rom = memregion("gfx1")->base();
624   size = memregion("gfx1")->bytes();
625625
626626   // text data lines
627627   for (i = 0;i < size/2;i++)
r21033r21034
643643   }
644644
645645
646   rom = machine().root_device().memregion("gfx2")->base();
647   size = machine().root_device().memregion("gfx2")->bytes();
646   rom = memregion("gfx2")->base();
647   size = memregion("gfx2")->bytes();
648648
649649   // tiles data lines
650650   for (i = 0;i < size/4;i++)
r21033r21034
670670   }
671671
672672
673   rom = machine().root_device().memregion("gfx3")->base();
674   size = machine().root_device().memregion("gfx3")->bytes();
673   rom = memregion("gfx3")->base();
674   size = memregion("gfx3")->bytes();
675675
676676   // sprites data lines
677677   for (i = 0;i < size/2;i++)
r21033r21034
695695   }
696696
697697   //rearrange  bg tilemaps a bit....
698   rom = machine().root_device().memregion("user1")->base();
699   size = machine().root_device().memregion("user1")->bytes();
698   rom = memregion("user1")->base();
699   size = memregion("user1")->bytes();
700700   memcpy(buf,rom, size);
701701
702702   for(j=0;j<16;j++)
r21033r21034
707707      }
708708   }
709709
710   rom = machine().root_device().memregion("user2")->base();
711   size = machine().root_device().memregion("user2")->bytes();
710   rom = memregion("user2")->base();
711   size = memregion("user2")->bytes();
712712   memcpy(buf,rom, size);
713713
714714   for(j=0;j<16;j++)
trunk/src/mame/drivers/galaga.c
r21033r21034
807807
808808READ8_MEMBER(galaga_state::namco_52xx_rom_r)
809809{
810   UINT32 length = machine().root_device().memregion("52xx")->bytes();
810   UINT32 length = memregion("52xx")->bytes();
811811//printf("ROM read %04X\n", offset);
812812   if (!(offset & 0x1000))
813813      offset = (offset & 0xfff) | 0x0000;
r21033r21034
817817      offset = (offset & 0xfff) | 0x2000;
818818   else if (!(offset & 0x8000))
819819      offset = (offset & 0xfff) | 0x3000;
820   return (offset < length) ? machine().root_device().memregion("52xx")->base()[offset] : 0xff;
820   return (offset < length) ? memregion("52xx")->base()[offset] : 0xff;
821821}
822822
823823READ8_MEMBER(galaga_state::namco_52xx_si_r)
r21033r21034
32883288DRIVER_INIT_MEMBER(galaga_state,galaga)
32893289{
32903290   /* swap bytes for flipped character so we can decode them together with normal characters */
3291   UINT8 *rom = machine().root_device().memregion("gfx1")->base();
3292   int i, len = machine().root_device().memregion("gfx1")->bytes();
3291   UINT8 *rom = memregion("gfx1")->base();
3292   int i, len = memregion("gfx1")->bytes();
32933293
32943294   for (i = 0;i < len;i++)
32953295   {
r21033r21034
33163316   UINT8 *rom;
33173317   int i;
33183318
3319   rom = machine().root_device().memregion("gfx3")->base() + 0x5000;
3319   rom = memregion("gfx3")->base() + 0x5000;
33203320   for (i = 0;i < 0x2000;i++)
33213321      rom[i + 0x2000] = rom[i] >> 4;
33223322}
r21033r21034
33283328
33293329
33303330   /* convert one of the sprite ROMs to the format used by Xevious */
3331   rom = machine().root_device().memregion("gfx3")->base();
3331   rom = memregion("gfx3")->base();
33323332   for (A = 0x5000;A < 0x7000;A++)
33333333   {
33343334      rom[A] = BITSWAP8(rom[A],1,3,5,7,0,2,4,6);
33353335   }
33363336
33373337   /* convert one of tile map ROMs to the format used by Xevious */
3338   rom = machine().root_device().memregion("gfx4")->base();
3338   rom = memregion("gfx4")->base();
33393339   for (A = 0x0000;A < 0x1000;A++)
33403340   {
33413341      rom[A] = BITSWAP8(rom[A],3,7,5,1,2,6,4,0);
trunk/src/mame/drivers/upscope.c
r21033r21034
220220      if (data & 4)
221221      {
222222         if (LOG_IO) logerror("Internal register (%d) read\n", m_nvram_address_latch);
223         m_nvram_data_latch = (m_nvram_address_latch == 0) ? machine().root_device().ioport("IO0")->read() : 0xff;
223         m_nvram_data_latch = (m_nvram_address_latch == 0) ? ioport("IO0")->read() : 0xff;
224224      }
225225
226226      /* if SEL == 0, we read NVRAM */
r21033r21034
404404
405405   /* set up memory */
406406   m_bank1->configure_entry(0, m_chip_ram);
407   m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base());
407   m_bank1->configure_entry(1, memregion("user1")->base());
408408}
409409
410410
trunk/src/mame/drivers/darkmist.c
r21033r21034
3232WRITE8_MEMBER(darkmist_state::darkmist_hw_w)
3333{
3434   m_hw=data;
35   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x010000+((data&0x80)?0x4000:0)]);
35   membank("bank1")->set_base(&memregion("maincpu")->base()[0x010000+((data&0x80)?0x4000:0)]);
3636}
3737
3838static ADDRESS_MAP_START( memmap, AS_PROGRAM, 8, darkmist_state )
r21033r21034
318318   int size;
319319   int i;
320320
321   rom = machine().root_device().memregion("gfx1")->base();
322   size = machine().root_device().memregion("gfx1")->bytes();
321   rom = memregion("gfx1")->base();
322   size = memregion("gfx1")->bytes();
323323
324324   /* data lines */
325325   for (i = 0;i < size/2;i++)
r21033r21034
341341   }
342342
343343
344   rom = machine().root_device().memregion("gfx2")->base();
345   size = machine().root_device().memregion("gfx2")->bytes();
344   rom = memregion("gfx2")->base();
345   size = memregion("gfx2")->bytes();
346346
347347   /* data lines */
348348   for (i = 0;i < size/2;i++)
r21033r21034
364364   }
365365
366366
367   rom = machine().root_device().memregion("gfx3")->base();
368   size = machine().root_device().memregion("gfx3")->bytes();
367   rom = memregion("gfx3")->base();
368   size = memregion("gfx3")->bytes();
369369
370370   /* data lines */
371371   for (i = 0;i < size/2;i++)
r21033r21034
392392void darkmist_state::decrypt_snd()
393393{
394394   int i;
395   UINT8 *ROM = machine().root_device().memregion("t5182")->base();
395   UINT8 *ROM = memregion("t5182")->base();
396396
397397   for(i=0x8000;i<0x10000;i++)
398398      ROM[i] = BITSWAP8(ROM[i], 7,1,2,3,4,5,6,0);
r21033r21034
402402{
403403   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
404404   int i, len;
405   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
405   UINT8 *ROM = memregion("maincpu")->base();
406406   UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x10000);
407407   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
408408
r21033r21034
437437   }
438438
439439   space.set_decrypted_region(0x0000, 0x7fff, decrypt);
440   space.machine().root_device().membank("bank1")->set_base(&ROM[0x010000]);
440   membank("bank1")->set_base(&ROM[0x010000]);
441441
442442   /* adr line swaps */
443   ROM = machine().root_device().memregion("user1")->base();
444   len = machine().root_device().memregion("user1")->bytes();
443   ROM = memregion("user1")->base();
444   len = memregion("user1")->bytes();
445445   memcpy( buffer, ROM, len );
446446
447447   for(i=0;i<len;i++)
r21033r21034
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().root_device().memregion("user2")->base();
453   len = machine().root_device().memregion("user2")->bytes();
452   ROM = memregion("user2")->base();
453   len = 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().root_device().memregion("user3")->base();
461   len = machine().root_device().memregion("user3")->bytes();
460   ROM = memregion("user3")->base();
461   len = 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().root_device().memregion("user4")->base();
469   len = machine().root_device().memregion("user4")->bytes();
468   ROM = memregion("user4")->base();
469   len = memregion("user4")->bytes();
470470   memcpy( buffer, ROM, len );
471471   for(i=0;i<len;i++)
472472   {
trunk/src/mame/drivers/equites.c
r21033r21034
18471847
18481848void equites_state::unpack_block( const char *region, int offset, int size )
18491849{
1850   UINT8 *rom = machine().root_device().memregion(region)->base();
1850   UINT8 *rom = memregion(region)->base();
18511851   int i;
18521852
18531853   for (i = 0; i < size; ++i)
trunk/src/mame/drivers/8080bw.c
r21033r21034
770770
771771DRIVER_INIT_MEMBER(_8080bw_state, spacecom)
772772{
773   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
773   UINT8 *ROM = memregion("maincpu")->base();
774774
775775   // bad byte: should be push a at RST 10h
776776   ROM[0x10] = 0xf5;
r21033r21034
25522552/* decrypt function for vortex */
25532553DRIVER_INIT_MEMBER(_8080bw_state,vortex)
25542554{
2555   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2556   int length = machine().root_device().memregion("maincpu")->bytes();
2555   UINT8 *rom = memregion("maincpu")->base();
2556   int length = memregion("maincpu")->bytes();
25572557   UINT8 *buf1 = auto_alloc_array(machine(), UINT8, length);
25582558   UINT32 x;
25592559   for (x = 0; x < length; x++)
r21033r21034
30713071
30723072DRIVER_INIT_MEMBER(_8080bw_state,invmulti)
30733073{
3074   UINT8 *src = machine().root_device().memregion("user1")->base();
3075   int len = machine().root_device().memregion("user1")->bytes();
3076   UINT8 *dest = machine().root_device().memregion("maincpu")->base();
3074   UINT8 *src = memregion("user1")->base();
3075   int len = memregion("user1")->bytes();
3076   UINT8 *dest = memregion("maincpu")->base();
30773077
30783078   // decrypt rom
30793079   for (int i = 0; i < len; i++)
trunk/src/mame/drivers/miniboy7.c
r21033r21034
220220
221221void miniboy7_state::palette_init()
222222{
223   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
223   const UINT8 *color_prom = memregion("proms")->base();
224224/*  FIXME... Can't get the correct palette.
225225    sometimes RGB bits are inverted, disregarding the 4th bit.
226226
trunk/src/mame/drivers/xyonix.c
r21033r21034
5555
5656   if (coin & 2)   // Coin 1 !
5757   {
58      tmp = (machine().root_device().ioport("DSW")->read() & 0x30) >> 4;
58      tmp = (ioport("DSW")->read() & 0x30) >> 4;
5959      m_coins++;
6060      if (m_coins >= coinage_table[tmp][0])
6161      {
trunk/src/mame/drivers/nycaptor.c
r21033r21034
329329WRITE8_MEMBER(nycaptor_state::nycaptor_generic_control_w)
330330{
331331   m_generic_control_reg = data;
332   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000 + ((data&0x08)>>3)*0x4000 );
332   membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000 + ((data&0x08)>>3)*0x4000 );
333333}
334334
335335static ADDRESS_MAP_START( nycaptor_master_map, AS_PROGRAM, 8, nycaptor_state )
r21033r21034
433433   int bank = (data >> 2) & 3;
434434
435435   m_generic_control_reg = data;
436   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000 + bank*0x4000 );
436   membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000 + bank*0x4000 );
437437}
438438
439439
trunk/src/mame/drivers/mitchell.c
r21033r21034
20832083void mitchell_state::bootleg_decode(  )
20842084{
20852085   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
2086   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x50000);
2087   machine().root_device().membank("bank1")->configure_decrypted_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x60000, 0x4000);
2086   space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x50000);
2087   membank("bank1")->configure_decrypted_entries(0, 16, memregion("maincpu")->base() + 0x60000, 0x4000);
20882088}
20892089
20902090
20912091void mitchell_state::configure_banks(  )
20922092{
2093   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
2093   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
20942094}
20952095
20962096
r21033r21034
22172217DRIVER_INIT_MEMBER(mitchell_state,mstworld)
22182218{
22192219   /* descramble the program rom .. */
2220   int len = machine().root_device().memregion("maincpu")->bytes();
2220   int len = memregion("maincpu")->bytes();
22212221   UINT8* source = auto_alloc_array(machine(), UINT8, len);
2222   UINT8* dst = machine().root_device().memregion("maincpu")->base() ;
2222   UINT8* dst = memregion("maincpu")->base() ;
22232223   int x;
22242224
22252225   static const int tablebank[]=
trunk/src/mame/drivers/deco_mlc.c
r21033r21034
692692void deco_mlc_state::descramble_sound(  )
693693{
694694   /* the same as simpl156 / heavy smash? */
695   UINT8 *rom = machine().root_device().memregion("ymz")->base();
696   int length = machine().root_device().memregion("ymz")->bytes();
695   UINT8 *rom = memregion("ymz")->base();
696   int length = memregion("ymz")->bytes();
697697   UINT8 *buf1 = auto_alloc_array(machine(), UINT8, length);
698698
699699   UINT32 x;
trunk/src/mame/drivers/cps1.c
r21033r21034
31373137MACHINE_START_MEMBER(cps_state,cps1)
31383138{
31393139   MACHINE_START_CALL_MEMBER(common);
3140   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
3140   membank("bank1")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0x4000);
31413141}
31423142
31433143MACHINE_START_MEMBER(cps_state,qsound)
31443144{
31453145   MACHINE_START_CALL_MEMBER(common);
3146   machine().root_device().membank("bank1")->configure_entries(0, 6, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
3146   membank("bank1")->configure_entries(0, 6, memregion("audiocpu")->base() + 0x10000, 0x4000);
31473147}
31483148
31493149static MACHINE_CONFIG_START( cps1_10MHz, cps_state )
r21033r21034
1106611066
1106711067DRIVER_INIT_MEMBER(cps_state,pang3)
1106811068{
11069   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
11069   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
1107011070   int A, src, dst;
1107111071
1107211072   for (A = 0x80000; A < 0x100000; A += 2)
trunk/src/mame/drivers/segas24.c
r21033r21034
712712
713713void segas24_state::reset_bank()
714714{
715   if (machine().root_device().memregion("romboard")->base())
715   if (memregion("romboard")->base())
716716   {
717717      membank("bank1")->set_entry(curbank & 15);
718718      membank("bank2")->set_entry(curbank & 15);
trunk/src/mame/drivers/ddayjlc.c
r21033r21034
482482
483483void ddayjlc_state::palette_init()
484484{
485   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
485   const UINT8 *color_prom = memregion("proms")->base();
486486   int i,r,g,b,val;
487487   int bit0,bit1,bit2;
488488
r21033r21034
667667      UINT8 *src, *dst, *temp;
668668      temp = auto_alloc_array(machine(), UINT8, 0x10000);
669669      src = temp;
670      dst = machine().root_device().memregion("gfx1")->base();
671      length = machine().root_device().memregion("gfx1")->bytes();
670      dst = memregion("gfx1")->base();
671      length = memregion("gfx1")->bytes();
672672      memcpy(src, dst, length);
673673      newadr = 0;
674674      oldaddr = 0;
r21033r21034
682682      auto_free(machine(), temp);
683683   }
684684
685   machine().root_device().membank("bank1")->configure_entries(0, 3, machine().root_device().memregion("user1")->base(), 0x4000);
686   machine().root_device().membank("bank1")->set_entry(0);
685   membank("bank1")->configure_entries(0, 3, memregion("user1")->base(), 0x4000);
686   membank("bank1")->set_entry(0);
687687}
688688
689689GAME( 1984, ddayjlc,  0,       ddayjlc, ddayjlc, ddayjlc_state, ddayjlc, ROT90, "Jaleco", "D-Day (Jaleco set 1)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/cop01.c
r21033r21034
640640#if MIGHTGUY_HACK
641641   /* This is a hack to fix the game code to get a fully working
642642      "Starting Area" fake Dip Switch */
643   UINT8 *RAM = (UINT8 *)machine().root_device().memregion("maincpu")->base();
643   UINT8 *RAM = (UINT8 *)memregion("maincpu")->base();
644644   RAM[0x00e4] = 0x07; // rlca
645645   RAM[0x00e5] = 0x07; // rlca
646646   RAM[0x00e6] = 0x07; // rlca
trunk/src/mame/drivers/bublbobl.c
r21033r21034
15331533
15341534void bublbobl_state::configure_banks(  )
15351535{
1536   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1537   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
1536   UINT8 *ROM = memregion("maincpu")->base();
1537   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
15381538}
15391539
15401540DRIVER_INIT_MEMBER(bublbobl_state,bublbobl)
r21033r21034
15651565{
15661566   // rearrange gfx to original format
15671567   int i;
1568   UINT8* src = machine().root_device().memregion("gfx1")->base();
1568   UINT8* src = memregion("gfx1")->base();
15691569   for (i = 0; i < 0x40000; i++)
15701570      src[i] = BITSWAP8(src[i],7,6,5,4,0,1,2,3);
15711571
trunk/src/mame/drivers/quantum.c
r21033r21034
8383
8484READ8_MEMBER(quantum_state::input_1_r)
8585{
86   return (machine().root_device().ioport("DSW0")->read() << (7 - (offset - pokey_device::POT0_C))) & 0x80;
86   return (ioport("DSW0")->read() << (7 - (offset - pokey_device::POT0_C))) & 0x80;
8787}
8888
8989
9090READ8_MEMBER(quantum_state::input_2_r)
9191{
92   return (machine().root_device().ioport("DSW1")->read() << (7 - (offset - pokey_device::POT0_C))) & 0x80;
92   return (ioport("DSW1")->read() << (7 - (offset - pokey_device::POT0_C))) & 0x80;
9393}
9494
9595
trunk/src/mame/drivers/coinmstr.c
r21033r21034
12261226
12271227DRIVER_INIT_MEMBER(coinmstr_state,coinmstr)
12281228{
1229   UINT8 *rom = machine().root_device().memregion("user1")->base();
1230   int length = machine().root_device().memregion("user1")->bytes();
1229   UINT8 *rom = memregion("user1")->base();
1230   int length = memregion("user1")->bytes();
12311231   UINT8 *buf = auto_alloc_array(machine(), UINT8, length);
12321232   int i;
12331233
trunk/src/mame/drivers/snowbros.c
r21033r21034
27042704DRIVER_INIT_MEMBER(snowbros_state,4in1boot)
27052705{
27062706   UINT8 *buffer;
2707   UINT8 *src = machine().root_device().memregion("maincpu")->base();
2708   int len = machine().root_device().memregion("maincpu")->bytes();
2707   UINT8 *src = memregion("maincpu")->base();
2708   int len = memregion("maincpu")->bytes();
27092709
27102710   /* strange order */
27112711   buffer = auto_alloc_array(machine(), UINT8, len);
r21033r21034
27192719      auto_free(machine(), buffer);
27202720   }
27212721
2722   src = machine().root_device().memregion("soundcpu")->base();
2723   len = machine().root_device().memregion("soundcpu")->bytes();
2722   src = memregion("soundcpu")->base();
2723   len = memregion("soundcpu")->bytes();
27242724
27252725   /* strange order */
27262726   buffer = auto_alloc_array(machine(), UINT8, len);
r21033r21034
27372737DRIVER_INIT_MEMBER(snowbros_state,snowbro3)
27382738{
27392739   UINT8 *buffer;
2740   UINT8 *src = machine().root_device().memregion("maincpu")->base();
2741   int len = machine().root_device().memregion("maincpu")->bytes();
2740   UINT8 *src = memregion("maincpu")->base();
2741   int len = memregion("maincpu")->bytes();
27422742
27432743   /* strange order */
27442744   buffer = auto_alloc_array(machine(), UINT8, len);
trunk/src/mame/drivers/pcktgal.c
r21033r21034
221221
222222void pcktgal_state::machine_start()
223223{
224   machine().root_device().membank("bank3")->configure_entries(0, 2, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
224   membank("bank3")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0x4000);
225225}
226226
227227static MACHINE_CONFIG_START( pcktgal, pcktgal_state )
r21033r21034
425425
426426DRIVER_INIT_MEMBER(pcktgal_state,pcktgal)
427427{
428   UINT8 *rom = machine().root_device().memregion("gfx1")->base();
429   int len = machine().root_device().memregion("gfx1")->bytes();
428   UINT8 *rom = memregion("gfx1")->base();
429   int len = memregion("gfx1")->bytes();
430430   int i,j,temp[16];
431431
432432   /* Tile graphics roms have some swapped lines, original version only */
trunk/src/mame/drivers/cntsteer.c
r21033r21034
101101
102102PALETTE_INIT_MEMBER(cntsteer_state,zerotrgt)
103103{
104   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
104   const UINT8 *color_prom = memregion("proms")->base();
105105   int i;
106106   for (i = 0; i < machine().total_colors(); i++)
107107   {
r21033r21034
11421142
11431143void cntsteer_state::zerotrgt_rearrange_gfx( int romsize, int romarea )
11441144{
1145   UINT8 *src = machine().root_device().memregion("gfx4")->base();
1146   UINT8 *dst = machine().root_device().memregion("gfx3")->base();
1145   UINT8 *src = memregion("gfx4")->base();
1146   UINT8 *dst = memregion("gfx3")->base();
11471147   int rm;
11481148   int cnt1;
11491149
r21033r21034
11621162#if 0
11631163DRIVER_INIT_MEMBER(cntsteer_state,cntsteer)
11641164{
1165   UINT8 *RAM = machine().root_device().memregion("subcpu")->base();
1165   UINT8 *RAM = memregion("subcpu")->base();
11661166
11671167   RAM[0xc2cf] = 0x43; /* Patch out Cpu 1 ram test - it never ends..?! */
11681168   RAM[0xc2d0] = 0x43;
trunk/src/mame/drivers/poker72.c
r21033r21034
343343
344344void poker72_state::machine_reset()
345345{
346   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
346   UINT8 *ROM = memregion("maincpu")->base();
347347
348   machine().root_device().membank("bank1")->set_base(&ROM[0]);
348   membank("bank1")->set_base(&ROM[0]);
349349}
350350
351351static MACHINE_CONFIG_START( poker72, poker72_state )
r21033r21034
394394
395395DRIVER_INIT_MEMBER(poker72_state,poker72)
396396{
397   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
397   UINT8 *rom = memregion("maincpu")->base();
398398
399399   rom[0x4a9] = 0x28;
400400}
trunk/src/mame/drivers/goindol.c
r21033r21034
371371
372372DRIVER_INIT_MEMBER(goindol_state,goindol)
373373{
374   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
374   UINT8 *rom = memregion("maincpu")->base();
375375
376376
377377   /* I hope that's all patches to avoid protection */
trunk/src/mame/drivers/spoker.c
r21033r21034
563563DRIVER_INIT_MEMBER(spoker_state,spk116it)
564564{
565565   int A;
566   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
566   UINT8 *rom = memregion("maincpu")->base();
567567
568568
569569   for (A = 0;A < 0x10000;A++)
r21033r21034
670670
671671DRIVER_INIT_MEMBER(spoker_state,3super8)
672672{
673   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
673   UINT8 *ROM = memregion("maincpu")->base();
674674   int i;
675675
676676   /* Decryption is probably done using one macrocell/output on an address decoding pal which we do not have a dump of */
r21033r21034
688688
689689   /* cheesy hack: take gfx roms from spk116it and rearrange them for this game needs */
690690   {
691      UINT8 *src = machine().root_device().memregion("rep_gfx")->base();
692      UINT8 *dst = machine().root_device().memregion("gfx1")->base();
691      UINT8 *src = memregion("rep_gfx")->base();
692      UINT8 *dst = memregion("gfx1")->base();
693693      UINT8 x;
694694
695695      for(x=0;x<3;x++)
trunk/src/mame/drivers/discoboy.c
r21033r21034
205205#ifdef UNUSED_FUNCTION
206206void discoboy_state::discoboy_setrombank( UINT8 data )
207207{
208   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
208   UINT8 *ROM = memregion("maincpu")->base();
209209   data &= 0x2f;
210   space.machine().root_device().membank("bank1")->set_base(&ROM[0x6000 + (data * 0x1000)] );
210   space.membank("bank1")->set_base(&ROM[0x6000 + (data * 0x1000)] );
211211}
212212#endif
213213
r21033r21034
331331   /* Note: this is bit 5 on yunsung8.c */
332332   msm5205_reset_w(device, (data & 0x08) >> 3);
333333
334   machine().root_device().membank("sndbank")->set_entry(data & 0x07);
334   membank("sndbank")->set_entry(data & 0x07);
335335
336336   if (data != (data & (~0x0f)))
337337      logerror("%s: Bank %02X\n", machine().describe_context(), data);
trunk/src/mame/drivers/mpu4mod4yam.c
r21033r21034
1515{
1616   // many original barcrest / bwb sets have identification info around here
1717   // this helps with sorting
18   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
19   int size = machine().root_device().memregion( "maincpu" )->bytes();
18   UINT8 *src = memregion( "maincpu" )->base();
19   int size = memregion( "maincpu" )->bytes();
2020
2121   for (int j=0;j<size;j+=0x10000)
2222   {
trunk/src/mame/drivers/tmnt.c
r21033r21034
907907      CellSrc = m_tmnt2_1c0800[0x00] | (m_tmnt2_1c0800[0x01] << 16 );
908908//        if (CellDest >= 0x180000 && CellDest < 0x183fe0) {
909909      CellVar -= 0x104000;
910      src = (UINT16 *)(machine().root_device().memregion("maincpu")->base() + CellSrc);
910      src = (UINT16 *)(memregion("maincpu")->base() + CellSrc);
911911
912912      CellVar >>= 1;
913913
r21033r21034
25662566MACHINE_START_MEMBER(tmnt_state,prmrsocr)
25672567{
25682568   MACHINE_START_CALL_MEMBER(common);
2569   UINT8 *ROM = machine().root_device().memregion("audiocpu")->base();
2570   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
2569   UINT8 *ROM = memregion("audiocpu")->base();
2570   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
25712571}
25722572
25732573static MACHINE_CONFIG_START( prmrsocr, tmnt_state )
r21033r21034
40914091       be shuffled around because the ROMs are connected differently to the
40924092       051962 custom IC.
40934093   */
4094   gfxdata = machine().root_device().memregion("gfx1")->base();
4095   len = machine().root_device().memregion("gfx1")->bytes();
4094   gfxdata = memregion("gfx1")->base();
4095   len = memregion("gfx1")->bytes();
40964096   for (i = 0; i < len; i += 4)
40974097   {
40984098      for (j = 0; j < 4; j++)
r21033r21034
41124112       be shuffled around because the ROMs are connected differently to the
41134113       051937 custom IC.
41144114   */
4115   gfxdata = machine().root_device().memregion("gfx2")->base();
4116   len = machine().root_device().memregion("gfx2")->bytes();
4115   gfxdata = memregion("gfx2")->base();
4116   len = memregion("gfx2")->bytes();
41174117   for (i = 0; i < len; i += 4)
41184118   {
41194119      for (j = 0; j < 4; j++)
r21033r21034
41844184       be shuffled around because the ROMs are connected differently to the
41854185       051962 custom IC.
41864186   */
4187   gfxdata = machine().root_device().memregion("gfx1")->base();
4188   len = machine().root_device().memregion("gfx1")->bytes();
4187   gfxdata = memregion("gfx1")->base();
4188   len = memregion("gfx1")->bytes();
41894189   for (i = 0; i < len; i += 4)
41904190   {
41914191      for (j = 0; j < 4; j++)
r21033r21034
42054205       be shuffled around because the ROMs are connected differently to the
42064206       051937 custom IC.
42074207   */
4208   gfxdata = machine().root_device().memregion("gfx2")->base();
4209   len = machine().root_device().memregion("gfx2")->bytes();
4208   gfxdata = memregion("gfx2")->base();
4209   len = memregion("gfx2")->bytes();
42104210   for (i = 0; i < len; i += 4)
42114211   {
42124212      for (j = 0; j < 4; j++)
r21033r21034
42234223
42244224   temp = auto_alloc_array(machine(), UINT8, len);
42254225   memcpy(temp, gfxdata, len);
4226   code_conv_table = &machine().root_device().memregion("proms")->base()[0x0000];
4226   code_conv_table = &memregion("proms")->base()[0x0000];
42274227   for (A = 0; A < len / 4; A++)
42284228   {
42294229#define CA0 0
trunk/src/mame/drivers/turbo.c
r21033r21034
16131613      2,1,2,1  /* 0x5000-0x5fff */
16141614   };
16151615
1616   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
1616   UINT8 *RAM = memregion("maincpu")->base();
16171617   int offs, i, j;
16181618   UINT8 src;
16191619
trunk/src/mame/drivers/rohga.c
r21033r21034
15491549
15501550DRIVER_INIT_MEMBER(rohga_state,schmeisr)
15511551{
1552   const UINT8 *src = machine().root_device().memregion("gfx2")->base();
1553   UINT8 *dst = machine().root_device().memregion("gfx1")->base();
1552   const UINT8 *src = memregion("gfx2")->base();
1553   UINT8 *dst = memregion("gfx1")->base();
15541554
15551555   memcpy(dst, src, 0x20000);
15561556   memcpy(dst + 0x20000, src + 0x80000, 0x20000);
trunk/src/mame/drivers/speedatk.c
r21033r21034
9494
9595      for (t = 0 ; t < 8 ; t ++)
9696      {
97         if (!(machine().root_device().ioport(keynames[j+p_side])->read() & ( 1 << t )))
97         if (!(ioport(keynames[j+p_side])->read() & ( 1 << t )))
9898         {
9999            return (i + t) | (p_side ? 0x20 : 0x00);
100100         }
trunk/src/mame/drivers/coinmvga.c
r21033r21034
876876DRIVER_INIT_MEMBER(coinmvga_state,colorama)
877877{
878878   UINT16 *ROM;
879   ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
879   ROM = (UINT16 *)memregion("maincpu")->base();
880880
881881   // rte in non-irq routines? wtf? patch them to rts...
882882   ROM[0x02B476/2] = 0x5470;
r21033r21034
893893DRIVER_INIT_MEMBER(coinmvga_state,cmrltv75)
894894{
895895   UINT16 *ROM;
896   ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
896   ROM = (UINT16 *)memregion("maincpu")->base();
897897
898898   // rte in non-irq routines? wtf? patch them to rts...
899899   ROM[0x056fd6/2] = 0x5470;
trunk/src/mame/drivers/jpmsys5.c
r21033r21034
827827
828828MACHINE_START_MEMBER(jpmsys5_state,jpmsys5)
829829{
830//  machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()+0x20000);
830//  membank("bank1")->set_base(memregion("maincpu")->base()+0x20000);
831831}
832832
833833MACHINE_RESET_MEMBER(jpmsys5_state,jpmsys5)
trunk/src/mame/drivers/corona.c
r21033r21034
359359
360360void corona_state::palette_init()
361361{
362   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
362   const UINT8 *color_prom = memregion("proms")->base();
363363   int bit6, bit7, bit0, bit1, r, g, b;
364364   int i;
365365
trunk/src/mame/drivers/balsente.c
r21033r21034
20762076
20772077   UINT8 *temp = auto_alloc_array(machine(), UINT8, 0x20000);
20782078   {
2079      UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2080      UINT32 len = machine().root_device().memregion("maincpu")->bytes();
2079      UINT8 *rom = memregion("maincpu")->base();
2080      UINT32 len = memregion("maincpu")->bytes();
20812081      UINT32 base;
20822082
20832083      for (base = 0x10000; base < len; base += 0x30000)
r21033r21034
21502150DRIVER_INIT_MEMBER(balsente_state,triviag1)  { expand_roms(EXPAND_ALL);  config_shooter_adc(FALSE, 0 /* noanalog */); }
21512151DRIVER_INIT_MEMBER(balsente_state,triviag2)
21522152{
2153   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2153   UINT8 *rom = memregion("maincpu")->base();
21542154   memcpy(&rom[0x20000], &rom[0x28000], 0x4000);
21552155   memcpy(&rom[0x24000], &rom[0x28000], 0x4000);
21562156   expand_roms(EXPAND_NONE); config_shooter_adc(FALSE, 0 /* noanalog */);
trunk/src/mame/drivers/galpani3.c
r21033r21034
346346
347347   m_sprite_bitmap_1.fill(0x0000, cliprect);
348348
349   m_spritegen->skns_draw_sprites(machine(), m_sprite_bitmap_1, cliprect, &m_spriteram32[0], 0x4000, machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion ("gfx1")->bytes(), m_spc_regs );
349   m_spritegen->skns_draw_sprites(machine(), m_sprite_bitmap_1, cliprect, &m_spriteram32[0], 0x4000, memregion("gfx1")->base(), memregion ("gfx1")->bytes(), m_spc_regs );
350350
351351   // ignoring priority bits for now..
352352   for (y=0;y<240;y++)
trunk/src/mame/drivers/fitfight.c
r21033r21034
992992
993993DRIVER_INIT_MEMBER(fitfight_state,fitfight)
994994{
995//  UINT16 *mem16 = (UINT16 *)machine().root_device().memregion("maincpu")->base();
995//  UINT16 *mem16 = (UINT16 *)memregion("maincpu")->base();
996996//  mem16[0x0165B2/2] = 0x4e71; // for now so it boots
997997   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::fitfight_700000_r),this));
998998   m_bbprot_kludge = 0;
r21033r21034
10001000
10011001DRIVER_INIT_MEMBER(fitfight_state,histryma)
10021002{
1003//  UINT16 *mem16 = (UINT16 *)machine().root_device().memregion("maincpu")->base();
1003//  UINT16 *mem16 = (UINT16 *)memregion("maincpu")->base();
10041004//  mem16[0x017FDC/2] = 0x4e71; // for now so it boots
10051005   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::histryma_700000_r),this));
10061006   m_bbprot_kludge = 0;
trunk/src/mame/drivers/epos.c
r21033r21034
102102*/
103103WRITE8_MEMBER(epos_state::write_prtc)
104104{
105   machine().root_device().membank("bank2")->set_entry(data & 0x01);
105   membank("bank2")->set_entry(data & 0x01);
106106}
107107
108108static I8255A_INTERFACE( ppi8255_intf )
r21033r21034
379379
380380MACHINE_START_MEMBER(epos_state,dealer)
381381{
382   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
383   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x0000], 0x10000);
384   machine().root_device().membank("bank2")->configure_entries(0, 2, &ROM[0x6000], 0x1000);
382   UINT8 *ROM = memregion("maincpu")->base();
383   membank("bank1")->configure_entries(0, 4, &ROM[0x0000], 0x10000);
384   membank("bank2")->configure_entries(0, 2, &ROM[0x6000], 0x1000);
385385
386   machine().root_device().membank("bank1")->set_entry(0);
387   machine().root_device().membank("bank2")->set_entry(0);
386   membank("bank1")->set_entry(0);
387   membank("bank2")->set_entry(0);
388388
389389   MACHINE_START_CALL_MEMBER(epos);
390390}
r21033r21034
602602
603603DRIVER_INIT_MEMBER(epos_state,dealer)
604604{
605   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
605   UINT8 *rom = memregion("maincpu")->base();
606606   int A;
607607
608608   /* Key 0 */
trunk/src/mame/drivers/cps3.c
r21033r21034
12741274   /* BIOS ROM */
12751275   if (address < 0x80000)
12761276   {
1277      direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, *direct.space().machine().root_device().memregion("user1"));
1277      direct.explicit_configure(0x00000, 0x7ffff, 0x7ffff, *memregion("user1"));
12781278      return ~0;
12791279   }
12801280   /* RAM */
trunk/src/mame/drivers/dbz.c
r21033r21034
522522{
523523   UINT16 *ROM;
524524
525   ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
525   ROM = (UINT16 *)memregion("maincpu")->base();
526526
527527   // to avoid crash during loop at 0x00076e after D4 > 0x80 (reading tiles region out of bounds)
528528   ROM[0x76c/2] = 0x007f;    /* 0x00ff */
r21033r21034
555555{
556556   UINT16 *ROM;
557557
558   ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
558   ROM = (UINT16 *)memregion("maincpu")->base();
559559
560560   // nop out dbz1's mask rom test
561561   // tile ROM test
r21033r21034
578578{
579579   UINT16 *ROM;
580580
581   ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
581   ROM = (UINT16 *)memregion("maincpu")->base();
582582
583583   // to avoid crash during loop at 0x000a4a after D4 > 0x80 (reading tiles region out of bounds)
584584   ROM[0xa48/2] = 0x007f;    /* 0x00ff */
trunk/src/mame/drivers/drw80pkr.c
r21033r21034
348348
349349void drw80pkr_state::palette_init()
350350{
351   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
351   const UINT8 *color_prom = memregion("proms")->base();
352352   int j;
353353
354354   for (j = 0; j < machine().total_colors(); j++)
r21033r21034
406406
407407DRIVER_INIT_MEMBER(drw80pkr_state,drw80pkr)
408408{
409   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base(), 0x1000);
409   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base(), 0x1000);
410410}
411411
412412
trunk/src/mame/drivers/shangkid.c
r21033r21034
144144{
145145   machine().device("bbx")->execute().set_input_line(INPUT_LINE_HALT, 1 );
146146
147   machine().root_device().membank("bank1")->set_entry(0);
148   machine().root_device().membank("bank2")->set_entry(0);
147   membank("bank1")->set_entry(0);
148   membank("bank2")->set_entry(0);
149149}
150150
151151/***************************************************************************************/
trunk/src/mame/drivers/rastan.c
r21033r21034
163163
164164WRITE8_MEMBER(rastan_state::rastan_bankswitch_w)
165165{
166   machine().root_device().membank("bank1")->set_entry(data & 3);
166   membank("bank1")->set_entry(data & 3);
167167}
168168
169169
trunk/src/mame/drivers/fastfred.c
r21033r21034
139139
140140WRITE8_MEMBER(fastfred_state::imago_sprites_dma_w)
141141{
142   UINT8 *rom = (UINT8 *)machine().root_device().memregion("gfx2")->base();
142   UINT8 *rom = (UINT8 *)memregion("gfx2")->base();
143143   UINT8 sprites_data;
144144
145145   sprites_data = rom[m_imago_sprites_address + 0x2000*0 + m_imago_sprites_bank * 0x1000];
trunk/src/mame/drivers/maxaflex.c
r21033r21034
373373
374374READ8_MEMBER(maxaflex_state::maxaflex_atari_pia_pa_r)
375375{
376   return atari_input_disabled() ? 0xFF : machine().root_device().ioport("djoy_0_1")->read_safe(0);
376   return atari_input_disabled() ? 0xFF : ioport("djoy_0_1")->read_safe(0);
377377}
378378
379379READ8_MEMBER(maxaflex_state::maxaflex_atari_pia_pb_r)
380380{
381   return atari_input_disabled() ? 0xFF : machine().root_device().ioport("djoy_2_3")->read_safe(0);
381   return atari_input_disabled() ? 0xFF : ioport("djoy_2_3")->read_safe(0);
382382}
383383
384384
r21033r21034
508508
509509DRIVER_INIT_MEMBER(maxaflex_state,a600xl)
510510{
511   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
511   UINT8 *rom = memregion("maincpu")->base();
512512   memcpy( rom + 0x5000, rom + 0xd000, 0x800 );
513513}
514514
trunk/src/mame/drivers/pirates.c
r21033r21034
341341   UINT16 *buf, *rom;
342342   int i;
343343
344   rom_size = machine().root_device().memregion("maincpu")->bytes();
344   rom_size = memregion("maincpu")->bytes();
345345
346346   buf = auto_alloc_array(machine(), UINT16, rom_size/2);
347347
348   rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
348   rom = (UINT16 *)memregion("maincpu")->base();
349349   memcpy (buf, rom, rom_size);
350350
351351   for (i=0; i<rom_size/2; i++)
r21033r21034
370370   UINT8 *buf, *rom;
371371   int i;
372372
373   rom_size = machine().root_device().memregion("gfx1")->bytes();
373   rom_size = memregion("gfx1")->bytes();
374374
375375   buf = auto_alloc_array(machine(), UINT8, rom_size);
376376
377   rom = machine().root_device().memregion("gfx1")->base();
377   rom = memregion("gfx1")->base();
378378   memcpy (buf, rom, rom_size);
379379
380380   for (i=0; i<rom_size/4; i++)
r21033r21034
394394   UINT8 *buf, *rom;
395395   int i;
396396
397   rom_size = machine().root_device().memregion("gfx2")->bytes();
397   rom_size = memregion("gfx2")->bytes();
398398
399399   buf = auto_alloc_array(machine(), UINT8, rom_size);
400400
401   rom = machine().root_device().memregion("gfx2")->base();
401   rom = memregion("gfx2")->base();
402402   memcpy (buf, rom, rom_size);
403403
404404   for (i=0; i<rom_size/4; i++)
r21033r21034
419419   UINT8 *buf, *rom;
420420   int i;
421421
422   rom_size = machine().root_device().memregion("oki")->bytes();
422   rom_size = memregion("oki")->bytes();
423423
424424   buf = auto_alloc_array(machine(), UINT8, rom_size);
425425
426   rom = machine().root_device().memregion("oki")->base();
426   rom = memregion("oki")->base();
427427   memcpy (buf, rom, rom_size);
428428
429429   for (i=0; i<rom_size; i++)
r21033r21034
437437
438438DRIVER_INIT_MEMBER(pirates_state,pirates)
439439{
440   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
440   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
441441
442442   pirates_decrypt_68k();
443443   pirates_decrypt_p();
trunk/src/mame/drivers/atvtrack.c
r21033r21034
333333   UINT8 *src, *dst;
334334
335335   m_nandaddressstep = 0;
336   m_nandregion = machine().root_device().memregion("maincpu");
336   m_nandregion = memregion("maincpu");
337337   address_space &as = machine().device("maincpu")->memory().space(AS_PROGRAM);
338338   dst = (UINT8 *)(as.get_write_ptr(0x0c7f0000));
339339   src = m_nandregion->base()+0x10;
trunk/src/mame/drivers/xorworld.c
r21033r21034
224224   /*  patch some strange protection (without this, strange characters appear
225225       after level 5 and some pieces don't rotate properly some times) */
226226
227   UINT16 *rom = (UINT16 *)(machine().root_device().memregion("maincpu")->base() + 0x1390);
227   UINT16 *rom = (UINT16 *)(memregion("maincpu")->base() + 0x1390);
228228
229229   PATCH(0x4239); PATCH(0x00ff); PATCH(0xe196);    /* clr.b $ffe196 */
230230   PATCH(0x4239); PATCH(0x00ff); PATCH(0xe197);    /* clr.b $ffe197 */
trunk/src/mame/drivers/bfcobra.c
r21033r21034
445445      addr &= 0xffff;
446446      addr += (m_bank_data[0] & 1) ? 0x10000 : 0;
447447
448      return (UINT8*)(machine().root_device().memregion("user1")->base() + addr + ((m_bank_data[0] >> 1) * 0x20000));
448      return (UINT8*)(memregion("user1")->base() + addr + ((m_bank_data[0] >> 1) * 0x20000));
449449   }
450450   else if (addr >= 0x20000 && addr < 0x40000)
451451   {
r21033r21034
10371037   {
10381038      UINT32 offset = ((m_bank_data[0] >> 1) * 0x20000) + ((0x4000 * data) ^ ((m_bank_data[0] & 1) ? 0 : 0x10000));
10391039
1040      membank(bank_names[num - 1])->set_base(machine().root_device().memregion("user1")->base() + offset);
1040      membank(bank_names[num - 1])->set_base(memregion("user1")->base() + offset);
10411041   }
10421042   else if (data < 0x10)
10431043   {
r21033r21034
11481148            }
11491149
11501150            fdc.offset = (BPT * fdc.track*2) + (fdc.side ? BPT : 0) + (BPS * (fdc.sector-1)) + fdc.byte_pos++;
1151            val = *(machine().root_device().memregion("user2")->base() + fdc.offset);
1151            val = *(memregion("user2")->base() + fdc.offset);
11521152
11531153            /* Move on to next sector? */
11541154            if (fdc.byte_pos == 1024)
r21033r21034
17081708   UINT8 *tmp;
17091709
17101710   tmp = auto_alloc_array(machine(), UINT8, 0x8000);
1711   rom = machine().root_device().memregion("audiocpu")->base() + 0x8000;
1711   rom = memregion("audiocpu")->base() + 0x8000;
17121712   memcpy(tmp, rom, 0x8000);
17131713
17141714   for (i = 0; i < 0x8000; i++)
r21033r21034
17371737   m_bank_data[3] = 0;
17381738
17391739   /* Fixed 16kB ROM region */
1740   membank("bank4")->set_base(machine().root_device().memregion("user1")->base());
1740   membank("bank4")->set_base(memregion("user1")->base());
17411741
17421742   /* TODO: Properly sort out the data ACIA */
17431743   m_data_r = 1;
trunk/src/mame/drivers/peplus.c
r21033r21034
981981
982982void peplus_state::palette_init()
983983{
984   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
984   const UINT8 *color_prom = memregion("proms")->base();
985985/*  prom bits
986986    7654 3210
987987    ---- -xxx   red component.
trunk/src/mame/drivers/wiz.c
r21033r21034
10541054      { 5,7,3, 0x28 }
10551055   };
10561056   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
1057   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1058   int size = machine().root_device().memregion("maincpu")->bytes();
1057   UINT8 *rom = memregion("maincpu")->base();
1058   int size = memregion("maincpu")->bytes();
10591059   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size);
10601060   int A;
10611061   const UINT8 *tbl;
trunk/src/mame/drivers/ddenlovr.c
r21033r21034
13121312
13131313#if 0
13141314   static int base = 0x0;
1315   const UINT8 *gfx = machine().root_device().memregion("blitter")->base();
1315   const UINT8 *gfx = memregion("blitter")->base();
13161316   int next;
13171317   memset(m_ddenlovr_pixmap[0], 0, 512 * 512);
13181318   memset(m_ddenlovr_pixmap[1], 0, 512 * 512);
r21033r21034
87848784
87858785MACHINE_START_MEMBER(dynax_state,rongrong)
87868786{
8787   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8788   machine().root_device().membank("bank1")->configure_entries(0, 0x20, &ROM[0x010000], 0x8000);
8789   machine().root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x110000], 0x1000);
8787   UINT8 *ROM = memregion("maincpu")->base();
8788   membank("bank1")->configure_entries(0, 0x20, &ROM[0x010000], 0x8000);
8789   membank("bank2")->configure_entries(0, 8,    &ROM[0x110000], 0x1000);
87908790
87918791   MACHINE_START_CALL_MEMBER(ddenlovr);
87928792}
87938793
87948794MACHINE_START_MEMBER(dynax_state,mmpanic)
87958795{
8796   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8797   machine().root_device().membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
8796   UINT8 *ROM = memregion("maincpu")->base();
8797   membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
87988798
87998799   MACHINE_START_CALL_MEMBER(ddenlovr);
88008800}
88018801
88028802MACHINE_START_MEMBER(dynax_state,funkyfig)
88038803{
8804   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8805   machine().root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8806   machine().root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
8804   UINT8 *ROM = memregion("maincpu")->base();
8805   membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8806   membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
88078807
88088808   MACHINE_START_CALL_MEMBER(ddenlovr);
88098809}
88108810
88118811MACHINE_START_MEMBER(dynax_state,hanakanz)
88128812{
8813   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8814   machine().root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8815   machine().root_device().membank("bank2")->configure_entries(0, 0x10, &ROM[0x90000], 0x1000);
8813   UINT8 *ROM = memregion("maincpu")->base();
8814   membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8815   membank("bank2")->configure_entries(0, 0x10, &ROM[0x90000], 0x1000);
88168816
88178817   MACHINE_START_CALL_MEMBER(ddenlovr);
88188818}
88198819
88208820MACHINE_START_MEMBER(dynax_state,mjmyster)
88218821{
8822   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8823   machine().root_device().membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
8824   machine().root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
8822   UINT8 *ROM = memregion("maincpu")->base();
8823   membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
8824   membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
88258825
88268826   MACHINE_START_CALL_MEMBER(ddenlovr);
88278827}
88288828
88298829MACHINE_START_MEMBER(dynax_state,hparadis)
88308830{
8831   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8832   machine().root_device().membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
8833   machine().root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x50000], 0x1000);
8831   UINT8 *ROM = memregion("maincpu")->base();
8832   membank("bank1")->configure_entries(0, 8,    &ROM[0x10000], 0x8000);
8833   membank("bank2")->configure_entries(0, 8,    &ROM[0x50000], 0x1000);
88348834
88358835   MACHINE_START_CALL_MEMBER(ddenlovr);
88368836}
88378837
88388838MACHINE_START_MEMBER(dynax_state,mjflove)
88398839{
8840   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8841   machine().root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8842   machine().root_device().membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
8840   UINT8 *ROM = memregion("maincpu")->base();
8841   membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8842   membank("bank2")->configure_entries(0, 8,    &ROM[0x90000], 0x1000);
88438843
88448844   MACHINE_START_CALL_MEMBER(ddenlovr);
88458845}
88468846
88478847MACHINE_START_MEMBER(dynax_state,sryudens)
88488848{
8849   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
8850   machine().root_device().membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8851   machine().root_device().membank("bank2")->configure_entries(0, 0x10, &ROM[0x90000], 0x1000);
8849   UINT8 *ROM = memregion("maincpu")->base();
8850   membank("bank1")->configure_entries(0, 0x10, &ROM[0x10000], 0x8000);
8851   membank("bank2")->configure_entries(0, 0x10, &ROM[0x90000], 0x1000);
88528852
88538853   MACHINE_START_CALL_MEMBER(ddenlovr);
88548854}
r21033r21034
97669766
97679767MACHINE_START_MEMBER(dynax_state,seljan2)
97689768{
9769   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9769   UINT8 *ROM = memregion("maincpu")->base();
97709770
9771   machine().root_device().membank("bank1")->configure_entries(0x00, 0x10, &ROM[0x10000], 0x8000);
9771   membank("bank1")->configure_entries(0x00, 0x10, &ROM[0x10000], 0x8000);
97729772   // banks 10-1f -> palette RAM
97739773   for (int i = 0; i < 0x10; i++)
9774      machine().root_device().membank("bank1")->configure_entries(0x10+i, 1, &ROM[0x90000], 0x8000);
9774      membank("bank1")->configure_entries(0x10+i, 1, &ROM[0x90000], 0x8000);
97759775
9776   machine().root_device().membank("bank2")->configure_entries(0, 0x10, &ROM[0x98000], 0x1000);
9776   membank("bank2")->configure_entries(0, 0x10, &ROM[0x98000], 0x1000);
97779777
97789778   MACHINE_START_CALL_MEMBER(ddenlovr);
97799779}
trunk/src/mame/drivers/kaneko16.c
r21033r21034
635635void kaneko16_state::kaneko16_common_oki_bank_w(  const char *bankname, const char* tag, int bank, size_t fixedsize, size_t bankedsize )
636636{
637637   UINT32 bankaddr;
638   UINT8* samples = machine().root_device().memregion(tag)->base();
639   size_t length = machine().root_device().memregion(tag)->bytes();
638   UINT8* samples = memregion(tag)->base();
639   size_t length = memregion(tag)->bytes();
640640
641641   bankaddr = fixedsize + (bankedsize * bank);
642642
643643   if (bankaddr <= (length-bankedsize))
644644   {
645      machine().root_device().membank(bankname)->set_base(samples + bankaddr);
645      membank(bankname)->set_base(samples + bankaddr);
646646   }
647647}
648648
r21033r21034
21572157*/
21582158void kaneko16_state::kaneko16_unscramble_tiles(const char *region)
21592159{
2160   UINT8 *RAM  =   machine().root_device().memregion(region)->base();
2161   int size            =   machine().root_device().memregion(region)->bytes();
2160   UINT8 *RAM  =   memregion(region)->base();
2161   int size            =   memregion(region)->bytes();
21622162   int i;
21632163
21642164   if (RAM == NULL)    return;
r21033r21034
21832183   int bank;
21842184   UINT8 *src0;
21852185
2186   if (machine().root_device().memregion(region)->bytes() < 0x40000 * 16)
2186   if (memregion(region)->bytes() < 0x40000 * 16)
21872187      fatalerror("gtmr SOUND1 region too small\n");
21882188
21892189   /* bank 0 maps to itself, so we just leave it alone */
2190   src0 = machine().root_device().memregion(region)->base();
2190   src0 = memregion(region)->base();
21912191   for (bank = 15; bank > 0; bank--)
21922192   {
21932193      UINT8 *srcn = src0 + 0x10000 * (bank < 3 ? 3 : bank);
trunk/src/mame/drivers/namcos10.c
r21033r21034
352352
353353READ32_MEMBER(namcos10_state::range_r)
354354{
355   UINT32 data32 = ((const UINT32 *)(machine().root_device().memregion("user1")->base()))[offset+bank_base];
355   UINT32 data32 = ((const UINT32 *)(memregion("user1")->base()))[offset+bank_base];
356356
357357   UINT16 d16;
358358   if(ACCESSING_BITS_16_31)
trunk/src/mame/drivers/cybertnk.c
r21033r21034
316316static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift)
317317{
318318   cybertnk_state *state = screen.machine().driver_data<cybertnk_state>();
319   const UINT32 *sprrom = (UINT32*)screen.machine().root_device().memregion("spr_gfx")->base();
319   const UINT32 *sprrom = (UINT32*)screen.memregion("spr_gfx")->base();
320320   const pen_t *paldata = screen.machine().pens;
321321
322322   int miny = cliprect.min_y;
r21033r21034
973973
974974DRIVER_INIT_MEMBER(cybertnk_state,cybertnk)
975975{
976   UINT32 *spr = (UINT32*)machine().root_device().memregion("spr_gfx")->base();
976   UINT32 *spr = (UINT32*)memregion("spr_gfx")->base();
977977
978978   for (int x = 0; x< 0x200000/4;x++)
979979   {
trunk/src/mame/drivers/gauntlet.c
r21033r21034
16641664
16651665DRIVER_INIT_MEMBER(gauntlet_state,vindctr2)
16661666{
1667   UINT8 *gfx2_base = machine().root_device().memregion("gfx2")->base();
1667   UINT8 *gfx2_base = memregion("gfx2")->base();
16681668   UINT8 *data = auto_alloc_array(machine(), UINT8, 0x8000);
16691669   int i;
16701670
trunk/src/mame/drivers/darkseal.c
r21033r21034
459459
460460DRIVER_INIT_MEMBER(darkseal_state,darkseal)
461461{
462   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
462   UINT8 *RAM = memregion("maincpu")->base();
463463   int i;
464464
465465   for (i=0x00000; i<0x80000; i++)
trunk/src/mame/drivers/expro02.c
r21033r21034
901901
902902DRIVER_INIT_MEMBER(expro02_state,galsnew)
903903{
904   UINT32 *src = (UINT32 *)machine().root_device().memregion("gfx3" )->base();
905   UINT32 *dst = (UINT32 *)machine().root_device().memregion("gfx2" )->base();
904   UINT32 *src = (UINT32 *)memregion("gfx3" )->base();
905   UINT32 *dst = (UINT32 *)memregion("gfx2" )->base();
906906   int x, offset;
907907
908908
trunk/src/mame/drivers/redalert.c
r21033r21034
109109
110110INTERRUPT_GEN_MEMBER(redalert_state::redalert_vblank_interrupt)
111111{
112   if( machine().root_device().ioport("COIN")->read() )
112   if( ioport("COIN")->read() )
113113      /* the service coin as conntected to the CPU's RDY pin as well */
114114      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
115115
trunk/src/mame/drivers/pipeline.c
r21033r21034
370370void pipeline_state::palette_init()
371371{
372372   int r,g,b,i,c;
373   UINT8 *prom1 = &machine().root_device().memregion("proms")->base()[0x000];
374   UINT8 *prom2 = &machine().root_device().memregion("proms")->base()[0x100];
373   UINT8 *prom1 = &memregion("proms")->base()[0x000];
374   UINT8 *prom2 = &memregion("proms")->base()[0x100];
375375
376376   for(i=0;i<0x100;i++)
377377   {
trunk/src/mame/drivers/rampart.c
r21033r21034
467467
468468DRIVER_INIT_MEMBER(rampart_state,rampart)
469469{
470   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
470   UINT8 *rom = memregion("maincpu")->base();
471471
472472   memcpy(&rom[0x140000], &rom[0x40000], 0x8000);
473473   slapstic_configure(*machine().device<cpu_device>("maincpu"), 0x140000, 0x438000, 118);
trunk/src/mame/drivers/gberet.c
r21033r21034
586586
587587DRIVER_INIT_MEMBER(gberet_state,mrgoemon)
588588{
589   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
590   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x800);
589   UINT8 *ROM = memregion("maincpu")->base();
590   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x800);
591591}
592592
593593
trunk/src/mame/drivers/bfm_sc1.c
r21033r21034
683683
684684// init rom bank ////////////////////////////////////////////////////////////////////
685685   {
686      UINT8 *rom = machine().root_device().memregion("maincpu")->base();
686      UINT8 *rom = memregion("maincpu")->base();
687687
688688      membank("bank1")->configure_entries(0, 4, &rom[0x0000], 0x02000);
689689      membank("bank1")->set_entry(m_defaultbank);
r21033r21034
11781178{
11791179   // search for the project string to find the title (usually just at ff00)
11801180   char title_string[7][32] = { "PROJECT NUMBER", "PROJECT PR", "PROJECT ", "CASH ON THE NILE 2", "PR6121", "CHINA TOWN\x0d\x0a", "PROJECTNUMBER" };
1181   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
1182   int size = machine().root_device().memregion( "maincpu" )->bytes();
1181   UINT8 *src = memregion( "maincpu" )->base();
1182   int size = memregion( "maincpu" )->bytes();
11831183
11841184   for (int search=0;search<7;search++)
11851185   {
trunk/src/mame/drivers/merit.c
r21033r21034
11631163MACHINE_START_MEMBER(merit_state,casino5)
11641164{
11651165   merit_state::machine_start();
1166   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x2000, 0x2000);
1167   machine().root_device().membank("bank2")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x6000, 0x2000);
1168   machine().root_device().membank("bank1")->set_entry(0);
1169   machine().root_device().membank("bank2")->set_entry(0);
1166   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x2000, 0x2000);
1167   membank("bank2")->configure_entries(0, 2, memregion("maincpu")->base() + 0x6000, 0x2000);
1168   membank("bank1")->set_entry(0);
1169   membank("bank2")->set_entry(0);
11701170}
11711171
11721172static MACHINE_CONFIG_START( pitboss, merit_state )
r21033r21034
20242024
20252025DRIVER_INIT_MEMBER(merit_state,couple)
20262026{
2027   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
2027   UINT8 *ROM = memregion("maincpu")->base();
20282028
20292029   #if 0 //quick rom compare test
20302030   {
r21033r21034
20442044     dumpers it's just the way it is,a.k.a. it's an "hardware" banking.
20452045     update 20060118 by f205v: now we have 3 dumps from 3 different boards and they
20462046     all behave the same...*/
2047   machine().root_device().membank("bank1")->set_base(ROM + 0x10000 + (0x2000 * 2));
2047   membank("bank1")->set_base(ROM + 0x10000 + (0x2000 * 2));
20482048}
20492049
20502050DRIVER_INIT_MEMBER(merit_state,dtrvwz5)
trunk/src/mame/drivers/mw8080bw.c
r21033r21034
554554
555555UINT8 mw8080bw_state::tornbase_get_cabinet_type()
556556{
557   return machine().root_device().ioport(TORNBASE_CAB_TYPE_PORT_TAG)->read();
557   return ioport(TORNBASE_CAB_TYPE_PORT_TAG)->read();
558558}
559559
560560
r21033r21034
25812581
25822582int mw8080bw_state::invaders_is_cabinet_cocktail()
25832583{
2584   return machine().root_device().ioport(INVADERS_CAB_TYPE_PORT_TAG)->read();
2584   return ioport(INVADERS_CAB_TYPE_PORT_TAG)->read();
25852585}
25862586
25872587
r21033r21034
27872787#ifdef UNUSED_FUNCTION
27882788UINT32 mw8080bw_state::invad2ct_coin_input_r(void *param)
27892789{
2790   UINT32 ret = machine().root_device().ioport(INVAD2CT_COIN_INPUT_PORT_TAG)->read();
2790   UINT32 ret = ioport(INVAD2CT_COIN_INPUT_PORT_TAG)->read();
27912791
27922792   coin_counter_w(machine, 0, !ret);
27932793
trunk/src/mame/drivers/vaportra.c
r21033r21034
836836
837837DRIVER_INIT_MEMBER(vaportra_state,vaportra)
838838{
839   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
839   UINT8 *RAM = memregion("maincpu")->base();
840840   int i;
841841
842842   for (i = 0x00000; i < 0x80000; i++)
trunk/src/mame/drivers/namcos86.c
r21033r21034
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().root_device().memregion("user1")->base()) return;
191   if (memregion("user1")->base()) return;
192192
193193   membank("bank1")->set_base(base + ((data & 0x03) * 0x2000));
194194}
r21033r21034
294294WRITE8_MEMBER(namcos86_state::cus115_w)
295295{
296296   /* make sure the expansion board is present */
297   if (!machine().root_device().memregion("user1")->base())
297   if (!memregion("user1")->base())
298298   {
299299      popmessage("expansion board not present");
300300      return;
r21033r21034
324324
325325void namcos86_state::machine_reset()
326326{
327   UINT8 *base = machine().root_device().memregion("cpu1")->base() + 0x10000;
327   UINT8 *base = memregion("cpu1")->base() + 0x10000;
328328
329   machine().root_device().membank("bank1")->set_base(base);
329   membank("bank1")->set_base(base);
330330}
331331
332332
r21033r21034
15191519   UINT8 *buffer;
15201520
15211521   /* shuffle tile ROMs so regular gfx unpack routines can be used */
1522   gfx = machine().root_device().memregion("gfx1")->base();
1523   size = machine().root_device().memregion("gfx1")->bytes() * 2 / 3;
1522   gfx = memregion("gfx1")->base();
1523   size = memregion("gfx1")->bytes() * 2 / 3;
15241524   buffer = auto_alloc_array(machine(), UINT8,  size );
15251525
15261526   {
r21033r21034
15441544      auto_free( machine(), buffer );
15451545   }
15461546
1547   gfx = machine().root_device().memregion("gfx2")->base();
1548   size = machine().root_device().memregion("gfx2")->bytes() * 2 / 3;
1547   gfx = memregion("gfx2")->base();
1548   size = memregion("gfx2")->bytes() * 2 / 3;
15491549   buffer = auto_alloc_array(machine(), UINT8,  size );
15501550
15511551   {
trunk/src/mame/drivers/chanbara.c
r21033r21034
9999
100100void chanbara_state::palette_init()
101101{
102   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
102   const UINT8 *color_prom = memregion("proms")->base();
103103   int i, red, green, blue;
104104
105105   for (i = 0; i < machine().total_colors(); i++)
r21033r21034
462462
463463DRIVER_INIT_MEMBER(chanbara_state,chanbara)
464464{
465   UINT8   *src = machine().root_device().memregion("gfx4")->base();
466   UINT8   *dst = machine().root_device().memregion("gfx3")->base() + 0x4000;
467   UINT8   *bg = machine().root_device().memregion("user1")->base();
465   UINT8   *src = memregion("gfx4")->base();
466   UINT8   *dst = memregion("gfx3")->base() + 0x4000;
467   UINT8   *bg = memregion("user1")->base();
468468
469469   int i;
470470   for (i = 0; i < 0x1000; i++)
r21033r21034
475475      dst[i + 0x2000] = (src[i + 0x1000] & 0x0f) << 4;
476476   }
477477
478   machine().root_device().membank("bank1")->configure_entries(0, 2, &bg[0x0000], 0x4000);
478   membank("bank1")->configure_entries(0, 2, &bg[0x0000], 0x4000);
479479}
480480
481481GAME( 1985, chanbara, 0,  chanbara, chanbara, chanbara_state, chanbara, ROT270, "Data East", "Chanbara", GAME_SUPPORTS_SAVE | GAME_NO_COCKTAIL )
trunk/src/mame/drivers/pipedrm.c
r21033r21034
219219
220220WRITE8_MEMBER(pipedrm_state::sound_bankswitch_w )
221221{
222   space.machine().root_device().membank("bank2")->set_entry(data & 0x01);
222   membank("bank2")->set_entry(data & 0x01);
223223}
224224
225225
trunk/src/mame/drivers/srmp2.c
r21033r21034
258258
259259      for (t = 0 ; t < 8 ; t ++)
260260      {
261         if (!(machine().root_device().ioport(keynames[j+p_side])->read() & ( 1 << t )))
261         if (!(ioport(keynames[j+p_side])->read() & ( 1 << t )))
262262         {
263263            return (i + t) | (p_side ? 0x20 : 0x00);
264264         }
trunk/src/mame/drivers/nova2001.c
r21033r21034
979979
980980void nova2001_state::lineswap_gfx_roms(const char *region, const int bit)
981981{
982   const int length = machine().root_device().memregion(region)->bytes();
982   const int length = memregion(region)->bytes();
983983
984   UINT8* const src = machine().root_device().memregion(region)->base();
984   UINT8* const src = memregion(region)->base();
985985
986986   UINT8* const temp = auto_alloc_array(machine(), UINT8, length);
987987
trunk/src/mame/drivers/jantotsu.c
r21033r21034
202202
203203void jantotsu_state::palette_init()
204204{
205   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
205   const UINT8 *color_prom = memregion("proms")->base();
206206   int bit0, bit1, bit2, r, g, b;
207207   int i;
208208
trunk/src/mame/drivers/snk68.c
r21033r21034
10391039
10401040DRIVER_INIT_MEMBER(snk68_state,searchar)
10411041{
1042   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("user1")->base());
1042   membank("bank1")->set_base(memregion("user1")->base());
10431043}
10441044
10451045/******************************************************************************/
trunk/src/mame/drivers/saturn.c
r21033r21034
18011801
18021802DEVICE_IMAGE_LOAD_MEMBER( saturn_state, sat_cart )
18031803{
1804   UINT8 *ROM = image.device().machine().root_device().memregion("maincpu")->base()+0x080000;
1804   UINT8 *ROM = image.device().memregion("maincpu")->base()+0x080000;
18051805   UINT32 length;
18061806
18071807   if (image.software_entry() != NULL)
trunk/src/mame/drivers/gaelco3d.c
r21033r21034
214214   /* allocate a timer for feeding the autobuffer */
215215   m_adsp_autobuffer_timer = machine().device<timer_device>("adsp_timer");
216216
217   membank("bank1")->configure_entries(0, 256, machine().root_device().memregion("user1")->base(), 0x4000);
217   membank("bank1")->configure_entries(0, 256, memregion("user1")->base(), 0x4000);
218218   membank("bank1")->set_entry(0);
219219
220220   /* keep the TMS32031 halted until the code is ready to go */
trunk/src/mame/drivers/tnzs.c
r21033r21034
737737{
738738   // to avoid the write when the sound chip is initialized
739739   if (data != 0xff)
740      machine().root_device().membank("audiobank")->set_entry(data & 0x07);
740      membank("audiobank")->set_entry(data & 0x07);
741741}
742742
743743WRITE8_MEMBER(tnzs_state::kabukiz_sample_w)
trunk/src/mame/drivers/namconb1.c
r21033r21034
602602
603603DRIVER_INIT_MEMBER(namconb1_state,nebulray)
604604{
605   UINT8 *pMem = (UINT8 *)machine().root_device().memregion(NAMCONB1_TILEMASKREGION)->base();
605   UINT8 *pMem = (UINT8 *)memregion(NAMCONB1_TILEMASKREGION)->base();
606606   size_t numBytes = (0xfe7-0xe6f)*8;
607607   memset( &pMem[0xe6f*8], 0, numBytes );
608608
trunk/src/mame/drivers/carpolo.c
r21033r21034
336336
337337
338338   /* invert gfx PROM since the bits are active LO */
339   ROM = machine().root_device().memregion("gfx2")->base();
340   len = machine().root_device().memregion("gfx2")->bytes();
339   ROM = memregion("gfx2")->base();
340   len = memregion("gfx2")->bytes();
341341   for (i = 0;i < len; i++)
342342      ROM[i] ^= 0x0f;
343343}
trunk/src/mame/drivers/mcr68.c
r21033r21034
6969
7070READ8_MEMBER(mcr68_state::zwackery_port_2_r)
7171{
72   int result = machine().root_device().ioport("IN2")->read();
73   int wheel = machine().root_device().ioport("IN5")->read();
72   int result = ioport("IN2")->read();
73   int wheel = ioport("IN5")->read();
7474
7575   return result | ((wheel >> 2) & 0x3e);
7676}
trunk/src/mame/drivers/re900.c
r21033r21034
114114
115115READ8_MEMBER(re900_state::re_psg_portA_r)
116116{
117   if ((machine().root_device().ioport("IN0")->read() & 0x01) == 0)
117   if ((ioport("IN0")->read() & 0x01) == 0)
118118   {
119119      output_set_lamp_value(0,1);     // Operator Key ON
120120   }
r21033r21034
124124      output_set_lamp_value(0,0);     // Operator Key OFF
125125   }
126126
127   return machine().root_device().ioport("IN0")->read();
127   return ioport("IN0")->read();
128128}
129129
130130READ8_MEMBER(re900_state::re_psg_portB_r)
trunk/src/mame/drivers/relief.c
r21033r21034
433433
434434DRIVER_INIT_MEMBER(relief_state,relief)
435435{
436   UINT8 *sound_base = machine().root_device().memregion("oki")->base();
436   UINT8 *sound_base = memregion("oki")->base();
437437
438438   /* expand the ADPCM data to avoid lots of memcpy's during gameplay */
439439   /* the upper 128k is fixed, the lower 128k is bankswitched */
trunk/src/mame/drivers/mpu4mod2sw.c
r21033r21034
3232
3333   // many original barcrest / bwb sets have identification info around here
3434   // this helps with sorting
35   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
35   UINT8 *src = memregion( "maincpu" )->base();
3636   printf("\ncopyright string:\n");
3737   for (int i = 0xffe0; i<0xfff0; i++)
3838   {
trunk/src/mame/drivers/majorpkr.c
r21033r21034
10771077
10781078DRIVER_INIT_MEMBER(majorpkr_state,majorpkr)
10791079{
1080   UINT8 * ROM = (UINT8 *)machine().root_device().memregion("maincpu")->base();
1081   machine().root_device().membank("rom_bank")->configure_entries(0, 4, &ROM[0x10000], 0x800);
1080   UINT8 * ROM = (UINT8 *)memregion("maincpu")->base();
1081   membank("rom_bank")->configure_entries(0, 4, &ROM[0x10000], 0x800);
10821082}
10831083
10841084
trunk/src/mame/drivers/twin16.c
r21033r21034
8787
8888READ16_MEMBER(twin16_state::extra_rom_r)
8989{
90   return ((UINT16 *)machine().root_device().memregion("gfx3")->base())[offset];
90   return ((UINT16 *)memregion("gfx3")->base())[offset];
9191}
9292
9393READ16_MEMBER(twin16_state::twin16_gfx_rom1_r)
trunk/src/mame/drivers/sshangha.c
r21033r21034
489489#if SSHANGHA_HACK
490490   /* This is a hack to allow you to use the extra features
491491        of the first "Unused" Dip Switch (see notes above). */
492   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
492   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
493493   RAM[0x000384/2] = 0x4e71;
494494   RAM[0x000386/2] = 0x4e71;
495495   RAM[0x000388/2] = 0x4e71;
trunk/src/mame/drivers/mpu4dealem.c
r21033r21034
7676
7777PALETTE_INIT_MEMBER(mpu4dealem_state,dealem)
7878{
79   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
79   const UINT8 *color_prom = memregion("proms")->base();
8080   int i, len;
8181   static const int resistances_rg[3] = { 1000, 470, 220 };
8282   static const int resistances_b [2] = { 470, 220 };
r21033r21034
8787         3,  resistances_rg, weights_g,  1000,   0,
8888         2,  resistances_b,  weights_b,  1000,   0);
8989
90   len = machine().root_device().memregion("proms")->bytes();
90   len = memregion("proms")->bytes();
9191   for (i = 0; i < len; i++)
9292   {
9393      int bit0,bit1,bit2,r,g,b;
trunk/src/mame/drivers/pacman.c
r21033r21034
376376
377377MACHINE_RESET_MEMBER(pacman_state,mschamp)
378378{
379   UINT8 *rom = machine().root_device().memregion("maincpu")->base() + 0x10000;
380   int whichbank = machine().root_device().ioport("GAME")->read() & 1;
379   UINT8 *rom = memregion("maincpu")->base() + 0x10000;
380   int whichbank = ioport("GAME")->read() & 1;
381381
382   machine().root_device().membank("bank1")->configure_entries(0, 2, &rom[0x0000], 0x8000);
383   machine().root_device().membank("bank2")->configure_entries(0, 2, &rom[0x4000], 0x8000);
382   membank("bank1")->configure_entries(0, 2, &rom[0x0000], 0x8000);
383   membank("bank2")->configure_entries(0, 2, &rom[0x4000], 0x8000);
384384
385   machine().root_device().membank("bank1")->set_entry(whichbank);
386   machine().root_device().membank("bank2")->set_entry(whichbank);
385   membank("bank1")->set_entry(whichbank);
386   membank("bank2")->set_entry(whichbank);
387387}
388388
389389MACHINE_RESET_MEMBER(pacman_state,superabc)
r21033r21034
57725772{
57735773   address_space &space = m_maincpu->space(AS_PROGRAM);
57745774   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x4000);
5775   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
5775   UINT8 *rom = memregion("maincpu")->base();
57765776
57775777   /* patch protection using a copy of the opcodes so ROM checksum */
57785778   /* tests will not fail */
r21033r21034
58045804{
58055805   address_space &space = m_maincpu->space(AS_PROGRAM);
58065806   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x4000);
5807   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
5807   UINT8 *rom = memregion("maincpu")->base();
58085808
58095809   /* patch protection using a copy of the opcodes so ROM checksum */
58105810   /* tests will not fail */
r21033r21034
58395839
58405840   int i, j;
58415841   UINT8 *RAM, temp;
5842   int length = machine().root_device().memregion("gfx1")->bytes()/2;
5842   int length = memregion("gfx1")->bytes()/2;
58435843
58445844   /* Characters */
5845   RAM = machine().root_device().memregion("gfx1")->base();
5845   RAM = memregion("gfx1")->base();
58465846   for (i = 0;i < length;i += 0x10)
58475847   {
58485848      for (j = 0; j < 8; j++)
r21033r21034
58545854   }
58555855
58565856   /* Sprites */
5857   RAM = machine().root_device().memregion("gfx1")->base()+length;
5857   RAM = memregion("gfx1")->base()+length;
58585858   for (i = 0;i < length;i += 0x20)
58595859   {
58605860      for (j = 0; j < 8; j++)
r21033r21034
58925892   /* CPU ROMs */
58935893
58945894   /* Data lines D3 and D5 swapped */
5895   RAM = machine().root_device().memregion("maincpu")->base();
5895   RAM = memregion("maincpu")->base();
58965896   for (i = 0; i < 0x4000; i++)
58975897   {
58985898      RAM[i] = BITSWAP8(RAM[i],7,6,3,4,5,2,1,0);
r21033r21034
59025902   /* Graphics ROMs */
59035903
59045904   /* Data lines D4 and D6 and address lines A0 and A2 are swapped */
5905   RAM = machine().root_device().memregion("gfx1")->base();
5906   len = machine().root_device().memregion("gfx1")->bytes();
5905   RAM = memregion("gfx1")->base();
5906   len = memregion("gfx1")->bytes();
59075907   for (i = 0;i < len;i += 8)
59085908      eyes_decode(&RAM[i]);
59095909}
r21033r21034
59755975   /* CPU ROMs */
59765976
59775977   /* Pac-Man code is in low bank */
5978   ROM = machine().root_device().memregion("maincpu")->base();
5978   ROM = memregion("maincpu")->base();
59795979
59805980   /* decrypted Ms. Pac-Man code is in high bank */
5981   DROM = &machine().root_device().memregion("maincpu")->base()[0x10000];
5981   DROM = &memregion("maincpu")->base()[0x10000];
59825982
59835983   /* copy ROMs into decrypted bank */
59845984   for (i = 0; i < 0x1000; i++)
r21033r21034
60136013   }
60146014
60156015   /* initialize the banks */
6016   machine().root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x00000], 0x10000);
6017   machine().root_device().membank("bank1")->set_entry(1);
6016   membank("bank1")->configure_entries(0, 2, &ROM[0x00000], 0x10000);
6017   membank("bank1")->set_entry(1);
60186018}
60196019
60206020DRIVER_INIT_MEMBER(pacman_state,woodpek)
r21033r21034
60256025   /* Graphics ROMs */
60266026
60276027   /* Data lines D4 and D6 and address lines A0 and A2 are swapped */
6028   RAM = machine().root_device().memregion("gfx1")->base();
6029   len = machine().root_device().memregion("gfx1")->bytes();
6028   RAM = memregion("gfx1")->base();
6029   len = memregion("gfx1")->bytes();
60306030   for (i = 0;i < len;i += 8)
60316031      eyes_decode(&RAM[i]);
60326032}
r21033r21034
60436043
60446044DRIVER_INIT_MEMBER(pacman_state,drivfrcp)
60456045{
6046   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
6047   machine().root_device().membank("bank1")->set_base(&ROM[0 * 0x2000]);
6048   machine().root_device().membank("bank2")->set_base(&ROM[1 * 0x2000]);
6049   machine().root_device().membank("bank3")->set_base(&ROM[2 * 0x2000]);
6050   machine().root_device().membank("bank4")->set_base(&ROM[3 * 0x2000]);
6046   UINT8 *ROM = memregion("maincpu")->base();
6047   membank("bank1")->set_base(&ROM[0 * 0x2000]);
6048   membank("bank2")->set_base(&ROM[1 * 0x2000]);
6049   membank("bank3")->set_base(&ROM[2 * 0x2000]);
6050   membank("bank4")->set_base(&ROM[3 * 0x2000]);
60516051}
60526052
60536053DRIVER_INIT_MEMBER(pacman_state,8bpm)
60546054{
6055   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
6055   UINT8 *ROM = memregion("maincpu")->base();
60566056   int i;
60576057
60586058   /* Data lines D0 and D6 swapped */
r21033r21034
60616061      ROM[i] = BITSWAP8(ROM[i],7,0,5,4,3,2,1,6);
60626062   }
60636063
6064   machine().root_device().membank("bank1")->set_base(&ROM[0 * 0x2000]);
6065   machine().root_device().membank("bank2")->set_base(&ROM[1 * 0x2000]);
6066   machine().root_device().membank("bank3")->set_base(&ROM[2 * 0x2000]);
6067   machine().root_device().membank("bank4")->set_base(&ROM[3 * 0x2000]);
6064   membank("bank1")->set_base(&ROM[0 * 0x2000]);
6065   membank("bank2")->set_base(&ROM[1 * 0x2000]);
6066   membank("bank3")->set_base(&ROM[2 * 0x2000]);
6067   membank("bank4")->set_base(&ROM[3 * 0x2000]);
60686068}
60696069
60706070DRIVER_INIT_MEMBER(pacman_state,porky)
60716071{
6072   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
6072   UINT8 *ROM = memregion("maincpu")->base();
60736073   int i;
60746074
60756075   /* Data lines D0 and D4 swapped */
r21033r21034
60786078      ROM[i] = BITSWAP8(ROM[i],7,6,5,0,3,2,1,4);
60796079   }
60806080
6081   machine().root_device().membank("bank1")->configure_entries(0, 2, &ROM[0 * 0x2000], 0x8000);
6082   machine().root_device().membank("bank2")->configure_entries(0, 2, &ROM[1 * 0x2000], 0x8000);
6083   machine().root_device().membank("bank3")->configure_entries(0, 2, &ROM[2 * 0x2000], 0x8000);
6084   machine().root_device().membank("bank4")->configure_entries(0, 2, &ROM[3 * 0x2000], 0x8000);
6081   membank("bank1")->configure_entries(0, 2, &ROM[0 * 0x2000], 0x8000);
6082   membank("bank2")->configure_entries(0, 2, &ROM[1 * 0x2000], 0x8000);
6083   membank("bank3")->configure_entries(0, 2, &ROM[2 * 0x2000], 0x8000);
6084   membank("bank4")->configure_entries(0, 2, &ROM[3 * 0x2000], 0x8000);
60856085
6086   machine().root_device().membank("bank1")->set_entry(0);
6087   machine().root_device().membank("bank2")->set_entry(0);
6088   machine().root_device().membank("bank3")->set_entry(0);
6089   machine().root_device().membank("bank4")->set_entry(0);
6086   membank("bank1")->set_entry(0);
6087   membank("bank2")->set_entry(0);
6088   membank("bank3")->set_entry(0);
6089   membank("bank4")->set_entry(0);
60906090}
60916091
60926092DRIVER_INIT_MEMBER(pacman_state,rocktrv2)
60936093{
60946094   /* hack to pass the rom check for the bad rom */
6095   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
6095   UINT8 *ROM = memregion("maincpu")->base();
60966096
60976097   ROM[0x7ffe] = 0xa7;
60986098   ROM[0x7fee] = 0x6d;
r21033r21034
61046104DRIVER_INIT_MEMBER(pacman_state,mspacmbe)
61056105{
61066106   UINT8 temp;
6107   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
6107   UINT8 *RAM = memregion("maincpu")->base();
61086108   int i;
61096109
61106110   /* Address lines A1 and A0 swapped if A2=0 */
r21033r21034
61346134
61356135DRIVER_INIT_MEMBER(pacman_state,superabc)
61366136{
6137   UINT8 *src = machine().root_device().memregion("user1")->base();
6138   UINT8 *dest = machine().root_device().memregion("gfx1")->base();
6137   UINT8 *src = memregion("user1")->base();
6138   UINT8 *dest = memregion("gfx1")->base();
61396139
61406140   // descramble gfx
61416141   for (int i = 0; i < 0x10000; i++)
trunk/src/mame/drivers/igs011.c
r21033r21034
601601void igs011_state::wlcc_decrypt()
602602{
603603   int i;
604   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
604   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
605605
606606   int rom_size = 0x80000;
607607
r21033r21034
625625void igs011_state::lhb_decrypt()
626626{
627627   int i;
628   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
628   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
629629
630630   int rom_size = 0x80000;
631631
r21033r21034
650650void igs011_state::drgnwrld_type3_decrypt()
651651{
652652   int i;
653   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
653   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
654654
655655   int rom_size = 0x80000;
656656
r21033r21034
678678void igs011_state::drgnwrld_type2_decrypt()
679679{
680680   int i;
681   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
681   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
682682
683683   int rom_size = 0x80000;
684684
r21033r21034
711711void igs011_state::drgnwrld_type1_decrypt()
712712{
713713   int i;
714   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
714   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
715715
716716   int rom_size = 0x80000;
717717
r21033r21034
741741{
742742   int i,j;
743743   int rom_size = 0x80000;
744   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
744   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
745745   UINT16 *result_data = auto_alloc_array(machine(), UINT16, rom_size/2);
746746
747747   for (i=0; i<rom_size/2; i++)
r21033r21034
773773{
774774   int i,j;
775775   int rom_size = 0x80000;
776   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
776   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
777777   UINT16 *result_data = auto_alloc_array(machine(), UINT16, rom_size/2);
778778
779779   for (i=0; i<rom_size/2; i++)
r21033r21034
811811void igs011_state::vbowlj_decrypt()
812812{
813813   int i;
814   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
814   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
815815
816816   int rom_size = 0x80000;
817817
r21033r21034
845845void igs011_state::dbc_decrypt()
846846{
847847   int i;
848   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
848   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
849849
850850   int rom_size = 0x80000;
851851
r21033r21034
895895void igs011_state::ryukobou_decrypt()
896896{
897897   int i;
898   UINT16 *src = (UINT16 *) machine().root_device().memregion("maincpu")->base();
898   UINT16 *src = (UINT16 *) memregion("maincpu")->base();
899899   int rom_size = 0x80000;
900900
901901   for (i=0; i<rom_size/2; i++)
r21033r21034
927927{
928928   int i;
929929   unsigned rom_size = 0x200000;
930   UINT8 *src = (UINT8 *) (machine().root_device().memregion("blitter")->base());
930   UINT8 *src = (UINT8 *) (memregion("blitter")->base());
931931   UINT8 *result_data = auto_alloc_array(machine(), UINT8, rom_size);
932932
933933   for (i=0; i<rom_size; i++)
r21033r21034
942942{
943943   int i;
944944   unsigned rom_size = 0x400000;
945   UINT8 *src = (UINT8 *) (machine().root_device().memregion("blitter")->base());
945   UINT8 *src = (UINT8 *) (memregion("blitter")->base());
946946   UINT8 *result_data = auto_alloc_array(machine(), UINT8, rom_size);
947947
948948   for (i=0; i<rom_size; i++)
r21033r21034
19091909// V0400O
19101910DRIVER_INIT_MEMBER(igs011_state,drgnwrld)
19111911{
1912//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
1912//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
19131913
19141914   drgnwrld_type1_decrypt();
19151915   drgnwrld_gfx_decrypt();
r21033r21034
19351935
19361936DRIVER_INIT_MEMBER(igs011_state,drgnwrldv30)
19371937{
1938//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
1938//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
19391939
19401940   drgnwrld_type1_decrypt();
19411941   drgnwrld_gfx_decrypt();
r21033r21034
19601960
19611961DRIVER_INIT_MEMBER(igs011_state,drgnwrldv21)
19621962{
1963//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
1963//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
19641964
19651965   drgnwrld_type2_decrypt();
19661966   drgnwrld_gfx_decrypt();
r21033r21034
19891989
19901990DRIVER_INIT_MEMBER(igs011_state,drgnwrldv21j)
19911991{
1992//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
1992//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
19931993
19941994   drgnwrld_type3_decrypt();
19951995   drgnwrld_gfx_decrypt();
r21033r21034
20162016
20172017DRIVER_INIT_MEMBER(igs011_state,drgnwrldv20j)
20182018{
2019//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2019//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
20202020
20212021   drgnwrld_type3_decrypt();
20222022   drgnwrld_gfx_decrypt();
r21033r21034
20542054
20552055DRIVER_INIT_MEMBER(igs011_state,drgnwrldv10c)
20562056{
2057//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2057//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
20582058
20592059   drgnwrld_type1_decrypt();
20602060   drgnwrld_gfx_decrypt();
r21033r21034
20802080
20812081DRIVER_INIT_MEMBER(igs011_state,lhb)
20822082{
2083//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2083//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
20842084
20852085   lhb_decrypt();
20862086
r21033r21034
20902090
20912091DRIVER_INIT_MEMBER(igs011_state,lhbv33c)
20922092{
2093//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2093//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
20942094
20952095   lhb_decrypt();
20962096
r21033r21034
21002100
21012101DRIVER_INIT_MEMBER(igs011_state,dbc)
21022102{
2103//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2103//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
21042104
21052105   dbc_decrypt();
21062106
r21033r21034
21302130
21312131DRIVER_INIT_MEMBER(igs011_state,ryukobou)
21322132{
2133//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2133//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
21342134
21352135   ryukobou_decrypt();
21362136
r21033r21034
21432143
21442144DRIVER_INIT_MEMBER(igs011_state,xymg)
21452145{
2146//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2146//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
21472147
21482148   lhb_decrypt();
21492149/*
r21033r21034
21772177
21782178DRIVER_INIT_MEMBER(igs011_state,wlcc)
21792179{
2180//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2180//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
21812181
21822182   wlcc_decrypt();
21832183/*
r21033r21034
22012201
22022202DRIVER_INIT_MEMBER(igs011_state,lhb2)
22032203{
2204//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2204//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
22052205
22062206   lhb2_decrypt();
22072207   lhb2_decrypt_gfx();
r21033r21034
22242224
22252225DRIVER_INIT_MEMBER(igs011_state,vbowl)
22262226{
2227   UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2228   UINT8  *gfx = (UINT8 *)  machine().root_device().memregion("blitter")->base();
2227   UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
2228   UINT8  *gfx = (UINT8 *)  memregion("blitter")->base();
22292229   int i;
22302230
22312231   vbowlj_decrypt();
r21033r21034
22502250
22512251DRIVER_INIT_MEMBER(igs011_state,vbowlj)
22522252{
2253//  UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2254   UINT8  *gfx = (UINT8 *)  machine().root_device().memregion("blitter")->base();
2253//  UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
2254   UINT8  *gfx = (UINT8 *)  memregion("blitter")->base();
22552255   int i;
22562256
22572257   vbowlj_decrypt();
r21033r21034
22732273
22742274DRIVER_INIT_MEMBER(igs011_state,nkishusp)
22752275{
2276   UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
2276   UINT16 *rom = (UINT16 *) memregion("maincpu")->base();
22772277
22782278   nkishusp_decrypt();
22792279   lhb2_decrypt_gfx();
trunk/src/mame/drivers/compgolf.c
r21033r21034
335335
336336void compgolf_state::compgolf_expand_bg()
337337{
338   UINT8 *GFXDST = machine().root_device().memregion("gfx2")->base();
339   UINT8 *GFXSRC = machine().root_device().memregion("gfx4")->base();
338   UINT8 *GFXDST = memregion("gfx2")->base();
339   UINT8 *GFXSRC = memregion("gfx4")->base();
340340
341341   int x;
342342
r21033r21034
349349
350350DRIVER_INIT_MEMBER(compgolf_state,compgolf)
351351{
352   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("user1")->base(), 0x4000);
352   membank("bank1")->configure_entries(0, 2, memregion("user1")->base(), 0x4000);
353353   compgolf_expand_bg();
354354}
355355
trunk/src/mame/drivers/midzeus.c
r21033r21034
8787
8888MACHINE_RESET_MEMBER(midzeus_state,midzeus)
8989{
90   memcpy(m_ram_base, machine().root_device().memregion("user1")->base(), 0x40000*4);
90   memcpy(m_ram_base, memregion("user1")->base(), 0x40000*4);
9191   *m_ram_base <<= 1;
9292   machine().device("maincpu")->reset();
9393
r21033r21034
14651465{
14661466   dcs2_init(machine(), 0, 0);
14671467   midway_ioasic_init(machine(), MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL);
1468   machine().root_device().membank("bank1")->configure_entries(0, 3, machine().root_device().memregion("user2")->base(), 0x400000*4);
1468   membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4);
14691469   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x9b0004, 0x9b0007, read32_delegate(FUNC(midzeus_state::crusnexo_leds_r),this), write32_delegate(FUNC(midzeus_state::crusnexo_leds_w),this));
14701470   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    (0x8d0009, 0x8d000a, write32_delegate(FUNC(midzeus_state::keypad_select_w),this));
14711471}
r21033r21034
14751475{
14761476   dcs2_init(machine(), 0, 0);
14771477   midway_ioasic_init(machine(), MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL);
1478   machine().root_device().membank("bank1")->configure_entries(0, 3, machine().root_device().memregion("user2")->base(), 0x400000*4);
1478   membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4);
14791479}
14801480
14811481
trunk/src/mame/drivers/hnayayoi.c
r21033r21034
671671
672672DRIVER_INIT_MEMBER(hnayayoi_state,hnfubuki)
673673{
674   UINT8 *rom = machine().root_device().memregion("gfx1")->base();
675   int len = machine().root_device().memregion("gfx1")->bytes();
674   UINT8 *rom = memregion("gfx1")->base();
675   int len = memregion("gfx1")->bytes();
676676   int i, j;
677677
678678   /* interestingly, the blitter data has a slight encryption */
trunk/src/mame/drivers/amaticmg.c
r21033r21034
519519
520520void amaticmg_state::palette_init()
521521{
522   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
522   const UINT8 *color_prom = memregion("proms")->base();
523523   int bit0, bit1, bit2 , r, g, b;
524524   int i;
525525
r21033r21034
546546
547547PALETTE_INIT_MEMBER(amaticmg_state,amaticmg2)
548548{
549   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
549   const UINT8 *color_prom = memregion("proms")->base();
550550   int r, g, b;
551551   int i;
552552
553   for (i = 0; i < machine().root_device().memregion("proms")->bytes(); i+=2)
553   for (i = 0; i < memregion("proms")->bytes(); i+=2)
554554   {
555555      b = ((color_prom[1] & 0xf8) >> 3);
556556      g = ((color_prom[0] & 0xc0) >> 6) | ((color_prom[1] & 0x7) << 2);
r21033r21034
848848
849849void amaticmg_state::machine_start()
850850{
851   UINT8 *rombank = machine().root_device().memregion("maincpu")->base();
851   UINT8 *rombank = memregion("maincpu")->base();
852852
853   machine().root_device().membank("bank1")->configure_entries(0, 0x10, &rombank[0x8000], 0x4000);
853   membank("bank1")->configure_entries(0, 0x10, &rombank[0x8000], 0x4000);
854854}
855855
856856void amaticmg_state::machine_reset()
r21033r21034
10811081   UINT8 plaintext;
10821082   int newaddress;
10831083
1084   UINT8 *src = machine().root_device().memregion("mainprg")->base();
1085   UINT8 *dest = machine().root_device().memregion("maincpu")->base();
1086   int len = machine().root_device().memregion("mainprg")->bytes();
1084   UINT8 *src = memregion("mainprg")->base();
1085   UINT8 *dest = memregion("maincpu")->base();
1086   int len = memregion("mainprg")->bytes();
10871087
10881088   for (int i = 0; i < len; i++)
10891089   {
trunk/src/mame/drivers/namcos12.c
r21033r21034
11871187   INT32 n_ramleft;
11881188
11891189   // TODO: the check for going past the end of ram should be in dma.c
1190   UINT32 m_n_psxramsize = state->machine().root_device().memshare("share1")->bytes();
1190   UINT32 m_n_psxramsize = state->memshare("share1")->bytes();
11911191
11921192   if(state->m_has_tektagt_dma && !state->m_n_dmaoffset)
11931193   {
r21033r21034
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().root_device().memregion( n_region )->base();
1212   n_romleft = ( state->machine().root_device().memregion( n_region )->bytes() - n_offset ) / 4;
1211   source = (UINT16 *) state->memregion( n_region )->base();
1212   n_romleft = ( state->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 );
r21033r21034
16041604   DRIVER_INIT_CALL(namcos12);
16051605
16061606   /* patch out wait for dma 5 to complete */
1607   *( (UINT32 *)( machine().root_device().memregion( "user1" )->base() + 0x331c4 ) ) = 0;
1607   *( (UINT32 *)( memregion( "user1" )->base() + 0x331c4 ) ) = 0;
16081608
16091609   system11gun_install(machine());
16101610}
trunk/src/mame/drivers/superdq.c
r21033r21034
8484
8585void superdq_state::palette_init()
8686{
87   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
87   const UINT8 *color_prom = memregion("proms")->base();
8888   int i;
8989   static const int resistances[3] = { 820, 390, 200 };
9090   double rweights[3], gweights[3], bweights[2];
trunk/src/mame/drivers/mappy.c
r21033r21034
15491549
15501550***************************************************************************/
15511551
1552READ8_MEMBER(mappy_state::dipA_l){ return machine().root_device().ioport("DSW1")->read(); }     // dips A
1553READ8_MEMBER(mappy_state::dipA_h){ return machine().root_device().ioport("DSW1")->read() >> 4; }    // dips A
1552READ8_MEMBER(mappy_state::dipA_l){ return ioport("DSW1")->read(); }     // dips A
1553READ8_MEMBER(mappy_state::dipA_h){ return ioport("DSW1")->read() >> 4; }    // dips A
15541554
15551555READ8_MEMBER(mappy_state::dipB_mux)// dips B
15561556{
trunk/src/mame/drivers/norautp.c
r21033r21034
34423442{
34433443/* Attempt to decrypt the program ROM */
34443444
3445//  UINT8 *rom = machine().root_device().memregion("maincpu")->base();
3445//  UINT8 *rom = memregion("maincpu")->base();
34463446//  UINT8 *buffer;
3447//  int size = 0x2000; //machine().root_device().memregion("maincpu")->bytes();
3447//  int size = 0x2000; //memregion("maincpu")->bytes();
34483448//  int start = 0;
34493449//  int i;
34503450
r21033r21034
34813481/* Just for debugging purposes */
34823482/*   Should be removed soon    */
34833483{
3484   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3484   UINT8 *ROM = memregion("maincpu")->base();
34853485   ROM[0x02f7] = 0xca;
34863486   ROM[0x02f8] = 0x18;
34873487   ROM[0x206c] = 0xff;
r21033r21034
34913491/* Passing the video PPI handshaking lines */
34923492/* Just for debugging purposes */
34933493{
3494//  UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3494//  UINT8 *ROM = memregion("maincpu")->base();
34953495
34963496//  ROM[0x073b] = 0x00;
34973497//  ROM[0x073c] = 0x00;
trunk/src/mame/drivers/taxidriv.c
r21033r21034
364364
365365void taxidriv_state::palette_init()
366366{
367   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
367   const UINT8 *color_prom = memregion("proms")->base();
368368   int bit0, bit1, r, g, b;
369369   int i;
370370
trunk/src/mame/drivers/uapce.c
r21033r21034
221221   }
222222   else
223223   {
224      return machine().root_device().ioport("JOY" )->read() | 0x08;
224      return ioport("JOY" )->read() | 0x08;
225225   }
226226}
227227
trunk/src/mame/drivers/tehkanwc.c
r21033r21034
703703       023A: 00          nop
704704   */
705705
706   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
706   UINT8 *ROM = memregion("maincpu")->base();
707707
708708   ROM[0x0238] = 0x00;
709709   ROM[0x0239] = 0x00;
trunk/src/mame/drivers/sigmab52.c
r21033r21034
298298
299299WRITE8_MEMBER(sigmab52_state::unk_f710_w)
300300{
301   membank("bank1" )->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + ((data&0x80)?0x4000:0x0000)]);
301   membank("bank1" )->set_base(&memregion("maincpu")->base()[0x10000 + ((data&0x80)?0x4000:0x0000)]);
302302}
303303
304304READ8_MEMBER(sigmab52_state::unk_f721_r)
r21033r21034
546546
547547void sigmab52_state::machine_start()
548548{
549   machine().root_device().membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + 0x0000]);
549   membank("bank1")->set_base(&memregion("maincpu")->base()[0x10000 + 0x0000]);
550550
551   machine().root_device().membank("bank2")->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + 0xf800]);
551   membank("bank2")->set_base(&memregion("maincpu")->base()[0x10000 + 0xf800]);
552552
553   machine().root_device().membank("bank3")->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + 0x8000]);
553   membank("bank3")->set_base(&memregion("maincpu")->base()[0x10000 + 0x8000]);
554554
555555/*
556556
r21033r21034
564564*/
565565
566566   {
567      UINT16 *rom = (UINT16*)machine().root_device().memregion("gfx1")->base();
567      UINT16 *rom = (UINT16*)memregion("gfx1")->base();
568568      int i;
569569
570570      device_t *hd63484 = machine().device("hd63484");
trunk/src/mame/drivers/ampoker2.c
r21033r21034
14021402
14031403DRIVER_INIT_MEMBER(ampoker2_state,rabbitpk)
14041404{
1405   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1406   int size = machine().root_device().memregion("maincpu")->bytes();
1405   UINT8 *rom = memregion("maincpu")->base();
1406   int size = memregion("maincpu")->bytes();
14071407   int start = 0;
14081408   int i;
14091409
r21033r21034
14541454
14551455*/
14561456
1457   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1457   UINT8 *rom = memregion("maincpu")->base();
14581458
14591459   /* NOP'ing the mortal jump... */
14601460   rom[0x154b] = 0x00;
trunk/src/mame/drivers/dynadice.c
r21033r21034
292292DRIVER_INIT_MEMBER(dynadice_state,dynadice)
293293{
294294   int i, j;
295   UINT8 *usr1 = machine().root_device().memregion("user1")->base();
296   UINT8 *cpu2 = machine().root_device().memregion("audiocpu")->base();
297   UINT8 *gfx1 = machine().root_device().memregion("gfx1")->base();
298   UINT8 *gfx2 = machine().root_device().memregion("gfx2")->base();
295   UINT8 *usr1 = memregion("user1")->base();
296   UINT8 *cpu2 = memregion("audiocpu")->base();
297   UINT8 *gfx1 = memregion("gfx1")->base();
298   UINT8 *gfx2 = memregion("gfx2")->base();
299299
300300   cpu2[0x0b] = 0x23;  /* bug in game code  Dec HL -> Inc HL*/
301301
trunk/src/mame/drivers/mirax.c
r21033r21034
138138
139139void mirax_state::palette_init()
140140{
141   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
141   const UINT8 *color_prom = memregion("proms")->base();
142142   int i;
143143
144144   for (i = 0;i < machine().total_colors();i++)
trunk/src/mame/drivers/tcl.c
r21033r21034
191191   /* only the first part is decrypted (and verified)*/
192192
193193   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
194   UINT8 *dest = machine().root_device().memregion("maincpu")->base();
195   int len = machine().root_device().memregion("maincpu")->bytes();
194   UINT8 *dest = memregion("maincpu")->base();
195   int len = memregion("maincpu")->bytes();
196196   UINT8 *src = auto_alloc_array(machine(), UINT8, len);
197197
198198   int i,idx=0;
trunk/src/mame/drivers/mquake.c
r21033r21034
442442
443443   /* set up memory */
444444   m_bank1->configure_entry(0, m_chip_ram);
445   m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base());
445   m_bank1->configure_entry(1, memregion("user1")->base());
446446}
447447
448448
trunk/src/mame/drivers/namcos21.c
r21033r21034
12201220
12211221READ16_MEMBER(namcos21_state::winrun_dsp_pointrom_data_r)
12221222{
1223   UINT16 *ptrom = (UINT16 *)machine().root_device().memregion("user2")->base();
1223   UINT16 *ptrom = (UINT16 *)memregion("user2")->base();
12241224   return ptrom[m_winrun_pointrom_addr++];
12251225} /* winrun_dsp_pointrom_data_r */
12261226
r21033r21034
12621262
12631263READ16_MEMBER(namcos21_state::gpu_data_r)
12641264{
1265   const UINT16 *pSrc = (UINT16 *)machine().root_device().memregion( "user3" )->base();
1265   const UINT16 *pSrc = (UINT16 *)memregion( "user3" )->base();
12661266   return pSrc[offset];
12671267}
12681268
r21033r21034
12801280   COMBINE_DATA( &m_winrun_dspbios[offset] );
12811281   if( offset==0xfff )
12821282   {
1283      UINT16 *mem = (UINT16 *)machine().root_device().memregion("dsp")->base();
1283      UINT16 *mem = (UINT16 *)memregion("dsp")->base();
12841284      memcpy( mem, m_winrun_dspbios, 0x2000 );
12851285      m_winrun_dsp_alive = 1;
12861286   }
r21033r21034
22592259
22602260DRIVER_INIT_MEMBER(namcos21_state,solvalou)
22612261{
2262   UINT16 *mem = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2262   UINT16 *mem = (UINT16 *)memregion("maincpu")->base();
22632263   mem[0x20ce4/2+1] = 0x0000; // $200128
22642264   mem[0x20cf4/2+0] = 0x4e71; // 2nd ptr_booting
22652265   mem[0x20cf4/2+1] = 0x4e71;
trunk/src/mame/drivers/macs.c
r21033r21034
141141
142142WRITE8_MEMBER(macs_state::macs_rom_bank_w)
143143{
144   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (data* 0x4000) + macs_cart_slot*0x400000 );
144   membank("bank1")->set_base(memregion("maincpu")->base() + (data* 0x4000) + macs_cart_slot*0x400000 );
145145
146146   m_st0016_rom_bank=data;
147147}
r21033r21034
710710      macs_ram1[0x1ff9]=0x07;
711711      #endif
712712
713      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() );
713      membank("bank1")->set_base(memregion("maincpu")->base() );
714714      membank("bank2")->set_base(macs_ram1+0x800);
715715      membank("bank3")->set_base(macs_ram1+0x10000);
716      membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() );
716      membank("bank4")->set_base(memregion("maincpu")->base() );
717717}
718718
719719DRIVER_INIT_MEMBER(macs_state,macs)
trunk/src/mame/drivers/pengadvb.c
r21033r21034
8585         // BIOS
8686         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
8787         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
88         membank("bank21")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000);
89         membank("bank22")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000 + 0x2000);
88         membank("bank21")->set_base(memregion("maincpu")->base() + 0x4000);
89         membank("bank22")->set_base(memregion("maincpu")->base() + 0x4000 + 0x2000);
9090         break;
9191
9292      case 1:
9393         // game
9494         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
9595         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
96         membank("bank21")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[0]*0x2000);
97         membank("bank22")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[1]*0x2000);
96         membank("bank21")->set_base(memregion("game")->base() + m_mem_banks[0]*0x2000);
97         membank("bank22")->set_base(memregion("game")->base() + m_mem_banks[1]*0x2000);
9898         break;
9999
100100      default:
r21033r21034
109109         // game
110110         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0x9fff, "bank31" );
111111         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xbfff, "bank32" );
112         membank("bank31")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[2]*0x2000);
113         membank("bank32")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[3]*0x2000);
112         membank("bank31")->set_base(memregion("game")->base() + m_mem_banks[2]*0x2000);
113         membank("bank32")->set_base(memregion("game")->base() + m_mem_banks[3]*0x2000);
114114         break;
115115
116116      default:
r21033r21034
188188
189189READ8_MEMBER(pengadvb_state::pengadvb_psg_port_a_r)
190190{
191   return machine().root_device().ioport("IN0")->read();
191   return ioport("IN0")->read();
192192}
193193
194194static const ay8910_interface pengadvb_ay8910_interface =
r21033r21034
219219{
220220   i8255_device *ppi = machine().device<i8255_device>("ppi8255");
221221   if ((ppi->read(space, 2) & 0x0f) == 0)
222      return machine().root_device().ioport("IN1")->read();
222      return ioport("IN1")->read();
223223
224224   return 0xff;
225225}
r21033r21034
290290
291291void pengadvb_state::pengadvb_decrypt(const char* region)
292292{
293   UINT8 *mem = machine().root_device().memregion(region)->base();
294   int memsize = machine().root_device().memregion(region)->bytes();
293   UINT8 *mem = memregion(region)->base();
294   int memsize = memregion(region)->bytes();
295295   UINT8 *buf;
296296   int i;
297297
trunk/src/mame/drivers/1943.c
r21033r21034
638638
639639DRIVER_INIT_MEMBER(_1943_state,1943)
640640{
641   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
642   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
641   UINT8 *ROM = memregion("maincpu")->base();
642   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
643643}
644644
645645READ8_MEMBER(_1943_state::_1943b_c007_r){ return 0; }
trunk/src/mame/drivers/suprgolf.c
r21033r21034
283283{
284284   UINT8 p1_sht_sw,p2_sht_sw;
285285
286   p1_sht_sw = (machine().root_device().ioport("P1_RELEASE")->read() & 0x80)>>7;
287   p2_sht_sw = (machine().root_device().ioport("P2_RELEASE")->read() & 0x80)>>6;
286   p1_sht_sw = (ioport("P1_RELEASE")->read() & 0x80)>>7;
287   p2_sht_sw = (ioport("P2_RELEASE")->read() & 0x80)>>6;
288288
289289   return p1_sht_sw | p2_sht_sw;
290290}
291291
292292READ8_MEMBER(suprgolf_state::p1_r)
293293{
294   return (machine().root_device().ioport("P1")->read() & 0xf0) | ((machine().root_device().ioport("P1_ANALOG")->read() & 0xf));
294   return (ioport("P1")->read() & 0xf0) | ((ioport("P1_ANALOG")->read() & 0xf));
295295}
296296
297297READ8_MEMBER(suprgolf_state::p2_r)
298298{
299   return (machine().root_device().ioport("P2")->read() & 0xf0) | ((machine().root_device().ioport("P2_ANALOG")->read() & 0xf));
299   return (ioport("P2")->read() & 0xf0) | ((ioport("P2_ANALOG")->read() & 0xf));
300300}
301301
302302static ADDRESS_MAP_START( suprgolf_map, AS_PROGRAM, 8, suprgolf_state )
r21033r21034
632632
633633DRIVER_INIT_MEMBER(suprgolf_state,suprgolf)
634634{
635   UINT8 *ROM = machine().root_device().memregion("user2")->base();
635   UINT8 *ROM = memregion("user2")->base();
636636
637637   ROM[0x74f4-0x4000] = 0x00;
638638   ROM[0x74f5-0x4000] = 0x00;
trunk/src/mame/drivers/ssv.c
r21033r21034
448448   static const char *const gunnames[] = { "GUNX1", "GUNY1", "GUNX2", "GUNY2" };
449449
450450   eeprom_device *eeprom = downcast<eeprom_device *>(device);
451   return (((m_gdfs_lightgun_select & 1) ? 0 : 0xff) ^ machine().root_device().ioport(gunnames[m_gdfs_lightgun_select])->read()) | (eeprom->read_bit() << 8);
451   return (((m_gdfs_lightgun_select & 1) ? 0 : 0xff) ^ ioport(gunnames[m_gdfs_lightgun_select])->read()) | (eeprom->read_bit() << 8);
452452}
453453
454454WRITE16_MEMBER(ssv_state::gdfs_eeprom_w)
r21033r21034
25312531// massages the data from the BPMicro-compatible dump to runnable form
25322532void ssv_state::init_st010()
25332533{
2534   UINT8 *dspsrc = (UINT8 *)machine().root_device().memregion("st010")->base();
2535   UINT32 *dspprg = (UINT32 *)machine().root_device().memregion("dspprg")->base();
2536   UINT16 *dspdata = (UINT16 *)machine().root_device().memregion("dspdata")->base();
2534   UINT8 *dspsrc = (UINT8 *)memregion("st010")->base();
2535   UINT32 *dspprg = (UINT32 *)memregion("dspprg")->base();
2536   UINT16 *dspdata = (UINT16 *)memregion("dspdata")->base();
25372537
25382538   // copy DSP program
25392539   for (int i = 0; i < 0x10000; i+= 4)
r21033r21034
25602560DRIVER_INIT_MEMBER(ssv_state,mslider)       {   init_ssv(0); }
25612561DRIVER_INIT_MEMBER(ssv_state,ryorioh)       {   init_ssv(0); }
25622562DRIVER_INIT_MEMBER(ssv_state,srmp4)        {    init_ssv(0);
2563//  ((UINT16 *)machine().root_device().memregion("user1")->base())[0x2b38/2] = 0x037a;   /* patch to see gal test mode */
2563//  ((UINT16 *)memregion("user1")->base())[0x2b38/2] = 0x037a;   /* patch to see gal test mode */
25642564}
25652565DRIVER_INIT_MEMBER(ssv_state,srmp7)        {    init_ssv(0); }
25662566DRIVER_INIT_MEMBER(ssv_state,stmblade)     {    init_ssv(0); init_st010(); }
trunk/src/mame/drivers/pasha2.c
r21033r21034
133133               case 0xb000:
134134               case 0xc000:
135135               case 0xd000:
136                  membank("bank1")->set_base(machine().root_device().memregion("user2")->base() + 0x400 * (bank - 0x8000)); break;
136                  membank("bank1")->set_base(memregion("user2")->base() + 0x400 * (bank - 0x8000)); break;
137137            }
138138         }
139139      }
trunk/src/mame/drivers/toaplan2.c
r21033r21034
422422
423423DRIVER_INIT_MEMBER(toaplan2_state,fixeightbl)
424424{
425   UINT8 *ROM = machine().root_device().memregion("oki")->base();
425   UINT8 *ROM = memregion("oki")->base();
426426
427   machine().root_device().membank("bank1")->configure_entries(0, 5, &ROM[0x30000], 0x10000);
427   membank("bank1")->configure_entries(0, 5, &ROM[0x30000], 0x10000);
428428}
429429
430430
r21033r21034
436436
437437DRIVER_INIT_MEMBER(toaplan2_state,pipibibsbl)
438438{
439   UINT16 *ROM = (UINT16 *)(machine().root_device().memregion("maincpu")->base());
439   UINT16 *ROM = (UINT16 *)(memregion("maincpu")->base());
440440
441441   for (int i = 0; i < (0x040000/2); i += 4)
442442   {
r21033r21034
450450
451451DRIVER_INIT_MEMBER(toaplan2_state,bgaregga)
452452{
453   UINT8 *Z80 = machine().root_device().memregion("audiocpu")->base();
453   UINT8 *Z80 = memregion("audiocpu")->base();
454454
455455   // seems to only use banks 0x0a to 0x0f
456   machine().root_device().membank("bank1")->configure_entries(8, 8, Z80, 0x4000);
456   membank("bank1")->configure_entries(8, 8, Z80, 0x4000);
457457}
458458
459459
trunk/src/mame/drivers/skyfox.c
r21033r21034
423423/* Untangle the graphics: cut each 32x32x8 tile in 16 8x8x8 tiles */
424424DRIVER_INIT_MEMBER(skyfox_state,skyfox)
425425{
426   UINT8 *RAM = machine().root_device().memregion("gfx1")->base();
427   UINT8 *end = RAM + machine().root_device().memregion("gfx1")->bytes();
426   UINT8 *RAM = memregion("gfx1")->base();
427   UINT8 *end = RAM + memregion("gfx1")->bytes();
428428   UINT8 buf[32 * 32];
429429
430430   while (RAM < end)
trunk/src/mame/drivers/jailbrek.c
r21033r21034
412412
413413DRIVER_INIT_MEMBER(jailbrek_state,jailbrek)
414414{
415   UINT8 *SPEECH_ROM = machine().root_device().memregion("vlm")->base();
415   UINT8 *SPEECH_ROM = memregion("vlm")->base();
416416   int ind;
417417
418418   /*
r21033r21034
424424      represents address line A13.)
425425   */
426426
427   if (machine().root_device().memregion("vlm")->bytes() == 0x4000)
427   if (memregion("vlm")->bytes() == 0x4000)
428428   {
429429      for (ind = 0; ind < 0x2000; ++ind)
430430      {
trunk/src/mame/drivers/wecleman.c
r21033r21034
12911291{
12921292   const char *region       = "gfx1";  // sprites
12931293
1294   const UINT32 len = machine().root_device().memregion(region)->bytes();
1295   UINT8 *src     = machine().root_device().memregion(region)->base() + len / 2 - 1;
1296   UINT8 *dst     = machine().root_device().memregion(region)->base() + len - 1;
1294   const UINT32 len = memregion(region)->bytes();
1295   UINT8 *src     = memregion(region)->base() + len / 2 - 1;
1296   UINT8 *dst     = memregion(region)->base() + len - 1;
12971297
12981298   while(dst > src)
12991299   {
r21033r21034
13431343      RAM[i] = BITSWAP8(RAM[i],7,0,1,2,3,4,5,6);
13441344   }
13451345
1346   bitswap(machine().root_device().memregion("gfx1")->base(), machine().root_device().memregion("gfx1")->bytes(),
1346   bitswap(memregion("gfx1")->base(), memregion("gfx1")->bytes(),
13471347         0,1,20,19,18,17,14,9,16,6,4,7,8,15,10,11,13,5,12,3,2);
13481348
13491349   /* Now we can unpack each nibble of the sprites into a pixel (one byte) */
13501350   wecleman_unpack_sprites();
13511351
13521352   /* Bg & Fg & Txt */
1353   bitswap(machine().root_device().memregion("gfx2")->base(), machine().root_device().memregion("gfx2")->bytes(),
1353   bitswap(memregion("gfx2")->base(), memregion("gfx2")->bytes(),
13541354         20,19,18,17,16,15,12,7,14,4,2,5,6,13,8,9,11,3,10,1,0);
13551355
13561356   /* Road */
1357   bitswap(machine().root_device().memregion("gfx3")->base(), machine().root_device().memregion("gfx3")->bytes(),
1357   bitswap(memregion("gfx3")->base(), memregion("gfx3")->bytes(),
13581358         20,19,18,17,16,15,14,7,12,4,2,5,6,13,8,9,11,3,10,1,0);
13591359
13601360   m_spr_color_offs = 0x40;
r21033r21034
14191419   UINT8 *base, *temp;
14201420   int i;
14211421
1422   base = machine().root_device().memregion("gfx1")->base(); // sprites
1422   base = memregion("gfx1")->base(); // sprites
14231423   temp = auto_alloc_array(machine(), UINT8,  bank_size );
14241424
14251425   for( i = num16_banks; i >0; i-- ){
trunk/src/mame/drivers/lastduel.c
r21033r21034
473473
474474MACHINE_START_MEMBER(lastduel_state,madgear)
475475{
476   UINT8 *ROM = machine().root_device().memregion("audiocpu")->base();
476   UINT8 *ROM = memregion("audiocpu")->base();
477477
478   machine().root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000);
478   membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000);
479479
480480   MACHINE_START_CALL_MEMBER(lastduel);
481481}
trunk/src/mame/drivers/taito_b.c
r21033r21034
27452745#if 0
27462746void taitob_state::ryujin_patch(void)
27472747{
2748   UINT16 *rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
2748   UINT16 *rom = (UINT16*)memregion("maincpu")->base();
27492749   rom[ 0x62/2 ] = 1;
27502750   //0 (already in rom) - Taito Corporation 1993
27512751   //1 - Taito America corp with blue FBI logo
r21033r21034
27982798#if 0
27992799void taitob_state::sbm_patch(void)
28002800{
2801   UINT16 *rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
2801   UINT16 *rom = (UINT16*)memregion("maincpu")->base();
28022802   rom[ 0x7ffff/2 ] = 2; //US version
28032803}
28042804#endif
r21033r21034
36523652
36533653DRIVER_INIT_MEMBER(taitob_state,taito_b)
36543654{
3655   machine().root_device().membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
3655   membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x10000, 0x4000);
36563656}
36573657
36583658GAME( 1989, masterw,  0,       masterw,  masterw, taitob_state,  taito_b, ROT270, "Taito Corporation Japan", "Master of Weapon (World)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/cischeat.c
r21033r21034
17831783*/
17841784void cischeat_state::cischeat_untangle_sprites(const char *region)
17851785{
1786   UINT8       *src = machine().root_device().memregion(region)->base();
1787   const UINT8 *end = src + machine().root_device().memregion(region)->bytes();
1786   UINT8       *src = memregion(region)->base();
1787   const UINT8 *end = src + memregion(region)->bytes();
17881788
17891789   while (src < end)
17901790   {
trunk/src/mame/drivers/freekick.c
r21033r21034
611611
612612MACHINE_START_MEMBER(freekick_state,pbillrd)
613613{
614   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
614   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000);
615615
616616   MACHINE_START_CALL_MEMBER(freekick);
617617}
r21033r21034
11361136DRIVER_INIT_MEMBER(freekick_state,gigasb)
11371137{
11381138   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
1139   space.set_decrypted_region(0x0000, 0xbfff, machine().root_device().memregion("maincpu")->base() + 0x10000);
1139   space.set_decrypted_region(0x0000, 0xbfff, memregion("maincpu")->base() + 0x10000);
11401140}
11411141
11421142
trunk/src/mame/drivers/redclash.c
r21033r21034
536536DRIVER_INIT_MEMBER(ladybug_state,redclash)
537537{
538538   int i,j;
539   const UINT8 *src = machine().root_device().memregion("gfx2")->base();
540   UINT8 *dst = machine().root_device().memregion("gfx3")->base();
541   int len = machine().root_device().memregion("gfx3")->bytes();
539   const UINT8 *src = memregion("gfx2")->base();
540   UINT8 *dst = memregion("gfx3")->base();
541   int len = memregion("gfx3")->bytes();
542542
543543   /* rearrange the sprite graphics */
544544   for (i = 0;i < len;i++)
trunk/src/mame/drivers/hng64.c
r21033r21034
16111611
16121612DRIVER_INIT_MEMBER(hng64_state,hng64_reorder_gfx)
16131613{
1614   hng64_reorder(machine(), machine().root_device().memregion("scrtile")->base(), machine().root_device().memregion("scrtile")->bytes());
1614   hng64_reorder(machine(), memregion("scrtile")->base(), memregion("scrtile")->bytes());
16151615}
16161616
16171617#define HACK_REGION
trunk/src/mame/drivers/centiped.c
r21033r21034
524524
525525   /* if we're to read the dipswitches behind the trackball data, do it now */
526526   if (m_dsw_select)
527      return (machine().root_device().ioport(portnames[switch_port])->read() & 0x7f) | m_sign[idx];
527      return (ioport(portnames[switch_port])->read() & 0x7f) | m_sign[idx];
528528
529529   /* get the new position and adjust the result */
530   newpos = machine().root_device().ioport(tracknames[idx])->read();
530   newpos = ioport(tracknames[idx])->read();
531531   if (newpos != m_oldpos[idx])
532532   {
533533      m_sign[idx] = (newpos - m_oldpos[idx]) & 0x80;
r21033r21034
535535   }
536536
537537   /* blend with the bits from the switch port */
538   return (machine().root_device().ioport(portnames[switch_port])->read() & 0x70) | (m_oldpos[idx] & 0x0f) | m_sign[idx];
538   return (ioport(portnames[switch_port])->read() & 0x70) | (m_oldpos[idx] & 0x0f) | m_sign[idx];
539539}
540540
541541
r21033r21034
21792179
21802180DRIVER_INIT_MEMBER(centiped_state,multiped)
21812181{
2182   UINT8 *src = machine().root_device().memregion("user1")->base();
2183   UINT8 *dest = machine().root_device().memregion("maincpu")->base();
2182   UINT8 *src = memregion("user1")->base();
2183   UINT8 *dest = memregion("maincpu")->base();
21842184
21852185   // descramble rom and put in maincpu region
21862186   for (int i = 0; i < 0x10000; i++)
trunk/src/mame/drivers/shougi.c
r21033r21034
136136
137137void shougi_state::palette_init()
138138{
139   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
139   const UINT8 *color_prom = memregion("proms")->base();
140140   int i;
141141   static const int resistances_b[2]  = { 470, 220 };
142142   static const int resistances_rg[3] = { 1000, 470, 220 };
trunk/src/mame/drivers/hornet.c
r21033r21034
907907
908908void hornet_state::machine_reset()
909909{
910   UINT8 *usr3 = machine().root_device().memregion("user3")->base();
911   UINT8 *usr5 = machine().root_device().memregion("user5")->base();
910   UINT8 *usr3 = memregion("user3")->base();
911   UINT8 *usr5 = memregion("user5")->base();
912912   if (usr3 != NULL)
913913   {
914      machine().root_device().membank("bank1")->configure_entries(0, machine().root_device().memregion("user3")->bytes() / 0x10000, usr3, 0x10000);
915      machine().root_device().membank("bank1")->set_entry(0);
914      membank("bank1")->configure_entries(0, memregion("user3")->bytes() / 0x10000, usr3, 0x10000);
915      membank("bank1")->set_entry(0);
916916   }
917917
918918   machine().device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
919919
920920   if (usr5)
921      machine().root_device().membank("bank5")->set_base(usr5);
921      membank("bank5")->set_base(usr5);
922922}
923923
924924static double adc12138_input_callback( device_t *device, UINT8 input )
r21033r21034
10421042
10431043MACHINE_RESET_MEMBER(hornet_state,hornet_2board)
10441044{
1045   UINT8 *usr3 = machine().root_device().memregion("user3")->base();
1046   UINT8 *usr5 = machine().root_device().memregion("user5")->base();
1045   UINT8 *usr3 = memregion("user3")->base();
1046   UINT8 *usr5 = memregion("user5")->base();
10471047
10481048   if (usr3 != NULL)
10491049   {
1050      machine().root_device().membank("bank1")->configure_entries(0, machine().root_device().memregion("user3")->bytes() / 0x10000, usr3, 0x10000);
1051      machine().root_device().membank("bank1")->set_entry(0);
1050      membank("bank1")->configure_entries(0, memregion("user3")->bytes() / 0x10000, usr3, 0x10000);
1051      membank("bank1")->set_entry(0);
10521052   }
10531053   machine().device("dsp")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
10541054   machine().device("dsp2")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
10551055
10561056   if (usr5)
10571057   {
1058      machine().root_device().membank("bank5")->set_base(usr5);
1059      machine().root_device().membank("bank6")->set_base(usr5);
1058      membank("bank5")->set_base(usr5);
1059      membank("bank6")->set_base(usr5);
10601060   }
10611061}
10621062
trunk/src/mame/drivers/cabal.c
r21033r21034
836836{
837837   address_space &space = machine().device(cpu)->memory().space(AS_PROGRAM);
838838   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, length);
839   UINT8 *rom = machine().root_device().memregion(cpu)->base();
839   UINT8 *rom = memregion(cpu)->base();
840840
841841   space.set_decrypted_region(0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt);
842842
843843   memcpy(decrypt, rom+length, length);
844844
845845   if (length > 0x10000)
846      machine().root_device().membank("bank1")->configure_decrypted_entries(0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
846      membank("bank1")->configure_decrypted_entries(0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
847847}
848848
849849
trunk/src/mame/drivers/welltris.c
r21033r21034
687687{
688688#if WELLTRIS_4P_HACK
689689   /* A Hack which shows 4 player mode in code which is disabled */
690   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
690   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
691691   RAM[0xB91C/2] = 0x4e71;
692692   RAM[0xB91E/2] = 0x4e71;
693693#endif
trunk/src/mame/drivers/aquarium.c
r21033r21034
238238
239239DRIVER_INIT_MEMBER(aquarium_state,aquarium)
240240{
241   UINT8 *Z80 = machine().root_device().memregion("audiocpu")->base();
241   UINT8 *Z80 = memregion("audiocpu")->base();
242242
243243   /* The BG tiles are 5bpp, this rearranges the data from
244244      the roms containing the 1bpp data so we can decode it
245245      correctly */
246   UINT8 *DAT2 = machine().root_device().memregion("gfx1")->base() + 0x080000;
247   UINT8 *DAT = machine().root_device().memregion("user1")->base();
246   UINT8 *DAT2 = memregion("gfx1")->base() + 0x080000;
247   UINT8 *DAT = memregion("user1")->base();
248248   int len = 0x0200000;
249249
250250   for (len = 0; len < 0x020000; len++)
r21033r21034
259259      DAT2[len * 4 + 2] |= (DAT[len] & 0x01) << 3;
260260   }
261261
262   DAT2 = machine().root_device().memregion("gfx4")->base() + 0x080000;
263   DAT = machine().root_device().memregion("user2")->base();
262   DAT2 = memregion("gfx4")->base() + 0x080000;
263   DAT = memregion("user2")->base();
264264
265265   for (len = 0; len < 0x020000; len++)
266266   {
r21033r21034
275275   }
276276
277277   /* configure and set up the sound bank */
278   machine().root_device().membank("bank1")->configure_entries(0, 7, &Z80[0x18000], 0x8000);
279   machine().root_device().membank("bank1")->set_entry(1);
278   membank("bank1")->configure_entries(0, 7, &Z80[0x18000], 0x8000);
279   membank("bank1")->set_entry(1);
280280}
281281
282282
trunk/src/mame/drivers/angelkds.c
r21033r21034
738738
739739DRIVER_INIT_MEMBER(angelkds_state,angelkds)
740740{
741   UINT8 *RAM = machine().root_device().memregion("user1")->base();
742   machine().root_device().membank("bank1")->configure_entries(0, 8, &RAM[0x0000], 0x4000);
741   UINT8 *RAM = memregion("user1")->base();
742   membank("bank1")->configure_entries(0, 8, &RAM[0x0000], 0x4000);
743743}
744744
745745DRIVER_INIT_MEMBER(angelkds_state,spcpostn)
746746{
747   UINT8 *RAM = machine().root_device().memregion("user1")->base();
747   UINT8 *RAM = memregion("user1")->base();
748748
749749   sega_317_0005_decode(machine(), "maincpu");
750   machine().root_device().membank("bank1")->configure_entries(0, 10, &RAM[0x0000], 0x4000);
750   membank("bank1")->configure_entries(0, 10, &RAM[0x0000], 0x4000);
751751}
752752
753753
trunk/src/mame/drivers/photon2.c
r21033r21034
201201      logerror( "Unknown banking write: %02X\n", data);
202202   }
203203
204   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000*bank );
204   membank("bank1")->set_base(memregion("maincpu")->base() + 0x4000*bank );
205205}
206206
207207READ8_MEMBER(photon2_state::photon2_fe_r)
r21033r21034
314314
315315void photon2_state::machine_reset()
316316{
317   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
317   membank("bank1")->set_base(memregion("maincpu")->base());
318318}
319319
320320static MACHINE_CONFIG_START( photon2, photon2_state )
trunk/src/mame/drivers/jrpacman.c
r21033r21034
412412      { 0,0 }
413413   };
414414
415   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
415   UINT8 *RAM = memregion("maincpu")->base();
416416   int i, j, A;
417417
418418   for (i = A = 0; table[i].count; i++)
trunk/src/mame/drivers/cvs.c
r21033r21034
15741574
15751575DRIVER_INIT_MEMBER(cvs_state,huncholy)
15761576{
1577   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1577   UINT8 *ROM = memregion("maincpu")->base();
15781578
15791579   /* patch out protection */
15801580   ROM[0x0082] = 0xc0;
r21033r21034
15941594
15951595DRIVER_INIT_MEMBER(cvs_state,hunchbaka)
15961596{
1597   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1597   UINT8 *ROM = memregion("maincpu")->base();
15981598
15991599   offs_t offs;
16001600
r21033r21034
16061606
16071607DRIVER_INIT_MEMBER(cvs_state,superbik)
16081608{
1609   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1609   UINT8 *ROM = memregion("maincpu")->base();
16101610
16111611   /* patch out protection */
16121612   ROM[0x0079] = 0xc0;
r21033r21034
16341634
16351635DRIVER_INIT_MEMBER(cvs_state,hero)
16361636{
1637   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1637   UINT8 *ROM = memregion("maincpu")->base();
16381638
16391639   /* patch out protection */
16401640   ROM[0x0087] = 0xc0;
r21033r21034
16561656
16571657DRIVER_INIT_MEMBER(cvs_state,raiders)
16581658{
1659   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1659   UINT8 *ROM = memregion("maincpu")->base();
16601660
16611661   offs_t offs;
16621662
trunk/src/mame/drivers/gaplus.c
r21033r21034
862862   UINT8 *rom;
863863   int i;
864864
865   rom = machine().root_device().memregion("gfx1")->base();
865   rom = memregion("gfx1")->base();
866866   for (i = 0;i < 0x2000;i++)
867867      rom[i + 0x2000] = rom[i] >> 4;
868868
869   rom = machine().root_device().memregion("gfx2")->base() + 0x6000;
869   rom = memregion("gfx2")->base() + 0x6000;
870870   for (i = 0;i < 0x2000;i++)
871871      rom[i + 0x2000] = rom[i] << 4;
872872}
trunk/src/mame/drivers/nightgal.c
r21033r21034
302302/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
303303void nightgal_state::palette_init()
304304{
305   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
305   const UINT8 *color_prom = memregion("proms")->base();
306306   static const int resistances_rg[3] = { 1000, 470, 220 };
307307   static const int resistances_b [2] = { 470, 220 };
308308   double weights_rg[3], weights_b[2];
r21033r21034
12641264
12651265DRIVER_INIT_MEMBER(nightgal_state,royalqn)
12661266{
1267   UINT8 *ROM = machine().root_device().memregion("sub")->base();
1267   UINT8 *ROM = memregion("sub")->base();
12681268
12691269   /* patch open bus / protection */
12701270   ROM[0xc27e] = 0x02;
r21033r21034
12731273
12741274DRIVER_INIT_MEMBER(nightgal_state,ngalsumr)
12751275{
1276   UINT8 *ROM = machine().root_device().memregion("sub")->base();
1276   UINT8 *ROM = memregion("sub")->base();
12771277
12781278   /* patch protection */
12791279   ROM[0xd6ce] = 0x02;
trunk/src/mame/drivers/5clown.c
r21033r21034
545545
546546void _5clown_state::palette_init()
547547{
548   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
548   const UINT8 *color_prom = memregion("proms")->base();
549549/*
550550    7654 3210
551551    ---- ---x   RED component.
r21033r21034
12191219
12201220   /* Decrypting GFX by segments */
12211221
1222   UINT8 *gfx1_src = machine().root_device().memregion( "gfx1" )->base();
1223   UINT8 *gfx2_src = machine().root_device().memregion( "gfx2" )->base();
1222   UINT8 *gfx1_src = memregion( "gfx1" )->base();
1223   UINT8 *gfx2_src = memregion( "gfx2" )->base();
12241224
12251225   for (x = 0x2000; x < 0x3000; x++)
12261226   {
r21033r21034
12401240
12411241   /* Decrypting sound samples */
12421242
1243   UINT8 *samples_src = machine().root_device().memregion( "oki6295" )->base();
1243   UINT8 *samples_src = memregion( "oki6295" )->base();
12441244
12451245   for (x = 0x0000; x < 0x10000; x++)
12461246   {
trunk/src/mame/drivers/wink.c
r21033r21034
410410DRIVER_INIT_MEMBER(wink_state,wink)
411411{
412412   UINT32 i;
413   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
413   UINT8 *ROM = memregion("maincpu")->base();
414414   UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x8000);
415415
416416   // protection module reverse engineered by HIGHWAYMAN
trunk/src/mame/drivers/namcos23.c
r21033r21034
33023302   m_c361.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos23_state::c361_timer_cb),this));
33033303   m_c361.timer->adjust(attotime::never);
33043304
3305   mips3drc_add_fastram(m_maincpu, 0, m_mainram.bytes()-1, FALSE, reinterpret_cast<UINT32 *>(machine().root_device().memshare("mainram")->ptr()));
3305   mips3drc_add_fastram(m_maincpu, 0, m_mainram.bytes()-1, FALSE, reinterpret_cast<UINT32 *>(memshare("mainram")->ptr()));
33063306}
33073307
33083308
trunk/src/mame/drivers/commando.c
r21033r21034
510510DRIVER_INIT_MEMBER(commando_state,commando)
511511{
512512   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
513   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
513   UINT8 *rom = memregion("maincpu")->base();
514514   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000);
515515   int A;
516516
r21033r21034
530530DRIVER_INIT_MEMBER(commando_state,spaceinv)
531531{
532532   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
533   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
533   UINT8 *rom = memregion("maincpu")->base();
534534   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000);
535535   int A;
536536
trunk/src/mame/drivers/ninjakd2.c
r21033r21034
908908void ninjakd2_state::machine_reset()
909909{
910910   /* initialize main Z80 bank */
911   int num_banks = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x4000;
912   machine().root_device().membank("bank1")->configure_entries(0, num_banks, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
913   machine().root_device().membank("bank1")->set_entry(0);
911   int num_banks = (memregion("maincpu")->bytes() - 0x10000) / 0x4000;
912   membank("bank1")->configure_entries(0, num_banks, memregion("maincpu")->base() + 0x10000, 0x4000);
913   membank("bank1")->set_entry(0);
914914
915915   m_rom_bank_mask = num_banks - 1;
916916}
r21033r21034
14181418
14191419void ninjakd2_state::lineswap_gfx_roms(const char *region, const int bit)
14201420{
1421   const int length = machine().root_device().memregion(region)->bytes();
1422   UINT8* const src = machine().root_device().memregion(region)->base();
1421   const int length = memregion(region)->bytes();
1422   UINT8* const src = memregion(region)->base();
14231423   UINT8* const temp = auto_alloc_array(machine(), UINT8, length);
14241424   const int mask = (1 << (bit + 1)) - 1;
14251425
r21033r21034
14511451DRIVER_INIT_MEMBER(ninjakd2_state,bootleg)
14521452{
14531453   address_space &space = machine().device("soundcpu")->memory().space(AS_PROGRAM);
1454   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("soundcpu")->base() + 0x10000);
1454   space.set_decrypted_region(0x0000, 0x7fff, memregion("soundcpu")->base() + 0x10000);
14551455
14561456   gfx_unscramble();
14571457}
trunk/src/mame/drivers/yunsung8.c
r21033r21034
9898   device_t *device = machine().device("msm");
9999   msm5205_reset_w(device, data & 0x20);
100100
101   machine().root_device().membank("bank2")->set_entry(data & 0x07);
101   membank("bank2")->set_entry(data & 0x07);
102102
103103   if (data != (data & (~0x27)))
104104      logerror("%s: Bank %02X\n", machine().describe_context(), data);
trunk/src/mame/drivers/alg.c
r21033r21034
7777{
7878   const rectangle &visarea = screen.visible_area();
7979
80   int xpos = screen.machine().root_device().ioport((player == 0) ? "GUN1X" : "GUN2X")->read_safe(0xffffffff);
81   int ypos = screen.machine().root_device().ioport((player == 0) ? "GUN1Y" : "GUN2Y")->read_safe(0xffffffff);
80   int xpos = screen.ioport((player == 0) ? "GUN1X" : "GUN2X")->read_safe(0xffffffff);
81   int ypos = screen.ioport((player == 0) ? "GUN1Y" : "GUN2Y")->read_safe(0xffffffff);
8282
8383   if (xpos == -1 || ypos == -1)
8484      return FALSE;
r21033r21034
248248
249249READ8_MEMBER(alg_state::alg_cia_0_porta_r)
250250{
251   return machine().root_device().ioport("FIRE")->read() | 0x3f;
251   return ioport("FIRE")->read() | 0x3f;
252252}
253253
254254
r21033r21034
705705
706706   /* set up memory */
707707   m_bank1->configure_entry(0, m_chip_ram);
708   m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base());
708   m_bank1->configure_entry(1, memregion("user1")->base());
709709}
710710
711711
r21033r21034
718718
719719DRIVER_INIT_MEMBER(alg_state,palr1)
720720{
721   UINT32 length = machine().root_device().memregion("user2")->bytes();
722   UINT8 *rom = machine().root_device().memregion("user2")->base();
721   UINT32 length = memregion("user2")->bytes();
722   UINT8 *rom = memregion("user2")->base();
723723   UINT8 *original = auto_alloc_array(machine(), UINT8, length);
724724   UINT32 srcaddr;
725725
r21033r21034
738738
739739DRIVER_INIT_MEMBER(alg_state,palr3)
740740{
741   UINT32 length = machine().root_device().memregion("user2")->bytes();
742   UINT8 *rom = machine().root_device().memregion("user2")->base();
741   UINT32 length = memregion("user2")->bytes();
742   UINT8 *rom = memregion("user2")->base();
743743   UINT8 *original = auto_alloc_array(machine(), UINT8, length);
744744   UINT32 srcaddr;
745745
r21033r21034
757757
758758DRIVER_INIT_MEMBER(alg_state,palr6)
759759{
760   UINT32 length = machine().root_device().memregion("user2")->bytes();
761   UINT8 *rom = machine().root_device().memregion("user2")->base();
760   UINT32 length = memregion("user2")->bytes();
761   UINT8 *rom = memregion("user2")->base();
762762   UINT8 *original = auto_alloc_array(machine(), UINT8, length);
763763   UINT32 srcaddr;
764764
r21033r21034
779779DRIVER_INIT_MEMBER(alg_state,aplatoon)
780780{
781781   /* NOT DONE TODO FIGURE OUT THE RIGHT ORDER!!!! */
782   UINT8 *rom = machine().root_device().memregion("user2")->base();
782   UINT8 *rom = memregion("user2")->base();
783783   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x40000);
784784   int i;
785785
trunk/src/mame/drivers/warpwarp.c
r21033r21034
235235/* Read Dipswitches */
236236READ8_MEMBER(warpwarp_state::warpwarp_dsw1_r)
237237{
238   return (machine().root_device().ioport("DSW1")->read() >> (offset & 7)) & 1;
238   return (ioport("DSW1")->read() >> (offset & 7)) & 1;
239239}
240240
241241/* Read mux Controller Inputs */
trunk/src/mame/drivers/wheelfir.c
r21033r21034
780780      m_zoom_table[i]=-1;
781781   }
782782
783   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
783   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
784784
785785   for(int j=0;j<400;++j)
786786   {
r21033r21034
859859
860860DRIVER_INIT_MEMBER(wheelfir_state,wheelfir)
861861{
862   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
862   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
863863   RAM[0xdd3da/2] = 0x4e71; //hack
864864}
865865
trunk/src/mame/drivers/deco32.c
r21033r21034
32443244extern void process_dvi_data(UINT8* dvi_data, int offset, int regionsize);
32453245DRIVER_INIT_MEMBER(dragngun_state,dragngun)
32463246{
3247   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("maincpu")->base();
3248   const UINT8 *SRC_RAM = machine().root_device().memregion("gfx1")->base();
3249   UINT8 *DST_RAM = machine().root_device().memregion("gfx2")->base();
3247   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
3248   const UINT8 *SRC_RAM = memregion("gfx1")->base();
3249   UINT8 *DST_RAM = memregion("gfx2")->base();
32503250
32513251   deco74_decrypt_gfx(machine(), "gfx1");
32523252   deco74_decrypt_gfx(machine(), "gfx2");
r21033r21034
32593259
32603260#if 0
32613261   {
3262      UINT8 *ROM = machine().root_device().memregion("dvi")->base();
3262      UINT8 *ROM = memregion("dvi")->base();
32633263
32643264      FILE *fp;
32653265      char filename[256];
r21033r21034
32743274#endif
32753275
32763276   // there are DVI headers at 0x000000, 0x580000, 0x800000, 0xB10000, 0xB80000
3277   process_dvi_data(machine().root_device().memregion("dvi")->base(),0x000000, 0x1000000);
3278   process_dvi_data(machine().root_device().memregion("dvi")->base(),0x580000, 0x1000000);
3279   process_dvi_data(machine().root_device().memregion("dvi")->base(),0x800000, 0x1000000);
3280   process_dvi_data(machine().root_device().memregion("dvi")->base(),0xB10000, 0x1000000);
3281   process_dvi_data(machine().root_device().memregion("dvi")->base(),0xB80000, 0x1000000);
3277   process_dvi_data(memregion("dvi")->base(),0x000000, 0x1000000);
3278   process_dvi_data(memregion("dvi")->base(),0x580000, 0x1000000);
3279   process_dvi_data(memregion("dvi")->base(),0x800000, 0x1000000);
3280   process_dvi_data(memregion("dvi")->base(),0xB10000, 0x1000000);
3281   process_dvi_data(memregion("dvi")->base(),0xB80000, 0x1000000);
32823282
32833283}
32843284
r21033r21034
32923292
32933293DRIVER_INIT_MEMBER(dragngun_state,lockload)
32943294{
3295   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
3296//  UINT32 *ROM = (UINT32 *)machine().root_device().memregion("maincpu")->base();
3295   UINT8 *RAM = memregion("maincpu")->base();
3296//  UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
32973297
32983298   deco74_decrypt_gfx(machine(), "gfx1");
32993299   deco74_decrypt_gfx(machine(), "gfx2");
r21033r21034
33093309
33103310DRIVER_INIT_MEMBER(deco32_state,tattass)
33113311{
3312   UINT8 *RAM = machine().root_device().memregion("gfx1")->base();
3312   UINT8 *RAM = memregion("gfx1")->base();
33133313   UINT8 *tmp = auto_alloc_array(machine(), UINT8, 0x80000);
33143314
33153315   /* Reorder bitplanes to make decoding easier */
r21033r21034
33173317   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33183318   memcpy(RAM+0x100000,tmp,0x80000);
33193319
3320   RAM = machine().root_device().memregion("gfx2")->base();
3320   RAM = memregion("gfx2")->base();
33213321   memcpy(tmp,RAM+0x80000,0x80000);
33223322   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33233323   memcpy(RAM+0x100000,tmp,0x80000);
r21033r21034
33303330
33313331DRIVER_INIT_MEMBER(deco32_state,nslasher)
33323332{
3333   UINT8 *RAM = machine().root_device().memregion("gfx1")->base();
3333   UINT8 *RAM = memregion("gfx1")->base();
33343334   UINT8 *tmp = auto_alloc_array(machine(), UINT8, 0x80000);
33353335
33363336   /* Reorder bitplanes to make decoding easier */
r21033r21034
33383338   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33393339   memcpy(RAM+0x100000,tmp,0x80000);
33403340
3341   RAM = machine().root_device().memregion("gfx2")->base();
3341   RAM = memregion("gfx2")->base();
33423342   memcpy(tmp,RAM+0x80000,0x80000);
33433343   memcpy(RAM+0x80000,RAM+0x100000,0x80000);
33443344   memcpy(RAM+0x100000,tmp,0x80000);
trunk/src/mame/drivers/nbmj8891.c
r21033r21034
5353
5454DRIVER_INIT_MEMBER(nbmj8891_state,gionbana)
5555{
56   UINT8 *prot = machine().root_device().memregion("protection")->base();
56   UINT8 *prot = memregion("protection")->base();
5757   int i;
5858
5959   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
7777DRIVER_INIT_MEMBER(nbmj8891_state,omotesnd)
7878{
7979#if 0
80   UINT8 *prot = machine().root_device().memregion("protection")->base();
80   UINT8 *prot = memregion("protection")->base();
8181   int i;
8282
8383   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
9292#endif
9393
9494#if 1
95   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
95   UINT8 *ROM = memregion("maincpu")->base();
9696
9797   // Protection ROM check skip
9898   ROM[0x0106] = 0x00;
r21033r21034
127127
128128DRIVER_INIT_MEMBER(nbmj8891_state,telmahjn)
129129{
130   UINT8 *prot = machine().root_device().memregion("protection")->base();
130   UINT8 *prot = memregion("protection")->base();
131131   int i;
132132
133133   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
145145
146146DRIVER_INIT_MEMBER(nbmj8891_state,mgmen89)
147147{
148   UINT8 *prot = machine().root_device().memregion("protection")->base();
148   UINT8 *prot = memregion("protection")->base();
149149   int i;
150150
151151   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
163163
164164DRIVER_INIT_MEMBER(nbmj8891_state,mjfocus)
165165{
166   UINT8 *prot = machine().root_device().memregion("protection")->base();
167   UINT8 *ram = machine().root_device().memregion("maincpu")->base() + 0xf800;
166   UINT8 *prot = memregion("protection")->base();
167   UINT8 *ram = memregion("maincpu")->base() + 0xf800;
168168   int i;
169169
170170   /* need to clear RAM otherwise it doesn't boot... */
r21033r21034
186186DRIVER_INIT_MEMBER(nbmj8891_state,mjfocusm)
187187{
188188#if 1
189   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
189   UINT8 *ROM = memregion("maincpu")->base();
190190
191191   // Protection ROM check skip
192192   ROM[0x014e] = 0x00;
r21033r21034
198198
199199DRIVER_INIT_MEMBER(nbmj8891_state,scandal)
200200{
201   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
201   UINT8 *ROM = memregion("maincpu")->base();
202202   int i;
203203
204204   for (i = 0xf800; i < 0x10000; i++) ROM[i] = 0x00;
r21033r21034
215215{
216216   /* they forgot to enable the protection check in this game... */
217217#if 0
218   UINT8 *prot = machine().root_device().memregion("protection")->base();
218   UINT8 *prot = memregion("protection")->base();
219219   int i;
220220
221   machine().root_device().memregion("maincpu")->base()[0x003d] = 0x01;    // force the protection check to be executed
221   memregion("maincpu")->base()[0x003d] = 0x01;    // force the protection check to be executed
222222
223223   /* this is one possible way to rearrange the protection ROM data to get the
224224      expected 0xfe1a checksum. It's probably completely wrong! But since the
r21033r21034
276276
277277DRIVER_INIT_MEMBER(nbmj8891_state,pairsnb)
278278{
279   UINT8 *prot = machine().root_device().memregion("protection")->base();
279   UINT8 *prot = memregion("protection")->base();
280280   int i;
281281
282282   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
294294
295295DRIVER_INIT_MEMBER(nbmj8891_state,pairsten)
296296{
297   UINT8 *prot = machine().root_device().memregion("protection")->base();
297   UINT8 *prot = memregion("protection")->base();
298298   int i;
299299
300300   /* this is one possible way to rearrange the protection ROM data to get the
trunk/src/mame/drivers/liberate.c
r21033r21034
13451345
13461346DRIVER_INIT_MEMBER(liberate_state,prosport)
13471347{
1348   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
1348   UINT8 *RAM = memregion("maincpu")->base();
13491349   int i;
13501350
13511351   /* Main cpu has the nibbles swapped */
r21033r21034
13661366   int A;
13671367   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
13681368   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x10000);
1369   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
1369   UINT8 *ROM = memregion("maincpu")->base();
13701370
13711371   space.set_decrypted_region(0x0000, 0xffff, decrypted);
13721372
r21033r21034
13771377      decrypted[A] = (decrypted[A] & 0x7d) | ((decrypted[A] & 0x02) << 6) | ((decrypted[A] & 0x80) >> 6);
13781378   }
13791379
1380   machine().root_device().membank("bank1")->configure_decrypted_entry(0, decrypted + 0x8000);
1380   membank("bank1")->configure_decrypted_entry(0, decrypted + 0x8000);
13811381}
13821382
13831383/*************************************
trunk/src/mame/drivers/zaxxon.c
r21033r21034
15181518
15191519   int A;
15201520   address_space &space = machine().device(cputag)->memory().space(AS_PROGRAM);
1521   UINT8 *rom = machine().root_device().memregion(cputag)->base();
1522   int size = machine().root_device().memregion(cputag)->bytes();
1521   UINT8 *rom = memregion(cputag)->base();
1522   int size = memregion(cputag)->bytes();
15231523   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size);
15241524
15251525   space.set_decrypted_region(0x0000, size - 1, decrypt);
trunk/src/mame/drivers/asuka.c
r21033r21034
253253
254254WRITE8_MEMBER(asuka_state::sound_bankswitch_2151_w)
255255{
256   machine().root_device().membank("bank1")->set_entry(data & 0x03);
256   membank("bank1")->set_entry(data & 0x03);
257257}
258258
259259
trunk/src/mame/drivers/m62.c
r21033r21034
21502150DRIVER_INIT_MEMBER(m62_state,battroad)
21512151{
21522152   /* configure memory banks */
2153   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
2153   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x2000);
21542154}
21552155
21562156DRIVER_INIT_MEMBER(m62_state,ldrun2)
21572157{
21582158   /* configure memory banks */
2159   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
2159   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x2000);
21602160}
21612161
21622162DRIVER_INIT_MEMBER(m62_state,ldrun4)
21632163{
21642164   /* configure memory banks */
2165   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
2165   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000);
21662166}
21672167
21682168DRIVER_INIT_MEMBER(m62_state,kidniki)
21692169{
2170   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
2170   UINT8 *ROM = memregion("maincpu")->base();
21712171
21722172   /* in Kid Niki, bank 0 has code falling from 7fff to 8000, */
21732173   /* so I have to copy it there because bank switching wouldn't catch it */
21742174   memcpy(ROM + 0x08000, ROM + 0x10000, 0x2000);
21752175
21762176   /* configure memory banks */
2177   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
2177   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x2000);
21782178}
21792179
21802180DRIVER_INIT_MEMBER(m62_state,spelunkr)
21812181{
21822182   /* configure memory banks */
2183   machine().root_device().membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x2000);
2183   membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x2000);
21842184}
21852185
21862186DRIVER_INIT_MEMBER(m62_state,spelunk2)
21872187{
21882188   /* configure memory banks */
2189   machine().root_device().membank("bank1")->configure_entries(0,  4, machine().root_device().memregion("maincpu")->base() + 0x20000, 0x1000);
2190   machine().root_device().membank("bank2")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x1000);
2189   membank("bank1")->configure_entries(0,  4, memregion("maincpu")->base() + 0x20000, 0x1000);
2190   membank("bank2")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x1000);
21912191}
21922192
21932193DRIVER_INIT_MEMBER(m62_state,youjyudn)
21942194{
21952195   /* configure memory banks */
2196   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
2196   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000);
21972197}
21982198
21992199GAME( 1984, kungfum,  0,        kungfum,  kungfum, driver_device,  0,        ROT0,   "Irem", "Kung-Fu Master", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/citycon.c
r21033r21034
331331
332332DRIVER_INIT_MEMBER(citycon_state,citycon)
333333{
334   UINT8 *rom = machine().root_device().memregion("gfx1")->base();
334   UINT8 *rom = memregion("gfx1")->base();
335335   int i;
336336
337337   /*
trunk/src/mame/drivers/megatech.c
r21033r21034
587587      return IMAGE_INIT_FAIL;
588588
589589   //printf("load list\n");
590   UINT8 *ROM = image.device().machine().root_device().memregion(this_cart->region)->base();
590   UINT8 *ROM = image.device().memregion(this_cart->region)->base();
591591   //printf("load list2\n");
592592   UINT32 length = image.get_software_region_length("rom");
593593   memcpy(ROM, image.get_software_region("rom"), length);
trunk/src/mame/drivers/capbowl.c
r21033r21034
107107
108108INTERRUPT_GEN_MEMBER(capbowl_state::capbowl_interrupt)
109109{
110   if (machine().root_device().ioport("SERVICE")->read() & 1)                      /* get status of the F2 key */
110   if (ioport("SERVICE")->read() & 1)                      /* get status of the F2 key */
111111      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);    /* trigger self test */
112112}
113113
r21033r21034
491491
492492DRIVER_INIT_MEMBER(capbowl_state,capbowl)
493493{
494   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
494   UINT8 *ROM = memregion("maincpu")->base();
495495
496496   /* configure ROM banks in 0x0000-0x3fff */
497   machine().root_device().membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
497   membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
498498}
499499
500500
trunk/src/mame/drivers/nmk16.c
r21033r21034
748748   /*needed because of the uncompatibility of the dsw settings.*/
749749   if(dsw_setting) // Thunder Dragon
750750   {
751      dsw[0] = (machine().root_device().ioport("DSW2")->read() & 0x7);
752      dsw[1] = (machine().root_device().ioport("DSW2")->read() & 0x38) >> 3;
751      dsw[0] = (ioport("DSW2")->read() & 0x7);
752      dsw[1] = (ioport("DSW2")->read() & 0x38) >> 3;
753753      for(i=0;i<2;i++)
754754      {
755755         switch(dsw[i] & 7)
r21033r21034
767767   }
768768   else // Hacha Mecha Fighter
769769   {
770      dsw[0] = (machine().root_device().ioport("DSW1")->read() & 0x0700) >> 8;
771      dsw[1] = (machine().root_device().ioport("DSW1")->read() & 0x3800) >> 11;
770      dsw[0] = (ioport("DSW1")->read() & 0x0700) >> 8;
771      dsw[1] = (ioport("DSW1")->read() & 0x3800) >> 11;
772772      for(i=0;i<2;i++)
773773      {
774774         switch(dsw[i] & 7)
r21033r21034
786786   }
787787
788788   /*read the coin port*/
789   coin_input = (~(machine().root_device().ioport("IN0")->read()));
789   coin_input = (~(ioport("IN0")->read()));
790790
791791   if(coin_input & 0x01)//coin 1
792792   {
r21033r21034
10711071
10721072WRITE8_MEMBER(nmk16_state::raphero_sound_rombank_w)
10731073{
1074   membank("bank1")->set_base(machine().root_device().memregion("audiocpu")->base() + 0x10000 + (data & 0x07) * 0x4000);
1074   membank("bank1")->set_base(memregion("audiocpu")->base() + 0x10000 + (data & 0x07) * 0x4000);
10751075}
10761076
10771077static ADDRESS_MAP_START( raphero_sound_mem_map, AS_PROGRAM, 8, nmk16_state )
r21033r21034
44104410
44114411
44124412   /* background */
4413   rom = machine().root_device().memregion("gfx2")->base();
4414   len = machine().root_device().memregion("gfx2")->bytes();
4413   rom = memregion("gfx2")->base();
4414   len = memregion("gfx2")->bytes();
44154415   for (A = 0;A < len;A++)
44164416   {
44174417      rom[A] = decode_byte( rom[A], decode_data_bg[bjtwin_address_map_bg0(A)]);
44184418   }
44194419
44204420   /* sprites */
4421   rom = machine().root_device().memregion("gfx3")->base();
4422   len = machine().root_device().memregion("gfx3")->bytes();
4421   rom = memregion("gfx3")->base();
4422   len = memregion("gfx3")->bytes();
44234423   for (A = 0;A < len;A += 2)
44244424   {
44254425      UINT16 tmp = decode_word( rom[A+1]*256 + rom[A], decode_data_sprite[bjtwin_address_map_sprites(A)]);
r21033r21034
44484448      {0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
44494449   };
44504450
4451   rom = machine().root_device().memregion("maincpu")->base();
4452   len = machine().root_device().memregion("maincpu")->bytes();
4451   rom = memregion("maincpu")->base();
4452   len = memregion("maincpu")->bytes();
44534453   for (A = 0;A < len;A += 2)
44544454   {
44554455      int h = A+NATIVE_ENDIAN_VALUE_LE_BE(1,0), l = A+NATIVE_ENDIAN_VALUE_LE_BE(0,1);
r21033r21034
44584458      rom[l] = tmp & 0xff;
44594459   }
44604460
4461   rom = machine().root_device().memregion("gfx2")->base();
4462   len = machine().root_device().memregion("gfx2")->bytes();
4461   rom = memregion("gfx2")->base();
4462   len = memregion("gfx2")->bytes();
44634463   for (A = 0;A < len;A++)
44644464   {
44654465      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
44664466   }
44674467
4468   rom = machine().root_device().memregion("gfx3")->base();
4469   len = machine().root_device().memregion("gfx3")->bytes();
4468   rom = memregion("gfx3")->base();
4469   len = memregion("gfx3")->bytes();
44704470   for (A = 0;A < len;A++)
44714471   {
44724472      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
r21033r21034
44854485      {0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
44864486   };
44874487
4488   rom = machine().root_device().memregion("gfx2")->base();
4489   len = machine().root_device().memregion("gfx2")->bytes();
4488   rom = memregion("gfx2")->base();
4489   len = memregion("gfx2")->bytes();
44904490   for (A = 0;A < len;A++)
44914491   {
44924492      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
44934493   }
44944494
4495   rom = machine().root_device().memregion("gfx3")->base();
4496   len = machine().root_device().memregion("gfx3")->bytes();
4495   rom = memregion("gfx3")->base();
4496   len = memregion("gfx3")->bytes();
44974497   for (A = 0;A < len;A++)
44984498   {
44994499      rom[A] = decode_byte( rom[A], decode_data_tdragonbgfx[0]);
r21033r21034
45084508
45094509DRIVER_INIT_MEMBER(nmk16_state,hachamf)
45104510{
4511   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
4511   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
45124512
45134513   //rom[0x0006/2] = 0x7dc2;   /* replace reset vector with the "real" one */
45144514
r21033r21034
45244524
45254525DRIVER_INIT_MEMBER(nmk16_state,tdragon)
45264526{
4527   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
4527   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
45284528
45294529   //rom[0x94b0/2] = 0; /* Patch out JMP to shared memory (protection) */
45304530   //rom[0x94b2/2] = 0x92f4;
r21033r21034
45574557 *  008F7E: 207C 000F 9000           movea.l #$f9000, A0
45584558 */
45594559#if 0
4560   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
4560   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
45614561   rom[0x09172/2] = 0x6006;    /* patch checksum error */
45624562   rom[0x08f74/2] = 0x4e71;
45634563#endif
trunk/src/mame/drivers/champbwl.c
r21033r21034
534534
535535MACHINE_START_MEMBER(champbwl_state,doraemon)
536536{
537   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
538   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
537   UINT8 *ROM = memregion("maincpu")->base();
538   membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
539539}
540540
541541static MACHINE_CONFIG_START( doraemon, champbwl_state )
trunk/src/mame/drivers/skyarmy.c
r21033r21034
8989
9090void skyarmy_state::palette_init()
9191{
92   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
92   const UINT8 *color_prom = memregion("proms")->base();
9393   int i;
9494
9595   for (i = 0;i < 32;i++)
trunk/src/mame/drivers/poolshrk.c
r21033r21034
1414
1515DRIVER_INIT_MEMBER(poolshrk_state,poolshrk)
1616{
17   UINT8* pSprite = machine().root_device().memregion("gfx1")->base();
18   UINT8* pOffset = machine().root_device().memregion("proms")->base();
17   UINT8* pSprite = memregion("gfx1")->base();
18   UINT8* pOffset = memregion("proms")->base();
1919
2020   int i;
2121   int j;
trunk/src/mame/drivers/forte2.c
r21033r21034
143143DRIVER_INIT_MEMBER(forte2_state,pesadelo)
144144{
145145   int i;
146   UINT8 *mem = machine().root_device().memregion("maincpu")->base();
147   int memsize = machine().root_device().memregion("maincpu")->bytes();
146   UINT8 *mem = memregion("maincpu")->base();
147   int memsize = memregion("maincpu")->bytes();
148148   UINT8 *buf;
149149
150150   // data swap
trunk/src/mame/drivers/battlex.c
r21033r21034
307307
308308DRIVER_INIT_MEMBER(battlex_state,battlex)
309309{
310   UINT8 *colormask = machine().root_device().memregion("user1")->base();
311   UINT8 *gfxdata = machine().root_device().memregion("user2")->base();
312   UINT8 *dest = machine().root_device().memregion("gfx1")->base();
310   UINT8 *colormask = memregion("user1")->base();
311   UINT8 *gfxdata = memregion("user2")->base();
312   UINT8 *dest = memregion("gfx1")->base();
313313
314314   int tile, line, bit;
315315
trunk/src/mame/drivers/fgoal.c
r21033r21034
4747
4848void fgoal_state::palette_init()
4949{
50   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
50   const UINT8 *color_prom = memregion("proms")->base();
5151   int i;
5252
5353   /* for B/W screens PCB can be jumpered to use lower half of PROM */
trunk/src/mame/drivers/dmndrby.c
r21033r21034
447447// copied from elsewhere. surely incorrect
448448void dmndrby_state::palette_init()
449449{
450   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
450   const UINT8 *color_prom = memregion("proms")->base();
451451   static const int resistances_rg[3] = { 1000, 470, 220 };
452452   static const int resistances_b [2] = { 470, 220 };
453453   double rweights[3], gweights[3], bweights[2];
r21033r21034
489489   }
490490
491491   /* color_prom now points to the beginning of the lookup table */
492   color_prom = machine().root_device().memregion("proms2")->base();
492   color_prom = memregion("proms2")->base();
493493
494494   /* normal tiles use colors 0-15 */
495495   for (i = 0x000; i < 0x300; i++)
trunk/src/mame/drivers/gundealr.c
r21033r21034
491491         break;
492492   }
493493
494   m_rambase[0x004] = machine().root_device().ioport("IN2")->read();
495   m_rambase[0x005] = machine().root_device().ioport("IN1")->read();
496   m_rambase[0x006] = machine().root_device().ioport("IN0")->read();
494   m_rambase[0x004] = ioport("IN2")->read();
495   m_rambase[0x005] = ioport("IN1")->read();
496   m_rambase[0x006] = ioport("IN0")->read();
497497}
498498
499499static MACHINE_CONFIG_DERIVED( yamyam, gundealr )
trunk/src/mame/drivers/junofrst.c
r21033r21034
518518{
519519   UINT8 *decrypted = konami1_decode(machine(), "maincpu");
520520
521   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x1000);
522   machine().root_device().membank("bank1")->configure_decrypted_entries(0, 16, decrypted + 0x10000, 0x1000);
521   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x1000);
522   membank("bank1")->configure_decrypted_entries(0, 16, decrypted + 0x10000, 0x1000);
523523}
524524
525525
trunk/src/mame/drivers/voyager.c
r21033r21034
724724
725725void voyager_state::machine_reset()
726726{
727   //machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("bios")->base() + 0x10000);
728   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("bios")->base());
727   //membank("bank1")->set_base(memregion("bios")->base() + 0x10000);
728   membank("bank1")->set_base(memregion("bios")->base());
729729}
730730
731731static void set_gate_a20(running_machine &machine, int a20)
trunk/src/mame/drivers/drgnmst.c
r21033r21034
477477
478478DRIVER_INIT_MEMBER(drgnmst_state,drgnmst)
479479{
480   UINT8 *drgnmst_PICROM_HEX = machine().root_device().memregion("user1")->base();
481   UINT16 *drgnmst_PICROM = (UINT16 *)machine().root_device().memregion("audiocpu")->base();
482   UINT8 *drgnmst_PCM = machine().root_device().memregion("oki1")->base();
480   UINT8 *drgnmst_PICROM_HEX = memregion("user1")->base();
481   UINT16 *drgnmst_PICROM = (UINT16 *)memregion("audiocpu")->base();
482   UINT8 *drgnmst_PCM = memregion("oki1")->base();
483483   INT32   offs, data;
484484   UINT16  src_pos = 0;
485485   UINT16  dst_pos = 0;
trunk/src/mame/drivers/nbmj8688.c
r21033r21034
5959
6060DRIVER_INIT_MEMBER(nbmj8688_state,mjcamera)
6161{
62   UINT8 *rom = machine().root_device().memregion("voice")->base() + 0x20000;
63   UINT8 *prot = machine().root_device().memregion("user1")->base();
62   UINT8 *rom = memregion("voice")->base() + 0x20000;
63   UINT8 *prot = memregion("user1")->base();
6464   int i;
6565
6666   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
7979DRIVER_INIT_MEMBER(nbmj8688_state,kanatuen)
8080{
8181   /* uses the same protection data as mjcamer, but a different check */
82   UINT8 *rom = machine().root_device().memregion("voice")->base() + 0x30000;
82   UINT8 *rom = memregion("voice")->base() + 0x30000;
8383
8484   rom[0x0004] = 0x09;
8585   rom[0x0103] = 0x0e;
r21033r21034
9393{
9494#if 1
9595   /* uses the same protection data as ????, but a different check */
96   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
96   UINT8 *rom = memregion("maincpu")->base();
9797
9898   rom[0x0149] = 0x00;
9999   rom[0x014a] = 0x00;
r21033r21034
105105
106106DRIVER_INIT_MEMBER(nbmj8688_state,idhimitu)
107107{
108   UINT8 *rom = machine().root_device().memregion("voice")->base() + 0x20000;
109   UINT8 *prot = machine().root_device().memregion("user1")->base();
108   UINT8 *rom = memregion("voice")->base() + 0x20000;
109   UINT8 *prot = memregion("user1")->base();
110110   int i;
111111
112112   /* this is one possible way to rearrange the protection ROM data to get the
r21033r21034
130130
131131DRIVER_INIT_MEMBER(nbmj8688_state,kaguya2)
132132{
133   UINT8 *rom = machine().root_device().memregion("voice")->base() + 0x20000;
134   UINT8 *prot = machine().root_device().memregion("user1")->base();
133   UINT8 *rom = memregion("voice")->base() + 0x20000;
134   UINT8 *prot = memregion("user1")->base();
135135   int i;
136136
137137   /* this is one possible way to rearrange the protection ROM data to get the
trunk/src/mame/drivers/hitpoker.c
r21033r21034
524524
525525DRIVER_INIT_MEMBER(hitpoker_state,hitpoker)
526526{
527   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
527   UINT8 *ROM = memregion("maincpu")->base();
528528
529529   // init nvram
530530   machine().device<nvram_device>("nvram")->set_base(m_eeprom_data, sizeof(m_eeprom_data));
trunk/src/mame/drivers/vicdual.c
r21033r21034
184184
185185int vicdual_state::vicdual_is_cabinet_color()
186186{
187   return (machine().root_device().ioport(COLOR_BW_PORT_TAG)->read_safe(0) & 1) ? 0 : 1;
187   return (ioport(COLOR_BW_PORT_TAG)->read_safe(0) & 1) ? 0 : 1;
188188}
189189
190190
trunk/src/mame/drivers/ginganin.c
r21033r21034
373373   UINT16 *rom;
374374
375375   /* main cpu patches */
376   rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
376   rom = (UINT16 *)memregion("maincpu")->base();
377377   /* avoid writes to rom getting to the log */
378378   rom[0x408 / 2] = 0x6000;
379379   rom[0x40a / 2] = 0x001c;
r21033r21034
381381
382382   /* sound cpu patches */
383383   /* let's clear the RAM: ROM starts at 0x4000 */
384   memset(machine().root_device().memregion("audiocpu")->base(), 0, 0x800);
384   memset(memregion("audiocpu")->base(), 0, 0x800);
385385}
386386
387387
trunk/src/mame/drivers/tail2nos.c
r21033r21034
2828
2929WRITE8_MEMBER(tail2nos_state::sound_bankswitch_w)
3030{
31   machine().root_device().membank("bank3")->set_entry(data & 0x01);
31   membank("bank3")->set_entry(data & 0x01);
3232}
3333
3434static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, tail2nos_state )
trunk/src/mame/drivers/slapshot.c
r21033r21034
717717DRIVER_INIT_MEMBER(slapshot_state,slapshot)
718718{
719719   UINT32 offset,i;
720   UINT8 *gfx = machine().root_device().memregion("gfx2")->base();
721   int size = machine().root_device().memregion("gfx2")->bytes();
720   UINT8 *gfx = memregion("gfx2")->base();
721   int size = memregion("gfx2")->bytes();
722722   int data;
723723
724724   offset = size / 2;
trunk/src/mame/drivers/thief.c
r21033r21034
3636INTERRUPT_GEN_MEMBER(thief_state::thief_interrupt)
3737{
3838   /* SLAM switch causes an NMI if it's pressed */
39   if( (machine().root_device().ioport("P2")->read() & 0x10) == 0 )
39   if( (ioport("P2")->read() & 0x10) == 0 )
4040      device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
4141   else
4242      device.execute().set_input_line(0, HOLD_LINE);
r21033r21034
634634
635635DRIVER_INIT_MEMBER(thief_state,thief)
636636{
637   UINT8 *dest = machine().root_device().memregion( "maincpu" )->base();
638   const UINT8 *source = machine().root_device().memregion( "cpu1" )->base();
637   UINT8 *dest = memregion( "maincpu" )->base();
638   const UINT8 *source = memregion( "cpu1" )->base();
639639
640640   /* C8 is mapped (banked) in CPU1's address space; it contains Z80 code */
641641   memcpy( &dest[0xe010], &source[0x290], 0x20 );
trunk/src/mame/drivers/nbmj8991.c
r21033r21034
6262   device_t *audiocpu = machine().device("audiocpu");
6363   if (audiocpu != NULL && audiocpu->type() == Z80)
6464   {
65      machine().root_device().membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("audiocpu")->base() + 0x8000, 0x8000);
66      machine().root_device().membank("bank1")->set_entry(0);
65      membank("bank1")->configure_entries(0, 4, memregion("audiocpu")->base() + 0x8000, 0x8000);
66      membank("bank1")->set_entry(0);
6767   }
6868   MACHINE_RESET_CALL_LEGACY(nb1413m3);
6969}
r21033r21034
100100
101101DRIVER_INIT_MEMBER(nbmj8991_state,finalbny)
102102{
103   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
103   UINT8 *ROM = memregion("maincpu")->base();
104104   int i;
105105
106106   for (i = 0xf800; i < 0x10000; i++) ROM[i] = 0x00;
r21033r21034
126126DRIVER_INIT_MEMBER(nbmj8991_state,galkaika)
127127{
128128#if 1
129   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
129   UINT8 *ROM = memregion("maincpu")->base();
130130
131131   // Patch to IM2 -> IM1
132132   ROM[0x0002] = 0x56;
r21033r21034
137137DRIVER_INIT_MEMBER(nbmj8991_state,tokyogal)
138138{
139139#if 1
140   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
140   UINT8 *ROM = memregion("maincpu")->base();
141141
142142   // Patch to IM2 -> IM1
143143   ROM[0x0002] = 0x56;
r21033r21034
148148DRIVER_INIT_MEMBER(nbmj8991_state,tokimbsj)
149149{
150150#if 1
151   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
151   UINT8 *ROM = memregion("maincpu")->base();
152152
153153   // Patch to IM2 -> IM1
154154   ROM[0x0002] = 0x56;
trunk/src/mame/drivers/meyc8088.c
r21033r21034
117117
118118void meyc8088_state::palette_init()
119119{
120   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
120   const UINT8 *color_prom = memregion("proms")->base();
121121   rgb_t *rgb;
122122
123123   rgb = compute_res_net_all(machine(), color_prom, &meyc8088_decode_info, &meyc8088_net_info);
trunk/src/mame/drivers/igs_m027.c
r21033r21034
284284{
285285   int i;
286286   unsigned rom_size = 0x80000;
287   UINT8 *src = (UINT8 *) (machine().root_device().memregion("gfx1")->base());
287   UINT8 *src = (UINT8 *) (memregion("gfx1")->base());
288288   UINT8 *result_data = auto_alloc_array(machine(), UINT8, rom_size);
289289
290290   for (i=0; i<rom_size; i++)
r21033r21034
844844
845845void igs_m027_state::pgm_create_dummy_internal_arm_region()
846846{
847   UINT16 *temp16 = (UINT16 *)machine().root_device().memregion("maincpu")->base();
847   UINT16 *temp16 = (UINT16 *)memregion("maincpu")->base();
848848
849849   // fill with RX 14
850850   int i;
trunk/src/mame/drivers/hshavoc.c
r21033r21034
118118DRIVER_INIT_MEMBER(md_boot_state,hshavoc)
119119{
120120   int x;
121   UINT16 *src = (UINT16 *)machine().root_device().memregion("maincpu")->base();
121   UINT16 *src = (UINT16 *)memregion("maincpu")->base();
122122
123123   static const UINT16 typedat[16] = {
124124      1,1,1,1, 1,1,1,1,
trunk/src/mame/drivers/subsino2.c
r21033r21034
23792379
23802380DRIVER_INIT_MEMBER(subsino2_state,bishjan)
23812381{
2382   UINT16 *rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
2382   UINT16 *rom = (UINT16*)memregion("maincpu")->base();
23832383
23842384   // patch serial protection test (it always enters test mode on boot otherwise)
23852385   rom[0x042EA/2] = 0x4008;
r21033r21034
24432443
24442444DRIVER_INIT_MEMBER(subsino2_state,expcard)
24452445{
2446   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2446   UINT8 *rom = memregion("maincpu")->base();
24472447
24482448   // patch protection test (it always enters test mode on boot otherwise)
24492449   rom[0xed4dc-0xc0000] = 0xeb;
r21033r21034
25412541   subsino_decrypt(machine(), crsbingo_bitswaps, crsbingo_xors, 0x8000);
25422542
25432543   // patch serial protection test (it always enters test mode on boot otherwise)
2544   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2544   UINT8 *rom = memregion("maincpu")->base();
25452545   rom[0x0cec] = 0x18;
25462546   rom[0xb037] = 0x18;
25472547
r21033r21034
25952595
25962596DRIVER_INIT_MEMBER(subsino2_state,saklove)
25972597{
2598   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2598   UINT8 *rom = memregion("maincpu")->base();
25992599
26002600   // patch serial protection test (it always enters test mode on boot otherwise)
26012601   rom[0x0e029] = 0xeb;
r21033r21034
26552655
26562656DRIVER_INIT_MEMBER(subsino2_state,xplan)
26572657{
2658   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2658   UINT8 *rom = memregion("maincpu")->base();
26592659
26602660   // patch protection test (it always enters test mode on boot otherwise)
26612661   rom[0xeded9-0xc0000] = 0xeb;
r21033r21034
27152715
27162716DRIVER_INIT_MEMBER(subsino2_state,xtrain)
27172717{
2718   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2718   UINT8 *rom = memregion("maincpu")->base();
27192719
27202720   // patch protection test (it always enters test mode on boot otherwise)
27212721   rom[0xe190f-0xc0000] = 0xeb;
r21033r21034
27602760   subsino_decrypt(machine(), victor5_bitswaps, victor5_xors, 0x8000);
27612761
27622762   // patch serial protection test (it always enters test mode on boot otherwise)
2763   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
2763   UINT8 *rom = memregion("maincpu")->base();
27642764   rom[0x0d79] = 0x18;
27652765   rom[0xc1cf] = 0x18;
27662766   rom[0xc2a9] = 0x18;
trunk/src/mame/drivers/tecmosys.c
r21033r21034
630630
631631void tecmosys_state::tecmosys_descramble()
632632{
633   UINT8 *gfxsrc  = machine().root_device().memregion( "gfx1" )->base();
634   size_t srcsize = machine().root_device().memregion( "gfx1" )->bytes();
633   UINT8 *gfxsrc  = memregion( "gfx1" )->base();
634   size_t srcsize = memregion( "gfx1" )->bytes();
635635   int i;
636636
637637   for (i=0; i < srcsize; i+=4)
trunk/src/mame/drivers/fcrash.c
r21033r21034
16201620DRIVER_INIT_MEMBER(cps_state, sf2mdt)
16211621{
16221622   int i;
1623   UINT32 gfx_size = machine().root_device().memregion( "gfx" )->bytes();
1624   UINT8 *rom = machine().root_device().memregion( "gfx" )->base();
1623   UINT32 gfx_size = memregion( "gfx" )->bytes();
1624   UINT8 *rom = memregion( "gfx" )->base();
16251625   UINT8 tmp;
16261626
16271627   for( i = 0; i < gfx_size; i += 8 )
trunk/src/mame/drivers/exidy440.c
r21033r21034
307307
308308   /* select the bank and update the bank pointer */
309309   m_bank = bank;
310   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + m_bank * 0x4000]);
310   membank("bank1")->set_base(&memregion("maincpu")->base()[0x10000 + m_bank * 0x4000]);
311311}
312312
313313
trunk/src/mame/drivers/seta2.c
r21033r21034
124124   if (ACCESSING_BITS_0_7)
125125   {
126126      UINT8 *ROM = memregion( "x1snd" )->base();
127      int banks = (machine().root_device().memregion( "x1snd" )->bytes() - 0x100000) / 0x20000;
127      int banks = (memregion( "x1snd" )->bytes() - 0x100000) / 0x20000;
128128      if (data >= banks)
129129      {
130130         logerror("CPU #0 PC %06X: invalid sound bank %04X\n",space.device().safe_pc(),data);
r21033r21034
21752175   }
21762176   else
21772177   {
2178      UINT8 press   = machine().root_device().ioport("TOUCH_PRESS")->read();
2178      UINT8 press   = ioport("TOUCH_PRESS")->read();
21792179      UINT8 release = m_funcube_press && !press;
21802180
21812181      if ( press || release )
21822182      {
21832183         m_funcube_serial_fifo[0] = press ? 0xfe : 0xfd;
2184         m_funcube_serial_fifo[1] = machine().root_device().ioport("TOUCH_X")->read();
2185         m_funcube_serial_fifo[2] = machine().root_device().ioport("TOUCH_Y")->read();
2184         m_funcube_serial_fifo[1] = ioport("TOUCH_X")->read();
2185         m_funcube_serial_fifo[2] = ioport("TOUCH_Y")->read();
21862186         m_funcube_serial_fifo[3] = 0xff;
21872187         m_funcube_serial_count = 4;
21882188      }
r21033r21034
24912491
24922492DRIVER_INIT_MEMBER(seta2_state,funcube)
24932493{
2494   UINT32 *main_cpu = (UINT32 *) machine().root_device().memregion("maincpu")->base();
2495   UINT16 *sub_cpu  = (UINT16 *) machine().root_device().memregion("sub")->base();
2494   UINT32 *main_cpu = (UINT32 *) memregion("maincpu")->base();
2495   UINT16 *sub_cpu  = (UINT16 *) memregion("sub")->base();
24962496
24972497   main_cpu[0x064/4] = 0x0000042a; // PIC protection?
24982498
r21033r21034
25022502
25032503DRIVER_INIT_MEMBER(seta2_state,funcube2)
25042504{
2505   UINT32 *main_cpu = (UINT32 *) machine().root_device().memregion("maincpu")->base();
2506   UINT16 *sub_cpu  = (UINT16 *) machine().root_device().memregion("sub")->base();
2505   UINT32 *main_cpu = (UINT32 *) memregion("maincpu")->base();
2506   UINT16 *sub_cpu  = (UINT16 *) memregion("sub")->base();
25072507
25082508   main_cpu[0xa5c/4] = 0x4e713e3c;       // PIC protection?
25092509   main_cpu[0xa74/4] = 0x4e713e3c;
r21033r21034
25152515
25162516DRIVER_INIT_MEMBER(seta2_state,funcube3)
25172517{
2518   UINT32 *main_cpu = (UINT32 *) machine().root_device().memregion("maincpu")->base();
2519   UINT16 *sub_cpu  = (UINT16 *) machine().root_device().memregion("sub")->base();
2518   UINT32 *main_cpu = (UINT32 *) memregion("maincpu")->base();
2519   UINT16 *sub_cpu  = (UINT16 *) memregion("sub")->base();
25202520
25212521   main_cpu[0x008bc/4] = 0x4a804e71;
25222522   main_cpu[0x19f0c/4] = 0x4e714e71;
trunk/src/mame/drivers/jongkyo.c
r21033r21034
434434void jongkyo_state::palette_init()
435435{
436436   int i;
437   UINT8* proms = machine().root_device().memregion("proms")->base();
437   UINT8* proms = memregion("proms")->base();
438438   for (i = 0; i < 0x40; i++)
439439   {
440440      int data = proms[i];
r21033r21034
546546DRIVER_INIT_MEMBER(jongkyo_state,jongkyo)
547547{
548548   int i;
549   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
549   UINT8 *rom = memregion("maincpu")->base();
550550
551551   /* first of all, do a simple bitswap */
552552   for (i = 0x6000; i < 0x9000; ++i)
trunk/src/mame/drivers/dassault.c
r21033r21034
968968
969969DRIVER_INIT_MEMBER(dassault_state,dassault)
970970{
971   const UINT8 *src = machine().root_device().memregion("gfx1")->base();
972   UINT8 *dst = machine().root_device().memregion("gfx2")->base();
971   const UINT8 *src = memregion("gfx1")->base();
972   UINT8 *dst = memregion("gfx2")->base();
973973   UINT8 *tmp = auto_alloc_array(machine(), UINT8, 0x80000);
974974
975975   /* Playfield 4 also has access to the char graphics, make things easier
r21033r21034
985985
986986DRIVER_INIT_MEMBER(dassault_state,thndzone)
987987{
988   const UINT8 *src = machine().root_device().memregion("gfx1")->base();
989   UINT8 *dst = machine().root_device().memregion("gfx2")->base();
988   const UINT8 *src = memregion("gfx1")->base();
989   UINT8 *dst = memregion("gfx2")->base();
990990   UINT8 *tmp = auto_alloc_array(machine(), UINT8, 0x80000);
991991
992992   /* Playfield 4 also has access to the char graphics, make things easier
trunk/src/mame/drivers/dambustr.c
r21033r21034
207207{
208208   int i, j, tmp;
209209   int tmpram[16];
210   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
211   UINT8 *usr = machine().root_device().memregion("user1")->base();
212   UINT8 *gfx = machine().root_device().memregion("gfx1")->base();
210   UINT8 *rom = memregion("maincpu")->base();
211   UINT8 *usr = memregion("user1")->base();
212   UINT8 *gfx = memregion("gfx1")->base();
213213
214214   // Bit swap addresses
215215   for(i=0; i<4096*4; i++) {
trunk/src/mame/drivers/model2.c
r21033r21034
11491149
11501150READ32_MEMBER(model2_state::maxx_r)
11511151{
1152   UINT32 *ROM = (UINT32 *)machine().root_device().memregion("maincpu")->base();
1152   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
11531153
11541154   if (offset <= 0x1f/4)
11551155   {
r21033r21034
18451845WRITE16_MEMBER(model2_state::model2snd_ctrl)
18461846{
18471847   // handle sample banking
1848   if (machine().root_device().memregion("scsp")->bytes() > 0x800000)
1848   if (memregion("scsp")->bytes() > 0x800000)
18491849   {
18501850      UINT8 *snd = memregion("scsp")->base();
18511851      if (data & 0x20)
trunk/src/mame/drivers/chihiro.c
r21033r21034
15341534
15351535   logerror("baseboard: read sector lba %08x\n",lba);
15361536   off=(lba&0x7ff)*512;
1537   data=machine().root_device().memregion("others")->base();
1537   data=memregion("others")->base();
15381538   memcpy(buffer,data+off,512);
15391539   return 1;
15401540}
trunk/src/mame/drivers/blmbycar.c
r21033r21034
508508
509509DRIVER_INIT_MEMBER(blmbycar_state,blmbycar)
510510{
511   UINT16 *RAM  = (UINT16 *) machine().root_device().memregion("maincpu")->base();
512   size_t size = machine().root_device().memregion("maincpu")->bytes() / 2;
511   UINT16 *RAM  = (UINT16 *) memregion("maincpu")->base();
512   size_t size = memregion("maincpu")->bytes() / 2;
513513   int i;
514514
515515   for (i = 0; i < size; i++)
trunk/src/mame/drivers/toratora.c
r21033r21034
164164      m_last = ioport("INPUT")->read() & 0x0f;
165165      generic_pulse_irq_line(device.execute(), 0, 1);
166166   }
167   m_pia_u1->set_a_input(machine().root_device().ioport("INPUT")->read() & 0x0f, 0);
168   m_pia_u1->ca1_w(machine().root_device().ioport("INPUT")->read() & 0x10);
169   m_pia_u1->ca2_w(machine().root_device().ioport("INPUT")->read() & 0x20);
167   m_pia_u1->set_a_input(ioport("INPUT")->read() & 0x0f, 0);
168   m_pia_u1->ca1_w(ioport("INPUT")->read() & 0x10);
169   m_pia_u1->ca2_w(ioport("INPUT")->read() & 0x20);
170170}
171171
172172READ8_MEMBER(toratora_state::timer_r)
trunk/src/mame/drivers/pokechmp.c
r21033r21034
242242DRIVER_INIT_MEMBER(pokechmp_state,pokechmp)
243243{
244244   // default sound rom bank
245   machine().root_device().membank("bank3")->configure_entries(0, 2, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
245   membank("bank3")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0x4000);
246246
247247   // default fixed area for main CPU
248   machine().root_device().membank("fixed")->set_base( machine().root_device().memregion("maincpu")->base() + 0x18000 );
248   membank("fixed")->set_base( memregion("maincpu")->base() + 0x18000 );
249249
250250   // default OKI sample bank
251   machine().root_device().membank("okibank")->set_base( machine().root_device().memregion("oki")->base() + 0x40000 );
251   membank("okibank")->set_base( memregion("oki")->base() + 0x40000 );
252252}
253253
254254
trunk/src/mame/drivers/igs017.c
r21033r21034
464464
465465void igs017_state::decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0)
466466{
467   int length = machine().root_device().memregion("maincpu")->bytes();
468   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
467   int length = memregion("maincpu")->bytes();
468   UINT8 *rom = memregion("maincpu")->base();
469469   UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
470470   int i;
471471
r21033r21034
517517
518518void igs017_state::iqblocka_patch_rom()
519519{
520   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
520   UINT8 *rom = memregion("maincpu")->base();
521521
522522//  rom[0x7b64] = 0xc9;
523523
r21033r21034
558558
559559void igs017_state::tjsb_decrypt_sprites()
560560{
561   int length = machine().root_device().memregion("sprites")->bytes();
562   UINT8 *rom = machine().root_device().memregion("sprites")->base();
561   int length = memregion("sprites")->bytes();
562   UINT8 *rom = memregion("sprites")->base();
563563   UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
564564   int i, addr;
565565
r21033r21034
594594void igs017_state::mgcs_decrypt_program_rom()
595595{
596596   int i;
597   UINT16 *src = (UINT16 *)machine().root_device().memregion("maincpu")->base();
597   UINT16 *src = (UINT16 *)memregion("maincpu")->base();
598598
599599   int rom_size = 0x80000;
600600
r21033r21034
643643
644644void igs017_state::mgcs_decrypt_tiles()
645645{
646   int length = machine().root_device().memregion("tilemaps")->bytes();
647   UINT8 *rom = machine().root_device().memregion("tilemaps")->base();
646   int length = memregion("tilemaps")->bytes();
647   UINT8 *rom = memregion("tilemaps")->base();
648648   UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
649649   int i;
650650
r21033r21034
660660
661661void igs017_state::mgcs_flip_sprites()
662662{
663   int length = machine().root_device().memregion("sprites")->bytes();
664   UINT8 *rom = machine().root_device().memregion("sprites")->base();
663   int length = memregion("sprites")->bytes();
664   UINT8 *rom = memregion("sprites")->base();
665665   int i;
666666
667667   for (i = 0;i < length;i+=2)
r21033r21034
681681
682682void igs017_state::mgcs_patch_rom()
683683{
684   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
684   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
685685
686686   rom[0x4e036/2] = 0x6006;
687687
r21033r21034
707707// decryption is incomplete, the first part of code doesn't seem right.
708708DRIVER_INIT_MEMBER(igs017_state,tarzan)
709709{
710   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
710   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
711711   int i;
712712   int size = 0x40000;
713713
r21033r21034
733733// by iq_132
734734DRIVER_INIT_MEMBER(igs017_state,tarzana)
735735{
736   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
736   UINT8 *ROM = memregion("maincpu")->base();
737737   int i;
738738   int size = 0x80000;
739739
r21033r21034
806806{
807807   int size = 0x040000;
808808
809   UINT8 *data = machine().root_device().memregion("maincpu")->base();
809   UINT8 *data = memregion("maincpu")->base();
810810   UINT8 *code = auto_alloc_array(machine(), UINT8, size);
811811   memcpy(code, data, size);
812812
r21033r21034
824824DRIVER_INIT_MEMBER(igs017_state,sdmg2)
825825{
826826   int i;
827   UINT16 *src = (UINT16 *)machine().root_device().memregion("maincpu")->base();
827   UINT16 *src = (UINT16 *)memregion("maincpu")->base();
828828
829829   int rom_size = 0x80000;
830830
r21033r21034
881881DRIVER_INIT_MEMBER(igs017_state,mgdha)
882882{
883883   int i;
884   UINT16 *src = (UINT16 *)machine().root_device().memregion("maincpu")->base();
884   UINT16 *src = (UINT16 *)memregion("maincpu")->base();
885885
886886   int rom_size = 0x80000;
887887
r21033r21034
916916{
917917   DRIVER_INIT_CALL(mgdha);
918918
919   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
919   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
920920
921921   // additional protection
922922   rom[0x4ad50/2] = 0x4e71;
r21033r21034
928928
929929void igs017_state::lhzb2_patch_rom()
930930{
931   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
931   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
932932
933933   // Prot. checks:
934934   rom[0x14786/2] = 0x6044;    // 014786: 6744    beq $147cc
r21033r21034
939939
940940void igs017_state::lhzb2_decrypt_tiles()
941941{
942   int length = machine().root_device().memregion("tilemaps")->bytes();
943   UINT8 *rom = machine().root_device().memregion("tilemaps")->base();
942   int length = memregion("tilemaps")->bytes();
943   UINT8 *rom = memregion("tilemaps")->base();
944944   UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
945945   int i;
946946
r21033r21034
957957
958958void igs017_state::lhzb2_decrypt_sprites()
959959{
960   int length = machine().root_device().memregion("sprites")->bytes();
961   UINT8 *rom = machine().root_device().memregion("sprites")->base();
960   int length = memregion("sprites")->bytes();
961   UINT8 *rom = memregion("sprites")->base();
962962   UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
963963   int i, addr;
964964
r21033r21034
983983DRIVER_INIT_MEMBER(igs017_state,lhzb2)
984984{
985985   int i;
986   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
986   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
987987
988988   int rom_size = 0x80000;
989989
r21033r21034
10771077DRIVER_INIT_MEMBER(igs017_state,lhzb2a)
10781078{
10791079   int i;
1080   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
1080   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
10811081
10821082   int rom_size = 0x80000;
10831083
r21033r21034
11411141
11421142void igs017_state::slqz2_patch_rom()
11431143{
1144   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
1144   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
11451145
11461146   // Prot. checks:
11471147   rom[0x1489c/2] = 0x6044;    // 01489C: 6744    beq $148e2
r21033r21034
11521152
11531153void igs017_state::slqz2_decrypt_tiles()
11541154{
1155   int length = machine().root_device().memregion("tilemaps")->bytes();
1156   UINT8 *rom = machine().root_device().memregion("tilemaps")->base();
1155   int length = memregion("tilemaps")->bytes();
1156   UINT8 *rom = memregion("tilemaps")->base();
11571157   UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
11581158   int i;
11591159
r21033r21034
11701170DRIVER_INIT_MEMBER(igs017_state,slqz2)
11711171{
11721172   int i;
1173   UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
1173   UINT16 *src = (UINT16 *) (memregion("maincpu")->base());
11741174
11751175   int rom_size = 0x80000;
11761176
trunk/src/mame/drivers/cave.c
r21033r21034
44364436
44374437DRIVER_INIT_MEMBER(cave_state,agallet)
44384438{
4439   UINT8 *ROM = machine().root_device().memregion("audiocpu")->base();
4439   UINT8 *ROM = memregion("audiocpu")->base();
44404440   init_cave(machine());
44414441
4442   machine().root_device().membank("bank1")->configure_entries(0, 0x02, &ROM[0x00000], 0x4000);
4443   machine().root_device().membank("bank1")->configure_entries(2, 0x1e, &ROM[0x10000], 0x4000);
4442   membank("bank1")->configure_entries(0, 0x02, &ROM[0x00000], 0x4000);
4443   membank("bank1")->configure_entries(2, 0x1e, &ROM[0x10000], 0x4000);
44444444
4445   ROM = machine().root_device().memregion("oki1")->base();
4446   machine().root_device().membank("bank3")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4447   machine().root_device().membank("bank4")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4445   ROM = memregion("oki1")->base();
4446   membank("bank3")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4447   membank("bank4")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
44484448
4449   ROM = machine().root_device().memregion("oki2")->base();
4450   machine().root_device().membank("bank5")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4451   machine().root_device().membank("bank6")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4449   ROM = memregion("oki2")->base();
4450   membank("bank5")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
4451   membank("bank6")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
44524452
44534453   sailormn_unpack_tiles(machine(), "layer2");
44544454
r21033r21034
45744574   m_time_vblank_irq = 2100;
45754575
45764576   /* setup extra ROM */
4577   membank("bank1")->set_base(machine().root_device().memregion("user1")->base());
4577   membank("bank1")->set_base(memregion("user1")->base());
45784578}
45794579
45804580
r21033r21034
46434643
46444644#if 1       //ROM PATCH
46454645   {
4646      UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
4646      UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
46474647      rom[0xd46c / 2] = 0xd482;           // kurara dash fix  0xd400 -> 0xd482
46484648   }
46494649#endif
trunk/src/mame/drivers/rmhaihai.c
r21033r21034
667667
668668DRIVER_INIT_MEMBER(rmhaihai_state,rmhaihai)
669669{
670   UINT8 *rom = machine().root_device().memregion("gfx1")->base();
671   int size = machine().root_device().memregion("gfx1")->bytes();
670   UINT8 *rom = memregion("gfx1")->base();
671   int size = memregion("gfx1")->bytes();
672672   int a,b;
673673
674674   size /= 2;
trunk/src/mame/drivers/dec8.c
r21033r21034
35163516/* Below, I set up the correct number of banks depending on the "maincpu" region size */
35173517DRIVER_INIT_MEMBER(dec8_state,lastmisn)
35183518{
3519   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3520   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
3519   UINT8 *ROM = memregion("maincpu")->base();
3520   membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
35213521   DRIVER_INIT_CALL(dec8);
35223522}
35233523
35243524DRIVER_INIT_MEMBER(dec8_state,shackled)
35253525{
3526   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3527   machine().root_device().membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
3526   UINT8 *ROM = memregion("maincpu")->base();
3527   membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
35283528   DRIVER_INIT_CALL(dec8);
35293529}
35303530
35313531DRIVER_INIT_MEMBER(dec8_state,gondo)
35323532{
3533   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3534   machine().root_device().membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x4000);
3533   UINT8 *ROM = memregion("maincpu")->base();
3534   membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x4000);
35353535   DRIVER_INIT_CALL(dec8);
35363536}
35373537
35383538DRIVER_INIT_MEMBER(dec8_state,garyoret)
35393539{
3540   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3541   machine().root_device().membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x4000);
3540   UINT8 *ROM = memregion("maincpu")->base();
3541   membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x4000);
35423542   DRIVER_INIT_CALL(dec8);
35433543}
35443544
35453545DRIVER_INIT_MEMBER(dec8_state,ghostb)
35463546{
3547   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3548   UINT8 *RAM = machine().root_device().memregion("proms")->base();
3547   UINT8 *ROM = memregion("maincpu")->base();
3548   UINT8 *RAM = memregion("proms")->base();
35493549
35503550   /* Blank out unused garbage in colour prom to avoid colour overflow */
35513551   memset(RAM + 0x20, 0, 0xe0);
35523552
3553   machine().root_device().membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x4000);
3553   membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x4000);
35543554   DRIVER_INIT_CALL(dec8);
35553555}
35563556
35573557DRIVER_INIT_MEMBER(dec8_state,meikyuh)
35583558{
3559   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3560   UINT8 *RAM = machine().root_device().memregion("proms")->base();
3559   UINT8 *ROM = memregion("maincpu")->base();
3560   UINT8 *RAM = memregion("proms")->base();
35613561
35623562   /* Blank out unused garbage in colour prom to avoid colour overflow */
35633563   memset(RAM + 0x20, 0, 0xe0);
35643564
3565   machine().root_device().membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x4000);
3565   membank("bank1")->configure_entries(0, 12, &ROM[0x10000], 0x4000);
35663566   DRIVER_INIT_CALL(dec8);
35673567}
35683568
35693569DRIVER_INIT_MEMBER(dec8_state,csilver)
35703570{
3571   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3572   UINT8 *RAM = machine().root_device().memregion("audiocpu")->base();
3571   UINT8 *ROM = memregion("maincpu")->base();
3572   UINT8 *RAM = memregion("audiocpu")->base();
35733573
3574   machine().root_device().membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
3575   machine().root_device().membank("bank3")->configure_entries(0, 2, &RAM[0x10000], 0x4000);
3574   membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
3575   membank("bank3")->configure_entries(0, 2, &RAM[0x10000], 0x4000);
35763576   DRIVER_INIT_CALL(dec8);
35773577}
35783578
35793579DRIVER_INIT_MEMBER(dec8_state,oscar)
35803580{
3581   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3582   machine().root_device().membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
3581   UINT8 *ROM = memregion("maincpu")->base();
3582   membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
35833583   DRIVER_INIT_CALL(dec8);
35843584}
35853585
35863586DRIVER_INIT_MEMBER(dec8_state,srdarwin)
35873587{
3588   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3589   machine().root_device().membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
3588   UINT8 *ROM = memregion("maincpu")->base();
3589   membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000);
35903590   DRIVER_INIT_CALL(dec8);
35913591}
35923592
35933593DRIVER_INIT_MEMBER(dec8_state,cobracom)
35943594{
3595   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
3596   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
3595   UINT8 *ROM = memregion("maincpu")->base();
3596   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
35973597   DRIVER_INIT_CALL(dec8);
35983598}
35993599
trunk/src/mame/drivers/acesp.c
r21033r21034
38683868
38693869DRIVER_INIT_MEMBER(ace_sp_state,ace_cr)
38703870{
3871   descramble_crystal(machine().root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
3871   descramble_crystal(memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
38723872}
38733873
38743874DRIVER_INIT_MEMBER(ace_sp_state,ace_sp)
trunk/src/mame/drivers/legionna.c
r21033r21034
23222322DRIVER_INIT_MEMBER(legionna_state,cupsoc)
23232323{
23242324   #if CUPSOC_DEBUG_MODE
2325   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2325   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
23262326
23272327   /*Press p1 button 3 to enter into debug mode during gameplay*/
23282328   ROM[0xffffb/2] = 0x0000;
r21033r21034
23342334DRIVER_INIT_MEMBER(legionna_state,denjinmk)
23352335{
23362336   /* problem with audio comms? */
2337   UINT16 *ROM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
2337   UINT16 *ROM = (UINT16 *)memregion("maincpu")->base();
23382338   ROM[0x5fe4/2] = 0x4e71;
23392339}
23402340
23412341DRIVER_INIT_MEMBER(legionna_state,legiongfx)
23422342{
2343   descramble_legionnaire_gfx(machine().root_device().memregion("gfx5")->base() );
2343   descramble_legionnaire_gfx(memregion("gfx5")->base() );
23442344}
23452345
23462346
trunk/src/mame/drivers/aristmk4.c
r21033r21034
15671567
15681568READ8_MEMBER(aristmk4_state::pa1_r)
15691569{
1570   return (machine().root_device().ioport("SW3")->read() << 4) + machine().root_device().ioport("SW4")->read();
1570   return (ioport("SW3")->read() << 4) + ioport("SW4")->read();
15711571}
15721572
15731573READ8_MEMBER(aristmk4_state::pb1_r)
15741574{
1575   return (machine().root_device().ioport("SW5")->read() << 4) + machine().root_device().ioport("SW6")->read();
1575   return (ioport("SW5")->read() << 4) + ioport("SW6")->read();
15761576}
15771577
15781578READ8_MEMBER(aristmk4_state::pc1_r)
r21033r21034
15941594/* same as Casino Winner HW */
15951595void aristmk4_state::palette_init()
15961596{
1597   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
1597   const UINT8 *color_prom = memregion("proms")->base();
15981598   int i;
15991599
16001600   for (i = 0;i < machine().total_colors();i++)
r21033r21034
16341634void aristmk4_state::machine_reset()
16351635{
16361636   /* mark 4 has a link on the motherboard to switch between 1.5MHz and 3MHz clock speed */
1637   switch(machine().root_device().ioport("LK13")->read())  // CPU speed control... 3mhz or 1.5MHz
1637   switch(ioport("LK13")->read())  // CPU speed control... 3mhz or 1.5MHz
16381638   {
16391639   case 0x00:
16401640      machine().device("maincpu")->set_unscaled_clock(MAIN_CLOCK/4);  // 3 MHz
r21033r21034
16631663   Note: The use of 1 Hz in the timer is to avoid unintentional triggering the NMI ( ie.. hold down L for at least 1 second )
16641664   */
16651665
1666   if(machine().root_device().ioport("powerfail")->read()) // send NMI signal if L pressed
1666   if(ioport("powerfail")->read()) // send NMI signal if L pressed
16671667   {
16681668   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE );
16691669   }
trunk/src/mame/drivers/missb2.c
r21033r21034
7878
7979   sx = 0;
8080
81   prom = machine().root_device().memregion("proms")->base();
81   prom = memregion("proms")->base();
8282   for (offs = 0; offs < m_objectram.bytes(); offs += 4)
8383   {
8484      /* skip empty sprites */
r21033r21034
574574
575575void missb2_state::configure_banks()
576576{
577   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
578   UINT8 *SLAVE = machine().root_device().memregion("slave")->base();
577   UINT8 *ROM = memregion("maincpu")->base();
578   UINT8 *SLAVE = memregion("slave")->base();
579579
580   machine().root_device().membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
580   membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
581581
582582   /* 2009-11 FP: isn't there a way to configure both at once? */
583   machine().root_device().membank("bank2")->configure_entries(0, 7, &SLAVE[0x8000], 0x1000);
584   machine().root_device().membank("bank3")->configure_entries(0, 7, &SLAVE[0x9000], 0x1000);
583   membank("bank2")->configure_entries(0, 7, &SLAVE[0x8000], 0x1000);
584   membank("bank3")->configure_entries(0, 7, &SLAVE[0x9000], 0x1000);
585585}
586586
587587DRIVER_INIT_MEMBER(missb2_state,missb2)
trunk/src/mame/drivers/photon.c
r21033r21034
210210
211211UINT32 photon_state::screen_update_photon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
212212{
213   return pk8000_video_update(screen, bitmap, cliprect, machine().root_device().memregion("maincpu")->base());
213   return pk8000_video_update(screen, bitmap, cliprect, memregion("maincpu")->base());
214214}
215215
216216static MACHINE_CONFIG_START( photon, photon_state )
trunk/src/mame/drivers/jangou.c
r21033r21034
103103/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
104104void jangou_state::palette_init()
105105{
106   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
106   const UINT8 *color_prom = memregion("proms")->base();
107107   static const int resistances_rg[3] = { 1000, 470, 220 };
108108   static const int resistances_b [2] = { 470, 220 };
109109   double weights_rg[3], weights_b[2];
r21033r21034
294294      case 0x20: return ioport("PL2_3")->read();
295295   }
296296
297   return machine().root_device().ioport("IN_NOMUX")->read();
297   return ioport("IN_NOMUX")->read();
298298}
299299
300300READ8_MEMBER(jangou_state::input_system_r)
301301{
302   return machine().root_device().ioport("SYSTEM")->read();
302   return ioport("SYSTEM")->read();
303303}
304304
305305
r21033r21034
13611361{
13621362   // this is WRONG
13631363   int A;
1364   UINT8 *ROM = machine().root_device().memregion("cpu0")->base();
1364   UINT8 *ROM = memregion("cpu0")->base();
13651365
13661366   unsigned char patn1[32] = {
13671367      0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0xA0,
trunk/src/mame/drivers/murogmbl.c
r21033r21034
5454
5555void murogmbl_state::palette_init()
5656{
57   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
57   const UINT8 *color_prom = memregion("proms")->base();
5858   int bit0, bit1, bit2 , r, g, b;
5959   int i;
6060
trunk/src/mame/drivers/darius.c
r21033r21034
12501250DRIVER_INIT_MEMBER(darius_state,darius)
12511251{
12521252   /**** setup sound bank image ****/
1253   UINT8 *RAM = machine().root_device().memregion("audiocpu")->base();
1253   UINT8 *RAM = memregion("audiocpu")->base();
12541254   int  i;
12551255
12561256   for (i = 3; i >= 0; i--)
trunk/src/mame/drivers/foodf.c
r21033r21034
322322
323323READ8_MEMBER(foodf_state::pot_r)
324324{
325   return (machine().root_device().ioport("DSW")->read() >> offset) << 7;
325   return (ioport("DSW")->read() >> offset) << 7;
326326}
327327
328328static const pokey_interface pokey_config =
trunk/src/mame/drivers/st0016.c
r21033r21034
7575
7676WRITE8_MEMBER(st0016_state::st0016_rom_bank_w)
7777{
78   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (data* 0x4000));
78   membank("bank1")->set_base(memregion("maincpu")->base() + (data* 0x4000));
7979   st0016_rom_bank=data;
8080}
8181
r21033r21034
682682DRIVER_INIT_MEMBER(st0016_state,mayjinsn)
683683{
684684   st0016_game=4;//|0x80;
685   machine().root_device().membank("bank2")->set_base(machine().root_device().memregion("user1")->base());
685   membank("bank2")->set_base(memregion("user1")->base());
686686}
687687
688688DRIVER_INIT_MEMBER(st0016_state,mayjisn2)
689689{
690690   st0016_game=4;
691   machine().root_device().membank("bank2")->set_base(machine().root_device().memregion("user1")->base());
691   membank("bank2")->set_base(memregion("user1")->base());
692692}
693693
694694/*************************************
trunk/src/mame/drivers/olibochu.c
r21033r21034
9595
9696void olibochu_state::palette_init()
9797{
98   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
98   const UINT8 *color_prom = memregion("proms")->base();
9999   int i;
100100
101101   for (i = 0; i < machine().total_colors(); i++)
trunk/src/mame/drivers/ultratnk.c
r21033r21034
5050
5151   /* NMI and watchdog are disabled during service mode */
5252
53   machine().watchdog_enable(machine().root_device().ioport("IN0")->read() & 0x40);
53   machine().watchdog_enable(ioport("IN0")->read() & 0x40);
5454
55   if (machine().root_device().ioport("IN0")->read() & 0x40)
55   if (ioport("IN0")->read() & 0x40)
5656      machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
5757
5858   machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(ultratnk_state::nmi_callback),this), scanline);
trunk/src/mame/drivers/kingdrby.c
r21033r21034
315315   UINT16 p1_val,p2_val;
316316   UINT8 p1_res,p2_res;
317317
318   p1_val = machine().root_device().ioport("KEY_1P")->read();
319   p2_val = machine().root_device().ioport("KEY_2P")->read();
318   p1_val = ioport("KEY_1P")->read();
319   p2_val = ioport("KEY_2P")->read();
320320
321321   p1_res = 0;
322322   p2_res = 0;
r21033r21034
958958
959959PALETTE_INIT_MEMBER(kingdrby_state,kingdrby)
960960{
961   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
961   const UINT8 *color_prom = memregion("proms")->base();
962962   int bit0, bit1, bit2 , r, g, b;
963963   int i;
964964
r21033r21034
984984
985985PALETTE_INIT_MEMBER(kingdrby_state,kingdrbb)
986986{
987   UINT8 *raw_prom = machine().root_device().memregion("raw_prom")->base();
988   UINT8 *prom = machine().root_device().memregion("proms")->base();
987   UINT8 *raw_prom = memregion("raw_prom")->base();
988   UINT8 *prom = memregion("proms")->base();
989989   int bit0, bit1, bit2 , r, g, b;
990990   int i;
991991
trunk/src/mame/drivers/r2dx_v33.c
r21033r21034
248248      if(frame == 5)
249249      {
250250         int i,data;
251         static UINT8 *rom = space.machine().root_device().memregion("mainprg")->base();
251         static UINT8 *rom = memregion("mainprg")->base();
252252
253253         for(i=0;i<0x800;i+=2)
254254         {
r21033r21034
752752
753753DRIVER_INIT_MEMBER(r2dx_v33_state,rdx_v33)
754754{
755   machine().root_device().membank("bank1")->configure_entries(0, 0x20, machine().root_device().memregion("mainprg")->base(), 0x20000);
755   membank("bank1")->configure_entries(0, 0x20, memregion("mainprg")->base(), 0x20000);
756756
757757   raiden2_decrypt_sprites(machine());
758758
759   machine().root_device().membank("bank1")->set_entry(1);
759   membank("bank1")->set_entry(1);
760760}
761761
762762DRIVER_INIT_MEMBER(r2dx_v33_state,nzerotea)
763763{
764   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("mainprg")->base(), 0x20000);
764   membank("bank1")->configure_entries(0, 2, memregion("mainprg")->base(), 0x20000);
765765
766766   zeroteam_decrypt_sprites(machine());
767767
768   machine().root_device().membank("bank1")->set_entry(1);
768   membank("bank1")->set_entry(1);
769769}
770770
771771DRIVER_INIT_MEMBER(r2dx_v33_state,zerotm2k)
772772{
773   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("mainprg")->base(), 0x20000);
773   membank("bank1")->configure_entries(0, 2, memregion("mainprg")->base(), 0x20000);
774774
775775   // sprites are NOT encrypted
776776   //zeroteam_decrypt_sprites(machine());
777777
778   machine().root_device().membank("bank1")->set_entry(1);
778   membank("bank1")->set_entry(1);
779779
780780}
781781
trunk/src/mame/drivers/lastfght.c
r21033r21034
151151#if 1
152152   // gfx roms viewer (toggle with enter, use pgup/down to browse)
153153   int x, y, count = 0;
154   UINT8 *gfxdata = machine().root_device().memregion("gfx1")->base();
154   UINT8 *gfxdata = memregion("gfx1")->base();
155155   UINT8 data;
156156
157157   if (machine().input().code_pressed_once(KEYCODE_ENTER)) m_view_roms ^= 1;
r21033r21034
604604
605605DRIVER_INIT_MEMBER(lastfght_state,lastfght)
606606{
607   UINT16 *rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
607   UINT16 *rom = (UINT16*)memregion("maincpu")->base();
608608
609609   // pass initial check (protection ? hw?)
610610   rom[0x00354 / 2] = 0x403e;
trunk/src/mame/drivers/superqix.c
r21033r21034
321321
322322READ8_MEMBER(superqix_state::bootleg_in0_r)
323323{
324   return BITSWAP8(machine().root_device().ioport("DSW1")->read(), 0,1,2,3,4,5,6,7);
324   return BITSWAP8(ioport("DSW1")->read(), 0,1,2,3,4,5,6,7);
325325}
326326
327327WRITE8_MEMBER(superqix_state::bootleg_flipscreen_w)
r21033r21034
512512{
513513//  logerror("%04x: ay_port_a_r\n",space.device().safe_pc());
514514   /* bits 76------  MCU status bits */
515   return (machine().rand() & 0xc0) | machine().root_device().ioport("BUTTONS")->read();
515   return (machine().rand() & 0xc0) | ioport("BUTTONS")->read();
516516}
517517
518518
r21033r21034
538538MACHINE_START_MEMBER(superqix_state,superqix)
539539{
540540   /* configure the banks */
541   machine().root_device().membank("bank1")->configure_entries(0, 4, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
541   membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000);
542542
543543   machine_init_common();
544544}
r21033r21034
546546MACHINE_START_MEMBER(superqix_state,pbillian)
547547{
548548   /* configure the banks */
549   machine().root_device().membank("bank1")->configure_entries(0, 2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
549   membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000);
550550
551551   machine_init_common();
552552}
r21033r21034
13221322   int i,j;
13231323
13241324   /* decrypt program code; the address lines are shuffled around in a non-trivial way */
1325   src = machine().root_device().memregion("maincpu")->base();
1326   len = machine().root_device().memregion("maincpu")->bytes();
1325   src = memregion("maincpu")->base();
1326   len = memregion("maincpu")->bytes();
13271327   for (i = 0;i < len;i += 16)
13281328   {
13291329      memcpy(temp,&src[i],16);
r21033r21034
13421342   }
13431343
13441344   /* decrypt gfx ROMs; simple bit swap on the address lines */
1345   src = machine().root_device().memregion("gfx1")->base();
1346   len = machine().root_device().memregion("gfx1")->bytes();
1345   src = memregion("gfx1")->base();
1346   len = memregion("gfx1")->bytes();
13471347   for (i = 0;i < len;i += 16)
13481348   {
13491349      memcpy(temp,&src[i],16);
r21033r21034
13531353      }
13541354   }
13551355
1356   src = machine().root_device().memregion("gfx2")->base();
1357   len = machine().root_device().memregion("gfx2")->bytes();
1356   src = memregion("gfx2")->base();
1357   len = memregion("gfx2")->bytes();
13581358   for (i = 0;i < len;i += 16)
13591359   {
13601360      memcpy(temp,&src[i],16);
r21033r21034
13641364      }
13651365   }
13661366
1367   src = machine().root_device().memregion("gfx3")->base();
1368   len = machine().root_device().memregion("gfx3")->bytes();
1367   src = memregion("gfx3")->base();
1368   len = memregion("gfx3")->bytes();
13691369   for (i = 0;i < len;i += 16)
13701370   {
13711371      memcpy(temp,&src[i],16);
trunk/src/mame/drivers/arcadia.c
r21033r21034
768768
769769void arcadia_amiga_state::generic_decode(const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0)
770770{
771   UINT16 *rom = (UINT16 *)machine().root_device().memregion(tag)->base();
771   UINT16 *rom = (UINT16 *)memregion(tag)->base();
772772   int i;
773773
774774   /* only the low byte of ROMs are encrypted in these games */
r21033r21034
777777
778778   #if 0
779779   {
780      UINT8 *ROM = machine().root_device().memregion(tag)->base();
781      int size = machine().root_device().memregion(tag)->bytes();
780      UINT8 *ROM = memregion(tag)->base();
781      int size = memregion(tag)->bytes();
782782
783783      FILE *fp;
784784      char filename[256];
r21033r21034
819819
820820   /* set up memory */
821821   m_bank1->configure_entry(0, m_chip_ram);
822   m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base());
822   m_bank1->configure_entry(1, memregion("user1")->base());
823823
824824   /* OnePlay bios is encrypted, TenPlay is not */
825   biosrom = (UINT16 *)machine().root_device().memregion("user2")->base();
825   biosrom = (UINT16 *)memregion("user2")->base();
826826   if (biosrom[0] != 0x4afc)
827827      generic_decode("user2", 6, 1, 0, 2, 3, 4, 5, 7);
828828}
trunk/src/mame/drivers/warpsped.c
r21033r21034
125125   UINT8 code = 0x3f;
126126   if ( tile_index & 1 )
127127   {
128      code = machine().root_device().memregion("starfield")->base()[tile_index >> 1] & 0x3f;
128      code = memregion("starfield")->base()[tile_index >> 1] & 0x3f;
129129   }
130130   SET_TILE_INFO_MEMBER(1, code, 0, 0);
131131}
trunk/src/mame/drivers/deco156.c
r21033r21034
620620
621621void deco156_state::descramble_sound( const char *tag )
622622{
623   UINT8 *rom = machine().root_device().memregion(tag)->base();
624   int length = machine().root_device().memregion(tag)->bytes();
623   UINT8 *rom = memregion(tag)->base();
624   int length = memregion(tag)->bytes();
625625   UINT8 *buf1 = auto_alloc_array(machine(), UINT8, length);
626626   UINT32 x;
627627
trunk/src/mame/drivers/psikyosh.c
r21033r21034
339339{
340340   if (ACCESSING_BITS_24_31)
341341   {
342      return machine().root_device().ioport("JP4")->read();
342      return ioport("JP4")->read();
343343   }
344344
345345   logerror("Unk EEPROM read mask %x\n", mem_mask);
r21033r21034
12151215
12161216DRIVER_INIT_MEMBER(psikyosh_state,daraku)
12171217{
1218   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
1219   machine().root_device().membank("bank1")->set_base(&RAM[0x100000]);
1218   UINT8 *RAM = memregion("maincpu")->base();
1219   membank("bank1")->set_base(&RAM[0x100000]);
12201220   sh2drc_set_options(machine().device("maincpu"), SH2DRC_FASTEST_OPTIONS);
12211221}
12221222
r21033r21034
12271227
12281228DRIVER_INIT_MEMBER(psikyosh_state,gunbird2)
12291229{
1230   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
1231   machine().root_device().membank("bank1")->set_base(&RAM[0x100000]);
1230   UINT8 *RAM = memregion("maincpu")->base();
1231   membank("bank1")->set_base(&RAM[0x100000]);
12321232   sh2drc_set_options(machine().device("maincpu"), SH2DRC_FASTEST_OPTIONS);
12331233}
12341234
12351235DRIVER_INIT_MEMBER(psikyosh_state,s1945iii)
12361236{
1237   UINT8 *RAM = machine().root_device().memregion("maincpu")->base();
1238   machine().root_device().membank("bank1")->set_base(&RAM[0x100000]);
1237   UINT8 *RAM = memregion("maincpu")->base();
1238   membank("bank1")->set_base(&RAM[0x100000]);
12391239   sh2drc_set_options(machine().device("maincpu"), SH2DRC_FASTEST_OPTIONS);
12401240}
12411241
trunk/src/mame/drivers/supertnk.c
r21033r21034
145145
146146   bank_address = 0x10000 + (m_rom_bank * 0x1000);
147147
148   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[bank_address]);
148   membank("bank1")->set_base(&memregion("maincpu")->base()[bank_address]);
149149}
150150
151151
r21033r21034
157157
158158   bank_address = 0x10000 + (m_rom_bank * 0x1000);
159159
160   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[bank_address]);
160   membank("bank1")->set_base(&memregion("maincpu")->base()[bank_address]);
161161}
162162
163163
r21033r21034
487487{
488488   /* decode the TMS9980 ROMs */
489489   offs_t offs;
490   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
491   size_t len = machine().root_device().memregion("maincpu")->bytes();
490   UINT8 *rom = memregion("maincpu")->base();
491   size_t len = memregion("maincpu")->bytes();
492492
493493   for (offs = 0; offs < len; offs++)
494494   {
trunk/src/mame/drivers/boogwing.c
r21033r21034
560560
561561DRIVER_INIT_MEMBER(boogwing_state,boogwing)
562562{
563   const UINT8* src = machine().root_device().memregion("gfx6")->base();
564   UINT8* dst = machine().root_device().memregion("tiles2")->base() + 0x200000;
563   const UINT8* src = memregion("gfx6")->base();
564   UINT8* dst = memregion("tiles2")->base() + 0x200000;
565565
566566   deco56_decrypt_gfx(machine(), "tiles1");
567567   deco56_decrypt_gfx(machine(), "tiles2");
trunk/src/mame/drivers/astrocorp.c
r21033r21034
11091109DRIVER_INIT_MEMBER(astrocorp_state,showhand)
11101110{
11111111#if 0
1112   UINT16 *rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
1112   UINT16 *rom = (UINT16*)memregion("maincpu")->base();
11131113
11141114   rom[0x0a1a/2] = 0x6000; // hopper jam
11151115
r21033r21034
11251125DRIVER_INIT_MEMBER(astrocorp_state,showhanc)
11261126{
11271127#if 0
1128   UINT16 *rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
1128   UINT16 *rom = (UINT16*)memregion("maincpu")->base();
11291129
11301130   rom[0x14d4/2] = 0x4e71; // enable full test mode
11311131   rom[0x14d6/2] = 0x4e71; // ""
trunk/src/mame/drivers/viper.c
r21033r21034
20072007   /* configure fast RAM regions for DRC */
20082008   ppcdrc_add_fastram(machine().device("maincpu"), 0x00000000, 0x00ffffff, FALSE, workram);
20092009
2010   ds2430_rom = (UINT8*)machine().root_device().memregion("ds2430")->base();
2010   ds2430_rom = (UINT8*)memregion("ds2430")->base();
20112011}
20122012
20132013void viper_state::machine_reset()
trunk/src/mame/drivers/suna8.c
r21033r21034
5252
5353DRIVER_INIT_MEMBER(suna8_state,hardhead)
5454{
55   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
55   UINT8 *rom = memregion("maincpu")->base();
5656   int i;
5757
5858   for (i = 0; i < 0x8000; i++)
r21033r21034
6767         rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0) ^ 0x58;
6868   }
6969
70   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
70   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
7171}
7272
7373/* Non encrypted bootleg */
7474DRIVER_INIT_MEMBER(suna8_state,hardhedb)
7575{
7676   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
77   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x48000);
78   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
77   space.set_decrypted_region(0x0000, 0x7fff, memregion("maincpu")->base() + 0x48000);
78   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
7979}
8080
8181/***************************************************************************
r21033r21034
8585UINT8 *suna8_state::brickzn_decrypt()
8686{
8787   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
88   UINT8   *RAM    =   machine().root_device().memregion("maincpu")->base();
89   size_t  size    =   machine().root_device().memregion("maincpu")->bytes();
88   UINT8   *RAM    =   memregion("maincpu")->base();
89   size_t  size    =   memregion("maincpu")->bytes();
9090   UINT8   *decrypt = auto_alloc_array(machine(), UINT8, size);
9191   int i;
9292
r21033r21034
131131
132132DRIVER_INIT_MEMBER(suna8_state,brickzn)
133133{
134   UINT8   *RAM    =   machine().root_device().memregion("maincpu")->base();
134   UINT8   *RAM    =   memregion("maincpu")->base();
135135   UINT8   *decrypt = brickzn_decrypt();
136136   int i;
137137
r21033r21034
162162   decrypt[0x2593] = 0x00; // HALT -> NOP
163163
164164   // Data banks: 00-0f normal data decryption, 10-1f alternate data decryption:
165   machine().root_device().membank("bank1")->configure_entries(0, 16*2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
165   membank("bank1")->configure_entries(0, 16*2, memregion("maincpu")->base() + 0x10000, 0x4000);
166166   // Opcode banks: 00-1f normal opcode decryption:
167   machine().root_device().membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x10000, 0x4000);
168   machine().root_device().membank("bank1")->configure_decrypted_entries(16, 16, decrypt + 0x10000, 0x4000);
167   membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x10000, 0x4000);
168   membank("bank1")->configure_decrypted_entries(16, 16, decrypt + 0x10000, 0x4000);
169169}
170170
171171DRIVER_INIT_MEMBER(suna8_state,brickznv4)
172172{
173   UINT8   *RAM    =   machine().root_device().memregion("maincpu")->base();
173   UINT8   *RAM    =   memregion("maincpu")->base();
174174   UINT8   *decrypt = brickzn_decrypt();
175175   int i;
176176
r21033r21034
201201   decrypt[0x256c] = 0x00; // HALT -> NOP
202202
203203   // Data banks: 00-0f normal data decryption, 10-1f alternate data decryption:
204   machine().root_device().membank("bank1")->configure_entries(0, 16*2, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
204   membank("bank1")->configure_entries(0, 16*2, memregion("maincpu")->base() + 0x10000, 0x4000);
205205   // Opcode banks: 00-1f normal opcode decryption:
206   machine().root_device().membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x10000, 0x4000);
207   machine().root_device().membank("bank1")->configure_decrypted_entries(16, 16, decrypt + 0x10000, 0x4000);
206   membank("bank1")->configure_decrypted_entries(0, 16, decrypt + 0x10000, 0x4000);
207   membank("bank1")->configure_decrypted_entries(16, 16, decrypt + 0x10000, 0x4000);
208208}
209209
210210
r21033r21034
215215DRIVER_INIT_MEMBER(suna8_state,hardhea2)
216216{
217217   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
218   UINT8   *RAM    =   machine().root_device().memregion("maincpu")->base();
219   size_t  size    =   machine().root_device().memregion("maincpu")->bytes();
218   UINT8   *RAM    =   memregion("maincpu")->base();
219   size_t  size    =   memregion("maincpu")->bytes();
220220   UINT8   *decrypt =  auto_alloc_array(machine(), UINT8, size);
221221   UINT8 x;
222222   int i;
r21033r21034
290290         RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41;
291291   }
292292
293   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
294   machine().root_device().membank("bank2")->configure_entries(0, 2, auto_alloc_array(machine(), UINT8, 0x2000 * 2), 0x2000);
293   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
294   membank("bank2")->configure_entries(0, 2, auto_alloc_array(machine(), UINT8, 0x2000 * 2), 0x2000);
295295}
296296
297297
r21033r21034
302302DRIVER_INIT_MEMBER(suna8_state,starfigh)
303303{
304304   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
305   UINT8   *RAM    =   machine().root_device().memregion("maincpu")->base();
306   size_t  size    =   machine().root_device().memregion("maincpu")->bytes();
305   UINT8   *RAM    =   memregion("maincpu")->base();
306   size_t  size    =   memregion("maincpu")->bytes();
307307   UINT8   *decrypt =  auto_alloc_array(machine(), UINT8, size);
308308   UINT8 x;
309309   int i;
r21033r21034
377377   decrypt[0x2696] = 0xc9; // work ram writes disable, corrupt next routine
378378   decrypt[0x4e9a] = 0x00; // work ram writes disable, flip background sprite
379379
380   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
380   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
381381}
382382
383383
r21033r21034
388388DRIVER_INIT_MEMBER(suna8_state,sparkman)
389389{
390390   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
391   UINT8   *RAM    =   machine().root_device().memregion("maincpu")->base();
392   size_t  size    =   machine().root_device().memregion("maincpu")->bytes();
391   UINT8   *RAM    =   memregion("maincpu")->base();
392   size_t  size    =   memregion("maincpu")->bytes();
393393   UINT8   *decrypt =  auto_alloc_array(machine(), UINT8, size);
394394   UINT8 x;
395395   int i;
r21033r21034
461461   decrypt[0x1ac4] = 0x00;
462462   decrypt[0x1ac5] = 0x00;
463463
464   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
464   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
465465}
466466
467467/***************************************************************************
r21033r21034
27722772
27732773DRIVER_INIT_MEMBER(suna8_state,suna8)
27742774{
2775   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
2775   membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
27762776}
27772777
27782778GAME( 1988, sranger,   0,        rranger,  rranger,  suna8_state, suna8,     ROT0,  "SunA",               "Super Ranger (v2.0)",         0 )
trunk/src/mame/drivers/wardner.c
r21033r21034
596596
597597DRIVER_INIT_MEMBER(wardner_state,wardner)
598598{
599   m_ROM = machine().root_device().memregion("maincpu")->base();
599   m_ROM = memregion("maincpu")->base();
600600   twincobr_driver_savestate();   /* Save-State stuff in src/machine/twincobr.c */
601601}
602602
trunk/src/mame/drivers/missile.c
r21033r21034
12171217DRIVER_INIT_MEMBER(missile_state,suprmatk)
12181218{
12191219   int i;
1220   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
1220   UINT8 *rom = memregion("maincpu")->base();
12211221
12221222   for (i = 0; i < 0x40; i++)
12231223   {
r21033r21034
12901290
12911291DRIVER_INIT_MEMBER(missile_state,missilem)
12921292{
1293   UINT8 *src = machine().root_device().memregion("user1")->base();
1294   UINT8 *dest = machine().root_device().memregion("maincpu")->base();
1293   UINT8 *src = memregion("user1")->base();
1294   UINT8 *dest = memregion("maincpu")->base();
12951295
12961296   // decrypt rom and put in maincpu region (result looks correct, but is untested)
12971297   for (int i = 0; i < 0x10000; i++)
trunk/src/mame/drivers/mustache.c
r21033r21034
237237
238238   int i;
239239
240   int G1 = machine().root_device().memregion("gfx1")->bytes()/3;
241   int G2 = machine().root_device().memregion("gfx2")->bytes()/2;
242   UINT8 *gfx1 = machine().root_device().memregion("gfx1")->base();
243   UINT8 *gfx2 = machine().root_device().memregion("gfx2")->base();
240   int G1 = memregion("gfx1")->bytes()/3;
241   int G2 = memregion("gfx2")->bytes()/2;
242   UINT8 *gfx1 = memregion("gfx1")->base();
243   UINT8 *gfx2 = memregion("gfx2")->base();
244244   UINT8 *buf=auto_alloc_array(machine(), UINT8, G2*2);
245245
246246   /* BG data lines */
trunk/src/mame/drivers/scregg.c
r21033r21034
412412{
413413   // rd2.rdh and rd1.rdj are bitswapped, but not rd3.rdg .. are they really from the same board?
414414   int x;
415   UINT8 *src = machine().root_device().memregion( "gfx1" )->base();
415   UINT8 *src = memregion( "gfx1" )->base();
416416
417417   for (x = 0x2000; x < 0x6000; x++)
418418   {
trunk/src/mame/drivers/statriv2.c
r21033r21034
11011101   *                                                   *
11021102   \***************************************************/
11031103
1104   UINT8 *qrom = machine().root_device().memregion("questions")->base();
1105   UINT32 length = machine().root_device().memregion("questions")->bytes();
1104   UINT8 *qrom = memregion("questions")->base();
1105   UINT32 length = memregion("questions")->bytes();
11061106   UINT32 address;
11071107
11081108   for (address = 0; address < length; address++)
trunk/src/mame/drivers/route16.c
r21033r21034
957957
958958DRIVER_INIT_MEMBER(route16_state,route16)
959959{
960   UINT8 *ROM = machine().root_device().memregion("cpu1")->base();
960   UINT8 *ROM = memregion("cpu1")->base();
961961   /* Is this actually a bootleg? some of the protection has
962962      been removed */
963963
r21033r21034
972972
973973DRIVER_INIT_MEMBER(route16_state,route16a)
974974{
975   UINT8 *ROM = machine().root_device().memregion("cpu1")->base();
975   UINT8 *ROM = memregion("cpu1")->base();
976976   /* TO DO : Replace these patches with simulation of the protection device */
977977
978978   /* patch the protection */
trunk/src/mame/drivers/starshp1.c
r21033r21034
1616
1717INTERRUPT_GEN_MEMBER(starshp1_state::starshp1_interrupt)
1818{
19   if ((machine().root_device().ioport("SYSTEM")->read() & 0x90) != 0x90)
19   if ((ioport("SYSTEM")->read() & 0x90) != 0x90)
2020      generic_pulse_irq_line(device.execute(), 0, 1);
2121}
2222
trunk/src/mame/drivers/taito_f2.c
r21033r21034
30263026MACHINE_START_MEMBER(taitof2_state,f2)
30273027{
30283028   MACHINE_START_CALL_MEMBER(common);
3029   machine().root_device().membank("bank2")->configure_entries(0, 8, machine().root_device().memregion("audiocpu")->base() + 0x10000, 0x4000);
3029   membank("bank2")->configure_entries(0, 8, memregion("audiocpu")->base() + 0x10000, 0x4000);
30303030}
30313031
30323032static MACHINE_CONFIG_START( taito_f2, taitof2_state )
r21033r21034
53115311   int i;
53125312   UINT8 data;
53135313   UINT32 offset;
5314   UINT8 *gfx = machine().root_device().memregion("gfx2")->base();
5314   UINT8 *gfx = memregion("gfx2")->base();
53155315
53165316   offset = 0x100000;
53175317   for (i = 0x180000; i < 0x200000; i++)
trunk/src/mame/drivers/maygayep.c
r21033r21034
7878
7979DRIVER_INIT_MEMBER(maygayep_state,maygayep)
8080{
81   UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
81   UINT8 *src = memregion( "maincpu" )->base();
8282
8383   for (int i=0x100;i<0x210;i++)
8484   {
trunk/src/mame/drivers/goldnpkr.c
r21033r21034
10791079
10801080void goldnpkr_state::palette_init()
10811081{
1082   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
1082   const UINT8 *color_prom = memregion("proms")->base();
10831083/*  prom bits
10841084    7654 3210
10851085    ---- ---x   red component.
r21033r21034
11231123
11241124PALETTE_INIT_MEMBER(goldnpkr_state,witchcrd)
11251125{
1126   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
1126   const UINT8 *color_prom = memregion("proms")->base();
11271127/*
11281128    This hardware has a feature called BLUE KILLER.
11291129    Using the original intensity line, the PCB has a bridge
r21033r21034
11711171
11721172PALETTE_INIT_MEMBER(goldnpkr_state,wcrdxtnd)
11731173{
1174   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
1174   const UINT8 *color_prom = memregion("proms")->base();
11751175/*
11761176    Using the original intensity line, the PCB has a bridge
11771177    that allow (as default) turn the background dark blue.
r21033r21034
93949394{
93959395   /* $60bb, NOPing the ORA #$F0 (after read the PIA1 port B */
93969396
9397//  UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9397//  UINT8 *ROM = memregion("maincpu")->base();
93989398
93999399//  ROM[0x60bb] = 0xea;
94009400//  ROM[0x60bc] = 0xea;
r21033r21034
94239423{
94249424   /* Attempt to decrypt the MCU program (we're sooo close!) */
94259425
9426   UINT8 *ROM = machine().root_device().memregion("mcu")->base();
9427   int size = machine().root_device().memregion("mcu")->bytes();
9426   UINT8 *ROM = memregion("mcu")->base();
9427   int size = memregion("mcu")->bytes();
94289428   int start = 0x0000;
94299429   int i;
94309430
r21033r21034
94429442      after compare with Dallas TK data
94439443   */
94449444
9445   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9445   UINT8 *ROM = memregion("maincpu")->base();
94469446
94479447   ROM[0xe097] = 0xea;
94489448   ROM[0xe098] = 0xea;
r21033r21034
94549454      after compare with Dallas TK data
94559455   */
94569456
9457   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9457   UINT8 *ROM = memregion("maincpu")->base();
94589458
94599459   ROM[0xe87b] = 0xea;
94609460   ROM[0xe87c] = 0xea;
r21033r21034
94669466      after compare with Dallas TK data
94679467   */
94689468
9469   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9469   UINT8 *ROM = memregion("maincpu")->base();
94709470
94719471   ROM[0x453a] = 0xea;
94729472   ROM[0x453b] = 0xea;
r21033r21034
94789478      after compare with Dallas TK data
94799479   */
94809480
9481   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9481   UINT8 *ROM = memregion("maincpu")->base();
94829482
94839483   ROM[0xf2c9] = 0xea;
94849484   ROM[0xf2ca] = 0xea;
r21033r21034
94909490      after compare with Dallas TK data
94919491   */
94929492
9493   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9493   UINT8 *ROM = memregion("maincpu")->base();
94949494
94959495   ROM[0xdf80] = 0xea;
94969496   ROM[0xdf81] = 0xea;
r21033r21034
95029502      after compare with Dallas TK data
95039503   */
95049504
9505   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9505   UINT8 *ROM = memregion("maincpu")->base();
95069506
95079507   ROM[0xe42f] = 0xea;
95089508   ROM[0xe430] = 0xea;
r21033r21034
95149514      after compare with Dallas TK data
95159515   */
95169516
9517   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9517   UINT8 *ROM = memregion("maincpu")->base();
95189518
95199519   ROM[0xe442] = 0xea;
95209520   ROM[0xe443] = 0xea;
r21033r21034
95269526      after compare with Dallas TK data
95279527   */
95289528
9529   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9529   UINT8 *ROM = memregion("maincpu")->base();
95309530
95319531   ROM[0xe4d5] = 0xea;
95329532   ROM[0xe4d6] = 0xea;
r21033r21034
95389538      after compare with Dallas TK data
95399539   */
95409540
9541   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9541   UINT8 *ROM = memregion("maincpu")->base();
95429542
95439543   ROM[0xe87c] = 0xea;
95449544   ROM[0xe87d] = 0xea;
r21033r21034
95509550      after compare with Dallas TK data
95519551   */
95529552
9553   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9553   UINT8 *ROM = memregion("maincpu")->base();
95549554
95559555   ROM[0xe7d5] = 0xea;
95569556   ROM[0xe7d6] = 0xea;
r21033r21034
95629562      after compare with Dallas TK data
95639563   */
95649564
9565   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9565   UINT8 *ROM = memregion("maincpu")->base();
95669566
95679567   ROM[0xe7d9] = 0xea;
95689568   ROM[0xe7da] = 0xea;
r21033r21034
95749574      after compare with Dallas TK data
95759575   */
95769576
9577   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9577   UINT8 *ROM = memregion("maincpu")->base();
95789578
95799579   ROM[0xe7f7] = 0xea;
95809580   ROM[0xe7f8] = 0xea;
r21033r21034
95869586      after compare with Dallas TK data
95879587   */
95889588
9589   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9589   UINT8 *ROM = memregion("maincpu")->base();
95909590
95919591   ROM[0xe8a5] = 0xea;
95929592   ROM[0xe8a6] = 0xea;
r21033r21034
95989598      after compare with Dallas TK data
95999599   */
96009600
9601   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9601   UINT8 *ROM = memregion("maincpu")->base();
96029602
96039603   ROM[0xe955] = 0xea;
96049604   ROM[0xe956] = 0xea;
r21033r21034
96109610      after compare with Dallas TK data
96119611   */
96129612
9613   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9613   UINT8 *ROM = memregion("maincpu")->base();
96149614
96159615   ROM[0xee6b] = 0xea;
96169616   ROM[0xee6c] = 0xea;
r21033r21034
96229622      after compare with Dallas TK data
96239623   */
96249624
9625   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9625   UINT8 *ROM = memregion("maincpu")->base();
96269626
96279627   ROM[0xf052] = 0xea;
96289628   ROM[0xf053] = 0xea;
r21033r21034
97549754      after compare with a string inside the Dallas TK RAM
97559755   */
97569756
9757   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
9757   UINT8 *ROM = memregion("maincpu")->base();
97589758
97599759   ROM[0xf2e1] = 0xea;
97609760   ROM[0xf2e2] = 0xea;
trunk/src/mame/drivers/xxmissio.c
r21033r21034
7777
7878void xxmissio_state::machine_start()
7979{
80   machine().root_device().membank("bank1")->configure_entries(0, 8, machine().root_device().memregion("user1")->base(), 0x4000);
81   machine().root_device().membank("bank1")->set_entry(0);
80   membank("bank1")->configure_entries(0, 8, memregion("user1")->base(), 0x4000);
81   membank("bank1")->set_entry(0);
8282}
8383
8484/****************************************************************************/
trunk/src/mame/drivers/eolith.c
r21033r21034
14811481   i8051_set_serial_tx_callback(machine().device("soundcpu"), soundcpu_to_qs1000);
14821482
14831483   // Configure the sound ROM banking
1484   machine().root_device().membank("sound_bank")->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000);
1484   membank("sound_bank")->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000);
14851485}
14861486
14871487DRIVER_INIT_MEMBER(eolith_state,landbrk)
r21033r21034
15071507DRIVER_INIT_MEMBER(eolith_state,hidctch2)
15081508{
15091509   //it fails compares in memory like in landbrka
1510   UINT32 *rombase = (UINT32*)machine().root_device().memregion("maincpu")->base();
1510   UINT32 *rombase = (UINT32*)memregion("maincpu")->base();
15111511   rombase[0xbcc8/4] = (rombase[0xbcc8/4] & 0xffff) | 0x03000000; /* Change BR to NOP */
15121512
15131513   DRIVER_INIT_CALL(eolith);
trunk/src/mame/drivers/tatsumi.c
r21033r21034
12981298   }
12991299
13001300   // Copy sprite & palette data out of GFX rom area
1301   m_rom_sprite_lookup1 = machine().root_device().memregion("gfx2")->base();
1302   m_rom_sprite_lookup2 = machine().root_device().memregion("gfx3")->base();
1303   m_rom_clut0 = machine().root_device().memregion("gfx2")->base()+ 0x100000 - 0x800;
1304   m_rom_clut1 = machine().root_device().memregion("gfx3")->base()+ 0x100000 - 0x800;
1301   m_rom_sprite_lookup1 = memregion("gfx2")->base();
1302   m_rom_sprite_lookup2 = memregion("gfx3")->base();
1303   m_rom_clut0 = memregion("gfx2")->base()+ 0x100000 - 0x800;
1304   m_rom_clut1 = memregion("gfx3")->base()+ 0x100000 - 0x800;
13051305
13061306   tatsumi_reset(machine());
13071307
r21033r21034
13251325   }
13261326
13271327   // Copy sprite & palette data out of GFX rom area
1328   m_rom_sprite_lookup1 = machine().root_device().memregion("gfx2")->base();
1329   m_rom_sprite_lookup2 = machine().root_device().memregion("gfx3")->base();
1330   m_rom_clut0 = machine().root_device().memregion("gfx2")->base()+ 0xc0000 - 0x800;
1331   m_rom_clut1 = machine().root_device().memregion("gfx3")->base()+ 0xc0000 - 0x800;
1328   m_rom_sprite_lookup1 = memregion("gfx2")->base();
1329   m_rom_sprite_lookup2 = memregion("gfx3")->base();
1330   m_rom_clut0 = memregion("gfx2")->base()+ 0xc0000 - 0x800;
1331   m_rom_clut1 = memregion("gfx3")->base()+ 0xc0000 - 0x800;
13321332
13331333   tatsumi_reset(machine());
13341334}
r21033r21034
13501350      src2+=32;
13511351   }
13521352
1353   dst = machine().root_device().memregion("maincpu")->base();
1353   dst = memregion("maincpu")->base();
13541354   memcpy(m_cyclwarr_cpua_ram,dst,8);
13551355   membank("bank1")->set_base(dst);
13561356
1357   dst = machine().root_device().memregion("sub")->base();
1357   dst = memregion("sub")->base();
13581358   memcpy(m_cyclwarr_cpub_ram,dst,8);
13591359   membank("bank2")->set_base(dst);
13601360
13611361   // Copy sprite & palette data out of GFX rom area
1362   m_rom_sprite_lookup1 = machine().root_device().memregion("gfx2")->base();
1363   m_rom_sprite_lookup2 = machine().root_device().memregion("gfx3")->base();
1364   m_rom_clut0 = machine().root_device().memregion("gfx2")->base() + len1 - 0x1000;
1365   m_rom_clut1 = machine().root_device().memregion("gfx3")->base() + len2 - 0x1000;
1362   m_rom_sprite_lookup1 = memregion("gfx2")->base();
1363   m_rom_sprite_lookup2 = memregion("gfx3")->base();
1364   m_rom_clut0 = memregion("gfx2")->base() + len1 - 0x1000;
1365   m_rom_clut1 = memregion("gfx3")->base() + len2 - 0x1000;
13661366
13671367   tatsumi_reset(machine());
13681368}
trunk/src/mame/drivers/groundfx.c
r21033r21034
451451DRIVER_INIT_MEMBER(groundfx_state,groundfx)
452452{
453453   UINT32 offset,i;
454   UINT8 *gfx = machine().root_device().memregion("gfx3")->base();
455   int size=machine().root_device().memregion("gfx3")->bytes();
454   UINT8 *gfx = memregion("gfx3")->base();
455   int size=memregion("gfx3")->bytes();
456456   int data;
457457
458458   /* Speedup handlers */
trunk/src/mame/drivers/suprloco.c
r21033r21034
281281   int i, j, k, color_source, color_dest;
282282   UINT8 *source, *dest, *lookup;
283283
284   source = machine().root_device().memregion("gfx1")->base();
284   source = memregion("gfx1")->base();
285285   dest   = source + 0x6000;
286   lookup = machine().root_device().memregion("proms")->base() + 0x0200;
286   lookup = memregion("proms")->base() + 0x0200;
287287
288288   for (i = 0; i < 0x80; i++, lookup += 8)
289289   {
trunk/src/mame/drivers/feversoc.c
r21033r21034
298298
299299DRIVER_INIT_MEMBER(feversoc_state,feversoc)
300300{
301   seibuspi_rise11_sprite_decrypt_feversoc(machine().root_device().memregion("gfx1")->base(), 0x200000);
301   seibuspi_rise11_sprite_decrypt_feversoc(memregion("gfx1")->base(), 0x200000);
302302}
303303
304304GAME( 2004, feversoc,  0,       feversoc,  feversoc, feversoc_state,  feversoc, ROT0, "Seibu Kaihatsu", "Fever Soccer", 0 )
trunk/src/mame/drivers/multigam.c
r21033r21034
331331
332332WRITE8_MEMBER(multigam_state::multigam_switch_gfx_rom)
333333{
334   membank("bank1")->set_base(machine().root_device().memregion("gfx1")->base() + (0x2000 * (data & 0x3f)));
334   membank("bank1")->set_base(memregion("gfx1")->base() + (0x2000 * (data & 0x3f)));
335335   set_mirroring(data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
336336   m_game_gfx_bank = data;
337337};
r21033r21034
341341{
342342   if (m_game_gfx_bank & 0x80)
343343   {
344      membank("bank1")->set_base(machine().root_device().memregion("gfx1")->base() + (0x2000 * ((data & 0x3) + (m_game_gfx_bank & 0x3c))));
344      membank("bank1")->set_base(memregion("gfx1")->base() + (0x2000 * ((data & 0x3) + (m_game_gfx_bank & 0x3c))));
345345   }
346346   else
347347   {
r21033r21034
533533         }
534534         else
535535         {
536            membank("bank10")->set_base(machine().root_device().memregion("maincpu")->base() + 0x6000);
536            membank("bank10")->set_base(memregion("maincpu")->base() + 0x6000);
537537         }
538538         if (data & 0x40)
539539         {
r21033r21034
617617   else
618618   {
619619      space.install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigm3_mapper2_w),this) );
620      membank("bank10")->set_base(machine().root_device().memregion("maincpu")->base() + 0x6000);
620      membank("bank10")->set_base(memregion("maincpu")->base() + 0x6000);
621621   }
622622
623623   if (data & 0x80)
r21033r21034
13801380
13811381   const UINT8 decode[16]  = { 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a };
13821382
1383   multigm3_decrypt(machine().root_device().memregion("maincpu")->base(), machine().root_device().memregion("maincpu")->bytes(), decode );
1384   multigm3_decrypt(machine().root_device().memregion("user1")->base(), machine().root_device().memregion("user1")->bytes(), decode );
1383   multigm3_decrypt(memregion("maincpu")->base(), memregion("maincpu")->bytes(), decode );
1384   multigm3_decrypt(memregion("user1")->base(), memregion("user1")->bytes(), decode );
13851385
13861386   m_multigmc_mmc3_6000_ram = auto_alloc_array(machine(), UINT8, 0x2000);
13871387
r21033r21034
13981398   int i;
13991399   int addr;
14001400
1401   rom = machine().root_device().memregion("maincpu")->base();
1401   rom = memregion("maincpu")->base();
14021402   size = 0x8000;
14031403   memcpy(buf, rom, size);
14041404   for (i = 0; i < size; i++)
r21033r21034
14071407      rom[i] = buf[addr];
14081408   }
14091409
1410   rom = machine().root_device().memregion("user1")->base();
1410   rom = memregion("user1")->base();
14111411   size = 0x80000;
14121412   memcpy(buf, rom, size);
14131413   for (i = 0; i < size; i++)
r21033r21034
14151415      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);
14161416      rom[i] = buf[addr];
14171417   }
1418   rom = machine().root_device().memregion("gfx1")->base();
1418   rom = memregion("gfx1")->base();
14191419   size = 0x80000;
14201420   memcpy(buf, rom, size);
14211421   for (i = 0; i < size; i++)
trunk/src/mame/drivers/amspdwy.c
r21033r21034
3737UINT8 amspdwy_state::amspdwy_wheel_r( int index )
3838{
3939   static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" };
40   UINT8 wheel = machine().root_device().ioport(portnames[2 + index])->read();
40   UINT8 wheel = ioport(portnames[2 + index])->read();
4141   if (wheel != m_wheel_old[index])
4242   {
4343      wheel = (wheel & 0x7fff) - (wheel & 0x8000);
r21033r21034
4848
4949   m_wheel_old[index] = wheel;
5050   }
51   return m_wheel_return[index] | machine().root_device().ioport(portnames[index])->read();
51   return m_wheel_return[index] | ioport(portnames[index])->read();
5252}
5353
5454READ8_MEMBER(amspdwy_state::amspdwy_wheel_0_r)
r21033r21034
6464READ8_MEMBER(amspdwy_state::amspdwy_sound_r)
6565{
6666   ym2151_device *device = machine().device<ym2151_device>("ymsnd");
67   return (device->status_r(space, 0) & ~ 0x30) | machine().root_device().ioport("IN0")->read();
67   return (device->status_r(space, 0) & ~ 0x30) | ioport("IN0")->read();
6868}
6969
7070WRITE8_MEMBER(amspdwy_state::amspdwy_sound_w)
trunk/src/mame/drivers/fortecar.c
r21033r21034
380380
381381void fortecar_state::palette_init()
382382{
383   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
383   const UINT8 *color_prom = memregion("proms")->base();
384384/* Video resistors...
385385
386386O1 (LS374) R1K  RED
trunk/src/mame/drivers/baraduke.c
r21033r21034
533533   int i;
534534
535535   /* unpack the third tile ROM */
536   rom = machine().root_device().memregion("gfx2")->base() + 0x8000;
536   rom = memregion("gfx2")->base() + 0x8000;
537537   for (i = 0x2000;i < 0x4000;i++)
538538   {
539539      rom[i + 0x2000] = rom[i];
trunk/src/mame/drivers/runaway.c
r21033r21034
6262
6363READ8_MEMBER(runaway_state::runaway_pot_r)
6464{
65   return (machine().root_device().ioport("7000")->read() << (7 - offset)) & 0x80;
65   return (ioport("7000")->read() << (7 - offset)) & 0x80;
6666}
6767
6868
trunk/src/mame/drivers/tumbleb.c
r21033r21034
468468/* we use channels 1,2,3 for sound effects, and channel 4 for music */
469469void tumbleb_state::tumbleb2_set_music_bank( int bank )
470470{
471   UINT8 *oki = machine().root_device().memregion("oki")->base();
471   UINT8 *oki = memregion("oki")->base();
472472   memcpy(&oki[0x38000], &oki[0x80000 + 0x38000 + 0x8000 * bank], 0x8000);
473473}
474474
r21033r21034
31943194void tumbleb_state::tumblepb_patch_code(UINT16 offset)
31953195{
31963196   /* A hack which enables all Dip Switches effects */
3197   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
3197   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
31983198   RAM[(offset + 0)/2] = 0x0240;
31993199   RAM[(offset + 2)/2] = 0xffff;   // andi.w  #$f3ff, D0
32003200}
r21033r21034
32083208
32093209   if (rgn == 1)
32103210   {
3211      rom = machine().root_device().memregion("tilegfx")->base();
3212      len = machine().root_device().memregion("tilegfx")->bytes();
3211      rom = memregion("tilegfx")->base();
3212      len = memregion("tilegfx")->bytes();
32133213   }
32143214   else
32153215   {
3216      rom = machine().root_device().memregion("sprgfx")->base();
3217      len = machine().root_device().memregion("sprgfx")->bytes();
3216      rom = memregion("sprgfx")->base();
3217      len = memregion("sprgfx")->bytes();
32183218   }
32193219
32203220   int i;
r21033r21034
32763276   #if FNCYWLD_HACK
32773277   /* This is a hack to allow you to use the extra features
32783278      of the 2 first "Unused" Dip Switch (see notes above). */
3279   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
3279   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
32803280   RAM[0x0005fa/2] = 0x4e71;
32813281   RAM[0x00060a/2] = 0x4e71;
32823282   #endif
r21033r21034
33143314
33153315void tumbleb_state::suprtrio_decrypt_code()
33163316{
3317   UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
3317   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
33183318   UINT16 *buf = auto_alloc_array(machine(), UINT16, 0x80000/2);
33193319   int i;
33203320
r21033r21034
33323332
33333333void tumbleb_state::suprtrio_decrypt_gfx()
33343334{
3335   UINT16 *rom = (UINT16 *)machine().root_device().memregion("tilegfx")->base();
3335   UINT16 *rom = (UINT16 *)memregion("tilegfx")->base();
33363336   UINT16 *buf = auto_alloc_array(machine(), UINT16, 0x100000/2);
33373337   int i;
33383338
trunk/src/mame/drivers/clshroad.c
r21033r21034
469469die once, it would be nice to avoid the hack however
470470
471471*/
472   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
472   UINT8 *ROM = memregion("maincpu")->base();
473473
474474   ROM[0x05C6] = 0xc3;
475475   ROM[0x05C7] = 0x8d;
trunk/src/mame/drivers/cabaret.c
r21033r21034
360360
361361DRIVER_INIT_MEMBER(cabaret_state,cabaret)
362362{
363   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
363   UINT8 *rom = memregion("maincpu")->base();
364364   int i;
365365
366366   /* decrypt the program ROM */
trunk/src/mame/drivers/raiden.c
r21033r21034
575575bit-swapping */
576576void raiden_state::common_decrypt()
577577{
578   UINT16 *RAM = (UINT16 *)machine().root_device().memregion("maincpu")->base();
578   UINT16 *RAM = (UINT16 *)memregion("maincpu")->base();
579579   int i;
580580
581581   for (i = 0; i < 0x20000; i++)
r21033r21034
587587      RAM[0xc0000/2 + i] = data;
588588   }
589589
590   RAM = (UINT16 *)machine().root_device().memregion("sub")->base();
590   RAM = (UINT16 *)memregion("sub")->base();
591591
592592   for (i = 0; i < 0x20000; i++)
593593   {
trunk/src/mame/drivers/tugboat.c
r21033r21034
5858    just four 1k resistors. */
5959void tugboat_state::palette_init()
6060{
61   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
61   const UINT8 *color_prom = memregion("proms")->base();
6262   int i;
6363
6464
trunk/src/mame/drivers/phoenix.c
r21033r21034
446446
447447MACHINE_RESET_MEMBER(phoenix_state,phoenix)
448448{
449   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000);
449   membank("bank1")->set_base(memregion("maincpu")->base() + 0x4000);
450450}
451451
452452
trunk/src/mame/drivers/snesb.c
r21033r21034
692692DRIVER_INIT_MEMBER(snesb_state,ffight2b)
693693{
694694   INT32 i;
695   UINT8 *rom = machine().root_device().memregion("user3")->base();
695   UINT8 *rom = memregion("user3")->base();
696696
697697   for(i = 0; i < 0x200000; i++)
698698   {
r21033r21034
735735DRIVER_INIT_MEMBER(snesb_state,iron)
736736{
737737   INT32 i;
738   UINT8 *rom = machine().root_device().memregion("user3")->base();
738   UINT8 *rom = memregion("user3")->base();
739739
740740   for (i = 0; i < 0x140000; i++)
741741   {
r21033r21034
759759
760760DRIVER_INIT_MEMBER(snesb_state,denseib)
761761{
762   UINT8 *rom = machine().root_device().memregion("user3")->base();
762   UINT8 *rom = memregion("user3")->base();
763763   INT32 i;
764764
765765   for (i = 0; i < 0x200000; i++)
r21033r21034
808808DRIVER_INIT_MEMBER(snesb_state,sblast2b)
809809{
810810   int i, cipherText, plainText, newAddress;
811   UINT8 *src = machine().root_device().memregion("user7")->base();
812   UINT8 *dst = machine().root_device().memregion("user3")->base();
811   UINT8 *src = memregion("user7")->base();
812   UINT8 *dst = memregion("user3")->base();
813813
814814   for (i =0; i < 0x80000 * 3; i++)
815815   {
r21033r21034
858858DRIVER_INIT_MEMBER(snesb_state,endless)
859859{
860860   INT32 i;
861   UINT8 *rom = machine().root_device().memregion("user3")->base();
861   UINT8 *rom = memregion("user3")->base();
862862
863863   /* there is more to this, 0x800 based block swaps? */
864864   for (i = 0; i < 0x200000; i++)
trunk/src/mame/drivers/ms32.c
r21033r21034
13761376
13771377void ms32_state::machine_reset()
13781378{
1379   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
1380   machine().root_device().membank("bank4")->set_entry(0);
1381   machine().root_device().membank("bank5")->set_entry(1);
1379   membank("bank1")->set_base(memregion("maincpu")->base());
1380   membank("bank4")->set_entry(0);
1381   membank("bank5")->set_entry(1);
13821382   irq_init();
13831383}
13841384
r21033r21034
22532253DRIVER_INIT_MEMBER(ms32_state,f1superb)
22542254{
22552255#if 0 // we shouldn't need this hack, something else is wrong, and the x offsets are never copied either, v70 problems??
2256   UINT32 *pROM = (UINT32 *)machine().root_device().memregion("maincpu")->base();
2256   UINT32 *pROM = (UINT32 *)memregion("maincpu")->base();
22572257   pROM[0x19d04/4]=0x167a021a; // bne->br  : sprite Y offset table is always copied to RAM
22582258#endif
22592259   DRIVER_INIT_CALL(ss92046_01);
trunk/src/mame/drivers/kontest.c
r21033r21034
6666
6767void kontest_state::palette_init()
6868{
69   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
69   const UINT8 *color_prom = memregion("proms")->base();
7070   int bit0, bit1, bit2 , r, g, b;
7171   int i;
7272
trunk/src/mame/drivers/tourtabl.c
r21033r21034
4444{
4545   static const char *const tianames[] = { "PADDLE4", "PADDLE3", "PADDLE2", "PADDLE1", "TIA_IN4", "TIA_IN5" };
4646
47   return machine().root_device().ioport(tianames[offset])->read();
47   return ioport(tianames[offset])->read();
4848}
4949
5050READ8_MEMBER(tourtabl_state::tourtabl_get_databus_contents)
trunk/src/mame/drivers/kas89.c
r21033r21034
861861DRIVER_INIT_MEMBER(kas89_state,kas89)
862862{
863863   int i;
864   UINT8 *mem = machine().root_device().memregion("maincpu")->base();
865   int memsize = machine().root_device().memregion("maincpu")->bytes();
864   UINT8 *mem = memregion("maincpu")->base();
865   int memsize = memregion("maincpu")->bytes();
866866   UINT8 *buf;
867867
868868   /* Unscrambling data lines */
trunk/src/mame/drivers/backfire.c
r21033r21034
677677
678678void backfire_state::descramble_sound()
679679{
680   UINT8 *rom = machine().root_device().memregion("ymz")->base();
680   UINT8 *rom = memregion("ymz")->base();
681681   int length = 0x200000; // only the first rom is swapped on backfire!
682682   UINT8 *buf1 = auto_alloc_array(machine(), UINT8, length);
683683   UINT32 x;
trunk/src/mame/drivers/dwarfd.c
r21033r21034
12971297   }
12981298
12991299   /* use low bit as 'interpolation' bit */
1300   src = machine().root_device().memregion("gfx2")->base();
1300   src = memregion("gfx2")->base();
13011301   for (i = 0; i < 0x8000; i++)
13021302   {
13031303      if (src[i] & 0x10)
r21033r21034
13281328   DRIVER_INIT_CALL(dwarfd);
13291329
13301330   // hacks for program to proceed
1331   machine().root_device().memregion("maincpu")->base()[0x6564] = 0x00;
1332   machine().root_device().memregion("maincpu")->base()[0x6565] = 0x00;
1331   memregion("maincpu")->base()[0x6564] = 0x00;
1332   memregion("maincpu")->base()[0x6565] = 0x00;
13331333
1334   machine().root_device().memregion("maincpu")->base()[0x59b2] = 0x00;
1335   machine().root_device().memregion("maincpu")->base()[0x59b3] = 0x00;
1336   machine().root_device().memregion("maincpu")->base()[0x59b4] = 0x00;
1334   memregion("maincpu")->base()[0x59b2] = 0x00;
1335   memregion("maincpu")->base()[0x59b3] = 0x00;
1336   memregion("maincpu")->base()[0x59b4] = 0x00;
13371337
13381338}
13391339
trunk/src/mame/drivers/segas32.c
r21033r21034
11221122WRITE8_MEMBER(segas32_state::sound_bank_lo_w)
11231123{
11241124   m_sound_bank = (m_sound_bank & ~0x3f) | (data & 0x3f);
1125   membank("bank1")->set_base(machine().root_device().memregion("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
1125   membank("bank1")->set_base(memregion("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
11261126}
11271127
11281128
11291129WRITE8_MEMBER(segas32_state::sound_bank_hi_w)
11301130{
11311131   m_sound_bank = (m_sound_bank & 0x3f) | ((data & 0x04) << 4) | ((data & 0x03) << 7);
1132   membank("bank1")->set_base(machine().root_device().memregion("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
1132   membank("bank1")->set_base(memregion("soundcpu")->base() + 0x100000 + 0x2000 * m_sound_bank);
11331133}
11341134
11351135
trunk/src/mame/drivers/looping.c
r21033r21034
157157
158158void looping_state::palette_init()
159159{
160   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
160   const UINT8 *color_prom = memregion("proms")->base();
161161   static const int resistances[3] = { 1000, 470, 220 };
162162   double rweights[3], gweights[3], bweights[2];
163163   int i;
trunk/src/mame/drivers/savquest.c
r21033r21034
630630
631631void savquest_state::machine_reset()
632632{
633   machine().root_device().membank("bios_f0000")->set_base(machine().root_device().memregion("bios")->base() + 0x30000);
634   machine().root_device().membank("bios_e0000")->set_base(machine().root_device().memregion("bios")->base() + 0x20000);
635   machine().root_device().membank("bios_e4000")->set_base(machine().root_device().memregion("bios")->base() + 0x24000);
636   machine().root_device().membank("bios_e8000")->set_base(machine().root_device().memregion("bios")->base() + 0x28000);
637   machine().root_device().membank("bios_ec000")->set_base(machine().root_device().memregion("bios")->base() + 0x2c000);
633   membank("bios_f0000")->set_base(memregion("bios")->base() + 0x30000);
634   membank("bios_e0000")->set_base(memregion("bios")->base() + 0x20000);
635   membank("bios_e4000")->set_base(memregion("bios")->base() + 0x24000);
636   membank("bios_e8000")->set_base(memregion("bios")->base() + 0x28000);
637   membank("bios_ec000")->set_base(memregion("bios")->base() + 0x2c000);
638638}
639639
640640static MACHINE_CONFIG_START( savquest, savquest_state )
trunk/src/mame/drivers/ltcasino.c
r21033r21034
712712DRIVER_INIT_MEMBER(ltcasino_state,mv4in1)
713713{
714714   int i;
715   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
715   UINT8 *rom = 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}
trunk/src/mame/drivers/meijinsn.c
r21033r21034
254254
255255void meijinsn_state::palette_init()
256256{
257   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
257   const UINT8 *color_prom = memregion("proms")->base();
258258   int i;
259259   static const int resistances_b[2]  = { 470, 220 };
260260   static const int resistances_rg[3] = { 1000, 470, 220 };
trunk/src/mame/drivers/neodrvr.c
r21033r21034
95069506   kof2002_decrypt_68k(machine());
95079507   neo_pcm2_swap(machine(), 0);
95089508   neogeo_cmc50_m1_decrypt(machine());
9509   kof2002b_gfx_decrypt(machine(), machine().root_device().memregion("sprites")->base(),0x4000000);
9510   kof2002b_gfx_decrypt(machine(), machine().root_device().memregion("fixed")->base(),0x20000);
9509   kof2002b_gfx_decrypt(machine(), memregion("sprites")->base(),0x4000000);
9510   kof2002b_gfx_decrypt(machine(), memregion("fixed")->base(),0x20000);
95119511}
95129512
95139513DRIVER_INIT_MEMBER(neogeo_state,kf2k2pls)
r21033r21034
99169916
99179917   /* the game code clears the text overlay used ingame immediately after writing it.. why? protection? sloppy code that the hw ignores? imperfect emulation? */
99189918   {
9919      UINT16* rom = (UINT16*)machine().root_device().memregion("maincpu")->base();
9919      UINT16* rom = (UINT16*)memregion("maincpu")->base();
99209920
99219921      rom[0x2a6f8/2] = 0x4e71;
99229922      rom[0x2a6fa/2] = 0x4e71;
trunk/src/mame/drivers/caswin.c
r21033r21034
299299
300300void caswin_state::palette_init()
301301{
302   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
302   const UINT8 *color_prom = memregion("proms")->base();
303303   int bit0, bit1, bit2 , r, g, b;
304304   int i;
305305
trunk/src/mame/drivers/intrscti.c
r21033r21034
211211
212212DRIVER_INIT_MEMBER(intrscti_state,intrscti)
213213{
214   UINT8 *cpu = machine().root_device().memregion( "maincpu" )->base();
214   UINT8 *cpu = memregion( "maincpu" )->base();
215215   int i;
216216   for (i=0;i<0x1000;i++)
217217      cpu[i+0x8000]=0xc9; // ret
trunk/src/mame/drivers/halleys.c
r21033r21034
14941494      bitmap.fill(m_bgcolor, cliprect);
14951495
14961496#ifdef MAME_DEBUG
1497   if (machine().root_device().ioport("DEBUG")->read()) copy_scroll_xp(bitmap, m_render_layer[3], *m_scrollx0, *m_scrolly0); // not used???
1497   if (ioport("DEBUG")->read()) copy_scroll_xp(bitmap, m_render_layer[3], *m_scrollx0, *m_scrolly0); // not used???
14981498#endif
14991499
15001500   copy_scroll_xp(bitmap, m_render_layer[2], *m_scrollx1, *m_scrolly1);
trunk/src/mame/drivers/cninja.c
r21033r21034
20452045
20462046DRIVER_INIT_MEMBER(cninja_state,mutantf)
20472047{
2048   const UINT8 *src = machine().root_device().memregion("gfx2")->base();
2049   UINT8 *dst = machine().root_device().memregion("gfx1")->base();
2048   const UINT8 *src = memregion("gfx2")->base();
2049   UINT8 *dst = memregion("gfx1")->base();
20502050
20512051   /* The 16x16 graphic has some 8x8 chars in it - decode them in GFX1 */
20522052   memcpy(dst + 0x50000, dst + 0x10000, 0x10000);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team