Previous 199869 Revisions Next

r18028 Wednesday 19th September, 2012 at 19:48:09 UTC by Aaron Giles
Since nobody checks for NULLs anyway, make
device_memory_interface::space() assert against NULL and
return a reference, and pushed references throughout all
address space usage in the system. Added a has_space()
method to check for those rare case when it is ambiguous.
[Aaron Giles]

Also reinstated the generic space and added fatal error
handlers if anyone tries to actually read/write from it.
[src/emu]devcb.c device.h dimemory.h driver.c driver.h machine.c
[src/emu/cpu]drcfe.h drcuml.c
[src/emu/cpu/adsp2100]adsp2100.c
[src/emu/cpu/alph8201]alph8201.c
[src/emu/cpu/am29000]am29000.c
[src/emu/cpu/apexc]apexc.c
[src/emu/cpu/arm]arm.c
[src/emu/cpu/arm7]arm7.c arm7core.c
[src/emu/cpu/asap]asap.c
[src/emu/cpu/avr8]avr8.c
[src/emu/cpu/ccpu]ccpu.c
[src/emu/cpu/cop400]cop400.c
[src/emu/cpu/cosmac]cosmac.c
[src/emu/cpu/cp1610]cp1610.c
[src/emu/cpu/cubeqcpu]cubeqcpu.c
[src/emu/cpu/dsp16]dsp16.c
[src/emu/cpu/dsp32]dsp32.c
[src/emu/cpu/dsp56k]dsp56k.c
[src/emu/cpu/e132xs]e132xs.c
[src/emu/cpu/esrip]esrip.c
[src/emu/cpu/f8]f8.c
[src/emu/cpu/g65816]g65816.c
[src/emu/cpu/h6280]h6280.c
[src/emu/cpu/h83002]h8_16.c h8_8.c
[src/emu/cpu/hcd62121]hcd62121.c
[src/emu/cpu/hd61700]hd61700.c
[src/emu/cpu/hd6309]hd6309.c
[src/emu/cpu/i386]i386.c
[src/emu/cpu/i4004]i4004.c
[src/emu/cpu/i8008]i8008.c
[src/emu/cpu/i8085]i8085.c
[src/emu/cpu/i86]i286.c i86.c
[src/emu/cpu/i860]i860.c
[src/emu/cpu/i960]i960.c
[src/emu/cpu/jaguar]jaguar.c
[src/emu/cpu/konami]konami.c
[src/emu/cpu/lh5801]lh5801.c
[src/emu/cpu/lr35902]lr35902.c
[src/emu/cpu/m37710]m37710.c
[src/emu/cpu/m6502]m4510.c m6502.c m6509.c m65ce02.c
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/m68000]m68kcpu.c
[src/emu/cpu/m6805]m6805.c
[src/emu/cpu/m6809]m6809.c
[src/emu/cpu/mb86233]mb86233.c
[src/emu/cpu/mb88xx]mb88xx.c
[src/emu/cpu/mc68hc11]mc68hc11.c
[src/emu/cpu/mcs48]mcs48.c
[src/emu/cpu/mcs51]mcs51.c
[src/emu/cpu/minx]minx.c
[src/emu/cpu/mips]mips3com.c r3000.c
[src/emu/cpu/mn10200]mn10200.c
[src/emu/cpu/nec]nec.c v25.c
[src/emu/cpu/pdp1]pdp1.c tx0.c
[src/emu/cpu/pic16c5x]pic16c5x.c
[src/emu/cpu/pic16c62x]pic16c62x.c
[src/emu/cpu/powerpc]ppc.c ppccom.c
[src/emu/cpu/pps4]pps4.c
[src/emu/cpu/psx]psx.c
[src/emu/cpu/rsp]rsp.c rspdrc.c
[src/emu/cpu/s2650]s2650.c
[src/emu/cpu/saturn]saturn.c
[src/emu/cpu/sc61860]sc61860.c
[src/emu/cpu/scmp]scmp.c
[src/emu/cpu/se3208]se3208.c
[src/emu/cpu/sh2]sh2comn.c
[src/emu/cpu/sh4]sh4.c
[src/emu/cpu/sharc]sharc.c
[src/emu/cpu/sm8500]sm8500.c
[src/emu/cpu/spc700]spc700.c
[src/emu/cpu/ssem]ssem.c
[src/emu/cpu/ssp1601]ssp1601.c
[src/emu/cpu/superfx]superfx.c
[src/emu/cpu/t11]t11.c
[src/emu/cpu/tlcs90]tlcs90.c
[src/emu/cpu/tlcs900]tlcs900.c
[src/emu/cpu/tms0980]tms0980.c
[src/emu/cpu/tms32010]tms32010.c
[src/emu/cpu/tms32025]tms32025.c
[src/emu/cpu/tms32031]tms32031.c
[src/emu/cpu/tms32051]tms32051.c
[src/emu/cpu/tms34010]tms34010.c
[src/emu/cpu/tms57002]tms57002.c
[src/emu/cpu/tms7000]tms7000.c
[src/emu/cpu/tms9900]99xxcore.h tms9900.c tms9995.c
[src/emu/cpu/unsp]unsp.c
[src/emu/cpu/upd7725]upd7725.c
[src/emu/cpu/upd7810]upd7810.c
[src/emu/cpu/v30mz]v30mz.c
[src/emu/cpu/v60]v60.c
[src/emu/cpu/v810]v810.c
[src/emu/cpu/z180]z180.c
[src/emu/cpu/z8]z8.c
[src/emu/cpu/z80]z80.c
[src/emu/cpu/z8000]z8000.c
[src/emu/debug]debugcmd.c debugcpu.c debugcpu.h dvdisasm.c dvdisasm.h dvmemory.c
[src/emu/drivers]testcpu.c
[src/emu/machine]6821pia.h 6840ptm.h amigafdc.c i8155.c i8355.c idectrl.c microtch.c s3c2400.c s3c2410.c s3c2440.c s3c24xx.c
[src/emu/sound]bsmt2000.c c352.c cdp1869.c disc_inp.c es5503.c mos6560.c nes_apu.c okim6295.c okim9810.c qs1000.c
[src/emu/video]315_5124.c crt9007.c h63484.c hd61830.c huc6261.c huc6272.c m50458.c mb90082.c mc6845.c pc_cga.c ramdac.c sed1330.c tms9928a.c v9938.c
[src/mame/audio]8080bw.c amiga.c atarijsa.c cage.c cinemat.c dcs.c harddriv.c hyprolyb.c jaguar.c leland.c m72.c mario.c scramble.c seibu.c williams.c
[src/mame/drivers]1943.c 39in1.c 8080bw.c adp.c airbustr.c alpha68k.c appoooh.c arcadia.c arkanoid.c armedf.c artmagic.c asteroid.c astrocde.c astrof.c atarig1.c atarig42.c atarigt.c atarigx2.c atarisy2.c atarisy4.c ataxx.c attckufo.c atvtrack.c backfire.c badlands.c bagman.c balsente.c beathead.c berzerk.c bfm_sc2.c btime.c bublbobl.c bzone.c cabal.c calchase.c calorie.c cd32.c cham24.c chihiro.c cinemat.c cischeat.c cninja.c combatsc.c commando.c coolpool.c coolridr.c cosmic.c cps1.c cps2.c cps3.c crbaloon.c crgolf.c crimfght.c crystal.c cshooter.c csplayh5.c darkmist.c ddealer.c ddenlovr.c ddragon.c deadang.c dec0.c dec8.c deco32.c deco_mlc.c decocass.c deshoros.c dfruit.c dgpix.c dkong.c dynax.c eolith.c eprom.c equites.c exidy.c exidy440.c exprraid.c famibox.c fastfred.c firebeat.c fitfight.c flstory.c freekick.c funworld.c gaiden.c galaga.c galaxian.c galgame.c galivan.c galpani2.c gameplan.c gamtor.c gauntlet.c gei.c ghosteo.c gladiatr.c glass.c gng.c goldstar.c gottlieb.c groundfx.c gstream.c gstriker.c gsword.c guab.c gunbustr.c harddriv.c highvdeo.c hng64.c homedata.c hshavoc.c hyprduel.c igs011.c igs017.c iqblock.c ironhors.c itech32.c itech8.c jack.c jaguar.c jalmah.c jangou.c jchan.c kaneko16.c kangaroo.c kchamp.c konamigv.c konamigx.c ksys573.c kyugo.c ladybug.c lastbank.c leland.c lethalj.c liberate.c limenko.c littlerb.c lkage.c lockon.c looping.c m107.c m72.c m90.c m92.c macrossp.c magictg.c magtouch.c mappy.c maygay1b.c mcr.c mcr3.c mcr68.c mediagx.c megadrvb.c megaplay.c megasys1.c megatech.c meritm.c metalmx.c metro.c midqslvr.c midvunit.c midyunit.c midzeus.c missile.c mitchell.c model2.c model3.c mouser.c mpu3.c mpu4hw.c mquake.c multigam.c namcona1.c namcos11.c namcos12.c namcos22.c naughtyb.c nbmj9195.c neodrvr.c neogeo.c ninjakd2.c niyanpai.c nmk16.c nyny.c offtwall.c omegrace.c pachifev.c pacman.c pangofun.c paradise.c pasha2.c pbaction.c pcat_dyn.c pcat_nit.c pcktgal.c pengadvb.c pengo.c phoenix.c photoply.c pingpong.c pinkiri8.c pipedrm.c pirates.c plygonet.c pntnpuzl.c polepos.c policetr.c progolf.c psikyo.c psikyo4.c psikyosh.c pturn.c qix.c queen.c r2dtank.c r2dx_v33.c raiden.c renegade.c rmhaihai.c safarir.c sangho.c saturn.c savquest.c seattle.c segac2.c segae.c segag80r.c segag80v.c segahang.c segas16a.c segas16b.c segas32.c segaxbd.c seibuspi.c seta.c shootout.c sidepckt.c simpl156.c skydiver.c slapfght.c snesb.c snk.c snowbros.c spacefb.c sprint2.c srumbler.c starwars.c statriv2.c strnskil.c stv.c su2000.c suna16.c suna8.c superchs.c supertnk.c suprnova.c system1.c system16.c taito_f3.c taito_x.c taitogn.c taitojc.c taitosj.c taitowlf.c tcl.c tecmo.c terracre.c thepit.c tiamc1.c tigeroad.c tmaster.c toki.c trackfld.c tumbleb.c turbo.c tx1.c umipoker.c upscope.c vamphalf.c vcombat.c vegaeo.c vegas.c vendetta.c videopin.c viper.c voyager.c williams.c witch.c wiz.c xtom3d.c yunsun16.c zaxxon.c zn.c
[src/mame/includes]jaguar.h
[src/mame/machine]amiga.c archimds.c asic65.c asteroid.c atari.c atarigen.c bagman.c balsente.c cclimber.c cd32.c cps2crpt.c cx4fn.c cx4oam.c dc.c dec0.c deco102.c fd1089.c fd1094.c fddebug.c galaxold.c irobot.c kabuki.c kaneko_calc3.c kaneko_toybox.c konami1.c konamigx.c mc8123.c mcr68.c md_cart.c mega32x.c megacd.c megadriv.c megasvp.c megavdp.c mhavoc.c micro3d.c midtunit.c midwunit.c midyunit.c n64.c namcos1.c namcos2.c naomi.c neoboot.c neoprot.c nmk004.c pgmprot.c pgmprot1.c pgmprot2.c pgmprot3.c pgmprot4.c pgmprot5.c pgmprot6.c pitnrun.c playch10.c qix.c scramble.c segacrp2.c segacrpt.c segaic16.c segamsys.c segas32.c snes.c snescx4.c stfight.c stvprot.c taitosj.c tatsumi.c tnzs.c toaplan1.c twincobr.c vectrex.c vsnes.c williams.c
[src/mame/video]amiga.c astrocde.c atari.c atarisy1.c avgdvg.c blstroid.c cischeat.c combatsc.c dc.c dogfgt.c gp9001.c gtia.c hng64.c leland.c namcos22.c ojankohs.c popeye.c ppu2c0x.c simpsons.c skydiver.c taito_b.c toaplan1.c vdc.c vrender0.c
[src/mess/audio]mos7360.c svision.c
[src/mess/drivers]a2600.c a310.c a5105.c a7000.c abc1600.c abc80x.c ace.c adam.c amiga.c apexc.c apollo.c apricot.c apricotf.c aquarius.c astrocde.c atari400.c atarist.c atm.c atom.c avigo.c basic52.c bebox.c bigbord2.c bml3.c bw12.c bw2.c c64.c camplynx.c cat.c cd2650.c cosmicos.c crvision.c cxhumax.c d6800.c dc.c dectalk.c elf.c elwro800.c enterp.c exp85.c fk1.c fm7.c fmtowns.c fp1100.c gba.c gp32.c homelab.c ht68k.c indiana.c instruct.c ip22.c itt3030.c kyocera.c lc80.c lynx.c m5.c mc10.c mc1000.c mc80.c micronic.c mikromik.c mpf1.c mpz80.c ms0515.c msbc1.c mstation.c nanos.c nc.c newbrain.c next.c ng_aes.c ob68k1a.c osi.c p8k.c palm.c pasopia7.c pc1512.c pc6001.c pc8001.c pc8401a.c pc88va.c pc9801.c pce220.c pcfx.c pcw.c pcw16.c pdp1.c pentagon.c pes.c pipbug.c plus4.c poly.c portfoli.c prestige.c prof80.c psx.c px4.c px8.c ql.c rex6000.c rx78.c sage2.c samcoupe.c scorpion.c sg1000.c sgi_ip2.c spc1000.c specpls3.c spectrum.c super6.c supracan.c tandy2k.c tek405x.c ti89.c tiki100.c timex.c tmc1800.c tmc600.c tvc.c unixpc.c v1050.c vboy.c vc4000.c vcs80.c vg5k.c vic10.c victor9k.c vii.c vixen.c vt520.c vtech1.c wangpc.c x07.c x1.c x1twin.c x68k.c xerox820.c xor100.c z1013.c z88.c z9001.c
[src/mess/formats]ace_ace.c atom_atm.c cbm_snqk.c comx35_comx.c m65_snqk.c spec_snqk.c trs_cmd.c z80bin.c
[src/mess/machine]6883sam.c 990_hd.c 990_tap.c a7800.c advision.c aim65.c amigacd.c amigacrt.c amstrad.c apollo.c apple1.c apple2.c apple2gs.c apple3.c at.c ataricrt.c b2m.c bbc.c bebox.c c128.c c64.c c65.c cgenie.c coco.c coco_multi.c coco_vhd.c compis.c comx_clm.c cpc_ssa1.c cs4031.c cybiko.c dgn_beta.c electron.c galaxy.c gb.c genpc.c hd63450.c hp48.c i82439tx.c intv.c iq151_staper.c isa.c kaypro.c kc.c kc_d004.c lisa.c llc.c lviv.c lynx.c mac.c mbc55x.c mbee.c mface2.c microtan.c mpc105.c msx.c msx_slot.c mtx.c mz700.c nascom1.c nes.c northbridge.c nubus.c ondra.c oric.c orion.c osborne1.c partner.c pc.c pc1350.c pc_lpt.c pce.c pecom.c pet.c pk8020.c pmd85.c pokemini.c poly88.c pp01.c primo.c radio86.c rm380z.c rmnimbus.c s100_wunderbus.c s3c44b0.c samcoupe.c sms.c snescart.c sorcerer.c southbridge.c special.c sym1.c tf20.c thomson.c ti85.c trs80.c upd71071.c vector06.c vtech2.c wswan.c x68k_neptunex.c x68k_scsiext.c z80ne.c z88_flash.c zx.c
[src/mess/machine/ti99]datamux.c ti_rs232.c tn_ide.c
[src/mess/video]a7800.c ac1.c apple3.c atarist.c cirrus.c dai.c ef9345.c galaxy.c gb.c hd66421.c hp48.c iq151_grafik.c irisha.c isa_cga.c kramermc.c mos6566.c newbrain.c oric.c pc_aga.c pc_t1t.c primo.c ti85.c tms3556.c upd7220.c zx8301.c

trunk/src/mame/audio/jaguar.c
r18027r18028
202202
203203#if ENABLE_SPEEDUP_HACKS
204204   if (m_hacks_enabled)
205      m_dsp->space(AS_PROGRAM)->install_write_handler(0xf1a100, 0xf1a103, write32_delegate(FUNC(jaguar_state::dsp_flags_w), this));
205      m_dsp->space(AS_PROGRAM).install_write_handler(0xf1a100, 0xf1a103, write32_delegate(FUNC(jaguar_state::dsp_flags_w), this));
206206#endif
207207}
208208
trunk/src/mame/audio/atarijsa.c
r18027r18028
147147
148148   /* install POKEY memory handlers */
149149   if (pokey != NULL)
150      jsacpu->space(AS_PROGRAM)->install_readwrite_handler(0x2c00, 0x2c0f, read8_delegate(FUNC(pokey_device::read),pokey), write8_delegate(FUNC(pokey_device::write),pokey));
150      jsacpu->space(AS_PROGRAM).install_readwrite_handler(0x2c00, 0x2c0f, read8_delegate(FUNC(pokey_device::read),pokey), write8_delegate(FUNC(pokey_device::write),pokey));
151151
152152   init_save_state(machine);
153153   atarijsa_reset();
trunk/src/mame/audio/cage.c
r18027r18028
177177   state->timer[1] = machine.device<timer_device>("cage_timer1");
178178
179179   if (speedup)
180      state->speedup_ram = state->cpu->space(AS_PROGRAM)->install_legacy_write_handler(speedup, speedup, FUNC(speedup_w));
180      state->speedup_ram = state->cpu->space(AS_PROGRAM).install_legacy_write_handler(speedup, speedup, FUNC(speedup_w));
181181
182182   for (chan = 0; chan < DAC_BUFFER_CHANNELS; chan++)
183183   {
trunk/src/mame/audio/leland.c
r18027r18028
385385static STREAM_UPDATE( leland_80186_dma_update )
386386{
387387   leland_sound_state *state = get_safe_token(device);
388   address_space *dmaspace = (address_space *)param;
388   address_space &dmaspace = *(address_space *)param;
389389   stream_sample_t *buffer = outputs[0];
390390   int i, j;
391391
r18027r18028
434434            /* sample-rate convert to the output frequency */
435435            for (j = 0; j < samples && count > 0; j++)
436436            {
437               buffer[j] += ((int)dmaspace->read_byte(source) - 0x80) * volume;
437               buffer[j] += ((int)dmaspace.read_byte(source) - 0x80) * volume;
438438               frac += step;
439439               source += frac >> 24;
440440               count -= frac >> 24;
r18027r18028
521521{
522522   leland_sound_state *state = get_safe_token(device);
523523   running_machine &machine = device->machine();
524   address_space *dmaspace = machine.device("audiocpu")->memory().space(AS_PROGRAM);
524   address_space &dmaspace = machine.device("audiocpu")->memory().space(AS_PROGRAM);
525525   int i;
526526
527527   /* determine which sound hardware is installed */
528528   state->m_has_ym2151 = (device->machine().device("ymsnd") != NULL);
529529
530530   /* allocate separate streams for the DMA and non-DMA DACs */
531   state->m_dma_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, (void *)dmaspace, leland_80186_dma_update);
531   state->m_dma_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, (void *)&dmaspace, leland_80186_dma_update);
532532   state->m_nondma_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, NULL, leland_80186_dac_update);
533533
534534   /* if we have a 2151, install an externally driven DAC stream */
r18027r18028
539539   }
540540
541541   /* create timers here so they stick around */
542   state->m_i80186.cpu = &dmaspace->device();
542   state->m_i80186.cpu = &dmaspace.device();
543543   state->m_i80186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device);
544544   state->m_i80186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device);
545545   state->m_i80186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device);
r18027r18028
15911591         temp = (state->m_i80186.mem.peripheral & 0xffc0) << 4;
15921592         if (state->m_i80186.mem.middle_size & 0x0040)
15931593         {
1594            state->m_i80186.cpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w));
1594            state->m_i80186.cpu->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w));
15951595         }
15961596         else
15971597         {
15981598            temp &= 0xffff;
1599            state->m_i80186.cpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w));
1599            state->m_i80186.cpu->memory().space(AS_IO).install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w));
16001600         }
16011601
16021602         /* we need to do this at a time when the 80186 context is swapped in */
r18027r18028
16621662         temp = (data & 0x0fff) << 8;
16631663         if (data & 0x1000)
16641664         {
1665            state->m_i80186.cpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w));
1665            state->m_i80186.cpu->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w));
16661666         }
16671667         else
16681668         {
16691669            temp &= 0xffff;
1670            state->m_i80186.cpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w));
1670            state->m_i80186.cpu->memory().space(AS_IO).install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w));
16711671         }
16721672/*          popmessage("Sound CPU reset");*/
16731673         break;
trunk/src/mame/audio/seibu.c
r18027r18028
104104
105105void seibu_sound_decrypt(running_machine &machine,const char *cpu,int length)
106106{
107   address_space &space = *machine.device(cpu)->memory().space(AS_PROGRAM);
107   address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM);
108108   UINT8 *decrypt = auto_alloc_array(machine, UINT8, length);
109109   UINT8 *rom = machine.root_device().memregion(cpu)->base();
110110   int i;
trunk/src/mame/audio/scramble.c
r18027r18028
127127{
128128   driver_device *drvstate = space.machine().driver_data<driver_device>();
129129   space.machine().device("audiocpu")->execute().set_input_line(0, CLEAR_LINE);
130   return drvstate->soundlatch_byte_r(*space.machine().device("audiocpu")->memory().space(AS_PROGRAM),0);
130   return drvstate->soundlatch_byte_r(space.machine().device("audiocpu")->memory().space(AS_PROGRAM),0);
131131}
132132
133133static void filter_w(device_t *device, int data)
trunk/src/mame/audio/dcs.c
r18027r18028
944944
945945   /* find the DCS CPU and the sound ROMs */
946946   dcs.cpu = machine.device<adsp21xx_device>("dcs");
947   dcs.program = dcs.cpu->space(AS_PROGRAM);
948   dcs.data = dcs.cpu->space(AS_DATA);
947   dcs.program = &dcs.cpu->space(AS_PROGRAM);
948   dcs.data = &dcs.cpu->space(AS_DATA);
949949   dcs.rev = 1;
950950   dcs.channels = 1;
951951   dcs.dmadac[0] = machine.device<dmadac_sound_device>("dac");
r18027r18028
997997      dcs.rev = 4;
998998      soundbank_words = 0x800;
999999   }
1000   dcs.program = dcs.cpu->space(AS_PROGRAM);
1001   dcs.data = dcs.cpu->space(AS_DATA);
1000   dcs.program = &dcs.cpu->space(AS_PROGRAM);
1001   dcs.data = &dcs.cpu->space(AS_DATA);
10021002   dcs.channels = 2;
10031003   dcs.dmadac[0] = machine.device<dmadac_sound_device>("dac1");
10041004   dcs.dmadac[1] = machine.device<dmadac_sound_device>("dac2");
r18027r18028
10361036   /* install the speedup handler */
10371037   dcs.polling_offset = polling_offset;
10381038   if (polling_offset)
1039      dcs.polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w));
1039      dcs.polling_base = dcs.cpu->space(AS_DATA).install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w));
10401040
10411041   /* allocate a watchdog timer for HLE transfers */
10421042   dcs.transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && dram_in_mb != 0);
r18027r18028
11751175
11761176   /* reinstall the polling hotspot */
11771177   if (dcs.polling_offset)
1178      dcs.polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w));
1178      dcs.polling_base = dcs.cpu->space(AS_DATA).install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w));
11791179}
11801180
11811181
r18027r18028
21372137      machine.scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback2), param);
21382138      return;
21392139   }
2140   output_latch_w(*dcs.cpu->space(AS_PROGRAM), 0, 0x000a, 0xffff);
2140   output_latch_w(dcs.cpu->space(AS_PROGRAM), 0, 0x000a, 0xffff);
21412141}
21422142
21432143
r18027r18028
21492149      machine.scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback1), param);
21502150      return;
21512151   }
2152   output_latch_w(*dcs.cpu->space(AS_PROGRAM), 0, param, 0xffff);
2152   output_latch_w(dcs.cpu->space(AS_PROGRAM), 0, param, 0xffff);
21532153
21542154   /* chain to the next word we need to write back */
21552155   machine.scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback2));
r18027r18028
22812281
22822282static TIMER_CALLBACK( s2_ack_callback )
22832283{
2284   address_space &space = *dcs.cpu->space(AS_PROGRAM);
2284   address_space &space = dcs.cpu->space(AS_PROGRAM);
22852285
22862286   /* if the output is full, stall for a usec */
22872287   if (IS_OUTPUT_FULL())
trunk/src/mame/audio/8080bw.c
r18027r18028
897897
898898static void schaser_reinit_555_time_remain(_8080bw_state *state)
899899{
900   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
900   address_space &space = state->m_maincpu->space(AS_PROGRAM);
901901   state->m_schaser_effect_555_time_remain = attotime::from_double(state->m_schaser_effect_555_time_remain_savable);
902902   state->schaser_sh_port_2_w(space, 0, state->m_port_2_last_extra);
903903}
r18027r18028
918918
919919MACHINE_RESET_MEMBER(_8080bw_state,schaser_sh)
920920{
921   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
921   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
922922
923923   m_schaser_effect_555_is_low = 0;
924924   m_schaser_effect_555_timer->adjust(attotime::never);
trunk/src/mame/audio/hyprolyb.c
r18027r18028
2424{
2525   hyprolyb_adpcm_state *state = get_safe_token(device);
2626
27   state->m_space = device->machine().device("audiocpu")->memory().space(AS_PROGRAM);
27   state->m_space = &device->machine().device("audiocpu")->memory().space(AS_PROGRAM);
2828   state->m_msm = device->machine().device("msm");
2929   device->save_item(NAME(state->m_adpcm_ready));   // only bootlegs
3030   device->save_item(NAME(state->m_adpcm_busy));
trunk/src/mame/audio/amiga.c
r18027r18028
7676
7777static TIMER_CALLBACK( signal_irq )
7878{
79   amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | (0x80 << param), 0xffff);
79   amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | (0x80 << param), 0xffff);
8080}
8181
8282
trunk/src/mame/audio/cinemat.c
r18027r18028
14911491{
14921492   cinemat_state *state = machine.driver_data<cinemat_state>();
14931493   SOUND_RESET_CALL(demon_sound);
1494   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x04, 0x04, write8_delegate(FUNC(cinemat_state::qb3_sound_w),state));
1494   machine.device("maincpu")->memory().space(AS_IO).install_write_handler(0x04, 0x04, write8_delegate(FUNC(cinemat_state::qb3_sound_w),state));
14951495
14961496   /* this patch prevents the sound ROM from eating itself when command $0A is sent */
14971497   /* on a cube rotate */
trunk/src/mame/audio/harddriv.c
r18027r18028
231231
232232READ16_MEMBER(harddriv_state::hdsnd68k_320ports_r)
233233{
234   return m_sounddsp->space(AS_IO)->read_word((offset & 7) << 1);
234   return m_sounddsp->space(AS_IO).read_word((offset & 7) << 1);
235235}
236236
237237
238238WRITE16_MEMBER(harddriv_state::hdsnd68k_320ports_w)
239239{
240   m_sounddsp->space(AS_IO)->write_word((offset & 7) << 1, data);
240   m_sounddsp->space(AS_IO).write_word((offset & 7) << 1, data);
241241}
242242
243243
trunk/src/mame/audio/m72.c
r18027r18028
125125
126126   state->samples = device->machine().root_device().memregion("samples")->base();
127127   state->samples_size = device->machine().root_device().memregion("samples")->bytes();
128   state->space = device->machine().device("soundcpu")->memory().space(AS_IO);
128   state->space = &device->machine().device("soundcpu")->memory().space(AS_IO);
129129   state->dac = device->machine().device<dac_device>("dac");
130130
131131   device->save_item(NAME(state->irqvector));
trunk/src/mame/audio/williams.c
r18027r18028
129129   // going high halts the CPU
130130   if (state)
131131   {
132      bank_select_w(*m_cpu->space(), 0, 0);
132      bank_select_w(m_cpu->space(), 0, 0);
133133      device_reset();
134134      m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
135135   }
r18027r18028
404404   // going high halts the CPU
405405   if (state)
406406   {
407      master_bank_select_w(*m_cpu0->space(), 0, 0);
408      slave_bank_select_w(*m_cpu1->space(), 0, 0);
407      master_bank_select_w(m_cpu0->space(), 0, 0);
408      slave_bank_select_w(m_cpu1->space(), 0, 0);
409409      device_reset();
410410      m_cpu0->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
411411      m_cpu1->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
r18027r18028
772772   // going high halts the CPU
773773   if (state)
774774   {
775      bank_select_w(*m_cpu->space(), 0, 0);
775      bank_select_w(m_cpu->space(), 0, 0);
776776      device_reset();
777777      m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
778778   }
trunk/src/mame/audio/mario.c
r18027r18028
425425   if (audiocpu != NULL && audiocpu->type() != Z80)
426426   {
427427      state->m_eabank = "bank1";
428      audiocpu->memory().space(AS_PROGRAM)->install_read_bank(0x000, 0x7ff, "bank1");
428      audiocpu->memory().space(AS_PROGRAM).install_read_bank(0x000, 0x7ff, "bank1");
429429      state->membank("bank1")->configure_entry(0, state->memregion("audiocpu")->base());
430430       state->membank("bank1")->configure_entry(1, state->memregion("audiocpu")->base() + 0x1000);
431431   }
r18027r18028
437437static SOUND_RESET( mario )
438438{
439439   mario_state   *state = machine.driver_data<mario_state>();
440   address_space &space = *machine.device("audiocpu")->memory().space(AS_PROGRAM);
440   address_space &space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
441441
442442#if USE_8039
443443    set_ea(machine, 1);
trunk/src/mame/machine/segacrp2.c
r18027r18028
6060   };
6161
6262
63   address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM);
63   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
6464   UINT8 *rom = machine.root_device().memregion(cputag)->base();
6565   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x8000);
6666
trunk/src/mame/machine/nmk004.c
r18027r18028
311311static void fm_update(int channel)
312312{
313313   struct fm_control *fm = &NMK004_state.fm_control[channel];
314   address_space &space = *NMK004_state.machine().firstcpu->space(AS_PROGRAM);
314   address_space &space = NMK004_state.machine().firstcpu->space(AS_PROGRAM);
315315
316316   // advance the timers
317317   if (fm->timer1)
r18027r18028
595595   };
596596   int channel,i;
597597
598   address_space &space = *NMK004_state.machine().firstcpu->space(AS_PROGRAM);
598   address_space &space = NMK004_state.machine().firstcpu->space(AS_PROGRAM);
599599   for (channel = 0; channel < 3;channel++)
600600   {
601601      struct fm_control *fm1 = &NMK004_state.fm_control[channel];
r18027r18028
684684static void psg_update(int channel)
685685{
686686   struct psg_control *psg = &NMK004_state.psg_control[channel];
687   address_space &space = *NMK004_state.machine().firstcpu->space(AS_PROGRAM);
687   address_space &space = NMK004_state.machine().firstcpu->space(AS_PROGRAM);
688688
689689   // advance the timers
690690   if (psg->note_timer)
r18027r18028
10031003{
10041004   if (irq)
10051005   {
1006      address_space &space = *NMK004_state.machine().firstcpu->space(AS_PROGRAM);
1006      address_space &space = NMK004_state.machine().firstcpu->space(AS_PROGRAM);
10071007      int status = ym2203_status_port_r(device,space,0);
10081008
10091009      if (status & 1)   // timer A expired
r18027r18028
10391039
10401040   NMK004_state.rom = machine.root_device().memregion("audiocpu")->base();
10411041
1042   address_space &space = *NMK004_state.machine().firstcpu->space(AS_PROGRAM);
1042   address_space &space = NMK004_state.machine().firstcpu->space(AS_PROGRAM);
10431043   ym2203_control_port_w(NMK004_state.ymdevice, space, 0, 0x2f);
10441044
10451045   i = 0;
trunk/src/mame/machine/fd1089.c
r18027r18028
253253   decrypt(0x000000, romsize, m_plaintext, m_decrypted_opcodes, rombase);
254254
255255   // mark the ROM region as decrypted, pointing to the opcodes (if it is mapped)
256   address_space *program = space(AS_PROGRAM);
257   if (program->get_read_ptr(0) != NULL)
258      program->set_decrypted_region(0x000000, romsize - 1, m_decrypted_opcodes);
256   address_space &program = space(AS_PROGRAM);
257   if (program.get_read_ptr(0) != NULL)
258      program.set_decrypted_region(0x000000, romsize - 1, m_decrypted_opcodes);
259259}
260260
261261
trunk/src/mame/machine/stvprot.c
r18027r18028
162162
163163void install_twcup98_protection(running_machine &machine)
164164{
165   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(twcup98_prot_r), FUNC(twcup98_prot_w));
165   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(twcup98_prot_r), FUNC(twcup98_prot_w));
166166}
167167
168168/**************************
r18027r18028
227227
228228void install_sss_protection(running_machine &machine)
229229{
230   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(sss_prot_r), FUNC(sss_prot_w));
230   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(sss_prot_r), FUNC(sss_prot_w));
231231}
232232
233233/*************************************
r18027r18028
292292
293293void install_rsgun_protection(running_machine &machine)
294294{
295   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(rsgun_prot_r), FUNC(rsgun_prot_w));
295   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(rsgun_prot_r), FUNC(rsgun_prot_w));
296296}
297297
298298/*************************
r18027r18028
387387
388388void install_elandore_protection(running_machine &machine)
389389{
390   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(elandore_prot_r), FUNC(elandore_prot_w));
390   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(elandore_prot_r), FUNC(elandore_prot_w));
391391}
392392
393393/*************************
r18027r18028
471471
472472void install_ffreveng_protection(running_machine &machine)
473473{
474   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(ffreveng_prot_r), FUNC(ffreveng_prot_w));
474   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(ffreveng_prot_r), FUNC(ffreveng_prot_w));
475475}
476476
477477/************************
r18027r18028
511511void install_astrass_protection(running_machine &machine)
512512{
513513   ctrl_index = -1;
514   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(astrass_prot_r), FUNC(astrass_prot_w));
514   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x4fffff0, 0x4ffffff, FUNC(astrass_prot_r), FUNC(astrass_prot_w));
515515}
516516
517517/**************************
r18027r18028
698698   decathlt_prot_uploadmode = 0;
699699   decathlt_prot_uploadoffset = 0;
700700   decathlt_part = 1;
701   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x37FFFF0, 0x37FFFFF, FUNC(decathlt_prot_r), FUNC(decathlt_prot1_w));
701   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x37FFFF0, 0x37FFFFF, FUNC(decathlt_prot_r), FUNC(decathlt_prot1_w));
702702   /* It accesses the device at this address too, with different tables, for the game textures, should it just act like a mirror, or a secondary device? */
703   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x27FFFF0, 0x27FFFFF, FUNC(decathlt_prot_r), FUNC(decathlt_prot2_w));
703   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x27FFFF0, 0x27FFFFF, FUNC(decathlt_prot_r), FUNC(decathlt_prot2_w));
704704}
705705
706706void stv_register_protection_savestates(running_machine &machine)
trunk/src/mame/machine/asic65.c
r18027r18028
138138
139139void asic65_reset(running_machine &machine, int state)
140140{
141   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
141   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
142142
143143   /* rom-based means reset and clear states */
144144   if (asic65.cpu != NULL)
trunk/src/mame/machine/tnzs.c
r18027r18028
528528   m_mcu_type = MCU_DRTOPPEL;
529529
530530   /* drtoppel writes to the palette RAM area even if it has PROMs! We have to patch it out. */
531   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xf800, 0xfbff);
531   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xf800, 0xfbff);
532532}
533533
534534DRIVER_INIT_MEMBER(tnzs_state,chukatai)
r18027r18028
540540{
541541   m_mcu_type = MCU_TNZS;
542542   /* we need to install a kludge to avoid problems with a bug in the original code */
543//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xef10, 0xef10, FUNC(tnzs_sync_kludge_w));
543//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xef10, 0xef10, FUNC(tnzs_sync_kludge_w));
544544}
545545
546546DRIVER_INIT_MEMBER(tnzs_state,tnzsb)
r18027r18028
548548   m_mcu_type = MCU_NONE_TNZSB;
549549
550550   /* we need to install a kludge to avoid problems with a bug in the original code */
551//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xef10, 0xef10, FUNC(tnzs_sync_kludge_w));
551//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xef10, 0xef10, FUNC(tnzs_sync_kludge_w));
552552}
553553
554554DRIVER_INIT_MEMBER(tnzs_state,kabukiz)
r18027r18028
564564   m_mcu_type = MCU_NONE_INSECTX;
565565
566566   /* this game has no mcu, replace the handler with plain input port handlers */
567   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_port(0xc000, 0xc000, "IN0" );
568   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_port(0xc001, 0xc001, "IN1" );
569   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_port(0xc002, 0xc002, "IN2" );
567   machine().device("sub")->memory().space(AS_PROGRAM).install_read_port(0xc000, 0xc000, "IN0" );
568   machine().device("sub")->memory().space(AS_PROGRAM).install_read_port(0xc001, 0xc001, "IN1" );
569   machine().device("sub")->memory().space(AS_PROGRAM).install_read_port(0xc002, 0xc002, "IN2" );
570570}
571571
572572DRIVER_INIT_MEMBER(tnzs_state,kageki)
trunk/src/mame/machine/midyunit.c
r18027r18028
297297   switch (sound)
298298   {
299299      case SOUND_CVSD_SMALL:
300         machine.device("cvsd:cpu")->memory().space(AS_PROGRAM)->install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w),state));
300         machine.device("cvsd:cpu")->memory().space(AS_PROGRAM).install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w),state));
301301         state->m_cvsd_protection_base = machine.root_device().memregion("cvsd:cpu")->base() + 0x10000 + (prot_start - 0x8000);
302302         break;
303303
304304      case SOUND_CVSD:
305         machine.device("cvsd:cpu")->memory().space(AS_PROGRAM)->install_ram(prot_start, prot_end);
305         machine.device("cvsd:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
306306         break;
307307
308308      case SOUND_ADPCM:
309         machine.device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_ram(prot_start, prot_end);
309         machine.device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
310310         break;
311311
312312      case SOUND_NARC:
313         machine.device("narcsnd:cpu0")->memory().space(AS_PROGRAM)->install_ram(prot_start, prot_end);
313         machine.device("narcsnd:cpu0")->memory().space(AS_PROGRAM).install_ram(prot_start, prot_end);
314314         break;
315315
316316      case SOUND_YAWDIM:
r18027r18028
478478DRIVER_INIT_MEMBER(midyunit_state,mkyturbo)
479479{
480480   /* protection */
481   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfffff400, 0xfffff40f, read16_delegate(FUNC(midyunit_state::mkturbo_prot_r),this));
481   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfffff400, 0xfffff40f, read16_delegate(FUNC(midyunit_state::mkturbo_prot_r),this));
482482
483483   DRIVER_INIT_CALL(mkyunit);
484484}
r18027r18028
500500   init_generic(machine, 6, SOUND_ADPCM, 0xfa8d, 0xfa9c);
501501
502502   /* special inputs */
503   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01c00000, 0x01c0005f, read16_delegate(FUNC(midyunit_state::term2_input_r),state));
504   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w),state));
503   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01c00000, 0x01c0005f, read16_delegate(FUNC(midyunit_state::term2_input_r),state));
504   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w),state));
505505
506506   /* HACK: this prevents the freeze on the movies */
507507   /* until we figure whats causing it, this is better than nothing */
508   state->m_t2_hack_mem = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w);
508   state->m_t2_hack_mem = machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w);
509509}
510510
511511DRIVER_INIT_MEMBER(midyunit_state,term2)    { term2_init_common(machine(), write16_delegate(FUNC(midyunit_state::term2_hack_w),this)); }
trunk/src/mame/machine/naomi.c
r18027r18028
192192
193193DRIVER_INIT_MEMBER(dc_state,naomi)
194194{
195   //machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
196   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
195   //machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
196   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
197197   jvsboard_type = JVSBD_DEFAULT;
198198   actel_id = 0xffff;
199199
r18027r18028
202202
203203DRIVER_INIT_MEMBER(dc_state,naomi2)
204204{
205   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi2_biose_idle_skip_r)); // rev e bios
205   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi2_biose_idle_skip_r)); // rev e bios
206206   jvsboard_type = JVSBD_DEFAULT;
207207   actel_id = 0xffff;
208208
r18027r18028
211211
212212DRIVER_INIT_MEMBER(dc_state,naomi_mp)
213213{
214   //machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
215   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
214   //machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
215   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
216216   jvsboard_type = JVSBD_MAHJONG;
217217   actel_id = 0xffff;
218218
r18027r18028
221221
222222DRIVER_INIT_MEMBER(dc_state,naomigd)
223223{
224   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
225   //machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
224   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
225   //machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
226226   jvsboard_type = JVSBD_DEFAULT;
227227   actel_id = 0xffff;
228228
r18027r18028
231231
232232DRIVER_INIT_MEMBER(dc_state,naomigd_mp)
233233{
234   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
235   //machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
234   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2ad238, 0xc2ad23f, FUNC(naomi_biose_idle_skip_r)); // rev e bios
235   //machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2b0600, 0xc2b0607, FUNC(naomi_biosh_idle_skip_r)); // rev h bios
236236   jvsboard_type = JVSBD_MAHJONG;
237237   actel_id = 0xffff;
238238
r18027r18028
250250
251251DRIVER_INIT_MEMBER(dc_state,ggxxsla)
252252{
253   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc1aae18, 0xc1aae1f, FUNC(naomigd_ggxxsla_idle_skip_r));
253   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc1aae18, 0xc1aae1f, FUNC(naomigd_ggxxsla_idle_skip_r));
254254   DRIVER_INIT_CALL(naomigd);
255255}
256256
r18027r18028
265265
266266DRIVER_INIT_MEMBER(dc_state,ggxx)
267267{
268   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc1837b8, 0xc1837bf, FUNC(naomigd_ggxx_idle_skip_r));
268   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc1837b8, 0xc1837bf, FUNC(naomigd_ggxx_idle_skip_r));
269269   DRIVER_INIT_CALL(naomigd);
270270}
271271
r18027r18028
281281
282282DRIVER_INIT_MEMBER(dc_state,ggxxrl)
283283{
284   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc18d6c8, 0xc18d6cf, FUNC(naomigd_ggxxrl_idle_skip_r));
284   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc18d6c8, 0xc18d6cf, FUNC(naomigd_ggxxrl_idle_skip_r));
285285   DRIVER_INIT_CALL(naomigd);
286286}
287287
r18027r18028
296296
297297DRIVER_INIT_MEMBER(dc_state,sfz3ugd)
298298{
299   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc5dc900, 0xc5dc907, FUNC(naomigd_sfz3ugd_idle_skip_r));
299   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc5dc900, 0xc5dc907, FUNC(naomigd_sfz3ugd_idle_skip_r));
300300   DRIVER_INIT_CALL(naomigd);
301301}
302302
r18027r18028
344344
345345DRIVER_INIT_MEMBER(dc_state,hotd2)
346346{
347   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xca25fb8, 0xca25fbf, FUNC(hotd2_idle_skip_r));
347   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xca25fb8, 0xca25fbf, FUNC(hotd2_idle_skip_r));
348348}
349349
350350// f355 PC=0xc065f7c RAM=0xc26dafc
trunk/src/mame/machine/asteroid.c
r18027r18028
133133
134134void asteroid_state::machine_reset()
135135{
136   asteroid_bank_switch_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
137   avgdvg_reset_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
136   asteroid_bank_switch_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
137   avgdvg_reset_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
138138}
trunk/src/mame/machine/mhavoc.c
r18027r18028
8282
8383void mhavoc_state::machine_reset()
8484{
85   address_space &space = *machine().device("alpha")->memory().space(AS_PROGRAM);
85   address_space &space = machine().device("alpha")->memory().space(AS_PROGRAM);
8686   m_has_gamma_cpu = (machine().device("gamma") != NULL);
8787
8888   membank("bank1")->configure_entry(0, m_zram0);
r18027r18028
324324{
325325   /* install the speech support that was only optionally stuffed for use */
326326   /* in the Return to Vax hack */
327   machine().device("gamma")->memory().space(AS_PROGRAM)->install_write_handler(0x5800, 0x5800, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_data_w),this));
328   machine().device("gamma")->memory().space(AS_PROGRAM)->install_write_handler(0x5900, 0x5900, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_strobe_w),this));
327   machine().device("gamma")->memory().space(AS_PROGRAM).install_write_handler(0x5800, 0x5800, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_data_w),this));
328   machine().device("gamma")->memory().space(AS_PROGRAM).install_write_handler(0x5900, 0x5900, write8_delegate(FUNC(mhavoc_state::mhavocrv_speech_strobe_w),this));
329329}
trunk/src/mame/machine/twincobr.c
r18027r18028
5151{
5252   /* DSP can read data from main CPU RAM via DSP IO port 1 */
5353
54   address_space *mainspace;
5554   UINT16 input_data = 0;
5655   switch (m_main_ram_seg) {
5756      case 0x30000:
5857      case 0x40000:
59      case 0x50000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
60                  input_data = mainspace->read_word(m_main_ram_seg + m_dsp_addr_w);
61                  break;
58      case 0x50000:  {address_space &mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
59                  input_data = mainspace.read_word(m_main_ram_seg + m_dsp_addr_w);
60                  break;}
6261      default:      logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break;
6362   }
6463   LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",space.device().safe_pcbase(),input_data,m_main_ram_seg + m_dsp_addr_w));
r18027r18028
6766
6867WRITE16_MEMBER(twincobr_state::twincobr_dsp_w)
6968{
70   address_space *mainspace;
71
7269   /* Data written to main CPU RAM via DSP IO port 1 */
7370   m_dsp_execute = 0;
7471   switch (m_main_ram_seg) {
7572      case 0x30000:   if ((m_dsp_addr_w < 3) && (data == 0)) m_dsp_execute = 1;
7673      case 0x40000:
77      case 0x50000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
78                  mainspace->write_word(m_main_ram_seg + m_dsp_addr_w, data);
79                  break;
74      case 0x50000:  {address_space &mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
75                  mainspace.write_word(m_main_ram_seg + m_dsp_addr_w, data);
76                  break;}
8077      default:      logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break;
8178   }
8279   LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",space.device().safe_pcbase(),data,m_main_ram_seg + m_dsp_addr_w));
r18027r18028
10198{
10299   /* DSP can read data from main CPU RAM via DSP IO port 1 */
103100
104   address_space *mainspace;
105101   UINT16 input_data = 0;
106102   switch (m_main_ram_seg) {
107103      case 0x7000:
108104      case 0x8000:
109      case 0xa000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
110                  input_data =  mainspace->read_byte(m_main_ram_seg + (m_dsp_addr_w + 0))
111                           | (mainspace->read_byte(m_main_ram_seg + (m_dsp_addr_w + 1)) << 8);
112                  break;
105      case 0xa000:   {address_space &mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
106                  input_data =  mainspace.read_byte(m_main_ram_seg + (m_dsp_addr_w + 0))
107                           | (mainspace.read_byte(m_main_ram_seg + (m_dsp_addr_w + 1)) << 8);
108                  break;}
113109      default:      logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break;
114110   }
115111   LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",space.device().safe_pcbase(),input_data,m_main_ram_seg + m_dsp_addr_w));
r18027r18028
118114
119115WRITE16_MEMBER(twincobr_state::wardner_dsp_w)
120116{
121   address_space *mainspace;
122
123117   /* Data written to main CPU RAM via DSP IO port 1 */
124118   m_dsp_execute = 0;
125119   switch (m_main_ram_seg) {
126120      case 0x7000:   if ((m_dsp_addr_w < 3) && (data == 0)) m_dsp_execute = 1;
127121      case 0x8000:
128      case 0xa000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
129                  mainspace->write_byte(m_main_ram_seg + (m_dsp_addr_w + 0), (data & 0xff));
130                  mainspace->write_byte(m_main_ram_seg + (m_dsp_addr_w + 1), ((data >> 8) & 0xff));
131                  break;
122      case 0xa000:   {address_space &mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
123                  mainspace.write_byte(m_main_ram_seg + (m_dsp_addr_w + 0), (data & 0xff));
124                  mainspace.write_byte(m_main_ram_seg + (m_dsp_addr_w + 1), ((data >> 8) & 0xff));
125                  break;}
132126      default:      logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break;
133127   }
134128   LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",space.device().safe_pcbase(),data,m_main_ram_seg + m_dsp_addr_w));
trunk/src/mame/machine/megasvp.c
r18027r18028
354354
355355   /* SVP stuff */
356356   state->m_dram = auto_alloc_array(machine, UINT8, 0x20000);
357   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x300000, 0x31ffff, state->m_dram);
358   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15000, 0xa150ff, FUNC(svp_68k_io_r), FUNC(svp_68k_io_w));
357   machine.device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x300000, 0x31ffff, state->m_dram);
358   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa15000, 0xa150ff, FUNC(svp_68k_io_r), FUNC(svp_68k_io_w));
359359   // "cell arrange" 1 and 2
360   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x390000, 0x39ffff, FUNC(svp_68k_cell1_r));
361   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3a0000, 0x3affff, FUNC(svp_68k_cell2_r));
360   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x390000, 0x39ffff, FUNC(svp_68k_cell1_r));
361   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x3a0000, 0x3affff, FUNC(svp_68k_cell2_r));
362362
363   machine.device("svp")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x438, 0x438, FUNC(svp_speedup_r));
363   machine.device("svp")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x438, 0x438, FUNC(svp_speedup_r));
364364
365365   state->m_iram = auto_alloc_array(machine, UINT8, 0x800);
366366   state->membank("bank3")->set_base(state->m_iram);
trunk/src/mame/machine/neoboot.c
r18027r18028
178178
179179void install_kof10th_protection ( running_machine &machine )
180180{
181   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x2fe000, 0x2fffff, FUNC(kof10th_RAMB_r));
182   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x200000, 0x23ffff, FUNC(kof10th_custom_w));
183   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x240000, 0x2fffff, FUNC(kof10th_bankswitch_w));
181   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe000, 0x2fffff, FUNC(kof10th_RAMB_r));
182   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x200000, 0x23ffff, FUNC(kof10th_custom_w));
183   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x240000, 0x2fffff, FUNC(kof10th_bankswitch_w));
184184}
185185
186186void decrypt_kof10th(running_machine &machine)
r18027r18028
485485   UINT16 *mem16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
486486
487487   /* special ROM banking handler */
488   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2ffff0, 0x2fffff, FUNC(cthd2003_bankswitch_w));
488   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2ffff0, 0x2fffff, FUNC(cthd2003_bankswitch_w));
489489
490490   // theres still a problem on the character select screen but it seems to be related to cpu core timing issues,
491491   // overclocking the 68k prevents it.
r18027r18028
729729void install_ms5plus_protection(running_machine &machine)
730730{
731731   // special ROM banking handler / additional protection
732   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2ffff0, 0x2fffff,FUNC(mslug5_prot_r), FUNC(ms5plus_bankswitch_w));
732   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2ffff0, 0x2fffff,FUNC(mslug5_prot_r), FUNC(ms5plus_bankswitch_w));
733733}
734734
735735
r18027r18028
972972
973973void kf2k3bl_install_protection(running_machine &machine)
974974{
975    machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003_w) );
975    machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003_w) );
976976}
977977
978978
r18027r18028
10001000
10011001void kf2k3pl_install_protection(running_machine &machine)
10021002{
1003    machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003p_w) );
1003    machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003p_w) );
10041004}
10051005
10061006
r18027r18028
10311031
10321032void kf2k3upl_install_protection(running_machine &machine)
10331033{
1034    machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003_w) );
1034    machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(kof2003_r), FUNC(kof2003_w) );
10351035}
10361036
10371037
trunk/src/mame/machine/mega32x.c
r18027r18028
414414
415415READ16_MEMBER( sega_32x_device::_32x_dreq_common_r )
416416{
417   address_space* _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
417   address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
418418
419419   switch (offset)
420420   {
r18027r18028
430430         return m_dreq_size;
431431
432432      case 0x0a/2: // a15112 / 4012
433         if (&space == _68kspace)
433         if (&space == &_68kspace)
434434         {
435435            printf("attempting to READ FIFO with 68k!\n");
436436            return 0xffff;
r18027r18028
485485
486486WRITE16_MEMBER( sega_32x_device::_32x_dreq_common_w )
487487{
488   address_space* _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
488   address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
489489
490490   switch (offset)
491491   {
492492      case 0x00/2: // a15108 / 4008
493493      case 0x02/2: // a1510a / 400a
494         if (&space != _68kspace)
494         if (&space != &_68kspace)
495495         {
496496            printf("attempting to WRITE DREQ SRC with SH2!\n");
497497            return;
r18027r18028
506506
507507      case 0x04/2: // a1510c / 400c
508508      case 0x06/2: // a1510e / 400e
509         if (&space != _68kspace)
509         if (&space != &_68kspace)
510510         {
511511            printf("attempting to WRITE DREQ DST with SH2!\n");
512512            return;
r18027r18028
520520         break;
521521
522522      case 0x08/2: // a15110 / 4010
523         if (&space != _68kspace)
523         if (&space != &_68kspace)
524524         {
525525            printf("attempting to WRITE DREQ SIZE with SH2!\n");
526526            return;
r18027r18028
534534         break;
535535
536536      case 0x0a/2: // a15112 / 4012 - FIFO Write (68k only!)
537         if (&space != _68kspace)
537         if (&space != &_68kspace)
538538         {
539539            printf("attempting to WRITE FIFO with SH2!\n");
540540            return;
r18027r18028
688688
689689
690690
691         space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector
691         space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector
692692      }
693693      else
694694      {
695695         m_32x_adapter_enabled = 0;
696696
697697         space.install_rom(0x0000000, 0x03fffff, space.machine().root_device().memregion("gamecart")->base());
698         space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector
698         space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector
699699      }
700700   }
701701
r18027r18028
10631063{
10641064   // what happens if the z80 accesses it, what authorization do we use? which address space do we get?? the z80 *can* write here and to the framebuffer via the window
10651065
1066   address_space* _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
1066   address_space& _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
10671067
1068   if (&space!= _68kspace)
1068   if (&space!= &_68kspace)
10691069   {
10701070      if (m_32x_access_auth!=1)
10711071         return;
10721072   }
10731073
1074   if (&space== _68kspace)
1074   if (&space== &_68kspace)
10751075   {
10761076      if (m_32x_access_auth!=0)
10771077         return;
r18027r18028
18891889
18901890   if (m_32x_adapter_enabled == 0)
18911891   {
1892      machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_rom(0x0000000, 0x03fffff, machine().root_device().memregion(":gamecart")->base());
1893      machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector
1892      machine().device(":maincpu")->memory().space(AS_PROGRAM).install_rom(0x0000000, 0x03fffff, machine().root_device().memregion(":gamecart")->base());
1893      machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_hint_vector_w),this)); // h interrupt vector
18941894   };
18951895
18961896
18971897   m_a15100_reg = 0x0000;
1898   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15100, 0xa15101, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_w),this)); // framebuffer control regs
1899   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15102, 0xa15103, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_w),this)); // send irq to sh2
1900   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15104, 0xa15105, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_w),this)); // 68k BANK rom set
1901   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15106, 0xa15107, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_w),this)); // dreq stuff
1902   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15108, 0xa15113, read16_delegate(FUNC(sega_32x_device::_32x_dreq_common_r),this), write16_delegate(FUNC(sega_32x_device::_32x_dreq_common_w),this)); // dreq src / dst / length /fifo
1898   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15100, 0xa15101, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_w),this)); // framebuffer control regs
1899   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15102, 0xa15103, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_w),this)); // send irq to sh2
1900   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15104, 0xa15105, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_w),this)); // 68k BANK rom set
1901   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15106, 0xa15107, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_w),this)); // dreq stuff
1902   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15108, 0xa15113, read16_delegate(FUNC(sega_32x_device::_32x_dreq_common_r),this), write16_delegate(FUNC(sega_32x_device::_32x_dreq_common_w),this)); // dreq src / dst / length /fifo
19031903
1904   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa1511a, 0xa1511b, read16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_w),this)); // SEGA TV
1904   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa1511a, 0xa1511b, read16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_w),this)); // SEGA TV
19051905
1906   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15120, 0xa1512f, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_w),this)); // comms reg 0-7
1907   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15130, 0xa1513f, read16_delegate(FUNC(sega_32x_device::_32x_pwm_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_pwm_w),this));
1906   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15120, 0xa1512f, read16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_m_commsram_w),this)); // comms reg 0-7
1907   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa15130, 0xa1513f, read16_delegate(FUNC(sega_32x_device::_32x_pwm_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_pwm_w),this));
19081908
1909   machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0a130ec, 0x0a130ef, read16_delegate(FUNC(sega_32x_device::_32x_68k_MARS_r),this)); // system ID
1909   machine().device(":maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0a130ec, 0x0a130ef, read16_delegate(FUNC(sega_32x_device::_32x_68k_MARS_r),this)); // system ID
19101910
19111911
19121912
trunk/src/mame/machine/midtunit.c
r18027r18028
445445   init_tunit_generic(machine(), SOUND_ADPCM);
446446
447447   /* protection */
448   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x1b00000, 0x1b6ffff, read16_delegate(FUNC(midtunit_state::mk_prot_r),this), write16_delegate(FUNC(midtunit_state::mk_prot_w),this));
448   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b00000, 0x1b6ffff, read16_delegate(FUNC(midtunit_state::mk_prot_r),this), write16_delegate(FUNC(midtunit_state::mk_prot_w),this));
449449
450450   /* sound chip protection (hidden RAM) */
451   machine().device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_ram(0xfb9c, 0xfbc6);
451   machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(0xfb9c, 0xfbc6);
452452}
453453
454454DRIVER_INIT_MEMBER(midtunit_state,mkturbo)
455455{
456456   /* protection */
457   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfffff400, 0xfffff40f, read16_delegate(FUNC(midtunit_state::mkturbo_prot_r),this));
457   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfffff400, 0xfffff40f, read16_delegate(FUNC(midtunit_state::mkturbo_prot_r),this));
458458
459459   DRIVER_INIT_CALL(mktunit);
460460}
r18027r18028
469469   if (!te_protection)
470470   {
471471      nbajam_prot_table = nbajam_prot_values;
472      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x1b14020, 0x1b2503f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state));
472      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b14020, 0x1b2503f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state));
473473   }
474474   else
475475   {
476476      nbajam_prot_table = nbajamte_prot_values;
477      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x1b15f40, 0x1b37f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state));
478      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x1b95f40, 0x1bb7f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state));
477      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b15f40, 0x1b37f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state));
478      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b95f40, 0x1bb7f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),state), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),state));
479479   }
480480
481481   /* sound chip protection (hidden RAM) */
482482   if (!te_protection)
483      machine.device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_ram(0xfbaa, 0xfbd4);
483      machine.device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(0xfbaa, 0xfbd4);
484484   else
485      machine.device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_ram(0xfbec, 0xfc16);
485      machine.device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(0xfbec, 0xfc16);
486486}
487487
488488DRIVER_INIT_MEMBER(midtunit_state,nbajam)
r18027r18028
501501   init_tunit_generic(machine(), SOUND_ADPCM_LARGE);
502502
503503   /* looks like the watchdog needs to be disabled */
504   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x01d81060, 0x01d8107f);
504   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x01d81060, 0x01d8107f);
505505
506506   /* protection */
507   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x1b00000, 0x1bfffff, read16_delegate(FUNC(midtunit_state::jdredd_prot_r),this), write16_delegate(FUNC(midtunit_state::jdredd_prot_w),this));
507   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1b00000, 0x1bfffff, read16_delegate(FUNC(midtunit_state::jdredd_prot_r),this), write16_delegate(FUNC(midtunit_state::jdredd_prot_w),this));
508508
509509   /* sound chip protection (hidden RAM) */
510   machine().device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_read_bank(0xfbcf, 0xfbf9, "bank7");
511   machine().device("adpcm:cpu")->memory().space(AS_PROGRAM)->install_write_bank(0xfbcf, 0xfbf9, "bank9");
510   machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_read_bank(0xfbcf, 0xfbf9, "bank7");
511   machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_write_bank(0xfbcf, 0xfbf9, "bank9");
512512   membank("adpcm:bank9")->set_base(auto_alloc_array(machine(), UINT8, 0x80));
513513
514514#if ENABLE_ALL_JDREDD_LEVELS
515515   /* how about the final levels? */
516   jdredd_hack = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xFFBA7FF0, 0xFFBA7FFf, FUNC(jdredd_hack_r));
516   jdredd_hack = machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xFFBA7FF0, 0xFFBA7FFf, FUNC(jdredd_hack_r));
517517#endif
518518}
519519
r18027r18028
534534   midtunit_gfx_rom_large = 1;
535535
536536   /* protection */
537   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00f20c60, 0x00f20c7f, write16_delegate(FUNC(midtunit_state::mk2_prot_w),this));
538   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00f42820, 0x00f4283f, write16_delegate(FUNC(midtunit_state::mk2_prot_w),this));
539   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01a190e0, 0x01a190ff, read16_delegate(FUNC(midtunit_state::mk2_prot_r),this));
540   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01a191c0, 0x01a191df, read16_delegate(FUNC(midtunit_state::mk2_prot_shift_r),this));
541   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01a3d0c0, 0x01a3d0ff, read16_delegate(FUNC(midtunit_state::mk2_prot_r),this));
542   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01d9d1e0, 0x01d9d1ff, read16_delegate(FUNC(midtunit_state::mk2_prot_const_r),this));
543   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01def920, 0x01def93f, read16_delegate(FUNC(midtunit_state::mk2_prot_const_r),this));
537   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00f20c60, 0x00f20c7f, write16_delegate(FUNC(midtunit_state::mk2_prot_w),this));
538   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00f42820, 0x00f4283f, write16_delegate(FUNC(midtunit_state::mk2_prot_w),this));
539   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01a190e0, 0x01a190ff, read16_delegate(FUNC(midtunit_state::mk2_prot_r),this));
540   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01a191c0, 0x01a191df, read16_delegate(FUNC(midtunit_state::mk2_prot_shift_r),this));
541   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01a3d0c0, 0x01a3d0ff, read16_delegate(FUNC(midtunit_state::mk2_prot_r),this));
542   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01d9d1e0, 0x01d9d1ff, read16_delegate(FUNC(midtunit_state::mk2_prot_const_r),this));
543   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01def920, 0x01def93f, read16_delegate(FUNC(midtunit_state::mk2_prot_const_r),this));
544544}
545545
546546
trunk/src/mame/machine/konami1.c
r18027r18028
4242
4343UINT8 *konami1_decode(running_machine &machine, const char *cpu)
4444{
45   address_space &space = *machine.device(cpu)->memory().space(AS_PROGRAM);
45   address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM);
4646   const UINT8 *rom = machine.root_device().memregion(cpu)->base();
4747   int size = machine.root_device().memregion(cpu)->bytes();
4848   int A;
trunk/src/mame/machine/namcos1.c
r18027r18028
672672      "bank9", "bank10", "bank11", "bank12", "bank13", "bank14", "bank15", "bank16"
673673   };
674674   static const char *const cputags[] = { "maincpu", "sub" };
675   address_space &space = *machine.device(cputags[(banknum >> 3) & 1])->memory().space(AS_PROGRAM);
675   address_space &space = machine.device(cputags[(banknum >> 3) & 1])->memory().space(AS_PROGRAM);
676676   int bankstart = (banknum & 7) * 0x2000;
677677
678678   /* for BANK handlers , memory direct and OP-code base */
r18027r18028
12161216   };
12171217   namcos1_driver_init(machine(), &tankfrce_specific);
12181218
1219   machine().device("mcu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1400, 0x1401, FUNC(faceoff_inputs_r));
1219   machine().device("mcu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x1400, 0x1401, FUNC(faceoff_inputs_r));
12201220}
12211221
12221222/*******************************************************************************
r18027r18028
13071307DRIVER_INIT_MEMBER(namcos1_state,quester)
13081308{
13091309   namcos1_driver_init(machine(), NULL);
1310   machine().device("mcu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1400, 0x1401, FUNC(quester_paddle_r));
1310   machine().device("mcu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x1400, 0x1401, FUNC(quester_paddle_r));
13111311}
13121312
13131313
r18027r18028
13961396DRIVER_INIT_MEMBER(namcos1_state,berabohm)
13971397{
13981398   namcos1_driver_init(machine(), NULL);
1399   machine().device("mcu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1400, 0x1401, FUNC(berabohm_buttons_r));
1399   machine().device("mcu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x1400, 0x1401, FUNC(berabohm_buttons_r));
14001400}
14011401
14021402
r18027r18028
14661466DRIVER_INIT_MEMBER(namcos1_state,faceoff)
14671467{
14681468   namcos1_driver_init(machine(), NULL);
1469   machine().device("mcu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1400, 0x1401, FUNC(faceoff_inputs_r));
1469   machine().device("mcu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x1400, 0x1401, FUNC(faceoff_inputs_r));
14701470}
trunk/src/mame/machine/pgmprot1.c
r18027r18028
286286   pgm_photoy2k_decrypt(machine());
287287   pgm_arm7_type1_latch_init(machine());
288288   /* we only have a china internal ROM dumped for now.. allow region to be changed for debugging (to ensure all alt titles / regions can be seen) */
289   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
289   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
290290}
291291
292292DRIVER_INIT_MEMBER(pgm_arm_type1_state,kovsh)
r18027r18028
295295   pgm_kovsh_decrypt(machine());
296296   pgm_arm7_type1_latch_init(machine());
297297   /* we only have a china internal ROM dumped for now.. allow region to be changed for debugging (to ensure all alt titles / regions can be seen) */
298   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
298   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
299299}
300300
301301/* Fake remapping of ASIC commands to the ones used by KOVSH due to the lack of the real ARM rom for this set */
r18027r18028
365365   pgm_basic_init(machine());
366366   pgm_kovshp_decrypt(machine());
367367   pgm_arm7_type1_latch_init(machine());
368   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
369   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
368   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
369   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
370370}
371371
372372
r18027r18028
378378   pgm_basic_init(machine());
379379//  pgm_kovshp_decrypt(machine());
380380   pgm_arm7_type1_latch_init(machine());
381   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
382   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
381   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
382   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
383383}
384384
385385static void pgm_decode_kovlsqh2_tiles( running_machine &machine )
r18027r18028
483483   pgm_decode_kovlsqh2_samples(machine());
484484   pgm_basic_init(machine());
485485   pgm_arm7_type1_latch_init(machine());
486   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
487   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
486   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
487   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x500000, 0x500005, FUNC(kovshp_asic27a_write_word));
488488}
489489
490490DRIVER_INIT_MEMBER(pgm_arm_type1_state,kovqhsgs)
r18027r18028
505505   pgm_basic_init(machine());
506506   pgm_arm7_type1_latch_init(machine());
507507   /* we only have a china internal ROM dumped for now.. allow region to be changed for debugging (to ensure all alt titles / regions can be seen) */
508   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
508   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0008, 0x4f0009, FUNC(kovsh_fake_region_r));
509509}
510510
511511/*
r18027r18028
14121412   pgm_basic_init(machine(), false);
14131413   pgm_py2k2_decrypt(machine()); // yes, it's the same as photo y2k2
14141414   arm_sim_handler = command_handler_ddp3;
1415   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1415   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
14161416}
14171417
14181418DRIVER_INIT_MEMBER(pgm_arm_type1_state,ket)
r18027r18028
14201420   pgm_basic_init(machine(), false);
14211421   pgm_ket_decrypt(machine());
14221422   arm_sim_handler = command_handler_ddp3;
1423   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x400000, 0x400005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1423   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x400000, 0x400005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
14241424}
14251425
14261426DRIVER_INIT_MEMBER(pgm_arm_type1_state,espgal)
r18027r18028
14281428   pgm_basic_init(machine(), false);
14291429   pgm_espgal_decrypt(machine());
14301430   arm_sim_handler = command_handler_ddp3;
1431   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x400000, 0x400005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1431   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x400000, 0x400005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
14321432}
14331433
14341434DRIVER_INIT_MEMBER(pgm_arm_type1_state,puzzli2)
r18027r18028
14361436   pgm_basic_init(machine());
14371437   pgm_puzzli2_decrypt(machine());
14381438   arm_sim_handler = command_handler_puzzli2;
1439   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1440   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
1439   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1440   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
14411441   m_irq4_disabled = 1; // // doesn't like this irq??
14421442}
14431443
r18027r18028
14461446   pgm_basic_init(machine());
14471447   pgm_py2k2_decrypt(machine());
14481448   arm_sim_handler = command_handler_py2k2;
1449   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1450   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
1449   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1450   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
14511451}
14521452
14531453DRIVER_INIT_MEMBER(pgm_arm_type1_state,pstar)
r18027r18028
14651465   memset(m_slots, 0, 16 * sizeof(UINT32));
14661466
14671467   arm_sim_handler = command_handler_pstars;
1468   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1469   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pstars_arm7_type1_sim_protram_r));
1468   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1469   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pstars_arm7_type1_sim_protram_r));
14701470
14711471   save_item(NAME(m_pstar_e7_value));
14721472   save_item(NAME(m_pstar_b1_value));
r18027r18028
14841484   m_kov_cb_value = 0;
14851485   m_kov_fe_value = 0;
14861486   arm_sim_handler = command_handler_kov;
1487   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1488   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
1487   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1488   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
14891489}
14901490
14911491DRIVER_INIT_MEMBER(pgm_arm_type1_state,kovboot)
r18027r18028
14981498   m_kov_cb_value = 0;
14991499   m_kov_fe_value = 0;
15001500   arm_sim_handler = command_handler_kov;
1501   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1502   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
1501   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1502   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
15031503
15041504}
15051505
r18027r18028
15111511   memset(m_extra_ram, 0, 0x100 * sizeof(UINT16));
15121512   memset(m_slots, 0, 0x100 * sizeof(UINT32));
15131513   arm_sim_handler = command_handler_oldsplus;
1514   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1515   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
1514   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x500000, 0x500005, FUNC(pgm_arm7_type1_sim_r), FUNC(pgm_arm7_type1_sim_w));
1515   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f0000, 0x4f003f, FUNC(pgm_arm7_type1_sim_protram_r));
15161516   state_save_register_global_array(machine(), m_extra_ram);
15171517   state_save_register_global_array(machine(), m_slots);
15181518}
trunk/src/mame/machine/balsente.c
r18027r18028
137137
138138void balsente_state::machine_reset()
139139{
140   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
140   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
141141   int numbanks;
142142
143143   /* reset counters; counter 2's gate is tied high */
trunk/src/mame/machine/megadriv.c
r18027r18028
800800//   z80 area of the 68k if games misbehave
801801static READ8_HANDLER( z80_read_68k_banked_data )
802802{
803   address_space *space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
804   UINT8 ret = space68k->read_byte(genz80.z80_bank_addr+offset);
803   address_space &space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
804   UINT8 ret = space68k.read_byte(genz80.z80_bank_addr+offset);
805805   return ret;
806806}
807807
808808static WRITE8_HANDLER( z80_write_68k_banked_data )
809809{
810   address_space *space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
811   space68k->write_byte(genz80.z80_bank_addr+offset,data);
810   address_space &space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
811   space68k.write_byte(genz80.z80_bank_addr+offset,data);
812812}
813813
814814
r18027r18028
15111511   device_t *ym = machine.device("ymsnd");
15121512
15131513   /* INIT THE PORTS *********************************************************************************************/
1514   machine.device(tag)->memory().space(AS_IO)->install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_port_r), FUNC(z80_unmapped_port_w));
1514   machine.device(tag)->memory().space(AS_IO).install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_port_r), FUNC(z80_unmapped_port_w));
15151515
15161516   /* catch any addresses that don't get mapped */
1517   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_r), FUNC(z80_unmapped_w));
1517   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_r), FUNC(z80_unmapped_w));
15181518
15191519
1520   machine.device(tag)->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, 0x1fff, "bank1");
1520   machine.device(tag)->memory().space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x1fff, "bank1");
15211521   machine.root_device().membank("bank1")->set_base(genz80.z80_prgram );
15221522
1523   machine.device(tag)->memory().space(AS_PROGRAM)->install_ram(0x0000, 0x1fff, genz80.z80_prgram);
1523   machine.device(tag)->memory().space(AS_PROGRAM).install_ram(0x0000, 0x1fff, genz80.z80_prgram);
15241524
15251525
1526   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*ym, 0x4000, 0x4003, FUNC(ym2612_r), FUNC(ym2612_w));
1527   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_write_handler    (0x6000, 0x6000, FUNC(megadriv_z80_z80_bank_w));
1528   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_write_handler    (0x6001, 0x6001, FUNC(megadriv_z80_z80_bank_w));
1529   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_read_handler     (0x6100, 0x7eff, FUNC(megadriv_z80_unmapped_read));
1530   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x7f00, 0x7fff, FUNC(megadriv_z80_vdp_read), FUNC(megadriv_z80_vdp_write));
1531   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x8000, 0xffff, FUNC(z80_read_68k_banked_data), FUNC(z80_write_68k_banked_data));
1526   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*ym, 0x4000, 0x4003, FUNC(ym2612_r), FUNC(ym2612_w));
1527   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_write_handler    (0x6000, 0x6000, FUNC(megadriv_z80_z80_bank_w));
1528   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_write_handler    (0x6001, 0x6001, FUNC(megadriv_z80_z80_bank_w));
1529   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_read_handler     (0x6100, 0x7eff, FUNC(megadriv_z80_unmapped_read));
1530   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7f00, 0x7fff, FUNC(megadriv_z80_vdp_read), FUNC(megadriv_z80_vdp_write));
1531   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x8000, 0xffff, FUNC(z80_read_68k_banked_data), FUNC(z80_write_68k_banked_data));
15321532}
15331533
15341534
trunk/src/mame/machine/vsnes.c
r18027r18028
186186
187187MACHINE_START_MEMBER(vsnes_state,vsnes)
188188{
189   address_space *ppu1_space = machine().device("ppu1")->memory().space(AS_PROGRAM);
189   address_space &ppu1_space = machine().device("ppu1")->memory().space(AS_PROGRAM);
190190   int i;
191191
192192   /* establish nametable ram */
r18027r18028
197197   m_nt_page[0][2] = m_nt_ram[0] + 0x800;
198198   m_nt_page[0][3] = m_nt_ram[0] + 0xc00;
199199
200   ppu1_space->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt0_r),this), write8_delegate(FUNC(vsnes_state::vsnes_nt0_w),this));
200   ppu1_space.install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt0_r),this), write8_delegate(FUNC(vsnes_state::vsnes_nt0_w),this));
201201
202202   m_vrom[0] = memregion("gfx1")->base();
203203   m_vrom_size[0] = memregion("gfx1")->bytes();
r18027r18028
210210   {
211211      for (i = 0; i < 8; i++)
212212      {
213         ppu1_space->install_read_bank(0x0400 * i, 0x0400 * i + 0x03ff, chr_banknames[i]);
213         ppu1_space.install_read_bank(0x0400 * i, 0x0400 * i + 0x03ff, chr_banknames[i]);
214214         membank(chr_banknames[i])->configure_entries(0, m_vrom_banks, m_vrom[0], 0x400);
215215      }
216216      v_set_videorom_bank(machine(), 0, 8, 0);
217217   }
218218   else
219219   {
220      ppu1_space->install_ram(0x0000, 0x1fff, m_vram);
220      ppu1_space.install_ram(0x0000, 0x1fff, m_vram);
221221   }
222222}
223223
r18027r18028
241241   m_nt_page[1][2] = m_nt_ram[1] + 0x800;
242242   m_nt_page[1][3] = m_nt_ram[1] + 0xc00;
243243
244   machine().device("ppu1")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt0_r),this), write8_delegate(FUNC(vsnes_state::vsnes_nt0_w),this));
245   machine().device("ppu2")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt1_r),this), write8_delegate(FUNC(vsnes_state::vsnes_nt1_w),this));
244   machine().device("ppu1")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt0_r),this), write8_delegate(FUNC(vsnes_state::vsnes_nt0_w),this));
245   machine().device("ppu2")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(vsnes_state::vsnes_nt1_r),this), write8_delegate(FUNC(vsnes_state::vsnes_nt1_w),this));
246246   // read only!
247   machine().device("ppu1")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank2");
247   machine().device("ppu1")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "bank2");
248248   // read only!
249   machine().device("ppu2")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank3");
249   machine().device("ppu2")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "bank3");
250250   membank("bank2")->configure_entries(0, m_vrom_size[0] / 0x2000, m_vrom[0], 0x2000);
251251   membank("bank3")->configure_entries(0, m_vrom_size[1] / 0x2000, m_vrom[1], 0x2000);
252252   membank("bank2")->set_entry(0);
r18027r18028
339339DRIVER_INIT_MEMBER(vsnes_state,vsnormal)
340340{
341341   /* vrom switching is enabled with bit 2 of $4016 */
342   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(vsnes_state::vsnormal_vrom_banking),this));
342   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(vsnes_state::vsnormal_vrom_banking),this));
343343}
344344
345345/**********************************************************************************/
r18027r18028
395395DRIVER_INIT_MEMBER(vsnes_state,vsgun)
396396{
397397   /* VROM switching is enabled with bit 2 of $4016 */
398   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x4016, 0x4016, read8_delegate(FUNC(vsnes_state::gun_in0_r),this), write8_delegate(FUNC(vsnes_state::gun_in0_w),this));
398   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x4016, 0x4016, read8_delegate(FUNC(vsnes_state::gun_in0_r),this), write8_delegate(FUNC(vsnes_state::gun_in0_w),this));
399399   m_do_vrom_bank = 1;
400400}
401401
r18027r18028
436436   memcpy(&prg[0x08000], &prg[0x18000], 0x8000);
437437
438438   /* banking is done with writes to the $8000-$ffff area */
439   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::vskonami_rom_banking),this));
439   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::vskonami_rom_banking),this));
440440}
441441
442442/***********************************************************************/
r18027r18028
463463   memcpy (&prg[0x08000], &prg[0x12000], 0x2000);
464464
465465   /* vrom switching is enabled with bit 2 of $4016 */
466   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x4016, 0x4016, read8_delegate(FUNC(vsnes_state::gun_in0_r),this), write8_delegate(FUNC(vsnes_state::vsgshoe_gun_in0_w),this));
466   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x4016, 0x4016, read8_delegate(FUNC(vsnes_state::gun_in0_r),this), write8_delegate(FUNC(vsnes_state::vsgshoe_gun_in0_w),this));
467467
468468   m_do_vrom_bank = 1;
469469}
r18027r18028
592592   memcpy(&prg[0x0c000], &prg[0x1c000], 0x4000);
593593
594594   /* MMC1 mapper at writes to $8000-$ffff */
595   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::drmario_rom_banking),this));
595   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::drmario_rom_banking),this));
596596
597597   m_drmario_shiftreg = 0;
598598   m_drmario_shiftcount = 0;
r18027r18028
616616   memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
617617
618618   /* banking is done with writes to the $8000-$ffff area */
619   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::vsvram_rom_banking),this));
619   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::vsvram_rom_banking),this));
620620
621621   /* allocate m_vram */
622622   m_vram = auto_alloc_array(machine(), UINT8, 0x2000);
r18027r18028
778778   memcpy(&prg[0xe000], &prg[(MMC3_prg_chunks - 1) * 0x4000 + 0x12000], 0x2000);
779779
780780   /* MMC3 mapper at writes to $8000-$ffff */
781   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::mapper4_w),this));
781   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::mapper4_w),this));
782782
783783   /* extra ram at $6000-$7fff */
784   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff);
784   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff);
785785}
786786
787787/* Vs. RBI Baseball */
r18027r18028
818818   DRIVER_INIT_CALL(MMC3);
819819
820820   /* RBI Base ball hack */
821   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x5e00, 0x5e01, read8_delegate(FUNC(vsnes_state::rbi_hack_r),this)) ;
821   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x5e00, 0x5e01, read8_delegate(FUNC(vsnes_state::rbi_hack_r),this)) ;
822822}
823823
824824/* Vs. Super Xevious */
r18027r18028
865865   DRIVER_INIT_CALL(MMC3);
866866
867867   /* Vs. Super Xevious Protection */
868   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x54ff, 0x54ff, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_1_r),this));
869   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x5678, 0x5678, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_2_r),this));
870   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x578f, 0x578f, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_3_r),this));
871   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x5567, 0x5567, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_4_r),this));
868   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x54ff, 0x54ff, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_1_r),this));
869   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x5678, 0x5678, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_2_r),this));
870   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x578f, 0x578f, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_3_r),this));
871   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x5567, 0x5567, read8_delegate(FUNC(vsnes_state::supxevs_read_prot_4_r),this));
872872}
873873
874874/* Vs. TKO Boxing */
r18027r18028
897897   DRIVER_INIT_CALL(MMC3);
898898
899899   /* security device at $5e00-$5e01 */
900   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x5e00, 0x5e01, read8_delegate(FUNC(vsnes_state::tko_security_r),this));
900   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x5e00, 0x5e01, read8_delegate(FUNC(vsnes_state::tko_security_r),this));
901901}
902902
903903/* Vs. Freedom Force */
r18027r18028
906906{
907907   DRIVER_INIT_CALL(MMC3);
908908
909   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x4016, 0x4016, read8_delegate(FUNC(vsnes_state::gun_in0_r),this), write8_delegate(FUNC(vsnes_state::gun_in0_w),this));
909   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x4016, 0x4016, read8_delegate(FUNC(vsnes_state::gun_in0_r),this), write8_delegate(FUNC(vsnes_state::gun_in0_w),this));
910910
911911   m_do_vrom_bank = 0;
912912}
r18027r18028
956956   memcpy(&prg[0x08000], &prg[0x10000], 0x4000);
957957   memcpy(&prg[0x0c000], &prg[0x2c000], 0x4000);
958958
959   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::mapper68_rom_banking),this));
959   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(vsnes_state::mapper68_rom_banking),this));
960960}
961961
962962/**********************************************************************************/
r18027r18028
977977
978978DRIVER_INIT_MEMBER(vsnes_state,bnglngby)
979979{
980   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x0231, 0x0231, read8_delegate(FUNC(vsnes_state::set_bnglngby_irq_r),this), write8_delegate(FUNC(vsnes_state::set_bnglngby_irq_w),this));
980   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x0231, 0x0231, read8_delegate(FUNC(vsnes_state::set_bnglngby_irq_r),this), write8_delegate(FUNC(vsnes_state::set_bnglngby_irq_w),this));
981981
982982   /* extra ram */
983   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff);
983   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff);
984984
985985   m_ret = 0;
986986
r18027r18028
10121012   UINT8 *prg = machine().root_device().memregion("maincpu")->base();
10131013
10141014   /* vrom switching is enabled with bit 2 of $4016 */
1015   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(vsnes_state::vsdual_vrom_banking),this));
1016   machine().device("sub")->memory().space(AS_PROGRAM)->install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(vsnes_state::vsdual_vrom_banking),this));
1015   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(vsnes_state::vsdual_vrom_banking),this));
1016   machine().device("sub")->memory().space(AS_PROGRAM).install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(vsnes_state::vsdual_vrom_banking),this));
10171017
10181018   /* shared ram at $6000 */
1019   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff, &prg[0x6000]);
1020   machine().device("sub")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff, &prg[0x6000]);
1019   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff, &prg[0x6000]);
1020   machine().device("sub")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff, &prg[0x6000]);
10211021}
10221022
trunk/src/mame/machine/taitosj.c
r18027r18028
3636
3737void taitosj_state::machine_reset()
3838{
39   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
39   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4040   /* set the default ROM bank (many games only have one bank and */
4141   /* never write to the bank selector register) */
4242   taitosj_bankswitch_w(space, 0, 0);
r18027r18028
211211   }
212212   if (~data & 0x10)
213213   {
214      address_space *cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
214      address_space &cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
215215      LOG(("%04x: 68705 write %02x to address %04x\n",space.device().safe_pc(), m_portA_out, m_address));
216216
217      cpu0space->write_byte(m_address, m_portA_out);
217      cpu0space.write_byte(m_address, m_portA_out);
218218
219219      /* increase low 8 bits of latched address for burst writes */
220220      m_address = (m_address & 0xff00) | ((m_address + 1) & 0xff);
221221   }
222222   if (~data & 0x20)
223223   {
224      address_space *cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
225      m_portA_in = cpu0space->read_byte(m_address);
224      address_space &cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
225      m_portA_in = cpu0space.read_byte(m_address);
226226      LOG(("%04x: 68705 read %02x from address %04x\n", space.device().safe_pc(), m_portA_in, m_address));
227227   }
228228   if (~data & 0x40)
trunk/src/mame/machine/mc8123.c
r18027r18028
377377
378378void mc8123_decrypt_rom(running_machine &machine, const char *cpu, const char *keyrgn, const char *bankname, int numbanks)
379379{
380   address_space &space = *machine.device(cpu)->memory().space(AS_PROGRAM);
380   address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM);
381381   int fixed_length = numbanks == 1 ? 0xc000 : 0x8000;
382382   UINT8 *decrypted1 = auto_alloc_array(machine, UINT8, fixed_length);
383383   UINT8 *decrypted2 = numbanks > 1 ? auto_alloc_array(machine, UINT8, 0x4000 * numbanks) : 0;
trunk/src/mame/machine/amiga.c
r18027r18028
261261static void amiga_m68k_reset(device_t *device)
262262{
263263   amiga_state *state = device->machine().driver_data<amiga_state>();
264   address_space &space = *device->memory().space(AS_PROGRAM);
264   address_space &space = device->memory().space(AS_PROGRAM);
265265
266266   logerror("Executed RESET at PC=%06x\n", space.device().safe_pc());
267267
r18027r18028
318318   if (scanline == 0)
319319   {
320320      /* signal VBLANK IRQ */
321      amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_VERTB, 0xffff);
321      amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_VERTB, 0xffff);
322322
323323      /* clock the first CIA TOD */
324324      mos6526_tod_w(cia_0, 1);
r18027r18028
939939   CUSTOM_REG(REG_DMACON) &= ~0x4000;
940940
941941   /* signal an interrupt */
942   amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_BLIT, 0xffff);
942   amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_BLIT, 0xffff);
943943
944944   /* reset the blitter timer */
945945   state->m_blitter_timer->reset( );
r18027r18028
10941094
10951095void amiga_cia_0_irq(device_t *device, int state)
10961096{
1097   amiga_custom_w(*device->machine().device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_PORTS, 0xffff);
1097   amiga_custom_w(device->machine().device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_PORTS, 0xffff);
10981098}
10991099
11001100
11011101void amiga_cia_1_irq(device_t *device, int state)
11021102{
1103   amiga_custom_w(*device->machine().device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_EXTER, 0xffff);
1103   amiga_custom_w(device->machine().device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, (state ? 0x8000 : 0x0000) | INTENA_EXTER, 0xffff);
11041104}
11051105
11061106
r18027r18028
12491249   CUSTOM_REG(REG_SERDATR) |= 0x3000;
12501250
12511251   /* signal an interrupt */
1252   amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_TBE, 0xffff);
1252   amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_TBE, 0xffff);
12531253}
12541254
12551255
r18027r18028
15091509void amiga_serial_in_w(running_machine &machine, UINT16 data)
15101510{
15111511   amiga_state *state = machine.driver_data<amiga_state>();
1512   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1512   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
15131513   int mask = (CUSTOM_REG(REG_SERPER) & 0x8000) ? 0x1ff : 0xff;
15141514
15151515   /* copy the data to the low 8 bits of SERDATR and set RBF */
trunk/src/mame/machine/neoprot.c
r18027r18028
101101
102102   /* the protection involves reading and writing addresses in the */
103103   /* 0x2xxxxx range. There are several checks all around the code. */
104   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200000, 0x2fffff, FUNC(fatfury2_protection_16_r), FUNC(fatfury2_protection_16_w));
104   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x200000, 0x2fffff, FUNC(fatfury2_protection_16_r), FUNC(fatfury2_protection_16_w));
105105
106106   state->m_fatfury2_prot_data = 0;
107107
r18027r18028
146146{
147147   /* when 0x20aaaa contains 0x0090 (word) then 0x100 (normally the neogeo header) should return 0x00c200fd worked out using real hw */
148148
149   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x20aaaa, 0x20aaab, FUNC(kof98_prot_w));
149   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x20aaaa, 0x20aaab, FUNC(kof98_prot_w));
150150}
151151
152152
r18027r18028
405405   neogeo_state *state = machine.driver_data<neogeo_state>();
406406   state->save_item(NAME(state->m_neogeo_rng));
407407
408   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(addr1, addr1 + 1, FUNC(sma_random_r));
409   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(addr2, addr2 + 1, FUNC(sma_random_r));
408   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(addr1, addr1 + 1, FUNC(sma_random_r));
409   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(addr2, addr2 + 1, FUNC(sma_random_r));
410410}
411411
412412
413413void kof99_install_protection( running_machine &machine )
414414{
415   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2ffff0, 0x2ffff1, FUNC(kof99_bankswitch_w));
416   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
415   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2ffff0, 0x2ffff1, FUNC(kof99_bankswitch_w));
416   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
417417
418418   sma_install_random_read_handler(machine, 0x2ffff8, 0x2ffffa);
419419}
r18027r18028
421421
422422void garou_install_protection( running_machine &machine )
423423{
424   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2fffc0, 0x2fffc1, FUNC(garou_bankswitch_w));
425   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
424   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffc0, 0x2fffc1, FUNC(garou_bankswitch_w));
425   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
426426
427427   sma_install_random_read_handler(machine, 0x2fffcc, 0x2ffff0);
428428}
r18027r18028
430430
431431void garouh_install_protection( running_machine &machine )
432432{
433   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2fffc0, 0x2fffc1, FUNC(garouh_bankswitch_w));
434   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
433   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffc0, 0x2fffc1, FUNC(garouh_bankswitch_w));
434   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
435435
436436   sma_install_random_read_handler(machine, 0x2fffcc, 0x2ffff0);
437437}
r18027r18028
439439
440440void mslug3_install_protection( running_machine &machine )
441441{
442   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2fffe4, 0x2fffe5, FUNC(mslug3_bankswitch_w));
443   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
442   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffe4, 0x2fffe5, FUNC(mslug3_bankswitch_w));
443   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
444444
445445//  sma_install_random_read_handler(machine, 0x2ffff8, 0x2ffffa);
446446}
r18027r18028
448448
449449void kof2000_install_protection( running_machine &machine )
450450{
451   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x2fffec, 0x2fffed, FUNC(kof2000_bankswitch_w));
452   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
451   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x2fffec, 0x2fffed, FUNC(kof2000_bankswitch_w));
452   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x2fe446, 0x2fe447, FUNC(prot_9a37_r));
453453
454454   sma_install_random_read_handler(machine, 0x2fffd8, 0x2fffda);
455455}
r18027r18028
540540   state->m_pvc_cartridge_ram = auto_alloc_array(machine, UINT16, 0x2000 / 2);
541541   state->save_pointer(NAME(state->m_pvc_cartridge_ram), 0x2000 / 2);
542542
543   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(pvc_prot_r), FUNC(pvc_prot_w));
543   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2fe000, 0x2fffff, FUNC(pvc_prot_r), FUNC(pvc_prot_w));
544544}
trunk/src/mame/machine/midwunit.c
r18027r18028
221221DRIVER_INIT_MEMBER(midwunit_state,umk3)
222222{
223223   init_mk3_common(machine());
224   m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0106a060, 0x0106a09f, write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this));
224   m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f, write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this));
225225}
226226
227227DRIVER_INIT_MEMBER(midwunit_state,umk3r11)
228228{
229229   init_mk3_common(machine());
230   m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0106a060, 0x0106a09f,write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this));
230   m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f,write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this));
231231}
232232
233233
r18027r18028
312312   init_wunit_generic(machine());
313313
314314   /* enable I/O shuffling */
315   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01800000, 0x0180000f, write16_delegate(FUNC(midwunit_state::wwfmania_io_0_w),this));
315   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01800000, 0x0180000f, write16_delegate(FUNC(midwunit_state::wwfmania_io_0_w),this));
316316
317317   /* serial prefixes 430, 528 */
318318   midway_serial_pic_init(machine(), 528);
trunk/src/mame/machine/namcos2.c
r18027r18028
113113
114114MACHINE_RESET_MEMBER(namcos2_shared_state,namcos2)
115115{
116   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
116   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
117117   mFinalLapProtCount = 0;
118118   namcos2_mcu_analog_ctrl = 0;
119119   namcos2_mcu_analog_data = 0xaa;
trunk/src/mame/machine/pgmprot2.c
r18027r18028
188188   kov2_latch_init(machine());
189189
190190   // we only have a HK internal ROM dumped for now, allow us to override that for debugging purposes.
191   machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(kov2_arm_region_w));
191   machine().device("prot")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(kov2_arm_region_w));
192192}
193193
194194
r18027r18028
222222   mem8[0x1FFFFD] = 0x99;
223223
224224   // we only have a HK internal ROM dumped for now, allow us to override that for debugging purposes.
225   machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(kov2_arm_region_w));
225   machine().device("prot")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(kov2_arm_region_w));
226226}
227227
228228static WRITE32_HANDLER( martmast_arm_region_w )
r18027r18028
242242   kov2_latch_init(machine());
243243
244244   // we only have a USA / CHINA internal ROMs dumped for now, allow us to override that for debugging purposes.
245   machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(martmast_arm_region_w));
245   machine().device("prot")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x48000138, 0x4800013b, FUNC(martmast_arm_region_w));
246246}
247247
248248
r18027r18028
297297   kov2_latch_init(machine());
298298
299299   // we only have a Japan internal ROM dumped for now, allow us to override that for debugging purposes.
300   machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x48000000, 0x48000003, FUNC(ddp2_arm_region_w));
300   machine().device("prot")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x48000000, 0x48000003, FUNC(ddp2_arm_region_w));
301301
302   machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1800300c, 0x1800300f, FUNC(ddp2_speedup_r));
303   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x80ee54, 0x80ee55, FUNC(ddp2_main_speedup_r));
302   machine().device("prot")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x1800300c, 0x1800300f, FUNC(ddp2_speedup_r));
303   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x80ee54, 0x80ee55, FUNC(ddp2_main_speedup_r));
304304}
305305
306306
trunk/src/mame/machine/cclimber.c
r18027r18028
66
77static void cclimber_decode(running_machine &machine, const UINT8 convtable[8][16])
88{
9   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
9   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1010   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
1111   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
1212   int A;
trunk/src/mame/machine/tatsumi.c
r18027r18028
6666
6767READ16_MEMBER(tatsumi_state::apache3_v30_v20_r)
6868{
69   address_space *targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
69   address_space &targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
7070
7171   /* Each V20 byte maps to a V30 word */
7272   if ((m_control_word & 0xe0) == 0xe0)
r18027r18028
7777      offset += 0x00000; // main ram
7878   else
7979      logerror("%08x: unmapped read z80 rom %08x\n", space.device().safe_pc(), offset);
80   return 0xff00 | targetspace->read_byte(offset);
80   return 0xff00 | targetspace.read_byte(offset);
8181}
8282
8383WRITE16_MEMBER(tatsumi_state::apache3_v30_v20_w)
8484{
85   address_space *targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
85   address_space &targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
8686
8787   if ((m_control_word & 0xe0) != 0x80)
8888      logerror("%08x: write unmapped v30 rom %08x\n", space.device().safe_pc(), offset);
r18027r18028
9090   /* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */
9191   if (ACCESSING_BITS_0_7)
9292   {
93      targetspace->write_byte(offset, data & 0xff);
93      targetspace.write_byte(offset, data & 0xff);
9494   }
9595}
9696
r18027r18028
142142
143143READ16_MEMBER(tatsumi_state::roundup_v30_z80_r)
144144{
145   address_space *targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
145   address_space &targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
146146
147147   /* Each Z80 byte maps to a V30 word */
148148   if (m_control_word & 0x20)
149149      offset += 0x8000; /* Upper half */
150150
151   return 0xff00 | targetspace->read_byte(offset);
151   return 0xff00 | targetspace.read_byte(offset);
152152}
153153
154154WRITE16_MEMBER(tatsumi_state::roundup_v30_z80_w)
155155{
156   address_space *targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
156   address_space &targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
157157
158158   /* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */
159159   if (ACCESSING_BITS_0_7)
r18027r18028
161161      if (m_control_word & 0x20)
162162         offset += 0x8000; /* Upper half of Z80 address &space */
163163
164      targetspace->write_byte(offset, data & 0xff);
164      targetspace.write_byte(offset, data & 0xff);
165165   }
166166}
167167
trunk/src/mame/machine/segamsys.c
r18027r18028
14851485
14861486void init_extra_gg_ports(running_machine& machine, const char* tag)
14871487{
1488   address_space *io = machine.device(tag)->memory().space(AS_IO);
1489   io->install_legacy_read_handler     (0x00, 0x00, FUNC(sms_ioport_gg00_r));
1488   address_space &io = machine.device(tag)->memory().space(AS_IO);
1489   io.install_legacy_read_handler     (0x00, 0x00, FUNC(sms_ioport_gg00_r));
14901490}
14911491
14921492void init_smsgg(running_machine &machine)
r18027r18028
16481648{
16491649   /* INIT THE PORTS *********************************************************************************************/
16501650
1651   address_space *io = machine.device(tag)->memory().space(AS_IO);
1651   address_space &io = machine.device(tag)->memory().space(AS_IO);
16521652   device_t *sn = machine.device("snsnd");
16531653
1654   io->install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_port_r), FUNC(z80_unmapped_port_w));
1654   io.install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_port_r), FUNC(z80_unmapped_port_w));
16551655
1656   io->install_legacy_read_handler      (0x7e, 0x7e, FUNC(md_sms_vdp_vcounter_r));
1657   io->install_legacy_write_handler(*sn, 0x7e, 0x7f, FUNC(sn76496_w));
1658   io->install_legacy_readwrite_handler (0xbe, 0xbe, FUNC(md_sms_vdp_data_r), FUNC(md_sms_vdp_data_w));
1659   io->install_legacy_readwrite_handler (0xbf, 0xbf, FUNC(md_sms_vdp_ctrl_r), FUNC(md_sms_vdp_ctrl_w));
1656   io.install_legacy_read_handler      (0x7e, 0x7e, FUNC(md_sms_vdp_vcounter_r));
1657   io.install_legacy_write_handler(*sn, 0x7e, 0x7f, FUNC(sn76496_w));
1658   io.install_legacy_readwrite_handler (0xbe, 0xbe, FUNC(md_sms_vdp_data_r), FUNC(md_sms_vdp_data_w));
1659   io.install_legacy_readwrite_handler (0xbf, 0xbf, FUNC(md_sms_vdp_ctrl_r), FUNC(md_sms_vdp_ctrl_w));
16601660
1661   io->install_legacy_read_handler      (0x10, 0x10, FUNC(megatech_sms_ioport_dd_r)); // super tetris
1661   io.install_legacy_read_handler      (0x10, 0x10, FUNC(megatech_sms_ioport_dd_r)); // super tetris
16621662
1663   io->install_legacy_read_handler      (0xdc, 0xdc, FUNC(megatech_sms_ioport_dc_r));
1664   io->install_legacy_read_handler      (0xdd, 0xdd, FUNC(megatech_sms_ioport_dd_r));
1665   io->install_legacy_read_handler      (0xde, 0xde, FUNC(megatech_sms_ioport_dd_r));
1666   io->install_legacy_read_handler      (0xdf, 0xdf, FUNC(megatech_sms_ioport_dd_r)); // adams family
1663   io.install_legacy_read_handler      (0xdc, 0xdc, FUNC(megatech_sms_ioport_dc_r));
1664   io.install_legacy_read_handler      (0xdd, 0xdd, FUNC(megatech_sms_ioport_dd_r));
1665   io.install_legacy_read_handler      (0xde, 0xde, FUNC(megatech_sms_ioport_dd_r));
1666   io.install_legacy_read_handler      (0xdf, 0xdf, FUNC(megatech_sms_ioport_dd_r)); // adams family
16671667}
16681668
16691669void megatech_set_genz80_as_sms_standard_map(running_machine &machine, const char* tag, int mapper)
r18027r18028
16711671   /* INIT THE MEMMAP / BANKING *********************************************************************************/
16721672
16731673   /* catch any addresses that don't get mapped */
1674   machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_r), FUNC(z80_unmapped_w));
1674   machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x0000, 0xffff, FUNC(z80_unmapped_r), FUNC(z80_unmapped_w));
16751675
16761676   /* main ram area */
1677   sms_mainram = (UINT8 *)machine.device(tag)->memory().space(AS_PROGRAM)->install_ram(0xc000, 0xdfff, 0, 0x2000);
1677   sms_mainram = (UINT8 *)machine.device(tag)->memory().space(AS_PROGRAM).install_ram(0xc000, 0xdfff, 0, 0x2000);
16781678   memset(sms_mainram,0x00,0x2000);
16791679
16801680   megatech_set_genz80_as_sms_standard_ports(machine,  tag);
16811681
16821682   /* fixed rom bank area */
1683   sms_rom = (UINT8 *)machine.device(tag)->memory().space(AS_PROGRAM)->install_rom(0x0000, 0xbfff, NULL);
1683   sms_rom = (UINT8 *)machine.device(tag)->memory().space(AS_PROGRAM).install_rom(0x0000, 0xbfff, NULL);
16841684
16851685   memcpy(sms_rom, machine.root_device().memregion("maincpu")->base(), 0xc000);
16861686
r18027r18028
16881688   {
16891689
16901690
1691      machine.device(tag)->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xfffc, 0xffff, FUNC(mt_sms_standard_rom_bank_w));
1691      machine.device(tag)->memory().space(AS_PROGRAM).install_legacy_write_handler(0xfffc, 0xffff, FUNC(mt_sms_standard_rom_bank_w));
16921692
16931693   }
16941694   else if (mapper == MAPPER_CODEMASTERS )
16951695   {
1696      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0000, 0x0000, FUNC(codemasters_rom_bank_0000_w));
1697      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x4000, 0x4000, FUNC(codemasters_rom_bank_4000_w));
1698      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x8000, 0x8000, FUNC(codemasters_rom_bank_8000_w));
1696      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x0000, 0x0000, FUNC(codemasters_rom_bank_0000_w));
1697      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x4000, 0x4000, FUNC(codemasters_rom_bank_4000_w));
1698      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x8000, 0x8000, FUNC(codemasters_rom_bank_8000_w));
16991699   }
17001700//  smsgg_backupram = NULL;
17011701}
trunk/src/mame/machine/segacrpt.c
r18027r18028
217217{
218218   int A;
219219
220   address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM);
220   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
221221   int length = machine.root_device().memregion(cputag)->bytes();
222222   int cryptlen = MIN(length, 0x8000);
223223   UINT8 *rom = machine.root_device().memregion(cputag)->base();
r18027r18028
439439
440440   int A;
441441
442   address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM);
442   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
443443   UINT8 *rom = machine.root_device().memregion(regiontag)->base();
444444   int bankstart;
445445   decrypted = auto_alloc_array(machine, UINT8, 0x6000*3);
r18027r18028
797797
798798   int A;
799799
800   address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM);
800   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
801801   UINT8 *rom = machine.root_device().memregion(cputag)->base();
802802   decrypted = auto_alloc_array(machine, UINT8, 0x9000);
803803
trunk/src/mame/machine/megacd.c
r18027r18028
886886
887887void CDC_Do_DMA(running_machine& machine, int rate)
888888{
889   address_space& space = *machine.device(":segacd:segacd_68k")->memory().space(AS_PROGRAM);
889   address_space& space = machine.device(":segacd:segacd_68k")->memory().space(AS_PROGRAM);
890890
891891   UINT32 dstoffset, length;
892892   UINT8 *dest;
r18027r18028
23042304/* main CPU map set up in INIT */
23052305void segacd_init_main_cpu( running_machine& machine )
23062306{
2307   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2307   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
23082308   
23092309   segacd_font_bits = reinterpret_cast<UINT16 *>(machine.root_device().memshare(":segacd:segacd_font")->ptr());
23102310   segacd_backupram = reinterpret_cast<UINT16 *>(machine.root_device().memshare(":segacd:backupram")->ptr());
r18027r18028
23242324   segacd_wordram_mapped = 1;
23252325
23262326
2327   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200000, 0x23ffff, FUNC(segacd_main_dataram_part1_r), FUNC(segacd_main_dataram_part1_w)); // RAM shared with sub
2327   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x200000, 0x23ffff, FUNC(segacd_main_dataram_part1_r), FUNC(segacd_main_dataram_part1_w)); // RAM shared with sub
23282328
2329   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa12000, 0xa12001, FUNC(scd_a12000_halt_reset_r), FUNC(scd_a12000_halt_reset_w)); // sub-cpu control
2330   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa12002, 0xa12003, FUNC(scd_a12002_memory_mode_r), FUNC(scd_a12002_memory_mode_w)); // memory mode / write protect
2331   //space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa12004, 0xa12005, FUNC(segacd_cdc_mode_address_r), FUNC(segacd_cdc_mode_address_w));
2332   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa12006, 0xa12007, FUNC(scd_a12006_hint_register_r), FUNC(scd_a12006_hint_register_w)); // where HINT points on main CPU
2333   //space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler     (0xa12008, 0xa12009, FUNC(cdc_data_main_r));
2329   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa12000, 0xa12001, FUNC(scd_a12000_halt_reset_r), FUNC(scd_a12000_halt_reset_w)); // sub-cpu control
2330   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa12002, 0xa12003, FUNC(scd_a12002_memory_mode_r), FUNC(scd_a12002_memory_mode_w)); // memory mode / write protect
2331   //space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa12004, 0xa12005, FUNC(segacd_cdc_mode_address_r), FUNC(segacd_cdc_mode_address_w));
2332   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa12006, 0xa12007, FUNC(scd_a12006_hint_register_r), FUNC(scd_a12006_hint_register_w)); // where HINT points on main CPU
2333   //space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler     (0xa12008, 0xa12009, FUNC(cdc_data_main_r));
23342334
23352335
2336   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa1200c, 0xa1200d, FUNC(segacd_stopwatch_timer_r), FUNC(segacd_stopwatch_timer_w)); // starblad
2336   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa1200c, 0xa1200d, FUNC(segacd_stopwatch_timer_r), FUNC(segacd_stopwatch_timer_w)); // starblad
23372337
2338   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa1200e, 0xa1200f, FUNC(segacd_comms_flags_r), FUNC(segacd_comms_flags_maincpu_w)); // communication flags block
2338   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa1200e, 0xa1200f, FUNC(segacd_comms_flags_r), FUNC(segacd_comms_flags_maincpu_w)); // communication flags block
23392339
2340   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa12010, 0xa1201f, FUNC(segacd_comms_main_part1_r), FUNC(segacd_comms_main_part1_w));
2341   space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa12020, 0xa1202f, FUNC(segacd_comms_main_part2_r), FUNC(segacd_comms_main_part2_w));
2340   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa12010, 0xa1201f, FUNC(segacd_comms_main_part1_r), FUNC(segacd_comms_main_part1_w));
2341   space.machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa12020, 0xa1202f, FUNC(segacd_comms_main_part2_r), FUNC(segacd_comms_main_part2_w));
23422342
23432343
23442344
trunk/src/mame/machine/pgmprot.c
r18027r18028
150150{
151151   pgm_basic_init(machine());
152152
153   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xC0400e, 0xC0400f, FUNC(pgm_asic3_r), FUNC(pgm_asic3_w));
154   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xC04000, 0xC04001, FUNC(pgm_asic3_reg_w));
153   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xC0400e, 0xC0400f, FUNC(pgm_asic3_r), FUNC(pgm_asic3_w));
154   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xC04000, 0xC04001, FUNC(pgm_asic3_reg_w));
155155
156156   m_asic3_reg = 0;
157157   m_asic3_latch[0] = 0;
trunk/src/mame/machine/cx4oam.c
r18027r18028
4444   offset = (cx4.ram[0x626] & 3) * 2;
4545   srcptr = 0x220;
4646
47   address_space &space = *machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
47   address_space &space = machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
4848   for(i = cx4.ram[0x620]; i > 0 && sprcount > 0; i--, srcptr += 16)
4949   {
5050      UINT32 spraddr = CX4_readl(srcptr + 7);
trunk/src/mame/machine/mcr68.c
r18027r18028
288288WRITE_LINE_DEVICE_HANDLER( zwackery_ca2_w )
289289{
290290   mcr68_state *drvstate = device->machine().driver_data<mcr68_state>();
291   address_space &space = *device->machine().device("maincpu")->memory().space(AS_PROGRAM);
291   address_space &space = device->machine().device("maincpu")->memory().space(AS_PROGRAM);
292292   drvstate->m_chip_squeak_deluxe->write(space, 0, (state << 4) | drvstate->m_zwackery_sound_data);
293293}
294294
trunk/src/mame/machine/cps2crpt.c
r18027r18028
632632
633633static void cps2_decrypt(running_machine &machine, const UINT32 *master_key, UINT32 upper_limit)
634634{
635   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
635   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
636636   UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
637637   int length = machine.root_device().memregion("maincpu")->bytes();
638638   UINT16 *dec = auto_alloc_array(machine, UINT16, length/2);
trunk/src/mame/machine/pgmprot3.c
r18027r18028
293293   /* put some fake code for the ARM here ... */
294294   pgm_create_dummy_internal_arm_region(machine());
295295
296   machine().device("prot")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x18000444, 0x18000447, FUNC(dmnfrnt_speedup_r));
297   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x80a03c, 0x80a03d, FUNC(dmnfrnt_main_speedup_r));
296   machine().device("prot")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x18000444, 0x18000447, FUNC(dmnfrnt_speedup_r));
297   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x80a03c, 0x80a03d, FUNC(dmnfrnt_main_speedup_r));
298298
299299   m_svg_ram_sel = 1;
300300
trunk/src/mame/machine/megavdp.c
r18027r18028
204204   irq4_on_timer = machine().scheduler().timer_alloc(FUNC(irq4_on_timer_callback), (void*)this);
205205   megadriv_render_timer = machine().scheduler().timer_alloc(FUNC(megadriv_render_timer_callback), (void*)this);
206206
207   m_space68k = machine().device<legacy_cpu_device>(":maincpu")->space();
207   m_space68k = &machine().device<legacy_cpu_device>(":maincpu")->space();
208208   m_cpu68k = machine().device<legacy_cpu_device>(":maincpu");
209209}
210210
trunk/src/mame/machine/cd32.c
r18027r18028
174174   akiko_state *state = get_safe_token(device);
175175
176176   state->set_machine(machine);
177   state->m_space = machine.device("maincpu")->memory().space(AS_PROGRAM);
177   state->m_space = &machine.device("maincpu")->memory().space(AS_PROGRAM);
178178   state->m_c2p_input_index = 0;
179179   state->m_c2p_output_index = 0;
180180
trunk/src/mame/machine/micro3d.c
r18027r18028
605605
606606DRIVER_INIT_MEMBER(micro3d_state,micro3d)
607607{
608   address_space &space = *machine().device("drmath")->memory().space(AS_DATA);
608   address_space &space = machine().device("drmath")->memory().space(AS_DATA);
609609
610610   i8051_set_serial_tx_callback(machine().device("audiocpu"), data_from_i8031);
611611   i8051_set_serial_rx_callback(machine().device("audiocpu"), data_to_i8031);
r18027r18028
624624
625625DRIVER_INIT_MEMBER(micro3d_state,botss)
626626{
627   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
627   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
628628
629629   /* Required to pass the hardware version check */
630630   space.install_read_handler(0x140000, 0x140001, read16_delegate(FUNC(micro3d_state::botss_140000_r),this));
trunk/src/mame/machine/md_cart.c
r18027r18028
916916   image->battery_load(state->m_md_cart.sram, state->m_md_cart.sram_end - state->m_md_cart.sram_start + 1, 0xff); // Dino Dini's Soccer needs backup RAM to be 1fill
917917   memcpy(megadriv_backupram, state->m_md_cart.sram, state->m_md_cart.sram_end - state->m_md_cart.sram_start + 1);
918918
919   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(state->m_md_cart.sram_start & mask, state->m_md_cart.sram_end & mask, FUNC(genesis_sram_read));
920   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(state->m_md_cart.sram_start & mask, state->m_md_cart.sram_end & mask, FUNC(genesis_sram_write));
919   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(state->m_md_cart.sram_start & mask, state->m_md_cart.sram_end & mask, FUNC(genesis_sram_read));
920   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(state->m_md_cart.sram_start & mask, state->m_md_cart.sram_end & mask, FUNC(genesis_sram_write));
921921   state->m_md_cart.sram_handlers_installed = 1;
922922}
923923
r18027r18028
12451245      case CM_JCART:
12461246      case CM_JCART_SEPROM:
12471247         /* Codemasters PCB (J-Carts) */
1248         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x38fffe, 0x38ffff, FUNC(jcart_ctrl_r));
1249         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x38fffe, 0x38ffff, FUNC(jcart_ctrl_w));
1248         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x38fffe, 0x38ffff, FUNC(jcart_ctrl_r));
1249         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x38fffe, 0x38ffff, FUNC(jcart_ctrl_w));
12501250         break;
12511251
12521252      case SSF2:
r18027r18028
12541254         memcpy(&ROM[0x400000], &ROM[VIRGIN_COPY_GEN], 0x400000);
12551255         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x400000);
12561256
1257         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa130f0, 0xa130ff, FUNC(genesis_ssf2_bank_w));
1257         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa130f0, 0xa130ff, FUNC(genesis_ssf2_bank_w));
12581258         break;
12591259
12601260      case LIONK3:
r18027r18028
12631263         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x200000); /* default rom */
12641264         memcpy(&ROM[0x200000], &ROM[VIRGIN_COPY_GEN], 0x200000); /* default rom */
12651265
1266         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x600000, 0x6fffff, FUNC(l3alt_prot_r), FUNC(l3alt_prot_w));
1267         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x700000, 0x7fffff, FUNC(l3alt_bank_w));
1266         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x600000, 0x6fffff, FUNC(l3alt_prot_r), FUNC(l3alt_prot_w));
1267         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x700000, 0x7fffff, FUNC(l3alt_bank_w));
12681268         break;
12691269
12701270      case SDK99:
r18027r18028
12731273         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x300000); /* default rom */
12741274         memcpy(&ROM[0x300000], &ROM[VIRGIN_COPY_GEN], 0x100000); /* default rom */
12751275
1276         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x600000, 0x6fffff, FUNC(l3alt_prot_r), FUNC(l3alt_prot_w));
1277         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x700000, 0x7fffff, FUNC(l3alt_bank_w));
1276         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x600000, 0x6fffff, FUNC(l3alt_prot_r), FUNC(l3alt_prot_w));
1277         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x700000, 0x7fffff, FUNC(l3alt_bank_w));
12781278         break;
12791279
12801280      case REDCLIFF:
1281         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400001, FUNC(redclif_prot2_r));
1282         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400004, 0x400005, FUNC(redclif_prot_r));
1281         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400001, FUNC(redclif_prot2_r));
1282         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400004, 0x400005, FUNC(redclif_prot_r));
12831283         break;
12841284
12851285      case REDCL_EN:
r18027r18028
12871287            ROM[x] ^= 0x40;
12881288         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN + 4], 0x200000); /* default rom */
12891289
1290         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400001, FUNC(redclif_prot2_r));
1291         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400004, 0x400005, FUNC(redclif_prot_r));
1290         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400001, FUNC(redclif_prot2_r));
1291         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400004, 0x400005, FUNC(redclif_prot_r));
12921292         break;
12931293
12941294      case RADICA:
r18027r18028
12961296         memcpy(&ROM[0x400000], &ROM[VIRGIN_COPY_GEN], 0x400000); // keep a copy for later banking.. making use of huge ROM_REGION allocated to genesis driver
12971297         memcpy(&ROM[0x800000], &ROM[VIRGIN_COPY_GEN], 0x400000); // wraparound banking (from hazemd code)
12981298
1299         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa13000, 0xa1307f, FUNC(radica_bank_select));
1299         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa13000, 0xa1307f, FUNC(radica_bank_select));
13001300         break;
13011301
13021302      case KOF99:
13031303         //memcpy(&ROM[0x000000],&ROM[VIRGIN_COPY_GEN],0x300000);
1304         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa13000, 0xa13001, FUNC(kof99_A13000_r));
1305         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa13002, 0xa13003, FUNC(kof99_A13002_r));
1306         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa1303e, 0xa1303f, FUNC(kof99_00A1303E_r));
1304         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa13000, 0xa13001, FUNC(kof99_A13000_r));
1305         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa13002, 0xa13003, FUNC(kof99_A13002_r));
1306         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa1303e, 0xa1303f, FUNC(kof99_00A1303E_r));
13071307         break;
13081308
13091309      case SOULBLAD:
1310         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400002, 0x400003, FUNC(soulb_400002_r));
1311         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400004, 0x400005, FUNC(soulb_400004_r));
1312         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400006, 0x400007, FUNC(soulb_400006_r));
1310         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400002, 0x400003, FUNC(soulb_400002_r));
1311         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400004, 0x400005, FUNC(soulb_400004_r));
1312         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400006, 0x400007, FUNC(soulb_400006_r));
13131313         break;
13141314
13151315      case MJLOVER:
1316         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400001, FUNC(mjlovr_prot_1_r));
1317         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x401000, 0x401001, FUNC(mjlovr_prot_2_r));
1316         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400001, FUNC(mjlovr_prot_1_r));
1317         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x401000, 0x401001, FUNC(mjlovr_prot_2_r));
13181318         break;
13191319
13201320      case SQUIRRELK:
13211321         state->m_md_cart.squirrel_king_extra = 0;
1322         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400007, FUNC(squirrel_king_extra_r));
1323         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x400000, 0x400007, FUNC(squirrel_king_extra_w));
1322         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400007, FUNC(squirrel_king_extra_r));
1323         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x400000, 0x400007, FUNC(squirrel_king_extra_w));
13241324         break;
13251325
13261326      case SMOUSE:
1327         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400007, FUNC(smous_prot_r));
1327         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400007, FUNC(smous_prot_r));
13281328         break;
13291329
13301330      case SMB:
1331         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa13000, 0xa13001, FUNC(smbro_prot_r));
1331         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa13000, 0xa13001, FUNC(smbro_prot_r));
13321332         break;
13331333
13341334      case SMB2:
1335         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa13000, 0xa13001, FUNC(smb2_extra_r));
1335         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa13000, 0xa13001, FUNC(smb2_extra_r));
13361336         break;
13371337
13381338      case KAIJU:
r18027r18028
13401340         memcpy(&ROM[0x600000], &ROM[VIRGIN_COPY_GEN], 0x200000);
13411341         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x200000);
13421342
1343         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x700000, 0x7fffff, FUNC(kaiju_bank_w));
1343         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x700000, 0x7fffff, FUNC(kaiju_bank_w));
13441344         break;
13451345
13461346      case CHINFIGHT3:
r18027r18028
13481348         memcpy(&ROM[0x600000], &ROM[VIRGIN_COPY_GEN], 0x200000);
13491349         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x200000);
13501350
1351         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x4fffff, FUNC(chifi3_prot_r));
1352         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x600000, 0x6fffff, FUNC(chifi3_bank_w));
1351         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x4fffff, FUNC(chifi3_prot_r));
1352         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x600000, 0x6fffff, FUNC(chifi3_bank_w));
13531353         break;
13541354
13551355      case LIONK2:
13561356         state->m_md_cart.lion2_prot1_data = state->m_md_cart.lion2_prot2_data = 0;
13571357
1358         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400002, 0x400003, FUNC(lion2_prot1_r));
1359         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400006, 0x400007, FUNC(lion2_prot2_r));
1360         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x400000, 0x400001, FUNC(lion2_prot1_w));
1361         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x400004, 0x400005, FUNC(lion2_prot2_w));
1358         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400002, 0x400003, FUNC(lion2_prot1_r));
1359         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400006, 0x400007, FUNC(lion2_prot2_r));
1360         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x400000, 0x400001, FUNC(lion2_prot1_w));
1361         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x400004, 0x400005, FUNC(lion2_prot2_w));
13621362         break;
13631363
13641364      case BUGSLIFE:
1365         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa13000, 0xa13001, FUNC(bugl_extra_r));
1365         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa13000, 0xa13001, FUNC(bugl_extra_r));
13661366         break;
13671367
13681368      case ELFWOR:
13691369         /* It return (0x55 @ 0x400000 OR 0xc9 @ 0x400004) AND (0x0f @ 0x400002 OR 0x18 @ 0x400006). It is probably best to add handlers for all 4 addresses. */
1370         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400001, FUNC(elfwor_400000_r));
1371         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400002, 0x400003, FUNC(elfwor_400002_r));
1372         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400004, 0x400005, FUNC(elfwor_400004_r));
1373         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400006, 0x400007, FUNC(elfwor_400006_r));
1370         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400001, FUNC(elfwor_400000_r));
1371         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400002, 0x400003, FUNC(elfwor_400002_r));
1372         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400004, 0x400005, FUNC(elfwor_400004_r));
1373         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400006, 0x400007, FUNC(elfwor_400006_r));
13741374         break;
13751375
13761376      case ROCKMANX3:
1377         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa13000, 0xa13001, FUNC(rx3_extra_r));
1377         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa13000, 0xa13001, FUNC(rx3_extra_r));
13781378         break;
13791379
13801380      case SBUBBOB:
1381         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400001, FUNC(sbub_extra1_r));
1382         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400002, 0x400003, FUNC(sbub_extra2_r));
1381         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400001, FUNC(sbub_extra1_r));
1382         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400002, 0x400003, FUNC(sbub_extra2_r));
13831383         break;
13841384
13851385      case KOF98:
1386         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x480000, 0x480001, FUNC(kof98_aa_r));
1387         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4800e0, 0x4800e1, FUNC(kof98_aa_r));
1388         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4824a0, 0x4824a1, FUNC(kof98_aa_r));
1389         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x488880, 0x488881, FUNC(kof98_aa_r));
1386         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x480000, 0x480001, FUNC(kof98_aa_r));
1387         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4800e0, 0x4800e1, FUNC(kof98_aa_r));
1388         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4824a0, 0x4824a1, FUNC(kof98_aa_r));
1389         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x488880, 0x488881, FUNC(kof98_aa_r));
13901390
1391         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4a8820, 0x4a8821, FUNC(kof98_0a_r));
1392         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f8820, 0x4f8821, FUNC(kof98_00_r));
1391         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4a8820, 0x4a8821, FUNC(kof98_0a_r));
1392         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4f8820, 0x4f8821, FUNC(kof98_00_r));
13931393         break;
13941394
13951395      case REALTEC:
r18027r18028
14021402         for (mirroraddr = 0; mirroraddr < 0x400000; mirroraddr += 0x2000)
14031403            memcpy(ROM + mirroraddr, ROM + VIRGIN_COPY_GEN + 0x7e000, 0x002000); /* copy last 8kb across the whole rom region */
14041404
1405         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x400000, 0x400001, FUNC(realtec_400000_w));
1406         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x402000, 0x402001, FUNC(realtec_402000_w));
1407         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x404000, 0x404001, FUNC(realtec_404000_w));
1405         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x400000, 0x400001, FUNC(realtec_400000_w));
1406         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x402000, 0x402001, FUNC(realtec_402000_w));
1407         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x404000, 0x404001, FUNC(realtec_404000_w));
14081408         break;
14091409
14101410      case MC_SUP19IN1:
14111411         memcpy(&ROM[0x400000], &ROM[VIRGIN_COPY_GEN], 0x400000); // allow hard reset to menu
1412         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa13000, 0xa13039, FUNC(s19in1_bank));
1412         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa13000, 0xa13039, FUNC(s19in1_bank));
14131413         break;
14141414
14151415      case MC_SUP15IN1:
14161416         memcpy(&ROM[0x400000], &ROM[VIRGIN_COPY_GEN], 0x200000); // allow hard reset to menu
1417         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa13000, 0xa13039, FUNC(s19in1_bank));
1417         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa13000, 0xa13039, FUNC(s19in1_bank));
14181418         break;
14191419
14201420      case MC_12IN1:
14211421         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x400000);  /* default rom */
1422         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa13000, 0xa1303f, FUNC(mc_12in1_bank_w));
1422         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa13000, 0xa1303f, FUNC(mc_12in1_bank_w));
14231423         break;
14241424
14251425      case TOPFIGHTER:
14261426         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x400000);  /* default rom */
14271427
1428         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x6f5344, 0x6f5345, FUNC(topfig_6F5344_r) );
1429         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x6bd294, 0x6bd295, FUNC(topfig_6BD294_r) );
1430         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x645b44, 0x645b45, FUNC(topfig_645B44_r) );
1428         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x6f5344, 0x6f5345, FUNC(topfig_6F5344_r) );
1429         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x6bd294, 0x6bd295, FUNC(topfig_6BD294_r) );
1430         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x645b44, 0x645b45, FUNC(topfig_645B44_r) );
14311431
14321432         /* readd */
1433         //machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x689b80, 0x689b81, FUNC(MWA16_NOP));
1434         //machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6d8b02, 0x6d8b03, FUNC(MWA16_NOP));
1433         //machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x689b80, 0x689b81, FUNC(MWA16_NOP));
1434         //machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x6d8b02, 0x6d8b03, FUNC(MWA16_NOP));
14351435
1436         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x700000, 0x7fffff, FUNC(topfig_bank_w) );
1436         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x700000, 0x7fffff, FUNC(topfig_bank_w) );
14371437         break;
14381438      case PSOLAR:
14391439         memcpy(&ROM[0x000000], &ROM[VIRGIN_COPY_GEN], 0x400000);
1440         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa13002, 0xa13007, FUNC(psolar_bank_w));
1441         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa13000, 0xa13001, FUNC(psolar_unk_w));
1442         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0015e6, 0x0015e9, FUNC(psolar_hack_r));
1440         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa13002, 0xa13007, FUNC(psolar_bank_w));
1441         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa13000, 0xa13001, FUNC(psolar_unk_w));
1442         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x0015e6, 0x0015e9, FUNC(psolar_hack_r));
14431443         psolar_rdcnt = 0;
14441444         break;
14451445   }
r18027r18028
15071507   }
15081508
15091509   /* install NOP handler for TMSS */
1510   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa14000, 0xa14003, FUNC(genesis_TMSS_bank_w));
1510   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa14000, 0xa14003, FUNC(genesis_TMSS_bank_w));
15111511}
15121512
15131513static void setup_megadriv_sram(device_image_interface &image)
r18027r18028
15351535         state->m_md_cart.sram_end = state->m_md_cart.sram_start + image.get_software_region_length("sram") - 1;
15361536         state->m_md_cart.sram_detected = 1;
15371537         megadriv_backupram = (UINT16*) (ROM + state->m_md_cart.sram_start);
1538         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa130f0, 0xa130f1, FUNC(genesis_sram_toggle));
1538         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa130f0, 0xa130f1, FUNC(genesis_sram_toggle));
15391539         if (state->m_md_cart.last_loaded_image_length <= state->m_md_cart.sram_start)
15401540         {
15411541            state->m_md_cart.sram_active = 1;
r18027r18028
15571557         state->m_md_cart.sram_end = state->m_md_cart.sram_start + image.get_software_region_length("fram") - 1;
15581558         state->m_md_cart.sram_detected = 1;
15591559         megadriv_backupram = (UINT16*) (ROM + state->m_md_cart.sram_start);
1560         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa130f0, 0xa130f1, FUNC(sega_6658a_reg_r));
1561         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa130f0, 0xa130f1, FUNC(sega_6658a_reg_w));
1560         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa130f0, 0xa130f1, FUNC(sega_6658a_reg_r));
1561         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa130f0, 0xa130f1, FUNC(sega_6658a_reg_w));
15621562         install_sram_rw_handlers(machine, FALSE);
15631563         break;
15641564
15651565      // These types might come either from xml or from old-styele loading
15661566      case SEGA_EEPROM:
15671567         state->m_md_cart.has_serial_eeprom = 1;
1568         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(wboy_v_eeprom_r), FUNC(wboy_v_eeprom_w));
1568         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(wboy_v_eeprom_r), FUNC(wboy_v_eeprom_w));
15691569         break;
15701570
15711571      case NBA_JAM:
15721572         state->m_md_cart.has_serial_eeprom = 1;
1573         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(nba_jam_eeprom_r), FUNC(nba_jam_eeprom_w));
1573         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(nba_jam_eeprom_r), FUNC(nba_jam_eeprom_w));
15741574         break;
15751575
15761576      case NBA_JAM_TE:
15771577      case NFL_QB_96:
15781578      case C_SLAM: // same handling but different sizes
15791579         state->m_md_cart.has_serial_eeprom = 1;
1580         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(nba_jam_te_eeprom_r), FUNC(nba_jam_te_eeprom_w));
1580         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(nba_jam_te_eeprom_r), FUNC(nba_jam_te_eeprom_w));
15811581         break;
15821582
15831583      case EA_NHLPA:
15841584         state->m_md_cart.has_serial_eeprom = 1;
1585         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(ea_nhlpa_eeprom_r), FUNC(ea_nhlpa_eeprom_w));
1585         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x200000, 0x200001, FUNC(ea_nhlpa_eeprom_r), FUNC(ea_nhlpa_eeprom_w));
15861586         break;
15871587
15881588      case CODE_MASTERS:
15891589      case CM_JCART_SEPROM:
15901590         state->m_md_cart.has_serial_eeprom = 1;
1591         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x300000, 0x300001, FUNC(codemasters_eeprom_w));
1592         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x380000, 0x380001, FUNC(codemasters_eeprom_r));
1591         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x300000, 0x300001, FUNC(codemasters_eeprom_w));
1592         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x380000, 0x380001, FUNC(codemasters_eeprom_r));
15931593         break;
15941594      case PSOLAR:
15951595         state->m_md_cart.sram_start = 0x800000;
r18027r18028
15991599         STM95.eeprom_data = (UINT8*)state->m_md_cart.sram;
16001600
16011601         state->m_md_cart.has_serial_eeprom = 1;
1602         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa13008, 0xa13009, FUNC(psolar_eeprom_w));
1603         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xa1300a, 0xa1300b, FUNC(psolar_eeprom_r));
1602         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa13008, 0xa13009, FUNC(psolar_eeprom_w));
1603         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xa1300a, 0xa1300b, FUNC(psolar_eeprom_r));
16041604         break;
16051605   }
16061606
r18027r18028
16521652         if (state->m_md_cart.last_loaded_image_length <= state->m_md_cart.sram_start)
16531653            state->m_md_cart.sram_active = 1;
16541654
1655         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa130f0, 0xa130f1, FUNC(genesis_sram_toggle));
1655         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa130f0, 0xa130f1, FUNC(genesis_sram_toggle));
16561656         //printf("res: start %x, end %x, det %d, active %d\n", state->m_md_cart.sram_start, state->m_md_cart.sram_end, state->m_md_cart.sram_detected, state->m_md_cart.sram_active);
16571657
16581658         /* Sonic 1 included in Sonic Classics doesn't have SRAM and
trunk/src/mame/machine/kaneko_calc3.c
r18027r18028
12431243int kaneko_calc3_device::calc3_decompress_table(running_machine& machine, int tabnum, UINT8* dstram, int dstoffset)
12441244{
12451245   calc3_t &calc3 = m_calc3;
1246   address_space &space = *machine.device(":maincpu")->memory().space(AS_PROGRAM);
1246   address_space &space = machine.device(":maincpu")->memory().space(AS_PROGRAM);
12471247   UINT8* datarom = memregion(":calc3_rom")->base();
12481248
12491249   UINT8 numregions;
r18027r18028
13441344               //printf("save to eeprom\n");
13451345
13461346               {
1347                  address_space *eeprom_space = space.machine().device<eeprom_device>(":eeprom")->space();
1347                  address_space &eeprom_space = space.machine().device<eeprom_device>(":eeprom")->space();
13481348
13491349                  for (i=0;i<0x80;i++)
13501350                  {
1351                     eeprom_space->write_byte(i, space.read_byte(calc3.eeprom_addr+0x200000+i));
1351                     eeprom_space.write_byte(i, space.read_byte(calc3.eeprom_addr+0x200000+i));
13521352                  }
13531353
13541354               }
r18027r18028
16331633   calc3_t &calc3 = m_calc3;
16341634   UINT16 mcu_command;
16351635   int i;
1636   address_space &space = *machine.device(":maincpu")->memory().space(AS_PROGRAM);
1636   address_space &space = machine.device(":maincpu")->memory().space(AS_PROGRAM);
16371637
16381638   if ( calc3.mcu_status != (1|2|4|8) )   return;
16391639
r18027r18028
16891689         }
16901690#endif
16911691         {
1692            address_space *eeprom_space = space.machine().device<eeprom_device>(":eeprom")->space();
1692            address_space &eeprom_space = space.machine().device<eeprom_device>(":eeprom")->space();
16931693
16941694            for (i=0;i<0x80;i++)
16951695            {
1696               space.write_byte(calc3.eeprom_addr+0x200000+i, eeprom_space->read_byte(i));
1696               space.write_byte(calc3.eeprom_addr+0x200000+i, eeprom_space.read_byte(i));
16971697            }
16981698
16991699         }
trunk/src/mame/machine/playch10.c
r18027r18028
5151   /* move to individual boards as documentation of actual boards allows */
5252   m_nt_ram = auto_alloc_array(machine(), UINT8, 0x1000);
5353
54   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(playch10_state::pc10_chr_r),this), write8_delegate(FUNC(playch10_state::pc10_chr_w),this));
55   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(playch10_state::pc10_nt_r),this),write8_delegate(FUNC(playch10_state::pc10_nt_w),this));
54   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(playch10_state::pc10_chr_r),this), write8_delegate(FUNC(playch10_state::pc10_chr_w),this));
55   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(playch10_state::pc10_nt_r),this),write8_delegate(FUNC(playch10_state::pc10_nt_w),this));
5656
5757   if (NULL != m_vram)
5858      set_videoram_bank(machine(), 0, 8, 0, 8);
r18027r18028
7474
7575   m_vram = auto_alloc_array(machine(), UINT8, 0x2000);
7676
77   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(playch10_state::pc10_chr_r),this), write8_delegate(FUNC(playch10_state::pc10_chr_w),this));
78   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(playch10_state::pc10_nt_r),this), write8_delegate(FUNC(playch10_state::pc10_nt_w),this));
77   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0, 0x1fff, read8_delegate(FUNC(playch10_state::pc10_chr_r),this), write8_delegate(FUNC(playch10_state::pc10_chr_w),this));
78   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(playch10_state::pc10_nt_r),this), write8_delegate(FUNC(playch10_state::pc10_nt_w),this));
7979}
8080
8181/*************************************
r18027r18028
581581DRIVER_INIT_MEMBER(playch10_state,pcaboard)
582582{
583583   /* switches vrom with writes to the $803e-$8041 area */
584   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0x8fff, write8_delegate(FUNC(playch10_state::aboard_vrom_switch_w),this));
584   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0x8fff, write8_delegate(FUNC(playch10_state::aboard_vrom_switch_w),this));
585585
586586   /* common init */
587587   DRIVER_INIT_CALL(playch10);
r18027r18028
613613   memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
614614
615615   /* Roms are banked at $8000 to $bfff */
616   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::bboard_rom_switch_w),this));
616   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::bboard_rom_switch_w),this));
617617
618618   /* common init */
619619   DRIVER_INIT_CALL(playch10);
r18027r18028
638638DRIVER_INIT_MEMBER(playch10_state,pccboard)
639639{
640640   /* switches vrom with writes to $6000 */
641   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x6000, 0x6000, write8_delegate(FUNC(playch10_state::cboard_vrom_switch_w),this));
641   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x6000, 0x6000, write8_delegate(FUNC(playch10_state::cboard_vrom_switch_w),this));
642642
643643   /* we have no vram, make sure switching games doesn't point to an old allocation */
644644   m_vram = NULL;
r18027r18028
661661   m_mmc1_rom_mask = 0x07;
662662
663663   /* MMC mapper at writes to $8000-$ffff */
664   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::mmc1_rom_switch_w),this));
664   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::mmc1_rom_switch_w),this));
665665
666666
667667   /* common init */
r18027r18028
677677DRIVER_INIT_MEMBER(playch10_state,pcdboard_2)
678678{
679679   /* extra ram at $6000-$7fff */
680   machine().device("cart")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff);
680   machine().device("cart")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff);
681681
682682   /* common init */
683683   DRIVER_INIT_CALL(pcdboard);
r18027r18028
775775   memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
776776
777777   /* basically a mapper 9 on a nes */
778   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::eboard_rom_switch_w),this));
778   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::eboard_rom_switch_w),this));
779779
780780   /* ppu_latch callback */
781781   ppu->set_latch(mapper9_latch);
782782
783783   /* nvram at $6000-$6fff */
784   machine().device("cart")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x6fff);
784   machine().device("cart")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x6fff);
785785
786786   /* common init */
787787   DRIVER_INIT_CALL(playch10);
r18027r18028
804804   m_mmc1_rom_mask = 0x07;
805805
806806   /* MMC mapper at writes to $8000-$ffff */
807   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::mmc1_rom_switch_w),this));
807   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::mmc1_rom_switch_w),this));
808808
809809   /* common init */
810810   DRIVER_INIT_CALL(playch10);
r18027r18028
815815DRIVER_INIT_MEMBER(playch10_state,pcfboard_2)
816816{
817817   /* extra ram at $6000-$6fff */
818   machine().device("cart")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x6fff);
818   machine().device("cart")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x6fff);
819819
820820   m_vram = NULL;
821821
r18027r18028
991991   memcpy(&prg[0x0c000], &prg[0x4c000], 0x4000);
992992
993993   /* MMC3 mapper at writes to $8000-$ffff */
994   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::gboard_rom_switch_w),this));
994   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::gboard_rom_switch_w),this));
995995
996996   /* extra ram at $6000-$7fff */
997   machine().device("cart")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff);
997   machine().device("cart")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff);
998998
999999   m_gboard_banks[0] = 0x1e;
10001000   m_gboard_banks[1] = 0x1f;
r18027r18028
10451045   memcpy(&prg[0x08000], &prg[0x10000], 0x8000);
10461046
10471047   /* Roms are banked at $8000 to $bfff */
1048   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::iboard_rom_switch_w),this));
1048   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::iboard_rom_switch_w),this));
10491049
10501050   /* common init */
10511051   DRIVER_INIT_CALL(playch10);
r18027r18028
11121112   memcpy(&prg[0x0c000], &prg[0x4c000], 0x4000);
11131113
11141114   /* Roms are banked at $8000 to $bfff */
1115   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::hboard_rom_switch_w),this));
1115   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::hboard_rom_switch_w),this));
11161116
11171117   /* extra ram at $6000-$7fff */
1118   machine().device("cart")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff);
1118   machine().device("cart")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff);
11191119
11201120   m_gboard_banks[0] = 0x1e;
11211121   m_gboard_banks[1] = 0x1f;
r18027r18028
11421142   m_mmc1_rom_mask = 0x0f;
11431143
11441144   /* extra ram at $6000-$7fff */
1145   machine().device("cart")->memory().space(AS_PROGRAM)->install_ram(0x6000, 0x7fff);
1145   machine().device("cart")->memory().space(AS_PROGRAM).install_ram(0x6000, 0x7fff);
11461146
11471147   /* Roms are banked at $8000 to $bfff */
1148   machine().device("cart")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::mmc1_rom_switch_w),this));
1148   machine().device("cart")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(playch10_state::mmc1_rom_switch_w),this));
11491149
11501150   /* common init */
11511151   DRIVER_INIT_CALL(playch10);
trunk/src/mame/machine/atari.c
r18027r18028
105105   if ( new_mmu & 0x80 )
106106   {
107107      logerror("%s MMU SELFTEST RAM\n", machine.system().name);
108      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x5000, 0x57ff);
108      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x5000, 0x57ff);
109109   }
110110   else
111111   {
112112      logerror("%s MMU SELFTEST ROM\n", machine.system().name);
113      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x57ff, "bank2");
114      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x5000, 0x57ff);
113      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x57ff, "bank2");
114      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x5000, 0x57ff);
115115      machine.root_device().membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x5000);
116116   }
117117}
trunk/src/mame/machine/fd1094.c
r18027r18028
712712
713713   // if address 0 is mapped to ROM, assume this is a state memory mapping and
714714   // use the internal state change callback
715   if (space(AS_PROGRAM)->get_read_ptr(0) != NULL)
715   if (space(AS_PROGRAM).get_read_ptr(0) != NULL)
716716      m_state_change = state_change_delegate(FUNC(fd1094_device::default_state_change), this);
717717
718718   // determine length and configure our cache
r18027r18028
961961
962962void fd1094_device::default_state_change(UINT8 state)
963963{
964   space(AS_PROGRAM)->set_decrypted_region(0x000000, m_srcbytes - 1, m_cache.decrypted_opcodes(state));
964   space(AS_PROGRAM).set_decrypted_region(0x000000, m_srcbytes - 1, m_cache.decrypted_opcodes(state));
965965}
966966
967967
trunk/src/mame/machine/segas32.c
r18027r18028
207207
208208void darkedge_fd1149_vblank(device_t *device)
209209{
210   address_space &space = *device->memory().space(AS_PROGRAM);
210   address_space &space = device->memory().space(AS_PROGRAM);
211211
212212   space.write_word(0x20f072, 0);
213213   space.write_word(0x20f082, 0);
r18027r18028
243243
244244void f1lap_fd1149_vblank(device_t *device)
245245{
246   address_space &space = *device->memory().space(AS_PROGRAM);
246   address_space &space = device->memory().space(AS_PROGRAM);
247247
248248   space.write_byte(0x20F7C6, 0);
249249
trunk/src/mame/machine/kaneko_toybox.c
r18027r18028
200200      {
201201         UINT8* nvdat = (UINT8*)&kaneko16_mcu_ram[mcu_offset];
202202
203         address_space *eeprom_space = machine.device<eeprom_device>(":eeprom")->space();
203         address_space &eeprom_space = machine.device<eeprom_device>(":eeprom")->space();
204204
205205         for (int i=0;i<0x80;i++)
206206         {
207            nvdat[i] = eeprom_space->read_byte(i);
207            nvdat[i] = eeprom_space.read_byte(i);
208208         }
209209
210210         logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2);
r18027r18028
214214
215215      case 0x42:   // Write to NVRAM
216216      {
217         address_space *eeprom_space = machine.device<eeprom_device>(":eeprom")->space();
217         address_space &eeprom_space = machine.device<eeprom_device>(":eeprom")->space();
218218         UINT8* nvdat = (UINT8*)&kaneko16_mcu_ram[mcu_offset];
219219         for (int i=0;i<0x80;i++)
220220         {
221            eeprom_space->write_byte(i, nvdat[i]);
221            eeprom_space.write_byte(i, nvdat[i]);
222222         }
223223
224224         logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2);
r18027r18028
233233            //memcpy(m_nvram_save, bonkadv_mcu_43, sizeof(bonkadv_mcu_43));
234234
235235
236            address_space *eeprom_space = machine.device<eeprom_device>(":eeprom")->space();
236            address_space &eeprom_space = machine.device<eeprom_device>(":eeprom")->space();
237237            UINT8* nvdat = (UINT8*)&bonkadv_mcu_43[0];
238238            for (int i=0;i<0x80;i++)
239239            {
240               eeprom_space->write_byte(i, nvdat[i]);
240               eeprom_space.write_byte(i, nvdat[i]);
241241            }
242242            logerror("%s : MCU executed command: %04X %04X (restore default NVRAM settings)\n", machine.describe_context(), mcu_command, mcu_offset*2);
243243         }
trunk/src/mame/machine/pgmprot4.c
r18027r18028
373373   pgm_basic_init(machine());
374374   pgm_killbld_decrypt(machine());
375375
376   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xd40000, 0xd40003, FUNC(killbld_igs025_prot_r), FUNC(killbld_igs025_prot_w));
376   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xd40000, 0xd40003, FUNC(killbld_igs025_prot_r), FUNC(killbld_igs025_prot_w));
377377
378378   m_kb_cmd = 0;
379379   m_kb_reg = 0;
r18027r18028
536536        }
537537    }
538538*/
539   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xDA5610, 0xDA5613, FUNC(drgw3_igs025_prot_r), FUNC(drgw3_igs025_prot_w));
539   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xDA5610, 0xDA5613, FUNC(drgw3_igs025_prot_r), FUNC(drgw3_igs025_prot_w));
540540
541541   pgm_dw3_decrypt(machine());
542542}
trunk/src/mame/machine/cx4fn.c
r18027r18028
101101   UINT8 Color;
102102   INT32 i;
103103
104   address_space &space = *machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
104   address_space &space = machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
105105   for(i = cx4.ram[0x0295]; i > 0; i--, line += 5)
106106   {
107107      if(space.read_byte(line) == 0xff &&
trunk/src/mame/machine/irobot.c
r18027r18028
186186   /* set an initial timer to go off on scanline 0 */
187187   machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), FUNC(scanline_callback));
188188
189   irobot_rom_banksel_w(*machine().device("maincpu")->memory().space(AS_PROGRAM),0,0);
190   irobot_out0_w(*machine().device("maincpu")->memory().space(AS_PROGRAM),0,0);
189   irobot_rom_banksel_w(machine().device("maincpu")->memory().space(AS_PROGRAM),0,0);
190   irobot_out0_w(machine().device("maincpu")->memory().space(AS_PROGRAM),0,0);
191191   m_combase = m_comRAM[0];
192192   m_combase_mb = m_comRAM[1];
193193   m_outx = 0;
trunk/src/mame/machine/kabuki.c
r18027r18028
161161
162162static void mitchell_decode(running_machine &machine, int swap_key1,int swap_key2,int addr_key,int xor_key)
163163{
164   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
164   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
165165   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
166166   UINT8 *decrypt = auto_alloc_array(machine, UINT8, machine.root_device().memregion("maincpu")->bytes());
167167   int numbanks = (machine.root_device().memregion("maincpu")->bytes() - 0x10000) / 0x4000;
r18027r18028
202202
203203static void cps1_decode(running_machine &machine,int swap_key1,int swap_key2,int addr_key,int xor_key)
204204{
205   address_space &space = *machine.device("audiocpu")->memory().space(AS_PROGRAM);
205   address_space &space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
206206   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x8000);
207207   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
208208
trunk/src/mame/machine/konamigx.c
r18027r18028
443443{
444444   konamigx_state *state = machine.driver_data<konamigx_state>();
445445   state_save_register_global_array(machine, fantjour_dma);
446   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xdb0000, 0xdb001f, write32_delegate(FUNC(konamigx_state::fantjour_dma_w),state));
446   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xdb0000, 0xdb001f, write32_delegate(FUNC(konamigx_state::fantjour_dma_w),state));
447447   memset(fantjour_dma, 0, sizeof(fantjour_dma));
448448}
449449
trunk/src/mame/machine/toaplan1.c
r18027r18028
7575{
7676   /* DSP can read data from main CPU RAM via DSP IO port 1 */
7777
78   address_space *mainspace;
7978   UINT16 input_data = 0;
8079
8180   switch (m_main_ram_seg) {
82      case 0xc00000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
83                  input_data = mainspace->read_word(m_main_ram_seg + m_dsp_addr_w);
84                  break;
81      case 0xc00000: {address_space &mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
82                  input_data = mainspace.read_word(m_main_ram_seg + m_dsp_addr_w);
83                  break;}
8584      default:      logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n", space.device().safe_pcbase(), m_main_ram_seg + m_dsp_addr_w);
8685   }
8786   logerror("DSP PC:%04x IO read %04x at %08x (port 1)\n", space.device().safe_pcbase(), input_data, m_main_ram_seg + m_dsp_addr_w);
r18027r18028
9089
9190WRITE16_MEMBER(toaplan1_state::demonwld_dsp_w)
9291{
93   address_space *mainspace;
94
9592   /* Data written to main CPU RAM via DSP IO port 1 */
9693   m_dsp_execute = 0;
9794   switch (m_main_ram_seg) {
98      case 0xc00000:   if ((m_dsp_addr_w < 3) && (data == 0)) m_dsp_execute = 1;
99                  mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
100                  mainspace->write_word(m_main_ram_seg + m_dsp_addr_w, data);
101                  break;
95      case 0xc00000: {if ((m_dsp_addr_w < 3) && (data == 0)) m_dsp_execute = 1;
96                  address_space &mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
97                  mainspace.write_word(m_main_ram_seg + m_dsp_addr_w, data);
98                  break;}
10299      default:      logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n", space.device().safe_pcbase(), m_main_ram_seg + m_dsp_addr_w);
103100   }
104101   logerror("DSP PC:%04x IO write %04x at %08x (port 1)\n", space.device().safe_pcbase(), data, m_main_ram_seg + m_dsp_addr_w);
trunk/src/mame/machine/vectrex.c
r18027r18028
8989   }
9090
9191   if (memcmp(mem + 0x06,"SRAM",4)) {
92      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x7fff);
92      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x7fff);
9393   }
9494
9595   /* If VIA T2 starts, reset refresh timer.
trunk/src/mame/machine/dc.c
r18027r18028
321321   {
322322      if((state->dc_sysctrl_regs[SB_G2DTNRM] & state->dc_sysctrl_regs[SB_ISTNRM]) || (state->dc_sysctrl_regs[SB_G2DTEXT] & state->dc_sysctrl_regs[SB_ISTEXT]))
323323      {
324         address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
324         address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
325325
326326         printf("Wave DMA HW trigger\n");
327327         wave_dma_execute(space);
r18027r18028
333333   {
334334      if((state->dc_sysctrl_regs[SB_PDTNRM] & state->dc_sysctrl_regs[SB_ISTNRM]) || (state->dc_sysctrl_regs[SB_PDTEXT] & state->dc_sysctrl_regs[SB_ISTEXT]))
335335      {
336         address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
336         address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
337337
338338         printf("PVR-DMA HW trigger\n");
339339         pvr_dma_execute(space);
trunk/src/mame/machine/scramble.c
r18027r18028
156156
157157DRIVER_INIT_MEMBER(scramble_state,scobra)
158158{
159   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa803, 0xa803, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
159   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa803, 0xa803, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
160160}
161161
162162#ifdef UNUSED_FUNCTION
163163DRIVER_INIT_MEMBER(scramble_state,atlantis)
164164{
165   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6803, 0x6803, FUNC(scrambold_background_enable_w));
165   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x6803, 0x6803, FUNC(scrambold_background_enable_w));
166166}
167167
168168DRIVER_INIT_MEMBER(scramble_state,scramble)
r18027r18028
173173
174174DRIVER_INIT_MEMBER(scramble_state,stratgyx)
175175{
176   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb000, 0xb000, write8_delegate(FUNC(scramble_state::scrambold_background_green_w),this));
177   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb002, 0xb002, write8_delegate(FUNC(scramble_state::scrambold_background_blue_w),this));
178   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb00a, 0xb00a, write8_delegate(FUNC(scramble_state::scrambold_background_red_w),this));
176   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb000, 0xb000, write8_delegate(FUNC(scramble_state::scrambold_background_green_w),this));
177   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb002, 0xb002, write8_delegate(FUNC(scramble_state::scrambold_background_blue_w),this));
178   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb00a, 0xb00a, write8_delegate(FUNC(scramble_state::scrambold_background_red_w),this));
179179}
180180
181181DRIVER_INIT_MEMBER(scramble_state,tazmani2)
182182{
183   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb002, 0xb002, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
183   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb002, 0xb002, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
184184}
185185
186186DRIVER_INIT_MEMBER(scramble_state,ckongs)
r18027r18028
190190DRIVER_INIT_MEMBER(scramble_state,mariner)
191191{
192192   /* extra ROM */
193   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5800, 0x67ff, "bank1");
194   machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x5800, 0x67ff);
193   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5800, 0x67ff, "bank1");
194   machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x5800, 0x67ff);
195195   machine().root_device().membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x5800);
196196
197   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x9008, 0x9008, FUNC(mariner_protection_2_r));
198   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xb401, 0xb401, FUNC(mariner_protection_1_r));
197   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x9008, 0x9008, FUNC(mariner_protection_2_r));
198   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xb401, 0xb401, FUNC(mariner_protection_1_r));
199199
200200   /* ??? (it's NOT a background enable) */
201   /*machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x6803, 0x6803);*/
201   /*machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x6803, 0x6803);*/
202202}
203203
204204#ifdef UNUSED_FUNCTION
r18027r18028
276276   UINT8 *ROM = memregion("maincpu")->base();
277277
278278   /* banked ROM */
279   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
279   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
280280   membank("bank1")->configure_entries(0, 2, &ROM[0x00000], 0x10000);
281281   cavelon_banksw(machine());
282282
283283   /* A15 switches memory banks */
284   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x8000, 0xffff, FUNC(cavelon_banksw_r), FUNC(cavelon_banksw_w));
284   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x8000, 0xffff, FUNC(cavelon_banksw_r), FUNC(cavelon_banksw_w));
285285
286   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x2000, 0x2000);   /* ??? */
287   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x3800, 0x3801);  /* looks suspicously like
286   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x2000, 0x2000);   /* ??? */
287   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x3800, 0x3801);  /* looks suspicously like
288288                                                               an AY8910, but not sure */
289289   state_save_register_global(machine(), m_cavelon_bank);
290290}
r18027r18028
293293
294294DRIVER_INIT_MEMBER(scramble_state,darkplnt)
295295{
296   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb00a, 0xb00a, write8_delegate(FUNC(scramble_state::darkplnt_bullet_color_w),this));
296   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb00a, 0xb00a, write8_delegate(FUNC(scramble_state::darkplnt_bullet_color_w),this));
297297}
298298
299299DRIVER_INIT_MEMBER(scramble_state,mimonkey)
r18027r18028
328328      ROM[A] = ROM[A] ^ xortable[line][col];
329329      ctr++;
330330   }
331   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa804, 0xa804, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
331   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa804, 0xa804, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
332332}
333333
334334DRIVER_INIT_MEMBER(scramble_state,mimonsco)
335335{
336   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa804, 0xa804, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
336   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa804, 0xa804, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
337337}
338338
339339DRIVER_INIT_MEMBER(scramble_state,mimonscr)
340340{
341   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x6804, 0x6804, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
341   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x6804, 0x6804, write8_delegate(FUNC(scramble_state::scrambold_background_enable_w),this));
342342}
343343
344344
trunk/src/mame/machine/pitnrun.c
r18027r18028
105105
106106WRITE8_MEMBER(pitnrun_state::pitnrun_68705_portB_w)
107107{
108   address_space *cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
108   address_space &cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
109109   if (~data & 0x02)
110110   {
111111      /* 68705 is going to read data from the Z80 */
r18027r18028
120120   }
121121   if (~data & 0x10)
122122   {
123      cpu0space->write_byte(m_address, m_portA_out);
123      cpu0space.write_byte(m_address, m_portA_out);
124124   }
125125   if (~data & 0x20)
126126   {
127      m_portA_in = cpu0space->read_byte(m_address);
127      m_portA_in = cpu0space.read_byte(m_address);
128128   }
129129   if (~data & 0x40)
130130   {
trunk/src/mame/machine/fddebug.c
r18027r18028
747747   }
748748
749749   /* try all possible decodings at the current pc */
750   posscount = try_all_possibilities(*device.memory().space(AS_PROGRAM), curpc, 0, 0, instrbuffer, keybuffer, posslist) - posslist;
750   posscount = try_all_possibilities(device.memory().space(AS_PROGRAM), curpc, 0, 0, instrbuffer, keybuffer, posslist) - posslist;
751751   if (keydirty)
752752      fd1094_regenerate_key(device.machine());
753753
r18027r18028
10751075
10761076static void execute_fdsearch(running_machine &machine, int ref, int params, const char **param)
10771077{
1078   address_space &space = *debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM);
1078   address_space &space = debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM);
10791079   int pc = space.device().safe_pc();
10801080   int length, first = TRUE;
10811081   UINT8 instrdata[2];
r18027r18028
12011201
12021202static void execute_fddasm(running_machine &machine, int ref, int params, const char **param)
12031203{
1204   address_space &space = *debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM);
1204   address_space &space = debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM);
12051205   int origstate = fd1094_set_state(keyregion, -1);
12061206   const char *filename;
12071207   int skipped = FALSE;
trunk/src/mame/machine/segaic16.c
r18027r18028
541541   }
542542
543543   // find the address space that is to be mapped
544   m_space = m_cpu->space(AS_PROGRAM);
544   m_space = &m_cpu->space(AS_PROGRAM);
545545   if (m_space == NULL)
546546      throw emu_fatalerror("Unable to find program address space on device '%s'", m_cputag);
547547
trunk/src/mame/machine/n64.c
r18027r18028
7575
7676   maincpu = machine().device("maincpu");
7777   rspcpu = machine().device("rsp");
78   mem_map = maincpu->memory().space(AS_PROGRAM);
78   mem_map = &maincpu->memory().space(AS_PROGRAM);
7979
8080   mi_version = 0x01010101;
8181   mi_interrupt = 0;
trunk/src/mame/machine/stfight.c
r18027r18028
3838
3939DRIVER_INIT_MEMBER(stfight_state,empcity)
4040{
41   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
41   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4242   UINT8 *rom = memregion("maincpu")->base();
4343   int A;
4444
r18027r18028
8282
8383void stfight_state::machine_reset()
8484{
85   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
85   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
8686   m_adpcm_data_offs = m_adpcm_data_end = 0;
8787   m_toggle = 0;
8888   m_fm_data = 0;
trunk/src/mame/machine/pgmprot5.c
r18027r18028
6262    select and after failing in the 2nd stage (probably there are other checks
6363    out there).
6464    */
65   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xd80000, 0xd80003, FUNC(dw2_d80000_r));
65   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xd80000, 0xd80003, FUNC(dw2_d80000_r));
6666}
6767
6868DRIVER_INIT_MEMBER(pgm_state,drgw2)
trunk/src/mame/machine/snescx4.c
r18027r18028
108108   count = (cx4.reg[0x43]) | (cx4.reg[0x44] << 8);
109109   dest  = (cx4.reg[0x45]) | (cx4.reg[0x46] << 8);
110110
111   address_space &space = *machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
111   address_space &space = machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
112112   for(i=0;i<count;i++)
113113   {
114114      CX4_write(machine, dest++, space.read_byte(src++));
trunk/src/mame/machine/deco102.c
r18027r18028
5050void deco102_decrypt_cpu(running_machine &machine, const char *cputag, int address_xor, int data_select_xor, int opcode_select_xor)
5151{
5252   int i;
53   address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM);
53   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
5454   UINT16 *rom = (UINT16 *)machine.root_device().memregion(cputag)->base();
5555   int size = machine.root_device().memregion(cputag)->bytes();
5656   UINT16 *opcodes = auto_alloc_array(machine, UINT16, size / 2);
trunk/src/mame/machine/qix.c
r18027r18028
465465static TIMER_CALLBACK( pia_w_callback )
466466{
467467   pia6821_device *device = (pia6821_device *)ptr;
468   device->write(*device->machine().memory().first_space(), param >> 8, param & 0xff);
468   device->write(device->machine().driver_data()->generic_space(), param >> 8, param & 0xff);
469469}
470470
471471
r18027r18028
503503   qix_state *state = device->machine().driver_data<qix_state>();
504504
505505   /* write to the sound chip */
506   state->m_sn1->write(*device->machine().device<legacy_cpu_device>("maincpu")->space(), 0, data);
506   state->m_sn1->write(device->machine().device<legacy_cpu_device>("maincpu")->space(), 0, data);
507507
508508   /* clock the ready line going back into CB1 */
509509   pia6821_device *pia = downcast<pia6821_device *>(device);
r18027r18028
517517   qix_state *state = device->machine().driver_data<qix_state>();
518518
519519   /* write to the sound chip */
520   state->m_sn2->write(*device->machine().device<legacy_cpu_device>("maincpu")->space(), 0, data);
520   state->m_sn2->write(device->machine().device<legacy_cpu_device>("maincpu")->space(), 0, data);
521521
522522   /* clock the ready line going back into CB1 */
523523   pia6821_device *pia = downcast<pia6821_device *>(device);
trunk/src/mame/machine/snes.c
r18027r18028
135135{
136136   snes_state *state = machine.driver_data<snes_state>();
137137   // make sure we're in the 65816's context since we're messing with the OAM and stuff
138   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
138   address_space &space = state->m_maincpu->space(AS_PROGRAM);
139139
140140   if (!(snes_ppu.screen_disabled)) //Reset OAM address, byuu says it happens at H=10
141141   {
r18027r18028
148148static TIMER_CALLBACK( snes_reset_hdma )
149149{
150150   snes_state *state = machine.driver_data<snes_state>();
151   address_space &cpu0space = *state->m_maincpu->space(AS_PROGRAM);
151   address_space &cpu0space = state->m_maincpu->space(AS_PROGRAM);
152152   snes_hdma_init(cpu0space);
153153}
154154
155155static TIMER_CALLBACK( snes_update_io )
156156{
157157   snes_state *state = machine.driver_data<snes_state>();
158   address_space *cpu0space = state->m_maincpu->space(AS_PROGRAM);
159   state->m_io_read(cpu0space->machine());
158   address_space &cpu0space = state->m_maincpu->space(AS_PROGRAM);
159   state->m_io_read(cpu0space.machine());
160160   snes_ram[HVBJOY] &= 0xfe;      /* Clear busy bit */
161161
162162   state->m_io_timer->adjust(attotime::never);
r18027r18028
233233   // hdma reset happens at scanline 0, H=~6
234234   if (snes_ppu.beam.current_vert == 0)
235235   {
236      address_space &cpu0space = *state->m_maincpu->space(AS_PROGRAM);
236      address_space &cpu0space = state->m_maincpu->space(AS_PROGRAM);
237237      snes_hdma_init(cpu0space);
238238   }
239239
r18027r18028
257257static TIMER_CALLBACK( snes_hblank_tick )
258258{
259259   snes_state *state = machine.driver_data<snes_state>();
260   address_space &cpu0space = *state->m_maincpu->space(AS_PROGRAM);
260   address_space &cpu0space = state->m_maincpu->space(AS_PROGRAM);
261261   int nextscan;
262262
263263   snes_ppu.beam.current_vert = machine.primary_screen->vpos();
r18027r18028
15581558static void snes_init_ram( running_machine &machine )
15591559{
15601560   snes_state *state = machine.driver_data<snes_state>();
1561   address_space *cpu0space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1561   address_space &cpu0space = machine.device("maincpu")->memory().space(AS_PROGRAM);
15621562   int i;
15631563
15641564   /* Init work RAM - 0x55 isn't exactly right but it's close */
15651565   /* make sure it happens to the 65816 (CPU 0) */
15661566   for (i = 0; i < (128*1024); i++)
15671567   {
1568      cpu0space->write_byte(0x7e0000 + i, 0x55);
1568      cpu0space.write_byte(0x7e0000 + i, 0x55);
15691569   }
15701570
15711571   /* Inititialize registers/variables */
r18027r18028
16801680   state->m_spc700 = machine.device<snes_sound_device>("spc700");
16811681   state->m_superfx = machine.device<cpu_device>("superfx");
16821682
1683   state->m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(snes_state::snes_direct), state));
1684//  state->m_soundcpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(snes_state::snes_spc_direct), state));
1683   state->m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(snes_state::snes_direct), state));
1684//  state->m_soundcpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(snes_state::snes_spc_direct), state));
16851685
16861686   // power-on sets these registers like this
16871687   snes_ram[WRIO] = 0xff;
r18027r18028
18161816/* for mame we use an init, maybe we will need more for the different games */
18171817DRIVER_INIT_MEMBER(snes_state,snes)
18181818{
1819   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1819   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
18201820   UINT16 total_blocks, read_blocks;
18211821   UINT8 *rom;
18221822
r18027r18028
18811881
18821882DRIVER_INIT_MEMBER(snes_state,snes_hirom)
18831883{
1884   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1884   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
18851885   UINT16 total_blocks, read_blocks;
18861886   UINT8  *rom;
18871887
trunk/src/mame/machine/atarigen.c
r18027r18028
498498      slapstic_init(device->machine(), chipnum);
499499
500500      /* install the memory handlers */
501      state->m_slapstic = device->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(base, base + 0x7fff, 0, mirror, FUNC(atarigen_slapstic_r), FUNC(atarigen_slapstic_w));
501      state->m_slapstic = device->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(base, base + 0x7fff, 0, mirror, FUNC(atarigen_slapstic_r), FUNC(atarigen_slapstic_w));
502502
503503      /* allocate memory for a copy of bank 0 */
504504      state->m_slapstic_bank0 = auto_alloc_array(device->machine(), UINT8, 0x2000);
r18027r18028
511511      state->m_slapstic_base = base;
512512      state->m_slapstic_mirror = mirror;
513513
514      address_space &space = *downcast<cpu_device *>(device)->space(AS_PROGRAM);
514      address_space &space = device->memory().space(AS_PROGRAM);
515515      space.set_direct_update_handler(direct_update_delegate(FUNC(atarigen_state::atarigen_slapstic_setdirect), state));
516516   }
517517}
r18027r18028
764764static TIMER_CALLBACK( delayed_sound_reset )
765765{
766766   atarigen_state *state = machine.driver_data<atarigen_state>();
767   address_space &space = *state->m_sound_cpu->memory().space(AS_PROGRAM);
767   address_space &space = state->m_sound_cpu->memory().space(AS_PROGRAM);
768768
769769   /* unhalt and reset the sound CPU */
770770   if (param == 0)
r18027r18028
11251125      /* scanline IRQ ack here */
11261126      case 0x1e:
11271127         /* hack: this should be a device */
1128         atarigen_scanline_int_ack_w(*screen.machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0, 0xffff);
1128         atarigen_scanline_int_ack_w(screen.machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0, 0xffff);
11291129         break;
11301130
11311131      /* log anything else */
trunk/src/mame/machine/pgmprot6.c
r18027r18028
196196{
197197   pgm_basic_init(machine());
198198
199   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xdcb400, 0xdcb403, FUNC(olds_r), FUNC(olds_w));
200   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x8178f4, 0x8178f5, FUNC(olds_prot_swap_r));
199   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xdcb400, 0xdcb403, FUNC(olds_r), FUNC(olds_w));
200   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x8178f4, 0x8178f5, FUNC(olds_prot_swap_r));
201201
202202   m_kb_cmd = 0;
203203   m_kb_reg = 0;
trunk/src/mame/machine/archimds.c
r18027r18028
115115/* TODO: what type of DMA this is, burst or cycle steal? Docs doesn't explain it (4 usec is the DRAM refresh). */
116116static TIMER_CALLBACK( vidc_video_tick )
117117{
118   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
118   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
119119   static UINT8 *vram = machine.root_device().memregion("vram")->base();
120120   UINT32 size;
121121
r18027r18028
133133/* audio DMA */
134134static TIMER_CALLBACK( vidc_audio_tick )
135135{
136   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
136   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
137137   UINT8 ulaw_comp;
138138   INT16 res;
139139   UINT8 ch;
r18027r18028
423423void archimedes_driver_init(running_machine &machine)
424424{
425425   archimedes_memc_physmem = reinterpret_cast<UINT32 *>(machine.root_device().memshare("physicalram")->ptr());
426//  address_space &space = *machine.device<arm_device>("maincpu")->space(AS_PROGRAM);
426//  address_space &space = machine.device<arm_device>("maincpu")->space(AS_PROGRAM);
427427//  space.set_direct_update_handler(direct_update_delegate(FUNC(a310_setopbase), &machine));
428428}
429429
trunk/src/mame/machine/galaxold.c
r18027r18028
217217         rom[i] = BITSWAP8(rom[i],7,6,5,0,3,2,1,4);
218218   }
219219
220   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3001, 0x3001, FUNC(dingoe_3001_r));   /* Protection check */
220   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x3001, 0x3001, FUNC(dingoe_3001_r));   /* Protection check */
221221
222222}
223223#endif
r18027r18028
266266DRIVER_INIT_MEMBER(galaxold_state,pisces)
267267{
268268   /* the coin lockout was replaced */
269   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6002, 0x6002, FUNC(galaxold_gfxbank_w));
269   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x6002, 0x6002, FUNC(galaxold_gfxbank_w));
270270}
271271
272272DRIVER_INIT_MEMBER(galaxold_state,checkmaj)
273273{
274274   /* for the title screen */
275   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3800, 0x3800, FUNC(checkmaj_protection_r));
275   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x3800, 0x3800, FUNC(checkmaj_protection_r));
276276}
277277
278278DRIVER_INIT_MEMBER(galaxold_state,dingo)
279279{
280   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3000, 0x3000, FUNC(dingo_3000_r));
281   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x3035, 0x3035, FUNC(dingo_3035_r));
280   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x3000, 0x3000, FUNC(dingo_3000_r));
281   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x3035, 0x3035, FUNC(dingo_3035_r));
282282}
283283
284284
r18027r18028
296296
297297DRIVER_INIT_MEMBER(galaxold_state,mooncrsu)
298298{
299   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xa000, 0xa002, FUNC(galaxold_gfxbank_w));
299   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xa000, 0xa002, FUNC(galaxold_gfxbank_w));
300300}
301301
302302DRIVER_INIT_MEMBER(galaxold_state,mooncrst)
r18027r18028
313313
314314DRIVER_INIT_MEMBER(galaxold_state,mooncrgx)
315315{
316   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6000, 0x6002, FUNC(galaxold_gfxbank_w));
316   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x6000, 0x6002, FUNC(galaxold_gfxbank_w));
317317}
318318
319319DRIVER_INIT_MEMBER(galaxold_state,moonqsr)
320320{
321321   offs_t i;
322   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
322   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
323323   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
324324   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
325325
r18027r18028
397397
398398DRIVER_INIT_MEMBER(galaxold_state,4in1)
399399{
400   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
400   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
401401   offs_t i, len = memregion("maincpu")->bytes();
402402   UINT8 *RAM = memregion("maincpu")->base();
403403
r18027r18028
421421DRIVER_INIT_MEMBER(galaxold_state,ladybugg)
422422{
423423   /* Doesn't actually use the bank, but it mustn't have a coin lock! */
424   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x6002, 0x6002, write8_delegate(FUNC(galaxold_state::galaxold_gfxbank_w),this));
424   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x6002, 0x6002, write8_delegate(FUNC(galaxold_state::galaxold_gfxbank_w),this));
425425}
426426
427427DRIVER_INIT_MEMBER(galaxold_state,bullsdrtg)
trunk/src/mame/machine/dec0.c
r18027r18028
361361DRIVER_INIT_MEMBER(dec0_state,hippodrm)
362362{
363363   UINT8 *RAM = machine().root_device().memregion("sub")->base();
364   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));
365   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xffc800, 0xffcfff, write16_delegate(FUNC(dec0_state::sprite_mirror_w),this));
364   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));
365   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xffc800, 0xffcfff, write16_delegate(FUNC(dec0_state::sprite_mirror_w),this));
366366
367367   h6280_decrypt(machine(), "sub");
368368
r18027r18028
386386
387387DRIVER_INIT_MEMBER(dec0_state,robocop)
388388{
389   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x180000, 0x180fff, read16_delegate(FUNC(dec0_state::robocop_68000_share_r),this), write16_delegate(FUNC(dec0_state::robocop_68000_share_w),this));
389   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x180000, 0x180fff, read16_delegate(FUNC(dec0_state::robocop_68000_share_r),this), write16_delegate(FUNC(dec0_state::robocop_68000_share_w),this));
390390}
391391
392392DRIVER_INIT_MEMBER(dec0_state,baddudes)
trunk/src/mame/machine/williams.c
r18027r18028
456456static void williams2_postload(running_machine &machine)
457457{
458458   williams_state *state = machine.driver_data<williams_state>();
459   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
459   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
460460   state->williams2_bank_select_w(space, 0, state->m_vram_bank);
461461}
462462
r18027r18028
475475
476476MACHINE_RESET_MEMBER(williams_state,williams2)
477477{
478   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
478   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
479479
480480   /* make sure our banking is reset */
481481   williams2_bank_select_w(space, 0, 0);
r18027r18028
759759static void defender_postload(running_machine &machine)
760760{
761761   williams_state *state = machine.driver_data<williams_state>();
762   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
762   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
763763   state->defender_bank_select_w(space, 0, state->m_vram_bank);
764764}
765765
r18027r18028
777777
778778MACHINE_RESET_MEMBER(williams_state,defender)
779779{
780   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
780   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
781781
782782   MACHINE_RESET_CALL_MEMBER(williams_common);
783783
r18027r18028
10021002{
10031003   joust2_state *state = device->machine().driver_data<joust2_state>();
10041004   state->m_joust2_current_sound_data = (state->m_joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100);
1005   state->m_cvsd_sound->write(*device->machine().memory().first_space(), 0, state->m_joust2_current_sound_data);
1005   state->m_cvsd_sound->write(device->machine().driver_data()->generic_space(), 0, state->m_joust2_current_sound_data);
10061006}
10071007
10081008
r18027r18028
10101010{
10111011   joust2_state *state = device->machine().driver_data<joust2_state>();
10121012   state->m_joust2_current_sound_data = (state->m_joust2_current_sound_data & ~0xff) | (data & 0xff);
1013   state->m_cvsd_sound->write(*device->machine().memory().first_space(), 0, state->m_joust2_current_sound_data);
1013   state->m_cvsd_sound->write(device->machine().driver_data()->generic_space(), 0, state->m_joust2_current_sound_data);
10141014   device->machine().scheduler().synchronize(FUNC(joust2_deferred_snd_cmd_w), state->m_joust2_current_sound_data);
10151015}
trunk/src/mame/machine/bagman.c
r18027r18028
210210
211211MACHINE_RESET_MEMBER(bagman_state,bagman)
212212{
213   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
213   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
214214   bagman_pal16r6_w(space, 0, 1);   /*pin 2*/
215215   bagman_pal16r6_w(space, 1, 1);   /*pin 3*/
216216   bagman_pal16r6_w(space, 2, 1);   /*pin 4*/
trunk/src/mame/video/amiga.c
r18027r18028
206206   {
207207      if (LOG_COPPER)
208208         logerror("%02X.%02X: Write to %s = %04x\n", state->m_last_scanline, xpos / 2, amiga_custom_names[state->m_copper_pending_offset & 0xff], state->m_copper_pending_data);
209      amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), state->m_copper_pending_offset, state->m_copper_pending_data, 0xffff);
209      amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), state->m_copper_pending_offset, state->m_copper_pending_data, 0xffff);
210210      state->m_copper_pending_offset = 0;
211211   }
212212
r18027r18028
262262         {
263263            if (LOG_COPPER)
264264               logerror("%02X.%02X: Write to %s = %04x\n", state->m_last_scanline, xpos / 2, amiga_custom_names[word0 & 0xff], word1);
265            amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), word0, word1, 0xffff);
265            amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), word0, word1, 0xffff);
266266         }
267267         else   // additional 2 cycles needed for non-Agnus registers
268268         {
trunk/src/mame/video/vdc.c
r18027r18028
11851185
11861186static void vpc_init( running_machine &machine )
11871187{
1188   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1188   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
11891189   vpc_w( space, 0, 0x11 );
11901190   vpc_w( space, 1, 0x11 );
11911191   vpc.window1.w = 0;
trunk/src/mame/video/simpsons.c
r18027r18028
9393void simpsons_video_banking( running_machine &machine, int bank )
9494{
9595   simpsons_state *state = machine.driver_data<simpsons_state>();
96   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
96   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
9797
9898   if (bank & 1)
9999   {
trunk/src/mame/video/taito_b.c
r18027r18028
2727{
2828   int i;
2929   taitob_state *state = machine.driver_data<taitob_state>();
30   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
30   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
3131
3232   for (i = 0; i < 0x40000; i++)
3333      state->hitice_pixelram_w(space, i, 0, 0xffff);
trunk/src/mame/video/leland.c
r18027r18028
290290
291291static TIMER_CALLBACK( leland_delayed_mvram_w )
292292{
293   address_space &space = *machine.device("master")->memory().space(AS_PROGRAM);
293   address_space &space = machine.device("master")->memory().space(AS_PROGRAM);
294294
295295   int num = (param >> 16) & 1;
296296   int offset = (param >> 8) & 0xff;
trunk/src/mame/video/popeye.c
r18027r18028
277277{
278278   popeye_state *state = machine.driver_data<popeye_state>();
279279   int offs;
280   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
280   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
281281
282282   if (state->m_lastflip != state->flip_screen())
283283   {
trunk/src/mame/video/toaplan1.c
r18027r18028
286286static void rallybik_flipscreen(running_machine &machine)
287287{
288288   toaplan1_state *state = machine.driver_data<toaplan1_state>();
289   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
289   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
290290
291291   state->rallybik_bcu_flipscreen_w(space, 0, state->m_bcu_flipscreen, 0xffff);
292292}
r18027r18028
294294static void toaplan1_flipscreen(running_machine &machine)
295295{
296296   toaplan1_state *state = machine.driver_data<toaplan1_state>();
297   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
297   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
298298
299299   state->toaplan1_bcu_flipscreen_w(space, 0, state->m_bcu_flipscreen, 0xffff);
300300}
trunk/src/mame/video/dc.c
r18027r18028
19751975static void render_to_accumulation_buffer(running_machine &machine,bitmap_rgb32 &bitmap,const rectangle &cliprect)
19761976{
19771977   dc_state *state = machine.driver_data<dc_state>();
1978   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1978   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
19791979   int cs,rs,ns;
19801980   UINT32 c;
19811981#if 0
trunk/src/mame/video/cischeat.c
r18027r18028
14191419   if (msk != 0) m_active_layers &= msk;
14201420#if 1
14211421   {
1422      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1422      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
14231423
14241424      popmessage("Cmd: %04X Pos:%04X Lim:%04X Inp:%04X",
14251425                     m_scudhamm_motor_command,
trunk/src/mame/video/namcos22.c
r18027r18028
28132813      FILE *f = fopen( "dump.txt", "wb" );
28142814      if( f )
28152815      {
2816         address_space &space = *m_maincpu->space(AS_PROGRAM);
2816         address_space &space = m_maincpu->space(AS_PROGRAM);
28172817
28182818         if (1) // czram
28192819         {
r18027r18028
28782878      FILE *f = fopen( "dump.txt", "wb" );
28792879      if( f )
28802880      {
2881         address_space &space = *m_maincpu->space(AS_PROGRAM);
2881         address_space &space = m_maincpu->space(AS_PROGRAM);
28822882
28832883         //Dump(space, f,0x90000000, 0x90000003, "led?" );
28842884         Dump(space, f,0x90010000, 0x90017fff, "cz_ram");
trunk/src/mame/video/atarisy1.c
r18027r18028
384384
385385TIMER_DEVICE_CALLBACK( atarisy1_int3off_callback )
386386{
387   address_space &space = *timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
387   address_space &space = timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
388388
389389   /* clear the state */
390390   atarigen_scanline_int_ack_w(space, 0, 0, 0xffff);
trunk/src/mame/video/gtia.c
r18027r18028
157157static void gtia_reset(running_machine &machine)
158158{
159159   int i;
160   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
160   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
161161
162162   /* reset the GTIA read/write/helper registers */
163163   for (i = 0; i < 32; i++)
trunk/src/mame/video/skydiver.c
r18027r18028
1111
1212void skydiver_state::machine_reset()
1313{
14   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
14   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
1515
1616   /* reset all latches */
1717   skydiver_start_lamp_1_w(space, 0, 0);
trunk/src/mame/video/ojankohs.c
r18027r18028
307307
308308   if (m_screen_refresh)
309309   {
310      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
310      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
311311
312312      /* redraw bitmap */
313313      for (offs = 0; offs < 0x8000; offs++)
trunk/src/mame/video/astrocde.c
r18027r18028
866866
867867      case 6:      /* height of blit and initiator */
868868         m_pattern_height = data;
869         execute_blit(*space.device().memory().space(AS_PROGRAM));
869         execute_blit(space.device().memory().space(AS_PROGRAM));
870870         break;
871871   }
872872}
trunk/src/mame/video/dogfgt.c
r18027r18028
215215
216216   if (m_lastflip != flip_screen() || m_lastpixcolor != m_pixcolor)
217217   {
218      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
218      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
219219
220220      m_lastflip = flip_screen();
221221      m_lastpixcolor = m_pixcolor;
trunk/src/mame/video/avgdvg.c
r18027r18028
12891289
12901290MACHINE_RESET( avgdvg )
12911291{
1292   avgdvg_reset_w (*machine.device("maincpu")->memory().space(AS_PROGRAM),0,0);
1292   avgdvg_reset_w (machine.device("maincpu")->memory().space(AS_PROGRAM),0,0);
12931293}
12941294
12951295
trunk/src/mame/video/blstroid.c
r18027r18028
8989
9090static TIMER_CALLBACK( irq_off )
9191{
92   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
92   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
9393
9494   /* clear the interrupt */
9595   atarigen_scanline_int_ack_w(space, 0, 0, 0xffff);
trunk/src/mame/video/vrender0.c
r18027r18028
402402int vrender0_ProcessPacket(device_t *device, UINT32 PacketPtr, UINT16 *Dest, UINT8 *TEXTURE)
403403{
404404   vr0video_state *vr0 = get_safe_token(device);
405   address_space &space = *vr0->cpu->memory().space(AS_PROGRAM);
405   address_space &space = vr0->cpu->memory().space(AS_PROGRAM);
406406   UINT32 Dx = Packet(1) & 0x3ff;
407407   UINT32 Dy = Packet(2) & 0x1ff;
408408   UINT32 Endx = Packet(3) & 0x3ff;
trunk/src/mame/video/atari.c
r18027r18028
11741174 *****************************************************************************/
11751175static TIMER_CALLBACK( antic_scanline_render )
11761176{
1177   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1177   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
11781178
11791179   VIDEO *video = antic.video[antic.scanline];
11801180   LOG(("           @cycle #%3d render mode $%X lines to go #%d\n", cycle(machine), (antic.cmd & 0x0f), antic.modelines));
r18027r18028
12441244     **************************************************************/
12451245    if( new_cmd & ANTIC_LMS )
12461246    {
1247       address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1247       address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12481248      int addr = RDANTIC(space);
12491249        antic.doffs = (antic.doffs + 1) & DOFFS;
12501250        addr += 256 * RDANTIC(space);
r18027r18028
12691269 *****************************************************************************/
12701270static void antic_scanline_dma(running_machine &machine, int param)
12711271{
1272   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1272   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12731273   LOG(("           @cycle #%3d DMA fetch\n", cycle(machine)));
12741274   if (antic.scanline == VBL_END)
12751275      antic.r.nmist &= ~VBL_NMI;
trunk/src/mame/video/combatsc.c
r18027r18028
507507
508508static void bootleg_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const UINT8 *source, int circuit )
509509{
510   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
510   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
511511   gfx_element *gfx = machine.gfx[circuit + 2];
512512
513513   int limit = circuit ? (space.read_byte(0xc2) * 256 + space.read_byte(0xc3)) : (space.read_byte(0xc0) * 256 + space.read_byte(0xc1));
trunk/src/mame/video/ppu2c0x.c
r18027r18028
265265
266266inline UINT8 ppu2c0x_device::readbyte(offs_t address)
267267{
268   return space()->read_byte(address);
268   return space().read_byte(address);
269269}
270270
271271
r18027r18028
275275
276276inline void ppu2c0x_device::writebyte(offs_t address, UINT8 data)
277277{
278   space()->write_byte(address, data);
278   space().write_byte(address, data);
279279}
280280
281281
trunk/src/mame/video/hng64.c
r18027r18028
14461446   // but it could be useful
14471447   if ( machine().input().code_pressed_once(KEYCODE_L) )
14481448   {
1449      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1449      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
14501450      space.write_byte(0x2f27c8, 0x2);
14511451   }
14521452#endif
trunk/src/mame/video/gp9001.c
r18027r18028
400400{
401401   int offs = vdp->gp9001_voffs;
402402   vdp->gp9001_voffs++;
403   return vdp->space()->read_word(offs*2);
403   return vdp->space().read_word(offs*2);
404404}
405405
406406
r18027r18028
408408{
409409   int offs = vdp->gp9001_voffs;
410410   vdp->gp9001_voffs++;
411   vdp->space()->write_word(offs*2, data, mem_mask);
411   vdp->space().write_word(offs*2, data, mem_mask);
412412}
413413
414414static WRITE16_DEVICE_HANDLER( gp9001_devvoffs_w )
trunk/src/mame/includes/jaguar.h
r18027r18028
251251   int effective_hvalue(int value);
252252   bool adjust_object_timer(int vc);
253253   void update_cpu_irq();
254   UINT8 *memory_base(UINT32 offset) { return reinterpret_cast<UINT8 *>(m_gpu->space(AS_PROGRAM)->get_read_ptr(offset)); }
254   UINT8 *memory_base(UINT32 offset) { return reinterpret_cast<UINT8 *>(m_gpu->space(AS_PROGRAM).get_read_ptr(offset)); }
255255   void blitter_run();
256256   void scanline_update(int param);
257257   void set_palette(UINT16 vmode);
trunk/src/mame/drivers/mitchell.c
r18027r18028
21042104
21052105static void bootleg_decode( running_machine &machine )
21062106{
2107   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2107   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
21082108   space.set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x50000);
21092109   machine.root_device().membank("bank1")->configure_decrypted_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x60000, 0x4000);
21102110}
r18027r18028
22032203{
22042204   m_input_type = 1;
22052205   configure_banks(machine());
2206   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x03, 0x03, "DSW0");
2207   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x04, 0x04, "DSW1");
2206   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x03, 0x03, "DSW0");
2207   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x04, 0x04, "DSW1");
22082208}
22092209DRIVER_INIT_MEMBER(mitchell_state,mgakuen2)
22102210{
trunk/src/mame/drivers/deco_mlc.c
r18027r18028
738738   sh2drc_add_pcflush(machine().device("maincpu"), 0x32dc);
739739
740740   m_mainCpuIsArm = 0;
741   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01089a0, 0x01089a3, read32_delegate(FUNC(deco_mlc_state::avengrgs_speedup_r),this));
741   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01089a0, 0x01089a3, read32_delegate(FUNC(deco_mlc_state::avengrgs_speedup_r),this));
742742   descramble_sound(machine());
743743}
744744
trunk/src/mame/drivers/pasha2.c
r18027r18028
481481
482482DRIVER_INIT_MEMBER(pasha2_state,pasha2)
483483{
484   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x95744, 0x95747, read16_delegate(FUNC(pasha2_state::pasha2_speedup_r), this));
484   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x95744, 0x95747, read16_delegate(FUNC(pasha2_state::pasha2_speedup_r), this));
485485
486486   membank("bank1")->set_base(memregion("user2")->base());
487487}
trunk/src/mame/drivers/bublbobl.c
r18027r18028
15681568{
15691569   DRIVER_INIT_CALL(tokio);
15701570
1571   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfe00, 0xfe00, read8_delegate(FUNC(bublbobl_state::tokiob_mcu_r),this) );
1571   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfe00, 0xfe00, read8_delegate(FUNC(bublbobl_state::tokiob_mcu_r),this) );
15721572}
15731573
15741574DRIVER_INIT_MEMBER(bublbobl_state,dland)
trunk/src/mame/drivers/snowbros.c
r18027r18028
23422342//      m_hyperpac_ram[0xf000/2 + i] = PROTDATA[i];
23432343
23442344   /* explicit check in the code */
2345   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::moremorp_0a_read),this));
2345   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::moremorp_0a_read),this));
23462346}
23472347
23482348
r18027r18028
27412741      memcpy(src,buffer,len);
27422742      auto_free(machine(), buffer);
27432743   }
2744   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::_4in1_02_read),this));
2744   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::_4in1_02_read),this));
27452745}
27462746
27472747DRIVER_INIT_MEMBER(snowbros_state,snowbro3)
r18027r18028
27682768
27692769DRIVER_INIT_MEMBER(snowbros_state,3in1semi)
27702770{
2771   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::_3in1_read),this));
2771   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::_3in1_read),this));
27722772}
27732773
27742774READ16_MEMBER(snowbros_state::cookbib3_read)
r18027r18028
27782778
27792779DRIVER_INIT_MEMBER(snowbros_state,cookbib3)
27802780{
2781   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::cookbib3_read),this));
2781   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200001, read16_delegate(FUNC(snowbros_state::cookbib3_read),this));
27822782}
27832783
27842784DRIVER_INIT_MEMBER(snowbros_state,pzlbreak)
trunk/src/mame/drivers/segaxbd.c
r18027r18028
32563256   m_adc_reverse[1] = m_adc_reverse[3] = true;
32573257
32583258   // install sync hack on core shared memory
3259   m_loffire_sync = m_maincpu->space(AS_PROGRAM)->install_write_handler(0x29c000, 0x29c011, write16_delegate(FUNC(segaxbd_state::loffire_sync0_w), this));
3259   m_loffire_sync = m_maincpu->space(AS_PROGRAM).install_write_handler(0x29c000, 0x29c011, write16_delegate(FUNC(segaxbd_state::loffire_sync0_w), this));
32603260}
32613261
32623262DRIVER_INIT_MEMBER(segaxbd_state,smgp)
r18027r18028
32663266   m_iochip_custom_io_w[0][1] = iowrite_delegate(FUNC(segaxbd_state::smgp_iochip0_motor_w), this);
32673267
32683268   // map /EXCS space
3269   m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x2f0000, 0x2f3fff, read16_delegate(FUNC(segaxbd_state::smgp_excs_r), this), write16_delegate(FUNC(segaxbd_state::smgp_excs_w), this));
3269   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2f0000, 0x2f3fff, read16_delegate(FUNC(segaxbd_state::smgp_excs_r), this), write16_delegate(FUNC(segaxbd_state::smgp_excs_w), this));
32703270}
32713271
32723272DRIVER_INIT_MEMBER(segaxbd_state,rascot)
r18027r18028
32813281   rom[0x606/2] = 0x4e71;
32823282
32833283   // map /EXCS space
3284   m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x0f0000, 0x0f3fff, read16_delegate(FUNC(segaxbd_state::rascot_excs_r), this), write16_delegate(FUNC(segaxbd_state::rascot_excs_w), this));
3284   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0f0000, 0x0f3fff, read16_delegate(FUNC(segaxbd_state::rascot_excs_r), this), write16_delegate(FUNC(segaxbd_state::rascot_excs_w), this));
32853285}
32863286
32873287DRIVER_INIT_MEMBER(segaxbd_state,gprider)
trunk/src/mame/drivers/nbmj9195.c
r18027r18028
636636
637637void nbmj9195_state::machine_reset()
638638{
639   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
639   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
640640   int i;
641641
642642   // initialize TMPZ84C011 PIO
r18027r18028
649649
650650DRIVER_INIT_MEMBER(nbmj9195_state,nbmj9195)
651651{
652   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
652   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
653653   UINT8 *ROM = memregion("audiocpu")->base();
654654
655655   // sound program patch
trunk/src/mame/drivers/csplayh5.c
r18027r18028
585585
586586void csplayh5_state::machine_reset()
587587{
588   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
588   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
589589   int i;
590590
591591   // initialize TMPZ84C011 PIO
trunk/src/mame/drivers/pipedrm.c
r18027r18028
877877
878878   /* sprite RAM lives at the end of palette RAM */
879879   m_spriteram.set_target(&m_generic_paletteram_8[0xc00], 0x400);
880   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0xcc00, 0xcfff, m_spriteram);
880   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0xcc00, 0xcfff, m_spriteram);
881881}
882882
883883
884884DRIVER_INIT_MEMBER(fromance_state,hatris)
885885{
886   machine().device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x20, 0x20, FUNC(sound_command_nonmi_w));
887   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x21, 0x21, write8_delegate(FUNC(fromance_state::fromance_gfxreg_w),this));
886   machine().device("maincpu")->memory().space(AS_IO).install_legacy_write_handler(0x20, 0x20, FUNC(sound_command_nonmi_w));
887   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x21, 0x21, write8_delegate(FUNC(fromance_state::fromance_gfxreg_w),this));
888888}
889889
890890
trunk/src/mame/drivers/mediagx.c
r18027r18028
13131313   state->m_speedup_count = count;
13141314
13151315   for (i = 0; i < count; i++)
1316      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(entries[i].offset, entries[i].offset + 3, speedup_handlers[i].func, speedup_handlers[i].name);
1316      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(entries[i].offset, entries[i].offset + 3, speedup_handlers[i].func, speedup_handlers[i].name);
13171317
13181318#ifdef MAME_DEBUG
13191319   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(report_speedups), &machine));
trunk/src/mame/drivers/policetr.c
r18027r18028
697697
698698DRIVER_INIT_MEMBER(policetr_state,policetr)
699699{
700   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this));
700   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this));
701701   m_speedup_pc = 0x1fc028ac;
702702}
703703
704704DRIVER_INIT_MEMBER(policetr_state,plctr13b)
705705{
706   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this));
706   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this));
707707   m_speedup_pc = 0x1fc028bc;
708708}
709709
710710
711711DRIVER_INIT_MEMBER(policetr_state,sshooter)
712712{
713   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this));
713   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this));
714714   m_speedup_pc = 0x1fc03470;
715715}
716716
717717DRIVER_INIT_MEMBER(policetr_state,sshoot12)
718718{
719   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this));
719   m_speedup_data = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this));
720720   m_speedup_pc = 0x1fc033e0;
721721}
722722
trunk/src/mame/drivers/megadrvb.c
r18027r18028
664664   #endif
665665
666666   // 220000 = writes to mcu? 330000 = reads?
667   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x220000, 0x220001, FUNC(aladmdb_w));
668   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x330000, 0x330001, FUNC(aladmdb_r));
667   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x220000, 0x220001, FUNC(aladmdb_w));
668   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x330000, 0x330001, FUNC(aladmdb_r));
669669
670670   megadrive_6buttons_pad = 0;
671671   DRIVER_INIT_CALL(megadrij);
r18027r18028
714714   rom[0x07] = 0x02;
715715   rom[0x06] = 0x10;
716716
717   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770070, 0x770075, FUNC(mk3mdb_dsw_r) );
717   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x770070, 0x770075, FUNC(mk3mdb_dsw_r) );
718718
719719   megadrive_6buttons_pad = 1;
720720   DRIVER_INIT_CALL(megadriv);
r18027r18028
722722
723723DRIVER_INIT_MEMBER(md_boot_state,ssf2mdb)
724724{
725   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xA130F0, 0xA130FF); // custom banking is disabled (!)
726   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x400000, 0x5fffff, "bank5");
727   machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x400000, 0x5fffff);
725   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xA130F0, 0xA130FF); // custom banking is disabled (!)
726   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x400000, 0x5fffff, "bank5");
727   machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x400000, 0x5fffff);
728728
729729   machine().root_device().membank("bank5")->set_base(machine().root_device().memregion( "maincpu" )->base() + 0x400000 );
730730
731   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770070, 0x770075, FUNC(ssf2mdb_dsw_r) );
731   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x770070, 0x770075, FUNC(ssf2mdb_dsw_r) );
732732
733733   megadrive_6buttons_pad = 1;
734734   DRIVER_INIT_CALL(megadrij);
r18027r18028
770770   rom[0x06] = 0xd2;
771771   rom[0x07] = 0x00;
772772
773   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x770070, 0x770075, FUNC(srmdb_dsw_r) );
773   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x770070, 0x770075, FUNC(srmdb_dsw_r) );
774774
775775   megadrive_6buttons_pad = 0;
776776   DRIVER_INIT_CALL(megadriv);
r18027r18028
778778
779779DRIVER_INIT_MEMBER(md_cons_state,topshoot)
780780{
781   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x200050, 0x200051, FUNC(topshoot_200051_r) );
782   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x200042, 0x200043, "IN0");
783   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x200044, 0x200045, "IN1");
784   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x200046, 0x200047, "IN2");
785   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x200048, 0x200049, "IN3");
781   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x200050, 0x200051, FUNC(topshoot_200051_r) );
782   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x200042, 0x200043, "IN0");
783   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x200044, 0x200045, "IN1");
784   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x200046, 0x200047, "IN2");
785   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x200048, 0x200049, "IN3");
786786
787787   megadrive_6buttons_pad = 0;
788788   DRIVER_INIT_CALL(megadriv);
trunk/src/mame/drivers/zn.c
r18027r18028
733733
734734DRIVER_INIT_MEMBER(zn_state,coh1000c)
735735{
736   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );     /* fixed game rom */
737   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );     /* banked game rom */
738   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::bank_coh1000c_w),this)); /* bankswitch */
739   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40010, 0x1fb40013, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
740   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40020, 0x1fb40023, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
741   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1fb80000, 0x1fbfffff, "bank3" );     /* country rom */
742   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb60000, 0x1fb60003, write32_delegate(FUNC(zn_state::zn_qsound_w),this));
736   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );     /* fixed game rom */
737   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );     /* banked game rom */
738   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::bank_coh1000c_w),this)); /* bankswitch */
739   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1fb40010, 0x1fb40013, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
740   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1fb40020, 0x1fb40023, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
741   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1fb80000, 0x1fbfffff, "bank3" );     /* country rom */
742   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb60000, 0x1fb60003, write32_delegate(FUNC(zn_state::zn_qsound_w),this));
743743
744744   zn_driver_init(machine());
745745
r18027r18028
950950
951951DRIVER_INIT_MEMBER(zn_state,coh3002c)
952952{
953   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );     /* fixed game rom */
954   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );     /* banked game rom */
955   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40010, 0x1fb40013, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
956   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb40020, 0x1fb40023, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
957   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::bank_coh3002c_w),this)); /* bankswitch */
958   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1fb80000, 0x1fbfffff, "bank3" );     /* country rom */
959   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb60000, 0x1fb60003, write32_delegate(FUNC(zn_state::zn_qsound_w),this));
953   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );     /* fixed game rom */
954   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );     /* banked game rom */
955   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1fb40010, 0x1fb40013, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
956   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1fb40020, 0x1fb40023, read32_delegate(FUNC(zn_state::capcom_kickharness_r),this));
957   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::bank_coh3002c_w),this)); /* bankswitch */
958   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1fb80000, 0x1fbfffff, "bank3" );     /* country rom */
959   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb60000, 0x1fb60003, write32_delegate(FUNC(zn_state::zn_qsound_w),this));
960960
961961   zn_driver_init(machine());
962962}
r18027r18028
12391239   m_taitofx1_eeprom_size1 = 0x200; m_taitofx1_eeprom1 = auto_alloc_array( machine(), UINT8, m_taitofx1_eeprom_size1 );
12401240   machine().device<nvram_device>("eeprom1")->set_base(m_taitofx1_eeprom1, m_taitofx1_eeprom_size1);
12411241
1242   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank     ( 0x1f000000, 0x1f7fffff, "bank1" );     /* banked game rom */
1243   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb40000, 0x1fb40003, write32_delegate(FUNC(zn_state::bank_coh1000t_w),this)); /* bankswitch */
1244   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1fb80000, 0x1fb80003, read32_delegate(FUNC(zn_state::taitofx1a_ymsound_r),this), write32_delegate(FUNC(zn_state::taitofx1a_ymsound_w),this));
1245   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1fbe0000, 0x1fbe0000 + ( m_taitofx1_eeprom_size1 - 1 ), "bank2" );
1242   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank     ( 0x1f000000, 0x1f7fffff, "bank1" );     /* banked game rom */
1243   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    ( 0x1fb40000, 0x1fb40003, write32_delegate(FUNC(zn_state::bank_coh1000t_w),this)); /* bankswitch */
1244   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1fb80000, 0x1fb80003, read32_delegate(FUNC(zn_state::taitofx1a_ymsound_r),this), write32_delegate(FUNC(zn_state::taitofx1a_ymsound_w),this));
1245   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank( 0x1fbe0000, 0x1fbe0000 + ( m_taitofx1_eeprom_size1 - 1 ), "bank2" );
12461246
12471247   zn_driver_init(machine());
12481248}
r18027r18028
13281328   machine().device<nvram_device>("eeprom1")->set_base(m_taitofx1_eeprom1, m_taitofx1_eeprom_size1);
13291329   machine().device<nvram_device>("eeprom2")->set_base(m_taitofx1_eeprom2, m_taitofx1_eeprom_size2);
13301330
1331   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank     ( 0x1f000000, 0x1f7fffff, "bank1" ); /* banked game rom */
1332   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1fb00000, 0x1fb00000 + ( m_taitofx1_eeprom_size1 - 1 ), "bank2" );
1333   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb40000, 0x1fb40003, write32_delegate(FUNC(zn_state::bank_coh1000t_w),this)); /* bankswitch */
1334   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb80000, 0x1fb8ffff, write32_delegate(FUNC(zn_state::taitofx1b_volume_w),this));
1335   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fba0000, 0x1fbaffff, write32_delegate(FUNC(zn_state::taitofx1b_sound_w),this));
1336   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1fbc0000, 0x1fbc0003, read32_delegate(FUNC(zn_state::taitofx1b_sound_r),this));
1337   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1fbe0000, 0x1fbe0000 + ( m_taitofx1_eeprom_size2 - 1 ), "bank3" );
1331   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank     ( 0x1f000000, 0x1f7fffff, "bank1" ); /* banked game rom */
1332   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank( 0x1fb00000, 0x1fb00000 + ( m_taitofx1_eeprom_size1 - 1 ), "bank2" );
1333   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    ( 0x1fb40000, 0x1fb40003, write32_delegate(FUNC(zn_state::bank_coh1000t_w),this)); /* bankswitch */
1334   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    ( 0x1fb80000, 0x1fb8ffff, write32_delegate(FUNC(zn_state::taitofx1b_volume_w),this));
1335   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    ( 0x1fba0000, 0x1fbaffff, write32_delegate(FUNC(zn_state::taitofx1b_sound_w),this));
1336   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler     ( 0x1fbc0000, 0x1fbc0003, read32_delegate(FUNC(zn_state::taitofx1b_sound_r),this));
1337   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank( 0x1fbe0000, 0x1fbe0000 + ( m_taitofx1_eeprom_size2 - 1 ), "bank3" );
13381338
13391339   zn_driver_init(machine());
13401340}
r18027r18028
14991499
15001500   /* dma size is in 32-bit words, convert to bytes */
15011501   n_size <<= 2;
1502   address_space &space = *state->machine().firstcpu->space(AS_PROGRAM);
1502   address_space &space = state->machine().firstcpu->space(AS_PROGRAM);
15031503   while( n_size > 0 )
15041504   {
15051505      psxwritebyte( p_n_psxram, n_address, ide_controller32_r( ide, space, 0x1f0 / 4, 0x000000ff ) );
r18027r18028
15171517{
15181518   device_t *ide = machine().device("ide");
15191519
1520   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank         ( 0x1f000000, 0x1f1fffff, "bank1" );
1521   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write                         ( 0x1f000000, 0x1f000003);
1522   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( *ide, 0x1f7e4000, 0x1f7e4fff, FUNC(ide_controller32_r), FUNC(ide_controller32_w) );
1523   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite                     ( 0x1f7e8000, 0x1f7e8003);
1524   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( *ide, 0x1f7f4000, 0x1f7f4fff, FUNC(ide_controller32_r), FUNC(ide_controller32_w) );
1520   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank         ( 0x1f000000, 0x1f1fffff, "bank1" );
1521   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write                         ( 0x1f000000, 0x1f000003);
1522   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler( *ide, 0x1f7e4000, 0x1f7e4fff, FUNC(ide_controller32_r), FUNC(ide_controller32_w) );
1523   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite                     ( 0x1f7e8000, 0x1f7e8003);
1524   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler( *ide, 0x1f7f4000, 0x1f7f4fff, FUNC(ide_controller32_r), FUNC(ide_controller32_w) );
15251525
15261526   zn_driver_init(machine());
15271527}
r18027r18028
17131713
17141714DRIVER_INIT_MEMBER(zn_state,coh1002e)
17151715{
1716   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f7fffff, "bank1" );
1717   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fa10300, 0x1fa10303, write32_delegate(FUNC(zn_state::coh1002e_bank_w),this));
1718   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00007, write32_delegate(FUNC(zn_state::coh1002e_latch_w),this));
1716   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f000000, 0x1f7fffff, "bank1" );
1717   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fa10300, 0x1fa10303, write32_delegate(FUNC(zn_state::coh1002e_bank_w),this));
1718   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb00000, 0x1fb00007, write32_delegate(FUNC(zn_state::coh1002e_latch_w),this));
17191719
17201720   zn_driver_init(machine());
17211721}
r18027r18028
18531853
18541854DRIVER_INIT_MEMBER(zn_state,bam2)
18551855{
1856   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );
1857   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );
1858   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fb00000, 0x1fb00007, read32_delegate(FUNC(zn_state::bam2_mcu_r),this));
1859   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1fa20000, 0x1fa20003, read32_delegate(FUNC(zn_state::bam2_unk_r),this));
1860   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fa10300, 0x1fa10303, write32_delegate(FUNC(zn_state::bam2_sec_w),this));
1861   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00007, write32_delegate(FUNC(zn_state::bam2_mcu_w),this));
1856   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f000000, 0x1f3fffff, "bank1" );
1857   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f400000, 0x1f7fffff, "bank2" );
1858   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1fb00000, 0x1fb00007, read32_delegate(FUNC(zn_state::bam2_mcu_r),this));
1859   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1fa20000, 0x1fa20003, read32_delegate(FUNC(zn_state::bam2_unk_r),this));
1860   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fa10300, 0x1fa10303, write32_delegate(FUNC(zn_state::bam2_sec_w),this));
1861   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb00000, 0x1fb00007, write32_delegate(FUNC(zn_state::bam2_mcu_w),this));
18621862
18631863   zn_driver_init(machine());
18641864}
r18027r18028
21722172DRIVER_INIT_MEMBER(zn_state,coh1000a)
21732173{
21742174
2175   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f1fffff, "bank1" );
2176   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fbfff00, 0x1fbfff03, write32_delegate(FUNC(zn_state::acpsx_00_w),this));
2177   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fbfff10, 0x1fbfff13, write32_delegate(FUNC(zn_state::acpsx_10_w),this));
2175   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f000000, 0x1f1fffff, "bank1" );
2176   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fbfff00, 0x1fbfff03, write32_delegate(FUNC(zn_state::acpsx_00_w),this));
2177   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fbfff10, 0x1fbfff13, write32_delegate(FUNC(zn_state::acpsx_10_w),this));
21782178
21792179   if( strcmp( machine().system().name, "nbajamex" ) == 0 )
21802180   {
21812181      m_nbajamex_eeprom_size = 0x8000;
21822182      m_nbajamex_eeprom = auto_alloc_array( machine(), UINT8, m_nbajamex_eeprom_size );
21832183
2184      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank( 0x1f200000, 0x1f200000 + ( m_nbajamex_eeprom_size - 1 ), "bank2" );
2185      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1fbfff08, 0x1fbfff0b, read32_delegate(FUNC(zn_state::nbajamex_08_r),this));
2186      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1fbfff80, 0x1fbfff83, read32_delegate(FUNC(zn_state::nbajamex_80_r),this), write32_delegate(FUNC(zn_state::nbajamex_80_w),this));
2184      machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank( 0x1f200000, 0x1f200000 + ( m_nbajamex_eeprom_size - 1 ), "bank2" );
2185      machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler     ( 0x1fbfff08, 0x1fbfff0b, read32_delegate(FUNC(zn_state::nbajamex_08_r),this));
2186      machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1fbfff80, 0x1fbfff83, read32_delegate(FUNC(zn_state::nbajamex_80_r),this), write32_delegate(FUNC(zn_state::nbajamex_80_w),this));
21872187
21882188      membank( "bank2" )->set_base( m_nbajamex_eeprom ); /* ram/eeprom/?? */
21892189   }
r18027r18028
21912191   if( ( !strcmp( machine().system().name, "jdredd" ) ) ||
21922192      ( !strcmp( machine().system().name, "jdreddb" ) ) )
21932193   {
2194      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x1fbfff8c, 0x1fbfff8f,read32_delegate(FUNC(zn_state::jdredd_idestat_r),this) );
2195      machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write                    ( 0x1fbfff8c, 0x1fbfff8f);
2196      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x1fbfff90, 0x1fbfff9f, read32_delegate(FUNC(zn_state::jdredd_ide_r),this), write32_delegate(FUNC(zn_state::jdredd_ide_w),this) );
2194      machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x1fbfff8c, 0x1fbfff8f,read32_delegate(FUNC(zn_state::jdredd_idestat_r),this) );
2195      machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write                    ( 0x1fbfff8c, 0x1fbfff8f);
2196      machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x1fbfff90, 0x1fbfff9f, read32_delegate(FUNC(zn_state::jdredd_ide_r),this), write32_delegate(FUNC(zn_state::jdredd_ide_w),this) );
21972197   }
21982198
21992199   zn_driver_init(machine());
r18027r18028
23552355
23562356DRIVER_INIT_MEMBER(zn_state,coh1001l)
23572357{
2358   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f7fffff, "bank1" ); /* banked rom */
2359   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::coh1001l_bnk_w),this) );
2358   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f000000, 0x1f7fffff, "bank1" ); /* banked rom */
2359   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::coh1001l_bnk_w),this) );
23602360
23612361   zn_driver_init(machine());
23622362}
r18027r18028
23972397
23982398DRIVER_INIT_MEMBER(zn_state,coh1002v)
23992399{
2400   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1f000000, 0x1f27ffff, "bank1" );
2401   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank ( 0x1fb00000, 0x1fbfffff, "bank2" );
2402   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::coh1002v_bnk_w),this));
2400   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1f000000, 0x1f27ffff, "bank1" );
2401   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank ( 0x1fb00000, 0x1fbfffff, "bank2" );
2402   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1fb00000, 0x1fb00003, write32_delegate(FUNC(zn_state::coh1002v_bnk_w),this));
24032403
24042404   zn_driver_init(machine());
24052405}
r18027r18028
26002600
26012601DRIVER_INIT_MEMBER(zn_state,coh1002m)
26022602{
2603   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank               ( 0x1f000000, 0x1f7fffff, "bank1" );
2604   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1fb00000, 0x1fb00003, read32_delegate(FUNC(zn_state::cbaj_z80_r),this), write32_delegate(FUNC(zn_state::cbaj_z80_w),this));
2605   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1fb00004, 0x1fb00007, write32_delegate(FUNC(zn_state::coh1002m_bank_w),this));
2603   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank               ( 0x1f000000, 0x1f7fffff, "bank1" );
2604   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1fb00000, 0x1fb00003, read32_delegate(FUNC(zn_state::cbaj_z80_r),this), write32_delegate(FUNC(zn_state::cbaj_z80_w),this));
2605   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    ( 0x1fb00004, 0x1fb00007, write32_delegate(FUNC(zn_state::coh1002m_bank_w),this));
26062606
26072607   zn_driver_init(machine());
26082608}
trunk/src/mame/drivers/paradise.c
r18027r18028
12591259DRIVER_INIT_MEMBER(paradise_state,tgtball)
12601260{
12611261   m_sprite_inc = 4;
1262   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x2001, 0x2001, write8_delegate(FUNC(paradise_state::tgtball_flipscreen_w),this));
1262   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x2001, 0x2001, write8_delegate(FUNC(paradise_state::tgtball_flipscreen_w),this));
12631263
12641264}
12651265
12661266DRIVER_INIT_MEMBER(paradise_state,torus)
12671267{
12681268   m_sprite_inc = 4;
1269   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x2070, 0x2070, write8_delegate(FUNC(paradise_state::torus_coin_counter_w),this));
1269   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x2070, 0x2070, write8_delegate(FUNC(paradise_state::torus_coin_counter_w),this));
12701270}
12711271
12721272
trunk/src/mame/drivers/balsente.c
r18027r18028
21632163DRIVER_INIT_MEMBER(balsente_state,toggle)    { expand_roms(machine(), EXPAND_ALL);  config_shooter_adc(machine(), FALSE, 0 /* noanalog */); }
21642164DRIVER_INIT_MEMBER(balsente_state,nametune)
21652165{
2166   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2166   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
21672167   space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
21682168   expand_roms(machine(), EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 0 /* noanalog */);
21692169}
21702170DRIVER_INIT_MEMBER(balsente_state,nstocker)
21712171{
2172   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2172   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
21732173   space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
21742174   expand_roms(machine(), EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine(), TRUE, 1);
21752175}
21762176DRIVER_INIT_MEMBER(balsente_state,sfootbal)
21772177{
2178   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2178   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
21792179   space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
21802180   expand_roms(machine(), EXPAND_ALL  | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 0);
21812181}
21822182DRIVER_INIT_MEMBER(balsente_state,spiker)
21832183{
2184   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2184   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
21852185   space.install_readwrite_handler(0x9f80, 0x9f8f, read8_delegate(FUNC(balsente_state::spiker_expand_r),this), write8_delegate(FUNC(balsente_state::spiker_expand_w),this));
21862186   space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
21872187   expand_roms(machine(), EXPAND_ALL  | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 1);
21882188}
21892189DRIVER_INIT_MEMBER(balsente_state,stompin)
21902190{
2191   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2191   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
21922192   space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this));
21932193   expand_roms(machine(), 0x0c | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 32);
21942194}
21952195DRIVER_INIT_MEMBER(balsente_state,rescraid)  { expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); }
21962196DRIVER_INIT_MEMBER(balsente_state,grudge)
21972197{
2198   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2198   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
21992199   space.install_read_handler(0x9400, 0x9400, read8_delegate(FUNC(balsente_state::grudge_steering_r),this));
22002200   expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 0);
22012201}
22022202DRIVER_INIT_MEMBER(balsente_state,shrike)
22032203{
2204   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2204   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
22052205   space.install_readwrite_handler(0x9e00, 0x9fff, read8_delegate(FUNC(balsente_state::shrike_shared_6809_r),this), write8_delegate(FUNC(balsente_state::shrike_shared_6809_w),this));
22062206   space.install_write_handler(0x9e01, 0x9e01, write8_delegate(FUNC(balsente_state::shrike_sprite_select_w),this));
2207   machine().device("68k")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x10000, 0x1001f, read16_delegate(FUNC(balsente_state::shrike_io_68k_r),this), write16_delegate(FUNC(balsente_state::shrike_io_68k_w),this));
2207   machine().device("68k")->memory().space(AS_PROGRAM).install_readwrite_handler(0x10000, 0x1001f, read16_delegate(FUNC(balsente_state::shrike_io_68k_r),this), write16_delegate(FUNC(balsente_state::shrike_io_68k_w),this));
22082208
22092209   expand_roms(machine(), EXPAND_ALL);  config_shooter_adc(machine(), FALSE, 32);
22102210}
trunk/src/mame/drivers/fitfight.c
r18027r18028
996996{
997997//  UINT16 *mem16 = (UINT16 *)machine().root_device().memregion("maincpu")->base();
998998//  mem16[0x0165B2/2] = 0x4e71; // for now so it boots
999   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::fitfight_700000_r),this));
999   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::fitfight_700000_r),this));
10001000   m_bbprot_kludge = 0;
10011001}
10021002
r18027r18028
10041004{
10051005//  UINT16 *mem16 = (UINT16 *)machine().root_device().memregion("maincpu")->base();
10061006//  mem16[0x017FDC/2] = 0x4e71; // for now so it boots
1007   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::histryma_700000_r),this));
1007   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::histryma_700000_r),this));
10081008   m_bbprot_kludge = 0;
10091009}
10101010
r18027r18028
10151015
10161016DRIVER_INIT_MEMBER(fitfight_state,hotmindff)
10171017{
1018   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, 0, 0, read16_delegate(FUNC(fitfight_state::hotmindff_unk_r),this));
1018   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200001, 0, 0, read16_delegate(FUNC(fitfight_state::hotmindff_unk_r),this));
10191019   DRIVER_INIT_CALL(fitfight);
10201020}
10211021
trunk/src/mame/drivers/terracre.c
r18027r18028
10141014DRIVER_INIT_MEMBER(terracre_state,horekid)
10151015{
10161016   m_mpProtData = mHoreKidProtData;
1017   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x44004, 0x44005, read16_delegate(FUNC(terracre_state::horekid_IN2_r),this));
1017   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x44004, 0x44005, read16_delegate(FUNC(terracre_state::horekid_IN2_r),this));
10181018}
10191019
10201020/*    YEAR, NAME,   PARENT,     MACHINE, INPUT,    INIT,     MONITOR,  COMPANY,      FULLNAME, FLAGS */
trunk/src/mame/drivers/deco32.c
r18027r18028
506506WRITE32_MEMBER(deco32_state::tattass_control_w)
507507{
508508   eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
509   address_space *eeprom_space = eeprom->space();
509   address_space &eeprom_space = eeprom->space();
510510
511511   /* Eprom in low byte */
512512   if (mem_mask==0x000000ff) { /* Byte write to low byte only (different from word writing including low byte) */
r18027r18028
556556            int d=m_readBitCount/8;
557557            int m=7-(m_readBitCount%8);
558558            int a=(m_byteAddr+d)%1024;
559            int b=eeprom_space->read_byte(a);
559            int b=eeprom_space.read_byte(a);
560560
561561            m_tattass_eprom_bit=(b>>m)&1;
562562
r18027r18028
573573               int b=(m_buffer[24]<<7)|(m_buffer[25]<<6)|(m_buffer[26]<<5)|(m_buffer[27]<<4)
574574                  |(m_buffer[28]<<3)|(m_buffer[29]<<2)|(m_buffer[30]<<1)|(m_buffer[31]<<0);
575575
576               eeprom_space->write_byte(m_byteAddr, b);
576               eeprom_space.write_byte(m_byteAddr, b);
577577            }
578578            m_lastClock=data&0x20;
579579            return;
r18027r18028
588588
589589            /* Check for read command */
590590            if (m_buffer[0] && m_buffer[1]) {
591               m_tattass_eprom_bit=(eeprom_space->read_byte(m_byteAddr)>>7)&1;
591               m_tattass_eprom_bit=(eeprom_space.read_byte(m_byteAddr)>>7)&1;
592592               m_readBitCount=1;
593593               m_pendingCommand=1;
594594            }
trunk/src/mame/drivers/midzeus.c
r18027r18028
14331433{
14341434   dcs2_init(machine(), 0, 0);
14351435   midway_ioasic_init(machine(), MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 94, NULL);
1436   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x9c0000, 0x9c0000, read32_delegate(FUNC(midzeus_state::invasn_gun_r),this), write32_delegate(FUNC(midzeus_state::invasn_gun_w),this));
1436   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x9c0000, 0x9c0000, read32_delegate(FUNC(midzeus_state::invasn_gun_r),this), write32_delegate(FUNC(midzeus_state::invasn_gun_w),this));
14371437}
14381438
14391439
r18027r18028
14421442   dcs2_init(machine(), 0, 0);
14431443   midway_ioasic_init(machine(), MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL);
14441444   machine().root_device().membank("bank1")->configure_entries(0, 3, machine().root_device().memregion("user2")->base(), 0x400000*4);
1445   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));
1446   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    (0x8d0009, 0x8d000a, write32_delegate(FUNC(midzeus_state::keypad_select_w),this));
1445   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));
1446   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    (0x8d0009, 0x8d000a, write32_delegate(FUNC(midzeus_state::keypad_select_w),this));
14471447}
14481448
14491449
trunk/src/mame/drivers/zaxxon.c
r18027r18028
15221522   };
15231523
15241524   int A;
1525   address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM);
1525   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
15261526   UINT8 *rom = machine.root_device().memregion(cputag)->base();
15271527   int size = machine.root_device().memregion(cputag)->bytes();
15281528   UINT8 *decrypt = auto_alloc_array(machine, UINT8, size);
r18027r18028
15821582
15831583DRIVER_INIT_MEMBER(zaxxon_state,razmataz)
15841584{
1585   address_space *pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1585   address_space &pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
15861586
15871587   nprinces_decode(machine(), "maincpu");
15881588
15891589   /* additional input ports are wired */
1590   pgmspace->install_read_port(0xc004, 0xc004, 0, 0x18f3, "SW04");
1591   pgmspace->install_read_port(0xc008, 0xc008, 0, 0x18f3, "SW08");
1592   pgmspace->install_read_port(0xc00c, 0xc00c, 0, 0x18f3, "SW0C");
1590   pgmspace.install_read_port(0xc004, 0xc004, 0, 0x18f3, "SW04");
1591   pgmspace.install_read_port(0xc008, 0xc008, 0, 0x18f3, "SW08");
1592   pgmspace.install_read_port(0xc00c, 0xc00c, 0, 0x18f3, "SW0C");
15931593
15941594   /* unknown behavior expected here */
1595   pgmspace->install_read_handler(0xc80a, 0xc80a, read8_delegate(FUNC(zaxxon_state::razmataz_counter_r),this));
1595   pgmspace.install_read_handler(0xc80a, 0xc80a, read8_delegate(FUNC(zaxxon_state::razmataz_counter_r),this));
15961596
15971597   /* additional state saving */
15981598   save_item(NAME(m_razmataz_dial_pos));
trunk/src/mame/drivers/fastfred.c
r18027r18028
10001000
10011001DRIVER_INIT_MEMBER(fastfred_state,flyboy)
10021002{
1003   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc085, 0xc099, read8_delegate(FUNC(fastfred_state::flyboy_custom1_io_r),this));
1004   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc8fb, 0xc900, read8_delegate(FUNC(fastfred_state::flyboy_custom2_io_r),this));
1003   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc085, 0xc099, read8_delegate(FUNC(fastfred_state::flyboy_custom1_io_r),this));
1004   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc8fb, 0xc900, read8_delegate(FUNC(fastfred_state::flyboy_custom2_io_r),this));
10051005   m_hardware_type = 1;
10061006}
10071007
r18027r18028
10121012
10131013DRIVER_INIT_MEMBER(fastfred_state,fastfred)
10141014{
1015   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::fastfred_custom_io_r),this));
1016   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
1015   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::fastfred_custom_io_r),this));
1016   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff);
10171017   m_hardware_type = 1;
10181018}
10191019
10201020DRIVER_INIT_MEMBER(fastfred_state,jumpcoas)
10211021{
1022   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this));
1023   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
1022   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this));
1023   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff);
10241024   m_hardware_type = 0;
10251025}
10261026
10271027DRIVER_INIT_MEMBER(fastfred_state,boggy84b)
10281028{
1029   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this));
1030   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
1029   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this));
1030   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff);
10311031   m_hardware_type = 2;
10321032}
10331033
10341034DRIVER_INIT_MEMBER(fastfred_state,boggy84)
10351035{
1036   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::boggy84_custom_io_r),this));
1037   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff);
1036   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::boggy84_custom_io_r),this));
1037   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff);
10381038   m_hardware_type = 2;
10391039}
10401040
trunk/src/mame/drivers/atvtrack.c
r18027r18028
327327void atvtrack_state::machine_start()
328328{
329329   UINT8 *src, *dst;
330   address_space *as;
331330
332331   nandaddressstep = 0;
333332   nandregion = machine().root_device().memregion("maincpu");
334   as = machine().device("maincpu")->memory().space(AS_PROGRAM);
335   dst = (UINT8 *)(as->get_write_ptr(0x0c7f0000));
333   address_space &as = machine().device("maincpu")->memory().space(AS_PROGRAM);
334   dst = (UINT8 *)(as.get_write_ptr(0x0c7f0000));
336335   src = nandregion->base()+0x10;
337336   // copy 0x10000 bytes from region "maincpu" offset 0x10 to 0x0c7f0000
338337   memcpy(dst, src, 0x10000);
r18027r18028
344343   // The routine initializes the cpu, copies the boot program from the flash memories into the cpu sdram
345344   // and finally executes it.
346345   // Here there is the setup of the cpu, the boot program is copied in machine_start
347   address_space &as = *machine().device("maincpu")->memory().space(AS_PROGRAM);
346   address_space &as = machine().device("maincpu")->memory().space(AS_PROGRAM);
348347   // set cpu PC register to 0x0c7f0000
349348   machine().device("maincpu")->state().set_pc(0x0c7f0000);
350349   // set BCR2 to 1
trunk/src/mame/drivers/ddenlovr.c
r18027r18028
1012210122       version of the game might be a bootleg with the protection
1012310123       patched. (both sets need this)
1012410124     */
10125   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x60d4, 0x60d4);
10125   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x60d4, 0x60d4);
1012610126}
1012710127
1012810128/***************************************************************************
r18027r18028
1138711387
1138811388DRIVER_INIT_MEMBER(dynax_state,momotaro)
1138911389{
11390   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0xe0, 0xe0, read8_delegate(FUNC(dynax_state::momotaro_protection_r),this));
11390   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0xe0, 0xe0, read8_delegate(FUNC(dynax_state::momotaro_protection_r),this));
1139111391}
1139211392
1139311393GAME( 1992, mmpanic,   0,        mmpanic,   mmpanic, driver_device,  0,        ROT0, "Nakanihon / East Technology (Taito license)", "Monkey Mole Panic (USA)",                                         GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/kaneko16.c
r18027r18028
38383838DRIVER_INIT_MEMBER( kaneko16_shogwarr_state, brapboys )
38393839{
38403840   // sample banking is different on brap boys for the music, why? GALs / PALs ?
3841   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe00000, 0xe00001, write16_delegate(FUNC(kaneko16_shogwarr_state::brapboys_oki_bank_w),this));
3841   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe00000, 0xe00001, write16_delegate(FUNC(kaneko16_shogwarr_state::brapboys_oki_bank_w),this));
38423842
38433843   // default sample banks
38443844   kaneko16_common_oki_bank_w(machine(), "bank10", "oki1", 0, 0x30000, 0x10000);
trunk/src/mame/drivers/gauntlet.c
r18027r18028
145145
146146static void scanline_update(screen_device &screen, int scanline)
147147{
148   address_space &space = *screen.machine().device("audiocpu")->memory().space(AS_PROGRAM);
148   address_space &space = screen.machine().device("audiocpu")->memory().space(AS_PROGRAM);
149149
150150   /* sound IRQ is on 32V */
151151   if (scanline & 32)
trunk/src/mame/drivers/mcr3.c
r18027r18028
15251525DRIVER_INIT_MEMBER(mcr3_state,demoderm)
15261526{
15271527   mcr_common_init(machine());
1528   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::demoderm_ip1_r),this));
1529   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::demoderm_ip2_r),this));
1530   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::demoderm_op6_w),this));
1528   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::demoderm_ip1_r),this));
1529   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::demoderm_ip2_r),this));
1530   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::demoderm_op6_w),this));
15311531}
15321532
15331533
15341534DRIVER_INIT_MEMBER(mcr3_state,sarge)
15351535{
15361536   mcr_common_init(machine());
1537   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(midway_turbo_chip_squeak_device::write),m_turbo_chip_squeak.target()));
1537   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(midway_turbo_chip_squeak_device::write),m_turbo_chip_squeak.target()));
15381538}
15391539
15401540
15411541DRIVER_INIT_MEMBER(mcr3_state,maxrpm)
15421542{
15431543   mcr_common_init(machine());
1544   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::maxrpm_ip1_r),this));
1545   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::maxrpm_ip2_r),this));
1546   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::maxrpm_op5_w),this));
1547   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::maxrpm_op6_w),this));
1544   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::maxrpm_ip1_r),this));
1545   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::maxrpm_ip2_r),this));
1546   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::maxrpm_op5_w),this));
1547   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::maxrpm_op6_w),this));
15481548
15491549   state_save_register_global(machine(), m_maxrpm_adc_control);
15501550   state_save_register_global(machine(), m_maxrpm_adc_select);
r18027r18028
15571557DRIVER_INIT_MEMBER(mcr3_state,rampage)
15581558{
15591559   mcr_common_init(machine());
1560   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x04, 0x04, read8_delegate(FUNC(mcr3_state::rampage_ip4_r),this));
1561   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::rampage_op6_w),this));
1560   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x04, 0x04, read8_delegate(FUNC(mcr3_state::rampage_ip4_r),this));
1561   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::rampage_op6_w),this));
15621562}
15631563
15641564
15651565DRIVER_INIT_MEMBER(mcr3_state,powerdrv)
15661566{
15671567   mcr_common_init(machine());
1568   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::powerdrv_ip2_r),this));
1569   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::powerdrv_op5_w),this));
1570   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::powerdrv_op6_w),this));
1568   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::powerdrv_ip2_r),this));
1569   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::powerdrv_op5_w),this));
1570   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::powerdrv_op6_w),this));
15711571}
15721572
15731573
15741574DRIVER_INIT_MEMBER(mcr3_state,stargrds)
15751575{
15761576   mcr_common_init(machine());
1577   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x00, read8_delegate(FUNC(mcr3_state::stargrds_ip0_r),this));
1578   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::stargrds_op5_w),this));
1579   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::stargrds_op6_w),this));
1577   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(mcr3_state::stargrds_ip0_r),this));
1578   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::stargrds_op5_w),this));
1579   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::stargrds_op6_w),this));
15801580}
15811581
15821582
r18027r18028
16151615   machine().device<cpu_device>("csd:cpu")->suspend(SUSPEND_REASON_DISABLE, 1);
16161616
16171617   /* kludge for bad ROM read */
1618   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0b53, 0x0b53, read8_delegate(FUNC(mcr3_state::turbotag_kludge_r),this));
1618   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0b53, 0x0b53, read8_delegate(FUNC(mcr3_state::turbotag_kludge_r),this));
16191619}
16201620
16211621
trunk/src/mame/drivers/viper.c
r18027r18028
20262026
20272027DRIVER_INIT_MEMBER(viper_state,viper)
20282028{
2029//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler( *ide, 0xff200000, 0xff207fff, FUNC(hdd_r), FUNC(hdd_w) ); //TODO
2029//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler( *ide, 0xff200000, 0xff207fff, FUNC(hdd_r), FUNC(hdd_w) ); //TODO
20302030}
20312031
20322032DRIVER_INIT_MEMBER(viper_state,vipercf)
20332033{
20342034   DRIVER_INIT_CALL(viper);
20352035
2036   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xff000000, 0xff000fff, read64_delegate(FUNC(viper_state::cf_card_data_r), this), write64_delegate(FUNC(viper_state::cf_card_data_w), this) );
2037   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xff200000, 0xff200fff, read64_delegate(FUNC(viper_state::cf_card_r), this), write64_delegate(FUNC(viper_state::cf_card_w), this) );
2036   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xff000000, 0xff000fff, read64_delegate(FUNC(viper_state::cf_card_data_r), this), write64_delegate(FUNC(viper_state::cf_card_data_w), this) );
2037   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xff200000, 0xff200fff, read64_delegate(FUNC(viper_state::cf_card_r), this), write64_delegate(FUNC(viper_state::cf_card_w), this) );
20382038}
20392039
20402040
trunk/src/mame/drivers/pinkiri8.c
r18027r18028
453453         break;
454454
455455      case 3:
456      {
457         address_space &vdp_space = machine().device<janshi_vdp_device>("janshivdp")->space();
456458
457         address_space *vdp_space = machine().device<janshi_vdp_device>("janshivdp")->space();
458
459459         if (LOG_VRAM) printf("%02x ", data);
460460         m_prev_writes++;
461461         m_vram_addr++;
462462
463         vdp_space->write_byte(m_vram_addr, data);
463         vdp_space.write_byte(m_vram_addr, data);
464464         break;
465      }
465466   }
466467}
467468
r18027r18028
12501251
12511252DRIVER_INIT_MEMBER(pinkiri8_state,ronjan)
12521253{
1253   machine().device("maincpu")->memory().space(AS_IO)->install_readwrite_handler(0x90, 0x90, read8_delegate(FUNC(pinkiri8_state::ronjan_prot_r), this), write8_delegate(FUNC(pinkiri8_state::ronjan_prot_w), this));
1254   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x66, 0x66, read8_delegate(FUNC(pinkiri8_state::ronjan_prot_status_r), this));
1255   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x9f, 0x9f, read8_delegate(FUNC(pinkiri8_state::ronjan_patched_prot_r), this));
1254   machine().device("maincpu")->memory().space(AS_IO).install_readwrite_handler(0x90, 0x90, read8_delegate(FUNC(pinkiri8_state::ronjan_prot_r), this), write8_delegate(FUNC(pinkiri8_state::ronjan_prot_w), this));
1255   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x66, 0x66, read8_delegate(FUNC(pinkiri8_state::ronjan_prot_status_r), this));
1256   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x9f, 0x9f, read8_delegate(FUNC(pinkiri8_state::ronjan_patched_prot_r), this));
12561257}
12571258
12581259GAME( 1992,  janshi,    0,   pinkiri8, janshi, driver_device,    0,      ROT0, "Eagle",         "Janshi",          GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
trunk/src/mame/drivers/suna8.c
r18027r18028
8181/* Non encrypted bootleg */
8282DRIVER_INIT_MEMBER(suna8_state,hardhedb)
8383{
84   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
84   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
8585   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x48000);
8686   machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
8787}
r18027r18028
9292
9393static UINT8 *brickzn_decrypt(running_machine &machine)
9494{
95   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
95   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
9696   UINT8   *RAM   =   machine.root_device().memregion("maincpu")->base();
9797   size_t   size   =   machine.root_device().memregion("maincpu")->bytes();
9898   UINT8   *decrypt = auto_alloc_array(machine, UINT8, size);
r18027r18028
222222
223223DRIVER_INIT_MEMBER(suna8_state,hardhea2)
224224{
225   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
225   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
226226   UINT8   *RAM   =   machine().root_device().memregion("maincpu")->base();
227227   size_t   size   =   machine().root_device().memregion("maincpu")->bytes();
228228   UINT8   *decrypt =   auto_alloc_array(machine(), UINT8, size);
r18027r18028
309309
310310DRIVER_INIT_MEMBER(suna8_state,starfigh)
311311{
312   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
312   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
313313   UINT8   *RAM   =   machine().root_device().memregion("maincpu")->base();
314314   size_t   size   =   machine().root_device().memregion("maincpu")->bytes();
315315   UINT8   *decrypt =   auto_alloc_array(machine(), UINT8, size);
r18027r18028
377377
378378DRIVER_INIT_MEMBER(suna8_state,sparkman)
379379{
380   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
380   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
381381   UINT8   *RAM   =   machine().root_device().memregion("maincpu")->base();
382382   size_t   size   =   machine().root_device().memregion("maincpu")->bytes();
383383   UINT8   *decrypt =   auto_alloc_array(machine(), UINT8, size);
r18027r18028
18321832
18331833MACHINE_RESET_MEMBER(suna8_state,hardhea2)
18341834{
1835   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1835   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
18361836   hardhea2_rambank_0_w(space,0,0);
18371837}
18381838
trunk/src/mame/drivers/btime.c
r18027r18028
20382038
20392039static void decrypt_C10707_cpu(running_machine &machine, const char *cputag)
20402040{
2041   address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM);
2041   address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM);
20422042   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
20432043   UINT8 *rom = machine.root_device().memregion(cputag)->base();
20442044   offs_t addr;
r18027r18028
20682068
20692069static void init_rom1(running_machine &machine)
20702070{
2071   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2071   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
20722072   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
20732073
20742074   decrypted = auto_alloc_array(machine, UINT8, 0x10000);
r18027r18028
21362136{
21372137   decrypt_C10707_cpu(machine(), "maincpu");
21382138
2139   machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0200, 0x0fff, "bank10");
2139   machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_bank(0x0200, 0x0fff, "bank10");
21402140   membank("bank10")->set_base(memregion("audiocpu")->base() + 0xe200);
21412141   m_audio_nmi_enable_type = AUDIO_ENABLE_DIRECT;
21422142}
r18027r18028
21512151{
21522152   decrypt_C10707_cpu(machine(), "maincpu");
21532153
2154   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc15f, 0xc15f, read8_delegate(FUNC(btime_state::wtennis_reset_hack_r),this));
2154   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc15f, 0xc15f, read8_delegate(FUNC(btime_state::wtennis_reset_hack_r),this));
21552155
2156   machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0200, 0x0fff, "bank10");
2156   machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_bank(0x0200, 0x0fff, "bank10");
21572157   membank("bank10")->set_base(memregion("audiocpu")->base() + 0xe200);
21582158   m_audio_nmi_enable_type = AUDIO_ENABLE_AY8910;
21592159}
trunk/src/mame/drivers/gstriker.c
r18027r18028
10131013   state->m_pending_command = 0;
10141014   state->m_mcu_data = 0;
10151015
1016   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),state));
1017   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),state));
1016   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),state));
1017   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),state));
10181018
1019   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),state));
1020   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),state));
1019   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),state));
1020   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),state));
10211021}
10221022
10231023DRIVER_INIT_MEMBER(gstriker_state,twrldc94)
r18027r18028
10371037   m_gametype = 3;
10381038   mcu_init( machine() );
10391039
1040   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle
1041   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this));
1040   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle
1041   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this));
10421042}
10431043
10441044/*** GAME DRIVERS ************************************************************/
trunk/src/mame/drivers/snk.c
r18027r18028
62666266DRIVER_INIT_MEMBER(snk_state,countryc)
62676267{
62686268   // replace coin counter with trackball select
6269   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc300, 0xc300, write8_delegate(FUNC(snk_state::countryc_trackball_w),this));
6269   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc300, 0xc300, write8_delegate(FUNC(snk_state::countryc_trackball_w),this));
62706270}
62716271
62726272
trunk/src/mame/drivers/highvdeo.c
r18027r18028
12011201
12021202DRIVER_INIT_MEMBER(highvdeo_state,ciclone)
12031203{
1204   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0030, 0x0033, read16_delegate(FUNC(highvdeo_state::ciclone_status_r), this));
1204   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0030, 0x0033, read16_delegate(FUNC(highvdeo_state::ciclone_status_r), this));
12051205}
12061206
12071207/*
r18027r18028
12711271
12721272DRIVER_INIT_MEMBER(highvdeo_state,fashion)
12731273{
1274   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x0002, 0x0003, write16_delegate(FUNC(highvdeo_state::fashion_output_w), this));
1274   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x0002, 0x0003, write16_delegate(FUNC(highvdeo_state::fashion_output_w), this));
12751275}
12761276
12771277GAMEL( 2000, tour4000,  0,      tv_vcf,   tv_vcf, driver_device,   0,       ROT0,  "High Video", "Tour 4000",         0, layout_fashion )
trunk/src/mame/drivers/strnskil.c
r18027r18028
539539//  AM_RANGE(0xd806, 0xd806) AM_READ_LEGACY(protection_r) /* protection data read (pettanp) */
540540
541541   /* Fujitsu MB8841 4-Bit MCU */
542   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd806, 0xd806, read8_delegate(FUNC(strnskil_state::pettanp_protection_r),this));
543   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd80d, 0xd80d, write8_delegate(FUNC(strnskil_state::protection_w),this));
542   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd806, 0xd806, read8_delegate(FUNC(strnskil_state::pettanp_protection_r),this));
543   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd80d, 0xd80d, write8_delegate(FUNC(strnskil_state::protection_w),this));
544544
545545}
546546
547547DRIVER_INIT_MEMBER(strnskil_state,banbam)
548548{
549549   /* Fujitsu MB8841 4-Bit MCU */
550   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd806, 0xd806, read8_delegate(FUNC(strnskil_state::banbam_protection_r),this));
551   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd80d, 0xd80d, write8_delegate(FUNC(strnskil_state::protection_w),this));
550   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd806, 0xd806, read8_delegate(FUNC(strnskil_state::banbam_protection_r),this));
551   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd80d, 0xd80d, write8_delegate(FUNC(strnskil_state::protection_w),this));
552552}
553553
554554GAME( 1984, strnskil, 0,        strnskil, strnskil, driver_device, 0,       ROT0, "Sun Electronics", "Strength & Skill", 0 )
trunk/src/mame/drivers/cosmic.c
r18027r18028
411411
412412INPUT_CHANGED_MEMBER(cosmic_state::panic_coin_inserted)
413413{
414   panic_sound_output_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 17, newval == 0);
414   panic_sound_output_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 17, newval == 0);
415415}
416416
417417static INPUT_PORTS_START( panic )
r18027r18028
15381538
15391539DRIVER_INIT_MEMBER(cosmic_state,devzone)
15401540{
1541   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4807, 0x4807,write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this));
1541   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4807, 0x4807,write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this));
15421542}
15431543
15441544
15451545DRIVER_INIT_MEMBER(cosmic_state,nomnlnd)
15461546{
15471547   dac_device *dac = machine().device<dac_device>("dac");
1548   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x5000, 0x5001, read8_delegate(FUNC(cosmic_state::nomnlnd_port_0_1_r),this));
1549   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x4800, 0x4800);
1550   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4807, 0x4807, write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this));
1551   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x480a, 0x480a, write8_delegate(FUNC(dac_device::write_unsigned8),dac));
1548   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x5000, 0x5001, read8_delegate(FUNC(cosmic_state::nomnlnd_port_0_1_r),this));
1549   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x4800, 0x4800);
1550   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4807, 0x4807, write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this));
1551   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x480a, 0x480a, write8_delegate(FUNC(dac_device::write_unsigned8),dac));
15521552}
15531553
15541554DRIVER_INIT_MEMBER(cosmic_state,panic)
trunk/src/mame/drivers/model2.c
r18027r18028
52245224
52255225DRIVER_INIT_MEMBER(model2_state,genprot)
52265226{
5227   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5227   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
52285228   m_protstate = m_protpos = 0;
52295229}
52305230
r18027r18028
52325232{
52335233   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
52345234
5235   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5235   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
52365236   m_protstate = m_protpos = 0;
52375237
52385238   // fix bug in program: it destroys the interrupt table and never fixes it
r18027r18028
52435243{
52445244   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
52455245
5246   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5246   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
52475247   m_protstate = m_protpos = 0;
52485248
52495249   // fix bug in program: it destroys the interrupt table and never fixes it
r18027r18028
52525252
52535253DRIVER_INIT_MEMBER(model2_state,daytonam)
52545254{
5255   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x240000, 0x24ffff, read32_delegate(FUNC(model2_state::maxx_r),this));
5255   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x240000, 0x24ffff, read32_delegate(FUNC(model2_state::maxx_r),this));
52565256}
52575257
52585258/* very crude support for let the game set itself into stand-alone mode */
r18027r18028
52855285{
52865286   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
52875287
5288   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5289   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
5288   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5289   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
52905290
52915291   m_protstate = m_protpos = 0;
52925292
r18027r18028
52965296
52975297DRIVER_INIT_MEMBER(model2_state,overrev)
52985298{
5299   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
5299   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
53005300
53015301   //TODO: cache patch?
53025302}
r18027r18028
53065306{
53075307   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
53085308
5309   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
5309   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(model2_state::model2_prot_r),this), write32_delegate(FUNC(model2_state::model2_prot_w),this));
53105310   m_protstate = m_protpos = 0;
53115311
53125312   ROM[0x630/4] = 0x08000004;
r18027r18028
53155315
53165316DRIVER_INIT_MEMBER(model2_state,rchase2)
53175317{
5318   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01c00008, 0x01c0000b, write32_delegate(FUNC(model2_state::rchase2_devices_w),this));
5318   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01c00008, 0x01c0000b, write32_delegate(FUNC(model2_state::rchase2_devices_w),this));
53195319}
53205320
53215321DRIVER_INIT_MEMBER(model2_state,srallyc)
53225322{
5323   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01c00008, 0x01c0000b, write32_delegate(FUNC(model2_state::srallyc_devices_w),this));
5323   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01c00008, 0x01c0000b, write32_delegate(FUNC(model2_state::srallyc_devices_w),this));
53245324}
53255325
53265326
trunk/src/mame/drivers/ataxx.c
r18027r18028
711711   leland_rotate_memory(machine(), "slave");
712712
713713   /* set up additional input ports */
714   machine().device("master")->memory().space(AS_IO)->install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this));
714   machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this));
715715}
716716
717717
r18027r18028
721721   leland_rotate_memory(machine(), "slave");
722722
723723   /* set up additional input ports */
724   machine().device("master")->memory().space(AS_IO)->install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this));
724   machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this));
725725}
726726
727727
r18027r18028
731731   leland_rotate_memory(machine(), "slave");
732732
733733   /* set up additional input ports */
734   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P1_P2");
735   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P3_P4");
736   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "BUTTONS");
734   machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P1_P2");
735   machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P3_P4");
736   machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "BUTTONS");
737737}
738738
739739
r18027r18028
743743   leland_rotate_memory(machine(), "slave");
744744
745745   /* set up additional input ports */
746   machine().device("master")->memory().space(AS_IO)->install_read_handler(0x00, 0x02, read8_delegate(FUNC(leland_state::indyheat_wheel_r),this));
747   machine().device("master")->memory().space(AS_IO)->install_read_handler(0x08, 0x0b, read8_delegate(FUNC(leland_state::indyheat_analog_r),this));
748   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P1");
749   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P2");
750   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "P3");
746   machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x02, read8_delegate(FUNC(leland_state::indyheat_wheel_r),this));
747   machine().device("master")->memory().space(AS_IO).install_read_handler(0x08, 0x0b, read8_delegate(FUNC(leland_state::indyheat_analog_r),this));
748   machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P1");
749   machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P2");
750   machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "P3");
751751
752752   /* set up additional output ports */
753   machine().device("master")->memory().space(AS_IO)->install_write_handler(0x08, 0x0b, write8_delegate(FUNC(leland_state::indyheat_analog_w),this));
753   machine().device("master")->memory().space(AS_IO).install_write_handler(0x08, 0x0b, write8_delegate(FUNC(leland_state::indyheat_analog_w),this));
754754}
755755
756756
r18027r18028
760760   leland_rotate_memory(machine(), "slave");
761761
762762   /* set up additional input ports */
763   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P2");
764   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P1");
765   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "P3");
763   machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P2");
764   machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P1");
765   machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "P3");
766766}
767767
768768
r18027r18028
772772   leland_rotate_memory(machine(), "slave");
773773
774774   /* asylum appears to have some extra RAM for the slave CPU */
775   machine().device("slave")->memory().space(AS_PROGRAM)->install_ram(0xf000, 0xfffb);
775   machine().device("slave")->memory().space(AS_PROGRAM).install_ram(0xf000, 0xfffb);
776776
777777   /* set up additional input ports */
778   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P2");
779   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P1");
780   machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "P3");
778   machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P2");
779   machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P1");
780   machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "P3");
781781}
782782
783783
trunk/src/mame/drivers/gstream.c
r18027r18028
640640
641641DRIVER_INIT_MEMBER(gstream_state,gstream)
642642{
643   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd1ee0, 0xd1ee3, read32_delegate(FUNC(gstream_state::gstream_speedup_r), this));
643   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd1ee0, 0xd1ee3, read32_delegate(FUNC(gstream_state::gstream_speedup_r), this));
644644}
645645
646646
trunk/src/mame/drivers/cps2.c
r18027r18028
81428142
81438143   save_item(NAME(m_readpaddle));
81448144
8145   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x804000, 0x804001, FUNC(joy_or_paddle_r));
8145   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x804000, 0x804001, FUNC(joy_or_paddle_r));
81468146}
81478147
81488148static READ16_HANDLER( gigaman2_dummyqsound_r )
r18027r18028
81768176
81778177DRIVER_INIT_MEMBER(cps_state,gigaman2)
81788178{
8179   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
8179   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
81808180   UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
81818181   int length = memregion("maincpu")->bytes();
81828182
r18027r18028
81878187   m_gigaman2_dummyqsound_ram = auto_alloc_array(machine(), UINT16, 0x20000 / 2);
81888188   save_pointer(NAME(m_gigaman2_dummyqsound_ram), 0x20000 / 2);
81898189
8190   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x618000, 0x619fff, FUNC(gigaman2_dummyqsound_r), FUNC(gigaman2_dummyqsound_w)); // no qsound..
8190   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x618000, 0x619fff, FUNC(gigaman2_dummyqsound_r), FUNC(gigaman2_dummyqsound_w)); // no qsound..
81918191   space.set_decrypted_region(0x000000, (length) - 1, &rom[length/4]);
81928192   m68k_set_encrypted_opcode_range(machine().device("maincpu"), 0, length);
81938193}
trunk/src/mame/drivers/igs017.c
r18027r18028
797797   starzan_decrypt(data, size, false);   // data
798798   starzan_decrypt(code, size, true);   // opcodes
799799
800   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_decrypted_region(0x00000, 0x3ffff, code);
800   machine().device("maincpu")->memory().space(AS_PROGRAM).set_decrypted_region(0x00000, 0x3ffff, code);
801801
802802   mgcs_flip_sprites(machine());
803803}
r18027r18028
33933393MACHINE_RESET_MEMBER(igs017_state,lhzb2a)
33943394{
33953395   MACHINE_RESET_CALL_MEMBER( mgcs );
3396   lhzb2a_input_addr_w(*m_maincpu->space(AS_PROGRAM), 0, 0xf0);
3396   lhzb2a_input_addr_w(m_maincpu->space(AS_PROGRAM), 0, 0xf0);
33973397}
33983398
33993399static MACHINE_CONFIG_START( lhzb2a, igs017_state )
trunk/src/mame/drivers/namcos12.c
r18027r18028
13181318static void system11gun_install( running_machine &machine )
13191319{
13201320   namcos12_state *state = machine.driver_data<namcos12_state>();
1321   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f788000, 0x1f788003, write32_delegate(FUNC(namcos12_state::system11gun_w),state));
1322   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler (0x1f780000, 0x1f78000f, read32_delegate(FUNC(namcos12_state::system11gun_r),state));
1321   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1f788000, 0x1f788003, write32_delegate(FUNC(namcos12_state::system11gun_w),state));
1322   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x1f780000, 0x1f78000f, read32_delegate(FUNC(namcos12_state::system11gun_r),state));
13231323}
13241324
13251325WRITE32_MEMBER(namcos12_state::kcoff_w)
r18027r18028
13861386
13871387MACHINE_RESET_MEMBER(namcos12_state,namcos12)
13881388{
1389   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1389   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
13901390   bankoffset_w(space,0,0,0xffffffff);
13911391
13921392   space.install_write_handler(0x1f801000, 0x1f801003, write32_delegate(FUNC(namcos12_state::s12_dma_bias_w),this));
trunk/src/mame/drivers/jangou.c
r18027r18028
13631363
13641364DRIVER_INIT_MEMBER(jangou_state,jngolady)
13651365{
1366   machine().device("nsc")->memory().space(AS_PROGRAM)->install_read_handler(0x08, 0x08, read8_delegate(FUNC(jangou_state::jngolady_rng_r),this) );
1366   machine().device("nsc")->memory().space(AS_PROGRAM).install_read_handler(0x08, 0x08, read8_delegate(FUNC(jangou_state::jngolady_rng_r),this) );
13671367}
13681368
13691369DRIVER_INIT_MEMBER(jangou_state,luckygrl)
trunk/src/mame/drivers/gameplan.c
r18027r18028
187187
188188WRITE8_MEMBER(gameplan_state::r6532_soundlatch_w)
189189{
190   address_space *progspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
191   soundlatch_byte_w(*progspace, 0, data);
190   address_space &progspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
191   soundlatch_byte_w(progspace, 0, data);
192192}
193193
194194
trunk/src/mame/drivers/pengadvb.c
r18027r18028
6767   {
6868      case 0:
6969         // BIOS
70         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1" );
70         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1" );
7171         state->membank("bank1")->set_base(state->memregion("maincpu")->base());
7272         break;
7373
7474      default:
75         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0x0000, 0x3fff);
75         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x0000, 0x3fff);
7676         break;
7777   }
7878
r18027r18028
8181   {
8282      case 0:
8383         // BIOS
84         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x5fff, "bank21" );
85         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x6000, 0x7fff, "bank22" );
84         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
85         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
8686         state->membank("bank21")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000);
8787         state->membank("bank22")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000 + 0x2000);
8888         break;
8989
9090      case 1:
9191         // game
92         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x5fff, "bank21" );
93         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x6000, 0x7fff, "bank22" );
92         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
93         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
9494         state->membank("bank21")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[0]*0x2000);
9595         state->membank("bank22")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[1]*0x2000);
9696         break;
9797
9898      default:
99         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0x4000, 0x7fff);
99         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x4000, 0x7fff);
100100         break;
101101   }
102102
r18027r18028
105105   {
106106      case 1:
107107         // game
108         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x9fff, "bank31" );
109         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xbfff, "bank32" );
108         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0x9fff, "bank31" );
109         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xbfff, "bank32" );
110110         state->membank("bank31")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[2]*0x2000);
111111         state->membank("bank32")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[3]*0x2000);
112112         break;
113113
114114      default:
115         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0x8000, 0xbfff);
115         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x8000, 0xbfff);
116116         break;
117117   }
118118
r18027r18028
121121   {
122122      case 3:
123123         // RAM
124         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc000, 0xffff, "bank4" );
124         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xffff, "bank4" );
125125         state->membank("bank4")->set_base(state->m_main_mem);
126126         break;
127127
128128      default:
129         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0xc000, 0xffff);
129         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0xc000, 0xffff);
130130         break;
131131   }
132132}
trunk/src/mame/drivers/beathead.c
r18027r18028
532532   atarijsa_init(machine(), "IN2", 0x0040);
533533
534534   /* prepare the speedups */
535   m_speedup_data = m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), this));
536   m_movie_speedup_data = m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), this));
535   m_speedup_data = m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), this));
536   m_movie_speedup_data = m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), this));
537537}
538538
539539
trunk/src/mame/drivers/lastbank.c
r18027r18028
137137
138138UINT8 lastbank_state::ram_bank_r(UINT16 offset, UINT8 bank_num)
139139{
140   address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
141   return vdp_space->read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);;
140   address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
141   return vdp_space.read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);;
142142}
143143
144144void lastbank_state::ram_bank_w(UINT16 offset, UINT8 data, UINT8 bank_num)
145145{
146   address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
147   vdp_space->write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);;
146   address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
147   vdp_space.write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);;
148148}
149149
150150READ8_MEMBER(lastbank_state::lastbank_ram_0_r) { return ram_bank_r(offset, 0); }
trunk/src/mame/drivers/qix.c
r18027r18028
12561256
12571257DRIVER_INIT_MEMBER(qix_state,kram3)
12581258{
1259   address_space *mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1260   address_space *videospace = machine().device("videocpu")->memory().space(AS_PROGRAM);
1259   address_space &mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1260   address_space &videospace = machine().device("videocpu")->memory().space(AS_PROGRAM);
12611261   //const UINT8 *patch;
12621262   UINT8 *rom, *decrypted;
12631263   int i;
r18027r18028
12811281   rom = machine().root_device().memregion("maincpu")->base();
12821282   decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
12831283
1284   mainspace->set_decrypted_region(0xa000, 0xffff, decrypted);
1284   mainspace.set_decrypted_region(0xa000, 0xffff, decrypted);
12851285
12861286   memcpy(decrypted,&rom[0xa000],0x6000);
12871287   for (i = 0xa000; i < 0x10000; ++i)
r18027r18028
12941294   rom = machine().root_device().memregion("videocpu")->base();
12951295   decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
12961296
1297   videospace->set_decrypted_region(0xa000, 0xffff, decrypted);
1297   videospace.set_decrypted_region(0xa000, 0xffff, decrypted);
12981298
12991299   memcpy(decrypted,&rom[0xa000],0x6000);
13001300   for (i = 0xa000; i < 0x10000; ++i)
trunk/src/mame/drivers/adp.c
r18027r18028
280280   adp_state *state = device->machine().driver_data<adp_state>();
281281   if (channel == 0)
282282   {
283      state->m_microtouch->rx(*device->machine().memory().first_space(), 0, data);
283      state->m_microtouch->rx(device->machine().driver_data()->generic_space(), 0, data);
284284   }
285285}
286286
trunk/src/mame/drivers/snesb.c
r18027r18028
662662   }
663663
664664   m_shared_ram = auto_alloc_array(machine(), INT8, 0x100);
665   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x781000, 0x7810ff, read8_delegate(FUNC(snesb_state::sharedram_r),this), write8_delegate(FUNC(snesb_state::sharedram_w),this));
665   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x781000, 0x7810ff, read8_delegate(FUNC(snesb_state::sharedram_r),this), write8_delegate(FUNC(snesb_state::sharedram_w),this));
666666
667667   /* extra inputs */
668   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
669   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
670   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
668   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
669   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
670   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
671671
672672   DRIVER_INIT_CALL(snes_hirom);
673673}
r18027r18028
708708   rom[0x7ffc] = 0x54;
709709
710710   /* extra inputs */
711   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
712   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
713   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
711   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
712   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
713   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
714714
715715   DRIVER_INIT_CALL(snes);
716716}
r18027r18028
733733   }
734734
735735   /* extra inputs */
736   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
737   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
738   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
736   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
737   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
738   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
739739
740740   DRIVER_INIT_CALL(snes);
741741}
r18027r18028
764764   rom[0xfffd] = 0xf7;
765765
766766   /* extra inputs */
767   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
768   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
769   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
767   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
768   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
769   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
770770
771771   DRIVER_INIT_CALL(snes_hirom);
772772}
r18027r18028
824824   dst[0xfffd] = 0x7a;
825825
826826   /*  protection checks */
827   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x75bd37, 0x75bd37, read8_delegate(FUNC(snesb_state::sb2b_75bd37_r),this));
828   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6a6000, 0x6a6fff, read8_delegate(FUNC(snesb_state::sb2b_6a6xxx_r),this));
827   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x75bd37, 0x75bd37, read8_delegate(FUNC(snesb_state::sb2b_75bd37_r),this));
828   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6a6000, 0x6a6fff, read8_delegate(FUNC(snesb_state::sb2b_6a6xxx_r),this));
829829
830830   /* handler to read boot code */
831   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x007000, 0x007fff, read8_delegate(FUNC(snesb_state::sb2b_7xxx_r),this));
831   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x007000, 0x007fff, read8_delegate(FUNC(snesb_state::sb2b_7xxx_r),this));
832832
833833   /* extra inputs */
834   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
835   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
836   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
834   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770071, 0x770071, read8_delegate(FUNC(snesb_state::snesb_dsw1_r),this));
835   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770073, 0x770073, read8_delegate(FUNC(snesb_state::snesb_dsw2_r),this));
836   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x770079, 0x770079, read8_delegate(FUNC(snesb_state::snesb_coin_r),this));
837837
838838   DRIVER_INIT_CALL(snes_hirom);
839839}
trunk/src/mame/drivers/cinemat.c
r18027r18028
14481448DRIVER_INIT_MEMBER(cinemat_state,speedfrk)
14491449{
14501450   m_gear = 0xe;
1451   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x03, read8_delegate(FUNC(cinemat_state::speedfrk_wheel_r),this));
1452   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x04, 0x06, read8_delegate(FUNC(cinemat_state::speedfrk_gear_r),this));
1451   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(cinemat_state::speedfrk_wheel_r),this));
1452   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x04, 0x06, read8_delegate(FUNC(cinemat_state::speedfrk_gear_r),this));
14531453}
14541454
14551455
14561456DRIVER_INIT_MEMBER(cinemat_state,sundance)
14571457{
1458   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x0f, read8_delegate(FUNC(cinemat_state::sundance_inputs_r),this));
1458   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x0f, read8_delegate(FUNC(cinemat_state::sundance_inputs_r),this));
14591459}
14601460
14611461
14621462DRIVER_INIT_MEMBER(cinemat_state,tailg)
14631463{
1464   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this));
1464   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this));
14651465}
14661466
14671467
14681468DRIVER_INIT_MEMBER(cinemat_state,boxingb)
14691469{
1470   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0c, 0x0f, read8_delegate(FUNC(cinemat_state::boxingb_dial_r),this));
1471   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this));
1470   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0c, 0x0f, read8_delegate(FUNC(cinemat_state::boxingb_dial_r),this));
1471   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this));
14721472}
14731473
14741474
14751475DRIVER_INIT_MEMBER(cinemat_state,qb3)
14761476{
1477   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0f, 0x0f, read8_delegate(FUNC(cinemat_state::qb3_frame_r),this));
1478   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x00, 0x00, write8_delegate(FUNC(cinemat_state::qb3_ram_bank_w),this));
1477   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0f, 0x0f, read8_delegate(FUNC(cinemat_state::qb3_frame_r),this));
1478   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x00, 0x00, write8_delegate(FUNC(cinemat_state::qb3_ram_bank_w),this));
14791479
14801480   membank("bank1")->configure_entries(0, 4, m_rambase, 0x100*2);
14811481}
trunk/src/mame/drivers/su2000.c
r18027r18028
260260
261261void su2000_state::machine_start()
262262{
263   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
263   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
264264
265265   m_pit8254 = machine().device("pit8254");
266266   m_pic8259_1 = machine().device("pic8259_1");
r18027r18028
287287   kbdc8042_init(machine(), &at8042);
288288
289289   pc_vga_init(machine(), vga_setting, NULL);
290   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
290   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
291291}
292292
293293void su2000_state::machine_reset()
trunk/src/mame/drivers/crbaloon.c
r18027r18028
339339
340340void crbaloon_state::machine_reset()
341341{
342   address_space &space = *machine().device("maincpu")->memory().space(AS_IO);
342   address_space &space = machine().device("maincpu")->memory().space(AS_IO);
343343   device_t *discrete = machine().device("discrete");
344344
345345   pc3092_reset();
trunk/src/mame/drivers/voyager.c
r18027r18028
801801   m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4);
802802
803803   pc_vga_init(machine(), vga_setting, NULL);
804   pc_svga_trident_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
804   pc_svga_trident_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
805805   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, voyager_set_keyb_int);
806806
807807   intel82439tx_init(machine());
trunk/src/mame/drivers/freekick.c
r18027r18028
11241124
11251125DRIVER_INIT_MEMBER(freekick_state,gigasb)
11261126{
1127   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1127   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
11281128   space.set_decrypted_region(0x0000, 0xbfff, machine().root_device().memregion("maincpu")->base() + 0x10000);
11291129}
11301130
trunk/src/mame/drivers/cischeat.c
r18027r18028
24812481
24822482DRIVER_INIT_MEMBER(cischeat_state,wildplt)
24832483{
2484   machine().device("cpu1")->memory().space(AS_PROGRAM)->install_read_handler(0x080000, 0x087fff, read16_delegate(FUNC(cischeat_state::wildplt_vregs_r),this));
2484   machine().device("cpu1")->memory().space(AS_PROGRAM).install_read_handler(0x080000, 0x087fff, read16_delegate(FUNC(cischeat_state::wildplt_vregs_r),this));
24852485
24862486   DRIVER_INIT_CALL(f1gpstar);
24872487}
trunk/src/mame/drivers/metro.c
r18027r18028
133133static void update_irq_state( running_machine &machine )
134134{
135135   metro_state *state = machine.driver_data<metro_state>();
136   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
136   address_space &space = state->m_maincpu->space(AS_PROGRAM);
137137
138138   /*  Get the pending IRQs (only the enabled ones, e.g. where irq_enable is *0*)  */
139139   UINT16 irq = state->metro_irq_cause_r(space, 0, 0xffff) & ~*state->m_irq_enable;
r18027r18028
262262static int metro_io_callback( device_t *device, int ioline, int state )
263263{
264264   metro_state *driver_state = device->machine().driver_data<metro_state>();
265   address_space &space = *driver_state->m_maincpu->space(AS_PROGRAM);
265   address_space &space = driver_state->m_maincpu->space(AS_PROGRAM);
266266   UINT8 data = 0;
267267
268268   switch (ioline)
r18027r18028
59415941
59425942DRIVER_INIT_MEMBER(metro_state,metro)
59435943{
5944   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
5944   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
59455945
59465946   metro_common(machine());
59475947
r18027r18028
59685968
59695969DRIVER_INIT_MEMBER(metro_state,daitorid)
59705970{
5971   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
5971   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
59725972
59735973   metro_common(machine());
59745974
trunk/src/mame/drivers/hshavoc.c
r18027r18028
218218*/
219219
220220   {
221      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
221      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
222222      space.nop_write(0x200000, 0x201fff);
223223   }
224224
trunk/src/mame/drivers/attckufo.c
r18027r18028
9696
9797READ8_MEMBER(attckufo_state::vic_videoram_r)
9898{
99   return m_maincpu->space(AS_PROGRAM)->read_byte(offset);
99   return m_maincpu->space(AS_PROGRAM).read_byte(offset);
100100}
101101
102102READ8_MEMBER(attckufo_state::vic_colorram_r)
103103{
104   return m_maincpu->space(AS_PROGRAM)->read_byte(offset + 0x400);
104   return m_maincpu->space(AS_PROGRAM).read_byte(offset + 0x400);
105105}
106106
107107static ADDRESS_MAP_START( cpu_map, AS_PROGRAM, 8, attckufo_state )
trunk/src/mame/drivers/littlerb.c
r18027r18028
303303{
304304   littlerb_state *state = machine.driver_data<littlerb_state>();
305305   UINT32 addr = state->m_write_address >> 3; // almost surely raw addresses are actually shifted by 3
306   address_space *vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
306   address_space &vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
307307
308   return vdp_space->read_word(addr, mem_mask);
308   return vdp_space.read_word(addr, mem_mask);
309309}
310310
311311static void littlerb_data_write(running_machine &machine, UINT16 data, UINT16 mem_mask)
312312{
313313   littlerb_state *state = machine.driver_data<littlerb_state>();
314314   UINT32 addr = state->m_write_address >> 3; // almost surely raw addresses are actually shifted by 3
315   address_space *vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
315   address_space &vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
316316   int mode = state->m_vdp_writemode;
317317
318318
r18027r18028
323323   }
324324   else
325325   {
326      vdp_space->write_word(addr, data, mem_mask);
326      vdp_space.write_word(addr, data, mem_mask);
327327
328328      // 2000 is used for palette writes which appears to be a RAMDAC, no auto-inc.
329329      //  1ff80806 is our 'spritelist'
r18027r18028
612612{
613613   int x,y;
614614   fulloffs >>= 3;
615   address_space *vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
615   address_space &vdp_space = machine.device<littlerb_vdp_device>("littlerbvdp")->space();
616616
617617   for (y=0;y<ysize;y++)
618618   {
r18027r18028
620620      {
621621         int drawxpos, drawypos;
622622         // the addresses provided are the same as the offsets as the vdp writes
623         UINT16 pix = vdp_space->read_byte(fulloffs);
623         UINT16 pix = vdp_space.read_byte(fulloffs);
624624
625625         drawxpos = xpos+x;
626626         drawypos = ypos+y;
trunk/src/mame/drivers/eolith.c
r18027r18028
14811481
14821482DRIVER_INIT_MEMBER(eolith_state,hidctch3)
14831483{
1484   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xfc200000, 0xfc200003); // this generates pens vibration
1484   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xfc200000, 0xfc200003); // this generates pens vibration
14851485
14861486   // It is not clear why the first reads are needed too
14871487
1488   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfce00000, 0xfce00003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this));
1489   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfce80000, 0xfce80003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this));
1488   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfce00000, 0xfce00003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this));
1489   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfce80000, 0xfce80003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this));
14901490
1491   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfcf00000, 0xfcf00003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this));
1492   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfcf80000, 0xfcf80003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this));
1491   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfcf00000, 0xfcf00003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this));
1492   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfcf80000, 0xfcf80003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this));
14931493
14941494   DRIVER_INIT_CALL(eolith);
14951495}
trunk/src/mame/drivers/chihiro.c
r18027r18028
448448      memset(pmc,0,sizeof(pmc));
449449      memset(ramin,0,sizeof(ramin));
450450      computedilated();
451      video_memory=(UINT32 *)machine.firstcpu->space()->get_read_ptr(0xf0000000);
451      video_memory=(UINT32 *)machine.firstcpu->space().get_read_ptr(0xf0000000);
452452      fb.allocate(640,480);
453453      objectdata=&(object_data_alloc());
454454      objectdata->data=this;
r18027r18028
717717
718718static void jamtable_disasm_command(running_machine &machine, int ref, int params, const char **param)
719719{
720   address_space &space=*machine.firstcpu->space();
720   address_space &space=machine.firstcpu->space();
721721   UINT64   addr,size;
722722
723723   if (params < 2)
r18027r18028
731731
732732static void dump_string_command(running_machine &machine, int ref, int params, const char **param)
733733{
734   address_space &space=*machine.firstcpu->space();
734   address_space &space=machine.firstcpu->space();
735735   UINT64   addr;
736736   offs_t address;
737737   UINT32 length,maximumlength;
r18027r18028
770770
771771static void dump_process_command(running_machine &machine, int ref, int params, const char **param)
772772{
773   address_space &space=*machine.firstcpu->space();
773   address_space &space=machine.firstcpu->space();
774774   UINT64 addr;
775775   offs_t address;
776776
r18027r18028
796796
797797static void dump_list_command(running_machine &machine, int ref, int params, const char **param)
798798{
799   address_space &space=*machine.firstcpu->space();
799   address_space &space=machine.firstcpu->space();
800800   UINT64 addr,offs,start,old;
801801   offs_t address,offset;
802802
r18027r18028
13651365READ32_MEMBER( chihiro_state::usbctrl_r )
13661366{
13671367   if (offset == 0) { /* hack needed until usb (and jvs) is implemented */
1368      chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x6a79f,0x01);
1369      chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x6a7a0,0x00);
1368      chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x6a79f,0x01);
1369      chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x6a7a0,0x00);
13701370   }
13711371#ifdef LOG_OHCI
13721372   if (offset >= 0x54/4)
r18027r18028
16891689      // hack to avoid hanging if eeprom contents are not correct
16901690      // this would need dumping the serial eeprom on the xbox board
16911691      if (command == 0) {
1692         chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b744,0x90);
1693         chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b745,0x90);
1694         chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b766,0xc9);
1695         chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b767,0xc3);
1692         chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b744,0x90);
1693         chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b745,0x90);
1694         chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b766,0xc9);
1695         chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b767,0xc3);
16961696      }
16971697      data = dummyeeprom[command]+dummyeeprom[command+1]*256;
16981698      logerror("eeprom: %d %d %d\n",command,rw,data);
trunk/src/mame/drivers/commando.c
r18027r18028
511511
512512DRIVER_INIT_MEMBER(commando_state,commando)
513513{
514   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
514   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
515515   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
516516   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000);
517517   int A;
r18027r18028
531531
532532DRIVER_INIT_MEMBER(commando_state,spaceinv)
533533{
534   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
534   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
535535   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
536536   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000);
537537   int A;
trunk/src/mame/drivers/atarisy2.c
r18027r18028
242242   atarigen_sound_io_reset(machine().device("soundcpu"));
243243   atarigen_scanline_timer_reset(*machine().primary_screen, scanline_update, 64);
244244
245   address_space *main = machine().device<t11_device>("maincpu")->space(AS_PROGRAM);
246   main->set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this));
245   address_space &main = machine().device<t11_device>("maincpu")->space(AS_PROGRAM);
246   main.set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this));
247247
248248   m_p2portwr_state = 0;
249249   m_p2portrd_state = 0;
r18027r18028
340340
341341static void bankselect_postload(running_machine &machine)
342342{
343   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
343   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
344344   atarisy2_state *state = machine.driver_data<atarisy2_state>();
345345
346346   state->bankselect_w(space, 0, state->m_bankselect[0], 0xffff);
trunk/src/mame/drivers/skydiver.c
r18027r18028
148148   device_t *discrete = machine().device("discrete");
149149
150150   /* Convert range data to divide value and write to sound */
151   address_space &space = *machine().firstcpu->space(AS_PROGRAM);
151   address_space &space = machine().firstcpu->space(AS_PROGRAM);
152152   discrete_sound_w(discrete, space, SKYDIVER_RANGE_DATA, (0x01 << (~m_videoram[0x394] & 0x07)) & 0xff);   // Range 0-2
153153
154154   discrete_sound_w(discrete, space, SKYDIVER_RANGE3_EN,  m_videoram[0x394] & 0x08);      // Range 3 - note disable
trunk/src/mame/drivers/ninjakd2.c
r18027r18028
14691469
14701470DRIVER_INIT_MEMBER(ninjakd2_state,bootleg)
14711471{
1472   address_space &space = *machine().device("soundcpu")->memory().space(AS_PROGRAM);
1472   address_space &space = machine().device("soundcpu")->memory().space(AS_PROGRAM);
14731473   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("soundcpu")->base() + 0x10000);
14741474
14751475   gfx_unscramble(machine());
trunk/src/mame/drivers/spacefb.c
r18027r18028
180180
181181void spacefb_state::machine_reset()
182182{
183   address_space &space = *machine().device("maincpu")->memory().space(AS_IO);
183   address_space &space = machine().device("maincpu")->memory().space(AS_IO);
184184   /* the 3 output ports are cleared on reset */
185185   spacefb_port_0_w(space, 0, 0);
186186   spacefb_port_1_w(space, 0, 0);
trunk/src/mame/drivers/jaguar.c
r18027r18028
22732273
22742274   /* install synchronization hooks for GPU */
22752275   if (m_is_r3000)
2276      m_main_cpu->space(AS_PROGRAM)->install_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this));
2276      m_main_cpu->space(AS_PROGRAM).install_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this));
22772277   else
2278      m_main_cpu->space(AS_PROGRAM)->install_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this));
2279   m_gpu->space(AS_PROGRAM)->install_read_handler(0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, read32_delegate(FUNC(jaguar_state::gpu_jump_r), this));
2278      m_main_cpu->space(AS_PROGRAM).install_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this));
2279   m_gpu->space(AS_PROGRAM).install_read_handler(0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, read32_delegate(FUNC(jaguar_state::gpu_jump_r), this));
22802280   m_gpu_jump_address = &m_gpu_ram[gpu_jump_offs/4];
22812281   m_gpu_spin_pc = 0xf03000 + spin_pc;
22822282
r18027r18028
22942294
22952295#if ENABLE_SPEEDUP_HACKS
22962296   /* install speedup for main CPU */
2297   m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this));
2297   m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this));
22982298#endif
22992299}
23002300
r18027r18028
23072307#if ENABLE_SPEEDUP_HACKS
23082308   /* install speedup for main CPU */
23092309   m_main_speedup_max_cycles = 120;
2310   m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
2310   m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
23112311#endif
23122312}
23132313
r18027r18028
23222322#if ENABLE_SPEEDUP_HACKS
23232323   /* install speedup for main CPU */
23242324   m_main_speedup_max_cycles = 120;
2325   m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
2325   m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
23262326#endif
23272327}
23282328
r18027r18028
23372337
23382338#if ENABLE_SPEEDUP_HACKS
23392339   /* install speedup for main CPU */
2340   m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this));
2340   m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this));
23412341#endif
23422342}
23432343
r18027r18028
23532353#if ENABLE_SPEEDUP_HACKS
23542354   /* install speedup for main CPU */
23552355   m_main_speedup_max_cycles = 120;
2356   m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
2356   m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
23572357#endif
23582358}
23592359
r18027r18028
23662366#if ENABLE_SPEEDUP_HACKS
23672367   /* install speedup for main CPU */
23682368   m_main_speedup_max_cycles = 200;
2369   m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
2369   m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
23702370#endif
23712371}
23722372
r18027r18028
23792379   /* install speedup for main CPU */
23802380   m_main_speedup_max_cycles = 200;
23812381   if (main_speedup_addr != 0)
2382      m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this));
2383   m_main_gpu_wait = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this));
2382      m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this));
2383   m_main_gpu_wait = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this));
23842384#endif
23852385}
23862386
r18027r18028
23992399#if ENABLE_SPEEDUP_HACKS
24002400   /* install speedup for main CPU */
24012401   m_main_speedup_max_cycles = 50;
2402   m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
2402   m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this));
24032403#endif
24042404}
24052405
trunk/src/mame/drivers/gng.c
r18027r18028
764764
765765DRIVER_INIT_MEMBER(gng_state,diamond)
766766{
767   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6000, 0x6000, read8_delegate(FUNC(gng_state::diamond_hack_r),this));
767   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, read8_delegate(FUNC(gng_state::diamond_hack_r),this));
768768}
769769
770770
trunk/src/mame/drivers/liberate.c
r18027r18028
6969   m_bank = data;
7070
7171   if (m_bank)
72      m_maincpu->space(AS_PROGRAM)->install_read_handler(0x8000, 0x800f, read8_delegate(FUNC(liberate_state::deco16_io_r),this));
72      m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0x800f, read8_delegate(FUNC(liberate_state::deco16_io_r),this));
7373   else
74      m_maincpu->space(AS_PROGRAM)->install_read_bank(0x8000, 0x800f, "bank1");
74      m_maincpu->space(AS_PROGRAM).install_read_bank(0x8000, 0x800f, "bank1");
7575}
7676
7777READ8_MEMBER(liberate_state::prosoccr_bank_r)
r18027r18028
174174   m_bank = data & 1;
175175
176176   if (m_bank)
177      m_maincpu->space(AS_PROGRAM)->install_read_handler(0x8000, 0x800f, read8_delegate(FUNC(liberate_state::deco16_io_r),this));
177      m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0x800f, read8_delegate(FUNC(liberate_state::deco16_io_r),this));
178178   else
179      m_maincpu->space(AS_PROGRAM)->install_read_handler(0x8000, 0x800f, read8_delegate(FUNC(liberate_state::prosoccr_charram_r),this));
179      m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0x800f, read8_delegate(FUNC(liberate_state::prosoccr_charram_r),this));
180180
181181}
182182
r18027r18028
13451345
13461346static void sound_cpu_decrypt(running_machine &machine)
13471347{
1348   address_space &space = *machine.device("audiocpu")->memory().space(AS_PROGRAM);
1348   address_space &space = machine.device("audiocpu")->memory().space(AS_PROGRAM);
13491349   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
13501350   UINT8 *rom = machine.root_device().memregion("audiocpu")->base();
13511351   int i;
r18027r18028
13731373{
13741374   DRIVER_INIT_CALL(prosport);
13751375
1376   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0xa000, 0xa000, "IN0");
1376   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0xa000, 0xa000, "IN0");
13771377}
13781378
13791379DRIVER_INIT_MEMBER(liberate_state,liberate)
13801380{
13811381   int A;
1382   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1382   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
13831383   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x10000);
13841384   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
13851385
trunk/src/mame/drivers/seta.c
r18027r18028
31763176
31773177MACHINE_RESET_MEMBER(seta_state,calibr50)
31783178{
3179   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3179   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
31803180   sub_bankswitch_w(space, 0, 0);
31813181}
31823182
r18027r18028
1072110721DRIVER_INIT_MEMBER(seta_state,twineagl)
1072210722{
1072310723   /* debug? */
10724   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x800000, 0x8000ff, read16_delegate(FUNC(seta_state::twineagl_debug_r),this));
10724   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800000, 0x8000ff, read16_delegate(FUNC(seta_state::twineagl_debug_r),this));
1072510725
1072610726   /* This allows 2 simultaneous players and the use of the "Copyright" Dip Switch. */
10727   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x200100, 0x20010f, read16_delegate(FUNC(seta_state::twineagl_200100_r),this), write16_delegate(FUNC(seta_state::twineagl_200100_w),this));
10727   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x200100, 0x20010f, read16_delegate(FUNC(seta_state::twineagl_200100_r),this), write16_delegate(FUNC(seta_state::twineagl_200100_w),this));
1072810728}
1072910729
1073010730
r18027r18028
1075310753
1075410754DRIVER_INIT_MEMBER(seta_state,downtown)
1075510755{
10756   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x200000, 0x2001ff, read16_delegate(FUNC(seta_state::downtown_protection_r),this), write16_delegate(FUNC(seta_state::downtown_protection_w),this));
10756   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x200000, 0x2001ff, read16_delegate(FUNC(seta_state::downtown_protection_r),this), write16_delegate(FUNC(seta_state::downtown_protection_w),this));
1075710757}
1075810758
1075910759
r18027r18028
1077310773
1077410774DRIVER_INIT_MEMBER(seta_state,arbalest)
1077510775{
10776   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80000, 0x8000f, read16_delegate(FUNC(seta_state::arbalest_debug_r),this));
10776   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80000, 0x8000f, read16_delegate(FUNC(seta_state::arbalest_debug_r),this));
1077710777}
1077810778
1077910779
r18027r18028
1078210782   UINT16 *RAM = (UINT16 *) machine().root_device().memregion("maincpu")->base();
1078310783
1078410784   /* This game uses the 21c000-21ffff area for protection? */
10785//  machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x21c000, 0x21ffff);
10785//  machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x21c000, 0x21ffff);
1078610786
1078710787   RAM[0x8ab1c/2] = 0x4e71;   // patch protection test: "cp error"
1078810788   RAM[0x8ab1e/2] = 0x4e71;
r18027r18028
1082610826
1082710827DRIVER_INIT_MEMBER(seta_state,eightfrc)
1082810828{
10829   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x500004, 0x500005);   // watchdog??
10829   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x500004, 0x500005);   // watchdog??
1083010830}
1083110831
1083210832
1083310833DRIVER_INIT_MEMBER(seta_state,zombraid)
1083410834{
10835   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf00002, 0xf00003, read16_delegate(FUNC(seta_state::zombraid_gun_r),this));
10836   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xf00000, 0xf00001, write16_delegate(FUNC(seta_state::zombraid_gun_w),this));
10835   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf00002, 0xf00003, read16_delegate(FUNC(seta_state::zombraid_gun_r),this));
10836   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xf00000, 0xf00001, write16_delegate(FUNC(seta_state::zombraid_gun_w),this));
1083710837}
1083810838
1083910839
r18027r18028
1085110851
1085210852DRIVER_INIT_MEMBER(seta_state,rezon)
1085310853{
10854   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x500006, 0x500007);   // irq ack?
10854   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x500006, 0x500007);   // irq ack?
1085510855}
1085610856
1085710857DRIVER_INIT_MEMBER(seta_state,wiggie)
r18027r18028
1088310883   }
1088410884
1088510885   /* X1_010 is not used. */
10886   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x100000, 0x103fff);
10887   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xB00008, 0xB00009, write16_delegate(FUNC(seta_state::wiggie_soundlatch_w),this));
10886   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x100000, 0x103fff);
10887   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xB00008, 0xB00009, write16_delegate(FUNC(seta_state::wiggie_soundlatch_w),this));
1088810888
1088910889}
1089010890
trunk/src/mame/drivers/asteroid.c
r18027r18028
951951
952952DRIVER_INIT_MEMBER(asteroid_state,asteroidb)
953953{
954   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2000, 0x2000, "IN0");
955   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2003, 0x2003, "HS");
954   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2000, 0x2000, "IN0");
955   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2003, 0x2003, "HS");
956956}
957957
958958
959959DRIVER_INIT_MEMBER(asteroid_state,asterock)
960960{
961   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2000, 0x2007, read8_delegate(FUNC(asteroid_state::asterock_IN0_r),this));
961   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2000, 0x2007, read8_delegate(FUNC(asteroid_state::asterock_IN0_r),this));
962962}
963963
964964
trunk/src/mame/drivers/stv.c
r18027r18028
343343   sh2drc_set_options(machine().device("maincpu"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
344344   sh2drc_set_options(machine().device("slave"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
345345
346   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stv_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
347   machine().device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stv_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
346   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stv_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
347   machine().device("slave")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stv_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
348348
349349   m_vdp2.pal = 0;
350350}
r18027r18028
352352DRIVER_INIT_MEMBER(saturn_state,critcrsh)
353353{
354354   DRIVER_INIT_CALL(stv);
355   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::critcrsh_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
356   machine().device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::critcrsh_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
355   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::critcrsh_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
356   machine().device("slave")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::critcrsh_ioga_r32),this), write32_delegate(FUNC(saturn_state::stv_ioga_w32),this));
357357}
358358
359359/*
r18027r18028
390390
391391   DRIVER_INIT_CALL(stv);
392392
393   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::magzun_ioga_r32),this), write32_delegate(FUNC(saturn_state::magzun_ioga_w32),this));
394   machine().device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::magzun_ioga_r32),this), write32_delegate(FUNC(saturn_state::magzun_ioga_w32),this));
393   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::magzun_ioga_r32),this), write32_delegate(FUNC(saturn_state::magzun_ioga_w32),this));
394   machine().device("slave")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::magzun_ioga_r32),this), write32_delegate(FUNC(saturn_state::magzun_ioga_w32),this));
395395
396   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x608e830, 0x608e833, read32_delegate(FUNC(saturn_state::magzun_hef_hack_r),this));
397   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60ff3b4, 0x60ff3b7, read32_delegate(FUNC(saturn_state::magzun_rx_hack_r),this));
396   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x608e830, 0x608e833, read32_delegate(FUNC(saturn_state::magzun_hef_hack_r),this));
397   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60ff3b4, 0x60ff3b7, read32_delegate(FUNC(saturn_state::magzun_rx_hack_r),this));
398398
399399   /* Program ROM patches, don't understand how to avoid these two checks ... */
400400   {
r18027r18028
410410DRIVER_INIT_MEMBER(saturn_state,stvmp)
411411{
412412   DRIVER_INIT_CALL(stv);
413   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stvmp_ioga_r32),this), write32_delegate(FUNC(saturn_state::stvmp_ioga_w32),this));
414   machine().device("slave")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stvmp_ioga_r32),this), write32_delegate(FUNC(saturn_state::stvmp_ioga_w32),this));
413   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stvmp_ioga_r32),this), write32_delegate(FUNC(saturn_state::stvmp_ioga_w32),this));
414   machine().device("slave")->memory().space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(saturn_state::stvmp_ioga_r32),this), write32_delegate(FUNC(saturn_state::stvmp_ioga_w32),this));
415415}
416416
417417
r18027r18028
663663   sh2drc_add_pcflush(machine().device("maincpu"), 0x60011ba);
664664   sh2drc_add_pcflush(machine().device("maincpu"), 0x605b9da);
665665
666   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x06000770, 0x06000773, read32_delegate(FUNC(saturn_state::astrass_hack_r),this));
666   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x06000770, 0x06000773, read32_delegate(FUNC(saturn_state::astrass_hack_r),this));
667667
668668   install_astrass_protection(machine());
669669
trunk/src/mame/drivers/queen.c
r18027r18028
656656
657657   kbdc8042_init(machine(), &at8042);
658658   pc_vga_init(machine(), ::vga_setting, NULL);
659   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
659   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
660660}
661661
662662void queen_state::machine_reset()
trunk/src/mame/drivers/megatech.c
r18027r18028
334334static READ8_HANDLER( megatech_z80_read_68k_banked_data )
335335{
336336   mtech_state *state = space.machine().driver_data<mtech_state>();
337   address_space *space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
338   UINT8 ret = space68k->read_byte(state->m_mt_bank_addr + offset);
337   address_space &space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
338   UINT8 ret = space68k.read_byte(state->m_mt_bank_addr + offset);
339339   return ret;
340340}
341341
342342static WRITE8_HANDLER( megatech_z80_write_68k_banked_data )
343343{
344344   mtech_state *state = space.machine().driver_data<mtech_state>();
345   address_space *space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
346   space68k->write_byte(state->m_mt_bank_addr + offset,data);
345   address_space &space68k = space.machine().device<legacy_cpu_device>("maincpu")->space();
346   space68k.write_byte(state->m_mt_bank_addr + offset,data);
347347}
348348
349349static void megatech_z80_bank_w(running_machine &machine, UINT16 data)
trunk/src/mame/drivers/vamphalf.c
r18027r18028
24712471
24722472DRIVER_INIT_MEMBER(vamphalf_state,vamphalf)
24732473{
2474   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0004a840, 0x0004a843, read16_delegate(FUNC(vamphalf_state::vamphalf_speedup_r), this));
2474   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0004a840, 0x0004a843, read16_delegate(FUNC(vamphalf_state::vamphalf_speedup_r), this));
24752475
24762476   m_palshift = 0;
24772477   m_flip_bit = 0x80;
r18027r18028
24792479
24802480DRIVER_INIT_MEMBER(vamphalf_state,vamphafk)
24812481{
2482   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0004a6d0, 0x0004a6d3, read16_delegate(FUNC(vamphalf_state::vamphafk_speedup_r), this));
2482   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0004a6d0, 0x0004a6d3, read16_delegate(FUNC(vamphalf_state::vamphafk_speedup_r), this));
24832483
24842484   m_palshift = 0;
24852485   m_flip_bit = 0x80;
r18027r18028
24872487
24882488DRIVER_INIT_MEMBER(vamphalf_state,misncrft)
24892489{
2490   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00072eb4, 0x00072eb7, read16_delegate(FUNC(vamphalf_state::misncrft_speedup_r), this));
2490   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00072eb4, 0x00072eb7, read16_delegate(FUNC(vamphalf_state::misncrft_speedup_r), this));
24912491
24922492   m_palshift = 0;
24932493   m_flip_bit = 1;
24942494
24952495   // Configure the QS1000 ROM banking. Care must be taken not to overlap the 256b internal RAM
2496   machine().device("qs1000:cpu")->memory().space(AS_IO)->install_read_bank(0x0100, 0xffff, "data");
2496   machine().device("qs1000:cpu")->memory().space(AS_IO).install_read_bank(0x0100, 0xffff, "data");
24972497   membank("qs1000:data")->configure_entries(0, 16, memregion("qs1000:cpu")->base()+0x100, 0x8000-0x100);
24982498}
24992499
25002500DRIVER_INIT_MEMBER(vamphalf_state,coolmini)
25012501{
2502   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x000d2e80, 0x000d2e83, read16_delegate(FUNC(vamphalf_state::coolmini_speedup_r), this));
2502   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x000d2e80, 0x000d2e83, read16_delegate(FUNC(vamphalf_state::coolmini_speedup_r), this));
25032503
25042504   m_palshift = 0;
25052505   m_flip_bit = 1;
r18027r18028
25072507
25082508DRIVER_INIT_MEMBER(vamphalf_state,suplup)
25092509{
2510   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0011605c, 0x0011605f, read16_delegate(FUNC(vamphalf_state::suplup_speedup_r), this));
2510   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0011605c, 0x0011605f, read16_delegate(FUNC(vamphalf_state::suplup_speedup_r), this));
25112511
25122512   m_palshift = 8;
25132513   /* no flipscreen */
r18027r18028
25152515
25162516DRIVER_INIT_MEMBER(vamphalf_state,luplup)
25172517{
2518   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00115e84, 0x00115e87, read16_delegate(FUNC(vamphalf_state::luplup_speedup_r), this));
2518   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00115e84, 0x00115e87, read16_delegate(FUNC(vamphalf_state::luplup_speedup_r), this));
25192519
25202520   m_palshift = 8;
25212521   /* no flipscreen */
r18027r18028
25232523
25242524DRIVER_INIT_MEMBER(vamphalf_state,luplup29)
25252525{
2526   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00113f08, 0x00113f0b, read16_delegate(FUNC(vamphalf_state::luplup29_speedup_r), this));
2526   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00113f08, 0x00113f0b, read16_delegate(FUNC(vamphalf_state::luplup29_speedup_r), this));
25272527
25282528   m_palshift = 8;
25292529   /* no flipscreen */
r18027r18028
25312531
25322532DRIVER_INIT_MEMBER(vamphalf_state,puzlbang)
25332533{
2534   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00113ecc, 0x00113ecf, read16_delegate(FUNC(vamphalf_state::puzlbang_speedup_r), this));
2534   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00113ecc, 0x00113ecf, read16_delegate(FUNC(vamphalf_state::puzlbang_speedup_r), this));
25352535
25362536   m_palshift = 8;
25372537   /* no flipscreen */
r18027r18028
25392539
25402540DRIVER_INIT_MEMBER(vamphalf_state,wyvernwg)
25412541{
2542   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00b56fc, 0x00b56ff, read32_delegate(FUNC(vamphalf_state::wyvernwg_speedup_r), this));
2543   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00b74f8, 0x00b74fb, read32_delegate(FUNC(vamphalf_state::wyvernwga_speedup_r), this));
2542   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00b56fc, 0x00b56ff, read32_delegate(FUNC(vamphalf_state::wyvernwg_speedup_r), this));
2543   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00b74f8, 0x00b74fb, read32_delegate(FUNC(vamphalf_state::wyvernwga_speedup_r), this));
25442544
25452545   m_palshift = 0;
25462546   m_flip_bit = 1;
r18027r18028
25502550   m_semicom_prot_data[1] = 1;
25512551
25522552   // Configure the QS1000 ROM banking. Care must be taken not to overlap the 256b internal RAM
2553   machine().device("qs1000:cpu")->memory().space(AS_IO)->install_read_bank(0x0100, 0xffff, "data");
2553   machine().device("qs1000:cpu")->memory().space(AS_IO).install_read_bank(0x0100, 0xffff, "data");
25542554   membank("qs1000:data")->configure_entries(0, 16, memregion("qs1000:cpu")->base()+0x100, 0x8000-0x100);
25552555}
25562556
r18027r18028
25582558{
25592559   m_finalgdr_backupram_bank = 1;
25602560   m_finalgdr_backupram = auto_alloc_array(machine(), UINT8, 0x80*0x100);
2561   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x005e874, 0x005e877, read32_delegate(FUNC(vamphalf_state::finalgdr_speedup_r), this));
2561   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x005e874, 0x005e877, read32_delegate(FUNC(vamphalf_state::finalgdr_speedup_r), this));
25622562   machine().device<nvram_device>("nvram")->set_base(m_finalgdr_backupram, 0x80*0x100);
25632563
25642564   m_palshift = 0;
r18027r18028
25742574   // backup ram isn't used
25752575   m_finalgdr_backupram_bank = 1;
25762576   m_finalgdr_backupram = auto_alloc_array(machine(), UINT8, 0x80*0x100);
2577   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00701a4, 0x00701a7, read32_delegate(FUNC(vamphalf_state::mrkicker_speedup_r), this));
2577   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00701a4, 0x00701a7, read32_delegate(FUNC(vamphalf_state::mrkicker_speedup_r), this));
25782578   machine().device<nvram_device>("nvram")->set_base(m_finalgdr_backupram, 0x80*0x100);
25792579
25802580   m_palshift = 0;
r18027r18028
25872587
25882588DRIVER_INIT_MEMBER(vamphalf_state,dquizgo2)
25892589{
2590   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00cde70, 0x00cde73, read16_delegate(FUNC(vamphalf_state::dquizgo2_speedup_r), this));
2590   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00cde70, 0x00cde73, read16_delegate(FUNC(vamphalf_state::dquizgo2_speedup_r), this));
25912591
25922592   m_palshift = 0;
25932593   m_flip_bit = 1;
r18027r18028
25952595
25962596DRIVER_INIT_MEMBER(vamphalf_state,dtfamily)
25972597{
2598   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xcc2a8, 0xcc2a9, read16_delegate(FUNC(vamphalf_state::dtfamily_speedup_r), this));
2598   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xcc2a8, 0xcc2a9, read16_delegate(FUNC(vamphalf_state::dtfamily_speedup_r), this));
25992599
26002600   m_palshift = 0;
26012601   m_flip_bit = 1;
r18027r18028
26042604
26052605DRIVER_INIT_MEMBER(vamphalf_state,toyland)
26062606{
2607   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x780d8, 0x780d9, read16_delegate(FUNC(vamphalf_state::toyland_speedup_r), this));
2607   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x780d8, 0x780d9, read16_delegate(FUNC(vamphalf_state::toyland_speedup_r), this));
26082608
26092609   m_palshift = 0;
26102610   m_flip_bit = 1;
r18027r18028
26122612
26132613DRIVER_INIT_MEMBER(vamphalf_state,aoh)
26142614{
2615   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x028a09c, 0x028a09f, read32_delegate(FUNC(vamphalf_state::aoh_speedup_r), this));
2615   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x028a09c, 0x028a09f, read32_delegate(FUNC(vamphalf_state::aoh_speedup_r), this));
26162616
26172617   m_palshift = 0;
26182618   /* no flipscreen */
r18027r18028
26202620
26212621DRIVER_INIT_MEMBER(vamphalf_state,jmpbreak)
26222622{
2623   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00906fc, 0x00906ff, read16_delegate(FUNC(vamphalf_state::jmpbreak_speedup_r), this));
2624   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe0000000, 0xe0000003, write16_delegate(FUNC(vamphalf_state::jmpbreak_flipscreen_w), this));
2623   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00906fc, 0x00906ff, read16_delegate(FUNC(vamphalf_state::jmpbreak_speedup_r), this));
2624   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe0000000, 0xe0000003, write16_delegate(FUNC(vamphalf_state::jmpbreak_flipscreen_w), this));
26252625
26262626   m_palshift = 0;
26272627}
26282628
26292629DRIVER_INIT_MEMBER(vamphalf_state,mrdig)
26302630{
2631   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00a99c, 0x00a99f, read16_delegate(FUNC(vamphalf_state::mrdig_speedup_r), this));
2632   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe0000000, 0xe0000003, write16_delegate(FUNC(vamphalf_state::jmpbreak_flipscreen_w), this));
2631   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00a99c, 0x00a99f, read16_delegate(FUNC(vamphalf_state::mrdig_speedup_r), this));
2632   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe0000000, 0xe0000003, write16_delegate(FUNC(vamphalf_state::jmpbreak_flipscreen_w), this));
26332633
26342634   m_palshift = 0;
26352635}
r18027r18028
26372637
26382638DRIVER_INIT_MEMBER(vamphalf_state,boonggab)
26392639{
2640   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x000f1b7c, 0x000f1b7f, read16_delegate(FUNC(vamphalf_state::boonggab_speedup_r), this));
2640   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x000f1b7c, 0x000f1b7f, read16_delegate(FUNC(vamphalf_state::boonggab_speedup_r), this));
26412641
26422642   m_palshift = 0;
26432643   m_has_extra_gfx = 1;
trunk/src/mame/drivers/raiden.c
r18027r18028
606606DRIVER_INIT_MEMBER(raiden_state,raidena)
607607{
608608#ifdef SYNC_HACK
609   machine().device("sub")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4008, 0x4009, FUNC(sub_cpu_spin_r));
609   machine().device("sub")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x4008, 0x4009, FUNC(sub_cpu_spin_r));
610610#endif
611611}
612612
trunk/src/mame/drivers/vegaeo.c
r18027r18028
356356{
357357
358358   // Set up the QS1000 program ROM banking, taking care not to overlap the internal RAM
359   machine().device("qs1000:cpu")->memory().space(AS_IO)->install_read_bank(0x0100, 0xffff, "bank");
359   machine().device("qs1000:cpu")->memory().space(AS_IO).install_read_bank(0x0100, 0xffff, "bank");
360360   membank("qs1000:bank")->configure_entries(0, 8, memregion("qs1000:cpu")->base()+0x100, 0x10000);
361361
362362   init_eolith_speedup(machine());
trunk/src/mame/drivers/arcadia.c
r18027r18028
122122   /* swap the write handlers between ROM and bank 1 based on the bit */
123123   if ((data & 1) == 0)
124124      /* overlay disabled, map RAM on 0x000000 */
125      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x000000, 0x07ffff, "bank1");
125      machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1");
126126
127127   else
128128      /* overlay enabled, map Amiga system ROM on 0x000000 */
129      machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x000000, 0x07ffff);
129      machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff);
130130
131131   /* bit 2 = Power Led on Amiga */
132132   set_led_status(machine(), 0, (data & 2) ? 0 : 1);
trunk/src/mame/drivers/superchs.c
r18027r18028
453453DRIVER_INIT_MEMBER(superchs_state,superchs)
454454{
455455   /* Speedup handlers */
456   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x100000, 0x100003, read32_delegate(FUNC(superchs_state::main_cycle_r),this));
457   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x80000a, 0x80000b, read16_delegate(FUNC(superchs_state::sub_cycle_r),this));
456   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x100000, 0x100003, read32_delegate(FUNC(superchs_state::main_cycle_r),this));
457   machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0x80000a, 0x80000b, read16_delegate(FUNC(superchs_state::sub_cycle_r),this));
458458}
459459
460460GAMEL( 1992, superchs,         0, superchs, superchs, superchs_state, superchs, ROT0, "Taito America Corporation", "Super Chase - Criminal Termination (US)", 0, layout_superchs )
trunk/src/mame/drivers/toki.c
r18027r18028
860860
861861   /* Decrypt data for z80 program */
862862   {
863      address_space &space = *machine().device("audiocpu")->memory().space(AS_PROGRAM);
863      address_space &space = machine().device("audiocpu")->memory().space(AS_PROGRAM);
864864      UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x20000);
865865      UINT8 *rom = machine().root_device().memregion("audiocpu")->base();
866866      int i;
trunk/src/mame/drivers/renegade.c
r18027r18028
316316
317317DRIVER_INIT_MEMBER(renegade_state,kuniokunb)
318318{
319   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
319   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
320320
321321   /* Remove the MCU handlers */
322322   space.unmap_readwrite(0x3804, 0x3804);
trunk/src/mame/drivers/meritm.c
r18027r18028
371371{
372372   meritm_state *state = machine.driver_data<meritm_state>();
373373   for(int i = 0; i < count; i++)
374      state->m_microtouch->rx(*machine.memory().first_space(), 0, data[i]);
374      state->m_microtouch->rx(machine.driver_data()->generic_space(), 0, data[i]);
375375}
376376
377377WRITE8_MEMBER(meritm_state::microtouch_tx)
r18027r18028
20472047
20482048   ds1204_init(machine(), megat3_ds1204_key, megat3_ds1204_nvram);
20492049
2050   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
2050   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
20512051
20522052};
20532053
r18027r18028
20772077
20782078   ds1204_init(machine(), 0, megat4te_ds1204_nvram);
20792079
2080   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
2080   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
20812081
20822082};
20832083
r18027r18028
20882088
20892089   ds1204_init(machine(), 0, megat4te_ds1204_nvram);
20902090
2091   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
2091   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
20922092
20932093};
20942094
r18027r18028
21082108
21092109   ds1204_init(machine(), 0, megat5_ds1204_nvram);
21102110
2111   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
2111   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfff8, 0xffff, read8_delegate(FUNC(meritm_state::meritm_ds1644_r), this), write8_delegate(FUNC(meritm_state::meritm_ds1644_w), this));
21122112
21132113}
21142114
trunk/src/mame/drivers/atarisy4.c
r18027r18028
964964
965965DRIVER_INIT_MEMBER(atarisy4_state,laststar)
966966{
967   address_space &main = *machine().device("maincpu")->memory().space(AS_PROGRAM);
967   address_space &main = machine().device("maincpu")->memory().space(AS_PROGRAM);
968968
969969   /* Allocate 16kB of shared RAM */
970970   m_shared_ram[0] = auto_alloc_array_clear(machine(), UINT16, 0x2000);
r18027r18028
976976   /* Set up the DSP */
977977   membank("dsp0_bank0")->set_base(m_shared_ram[0]);
978978   membank("dsp0_bank1")->set_base(&m_shared_ram[0][0x800]);
979   load_ldafile(*machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base());
979   load_ldafile(machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base());
980980}
981981
982982DRIVER_INIT_MEMBER(atarisy4_state,airrace)
r18027r18028
986986   m_shared_ram[1] = auto_alloc_array_clear(machine(), UINT16, 0x4000);
987987
988988   /* Populate RAM with data from the HEX files */
989   load_hexfile(*machine().device("maincpu")->memory().space(AS_PROGRAM), memregion("code")->base());
989   load_hexfile(machine().device("maincpu")->memory().space(AS_PROGRAM), memregion("code")->base());
990990
991991   /* Set up the first DSP */
992992   membank("dsp0_bank0")->set_base(m_shared_ram[0]);
993993   membank("dsp0_bank1")->set_base(&m_shared_ram[0][0x800]);
994   load_ldafile(*machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base());
994   load_ldafile(machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base());
995995
996996   /* Set up the second DSP */
997997   membank("dsp1_bank0")->set_base(m_shared_ram[1]);
998998   membank("dsp1_bank1")->set_base(&m_shared_ram[1][0x800]);
999   load_ldafile(*machine().device("dsp1")->memory().space(AS_PROGRAM), memregion("dsp")->base());
999   load_ldafile(machine().device("dsp1")->memory().space(AS_PROGRAM), memregion("dsp")->base());
10001000}
10011001
10021002void atarisy4_state::machine_reset()
trunk/src/mame/drivers/cninja.c
r18027r18028
20832083
20842084DRIVER_INIT_MEMBER(cninja_state,cninja)
20852085{
2086   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::cninja_sound_w),this));
2086   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::cninja_sound_w),this));
20872087   cninja_patch(machine());
20882088}
20892089
20902090DRIVER_INIT_MEMBER(cninja_state,stoneage)
20912091{
2092   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::stoneage_sound_w),this));
2092   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::stoneage_sound_w),this));
20932093}
20942094
20952095DRIVER_INIT_MEMBER(cninja_state,mutantf)
trunk/src/mame/drivers/missile.c
r18027r18028
518518   m_flipscreen = 0;
519519
520520   /* set up an opcode base handler since we use mapped handlers for RAM */
521   address_space &space = *m_maincpu->space(AS_PROGRAM);
521   address_space &space = m_maincpu->space(AS_PROGRAM);
522522   space.set_direct_update_handler(direct_update_delegate(FUNC(missile_state::missile_direct_handler), this));
523523
524524   /* create a timer to speed/slow the CPU */
r18027r18028
731731   else if (offset < 0x4800)
732732   {
733733      pokey_device *pokey_dev = downcast<pokey_device *>(machine().device("pokey"));
734      pokey_dev->write(*machine().firstcpu->space(), offset, data, 0xff);
734      pokey_dev->write(machine().firstcpu->space(), offset, data, 0xff);
735735   }
736736
737737   /* OUT0 */
r18027r18028
794794   else if (offset < 0x4800)
795795   {
796796      pokey_device *pokey_dev = downcast<pokey_device *>(machine().device("pokey"));
797      result = pokey_dev->read(*machine().firstcpu->space(), offset & 0x0f, 0xff);
797      result = pokey_dev->read(machine().firstcpu->space(), offset & 0x0f, 0xff);
798798   }
799799
800800   /* IN0 */
trunk/src/mame/drivers/jack.c
r18027r18028
12901290static void treahunt_decode( running_machine &machine )
12911291{
12921292   int A;
1293   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1293   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12941294   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
12951295   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x4000);
12961296   int data;
r18027r18028
13991399   }
14001400
14011401   // Set-up the weirdest questions read ever done
1402   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(jack_state::striv_question_r),this));
1402   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(jack_state::striv_question_r),this));
14031403
14041404   // Nop out unused sprites writes
1405   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xb000, 0xb0ff);
1405   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xb000, 0xb0ff);
14061406
14071407   m_timer_rate = 128;
14081408}
trunk/src/mame/drivers/taitosj.c
r18027r18028
27652765   init_common(machine());
27662766
27672767   /* install protection handler */
2768   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd48b, 0xd48b, read8_delegate(FUNC(taitosj_state::spacecr_prot_r),this));
2768   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd48b, 0xd48b, read8_delegate(FUNC(taitosj_state::spacecr_prot_r),this));
27692769}
27702770
27712771DRIVER_INIT_MEMBER(taitosj_state,alpine)
r18027r18028
27732773   init_common(machine());
27742774
27752775   /* install protection handlers */
2776   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
2777   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd50f, 0xd50f, write8_delegate(FUNC(taitosj_state::alpine_protection_w),this));
2776   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
2777   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd50f, 0xd50f, write8_delegate(FUNC(taitosj_state::alpine_protection_w),this));
27782778}
27792779
27802780DRIVER_INIT_MEMBER(taitosj_state,alpinea)
r18027r18028
27822782   init_common(machine());
27832783
27842784   /* install protection handlers */
2785   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
2786   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd50e, 0xd50e, write8_delegate(FUNC(taitosj_state::alpinea_bankswitch_w),this));
2785   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this));
2786   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd50e, 0xd50e, write8_delegate(FUNC(taitosj_state::alpinea_bankswitch_w),this));
27872787}
27882788
27892789DRIVER_INIT_MEMBER(taitosj_state,junglhbr)
r18027r18028
27912791   init_common(machine());
27922792
27932793   /* inverter on bits 0 and 1 */
2794   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(taitosj_state::junglhbr_characterram_w),this));
2794   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(taitosj_state::junglhbr_characterram_w),this));
27952795}
27962796
27972797GAME( 1981, spaceskr, 0,        nomcu,    spaceskr, taitosj_state,   taitosj, ROT0,   "Taito Corporation", "Space Seeker", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/galivan.c
r18027r18028
10761076
10771077DRIVER_INIT_MEMBER(galivan_state,youmab)
10781078{
1079   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x82, 0x82, write8_delegate(FUNC(galivan_state::youmab_extra_bank_w),this)); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there
1080   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x7fff, "bank3");
1079   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x82, 0x82, write8_delegate(FUNC(galivan_state::youmab_extra_bank_w),this)); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there
1080   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x7fff, "bank3");
10811081   membank("bank3")->set_base(memregion("maincpu")->base());
10821082
1083   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xbfff, "bank2");
1083   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank2");
10841084   membank("bank2")->configure_entries(0, 2, memregion("user2")->base(), 0x4000);
10851085   membank("bank2")->set_entry(0);
10861086
1087   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x81, 0x81, write8_delegate(FUNC(galivan_state::youmab_81_w),this)); // ?? often, alternating values
1088   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x84, 0x84, write8_delegate(FUNC(galivan_state::youmab_84_w),this)); // ?? often, sequence..
1087   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x81, 0x81, write8_delegate(FUNC(galivan_state::youmab_81_w),this)); // ?? often, alternating values
1088   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x84, 0x84, write8_delegate(FUNC(galivan_state::youmab_84_w),this)); // ?? often, sequence..
10891089
1090   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xd800, 0xd81f); // scrolling isn't here..
1090   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xd800, 0xd81f); // scrolling isn't here..
10911091
1092   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x8a, 0x8a, read8_delegate(FUNC(galivan_state::youmab_8a_r),this)); // ???
1092   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x8a, 0x8a, read8_delegate(FUNC(galivan_state::youmab_8a_r),this)); // ???
10931093
1094   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x86, 0x86, write8_delegate(FUNC(galivan_state::youmab_86_w),this));
1094   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x86, 0x86, write8_delegate(FUNC(galivan_state::youmab_86_w),this));
10951095
10961096}
10971097
trunk/src/mame/drivers/deshoros.c
r18027r18028
253253
254254void destiny_state::machine_reset()
255255{
256   bank_select_w(*m_maincpu->space(AS_PROGRAM), 0, 0);
256   bank_select_w(m_maincpu->space(AS_PROGRAM), 0, 0);
257257}
258258
259259static MACHINE_CONFIG_START( destiny, destiny_state )
trunk/src/mame/drivers/exidy440.c
r18027r18028
301301   if (state->m_showdown_bank_data[0] != NULL)
302302   {
303303      if (bank == 0 && state->m_bank != 0)
304         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),state));
304         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),state));
305305      else if (bank != 0 && state->m_bank == 0)
306         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank1");
306         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank1");
307307   }
308308
309309   /* select the bank and update the bank pointer */
r18027r18028
19311931DRIVER_INIT_MEMBER(exidy440_state,claypign)
19321932{
19331933   DRIVER_INIT_CALL(exidy440);
1934   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2ec0, 0x2ec3, read8_delegate(FUNC(exidy440_state::claypign_protection_r),this));
1934   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2ec0, 0x2ec3, read8_delegate(FUNC(exidy440_state::claypign_protection_r),this));
19351935}
19361936
19371937
r18027r18028
19401940   DRIVER_INIT_CALL(exidy440);
19411941
19421942   /* extra input ports and scrolling */
1943   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2ec5, 0x2ec5, read8_delegate(FUNC(exidy440_state::topsecex_input_port_5_r),this));
1944   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2ec6, 0x2ec6, "AN0");
1945   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2ec7, 0x2ec7, "IN4");
1943   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2ec5, 0x2ec5, read8_delegate(FUNC(exidy440_state::topsecex_input_port_5_r),this));
1944   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2ec6, 0x2ec6, "AN0");
1945   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2ec7, 0x2ec7, "IN4");
19461946
1947   m_topsecex_yscroll = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x2ec1, 0x2ec1, write8_delegate(FUNC(exidy440_state::topsecex_yscroll_w),this));
1947   m_topsecex_yscroll = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2ec1, 0x2ec1, write8_delegate(FUNC(exidy440_state::topsecex_yscroll_w),this));
19481948}
19491949
19501950
trunk/src/mame/drivers/megaplay.c
r18027r18028
882882   mplay_start(machine());
883883
884884   /* for now ... */
885   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa10000, 0xa1001f, FUNC(megaplay_io_read), FUNC(megaplay_io_write));
885   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa10000, 0xa1001f, FUNC(megaplay_io_read), FUNC(megaplay_io_write));
886886
887887   /* megaplay has ram shared with the bios cpu here */
888   machine().device("genesis_snd_z80")->memory().space(AS_PROGRAM)->install_ram(0x2000, 0x3fff, &m_ic36_ram[0]);
888   machine().device("genesis_snd_z80")->memory().space(AS_PROGRAM).install_ram(0x2000, 0x3fff, &m_ic36_ram[0]);
889889
890890   /* instead of a RAM mirror the 68k sees the extra ram of the 2nd z80 too */
891   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa02000, 0xa03fff, FUNC(megadriv_68k_read_z80_extra_ram), FUNC(megadriv_68k_write_z80_extra_ram));
891   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xa02000, 0xa03fff, FUNC(megadriv_68k_read_z80_extra_ram), FUNC(megadriv_68k_write_z80_extra_ram));
892892
893893   init_megatech_bios(machine());
894894
trunk/src/mame/drivers/m72.c
r18027r18028
352352
353353DRIVER_INIT_MEMBER(m72_state,m72_8751)
354354{
355   address_space *program = machine().device("maincpu")->memory().space(AS_PROGRAM);
356   address_space *io = machine().device("maincpu")->memory().space(AS_IO);
357   address_space *sndio = machine().device("soundcpu")->memory().space(AS_IO);
355   address_space &program = machine().device("maincpu")->memory().space(AS_PROGRAM);
356   address_space &io = machine().device("maincpu")->memory().space(AS_IO);
357   address_space &sndio = machine().device("soundcpu")->memory().space(AS_IO);
358358
359359   m_protection_ram = auto_alloc_array(machine(), UINT16, 0x10000/2);
360   program->install_read_bank(0xb0000, 0xbffff, "bank1");
361   program->install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::m72_main_mcu_w),this));
360   program.install_read_bank(0xb0000, 0xbffff, "bank1");
361   program.install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::m72_main_mcu_w),this));
362362   membank("bank1")->set_base(m_protection_ram);
363363
364   //io->install_legacy_write_handler(0xc0, 0xc1, FUNC(loht_sample_trigger_w));
365   io->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::m72_main_mcu_sound_w),this));
364   //io.install_legacy_write_handler(0xc0, 0xc1, FUNC(loht_sample_trigger_w));
365   io.install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::m72_main_mcu_sound_w),this));
366366
367367   /* sound cpu */
368   sndio->install_write_handler(0x82, 0x82, 0xff, 0, write8_delegate(FUNC(m72_state::m72_snd_cpu_sample_w),this));
369   sndio->install_read_handler (0x84, 0x84, 0xff, 0, read8_delegate(FUNC(m72_state::m72_snd_cpu_sample_r),this));
368   sndio.install_write_handler(0x82, 0x82, 0xff, 0, write8_delegate(FUNC(m72_state::m72_snd_cpu_sample_w),this));
369   sndio.install_read_handler (0x84, 0x84, 0xff, 0, read8_delegate(FUNC(m72_state::m72_snd_cpu_sample_r),this));
370370
371371   /* lohtb2 */
372372#if 0
r18027r18028
717717   state->m_protection_ram = auto_alloc_array(machine, UINT16, 0x1000/2);
718718   state->m_protection_code = code;
719719   state->m_protection_crc =  crc;
720   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xb0000, 0xb0fff, "bank1");
721   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xb0ffa, 0xb0ffb, read16_delegate(FUNC(m72_state::protection_r),state));
722   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::protection_w),state));
720   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xb0000, 0xb0fff, "bank1");
721   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xb0ffa, 0xb0ffb, read16_delegate(FUNC(m72_state::protection_r),state));
722   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::protection_w),state));
723723   state->membank("bank1")->set_base(state->m_protection_ram);
724724}
725725
726726DRIVER_INIT_MEMBER(m72_state,bchopper)
727727{
728728   install_protection_handler(machine(), bchopper_code,bchopper_crc);
729   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this));
729   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this));
730730}
731731
732732DRIVER_INIT_MEMBER(m72_state,mrheli)
733733{
734734   install_protection_handler(machine(), bchopper_code,mrheli_crc);
735   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this));
735   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this));
736736}
737737
738738DRIVER_INIT_MEMBER(m72_state,nspirit)
739739{
740740   install_protection_handler(machine(), nspirit_code,nspirit_crc);
741   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::nspirit_sample_trigger_w),this));
741   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::nspirit_sample_trigger_w),this));
742742}
743743
744744DRIVER_INIT_MEMBER(m72_state,imgfight)
745745{
746746   install_protection_handler(machine(), imgfight_code,imgfightj_crc);
747   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::imgfight_sample_trigger_w),this));
747   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::imgfight_sample_trigger_w),this));
748748}
749749
750750DRIVER_INIT_MEMBER(m72_state,loht)
751751{
752752   install_protection_handler(machine(), loht_code,loht_crc);
753753
754   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::loht_sample_trigger_w),this));
754   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::loht_sample_trigger_w),this));
755755
756756   /* since we skip the startup tests, clear video RAM to prevent garbage on title screen */
757757   memset(m_videoram2,0,0x4000);
r18027r18028
760760DRIVER_INIT_MEMBER(m72_state,xmultiplm72)
761761{
762762   install_protection_handler(machine(), xmultiplm72_code,xmultiplm72_crc);
763   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::xmultiplm72_sample_trigger_w),this));
763   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::xmultiplm72_sample_trigger_w),this));
764764}
765765
766766DRIVER_INIT_MEMBER(m72_state,dbreedm72)
767767{
768768   install_protection_handler(machine(), dbreedm72_code,dbreedm72_crc);
769   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dbreedm72_sample_trigger_w),this));
769   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dbreedm72_sample_trigger_w),this));
770770}
771771
772772DRIVER_INIT_MEMBER(m72_state,airduel)
773773{
774774   install_protection_handler(machine(), airduel_code,airduel_crc);
775   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::airduel_sample_trigger_w),this));
775   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::airduel_sample_trigger_w),this));
776776}
777777
778778DRIVER_INIT_MEMBER(m72_state,dkgenm72)
779779{
780780   install_protection_handler(machine(), dkgenm72_code,dkgenm72_crc);
781   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dkgenm72_sample_trigger_w),this));
781   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dkgenm72_sample_trigger_w),this));
782782}
783783
784784DRIVER_INIT_MEMBER(m72_state,gallop)
785785{
786   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::gallop_sample_trigger_w),this));
786   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::gallop_sample_trigger_w),this));
787787}
788788
789789
trunk/src/mame/drivers/r2dtank.c
r18027r18028
417417WRITE8_MEMBER(r2dtank_state::pia_comp_w)
418418{
419419   device_t *device = machine().device("pia_main");
420   downcast<pia6821_device *>(device)->write(*machine().memory().first_space(), offset, ~data);
420   downcast<pia6821_device *>(device)->write(machine().driver_data()->generic_space(), offset, ~data);
421421}
422422
423423
trunk/src/mame/drivers/crgolf.c
r18027r18028
614614
615615DRIVER_INIT_MEMBER(crgolf_state,crgolfhi)
616616{
617   machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa000, 0xa003, write8_delegate(FUNC(crgolf_state::crgolfhi_sample_w),this));
617   machine().device("audiocpu")->memory().space(AS_PROGRAM).install_write_handler(0xa000, 0xa003, write8_delegate(FUNC(crgolf_state::crgolfhi_sample_w),this));
618618}
619619
620620
trunk/src/mame/drivers/rmhaihai.c
r18027r18028
194194
195195MACHINE_RESET_MEMBER(rmhaihai_state,themj)
196196{
197   themj_rombank_w(*machine().device("maincpu")->memory().space(AS_IO), 0, 0);
197   themj_rombank_w(machine().device("maincpu")->memory().space(AS_IO), 0, 0);
198198}
199199
200200
trunk/src/mame/drivers/segae.c
r18027r18028
512512{
513513   systeme_state::driver_start();
514514
515   m_maincpu->space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(systeme_state::ridleofp_port_f8_read), this));
516   m_maincpu->space(AS_IO)->install_write_handler(0xfa, 0xfa, write8_delegate(FUNC(systeme_state::ridleofp_port_fa_write), this));
515   m_maincpu->space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(systeme_state::ridleofp_port_f8_read), this));
516   m_maincpu->space(AS_IO).install_write_handler(0xfa, 0xfa, write8_delegate(FUNC(systeme_state::ridleofp_port_fa_write), this));
517517}
518518
519519
r18027r18028
521521{
522522   systeme_state::driver_start();
523523
524   m_maincpu->space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(systeme_state::hangonjr_port_f8_read), this));
525   m_maincpu->space(AS_IO)->install_write_handler(0xfa, 0xfa, write8_delegate(FUNC(systeme_state::hangonjr_port_fa_write), this));
524   m_maincpu->space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(systeme_state::hangonjr_port_f8_read), this));
525   m_maincpu->space(AS_IO).install_write_handler(0xfa, 0xfa, write8_delegate(FUNC(systeme_state::hangonjr_port_fa_write), this));
526526}
527527
528528
trunk/src/mame/drivers/atarig1.c
r18027r18028
184184   atarig1_state *state = machine.driver_data<atarig1_state>();
185185
186186   /* install a read handler */
187   state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),state));
187   state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),state));
188188
189189   /* allocate memory for a copy of bank 0 */
190190   state->m_bslapstic_bank0 = auto_alloc_array(machine, UINT8, 0x2000);
trunk/src/mame/drivers/videopin.c
r18027r18028
6868
6969   /* both output latches are cleared on reset */
7070
71   videopin_out1_w(*machine().memory().first_space(), 0, 0);
72   videopin_out2_w(*machine().memory().first_space(), 0, 0);
71   videopin_out1_w(machine().driver_data()->generic_space(), 0, 0);
72   videopin_out2_w(machine().driver_data()->generic_space(), 0, 0);
7373}
7474
7575
trunk/src/mame/drivers/tumbleb.c
r18027r18028
32323232   #if TUMBLEP_HACK
32333233   tumblepb_patch_code(machine(), 0x000132);
32343234   #endif
3235   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x100000, 0x100001, write16_delegate(FUNC(tumbleb_state::tumbleb2_soundmcu_w),this));
3235   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x100000, 0x100001, write16_delegate(FUNC(tumbleb_state::tumbleb2_soundmcu_w),this));
32363236
32373237}
32383238
r18027r18028
32703270DRIVER_INIT_MEMBER(tumbleb_state,bcstory)
32713271{
32723272   tumblepb_gfx1_rearrange(machine());
3273   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x180008, 0x180009, read16_delegate(FUNC(tumbleb_state::bcstory_1a0_read),this)); // io should be here??
3273   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x180008, 0x180009, read16_delegate(FUNC(tumbleb_state::bcstory_1a0_read),this)); // io should be here??
32743274}
32753275
32763276
r18027r18028
33343334   DRIVER_INIT_CALL(htchctch);
33353335
33363336   /* different palette format, closer to tumblep -- is this controlled by a register? the palette was right with the hatch catch trojan */
3337   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x140000, 0x140fff, write16_delegate(FUNC(tumbleb_state::paletteram_xxxxBBBBGGGGRRRR_word_w), this));
3337   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x140000, 0x140fff, write16_delegate(FUNC(tumbleb_state::paletteram_xxxxBBBBGGGGRRRR_word_w), this));
33383338
33393339   /* slightly different banking */
3340   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x100002, 0x100003, write16_delegate(FUNC(tumbleb_state::chokchok_tilebank_w),this));
3340   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x100002, 0x100003, write16_delegate(FUNC(tumbleb_state::chokchok_tilebank_w),this));
33413341}
33423342
33433343DRIVER_INIT_MEMBER(tumbleb_state,wlstar)
r18027r18028
33453345   tumblepb_gfx1_rearrange(machine());
33463346
33473347   /* slightly different banking */
3348   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x100002, 0x100003, write16_delegate(FUNC(tumbleb_state::wlstar_tilebank_w),this));
3348   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x100002, 0x100003, write16_delegate(FUNC(tumbleb_state::wlstar_tilebank_w),this));
33493349
33503350   m_protbase = 0x0000;
33513351}
trunk/src/mame/drivers/cd32.c
r18027r18028
14381438   cd32_state *state = machine.driver_data<cd32_state>();
14391439   UINT8 data8 = data & 0xff;
14401440   if ( data8 != 0x00 )
1441      state->m_microtouch->rx(*machine.memory().first_space(), 0, data8);
1441      state->m_microtouch->rx(machine.driver_data()->generic_space(), 0, data8);
14421442}
14431443
14441444WRITE8_MEMBER (cd32_state::microtouch_tx)
trunk/src/mame/drivers/kchamp.c
r18027r18028
711711
712712static UINT8 *decrypt_code(running_machine &machine)
713713{
714   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
714   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
715715   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000);
716716   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
717717   int A;
trunk/src/mame/drivers/m90.c
r18027r18028
679679
680680INTERRUPT_GEN_MEMBER(m90_state::fake_nmi)
681681{
682   address_space &space = *machine().firstcpu->space(AS_PROGRAM);
682   address_space &space = machine().firstcpu->space(AS_PROGRAM);
683683   int sample = m72_sample_r(m_audio,space,0);
684684   if (sample)
685685      m72_sample_w(m_audio,space,0,sample);
r18027r18028
687687
688688INTERRUPT_GEN_MEMBER(m90_state::bomblord_fake_nmi)
689689{
690   address_space &space = *machine().firstcpu->space(AS_PROGRAM);
690   address_space &space = machine().firstcpu->space(AS_PROGRAM);
691691   int sample = m72_sample_r(m_audio,space,0);
692692   if (sample != 0x80)
693693      m72_sample_w(m_audio,space,0,sample);
r18027r18028
11831183DRIVER_INIT_MEMBER(m90_state,quizf1)
11841184{
11851185   membank("bank1")->configure_entries(0, 16, memregion("user1")->base(), 0x10000);
1186   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x04, 0x05, write16_delegate(FUNC(m90_state::quizf1_bankswitch_w),this));
1186   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x04, 0x05, write16_delegate(FUNC(m90_state::quizf1_bankswitch_w),this));
11871187}
11881188
11891189
trunk/src/mame/drivers/phoenix.c
r18027r18028
10831083DRIVER_INIT_MEMBER(phoenix_state,condor)
10841084{
10851085   /* additional inputs for coinage */
1086   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x5000, 0x5000, "DSW1");
1086   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x5000, 0x5000, "DSW1");
10871087}
10881088
10891089
trunk/src/mame/drivers/r2dx_v33.c
r18027r18028
232232   {
233233      static UINT32 src_addr = 0x100000;
234234      static int frame;
235      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
235      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
236236
237237      //if(machine().input().code_pressed_once(KEYCODE_A))
238238      //  src_addr+=0x800;
trunk/src/mame/drivers/lockon.c
r18027r18028
6363
6464READ16_MEMBER(lockon_state::main_gnd_r)
6565{
66   address_space *gndspace = m_ground->memory().space(AS_PROGRAM);
67   return gndspace->read_word(V30_GND_ADDR | offset * 2);
66   address_space &gndspace = m_ground->memory().space(AS_PROGRAM);
67   return gndspace.read_word(V30_GND_ADDR | offset * 2);
6868}
6969
7070WRITE16_MEMBER(lockon_state::main_gnd_w)
7171{
72   address_space *gndspace = m_ground->memory().space(AS_PROGRAM);
72   address_space &gndspace = m_ground->memory().space(AS_PROGRAM);
7373
7474   if (ACCESSING_BITS_0_7)
75      gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
75      gndspace.write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
7676   if (ACCESSING_BITS_8_15)
77      gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 1), data >> 8);
77      gndspace.write_byte(V30_GND_ADDR | (offset * 2 + 1), data >> 8);
7878}
7979
8080READ16_MEMBER(lockon_state::main_obj_r)
8181{
82   address_space *objspace = m_object->memory().space(AS_PROGRAM);
83   return objspace->read_word(V30_OBJ_ADDR | offset * 2);
82   address_space &objspace = m_object->memory().space(AS_PROGRAM);
83   return objspace.read_word(V30_OBJ_ADDR | offset * 2);
8484}
8585
8686WRITE16_MEMBER(lockon_state::main_obj_w)
8787{
88   address_space *objspace =m_object->memory().space(AS_PROGRAM);
88   address_space &objspace =m_object->memory().space(AS_PROGRAM);
8989
9090   if (ACCESSING_BITS_0_7)
91      objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 0), data);
91      objspace.write_byte(V30_OBJ_ADDR | (offset * 2 + 0), data);
9292   if (ACCESSING_BITS_8_15)
93      objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
93      objspace.write_byte(V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
9494}
9595
9696WRITE16_MEMBER(lockon_state::tst_w)
r18027r18028
9898
9999   if (offset < 0x800)
100100   {
101      address_space *gndspace = m_ground->memory().space(AS_PROGRAM);
102      address_space *objspace = m_object->memory().space(AS_PROGRAM);
101      address_space &gndspace = m_ground->memory().space(AS_PROGRAM);
102      address_space &objspace = m_object->memory().space(AS_PROGRAM);
103103
104104      if (ACCESSING_BITS_0_7)
105         gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
105         gndspace.write_byte(V30_GND_ADDR | (offset * 2 + 0), data);
106106      if (ACCESSING_BITS_8_15)
107         gndspace->write_byte(V30_GND_ADDR | (offset * 2 + 1), data >> 8);
107         gndspace.write_byte(V30_GND_ADDR | (offset * 2 + 1), data >> 8);
108108
109109      if (ACCESSING_BITS_0_7)
110         objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 0), data);
110         objspace.write_byte(V30_OBJ_ADDR | (offset * 2 + 0), data);
111111      if (ACCESSING_BITS_8_15)
112         objspace->write_byte(V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
112         objspace.write_byte(V30_OBJ_ADDR | (offset * 2 + 1), data >> 8);
113113   }
114114}
115115
116116READ16_MEMBER(lockon_state::main_z80_r)
117117{
118   address_space *sndspace = m_audiocpu->space(AS_PROGRAM);
119   return 0xff00 | sndspace->read_byte(offset);
118   address_space &sndspace = m_audiocpu->space(AS_PROGRAM);
119   return 0xff00 | sndspace.read_byte(offset);
120120}
121121
122122WRITE16_MEMBER(lockon_state::main_z80_w)
123123{
124   address_space *sndspace = m_audiocpu->space(AS_PROGRAM);
125   sndspace->write_byte(offset, data);
124   address_space &sndspace = m_audiocpu->space(AS_PROGRAM);
125   sndspace.write_byte(offset, data);
126126}
127127
128128WRITE16_MEMBER(lockon_state::inten_w)
trunk/src/mame/drivers/tigeroad.c
r18027r18028
764764
765765DRIVER_INIT_MEMBER(tigeroad_state,tigeroad)
766766{
767   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xfe4002, 0xfe4003, write16_delegate(FUNC(tigeroad_state::tigeroad_soundcmd_w),this));
767   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xfe4002, 0xfe4003, write16_delegate(FUNC(tigeroad_state::tigeroad_soundcmd_w),this));
768768}
769769
770770DRIVER_INIT_MEMBER(tigeroad_state,f1dream)
771771{
772   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xfe4002, 0xfe4003, write16_delegate(FUNC(tigeroad_state::f1dream_control_w),this));
772   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xfe4002, 0xfe4003, write16_delegate(FUNC(tigeroad_state::f1dream_control_w),this));
773773}
774774
775775
trunk/src/mame/drivers/gei.c
r18027r18028
220220   set_led_status(machine(), 9,data & 0x08);
221221
222222   /* bit 5 - ticket out in trivia games */
223   machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, (data & 0x20)<< 2);
223   machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, (data & 0x20)<< 2);
224224
225225   /* bit 6 enables NMI */
226226   m_nmi_mask = data & 0x40;
trunk/src/mame/drivers/segas32.c
r18027r18028
42094209DRIVER_INIT_MEMBER(segas32_state,arescue)
42104210{
42114211   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this));
4212   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa00007, read16_delegate(FUNC(segas32_state::arescue_dsp_r),this), write16_delegate(FUNC(segas32_state::arescue_dsp_w),this));
4212   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa00007, read16_delegate(FUNC(segas32_state::arescue_dsp_r),this), write16_delegate(FUNC(segas32_state::arescue_dsp_w),this));
42134213
42144214   m_dual_pcb_comms = auto_alloc_array(machine(), UINT16, 0x1000/2);
4215   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this));
4216   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),this));
4215   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this));
4216   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),this));
42174217
4218   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x810000, 0x810001, read16_delegate(FUNC(segas32_state::arescue_handshake_r),this));
4219   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x81000e, 0x81000f, read16_delegate(FUNC(segas32_state::arescue_slavebusy_r),this));
4218   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x810000, 0x810001, read16_delegate(FUNC(segas32_state::arescue_handshake_r),this));
4219   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x81000e, 0x81000f, read16_delegate(FUNC(segas32_state::arescue_slavebusy_r),this));
42204220
42214221   m_sw1_output = arescue_sw1_output;
42224222}
r18027r18028
42274227   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate());
42284228
42294229   /* install protection handlers */
4230   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa00100, 0xa0011f, read16_delegate(FUNC(segas32_state::arf_wakeup_protection_r),this));
4231   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa00fff, read16_delegate(FUNC(segas32_state::arabfgt_protection_r),this), write16_delegate(FUNC(segas32_state::arabfgt_protection_w),this));
4230   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa00100, 0xa0011f, read16_delegate(FUNC(segas32_state::arf_wakeup_protection_r),this));
4231   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa00fff, read16_delegate(FUNC(segas32_state::arabfgt_protection_r),this), write16_delegate(FUNC(segas32_state::arabfgt_protection_w),this));
42324232}
42334233
42344234
r18027r18028
42384238
42394239   /* install protection handlers */
42404240   m_system32_protram = auto_alloc_array(machine(), UINT16, 0x1000/2);
4241   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x20ba00, 0x20ba07, read16_delegate(FUNC(segas32_state::brival_protection_r),this));
4242   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa00000, 0xa00fff, write16_delegate(FUNC(segas32_state::brival_protection_w),this));
4241   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20ba00, 0x20ba07, read16_delegate(FUNC(segas32_state::brival_protection_r),this));
4242   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xa00000, 0xa00fff, write16_delegate(FUNC(segas32_state::brival_protection_w),this));
42434243}
42444244
42454245
r18027r18028
42484248   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate());
42494249
42504250   /* install protection handlers */
4251   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::darkedge_protection_r),this), write16_delegate(FUNC(segas32_state::darkedge_protection_w),this));
4251   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::darkedge_protection_r),this), write16_delegate(FUNC(segas32_state::darkedge_protection_w),this));
42524252   m_system32_prot_vblank = darkedge_fd1149_vblank;
42534253}
42544254
r18027r18028
42574257   segas32_common_init(machine(), read16_delegate(), write16_delegate());
42584258
42594259   /* install protection handlers */
4260   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::dbzvrvs_protection_r),this), write16_delegate(FUNC(segas32_state::dbzvrvs_protection_w),this));
4260   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa7ffff, read16_delegate(FUNC(segas32_state::dbzvrvs_protection_r),this), write16_delegate(FUNC(segas32_state::dbzvrvs_protection_w),this));
42614261}
42624262
42634263WRITE16_MEMBER(segas32_state::f1en_comms_echo_w)
r18027r18028
42724272   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this));
42734273
42744274   m_dual_pcb_comms = auto_alloc_array(machine(), UINT16, 0x1000/2);
4275   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this));
4276   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),this));
4275   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x810000, 0x810fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this));
4276   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x818000, 0x818003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),this));
42774277
4278   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x810048, 0x810049, write16_delegate(FUNC(segas32_state::f1en_comms_echo_w),this));
4278   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x810048, 0x810049, write16_delegate(FUNC(segas32_state::f1en_comms_echo_w),this));
42794279
42804280   m_sw1_output = radm_sw1_output;
42814281}
r18027r18028
42884288   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this));
42894289
42904290   m_dual_pcb_comms = auto_alloc_array(machine(), UINT16, 0x1000/2);
4291   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x800000, 0x800fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this));
4292   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x801000, 0x801003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),this));
4291   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x800000, 0x800fff, read16_delegate(FUNC(segas32_state::dual_pcb_comms_r),this), write16_delegate(FUNC(segas32_state::dual_pcb_comms_w),this));
4292   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x801000, 0x801003, read16_delegate(FUNC(segas32_state::dual_pcb_masterslave),this));
42934293
4294//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(segas32_state::f1en_comms_echo_w),this));
4294//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(segas32_state::f1en_comms_echo_w),this));
42954295   m_system32_prot_vblank = f1lap_fd1149_vblank;
42964296
42974297   m_sw1_output = f1lap_sw1_output;
r18027r18028
43034303   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::extra_custom_io_r),this), write16_delegate());
43044304
43054305   decrypt_ga2_protrom(machine());
4306   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa00000, 0xa00fff, read16_delegate(FUNC(segas32_state::ga2_dpram_r),this), write16_delegate(FUNC(segas32_state::ga2_dpram_w),this));
4306   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xa00000, 0xa00fff, read16_delegate(FUNC(segas32_state::ga2_dpram_r),this), write16_delegate(FUNC(segas32_state::ga2_dpram_w),this));
43074307}
43084308
43094309
r18027r18028
43634363DRIVER_INIT_MEMBER(segas32_state,scross)
43644364{
43654365   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::analog_custom_io_r),this), write16_delegate(FUNC(segas32_state::analog_custom_io_w),this));
4366   machine().device("soundcpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb0, 0xbf, write8_delegate(FUNC(segas32_state::scross_bank_w),this));
4366   machine().device("soundcpu")->memory().space(AS_PROGRAM).install_write_handler(0xb0, 0xbf, write8_delegate(FUNC(segas32_state::scross_bank_w),this));
43674367
43684368   m_sw1_output = scross_sw1_output;
43694369   m_sw2_output = scross_sw2_output;
r18027r18028
43814381   segas32_common_init(machine(), read16_delegate(FUNC(segas32_state::sonic_custom_io_r),this), write16_delegate(FUNC(segas32_state::sonic_custom_io_w),this));
43824382
43834383   /* install protection handlers */
4384   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20E5C4, 0x20E5C5, write16_delegate(FUNC(segas32_state::sonic_level_load_protection),this));
4384   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20E5C4, 0x20E5C5, write16_delegate(FUNC(segas32_state::sonic_level_load_protection),this));
43854385}
43864386
43874387
r18027r18028
44064406DRIVER_INIT_MEMBER(segas32_state,jleague)
44074407{
44084408   segas32_common_init(machine(), read16_delegate(), write16_delegate());
4409   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20F700, 0x20F705, write16_delegate(FUNC(segas32_state::jleague_protection_w),this));
4409   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20F700, 0x20F705, write16_delegate(FUNC(segas32_state::jleague_protection_w),this));
44104410}
44114411
44124412
trunk/src/mame/drivers/looping.c
r18027r18028
916916      rom[i] = BITSWAP8(rom[i], 0,1,2,3,4,5,6,7);
917917
918918   /* install protection handlers */
919   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x7000, 0x7007, read8_delegate(FUNC(looping_state::protection_r), this));
919   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7000, 0x7007, read8_delegate(FUNC(looping_state::protection_r), this));
920920}
921921
922922
trunk/src/mame/drivers/badlands.c
r18027r18028
187187
188188static void scanline_update(screen_device &screen, int scanline)
189189{
190   address_space &space = *screen.machine().device("audiocpu")->memory().space(AS_PROGRAM);
190   address_space &space = screen.machine().device("audiocpu")->memory().space(AS_PROGRAM);
191191
192192   /* sound IRQ is on 32V */
193193   if (scanline & 32)
trunk/src/mame/drivers/slapfght.c
r18027r18028
17391739
17401740DRIVER_INIT_MEMBER(slapfght_state,tigerh)
17411741{
1742   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::tigerh_mcu_r),this), write8_delegate(FUNC(slapfght_state::tigerh_mcu_w),this));
1742   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::tigerh_mcu_r),this), write8_delegate(FUNC(slapfght_state::tigerh_mcu_w),this));
17431743}
17441744
17451745DRIVER_INIT_MEMBER(slapfght_state,tigerhb)
17461746{
1747   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::tigerhb_e803_r),this), write8_delegate(FUNC(slapfght_state::tigerhb_e803_w),this));
1747   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::tigerhb_e803_r),this), write8_delegate(FUNC(slapfght_state::tigerhb_e803_w),this));
17481748}
17491749
17501750
r18027r18028
18051805static void getstar_init( running_machine &machine )
18061806{
18071807   slapfght_state *state = machine.driver_data<slapfght_state>();
1808   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::getstar_e803_r),state), write8_delegate(FUNC(slapfght_state::getstar_e803_w),state));
1809   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::slapfight_port_00_r),state));
1808   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::getstar_e803_r),state), write8_delegate(FUNC(slapfght_state::getstar_e803_w),state));
1809   machine.device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::slapfight_port_00_r),state));
18101810}
18111811
18121812DRIVER_INIT_MEMBER(slapfght_state,getstar)
r18027r18028
18291829   getstar_init(machine());
18301830
18311831   /* specific handlers for this bootleg */
1832   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0, 0x0, read8_delegate(FUNC(slapfght_state::gtstarb1_port_0_read),this));
1832   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0, 0x0, read8_delegate(FUNC(slapfght_state::gtstarb1_port_0_read),this));
18331833   /* requires this or it gets stuck with 'rom test' on screen */
18341834   /* it is possible the program roms are slighly corrupt like the gfx roms, or
18351835       that the bootleg simply shouldn't execute the code due to the modified roms */
r18027r18028
18451845
18461846DRIVER_INIT_MEMBER(slapfght_state,slapfigh)
18471847{
1848   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::slapfight_mcu_r),this), write8_delegate(FUNC(slapfght_state::slapfight_mcu_w),this));
1849   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::slapfight_mcu_status_r),this));
1848   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe803, 0xe803, read8_delegate(FUNC(slapfght_state::slapfight_mcu_r),this), write8_delegate(FUNC(slapfght_state::slapfight_mcu_w),this));
1849   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::slapfight_mcu_status_r),this));
18501850}
18511851
18521852DRIVER_INIT_MEMBER(slapfght_state,perfrman)
18531853{
1854   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::perfrman_port_00_r),this));
1854   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(slapfght_state::perfrman_port_00_r),this));
18551855}
18561856
18571857/*  ( YEAR  NAME        PARENT    MACHINE     INPUT     INIT      MONITOR  COMPANY    FULLNAME     FLAGS ) */
trunk/src/mame/drivers/psikyosh.c
r18027r18028
12591259{
12601260   sh2drc_set_options(machine().device("maincpu"), SH2DRC_FASTEST_OPTIONS);
12611261   /* needs to install mahjong controls too (can select joystick in test mode tho) */
1262   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x03000000, 0x03000003, read32_delegate(FUNC(psikyosh_state::mjgtaste_input_r),this));
1262   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x03000000, 0x03000003, read32_delegate(FUNC(psikyosh_state::mjgtaste_input_r),this));
12631263}
12641264
12651265
trunk/src/mame/drivers/supertnk.c
r18027r18028
288288
289289void supertnk_state::machine_reset()
290290{
291   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
291   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
292292   supertnk_bankswitch_0_w(space, 0, 0);
293293   supertnk_bankswitch_1_w(space, 0, 0);
294294
trunk/src/mame/drivers/offtwall.c
r18027r18028
490490   atarijsa_init(machine(), "260010", 0x0040);
491491
492492   /* install son-of-slapstic workarounds */
493   m_spritecache_count = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this));
494   m_bankswitch_base = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x037ec2, 0x037f39, read16_delegate(FUNC(offtwall_state::bankswitch_r),this));
495   m_unknown_verify_base = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fdf1e, 0x3fdf1f, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this));
493   m_spritecache_count = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this));
494   m_bankswitch_base = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x037ec2, 0x037f39, read16_delegate(FUNC(offtwall_state::bankswitch_r),this));
495   m_unknown_verify_base = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3fdf1e, 0x3fdf1f, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this));
496496}
497497
498498
r18027r18028
502502   atarijsa_init(machine(), "260010", 0x0040);
503503
504504   /* install son-of-slapstic workarounds */
505   m_spritecache_count = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this));
506   m_bankswitch_base = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x037eca, 0x037f43, read16_delegate(FUNC(offtwall_state::bankswitch_r),this));
507   m_unknown_verify_base = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3fdf24, 0x3fdf25, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this));
505   m_spritecache_count = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this));
506   m_bankswitch_base = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x037eca, 0x037f43, read16_delegate(FUNC(offtwall_state::bankswitch_r),this));
507   m_unknown_verify_base = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3fdf24, 0x3fdf25, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this));
508508}
509509
510510
trunk/src/mame/drivers/neodrvr.c
r18027r18028
97249724   neo_pcm2_swap(machine(), 5);
97259725   m_fixed_layer_bank_type = 2;
97269726   install_pvc_protection(machine());
9727   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc00000, 0xc7ffff, "bios" );  // 512k bios
9727   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc00000, 0xc7ffff, "bios" );  // 512k bios
97289728}
97299729
97309730DRIVER_INIT_MEMBER(neogeo_state,kof2003)
r18027r18028
97969796   kof2000_neogeo_gfx_decrypt(machine(), 0xac);
97979797
97989798   /* install some extra RAM */
9799   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x200000, 0x201fff);
9799   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x200000, 0x201fff);
98009800
9801//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x280000, 0x280001, "IN5");
9802//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2c0000, 0x2c0001, "IN6");
9801//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x280000, 0x280001, "IN5");
9802//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2c0000, 0x2c0001, "IN6");
98039803}
98049804
98059805DRIVER_INIT_MEMBER(neogeo_state,vliner)
98069806{
9807   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x200000, 0x201fff);
9807   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x200000, 0x201fff);
98089808
9809   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x280000, 0x280001, "IN5");
9810   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2c0000, 0x2c0001, "IN6");
9809   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x280000, 0x280001, "IN5");
9810   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2c0000, 0x2c0001, "IN6");
98119811
98129812   DRIVER_INIT_CALL(neogeo);
98139813}
r18027r18028
98159815DRIVER_INIT_MEMBER(neogeo_state,kog)
98169816{
98179817   /* overlay cartridge ROM */
9818   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x0ffffe, 0x0fffff, "JUMPER");
9818   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x0ffffe, 0x0fffff, "JUMPER");
98199819
98209820   kog_px_decrypt(machine());
98219821   neogeo_bootleg_sx_decrypt(machine(), 1);
r18027r18028
98759875   // there are also writes to 0x1080..
98769876   //
98779877   // other stuff going on as well tho, the main overlay is still missing, and p1 inputs don't work
9878   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x00200, 0x001fff, FUNC(sbp_lowerrom_r));
9879   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x00200, 0x001fff, FUNC(sbp_lowerrom_w));
9878   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x00200, 0x001fff, FUNC(sbp_lowerrom_r));
9879   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x00200, 0x001fff, FUNC(sbp_lowerrom_w));
98809880
98819881   /* the game code clears the text overlay used ingame immediately after writing it.. why? protection? sloppy code that the hw ignores? imperfect emulation? */
98829882   {
trunk/src/mame/drivers/segas16a.c
r18027r18028
427427WRITE8_DEVICE_HANDLER( segas16a_state::static_n7751_rom_offset_w )
428428{
429429   segas16a_state *state = device->machine().driver_data<segas16a_state>();
430   state->n7751_rom_offset_w(*state->m_maincpu->space(AS_PROGRAM), offset, data);
430   state->n7751_rom_offset_w(state->m_maincpu->space(AS_PROGRAM), offset, data);
431431}
432432
433433
r18027r18028
539539      case 0:
540540         // access main work RAM
541541         if (offset >= 0x4000 && offset < 0x8000)
542            m_maincpu->space(AS_PROGRAM)->write_byte(0xc70001 ^ (offset & 0x3fff), data);
542            m_maincpu->space(AS_PROGRAM).write_byte(0xc70001 ^ (offset & 0x3fff), data);
543543
544544         // access misc I/O space
545545         else if (offset >= 0x8000 && offset < 0xc000)
546            m_maincpu->space(AS_PROGRAM)->write_byte(0xc40001 ^ (offset & 0x3fff), data);
546            m_maincpu->space(AS_PROGRAM).write_byte(0xc40001 ^ (offset & 0x3fff), data);
547547         else
548548            logerror("%03X: MCU movx write mode %02X offset %04X = %02X\n", m_mcu->pc(), m_mcu_control, offset, data);
549549         break;
r18027r18028
551551      // access text RAM
552552      case 1:
553553         if (offset >= 0x8000 && offset < 0x9000)
554            m_maincpu->space(AS_PROGRAM)->write_byte(0x410001 ^ (offset & 0xfff), data);
554            m_maincpu->space(AS_PROGRAM).write_byte(0x410001 ^ (offset & 0xfff), data);
555555         else
556556            logerror("%03X: MCU movx write mode %02X offset %04X = %02X\n", m_mcu->pc(), m_mcu_control, offset, data);
557557         break;
558558
559559      // access palette RAM
560560      case 3:
561         m_maincpu->space(AS_PROGRAM)->write_byte(0x840001 ^ offset, data);
561         m_maincpu->space(AS_PROGRAM).write_byte(0x840001 ^ offset, data);
562562         break;
563563
564564      // access ROMs - fall through to logging
r18027r18028
590590
591591         // access main work RAM
592592         else if (offset >= 0x4000 && offset < 0x8000)
593            return m_maincpu->space(AS_PROGRAM)->read_byte(0xc70001 ^ (offset & 0x3fff));
593            return m_maincpu->space(AS_PROGRAM).read_byte(0xc70001 ^ (offset & 0x3fff));
594594
595595         // access misc I/O space
596596         else if (offset >= 0x8000 && offset < 0xc000)
597            return m_maincpu->space(AS_PROGRAM)->read_byte(0xc40001 ^ (offset & 0x3fff));
597            return m_maincpu->space(AS_PROGRAM).read_byte(0xc40001 ^ (offset & 0x3fff));
598598         logerror("%03X: MCU movx read mode %02X offset %04X\n", m_mcu->pc(), m_mcu_control, offset);
599599         return 0xff;
600600
601601      // access text RAM
602602      case 1:
603603         if (offset >= 0x8000 && offset < 0x9000)
604            return m_maincpu->space(AS_PROGRAM)->read_byte(0x410001 ^ (offset & 0xfff));
604            return m_maincpu->space(AS_PROGRAM).read_byte(0x410001 ^ (offset & 0xfff));
605605         logerror("%03X: MCU movx read mode %02X offset %04X\n", m_mcu->pc(), m_mcu_control, offset);
606606         return 0xff;
607607
608608      // access palette RAM
609609      case 3:
610         return m_maincpu->space(AS_PROGRAM)->read_byte(0x840001 ^ offset);
610         return m_maincpu->space(AS_PROGRAM).read_byte(0x840001 ^ offset);
611611
612612      // access ROMs
613613      case 5:
r18027r18028
695695
696696      // synchronize writes to the 8255 PPI
697697      case TID_PPI_WRITE:
698         m_i8255->write(*m_maincpu->space(AS_PROGRAM), param >> 8, param & 0xff);
698         m_i8255->write(m_maincpu->space(AS_PROGRAM), param >> 8, param & 0xff);
699699         break;
700700   }
701701}
r18027r18028
767767   m_maincpu->set_input_line(4, HOLD_LINE);
768768
769769   // X scroll values
770   address_space &space = *m_maincpu->space(AS_PROGRAM);
770   address_space &space = m_maincpu->space(AS_PROGRAM);
771771   segaic16_textram_0_w(space, 0xff8/2, m_workram[0x0d14/2], 0xffff);
772772   segaic16_textram_0_w(space, 0xffa/2, m_workram[0x0d18/2], 0xffff);
773773
trunk/src/mame/drivers/neogeo.c
r18027r18028
685685
686686static void main_cpu_banking_init( running_machine &machine )
687687{
688   address_space &mainspace = *machine.device("maincpu")->memory().space(AS_PROGRAM);
688   address_space &mainspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
689689
690690   /* create vector banks */
691691   machine.root_device().membank(NEOGEO_BANK_VECTORS)->configure_entry(0, machine.root_device().memregion("mainbios")->base());
r18027r18028
826826   set_audio_cpu_banking(machine);
827827
828828   state->m_audio_cpu_rom_source_last = 0;
829   set_audio_cpu_rom_source(*machine.device("maincpu")->memory().space(AS_PROGRAM), 0);
829   set_audio_cpu_rom_source(machine.device("maincpu")->memory().space(AS_PROGRAM), 0);
830830}
831831
832832
r18027r18028
982982   _set_main_cpu_bank_address(machine);
983983   _set_main_cpu_vector_table_source(machine);
984984   set_audio_cpu_banking(machine);
985   _set_audio_cpu_rom_source(*machine.device("maincpu")->memory().space(AS_PROGRAM));
985   _set_audio_cpu_rom_source(machine.device("maincpu")->memory().space(AS_PROGRAM));
986986   set_outputs(machine);
987987}
988988
r18027r18028
10501050void neogeo_state::machine_reset()
10511051{
10521052   offs_t offs;
1053   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1053   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
10541054
10551055   /* reset system control registers */
10561056   for (offs = 0; offs < 8; offs++)
r18027r18028
13361336      }
13371337
13381338      // setup cartridge ROM area
1339      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x000080,0x0fffff,"cart_rom");
1339      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x000080,0x0fffff,"cart_rom");
13401340      image.device().machine().root_device().membank("cart_rom")->set_base(&image.device().machine().root_device().memregion("maincpu")->base()[0x80]);
13411341
13421342      // handle possible protection
trunk/src/mame/drivers/segahang.c
r18027r18028
437437
438438      // synchronize writes to the 8255 PPI
439439      case TID_PPI_WRITE:
440         m_i8255_1->write(*m_maincpu->space(AS_PROGRAM), param >> 8, param & 0xff);
440         m_i8255_1->write(m_maincpu->space(AS_PROGRAM), param >> 8, param & 0xff);
441441         break;
442442   }
443443}
r18027r18028
17911791   UINT16 *decrypt = auto_alloc_array(machine(), UINT16, 0x40000/2);
17921792   memcpy(decrypt + 0x00000/2, rom + 0x30000/2, 0x10000);
17931793   memcpy(decrypt + 0x10000/2, rom + 0x10000/2, 0x20000);
1794   m_maincpu->space(AS_PROGRAM)->set_decrypted_region(0x000000, 0x03ffff, decrypt);
1794   m_maincpu->space(AS_PROGRAM).set_decrypted_region(0x000000, 0x03ffff, decrypt);
17951795}
17961796
17971797DRIVER_INIT_MEMBER(segahang_state,endurob2)
r18027r18028
18021802   UINT16 *rom = reinterpret_cast<UINT16 *>(memregion("maincpu")->base());
18031803   UINT16 *decrypt = auto_alloc_array(machine(), UINT16, 0x40000/2);
18041804   memcpy(decrypt, rom, 0x30000);
1805   m_maincpu->space(AS_PROGRAM)->set_decrypted_region(0x000000, 0x03ffff, decrypt);
1805   m_maincpu->space(AS_PROGRAM).set_decrypted_region(0x000000, 0x03ffff, decrypt);
18061806}
18071807
18081808
trunk/src/mame/drivers/statriv2.c
r18027r18028
11281128
11291129DRIVER_INIT_MEMBER(statriv2_state,laserdisc)
11301130{
1131   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1132   iospace->install_readwrite_handler(0x28, 0x2b, read8_delegate(FUNC(statriv2_state::laserdisc_io_r), this), write8_delegate(FUNC(statriv2_state::laserdisc_io_w), this));
1131   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
1132   iospace.install_readwrite_handler(0x28, 0x2b, read8_delegate(FUNC(statriv2_state::laserdisc_io_r), this), write8_delegate(FUNC(statriv2_state::laserdisc_io_w), this));
11331133}
11341134
11351135
trunk/src/mame/drivers/ladybug.c
r18027r18028
10681068   /* decode the opcodes */
10691069
10701070   offs_t i;
1071   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1071   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
10721072   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
10731073   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
10741074   UINT8 *table = machine().root_device().memregion("user1")->base();
trunk/src/mame/drivers/gottlieb.c
r18027r18028
244244   if (m_laserdisc != NULL)
245245   {
246246      /* attach to the I/O ports */
247      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x05805, 0x05807, 0, 0x07f8, read8_delegate(FUNC(gottlieb_state::laserdisc_status_r),this));
248      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x05805, 0x05805, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_command_w),this));   /* command for the player */
249      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x05806, 0x05806, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_select_w),this));
247      machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x05805, 0x05807, 0, 0x07f8, read8_delegate(FUNC(gottlieb_state::laserdisc_status_r),this));
248      machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x05805, 0x05805, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_command_w),this));   /* command for the player */
249      machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x05806, 0x05806, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_select_w),this));
250250
251251      /* allocate a timer for serial transmission, and one for philips code processing */
252252      m_laserdisc_bit_timer = machine().scheduler().timer_alloc(FUNC(laserdisc_bit_callback));
r18027r18028
24512451DRIVER_INIT_MEMBER(gottlieb_state,stooges)
24522452{
24532453   DRIVER_INIT_CALL(ramtiles);
2454   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x05803, 0x05803, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::stooges_output_w),this));
2454   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x05803, 0x05803, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::stooges_output_w),this));
24552455}
24562456
24572457
trunk/src/mame/drivers/ddragon.c
r18027r18028
20022002   m_sound_irq = M6809_IRQ_LINE;
20032003   m_ym_irq = M6809_FIRQ_LINE;
20042004   m_technos_video_hw = 0;
2005   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::darktowr_bankswitch_w),this));
2005   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::darktowr_bankswitch_w),this));
20062006}
20072007
20082008
r18027r18028
20142014   m_sound_irq = M6809_IRQ_LINE;
20152015   m_ym_irq = M6809_FIRQ_LINE;
20162016   m_technos_video_hw = 0;
2017   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::toffy_bankswitch_w),this));
2017   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::toffy_bankswitch_w),this));
20182018
20192019   /* the program rom has a simple bitswap encryption */
20202020   rom = memregion("maincpu")->base();
trunk/src/mame/drivers/groundfx.c
r18027r18028
456456   int data;
457457
458458   /* Speedup handlers */
459   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x20b574, 0x20b577, read32_delegate(FUNC(groundfx_state::irq_speedup_r_groundfx),this));
459   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20b574, 0x20b577, read32_delegate(FUNC(groundfx_state::irq_speedup_r_groundfx),this));
460460
461461   /* make piv tile GFX format suitable for gfxdecode */
462462   offset = size/2;
trunk/src/mame/drivers/m92.c
r18027r18028
21862186   UINT8 *ROM = memregion("maincpu")->base();
21872187
21882188   membank("bank1")->configure_entries(0, 4, &ROM[0x80000], 0x20000);
2189   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),this));
2189   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),this));
21902190
21912191   m_game_kludge = 0;
21922192   m_irq_vectorbase = 0x80;
r18027r18028
21982198   UINT8 *ROM = memregion("maincpu")->base();
21992199
22002200   membank("bank1")->configure_entries(0, 4, &ROM[0x80000], 0x20000);
2201   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),this));
2201   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x20, 0x21, write16_delegate(FUNC(m92_state::m92_bankswitch_w),this));
22022202
22032203   /* This game has an eeprom on the game board */
2204   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0000, 0xf3fff, read16_delegate(FUNC(m92_state::m92_eeprom_r),this), write16_delegate(FUNC(m92_state::m92_eeprom_w),this));
2204   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0000, 0xf3fff, read16_delegate(FUNC(m92_state::m92_eeprom_r),this), write16_delegate(FUNC(m92_state::m92_eeprom_w),this));
22052205
22062206   m_game_kludge = 2;
22072207   m_irq_vectorbase = 0x80;
trunk/src/mame/drivers/multigam.c
r18027r18028
570570   memcpy(&dst[0x8000], prg_base + (prg_size - 0x4000), 0x4000);
571571   memcpy(&dst[0xc000], prg_base + (prg_size - 0x4000), 0x4000);
572572
573   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigam3_mmc3_rom_switch_w),state));
573   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigam3_mmc3_rom_switch_w),state));
574574
575575   state->m_multigam3_mmc3_banks[0] = 0x1e;
576576   state->m_multigam3_mmc3_banks[1] = 0x1f;
r18027r18028
679679   ppu2c0x_device *ppu = machine.device<ppu2c0x_device>("ppu");
680680   UINT8* mem = state->memregion("maincpu")->base();
681681   memcpy(mem + 0x8000, prg_base + prg_size - 0x8000, 0x8000);
682   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigam3_mapper02_rom_switch_w),state));
682   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::multigam3_mapper02_rom_switch_w),state));
683683
684684   state->m_mapper02_prg_base = prg_base;
685685   state->m_mapper02_prg_size = prg_size;
r18027r18028
835835
836836   memcpy(&dst[0x8000], prg_base + (prg_size - 0x8000), 0x8000);
837837
838   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::mmc1_rom_switch_w),state));
838   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8000, 0xffff, write8_delegate(FUNC(multigam_state::mmc1_rom_switch_w),state));
839839
840840   state->m_mmc1_reg_write_enable = 1;
841841   state->m_mmc1_rom_mask = (prg_size / 0x4000) - 1;
r18027r18028
880880      state->m_supergm3_chr_bank == 0x40 )
881881   {
882882      // VRAM
883      ppu->space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1");
884      ppu->space(AS_PROGRAM)->install_write_bank(0x0000, 0x1fff, "bank1");
883      ppu->space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "bank1");
884      ppu->space(AS_PROGRAM).install_write_bank(0x0000, 0x1fff, "bank1");
885885      state->membank("bank1")->set_base(state->m_vram);
886886
887887      if (state->m_supergm3_chr_bank == 0x40)
r18027r18028
889889   }
890890   else
891891   {
892      ppu->space(AS_PROGRAM)->install_read_bank(0x0000, 0x03ff, "bank2");
893      ppu->space(AS_PROGRAM)->install_read_bank(0x0400, 0x07ff, "bank3");
894      ppu->space(AS_PROGRAM)->install_read_bank(0x0800, 0x0bff, "bank4");
895      ppu->space(AS_PROGRAM)->install_read_bank(0x0c00, 0x0fff, "bank5");
896      ppu->space(AS_PROGRAM)->install_read_bank(0x1000, 0x13ff, "bank6");
897      ppu->space(AS_PROGRAM)->install_read_bank(0x1400, 0x17ff, "bank7");
898      ppu->space(AS_PROGRAM)->install_read_bank(0x1800, 0x1bff, "bank8");
899      ppu->space(AS_PROGRAM)->install_read_bank(0x1c00, 0x1fff, "bank9");
900      ppu->space(AS_PROGRAM)->unmap_write(0x0000, 0x1fff);
892      ppu->space(AS_PROGRAM).install_read_bank(0x0000, 0x03ff, "bank2");
893      ppu->space(AS_PROGRAM).install_read_bank(0x0400, 0x07ff, "bank3");
894      ppu->space(AS_PROGRAM).install_read_bank(0x0800, 0x0bff, "bank4");
895      ppu->space(AS_PROGRAM).install_read_bank(0x0c00, 0x0fff, "bank5");
896      ppu->space(AS_PROGRAM).install_read_bank(0x1000, 0x13ff, "bank6");
897      ppu->space(AS_PROGRAM).install_read_bank(0x1400, 0x17ff, "bank7");
898      ppu->space(AS_PROGRAM).install_read_bank(0x1800, 0x1bff, "bank8");
899      ppu->space(AS_PROGRAM).install_read_bank(0x1c00, 0x1fff, "bank9");
900      ppu->space(AS_PROGRAM).unmap_write(0x0000, 0x1fff);
901901
902902      set_videorom_bank(machine, 0, 8, 0, 8);
903903   }
r18027r18028
11391139
11401140MACHINE_RESET_MEMBER(multigam_state,multigm3)
11411141{
1142   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1142   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
11431143   /* reset the ppu */
11441144   multigm3_switch_prg_rom(space, 0, 0x01 );
11451145};
r18027r18028
11521152   m_nt_page[2] = m_nt_ram + 0x800;
11531153   m_nt_page[3] = m_nt_ram + 0xc00;
11541154
1155   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),this), write8_delegate(FUNC(multigam_state::multigam_nt_w),this));
1156   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1");
1155   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),this), write8_delegate(FUNC(multigam_state::multigam_nt_w),this));
1156   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "bank1");
11571157   membank("bank1")->set_base(memregion("gfx1")->base());
11581158}
11591159
r18027r18028
11651165   m_nt_page[2] = m_nt_ram + 0x800;
11661166   m_nt_page[3] = m_nt_ram + 0xc00;
11671167
1168   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),this), write8_delegate(FUNC(multigam_state::multigam_nt_w),this));
1168   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),this), write8_delegate(FUNC(multigam_state::multigam_nt_w),this));
11691169
1170   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x03ff, "bank2");
1171   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0400, 0x07ff, "bank3");
1172   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0800, 0x0bff, "bank4");
1173   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0c00, 0x0fff, "bank5");
1174   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x1000, 0x13ff, "bank6");
1175   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x1400, 0x17ff, "bank7");
1176   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x1800, 0x1bff, "bank8");
1177   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x1c00, 0x1fff, "bank9");
1170   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x03ff, "bank2");
1171   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0400, 0x07ff, "bank3");
1172   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0800, 0x0bff, "bank4");
1173   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0c00, 0x0fff, "bank5");
1174   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x1000, 0x13ff, "bank6");
1175   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x1400, 0x17ff, "bank7");
1176   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x1800, 0x1bff, "bank8");
1177   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x1c00, 0x1fff, "bank9");
11781178
11791179   set_videorom_bank(machine(), 0, 8, 0, 8);
11801180};
r18027r18028
11871187   m_nt_page[2] = m_nt_ram + 0x800;
11881188   m_nt_page[3] = m_nt_ram + 0xc00;
11891189
1190   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),this), write8_delegate(FUNC(multigam_state::multigam_nt_w),this));
1190   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(multigam_state::multigam_nt_r),this), write8_delegate(FUNC(multigam_state::multigam_nt_w),this));
11911191
11921192   m_vram = auto_alloc_array(machine(), UINT8, 0x2000);
11931193   m_multigmc_mmc3_6000_ram = auto_alloc_array(machine(), UINT8, 0x2000);
r18027r18028
13611361
13621362DRIVER_INIT_MEMBER(multigam_state,multigam)
13631363{
1364   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1364   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
13651365   multigam_switch_prg_rom(space, 0x0, 0x01);
13661366}
13671367
r18027r18028
13761376
13771377DRIVER_INIT_MEMBER(multigam_state,multigm3)
13781378{
1379   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1379   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
13801380
13811381   const UINT8 decode[16]  = { 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a };
13821382
r18027r18028
13901390
13911391DRIVER_INIT_MEMBER(multigam_state,multigmt)
13921392{
1393   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1393   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
13941394
13951395   UINT8* buf = auto_alloc_array(machine(), UINT8, 0x80000);
13961396   UINT8 *rom;
trunk/src/mame/drivers/vcombat.c
r18027r18028
448448   UINT8 *ROM = memregion("maincpu")->base();
449449
450450   /* The two i860s execute out of RAM */
451   address_space &v0space = *machine().device<i860_device>("vid_0")->space(AS_PROGRAM);
451   address_space &v0space = machine().device<i860_device>("vid_0")->space(AS_PROGRAM);
452452   v0space.set_direct_update_handler(direct_update_delegate(FUNC(vcombat_state::vcombat_vid_0_direct_handler), this));
453453
454   address_space &v1space = *machine().device<i860_device>("vid_1")->space(AS_PROGRAM);
454   address_space &v1space = machine().device<i860_device>("vid_1")->space(AS_PROGRAM);
455455   v1space.set_direct_update_handler(direct_update_delegate(FUNC(vcombat_state::vcombat_vid_1_direct_handler), this));
456456
457457   /* Allocate the 68000 framebuffers */
r18027r18028
495495   m_i860_framebuffer[1][1] = NULL;
496496
497497   /* The i860 executes out of RAM */
498   address_space &space = *machine().device<i860_device>("vid_0")->space(AS_PROGRAM);
498   address_space &space = machine().device<i860_device>("vid_0")->space(AS_PROGRAM);
499499   space.set_direct_update_handler(direct_update_delegate(FUNC(vcombat_state::vcombat_vid_0_direct_handler), this));
500500}
501501
trunk/src/mame/drivers/39in1.c
r18027r18028
280280
281281   // Load the next descriptor
282282
283   address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
283   address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
284284   dma_regs->dsadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x4);
285285   dma_regs->dtadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x8);
286286   dma_regs->dcmd[channel]  = space.read_dword(dma_regs->ddadr[channel] + 0xc);
r18027r18028
320320   UINT16 temp16;
321321   UINT32 temp32;
322322
323   address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
323   address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
324324   switch(param)
325325   {
326326      case 3:
r18027r18028
11131113
11141114      if(lcd_regs->dma[channel].ldcmd & PXA255_LDCMD_PAL)
11151115      {
1116         address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
1116         address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
11171117         int length = lcd_regs->dma[channel].ldcmd & 0x000fffff;
11181118         int index = 0;
11191119         for(index = 0; index < length; index += 2)
r18027r18028
11251125      }
11261126      else
11271127      {
1128         address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
1128         address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
11291129         int length = lcd_regs->dma[channel].ldcmd & 0x000fffff;
11301130         int index = 0;
11311131         for(index = 0; index < length; index++)
r18027r18028
11451145   {
11461146      verboselog( machine, 4, "pxa255_lcd_check_load_next_branch: Taking branch\n" );
11471147      lcd_regs->fbr[channel] &= ~1;
1148      address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
1148      address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM);
11491149      //lcd_regs->fbr[channel] = (space.read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003);
11501150      //printf( "%08x\n", lcd_regs->fbr[channel] );
11511151      pxa255_lcd_load_dma_descriptor(space, lcd_regs->fbr[channel] & 0xfffffff0, 0);
r18027r18028
14661466   m_dmadac[1] = machine().device<dmadac_sound_device>("dac2");
14671467   m_eeprom = machine().device<eeprom_device>("eeprom");
14681468
1469   address_space &space = *machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM);
1469   address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM);
14701470   space.install_read_handler (0xa0151648, 0xa015164b, read32_delegate(FUNC(_39in1_state::prot_cheater_r), this));
14711471}
14721472
trunk/src/mame/drivers/guab.c
r18027r18028
608608   if (newval == 0)
609609   {
610610      UINT32 credit;
611      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
611      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
612612
613613      /* Get the current credit value and add the new coin value */
614614      credit = space.read_dword(0x8002c) + (UINT32)(FPTR)param;
trunk/src/mame/drivers/mcr.c
r18027r18028
28002800   machine().device<midway_ssio_device>("ssio")->set_custom_input(0, 0x8e, read8_delegate(FUNC(mcr_state::dpoker_ip0_r),this));
28012801
28022802   // meter ram, is it battery backed?
2803   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x8000, 0x81ff);
2803   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x8000, 0x81ff);
28042804
28052805   // extra I/O
2806   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x24, 0x24, "P24");
2807   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x28, 0x28, "P28");
2808   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x2c, 0x2c, "P2C");
2806   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x24, 0x24, "P24");
2807   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x28, 0x28, "P28");
2808   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x2c, 0x2c, "P2C");
28092809
2810   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x2c, 0x2c, write8_delegate(FUNC(mcr_state::dpoker_lamps1_w),this));
2811   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x30, 0x30, write8_delegate(FUNC(mcr_state::dpoker_lamps2_w),this));
2812   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x34, 0x34, write8_delegate(FUNC(mcr_state::dpoker_output_w),this));
2813   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(mcr_state::dpoker_meters_w),this));
2810   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x2c, 0x2c, write8_delegate(FUNC(mcr_state::dpoker_lamps1_w),this));
2811   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x30, 0x30, write8_delegate(FUNC(mcr_state::dpoker_lamps2_w),this));
2812   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x34, 0x34, write8_delegate(FUNC(mcr_state::dpoker_output_w),this));
2813   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(mcr_state::dpoker_meters_w),this));
28142814
28152815   dpoker_coin_status = 0;
28162816   dpoker_output = 0;
r18027r18028
28412841   mcr_init(machine(), 90010, 91399, 90913);
28422842
28432843   machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::twotiger_op4_w),this));
2844   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xe800, 0xefff, 0, 0x1000, read8_delegate(FUNC(mcr_state::twotiger_videoram_r),this), write8_delegate(FUNC(mcr_state::twotiger_videoram_w),this));
2844   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe800, 0xefff, 0, 0x1000, read8_delegate(FUNC(mcr_state::twotiger_videoram_r),this), write8_delegate(FUNC(mcr_state::twotiger_videoram_w),this));
28452845}
28462846
28472847
trunk/src/mame/drivers/cham24.c
r18027r18028
322322   memcpy(&dst[0xc000], &src[0x0f8000], 0x4000);
323323
324324   /* uses 8K swapping, all ROM!*/
325   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1");
325   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "bank1");
326326   membank("bank1")->set_base(memregion("gfx1")->base());
327327
328328   /* need nametable ram, though. I doubt this uses more than 2k, but it starts up configured for 4 */
r18027r18028
333333   m_nt_page[3] = m_nt_ram + 0xc00;
334334
335335   /* and read/write handlers */
336   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff,read8_delegate(FUNC(cham24_state::nt_r), this), write8_delegate(FUNC(cham24_state::nt_w), this));
336   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff,read8_delegate(FUNC(cham24_state::nt_r), this), write8_delegate(FUNC(cham24_state::nt_w), this));
337337}
338338
339339DRIVER_INIT_MEMBER(cham24_state,cham24)
trunk/src/mame/drivers/thepit.c
r18027r18028
10911091DRIVER_INIT_MEMBER(thepit_state,rtriv)
10921092{
10931093   // Set-up the weirdest questions read ever done
1094   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x4000, 0x4fff, read8_delegate(FUNC(thepit_state::rtriv_question_r),this));
1094   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x4fff, read8_delegate(FUNC(thepit_state::rtriv_question_r),this));
10951095}
10961096
10971097
trunk/src/mame/drivers/backfire.c
r18027r18028
714714   deco156_decrypt(machine());
715715   machine().device("maincpu")->set_clock_scale(4.0f); /* core timings aren't accurate */
716716   descramble_sound(machine());
717   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0170018, 0x017001b, read32_delegate(FUNC(backfire_state::backfire_speedup_r), this));
717   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0170018, 0x017001b, read32_delegate(FUNC(backfire_state::backfire_speedup_r), this));
718718}
719719
720720GAME( 1995, backfire,  0,        backfire,   backfire, backfire_state, backfire, ROT0, "Data East Corporation", "Backfire! (set 1)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/sidepckt.c
r18027r18028
502502
503503DRIVER_INIT_MEMBER(sidepckt_state,sidepckt)
504504{
505   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3014, 0x3014, read8_delegate(FUNC(sidepckt_state::sidepckt_i8751_r),this));
506   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3018, 0x3018, write8_delegate(FUNC(sidepckt_state::sidepckt_i8751_w),this));
505   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3014, 0x3014, read8_delegate(FUNC(sidepckt_state::sidepckt_i8751_r),this));
506   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x3018, 0x3018, write8_delegate(FUNC(sidepckt_state::sidepckt_i8751_w),this));
507507}
508508
509509DRIVER_INIT_MEMBER(sidepckt_state,sidepctj)
510510{
511   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3014, 0x3014, read8_delegate(FUNC(sidepckt_state::sidepckt_i8751_r),this));
512   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3018, 0x3018, write8_delegate(FUNC(sidepckt_state::sidepctj_i8751_w),this));
511   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3014, 0x3014, read8_delegate(FUNC(sidepckt_state::sidepckt_i8751_r),this));
512   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x3018, 0x3018, write8_delegate(FUNC(sidepckt_state::sidepctj_i8751_w),this));
513513}
514514
515515
trunk/src/mame/drivers/starwars.c
r18027r18028
4848   /* ESB-specific */
4949   if (m_is_esb)
5050   {
51      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
51      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
5252
5353      /* reset the slapstic */
5454      slapstic_reset();
r18027r18028
514514   m_slapstic_base = &rom[0x08000];
515515
516516   /* install an opcode base handler */
517   address_space &space = *machine().device<m6809_device>("maincpu")->space(AS_PROGRAM);
517   address_space &space = machine().device<m6809_device>("maincpu")->space(AS_PROGRAM);
518518   space.set_direct_update_handler(direct_update_delegate(FUNC(starwars_state::esb_setdirect), this));
519519
520520   /* install read/write handlers for it */
521   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x8000, 0x9fff, read8_delegate(FUNC(starwars_state::esb_slapstic_r),this), write8_delegate(FUNC(starwars_state::esb_slapstic_w),this));
521   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x8000, 0x9fff, read8_delegate(FUNC(starwars_state::esb_slapstic_r),this), write8_delegate(FUNC(starwars_state::esb_slapstic_w),this));
522522
523523   /* install additional banking */
524   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xffff, "bank2");
524   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xffff, "bank2");
525525
526526   /* prepare the matrix processor */
527527   m_is_esb = 1;
trunk/src/mame/drivers/savquest.c
r18027r18028
529529
530530   kbdc8042_init(machine(), &at8042);
531531   pc_vga_init(machine(), vga_setting, NULL);
532   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
532   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
533533}
534534
535535void savquest_state::machine_reset()
trunk/src/mame/drivers/coolridr.c
r18027r18028
12521252
12531253DRIVER_INIT_MEMBER(coolridr_state,coolridr)
12541254{
1255//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x60d88a4, 0x060d88a7, FUNC(coolridr_hack1_r) );
1256   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60d8894, 0x060d8897, read32_delegate(FUNC(coolridr_state::coolridr_hack2_r), this));
1255//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x60d88a4, 0x060d88a7, FUNC(coolridr_hack1_r) );
1256   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60d8894, 0x060d8897, read32_delegate(FUNC(coolridr_state::coolridr_hack2_r), this));
12571257}
12581258
12591259GAME( 1995, coolridr,    0, coolridr,    coolridr, coolridr_state,    coolridr, ROT0,  "Sega", "Cool Riders (US)",GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/mame/drivers/mpu4hw.c
r18027r18028
23592359
23602360MACHINE_START_MEMBER(mpu4_state,mpu4yam)
23612361{
2362   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2362   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
23632363   mpu4_config_common(machine());
23642364
23652365   m_link7a_connected=0;
r18027r18028
23692369
23702370MACHINE_START_MEMBER(mpu4_state,mpu4oki)
23712371{
2372   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2372   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
23732373   mpu4_config_common(machine());
23742374
23752375   m_link7a_connected=0;
r18027r18028
23792379
23802380MACHINE_START_MEMBER(mpu4_state,mpu4bwb)
23812381{
2382   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2382   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
23832383   mpu4_config_common(machine());
23842384
23852385   m_link7a_connected=0;
r18027r18028
25882588
25892589DRIVER_INIT_MEMBER(mpu4_state,m4default_big)
25902590{
2591   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2591   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
25922592   DRIVER_INIT_CALL(m4default);
25932593
25942594   int size = machine().root_device().memregion( "maincpu" )->bytes();
r18027r18028
26202620
26212621DRIVER_INIT_MEMBER(mpu4_state,m_frkstn)
26222622{
2623   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2623   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
26242624   DRIVER_INIT_CALL(m4default_big);
26252625   space.install_read_handler(0x0880, 0x0880, 0, 0, read8_delegate(FUNC(mpu4_state::crystal_sound_r),this));
26262626   space.install_write_handler(0x0881, 0x0881, 0, 0, write8_delegate(FUNC(mpu4_state::crystal_sound_w),this));
trunk/src/mame/drivers/gamtor.c
r18027r18028
12541254DRIVER_INIT_MEMBER(gaminator_state,gaminator)
12551255{
12561256   pc_vga_init(machine(), vga_setting, NULL);
1257   pc_vga_gamtor_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x44000000, *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x40000000);
1257   pc_vga_gamtor_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0x44000000, machine().device("maincpu")->memory().space(AS_PROGRAM), 0x40000000);
12581258}
12591259
12601260
trunk/src/mame/drivers/photoply.c
r18027r18028
378378DRIVER_INIT_MEMBER(photoply_state,photoply)
379379{
380380   pc_vga_init(machine(), vga_setting, NULL);
381   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
381   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
382382}
383383
384384GAME( 199?, photoply,  0,   photoply, photoply, photoply_state, photoply, ROT0, "Funworld", "Photo Play 2000 (v2.01)", GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/mame/drivers/crystal.c
r18027r18028
198198static void IntReq( running_machine &machine, int num )
199199{
200200   crystal_state *state = machine.driver_data<crystal_state>();
201   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
201   address_space &space = state->m_maincpu->space(AS_PROGRAM);
202202   UINT32 IntEn = space.read_dword(0x01800c08);
203203   UINT32 IntPend = space.read_dword(0x01800c0c);
204204   if (IntEn & (1 << num))
r18027r18028
276276static IRQ_CALLBACK( icallback )
277277{
278278   crystal_state *state = device->machine().driver_data<crystal_state>();
279   address_space &space = *device->memory().space(AS_PROGRAM);
279   address_space &space = device->memory().space(AS_PROGRAM);
280280   UINT32 IntPend = space.read_dword(0x01800c0c);
281281   int i;
282282
r18027r18028
652652
653653UINT32 crystal_state::screen_update_crystal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
654654{
655   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
655   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
656656   int DoFlip;
657657
658658   UINT32 B0 = 0x0;
r18027r18028
717717   // rising edge
718718   if (state)
719719   {
720      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
720      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
721721      UINT16 head, tail;
722722      int DoFlip = 0;
723723
trunk/src/mame/drivers/eprom.c
r18027r18028
721721   atarijsa_init(machine(), "260010", 0x0002);
722722
723723   /* install CPU synchronization handlers */
724   m_sync_data = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this));
725   m_sync_data = machine().device("extra")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this));
724   m_sync_data = machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this));
725   m_sync_data = machine().device("extra")->memory().space(AS_PROGRAM).install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this));
726726}
727727
728728
trunk/src/mame/drivers/famibox.c
r18027r18028
564564   m_nt_page[2] = m_nt_ram + 0x800;
565565   m_nt_page[3] = m_nt_ram + 0xc00;
566566
567   machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(famibox_state::famibox_nt_r), this), write8_delegate(FUNC(famibox_state::famibox_nt_w), this));
568   machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "ppubank1");
567   machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(famibox_state::famibox_nt_r), this), write8_delegate(FUNC(famibox_state::famibox_nt_w), this));
568   machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "ppubank1");
569569
570570   famicombox_bankswitch(machine(), 0);
571571
trunk/src/mame/drivers/cshooter.c
r18027r18028
676676
677677DRIVER_INIT_MEMBER(cshooter_state,cshootere)
678678{
679   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
679   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
680680   int A;
681681   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
682682   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
trunk/src/mame/drivers/midyunit.c
r18027r18028
152152
153153CUSTOM_INPUT_MEMBER(midyunit_state::narc_talkback_strobe_r)
154154{
155   return (m_narc_sound->read(*machine().memory().first_space(), 0) >> 8) & 1;
155   return (m_narc_sound->read(machine().driver_data()->generic_space(), 0) >> 8) & 1;
156156}
157157
158158
159159CUSTOM_INPUT_MEMBER(midyunit_state::narc_talkback_data_r)
160160{
161   return m_narc_sound->read(*machine().memory().first_space(), 0) & 0xff;
161   return m_narc_sound->read(machine().driver_data()->generic_space(), 0) & 0xff;
162162}
163163
164164
trunk/src/mame/drivers/maygay1b.c
r18027r18028
44324432   UINT8 *okirom = machine().root_device().memregion( "msm6376" )->base();
44334433
44344434   if (!okirom) {
4435      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x2420, 0x2421, write8_delegate(FUNC(maygay1b_state::m1ab_no_oki_w), this));
4435      machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2420, 0x2421, write8_delegate(FUNC(maygay1b_state::m1ab_no_oki_w), this));
44364436   }
44374437   // print out the rom id / header info to give us some hints
44384438   // note this isn't always correct, alley cat has 'Calpsyo' still in the ident string?
trunk/src/mame/drivers/bzone.c
r18027r18028
876876
877877DRIVER_INIT_MEMBER(bzone_state,bradley)
878878{
879   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
879   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
880880   space.install_ram(0x400, 0x7ff);
881881   space.install_read_port(0x1808, 0x1808, "1808");
882882   space.install_read_port(0x1809, 0x1809, "1809");
trunk/src/mame/drivers/simpl156.c
r18027r18028
10611061
10621062DRIVER_INIT_MEMBER(simpl156_state,joemacr)
10631063{
1064   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0201018, 0x020101b, read32_delegate(FUNC(simpl156_state::joemacr_speedup_r),this));
1064   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0201018, 0x020101b, read32_delegate(FUNC(simpl156_state::joemacr_speedup_r),this));
10651065   DRIVER_INIT_CALL(simpl156);
10661066}
10671067
r18027r18028
10741074
10751075DRIVER_INIT_MEMBER(simpl156_state,chainrec)
10761076{
1077   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0201018, 0x020101b, read32_delegate(FUNC(simpl156_state::chainrec_speedup_r),this));
1077   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0201018, 0x020101b, read32_delegate(FUNC(simpl156_state::chainrec_speedup_r),this));
10781078   DRIVER_INIT_CALL(simpl156);
10791079}
10801080
r18027r18028
10871087
10881088DRIVER_INIT_MEMBER(simpl156_state,prtytime)
10891089{
1090   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0201ae0, 0x0201ae3, read32_delegate(FUNC(simpl156_state::prtytime_speedup_r),this));
1090   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0201ae0, 0x0201ae3, read32_delegate(FUNC(simpl156_state::prtytime_speedup_r),this));
10911091   DRIVER_INIT_CALL(simpl156);
10921092}
10931093
r18027r18028
11011101
11021102DRIVER_INIT_MEMBER(simpl156_state,charlien)
11031103{
1104   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0201010, 0x0201013, read32_delegate(FUNC(simpl156_state::charlien_speedup_r),this));
1104   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0201010, 0x0201013, read32_delegate(FUNC(simpl156_state::charlien_speedup_r),this));
11051105   DRIVER_INIT_CALL(simpl156);
11061106}
11071107
r18027r18028
11141114
11151115DRIVER_INIT_MEMBER(simpl156_state,osman)
11161116{
1117   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0201010, 0x0201013, read32_delegate(FUNC(simpl156_state::osman_speedup_r),this));
1117   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0201010, 0x0201013, read32_delegate(FUNC(simpl156_state::osman_speedup_r),this));
11181118   DRIVER_INIT_CALL(simpl156);
11191119
11201120}
trunk/src/mame/drivers/deadang.c
r18027r18028
422422   seibu_adpcm_decrypt(machine(), "adpcm1");
423423   seibu_adpcm_decrypt(machine(), "adpcm2");
424424
425   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80000, 0x80001, read16_delegate(FUNC(deadang_state::ghunter_trackball_low_r),this));
426   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xb0000, 0xb0001, read16_delegate(FUNC(deadang_state::ghunter_trackball_high_r),this));
425   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80000, 0x80001, read16_delegate(FUNC(deadang_state::ghunter_trackball_low_r),this));
426   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xb0000, 0xb0001, read16_delegate(FUNC(deadang_state::ghunter_trackball_high_r),this));
427427}
428428
429429/* Game Drivers */
trunk/src/mame/drivers/artmagic.c
r18027r18028
11641164   m_protection_handler = ultennis_protection;
11651165
11661166   /* additional (protection?) hack */
1167   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x300000, 0x300001, read16_delegate(FUNC(artmagic_state::ultennis_hack_r),this));
1167   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x300000, 0x300001, read16_delegate(FUNC(artmagic_state::ultennis_hack_r),this));
11681168}
11691169
11701170
trunk/src/mame/drivers/galpani2.c
r18027r18028
7777
7878static void galpani2_write_kaneko(device_t *device)
7979{
80   address_space *dstspace = device->memory().space(AS_PROGRAM);
80   address_space &dstspace = device->memory().space(AS_PROGRAM);
8181   int i,x,tpattidx;
8282   unsigned char testpattern[] = {0xFF,0x55,0xAA,0xDD,0xBB,0x99};
8383
r18027r18028
8989   {
9090      for (tpattidx = 0; tpattidx < 6; tpattidx++)
9191      {
92         if (dstspace->read_byte(i) == testpattern[tpattidx]) x = 1; //ram test fragment present
92         if (dstspace.read_byte(i) == testpattern[tpattidx]) x = 1; //ram test fragment present
9393      }
9494   }
9595
9696   if   ( x == 0 )
9797   {
98      dstspace->write_byte(0x100000,0x4b); //K
99      dstspace->write_byte(0x100001,0x41); //A
100      dstspace->write_byte(0x100002,0x4e); //N
101      dstspace->write_byte(0x100003,0x45); //E
102      dstspace->write_byte(0x100004,0x4b); //K
103      dstspace->write_byte(0x100005,0x4f); //O
98      dstspace.write_byte(0x100000,0x4b); //K
99      dstspace.write_byte(0x100001,0x41); //A
100      dstspace.write_byte(0x100002,0x4e); //N
101      dstspace.write_byte(0x100003,0x45); //E
102      dstspace.write_byte(0x100004,0x4b); //K
103      dstspace.write_byte(0x100005,0x4f); //O
104104   }
105105}
106106
107107WRITE8_MEMBER(galpani2_state::galpani2_mcu_init_w)
108108{
109   address_space *srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
110   address_space *dstspace = machine().device("sub")->memory().space(AS_PROGRAM);
109   address_space &srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
110   address_space &dstspace = machine().device("sub")->memory().space(AS_PROGRAM);
111111   UINT32 mcu_address, mcu_data;
112112
113113   for ( mcu_address = 0x100010; mcu_address < (0x100010 + 6); mcu_address += 1 )
114114   {
115      mcu_data   =   srcspace->read_byte(mcu_address );
116      dstspace->write_byte(mcu_address-0x10, mcu_data);
115      mcu_data   =   srcspace.read_byte(mcu_address );
116      dstspace.write_byte(mcu_address-0x10, mcu_data);
117117   }
118118   machine().device("sub")->execute().set_input_line(INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised
119119}
120120
121121static void galpani2_mcu_nmi1(running_machine &machine)
122122{
123   address_space *srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
124   address_space *dstspace = machine.device("sub")->memory().space(AS_PROGRAM);
123   address_space &srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
124   address_space &dstspace = machine.device("sub")->memory().space(AS_PROGRAM);
125125   UINT32 mcu_list, mcu_command, mcu_address, mcu_extra, mcu_src, mcu_dst, mcu_size;
126126
127127   for ( mcu_list = 0x100021; mcu_list < (0x100021 + 0x40); mcu_list += 4 )
128128   {
129      mcu_command      =   srcspace->read_byte(mcu_list);
129      mcu_command      =   srcspace.read_byte(mcu_list);
130130
131131      mcu_address      =   0x100000 +
132                     (srcspace->read_byte(mcu_list + 1)<<8) +
133                     (srcspace->read_byte(mcu_list + 2)<<0) ;
132                     (srcspace.read_byte(mcu_list + 1)<<8) +
133                     (srcspace.read_byte(mcu_list + 2)<<0) ;
134134
135      mcu_extra      =   srcspace->read_byte(mcu_list + 3); //0xff for command $A and $2, 0x02 for others
135      mcu_extra      =   srcspace.read_byte(mcu_list + 3); //0xff for command $A and $2, 0x02 for others
136136
137137      if (mcu_command != 0)
138138      {
139139         logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n",
140140         machine.describe_context(),
141141         mcu_list,
142         srcspace->read_byte(0x100020),
142         srcspace.read_byte(0x100020),
143143         mcu_command,
144144         mcu_address,
145145         mcu_extra
r18027r18028
152152         break;
153153
154154      case 0x02: //Copy N bytes from RAM2 to RAM1?, gp2se is the only one to use it, often!
155         mcu_src      =   (srcspace->read_byte(mcu_address + 2)<<8) +
156                     (srcspace->read_byte(mcu_address + 3)<<0) ;
155         mcu_src      =   (srcspace.read_byte(mcu_address + 2)<<8) +
156                     (srcspace.read_byte(mcu_address + 3)<<0) ;
157157
158         mcu_dst      =   (srcspace->read_byte(mcu_address + 6)<<8) +
159                     (srcspace->read_byte(mcu_address + 7)<<0) ;
158         mcu_dst      =   (srcspace.read_byte(mcu_address + 6)<<8) +
159                     (srcspace.read_byte(mcu_address + 7)<<0) ;
160160
161         mcu_size   =   (srcspace->read_byte(mcu_address + 8)<<8) +
162                     (srcspace->read_byte(mcu_address + 9)<<0) ;
161         mcu_size   =   (srcspace.read_byte(mcu_address + 8)<<8) +
162                     (srcspace.read_byte(mcu_address + 9)<<0) ;
163163         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
164164
165165         for( ; mcu_size > 0 ; mcu_size-- )
166166         {
167167            mcu_src &= 0xffff;   mcu_dst &= 0xffff;
168            srcspace->write_byte(0x100000 + mcu_dst,dstspace->read_byte(0x100000 + mcu_src));
168            srcspace.write_byte(0x100000 + mcu_dst,dstspace.read_byte(0x100000 + mcu_src));
169169            mcu_src ++;         mcu_dst ++;
170170         }
171171
172172         /* Raise a "job done" flag */
173         srcspace->write_byte(mcu_address+0,0xff);
174         srcspace->write_byte(mcu_address+1,0xff);
173         srcspace.write_byte(mcu_address+0,0xff);
174         srcspace.write_byte(mcu_address+1,0xff);
175175
176176         break;
177177
178178      case 0x0a:   // Copy N bytes from RAM1 to RAM2
179         mcu_src      =   (srcspace->read_byte(mcu_address + 2)<<8) +
180                     (srcspace->read_byte(mcu_address + 3)<<0) ;
179         mcu_src      =   (srcspace.read_byte(mcu_address + 2)<<8) +
180                     (srcspace.read_byte(mcu_address + 3)<<0) ;
181181
182         mcu_dst      =   (srcspace->read_byte(mcu_address + 6)<<8) +
183                     (srcspace->read_byte(mcu_address + 7)<<0) ;
182         mcu_dst      =   (srcspace.read_byte(mcu_address + 6)<<8) +
183                     (srcspace.read_byte(mcu_address + 7)<<0) ;
184184
185         mcu_size   =   (srcspace->read_byte(mcu_address + 8)<<8) +
186                     (srcspace->read_byte(mcu_address + 9)<<0) ;
185         mcu_size   =   (srcspace.read_byte(mcu_address + 8)<<8) +
186                     (srcspace.read_byte(mcu_address + 9)<<0) ;
187187
188188         logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
189189
190190         for( ; mcu_size > 0 ; mcu_size-- )
191191         {
192192            mcu_src &= 0xffff;   mcu_dst &= 0xffff;
193            dstspace->write_byte(0x100000 + mcu_dst,srcspace->read_byte(0x100000 + mcu_src));
193            dstspace.write_byte(0x100000 + mcu_dst,srcspace.read_byte(0x100000 + mcu_src));
194194            mcu_src ++;         mcu_dst ++;
195195         }
196196
197197         /* Raise a "job done" flag */
198         srcspace->write_byte(mcu_address+0,0xff);
199         srcspace->write_byte(mcu_address+1,0xff);
198         srcspace.write_byte(mcu_address+0,0xff);
199         srcspace.write_byte(mcu_address+1,0xff);
200200
201201         break;
202202
r18027r18028
210210      //case 0x85: //? Do what?
211211      default:
212212         /* Raise a "job done" flag */
213         srcspace->write_byte(mcu_address+0,0xff);
214         srcspace->write_byte(mcu_address+1,0xff);
213         srcspace.write_byte(mcu_address+0,0xff);
214         srcspace.write_byte(mcu_address+1,0xff);
215215
216216         logerror("%s : MCU ERROR, unknown command $%02X\n",machine.describe_context(),mcu_command);
217217      }
218218
219219      /* Erase command (so that it won't be processed again)? */
220      srcspace->write_byte(mcu_list,0x00);
220      srcspace.write_byte(mcu_list,0x00);
221221   }
222222}
223223
trunk/src/mame/drivers/sprint2.c
r18027r18028
102102      }
103103   }
104104
105   address_space &space = *machine().firstcpu->space(AS_PROGRAM);
105   address_space &space = machine().firstcpu->space(AS_PROGRAM);
106106   discrete_sound_w(discrete, space, SPRINT2_MOTORSND1_DATA, m_video_ram[0x394] & 15);   // also DOMINOS_FREQ_DATA
107107   discrete_sound_w(discrete, space, SPRINT2_MOTORSND2_DATA, m_video_ram[0x395] & 15);
108108   discrete_sound_w(discrete, space, SPRINT2_CRASHSND_DATA, m_video_ram[0x396] & 15);   // also DOMINOS_AMP_DATA
trunk/src/mame/drivers/midqslvr.c
r18027r18028
253253
254254static UINT8 piix4_config_r(device_t *busdevice, device_t *device, int function, int reg)
255255{
256   address_space &space = *busdevice->machine().firstcpu->space( AS_PROGRAM );
256   address_space &space = busdevice->machine().firstcpu->space( AS_PROGRAM );
257257   midqslvr_state *state = busdevice->machine().driver_data<midqslvr_state>();
258258
259259   function &= 3;
r18027r18028
672672
673673   kbdc8042_init(machine(), &at8042);
674674   pc_vga_init(machine(), vga_setting, NULL);
675   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
675   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
676676}
677677
678678void midqslvr_state::machine_reset()
trunk/src/mame/drivers/seibuspi.c
r18027r18028
18171817   machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE );
18181818   machine().device("maincpu")->execute().set_irq_acknowledge_callback(spi_irq_callback);
18191819
1820   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000680, 0x00000683, read32_delegate(FUNC(seibuspi_state::sound_fifo_r),this));
1821   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00000688, 0x0000068b, write32_delegate(FUNC(seibuspi_state::z80_prg_fifo_w),this));
1822   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0000068c, 0x0000068f, write32_delegate(FUNC(seibuspi_state::z80_enable_w),this));
1820   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000680, 0x00000683, read32_delegate(FUNC(seibuspi_state::sound_fifo_r),this));
1821   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00000688, 0x0000068b, write32_delegate(FUNC(seibuspi_state::z80_prg_fifo_w),this));
1822   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0000068c, 0x0000068f, write32_delegate(FUNC(seibuspi_state::z80_enable_w),this));
18231823
18241824   membank("bank4")->set_base(m_z80_rom);
18251825   membank("bank5")->set_base(m_z80_rom);
r18027r18028
18991899
19001900   memcpy(m_z80_rom, rom, 0x40000);
19011901
1902   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0000068c, 0x0000068f, write32_delegate(FUNC(seibuspi_state::eeprom_w),this));
1903   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000680, 0x00000683, read32_delegate(FUNC(seibuspi_state::sb_coin_r),this));
1902   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0000068c, 0x0000068f, write32_delegate(FUNC(seibuspi_state::eeprom_w),this));
1903   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000680, 0x00000683, read32_delegate(FUNC(seibuspi_state::sb_coin_r),this));
19041904
19051905   machine().device("maincpu")->execute().set_irq_acknowledge_callback(spi_irq_callback);
19061906
r18027r18028
20772077
20782078DRIVER_INIT_MEMBER(seibuspi_state,rdft)
20792079{
2080   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00298d0, 0x00298d3, read32_delegate(FUNC(seibuspi_state::rdft_speedup_r),this));
2080   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00298d0, 0x00298d3, read32_delegate(FUNC(seibuspi_state::rdft_speedup_r),this));
20812081
20822082   init_spi(machine());
20832083}
20842084
20852085DRIVER_INIT_MEMBER(seibuspi_state,senkyu)
20862086{
2087   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0018cb4, 0x0018cb7, read32_delegate(FUNC(seibuspi_state::senkyu_speedup_r),this));
2087   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0018cb4, 0x0018cb7, read32_delegate(FUNC(seibuspi_state::senkyu_speedup_r),this));
20882088
20892089   init_spi(machine());
20902090}
20912091
20922092DRIVER_INIT_MEMBER(seibuspi_state,senkyua)
20932093{
2094   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0018c9c, 0x0018c9f, read32_delegate(FUNC(seibuspi_state::senkyua_speedup_r),this));
2094   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0018c9c, 0x0018c9f, read32_delegate(FUNC(seibuspi_state::senkyua_speedup_r),this));
20952095
20962096   init_spi(machine());
20972097}
20982098
20992099DRIVER_INIT_MEMBER(seibuspi_state,batlball)
21002100{
2101   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0018db4, 0x0018db7, read32_delegate(FUNC(seibuspi_state::batlball_speedup_r),this));
2101   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0018db4, 0x0018db7, read32_delegate(FUNC(seibuspi_state::batlball_speedup_r),this));
21022102
21032103   init_spi(machine());
21042104}
r18027r18028
21062106DRIVER_INIT_MEMBER(seibuspi_state,ejanhs)
21072107{
21082108//  idle skip doesn't work properly?
2109//  machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x002d224, 0x002d227, read32_delegate(FUNC(seibuspi_state::ejanhs_speedup_r),this));
2109//  machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002d224, 0x002d227, read32_delegate(FUNC(seibuspi_state::ejanhs_speedup_r),this));
21102110
21112111   init_spi(machine());
21122112}
21132113
21142114DRIVER_INIT_MEMBER(seibuspi_state,viprp1)
21152115{
2116   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x001e2e0, 0x001e2e3, read32_delegate(FUNC(seibuspi_state::viprp1_speedup_r),this));
2116   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x001e2e0, 0x001e2e3, read32_delegate(FUNC(seibuspi_state::viprp1_speedup_r),this));
21172117
21182118   init_spi(machine());
21192119}
21202120
21212121DRIVER_INIT_MEMBER(seibuspi_state,viprp1o)
21222122{
2123   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x001d49c, 0x001d49f, read32_delegate(FUNC(seibuspi_state::viprp1o_speedup_r),this));
2123   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x001d49c, 0x001d49f, read32_delegate(FUNC(seibuspi_state::viprp1o_speedup_r),this));
21242124
21252125   init_spi(machine());
21262126}
r18027r18028
21332133   state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0");
21342134   state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1");
21352135
2136   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0282AC, 0x0282AF, read32_delegate(FUNC(seibuspi_state::rf2_speedup_r),state));
2136   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0282AC, 0x0282AF, read32_delegate(FUNC(seibuspi_state::rf2_speedup_r),state));
21372137   seibuspi_rise10_text_decrypt(state->memregion("gfx1")->base());
21382138   seibuspi_rise10_bg_decrypt(state->memregion("gfx2")->base(), state->memregion("gfx2")->bytes());
21392139   seibuspi_rise10_sprite_decrypt(state->memregion("gfx3")->base(), 0x600000);
21402140
2141   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),state));
2141   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),state));
21422142}
21432143
21442144DRIVER_INIT_MEMBER(seibuspi_state,rdft2)
r18027r18028
21582158   state->m_flash[0] = machine.device<intel_e28f008sa_device>("flash0");
21592159   state->m_flash[1] = machine.device<intel_e28f008sa_device>("flash1");
21602160
2161   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x002894c, 0x002894f, read32_delegate(FUNC(seibuspi_state::rfjet_speedup_r),state));
2161   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x002894c, 0x002894f, read32_delegate(FUNC(seibuspi_state::rfjet_speedup_r),state));
21622162   seibuspi_rise11_text_decrypt(state->memregion("gfx1")->base());
21632163   seibuspi_rise11_bg_decrypt(state->memregion("gfx2")->base(), state->memregion("gfx2")->bytes());
21642164   seibuspi_rise11_sprite_decrypt_rfjet(state->memregion("gfx3")->base(), 0x800000);
21652165
2166   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),state));
2166   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x560, 0x563, write32_delegate(FUNC(seibuspi_state::sprite_dma_start_w),state));
21672167}
21682168
21692169DRIVER_INIT_MEMBER(seibuspi_state,rfjet)
trunk/src/mame/drivers/coolpool.c
r18027r18028
11841184DRIVER_INIT_MEMBER(coolpool_state,coolpool)
11851185{
11861186
1187   machine().device("dsp")->memory().space(AS_IO)->install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this));
1187   machine().device("dsp")->memory().space(AS_IO).install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this));
11881188
11891189   register_state_save(machine());
11901190}
trunk/src/mame/drivers/system1.c
r18027r18028
555555   switch ((m_mcu_control >> 3) & 3)
556556   {
557557      case 0:
558         machine().device<z80_device>("maincpu")->space(AS_PROGRAM)->write_byte(offset, data);
558         machine().device<z80_device>("maincpu")->space(AS_PROGRAM).write_byte(offset, data);
559559         break;
560560
561561      case 2:
562         machine().device<z80_device>("maincpu")->space(AS_IO)->write_byte(offset, data);
562         machine().device<z80_device>("maincpu")->space(AS_IO).write_byte(offset, data);
563563         break;
564564
565565      default:
r18027r18028
575575   switch ((m_mcu_control >> 3) & 3)
576576   {
577577      case 0:
578         return machine().device<z80_device>("maincpu")->space(AS_PROGRAM)->read_byte(offset);
578         return machine().device<z80_device>("maincpu")->space(AS_PROGRAM).read_byte(offset);
579579
580580      case 1:
581581         return memregion("maincpu")->base()[offset + 0x10000];
582582
583583      case 2:
584         return machine().device<z80_device>("maincpu")->space(AS_IO)->read_byte(offset);
584         return machine().device<z80_device>("maincpu")->space(AS_IO).read_byte(offset);
585585
586586      default:
587587         logerror("%03X: MCU movx read mode %02X offset %04X\n",
r18027r18028
46424642
46434643   mc8123_decrypt_rom(machine(), "maincpu", "key", "bank1", 4);
46444644
4645//  machine().device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x00, 0x00, FUNC(dakkochn_port_00_r));
4646//  machine().device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x03, 0x03, FUNC(dakkochn_port_03_r));
4647//  machine().device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x04, 0x04, FUNC(dakkochn_port_04_r));
4645//  machine().device("maincpu")->memory().space(AS_IO).install_legacy_read_handler(0x00, 0x00, FUNC(dakkochn_port_00_r));
4646//  machine().device("maincpu")->memory().space(AS_IO).install_legacy_read_handler(0x03, 0x03, FUNC(dakkochn_port_03_r));
4647//  machine().device("maincpu")->memory().space(AS_IO).install_legacy_read_handler(0x04, 0x04, FUNC(dakkochn_port_04_r));
46484648
4649//  machine().device("maincpu")->memory().space(AS_IO)->install_legacy_write_handler(0x15, 0x15, FUNC(dakkochn_port_15_w));
4649//  machine().device("maincpu")->memory().space(AS_IO).install_legacy_write_handler(0x15, 0x15, FUNC(dakkochn_port_15_w));
46504650}
46514651
46524652
r18027r18028
47044704
47054705DRIVER_INIT_MEMBER(system1_state,nob)
47064706{
4707   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
4708   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
4707   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4708   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
47094709
47104710   DRIVER_INIT_CALL(bank44);
47114711
r18027r18028
47154715   space.install_read_handler(0x0001, 0x0001, read8_delegate(FUNC(system1_state::nob_start_r),this));
47164716
47174717   /* install MCU communications */
4718   iospace->install_readwrite_handler(0x18, 0x18, 0x00, 0x00, read8_delegate(FUNC(system1_state::nob_maincpu_latch_r),this), write8_delegate(FUNC(system1_state::nob_maincpu_latch_w),this));
4719   iospace->install_read_handler(0x1c, 0x1c, read8_delegate(FUNC(system1_state::nob_mcu_status_r),this));
4718   iospace.install_readwrite_handler(0x18, 0x18, 0x00, 0x00, read8_delegate(FUNC(system1_state::nob_maincpu_latch_r),this), write8_delegate(FUNC(system1_state::nob_maincpu_latch_w),this));
4719   iospace.install_read_handler(0x1c, 0x1c, read8_delegate(FUNC(system1_state::nob_mcu_status_r),this));
47204720}
47214721
47224722DRIVER_INIT_MEMBER(system1_state,nobb)
r18027r18028
47364736//  ROM[0x10000 + 0 * 0x8000 + 0x3347] = 0x18;  // 'jr' instead of 'jr z'
47374737
47384738   /* Patch to get sound in later levels(the program enters into a tight loop)*/
4739   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
4739   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
47404740   UINT8 *ROM2 = machine().root_device().memregion("soundcpu")->base();
47414741
47424742   ROM2[0x02f9] = 0x28;//'jr z' instead of 'jr'
47434743
47444744   DRIVER_INIT_CALL(bank44);
47454745
4746   iospace->install_read_handler(0x1c, 0x1c, read8_delegate(FUNC(system1_state::nobb_inport1c_r),this));
4747   iospace->install_read_handler(0x22, 0x22, read8_delegate(FUNC(system1_state::nobb_inport22_r),this));
4748   iospace->install_read_handler(0x23, 0x23, read8_delegate(FUNC(system1_state::nobb_inport23_r),this));
4749   iospace->install_write_handler(0x24, 0x24, write8_delegate(FUNC(system1_state::nobb_outport24_w),this));
4746   iospace.install_read_handler(0x1c, 0x1c, read8_delegate(FUNC(system1_state::nobb_inport1c_r),this));
4747   iospace.install_read_handler(0x22, 0x22, read8_delegate(FUNC(system1_state::nobb_inport22_r),this));
4748   iospace.install_read_handler(0x23, 0x23, read8_delegate(FUNC(system1_state::nobb_inport23_r),this));
4749   iospace.install_write_handler(0x24, 0x24, write8_delegate(FUNC(system1_state::nobb_outport24_w),this));
47504750}
47514751
47524752
47534753DRIVER_INIT_MEMBER(system1_state,bootleg)
47544754{
4755   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
4755   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
47564756   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x10000);
47574757   DRIVER_INIT_CALL(bank00);
47584758}
r18027r18028
47604760
47614761DRIVER_INIT_MEMBER(system1_state,bootsys2)
47624762{
4763   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
4763   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
47644764   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x20000);
47654765   machine().root_device().membank("bank1")->configure_decrypted_entries(0, 4, machine().root_device().memregion("maincpu")->base() + 0x30000, 0x4000);
47664766   DRIVER_INIT_CALL(bank0c);
r18027r18028
47804780
47814781DRIVER_INIT_MEMBER(system1_state,shtngmst)
47824782{
4783   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
4784   iospace->install_read_port(0x12, 0x12, 0x00, 0x00, "TRIGGER");
4785   iospace->install_read_port(0x18, 0x18, 0x00, 0x03, "18");
4786   iospace->install_read_port(0x1c, 0x1c, 0x00, 0x02, "GUNX");
4787   iospace->install_read_port(0x1d, 0x1d, 0x00, 0x02, "GUNY");
4783   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
4784   iospace.install_read_port(0x12, 0x12, 0x00, 0x00, "TRIGGER");
4785   iospace.install_read_port(0x18, 0x18, 0x00, 0x03, "18");
4786   iospace.install_read_port(0x1c, 0x1c, 0x00, 0x02, "GUNX");
4787   iospace.install_read_port(0x1d, 0x1d, 0x00, 0x02, "GUNY");
47884788   DRIVER_INIT_CALL(bank0c);
47894789}
47904790
trunk/src/mame/drivers/niyanpai.c
r18027r18028
245245
246246void niyanpai_state::machine_reset()
247247{
248   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
248   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
249249   int i;
250250
251251   // initialize TMPZ84C011 PIO
r18027r18028
308308
309309CUSTOM_INPUT_MEMBER(niyanpai_state::musobana_outcoin_flag_r)
310310{
311   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
311   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
312312   // tmp68301_parallel_interface[0x05]
313313   //  bit 0   coin counter
314314   //  bit 2   motor on
trunk/src/mame/drivers/bfm_sc2.c
r18027r18028
36923692MACHINE_START_MEMBER(bfm_sc2_state,sc2dmd)
36933693{
36943694
3695   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3695   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
36963696   space.install_write_handler(0x2800, 0x2800, 0, 0, write8_delegate(FUNC(bfm_sc2_state::vfd1_dmd_w),this));
36973697   space.install_write_handler(0x2900, 0x2900, 0, 0, write8_delegate(FUNC(bfm_sc2_state::dmd_reset_w),this));
36983698}
trunk/src/mame/drivers/suprnova.c
r18027r18028
970970
971971DRIVER_INIT_MEMBER(skns_state,galpani4)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-5,-1); init_skns(machine());  }
972972DRIVER_INIT_MEMBER(skns_state,galpanis)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-5,-1); init_skns(machine());  }
973DRIVER_INIT_MEMBER(skns_state,cyvern)     { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+2); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x604d3c8, 0x604d3cb, read32_delegate(FUNC(skns_state::cyvern_speedup_r),this) );  set_drc_pcflush(machine(), 0x402ebd2);  }
974DRIVER_INIT_MEMBER(skns_state,galpans2)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60fb6bc, 0x60fb6bf, read32_delegate(FUNC(skns_state::galpans2_speedup_r),this) ); set_drc_pcflush(machine(), 0x4049ae2); }
975DRIVER_INIT_MEMBER(skns_state,gutsn)      { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+0); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x600c780, 0x600c783, read32_delegate(FUNC(skns_state::gutsn_speedup_r),this) ); set_drc_pcflush(machine(), 0x402206e); }
976DRIVER_INIT_MEMBER(skns_state,panicstr)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60f19e4, 0x60f19e7, read32_delegate(FUNC(skns_state::panicstr_speedup_r),this) ); set_drc_pcflush(machine(), 0x404e68a);  }
977DRIVER_INIT_MEMBER(skns_state,senknow)    { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+1,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60000dc, 0x60000df, read32_delegate(FUNC(skns_state::senknow_speedup_r),this) ); set_drc_pcflush(machine(), 0x4017dce);  }
978DRIVER_INIT_MEMBER(skns_state,puzzloope)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6081d38, 0x6081d3b, read32_delegate(FUNC(skns_state::puzzloope_speedup_r),this) ); set_drc_pcflush(machine(), 0x401da14); }
979DRIVER_INIT_MEMBER(skns_state,puzzloopj)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6086714, 0x6086717, read32_delegate(FUNC(skns_state::puzzloopj_speedup_r),this) ); set_drc_pcflush(machine(), 0x401dca0); }
980DRIVER_INIT_MEMBER(skns_state,puzzloopa)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6085bcc, 0x6085bcf, read32_delegate(FUNC(skns_state::puzzloopa_speedup_r),this) ); set_drc_pcflush(machine(), 0x401d9d4); }
981DRIVER_INIT_MEMBER(skns_state,puzzloopu)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6085cec, 0x6085cef, read32_delegate(FUNC(skns_state::puzzloopu_speedup_r),this) ); set_drc_pcflush(machine(), 0x401dab0); }
982DRIVER_INIT_MEMBER(skns_state,jjparads)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6000994, 0x6000997, read32_delegate(FUNC(skns_state::jjparads_speedup_r),this) ); set_drc_pcflush(machine(), 0x4015e84); }
983DRIVER_INIT_MEMBER(skns_state,jjparad2)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6000984, 0x6000987, read32_delegate(FUNC(skns_state::jjparad2_speedup_r),this) ); set_drc_pcflush(machine(), 0x401620a); }
984DRIVER_INIT_MEMBER(skns_state,ryouran)    { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6000a14, 0x6000a17, read32_delegate(FUNC(skns_state::ryouran_speedup_r),this) );  set_drc_pcflush(machine(), 0x40182ce); }
985DRIVER_INIT_MEMBER(skns_state,teljan)     { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6002fb4, 0x6002fb7, read32_delegate(FUNC(skns_state::teljan_speedup_r),this) ); set_drc_pcflush(machine(), 0x401ba32); }
986DRIVER_INIT_MEMBER(skns_state,sengekis)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60b74bc, 0x60b74bf, read32_delegate(FUNC(skns_state::sengekis_speedup_r),this) ); set_drc_pcflush(machine(), 0x60006ec); }
987DRIVER_INIT_MEMBER(skns_state,sengekij)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60b7380, 0x60b7383, read32_delegate(FUNC(skns_state::sengekij_speedup_r),this) ); set_drc_pcflush(machine(), 0x60006ec); }
973DRIVER_INIT_MEMBER(skns_state,cyvern)     { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+2); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x604d3c8, 0x604d3cb, read32_delegate(FUNC(skns_state::cyvern_speedup_r),this) );  set_drc_pcflush(machine(), 0x402ebd2);  }
974DRIVER_INIT_MEMBER(skns_state,galpans2)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60fb6bc, 0x60fb6bf, read32_delegate(FUNC(skns_state::galpans2_speedup_r),this) ); set_drc_pcflush(machine(), 0x4049ae2); }
975DRIVER_INIT_MEMBER(skns_state,gutsn)      { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+0,+0); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x600c780, 0x600c783, read32_delegate(FUNC(skns_state::gutsn_speedup_r),this) ); set_drc_pcflush(machine(), 0x402206e); }
976DRIVER_INIT_MEMBER(skns_state,panicstr)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60f19e4, 0x60f19e7, read32_delegate(FUNC(skns_state::panicstr_speedup_r),this) ); set_drc_pcflush(machine(), 0x404e68a);  }
977DRIVER_INIT_MEMBER(skns_state,senknow)    { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+1,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60000dc, 0x60000df, read32_delegate(FUNC(skns_state::senknow_speedup_r),this) ); set_drc_pcflush(machine(), 0x4017dce);  }
978DRIVER_INIT_MEMBER(skns_state,puzzloope)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6081d38, 0x6081d3b, read32_delegate(FUNC(skns_state::puzzloope_speedup_r),this) ); set_drc_pcflush(machine(), 0x401da14); }
979DRIVER_INIT_MEMBER(skns_state,puzzloopj)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6086714, 0x6086717, read32_delegate(FUNC(skns_state::puzzloopj_speedup_r),this) ); set_drc_pcflush(machine(), 0x401dca0); }
980DRIVER_INIT_MEMBER(skns_state,puzzloopa)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6085bcc, 0x6085bcf, read32_delegate(FUNC(skns_state::puzzloopa_speedup_r),this) ); set_drc_pcflush(machine(), 0x401d9d4); }
981DRIVER_INIT_MEMBER(skns_state,puzzloopu)  { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-9,-1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6085cec, 0x6085cef, read32_delegate(FUNC(skns_state::puzzloopu_speedup_r),this) ); set_drc_pcflush(machine(), 0x401dab0); }
982DRIVER_INIT_MEMBER(skns_state,jjparads)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000994, 0x6000997, read32_delegate(FUNC(skns_state::jjparads_speedup_r),this) ); set_drc_pcflush(machine(), 0x4015e84); }
983DRIVER_INIT_MEMBER(skns_state,jjparad2)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000984, 0x6000987, read32_delegate(FUNC(skns_state::jjparad2_speedup_r),this) ); set_drc_pcflush(machine(), 0x401620a); }
984DRIVER_INIT_MEMBER(skns_state,ryouran)    { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000a14, 0x6000a17, read32_delegate(FUNC(skns_state::ryouran_speedup_r),this) );  set_drc_pcflush(machine(), 0x40182ce); }
985DRIVER_INIT_MEMBER(skns_state,teljan)     { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(+5,+1); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6002fb4, 0x6002fb7, read32_delegate(FUNC(skns_state::teljan_speedup_r),this) ); set_drc_pcflush(machine(), 0x401ba32); }
986DRIVER_INIT_MEMBER(skns_state,sengekis)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60b74bc, 0x60b74bf, read32_delegate(FUNC(skns_state::sengekis_speedup_r),this) ); set_drc_pcflush(machine(), 0x60006ec); }
987DRIVER_INIT_MEMBER(skns_state,sengekij)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-192,-272); init_skns(machine());machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60b7380, 0x60b7383, read32_delegate(FUNC(skns_state::sengekij_speedup_r),this) ); set_drc_pcflush(machine(), 0x60006ec); }
988988DRIVER_INIT_MEMBER(skns_state,sarukani)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine()); set_drc_pcflush(machine(), 0x4013b42); } // Speedup is in skns_io_w()
989989DRIVER_INIT_MEMBER(skns_state,galpans3)   { machine().device<sknsspr_device>("spritegen")->skns_sprite_kludge(-1,-1); init_skns(machine());  }
990990
trunk/src/mame/drivers/witch.c
r18027r18028
875875   UINT8 *ROM = (UINT8 *)memregion("maincpu")->base();
876876   membank("bank1")->set_base(&ROM[0x10000+UNBANKED_SIZE]);
877877
878   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x7000, 0x700f, read8_delegate(FUNC(witch_state::prot_read_700x), this));
878   machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0x7000, 0x700f, read8_delegate(FUNC(witch_state::prot_read_700x), this));
879879   m_bank = -1;
880880}
881881
trunk/src/mame/drivers/dynax.c
r18027r18028
64776477
64786478DRIVER_INIT_MEMBER(dynax_state,mjreach)
64796479{
6480   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x10060, 0x10060, write8_delegate(FUNC(dynax_state::yarunara_flipscreen_w),this));
6480   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x10060, 0x10060, write8_delegate(FUNC(dynax_state::yarunara_flipscreen_w),this));
64816481}
64826482
64836483/***************************************************************************
trunk/src/mame/drivers/shootout.c
r18027r18028
404404
405405DRIVER_INIT_MEMBER(shootout_state,shootout)
406406{
407   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
407   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
408408   int length = machine().root_device().memregion("maincpu")->bytes();
409409   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, length - 0x8000);
410410   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
trunk/src/mame/drivers/itech32.c
r18027r18028
704704   set_led_status(machine(), 1, data & 0x01);
705705   set_led_status(machine(), 2, data & 0x02);
706706   set_led_status(machine(), 3, data & 0x04);
707   machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, (data & 0x10) << 3);
707   machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, (data & 0x10) << 3);
708708   coin_counter_w(machine(), 0, (data & 0x20) >> 5);
709709}
710710
r18027r18028
722722   /* bit 4 controls the ticket dispenser */
723723   /* bit 5 controls the coin counter */
724724   /* bit 6 controls the diagnostic sound LED */
725   machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, (data & 0x10) << 3);
725   machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, (data & 0x10) << 3);
726726   coin_counter_w(machine(), 0, (data & 0x20) >> 5);
727727}
728728
r18027r18028
40374037   m_planes = 1;
40384038   m_is_drivedge = 1;
40394039
4040   machine().device("dsp1")->memory().space(AS_PROGRAM)->install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms1_speedup_r),this));
4041   machine().device("dsp2")->memory().space(AS_PROGRAM)->install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms2_speedup_r),this));
4040   machine().device("dsp1")->memory().space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms1_speedup_r),this));
4041   machine().device("dsp2")->memory().space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms2_speedup_r),this));
40424042}
40434043
40444044
r18027r18028
40544054   m_vram_height = 1024;
40554055   m_planes = 1;
40564056
4057   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680000, 0x680001, read16_delegate(FUNC(itech32_state::trackball_r),this));
4057   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680000, 0x680001, read16_delegate(FUNC(itech32_state::trackball_r),this));
40584058
4059   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x578000, 0x57ffff);
4060   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680080, 0x680081, read16_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this));
4061   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x680080, 0x680081);
4059   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x578000, 0x57ffff);
4060   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680080, 0x680081, read16_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this));
4061   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x680080, 0x680081);
40624062}
40634063
40644064
r18027r18028
40724072
40734073   state->m_itech020_prot_address = prot_addr;
40744074
4075   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state));
4076   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state));
4075   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state));
4076   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state));
40774077}
40784078
40794079
r18027r18028
41044104
41054105   state->m_itech020_prot_address = prot_addr;
41064106
4107   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state));
4108   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state));
4109   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),state));
4110   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),state));
4107   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state));
4108   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state));
4109   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),state));
4110   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),state));
41114111}
41124112
41134113
r18027r18028
41264126static void install_timekeeper(running_machine &machine)
41274127{
41284128   device_t *device = machine.device("m48t02");
4129   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*device, 0x681000, 0x6817ff, FUNC(timekeeper_r), FUNC(timekeeper_w), 0xffffffff);
4129   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*device, 0x681000, 0x6817ff, FUNC(timekeeper_r), FUNC(timekeeper_w), 0xffffffff);
41304130}
41314131
41324132DRIVER_INIT_MEMBER(itech32_state,wcbowlt)
r18027r18028
41584158        Hacked versions of this PCB have been found with GT97
41594159        through GTClassic. This is _NOT_ a factory modification
41604160    */
4161   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_8bit_r),this));
4161   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_8bit_r),this));
41624162   init_gt_common(machine());
41634163}
41644164
r18027r18028
41714171        board share the same sound CPU code and sample ROMs.
41724172        This board has all versions of GT for it, GT3D through GTClassic
41734173    */
4174   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
4175   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this));
4174   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
4175   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this));
41764176   init_gt_common(machine());
41774177}
41784178
r18027r18028
41964196        board: GT97 v1.21S, GT98, GT99, GT2K & GT Classic Versions 1.00S
41974197        Trackball info is read through 200202 (actually 200203).
41984198    */
4199   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200200, 0x200203, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
4199   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200200, 0x200203, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this));
42004200   init_gt_common(machine());
42014201}
42024202
r18027r18028
42104210        Player 1 trackball read through 200003
42114211        Player 2 trackball read through 200002
42124212    */
4213   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_4bit_combined_r),this));
4213   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_4bit_combined_r),this));
42144214   init_gt_common(machine());
42154215}
42164216
r18027r18028
42184218DRIVER_INIT_MEMBER(itech32_state,gt2kp)
42194219{
42204220   /* a little extra protection */
4221   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gt2kp_prot_result_r),this));
4221   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gt2kp_prot_result_r),this));
42224222   DRIVER_INIT_CALL(aama);
42234223
42244224   /* The protection code is:
r18027r18028
42394239DRIVER_INIT_MEMBER(itech32_state,gtclasscp)
42404240{
42414241   /* a little extra protection */
4242   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gtclass_prot_result_r),this));
4242   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gtclass_prot_result_r),this));
42434243   DRIVER_INIT_CALL(aama);
42444244
42454245   /* The protection code is:
trunk/src/mame/drivers/calchase.c
r18027r18028
977977   m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4);
978978
979979   pc_vga_init(machine(), vga_setting, NULL);
980   pc_svga_trident_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
980   pc_svga_trident_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
981981   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int);
982982
983983   intel82439tx_init(machine());
984984
985985   kbdc8042_init(machine(), &at8042);
986986
987   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x3f0b160, 0x3f0b163, read32_delegate(FUNC(calchase_state::calchase_idle_skip_r),this), write32_delegate(FUNC(calchase_state::calchase_idle_skip_w),this));
987   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x3f0b160, 0x3f0b163, read32_delegate(FUNC(calchase_state::calchase_idle_skip_r),this), write32_delegate(FUNC(calchase_state::calchase_idle_skip_w),this));
988988}
989989
990990ROM_START( calchase )
trunk/src/mame/drivers/mouser.c
r18027r18028
287287   /* Decode the opcodes */
288288
289289   offs_t i;
290   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
290   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
291291   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
292292   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000);
293293   UINT8 *table = machine().root_device().memregion("user1")->base();
trunk/src/mame/drivers/lkage.c
r18027r18028
960960
961961DRIVER_INIT_MEMBER(lkage_state,lkageb)
962962{
963   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf062, 0xf062, read8_delegate(FUNC(lkage_state::fake_mcu_r),this));
964   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf087, 0xf087, read8_delegate(FUNC(lkage_state::fake_status_r),this));
965   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xf062, 0xf062, write8_delegate(FUNC(lkage_state::fake_mcu_w),this));
963   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf062, 0xf062, read8_delegate(FUNC(lkage_state::fake_mcu_r),this));
964   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf087, 0xf087, read8_delegate(FUNC(lkage_state::fake_status_r),this));
965   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xf062, 0xf062, write8_delegate(FUNC(lkage_state::fake_mcu_w),this));
966966   m_sprite_dx=0;
967967}
968968
trunk/src/mame/drivers/mpu3.c
r18027r18028
935935
936936DRIVER_INIT_MEMBER(mpu3_state,m3hprvpr)
937937{
938   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
938   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
939939
940940   m_disp_func=METER_PORT;
941941   m_current_chr_table = hprvpr_data;
trunk/src/mame/drivers/gaiden.c
r18027r18028
14951495
14961496   m_prot = 0;
14971497   m_jumpcode = 0;
1498   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::wildfang_protection_r),this));
1499   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::wildfang_protection_w),this));
1498   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::wildfang_protection_r),this));
1499   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::wildfang_protection_w),this));
15001500}
15011501
15021502DRIVER_INIT_MEMBER(gaiden_state,raiga)
r18027r18028
15071507
15081508   m_prot = 0;
15091509   m_jumpcode = 0;
1510   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::raiga_protection_r),this));
1511   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this));
1510   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::raiga_protection_r),this));
1511   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this));
15121512}
15131513
15141514static void descramble_drgnbowl_gfx(running_machine &machine)
trunk/src/mame/drivers/trackfld.c
r18027r18028
14441444
14451445DRIVER_INIT_MEMBER(trackfld_state,atlantol)
14461446{
1447   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1447   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
14481448   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
14491449   UINT8 *decrypt;
14501450   int A;
trunk/src/mame/drivers/astrof.c
r18027r18028
12901290      rom[i] = prom[rom[i]];
12911291
12921292   /* set up protection handlers */
1293   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this));
1294   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this));
1293   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this));
1294   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this));
12951295}
12961296
12971297
r18027r18028
13041304      rom[i] = ~rom[i];
13051305
13061306   /* set up protection handlers */
1307   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this));
1308   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::afire_coin_prot_r),this));
1307   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this));
1308   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::afire_coin_prot_r),this));
13091309}
13101310
13111311
r18027r18028
13181318      rom[i] = ~rom[i];
13191319
13201320   /* set up protection handlers */
1321   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this));
1322   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this));
1321   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this));
1322   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this));
13231323}
13241324
13251325
trunk/src/mame/drivers/vegas.c
r18027r18028
15651565
15661566   /* unmap everything we know about */
15671567   for (addr = 0; addr < state->m_dynamic_count; addr++)
1568      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_readwrite(dynamic[addr].start, dynamic[addr].end);
1568      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_readwrite(dynamic[addr].start, dynamic[addr].end);
15691569
15701570   /* the build the list of stuff */
15711571   state->m_dynamic_count = 0;
r18027r18028
16811681
16821682   /* now remap everything */
16831683   if (LOG_DYNAMIC) logerror("remap_dynamic_addresses:\n");
1684   address_space &space = *machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
1684   address_space &space = machine.device<cpu_device>("maincpu")->space(AS_PROGRAM);
16851685   for (addr = 0; addr < state->m_dynamic_count; addr++)
16861686   {
16871687      if (LOG_DYNAMIC) logerror("  installing: %08X-%08X %s,%s\n", dynamic[addr].start, dynamic[addr].end, dynamic[addr].rdname, dynamic[addr].wrname);
trunk/src/mame/drivers/tecmo.c
r18027r18028
11411141   m_video_type = 2;
11421142
11431143   /* no MSM */
1144   machine().device("soundcpu")->memory().space(AS_PROGRAM)->nop_write(0xc000, 0xc000);
1145   machine().device("soundcpu")->memory().space(AS_PROGRAM)->nop_write(0xc400, 0xc400);
1146   machine().device("soundcpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xc800);
1144   machine().device("soundcpu")->memory().space(AS_PROGRAM).nop_write(0xc000, 0xc000);
1145   machine().device("soundcpu")->memory().space(AS_PROGRAM).nop_write(0xc400, 0xc400);
1146   machine().device("soundcpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xc800);
11471147}
11481148
11491149
trunk/src/mame/drivers/magictg.c
r18027r18028
753753
754754         if (data > 0)
755755         {
756            address_space* addr_space;
757756            UINT8* adsp_rom = (UINT8*)space.machine().root_device().memregion("adsp")->base();
758757
759758            UINT32 page = (m_adsp_regs.bdma_control >> 8) & 0xff;
r18027r18028
762761
763762            UINT32 src_addr = (page << 14) | m_adsp_regs.bdma_external_addr;
764763
765            if (type == 0)
766               addr_space = m_adsp->space(AS_PROGRAM);
767            else
768               addr_space = m_adsp->space(AS_DATA);
764            address_space &addr_space = m_adsp->space((type == 0) ? AS_PROGRAM : AS_DATA);
769765
770766            if (dir == 0)
771767            {
r18027r18028
777773                                  (adsp_rom[src_addr + 1] << 8) |
778774                                  (adsp_rom[src_addr + 2]);
779775
780                     addr_space->write_dword(m_adsp_regs.bdma_internal_addr * 4, src_word);
776                     addr_space.write_dword(m_adsp_regs.bdma_internal_addr * 4, src_word);
781777
782778                     src_addr += 3;
783779                     m_adsp_regs.bdma_internal_addr ++;
r18027r18028
786782                  {
787783                     UINT32 src_word =(adsp_rom[src_addr + 0] << 8) | adsp_rom[src_addr + 1];
788784
789                     addr_space->write_dword(m_adsp_regs.bdma_internal_addr * 2, src_word);
785                     addr_space.write_dword(m_adsp_regs.bdma_internal_addr * 2, src_word);
790786
791787                     src_addr += 2;
792788                     m_adsp_regs.bdma_internal_addr ++;
trunk/src/mame/drivers/xtom3d.c
r18027r18028
664664
665665   kbdc8042_init(machine(), &at8042);
666666   pc_vga_init(machine(), vga_setting, NULL);
667   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
667   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
668668}
669669
670670void xtom3d_state::machine_reset()
trunk/src/mame/drivers/namcona1.c
r18027r18028
495495{
496496   namcona1_state *state = machine.driver_data<namcona1_state>();
497497   UINT16 data;
498   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
498   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
499499
500500   if( source>=0x400000 && source<0xc00000 )
501501   {
trunk/src/mame/drivers/armedf.c
r18027r18028
20362036{
20372037   m_scroll_type = 0;
20382038
2039   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this));
2040   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c006, 0x07c007, write16_delegate(FUNC(armedf_state::terraf_fg_scrolly_w),this));
2041   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c008, 0x07c009, write16_delegate(FUNC(armedf_state::terraf_fg_scrollx_w),this));
2042   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0c0001, write16_delegate(FUNC(armedf_state::terraf_fg_scroll_msb_arm_w),this));
2039   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this));
2040   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c006, 0x07c007, write16_delegate(FUNC(armedf_state::terraf_fg_scrolly_w),this));
2041   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c008, 0x07c009, write16_delegate(FUNC(armedf_state::terraf_fg_scrollx_w),this));
2042   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0c0000, 0x0c0001, write16_delegate(FUNC(armedf_state::terraf_fg_scroll_msb_arm_w),this));
20432043}
20442044
20452045DRIVER_INIT_MEMBER(armedf_state,terrafu)
20462046{
20472047   m_scroll_type = 0;
20482048
2049   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
2049   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
20502050}
20512051
20522052DRIVER_INIT_MEMBER(armedf_state,terrafb)
20532053{
20542054   m_scroll_type = 0;
20552055
2056   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terrafb_io_w),this));
2056   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terrafb_io_w),this));
20572057}
20582058
20592059DRIVER_INIT_MEMBER(armedf_state,armedf)
r18027r18028
20662066{
20672067   m_scroll_type = 0;
20682068
2069   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
2069   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
20702070
20712071}
20722072
r18027r18028
20812081   RAM[0x000488 / 2] = 0x4e71;
20822082#endif
20832083
2084   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
2084   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
20852085
20862086   m_scroll_type = 2;
20872087}
r18027r18028
20962096   /* No need to patch the checksum routine (see notes) ! */
20972097#endif
20982098
2099   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this));
2099   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this));
21002100
21012101   m_scroll_type = 2;
21022102}
r18027r18028
21042104DRIVER_INIT_MEMBER(armedf_state,cclimbr2)
21052105{
21062106
2107   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
2107   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this));
21082108
21092109   m_scroll_type = 3;
21102110}
trunk/src/mame/drivers/pcat_dyn.c
r18027r18028
197197DRIVER_INIT_MEMBER(pcat_dyn_state,pcat_dyn)
198198{
199199   pc_vga_init(machine(), vga_setting, NULL);
200   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
200   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
201201}
202202
203203GAME( 1995, toursol,  0,       pcat_dyn, pcat_dyn, pcat_dyn_state, pcat_dyn, ROT0, "Dynamo", "Tournament Solitaire (V1.06, 08/03/95)", GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/mame/drivers/dkong.c
r18027r18028
519519        fatalerror("hb_dma_read_byte - unmapped access for 0x%02x - bucket 0x%02x\n", offset, bucket);
520520
521521    addr = ((bucket << 7) & 0x7c00) | (offset & 0x3ff);
522   address_space *prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
523    return prog_space->read_byte(addr);
522   address_space &prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
523    return prog_space.read_byte(addr);
524524}
525525
526526WRITE8_MEMBER(dkong_state::hb_dma_write_byte)
r18027r18028
532532        fatalerror("hb_dma_read_byte - unmapped access for 0x%02x - bucket 0x%02x\n", offset, bucket);
533533
534534    addr = ((bucket << 7) & 0x7c00) | (offset & 0x3ff);
535   address_space *prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
536    prog_space->write_byte(addr, data);
535   address_space &prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
536    prog_space.write_byte(addr, data);
537537}
538538
539539READ8_MEMBER(dkong_state::p8257_ctl_r)
r18027r18028
30973097            {7,1,4,0,3,6,2,5},
30983098    };
30993099
3100    machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1" );
3100    machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1" );
31013101
31023102    /* While the PAL supports up to 16 decryption methods, only four
31033103        are actually used in the PAL.  Therefore, we'll take a little
r18027r18028
31193119            {6,3,4,1,0,7,2,5},
31203120    };
31213121
3122    machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1" );
3122    machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1" );
31233123
31243124    /* While the PAL supports up to 16 decryption methods, only four
31253125        are actually used in the PAL.  Therefore, we'll take a little
r18027r18028
31303130    drakton_decrypt_rom(machine(), 0x88, 0x1c000, bs[3]);
31313131
31323132    /* custom handlers supporting Joystick or Steering Wheel */
3133    machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x7c00, 0x7c00, read8_delegate(FUNC(dkong_state::strtheat_inputport_0_r),this));
3134    machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x7c80, 0x7c80, read8_delegate(FUNC(dkong_state::strtheat_inputport_1_r),this));
3133    machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7c00, 0x7c00, read8_delegate(FUNC(dkong_state::strtheat_inputport_0_r),this));
3134    machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7c80, 0x7c80, read8_delegate(FUNC(dkong_state::strtheat_inputport_1_r),this));
31353135}
31363136
31373137
31383138DRIVER_INIT_MEMBER(dkong_state,dkongx)
31393139{
31403140   UINT8 *decrypted;
3141   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3141   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
31423142
31433143   decrypted = auto_alloc_array(machine(), UINT8, 0x10000);
31443144
3145   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x5fff, "bank1" );
3146    machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xffff, "bank2" );
3145   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x5fff, "bank1" );
3146    machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xffff, "bank2" );
31473147
31483148   space.install_write_handler(0xe000, 0xe000, write8_delegate(FUNC(dkong_state::braze_a15_w),this));
31493149
trunk/src/mame/drivers/appoooh.c
r18027r18028
612612
613613DRIVER_INIT_MEMBER(appoooh_state,robowresb)
614614{
615   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
615   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
616616   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x1c000);
617617}
618618
trunk/src/mame/drivers/goldstar.c
r18027r18028
1031310313
1031410314      ROM[i] = x;
1031510315   }
10316   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x1d, 0x1d, read8_delegate(FUNC(goldstar_state::fixedvala8_r),this));
10317   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x2a, 0x2a, read8_delegate(FUNC(goldstar_state::fixedvalb4_r),this));
10316   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x1d, 0x1d, read8_delegate(FUNC(goldstar_state::fixedvala8_r),this));
10317   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x2a, 0x2a, read8_delegate(FUNC(goldstar_state::fixedvalb4_r),this));
1031810318   /* Oki 6295 at 0x20 */
1031910319}
1032010320
r18027r18028
1034210342   }
1034310343
1034410344
10345   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedval38_r),this));
10345   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedval38_r),this));
1034610346   /* Oki 6295 at 0x20 */
1034710347}
1034810348
r18027r18028
1036810368
1036910369      ROM[i] = x;
1037010370   }
10371   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x1e, 0x1e, read8_delegate(FUNC(goldstar_state::fixedvalea_r),this));
10371   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x1e, 0x1e, read8_delegate(FUNC(goldstar_state::fixedvalea_r),this));
1037210372   /* Oki 6295 at 0x20 */
1037310373}
1037410374
r18027r18028
1039410394      }
1039510395      ROM[i] = x;
1039610396   }
10397   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x31, 0x31, read8_delegate(FUNC(goldstar_state::fixedval68_r),this));
10397   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x31, 0x31, read8_delegate(FUNC(goldstar_state::fixedval68_r),this));
1039810398
1039910399}
1040010400
r18027r18028
1042110421
1042210422      ROM[i] = x;
1042310423   }
10424   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x21, 0x21, read8_delegate(FUNC(goldstar_state::fixedval58_r),this));
10424   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x21, 0x21, read8_delegate(FUNC(goldstar_state::fixedval58_r),this));
1042510425}
1042610426
1042710427READ8_MEMBER(goldstar_state::fixedval80_r)
r18027r18028
1045710457      ROM[i] = x;
1045810458   }
1045910459   // nfb96b needs both of these
10460   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x23, 0x23, read8_delegate(FUNC(goldstar_state::fixedval80_r),this));
10461   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x5a, 0x5a, read8_delegate(FUNC(goldstar_state::fixedvalaa_r),this));
10460   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x23, 0x23, read8_delegate(FUNC(goldstar_state::fixedval80_r),this));
10461   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x5a, 0x5a, read8_delegate(FUNC(goldstar_state::fixedvalaa_r),this));
1046210462
1046310463   // csel96b
10464   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x6e, 0x6e, read8_delegate(FUNC(goldstar_state::fixedval96_r),this));
10464   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x6e, 0x6e, read8_delegate(FUNC(goldstar_state::fixedval96_r),this));
1046510465
1046610466}
1046710467
r18027r18028
1048810488      }
1048910489      ROM[i] = x;
1049010490   }
10491   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x2e, 0x2e, read8_delegate(FUNC(goldstar_state::fixedvalbe_r),this));
10491   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x2e, 0x2e, read8_delegate(FUNC(goldstar_state::fixedvalbe_r),this));
1049210492
1049310493}
1049410494
r18027r18028
1052010520      ROM[i] = x;
1052110521   }
1052210522
10523   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x5e, 0x5e, read8_delegate(FUNC(goldstar_state::fixedval84_r),this));
10524   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x36, 0x36, read8_delegate(FUNC(goldstar_state::fixedval90_r),this));
10523   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x5e, 0x5e, read8_delegate(FUNC(goldstar_state::fixedval84_r),this));
10524   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x36, 0x36, read8_delegate(FUNC(goldstar_state::fixedval90_r),this));
1052510525}
1052610526
1052710527READ8_MEMBER(goldstar_state::fixedvalb2_r)
r18027r18028
1054810548      ROM[i] = x;
1054910549   }
1055010550
10551   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x34, 0x34, read8_delegate(FUNC(goldstar_state::fixedvalb2_r),this));
10551   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x34, 0x34, read8_delegate(FUNC(goldstar_state::fixedvalb2_r),this));
1055210552}
1055310553
1055410554READ8_MEMBER(goldstar_state::fixedval48_r)
r18027r18028
1057510575      ROM[i] = x;
1057610576   }
1057710577
10578   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x17, 0x17, read8_delegate(FUNC(goldstar_state::fixedval48_r),this));
10578   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x17, 0x17, read8_delegate(FUNC(goldstar_state::fixedval48_r),this));
1057910579}
1058010580
1058110581READ8_MEMBER(goldstar_state::fixedval09_r)
r18027r18028
1060710607
1060810608      ROM[i] = x;
1060910609   }
10610   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x32, 0x32, read8_delegate(FUNC(goldstar_state::fixedval74_r),this));
10611   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x12, 0x12, read8_delegate(FUNC(goldstar_state::fixedval09_r),this));
10610   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x32, 0x32, read8_delegate(FUNC(goldstar_state::fixedval74_r),this));
10611   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x12, 0x12, read8_delegate(FUNC(goldstar_state::fixedval09_r),this));
1061210612   /* oki6295 at 0x20 */
1061310613}
1061410614
r18027r18028
1064110641      ROM[i] = x;
1064210642   }
1064310643
10644   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedvalc7_r),this));
10645   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x1a, 0x1a, read8_delegate(FUNC(goldstar_state::fixedvale4_r),this));
10644   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedvalc7_r),this));
10645   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x1a, 0x1a, read8_delegate(FUNC(goldstar_state::fixedvale4_r),this));
1064610646}
1064710647
1064810648DRIVER_INIT_MEMBER(goldstar_state,cherrys)
r18027r18028
1070710707DRIVER_INIT_MEMBER(goldstar_state,tonypok)
1070810708{
1070910709   // the ppi doesn't seem to work properly, so just install the inputs directly
10710   address_space *io = machine().device("maincpu")->memory().space(AS_IO);
10711   io->install_read_port(0x04, 0x04, "IN0" );
10712   io->install_read_port(0x05, 0x05, "IN1" );
10713   io->install_read_port(0x06, 0x06, "IN2" );
10710   address_space &io = machine().device("maincpu")->memory().space(AS_IO);
10711   io.install_read_port(0x04, 0x04, "IN0" );
10712   io.install_read_port(0x05, 0x05, "IN1" );
10713   io.install_read_port(0x06, 0x06, "IN2" );
1071410714
1071510715}
1071610716
trunk/src/mame/drivers/system16.c
r18027r18028
32943294   int i;
32953295   UINT8 *ROM = memregion("maincpu")->base();
32963296   UINT8 *KEY = memregion("decryption")->base();
3297   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3297   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
32983298   UINT8 data[0x1000];
32993299
33003300   // the decryption key is in a rom (part of an MSDOS executable...)
trunk/src/mame/drivers/nyny.c
r18027r18028
228228   m_star_enable = data & 0x10;
229229
230230   /* bits 5-7 go to the music board connector */
231   audio_2_command_w(*m_maincpu->space(AS_PROGRAM), 0, data & 0xe0);
231   audio_2_command_w(m_maincpu->space(AS_PROGRAM), 0, data & 0xe0);
232232}
233233
234234
trunk/src/mame/drivers/limenko.c
r18027r18028
11181118{
11191119
11201120   // Set up the QS1000 program ROM banking, taking care not to overlap the internal RAM
1121   machine().device("qs1000:cpu")->memory().space(AS_IO)->install_read_bank(0x0100, 0xffff, "bank");
1121   machine().device("qs1000:cpu")->memory().space(AS_IO).install_read_bank(0x0100, 0xffff, "bank");
11221122   membank("qs1000:bank")->configure_entries(0, 8, memregion("qs1000:cpu")->base()+0x100, 0x10000);
11231123
11241124   m_spriteram_bit = 1;
r18027r18028
11261126
11271127DRIVER_INIT_MEMBER(limenko_state,dynabomb)
11281128{
1129   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe2784, 0xe2787, read32_delegate(FUNC(limenko_state::dynabomb_speedup_r), this));
1129   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xe2784, 0xe2787, read32_delegate(FUNC(limenko_state::dynabomb_speedup_r), this));
11301130
11311131   DRIVER_INIT_CALL(common);
11321132}
11331133
11341134DRIVER_INIT_MEMBER(limenko_state,legendoh)
11351135{
1136   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x32ab0, 0x32ab3, read32_delegate(FUNC(limenko_state::legendoh_speedup_r), this));
1136   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x32ab0, 0x32ab3, read32_delegate(FUNC(limenko_state::legendoh_speedup_r), this));
11371137
11381138   DRIVER_INIT_CALL(common);
11391139}
11401140
11411141DRIVER_INIT_MEMBER(limenko_state,sb2003)
11421142{
1143   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x135800, 0x135803, read32_delegate(FUNC(limenko_state::sb2003_speedup_r), this));
1143   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x135800, 0x135803, read32_delegate(FUNC(limenko_state::sb2003_speedup_r), this));
11441144
11451145   DRIVER_INIT_CALL(common);
11461146}
r18027r18028
11611161      dst[x+2] = (src[x+1]&0x0f) >> 0;
11621162   }
11631163
1164   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6626c, 0x6626f, read32_delegate(FUNC(limenko_state::spotty_speedup_r), this));
1164   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6626c, 0x6626f, read32_delegate(FUNC(limenko_state::spotty_speedup_r), this));
11651165
11661166   m_spriteram_bit = 1;
11671167}
trunk/src/mame/drivers/pengo.c
r18027r18028
692692      { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 },   /* ...1...1...0.... */
693693      { 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }      /* ...1...1...1.... */
694694   };
695   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
695   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
696696   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
697697   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
698698   int A;
trunk/src/mame/drivers/polepos.c
r18027r18028
463463
464464MACHINE_RESET_MEMBER(polepos_state,polepos)
465465{
466   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
466   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
467467   int i;
468468
469469   /* Reset all latches */
r18027r18028
19901990DRIVER_INIT_MEMBER(polepos_state,topracern)
19911991{
19921992   /* extra direct mapped inputs read */
1993   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x02, 0x02, "STEER");
1994   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x03, 0x03, "IN0");
1995   machine().device("maincpu")->memory().space(AS_IO)->install_read_port(0x04, 0x04, "DSWA");
1993   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x02, 0x02, "STEER");
1994   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x03, 0x03, "IN0");
1995   machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x04, 0x04, "DSWA");
19961996}
19971997
19981998DRIVER_INIT_MEMBER(polepos_state,polepos2)
19991999{
20002000   /* note that the bootleg version doesn't need this custom IC; it has a hacked ROM in its place */
2001   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x4000, 0x5fff, read16_delegate(FUNC(polepos_state::polepos2_ic25_r),this));
2001   machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x5fff, read16_delegate(FUNC(polepos_state::polepos2_ic25_r),this));
20022002}
20032003
20042004
trunk/src/mame/drivers/galgame.c
r18027r18028
396396
397397DRIVER_INIT_MEMBER(galaxygame_state,galaxygame)
398398{
399   address_space *main = machine().device("maincpu")->memory().space(AS_PROGRAM);
399   address_space &main = machine().device("maincpu")->memory().space(AS_PROGRAM);
400400   UINT8 *code = machine().root_device().memregion("code")->base();
401401
402402   int filepos = 0, linepos, linelen;
r18027r18028
426426         if ( (linelen >= 15+6) && (line[15] != ' ') )
427427         {
428428            read_uint16(&val, 15, line, linelen);
429            main->write_word(address, val, 0xffff);
429            main.write_word(address, val, 0xffff);
430430            address += 2;
431431
432432            if ( (linelen >= 22+6) && (line[22] != ' ') )
433433            {
434434               read_uint16(&val, 22, line, linelen);
435               main->write_word(address, val, 0xffff);
435               main.write_word(address, val, 0xffff);
436436               address += 2;
437437            }
438438
439439            if ( (linelen >= 29+6) && (line[29] != ' ') )
440440            {
441441               read_uint16(&val, 29, line, linelen);
442               main->write_word(address, val, 0xffff);
442               main.write_word(address, val, 0xffff);
443443               address += 2;
444444            }
445445
r18027r18028
449449            if ( (linelen >= 18+3) && (line[18] != ' ') )
450450            {
451451               read_uint8(&val8, 18, line, linelen);
452               main->write_byte(address, val8);
452               main.write_byte(address, val8);
453453               address += 1;
454454            }
455455         }
r18027r18028
458458   }
459459
460460   // set startup code
461   main->write_word(0, 012700); /* MOV #0, R0 */
462   main->write_word(2, 0);
463   main->write_word(4, 0x8d00); /* MTPS R0 */
464   main->write_word(6, 000167); /* JMP 0500*/
465   main->write_word(8, 000500 - 10);
461   main.write_word(0, 012700); /* MOV #0, R0 */
462   main.write_word(2, 0);
463   main.write_word(4, 0x8d00); /* MTPS R0 */
464   main.write_word(6, 000167); /* JMP 0500*/
465   main.write_word(8, 000500 - 10);
466466}
467467
468468GAME(1971, galgame, 0, galaxygame, galaxygame, galaxygame_state, galaxygame, ROT270, "Computer Recreations, Inc", "Galaxy Game", GAME_NO_SOUND_HW )
trunk/src/mame/drivers/cps1.c
r18027r18028
1069810698
1069910699   /* Forgotten Worlds has a NEC uPD4701AC on the B-board handling dial inputs from the CN-MOWS connector. */
1070010700   /* The memory mapping is handled by PAL LWIO */
10701   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x800040, 0x800041, write16_delegate(FUNC(cps_state::forgottn_dial_0_reset_w),this));
10702   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(cps_state::forgottn_dial_1_reset_w),this));
10703   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x800052, 0x800055, read16_delegate(FUNC(cps_state::forgottn_dial_0_r),this));
10704   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80005a, 0x80005d, read16_delegate(FUNC(cps_state::forgottn_dial_1_r),this));
10701   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800040, 0x800041, write16_delegate(FUNC(cps_state::forgottn_dial_0_reset_w),this));
10702   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(cps_state::forgottn_dial_1_reset_w),this));
10703   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800052, 0x800055, read16_delegate(FUNC(cps_state::forgottn_dial_0_r),this));
10704   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80005a, 0x80005d, read16_delegate(FUNC(cps_state::forgottn_dial_1_r),this));
1070510705
1070610706   save_item(NAME(m_dial));
1070710707
r18027r18028
1071510715{
1071610716   /* This specific revision of SF2 has the CPS-B custom mapped at a different address. */
1071710717   /* The mapping is handled by the PAL IOB2 on the B-board */
10718   machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_readwrite(0x800140, 0x80017f);
10719   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this));
10718   machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_readwrite(0x800140, 0x80017f);
10719   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this));
1072010720
1072110721   DRIVER_INIT_CALL(cps1);
1072210722}
r18027r18028
1072410724DRIVER_INIT_MEMBER(cps_state,sf2thndr)
1072510725{
1072610726   /* This particular hack uses a modified B-board PAL which mirrors the CPS-B registers at an alternate address */
10727   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this));
10727   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this));
1072810728
1072910729   DRIVER_INIT_CALL(cps1);
1073010730}
r18027r18028
1073210732DRIVER_INIT_MEMBER(cps_state,sf2hack)
1073310733{
1073410734   /* some SF2 hacks have some inputs wired to the LSB instead of MSB */
10735   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x800018, 0x80001f, read16_delegate(FUNC(cps_state::cps1_hack_dsw_r),this));
10735   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800018, 0x80001f, read16_delegate(FUNC(cps_state::cps1_hack_dsw_r),this));
1073610736
1073710737   DRIVER_INIT_CALL(cps1);
1073810738}
r18027r18028
1076510765{
1076610766   /* Pang 3 is the only non-QSound game to have an EEPROM. */
1076710767   /* It is mapped in the CPS-B address range so probably is on the C-board. */
10768   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_port(0x80017a, 0x80017b, "EEPROMIN", "EEPROMOUT");
10768   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_port(0x80017a, 0x80017b, "EEPROMIN", "EEPROMOUT");
1076910769
1077010770   DRIVER_INIT_CALL(cps1);
1077110771}
r18027r18028
1081510815      rom[i + 3] = rom[i + 6];
1081610816      rom[i + 6] = tmp;
1081710817   }
10818   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c01a, 0x70c01b, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10819   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c01c, 0x70c01d, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10820   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c01e, 0x70c01f, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10821   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c010, 0x70c011, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10822   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c018, 0x70c019, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10818   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c01a, 0x70c01b, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10819   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c01c, 0x70c01d, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10820   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c01e, 0x70c01f, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10821   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c010, 0x70c011, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
10822   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c018, 0x70c019, read16_delegate(FUNC(cps_state::sf2mdt_r),this));
1082310823
1082410824   DRIVER_INIT_CALL(cps1);
1082510825}
r18027r18028
1082710827DRIVER_INIT_MEMBER(cps_state,dinohunt)
1082810828{
1082910829   // is this shared with the new sound hw?
10830   UINT8* ram = (UINT8*)machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0xf18000, 0xf19fff);
10830   UINT8* ram = (UINT8*)machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0xf18000, 0xf19fff);
1083110831   memset(ram,0xff,0x2000);
1083210832   DRIVER_INIT_CALL(cps1);
1083310833}
trunk/src/mame/drivers/yunsun16.c
r18027r18028
156156DRIVER_INIT_MEMBER(yunsun16_state,magicbub)
157157{
158158//  remove_mem_write16_handler (0, 0x800180, 0x800181 );
159   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x800188, 0x800189, write16_delegate(FUNC(yunsun16_state::magicbub_sound_command_w),this));
159   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800188, 0x800189, write16_delegate(FUNC(yunsun16_state::magicbub_sound_command_w),this));
160160}
161161
162162/***************************************************************************
trunk/src/mame/drivers/wiz.c
r18027r18028
10571057      { 5,3,7, 0x80 },
10581058      { 5,7,3, 0x28 }
10591059   };
1060   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1060   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
10611061   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
10621062   int size = machine().root_device().memregion("maincpu")->bytes();
10631063   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, size);
r18027r18028
10941094
10951095DRIVER_INIT_MEMBER(wiz_state,scion)
10961096{
1097   machine().device("audiocpu")->memory().space(AS_PROGRAM)->nop_write(0x4000, 0x4001);
1097   machine().device("audiocpu")->memory().space(AS_PROGRAM).nop_write(0x4000, 0x4001);
10981098}
10991099
11001100
11011101DRIVER_INIT_MEMBER(wiz_state,wiz)
11021102{
1103   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd400, 0xd400, read8_delegate(FUNC(wiz_state::wiz_protection_r),this));
1103   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd400, 0xd400, read8_delegate(FUNC(wiz_state::wiz_protection_r),this));
11041104}
11051105
11061106
trunk/src/mame/drivers/calorie.c
r18027r18028
554554
555555DRIVER_INIT_MEMBER(calorie_state,calorieb)
556556{
557   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
557   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
558558   space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x10000);
559559}
560560
trunk/src/mame/drivers/namcos11.c
r18027r18028
879879   if (C76_SPEEDUP)
880880   {
881881      state->save_item( NAME(state->m_su_83) );
882      machine.device("c76")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos11_state::c76_speedup_r),state), write16_delegate(FUNC(namcos11_state::c76_speedup_w),state));
882      machine.device("c76")->memory().space(AS_PROGRAM).install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos11_state::c76_speedup_r),state), write16_delegate(FUNC(namcos11_state::c76_speedup_w),state));
883883   }
884884
885885   if (!n_daughterboard)
886886   {
887      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x1fa10020, 0x1fa1002f);
887      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x1fa10020, 0x1fa1002f);
888888      return;
889889   }
890890
r18027r18028
893893   UINT32 len = machine.root_device().memregion( "user2" )->bytes();
894894   UINT8 *rgn = machine.root_device().memregion( "user2" )->base();
895895
896   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f000000, 0x1f0fffff, "bank1" );
897   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f100000, 0x1f1fffff, "bank2" );
898   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f200000, 0x1f2fffff, "bank3" );
899   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f300000, 0x1f3fffff, "bank4" );
900   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f400000, 0x1f4fffff, "bank5" );
901   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f500000, 0x1f5fffff, "bank6" );
902   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f600000, 0x1f6fffff, "bank7" );
903   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x1f700000, 0x1f7fffff, "bank8" );
896   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f000000, 0x1f0fffff, "bank1" );
897   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f100000, 0x1f1fffff, "bank2" );
898   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f200000, 0x1f2fffff, "bank3" );
899   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f300000, 0x1f3fffff, "bank4" );
900   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f400000, 0x1f4fffff, "bank5" );
901   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f500000, 0x1f5fffff, "bank6" );
902   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f600000, 0x1f6fffff, "bank7" );
903   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x1f700000, 0x1f7fffff, "bank8" );
904904
905905   for (bank = 0; bank < 8; bank++)
906906   {
r18027r18028
910910
911911   if (n_daughterboard == 32)
912912   {
913      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1fa10020, 0x1fa1002f, write32_delegate(FUNC(namcos11_state::bankswitch_rom32_w),state));
913      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1fa10020, 0x1fa1002f, write32_delegate(FUNC(namcos11_state::bankswitch_rom32_w),state));
914914   }
915915   if (n_daughterboard == 64)
916916   {
917917      state->m_n_bankoffset = 0;
918      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f080000, 0x1f080003, write32_delegate(FUNC(namcos11_state::bankswitch_rom64_upper_w),state));
919      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x1fa10020, 0x1fa1002f);
920      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1fa10020, 0x1fa1002f, write32_delegate(FUNC(namcos11_state::bankswitch_rom64_w),state));
918      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1f080000, 0x1f080003, write32_delegate(FUNC(namcos11_state::bankswitch_rom64_upper_w),state));
919      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x1fa10020, 0x1fa1002f);
920      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1fa10020, 0x1fa1002f, write32_delegate(FUNC(namcos11_state::bankswitch_rom64_w),state));
921921      state->save_item( NAME(state->m_n_bankoffset) );
922922   }
923923}
r18027r18028
929929
930930DRIVER_INIT_MEMBER(namcos11_state,tekken2)
931931{
932   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c406_r),this));
932   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c406_r),this));
933933   namcos11_init_common(machine(), 32);
934934}
935935
936936DRIVER_INIT_MEMBER(namcos11_state,souledge)
937937{
938   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c409_r),this));
938   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c409_r),this));
939939   namcos11_init_common(machine(), 32);
940940}
941941
942942DRIVER_INIT_MEMBER(namcos11_state,dunkmnia)
943943{
944   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c410_r),this));
944   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c410_r),this));
945945   namcos11_init_common(machine(), 32);
946946}
947947
948948DRIVER_INIT_MEMBER(namcos11_state,primglex)
949949{
950   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c411_r),this));
950   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c411_r),this));
951951   namcos11_init_common(machine(), 32);
952952}
953953
954954DRIVER_INIT_MEMBER(namcos11_state,xevi3dg)
955955{
956   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c430_r),this));
956   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c430_r),this));
957957   namcos11_init_common(machine(), 32);
958958}
959959
960960DRIVER_INIT_MEMBER(namcos11_state,danceyes)
961961{
962   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c431_r),this));
962   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c431_r),this));
963963   namcos11_init_common(machine(), 32);
964964}
965965
966966DRIVER_INIT_MEMBER(namcos11_state,pocketrc)
967967{
968   machine().device("c76")->memory().space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC0_L, read8_delegate(FUNC(namcos11_state::pocketrc_steer_r),this));
969   machine().device("c76")->memory().space(AS_IO)->install_read_handler(M37710_ADC1_L, M37710_ADC1_L, read8_delegate(FUNC(namcos11_state::pocketrc_gas_r),this));
968   machine().device("c76")->memory().space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC0_L, read8_delegate(FUNC(namcos11_state::pocketrc_steer_r),this));
969   machine().device("c76")->memory().space(AS_IO).install_read_handler(M37710_ADC1_L, M37710_ADC1_L, read8_delegate(FUNC(namcos11_state::pocketrc_gas_r),this));
970970
971   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c432_r),this));
971   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c432_r),this));
972972   namcos11_init_common(machine(), 32);
973973}
974974
975975DRIVER_INIT_MEMBER(namcos11_state,starswep)
976976{
977   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c442_r),this));
977   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c442_r),this));
978978   namcos11_init_common(machine(), 0);
979979}
980980
981981DRIVER_INIT_MEMBER(namcos11_state,myangel3)
982982{
983   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c443_r),this));
983   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c443_r),this));
984984   namcos11_init_common(machine(), 64);
985985}
986986
987987DRIVER_INIT_MEMBER(namcos11_state,ptblank2ua)
988988{
989   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c443_r),this));
989   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler( 0x1fa20000, 0x1fa2ffff, read32_delegate(FUNC(namcos11_state::keycus_c443_r),this));
990990   namcos11_init_common(machine(), 64);
991991
992   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f788000, 0x1f788003, write32_delegate(FUNC(namcos11_state::lightgun_w),this));
993   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler (0x1f780000, 0x1f78000f, read32_delegate(FUNC(namcos11_state::lightgun_r),this));
992   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1f788000, 0x1f788003, write32_delegate(FUNC(namcos11_state::lightgun_w),this));
993   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x1f780000, 0x1f78000f, read32_delegate(FUNC(namcos11_state::lightgun_r),this));
994994}
995995
996996MACHINE_RESET_MEMBER(namcos11_state,namcos11)
trunk/src/mame/drivers/lethalj.c
r18027r18028
895895
896896DRIVER_INIT_MEMBER(lethalj_state,ripribit)
897897{
898   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x04100010, 0x0410001f, write16_delegate(FUNC(lethalj_state::ripribit_control_w),this));
898   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x04100010, 0x0410001f, write16_delegate(FUNC(lethalj_state::ripribit_control_w),this));
899899}
900900
901901
902902DRIVER_INIT_MEMBER(lethalj_state,cfarm)
903903{
904   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x04100010, 0x0410001f, write16_delegate(FUNC(lethalj_state::cfarm_control_w),this));
904   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x04100010, 0x0410001f, write16_delegate(FUNC(lethalj_state::cfarm_control_w),this));
905905}
906906
907907
908908DRIVER_INIT_MEMBER(lethalj_state,cclownz)
909909{
910   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x04100010, 0x0410001f, write16_delegate(FUNC(lethalj_state::cclownz_control_w),this));
910   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x04100010, 0x0410001f, write16_delegate(FUNC(lethalj_state::cclownz_control_w),this));
911911}
912912
913913
trunk/src/mame/drivers/itech8.c
r18027r18028
767767   /* bit 6 controls the diagnostic sound LED */
768768   /* bit 7 controls the ticket dispenser */
769769   m_pia_portb_data = data;
770   machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, data & 0x80);
770   machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, data & 0x80);
771771   coin_counter_w(machine(), 0, (data & 0x20) >> 5);
772772}
773773
r18027r18028
26302630
26312631DRIVER_INIT_MEMBER(itech8_state,grmatch)
26322632{
2633   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0160, 0x0160, write8_delegate(FUNC(itech8_state::grmatch_palette_w),this));
2634   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0180, 0x0180, write8_delegate(FUNC(itech8_state::grmatch_xscroll_w),this));
2635   machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x01e0, 0x01ff);
2633   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0160, 0x0160, write8_delegate(FUNC(itech8_state::grmatch_palette_w),this));
2634   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0180, 0x0180, write8_delegate(FUNC(itech8_state::grmatch_xscroll_w),this));
2635   machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x01e0, 0x01ff);
26362636}
26372637
26382638
26392639DRIVER_INIT_MEMBER(itech8_state,slikshot)
26402640{
2641   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x0180, 0x0180, FUNC(slikshot_z80_r));
2642   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x01cf, 0x01cf, FUNC(slikshot_z80_control_r));
2643   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x01cf, 0x01cf, FUNC(slikshot_z80_control_w));
2641   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x0180, 0x0180, FUNC(slikshot_z80_r));
2642   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x01cf, 0x01cf, FUNC(slikshot_z80_control_r));
2643   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x01cf, 0x01cf, FUNC(slikshot_z80_control_w));
26442644}
26452645
26462646
26472647DRIVER_INIT_MEMBER(itech8_state,sstrike)
26482648{
2649   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x1180, 0x1180, FUNC(slikshot_z80_r));
2650   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x11cf, 0x11cf, FUNC(slikshot_z80_control_r));
2651   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x11cf, 0x11cf, FUNC(slikshot_z80_control_w));
2649   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x1180, 0x1180, FUNC(slikshot_z80_r));
2650   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x11cf, 0x11cf, FUNC(slikshot_z80_control_r));
2651   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x11cf, 0x11cf, FUNC(slikshot_z80_control_w));
26522652}
26532653
26542654
r18027r18028
26792679DRIVER_INIT_MEMBER(itech8_state,rimrockn)
26802680{
26812681   /* additional input ports */
2682   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0161, 0x0161, "161");
2683   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0162, 0x0162, "162");
2684   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0163, 0x0163, "163");
2685   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0164, 0x0164, "164");
2686   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0165, 0x0165, "165");
2682   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0161, 0x0161, "161");
2683   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0162, 0x0162, "162");
2684   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0163, 0x0163, "163");
2685   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0164, 0x0164, "164");
2686   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0165, 0x0165, "165");
26872687
26882688   /* different banking mechanism (disable the old one) */
2689   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01a0, 0x01a0, write8_delegate(FUNC(itech8_state::rimrockn_bank_w),this));
2690   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01c0, 0x01df, write8_delegate(FUNC(itech8_state::itech8_blitter_w),this));
2689   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01a0, 0x01a0, write8_delegate(FUNC(itech8_state::rimrockn_bank_w),this));
2690   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01c0, 0x01df, write8_delegate(FUNC(itech8_state::itech8_blitter_w),this));
26912691}
26922692
26932693
trunk/src/mame/drivers/galaxian.c
r18027r18028
755755READ8_MEMBER(galaxian_state::explorer_sound_latch_r)
756756{
757757   machine().device("audiocpu")->execute().set_input_line(0, CLEAR_LINE);
758   return soundlatch_byte_r(*machine().device("audiocpu")->memory().space(AS_PROGRAM), 0);
758   return soundlatch_byte_r(machine().device("audiocpu")->memory().space(AS_PROGRAM), 0);
759759}
760760
761761
r18027r18028
10641064
10651065INPUT_CHANGED_MEMBER(galaxian_state::gmgalax_game_changed)
10661066{
1067   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1067   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
10681068
10691069   /* new value is the selected game */
10701070   m_gmgalax_selected_game = newval;
r18027r18028
27402740
27412741static void unmap_galaxian_sound(running_machine &machine, offs_t base)
27422742{
2743   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2743   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
27442744
27452745   space.unmap_write(base + 0x0004, base + 0x0007, 0, 0x07f8);
27462746   space.unmap_write(base + 0x0800, base + 0x0807, 0, 0x07f8);
r18027r18028
27632763
27642764DRIVER_INIT_MEMBER(galaxian_state,nolock)
27652765{
2766   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2766   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
27672767
27682768   /* same as galaxian... */
27692769   DRIVER_INIT_CALL(galaxian);
r18027r18028
27752775
27762776DRIVER_INIT_MEMBER(galaxian_state,azurian)
27772777{
2778   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2778   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
27792779
27802780   /* yellow bullets instead of white ones */
27812781   common_init(machine(), scramble_draw_bullet, galaxian_draw_background, NULL, NULL);
r18027r18028
27872787
27882788DRIVER_INIT_MEMBER(galaxian_state,gmgalax)
27892789{
2790   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2790   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
27912791
27922792   /* video extensions */
27932793   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info);
r18027r18028
28042804
28052805DRIVER_INIT_MEMBER(galaxian_state,pisces)
28062806{
2807   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2807   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28082808
28092809   /* video extensions */
28102810   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info);
r18027r18028
28162816
28172817DRIVER_INIT_MEMBER(galaxian_state,batman2)
28182818{
2819   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2819   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28202820
28212821   /* video extensions */
28222822   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
r18027r18028
28282828
28292829DRIVER_INIT_MEMBER(galaxian_state,frogg)
28302830{
2831   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2831   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28322832
28332833   /* same as galaxian... */
28342834   common_init(machine(), galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
r18027r18028
28642864
28652865DRIVER_INIT_MEMBER(galaxian_state,mooncrgx)
28662866{
2867   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2867   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28682868
28692869   /* video extensions */
28702870   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
r18027r18028
28762876
28772877DRIVER_INIT_MEMBER(galaxian_state,moonqsr)
28782878{
2879   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2879   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28802880   UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
28812881
28822882   /* video extensions */
r18027r18028
28942894
28952895DRIVER_INIT_MEMBER(galaxian_state,pacmanbl)
28962896{
2897   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2897   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
28982898
28992899   /* same as galaxian... */
29002900   DRIVER_INIT_CALL(galaxian);
r18027r18028
29542954
29552955DRIVER_INIT_MEMBER(galaxian_state,tenspot)
29562956{
2957   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2957   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
29582958
29592959   /* these are needed for batman part 2 to work properly, this banking is probably a property of the artic board,
29602960       which tenspot appears to have copied */
r18027r18028
29912991
29922992DRIVER_INIT_MEMBER(galaxian_state,zigzag)
29932993{
2994   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2994   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
29952995
29962996   /* video extensions */
29972997   common_init(machine(), NULL, galaxian_draw_background, NULL, NULL);
r18027r18028
30353035
30363036DRIVER_INIT_MEMBER(galaxian_state,checkman)
30373037{
3038   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3039   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
3038   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
3039   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
30403040
30413041   /* video extensions */
30423042   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
r18027r18028
30463046   space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),this));
30473047
30483048   /* attach the sound command handler */
3049   iospace->install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
3049   iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
30503050
30513051   /* decrypt program code */
30523052   decode_checkman(machine());
r18027r18028
30553055
30563056DRIVER_INIT_MEMBER(galaxian_state,checkmaj)
30573057{
3058   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3058   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
30593059
30603060   /* video extensions */
30613061   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
r18027r18028
30703070
30713071DRIVER_INIT_MEMBER(galaxian_state,dingo)
30723072{
3073   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3073   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
30743074
30753075   /* video extensions */
30763076   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
r18027r18028
30853085
30863086DRIVER_INIT_MEMBER(galaxian_state,dingoe)
30873087{
3088   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3089   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
3088   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
3089   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
30903090
30913091   /* video extensions */
30923092   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
r18027r18028
30963096   space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),this));
30973097
30983098   /* attach the sound command handler */
3099   iospace->install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
3099   iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
31003100
31013101   space.install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),this));   /* Protection check */
31023102
r18027r18028
31073107
31083108DRIVER_INIT_MEMBER(galaxian_state,skybase)
31093109{
3110   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3110   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
31113111
31123112   /* video extensions */
31133113   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info);
r18027r18028
31253125
31263126DRIVER_INIT_MEMBER(galaxian_state,kong)
31273127{
3128   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3128   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
31293129
31303130   /* video extensions */
31313131   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info);
r18027r18028
31403140
31413141static void mshuttle_decode(running_machine &machine, const UINT8 convtable[8][16])
31423142{
3143   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
3143   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
31443144   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
31453145   UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
31463146   int A;
r18027r18028
32523252
32533253DRIVER_INIT_MEMBER(galaxian_state,kingball)
32543254{
3255   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3255   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
32563256
32573257   /* video extensions */
32583258   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
r18027r18028
32723272
32733273DRIVER_INIT_MEMBER(galaxian_state,scorpnmc)
32743274{
3275   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3275   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
32763276
32773277   /* video extensions */
32783278   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
r18027r18028
32933293
32943294DRIVER_INIT_MEMBER(galaxian_state,thepitm)
32953295{
3296   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3296   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
32973297
32983298   /* video extensions */
32993299   common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
r18027r18028
33173317
33183318DRIVER_INIT_MEMBER(galaxian_state,theend)
33193319{
3320   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3320   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
33213321
33223322   /* video extensions */
33233323   common_init(machine(), theend_draw_bullet, galaxian_draw_background, NULL, NULL);
r18027r18028
33363336
33373337DRIVER_INIT_MEMBER(galaxian_state,explorer)
33383338{
3339   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3339   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
33403340
33413341   /* video extensions */
33423342   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
r18027r18028
33623362   m_sfx_tilemap = TRUE;
33633363
33643364   /* sound board has space for extra ROM */
3365   machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
3365   machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
33663366   membank("bank1")->set_base(memregion("audiocpu")->base());
33673367}
33683368
33693369
33703370DRIVER_INIT_MEMBER(galaxian_state,atlantis)
33713371{
3372   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3372   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
33733373
33743374   /* video extensions */
33753375   common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL);
r18027r18028
34113411
34123412DRIVER_INIT_MEMBER(galaxian_state,froggrmc)
34133413{
3414   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3414   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
34153415
34163416   /* video extensions */
34173417   common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
r18027r18028
34563456
34573457DRIVER_INIT_MEMBER(galaxian_state,scorpion)
34583458{
3459   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
3459   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
34603460
34613461   common_init(machine(), scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
34623462
34633463   /* hook up AY8910 */
3464   machine().device("audiocpu")->memory().space(AS_IO)->install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this));
3464   machine().device("audiocpu")->memory().space(AS_IO).install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this));
34653465
34663466   /* extra ROM */
34673467   space.install_read_bank(0x5800, 0x67ff, "bank1");
r18027r18028
34703470   /* no background related */
34713471//  space.nop_write(0x6803, 0x6803);
34723472
3473   machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3000, 0x3000, read8_delegate(FUNC(galaxian_state::scorpion_digitalker_intr_r),this));
3473   machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_handler(0x3000, 0x3000, read8_delegate(FUNC(galaxian_state::scorpion_digitalker_intr_r),this));
34743474/*
34753475{
34763476    const UINT8 *rom = memregion("speech")->base();
trunk/src/mame/drivers/hyprduel.c
r18027r18028
803803   m_int_num = 0x02;
804804
805805   /* cpu synchronization (severe timings) */
806   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc0040e, 0xc00411, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_w),this));
807   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0xc00408, 0xc00409, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_r),this));
808   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00408, 0xc00409, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_w),this));
809   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0xfff34c, 0xfff34d, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_r),this));
806   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc0040e, 0xc00411, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_w),this));
807   machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0xc00408, 0xc00409, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_r),this));
808   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00408, 0xc00409, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_w),this));
809   machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0xfff34c, 0xfff34d, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_r),this));
810810}
811811
812812DRIVER_INIT_MEMBER(hyprduel_state,magerror)
trunk/src/mame/drivers/flstory.c
r18027r18028
119119
120120CUSTOM_INPUT_MEMBER(flstory_state::victnine_mcu_status_bit01_r)
121121{
122   address_space &space = *m_maincpu->space(AS_PROGRAM);
122   address_space &space = m_maincpu->space(AS_PROGRAM);
123123
124124   return (victnine_mcu_status_r(space, 0) & 3);
125125}
trunk/src/mame/drivers/dgpix.c
r18027r18028
584584   rom[BYTE4_XOR_BE(0x3aa933)] = 0;
585585
586586//  protection related ?
587//  machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0xf0c8b440, 0xf0c8b447);
587//  machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0xf0c8b440, 0xf0c8b447);
588588
589589   m_flash_roms = 2;
590590}
r18027r18028
604604   rom[BYTE4_XOR_BE(0x3a45c9)] = 0;
605605
606606//  protection related ?
607//  machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x12341234, 0x12341243);
607//  machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x12341234, 0x12341243);
608608
609609   m_flash_roms = 4;
610610}
trunk/src/mame/drivers/sangho.c
r18027r18028
8080   switch(slot_select)
8181   {
8282      case 0:
83         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
84         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x3fff, "bank5");
83         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
84         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0000, 0x3fff, "bank5");
8585         state->membank("bank1")->set_base(state->m_ram);
8686         state->membank("bank5")->set_base(state->m_ram);
8787         break;
8888      case 2:
89         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1");
90         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x3fff);
89         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
90         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x3fff);
9191         state->membank("bank1")->set_base(state->memregion("user1")->base()+ 0x10000);
9292         break;
9393      case 1:
9494      case 3:
95         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0x0000, 0x3fff);
96         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x3fff);
95         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x0000, 0x3fff);
96         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x3fff);
9797         break;
9898   }
9999
r18027r18028
102102   switch(slot_select)
103103   {
104104      case 0:
105         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank2");
106         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x4000, 0x7fff, "bank6");
105         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
106         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x4000, 0x7fff, "bank6");
107107         state->membank("bank2")->set_base(state->m_ram + 0x4000);
108108         state->membank("bank6")->set_base(state->m_ram + 0x4000);
109109         break;
110110      case 2:
111         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank2");
112         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x4000, 0x7fff);
111         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
112         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
113113         state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base()+ 0x18000);
114114         break;
115115      case 3:
116         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank2");
117         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x4000, 0x7fff);
116         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
117         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
118118         state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000) + 0x4000);
119119         break;
120120      case 1:
121         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0x4000, 0x7fff);
122         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x4000, 0x7fff);
121         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x4000, 0x7fff);
122         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
123123         break;
124124   }
125125
r18027r18028
128128   switch(slot_select)
129129   {
130130      case 0:
131         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xbfff, "bank3");
132         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x8000, 0xbfff, "bank7");
131         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank3");
132         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x8000, 0xbfff, "bank7");
133133         state->membank("bank3")->set_base(state->m_ram + 0x8000);
134134         state->membank("bank7")->set_base(state->m_ram + 0x8000);
135135         break;
136136      case 3:
137         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xbfff, "bank3");
138         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0xbfff);
137         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank3");
138         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
139139         state->membank("bank3")->set_base(machine.root_device().memregion("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000));
140140         break;
141141      case 1:
142142      case 2:
143         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0x8000, 0xbfff);
144         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0xbfff);
143         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x8000, 0xbfff);
144         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
145145         break;
146146   }
147147
r18027r18028
150150   switch(slot_select)
151151   {
152152      case 0:
153         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc000, 0xffff, "bank4");
154         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0xc000, 0xffff, "bank8");
153         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xffff, "bank4");
154         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0xc000, 0xffff, "bank8");
155155         state->membank("bank4")->set_base(state->m_ram + 0xc000);
156156         state->membank("bank8")->set_base(state->m_ram + 0xc000);
157157         break;
158158      case 1:
159159      case 2:
160160      case 3:
161         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_read(0xc000, 0xffff);
162         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xc000, 0xffff);
161         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0xc000, 0xffff);
162         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xc000, 0xffff);
163163         break;
164164   }
165165
r18027r18028
201201      {
202202         // ram
203203         state->membank(read_bank_name)->set_base(&state->m_ram[(banknum & 0x7f) * 0x4000]);
204         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(bank*0x4000, (bank+1)*0x4000 - 1, write_bank_name );
204         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(bank*0x4000, (bank+1)*0x4000 - 1, write_bank_name );
205205         state->membank(write_bank_name)->set_base(&state->m_ram[(banknum & 0x7f) * 0x4000]);
206206      }
207207      else
208208      {
209209         // rom 0
210210         state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x4000*banknum);
211         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
211         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
212212      }
213213   }
214214   else if (banktype == 0x82)
215215   {
216216      state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x20000+banknum*0x4000);
217      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
217      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
218218   }
219219   else if (banktype == 0x80)
220220   {
221221      state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x120000+banknum*0x4000);
222      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
222      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
223223   }
224224   else
225225   {
trunk/src/mame/drivers/pachifev.c
r18027r18028
326326      /* I wish I had found a better way to handle cocktail inputs, but I can't find a way to access internal RAM */
327327      /* (bit 5 of 0xf0aa : 0 = player 1 and 1 = player 2 - bit 6 of 0xf0aa : 0 = upright and 1 = cocktail). */
328328      /* All I found is that in main RAM, 0xe00f.b determines the player : 0x00 = player 1 and 0x01 = player 2. */
329      address_space *ramspace = device.memory().space(AS_PROGRAM);
329      address_space &ramspace = device.memory().space(AS_PROGRAM);
330330      UINT8 player = 0;
331331
332      if ((ramspace->read_byte(0xe00f) == 0x01) && ((ioport("DSW1")->read() & 0x08) == 0x00))
332      if ((ramspace.read_byte(0xe00f) == 0x01) && ((ioport("DSW1")->read() & 0x08) == 0x00))
333333         player = 1;
334334
335335        int current_power=ioport(inname[player])->read() & 0x3f;
trunk/src/mame/drivers/kyugo.c
r18027r18028
510510
511511void kyugo_state::machine_reset()
512512{
513   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
513   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
514514   // must start with interrupts and sub CPU disabled
515515   m_nmi_mask = 0;
516516   kyugo_sub_cpu_control_w(space, 0, 0);
r18027r18028
13681368DRIVER_INIT_MEMBER(kyugo_state,gyrodine)
13691369{
13701370   /* add watchdog */
1371   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe000, 0xe000, write8_delegate(FUNC(kyugo_state::watchdog_reset_w),this));
1371   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe000, 0xe000, write8_delegate(FUNC(kyugo_state::watchdog_reset_w),this));
13721372}
13731373
13741374
r18027r18028
13761376{
13771377
13781378   /* shared RAM is mapped at 0xe000 as well  */
1379   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0xe000, 0xe7ff, m_shared_ram);
1379   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0xe000, 0xe7ff, m_shared_ram);
13801380
13811381   /* extra RAM on sub CPU  */
1382   machine().device("sub")->memory().space(AS_PROGRAM)->install_ram(0x8800, 0x8fff);
1382   machine().device("sub")->memory().space(AS_PROGRAM).install_ram(0x8800, 0x8fff);
13831383}
13841384
13851385
trunk/src/mame/drivers/leland.c
r18027r18028
19821982{
19831983   leland_state *state = machine.driver_data<leland_state>();
19841984   /* set up the master CPU VRAM I/O */
1985   machine.device("master")->memory().space(AS_IO)->install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),state), write8_delegate(FUNC(leland_state::leland_mvram_port_w),state));
1985   machine.device("master")->memory().space(AS_IO).install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),state), write8_delegate(FUNC(leland_state::leland_mvram_port_w),state));
19861986
19871987   /* set up the master CPU I/O ports */
1988   machine.device("master")->memory().space(AS_IO)->install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),state));
1989   machine.device("master")->memory().space(AS_IO)->install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),state));
1988   machine.device("master")->memory().space(AS_IO).install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),state));
1989   machine.device("master")->memory().space(AS_IO).install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),state));
19901990}
19911991
19921992
r18027r18028
20022002   init_master_ports(machine(), 0x40, 0x80);
20032003
20042004   /* set up additional input ports */
2005   machine().device("master")->memory().space(AS_IO)->install_read_handler(0x80, 0x80, read8_delegate(FUNC(leland_state::cerberus_dial_1_r),this));
2006   machine().device("master")->memory().space(AS_IO)->install_read_handler(0x90, 0x90, read8_delegate(FUNC(leland_state::cerberus_dial_2_r),this));
2005   machine().device("master")->memory().space(AS_IO).install_read_handler(0x80, 0x80, read8_delegate(FUNC(leland_state::cerberus_dial_1_r),this));
2006   machine().device("master")->memory().space(AS_IO).install_read_handler(0x90, 0x90, read8_delegate(FUNC(leland_state::cerberus_dial_2_r),this));
20072007}
20082008
20092009
r18027r18028
20482048   /* kludge warning: the game uses location E0CA to determine if the joysticks are available */
20492049   /* it gets cleared by the code, but there is no obvious way for the value to be set to a */
20502050   /* non-zero value. If the value is zero, the joystick is never read. */
2051   m_alleymas_kludge_mem = machine().device("master")->memory().space(AS_PROGRAM)->install_write_handler(0xe0ca, 0xe0ca, write8_delegate(FUNC(leland_state::alleymas_joystick_kludge),this));
2051   m_alleymas_kludge_mem = machine().device("master")->memory().space(AS_PROGRAM).install_write_handler(0xe0ca, 0xe0ca, write8_delegate(FUNC(leland_state::alleymas_joystick_kludge),this));
20522052}
20532053
20542054
r18027r18028
20712071   init_master_ports(machine(), 0x40, 0x80);
20722072
20732073   /* set up additional input ports */
2074   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this));
2075   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this));
2076   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this));
2074   machine().device("master")->memory().space(AS_IO).install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this));
2075   machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this));
2076   machine().device("master")->memory().space(AS_IO).install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this));
20772077}
20782078
20792079
r18027r18028
21182118   init_master_ports(machine(), 0x00, 0xc0);
21192119
21202120   /* set up additional input ports */
2121   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(leland_state::redline_pedal_1_r),this));
2122   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xd0, 0xd0, read8_delegate(FUNC(leland_state::redline_pedal_2_r),this));
2123   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::redline_wheel_2_r),this));
2124   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::redline_wheel_1_r),this));
2121   machine().device("master")->memory().space(AS_IO).install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(leland_state::redline_pedal_1_r),this));
2122   machine().device("master")->memory().space(AS_IO).install_read_handler(0xd0, 0xd0, read8_delegate(FUNC(leland_state::redline_pedal_2_r),this));
2123   machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::redline_wheel_2_r),this));
2124   machine().device("master")->memory().space(AS_IO).install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::redline_wheel_1_r),this));
21252125}
21262126
21272127
r18027r18028
21502150   init_master_ports(machine(), 0x00, 0xc0);
21512151
21522152   /* set up additional input ports */
2153   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xa4, 0xa4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this));
2154   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xb8, 0xb8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this));
2155   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xbc, 0xbc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this));
2153   machine().device("master")->memory().space(AS_IO).install_read_handler(0xa4, 0xa4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this));
2154   machine().device("master")->memory().space(AS_IO).install_read_handler(0xb8, 0xb8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this));
2155   machine().device("master")->memory().space(AS_IO).install_read_handler(0xbc, 0xbc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this));
21562156}
21572157
21582158
r18027r18028
21692169   init_master_ports(machine(), 0x40, 0x80);
21702170
21712171   /* set up additional input ports */
2172   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4");
2173   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5");
2172   machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
2173   machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5");
21742174}
21752175
21762176
r18027r18028
21872187   init_master_ports(machine(), 0x00, 0xc0);
21882188
21892189   /* set up additional input ports */
2190   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4");
2191   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5");
2190   machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
2191   machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5");
21922192}
21932193
21942194
r18027r18028
22052205   init_master_ports(machine(), 0x80, 0x40);
22062206
22072207   /* set up additional input ports */
2208   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4");
2209   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5");
2208   machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
2209   machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5");
22102210}
22112211
22122212
r18027r18028
22232223   init_master_ports(machine(), 0x00, 0x40);
22242224
22252225   /* set up additional input ports */
2226   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4");
2227   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5");
2226   machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
2227   machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5");
22282228}
22292229
22302230
r18027r18028
22422242   init_master_ports(machine(), 0x40, 0x80);   /* yes, this is intentional */
22432243
22442244   /* set up additional input ports */
2245   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this));
2246   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this));
2247   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this));
2245   machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this));
2246   machine().device("master")->memory().space(AS_IO).install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this));
2247   machine().device("master")->memory().space(AS_IO).install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this));
22482248}
22492249
22502250
r18027r18028
22612261   init_master_ports(machine(), 0x80, 0x40);
22622262
22632263   /* set up additional input ports */
2264   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this));
2265   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this));
2266   machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this));
2264   machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this));
2265   machine().device("master")->memory().space(AS_IO).install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this));
2266   machine().device("master")->memory().space(AS_IO).install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this));
22672267}
22682268
22692269
r18027r18028
22802280   init_master_ports(machine(), 0x00, 0x40);
22812281
22822282   /* set up additional input ports */
2283   machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN4");
2283   machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN4");
22842284}
22852285
22862286
trunk/src/mame/drivers/pcat_nit.c
r18027r18028
427427   machine().device<nvram_device>("nvram")->set_base(m_banked_nvram, 0x2000);
428428
429429   pc_vga_init(machine(), vga_setting, NULL);
430   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
430   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
431431}
432432
433433GAME( 1993, bonanza,    0,         pcat_nit,  pcat_nit, pcat_nit_state, pcat_nit, ROT0, "New Image Technologies",  "Bonanza (Revision 3)", GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/mame/drivers/tiamc1.c
r18027r18028
120120
121121void tiamc1_state::machine_reset()
122122{
123   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
123   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
124124   tiamc1_bankswitch_w(space, 0, 0);
125125}
126126
trunk/src/mame/drivers/segag80r.c
r18027r18028
188188WRITE8_MEMBER(segag80r_state::monsterb_vidram_w){ monsterb_videoram_w(space, decrypt_offset(space, offset), data); }
189189WRITE8_MEMBER(segag80r_state::pignewt_vidram_w){ pignewt_videoram_w(space, decrypt_offset(space, offset), data); }
190190WRITE8_MEMBER(segag80r_state::sindbadm_vidram_w){ sindbadm_videoram_w(space, decrypt_offset(space, offset), data); }
191WRITE8_MEMBER(segag80r_state::usb_ram_w){ device_t *device = machine().device("usbsnd"); sega_usb_ram_w(device, space, decrypt_offset(*machine().device("maincpu")->memory().space(AS_PROGRAM), offset), data); }
191WRITE8_MEMBER(segag80r_state::usb_ram_w){ device_t *device = machine().device("usbsnd"); sega_usb_ram_w(device, space, decrypt_offset(machine().device("maincpu")->memory().space(AS_PROGRAM), offset), data); }
192192
193193
194194
r18027r18028
14461446DRIVER_INIT_MEMBER(segag80r_state,astrob)
14471447{
14481448   device_t *speech = machine().device("segaspeech");
1449   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1449   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
14501450
14511451   /* configure the 315-0062 security chip */
14521452   m_decrypt = segag80_security(62);
r18027r18028
14551455   m_background_pcb = G80_BACKGROUND_NONE;
14561456
14571457   /* install speech board */
1458   iospace->install_legacy_write_handler(*speech, 0x38, 0x38, FUNC(sega_speech_data_w));
1459   iospace->install_legacy_write_handler(*speech, 0x3b, 0x3b, FUNC(sega_speech_control_w));
1458   iospace.install_legacy_write_handler(*speech, 0x38, 0x38, FUNC(sega_speech_data_w));
1459   iospace.install_legacy_write_handler(*speech, 0x3b, 0x3b, FUNC(sega_speech_control_w));
14601460
14611461   /* install Astro Blaster sound board */
1462   iospace->install_write_handler(0x3e, 0x3f, write8_delegate(FUNC(segag80r_state::astrob_sound_w),this));
1462   iospace.install_write_handler(0x3e, 0x3f, write8_delegate(FUNC(segag80r_state::astrob_sound_w),this));
14631463}
14641464
14651465
r18027r18028
14761476
14771477DRIVER_INIT_MEMBER(segag80r_state,spaceod)
14781478{
1479   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1479   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
14801480
14811481   /* configure the 315-0063 security chip */
14821482   m_decrypt = segag80_security(63);
r18027r18028
14851485   m_background_pcb = G80_BACKGROUND_SPACEOD;
14861486
14871487   /* configure ports for the background board */
1488   iospace->install_readwrite_handler(0x08, 0x0f, read8_delegate(FUNC(segag80r_state::spaceod_back_port_r),this), write8_delegate(FUNC(segag80r_state::spaceod_back_port_w),this));
1488   iospace.install_readwrite_handler(0x08, 0x0f, read8_delegate(FUNC(segag80r_state::spaceod_back_port_r),this), write8_delegate(FUNC(segag80r_state::spaceod_back_port_w),this));
14891489
14901490   /* install Space Odyssey sound board */
1491   iospace->install_write_handler(0x0e, 0x0f, write8_delegate(FUNC(segag80r_state::spaceod_sound_w),this));
1491   iospace.install_write_handler(0x0e, 0x0f, write8_delegate(FUNC(segag80r_state::spaceod_sound_w),this));
14921492
14931493   /* install our wacky mangled ports */
1494   iospace->install_read_handler(0xf8, 0xfb, read8_delegate(FUNC(segag80r_state::spaceod_mangled_ports_r),this));
1495   iospace->install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80r_state::spaceod_port_fc_r),this));
1494   iospace.install_read_handler(0xf8, 0xfb, read8_delegate(FUNC(segag80r_state::spaceod_mangled_ports_r),this));
1495   iospace.install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80r_state::spaceod_port_fc_r),this));
14961496}
14971497
14981498
14991499DRIVER_INIT_MEMBER(segag80r_state,monsterb)
15001500{
1501   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1502   address_space *pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1501   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
1502   address_space &pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
15031503
15041504   /* configure the 315-0082 security chip */
15051505   m_decrypt = segag80_security(82);
r18027r18028
15091509   monsterb_expand_gfx(machine(), "gfx1");
15101510
15111511   /* install background board handlers */
1512   iospace->install_write_handler(0xb8, 0xbd, write8_delegate(FUNC(segag80r_state::monsterb_back_port_w),this));
1513   pgmspace->install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::monsterb_vidram_w),this));
1512   iospace.install_write_handler(0xb8, 0xbd, write8_delegate(FUNC(segag80r_state::monsterb_back_port_w),this));
1513   pgmspace.install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::monsterb_vidram_w),this));
15141514}
15151515
15161516
15171517DRIVER_INIT_MEMBER(segag80r_state,monster2)
15181518{
1519   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1520   address_space *pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1519   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
1520   address_space &pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
15211521
15221522   /* configure the 315-5006 security chip */
15231523   spatter_decode(machine(), "maincpu");
r18027r18028
15281528   monsterb_expand_gfx(machine(), "gfx1");
15291529
15301530   /* install background board handlers */
1531   iospace->install_write_handler(0xb4, 0xb5, write8_delegate(FUNC(segag80r_state::pignewt_back_color_w),this));
1532   iospace->install_write_handler(0xb8, 0xbd, write8_delegate(FUNC(segag80r_state::pignewt_back_port_w),this));
1533   pgmspace->install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::pignewt_vidram_w),this));
1531   iospace.install_write_handler(0xb4, 0xb5, write8_delegate(FUNC(segag80r_state::pignewt_back_color_w),this));
1532   iospace.install_write_handler(0xb8, 0xbd, write8_delegate(FUNC(segag80r_state::pignewt_back_port_w),this));
1533   pgmspace.install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::pignewt_vidram_w),this));
15341534}
15351535
15361536
15371537DRIVER_INIT_MEMBER(segag80r_state,pignewt)
15381538{
15391539   device_t *usbsnd = machine().device("usbsnd");
1540   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1541   address_space *pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1540   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
1541   address_space &pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
15421542
15431543   /* configure the 315-0063? security chip */
15441544   m_decrypt = segag80_security(63);
r18027r18028
15481548   monsterb_expand_gfx(machine(), "gfx1");
15491549
15501550   /* install background board handlers */
1551   iospace->install_write_handler(0xb4, 0xb5, write8_delegate(FUNC(segag80r_state::pignewt_back_color_w),this));
1552   iospace->install_write_handler(0xb8, 0xbd, write8_delegate(FUNC(segag80r_state::pignewt_back_port_w),this));
1553   pgmspace->install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::pignewt_vidram_w),this));
1551   iospace.install_write_handler(0xb4, 0xb5, write8_delegate(FUNC(segag80r_state::pignewt_back_color_w),this));
1552   iospace.install_write_handler(0xb8, 0xbd, write8_delegate(FUNC(segag80r_state::pignewt_back_port_w),this));
1553   pgmspace.install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::pignewt_vidram_w),this));
15541554
15551555   /* install Universal sound board */
1556   iospace->install_legacy_readwrite_handler(*usbsnd, 0x3f, 0x3f, FUNC(sega_usb_status_r), FUNC(sega_usb_data_w));
1557   pgmspace->install_legacy_read_handler(*usbsnd, 0xd000, 0xdfff, FUNC(sega_usb_ram_r));
1558   pgmspace->install_write_handler(0xd000, 0xdfff, write8_delegate(FUNC(segag80r_state::usb_ram_w),this));
1556   iospace.install_legacy_readwrite_handler(*usbsnd, 0x3f, 0x3f, FUNC(sega_usb_status_r), FUNC(sega_usb_data_w));
1557   pgmspace.install_legacy_read_handler(*usbsnd, 0xd000, 0xdfff, FUNC(sega_usb_ram_r));
1558   pgmspace.install_write_handler(0xd000, 0xdfff, write8_delegate(FUNC(segag80r_state::usb_ram_w),this));
15591559}
15601560
15611561
15621562DRIVER_INIT_MEMBER(segag80r_state,sindbadm)
15631563{
1564   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1565   address_space *pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1564   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
1565   address_space &pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
15661566
15671567   /* configure the encrypted Z80 */
15681568   sindbadm_decode(machine(), "maincpu");
r18027r18028
15721572   m_background_pcb = G80_BACKGROUND_SINDBADM;
15731573
15741574   /* install background board handlers */
1575   iospace->install_write_handler(0x40, 0x41, write8_delegate(FUNC(segag80r_state::sindbadm_back_port_w),this));
1576   pgmspace->install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::sindbadm_vidram_w),this));
1575   iospace.install_write_handler(0x40, 0x41, write8_delegate(FUNC(segag80r_state::sindbadm_back_port_w),this));
1576   pgmspace.install_write_handler(0xe000, 0xffff, write8_delegate(FUNC(segag80r_state::sindbadm_vidram_w),this));
15771577}
15781578
15791579
trunk/src/mame/drivers/taitojc.c
r18027r18028
13251325
13261326   m_has_dsp_hack = 1;
13271327
1328   machine().device("dsp")->memory().space(AS_DATA)->install_readwrite_handler(0x7ff0, 0x7ff0, read16_delegate(FUNC(taitojc_state::taitojc_dsp_idle_skip_r),this), write16_delegate(FUNC(taitojc_state::dsp_idle_skip_w),this));
1328   machine().device("dsp")->memory().space(AS_DATA).install_readwrite_handler(0x7ff0, 0x7ff0, read16_delegate(FUNC(taitojc_state::taitojc_dsp_idle_skip_r),this), write16_delegate(FUNC(taitojc_state::dsp_idle_skip_w),this));
13291329}
13301330
13311331DRIVER_INIT_MEMBER(taitojc_state,dendego2)
r18027r18028
13331333
13341334   DRIVER_INIT_CALL(taitojc);
13351335
1336   machine().device("dsp")->memory().space(AS_DATA)->install_readwrite_handler(0x7ff0, 0x7ff0, read16_delegate(FUNC(taitojc_state::dendego2_dsp_idle_skip_r),this), write16_delegate(FUNC(taitojc_state::dsp_idle_skip_w),this));
1336   machine().device("dsp")->memory().space(AS_DATA).install_readwrite_handler(0x7ff0, 0x7ff0, read16_delegate(FUNC(taitojc_state::dendego2_dsp_idle_skip_r),this), write16_delegate(FUNC(taitojc_state::dsp_idle_skip_w),this));
13371337}
13381338
13391339DRIVER_INIT_MEMBER(taitojc_state,dangcurv)
trunk/src/mame/drivers/ddealer.c
r18027r18028
677677
678678DRIVER_INIT_MEMBER(ddealer_state,ddealer)
679679{
680   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfe01c, 0xfe01d, read16_delegate(FUNC(ddealer_state::ddealer_mcu_r), this));
680   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfe01c, 0xfe01d, read16_delegate(FUNC(ddealer_state::ddealer_mcu_r), this));
681681}
682682
683683ROM_START( ddealer )
trunk/src/mame/drivers/berzerk.c
r18027r18028
582582
583583static SOUND_RESET(berzerk)
584584{
585   address_space &space = *machine.device("maincpu")->memory().space(AS_IO);
585   address_space &space = machine.device("maincpu")->memory().space(AS_IO);
586586   berzerk_state *state = machine.driver_data<berzerk_state>();
587587   /* clears the flip-flop controlling the volume and freq on the speech chip */
588588   state->berzerk_audio_w(space, 4, 0x40);
r18027r18028
12341234
12351235DRIVER_INIT_MEMBER(berzerk_state,moonwarp)
12361236{
1237   address_space *io = machine().device("maincpu")->memory().space(AS_IO);
1238   io->install_read_handler (0x48, 0x48, read8_delegate(FUNC(berzerk_state::moonwarp_p1_r), this));
1239   io->install_read_handler (0x4a, 0x4a, read8_delegate(FUNC(berzerk_state::moonwarp_p2_r), this));
1237   address_space &io = machine().device("maincpu")->memory().space(AS_IO);
1238   io.install_read_handler (0x48, 0x48, read8_delegate(FUNC(berzerk_state::moonwarp_p1_r), this));
1239   io.install_read_handler (0x4a, 0x4a, read8_delegate(FUNC(berzerk_state::moonwarp_p2_r), this));
12401240}
12411241
12421242/*************************************
trunk/src/mame/drivers/magtouch.c
r18027r18028
249249DRIVER_INIT_MEMBER(magtouch_state,magtouch)
250250{
251251   pc_vga_init(machine(), vga_setting, NULL);
252   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
252   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
253253}
254254
255255GAME( 1995, magtouch,   0,         magtouch,  magtouch, magtouch_state, magtouch, ROT0, "Micro Manufacturing",     "Magical Touch", GAME_NOT_WORKING | GAME_NO_SOUND )
trunk/src/mame/drivers/psikyo.c
r18027r18028
18131813   }
18141814
18151815   /* input ports */
1816   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::sngkace_input_r),this));
1816   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::sngkace_input_r),this));
18171817
18181818   /* sound latch */
1819   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::psikyo_soundlatch_w),this));
1819   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::psikyo_soundlatch_w),this));
18201820
18211821   m_ka302c_banking = 0; // SH201B doesn't have any gfx banking
18221822
r18027r18028
18651865{
18661866
18671867   /* input ports */
1868   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
1868   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
18691869
18701870   /* sound latch */
1871   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
1871   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
18721872
18731873   /* protection */
1874   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
1874   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
18751875
18761876   s1945_mcu_init(machine());
18771877   m_s1945_mcu_table = 0;
r18027r18028
18871887{
18881888
18891889   /* input ports */
1890   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::gunbird_input_r),this));
1890   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::gunbird_input_r),this));
18911891
18921892   /* sound latch */
1893   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::psikyo_soundlatch_w),this));
1893   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::psikyo_soundlatch_w),this));
18941894
18951895   m_ka302c_banking = 1;
18961896
r18027r18028
19041904{
19051905
19061906   /* input ports */
1907   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
1907   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
19081908
19091909   /* sound latch */
1910   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
1910   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
19111911
19121912   /* protection and tile bank switching */
1913   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
1913   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
19141914
19151915   s1945_mcu_init(machine());
19161916   m_s1945_mcu_table = s1945_table;
r18027r18028
19261926{
19271927
19281928   /* input ports */
1929   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
1929   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
19301930
19311931   /* sound latch */
1932   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
1932   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
19331933
19341934   /* protection and tile bank switching */
1935   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
1935   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
19361936
19371937   s1945_mcu_init(machine());
19381938   m_s1945_mcu_table = s1945a_table;
r18027r18028
19481948{
19491949
19501950   /* input ports*/
1951   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
1951   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::s1945_input_r),this));
19521952
19531953   /* sound latch */
1954   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
1954   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
19551955
19561956   /* protection and tile bank switching */
1957   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
1957   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00004, 0xc0000b, write32_delegate(FUNC(psikyo_state::s1945_mcu_w),this));
19581958
19591959   s1945_mcu_init(machine());
19601960   m_s1945_mcu_table = s1945j_table;
r18027r18028
19701970{
19711971
19721972   /* input ports */
1973   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::gunbird_input_r),this));
1973   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::gunbird_input_r),this));
19741974
19751975   /* sound latch */
1976   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
1976   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
19771977
19781978   m_ka302c_banking = 1;
19791979
r18027r18028
19861986{
19871987
19881988   /* input ports */
1989   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::gunbird_input_r),this));
1989   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc00000, 0xc0000b, read32_delegate(FUNC(psikyo_state::gunbird_input_r),this));
19901990
19911991   /* sound latch */
1992   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
1992   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00010, 0xc00013, write32_delegate(FUNC(psikyo_state::s1945_soundlatch_w),this));
19931993
19941994   m_ka302c_banking = 1;
19951995
trunk/src/mame/drivers/model3.c
r18027r18028
10591059
10601060static UINT32 scsi_fetch(running_machine &machine, UINT32 dsp)
10611061{
1062   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1062   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
10631063   UINT32 result;
10641064   result = space.read_dword(dsp);
10651065   return FLIPENDIAN_INT32(result);
r18027r18028
11591159
11601160static void real3d_dma_callback(running_machine &machine, UINT32 src, UINT32 dst, int length, int byteswap)
11611161{
1162   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1162   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
11631163   switch(dst >> 24)
11641164   {
11651165      case 0x88:      /* Display List End Trigger */
r18027r18028
54835483{
54845484   interleave_vroms(machine());
54855485
5486   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc0000000, 0xc00000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5486   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
54875487
5488   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
5488   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xff000000, 0xff7fffff, "bank1" );
54895489
5490   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),this), write64_delegate(FUNC(model3_state::mpc105_addr_w),this));
5491   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),this), write64_delegate(FUNC(model3_state::mpc105_data_w),this));
5492   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),this), write64_delegate(FUNC(model3_state::mpc105_reg_w),this));
5490   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),this), write64_delegate(FUNC(model3_state::mpc105_addr_w),this));
5491   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),this), write64_delegate(FUNC(model3_state::mpc105_data_w),this));
5492   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),this), write64_delegate(FUNC(model3_state::mpc105_reg_w),this));
54935493}
54945494
54955495DRIVER_INIT_MEMBER(model3_state,model3_15)
54965496{
54975497   interleave_vroms(machine());
5498   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
5498   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xff000000, 0xff7fffff, "bank1" );
54995499
5500   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),this), write64_delegate(FUNC(model3_state::mpc105_addr_w),this));
5501   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),this), write64_delegate(FUNC(model3_state::mpc105_data_w),this));
5502   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),this), write64_delegate(FUNC(model3_state::mpc105_reg_w),this));
5500   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),this), write64_delegate(FUNC(model3_state::mpc105_addr_w),this));
5501   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),this), write64_delegate(FUNC(model3_state::mpc105_data_w),this));
5502   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),this), write64_delegate(FUNC(model3_state::mpc105_reg_w),this));
55035503}
55045504
55055505DRIVER_INIT_MEMBER(model3_state,model3_20)
55065506{
55075507   interleave_vroms(machine());
5508   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
5508   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xff000000, 0xff7fffff, "bank1" );
55095509
5510   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc2000000, 0xc20000ff, read64_delegate(FUNC(model3_state::real3d_dma_r),this), write64_delegate(FUNC(model3_state::real3d_dma_w),this));
5510   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc2000000, 0xc20000ff, read64_delegate(FUNC(model3_state::real3d_dma_r),this), write64_delegate(FUNC(model3_state::real3d_dma_w),this));
55115511
5512   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5513   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5514   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
5512   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5513   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5514   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
55155515}
55165516
55175517DRIVER_INIT_MEMBER(model3_state,lostwsga)
r18027r18028
55205520
55215521   DRIVER_INIT_CALL(model3_15);
55225522   /* TODO: there's an M68K device at 0xC0000000 - FF, maybe lightgun controls ? */
5523   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5523   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
55245524
55255525   rom[0x7374f0/4] = 0x38840004;      /* This seems to be an actual bug in the original code */
55265526}
r18027r18028
55315531
55325532   DRIVER_INIT_CALL(model3_15);
55335533   /* TODO: network device at 0xC0000000 - FF */
5534   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5534   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
55355535
55365536   rom[(0x71275c^4)/4] = 0x60000000;
55375537   rom[(0x71277c^4)/4] = 0x60000000;
r18027r18028
55435543
55445544   DRIVER_INIT_CALL(model3_15);
55455545   /* TODO: network device at 0xC0000000 - FF */
5546   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5546   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
55475547
55485548   rom[(0x713724^4)/4] = 0x60000000;
55495549   rom[(0x713744^4)/4] = 0x60000000;
r18027r18028
55605560
55615561   DRIVER_INIT_CALL(model3_15);
55625562   /* TODO: network device at 0xC0000000 - FF */
5563   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5563   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
55645564
55655565   //rom[(0x713724^4)/4] = 0x60000000; // Fix ME!!!! Needs to corrected for the non REV A version!!!!
55665566   //rom[(0x713744^4)/4] = 0x60000000;
r18027r18028
55765576   UINT32 *rom = (UINT32*)memregion("user1")->base();
55775577   DRIVER_INIT_CALL(model3_15);
55785578
5579   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5579   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc1000000, 0xc10000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
55805580
55815581   rom[(0x73fe38^4)/4] = 0x38840004;      /* This seems to be an actual bug in the original code */
55825582
r18027r18028
56075607   rom[(0x70e710^4)/4] = 0x60000000;
56085608
56095609   interleave_vroms(machine());
5610   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
5610   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xff000000, 0xff7fffff, "bank1" );
56115611
5612   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5612   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
56135613
5614   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5615   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5616   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5617   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5618   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
5614   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5615   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5616   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5617   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5618   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
56195619}
56205620
56215621DRIVER_INIT_MEMBER(model3_state,vs29815)
r18027r18028
56265626   rom[(0x60290c^4)/4] = 0x60000000;
56275627
56285628   interleave_vroms(machine());
5629   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
5629   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xff000000, 0xff7fffff, "bank1" );
56305630
5631   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5631   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
56325632
5633   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5634   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5635   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5636   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5637   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
5633   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5634   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5635   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5636   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5637   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
56385638}
56395639
56405640DRIVER_INIT_MEMBER(model3_state,bass)
r18027r18028
56455645   rom[(0x7999c8^4)/4] = 0x60000000;
56465646
56475647   interleave_vroms(machine());
5648   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
5648   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xff000000, 0xff7fffff, "bank1" );
56495649
5650   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5650   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
56515651
5652   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5653   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5654   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5655   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5656   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
5652   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5653   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec00000, 0xfedfffff, read64_delegate(FUNC(model3_state::mpc106_addr_r),this), write64_delegate(FUNC(model3_state::mpc106_addr_w),this));
5654   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5655   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfee00000, 0xfeffffff, read64_delegate(FUNC(model3_state::mpc106_data_r),this), write64_delegate(FUNC(model3_state::mpc106_data_w),this));
5656   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc106_reg_r),this), write64_delegate(FUNC(model3_state::mpc106_reg_w),this));
56575657}
56585658
56595659DRIVER_INIT_MEMBER(model3_state,getbass)
56605660{
56615661   interleave_vroms(machine());
5662   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xff000000, 0xff7fffff, "bank1" );
5662   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xff000000, 0xff7fffff, "bank1" );
56635663
5664   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
5664   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf9000000, 0xf90000ff, read64_delegate(FUNC(model3_state::scsi_r),this), write64_delegate(FUNC(model3_state::scsi_w),this));
56655665
5666   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),this), write64_delegate(FUNC(model3_state::mpc105_addr_w),this));
5667   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),this), write64_delegate(FUNC(model3_state::mpc105_data_w),this));
5668   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),this), write64_delegate(FUNC(model3_state::mpc105_reg_w),this));
5666   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0800cf8, 0xf0800cff, read64_delegate(FUNC(model3_state::mpc105_addr_r),this), write64_delegate(FUNC(model3_state::mpc105_addr_w),this));
5667   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf0c00cf8, 0xf0c00cff, read64_delegate(FUNC(model3_state::mpc105_data_r),this), write64_delegate(FUNC(model3_state::mpc105_data_w),this));
5668   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xf8fff000, 0xf8fff0ff, read64_delegate(FUNC(model3_state::mpc105_reg_r),this), write64_delegate(FUNC(model3_state::mpc105_reg_w),this));
56695669}
56705670
56715671DRIVER_INIT_MEMBER(model3_state,vs2)
r18027r18028
57355735   DRIVER_INIT_CALL(model3_20);
57365736
57375737   m_network_ram = auto_alloc_array_clear(machine(), UINT64, 0x10000);
5738   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this));
5738   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this));
57395739
57405740   rom[(0x50ecb4^4)/4] = 0x60000000;
57415741   rom[(0x50ecd4^4)/4] = 0x60000000;
r18027r18028
57505750   DRIVER_INIT_CALL(model3_20);
57515751
57525752   m_network_ram = auto_alloc_array_clear(machine(), UINT64, 0x10000);
5753   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this));
5753   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this));
57545754
57555755   rom[(0x50e8d4^4)/4] = 0x60000000;
57565756   rom[(0x50e8f4^4)/4] = 0x60000000;
r18027r18028
58195819   UINT32 *rom = (UINT32*)memregion("user1")->base();
58205820   DRIVER_INIT_CALL(model3_20);
58215821
5822   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
5823   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
5822   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
5823   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
58245824
58255825   //rom[(0x68468c^4)/4] = 0x60000000;
58265826   rom[(0x6063c4^4)/4] = 0x60000000;
r18027r18028
58335833   UINT32 *rom = (UINT32*)memregion("user1")->base();
58345834   DRIVER_INIT_CALL(model3_20);
58355835
5836   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
5837   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
5836   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
5837   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
58385838
58395839   rom[(0x606784^4)/4] = 0x60000000;
58405840   rom[(0x69a3fc^4)/4] = 0x60000000;      // jump to encrypted code
trunk/src/mame/drivers/iqblock.c
r18027r18028
443443   m_generic_paletteram2_8.set_target(rom + 0x12800, 0x800);
444444   m_fgvideoram = rom + 0x16800;
445445   m_bgvideoram = rom + 0x17000;
446   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xfe26, 0xfe26, write8_delegate(FUNC(iqblock_state::iqblock_prot_w),this));
446   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xfe26, 0xfe26, write8_delegate(FUNC(iqblock_state::iqblock_prot_w),this));
447447   m_video_type=1;
448448}
449449
r18027r18028
465465   m_generic_paletteram2_8.set_target(rom + 0x12800, 0x800);
466466   m_fgvideoram = rom + 0x16800;
467467   m_bgvideoram = rom + 0x17000;
468   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xfe39, 0xfe39, write8_delegate(FUNC(iqblock_state::grndtour_prot_w),this));
468   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xfe39, 0xfe39, write8_delegate(FUNC(iqblock_state::grndtour_prot_w),this));
469469   m_video_type=0;
470470}
471471
trunk/src/mame/drivers/ironhors.c
r18027r18028
436436READ8_MEMBER(ironhors_state::farwest_soundlatch_r)
437437{
438438
439   return soundlatch_byte_r(*m_soundcpu->space(AS_PROGRAM), 0);
439   return soundlatch_byte_r(m_soundcpu->space(AS_PROGRAM), 0);
440440}
441441
442442static const ym2203_interface farwest_ym2203_config =
trunk/src/mame/drivers/cps3.c
r18027r18028
723723
724724   state->m_0xc0000000_ram_decrypted = auto_alloc_array(machine, UINT32, 0x400/4);
725725
726   address_space *main = machine.device<sh2_device>("maincpu")->space(AS_PROGRAM);
727   main->set_direct_update_handler(direct_update_delegate(FUNC(cps3_state::cps3_direct_handler), state));
726   address_space &main = machine.device<sh2_device>("maincpu")->space(AS_PROGRAM);
727   main.set_direct_update_handler(direct_update_delegate(FUNC(cps3_state::cps3_direct_handler), state));
728728
729729   // flash roms
730730   astring tempstr;
trunk/src/mame/drivers/glass.c
r18027r18028
412412   glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
413413
414414   /* install custom handler over RAM for protection */
415   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this));
415   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this));
416416
417417}
418418
trunk/src/mame/drivers/jchan.c
r18027r18028
722722
723723DRIVER_INIT_MEMBER( jchan_state, jchan )
724724{
725   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x403ffe, 0x403fff, write16_delegate(FUNC(jchan_state::main2sub_cmd_w),this));
726   machine().device("sub")->memory().space(AS_PROGRAM)->install_write_handler(0x400000, 0x400001, write16_delegate(FUNC(jchan_state::sub2main_cmd_w),this));
725   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x403ffe, 0x403fff, write16_delegate(FUNC(jchan_state::main2sub_cmd_w),this));
726   machine().device("sub")->memory().space(AS_PROGRAM).install_write_handler(0x400000, 0x400001, write16_delegate(FUNC(jchan_state::sub2main_cmd_w),this));
727727}
728728
729729
trunk/src/mame/drivers/seattle.c
r18027r18028
14031403      for (which = 0; which < 4; which++)
14041404         if (state->m_galileo.dma_stalled_on_voodoo[which])
14051405         {
1406            address_space &space = *device->machine().device("maincpu")->memory().space(AS_PROGRAM);
1406            address_space &space = device->machine().device("maincpu")->memory().space(AS_PROGRAM);
14071407            if (LOG_DMA) logerror("Resuming DMA%d on voodoo\n", which);
14081408
14091409            /* mark this DMA as no longer stalled */
r18027r18028
14201420         /* if the CPU had a pending write, do it now */
14211421         if (state->m_cpu_stalled_on_voodoo)
14221422         {
1423            address_space &space = *device->machine().firstcpu->space(AS_PROGRAM);
1423            address_space &space = device->machine().firstcpu->space(AS_PROGRAM);
14241424            voodoo_w(device, space, state->m_cpu_stalled_offset, state->m_cpu_stalled_data, state->m_cpu_stalled_mem_mask);
14251425         }
14261426         state->m_cpu_stalled_on_voodoo = FALSE;
r18027r18028
15881588         break;
15891589
15901590      case WREG_ANALOG:
1591         result = analog_port_r(*machine().device("maincpu")->memory().space(AS_PROGRAM), 0, mem_mask);
1591         result = analog_port_r(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, mem_mask);
15921592         break;
15931593
15941594      case WREG_ETHER_DATA:
r18027r18028
16201620         break;
16211621
16221622      case WREG_ANALOG:
1623         analog_port_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 0, data, mem_mask);
1623         analog_port_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, data, mem_mask);
16241624         break;
16251625
16261626      case WREG_ETHER_DATA:
r18027r18028
28732873   {
28742874      case PHOENIX_CONFIG:
28752875         /* original Phoenix board only has 4MB of RAM */
2876         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_readwrite(0x00400000, 0x007fffff);
2876         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_readwrite(0x00400000, 0x007fffff);
28772877         break;
28782878
28792879      case SEATTLE_WIDGET_CONFIG:
28802880         /* set up the widget board */
2881         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16c00000, 0x16c0001f, read32_delegate(FUNC(seattle_state::widget_r),state), write32_delegate(FUNC(seattle_state::widget_w),state));
2881         machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x16c00000, 0x16c0001f, read32_delegate(FUNC(seattle_state::widget_r),state), write32_delegate(FUNC(seattle_state::widget_w),state));
28822882         break;
28832883
28842884      case FLAGSTAFF_CONFIG:
28852885         /* set up the analog inputs */
2886         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x14000000, 0x14000003, read32_delegate(FUNC(seattle_state::analog_port_r),state), write32_delegate(FUNC(seattle_state::analog_port_w),state));
2886         machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x14000000, 0x14000003, read32_delegate(FUNC(seattle_state::analog_port_r),state), write32_delegate(FUNC(seattle_state::analog_port_w),state));
28872887
28882888         /* set up the ethernet controller */
2889         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16c00000, 0x16c0003f, read32_delegate(FUNC(seattle_state::ethernet_r),state), write32_delegate(FUNC(seattle_state::ethernet_w),state));
2889         machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x16c00000, 0x16c0003f, read32_delegate(FUNC(seattle_state::ethernet_r),state), write32_delegate(FUNC(seattle_state::ethernet_w),state));
28902890         break;
28912891   }
28922892}
r18027r18028
30143014   init_common(machine(), MIDWAY_IOASIC_CARNEVIL, 469/* 469 or 486 or 528 */, 80, SEATTLE_CONFIG);
30153015
30163016   /* set up the gun */
3017   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16800000, 0x1680001f, read32_delegate(FUNC(seattle_state::carnevil_gun_r),this), write32_delegate(FUNC(seattle_state::carnevil_gun_w),this));
3017   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x16800000, 0x1680001f, read32_delegate(FUNC(seattle_state::carnevil_gun_r),this), write32_delegate(FUNC(seattle_state::carnevil_gun_w),this));
30183018
30193019   /* speedups */
30203020   mips3drc_add_hotspot(machine().device("maincpu"), 0x8015176C, 0x3C03801A, 250);      /* confirmed */
trunk/src/mame/drivers/alpha68k.c
r18027r18028
31513151
31523152DRIVER_INIT_MEMBER(alpha68k_state,jongbou)
31533153{
3154   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0c0000, 0x0c0001, read16_delegate(FUNC(alpha68k_state::jongbou_inputs_r),this));
3154   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0c0000, 0x0c0001, read16_delegate(FUNC(alpha68k_state::jongbou_inputs_r),this));
31553155   m_invert_controls = 0;
31563156   m_microcontroller_id = 0x00ff;
31573157   m_coin_id = 0x23 | (0x24 << 8);
trunk/src/mame/drivers/tmaster.c
r18027r18028
225225   tmaster_state *state = device->machine().driver_data<tmaster_state>();
226226   if ( channel == 0 )
227227   {
228      state->m_microtouch->rx(*device->machine().memory().first_space(), 0, data);
228      state->m_microtouch->rx(device->machine().driver_data()->generic_space(), 0, data);
229229   }
230230};
231231
trunk/src/mame/drivers/tcl.c
r18027r18028
190190{
191191   /* only the first part is decrypted (and verified)*/
192192
193   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
193   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
194194   UINT8 *dest = machine().root_device().memregion("maincpu")->base();
195195   int len = machine().root_device().memregion("maincpu")->bytes();
196196   UINT8 *src = auto_alloc_array(machine(), UINT8, len);
trunk/src/mame/drivers/namcos22.c
r18027r18028
54445444{
54455445   namcos22_state *state = machine.driver_data<namcos22_state>();
54465446   if (MCU_SPEEDUP)
5447      state->m_mcu->space(AS_PROGRAM)->install_readwrite_handler(0x80, 0x81, read16_delegate(FUNC(namcos22_state::mcuc74_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
5447      state->m_mcu->space(AS_PROGRAM).install_readwrite_handler(0x80, 0x81, read16_delegate(FUNC(namcos22_state::mcuc74_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
54485448}
54495449
54505450static void install_130_speedup(running_machine &machine)
r18027r18028
54525452   namcos22_state *state = machine.driver_data<namcos22_state>();
54535453   // install speedup cheat for 1.30 MCU BIOS
54545454   if (MCU_SPEEDUP)
5455      state->m_mcu->space(AS_PROGRAM)->install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos22_state::mcu130_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
5455      state->m_mcu->space(AS_PROGRAM).install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos22_state::mcu130_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
54565456}
54575457
54585458static void install_141_speedup(running_machine &machine)
r18027r18028
54605460   namcos22_state *state = machine.driver_data<namcos22_state>();
54615461   // install speedup cheat for 1.41 MCU BIOS
54625462   if (MCU_SPEEDUP)
5463      state->m_mcu->space(AS_PROGRAM)->install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos22_state::mcu141_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
5463      state->m_mcu->space(AS_PROGRAM).install_readwrite_handler(0x82, 0x83, read16_delegate(FUNC(namcos22_state::mcu141_speedup_r),state), write16_delegate(FUNC(namcos22_state::mcu_speedup_w),state));
54645464}
54655465
54665466static void namcos22_init( running_machine &machine, int game_type )
r18027r18028
54835483   namcos22_state *state = machine.driver_data<namcos22_state>();
54845484   namcos22_init(machine, game_type);
54855485
5486   state->m_mcu->space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::alpineracer_mcu_adc_r),state));
5487   state->m_mcu->space(AS_IO)->install_write_handler(M37710_PORT5, M37710_PORT5, write8_delegate(FUNC(namcos22_state::alpine_mcu_port5_w),state));
5486   state->m_mcu->space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::alpineracer_mcu_adc_r),state));
5487   state->m_mcu->space(AS_IO).install_write_handler(M37710_PORT5, M37710_PORT5, write8_delegate(FUNC(namcos22_state::alpine_mcu_port5_w),state));
54885488
54895489   state->m_motor_timer = machine.scheduler().timer_alloc(FUNC(alpine_steplock_callback));
54905490   state->m_motor_timer->reset();
r18027r18028
55135513{
55145514   alpine_init_common(machine(), NAMCOS22_ALPINE_SURFER);
55155515
5516   m_maincpu->space(AS_PROGRAM)->install_read_handler (0x200000, 0x200003, read32_delegate(FUNC(namcos22_state::alpinesa_prot_r),this));
5517   m_maincpu->space(AS_PROGRAM)->install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(namcos22_state::alpinesa_prot_w),this));
5516   m_maincpu->space(AS_PROGRAM).install_read_handler (0x200000, 0x200003, read32_delegate(FUNC(namcos22_state::alpinesa_prot_r),this));
5517   m_maincpu->space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(namcos22_state::alpinesa_prot_w),this));
55185518   install_141_speedup(machine());
55195519
55205520   m_keycus_id = 0x01a9;
r18027r18028
55255525   namcos22_init(machine(), NAMCOS22_AIR_COMBAT22);
55265526
55275527   // S22-BIOS ver1.20 namco all rights reserved 94/12/21
5528   m_mcu->space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::airco22_mcu_adc_r),this));
5528   m_mcu->space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::airco22_mcu_adc_r),this));
55295529}
55305530
55315531DRIVER_INIT_MEMBER(namcos22_state,propcycl)
r18027r18028
55485548//   pROM[0x22296/4] |= 0x00004e75;
55495549
55505550   namcos22_init(machine(), NAMCOS22_PROP_CYCLE);
5551   m_mcu->space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::propcycle_mcu_adc_r),this));
5552   m_mcu->space(AS_IO)->install_write_handler(M37710_PORT5, M37710_PORT5, write8_delegate(FUNC(namcos22_state::propcycle_mcu_port5_w),this));
5551   m_mcu->space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::propcycle_mcu_adc_r),this));
5552   m_mcu->space(AS_IO).install_write_handler(M37710_PORT5, M37710_PORT5, write8_delegate(FUNC(namcos22_state::propcycle_mcu_port5_w),this));
55535553   install_141_speedup(machine());
55545554}
55555555
r18027r18028
56095609{
56105610   namcos22_init(machine(), NAMCOS22_CYBER_CYCLES);
56115611
5612   m_mcu->space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::cybrcycc_mcu_adc_r),this));
5612   m_mcu->space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::cybrcycc_mcu_adc_r),this));
56135613   install_130_speedup(machine());
56145614
56155615   m_keycus_id = 0x0387;
r18027r18028
56265626{
56275627   namcos22_init(machine(), NAMCOS22_TOKYO_WARS);
56285628
5629   m_mcu->space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::tokyowar_mcu_adc_r),this));
5629   m_mcu->space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::tokyowar_mcu_adc_r),this));
56305630   install_141_speedup(machine());
56315631
56325632   m_keycus_id = 0x01a8;
r18027r18028
56355635DRIVER_INIT_MEMBER(namcos22_state,aquajet)
56365636{
56375637   namcos22_init(machine(), NAMCOS22_AQUA_JET);
5638   m_mcu->space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::aquajet_mcu_adc_r),this));
5638   m_mcu->space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::aquajet_mcu_adc_r),this));
56395639   install_141_speedup(machine());
56405640}
56415641
r18027r18028
56435643{
56445644   namcos22_init(machine(), NAMCOS22_DIRT_DASH);
56455645
5646   m_mcu->space(AS_IO)->install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::cybrcycc_mcu_adc_r),this));
5646   m_mcu->space(AS_IO).install_read_handler(M37710_ADC0_L, M37710_ADC7_H, read8_delegate(FUNC(namcos22_state::cybrcycc_mcu_adc_r),this));
56475647   install_141_speedup(machine());
56485648
56495649   m_keycus_id = 0x01a2;
trunk/src/mame/drivers/pturn.c
r18027r18028
479479
480480void pturn_state::machine_reset()
481481{
482   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
482   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
483483   soundlatch_clear_byte_w(space,0,0);
484484}
485485
r18027r18028
555555DRIVER_INIT_MEMBER(pturn_state,pturn)
556556{
557557   /*
558    machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc0dd, 0xc0dd, FUNC(pturn_protection_r));
559    machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc0db, 0xc0db, FUNC(pturn_protection2_r));
558    machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc0dd, 0xc0dd, FUNC(pturn_protection_r));
559    machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc0db, 0xc0db, FUNC(pturn_protection2_r));
560560    */
561561}
562562
trunk/src/mame/drivers/dec0.c
r18027r18028
422422void slyspy_set_protection_map(running_machine& machine, int type)
423423{
424424   dec0_state *state = machine.driver_data<dec0_state>();
425   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
425   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
426426
427427   deco_bac06_device *tilegen1 = (deco_bac06_device*)state->m_tilegen1;
428428   deco_bac06_device *tilegen2 = (deco_bac06_device*)state->m_tilegen2;
r18027r18028
30433043
30443044DRIVER_INIT_MEMBER(dec0_state,midresb)
30453045{
3046   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00180000, 0x0018000f, read16_delegate(FUNC(dec0_state::dec0_controls_r),this));
3047   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x001a0000, 0x001a000f, read16_delegate(FUNC(dec0_state::dec0_rotary_r),this));
3046   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00180000, 0x0018000f, read16_delegate(FUNC(dec0_state::dec0_controls_r),this));
3047   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x001a0000, 0x001a000f, read16_delegate(FUNC(dec0_state::dec0_rotary_r),this));
30483048
3049   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00180014, 0x00180015, write16_delegate(FUNC(dec0_state::midres_sound_w),this));
3049   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00180014, 0x00180015, write16_delegate(FUNC(dec0_state::midres_sound_w),this));
30503050}
30513051
30523052/******************************************************************************/
trunk/src/mame/drivers/atarig42.c
r18027r18028
786786
787787   m_playfield_base = 0x400;
788788
789   address_space *main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM);
790   m_sloop_base = main->install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this));
791   main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this));
789   address_space &main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM);
790   m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this));
791   main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this));
792792
793793   asic65_config(machine(), ASIC65_ROMBASED);
794794/*
r18027r18028
824824   /* put an RTS there so we don't die */
825825   *(UINT16 *)&memregion("maincpu")->base()[0x80000] = 0x4E75;
826826
827   address_space *main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM);
828   m_sloop_base = main->install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this));
829   main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this));
827   address_space &main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM);
828   m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this));
829   main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this));
830830
831831   asic65_config(machine(), ASIC65_GUARDIANS);
832832/*
trunk/src/mame/drivers/midvunit.c
r18027r18028
17251725   m_adc_shift = 24;
17261726
17271727   /* speedups */
1728   m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
1728   m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
17291729}
17301730DRIVER_INIT_MEMBER(midvunit_state,crusnusa)  { init_crusnusa_common(0xc93e); }
17311731DRIVER_INIT_MEMBER(midvunit_state,crusnu40)  { init_crusnusa_common(0xc957); }
r18027r18028
17381738   m_adc_shift = 16;
17391739
17401740   /* control register is different */
1741   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x994000, 0x994000, write32_delegate(FUNC(midvunit_state::crusnwld_control_w),this));
1741   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x994000, 0x994000, write32_delegate(FUNC(midvunit_state::crusnwld_control_w),this));
17421742
17431743   /* valid values are 450 or 460 */
17441744   midway_serial_pic_init(machine(), 450);
1745   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x991030, 0x991030, read32_delegate(FUNC(midvunit_state::offroadc_serial_status_r),this));
1746   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x996000, 0x996000, read32_delegate(FUNC(midvunit_state::offroadc_serial_data_r),this));
1747   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x996000, 0x996000, write32_delegate(FUNC(midvunit_state::offroadc_serial_data_w),this));
1745   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x991030, 0x991030, read32_delegate(FUNC(midvunit_state::offroadc_serial_status_r),this));
1746   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x996000, 0x996000, read32_delegate(FUNC(midvunit_state::offroadc_serial_data_r),this));
1747   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x996000, 0x996000, write32_delegate(FUNC(midvunit_state::offroadc_serial_data_w),this));
17481748
17491749   /* install strange protection device */
1750   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x9d0000, 0x9d1fff, read32_delegate(FUNC(midvunit_state::bit_data_r),this));
1751   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x9d0000, 0x9d0000, write32_delegate(FUNC(midvunit_state::bit_reset_w),this));
1750   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x9d0000, 0x9d1fff, read32_delegate(FUNC(midvunit_state::bit_data_r),this));
1751   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x9d0000, 0x9d0000, write32_delegate(FUNC(midvunit_state::bit_reset_w),this));
17521752
17531753   /* speedups */
17541754   if (speedup)
1755      m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
1755      m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
17561756}
17571757DRIVER_INIT_MEMBER(midvunit_state,crusnwld)  { init_crusnwld_common(0xd4c0); }
17581758#if 0
r18027r18028
17661766   m_adc_shift = 16;
17671767
17681768   /* control register is different */
1769   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x994000, 0x994000, write32_delegate(FUNC(midvunit_state::crusnwld_control_w),this));
1769   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x994000, 0x994000, write32_delegate(FUNC(midvunit_state::crusnwld_control_w),this));
17701770
17711771   /* valid values are 230 or 234 */
17721772   midway_serial_pic2_init(machine(), 230, 94);
1773   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x991030, 0x991030, read32_delegate(FUNC(midvunit_state::offroadc_serial_status_r),this));
1774   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x996000, 0x996000, read32_delegate(FUNC(midvunit_state::offroadc_serial_data_r),this), write32_delegate(FUNC(midvunit_state::offroadc_serial_data_w),this));
1773   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x991030, 0x991030, read32_delegate(FUNC(midvunit_state::offroadc_serial_status_r),this));
1774   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x996000, 0x996000, read32_delegate(FUNC(midvunit_state::offroadc_serial_data_r),this), write32_delegate(FUNC(midvunit_state::offroadc_serial_data_w),this));
17751775
17761776   /* speedups */
1777   m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x195aa, 0x195aa, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
1777   m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x195aa, 0x195aa, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
17781778}
17791779
17801780
r18027r18028
17991799   midway_serial_pic2_set_default_nvram(default_nvram);
18001800
18011801   /* speedups */
1802   m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2f4c, 0x2f4c, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
1802   m_generic_speedup = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2f4c, 0x2f4c, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
18031803}
18041804
18051805
trunk/src/mame/drivers/pangofun.c
r18027r18028
244244DRIVER_INIT_MEMBER(pangofun_state,pangofun)
245245{
246246   pc_vga_init(machine(), vga_setting, NULL);
247   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
247   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
248248}
249249
250250GAME( 1995, pangofun,  0,   pangofun, pangofun, pangofun_state, pangofun, ROT0, "InfoCube", "Pango Fun (Italy)", GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/mame/drivers/suna16.c
r18027r18028
361361
362362MACHINE_RESET_MEMBER(suna16_state,uballoon)
363363{
364   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
364   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
365365   uballoon_pcm_1_bankswitch_w(space, 0, 0);
366366}
367367
trunk/src/mame/drivers/firebeat.c
r18027r18028
22202220   if(!out2) out2 = lamp_output2_w, out2name = "lamp_output2_w";
22212221   if(!out3) out3 = lamp_output3_w, out3name = "lamp_output3_w";
22222222
2223   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000804, 0x7d000807, out1, out1name);
2224   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000320, 0x7d000323, out2, out2name);
2225   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000324, 0x7d000327, out3, out3name);
2223   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x7d000804, 0x7d000807, out1, out1name);
2224   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x7d000320, 0x7d000323, out2, out2name);
2225   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x7d000324, 0x7d000327, out3, out3name);
22262226}
22272227
22282228static void init_firebeat(running_machine &machine)
trunk/src/mame/drivers/bagman.c
r18027r18028
932932
933933   /* Unmap video enable register, not available on earlier hardware revision(s)
934934       Bagman is supposed to have glitches during screen transitions */
935   machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa003, 0xa003);
935   machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xa003, 0xa003);
936936   *m_video_enable = 1;
937937}
938938
trunk/src/mame/drivers/ghosteo.c
r18027r18028
581581
582582void ghosteo_state::machine_reset()
583583{
584   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x4d000010, 0x4d000013,read32_delegate(FUNC(ghosteo_state::bballoon_speedup_r), this));
584   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4d000010, 0x4d000013,read32_delegate(FUNC(ghosteo_state::bballoon_speedup_r), this));
585585   s3c2410 = machine().device("s3c2410");
586586}
587587
trunk/src/mame/drivers/turbo.c
r18027r18028
567567static TIMER_CALLBACK( delayed_i8255_w )
568568{
569569   turbo_state *state = machine.driver_data<turbo_state>();
570   state->m_i8255_0->write(*state->m_maincpu->space(AS_PROGRAM), param >> 8, param & 0xff);
570   state->m_i8255_0->write(state->m_maincpu->space(AS_PROGRAM), param >> 8, param & 0xff);
571571}
572572
573573
trunk/src/mame/drivers/plygonet.c
r18027r18028
738738   memset(m_dsp56k_bank04_ram, 0, sizeof(m_dsp56k_bank04_ram));
739739
740740   /* The dsp56k occasionally executes out of mapped memory */
741   address_space &space = *machine().device<dsp56k_device>("dsp")->space(AS_PROGRAM);
741   address_space &space = machine().device<dsp56k_device>("dsp")->space(AS_PROGRAM);
742742   m_dsp56k_update_handler = space.set_direct_update_handler(direct_update_delegate(FUNC(polygonet_state::plygonet_dsp56k_direct_handler), this));
743743
744744    /* save states */
trunk/src/mame/drivers/progolf.c
r18027r18028
503503DRIVER_INIT_MEMBER(progolf_state,progolf)
504504{
505505   int A;
506   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
506   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
507507   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
508508   UINT8* decrypted = auto_alloc_array(machine(), UINT8, 0x10000);
509509
r18027r18028
517517DRIVER_INIT_MEMBER(progolf_state,progolfa)
518518{
519519   int A;
520   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
520   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
521521   UINT8 *rom = machine().root_device().memregion("maincpu")->base();
522522   UINT8* decrypted = auto_alloc_array(machine(), UINT8, 0x10000);
523523
trunk/src/mame/drivers/segag80v.c
r18027r18028
202202   m_mainram[decrypt_offset(space, offset)] = data;
203203}
204204
205WRITE8_MEMBER(segag80v_state::usb_ram_w){ sega_usb_ram_w(m_usb, space, decrypt_offset(*machine().device("maincpu")->memory().space(AS_PROGRAM), offset), data); }
205WRITE8_MEMBER(segag80v_state::usb_ram_w){ sega_usb_ram_w(m_usb, space, decrypt_offset(machine().device("maincpu")->memory().space(AS_PROGRAM), offset), data); }
206206WRITE8_MEMBER(segag80v_state::vectorram_w)
207207{
208208   m_vectorram[decrypt_offset(space, offset)] = data;
r18027r18028
12871287
12881288DRIVER_INIT_MEMBER(segag80v_state,elim2)
12891289{
1290   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1290   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
12911291
12921292   /* configure security */
12931293   m_decrypt = segag80_security(70);
12941294
12951295   /* configure sound */
12961296   m_usb = NULL;
1297   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::elim1_sh_w),this));
1298   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::elim2_sh_w),this));
1297   iospace.install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::elim1_sh_w),this));
1298   iospace.install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::elim2_sh_w),this));
12991299}
13001300
13011301
13021302DRIVER_INIT_MEMBER(segag80v_state,elim4)
13031303{
1304   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1304   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
13051305
13061306   /* configure security */
13071307   m_decrypt = segag80_security(76);
13081308
13091309   /* configure sound */
13101310   m_usb = NULL;
1311   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::elim1_sh_w),this));
1312   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::elim2_sh_w),this));
1311   iospace.install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::elim1_sh_w),this));
1312   iospace.install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::elim2_sh_w),this));
13131313
13141314   /* configure inputs */
1315   iospace->install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1316   iospace->install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::elim4_input_r),this));
1315   iospace.install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1316   iospace.install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::elim4_input_r),this));
13171317}
13181318
13191319
13201320DRIVER_INIT_MEMBER(segag80v_state,spacfury)
13211321{
1322   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1322   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
13231323
13241324   /* configure security */
13251325   m_decrypt = segag80_security(64);
13261326
13271327   /* configure sound */
13281328   m_usb = NULL;
1329   iospace->install_legacy_write_handler(*machine().device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
1330   iospace->install_legacy_write_handler(*machine().device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
1331   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::spacfury1_sh_w),this));
1332   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::spacfury2_sh_w),this));
1329   iospace.install_legacy_write_handler(*machine().device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
1330   iospace.install_legacy_write_handler(*machine().device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
1331   iospace.install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::spacfury1_sh_w),this));
1332   iospace.install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::spacfury2_sh_w),this));
13331333}
13341334
13351335
13361336DRIVER_INIT_MEMBER(segag80v_state,zektor)
13371337{
1338   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1338   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
13391339   device_t *ay = machine().device("aysnd");
13401340
13411341   /* configure security */
r18027r18028
13431343
13441344   /* configure sound */
13451345   m_usb = NULL;
1346   iospace->install_legacy_write_handler(*machine().device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
1347   iospace->install_legacy_write_handler(*machine().device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
1348   iospace->install_legacy_write_handler(*ay, 0x3c, 0x3d, FUNC(ay8910_address_data_w));
1349   iospace->install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::zektor1_sh_w),this));
1350   iospace->install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::zektor2_sh_w),this));
1346   iospace.install_legacy_write_handler(*machine().device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
1347   iospace.install_legacy_write_handler(*machine().device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
1348   iospace.install_legacy_write_handler(*ay, 0x3c, 0x3d, FUNC(ay8910_address_data_w));
1349   iospace.install_write_handler(0x3e, 0x3e, write8_delegate(FUNC(segag80v_state::zektor1_sh_w),this));
1350   iospace.install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(segag80v_state::zektor2_sh_w),this));
13511351
13521352   /* configure inputs */
1353   iospace->install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1354   iospace->install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::spinner_input_r),this));
1353   iospace.install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1354   iospace.install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::spinner_input_r),this));
13551355}
13561356
13571357
13581358DRIVER_INIT_MEMBER(segag80v_state,tacscan)
13591359{
1360   address_space *pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1361   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1360   address_space &pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1361   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
13621362
13631363   /* configure security */
13641364   m_decrypt = segag80_security(76);
13651365
13661366   /* configure sound */
13671367   m_usb = machine().device("usbsnd");
1368   iospace->install_legacy_readwrite_handler(*m_usb, 0x3f, 0x3f, FUNC(sega_usb_status_r), FUNC(sega_usb_data_w));
1369   pgmspace->install_legacy_read_handler(*m_usb, 0xd000, 0xdfff, FUNC(sega_usb_ram_r));
1370   pgmspace->install_write_handler(0xd000, 0xdfff, write8_delegate(FUNC(segag80v_state::usb_ram_w),this));
1368   iospace.install_legacy_readwrite_handler(*m_usb, 0x3f, 0x3f, FUNC(sega_usb_status_r), FUNC(sega_usb_data_w));
1369   pgmspace.install_legacy_read_handler(*m_usb, 0xd000, 0xdfff, FUNC(sega_usb_ram_r));
1370   pgmspace.install_write_handler(0xd000, 0xdfff, write8_delegate(FUNC(segag80v_state::usb_ram_w),this));
13711371
13721372   /* configure inputs */
1373   iospace->install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1374   iospace->install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::spinner_input_r),this));
1373   iospace.install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1374   iospace.install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::spinner_input_r),this));
13751375}
13761376
13771377
13781378DRIVER_INIT_MEMBER(segag80v_state,startrek)
13791379{
1380   address_space *pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1381   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1380   address_space &pgmspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
1381   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
13821382
13831383   /* configure security */
13841384   m_decrypt = segag80_security(64);
13851385
13861386   /* configure sound */
13871387   m_usb = machine().device("usbsnd");
1388   iospace->install_legacy_write_handler(*machine().device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
1389   iospace->install_legacy_write_handler(*machine().device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
1388   iospace.install_legacy_write_handler(*machine().device("segaspeech"), 0x38, 0x38, FUNC(sega_speech_data_w));
1389   iospace.install_legacy_write_handler(*machine().device("segaspeech"), 0x3b, 0x3b, FUNC(sega_speech_control_w));
13901390
1391   iospace->install_legacy_readwrite_handler(*m_usb, 0x3f, 0x3f, FUNC(sega_usb_status_r), FUNC(sega_usb_data_w));
1392   pgmspace->install_legacy_read_handler(*m_usb, 0xd000, 0xdfff, FUNC(sega_usb_ram_r));
1393   pgmspace->install_write_handler(0xd000, 0xdfff, write8_delegate(FUNC(segag80v_state::usb_ram_w),this));
1391   iospace.install_legacy_readwrite_handler(*m_usb, 0x3f, 0x3f, FUNC(sega_usb_status_r), FUNC(sega_usb_data_w));
1392   pgmspace.install_legacy_read_handler(*m_usb, 0xd000, 0xdfff, FUNC(sega_usb_ram_r));
1393   pgmspace.install_write_handler(0xd000, 0xdfff, write8_delegate(FUNC(segag80v_state::usb_ram_w),this));
13941394
13951395   /* configure inputs */
1396   iospace->install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1397   iospace->install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::spinner_input_r),this));
1396   iospace.install_write_handler(0xf8, 0xf8, write8_delegate(FUNC(segag80v_state::spinner_select_w),this));
1397   iospace.install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(segag80v_state::spinner_input_r),this));
13981398}
13991399
14001400
trunk/src/mame/drivers/astrocde.c
r18027r18028
421421   int bank = (data >> 5) & 3;
422422
423423   /* this is accessed from I/O &space but modifies program &space, so we normalize here */
424   address_space *prog_space = space.device().memory().space(AS_PROGRAM);
424   address_space &prog_space = space.device().memory().space(AS_PROGRAM);
425425
426426   /* remember the banking bits for save state support */
427427   m_profpac_bank = data;
428428
429429   /* set the main banking */
430   prog_space->install_read_bank(0x4000, 0xbfff, "bank1");
430   prog_space.install_read_bank(0x4000, 0xbfff, "bank1");
431431   membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + 0x8000 * bank);
432432
433433   /* bank 0 reads video RAM in the 4000-7FFF range */
434434   if (bank == 0)
435      prog_space->install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r),this));
435      prog_space.install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r),this));
436436
437437   /* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */
438438   if ((data & 0x80) && memregion("user2")->base() != NULL)
r18027r18028
443443      /* if the bank is in range, map the appropriate bank */
444444      if (bank < 0x28)
445445      {
446         prog_space->install_read_bank(0x4000, 0x7fff, "bank2");
446         prog_space.install_read_bank(0x4000, 0x7fff, "bank2");
447447         membank("bank2")->set_base(machine().root_device().memregion("user2")->base() + 0x4000 * bank);
448448      }
449449      else
450         prog_space->unmap_read(0x4000, 0x7fff);
450         prog_space.unmap_read(0x4000, 0x7fff);
451451   }
452452}
453453
r18027r18028
455455static void profbank_banksw_restore(running_machine &machine)
456456{
457457   astrocde_state *state = machine.driver_data<astrocde_state>();
458   address_space &space = *machine.device("maincpu")->memory().space(AS_IO);
458   address_space &space = machine.device("maincpu")->memory().space(AS_IO);
459459
460460   state->profpac_banksw_w(space, 0, state->m_profpac_bank);
461461}
r18027r18028
17341734DRIVER_INIT_MEMBER(astrocde_state,seawolf2)
17351735{
17361736   m_video_config = 0x00;
1737   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x40, 0x40, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_1_w),this));
1738   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x41, 0x41, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_2_w),this));
1739   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x42, 0x43, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_lamps_w),this));
1737   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x40, 0x40, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_1_w),this));
1738   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x41, 0x41, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_2_w),this));
1739   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x42, 0x43, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_lamps_w),this));
17401740}
17411741
17421742
17431743DRIVER_INIT_MEMBER(astrocde_state,ebases)
17441744{
17451745   m_video_config = AC_SOUND_PRESENT;
1746   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x20, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_coin_w),this));
1747   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x28, 0x28, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_trackball_select_w),this));
1746   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x20, 0x20, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_coin_w),this));
1747   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x28, 0x28, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_trackball_select_w),this));
17481748}
17491749
17501750
17511751DRIVER_INIT_MEMBER(astrocde_state,spacezap)
17521752{
17531753   m_video_config = AC_SOUND_PRESENT | AC_MONITOR_BW;
1754   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x13, 0x13, 0x03ff, 0xff00, read8_delegate(FUNC(astrocde_state::spacezap_io_r),this));
1754   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x13, 0x13, 0x03ff, 0xff00, read8_delegate(FUNC(astrocde_state::spacezap_io_r),this));
17551755}
17561756
17571757
17581758DRIVER_INIT_MEMBER(astrocde_state,wow)
17591759{
17601760   m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS;
1761   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::wow_io_r),this));
1762   machine().device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(wow_speech_r));
1761   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::wow_io_r),this));
1762   machine().device("maincpu")->memory().space(AS_IO).install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(wow_speech_r));
17631763}
17641764
17651765
17661766DRIVER_INIT_MEMBER(astrocde_state,gorf)
17671767{
17681768   m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS;
1769   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_1_r),this));
1770   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x16, 0x16, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_2_r),this));
1771   machine().device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(gorf_speech_r));
1769   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_1_r),this));
1770   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x16, 0x16, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_2_r),this));
1771   machine().device("maincpu")->memory().space(AS_IO).install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(gorf_speech_r));
17721772}
17731773
17741774
17751775DRIVER_INIT_MEMBER(astrocde_state,robby)
17761776{
17771777   m_video_config = AC_SOUND_PRESENT;
1778   machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::robby_io_r),this));
1778   machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::robby_io_r),this));
17791779}
17801780
17811781
17821782DRIVER_INIT_MEMBER(astrocde_state,profpac)
17831783{
1784   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1784   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
17851785
17861786   m_video_config = AC_SOUND_PRESENT;
1787   iospace->install_read_handler(0x14, 0x14, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_1_r),this));
1788   iospace->install_read_handler(0x15, 0x15, 0x77ff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_2_r),this));
1787   iospace.install_read_handler(0x14, 0x14, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_1_r),this));
1788   iospace.install_read_handler(0x15, 0x15, 0x77ff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_2_r),this));
17891789
17901790   /* reset banking */
1791   profpac_banksw_w(*iospace, 0, 0);
1791   profpac_banksw_w(iospace, 0, 0);
17921792   machine().save().register_postload(save_prepost_delegate(FUNC(profbank_banksw_restore), &machine()));
17931793}
17941794
17951795
17961796DRIVER_INIT_MEMBER(astrocde_state,demndrgn)
17971797{
1798   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1798   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
17991799
18001800   m_video_config = 0x00;
1801   iospace->install_read_handler(0x14, 0x14, 0x1fff, 0xff00, read8_delegate(FUNC(astrocde_state::demndrgn_io_r),this));
1802   iospace->install_read_port(0x1c, 0x1c, 0x0000, 0xff00, "FIREX");
1803   iospace->install_read_port(0x1d, 0x1d, 0x0000, 0xff00, "FIREY");
1804   iospace->install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::demndrgn_sound_w),this));
1801   iospace.install_read_handler(0x14, 0x14, 0x1fff, 0xff00, read8_delegate(FUNC(astrocde_state::demndrgn_io_r),this));
1802   iospace.install_read_port(0x1c, 0x1c, 0x0000, 0xff00, "FIREX");
1803   iospace.install_read_port(0x1d, 0x1d, 0x0000, 0xff00, "FIREY");
1804   iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::demndrgn_sound_w),this));
18051805
18061806   /* reset banking */
1807   profpac_banksw_w(*iospace, 0, 0);
1807   profpac_banksw_w(iospace, 0, 0);
18081808   machine().save().register_postload(save_prepost_delegate(FUNC(profbank_banksw_restore), &machine()));
18091809}
18101810
18111811
18121812DRIVER_INIT_MEMBER(astrocde_state,tenpindx)
18131813{
1814   address_space *iospace = machine().device("maincpu")->memory().space(AS_IO);
1814   address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
18151815
18161816   m_video_config = 0x00;
1817   iospace->install_read_port(0x60, 0x60, 0x0000, 0xff00, "P60");
1818   iospace->install_read_port(0x61, 0x61, 0x0000, 0xff00, "P61");
1819   iospace->install_read_port(0x62, 0x62, 0x0000, 0xff00, "P62");
1820   iospace->install_read_port(0x63, 0x63, 0x0000, 0xff00, "P63");
1821   iospace->install_read_port(0x64, 0x64, 0x0000, 0xff00, "P64");
1822   iospace->install_write_handler(0x65, 0x66, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lamp_w),this));
1823   iospace->install_write_handler(0x67, 0x67, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_counter_w),this));
1824   iospace->install_write_handler(0x68, 0x68, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lights_w),this));
1825   iospace->install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_sound_w),this));
1817   iospace.install_read_port(0x60, 0x60, 0x0000, 0xff00, "P60");
1818   iospace.install_read_port(0x61, 0x61, 0x0000, 0xff00, "P61");
1819   iospace.install_read_port(0x62, 0x62, 0x0000, 0xff00, "P62");
1820   iospace.install_read_port(0x63, 0x63, 0x0000, 0xff00, "P63");
1821   iospace.install_read_port(0x64, 0x64, 0x0000, 0xff00, "P64");
1822   iospace.install_write_handler(0x65, 0x66, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lamp_w),this));
1823   iospace.install_write_handler(0x67, 0x67, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_counter_w),this));
1824   iospace.install_write_handler(0x68, 0x68, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lights_w),this));
1825   iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_sound_w),this));
18261826
18271827   /* reset banking */
1828   profpac_banksw_w(*iospace, 0, 0);
1828   profpac_banksw_w(iospace, 0, 0);
18291829   machine().save().register_postload(save_prepost_delegate(FUNC(profbank_banksw_restore), &machine()));
18301830}
18311831
trunk/src/mame/drivers/galaga.c
r18027r18028
889889static void bosco_latch_reset(running_machine &machine)
890890{
891891   galaga_state *state = machine.driver_data<galaga_state>();
892   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
892   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
893893   int i;
894894
895895   /* Reset all latches */
r18027r18028
33123312   DRIVER_INIT_CALL(galaga);
33133313
33143314   /* Gatsbee has a larger character ROM, we need a handler for banking */
3315   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1000, 0x1000, write8_delegate(FUNC(galaga_state::gatsbee_bank_w),this));
3315   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1000, 0x1000, write8_delegate(FUNC(galaga_state::gatsbee_bank_w),this));
33163316}
33173317
33183318
r18027r18028
33533353DRIVER_INIT_MEMBER(xevious_state,battles)
33543354{
33553355   /* replace the Namco I/O handlers with interface to the 4th CPU */
3356   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x7000, 0x700f, FUNC(battles_customio_data0_r), FUNC(battles_customio_data0_w) );
3357   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x7100, 0x7100, FUNC(battles_customio0_r), FUNC(battles_customio0_w) );
3356   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7000, 0x700f, FUNC(battles_customio_data0_r), FUNC(battles_customio_data0_w) );
3357   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7100, 0x7100, FUNC(battles_customio0_r), FUNC(battles_customio0_w) );
33583358
33593359   DRIVER_INIT_CALL(xevious);
33603360}
trunk/src/mame/drivers/8080bw.c
r18027r18028
25322532MACHINE_RESET_MEMBER(_8080bw_state,invmulti)
25332533{
25342534
2535   invmulti_bank_w(*m_maincpu->space(AS_PROGRAM), 0, 0);
2535   invmulti_bank_w(m_maincpu->space(AS_PROGRAM), 0, 0);
25362536
25372537   MACHINE_RESET_CALL_MEMBER(mw8080bw);
25382538}
trunk/src/mame/drivers/1943.c
r18027r18028
650650   DRIVER_INIT_CALL(1943);
651651   //it expects 0x00 to be returned from the protection reads because the protection has been patched out.
652652   //AM_RANGE(0xc007, 0xc007) AM_READ(c1943_protection_r)
653   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc007, 0xc007, read8_delegate(FUNC(_1943_state::_1943b_c007_r),this));
653   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc007, 0xc007, read8_delegate(FUNC(_1943_state::_1943b_c007_r),this));
654654
655655}
656656
trunk/src/mame/drivers/psikyo4.c
r18027r18028
960960   set_hotgmck_pcm_bank(machine, 0);
961961   set_hotgmck_pcm_bank(machine, 1);
962962
963   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x5800008, 0x580000b, write32_delegate(FUNC(psikyo4_state::hotgmck_pcm_bank_w),state));
963   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x5800008, 0x580000b, write32_delegate(FUNC(psikyo4_state::hotgmck_pcm_bank_w),state));
964964   machine.save().register_postload(save_prepost_delegate(FUNC(hotgmck_pcm_bank_postload), &machine));
965965}
966966
trunk/src/mame/drivers/taito_x.c
r18027r18028
12691269
12701270DRIVER_INIT_MEMBER(taitox_state,kyustrkr)
12711271{
1272   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x900000, 0x90000f, write16_delegate(FUNC(taitox_state::kyustrkr_input_w),this));
1272   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x900000, 0x90000f, write16_delegate(FUNC(taitox_state::kyustrkr_input_w),this));
12731273}
12741274
12751275
trunk/src/mame/drivers/jalmah.c
r18027r18028
730730static void daireika_palette_dma(running_machine &machine, UINT16 val)
731731{
732732   //jalmah_state *state = machine.driver_data<jalmah_state>();
733   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
733   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
734734   UINT32 index_1, index_2, src_addr, tmp_addr;
735735   /*a0=301c0+jm_shared_ram[0x540/2] & 0xf00 */
736736   /*a1=88000*/
r18027r18028
24212421
24222422DRIVER_INIT_MEMBER(jalmah_state,urashima)
24232423{
2424   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::urashima_mcu_r), this));
2425   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::urashima_mcu_w), this));
2424   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::urashima_mcu_r), this));
2425   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::urashima_mcu_w), this));
24262426
24272427   m_mcu_prg = 0x12;
24282428}
24292429
24302430DRIVER_INIT_MEMBER(jalmah_state,daireika)
24312431{
2432   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::daireika_mcu_r), this));
2433   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::daireika_mcu_w), this));
2432   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::daireika_mcu_r), this));
2433   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::daireika_mcu_w), this));
24342434
24352435   m_mcu_prg = 0x11;
24362436}
24372437
24382438DRIVER_INIT_MEMBER(jalmah_state,mjzoomin)
24392439{
2440   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::mjzoomin_mcu_r), this));
2441   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::mjzoomin_mcu_w), this));
2440   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::mjzoomin_mcu_r), this));
2441   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::mjzoomin_mcu_w), this));
24422442
24432443   m_mcu_prg = 0x13;
24442444}
24452445
24462446DRIVER_INIT_MEMBER(jalmah_state,kakumei)
24472447{
2448   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this));
2448   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this));
24492449   m_mcu_prg = 0x21;
24502450}
24512451
24522452DRIVER_INIT_MEMBER(jalmah_state,kakumei2)
24532453{
2454   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this));
2454   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this));
24552455
24562456   m_mcu_prg = 0x22;
24572457}
24582458
24592459DRIVER_INIT_MEMBER(jalmah_state,suchipi)
24602460{
2461   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::suchipi_mcu_r), this));
2461   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::suchipi_mcu_r), this));
24622462
24632463   m_mcu_prg = 0x23;
24642464}
trunk/src/mame/drivers/tx1.c
r18027r18028
8888
8989READ16_MEMBER(tx1_state::z80_shared_r)
9090{
91   address_space *cpu2space = machine().device("audio_cpu")->memory().space(AS_PROGRAM);
92   return cpu2space->read_byte(offset);
91   address_space &cpu2space = machine().device("audio_cpu")->memory().space(AS_PROGRAM);
92   return cpu2space.read_byte(offset);
9393}
9494
9595WRITE16_MEMBER(tx1_state::z80_shared_w)
9696{
97   address_space *cpu2space = machine().device("audio_cpu")->memory().space(AS_PROGRAM);
98   cpu2space->write_byte(offset, data & 0xff);
97   address_space &cpu2space = machine().device("audio_cpu")->memory().space(AS_PROGRAM);
98   cpu2space.write_byte(offset, data & 0xff);
9999}
100100
101101
trunk/src/mame/drivers/pingpong.c
r18027r18028
598598      ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
599599
600600   /* questions banking handlers */
601   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4000, 0x4000, write8_delegate(FUNC(pingpong_state::cashquiz_question_bank_high_w),this));
602   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4001, 0x4001, write8_delegate(FUNC(pingpong_state::cashquiz_question_bank_low_w),this));
601   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4000, 0x4000, write8_delegate(FUNC(pingpong_state::cashquiz_question_bank_high_w),this));
602   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4001, 0x4001, write8_delegate(FUNC(pingpong_state::cashquiz_question_bank_low_w),this));
603603
604604   // 8 independents banks for questions
605   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x50ff, "bank1");
606   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5100, 0x51ff, "bank2");
607   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5200, 0x52ff, "bank3");
608   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5300, 0x53ff, "bank4");
609   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5400, 0x54ff, "bank5");
610   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5500, 0x55ff, "bank6");
611   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5600, 0x56ff, "bank7");
612   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5700, 0x57ff, "bank8");
605   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x50ff, "bank1");
606   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5100, 0x51ff, "bank2");
607   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5200, 0x52ff, "bank3");
608   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5300, 0x53ff, "bank4");
609   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5400, 0x54ff, "bank5");
610   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5500, 0x55ff, "bank6");
611   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5600, 0x56ff, "bank7");
612   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5700, 0x57ff, "bank8");
613613
614614   // setup default banks
615615   membank("bank1")->set_base(memregion("user1")->base() + 0x100*0 );
trunk/src/mame/drivers/harddriv.c
r18027r18028
39993999   /* install handlers for the compact driving games' inputs */
40004000   if (compact_inputs)
40014001   {
4002      state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400001, FUNC(hdc68k_wheel_r));
4003      state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x408000, 0x408001, FUNC(hdc68k_wheel_edge_reset_w));
4004      state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hdc68k_port1_r));
4002      state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400001, FUNC(hdc68k_wheel_r));
4003      state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x408000, 0x408001, FUNC(hdc68k_wheel_edge_reset_w));
4004      state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hdc68k_port1_r));
40054005   }
40064006}
40074007
r18027r18028
40124012   harddriv_state *state = machine.driver_data<harddriv_state>();
40134013
40144014   /* install ADSP program RAM */
4015   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_adsp_program_r), FUNC(hd68k_adsp_program_w));
4015   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_adsp_program_r), FUNC(hd68k_adsp_program_w));
40164016
40174017   /* install ADSP data RAM */
4018   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w));
4018   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w));
40194019
40204020   /* install ADSP serial buffer RAM */
4021   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x810000, 0x813fff, FUNC(hd68k_adsp_buffer_r), FUNC(hd68k_adsp_buffer_w));
4021   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x810000, 0x813fff, FUNC(hd68k_adsp_buffer_r), FUNC(hd68k_adsp_buffer_w));
40224022
40234023   /* install ADSP control locations */
4024   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x818000, 0x81801f, FUNC(hd68k_adsp_control_w));
4025   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x818060, 0x81807f, FUNC(hd68k_adsp_irq_clear_w));
4026   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x838000, 0x83ffff, FUNC(hd68k_adsp_irq_state_r));
4024   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x818000, 0x81801f, FUNC(hd68k_adsp_control_w));
4025   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x818060, 0x81807f, FUNC(hd68k_adsp_irq_clear_w));
4026   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x838000, 0x83ffff, FUNC(hd68k_adsp_irq_state_r));
40274027}
40284028
40294029
r18027r18028
40334033   harddriv_state *state = machine.driver_data<harddriv_state>();
40344034
40354035   /* install ADSP program RAM */
4036   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_ds3_program_r), FUNC(hd68k_ds3_program_w));
4036   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_ds3_program_r), FUNC(hd68k_ds3_program_w));
40374037
40384038   /* install ADSP data RAM */
4039   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w));
4040   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x80c000, 0x80dfff, FUNC(hdds3_special_r), FUNC(hdds3_special_w));
4039   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w));
4040   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x80c000, 0x80dfff, FUNC(hdds3_special_r), FUNC(hdds3_special_w));
40414041
40424042   /* install ADSP control locations */
4043   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_r));
4044   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x820800, 0x820fff, FUNC(hd68k_ds3_girq_state_r));
4045   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_w));
4046   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x821000, 0x8217ff, FUNC(hd68k_adsp_irq_clear_w));
4047   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_r));
4048   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x822800, 0x822fff, FUNC(hd68k_ds3_sirq_state_r));
4049   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_w));
4050   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x823800, 0x823fff, FUNC(hd68k_ds3_control_w));
4043   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_r));
4044   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x820800, 0x820fff, FUNC(hd68k_ds3_girq_state_r));
4045   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_w));
4046   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x821000, 0x8217ff, FUNC(hd68k_adsp_irq_clear_w));
4047   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_r));
4048   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x822800, 0x822fff, FUNC(hd68k_ds3_sirq_state_r));
4049   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_w));
4050   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x823800, 0x823fff, FUNC(hd68k_ds3_control_w));
40514051
40524052   /* if we have a sound DSP, boot it */
40534053   if (state->m_ds4cpu1 != NULL)
r18027r18028
41324132   UINT8 *usr3 = state->memregion("user3")->base();
41334133
41344134   /* install ASIC61 */
4135   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x85c000, 0x85c7ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w));
4135   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x85c000, 0x85c7ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w));
41364136
41374137   /* install control registers */
4138   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x85c800, 0x85c81f, FUNC(hd68k_dsk_control_w));
4138   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x85c800, 0x85c81f, FUNC(hd68k_dsk_control_w));
41394139
41404140   /* install extra RAM */
4141   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x900000, 0x90ffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w));
4141   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x900000, 0x90ffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w));
41424142   state->m_dsk_ram = (UINT16 *)(usr3 + 0x40000);
41434143
41444144   /* install extra ZRAM */
4145   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x910000, 0x910fff, FUNC(hd68k_dsk_zram_r), FUNC(hd68k_dsk_zram_w));
4145   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x910000, 0x910fff, FUNC(hd68k_dsk_zram_r), FUNC(hd68k_dsk_zram_w));
41464146   state->m_dsk_zram = (UINT16 *)(usr3 + 0x50000);
41474147
41484148   /* install ASIC65 */
4149   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x914000, 0x917fff, FUNC(asic65_data_w));
4150   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x914000, 0x917fff, FUNC(asic65_r));
4151   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x918000, 0x91bfff, FUNC(asic65_io_r));
4149   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x914000, 0x917fff, FUNC(asic65_data_w));
4150   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x914000, 0x917fff, FUNC(asic65_r));
4151   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x918000, 0x91bfff, FUNC(asic65_io_r));
41524152
41534153   /* install extra ROM */
4154   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x940000, 0x9fffff, FUNC(hd68k_dsk_small_rom_r));
4154   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x940000, 0x9fffff, FUNC(hd68k_dsk_small_rom_r));
41554155   state->m_dsk_rom = (UINT16 *)(usr3 + 0x00000);
41564156
41574157   /* set up the ASIC65 */
r18027r18028
41664166   UINT8 *usr3 = state->memregion("user3")->base();
41674167
41684168   /* install ASIC65 */
4169   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x824000, 0x824003, FUNC(asic65_data_w));
4170   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x824000, 0x824003, FUNC(asic65_r));
4171   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x825000, 0x825001, FUNC(asic65_io_r));
4169   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x824000, 0x824003, FUNC(asic65_data_w));
4170   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x824000, 0x824003, FUNC(asic65_r));
4171   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x825000, 0x825001, FUNC(asic65_io_r));
41724172
41734173   /* install ASIC61 */
4174   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x827000, 0x8277ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w));
4174   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x827000, 0x8277ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w));
41754175
41764176   /* install control registers */
4177   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x827800, 0x82781f, FUNC(hd68k_dsk_control_w));
4177   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x827800, 0x82781f, FUNC(hd68k_dsk_control_w));
41784178
41794179   /* install extra RAM */
4180   state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x880000, 0x8bffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w));
4180   state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x880000, 0x8bffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w));
41814181   state->m_dsk_ram = (UINT16 *)(usr3 + 0x100000);
41824182
41834183   /* install extra ROM */
4184   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x900000, 0x9fffff, FUNC(hd68k_dsk_rom_r));
4184   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x900000, 0x9fffff, FUNC(hd68k_dsk_rom_r));
41854185   state->m_dsk_rom = (UINT16 *)(usr3 + 0x000000);
41864186
41874187   /* set up the ASIC65 */
r18027r18028
41954195   harddriv_state *state = machine.driver_data<harddriv_state>();
41964196
41974197   /* install ASIC65 */
4198   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x900000, 0x900003, FUNC(asic65_data_w));
4199   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x900000, 0x900003, FUNC(asic65_r));
4200   state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x901000, 0x910001, FUNC(asic65_io_r));
4198   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x900000, 0x900003, FUNC(asic65_data_w));
4199   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x900000, 0x900003, FUNC(asic65_r));
4200   state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x901000, 0x910001, FUNC(asic65_io_r));
42014201
42024202   /* set up the ASIC65 */
42034203   asic65_config(machine, ASIC65_STEELTAL);
42044204
42054205   /* install DSPCOM control */
4206   state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x904000, 0x90401f, FUNC(hddspcom_control_w));
4206   state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x904000, 0x90401f, FUNC(hddspcom_control_w));
42074207}
42084208
42094209
r18027r18028
42154215   hdsnd_init(machine);
42164216
42174217   /* install sound handlers */
4218   state->m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x840000, 0x840001, read16_delegate(FUNC(harddriv_state::hd68k_snd_data_r),state), write16_delegate(FUNC(harddriv_state::hd68k_snd_data_w),state));
4219   state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x844000, 0x844001, read16_delegate(FUNC(harddriv_state::hd68k_snd_status_r),state));
4220   state->m_maincpu->space(AS_PROGRAM)->install_write_handler(0x84c000, 0x84c001, write16_delegate(FUNC(harddriv_state::hd68k_snd_reset_w),state));
4218   state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x840000, 0x840001, read16_delegate(FUNC(harddriv_state::hd68k_snd_data_r),state), write16_delegate(FUNC(harddriv_state::hd68k_snd_data_w),state));
4219   state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x844000, 0x844001, read16_delegate(FUNC(harddriv_state::hd68k_snd_status_r),state));
4220   state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x84c000, 0x84c001, write16_delegate(FUNC(harddriv_state::hd68k_snd_reset_w),state));
42214221}
42224222
42234223
r18027r18028
42384238   init_driver_sound(machine());
42394239
42404240   /* set up gsp speedup handler */
4241   m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w));
4242   m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w));
4243   m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r));
4241   m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w));
4242   m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w));
4243   m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r));
42444244   m_gsp_speedup_pc = 0xffc00f10;
42454245
42464246   /* set up msp speedup handler */
4247   m_msp_speedup_addr = m_msp->space(AS_PROGRAM)->install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w));
4248   m_msp->space(AS_PROGRAM)->install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r));
4247   m_msp_speedup_addr = m_msp->space(AS_PROGRAM).install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w));
4248   m_msp->space(AS_PROGRAM).install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r));
42494249   m_msp_speedup_pc = 0x00723b00;
42504250
42514251   /* set up adsp speedup handlers */
4252   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4252   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
42534253}
42544254
42554255
r18027r18028
42624262   init_driver_sound(machine());
42634263
42644264   /* set up gsp speedup handler */
4265   m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w));
4266   m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w));
4267   m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r));
4265   m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w));
4266   m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w));
4267   m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r));
42684268   m_gsp_speedup_pc = 0xfff40ff0;
42694269
42704270   /* set up msp speedup handler */
4271   m_msp_speedup_addr = m_msp->space(AS_PROGRAM)->install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w));
4272   m_msp->space(AS_PROGRAM)->install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r));
4271   m_msp_speedup_addr = m_msp->space(AS_PROGRAM).install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w));
4272   m_msp->space(AS_PROGRAM).install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r));
42734273   m_msp_speedup_pc = 0x00723b00;
42744274
42754275   /* set up adsp speedup handlers */
4276   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4276   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
42774277}
42784278
42794279
r18027r18028
42864286   atarijsa_init(machine(), "IN0", 0x0020);
42874287
42884288   /* set up gsp speedup handler */
4289   m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w));
4290   m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w));
4291   m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r));
4289   m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w));
4290   m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w));
4291   m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r));
42924292   m_gsp_speedup_pc = 0xfff41070;
42934293
42944294   /* set up adsp speedup handlers */
4295   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4295   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
42964296}
42974297
42984298
r18027r18028
43074307
43084308   /* set up the slapstic */
43094309   slapstic_init(machine(), 117);
4310   m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w));
4310   m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w));
43114311
43124312   /* synchronization */
4313   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w));
4314   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w));
4313   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w));
4314   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w));
43154315
43164316   /* set up adsp speedup handlers */
4317   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4317   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
43184318}
43194319
43204320
r18027r18028
43304330
43314331   /* set up the slapstic */
43324332   slapstic_init(machine, 117);
4333   state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w));
4333   state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w));
43344334
43354335   /* synchronization */
4336   state->m_rddsp32_sync[0] = state->m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w));
4337   state->m_rddsp32_sync[1] = state->m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w));
4336   state->m_rddsp32_sync[0] = state->m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w));
4337   state->m_rddsp32_sync[1] = state->m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w));
43384338
43394339   /* set up protection hacks */
4340   state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(gsp_protection, gsp_protection + 0x0f, FUNC(hdgsp_protection_w));
4340   state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM).install_legacy_write_handler(gsp_protection, gsp_protection + 0x0f, FUNC(hdgsp_protection_w));
43414341
43424342   /* set up gsp speedup handler */
4343   state->m_gsp_speedup_addr[0] = state->m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_w));
4344   state->m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_r));
4343   state->m_gsp_speedup_addr[0] = state->m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_w));
4344   state->m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_r));
43454345   state->m_gsp_speedup_pc = 0xfff43a00;
43464346
43474347   /* set up adsp speedup handlers */
4348   state->m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4348   state->m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
43494349}
43504350
43514351DRIVER_INIT_MEMBER(harddriv_state,racedrivc) { racedrivc_init_common(machine(), 0xfff95cd0); }
r18027r18028
43574357   /* this unpleasantness prevents racedrivb1 and racedrivg1 from crashing MAME during boot */
43584358   /* both clear the DSP32C's RAM and then release it from reset, causing it to run through */
43594359   /* its address space recursively executing instructions */
4360   m_dsp32->space(AS_PROGRAM)->install_read_handler(0x002000, 0x5fffff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this));
4361   m_dsp32->space(AS_PROGRAM)->install_read_handler(0x640000, 0xfff7ff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this));
4360   m_dsp32->space(AS_PROGRAM).install_read_handler(0x002000, 0x5fffff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this));
4361   m_dsp32->space(AS_PROGRAM).install_read_handler(0x640000, 0xfff7ff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this));
43624362
43634363   DRIVER_INIT_CALL(racedriv);
43644364}
r18027r18028
43854385   init_dspcom(machine);
43864386   atarijsa_init(machine, "IN0", 0x0020);
43874387
4388   state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x908000, 0x908001, read16_delegate(FUNC(harddriv_state::steeltal_dummy_r),state));
4388   state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x908000, 0x908001, read16_delegate(FUNC(harddriv_state::steeltal_dummy_r),state));
43894389
43904390   /* set up the SLOOP */
43914391   if (!proto_sloop)
43924392   {
4393      state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_sloop_r), FUNC(st68k_sloop_w));
4394      state->m_m68k_sloop_alt_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x4e000, 0x4ffff, FUNC(st68k_sloop_alt_r));
4393      state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_sloop_r), FUNC(st68k_sloop_w));
4394      state->m_m68k_sloop_alt_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x4e000, 0x4ffff, FUNC(st68k_sloop_alt_r));
43954395   }
43964396   else
4397      state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_protosloop_r), FUNC(st68k_protosloop_w));
4397      state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_protosloop_r), FUNC(st68k_protosloop_w));
43984398
43994399   /* set up protection hacks */
4400   state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff965d0, 0xfff965df, FUNC(hdgsp_protection_w));
4400   state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff965d0, 0xfff965df, FUNC(hdgsp_protection_w));
44014401
44024402   /* set up adsp speedup handlers */
4403   state->m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4404   state->m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r));
4403   state->m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4404   state->m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r));
44054405   state->m_ds3_speedup_addr = &state->m_adsp_data_memory[0x1f99];
44064406   state->m_ds3_speedup_pc = 0xff;
44074407   state->m_ds3_transfer_pc = ds3_transfer_pc;
r18027r18028
44234423
44244424   /* set up the slapstic */
44254425   slapstic_init(machine(), 117);
4426   m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w));
4426   m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w));
44274427
4428   m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r));
4428   m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r));
44294429
44304430   /* synchronization */
4431   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w));
4432   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w));
4431   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w));
4432   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w));
44334433
44344434   /* set up protection hacks */
4435   m_gsp_protection = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff960a0, 0xfff960af, FUNC(hdgsp_protection_w));
4435   m_gsp_protection = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff960a0, 0xfff960af, FUNC(hdgsp_protection_w));
44364436
44374437   /* set up adsp speedup handlers */
4438   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4439   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r));
4438   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4439   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r));
44404440   m_ds3_speedup_addr = &m_adsp_data_memory[0x1f99];
44414441   m_ds3_speedup_pc = 0xff;
44424442   m_ds3_transfer_pc = 0x43672;
r18027r18028
44514451   init_ds3(machine());
44524452   init_dsk2(machine());
44534453
4454   m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r));
4454   m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r));
44554455
44564456   /* synchronization */
4457   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w));
4458   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w));
4457   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w));
4458   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w));
44594459
44604460   /* set up protection hacks */
4461   m_gsp_protection = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff943f0, 0xfff943ff, FUNC(hdgsp_protection_w));
4461   m_gsp_protection = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff943f0, 0xfff943ff, FUNC(hdgsp_protection_w));
44624462
44634463   /* set up adsp speedup handlers */
4464   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4465   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r));
4464   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4465   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r));
44664466   m_ds3_speedup_addr = &m_adsp_data_memory[0x1f99];
44674467   m_ds3_speedup_pc = 0x2da;
44684468   m_ds3_transfer_pc = 0x407b8;
r18027r18028
44774477   init_ds3(machine());
44784478   init_dsk2(machine());
44794479
4480   m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r));
4480   m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r));
44814481
44824482   /* synchronization */
4483   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w));
4484   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w));
4483   m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w));
4484   m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w));
44854485
44864486   /* set up protection hacks */
4487   m_gsp_protection = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff916c0, 0xfff916cf, FUNC(hdgsp_protection_w));
4487   m_gsp_protection = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff916c0, 0xfff916cf, FUNC(hdgsp_protection_w));
44884488
44894489   /* set up adsp speedup handlers */
4490   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4491   m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f9a, 0x1f9a, FUNC(hdds3_speedup_r));
4490   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r));
4491   m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f9a, 0x1f9a, FUNC(hdds3_speedup_r));
44924492   m_ds3_speedup_addr = &m_adsp_data_memory[0x1f9a];
44934493   m_ds3_speedup_pc = 0x2d9;
44944494   m_ds3_transfer_pc = 0X407da;
trunk/src/mame/drivers/konamigv.c
r18027r18028
528528   m_flash8[2] = machine().device<fujitsu_29f016a_device>("flash2");
529529   m_flash8[3] = machine().device<fujitsu_29f016a_device>("flash3");
530530
531   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::flash_r),this), write32_delegate(FUNC(konamigv_state::flash_w),this) );
532   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1f6800c0, 0x1f6800c7, read32_delegate(FUNC(konamigv_state::trackball_r),this));
533   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler     ( 0x1f6800c8, 0x1f6800cb, read32_delegate(FUNC(konamigv_state::unknown_r),this)); /* ?? */
531   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::flash_r),this), write32_delegate(FUNC(konamigv_state::flash_w),this) );
532   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler     ( 0x1f6800c0, 0x1f6800c7, read32_delegate(FUNC(konamigv_state::trackball_r),this));
533   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler     ( 0x1f6800c8, 0x1f6800cb, read32_delegate(FUNC(konamigv_state::unknown_r),this)); /* ?? */
534534
535535   DRIVER_INIT_CALL(konamigv);
536536}
r18027r18028
617617
618618   m_flash16[0] = machine().device<sharp_lh28f400_device>("flash");
619619
620   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::btc_trackball_r),this), write32_delegate(FUNC(konamigv_state::btc_trackball_w),this));
621   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write                  ( 0x1f6800e0, 0x1f6800e3);
622   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this) );
620   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::btc_trackball_r),this), write32_delegate(FUNC(konamigv_state::btc_trackball_w),this));
621   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write                  ( 0x1f6800e0, 0x1f6800e3);
622   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this) );
623623
624624   DRIVER_INIT_CALL(konamigv);
625625}
r18027r18028
672672
673673DRIVER_INIT_MEMBER(konamigv_state,tokimosh)
674674{
675   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1f680080, 0x1f680083, read32_delegate(FUNC(konamigv_state::tokimeki_serial_r),this));
676   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1f680090, 0x1f680093, write32_delegate(FUNC(konamigv_state::tokimeki_serial_w),this));
675   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1f680080, 0x1f680083, read32_delegate(FUNC(konamigv_state::tokimeki_serial_r),this));
676   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1f680090, 0x1f680093, write32_delegate(FUNC(konamigv_state::tokimeki_serial_w),this));
677677
678678   DRIVER_INIT_CALL(konamigv);
679679}
r18027r18028
697697
698698   m_flash16[0] = machine().device<sharp_lh28f400_device>("flash");
699699
700   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f680080, 0x1f680083, "GUNX1" );
701   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f680090, 0x1f680093, "GUNY1" );
702   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f6800a0, 0x1f6800a3, "GUNX2" );
703   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f6800b0, 0x1f6800b3, "GUNY2" );
704   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port  ( 0x1f6800c0, 0x1f6800c3, "BUTTONS" );
705   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler    ( 0x1f6800e0, 0x1f6800e3, write32_delegate(FUNC(konamigv_state::kdeadeye_0_w),this) );
706   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this));
700   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port  ( 0x1f680080, 0x1f680083, "GUNX1" );
701   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port  ( 0x1f680090, 0x1f680093, "GUNY1" );
702   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port  ( 0x1f6800a0, 0x1f6800a3, "GUNX2" );
703   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port  ( 0x1f6800b0, 0x1f6800b3, "GUNY2" );
704   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port  ( 0x1f6800c0, 0x1f6800c3, "BUTTONS" );
705   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler    ( 0x1f6800e0, 0x1f6800e3, write32_delegate(FUNC(konamigv_state::kdeadeye_0_w),this) );
706   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this));
707707
708708   DRIVER_INIT_CALL(konamigv);
709709}
trunk/src/mame/drivers/ksys573.c
r18027r18028
15551555DRIVER_INIT_MEMBER(ksys573_state,ge765pwbba)
15561556{
15571557   DRIVER_INIT_CALL(konami573);
1558   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::ge765pwbba_r),this), write32_delegate(FUNC(ksys573_state::ge765pwbba_w),this));
1558   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::ge765pwbba_r),this), write32_delegate(FUNC(ksys573_state::ge765pwbba_w),this));
15591559}
15601560
15611561/*
r18027r18028
16671667
16681668   state->m_gx700pwfbf_output_callback = output_callback_func;
16691669
1670   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx700pwbf_io_r),state), write32_delegate(FUNC(ksys573_state::gx700pwbf_io_w),state));
1670   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx700pwbf_io_r),state), write32_delegate(FUNC(ksys573_state::gx700pwbf_io_w),state));
16711671
16721672   state->save_item( NAME(state->m_gx700pwbf_output_data) );
16731673}
r18027r18028
19051905DRIVER_INIT_MEMBER(ksys573_state,gtrfrks)
19061906{
19071907   DRIVER_INIT_CALL(konami573);
1908   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this));
1908   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this));
19091909}
19101910
19111911/* GX894 digital i/o */
r18027r18028
22182218
22192219   state->m_gx894pwbba_output_callback = output_callback_func;
22202220
2221   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx894pwbba_r),state), write32_delegate(FUNC(ksys573_state::gx894pwbba_w),state));
2221   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx894pwbba_r),state), write32_delegate(FUNC(ksys573_state::gx894pwbba_w),state));
22222222
22232223   state->m_gx894_ram_write_offset = 0;
22242224   state->m_gx894_ram_read_offset = 0;
r18027r18028
22442244   DRIVER_INIT_CALL(konami573);
22452245
22462246   gx894pwbba_init( machine(), NULL );
2247   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this) );
2247   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this) );
22482248}
22492249
22502250/* ddr solo */
r18027r18028
25362536   DRIVER_INIT_CALL(konami573);
25372537
25382538   gx894pwbba_init( machine(), dmx_output_callback );
2539   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::dmx_io_w),this) );
2539   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::dmx_io_w),this) );
25402540}
25412541
25422542/* salary man champ */
r18027r18028
26932693   DRIVER_INIT_CALL(konami573);
26942694
26952695   gx894pwbba_init( machine(), mamboagg_output_callback );
2696   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::mamboagg_io_w),this));
2696   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::mamboagg_io_w),this));
26972697}
26982698
26992699
r18027r18028
30113011DRIVER_INIT_MEMBER(ksys573_state,gunmania)
30123012{
30133013   DRIVER_INIT_CALL(konami573);
3014   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gunmania_r),this), write32_delegate(FUNC(ksys573_state::gunmania_w),this));
3014   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gunmania_r),this), write32_delegate(FUNC(ksys573_state::gunmania_w),this));
30153015}
30163016
30173017/* ADC0834 Interface */
trunk/src/mame/drivers/srumbler.c
r18027r18028
4545
4646void srumbler_state::machine_start()
4747{
48   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
48   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4949   /* initialize banked ROM pointers */
5050   srumbler_bankswitch_w(space,0,0);
5151}
trunk/src/mame/drivers/mcr68.c
r18027r18028
15711571   m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
15721572
15731573   /* install control port handler */
1574   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::xenophobe_control_w),this));
1574   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::xenophobe_control_w),this));
15751575}
15761576
15771577
r18027r18028
15831583   m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
15841584
15851585   /* analog port handling is a bit tricky */
1586   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::spyhunt2_control_w),this));
1587   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0d0000, 0x0dffff, read16_delegate(FUNC(mcr68_state::spyhunt2_port_0_r),this));
1588   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0e0000, 0x0effff, read16_delegate(FUNC(mcr68_state::spyhunt2_port_1_r),this));
1586   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::spyhunt2_control_w),this));
1587   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0d0000, 0x0dffff, read16_delegate(FUNC(mcr68_state::spyhunt2_port_0_r),this));
1588   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0e0000, 0x0effff, read16_delegate(FUNC(mcr68_state::spyhunt2_port_1_r),this));
15891589}
15901590
15911591
r18027r18028
15991599   m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
16001600
16011601   /* handle control writes */
1602   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::blasted_control_w),this));
1602   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::blasted_control_w),this));
16031603
16041604   /* 6840 is mapped to the lower 8 bits */
1605   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x0a0000, 0x0a000f, read16_delegate(FUNC(mcr68_state::mcr68_6840_lower_r),this), write16_delegate(FUNC(mcr68_state::mcr68_6840_lower_w),this));
1605   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x0a0000, 0x0a000f, read16_delegate(FUNC(mcr68_state::mcr68_6840_lower_r),this), write16_delegate(FUNC(mcr68_state::mcr68_6840_lower_w),this));
16061606}
16071607
16081608DRIVER_INIT_MEMBER(mcr68_state,intlaser)
r18027r18028
16131613   m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
16141614
16151615   /* handle control writes */
1616   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::blasted_control_w),this));
1616   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::blasted_control_w),this));
16171617
16181618}
16191619
r18027r18028
16271627   m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
16281628
16291629   /* handle control writes */
1630   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::archrivl_control_w),this));
1630   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::archrivl_control_w),this));
16311631
16321632   /* 49-way joystick handling is a bit tricky */
1633   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0e0000, 0x0effff, read16_delegate(FUNC(mcr68_state::archrivl_port_1_r),this));
1633   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0e0000, 0x0effff, read16_delegate(FUNC(mcr68_state::archrivl_port_1_r),this));
16341634
16351635   /* 6840 is mapped to the lower 8 bits */
1636   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x0a0000, 0x0a000f, read16_delegate(FUNC(mcr68_state::mcr68_6840_lower_r),this), write16_delegate(FUNC(mcr68_state::mcr68_6840_lower_w),this));
1636   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x0a0000, 0x0a000f, read16_delegate(FUNC(mcr68_state::mcr68_6840_lower_r),this), write16_delegate(FUNC(mcr68_state::mcr68_6840_lower_w),this));
16371637}
16381638
16391639
trunk/src/mame/drivers/pbaction.c
r18027r18028
487487   pbaction_decode(machine(), "maincpu");
488488
489489   /* install a protection (?) workaround */
490   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc000, 0xc000, read8_delegate(FUNC(pbaction_state::pbactio3_prot_kludge_r),this) );
490   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc000, 0xc000, read8_delegate(FUNC(pbaction_state::pbactio3_prot_kludge_r),this) );
491491}
492492
493493DRIVER_INIT_MEMBER(pbaction_state,pbactio4)
trunk/src/mame/drivers/funworld.c
r18027r18028
45354535******************************************************/
45364536{
45374537   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4538   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
4538   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
45394539
45404540   int x;
45414541
r18027r18028
45684568******************************************************/
45694569
45704570   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
4571   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
4571   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
45724572
45734573   int x;
45744574
trunk/src/mame/drivers/gsword.c
r18027r18028
905905#endif
906906#if 1
907907   /* hack for sound protection or time out function */
908   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this));
908   machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this));
909909#endif
910910}
911911
r18027r18028
920920#endif
921921#if 1
922922   /* hack for sound protection or time out function */
923   machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this));
923   machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this));
924924#endif
925925}
926926
trunk/src/mame/drivers/exprraid.c
r18027r18028
805805
806806DRIVER_INIT_MEMBER(exprraid_state,wexpressb2)
807807{
808   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3800, 0x3800, read8_delegate(FUNC(exprraid_state::vblank_r),this));
808   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3800, 0x3800, read8_delegate(FUNC(exprraid_state::vblank_r),this));
809809   exprraid_gfx_expand(machine());
810810}
811811
812812DRIVER_INIT_MEMBER(exprraid_state,wexpressb3)
813813{
814   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xFFC0, 0xFFC0, read8_delegate(FUNC(exprraid_state::vblank_r),this));
814   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xFFC0, 0xFFC0, read8_delegate(FUNC(exprraid_state::vblank_r),this));
815815   exprraid_gfx_expand(machine());
816816}
817817
trunk/src/mame/drivers/naughtyb.c
r18027r18028
832832DRIVER_INIT_MEMBER(naughtyb_state,popflame)
833833{
834834   /* install a handler to catch protection checks */
835   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x9000, 0x9000, read8_delegate(FUNC(naughtyb_state::popflame_protection_r),this));
836   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x9090, 0x9090, read8_delegate(FUNC(naughtyb_state::popflame_protection_r),this));
835   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x9000, 0x9000, read8_delegate(FUNC(naughtyb_state::popflame_protection_r),this));
836   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x9090, 0x9090, read8_delegate(FUNC(naughtyb_state::popflame_protection_r),this));
837837
838   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xb000, 0xb0ff, write8_delegate(FUNC(naughtyb_state::popflame_protection_w),this));
838   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb000, 0xb0ff, write8_delegate(FUNC(naughtyb_state::popflame_protection_w),this));
839839}
840840
841841
r18027r18028
863863DRIVER_INIT_MEMBER(naughtyb_state,trvmstr)
864864{
865865   /* install questions' handlers  */
866   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc000, 0xc002, read8_delegate(FUNC(naughtyb_state::trvmstr_questions_r),this), write8_delegate(FUNC(naughtyb_state::trvmstr_questions_w),this));
866   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc000, 0xc002, read8_delegate(FUNC(naughtyb_state::trvmstr_questions_r),this), write8_delegate(FUNC(naughtyb_state::trvmstr_questions_w),this));
867867}
868868
869869
trunk/src/mame/drivers/taitowlf.c
r18027r18028
710710   kbdc8042_init(machine(), &at8042);
711711   #if ENABLE_VGA
712712   pc_vga_init(machine(), vga_setting, NULL);
713   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
713   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
714714   #endif
715715}
716716
trunk/src/mame/drivers/dfruit.c
r18027r18028
136136
137137UINT8 dfruit_state::ram_bank_r(UINT16 offset, UINT8 bank_num)
138138{
139   address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
140   return vdp_space->read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);;
139   address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
140   return vdp_space.read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);;
141141}
142142
143143void dfruit_state::ram_bank_w(UINT16 offset, UINT8 data, UINT8 bank_num)
144144{
145   address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
146   vdp_space->write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);;
145   address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space();
146   vdp_space.write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);;
147147}
148148
149149READ8_MEMBER(dfruit_state::dfruit_ram_0_r) { return ram_bank_r(offset, 0); }
trunk/src/mame/drivers/taitogn.c
r18027r18028
572572static void install_handlers(running_machine &machine, int mode)
573573{
574574   taitogn_state *state = machine.driver_data<taitogn_state>();
575   address_space *a = machine.device("maincpu")->memory().space(AS_PROGRAM);
575   address_space &a = machine.device("maincpu")->memory().space(AS_PROGRAM);
576576   if(mode == 0) {
577577      // Mode 0 has access to the subbios, the mn102 flash and the rf5c296 mem zone
578      a->install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_subbios_r),state), write32_delegate(FUNC(taitogn_state::flash_subbios_w),state));
579      a->install_readwrite_handler(0x1f200000, 0x1f2fffff, read32_delegate(FUNC(taitogn_state::rf5c296_mem_r),state), write32_delegate(FUNC(taitogn_state::rf5c296_mem_w),state));
580      a->install_readwrite_handler(0x1f300000, 0x1f37ffff, read32_delegate(FUNC(taitogn_state::flash_mn102_r),state), write32_delegate(FUNC(taitogn_state::flash_mn102_w),state));
581      a->nop_readwrite(0x1f380000, 0x1f5fffff);
578      a.install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_subbios_r),state), write32_delegate(FUNC(taitogn_state::flash_subbios_w),state));
579      a.install_readwrite_handler(0x1f200000, 0x1f2fffff, read32_delegate(FUNC(taitogn_state::rf5c296_mem_r),state), write32_delegate(FUNC(taitogn_state::rf5c296_mem_w),state));
580      a.install_readwrite_handler(0x1f300000, 0x1f37ffff, read32_delegate(FUNC(taitogn_state::flash_mn102_r),state), write32_delegate(FUNC(taitogn_state::flash_mn102_w),state));
581      a.nop_readwrite(0x1f380000, 0x1f5fffff);
582582
583583   } else {
584584      // Mode 1 has access to the 3 samples flashes
585      a->install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_s1_r),state), write32_delegate(FUNC(taitogn_state::flash_s1_w),state));
586      a->install_readwrite_handler(0x1f200000, 0x1f3fffff, read32_delegate(FUNC(taitogn_state::flash_s2_r),state), write32_delegate(FUNC(taitogn_state::flash_s2_w),state));
587      a->install_readwrite_handler(0x1f400000, 0x1f5fffff, read32_delegate(FUNC(taitogn_state::flash_s3_r),state), write32_delegate(FUNC(taitogn_state::flash_s3_w),state));
585      a.install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_s1_r),state), write32_delegate(FUNC(taitogn_state::flash_s1_w),state));
586      a.install_readwrite_handler(0x1f200000, 0x1f3fffff, read32_delegate(FUNC(taitogn_state::flash_s2_r),state), write32_delegate(FUNC(taitogn_state::flash_s2_w),state));
587      a.install_readwrite_handler(0x1f400000, 0x1f5fffff, read32_delegate(FUNC(taitogn_state::flash_s3_r),state), write32_delegate(FUNC(taitogn_state::flash_s3_w),state));
588588   }
589589}
590590
r18027r18028
879879DRIVER_INIT_MEMBER(taitogn_state,coh3002t_mp)
880880{
881881   DRIVER_INIT_CALL(coh3002t);
882   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x1fa10100, 0x1fa10103, read32_delegate(FUNC(taitogn_state::gnet_mahjong_panel_r),this));
882   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x1fa10100, 0x1fa10103, read32_delegate(FUNC(taitogn_state::gnet_mahjong_panel_r),this));
883883}
884884
885885MACHINE_RESET_MEMBER(taitogn_state,coh3002t)
trunk/src/mame/drivers/gunbustr.c
r18027r18028
442442DRIVER_INIT_MEMBER(gunbustr_state,gunbustr)
443443{
444444   /* Speedup handler */
445   m_maincpu->space(AS_PROGRAM)->install_read_handler(0x203acc, 0x203acf, read32_delegate(FUNC(gunbustr_state::main_cycle_r),this));
445   m_maincpu->space(AS_PROGRAM).install_read_handler(0x203acc, 0x203acf, read32_delegate(FUNC(gunbustr_state::main_cycle_r),this));
446446}
447447
448448DRIVER_INIT_MEMBER(gunbustr_state,gunbustrj)
trunk/src/mame/drivers/mappy.c
r18027r18028
717717
718718MACHINE_RESET_MEMBER(mappy_state,superpac)
719719{
720   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
720   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
721721   int i;
722722
723723   /* Reset all latches */
r18027r18028
727727
728728MACHINE_RESET_MEMBER(mappy_state,phozon)
729729{
730   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
730   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
731731   int i;
732732
733733   /* Reset all latches */
r18027r18028
737737
738738MACHINE_RESET_MEMBER(mappy_state,mappy)
739739{
740   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
740   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
741741   int i;
742742
743743   /* Reset all latches */
r18027r18028
22582258       However, removing the 15XX from the board causes sound to disappear completely, so
22592259       the DAC might be built-in after all.
22602260      */
2261   machine().device("sub")->memory().space(AS_PROGRAM)->install_write_handler(0x0002, 0x0002, write8_delegate(FUNC(mappy_state::grobda_DAC_w),this));
2261   machine().device("sub")->memory().space(AS_PROGRAM).install_write_handler(0x0002, 0x0002, write8_delegate(FUNC(mappy_state::grobda_DAC_w),this));
22622262}
22632263
22642264DRIVER_INIT_MEMBER(mappy_state,digdug2)
22652265{
22662266   /* appears to not use the watchdog */
2267   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x8000, 0x8000);
2267   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x8000, 0x8000);
22682268}
22692269
22702270
trunk/src/mame/drivers/safarir.c
r18027r18028
155155TILE_GET_INFO_MEMBER(safarir_state::get_bg_tile_info)
156156{
157157   int color;
158   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
158   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
159159   UINT8 code = ram_r(space,tile_index | 0x400);
160160
161161   if (code & 0x80)
r18027r18028
177177TILE_GET_INFO_MEMBER(safarir_state::get_fg_tile_info)
178178{
179179   int color, flags;
180   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
180   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
181181   UINT8 code = ram_r(space,tile_index);
182182
183183   if (code & 0x80)
trunk/src/mame/drivers/pntnpuzl.c
r18027r18028
385385//  rom[0x2696/2] = 0x4e71;
386386//  rom[0x26a0/2] = 0x4e71;
387387   pc_vga_init(machine(), vga_setting, NULL);
388   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x3a0000, *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x3c0000);
388   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0x3a0000, machine().device("maincpu")->memory().space(AS_PROGRAM), 0x3c0000);
389389
390390}
391391
trunk/src/mame/drivers/metalmx.c
r18027r18028
443443
444444WRITE32_MEMBER(metalmx_state::host_gsp_w)
445445{
446   address_space *gsp_space = machine().device("gsp")->memory().space(AS_PROGRAM);
446   address_space &gsp_space = machine().device("gsp")->memory().space(AS_PROGRAM);
447447
448   gsp_space->write_word((0xc0000000 + (offset << 5) + 0x10) / 8, data);
449   gsp_space->write_word((0xc0000000 + (offset << 5))/ 8 , data >> 16);
448   gsp_space.write_word((0xc0000000 + (offset << 5) + 0x10) / 8, data);
449   gsp_space.write_word((0xc0000000 + (offset << 5))/ 8 , data >> 16);
450450}
451451
452452READ32_MEMBER(metalmx_state::host_gsp_r)
453453{
454   address_space *gsp_space = machine().device("gsp")->memory().space(AS_PROGRAM);
454   address_space &gsp_space = machine().device("gsp")->memory().space(AS_PROGRAM);
455455   UINT32 val;
456456
457   val  = gsp_space->read_word((0xc0000000 + (offset << 5) + 0x10) / 8);
458   val |= gsp_space->read_word((0xc0000000 + (offset << 5)) / 8) << 16;
457   val  = gsp_space.read_word((0xc0000000 + (offset << 5) + 0x10) / 8);
458   val |= gsp_space.read_word((0xc0000000 + (offset << 5)) / 8) << 16;
459459   return val;
460460}
461461
trunk/src/mame/drivers/upscope.c
r18027r18028
9898   /* swap the write handlers between ROM and bank 1 based on the bit */
9999   if ((data & 1) == 0)
100100      /* overlay disabled, map RAM on 0x000000 */
101      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x000000, 0x07ffff, "bank1");
101      machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1");
102102
103103   else
104104      /* overlay enabled, map Amiga system ROM on 0x000000 */
105      machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x000000, 0x07ffff);
105      machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff);
106106}
107107
108108
trunk/src/mame/drivers/equites.c
r18027r18028
18961896   unpack_region(machine(), "gfx3");
18971897
18981898   // install special handlers for unknown device (protection?)
1899   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x580000, 0x580001, write16_delegate(FUNC(equites_state::gekisou_unknown_0_w),this));
1900   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x5a0000, 0x5a0001, write16_delegate(FUNC(equites_state::gekisou_unknown_1_w),this));
1899   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x580000, 0x580001, write16_delegate(FUNC(equites_state::gekisou_unknown_0_w),this));
1900   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x5a0000, 0x5a0001, write16_delegate(FUNC(equites_state::gekisou_unknown_1_w),this));
19011901}
19021902
19031903DRIVER_INIT_MEMBER(equites_state,splndrbt)
r18027r18028
19101910   unpack_region(machine(), "gfx3");
19111911
19121912#if HVOLTAGE_DEBUG
1913   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x000038, 0x000039, read16_delegate(FUNC(equites_state::hvoltage_debug_r),this));
1913   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x000038, 0x000039, read16_delegate(FUNC(equites_state::hvoltage_debug_r),this));
19141914#endif
19151915}
19161916
trunk/src/mame/drivers/omegrace.c
r18027r18028
246246
247247void omegrace_state::machine_reset()
248248{
249   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
249   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
250250   /* Omega Race expects the vector processor to be ready. */
251251   avgdvg_reset_w(space, 0, 0);
252252}
trunk/src/mame/drivers/decocass.c
r18027r18028
16001600
16011601DRIVER_INIT_MEMBER(decocass_state,decocass)
16021602{
1603   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1603   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
16041604   UINT8 *rom = memregion("maincpu")->base();
16051605   int A;
16061606
r18027r18028
16381638      m_decrypted2[i] = swap_bits_5_6(rom[i]);
16391639
16401640   /* convert charram to a banked ROM */
1641   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x6000, 0xafff, "bank1");
1642   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6000, 0xafff, FUNC(decocass_de0091_w));
1641   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0xafff, "bank1");
1642   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x6000, 0xafff, FUNC(decocass_de0091_w));
16431643   membank("bank1")->configure_entry(0, m_charram);
16441644   membank("bank1")->configure_entry(1, memregion("user3")->base());
16451645   membank("bank1")->configure_decrypted_entry(0, &m_decrypted[0x6000]);
r18027r18028
16471647   membank("bank1")->set_entry(0);
16481648
16491649   /* install the bank selector */
1650   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xe900, 0xe900, FUNC(decocass_e900_w));
1650   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xe900, 0xe900, FUNC(decocass_e900_w));
16511651
16521652   save_pointer(NAME(m_decrypted2), romlength);
16531653}
r18027r18028
16851685   DRIVER_INIT_CALL(decocass);
16861686
16871687   /* install custom mahjong panel */
1688   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xe413, 0xe413, FUNC(cdsteljn_mux_w));
1689   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xe600, 0xe6ff, FUNC(cdsteljn_input_r));
1688   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xe413, 0xe413, FUNC(cdsteljn_mux_w));
1689   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xe600, 0xe6ff, FUNC(cdsteljn_input_r));
16901690}
16911691
16921692/* -- */ GAME( 1981, decocass,  0,        decocass, decocass, decocass_state, decocass, ROT270, "Data East Corporation", "DECO Cassette System", GAME_IS_BIOS_ROOT )
trunk/src/mame/drivers/konamigx.c
r18027r18028
37433743         switch (gameDefs[i].special)
37443744   {
37453745            case 1:   // LE2 guns
3746               machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd44000, 0xd44003, read32_delegate(FUNC(konamigx_state::le2_gun_H_r),this));
3747               machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd44004, 0xd44007, read32_delegate(FUNC(konamigx_state::le2_gun_V_r),this));
3746               machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd44000, 0xd44003, read32_delegate(FUNC(konamigx_state::le2_gun_H_r),this));
3747               machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd44004, 0xd44007, read32_delegate(FUNC(konamigx_state::le2_gun_V_r),this));
37483748               break;
37493749
37503750            case 2:   // tkmmpzdm hack
r18027r18028
37803780               break;
37813781
37823782            case 7:   // install type 4 Xilinx protection for non-type 3/4 games
3783      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xcc0000, 0xcc0007, write32_delegate(FUNC(konamigx_state::type4_prot_w),this));
3783      machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xcc0000, 0xcc0007, write32_delegate(FUNC(konamigx_state::type4_prot_w),this));
37843784               break;
37853785
37863786            case 8: // tbyahhoo
r18027r18028
38003800   switch (readback)
38013801   {
38023802      case BPP5:
3803         machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx5bppspr_r),this));
3803         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx5bppspr_r),this));
38043804      break;
38053805
38063806      case BPP66:
3807         machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xd00000, 0xd01fff, FUNC(K056832_6bpp_rom_long_r));
3807         machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xd00000, 0xd01fff, FUNC(K056832_6bpp_rom_long_r));
38083808
38093809      case BPP6:
3810         machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx6bppspr_r),this));
3810         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx6bppspr_r),this));
38113811      break;
38123812   }
38133813
trunk/src/mame/drivers/combatsc.c
r18027r18028
707707
708708void combatsc_state::machine_reset()
709709{
710   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
710   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
711711   int i;
712712
713713   memset(m_io_ram,  0x00, 0x4000);
r18027r18028
991991DRIVER_INIT_MEMBER(combatsc_state,combatsc)
992992{
993993   /* joystick instead of trackball */
994   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x0404, 0x0404, "IN1");
994   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x0404, 0x0404, "IN1");
995995}
996996
997997
trunk/src/mame/drivers/segac2.c
r18027r18028
18601860   genvdp_use_cram = 0;
18611861
18621862   if (upd != NULL)
1863      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(*upd, 0x880000, 0x880001, 0, 0x13fefe, FUNC(segac2_upd7759_w));
1863      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(*upd, 0x880000, 0x880001, 0, 0x13fefe, FUNC(segac2_upd7759_w));
18641864}
18651865
18661866
r18027r18028
21172117{
21182118   /* disable the palette bank switching from the protection chip */
21192119   segac2_common_init(machine(), NULL);
2120   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x800000, 0x800001);
2120   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x800000, 0x800001);
21212121}
21222122
21232123DRIVER_INIT_MEMBER(segac2_state,borench)
r18027r18028
22042204{
22052205   segac2_common_init(machine(), prot_func_pclub);
22062206
2207   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2208   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2209   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
2207   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2208   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2209   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
22102210}
22112211
22122212DRIVER_INIT_MEMBER(segac2_state,pclubjv2)
22132213{
22142214   segac2_common_init(machine(), prot_func_pclubjv2);
22152215
2216   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2217   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2218   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
2216   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2217   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2218   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
22192219}
22202220
22212221DRIVER_INIT_MEMBER(segac2_state,pclubjv4)
22222222{
22232223   segac2_common_init(machine(), prot_func_pclubjv4);
22242224
2225   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2226   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2227   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
2225   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2226   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2227   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
22282228}
22292229
22302230DRIVER_INIT_MEMBER(segac2_state,pclubjv5)
22312231{
22322232   segac2_common_init(machine(), prot_func_pclubjv5);
22332233
2234   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2235   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2236   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
2234   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880120, 0x880121, FUNC(printer_r) );/*Print Club Vol.1*/
2235   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x880124, 0x880125, FUNC(printer_r) );/*Print Club Vol.2*/
2236   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x880124, 0x880125, FUNC(print_club_camera_w));
22372237}
22382238
22392239
trunk/src/mame/drivers/homedata.c
r18027r18028
12111211
12121212MACHINE_RESET_MEMBER(homedata_state,pteacher)
12131213{
1214   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1214   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
12151215
12161216   /* on reset, ports are set as input (high impedance), therefore 0xff output */
12171217   pteacher_upd7807_portc_w(space, 0, 0xff);
r18027r18028
12271227
12281228MACHINE_RESET_MEMBER(homedata_state,reikaids)
12291229{
1230   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1230   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
12311231
12321232   /* on reset, ports are set as input (high impedance), therefore 0xff output */
12331233   reikaids_upd7807_portc_w(space, 0, 0xff);
r18027r18028
20162016   /* it seems that Mahjong Jogakuen runs on the same board as the others,
20172017       but with just these two addresses swapped. Instead of creating a new
20182018       MachineDriver, I just fix them here. */
2019   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8007, 0x8007, write8_delegate(FUNC(homedata_state::pteacher_blitter_bank_w),this));
2020   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8005, 0x8005, write8_delegate(FUNC(homedata_state::pteacher_gfx_bank_w),this));
2019   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8007, 0x8007, write8_delegate(FUNC(homedata_state::pteacher_blitter_bank_w),this));
2020   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8005, 0x8005, write8_delegate(FUNC(homedata_state::pteacher_gfx_bank_w),this));
20212021}
20222022
20232023DRIVER_INIT_MEMBER(homedata_state,mjikaga)
20242024{
20252025   /* Mahjong Ikagadesuka is different as well. */
2026   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x7802, 0x7802, read8_delegate(FUNC(homedata_state::pteacher_snd_r),this));
2027   machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0123, 0x0123, write8_delegate(FUNC(homedata_state::pteacher_snd_answer_w),this));
2026   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7802, 0x7802, read8_delegate(FUNC(homedata_state::pteacher_snd_r),this));
2027   machine().device("audiocpu")->memory().space(AS_PROGRAM).install_write_handler(0x0123, 0x0123, write8_delegate(FUNC(homedata_state::pteacher_snd_answer_w),this));
20282028}
20292029
20302030DRIVER_INIT_MEMBER(homedata_state,reikaids)
trunk/src/mame/drivers/exidy.c
r18027r18028
14621462   m_color_latch[0] = 0x09;
14631463
14641464   /* the ROM is actually mapped high */
1465   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xf800, 0xffff, "bank1");
1465   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xf800, 0xffff, "bank1");
14661466   membank("bank1")->set_base(memregion("maincpu")->base() + 0xf800);
14671467}
14681468
r18027r18028
14931493
14941494DRIVER_INIT_MEMBER(exidy_state,fax)
14951495{
1496   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1496   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
14971497
14981498   exidy_video_config(machine(), 0x04, 0x04, TRUE);
14991499
trunk/src/mame/drivers/pcktgal.c
r18027r18028
411411DRIVER_INIT_MEMBER(pcktgal_state,deco222)
412412{
413413   int A;
414   address_space &space = *machine().device("audiocpu")->memory().space(AS_PROGRAM);
414   address_space &space = machine().device("audiocpu")->memory().space(AS_PROGRAM);
415415   UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x10000);
416416   UINT8 *rom = machine().root_device().memregion("audiocpu")->base();
417417
trunk/src/mame/drivers/hng64.c
r18027r18028
18061806
18071807   KL5C80_virtual_mem_sync(this);
18081808
1809   address_space &space = *machine().device<z80_device>("comm")->space(AS_PROGRAM);
1809   address_space &space = machine().device<z80_device>("comm")->space(AS_PROGRAM);
18101810   space.set_direct_update_handler(direct_update_delegate(FUNC(hng64_state::KL5C80_direct_handler), this));
18111811
18121812   machine().device("comm")->execute().set_input_line(INPUT_LINE_RESET, PULSE_LINE);     // reset the CPU and let 'er rip
trunk/src/mame/drivers/macrossp.c
r18027r18028
779779
780780DRIVER_INIT_MEMBER(macrossp_state,macrossp)
781781{
782   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xf10158, 0xf1015b, write32_delegate(FUNC(macrossp_state::macrossp_speedup_w),this));
782   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xf10158, 0xf1015b, write32_delegate(FUNC(macrossp_state::macrossp_speedup_w),this));
783783}
784784
785785DRIVER_INIT_MEMBER(macrossp_state,quizmoon)
786786{
787787#ifdef UNUSED_FUNCTION
788   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xf00020, 0xf00023, write32_delegate(FUNC(macrossp_state::quizmoon_speedup_w),this));
788   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xf00020, 0xf00023, write32_delegate(FUNC(macrossp_state::quizmoon_speedup_w),this));
789789#endif
790790}
791791
trunk/src/mame/drivers/gladiatr.c
r18027r18028
10221022         rom[i+2*j*0x2000] = rom[i+j*0x2000];
10231023      }
10241024   }
1025   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(gladiatr_state::f6a3_r),this));
1025   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(gladiatr_state::f6a3_r),this));
10261026}
10271027
10281028
trunk/src/mame/drivers/umipoker.c
r18027r18028
747747
748748DRIVER_INIT_MEMBER(umipoker_state,umipoker)
749749{
750   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe00010, 0xe00011, write16_delegate(FUNC(umipoker_state::umi_counters_w), this));
750   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe00010, 0xe00011, write16_delegate(FUNC(umipoker_state::umi_counters_w), this));
751751}
752752
753753DRIVER_INIT_MEMBER(umipoker_state,saiyukip)
754754{
755   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe00010, 0xe00011, write16_delegate(FUNC(umipoker_state::saiyu_counters_w), this));
756   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe0000c, 0xe0000d, write16_delegate(FUNC(umipoker_state::lamps_w), this));
755   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe00010, 0xe00011, write16_delegate(FUNC(umipoker_state::saiyu_counters_w), this));
756   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe0000c, 0xe0000d, write16_delegate(FUNC(umipoker_state::lamps_w), this));
757757}
758758
759759
trunk/src/mame/drivers/kangaroo.c
r18027r18028
181181MACHINE_START_MEMBER(kangaroo_state,kangaroo_mcu)
182182{
183183   kangaroo_state::machine_start();
184   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xef00, 0xefff, read8_delegate(FUNC(kangaroo_state::mcu_sim_r),this), write8_delegate(FUNC(kangaroo_state::mcu_sim_w),this));
184   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xef00, 0xefff, read8_delegate(FUNC(kangaroo_state::mcu_sim_r),this), write8_delegate(FUNC(kangaroo_state::mcu_sim_w),this));
185185   save_item(NAME(m_mcu_clock));
186186}
187187
trunk/src/mame/drivers/cabal.c
r18027r18028
848848
849849static void seibu_sound_bootleg(running_machine &machine,const char *cpu,int length)
850850{
851   address_space &space = *machine.device(cpu)->memory().space(AS_PROGRAM);
851   address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM);
852852   UINT8 *decrypt = auto_alloc_array(machine, UINT8, length);
853853   UINT8 *rom = machine.root_device().memregion(cpu)->base();
854854
trunk/src/mame/drivers/vendetta.c
r18027r18028
164164static void vendetta_video_banking( running_machine &machine, int select )
165165{
166166   vendetta_state *state = machine.driver_data<vendetta_state>();
167   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
167   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
168168
169169   if (select & 1)
170170   {
trunk/src/mame/drivers/segas16b.c
r18027r18028
13691369   m_maincpu->set_input_line(4, HOLD_LINE);
13701370
13711371   // set tile banks
1372   address_space &space = *m_maincpu->space(AS_PROGRAM);
1372   address_space &space = m_maincpu->space(AS_PROGRAM);
13731373   rom_5704_bank_w(space, 1, m_workram[0x3094/2] & 0x00ff, 0x00ff);
13741374
13751375   // process any new sound data
r18027r18028
14141414   UINT16 temp = m_workram[0x0bd0/2];
14151415   if ((temp & 0xff00) != 0x0000)
14161416   {
1417      address_space &space = *m_maincpu->space(AS_PROGRAM);
1417      address_space &space = m_maincpu->space(AS_PROGRAM);
14181418      m_mapper->write(space, 0x03, temp >> 8);
14191419      m_workram[0x0bd0/2] = temp & 0x00ff;
14201420   }
r18027r18028
14441444   UINT16 temp = m_workram[0x2cfc/2];
14451445   if ((temp & 0xff00) != 0x0000)
14461446   {
1447      address_space &space = *m_maincpu->space(AS_PROGRAM);
1447      address_space &space = m_maincpu->space(AS_PROGRAM);
14481448      m_mapper->write(space, 0x03, temp >> 8);
14491449      m_workram[0x2cfc/2] = temp & 0x00ff;
14501450   }
r18027r18028
14711471   temp = m_workram[0x01d0/2];
14721472   if ((temp & 0xff00) != 0x0000)
14731473   {
1474      address_space &space = *m_maincpu->space(AS_PROGRAM);
1474      address_space &space = m_maincpu->space(AS_PROGRAM);
14751475      m_mapper->write(space, 0x03, temp);
14761476      m_workram[0x01d0/2] = temp & 0x00ff;
14771477   }
r18027r18028
14971497   UINT16 temp = m_workram[0x0008/2];
14981498   if ((temp & 0x00ff) != 0x0000)
14991499   {
1500      address_space &space = *m_maincpu->space(AS_PROGRAM);
1500      address_space &space = m_maincpu->space(AS_PROGRAM);
15011501      m_mapper->write(space, 0x03, temp >> 8);
15021502      m_workram[0x0008/2] = temp & 0xff00;
15031503   }
trunk/src/mame/drivers/saturn.c
r18027r18028
239239static void scu_do_transfer(running_machine &machine,UINT8 event)
240240{
241241   saturn_state *state = machine.driver_data<saturn_state>();
242   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
242   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
243243   int i;
244244
245245   for(i=0;i<3;i++)
r18027r18028
20542054
20552055   m_cart_type = ioport("CART_AREA")->read() & 7;
20562056
2057   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02400000, 0x027fffff, FUNC(saturn_null_ram_r), FUNC(saturn_null_ram_w));
2058   machine().device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02400000, 0x027fffff, FUNC(saturn_null_ram_r), FUNC(saturn_null_ram_w));
2057   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02400000, 0x027fffff, FUNC(saturn_null_ram_r), FUNC(saturn_null_ram_w));
2058   machine().device("slave")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02400000, 0x027fffff, FUNC(saturn_null_ram_r), FUNC(saturn_null_ram_w));
20592059
20602060   if(m_cart_type == 5)
20612061   {
20622062      //  AM_RANGE(0x02400000, 0x027fffff) AM_RAM //cart RAM area, dynamically allocated
2063      machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x02400000, 0x027fffff);
2064      machine().device("slave")->memory().space(AS_PROGRAM)->nop_readwrite(0x02400000, 0x027fffff);
2063      machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x02400000, 0x027fffff);
2064      machine().device("slave")->memory().space(AS_PROGRAM).nop_readwrite(0x02400000, 0x027fffff);
20652065
2066      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02400000, 0x0247ffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2067      machine().device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02400000, 0x0247ffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2068      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02600000, 0x0267ffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
2069      machine().device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02600000, 0x0267ffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
2066      machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02400000, 0x0247ffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2067      machine().device("slave")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02400000, 0x0247ffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2068      machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02600000, 0x0267ffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
2069      machine().device("slave")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02600000, 0x0267ffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
20702070   }
20712071
20722072   if(m_cart_type == 6)
20732073   {
20742074      //  AM_RANGE(0x02400000, 0x027fffff) AM_RAM //cart RAM area, dynamically allocated
2075      machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x02400000, 0x027fffff);
2076      machine().device("slave")->memory().space(AS_PROGRAM)->nop_readwrite(0x02400000, 0x027fffff);
2075      machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x02400000, 0x027fffff);
2076      machine().device("slave")->memory().space(AS_PROGRAM).nop_readwrite(0x02400000, 0x027fffff);
20772077
2078      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02400000, 0x025fffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2079      machine().device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02400000, 0x025fffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2080      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02600000, 0x027fffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
2081      machine().device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x02600000, 0x027fffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
2078      machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02400000, 0x025fffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2079      machine().device("slave")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02400000, 0x025fffff, FUNC(saturn_cart_dram0_r), FUNC(saturn_cart_dram0_w));
2080      machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02600000, 0x027fffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
2081      machine().device("slave")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x02600000, 0x027fffff, FUNC(saturn_cart_dram1_r), FUNC(saturn_cart_dram1_w));
20822082   }
20832083
2084   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(0x04000000, 0x047fffff);
2085   machine().device("slave")->memory().space(AS_PROGRAM)->nop_readwrite(0x04000000, 0x047fffff);
2084   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff);
2085   machine().device("slave")->memory().space(AS_PROGRAM).nop_readwrite(0x04000000, 0x047fffff);
20862086
20872087   if(m_cart_type > 0 && m_cart_type < 5)
20882088   {
r18027r18028
20932093      //mask = 0x7fffff >> 4-3 = 0x3fffff 16mbit
20942094      //mask = 0x7fffff >> 4-2 = 0x1fffff 8mbit
20952095      //mask = 0x7fffff >> 4-1 = 0x0fffff 4mbit
2096      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x04000000, 0x04000000 | mask, FUNC(saturn_cs1_r), FUNC(saturn_cs1_w));
2097      machine().device("slave")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x04000000, 0x04000000 | mask, FUNC(saturn_cs1_r), FUNC(saturn_cs1_w));
2096      machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x04000000, 0x04000000 | mask, FUNC(saturn_cs1_r), FUNC(saturn_cs1_w));
2097      machine().device("slave")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x04000000, 0x04000000 | mask, FUNC(saturn_cs1_r), FUNC(saturn_cs1_w));
20982098   }
20992099
21002100
trunk/src/mame/drivers/atarigx2.c
r18027r18028
22362236
22372237   m_playfield_base = 0x000;
22382238
2239   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xca0fc0, 0xca0fc3, read32_delegate(FUNC(atarigx2_state::rrreveng_prot_r),this));
2239   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xca0fc0, 0xca0fc3, read32_delegate(FUNC(atarigx2_state::rrreveng_prot_r),this));
22402240}
22412241
22422242
trunk/src/mame/drivers/taito_f3.c
r18027r18028
38853885      }
38863886   }
38873887
3888   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x4a001c, 0x4a001f, read32_delegate(FUNC(taito_f3_state::bubsympb_oki_r),this));
3889   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4a001c, 0x4a001f, write32_delegate(FUNC(taito_f3_state::bubsympb_oki_w),this));
3888   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4a001c, 0x4a001f, read32_delegate(FUNC(taito_f3_state::bubsympb_oki_r),this));
3889   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4a001c, 0x4a001f, write32_delegate(FUNC(taito_f3_state::bubsympb_oki_w),this));
38903890}
38913891
38923892
trunk/src/mame/drivers/m107.c
r18027r18028
974974   UINT8 *ROM = memregion("maincpu")->base();
975975
976976   membank("bank1")->configure_entries(0, 4, &ROM[0x80000], 0x20000);
977   machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x06, 0x07, write16_delegate(FUNC(m107_state::m107_bankswitch_w),this));
977   machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x07, write16_delegate(FUNC(m107_state::m107_bankswitch_w),this));
978978
979979   m_irq_vectorbase = 0x80;
980980   m_spritesystem = 0;
trunk/src/mame/drivers/arkanoid.c
r18027r18028
15721572static void arkanoid_bootleg_init( running_machine &machine )
15731573{
15741574   arkanoid_state *state = machine.driver_data<arkanoid_state>();
1575   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf000, 0xf000, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f000_r),state) );
1576   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf002, 0xf002, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f002_r),state) );
1577   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd018, 0xd018, write8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d018_w),state) );
1578   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd008, 0xd008, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d008_r),state) );
1575   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf000, 0xf000, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f000_r),state) );
1576   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf002, 0xf002, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f002_r),state) );
1577   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd018, 0xd018, write8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d018_w),state) );
1578   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd008, 0xd008, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d008_r),state) );
15791579}
15801580
15811581DRIVER_INIT_MEMBER(arkanoid_state,arkangc)
r18027r18028
16601660      ROM[x] = ROM[x] ^ 0x94;
16611661   }
16621662
1663   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd008, 0xd008, write8_delegate(FUNC(arkanoid_state::tetrsark_d008_w),this));
1663   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd008, 0xd008, write8_delegate(FUNC(arkanoid_state::tetrsark_d008_w),this));
16641664}
16651665
16661666
trunk/src/mame/drivers/megasys1.c
r18027r18028
37303730DRIVER_INIT_MEMBER(megasys1_state,astyanax)
37313731{
37323732   astyanax_rom_decode(machine(), "maincpu");
3733   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_r),this));
3734   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20000, 0x20009, write16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_w),this));
3733   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_r),this));
3734   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20000, 0x20009, write16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_w),this));
37353735}
37363736
37373737DRIVER_INIT_MEMBER(megasys1_state,avspirit)
r18027r18028
37433743   m_ip_select_values[4] = 0x34;
37443744
37453745   // has twice less RAM
3746   machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_readwrite(0x060000, 0x06ffff);
3747   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x070000, 0x07ffff, m_ram);
3746   machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_readwrite(0x060000, 0x06ffff);
3747   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x070000, 0x07ffff, m_ram);
37483748}
37493749
37503750DRIVER_INIT_MEMBER(megasys1_state,bigstrik)
r18027r18028
38063806DRIVER_INIT_MEMBER(megasys1_state,edfbl)
38073807{
38083808   //device_t *oki1 = machine().device("oki1");
3809   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe0000, 0xe000f, read16_delegate(FUNC(megasys1_state::edfbl_input_r),this));
3810   //machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(*oki1, 0xe000e, 0xe000f, FUNC(soundlatch_byte_w));
3809   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xe0000, 0xe000f, read16_delegate(FUNC(megasys1_state::edfbl_input_r),this));
3810   //machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(*oki1, 0xe000e, 0xe000f, FUNC(soundlatch_byte_w));
38113811}
38123812
38133813DRIVER_INIT_MEMBER(megasys1_state,hayaosi1)
r18027r18028
38613861   phantasm_rom_decode(machine(), "maincpu");
38623862
38633863   //ROM  = (UINT16 *) machine().root_device().memregion("maincpu")->base();
3864   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_r),this));
3865   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x2f000, 0x2f009, write16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_w),this));
3864   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_r),this));
3865   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2f000, 0x2f009, write16_delegate(FUNC(megasys1_state::iganinju_mcu_hs_w),this));
38663866
38673867   //ROM[0x00006e/2] = 0x0420; // the only game that does
38683868                        // not like lev 3 interrupts
r18027r18028
38893889
38903890   jitsupro_gfx_unmangle(machine(), "gfx1");   // Gfx
38913891   jitsupro_gfx_unmangle(machine(), "gfx4");
3892   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_r),this));
3893   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20000, 0x20009, write16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_w),this));
3892   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_r),this));
3893   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20000, 0x20009, write16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_w),this));
38943894
38953895   /* the sound code writes oki commands to both the lsb and msb */
3896   machine().device("soundcpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa0000, 0xa0003, write16_delegate(FUNC(megasys1_state::okim6295_both_1_w),this));
3897   machine().device("soundcpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc0000, 0xc0003, write16_delegate(FUNC(megasys1_state::okim6295_both_2_w),this));
3896   machine().device("soundcpu")->memory().space(AS_PROGRAM).install_write_handler(0xa0000, 0xa0003, write16_delegate(FUNC(megasys1_state::okim6295_both_1_w),this));
3897   machine().device("soundcpu")->memory().space(AS_PROGRAM).install_write_handler(0xc0000, 0xc0003, write16_delegate(FUNC(megasys1_state::okim6295_both_2_w),this));
38983898}
38993899
39003900DRIVER_INIT_MEMBER(megasys1_state,peekaboo)
39013901{
3902   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x100000, 0x100001, read16_delegate(FUNC(megasys1_state::protection_peekaboo_r),this), write16_delegate(FUNC(megasys1_state::protection_peekaboo_w),this));
3902   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x100000, 0x100001, read16_delegate(FUNC(megasys1_state::protection_peekaboo_r),this), write16_delegate(FUNC(megasys1_state::protection_peekaboo_w),this));
39033903}
39043904
39053905DRIVER_INIT_MEMBER(megasys1_state,phantasm)
r18027r18028
39343934{
39353935   astyanax_rom_decode(machine(), "maincpu");
39363936   /* Sprite RAM is mirrored */
3937   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x8c000, 0x8cfff, read16_delegate(FUNC(megasys1_state::soldamj_spriteram16_r),this), write16_delegate(FUNC(megasys1_state::soldamj_spriteram16_w),this));
3937   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x8c000, 0x8cfff, read16_delegate(FUNC(megasys1_state::soldamj_spriteram16_r),this), write16_delegate(FUNC(megasys1_state::soldamj_spriteram16_w),this));
39383938}
39393939
39403940DRIVER_INIT_MEMBER(megasys1_state,soldam)
39413941{
39423942   phantasm_rom_decode(machine(), "maincpu");
39433943   /* Sprite RAM is mirrored */
3944   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x8c000, 0x8cfff, read16_delegate(FUNC(megasys1_state::soldamj_spriteram16_r),this), write16_delegate(FUNC(megasys1_state::soldamj_spriteram16_w),this));
3944   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x8c000, 0x8cfff, read16_delegate(FUNC(megasys1_state::soldamj_spriteram16_r),this), write16_delegate(FUNC(megasys1_state::soldamj_spriteram16_w),this));
39453945}
39463946
39473947
r18027r18028
39783978DRIVER_INIT_MEMBER(megasys1_state,stdragon)
39793979{
39803980   phantasm_rom_decode(machine(), "maincpu");
3981   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_r),this));
3982   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x23ff0, 0x23ff9, write16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_w),this));
3981   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_r),this));
3982   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x23ff0, 0x23ff9, write16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_w),this));
39833983}
39843984
39853985DRIVER_INIT_MEMBER(megasys1_state,stdragona)
r18027r18028
39883988
39893989   stdragona_gfx_unmangle(machine(), "gfx1");
39903990   stdragona_gfx_unmangle(machine(), "gfx4");
3991   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_r),this));
3992   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x23ff0, 0x23ff9, write16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_w),this));
3991   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_r),this));
3992   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x23ff0, 0x23ff9, write16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_w),this));
39933993}
39943994
39953995READ16_MEMBER(megasys1_state::monkelf_input_r)
r18027r18028
40184018   UINT16 *ROM = (UINT16*)memregion("maincpu")->base();
40194019   ROM[0x00744/2] = 0x4e71; // weird check, 0xe000e R is a port-based trap?
40204020
4021   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe0000, 0xe000f, read16_delegate(FUNC(megasys1_state::monkelf_input_r),this));
4021   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xe0000, 0xe000f, read16_delegate(FUNC(megasys1_state::monkelf_input_r),this));
40224022}
40234023
40244024/*************************************
trunk/src/mame/drivers/airbustr.c
r18027r18028
783783
784784DRIVER_INIT_MEMBER(airbustr_state,airbustr)
785785{
786   machine().device("master")->memory().space(AS_PROGRAM)->install_read_handler(0xe000, 0xefff, read8_delegate(FUNC(airbustr_state::devram_r),this)); // protection device lives here
786   machine().device("master")->memory().space(AS_PROGRAM).install_read_handler(0xe000, 0xefff, read8_delegate(FUNC(airbustr_state::devram_r),this)); // protection device lives here
787787}
788788
789789
trunk/src/mame/drivers/pacman.c
r18027r18028
388388
389389MACHINE_RESET_MEMBER(pacman_state,superabc)
390390{
391   superabc_bank_w(*m_maincpu->space(AS_PROGRAM), 0, 0);
391   superabc_bank_w(m_maincpu->space(AS_PROGRAM), 0, 0);
392392}
393393
394394
r18027r18028
57425742static void maketrax_rom_decode(running_machine &machine)
57435743{
57445744   pacman_state *state = machine.driver_data<pacman_state>();
5745   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
5745   address_space &space = state->m_maincpu->space(AS_PROGRAM);
57465746   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
57475747   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
57485748
r18027r18028
57665766DRIVER_INIT_MEMBER(pacman_state,maketrax)
57675767{
57685768   /* set up protection handlers */
5769   m_maincpu->space(AS_PROGRAM)->install_read_handler(0x5080, 0x50bf, read8_delegate(FUNC(pacman_state::maketrax_special_port2_r),this));
5770   m_maincpu->space(AS_PROGRAM)->install_read_handler(0x50c0, 0x50ff, read8_delegate(FUNC(pacman_state::maketrax_special_port3_r),this));
5769   m_maincpu->space(AS_PROGRAM).install_read_handler(0x5080, 0x50bf, read8_delegate(FUNC(pacman_state::maketrax_special_port2_r),this));
5770   m_maincpu->space(AS_PROGRAM).install_read_handler(0x50c0, 0x50ff, read8_delegate(FUNC(pacman_state::maketrax_special_port3_r),this));
57715771
57725772   maketrax_rom_decode(machine());
57735773}
r18027r18028
57755775static void korosuke_rom_decode(running_machine &machine)
57765776{
57775777   pacman_state *state = machine.driver_data<pacman_state>();
5778   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
5778   address_space &space = state->m_maincpu->space(AS_PROGRAM);
57795779   UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x4000);
57805780   UINT8 *rom = machine.root_device().memregion("maincpu")->base();
57815781
r18027r18028
57995799DRIVER_INIT_MEMBER(pacman_state,korosuke)
58005800{
58015801   /* set up protection handlers */
5802   m_maincpu->space(AS_PROGRAM)->install_read_handler(0x5080, 0x5080, read8_delegate(FUNC(pacman_state::korosuke_special_port2_r),this));
5803   m_maincpu->space(AS_PROGRAM)->install_read_handler(0x50c0, 0x50ff, read8_delegate(FUNC(pacman_state::korosuke_special_port3_r),this));
5802   m_maincpu->space(AS_PROGRAM).install_read_handler(0x5080, 0x5080, read8_delegate(FUNC(pacman_state::korosuke_special_port2_r),this));
5803   m_maincpu->space(AS_PROGRAM).install_read_handler(0x50c0, 0x50ff, read8_delegate(FUNC(pacman_state::korosuke_special_port3_r),this));
58045804
58055805   korosuke_rom_decode(machine());
58065806}
r18027r18028
61026102DRIVER_INIT_MEMBER(pacman_state,mspacii)
61036103{
61046104   // protection
6105   m_maincpu->space(AS_PROGRAM)->install_read_handler(0x504d, 0x506f, read8_delegate(FUNC(pacman_state::mspacii_protection_r), this));
6105   m_maincpu->space(AS_PROGRAM).install_read_handler(0x504d, 0x506f, read8_delegate(FUNC(pacman_state::mspacii_protection_r), this));
61066106}
61076107
61086108DRIVER_INIT_MEMBER(pacman_state,superabc)
r18027r18028
61636163{
61646164
61656165   /* extra memory */
6166   m_maincpu->space(AS_PROGRAM)->install_ram(0x4800, 0x4bff);
6166   m_maincpu->space(AS_PROGRAM).install_ram(0x4800, 0x4bff);
61676167
61686168   /* protection? */
6169   m_maincpu->space(AS_PROGRAM)->install_read_handler(0x3000, 0x3fff, read8_delegate(FUNC(pacman_state::cannonbp_protection_r),this));
6169   m_maincpu->space(AS_PROGRAM).install_read_handler(0x3000, 0x3fff, read8_delegate(FUNC(pacman_state::cannonbp_protection_r),this));
61706170}
61716171
61726172
trunk/src/mame/drivers/igs011.c
r18027r18028
10361036
10371037//  m_prot2 = 0x00;
10381038
1039   address_space *sp = machine().device("maincpu")->memory().space(AS_PROGRAM);
1039   address_space &sp = machine().device("maincpu")->memory().space(AS_PROGRAM);
10401040   UINT8 *rom = memregion("maincpu")->base();
10411041
10421042   // Plug previous address range with ROM access
1043   sp->install_rom(m_prot1_addr + 0, m_prot1_addr + 9, rom + m_prot1_addr);
1043   sp.install_rom(m_prot1_addr + 0, m_prot1_addr + 9, rom + m_prot1_addr);
10441044
10451045   m_prot1_addr = (data << 4) ^ 0x8340;
10461046
10471047   // Add protection memory range
1048   sp->install_write_handler(m_prot1_addr + 0, m_prot1_addr + 7, write16_delegate(FUNC(igs011_state::igs011_prot1_w), this));
1049   sp->install_read_handler (m_prot1_addr + 8, m_prot1_addr + 9, read16_delegate(FUNC(igs011_state::igs011_prot1_r), this));
1048   sp.install_write_handler(m_prot1_addr + 0, m_prot1_addr + 7, write16_delegate(FUNC(igs011_state::igs011_prot1_w), this));
1049   sp.install_read_handler (m_prot1_addr + 8, m_prot1_addr + 9, read16_delegate(FUNC(igs011_state::igs011_prot1_r), this));
10501050}
10511051/*
10521052READ16_MEMBER(igs011_state::igs011_prot_fake_r)
r18027r18028
18351835
18361836   drgnwrld_type2_decrypt(machine());
18371837   drgnwrld_gfx_decrypt(machine());
1838   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd4c0, 0xd4ff, read16_delegate(FUNC(igs011_state::drgnwrldv21_igs011_prot2_r), this));
1838   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd4c0, 0xd4ff, read16_delegate(FUNC(igs011_state::drgnwrldv21_igs011_prot2_r), this));
18391839/*
18401840    // PROTECTION CHECKS
18411841    // bp 32ee; bp 11ca8; bp 23d5e; bp 23fd0; bp 24170; bp 24348; bp 2454e; bp 246cc; bp 24922; bp 24b66; bp 24de2; bp 2502a; bp 25556; bp 269de; bp 2766a; bp 2a830
r18027r18028
19751975
19761976   dbc_decrypt(machine());
19771977
1978   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::dbc_igs011_prot2_r), this));
1978   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::dbc_igs011_prot2_r), this));
19791979/*
19801980    // PROTECTION CHECKS
19811981    rom[0x04c42/2]  =   0x602e;     // 004C42: 6604         bne 4c48  (rom test error otherwise)
r18027r18028
20052005
20062006   ryukobou_decrypt(machine());
20072007
2008   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::ryukobou_igs011_prot2_r), this));
2008   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::ryukobou_igs011_prot2_r), this));
20092009
20102010   // PROTECTION CHECKS
20112011//  rom[0x2df68/2]  =   0x4e75;     // 02DF68: 4E56 FE00    link A6, #-$200  (fills palette with pink otherwise)
trunk/src/mame/drivers/williams.c
r18027r18028
27442744   CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
27452745
27462746   /* install a handler to catch protection checks */
2747   m_mayday_protection = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa190, 0xa191, read8_delegate(FUNC(williams_state::mayday_protection_r),this));
2747   m_mayday_protection = machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa190, 0xa191, read8_delegate(FUNC(williams_state::mayday_protection_r),this));
27482748}
27492749
27502750
r18027r18028
27782778   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
27792779
27802780   /* bubbles has a full 8-bit-wide CMOS */
2781   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xcc00, 0xcfff, write8_delegate(FUNC(williams_state::bubbles_cmos_w),this));
2781   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xcc00, 0xcfff, write8_delegate(FUNC(williams_state::bubbles_cmos_w),this));
27822782}
27832783
27842784
r18027r18028
28132813   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
28142814
28152815   /* add a third PIA */
2816   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xc808, 0xc80b, read8_delegate(FUNC(pia6821_device::read), pia_3), write8_delegate(FUNC(pia6821_device::write), pia_3));
2816   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xc808, 0xc80b, read8_delegate(FUNC(pia6821_device::read), pia_3), write8_delegate(FUNC(pia6821_device::write), pia_3));
28172817
28182818   /* install extra input handlers */
2819   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0xc800, 0xc800, "AN0");
2820   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0xc801, 0xc801, "AN1");
2821   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0xc802, 0xc802, "AN2");
2822   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0xc803, 0xc803, "AN3");
2819   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0xc800, 0xc800, "AN0");
2820   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0xc801, 0xc801, "AN1");
2821   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0xc802, 0xc802, "AN2");
2822   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0xc803, 0xc803, "AN3");
28232823}
28242824
28252825
28262826DRIVER_INIT_MEMBER(williams_state,alienar)
28272827{
28282828   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
2829   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xcbff, 0xcbff);
2829   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xcbff, 0xcbff);
28302830}
28312831
28322832
28332833DRIVER_INIT_MEMBER(williams_state,alienaru)
28342834{
28352835   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
2836   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xcbff, 0xcbff);
2836   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xcbff, 0xcbff);
28372837}
28382838
28392839
trunk/src/mame/drivers/dec8.c
r18027r18028
7171   // rising edge
7272   if (state)
7373   {
74      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
74      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
7575      dec8_mxc06_karn_buffer_spriteram_w(space, 0, 0);
7676   }
7777}
r18027r18028
35243524/* Ghostbusters, Darwin, Oscar use a "Deco 222" custom 6502 for sound. */
35253525DRIVER_INIT_MEMBER(dec8_state,deco222)
35263526{
3527   address_space &space = *machine().device("audiocpu")->memory().space(AS_PROGRAM);
3527   address_space &space = machine().device("audiocpu")->memory().space(AS_PROGRAM);
35283528   int A;
35293529   UINT8 *decrypt;
35303530   UINT8 *rom;
trunk/src/mame/drivers/atarigt.c
r18027r18028
8080
8181static void cage_irq_callback(running_machine &machine, int reason)
8282{
83   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
83   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
8484
8585   if (reason)
8686      atarigen_sound_int_gen(machine.device("maincpu"));
r18027r18028
12741274   m_protection_w = tmek_protection_w;
12751275
12761276   /* temp hack */
1277   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),this));
1277   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),this));
12781278}
12791279
12801280
trunk/src/mame/drivers/crimfght.c
r18027r18028
407407   /* bit 5 = select work RAM or palette */
408408   if (lines & 0x20)
409409   {
410      device->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x03ff, "bank3");
411      device->memory().space(AS_PROGRAM)->install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(crimfght_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state));
410      device->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x03ff, "bank3");
411      device->memory().space(AS_PROGRAM).install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(crimfght_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state));
412412      state->membank("bank3")->set_base(state->m_generic_paletteram_8);
413413   }
414414   else
415      device->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, 0x03ff, "bank1");                        /* RAM */
415      device->memory().space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1");                        /* RAM */
416416
417417   /* bit 6 = enable char ROM reading through the video RAM */
418418   k052109_set_rmrd_line(state->m_k052109, (lines & 0x40) ? ASSERT_LINE : CLEAR_LINE);
trunk/src/mame/drivers/pirates.c
r18027r18028
459459
460460   /* If this value is increased then something has gone wrong and the protection failed */
461461   /* Write-protect it for now */
462   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x109e98, 0x109e9b, read16_delegate(FUNC(pirates_state::genix_prot_r),this));
462   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x109e98, 0x109e9b, read16_delegate(FUNC(pirates_state::genix_prot_r),this));
463463}
464464
465465
trunk/src/mame/drivers/darkmist.c
r18027r18028
400400
401401DRIVER_INIT_MEMBER(darkmist_state,darkmist)
402402{
403   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
403   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
404404   int i, len;
405405   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
406406   UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x10000);
trunk/src/mame/drivers/mquake.c
r18027r18028
4040   /* swap the write handlers between ROM and bank 1 based on the bit */
4141   if ((data & 1) == 0)
4242      /* overlay disabled, map RAM on 0x000000 */
43      device->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x000000, 0x07ffff, "bank1");
43      device->machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1");
4444
4545   else
4646      /* overlay enabled, map Amiga system ROM on 0x000000 */
47      device->machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x000000, 0x07ffff);
47      device->machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff);
4848}
4949
5050
trunk/src/mame/drivers/nmk16.c
r18027r18028
45734573READ16_MEMBER(nmk16_state::vandykeb_r){ return 0x0000; }
45744574DRIVER_INIT_MEMBER(nmk16_state,vandykeb)
45754575{
4576   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x08000e, 0x08000f, read16_delegate(FUNC(nmk16_state::vandykeb_r),this));
4577   machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x08001e, 0x08001f);
4576   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x08000e, 0x08000f, read16_delegate(FUNC(nmk16_state::vandykeb_r),this));
4577   machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x08001e, 0x08001f);
45784578}
45794579
45804580
trunk/src/emu/debug/debugcpu.c
r18027r18028
11551155   running_machine &machine = *(running_machine *)param;
11561156   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
11571157   device_t *device = NULL;
1158   address_space *space;
11591158
11601159   switch (spacenum)
11611160   {
r18027r18028
11671166            device = expression_get_device(machine, name);
11681167         if (device == NULL)
11691168            device = debug_cpu_get_visible_cpu(machine);
1170         space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
1171         if (space != NULL)
1172            result = debug_read_memory(*space, space->address_to_byte(address), size, true);
1169         if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)))
1170         {
1171            address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
1172            result = debug_read_memory(space, space.address_to_byte(address), size, true);
1173         }
11731174         break;
11741175
11751176      case EXPSPACE_PROGRAM_PHYSICAL:
r18027r18028
11801181            device = expression_get_device(machine, name);
11811182         if (device == NULL)
11821183            device = debug_cpu_get_visible_cpu(machine);
1183         space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL));
1184         if (space != NULL)
1185            result = debug_read_memory(*space, space->address_to_byte(address), size, false);
1184         if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)))
1185         {
1186            address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
1187            result = debug_read_memory(space, space.address_to_byte(address), size, false);
1188         }
11861189         break;
11871190
11881191      case EXPSPACE_OPCODE:
r18027r18028
11911194            device = expression_get_device(machine, name);
11921195         if (device == NULL)
11931196            device = debug_cpu_get_visible_cpu(machine);
1194         result = expression_read_program_direct(*device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size);
1197         result = expression_read_program_direct(device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size);
11951198         break;
11961199
11971200      case EXPSPACE_REGION:
r18027r18028
13211324{
13221325   running_machine &machine = *(running_machine *)param;
13231326   device_t *device = NULL;
1324   address_space *space;
13251327
13261328   switch (spacenum)
13271329   {
r18027r18028
13331335            device = expression_get_device(machine, name);
13341336         if (device == NULL)
13351337            device = debug_cpu_get_visible_cpu(machine);
1336         space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
1337         if (space != NULL)
1338            debug_write_memory(*space, space->address_to_byte(address), data, size, true);
1338         if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)))
1339         {
1340            address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
1341            debug_write_memory(space, space.address_to_byte(address), data, size, true);
1342         }
13391343         break;
13401344
13411345      case EXPSPACE_PROGRAM_PHYSICAL:
r18027r18028
13461350            device = expression_get_device(machine, name);
13471351         if (device == NULL)
13481352            device = debug_cpu_get_visible_cpu(machine);
1349         space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL));
1350         if (space != NULL)
1351            debug_write_memory(*space, space->address_to_byte(address), data, size, false);
1353         if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)))
1354         {
1355            address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL));
1356            debug_write_memory(space, space.address_to_byte(address), data, size, false);
1357         }
13521358         break;
13531359
13541360      case EXPSPACE_OPCODE:
r18027r18028
13571363            device = expression_get_device(machine, name);
13581364         if (device == NULL)
13591365            device = debug_cpu_get_visible_cpu(machine);
1360         expression_write_program_direct(*device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size, data);
1366         expression_write_program_direct(device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size, data);
13611367         break;
13621368
13631369      case EXPSPACE_REGION:
r18027r18028
15151521         }
15161522         if (device == NULL)
15171523            device = debug_cpu_get_visible_cpu(machine);
1518         if (device->memory().space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_LOGICAL)) == NULL)
1524         if (!device->memory().has_space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_LOGICAL)))
15191525            return expression_error::NO_SUCH_MEMORY_SPACE;
15201526         break;
15211527
r18027r18028
15311537         }
15321538         if (device == NULL)
15331539            device = debug_cpu_get_visible_cpu(machine);
1534         if (device->memory().space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_PHYSICAL)) == NULL)
1540         if (!device->memory().has_space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_PHYSICAL)))
15351541            return expression_error::NO_SUCH_MEMORY_SPACE;
15361542         break;
15371543
r18027r18028
15451551         }
15461552         if (device == NULL)
15471553            device = debug_cpu_get_visible_cpu(machine);
1548         if (device->memory().space(AS_PROGRAM) == NULL)
1554         if (!device->memory().has_space(AS_PROGRAM))
15491555            return expression_error::NO_SUCH_MEMORY_SPACE;
15501556         break;
15511557
r18027r18028
16741680      // add entries to enable/disable unmap reporting for each space
16751681      if (m_memory != NULL)
16761682      {
1677         if (m_memory->space(AS_PROGRAM) != NULL)
1678            m_symtable.add("logunmap", (void *)m_memory->space(AS_PROGRAM), get_logunmap, set_logunmap);
1679         if (m_memory->space(AS_DATA) != NULL)
1680            m_symtable.add("logunmapd", (void *)m_memory->space(AS_DATA), get_logunmap, set_logunmap);
1681         if (m_memory->space(AS_IO) != NULL)
1682            m_symtable.add("logunmapi", (void *)m_memory->space(AS_IO), get_logunmap, set_logunmap);
1683         if (m_memory->has_space(AS_PROGRAM))
1684            m_symtable.add("logunmap", (void *)&m_memory->space(AS_PROGRAM), get_logunmap, set_logunmap);
1685         if (m_memory->has_space(AS_DATA))
1686            m_symtable.add("logunmapd", (void *)&m_memory->space(AS_DATA), get_logunmap, set_logunmap);
1687         if (m_memory->has_space(AS_IO))
1688            m_symtable.add("logunmapi", (void *)&m_memory->space(AS_IO), get_logunmap, set_logunmap);
16831689      }
16841690
16851691      // add all registers into it
r18027r18028
20392045#ifdef MAME_DEBUG
20402046if (m_memory != NULL && m_disasm != NULL)
20412047{
2042   address_space &space = *m_memory->space(AS_PROGRAM);
2048   address_space &space = m_memory->space(AS_PROGRAM);
20432049   int bytes = space.address_to_byte(result & DASMFLAG_LENGTHMASK);
20442050   assert(bytes >= m_disasm->min_opcode_bytes());
20452051   assert(bytes <= m_disasm->max_opcode_bytes());
r18027r18028
24672473   }
24682474
24692475   // update the watchpoint flags to include us
2470   if (m_memory != NULL && m_memory->space(AS_PROGRAM) != NULL)
2471      watchpoint_update_flags(*m_memory->space(AS_PROGRAM));
2476   if (m_memory != NULL && m_memory->has_space(AS_PROGRAM))
2477      watchpoint_update_flags(m_memory->space(AS_PROGRAM));
24722478}
24732479
24742480
r18027r18028
26662672      return 0;
26672673
26682674   // no program interface, just fail
2669   address_space &space = *m_memory->space(AS_PROGRAM);
2675   address_space &space = m_memory->space(AS_PROGRAM);
26702676
26712677   // zero out the buffers
26722678   UINT8 opbuf[64], argbuf[64];
r18027r18028
30163022   assert(m_memory != NULL && m_disasm != NULL);
30173023
30183024   // determine the adjusted PC
3019   address_space &space = *m_memory->space(AS_PROGRAM);
3025   address_space &space = m_memory->space(AS_PROGRAM);
30203026   offs_t pcbyte = space.address_to_byte(pc) & space.bytemask();
30213027
30223028   // fetch the bytes up to the maximum
trunk/src/emu/debug/dvmemory.c
r18027r18028
154154   // first add all the devices' address spaces
155155   memory_interface_iterator iter(machine().root_device());
156156   for (device_memory_interface *memintf = iter.first(); memintf != NULL; memintf = iter.next())
157      for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
158      {
159         address_space *space = memintf->space(spacenum);
160         if (space != NULL)
161         {
162            name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space->name());
163            m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *space)));
164         }
165      }
157      if (&memintf->device() != &machine().root_device())
158         for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
159            if (memintf->has_space(spacenum))
160            {
161               address_space &space = memintf->space(spacenum);
162               name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space.name());
163               m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, space)));
164            }
166165
167166   // then add all the memory regions
168167   for (memory_region *region = machine().memory().first_region(); region != NULL; region = region->next())
trunk/src/emu/debug/debugcpu.h
r18027r18028
146146
147147   // commonly-used pass-throughs
148148   offs_t pc() const { return (m_state != NULL) ? m_state->pc() : 0; }
149   int logaddrchars(address_spacenum spacenum = AS_0) const { return (m_memory != NULL && m_memory->space(spacenum) != NULL) ? m_memory->space(spacenum)->logaddrchars() : 8; }
149   int logaddrchars(address_spacenum spacenum = AS_0) const { return (m_memory != NULL && m_memory->has_space(spacenum)) ? m_memory->space(spacenum).logaddrchars() : 8; }
150150   int min_opcode_bytes() const { return (m_disasm != NULL) ? m_disasm->max_opcode_bytes() : 1; }
151151   int max_opcode_bytes() const { return (m_disasm != NULL) ? m_disasm->max_opcode_bytes() : 1; }
152152
trunk/src/emu/debug/dvdisasm.c
r18027r18028
5656   : debug_view_source(name, &device),
5757     m_device(device),
5858     m_disasmintf(dynamic_cast<device_disasm_interface *>(&device)),
59     m_space(dynamic_cast<device_memory_interface *>(&device)->space(AS_PROGRAM))
59     m_space(device.memory().space(AS_PROGRAM))
6060{
6161}
6262
r18027r18028
202202      case DCH_HOME:            // set the active column to the PC
203203      {
204204         const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
205         offs_t pc = source.m_space->address_to_byte(source.m_device.safe_pc()) & source.m_space->logbytemask();
205         offs_t pc = source.m_space.address_to_byte(source.m_device.safe_pc()) & source.m_space.logbytemask();
206206
207207         // figure out which row the pc is on
208208         for (int curline = 0; curline < m_allocated.y; curline++)
r18027r18028
241241   const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
242242
243243   // compute the increment
244   int minlen = source.m_space->byte_to_address(source.m_disasmintf->min_opcode_bytes());
244   int minlen = source.m_space.byte_to_address(source.m_disasmintf->min_opcode_bytes());
245245   if (minlen == 0) minlen = 1;
246   int maxlen = source.m_space->byte_to_address(source.m_disasmintf->max_opcode_bytes());
246   int maxlen = source.m_space.byte_to_address(source.m_disasmintf->max_opcode_bytes());
247247   if (maxlen == 0) maxlen = 1;
248248
249249   // start off numinstrs back
r18027r18028
252252      curpc = 0;
253253
254254   /* loop until we find what we are looking for */
255   offs_t targetpcbyte = source.m_space->address_to_byte(targetpc) & source.m_space->logbytemask();
255   offs_t targetpcbyte = source.m_space.address_to_byte(targetpc) & source.m_space.logbytemask();
256256   offs_t fillpcbyte = targetpcbyte;
257257   offs_t lastgoodpc = targetpc;
258258   while (1)
259259   {
260260      // fill the buffer up to the target
261      offs_t curpcbyte = source.m_space->address_to_byte(curpc) & source.m_space->logbytemask();
261      offs_t curpcbyte = source.m_space.address_to_byte(curpc) & source.m_space.logbytemask();
262262      UINT8 opbuf[1024], argbuf[1024];
263263      while (curpcbyte < fillpcbyte)
264264      {
265265         fillpcbyte--;
266         opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(*source.m_space, fillpcbyte, 1, FALSE);
267         argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(*source.m_space, fillpcbyte, 1, TRUE);
266         opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1, FALSE);
267         argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1, TRUE);
268268      }
269269
270270      // loop until we get past the target instruction
r18027r18028
273273      offs_t scanpc;
274274      for (scanpc = curpc; scanpc < targetpc; scanpc += instlen)
275275      {
276         offs_t scanpcbyte = source.m_space->address_to_byte(scanpc) & source.m_space->logbytemask();
276         offs_t scanpcbyte = source.m_space.address_to_byte(scanpc) & source.m_space.logbytemask();
277277         offs_t physpcbyte = scanpcbyte;
278278
279279         // get the disassembly, but only if mapped
280280         instlen = 1;
281         if (debug_cpu_translate(*source.m_space, TRANSLATE_FETCH, &physpcbyte))
281         if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH, &physpcbyte))
282282         {
283283            char dasmbuffer[100];
284284            instlen = source.m_device.debug()->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
r18027r18028
322322   // output the first value
323323   int offset = 0;
324324   if (maxchars >= char_num * minbytes)
325      offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(*source.m_space, pcbyte, minbytes, FALSE), minbytes * char_num, source.is_octal()));
325      offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_space, pcbyte, minbytes, FALSE), minbytes * char_num, source.is_octal()));
326326
327327   // output subsequent values
328328   int byte;
329329   for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes)
330      offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(*source.m_space, pcbyte + byte, minbytes, encrypted), minbytes * char_num, source.is_octal()));
330      offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(source.m_space, pcbyte + byte, minbytes, encrypted), minbytes * char_num, source.is_octal()));
331331
332332   // if we ran out of room, indicate more
333333   string[maxchars - 1] = 0;
r18027r18028
348348   int char_num =  source.is_octal() ? 3 : 2;
349349
350350   // determine how many characters we need for an address and set the divider
351   m_divider1 = 1 + (source.m_space->logaddrchars()/2*char_num) + 1;
351   m_divider1 = 1 + (source.m_space.logaddrchars()/2*char_num) + 1;
352352
353353   // assume a fixed number of characters for the disassembly
354354   m_divider2 = m_divider1 + 1 + m_dasm_width + 1;
r18027r18028
358358   int maxbytes = source.m_disasmintf->max_opcode_bytes();
359359
360360   // ensure that the PC is aligned to the minimum opcode size
361   pc &= ~source.m_space->byte_to_address_end(minbytes - 1);
361   pc &= ~source.m_space.byte_to_address_end(minbytes - 1);
362362
363363   // set the width of the third column according to display mode
364364   if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
r18027r18028
390390   for (int line = 0; line < lines; line++)
391391   {
392392      // convert PC to a byte offset
393      offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask();
393      offs_t pcbyte = source.m_space.address_to_byte(pc) & source.m_space.logbytemask();
394394
395395      // save a copy of the previous line as a backup if we're only doing one line
396396      int instr = startline + line;
r18027r18028
401401
402402      // convert back and set the address of this instruction
403403      m_byteaddress[instr] = pcbyte;
404      sprintf(&destbuf[0], " %s  ", core_i64_format(source.m_space->byte_to_address(pcbyte), source.m_space->logaddrchars()/2*char_num, source.is_octal()));
404      sprintf(&destbuf[0], " %s  ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.is_octal()));
405405
406406      // make sure we can translate the address, and then disassemble the result
407407      char buffer[100];
408408      int numbytes = 0;
409409      offs_t physpcbyte = pcbyte;
410      if (debug_cpu_translate(*source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
410      if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
411411      {
412412         UINT8 opbuf[64], argbuf[64];
413413
414414         // fetch the bytes up to the maximum
415415         for (numbytes = 0; numbytes < maxbytes; numbytes++)
416416         {
417            opbuf[numbytes] = debug_read_opcode(*source.m_space, pcbyte + numbytes, 1, FALSE);
418            argbuf[numbytes] = debug_read_opcode(*source.m_space, pcbyte + numbytes, 1, TRUE);
417            opbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1, FALSE);
418            argbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1, TRUE);
419419         }
420420
421421         // disassemble the result
422         pc += numbytes = source.m_device.debug()->disassemble(buffer, pc & source.m_space->logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK;
422         pc += numbytes = source.m_device.debug()->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK;
423423      }
424424      else
425425         strcpy(buffer, "<unmapped>");
r18027r18028
431431      if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
432432      {
433433         // get the bytes
434         numbytes = source.m_space->address_to_byte(numbytes) & source.m_space->logbytemask();
434         numbytes = source.m_space.address_to_byte(numbytes) & source.m_space.logbytemask();
435435         generate_bytes(pcbyte, numbytes, minbytes, &destbuf[m_divider2], m_allocated.x - m_divider2, m_right_column == DASM_RIGHTCOL_ENCRYPTED);
436436      }
437437      else if (m_right_column == DASM_RIGHTCOL_COMMENTS)
438438      {
439439         // get and add the comment, if present
440         offs_t comment_address = source.m_space->byte_to_address(m_byteaddress[instr]);
440         offs_t comment_address = source.m_space.byte_to_address(m_byteaddress[instr]);
441441         const char *text = source.m_device.debug()->comment_text(comment_address);
442442         if (text != NULL)
443443            sprintf(&destbuf[m_divider2], "// %.*s", m_allocated.x - m_divider2 - 1, text);
r18027r18028
449449   }
450450
451451   // update opcode base information
452   m_last_direct_decrypted = source.m_space->direct().decrypted();
453   m_last_direct_raw = source.m_space->direct().raw();
452   m_last_direct_decrypted = source.m_space.direct().decrypted();
453   m_last_direct_raw = source.m_space.direct().raw();
454454   m_last_change_count = source.m_device.debug()->comment_change_count();
455455
456456   // now longer need to recompute
r18027r18028
469469   const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
470470
471471   offs_t pc = source.m_device.safe_pc();
472   offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask();
472   offs_t pcbyte = source.m_space.address_to_byte(pc) & source.m_space.logbytemask();
473473
474474   // update our context; if the expression is dirty, recompute
475475   if (m_expression.dirty())
r18027r18028
480480   UINT64 result = m_expression.value();
481481   if (result != previous)
482482   {
483      offs_t resultbyte = source.m_space->address_to_byte(result) & source.m_space->logbytemask();
483      offs_t resultbyte = source.m_space.address_to_byte(result) & source.m_space.logbytemask();
484484
485485      // see if the new result is an address we already have
486486      UINT32 row;
r18027r18028
498498   }
499499
500500   // if the opcode base has changed, rework things
501   if (source.m_space->direct().decrypted() != m_last_direct_decrypted || source.m_space->direct().raw() != m_last_direct_raw)
501   if (source.m_space.direct().decrypted() != m_last_direct_decrypted || source.m_space.direct().raw() != m_last_direct_raw)
502502      m_recompute = true;
503503
504504   // if the comments have changed, redo it
r18027r18028
517517         m_topleft.x = 0;
518518
519519         // recompute from where we last recomputed!
520         recompute(source.m_space->byte_to_address(m_byteaddress[0]), 0, m_total.y);
520         recompute(source.m_space.byte_to_address(m_byteaddress[0]), 0, m_total.y);
521521      }
522522      else
523523      {
r18027r18028
579579         else
580580         {
581581            for (device_debug::breakpoint *bp = source.m_device.debug()->breakpoint_first(); bp != NULL; bp = bp->next())
582               if (m_byteaddress[effrow] == (source.m_space->address_to_byte(bp->address()) & source.m_space->logbytemask()))
582               if (m_byteaddress[effrow] == (source.m_space.address_to_byte(bp->address()) & source.m_space.logbytemask()))
583583                  attrib = DCA_CHANGED;
584584         }
585585
r18027r18028
627627offs_t debug_view_disasm::selected_address()
628628{
629629   flush_updates();
630   return downcast<const debug_view_disasm_source &>(*m_source).m_space->byte_to_address(m_byteaddress[m_cursor.y]);
630   return downcast<const debug_view_disasm_source &>(*m_source).m_space.byte_to_address(m_byteaddress[m_cursor.y]);
631631}
632632
633633
r18027r18028
695695void debug_view_disasm::set_selected_address(offs_t address)
696696{
697697   const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
698   offs_t byteaddress = source.m_space->address_to_byte(address) & source.m_space->logbytemask();
698   offs_t byteaddress = source.m_space.address_to_byte(address) & source.m_space.logbytemask();
699699   for (int line = 0; line < m_total.y; line++)
700700      if (m_byteaddress[line] == byteaddress)
701701      {
trunk/src/emu/debug/debugcmd.c
r18027r18028
566566      return FALSE;
567567
568568   /* fetch the space pointer */
569   result = cpu->memory().space(spacenum);
570   if (result == NULL)
569   if (!cpu->memory().has_space(spacenum))
571570   {
572571      debug_console_printf(machine, "No matching memory space found for CPU '%s'\n", cpu->tag());
573572      return FALSE;
574573   }
574   result = &cpu->memory().space(spacenum);
575575   return TRUE;
576576}
577577
trunk/src/emu/debug/dvdisasm.h
r18027r18028
7373public:
7474   // getters
7575   device_t &device() const { return m_device; }
76   address_space *space() const { return m_space; }
76   address_space &space() const { return m_space; }
7777
7878private:
7979   // internal state
8080   device_t &         m_device;            // underlying device
8181   device_disasm_interface *m_disasmintf;      // disassembly interface
82   address_space *      m_space;            // address space to display
82   address_space &      m_space;            // address space to display
8383};
8484
8585
trunk/src/emu/cpu/m6805/m6805.c
r18027r18028
479479   state_register(cpustate, "m6805", device);
480480   cpustate->irq_callback = irqcallback;
481481   cpustate->device = device;
482   cpustate->program = device->space(AS_PROGRAM);
482   cpustate->program = &device->space(AS_PROGRAM);
483483   cpustate->direct = &cpustate->program->direct();
484484}
485485
r18027r18028
493493   cpustate->iCount=50000;      /* Used to be global */
494494   cpustate->irq_callback = save_irqcallback;
495495   cpustate->device = device;
496   cpustate->program = device->space(AS_PROGRAM);
496   cpustate->program = &device->space(AS_PROGRAM);
497497   cpustate->direct = &cpustate->program->direct();
498498
499499   /* Force CPU sub-type and relevant masks */
trunk/src/emu/cpu/v30mz/v30mz.c
r18027r18028
130130void v30mz_cpu_device::device_start()
131131{
132132   m_irq_callback = static_standard_irq_callback;
133   m_program = space(AS_PROGRAM);
133   m_program = &space(AS_PROGRAM);
134134   m_direct = &m_program->direct();
135   m_io = space(AS_IO);
135   m_io = &space(AS_IO);
136136
137137   save_item(NAME(m_regs.w));
138138   save_item(NAME(m_sregs));
trunk/src/emu/cpu/lh5801/lh5801.c
r18027r18028
117117   memset(cpustate, 0, sizeof(*cpustate));
118118   cpustate->config = (const lh5801_cpu_core *) device->static_config();
119119   cpustate->device = device;
120   cpustate->program = device->space(AS_PROGRAM);
121   cpustate->io = device->space(AS_IO);
120   cpustate->program = &device->space(AS_PROGRAM);
121   cpustate->io = &device->space(AS_IO);
122122   cpustate->direct = &cpustate->program->direct();
123123}
124124
trunk/src/emu/cpu/m6809/m6809.c
r18027r18028
377377   m68_state->irq_callback = irqcallback;
378378   m68_state->device = device;
379379
380   m68_state->program = device->space(AS_PROGRAM);
380   m68_state->program = &device->space(AS_PROGRAM);
381381   m68_state->direct = &m68_state->program->direct();
382382
383383   /* setup regtable */
trunk/src/emu/cpu/h83002/h8_16.c
r18027r18028
217217
218218   h8->mode_8bit = 0;
219219
220   h8->program = device->space(AS_PROGRAM);
220   h8->program = &device->space(AS_PROGRAM);
221221   h8->direct = &h8->program->direct();
222   h8->io = device->space(AS_IO);
222   h8->io = &device->space(AS_IO);
223223
224224   device->save_item(NAME(h8->h8err));
225225   device->save_item(NAME(h8->regs));
trunk/src/emu/cpu/h83002/h8_8.c
r18027r18028
234234
235235   h8->mode_8bit = 1;
236236
237   h8->program = device->space(AS_PROGRAM);
237   h8->program = &device->space(AS_PROGRAM);
238238   h8->direct = &h8->program->direct();
239   h8->io = device->space(AS_IO);
239   h8->io = &device->space(AS_IO);
240240
241241   h8->timer[0] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_0_cb), h8);
242242   h8->timer[1] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_1_cb), h8);
trunk/src/emu/cpu/tms0980/tms0980.c
r18027r18028
503503   cpustate->pc_size = pc_size;
504504   cpustate->byte_size = byte_size;
505505
506   cpustate->program = device->space( AS_PROGRAM );
507   cpustate->data = device->space( AS_PROGRAM );
506   cpustate->program = &device->space( AS_PROGRAM );
507   cpustate->data = &device->space( AS_PROGRAM );
508508
509509   device->save_item( NAME(cpustate->prev_pc) );
510510   device->save_item( NAME(cpustate->prev_pa) );
trunk/src/emu/cpu/pic16c62x/pic16c62x.c
r18027r18028
834834   pic16c62x_state *cpustate = get_safe_token(device);
835835
836836   cpustate->device = device;
837   cpustate->program = device->space(AS_PROGRAM);
837   cpustate->program = &device->space(AS_PROGRAM);
838838   cpustate->direct = &cpustate->program->direct();
839   cpustate->data = device->space(AS_DATA);
840   cpustate->io = device->space(AS_IO);
839   cpustate->data = &device->space(AS_DATA);
840   cpustate->io = &device->space(AS_IO);
841841
842842   cpustate->CONFIG = 0x3fff;
843843
trunk/src/emu/cpu/unsp/unsp.c
r18027r18028
114114    memset(unsp->r, 0, sizeof(UINT16) * UNSP_GPR_COUNT);
115115
116116    unsp->device = device;
117    unsp->program = device->space(AS_PROGRAM);
117    unsp->program = &device->space(AS_PROGRAM);
118118}
119119
120120static CPU_RESET( unsp )
trunk/src/emu/cpu/am29000/am29000.c
r18027r18028
154154{
155155   am29000_state *am29000 = get_safe_token(device);
156156
157   am29000->program = device->space(AS_PROGRAM);
157   am29000->program = &device->space(AS_PROGRAM);
158158   am29000->direct = &am29000->program->direct();
159   am29000->data = device->space(AS_DATA);
159   am29000->data = &device->space(AS_DATA);
160160   am29000->datadirect = &am29000->data->direct();
161   am29000->io = device->space(AS_IO);
161   am29000->io = &device->space(AS_IO);
162162   am29000->cfg = (PRL_AM29000 | PRL_REV_D) << CFG_PRL_SHIFT;
163163
164164   /* Register state for saving */
trunk/src/emu/cpu/m68000/m68kcpu.c
r18027r18028
898898   m68ki_cpu_core *m68k = m68k_get_safe_token(device);
899899
900900   m68k->device = device;
901   m68k->program = device->space(AS_PROGRAM);
901   m68k->program = &device->space(AS_PROGRAM);
902902   m68k->int_ack_callback = irqcallback;
903903
904904   /* disable all MMUs */
r18027r18028
20652065   m68k->m68307SERIAL->reset();
20662066   m68k->m68307TIMER->reset();
20672067
2068   m68k->internal = device->space(AS_PROGRAM);
2068   m68k->internal = &device->space(AS_PROGRAM);
20692069   m68k->m68307_base = 0xbfff;
20702070   m68k->m68307_scrhigh = 0x0007;
20712071   m68k->m68307_scrlow = 0xf010;
r18027r18028
28622862
28632863   m68k->m68340_base = 0x00000000;
28642864
2865   m68k->internal = device->space(AS_PROGRAM);
2865   m68k->internal = &device->space(AS_PROGRAM);
28662866
28672867   define_state(device);
28682868}
trunk/src/emu/cpu/ccpu/ccpu.c
r18027r18028
130130   cpustate->external_input = configdata->external_input ? configdata->external_input : read_jmi;
131131   cpustate->vector_callback = configdata->vector_callback;
132132   cpustate->device = device;
133   cpustate->program = device->space(AS_PROGRAM);
133   cpustate->program = &device->space(AS_PROGRAM);
134134   cpustate->direct = &cpustate->program->direct();
135   cpustate->data = device->space(AS_DATA);
136   cpustate->io = device->space(AS_IO);
135   cpustate->data = &device->space(AS_DATA);
136   cpustate->io = &device->space(AS_IO);
137137
138138   device->save_item(NAME(cpustate->PC));
139139   device->save_item(NAME(cpustate->A));
trunk/src/emu/cpu/tms34010/tms34010.c
r18027r18028
626626   tms->config = configdata;
627627   tms->irq_callback = irqcallback;
628628   tms->device = device;
629   tms->program = device->space(AS_PROGRAM);
629   tms->program = &device->space(AS_PROGRAM);
630630   tms->direct = &tms->program->direct();
631631   tms->screen = downcast<screen_device *>(device->machine().device(configdata->screen_tag));
632632
r18027r18028
688688   tms->irq_callback = save_irqcallback;
689689   tms->scantimer = save_scantimer;
690690   tms->device = device;
691   tms->program = device->space(AS_PROGRAM);
691   tms->program = &device->space(AS_PROGRAM);
692692   tms->direct = &tms->program->direct();
693693
694694   /* fetch the initial PC and reset the state */
r18027r18028
699699   /* the first time we are run */
700700   tms->reset_deferred = tms->config->halt_on_reset;
701701   if (tms->config->halt_on_reset)
702      tms34010_io_register_w(*device->space(AS_PROGRAM), REG_HSTCTLH, 0x8000, 0xffff);
702      tms34010_io_register_w(device->space(AS_PROGRAM), REG_HSTCTLH, 0x8000, 0xffff);
703703}
704704
705705
r18027r18028
16301630      case TMS34010_HOST_CONTROL:
16311631      {
16321632         tms->external_host_access = TRUE;
1633         address_space &space = *tms->device->space(AS_PROGRAM);
1633         address_space &space = tms->device->space(AS_PROGRAM);
16341634         tms34010_io_register_w(space, REG_HSTCTLH, data & 0xff00, 0xffff);
16351635         tms34010_io_register_w(space, REG_HSTCTLL, data & 0x00ff, 0xffff);
16361636         tms->external_host_access = FALSE;
trunk/src/emu/cpu/tms32031/tms32031.c
r18027r18028
368368void tms3203x_device::device_start()
369369{
370370   // find address spaces
371   m_program = space(AS_PROGRAM);
371   m_program = &space(AS_PROGRAM);
372372   m_direct = &m_program->direct();
373373
374374   // save state
trunk/src/emu/cpu/superfx/superfx.c
r18027r18028
751751   superfx_update_speed(cpustate);
752752
753753   cpustate->device = device;
754   cpustate->program = device->space(AS_PROGRAM);
754   cpustate->program = &device->space(AS_PROGRAM);
755755
756756   if (device->static_config() != NULL)
757757   {
trunk/src/emu/cpu/m37710/m37710.c
r18027r18028
978978
979979   INT_ACK = irqcallback;
980980   cpustate->device = device;
981   cpustate->program = device->space(AS_PROGRAM);
982   cpustate->io = device->space(AS_IO);
981   cpustate->program = &device->space(AS_PROGRAM);
982   cpustate->io = &device->space(AS_IO);
983983
984984   cpustate->ICount = 0;
985985
trunk/src/emu/cpu/mcs48/mcs48.c
r18027r18028
858858   cpustate->int_rom_size = romsize;
859859   cpustate->feature_mask = feature_mask;
860860
861   cpustate->program = device->space(AS_PROGRAM);
861   cpustate->program = &device->space(AS_PROGRAM);
862862   cpustate->direct = &cpustate->program->direct();
863   cpustate->data = device->space(AS_DATA);
864   cpustate->io = device->space(AS_IO);
863   cpustate->data = &device->space(AS_DATA);
864   cpustate->io = &device->space(AS_IO);
865865
866866   /* set up the state table */
867867   {
trunk/src/emu/cpu/sharc/sharc.c
r18027r18028
425425
426426   cpustate->irq_callback = irqcallback;
427427   cpustate->device = device;
428   cpustate->program = device->space(AS_PROGRAM);
429   cpustate->data = device->space(AS_DATA);
428   cpustate->program = &device->space(AS_PROGRAM);
429   cpustate->data = &device->space(AS_DATA);
430430
431431   build_opcode_table();
432432
trunk/src/emu/cpu/tms57002/tms57002.c
r18027r18028
787787void tms57002_device::device_start()
788788{
789789   sti = S_IDLE;
790   program = space(AS_PROGRAM);
791   data    = space(AS_DATA);
790   program = &space(AS_PROGRAM);
791   data    = &space(AS_DATA);
792792
793793   state_add(STATE_GENPC,"GENPC", pc).noshow();
794794
trunk/src/emu/cpu/z180/z180.c
r18027r18028
22122212   cpustate->irq_state[2] = CLEAR_LINE;
22132213   cpustate->after_EI = 0;
22142214   cpustate->ea = 0;
2215   cpustate->program = device->space(AS_PROGRAM);
2215   cpustate->program = &device->space(AS_PROGRAM);
22162216   cpustate->direct = &cpustate->program->direct();
2217   cpustate->iospace = device->space(AS_IO);
2217   cpustate->iospace = &device->space(AS_IO);
22182218   cpustate->device = device;
22192219
22202220   memcpy(cpustate->cc, (UINT8 *)cc_default, sizeof(cpustate->cc));
trunk/src/emu/cpu/i86/i86.c
r18027r18028
165165
166166   cpustate->irq_callback = irqcallback;
167167   cpustate->device = device;
168   cpustate->program = device->space(AS_PROGRAM);
168   cpustate->program = &device->space(AS_PROGRAM);
169169   cpustate->direct = &cpustate->program->direct();
170   cpustate->io = device->space(AS_IO);
170   cpustate->io = &device->space(AS_IO);
171171
172172   /* set up the state table */
173173   {
r18027r18028
236236   memset(cpustate, 0, sizeof(*cpustate));
237237   cpustate->irq_callback = save_irqcallback;
238238   cpustate->device = device;
239   cpustate->program = device->space(AS_PROGRAM);
239   cpustate->program = &device->space(AS_PROGRAM);
240240   cpustate->direct = &cpustate->program->direct();
241   cpustate->io = device->space(AS_IO);
241   cpustate->io = &device->space(AS_IO);
242242
243243   cpustate->sregs[CS] = 0xffff;
244244   cpustate->base[CS] = SegBase(CS);
trunk/src/emu/cpu/i86/i286.c
r18027r18028
310310
311311   cpustate->irq_callback = irqcallback;
312312   cpustate->device = device;
313   cpustate->program = device->space(AS_PROGRAM);
314   cpustate->io = device->space(AS_IO);
313   cpustate->program = &device->space(AS_PROGRAM);
314   cpustate->io = &device->space(AS_IO);
315315   cpustate->direct = &cpustate->program->direct();
316316
317317   /* If a reset parameter is given, take it as pointer to an address mask */
trunk/src/emu/cpu/drcuml.c
r18027r18028
121121   device_memory_interface *memory;
122122   if (device.interface(memory))
123123      for (address_spacenum spacenum = AS_0; spacenum < ARRAY_LENGTH(m_space); spacenum++)
124      {
125         m_space[spacenum] = memory->space(spacenum);
126         if (m_space[spacenum] != NULL)
124         if (memory->has_space(spacenum))
125         {
126            m_space[spacenum] = &memory->space(spacenum);
127127            m_space[spacenum]->accessors(m_accessors[spacenum]);
128      }
128         }
129129}
130130
131131
trunk/src/emu/cpu/cubeqcpu/cubeqcpu.c
r18027r18028
282282   cpustate->sound_data = (UINT16*)device->machine().root_device().memregion(_config->sound_data_region)->base();
283283
284284   cpustate->device = device;
285   cpustate->program = device->space(AS_PROGRAM);
285   cpustate->program = &device->space(AS_PROGRAM);
286286   cpustate->direct = &cpustate->program->direct();
287287
288288   /* Allocate RAM shared with 68000 */
r18027r18028
350350
351351   cpustate->device = device;
352352   cpustate->lindevice = device->machine().device<legacy_cpu_device>(rotconfig->lin_cpu_tag);
353   cpustate->program = device->space(AS_PROGRAM);
353   cpustate->program = &device->space(AS_PROGRAM);
354354   cpustate->direct = &cpustate->program->direct();
355355
356356   cquestrot_state_register(device);
r18027r18028
429429
430430   cpustate->device = device;
431431   cpustate->rotdevice = device->machine().device<legacy_cpu_device>(linconfig->rot_cpu_tag);
432   cpustate->program = device->space(AS_PROGRAM);
432   cpustate->program = &device->space(AS_PROGRAM);
433433   cpustate->direct = &cpustate->program->direct();
434434
435435   cquestlin_state_register(device);
trunk/src/emu/cpu/upd7810/upd7810.c
r18027r18028
17021702   cpustate->config = *(const UPD7810_CONFIG*) device->static_config();
17031703   cpustate->irq_callback = irqcallback;
17041704   cpustate->device = device;
1705   cpustate->program = device->space(AS_PROGRAM);
1705   cpustate->program = &device->space(AS_PROGRAM);
17061706   cpustate->direct = &cpustate->program->direct();
1707   cpustate->io = device->space(AS_IO);
1707   cpustate->io = &device->space(AS_IO);
17081708
17091709   device->save_item(NAME(cpustate->ppc.w.l));
17101710   device->save_item(NAME(cpustate->pc.w.l));
r18027r18028
17871787   cpustate->config = save_config;
17881788   cpustate->irq_callback = save_irqcallback;
17891789   cpustate->device = device;
1790   cpustate->program = device->space(AS_PROGRAM);
1790   cpustate->program = &device->space(AS_PROGRAM);
17911791   cpustate->direct = &cpustate->program->direct();
1792   cpustate->io = device->space(AS_IO);
1792   cpustate->io = &device->space(AS_IO);
17931793
17941794   cpustate->opXX = opXX_7810;
17951795   cpustate->op48 = op48;
trunk/src/emu/cpu/drcfe.h
r18027r18028
180180
181181   // CPU parameters
182182   cpu_device &      m_cpudevice;            // CPU device object
183   address_space *      m_program;               // program address space for this CPU
183   address_space &      m_program;               // program address space for this CPU
184184   offs_t            m_pageshift;            // shift to convert address to a page index
185185
186186   // opcode descriptor arrays
trunk/src/emu/cpu/sc61860/sc61860.c
r18027r18028
105105   cpustate->config = (sc61860_cpu_core *) device->static_config();
106106   device->machine().scheduler().timer_pulse(attotime::from_hz(500), FUNC(sc61860_2ms_tick), 0, cpustate);
107107   cpustate->device = device;
108   cpustate->program = device->space(AS_PROGRAM);
108   cpustate->program = &device->space(AS_PROGRAM);
109109   cpustate->direct = &cpustate->program->direct();
110110}
111111
trunk/src/emu/cpu/v60/v60.c
r18027r18028
353353   cpustate->fetch_xor = BYTE_XOR_LE(0);
354354   cpustate->start_pc = 0xfffff0;
355355   cpustate->device = device;
356   cpustate->program = device->space(AS_PROGRAM);
356   cpustate->program = &device->space(AS_PROGRAM);
357357   cpustate->direct = &cpustate->program->direct();
358   cpustate->io = device->space(AS_IO);
358   cpustate->io = &device->space(AS_IO);
359359}
360360
361361static CPU_INIT( v70 )
r18027r18028
369369   cpustate->fetch_xor = BYTE4_XOR_LE(0);
370370   cpustate->start_pc = 0xfffffff0;
371371   cpustate->device = device;
372   cpustate->program = device->space(AS_PROGRAM);
372   cpustate->program = &device->space(AS_PROGRAM);
373373   cpustate->direct = &cpustate->program->direct();
374   cpustate->io = device->space(AS_IO);
374   cpustate->io = &device->space(AS_IO);
375375}
376376
377377static CPU_RESET( v60 )
trunk/src/emu/cpu/minx/minx.c
r18027r18028
119119   minx_state *minx = get_safe_token(device);
120120   minx->irq_callback = irqcallback;
121121   minx->device = device;
122   minx->program = device->space(AS_PROGRAM);
122   minx->program = &device->space(AS_PROGRAM);
123123   if ( device->static_config() != NULL )
124124   {
125125   }
trunk/src/emu/cpu/dsp56k/dsp56k.c
r18027r18028
232232   //cpustate->config = device->static_config();
233233   //cpustate->irq_callback = irqcallback;
234234   cpustate->device = device;
235   cpustate->program = device->space(AS_PROGRAM);
235   cpustate->program = &device->space(AS_PROGRAM);
236236   cpustate->direct = &cpustate->program->direct();
237   cpustate->data = device->space(AS_DATA);
237   cpustate->data = &device->space(AS_DATA);
238238
239239   /* Setup the direct memory handler for this CPU */
240240   /* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */
trunk/src/emu/cpu/spc700/spc700.c
r18027r18028
12861286
12871287   INT_ACK = irqcallback;
12881288   cpustate->device = device;
1289   cpustate->program = device->space(AS_PROGRAM);
1289   cpustate->program = &device->space(AS_PROGRAM);
12901290}
12911291
12921292
trunk/src/emu/cpu/ssp1601/ssp1601.c
r18027r18028
528528   memset(ssp1601_state, 0, sizeof(ssp1601_state_t));
529529   ssp1601_state->gr[0].w.h = 0xffff; // constant reg
530530   ssp1601_state->device = device;
531   ssp1601_state->program = device->space(AS_PROGRAM);
531   ssp1601_state->program = &device->space(AS_PROGRAM);
532532   ssp1601_state->direct = &ssp1601_state->program->direct();
533   ssp1601_state->io = device->space(AS_IO);
533   ssp1601_state->io = &device->space(AS_IO);
534534
535535}
536536
trunk/src/emu/cpu/hd6309/hd6309.c
r18027r18028
518518   m68_state->irq_callback = irqcallback;
519519   m68_state->device = device;
520520
521   m68_state->program = device->space(AS_PROGRAM);
521   m68_state->program = &device->space(AS_PROGRAM);
522522   m68_state->direct = &m68_state->program->direct();
523523
524524   /* setup regtable */
trunk/src/emu/cpu/tlcs90/tlcs90.c
r18027r18028
27132713   memset(cpustate, 0, sizeof(t90_Regs));
27142714   cpustate->irq_callback = irqcallback;
27152715   cpustate->device = device;
2716   cpustate->program = device->space(AS_PROGRAM);
2717   cpustate->io = device->space(AS_IO);
2716   cpustate->program = &device->space(AS_PROGRAM);
2717   cpustate->io = &device->space(AS_IO);
27182718
27192719   cpustate->timer_period = attotime::from_hz(device->unscaled_clock()) * 8;
27202720
trunk/src/emu/cpu/s2650/s2650.c
r18027r18028
795795
796796   s2650c->irq_callback = irqcallback;
797797   s2650c->device = device;
798   s2650c->program = device->space(AS_PROGRAM);
798   s2650c->program = &device->space(AS_PROGRAM);
799799   s2650c->direct = &s2650c->program->direct();
800   s2650c->io = device->space(AS_IO);
800   s2650c->io = &device->space(AS_IO);
801801
802802   device->save_item(NAME(s2650c->ppc));
803803   device->save_item(NAME(s2650c->page));
r18027r18028
828828   memset(s2650c->ras, 0, sizeof(s2650c->ras));
829829
830830   s2650c->device = device;
831   s2650c->program = device->space(AS_PROGRAM);
831   s2650c->program = &device->space(AS_PROGRAM);
832832   s2650c->direct = &s2650c->program->direct();
833   s2650c->io = device->space(AS_IO);
833   s2650c->io = &device->space(AS_IO);
834834   s2650c->psl = COM | WC;
835835   /* force write */
836836   s2650c->psu = 0xff;
trunk/src/emu/cpu/avr8/avr8.c
r18027r18028
188188    cpustate->pc = 0;
189189
190190    cpustate->device = device;
191    cpustate->program = device->space(AS_PROGRAM);
192    cpustate->io = device->space(AS_IO);
191    cpustate->program = &device->space(AS_PROGRAM);
192    cpustate->io = &device->space(AS_IO);
193193
194194    WRITE_IO_8(cpustate, AVR8_IO_SREG, 0);
195195
trunk/src/emu/cpu/se3208/se3208.c
r18027r18028
17171717   memset(se3208_state,0,sizeof(se3208_state_t));
17181718   se3208_state->irq_callback = save_irqcallback;
17191719   se3208_state->device = device;
1720   se3208_state->program = device->space(AS_PROGRAM);
1720   se3208_state->program = &device->space(AS_PROGRAM);
17211721   se3208_state->direct = &se3208_state->program->direct();
17221722   se3208_state->PC=SE3208_Read32(se3208_state, 0);
17231723   se3208_state->SR=0;
r18027r18028
17881788
17891789   se3208_state->irq_callback = irqcallback;
17901790   se3208_state->device = device;
1791   se3208_state->program = device->space(AS_PROGRAM);
1791   se3208_state->program = &device->space(AS_PROGRAM);
17921792   se3208_state->direct = &se3208_state->program->direct();
17931793}
17941794
trunk/src/emu/cpu/e132xs/e132xs.c
r18027r18028
15421542
15431543   cpustate->irq_callback = irqcallback;
15441544   cpustate->device = device;
1545   cpustate->program = device->space(AS_PROGRAM);
1545   cpustate->program = &device->space(AS_PROGRAM);
15461546   cpustate->direct = &cpustate->program->direct();
1547   cpustate->io = device->space(AS_IO);
1547   cpustate->io = &device->space(AS_IO);
15481548   cpustate->timer = device->machine().scheduler().timer_alloc(FUNC(e132xs_timer_callback), (void *)device);
15491549   cpustate->clock_scale_mask = scale_mask;
15501550}
r18027r18028
16501650   cpustate->irq_callback = save_irqcallback;
16511651   cpustate->opcodexor = save_opcodexor;
16521652   cpustate->device = device;
1653   cpustate->program = device->space(AS_PROGRAM);
1653   cpustate->program = &device->space(AS_PROGRAM);
16541654   cpustate->direct = &cpustate->program->direct();
1655   cpustate->io = device->space(AS_IO);
1655   cpustate->io = &device->space(AS_IO);
16561656   cpustate->timer = save_timer;
16571657
16581658   cpustate->tr_clocks_per_tick = 2;
trunk/src/emu/cpu/i860/i860.c
r18027r18028
3030{
3131   i860_state_t *cpustate = get_safe_token(device);
3232   cpustate->device = device;
33   cpustate->program = device->space(AS_PROGRAM);
33   cpustate->program = &device->space(AS_PROGRAM);
3434   reset_i860(cpustate);
3535   i860_set_pin(device, DEC_PIN_BUS_HOLD, 0);
3636   i860_set_pin(device, DEC_PIN_RESET, 0);
trunk/src/emu/cpu/mcs51/mcs51.c
r18027r18028
20752075   mcs51_state->irq_callback = irqcallback;
20762076   mcs51_state->device = device;
20772077
2078   mcs51_state->program = device->space(AS_PROGRAM);
2078   mcs51_state->program = &device->space(AS_PROGRAM);
20792079   mcs51_state->direct = &mcs51_state->program->direct();
2080   mcs51_state->data = device->space(AS_DATA);
2081   mcs51_state->io = device->space(AS_IO);
2080   mcs51_state->data = &device->space(AS_DATA);
2081   mcs51_state->io = &device->space(AS_IO);
20822082
20832083   mcs51_state->features = FEATURE_NONE;
20842084   mcs51_state->ram_mask = 0x7F;         /* 128 bytes of ram */
trunk/src/emu/cpu/i386/i386.c
r18027r18028
28822882
28832883   cpustate->irq_callback = irqcallback;
28842884   cpustate->device = device;
2885   cpustate->program = device->space(AS_PROGRAM);
2885   cpustate->program = &device->space(AS_PROGRAM);
28862886   cpustate->direct = &cpustate->program->direct();
2887   cpustate->io = device->space(AS_IO);
2887   cpustate->io = &device->space(AS_IO);
28882888
28892889   device->save_item(NAME(   cpustate->reg.d));
28902890   device->save_item(NAME(cpustate->sreg[ES].selector));
r18027r18028
30063006   memset( cpustate, 0, sizeof(*cpustate) );
30073007   cpustate->irq_callback = save_irqcallback;
30083008   cpustate->device = device;
3009   cpustate->program = device->space(AS_PROGRAM);
3009   cpustate->program = &device->space(AS_PROGRAM);
30103010   cpustate->direct = &cpustate->program->direct();
3011   cpustate->io = device->space(AS_IO);
3011   cpustate->io = &device->space(AS_IO);
30123012
30133013   cpustate->sreg[CS].selector = 0xf000;
30143014   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
34973497   memset( cpustate, 0, sizeof(*cpustate) );
34983498   cpustate->irq_callback = save_irqcallback;
34993499   cpustate->device = device;
3500   cpustate->program = device->space(AS_PROGRAM);
3500   cpustate->program = &device->space(AS_PROGRAM);
35013501   cpustate->direct = &cpustate->program->direct();
3502   cpustate->io = device->space(AS_IO);
3502   cpustate->io = &device->space(AS_IO);
35033503
35043504   cpustate->sreg[CS].selector = 0xf000;
35053505   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
36043604   memset( cpustate, 0, sizeof(*cpustate) );
36053605   cpustate->irq_callback = save_irqcallback;
36063606   cpustate->device = device;
3607   cpustate->program = device->space(AS_PROGRAM);
3607   cpustate->program = &device->space(AS_PROGRAM);
36083608   cpustate->direct = &cpustate->program->direct();
3609   cpustate->io = device->space(AS_IO);
3609   cpustate->io = &device->space(AS_IO);
36103610
36113611   cpustate->sreg[CS].selector = 0xf000;
36123612   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
37273727   memset( cpustate, 0, sizeof(*cpustate) );
37283728   cpustate->irq_callback = save_irqcallback;
37293729   cpustate->device = device;
3730   cpustate->program = device->space(AS_PROGRAM);
3730   cpustate->program = &device->space(AS_PROGRAM);
37313731   cpustate->direct = &cpustate->program->direct();
3732   cpustate->io = device->space(AS_IO);
3732   cpustate->io = &device->space(AS_IO);
37333733
37343734   cpustate->sreg[CS].selector = 0xf000;
37353735   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
38423842   memset( cpustate, 0, sizeof(*cpustate) );
38433843   cpustate->irq_callback = save_irqcallback;
38443844   cpustate->device = device;
3845   cpustate->program = device->space(AS_PROGRAM);
3845   cpustate->program = &device->space(AS_PROGRAM);
38463846   cpustate->direct = &cpustate->program->direct();
3847   cpustate->io = device->space(AS_IO);
3847   cpustate->io = &device->space(AS_IO);
38483848
38493849   cpustate->sreg[CS].selector = 0xf000;
38503850   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
39383938   memset( cpustate, 0, sizeof(*cpustate) );
39393939   cpustate->irq_callback = save_irqcallback;
39403940   cpustate->device = device;
3941   cpustate->program = device->space(AS_PROGRAM);
3941   cpustate->program = &device->space(AS_PROGRAM);
39423942   cpustate->direct = &cpustate->program->direct();
3943   cpustate->io = device->space(AS_IO);
3943   cpustate->io = &device->space(AS_IO);
39443944
39453945   cpustate->sreg[CS].selector = 0xf000;
39463946   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
40344034   memset( cpustate, 0, sizeof(*cpustate) );
40354035   cpustate->irq_callback = save_irqcallback;
40364036   cpustate->device = device;
4037   cpustate->program = device->space(AS_PROGRAM);
4037   cpustate->program = &device->space(AS_PROGRAM);
40384038   cpustate->direct = &cpustate->program->direct();
4039   cpustate->io = device->space(AS_IO);
4039   cpustate->io = &device->space(AS_IO);
40404040
40414041   cpustate->sreg[CS].selector = 0xf000;
40424042   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
41304130   memset( cpustate, 0, sizeof(*cpustate) );
41314131   cpustate->irq_callback = save_irqcallback;
41324132   cpustate->device = device;
4133   cpustate->program = device->space(AS_PROGRAM);
4133   cpustate->program = &device->space(AS_PROGRAM);
41344134   cpustate->direct = &cpustate->program->direct();
4135   cpustate->io = device->space(AS_IO);
4135   cpustate->io = &device->space(AS_IO);
41364136
41374137   cpustate->sreg[CS].selector = 0xf000;
41384138   cpustate->sreg[CS].base      = 0xffff0000;
r18027r18028
42264226   memset( cpustate, 0, sizeof(*cpustate) );
42274227   cpustate->irq_callback = save_irqcallback;
42284228   cpustate->device = device;
4229   cpustate->program = device->space(AS_PROGRAM);
4229   cpustate->program = &device->space(AS_PROGRAM);
42304230   cpustate->direct = &cpustate->program->direct();
4231   cpustate->io = device->space(AS_IO);
4231   cpustate->io = &device->space(AS_IO);
42324232
42334233   cpustate->sreg[CS].selector = 0xf000;
42344234   cpustate->sreg[CS].base      = 0xffff0000;
trunk/src/emu/cpu/mc68hc11/mc68hc11.c
r18027r18028
446446
447447   cpustate->irq_callback = irqcallback;
448448   cpustate->device = device;
449   cpustate->program = device->space(AS_PROGRAM);
449   cpustate->program = &device->space(AS_PROGRAM);
450450   cpustate->direct = &cpustate->program->direct();
451   cpustate->io = device->space(AS_IO);
451   cpustate->io = &device->space(AS_IO);
452452
453453   device->save_item(NAME(cpustate->pc));
454454   device->save_item(NAME(cpustate->ix));
trunk/src/emu/cpu/hcd62121/hcd62121.c
r18027r18028
316316
317317   cpustate->irq_callback = irqcallback;
318318   cpustate->device = device;
319   cpustate->program = device->space(AS_PROGRAM);
320   cpustate->io = device->space(AS_IO);
319   cpustate->program = &device->space(AS_PROGRAM);
320   cpustate->io = &device->space(AS_IO);
321321}
322322
323323
trunk/src/emu/cpu/adsp2100/adsp2100.c
r18027r18028
445445void adsp21xx_device::device_start()
446446{
447447   // get our address spaces
448   m_program = space(AS_PROGRAM);
448   m_program = &space(AS_PROGRAM);
449449   m_direct = &m_program->direct();
450   m_data = space(AS_DATA);
451   m_io = space(AS_IO);
450   m_data = &space(AS_DATA);
451   m_io = has_space(AS_IO) ? &space(AS_IO) : NULL;
452452
453453   // "core"
454454   save_item(NAME(m_core.ax0.u));
trunk/src/emu/cpu/dsp32/dsp32.c
r18027r18028
231231void dsp32c_device::device_start()
232232{
233233   // get our address spaces
234   m_program = space(AS_PROGRAM);
234   m_program = &space(AS_PROGRAM);
235235   m_direct = &m_program->direct();
236236
237237   // register our state for the debugger
trunk/src/emu/cpu/tlcs900/tlcs900.c
r18027r18028
222222   cpustate->intf = (const tlcs900_interface *)device->static_config();
223223   cpustate->irqcallback = irqcallback;
224224   cpustate->device = device;
225   cpustate->program = device->space( AS_PROGRAM );
225   cpustate->program = &device->space( AS_PROGRAM );
226226
227227   cpustate->to1.resolve(cpustate->intf->to1, *device );
228228   cpustate->to3.resolve(cpustate->intf->to3, *device );
trunk/src/emu/cpu/i4004/i4004.c
r18027r18028
462462
463463   cpustate->device = device;
464464
465   cpustate->program = device->space(AS_PROGRAM);
465   cpustate->program = &device->space(AS_PROGRAM);
466466   cpustate->direct = &cpustate->program->direct();
467   cpustate->data = device->space(AS_DATA);
468   cpustate->io = device->space(AS_IO);
467   cpustate->data = &device->space(AS_DATA);
468   cpustate->io = &device->space(AS_IO);
469469
470470   device->save_item(NAME(cpustate->PC));
471471   device->save_item(NAME(cpustate->A));
trunk/src/emu/cpu/scmp/scmp.c
r18027r18028
513513
514514   cpustate->device = device;
515515
516   cpustate->program = device->space(AS_PROGRAM);
516   cpustate->program = &device->space(AS_PROGRAM);
517517   cpustate->direct = &cpustate->program->direct();
518518
519519   /* resolve callbacks */
trunk/src/emu/cpu/rsp/rsp.c
r18027r18028
281281
282282   rsp->irq_callback = irqcallback;
283283   rsp->device = device;
284   rsp->program = device->space(AS_PROGRAM);
284   rsp->program = &device->space(AS_PROGRAM);
285285   rsp->direct = &rsp->program->direct();
286286
287287#if 1
trunk/src/emu/cpu/rsp/rspdrc.c
r18027r18028
588588   rsp->config = (const rsp_config *)device->static_config();
589589   rsp->irq_callback = irqcallback;
590590   rsp->device = device;
591   rsp->program = device->space(AS_PROGRAM);
591   rsp->program = &device->space(AS_PROGRAM);
592592   rsp->direct = &rsp->program->direct();
593593
594594#if 1
trunk/src/emu/cpu/cop400/cop400.c
r18027r18028
872872
873873   /* find address spaces */
874874
875   cpustate->program = device->space(AS_PROGRAM);
875   cpustate->program = &device->space(AS_PROGRAM);
876876   cpustate->direct = &cpustate->program->direct();
877   cpustate->data = device->space(AS_DATA);
878   cpustate->io = device->space(AS_IO);
877   cpustate->data = &device->space(AS_DATA);
878   cpustate->io = &device->space(AS_IO);
879879
880880   /* set output pin masks */
881881
trunk/src/emu/cpu/ssem/ssem.c
r18027r18028
149149    cpustate->halt = 0;
150150
151151    cpustate->device = device;
152    cpustate->program = device->space(AS_PROGRAM);
152    cpustate->program = &device->space(AS_PROGRAM);
153153}
154154
155155static CPU_EXIT( ssem )
trunk/src/emu/cpu/i8008/i8008.c
r18027r18028
5151void i8008_device::device_start()
5252{
5353   // find address spaces
54   m_program = space(AS_PROGRAM);
54   m_program = &space(AS_PROGRAM);
5555   m_direct = &m_program->direct();
56   m_io = space(AS_IO);
56   m_io = &space(AS_IO);
5757
5858   // save state
5959   save_item(NAME(m_PC));
trunk/src/emu/cpu/m6502/m4510.c
r18027r18028
191191   cpustate->interrupt_inhibit = 0;
192192   cpustate->irq_callback = irqcallback;
193193   cpustate->device = device;
194   cpustate->space = device->space(AS_PROGRAM);
194   cpustate->space = &device->space(AS_PROGRAM);
195195   cpustate->direct = &cpustate->space->direct();
196196
197197   if ( intf )
trunk/src/emu/cpu/m6502/m6502.c
r18027r18028
136136
137137   cpustate->irq_callback = irqcallback;
138138   cpustate->device = device;
139   cpustate->space = device->space(AS_PROGRAM);
139   cpustate->space = &device->space(AS_PROGRAM);
140140   cpustate->direct = &cpustate->space->direct();
141141   cpustate->subtype = subtype;
142142   cpustate->insn = insn;
r18027r18028
548548{
549549   m6502_Regs *cpustate = get_safe_token(device);
550550   m6502_common_init(device, irqcallback, SUBTYPE_DECO16, insndeco16, "deco16");
551   cpustate->io = device->space(AS_IO);
551   cpustate->io = &device->space(AS_IO);
552552}
553553
554554
trunk/src/emu/cpu/m6502/m6509.c
r18027r18028
141141
142142   cpustate->irq_callback = irqcallback;
143143   cpustate->device = device;
144   cpustate->space = device->space(AS_PROGRAM);
144   cpustate->space = &device->space(AS_PROGRAM);
145145   cpustate->direct = &cpustate->space->direct();
146146
147147   if ( intf )
trunk/src/emu/cpu/m6502/m65ce02.c
r18027r18028
101101
102102   cpustate->irq_callback = irqcallback;
103103   cpustate->device = device;
104   cpustate->space = device->space(AS_PROGRAM);
104   cpustate->space = &device->space(AS_PROGRAM);
105105   cpustate->direct = &cpustate->space->direct();
106106
107107   if ( intf )
trunk/src/emu/cpu/jaguar/jaguar.c
r18027r18028
417417
418418   jaguar->irq_callback = irqcallback;
419419   jaguar->device = device;
420   jaguar->program = device->space(AS_PROGRAM);
420   jaguar->program = &device->space(AS_PROGRAM);
421421   jaguar->direct = &jaguar->program->direct();
422422   if (configdata != NULL)
423423      jaguar->cpu_interrupt = configdata->cpu_int_callback;
trunk/src/emu/cpu/psx/psx.c
r18027r18028
16291629void psxcpu_device::device_start()
16301630{
16311631   // get our address spaces
1632   m_program = space(AS_PROGRAM);
1632   m_program = &space(AS_PROGRAM);
16331633   m_direct = &m_program->direct();
16341634
16351635   save_item( NAME(m_op) );
trunk/src/emu/cpu/i8085/i8085.c
r18027r18028
10061006   cpustate->irq_callback = irqcallback;
10071007   cpustate->device = device;
10081008
1009   cpustate->program = device->space(AS_PROGRAM);
1009   cpustate->program = &device->space(AS_PROGRAM);
10101010   cpustate->direct = &cpustate->program->direct();
1011   cpustate->io = device->space(AS_IO);
1011   cpustate->io = &device->space(AS_IO);
10121012
10131013   /* resolve callbacks */
10141014   cpustate->out_status_func.resolve(cpustate->config.out_status_func, *device);
trunk/src/emu/cpu/arm/arm.c
r18027r18028
345345   cpustate->irq_callback = save_irqcallback;
346346   cpustate->endian = save_endian;
347347   cpustate->device = device;
348   cpustate->program = device->space(AS_PROGRAM);
348   cpustate->program = &device->space(AS_PROGRAM);
349349   cpustate->direct = &cpustate->program->direct();
350350
351351   /* start up in SVC mode with interrupts disabled. */
r18027r18028
528528
529529   cpustate->irq_callback = irqcallback;
530530   cpustate->device = device;
531   cpustate->program = device->space(AS_PROGRAM);
531   cpustate->program = &device->space(AS_PROGRAM);
532532   cpustate->endian = ENDIANNESS_LITTLE;
533533
534534   device->save_item(NAME(cpustate->sArmRegister));
r18027r18028
544544
545545   cpustate->irq_callback = irqcallback;
546546   cpustate->device = device;
547   cpustate->program = device->space(AS_PROGRAM);
547   cpustate->program = &device->space(AS_PROGRAM);
548548   cpustate->endian = ENDIANNESS_BIG;
549549
550550   device->save_item(NAME(cpustate->sArmRegister));
trunk/src/emu/cpu/powerpc/ppccom.c
r18027r18028
317317   ppc->cpu_clock = device->clock();
318318   ppc->irq_callback = irqcallback;
319319   ppc->device = device;
320   ppc->program = device->space(AS_PROGRAM);
320   ppc->program = &device->space(AS_PROGRAM);
321321   ppc->direct = &ppc->program->direct();
322322   ppc->system_clock = (config != NULL) ? config->bus_frequency : device->clock();
323323   ppc->dcr_read_func = (config != NULL) ? config->dcr_read_func : NULL;
trunk/src/emu/cpu/powerpc/ppc.c
r18027r18028
963963
964964   ppc.irq_callback = irqcallback;
965965   ppc.device = device;
966   ppc.program = device->space(AS_PROGRAM);
966   ppc.program = &device->space(AS_PROGRAM);
967967
968968   ppc.pvr = configdata->pvr;
969969}
r18027r18028
10091009
10101010   ppc.irq_callback = irqcallback;
10111011   ppc.device = device;
1012   ppc.program = device->space(AS_PROGRAM);
1012   ppc.program = &device->space(AS_PROGRAM);
10131013
10141014   ppc.pvr = configdata->pvr;
10151015}
r18027r18028
11341134
11351135   ppc.irq_callback = irqcallback;
11361136   ppc.device = device;
1137   ppc.program = device->space(AS_PROGRAM);
1137   ppc.program = &device->space(AS_PROGRAM);
11381138
11391139   ppc.pvr = configdata->pvr;
11401140
r18027r18028
12821282
12831283   ppc.irq_callback = irqcallback;
12841284   ppc.device = device;
1285   ppc.program = device->space(AS_PROGRAM);
1285   ppc.program = &device->space(AS_PROGRAM);
12861286
12871287   ppc.pvr = configdata->pvr;
12881288
r18027r18028
14231423
14241424   ppc.irq_callback = irqcallback;
14251425   ppc.device = device;
1426   ppc.program = device->space(AS_PROGRAM);
1426   ppc.program = &device->space(AS_PROGRAM);
14271427
14281428   ppc.pvr = configdata->pvr;
14291429
r18027r18028
15491549
15501550   ppc.irq_callback = irqcallback;
15511551   ppc.device = device;
1552   ppc.program = device->space(AS_PROGRAM);
1552   ppc.program = &device->space(AS_PROGRAM);
15531553
15541554   ppc.pvr = configdata->pvr;
15551555
r18027r18028
16791679
16801680   ppc.irq_callback = irqcallback;
16811681   ppc.device = device;
1682   ppc.program = device->space(AS_PROGRAM);
1682   ppc.program = &device->space(AS_PROGRAM);
16831683
16841684   ppc.pvr = configdata->pvr;
16851685
trunk/src/emu/cpu/lr35902/lr35902.c
r18027r18028
117117void lr35902_cpu_device::device_start()
118118{
119119   m_device = this;
120   m_program = this->space(AS_PROGRAM);
120   m_program = &space(AS_PROGRAM);
121121
122122   save_item(NAME(m_A));
123123   save_item(NAME(m_F));
trunk/src/emu/cpu/z8000/z8000.c
r18027r18028
478478
479479   cpustate->irq_callback = irqcallback;
480480   cpustate->device = device;
481   cpustate->program = device->space(AS_PROGRAM);
481   cpustate->program = &device->space(AS_PROGRAM);
482482   cpustate->direct = &cpustate->program->direct();
483   cpustate->io = device->space(AS_IO);
483   cpustate->io = &device->space(AS_IO);
484484
485485   /* already initialized? */
486486   if(z8000_exec == NULL)
r18027r18028
493493
494494   cpustate->irq_callback = irqcallback;
495495   cpustate->device = device;
496   cpustate->program = device->space(AS_PROGRAM);
496   cpustate->program = &device->space(AS_PROGRAM);
497497   cpustate->direct = &cpustate->program->direct();
498   cpustate->io = device->space(AS_IO);
498   cpustate->io = &device->space(AS_IO);
499499
500500   /* already initialized? */
501501   if(z8000_exec == NULL)
r18027r18028
510510   memset(cpustate, 0, sizeof(*cpustate));
511511   cpustate->irq_callback = save_irqcallback;
512512   cpustate->device = device;
513   cpustate->program = device->space(AS_PROGRAM);
513   cpustate->program = &device->space(AS_PROGRAM);
514514   cpustate->direct = &cpustate->program->direct();
515   cpustate->io = device->space(AS_IO);
515   cpustate->io = &device->space(AS_IO);
516516   cpustate->fcw = RDMEM_W(cpustate,  2); /* get reset cpustate->fcw */
517517   if(cpustate->fcw & F_SEG)
518518   {
r18027r18028
532532   memset(cpustate, 0, sizeof(*cpustate));
533533   cpustate->irq_callback = save_irqcallback;
534534   cpustate->device = device;
535   cpustate->program = device->space(AS_PROGRAM);
535   cpustate->program = &device->space(AS_PROGRAM);
536536   cpustate->direct = &cpustate->program->direct();
537   cpustate->io = device->space(AS_IO);
537   cpustate->io = &device->space(AS_IO);
538538   cpustate->fcw = RDMEM_W(cpustate,  2); /* get reset cpustate->fcw */
539539   cpustate->pc = RDMEM_W(cpustate,  4); /* get reset cpustate->pc  */
540540}
trunk/src/emu/cpu/tms32010/tms32010.c
r18027r18028
826826   device->save_item(NAME(cpustate->addr_mask));
827827
828828   cpustate->device = device;
829   cpustate->program = device->space(AS_PROGRAM);
829   cpustate->program = &device->space(AS_PROGRAM);
830830   cpustate->direct = &cpustate->program->direct();
831   cpustate->data = device->space(AS_DATA);
832   cpustate->io = device->space(AS_IO);
831   cpustate->data = &device->space(AS_DATA);
832   cpustate->io = &device->space(AS_IO);
833833}
834834
835835
trunk/src/emu/cpu/sm8500/sm8500.c
r18027r18028
124124
125125   cpustate->irq_callback = irqcallback;
126126   cpustate->device = device;
127   cpustate->program = device->space(AS_PROGRAM);
127   cpustate->program = &device->space(AS_PROGRAM);
128128   if ( device->static_config() != NULL ) {
129129      cpustate->config.handle_dma = ((SM8500_CONFIG *)device->static_config())->handle_dma;
130130      cpustate->config.handle_timers = ((SM8500_CONFIG *)device->static_config())->handle_timers;
trunk/src/emu/cpu/sh2/sh2comn.c
r18027r18028
961961   }
962962   sh2->irq_callback = irqcallback;
963963   sh2->device = device;
964   sh2->program = device->space(AS_PROGRAM);
964   sh2->program = &device->space(AS_PROGRAM);
965965   sh2->direct = &sh2->program->direct();
966   sh2->internal = device->space(AS_PROGRAM);
966   sh2->internal = &device->space(AS_PROGRAM);
967967
968968   device->save_item(NAME(sh2->pc));
969969   device->save_item(NAME(sh2->sr));
trunk/src/emu/cpu/mn10200/mn10200.c
r18027r18028
274274   memset(cpustate, 0, sizeof(mn102_info));
275275
276276   cpustate->device = device;
277   cpustate->program = device->space(AS_PROGRAM);
278   cpustate->io = device->space(AS_IO);
277   cpustate->program = &device->space(AS_PROGRAM);
278   cpustate->io = &device->space(AS_IO);
279279
280280   device->save_item(NAME(cpustate->pc));
281281   device->save_item(NAME(cpustate->d));
trunk/src/emu/cpu/tms32051/tms32051.c
r18027r18028
223223   tms32051_state *cpustate = get_safe_token(device);
224224
225225   cpustate->device = device;
226   cpustate->program = device->space(AS_PROGRAM);
226   cpustate->program = &device->space(AS_PROGRAM);
227227   cpustate->direct = &cpustate->program->direct();
228   cpustate->data = device->space(AS_DATA);
228   cpustate->data = &device->space(AS_DATA);
229229
230230   cpustate->pcstack_ptr = 0;
231231}
trunk/src/emu/cpu/mb88xx/mb88xx.c
r18027r18028
143143
144144   cpustate->irqcallback = irqcallback;
145145   cpustate->device = device;
146   cpustate->program = device->space(AS_PROGRAM);
146   cpustate->program = &device->space(AS_PROGRAM);
147147   cpustate->direct = &cpustate->program->direct();
148   cpustate->data = device->space(AS_DATA);
149   cpustate->io = device->space(AS_IO);
148   cpustate->data = &device->space(AS_DATA);
149   cpustate->io = &device->space(AS_IO);
150150
151151   cpustate->serial = device->machine().scheduler().timer_alloc(FUNC(serial_timer), (void *)device);
152152
trunk/src/emu/cpu/sh4/sh4.c
r18027r18028
28682868   sh4->ftcsr_read_callback = f;
28692869   sh4->irq_callback = save_irqcallback;
28702870   sh4->device = device;
2871   sh4->internal = device->space(AS_PROGRAM);
2872   sh4->program = device->space(AS_PROGRAM);
2871   sh4->internal = &device->space(AS_PROGRAM);
2872   sh4->program = &device->space(AS_PROGRAM);
28732873   sh4->direct = &sh4->program->direct();
2874   sh4->io = device->space(AS_IO);
2874   sh4->io = &device->space(AS_IO);
28752875
28762876   sh4->dma_timer[0] = tsaved[0];
28772877   sh4->dma_timer[1] = tsaved[1];
r18027r18028
32163216
32173217   sh4->irq_callback = irqcallback;
32183218   sh4->device = device;
3219   sh4->internal = device->space(AS_PROGRAM);
3220   sh4->program = device->space(AS_PROGRAM);
3221   sh4->io = device->space(AS_IO);
3219   sh4->internal = &device->space(AS_PROGRAM);
3220   sh4->program = &device->space(AS_PROGRAM);
3221   sh4->io = &device->space(AS_IO);
32223222   sh4_default_exception_priorities(sh4);
32233223   sh4->irln = 15;
32243224   sh4->test_irq = 0;
trunk/src/emu/cpu/alph8201/alph8201.c
r18027r18028
668668   alpha8201_state *cpustate = get_safe_token(device);
669669
670670   cpustate->device = device;
671   cpustate->program = device->space(AS_PROGRAM);
671   cpustate->program = &device->space(AS_PROGRAM);
672672   cpustate->direct = &cpustate->program->direct();
673673
674674   device->save_item(NAME(cpustate->RAM));
trunk/src/emu/cpu/g65816/g65816.c
r18027r18028
338338
339339   g65816_set_irq_callback(cpustate, irqcallback);
340340   cpustate->device = device;
341   cpustate->program = device->space(AS_PROGRAM);
341   cpustate->program = &device->space(AS_PROGRAM);
342342   cpustate->cpu_type = CPU_TYPE_G65816;
343343
344344   device->save_item(NAME(cpustate->a));
trunk/src/emu/cpu/apexc/apexc.c
r18027r18028
800800   apexc_state *cpustate = get_safe_token(device);
801801
802802   cpustate->device = device;
803   cpustate->program = device->space(AS_PROGRAM);
804   cpustate->io = device->space(AS_IO);
803   cpustate->program = &device->space(AS_PROGRAM);
804   cpustate->io = &device->space(AS_IO);
805805
806806   device->save_item(NAME(cpustate->a));
807807   device->save_item(NAME(cpustate->r));
trunk/src/emu/cpu/nec/nec.c
r18027r18028
367367
368368   nec_state->irq_callback = irqcallback;
369369   nec_state->device = device;
370   nec_state->program = device->space(AS_PROGRAM);
370   nec_state->program = &device->space(AS_PROGRAM);
371371   nec_state->direct = &nec_state->program->direct();
372   nec_state->io = device->space(AS_IO);
372   nec_state->io = &device->space(AS_IO);
373373}
374374
375375
trunk/src/emu/cpu/nec/v25.c
r18027r18028
486486
487487   nec_state->irq_callback = irqcallback;
488488   nec_state->device = device;
489   nec_state->program = device->space(AS_PROGRAM);
489   nec_state->program = &device->space(AS_PROGRAM);
490490   nec_state->direct = &nec_state->program->direct();
491   nec_state->io = device->space(AS_IO);
491   nec_state->io = &device->space(AS_IO);
492492}
493493
494494
trunk/src/emu/cpu/cosmac/cosmac.c
r18027r18028
231231void cosmac_device::device_start()
232232{
233233   // get our address spaces
234   m_program = space(AS_PROGRAM);
234   m_program = &space(AS_PROGRAM);
235235   m_direct = &m_program->direct();
236   m_io = space(AS_IO);
236   m_io = &space(AS_IO);
237237
238238   // register our state for the debugger
239239   state_add(STATE_GENPC,      "GENPC",      m_pc).callimport().callexport().noshow();
trunk/src/emu/cpu/mips/r3000.c
r18027r18028
311311
312312   r3000->irq_callback = irqcallback;
313313   r3000->device = device;
314   r3000->program = device->space(AS_PROGRAM);
314   r3000->program = &device->space(AS_PROGRAM);
315315   r3000->direct = &r3000->program->direct();
316316}
317317
trunk/src/emu/cpu/mips/mips3com.c
r18027r18028
8181   mips->cpu_clock = device->clock();
8282   mips->irq_callback = irqcallback;
8383   mips->device = device;
84   mips->program = device->space(AS_PROGRAM);
84   mips->program = &device->space(AS_PROGRAM);
8585   mips->direct = &mips->program->direct();
8686   mips->icache_size = config->icache;
8787   mips->dcache_size = config->dcache;
trunk/src/emu/cpu/tms7000/tms7000.c
r18027r18028
165165
166166   cpustate->irq_callback = irqcallback;
167167   cpustate->device = device;
168   cpustate->program = device->space(AS_PROGRAM);
168   cpustate->program = &device->space(AS_PROGRAM);
169169   cpustate->direct = &cpustate->program->direct();
170   cpustate->io = device->space(AS_IO);
170   cpustate->io = &device->space(AS_IO);
171171
172172   memset(cpustate->pf, 0, 0x100);
173173   memset(cpustate->rf, 0, 0x80);
trunk/src/emu/cpu/f8/f8.c
r18027r18028
16191619   memset(cpustate, 0, sizeof(f8_Regs));
16201620   cpustate->irq_callback = save_callback;
16211621   cpustate->device = device;
1622   cpustate->program = device->space(AS_PROGRAM);
1622   cpustate->program = &device->space(AS_PROGRAM);
16231623   cpustate->direct = &cpustate->program->direct();
1624   cpustate->iospace = device->space(AS_IO);
1624   cpustate->iospace = &device->space(AS_IO);
16251625   cpustate->w&=~I;
16261626
16271627   /* save PC0 to PC1 and reset PC0 */
r18027r18028
19671967   f8_Regs *cpustate = get_safe_token(device);
19681968   cpustate->irq_callback = irqcallback;
19691969   cpustate->device = device;
1970   cpustate->program = device->space(AS_PROGRAM);
1970   cpustate->program = &device->space(AS_PROGRAM);
19711971   cpustate->direct = &cpustate->program->direct();
1972   cpustate->iospace = device->space(AS_IO);
1972   cpustate->iospace = &device->space(AS_IO);
19731973
19741974   device->save_item(NAME(cpustate->pc0));
19751975   device->save_item(NAME(cpustate->pc1));
trunk/src/emu/cpu/z80/z80.c
r18027r18028
34773477      z80->daisy.init(device, (const z80_daisy_config *)device->static_config());
34783478   z80->irq_callback = irqcallback;
34793479   z80->device = device;
3480   z80->program = device->space(AS_PROGRAM);
3480   z80->program = &device->space(AS_PROGRAM);
34813481   z80->direct = &z80->program->direct();
3482   z80->io = device->space(AS_IO);
3482   z80->io = &device->space(AS_IO);
34833483   z80->IX = z80->IY = 0xffff; /* IX and IY are FFFF after a reset! */
34843484   z80->F = ZF;         /* Zero flag is set */
34853485
trunk/src/emu/cpu/esrip/esrip.c
r18027r18028
264264   cpustate->ipt_ram = auto_alloc_array(device->machine(), UINT16, IPT_RAM_SIZE/2);
265265
266266   cpustate->device = device;
267   cpustate->program = device->space(AS_PROGRAM);
267   cpustate->program = &device->space(AS_PROGRAM);
268268   cpustate->direct = &cpustate->program->direct();
269269
270270   /* Create the instruction decode lookup table */
trunk/src/emu/cpu/asap/asap.c
r18027r18028
211211void asap_device::device_start()
212212{
213213   // get our address spaces
214   m_program = space(AS_PROGRAM);
214   m_program = &space(AS_PROGRAM);
215215   m_direct = &m_program->direct();
216216
217217   // register our state for the debugger
trunk/src/emu/cpu/tms9900/99xxcore.h
r18027r18028
12941294   cpustate->irq_level = 16;
12951295   cpustate->irq_callback = irqcallback;
12961296   cpustate->device = device;
1297   cpustate->program = device->space(AS_PROGRAM);
1298   cpustate->io = device->space(AS_IO);
1297   cpustate->program = &device->space(AS_PROGRAM);
1298   cpustate->io = &device->space(AS_IO);
12991299
13001300#if (TMS99XX_MODEL == TMS9995_ID)
13011301   cpustate->timer = device->machine().scheduler().timer_alloc(FUNC(decrementer_callback), cpustate);
trunk/src/emu/cpu/tms9900/tms9995.c
r18027r18028
148148
149149   // TODO: Restore save state suport
150150
151   m_prgspace = space(AS_PROGRAM);                  // dimemory.h
152   m_cru = space(AS_IO);
151   m_prgspace = &space(AS_PROGRAM);                  // dimemory.h
152   m_cru = &space(AS_IO);
153153
154154   // Resolve our external connections
155155   m_external_operation.resolve(conf->external_callback, *this);
trunk/src/emu/cpu/tms9900/tms9900.c
r18027r18028
167167
168168   // TODO: Restore state save feature
169169
170   m_prgspace = space(AS_PROGRAM);                  // dimemory.h
171   m_cru = space(AS_IO);
170   m_prgspace = &space(AS_PROGRAM);                  // dimemory.h
171   m_cru = &space(AS_IO);
172172
173173   // Resolve our external connections
174174   m_external_operation.resolve(conf->external_callback, *this);
trunk/src/emu/cpu/pps4/pps4.c
r18027r18028
337337
338338   cpustate->device = device;
339339
340   cpustate->program = device->space(AS_PROGRAM);
340   cpustate->program = &device->space(AS_PROGRAM);
341341   cpustate->direct = &cpustate->program->direct();
342   cpustate->data = device->space(AS_DATA);
343   cpustate->io = device->space(AS_IO);
342   cpustate->data = &device->space(AS_DATA);
343   cpustate->io = &device->space(AS_IO);
344344
345345   device->save_item(NAME(cpustate->A));
346346   device->save_item(NAME(cpustate->X));
trunk/src/emu/cpu/i960/i960.c
r18027r18028
20672067
20682068   i960->irq_cb = irqcallback;
20692069   i960->device = device;
2070   i960->program = device->space(AS_PROGRAM);
2070   i960->program = &device->space(AS_PROGRAM);
20712071   i960->direct = &i960->program->direct();
20722072
20732073   device->save_item(NAME(i960->PIP));
trunk/src/emu/cpu/hd61700/hd61700.c
r18027r18028
124124
125125void hd61700_cpu_device::device_start()
126126{
127   m_program = this->space(AS_PROGRAM);
127   m_program = &space(AS_PROGRAM);
128128
129129   m_sec_timer = timer_alloc(SEC_TIMER);
130130   m_sec_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
trunk/src/emu/cpu/dsp16/dsp16.c
r18027r18028
4242void dsp16_device::device_start()
4343{
4444   // get our address spaces
45   m_program = space(AS_PROGRAM);
45   m_program = &space(AS_PROGRAM);
4646   m_direct = &m_program->direct();
4747
4848   save_item(NAME(m_pc));
trunk/src/emu/cpu/v810/v810.c
r18027r18028
12541254   cpustate->nmi_line = CLEAR_LINE;
12551255   cpustate->irq_callback = irqcallback;
12561256   cpustate->device = device;
1257   cpustate->program = device->space(AS_PROGRAM);
1257   cpustate->program = &device->space(AS_PROGRAM);
12581258   cpustate->direct = &cpustate->program->direct();
1259   cpustate->io = device->space(AS_IO);
1259   cpustate->io = &device->space(AS_IO);
12601260
12611261   device->save_item(NAME(cpustate->reg));
12621262   device->save_item(NAME(cpustate->irq_line));
trunk/src/emu/cpu/tms32025/tms32025.c
r18027r18028
16761676   cpustate->intRAM = auto_alloc_array(device->machine(), UINT16, 0x800);
16771677   cpustate->irq_callback = irqcallback;
16781678   cpustate->device = device;
1679   cpustate->program = device->space(AS_PROGRAM);
1679   cpustate->program = &device->space(AS_PROGRAM);
16801680   cpustate->direct = &cpustate->program->direct();
1681   cpustate->data = device->space(AS_DATA);
1682   cpustate->io = device->space(AS_IO);
1681   cpustate->data = &device->space(AS_DATA);
1682   cpustate->io = &device->space(AS_IO);
16831683
16841684   device->save_item(NAME(cpustate->PC));
16851685   device->save_item(NAME(cpustate->STR0));
trunk/src/emu/cpu/z8/z8.c
r18027r18028
661661   cpustate->clock = device->clock();
662662
663663   /* find address spaces */
664   cpustate->program = device->space(AS_PROGRAM);
664   cpustate->program = &device->space(AS_PROGRAM);
665665   cpustate->direct = &cpustate->program->direct();
666   cpustate->data = device->space(AS_DATA);
667   cpustate->io = device->space(AS_IO);
666   cpustate->data = &device->space(AS_DATA);
667   cpustate->io = &device->space(AS_IO);
668668
669669   /* allocate timers */
670670   cpustate->t0_timer = device->machine().scheduler().timer_alloc(FUNC(t0_tick), cpustate);
trunk/src/emu/cpu/pic16c5x/pic16c5x.c
r18027r18028
727727   pic16c5x_state *cpustate = get_safe_token(device);
728728
729729   cpustate->device = device;
730   cpustate->program = device->space(AS_PROGRAM);
730   cpustate->program = &device->space(AS_PROGRAM);
731731   cpustate->direct = &cpustate->program->direct();
732   cpustate->data = device->space(AS_DATA);
733   cpustate->io = device->space(AS_IO);
732   cpustate->data = &device->space(AS_DATA);
733   cpustate->io = &device->space(AS_IO);
734734
735735   /* ensure the internal ram pointers are set before get_info is called */
736736   update_internalram_ptr(cpustate);
trunk/src/emu/cpu/pdp1/pdp1.c
r18027r18028
543543   /* clean-up */
544544   memset (cpustate, 0, sizeof (*cpustate));
545545   cpustate->device = device;
546   cpustate->program = device->space(AS_PROGRAM);
546   cpustate->program = &device->space(AS_PROGRAM);
547547
548548   /* set up params and callbacks */
549549   for (i=0; i<64; i++)
trunk/src/emu/cpu/pdp1/tx0.c
r18027r18028
135135   cpustate->ir_mask = is_64kw ? 03 : 037;
136136
137137   cpustate->device = device;
138   cpustate->program = device->space(AS_PROGRAM);
138   cpustate->program = &device->space(AS_PROGRAM);
139139}
140140
141141static CPU_INIT( tx0_64kw )
trunk/src/emu/cpu/mb86233/mb86233.c
r18027r18028
111111
112112   memset(cpustate, 0, sizeof( *cpustate ) );
113113   cpustate->device = device;
114   cpustate->program = device->space(AS_PROGRAM);
114   cpustate->program = &device->space(AS_PROGRAM);
115115   cpustate->direct = &cpustate->program->direct();
116116
117117   if ( _config )
trunk/src/emu/cpu/t11/t11.c
r18027r18028
264264   cpustate->initial_pc = initial_pc[setup->mode >> 13];
265265   cpustate->irq_callback = irqcallback;
266266   cpustate->device = device;
267   cpustate->program = device->space(AS_PROGRAM);
267   cpustate->program = &device->space(AS_PROGRAM);
268268   cpustate->direct = &cpustate->program->direct();
269269
270270   device->save_item(NAME(cpustate->ppc.w.l));
trunk/src/emu/cpu/arm7/arm7core.c
r18027r18028
140140    memset(cpustate, 0, sizeof(arm_state));
141141    cpustate->irq_callback = save_irqcallback;
142142    cpustate->device = device;
143    cpustate->program = device->space(AS_PROGRAM);
143    cpustate->program = &device->space(AS_PROGRAM);
144144   cpustate->endian = ENDIANNESS_LITTLE;
145145   cpustate->direct = &cpustate->program->direct();
146146
trunk/src/emu/cpu/arm7/arm7.c
r18027r18028
427427
428428   cpustate->irq_callback = irqcallback;
429429   cpustate->device = device;
430   cpustate->program = device->space(AS_PROGRAM);
430   cpustate->program = &device->space(AS_PROGRAM);
431431   cpustate->direct = &cpustate->program->direct();
432432
433433   // setup co-proc callbacks
trunk/src/emu/cpu/h6280/h6280.c
r18027r18028
161161
162162   cpustate->irq_callback = irqcallback;
163163   cpustate->device = device;
164   cpustate->program = device->space(AS_PROGRAM);
164   cpustate->program = &device->space(AS_PROGRAM);
165165   cpustate->direct = &cpustate->program->direct();
166   cpustate->io = device->space(AS_IO);
166   cpustate->io = &device->space(AS_IO);
167167}
168168
169169static CPU_RESET( h6280 )
r18027r18028
178178   memset(cpustate, 0, sizeof(h6280_Regs));
179179   cpustate->irq_callback = save_irqcallback;
180180   cpustate->device = device;
181   cpustate->program = device->space(AS_PROGRAM);
181   cpustate->program = &device->space(AS_PROGRAM);
182182   cpustate->direct = &cpustate->program->direct();
183   cpustate->io = device->space(AS_IO);
183   cpustate->io = &device->space(AS_IO);
184184
185185   /* set I and B flags */
186186   P = _fI | _fB;
trunk/src/emu/cpu/m6800/m6800.c
r18027r18028
10461046{
10471047   m6800_state *cpustate = get_safe_token(device);
10481048
1049   cpustate->program = device->space(AS_PROGRAM);
1049   cpustate->program = &device->space(AS_PROGRAM);
10501050   cpustate->direct = &cpustate->program->direct();
1051   cpustate->data = device->space(AS_DATA);
1052   cpustate->io = device->space(AS_IO);
1051   cpustate->data = &device->space(AS_DATA);
1052   cpustate->io = &device->space(AS_IO);
10531053
10541054   //  cpustate->subtype   = SUBTYPE_M6800;
10551055   cpustate->insn = m6800_insn;
r18027r18028
11991199   cpustate->irq_callback = irqcallback;
12001200   cpustate->device = device;
12011201
1202   cpustate->program = device->space(AS_PROGRAM);
1202   cpustate->program = &device->space(AS_PROGRAM);
12031203   cpustate->direct = &cpustate->program->direct();
1204   cpustate->data = device->space(AS_DATA);
1205   cpustate->io = device->space(AS_IO);
1204   cpustate->data = &device->space(AS_DATA);
1205   cpustate->io = &device->space(AS_IO);
12061206
12071207   cpustate->clock = device->clock() / 4;
12081208   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
r18027r18028
12341234   cpustate->irq_callback = irqcallback;
12351235   cpustate->device = device;
12361236
1237   cpustate->program = device->space(AS_PROGRAM);
1237   cpustate->program = &device->space(AS_PROGRAM);
12381238   cpustate->direct = &cpustate->program->direct();
1239   cpustate->data = device->space(AS_DATA);
1240   cpustate->io = device->space(AS_IO);
1239   cpustate->data = &device->space(AS_DATA);
1240   cpustate->io = &device->space(AS_IO);
12411241
12421242   state_register(cpustate, "m6802");
12431243}
r18027r18028
12541254   cpustate->irq_callback = irqcallback;
12551255   cpustate->device = device;
12561256
1257   cpustate->program = device->space(AS_PROGRAM);
1257   cpustate->program = &device->space(AS_PROGRAM);
12581258   cpustate->direct = &cpustate->program->direct();
1259   cpustate->data = device->space(AS_DATA);
1260   cpustate->io = device->space(AS_IO);
1259   cpustate->data = &device->space(AS_DATA);
1260   cpustate->io = &device->space(AS_IO);
12611261
12621262   cpustate->clock = device->clock() / 4;
12631263   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
r18027r18028
12961296   cpustate->irq_callback = irqcallback;
12971297   cpustate->device = device;
12981298
1299   cpustate->program = device->space(AS_PROGRAM);
1299   cpustate->program = &device->space(AS_PROGRAM);
13001300   cpustate->direct = &cpustate->program->direct();
1301   cpustate->data = device->space(AS_DATA);
1302   cpustate->io = device->space(AS_IO);
1301   cpustate->data = &device->space(AS_DATA);
1302   cpustate->io = &device->space(AS_IO);
13031303
13041304   state_register(cpustate, "m6808");
13051305}
r18027r18028
13171317   cpustate->irq_callback = irqcallback;
13181318   cpustate->device = device;
13191319
1320   cpustate->program = device->space(AS_PROGRAM);
1320   cpustate->program = &device->space(AS_PROGRAM);
13211321   cpustate->direct = &cpustate->program->direct();
1322   cpustate->data = device->space(AS_DATA);
1323   cpustate->io = device->space(AS_IO);
1322   cpustate->data = &device->space(AS_DATA);
1323   cpustate->io = &device->space(AS_IO);
13241324
13251325   cpustate->clock = device->clock() / 4;
13261326   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
r18027r18028
13421342   cpustate->irq_callback = irqcallback;
13431343   cpustate->device = device;
13441344
1345   cpustate->program = device->space(AS_PROGRAM);
1345   cpustate->program = &device->space(AS_PROGRAM);
13461346   cpustate->direct = &cpustate->program->direct();
1347   cpustate->data = device->space(AS_DATA);
1348   cpustate->io = device->space(AS_IO);
1347   cpustate->data = &device->space(AS_DATA);
1348   cpustate->io = &device->space(AS_IO);
13491349
13501350   cpustate->clock = device->clock() / 4;
13511351   cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate);
r18027r18028
13771377   //  cpustate->subtype = SUBTYPE_NSC8105;
13781378   cpustate->device = device;
13791379
1380   cpustate->program = device->space(AS_PROGRAM);
1380   cpustate->program = &device->space(AS_PROGRAM);
13811381   cpustate->direct = &cpustate->program->direct();
1382   cpustate->data = device->space(AS_DATA);
1383   cpustate->io = device->space(AS_IO);
1382   cpustate->data = &device->space(AS_DATA);
1383   cpustate->io = &device->space(AS_IO);
13841384
13851385   cpustate->insn = nsc8105_insn;
13861386   cpustate->cycles = cycles_nsc8105;
trunk/src/emu/cpu/cp1610/cp1610.c
r18027r18028
33883388   cpustate->intrm_pending = 0;
33893389   cpustate->irq_callback = irqcallback;
33903390   cpustate->device = device;
3391   cpustate->program = device->space(AS_PROGRAM);
3391   cpustate->program = &device->space(AS_PROGRAM);
33923392
33933393   device->save_item(NAME(cpustate->r));
33943394   device->save_item(NAME(cpustate->flags));
trunk/src/emu/cpu/saturn/saturn.c
r18027r18028
114114   cpustate->config = (saturn_cpu_core *) device->static_config();
115115   cpustate->irq_callback = irqcallback;
116116   cpustate->device = device;
117   cpustate->program = device->space(AS_PROGRAM);
117   cpustate->program = &device->space(AS_PROGRAM);
118118   cpustate->direct = &cpustate->program->direct();
119119
120120   device->save_item(NAME(cpustate->reg[R0]));
trunk/src/emu/cpu/upd7725/upd7725.c
r18027r18028
8080void necdsp_device::device_start()
8181{
8282   // get our address spaces
83   m_program = space(AS_PROGRAM);
84   m_data = space(AS_DATA);
83   m_program = &space(AS_PROGRAM);
84   m_data = &space(AS_DATA);
8585   m_direct = &m_program->direct();
8686
8787   // register our state for the debugger
trunk/src/emu/cpu/konami/konami.c
r18027r18028
403403
404404   cpustate->irq_callback = irqcallback;
405405   cpustate->device = device;
406   cpustate->program = device->space(AS_PROGRAM);
406   cpustate->program = &device->space(AS_PROGRAM);
407407   cpustate->direct = &cpustate->program->direct();
408408
409409   device->save_item(NAME(PC));
trunk/src/emu/devcb.c
r18027r18028
144144      throw emu_fatalerror("Device '%s' (requested by %s '%s') has no memory interface", tag, current.name(), current.tag());
145145
146146   // set the real target and function, then prime a delegate
147   address_space *result = memory->space(index);
148   if (result == NULL)
147   if (!memory->has_space(index))
149148      throw emu_fatalerror("Unable to find device '%s' space %d (requested by %s '%s')", tag, index, current.name(), current.tag());
150
151   return *result;
149   return memory->space(index);
152150}
153151
154152
trunk/src/emu/video/crt9007.c
r18027r18028
231231
232232inline UINT8 crt9007_device::readbyte(offs_t address)
233233{
234   return space()->read_byte(address);
234   return space().read_byte(address);
235235}
236236
237237
trunk/src/emu/video/mc6845.c
r18027r18028
418418
419419inline UINT8 mos8563_device::read_videoram(offs_t offset)
420420{
421   return space(AS_0)->read_byte(offset);
421   return space(AS_0).read_byte(offset);
422422}
423423
424424inline void mos8563_device::write_videoram(offs_t offset, UINT8 data)
425425{
426   space(AS_0)->write_byte(offset, data);
426   space(AS_0).write_byte(offset, data);
427427}
428428
429429
trunk/src/emu/video/h63484.c
r18027r18028
365365
366366inline UINT8 h63484_device::readbyte(offs_t address)
367367{
368   return space()->read_byte(address);
368   return space().read_byte(address);
369369}
370370
371371
r18027r18028
375375
376376inline void h63484_device::writebyte(offs_t address, UINT8 data)
377377{
378   space()->write_byte(address, data);
378   space().write_byte(address, data);
379379}
380380
381381
trunk/src/emu/video/tms9928a.c
r18027r18028
619619   m_irq_changed.resolve( m_out_int_line, *this );
620620
621621   // Video RAM is allocated as an own address space
622   m_vram_space = space(AS_DATA);
622   m_vram_space = &space(AS_DATA);
623623
624624   /* back bitmap */
625625   m_tmpbmp.allocate(TMS9928A_TOTAL_HORZ, TMS9928A_TOTAL_VERT_PAL);
trunk/src/emu/video/mb90082.c
r18027r18028
6363
6464inline UINT16 mb90082_device::read_word(offs_t address)
6565{
66   return space()->read_word(address << 1);
66   return space().read_word(address << 1);
6767}
6868
6969//-------------------------------------------------
r18027r18028
7272
7373inline void mb90082_device::write_word(offs_t address, UINT16 data)
7474{
75   space()->write_word(address << 1, data);
75   space().write_word(address << 1, data);
7676}
7777
7878//**************************************************************************
trunk/src/emu/video/pc_cga.c
r18027r18028
329329static VIDEO_START( pc_cga )
330330{
331331   int buswidth;
332   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
333   address_space *spaceio = machine.firstcpu->space(AS_IO);
332   address_space &space = machine.firstcpu->space(AS_PROGRAM);
333   address_space &spaceio = machine.firstcpu->space(AS_IO);
334334
335335   space.install_readwrite_bank(0xb8000, 0xbbfff, 0, 0x04000, "bank11" );
336336   buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
r18027r18028
357357         fatalerror("CGA: Bus width %d not supported\n", buswidth);
358358         break;
359359   }
360   spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask );
360   spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask );
361361   internal_pc_cga_video_start(machine);
362362   cga.videoram_size = 0x4000;
363363   cga.videoram = auto_alloc_array(machine, UINT8, 0x4000);
r18027r18028
370370static VIDEO_START( pc_cga32k )
371371{
372372   int buswidth;
373   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
374   address_space *spaceio = machine.firstcpu->space(AS_IO);
373   address_space &space = machine.firstcpu->space(AS_PROGRAM);
374   address_space &spaceio = machine.firstcpu->space(AS_IO);
375375
376376
377377   space.install_readwrite_bank(0xb8000, 0xbffff, "bank11" );
r18027r18028
399399         fatalerror("CGA: Bus width %d not supported\n", buswidth);
400400         break;
401401   }
402   spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask );
402   spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask );
403403
404404   internal_pc_cga_video_start(machine);
405405
r18027r18028
12021202      // Not sure if some all CGA cards have ability to upload char definition
12031203      // The original CGA card had a char rom
12041204      UINT8 buswidth = space.machine().firstcpu->space_config(AS_PROGRAM)->m_databus_width;
1205      address_space *space_prg = space.machine().firstcpu->space(AS_PROGRAM);
1205      address_space &space_prg = space.machine().firstcpu->space(AS_PROGRAM);
12061206      cga.p3df = data;
12071207      if (data & 1) {
12081208         UINT64 mask = 0;
r18027r18028
12281228               fatalerror("CGA: Bus width %d not supported\n", buswidth);
12291229               break;
12301230         }
1231         space_prg->install_legacy_readwrite_handler(0xb8000, 0xb9fff, FUNC(char_ram_r),FUNC(char_ram_w), mask );
1231         space_prg.install_legacy_readwrite_handler(0xb8000, 0xb9fff, FUNC(char_ram_r),FUNC(char_ram_w), mask );
12321232      } else {
12331233         if (cga.videoram_size== 0x4000) {
1234            space_prg->install_readwrite_bank(0xb8000, 0xbbfff, 0, 0x04000, "bank11" );
1234            space_prg.install_readwrite_bank(0xb8000, 0xbbfff, 0, 0x04000, "bank11" );
12351235         } else {
1236            space_prg->install_readwrite_bank(0xb8000, 0xbffff, "bank11" );
1236            space_prg.install_readwrite_bank(0xb8000, 0xbffff, "bank11" );
12371237         }
12381238      }
12391239      break;
r18027r18028
16351635   cga.videoram_size = 0x10000;
16361636   cga.videoram = auto_alloc_array(machine, UINT8, 0x10000 );
16371637
1638   address_space &space = *machine.firstcpu->space( AS_PROGRAM );
1639   address_space *io_space = machine.firstcpu->space( AS_IO );
1638   address_space &space = machine.firstcpu->space( AS_PROGRAM );
1639   address_space &io_space = machine.firstcpu->space( AS_IO );
16401640
16411641   space.install_read_bank( 0xb8000, 0xbbfff, 0, 0x0C000, "bank1" );
16421642   machine.root_device().membank("bank1")->set_base(cga.videoram + videoram_offset[0]);
16431643   space.install_legacy_write_handler( 0xb8000, 0xbbfff, 0, 0x0C000, FUNC(pc1512_videoram_w), 0xffff);
16441644
1645   io_space->install_legacy_readwrite_handler( 0x3d0, 0x3df, FUNC(pc1512_r), FUNC(pc1512_w), 0xffff);
1645   io_space.install_legacy_readwrite_handler( 0x3d0, 0x3df, FUNC(pc1512_r), FUNC(pc1512_w), 0xffff);
16461646
16471647}
16481648
trunk/src/emu/video/huc6261.c
r18027r18028
9696      {
9797         g_profiler.start( PROFILER_VIDEO );
9898         /* Get next pixel information */
99         m_pixel_data = m_huc6270_b->next_pixel( *machine().memory().first_space(), 0, 0xffff );
99         m_pixel_data = m_huc6270_b->next_pixel( machine().driver_data()->generic_space(), 0, 0xffff );
100100         g_profiler.stop();
101101      }
102102
trunk/src/emu/video/m50458.c
r18027r18028
148148
149149inline UINT16 m50458_device::read_word(offs_t address)
150150{
151   return space()->read_word(address << 1);
151   return space().read_word(address << 1);
152152}
153153
154154//-------------------------------------------------
r18027r18028
157157
158158inline void m50458_device::write_word(offs_t address, UINT16 data)
159159{
160   space()->write_word(address << 1, data);
160   space().write_word(address << 1, data);
161161}
162162
163163
trunk/src/emu/video/hd61830.c
r18027r18028
8282
8383inline UINT8 hd61830_device::readbyte(offs_t address)
8484{
85   return space()->read_byte(address);
85   return space().read_byte(address);
8686}
8787
8888
r18027r18028
9292
9393inline void hd61830_device::writebyte(offs_t address, UINT8 data)
9494{
95   space()->write_byte(address, data);
95   space().write_byte(address, data);
9696}
9797
9898
trunk/src/emu/video/huc6272.c
r18027r18028
4242
4343inline UINT32 huc6272_device::read_dword(offs_t address)
4444{
45   return space()->read_dword(address << 2);
45   return space().read_dword(address << 2);
4646}
4747
4848
r18027r18028
5252
5353inline void huc6272_device::write_dword(offs_t address, UINT32 data)
5454{
55   space()->write_dword(address << 2, data);
55   space().write_dword(address << 2, data);
5656}
5757
5858//**************************************************************************
trunk/src/emu/video/v9938.c
r18027r18028
614614   m_size_old = -1;
615615
616616   // Video RAM is allocated as an own address space
617   m_vram_space = space(AS_DATA);
617   m_vram_space = &space(AS_DATA);
618618
619619   // allocate VRAM
620620   assert(m_vram_size > 0);
trunk/src/emu/video/sed1330.c
r18027r18028
8989
9090inline UINT8 sed1330_device::readbyte(offs_t address)
9191{
92   return space()->read_byte(address);
92   return space().read_byte(address);
9393}
9494
9595
r18027r18028
9999
100100inline void sed1330_device::writebyte(offs_t address, UINT8 data)
101101{
102   space()->write_byte(address, data);
102   space().write_byte(address, data);
103103}
104104
105105
trunk/src/emu/video/315_5124.c
r18027r18028
496496   if ( !space.debugger_access() )
497497   {
498498      /* Load read buffer */
499      m_buffer = this->space()->read_byte(m_addr & 0x3fff);
499      m_buffer = this->space().read_byte(m_addr & 0x3fff);
500500
501501      /* Bump internal addthis->ress register */
502502      m_addr += 1;
r18027r18028
543543      case 0x00:
544544      case 0x01:
545545      case 0x02:
546         this->space()->write_byte(m_addr & 0x3fff, data);
546         this->space().write_byte(m_addr & 0x3fff, data);
547547         break;
548548
549549      case 0x03:
r18027r18028
582582      switch (m_addrmode)
583583      {
584584      case 0:      /* VRAM reading mode */
585         m_buffer = this->space()->read_byte(m_addr & 0x3fff);
585         m_buffer = this->space().read_byte(m_addr & 0x3fff);
586586         m_addr += 1;
587587         break;
588588
r18027r18028
691691      y_scroll = ((m_reg[0x00] & 0x80) && (tile_column > 23)) ? 0 : m_reg9copy;
692692
693693      tile_line = ((tile_column + x_scroll_start_column) & 0x1f) * 2;
694      tile_data = space()->read_word(name_table_address + ((((line + y_scroll) % scroll_mod) >> 3) << 6) + tile_line);
694      tile_data = space().read_word(name_table_address + ((((line + y_scroll) % scroll_mod) >> 3) << 6) + tile_line);
695695
696696      tile_selected = (tile_data & 0x01ff);
697697      priority_select = tile_data & PRIORITY_BIT;
r18027r18028
703703      if (vert_selected)
704704         tile_line = 0x07 - tile_line;
705705
706      bit_plane_0 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x00);
707      bit_plane_1 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x01);
708      bit_plane_2 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x02);
709      bit_plane_3 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x03);
706      bit_plane_0 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x00);
707      bit_plane_1 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x01);
708      bit_plane_2 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x02);
709      bit_plane_3 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x03);
710710
711711      for (pixel_x = 0; pixel_x < 8 ; pixel_x++)
712712      {
r18027r18028
765765      if (m_reg[0x01] & 0x01)                         /* Check if MAG is set */
766766         m_sprite_height = m_sprite_height * 2;
767767
768      for (sprite_index = 0; (sprite_index < 32 * 4) && (space()->read_byte( m_sprite_base + sprite_index ) != 0xd0) && (m_sprite_count < max_sprites + 1); sprite_index += 4)
768      for (sprite_index = 0; (sprite_index < 32 * 4) && (space().read_byte( m_sprite_base + sprite_index ) != 0xd0) && (m_sprite_count < max_sprites + 1); sprite_index += 4)
769769      {
770         int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1;
770         int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1;
771771
772772         if (sprite_y > 240)
773773         {
r18027r18028
794794      m_sprite_height = (m_reg[0x01] & 0x02) ? 16 : 8;
795795      m_sprite_zoom = (m_reg[0x01] & 0x01) ? 2 : 1;
796796
797      for (sprite_index = 0; (sprite_index < 64) && (space()->read_byte(m_sprite_base + sprite_index ) != 0xd0 || m_y_pixels != 192) && (m_sprite_count < max_sprites + 1); sprite_index++)
797      for (sprite_index = 0; (sprite_index < 64) && (space().read_byte(m_sprite_base + sprite_index ) != 0xd0 || m_y_pixels != 192) && (m_sprite_count < max_sprites + 1); sprite_index++)
798798      {
799         int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */
799         int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */
800800
801801         if (sprite_y > 240)
802802         {
r18027r18028
844844   for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--)
845845   {
846846      int sprite_index = m_selected_sprite[sprite_buffer_index];
847      int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */
848      int sprite_x = space()->read_byte( m_sprite_base + 0x80 + (sprite_index << 1) );
849      int sprite_tile_selected = space()->read_byte( m_sprite_base + 0x81 + (sprite_index << 1) );
847      int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */
848      int sprite_x = space().read_byte( m_sprite_base + 0x80 + (sprite_index << 1) );
849      int sprite_tile_selected = space().read_byte( m_sprite_base + 0x81 + (sprite_index << 1) );
850850
851851      if (sprite_y > 240)
852852      {
r18027r18028
875875         sprite_tile_selected += 1;
876876      }
877877
878      UINT8 bit_plane_0 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x00);
879      UINT8 bit_plane_1 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x01);
880      UINT8 bit_plane_2 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x02);
881      UINT8 bit_plane_3 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x03);
878      UINT8 bit_plane_0 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x00);
879      UINT8 bit_plane_1 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x01);
880      UINT8 bit_plane_2 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x02);
881      UINT8 bit_plane_3 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x03);
882882
883883      for (int pixel_x = 0; pixel_x < 8 ; pixel_x++)
884884      {
r18027r18028
10021002   for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--)
10031003   {
10041004      int sprite_index = m_selected_sprite[sprite_buffer_index];
1005      int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1;
1006      int sprite_x = space()->read_byte( m_sprite_base + sprite_index + 1 );
1007      UINT8 flags = space()->read_byte( m_sprite_base + sprite_index + 3 );
1005      int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1;
1006      int sprite_x = space().read_byte( m_sprite_base + sprite_index + 1 );
1007      UINT8 flags = space().read_byte( m_sprite_base + sprite_index + 3 );
10081008      int pen_selected = m_palette_offset + ( flags & 0x0f );
10091009
10101010      if (sprite_y > 240)
r18027r18028
10131013      if (flags & 0x80)
10141014         sprite_x -= 32;
10151015
1016      int sprite_tile_selected = space()->read_byte( m_sprite_base + sprite_index + 2 );
1016      int sprite_tile_selected = space().read_byte( m_sprite_base + sprite_index + 2 );
10171017      int sprite_line = line - sprite_y;
10181018
10191019      if (m_reg[0x01] & 0x01)
r18027r18028
10301030         }
10311031      }
10321032
1033      UINT8 pattern = space()->read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line );
1033      UINT8 pattern = space().read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line );
10341034
10351035      for (int pixel_x = 0; pixel_x < 8; pixel_x++)
10361036      {
r18027r18028
10991099      if (m_reg[0x01] & 0x02)
11001100      {
11011101         sprite_tile_selected += 2;
1102         pattern = space()->read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line );
1102         pattern = space().read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line );
11031103         sprite_x += (m_reg[0x01] & 0x01 ? 16 : 8);
11041104
11051105         for (int pixel_x = 0; pixel_x < 8; pixel_x++)
r18027r18028
11911191
11921192   for (tile_column = 0; tile_column < 32; tile_column++)
11931193   {
1194      UINT8 name = space()->read_byte( name_table_base + tile_column );
1194      UINT8 name = space().read_byte( name_table_base + tile_column );
11951195      UINT8 pattern;
11961196      UINT8 colors;
11971197
1198      pattern = space()->read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) );
1199      colors = space()->read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) );
1198      pattern = space().read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) );
1199      colors = space().read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) );
12001200
12011201      for (pixel_x = 0; pixel_x < 8; pixel_x++)
12021202      {
r18027r18028
12371237
12381238   for (tile_column = 0; tile_column < 32; tile_column++)
12391239   {
1240      UINT8 name = space()->read_byte( name_base + tile_column );
1240      UINT8 name = space().read_byte( name_base + tile_column );
12411241      UINT8 pattern;
12421242      UINT8 colors;
12431243
1244      pattern = space()->read_byte( pattern_base + (name * 8) + (line & 0x07) );
1245      colors = space()->read_byte( color_base + ( name >> 3 ) );
1244      pattern = space().read_byte( pattern_base + (name * 8) + (line & 0x07) );
1245      colors = space().read_byte( color_base + ( name >> 3 ) );
12461246
12471247      for (pixel_x = 0; pixel_x < 8; pixel_x++)
12481248      {
trunk/src/emu/video/ramdac.c
r18027r18028
6161
6262inline UINT8 ramdac_device::readbyte(offs_t address)
6363{
64   return space()->read_byte(address);
64   return space().read_byte(address);
6565}
6666
6767
r18027r18028
7171
7272inline void ramdac_device::writebyte(offs_t address, UINT8 data)
7373{
74   space()->write_byte(address, data);
74   space().write_byte(address, data);
7575}
7676
7777//-------------------------------------------------
trunk/src/emu/machine.c
r18027r18028
224224   {
225225      cpu_device *cpu = downcast<cpu_device *>(&executing->device());
226226      if (cpu != NULL)
227         m_context.printf("'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM)->logaddrchars(), cpu->is_octal()));
227         m_context.printf("'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM).logaddrchars(), cpu->is_octal()));
228228   }
229229   else
230230      m_context.cpy("(no context)");
trunk/src/emu/sound/cdp1869.c
r18027r18028
8787
8888inline UINT8 cdp1869_device::read_page_ram_byte(offs_t pma)
8989{
90   return space()->read_byte(pma);
90   return space().read_byte(pma);
9191}
9292
9393
r18027r18028
9898
9999inline void cdp1869_device::write_page_ram_byte(offs_t pma, UINT8 data)
100100{
101   space()->write_byte(pma, data);
101   space().write_byte(pma, data);
102102}
103103
104104
trunk/src/emu/sound/c352.c
r18027r18028
461461   double u = 10.0;
462462
463463   // find our direct access
464   m_direct = &space()->direct();
464   m_direct = &space().direct();
465465
466466   m_sample_rate_base = clock() / 288;
467467
trunk/src/emu/sound/disc_inp.c
r18027r18028
2323READ8_DEVICE_HANDLER(discrete_sound_r)
2424{
2525   discrete_device *disc_device = downcast<discrete_device *>(device);
26   return   disc_device->read( *disc_device->machine().firstcpu->space(), offset, 0xff);
26   return   disc_device->read( disc_device->machine().firstcpu->space(), offset, 0xff);
2727}
2828
2929
3030WRITE8_DEVICE_HANDLER(discrete_sound_w)
3131{
3232   discrete_device *disc_device = downcast<discrete_device *>(device);
33   disc_device->write(*disc_device->machine().firstcpu->space(), offset, data, 0xff);
33   disc_device->write(disc_device->machine().firstcpu->space(), offset, data, 0xff);
3434}
3535
3636/************************************************************************
trunk/src/emu/sound/mos6560.c
r18027r18028
155155
156156inline UINT8 mos6560_device::read_videoram(offs_t offset)
157157{
158   m_last_data = space(AS_0)->read_byte(offset & 0x3fff);
158   m_last_data = space(AS_0).read_byte(offset & 0x3fff);
159159
160160   return m_last_data;
161161}
162162
163163inline UINT8 mos6560_device::read_colorram(offs_t offset)
164164{
165   return space(AS_1)->read_byte(offset & 0x3ff);
165   return space(AS_1).read_byte(offset & 0x3ff);
166166}
167167
168168/*-------------------------------------------------
trunk/src/emu/sound/okim9810.c
r18027r18028
9696void okim9810_device::device_start()
9797{
9898   // find our direct access
99   m_direct = &space()->direct();
99   m_direct = &space().direct();
100100
101101   // create the stream
102102   //int divisor = m_pin7 ? 132 : 165;
trunk/src/emu/sound/bsmt2000.c
r18027r18028
171171   m_cpu = subdevice<tms32015_device>("bsmt2000");
172172
173173   // find our direct access
174   m_direct = &space()->direct();
174   m_direct = &space().direct();
175175
176176   // create the stream; BSMT typically runs at 24MHz and writes to a DAC, so
177177   // in theory we should generate a 24MHz stream, but that's certainly overkill
trunk/src/emu/sound/qs1000.c
r18027r18028
222222void qs1000_device::device_start()
223223{
224224   // Find our direct access
225   m_direct = &space()->direct();
225   m_direct = &space().direct();
226226
227227   // The QS1000 operates at 24MHz. Creating a stream at that rate
228228   // would be overkill so we opt for a fraction of that rate which
trunk/src/emu/sound/okim6295.c
r18027r18028
118118void okim6295_device::device_start()
119119{
120120   // find our direct access
121   m_direct = &space()->direct();
121   m_direct = &space().direct();
122122
123123   // create the stream
124124   int divisor = m_pin7_state ? 132 : 165;
r18027r18028
220220   if (!m_bank_installed && base != 0)
221221   {
222222      // override our memory map with a bank
223      space()->install_read_bank(0x00000, 0x3ffff, tag());
223      space().install_read_bank(0x00000, 0x3ffff, tag());
224224      m_bank_installed = true;
225225   }
226226
trunk/src/emu/sound/es5503.c
r18027r18028
248248   int osc;
249249
250250   // find our direct access
251   m_direct = &space()->direct();
251   m_direct = &space().direct();
252252
253253   rege0 = 0xff;
254254
trunk/src/emu/sound/nes_apu.c
r18027r18028
703703   info->buffer_size+=info->samps_per_sync;
704704
705705   /* Initialize individual chips */
706   (info->APU.dpcm).memory = device->machine().device(intf->cpu_tag)->memory().space(AS_PROGRAM);
706   (info->APU.dpcm).memory = &device->machine().device(intf->cpu_tag)->memory().space(AS_PROGRAM);
707707
708708   info->stream = device->machine().sound().stream_alloc(*device, 0, 1, rate, info, nes_psg_update_sound);
709709
trunk/src/emu/drivers/testcpu.c
r18027r18028
123123   virtual void machine_start()
124124   {
125125      // find the CPU's address space
126      m_space = m_cpu->space(AS_PROGRAM);
126      m_space = &m_cpu->space(AS_PROGRAM);
127127
128128      // configure DRC in the most compatible mode
129129      ppcdrc_set_options(m_cpu, PPCDRC_COMPATIBLE_OPTIONS);
trunk/src/emu/device.h
r18027r18028
984984   // leading caret implies the owner, just skip it
985985   if (tag[0] == '^') tag++;
986986
987   // query relative to the parent
988   return (m_owner != NULL) ? m_owner->subdevice(tag) : NULL;
987   // query relative to the parent, if we have one
988   if (m_owner != NULL)
989      return m_owner->subdevice(tag);
990   
991   // otherwise, it's NULL unless the tag is absolute
992   return (tag[0] == ':') ? subdevice(tag) : NULL;
989993}
990994
991995
trunk/src/emu/machine/amigafdc.c
r18027r18028
9696void amiga_fdc::dma_done()
9797{
9898   dma_state = DMA_IDLE;
99   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
99   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
100100   amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0xffff);
101101}
102102
r18027r18028
233233                  cur_live.bit_counter = 0;
234234            }
235235            dskbyt |= 0x1000;
236            address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
236            address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
237237            amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0xffff);
238238         } else
239239            dskbyt &= ~0x1000;
trunk/src/emu/machine/s3c2440.c
r18027r18028
3838
3939DEVICE_START( s3c2440 )
4040{
41   address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
41   address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
4242   space.install_legacy_readwrite_handler( *device, 0x48000000, 0x4800003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w));
4343   space.install_legacy_readwrite_handler( *device, 0x49000000, 0x4900005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w));
4444   space.install_legacy_readwrite_handler( *device, 0x4a000000, 0x4a00001f, FUNC(s3c24xx_irq_r), FUNC(s3c24xx_irq_w));
trunk/src/emu/machine/s3c24xx.c
r18027r18028
301301static UINT32 s3c24xx_lcd_dma_read( device_t *device)
302302{
303303   s3c24xx_t *s3c24xx = get_token( device);
304   address_space& space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
304   address_space& space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
305305   UINT8 *vram, data[4];
306306   vram = (UINT8 *)space.get_read_ptr( s3c24xx->lcd.vramaddr_cur);
307307   for (int i = 0; i < 2; i++)
r18027r18028
345345static UINT32 s3c24xx_lcd_dma_read( device_t *device)
346346{
347347   s3c24xx_t *s3c24xx = get_token( device);
348   address_space& space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
348   address_space& space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
349349   UINT8 *vram, data[4];
350350   vram = (UINT8 *)space.get_read_ptr( s3c24xx->lcd.vramaddr_cur);
351351   for (int i = 0; i < 2; i++)
r18027r18028
16111611   s3c24xx_t *s3c24xx = get_token( device);
16121612   s3c24xx_dma_regs_t *regs = &s3c24xx->dma[ch].regs;
16131613   UINT32 curr_tc, curr_src, curr_dst;
1614   address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
1614   address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
16151615   int dsz, inc_src, inc_dst, servmode, tsz;
16161616   const UINT32 ch_int[] = { S3C24XX_INT_DMA0, S3C24XX_INT_DMA1, S3C24XX_INT_DMA2, S3C24XX_INT_DMA3};
16171617   verboselog( device->machine(), 5, "DMA %d trigger\n", ch);
r18027r18028
37013701   int om1 = iface_core_pin_r( device, S3C24XX_CORE_PIN_OM1);
37023702   if ((om0 == 0) && (om1 == 0))
37033703   {
3704      address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
3704      address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
37053705      space.install_ram( 0x00000000, 0x00000fff, s3c24xx->steppingstone);
37063706      space.install_ram( 0x40000000, 0x40000fff, s3c24xx->steppingstone);
37073707   }
trunk/src/emu/machine/i8155.c
r18027r18028
538538
539539READ8_MEMBER( i8155_device::memory_r )
540540{
541   return this->space()->read_byte(offset);
541   return this->space().read_byte(offset);
542542}
543543
544544
r18027r18028
548548
549549WRITE8_MEMBER( i8155_device::memory_w )
550550{
551   this->space()->write_byte(offset, data);
551   this->space().write_byte(offset, data);
552552}
553553
554554
trunk/src/emu/machine/idectrl.c
r18027r18028
18591859      device_memory_interface *memory;
18601860      if (!bmtarget->interface(memory))
18611861         throw emu_fatalerror("IDE controller '%s' bus master target '%s' has no memory!", device->tag(), config->bmcpu);
1862      ide->dma_space = memory->space(config->bmspace);
1863      if (ide->dma_space == NULL)
1864         throw emu_fatalerror("IDE controller '%s' bus master target '%s' does not have specified space %d!", device->tag(), config->bmcpu, config->bmspace);
1862      ide->dma_space = &memory->space(config->bmspace);
18651863      ide->dma_address_xor = (ide->dma_space->endianness() == ENDIANNESS_LITTLE) ? 0 : 3;
18661864   }
18671865
trunk/src/emu/machine/6821pia.h
r18027r18028
9494    void set_port_a_z_mask(UINT8 data) { m_port_a_z_mask = data; }// see second note in .c
9595
9696   DECLARE_READ8_MEMBER( porta_r );
97    UINT8 porta_r() { return porta_r(*machine().memory().first_space(), 0); }
97    UINT8 porta_r() { return porta_r(machine().driver_data()->generic_space(), 0); }
9898    DECLARE_WRITE8_MEMBER( porta_w );
99    void porta_w(UINT8 data) { porta_w(*machine().memory().first_space(), 0, data); }
99    void porta_w(UINT8 data) { porta_w(machine().driver_data()->generic_space(), 0, data); }
100100    void set_a_input(UINT8 data, UINT8 z_mask);
101101    UINT8 a_output();
102102
r18027r18028
109109    int ca2_output_z();
110110
111111   DECLARE_READ8_MEMBER( portb_r );
112    UINT8 portb_r() { return portb_r(*machine().memory().first_space(), 0); }
112    UINT8 portb_r() { return portb_r(machine().driver_data()->generic_space(), 0); }
113113    DECLARE_WRITE8_MEMBER( portb_w );
114    void portb_w(UINT8 data) { portb_w(*machine().memory().first_space(), 0, data); }
114    void portb_w(UINT8 data) { portb_w(machine().driver_data()->generic_space(), 0, data); }
115115    UINT8 b_output();
116116
117117    DECLARE_READ_LINE_MEMBER( cb1_r );
trunk/src/emu/machine/6840ptm.h
r18027r18028
6161   int ext_clock(int counter) const { return m_external_clock[counter]; }   // get clock frequency
6262
6363   DECLARE_WRITE8_MEMBER( write );
64   void write(offs_t offset, UINT8 data) { write(*machine().memory().first_space(), offset, data); }
64   void write(offs_t offset, UINT8 data) { write(machine().driver_data()->generic_space(), offset, data); }
6565   DECLARE_READ8_MEMBER( read );
66   UINT8 read(offs_t offset) { return read(*machine().memory().first_space(), offset); }
66   UINT8 read(offs_t offset) { return read(machine().driver_data()->generic_space(), offset); }
6767
6868   void set_gate(int idx, int state);
6969   DECLARE_WRITE_LINE_MEMBER( set_g1 );
trunk/src/emu/machine/s3c2400.c
r18027r18028
3838
3939DEVICE_START( s3c2400 )
4040{
41   address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
41   address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
4242   DEVICE_START_CALL(s3c24xx);
4343   space.install_legacy_readwrite_handler( *device, 0x14000000, 0x1400003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w));
4444   space.install_legacy_readwrite_handler( *device, 0x14200000, 0x1420005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w));
trunk/src/emu/machine/s3c2410.c
r18027r18028
3838
3939DEVICE_START( s3c2410 )
4040{
41   address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
41   address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM);
4242   DEVICE_START_CALL(s3c24xx);
4343   space.install_legacy_readwrite_handler( *device, 0x48000000, 0x4800003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w));
4444   space.install_legacy_readwrite_handler( *device, 0x49000000, 0x4900005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w));
trunk/src/emu/machine/microtch.c
r18027r18028
343343void microtouch_serial_device::rcv_complete()
344344{
345345   receive_register_extract();
346   microtouch_device::rx(*machine().memory().first_space(), 0, get_received_char());
346   microtouch_device::rx(machine().driver_data()->generic_space(), 0, get_received_char());
347347}
trunk/src/emu/machine/i8355.c
r18027r18028
227227
228228READ8_MEMBER( i8355_device::memory_r )
229229{
230   return this->space()->read_byte(offset);
230   return this->space().read_byte(offset);
231231}
trunk/src/emu/driver.c
r18027r18028
4242
4343
4444//**************************************************************************
45//   ADDRESS_MAPS
46//**************************************************************************
47
48// default address map
49static ADDRESS_MAP_START( generic, AS_0, 8, driver_device )
50   AM_RANGE(0x00000000, 0xffffffff) AM_DEVREADWRITE(":", driver_device, fatal_generic_read, fatal_generic_write)
51ADDRESS_MAP_END
52
53
54
55//**************************************************************************
4556//  DRIVER DEVICE
4657//**************************************************************************
4758
r18027r18028
5162
5263driver_device::driver_device(const machine_config &mconfig, device_type type, const char *tag)
5364   : device_t(mconfig, type, "Driver Device", tag, NULL, 0),
65     device_memory_interface(mconfig, *this),
5466     m_generic_paletteram_8(*this, "paletteram"),
5567     m_generic_paletteram2_8(*this, "paletteram2"),
5668     m_generic_paletteram_16(*this, "paletteram"),
5769     m_generic_paletteram2_16(*this, "paletteram2"),
5870     m_generic_paletteram_32(*this, "paletteram"),
5971     m_generic_paletteram2_32(*this, "paletteram2"),
72     m_space_config("generic", ENDIANNESS_LITTLE, 8, 32, 0, NULL, *ADDRESS_MAP_NAME(generic)),
6073     m_system(NULL),
6174     m_latch_clear_value(0),
6275     m_flip_screen_x(0),
r18027r18028
313326}
314327
315328
329//-------------------------------------------------
330//  memory_space_config - return a description of
331//  any address spaces owned by this device
332//-------------------------------------------------
333
334const address_space_config *driver_device::memory_space_config(address_spacenum spacenum) const
335{
336   return (spacenum == 0) ? &m_space_config : NULL;
337}
338
339
340
316341//**************************************************************************
317342//  INTERRUPT ENABLE AND VECTOR HELPERS
318343//**************************************************************************
r18027r18028
737762// 8-8-8 RGB palette write handlers
738763WRITE16_MEMBER( driver_device::paletteram_xrgb_word_be_w ) { palette_32bit_word_be_w<8,8,8, 16,8,0>(space, offset, data, mem_mask); }
739764WRITE16_MEMBER( driver_device::paletteram_xbgr_word_be_w ) { palette_32bit_word_be_w<8,8,8, 0,8,16>(space, offset, data, mem_mask); }
765
766
767
768//**************************************************************************
769//  MISC READ/WRITE HANDLERS
770//**************************************************************************
771
772//-------------------------------------------------
773//  generic space fatal error handlers
774//-------------------------------------------------
775
776READ8_MEMBER( driver_device::fatal_generic_read )
777{
778   throw emu_fatalerror("Attempted to read from generic address space (offs %X)\n", offset);
779}
780
781WRITE8_MEMBER( driver_device::fatal_generic_write )
782{
783   throw emu_fatalerror("Attempted to write to generic address space (offs %X = %02X)\n", offset, data);
784}
785
786
trunk/src/emu/driver.h
r18027r18028
166166// ======================> driver_device
167167
168168// base class for machine driver-specific devices
169class driver_device :    public device_t
169class driver_device :    public device_t,
170                  public device_memory_interface
170171{
171172public:
172173   // construction/destruction
r18027r18028
205206   void init_0() { }
206207   
207208   // memory helpers
208   address_space &generic_space() const { return *machine().memory().first_space(); }
209   address_space &generic_space() const { return space(AS_PROGRAM); }
209210
210211   // generic interrupt generators
211212   void generic_pulse_irq_line(device_execute_interface &exec, int irqline, int cycles);
r18027r18028
380381   DECLARE_WRITE16_MEMBER( paletteram_xbgr_word_be_w );
381382
382383   // generic input port helpers
383   // custom handler
384384   DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read );
385385
386   // general fatal error handlers
387   DECLARE_READ8_MEMBER( fatal_generic_read );
388   DECLARE_WRITE8_MEMBER( fatal_generic_write );
389
386390protected:
387391   // helpers called at startup
388392   virtual void driver_start();
r18027r18028
403407   virtual void device_start();
404408   virtual void device_reset_after_children();
405409
410   // device_memory_interface overrides
411   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
412
406413   // internal helpers
407414   inline UINT16 paletteram16_le(offs_t offset) const { return m_generic_paletteram_8[offset & ~1] | (m_generic_paletteram_8[offset |  1] << 8); }
408415   inline UINT16 paletteram16_be(offs_t offset) const { return m_generic_paletteram_8[offset |  1] | (m_generic_paletteram_8[offset & ~1] << 8); }
r18027r18028
424431   void soundlatch_sync_callback(void *ptr, INT32 param);
425432   void updateflip();
426433
434   // configuration state
435   const address_space_config  m_space_config;
436
427437   // internal state
428438   const game_driver *      m_system;               // pointer to the game driver
429439   driver_callback_delegate m_callbacks[CB_COUNT];      // start/reset callbacks
trunk/src/emu/dimemory.h
r18027r18028
109109   static void static_set_addrmap(device_t &device, address_spacenum spacenum, address_map_constructor map);
110110
111111   // basic information getters
112   address_space *space(int index = 0) const { return m_addrspace[index]; }
113   address_space *space(address_spacenum index) const { return m_addrspace[static_cast<int>(index)]; }
112   bool has_space(int index = 0) const { return (m_addrspace[index] != NULL); }
113   bool has_space(address_spacenum index) const { return (m_addrspace[int(index)] != NULL); }
114   address_space &space(int index = 0) const { assert(m_addrspace[index] != NULL); return *m_addrspace[index]; }
115   address_space &space(address_spacenum index) const { assert(m_addrspace[int(index)] != NULL); return *m_addrspace[int(index)]; }
114116
115117   // address space accessors
116118   void set_address_space(address_spacenum spacenum, address_space &space);
trunk/src/mess/audio/mos7360.c
r18027r18028
237237   int rom = m_rom;
238238   m_rom = 0;
239239
240   m_last_data = space(AS_0)->read_byte(offset);
240   m_last_data = space(AS_0).read_byte(offset);
241241
242242   m_rom = rom;
243243
r18027r18028
249249   int rom = m_rom;
250250   m_rom = 1;
251251
252   m_last_data = space(AS_0)->read_byte(offset);
252   m_last_data = space(AS_0).read_byte(offset);
253253
254254   m_rom = rom;
255255
trunk/src/mess/audio/svision.c
r18027r18028
261261         }
262262         else
263263         {
264            sample = device->machine().device("maincpu")->memory().space(AS_PROGRAM)->read_byte(addr);
264            sample = device->machine().device("maincpu")->memory().space(AS_PROGRAM).read_byte(addr);
265265         }
266266         if (((unsigned)state->dma.pos) & 1)
267267            s = (sample & 0xf);
trunk/src/mess/machine/dgn_beta.c
r18027r18028
256256static void UpdateBanks(running_machine &machine, int first, int last)
257257{
258258   dgn_beta_state *state = machine.driver_data<dgn_beta_state>();
259   address_space *space_0 = machine.device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
260   address_space *space_1 = machine.device(DMACPU_TAG)->memory().space(AS_PROGRAM);
259   address_space &space_0 = machine.device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
260   address_space &space_1 = machine.device(DMACPU_TAG)->memory().space(AS_PROGRAM);
261261   int                  Page;
262262   UINT8              *readbank;
263263   int                  bank_start;
r18027r18028
265265   int                  MapPage;
266266   char                page_num[10];
267267
268   LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,space_0->device().safe_pc()));
268   LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,space_0.device().safe_pc()));
269269   for(Page=first;Page<=last;Page++)
270270   {
271271      sprintf(page_num,"bank%d",Page+1);
r18027r18028
295295            readbank = &machine.device<ram_device>(RAM_TAG)->pointer()[(MapPage*RamPageSize)-256];
296296            logerror("Error RAM in Last page !\n");
297297         }
298         space_0->install_legacy_write_handler(bank_start, bank_end,bank_info[Page].func,bank_info[Page].name);
299         space_1->install_legacy_write_handler(bank_start, bank_end,bank_info[Page].func,bank_info[Page].name);
298         space_0.install_legacy_write_handler(bank_start, bank_end,bank_info[Page].func,bank_info[Page].name);
299         space_1.install_legacy_write_handler(bank_start, bank_end,bank_info[Page].func,bank_info[Page].name);
300300      }
301301      else               // Block is rom, or undefined
302302      {
r18027r18028
310310         else
311311            readbank=state->m_system_rom;
312312
313         space_0->unmap_write(bank_start, bank_end);
314         space_1->unmap_write(bank_start, bank_end);
313         space_0.unmap_write(bank_start, bank_end);
314         space_1.unmap_write(bank_start, bank_end);
315315      }
316316
317317      state->m_PageRegs[state->m_TaskReg][Page].memory=readbank;
trunk/src/mess/machine/ataricrt.c
r18027r18028
4242   offs_t ram_top;
4343   // take care of 0x0000-0x7fff: RAM or NOP
4444   ram_top = MIN(machine.device<ram_device>(RAM_TAG)->size(), 0x8000) - 1;
45   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, ram_top, "0000");
45   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0x0000, ram_top, "0000");
4646   machine.root_device().membank("0000")->set_base(machine.device<ram_device>(RAM_TAG)->pointer());
4747
4848   // take care of 0x8000-0x9fff: A800 -> either right slot or RAM or NOP, others -> RAM or NOP
4949   // is there anything in the right slot?
5050   if (cart_mounted & RIGHT_CARTSLOT_MOUNTED)
5151   {
52      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x9fff, "8000");
52      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0x9fff, "8000");
5353      machine.root_device().membank("8000")->set_base(machine.root_device().memregion("rslot")->base());
54      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0x9fff);
54      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0x9fff);
5555   }
5656   else if (a800_cart_type != BBSB)
5757   {
5858      ram_top = MIN(machine.device<ram_device>(RAM_TAG)->size(), 0xa000) - 1;
5959      if (ram_top > 0x8000)
6060      {
61         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x8000, ram_top, "8000");
61         machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0x8000, ram_top, "8000");
6262         machine.root_device().membank("8000")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x8000);
6363      }
6464   }
r18027r18028
7171      {
7272         if (a800_cart_type == A800_16K)
7373         {
74            machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x9fff, "8000");
74            machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0x9fff, "8000");
7575            machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base());
76            machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0x9fff);
76            machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0x9fff);
7777
7878            memcpy(machine.root_device().memregion("maincpu")->base() + 0x10000, machine.root_device().memregion("lslot")->base() + 0x2000, 0x2000);
7979         }
r18027r18028
8686      {
8787         machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base());
8888         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base() + 0x2000);
89         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0xbfff);
89         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
9090      }
9191      else if (a800_cart_type == BBSB)
9292      {
9393         // this requires separate banking in 0x8000 & 0x9000!
94         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0x8fff, "8000");
95         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x9000, 0x9fff, "9000");
94         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0x8fff, "8000");
95         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x9000, 0x9fff, "9000");
9696         machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base() + 0x0000);
9797         machine.root_device().membank("9000")->set_base(machine.root_device().memregion("lslot")->base() + 0x4000);
9898         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base() + 0x8000);
99         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
99         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
100100      }
101101      else if (a800_cart_type == OSS_034M)
102102      {
103103         // this requires separate banking in 0xa000 & 0xb000!
104         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xafff, "a000");
105         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xb000, 0xbfff, "b000");
104         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xafff, "a000");
105         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xb000, 0xbfff, "b000");
106106         machine.root_device().membank("b000")->set_base(machine.root_device().memregion("lslot")->base() + 0x3000);
107         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
107         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
108108      }
109109      else if (a800_cart_type == OSS_M091)
110110      {
111111         // this requires separate banking in 0xa000 & 0xb000!
112         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xafff, "a000");
113         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xb000, 0xbfff, "b000");
112         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xafff, "a000");
113         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xb000, 0xbfff, "b000");
114114         machine.root_device().membank("b000")->set_base(machine.root_device().memregion("lslot")->base());
115         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
115         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
116116      }
117117      else if (a800_cart_type == XEGS_32K)
118118      {
119119         machine.root_device().membank("8000")->set_base(machine.root_device().memregion("lslot")->base());
120120         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base() + 0x6000);
121         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x8000, 0xbfff);
121         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
122122      }
123123      else
124124      {
125125         machine.root_device().membank("a000")->set_base(machine.root_device().memregion("lslot")->base());
126         machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa000, 0xbfff);
126         machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xa000, 0xbfff);
127127      }
128128   }
129129}
r18027r18028
352352      case PHOENIX_8K:   // as normal 8k cart, but it can be disabled by writing to 0xd500-0xdfff
353353         break;
354354      case XEGS_32K:
355         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd500, 0xd5ff, FUNC(x32_bank_w));
355         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xd500, 0xd5ff, FUNC(x32_bank_w));
356356         break;
357357      case OSS_034M:
358         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd500, 0xd5ff, FUNC(oss_034m_w));
358         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xd500, 0xd5ff, FUNC(oss_034m_w));
359359         break;
360360      case OSS_M091:
361         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd500, 0xd5ff, FUNC(oss_m091_w));
361         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xd500, 0xd5ff, FUNC(oss_m091_w));
362362         break;
363363      case BBSB:
364         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x8000, 0x8fff, FUNC(bbsb_bankl_w));
365         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x9000, 0x9fff, FUNC(bbsb_bankh_w));
364         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x8000, 0x8fff, FUNC(bbsb_bankl_w));
365         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x9000, 0x9fff, FUNC(bbsb_bankh_w));
366366         break;
367367      case WILLIAMS_64K:
368         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd500, 0xd50f, FUNC(w64_bank_w));
368         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xd500, 0xd50f, FUNC(w64_bank_w));
369369         break;
370370      case DIAMOND_64K:
371         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd5d0, 0xd5df, FUNC(ex64_bank_w));
371         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xd5d0, 0xd5df, FUNC(ex64_bank_w));
372372         break;
373373      case EXPRESS_64:
374         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd570, 0xd57f, FUNC(ex64_bank_w));
374         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xd570, 0xd57f, FUNC(ex64_bank_w));
375375         break;
376376      case SPARTADOS_X:
377         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd5e0, 0xd5ef, FUNC(ex64_bank_w));
377         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xd5e0, 0xd5ef, FUNC(ex64_bank_w));
378378         break;
379379      default:
380380         break;
r18027r18028
665665
666666MACHINE_START( xegs )
667667{
668   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
668   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
669669   UINT8 *cart = space.machine().root_device().memregion("user1")->base();
670670   UINT8 *cpu  = space.machine().root_device().memregion("maincpu")->base();
671671
trunk/src/mess/machine/s100_wunderbus.c
r18027r18028
415415         break;
416416
417417      case 1:
418         data = m_ace1->ins8250_r(*machine().memory().first_space(), offset & 0x07);
418         data = m_ace1->ins8250_r(machine().driver_data()->generic_space(), offset & 0x07);
419419         break;
420420
421421      case 2:
422         data = m_ace2->ins8250_r(*machine().memory().first_space(), offset & 0x07);
422         data = m_ace2->ins8250_r(machine().driver_data()->generic_space(), offset & 0x07);
423423         break;
424424
425425      case 3:
426         data = m_ace3->ins8250_r(*machine().memory().first_space(), offset & 0x07);
426         data = m_ace3->ins8250_r(machine().driver_data()->generic_space(), offset & 0x07);
427427         break;
428428      }
429429   }
r18027r18028
538538         break;
539539
540540      case 1:
541         m_ace1->ins8250_w(*machine().memory().first_space(), offset & 0x07, data);
541         m_ace1->ins8250_w(machine().driver_data()->generic_space(), offset & 0x07, data);
542542         break;
543543
544544      case 2:
545         m_ace2->ins8250_w(*machine().memory().first_space(), offset & 0x07, data);
545         m_ace2->ins8250_w(machine().driver_data()->generic_space(), offset & 0x07, data);
546546         break;
547547
548548      case 3:
549         m_ace3->ins8250_w(*machine().memory().first_space(), offset & 0x07, data);
549         m_ace3->ins8250_w(machine().driver_data()->generic_space(), offset & 0x07, data);
550550         break;
551551      }
552552   }
trunk/src/mess/machine/apple3.c
r18027r18028
327327   apple3_state *state = machine.driver_data<apple3_state>();
328328   UINT16 bank;
329329   UINT8 page;
330   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
330   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
331331
332332   if (LOG_MEMORY)
333333   {
r18027r18028
734734   m_via_1_irq = 0;
735735   apple3_update_memory(machine());
736736
737   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(apple3_state::apple3_opbase), this));
737   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(apple3_state::apple3_opbase), this));
738738}
trunk/src/mess/machine/msx_slot.c
r18027r18028
3131static void msx_cpu_setbank (running_machine &machine, int page, UINT8 *mem)
3232{
3333   msx_state *state = machine.driver_data<msx_state>();
34   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
34   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
3535   switch (page)
3636   {
3737   case 1:
r18027r18028
379379      msx_cpu_setbank (machine, 5, state->m_mem + state->m_banks[2] * 0x2000);
380380      msx_cpu_setbank (machine, 6, state->m_mem + state->m_banks[3] * 0x2000);
381381      if (state->m_cart.scc.active ) {
382         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x9800, 0x9fff, FUNC(konami_scc_bank5));
382         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x9800, 0x9fff, FUNC(konami_scc_bank5));
383383      } else {
384         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x9800, 0x9fff,"bank7");
384         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x9800, 0x9fff,"bank7");
385385      }
386386      break;
387387   case 3:
r18027r18028
393393MSX_SLOT_WRITE(konami_scc)
394394{
395395   msx_state *drvstate = machine.driver_data<msx_state>();
396   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
396   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
397397   if (addr >= 0x5000 && addr < 0x5800)
398398   {
399399      state->m_banks[0] = val & state->m_bank_mask;
r18027r18028
12791279MSX_SLOT_MAP(diskrom)
12801280{
12811281   msx_state *drvstate = machine.driver_data<msx_state>();
1282   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1282   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12831283   switch (page)
12841284   {
12851285   case 0:
r18027r18028
13061306MSX_SLOT_WRITE(diskrom)
13071307{
13081308   device_t *fdc = machine.device("wd179x");
1309   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1309   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
13101310   if (addr >= 0xa000 && addr < 0xc000)
13111311   {
13121312      addr -= 0x4000;
r18027r18028
14081408MSX_SLOT_MAP(diskrom2)
14091409{
14101410   msx_state *drvstate = machine.driver_data<msx_state>();
1411   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1411   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
14121412   switch (page)
14131413   {
14141414   case 0:
r18027r18028
14341434MSX_SLOT_WRITE(diskrom2)
14351435{
14361436   device_t *fdc = machine.device("wd179x");
1437   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1437   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
14381438   if (addr >= 0xa000 && addr < 0xc000)
14391439   {
14401440      addr -= 0x4000;
r18027r18028
16851685MSX_SLOT_WRITE(fmpac)
16861686{
16871687   msx_state *drvstate = machine.driver_data<msx_state>();
1688   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1688   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
16891689   int i, data;
16901690
16911691   if (addr >= 0x4000 && addr < 0x6000 && state->m_cart.fmpac.sram_support)
r18027r18028
22442244
22452245MSX_SLOT_MAP(soundcartridge)
22462246{
2247   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2247   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
22482248   switch (page)
22492249   {
22502250   case 0:
r18027r18028
22792279MSX_SLOT_WRITE(soundcartridge)
22802280{
22812281   msx_state *drvstate = machine.driver_data<msx_state>();
2282   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2282   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
22832283   int i;
22842284
22852285   if (addr < 0x4000)
trunk/src/mess/machine/mbee.c
r18027r18028
222222
223223WRITE8_MEMBER( mbee_state::mbee_04_w )   // address
224224{
225   address_space *mem = m_maincpu->space(AS_IO);
226   machine().device<mc146818_device>("rtc")->write(*mem, 0, data);
225   address_space &mem = m_maincpu->space(AS_IO);
226   machine().device<mc146818_device>("rtc")->write(mem, 0, data);
227227}
228228
229229WRITE8_MEMBER( mbee_state::mbee_06_w )   // write
230230{
231   address_space *mem = m_maincpu->space(AS_IO);
232   machine().device<mc146818_device>("rtc")->write(*mem, 1, data);
231   address_space &mem = m_maincpu->space(AS_IO);
232   machine().device<mc146818_device>("rtc")->write(mem, 1, data);
233233}
234234
235235READ8_MEMBER( mbee_state::mbee_07_r )   // read
236236{
237   address_space *mem = m_maincpu->space(AS_IO);
238   return machine().device<mc146818_device>("rtc")->read(*mem, 1);
237   address_space &mem = m_maincpu->space(AS_IO);
238   return machine().device<mc146818_device>("rtc")->read(mem, 1);
239239}
240240
241241static TIMER_CALLBACK( mbee_rtc_irq )
242242{
243243   mbee_state *state = machine.driver_data<mbee_state>();
244   address_space *mem = machine.device("maincpu")->memory().space(AS_IO);
245   UINT8 data = machine.device<mc146818_device>("rtc")->read(*mem, 12);
244   address_space &mem = machine.device("maincpu")->memory().space(AS_IO);
245   UINT8 data = machine.device<mc146818_device>("rtc")->read(mem, 12);
246246   if (data) state->m_clock_pulse = 0x80;
247247}
248248
r18027r18028
263263
264264WRITE8_MEMBER( mbee_state::mbee256_50_w )
265265{
266   address_space *mem = m_maincpu->space(AS_PROGRAM);
266   address_space &mem = m_maincpu->space(AS_PROGRAM);
267267
268268   // primary low banks
269269   membank("boot")->set_entry((data & 3) | ((data & 0x20) >> 3));
r18027r18028
273273   membank("bank9")->set_entry((data & 4) ? 1 : 0);
274274
275275   // 8000-8FFF, F000-FFFF
276   mem->unmap_readwrite (0x8000, 0x87ff);
277   mem->unmap_readwrite (0x8800, 0x8fff);
278   mem->unmap_readwrite (0xf000, 0xf7ff);
279   mem->unmap_readwrite (0xf800, 0xffff);
276   mem.unmap_readwrite (0x8000, 0x87ff);
277   mem.unmap_readwrite (0x8800, 0x8fff);
278   mem.unmap_readwrite (0xf000, 0xf7ff);
279   mem.unmap_readwrite (0xf800, 0xffff);
280280
281281   switch (data & 0x1c)
282282   {
283283      case 0x00:
284         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
285         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
286         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
287         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
284         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
285         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
286         mem.install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
287         mem.install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
288288         membank("bank8l")->set_entry(0); // rom
289289         membank("bank8h")->set_entry(0); // rom
290290         break;
291291      case 0x04:
292         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
293         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
294         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
295         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
292         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
293         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
294         mem.install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
295         mem.install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
296296         membank("bank8l")->set_entry(1); // ram
297297         membank("bank8h")->set_entry(1); // ram
298298         break;
299299      case 0x08:
300300      case 0x18:
301         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
302         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
303         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
304         mem->install_read_bank (0xf800, 0xffff, "bankfh");
301         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
302         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
303         mem.install_read_bank (0xf000, 0xf7ff, "bankfl");
304         mem.install_read_bank (0xf800, 0xffff, "bankfh");
305305         membank("bank8l")->set_entry(0); // rom
306306         membank("bank8h")->set_entry(0); // rom
307307         membank("bankfl")->set_entry(0); // ram
r18027r18028
309309         break;
310310      case 0x0c:
311311      case 0x1c:
312         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
313         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
314         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
315         mem->install_read_bank (0xf800, 0xffff, "bankfh");
312         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
313         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
314         mem.install_read_bank (0xf000, 0xf7ff, "bankfl");
315         mem.install_read_bank (0xf800, 0xffff, "bankfh");
316316         membank("bank8l")->set_entry(1); // ram
317317         membank("bank8h")->set_entry(1); // ram
318318         membank("bankfl")->set_entry(0); // ram
r18027r18028
320320         break;
321321      case 0x10:
322322      case 0x14:
323         mem->install_readwrite_handler (0x8000, 0x87ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
324         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
325         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
326         mem->install_read_bank (0xf800, 0xffff, "bankfh");
323         mem.install_readwrite_handler (0x8000, 0x87ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w), this));
324         mem.install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r), this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w), this));
325         mem.install_read_bank (0xf000, 0xf7ff, "bankfl");
326         mem.install_read_bank (0xf800, 0xffff, "bankfh");
327327         membank("bankfl")->set_entry(0); // ram
328328         membank("bankfh")->set_entry(0); // ram
329329         break;
r18027r18028
345345
346346WRITE8_MEMBER( mbee_state::mbee128_50_w )
347347{
348   address_space *mem = m_maincpu->space(AS_PROGRAM);
348   address_space &mem = m_maincpu->space(AS_PROGRAM);
349349
350350   // primary low banks
351351   membank("boot")->set_entry((data & 3));
r18027r18028
355355   membank("bank9")->set_entry((data & 4) ? 1 : 0);
356356
357357   // 8000-8FFF, F000-FFFF
358   mem->unmap_readwrite (0x8000, 0x87ff);
359   mem->unmap_readwrite (0x8800, 0x8fff);
360   mem->unmap_readwrite (0xf000, 0xf7ff);
361   mem->unmap_readwrite (0xf800, 0xffff);
358   mem.unmap_readwrite (0x8000, 0x87ff);
359   mem.unmap_readwrite (0x8800, 0x8fff);
360   mem.unmap_readwrite (0xf000, 0xf7ff);
361   mem.unmap_readwrite (0xf800, 0xffff);
362362
363363   switch (data & 0x1c)
364364   {
365365      case 0x00:
366         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
367         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
368         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
369         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
366         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
367         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
368         mem.install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
369         mem.install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
370370         membank("bank8l")->set_entry(0); // rom
371371         membank("bank8h")->set_entry(0); // rom
372372         break;
373373      case 0x04:
374         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
375         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
376         mem->install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
377         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
374         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
375         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
376         mem.install_readwrite_handler (0xf000, 0xf7ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
377         mem.install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
378378         membank("bank8l")->set_entry(1); // ram
379379         membank("bank8h")->set_entry(1); // ram
380380         break;
381381      case 0x08:
382382      case 0x18:
383         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
384         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
385         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
386         mem->install_read_bank (0xf800, 0xffff, "bankfh");
383         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
384         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
385         mem.install_read_bank (0xf000, 0xf7ff, "bankfl");
386         mem.install_read_bank (0xf800, 0xffff, "bankfh");
387387         membank("bank8l")->set_entry(0); // rom
388388         membank("bank8h")->set_entry(0); // rom
389389         membank("bankfl")->set_entry(0); // ram
r18027r18028
391391         break;
392392      case 0x0c:
393393      case 0x1c:
394         mem->install_read_bank (0x8000, 0x87ff, "bank8l");
395         mem->install_read_bank (0x8800, 0x8fff, "bank8h");
396         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
397         mem->install_read_bank (0xf800, 0xffff, "bankfh");
394         mem.install_read_bank (0x8000, 0x87ff, "bank8l");
395         mem.install_read_bank (0x8800, 0x8fff, "bank8h");
396         mem.install_read_bank (0xf000, 0xf7ff, "bankfl");
397         mem.install_read_bank (0xf800, 0xffff, "bankfh");
398398         membank("bank8l")->set_entry(1); // ram
399399         membank("bank8h")->set_entry(1); // ram
400400         membank("bankfl")->set_entry(0); // ram
r18027r18028
402402         break;
403403      case 0x10:
404404      case 0x14:
405         mem->install_readwrite_handler (0x8000, 0x87ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
406         mem->install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
407         mem->install_read_bank (0xf000, 0xf7ff, "bankfl");
408         mem->install_read_bank (0xf800, 0xffff, "bankfh");
405         mem.install_readwrite_handler (0x8000, 0x87ff, read8_delegate(FUNC(mbee_state::mbeeppc_low_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_low_w),this));
406         mem.install_readwrite_handler (0x8800, 0x8fff, read8_delegate(FUNC(mbee_state::mbeeppc_high_r),this), write8_delegate(FUNC(mbee_state::mbeeppc_high_w),this));
407         mem.install_read_bank (0xf000, 0xf7ff, "bankfl");
408         mem.install_read_bank (0xf800, 0xffff, "bankfh");
409409         membank("bankfl")->set_entry(0); // ram
410410         membank("bankfh")->set_entry(0); // ram
411411         break;
r18027r18028
532532
533533MACHINE_RESET_MEMBER(mbee_state,mbee128)
534534{
535   address_space *mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
535   address_space &mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
536536   machine_reset_common_disk(machine());
537   mbee128_50_w(*mem,0,0); // set banks to default
537   mbee128_50_w(mem,0,0); // set banks to default
538538   membank("boot")->set_entry(4); // boot time
539539}
540540
541541MACHINE_RESET_MEMBER(mbee_state,mbee256)
542542{
543543   UINT8 i;
544   address_space *mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
544   address_space &mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
545545   machine_reset_common_disk(machine());
546546   for (i = 0; i < 15; i++) m_mbee256_was_pressed[i] = 0;
547547   m_mbee256_q_pos = 0;
548   mbee256_50_w(*mem,0,0); // set banks to default
548   mbee256_50_w(mem,0,0); // set banks to default
549549   membank("boot")->set_entry(8); // boot time
550550   machine().scheduler().timer_set(attotime::from_usec(4), FUNC(mbee_reset));
551551}
r18027r18028
564564// Due to the uncertainly and hackage here, this is commented out for now - Robbbert - 05-Oct-2010
565565#if 0
566566
567   //address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
567   //address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
568568   /* The printer status connects to the pio ASTB pin, and the printer changing to not
569569        busy should signal an interrupt routine at B61C, (next line) but this doesn't work.
570570        The line below does what the interrupt should be doing. */
r18027r18028
753753{
754754   mbee_state *state = image.device().machine().driver_data<mbee_state>();
755755   device_t *cpu = image.device().machine().device("maincpu");
756   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
756   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
757757   UINT16 i, j;
758758   UINT8 data, sw = image.device().machine().root_device().ioport("CONFIG")->read() & 1;   /* reading the dipswitch: 1 = autorun */
759759
trunk/src/mess/machine/pokemini.c
r18027r18028
14161416static TIMER_CALLBACK( pokemini_prc_counter_callback )
14171417{
14181418   pokemini_state *state = machine.driver_data<pokemini_state>();
1419   address_space &space = *machine.device( "maincpu")->memory().space( AS_PROGRAM );
1419   address_space &space = machine.device( "maincpu")->memory().space( AS_PROGRAM );
14201420   state->m_prc.count++;
14211421
14221422   /* Check for overflow */
trunk/src/mess/machine/pc1350.c
r18027r18028
9999MACHINE_START( pc1350 )
100100{
101101   pc1350_state *state = machine.driver_data<pc1350_state>();
102   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
102   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
103103
104104   state->m_power = 1;
105105   machine.scheduler().timer_set(attotime::from_seconds(1), FUNC(pc1350_power_up));
trunk/src/mess/machine/coco_vhd.c
r18027r18028
106106{
107107   m_status = VHDSTATUS_NO_VHD_ATTACHED;
108108   m_cpu = machine().device<cpu_device>(MAINCPU_TAG);
109   m_cpu_space = m_cpu->space(AS_PROGRAM);
109   m_cpu_space = &m_cpu->space(AS_PROGRAM);
110110}
111111
112112
trunk/src/mess/machine/northbridge.c
r18027r18028
2424
2525void northbridge_device::device_start()
2626{
27   address_space& space = *machine().device(":maincpu")->memory().space(AS_PROGRAM);
27   address_space& space = machine().device(":maincpu")->memory().space(AS_PROGRAM);
2828
2929   machine().root_device().membank("bank10")->set_base(m_ram->pointer());
3030
trunk/src/mess/machine/pmd85.c
r18027r18028
2828static void pmd851_update_memory(running_machine &machine)
2929{
3030   pmd85_state *state = machine.driver_data<pmd85_state>();
31   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
31   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
3232   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
3333
3434   if (state->m_startup_mem_map)
r18027r18028
7373static void pmd852a_update_memory(running_machine &machine)
7474{
7575   pmd85_state *state = machine.driver_data<pmd85_state>();
76   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
76   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
7777   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
7878
7979   if (state->m_startup_mem_map)
r18027r18028
149149static void alfa_update_memory(running_machine &machine)
150150{
151151   pmd85_state *state = machine.driver_data<pmd85_state>();
152   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
152   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
153153   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
154154
155155   if (state->m_startup_mem_map)
r18027r18028
183183static void mato_update_memory(running_machine &machine)
184184{
185185   pmd85_state *state = machine.driver_data<pmd85_state>();
186   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
186   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
187187   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
188188
189189   if (state->m_startup_mem_map)
r18027r18028
209209static void c2717_update_memory(running_machine &machine)
210210{
211211   pmd85_state *state = machine.driver_data<pmd85_state>();
212   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
212   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
213213   UINT8 *mem = state->memregion("maincpu")->base();
214214   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
215215
r18027r18028
960960
961961   machine().scheduler().timer_set(attotime::zero, FUNC(setup_machine_state));
962962
963   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(pmd85_state::pmd85_opbaseoverride), this));
963   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(pmd85_state::pmd85_opbaseoverride), this));
964964}
trunk/src/mess/machine/upd71071.c
r18027r18028
123123   // single byte or word transfer
124124   device_t* device = (device_t*)ptr;
125125   upd71071_t* dmac = get_safe_token(device);
126   address_space& space = *device->machine().device(dmac->intf->cputag)->memory().space(AS_PROGRAM);
126   address_space& space = device->machine().device(dmac->intf->cputag)->memory().space(AS_PROGRAM);
127127   int channel = param;
128128   UINT16 data = 0;  // data to transfer
129129
trunk/src/mess/machine/at.c
r18027r18028
316316static void init_at_common(running_machine &machine)
317317{
318318   at_state *state = machine.driver_data<at_state>();
319   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
319   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
320320
321321   // The CS4031 chipset does this itself
322322   if (machine.device("cs4031") == NULL)
trunk/src/mess/machine/electron.c
r18027r18028
337337   state->m_ula.screen_size = 0x8000 - 0x3000;
338338   state->m_ula.screen_addr = 0;
339339   state->m_ula.tape_running = 0;
340   state->m_ula.vram = (UINT8 *)machine.device("maincpu")->memory().space(AS_PROGRAM)->get_read_ptr(state->m_ula.screen_base);
340   state->m_ula.vram = (UINT8 *)machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(state->m_ula.screen_base);
341341}
342342
343343void electron_state::machine_start()
trunk/src/mess/machine/orion.c
r18027r18028
268268   orion_state *state = machine.driver_data<orion_state>();
269269   UINT8 bank_select;
270270   UINT8 segment_select;
271   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
271   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
272272
273273   bank_select = (state->m_orionz80_dispatcher & 0x0c) >> 2;
274274   segment_select = state->m_orionz80_dispatcher & 0x03;
r18027r18028
328328
329329MACHINE_RESET_MEMBER(orion_state,orionz80)
330330{
331   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
331   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
332332
333333   space.unmap_write(0x0000, 0x3fff);
334334   space.install_write_bank(0x4000, 0xefff, "bank2");
r18027r18028
412412static void orionpro_bank_switch(running_machine &machine)
413413{
414414   orion_state *state = machine.driver_data<orion_state>();
415   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
415   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
416416   int page = state->m_orionpro_page & 7; // we have only 8 pages
417417   int is128 = (state->m_orionpro_dispatcher & 0x80) ? 1 : 0;
418418   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
trunk/src/mess/machine/cpc_ssa1.c
r18027r18028
187187void cpc_ssa1_device::device_start()
188188{
189189   device_t* cpu = machine().device("maincpu");
190   address_space& space = *cpu->memory().space(AS_IO);
190   address_space& space = cpu->memory().space(AS_IO);
191191   m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
192192
193193   m_rom = memregion("sp0256")->base();
r18027r18028
201201void cpc_dkspeech_device::device_start()
202202{
203203   device_t* cpu = machine().device("maincpu");
204   address_space& space = *cpu->memory().space(AS_IO);
204   address_space& space = cpu->memory().space(AS_IO);
205205   m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
206206
207207   m_rom = memregion("sp0256")->base();
trunk/src/mess/machine/a7800.c
r18027r18028
7272static void a7800_driver_init(running_machine &machine, int ispal, int lines)
7373{
7474   a7800_state *state = machine.driver_data<a7800_state>();
75   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
75   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
7676   state->m_ROM = state->memregion("maincpu")->base();
7777   state->m_ispal = ispal;
7878   state->m_lines = lines;
r18027r18028
107107void a7800_state::machine_reset()
108108{
109109   UINT8 *memory;
110   address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
110   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
111111
112112   m_ctrl_lock = 0;
113113   m_ctrl_reg = 0;
trunk/src/mess/machine/nascom1.c
r18027r18028
222222      if (sscanf((char *)line, "%x %x %x %x %x %x %x %x %x %x\010\010\n",
223223         &addr, &b0, &b1, &b2, &b3, &b4, &b5, &b6, &b7, &dummy) == 10)
224224      {
225         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b0);
226         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b1);
227         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b2);
228         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b3);
229         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b4);
230         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b5);
231         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b6);
232         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr++, b7);
225         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b0);
226         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b1);
227         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b2);
228         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b3);
229         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b4);
230         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b5);
231         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b6);
232         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr++, b7);
233233      }
234234   }
235235
r18027r18028
265265   switch (machine().device<ram_device>(RAM_TAG)->size())
266266   {
267267   case 1 * 1024:
268      machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(
268      machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(
269269         0x1400, 0x9000);
270270      break;
271271
272272   case 16 * 1024:
273      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(
273      machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(
274274         0x1400, 0x4fff, "bank1");
275      machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(
275      machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(
276276         0x5000, 0xafff);
277277      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
278278      break;
279279
280280   case 32 * 1024:
281      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(
281      machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(
282282         0x1400, 0x8fff, "bank1");
283      machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(
283      machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(
284284         0x9000, 0xafff);
285285      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
286286      break;
287287
288288   case 40 * 1024:
289      machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(
289      machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(
290290         0x1400, 0xafff, "bank1");
291291      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
292292      break;
trunk/src/mess/machine/microtan.c
r18027r18028
514514{
515515    UINT8 *dst = memregion("gfx2")->base();
516516    int i;
517    address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
517    address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
518518
519519    for (i = 0; i < 256; i++)
520520    {
trunk/src/mess/machine/cs4031.c
r18027r18028
126126      throw device_missing_dependencies();
127127
128128   device_t *cpu = machine().device(m_cputag);
129   m_space = cpu->memory().space(AS_PROGRAM);
129   m_space = &cpu->memory().space(AS_PROGRAM);
130130   m_isa = machine().root_device().memregion(m_isatag)->base();
131131   m_bios = machine().root_device().memregion(m_biostag)->base();
132132
trunk/src/mess/machine/poly88.c
r18027r18028
257257
258258SNAPSHOT_LOAD( poly88 )
259259{
260   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
260   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
261261   UINT8* data= auto_alloc_array(image.device().machine(), UINT8, snapshot_size);
262262   UINT16 recordNum;
263263   UINT16 recordLen;
trunk/src/mess/machine/samcoupe.c
r18027r18028
139139
140140WRITE8_MEMBER(samcoupe_state::samcoupe_ext_mem_w)
141141{
142   address_space &space_program = *machine().device("maincpu")->memory().space(AS_PROGRAM);
142   address_space &space_program = machine().device("maincpu")->memory().space(AS_PROGRAM);
143143
144144   if (offset & 1)
145145      m_hext = data;
r18027r18028
160160
161161static READ8_DEVICE_HANDLER( samcoupe_rtc_r )
162162{
163   address_space &spaceio = *device->machine().device("maincpu")->memory().space(AS_IO);
163   address_space &spaceio = device->machine().device("maincpu")->memory().space(AS_IO);
164164   msm6242_device *rtc = dynamic_cast<msm6242_device*>(device);
165165   return rtc->read(spaceio,offset >> 12);
166166}
r18027r18028
168168
169169static WRITE8_DEVICE_HANDLER( samcoupe_rtc_w )
170170{
171   address_space &spaceio = *device->machine().device("maincpu")->memory().space(AS_IO);
171   address_space &spaceio = device->machine().device("maincpu")->memory().space(AS_IO);
172172   msm6242_device *rtc = dynamic_cast<msm6242_device*>(device);
173173   rtc->write(spaceio,offset >> 12, data);
174174}
r18027r18028
244244
245245void samcoupe_state::machine_reset()
246246{
247   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
248   address_space &spaceio = *machine().device("maincpu")->memory().space(AS_IO);
247   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
248   address_space &spaceio = machine().device("maincpu")->memory().space(AS_IO);
249249
250250   /* initialize state */
251251   m_lmpr = 0x0f;      /* ROM0 paged in, ROM1 paged out RAM Banks */
trunk/src/mess/machine/trs80.c
r18027r18028
216216    d0 Select bit 0 */
217217
218218   /* get address space instead of io space */
219   address_space *mem = m_maincpu->space(AS_PROGRAM);
219   address_space &mem = m_maincpu->space(AS_PROGRAM);
220220   UINT8 *base = memregion("maincpu")->base();
221221
222222   m_mode = (m_mode & 0x73) | (data & 0x8c);
r18027r18028
255255         membank("bank17")->set_base(base + 0x14000);
256256         membank("bank18")->set_base(base + 0x1f400);
257257         membank("bank19")->set_base(base + 0x1f800);
258         mem->install_readwrite_handler (0x37e8, 0x37e9, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this));   /* 3 & 13 */
259         mem->install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 5 */
260         mem->install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 6 & 16 */
258         mem.install_readwrite_handler (0x37e8, 0x37e9, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this));   /* 3 & 13 */
259         mem.install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 5 */
260         mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 6 & 16 */
261261         break;
262262
263263      case 1:   /* write-only ram backs up the rom */
r18027r18028
292292         membank("bank17")->set_base(base + 0x14000);
293293         membank("bank18")->set_base(base + 0x1f400);
294294         membank("bank19")->set_base(base + 0x1f800);
295         mem->install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 5 */
296         mem->install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 6 & 16 */
295         mem.install_read_handler (0x3800, 0x3bff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 5 */
296         mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 6 & 16 */
297297         break;
298298
299299      case 2:   /* keyboard and video are moved to high memory, and the rest is ram */
r18027r18028
312312         membank("bank16")->set_base(base + 0x13c00);
313313         membank("bank17")->set_base(base + 0x14000);
314314         membank("bank18")->set_base(base + 0x0a000);
315         mem->install_read_handler (0xf400, 0xf7ff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 8 */
316         mem->install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 9 & 19 */
315         mem.install_read_handler (0xf400, 0xf7ff, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));   /* 8 */
316         mem.install_readwrite_handler (0xf800, 0xffff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));   /* 9 & 19 */
317317         m_model4++;
318318         break;
319319
r18027r18028
561561    d0 inverse video (entire screen) */
562562
563563   /* get address space instead of io space */
564   address_space *mem = m_maincpu->space(AS_PROGRAM);
564   address_space &mem = m_maincpu->space(AS_PROGRAM);
565565
566566   m_mode = (m_mode & 0x87) | ((data & 0x0f) << 3);
567567
568568   if (data & 8)
569569   {
570      mem->unmap_readwrite (0x0000, 0x3fff);
571      mem->install_readwrite_handler (0x0000, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_gfxram_r), this), write8_delegate(FUNC(trs80_state::trs80_gfxram_w), this));
570      mem.unmap_readwrite (0x0000, 0x3fff);
571      mem.install_readwrite_handler (0x0000, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_gfxram_r), this), write8_delegate(FUNC(trs80_state::trs80_gfxram_w), this));
572572   }
573573   else
574574   {
575      mem->unmap_readwrite (0x0000, 0x3fff);
576      mem->install_read_bank (0x0000, 0x2fff, "bank1");
575      mem.unmap_readwrite (0x0000, 0x3fff);
576      mem.install_read_bank (0x0000, 0x2fff, "bank1");
577577      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
578      mem->install_readwrite_handler (0x37e0, 0x37e3, read8_delegate(FUNC(trs80_state::trs80_irq_status_r), this), write8_delegate(FUNC(trs80_state::trs80_motor_w), this));
579      mem->install_readwrite_handler (0x37e8, 0x37eb, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this));
580      mem->install_read_handler (0x37ec, 0x37ec, read8_delegate(FUNC(trs80_state::trs80_wd179x_r), this));
581      mem->install_legacy_write_handler (*m_fdc, 0x37ec, 0x37ec, FUNC(wd17xx_command_w));
582      mem->install_legacy_readwrite_handler (*m_fdc, 0x37ed, 0x37ed, FUNC(wd17xx_track_r), FUNC(wd17xx_track_w));
583      mem->install_legacy_readwrite_handler (*m_fdc, 0x37ee, 0x37ee, FUNC(wd17xx_sector_r), FUNC(wd17xx_sector_w));
584      mem->install_legacy_readwrite_handler (*m_fdc, 0x37ef, 0x37ef, FUNC(wd17xx_data_r), FUNC(wd17xx_data_w));
585      mem->install_read_handler (0x3800, 0x38ff, 0, 0x0300, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));
586      mem->install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));
578      mem.install_readwrite_handler (0x37e0, 0x37e3, read8_delegate(FUNC(trs80_state::trs80_irq_status_r), this), write8_delegate(FUNC(trs80_state::trs80_motor_w), this));
579      mem.install_readwrite_handler (0x37e8, 0x37eb, read8_delegate(FUNC(trs80_state::trs80_printer_r), this), write8_delegate(FUNC(trs80_state::trs80_printer_w), this));
580      mem.install_read_handler (0x37ec, 0x37ec, read8_delegate(FUNC(trs80_state::trs80_wd179x_r), this));
581      mem.install_legacy_write_handler (*m_fdc, 0x37ec, 0x37ec, FUNC(wd17xx_command_w));
582      mem.install_legacy_readwrite_handler (*m_fdc, 0x37ed, 0x37ed, FUNC(wd17xx_track_r), FUNC(wd17xx_track_w));
583      mem.install_legacy_readwrite_handler (*m_fdc, 0x37ee, 0x37ee, FUNC(wd17xx_sector_r), FUNC(wd17xx_sector_w));
584      mem.install_legacy_readwrite_handler (*m_fdc, 0x37ef, 0x37ef, FUNC(wd17xx_data_r), FUNC(wd17xx_data_w));
585      mem.install_read_handler (0x3800, 0x38ff, 0, 0x0300, read8_delegate(FUNC(trs80_state::trs80_keyboard_r), this));
586      mem.install_readwrite_handler (0x3c00, 0x3fff, read8_delegate(FUNC(trs80_state::trs80_videoram_r), this), write8_delegate(FUNC(trs80_state::trs80_videoram_w), this));
587587   }
588588}
589589
r18027r18028
863863
864864MACHINE_RESET_MEMBER(trs80_state,trs80m4)
865865{
866   address_space *mem = m_maincpu->space(AS_PROGRAM);
866   address_space &mem = m_maincpu->space(AS_PROGRAM);
867867   m_cassette_data = 0;
868868
869   mem->install_read_bank (0x0000, 0x0fff, "bank1");
870   mem->install_read_bank (0x1000, 0x37e7, "bank2");
871   mem->install_read_bank (0x37e8, 0x37e9, "bank3");
872   mem->install_read_bank (0x37ea, 0x37ff, "bank4");
873   mem->install_read_bank (0x3800, 0x3bff, "bank5");
874   mem->install_read_bank (0x3c00, 0x3fff, "bank6");
875   mem->install_read_bank (0x4000, 0xf3ff, "bank7");
876   mem->install_read_bank (0xf400, 0xf7ff, "bank8");
877   mem->install_read_bank (0xf800, 0xffff, "bank9");
869   mem.install_read_bank (0x0000, 0x0fff, "bank1");
870   mem.install_read_bank (0x1000, 0x37e7, "bank2");
871   mem.install_read_bank (0x37e8, 0x37e9, "bank3");
872   mem.install_read_bank (0x37ea, 0x37ff, "bank4");
873   mem.install_read_bank (0x3800, 0x3bff, "bank5");
874   mem.install_read_bank (0x3c00, 0x3fff, "bank6");
875   mem.install_read_bank (0x4000, 0xf3ff, "bank7");
876   mem.install_read_bank (0xf400, 0xf7ff, "bank8");
877   mem.install_read_bank (0xf800, 0xffff, "bank9");
878878
879   mem->install_write_bank (0x0000, 0x0fff, "bank11");
880   mem->install_write_bank (0x1000, 0x37e7, "bank12");
881   mem->install_write_bank (0x37e8, 0x37e9, "bank13");
882   mem->install_write_bank (0x37ea, 0x37ff, "bank14");
883   mem->install_write_bank (0x3800, 0x3bff, "bank15");
884   mem->install_write_bank (0x3c00, 0x3fff, "bank16");
885   mem->install_write_bank (0x4000, 0xf3ff, "bank17");
886   mem->install_write_bank (0xf400, 0xf7ff, "bank18");
887   mem->install_write_bank (0xf800, 0xffff, "bank19");
888   trs80m4p_9c_w(*mem, 0, 1);   /* Enable the ROM */
889   trs80m4_84_w(*mem, 0, 0);   /* switch in devices at power-on */
879   mem.install_write_bank (0x0000, 0x0fff, "bank11");
880   mem.install_write_bank (0x1000, 0x37e7, "bank12");
881   mem.install_write_bank (0x37e8, 0x37e9, "bank13");
882   mem.install_write_bank (0x37ea, 0x37ff, "bank14");
883   mem.install_write_bank (0x3800, 0x3bff, "bank15");
884   mem.install_write_bank (0x3c00, 0x3fff, "bank16");
885   mem.install_write_bank (0x4000, 0xf3ff, "bank17");
886   mem.install_write_bank (0xf400, 0xf7ff, "bank18");
887   mem.install_write_bank (0xf800, 0xffff, "bank19");
888   trs80m4p_9c_w(mem, 0, 1);   /* Enable the ROM */
889   trs80m4_84_w(mem, 0, 0);   /* switch in devices at power-on */
890890}
891891
892892MACHINE_RESET_MEMBER(trs80_state,lnw80)
893893{
894   address_space &space = *m_maincpu->space(AS_PROGRAM);
894   address_space &space = m_maincpu->space(AS_PROGRAM);
895895   m_cassette_data = 0;
896896   m_reg_load = 1;
897897   lnw80_fe_w(space, 0, 0);
trunk/src/mess/machine/x68k_neptunex.c
r18027r18028
4747   device_t* cpu = machine().device("maincpu");
4848   char mac[7];
4949   UINT32 num = rand();
50   address_space& space = *cpu->memory().space(AS_PROGRAM);
50   address_space& space = cpu->memory().space(AS_PROGRAM);
5151   m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
5252   memset(m_prom, 0x57, 16);
5353   sprintf(mac+2, "\x1b%c%c%c", (num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff);
trunk/src/mess/machine/primo.c
r18027r18028
4646static void primo_update_memory(running_machine &machine)
4747{
4848   primo_state *state = machine.driver_data<primo_state>();
49   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
49   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
5050   switch (state->m_port_FD & 0x03)
5151   {
5252      case 0x00:   /* Original ROM */
r18027r18028
300300   /* memory */
301301
302302   for (i=0; i<0xc000; i++)
303      machine.device("maincpu")->memory().space(AS_PROGRAM)->write_byte( i+0x4000, snapshot_data[i+38]);
303      machine.device("maincpu")->memory().space(AS_PROGRAM).write_byte( i+0x4000, snapshot_data[i+38]);
304304}
305305
306306SNAPSHOT_LOAD( primo )
r18027r18028
346346   start_addr = quickload_data[2] + quickload_data[3]*256;
347347
348348   for (i=4; i<quickload_size; i++)
349      machine.device("maincpu")->memory().space(AS_PROGRAM)->write_byte(start_addr+i-4, quickload_data[i]);
349      machine.device("maincpu")->memory().space(AS_PROGRAM).write_byte(start_addr+i-4, quickload_data[i]);
350350
351351   machine.device("maincpu")->state().set_state_int(Z80_PC, start_addr);
352352
trunk/src/mess/machine/mface2.c
r18027r18028
7070        m_slot->romen_w(0);
7171
7272       /* clear op base override */
73       machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(cpc_multiface2_device::amstrad_default),this));
73       machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(cpc_multiface2_device::amstrad_default),this));
7474      }
7575
7676      return pc;
r18027r18028
163163      m_slot->nmi_w(0);
164164
165165      /* initialise 0065 override to monitor calls to 0065 */
166      machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(cpc_multiface2_device::amstrad_multiface_directoverride),this));
166      machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(cpc_multiface2_device::amstrad_multiface_directoverride),this));
167167   }
168168}
169169
trunk/src/mess/machine/wswan.c
r18027r18028
223223
224224void wswan_state::machine_reset()
225225{
226   address_space &space = *machine().device( "maincpu")->memory().space( AS_PROGRAM );
226   address_space &space = machine().device( "maincpu")->memory().space( AS_PROGRAM );
227227
228228   /* Intialize ports */
229229   memcpy( m_ws_portram, ws_portram_init, 256 );
r18027r18028
354354
355355WRITE8_MEMBER( wswan_state::wswan_port_w )
356356{
357   address_space *mem = m_maincpu->space(AS_PROGRAM);
357   address_space &mem = m_maincpu->space(AS_PROGRAM);
358358   wswan_state *state = machine().driver_data<wswan_state>();
359359   UINT8 input;
360   logerror( "PC=%X: port write %02X <- %02X\n", mem->device().safe_pc(), offset, data );
360   logerror( "PC=%X: port write %02X <- %02X\n", mem.device().safe_pc(), offset, data );
361361   switch( offset )
362362   {
363363      case 0x00:   /* Display control
r18027r18028
676676            length = m_ws_portram[0x46] + (m_ws_portram[0x47] << 8);
677677            for( ; length > 0; length-- )
678678            {
679               mem->write_byte(dst, mem->read_byte(src ) );
679               mem.write_byte(dst, mem.read_byte(src ) );
680680               src++;
681681               dst++;
682682            }
r18027r18028
12511251            m_ws_portram[0xcb] = m_rtc.year;
12521252            break;
12531253         default:
1254            logerror( "%X: Unknown RTC command (%X) requested\n", mem->device().safe_pc(), data );
1254            logerror( "%X: Unknown RTC command (%X) requested\n", mem.device().safe_pc(), data );
12551255         }
12561256         break;
12571257      case 0xcb:   /* RTC Data */
r18027r18028
13501350   else
13511351      size = image.get_software_region_length("rom");
13521352
1353   state->m_ws_ram = (UINT8*) image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->get_read_ptr(0);
1353   state->m_ws_ram = (UINT8*) image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(0);
13541354   memset(state->m_ws_ram, 0, 0xffff);
13551355   state->m_ROMBanks = size / 65536;
13561356
r18027r18028
14591459   /* Handle Sound DMA */
14601460   if ( ( state->m_sound_dma.enable & 0x88 ) == 0x80 )
14611461   {
1462      address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM );
1462      address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM );
14631463      /* TODO: Output sound DMA byte */
14641464      state->wswan_port_w( space, 0x89, space.read_byte(state->m_sound_dma.source ) );
14651465      state->m_sound_dma.size--;
trunk/src/mess/machine/z80ne.c
r18027r18028
172172
173173   if (!m_nmi_delay_counter)
174174   {
175      machine().device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this));
175      machine().device("z80ne")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this));
176176      machine().device("z80ne")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
177177   }
178178   return address;
r18027r18028
184184 */
185185DIRECT_UPDATE_MEMBER(z80ne_state::z80ne_reset_delay_count)
186186{
187   address_space &space = *machine().device("z80ne")->memory().space(AS_PROGRAM);
187   address_space &space = machine().device("z80ne")->memory().space(AS_PROGRAM);
188188   /*
189189     * TODO: when debugger is active, his memory access causes this callback
190190     *
r18027r18028
195195   if (!m_reset_delay_counter)
196196   {
197197      /* remove this callback */
198      machine().device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this));
198      machine().device("z80ne")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), this));
199199      /* and switch to RAM bank at address 0x0000 */
200200      membank( "bank1" )->set_entry( 0 ); /* RAM at 0x0000 (bank 1) */
201201   }
r18027r18028
213213static void reset_lx382_banking(running_machine &machine)
214214{
215215   z80ne_state *state = machine.driver_data<z80ne_state>();
216   address_space &space = *machine.device("z80ne")->memory().space(AS_PROGRAM);
216   address_space &space = machine.device("z80ne")->memory().space(AS_PROGRAM);
217217
218218   /* switch to ROM bank at address 0x0000 */
219219    state->membank("bank1")->set_entry(1);
r18027r18028
227227static void reset_lx390_banking(running_machine &machine)
228228{
229229   z80ne_state *state = machine.driver_data<z80ne_state>();
230   address_space &space = *machine.device("z80ne")->memory().space(AS_PROGRAM);
230   address_space &space = machine.device("z80ne")->memory().space(AS_PROGRAM);
231231   state->m_reset_delay_counter = 0;
232232
233233   switch (machine.root_device().ioport("CONFIG")->read() & 0x07) {
r18027r18028
249249       state->membank("bank2")->set_entry(1);  /* ep548 at 0x0400-0x3FFF */
250250       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
251251       state->membank("bank4")->set_entry(0);  /* RAM   at 0xF000 */
252      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
252      machine.device("z80ne")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
253253       break;
254254   case 0x03: /* EP390  Boot Loader for 5.5k floppy BASIC */
255255      if (VERBOSE)
r18027r18028
258258       state->membank("bank2")->set_entry(0);  /* RAM   at 0x0400-0x3FFF */
259259       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
260260       state->membank("bank4")->set_entry(1);  /* ep390 at 0xF000 */
261      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
261      machine.device("z80ne")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
262262       break;
263263   case 0x04: /* EP1390 Boot Loader for NE DOS 1.0/1.5 */
264264      if (VERBOSE)
r18027r18028
267267       state->membank("bank2")->set_entry(0);  /* RAM   at 0x0400-0x3FFF */
268268       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
269269       state->membank("bank4")->set_entry(2);  /* ep1390 at 0xF000 */
270      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
270      machine.device("z80ne")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
271271       break;
272272   case 0x05: /* EP2390 Boot Loader for NE DOS G.1 */
273273      if (VERBOSE)
r18027r18028
276276       state->membank("bank2")->set_entry(0);  /* RAM   at 0x0400-0x3FFF */
277277       state->membank("bank3")->set_entry(0);  /* RAM   at 0x8000 */
278278       state->membank("bank4")->set_entry(3);  /* ep2390 at 0xF000 */
279      machine.device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
279      machine.device("z80ne")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_default), state));
280280       break;
281281   }
282282
r18027r18028
288288MACHINE_RESET_MEMBER(z80ne_state,z80ne_base)
289289{
290290   int i;
291   address_space &space = *machine().device("z80ne")->memory().space(AS_PROGRAM);
291   address_space &space = machine().device("z80ne")->memory().space(AS_PROGRAM);
292292
293293   LOG(("In MACHINE_RESET z80ne_base\n"));
294294
r18027r18028
480480    else
481481       /* after writing to port 0xF8 and the first ~M1 cycles strike a NMI for single step execution */
482482       m_nmi_delay_counter = 1;
483      machine().device("z80ne")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_nmi_delay_count), this));
483      machine().device("z80ne")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(z80ne_state::z80ne_nmi_delay_count), this));
484484}
485485
486486
trunk/src/mess/machine/apple2gs.c
r18027r18028
15541554   }
15551555   else if ((address & 0x000F00) == 0x000000)   // accessing C0xx?
15561556   {
1557      result = state->apple2gs_c0xx_r(*machine.device("maincpu")->memory().space(AS_PROGRAM), address, 0);
1557      result = state->apple2gs_c0xx_r(machine.device("maincpu")->memory().space(AS_PROGRAM), address, 0);
15581558   }
15591559   else
15601560   {
r18027r18028
16461646   }
16471647   else if ((address & 0x000F00) == 0x000000)
16481648   {
1649      state->apple2gs_c0xx_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), address, data, 0);
1649      state->apple2gs_c0xx_w(machine.device("maincpu")->memory().space(AS_PROGRAM), address, data, 0);
16501650   }
16511651   else
16521652   {
r18027r18028
17961796static void apple2gs_setup_memory(running_machine &machine)
17971797{
17981798   apple2gs_state *state = machine.driver_data<apple2gs_state>();
1799   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1799   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
18001800   offs_t begin, end;
18011801   apple2_memmap_config cfg;
18021802
trunk/src/mess/machine/mpc105.c
r18027r18028
9494
9595   if (m_bank_base > 0)
9696   {
97      address_space &space = *m_maincpu->space(AS_PROGRAM);
97      address_space &space = m_maincpu->space(AS_PROGRAM);
9898
9999      /* first clear everything out */
100100      space.nop_read(0x00000000, 0x3FFFFFFF);
trunk/src/mess/machine/iq151_staper.c
r18027r18028
9393
9494void iq151_staper_device::io_read(offs_t offset, UINT8 &data)
9595{
96   address_space& space = *machine().device("maincpu")->memory().space(AS_IO);
96   address_space& space = machine().device("maincpu")->memory().space(AS_IO);
9797
9898   if (offset >= 0xf8 && offset < 0xfc)
9999      data = m_ppi->read(space, offset & 0x03);
r18027r18028
105105
106106void iq151_staper_device::io_write(offs_t offset, UINT8 data)
107107{
108   address_space& space = *machine().device("maincpu")->memory().space(AS_IO);
108   address_space& space = machine().device("maincpu")->memory().space(AS_IO);
109109
110110   if (offset >= 0xf8 && offset < 0xfc)
111111      m_ppi->write(space, offset & 0x03, data);
trunk/src/mess/machine/990_tap.c
r18027r18028
306306      /* DMA */
307307      for (i=0; i<bytes_read; i+=2)
308308      {
309         device->machine().device("maincpu")->memory().space(AS_PROGRAM)->write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
309         device->machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
310310         dma_address = (dma_address + 2) & 0x1ffffe;
311311      }
312312
trunk/src/mess/machine/nes.c
r18027r18028
3636static void init_nes_core( running_machine &machine )
3737{
3838   nes_state *state = machine.driver_data<nes_state>();
39   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
39   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
4040   static const char *const bank_names[] = { "bank1", "bank2", "bank3", "bank4" };
4141   int prg_banks = (state->m_prg_chunks == 1) ? (2 * 2) : (state->m_prg_chunks * 2);
4242   int i;
r18027r18028
4848   /* Brutal hack put in as a consequence of the new memory system; we really need to fix the NES code */
4949   space.install_readwrite_bank(0x0000, 0x07ff, 0, 0x1800, "bank10");
5050
51   machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0, 0x1fff, FUNC(nes_chr_r), FUNC(nes_chr_w));
52   machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x2000, 0x3eff, FUNC(nes_nt_r), FUNC(nes_nt_w));
51   machine.device("ppu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0, 0x1fff, FUNC(nes_chr_r), FUNC(nes_chr_w));
52   machine.device("ppu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x2000, 0x3eff, FUNC(nes_nt_r), FUNC(nes_nt_w));
5353
5454   state->membank("bank10")->set_base(state->m_rom);
5555
r18027r18028
193193   }
194194
195195   if (state->m_pcb_id == WAIXING_SH2)
196      machine.device("ppu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0, 0x1fff, FUNC(waixing_sh2_chr_r));
196      machine.device("ppu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0, 0x1fff, FUNC(waixing_sh2_chr_r));
197197}
198198
199199// to be probably removed (it does nothing since a long time)
trunk/src/mess/machine/apollo.c
r18027r18028
826826 ***************************************************************************/
827827
828828static DEVICE_RESET( apollo_rtc ) {
829   address_space &space = *device->machine().device(MAINCPU)->memory().space(AS_PROGRAM);
829   address_space &space = device->machine().device(MAINCPU)->memory().space(AS_PROGRAM);
830830   apollo_state *state = device->machine().driver_data<apollo_state>();
831831   UINT8 year = state->apollo_rtc_r(space, 9);
832832
r18027r18028
872872static TIMER_CALLBACK( apollo_rtc_timer )
873873{
874874   apollo_state *state = machine.driver_data<apollo_state>();
875   address_space &space = *machine.device(MAINCPU)->memory().space(AS_PROGRAM);
875   address_space &space = machine.device(MAINCPU)->memory().space(AS_PROGRAM);
876876
877877   // FIXME: reading register 0x0c will clear all interrupt flags
878878   if ((state->apollo_rtc_r(space, 0x0c) & 0x80))
trunk/src/mess/machine/sym1.c
r18027r18028
197197 */
198198static WRITE8_DEVICE_HANDLER( sym1_via2_a_w )
199199{
200   address_space *cpu0space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM );
200   address_space &cpu0space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM );
201201
202202   logerror("SYM1 VIA2 W 0x%02x\n", data);
203203
204204   if ((device->machine().root_device().ioport("WP")->read() & 0x01) && !(data & 0x01)) {
205      cpu0space->nop_write(0xa600, 0xa67f);
205      cpu0space.nop_write(0xa600, 0xa67f);
206206   } else {
207      cpu0space->install_write_bank(0xa600, 0xa67f, "bank5");
207      cpu0space.install_write_bank(0xa600, 0xa67f, "bank5");
208208   }
209209   if ((device->machine().root_device().ioport("WP")->read() & 0x02) && !(data & 0x02)) {
210      cpu0space->nop_write(0x0400, 0x07ff);
210      cpu0space.nop_write(0x0400, 0x07ff);
211211   } else {
212      cpu0space->install_write_bank(0x0400, 0x07ff, "bank2");
212      cpu0space.install_write_bank(0x0400, 0x07ff, "bank2");
213213   }
214214   if ((device->machine().root_device().ioport("WP")->read() & 0x04) && !(data & 0x04)) {
215      cpu0space->nop_write(0x0800, 0x0bff);
215      cpu0space.nop_write(0x0800, 0x0bff);
216216   } else {
217      cpu0space->install_write_bank(0x0800, 0x0bff, "bank3");
217      cpu0space.install_write_bank(0x0800, 0x0bff, "bank3");
218218   }
219219   if ((device->machine().root_device().ioport("WP")->read() & 0x08) && !(data & 0x08)) {
220      cpu0space->nop_write(0x0c00, 0x0fff);
220      cpu0space.nop_write(0x0c00, 0x0fff);
221221   } else {
222      cpu0space->install_write_bank(0x0c00, 0x0fff, "bank4");
222      cpu0space.install_write_bank(0x0c00, 0x0fff, "bank4");
223223   }
224224}
225225
r18027r18028
289289   /* wipe expansion memory banks that are not installed */
290290   if (machine().device<ram_device>(RAM_TAG)->size() < 4*1024)
291291   {
292      machine().device( "maincpu")->memory().space( AS_PROGRAM )->nop_readwrite(
292      machine().device( "maincpu")->memory().space( AS_PROGRAM ).nop_readwrite(
293293         machine().device<ram_device>(RAM_TAG)->size(), 0x0fff);
294294   }
295295
r18027r18028
302302{
303303   /* make 0xf800 to 0xffff point to the last half of the monitor ROM
304304       so that the CPU can find its reset vectors */
305   machine().device( "maincpu")->memory().space( AS_PROGRAM )->install_read_bank(0xf800, 0xffff, "bank1");
306   machine().device( "maincpu")->memory().space( AS_PROGRAM )->nop_write(0xf800, 0xffff);
305   machine().device( "maincpu")->memory().space( AS_PROGRAM ).install_read_bank(0xf800, 0xffff, "bank1");
306   machine().device( "maincpu")->memory().space( AS_PROGRAM ).nop_write(0xf800, 0xffff);
307307   membank("bank1")->set_base(m_monitor + 0x800);
308308   machine().device("maincpu")->reset();
309309}
trunk/src/mess/machine/ondra.c
r18027r18028
4242   ondra_state *state = machine.driver_data<ondra_state>();
4343   UINT8 *mem = state->memregion("maincpu")->base();
4444   if (state->m_bank1_status==0) {
45      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x0000, 0x3fff);
45      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x3fff);
4646      state->membank("bank1")->set_base(mem + 0x010000);
4747   } else {
48      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x3fff, "bank1");
48      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0000, 0x3fff, "bank1");
4949      state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x0000);
5050   }
5151   state->membank("bank2")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x4000);
5252   if (state->m_bank2_status==0) {
53      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xe000, 0xffff, "bank3");
53      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xe000, 0xffff, "bank3");
5454      state->membank("bank3")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xe000);
5555   } else {
56      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xe000, 0xffff);
57      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler (0xe000, 0xffff, read8_delegate(FUNC(ondra_state::ondra_keyboard_r),state));
56      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xe000, 0xffff);
57      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0xe000, 0xffff, read8_delegate(FUNC(ondra_state::ondra_keyboard_r),state));
5858   }
5959}
6060
trunk/src/mess/machine/kaypro.c
r18027r18028
4242    d0 drive A */
4343
4444   /* get address space */
45   address_space *mem = m_maincpu->space(AS_PROGRAM);
45   address_space &mem = m_maincpu->space(AS_PROGRAM);
4646
4747   if (data & 0x80)
4848   {
49      mem->unmap_readwrite (0x0000, 0x3fff);
50      mem->install_read_bank (0x0000, 0x0fff, "bank1");
49      mem.unmap_readwrite (0x0000, 0x3fff);
50      mem.install_read_bank (0x0000, 0x0fff, "bank1");
5151      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
52      mem->install_readwrite_handler (0x3000, 0x3fff, read8_delegate(FUNC(kaypro_state::kaypro_videoram_r), this), write8_delegate(FUNC(kaypro_state::kaypro_videoram_w), this));
52      mem.install_readwrite_handler (0x3000, 0x3fff, read8_delegate(FUNC(kaypro_state::kaypro_videoram_r), this), write8_delegate(FUNC(kaypro_state::kaypro_videoram_w), this));
5353   }
5454   else
5555   {
56      mem->unmap_readwrite(0x0000, 0x3fff);
57      mem->install_read_bank (0x0000, 0x3fff, "bank2");
58      mem->install_write_bank (0x0000, 0x3fff, "bank3");
56      mem.unmap_readwrite(0x0000, 0x3fff);
57      mem.install_read_bank (0x0000, 0x3fff, "bank2");
58      mem.install_write_bank (0x0000, 0x3fff, "bank3");
5959      membank("bank2")->set_base(machine().root_device().memregion("rambank")->base());
6060      membank("bank3")->set_base(machine().root_device().memregion("rambank")->base());
6161   }
r18027r18028
155155    d0 drive A */
156156
157157   /* get address space */
158   address_space *mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
158   address_space &mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
159159
160160   if (BIT(data, 7))
161161   {
162      mem->unmap_readwrite (0x0000, 0x3fff);
163      mem->install_read_bank (0x0000, 0x1fff, "bank1");
164      membank("bank1")->set_base(mem->machine().root_device().memregion("maincpu")->base());
162      mem.unmap_readwrite (0x0000, 0x3fff);
163      mem.install_read_bank (0x0000, 0x1fff, "bank1");
164      membank("bank1")->set_base(mem.machine().root_device().memregion("maincpu")->base());
165165   }
166166   else
167167   {
168      mem->unmap_readwrite (0x0000, 0x3fff);
169      mem->install_read_bank (0x0000, 0x3fff, "bank2");
170      mem->install_write_bank (0x0000, 0x3fff, "bank3");
171      membank("bank2")->set_base(mem->machine().root_device().memregion("rambank")->base());
172      membank("bank3")->set_base(mem->machine().root_device().memregion("rambank")->base());
168      mem.unmap_readwrite (0x0000, 0x3fff);
169      mem.install_read_bank (0x0000, 0x3fff, "bank2");
170      mem.install_write_bank (0x0000, 0x3fff, "bank3");
171      membank("bank2")->set_base(mem.machine().root_device().memregion("rambank")->base());
172      membank("bank3")->set_base(mem.machine().root_device().memregion("rambank")->base());
173173   }
174174
175175   wd17xx_dden_w(m_fdc, BIT(data, 5));
r18027r18028
327327
328328MACHINE_RESET_MEMBER(kaypro_state,kaypro2x)
329329{
330   address_space &space = *m_maincpu->space(AS_PROGRAM);
330   address_space &space = m_maincpu->space(AS_PROGRAM);
331331   kaypro2x_system_port_w(space, 0, 0x80);
332332   MACHINE_RESET_CALL_MEMBER(kay_kbd);
333333}
r18027r18028
346346QUICKLOAD_LOAD( kayproii )
347347{
348348   kaypro_state *state = image.device().machine().driver_data<kaypro_state>();
349   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
349   address_space &space = state->m_maincpu->space(AS_PROGRAM);
350350   UINT8 *RAM = state->memregion("rambank")->base();
351351   UINT16 i;
352352   UINT8 data;
r18027r18028
369369QUICKLOAD_LOAD( kaypro2x )
370370{
371371   kaypro_state *state = image.device().machine().driver_data<kaypro_state>();
372   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
372   address_space &space = state->m_maincpu->space(AS_PROGRAM);
373373   UINT8 *RAM = state->memregion("rambank")->base();
374374   UINT16 i;
375375   UINT8 data;
trunk/src/mess/machine/pc_lpt.c
r18027r18028
137137{
138138   pc_lpt_state *lpt = get_safe_token(device);
139139   // pull up mechanism for input lines, zeros are provided by pheripherial
140   return lpt->data & ~lpt->centronics->read(*device->machine().memory().first_space(), 0);
140   return lpt->data & ~lpt->centronics->read(device->machine().driver_data()->generic_space(), 0);
141141}
142142
143143
r18027r18028
145145{
146146   pc_lpt_state *lpt = get_safe_token(device);
147147   lpt->data = data;
148   lpt->centronics->write(*device->machine().memory().first_space(), 0, data);
148   lpt->centronics->write(device->machine().driver_data()->generic_space(), 0, data);
149149}
150150
151151
trunk/src/mess/machine/s3c44b0.c
r18027r18028
20012001DEVICE_START( s3c44b0 )
20022002{
20032003   running_machine &machine = device->machine();
2004   address_space &space = *machine.device( "maincpu")->memory().space( AS_PROGRAM);
2004   address_space &space = machine.device( "maincpu")->memory().space( AS_PROGRAM);
20052005   s3c44b0_t *s3c44b0 = get_token( device);
20062006   s3c44b0->iface = (const s3c44b0_interface *)device->static_config();
20072007   s3c44b0->space = &space;
trunk/src/mess/machine/coco_multi.c
r18027r18028
153153
154154   // install $FF7F handler
155155   write8_delegate wh = write8_delegate(FUNC(coco_multipak_device::ff7f_write), this);
156   machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM)->install_write_handler(0xFF7F, 0xFF7F, wh);
156   machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM).install_write_handler(0xFF7F, 0xFF7F, wh);
157157
158158   // initial state
159159   m_select = 0xFF;
trunk/src/mess/machine/partner.c
r18027r18028
125125static void partner_iomap_bank(running_machine &machine,UINT8 *rom)
126126{
127127   partner_state *state = machine.driver_data<partner_state>();
128   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
128   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
129129   switch(state->m_win_mem_page) {
130130      case 2 :
131131            // FDD
r18027r18028
143143static void partner_bank_switch(running_machine &machine)
144144{
145145   partner_state *state = machine.driver_data<partner_state>();
146   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
146   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
147147   UINT8 *rom = state->memregion("maincpu")->base();
148148   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
149149
trunk/src/mess/machine/bebox.c
r18027r18028
201201   result = state->m_crossproc_interrupts;
202202
203203   /* return a different result depending on which CPU is accessing this handler */
204   if (&space != space.machine().device("ppc1")->memory().space(AS_PROGRAM))
204   if (&space != &space.machine().device("ppc1")->memory().space(AS_PROGRAM))
205205      result |= 0x02000000;
206206   else
207207      result &= ~0x02000000;
r18027r18028
955955               /* brutal ugly hack; at some point the PCI code should be handling this stuff */
956956               if (state->m_scsi53c810_data[5] != 0xFFFFFFF0)
957957               {
958                  address_space &space = *device->machine().device("ppc1")->memory().space(AS_PROGRAM);
958                  address_space &space = device->machine().device("ppc1")->memory().space(AS_PROGRAM);
959959
960960                  addr = (state->m_scsi53c810_data[5] | 0xC0000000) & ~0xFF;
961961                  space.install_legacy_read_handler(addr, addr + 0xFF, FUNC(scsi53c810_r));
r18027r18028
995995   machine().device("ppc1")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
996996   machine().device("ppc2")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
997997
998   memcpy(machine().device<fujitsu_29f016a_device>("flash")->space()->get_read_ptr(0),memregion("user1")->base(),0x200000);
998   memcpy(machine().device<fujitsu_29f016a_device>("flash")->space().get_read_ptr(0),memregion("user1")->base(),0x200000);
999999}
10001000
10011001void bebox_state::machine_start()
r18027r18028
10051005
10061006DRIVER_INIT_MEMBER(bebox_state,bebox)
10071007{
1008   address_space *space_0 = machine().device("ppc1")->memory().space(AS_PROGRAM);
1009   address_space *space_1 = machine().device("ppc2")->memory().space(AS_PROGRAM);
1008   address_space &space_0 = machine().device("ppc1")->memory().space(AS_PROGRAM);
1009   address_space &space_1 = machine().device("ppc2")->memory().space(AS_PROGRAM);
10101010   offs_t vram_begin;
10111011   offs_t vram_end;
10121012
r18027r18028
10141014   membank("bank2")->set_base(machine().root_device().memregion("user2")->base());
10151015
10161016   /* install MESS managed RAM */
1017   space_0->install_readwrite_bank(0, machine().device<ram_device>(RAM_TAG)->size() - 1, 0, 0x02000000, "bank3");
1018   space_1->install_readwrite_bank(0, machine().device<ram_device>(RAM_TAG)->size() - 1, 0, 0x02000000, "bank3");
1017   space_0.install_readwrite_bank(0, machine().device<ram_device>(RAM_TAG)->size() - 1, 0, 0x02000000, "bank3");
1018   space_1.install_readwrite_bank(0, machine().device<ram_device>(RAM_TAG)->size() - 1, 0, 0x02000000, "bank3");
10191019   membank("bank3")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
10201020
10211021   kbdc8042_init(machine(), &bebox_8042_interface);
r18027r18028
10231023   /* install VGA memory */
10241024   vram_begin = 0xC1000000;
10251025   vram_end = vram_begin + pc_vga_memory_size() - 1;
1026   space_0->install_legacy_readwrite_handler(vram_begin, vram_end, FUNC(bebox_video_r), FUNC(bebox_video_w));
1027   space_1->install_legacy_readwrite_handler(vram_begin, vram_end, FUNC(bebox_video_r), FUNC(bebox_video_w));
1026   space_0.install_legacy_readwrite_handler(vram_begin, vram_end, FUNC(bebox_video_r), FUNC(bebox_video_w));
1027   space_1.install_legacy_readwrite_handler(vram_begin, vram_end, FUNC(bebox_video_r), FUNC(bebox_video_w));
10281028
10291029   /* The following is a verrrry ugly hack put in to support NetBSD for
10301030     * NetBSD.  When NetBSD/bebox it does most of its work on CPU #0 and then
r18027r18028
10441044         /* bcctr 0x14, 0 */
10451045         U64(0x4E80042000000000)
10461046      };
1047      space_1->install_read_bank(0x9421FFF0, 0x9421FFFF, "bank1");
1047      space_1.install_read_bank(0x9421FFF0, 0x9421FFFF, "bank1");
10481048      membank("bank1")->set_base(ops);
10491049   }
10501050}
trunk/src/mess/machine/intv.c
r18027r18028
410410
411411   UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
412412   intv_state *state = image.device().machine().driver_data<intv_state>();
413   address_space *program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
413   address_space &program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
414414   const char *filetype = image.filetype();
415415
416416   /* if it is in .rom format, we enter here */
r18027r18028
504504            start = (( ram & 0xf0 ) >> 4) * 0x1000;
505505            size = ( ram & 0x0f ) * 0x800;
506506
507            program->install_readwrite_handler(start, start + size,
507            program.install_readwrite_handler(start, start + size,
508508               read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state),
509509               write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state));
510510         }
r18027r18028
556556      const char* region_name[] = {"4800", "5000", "6000", "7000", "9000", "A000", "C000", "D000", "F000"};
557557      UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
558558      intv_state *state = image.device().machine().driver_data<intv_state>();
559      address_space *program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
559      address_space &program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
560560
561561      UINT32 size=0;
562562      UINT16 address = 0;
r18027r18028
593593      size = image.get_software_region_length("D000_RAM8");
594594      if (size)
595595      {
596         program->install_readwrite_handler(0xD000, 0xD000 + size,
596         program.install_readwrite_handler(0xD000, 0xD000 + size,
597597            read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state),
598598            write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state));
599599      }
r18027r18028
601601      size = image.get_software_region_length("8800_RAM8");
602602      if (size)
603603      {
604         program->install_readwrite_handler(0x8800, 0x8800 + size,
604         program.install_readwrite_handler(0x8800, 0x8800 + size,
605605            read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state),
606606            write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state));
607607      }
trunk/src/mess/machine/nubus.c
r18027r18028
146146   switch(buswidth)
147147   {
148148      case 32:
149         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, mask);
149         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask);
150150         break;
151151      case 64:
152         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask);
152         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask);
153153         break;
154154      default:
155155         fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
r18027r18028
164164   switch(buswidth)
165165   {
166166      case 32:
167         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, mask);
167         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask);
168168         break;
169169      case 64:
170         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask);
170         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask);
171171         break;
172172      default:
173173         fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
r18027r18028
182182   switch(buswidth)
183183   {
184184      case 32:
185         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, mask);
185         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, mask);
186186         break;
187187      case 64:
188         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask);
188         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(start, end, rhandler, whandler, ((UINT64)mask<<32)|mask);
189189         break;
190190      default:
191191         fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
r18027r18028
200200   switch(buswidth)
201201   {
202202      case 32:
203         m_maincpu->space(AS_PROGRAM)->install_read_handler(start, end, rhandler, mask);
203         m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, mask);
204204         break;
205205      case 64:
206         m_maincpu->space(AS_PROGRAM)->install_read_handler(start, end, rhandler, ((UINT64)mask<<32)|mask);
206         m_maincpu->space(AS_PROGRAM).install_read_handler(start, end, rhandler, ((UINT64)mask<<32)|mask);
207207         break;
208208      default:
209209         fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
r18027r18028
218218   switch(buswidth)
219219   {
220220      case 32:
221         m_maincpu->space(AS_PROGRAM)->install_write_handler(start, end, whandler, mask);
221         m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, mask);
222222         break;
223223      case 64:
224         m_maincpu->space(AS_PROGRAM)->install_write_handler(start, end, whandler, ((UINT64)mask<<32)|mask);
224         m_maincpu->space(AS_PROGRAM).install_write_handler(start, end, whandler, ((UINT64)mask<<32)|mask);
225225         break;
226226      default:
227227         fatalerror("NUBUS: Bus width %d not supported\n", buswidth);
r18027r18028
233233{
234234//  printf("install_bank: %s @ %x->%x mask %x mirror %x\n", tag, start, end, mask, mirror);
235235   m_maincpu = machine().device<cpu_device>(m_cputag);
236   address_space &space = *m_maincpu->space(AS_PROGRAM);
236   address_space &space = m_maincpu->space(AS_PROGRAM);
237237   space.install_readwrite_bank(start, end, mask, mirror, tag );
238238   machine().root_device().membank(tag)->set_base(data);
239239}
trunk/src/mess/machine/tf20.c
r18027r18028
7272static READ8_HANDLER( tf20_rom_disable )
7373{
7474   tf20_state *tf20 = get_safe_token(space.device().owner());
75   address_space *prg = space.device().memory().space(AS_PROGRAM);
75   address_space &prg = space.device().memory().space(AS_PROGRAM);
7676
7777   /* switch in ram */
78   prg->install_ram(0x0000, 0x7fff, tf20->ram->pointer());
78   prg.install_ram(0x0000, 0x7fff, tf20->ram->pointer());
7979
8080   return 0xff;
8181}
r18027r18028
327327{
328328   tf20_state *tf20 = get_safe_token(device);
329329   device_t *cpu = device->subdevice("tf20");
330   address_space *prg = cpu->memory().space(AS_PROGRAM);
330   address_space &prg = cpu->memory().space(AS_PROGRAM);
331331
332332   cpu->execute().set_irq_acknowledge_callback(tf20_irq_ack);
333333
r18027r18028
345345   tf20->floppy_1 = device->subdevice(FLOPPY_1);
346346
347347   /* enable second half of ram */
348   prg->install_ram(0x8000, 0xffff, tf20->ram->pointer() + 0x8000);
348   prg.install_ram(0x8000, 0xffff, tf20->ram->pointer() + 0x8000);
349349}
350350
351351static DEVICE_RESET( tf20 )
352352{
353353   device_t *cpu = device->subdevice("tf20");
354   address_space *prg = cpu->memory().space(AS_PROGRAM);
354   address_space &prg = cpu->memory().space(AS_PROGRAM);
355355
356356   /* enable rom */
357   prg->install_rom(0x0000, 0x07ff, 0, 0x7800, cpu->region()->base());
357   prg.install_rom(0x0000, 0x07ff, 0, 0x7800, cpu->region()->base());
358358}
359359
360360const device_type TF20 = &device_creator<tf20_device>;
trunk/src/mess/machine/snescart.c
r18027r18028
504504static int snes_find_addon_chip( running_machine &machine )
505505{
506506   snes_state *state = machine.driver_data<snes_state>();
507   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
507   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
508508   int supported_type = 1;
509509   int dsp_prg_offset = 0;
510510
r18027r18028
686686static void snes_cart_log_info( running_machine &machine, int total_blocks, int supported )
687687{
688688   snes_state *state = machine.driver_data<snes_state>();
689   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
689   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
690690   char title[21], rom_id[4], company_id[2];
691691   int i, company, has_ram = 0, has_sram = 0;
692692
r18027r18028
763763   int supported_type = 1;
764764   running_machine &machine = image.device().machine();
765765   snes_state *state = machine.driver_data<snes_state>();
766   address_space &space = *machine.device( "maincpu")->memory().space( AS_PROGRAM );
766   address_space &space = machine.device( "maincpu")->memory().space( AS_PROGRAM );
767767   int total_blocks, read_blocks, has_bsx_slot = 0, st_bios = 0;
768768   UINT32 offset, int_header_offs;
769769   UINT8 *ROM = state->memregion("cart")->base();
trunk/src/mess/machine/c64.c
r18027r18028
465465         state->membank("bank1")->set_base(state->m_roml);
466466         state->membank("bank3")->set_base(state->m_memory + 0xa000);
467467         state->membank("bank4")->set_base(state->m_romh);
468         machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xe000, 0xffff);
468         machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xe000, 0xffff);
469469   }
470470   else
471471   {
r18027r18028
589589   if (!state->m_ultimax)
590590      c64_bankswitch(device->machine(), 0);
591591
592   state->m_memory[0x000] = device->memory().space(AS_PROGRAM)->read_byte(0);
593   state->m_memory[0x001] = device->memory().space(AS_PROGRAM)->read_byte(1);
592   state->m_memory[0x000] = device->memory().space(AS_PROGRAM).read_byte(0);
593   state->m_memory[0x001] = device->memory().space(AS_PROGRAM).read_byte(1);
594594
595595}
596596
r18027r18028
12601260***************************************************************************/
12611261
12621262#define install_write_handler(_start, _end, _handler) \
1263   image.device().machine().firstcpu->space(AS_PROGRAM)->install_legacy_write_handler(_start, _end, FUNC(_handler));
1263   image.device().machine().firstcpu->space(AS_PROGRAM).install_legacy_write_handler(_start, _end, FUNC(_handler));
12641264
12651265#define install_io1_handler(_handler) \
1266   image.device().machine().firstcpu->space(AS_PROGRAM)->install_legacy_write_handler(0xde00, 0xde00, 0, 0xff, FUNC(_handler));
1266   image.device().machine().firstcpu->space(AS_PROGRAM).install_legacy_write_handler(0xde00, 0xde00, 0, 0xff, FUNC(_handler));
12671267
12681268#define install_io2_handler(_handler) \
1269   image.device().machine().firstcpu->space(AS_PROGRAM)->install_legacy_write_handler(0xdf00, 0xdf00, 0, 0xff, FUNC(_handler));
1269   image.device().machine().firstcpu->space(AS_PROGRAM).install_legacy_write_handler(0xdf00, 0xdf00, 0, 0xff, FUNC(_handler));
12701270
12711271#define allocate_cartridge_timer(_period, _func) \
12721272   legacy_c64_state *state = image.device().machine().driver_data<legacy_c64_state>(); \
r18027r18028
15771577
15781578   map_cartridge_roml(image.device().machine(), 0x0000);
15791579
1580   address_space &space = *image.device().machine().firstcpu->space(AS_PROGRAM);
1580   address_space &space = image.device().machine().firstcpu->space(AS_PROGRAM);
15811581   space.install_legacy_read_handler(0xdf00, 0xdfff, FUNC(super_explode_r));
15821582
15831583   install_io2_handler(super_explode_bank_w);
r18027r18028
19591959static void setup_c64_custom_mappers(running_machine &machine)
19601960{
19611961   legacy_c64_state *state = machine.driver_data<legacy_c64_state>();
1962   address_space &space = *machine.device( "maincpu")->memory().space( AS_PROGRAM );
1962   address_space &space = machine.device( "maincpu")->memory().space( AS_PROGRAM );
19631963
19641964   switch (state->m_cart.mapper)
19651965   {
trunk/src/mess/machine/hd63450.c
r18027r18028
237237
238238static void dma_transfer_start(device_t* device, int channel, int dir)
239239{
240   address_space &space = *device->machine().firstcpu->space(AS_PROGRAM);
240   address_space &space = device->machine().firstcpu->space(AS_PROGRAM);
241241   hd63450_t* dmac = get_safe_token(device);
242242   dmac->in_progress[channel] = 1;
243243   dmac->reg[channel].csr &= ~0xe0;
r18027r18028
314314
315315void hd63450_single_transfer(device_t* device, int x)
316316{
317   address_space &space = *device->machine().firstcpu->space(AS_PROGRAM);
317   address_space &space = device->machine().firstcpu->space(AS_PROGRAM);
318318   int data;
319319   int datasize = 1;
320320   hd63450_t* dmac = get_safe_token(device);
trunk/src/mess/machine/pc.c
r18027r18028
9898WRITE8_MEMBER(pc_state::ec1841_memboard_w)
9999{
100100   pc_state *st = space.machine().driver_data<pc_state>();
101   address_space *program = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
101   address_space &program = space.machine().device("maincpu")->memory().space(AS_PROGRAM);
102102   running_machine &machine = space.machine();
103103   UINT8 current;
104104
r18027r18028
114114
115115   if (BIT(current, 2) && !BIT(data, 2)) {
116116      // disable read access
117      program->unmap_read(0, 0x7ffff);
117      program.unmap_read(0, 0x7ffff);
118118      DBG_LOG(1,"ec1841_memboard_w",("unmap_read(%d)\n", offset));
119119   }
120120
121121   if (BIT(current, 3) && !BIT(data, 3)) {
122122      // disable write access
123      program->unmap_write(0, 0x7ffff);
123      program.unmap_write(0, 0x7ffff);
124124      DBG_LOG(1,"ec1841_memboard_w",("unmap_write(%d)\n", offset));
125125   }
126126
127127   if (!BIT(current, 2) && BIT(data, 2)) {
128128      // enable read access
129      program->install_read_bank(0, 0x7ffff, "bank10");
129      program.install_read_bank(0, 0x7ffff, "bank10");
130130      DBG_LOG(1,"ec1841_memboard_w",("map_read(%d)\n", offset));
131131   }
132132
133133   if (!BIT(current, 3) && BIT(data, 3)) {
134134      // enable write access
135      program->install_write_bank(0, 0x7ffff, "bank10");
135      program.install_write_bank(0, 0x7ffff, "bank10");
136136      DBG_LOG(1,"ec1841_memboard_w",("map_write(%d)\n", offset));
137137   }
138138
r18027r18028
14091409
14101410DRIVER_INIT_MEMBER(pc_state,pc1640)
14111411{
1412   address_space *io_space = machine().firstcpu->space( AS_IO );
1412   address_space &io_space = machine().firstcpu->space( AS_IO );
14131413
1414   io_space->install_legacy_read_handler(0x278, 0x27b, FUNC(pc1640_port278_r), 0xffff);
1415   io_space->install_legacy_read_handler(0x4278, 0x427b, FUNC(pc1640_port4278_r), 0xffff);
1414   io_space.install_legacy_read_handler(0x278, 0x27b, FUNC(pc1640_port278_r), 0xffff);
1415   io_space.install_legacy_read_handler(0x4278, 0x427b, FUNC(pc1640_port4278_r), 0xffff);
14161416
14171417   mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
14181418}
r18027r18028
14221422   mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
14231423
14241424   pc_vga_init(machine(), ::input_port_0_r, NULL);
1425   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000);
1425   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000);
14261426}
14271427
14281428static IRQ_CALLBACK(pc_irq_callback)
trunk/src/mess/machine/pecom.c
r18027r18028
2727void pecom_state::machine_reset()
2828{
2929   UINT8 *rom = machine().root_device().memregion(CDP1802_TAG)->base();
30   address_space &space = *machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM);
30   address_space &space = machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM);
3131
3232
3333   space.unmap_write(0x0000, 0x3fff);
r18027r18028
6868
6969WRITE8_MEMBER(pecom_state::pecom_bank_w)
7070{
71   address_space *space2 = machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM);
71   address_space &space2 = machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM);
7272   UINT8 *rom = memregion(CDP1802_TAG)->base();
73   machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x3fff, "bank1");
73   machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM).install_write_bank(0x0000, 0x3fff, "bank1");
7474   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x0000);
7575
7676   if (data==2)
7777   {
78      space2->install_read_handler (0xf000, 0xf7ff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_r),this));
79      space2->install_write_handler(0xf000, 0xf7ff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_w),this));
80      space2->install_read_handler (0xf800, 0xffff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_r),this));
81      space2->install_write_handler(0xf800, 0xffff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_w),this));
78      space2.install_read_handler (0xf000, 0xf7ff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_r),this));
79      space2.install_write_handler(0xf000, 0xf7ff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_charram_w),this));
80      space2.install_read_handler (0xf800, 0xffff, read8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_r),this));
81      space2.install_write_handler(0xf800, 0xffff, write8_delegate(FUNC(pecom_state::pecom_cdp1869_pageram_w),this));
8282   }
8383   else
8484   {
85      space2->unmap_write(0xf000, 0xf7ff);
86      space2->unmap_write(0xf800, 0xffff);
87      space2->install_read_bank (0xf000, 0xf7ff, "bank3");
88      space2->install_read_bank (0xf800, 0xffff, "bank4");
85      space2.unmap_write(0xf000, 0xf7ff);
86      space2.unmap_write(0xf800, 0xffff);
87      space2.install_read_bank (0xf000, 0xf7ff, "bank3");
88      space2.install_read_bank (0xf800, 0xffff, "bank4");
8989      membank("bank3")->set_base(rom + 0xf000);
9090      membank("bank4")->set_base(rom + 0xf800);
9191   }
trunk/src/mess/machine/z88_flash.c
r18027r18028
7070
7171UINT8* z88_1024k_flash_device::get_cart_base()
7272{
73   return (UINT8*)m_flash->space()->get_read_ptr(0);
73   return (UINT8*)m_flash->space().get_read_ptr(0);
7474}
7575
7676/*-------------------------------------------------
trunk/src/mess/machine/pce.c
r18027r18028
220220   /* Check for Street fighter 2 */
221221   if (size == PCE_ROM_MAXSIZE)
222222   {
223      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01ff0, 0x01ff3, write8_delegate(FUNC(pce_state::pce_sf2_banking_w),state));
223      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01ff0, 0x01ff3, write8_delegate(FUNC(pce_state::pce_sf2_banking_w),state));
224224   }
225225
226226   /* Check for Populous */
r18027r18028
228228   {
229229      state->m_cartridge_ram = auto_alloc_array(image.device().machine(), UINT8, 0x8000);
230230      state->membank("bank2")->set_base(state->m_cartridge_ram);
231      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x080000, 0x087FFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state));
231      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x080000, 0x087FFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state));
232232   }
233233
234234   /* Check for CD system card */
r18027r18028
243243      {
244244         state->m_cartridge_ram = auto_alloc_array(image.device().machine(), UINT8, 0x30000);
245245         state->membank("bank4")->set_base(state->m_cartridge_ram);
246         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0D0000, 0x0FFFFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state));
247         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x080000, 0x087FFF, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),state),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),state));
246         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0D0000, 0x0FFFFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state));
247         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087FFF, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),state),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),state));
248248      }
249249   }
250250   return 0;
trunk/src/mess/machine/bbc.c
r18027r18028
20742074{
20752075   m_mc6850_clock = 0;
20762076
2077   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcbp_direct_handler), this));
2077   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcbp_direct_handler), this));
20782078
20792079   /* bank 6 is the paged ROMs     from b000 to bfff */
20802080   membank("bank6")->configure_entries(0, 16, memregion("user1")->base() + 0x3000, 1<<14);
r18027r18028
21002100{
21012101   m_mc6850_clock = 0;
21022102
2103   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcm_direct_handler), this));
2103   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(bbc_state::bbcm_direct_handler), this));
21042104
21052105   /* bank 5 is the paged ROMs     from 9000 to bfff */
21062106   membank("bank5")->configure_entries(0, 16, machine().root_device().memregion("user1")->base()+0x01000, 1<<14);
21072107
21082108   /* Set ROM/IO bank to point to rom */
21092109   membank( "bank8" )->set_base( memregion("user1")->base()+0x43c00);
2110   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xFC00, 0xFEFF, "bank8");
2110   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xFC00, 0xFEFF, "bank8");
21112111}
21122112
21132113MACHINE_RESET_MEMBER(bbc_state,bbcm)
trunk/src/mess/machine/comx_clm.c
r18027r18028
251251
252252UINT8 comx_clm_device::comx_mrd_r(offs_t offset, int *extrom)
253253{
254   address_space &space = *machine().firstcpu->space(AS_PROGRAM);
254   address_space &space = machine().firstcpu->space(AS_PROGRAM);
255255
256256   UINT8 data = 0xff;
257257
r18027r18028
278278
279279void comx_clm_device::comx_mwr_w(offs_t offset, UINT8 data)
280280{
281   address_space &space = *machine().firstcpu->space(AS_PROGRAM);
281   address_space &space = machine().firstcpu->space(AS_PROGRAM);
282282
283283   if (offset >= 0xd000 && offset < 0xd800)
284284   {
trunk/src/mess/machine/hp48.c
r18027r18028
709709{
710710   int i;
711711   int nce2_enable = 1;
712   address_space& space = *state->machine().device("maincpu")->memory().space(AS_PROGRAM);
712   address_space& space = state->machine().device("maincpu")->memory().space(AS_PROGRAM);
713713
714714   state->m_io_addr = 0x100000;
715715
trunk/src/mess/machine/c65.c
r18027r18028
270270   PAIR pair, src, dst, len;
271271   UINT8 cmd, fill;
272272   int i;
273   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
273   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
274274
275275   switch (offset & 3)
276276   {
r18027r18028
793793      {
794794         state->membank("bank8")->set_base(state->m_colorram + 0x400);
795795         state->membank("bank9")->set_base(state->m_colorram + 0x400);
796         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0dc00, 0x0dfff, "bank8");
797         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0dc00, 0x0dfff, "bank9");
796         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8");
797         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9");
798798      }
799799      else
800800      {
801         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0dc00, 0x0dfff, FUNC(c65_read_io_dc00));
802         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0dc00, 0x0dfff, FUNC(c65_write_io_dc00));
801         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x0dc00, 0x0dfff, FUNC(c65_read_io_dc00));
802         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x0dc00, 0x0dfff, FUNC(c65_write_io_dc00));
803803      }
804804   }
805805
r18027r18028
869869
870870      if (state->m_io_dc00_on)
871871      {
872         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0dc00, 0x0dfff, FUNC(c65_read_io_dc00));
873         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0dc00, 0x0dfff, FUNC(c65_write_io_dc00));
872         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x0dc00, 0x0dfff, FUNC(c65_read_io_dc00));
873         machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x0dc00, 0x0dfff, FUNC(c65_write_io_dc00));
874874      }
875875      else
876876      {
877         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0dc00, 0x0dfff, "bank8");
878         machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0dc00, 0x0dfff, "bank9");
877         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8");
878         machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9");
879879         state->membank("bank8")->set_base(state->m_colorram + 0x400);
880880         state->membank("bank9")->set_base(state->m_colorram + 0x400);
881881      }
882      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0d000, 0x0d7ff, FUNC(c65_read_io));
883      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0d000, 0x0d7ff, FUNC(c65_write_io));
882      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x0d000, 0x0d7ff, FUNC(c65_read_io));
883      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x0d000, 0x0d7ff, FUNC(c65_write_io));
884884   }
885885   else
886886   {
r18027r18028
900900         state->membank("bank6")->set_base(state->m_memory + 0xd800);
901901         state->membank("bank8")->set_base(state->m_memory + 0xdc00);
902902      }
903      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0d000, 0x0d7ff, "bank4");
904      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0d000, 0x0d7ff, "bank5");
903      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0d000, 0x0d7ff, "bank4");
904      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0d000, 0x0d7ff, "bank5");
905905   }
906906
907907   if (!state->m_game && state->m_exrom)
trunk/src/mess/machine/rm380z.c
r18027r18028
107107
108108WRITE8_MEMBER( rm380z_state::port_write_1b00 )
109109{
110   address_space *program = m_maincpu->space(AS_PROGRAM);
111   port_write(*program,offset+0xfc,data);
110   address_space &program = m_maincpu->space(AS_PROGRAM);
111   port_write(program,offset+0xfc,data);
112112}
113113
114114READ8_MEMBER( rm380z_state::port_read_1b00 )
115115{
116   address_space *program = m_maincpu->space(AS_PROGRAM);
117   return port_read(*program,offset+0xfc);
116   address_space &program = m_maincpu->space(AS_PROGRAM);
117   return port_read(program,offset+0xfc);
118118}
119119
120120READ8_MEMBER( rm380z_state::hiram_read )
r18027r18028
282282
283283void rm380z_state::config_memory_map()
284284{
285   address_space *program = m_maincpu->space(AS_PROGRAM);
285   address_space &program = m_maincpu->space(AS_PROGRAM);
286286   UINT8 *rom = memregion(RM380Z_MAINCPU_TAG)->base();
287287   UINT8* m_ram_p = m_messram->pointer();
288288
289289   if ( RM380Z_PORTS_ENABLED_HIGH )
290290   {
291      program->install_ram( 0x0000, 0xDFFF, m_ram_p );
291      program.install_ram( 0x0000, 0xDFFF, m_ram_p );
292292   }
293293   else
294294   {
295      program->install_rom( 0x0000, 0x0FFF, rom );
296      program->install_readwrite_handler(0x1BFC, 0x1BFF,read8_delegate(FUNC(rm380z_state::port_read_1b00), this),write8_delegate(FUNC(rm380z_state::port_write_1b00), this)   );
297      program->install_rom( 0x1C00, 0x1DFF, rom + 0x1400 );
298      program->install_ram( 0x4000, 0xDFFF, m_ram_p );
295      program.install_rom( 0x0000, 0x0FFF, rom );
296      program.install_readwrite_handler(0x1BFC, 0x1BFF,read8_delegate(FUNC(rm380z_state::port_read_1b00), this),write8_delegate(FUNC(rm380z_state::port_write_1b00), this)   );
297      program.install_rom( 0x1C00, 0x1DFF, rom + 0x1400 );
298      program.install_ram( 0x4000, 0xDFFF, m_ram_p );
299299   }
300300}
trunk/src/mess/machine/ti99/tn_ide.c
r18027r18028
136136         case 0:      /* RTC RAM */
137137            if (addr & 0x80)
138138               /* RTC RAM page register */
139               reply = m_rtc->xram_r(*machine().memory().first_space(),(addr & 0x1f) | 0x20);
139               reply = m_rtc->xram_r(machine().driver_data()->generic_space(),(addr & 0x1f) | 0x20);
140140            else
141141               /* RTC RAM read */
142               reply = m_rtc->xram_r(*machine().memory().first_space(),addr);
142               reply = m_rtc->xram_r(machine().driver_data()->generic_space(),addr);
143143            break;
144144         case 1:      /* RTC registers */
145145            if (addr & 0x10)
146146               /* register data */
147               reply = m_rtc->rtc_r(*machine().memory().first_space(),1);
147               reply = m_rtc->rtc_r(machine().driver_data()->generic_space(),1);
148148            else
149149               /* register select */
150               reply = m_rtc->rtc_r(*machine().memory().first_space(),0);
150               reply = m_rtc->rtc_r(machine().driver_data()->generic_space(),0);
151151            break;
152152         case 2:      /* IDE registers set 1 (CS1Fx) */
153153            if (m_tms9995_mode ? (!(addr & 1)) : (addr & 1))
r18027r18028
205205         case 0:      /* RTC RAM */
206206            if (addr & 0x80)
207207               /* RTC RAM page register */
208               m_rtc->xram_w(*machine().memory().first_space(),(addr & 0x1f) | 0x20, data);
208               m_rtc->xram_w(machine().driver_data()->generic_space(),(addr & 0x1f) | 0x20, data);
209209            else
210210               /* RTC RAM write */
211               m_rtc->xram_w(*machine().memory().first_space(),addr, data);
211               m_rtc->xram_w(machine().driver_data()->generic_space(),addr, data);
212212            break;
213213         case 1:      /* RTC registers */
214214            if (addr & 0x10)
215215               /* register data */
216               m_rtc->rtc_w(*machine().memory().first_space(),1, data);
216               m_rtc->rtc_w(machine().driver_data()->generic_space(),1, data);
217217            else
218218               /* register select */
219               m_rtc->rtc_w(*machine().memory().first_space(),0, data);
219               m_rtc->rtc_w(machine().driver_data()->generic_space(),0, data);
220220            break;
221221         case 2:      /* IDE registers set 1 (CS1Fx) */
222222/*
trunk/src/mess/machine/ti99/datamux.c
r18027r18028
254254   m_ready.resolve(conf->ready, *this);
255255
256256   m_cpu = machine().device("maincpu");
257   m_space = m_cpu->memory().space(AS_PROGRAM);
257   m_space = &m_cpu->memory().space(AS_PROGRAM);
258258
259259   m_devices.reset(); // clear the list
260260   m_use32k = (ioport("RAM")->read()==1);
trunk/src/mess/machine/ti99/ti_rs232.c
r18027r18028
10591059      m_select_value = 0x74000;
10601060   }
10611061
1062   m_space = machine().device("maincpu")->memory().space(AS_IO);
1062   m_space = &machine().device("maincpu")->memory().space(AS_IO);
10631063   m_selected = false;
10641064
10651065   m_cru_base = (ioport("CRURS232")->read()==0)? 0x1300 : 0x1500;
trunk/src/mess/machine/coco.c
r18027r18028
236236   UINT8 byte;
237237
238238   // set up the ability to read address spaces
239   address_space *program = m_maincpu->space(AS_PROGRAM);
239   address_space &program = m_maincpu->space(AS_PROGRAM);
240240
241241   // get the previous and current PC
242242   UINT16 prev_pc = m_maincpu->pcbase();
243243   UINT16 pc = m_maincpu->pc();
244244
245245   // get the byte; and skip over header bytes
246   byte = program->read_byte(prev_pc);
246   byte = program.read_byte(prev_pc);
247247   if ((byte == 0x10) || (byte == 0x11))
248      byte = program->read_byte(++prev_pc);
248      byte = program.read_byte(++prev_pc);
249249
250250   // check to see if the opcode specifies the indexed addressing mode, and the secondary byte
251251   // specifies no-offset
252252   bool is_nooffset_indexed = (((byte & 0xF0) == 0x60) || ((byte & 0xF0) == 0xA0) || ((byte & 0xF0) == 0xE0))
253      && ((program->read_byte(prev_pc + 1) & 0xBF) == 0x84);
253      && ((program.read_byte(prev_pc + 1) & 0xBF) == 0x84);
254254
255255   // finally read the byte
256   return program->read_byte(is_nooffset_indexed ? pc : 0xFFFF);
256   return program.read_byte(is_nooffset_indexed ? pc : 0xFFFF);
257257}
258258
259259
trunk/src/mess/machine/gb.c
r18027r18028
119119   state->SIODATA = 0x00;
120120   state->SIOCONT = 0x7E;
121121
122   state->gb_io_w( *machine.device("maincpu")->memory().space(AS_PROGRAM ), 0x05, 0x00 );      /* TIMECNT */
123   state->gb_io_w( *machine.device("maincpu")->memory().space(AS_PROGRAM ), 0x06, 0x00 );      /* TIMEMOD */
122   state->gb_io_w( machine.device("maincpu")->memory().space(AS_PROGRAM ), 0x05, 0x00 );      /* TIMECNT */
123   state->gb_io_w( machine.device("maincpu")->memory().space(AS_PROGRAM ), 0x06, 0x00 );      /* TIMEMOD */
124124}
125125
126126static void gb_rom16_0000( running_machine &machine, UINT8 *addr )
r18027r18028
154154static void gb_init(running_machine &machine)
155155{
156156   gb_state *state = machine.driver_data<gb_state>();
157   address_space &space = *machine.device( "maincpu")->memory().space( AS_PROGRAM );
157   address_space &space = machine.device( "maincpu")->memory().space( AS_PROGRAM );
158158
159159   /* Initialize the memory banks */
160160   state->m_MBC1Mode = 0;
trunk/src/mess/machine/990_hd.c
r18027r18028
540540   if (! (hdc.w[1] & w1_transfer_inhibit))
541541      for (i=0; i<real_word_count; i++)
542542      {
543         machine.device("maincpu")->memory().space(AS_PROGRAM)->write_word(dma_address, buffer[i]);
543         machine.device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, buffer[i]);
544544         dma_address = (dma_address + 2) & 0x1ffffe;
545545      }
546546
r18027r18028
695695      if (! (hdc.w[1] & w1_transfer_inhibit))
696696         for (i=0; i<bytes_read; i+=2)
697697         {
698            machine.device("maincpu")->memory().space(AS_PROGRAM)->write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
698            machine.device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
699699            dma_address = (dma_address + 2) & 0x1ffffe;
700700         }
701701
r18027r18028
791791      /* DMA */
792792      for (i=0; (i<byte_count) && (i<hdc.d[dsk_sel].bytes_per_sector); i+=2)
793793      {
794         word = machine.device("maincpu")->memory().space(AS_PROGRAM)->read_word(dma_address);
794         word = machine.device("maincpu")->memory().space(AS_PROGRAM).read_word(dma_address);
795795         buffer[i] = word >> 8;
796796         buffer[i+1] = word & 0xff;
797797
r18027r18028
898898   if (! (hdc.w[1] & w1_transfer_inhibit))
899899      for (i=0; i<real_word_count; i++)
900900      {
901         machine.device("maincpu")->memory().space(AS_PROGRAM)->write_word(dma_address, buffer[i]);
901         machine.device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, buffer[i]);
902902         dma_address = (dma_address + 2) & 0x1ffffe;
903903      }
904904
trunk/src/mess/machine/radio86.c
r18027r18028
168168
169169READ8_MEMBER(radio86_state::radio_io_r)
170170{
171   return machine().device("maincpu")->memory().space(AS_PROGRAM)->read_byte((offset << 8) + offset);
171   return machine().device("maincpu")->memory().space(AS_PROGRAM).read_byte((offset << 8) + offset);
172172}
173173
174174WRITE8_MEMBER(radio86_state::radio_io_w)
175175{
176   machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte((offset << 8) + offset,data);
176   machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte((offset << 8) + offset,data);
177177}
178178
179179MACHINE_RESET_MEMBER(radio86_state,radio86)
trunk/src/mess/machine/advision.c
r18027r18028
3030   /* configure EA banking */
3131   membank("bank1")->configure_entry(0, memregion("bios")->base());
3232   membank("bank1")->configure_entry(1, memregion(I8048_TAG)->base());
33   m_maincpu->space(AS_PROGRAM)->install_readwrite_bank(0x0000, 0x03ff, "bank1");
33   m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1");
3434   membank("bank1")->set_entry(0);
3535
3636   /* allocate external RAM */
trunk/src/mess/machine/b2m.c
r18027r18028
4444{
4545   UINT8 *rom;
4646   b2m_state *state =  machine.driver_data<b2m_state>();
47   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
47   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
4848   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
4949
5050   space.install_write_bank(0x0000, 0x27ff, "bank1");
trunk/src/mess/machine/aim65.c
r18027r18028
141141void aim65_state::machine_start()
142142{
143143   ram_device *ram = machine().device<ram_device>(RAM_TAG);
144   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
144   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
145145
146146   /* Init RAM */
147147   space.install_ram(0x0000, ram->size() - 1, ram->pointer());
trunk/src/mess/machine/thomson.c
r18027r18028
447447
448448static void to7_update_cart_bank(running_machine &machine)
449449{
450   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
450   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
451451   int bank = 0;
452452   if ( thom_cart_nb_banks )
453453   {
r18027r18028
772772   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ));
773773
774774   /* set 8-bit data */
775   printer->write( *device->machine().memory().first_space(), 0, data);
775   printer->write( device->machine().driver_data()->generic_space(), 0, data);
776776}
777777
778778
r18027r18028
14871487
14881488MACHINE_START ( to7 )
14891489{
1490   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1490   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
14911491   UINT8* mem = machine.root_device().memregion("maincpu")->base();
14921492   UINT8* ram = machine.device<ram_device>(RAM_TAG)->pointer();
14931493
r18027r18028
15681568static void to770_update_ram_bank(running_machine &machine)
15691569{
15701570   pia6821_device *sys_pia = machine.device<pia6821_device>(THOM_PIA_SYS );
1571   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1571   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
15721572   UINT8 portb = sys_pia->port_b_z_mask();
15731573   int bank;
15741574
r18027r18028
19921992
19931993static void mo5_update_cart_bank(running_machine &machine)
19941994{
1995   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1995   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
19961996   int rom_is_ram = mo5_reg_cart & 4;
19971997   int bank = 0;
19981998   int bank_is_read_only = 0;
r18027r18028
23942394
23952395static void to9_update_cart_bank(running_machine &machine)
23962396{
2397   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2397   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
23982398   int bank = 0;
23992399   int slot = ( mc6846_get_output_port(machine.device("mc6846")) >> 4 ) & 3; /* bits 4-5: ROM bank */
24002400
r18027r18028
25102510static void to9_update_ram_bank (running_machine &machine)
25112511{
25122512   pia6821_device *sys_pia = machine.device<pia6821_device>(THOM_PIA_SYS );
2513   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2513   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
25142514   UINT8 port = mc6846_get_output_port(machine.device("mc6846"));
25152515   UINT8 portb = sys_pia->port_b_z_mask();
25162516   UINT8 disk = ((port >> 2) & 1) | ((port >> 5) & 2); /* bits 6,2: RAM bank */
r18027r18028
30493049static WRITE8_DEVICE_HANDLER ( to9_sys_porta_out )
30503050{
30513051   centronics_device *printer = device->machine().device<centronics_device>("centronics");
3052   printer->write(*device->machine().memory().first_space(), 0, data & 0xfe);
3052   printer->write(device->machine().driver_data()->generic_space(), 0, data & 0xfe);
30533053}
30543054
30553055
r18027r18028
35733573static void to8_update_ram_bank (running_machine &machine)
35743574{
35753575   pia6821_device *sys_pia = machine.device<pia6821_device>(THOM_PIA_SYS );
3576   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
3576   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
35773577   UINT8 bank = 0;
35783578
35793579   if ( to8_reg_sys1 & 0x10 )
r18027r18028
36373637
36383638static void to8_update_cart_bank (running_machine &machine)
36393639{
3640   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
3640   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
36413641   int bank = 0;
36423642   int bank_is_read_only = 0;
36433643
r18027r18028
44984498static void mo6_update_cart_bank (running_machine &machine)
44994499{
45004500   pia6821_device *sys_pia = machine.device<pia6821_device>(THOM_PIA_SYS );
4501   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
4501   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
45024502   int b = (sys_pia->a_output() >> 5) & 1;
45034503   int bank = 0;
45044504   int bank_is_read_only = 0;
r18027r18028
47604760   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ));
47614761
47624762   /* centronics data */
4763   printer->write( *device->machine().memory().first_space(), 0, data);
4763   printer->write( device->machine().driver_data()->generic_space(), 0, data);
47644764}
47654765
47664766
trunk/src/mess/machine/6883sam.c
r18027r18028
7474
7575   /* find the CPU */
7676   m_cpu = machine().device<cpu_device>(config->m_cpu_tag);
77   m_cpu_space = m_cpu->space(config->m_cpu_space);
77   m_cpu_space = &m_cpu->space(config->m_cpu_space);
7878
7979   /* resolve callbacks */
8080   m_res_input_func.resolve(config->m_input_func, *this);
trunk/src/mess/machine/c128.c
r18027r18028
452452
453453   if ((!m_game && m_exrom) || (charen && (loram || hiram)))
454454   {
455      m_subcpu->space(AS_PROGRAM)->install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(c128_state::read_io), this));
455      m_subcpu->space(AS_PROGRAM).install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(c128_state::read_io), this));
456456      m_write_io = 1;
457457   }
458458   else
459459   {
460      m_subcpu->space(AS_PROGRAM)->install_read_bank(0xd000, 0xdfff, "bank5");
460      m_subcpu->space(AS_PROGRAM).install_read_bank(0xd000, 0xdfff, "bank5");
461461      m_write_io = 0;
462462      if ((!charen && (loram || hiram)))
463463         membank("bank13")->set_base(m_chargen);
r18027r18028
636636      else
637637         m_ram_top = 0x10000;
638638
639      m_subcpu->space(AS_PROGRAM)->install_read_handler(0xff00, 0xff04, read8_delegate(FUNC(c128_state::mmu8722_ff00_r), this));
639      m_subcpu->space(AS_PROGRAM).install_read_handler(0xff00, 0xff04, read8_delegate(FUNC(c128_state::mmu8722_ff00_r), this));
640640
641641      if (MMU_IO_ON)
642642      {
643643         m_write_io = 1;
644         m_subcpu->space(AS_PROGRAM)->install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(c128_state::read_io), this));
644         m_subcpu->space(AS_PROGRAM).install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(c128_state::read_io), this));
645645      }
646646      else
647647      {
648648         m_write_io = 0;
649         m_subcpu->space(AS_PROGRAM)->install_read_bank(0xd000, 0xdfff, "bank13");
649         m_subcpu->space(AS_PROGRAM).install_read_bank(0xd000, 0xdfff, "bank13");
650650      }
651651
652652
r18027r18028
10251025
10261026   bankswitch_64(0);
10271027
1028   m_memory[0x000] = m_subcpu->space(AS_PROGRAM)->read_byte(0);
1029   m_memory[0x001] = m_subcpu->space(AS_PROGRAM)->read_byte(1);
1028   m_memory[0x000] = m_subcpu->space(AS_PROGRAM).read_byte(0);
1029   m_memory[0x001] = m_subcpu->space(AS_PROGRAM).read_byte(1);
10301030}
10311031
10321032READ8_MEMBER( c128_state::cpu_r)
trunk/src/mess/machine/pet.c
r18027r18028
656656   state->m_superpet = 0;
657657   state->m_cbm8096 = 0;
658658
659   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, machine.device<ram_device>(RAM_TAG)->size() - 1, "bank10");
659   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0x0000, machine.device<ram_device>(RAM_TAG)->size() - 1, "bank10");
660660   state->membank("bank10")->set_base(state->m_memory);
661661
662662   if (machine.device<ram_device>(RAM_TAG)->size() < 0x8000)
663663   {
664      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(machine.device<ram_device>(RAM_TAG)->size(), 0x7FFF);
664      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(machine.device<ram_device>(RAM_TAG)->size(), 0x7FFF);
665665   }
666666
667667   /* 2114 poweron ? 64 x 0xff, 64x 0, and so on */
r18027r18028
743743   {
744744      if (machine().root_device().ioport("CFG")->read() & 0x08)
745745      {
746         machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xfff0, 0xfff0, FUNC(cbm8096_w));
746         machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xfff0, 0xfff0, FUNC(cbm8096_w));
747747      }
748748      else
749749      {
750         machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xfff0, 0xfff0);
750         machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xfff0, 0xfff0);
751751      }
752      cbm8096_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
752      cbm8096_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
753753   }
754754
755755//removed   cbm_drive_0_config (machine().root_device().ioport("CFG")->read() & 2 ? IEEE : 0, 8);
trunk/src/mess/machine/oric.c
r18027r18028
221221   {
222222      /* if psg not selected, write to printer */
223223      centronics_device *centronics = device->machine().device<centronics_device>("centronics");
224      centronics->write(*device->machine().memory().first_space(), 0, data);
224      centronics->write(device->machine().driver_data()->generic_space(), 0, data);
225225   }
226226}
227227
r18027r18028
427427{
428428   oric_state *state = machine.driver_data<oric_state>();
429429   device_t *fdc = machine.device("fdc");
430   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
430   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
431431
432432   if (state->m_is_telestrat)
433433      return;
r18027r18028
446446{
447447   oric_state *state = machine.driver_data<oric_state>();
448448   int i;
449   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
449   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
450450
451451   if (state->m_is_telestrat)
452452      return;
r18027r18028
551551{
552552   oric_state *state = machine.driver_data<oric_state>();
553553   device_t *fdc = machine.device("fdc");
554   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
554   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
555555
556556   space.install_read_handler(0x0300, 0x030f, read8_delegate(FUNC(oric_state::oric_IO_r),state));
557557   space.install_legacy_read_handler(*fdc, 0x0310, 0x031f, FUNC(applefdc_r));
r18027r18028
755755static void oric_install_jasmin_interface(running_machine &machine)
756756{
757757   oric_state *state = machine.driver_data<oric_state>();
758   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
758   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
759759   /* romdis */
760760   state->m_port_3fb_w = 1;
761761   oric_jasmin_set_mem_0x0c000(machine);
r18027r18028
978978static void oric_install_microdisc_interface(running_machine &machine)
979979{
980980   oric_state *state = machine.driver_data<oric_state>();
981   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
981   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
982982
983983   space.install_read_handler(0x0300, 0x030f, read8_delegate(FUNC(oric_state::oric_IO_r),state));
984984   space.install_read_handler(0x0310, 0x031f, read8_delegate(FUNC(oric_state::oric_microdisc_r),state));
r18027r18028
10641064void oric_state::machine_reset()
10651065{
10661066   int disc_interface_id = machine().root_device().ioport("FLOPPY")->read() & 0x07;
1067   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1067   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
10681068   if (m_is_telestrat)
10691069      return;
10701070
r18027r18028
12461246static void telestrat_refresh_mem(running_machine &machine)
12471247{
12481248   oric_state *state = machine.driver_data<oric_state>();
1249   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1249   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12501250
12511251   telestrat_mem_block *mem_block = &state->m_telestrat_blocks[state->m_telestrat_bank_selection];
12521252
trunk/src/mess/machine/genpc.c
r18027r18028
7171{
7272   if(m_dma_channel == -1)
7373      return 0xff;
74   address_space *spaceio = m_maincpu->space(AS_PROGRAM);
74   address_space &spaceio = m_maincpu->space(AS_PROGRAM);
7575   offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0x0F0000;
76   return spaceio->read_byte( page_offset + offset);
76   return spaceio.read_byte( page_offset + offset);
7777}
7878
7979
r18027r18028
8181{
8282   if(m_dma_channel == -1)
8383      return;
84   address_space *spaceio = m_maincpu->space(AS_PROGRAM);
84   address_space &spaceio = m_maincpu->space(AS_PROGRAM);
8585   offs_t page_offset = (((offs_t) m_dma_offset[m_dma_channel]) << 16) & 0x0F0000;
8686
87   spaceio->write_byte( page_offset + offset, data);
87   spaceio.write_byte( page_offset + offset, data);
8888}
8989
9090
r18027r18028
574574   switch(buswidth)
575575   {
576576      case 8:
577         m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0);
577         m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0);
578578         break;
579579      case 16:
580         m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
580         m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
581581         break;
582582      default:
583583         fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth);
r18027r18028
591591   switch(buswidth)
592592   {
593593      case 8:
594         m_maincpu->space(AS_IO)->install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name,0);
594         m_maincpu->space(AS_IO).install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name,0);
595595         break;
596596      case 16:
597         m_maincpu->space(AS_IO)->install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name, 0xffff);
597         m_maincpu->space(AS_IO).install_legacy_write_handler(*dev, start, end, mask, mirror, whandler, whandler_name, 0xffff);
598598         break;
599599      default:
600600         fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth);
r18027r18028
608608   switch(buswidth)
609609   {
610610      case 8:
611         m_maincpu->space(AS_IO)->install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0);
611         m_maincpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0);
612612         break;
613613      case 16:
614         m_maincpu->space(AS_IO)->install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff);
614         m_maincpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff);
615615         break;
616616      default:
617617         fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth);
r18027r18028
635635   switch(buswidth)
636636   {
637637      case 8:
638         m_maincpu->space(AS_IO)->install_readwrite_handler(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255), 0);
638         m_maincpu->space(AS_IO).install_readwrite_handler(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255), 0);
639639         break;
640640      case 16:
641         m_maincpu->space(AS_IO)->install_readwrite_handler(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255), 0xffff);
641         m_maincpu->space(AS_IO).install_readwrite_handler(0x0060, 0x0063, 0, 0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi8255), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi8255), 0xffff);
642642         break;
643643      default:
644644         fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth);
trunk/src/mess/machine/vector06.c
r18027r18028
169169
170170void vector06_state::machine_reset()
171171{
172   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
172   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
173173
174174   machine().device("maincpu")->execute().set_irq_acknowledge_callback(vector06_irq_callback);
175175   space.install_read_bank (0x0000, 0x7fff, "bank1");
trunk/src/mess/machine/sorcerer.c
r18027r18028
306306{
307307   device_t *cpu = image.device().machine().device("maincpu");
308308   UINT8 *RAM = image.device().machine().root_device().memregion(cpu->tag())->base();
309   address_space &space = *cpu->memory().space(AS_PROGRAM);
309   address_space &space = cpu->memory().space(AS_PROGRAM);
310310   UINT8 header[28];
311311   unsigned char s_byte;
312312
r18027r18028
360360
361361   UINT16 endmem = 0xbfff;
362362
363   address_space &space = *m_maincpu->space(AS_PROGRAM);
363   address_space &space = m_maincpu->space(AS_PROGRAM);
364364   /* configure RAM */
365365   switch (m_ram->size())
366366   {
r18027r18028
387387
388388   UINT16 endmem = 0xbbff;
389389
390   address_space &space = *m_maincpu->space(AS_PROGRAM);
390   address_space &space = m_maincpu->space(AS_PROGRAM);
391391   /* configure RAM */
392392   switch (m_ram->size())
393393   {
r18027r18028
407407
408408void sorcerer_state::machine_reset()
409409{
410   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
410   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
411411
412412   /* Initialize cassette interface */
413413   m_cass_data.output.length = 0;
trunk/src/mess/machine/x68k_scsiext.c
r18027r18028
6868   device_t* cpu = machine().device("maincpu");
6969   UINT8* ROM;
7070   astring temp;
71   address_space& space = *cpu->memory().space(AS_PROGRAM);
71   address_space& space = cpu->memory().space(AS_PROGRAM);
7272   m_slot = dynamic_cast<x68k_expansion_slot_device *>(owner());
7373   space.install_read_bank(0xea0020,0xea1fff,0,0,"scsi_ext");
7474   space.unmap_write(0xea0020,0xea1fff,0,0);
trunk/src/mess/machine/amigacrt.c
r18027r18028
9494{
9595   amiga_state *state = machine.driver_data<amiga_state>();
9696   /* get the cart's built-in ram */
97   UINT16 *ar_ram = (UINT16 *)machine.device("maincpu")->memory().space(AS_PROGRAM)->get_write_ptr(0x9fc000);
97   UINT16 *ar_ram = (UINT16 *)machine.device("maincpu")->memory().space(AS_PROGRAM).get_write_ptr(0x9fc000);
9898
9999   if ( ar_ram != NULL )
100100   {
r18027r18028
133133
134134static void amiga_ar1_check_overlay( running_machine &machine )
135135{
136   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x000000, 0x00007f, FUNC(amiga_ar1_chipmem_w));
136   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x000000, 0x00007f, FUNC(amiga_ar1_chipmem_w));
137137}
138138
139139static void amiga_ar1_init( running_machine &machine )
r18027r18028
153153   memset(ar_ram, 0, 0x4000);
154154
155155   /* Install ROM */
156   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xf00000, 0xf7ffff, "bank2");
157   machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xf00000, 0xf7ffff);
156   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xf00000, 0xf7ffff, "bank2");
157   machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xf00000, 0xf7ffff);
158158
159159   /* Install RAM */
160   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x9fc000, 0x9fffff, "bank3");
160   machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0x9fc000, 0x9fffff, "bank3");
161161
162162   /* Configure Banks */
163163   state->membank("bank2")->set_base(machine.root_device().memregion("user2")->base());
r18027r18028
269269   if ( ((pc >> 16) & 0xfe ) != 0x40 )
270270   {
271271      /* get the cart's built-in ram */
272      UINT16 *ar_ram = (UINT16 *)machine.device("maincpu")->memory().space(AS_PROGRAM)->get_write_ptr(0x440000);
272      UINT16 *ar_ram = (UINT16 *)machine.device("maincpu")->memory().space(AS_PROGRAM).get_write_ptr(0x440000);
273273
274274      if ( ar_ram != NULL )
275275      {
r18027r18028
283283      state->membank("bank1")->set_entry(2);
284284
285285      /* writes go to chipram */
286      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x000000, state->m_chip_ram.bytes() - 1, FUNC(amiga_ar23_chipmem_w));
286      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x000000, state->m_chip_ram.bytes() - 1, FUNC(amiga_ar23_chipmem_w));
287287
288288      /* trigger NMI irq */
289289      machine.device("maincpu")->execute().set_input_line(7, PULSE_LINE);
r18027r18028
341341static void amiga_ar23_check_overlay( running_machine &machine )
342342{
343343   amigacrt.ar23_mode = 3;
344   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x000000, 0x00000f, FUNC(amiga_ar23_chipmem_w));
344   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x000000, 0x00000f, FUNC(amiga_ar23_chipmem_w));
345345}
346346
347347static void amiga_ar23_init( running_machine &machine, int ar3 )
r18027r18028
367367   }
368368
369369   /* Install ROM */
370   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x400000, 0x400000+size, 0, mirror, "bank2");
371   machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x400000, 0x400000+size, 0, mirror);
370   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x400000, 0x400000+size, 0, mirror, "bank2");
371   machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x400000, 0x400000+size, 0, mirror);
372372
373373   /* Install RAM */
374   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x440000, 0x44ffff, "bank3");
375   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x440000, 0x44ffff, "bank3");
374   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x440000, 0x44ffff, "bank3");
375   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x440000, 0x44ffff, "bank3");
376376
377377   /* Install Custom chip monitor */
378//  machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xdff000, 0xdff1ff, FUNC(amiga_ar23_custom_r));
379//  machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xdff000, 0xdff1ff, FUNC(amiga_ar23_custom_w));
378//  machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xdff000, 0xdff1ff, FUNC(amiga_ar23_custom_r));
379//  machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xdff000, 0xdff1ff, FUNC(amiga_ar23_custom_w));
380380
381381   /* Install status/mode handlers */
382   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400007, 0, mirror, FUNC(amiga_ar23_mode_r));
383   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x400000, 0x400003, 0, mirror, FUNC(amiga_ar23_mode_w));
382   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400007, 0, mirror, FUNC(amiga_ar23_mode_r));
383   machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x400000, 0x400003, 0, mirror, FUNC(amiga_ar23_mode_w));
384384
385385   /* Configure Banks */
386386   state->membank("bank2")->set_base(machine.root_device().memregion("user2")->base());
trunk/src/mess/machine/osborne1.c
r18027r18028
426426void osborne1_state::machine_reset()
427427{
428428   int drive;
429   address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
429   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
430430   /* Initialize memory configuration */
431431   osborne1_bankswitch_w( space, 0x00, 0 );
432432
r18027r18028
524524   osborne1_state *state = machine().driver_data<osborne1_state>();
525525   /* Enable ROM and I/O when IRQ is acknowledged */
526526   UINT8 old_bankswitch = state->m_bankswitch;
527   address_space& space = *device().machine().device("maincpu")->memory().space(AS_PROGRAM);
527   address_space& space = device().machine().device("maincpu")->memory().space(AS_PROGRAM);
528528
529529   state->osborne1_bankswitch_w( space, 0, 0 );
530530   state->m_bankswitch = old_bankswitch;
trunk/src/mess/machine/amstrad.c
r18027r18028
11951195   }
11961196   else  // CPC+/GX4000
11971197   {
1198      //address_space &space = *state->m_maincpu->space(AS_PROGRAM);
1198      //address_space &space = state->m_maincpu->space(AS_PROGRAM);
11991199
12001200/*      if ( state->m_asic.enabled && ( state->m_asic.rmr2 & 0x18 ) == 0x18 )
12011201        {
r18027r18028
21742174static void amstrad_handle_snapshot(running_machine &machine, unsigned char *pSnapshot)
21752175{
21762176   amstrad_state *state = machine.driver_data<amstrad_state>();
2177   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
2177   address_space &space = state->m_maincpu->space(AS_PROGRAM);
21782178   mc6845_device *mc6845 = state->m_crtc;
21792179   device_t *ay8910 = state->m_ay;
21802180   int RegData;
r18027r18028
24572457static void update_psg(running_machine &machine)
24582458{
24592459   amstrad_state *state = machine.driver_data<amstrad_state>();
2460   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
2460   address_space &space = state->m_maincpu->space(AS_PROGRAM);
24612461   device_t *ay8910 = state->m_ay;
24622462   mc146818_device *rtc = state->m_rtc;
24632463
r18027r18028
28312831static void amstrad_common_init(running_machine &machine)
28322832{
28332833   amstrad_state *state = machine.driver_data<amstrad_state>();
2834   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
2834   address_space &space = state->m_maincpu->space(AS_PROGRAM);
28352835   device_t* romexp;
28362836   rom_image_device* romimage;
28372837   char str[20];
r18027r18028
29762976
29772977MACHINE_RESET_MEMBER(amstrad_state,plus)
29782978{
2979   address_space &space = *m_maincpu->space(AS_PROGRAM);
2979   address_space &space = m_maincpu->space(AS_PROGRAM);
29802980   int i;
29812981   UINT8 *rom = memregion("maincpu")->base();
29822982
r18027r18028
30263026
30273027MACHINE_RESET_MEMBER(amstrad_state,gx4000)
30283028{
3029   address_space &space = *m_maincpu->space(AS_PROGRAM);
3029   address_space &space = m_maincpu->space(AS_PROGRAM);
30303030   int i;
30313031   UINT8 *rom = memregion("maincpu")->base();
30323032
trunk/src/mess/machine/sms.c
r18027r18028
19401940   m_main_scr = machine().device("screen");
19411941   m_left_lcd = machine().device("left_lcd");
19421942   m_right_lcd = machine().device("right_lcd");
1943   m_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
1943   m_space = &machine().device("maincpu")->memory().space(AS_PROGRAM);
19441944
19451945   /* Check if lightgun has been chosen as input: if so, enable crosshair */
19461946   machine().scheduler().timer_set(attotime::zero, FUNC(lightgun_tick));
r18027r18028
19481948
19491949MACHINE_RESET_MEMBER(sms_state,sms)
19501950{
1951   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1951   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
19521952
19531953   m_ctrl_reg = 0xff;
19541954   if (m_has_fm)
trunk/src/mess/machine/llc.c
r18027r18028
152152
153153MACHINE_RESET_MEMBER(llc_state,llc2)
154154{
155   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
155   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
156156
157157   space.unmap_write(0x0000, 0x3fff);
158158   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
r18027r18028
170170
171171WRITE8_MEMBER(llc_state::llc2_rom_disable_w)
172172{
173   address_space *mem_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
173   address_space &mem_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
174174   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
175175
176   mem_space->install_write_bank(0x0000, 0xbfff, "bank1");
176   mem_space.install_write_bank(0x0000, 0xbfff, "bank1");
177177   membank("bank1")->set_base(ram);
178178
179   mem_space->install_write_bank(0x4000, 0x5fff, "bank2");
179   mem_space.install_write_bank(0x4000, 0x5fff, "bank2");
180180   membank("bank2")->set_base(ram + 0x4000);
181181
182   mem_space->install_write_bank(0x6000, 0xbfff, "bank3");
182   mem_space.install_write_bank(0x6000, 0xbfff, "bank3");
183183   membank("bank3")->set_base(ram + 0x6000);
184184
185   mem_space->install_write_bank(0xc000, 0xffff, "bank4");
185   mem_space.install_write_bank(0xc000, 0xffff, "bank4");
186186   membank("bank4")->set_base(ram + 0xc000);
187187
188188}
189189
190190WRITE8_MEMBER(llc_state::llc2_basic_enable_w)
191191{
192   address_space *mem_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
192   address_space &mem_space = machine().device("maincpu")->memory().space(AS_PROGRAM);
193193   if (data & 0x02)
194194   {
195      mem_space->unmap_write(0x4000, 0x5fff);
195      mem_space.unmap_write(0x4000, 0x5fff);
196196      membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000);
197197   }
198198   else
199199   {
200      mem_space->install_write_bank(0x4000, 0x5fff, "bank2");
200      mem_space.install_write_bank(0x4000, 0x5fff, "bank2");
201201      membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x4000);
202202   }
203203
trunk/src/mess/machine/kc_d004.c
r18027r18028
336336            if (data & 0x02)
337337            {
338338               for (int i=0; i<0xfc00; i++)
339                  m_cpu->space(AS_PROGRAM)->write_byte(i, 0);
339                  m_cpu->space(AS_PROGRAM).write_byte(i, 0);
340340
341341               m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
342342            }
trunk/src/mess/machine/ti85.c
r18027r18028
6060static void update_ti83p_memory (running_machine &machine)
6161{
6262   ti85_state *state = machine.driver_data<ti85_state>();
63   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
63   address_space &space = state->m_maincpu->space(AS_PROGRAM);
6464
6565   if (state->m_ti8x_memory_page_1 & 0x40)
6666   {
r18027r18028
8484static void update_ti86_memory (running_machine &machine)
8585{
8686   ti85_state *state = machine.driver_data<ti85_state>();
87   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
87   address_space &space = state->m_maincpu->space(AS_PROGRAM);
8888
8989   if (state->m_ti8x_memory_page_1 & 0x40)
9090   {
r18027r18028
112112
113113void ti85_state::machine_start()
114114{
115   address_space &space = *m_maincpu->space(AS_PROGRAM);
115   address_space &space = m_maincpu->space(AS_PROGRAM);
116116   m_bios = memregion("bios")->base();
117117
118118   m_timer_interrupt_mask = 0;
r18027r18028
149149
150150MACHINE_START_MEMBER(ti85_state,ti83p)
151151{
152   address_space &space = *m_maincpu->space(AS_PROGRAM);
152   address_space &space = m_maincpu->space(AS_PROGRAM);
153153   m_bios = memregion("bios")->base();
154154
155155   m_timer_interrupt_mask = 0;
r18027r18028
187187
188188MACHINE_START_MEMBER(ti85_state,ti86)
189189{
190   address_space &space = *m_maincpu->space(AS_PROGRAM);
190   address_space &space = m_maincpu->space(AS_PROGRAM);
191191   m_bios = memregion("bios")->base();
192192
193193   m_timer_interrupt_mask = 0;
r18027r18028
608608static void ti85_setup_snapshot (running_machine &machine, UINT8 * data)
609609{
610610   ti85_state *state = machine.driver_data<ti85_state>();
611   address_space &space = *state->m_maincpu->space(AS_PROGRAM);
611   address_space &space = state->m_maincpu->space(AS_PROGRAM);
612612   int i;
613613   unsigned char lo,hi;
614614   unsigned char * hdw = data + 0x8000 + 0x94;
trunk/src/mess/machine/galaxy.c
r18027r18028
155155
156156DRIVER_INIT_MEMBER(galaxy_state,galaxy)
157157{
158   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
158   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
159159   space.install_readwrite_bank( 0x2800, 0x2800 + machine().device<ram_device>(RAM_TAG)->size() - 1, "bank1");
160160   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
161161
r18027r18028
171171
172172MACHINE_RESET_MEMBER(galaxy_state,galaxy)
173173{
174   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
174   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
175175
176176   /* ROM 2 enable/disable */
177177   if (machine().root_device().ioport("ROM2")->read()) {
r18027r18028
196196MACHINE_RESET_MEMBER(galaxy_state,galaxyp)
197197{
198198   UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
199   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
199   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
200200
201201   machine().device("maincpu")->execute().set_irq_acknowledge_callback(galaxy_irq_callback);
202202
trunk/src/mess/machine/compis.c
r18027r18028
10531053
10541054WRITE16_MEMBER( compis_state::compis_i186_internal_port_w )
10551055{
1056   address_space *mem = m_maincpu->space(AS_PROGRAM);
1057   address_space *io = m_maincpu->space(AS_IO);
1056   address_space &mem = m_maincpu->space(AS_PROGRAM);
1057   address_space &io = m_maincpu->space(AS_IO);
10581058   int temp, which, data16 = data;
10591059
10601060   switch (offset)
r18027r18028
12751275         temp = (data16 & 0x0fff) << 8;
12761276         if (data16 & 0x1000)
12771277         {
1278            mem->install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(compis_state::compis_i186_internal_port_r), this));
1279            mem->install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(compis_state::compis_i186_internal_port_w), this));
1278            mem.install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(compis_state::compis_i186_internal_port_r), this));
1279            mem.install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(compis_state::compis_i186_internal_port_w), this));
12801280         }
12811281         else
12821282         {
12831283            temp &= 0xffff;
1284            io->install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(compis_state::compis_i186_internal_port_r), this));
1285            io->install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(compis_state::compis_i186_internal_port_w), this));
1284            io.install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(compis_state::compis_i186_internal_port_r), this));
1285            io.install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(compis_state::compis_i186_internal_port_w), this));
12861286         }
12871287/*          popmessage("Sound CPU reset");*/
12881288         break;
trunk/src/mess/machine/vtech2.c
r18027r18028
113113   logerror("laser_machine_init(): bank mask $%04X, video %d [$%05X]\n", state->m_laser_bank_mask, state->m_laser_video_bank, state->m_laser_video_bank * 0x04000);
114114
115115   for (i = 0; i < ARRAY_LENGTH(state->m_laser_bank); i++)
116      state->laser_bank_select_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), i, 0);
116      state->laser_bank_select_w(machine.device("maincpu")->memory().space(AS_PROGRAM), i, 0);
117117}
118118
119119void vtech2_state::machine_reset()
r18027r18028
155155        /* memory mapped I/O bank selected? */
156156      if (data == 2)
157157      {
158         machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_soft[offset].func, mra_bank_soft[offset].name);
159         machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_soft[offset].func, mwa_bank_soft[offset].name);
158         machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_soft[offset].func, mra_bank_soft[offset].name);
159         machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_soft[offset].func, mwa_bank_soft[offset].name);
160160      }
161161      else
162162      {
r18027r18028
169169            {
170170               logerror("select bank #%d VIDEO!\n", offset+1);
171171            }
172            machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_hard[offset]);
173            machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_hard[offset]);
172            machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mra_bank_hard[offset]);
173            machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(offset * 0x4000, offset * 0x4000 + 0x3fff, mwa_bank_hard[offset]);
174174
175175         }
176176         else
177177         {
178178            logerror("select bank #%d MASKED!\n", offset+1);
179            machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_readwrite(offset * 0x4000, offset * 0x4000 + 0x3fff);
179            machine().device("maincpu")->memory().space(AS_PROGRAM).nop_readwrite(offset * 0x4000, offset * 0x4000 + 0x3fff);
180180
181181         }
182182      }
trunk/src/mess/machine/zx.c
r18027r18028
4444
4545DRIVER_INIT_MEMBER(zx_state,zx)
4646{
47   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
47   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4848
4949   space.install_read_bank(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 1, "bank1");
5050   space.install_write_handler(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 1, write8_delegate(FUNC(zx_state::zx_ram_w),this));
r18027r18028
7474
7575void zx_state::machine_reset()
7676{
77   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(zx_state::zx_setdirect), this));
77   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::zx_setdirect), this));
7878   m_tape_bit = 0x80;
7979}
8080
8181MACHINE_RESET_MEMBER(zx_state,pow3000)
8282{
83   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pow3000_setdirect), this));
83   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pow3000_setdirect), this));
8484   m_tape_bit = 0x80;
8585}
8686
8787MACHINE_RESET_MEMBER(zx_state,pc8300)
8888{
89   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pc8300_setdirect), this));
89   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(zx_state::pc8300_setdirect), this));
9090   m_tape_bit = 0x80;
9191}
9292
r18027r18028
354354
355355WRITE8_MEMBER( zx_state::zx81_io_w )
356356{
357   address_space *mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
357   address_space &mem = machine().device("maincpu")->memory().space(AS_PROGRAM);
358358/* port F5 = unknown, pc8300/pow3000/lambda only
359359    F6 = unknown, pc8300/pow3000/lambda only
360360    FB = write data to printer, not emulated
r18027r18028
385385      zx_ula_bkgnd(1);
386386      if (m_ula_frame_vsync == 2)
387387      {
388         mem->device().execute().spin_until_time(machine().primary_screen->time_until_pos(height - 1, 0));
388         mem.device().execute().spin_until_time(machine().primary_screen->time_until_pos(height - 1, 0));
389389         m_ula_scanline_count = height - 1;
390390         logerror ("S: %d B: %d\n", machine().primary_screen->vpos(), machine().primary_screen->hpos());
391391      }
trunk/src/mess/machine/mac.c
r18027r18028
212212   offs_t memory_size, void *memory_data, int is_rom, const char *bank)
213213{
214214   mac_state *state = machine.driver_data<mac_state>();
215   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
215   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
216216   offs_t memory_mask;
217217
218218   memory_size = MIN(memory_size, (memory_end + 1 - memory_begin));
r18027r18028
410410   }
411411   else
412412   {
413      address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
413      address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
414414      UINT32 onboard_amt, simm_amt, simm_size;
415415      static const UINT32 simm_sizes[4] = { 0, 2*1024*1024, 4*1024*1024, 8*1024*1024 };
416416
r18027r18028
501501      }
502502      else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100) || (m_model == MODEL_MAC_IIVX) || (m_model == MODEL_MAC_IIFX))
503503      {
504         address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
504         address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
505505         space.unmap_write(0x000000, 0x9fffff, 0x9fffff, 0);
506506         mac_install_memory(machine(), 0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1");
507507      }
508508      else if ((m_model == MODEL_MAC_PB140) || (m_model == MODEL_MAC_PB160) || ((m_model >= MODEL_MAC_PBDUO_210) && (m_model <= MODEL_MAC_PBDUO_270c)))
509509      {
510         address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
510         address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
511511         space.unmap_write(0x000000, 0xffffff, 0xffffff, 0);
512512         mac_install_memory(machine(), 0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1");
513513      }
r18027r18028
18141814
18151815   if (m_model >= MODEL_MAC_POWERMAC_6100 && m_model <= MODEL_MAC_POWERMAC_8100)
18161816   {
1817      m_awacs->set_dma_base(*m_maincpu->space(AS_PROGRAM), 0x10000, 0x12000);
1817      m_awacs->set_dma_base(m_maincpu->space(AS_PROGRAM), 0x10000, 0x12000);
18181818   }
18191819
18201820   // start 60.15 Hz timer for most systems
r18027r18028
20992099       (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((mac->m_model >= MODEL_MAC_II) && (mac->m_model <= MODEL_MAC_SE30)) ||
21002100       (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100) || (model == MODEL_MAC_PB140) || (model == MODEL_MAC_PB160) || (model == MODEL_MAC_PBDUO_210) || (model >= MODEL_MAC_QUADRA_700 && model <= MODEL_MAC_QUADRA_800))
21012101   {
2102      machine.device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(mac_state::overlay_opbaseoverride), mac));
2102      machine.device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mac_state::overlay_opbaseoverride), mac));
21032103   }
21042104
21052105   /* setup keyboard */
trunk/src/mess/machine/amigacd.c
r18027r18028
8282      return;
8383
8484   /* otherwise, generate the IRQ */
85   amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
85   amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
8686}
8787
8888static TIMER_CALLBACK(dmac_dma_proc)
r18027r18028
389389
390390static void   dmac_install(running_machine &machine, offs_t base)
391391{
392   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
392   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
393393   space.install_legacy_read_handler(base, base + 0xFFFF, FUNC(amiga_dmac_r));
394394   space.install_legacy_write_handler(base, base + 0xFFFF, FUNC(amiga_dmac_w));
395395}
396396
397397static void   dmac_uninstall(running_machine &machine, offs_t base)
398398{
399   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
399   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
400400   space.unmap_readwrite(base, base + 0xFFFF);
401401}
402402
r18027r18028
457457
458458   if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
459459   {
460      amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
460      amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
461461   }
462462   else
463463   {
r18027r18028
474474   {
475475      if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
476476      {
477         amiga_custom_w(*device->machine().device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
477         amiga_custom_w(device->machine().device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
478478      }
479479      else
480480      {
trunk/src/mess/machine/msx.c
r18027r18028
634634      /* SIMPL emulation */
635635      device->machine().device<dac_device>("dac")->write_signed8(data);
636636   else
637      device->machine().device<centronics_device>("centronics")->write(*device->machine().memory().first_space(), 0, data);
637      device->machine().device<centronics_device>("centronics")->write(device->machine().driver_data()->generic_space(), 0, data);
638638}
639639
640640READ8_DEVICE_HANDLER( msx_printer_status_r )
trunk/src/mess/machine/mz700.c
r18027r18028
109109   m_ppi = machine().device<i8255_device>("ppi8255");
110110
111111   /* reset memory map to defaults */
112   mz700_bank_4_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
112   mz700_bank_4_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
113113}
114114
115115
r18027r18028
143143READ8_MEMBER(mz_state::mz800_bank_0_r)
144144{
145145   UINT8 *videoram = m_videoram;
146   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
146   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
147147
148148   /* switch in cgrom */
149   spc->install_read_bank(0x1000, 0x1fff, "bank2");
150   spc->nop_write(0x1000, 0x1fff);
149   spc.install_read_bank(0x1000, 0x1fff, "bank2");
150   spc.nop_write(0x1000, 0x1fff);
151151   membank("bank2")->set_base(machine().root_device().memregion("monitor")->base() + 0x1000);
152152
153153   if (m_mz700_mode)
154154   {
155155      /* cgram from 0xc000 to 0xcfff */
156      spc->install_read_bank(0xc000, 0xcfff, "bank6");
157      spc->install_write_handler(0xc000, 0xcfff, write8_delegate(FUNC(mz_state::mz800_cgram_w),this));
156      spc.install_read_bank(0xc000, 0xcfff, "bank6");
157      spc.install_write_handler(0xc000, 0xcfff, write8_delegate(FUNC(mz_state::mz800_cgram_w),this));
158158      membank("bank6")->set_base(m_cgram);
159159   }
160160   else
r18027r18028
162162      if (m_hires_mode)
163163      {
164164         /* vram from 0x8000 to 0xbfff */
165         spc->install_readwrite_bank(0x8000, 0xbfff, "bank4");
165         spc.install_readwrite_bank(0x8000, 0xbfff, "bank4");
166166         membank("bank4")->set_base(videoram);
167167      }
168168      else
169169      {
170170         /* vram from 0x8000 to 0x9fff */
171         spc->install_readwrite_bank(0x8000, 0x9fff, "bank4");
171         spc.install_readwrite_bank(0x8000, 0x9fff, "bank4");
172172         membank("bank4")->set_base(videoram);
173173
174174         /* ram from 0xa000 to 0xbfff */
175         spc->install_readwrite_bank(0xa000, 0xbfff, "bank5");
175         spc.install_readwrite_bank(0xa000, 0xbfff, "bank5");
176176         membank("bank5")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xa000);
177177      }
178178   }
r18027r18028
182182
183183WRITE8_MEMBER(mz_state::mz700_bank_0_w)
184184{
185   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
185   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
186186
187   spc->install_readwrite_bank(0x0000, 0x0fff, "bank1");
187   spc.install_readwrite_bank(0x0000, 0x0fff, "bank1");
188188   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
189189}
190190
191191WRITE8_MEMBER(mz_state::mz800_bank_0_w)
192192{
193   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
193   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
194194
195   spc->install_readwrite_bank(0x0000, 0x7fff, "bank1");
195   spc.install_readwrite_bank(0x0000, 0x7fff, "bank1");
196196   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
197197}
198198
199199READ8_MEMBER(mz_state::mz800_bank_1_r)
200200{
201   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
201   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
202202
203203   /* switch in ram from 0x1000 to 0x1fff */
204   spc->install_readwrite_bank(0x1000, 0x1fff, "bank2");
204   spc.install_readwrite_bank(0x1000, 0x1fff, "bank2");
205205   membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
206206
207207   if (m_mz700_mode)
208208   {
209209      /* ram from 0xc000 to 0xcfff */
210      spc->install_readwrite_bank(0xc000, 0xcfff, "bank6");
210      spc.install_readwrite_bank(0xc000, 0xcfff, "bank6");
211211      membank("bank6")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
212212   }
213213   else
214214   {
215215      /* ram from 0x8000 to 0xbfff */
216      spc->install_readwrite_bank(0x8000, 0xbfff, "bank4");
216      spc.install_readwrite_bank(0x8000, 0xbfff, "bank4");
217217      membank("bank4")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x8000);
218218   }
219219
r18027r18028
222222
223223WRITE8_MEMBER(mz_state::mz700_bank_1_w)
224224{
225   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
225   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
226226
227227   if (m_mz700_mode)
228228   {
229229      /* switch in ram when not locked */
230230      if (!m_mz700_ram_lock)
231231      {
232         spc->install_readwrite_bank(0xd000, 0xffff, "bank7");
232         spc.install_readwrite_bank(0xd000, 0xffff, "bank7");
233233         membank("bank7")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xd000);
234234         m_mz700_ram_vram = FALSE;
235235      }
r18027r18028
239239      /* switch in ram when not locked */
240240      if (!m_mz800_ram_lock)
241241      {
242         spc->install_readwrite_bank(0xe000, 0xffff, "bank8");
242         spc.install_readwrite_bank(0xe000, 0xffff, "bank8");
243243         membank("bank8")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xe000);
244244         m_mz800_ram_monitor = FALSE;
245245      }
r18027r18028
248248
249249WRITE8_MEMBER(mz_state::mz700_bank_2_w)
250250{
251   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
251   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
252252
253   spc->install_read_bank(0x0000, 0x0fff, "bank1");
254   spc->nop_write(0x0000, 0x0fff);
253   spc.install_read_bank(0x0000, 0x0fff, "bank1");
254   spc.nop_write(0x0000, 0x0fff);
255255   membank("bank1")->set_base(machine().root_device().memregion("monitor")->base());
256256}
257257
258258WRITE8_MEMBER(mz_state::mz700_bank_3_w)
259259{
260260   UINT8 *videoram = m_videoram;
261   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
261   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
262262
263263   if (m_mz700_mode)
264264   {
265265      if (!m_mz700_ram_lock)
266266      {
267267         /* switch in videoram */
268         spc->install_readwrite_bank(0xd000, 0xd7ff, "bank7");
268         spc.install_readwrite_bank(0xd000, 0xd7ff, "bank7");
269269         membank("bank7")->set_base(videoram);
270270
271271         /* switch in colorram */
272         spc->install_readwrite_bank(0xd800, 0xdfff, "bank9");
272         spc.install_readwrite_bank(0xd800, 0xdfff, "bank9");
273273         membank("bank9")->set_base(m_colorram);
274274
275275         m_mz700_ram_vram = TRUE;
r18027r18028
277277         /* switch in memory mapped i/o devices */
278278         if (m_mz700)
279279         {
280            spc->install_readwrite_handler(0xe000, 0xfff3, 0, 0x1ff0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi));
281            spc->install_legacy_readwrite_handler(*m_pit, 0xe004, 0xfff7, 0, 0x1ff0, FUNC(pit8253_r), FUNC(pit8253_w));
282            spc->install_readwrite_handler(0xe008, 0xfff8, 0, 0x1ff0, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this));
280            spc.install_readwrite_handler(0xe000, 0xfff3, 0, 0x1ff0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi));
281            spc.install_legacy_readwrite_handler(*m_pit, 0xe004, 0xfff7, 0, 0x1ff0, FUNC(pit8253_r), FUNC(pit8253_w));
282            spc.install_readwrite_handler(0xe008, 0xfff8, 0, 0x1ff0, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this));
283283         }
284284         else
285285         {
286            spc->install_readwrite_handler(0xe000, 0xe003, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi));
287            spc->install_legacy_readwrite_handler(*m_pit, 0xe004, 0xe007, FUNC(pit8253_r), FUNC(pit8253_w));
288            spc->install_readwrite_handler(0xe008, 0xe008, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this));
286            spc.install_readwrite_handler(0xe000, 0xe003, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi));
287            spc.install_legacy_readwrite_handler(*m_pit, 0xe004, 0xe007, FUNC(pit8253_r), FUNC(pit8253_w));
288            spc.install_readwrite_handler(0xe008, 0xe008, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this));
289289         }
290290      }
291291   }
r18027r18028
294294      if (!m_mz800_ram_lock)
295295      {
296296         /* switch in mz800 monitor rom if not locked */
297         spc->install_read_bank(0xe000, 0xffff, "bank8");
298         spc->nop_write(0xe000, 0xffff);
297         spc.install_read_bank(0xe000, 0xffff, "bank8");
298         spc.nop_write(0xe000, 0xffff);
299299         membank("bank8")->set_base(machine().root_device().memregion("monitor")->base() + 0x2000);
300300         m_mz800_ram_monitor = TRUE;
301301      }
r18027r18028
305305WRITE8_MEMBER(mz_state::mz700_bank_4_w)
306306{
307307   UINT8 *videoram = m_videoram;
308   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
308   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
309309
310310   if (m_mz700_mode)
311311   {
r18027r18028
314314      mz700_bank_3_w(space, 0, 0);   /* switch in videoram, colorram, and mmio */
315315
316316      /* rest is ram is always ram in mz700 mode */
317      spc->install_readwrite_bank(0x1000, 0xcfff, "bank2");
317      spc.install_readwrite_bank(0x1000, 0xcfff, "bank2");
318318      membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
319319   }
320320   else
321321   {
322322      /* monitor rom and cgrom */
323      spc->install_read_bank(0x0000, 0x1fff, "bank1");
324      spc->nop_write(0x0000, 0x1fff);
323      spc.install_read_bank(0x0000, 0x1fff, "bank1");
324      spc.nop_write(0x0000, 0x1fff);
325325      membank("bank1")->set_base(machine().root_device().memregion("monitor")->base());
326326
327327      /* ram from 0x2000 to 0x7fff */
328      spc->install_readwrite_bank(0x2000, 0x7fff, "bank3");
328      spc.install_readwrite_bank(0x2000, 0x7fff, "bank3");
329329      membank("bank3")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
330330
331331      if (m_hires_mode)
332332      {
333333         /* vram from 0x8000 to 0xbfff */
334         spc->install_readwrite_bank(0x8000, 0xbfff, "bank4");
334         spc.install_readwrite_bank(0x8000, 0xbfff, "bank4");
335335         membank("bank4")->set_base(videoram);
336336      }
337337      else
338338      {
339339         /* vram from 0x8000 to 0x9fff */
340         spc->install_readwrite_bank(0x8000, 0x9fff, "bank4");
340         spc.install_readwrite_bank(0x8000, 0x9fff, "bank4");
341341         membank("bank4")->set_base(videoram);
342342
343343         /* ram from 0xa000 to 0xbfff */
344         spc->install_readwrite_bank(0xa000, 0xbfff, "bank5");
344         spc.install_readwrite_bank(0xa000, 0xbfff, "bank5");
345345         membank("bank5")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xa000);
346346      }
347347
348348      /* ram from 0xc000 to 0xdfff */
349      spc->install_readwrite_bank(0xc000, 0xdfff, "bank6");
349      spc.install_readwrite_bank(0xc000, 0xdfff, "bank6");
350350      membank("bank6")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000);
351351
352352      /* mz800 monitor rom from 0xe000 to 0xffff */
353      spc->install_read_bank(0xe000, 0xffff, "bank8");
354      spc->nop_write(0xe000, 0xffff);
353      spc.install_read_bank(0xe000, 0xffff, "bank8");
354      spc.nop_write(0xe000, 0xffff);
355355      membank("bank8")->set_base(machine().root_device().memregion("monitor")->base() + 0x2000);
356356      m_mz800_ram_monitor = TRUE;
357357
r18027r18028
361361
362362WRITE8_MEMBER(mz_state::mz700_bank_5_w)
363363{
364   address_space *spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
364   address_space &spc = machine().device("maincpu")->memory().space(AS_PROGRAM);
365365
366366   if (m_mz700_mode)
367367   {
368368      /* prevent access from 0xd000 to 0xffff */
369369      m_mz700_ram_lock = TRUE;
370      spc->nop_readwrite(0xd000, 0xffff);
370      spc.nop_readwrite(0xd000, 0xffff);
371371   }
372372   else
373373   {
374374      /* prevent access from 0xe000 to 0xffff */
375375      m_mz800_ram_lock = TRUE;
376      spc->nop_readwrite(0xe000, 0xffff);
376      spc.nop_readwrite(0xe000, 0xffff);
377377   }
378378}
379379
trunk/src/mess/machine/lisa.c
r18027r18028
237237{
238238   lisa_state *state = machine.driver_data<lisa_state>();
239239   via6522_device *via_0 = machine.device<via6522_device>("via6522_0");
240   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
240   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
241241
242242   if ((! state->m_hold_COPS_data) && state->m_fifo_size && (! state->m_COPS_Ready))
243243   {
r18027r18028
427427   lisa_state *state = machine.driver_data<lisa_state>();
428428   int command;
429429   via6522_device *via_0 = machine.device<via6522_device>("via6522_0");
430   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
430   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
431431
432432   state->m_COPS_Ready = 0;
433433
r18027r18028
10431043   m_rom_ptr = machine().root_device().memregion("maincpu")->base() + ROM_OFFSET;
10441044   m_videoROM_ptr = memregion("gfx1")->base();
10451045
1046//  machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate_create_static(lisa_OPbaseoverride, *machine()));
1046//  machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate_create_static(lisa_OPbaseoverride, *machine()));
10471047//  m68k_set_reset_callback(machine().device("maincpu"), /*lisa_reset_instr_callback*/NULL);
10481048
10491049   /* init MMU */
trunk/src/mess/machine/cgenie.c
r18027r18028
4747
4848void cgenie_state::machine_reset()
4949{
50   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
50   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
5151   device_t *ay8910 = machine().device("ay8910");
5252   UINT8 *ROM = memregion("maincpu")->base();
5353
r18027r18028
124124
125125void cgenie_state::machine_start()
126126{
127   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
127   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
128128   UINT8 *gfx = memregion("gfx2")->base();
129129   int i;
130130
r18027r18028
597597      m_tv_mode = ioport("DSW0")->read() & 0x10;
598598      /* force setting of background color */
599599      m_port_ff ^= FF_BGD0;
600      cgenie_port_ff_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 0, m_port_ff ^ FF_BGD0);
600      cgenie_port_ff_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, m_port_ff ^ FF_BGD0);
601601   }
602602}
603603
trunk/src/mess/machine/lynx.c
r18027r18028
703703
704704   int i; int colors;
705705
706   state->m_blitter.mem = (UINT8*)machine.device("maincpu")->memory().space(AS_PROGRAM)->get_read_ptr(0x0000);
706   state->m_blitter.mem = (UINT8*)machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(0x0000);
707707
708708   state->m_blitter.busy = 1; // blitter working
709709   state->m_blitter.memory_accesses = 0;
r18027r18028
19271927static void lynx_reset(running_machine &machine)
19281928{
19291929   lynx_state *state = machine.driver_data<lynx_state>();
1930   state->lynx_memory_config_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
1930   state->lynx_memory_config_w(machine.device("maincpu")->memory().space(AS_PROGRAM), 0, 0);
19311931
19321932   machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
19331933   machine.device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE);
r18027r18028
19591959
19601960static void lynx_postload(lynx_state *state)
19611961{
1962   state->lynx_memory_config_w( *state->machine().device("maincpu")->memory().space(AS_PROGRAM), 0, state->m_memory_config);
1962   state->lynx_memory_config_w( state->machine().device("maincpu")->memory().space(AS_PROGRAM), 0, state->m_memory_config);
19631963}
19641964
19651965void lynx_state::machine_start()
trunk/src/mess/machine/isa.c
r18027r18028
202202void isa8_device::install_space(address_spacenum spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_space_func rhandler, const char* rhandler_name, write8_space_func whandler, const char *whandler_name)
203203{
204204   int buswidth = m_maincpu->space_config(spacenum)->m_databus_width;
205   address_space &space = m_maincpu->space(spacenum);
205206   switch(buswidth)
206207   {
207208      case 8:
208         m_maincpu->space(spacenum)->install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0);
209         space.install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0);
209210         break;
210211      case 16:
211         m_maincpu->space(spacenum)->install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
212         space.install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
212213         break;
213214      case 32:
214215         if ((start % 4) == 0) {
215216            if ((end-start)==1) {
216               m_maincpu->space(spacenum)->install_legacy_readwrite_handler(start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0x0000ffff);
217               space.install_legacy_readwrite_handler(start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0x0000ffff);
217218            } else {
218               m_maincpu->space(spacenum)->install_legacy_readwrite_handler(start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffffffff);
219               space.install_legacy_readwrite_handler(start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffffffff);
219220            }
220221         } else {
221222            // we handle just misalligned by 2
222            m_maincpu->space(spacenum)->install_legacy_readwrite_handler(start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff0000);
223            space.install_legacy_readwrite_handler(start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff0000);
223224         }
224225         break;
225226      default:
r18027r18028
232233void isa8_device::install_space(address_spacenum spacenum, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler)
233234{
234235   int buswidth = m_maincpu->space_config(spacenum)->m_databus_width;
236   address_space &space = m_maincpu->space(spacenum);
235237   switch(buswidth)
236238   {
237239      case 8:
238         m_maincpu->space(spacenum)->install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0);
240         space.install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0);
239241         break;
240242      case 16:
241         m_maincpu->space(spacenum)->install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff);
243         space.install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff);
242244         break;
243245      case 32:
244246         if ((start % 4) == 0) {
245247            if ((end-start)==1) {
246               m_maincpu->space(spacenum)->install_readwrite_handler(start, end+2, mask, mirror, rhandler, whandler, 0x0000ffff);
248               space.install_readwrite_handler(start, end+2, mask, mirror, rhandler, whandler, 0x0000ffff);
247249            } else {
248               m_maincpu->space(spacenum)->install_readwrite_handler(start, end,   mask, mirror, rhandler, whandler, 0xffffffff);
250               space.install_readwrite_handler(start, end,   mask, mirror, rhandler, whandler, 0xffffffff);
249251            }
250252         } else {
251253            // we handle just misalligned by 2
252            m_maincpu->space(spacenum)->install_readwrite_handler(start-2, end, mask, mirror, rhandler, whandler, 0xffff0000);
254            space.install_readwrite_handler(start-2, end, mask, mirror, rhandler, whandler, 0xffff0000);
253255         }
254256         break;
255257      default:
r18027r18028
262264void isa8_device::install_space(address_spacenum spacenum, device_t *dev, offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_device_func rhandler, const char* rhandler_name, write8_device_func whandler, const char *whandler_name)
263265{
264266   int buswidth = m_maincpu->space_config(spacenum)->m_databus_width;
267   address_space &space = m_maincpu->space(spacenum);
265268   switch(buswidth)
266269   {
267270      case 8:
268         m_maincpu->space(spacenum)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0);
271         space.install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0);
269272         break;
270273      case 16:
271         m_maincpu->space(spacenum)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
274         space.install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff);
272275         break;
273276      case 32:
274277         if ((start % 4) == 0) {
275278            if ((end-start)==1) {
276               m_maincpu->space(spacenum)->install_legacy_readwrite_handler(*dev, start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0x0000ffff);
279               space.install_legacy_readwrite_handler(*dev, start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0x0000ffff);
277280            } else {
278               m_maincpu->space(spacenum)->install_legacy_readwrite_handler(*dev, start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffffffff);
281               space.install_legacy_readwrite_handler(*dev, start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffffffff);
279282            }
280283         } else {
281284            // we handle just misalligned by 2
282            m_maincpu->space(spacenum)->install_legacy_readwrite_handler(*dev, start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff0000);
285            space.install_legacy_readwrite_handler(*dev, start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff0000);
283286         }
284287         break;
285288      default:
r18027r18028
327330
328331void isa8_device::install_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror, const char *tag, UINT8 *data)
329332{
330   address_space &space = *m_maincpu->space(AS_PROGRAM);
333   address_space &space = m_maincpu->space(AS_PROGRAM);
331334   space.install_readwrite_bank(start, end, mask, mirror, tag );
332335   machine().root_device().membank(tag)->set_base(data);
333336}
334337
335338void isa8_device::unmap_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror)
336339{
337   address_space &space = *m_maincpu->space(AS_PROGRAM);
340   address_space &space = m_maincpu->space(AS_PROGRAM);
338341   space.unmap_readwrite(start, end, mask, mirror);
339342}
340343
r18027r18028
346349      UINT8 *dest = machine().root_device().memregion("isa")->base() + start - 0xc0000;
347350      memcpy(dest,src, end - start + 1);
348351   } else {
349      address_space &space = *m_maincpu->space(AS_PROGRAM);
352      address_space &space = m_maincpu->space(AS_PROGRAM);
350353      space.install_read_bank(start, end, mask, mirror, tag);
351354      space.unmap_write(start, end, mask, mirror);
352355      machine().root_device().membank(tag)->set_base(machine().root_device().memregion(dev->subtag(tempstring, region))->base());
r18027r18028
355358
356359void isa8_device::unmap_rom(offs_t start, offs_t end, offs_t mask, offs_t mirror)
357360{
358   address_space &space = *m_maincpu->space(AS_PROGRAM);
361   address_space &space = m_maincpu->space(AS_PROGRAM);
359362   space.unmap_read(start, end, mask, mirror);
360363}
361364
362365bool isa8_device::is_option_rom_space_available(offs_t start, int size)
363366{
364367   m_maincpu = machine().device<cpu_device>(m_cputag);
365   address_space &space = *m_maincpu->space(AS_PROGRAM);
368   address_space &space = m_maincpu->space(AS_PROGRAM);
366369   for(int i = 0; i < size; i += 4096) // 4KB granularity should be enough
367370      if(space.get_read_ptr(start + i)) return false;
368371   return true;
r18027r18028
548551   switch(buswidth)
549552   {
550553      case 16:
551         m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0);
554         m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0);
552555         break;
553556      case 32:
554557         if ((start % 4) == 0) {
555558            if ((end-start)==1) {
556               m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0x0000ffff);
559               m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0x0000ffff);
557560            } else {
558               m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(*dev, start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffffffff);
561               m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffffffff);
559562            }
560563         } else {
561564            // we handle just misalligned by 2
562            m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(*dev, start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff0000);
565            m_maincpu->space(AS_IO).install_legacy_readwrite_handler(*dev, start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name,0xffff0000);
563566         }
564567
565568         break;
r18027r18028
575578   switch(buswidth)
576579   {
577580      case 16:
578         m_maincpu->space(AS_IO)->install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0);
581         m_maincpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0);
579582         break;
580583      case 32:
581         m_maincpu->space(AS_IO)->install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff);
584         m_maincpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff);
582585         if ((start % 4) == 0) {
583586            if ((end-start)==1) {
584               m_maincpu->space(AS_IO)->install_readwrite_handler(start, end+2, mask, mirror, rhandler, whandler, 0x0000ffff);
587               m_maincpu->space(AS_IO).install_readwrite_handler(start, end+2, mask, mirror, rhandler, whandler, 0x0000ffff);
585588            } else {
586               m_maincpu->space(AS_IO)->install_readwrite_handler(start, end,   mask, mirror, rhandler, whandler, 0xffffffff);
589               m_maincpu->space(AS_IO).install_readwrite_handler(start, end,   mask, mirror, rhandler, whandler, 0xffffffff);
587590            }
588591         } else {
589592            // we handle just misalligned by 2
590            m_maincpu->space(AS_IO)->install_readwrite_handler(start-2, end, mask, mirror, rhandler, whandler, 0xffff0000);
593            m_maincpu->space(AS_IO).install_readwrite_handler(start-2, end, mask, mirror, rhandler, whandler, 0xffff0000);
591594         }
592595
593596         break;
r18027r18028
603606   switch(buswidth)
604607   {
605608      case 16:
606         m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0);
609         m_maincpu->space(AS_IO).install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0);
607610         break;
608611      case 32:
609         m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffffffff);
612         m_maincpu->space(AS_IO).install_legacy_readwrite_handler(start, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffffffff);
610613         if ((start % 4) == 0) {
611614            if ((end-start)==1) {
612               m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0x0000ffff);
615               m_maincpu->space(AS_IO).install_legacy_readwrite_handler(start, end+2, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0x0000ffff);
613616            } else {
614               m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffffffff);
617               m_maincpu->space(AS_IO).install_legacy_readwrite_handler(start, end,   mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffffffff);
615618            }
616619         } else {
617620            // we handle just misalligned by 2
618            m_maincpu->space(AS_IO)->install_legacy_readwrite_handler(start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffff0000);
621            m_maincpu->space(AS_IO).install_legacy_readwrite_handler(start-2, end, mask, mirror, rhandler, rhandler_name, whandler, whandler_name, 0xffff0000);
619622         }
620623
621624         break;
trunk/src/mess/machine/i82439tx.c
r18027r18028
287287   device_t *cpu = machine().device(m_cputag);
288288   assert(cpu != NULL);
289289
290   m_space = cpu->memory().space(AS_PROGRAM);
290   m_space = &cpu->memory().space(AS_PROGRAM);
291291
292292   /* get rom region */
293293   m_rom = machine().root_device().memregion(m_rom_region)->base();
trunk/src/mess/machine/lviv.c
r18027r18028
172172
173173WRITE8_MEMBER(lviv_state::lviv_io_w)
174174{
175   address_space *cpuspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
175   address_space &cpuspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
176176   if (m_startup_mem_map)
177177   {
178178      UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
179179
180180      m_startup_mem_map = 0;
181181
182      cpuspace->install_write_bank(0x0000, 0x3fff, "bank1");
183      cpuspace->install_write_bank(0x4000, 0x7fff, "bank2");
184      cpuspace->install_write_bank(0x8000, 0xbfff, "bank3");
185      cpuspace->unmap_write(0xC000, 0xffff);
182      cpuspace.install_write_bank(0x0000, 0x3fff, "bank1");
183      cpuspace.install_write_bank(0x4000, 0x7fff, "bank2");
184      cpuspace.install_write_bank(0x8000, 0xbfff, "bank3");
185      cpuspace.unmap_write(0xC000, 0xffff);
186186
187187      membank("bank1")->set_base(ram);
188188      membank("bank2")->set_base(ram + 0x4000);
r18027r18028
232232
233233void lviv_state::machine_reset()
234234{
235   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
235   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
236236   UINT8 *mem;
237237
238238   space.set_direct_update_handler(direct_update_delegate(FUNC(lviv_state::lviv_directoverride), this));
trunk/src/mess/machine/mbc55x.c
r18027r18028
339339static void set_ram_size(running_machine &machine)
340340{
341341   mbc55x_state   *state      = machine.driver_data<mbc55x_state>();
342   address_space   &space      = *machine.device( MAINCPU_TAG)->memory().space( AS_PROGRAM );
342   address_space   &space      = machine.device( MAINCPU_TAG)->memory().space( AS_PROGRAM );
343343   int          ramsize    = state->m_ram->size();
344344   int          nobanks      = ramsize / RAM_BANK_SIZE;
345345   char         bank[10];
r18027r18028
434434static int instruction_hook(device_t &device, offs_t curpc)
435435{
436436   mbc55x_state   *state = device.machine().driver_data<mbc55x_state>();
437   address_space   &space = *device.memory().space(AS_PROGRAM);
437   address_space   &space = device.memory().space(AS_PROGRAM);
438438   UINT8         *addr_ptr;
439439
440440   addr_ptr = (UINT8*)space.get_read_ptr(curpc);
trunk/src/mess/machine/southbridge.c
r18027r18028
194194
195195void southbridge_device::device_start()
196196{
197   address_space* spaceio = machine().device(":maincpu")->memory().space(AS_IO);
197   address_space& spaceio = machine().device(":maincpu")->memory().space(AS_IO);
198198
199   spaceio->install_legacy_readwrite_handler(*m_dma8237_1, 0x0000, 0x001f, FUNC(i8237_r), FUNC(i8237_w), 0xffffffff);
200   spaceio->install_legacy_readwrite_handler(*m_pic8259_master, 0x0020, 0x003f, FUNC(pic8259_r), FUNC(pic8259_w), 0xffffffff);
201   spaceio->install_legacy_readwrite_handler(*m_pit8254, 0x0040, 0x005f, FUNC(pit8253_r), FUNC(pit8253_w), 0xffffffff);
202   spaceio->install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(southbridge_device::at_keybc_r),this), write8_delegate(FUNC(southbridge_device::at_keybc_w),this), 0xffffffff);
203   spaceio->install_readwrite_handler(0x0064, 0x0067, read8_delegate(FUNC(at_keyboard_controller_device::status_r),&(*m_keybc)), write8_delegate(FUNC(at_keyboard_controller_device::command_w),&(*m_keybc)), 0xffffffff);
204   spaceio->install_readwrite_handler(0x0070, 0x007f, read8_delegate(FUNC(mc146818_device::read),&(*m_mc146818)), write8_delegate(FUNC(mc146818_device::write),&(*m_mc146818)), 0xffffffff);
205   spaceio->install_readwrite_handler(0x0080, 0x009f, read8_delegate(FUNC(southbridge_device::at_page8_r),this), write8_delegate(FUNC(southbridge_device::at_page8_w),this), 0xffffffff);
206   spaceio->install_legacy_readwrite_handler(*m_pic8259_slave, 0x00a0, 0x00bf, FUNC(pic8259_r), FUNC(pic8259_w), 0xffffffff);
207   spaceio->install_readwrite_handler(0x00c0, 0x00df, read8_delegate(FUNC(southbridge_device::at_dma8237_2_r),this), write8_delegate(FUNC(southbridge_device::at_dma8237_2_w),this), 0xffffffff);
208   spaceio->nop_readwrite(0x00e0, 0x00ef);
199   spaceio.install_legacy_readwrite_handler(*m_dma8237_1, 0x0000, 0x001f, FUNC(i8237_r), FUNC(i8237_w), 0xffffffff);
200   spaceio.install_legacy_readwrite_handler(*m_pic8259_master, 0x0020, 0x003f, FUNC(pic8259_r), FUNC(pic8259_w), 0xffffffff);
201   spaceio.install_legacy_readwrite_handler(*m_pit8254, 0x0040, 0x005f, FUNC(pit8253_r), FUNC(pit8253_w), 0xffffffff);
202   spaceio.install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(southbridge_device::at_keybc_r),this), write8_delegate(FUNC(southbridge_device::at_keybc_w),this), 0xffffffff);
203   spaceio.install_readwrite_handler(0x0064, 0x0067, read8_delegate(FUNC(at_keyboard_controller_device::status_r),&(*m_keybc)), write8_delegate(FUNC(at_keyboard_controller_device::command_w),&(*m_keybc)), 0xffffffff);
204   spaceio.install_readwrite_handler(0x0070, 0x007f, read8_delegate(FUNC(mc146818_device::read),&(*m_mc146818)), write8_delegate(FUNC(mc146818_device::write),&(*m_mc146818)), 0xffffffff);
205   spaceio.install_readwrite_handler(0x0080, 0x009f, read8_delegate(FUNC(southbridge_device::at_page8_r),this), write8_delegate(FUNC(southbridge_device::at_page8_w),this), 0xffffffff);
206   spaceio.install_legacy_readwrite_handler(*m_pic8259_slave, 0x00a0, 0x00bf, FUNC(pic8259_r), FUNC(pic8259_w), 0xffffffff);
207   spaceio.install_readwrite_handler(0x00c0, 0x00df, read8_delegate(FUNC(southbridge_device::at_dma8237_2_r),this), write8_delegate(FUNC(southbridge_device::at_dma8237_2_w),this), 0xffffffff);
208   spaceio.nop_readwrite(0x00e0, 0x00ef);
209209
210210
211211   m_at_offset1 = 0xff;
trunk/src/mess/machine/apple1.c
r18027r18028
143143
144144DRIVER_INIT_MEMBER(apple1_state,apple1)
145145{
146   address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
146   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
147147   /* Set up the handlers for MESS's dynamically-sized RAM. */
148148   space.install_readwrite_bank(0x0000, machine().device<ram_device>(RAM_TAG)->size() - 1, "bank1");
149149   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
r18027r18028
255255   for (addr = start_addr, snapptr = snapbuf + SNAP_HEADER_LEN;
256256       addr <= end_addr;
257257       addr++, snapptr++)
258      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(addr, *snapptr);
258      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(addr, *snapptr);
259259
260260
261261   return IMAGE_INIT_PASS;
trunk/src/mess/machine/mtx.c
r18027r18028
7474
7575    */
7676   mtx_state *state = machine.driver_data<mtx_state>();
77   address_space *program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM);
77   address_space &program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM);
7878   ram_device *messram = machine.device<ram_device>(RAM_TAG);
7979
8080//  UINT8 cbm_mode = data >> 7 & 0x01;
r18027r18028
8787   /* set ram bank, for invalid pages a nop-handler will be installed */
8888   if (ram_page >= messram->size()/0x8000)
8989   {
90      program->nop_readwrite(0x4000, 0x7fff);
91      program->nop_readwrite(0x8000, 0xbfff);
90      program.nop_readwrite(0x4000, 0x7fff);
91      program.nop_readwrite(0x8000, 0xbfff);
9292   }
9393   else if (ram_page + 1 == messram->size()/0x8000)
9494   {
95      program->nop_readwrite(0x4000, 0x7fff);
96      program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
95      program.nop_readwrite(0x4000, 0x7fff);
96      program.install_readwrite_bank(0x8000, 0xbfff, "bank4");
9797      state->membank("bank4")->set_entry(ram_page);
9898   }
9999   else
100100   {
101      program->install_readwrite_bank(0x4000, 0x7fff, "bank3");
102      program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
101      program.install_readwrite_bank(0x4000, 0x7fff, "bank3");
102      program.install_readwrite_bank(0x8000, 0xbfff, "bank4");
103103      state->membank("bank3")->set_entry(ram_page);
104104      state->membank("bank4")->set_entry(ram_page);
105105   }
r18027r18028
333333
334334SNAPSHOT_LOAD( mtx )
335335{
336   address_space *program = image.device().machine().device(Z80_TAG)->memory().space(AS_PROGRAM);
336   address_space &program = image.device().machine().device(Z80_TAG)->memory().space(AS_PROGRAM);
337337
338338   UINT8 header[18];
339339   UINT16 addr;
r18027r18028
345345   {
346346      /* long header */
347347      addr = pick_integer_le(header, 16, 2);
348      void *ptr = program->get_write_ptr(addr);
348      void *ptr = program.get_write_ptr(addr);
349349      image.fread( ptr, 599);
350      ptr = program->get_write_ptr(0xc000);
350      ptr = program.get_write_ptr(0xc000);
351351      image.fread( ptr, snapshot_size - 599 - 18);
352352   }
353353   else
r18027r18028
355355      /* short header */
356356      addr = pick_integer_le(header, 0, 2);
357357      image.fseek(4, SEEK_SET);
358      void *ptr = program->get_write_ptr(addr);
358      void *ptr = program.get_write_ptr(addr);
359359      image.fread( ptr, 599);
360      ptr = program->get_write_ptr(0xc000);
360      ptr = program.get_write_ptr(0xc000);
361361      image.fread( ptr, snapshot_size - 599 - 4);
362362   }
363363
trunk/src/mess/machine/special.c
r18027r18028
136136
137137void special_state::specimx_set_bank(offs_t i, UINT8 data)
138138{
139   address_space &space = *m_maincpu->space(AS_PROGRAM);
139   address_space &space = m_maincpu->space(AS_PROGRAM);
140140   UINT8 *ram = m_ram->pointer();
141141
142142   space.install_write_bank(0xc000, 0xffbf, "bank3");
r18027r18028
273273   UINT8 bank4 = (m_RR_register >> 6) & 3;
274274   UINT8 *mem = memregion("maincpu")->base();
275275   UINT8 *ram = m_ram->pointer();
276   address_space &space = *m_maincpu->space(AS_PROGRAM);
276   address_space &space = m_maincpu->space(AS_PROGRAM);
277277
278278   space.install_write_bank(0x0000, 0x3fff, "bank1");
279279   space.install_write_bank(0x4000, 0x8fff, "bank2");
trunk/src/mess/machine/rmnimbus.c
r18027r18028
729729{
730730   rmnimbus_state *state = machine.driver_data<rmnimbus_state>();
731731   struct dma_state *dma = &state->m_i186.dma[which];
732   address_space *memory_space   = machine.device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
733   address_space *io_space       = machine.device(MAINCPU_TAG)->memory().space(AS_IO);
732   address_space &memory_space   = machine.device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
733   address_space &io_space       = machine.device(MAINCPU_TAG)->memory().space(AS_IO);
734734
735    address_space *src_space;
736    address_space *dest_space;
737
738735    UINT16  dma_word;
739736    UINT8   dma_byte;
740737    UINT8   incdec_size;
r18027r18028
750747        return;
751748    }
752749
753    if(dma->control & DEST_MIO)
754        dest_space=memory_space;
755    else
756        dest_space=io_space;
750   address_space &dest_space = (dma->control & DEST_MIO) ? memory_space : io_space;
751    address_space &src_space = (dma->control & SRC_MIO) ? memory_space : io_space;
757752
758    if(dma->control & SRC_MIO)
759        src_space=memory_space;
760    else
761        src_space=io_space;
762
763753    // Do the transfer
764754    if(dma->control & BYTE_WORD)
765755    {
766        dma_word=src_space->read_word(dma->source);
767        dest_space->write_word(dma->dest,dma_word);
756        dma_word=src_space.read_word(dma->source);
757        dest_space.write_word(dma->dest,dma_word);
768758        incdec_size=2;
769759    }
770760    else
771761    {
772        dma_byte=src_space->read_byte(dma->source);
773        dest_space->write_byte(dma->dest,dma_byte);
762        dma_byte=src_space.read_byte(dma->source);
763        dest_space.write_byte(dma->dest,dma_byte);
774764        incdec_size=1;
775765    }
776766
r18027r18028
12321222         temp = (data16 & 0x0fff) << 8;
12331223         if (data16 & 0x1000)
12341224         {
1235            machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM)->install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_r),this));
1236            machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM)->install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_w),this));
1225            machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM).install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_r),this));
1226            machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM).install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_w),this));
12371227         }
12381228         else
12391229         {
12401230            temp &= 0xffff;
1241            machine().device(MAINCPU_TAG)->memory().space(AS_IO)->install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_r),this));
1242            machine().device(MAINCPU_TAG)->memory().space(AS_IO)->install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_w),this));
1231            machine().device(MAINCPU_TAG)->memory().space(AS_IO).install_read_handler(temp, temp + 0xff, read16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_r),this));
1232            machine().device(MAINCPU_TAG)->memory().space(AS_IO).install_write_handler(temp, temp + 0xff, write16_delegate(FUNC(rmnimbus_state::nimbus_i186_internal_port_w),this));
12431233         }
12441234         break;
12451235
r18027r18028
13461336static int instruction_hook(device_t &device, offs_t curpc)
13471337{
13481338   rmnimbus_state   *state = device.machine().driver_data<rmnimbus_state>();
1349    address_space   &space = *device.memory().space(AS_PROGRAM);
1339    address_space   &space = device.memory().space(AS_PROGRAM);
13501340    UINT8           *addr_ptr;
13511341
13521342    addr_ptr = (UINT8*)space.get_read_ptr(curpc);
r18027r18028
17251715
17261716static void decode_dssi_generic(device_t *device,UINT16  ds, UINT16 si, UINT8 raw_flag)
17271717{
1728   address_space &space = *device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
1718   address_space &space = device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
17291719    UINT16  *params;
17301720   int      count;
17311721
r18027r18028
17431733
17441734static void decode_dssi_f_fill_area(device_t *device,UINT16  ds, UINT16 si, UINT8 raw_flag)
17451735{
1746    address_space &space = *device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
1736    address_space &space = device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
17471737
17481738    UINT16          *addr_ptr;
17491739    t_area_params   *area_params;
r18027r18028
17961786
17971787static void decode_dssi_f_plot_character_string(device_t *device,UINT16  ds, UINT16 si, UINT8 raw_flag)
17981788{
1799    address_space &space = *device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
1789    address_space &space = device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
18001790
18011791    UINT8                *char_ptr;
18021792    t_plot_string_params   *plot_string_params;
r18027r18028
18251815
18261816static void decode_dssi_f_set_new_clt(device_t *device,UINT16  ds, UINT16 si, UINT8 raw_flag)
18271817{
1828    address_space &space = *device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
1818    address_space &space = device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
18291819    UINT16  *new_colours;
18301820    int     colour;
18311821    new_colours=(UINT16  *)get_dssi_ptr(space,ds,si);
r18027r18028
18421832
18431833static void decode_dssi_f_plonk_char(device_t *device,UINT16  ds, UINT16 si, UINT8 raw_flag)
18441834{
1845    address_space &space = *device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
1835    address_space &space = device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
18461836    UINT16  *params;
18471837    params=(UINT16  *)get_dssi_ptr(space,ds,si);
18481838
r18027r18028
18561846
18571847static void decode_dssi_f_rw_sectors(device_t *device,UINT16  ds, UINT16 si, UINT8 raw_flag)
18581848{
1859    address_space &space = *device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
1849    address_space &space = device->machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM);
18601850    UINT16  *params;
18611851    int     param_no;
18621852
r18027r18028
19921982static void nimbus_bank_memory(running_machine &machine)
19931983{
19941984   rmnimbus_state *state = machine.driver_data<rmnimbus_state>();
1995    address_space &space = *machine.device( MAINCPU_TAG)->memory().space( AS_PROGRAM );
1985    address_space &space = machine.device( MAINCPU_TAG)->memory().space( AS_PROGRAM );
19961986    int     ramsize = machine.device<ram_device>(RAM_TAG)->size();
19971987    int     ramblock = 0;
19981988    int     blockno;
trunk/src/mess/machine/pp01.c
r18027r18028
8585{
8686   pp01_state *state = machine.driver_data<pp01_state>();
8787   UINT8 *mem = state->memregion("maincpu")->base();
88   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
88   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
8989   UINT16 startaddr = block*0x1000;
9090   UINT16 endaddr   = ((block+1)*0x1000)-1;
9191   UINT8  blocknum  = block + 1;
trunk/src/mess/machine/cybiko.c
r18027r18028
4040
4141static void init_ram_handler(running_machine &machine, offs_t start, offs_t size, offs_t mirror)
4242{
43   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(start, start + size - 1, 0, mirror - size, "bank1");
44   machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(start, start + size - 1, 0, mirror - size, "bank1");
43   machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(start, start + size - 1, 0, mirror - size, "bank1");
44   machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(start, start + size - 1, 0, mirror - size, "bank1");
4545   machine.root_device().membank( "bank1" )->set_base( machine.device<ram_device>(RAM_TAG)->pointer());
4646}
4747
trunk/src/mess/machine/apple2.c
r18027r18028
5959void apple2_update_memory(running_machine &machine)
6060{
6161   apple2_state *state = machine.driver_data<apple2_state>();
62   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
62   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
6363   int i, bank;
6464   char rbank[10], wbank[10];
6565   int full_update = 0;
trunk/src/mess/machine/pk8020.c
r18027r18028
231231static void pk8020_set_bank(running_machine &machine,UINT8 data)
232232{
233233   pk8020_state *state = machine.driver_data<pk8020_state>();
234   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
234   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
235235   UINT8 *mem = state->memregion("maincpu")->base();
236236   UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer();
237237
trunk/src/mess/machine/kc.c
r18027r18028
6161      datasize = image.length() - 128;
6262   }
6363
64   address_space &space = *state->m_maincpu->space( AS_PROGRAM );
64   address_space &space = state->m_maincpu->space( AS_PROGRAM );
6565
6666   for (i=0; i<datasize; i++)
6767      space.write_byte((addr+i) & 0xffff, data[i+128]);
r18027r18028
290290/* update status of memory area 0x0000-0x03fff */
291291void kc_state::update_0x00000()
292292{
293   address_space &space = *m_maincpu->space( AS_PROGRAM );
293   address_space &space = m_maincpu->space( AS_PROGRAM );
294294
295295   /* access ram? */
296296   if (m_pio_data[0] & (1<<1))
r18027r18028
330330/* update status of memory area 0x4000-0x07fff */
331331void kc_state::update_0x04000()
332332{
333   address_space &space = *m_maincpu->space( AS_PROGRAM );
333   address_space &space = m_maincpu->space( AS_PROGRAM );
334334
335335   LOG(("Module at 0x4000\n"));
336336
r18027r18028
343343/* update memory address 0x0c000-0x0e000 */
344344void kc_state::update_0x0c000()
345345{
346   address_space &space = *m_maincpu->space( AS_PROGRAM );
346   address_space &space = m_maincpu->space( AS_PROGRAM );
347347
348348   if ((m_pio_data[0] & (1<<7)) && memregion("basic")->base() != NULL)
349349   {
r18027r18028
366366/* update memory address 0x0e000-0x0ffff */
367367void kc_state::update_0x0e000()
368368{
369   address_space &space = *m_maincpu->space( AS_PROGRAM );
369   address_space &space = m_maincpu->space( AS_PROGRAM );
370370
371371   if (m_pio_data[0] & (1<<0))
372372   {
r18027r18028
390390/* update status of memory area 0x08000-0x0ffff */
391391void kc_state::update_0x08000()
392392{
393   address_space &space = *m_maincpu->space( AS_PROGRAM );
393   address_space &space = m_maincpu->space( AS_PROGRAM );
394394
395395    if (m_pio_data[0] & (1<<2))
396396    {
r18027r18028
413413/* update status of memory area 0x4000-0x07fff */
414414void kc85_4_state::update_0x04000()
415415{
416   address_space &space = *m_maincpu->space( AS_PROGRAM );
416   address_space &space = m_maincpu->space( AS_PROGRAM );
417417
418418   /* access ram? */
419419   if (m_port_86_data & (1<<0))
r18027r18028
455455/* update memory address 0x0c000-0x0e000 */
456456void kc85_4_state::update_0x0c000()
457457{
458   address_space &space = *m_maincpu->space( AS_PROGRAM );
458   address_space &space = m_maincpu->space( AS_PROGRAM );
459459
460460   if (m_port_86_data & (1<<7))
461461   {
r18027r18028
491491
492492void kc85_4_state::update_0x08000()
493493{
494   address_space &space = *m_maincpu->space( AS_PROGRAM );
494   address_space &space = m_maincpu->space( AS_PROGRAM );
495495
496496   if (m_pio_data[0] & (1<<2))
497497   {
trunk/src/mess/video/hp48.c
r18027r18028
130130UINT32 hp48_state::screen_update_hp48(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
131131{
132132   hp48_state *state = machine().driver_data<hp48_state>();
133   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
133   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
134134   int x, y, xp, i, addr;
135135   int display       = HP48_IO_4(0) >> 3;           /* 1=on, 0=off */
136136   int left_margin   = HP48_IO_4(0) & 7;            /* 0..7 pixels for main bitmap */
trunk/src/mess/video/apple3.c
r18027r18028
4040void apple3_write_charmem(running_machine &machine)
4141{
4242   apple3_state *state = machine.driver_data<apple3_state>();
43   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
43   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
4444   static const UINT32 screen_hole_map[] =
4545   {
4646      0x478, 0x4f8, 0x578, 0x5f8, 0x678, 0x6f8, 0x778, 0x7f8
trunk/src/mess/video/dai.c
r18027r18028
5757
5858UINT32 dai_state::screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
5959{
60   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
60   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
6161   int i, j, k, l;
6262
6363   UINT8* char_rom = memregion("gfx1")->base();
trunk/src/mess/video/ac1.c
r18027r18028
2929UINT32 ac1_state::screen_update_ac1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
3030{
3131   int x,y;
32   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
32   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
3333
3434   for(y = 0; y < 16; y++ )
3535   {
r18027r18028
4545UINT32 ac1_state::screen_update_ac1_32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
4646{
4747   int x,y;
48   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
48   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
4949
5050   for(y = 0; y < 32; y++ )
5151   {
trunk/src/mess/video/cirrus.c
r18027r18028
163163void cirrus_device::device_start()
164164{
165165   pc_vga_init(machine(), NULL, &cirrus_svga_interface);
166   pc_vga_io_init(machine(), *machine().device("ppc1")->memory().space(AS_PROGRAM), 0xC00A0000, *machine().device("ppc1")->memory().space(AS_PROGRAM), 0x80000000);
166   pc_vga_io_init(machine(), machine().device("ppc1")->memory().space(AS_PROGRAM), 0xC00A0000, machine().device("ppc1")->memory().space(AS_PROGRAM), 0x80000000);
167167}
168168
169169//-------------------------------------------------
trunk/src/mess/video/isa_cga.c
r18027r18028
15951595      // TODO: This should be moved to card implementations that actually had this feature
15961596      m_p3df = data;
15971597      if (data & 1) {
1598         address_space *space_prg = machine().firstcpu->space(AS_PROGRAM);
1598         address_space &space_prg = machine().firstcpu->space(AS_PROGRAM);
15991599
1600         space_prg->install_readwrite_handler(0xb8000, 0xb87ff, read8_delegate( FUNC(isa8_cga_device::char_ram_read), this), write8_delegate(FUNC(isa8_cga_device::char_ram_write), this) );
1600         space_prg.install_readwrite_handler(0xb8000, 0xb87ff, read8_delegate( FUNC(isa8_cga_device::char_ram_read), this), write8_delegate(FUNC(isa8_cga_device::char_ram_write), this) );
16011601      } else {
16021602         m_isa->install_bank(0xb8000, 0xb8000 + MIN(0x8000,m_vram_size) - 1, 0, m_vram_size & 0x4000, "bank_cga", m_vram);
16031603      }
r18027r18028
20132013   m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate( FUNC(isa8_cga_pc1512_device::io_read), this ), write8_delegate( FUNC(isa8_cga_pc1512_device::io_write), this ) );
20142014   m_isa->install_bank(0xb8000, 0xbbfff, 0, 0, "bank1", m_vram);
20152015
2016    address_space &space = *machine().firstcpu->space( AS_PROGRAM );
2016    address_space &space = machine().firstcpu->space( AS_PROGRAM );
20172017
20182018    space.install_write_handler( 0xb8000, 0xbbfff, 0, 0x0C000, write8_delegate( FUNC(isa8_cga_pc1512_device::vram_w), this ) );
20192019}
trunk/src/mess/video/gb.c
r18027r18028
12221222   gb_state *state = machine.driver_data<gb_state>();
12231223   int   i;
12241224   int vram_size = 0x2000;
1225   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1225   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12261226   emu_timer *old_timer = state->m_lcd.lcd_timer;
12271227
12281228   memset( &state->m_lcd, 0, sizeof(state->m_lcd) );
r18027r18028
13321332{
13331333   gb_state *state = machine.driver_data<gb_state>();
13341334   UINT16 src, dst;
1335   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1335   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
13361336
13371337   src = ((UINT16)HDMA1 << 8) | (HDMA2 & 0xF0);
13381338   dst = ((UINT16)(HDMA3 & 0x1F) << 8) | (HDMA4 & 0xF0);
trunk/src/mess/video/kramermc.c
r18027r18028
3030UINT32 kramermc_state::screen_update_kramermc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
3131{
3232   int x,y;
33   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
33   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
3434
3535   for(y = 0; y < 16; y++ )
3636   {
trunk/src/mess/video/atarist.c
r18027r18028
180180
181181inline void st_state::shifter_load()
182182{
183   address_space *program = m_maincpu->space(AS_PROGRAM);
184   UINT16 data = program->read_word(m_shifter_ofs);
183   address_space &program = m_maincpu->space(AS_PROGRAM);
184   UINT16 data = program.read_word(m_shifter_ofs);
185185
186186   m_shifter_ir[m_shifter_bitplane] = data;
187187   m_shifter_bitplane++;
r18027r18028
619619
620620void st_state::blitter_source()
621621{
622   address_space *program = m_maincpu->space(AS_PROGRAM);
623   UINT16 data = program->read_word(m_blitter_src);
622   address_space &program = m_maincpu->space(AS_PROGRAM);
623   UINT16 data = program.read_word(m_blitter_src);
624624
625625   if (m_blitter_src_inc_x < 0)
626626   {
r18027r18028
669669
670670void st_state::blitter_op(UINT16 s, UINT32 dstaddr, UINT16 mask)
671671{
672   address_space *program = m_maincpu->space(AS_PROGRAM);
672   address_space &program = m_maincpu->space(AS_PROGRAM);
673673
674   UINT16 d = program->read_word(dstaddr);
674   UINT16 d = program.read_word(dstaddr);
675675   UINT16 result = 0;
676676
677677   if (m_blitter_op & 0x08) result = (~s & ~d);
r18027r18028
679679   if (m_blitter_op & 0x02) result |= (s & ~d);
680680   if (m_blitter_op & 0x01) result |= (s & d);
681681
682   program->write_word(dstaddr, result);
682   program.write_word(dstaddr, result);
683683}
684684
685685
trunk/src/mess/video/oric.c
r18027r18028
6868   oric_state *state = machine.driver_data<oric_state>();
6969   /* attribute */
7070   UINT8 attribute = c & 0x03f;
71   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
71   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
7272
7373   switch ((attribute>>3) & 0x03)
7474   {
r18027r18028
213213         }
214214
215215         /* fetch data */
216         c = RAM ? RAM[read_addr] : machine().device("maincpu")->memory().space(AS_PROGRAM)->read_byte(read_addr);
216         c = RAM ? RAM[read_addr] : machine().device("maincpu")->memory().space(AS_PROGRAM).read_byte(read_addr);
217217
218218         /* if bits 6 and 5 are zero, the byte contains a serial attribute */
219219         if ((c & ((1 << 6) | (1 << 5))) == 0)
trunk/src/mess/video/upd7220.c
r18027r18028
212212
213213inline UINT8 upd7220_device::readbyte(offs_t address)
214214{
215   return space()->read_byte(address);
215   return space().read_byte(address);
216216}
217217
218218
r18027r18028
222222
223223inline void upd7220_device::writebyte(offs_t address, UINT8 data)
224224{
225   space()->write_byte(address, data);
225   space().write_byte(address, data);
226226}
227227
228228
trunk/src/mess/video/zx8301.c
r18027r18028
103103
104104inline UINT8 zx8301_device::readbyte(offs_t address)
105105{
106   return space()->read_byte(address);
106   return space().read_byte(address);
107107}
108108
109109
r18027r18028
113113
114114inline void zx8301_device::writebyte(offs_t address, UINT8 data)
115115{
116   space()->write_byte(address, data);
116   space().write_byte(address, data);
117117}
118118
119119
trunk/src/mess/video/irisha.c
r18027r18028
2020   UINT8 code1; //, code2;
2121   UINT8 col;
2222   int y, x, b;
23   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
23   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
2424
2525   // draw image
2626   for (y = 0; y < 200; y++)
trunk/src/mess/video/pc_t1t.c
r18027r18028
922922static VIDEO_START( pc_t1t )
923923{
924924   int buswidth;
925   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
926   address_space *spaceio = machine.firstcpu->space(AS_IO);
925   address_space &space = machine.firstcpu->space(AS_PROGRAM);
926   address_space &spaceio = machine.firstcpu->space(AS_IO);
927927
928928   pcjr.chr_gen = machine.root_device().memregion("gfx1")->base();
929929   pcjr.update_row = NULL;
r18027r18028
935935   {
936936      case 8:
937937         space.install_legacy_readwrite_handler(0xb8000, 0xbffff, FUNC(pc_t1t_videoram_r), FUNC(pc_t1t_videoram_w) );
938         spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_T1T_r),FUNC(pc_T1T_w) );
938         spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_T1T_r),FUNC(pc_T1T_w) );
939939         break;
940940
941941      case 16:
942942         space.install_legacy_readwrite_handler(0xb8000, 0xbffff, FUNC(pc_t1t_videoram_r), FUNC(pc_t1t_videoram_w), 0xffff );
943         spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_T1T_r),FUNC(pc_T1T_w), 0xffff );
943         spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_T1T_r),FUNC(pc_T1T_w), 0xffff );
944944         break;
945945
946946      default:
r18027r18028
953953static VIDEO_START( pc_pcjr )
954954{
955955   int buswidth;
956   address_space *spaceio = machine.firstcpu->space(AS_IO);
956   address_space &spaceio = machine.firstcpu->space(AS_IO);
957957
958958   pcjr.chr_gen = machine.root_device().memregion("gfx1")->base();
959959   pcjr.update_row = NULL;
r18027r18028
965965   switch(buswidth)
966966   {
967967      case 8:
968         spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_T1T_r),FUNC(pc_pcjr_w) );
968         spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_T1T_r),FUNC(pc_pcjr_w) );
969969         break;
970970
971971      default:
trunk/src/mess/video/a7800.c
r18027r18028
8686static void maria_draw_scanline(running_machine &machine)
8787{
8888   a7800_state *state = machine.driver_data<a7800_state>();
89   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
89   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
9090   unsigned int graph_adr,data_addr;
9191   int width,hpos,pal,mode,ind;
9292   unsigned int dl;
r18027r18028
321321   a7800_state *state = timer.machine().driver_data<a7800_state>();
322322   int frame_scanline;
323323   UINT8 *ROM = timer.machine().root_device().memregion("maincpu")->base();
324   address_space& space = *timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
324   address_space& space = timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
325325
326326   state->m_maria_scanline++;
327327
trunk/src/mess/video/newbrain.c
r18027r18028
1515
1616void newbrain_state::screen_update(bitmap_rgb32 &bitmap, const rectangle &cliprect)
1717{
18   address_space *program = m_maincpu->space(AS_PROGRAM);
18   address_space &program = m_maincpu->space(AS_PROGRAM);
1919
2020   int y, sx;
2121   int columns = (m_tvctl & NEWBRAIN_VIDEO_80L) ? 80 : 40;
r18027r18028
3636      {
3737         int bit;
3838
39         UINT8 videoram_data = program->read_byte(videoram_addr + sx);
39         UINT8 videoram_data = program.read_byte(videoram_addr + sx);
4040         UINT8 charrom_data;
4141
4242         if (gr)
trunk/src/mess/video/pc_aga.c
r18027r18028
689689
690690VIDEO_START( pc_aga )
691691{
692   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
693   address_space *spaceio = machine.firstcpu->space(AS_IO);
692   address_space &space = machine.firstcpu->space(AS_PROGRAM);
693   address_space &spaceio = machine.firstcpu->space(AS_IO);
694694   int buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
695695   switch(buswidth)
696696   {
697697      case 8:
698698         space.install_legacy_readwrite_handler(0xb0000, 0xbffff, FUNC(pc200_videoram_r), FUNC(pc200_videoram_w) );
699         spaceio->install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w) );
700         spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_aga_cga_r), FUNC(pc_aga_cga_w) );
699         spaceio.install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w) );
700         spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_aga_cga_r), FUNC(pc_aga_cga_w) );
701701         break;
702702
703703      case 16:
704704         space.install_legacy_readwrite_handler(0xb0000, 0xbffff, FUNC(pc200_videoram_r), FUNC(pc200_videoram_w), 0xffff );
705         spaceio->install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w), 0xffff );
706         spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_aga_cga_r), FUNC(pc_aga_cga_w), 0xffff );
705         spaceio.install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w), 0xffff );
706         spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_aga_cga_r), FUNC(pc_aga_cga_w), 0xffff );
707707         break;
708708
709709      default:
r18027r18028
720720
721721VIDEO_START( pc200 )
722722{
723   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
724   address_space *spaceio = machine.firstcpu->space(AS_IO);
723   address_space &space = machine.firstcpu->space(AS_PROGRAM);
724   address_space &spaceio = machine.firstcpu->space(AS_IO);
725725   int buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width;
726726   switch(buswidth)
727727   {
728728      case 8:
729729         space.install_legacy_readwrite_handler(0xb0000, 0xbffff, FUNC(pc_aga_videoram_r), FUNC(pc_aga_videoram_w) );
730         spaceio->install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w) );
731         spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc200_cga_r),  FUNC(pc200_cga_w) );
730         spaceio.install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w) );
731         spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc200_cga_r),  FUNC(pc200_cga_w) );
732732         break;
733733
734734      case 16:
735735         space.install_legacy_readwrite_handler(0xb0000, 0xbffff, FUNC(pc_aga_videoram_r), FUNC(pc_aga_videoram_w), 0xffff );
736         spaceio->install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w), 0xffff );
737         spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc200_cga_r),  FUNC(pc200_cga_w), 0xffff );
736         spaceio.install_legacy_readwrite_handler(0x3b0, 0x3bf, FUNC(pc_aga_mda_r), FUNC(pc_aga_mda_w), 0xffff );
737         spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc200_cga_r),  FUNC(pc200_cga_w), 0xffff );
738738         break;
739739
740740      default:
trunk/src/mess/video/ef9345.c
r18027r18028
140140   m_busy_timer = timer_alloc(BUSY_TIMER);
141141   m_blink_timer = timer_alloc(BLINKING_TIMER);
142142
143   m_videoram = space(0);
143   m_videoram = &space(0);
144144   m_charset = region();
145145
146146   m_screen_out.allocate(496, m_screen->height());
trunk/src/mess/video/iq151_grafik.c
r18027r18028
130130{
131131   if (offset >= 0xd0 && offset < 0xd4)
132132   {
133      address_space& space = *machine().device("maincpu")->memory().space(AS_IO);
133      address_space& space = machine().device("maincpu")->memory().space(AS_IO);
134134      data = m_ppi8255->read(space, offset & 3);
135135   }
136136   else if (offset == 0xd4)
r18027r18028
150150{
151151   if (offset >= 0xd0 && offset < 0xd4)
152152   {
153      address_space& space = *machine().device("maincpu")->memory().space(AS_IO);
153      address_space& space = machine().device("maincpu")->memory().space(AS_IO);
154154      m_ppi8255->write(space, offset & 3, data);
155155   }
156156   else if (offset == 0xd4)
trunk/src/mess/video/mos6566.c
r18027r18028
280280
281281inline UINT8 mos6566_device::read_videoram(offs_t offset)
282282{
283   m_last_data = space(AS_0)->read_byte(offset & 0x3fff);
283   m_last_data = space(AS_0).read_byte(offset & 0x3fff);
284284
285285   return m_last_data;
286286}
287287
288288inline UINT8 mos6566_device::read_colorram(offs_t offset)
289289{
290   return space(AS_1)->read_byte(offset & 0x3ff);
290   return space(AS_1).read_byte(offset & 0x3ff);
291291}
292292
293293// Idle access
trunk/src/mess/video/primo.c
r18027r18028
2323   UINT16 *scanline = &bitmap.pix16(primo_scanline);
2424
2525   /* address of current line in Primo video memory */
26   const UINT8* primo_video_ram_line = (const UINT8*)machine.device("maincpu")->memory().space(AS_PROGRAM)->get_read_ptr(state->m_video_memory_base + 32 * primo_scanline);
26   const UINT8* primo_video_ram_line = (const UINT8*)machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(state->m_video_memory_base + 32 * primo_scanline);
2727
2828   for (x=0; x<256; x+=8)
2929   {
trunk/src/mess/video/tms3556.c
r18027r18028
5454
5555inline UINT8 tms3556_device::readbyte(offs_t address)
5656{
57   return space()->read_byte(address);
57   return space().read_byte(address);
5858}
5959
6060
r18027r18028
6464
6565inline void tms3556_device::writebyte(offs_t address, UINT8 data)
6666{
67   space()->write_byte(address, data);
67   space().write_byte(address, data);
6868}
6969
7070
trunk/src/mess/video/ti85.c
r18027r18028
149149
150150UINT32 ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
151151{
152   address_space &space = *m_maincpu->space(AS_PROGRAM);
152   address_space &space = m_maincpu->space(AS_PROGRAM);
153153   int x,y,b;
154154   int brightnes;
155155   int lcdmem;
trunk/src/mess/video/hd66421.c
r18027r18028
9292
9393inline UINT8 hd66421_device::readbyte(offs_t address)
9494{
95   return space()->read_byte(address);
95   return space().read_byte(address);
9696}
9797
9898
r18027r18028
102102
103103inline void hd66421_device::writebyte(offs_t address, UINT8 data)
104104{
105   space()->write_byte(address, data);
105   space().write_byte(address, data);
106106}
107107
108108
trunk/src/mess/video/galaxy.c
r18027r18028
1616static TIMER_CALLBACK( gal_video )
1717{
1818   galaxy_state *state = machine.driver_data<galaxy_state>();
19   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
19   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
2020   int y, x;
2121   if (state->m_interrupts_enabled == TRUE)
2222   {
trunk/src/mess/formats/ace_ace.c
r18027r18028
2727{
2828   cpu_device *cpu = image.device().machine().firstcpu;
2929   UINT8 *RAM = image.device().machine().root_device().memregion(cpu->tag())->base();
30   address_space &space = *cpu->space(AS_PROGRAM);
30   address_space &space = cpu->space(AS_PROGRAM);
3131   unsigned char ace_repeat, ace_byte, loop;
3232   int done=0, ace_index=0x2000;
3333
trunk/src/mess/formats/atom_atm.c
r18027r18028
2626
2727static void image_fread_memory(device_image_interface &image, UINT16 addr, UINT32 count)
2828{
29   void *ptr = image.device().machine().firstcpu->space(AS_PROGRAM)->get_write_ptr(addr);
29   void *ptr = image.device().machine().firstcpu->space(AS_PROGRAM).get_write_ptr(addr);
3030
3131   image.fread( ptr, count);
3232}
trunk/src/mess/formats/m65_snqk.c
r18027r18028
219219{
220220   microtan_state *state = machine.driver_data<microtan_state>();
221221    UINT8 *RAM = state->memregion("maincpu")->base();
222    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
222    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
223223    via6522_device *via_0 = machine.device<via6522_device>("via6522_0");
224224    via6522_device *via_1 = machine.device<via6522_device>("via6522_1");
225225    device_t *ay8910 = machine.device("ay8910.1");
trunk/src/mess/formats/comx35_comx.c
r18027r18028
4747
4848QUICKLOAD_LOAD( comx35_comx )
4949{
50   address_space *program = image.device().machine().firstcpu->space(AS_PROGRAM);
50   address_space &program = image.device().machine().firstcpu->space(AS_PROGRAM);
5151
5252   UINT8 header[16] = {0};
5353   int size = image.length();
r18027r18028
172172         image.fread(header, 2);
173173
174174         array_length = pick_integer_be(header, 0, 2);
175         start_array = (program->read_byte(0x4295) << 8) | program->read_byte(0x4296);
175         start_array = (program.read_byte(0x4295) << 8) | program.read_byte(0x4296);
176176         end_array = start_array + (size - 7);
177177
178         program->write_byte(0x4299, end_array >> 8);
179         program->write_byte(0x429a, end_array & 0xff);
178         program.write_byte(0x4299, end_array >> 8);
179         program.write_byte(0x429a, end_array & 0xff);
180180
181181         start_string = start_array + array_length;
182182
183         program->write_byte(0x4292, start_string >> 8);
184         program->write_byte(0x4293, start_string & 0xff);
183         program.write_byte(0x4292, start_string >> 8);
184         program.write_byte(0x4293, start_string & 0xff);
185185
186186         image_fread_memory(image, start_array, size);
187187      }
trunk/src/mess/formats/z80bin.c
r18027r18028
6868         image->message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
6969         return IMAGE_INIT_FAIL;
7070      }
71      image->device().machine().device("maincpu")->memory().space(AS_PROGRAM)->write_byte(j, data);
71      image->device().machine().device("maincpu")->memory().space(AS_PROGRAM).write_byte(j, data);
7272   }
7373
7474   return IMAGE_INIT_PASS;
r18027r18028
122122      autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
123123
124124      device_t *cpu = image.device().machine().device("maincpu");
125      address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
125      address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
126126
127127      space.write_word(0xa6, execute_address);         /* fix the EXEC command */
128128
r18027r18028
158158      /* check to see if autorun is on (I hate how this works) */
159159      autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1;
160160
161      address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
161      address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
162162
163163      if ((execute_address >= 0xc000) && (execute_address <= 0xdfff) && (space.read_byte(0xdffa) != 0xc3))
164164         return IMAGE_INIT_FAIL;      /* can't run a program if the cartridge isn't in */
trunk/src/mess/formats/spec_snqk.c
r18027r18028
320320    UINT16 start, size, data, status;
321321    spectrum_state *state = machine.driver_data<spectrum_state>();
322322    device_t *cpu = machine.device("maincpu");
323    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
323    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
324324
325325    if (snapsize == SP_NEW_SIZE_16K || snapsize == SP_NEW_SIZE_48K)
326326    {
r18027r18028
520520    UINT16 data, addr;
521521    spectrum_state *state = machine.driver_data<spectrum_state>();
522522    device_t *cpu = machine.device("maincpu");
523    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
523    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
524524
525525    if ((snapsize != SNA48_SIZE) && (state->m_port_7ffd_data == -1))
526526    {
r18027r18028
739739    UINT16 data;
740740    spectrum_state *state = machine.driver_data<spectrum_state>();
741741    device_t *cpu = machine.device("maincpu");
742    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
742    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
743743
744744    data = (snapdata[ACH_OFFSET +   0] << 8) | snapdata[ACH_OFFSET +   4];
745745    LOAD_REG(cpu, Z80_AF, data);
r18027r18028
872872    UINT16 addr, data;
873873    spectrum_state *state = machine.driver_data<spectrum_state>();
874874    device_t *cpu = machine.device("maincpu");
875    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
875    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
876876
877877    data = snapdata[PRG_OFFSET +   0];
878878    if (data != 0x05)
r18027r18028
10421042    UINT16 addr = 0, data;
10431043    spectrum_state *state = machine.driver_data<spectrum_state>();
10441044    device_t *cpu = machine.device("maincpu");
1045    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1045    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
10461046
10471047    data = (snapdata[PLUSD_OFFSET + 15] << 8) | snapdata[PLUSD_OFFSET + 14];
10481048    LOAD_REG(cpu, Z80_BC, data);
r18027r18028
12101210    UINT16 data;
12111211    spectrum_state *state = machine.driver_data<spectrum_state>();
12121212    device_t *cpu = machine.device("maincpu");
1213    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1213    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12141214
12151215    data = (snapdata[SEM_OFFSET +  1] << 8) | snapdata[SEM_OFFSET +  0];
12161216    LOAD_REG(cpu, Z80_AF, data);
r18027r18028
13291329    UINT16 data;
13301330    spectrum_state *state = machine.driver_data<spectrum_state>();
13311331    device_t *cpu = machine.device("maincpu");
1332    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1332    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
13331333
13341334    data = (snapdata[SIT_OFFSET +  7] << 8) | snapdata[SIT_OFFSET +  6];
13351335    LOAD_REG(cpu, Z80_AF, data);
r18027r18028
14591459    UINT16 data, mode;
14601460    spectrum_state *state = machine.driver_data<spectrum_state>();
14611461    device_t *cpu = machine.device("maincpu");
1462    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1462    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
14631463
14641464    logerror("Skipping last 132 bytes of the 16K ROM dump at offset:0000\n");
14651465
r18027r18028
15911591    UINT16 data;
15921592    spectrum_state *state = machine.driver_data<spectrum_state>();
15931593    device_t *cpu = machine.device("maincpu");
1594    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1594    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
15951595
15961596    data = (snapdata[SNP_OFFSET +  1] << 8) | snapdata[SNP_OFFSET +  0];
15971597    LOAD_REG(cpu, Z80_AF, data);
r18027r18028
17681768{
17691769    UINT8 counthi, countlo, compress, fill;
17701770    UINT16 block = 0, count, i, j, numbytes;
1771    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1771    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
17721772
17731773    i = SNX_HDR - 1;
17741774    numbytes = 0;
r18027r18028
18181818    UINT16 data, addr;
18191819    spectrum_state *state = machine.driver_data<spectrum_state>();
18201820    device_t *cpu = machine.device("maincpu");
1821    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1821    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
18221822
18231823    data = (snapdata[SNX_OFFSET +  4] << 8) | snapdata[SNX_OFFSET +  5];
18241824    if (data != 0x25)
r18027r18028
19721972    UINT16 addr, data;
19731973    spectrum_state *state = machine.driver_data<spectrum_state>();
19741974    device_t *cpu = machine.device("maincpu");
1975    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1975    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
19761976
19771977    if (state->m_port_7ffd_data == -1)
19781978    {
r18027r18028
20832083{
20842084    UINT8 ch;
20852085    int i;
2086    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2086    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
20872087
20882088    do
20892089    {
r18027r18028
21942194    int i;
21952195    UINT8 lo, hi, data;
21962196    SPECTRUM_Z80_SNAPSHOT_TYPE z80_type;
2197    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2197    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
21982198
21992199    z80_type = spectrum_identify_z80(snapdata, snapsize);
22002200
r18027r18028
25202520void spectrum_setup_scr(running_machine &machine, UINT8 *quickdata, UINT32 quicksize)
25212521{
25222522    int i;
2523    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2523    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
25242524
25252525    for (i = 0; i < quicksize; i++)
25262526        space.write_byte(i + BASE_RAM, quickdata[i]);
r18027r18028
25602560   UINT8 data;
25612561    UINT16 start, len;
25622562    spectrum_state *state = machine.driver_data<spectrum_state>();
2563    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
2563    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
25642564
25652565    start = (quickdata[RAW_OFFSET + 4] << 8) | quickdata[RAW_OFFSET + 3];
25662566    len   = (quickdata[RAW_OFFSET + 2] << 8) | quickdata[RAW_OFFSET + 1];
trunk/src/mess/formats/trs_cmd.c
r18027r18028
3535
3636QUICKLOAD_LOAD( trs80_cmd )
3737{
38    address_space *program = image.device().machine().firstcpu->space(AS_PROGRAM);
38    address_space &program = image.device().machine().firstcpu->space(AS_PROGRAM);
3939
4040   UINT8 type, length;
4141   UINT8 data[0x100];
r18027r18028
5757         image.fread( &addr, 2);
5858         UINT16 address = (addr[1] << 8) | addr[0];
5959         if (LOG) logerror("/CMD object code block: address %04x length %u\n", address, block_length);
60         ptr = program->get_write_ptr(address);
60         ptr = program.get_write_ptr(address);
6161         image.fread( ptr, block_length);
6262         }
6363         break;
trunk/src/mess/formats/cbm_snqk.c
r18027r18028
3030   UINT32 bytesread;
3131   UINT16 address = 0;
3232   int i;
33   address_space &space = *image.device().machine().firstcpu->space(AS_PROGRAM);
33   address_space &space = image.device().machine().firstcpu->space(AS_PROGRAM);
3434
3535   if (!file_type)
3636      goto error;
r18027r18028
9393
9494static void cbm_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
9595{
96   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
96   address_space &space = machine.firstcpu->space(AS_PROGRAM);
9797
9898   space.write_byte(0x31, hiaddress & 0xff);
9999   space.write_byte(0x2f, hiaddress & 0xff);
r18027r18028
120120
121121static void cbm_pet_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
122122{
123   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
123   address_space &space = machine.firstcpu->space(AS_PROGRAM);
124124
125125   space.write_byte(0x2e, hiaddress & 0xff);
126126   space.write_byte(0x2c, hiaddress & 0xff);
r18027r18028
137137
138138static void cbm_pet1_quick_sethiaddress(running_machine &machine, UINT16 hiaddress)
139139{
140   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
140   address_space &space = machine.firstcpu->space(AS_PROGRAM);
141141
142142   space.write_byte(0x80, hiaddress & 0xff);
143143   space.write_byte(0x7e, hiaddress & 0xff);
r18027r18028
154154
155155static void cbmb_quick_sethiaddress(running_machine &machine, UINT16 hiaddress)
156156{
157   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
157   address_space &space = machine.firstcpu->space(AS_PROGRAM);
158158
159159   space.write_byte(0xf0046, hiaddress & 0xff);
160160   space.write_byte(0xf0047, hiaddress >> 8);
r18027r18028
172172
173173static void cbm_c65_quick_sethiaddress( running_machine &machine, UINT16 hiaddress )
174174{
175   address_space &space = *machine.firstcpu->space(AS_PROGRAM);
175   address_space &space = machine.firstcpu->space(AS_PROGRAM);
176176
177177   space.write_byte(0x82, hiaddress & 0xff);
178178   space.write_byte(0x83, hiaddress >> 8);
trunk/src/mess/drivers/pdp1.c
r18027r18028
15881588   {
15891589      if ((state->m_parallel_drum.wfb >= 1) && (state->m_parallel_drum.wfb <= 22))
15901590      {
1591         drum_write(state, state->m_parallel_drum.wfb-1, dc, (signed)device->machine().device("maincpu")->memory().space(AS_PROGRAM)->read_dword(state->m_parallel_drum.wcl<<2));
1591         drum_write(state, state->m_parallel_drum.wfb-1, dc, (signed)device->machine().device("maincpu")->memory().space(AS_PROGRAM).read_dword(state->m_parallel_drum.wcl<<2));
15921592      }
15931593
15941594      if ((state->m_parallel_drum.rfb >= 1) && (state->m_parallel_drum.rfb <= 22))
15951595      {
1596         device->machine().device("maincpu")->memory().space(AS_PROGRAM)->write_dword(state->m_parallel_drum.wcl<<2, drum_read(state, state->m_parallel_drum.rfb-1, dc));
1596         device->machine().device("maincpu")->memory().space(AS_PROGRAM).write_dword(state->m_parallel_drum.wcl<<2, drum_read(state, state->m_parallel_drum.rfb-1, dc));
15971597      }
15981598
15991599      state->m_parallel_drum.wc = (state->m_parallel_drum.wc+1) & 07777;
r18027r18028
18621862         device.state().set_state_int(PDP1_MA, device.state().state_int(PDP1_PC));
18631863         device.state().set_state_int(PDP1_IR, LAC);   /* this instruction is actually executed */
18641864
1865         device.state().set_state_int(PDP1_MB, (signed)device.memory().space(AS_PROGRAM)->read_dword(PDP1_MA<<2));
1865         device.state().set_state_int(PDP1_MB, (signed)device.memory().space(AS_PROGRAM).read_dword(PDP1_MA<<2));
18661866         device.state().set_state_int(PDP1_AC, device.state().state_int(PDP1_MB));
18671867      }
18681868      if (control_transitions & pdp1_deposit)
r18027r18028
18741874         device.state().set_state_int(PDP1_IR, DAC);   /* this instruction is actually executed */
18751875
18761876         device.state().set_state_int(PDP1_MB, device.state().state_int(PDP1_AC));
1877         device.memory().space(AS_PROGRAM)->write_dword(device.state().state_int(PDP1_MA)<<2, device.state().state_int(PDP1_MB));
1877         device.memory().space(AS_PROGRAM).write_dword(device.state().state_int(PDP1_MA)<<2, device.state().state_int(PDP1_MB));
18781878      }
18791879      if (control_transitions & pdp1_read_in)
18801880      {   /* set cpu to read instructions from perforated tape */
trunk/src/mess/drivers/elf.c
r18027r18028
236236
237237void elf2_state::machine_start()
238238{
239   address_space *program = m_maincpu->space(AS_PROGRAM);
239   address_space &program = m_maincpu->space(AS_PROGRAM);
240240
241241   /* initialize LED displays */
242242   m_led_l->rbi_w(1);
243243   m_led_h->rbi_w(1);
244244
245245   /* setup memory banking */
246   program->install_read_bank(0x0000, 0x00ff, "bank1");
247   program->install_write_handler(0x0000, 0x00ff, write8_delegate(FUNC(elf2_state::memory_w), this));
246   program.install_read_bank(0x0000, 0x00ff, "bank1");
247   program.install_write_handler(0x0000, 0x00ff, write8_delegate(FUNC(elf2_state::memory_w), this));
248248   membank("bank1")->configure_entry(0, m_ram->pointer());
249249   membank("bank1")->set_entry(0);
250250
trunk/src/mess/drivers/dectalk.c
r18027r18028
228228static void duart_tx(device_t *device, int channel, UINT8 data)
229229{
230230   device_t *devconf = device->machine().device(TERMINAL_TAG);
231   dynamic_cast<generic_terminal_device *>(devconf)->write(*devconf->machine().memory().first_space(), 0, data);
231   dynamic_cast<generic_terminal_device *>(devconf)->write(devconf->machine().driver_data()->generic_space(), 0, data);
232232#ifdef SERIAL_TO_STDERR
233233   fprintf(stderr, "%02X ",data);
234234#endif
trunk/src/mess/drivers/homelab.c
r18027r18028
646646
647647static QUICKLOAD_LOAD(homelab)
648648{
649   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
649   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
650650   int i=0;
651651   UINT8 ch;
652652   UINT16 quick_addr;
trunk/src/mess/drivers/vt520.c
r18027r18028
5353
5454void vt520_state::machine_reset()
5555{
56   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
56   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
5757   UINT8 *rom = memregion("maincpu")->base();
5858   space.unmap_write(0x0000, 0xffff);
5959   membank("bank1")->set_base(rom + 0x70000);
trunk/src/mess/drivers/pc8401a.c
r18027r18028
7272
7373void pc8401a_state::bankswitch(UINT8 data)
7474{
75   address_space *program = m_maincpu->space(AS_PROGRAM);
75   address_space &program = m_maincpu->space(AS_PROGRAM);
7676
7777   int rombank = data & 0x03;
7878   int ram0000 = (data >> 2) & 0x03;
r18027r18028
8484      if (rombank < 3)
8585      {
8686         /* internal ROM */
87         program->install_read_bank(0x0000, 0x7fff, "bank1");
88         program->unmap_write(0x0000, 0x7fff);
87         program.install_read_bank(0x0000, 0x7fff, "bank1");
88         program.unmap_write(0x0000, 0x7fff);
8989         membank("bank1")->set_entry(rombank);
9090      }
9191      else
9292      {
9393         /* ROM cartridge */
94         program->unmap_readwrite(0x0000, 0x7fff);
94         program.unmap_readwrite(0x0000, 0x7fff);
9595      }
9696      //logerror("0x0000-0x7fff = ROM %u\n", rombank);
9797      break;
9898
9999   case 1: /* RAM 0000H to 7FFFH */
100      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
100      program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
101101      membank("bank1")->set_entry(4);
102102      //logerror("0x0000-0x7fff = RAM 0-7fff\n");
103103      break;
104104
105105   case 2:   /* RAM 8000H to FFFFH */
106      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
106      program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
107107      membank("bank1")->set_entry(5);
108108      //logerror("0x0000-0x7fff = RAM 8000-ffff\n");
109109      break;
r18027r18028
116116   switch (ram8000)
117117   {
118118   case 0: /* cell addresses 0000H to 3FFFH */
119      program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
119      program.install_readwrite_bank(0x8000, 0xbfff, "bank3");
120120      membank("bank3")->set_entry(0);
121121      //logerror("0x8000-0xbfff = RAM 0-3fff\n");
122122      break;
123123
124124   case 1: /* cell addresses 4000H to 7FFFH */
125      program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
125      program.install_readwrite_bank(0x8000, 0xbfff, "bank3");
126126      membank("bank3")->set_entry(1);
127127      //logerror("0x8000-0xbfff = RAM 4000-7fff\n");
128128      break;
129129
130130   case 2: /* cell addresses 8000H to BFFFH */
131      program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
131      program.install_readwrite_bank(0x8000, 0xbfff, "bank3");
132132      membank("bank3")->set_entry(2);
133133      //logerror("0x8000-0xbfff = RAM 8000-bfff\n");
134134      break;
r18027r18028
136136   case 3: /* RAM cartridge */
137137      if (m_ram->size() > 64)
138138      {
139         program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
139         program.install_readwrite_bank(0x8000, 0xbfff, "bank3");
140140         membank("bank3")->set_entry(3); // TODO or 4
141141      }
142142      else
143143      {
144         program->unmap_readwrite(0x8000, 0xbfff);
144         program.unmap_readwrite(0x8000, 0xbfff);
145145      }
146146      //logerror("0x8000-0xbfff = RAM cartridge\n");
147147      break;
r18027r18028
150150   if (BIT(data, 6))
151151   {
152152      /* CRT video RAM */
153      program->install_readwrite_bank(0xc000, 0xdfff, "bank4");
154      program->unmap_readwrite(0xe000, 0xe7ff);
153      program.install_readwrite_bank(0xc000, 0xdfff, "bank4");
154      program.unmap_readwrite(0xe000, 0xe7ff);
155155      membank("bank4")->set_entry(1);
156156      //logerror("0xc000-0xdfff = video RAM\n");
157157   }
158158   else
159159   {
160160      /* RAM */
161      program->install_readwrite_bank(0xc000, 0xe7ff, "bank4");
161      program.install_readwrite_bank(0xc000, 0xe7ff, "bank4");
162162      membank("bank4")->set_entry(0);
163163      //logerror("0xc000-0e7fff = RAM c000-e7fff\n");
164164   }
trunk/src/mess/drivers/pc9801.c
r18027r18028
26112611INTERRUPT_GEN_MEMBER(pc9801_state::pc9801_vrtc_irq)
26122612{
26132613   #if 0
2614   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2614   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
26152615   static UINT8 test;
26162616
26172617   if(machine().input().code_pressed_once(JOYCODE_BUTTON1))
trunk/src/mess/drivers/atari400.c
r18027r18028
759759      logerror("%s MMU BIOS ROM\n", machine.system().name);
760760      base3 = base + 0x14000;  /* 8K lo BIOS */
761761      base4 = base + 0x15800;  /* 4K FP ROM + 8K hi BIOS */
762      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc000, 0xcfff, "bank3");
763      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xc000, 0xcfff);
764      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xd800, 0xffff, "bank4");
765      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xd800, 0xffff);
762      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xcfff, "bank3");
763      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xc000, 0xcfff);
764      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xd800, 0xffff, "bank4");
765      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xd800, 0xffff);
766766   }
767767   else
768768   {
769769      logerror("%s MMU BIOS RAM\n", machine.system().name);
770770      base3 = base + 0x0c000;  /* 8K RAM */
771771      base4 = base + 0x0d800;  /* 4K RAM + 8K RAM */
772      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xc000, 0xcfff, "bank3");
773      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xd800, 0xffff, "bank4");
772      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xc000, 0xcfff, "bank3");
773      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xd800, 0xffff, "bank4");
774774   }
775775   machine.root_device().membank("bank3")->set_base(base3);
776776   machine.root_device().membank("bank4")->set_base(base4);
r18027r18028
779779   if( new_mmu & 0x02 )
780780   {
781781      logerror("%s MMU BASIC RAM\n", machine.system().name);
782      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xa000, 0xbfff, "bank1");
782      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xa000, 0xbfff, "bank1");
783783      base1 = base + 0x0a000;  /* 8K RAM */
784784   }
785785   else
786786   {
787787      logerror("%s MMU BASIC ROM\n", machine.system().name);
788      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xa000, 0xbfff, "bank1");
789      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xa000, 0xbfff);
788      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xbfff, "bank1");
789      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xa000, 0xbfff);
790790      base1 = base + 0x10000;  /* 8K BASIC */
791791   }
792792
r18027r18028
796796   if( new_mmu & 0x80 )
797797   {
798798      logerror("%s MMU SELFTEST RAM\n", machine.system().name);
799      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x5000, 0x57ff, "bank2");
799      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0x5000, 0x57ff, "bank2");
800800      base2 = base + 0x05000;  /* 0x0800 bytes */
801801   }
802802   else
803803   {
804804      logerror("%s MMU SELFTEST ROM\n", machine.system().name);
805      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x57ff, "bank2");
806      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x5000, 0x57ff);
805      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x57ff, "bank2");
806      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x5000, 0x57ff);
807807      base2 = base + 0x15000;  /* 0x0800 bytes */
808808   }
809809   machine.root_device().membank("bank2")->set_base(base2);
r18027r18028
821821      logerror("%s MMU BIOS ROM\n", machine.system().name);
822822      base3 = base + 0x14000;  /* 8K lo BIOS */
823823      base4 = base + 0x15800;  /* 4K FP ROM + 8K hi BIOS */
824      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc000, 0xcfff, "bank3");
825      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xc000, 0xcfff);
826      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xd800, 0xffff, "bank4");
827      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xd800, 0xffff);
824      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xcfff, "bank3");
825      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xc000, 0xcfff);
826      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xd800, 0xffff, "bank4");
827      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xd800, 0xffff);
828828   }
829829   else
830830   {
831831      logerror("%s MMU BIOS RAM\n", machine.system().name);
832832      base3 = base + 0x0c000;  /* 8K RAM */
833833      base4 = base + 0x0d800;  /* 4K RAM + 8K RAM */
834      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xc000, 0xcfff, "bank3");
835      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xd800, 0xffff, "bank4");
834      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xc000, 0xcfff, "bank3");
835      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xd800, 0xffff, "bank4");
836836   }
837837   machine.root_device().membank("bank3")->set_base(base3);
838838   machine.root_device().membank("bank4")->set_base(base4);
r18027r18028
842842   {
843843      logerror("%s MMU SELFTEST RAM\n", machine.system().name);
844844      base2 = base + 0x05000;  /* 0x0800 bytes */
845      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x5000, 0x57ff, "bank2");
845      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0x5000, 0x57ff, "bank2");
846846   }
847847   else
848848   {
849849      logerror("%s MMU SELFTEST ROM\n", machine.system().name);
850850      base2 = base + 0x15000;  /* 0x0800 bytes */
851      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x57ff, "bank2");
852      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x5000, 0x57ff);
851      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x57ff, "bank2");
852      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x5000, 0x57ff);
853853   }
854854   machine.root_device().membank("bank2")->set_base(base2);
855855}
r18027r18028
865865      logerror("%s MMU BIOS ROM\n", machine.system().name);
866866      base3 = base + 0x14000;  /* 8K lo BIOS */
867867      base4 = base + 0x15800;  /* 4K FP ROM + 8K hi BIOS */
868      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xc000, 0xcfff, "bank3");
869      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xc000, 0xcfff);
870      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xd800, 0xffff, "bank4");
871      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xd800, 0xffff);
868      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xcfff, "bank3");
869      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xc000, 0xcfff);
870      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xd800, 0xffff, "bank4");
871      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xd800, 0xffff);
872872   }
873873   else
874874   {
875875      logerror("%s MMU BIOS RAM\n", machine.system().name);
876876      base3 = base + 0x0c000;  /* 8K RAM */
877877      base4 = base + 0x0d800;  /* 4K RAM + 8K RAM */
878      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xc000, 0xcfff, "bank3");
879      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0xd800, 0xffff, "bank4");
878      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xc000, 0xcfff, "bank3");
879      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0xd800, 0xffff, "bank4");
880880   }
881881   machine.root_device().membank("bank3")->set_base(base3);
882882   machine.root_device().membank("bank4")->set_base(base4);
r18027r18028
886886   if( new_mmu & 0x80 )
887887   {
888888      logerror("%s MMU SELFTEST RAM\n", machine.system().name);
889      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_bank(0x5000, 0x57ff, "bank2");
889      machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_bank(0x5000, 0x57ff, "bank2");
890890      base2 = base + 0x05000;  /* 0x0800 bytes */
891891   }
892892   else
893893   {
894894      logerror("%s MMU SELFTEST ROM\n", machine.system().name);
895      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x5000, 0x57ff, "bank2");
896      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x5000, 0x57ff);
895      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x5000, 0x57ff, "bank2");
896      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x5000, 0x57ff);
897897      base2 = base + 0x15000;  /* 0x0800 bytes */
898898   }
899899   machine.root_device().membank("bank2")->set_base(base2);
trunk/src/mess/drivers/mc1000.c
r18027r18028
2626
2727void mc1000_state::bankswitch()
2828{
29   address_space *program = m_maincpu->space(AS_PROGRAM);
29   address_space &program = m_maincpu->space(AS_PROGRAM);
3030
3131   /* MC6845 video RAM */
3232   membank("bank2")->set_entry(m_mc6845_bank);
r18027r18028
3434   /* extended RAM */
3535   if (m_ram->size() > 16*1024)
3636   {
37      program->install_readwrite_bank(0x4000, 0x7fff, "bank3");
37      program.install_readwrite_bank(0x4000, 0x7fff, "bank3");
3838   }
3939   else
4040   {
41      program->unmap_readwrite(0x4000, 0x7fff);
41      program.unmap_readwrite(0x4000, 0x7fff);
4242   }
4343
4444   /* MC6847 video RAM */
r18027r18028
4646   {
4747      if (m_ram->size() > 16*1024)
4848      {
49         program->install_readwrite_bank(0x8000, 0x97ff, "bank4");
49         program.install_readwrite_bank(0x8000, 0x97ff, "bank4");
5050      }
5151      else
5252      {
53         program->unmap_readwrite(0x8000, 0x97ff);
53         program.unmap_readwrite(0x8000, 0x97ff);
5454      }
5555   }
5656   else
5757   {
58      program->install_readwrite_bank(0x8000, 0x97ff, "bank4");
58      program.install_readwrite_bank(0x8000, 0x97ff, "bank4");
5959   }
6060
6161   membank("bank4")->set_entry(m_mc6847_bank);
r18027r18028
6363   /* extended RAM */
6464   if (m_ram->size() > 16*1024)
6565   {
66      program->install_readwrite_bank(0x9800, 0xbfff, "bank5");
66      program.install_readwrite_bank(0x9800, 0xbfff, "bank5");
6767   }
6868   else
6969   {
70      program->unmap_readwrite(0x9800, 0xbfff);
70      program.unmap_readwrite(0x9800, 0xbfff);
7171   }
7272}
7373
r18027r18028
323323
324324void mc1000_state::machine_start()
325325{
326   address_space *program = m_maincpu->space(AS_PROGRAM);
326   address_space &program = m_maincpu->space(AS_PROGRAM);
327327
328328   /* setup memory banking */
329329   UINT8 *rom = memregion(Z80_TAG)->base();
330330
331   program->install_readwrite_bank(0x0000, 0x1fff, "bank1");
331   program.install_readwrite_bank(0x0000, 0x1fff, "bank1");
332332   membank("bank1")->configure_entry(0, rom);
333333   membank("bank1")->configure_entry(1, rom + 0xc000);
334334   membank("bank1")->set_entry(1);
335335
336336   m_rom0000 = 1;
337337
338   program->install_readwrite_bank(0x2000, 0x27ff, "bank2");
338   program.install_readwrite_bank(0x2000, 0x27ff, "bank2");
339339   membank("bank2")->configure_entry(0, rom + 0x2000);
340340   membank("bank2")->configure_entry(1, m_mc6845_video_ram);
341341   membank("bank2")->set_entry(0);
r18027r18028
499499DRIVER_INIT_MEMBER(mc1000_state,mc1000)
500500{
501501
502   machine().device(Z80_TAG)->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(mc1000_state::mc1000_direct_update_handler), this));
502   machine().device(Z80_TAG)->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mc1000_state::mc1000_direct_update_handler), this));
503503}
504504
505505/* System Drivers */
trunk/src/mess/drivers/adam.c
r18027r18028
245245
246246void adam_state::bankswitch()
247247{
248   address_space *program = m_maincpu->space(AS_PROGRAM);
248   address_space &program = m_maincpu->space(AS_PROGRAM);
249249   UINT8 *ram = m_ram->pointer();
250250
251251   switch (m_mioc & 0x03)
r18027r18028
253253   case LO_SMARTWRITER:
254254      if (BIT(m_adamnet, 1))
255255      {
256         program->unmap_readwrite(0x0000, 0x5fff);
257         program->install_rom(0x6000, 0x7fff, memregion("wp")->base() + 0x8000);
256         program.unmap_readwrite(0x0000, 0x5fff);
257         program.install_rom(0x6000, 0x7fff, memregion("wp")->base() + 0x8000);
258258      }
259259      else
260260      {
261         program->install_rom(0x0000, 0x7fff, memregion("wp")->base());
261         program.install_rom(0x0000, 0x7fff, memregion("wp")->base());
262262      }
263263      break;
264264
265265   case LO_INTERNAL_RAM:
266      program->install_ram(0x0000, 0x7fff, ram);
266      program.install_ram(0x0000, 0x7fff, ram);
267267      break;
268268
269269   case LO_RAM_EXPANSION:
270270      if (m_ram->size() > 64 * 1024)
271         program->install_ram(0x0000, 0x7fff, ram + 0x10000);
271         program.install_ram(0x0000, 0x7fff, ram + 0x10000);
272272      else
273         program->unmap_readwrite(0x0000, 0x7fff);
273         program.unmap_readwrite(0x0000, 0x7fff);
274274      break;
275275
276276   case LO_OS7_ROM_INTERNAL_RAM:
277      program->install_rom(0x0000, 0x1fff, memregion("os7")->base());
278      program->install_ram(0x2000, 0x7fff, ram + 0x2000);
277      program.install_rom(0x0000, 0x1fff, memregion("os7")->base());
278      program.install_ram(0x2000, 0x7fff, ram + 0x2000);
279279      break;
280280   }
281281
282282   switch ((m_mioc >> 2) & 0x03)
283283   {
284284   case HI_INTERNAL_RAM:
285      program->install_ram(0x8000, 0xffff, ram + 0x8000);
285      program.install_ram(0x8000, 0xffff, ram + 0x8000);
286286      break;
287287
288288   case HI_ROM_EXPANSION:
289      program->install_rom(0x8000, 0xffff, memregion("xrom")->base());
289      program.install_rom(0x8000, 0xffff, memregion("xrom")->base());
290290      break;
291291
292292   case HI_RAM_EXPANSION:
293293      if (m_game)
294294      {
295         program->install_rom(0x8000, 0xffff, memregion("cart")->base());
295         program.install_rom(0x8000, 0xffff, memregion("cart")->base());
296296      }
297297      else
298298      {
299299         if (m_ram->size() > 64 * 1024)
300            program->install_ram(0x8000, 0xffff, ram + 0x18000);
300            program.install_ram(0x8000, 0xffff, ram + 0x18000);
301301         else
302            program->unmap_readwrite(0x8000, 0xffff);
302            program.unmap_readwrite(0x8000, 0xffff);
303303      }
304304      break;
305305
306306   case HI_CARTRIDGE_ROM:
307      program->install_rom(0x8000, 0xffff, memregion("cart")->base());
307      program.install_rom(0x8000, 0xffff, memregion("cart")->base());
308308      break;
309309   }
310310}
trunk/src/mess/drivers/msbc1.c
r18027r18028
6565
6666void msbc1_state::machine_reset()
6767{
68   void *ram = machine().firstcpu->space(AS_PROGRAM)->get_write_ptr(0);
68   void *ram = machine().firstcpu->space(AS_PROGRAM).get_write_ptr(0);
6969   UINT8 *rom = memregion(MC68000R12_TAG)->base();
7070
7171   memcpy(ram, rom, 8);
trunk/src/mess/drivers/unixpc.c
r18027r18028
7171
7272void unixpc_state::machine_reset()
7373{
74   address_space *program = m_maincpu->space(AS_PROGRAM);
74   address_space &program = m_maincpu->space(AS_PROGRAM);
7575
7676   // force ROM into lower mem on reset
77   romlmap_w(*program, 0, 0, 0xffff);
77   romlmap_w(program, 0, 0, 0xffff);
7878
7979   // reset cpu so that it can pickup the new values
8080   m_maincpu->reset();
trunk/src/mess/drivers/mc80.c
r18027r18028
137137static TIMER_DEVICE_CALLBACK( mc8020_kbd )
138138{
139139   device_t *cpu = timer.machine().device( "maincpu" );
140   address_space *mem = cpu->memory().space(AS_PROGRAM);
140   address_space &mem = cpu->memory().space(AS_PROGRAM);
141141   char kbdrow[6];
142142   UINT8 i;
143143   for (i = 1; i < 8; i++)
144144   {
145145      sprintf(kbdrow,"X%X", i);
146      mem->write_word(0xd20+i, timer.machine().root_device().ioport(kbdrow)->read());
146      mem.write_word(0xd20+i, timer.machine().root_device().ioport(kbdrow)->read());
147147   }
148148}
149149
trunk/src/mess/drivers/pc88va.c
r18027r18028
651651
652652static void tsp_sprite_enable(running_machine &machine, UINT32 spr_offset, UINT8 sw_bit)
653653{
654   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
654   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
655655
656656   space.write_word(spr_offset, space.read_word(spr_offset) & ~0x200);
657657   space.write_word(spr_offset, space.read_word(spr_offset) | (sw_bit & 0x200));
trunk/src/mess/drivers/pc6001.c
r18027r18028
20692069static TIMER_DEVICE_CALLBACK(keyboard_callback)
20702070{
20712071   pc6001_state *state = timer.machine().driver_data<pc6001_state>();
2072   address_space &space = *timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
2072   address_space &space = timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
20732073   UINT32 key1 = timer.machine().root_device().ioport("key1")->read();
20742074   UINT32 key2 = timer.machine().root_device().ioport("key2")->read();
20752075   UINT32 key3 = timer.machine().root_device().ioport("key3")->read();
trunk/src/mess/drivers/pc1512.c
r18027r18028
888888
889889READ8_MEMBER( pc1512_state::memr_r )
890890{
891   address_space *program = m_maincpu->space(AS_PROGRAM);
891   address_space &program = m_maincpu->space(AS_PROGRAM);
892892   offs_t page_offset = m_dma_page[m_dma_channel] << 16;
893893
894   return program->read_byte(page_offset + offset);
894   return program.read_byte(page_offset + offset);
895895}
896896
897897WRITE8_MEMBER( pc1512_state::memw_w )
898898{
899   address_space *program = m_maincpu->space(AS_PROGRAM);
899   address_space &program = m_maincpu->space(AS_PROGRAM);
900900   offs_t page_offset = m_dma_page[m_dma_channel] << 16;
901901
902   program->write_byte(page_offset + offset, data);
902   program.write_byte(page_offset + offset, data);
903903}
904904
905905READ8_MEMBER( pc1512_state::ior1_r )
r18027r18028
12101210
12111211   if (ram_size < 640 * 1024)
12121212   {
1213      address_space *program = m_maincpu->space(AS_PROGRAM);
1214      program->unmap_readwrite(ram_size, 0x9ffff);
1213      address_space &program = m_maincpu->space(AS_PROGRAM);
1214      program.unmap_readwrite(ram_size, 0x9ffff);
12151215   }
12161216
12171217   // state saving
trunk/src/mess/drivers/spc1000.c
r18027r18028
224224
225225void spc1000_state::machine_reset()
226226{
227   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
227   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
228228   UINT8 *mem = memregion("maincpu")->base();
229229   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
230230
trunk/src/mess/drivers/pipbug.c
r18027r18028
9292
9393QUICKLOAD_LOAD( pipbug )
9494{
95   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
95   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
9696   int i;
9797   int quick_addr = 0x0440;
9898   int exec_addr;
trunk/src/mess/drivers/vii.c
r18027r18028
217217static void vii_blit(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 xoff, UINT32 yoff, UINT32 attr, UINT32 ctrl, UINT32 bitmap_addr, UINT16 tile)
218218{
219219   vii_state *state = machine.driver_data<vii_state>();
220   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
220   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
221221
222222   UINT32 h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
223223   UINT32 w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
r18027r18028
293293   UINT32 tilemap = regs[4];
294294   UINT32 palette_map = regs[5];
295295   UINT32 h, w, hn, wn;
296   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
296   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
297297
298298   if(!(ctrl & PAGE_ENABLE_MASK))
299299   {
r18027r18028
355355static void vii_blit_sprite(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, UINT32 base_addr)
356356{
357357   vii_state *state = machine.driver_data<vii_state>();
358   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
358   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
359359   UINT16 tile, attr;
360360   INT16 x, y;
361361   UINT32 h, w;
r18027r18028
445445
446446void vii_state::vii_do_dma(UINT32 len)
447447{
448   address_space *mem = m_maincpu->space(AS_PROGRAM);
448   address_space &mem = m_maincpu->space(AS_PROGRAM);
449449   UINT32 src = m_video_regs[0x70];
450450   UINT32 dst = m_video_regs[0x71] + 0x2c00;
451451   UINT32 j;
452452
453453   for(j = 0; j < len; j++)
454454   {
455      mem->write_word((dst+j) << 1, mem->read_word((src+j) << 1));
455      mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1));
456456   }
457457
458458   m_video_regs[0x72] = 0;
r18027r18028
616616
617617void vii_state::spg_do_dma(UINT32 len)
618618{
619   address_space *mem = m_maincpu->space(AS_PROGRAM);
619   address_space &mem = m_maincpu->space(AS_PROGRAM);
620620
621621   UINT32 src = ((m_io_regs[0x101] & 0x3f) << 16) | m_io_regs[0x100];
622622   UINT32 dst = m_io_regs[0x103] & 0x3fff;
623623   UINT32 j;
624624
625625   for(j = 0; j < len; j++)
626      mem->write_word((dst+j) << 1, mem->read_word((src+j) << 1));
626      mem.write_word((dst+j) << 1, mem.read_word((src+j) << 1));
627627
628628   m_io_regs[0x102] = 0;
629629}
trunk/src/mess/drivers/pes.c
r18027r18028
114114static void data_from_i8031(device_t *device, int data)
115115{
116116   pes_state *state = device->machine().driver_data<pes_state>();
117   state->m_terminal->write(*device->machine().memory().first_space(),0,data);
117   state->m_terminal->write(device->machine().driver_data()->generic_space(),0,data);
118118#ifdef DEBUG_SERIAL_CB
119119   fprintf(stderr,"callback: output from i8031/pes to pc/terminal: %02X\n",data);
120120#endif
trunk/src/mess/drivers/x1.c
r18027r18028
19371937
19381938INPUT_CHANGED_MEMBER(x1_state::ipl_reset)
19391939{
1940   //address_space &space = *machine().device("x1_cpu")->memory().space(AS_PROGRAM);
1940   //address_space &space = machine().device("x1_cpu")->memory().space(AS_PROGRAM);
19411941
19421942   m_x1_cpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE);
19431943
r18027r18028
24042404TIMER_DEVICE_CALLBACK(x1_keyboard_callback)
24052405{
24062406   x1_state *state = timer.machine().driver_data<x1_state>();
2407   address_space &space = *timer.machine().device("x1_cpu")->memory().space(AS_PROGRAM);
2407   address_space &space = timer.machine().device("x1_cpu")->memory().space(AS_PROGRAM);
24082408   UINT32 key1 = timer.machine().root_device().ioport("key1")->read();
24092409   UINT32 key2 = timer.machine().root_device().ioport("key2")->read();
24102410   UINT32 key3 = timer.machine().root_device().ioport("key3")->read();
trunk/src/mess/drivers/palm.c
r18027r18028
120120
121121void palm_state::machine_start()
122122{
123   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
123   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
124124   space.install_read_bank (0x000000, machine().device<ram_device>(RAM_TAG)->size() - 1, machine().device<ram_device>(RAM_TAG)->size() - 1, 0, "bank1");
125125   space.install_write_bank(0x000000, machine().device<ram_device>(RAM_TAG)->size() - 1, machine().device<ram_device>(RAM_TAG)->size() - 1, 0, "bank1");
126126   membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
trunk/src/mess/drivers/xor100.c
r18027r18028
5757
5858void xor100_state::bankswitch()
5959{
60   address_space *program = m_maincpu->space(AS_PROGRAM);
60   address_space &program = m_maincpu->space(AS_PROGRAM);
6161   int banks = m_ram->size() / 0x10000;
6262
6363   switch (m_mode)
r18027r18028
6565   case EPROM_0000:
6666      if (m_bank < banks)
6767      {
68         program->install_write_bank(0x0000, 0xffff, "bank1");
68         program.install_write_bank(0x0000, 0xffff, "bank1");
6969         membank("bank1")->set_entry(1 + m_bank);
7070      }
7171      else
7272      {
73         program->unmap_write(0x0000, 0xffff);
73         program.unmap_write(0x0000, 0xffff);
7474      }
7575
76      program->install_read_bank(0x0000, 0xf7ff, 0x07ff, 0, "bank2");
77      program->install_read_bank(0xf800, 0xffff, "bank3");
76      program.install_read_bank(0x0000, 0xf7ff, 0x07ff, 0, "bank2");
77      program.install_read_bank(0xf800, 0xffff, "bank3");
7878      membank("bank2")->set_entry(0);
7979      membank("bank3")->set_entry(0);
8080      break;
r18027r18028
8282   case EPROM_F800:
8383      if (m_bank < banks)
8484      {
85         program->install_write_bank(0x0000, 0xffff, "bank1");
86         program->install_read_bank(0x0000, 0xf7ff, "bank2");
85         program.install_write_bank(0x0000, 0xffff, "bank1");
86         program.install_read_bank(0x0000, 0xf7ff, "bank2");
8787         membank("bank1")->set_entry(1 + m_bank);
8888         membank("bank2")->set_entry(1 + m_bank);
8989      }
9090      else
9191      {
92         program->unmap_write(0x0000, 0xffff);
93         program->unmap_read(0x0000, 0xf7ff);
92         program.unmap_write(0x0000, 0xffff);
93         program.unmap_read(0x0000, 0xf7ff);
9494      }
9595
96      program->install_read_bank(0xf800, 0xffff, "bank3");
96      program.install_read_bank(0xf800, 0xffff, "bank3");
9797      membank("bank3")->set_entry(0);
9898      break;
9999
100100   case EPROM_OFF:
101101      if (m_bank < banks)
102102      {
103         program->install_write_bank(0x0000, 0xffff, "bank1");
104         program->install_read_bank(0x0000, 0xf7ff, "bank2");
105         program->install_read_bank(0xf800, 0xffff, "bank3");
103         program.install_write_bank(0x0000, 0xffff, "bank1");
104         program.install_read_bank(0x0000, 0xf7ff, "bank2");
105         program.install_read_bank(0xf800, 0xffff, "bank3");
106106         membank("bank1")->set_entry(1 + m_bank);
107107         membank("bank2")->set_entry(1 + m_bank);
108108         membank("bank3")->set_entry(1 + m_bank);
109109      }
110110      else
111111      {
112         program->unmap_write(0x0000, 0xffff);
113         program->unmap_read(0x0000, 0xf7ff);
114         program->unmap_read(0xf800, 0xffff);
112         program.unmap_write(0x0000, 0xffff);
113         program.unmap_read(0x0000, 0xf7ff);
114         program.unmap_read(0xf800, 0xffff);
115115      }
116116      break;
117117   }
trunk/src/mess/drivers/d6800.c
r18027r18028
320320
321321static QUICKLOAD_LOAD( d6800 )
322322{
323   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
323   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
324324   int i;
325325   int quick_addr = 0x0200;
326326   int exec_addr = 0xc000;
trunk/src/mess/drivers/fp1100.c
r18027r18028
175175   irq_mask = data;
176176   ///printf("%02x\n",data);
177177   // FIXME - the below 2 lines are needed, otherwise nothing ever gets written to videoram
178   address_space *mem = m_subcpu->space(AS_PROGRAM);
179   data = mem->read_byte(0xe800);
178   address_space &mem = m_subcpu->space(AS_PROGRAM);
179   data = mem.read_byte(0xe800);
180180}
181181
182182WRITE8_MEMBER( fp1100_state::main_to_sub_w )
trunk/src/mess/drivers/tmc600.c
r18027r18028
237237
238238void tmc600_state::machine_start()
239239{
240   address_space *program = m_maincpu->space(AS_PROGRAM);
240   address_space &program = m_maincpu->space(AS_PROGRAM);
241241
242242   /* configure RAM */
243243   switch (m_ram->size())
244244   {
245245   case 8*1024:
246      program->unmap_readwrite(0x8000, 0xbfff);
246      program.unmap_readwrite(0x8000, 0xbfff);
247247      break;
248248
249249   case 16*1024:
250      program->unmap_readwrite(0xa000, 0xbfff);
250      program.unmap_readwrite(0xa000, 0xbfff);
251251      break;
252252   }
253253
trunk/src/mess/drivers/poly.c
r18027r18028
161161{
162162   m_term_data = data;
163163   //m_term_key = 1;
164   address_space *mem = m_maincpu->space(AS_PROGRAM);
165   mem->write_byte(0xebec, data); // this has to be 0xecf1 for bios 1
166   mem->write_byte(0xebd0, 1); // any non-zero here
164   address_space &mem = m_maincpu->space(AS_PROGRAM);
165   mem.write_byte(0xebec, data); // this has to be 0xecf1 for bios 1
166   mem.write_byte(0xebd0, 1); // any non-zero here
167167}
168168
169169static ASCII_KEYBOARD_INTERFACE( keyboard_intf )
trunk/src/mess/drivers/ace.c
r18027r18028
590590
591591void ace_state::machine_start()
592592{
593   address_space *program = m_maincpu->space(AS_PROGRAM);
593   address_space &program = m_maincpu->space(AS_PROGRAM);
594594
595595   /* configure RAM */
596596   switch (m_ram->size())
597597   {
598598   case 1*1024:
599      program->unmap_readwrite(0x4000, 0xffff);
599      program.unmap_readwrite(0x4000, 0xffff);
600600      break;
601601
602602   case 16*1024:
603      program->unmap_readwrite(0x8000, 0xffff);
603      program.unmap_readwrite(0x8000, 0xffff);
604604      break;
605605
606606   case 32*1024:
607      program->unmap_readwrite(0xc000, 0xffff);
607      program.unmap_readwrite(0xc000, 0xffff);
608608      break;
609609   }
610610}
trunk/src/mess/drivers/scorpion.c
r18027r18028
326326{
327327   UINT8 *messram = machine().device<ram_device>(RAM_TAG)->pointer();
328328   device_t *beta = machine().device(BETA_DISK_TAG);
329   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
329   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
330330
331331   m_ram_0000 = NULL;
332332   space.install_read_bank(0x0000, 0x3fff, "bank1");
trunk/src/mess/drivers/spectrum.c
r18027r18028
620620
621621DRIVER_INIT_MEMBER(spectrum_state,spectrum)
622622{
623   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
623   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
624624
625625   switch (machine().device<ram_device>(RAM_TAG)->size())
626626   {
r18027r18028
633633
634634MACHINE_RESET_MEMBER(spectrum_state,spectrum)
635635{
636   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
636   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
637637
638638   space.set_direct_update_handler(direct_update_delegate(FUNC(spectrum_state::spectrum_direct), this));
639639
trunk/src/mess/drivers/mpf1.c
r18027r18028
479479DRIVER_INIT_MEMBER(mpf1_state,mpf1)
480480{
481481
482   m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(mpf1_state::mpf1_direct_update_handler), this));
482   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mpf1_state::mpf1_direct_update_handler), this));
483483}
484484
485485COMP( 1979, mpf1,  0,    0, mpf1, mpf1, mpf1_state,  mpf1, "Multitech", "Micro Professor 1", 0)
trunk/src/mess/drivers/astrocde.c
r18027r18028
100100INPUT_CHANGED_MEMBER(astrocde_mess_state::set_write_protect)  // run when RAM expansion write protect switch is changed
101101{
102102   int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
103<<<<<<< .mine
104   address_space &space = field.machine().device("maincpu")->memory().space(AS_PROGRAM);
105   UINT8 *expram = field.machine().device<ram_device>("ram_tag")->pointer();
106=======
103107   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
104108   UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer();
109>>>>>>> .r18023
105110
106111   get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
107112
r18027r18028
320325MACHINE_RESET_MEMBER(astrocde_mess_state, astrocde)
321326{
322327    int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
328<<<<<<< .mine
329    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
330    UINT8 *expram = machine.device<ram_device>("ram_tag")->pointer();
331=======
323332    address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
324333    UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer();
334>>>>>>> .r18023
325335    space.unmap_readwrite(0x5000, 0xffff);  // unmap any previously installed expansion RAM
326336
327337    get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
trunk/src/mess/drivers/plus4.c
r18027r18028
800800
801801READ8_MEMBER( plus4_state::exp_dma_r )
802802{
803   return m_maincpu->space(AS_PROGRAM)->read_byte(offset);
803   return m_maincpu->space(AS_PROGRAM).read_byte(offset);
804804}
805805
806806WRITE8_MEMBER( plus4_state::exp_dma_w )
807807{
808   m_maincpu->space(AS_PROGRAM)->write_byte(offset, data);
808   m_maincpu->space(AS_PROGRAM).write_byte(offset, data);
809809}
810810
811811WRITE_LINE_MEMBER( plus4_state::exp_irq_w )
trunk/src/mess/drivers/cat.c
r18027r18028
355355
356356static TIMER_CALLBACK( swyft_reset )
357357{
358   memset(machine.device("maincpu")->memory().space(AS_PROGRAM)->get_read_ptr(0xe2341), 0xff, 1);
358   memset(machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(0xe2341), 0xff, 1);
359359}
360360
361361MACHINE_START_MEMBER(cat_state,swyft)
trunk/src/mess/drivers/atarist.c
r18027r18028
6767   if (m_fdc_fifo_empty[m_fdc_fifo_sel]) return;
6868
6969   if (m_fdc_dmabytes) {
70      address_space *program = m_maincpu->space(AS_PROGRAM);
70      address_space &program = m_maincpu->space(AS_PROGRAM);
7171      for (int i = 0; i < 8; i++) {
7272         UINT16 data = m_fdc_fifo[m_fdc_fifo_sel][i];
7373
7474         if (LOG) logerror("Flushing DMA FIFO %u data %04x to address %06x\n", m_fdc_fifo_sel, data, m_dma_base);
7575
7676         if(m_dma_base >= 8)
77            program->write_word(m_dma_base, data);
77            program.write_word(m_dma_base, data);
7878         m_dma_base += 2;
7979      }
8080      m_fdc_dmabytes -= 16;
r18027r18028
9898void st_state::fill_dma_fifo()
9999{
100100   if (m_fdc_dmabytes) {
101      address_space *program = m_maincpu->space(AS_PROGRAM);
101      address_space &program = m_maincpu->space(AS_PROGRAM);
102102      for (int i = 0; i < 8; i++) {
103         UINT16 data = program->read_word(m_dma_base);
103         UINT16 data = program.read_word(m_dma_base);
104104
105105         if (LOG) logerror("Filling DMA FIFO %u with data %04x from memory address %06x\n", m_fdc_fifo_sel, data, m_dma_base);
106106
r18027r18028
21422142
21432143void st_state::configure_memory()
21442144{
2145   address_space *program = m_maincpu->space(AS_PROGRAM);
2145   address_space &program = m_maincpu->space(AS_PROGRAM);
21462146
21472147   switch (m_ram->size())
21482148   {
21492149   case 256 * 1024:
2150      program->unmap_readwrite(0x040000, 0x3fffff);
2150      program.unmap_readwrite(0x040000, 0x3fffff);
21512151      break;
21522152
21532153   case 512 * 1024:
2154      program->unmap_readwrite(0x080000, 0x3fffff);
2154      program.unmap_readwrite(0x080000, 0x3fffff);
21552155      break;
21562156
21572157   case 1024 * 1024:
2158      program->unmap_readwrite(0x100000, 0x3fffff);
2158      program.unmap_readwrite(0x100000, 0x3fffff);
21592159      break;
21602160
21612161   case 2048 * 1024:
2162      program->unmap_readwrite(0x200000, 0x3fffff);
2162      program.unmap_readwrite(0x200000, 0x3fffff);
21632163      break;
21642164   }
21652165}
r18027r18028
22922292void stbook_state::machine_start()
22932293{
22942294   /* configure RAM banking */
2295   address_space *program = m_maincpu->space(AS_PROGRAM);
2295   address_space &program = m_maincpu->space(AS_PROGRAM);
22962296
22972297   switch (m_ram->size())
22982298   {
22992299   case 1024 * 1024:
2300      program->unmap_readwrite(0x100000, 0x3fffff);
2300      program.unmap_readwrite(0x100000, 0x3fffff);
23012301      break;
23022302   }
23032303
trunk/src/mess/drivers/sg1000.c
r18027r18028
642642
643643void sg1000_state::install_cartridge(UINT8 *ptr, int size)
644644{
645   address_space *program = m_maincpu->space(AS_PROGRAM);
645   address_space &program = m_maincpu->space(AS_PROGRAM);
646646
647647   switch (size)
648648   {
649649   case 40 * 1024:
650      program->install_read_bank(0x8000, 0x9fff, "bank1");
651      program->unmap_write(0x8000, 0x9fff);
650      program.install_read_bank(0x8000, 0x9fff, "bank1");
651      program.unmap_write(0x8000, 0x9fff);
652652      membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base() + 0x8000);
653653      membank("bank1")->set_entry(0);
654654      break;
655655
656656   case 48 * 1024:
657      program->install_read_bank(0x8000, 0xbfff, "bank1");
658      program->unmap_write(0x8000, 0xbfff);
657      program.install_read_bank(0x8000, 0xbfff, "bank1");
658      program.unmap_write(0x8000, 0xbfff);
659659      membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base() + 0x8000);
660660      membank("bank1")->set_entry(0);
661661      break;
r18027r18028
663663   default:
664664      if (IS_CARTRIDGE_TV_DRAW(ptr))
665665      {
666         program->install_write_handler(0x6000, 0x6000, 0, 0, write8_delegate(FUNC(sg1000_state::tvdraw_axis_w), this), 0);
667         program->install_read_handler(0x8000, 0x8000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_status_r), this), 0);
668         program->install_read_handler(0xa000, 0xa000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_data_r), this), 0);
669         program->nop_write(0xa000, 0xa000);
666         program.install_write_handler(0x6000, 0x6000, 0, 0, write8_delegate(FUNC(sg1000_state::tvdraw_axis_w), this), 0);
667         program.install_read_handler(0x8000, 0x8000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_status_r), this), 0);
668         program.install_read_handler(0xa000, 0xa000, 0, 0, read8_delegate(FUNC(sg1000_state::tvdraw_data_r), this), 0);
669         program.nop_write(0xa000, 0xa000);
670670      }
671671      else if (IS_CARTRIDGE_THE_CASTLE(ptr))
672672      {
673         program->install_readwrite_bank(0x8000, 0x9fff, "bank1");
673         program.install_readwrite_bank(0x8000, 0x9fff, "bank1");
674674      }
675675      break;
676676   }
r18027r18028
684684{
685685   running_machine &machine = image.device().machine();
686686   sg1000_state *state = machine.driver_data<sg1000_state>();
687   address_space *program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM);
687   address_space &program = machine.device(Z80_TAG)->memory().space(AS_PROGRAM);
688688   UINT8 *ptr = state->memregion(Z80_TAG)->base();
689689   UINT32 ram_size = 0x400;
690690   bool install_2000_ram = false;
r18027r18028
781781
782782   if ( install_2000_ram )
783783   {
784      program->install_ram(0x2000, 0x3FFF);
784      program.install_ram(0x2000, 0x3FFF);
785785   }
786786
787787   /* work RAM banking */
788   program->install_readwrite_bank(0xc000, 0xc000 + ram_size - 1, 0, 0x4000 - ram_size, "bank2");
788   program.install_readwrite_bank(0xc000, 0xc000 + ram_size - 1, 0, 0x4000 - ram_size, "bank2");
789789
790790   return IMAGE_INIT_PASS;
791791}
r18027r18028
825825
826826void sc3000_state::install_cartridge(UINT8 *ptr, int size)
827827{
828   address_space *program = m_maincpu->space(AS_PROGRAM);
828   address_space &program = m_maincpu->space(AS_PROGRAM);
829829
830830   /* include SG-1000 mapping */
831831   sg1000_state::install_cartridge(ptr, size);
832832
833833   if (IS_CARTRIDGE_BASIC_LEVEL_III(ptr))
834834   {
835      program->install_readwrite_bank(0x8000, 0xbfff, "bank1");
836      program->install_readwrite_bank(0xc000, 0xffff, "bank2");
835      program.install_readwrite_bank(0x8000, 0xbfff, "bank1");
836      program.install_readwrite_bank(0xc000, 0xffff, "bank2");
837837   }
838838   else if (IS_CARTRIDGE_MUSIC_EDITOR(ptr))
839839   {
840      program->install_readwrite_bank(0x8000, 0x9fff, "bank1");
841      program->install_readwrite_bank(0xc000, 0xc7ff, 0, 0x3800, "bank2");
840      program.install_readwrite_bank(0x8000, 0x9fff, "bank1");
841      program.install_readwrite_bank(0xc000, 0xc7ff, 0, 0x3800, "bank2");
842842   }
843843   else
844844   {
845845      /* regular cartridges */
846      program->install_readwrite_bank(0xc000, 0xc7ff, 0, 0x3800, "bank2");
846      program.install_readwrite_bank(0xc000, 0xc7ff, 0, 0x3800, "bank2");
847847   }
848848}
849849
trunk/src/mess/drivers/ip22.c
r18027r18028
12611261static void scsi_irq(running_machine &machine, int state)
12621262{
12631263   ip22_state *drvstate = machine.driver_data<ip22_state>();
1264   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1264   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
12651265
12661266   if (state)
12671267   {
trunk/src/mess/drivers/px8.c
r18027r18028
7575
7676void px8_state::bankswitch()
7777{
78   address_space *program = m_maincpu->space(AS_PROGRAM);
78   address_space &program = m_maincpu->space(AS_PROGRAM);
7979   UINT8 *ram = m_ram->pointer();
8080   UINT8 *ipl_rom = memregion(UPD70008_TAG)->base();
8181
8282   if (!m_bank0)
8383   {
8484      /* IPL ROM */
85      program->install_rom(0x0000, 0x7fff, ipl_rom);
85      program.install_rom(0x0000, 0x7fff, ipl_rom);
8686   }
8787   else
8888   {
8989      if (m_bk2)
9090      {
9191         /* D-RAM (L) */
92         program->install_ram(0x0000, 0x7fff, ram);
92         program.install_ram(0x0000, 0x7fff, ram);
9393      }
9494      else
9595      {
9696         /* OPTION ROM (L) */
97         program->unmap_readwrite(0x0000, 0x7fff);
97         program.unmap_readwrite(0x0000, 0x7fff);
9898      }
9999   }
100100
101101   if (m_bk2)
102102   {
103103      /* D-RAM (H) */
104      program->install_ram(0x8000, 0xffff, ram + 0x8000);
104      program.install_ram(0x8000, 0xffff, ram + 0x8000);
105105   }
106106   else
107107   {
108108      /* OPTION ROM (H) */
109      program->unmap_readwrite(0x8000, 0xffff);
109      program.unmap_readwrite(0x8000, 0xffff);
110110   }
111111}
112112
trunk/src/mess/drivers/mikromik.c
r18027r18028
757757
758758void mm1_state::machine_reset()
759759{
760   address_space *program = m_maincpu->space(AS_PROGRAM);
760   address_space &program = m_maincpu->space(AS_PROGRAM);
761761   int i;
762762
763763   // reset LS259
764   for (i = 0; i < 8; i++) ls259_w(*program, i, 0);
764   for (i = 0; i < 8; i++) ls259_w(program, i, 0);
765765
766766   // set FDC ready
767767   if (!ioport("T5")->read()) upd765_ready_w(m_fdc, 1);
trunk/src/mess/drivers/a2600.c
r18027r18028
783783{
784784   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 )
785785   {
786      modeF6_switch_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), ( address & 0x1FFF ) - 0x1FF6, 0 );
786      modeF6_switch_w(machine().device("maincpu")->memory().space(AS_PROGRAM), ( address & 0x1FFF ) - 0x1FF6, 0 );
787787   }
788788   return address;
789789}
r18027r18028
11291129      m_bank_base[1] = memregion("user1")->base() + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
11301130      membank("bank1")->set_base(m_bank_base[1] );
11311131      /* and restore old opbase handler */
1132      machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(m_FE_old_opbase_handler);
1132      machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(m_FE_old_opbase_handler);
11331133   }
11341134   else
11351135   {
r18027r18028
11421142static void modeFE_switch(running_machine &machine,UINT16 offset, UINT8 data)
11431143{
11441144   a2600_state *state = machine.driver_data<a2600_state>();
1145   address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
1145   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
11461146   /* Retrieve last byte read by the cpu (for this mapping scheme this
11471147       should be the last byte that was on the data bus
11481148    */
r18027r18028
12901290         "bank4",
12911291      };
12921292
1293      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(
1293      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(
12941294         0x1000 + (i + 0) * 0x1000 / count - 0,
12951295         0x1000 + (i + 1) * 0x1000 / count - 1, handler[i]);
12961296
r18027r18028
17321732
17331733void a2600_state::machine_reset()
17341734{
1735   address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1735   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
17361736   int chip = 0xFF;
17371737   static const unsigned char snowwhite[] = { 0x10, 0xd0, 0xff, 0xff }; // Snow White Proto
17381738
trunk/src/mess/drivers/pcw.c
r18027r18028
234234static void pcw_update_read_memory_block(running_machine &machine, int block, int bank)
235235{
236236   pcw_state *state = machine.driver_data<pcw_state>();
237   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
237   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
238238   char block_name[10];
239239
240240   sprintf(block_name,"bank%d",block+1);
trunk/src/mess/drivers/osi.c
r18027r18028
674674
675675void sb2m600_state::machine_start()
676676{
677   address_space *program = m_maincpu->space(AS_PROGRAM);
677   address_space &program = m_maincpu->space(AS_PROGRAM);
678678
679679   /* configure RAM banking */
680680   membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base());
r18027r18028
683683   switch (m_ram->size())
684684   {
685685   case 4*1024:
686      program->install_readwrite_bank(0x0000, 0x0fff, "bank1");
687      program->unmap_readwrite(0x1000, 0x1fff);
686      program.install_readwrite_bank(0x0000, 0x0fff, "bank1");
687      program.unmap_readwrite(0x1000, 0x1fff);
688688      break;
689689
690690   case 8*1024:
691      program->install_readwrite_bank(0x0000, 0x1fff, "bank1");
691      program.install_readwrite_bank(0x0000, 0x1fff, "bank1");
692692      break;
693693   }
694694
r18027r18028
699699
700700void c1p_state::machine_start()
701701{
702   address_space *program = m_maincpu->space(AS_PROGRAM);
702   address_space &program = m_maincpu->space(AS_PROGRAM);
703703
704704   /* configure RAM banking */
705705   membank("bank1")->configure_entry(0, memregion(M6502_TAG)->base());
r18027r18028
708708   switch (m_ram->size())
709709   {
710710   case 8*1024:
711      program->install_readwrite_bank(0x0000, 0x1fff, "bank1");
712      program->unmap_readwrite(0x2000, 0x4fff);
711      program.install_readwrite_bank(0x0000, 0x1fff, "bank1");
712      program.unmap_readwrite(0x2000, 0x4fff);
713713      break;
714714
715715   case 20*1024:
716      program->install_readwrite_bank(0x0000, 0x4fff, "bank1");
716      program.install_readwrite_bank(0x0000, 0x4fff, "bank1");
717717      break;
718718   }
719719
trunk/src/mess/drivers/rex6000.c
r18027r18028
155155
156156WRITE8_MEMBER( rex6000_state::bankswitch_w )
157157{
158   address_space* program = m_maincpu->space(AS_PROGRAM);
158   address_space& program = m_maincpu->space(AS_PROGRAM);
159159
160160   m_bank[offset&3] = data;
161161
r18027r18028
170170
171171         if (m_banks[0].type != BANK_UNKNOWN)
172172         {
173            program->install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this));
173            program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this));
174174         }
175175         else
176176         {
177            program->unmap_readwrite(0x8000, 0x9fff);
177            program.unmap_readwrite(0x8000, 0x9fff);
178178         }
179179
180180         break;
r18027r18028
187187
188188         if (m_banks[1].type == BANK_RAM)
189189         {
190            program->install_ram(0xa000, 0xbfff, m_ram_base + ((m_banks[1].page & 0x03)<<13));
190            program.install_ram(0xa000, 0xbfff, m_ram_base + ((m_banks[1].page & 0x03)<<13));
191191         }
192192         else if (m_banks[1].type != BANK_UNKNOWN)
193193         {
194            program->install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this));
194            program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this));
195195         }
196196         else
197197         {
198            program->unmap_readwrite(0xa000, 0xbfff);
198            program.unmap_readwrite(0xa000, 0xbfff);
199199         }
200200
201201         break;
r18027r18028
452452}
453453void rex6000_state::machine_reset()
454454{
455   address_space* program = m_maincpu->space(AS_PROGRAM);
455   address_space& program = m_maincpu->space(AS_PROGRAM);
456456
457   program->install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this));
458   program->install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this));
457   program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this));
458   program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this));
459459
460460   m_banks[0].type = 0x04;
461461   m_banks[0].type = 0;
r18027r18028
493493            }
494494            else
495495            {
496               data =  m_flash[mem_type]->space(0)->read_byte(((lcd_bank & 0x7f)<<13) | (y*30 + x));
496               data =  m_flash[mem_type]->space(0).read_byte(((lcd_bank & 0x7f)<<13) | (y*30 + x));
497497            }
498498
499499
r18027r18028
569569{
570570   static const char magic[] = "ApplicationName:Addin";
571571   running_machine &machine = image.device().machine();
572   address_space* flash = machine.device("flash0b")->memory().space(0);
572   address_space& flash = machine.device("flash0b")->memory().space(0);
573573   UINT32 img_start = 0;
574574   UINT8 *data;
575575
r18027r18028
583583   img_start += 0xa0;   //skip the icon (40x32 pixel)
584584
585585   for (int i=0; i<image.length() - img_start ;i++)
586      flash->write_byte(i, data[img_start + i]);
586      flash.write_byte(i, data[img_start + i]);
587587
588588   auto_free(machine, data);
589589
trunk/src/mess/drivers/v1050.c
r18027r18028
126126
127127void v1050_state::bankswitch()
128128{
129   address_space *program = m_maincpu->space(AS_PROGRAM);
129   address_space &program = m_maincpu->space(AS_PROGRAM);
130130
131131   int bank = (m_bank >> 1) & 0x03;
132132
133133   if (BIT(m_bank, 0))
134134   {
135      program->install_readwrite_bank(0x0000, 0x1fff, "bank1");
135      program.install_readwrite_bank(0x0000, 0x1fff, "bank1");
136136      membank("bank1")->set_entry(bank);
137137   }
138138   else
139139   {
140      program->install_read_bank(0x0000, 0x1fff, "bank1");
141      program->unmap_write(0x0000, 0x1fff);
140      program.install_read_bank(0x0000, 0x1fff, "bank1");
141      program.unmap_write(0x0000, 0x1fff);
142142      membank("bank1")->set_entry(3);
143143   }
144144
r18027r18028
146146
147147   if (bank == 2)
148148   {
149      program->unmap_readwrite(0x4000, 0xbfff);
149      program.unmap_readwrite(0x4000, 0xbfff);
150150   }
151151   else
152152   {
153      program->install_readwrite_bank(0x4000, 0x7fff, "bank3");
154      program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
153      program.install_readwrite_bank(0x4000, 0x7fff, "bank3");
154      program.install_readwrite_bank(0x8000, 0xbfff, "bank4");
155155      membank("bank3")->set_entry(bank);
156156      membank("bank4")->set_entry(bank);
157157   }
r18027r18028
702702static WRITE8_DEVICE_HANDLER( misc_ppi_pb_w )
703703{
704704   centronics_device *centronics = device->machine().device<centronics_device>(CENTRONICS_TAG);
705   centronics->write( *device->machine().memory().first_space() , 0, ~data & 0xff);
705   centronics->write( device->machine().driver_data()->generic_space() , 0, ~data & 0xff);
706706}
707707
708708static READ8_DEVICE_HANDLER( misc_ppi_pc_r )
r18027r18028
10201020
10211021void v1050_state::machine_start()
10221022{
1023   address_space *program = m_maincpu->space(AS_PROGRAM);
1023   address_space &program = m_maincpu->space(AS_PROGRAM);
10241024
10251025   // initialize SASI bus
10261026   m_sasibus->init_scsibus(256);
r18027r18028
10421042   membank("bank1")->configure_entry(2, ram + 0x1c000);
10431043   membank("bank1")->configure_entry(3, memregion(Z80_TAG)->base());
10441044
1045   program->install_readwrite_bank(0x2000, 0x3fff, "bank2");
1045   program.install_readwrite_bank(0x2000, 0x3fff, "bank2");
10461046   membank("bank2")->configure_entries(0, 2, ram + 0x2000, 0x10000);
10471047   membank("bank2")->configure_entry(2, ram + 0x1e000);
10481048
1049   program->install_readwrite_bank(0x4000, 0x7fff, "bank3");
1049   program.install_readwrite_bank(0x4000, 0x7fff, "bank3");
10501050   membank("bank3")->configure_entries(0, 2, ram + 0x4000, 0x10000);
10511051
1052   program->install_readwrite_bank(0x8000, 0xbfff, "bank4");
1052   program.install_readwrite_bank(0x8000, 0xbfff, "bank4");
10531053   membank("bank4")->configure_entries(0, 2, ram + 0x8000, 0x10000);
10541054
1055   program->install_readwrite_bank(0xc000, 0xffff, "bank5");
1055   program.install_readwrite_bank(0xc000, 0xffff, "bank5");
10561056   membank("bank5")->configure_entries(0, 3, ram + 0xc000, 0);
10571057
10581058   bankswitch();
trunk/src/mess/drivers/ql.c
r18027r18028
907907
908908void ql_state::machine_reset()
909909{
910   address_space   *program   = m_maincpu->space(AS_PROGRAM);
910   address_space   &program   = m_maincpu->space(AS_PROGRAM);
911911
912912   m_disk_type=ioport(QL_CONFIG_PORT)->read() & DISK_TYPE_MASK;
913913   logerror("disktype=%d\n",m_disk_type);
r18027r18028
920920   switch (m_ram->size())
921921   {
922922      case 128*1024:
923         program->unmap_readwrite(0x040000, 0x0fffff);
923         program.unmap_readwrite(0x040000, 0x0fffff);
924924         break;
925925
926926      case 192*1024:
927         program->unmap_readwrite(0x050000, 0x0fffff);
927         program.unmap_readwrite(0x050000, 0x0fffff);
928928         break;
929929
930930      case 256*1024:
931         program->unmap_readwrite(0x060000, 0x0fffff);
931         program.unmap_readwrite(0x060000, 0x0fffff);
932932         break;
933933
934934      case 384*1024:
935         program->unmap_readwrite(0x080000, 0x0fffff);
935         program.unmap_readwrite(0x080000, 0x0fffff);
936936         break;
937937
938938      case 640*1024:
939         program->unmap_readwrite(0x0c0000, 0x0fffff);
939         program.unmap_readwrite(0x0c0000, 0x0fffff);
940940         break;
941941   }
942942
r18027r18028
944944   {
945945      case DISK_TYPE_SANDY :
946946         logerror("Configuring SandySuperDisk\n");
947         program->install_rom(0x0c0000, 0x0c3fff, &machine().root_device().memregion(M68008_TAG)->base()[SANDY_ROM_BASE]);
948         program->install_read_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this));
949         program->install_write_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this));
947         program.install_rom(0x0c0000, 0x0c3fff, &machine().root_device().memregion(M68008_TAG)->base()[SANDY_ROM_BASE]);
948         program.install_read_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this));
949         program.install_write_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this));
950950         m_disk_io_base=SANDY_IO_BASE;
951951         break;
952952      case DISK_TYPE_TRUMP :
953953         logerror("Configuring TrumpCard\n");
954         program->install_read_handler(CART_ROM_BASE, CART_ROM_END, 0, 0, read8_delegate(FUNC(ql_state::cart_rom_r), this));
955         program->install_read_handler(TRUMP_ROM_BASE, TRUMP_ROM_END, 0, 0, read8_delegate(FUNC(ql_state::trump_card_rom_r), this));
956         program->install_read_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this));
957         program->install_write_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this));
954         program.install_read_handler(CART_ROM_BASE, CART_ROM_END, 0, 0, read8_delegate(FUNC(ql_state::cart_rom_r), this));
955         program.install_read_handler(TRUMP_ROM_BASE, TRUMP_ROM_END, 0, 0, read8_delegate(FUNC(ql_state::trump_card_rom_r), this));
956         program.install_read_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this));
957         program.install_write_handler(TRUMP_IO_BASE, TRUMP_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this));
958958         m_disk_io_base=TRUMP_IO_BASE;
959959         break;
960960   }
trunk/src/mess/drivers/amiga.c
r18027r18028
550550      }
551551
552552      /* overlay disabled, map RAM on 0x000000 */
553      device->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x000000, state->m_chip_ram.bytes() - 1, 0, mirror_mask, "bank1");
553      device->machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x000000, state->m_chip_ram.bytes() - 1, 0, mirror_mask, "bank1");
554554
555555      /* if there is a cart region, check for cart overlay */
556556      if (device->machine().root_device().memregion("user2")->base() != NULL)
r18027r18028
558558   }
559559   else
560560      /* overlay enabled, map Amiga system ROM on 0x000000 */
561      device->machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x000000, state->m_chip_ram.bytes() - 1);
561      device->machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x000000, state->m_chip_ram.bytes() - 1);
562562
563563   set_led_status( device->machine(), 0, ( data & 2 ) ? 0 : 1 ); /* bit 2 = Power Led on Amiga */
564564   output_set_value("power_led", ( data & 2 ) ? 0 : 1);
r18027r18028
597597   if (machine.root_device().ioport("hardware")->read() & 0x08)
598598   {
599599      /* Install RTC */
600      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xdc0000, 0xdc003f, FUNC(amiga_clock_r), FUNC(amiga_clock_w));
600      machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0xdc0000, 0xdc003f, FUNC(amiga_clock_r), FUNC(amiga_clock_w));
601601   }
602602   else
603603   {
604604      /* No RTC support */
605      machine.device("maincpu")->memory().space(AS_PROGRAM)->unmap_readwrite(0xdc0000, 0xdc003f);
605      machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_readwrite(0xdc0000, 0xdc003f);
606606   }
607607}
608608
trunk/src/mess/drivers/abc80x.c
r18027r18028
192192
193193void abc800_state::bankswitch()
194194{
195   address_space *program = m_maincpu->space(AS_PROGRAM);
195   address_space &program = m_maincpu->space(AS_PROGRAM);
196196
197197   if (m_fetch_charram)
198198   {
199199      // HR video RAM selected
200      program->install_ram(0x0000, 0x3fff, m_video_ram);
200      program.install_ram(0x0000, 0x3fff, m_video_ram);
201201   }
202202   else
203203   {
204204      // BASIC ROM selected
205      program->install_rom(0x0000, 0x3fff, memregion(Z80_TAG)->base());
205      program.install_rom(0x0000, 0x3fff, memregion(Z80_TAG)->base());
206206   }
207207}
208208
r18027r18028
213213
214214void abc802_state::bankswitch()
215215{
216   address_space *program = m_maincpu->space(AS_PROGRAM);
216   address_space &program = m_maincpu->space(AS_PROGRAM);
217217
218218   if (m_lrs)
219219   {
220220      // ROM and video RAM selected
221      program->install_rom(0x0000, 0x77ff, memregion(Z80_TAG)->base());
222      program->install_ram(0x7800, 0x7fff, m_char_ram);
221      program.install_rom(0x0000, 0x77ff, memregion(Z80_TAG)->base());
222      program.install_ram(0x7800, 0x7fff, m_char_ram);
223223   }
224224   else
225225   {
226226      // low RAM selected
227      program->install_ram(0x0000, 0x7fff, m_ram->pointer());
227      program.install_ram(0x0000, 0x7fff, m_ram->pointer());
228228   }
229229}
230230
r18027r18028
235235
236236void abc806_state::bankswitch()
237237{
238   address_space *program = m_maincpu->space(AS_PROGRAM);
238   address_space &program = m_maincpu->space(AS_PROGRAM);
239239   UINT32 videoram_mask = m_ram->size() - (32 * 1024) - 1;
240240   int bank;
241241   char bank_name[10];
r18027r18028
256256         sprintf(bank_name,"bank%d",bank);
257257         //logerror("%04x-%04x: Video RAM %04x (32K)\n", start_addr, end_addr, videoram_offset);
258258
259         program->install_readwrite_bank(start_addr, end_addr, bank_name);
259         program.install_readwrite_bank(start_addr, end_addr, bank_name);
260260         membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset);
261261         membank(bank_name)->set_entry(1);
262262      }
r18027r18028
270270         sprintf(bank_name,"bank%d",bank);
271271         //logerror("%04x-%04x: Work RAM (32K)\n", start_addr, end_addr);
272272
273         program->install_readwrite_bank(start_addr, end_addr, bank_name);
273         program.install_readwrite_bank(start_addr, end_addr, bank_name);
274274         membank(bank_name)->set_entry(0);
275275      }
276276   }
r18027r18028
290290            // map to video RAM
291291            //logerror("%04x-%04x: Video RAM %04x (4K)\n", start_addr, end_addr, videoram_offset);
292292
293            program->install_readwrite_bank(start_addr, end_addr, bank_name);
293            program.install_readwrite_bank(start_addr, end_addr, bank_name);
294294            membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset);
295295            membank(bank_name)->set_entry(1);
296296         }
r18027r18028
304304               // ROM
305305               //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr);
306306
307               program->install_read_bank(start_addr, end_addr, bank_name);
308               program->unmap_write(start_addr, end_addr);
307               program.install_read_bank(start_addr, end_addr, bank_name);
308               program.unmap_write(start_addr, end_addr);
309309               membank(bank_name)->set_entry(0);
310310               break;
311311
r18027r18028
313313               // ROM/char RAM
314314               //logerror("%04x-%04x: ROM (4K)\n", start_addr, end_addr);
315315
316               program->install_read_bank(0x7000, 0x77ff, bank_name);
317               program->unmap_write(0x7000, 0x77ff);
318               program->install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate(FUNC(abc806_state::charram_r),this), write8_delegate(FUNC(abc806_state::charram_w),this));
316               program.install_read_bank(0x7000, 0x77ff, bank_name);
317               program.unmap_write(0x7000, 0x77ff);
318               program.install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate(FUNC(abc806_state::charram_r),this), write8_delegate(FUNC(abc806_state::charram_w),this));
319319               membank(bank_name)->set_entry(0);
320320               break;
321321
r18027r18028
323323               // work RAM
324324               //logerror("%04x-%04x: Work RAM (4K)\n", start_addr, end_addr);
325325
326               program->install_readwrite_bank(start_addr, end_addr, bank_name);
326               program.install_readwrite_bank(start_addr, end_addr, bank_name);
327327               membank(bank_name)->set_entry(0);
328328               break;
329329            }
r18027r18028
349349
350350         if (start_addr == 0x7000)
351351         {
352            program->install_readwrite_bank(0x7000, 0x77ff, bank_name);
353            program->install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate(FUNC(abc806_state::charram_r), this), write8_delegate(FUNC(abc806_state::charram_w), this));
352            program.install_readwrite_bank(0x7000, 0x77ff, bank_name);
353            program.install_readwrite_handler(0x7800, 0x7fff, 0, 0, read8_delegate(FUNC(abc806_state::charram_r), this), write8_delegate(FUNC(abc806_state::charram_w), this));
354354         }
355355         else
356356         {
357            program->install_readwrite_bank(start_addr, end_addr, bank_name);
357            program.install_readwrite_bank(start_addr, end_addr, bank_name);
358358         }
359359
360360         membank(bank_name)->configure_entry(1, m_video_ram + videoram_offset);
r18027r18028
14981498
14991499DRIVER_INIT_MEMBER(abc800c_state,driver_init)
15001500{
1501   m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(abc800c_state::direct_update_handler), this));
1501   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc800c_state::direct_update_handler), this));
15021502}
15031503
15041504
r18027r18028
15321532
15331533DRIVER_INIT_MEMBER(abc800m_state,driver_init)
15341534{
1535   m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(abc800m_state::direct_update_handler), this));
1535   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc800m_state::direct_update_handler), this));
15361536}
15371537
15381538
r18027r18028
15561556
15571557DRIVER_INIT_MEMBER(abc802_state,driver_init)
15581558{
1559   m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(abc802_state::direct_update_handler), this));
1559   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc802_state::direct_update_handler), this));
15601560}
15611561
15621562
r18027r18028
15901590
15911591DRIVER_INIT_MEMBER(abc806_state,driver_init)
15921592{
1593   m_maincpu->space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(abc806_state::direct_update_handler), this));
1593   m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(abc806_state::direct_update_handler), this));
15941594}
15951595
15961596
trunk/src/mess/drivers/a7000.c
r18027r18028
602602
603603void a7000_state::viddma_transfer_start()
604604{
605   address_space *mem = m_maincpu->space(AS_PROGRAM);
605   address_space &mem = m_maincpu->space(AS_PROGRAM);
606606   UINT32 src = m_viddma_addr_start;
607607   UINT32 dst = 0;
608608   UINT32 size = m_viddma_addr_end;
r18027r18028
612612   /* TODO: this should actually be a qword transfer */
613613   for(dma_index = 0;dma_index < size;dma_index++)
614614   {
615      vram[dst] = mem->read_byte(src);
615      vram[dst] = mem.read_byte(src);
616616
617617      src++;
618618      dst++;
trunk/src/mess/drivers/bigbord2.c
r18027r18028
417417
418418WRITE_LINE_MEMBER( bigbord2_state::frame )
419419{
420   address_space &space = *m_maincpu->space(AS_PROGRAM);
420   address_space &space = m_maincpu->space(AS_PROGRAM);
421421   static UINT8 framecnt;
422422   framecnt++;
423423
trunk/src/mess/drivers/tvc.c
r18027r18028
3232
3333void tvc_state::tvc_set_mem_page(UINT8 data)
3434{
35   address_space &space = *m_maincpu->space(AS_PROGRAM);
35   address_space &space = m_maincpu->space(AS_PROGRAM);
3636   switch(data & 0x18)
3737   {
3838      case 0x00 : // system ROM selected
trunk/src/mess/drivers/tmc1800.c
r18027r18028
167167
168168void tmc2000_state::bankswitch()
169169{
170   address_space *program = m_maincpu->space(AS_PROGRAM);
170   address_space &program = m_maincpu->space(AS_PROGRAM);
171171   UINT8 *ram = m_ram->pointer();
172172   UINT8 *rom = memregion(CDP1802_TAG)->base();
173173
174174   if (m_roc)
175175   {
176176      // monitor ROM
177      program->install_rom(0x0000, 0x01ff, 0, 0x7e00, rom);
177      program.install_rom(0x0000, 0x01ff, 0, 0x7e00, rom);
178178   }
179179   else
180180   {
r18027r18028
182182      switch (m_ram->size())
183183      {
184184      case 4 * 1024:
185         program->install_ram(0x0000, 0x0fff, 0, 0x7000, ram);
185         program.install_ram(0x0000, 0x0fff, 0, 0x7000, ram);
186186         break;
187187
188188      case 16 * 1024:
189         program->install_ram(0x0000, 0x3fff, 0, 0x4000, ram);
189         program.install_ram(0x0000, 0x3fff, 0, 0x4000, ram);
190190         break;
191191
192192      case 32 * 1024:
193         program->install_ram(0x0000, 0x7fff, ram);
193         program.install_ram(0x0000, 0x7fff, ram);
194194         break;
195195      }
196196   }
r18027r18028
198198   if (m_rac)
199199   {
200200      // color RAM
201      program->install_ram(0x8000, 0x81ff, 0, 0x7e00, m_colorram);
202      program->unmap_read(0x8000, 0x81ff, 0, 0x7e00);
201      program.install_ram(0x8000, 0x81ff, 0, 0x7e00, m_colorram);
202      program.unmap_read(0x8000, 0x81ff, 0, 0x7e00);
203203   }
204204   else
205205   {
206206      // monitor ROM
207      program->install_rom(0x8000, 0x81ff, 0, 0x7e00, rom);
207      program.install_rom(0x8000, 0x81ff, 0, 0x7e00, rom);
208208   }
209209}
210210
r18027r18028
220220WRITE8_MEMBER( nano_state::bankswitch_w )
221221{
222222   /* enable RAM */
223   address_space *program = m_maincpu->space(AS_PROGRAM);
223   address_space &program = m_maincpu->space(AS_PROGRAM);
224224   UINT8 *ram = m_ram->pointer();
225   program->install_ram(0x0000, 0x0fff, 0, 0x7000, ram);
225   program.install_ram(0x0000, 0x0fff, 0, 0x7000, ram);
226226
227227   /* write to CDP1864 tone latch */
228228   m_cti->tone_latch_w(space, 0, data);
r18027r18028
745745   m_cti->reset();
746746
747747   /* enable ROM */
748   address_space *program = m_maincpu->space(AS_PROGRAM);
748   address_space &program = m_maincpu->space(AS_PROGRAM);
749749   UINT8 *rom = memregion(CDP1802_TAG)->base();
750   program->install_rom(0x0000, 0x01ff, 0, 0x7e00, rom);
750   program.install_rom(0x0000, 0x01ff, 0, 0x7e00, rom);
751751}
752752
753753/* Machine Drivers */
trunk/src/mess/drivers/crvision.c
r18027r18028
853853   running_machine &machine = image.device().machine();
854854   crvision_state *state = machine.driver_data<crvision_state>();
855855   UINT8 *mem = state->memregion(M6502_TAG)->base();
856   address_space *program = machine.device(M6502_TAG)->memory().space(AS_PROGRAM);
856   address_space &program = machine.device(M6502_TAG)->memory().space(AS_PROGRAM);
857857
858858   if (image.software_entry() == NULL)
859859   {
r18027r18028
873873   case 0x1000: // 4K
874874      memcpy(mem + 0x9000, temp_copy, 0x1000);         // load 4KB at 0x9000
875875      memcpy(mem + 0xb000, mem + 0x9000, 0x1000);         // mirror 4KB at 0xb000
876      program->install_read_bank(0x8000, 0xbfff, 0, 0x2000, BANK_ROM1);
876      program.install_read_bank(0x8000, 0xbfff, 0, 0x2000, BANK_ROM1);
877877      break;
878878
879879   case 0x1800: // 6K
r18027r18028
883883      memcpy(mem + 0x8800, mem + 0x8000, 0x0800);         // mirror higher 2KB at 0x8800
884884      memcpy(mem + 0xa000, mem + 0x8000, 0x0800);         // mirror higher 2KB at 0xa000
885885      memcpy(mem + 0xa800, mem + 0x8000, 0x0800);         // mirror higher 2KB at 0xa800
886      program->install_read_bank(0x8000, 0xbfff, 0, 0x2000, BANK_ROM1);
886      program.install_read_bank(0x8000, 0xbfff, 0, 0x2000, BANK_ROM1);
887887      break;
888888
889889   case 0x2000: // 8K
890890      memcpy(mem + 0x8000, temp_copy, 0x2000);         // load 8KB at 0x8000
891891      memcpy(mem + 0xa000, mem + 0x8000, 0x2000);         // mirror 8KB at 0xa000
892      program->install_read_bank(0x8000, 0xbfff, 0, 0x2000, BANK_ROM1);
892      program.install_read_bank(0x8000, 0xbfff, 0, 0x2000, BANK_ROM1);
893893      break;
894894
895895   case 0x2800: // 10K
r18027r18028
903903      memcpy(mem + 0x6800, mem + 0x4000, 0x0800);         // mirror higher 2KB at 0x6800
904904      memcpy(mem + 0x7000, mem + 0x4000, 0x0800);         // mirror higher 2KB at 0x7000
905905      memcpy(mem + 0x7800, mem + 0x4000, 0x0800);         // mirror higher 2KB at 0x7800
906      program->install_read_bank(0x8000, 0xbfff, BANK_ROM1);
907      program->install_read_bank(0x4000, 0x7fff, BANK_ROM2);
906      program.install_read_bank(0x8000, 0xbfff, BANK_ROM1);
907      program.install_read_bank(0x4000, 0x7fff, BANK_ROM2);
908908      break;
909909
910910   case 0x3000: // 12K
r18027r18028
914914      memcpy(mem + 0x5000, mem + 0x4000, 0x1000);         // mirror higher 4KB at 0x5000
915915      memcpy(mem + 0x6000, mem + 0x4000, 0x1000);         // mirror higher 4KB at 0x6000
916916      memcpy(mem + 0x7000, mem + 0x4000, 0x1000);         // mirror higher 4KB at 0x7000
917      program->install_read_bank(0x8000, 0xbfff, BANK_ROM1);
918      program->install_read_bank(0x4000, 0x7fff, BANK_ROM2);
917      program.install_read_bank(0x8000, 0xbfff, BANK_ROM1);
918      program.install_read_bank(0x4000, 0x7fff, BANK_ROM2);
919919      break;
920920
921921   case 0x4000: // 16K
922922      memcpy(mem + 0xa000, temp_copy, 0x2000);         // load lower 8KB at 0xa000
923923      memcpy(mem + 0x8000, temp_copy + 0x2000, 0x2000);   // load higher 8KB at 0x8000
924      program->install_read_bank(0x8000, 0xbfff, BANK_ROM1);
925      program->install_read_bank(0x4000, 0x7fff, BANK_ROM2);
924      program.install_read_bank(0x8000, 0xbfff, BANK_ROM1);
925      program.install_read_bank(0x4000, 0x7fff, BANK_ROM2);
926926      break;
927927
928928   case 0x4800: // 18K
r18027r18028
936936      memcpy(mem + 0x6800, mem + 0x4000, 0x0800);         // mirror higher 2KB at 0x6800
937937      memcpy(mem + 0x7000, mem + 0x4000, 0x0800);         // mirror higher 2KB at 0x7000
938938      memcpy(mem + 0x7800, mem + 0x4000, 0x0800);         // mirror higher 2KB at 0x7800
939      program->install_read_bank(0x8000, 0xbfff, BANK_ROM1);
940      program->install_read_bank(0x4000, 0x7fff, BANK_ROM2);
939      program.install_read_bank(0x8000, 0xbfff, BANK_ROM1);
940      program.install_read_bank(0x4000, 0x7fff, BANK_ROM2);
941941      break;
942942
943943   default:
trunk/src/mess/drivers/fmtowns.c
r18027r18028
24592459   m_towns_cd.read_timer = machine().scheduler().timer_alloc(FUNC(towns_cdrom_read_byte), (void*)machine().device("dma_1"));
24602460
24612461   machine().device("maincpu")->execute().set_irq_acknowledge_callback(towns_irq_callback);
2462   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0x100000,machine().device<ram_device>(RAM_TAG)->size()-1,0xffffffff,0,NULL);
2462   machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0x100000,machine().device<ram_device>(RAM_TAG)->size()-1,0xffffffff,0,NULL);
24632463
24642464}
24652465
r18027r18028
24722472
24732473void towns_state::machine_reset()
24742474{
2475   address_space *program;
2476
24772475   m_maincpu = machine().device<cpu_device>("maincpu");
2478   program = m_maincpu->space(AS_PROGRAM);
2476   address_space &program = m_maincpu->space(AS_PROGRAM);
24792477   m_dma_1 = machine().device("dma_1");
24802478   m_dma_2 = machine().device("dma_2");
24812479   m_fdc = machine().device("fdc");
r18027r18028
24962494   m_towns_mainmem_enable = 0x00;
24972495   m_towns_system_port = 0x00;
24982496   m_towns_ram_enable = 0x00;
2499   towns_update_video_banks(*program);
2497   towns_update_video_banks(program);
25002498   m_towns_kb_status = 0x18;
25012499   m_towns_kb_irq1_enable = 0;
25022500   m_towns_pad_mask = 0x7f;
trunk/src/mess/drivers/newbrain.c
r18027r18028
5555/* Bank Switching */
5656
5757#define memory_install_unmapped(program, bank, bank_start, bank_end) \
58   program->unmap_readwrite(bank_start, bank_end);
58   program.unmap_readwrite(bank_start, bank_end);
5959
6060#define memory_install_rom_helper(program, bank, bank_start, bank_end) \
61   program->install_read_bank(bank_start, bank_end, bank); \
62   program->unmap_write(bank_start, bank_end);
61   program.install_read_bank(bank_start, bank_end, bank); \
62   program.unmap_write(bank_start, bank_end);
6363
6464#define memory_install_ram_helper(program, bank, bank_start, bank_end) \
65   program->install_readwrite_bank(bank_start, bank_end, bank);
65   program.install_readwrite_bank(bank_start, bank_end, bank);
6666
6767void newbrain_eim_state::bankswitch()
6868{
69   address_space *program = m_maincpu->space(AS_PROGRAM);
69   address_space &program = m_maincpu->space(AS_PROGRAM);
7070   int bank;
7171
7272   for (bank = 1; bank < 9; bank++)
r18027r18028
104104
105105void newbrain_state::bankswitch()
106106{
107   address_space *program = m_maincpu->space(AS_PROGRAM);
107   address_space &program = m_maincpu->space(AS_PROGRAM);
108108   int bank;
109109
110110   for (bank = 1; bank < 9; bank++)
trunk/src/mess/drivers/wangpc.c
r18027r18028
696696
697697READ8_MEMBER( wangpc_state::memr_r )
698698{
699   address_space *program = m_maincpu->space(AS_PROGRAM);
699   address_space &program = m_maincpu->space(AS_PROGRAM);
700700   offs_t addr = (m_dma_page[m_dack] << 16) | offset;
701701
702   return program->read_byte(addr);
702   return program.read_byte(addr);
703703}
704704
705705WRITE8_MEMBER( wangpc_state::memw_w )
706706{
707   address_space *program = m_maincpu->space(AS_PROGRAM);
707   address_space &program = m_maincpu->space(AS_PROGRAM);
708708   offs_t addr = (m_dma_page[m_dack] << 16) | offset;
709709
710   program->write_byte(addr, data);
710   program.write_byte(addr, data);
711711}
712712
713713READ8_MEMBER( wangpc_state::ior2_r )
trunk/src/mess/drivers/vboy.c
r18027r18028
14051405   {
14061406      state->m_nvptr = (UINT8 *)&state->m_vboy_sram;
14071407
1408      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x06000000, 0x0600ffff, read32_delegate(FUNC(vboy_state::sram_r),state));
1409      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x06000000, 0x0600ffff, write32_delegate(FUNC(vboy_state::sram_w),state));
1408      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x06000000, 0x0600ffff, read32_delegate(FUNC(vboy_state::sram_r),state));
1409      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x06000000, 0x0600ffff, write32_delegate(FUNC(vboy_state::sram_w),state));
14101410
14111411      image.battery_load(state->m_nvptr, 0x10000, 0x00);
14121412      state->m_nvimage = image;
trunk/src/mess/drivers/fk1.c
r18027r18028
293293
294294READ8_MEMBER( fk1_state::fk1_bank_ram_r )
295295{
296   address_space *space_mem = m_maincpu->space(AS_PROGRAM);
296   address_space &space_mem = m_maincpu->space(AS_PROGRAM);
297297   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
298298
299   space_mem->install_write_bank(0x0000, 0x3fff, "bank1");
299   space_mem.install_write_bank(0x0000, 0x3fff, "bank1");
300300   membank("bank1")->set_base(ram);
301301   membank("bank2")->set_base(ram + 0x4000);
302302   return 0;
r18027r18028
304304
305305READ8_MEMBER( fk1_state::fk1_bank_rom_r )
306306{
307   address_space *space_mem = m_maincpu->space(AS_PROGRAM);
308   space_mem->unmap_write(0x0000, 0x3fff);
307   address_space &space_mem = m_maincpu->space(AS_PROGRAM);
308   space_mem.unmap_write(0x0000, 0x3fff);
309309   membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
310310   membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x10000);
311311   return 0;
r18027r18028
423423
424424void fk1_state::machine_reset()
425425{
426   address_space &space = *m_maincpu->space(AS_PROGRAM);
426   address_space &space = m_maincpu->space(AS_PROGRAM);
427427   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
428428
429429   space.unmap_write(0x0000, 0x3fff);
trunk/src/mess/drivers/vtech1.c
r18027r18028
209209static SNAPSHOT_LOAD( vtech1 )
210210{
211211   vtech1_state *vtech1 = image.device().machine().driver_data<vtech1_state>();
212   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
212   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
213213   UINT8 i, header[24];
214214   UINT16 start, end, size;
215215   char pgmname[18];
r18027r18028
628628
629629DRIVER_INIT_MEMBER(vtech1_state,vtech1)
630630{
631   address_space *prg = machine().device("maincpu")->memory().space(AS_PROGRAM);
631   address_space &prg = machine().device("maincpu")->memory().space(AS_PROGRAM);
632632   int id;
633633
634634   /* ram */
r18027r18028
642642   if (m_ram_size == 18*1024 || m_ram_size == 22*1024 || m_ram_size == 32*1024)
643643   {
644644      offs_t base = 0x7800 + (m_ram_size - 0x4000);
645      prg->install_readwrite_bank(base, base + 0x3fff, "bank2");
645      prg.install_readwrite_bank(base, base + 0x3fff, "bank2");
646646      membank("bank2")->set_base(m_ram + base - 0x7800);
647647   }
648648
r18027r18028
650650   if (m_ram_size >= 66*1024)
651651   {
652652      /* install fixed first bank */
653      prg->install_readwrite_bank(0x8000, 0xbfff, "bank2");
653      prg.install_readwrite_bank(0x8000, 0xbfff, "bank2");
654654      membank("bank2")->set_base(m_ram + 0x800);
655655
656656      /* install the others, dynamically banked in */
657      prg->install_readwrite_bank(0xc000, 0xffff, "bank3");
657      prg.install_readwrite_bank(0xc000, 0xffff, "bank3");
658658      membank("bank3")->configure_entries(0, (m_ram_size - 0x4800) / 0x4000, m_ram + 0x4800, 0x4000);
659659      membank("bank3")->set_entry(0);
660660   }
r18027r18028
681681
682682DRIVER_INIT_MEMBER(vtech1_state,vtech1h)
683683{
684   address_space *prg = machine().device("maincpu")->memory().space(AS_PROGRAM);
684   address_space &prg = machine().device("maincpu")->memory().space(AS_PROGRAM);
685685
686686   DRIVER_INIT_CALL(vtech1);
687687
r18027r18028
689689   //m_videoram_size = 0x2000;
690690   //m_videoram = auto_alloc_array(machine(), UINT8, m_videoram_size);
691691
692   prg->install_readwrite_bank(0x7000, 0x77ff, "bank4");
692   prg.install_readwrite_bank(0x7000, 0x77ff, "bank4");
693693   membank("bank4")->configure_entries(0, 4, m_videoram, 0x800);
694694   membank("bank4")->set_entry(0);
695695}
trunk/src/mess/drivers/camplynx.c
r18027r18028
130130WRITE8_MEMBER( camplynx_state::lynx128k_bank_w )
131131{
132132   /* get address space */
133   address_space *mem = m_maincpu->space(AS_PROGRAM);
134   UINT8 *base = mem->machine().root_device().memregion("maincpu")->base();
133   address_space &mem = m_maincpu->space(AS_PROGRAM);
134   UINT8 *base = mem.machine().root_device().memregion("maincpu")->base();
135135
136136   /* Set read banks */
137137   UINT8 bank = data & 0x0f;
r18027r18028
330330
331331MACHINE_RESET_MEMBER(camplynx_state,lynx128k)
332332{
333   address_space *mem = m_maincpu->space(AS_PROGRAM);
334   mem->install_read_bank (0x0000, 0x1fff, "bank1");
335   mem->install_read_bank (0x2000, 0x3fff, "bank2");
336   mem->install_read_bank (0x4000, 0x5fff, "bank3");
337   mem->install_read_bank (0x6000, 0x7fff, "bank4");
338   mem->install_read_bank (0x8000, 0x9fff, "bank5");
339   mem->install_read_bank (0xa000, 0xbfff, "bank6");
340   mem->install_read_bank (0xc000, 0xdfff, "bank7");
341   mem->install_read_bank (0xe000, 0xffff, "bank8");
342   mem->install_write_bank (0x0000, 0x1fff, "bank11");
343   mem->install_write_bank (0x2000, 0x3fff, "bank12");
344   mem->install_write_bank (0x4000, 0x5fff, "bank13");
345   mem->install_write_bank (0x6000, 0x7fff, "bank14");
346   mem->install_write_bank (0x8000, 0x9fff, "bank15");
347   mem->install_write_bank (0xa000, 0xbfff, "bank16");
348   mem->install_write_bank (0xc000, 0xdfff, "bank17");
349   mem->install_write_bank (0xe000, 0xffff, "bank18");
333   address_space &mem = m_maincpu->space(AS_PROGRAM);
334   mem.install_read_bank (0x0000, 0x1fff, "bank1");
335   mem.install_read_bank (0x2000, 0x3fff, "bank2");
336   mem.install_read_bank (0x4000, 0x5fff, "bank3");
337   mem.install_read_bank (0x6000, 0x7fff, "bank4");
338   mem.install_read_bank (0x8000, 0x9fff, "bank5");
339   mem.install_read_bank (0xa000, 0xbfff, "bank6");
340   mem.install_read_bank (0xc000, 0xdfff, "bank7");
341   mem.install_read_bank (0xe000, 0xffff, "bank8");
342   mem.install_write_bank (0x0000, 0x1fff, "bank11");
343   mem.install_write_bank (0x2000, 0x3fff, "bank12");
344   mem.install_write_bank (0x4000, 0x5fff, "bank13");
345   mem.install_write_bank (0x6000, 0x7fff, "bank14");
346   mem.install_write_bank (0x8000, 0x9fff, "bank15");
347   mem.install_write_bank (0xa000, 0xbfff, "bank16");
348   mem.install_write_bank (0xc000, 0xdfff, "bank17");
349   mem.install_write_bank (0xe000, 0xffff, "bank18");
350350
351   lynx128k_bank_w(*mem, 0, 0);
351   lynx128k_bank_w(mem, 0, 0);
352352}
353353
354354WRITE8_MEMBER( camplynx_state::lynx128k_irq )
trunk/src/mess/drivers/ng_aes.c
r18027r18028
612612static void main_cpu_banking_init( running_machine &machine )
613613{
614614   ng_aes_state *state = machine.driver_data<ng_aes_state>();
615   address_space &mainspace = *machine.device("maincpu")->memory().space(AS_PROGRAM);
615   address_space &mainspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
616616
617617   /* create vector banks */
618618   state->membank(NEOGEO_BANK_VECTORS)->configure_entry(0, machine.root_device().memregion("mainbios")->base());
r18027r18028
753753   set_audio_cpu_banking(machine);
754754
755755   state->m_audio_cpu_rom_source_last = 0;
756   set_audio_cpu_rom_source(*machine.device("maincpu")->memory().space(AS_PROGRAM), 0);
756   set_audio_cpu_rom_source(machine.device("maincpu")->memory().space(AS_PROGRAM), 0);
757757}
758758
759759
r18027r18028
11491149   _set_main_cpu_bank_address(state->machine());
11501150   _set_main_cpu_vector_table_source(state->machine());
11511151   set_audio_cpu_banking(state->machine());
1152   _set_audio_cpu_rom_source(*state->machine().device("maincpu")->memory().space(AS_PROGRAM));
1152   _set_audio_cpu_rom_source(state->machine().device("maincpu")->memory().space(AS_PROGRAM));
11531153}
11541154
11551155static void common_machine_start(running_machine &machine)
r18027r18028
12541254MACHINE_RESET_MEMBER(ng_aes_state,neogeo)
12551255{
12561256   offs_t offs;
1257   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
1257   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
12581258
12591259   /* reset system control registers */
12601260   for (offs = 0; offs < 8; offs++)
trunk/src/mess/drivers/kyocera.c
r18027r18028
104104
105105void pc8201_state::bankswitch(UINT8 data)
106106{
107   address_space *program = m_maincpu->space(AS_PROGRAM);
107   address_space &program = m_maincpu->space(AS_PROGRAM);
108108
109109   int rom_bank = data & 0x03;
110110   int ram_bank = (data >> 2) & 0x03;
r18027r18028
114114   if (rom_bank > 1)
115115   {
116116      /* RAM */
117      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
117      program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
118118   }
119119   else
120120   {
121121      /* ROM */
122      program->install_read_bank(0x0000, 0x7fff, "bank1");
123      program->unmap_write(0x0000, 0x7fff);
122      program.install_read_bank(0x0000, 0x7fff, "bank1");
123      program.unmap_write(0x0000, 0x7fff);
124124   }
125125
126126   membank("bank1")->set_entry(rom_bank);
r18027r18028
130130   case 0:
131131      if (m_ram->size() > 16 * 1024)
132132      {
133         program->install_readwrite_bank(0x8000, 0xffff, "bank2");
133         program.install_readwrite_bank(0x8000, 0xffff, "bank2");
134134      }
135135      else
136136      {
137         program->unmap_readwrite(0x8000, 0xbfff);
138         program->install_readwrite_bank(0xc000, 0xffff, "bank2");
137         program.unmap_readwrite(0x8000, 0xbfff);
138         program.install_readwrite_bank(0xc000, 0xffff, "bank2");
139139      }
140140      break;
141141
142142   case 1:
143      program->unmap_readwrite(0x8000, 0xffff);
143      program.unmap_readwrite(0x8000, 0xffff);
144144      break;
145145
146146   case 2:
147147      if (m_ram->size() > 32 * 1024)
148         program->install_readwrite_bank(0x8000, 0xffff, "bank2");
148         program.install_readwrite_bank(0x8000, 0xffff, "bank2");
149149      else
150         program->unmap_readwrite(0x8000, 0xffff);
150         program.unmap_readwrite(0x8000, 0xffff);
151151      break;
152152
153153   case 3:
154154      if (m_ram->size() > 64 * 1024)
155         program->install_readwrite_bank(0x8000, 0xffff, "bank2");
155         program.install_readwrite_bank(0x8000, 0xffff, "bank2");
156156      else
157         program->unmap_readwrite(0x8000, 0xffff);
157         program.unmap_readwrite(0x8000, 0xffff);
158158      break;
159159   }
160160
r18027r18028
454454
455455void tandy200_state::bankswitch(UINT8 data)
456456{
457   address_space *program = m_maincpu->space(AS_PROGRAM);
457   address_space &program = m_maincpu->space(AS_PROGRAM);
458458
459459   int rom_bank = data & 0x03;
460460   int ram_bank = (data >> 2) & 0x03;
r18027r18028
464464   if (rom_bank == 3)
465465   {
466466      /* invalid ROM bank */
467      program->unmap_readwrite(0x0000, 0x7fff);
467      program.unmap_readwrite(0x0000, 0x7fff);
468468   }
469469   else
470470   {
471      program->install_read_bank(0x0000, 0x7fff, "bank1");
472      program->unmap_write(0x0000, 0x7fff);
471      program.install_read_bank(0x0000, 0x7fff, "bank1");
472      program.unmap_write(0x0000, 0x7fff);
473473      membank("bank1")->set_entry(rom_bank);
474474   }
475475
476476   if (m_ram->size() < ((ram_bank + 1) * 24 * 1024))
477477   {
478478      /* invalid RAM bank */
479      program->unmap_readwrite(0xa000, 0xffff);
479      program.unmap_readwrite(0xa000, 0xffff);
480480   }
481481   else
482482   {
483      program->install_readwrite_bank(0xa000, 0xffff, "bank2");
483      program.install_readwrite_bank(0xa000, 0xffff, "bank2");
484484      membank("bank2")->set_entry(ram_bank);
485485   }
486486}
r18027r18028
11271127
11281128void kc85_state::machine_start()
11291129{
1130   address_space *program = m_maincpu->space(AS_PROGRAM);
1130   address_space &program = m_maincpu->space(AS_PROGRAM);
11311131
11321132   /* initialize RTC */
11331133   m_rtc->cs_w(1);
11341134   m_rtc->oe_w(1);
11351135
11361136   /* configure ROM banking */
1137   program->install_read_bank(0x0000, 0x7fff, "bank1");
1138   program->unmap_write(0x0000, 0x7fff);
1137   program.install_read_bank(0x0000, 0x7fff, "bank1");
1138   program.unmap_write(0x0000, 0x7fff);
11391139   membank("bank1")->configure_entry(0, memregion(I8085_TAG)->base());
11401140   membank("bank1")->configure_entry(1, memregion("option")->base());
11411141   membank("bank1")->set_entry(0);
r18027r18028
11441144   switch (m_ram->size())
11451145   {
11461146   case 16 * 1024:
1147      program->unmap_readwrite(0x8000, 0xbfff);
1148      program->install_readwrite_bank(0xc000, 0xffff, "bank2");
1147      program.unmap_readwrite(0x8000, 0xbfff);
1148      program.install_readwrite_bank(0xc000, 0xffff, "bank2");
11491149      break;
11501150
11511151   case 32 * 1024:
1152      program->install_readwrite_bank(0x8000, 0xffff,"bank2");
1152      program.install_readwrite_bank(0x8000, 0xffff,"bank2");
11531153      break;
11541154   }
11551155
r18027r18028
11941194
11951195void trsm100_state::machine_start()
11961196{
1197   address_space *program = m_maincpu->space(AS_PROGRAM);
1197   address_space &program = m_maincpu->space(AS_PROGRAM);
11981198
11991199   /* initialize RTC */
12001200   m_rtc->cs_w(1);
12011201   m_rtc->oe_w(1);
12021202
12031203   /* configure ROM banking */
1204   program->install_read_bank(0x0000, 0x7fff, "bank1");
1205   program->unmap_write(0x0000, 0x7fff);
1204   program.install_read_bank(0x0000, 0x7fff, "bank1");
1205   program.unmap_write(0x0000, 0x7fff);
12061206   membank("bank1")->configure_entry(0, memregion(I8085_TAG)->base());
12071207   membank("bank1")->configure_entry(1, memregion("option")->base());
12081208   membank("bank1")->set_entry(0);
r18027r18028
12111211   switch (m_ram->size())
12121212   {
12131213   case 8 * 1024:
1214      program->unmap_readwrite(0x8000, 0xcfff);
1215      program->install_readwrite_bank(0xe000, 0xffff, "bank2");
1214      program.unmap_readwrite(0x8000, 0xcfff);
1215      program.install_readwrite_bank(0xe000, 0xffff, "bank2");
12161216      break;
12171217
12181218   case 16 * 1024:
1219      program->unmap_readwrite(0x8000, 0xbfff);
1220      program->install_readwrite_bank(0xc000, 0xffff, "bank2");
1219      program.unmap_readwrite(0x8000, 0xbfff);
1220      program.install_readwrite_bank(0xc000, 0xffff, "bank2");
12211221      break;
12221222
12231223   case 24 * 1024:
1224      program->unmap_readwrite(0x8000, 0x9fff);
1225      program->install_readwrite_bank(0xa000, 0xffff, "bank2");
1224      program.unmap_readwrite(0x8000, 0x9fff);
1225      program.install_readwrite_bank(0xa000, 0xffff, "bank2");
12261226      break;
12271227
12281228   case 32 * 1024:
1229      program->install_readwrite_bank(0x8000, 0xffff, "bank2");
1229      program.install_readwrite_bank(0x8000, 0xffff, "bank2");
12301230      break;
12311231   }
12321232
trunk/src/mess/drivers/bml3.c
r18027r18028
637637
638638void bml3_state::machine_reset()
639639{
640   address_space *mem = m_maincpu->space(AS_PROGRAM);
640   address_space &mem = m_maincpu->space(AS_PROGRAM);
641641
642642   /* defaults */
643   mem->install_rom(0xa000, 0xfeff,mem->machine().root_device().memregion("maincpu")->base() + 0xa000);
644   mem->install_rom(0xfff0, 0xffff,mem->machine().root_device().memregion("maincpu")->base() + 0xfff0);
645   mem->install_write_handler(0xa000, 0xbfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_a000_w), this),0);
646   mem->install_write_handler(0xc000, 0xdfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_c000_w), this),0);
647   mem->install_write_handler(0xe000, 0xefff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_e000_w), this),0);
648   mem->install_write_handler(0xf000, 0xfeff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_f000_w), this),0);
649   mem->install_write_handler(0xfff0, 0xffff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),0);
643   mem.install_rom(0xa000, 0xfeff,mem.machine().root_device().memregion("maincpu")->base() + 0xa000);
644   mem.install_rom(0xfff0, 0xffff,mem.machine().root_device().memregion("maincpu")->base() + 0xfff0);
645   mem.install_write_handler(0xa000, 0xbfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_a000_w), this),0);
646   mem.install_write_handler(0xc000, 0xdfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_c000_w), this),0);
647   mem.install_write_handler(0xe000, 0xefff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_e000_w), this),0);
648   mem.install_write_handler(0xf000, 0xfeff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_f000_w), this),0);
649   mem.install_write_handler(0xfff0, 0xffff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),0);
650650
651651   m_firq_mask = -1; // disable firq
652652}
r18027r18028
701701
702702WRITE8_MEMBER(bml3_state::bml3_piaA_w)
703703{
704   address_space *mem = m_maincpu->space(AS_PROGRAM);
704   address_space &mem = m_maincpu->space(AS_PROGRAM);
705705   /* ROM banking:
706706    -0-- --0- 0xa000 - 0xbfff ROM R RAM W
707707    -1-- --0- 0xa000 - 0xbfff RAM R/W
r18027r18028
721721   {
722722      if(data & 0x40)
723723      {
724         mem->install_readwrite_handler(0xa000, 0xbfff, 0, 0,
724         mem.install_readwrite_handler(0xa000, 0xbfff, 0, 0,
725725            read8_delegate(FUNC(bml3_state::bml3_a000_r), this),
726726            write8_delegate(FUNC(bml3_state::bml3_a000_w), this), 0);
727727      }
728728      else
729729      {
730         mem->install_rom(0xa000, 0xbfff,
731            mem->machine().root_device().memregion("maincpu")->base() + 0xa000);
732         mem->install_write_handler(0xa000, 0xbfff, 0, 0,
730         mem.install_rom(0xa000, 0xbfff,
731            mem.machine().root_device().memregion("maincpu")->base() + 0xa000);
732         mem.install_write_handler(0xa000, 0xbfff, 0, 0,
733733            write8_delegate(FUNC(bml3_state::bml3_a000_w), this),
734734            0);
735735      }
r18027r18028
739739   {
740740      if(data & 0x40)
741741      {
742         mem->install_readwrite_handler(0xc000, 0xdfff, 0, 0,
742         mem.install_readwrite_handler(0xc000, 0xdfff, 0, 0,
743743            read8_delegate(FUNC(bml3_state::bml3_c000_r), this),
744744            write8_delegate(FUNC(bml3_state::bml3_c000_w), this), 0);
745745      }
746746      else
747747      {
748         mem->install_rom(0xc000, 0xdfff,
749            mem->machine().root_device().memregion("maincpu")->base() + 0xc000);
750         mem->install_write_handler(0xc000, 0xdfff, 0, 0,
748         mem.install_rom(0xc000, 0xdfff,
749            mem.machine().root_device().memregion("maincpu")->base() + 0xc000);
750         mem.install_write_handler(0xc000, 0xdfff, 0, 0,
751751            write8_delegate(FUNC(bml3_state::bml3_c000_w), this),
752752            0);
753753      }
r18027r18028
757757   {
758758      if(data & 0x80)
759759      {
760         mem->install_readwrite_handler(0xe000, 0xefff, 0, 0,
760         mem.install_readwrite_handler(0xe000, 0xefff, 0, 0,
761761            read8_delegate(FUNC(bml3_state::bml3_e000_r), this),
762762            write8_delegate(FUNC(bml3_state::bml3_e000_w), this), 0);
763763      }
764764      else
765765      {
766         mem->install_rom(0xe000, 0xefff,
767            mem->machine().root_device().memregion("maincpu")->base() + 0xe000);
768         mem->install_write_handler(0xe000, 0xefff, 0, 0,
766         mem.install_rom(0xe000, 0xefff,
767            mem.machine().root_device().memregion("maincpu")->base() + 0xe000);
768         mem.install_write_handler(0xe000, 0xefff, 0, 0,
769769            write8_delegate(FUNC(bml3_state::bml3_e000_w), this),
770770            0);
771771      }
r18027r18028
773773
774774   if(data & 1)
775775   {
776      mem->install_readwrite_handler(0xf000, 0xfeff, 0, 0,
776      mem.install_readwrite_handler(0xf000, 0xfeff, 0, 0,
777777         read8_delegate(FUNC(bml3_state::bml3_f000_r), this),
778778         write8_delegate(FUNC(bml3_state::bml3_f000_w), this), 0);
779779   }
780780   else
781781   {
782      mem->install_rom(0xf000, 0xfeff,
783         mem->machine().root_device().memregion("maincpu")->base() + 0xf000);
784      mem->install_write_handler(0xf000, 0xfeff, 0, 0,
782      mem.install_rom(0xf000, 0xfeff,
783         mem.machine().root_device().memregion("maincpu")->base() + 0xf000);
784      mem.install_write_handler(0xf000, 0xfeff, 0, 0,
785785         write8_delegate(FUNC(bml3_state::bml3_f000_w), this),
786786         0);
787787   }
788788
789789   if(data & 2)
790790   {
791      mem->install_readwrite_handler(0xfff0, 0xffff, 0, 0,
791      mem.install_readwrite_handler(0xfff0, 0xffff, 0, 0,
792792         read8_delegate(FUNC(bml3_state::bml3_fff0_r), this),
793793         write8_delegate(FUNC(bml3_state::bml3_fff0_w), this), 0);
794794   }
795795   else
796796   {
797      mem->install_rom(0xfff0, 0xffff,
798         mem->machine().root_device().memregion("maincpu")->base() + 0xfff0);
799      mem->install_write_handler(0xfff0, 0xffff, 0, 0,
797      mem.install_rom(0xfff0, 0xffff,
798         mem.machine().root_device().memregion("maincpu")->base() + 0xfff0);
799      mem.install_write_handler(0xfff0, 0xffff, 0, 0,
800800         write8_delegate(FUNC(bml3_state::bml3_fff0_w), this),
801801         0);
802802   }
trunk/src/mess/drivers/psx.c
r18027r18028
431431   {
432432      device_t *cpu = machine().device("maincpu");
433433
434      machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(psx1_state::psx_default), this));
434      machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(psx1_state::psx_default), this));
435435
436436      if( load_psxexe( cpu, m_exe_buffer, m_exe_size ) ||
437437         load_cpe( cpu, m_exe_buffer, m_exe_size ) ||
r18027r18028
455455static QUICKLOAD_LOAD( psx_exe_load )
456456{
457457   psx1_state *state = image.device().machine().driver_data<psx1_state>();
458   address_space &space = *image.device().machine().device( "maincpu")->memory().space( AS_PROGRAM );
458   address_space &space = image.device().machine().device( "maincpu")->memory().space( AS_PROGRAM );
459459
460460   state->m_exe_size = 0;
461461   state->m_exe_buffer = (UINT8*)malloc( quickload_size );
trunk/src/mess/drivers/samcoupe.c
r18027r18028
167167
168168WRITE8_MEMBER(samcoupe_state::samcoupe_lmpr_w)
169169{
170   address_space &space_program = *machine().device("maincpu")->memory().space(AS_PROGRAM);
170   address_space &space_program = machine().device("maincpu")->memory().space(AS_PROGRAM);
171171
172172   m_lmpr = data;
173173   samcoupe_update_memory(space_program);
r18027r18028
180180
181181WRITE8_MEMBER(samcoupe_state::samcoupe_hmpr_w)
182182{
183   address_space &space_program = *machine().device("maincpu")->memory().space(AS_PROGRAM);
183   address_space &space_program = machine().device("maincpu")->memory().space(AS_PROGRAM);
184184
185185   m_hmpr = data;
186186   samcoupe_update_memory(space_program);
r18027r18028
193193
194194WRITE8_MEMBER(samcoupe_state::samcoupe_vmpr_w)
195195{
196   address_space &space_program = *machine().device("maincpu")->memory().space(AS_PROGRAM);
196   address_space &space_program = machine().device("maincpu")->memory().space(AS_PROGRAM);
197197
198198   m_vmpr = data;
199199   samcoupe_update_memory(space_program);
trunk/src/mess/drivers/z1013.c
r18027r18028
348348      return IMAGE_INIT_FAIL;
349349   }
350350
351   memcpy (image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->get_read_ptr(startaddr),
351   memcpy (image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(startaddr),
352352       data+0x20, endaddr - startaddr + 1);
353353
354354   if (runaddr)
trunk/src/mess/drivers/tiki100.c
r18027r18028
4444
4545void tiki100_state::bankswitch()
4646{
47   address_space *program = m_maincpu->space(AS_PROGRAM);
47   address_space &program = m_maincpu->space(AS_PROGRAM);
4848
4949   if (m_vire)
5050   {
5151      if (!m_rome)
5252      {
5353         /* reserved */
54         program->unmap_readwrite(0x0000, 0xffff);
54         program.unmap_readwrite(0x0000, 0xffff);
5555      }
5656      else
5757      {
5858         /* GFXRAM, GFXRAM, RAM */
59         program->install_readwrite_handler(0x0000, 0x7fff, read8_delegate(FUNC(tiki100_state::gfxram_r), this), write8_delegate(FUNC(tiki100_state::gfxram_w), this));
60         program->install_readwrite_bank(0x8000, 0xffff, "bank3");
59         program.install_readwrite_handler(0x0000, 0x7fff, read8_delegate(FUNC(tiki100_state::gfxram_r), this), write8_delegate(FUNC(tiki100_state::gfxram_w), this));
60         program.install_readwrite_bank(0x8000, 0xffff, "bank3");
6161
6262         membank("bank1")->set_entry(BANK_VIDEO_RAM);
6363         membank("bank2")->set_entry(BANK_VIDEO_RAM);
r18027r18028
6969      if (!m_rome)
7070      {
7171         /* ROM, RAM, RAM */
72         program->install_read_bank(0x0000, 0x3fff, "bank1");
73         program->unmap_write(0x0000, 0x3fff);
74         program->install_readwrite_bank(0x4000, 0x7fff, "bank2");
75         program->install_readwrite_bank(0x8000, 0xffff, "bank3");
72         program.install_read_bank(0x0000, 0x3fff, "bank1");
73         program.unmap_write(0x0000, 0x3fff);
74         program.install_readwrite_bank(0x4000, 0x7fff, "bank2");
75         program.install_readwrite_bank(0x8000, 0xffff, "bank3");
7676
7777         membank("bank1")->set_entry(BANK_ROM);
7878         membank("bank2")->set_entry(BANK_RAM);
r18027r18028
8181      else
8282      {
8383         /* RAM, RAM, RAM */
84         program->install_readwrite_bank(0x0000, 0x3fff, "bank1");
85         program->install_readwrite_bank(0x4000, 0x7fff, "bank2");
86         program->install_readwrite_bank(0x8000, 0xffff, "bank3");
84         program.install_readwrite_bank(0x0000, 0x3fff, "bank1");
85         program.install_readwrite_bank(0x4000, 0x7fff, "bank2");
86         program.install_readwrite_bank(0x8000, 0xffff, "bank3");
8787
8888         membank("bank1")->set_entry(BANK_RAM);
8989         membank("bank2")->set_entry(BANK_RAM);
trunk/src/mess/drivers/atm.c
r18027r18028
120120MACHINE_RESET_MEMBER(atm_state,atm)
121121{
122122   UINT8 *messram = machine().device<ram_device>(RAM_TAG)->pointer();
123   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
123   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
124124   device_t *beta = machine().device(BETA_DISK_TAG);
125125
126126   space.install_read_bank(0x0000, 0x3fff, "bank1");
trunk/src/mess/drivers/abc1600.c
r18027r18028
182182   else if (offset < 0x180000)
183183   {
184184      // video RAM
185      address_space &program = *m_maincpu->space(AS_PROGRAM);
185      address_space &program = m_maincpu->space(AS_PROGRAM);
186186      data = video_ram_r(program, offset);
187187   }
188188   else
r18027r18028
209209   else if (offset < 0x180000)
210210   {
211211      // video RAM
212      address_space &program = *m_maincpu->space(AS_PROGRAM);
212      address_space &program = m_maincpu->space(AS_PROGRAM);
213213      video_ram_w(program, offset, data);
214214   }
215215   else
r18027r18028
242242
243243UINT8 abc1600_state::read_internal_io(offs_t offset)
244244{
245   address_space &program = *m_maincpu->space(AS_PROGRAM);
245   address_space &program = m_maincpu->space(AS_PROGRAM);
246246   UINT8 data = 0;
247247
248248   if (X11)
r18027r18028
467467
468468void abc1600_state::write_internal_io(offs_t offset, UINT8 data)
469469{
470   address_space &program = *m_maincpu->space(AS_PROGRAM);
470   address_space &program = m_maincpu->space(AS_PROGRAM);
471471
472472   if (X11)
473473   {
r18027r18028
770770
771771UINT8 abc1600_state::read_supervisor_memory(offs_t offset)
772772{
773   address_space &program = *m_maincpu->space(AS_PROGRAM);
773   address_space &program = m_maincpu->space(AS_PROGRAM);
774774   UINT8 data = 0;
775775
776776   if (!A2 && !A1)
r18027r18028
799799
800800void abc1600_state::write_supervisor_memory(offs_t offset, UINT8 data)
801801{
802   address_space &program = *m_maincpu->space(AS_PROGRAM);
802   address_space &program = m_maincpu->space(AS_PROGRAM);
803803
804804   if (!A2 && !A1)
805805   {
r18027r18028
18791879
18801880void abc1600_state::machine_reset()
18811881{
1882   address_space &program = *m_maincpu->space(AS_PROGRAM);
1882   address_space &program = m_maincpu->space(AS_PROGRAM);
18831883
18841884   // clear special control register
18851885   for (int i = 0; i < 8; i++)
trunk/src/mess/drivers/sage2.c
r18027r18028
657657
658658DRIVER_INIT_MEMBER(sage2_state,sage2)
659659{
660   address_space *program = machine().device<cpu_device>(M68000_TAG)->space(AS_PROGRAM);
661   program->set_direct_update_handler(direct_update_delegate(FUNC(sage2_state::sage2_direct_update_handler), this));
660   address_space &program = machine().device<cpu_device>(M68000_TAG)->space(AS_PROGRAM);
661   program.set_direct_update_handler(direct_update_delegate(FUNC(sage2_state::sage2_direct_update_handler), this));
662662
663663   // patch out i8251 test
664664   machine().root_device().memregion(M68000_TAG)->base()[0x1be8] = 0xd6;
trunk/src/mess/drivers/vcs80.c
r18027r18028
255255
256256DRIVER_INIT_MEMBER(vcs80_state,vcs80)
257257{
258   machine().device(Z80_TAG)->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this));
259   machine().device(Z80_TAG)->memory().space(AS_IO)->set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this));
258   machine().device(Z80_TAG)->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this));
259   machine().device(Z80_TAG)->memory().space(AS_IO).set_direct_update_handler(direct_update_delegate(FUNC(vcs80_state::vcs80_direct_update_handler), this));
260260}
261261
262262/* System Drivers */
trunk/src/mess/drivers/itt3030.c
r18027r18028
5757
5858UINT32 itt3030_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
5959{
60   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
60   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
6161
6262   for(int y = 0; y < 24; y++ )
6363   {
trunk/src/mess/drivers/ob68k1a.c
r18027r18028
288288
289289void ob68k1a_state::machine_start()
290290{
291   address_space *program = m_maincpu->space(AS_PROGRAM);
291   address_space &program = m_maincpu->space(AS_PROGRAM);
292292
293293   // configure RAM
294294   switch (m_ram->size())
295295   {
296296   case 32*1024:
297      program->unmap_readwrite(0x008000, 0x01ffff);
297      program.unmap_readwrite(0x008000, 0x01ffff);
298298      break;
299299   }
300300}
r18027r18028
306306
307307void ob68k1a_state::machine_reset()
308308{
309   address_space *program = m_maincpu->space(AS_PROGRAM);
309   address_space &program = m_maincpu->space(AS_PROGRAM);
310310
311311   // initialize COM8116
312312//  m_dbrg->stt_w(program, 0, 0x01);
313313//  m_dbrg->str_w(program, 0, 0x01);
314314
315315   // set reset vector
316   void *ram = program->get_write_ptr(0);
316   void *ram = program.get_write_ptr(0);
317317   UINT8 *rom = memregion(MC68000L10_TAG)->base();
318318
319319   memcpy(ram, rom, 8);
trunk/src/mess/drivers/tandy2k.c
r18027r18028
4949
5050READ8_MEMBER( tandy2k_state::videoram_r )
5151{
52   address_space *program = m_maincpu->space(AS_PROGRAM);
52   address_space &program = m_maincpu->space(AS_PROGRAM);
5353
5454   offs_t addr = (m_vram_base << 15) | (offset << 1);
55   UINT16 data = program->read_word(addr);
55   UINT16 data = program.read_word(addr);
5656
5757   // character
5858   m_drb0->write(space, 0, data & 0xff);
r18027r18028
319319static CRT9007_DRAW_SCANLINE( tandy2k_crt9007_display_pixels )
320320{
321321    tandy2k_state *state = device->machine().driver_data<tandy2k_state>();
322    address_space *program = state->m_maincpu->space(AS_PROGRAM);
322    address_space &program = state->m_maincpu->space(AS_PROGRAM);
323323
324324    for (int sx = 0; sx < x_count; sx++)
325325    {
326326        UINT32 videoram_addr = ((state->m_vram_base << 15) | (va << 1)) + sx;
327        UINT8 videoram_data = program->read_word(videoram_addr);
327        UINT8 videoram_data = program.read_word(videoram_addr);
328328        UINT16 charram_addr = (videoram_data << 4) | sl;
329329        UINT8 charram_data = state->m_char_ram[charram_addr] & 0xff;
330330
r18027r18028
670670void tandy2k_state::machine_start()
671671{
672672   // memory banking
673   address_space *program = m_maincpu->space(AS_PROGRAM);
673   address_space &program = m_maincpu->space(AS_PROGRAM);
674674   UINT8 *ram = m_ram->pointer();
675675   int ram_size = m_ram->size();
676676
677   program->install_ram(0x00000, ram_size - 1, ram);
677   program.install_ram(0x00000, ram_size - 1, ram);
678678
679679   // patch out i186 relocation register check
680680   UINT8 *rom = memregion(I80186_TAG)->base();
trunk/src/mess/drivers/x07.c
r18027r18028
10421042{
10431043   running_machine &machine = image.device().machine();
10441044   x07_state *state = machine.driver_data<x07_state>();
1045   address_space &space = *state->m_maincpu->space( AS_PROGRAM );
1045   address_space &space = state->m_maincpu->space( AS_PROGRAM );
10461046   UINT16 ram_size = state->m_ram->size();
10471047
10481048   if (image.software_entry() == NULL)
r18027r18028
14541454   save_item(NAME(m_cursor.on));
14551455
14561456   /* install RAM */
1457   address_space *program = m_maincpu->space(AS_PROGRAM);
1458   program->install_ram(0x0000, m_ram->size() - 1, m_ram->pointer());
1457   address_space &program = m_maincpu->space(AS_PROGRAM);
1458   program.install_ram(0x0000, m_ram->size() - 1, m_ram->pointer());
14591459}
14601460
14611461void x07_state::machine_reset()
trunk/src/mess/drivers/nanos.c
r18027r18028
439439
440440void nanos_state::machine_reset()
441441{
442   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
442   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
443443
444444   space.install_write_bank(0x0000, 0x0fff, "bank3");
445445   space.install_write_bank(0x1000, 0xffff, "bank2");
trunk/src/mess/drivers/z9001.c
r18027r18028
145145static TIMER_DEVICE_CALLBACK( timer_callback )
146146{
147147   z9001_state *state = timer.machine().driver_data<z9001_state>();
148   state->m_maincpu->space(AS_PROGRAM)->write_byte(0x006a, 0);
148   state->m_maincpu->space(AS_PROGRAM).write_byte(0x006a, 0);
149149}
150150
151151void z9001_state::machine_reset()
r18027r18028
218218
219219WRITE8_MEMBER( z9001_state::kbd_put )
220220{
221   m_maincpu->space(AS_PROGRAM)->write_byte(0x0025, data);
221   m_maincpu->space(AS_PROGRAM).write_byte(0x0025, data);
222222}
223223
224224static ASCII_KEYBOARD_INTERFACE( keyboard_intf )
trunk/src/mess/drivers/pasopia7.c
r18027r18028
579579
580580   if(m_mio_sel)
581581   {
582      address_space *ram_space = m_maincpu->space(AS_PROGRAM);
582      address_space &ram_space = m_maincpu->space(AS_PROGRAM);
583583
584584      m_mio_sel = 0;
585585      //printf("%08x\n",offset);
586586      //return 0x0d; // hack: this is used for reading the keyboard data, we can fake it a little ... (modify fda4)
587      return ram_space->read_byte(offset);
587      return ram_space.read_byte(offset);
588588   }
589589
590590   io_port = offset & 0xff; //trim down to 8-bit bus
r18027r18028
630630
631631   if(m_mio_sel)
632632   {
633      address_space *ram_space = m_maincpu->space(AS_PROGRAM);
633      address_space &ram_space = m_maincpu->space(AS_PROGRAM);
634634      m_mio_sel = 0;
635      ram_space->write_byte(offset, data);
635      ram_space.write_byte(offset, data);
636636      return;
637637   }
638638
trunk/src/mess/drivers/fm7.c
r18027r18028
824824static void fm7_update_psg(running_machine &machine)
825825{
826826   fm7_state *state = machine.driver_data<fm7_state>();
827   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
827   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
828828
829829   if(state->m_type == SYS_FM7)
830830   {
r18027r18028
19631963   }
19641964   if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX || m_type == SYS_FM11)
19651965   {
1966      fm7_mmr_refresh(*machine().device("maincpu")->memory().space(AS_PROGRAM));
1966      fm7_mmr_refresh(machine().device("maincpu")->memory().space(AS_PROGRAM));
19671967   }
19681968   if(m_type == SYS_FM11)
19691969   {
trunk/src/mess/drivers/indiana.c
r18027r18028
8484DRIVER_INIT_MEMBER(indiana_state,indiana)
8585{
8686   pc_vga_init(machine(), indiana_vga_setting, NULL);
87   pc_vga_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x7f7a0000, *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x7f600000);
87   pc_vga_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0x7f7a0000, machine().device("maincpu")->memory().space(AS_PROGRAM), 0x7f600000);
8888}
8989
9090/* ROM definition */
trunk/src/mess/drivers/exp85.c
r18027r18028
190190
191191void exp85_state::machine_start()
192192{
193   address_space *program = m_maincpu->space(AS_PROGRAM);
193   address_space &program = m_maincpu->space(AS_PROGRAM);
194194
195195   /* setup memory banking */
196   program->install_read_bank(0x0000, 0x07ff, "bank1");
197   program->unmap_write(0x0000, 0x07ff);
196   program.install_read_bank(0x0000, 0x07ff, "bank1");
197   program.unmap_write(0x0000, 0x07ff);
198198   membank("bank1")->configure_entry(0, memregion(I8085A_TAG)->base() + 0xf000);
199199   membank("bank1")->configure_entry(1, memregion(I8085A_TAG)->base());
200200   membank("bank1")->set_entry(0);
trunk/src/mess/drivers/m5.c
r18027r18028
617617
618618void m5_state::machine_start()
619619{
620   address_space *program = m_maincpu->space(AS_PROGRAM);
620   address_space &program = m_maincpu->space(AS_PROGRAM);
621621
622622   // configure RAM
623623   switch (m_ram->size())
624624   {
625625   case 4*1024:
626      program->unmap_readwrite(0x8000, 0xffff);
626      program.unmap_readwrite(0x8000, 0xffff);
627627      break;
628628
629629   case 36*1024:
trunk/src/mess/drivers/a5105.c
r18027r18028
219219
220220WRITE8_MEMBER( a5105_state::a5105_memsel_w )
221221{
222   address_space *prog = m_maincpu->space( AS_PROGRAM );
222   address_space &prog = m_maincpu->space( AS_PROGRAM );
223223
224224   if (m_memsel[0] != ((data & 0x03) >> 0))
225225   {
r18027r18028
229229      {
230230      case 0:
231231         membank("bank1")->set_base(m_rom_base);
232         prog->install_read_bank(0x0000, 0x3fff, "bank1");
233         prog->unmap_write(0x0000, 0x3fff);
232         prog.install_read_bank(0x0000, 0x3fff, "bank1");
233         prog.unmap_write(0x0000, 0x3fff);
234234         break;
235235      case 2:
236236         membank("bank1")->set_base(m_ram_base);
237         prog->install_readwrite_bank(0x0000, 0x3fff, "bank1");
237         prog.install_readwrite_bank(0x0000, 0x3fff, "bank1");
238238         break;
239239      default:
240         prog->unmap_readwrite(0x0000, 0x3fff);
240         prog.unmap_readwrite(0x0000, 0x3fff);
241241         break;
242242      }
243243   }
r18027r18028
250250      {
251251      case 0:
252252         membank("bank2")->set_base(m_rom_base + 0x4000);
253         prog->install_read_bank(0x4000, 0x7fff, "bank2");
254         prog->unmap_write(0x4000, 0x4000);
253         prog.install_read_bank(0x4000, 0x7fff, "bank2");
254         prog.unmap_write(0x4000, 0x4000);
255255         break;
256256      case 1:
257257         membank("bank2")->set_base(machine().root_device().memregion("k5651")->base());
258         prog->install_read_bank(0x4000, 0x7fff, "bank2");
259         prog->unmap_write(0x4000, 0x4000);
258         prog.install_read_bank(0x4000, 0x7fff, "bank2");
259         prog.unmap_write(0x4000, 0x4000);
260260         break;
261261      case 2:
262262         membank("bank2")->set_base(m_ram_base + 0x4000);
263         prog->install_readwrite_bank(0x4000, 0x7fff, "bank2");
263         prog.install_readwrite_bank(0x4000, 0x7fff, "bank2");
264264         break;
265265      default:
266         prog->unmap_readwrite(0x4000, 0x7fff);
266         prog.unmap_readwrite(0x4000, 0x7fff);
267267         break;
268268      }
269269   }
r18027r18028
276276      {
277277      case 0:
278278         membank("bank3")->set_base(m_rom_base + 0x8000);
279         prog->install_read_bank(0x8000, 0xbfff, "bank3");
280         prog->unmap_write(0x8000, 0xbfff);
279         prog.install_read_bank(0x8000, 0xbfff, "bank3");
280         prog.unmap_write(0x8000, 0xbfff);
281281         break;
282282      case 2:
283283         membank("bank3")->set_base(m_ram_base + 0x8000);
284         prog->install_readwrite_bank(0x8000, 0xbfff, "bank3");
284         prog.install_readwrite_bank(0x8000, 0xbfff, "bank3");
285285         break;
286286      default:
287         prog->unmap_readwrite(0x8000, 0xbfff);
287         prog.unmap_readwrite(0x8000, 0xbfff);
288288         break;
289289      }
290290   }
r18027r18028
297297      {
298298      case 2:
299299         membank("bank4")->set_base(m_ram_base + 0xc000);
300         prog->install_readwrite_bank(0xc000, 0xffff, "bank4");
300         prog.install_readwrite_bank(0xc000, 0xffff, "bank4");
301301         break;
302302      default:
303         prog->unmap_readwrite(0xc000, 0xffff);
303         prog.unmap_readwrite(0xc000, 0xffff);
304304         break;
305305      }
306306   }
r18027r18028
454454
455455void a5105_state::machine_reset()
456456{
457   address_space &space = *m_maincpu->space(AS_PROGRAM);
457   address_space &space = m_maincpu->space(AS_PROGRAM);
458458   a5105_ab_w(space, 0, 9); // turn motor off
459459   beep_set_frequency(m_beep, 500);
460460
trunk/src/mess/drivers/nc.c
r18027r18028
321321static void nc_refresh_memory_bank_config(running_machine &machine, int bank)
322322{
323323   nc_state *state = machine.driver_data<nc_state>();
324   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
324   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
325325   int mem_type;
326326   int mem_bank;
327327   char bank1[10];
trunk/src/mess/drivers/p8k.c
r18027r18028
513513
514514static READ16_DEVICE_HANDLER( p8k_16_ctc_r )
515515{
516   return (UINT16)downcast<z80ctc_device *>(device)->read(*device->machine().memory().first_space(),(offset & 0x06) >> 1);
516   return (UINT16)downcast<z80ctc_device *>(device)->read(device->machine().driver_data()->generic_space(),(offset & 0x06) >> 1);
517517}
518518
519519static WRITE16_DEVICE_HANDLER( p8k_16_ctc_w )
520520{
521   downcast<z80ctc_device *>(device)->write(*device->machine().memory().first_space(), (offset & 0x06) >> 1, (UINT8)(data & 0xff));
521   downcast<z80ctc_device *>(device)->write(device->machine().driver_data()->generic_space(), (offset & 0x06) >> 1, (UINT8)(data & 0xff));
522522}
523523
524524READ16_MEMBER( p8k_state::portff82_r )
trunk/src/mess/drivers/bw12.c
r18027r18028
5151
5252void bw12_state::bankswitch()
5353{
54   address_space *program = m_maincpu->space(AS_PROGRAM);
54   address_space &program = m_maincpu->space(AS_PROGRAM);
5555
5656   switch (m_bank)
5757   {
5858   case 0: /* ROM */
59      program->install_read_bank(0x0000, 0x7fff, "bank1");
60      program->unmap_write(0x0000, 0x7fff);
59      program.install_read_bank(0x0000, 0x7fff, "bank1");
60      program.unmap_write(0x0000, 0x7fff);
6161      break;
6262
6363   case 1: /* BK0 */
64      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
64      program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
6565      break;
6666
6767   case 2: /* BK1 */
6868   case 3: /* BK2 */
6969      if (m_ram->size() > 64*1024)
7070      {
71         program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
71         program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
7272      }
7373      else
7474      {
75         program->unmap_readwrite(0x0000, 0x7fff);
75         program.unmap_readwrite(0x0000, 0x7fff);
7676      }
7777      break;
7878   }
trunk/src/mess/drivers/pentagon.c
r18027r18028
112112{
113113   UINT8 *messram = machine().device<ram_device>(RAM_TAG)->pointer();
114114   device_t *beta = machine().device(BETA_DISK_TAG);
115   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
115   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
116116
117117   space.install_read_bank(0x0000, 0x3fff, "bank1");
118118   space.unmap_write(0x0000, 0x3fff);
trunk/src/mess/drivers/prestige.c
r18027r18028
121121
122122WRITE8_MEMBER( prestige_state::bankswitch_w )
123123{
124   address_space *program = m_maincpu->space(AS_PROGRAM);
124   address_space &program = m_maincpu->space(AS_PROGRAM);
125125
126126   switch (offset)
127127   {
r18027r18028
159159      {
160160         //cartridge memory is writable
161161         if (data & 0x08)
162            program->install_readwrite_bank(0x4000, 0x7fff, "bank2");
162            program.install_readwrite_bank(0x4000, 0x7fff, "bank2");
163163         else
164            program->unmap_write(0x4000, 0x7fff);
164            program.unmap_write(0x4000, 0x7fff);
165165
166166         if (data & 0x04)
167            program->install_readwrite_bank(0x8000, 0xbfff, "bank3");
167            program.install_readwrite_bank(0x8000, 0xbfff, "bank3");
168168         else
169            program->unmap_write(0x8000, 0xbfff);
169            program.unmap_write(0x8000, 0xbfff);
170170
171         program->install_readwrite_bank(0xc000, 0xdfff, "bank4");
171         program.install_readwrite_bank(0xc000, 0xdfff, "bank4");
172172      }
173173      else
174174      {
175175         //cartridge memory is read-only
176176         if (data & 0x02)
177            program->unmap_write(0xc000, 0xdfff);
177            program.unmap_write(0xc000, 0xdfff);
178178         else
179            program->install_readwrite_bank(0xc000, 0xdfff, "bank4");
179            program.install_readwrite_bank(0xc000, 0xdfff, "bank4");
180180
181         program->unmap_write(0x4000, 0xbfff);
181         program.unmap_write(0x4000, 0xbfff);
182182      }
183183      break;
184184   case 6:
trunk/src/mess/drivers/z88.c
r18027r18028
6767      // install read bank
6868      if (m_bank_type[bank] != Z88_BANK_ROM)
6969      {
70         m_maincpu->space(AS_PROGRAM)->install_read_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
71         m_maincpu->space(AS_PROGRAM)->unmap_write(bank<<14, (bank<<14) + 0x3fff);
70         m_maincpu->space(AS_PROGRAM).install_read_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
71         m_maincpu->space(AS_PROGRAM).unmap_write(bank<<14, (bank<<14) + 0x3fff);
7272         m_bank_type[bank] = Z88_BANK_ROM;
7373      }
7474
r18027r18028
8181         // install readwrite bank
8282         if (m_bank_type[bank] != Z88_BANK_RAM)
8383         {
84            m_maincpu->space(AS_PROGRAM)->install_readwrite_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
84            m_maincpu->space(AS_PROGRAM).install_readwrite_bank(bank<<14, (bank<<14) + 0x3fff, bank_tag);
8585            m_bank_type[bank] = Z88_BANK_RAM;
8686         }
8787
r18027r18028
9292      {
9393         if (m_bank_type[bank] != Z88_BANK_UNMAP)
9494         {
95            m_maincpu->space(AS_PROGRAM)->unmap_readwrite(bank<<14, (bank<<14) + 0x3fff);
95            m_maincpu->space(AS_PROGRAM).unmap_readwrite(bank<<14, (bank<<14) + 0x3fff);
9696            m_bank_type[bank] = Z88_BANK_UNMAP;
9797         }
9898      }
r18027r18028
107107         switch (bank)
108108         {
109109            case 0:
110               m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x0000, 0x3fff, 0, 0, read8_delegate(FUNC(z88_state::bank0_cart_r), this), write8_delegate(FUNC(z88_state::bank0_cart_w), this));
110               m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0000, 0x3fff, 0, 0, read8_delegate(FUNC(z88_state::bank0_cart_r), this), write8_delegate(FUNC(z88_state::bank0_cart_w), this));
111111               break;
112112            case 1:
113               m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(z88_state::bank1_cart_r), this), write8_delegate(FUNC(z88_state::bank1_cart_w), this));
113               m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(z88_state::bank1_cart_r), this), write8_delegate(FUNC(z88_state::bank1_cart_w), this));
114114               break;
115115            case 2:
116               m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(z88_state::bank2_cart_r), this), write8_delegate(FUNC(z88_state::bank2_cart_w), this));
116               m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(z88_state::bank2_cart_r), this), write8_delegate(FUNC(z88_state::bank2_cart_w), this));
117117               break;
118118            case 3:
119               m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(z88_state::bank3_cart_r), this), write8_delegate(FUNC(z88_state::bank3_cart_w), this));
119               m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc000, 0xffff, 0, 0, read8_delegate(FUNC(z88_state::bank3_cart_r), this), write8_delegate(FUNC(z88_state::bank3_cart_w), this));
120120               break;
121121         }
122122
r18027r18028
128128   // override setting for lower 8k of bank 0
129129   if (bank == 0)
130130   {
131      m_maincpu->space(AS_PROGRAM)->install_read_bank(0, 0x1fff, "bank1");
131      m_maincpu->space(AS_PROGRAM).install_read_bank(0, 0x1fff, "bank1");
132132
133133      // enable RAM
134134      if (rams)
135         m_maincpu->space(AS_PROGRAM)->install_write_bank(0, 0x1fff, "bank1");
135         m_maincpu->space(AS_PROGRAM).install_write_bank(0, 0x1fff, "bank1");
136136      else
137         m_maincpu->space(AS_PROGRAM)->unmap_write(0, 0x1fff);
137         m_maincpu->space(AS_PROGRAM).unmap_write(0, 0x1fff);
138138
139139      membank("bank1")->set_entry(rams & 1);
140140   }
trunk/src/mess/drivers/pce220.c
r18027r18028
340340   // set to 1 after boot for restore the ram in the first bank
341341   if (data & 0x01)
342342   {
343      address_space *space_prg = m_maincpu->space(AS_PROGRAM);
344      space_prg->install_write_bank(0x0000, 0x3fff, "bank1");
343      address_space &space_prg = m_maincpu->space(AS_PROGRAM);
344      space_prg.install_write_bank(0x0000, 0x3fff, "bank1");
345345      membank("bank1")->set_entry(0);
346346   }
347347}
r18027r18028
472472
473473WRITE8_MEMBER( pcg850v_state::g850v_bank_w )
474474{
475   address_space *space_prg = m_maincpu->space(AS_PROGRAM);
475   address_space &space_prg = m_maincpu->space(AS_PROGRAM);
476476
477477   if (data < 0x16)
478478   {
479      space_prg->install_read_bank(0xc000, 0xffff, "bank4");
479      space_prg.install_read_bank(0xc000, 0xffff, "bank4");
480480      membank("bank4")->set_entry(data);
481481   }
482482   else
483483   {
484      space_prg->unmap_read(0xc000, 0xffff);
484      space_prg.unmap_read(0xc000, 0xffff);
485485   }
486486
487487   m_g850v_bank_num = data;
r18027r18028
873873
874874void pce220_state::machine_reset()
875875{
876   address_space &space = *m_maincpu->space(AS_PROGRAM);
876   address_space &space = m_maincpu->space(AS_PROGRAM);
877877   space.unmap_write(0x0000, 0x3fff);
878878
879879   // install the boot code into the first bank
trunk/src/mess/drivers/sgi_ip2.c
r18027r18028
433433{
434434   device_t *devconf = device->machine().device(TERMINAL_TAG);
435435   verboselog(device->machine(), 0, "duarta_tx: %02x\n", data);
436   dynamic_cast<generic_terminal_device *>(devconf)->write(*devconf->machine().memory().first_space(), 0, data);
436   dynamic_cast<generic_terminal_device *>(devconf)->write(devconf->machine().driver_data()->generic_space(), 0, data);
437437}
438438
439439static const duart68681_config sgi_ip2_duart68681a_config =
trunk/src/mess/drivers/pcw16.c
r18027r18028
369369/*
370370static void pcw16_set_bank_handlers(running_machine &machine, int bank, PCW16_RAM_TYPE type)
371371{
372    address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
372    address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
373373    pcw16_state *state = machine.driver_data<pcw16_state>();
374374    switch (type) {
375375    case PCW16_MEM_ROM:
r18027r18028
441441                flashdev = machine.device<intelfsh8_device>("flash1");
442442            }
443443
444            mem_ptr = (unsigned char *)flashdev->space()->get_read_ptr(0);
444            mem_ptr = (unsigned char *)flashdev->space().get_read_ptr(0);
445445        }
446446
447447    }
trunk/src/mess/drivers/ht68k.c
r18027r18028
9797static void duart_tx(device_t *device, int channel, UINT8 data)
9898{
9999   ht68k_state *state = device->machine().driver_data<ht68k_state>();
100   state->m_terminal->write(*device->machine().memory().first_space(), 0, data);
100   state->m_terminal->write(device->machine().driver_data()->generic_space(), 0, data);
101101}
102102
103103static UINT8 duart_input(device_t *device)
trunk/src/mess/drivers/cxhumax.c
r18027r18028
154154      //we're in disabled debug_printf
155155      unsigned char* buf = (unsigned char *)alloca(200);
156156      unsigned char temp;
157      address_space *program = m_maincpu->space(AS_PROGRAM);
157      address_space &program = m_maincpu->space(AS_PROGRAM);
158158
159159      memset(buf,0,200);
160160
161161      int i = 0;
162      while ((temp=program->read_byte(m_maincpu->state_int(ARM7_R0)+i))) {
162      while ((temp=program.read_byte(m_maincpu->state_int(ARM7_R0)+i))) {
163163         buf[i++]=temp;
164164         //m_terminal->write(space, 0, temp);
165165      }
trunk/src/mess/drivers/next.c
r18027r18028
304304   dma_slot &ds = dma_slots[slot];
305305   ds.drq = state;
306306   if(state && (ds.state & DMA_ENABLE)) {
307      address_space &space = *maincpu->space(AS_PROGRAM);
307      address_space &space = maincpu->space(AS_PROGRAM);
308308      if(ds.state & DMA_READ) {
309309         while(ds.drq) {
310310            dma_check_update(slot);
trunk/src/mess/drivers/prof80.c
r18027r18028
4848
4949void prof80_state::bankswitch()
5050{
51   address_space *program = m_maincpu->space(AS_PROGRAM);
51   address_space &program = m_maincpu->space(AS_PROGRAM);
5252   UINT8 *ram = m_ram->pointer();
5353   UINT8 *rom = memregion(Z80_TAG)->base();
5454   int bank;
r18027r18028
6262      switch (block)
6363      {
6464      case BLK_RAM1:
65         program->install_ram(start_addr, end_addr, ram + ((bank % 8) * 0x1000));
65         program.install_ram(start_addr, end_addr, ram + ((bank % 8) * 0x1000));
6666         break;
6767
6868      case BLK_RAM2:
69         program->install_ram(start_addr, end_addr, ram + 0x8000 + ((bank % 8) * 0x1000));
69         program.install_ram(start_addr, end_addr, ram + 0x8000 + ((bank % 8) * 0x1000));
7070         break;
7171
7272      case BLK_RAM3:
73         program->install_ram(start_addr, end_addr, ram + 0x10000 + ((bank % 8) * 0x1000));
73         program.install_ram(start_addr, end_addr, ram + 0x10000 + ((bank % 8) * 0x1000));
7474         break;
7575
7676      case BLK_RAM4:
77         program->install_ram(start_addr, end_addr, ram + 0x18000 + ((bank % 8) * 0x1000));
77         program.install_ram(start_addr, end_addr, ram + 0x18000 + ((bank % 8) * 0x1000));
7878         break;
7979
8080      case BLK_EPROM:
81         program->install_rom(start_addr, end_addr, rom + ((bank % 2) * 0x1000));
81         program.install_rom(start_addr, end_addr, rom + ((bank % 2) * 0x1000));
8282         break;
8383
8484      default:
85         program->unmap_readwrite(start_addr, end_addr);
85         program.unmap_readwrite(start_addr, end_addr);
8686      }
8787
8888      //logerror("Segment %u address %04x-%04x block %u\n", bank, start_addr, end_addr, block);
trunk/src/mess/drivers/apollo.c
r18027r18028
11921192void apollo_terminal_write(UINT8 data) {
11931193   if (dsp_terminal != NULL) {
11941194      // output data to the terminal emulator
1195      dynamic_cast<generic_terminal_device *>(dsp_terminal)->write(*dsp_terminal->machine().memory().first_space(), 0, data);
1195      dynamic_cast<generic_terminal_device *>(dsp_terminal)->write(dsp_terminal->machine().driver_data()->generic_space(), 0, data);
11961196   }
11971197}
11981198
trunk/src/mess/drivers/dc.c
r18027r18028
6565
6666DRIVER_INIT_MEMBER(dc_state,dcus)
6767{
68   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2303b0, 0xc2303b7, FUNC(dcus_idle_skip_r));
68   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2303b0, 0xc2303b7, FUNC(dcus_idle_skip_r));
6969
7070   DRIVER_INIT_CALL(dc);
7171}
7272
7373DRIVER_INIT_MEMBER(dc_state,dcjp)
7474{
75   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xc2302f8, 0xc2302ff, FUNC(dcjp_idle_skip_r));
75   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xc2302f8, 0xc2302ff, FUNC(dcjp_idle_skip_r));
7676
7777   DRIVER_INIT_CALL(dc);
7878}
trunk/src/mess/drivers/basic52.c
r18027r18028
8080static void to_term(device_t *device, int data )
8181{
8282   basic52_state *state = device->machine().driver_data<basic52_state>();
83   address_space &space = *device->memory().space(AS_PROGRAM);
83   address_space &space = device->memory().space(AS_PROGRAM);
8484   state->m_terminal->write(space, 0, data);
8585}
8686
trunk/src/mess/drivers/aquarius.c
r18027r18028
216216   /* install expansion memory if available */
217217   if (machine().device<ram_device>(RAM_TAG)->size() > 0x1000)
218218   {
219      address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
219      address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
220220
221221      space.install_readwrite_bank(0x4000, 0x4000 + machine().device<ram_device>(RAM_TAG)->size() - 0x1000 - 1, "bank1");
222222      membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
trunk/src/mess/drivers/lynx.c
r18027r18028
138138static QUICKLOAD_LOAD( lynx )
139139{
140140   device_t *cpu = image.device().machine().device("maincpu");
141   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
141   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
142142   UINT8 *data = NULL;
143143   UINT8 *rom = image.device().machine().root_device().memregion("maincpu")->base();
144144   UINT8 header[10]; // 80 08 dw Start dw Len B S 9 3
trunk/src/mess/drivers/x1twin.c
r18027r18028
110110
111111INPUT_CHANGED_MEMBER(x1twin_state::ipl_reset)
112112{
113   //address_space &space = *machine().device("x1_cpu")->memory().space(AS_PROGRAM);
113   //address_space &space = machine().device("x1_cpu")->memory().space(AS_PROGRAM);
114114
115115   m_x1_cpu->set_input_line(INPUT_LINE_RESET, newval ? CLEAR_LINE : ASSERT_LINE);
116116
trunk/src/mess/drivers/specpls3.c
r18027r18028
211211void spectrum_plus3_update_memory(running_machine &machine)
212212{
213213   spectrum_state *state = machine.driver_data<spectrum_state>();
214   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
214   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
215215   UINT8 *messram = machine.device<ram_device>(RAM_TAG)->pointer();
216216
217217   if (state->m_port_7ffd_data & 8)
trunk/src/mess/drivers/apexc.c
r18027r18028
398398*/
399399INTERRUPT_GEN_MEMBER(apexc_state::apexc_interrupt)
400400{
401   address_space& space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
401   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
402402   UINT32 edit_keys;
403403   int control_keys;
404404
trunk/src/mess/drivers/x68k.c
r18027r18028
26222622
26232623MACHINE_START_MEMBER(x68k_state,x68000)
26242624{
2625   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2625   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
26262626   /*  Install RAM handlers  */
26272627   m_spriteram = (UINT16*)(*memregion("user1"));
26282628   space.install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_emptyram_r));
r18027r18028
26522652
26532653MACHINE_START_MEMBER(x68k_state,x68030)
26542654{
2655   address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM);
2655   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
26562656   /*  Install RAM handlers  */
26572657   m_spriteram = (UINT16*)(*memregion("user1"));
26582658   space.install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_rom0_r),0xffffffff);
trunk/src/mess/drivers/victor9k.c
r18027r18028
7575static MC6845_UPDATE_ROW( victor9k_update_row )
7676{
7777   victor9k_state *state = device->machine().driver_data<victor9k_state>();
78   address_space *program = state->m_maincpu->space(AS_PROGRAM);
78   address_space &program = state->m_maincpu->space(AS_PROGRAM);
7979   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
8080
8181   if (BIT(ma, 13))
r18027r18028
9090      {
9191         UINT16 code = (state->m_video_ram[video_ram_addr + 1] << 8) | state->m_video_ram[video_ram_addr];
9292         UINT32 char_ram_addr = (BIT(ma, 12) << 16) | ((code & 0xff) << 5) | (ra << 1);
93         UINT16 data = program->read_word(char_ram_addr);
93         UINT16 data = program.read_word(char_ram_addr);
9494
9595         for (int x = 0; x <= 10; x++)
9696         {
r18027r18028
926926   m_maincpu->set_irq_acknowledge_callback(victor9k_irq_callback);
927927
928928   // memory banking
929   address_space *program = m_maincpu->space(AS_PROGRAM);
930   program->install_ram(0x00000, m_ram->size() - 1, m_ram->pointer());
929   address_space &program = m_maincpu->space(AS_PROGRAM);
930   program.install_ram(0x00000, m_ram->size() - 1, m_ram->pointer());
931931}
932932
933933// Machine Driver
trunk/src/mess/drivers/px4.c
r18027r18028
528528/* bank register */
529529WRITE8_MEMBER(px4_state::px4_bankr_w)
530530{
531   address_space &space_program = *machine().device("maincpu")->memory().space(AS_PROGRAM);
531   address_space &space_program = machine().device("maincpu")->memory().space(AS_PROGRAM);
532532
533533   if (VERBOSE)
534534      logerror("%s: px4_bankr_w (0x%02x)\n", machine().describe_context(), data);
trunk/src/mess/drivers/instruct.c
r18027r18028
218218
219219QUICKLOAD_LOAD( instruct )
220220{
221   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
221   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
222222   int i;
223223   int quick_addr = 0x0100;
224224   int exec_addr;
trunk/src/mess/drivers/pc8001.c
r18027r18028
456456
457457READ8_MEMBER( pc8001_state::dma_io_r )
458458{
459   address_space *program = m_maincpu->space(AS_PROGRAM);
459   address_space &program = m_maincpu->space(AS_PROGRAM);
460460
461   return program->read_byte(offset);
461   return program.read_byte(offset);
462462}
463463
464464WRITE8_MEMBER( pc8001_state::dma_io_w )
465465{
466   address_space *program = m_maincpu->space(AS_PROGRAM);
466   address_space &program = m_maincpu->space(AS_PROGRAM);
467467
468   program->write_byte(offset, data);
468   program.write_byte(offset, data);
469469}
470470
471471static I8257_INTERFACE( dmac_intf )
r18027r18028
491491
492492void pc8001_state::machine_start()
493493{
494   address_space *program = m_maincpu->space(AS_PROGRAM);
494   address_space &program = m_maincpu->space(AS_PROGRAM);
495495
496496   /* initialize RTC */
497497   m_rtc->cs_w(1);
r18027r18028
504504   UINT8 *ram = m_ram->pointer();
505505
506506   membank("bank1")->configure_entry(1, memregion("n80")->base());
507   program->install_read_bank(0x0000, 0x5fff, "bank1");
508   program->unmap_write(0x0000, 0x5fff);
507   program.install_read_bank(0x0000, 0x5fff, "bank1");
508   program.unmap_write(0x0000, 0x5fff);
509509
510510   switch (m_ram->size())
511511   {
512512   case 16*1024:
513513      membank("bank3")->configure_entry(0, ram);
514      program->unmap_readwrite(0x6000, 0xbfff);
515      program->unmap_readwrite(0x8000, 0xbfff);
516      program->install_readwrite_bank(0xc000, 0xffff, "bank3");
514      program.unmap_readwrite(0x6000, 0xbfff);
515      program.unmap_readwrite(0x8000, 0xbfff);
516      program.install_readwrite_bank(0xc000, 0xffff, "bank3");
517517      break;
518518
519519   case 32*1024:
520520      membank("bank3")->configure_entry(0, ram);
521      program->unmap_readwrite(0x6000, 0xbfff);
522      program->install_readwrite_bank(0x8000, 0xffff, "bank3");
521      program.unmap_readwrite(0x6000, 0xbfff);
522      program.install_readwrite_bank(0x8000, 0xffff, "bank3");
523523      break;
524524
525525   case 64*1024:
526526      membank("bank1")->configure_entry(0, ram);
527527      membank("bank2")->configure_entry(0, ram + 0x6000);
528528      membank("bank3")->configure_entry(0, ram + 0x8000);
529      program->install_readwrite_bank(0x0000, 0x5fff, "bank1");
530      program->install_readwrite_bank(0x6000, 0xbfff, "bank2");
531      program->install_readwrite_bank(0x8000, 0xffff, "bank3");
529      program.install_readwrite_bank(0x0000, 0x5fff, "bank1");
530      program.install_readwrite_bank(0x6000, 0xbfff, "bank2");
531      program.install_readwrite_bank(0x8000, 0xffff, "bank3");
532532      membank("bank2")->set_entry(0);
533533      break;
534534   }
trunk/src/mess/drivers/timex.c
r18027r18028
228228{
229229   spectrum_state *state = machine.driver_data<spectrum_state>();
230230   UINT8 *messram = machine.device<ram_device>(RAM_TAG)->pointer();
231   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
231   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
232232   unsigned char *ChosenROM, *ExROM;
233233   const timex_cart_t *timex_cart = timex_cart_data();
234234   int timex_cart_type = timex_cart->type;
trunk/src/mess/drivers/bw2.c
r18027r18028
5151
5252    */
5353
54   address_space *program = m_maincpu->space(AS_PROGRAM);
54   address_space &program = m_maincpu->space(AS_PROGRAM);
5555
5656   int max_ram_bank = 0;
5757
r18027r18028
8787   switch (m_bank)
8888   {
8989   case BANK_RAM1:
90      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
90      program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
9191      break;
9292
9393   case BANK_VRAM:
94      program->install_readwrite_bank(0x0000, 0x3fff, 0, 0x4000, "bank1");
94      program.install_readwrite_bank(0x0000, 0x3fff, 0, 0x4000, "bank1");
9595      break;
9696
9797   case BANK_RAM2:
r18027r18028
101101   case BANK_RAM6:
102102      if (m_bank > max_ram_bank)
103103      {
104         program->unmap_readwrite(0x0000, 0x7fff);
104         program.unmap_readwrite(0x0000, 0x7fff);
105105      }
106106      else
107107      {
108         program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
108         program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
109109      }
110110      break;
111111
112112   case BANK_ROM:
113      program->install_read_bank(0x0000, 0x7fff, "bank1");
114      program->unmap_write(0x0000, 0x7fff);
113      program.install_read_bank(0x0000, 0x7fff, "bank1");
114      program.unmap_write(0x0000, 0x7fff);
115115      break;
116116   }
117117
r18027r18028
133133
134134    */
135135
136   address_space *program = m_maincpu->space(AS_PROGRAM);
136   address_space &program = m_maincpu->space(AS_PROGRAM);
137137
138138   int max_ram_bank = BANK_RAM1;
139139
r18027r18028
164164   {
165165   case BANK_RAM1:
166166   case BANK_RAMCARD_RAM:
167      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
167      program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
168168      break;
169169
170170   case BANK_VRAM:
171      program->install_readwrite_bank(0x0000, 0x3fff, 0, 0x4000, "bank1");
171      program.install_readwrite_bank(0x0000, 0x3fff, 0, 0x4000, "bank1");
172172      break;
173173
174174   case BANK_RAM3:
r18027r18028
176176   case BANK_RAM6:
177177      if (m_bank > max_ram_bank)
178178      {
179         program->unmap_readwrite(0x0000, 0x7fff);
179         program.unmap_readwrite(0x0000, 0x7fff);
180180      }
181181      else
182182      {
183         program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
183         program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
184184      }
185185      break;
186186
187187   case BANK_RAMCARD_ROM:
188      program->install_read_bank(0x0000, 0x3fff, 0, 0x4000, "bank1");
189      program->unmap_write(0x0000, 0x3fff, 0, 0x4000);
188      program.install_read_bank(0x0000, 0x3fff, 0, 0x4000, "bank1");
189      program.unmap_write(0x0000, 0x3fff, 0, 0x4000);
190190      break;
191191
192192   case BANK_ROM:
193      program->install_read_bank(0x0000, 0x7fff, "bank1");
194      program->unmap_write(0x0000, 0x7fff);
193      program.install_read_bank(0x0000, 0x7fff, "bank1");
194      program.unmap_write(0x0000, 0x7fff);
195195      break;
196196   }
197197
r18027r18028
200200
201201WRITE8_MEMBER( bw2_state::ramcard_bank_w )
202202{
203   address_space *program = m_maincpu->space(AS_PROGRAM);
203   address_space &program = m_maincpu->space(AS_PROGRAM);
204204
205205   UINT8 ramcard_bank = data & 0x0f;
206206   UINT32 bank_offset = ramcard_bank * 0x8000;
207207
208208   if ((get_ramdisk_size() == 256) && (ramcard_bank > 7))
209209   {
210      program->unmap_readwrite(0x0000, 0x7fff);
210      program.unmap_readwrite(0x0000, 0x7fff);
211211   }
212212   else
213213   {
214      program->install_readwrite_bank(0x0000, 0x7fff, "bank1");
214      program.install_readwrite_bank(0x0000, 0x7fff, "bank1");
215215   }
216216
217217   membank("bank1")->configure_entry(BANK_RAMCARD_RAM, m_ramcard_ram + bank_offset);
r18027r18028
638638
639639void bw2_state::machine_reset()
640640{
641   address_space *io = machine().device(Z80_TAG)->memory().space(AS_IO);
641   address_space &io = machine().device(Z80_TAG)->memory().space(AS_IO);
642642
643643   if (get_ramdisk_size() > 0)
644644   {
r18027r18028
649649      membank("bank1")->configure_entry(BANK_RAMCARD_RAM, m_ramcard_ram);
650650      membank("bank1")->configure_entry(BANK_RAM6, m_ram->pointer() + 0x18000);
651651
652      io->install_write_handler(0x30, 0x30, 0, 0x0f, write8_delegate(FUNC(bw2_state::ramcard_bank_w), this), 0);
652      io.install_write_handler(0x30, 0x30, 0, 0x0f, write8_delegate(FUNC(bw2_state::ramcard_bank_w), this), 0);
653653   }
654654   else
655655   {
r18027r18028
657657
658658      membank("bank1")->configure_entries(BANK_RAM2, 5, m_ram->pointer() + 0x8000, 0x8000);
659659
660      io->unmap_write(0x30, 0x30, 0, 0x0f);
660      io.unmap_write(0x30, 0x30, 0, 0x0f);
661661   }
662662
663663   membank("bank1")->set_entry(BANK_ROM);
trunk/src/mess/drivers/enterp.c
r18027r18028
108108   case 0x11:
109109   case 0x12:
110110   case 0x13:
111      enterprise_update_memory_page(*device->machine().device("maincpu")->memory().space(AS_PROGRAM), offset - 0x0f, data);
111      enterprise_update_memory_page(device->machine().device("maincpu")->memory().space(AS_PROGRAM), offset - 0x0f, data);
112112      break;
113113
114114   case 0x15:
trunk/src/mess/drivers/portfoli.c
r18027r18028
438438
439439WRITE8_MEMBER( portfolio_state::ncc1_w )
440440{
441   address_space *program = m_maincpu->space(AS_PROGRAM);
441   address_space &program = m_maincpu->space(AS_PROGRAM);
442442
443443   if (BIT(data, 0))
444444   {
445445      // system ROM
446446      UINT8 *rom = memregion(M80C88A_TAG)->base();
447      program->install_rom(0xc0000, 0xdffff, rom);
447      program.install_rom(0xc0000, 0xdffff, rom);
448448   }
449449   else
450450   {
451451      // credit card memory
452      program->unmap_readwrite(0xc0000, 0xdffff);
452      program.unmap_readwrite(0xc0000, 0xdffff);
453453   }
454454
455455   //logerror("NCC %02x\n", data);
r18027r18028
763763
764764void portfolio_state::machine_start()
765765{
766   address_space *program = m_maincpu->space(AS_PROGRAM);
766   address_space &program = m_maincpu->space(AS_PROGRAM);
767767
768768   /* set CPU interrupt vector callback */
769769   m_maincpu->set_irq_acknowledge_callback(portfolio_int_ack);
r18027r18028
772772   switch (machine().device<ram_device>(RAM_TAG)->size())
773773   {
774774   case 128 * 1024:
775      program->unmap_readwrite(0x1f000, 0x9efff);
775      program.unmap_readwrite(0x1f000, 0x9efff);
776776      break;
777777
778778   case 384 * 1024:
779      program->unmap_readwrite(0x5f000, 0x9efff);
779      program.unmap_readwrite(0x5f000, 0x9efff);
780780      break;
781781   }
782782
r18027r18028
801801
802802void portfolio_state::machine_reset()
803803{
804   address_space *io = m_maincpu->space(AS_IO);
804   address_space &io = m_maincpu->space(AS_IO);
805805
806806   // peripherals
807807   m_pid = ioport("PERIPHERAL")->read();
808808
809   io->unmap_readwrite(0x8070, 0x807b);
810   io->unmap_readwrite(0x807d, 0x807e);
809   io.unmap_readwrite(0x8070, 0x807b);
810   io.unmap_readwrite(0x807d, 0x807e);
811811
812812   switch (m_pid)
813813   {
814814   case PID_SERIAL:
815      io->install_readwrite_handler(0x8070, 0x8077, read8_delegate(FUNC(ins8250_device::ins8250_r), (ins8250_device*)m_uart), write8_delegate(FUNC(ins8250_device::ins8250_w), (ins8250_device*)m_uart));
815      io.install_readwrite_handler(0x8070, 0x8077, read8_delegate(FUNC(ins8250_device::ins8250_r), (ins8250_device*)m_uart), write8_delegate(FUNC(ins8250_device::ins8250_w), (ins8250_device*)m_uart));
816816      break;
817817
818818   case PID_PARALLEL:
819      io->install_readwrite_handler(0x8078, 0x807b, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi));
819      io.install_readwrite_handler(0x8078, 0x807b, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi));
820820      break;
821821   }
822822}
trunk/src/mess/drivers/atom.c
r18027r18028
123123
124124void atom_state::bankswitch()
125125{
126   address_space *program = m_maincpu->space(AS_PROGRAM);
126   address_space &program = m_maincpu->space(AS_PROGRAM);
127127
128128   UINT8 *eprom = memregion(EXTROM_TAG)->base() + (m_eprom << 12);
129129
130   program->install_rom(0xa000, 0xafff, eprom);
130   program.install_rom(0xa000, 0xafff, eprom);
131131}
132132
133133/*-------------------------------------------------
r18027r18028
648648    generator. I don't know if this is hardware, or random data because the
649649    ram chips are not cleared at start-up. So at this time, these numbers
650650    are poked into the memory to simulate it. When I have more details I will fix it */
651   UINT8 *m_baseram = (UINT8 *)m_maincpu->space(AS_PROGRAM)->get_write_ptr(0x0000);
651   UINT8 *m_baseram = (UINT8 *)m_maincpu->space(AS_PROGRAM).get_write_ptr(0x0000);
652652
653653   m_baseram[0x08] = machine().rand() & 0x0ff;
654654   m_baseram[0x09] = machine().rand() & 0x0ff;
trunk/src/mess/drivers/mc10.c
r18027r18028
236236
237237DRIVER_INIT_MEMBER(mc10_state,mc10)
238238{
239   address_space &prg = *machine().device("maincpu")->memory().space(AS_PROGRAM);
239   address_space &prg = machine().device("maincpu")->memory().space(AS_PROGRAM);
240240
241241   /* initialize keyboard strobe */
242242   m_keyboard_strobe = 0x00;
trunk/src/mess/drivers/apricot.c
r18027r18028
257257
258258DRIVER_INIT_MEMBER(apricot_state,apricot)
259259{
260   address_space *prg = m_maincpu->space(AS_PROGRAM);
260   address_space &prg = m_maincpu->space(AS_PROGRAM);
261261
262262   UINT8 *ram = m_ram->pointer();
263263   UINT32 ram_size = m_ram->size();
264264
265   prg->unmap_readwrite(0x40000, 0xeffff);
266   prg->install_ram(0x00000, ram_size - 1, ram);
265   prg.unmap_readwrite(0x40000, 0xeffff);
266   prg.install_ram(0x00000, ram_size - 1, ram);
267267
268268   m_maincpu->set_irq_acknowledge_callback(apricot_irq_ack);
269269
trunk/src/mess/drivers/lc80.c
r18027r18028
296296
297297void lc80_state::machine_start()
298298{
299   address_space *program = m_maincpu->space(AS_PROGRAM);
299   address_space &program = m_maincpu->space(AS_PROGRAM);
300300
301301   /* setup memory banking */
302302   membank("bank1")->configure_entry(0, memregion(Z80_TAG)->base()); // TODO
r18027r18028
314314   membank("bank4")->configure_entry(0, memregion(Z80_TAG)->base() + 0x2000);
315315   membank("bank4")->set_entry(0);
316316
317   program->install_readwrite_bank(0x0000, 0x07ff, "bank1");
318   program->install_readwrite_bank(0x0800, 0x0fff, "bank2");
319   program->install_readwrite_bank(0x1000, 0x17ff, "bank3");
317   program.install_readwrite_bank(0x0000, 0x07ff, "bank1");
318   program.install_readwrite_bank(0x0800, 0x0fff, "bank2");
319   program.install_readwrite_bank(0x1000, 0x17ff, "bank3");
320320
321321   switch (m_ram->size())
322322   {
323323   case 1*1024:
324      program->install_readwrite_bank(0x2000, 0x23ff, "bank4");
325      program->unmap_readwrite(0x2400, 0x2fff);
324      program.install_readwrite_bank(0x2000, 0x23ff, "bank4");
325      program.unmap_readwrite(0x2400, 0x2fff);
326326      break;
327327
328328   case 2*1024:
329      program->install_readwrite_bank(0x2000, 0x27ff, "bank4");
330      program->unmap_readwrite(0x2800, 0x2fff);
329      program.install_readwrite_bank(0x2000, 0x27ff, "bank4");
330      program.unmap_readwrite(0x2800, 0x2fff);
331331      break;
332332
333333   case 3*1024:
334      program->install_readwrite_bank(0x2000, 0x2bff, "bank4");
335      program->unmap_readwrite(0x2c00, 0x2fff);
334      program.install_readwrite_bank(0x2000, 0x2bff, "bank4");
335      program.unmap_readwrite(0x2c00, 0x2fff);
336336      break;
337337
338338   case 4*1024:
339      program->install_readwrite_bank(0x2000, 0x2fff, "bank4");
339      program.install_readwrite_bank(0x2000, 0x2fff, "bank4");
340340      break;
341341   }
342342
trunk/src/mess/drivers/rx78.c
r18027r18028
525525DRIVER_INIT_MEMBER(rx78_state,rx78)
526526{
527527   UINT32 ram_size = machine().device<ram_device>(RAM_TAG)->size();
528   address_space *prg = machine().device("maincpu")->memory().space(AS_PROGRAM);
528   address_space &prg = machine().device("maincpu")->memory().space(AS_PROGRAM);
529529
530530   if(ram_size == 0x4000)
531      prg->unmap_readwrite(0x6000, 0xafff);
531      prg.unmap_readwrite(0x6000, 0xafff);
532532}
533533
534534/* Driver */
trunk/src/mess/drivers/gp32.c
r18027r18028
706706   gp32_state *state = machine.driver_data<gp32_state>();
707707   UINT32 *regs = &state->m_s3c240x_dma_regs[dma<<3];
708708   UINT32 curr_tc, curr_src, curr_dst;
709   address_space &space = *machine.device( "maincpu")->memory().space( AS_PROGRAM);
709   address_space &space = machine.device( "maincpu")->memory().space( AS_PROGRAM);
710710   int dsz, inc_src, inc_dst, servmode;
711711   static const UINT32 ch_int[] = { INT_DMA0, INT_DMA1, INT_DMA2, INT_DMA3 };
712712   verboselog( machine, 5, "DMA %d trigger\n", dma);
trunk/src/mess/drivers/supracan.c
r18027r18028
993993{
994994   acan_dma_regs_t *acan_dma_regs = &m_acan_dma_regs;
995995   int ch = (offset < 0x10/2) ? 0 : 1;
996   address_space *mem = m_maincpu->space(AS_PROGRAM);
996   address_space &mem = m_maincpu->space(AS_PROGRAM);
997997
998998   switch(offset)
999999   {
r18027r18028
10391039            {
10401040               if(data & 0x1000)
10411041               {
1042                  mem->write_word(acan_dma_regs->dest[ch], mem->read_word(acan_dma_regs->source[ch]));
1042                  mem.write_word(acan_dma_regs->dest[ch], mem.read_word(acan_dma_regs->source[ch]));
10431043                  acan_dma_regs->dest[ch]+=2;
10441044                  acan_dma_regs->source[ch]+=2;
10451045                  if(data & 0x0100)
r18027r18028
10481048               }
10491049               else
10501050               {
1051                  mem->write_byte(acan_dma_regs->dest[ch], mem->read_byte(acan_dma_regs->source[ch]));
1051                  mem.write_byte(acan_dma_regs->dest[ch], mem.read_byte(acan_dma_regs->source[ch]));
10521052                  acan_dma_regs->dest[ch]++;
10531053                  acan_dma_regs->source[ch]++;
10541054               }
r18027r18028
11281128
11291129READ8_MEMBER( supracan_state::supracan_6502_soundmem_r )
11301130{
1131   address_space *mem = m_maincpu->space(AS_PROGRAM);
1131   address_space &mem = m_maincpu->space(AS_PROGRAM);
11321132   UINT8 data = m_soundram[offset];
11331133
11341134   switch(offset)
r18027r18028
11401140
11411141      case 0x410: // Sound IRQ enable
11421142         data = m_sound_irq_enable_reg;
1143         if(!mem->debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_r: IRQ enable: %04x\n", data);
1144         if(!mem->debugger_access())
1143         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_r: IRQ enable: %04x\n", data);
1144         if(!mem.debugger_access())
11451145         {
11461146            if(m_sound_irq_enable_reg & m_sound_irq_source_reg)
11471147            {
r18027r18028
11561156      case 0x411: // Sound IRQ source
11571157         data = m_sound_irq_source_reg;
11581158         m_sound_irq_source_reg = 0;
1159         if(!mem->debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: IRQ source: %04x\n", data);
1160         if(!mem->debugger_access())
1159         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: IRQ source: %04x\n", data);
1160         if(!mem.debugger_access())
11611161         {
11621162            machine().device("soundcpu")->execute().set_input_line(0, CLEAR_LINE);
11631163         }
11641164         break;
11651165      case 0x420:
1166         if(!mem->debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: Sound hardware status? (not yet implemented): %02x\n", 0);
1166         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: Sound hardware status? (not yet implemented): %02x\n", 0);
11671167         break;
11681168      case 0x422:
1169         if(!mem->debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: Sound hardware data? (not yet implemented): %02x\n", 0);
1169         if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 3, "supracan_soundreg_r: Sound hardware data? (not yet implemented): %02x\n", 0);
11701170         break;
11711171      case 0x404:
11721172      case 0x405:
r18027r18028
11771177      default:
11781178         if(offset >= 0x300 && offset < 0x500)
11791179         {
1180            if(!mem->debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_r: Unknown register %04x\n", offset);
1180            if(!mem.debugger_access()) verboselog(m_hack_68k_to_6502_access ? "maincpu" : "soundcpu", machine(), 0, "supracan_soundreg_r: Unknown register %04x\n", offset);
11811181         }
11821182         break;
11831183   }
r18027r18028
13571357
13581358WRITE16_MEMBER( supracan_state::supracan_68k_soundram_w )
13591359{
1360   address_space *mem = m_maincpu->space(AS_PROGRAM);
1360   address_space &mem = m_maincpu->space(AS_PROGRAM);
13611361   m_soundram[offset*2 + 1] = data & 0xff;
13621362   m_soundram[offset*2 + 0] = data >> 8;
13631363
r18027r18028
13661366      if(mem_mask & 0xff00)
13671367      {
13681368         m_hack_68k_to_6502_access = true;
1369         supracan_6502_soundmem_w(*mem, offset*2, data >> 8);
1369         supracan_6502_soundmem_w(mem, offset*2, data >> 8);
13701370         m_hack_68k_to_6502_access = false;
13711371      }
13721372      if(mem_mask & 0x00ff)
13731373      {
13741374         m_hack_68k_to_6502_access = true;
1375         supracan_6502_soundmem_w(*mem, offset*2 + 1, data & 0xff);
1375         supracan_6502_soundmem_w(mem, offset*2 + 1, data & 0xff);
13761376         m_hack_68k_to_6502_access = false;
13771377      }
13781378   }
r18027r18028
13801380
13811381READ16_MEMBER( supracan_state::supracan_68k_soundram_r )
13821382{
1383   address_space *mem = m_maincpu->space(AS_PROGRAM);
1383   address_space &mem = m_maincpu->space(AS_PROGRAM);
13841384   UINT16 val = m_soundram[offset*2 + 0] << 8;
13851385   val |= m_soundram[offset*2 + 1];
13861386
r18027r18028
13901390      if(mem_mask & 0xff00)
13911391      {
13921392         m_hack_68k_to_6502_access = true;
1393         val |= supracan_6502_soundmem_r(*mem, offset*2) << 8;
1393         val |= supracan_6502_soundmem_r(mem, offset*2) << 8;
13941394         m_hack_68k_to_6502_access = false;
13951395      }
13961396      if(mem_mask & 0x00ff)
13971397      {
13981398         m_hack_68k_to_6502_access = true;
1399         val |= supracan_6502_soundmem_r(*mem, offset*2 + 1);
1399         val |= supracan_6502_soundmem_r(mem, offset*2 + 1);
14001400         m_hack_68k_to_6502_access = false;
14011401      }
14021402   }
r18027r18028
14541454
14551455READ16_MEMBER( supracan_state::supracan_video_r )
14561456{
1457   address_space *mem = m_maincpu->space(AS_PROGRAM);
1457   address_space &mem = m_maincpu->space(AS_PROGRAM);
14581458   UINT16 data = m_video_regs[offset];
14591459
14601460   switch(offset)
14611461   {
14621462      case 0x00/2: // Video IRQ flags
1463         if(!mem->debugger_access())
1463         if(!mem.debugger_access())
14641464         {
14651465            //verboselog("maincpu", machine(), 0, "read video IRQ flags (%04x)\n", data);
14661466            m_maincpu->set_input_line(7, CLEAR_LINE);
r18027r18028
14721472         data = 0;
14731473         break;
14741474      case 0x100/2:
1475         if(!mem->debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_flags[0] (%04x)\n", data);
1475         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_flags[0] (%04x)\n", data);
14761476         break;
14771477      case 0x106/2:
1478         if(!mem->debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_scrolly[0] (%04x)\n", data);
1478         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_scrolly[0] (%04x)\n", data);
14791479         break;
14801480      case 0x120/2:
1481         if(!mem->debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_flags[1] (%04x)\n", data);
1481         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "read tilemap_flags[1] (%04x)\n", data);
14821482         break;
14831483      default:
1484         if(!mem->debugger_access()) verboselog("maincpu", machine(), 0, "supracan_video_r: Unknown register: %08x (%04x & %04x)\n", 0xf00000 + (offset << 1), data, mem_mask);
1484         if(!mem.debugger_access()) verboselog("maincpu", machine(), 0, "supracan_video_r: Unknown register: %08x (%04x & %04x)\n", 0xf00000 + (offset << 1), data, mem_mask);
14851485         break;
14861486   }
14871487
r18027r18028
15571557
15581558WRITE16_MEMBER( supracan_state::supracan_video_w )
15591559{
1560   address_space *mem = m_maincpu->space(AS_PROGRAM);
1560   address_space &mem = m_maincpu->space(AS_PROGRAM);
15611561   acan_sprdma_regs_t *acan_sprdma_regs = &m_acan_sprdma_regs;
15621562   int i;
15631563
r18027r18028
16181618            {
16191619               if(data & 0x0100) //dma 0x00 fill (or fixed value?)
16201620               {
1621                  mem->write_word(acan_sprdma_regs->dst, 0);
1621                  mem.write_word(acan_sprdma_regs->dst, 0);
16221622                  acan_sprdma_regs->dst+=2 * acan_sprdma_regs->dst_inc;
16231623                  //memset(supracan_vram,0x00,0x020000);
16241624               }
16251625               else
16261626               {
1627                  mem->write_word(acan_sprdma_regs->dst, mem->read_word(acan_sprdma_regs->src));
1627                  mem.write_word(acan_sprdma_regs->dst, mem.read_word(acan_sprdma_regs->src));
16281628                  acan_sprdma_regs->dst+=2 * acan_sprdma_regs->dst_inc;
16291629                  acan_sprdma_regs->src+=2 * acan_sprdma_regs->src_inc;
16301630               }
trunk/src/mess/drivers/bebox.c
r18027r18028
101101static UINT32 scsi53c810_fetch(running_machine &machine, UINT32 dsp)
102102{
103103   UINT32 result;
104   result = machine.device("ppc1")->memory().space(AS_PROGRAM)->read_dword(dsp & 0x7FFFFFFF);
104   result = machine.device("ppc1")->memory().space(AS_PROGRAM).read_dword(dsp & 0x7FFFFFFF);
105105   return BYTE_REVERSE32(result);
106106}
107107
trunk/src/mess/drivers/cd2650.c
r18027r18028
166166
167167QUICKLOAD_LOAD( cd2650 )
168168{
169   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
169   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
170170   int i;
171171   int quick_addr = 0x440;
172172   int exec_addr;
trunk/src/mess/drivers/tek405x.c
r18027r18028
117117
118118void tek4051_state::bankswitch(UINT8 data)
119119{
120   address_space *program = m_maincpu->space(AS_PROGRAM);
120   address_space &program = m_maincpu->space(AS_PROGRAM);
121121
122122   //int d = data & 0x07;
123123   int lbs = (data >> 3) & 0x07;
r18027r18028
125125   switch (lbs)
126126   {
127127   case LBS_RBC:
128      program->install_rom(0x8800, 0xa7ff, memregion(MC6800_TAG)->base() + 0x800);
128      program.install_rom(0x8800, 0xa7ff, memregion(MC6800_TAG)->base() + 0x800);
129129      break;
130130
131131   case LBS_BSOFL:
132      program->install_rom(0x8800, 0xa7ff, memregion("020_0147_00")->base());
132      program.install_rom(0x8800, 0xa7ff, memregion("020_0147_00")->base());
133133      break;
134134
135135   case LBS_BSCOM:
136      program->install_rom(0x8800, 0xa7ff, memregion("672_0799_08")->base());
136      program.install_rom(0x8800, 0xa7ff, memregion("672_0799_08")->base());
137137      break;
138138
139139   default:
140      program->unmap_readwrite(0x8800, 0xa7ff);
140      program.unmap_readwrite(0x8800, 0xa7ff);
141141   }
142142}
143143
r18027r18028
11671167
11681168void tek4051_state::machine_start()
11691169{
1170   address_space *program = m_maincpu->space(AS_PROGRAM);
1170   address_space &program = m_maincpu->space(AS_PROGRAM);
11711171
11721172   // configure RAM
11731173   switch (m_ram->size())
11741174   {
11751175   case 8*1024:
1176      program->unmap_readwrite(0x2000, 0x7fff);
1176      program.unmap_readwrite(0x2000, 0x7fff);
11771177      break;
11781178
11791179   case 16*1024:
1180      program->unmap_readwrite(0x4000, 0x7fff);
1180      program.unmap_readwrite(0x4000, 0x7fff);
11811181      break;
11821182
11831183   case 24*1024:
1184      program->unmap_readwrite(0x6000, 0x7fff);
1184      program.unmap_readwrite(0x6000, 0x7fff);
11851185      break;
11861186   }
11871187
trunk/src/mess/drivers/apricotf.c
r18027r18028
3232
3333UINT32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
3434{
35   address_space *program = m_maincpu->space(AS_PROGRAM);
35   address_space &program = m_maincpu->space(AS_PROGRAM);
3636   int lines = m_200_256 ? 200 : 256;
3737
3838   for (int y = 0; y < lines; y++)
r18027r18028
4141
4242      for (int sx = 0; sx < 80; sx++)
4343      {
44         UINT16 data = program->read_word(addr);
44         UINT16 data = program.read_word(addr);
4545
4646         if (m_40_80)
4747         {
trunk/src/mess/drivers/vg5k.c
r18027r18028
337337
338338
339339   /* install expansion memory*/
340   address_space *program = machine().device("maincpu")->memory().space(AS_PROGRAM);
340   address_space &program = machine().device("maincpu")->memory().space(AS_PROGRAM);
341341   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
342342   UINT16 ram_size = machine().device<ram_device>(RAM_TAG)->size();
343343
344344   if (ram_size > 0x4000)
345      program->install_ram(0x8000, 0x3fff + ram_size, ram);
345      program.install_ram(0x8000, 0x3fff + ram_size, ram);
346346}
347347
348348
trunk/src/mess/drivers/elwro800.c
r18027r18028
121121   {
122122      // rom BAS0
123123      state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x0000); /* BAS0 ROM */
124      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x0000, 0x1fff);
124      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x0000, 0x1fff);
125125      state->m_ram_at_0000 = 0;
126126   }
127127   else if (!BIT(cs,4))
128128   {
129129      // rom BOOT
130130      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000); /* BOOT ROM */
131      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x0000, 0x1fff);
131      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x0000, 0x1fff);
132132      state->m_ram_at_0000 = 0;
133133   }
134134   else
135135   {
136136      // RAM
137137      state->membank("bank1")->set_base(messram);
138      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x0000, 0x1fff, "bank1");
138      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0000, 0x1fff, "bank1");
139139      state->m_ram_at_0000 = 1;
140140   }
141141
r18027r18028
143143   if (!BIT(cs,1))
144144   {
145145      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x2000);   /* BAS1 ROM */
146      machine.device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x2000, 0x3fff);
146      machine.device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x2000, 0x3fff);
147147   }
148148   else
149149   {
150150      state->membank("bank2")->set_base(messram + 0x2000); /* RAM */
151      machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x2000, 0x3fff, "bank2");
151      machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x2000, 0x3fff, "bank2");
152152   }
153153
154154   if (BIT(ls175,2))
r18027r18028
524524   // this is a reset of ls175 in mmu
525525   elwro800jr_mmu_w(machine(), 0);
526526
527   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(elwro800_state::elwro800_direct_handler), this));
527   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(elwro800_state::elwro800_direct_handler), this));
528528}
529529
530530static const cassette_interface elwro800jr_cassette_interface =
trunk/src/mess/drivers/ms0515.c
r18027r18028
118118void ms0515_state::machine_reset()
119119{
120120   UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer();
121   ms0515_bank_w(*machine().memory().first_space(),0,0);
121   ms0515_bank_w(machine().driver_data()->generic_space(),0,0);
122122
123123   m_video_ram = ram + 0000000 + 0340000;
124124   m_blink = 0;
trunk/src/mess/drivers/mstation.c
r18027r18028
174174
175175void mstation_state::refresh_memory(UINT8 bank, UINT8 chip_select)
176176{
177   address_space* program = m_maincpu->space(AS_PROGRAM);
177   address_space& program = m_maincpu->space(AS_PROGRAM);
178178   int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000);
179179   char bank_tag[6];
180180
r18027r18028
185185         if (active_flash < 0)
186186         {
187187            if (bank == 1)
188               program->install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x4000_write_handler), this));
188               program.install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x4000_write_handler), this));
189189            else
190               program->install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x8000_write_handler), this));
190               program.install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x8000_write_handler), this));
191191         }
192192
193193         active_flash = chip_select ? 1 : 0;
r18027r18028
195195      case 1: // banked RAM
196196         sprintf(bank_tag,"bank%d", bank);
197197         membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1[0] : m_bank2[0]) & 0x07)<<14));
198         program->install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag);
198         program.install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag);
199199         active_flash = -1;
200200         break;
201201      case 2:   // left LCD panel
202         program->install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_left_r), this), write8_delegate(FUNC(mstation_state::lcd_left_w), this));
202         program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_left_r), this), write8_delegate(FUNC(mstation_state::lcd_left_w), this));
203203         active_flash = -1;
204204         break;
205205      case 4:   // right LCD panel
206         program->install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_right_r), this), write8_delegate(FUNC(mstation_state::lcd_right_w), this));
206         program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_right_r), this), write8_delegate(FUNC(mstation_state::lcd_right_w), this));
207207         active_flash = -1;
208208         break;
209209      default:
210210         logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff);
211         program->unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff);
211         program.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff);
212212         active_flash = -1;
213213         break;
214214   }
trunk/src/mess/drivers/pcfx.c
r18027r18028
6565
6666READ8_MEMBER(pcfx_state::extio_r)
6767{
68   address_space *io_space = m_maincpu->space(AS_IO);
68   address_space &io_space = m_maincpu->space(AS_IO);
6969
70   return io_space->read_byte(offset);
70   return io_space.read_byte(offset);
7171}
7272
7373WRITE8_MEMBER(pcfx_state::extio_w)
7474{
75   address_space *io_space = m_maincpu->space(AS_IO);
75   address_space &io_space = m_maincpu->space(AS_IO);
7676
77   io_space->write_byte(offset, data);
77   io_space.write_byte(offset, data);
7878}
7979
8080static ADDRESS_MAP_START( pcfx_mem, AS_PROGRAM, 32, pcfx_state )
trunk/src/mess/drivers/a310.c
r18027r18028
113113{
114114   UINT32 ram_size = machine().device<ram_device>(RAM_TAG)->size();
115115
116   machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x02000000, 0x02000000+(ram_size-1), read32_delegate(FUNC(a310_state::a310_psy_wram_r), this), write32_delegate(FUNC(a310_state::a310_psy_wram_w), this));
116   machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x02000000, 0x02000000+(ram_size-1), read32_delegate(FUNC(a310_state::a310_psy_wram_r), this), write32_delegate(FUNC(a310_state::a310_psy_wram_w), this));
117117
118118   archimedes_driver_init(machine());
119119}
trunk/src/mess/drivers/avigo.c
r18027r18028
158158
159159void avigo_state::refresh_memory(UINT8 bank, UINT8 chip_select)
160160{
161   address_space& space = *m_maincpu->space(AS_PROGRAM);
161   address_space& space = m_maincpu->space(AS_PROGRAM);
162162   int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000);
163163   char bank_tag[6];
164164
r18027r18028
246246   /* if is a cold start initialize flash contents */
247247   if (!m_warm_start)
248248   {
249      memcpy(m_flashes[0]->space()->get_read_ptr(0), memregion("bios")->base() + 0x000000, 0x100000);
250      memcpy(m_flashes[1]->space()->get_read_ptr(0), memregion("bios")->base() + 0x100000, 0x100000);
249      memcpy(m_flashes[0]->space().get_read_ptr(0), memregion("bios")->base() + 0x000000, 0x100000);
250      memcpy(m_flashes[1]->space().get_read_ptr(0), memregion("bios")->base() + 0x100000, 0x100000);
251251   }
252252
253253   m_irq = 0;
r18027r18028
293293   save_item(NAME(m_warm_start));
294294
295295   // save all flash contents
296   save_pointer(NAME((UINT8*)m_flashes[0]->space()->get_read_ptr(0)), 0x100000);
297   save_pointer(NAME((UINT8*)m_flashes[1]->space()->get_read_ptr(0)), 0x100000);
298   save_pointer(NAME((UINT8*)m_flashes[2]->space()->get_read_ptr(0)), 0x100000);
296   save_pointer(NAME((UINT8*)m_flashes[0]->space().get_read_ptr(0)), 0x100000);
297   save_pointer(NAME((UINT8*)m_flashes[1]->space().get_read_ptr(0)), 0x100000);
298   save_pointer(NAME((UINT8*)m_flashes[2]->space().get_read_ptr(0)), 0x100000);
299299
300300   // register postload callback
301301   machine().save().register_postload(save_prepost_delegate(FUNC(avigo_state::postload), this));
r18027r18028
830830static QUICKLOAD_LOAD(avigo)
831831{
832832   avigo_state *state = image.device().machine().driver_data<avigo_state>();
833   address_space* flash1 = state->m_flashes[1]->space(0);
833   address_space& flash1 = state->m_flashes[1]->space(0);
834834   const char *systemname = image.device().machine().system().name;
835835   UINT32 first_app_page = (0x50000>>14);
836836   int app_page;
r18027r18028
846846
847847      for (int offset=0; offset<0x4000; offset++)
848848      {
849         if (flash1->read_byte((app_page<<14) + offset) != 0xff)
849         if (flash1.read_byte((app_page<<14) + offset) != 0xff)
850850         {
851851            empty_page = false;
852852            break;
r18027r18028
863863      logerror("Application loaded at 0x%05x-0x%05x\n", app_page<<14, (app_page<<14) + (UINT32)image.length());
864864
865865      // copy app file into flash memory
866      image.fread((UINT8*)state->m_flashes[1]->space()->get_read_ptr(app_page<<14), image.length());
866      image.fread((UINT8*)state->m_flashes[1]->space().get_read_ptr(app_page<<14), image.length());
867867
868868      // update the application ID
869      flash1->write_byte((app_page<<14) + 0x1a5, 0x80 + (app_page - (first_app_page>>14)));
869      flash1.write_byte((app_page<<14) + 0x1a5, 0x80 + (app_page - (first_app_page>>14)));
870870
871871      // reset the CPU for allow at the Avigo OS to recognize the installed app
872872      state->m_warm_start = 1;
trunk/src/mess/drivers/mpz80.c
r18027r18028
840840
841841DRIVER_INIT_MEMBER(mpz80_state,mpz80)
842842{
843   address_space *program = machine().device<cpu_device>(Z80_TAG)->space(AS_PROGRAM);
844   program->set_direct_update_handler(direct_update_delegate(FUNC(mpz80_state::mpz80_direct_update_handler), this));
843   address_space &program = machine().device<cpu_device>(Z80_TAG)->space(AS_PROGRAM);
844   program.set_direct_update_handler(direct_update_delegate(FUNC(mpz80_state::mpz80_direct_update_handler), this));
845845}
846846
847847
trunk/src/mess/drivers/super6.c
r18027r18028
3030
3131void super6_state::bankswitch()
3232{
33   address_space *program = m_maincpu->space(AS_PROGRAM);
33   address_space &program = m_maincpu->space(AS_PROGRAM);
3434   UINT8 *ram = m_ram->pointer();
3535   UINT8 *rom = memregion(Z80_TAG)->base();
3636
3737   // power on jump
38   if (!BIT(m_bank0, 6)) {   program->install_rom(0x0000, 0x07ff, 0, 0xf800, rom); return; }
38   if (!BIT(m_bank0, 6)) {   program.install_rom(0x0000, 0x07ff, 0, 0xf800, rom); return; }
3939
4040   // first 64KB of memory
41   program->install_ram(0x0000, 0xffff, ram);
41   program.install_ram(0x0000, 0xffff, ram);
4242
4343   // second 64KB of memory
4444   int map = (m_bank1 >> 4) & 0x07;
r18027r18028
4646   switch (map)
4747   {
4848   case 0:
49      if (BIT(m_bank1, 0)) program->install_ram(0x0000, 0x3fff, ram + 0x10000);
50      if (BIT(m_bank1, 1)) program->install_ram(0x4000, 0x7fff, ram + 0x14000);
51      if (BIT(m_bank1, 2)) program->install_ram(0x8000, 0xbfff, ram + 0x18000);
52      if (BIT(m_bank1, 3)) program->install_ram(0xc000, 0xffff, ram + 0x1c000);
49      if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000);
50      if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000);
51      if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000);
52      if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000);
5353      break;
5454
5555   case 1:
56      if (BIT(m_bank1, 0)) program->install_ram(0x0000, 0x3fff, ram + 0x10000);
57      if (BIT(m_bank1, 1)) program->install_ram(0x4000, 0x7fff, ram + 0x14000);
58      if (BIT(m_bank1, 2)) program->install_ram(0x8000, 0xbfff, ram + 0x18000);
59      if (BIT(m_bank1, 3)) program->install_ram(0xc000, 0xffff, ram + 0x0000);
56      if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000);
57      if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000);
58      if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000);
59      if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x0000);
6060      break;
6161
6262   case 2:
63      if (BIT(m_bank1, 0)) program->install_ram(0x0000, 0x3fff, ram + 0x10000);
64      if (BIT(m_bank1, 1)) program->install_ram(0x4000, 0x7fff, ram + 0x14000);
65      if (BIT(m_bank1, 2)) program->install_ram(0x8000, 0xbfff, ram + 0x4000);
66      if (BIT(m_bank1, 3)) program->install_ram(0xc000, 0xffff, ram + 0x1c000);
63      if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000);
64      if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000);
65      if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x4000);
66      if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000);
6767      break;
6868
6969   case 3:
70      if (BIT(m_bank1, 0)) program->install_ram(0x0000, 0x3fff, ram + 0x10000);
71      if (BIT(m_bank1, 1)) program->install_ram(0x4000, 0x7fff, ram + 0x14000);
72      if (BIT(m_bank1, 2)) program->install_ram(0x8000, 0xbfff, ram + 0x0000);
73      if (BIT(m_bank1, 3)) program->install_ram(0xc000, 0xffff, ram + 0x4000);
70      if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x10000);
71      if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000);
72      if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x0000);
73      if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x4000);
7474      break;
7575
7676   case 4:
77      if (BIT(m_bank1, 0)) program->install_ram(0x0000, 0x3fff, ram + 0xc000);
78      if (BIT(m_bank1, 1)) program->install_ram(0x4000, 0x7fff, ram + 0x14000);
79      if (BIT(m_bank1, 2)) program->install_ram(0x8000, 0xbfff, ram + 0x18000);
80      if (BIT(m_bank1, 3)) program->install_ram(0xc000, 0xffff, ram + 0x1c000);
77      if (BIT(m_bank1, 0)) program.install_ram(0x0000, 0x3fff, ram + 0xc000);
78      if (BIT(m_bank1, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x14000);
79      if (BIT(m_bank1, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x18000);
80      if (BIT(m_bank1, 3)) program.install_ram(0xc000, 0xffff, ram + 0x1c000);
8181      break;
8282   }
8383
8484   // bank 0 overrides
85   if (BIT(m_bank0, 0)) program->install_ram(0x0000, 0x3fff, ram + 0x0000);
86   if (BIT(m_bank0, 1)) program->install_ram(0x4000, 0x7fff, ram + 0x4000);
87   if (BIT(m_bank0, 2)) program->install_ram(0x8000, 0xbfff, ram + 0x8000);
88   if (BIT(m_bank0, 3)) program->install_ram(0xc000, 0xffff, ram + 0xc000);
85   if (BIT(m_bank0, 0)) program.install_ram(0x0000, 0x3fff, ram + 0x0000);
86   if (BIT(m_bank0, 1)) program.install_ram(0x4000, 0x7fff, ram + 0x4000);
87   if (BIT(m_bank0, 2)) program.install_ram(0x8000, 0xbfff, ram + 0x8000);
88   if (BIT(m_bank0, 3)) program.install_ram(0xc000, 0xffff, ram + 0xc000);
8989
9090   // PROM enabled
91   if (!BIT(m_bank0, 5)) program->install_rom(0xf000, 0xf7ff, 0, 0x800, rom);
91   if (!BIT(m_bank0, 5)) program.install_rom(0xf000, 0xf7ff, 0, 0x800, rom);
9292}
9393
9494
trunk/src/mess/drivers/c64.c
r18027r18028
848848
849849READ8_MEMBER( c64_state::exp_dma_r )
850850{
851   return m_maincpu->space(AS_PROGRAM)->read_byte(offset);
851   return m_maincpu->space(AS_PROGRAM).read_byte(offset);
852852}
853853
854854WRITE8_MEMBER( c64_state::exp_dma_w )
855855{
856   m_maincpu->space(AS_PROGRAM)->write_byte(offset, data);
856   m_maincpu->space(AS_PROGRAM).write_byte(offset, data);
857857}
858858
859859WRITE_LINE_MEMBER( c64_state::exp_irq_w )
trunk/src/mess/drivers/ti89.c
r18027r18028
445445      m_hw_version = m_HW1;
446446      m_initial_pc = ((rom[2]) << 16) | rom[3];
447447
448      m_maincpu->space(AS_PROGRAM)->unmap_read(0x200000, 0x5fffff);
448      m_maincpu->space(AS_PROGRAM).unmap_read(0x200000, 0x5fffff);
449449
450450      if (m_initial_pc > 0x400000)
451451      {
452         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x400000, 0x5fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this),write16_delegate(FUNC(ti68k_state::flash_w), this));
452         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x400000, 0x5fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this),write16_delegate(FUNC(ti68k_state::flash_w), this));
453453      }
454454        else
455455      {
456         m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x200000, 0x3fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this), write16_delegate(FUNC(ti68k_state::flash_w), this));
456         m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x200000, 0x3fffff, 0, 0, read16_delegate(FUNC(ti68k_state::flash_r), this), write16_delegate(FUNC(ti68k_state::flash_w), this));
457457      }
458458   }
459459
r18027r18028
493493      for (y = 0; y < height; y++)
494494         for (x = 0; x < width / 8; x++)
495495         {
496            UINT8 s_byte= m_maincpu->space(AS_PROGRAM)->read_byte(m_lcd_base + y * (width/8) + x);
496            UINT8 s_byte= m_maincpu->space(AS_PROGRAM).read_byte(m_lcd_base + y * (width/8) + x);
497497            for (b = 0; b<8; b++)
498498               bitmap.pix16(y, x * 8 + (7 - b)) = BIT(s_byte, b);
499499         }
trunk/src/mess/drivers/xerox820.c
r18027r18028
143143
144144void xerox820_state::bankswitch(int bank)
145145{
146   address_space *program = m_maincpu->space(AS_PROGRAM);
146   address_space &program = m_maincpu->space(AS_PROGRAM);
147147   UINT8 *ram = m_ram->pointer();
148148
149149   if (bank)
150150   {
151151      /* ROM */
152      program->install_rom(0x0000, 0x0fff, memregion("monitor")->base());
153      program->unmap_readwrite(0x1000, 0x1fff);
154      program->install_ram(0x3000, 0x3fff, m_video_ram);
152      program.install_rom(0x0000, 0x0fff, memregion("monitor")->base());
153      program.unmap_readwrite(0x1000, 0x1fff);
154      program.install_ram(0x3000, 0x3fff, m_video_ram);
155155   }
156156   else
157157   {
158158      /* RAM */
159      program->install_ram(0x0000, 0x3fff, ram);
159      program.install_ram(0x0000, 0x3fff, ram);
160160   }
161161}
162162
163163void xerox820ii_state::bankswitch(int bank)
164164{
165   address_space *program = m_maincpu->space(AS_PROGRAM);
165   address_space &program = m_maincpu->space(AS_PROGRAM);
166166   UINT8 *ram = m_ram->pointer();
167167
168168   if (bank)
169169   {
170170      /* ROM */
171      program->install_rom(0x0000, 0x17ff, memregion("monitor")->base());
172      program->unmap_readwrite(0x1800, 0x2fff);
173      program->install_ram(0x3000, 0x3fff, m_video_ram);
174      program->unmap_readwrite(0x4000, 0xbfff);
171      program.install_rom(0x0000, 0x17ff, memregion("monitor")->base());
172      program.unmap_readwrite(0x1800, 0x2fff);
173      program.install_ram(0x3000, 0x3fff, m_video_ram);
174      program.unmap_readwrite(0x4000, 0xbfff);
175175   }
176176   else
177177   {
178178      /* RAM */
179      program->install_ram(0x0000, 0xbfff, ram);
179      program.install_ram(0x0000, 0xbfff, ram);
180180   }
181181}
182182
trunk/src/mess/drivers/micronic.c
r18027r18028
164164   if (data < 2)
165165   {
166166      membank("bank1")->set_entry(data);
167      m_maincpu->space(AS_PROGRAM)->unmap_write(0x0000, 0x7fff);
167      m_maincpu->space(AS_PROGRAM).unmap_write(0x0000, 0x7fff);
168168   }
169169   else
170170   {
171171      membank("bank1")->set_entry((data <= m_banks_num) ? data : m_banks_num);
172      m_maincpu->space(AS_PROGRAM)->install_write_bank(0x0000, 0x7fff, "bank1");
172      m_maincpu->space(AS_PROGRAM).install_write_bank(0x0000, 0x7fff, "bank1");
173173   }
174174}
175175
r18027r18028
342342void micronic_state::machine_reset()
343343{
344344   membank("bank1")->set_entry(0);
345   m_maincpu->space(AS_PROGRAM)->unmap_write(0x0000, 0x7fff);
345   m_maincpu->space(AS_PROGRAM).unmap_write(0x0000, 0x7fff);
346346}
347347
348348
trunk/src/mess/drivers/vc4000.c
r18027r18028
339339{
340340   running_machine &machine = image.device().machine();
341341   vc4000_state *state = machine.driver_data<vc4000_state>();
342   address_space *memspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
342   address_space &memspace = machine.device("maincpu")->memory().space(AS_PROGRAM);
343343   UINT32 size;
344344
345345   if (image.software_entry() == NULL)
r18027r18028
352352
353353   if (size > 0x1000)   /* 6k rom + 1k ram - Chess2 only */
354354   {
355      memspace->install_read_bank(0x0800, 0x15ff, "bank1");   /* extra rom */
355      memspace.install_read_bank(0x0800, 0x15ff, "bank1");   /* extra rom */
356356      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x1000);
357357
358      memspace->install_readwrite_bank(0x1800, 0x1bff, "bank2");   /* ram */
358      memspace.install_readwrite_bank(0x1800, 0x1bff, "bank2");   /* ram */
359359      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x1800);
360360   }
361361   else if (size > 0x0800)   /* some 4k roms have 1k of mirrored ram */
362362   {
363      memspace->install_read_bank(0x0800, 0x0fff, "bank1");   /* extra rom */
363      memspace.install_read_bank(0x0800, 0x0fff, "bank1");   /* extra rom */
364364      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x0800);
365365
366      memspace->install_readwrite_bank(0x1000, 0x15ff, 0, 0x800, "bank2"); /* ram */
366      memspace.install_readwrite_bank(0x1000, 0x15ff, 0, 0x800, "bank2"); /* ram */
367367      state->membank("bank2")->set_base(machine.root_device().memregion("maincpu")->base() + 0x1000);
368368   }
369369   else if (size == 0x0800)   /* 2k roms + 2k ram - Hobby Module(Radofin) and elektor TVGC*/
370370   {
371      memspace->install_readwrite_bank(0x0800, 0x0fff, "bank1"); /* ram */
371      memspace.install_readwrite_bank(0x0800, 0x0fff, "bank1"); /* ram */
372372      state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base() + 0x0800);
373373   }
374374
r18027r18028
530530
531531QUICKLOAD_LOAD(vc4000)
532532{
533   address_space &space = *image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
533   address_space &space = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
534534   int i;
535535   int quick_addr = 0x08c0;
536536   int exec_addr;
trunk/src/mess/drivers/cosmicos.c
r18027r18028
252252
253253void cosmicos_state::set_ram_mode()
254254{
255   address_space *program = m_maincpu->space(AS_PROGRAM);
255   address_space &program = m_maincpu->space(AS_PROGRAM);
256256   UINT8 *ram = m_ram->pointer();
257257
258258   if (m_ram_disable)
259259   {
260      program->unmap_readwrite(0xff00, 0xffff);
260      program.unmap_readwrite(0xff00, 0xffff);
261261   }
262262   else
263263   {
264264      if (m_ram_protect)
265265      {
266         program->install_rom(0xff00, 0xffff, ram);
266         program.install_rom(0xff00, 0xffff, ram);
267267      }
268268      else
269269      {
270         program->install_ram(0xff00, 0xffff, ram);
270         program.install_ram(0xff00, 0xffff, ram);
271271      }
272272   }
273273}
r18027r18028
486486
487487void cosmicos_state::machine_start()
488488{
489   address_space *program = m_maincpu->space(AS_PROGRAM);
489   address_space &program = m_maincpu->space(AS_PROGRAM);
490490
491491   /* initialize LED display */
492492   m_led->rbi_w(1);
r18027r18028
495495   switch (m_ram->size())
496496   {
497497   case 256:
498      program->unmap_readwrite(0x0000, 0xbfff);
498      program.unmap_readwrite(0x0000, 0xbfff);
499499      break;
500500
501501   case 4*1024:
502      program->unmap_readwrite(0x1000, 0xbfff);
502      program.unmap_readwrite(0x1000, 0xbfff);
503503      break;
504504   }
505505
r18027r18028
622622
623623DRIVER_INIT_MEMBER(cosmicos_state,cosmicos)
624624{
625   address_space *program = machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM);
625   address_space &program = machine().device(CDP1802_TAG)->memory().space(AS_PROGRAM);
626626
627   program->set_direct_update_handler(direct_update_delegate(FUNC(cosmicos_state::cosmicos_direct_update_handler), this));
627   program.set_direct_update_handler(direct_update_delegate(FUNC(cosmicos_state::cosmicos_direct_update_handler), this));
628628}
629629
630630/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT        COMPANY             FULLNAME    FLAGS */
trunk/src/mess/drivers/vic10.c
r18027r18028
124124
125125READ8_MEMBER( vic10_state::vic_videoram_r )
126126{
127   address_space *program = m_maincpu->space(AS_PROGRAM);
127   address_space &program = m_maincpu->space(AS_PROGRAM);
128128
129129   if (offset < 0x3000)
130      return program->read_byte(offset);
130      return program.read_byte(offset);
131131
132   return program->read_byte(0xe000 + (offset & 0x1fff));
132   return program.read_byte(0xe000 + (offset & 0x1fff));
133133}
134134
135135
trunk/src/mess/drivers/gba.c
r18027r18028
154154   int ctrl;
155155   int srcadd, dstadd;
156156   UINT32 src, dst;
157   address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM);
157   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
158158   gba_state *state = machine.driver_data<gba_state>();
159159
160160   src = state->m_dma_src[ch];
r18027r18028
30613061
30623062      if (cart_size <= (16 * 1024 * 1024))
30633063      {
3064         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd000000, 0xdffffff, read32_delegate(FUNC(gba_state::eeprom_r),state));
3065         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd000000, 0xdffffff, write32_delegate(FUNC(gba_state::eeprom_w),state));
3064         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd000000, 0xdffffff, read32_delegate(FUNC(gba_state::eeprom_r),state));
3065         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd000000, 0xdffffff, write32_delegate(FUNC(gba_state::eeprom_w),state));
30663066      }
30673067      else
30683068      {
3069         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xdffff00, 0xdffffff, read32_delegate(FUNC(gba_state::eeprom_r),state));
3070         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xdffff00, 0xdffffff, write32_delegate(FUNC(gba_state::eeprom_w),state));
3069         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xdffff00, 0xdffffff, read32_delegate(FUNC(gba_state::eeprom_r),state));
3070         image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xdffff00, 0xdffffff, write32_delegate(FUNC(gba_state::eeprom_w),state));
30713071      }
30723072   }
30733073
r18027r18028
30763076      state->m_nvptr = (UINT8 *)&state->m_gba_sram;
30773077      state->m_nvsize = 0x10000;
30783078
3079      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_state::sram_r),state));
3080      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_state::sram_w),state));
3079      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_state::sram_r),state));
3080      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_state::sram_w),state));
30813081   }
30823082
30833083   if (chip & GBA_CHIP_FLASH_1M)
r18027r18028
30873087      state->m_flash_size = 0x20000;
30883088      state->m_flash_mask = 0x1ffff/4;
30893089
3090      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe000000, 0xe01ffff, read32_delegate(FUNC(gba_state::flash_r),state));
3091      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe000000, 0xe01ffff, write32_delegate(FUNC(gba_state::flash_w),state));
3090      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xe000000, 0xe01ffff, read32_delegate(FUNC(gba_state::flash_r),state));
3091      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe000000, 0xe01ffff, write32_delegate(FUNC(gba_state::flash_w),state));
30923092   }
30933093
30943094   if ((chip & GBA_CHIP_FLASH) || (chip & GBA_CHIP_FLASH_512))
r18027r18028
30983098      state->m_flash_size = 0x10000;
30993099      state->m_flash_mask = 0xffff/4;
31003100
3101      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_state::flash_r),state));
3102      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_state::flash_w),state));
3101      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xe000000, 0xe00ffff, read32_delegate(FUNC(gba_state::flash_r),state));
3102      image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe000000, 0xe00ffff, write32_delegate(FUNC(gba_state::flash_w),state));
31033103   }
31043104
31053105   if (chip & GBA_CHIP_RTC)
r18027r18028
32043204
32053205DRIVER_INIT_MEMBER(gba_state,gbadv)
32063206{
3207   machine().device("maincpu")->memory().space(AS_PROGRAM)->set_direct_update_handler(direct_update_delegate(FUNC(gba_state::gba_direct), this));
3207   machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(gba_state::gba_direct), this));
32083208}
32093209
32103210/*    YEAR  NAME PARENT COMPAT MACHINE INPUT   INIT   COMPANY     FULLNAME */
trunk/src/mess/drivers/vixen.c
r18027r18028
809809
810810void vixen_state::machine_reset()
811811{
812   address_space *program = m_maincpu->space(AS_PROGRAM);
812   address_space &program = m_maincpu->space(AS_PROGRAM);
813813
814   program->install_read_bank(0x0000, 0xefff, 0xfff, 0, "bank1");
815   program->install_write_bank(0x0000, 0xefff, 0xfff, 0, "bank2");
814   program.install_read_bank(0x0000, 0xefff, 0xfff, 0, "bank1");
815   program.install_write_bank(0x0000, 0xefff, 0xfff, 0, "bank2");
816816
817817   membank("bank1")->set_entry(1);
818818   membank("bank2")->set_entry(1);
r18027r18028
910910   {
911911      if (m_reset)
912912      {
913         address_space *program = m_maincpu->space(AS_PROGRAM);
913         address_space &program = m_maincpu->space(AS_PROGRAM);
914914
915         program->install_read_bank(0x0000, 0xefff, "bank1");
916         program->install_write_bank(0x0000, 0xefff, "bank2");
915         program.install_read_bank(0x0000, 0xefff, "bank1");
916         program.install_write_bank(0x0000, 0xefff, "bank2");
917917
918918         membank("bank1")->set_entry(0);
919919         membank("bank2")->set_entry(0);
r18027r18028
931931
932932DRIVER_INIT_MEMBER(vixen_state,vixen)
933933{
934   address_space *program = machine().device<cpu_device>(Z8400A_TAG)->space(AS_PROGRAM);
935   program->set_direct_update_handler(direct_update_delegate(FUNC(vixen_state::vixen_direct_update_handler), this));
934   address_space &program = machine().device<cpu_device>(Z8400A_TAG)->space(AS_PROGRAM);
935   program.set_direct_update_handler(direct_update_delegate(FUNC(vixen_state::vixen_direct_update_handler), this));
936936}
937937
938938

Previous 199869 Revisions Next


© 1997-2024 The MAME Team