summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/emu/cpu/drcbec.c56
-rw-r--r--src/emu/cpu/drcbex64.c63
-rw-r--r--src/emu/cpu/drcbex86.c82
-rw-r--r--src/emu/cpu/mcs48/mcs48.c2
-rw-r--r--src/emu/cpu/mcs51/mcs51.c4
-rw-r--r--src/emu/cpu/mips/mips3com.c2
-rw-r--r--src/emu/cpu/mips/mips3drc.c2
-rw-r--r--src/emu/cpu/mips/psx.c7
-rw-r--r--src/emu/cpu/powerpc/drc_ops.c2
-rw-r--r--src/emu/cpu/powerpc/ppc_mem.c2
-rw-r--r--src/emu/cpu/powerpc/ppccom.c2
-rw-r--r--src/emu/cpu/powerpc/ppcdrc.c2
-rw-r--r--src/emu/cpu/sh2/sh2drc.c2
-rw-r--r--src/emu/cpuexec.c2
-rw-r--r--src/emu/cpuintrf.c6
-rw-r--r--src/emu/cpuintrf.h25
-rw-r--r--src/emu/debug/debugcmd.c303
-rw-r--r--src/emu/debug/debugcmt.c4
-rw-r--r--src/emu/debug/debugcon.c2
-rw-r--r--src/emu/debug/debugcpu.c883
-rw-r--r--src/emu/debug/debugcpu.h28
-rw-r--r--src/emu/debug/debugvw.c18
-rw-r--r--src/emu/debugger.h37
-rw-r--r--src/emu/mame.h2
-rw-r--r--src/emu/memory.c2514
-rw-r--r--src/emu/memory.h335
-rw-r--r--src/mame/audio/atarijsa.c2
-rw-r--r--src/mame/audio/cage.c2
-rw-r--r--src/mame/audio/cinemat.c2
-rw-r--r--src/mame/audio/dcs.c28
-rw-r--r--src/mame/audio/jaguar.c2
-rw-r--r--src/mame/audio/leland.c8
-rw-r--r--src/mame/audio/mario.c6
-rw-r--r--src/mame/audio/namcoc7x.c2
-rw-r--r--src/mame/audio/seibu.c7
-rw-r--r--src/mame/audio/williams.c8
-rw-r--r--src/mame/drivers/1942.c2
-rw-r--r--src/mame/drivers/40love.c4
-rw-r--r--src/mame/drivers/actfancr.c4
-rw-r--r--src/mame/drivers/airbustr.c2
-rw-r--r--src/mame/drivers/aladbl.c4
-rw-r--r--src/mame/drivers/alg.c8
-rw-r--r--src/mame/drivers/alpha68k.c18
-rw-r--r--src/mame/drivers/appoooh.c3
-rw-r--r--src/mame/drivers/arabian.c4
-rw-r--r--src/mame/drivers/arcadia.c10
-rw-r--r--src/mame/drivers/arkanoid.c6
-rw-r--r--src/mame/drivers/artmagic.c2
-rw-r--r--src/mame/drivers/asteroid.c6
-rw-r--r--src/mame/drivers/astrocde.c62
-rw-r--r--src/mame/drivers/astrof.c12
-rw-r--r--src/mame/drivers/asuka.c4
-rw-r--r--src/mame/drivers/atarig1.c2
-rw-r--r--src/mame/drivers/atarig42.c4
-rw-r--r--src/mame/drivers/atarigt.c2
-rw-r--r--src/mame/drivers/atarigx2.c2
-rw-r--r--src/mame/drivers/ataxx.c36
-rw-r--r--src/mame/drivers/backfire.c2
-rw-r--r--src/mame/drivers/balsente.c20
-rw-r--r--src/mame/drivers/beathead.c4
-rw-r--r--src/mame/drivers/bfm_sc2.c4
-rw-r--r--src/mame/drivers/blktiger.c2
-rw-r--r--src/mame/drivers/btime.c22
-rw-r--r--src/mame/drivers/bublbobl.c2
-rw-r--r--src/mame/drivers/bzone.c10
-rw-r--r--src/mame/drivers/calorie.c3
-rw-r--r--src/mame/drivers/cave.c2
-rw-r--r--src/mame/drivers/cbasebal.c2
-rw-r--r--src/mame/drivers/ccastles.c2
-rw-r--r--src/mame/drivers/centiped.c8
-rw-r--r--src/mame/drivers/chinsan.c2
-rw-r--r--src/mame/drivers/chqflag.c14
-rw-r--r--src/mame/drivers/cidelsa.c2
-rw-r--r--src/mame/drivers/cinemat.c18
-rw-r--r--src/mame/drivers/cischeat.c2
-rw-r--r--src/mame/drivers/cninja.c4
-rw-r--r--src/mame/drivers/cojag.c32
-rw-r--r--src/mame/drivers/combatsc.c2
-rw-r--r--src/mame/drivers/commando.c6
-rw-r--r--src/mame/drivers/coolpool.c2
-rw-r--r--src/mame/drivers/cosmic.c10
-rw-r--r--src/mame/drivers/cps1.c26
-rw-r--r--src/mame/drivers/cps2.c2
-rw-r--r--src/mame/drivers/crgolf.c4
-rw-r--r--src/mame/drivers/crimfght.c4
-rw-r--r--src/mame/drivers/cshooter.c3
-rw-r--r--src/mame/drivers/cubocd32.c8
-rw-r--r--src/mame/drivers/darkmist.c3
-rw-r--r--src/mame/drivers/dassault.c4
-rw-r--r--src/mame/drivers/ddealer.c2
-rw-r--r--src/mame/drivers/ddenlovr.c2
-rw-r--r--src/mame/drivers/ddragon.c10
-rw-r--r--src/mame/drivers/deadang.c4
-rw-r--r--src/mame/drivers/dec8.c9
-rw-r--r--src/mame/drivers/deco_mlc.c2
-rw-r--r--src/mame/drivers/decocass.c19
-rw-r--r--src/mame/drivers/dgpix.c4
-rw-r--r--src/mame/drivers/dkong.c12
-rw-r--r--src/mame/drivers/dooyong.c2
-rw-r--r--src/mame/drivers/dynax.c2
-rw-r--r--src/mame/drivers/eprom.c4
-rw-r--r--src/mame/drivers/equites.c6
-rw-r--r--src/mame/drivers/exidy.c2
-rw-r--r--src/mame/drivers/exidy440.c14
-rw-r--r--src/mame/drivers/exprraid.c4
-rw-r--r--src/mame/drivers/fastfred.c10
-rw-r--r--src/mame/drivers/firebeat.c6
-rw-r--r--src/mame/drivers/firefox.c2
-rw-r--r--src/mame/drivers/fitfight.c4
-rw-r--r--src/mame/drivers/freekick.c5
-rw-r--r--src/mame/drivers/gaelco3d.c2
-rw-r--r--src/mame/drivers/gaiden.c8
-rw-r--r--src/mame/drivers/galaga.c6
-rw-r--r--src/mame/drivers/galaxian.c127
-rw-r--r--src/mame/drivers/galivan.c12
-rw-r--r--src/mame/drivers/gladiatr.c2
-rw-r--r--src/mame/drivers/gng.c6
-rw-r--r--src/mame/drivers/gottlieb.c8
-rw-r--r--src/mame/drivers/groundfx.c2
-rw-r--r--src/mame/drivers/gstream.c2
-rw-r--r--src/mame/drivers/gstriker.c12
-rw-r--r--src/mame/drivers/gsword.c4
-rw-r--r--src/mame/drivers/gunbustr.c2
-rw-r--r--src/mame/drivers/gundealr.c2
-rw-r--r--src/mame/drivers/harddriv.c202
-rw-r--r--src/mame/drivers/homedata.c8
-rw-r--r--src/mame/drivers/hornet.c4
-rw-r--r--src/mame/drivers/hshavoc.c2
-rw-r--r--src/mame/drivers/hyprduel.c10
-rw-r--r--src/mame/drivers/iqblock.c4
-rw-r--r--src/mame/drivers/itech32.c36
-rw-r--r--src/mame/drivers/itech8.c32
-rw-r--r--src/mame/drivers/jack.c7
-rw-r--r--src/mame/drivers/jalmah.c18
-rw-r--r--src/mame/drivers/jchan.c4
-rw-r--r--src/mame/drivers/jedi.c2
-rw-r--r--src/mame/drivers/junofrst.c4
-rw-r--r--src/mame/drivers/kangaroo.c4
-rw-r--r--src/mame/drivers/kchamp.c3
-rw-r--r--src/mame/drivers/konamigv.c30
-rw-r--r--src/mame/drivers/konamigx.c12
-rw-r--r--src/mame/drivers/ksys573.c12
-rw-r--r--src/mame/drivers/kyugo.c6
-rw-r--r--src/mame/drivers/ladybug.c3
-rw-r--r--src/mame/drivers/leland.c62
-rw-r--r--src/mame/drivers/lethalj.c6
-rw-r--r--src/mame/drivers/liberate.c8
-rw-r--r--src/mame/drivers/limenko.c8
-rw-r--r--src/mame/drivers/lkage.c6
-rw-r--r--src/mame/drivers/looping.c2
-rw-r--r--src/mame/drivers/m62.c16
-rw-r--r--src/mame/drivers/m72.c40
-rw-r--r--src/mame/drivers/m92.c4
-rw-r--r--src/mame/drivers/macrossp.c4
-rw-r--r--src/mame/drivers/mappy.c4
-rw-r--r--src/mame/drivers/mcr.c2
-rw-r--r--src/mame/drivers/mcr3.c34
-rw-r--r--src/mame/drivers/mcr68.c18
-rw-r--r--src/mame/drivers/mediagx.c2
-rw-r--r--src/mame/drivers/megadriv.c72
-rw-r--r--src/mame/drivers/megaplay.c6
-rw-r--r--src/mame/drivers/megasys1.c10
-rw-r--r--src/mame/drivers/megatech.c32
-rw-r--r--src/mame/drivers/meritm.c12
-rw-r--r--src/mame/drivers/mhavoc.c4
-rw-r--r--src/mame/drivers/midvunit.c26
-rw-r--r--src/mame/drivers/midzeus.c10
-rw-r--r--src/mame/drivers/mitchell.c7
-rw-r--r--src/mame/drivers/model2.c12
-rw-r--r--src/mame/drivers/model3.c94
-rw-r--r--src/mame/drivers/mouser.c3
-rw-r--r--src/mame/drivers/mpu4.c2
-rw-r--r--src/mame/drivers/mquake.c8
-rw-r--r--src/mame/drivers/ms32.c4
-rw-r--r--src/mame/drivers/multigam.c4
-rw-r--r--src/mame/drivers/namcos11.c32
-rw-r--r--src/mame/drivers/namcos12.c16
-rw-r--r--src/mame/drivers/namcos22.c18
-rw-r--r--src/mame/drivers/naughtyb.c4
-rw-r--r--src/mame/drivers/nbmj8991.c2
-rw-r--r--src/mame/drivers/neodrvr.c16
-rw-r--r--src/mame/drivers/neogeo.c10
-rw-r--r--src/mame/drivers/ninjakd2.c9
-rw-r--r--src/mame/drivers/nmk16.c4
-rw-r--r--src/mame/drivers/offtwall.c12
-rw-r--r--src/mame/drivers/opwolf.c4
-rw-r--r--src/mame/drivers/pacman.c24
-rw-r--r--src/mame/drivers/paradise.c4
-rw-r--r--src/mame/drivers/pasha2.c2
-rw-r--r--src/mame/drivers/pbaction.c2
-rw-r--r--src/mame/drivers/pcktgal.c9
-rw-r--r--src/mame/drivers/pengo.c3
-rw-r--r--src/mame/drivers/pgm.c38
-rw-r--r--src/mame/drivers/phoenix.c2
-rw-r--r--src/mame/drivers/pingpong.c20
-rw-r--r--src/mame/drivers/pipedrm.c10
-rw-r--r--src/mame/drivers/pirates.c2
-rw-r--r--src/mame/drivers/pokechmp.c2
-rw-r--r--src/mame/drivers/polepos.c8
-rw-r--r--src/mame/drivers/policetr.c8
-rw-r--r--src/mame/drivers/progolf.c3
-rw-r--r--src/mame/drivers/psikyo.c36
-rw-r--r--src/mame/drivers/psikyo4.c8
-rw-r--r--src/mame/drivers/pturn.c4
-rw-r--r--src/mame/drivers/qix.c12
-rw-r--r--src/mame/drivers/raiden.c4
-rw-r--r--src/mame/drivers/seattle.c10
-rw-r--r--src/mame/drivers/segac2.c26
-rw-r--r--src/mame/drivers/segae.c44
-rw-r--r--src/mame/drivers/segag80r.c38
-rw-r--r--src/mame/drivers/segag80v.c56
-rw-r--r--src/mame/drivers/segahang.c6
-rw-r--r--src/mame/drivers/segald.c2
-rw-r--r--src/mame/drivers/segas24.c4
-rw-r--r--src/mame/drivers/segas32.c36
-rw-r--r--src/mame/drivers/segaxbd.c6
-rw-r--r--src/mame/drivers/seibuspi.c32
-rw-r--r--src/mame/drivers/seta.c22
-rw-r--r--src/mame/drivers/shangkid.c4
-rw-r--r--src/mame/drivers/shootout.c9
-rw-r--r--src/mame/drivers/simpl156.c14
-rw-r--r--src/mame/drivers/skykid.c2
-rw-r--r--src/mame/drivers/slapfght.c14
-rw-r--r--src/mame/drivers/snesb.c14
-rw-r--r--src/mame/drivers/snk.c2
-rw-r--r--src/mame/drivers/snowbros.c8
-rw-r--r--src/mame/drivers/ssf2md.c6
-rw-r--r--src/mame/drivers/starwars.c10
-rw-r--r--src/mame/drivers/strnskil.c8
-rw-r--r--src/mame/drivers/stv.c8
-rw-r--r--src/mame/drivers/stvinit.c8
-rw-r--r--src/mame/drivers/suna8.c37
-rw-r--r--src/mame/drivers/superchs.c4
-rw-r--r--src/mame/drivers/superqix.c4
-rw-r--r--src/mame/drivers/suprnova.c30
-rw-r--r--src/mame/drivers/system1.c20
-rw-r--r--src/mame/drivers/system18.c2
-rw-r--r--src/mame/drivers/taito_b.c2
-rw-r--r--src/mame/drivers/taito_f3.c4
-rw-r--r--src/mame/drivers/taito_l.c2
-rw-r--r--src/mame/drivers/taito_x.c2
-rw-r--r--src/mame/drivers/taitosj.c12
-rw-r--r--src/mame/drivers/tcl.c3
-rw-r--r--src/mame/drivers/terracre.c2
-rw-r--r--src/mame/drivers/thepit.c2
-rw-r--r--src/mame/drivers/tigeroad.c4
-rw-r--r--src/mame/drivers/tmaster.c8
-rw-r--r--src/mame/drivers/toaplan2.c12
-rw-r--r--src/mame/drivers/toki.c3
-rw-r--r--src/mame/drivers/topshoot.c2
-rw-r--r--src/mame/drivers/trackfld.c5
-rw-r--r--src/mame/drivers/tumbleb.c12
-rw-r--r--src/mame/drivers/tutankhm.c2
-rw-r--r--src/mame/drivers/upscope.c8
-rw-r--r--src/mame/drivers/vamphalf.c20
-rw-r--r--src/mame/drivers/vegas.c6
-rw-r--r--src/mame/drivers/vendetta.c8
-rw-r--r--src/mame/drivers/viper.c4
-rw-r--r--src/mame/drivers/wardner.c10
-rw-r--r--src/mame/drivers/williams.c32
-rw-r--r--src/mame/drivers/witch.c2
-rw-r--r--src/mame/drivers/wiz.c7
-rw-r--r--src/mame/drivers/xxmissio.c2
-rw-r--r--src/mame/drivers/yunsun16.c2
-rw-r--r--src/mame/drivers/zaxxon.c21
-rw-r--r--src/mame/drivers/zn.c116
-rw-r--r--src/mame/includes/decocrpt.h2
-rw-r--r--src/mame/machine/acitya.c2
-rw-r--r--src/mame/machine/atari.c22
-rw-r--r--src/mame/machine/atarigen.c2
-rw-r--r--src/mame/machine/balsente.c4
-rw-r--r--src/mame/machine/beezer.c10
-rw-r--r--src/mame/machine/cclimber.c3
-rw-r--r--src/mame/machine/cps2crpt.c3
-rw-r--r--src/mame/machine/dec0.c6
-rw-r--r--src/mame/machine/deco102.c9
-rw-r--r--src/mame/machine/fd1089.c3
-rw-r--r--src/mame/machine/fddebug.c4
-rw-r--r--src/mame/machine/galaxold.c25
-rw-r--r--src/mame/machine/kabuki.c8
-rw-r--r--src/mame/machine/konami1.c3
-rw-r--r--src/mame/machine/konppc.c2
-rw-r--r--src/mame/machine/mc8123.c5
-rw-r--r--src/mame/machine/mhavoc.c6
-rw-r--r--src/mame/machine/midtunit.c36
-rw-r--r--src/mame/machine/midwunit.c6
-rw-r--r--src/mame/machine/midyunit.c14
-rw-r--r--src/mame/machine/mspacman.c2
-rw-r--r--src/mame/machine/namcos1.c16
-rw-r--r--src/mame/machine/neoboot.c16
-rw-r--r--src/mame/machine/neoprot.c30
-rw-r--r--src/mame/machine/playch10.c32
-rw-r--r--src/mame/machine/s16fd.c2
-rw-r--r--src/mame/machine/s24fd.c4
-rw-r--r--src/mame/machine/scramble.c38
-rw-r--r--src/mame/machine/segacrpt.c160
-rw-r--r--src/mame/machine/segacrpt.h66
-rw-r--r--src/mame/machine/segaic16.c14
-rw-r--r--src/mame/machine/segas32.c3
-rw-r--r--src/mame/machine/simpsons.c6
-rw-r--r--src/mame/machine/stfight.c3
-rw-r--r--src/mame/machine/stvprot.c8
-rw-r--r--src/mame/machine/taitosj.c4
-rw-r--r--src/mame/machine/theglobp.c2
-rw-r--r--src/mame/machine/tnzs.c12
-rw-r--r--src/mame/machine/vsnes.c70
-rw-r--r--src/mame/machine/williams.c32
-rw-r--r--src/mame/video/bfm_adr2.c2
-rw-r--r--src/mame/video/combatsc.c10
-rw-r--r--src/mame/video/galivan.c4
-rw-r--r--src/mame/video/gunsmoke.c2
-rw-r--r--src/mame/video/jaguar.c2
-rw-r--r--src/mame/video/phoenix.c4
-rw-r--r--src/mame/video/simpsons.c8
-rw-r--r--src/mame/video/taitoic.c17
-rw-r--r--src/osd/windows/debugwin.c127
316 files changed, 4205 insertions, 3922 deletions
diff --git a/src/emu/cpu/drcbec.c b/src/emu/cpu/drcbec.c
index 99799e6e739..395edf5bcd2 100644
--- a/src/emu/cpu/drcbec.c
+++ b/src/emu/cpu/drcbec.c
@@ -754,43 +754,43 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ1, 4, 0): /* READ dst,src1,space_BYTE */
- PARAM0 = (UINT8)(*active_address_space[PARAM2 / 16]->accessors.read_byte)(PARAM1);
+ PARAM0 = memory_read_byte(active_address_space[PARAM2 / 16], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ2, 4, 0): /* READ dst,src1,space_WORD */
- PARAM0 = (UINT16)(*active_address_space[PARAM2 / 16]->accessors.read_word)(PARAM1);
+ PARAM0 = memory_read_word(active_address_space[PARAM2 / 16], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ4, 4, 0): /* READ dst,src1,space_DWORD */
- PARAM0 = (UINT32)(*active_address_space[PARAM2 / 16]->accessors.read_dword)(PARAM1);
+ PARAM0 = memory_read_dword(active_address_space[PARAM2 / 16], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM2, 4, 0): /* READM dst,src1,mask,space_WORD */
- PARAM0 = (UINT16)(*active_address_space[PARAM3 / 16]->accessors.read_word_masked)(PARAM1, PARAM2);
+ PARAM0 = memory_read_word_masked(active_address_space[PARAM3 / 16], PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM4, 4, 0): /* READM dst,src1,mask,space_DWORD */
- PARAM0 = (UINT32)(*active_address_space[PARAM3 / 16]->accessors.read_dword_masked)(PARAM1, PARAM2);
+ PARAM0 = memory_read_dword_masked(active_address_space[PARAM3 / 16], PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE1, 4, 0): /* WRITE dst,src1,space_BYTE */
- (*active_address_space[PARAM2 / 16]->accessors.write_byte)(PARAM0, PARAM1);
+ memory_write_byte(active_address_space[PARAM2 / 16], PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE2, 4, 0): /* WRITE dst,src1,space_WORD */
- (*active_address_space[PARAM2 / 16]->accessors.write_word)(PARAM0, PARAM1);
+ memory_write_word(active_address_space[PARAM2 / 16], PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE4, 4, 0): /* WRITE dst,src1,space_DWORD */
- (*active_address_space[PARAM2 / 16]->accessors.write_dword)(PARAM0, PARAM1);
+ memory_write_dword(active_address_space[PARAM2 / 16], PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM2, 4, 0): /* WRITEM dst,src1,mask,space_WORD */
- (*active_address_space[PARAM3 / 16]->accessors.write_word_masked)(PARAM0, PARAM1, PARAM2);
+ memory_write_word_masked(active_address_space[PARAM3 / 16], PARAM0, PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM4, 4, 0): /* WRITEM dst,src1,mask,space_DWORD */
- (*active_address_space[PARAM3 / 16]->accessors.write_dword_masked)(PARAM0, PARAM1, PARAM2);
+ memory_write_dword_masked(active_address_space[PARAM3 / 16], PARAM0, PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_CARRY, 4, 1): /* CARRY src,bitnum */
@@ -1185,59 +1185,59 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ1, 8, 0): /* DREAD dst,src1,space_BYTE */
- DPARAM0 = (UINT8)(*active_address_space[PARAM2 / 16]->accessors.read_byte)(PARAM1);
+ DPARAM0 = memory_read_byte(active_address_space[PARAM2 / 16], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ2, 8, 0): /* DREAD dst,src1,space_WORD */
- DPARAM0 = (UINT16)(*active_address_space[PARAM2 / 16]->accessors.read_word)(PARAM1);
+ DPARAM0 = memory_read_word(active_address_space[PARAM2 / 16], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ4, 8, 0): /* DREAD dst,src1,space_DWORD */
- DPARAM0 = (UINT32)(*active_address_space[PARAM2 / 16]->accessors.read_dword)(PARAM1);
+ DPARAM0 = memory_read_dword(active_address_space[PARAM2 / 16], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READ8, 8, 0): /* DREAD dst,src1,space_QOWRD */
- DPARAM0 = (UINT64)(*active_address_space[PARAM2 / 16]->accessors.read_qword)(PARAM1);
+ DPARAM0 = memory_read_qword(active_address_space[PARAM2 / 16], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM2, 8, 0): /* DREADM dst,src1,mask,space_WORD */
- DPARAM0 = (UINT16)(*active_address_space[PARAM3 / 16]->accessors.read_word_masked)(PARAM1, PARAM2);
+ DPARAM0 = memory_read_word_masked(active_address_space[PARAM3 / 16], PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM4, 8, 0): /* DREADM dst,src1,mask,space_DWORD */
- DPARAM0 = (UINT32)(*active_address_space[PARAM3 / 16]->accessors.read_dword_masked)(PARAM1, PARAM2);
+ DPARAM0 = memory_read_dword_masked(active_address_space[PARAM3 / 16], PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_READM8, 8, 0): /* DREADM dst,src1,mask,space_QWORD */
- DPARAM0 = (UINT64)(*active_address_space[PARAM3 / 16]->accessors.read_qword_masked)(PARAM1, PARAM2);
+ DPARAM0 = memory_read_qword_masked(active_address_space[PARAM3 / 16], PARAM1, PARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE1, 8, 0): /* DWRITE dst,src1,space_BYTE */
- (*active_address_space[PARAM2 / 16]->accessors.write_byte)(PARAM0, PARAM1);
+ memory_write_byte(active_address_space[PARAM2 / 16], PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE2, 8, 0): /* DWRITE dst,src1,space_WORD */
- (*active_address_space[PARAM2 / 16]->accessors.write_word)(PARAM0, PARAM1);
+ memory_write_word(active_address_space[PARAM2 / 16], PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE4, 8, 0): /* DWRITE dst,src1,space_DWORD */
- (*active_address_space[PARAM2 / 16]->accessors.write_dword)(PARAM0, PARAM1);
+ memory_write_dword(active_address_space[PARAM2 / 16], PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITE8, 8, 0): /* DWRITE dst,src1,space_QWORD */
- (*active_address_space[PARAM2 / 16]->accessors.write_qword)(PARAM0, DPARAM1);
+ memory_write_qword(active_address_space[PARAM2 / 16], PARAM0, DPARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM2, 8, 0): /* DWRITEM dst,src1,mask,space_WORD */
- (*active_address_space[PARAM3 / 16]->accessors.write_word_masked)(PARAM0, DPARAM1, DPARAM2);
+ memory_write_word_masked(active_address_space[PARAM3 / 16], PARAM0, DPARAM1, DPARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM4, 8, 0): /* DWRITEM dst,src1,mask,space_DWORD */
- (*active_address_space[PARAM3 / 16]->accessors.write_dword_masked)(PARAM0, DPARAM1, DPARAM2);
+ memory_write_dword_masked(active_address_space[PARAM3 / 16], PARAM0, DPARAM1, DPARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_WRITEM8, 8, 0): /* DWRITEM dst,src1,mask,space_QWORD */
- (*active_address_space[PARAM3 / 16]->accessors.write_qword_masked)(PARAM0, DPARAM1, DPARAM2);
+ memory_write_qword_masked(active_address_space[PARAM3 / 16], PARAM0, DPARAM1, DPARAM2);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_CARRY, 8, 0): /* DCARRY src,bitnum */
@@ -1598,11 +1598,11 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FREAD, 4, 0): /* FSREAD dst,src1,space */
- PARAM0 = (UINT32)(*active_address_space[PARAM2]->accessors.read_dword)(PARAM1);
+ PARAM0 = memory_read_dword(active_address_space[PARAM2], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FWRITE, 4, 0): /* FSWRITE dst,src1,space */
- (*active_address_space[PARAM2]->accessors.write_dword)(PARAM0, PARAM1);
+ memory_write_dword(active_address_space[PARAM2], PARAM0, PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FMOV, 4, 1): /* FSMOV dst,src[,c] */
@@ -1733,11 +1733,11 @@ static int drcbec_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FREAD, 8, 0): /* FDREAD dst,src1,space */
- DPARAM0 = (UINT64)(*active_address_space[PARAM2]->accessors.read_qword)(PARAM1);
+ DPARAM0 = memory_read_qword(active_address_space[PARAM2], PARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FWRITE, 8, 0): /* FDWRITE dst,src1,space */
- (*active_address_space[PARAM2]->accessors.write_qword)(PARAM0, DPARAM1);
+ memory_write_qword(active_address_space[PARAM2], PARAM0, DPARAM1);
break;
case MAKE_OPCODE_SHORT(DRCUML_OP_FMOV, 8, 1): /* FDMOV dst,src[,c] */
diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c
index 822d22f74b8..5d2fb9b1c78 100644
--- a/src/emu/cpu/drcbex64.c
+++ b/src/emu/cpu/drcbex64.c
@@ -278,6 +278,7 @@ struct _drcbe_state
x86code * debug_log_hashjmp; /* hashjmp debugging */
x86code * drcmap_get_value; /* map lookup helper */
data_accessors accessors[ADDRESS_SPACES];/* memory accessors */
+ const address_space * space[ADDRESS_SPACES]; /* address spaces */
UINT8 sse41; /* do we have SSE4.1 support? */
UINT32 ssemode; /* saved SSE mode */
@@ -706,6 +707,14 @@ static drcbe_state *drcbex64_alloc(drcuml_state *drcuml, drccache *cache, UINT32
drcbe->cache = cache;
drcbe->rbpvalue = drccache_near(cache) + 0x80;
+ /* get address spaces and accessors */
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ if (active_address_space[spacenum] != NULL)
+ {
+ drcbe->accessors[spacenum] = active_address_space[spacenum]->accessors;
+ drcbe->space[spacenum] = active_address_space[spacenum];
+ }
+
/* build up necessary arrays */
memcpy(drcbe->ssecontrol, sse_control, sizeof(drcbe->ssecontrol));
drcbe->absmask32 = drccache_memory_alloc_near(cache, 16*2 + 15);
@@ -795,12 +804,6 @@ static void drcbex64_reset(drcbe_state *drcbe)
if (drcbe->log != NULL)
x86log_printf(drcbe->log, "\n\n===========\nCACHE RESET\n===========\n\n");
- /* fetch the accessors now that things are ready to go */
- /* FIXME: Not sure about this one */
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- if (active_address_space[spacenum] != NULL)
- drcbe->accessors[spacenum] = active_address_space[spacenum]->accessors;
-
/* generate a little bit of glue code to set up the environment */
dst = (x86code **)drccache_begin_codegen(drcbe->cache, 500);
if (dst == NULL)
@@ -4075,7 +4078,9 @@ static x86code *op_read(drcbe_state *drcbe, x86code *dst, const drcuml_instructi
dstreg = param_select_register(REG_EAX, &dstp, NULL);
/* set up a call to the read byte handler */
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &addrp); // mov param1,addrp
+ emit_mov_r64_m64(drcbe, &dst, REG_PARAM1, MBD(REG_RCX, offsetof(drcuml_machine_state, &drcbe->space[spacesizep.value / 16]));
+ // mov param1,space
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &addrp); // mov param2,addrp
if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE)
{
emit_smart_call_m64(drcbe, &dst, (x86code **)&drcbe->accessors[spacesizep.value / 16].read_byte);
@@ -4134,11 +4139,13 @@ static x86code *op_readm(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
dstreg = param_select_register(REG_EAX, &dstp, NULL);
/* set up a call to the read byte handler */
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &addrp); // mov param1,addrp
+ emit_mov_r64_m64(drcbe, &dst, REG_PARAM1, MBD(REG_RCX, offsetof(drcuml_machine_state, &drcbe->space[spacesizep.value / 16]));
+ // mov param1,space
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &addrp); // mov param2,addrp
if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD)
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &maskp); // mov param2,maskp
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM3, &maskp); // mov param3,maskp
else
- emit_mov_r64_p64(drcbe, &dst, REG_PARAM2, &maskp); // mov param2,maskp
+ emit_mov_r64_p64(drcbe, &dst, REG_PARAM3, &maskp); // mov param3,maskp
if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
{
emit_smart_call_m64(drcbe, &dst, (x86code **)&drcbe->accessors[spacesizep.value / 16].read_word_masked);
@@ -4187,11 +4194,13 @@ static x86code *op_write(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
param_normalize_3(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MRI, &spacesizep, PTYPE_I);
/* set up a call to the write byte handler */
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &addrp); // mov param1,addrp
+ emit_mov_r64_m64(drcbe, &dst, REG_PARAM1, MBD(REG_RCX, offsetof(drcuml_machine_state, &drcbe->space[spacesizep.value / 16]));
+ // mov param1,space
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &addrp); // mov param2,addrp
if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD)
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &srcp); // mov param1,srcp
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM3, &srcp); // mov param3,srcp
else
- emit_mov_r64_p64(drcbe, &dst, REG_PARAM2, &srcp); // mov param1,srcp
+ emit_mov_r64_p64(drcbe, &dst, REG_PARAM3, &srcp); // mov param3,srcp
if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE)
emit_smart_call_m64(drcbe, &dst, (x86code **)&drcbe->accessors[spacesizep.value / 16].write_byte);
// call write_byte
@@ -4225,16 +4234,18 @@ static x86code *op_writem(drcbe_state *drcbe, x86code *dst, const drcuml_instruc
param_normalize_4(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MRI, &maskp, PTYPE_MRI, &spacesizep, PTYPE_I);
/* set up a call to the write byte handler */
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &addrp); // mov param1,addrp
+ emit_mov_r64_m64(drcbe, &dst, REG_PARAM1, MBD(REG_RCX, offsetof(drcuml_machine_state, &drcbe->space[spacesizep.value / 16]));
+ // mov param1,space
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &addrp); // mov param2,addrp
if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD)
{
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &srcp); // mov param2,srcp
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM3, &maskp); // mov param3,maskp
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM3, &srcp); // mov param3,srcp
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM4, &maskp); // mov param4,maskp
}
else
{
- emit_mov_r64_p64(drcbe, &dst, REG_PARAM2, &srcp); // mov param2,srcp
- emit_mov_r64_p64(drcbe, &dst, REG_PARAM3, &maskp); // mov param3,maskp
+ emit_mov_r64_p64(drcbe, &dst, REG_PARAM3, &srcp); // mov param3,srcp
+ emit_mov_r64_p64(drcbe, &dst, REG_PARAM4, &maskp); // mov param4,maskp
}
if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
emit_smart_call_m64(drcbe, &dst, (x86code **)&drcbe->accessors[spacesizep.value / 16].write_word_masked);
@@ -6220,7 +6231,9 @@ static x86code *op_fread(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &addrp, PTYPE_MRI, &spacep, PTYPE_I);
/* set up a call to the read dword/qword handler */
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &addrp); // mov param1,addrp
+ emit_mov_r64_m64(drcbe, &dst, REG_PARAM1, MBD(REG_RCX, offsetof(drcuml_machine_state, &drcbe->space[spacesizep.value / 16]));
+ // mov param1,space
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &addrp); // mov param2,addrp
if (inst->size == 4)
emit_smart_call_m64(drcbe, &dst, (x86code **)&drcbe->accessors[spacep.value].read_dword);// call read_dword
else if (inst->size == 8)
@@ -6262,15 +6275,17 @@ static x86code *op_fwrite(drcbe_state *drcbe, x86code *dst, const drcuml_instruc
param_normalize_3(drcbe, inst, &addrp, PTYPE_MRI, &srcp, PTYPE_MF, &spacep, PTYPE_I);
/* general case */
- emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &addrp); // mov param1,addrp
+ emit_mov_r64_m64(drcbe, &dst, REG_PARAM1, MBD(REG_RCX, offsetof(drcuml_machine_state, &drcbe->space[spacesizep.value / 16]));
+ // mov param1,space
+ emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &addrp); // mov param21,addrp
/* 32-bit form */
if (inst->size == 4)
{
if (srcp.type == DRCUML_PTYPE_MEMORY)
- emit_mov_r32_m32(&dst, REG_PARAM2, MABS(drcbe, srcp.value)); // mov param2,[srcp]
+ emit_mov_r32_m32(&dst, REG_PARAM3, MABS(drcbe, srcp.value)); // mov param3,[srcp]
else if (srcp.type == DRCUML_PTYPE_FLOAT_REGISTER)
- emit_movd_r32_r128(&dst, REG_PARAM2, srcp.value); // movd param2,srcp
+ emit_movd_r32_r128(&dst, REG_PARAM3, srcp.value); // movd param3,srcp
emit_smart_call_m64(drcbe, &dst, (x86code **)&drcbe->accessors[spacep.value].write_dword);// call write_dword
}
@@ -6278,9 +6293,9 @@ static x86code *op_fwrite(drcbe_state *drcbe, x86code *dst, const drcuml_instruc
else if (inst->size == 8)
{
if (srcp.type == DRCUML_PTYPE_MEMORY)
- emit_mov_r64_m64(&dst, REG_PARAM2, MABS(drcbe, srcp.value)); // mov param2,[srcp]
+ emit_mov_r64_m64(&dst, REG_PARAM3, MABS(drcbe, srcp.value)); // mov param3,[srcp]
else if (srcp.type == DRCUML_PTYPE_FLOAT_REGISTER)
- emit_movq_r64_r128(&dst, REG_PARAM2, srcp.value); // movq param2,srcp
+ emit_movq_r64_r128(&dst, REG_PARAM3, srcp.value); // movq param3,srcp
emit_smart_call_m64(drcbe, &dst, (x86code **)&drcbe->accessors[spacep.value].write_qword);// call write_qword
}
diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c
index ae7d9673945..5d6b59ecfb5 100644
--- a/src/emu/cpu/drcbex86.c
+++ b/src/emu/cpu/drcbex86.c
@@ -177,6 +177,8 @@ struct _drcbe_state
UINT32 * reghi[REG_MAX]; /* pointer to high part of data for each register */
double fptemp; /* temporary storage for floating point */
+ const address_space * space[ADDRESS_SPACES]; /* address spaces */
+
UINT8 sse3; /* do we have SSE3 support? */
UINT16 fpumode; /* saved FPU mode */
UINT16 fmodesave; /* temporary location for saving */
@@ -533,7 +535,7 @@ INLINE void emit_combine_z_shl_flags(x86code **dst)
static drcbe_state *drcbex86_alloc(drcuml_state *drcuml, drccache *cache, UINT32 flags, int modes, int addrbits, int ignorebits)
{
- int opnum, regnum, entry;
+ int opnum, regnum, entry, spacenum;
drcbe_state *drcbe;
/* allocate space in the cache for our state */
@@ -546,6 +548,10 @@ static drcbe_state *drcbex86_alloc(drcuml_state *drcuml, drccache *cache, UINT32
drcbe->drcuml = drcuml;
drcbe->cache = cache;
+ /* get address spaces */
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ drcbe->space[spacenum] = active_address_space[spacenum];
+
/* allocate hash tables */
drcbe->hash = drchash_alloc(cache, modes, addrbits, ignorebits);
if (drcbe->hash == NULL)
@@ -4118,28 +4124,29 @@ static x86code *op_read(drcbe_state *drcbe, x86code *dst, const drcuml_instructi
dstreg = param_select_register(REG_EAX, &dstp, NULL);
/* set up a call to the read byte handler */
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
+ emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE)
{
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.read_byte);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_byte);
// call read_byte
emit_movzx_r32_r8(&dst, dstreg, REG_AL); // movzx dstreg,al
}
else if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
{
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.read_word);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_word);
// call read_word
emit_movzx_r32_r16(&dst, dstreg, REG_AX); // movzx dstreg,ax
}
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
{
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.read_dword);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_dword);
// call read_dword
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
}
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
{
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.read_qword);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_qword);
// call read_qword
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
}
@@ -4194,25 +4201,26 @@ static x86code *op_readm(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
/* set up a call to the read byte handler */
if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD)
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &maskp); // mov [esp+4],maskp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 8), &maskp); // mov [esp+8],maskp
else
- emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &maskp); // mov [esp+4],maskp
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp
+ emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &maskp); // mov [esp+8],maskp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
+ emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
{
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.read_word_masked);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_word_masked);
// call read_word_masked
emit_movzx_r32_r16(&dst, dstreg, REG_AX); // movzx dstreg,ax
}
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
{
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.read_dword_masked);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_dword_masked);
// call read_dword_masked
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
}
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
{
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.read_qword_masked);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.read_qword_masked);
// call read_qword_masked
emit_mov_r32_r32(&dst, dstreg, REG_EAX); // mov dstreg,eax
}
@@ -4263,21 +4271,22 @@ static x86code *op_write(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
/* set up a call to the write byte handler */
if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD)
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 8), &srcp); // mov [esp+8],srcp
else
- emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp
+ emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &srcp); // mov [esp+8],srcp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
+ emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
if ((spacesizep.value & 3) == DRCUML_SIZE_BYTE)
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.write_byte);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_byte);
// call write_byte
else if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.write_word);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_word);
// call write_word
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.write_dword);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_dword);
// call write_dword
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.write_qword);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_qword);
// call write_qword
return dst;
}
@@ -4302,23 +4311,24 @@ static x86code *op_writem(drcbe_state *drcbe, x86code *dst, const drcuml_instruc
/* set up a call to the write byte handler */
if ((spacesizep.value & 3) != DRCUML_SIZE_QWORD)
{
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 8), &maskp); // mov [esp+8],maskp
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 12), &maskp); // mov [esp+12],maskp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 8), &srcp); // mov [esp+8],srcp
}
else
{
- emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 12), &maskp); // mov [esp+12],maskp
- emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp
+ emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 16), &maskp); // mov [esp+16],maskp
+ emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &srcp); // mov [esp+8],srcp
}
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
+ emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacesizep.value / 16]);// mov [esp],space
if ((spacesizep.value & 3) == DRCUML_SIZE_WORD)
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.write_word_masked);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_word_masked);
// call write_word_masked
else if ((spacesizep.value & 3) == DRCUML_SIZE_DWORD)
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.write_dword_masked);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_dword_masked);
// call write_dword_masked
else if ((spacesizep.value & 3) == DRCUML_SIZE_QWORD)
- emit_call(&dst, (x86code *)active_address_space[spacesizep.value / 16]->accessors.write_qword_masked);
+ emit_call(&dst, (x86code *)drcbe->space[spacesizep.value / 16]->accessors.write_qword_masked);
// call write_qword_masked
return dst;
}
@@ -6178,11 +6188,12 @@ static x86code *op_fread(drcbe_state *drcbe, x86code *dst, const drcuml_instruct
param_normalize_3(drcbe, inst, &dstp, PTYPE_MF, &addrp, PTYPE_MRI, &spacep, PTYPE_I);
/* set up a call to the read dword/qword handler */
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
+ emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacep.value / 16]); // mov [esp],space
if (inst->size == 4)
- emit_call(&dst, (x86code *)active_address_space[spacep.value]->accessors.read_dword);// call read_dword
+ emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.read_dword); // call read_dword
else if (inst->size == 8)
- emit_call(&dst, (x86code *)active_address_space[spacep.value]->accessors.read_qword);// call read_qword
+ emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.read_qword); // call read_qword
/* store result */
if (inst->size == 4)
@@ -6212,14 +6223,15 @@ static x86code *op_fwrite(drcbe_state *drcbe, x86code *dst, const drcuml_instruc
/* set up a call to the write dword/qword handler */
if (inst->size == 4)
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 8), &srcp); // mov [esp+8],srcp
else if (inst->size == 8)
- emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 4), &srcp); // mov [esp+4],srcp
- emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 0), &addrp); // mov [esp],addrp
+ emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &srcp); // mov [esp+8],srcp
+ emit_mov_m32_p32(drcbe, &dst, MBD(REG_ESP, 4), &addrp); // mov [esp+4],addrp
+ emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (UINT32)drcbe->space[spacep.value / 16]); // mov [esp],space
if (inst->size == 4)
- emit_call(&dst, (x86code *)active_address_space[spacep.value]->accessors.write_dword);// call write_dword
+ emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.write_dword); // call write_dword
else if (inst->size == 8)
- emit_call(&dst, (x86code *)active_address_space[spacep.value]->accessors.write_qword);// call write_qword
+ emit_call(&dst, (x86code *)drcbe->space[spacep.value]->accessors.write_qword); // call write_qword
return dst;
}
diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c
index 62ec5bfd83a..0e191bd7a6b 100644
--- a/src/emu/cpu/mcs48/mcs48.c
+++ b/src/emu/cpu/mcs48/mcs48.c
@@ -216,7 +216,7 @@ INLINE UINT8 argument_fetch(mcs48_state *mcs48, offs_t address)
INLINE void update_regptr(mcs48_state *mcs48)
{
- mcs48->regptr = memory_get_write_ptr(cpunum_get_active(), ADDRESS_SPACE_DATA, (PSW & B_FLAG) ? 24 : 0);
+ mcs48->regptr = memory_get_write_ptr(mcs48->data, (PSW & B_FLAG) ? 24 : 0);
}
diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c
index 9b9a6bb902b..69103e160ef 100644
--- a/src/emu/cpu/mcs51/mcs51.c
+++ b/src/emu/cpu/mcs51/mcs51.c
@@ -677,8 +677,8 @@ INLINE UINT8 r_psw(mcs51_state_t *mcs51_state) { return SFR_A(ADDR_PSW); }
INLINE void update_ptrs(mcs51_state_t *mcs51_state)
{
- mcs51_state->internal_ram = memory_get_write_ptr(cpunum_get_active(), ADDRESS_SPACE_DATA, 0x00);
- mcs51_state->sfr_ram = memory_get_write_ptr(cpunum_get_active(), ADDRESS_SPACE_DATA, 0x100);
+ mcs51_state->internal_ram = memory_get_write_ptr(mcs51_state->data, 0x00);
+ mcs51_state->sfr_ram = memory_get_write_ptr(mcs51_state->data, 0x100);
}
diff --git a/src/emu/cpu/mips/mips3com.c b/src/emu/cpu/mips/mips3com.c
index 4ad94373e77..396f97d5744 100644
--- a/src/emu/cpu/mips/mips3com.c
+++ b/src/emu/cpu/mips/mips3com.c
@@ -88,7 +88,7 @@ void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, const
mips->system_clock = config->system_clock;
/* set up the endianness */
- mips->memory = *memory_get_accessors(ADDRESS_SPACE_PROGRAM, 32, mips->bigendian ? CPU_IS_BE : CPU_IS_LE);
+ mips->memory = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM)->accessors;
/* allocate the virtual TLB */
mips->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, 2 * MIPS3_TLB_ENTRIES + 2, 0);
diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c
index 05dbc357af6..d9aca701f80 100644
--- a/src/emu/cpu/mips/mips3drc.c
+++ b/src/emu/cpu/mips/mips3drc.c
@@ -768,7 +768,7 @@ static void code_compile_block(drcuml_state *drcuml, UINT8 mode, offs_t pc)
}
/* validate this code block if we're not pointing into ROM */
- if (memory_get_write_ptr(cpunum_get_active(), ADDRESS_SPACE_PROGRAM, seqhead->physpc) != NULL)
+ if (memory_get_write_ptr(cpu_get_address_space(Machine->activecpu, ADDRESS_SPACE_PROGRAM), seqhead->physpc) != NULL)
generate_checksum_block(block, &compiler, seqhead, seqlast);
/* label this instruction, if it may be jumped to locally */
diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c
index 14876032ff0..c29aa23982d 100644
--- a/src/emu/cpu/mips/psx.c
+++ b/src/emu/cpu/mips/psx.c
@@ -1293,20 +1293,19 @@ static WRITE32_HANDLER( psx_berr_w )
static void mips_update_scratchpad( const address_space *space )
{
- int cpu = cpunum_get_active();
psxcpu_state *psxcpu = space->cpu->token;
if( ( psxcpu->biu & BIU_RAM ) == 0 )
{
- memory_install_readwrite32_handler( space->machine, cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, psx_berr_r, psx_berr_w );
+ memory_install_readwrite32_handler( space, 0x1f800000, 0x1f8003ff, 0, 0, psx_berr_r, psx_berr_w );
}
else if( ( psxcpu->biu & BIU_DS ) == 0 )
{
- memory_install_readwrite32_handler( space->machine, cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, psx_berr_r, SMH_NOP );
+ memory_install_readwrite32_handler( space, 0x1f800000, 0x1f8003ff, 0, 0, psx_berr_r, SMH_NOP );
}
else
{
- memory_install_readwrite32_handler( space->machine, cpu, ADDRESS_SPACE_PROGRAM, 0x1f800000, 0x1f8003ff, 0, 0, SMH_BANK32, SMH_BANK32 );
+ memory_install_readwrite32_handler( space, 0x1f800000, 0x1f8003ff, 0, 0, SMH_BANK32, SMH_BANK32 );
memory_set_bankptr( 32, psxcpu->dcache );
}
diff --git a/src/emu/cpu/powerpc/drc_ops.c b/src/emu/cpu/powerpc/drc_ops.c
index 0042a7e7f43..44fee326f59 100644
--- a/src/emu/cpu/powerpc/drc_ops.c
+++ b/src/emu/cpu/powerpc/drc_ops.c
@@ -132,7 +132,7 @@ static UINT32 *ppcdrc_getopptr(UINT32 address)
address &= ~0x07;
}
- result = (UINT32 *) memory_get_op_ptr(Machine, cpunum_get_active(), address, 0);
+ result = (UINT32 *) memory_decrypted_read_ptr(cpu_get_address_space(Machine->activecpu, ADDRESS_SPACE_PROGRAM), address);
if (result)
result += offset;
return result;
diff --git a/src/emu/cpu/powerpc/ppc_mem.c b/src/emu/cpu/powerpc/ppc_mem.c
index 39bc526dc7b..6991cc4189a 100644
--- a/src/emu/cpu/powerpc/ppc_mem.c
+++ b/src/emu/cpu/powerpc/ppc_mem.c
@@ -209,7 +209,7 @@ static int ppc_translate_address(offs_t *addr_ptr, int flags)
| (((ppc.sdr1 & 0x01FF) & (hash >> 10)) << 16)
| ((hash & 0x03FF) << 6);
- pteg_ptr[hash_type] = memory_get_read_ptr(cpunum_get_active(), ADDRESS_SPACE_PROGRAM, pteg_address);
+ pteg_ptr[hash_type] = memory_get_read_ptr(cpu_get_address_space(Machine->activecpu), ADDRESS_SPACE_PROGRAM), pteg_address);
if (pteg_ptr[hash_type])
{
for (i = 0; i < 8; i++)
diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c
index 1fa4a53ab8b..76d645bbc5e 100644
--- a/src/emu/cpu/powerpc/ppccom.c
+++ b/src/emu/cpu/powerpc/ppccom.c
@@ -427,7 +427,7 @@ static UINT32 ppccom_translate_address_internal(powerpc_state *ppc, int intentio
for (hashnum = 0; hashnum < 2; hashnum++)
{
offs_t ptegaddr = hashbase | ((hash << 6) & hashmask);
- UINT32 *ptegptr = memory_get_read_ptr(cpunum_get_active(), ADDRESS_SPACE_PROGRAM, ptegaddr);
+ UINT32 *ptegptr = memory_get_read_ptr(cpu_get_address_space(Machine->activecpu, ADDRESS_SPACE_PROGRAM), ptegaddr);
/* should only have valid memory here, but make sure */
if (ptegptr != NULL)
diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c
index e92427415df..b77d0b285f6 100644
--- a/src/emu/cpu/powerpc/ppcdrc.c
+++ b/src/emu/cpu/powerpc/ppcdrc.c
@@ -976,7 +976,7 @@ static void code_compile_block(drcuml_state *drcuml, UINT8 mode, offs_t pc)
}
/* validate this code block if we're not pointing into ROM */
- if (memory_get_write_ptr(cpunum_get_active(), ADDRESS_SPACE_PROGRAM, seqhead->physpc) != NULL)
+ if (memory_get_write_ptr(cpu_get_address_space(Machine->activecpu, ADDRESS_SPACE_PROGRAM), seqhead->physpc) != NULL)
generate_checksum_block(block, &compiler, seqhead, seqlast); // <checksum>
/* label this instruction, if it may be jumped to locally */
diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c
index 12f2e8252da..68080dadab4 100644
--- a/src/emu/cpu/sh2/sh2drc.c
+++ b/src/emu/cpu/sh2/sh2drc.c
@@ -966,7 +966,7 @@ static void code_compile_block(drcuml_state *drcuml, UINT8 mode, offs_t pc)
}
/* validate this code block if we're not pointing into ROM */
- if (memory_get_write_ptr(cpunum_get_active(), ADDRESS_SPACE_PROGRAM, seqhead->physpc) != NULL)
+ if (memory_get_write_ptr(cpu_get_address_space(Machine->activecpu, ADDRESS_SPACE_PROGRAM), seqhead->physpc) != NULL)
generate_checksum_block(block, &compiler, seqhead, seqlast);
/* label this instruction, if it may be jumped to locally */
diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c
index 1beb9f7440b..65bc2bb13a4 100644
--- a/src/emu/cpuexec.c
+++ b/src/emu/cpuexec.c
@@ -1359,7 +1359,7 @@ static IRQ_CALLBACK( standard_irq_callback )
vector = (*classdata->driver_irq)(device, irqline);
/* notify the debugger */
- debug_cpu_interrupt_hook(device->machine, classdata->header.index, irqline);
+ debugger_interrupt_hook(device->machine, classdata->header.index, irqline);
/* otherwise, just return the current vector */
return vector;
diff --git a/src/emu/cpuintrf.c b/src/emu/cpuintrf.c
index b587e73b22a..dea538378ac 100644
--- a/src/emu/cpuintrf.c
+++ b/src/emu/cpuintrf.c
@@ -1173,9 +1173,9 @@ void cpu_init(const device_config *device, int index, int clock, cpu_irq_callbac
device->machine->activecpu = device;
classheader->index = index;
- classheader->space[ADDRESS_SPACE_PROGRAM] = active_address_space[ADDRESS_SPACE_PROGRAM];
- classheader->space[ADDRESS_SPACE_DATA] = active_address_space[ADDRESS_SPACE_DATA];
- classheader->space[ADDRESS_SPACE_IO] = active_address_space[ADDRESS_SPACE_IO];
+ classheader->space[ADDRESS_SPACE_PROGRAM] = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
+ classheader->space[ADDRESS_SPACE_DATA] = memory_find_address_space(device, ADDRESS_SPACE_DATA);
+ classheader->space[ADDRESS_SPACE_IO] = memory_find_address_space(device, ADDRESS_SPACE_IO);
(*classheader->init)(device, index, clock, irqcallback);
(*classheader->get_context)(device->token);
diff --git a/src/emu/cpuintrf.h b/src/emu/cpuintrf.h
index b3a3d1326de..8a770900cf8 100644
--- a/src/emu/cpuintrf.h
+++ b/src/emu/cpuintrf.h
@@ -570,11 +570,21 @@ typedef enum _cpu_type cpu_type;
#define cputype_get_core_credits(cputype) cputype_get_info_string(cputype, CPUINFO_STR_CORE_CREDITS)
+/* helpers for using machine/cputag instead of cpu objects */
+#define cputag_reset(mach, tag) cpu_reset(cputag_get_cpu(mach, tag))
+#define cputag_get_index(mach, tag) cpu_get_index(cputag_get_cpu(mach, tag))
+#define cputag_get_address_space(mach, tag, space) cpu_get_address_space(cputag_get_cpu(mach, tag), space)
+
+
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
+/* opaque definition of CPU debugging info */
+typedef struct _cpu_debug_data cpu_debug_data;
+
+
/* forward declaration of this union */
typedef union _cpuinfo cpuinfo;
@@ -638,7 +648,8 @@ struct _cpu_class_header
{
int index; /* index of this CPU */
cpu_type cputype; /* type index of this CPU */
- address_space * space[ADDRESS_SPACES]; /* address spaces */
+ cpu_debug_data * debug; /* debugging data */
+ const address_space * space[ADDRESS_SPACES]; /* address spaces */
/* table of core functions */
cpu_get_info_func get_info;
@@ -777,6 +788,18 @@ INLINE int cpu_get_index(const device_config *cpu)
/*-------------------------------------------------
+ cpu_get_debug_data - return a pointer to
+ the given CPU's debugger data
+-------------------------------------------------*/
+
+INLINE cpu_debug_data *cpu_get_debug_data(const device_config *cpu)
+{
+ cpu_class_header *classheader = cpu->classtoken;
+ return classheader->debug;
+}
+
+
+/*-------------------------------------------------
cpu_get_address_space - return a pointer to
the given CPU's address space
-------------------------------------------------*/
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index 8676db17b96..cb45ab49b0c 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -18,6 +18,7 @@
#include "debughlp.h"
#include "debugvw.h"
#include "render.h"
+#include "deprecat.h"
#include <ctype.h>
@@ -371,7 +372,7 @@ static void global_set(void *ref, UINT64 value)
int debug_command_parameter_number(const char *param, UINT64 *result)
{
- EXPRERR err = expression_evaluate(param, debug_get_cpu_info(cpunum_get_active())->symtable, &debug_expression_callbacks, result);
+ EXPRERR err = expression_evaluate(param, cpu_get_debug_data(Machine->activecpu)->symtable, &debug_expression_callbacks, result);
if (err == EXPRERR_NONE)
return 1;
debug_console_printf("Error in expression: %s\n", param);
@@ -388,7 +389,7 @@ int debug_command_parameter_number(const char *param, UINT64 *result)
static int debug_command_parameter_expression(const char *param, parsed_expression **result)
{
- EXPRERR err = expression_parse(param, debug_get_cpu_info(cpunum_get_active())->symtable, &debug_expression_callbacks, result);
+ EXPRERR err = expression_parse(param, cpu_get_debug_data(Machine->activecpu)->symtable, &debug_expression_callbacks, result);
if (err == EXPRERR_NONE)
return 1;
debug_console_printf("Error in expression: %s\n", param);
@@ -603,7 +604,7 @@ static void execute_logerror(running_machine *machine, int ref, int params, cons
static void execute_tracelog(running_machine *machine, int ref, int params, const char *param[])
{
- FILE *file = debug_get_cpu_info(cpunum_get_active())->trace.file;
+ FILE *file = cpu_get_debug_data(machine->activecpu)->trace.file;
UINT64 values[MAX_COMMAND_PARAMS];
char buffer[1024];
int i;
@@ -775,15 +776,16 @@ static void execute_focus(running_machine *machine, int ref, int params, const c
}
/* first clear the ignore flag on the focused CPU */
- debug_cpu_ignore_cpu(cpuwhich, 0);
+ debug_cpu_ignore_cpu(machine->cpu[cpuwhich], 0);
/* then loop over CPUs and set the ignore flags on all other CPUs */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *info = debug_get_cpu_info(cpunum);
- if (info && info->valid && cpunum != cpuwhich)
- debug_cpu_ignore_cpu(cpunum, 1);
- }
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ const cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (info->valid && cpunum != cpuwhich)
+ debug_cpu_ignore_cpu(machine->cpu[cpunum], 1);
+ }
debug_console_printf("Now focused on CPU %d\n", (int)cpuwhich);
}
@@ -803,17 +805,20 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
if (params == 0)
{
/* loop over all CPUs */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *info = debug_get_cpu_info(cpunum);
-
- /* build up a comma-separated list */
- if (info && info->valid && (info->flags & DEBUG_FLAG_OBSERVING) == 0)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- if (buflen == 0) buflen += sprintf(&buffer[buflen], "Currently ignoring CPU %d", cpunum);
- else buflen += sprintf(&buffer[buflen], ",%d", cpunum);
+ const cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
+
+ /* build up a comma-separated list */
+ if (info->valid && (info->flags & DEBUG_FLAG_OBSERVING) == 0)
+ {
+ if (buflen == 0)
+ buflen += sprintf(&buffer[buflen], "Currently ignoring CPU %d", cpunum);
+ else
+ buflen += sprintf(&buffer[buflen], ",%d", cpunum);
+ }
}
- }
/* special message for none */
if (buflen == 0)
@@ -840,19 +845,20 @@ static void execute_ignore(running_machine *machine, int ref, int params, const
for (paramnum = 0; paramnum < params; paramnum++)
{
/* make sure this isn't the last live CPU */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *info = debug_get_cpu_info(cpunum);
- if (cpunum != cpuwhich[paramnum] && info && info->valid && (info->flags & DEBUG_FLAG_OBSERVING) != 0)
- break;
- }
- if (cpunum == MAX_CPU)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (cpunum != cpuwhich[paramnum] && machine->cpu[cpunum] != NULL)
+ {
+ const cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (info->valid && (info->flags & DEBUG_FLAG_OBSERVING) != 0)
+ break;
+ }
+ if (cpunum == ARRAY_LENGTH(machine->cpu))
{
debug_console_printf("Can't ignore all CPUs!\n");
return;
}
- debug_cpu_ignore_cpu(cpuwhich[paramnum], 1);
+ debug_cpu_ignore_cpu(machine->cpu[cpuwhich[paramnum]], 1);
debug_console_printf("Now ignoring CPU %d\n", (int)cpuwhich[paramnum]);
}
}
@@ -874,17 +880,20 @@ static void execute_observe(running_machine *machine, int ref, int params, const
if (params == 0)
{
/* loop over all CPUs */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *info = debug_get_cpu_info(cpunum);
-
- /* build up a comma-separated list */
- if (info && info->valid && (info->flags & DEBUG_FLAG_OBSERVING) != 0)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- if (buflen == 0) buflen += sprintf(&buffer[buflen], "Currently observing CPU %d", cpunum);
- else buflen += sprintf(&buffer[buflen], ",%d", cpunum);
+ const cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
+
+ /* build up a comma-separated list */
+ if (info->valid && (info->flags & DEBUG_FLAG_OBSERVING) != 0)
+ {
+ if (buflen == 0)
+ buflen += sprintf(&buffer[buflen], "Currently observing CPU %d", cpunum);
+ else
+ buflen += sprintf(&buffer[buflen], ",%d", cpunum);
+ }
}
- }
/* special message for none */
if (buflen == 0)
@@ -910,7 +919,7 @@ static void execute_observe(running_machine *machine, int ref, int params, const
/* clear the ignore flags */
for (paramnum = 0; paramnum < params; paramnum++)
{
- debug_cpu_ignore_cpu(cpuwhich[paramnum], 0);
+ debug_cpu_ignore_cpu(machine->cpu[cpuwhich[paramnum]], 0);
debug_console_printf("Now observing CPU %d\n", (int)cpuwhich[paramnum]);
}
}
@@ -1023,16 +1032,17 @@ static void execute_bpclear(running_machine *machine, int ref, int params, const
{
int cpunum;
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
- if (cpuinfo->valid)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- debug_cpu_breakpoint *bp;
- while ((bp = cpuinfo->bplist) != NULL)
- debug_cpu_breakpoint_clear(machine, bp->index);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (cpuinfo->valid)
+ {
+ debug_cpu_breakpoint *bp;
+ while ((bp = cpuinfo->bplist) != NULL)
+ debug_cpu_breakpoint_clear(machine, bp->index);
+ }
}
- }
debug_console_printf("Cleared all breakpoints\n");
}
@@ -1064,16 +1074,17 @@ static void execute_bpdisenable(running_machine *machine, int ref, int params, c
{
int cpunum;
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
- if (cpuinfo->valid)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- debug_cpu_breakpoint *bp;
- for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
- debug_cpu_breakpoint_enable(machine, bp->index, ref);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (cpuinfo->valid)
+ {
+ debug_cpu_breakpoint *bp;
+ for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
+ debug_cpu_breakpoint_enable(machine, bp->index, ref);
+ }
}
- }
if (ref == 0)
debug_console_printf("Disabled all breakpoints\n");
else
@@ -1105,30 +1116,31 @@ static void execute_bplist(running_machine *machine, int ref, int params, const
char buffer[256];
/* loop over all CPUs */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
-
- if (cpuinfo->valid && cpuinfo->bplist != NULL)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- debug_cpu_breakpoint *bp;
-
- debug_console_printf("CPU %d breakpoints:\n", cpunum);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
- /* loop over the breakpoints */
- for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
+ if (cpuinfo->valid && cpuinfo->bplist != NULL)
{
- int buflen;
- buflen = sprintf(buffer, "%c%4X @ %08X", bp->enabled ? ' ' : 'D', bp->index, bp->address);
- if (bp->condition)
- buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(bp->condition));
- if (bp->action)
- buflen += sprintf(&buffer[buflen], " do %s", bp->action);
- debug_console_printf("%s\n", buffer);
- printed++;
+ debug_cpu_breakpoint *bp;
+
+ debug_console_printf("CPU %d breakpoints:\n", cpunum);
+
+ /* loop over the breakpoints */
+ for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
+ {
+ int buflen;
+ buflen = sprintf(buffer, "%c%4X @ %08X", bp->enabled ? ' ' : 'D', bp->index, bp->address);
+ if (bp->condition)
+ buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(bp->condition));
+ if (bp->action)
+ buflen += sprintf(&buffer[buflen], " do %s", bp->action);
+ debug_console_printf("%s\n", buffer);
+ printed++;
+ }
}
}
- }
if (!printed)
debug_console_printf("No breakpoints currently installed\n");
@@ -1197,21 +1209,22 @@ static void execute_wpclear(running_machine *machine, int ref, int params, const
{
int cpunum;
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
- if (cpuinfo->valid)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- int spacenum;
-
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (cpuinfo->valid)
{
- debug_cpu_watchpoint *wp;
- while ((wp = cpuinfo->space[spacenum].wplist) != NULL)
- debug_cpu_watchpoint_clear(machine, wp->index);
+ int spacenum;
+
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ {
+ debug_cpu_watchpoint *wp;
+ while ((wp = cpuinfo->space[spacenum].wplist) != NULL)
+ debug_cpu_watchpoint_clear(machine, wp->index);
+ }
}
}
- }
debug_console_printf("Cleared all watchpoints\n");
}
@@ -1243,21 +1256,22 @@ static void execute_wpdisenable(running_machine *machine, int ref, int params, c
{
int cpunum;
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
- if (cpuinfo->valid)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- int spacenum;
-
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (cpuinfo->valid)
{
- debug_cpu_watchpoint *wp;
- for (wp = cpuinfo->space[spacenum].wplist; wp != NULL; wp = wp->next)
- debug_cpu_watchpoint_enable(machine, wp->index, ref);
+ int spacenum;
+
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ {
+ debug_cpu_watchpoint *wp;
+ for (wp = cpuinfo->space[spacenum].wplist; wp != NULL; wp = wp->next)
+ debug_cpu_watchpoint_enable(machine, wp->index, ref);
+ }
}
}
- }
if (ref == 0)
debug_console_printf("Disabled all watchpoints\n");
else
@@ -1289,40 +1303,40 @@ static void execute_wplist(running_machine *machine, int ref, int params, const
char buffer[256];
/* loop over all CPUs */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
-
- if (cpuinfo->valid)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- int spacenum;
-
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (cpuinfo->valid)
{
- if (cpuinfo->space[spacenum].wplist != NULL)
+ int spacenum;
+
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
- static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
- debug_cpu_watchpoint *wp;
+ if (cpuinfo->space[spacenum].wplist != NULL)
+ {
+ static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
+ debug_cpu_watchpoint *wp;
- debug_console_printf("CPU %d %s space watchpoints:\n", cpunum, address_space_names[spacenum]);
+ debug_console_printf("CPU %d %s space watchpoints:\n", cpunum, address_space_names[spacenum]);
- /* loop over the watchpoints */
- for (wp = cpuinfo->space[spacenum].wplist; wp != NULL; wp = wp->next)
- {
- int buflen;
- buflen = sprintf(buffer, "%c%4X @ %08X-%08X %s", wp->enabled ? ' ' : 'D',
- wp->index, BYTE2ADDR(wp->address, cpuinfo, spacenum), BYTE2ADDR(wp->address + wp->length, cpuinfo, spacenum) - 1, types[wp->type & 3]);
- if (wp->condition)
- buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(wp->condition));
- if (wp->action)
- buflen += sprintf(&buffer[buflen], " do %s", wp->action);
- debug_console_printf("%s\n", buffer);
- printed++;
+ /* loop over the watchpoints */
+ for (wp = cpuinfo->space[spacenum].wplist; wp != NULL; wp = wp->next)
+ {
+ int buflen;
+ buflen = sprintf(buffer, "%c%4X @ %08X-%08X %s", wp->enabled ? ' ' : 'D',
+ wp->index, BYTE2ADDR(wp->address, cpuinfo, spacenum), BYTE2ADDR(wp->address + wp->length, cpuinfo, spacenum) - 1, types[wp->type & 3]);
+ if (wp->condition)
+ buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(wp->condition));
+ if (wp->action)
+ buflen += sprintf(&buffer[buflen], " do %s", wp->action);
+ debug_console_printf("%s\n", buffer);
+ printed++;
+ }
}
}
}
}
- }
if (!printed)
debug_console_printf("No watchpoints currently installed\n");
@@ -1346,17 +1360,18 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const
int cleared = FALSE;
/* loop over CPUs and find live spots */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
-
- if (cpuinfo->valid && cpuinfo->hotspots)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- debug_cpu_hotspot_track(machine, cpunum, 0, 0);
- debug_console_printf("Cleared hotspot tracking on CPU %d\n", (int)cpunum);
- cleared = TRUE;
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+
+ if (cpuinfo->valid && cpuinfo->hotspots)
+ {
+ debug_cpu_hotspot_track(machine, cpunum, 0, 0);
+ debug_console_printf("Cleared hotspot tracking on CPU %d\n", (int)cpunum);
+ cleared = TRUE;
+ }
}
- }
/* if we cleared, we're done */
if (cleared)
@@ -1389,7 +1404,7 @@ static void execute_hotspot(running_machine *machine, int ref, int params, const
static void execute_save(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 offset, endoffset, length, cpunum = cpunum_get_active();
- const debug_cpu_info *info;
+ const cpu_debug_data *info;
int spacenum = ref;
FILE *f;
UINT64 i;
@@ -1403,7 +1418,7 @@ static void execute_save(running_machine *machine, int ref, int params, const ch
return;
/* determine the addresses to write */
- info = debug_get_cpu_info(cpunum);
+ info = cpu_get_debug_data(machine->cpu[cpunum]);
endoffset = ADDR2BYTE_MASKED(offset + length - 1, info, spacenum);
offset = ADDR2BYTE_MASKED(offset, info, spacenum);
@@ -1437,7 +1452,7 @@ static void execute_save(running_machine *machine, int ref, int params, const ch
static void execute_dump(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 offset, endoffset, length, width = 0, ascii = 1, cpunum = cpunum_get_active();
- const debug_cpu_info *info;
+ const cpu_debug_data *info;
int spacenum = ref;
FILE *f = NULL;
UINT64 i, j;
@@ -1460,7 +1475,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
debug_console_printf("Invalid CPU number!\n");
return;
}
- info = debug_get_cpu_info(cpunum);
+ info = cpu_get_debug_data(machine->cpu[cpunum]);
if (width == 0)
width = info->space[spacenum].databytes;
if (width < ADDR2BYTE(1, info, spacenum))
@@ -1606,7 +1621,7 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch
static void execute_find(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 offset, endoffset, length, cpunum = cpunum_get_active();
- const debug_cpu_info *info;
+ const cpu_debug_data *info;
UINT64 data_to_find[256];
UINT8 data_size[256];
int cur_data_size;
@@ -1627,7 +1642,7 @@ static void execute_find(running_machine *machine, int ref, int params, const ch
debug_console_printf("Invalid CPU number!\n");
return;
}
- info = debug_get_cpu_info(cpunum);
+ info = cpu_get_debug_data(machine->cpu[cpunum]);
endoffset = ADDR2BYTE_MASKED(offset + length - 1, info, spacenum);
offset = ADDR2BYTE_MASKED(offset, info, spacenum);
cur_data_size = ADDR2BYTE(1, info, spacenum);
@@ -1712,7 +1727,7 @@ static void execute_find(running_machine *machine, int ref, int params, const ch
static void execute_dasm(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 offset, length, bytes = 1, cpunum = cpunum_get_active();
- const debug_cpu_info *info;
+ const cpu_debug_data *info;
int minbytes, maxbytes, byteswidth;
FILE *f = NULL;
int i, j;
@@ -1733,7 +1748,7 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch
debug_console_printf("Invalid CPU number!\n");
return;
}
- info = debug_get_cpu_info(cpunum);
+ info = cpu_get_debug_data(machine->cpu[cpunum]);
/* determine the width of the bytes */
minbytes = cpu_get_min_opcode_bytes(machine->cpu[cpunum]);
@@ -1946,7 +1961,7 @@ static void execute_traceflush(running_machine *machine, int ref, int params, co
static void execute_history(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 count = DEBUG_HISTORY_SIZE;
- const debug_cpu_info *info;
+ const cpu_debug_data *info;
UINT64 cpunum;
int i;
@@ -1967,7 +1982,7 @@ static void execute_history(running_machine *machine, int ref, int params, const
if (count > DEBUG_HISTORY_SIZE)
count = DEBUG_HISTORY_SIZE;
- info = debug_get_cpu_info(cpunum);
+ info = cpu_get_debug_data(machine->cpu[cpunum]);
/* loop over lines */
cpu_push_context(machine->cpu[cpunum]);
@@ -2062,7 +2077,7 @@ static void execute_source(running_machine *machine, int ref, int params, const
static void execute_map(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 address, cpunum = cpunum_get_active();
- const debug_cpu_info *info;
+ const cpu_debug_data *info;
int spacenum = ref;
offs_t taddress;
int intention;
@@ -2070,7 +2085,7 @@ static void execute_map(running_machine *machine, int ref, int params, const cha
/* validate parameters */
if (!debug_command_parameter_number(param[0], &address))
return;
- info = debug_get_cpu_info(cpunum);
+ info = cpu_get_debug_data(machine->cpu[cpunum]);
/* do the translation first */
for (intention = TRANSLATE_READ_DEBUG; intention <= TRANSLATE_FETCH_DEBUG; intention++)
@@ -2081,7 +2096,7 @@ static void execute_map(running_machine *machine, int ref, int params, const cha
{
if ((*info->translate)(info->device, spacenum, intention, &taddress))
{
- const char *mapname = memory_get_handler_string(intention == TRANSLATE_WRITE_DEBUG, cpunum, spacenum, taddress);
+ const char *mapname = memory_get_handler_string(cpu_get_address_space(machine->cpu[cpunum], spacenum), intention == TRANSLATE_WRITE_DEBUG, taddress);
debug_console_printf("%7s: %08X logical == %08X physical -> %s\n", intnames[intention & 3], (UINT32)address, BYTE2ADDR(taddress, info, spacenum), mapname);
}
else
@@ -2089,7 +2104,7 @@ static void execute_map(running_machine *machine, int ref, int params, const cha
}
else
{
- const char *mapname = memory_get_handler_string(intention == TRANSLATE_WRITE_DEBUG, cpunum, spacenum, taddress);
+ const char *mapname = memory_get_handler_string(cpu_get_address_space(machine->cpu[cpunum], spacenum), intention == TRANSLATE_WRITE_DEBUG, taddress);
debug_console_printf("%7s: %08X -> %s\n", intnames[intention & 3], BYTE2ADDR(taddress, info, spacenum), mapname);
}
}
@@ -2112,7 +2127,7 @@ static void execute_memdump(running_machine *machine, int ref, int params, const
file = fopen(filename, "w");
if (file)
{
- memory_dump(file);
+ memory_dump(machine, file);
fclose(file);
}
}
@@ -2144,7 +2159,7 @@ static void execute_symlist(running_machine *machine, int ref, int params, const
debug_console_printf("Invalid CPU number!\n");
return;
}
- symtable = (cpunum == 100000) ? global_symtable : debug_get_cpu_info(cpunum)->symtable;
+ symtable = (cpunum == 100000) ? global_symtable : cpu_get_debug_data(machine->cpu[cpunum])->symtable;
if (symtable == global_symtable)
debug_console_printf("Global symbols:\n");
diff --git a/src/emu/debug/debugcmt.c b/src/emu/debug/debugcmt.c
index c5af8eceabc..81b9a08a31f 100644
--- a/src/emu/debug/debugcmt.c
+++ b/src/emu/debug/debugcmt.c
@@ -307,14 +307,14 @@ UINT32 debug_comment_all_change_count(void)
UINT32 debug_comment_get_opcode_crc32(offs_t address)
{
- const debug_cpu_info *info = debug_get_cpu_info(cpunum_get_active());
+ const cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
int i;
UINT32 crc;
UINT8 opbuf[64], argbuf[64];
char buff[256];
offs_t numbytes;
int maxbytes = cpu_get_max_opcode_bytes(Machine->activecpu);
- UINT32 addrmask = (debug_get_cpu_info(cpunum_get_active()))->space[ADDRESS_SPACE_PROGRAM].logaddrmask;
+ UINT32 addrmask = (cpu_get_debug_data(Machine->activecpu))->space[ADDRESS_SPACE_PROGRAM].logaddrmask;
memset(opbuf, 0x00, sizeof(opbuf));
memset(argbuf, 0x00, sizeof(argbuf));
diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c
index 74a4b41a1b6..48f115c5f56 100644
--- a/src/emu/debug/debugcon.c
+++ b/src/emu/debug/debugcon.c
@@ -328,7 +328,7 @@ static CMDERR internal_parse_command(running_machine *machine, const char *origi
if (isexpr && paramcount == 1)
{
UINT64 expresult;
- EXPRERR exprerr = expression_evaluate(command_start, debug_get_cpu_info(cpunum_get_active())->symtable, &debug_expression_callbacks, &expresult);
+ EXPRERR exprerr = expression_evaluate(command_start, cpu_get_debug_data(machine->activecpu)->symtable, &debug_expression_callbacks, &expresult);
if (exprerr != EXPRERR_NONE)
return MAKE_CMDERR_EXPRESSION_ERROR(EXPRERR_ERROR_OFFSET(exprerr));
}
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c
index ef22ba53176..9d7d5420bfe 100644
--- a/src/emu/debug/debugcpu.c
+++ b/src/emu/debug/debugcpu.c
@@ -52,10 +52,9 @@ enum
typedef struct _debugger_private debugger_private;
struct _debugger_private
{
- debug_cpu_info cpuinfo[MAX_CPU];
- debug_cpu_info *livecpu;
- debug_cpu_info *visiblecpu;
- debug_cpu_info *breakcpu;
+ cpu_debug_data *livecpu;
+ cpu_debug_data *visiblecpu;
+ cpu_debug_data *breakcpu;
UINT8 within_instruction_hook;
UINT8 vblank_occurred;
@@ -92,12 +91,12 @@ static debugger_private global;
***************************************************************************/
static void debug_cpu_exit(running_machine *machine);
-static void perform_trace(running_machine *machine, debug_cpu_info *info);
-static void prepare_for_step_overout(running_machine *machine, debug_cpu_info *info);
+static void perform_trace(running_machine *machine, cpu_debug_data *info);
+static void prepare_for_step_overout(running_machine *machine, cpu_debug_data *info);
static void process_source_file(running_machine *machine);
-static void breakpoint_check(running_machine *machine, debug_cpu_info *info, offs_t pc);
-static void watchpoint_check(running_machine *machine, int cpunum, int spacenum, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask);
-static void check_hotspots(running_machine *machine, int cpunum, int spacenum, offs_t address);
+static void breakpoint_check(running_machine *machine, cpu_debug_data *info, offs_t pc);
+static void watchpoint_check(const address_space *space, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask);
+static void check_hotspots(const address_space *space, offs_t address);
/* expression handlers */
static UINT64 expression_read_memory(const char *name, int space, UINT32 address, int size);
@@ -213,95 +212,97 @@ void debug_cpu_init(running_machine *machine)
}
/* loop over CPUs and build up their info */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- cpu_type cputype = machine->config->cpu[cpunum].type;
- debug_cpu_info *info = &global.cpuinfo[cpunum];
-
- /* if this is a dummy, stop looking */
- memset(info, 0, sizeof(*info));
- if (cputype == CPU_DUMMY)
- break;
-
- /* reset the PC data */
- info->valid = TRUE;
- info->flags = DEBUG_FLAG_OBSERVING | DEBUG_FLAG_HISTORY;
- info->device = machine->cpu[cpunum];
- info->endianness = cpu_get_endianness(info->device);
- info->opwidth = cpu_get_min_opcode_bytes(info->device);
-
- /* fetch the memory accessors */
- info->translate = (cpu_translate_func)cpu_get_info_fct(info->device, CPUINFO_PTR_TRANSLATE);
- info->read = (cpu_read_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READ);
- info->write = (cpu_write_func)cpu_get_info_fct(info->device, CPUINFO_PTR_WRITE);
- info->readop = (cpu_readop_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READOP);
-
- /* allocate a symbol table */
- info->symtable = symtable_alloc(global_symtable);
-
- /* add a global symbol for the current instruction pointer */
- symtable_add_register(info->symtable, "curpc", machine, get_current_pc, 0);
-
- /* add all registers into it */
- for (regnum = 0; regnum < MAX_REGS; regnum++)
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
{
- const char *str = cpu_get_reg_string(info->device, regnum);
- const char *colon;
- char symname[256];
- int charnum;
-
- /* skip if we don't get a valid string, or one without a colon */
- if (str == NULL)
- continue;
- if (str[0] == '~')
- str++;
- colon = strchr(str, ':');
- if (colon == NULL)
- continue;
-
- /* strip all spaces from the name and convert to lowercase */
- for (charnum = 0; charnum < sizeof(symname) - 1 && str < colon; str++)
- if (!isspace(*str))
- symname[charnum++] = tolower(*str);
- symname[charnum] = 0;
-
- /* add the symbol to the table */
- symtable_add_register(info->symtable, symname, (void *)(FPTR)regnum, get_cpu_reg, set_cpu_reg);
- }
+ const device_config *cpu = machine->cpu[cpunum];
+ cpu_class_header *classheader = cpu->classtoken;
+ cpu_debug_data *info;
+
+ /* allocate some information */
+ info = auto_malloc(sizeof(*info));
+ memset(info, 0, sizeof(*info));
+ classheader->debug = info;
+
+ /* reset the PC data */
+ info->valid = TRUE;
+ info->flags = DEBUG_FLAG_OBSERVING | DEBUG_FLAG_HISTORY;
+ info->device = machine->cpu[cpunum];
+ info->endianness = cpu_get_endianness(info->device);
+ info->opwidth = cpu_get_min_opcode_bytes(info->device);
+
+ /* fetch the memory accessors */
+ info->translate = (cpu_translate_func)cpu_get_info_fct(info->device, CPUINFO_PTR_TRANSLATE);
+ info->read = (cpu_read_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READ);
+ info->write = (cpu_write_func)cpu_get_info_fct(info->device, CPUINFO_PTR_WRITE);
+ info->readop = (cpu_readop_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READOP);
+
+ /* allocate a symbol table */
+ info->symtable = symtable_alloc(global_symtable);
+
+ /* add a global symbol for the current instruction pointer */
+ symtable_add_register(info->symtable, "curpc", machine, get_current_pc, 0);
+
+ /* add all registers into it */
+ for (regnum = 0; regnum < MAX_REGS; regnum++)
+ {
+ const char *str = cpu_get_reg_string(info->device, regnum);
+ const char *colon;
+ char symname[256];
+ int charnum;
+
+ /* skip if we don't get a valid string, or one without a colon */
+ if (str == NULL)
+ continue;
+ if (str[0] == '~')
+ str++;
+ colon = strchr(str, ':');
+ if (colon == NULL)
+ continue;
+
+ /* strip all spaces from the name and convert to lowercase */
+ for (charnum = 0; charnum < sizeof(symname) - 1 && str < colon; str++)
+ if (!isspace(*str))
+ symname[charnum++] = tolower(*str);
+ symname[charnum] = 0;
+
+ /* add the symbol to the table */
+ symtable_add_register(info->symtable, symname, (void *)(FPTR)regnum, get_cpu_reg, set_cpu_reg);
+ }
- /* loop over address spaces and get info */
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- {
- debug_space_info *spaceinfo = &info->space[spacenum];
- int datawidth = cpu_get_databus_width(info->device, spacenum);
- int logwidth = cpu_get_logaddr_width(info->device, spacenum);
- int physwidth = cpu_get_addrbus_width(info->device, spacenum);
- int addrshift = cpu_get_addrbus_shift(info->device, spacenum);
- int pageshift = cpu_get_page_shift(info->device, spacenum);
-
- if (logwidth == 0)
- logwidth = physwidth;
-
- spaceinfo->databytes = datawidth / 8;
- spaceinfo->pageshift = pageshift;
-
- /* left/right shifts to convert addresses to bytes */
- spaceinfo->addr2byte_lshift = (addrshift < 0) ? -addrshift : 0;
- spaceinfo->addr2byte_rshift = (addrshift > 0) ? addrshift : 0;
-
- /* number of character used to display addresses */
- spaceinfo->physchars = (physwidth + 3) / 4;
- spaceinfo->logchars = (logwidth + 3) / 4;
-
- /* masks to apply to addresses */
- spaceinfo->physaddrmask = (0xfffffffful >> (32 - physwidth));
- spaceinfo->logaddrmask = (0xfffffffful >> (32 - logwidth));
-
- /* masks to apply to byte addresses */
- spaceinfo->physbytemask = ((spaceinfo->physaddrmask << spaceinfo->addr2byte_lshift) | ((1 << spaceinfo->addr2byte_lshift) - 1)) >> spaceinfo->addr2byte_rshift;
- spaceinfo->logbytemask = ((spaceinfo->logaddrmask << spaceinfo->addr2byte_lshift) | ((1 << spaceinfo->addr2byte_lshift) - 1)) >> spaceinfo->addr2byte_rshift;
+ /* loop over address spaces and get info */
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ {
+ debug_space_info *spaceinfo = &info->space[spacenum];
+ int datawidth = cpu_get_databus_width(info->device, spacenum);
+ int logwidth = cpu_get_logaddr_width(info->device, spacenum);
+ int physwidth = cpu_get_addrbus_width(info->device, spacenum);
+ int addrshift = cpu_get_addrbus_shift(info->device, spacenum);
+ int pageshift = cpu_get_page_shift(info->device, spacenum);
+
+ if (logwidth == 0)
+ logwidth = physwidth;
+
+ spaceinfo->databytes = datawidth / 8;
+ spaceinfo->pageshift = pageshift;
+
+ /* left/right shifts to convert addresses to bytes */
+ spaceinfo->addr2byte_lshift = (addrshift < 0) ? -addrshift : 0;
+ spaceinfo->addr2byte_rshift = (addrshift > 0) ? addrshift : 0;
+
+ /* number of character used to display addresses */
+ spaceinfo->physchars = (physwidth + 3) / 4;
+ spaceinfo->logchars = (logwidth + 3) / 4;
+
+ /* masks to apply to addresses */
+ spaceinfo->physaddrmask = (0xfffffffful >> (32 - physwidth));
+ spaceinfo->logaddrmask = (0xfffffffful >> (32 - logwidth));
+
+ /* masks to apply to byte addresses */
+ spaceinfo->physbytemask = ((spaceinfo->physaddrmask << spaceinfo->addr2byte_lshift) | ((1 << spaceinfo->addr2byte_lshift) - 1)) >> spaceinfo->addr2byte_rshift;
+ spaceinfo->logbytemask = ((spaceinfo->logaddrmask << spaceinfo->addr2byte_lshift) | ((1 << spaceinfo->addr2byte_lshift) - 1)) >> spaceinfo->addr2byte_rshift;
+ }
}
- }
/* add callback for breaking on VBLANK */
if (machine->primary_screen != NULL)
@@ -320,32 +321,33 @@ static void debug_cpu_exit(running_machine *machine)
int cpunum, spacenum;
/* loop over all watchpoints and breakpoints to free their memory */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
- /* close any tracefiles */
- if (info->trace.file)
- fclose(info->trace.file);
- if (info->trace.action)
- free(info->trace.action);
+ /* close any tracefiles */
+ if (info->trace.file)
+ fclose(info->trace.file);
+ if (info->trace.action)
+ free(info->trace.action);
- /* free the symbol table */
- if (info->symtable)
- symtable_free(info->symtable);
+ /* free the symbol table */
+ if (info->symtable)
+ symtable_free(info->symtable);
- /* free all breakpoints */
- while (info->bplist)
- debug_cpu_breakpoint_clear(machine, info->bplist->index);
+ /* free all breakpoints */
+ while (info->bplist)
+ debug_cpu_breakpoint_clear(machine, info->bplist->index);
- /* loop over all address spaces */
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- {
- /* free all watchpoints */
- while (info->space[spacenum].wplist)
- debug_cpu_watchpoint_clear(machine, info->space[spacenum].wplist->index);
+ /* loop over all address spaces */
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ {
+ /* free all watchpoints */
+ while (info->space[spacenum].wplist)
+ debug_cpu_watchpoint_clear(machine, info->space[spacenum].wplist->index);
+ }
}
- }
/* free the global symbol table */
if (global_symtable)
@@ -363,7 +365,7 @@ static void debug_cpu_exit(running_machine *machine)
debug flags for optimal efficiency
-------------------------------------------------*/
-static void compute_debug_flags(running_machine *machine, const debug_cpu_info *info)
+static void compute_debug_flags(running_machine *machine, const cpu_debug_data *info)
{
/* clear out all global flags by default */
machine->debug_flags = DEBUG_FLAG_ENABLED;
@@ -382,13 +384,6 @@ static void compute_debug_flags(running_machine *machine, const debug_cpu_info *
/* if we are stopping at a particular time and that time is within the current timeslice, we need to be called */
if ((info->flags & DEBUG_FLAG_STOP_TIME) && attotime_compare(info->endexectime, info->stoptime) <= 0)
machine->debug_flags |= DEBUG_FLAG_CALL_HOOK;
-
- /* add in the watchpoint flags */
- machine->debug_flags |= (info->flags & DEBUG_FLAG_WATCHPOINT) >> (24 - 4);
-
- /* if any of the watchpoint flags are set and we're live, tell the memory system */
- if (global.livecpu != NULL && ((info->flags & DEBUG_FLAG_WATCHPOINT) != 0))
- memory_set_context(machine, -1);
}
@@ -402,8 +397,9 @@ static void reset_transient_flags(running_machine *machine)
int cpunum;
/* loop over CPUs and reset the transient flags */
- for (cpunum = 0; cpunum < ARRAY_LENGTH(global.cpuinfo); cpunum++)
- global.cpuinfo[cpunum].flags &= ~DEBUG_FLAG_TRANSIENT;
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ cpu_get_debug_data(machine->cpu[cpunum])->flags &= ~DEBUG_FLAG_TRANSIENT;
}
@@ -415,7 +411,7 @@ static void reset_transient_flags(running_machine *machine)
void debug_cpu_start_hook(running_machine *machine, int cpunum, attotime endtime)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
assert((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0);
@@ -474,7 +470,7 @@ void debug_cpu_start_hook(running_machine *machine, int cpunum, attotime endtime
void debug_cpu_stop_hook(running_machine *machine, int cpunum)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
assert(global.livecpu == info);
@@ -497,10 +493,10 @@ void debug_cpu_stop_hook(running_machine *machine, int cpunum)
void debug_cpu_interrupt_hook(running_machine *machine, int cpunum, int irqline)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
/* see if this matches a pending interrupt request */
- if ((info->flags & DEBUG_FLAG_STOP_INTERRUPT) != 0 && (info->stopirq == -1 || info->stopirq == irqline))
+ if (info != NULL && (info->flags & DEBUG_FLAG_STOP_INTERRUPT) != 0 && (info->stopirq == -1 || info->stopirq == irqline))
{
global.execution_state = EXECUTION_STATE_STOPPED;
debug_console_printf("Stopped on interrupt (CPU %d, IRQ %d)\n", cpunum, irqline);
@@ -516,7 +512,7 @@ void debug_cpu_interrupt_hook(running_machine *machine, int cpunum, int irqline)
void debug_cpu_exception_hook(running_machine *machine, int cpunum, int exception)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
/* see if this matches a pending interrupt request */
if ((info->flags & DEBUG_FLAG_STOP_EXCEPTION) != 0 && (info->stopexception == -1 || info->stopexception == exception))
@@ -535,7 +531,7 @@ void debug_cpu_exception_hook(running_machine *machine, int cpunum, int exceptio
void debug_cpu_instruction_hook(running_machine *machine, offs_t curpc)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
/* note that we are in the debugger code */
global.within_instruction_hook = TRUE;
@@ -587,7 +583,7 @@ void debug_cpu_instruction_hook(running_machine *machine, offs_t curpc)
/* check the temp running breakpoint and break if we hit it */
else if ((info->flags & DEBUG_FLAG_STOP_PC) != 0 && info->stopaddr == curpc)
{
- debug_console_printf("Stopped at temporary breakpoint %X on CPU %d\n", info->stopaddr, (int)(info - global.cpuinfo));
+ debug_console_printf("Stopped at temporary breakpoint %X on CPU %d\n", info->stopaddr, 0);//(int)(info - global.cpuinfo));
global.execution_state = EXECUTION_STATE_STOPPED;
}
@@ -653,17 +649,16 @@ void debug_cpu_instruction_hook(running_machine *machine, offs_t curpc)
and a memory read happens
-------------------------------------------------*/
-void debug_cpu_memory_read_hook(running_machine *machine, int cpunum, int spacenum, offs_t address, UINT64 mem_mask)
+void debug_cpu_memory_read_hook(const address_space *space, offs_t address, UINT64 mem_mask)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(space->cpu);
/* check watchpoints */
- if ((info->flags & (DEBUG_FLAG_LIVE_WPR_PROGRAM << spacenum)) != 0)
- watchpoint_check(machine, cpunum, spacenum, WATCHPOINT_READ, address, 0, mem_mask);
+ watchpoint_check(space, WATCHPOINT_READ, address, 0, mem_mask);
/* check hotspots */
if (info->hotspots != NULL)
- check_hotspots(machine, cpunum, spacenum, address);
+ check_hotspots(space, address);
}
@@ -673,13 +668,9 @@ void debug_cpu_memory_read_hook(running_machine *machine, int cpunum, int spacen
enabled and a memory write happens
-------------------------------------------------*/
-void debug_cpu_memory_write_hook(running_machine *machine, int cpunum, int spacenum, offs_t address, UINT64 data, UINT64 mem_mask)
+void debug_cpu_memory_write_hook(const address_space *space, offs_t address, UINT64 data, UINT64 mem_mask)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
-
- /* check watchpoints */
- if ((info->flags & (DEBUG_FLAG_LIVE_WPW_PROGRAM << spacenum)) != 0)
- watchpoint_check(machine, cpunum, spacenum, WATCHPOINT_WRITE, address, data, mem_mask);
+ watchpoint_check(space, WATCHPOINT_WRITE, address, data, mem_mask);
}
@@ -695,7 +686,7 @@ void debug_cpu_memory_write_hook(running_machine *machine, int cpunum, int space
void debug_cpu_single_step(int numsteps)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -715,7 +706,7 @@ void debug_cpu_single_step(int numsteps)
void debug_cpu_single_step_over(int numsteps)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -735,7 +726,7 @@ void debug_cpu_single_step_over(int numsteps)
void debug_cpu_single_step_out(void)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -754,7 +745,7 @@ void debug_cpu_single_step_out(void)
void debug_cpu_go(offs_t targetpc)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -773,7 +764,7 @@ void debug_cpu_go(offs_t targetpc)
void debug_cpu_go_vblank(void)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -792,7 +783,7 @@ void debug_cpu_go_vblank(void)
void debug_cpu_go_interrupt(int irqline)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -812,7 +803,7 @@ void debug_cpu_go_interrupt(int irqline)
#ifdef UNUSED_FUNCTION
void debug_cpu_go_exception(int exception)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -832,7 +823,7 @@ void debug_cpu_go_exception(int exception)
void debug_cpu_go_milliseconds(UINT64 milliseconds)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -851,7 +842,7 @@ void debug_cpu_go_milliseconds(UINT64 milliseconds)
void debug_cpu_next_cpu(void)
{
- debug_cpu_info *info = global.livecpu;
+ cpu_debug_data *info = global.livecpu;
if (!global.within_instruction_hook)
return;
@@ -867,9 +858,9 @@ void debug_cpu_next_cpu(void)
CPU
-------------------------------------------------*/
-void debug_cpu_ignore_cpu(int cpunum, int ignore)
+void debug_cpu_ignore_cpu(const device_config *cpu, int ignore)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(cpu);
if (!global.within_instruction_hook)
return;
@@ -891,7 +882,7 @@ void debug_cpu_ignore_cpu(int cpunum, int ignore)
void debug_cpu_trace(int cpunum, FILE *file, int trace_over, const char *action)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpunum]);
/* close existing files and delete expressions */
if (info->trace.file != NULL)
@@ -926,29 +917,18 @@ void debug_cpu_trace(int cpunum, FILE *file, int trace_over, const char *action)
***************************************************************************/
/*-------------------------------------------------
- debug_get_cpu_info - returns the cpu info
- block for a given CPU
--------------------------------------------------*/
-
-const debug_cpu_info *debug_get_cpu_info(int cpunum)
-{
- return &global.cpuinfo[cpunum];
-}
-
-
-/*-------------------------------------------------
debug_cpu_halt_on_next_instruction - halt in
the debugger on the next instruction
-------------------------------------------------*/
void debug_cpu_halt_on_next_instruction(running_machine *machine, int cpunum, const char *fmt, ...)
{
- debug_cpu_info *info;
+ cpu_debug_data *info;
va_list arg;
/* pick the best CPU to land on */
if (cpunum != -1)
- info = &global.cpuinfo[cpunum];
+ info = cpu_get_debug_data(machine->cpu[cpunum]);
else if (global.visiblecpu != NULL)
info = global.visiblecpu;
else
@@ -991,7 +971,7 @@ int debug_cpu_is_stopped(running_machine *machine)
static UINT32 dasm_wrapped(running_machine *machine, char *buffer, offs_t pc)
{
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum_get_active());
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->activecpu);
int maxbytes = cpu_get_max_opcode_bytes(machine->activecpu);
UINT8 opbuf[64], argbuf[64];
offs_t pcbyte;
@@ -1009,7 +989,7 @@ static UINT32 dasm_wrapped(running_machine *machine, char *buffer, offs_t pc)
}
-static void perform_trace(running_machine *machine, debug_cpu_info *info)
+static void perform_trace(running_machine *machine, cpu_debug_data *info)
{
offs_t pc = cpu_get_pc(machine->activecpu);
int offset, count, i;
@@ -1079,7 +1059,7 @@ static void perform_trace(running_machine *machine, debug_cpu_info *info)
stepping over an instruction
-------------------------------------------------*/
-static void prepare_for_step_overout(running_machine *machine, debug_cpu_info *info)
+static void prepare_for_step_overout(running_machine *machine, cpu_debug_data *info)
{
offs_t pc = cpu_get_pc(machine->activecpu);
char dasmbuffer[100];
@@ -1161,7 +1141,7 @@ static void process_source_file(running_machine *machine)
void debug_cpu_set_instruction_hook(int cpunum, int (*hook)(offs_t pc))
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpunum]);
/* set the hook and also the CPU's flag for fast knowledge of the hook */
info->instrhook = hook;
@@ -1182,7 +1162,7 @@ void debug_cpu_set_instruction_hook(int cpunum, int (*hook)(offs_t pc))
breakpoint flags
-------------------------------------------------*/
-static void breakpoint_update_flags(running_machine *machine, debug_cpu_info *info)
+static void breakpoint_update_flags(running_machine *machine, cpu_debug_data *info)
{
debug_cpu_breakpoint *bp;
@@ -1206,7 +1186,7 @@ static void breakpoint_update_flags(running_machine *machine, debug_cpu_info *in
a given CPU
-------------------------------------------------*/
-static void breakpoint_check(running_machine *machine, debug_cpu_info *info, offs_t pc)
+static void breakpoint_check(running_machine *machine, cpu_debug_data *info, offs_t pc)
{
debug_cpu_breakpoint *bp;
UINT64 result;
@@ -1239,7 +1219,7 @@ static void breakpoint_check(running_machine *machine, debug_cpu_info *info, off
int debug_cpu_breakpoint_set(running_machine *machine, int cpunum, offs_t address, parsed_expression *condition, const char *action)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
debug_cpu_breakpoint *bp;
assert_always(cpunum >= 0 && cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum] != NULL, "debug_cpu_breakpoint_set() called with invalid cpunum!");
@@ -1277,30 +1257,31 @@ int debug_cpu_breakpoint_clear(running_machine *machine, int bpnum)
int cpunum;
/* loop over CPUs and find the requested breakpoint */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- debug_cpu_info *info = &global.cpuinfo[cpunum];
- for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next)
- if (bp->index == bpnum)
- {
- /* unlink us from the list */
- if (pbp == NULL)
- info->bplist = bp->next;
- else
- pbp->next = bp->next;
-
- /* free the memory */
- if (bp->condition != NULL)
- expression_free(bp->condition);
- if (bp->action != NULL)
- free(bp->action);
- free(bp);
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
+ for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next)
+ if (bp->index == bpnum)
+ {
+ /* unlink us from the list */
+ if (pbp == NULL)
+ info->bplist = bp->next;
+ else
+ pbp->next = bp->next;
- /* update the flags */
- breakpoint_update_flags(machine, info);
- return 1;
- }
- }
+ /* free the memory */
+ if (bp->condition != NULL)
+ expression_free(bp->condition);
+ if (bp->action != NULL)
+ free(bp->action);
+ free(bp);
+
+ /* update the flags */
+ breakpoint_update_flags(machine, info);
+ return 1;
+ }
+ }
/* we didn't find it; return an error */
return 0;
@@ -1318,17 +1299,18 @@ int debug_cpu_breakpoint_enable(running_machine *machine, int bpnum, int enable)
int cpunum;
/* loop over CPUs and find the requested breakpoint */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- debug_cpu_info *info = &global.cpuinfo[cpunum];
- for (bp = info->bplist; bp != NULL; bp = bp->next)
- if (bp->index == bpnum)
- {
- bp->enabled = (enable != 0);
- breakpoint_update_flags(machine, info);
- return 1;
- }
- }
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
+ for (bp = info->bplist; bp != NULL; bp = bp->next)
+ if (bp->index == bpnum)
+ {
+ bp->enabled = (enable != 0);
+ breakpoint_update_flags(machine, info);
+ return 1;
+ }
+ }
return 0;
}
@@ -1344,41 +1326,30 @@ int debug_cpu_breakpoint_enable(running_machine *machine, int bpnum, int enable)
watchpoint flags
-------------------------------------------------*/
-static void watchpoint_update_flags(running_machine *machine, debug_cpu_info *info, int spacenum)
+static void watchpoint_update_flags(const address_space *space)
{
- UINT32 writeflag = DEBUG_FLAG_LIVE_WPW_PROGRAM << spacenum;
- UINT32 readflag = DEBUG_FLAG_LIVE_WPR_PROGRAM << spacenum;
+ const cpu_debug_data *info = cpu_get_debug_data(space->cpu);
debug_cpu_watchpoint *wp;
+ int enablewrite = FALSE;
+ int enableread = FALSE;
/* if hotspots are enabled, turn on all reads */
if (info->hotspots != NULL)
- {
- info->flags |= DEBUG_FLAG_READ_WATCHPOINT;
- readflag = 0;
- }
+ enableread = TRUE;
/* see if there are any enabled breakpoints */
- info->flags &= ~(readflag | writeflag);
- for (wp = info->space[spacenum].wplist; wp != NULL; wp = wp->next)
+ for (wp = info->space[space->spacenum].wplist; wp != NULL; wp = wp->next)
if (wp->enabled)
{
if (wp->type & WATCHPOINT_READ)
- {
- info->flags |= readflag;
- readflag = 0;
- }
+ enableread = TRUE;
if (wp->type & WATCHPOINT_WRITE)
- {
- info->flags |= writeflag;
- writeflag = 0;
- }
- if ((readflag | writeflag) == 0)
- break;
+ enablewrite = TRUE;
}
/* push the flags out globally */
- if (global.livecpu != NULL)
- compute_debug_flags(machine, global.livecpu);
+ memory_enable_read_watchpoints(space, enableread);
+ memory_enable_write_watchpoints(space, enablewrite);
}
@@ -1387,9 +1358,9 @@ static void watchpoint_update_flags(running_machine *machine, debug_cpu_info *in
for a given CPU and address space
-------------------------------------------------*/
-static void watchpoint_check(running_machine *machine, int cpunum, int spacenum, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask)
+static void watchpoint_check(const address_space *space, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum];
+ const cpu_debug_data *info = cpu_get_debug_data(space->cpu);
debug_cpu_watchpoint *wp;
offs_t size = 0;
UINT64 result;
@@ -1403,7 +1374,7 @@ static void watchpoint_check(running_machine *machine, int cpunum, int spacenum,
/* adjust address, size & value_to_write based on mem_mask. */
if (mem_mask != 0)
{
- int bus_size = info->space[spacenum].databytes;
+ int bus_size = info->space[space->spacenum].databytes;
int address_offset = 0;
while (address_offset < bus_size && (mem_mask & 0xff) == 0)
@@ -1431,7 +1402,7 @@ static void watchpoint_check(running_machine *machine, int cpunum, int spacenum,
global.wpdata = value_to_write;
/* see if we match */
- for (wp = info->space[spacenum].wplist; wp != NULL; wp = wp->next)
+ for (wp = info->space[space->spacenum].wplist; wp != NULL; wp = wp->next)
if (wp->enabled && (wp->type & type) != 0 && address + size > wp->address && address < wp->address + wp->length)
/* if we do, evaluate the condition */
@@ -1442,7 +1413,7 @@ static void watchpoint_check(running_machine *machine, int cpunum, int spacenum,
/* if we hit, evaluate the action */
if (wp->action != NULL)
- debug_console_execute_command(machine, wp->action, 0);
+ debug_console_execute_command(space->machine, wp->action, 0);
/* print a notification, unless the action made us go again */
if (global.execution_state == EXECUTION_STATE_STOPPED)
@@ -1455,16 +1426,16 @@ static void watchpoint_check(running_machine *machine, int cpunum, int spacenum,
if (type & WATCHPOINT_WRITE)
{
- sprintf(buffer, "Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->index, sizes[size], BYTE2ADDR(address, &global.cpuinfo[cpunum], spacenum), cpu_get_pc(machine->activecpu));
+ sprintf(buffer, "Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->index, sizes[size], cpu_byte_to_address(space->cpu, space->spacenum, address), cpu_get_pc(space->cpu));
if (value_to_write >> 32)
sprintf(&buffer[strlen(buffer)], " (data=%X%08X)", (UINT32)(value_to_write >> 32), (UINT32)value_to_write);
else
sprintf(&buffer[strlen(buffer)], " (data=%X)", (UINT32)value_to_write);
}
else
- sprintf(buffer, "Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->index, sizes[size], BYTE2ADDR(address, &global.cpuinfo[cpunum], spacenum), cpu_get_pc(machine->activecpu));
+ sprintf(buffer, "Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->index, sizes[size], cpu_byte_to_address(space->cpu, space->spacenum, address), cpu_get_pc(space->cpu));
debug_console_printf("%s\n", buffer);
- compute_debug_flags(machine, info);
+ compute_debug_flags(space->machine, info);
}
break;
}
@@ -1479,15 +1450,15 @@ static void watchpoint_check(running_machine *machine, int cpunum, int spacenum,
int debug_cpu_watchpoint_set(running_machine *machine, int cpunum, int spacenum, int type, offs_t address, offs_t length, parsed_expression *condition, const char *action)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
debug_cpu_watchpoint *wp = malloc_or_die(sizeof(*wp));
/* fill in the structure */
wp->index = global.wpindex++;
wp->enabled = TRUE;
wp->type = type;
- wp->address = ADDR2BYTE_MASKED(address, &global.cpuinfo[cpunum], spacenum);
- wp->length = ADDR2BYTE(length, &global.cpuinfo[cpunum], spacenum);
+ wp->address = ADDR2BYTE_MASKED(address, info, spacenum);
+ wp->length = ADDR2BYTE(length, info, spacenum);
wp->condition = condition;
wp->action = NULL;
if (action != NULL)
@@ -1500,7 +1471,7 @@ int debug_cpu_watchpoint_set(running_machine *machine, int cpunum, int spacenum,
wp->next = info->space[spacenum].wplist;
info->space[spacenum].wplist = wp;
- watchpoint_update_flags(machine, info, spacenum);
+ watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], spacenum));
return wp->index;
}
@@ -1516,30 +1487,31 @@ int debug_cpu_watchpoint_clear(running_machine *machine, int wpnum)
int cpunum, spacenum;
/* loop over CPUs and find the requested watchpoint */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- for (pwp = NULL, wp = info->space[spacenum].wplist; wp != NULL; pwp = wp, wp = wp->next)
- if (wp->index == wpnum)
- {
- /* unlink us from the list */
- if (pwp == NULL)
- info->space[spacenum].wplist = wp->next;
- else
- pwp->next = wp->next;
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ for (pwp = NULL, wp = info->space[spacenum].wplist; wp != NULL; pwp = wp, wp = wp->next)
+ if (wp->index == wpnum)
+ {
+ /* unlink us from the list */
+ if (pwp == NULL)
+ info->space[spacenum].wplist = wp->next;
+ else
+ pwp->next = wp->next;
- /* free the memory */
- if (wp->condition != NULL)
- expression_free(wp->condition);
- if (wp->action != NULL)
- free(wp->action);
- free(wp);
+ /* free the memory */
+ if (wp->condition != NULL)
+ expression_free(wp->condition);
+ if (wp->action != NULL)
+ free(wp->action);
+ free(wp);
- watchpoint_update_flags(machine, info, spacenum);
- return 1;
- }
+ watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], spacenum));
+ return 1;
+ }
}
/* we didn't find it; return an error */
@@ -1558,19 +1530,20 @@ int debug_cpu_watchpoint_enable(running_machine *machine, int wpnum, int enable)
int cpunum, spacenum;
/* loop over CPUs and address spaces and find the requested watchpoint */
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- for (wp = info->space[spacenum].wplist; wp; wp = wp->next)
- if (wp->index == wpnum)
- {
- wp->enabled = (enable != 0);
- watchpoint_update_flags(machine, info, spacenum);
- return 1;
- }
- }
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ for (wp = info->space[spacenum].wplist; wp; wp = wp->next)
+ if (wp->index == wpnum)
+ {
+ wp->enabled = (enable != 0);
+ watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], spacenum));
+ return 1;
+ }
+ }
return 0;
}
@@ -1587,7 +1560,7 @@ int debug_cpu_watchpoint_enable(running_machine *machine, int wpnum, int enable)
int debug_cpu_hotspot_track(running_machine *machine, int cpunum, int numspots, int threshhold)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
/* if we already have tracking info, kill it */
if (info->hotspots)
@@ -1606,7 +1579,7 @@ int debug_cpu_hotspot_track(running_machine *machine, int cpunum, int numspots,
info->hotspot_threshhold = threshhold;
}
- watchpoint_update_flags(machine, info, ADDRESS_SPACE_PROGRAM);
+ watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM));
return 1;
}
@@ -1616,15 +1589,15 @@ int debug_cpu_hotspot_track(running_machine *machine, int cpunum, int numspots,
hotspots on a memory read access
-------------------------------------------------*/
-static void check_hotspots(running_machine *machine, int cpunum, int spacenum, offs_t address)
+static void check_hotspots(const address_space *space, offs_t address)
{
- debug_cpu_info *info = &global.cpuinfo[cpunum];
- offs_t pc = cpu_get_pc(machine->activecpu);
+ cpu_debug_data *info = cpu_get_debug_data(space->cpu);
+ offs_t pc = cpu_get_pc(space->cpu);
int hotindex;
/* see if we have a match in our list */
for (hotindex = 0; hotindex < info->hotspot_count; hotindex++)
- if (info->hotspots[hotindex].access == address && info->hotspots[hotindex].pc == pc && info->hotspots[hotindex].spacenum == spacenum)
+ if (info->hotspots[hotindex].access == address && info->hotspots[hotindex].pc == pc && info->hotspots[hotindex].spacenum == space->spacenum)
break;
/* if we didn't find any, make a new entry */
@@ -1639,7 +1612,7 @@ static void check_hotspots(running_machine *machine, int cpunum, int spacenum, o
memmove(&info->hotspots[1], &info->hotspots[0], sizeof(info->hotspots[0]) * (info->hotspot_count - 1));
info->hotspots[0].access = address;
info->hotspots[0].pc = pc;
- info->hotspots[0].spacenum = spacenum;
+ info->hotspots[0].spacenum = space->spacenum;
info->hotspots[0].count = 1;
}
@@ -1668,7 +1641,7 @@ static void check_hotspots(running_machine *machine, int cpunum, int spacenum, o
UINT8 debug_read_byte(int spacenum, offs_t address, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
UINT64 custom;
UINT8 result;
@@ -1676,7 +1649,7 @@ UINT8 debug_read_byte(int spacenum, offs_t address, int apply_translation)
address &= info->space[spacenum].logbytemask;
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xff */
if (apply_translation && info->translate != NULL && !(*info->translate)(info->device, spacenum, TRANSLATE_READ_DEBUG, &address))
@@ -1688,10 +1661,10 @@ UINT8 debug_read_byte(int spacenum, offs_t address, int apply_translation)
/* otherwise, call the byte reading function for the translated address */
else
- result = (*active_address_space[spacenum]->accessors.read_byte)(address);
+ result = memory_read_byte(active_address_space[spacenum], address);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
return result;
}
@@ -1703,7 +1676,7 @@ UINT8 debug_read_byte(int spacenum, offs_t address, int apply_translation)
UINT16 debug_read_word(int spacenum, offs_t address, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
UINT64 custom;
UINT16 result;
@@ -1711,13 +1684,13 @@ UINT16 debug_read_word(int spacenum, offs_t address, int apply_translation)
address &= info->space[spacenum].logbytemask;
/* if this is misaligned read, or if there are no word readers, just read two bytes */
- if ((address & 1) || !active_address_space[spacenum]->accessors.read_word)
+ if ((address & 1) != 0)
{
UINT8 byte0 = debug_read_byte(spacenum, address + 0, apply_translation);
UINT8 byte1 = debug_read_byte(spacenum, address + 1, apply_translation);
/* based on the endianness, the result is assembled differently */
- if (global.cpuinfo[cpunum_get_active()].endianness == CPU_IS_LE)
+ if (info->endianness == CPU_IS_LE)
result = byte0 | (byte1 << 8);
else
result = byte1 | (byte0 << 8);
@@ -1727,7 +1700,7 @@ UINT16 debug_read_word(int spacenum, offs_t address, int apply_translation)
else
{
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xffff */
if (apply_translation && info->translate != NULL && !(*info->translate)(info->device, spacenum, TRANSLATE_READ_DEBUG, &address))
@@ -1739,10 +1712,10 @@ UINT16 debug_read_word(int spacenum, offs_t address, int apply_translation)
/* otherwise, call the byte reading function for the translated address */
else
- result = (*active_address_space[spacenum]->accessors.read_word)(address);
+ result = memory_read_word(active_address_space[spacenum], address);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
}
return result;
@@ -1756,7 +1729,7 @@ UINT16 debug_read_word(int spacenum, offs_t address, int apply_translation)
UINT32 debug_read_dword(int spacenum, offs_t address, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
UINT64 custom;
UINT32 result;
@@ -1764,13 +1737,13 @@ UINT32 debug_read_dword(int spacenum, offs_t address, int apply_translation)
address &= info->space[spacenum].logbytemask;
/* if this is misaligned read, or if there are no dword readers, just read two words */
- if ((address & 3) || !active_address_space[spacenum]->accessors.read_dword)
+ if ((address & 3) != 0)
{
UINT16 word0 = debug_read_word(spacenum, address + 0, apply_translation);
UINT16 word1 = debug_read_word(spacenum, address + 2, apply_translation);
/* based on the endianness, the result is assembled differently */
- if (global.cpuinfo[cpunum_get_active()].endianness == CPU_IS_LE)
+ if (info->endianness == CPU_IS_LE)
result = word0 | (word1 << 16);
else
result = word1 | (word0 << 16);
@@ -1780,7 +1753,7 @@ UINT32 debug_read_dword(int spacenum, offs_t address, int apply_translation)
else
{
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xffffffff */
if (apply_translation && info->translate != NULL && !(*info->translate)(info->device, spacenum, TRANSLATE_READ_DEBUG, &address))
@@ -1792,10 +1765,10 @@ UINT32 debug_read_dword(int spacenum, offs_t address, int apply_translation)
/* otherwise, call the byte reading function for the translated address */
else
- result = (*active_address_space[spacenum]->accessors.read_dword)(address);
+ result = memory_read_dword(active_address_space[spacenum], address);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
}
return result;
@@ -1809,7 +1782,7 @@ UINT32 debug_read_dword(int spacenum, offs_t address, int apply_translation)
UINT64 debug_read_qword(int spacenum, offs_t address, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
UINT64 custom;
UINT64 result;
@@ -1817,13 +1790,13 @@ UINT64 debug_read_qword(int spacenum, offs_t address, int apply_translation)
address &= info->space[spacenum].logbytemask;
/* if this is misaligned read, or if there are no qword readers, just read two dwords */
- if ((address & 7) || !active_address_space[spacenum]->accessors.read_qword)
+ if ((address & 7) != 0)
{
UINT32 dword0 = debug_read_dword(spacenum, address + 0, apply_translation);
UINT32 dword1 = debug_read_dword(spacenum, address + 4, apply_translation);
/* based on the endianness, the result is assembled differently */
- if (global.cpuinfo[cpunum_get_active()].endianness == CPU_IS_LE)
+ if (info->endianness == CPU_IS_LE)
result = dword0 | ((UINT64)dword1 << 32);
else
result = dword1 | ((UINT64)dword0 << 32);
@@ -1833,7 +1806,7 @@ UINT64 debug_read_qword(int spacenum, offs_t address, int apply_translation)
else
{
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
if (apply_translation && info->translate != NULL && !(*info->translate)(info->device, spacenum, TRANSLATE_READ_DEBUG, &address))
@@ -1845,10 +1818,10 @@ UINT64 debug_read_qword(int spacenum, offs_t address, int apply_translation)
/* otherwise, call the byte reading function for the translated address */
else
- result = (*active_address_space[spacenum]->accessors.read_qword)(address);
+ result = memory_read_qword(active_address_space[spacenum], address);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
}
return result;
@@ -1862,13 +1835,13 @@ UINT64 debug_read_qword(int spacenum, offs_t address, int apply_translation)
void debug_write_byte(int spacenum, offs_t address, UINT8 data, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
/* mask against the logical byte mask */
address &= info->space[spacenum].logbytemask;
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
if (apply_translation && info->translate != NULL && !(*info->translate)(info->device, spacenum, TRANSLATE_WRITE_DEBUG, &address))
@@ -1880,10 +1853,10 @@ void debug_write_byte(int spacenum, offs_t address, UINT8 data, int apply_transl
/* otherwise, call the byte reading function for the translated address */
else
- (*active_address_space[spacenum]->accessors.write_byte)(address, data);
+ memory_write_byte(active_address_space[spacenum], address, data);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
global.memory_modified = TRUE;
}
@@ -1895,15 +1868,15 @@ void debug_write_byte(int spacenum, offs_t address, UINT8 data, int apply_transl
void debug_write_word(int spacenum, offs_t address, UINT16 data, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
/* mask against the logical byte mask */
address &= info->space[spacenum].logbytemask;
/* if this is a misaligned write, or if there are no word writers, just read two bytes */
- if ((address & 1) || !active_address_space[spacenum]->accessors.write_word)
+ if ((address & 1) != 0)
{
- if (global.cpuinfo[cpunum_get_active()].endianness == CPU_IS_LE)
+ if (info->endianness == CPU_IS_LE)
{
debug_write_byte(spacenum, address + 0, data >> 0, apply_translation);
debug_write_byte(spacenum, address + 1, data >> 8, apply_translation);
@@ -1919,7 +1892,7 @@ void debug_write_word(int spacenum, offs_t address, UINT16 data, int apply_trans
else
{
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
if (apply_translation && info->translate && !(*info->translate)(info->device, spacenum, TRANSLATE_WRITE_DEBUG, &address))
@@ -1931,10 +1904,10 @@ void debug_write_word(int spacenum, offs_t address, UINT16 data, int apply_trans
/* otherwise, call the byte reading function for the translated address */
else
- (*active_address_space[spacenum]->accessors.write_word)(address, data);
+ memory_write_word(active_address_space[spacenum], address, data);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
global.memory_modified = TRUE;
}
}
@@ -1947,15 +1920,15 @@ void debug_write_word(int spacenum, offs_t address, UINT16 data, int apply_trans
void debug_write_dword(int spacenum, offs_t address, UINT32 data, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
/* mask against the logical byte mask */
address &= info->space[spacenum].logbytemask;
/* if this is a misaligned write, or if there are no dword writers, just read two words */
- if ((address & 3) || !active_address_space[spacenum]->accessors.write_dword)
+ if ((address & 3) != 0)
{
- if (global.cpuinfo[cpunum_get_active()].endianness == CPU_IS_LE)
+ if (info->endianness == CPU_IS_LE)
{
debug_write_word(spacenum, address + 0, data >> 0, apply_translation);
debug_write_word(spacenum, address + 2, data >> 16, apply_translation);
@@ -1971,7 +1944,7 @@ void debug_write_dword(int spacenum, offs_t address, UINT32 data, int apply_tran
else
{
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
if (apply_translation && info->translate && !(*info->translate)(info->device, spacenum, TRANSLATE_WRITE_DEBUG, &address))
@@ -1983,10 +1956,10 @@ void debug_write_dword(int spacenum, offs_t address, UINT32 data, int apply_tran
/* otherwise, call the byte reading function for the translated address */
else
- (*active_address_space[spacenum]->accessors.write_dword)(address, data);
+ memory_write_dword(active_address_space[spacenum], address, data);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
global.memory_modified = TRUE;
}
}
@@ -1999,15 +1972,15 @@ void debug_write_dword(int spacenum, offs_t address, UINT32 data, int apply_tran
void debug_write_qword(int spacenum, offs_t address, UINT64 data, int apply_translation)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
/* mask against the logical byte mask */
address &= info->space[spacenum].logbytemask;
/* if this is a misaligned write, or if there are no qword writers, just read two dwords */
- if ((address & 7) || !active_address_space[spacenum]->accessors.write_qword)
+ if ((address & 7) != 0)
{
- if (global.cpuinfo[cpunum_get_active()].endianness == CPU_IS_LE)
+ if (info->endianness == CPU_IS_LE)
{
debug_write_dword(spacenum, address + 0, data >> 0, apply_translation);
debug_write_dword(spacenum, address + 4, data >> 32, apply_translation);
@@ -2022,7 +1995,7 @@ void debug_write_qword(int spacenum, offs_t address, UINT64 data, int apply_tran
else
{
/* all accesses from this point on are for the debugger */
- memory_set_debugger_access(global.debugger_access = TRUE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = TRUE);
/* translate if necessary; if not mapped, we're done */
if (apply_translation && info->translate && !(*info->translate)(info->device, spacenum, TRANSLATE_WRITE_DEBUG, &address))
@@ -2034,10 +2007,10 @@ void debug_write_qword(int spacenum, offs_t address, UINT64 data, int apply_tran
/* otherwise, call the byte reading function for the translated address */
else
- (*active_address_space[spacenum]->accessors.write_qword)(address, data);
+ memory_write_qword(active_address_space[spacenum], address, data);
/* no longer accessing via the debugger */
- memory_set_debugger_access(global.debugger_access = FALSE);
+ memory_set_debugger_access(active_address_space[spacenum], global.debugger_access = FALSE);
global.memory_modified = TRUE;
}
}
@@ -2050,7 +2023,8 @@ void debug_write_qword(int spacenum, offs_t address, UINT64 data, int apply_tran
UINT64 debug_read_opcode(offs_t address, int size, int arg)
{
- const debug_cpu_info *info = &global.cpuinfo[cpunum_get_active()];
+ const address_space *space = cpu_get_address_space(Machine->activecpu, ADDRESS_SPACE_PROGRAM);
+ cpu_debug_data *info = cpu_get_debug_data(Machine->activecpu);
offs_t lowbits_mask;
const void *ptr;
@@ -2144,19 +2118,18 @@ UINT64 debug_read_opcode(offs_t address, int size, int arg)
/* get pointer to data */
/* note that we query aligned to the bus width, and then add back the low bits */
lowbits_mask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1;
- ptr = memory_get_op_ptr(Machine, cpunum_get_active(), address & ~lowbits_mask, arg);
- if (!ptr)
+ if (!arg)
+ ptr = memory_decrypted_read_ptr(space, address & ~lowbits_mask);
+ else
+ ptr = memory_raw_read_ptr(space, address & ~lowbits_mask);
+ if (ptr == NULL)
return ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size));
ptr = (UINT8 *)ptr + (address & lowbits_mask);
- /* gross! */
-// if (osd_is_bad_read_ptr(ptr, size))
-// fatalerror("debug_read_opcode: cpu %d address %x mapped to invalid memory %p", cpunum_get_active(), address, ptr);
-
/* return based on the size */
switch (size)
{
- case 1: return *(UINT8 *) ptr;
+ case 1: return *(UINT8 *) ptr;
case 2: return *(UINT16 *)ptr;
case 4: return *(UINT32 *)ptr;
case 8: return *(UINT64 *)ptr;
@@ -2229,27 +2202,31 @@ static UINT64 expression_read_memory(const char *name, int space, UINT32 address
from a specific CPU's address space
-------------------------------------------------*/
-static UINT64 expression_read_address_space(int cpuindex, int space, offs_t address, int size)
+static UINT64 expression_read_address_space(int cpuindex, int spacenum, offs_t address, int size)
{
- const debug_cpu_info *info = &global.cpuinfo[cpuindex];
UINT64 result = ~(UINT64)0 >> (64 - 8*size);
- /* only process if in of range and we have a bus */
- if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[space].databytes != 0)
+ if (cpuindex >= 0 && cpuindex < ARRAY_LENGTH(Machine->cpu) && Machine->cpu[cpuindex] != NULL)
{
- /* adjust the address into a byte address */
- address = ADDR2BYTE(address, info, space);
+ cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpuindex]);
- /* switch contexts and do the read */
- cpu_push_context(Machine->cpu[cpuindex]);
- switch (size)
+ /* only process if in of range and we have a bus */
+ if (info->space[spacenum].databytes != 0)
{
- case 1: result = debug_read_byte(space, address, TRUE); break;
- case 2: result = debug_read_word(space, address, TRUE); break;
- case 4: result = debug_read_dword(space, address, TRUE); break;
- case 8: result = debug_read_qword(space, address, TRUE); break;
+ /* adjust the address into a byte address */
+ address = ADDR2BYTE(address, info, spacenum);
+
+ /* switch contexts and do the read */
+ cpu_push_context(Machine->cpu[cpuindex]);
+ switch (size)
+ {
+ case 1: result = debug_read_byte(spacenum, address, TRUE); break;
+ case 2: result = debug_read_word(spacenum, address, TRUE); break;
+ case 4: result = debug_read_dword(spacenum, address, TRUE); break;
+ case 8: result = debug_read_qword(spacenum, address, TRUE); break;
+ }
+ cpu_pop_context();
}
- cpu_pop_context();
}
return result;
}
@@ -2262,53 +2239,57 @@ static UINT64 expression_read_address_space(int cpuindex, int space, offs_t addr
static UINT64 expression_read_program_direct(int cpuindex, int opcode, offs_t address, int size)
{
- const debug_cpu_info *info = &global.cpuinfo[cpuindex];
UINT64 result = ~(UINT64)0 >> (64 - 8*size);
- UINT8 *base;
- /* only process if in of range and we have a bus */
- if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[ADDRESS_SPACE_PROGRAM].databytes != 0)
+ if (cpuindex >= 0 && cpuindex < ARRAY_LENGTH(Machine->cpu) && Machine->cpu[cpuindex] != NULL)
{
- /* adjust the address into a byte address, but not if being called recursively */
- if ((opcode & 2) == 0)
- address = ADDR2BYTE(address, info, ADDRESS_SPACE_PROGRAM);
+ cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpuindex]);
+ UINT8 *base;
- /* call ourself recursively until we are byte-sized */
- if (size > 1)
+ /* only process if in of range and we have a bus */
+ if (info->space[ADDRESS_SPACE_PROGRAM].databytes != 0)
{
- int halfsize = size / 2;
- UINT64 r0, r1;
+ /* adjust the address into a byte address, but not if being called recursively */
+ if ((opcode & 2) == 0)
+ address = ADDR2BYTE(address, info, ADDRESS_SPACE_PROGRAM);
- /* read each half, from lower address to upper address */
- r0 = expression_read_program_direct(cpuindex, opcode | 2, address + 0, halfsize);
- r1 = expression_read_program_direct(cpuindex, opcode | 2, address + halfsize, halfsize);
+ /* call ourself recursively until we are byte-sized */
+ if (size > 1)
+ {
+ int halfsize = size / 2;
+ UINT64 r0, r1;
- /* assemble based on the target endianness */
- if (info->endianness == CPU_IS_LE)
- result = r0 | (r1 << (8 * halfsize));
- else
- result = r1 | (r0 << (8 * halfsize));
- }
+ /* read each half, from lower address to upper address */
+ r0 = expression_read_program_direct(cpuindex, opcode | 2, address + 0, halfsize);
+ r1 = expression_read_program_direct(cpuindex, opcode | 2, address + halfsize, halfsize);
- /* handle the byte-sized final requests */
- else
- {
- /* lowmask specified which address bits are within the databus width */
- offs_t lowmask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1;
+ /* assemble based on the target endianness */
+ if (info->endianness == CPU_IS_LE)
+ result = r0 | (r1 << (8 * halfsize));
+ else
+ result = r1 | (r0 << (8 * halfsize));
+ }
- /* get the base of memory, aligned to the address minus the lowbits */
- if (opcode & 1)
- base = memory_get_op_ptr(Machine, cpuindex, address & ~lowmask, FALSE);
+ /* handle the byte-sized final requests */
else
- base = memory_get_read_ptr(cpuindex, ADDRESS_SPACE_PROGRAM, address & ~lowmask);
-
- /* if we have a valid base, return the appropriate byte */
- if (base != NULL)
{
- if (info->endianness == CPU_IS_LE)
- result = base[BYTE8_XOR_LE(address) & lowmask];
+ /* lowmask specified which address bits are within the databus width */
+ offs_t lowmask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1;
+
+ /* get the base of memory, aligned to the address minus the lowbits */
+ if (opcode & 1)
+ base = memory_decrypted_read_ptr(cpu_get_address_space(Machine->cpu[cpuindex], ADDRESS_SPACE_PROGRAM), address & ~lowmask);
else
- result = base[BYTE8_XOR_BE(address) & lowmask];
+ base = memory_get_read_ptr(cpu_get_address_space(Machine->cpu[cpuindex], ADDRESS_SPACE_PROGRAM), address & ~lowmask);
+
+ /* if we have a valid base, return the appropriate byte */
+ if (base != NULL)
+ {
+ if (info->endianness == CPU_IS_LE)
+ result = base[BYTE8_XOR_LE(address) & lowmask];
+ else
+ result = base[BYTE8_XOR_BE(address) & lowmask];
+ }
}
}
}
@@ -2441,24 +2422,27 @@ static void expression_write_memory(const char *name, int space, UINT32 address,
static void expression_write_address_space(int cpuindex, int space, offs_t address, int size, UINT64 data)
{
- const debug_cpu_info *info = &global.cpuinfo[cpuindex];
-
- /* only process if in of range and we have a bus */
- if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[space].databytes != 0)
+ if (cpuindex >= 0 && cpuindex < ARRAY_LENGTH(Machine->cpu) && Machine->cpu[cpuindex] != NULL)
{
- /* adjust the address into a byte address */
- address = ADDR2BYTE(address, info, space);
+ const cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpuindex]);
- /* switch contexts and do the write */
- cpu_push_context(Machine->cpu[cpuindex]);
- switch (size)
+ /* only process if in of range and we have a bus */
+ if (info->space[space].databytes != 0)
{
- case 1: debug_write_byte(space, address, data, TRUE); break;
- case 2: debug_write_word(space, address, data, TRUE); break;
- case 4: debug_write_dword(space, address, data, TRUE); break;
- case 8: debug_write_qword(space, address, data, TRUE); break;
+ /* adjust the address into a byte address */
+ address = ADDR2BYTE(address, info, space);
+
+ /* switch contexts and do the write */
+ cpu_push_context(Machine->cpu[cpuindex]);
+ switch (size)
+ {
+ case 1: debug_write_byte(space, address, data, TRUE); break;
+ case 2: debug_write_word(space, address, data, TRUE); break;
+ case 4: debug_write_dword(space, address, data, TRUE); break;
+ case 8: debug_write_qword(space, address, data, TRUE); break;
+ }
+ cpu_pop_context();
}
- cpu_pop_context();
}
}
@@ -2470,60 +2454,63 @@ static void expression_write_address_space(int cpuindex, int space, offs_t addre
static void expression_write_program_direct(int cpuindex, int opcode, offs_t address, int size, UINT64 data)
{
- const debug_cpu_info *info = &global.cpuinfo[cpuindex];
- UINT8 *base;
-
- /* only process if in of range and we have a bus */
- if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[ADDRESS_SPACE_PROGRAM].databytes != 0)
+ if (cpuindex >= 0 && cpuindex < ARRAY_LENGTH(Machine->cpu) && Machine->cpu[cpuindex] != NULL)
{
- /* adjust the address into a byte address, but not if being called recursively */
- if ((opcode & 2) == 0)
- address = ADDR2BYTE(address, info, ADDRESS_SPACE_PROGRAM);
+ const cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpuindex]);
+ UINT8 *base;
- /* call ourself recursively until we are byte-sized */
- if (size > 1)
+ /* only process if in of range and we have a bus */
+ if (info->space[ADDRESS_SPACE_PROGRAM].databytes != 0)
{
- int halfsize = size / 2;
- UINT64 r0, r1, halfmask;
+ /* adjust the address into a byte address, but not if being called recursively */
+ if ((opcode & 2) == 0)
+ address = ADDR2BYTE(address, info, ADDRESS_SPACE_PROGRAM);
- /* break apart based on the target endianness */
- halfmask = ~(UINT64)0 >> (64 - 8 * halfsize);
- if (info->endianness == CPU_IS_LE)
- {
- r0 = data & halfmask;
- r1 = (data >> (8 * halfsize)) & halfmask;
- }
- else
+ /* call ourself recursively until we are byte-sized */
+ if (size > 1)
{
- r0 = (data >> (8 * halfsize)) & halfmask;
- r1 = data & halfmask;
- }
+ int halfsize = size / 2;
+ UINT64 r0, r1, halfmask;
- /* write each half, from lower address to upper address */
- expression_write_program_direct(cpuindex, opcode | 2, address + 0, halfsize, r0);
- expression_write_program_direct(cpuindex, opcode | 2, address + halfsize, halfsize, r1);
- }
+ /* break apart based on the target endianness */
+ halfmask = ~(UINT64)0 >> (64 - 8 * halfsize);
+ if (info->endianness == CPU_IS_LE)
+ {
+ r0 = data & halfmask;
+ r1 = (data >> (8 * halfsize)) & halfmask;
+ }
+ else
+ {
+ r0 = (data >> (8 * halfsize)) & halfmask;
+ r1 = data & halfmask;
+ }
- /* handle the byte-sized final case */
- else
- {
- /* lowmask specified which address bits are within the databus width */
- offs_t lowmask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1;
+ /* write each half, from lower address to upper address */
+ expression_write_program_direct(cpuindex, opcode | 2, address + 0, halfsize, r0);
+ expression_write_program_direct(cpuindex, opcode | 2, address + halfsize, halfsize, r1);
+ }
- /* get the base of memory, aligned to the address minus the lowbits */
- if (opcode & 1)
- base = memory_get_op_ptr(Machine, cpuindex, address & ~lowmask, FALSE);
+ /* handle the byte-sized final case */
else
- base = memory_get_read_ptr(cpuindex, ADDRESS_SPACE_PROGRAM, address & ~lowmask);
-
- /* if we have a valid base, write the appropriate byte */
- if (base != NULL)
{
- if (info->endianness == CPU_IS_LE)
- base[BYTE8_XOR_LE(address) & lowmask] = data;
+ /* lowmask specified which address bits are within the databus width */
+ offs_t lowmask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1;
+
+ /* get the base of memory, aligned to the address minus the lowbits */
+ if (opcode & 1)
+ base = memory_decrypted_read_ptr(cpu_get_address_space(Machine->cpu[cpuindex], ADDRESS_SPACE_PROGRAM), address & ~lowmask);
else
- base[BYTE8_XOR_BE(address) & lowmask] = data;
- global.memory_modified = TRUE;
+ base = memory_get_read_ptr(cpu_get_address_space(Machine->cpu[cpuindex], ADDRESS_SPACE_PROGRAM), address & ~lowmask);
+
+ /* if we have a valid base, write the appropriate byte */
+ if (base != NULL)
+ {
+ if (info->endianness == CPU_IS_LE)
+ base[BYTE8_XOR_LE(address) & lowmask] = data;
+ else
+ base[BYTE8_XOR_BE(address) & lowmask] = data;
+ global.memory_modified = TRUE;
+ }
}
}
}
@@ -2679,7 +2666,7 @@ void debug_cpu_trace_printf(int cpunum, const char *fmt, ...)
{
va_list va;
- debug_cpu_info *info = &global.cpuinfo[cpunum];
+ cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpunum]);
if (info->trace.file)
{
@@ -2730,8 +2717,9 @@ void debug_cpu_flush_traces(void)
for (cpunum = 0; cpunum < ARRAY_LENGTH(Machine->cpu); cpunum++)
if (Machine->cpu[cpunum] != NULL)
{
- if (global.cpuinfo[cpunum].trace.file)
- fflush(global.cpuinfo[cpunum].trace.file);
+ cpu_debug_data *info = cpu_get_debug_data(Machine->cpu[cpunum]);
+ if (info->trace.file != NULL)
+ fflush(info->trace.file);
}
}
@@ -2814,7 +2802,8 @@ static void set_tempvar(void *ref, UINT64 value)
static UINT64 get_logunmap(void *ref)
{
- return memory_get_log_unmap((FPTR)ref);
+ const address_space *space = cpu_get_address_space(Machine->activecpu, (FPTR)ref);
+ return (space != NULL) ? memory_get_log_unmap(space) : TRUE;
}
@@ -2873,7 +2862,9 @@ static UINT64 get_frame(void *ref)
static void set_logunmap(void *ref, UINT64 value)
{
- memory_set_log_unmap((FPTR)ref, value ? 1 : 0);
+ const address_space *space = cpu_get_address_space(Machine->activecpu, (FPTR)ref);
+ if (space != NULL)
+ memory_set_log_unmap(space, value ? 1 : 0);
}
diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h
index b32d478921e..6d784d3b82d 100644
--- a/src/emu/debug/debugcpu.h
+++ b/src/emu/debug/debugcpu.h
@@ -44,12 +44,6 @@
#define DEBUG_FLAG_STOP_VBLANK 0x00001000 /* there is a pending stop on the next VBLANK */
#define DEBUG_FLAG_STOP_TIME 0x00002000 /* there is a pending stop at cpu->stoptime */
#define DEBUG_FLAG_LIVE_BP 0x00010000 /* there are live breakpoints for this CPU */
-#define DEBUG_FLAG_LIVE_WPR_PROGRAM 0x01000000 /* there are live read watchpoints in program address space */
-#define DEBUG_FLAG_LIVE_WPR_DATA 0x02000000 /* there are live read watchpoints in data address space */
-#define DEBUG_FLAG_LIVE_WPR_IO 0x04000000 /* there are live read watchpoints in io address space */
-#define DEBUG_FLAG_LIVE_WPW_PROGRAM 0x10000000 /* there are live write watchpoints in program address space */
-#define DEBUG_FLAG_LIVE_WPW_DATA 0x20000000 /* there are live write watchpoints in data address space */
-#define DEBUG_FLAG_LIVE_WPW_IO 0x40000000 /* there are live write watchpoints in io address space */
#define DEBUG_FLAG_STEPPING_ANY (DEBUG_FLAG_STEPPING | \
DEBUG_FLAG_STEPPING_OVER | \
@@ -66,17 +60,6 @@
DEBUG_FLAG_STOP_VBLANK | \
DEBUG_FLAG_STOP_TIME)
-#define DEBUG_FLAG_READ_WATCHPOINT (DEBUG_FLAG_LIVE_WPR_PROGRAM | \
- DEBUG_FLAG_LIVE_WPR_DATA | \
- DEBUG_FLAG_LIVE_WPR_IO)
-
-#define DEBUG_FLAG_WRITE_WATCHPOINT (DEBUG_FLAG_LIVE_WPW_PROGRAM | \
- DEBUG_FLAG_LIVE_WPW_DATA | \
- DEBUG_FLAG_LIVE_WPW_IO)
-
-#define DEBUG_FLAG_WATCHPOINT (DEBUG_FLAG_READ_WATCHPOINT | \
- DEBUG_FLAG_WRITE_WATCHPOINT)
-
/***************************************************************************
@@ -142,8 +125,8 @@ struct _debug_hotspot_entry
};
-typedef struct _debug_cpu_info debug_cpu_info;
-struct _debug_cpu_info
+/* In cpuintrf.h: typedef struct _cpu_debug_data cpu_debug_data; */
+struct _cpu_debug_data
{
UINT8 valid; /* are we valid? */
UINT8 endianness; /* little or bigendian */
@@ -237,17 +220,16 @@ void debug_cpu_exception_hook(running_machine *machine, int cpunum, int exceptio
void debug_cpu_instruction_hook(running_machine *machine, offs_t curpc);
/* the memory system calls this hook when watchpoints are enabled and a memory read happens */
-void debug_cpu_memory_read_hook(running_machine *machine, int cpunum, int spacenum, offs_t address, UINT64 mem_mask);
+void debug_cpu_memory_read_hook(const address_space *space, offs_t address, UINT64 mem_mask);
/* the memory system calls this hook when watchpoints are enabled and a memory write happens */
-void debug_cpu_memory_write_hook(running_machine *machine, int cpunum, int spacenum, offs_t address, UINT64 data, UINT64 mem_mask);
+void debug_cpu_memory_write_hook(const address_space *space, offs_t address, UINT64 data, UINT64 mem_mask);
/* ----- core debugger functions ----- */
int debug_cpu_within_instruction_hook(running_machine *machine);
-const debug_cpu_info *debug_get_cpu_info(int cpunum);
void debug_cpu_halt_on_next_instruction(running_machine *machine, int cpunum, const char *fmt, ...) ATTR_PRINTF(3,4);
int debug_cpu_is_stopped(running_machine *machine);
void debug_cpu_trace_printf(int cpunum, const char *fmt, ...) ATTR_PRINTF(2,3);
@@ -267,7 +249,7 @@ void debug_cpu_go_vblank(void);
void debug_cpu_go_interrupt(int irqline);
void debug_cpu_go_milliseconds(UINT64 milliseconds);
void debug_cpu_next_cpu(void);
-void debug_cpu_ignore_cpu(int cpunum, int ignore);
+void debug_cpu_ignore_cpu(const device_config *cpu, int ignore);
/* tracing support */
void debug_cpu_trace(int cpunum, FILE *file, int trace_over, const char *action);
diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c
index 796a4565268..bb592497da0 100644
--- a/src/emu/debug/debugvw.c
+++ b/src/emu/debug/debugvw.c
@@ -1323,7 +1323,7 @@ static void disasm_free(debug_view *view)
of instructions from the given PC
-------------------------------------------------*/
-static offs_t disasm_back_up(int cpunum, const debug_cpu_info *cpuinfo, offs_t startpc, int numinstrs)
+static offs_t disasm_back_up(int cpunum, const cpu_debug_data *cpuinfo, offs_t startpc, int numinstrs)
{
int minlen = BYTE2ADDR(cpu_get_min_opcode_bytes(Machine->activecpu), cpuinfo, ADDRESS_SPACE_PROGRAM);
int maxlen = BYTE2ADDR(cpu_get_max_opcode_bytes(Machine->activecpu), cpuinfo, ADDRESS_SPACE_PROGRAM);
@@ -1405,7 +1405,7 @@ static offs_t disasm_back_up(int cpunum, const debug_cpu_info *cpuinfo, offs_t s
byte values
-------------------------------------------------*/
-static void disasm_generate_bytes(offs_t pcbyte, int numbytes, const debug_cpu_info *cpuinfo, int minbytes, char *string, int maxchars, int encrypted)
+static void disasm_generate_bytes(offs_t pcbyte, int numbytes, const cpu_debug_data *cpuinfo, int minbytes, char *string, int maxchars, int encrypted)
{
int byte, offset = 0;
UINT64 val;
@@ -1464,7 +1464,7 @@ static void disasm_generate_bytes(offs_t pcbyte, int numbytes, const debug_cpu_i
static int disasm_recompute(debug_view *view, offs_t pc, int startline, int lines, int original_cpunum)
{
debug_view_disasm *dasmdata = view->extra_data;
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(dasmdata->cpunum);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(Machine->cpu[dasmdata->cpunum]);
const address_space *space = cpu_get_address_space(cpuinfo->device, ADDRESS_SPACE_PROGRAM);
int chunksize, minbytes, maxbytes, maxbytes_clamped;
int changed = FALSE;
@@ -1617,7 +1617,7 @@ static int disasm_recompute(debug_view *view, offs_t pc, int startline, int line
static void disasm_update(debug_view *view)
{
debug_view_disasm *dasmdata = view->extra_data;
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(dasmdata->cpunum);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(Machine->cpu[dasmdata->cpunum]);
const address_space *space = cpu_get_address_space(cpuinfo->device, ADDRESS_SPACE_PROGRAM);
offs_t pc = cpu_get_reg(Machine->cpu[dasmdata->cpunum], REG_PC);
offs_t pcbyte = ADDR2BYTE_MASKED(pc, cpuinfo, ADDRESS_SPACE_PROGRAM);
@@ -1636,7 +1636,7 @@ static void disasm_update(debug_view *view)
parsed_expression *expr;
/* parse the new expression */
- exprerr = expression_parse(dasmdata->expression_string, debug_get_cpu_info(dasmdata->cpunum)->symtable, &debug_expression_callbacks, &expr);
+ exprerr = expression_parse(dasmdata->expression_string, cpu_get_debug_data(Machine->cpu[dasmdata->cpunum])->symtable, &debug_expression_callbacks, &expr);
/* if it worked, update the expression */
if (exprerr == EXPRERR_NONE)
@@ -1851,7 +1851,7 @@ static void disasm_handle_char(debug_view *view, char chval)
case DCH_HOME: /* set the active column to the PC */
{
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(dasmdata->cpunum);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(Machine->cpu[dasmdata->cpunum]);
offs_t pc = cpu_get_reg(Machine->cpu[dasmdata->cpunum], REG_PC);
int i;
@@ -2479,7 +2479,7 @@ static void generic_write_qword(debug_view_memory *memdata, offs_t offs, UINT64
static void memory_handle_char(debug_view *view, char chval)
{
debug_view_memory *memdata = view->extra_data;
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(memdata->cpunum);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(Machine->cpu[memdata->cpunum]);
static const char hexvals[] = "0123456789abcdef";
char *hexchar = strchr(hexvals, tolower(chval));
UINT32 bytes_per_row;
@@ -2638,7 +2638,7 @@ static void memory_handle_char(debug_view *view, char chval)
static void memory_update(debug_view *view)
{
debug_view_memory *memdata = view->extra_data;
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(memdata->cpunum);
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(Machine->cpu[memdata->cpunum]);
debug_view_char *dest = view->viewdata;
char addrformat[16];
EXPRERR exprerr;
@@ -2707,7 +2707,7 @@ static void memory_update(debug_view *view)
parsed_expression *expr;
/* parse the new expression */
- exprerr = expression_parse(memdata->expression_string, debug_get_cpu_info(memdata->cpunum)->symtable, &debug_expression_callbacks, &expr);
+ exprerr = expression_parse(memdata->expression_string, cpu_get_debug_data(Machine->cpu[memdata->cpunum])->symtable, &debug_expression_callbacks, &expr);
/* if it worked, update the expression */
if (exprerr == EXPRERR_NONE)
diff --git a/src/emu/debugger.h b/src/emu/debugger.h
index 53205067336..8f7e32cfffe 100644
--- a/src/emu/debugger.h
+++ b/src/emu/debugger.h
@@ -33,7 +33,7 @@ void debugger_refresh_display(running_machine *machine);
/***************************************************************************
- INLINE FUNCTIONS
+ CPU CORE INLINE FUNCTIONS
***************************************************************************/
/*-------------------------------------------------
@@ -49,6 +49,23 @@ INLINE void debugger_instruction_hook(running_machine *machine, offs_t curpc)
/*-------------------------------------------------
+ debugger_exception_hook - CPU cores call this
+ anytime an exception is generated
+-------------------------------------------------*/
+
+INLINE void debugger_exception_hook(running_machine *machine, int cpunum, int exception)
+{
+ if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ debug_cpu_exception_hook(machine, cpunum, exception);
+}
+
+
+
+/***************************************************************************
+ CPU EXECUTION SYSTEM INLINE FUNCTIONS
+***************************************************************************/
+
+/*-------------------------------------------------
debugger_start_cpu_hook - the CPU execution
system calls this hook before beginning
execution for the given CPU
@@ -75,6 +92,24 @@ INLINE void debugger_stop_cpu_hook(running_machine *machine, int cpunum)
/*-------------------------------------------------
+ debugger_interrupt_hook - the CPU execution
+ system calls this hook when an interrupt is
+ acknowledged
+-------------------------------------------------*/
+
+INLINE void debugger_interrupt_hook(running_machine *machine, int cpunum, int irqline)
+{
+ if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ debug_cpu_interrupt_hook(machine, cpunum, irqline);
+}
+
+
+
+/***************************************************************************
+ GENERAL INLINE FUNCTIONS
+***************************************************************************/
+
+/*-------------------------------------------------
debugger_break - stop in the debugger at the
next opportunity
-------------------------------------------------*/
diff --git a/src/emu/mame.h b/src/emu/mame.h
index 185ea3acea4..034d35e03f0 100644
--- a/src/emu/mame.h
+++ b/src/emu/mame.h
@@ -126,6 +126,7 @@ typedef void (*output_callback_func)(void *param, const char *format, va_list ar
/* forward type declarations */
typedef struct _mame_private mame_private;
+typedef struct _memory_private memory_private;
typedef struct _palette_private palette_private;
typedef struct _streams_private streams_private;
typedef struct _devices_private devices_private;
@@ -168,6 +169,7 @@ struct _running_machine
/* internal core information */
mame_private * mame_data; /* internal data from mame.c */
+ memory_private * memory_data; /* internal data from memory.c */
palette_private * palette_data; /* internal data from palette.c */
streams_private * streams_data; /* internal data from streams.c */
devices_private * devices_data; /* internal data from devices.c */
diff --git a/src/emu/memory.c b/src/emu/memory.c
index 06103626a40..162fa01ab03 100644
--- a/src/emu/memory.c
+++ b/src/emu/memory.c
@@ -54,7 +54,6 @@
- Automatically mirror program space into data space if no data space
- Get rid of opcode/data separation by using address spaces?
- Add support for internal addressing (maybe just accessors - see TMS3202x)
- - Evaluate min/max opcode ranges and do we include a check in program_decrypted_read_byte?
****************************************************************************
@@ -161,6 +160,7 @@ enum _read_or_write
typedef enum _read_or_write read_or_write;
+
/***************************************************************************
MACROS
***************************************************************************/
@@ -198,8 +198,7 @@ typedef struct _memory_block memory_block;
struct _memory_block
{
memory_block * next; /* next memory block in the list */
- UINT8 cpunum; /* which CPU are we associated with? */
- UINT8 spacenum; /* which address space are we associated with? */
+ const address_space * space; /* which address space are we associated with? */
UINT8 isallocated; /* did we allocate this ourselves? */
offs_t bytestart, byteend; /* byte-normalized start/end for verifying a match */
UINT8 * data; /* pointer to the data for this block */
@@ -210,8 +209,7 @@ struct _bank_data
{
UINT8 used; /* is this bank used? */
UINT8 dynamic; /* is this bank allocated dynamically? */
- UINT8 cpunum; /* the CPU it is used for */
- UINT8 spacenum; /* the address space it is used for */
+ const address_space * space; /* address space it is used for */
UINT8 read; /* is this bank used for reads? */
UINT8 write; /* is this bank used for writes? */
offs_t bytestart; /* byte-adjusted start offset */
@@ -234,6 +232,7 @@ struct _handler_data
offs_t bytestart; /* byte-adjusted start address for handler */
offs_t byteend; /* byte-adjusted end address for handler */
offs_t bytemask; /* byte-adjusted mask against the final address */
+ UINT8 ** bankbaseptr; /* pointer to the bank base */
};
/* In memory.h: typedef struct _subtable_data subtable_data; */
@@ -244,15 +243,21 @@ struct _subtable_data
UINT32 usecount; /* number of times this has been used */
};
-typedef struct _cpu_data cpu_data;
-struct _cpu_data
+struct _memory_private
{
- const char * tag; /* CPU's tag */
- UINT8 * region; /* pointer to memory region */
- size_t regionsize; /* size of region, in bytes */
+ const address_space * spacelist; /* list of address spaces */
+
+ UINT8 * bank_ptr[STATIC_COUNT]; /* array of bank pointers */
+ UINT8 * bankd_ptr[STATIC_COUNT]; /* array of decrypted bank pointers */
+ void * shared_ptr[MAX_SHARED_POINTERS];/* array of shared pointers */
+
+ memory_block * memory_block_list; /* head of the list of memory blocks */
+
+ int cur_context; /* current CPU context */
+
+ bank_info bankdata[STATIC_COUNT]; /* data gathered for each bank */
- UINT8 spacemask; /* mask of which address spaces are used */
- address_space space[ADDRESS_SPACES]; /* info about each address space */
+ UINT8 * wptable; /* watchpoint-fill table */
};
@@ -261,70 +266,32 @@ struct _cpu_data
GLOBAL VARIABLES
***************************************************************************/
-address_space * active_address_space[ADDRESS_SPACES];/* address space data */
-
-static UINT8 * bank_ptr[STATIC_COUNT]; /* array of bank pointers */
-static UINT8 * bankd_ptr[STATIC_COUNT]; /* array of decrypted bank pointers */
-static void * shared_ptr[MAX_SHARED_POINTERS];/* array of shared pointers */
-
-static memory_block * memory_block_list; /* head of the list of memory blocks */
-
-static int cur_context; /* current CPU context */
-
-static UINT8 debugger_access; /* treat accesses as coming from the debugger */
-static UINT8 log_unmap[ADDRESS_SPACES]; /* log unmapped memory accesses */
+const address_space * active_address_space[ADDRESS_SPACES];/* address space data */
-static cpu_data cpudata[MAX_CPU]; /* data gathered for each CPU */
-static bank_info bankdata[STATIC_COUNT]; /* data gathered for each bank */
-
-static UINT8 * wptable; /* watchpoint-fill table */
-
-static void dummy_change_pc(offs_t byteaddress) { }
-
-#define ACCESSOR_GROUP(type, width) \
+#define ACCESSOR_GROUP(width) \
{ \
- dummy_change_pc, \
- type##_read_byte_##width, \
- type##_read_word_##width, \
- type##_read_word_masked_##width, \
- type##_read_dword_##width, \
- type##_read_dword_masked_##width, \
- type##_read_qword_##width, \
- type##_read_qword_masked_##width, \
- type##_write_byte_##width, \
- type##_write_word_##width, \
- type##_write_word_masked_##width, \
- type##_write_dword_##width, \
- type##_write_dword_masked_##width, \
- type##_write_qword_##width, \
- type##_write_qword_masked_##width \
-}
-
-static const data_accessors memory_accessors[ADDRESS_SPACES][4][2] =
-{
- /* program accessors */
- {
- { ACCESSOR_GROUP(program, 8le), ACCESSOR_GROUP(program, 8be) },
- { ACCESSOR_GROUP(program, 16le), ACCESSOR_GROUP(program, 16be) },
- { ACCESSOR_GROUP(program, 32le), ACCESSOR_GROUP(program, 32be) },
- { ACCESSOR_GROUP(program, 64le), ACCESSOR_GROUP(program, 64be) }
- },
-
- /* data accessors */
- {
- { ACCESSOR_GROUP(data, 8le), ACCESSOR_GROUP(data, 8be) },
- { ACCESSOR_GROUP(data, 16le), ACCESSOR_GROUP(data, 16be) },
- { ACCESSOR_GROUP(data, 32le), ACCESSOR_GROUP(data, 32be) },
- { ACCESSOR_GROUP(data, 64le), ACCESSOR_GROUP(data, 64be) }
- },
-
- /* I/O accessors */
- {
- { ACCESSOR_GROUP(io, 8le), ACCESSOR_GROUP(io, 8be) },
- { ACCESSOR_GROUP(io, 16le), ACCESSOR_GROUP(io, 16be) },
- { ACCESSOR_GROUP(io, 32le), ACCESSOR_GROUP(io, 32be) },
- { ACCESSOR_GROUP(io, 64le), ACCESSOR_GROUP(io, 64be) }
- },
+ memory_read_byte_##width, \
+ memory_read_word_##width, \
+ memory_read_word_masked_##width, \
+ memory_read_dword_##width, \
+ memory_read_dword_masked_##width, \
+ memory_read_qword_##width, \
+ memory_read_qword_masked_##width, \
+ memory_write_byte_##width, \
+ memory_write_word_##width, \
+ memory_write_word_masked_##width, \
+ memory_write_dword_##width, \
+ memory_write_dword_masked_##width, \
+ memory_write_qword_##width, \
+ memory_write_qword_masked_##width \
+}
+
+static const data_accessors memory_accessors[4][2] =
+{
+ { ACCESSOR_GROUP(8le), ACCESSOR_GROUP(8be) },
+ { ACCESSOR_GROUP(16le), ACCESSOR_GROUP(16be) },
+ { ACCESSOR_GROUP(32le), ACCESSOR_GROUP(32be) },
+ { ACCESSOR_GROUP(64le), ACCESSOR_GROUP(64be) }
};
const char *const address_space_names[ADDRESS_SPACES] = { "program", "data", "I/O" };
@@ -335,34 +302,53 @@ const char *const address_space_names[ADDRESS_SPACES] = { "program", "data", "I/
FUNCTION PROTOTYPES
***************************************************************************/
-static void address_map_detokenize(address_map *map, const game_driver *driver, const char *cputag, const addrmap_token *tokens);
-
-static void memory_init_cpudata(running_machine *machine);
+/* internal initialization */
+static void memory_init_spaces(running_machine *machine);
static void memory_init_preflight(running_machine *machine);
static void memory_init_populate(running_machine *machine);
+static void memory_init_allocate(running_machine *machine);
+static void memory_init_locate(running_machine *machine);
+static void memory_exit(running_machine *machine);
+
+/* address map helpers */
+static void map_detokenize(address_map *map, const game_driver *driver, const char *cputag, const addrmap_token *tokens);
+
+/* memory mapping helpers */
static void space_map_range_private(address_space *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name);
static void space_map_range(address_space *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name);
-static void bank_assign_static(int banknum, int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend);
-static genf *bank_assign_dynamic(int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend);
-static UINT8 table_assign_handler(handler_data **table, void *object, genf *handler, const char *handler_name, offs_t bytestart, offs_t byteend, offs_t bytemask);
+static void *space_find_backing_memory(const address_space *space, offs_t byteaddress);
+static int space_needs_backing_store(const address_space *space, const address_map_entry *entry);
+
+/* banking helpers */
+static void bank_assign_static(int banknum, const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend);
+static genf *bank_assign_dynamic(const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend);
+static STATE_POSTLOAD( bank_reattach );
+
+/* table management */
+static UINT8 table_assign_handler(const address_space *space, handler_data **table, void *object, genf *handler, const char *handler_name, offs_t bytestart, offs_t byteend, offs_t bytemask);
static void table_compute_subhandler(handler_data **table, UINT8 entry, read_or_write readorwrite, int spacebits, int spaceendian, int handlerbits, int handlerunitmask);
static void table_populate_range(address_table *tabledata, offs_t bytestart, offs_t byteend, UINT8 handler);
static void table_populate_range_mirrored(address_table *tabledata, offs_t bytestart, offs_t byteend, offs_t bytemirror, UINT8 handler);
+
+/* subtable management */
static UINT8 subtable_alloc(address_table *tabledata);
static void subtable_realloc(address_table *tabledata, UINT8 subentry);
static int subtable_merge(address_table *tabledata);
static void subtable_release(address_table *tabledata, UINT8 subentry);
static UINT8 *subtable_open(address_table *tabledata, offs_t l1index);
static void subtable_close(address_table *tabledata, offs_t l1index);
-static void memory_init_allocate(running_machine *machine);
-static void *allocate_memory_block(running_machine *machine, int cpunum, int spacenum, offs_t bytestart, offs_t byteend, void *memory);
-static void register_for_save(int cpunum, int spacenum, offs_t bytestart, void *base, size_t numbytes);
-static address_map_entry *assign_intersecting_blocks(address_space *space, offs_t bytestart, offs_t byteend, UINT8 *base);
-static void memory_init_locate(running_machine *machine);
-static void *memory_find_base(int cpunum, int spacenum, offs_t byteaddress);
+
+/* memory block allocation */
+static void *block_allocate(const address_space *space, offs_t bytestart, offs_t byteend, void *memory);
+static address_map_entry *block_assign_intersecting(address_space *space, offs_t bytestart, offs_t byteend, UINT8 *base);
+
+/* internal handlers */
static memory_handler get_stub_handler(read_or_write readorwrite, int spacedbits, int handlerdbits);
static genf *get_static_handler(int handlerbits, int readorwrite, int which);
-static void memory_exit(running_machine *machine);
+
+/* debugging */
+static const char *handler_to_string(const address_table *table, UINT8 entry);
+static void dump_map(FILE *file, const address_space *space, const address_table *table);
static void mem_dump(void);
@@ -411,26 +397,26 @@ INLINE void adjust_addresses(address_space *space, offs_t *start, offs_t *end, o
arbitrary address space
-------------------------------------------------*/
-INLINE UINT8 read_byte_generic(const address_space *space, offs_t address)
+INLINE UINT8 read_byte_generic(const address_space *space, offs_t byteaddress)
{
const handler_data *handler;
- offs_t offset;
+ offs_t byteoffset;
UINT32 entry;
UINT8 result;
profiler_mark(PROFILER_MEMREAD);
- address &= space->bytemask;
- entry = space->readlookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->readlookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->readlookup[LEVEL2_INDEX(entry, address)];
+ entry = space->readlookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->read.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
- result = bank_ptr[entry][offset];
+ result = (*handler->bankbaseptr)[byteoffset];
else
- result = (*handler->handler.read.shandler8)(handler->object, offset);
+ result = (*handler->handler.read.shandler8)(handler->object, byteoffset);
profiler_mark(PROFILER_END);
return result;
@@ -442,25 +428,25 @@ INLINE UINT8 read_byte_generic(const address_space *space, offs_t address)
arbitrary address space
-------------------------------------------------*/
-INLINE void write_byte_generic(const address_space *space, offs_t address, UINT8 data)
+INLINE void write_byte_generic(const address_space *space, offs_t byteaddress, UINT8 data)
{
const handler_data *handler;
- offs_t offset;
+ offs_t byteoffset;
UINT32 entry;
profiler_mark(PROFILER_MEMWRITE);
- address &= space->bytemask;
- entry = space->writelookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->writelookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->writelookup[LEVEL2_INDEX(entry, address)];
+ entry = space->writelookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->write.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
- bank_ptr[entry][offset] = data;
+ (*handler->bankbaseptr)[byteoffset] = data;
else
- (*handler->handler.write.shandler8)(handler->object, offset, data);
+ (*handler->handler.write.shandler8)(handler->object, byteoffset, data);
profiler_mark(PROFILER_END);
}
@@ -471,26 +457,26 @@ INLINE void write_byte_generic(const address_space *space, offs_t address, UINT8
arbitrary address space
-------------------------------------------------*/
-INLINE UINT16 read_word_generic(const address_space *space, offs_t address, UINT16 mem_mask)
+INLINE UINT16 read_word_generic(const address_space *space, offs_t byteaddress, UINT16 mem_mask)
{
const handler_data *handler;
- offs_t offset;
+ offs_t byteoffset;
UINT32 entry;
UINT16 result;
profiler_mark(PROFILER_MEMREAD);
- address &= space->bytemask;
- entry = space->readlookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->readlookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->readlookup[LEVEL2_INDEX(entry, address)];
+ entry = space->readlookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->read.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
- result = *(UINT16 *)&bank_ptr[entry][offset & ~1];
+ result = *(UINT16 *)&(*handler->bankbaseptr)[byteoffset & ~1];
else
- result = (*handler->handler.read.shandler16)(handler->object, offset >> 1, mem_mask);
+ result = (*handler->handler.read.shandler16)(handler->object, byteoffset >> 1, mem_mask);
profiler_mark(PROFILER_END);
return result;
@@ -502,28 +488,28 @@ INLINE UINT16 read_word_generic(const address_space *space, offs_t address, UINT
arbitrary address space
-------------------------------------------------*/
-INLINE void write_word_generic(const address_space *space, offs_t address, UINT16 data, UINT16 mem_mask)
+INLINE void write_word_generic(const address_space *space, offs_t byteaddress, UINT16 data, UINT16 mem_mask)
{
const handler_data *handler;
- offs_t offset;
+ offs_t byteoffset;
UINT32 entry;
profiler_mark(PROFILER_MEMWRITE);
- address &= space->bytemask;
- entry = space->writelookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->writelookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->writelookup[LEVEL2_INDEX(entry, address)];
+ entry = space->writelookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->write.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
{
- UINT16 *dest = (UINT16 *)&bank_ptr[entry][offset & ~1];
+ UINT16 *dest = (UINT16 *)&(*handler->bankbaseptr)[byteoffset & ~1];
*dest = (*dest & ~mem_mask) | (data & mem_mask);
}
else
- (*handler->handler.write.shandler16)(handler->object, offset >> 1, data, mem_mask);
+ (*handler->handler.write.shandler16)(handler->object, byteoffset >> 1, data, mem_mask);
profiler_mark(PROFILER_END);
}
@@ -534,26 +520,26 @@ INLINE void write_word_generic(const address_space *space, offs_t address, UINT1
arbitrary address space
-------------------------------------------------*/
-INLINE UINT32 read_dword_generic(const address_space *space, offs_t address, UINT32 mem_mask)
+INLINE UINT32 read_dword_generic(const address_space *space, offs_t byteaddress, UINT32 mem_mask)
{
const handler_data *handler;
- offs_t offset;
+ offs_t byteoffset;
UINT32 entry;
UINT32 result;
profiler_mark(PROFILER_MEMREAD);
- address &= space->bytemask;
- entry = space->readlookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->readlookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->readlookup[LEVEL2_INDEX(entry, address)];
+ entry = space->readlookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->read.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
- result = *(UINT32 *)&bank_ptr[entry][offset & ~3];
+ result = *(UINT32 *)&(*handler->bankbaseptr)[byteoffset & ~3];
else
- result = (*handler->handler.read.shandler32)(handler->object, offset >> 2, mem_mask);
+ result = (*handler->handler.read.shandler32)(handler->object, byteoffset >> 2, mem_mask);
profiler_mark(PROFILER_END);
return result;
@@ -565,28 +551,28 @@ INLINE UINT32 read_dword_generic(const address_space *space, offs_t address, UIN
arbitrary address space
-------------------------------------------------*/
-INLINE void write_dword_generic(const address_space *space, offs_t address, UINT32 data, UINT32 mem_mask)
+INLINE void write_dword_generic(const address_space *space, offs_t byteaddress, UINT32 data, UINT32 mem_mask)
{
const handler_data *handler;
- offs_t offset;
+ offs_t byteoffset;
UINT32 entry;
profiler_mark(PROFILER_MEMWRITE);
- address &= space->bytemask;
- entry = space->writelookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->writelookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->writelookup[LEVEL2_INDEX(entry, address)];
+ entry = space->writelookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->write.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
{
- UINT32 *dest = (UINT32 *)&bank_ptr[entry][offset & ~3];
+ UINT32 *dest = (UINT32 *)&(*handler->bankbaseptr)[byteoffset & ~3];
*dest = (*dest & ~mem_mask) | (data & mem_mask);
}
else
- (*handler->handler.write.shandler32)(handler->object, offset >> 2, data, mem_mask);
+ (*handler->handler.write.shandler32)(handler->object, byteoffset >> 2, data, mem_mask);
profiler_mark(PROFILER_END);
}
@@ -597,26 +583,26 @@ INLINE void write_dword_generic(const address_space *space, offs_t address, UINT
arbitrary address space
-------------------------------------------------*/
-INLINE UINT64 read_qword_generic(const address_space *space, offs_t address, UINT64 mem_mask)
+INLINE UINT64 read_qword_generic(const address_space *space, offs_t byteaddress, UINT64 mem_mask)
{
const handler_data *handler;
- offs_t offset;
+ offs_t byteoffset;
UINT32 entry;
UINT64 result;
profiler_mark(PROFILER_MEMREAD);
- address &= space->bytemask;
- entry = space->readlookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->readlookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->readlookup[LEVEL2_INDEX(entry, address)];
+ entry = space->readlookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->read.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
- result = *(UINT64 *)&bank_ptr[entry][offset & ~7];
+ result = *(UINT64 *)&(*handler->bankbaseptr)[byteoffset & ~7];
else
- result = (*handler->handler.read.shandler64)(handler->object, offset >> 3, mem_mask);
+ result = (*handler->handler.read.shandler64)(handler->object, byteoffset >> 3, mem_mask);
profiler_mark(PROFILER_END);
return result;
@@ -628,7 +614,7 @@ INLINE UINT64 read_qword_generic(const address_space *space, offs_t address, UIN
arbitrary address space
-------------------------------------------------*/
-INLINE void write_qword_generic(const address_space *space, offs_t address, UINT64 data, UINT64 mem_mask)
+INLINE void write_qword_generic(const address_space *space, offs_t byteaddress, UINT64 data, UINT64 mem_mask)
{
const handler_data *handler;
offs_t offset;
@@ -636,16 +622,16 @@ INLINE void write_qword_generic(const address_space *space, offs_t address, UINT
profiler_mark(PROFILER_MEMWRITE);
- address &= space->bytemask;
- entry = space->writelookup[LEVEL1_INDEX(address)];
+ byteaddress &= space->bytemask;
+ entry = space->writelookup[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
- entry = space->writelookup[LEVEL2_INDEX(entry, address)];
+ entry = space->writelookup[LEVEL2_INDEX(entry, byteaddress)];
handler = space->write.handlers[entry];
- offset = (address - handler->bytestart) & handler->bytemask;
+ offset = (byteaddress - handler->bytestart) & handler->bytemask;
if (entry < STATIC_RAM)
{
- UINT64 *dest = (UINT64 *)&bank_ptr[entry][offset & ~7];
+ UINT64 *dest = (UINT64 *)&(*handler->bankbaseptr)[offset & ~7];
*dest = (*dest & ~mem_mask) | (data & mem_mask);
}
else
@@ -666,22 +652,24 @@ INLINE void write_qword_generic(const address_space *space, offs_t address, UINT
void memory_init(running_machine *machine)
{
- int spacenum;
+ memory_private *memdata;
add_exit_callback(machine, memory_exit);
+
+ /* allocate our private data */
+ machine->memory_data = auto_malloc(sizeof(*machine->memory_data));
+ memdata = machine->memory_data;
/* no current context to start */
- cur_context = -1;
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- log_unmap[spacenum] = TRUE;
+ memdata->cur_context = -1;
/* reset the shared pointers and bank pointers */
- memset(shared_ptr, 0, sizeof(shared_ptr));
- memset(bank_ptr, 0, sizeof(bank_ptr));
- memset(bankd_ptr, 0, sizeof(bankd_ptr));
+ memset(memdata->shared_ptr, 0, sizeof(memdata->shared_ptr));
+ memset(memdata->bank_ptr, 0, sizeof(memdata->bank_ptr));
+ memset(memdata->bankd_ptr, 0, sizeof(memdata->bankd_ptr));
/* build up the cpudata array with info about all CPUs and address spaces */
- memory_init_cpudata(machine);
+ memory_init_spaces(machine);
/* preflight the memory handlers and check banks */
memory_init_preflight(machine);
@@ -701,45 +689,20 @@ void memory_init(running_machine *machine)
/*-------------------------------------------------
- memory_exit - free memory
+ memory_find_address_space - find an address
+ space in our internal list; for faster access
+ use cpu_get_address_space()
-------------------------------------------------*/
-static void memory_exit(running_machine *machine)
+const address_space *memory_find_address_space(const device_config *cpu, int spacenum)
{
- int cpunum, spacenum;
-
- /* free the memory blocks */
- while (memory_block_list != NULL)
- {
- memory_block *block = memory_block_list;
- memory_block_list = block->next;
- free(block);
- }
-
- /* free all the tables */
- for (cpunum = 0; cpunum < ARRAY_LENGTH(cpudata); cpunum++)
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- {
- address_space *space = &cpudata[cpunum].space[spacenum];
- if (space->map != NULL)
- address_map_free(space->map);
- if (space->read.table != NULL)
- free(space->read.table);
- if (space->read.subtable != NULL)
- free(space->read.subtable);
- if (space->read.handlers[0] != NULL)
- free(space->read.handlers[0]);
- if (space->write.table != NULL)
- free(space->write.table);
- if (space->write.subtable != NULL)
- free(space->write.subtable);
- if (space->write.handlers[0] != NULL)
- free(space->write.handlers[0]);
- }
-
- /* free the global watchpoint table */
- if (wptable != NULL)
- free(wptable);
+ memory_private *memdata = cpu->machine->memory_data;
+ const address_space *space;
+
+ for (space = memdata->spacelist; space != NULL; space = space->next)
+ if (space->cpu == cpu && space->spacenum == spacenum)
+ return space;
+ return NULL;
}
@@ -749,34 +712,22 @@ static void memory_exit(running_machine *machine)
void memory_set_context(running_machine *machine, int activecpu)
{
+ memory_private *memdata = machine->memory_data;
+
/* remember dynamic RAM/ROM */
if (activecpu == -1)
- activecpu = cur_context;
- cur_context = activecpu;
+ activecpu = memdata->cur_context;
+ memdata->cur_context = activecpu;
- active_address_space[ADDRESS_SPACE_PROGRAM] = &cpudata[activecpu].space[ADDRESS_SPACE_PROGRAM];
- active_address_space[ADDRESS_SPACE_DATA] = &cpudata[activecpu].space[ADDRESS_SPACE_DATA];
- active_address_space[ADDRESS_SPACE_IO] = &cpudata[activecpu].space[ADDRESS_SPACE_IO];
+ active_address_space[ADDRESS_SPACE_PROGRAM] = cpu_get_address_space(machine->cpu[activecpu], ADDRESS_SPACE_PROGRAM);
+ active_address_space[ADDRESS_SPACE_DATA] = cpu_get_address_space(machine->cpu[activecpu], ADDRESS_SPACE_DATA);
+ active_address_space[ADDRESS_SPACE_IO] = cpu_get_address_space(machine->cpu[activecpu], ADDRESS_SPACE_IO);
// need to handle:
// active_address_space[ADDRESS_SPACE_PROGRAM].readlookup = ((machine->debug_flags & DEBUG_FLAG_WPR_PROGRAM) != 0) ? wptable : space->read.table;
}
-/*-------------------------------------------------
- memory_get_accessors - get a pointer to the
- set of memory accessor functions based on
- the address space, databus width, and
- endianness
--------------------------------------------------*/
-
-const data_accessors *memory_get_accessors(int spacenum, int databits, int endianness)
-{
- int accessorindex = (databits == 8) ? 0 : (databits == 16) ? 1 : (databits == 32) ? 2 : 3;
- return &memory_accessors[spacenum][accessorindex][(endianness == CPU_IS_LE) ? 0 : 1];
-}
-
-
/***************************************************************************
ADDRESS MAPS
@@ -799,13 +750,13 @@ address_map *address_map_alloc(const machine_config *config, const game_driver *
/* append the internal CPU map (first so it takes priority) */
if (internal_map != NULL)
- address_map_detokenize(map, driver, cputag, internal_map);
+ map_detokenize(map, driver, cputag, internal_map);
/* construct the standard map */
if (config->cpu[cpunum].address_map[spacenum][0] != NULL)
- address_map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][0]);
+ map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][0]);
if (config->cpu[cpunum].address_map[spacenum][1] != NULL)
- address_map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][1]);
+ map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][1]);
return map;
}
@@ -837,213 +788,9 @@ void address_map_free(address_map *map)
}
-/*-------------------------------------------------
- memory_get_address_map - return a pointer to
- the constructed address map for a CPU's
- address space
--------------------------------------------------*/
-
-const address_map *memory_get_address_map(int cpunum, int spacenum)
-{
- return cpudata[cpunum].space[spacenum].map;
-}
-
-
-/*-------------------------------------------------
- address_map_detokenize - detokenize an array
- of address map tokens
--------------------------------------------------*/
-
-#define check_map(field) do { \
- if (map->field != 0 && map->field != tmap.field) \
- fatalerror("%s: %s included a mismatched address map (%s %d) for an existing map with %s %d!\n", driver->source_file, driver->name, #field, tmap.field, #field, map->field); \
- } while (0)
-
-
-#define check_entry_handler(handler) do { \
- if (entry->handler.generic != NULL && entry->handler.generic != SMH_RAM) \
- fatalerror("%s: %s AM_RANGE(0x%x, 0x%x) %s handler already set!\n", driver->source_file, driver->name, entry->addrstart, entry->addrend, #handler); \
- } while (0)
-
-#define check_entry_field(field) do { \
- if (entry->field != 0) \
- fatalerror("%s: %s AM_RANGE(0x%x, 0x%x) setting %s already set!\n", driver->source_file, driver->name, entry->addrstart, entry->addrend, #field); \
- } while (0)
-
-static void address_map_detokenize(address_map *map, const game_driver *driver, const char *cputag, const addrmap_token *tokens)
-{
- address_map_entry **entryptr;
- address_map_entry *entry;
- address_map tmap = {0};
- UINT32 entrytype;
-
- /* check the first token */
- TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, tmap.spacenum, 8, tmap.databits, 8);
- if (entrytype != ADDRMAP_TOKEN_START)
- fatalerror("%s: %s Address map missing ADDRMAP_TOKEN_START!\n", driver->source_file, driver->name);
- if (tmap.spacenum >= ADDRESS_SPACES)
- fatalerror("%s: %s Invalid address space %d for memory map!\n", driver->source_file, driver->name, tmap.spacenum);
- if (tmap.databits != 8 && tmap.databits != 16 && tmap.databits != 32 && tmap.databits != 64)
- fatalerror("%s: %s Invalid data bits %d for memory map!\n", driver->source_file, driver->name, tmap.databits);
- check_map(spacenum);
- check_map(databits);
-
- /* fill in the map values */
- map->spacenum = tmap.spacenum;
- map->databits = tmap.databits;
-
- /* find the end of the list */
- for (entryptr = &map->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) ;
- entry = NULL;
-
- /* loop over tokens until we hit the end */
- while (entrytype != ADDRMAP_TOKEN_END)
- {
- /* unpack the token from the first entry */
- TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8);
- switch (entrytype)
- {
- /* end */
- case ADDRMAP_TOKEN_END:
- break;
-
- /* including */
- case ADDRMAP_TOKEN_INCLUDE:
- address_map_detokenize(map, driver, cputag, TOKEN_GET_PTR(tokens, tokenptr));
- for (entryptr = &map->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) ;
- entry = NULL;
- break;
-
- /* global flags */
- case ADDRMAP_TOKEN_GLOBAL_MASK:
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, tmap.globalmask, 32);
- check_map(globalmask);
- map->globalmask = tmap.globalmask;
- break;
-
- case ADDRMAP_TOKEN_UNMAP_VALUE:
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, tmap.unmapval, 1);
- check_map(unmapval);
- map->unmapval = tmap.unmapval;
- break;
-
- /* start a new range */
- case ADDRMAP_TOKEN_RANGE:
- entry = *entryptr = malloc_or_die(sizeof(**entryptr));
- entryptr = &entry->next;
- memset(entry, 0, sizeof(*entry));
- TOKEN_GET_UINT64_UNPACK2(tokens, entry->addrstart, 32, entry->addrend, 32);
- break;
-
- case ADDRMAP_TOKEN_MASK:
- check_entry_field(addrmask);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->addrmask, 32);
- break;
-
- case ADDRMAP_TOKEN_MIRROR:
- check_entry_field(addrmirror);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->addrmirror, 32);
- break;
-
- case ADDRMAP_TOKEN_READ:
- check_entry_handler(read);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->read_bits, 8, entry->read_mask, 8);
- entry->read = TOKEN_GET_PTR(tokens, read);
- entry->read_name = TOKEN_GET_STRING(tokens);
- break;
-
- case ADDRMAP_TOKEN_WRITE:
- check_entry_handler(write);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->write_bits, 8, entry->write_mask, 8);
- entry->write = TOKEN_GET_PTR(tokens, write);
- entry->write_name = TOKEN_GET_STRING(tokens);
- break;
-
- case ADDRMAP_TOKEN_DEVICE_READ:
- check_entry_handler(read);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->read_bits, 8, entry->read_mask, 8);
- entry->read = TOKEN_GET_PTR(tokens, read);
- entry->read_name = TOKEN_GET_STRING(tokens);
- entry->read_devtype = TOKEN_GET_PTR(tokens, devtype);
- if (entry->read_devtag_string == NULL)
- entry->read_devtag_string = astring_alloc();
- entry->read_devtag = device_inherit_tag(entry->read_devtag_string, cputag, TOKEN_GET_STRING(tokens));
- break;
-
- case ADDRMAP_TOKEN_DEVICE_WRITE:
- check_entry_handler(write);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->write_bits, 8, entry->write_mask, 8);
- entry->write = TOKEN_GET_PTR(tokens, write);
- entry->write_name = TOKEN_GET_STRING(tokens);
- entry->write_devtype = TOKEN_GET_PTR(tokens, devtype);
- if (entry->write_devtag_string == NULL)
- entry->write_devtag_string = astring_alloc();
- entry->write_devtag = device_inherit_tag(entry->write_devtag_string, cputag, TOKEN_GET_STRING(tokens));
- break;
-
- case ADDRMAP_TOKEN_READ_PORT:
- check_entry_field(read_porttag);
- entry->read_porttag = TOKEN_GET_STRING(tokens);
- break;
-
- case ADDRMAP_TOKEN_REGION:
- check_entry_field(region);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->rgnoffs, 32);
- if (entry->region_string == NULL)
- entry->region_string = astring_alloc();
- entry->region = device_inherit_tag(entry->region_string, cputag, TOKEN_GET_STRING(tokens));
- break;
-
- case ADDRMAP_TOKEN_SHARE:
- check_entry_field(share);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->share, 24);
- break;
-
- case ADDRMAP_TOKEN_BASEPTR:
- check_entry_field(baseptr);
- entry->baseptr = (void **)TOKEN_GET_PTR(tokens, voidptr);
- break;
-
- case ADDRMAP_TOKEN_BASE_MEMBER:
- check_entry_field(baseptroffs_plus1);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->baseptroffs_plus1, 24);
- entry->baseptroffs_plus1++;
- break;
-
- case ADDRMAP_TOKEN_SIZEPTR:
- check_entry_field(sizeptr);
- entry->sizeptr = TOKEN_GET_PTR(tokens, sizeptr);
- break;
-
- case ADDRMAP_TOKEN_SIZE_MEMBER:
- check_entry_field(sizeptroffs_plus1);
- TOKEN_UNGET_UINT32(tokens);
- TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->sizeptroffs_plus1, 24);
- entry->sizeptroffs_plus1++;
- break;
-
- default:
- fatalerror("Invalid token %d in address map\n", entrytype);
- break;
- }
- }
-}
-
-
/***************************************************************************
- OPCODE BASE CONTROL
+ DIRECT ACCESS CONTROL
***************************************************************************/
/*-------------------------------------------------
@@ -1052,9 +799,8 @@ static void address_map_detokenize(address_map *map, const game_driver *driver,
pointer
-------------------------------------------------*/
-void memory_set_decrypted_region(int cpunum, offs_t addrstart, offs_t addrend, void *base)
+void memory_set_decrypted_region(const address_space *space, offs_t addrstart, offs_t addrend, void *base)
{
- address_space *space = &cpudata[cpunum].space[ADDRESS_SPACE_PROGRAM];
offs_t bytestart = ADDR2BYTE(space, addrstart);
offs_t byteend = ADDR2BYTE_END(space, addrend);
int banknum, found = FALSE;
@@ -1062,37 +808,37 @@ void memory_set_decrypted_region(int cpunum, offs_t addrstart, offs_t addrend, v
/* loop over banks looking for a match */
for (banknum = 0; banknum < STATIC_COUNT; banknum++)
{
- bank_info *bank = &bankdata[banknum];
+ bank_info *bank = &space->machine->memory_data->bankdata[banknum];
- /* consider this bank if it is used for reading and matches the CPU/address space */
- if (bank->used && bank->read && bank->cpunum == cpunum && bank->spacenum == ADDRESS_SPACE_PROGRAM)
+ /* consider this bank if it is used for reading and matches the address space */
+ if (bank->used && bank->read && bank->space == space)
{
/* verify that the region fully covers the decrypted range */
if (bank->bytestart >= bytestart && bank->byteend <= byteend)
{
/* set the decrypted pointer for the corresponding memory bank */
- bankd_ptr[banknum] = (UINT8 *)base + bank->bytestart - bytestart;
+ space->machine->memory_data->bankd_ptr[banknum] = (UINT8 *)base + bank->bytestart - bytestart;
found = TRUE;
/* if we are executing from here, force an opcode base update */
if (active_address_space[ADDRESS_SPACE_PROGRAM] != NULL && active_address_space[ADDRESS_SPACE_PROGRAM]->direct.entry == banknum)
- force_opbase_update(space);
+ force_opbase_update((address_space *)space);
}
/* fatal error if the decrypted region straddles the bank */
else if (bank->bytestart < byteend && bank->byteend > bytestart)
- fatalerror("memory_set_decrypted_region found straddled region %08X-%08X for CPU %d", bytestart, byteend, cpunum);
+ fatalerror("memory_set_decrypted_region found straddled region %08X-%08X for CPU '%s'", bytestart, byteend, space->cpu->tag);
}
}
/* fatal error as well if we didn't find any relevant memory banks */
if (!found)
- fatalerror("memory_set_decrypted_region unable to find matching region %08X-%08X for CPU %d", bytestart, byteend, cpunum);
+ fatalerror("memory_set_decrypted_region unable to find matching region %08X-%08X for CPU '%s'", bytestart, byteend, space->cpu->tag);
}
/*-------------------------------------------------
- memory_set_opbase_handler - register a
+ memory_set_direct_update_handler - register a
handler for opcode base changes on a given
CPU
-------------------------------------------------*/
@@ -1113,6 +859,7 @@ direct_update_func memory_set_direct_update_handler(const address_space *space,
int memory_set_direct_region(const address_space *space, offs_t byteaddress)
{
+ memory_private *memdata = space->machine->memory_data;
address_space *spacerw = (address_space *)space;
UINT8 *base = NULL, *based = NULL;
const handler_data *handlers;
@@ -1132,10 +879,6 @@ int memory_set_direct_region(const address_space *space, offs_t byteaddress)
if (entry >= SUBTABLE_BASE)
entry = spacerw->readlookup[LEVEL2_INDEX(entry,byteaddress)];
- /* stop if nothing changed */
- if (spacerw->direct.entry == entry)
- return (entry >= STATIC_BANK1 && entry < STATIC_RAM);
-
/* keep track of current entry */
spacerw->direct.entry = entry;
@@ -1145,23 +888,22 @@ int memory_set_direct_region(const address_space *space, offs_t byteaddress)
/* loop over banks and find a match */
for (entry = 1; entry < STATIC_COUNT; entry++)
{
- bank_info *bank = &bankdata[entry];
- if (bank->used && bank->cpunum == cur_context && bank->spacenum == space->spacenum &&
- bank->bytestart < byteaddress && bank->byteend > byteaddress)
+ bank_info *bank = &memdata->bankdata[entry];
+ if (bank->used && bank->space == space && bank->bytestart < byteaddress && bank->byteend > byteaddress)
break;
}
/* if nothing was found, leave everything alone */
if (entry == STATIC_COUNT)
{
- logerror("CPU '%s': warning - attempt to direct-map address %08X in %s space\n", space->cpu->tag, byteaddress, address_space_names[space->spacenum]);
+ logerror("CPU '%s': warning - attempt to direct-map address %08X in %s space\n", space->cpu->tag, byteaddress, space->name);
return FALSE;
}
}
/* if no decrypted opcodes, point to the same base */
- base = bank_ptr[entry];
- based = bankd_ptr[entry];
+ base = memdata->bank_ptr[entry];
+ based = memdata->bankd_ptr[entry];
if (based == NULL)
based = base;
@@ -1176,19 +918,15 @@ int memory_set_direct_region(const address_space *space, offs_t byteaddress)
}
-/***************************************************************************
- OPCODE BASE CONTROL
-***************************************************************************/
-
/*-------------------------------------------------
- memory_get_read_ptr - return a pointer to the
- base of RAM associated with the given CPU
- and offset
+ memory_get_read_ptr - return a pointer the
+ memory byte provided in the given address
+ space, or NULL if it is not mapped to a bank
-------------------------------------------------*/
-void *memory_get_read_ptr(int cpunum, int spacenum, offs_t byteaddress)
+void *memory_get_read_ptr(const address_space *space, offs_t byteaddress)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ const handler_data *handler;
offs_t byteoffset;
UINT8 entry;
@@ -1197,24 +935,26 @@ void *memory_get_read_ptr(int cpunum, int spacenum, offs_t byteaddress)
entry = space->read.table[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
entry = space->read.table[LEVEL2_INDEX(entry, byteaddress)];
+ handler = space->read.handlers[entry];
/* 8-bit case: RAM/ROM */
if (entry >= STATIC_RAM)
return NULL;
- byteoffset = (byteaddress - space->read.handlers[entry]->bytestart) & space->read.handlers[entry]->bytemask;
- return &bank_ptr[entry][byteoffset];
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
+ return &(*handler->bankbaseptr)[byteoffset];
}
/*-------------------------------------------------
- memory_get_write_ptr - return a pointer to the
- base of RAM associated with the given CPU
- and offset
+ memory_get_write_ptr - return a pointer the
+ memory byte provided in the given address
+ space, or NULL if it is not mapped to a
+ writeable bank
-------------------------------------------------*/
-void *memory_get_write_ptr(int cpunum, int spacenum, offs_t byteaddress)
+void *memory_get_write_ptr(const address_space *space, offs_t byteaddress)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ const handler_data *handler;
offs_t byteoffset;
UINT8 entry;
@@ -1223,82 +963,36 @@ void *memory_get_write_ptr(int cpunum, int spacenum, offs_t byteaddress)
entry = space->write.table[LEVEL1_INDEX(byteaddress)];
if (entry >= SUBTABLE_BASE)
entry = space->write.table[LEVEL2_INDEX(entry, byteaddress)];
+ handler = space->write.handlers[entry];
/* 8-bit case: RAM/ROM */
if (entry >= STATIC_RAM)
return NULL;
- byteoffset = (byteaddress - space->write.handlers[entry]->bytestart) & space->write.handlers[entry]->bytemask;
- return &bank_ptr[entry][byteoffset];
+ byteoffset = (byteaddress - handler->bytestart) & handler->bytemask;
+ return &(*handler->bankbaseptr)[byteoffset];
}
-/*-------------------------------------------------
- memory_get_op_ptr - return a pointer to the
- base of opcode RAM associated with the given
- CPU and offset
--------------------------------------------------*/
-
-void *memory_get_op_ptr(running_machine *machine, int cpunum, offs_t byteaddress, int arg)
-{
- address_space *spacerw = &cpudata[cpunum].space[ADDRESS_SPACE_PROGRAM];
- offs_t byteoffset;
- void *ptr = NULL;
- UINT8 entry;
-
- /* if there is a custom mapper, use that */
- if (spacerw->directupdate != NULL)
- {
- /* need to save opcode info */
- direct_read_data saved_data = spacerw->direct;
-
- /* query the handler */
- offs_t new_byteaddress = (*spacerw->directupdate)(spacerw, byteaddress, &spacerw->direct);
-
- /* if it returns ~0, we use whatever data the handler set */
- if (new_byteaddress == ~0)
- ptr = arg ? &spacerw->direct.raw[byteaddress] : &spacerw->direct.decrypted[byteaddress];
-
- /* otherwise, we use the new offset in the generic case below */
- else
- byteaddress = new_byteaddress;
-
- /* restore opcode info */
- spacerw->direct = saved_data;
-
- /* if we got our pointer, we're done */
- if (ptr != NULL)
- return ptr;
- }
-
- /* perform the lookup */
- byteaddress &= spacerw->bytemask;
- entry = spacerw->read.table[LEVEL1_INDEX(byteaddress)];
- if (entry >= SUBTABLE_BASE)
- entry = spacerw->read.table[LEVEL2_INDEX(entry, byteaddress)];
-
- /* if a non-RAM area, return NULL */
- if (entry >= STATIC_RAM)
- return NULL;
-
- /* adjust the offset */
- byteoffset = (byteaddress - spacerw->read.handlers[entry]->bytestart) & spacerw->read.handlers[entry]->bytemask;
- return (!arg && bankd_ptr[entry]) ? &bankd_ptr[entry][byteoffset] : &bank_ptr[entry][byteoffset];
-}
+/***************************************************************************
+ MEMORY BANKING
+***************************************************************************/
/*-------------------------------------------------
memory_configure_bank - configure the
addresses for a bank
-------------------------------------------------*/
-void memory_configure_bank(int banknum, int startentry, int numentries, void *base, offs_t stride)
+void memory_configure_bank(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride)
{
+ memory_private *memdata = machine->memory_data;
+ bank_info *bank = &memdata->bankdata[banknum];
int entrynum;
/* validation checks */
- if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bankdata[banknum].used)
+ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used)
fatalerror("memory_configure_bank called with invalid bank %d", banknum);
- if (bankdata[banknum].dynamic)
+ if (bank->dynamic)
fatalerror("memory_configure_bank called with dynamic bank %d", banknum);
if (startentry < 0 || startentry + numentries > MAX_BANK_ENTRIES)
fatalerror("memory_configure_bank called with out-of-range entries %d-%d", startentry, startentry + numentries - 1);
@@ -1307,28 +1001,29 @@ void memory_configure_bank(int banknum, int startentry, int numentries, void *ba
/* fill in the requested bank entries */
for (entrynum = startentry; entrynum < startentry + numentries; entrynum++)
- bankdata[banknum].entry[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride;
+ bank->entry[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride;
/* if we have no bankptr yet, set it to the first entry */
- if (bank_ptr[banknum] == NULL)
- bank_ptr[banknum] = bankdata[banknum].entry[0];
+ if (memdata->bank_ptr[banknum] == NULL)
+ memdata->bank_ptr[banknum] = bank->entry[0];
}
-
/*-------------------------------------------------
memory_configure_bank_decrypted - configure
the decrypted addresses for a bank
-------------------------------------------------*/
-void memory_configure_bank_decrypted(int banknum, int startentry, int numentries, void *base, offs_t stride)
+void memory_configure_bank_decrypted(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride)
{
+ memory_private *memdata = machine->memory_data;
+ bank_info *bank = &memdata->bankdata[banknum];
int entrynum;
/* validation checks */
- if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bankdata[banknum].used)
+ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used)
fatalerror("memory_configure_bank called with invalid bank %d", banknum);
- if (bankdata[banknum].dynamic)
+ if (bank->dynamic)
fatalerror("memory_configure_bank called with dynamic bank %d", banknum);
if (startentry < 0 || startentry + numentries > MAX_BANK_ENTRIES)
fatalerror("memory_configure_bank called with out-of-range entries %d-%d", startentry, startentry + numentries - 1);
@@ -1337,35 +1032,38 @@ void memory_configure_bank_decrypted(int banknum, int startentry, int numentries
/* fill in the requested bank entries */
for (entrynum = startentry; entrynum < startentry + numentries; entrynum++)
- bankdata[banknum].entryd[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride;
+ bank->entryd[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride;
/* if we have no bankptr yet, set it to the first entry */
- if (bankd_ptr[banknum] == NULL)
- bankd_ptr[banknum] = bankdata[banknum].entryd[0];
+ if (memdata->bankd_ptr[banknum] == NULL)
+ memdata->bankd_ptr[banknum] = bank->entryd[0];
}
-
/*-------------------------------------------------
- memory_set_bank - set the base of a bank
+ memory_set_bank - select one pre-configured
+ entry to be the new bank base
-------------------------------------------------*/
void memory_set_bank(int banknum, int entrynum)
{
+ memory_private *memdata = Machine->memory_data;
+ bank_info *bank = &memdata->bankdata[banknum];
+
/* validation checks */
- if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bankdata[banknum].used)
+ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used)
fatalerror("memory_set_bank called with invalid bank %d", banknum);
- if (bankdata[banknum].dynamic)
+ if (bank->dynamic)
fatalerror("memory_set_bank called with dynamic bank %d", banknum);
if (entrynum < 0 || entrynum > MAX_BANK_ENTRIES)
fatalerror("memory_set_bank called with out-of-range entry %d", entrynum);
- if (!bankdata[banknum].entry[entrynum])
+ if (!bank->entry[entrynum])
fatalerror("memory_set_bank called for bank %d with invalid bank entry %d", banknum, entrynum);
/* set the base */
- bankdata[banknum].curentry = entrynum;
- bank_ptr[banknum] = bankdata[banknum].entry[entrynum];
- bankd_ptr[banknum] = bankdata[banknum].entryd[entrynum];
+ bank->curentry = entrynum;
+ memdata->bank_ptr[banknum] = bank->entry[entrynum];
+ memdata->bankd_ptr[banknum] = bank->entryd[entrynum];
/* if we're executing out of this bank, adjust the opbase pointer */
if (active_address_space[ADDRESS_SPACE_PROGRAM] != NULL && active_address_space[ADDRESS_SPACE_PROGRAM]->direct.entry == banknum)
@@ -1373,7 +1071,6 @@ void memory_set_bank(int banknum, int entrynum)
}
-
/*-------------------------------------------------
memory_get_bank - return the currently
selected bank
@@ -1381,34 +1078,39 @@ void memory_set_bank(int banknum, int entrynum)
int memory_get_bank(int banknum)
{
+ memory_private *memdata = Machine->memory_data;
+ bank_info *bank = &memdata->bankdata[banknum];
+
/* validation checks */
- if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bankdata[banknum].used)
+ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used)
fatalerror("memory_get_bank called with invalid bank %d", banknum);
- if (bankdata[banknum].dynamic)
+ if (bank->dynamic)
fatalerror("memory_get_bank called with dynamic bank %d", banknum);
- return bankdata[banknum].curentry;
+ return bank->curentry;
}
-
/*-------------------------------------------------
memory_set_bankptr - set the base of a bank
-------------------------------------------------*/
void memory_set_bankptr(int banknum, void *base)
{
+ memory_private *memdata = Machine->memory_data;
+ bank_info *bank = &memdata->bankdata[banknum];
+
/* validation checks */
- if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bankdata[banknum].used)
+ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used)
fatalerror("memory_set_bankptr called with invalid bank %d", banknum);
- if (bankdata[banknum].dynamic)
+ if (bank->dynamic)
fatalerror("memory_set_bankptr called with dynamic bank %d", banknum);
if (base == NULL)
fatalerror("memory_set_bankptr called NULL base");
if (ALLOW_ONLY_AUTO_MALLOC_BANKS)
- validate_auto_malloc_memory(base, bankdata[banknum].byteend - bankdata[banknum].bytestart + 1);
+ validate_auto_malloc_memory(base, bank->byteend - bank->bytestart + 1);
/* set the base */
- bank_ptr[banknum] = base;
+ memdata->bank_ptr[banknum] = base;
/* if we're executing out of this bank, adjust the opbase pointer */
if (active_address_space[ADDRESS_SPACE_PROGRAM] != NULL && active_address_space[ADDRESS_SPACE_PROGRAM]->direct.entry == banknum)
@@ -1416,271 +1118,423 @@ void memory_set_bankptr(int banknum, void *base)
}
-/*-------------------------------------------------
- memory_set_debugger_access - set debugger access
--------------------------------------------------*/
-
-void memory_set_debugger_access(int debugger)
-{
- debugger_access = debugger;
-}
+/***************************************************************************
+ DYNAMIC ADDRESS SPACE MAPPING
+***************************************************************************/
/*-------------------------------------------------
- memory_set_log_unmap - sets whether unmapped
- memory accesses should be logged or not
+ _memory_install_handler - install a new memory
+ handler into the given address space,
+ returning a pointer to the memory backing it,
+ if present
-------------------------------------------------*/
-void memory_set_log_unmap(int spacenum, int log)
+void *_memory_install_handler(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name)
{
- log_unmap[spacenum] = log;
+ address_space *spacerw = (address_space *)space;
+ if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT)
+ fatalerror("fatal: can only use static banks with memory_install_handler()");
+ if (rhandler != 0)
+ space_map_range(spacerw, ROW_READ, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, spacerw, rhandler_name);
+ if (whandler != 0)
+ space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, spacerw, whandler_name);
+ mem_dump();
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
/*-------------------------------------------------
- memory_get_log_unmap - gets whether unmapped
- memory accesses should be logged or not
+ _memory_install_handler8 - same as above but
+ explicitly for 8-bit handlers
-------------------------------------------------*/
-int memory_get_log_unmap(int spacenum)
+UINT8 *_memory_install_handler8(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_space_func rhandler, write8_space_func whandler, const char *rhandler_name, const char *whandler_name)
{
- return log_unmap[spacenum];
+ address_space *spacerw = (address_space *)space;
+ if (rhandler != NULL)
+ space_map_range(spacerw, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name);
+ if (whandler != NULL)
+ space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
+ mem_dump();
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
/*-------------------------------------------------
- memory_install_handlerX - install
- dynamic machine read and write handlers for
- X-bit case
+ _memory_install_handler16 - same as above but
+ explicitly for 16-bit handlers
-------------------------------------------------*/
-void *_memory_install_handler(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name)
+UINT16 *_memory_install_handler16(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_space_func rhandler, write16_space_func whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
- if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT)
- fatalerror("fatal: can only use static banks with memory_install_handler()");
- if (rhandler != 0)
- space_map_range(space, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, space, rhandler_name);
- if (whandler != 0)
- space_map_range(space, ROW_WRITE, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, space, whandler_name);
- mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
-}
-
-UINT8 *_memory_install_handler8(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_space_func rhandler, write8_space_func whandler, const char *rhandler_name, const char *whandler_name)
-{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler != NULL)
- space_map_range(space, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, space, rhandler_name);
+ space_map_range(spacerw, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name);
if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, space, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
-UINT16 *_memory_install_handler16(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_space_func rhandler, write16_space_func whandler, const char *rhandler_name, const char *whandler_name)
-{
- address_space *space = &cpudata[cpunum].space[spacenum];
- if (rhandler != NULL)
- space_map_range(space, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, space, rhandler_name);
- if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, space, whandler_name);
- mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
-}
-UINT32 *_memory_install_handler32(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_space_func rhandler, write32_space_func whandler, const char *rhandler_name, const char *whandler_name)
+/*-------------------------------------------------
+ _memory_install_handler32 - same as above but
+ explicitly for 32-bit handlers
+-------------------------------------------------*/
+
+UINT32 *_memory_install_handler32(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_space_func rhandler, write32_space_func whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler != NULL)
- space_map_range(space, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, space, rhandler_name);
+ space_map_range(spacerw, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name);
if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, space, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
-UINT64 *_memory_install_handler64(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_space_func rhandler, write64_space_func whandler, const char *rhandler_name, const char *whandler_name)
+
+/*-------------------------------------------------
+ _memory_install_handler64 - same as above but
+ explicitly for 64-bit handlers
+-------------------------------------------------*/
+
+UINT64 *_memory_install_handler64(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_space_func rhandler, write64_space_func whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler != NULL)
- space_map_range(space, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, space, rhandler_name);
+ space_map_range(spacerw, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name);
if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, space, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
/*-------------------------------------------------
- memory_install_device_handlerX -
- install dynamic device read and write handlers
- for X-bit case
+ _memory_install_device_handler - install a new
+ device memory handler into the given address
+ space, returning a pointer to the memory
+ backing it, if present
-------------------------------------------------*/
-void *_memory_install_device_handler(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name)
+void *_memory_install_device_handler(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT)
fatalerror("fatal: can only use static banks with memory_install_device_handler()");
if (rhandler != 0)
- space_map_range(space, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, (void *)device, rhandler_name);
+ space_map_range(spacerw, ROW_READ, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, (void *)device, rhandler_name);
if (whandler != 0)
- space_map_range(space, ROW_WRITE, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, (void *)device, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, (void *)device, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
-UINT8 *_memory_install_device_handler8(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, write8_device_func whandler, const char *rhandler_name, const char *whandler_name)
+
+/*-------------------------------------------------
+ _memory_install_device_handler8 - same as above
+ but explicitly for 8-bit handlers
+-------------------------------------------------*/
+
+UINT8 *_memory_install_device_handler8(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, write8_device_func whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler != NULL)
- space_map_range(space, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
+ space_map_range(spacerw, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
-UINT16 *_memory_install_device_handler16(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, write16_device_func whandler, const char *rhandler_name, const char *whandler_name)
+
+/*-------------------------------------------------
+ _memory_install_device_handler16 - same as
+ above but explicitly for 16-bit handlers
+-------------------------------------------------*/
+
+UINT16 *_memory_install_device_handler16(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, write16_device_func whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler != NULL)
- space_map_range(space, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
+ space_map_range(spacerw, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
-UINT32 *_memory_install_device_handler32(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, write32_device_func whandler, const char *rhandler_name, const char *whandler_name)
+
+/*-------------------------------------------------
+ _memory_install_device_handler32 - same as
+ above but explicitly for 32-bit handlers
+-------------------------------------------------*/
+
+UINT32 *_memory_install_device_handler32(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, write32_device_func whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler != NULL)
- space_map_range(space, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
+ space_map_range(spacerw, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
}
-UINT64 *_memory_install_device_handler64(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, write64_device_func whandler, const char *rhandler_name, const char *whandler_name)
+
+/*-------------------------------------------------
+ _memory_install_device_handler64 - same as
+ above but explicitly for 64-bit handlers
+-------------------------------------------------*/
+
+UINT64 *_memory_install_device_handler64(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, write64_device_func whandler, const char *rhandler_name, const char *whandler_name)
{
- address_space *space = &cpudata[cpunum].space[spacenum];
+ address_space *spacerw = (address_space *)space;
if (rhandler != NULL)
- space_map_range(space, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
+ space_map_range(spacerw, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name);
if (whandler != NULL)
- space_map_range(space, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
+ space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
mem_dump();
- return memory_find_base(cpunum, spacenum, ADDR2BYTE(space, addrstart));
+ return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
+}
+
+
+
+/***************************************************************************
+ DEBUGGER HELPERS
+***************************************************************************/
+
+/*-------------------------------------------------
+ memory_get_handler_string - return a string
+ describing the handler at a particular offset
+-------------------------------------------------*/
+
+const char *memory_get_handler_string(const address_space *space, int read0_or_write1, offs_t byteaddress)
+{
+ const address_table *table = read0_or_write1 ? &space->write : &space->read;
+ UINT8 entry;
+
+ /* perform the lookup */
+ byteaddress &= space->bytemask;
+ entry = table->table[LEVEL1_INDEX(byteaddress)];
+ if (entry >= SUBTABLE_BASE)
+ entry = table->table[LEVEL2_INDEX(entry, byteaddress)];
+
+ /* 8-bit case: RAM/ROM */
+ return handler_to_string(table, entry);
}
/*-------------------------------------------------
- memory_init_cpudata - initialize the cpudata
- structure for each CPU
+ memory_enable_read_watchpoints - enable/disable
+ read watchpoint tracking for a given address
+ space
-------------------------------------------------*/
-static void memory_init_cpudata(running_machine *machine)
+void memory_enable_read_watchpoints(const address_space *space, int enable)
+{
+ address_space *spacerw = (address_space *)space;
+ if (enable)
+ spacerw->readlookup = space->machine->memory_data->wptable;
+ else
+ spacerw->readlookup = spacerw->read.table;
+}
+
+
+/*-------------------------------------------------
+ memory_enable_write_watchpoints - enable/disable
+ write watchpoint tracking for a given address
+ space
+-------------------------------------------------*/
+
+void memory_enable_write_watchpoints(const address_space *space, int enable)
+{
+ address_space *spacerw = (address_space *)space;
+ if (enable)
+ spacerw->writelookup = space->machine->memory_data->wptable;
+ else
+ spacerw->writelookup = spacerw->write.table;
+}
+
+
+/*-------------------------------------------------
+ memory_set_debugger_access - control whether
+ subsequent accesses are treated as coming from
+ the debugger
+-------------------------------------------------*/
+
+void memory_set_debugger_access(const address_space *space, int debugger)
+{
+ address_space *spacerw = (address_space *)space;
+ spacerw->debugger_access = debugger;
+}
+
+
+/*-------------------------------------------------
+ memory_set_log_unmap - sets whether unmapped
+ memory accesses should be logged or not
+-------------------------------------------------*/
+
+void memory_set_log_unmap(const address_space *space, int log)
+{
+ address_space *spacerw = (address_space *)space;
+ spacerw->log_unmap = log;
+}
+
+
+/*-------------------------------------------------
+ memory_get_log_unmap - gets whether unmapped
+ memory accesses should be logged or not
+-------------------------------------------------*/
+
+int memory_get_log_unmap(const address_space *space)
+{
+ return space->log_unmap;
+}
+
+
+/*-------------------------------------------------
+ memory_dump - dump the internal memory tables
+ to the given file
+-------------------------------------------------*/
+
+void memory_dump(running_machine *machine, FILE *file)
+{
+ memory_private *memdata = machine->memory_data;
+ const address_space *space;
+
+ /* skip if we can't open the file */
+ if (!file)
+ return;
+
+ /* loop over valid address spaces */
+ for (space = memdata->spacelist; space != NULL; space = space->next)
+ {
+ fprintf(file, "\n\n"
+ "====================================================\n"
+ "CPU '%s' %s address space read handler dump\n"
+ "====================================================\n", space->cpu->tag, space->name);
+ dump_map(file, space, &space->read);
+
+ fprintf(file, "\n\n"
+ "====================================================\n"
+ "CPU '%s' %s address space write handler dump\n"
+ "====================================================\n", space->cpu->tag, space->name);
+ dump_map(file, space, &space->read);
+ }
+}
+
+
+
+/***************************************************************************
+ INTERNAL INITIALIZATION
+***************************************************************************/
+
+/*-------------------------------------------------
+ memory_init_spaces - create the address
+ spaces
+-------------------------------------------------*/
+
+static void memory_init_spaces(running_machine *machine)
{
const machine_config *config = machine->config;
+ memory_private *memdata = machine->memory_data;
+ address_space **nextptr = (address_space **)&memdata->spacelist;
int cpunum, spacenum;
- /* zap the cpudata structure */
- memset(&cpudata, 0, sizeof(cpudata));
-
/* create a global watchpoint-filled table */
- wptable = malloc_or_die(1 << LEVEL1_BITS);
- memset(wptable, STATIC_WATCHPOINT, 1 << LEVEL1_BITS);
+ memdata->wptable = auto_malloc(1 << LEVEL1_BITS);
+ memset(memdata->wptable, STATIC_WATCHPOINT, 1 << LEVEL1_BITS);
/* loop over CPUs */
for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
if (machine->cpu[cpunum] != NULL)
{
cpu_type cputype = config->cpu[cpunum].type;
- cpu_data *cpu = &cpudata[cpunum];
-
- /* get pointers to the CPU's memory region */
- cpu->tag = config->cpu[cpunum].tag;
- cpu->region = memory_region(machine, cpu->tag);
- cpu->regionsize = memory_region_length(machine, cpu->tag);
- /* initialize each address space, and build up a mask of spaces */
+ /* initialize each address space with an actual address bus */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- {
- address_space *space = &cpu->space[spacenum];
- int entrynum;
-
- /* determine the address and data bits */
- space->machine = machine;
- space->cpu = machine->cpu[cpunum];
- space->spacenum = spacenum;
- space->endianness = cputype_get_endianness(cputype);
- space->ashift = cputype_get_addrbus_shift(cputype, spacenum);
- space->abits = cputype_get_addrbus_width(cputype, spacenum);
- space->dbits = cputype_get_databus_width(cputype, spacenum);
- space->addrmask = 0xffffffffUL >> (32 - space->abits);
- space->bytemask = ADDR2BYTE_END(space, space->addrmask);
- space->accessors = *memory_get_accessors(spacenum, space->dbits, space->endianness);
- space->map = NULL;
-
- /* if there's nothing here, just punt */
- if (space->abits == 0)
- continue;
- cpu->spacemask |= 1 << spacenum;
-
- /* allocate subtable information */
- space->read.subtable = malloc_or_die(sizeof(*space->read.subtable) * SUBTABLE_COUNT);
- memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT);
- space->write.subtable = malloc_or_die(sizeof(*space->write.subtable) * SUBTABLE_COUNT);
- memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT);
-
- /* allocate the handler table */
- space->read.handlers[0] = malloc_or_die(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
- memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
- space->write.handlers[0] = malloc_or_die(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
- memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
- for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++)
+ if (cputype_get_addrbus_width(cputype, spacenum) > 0)
{
- space->read.handlers[entrynum] = space->read.handlers[0] + entrynum;
- space->write.handlers[entrynum] = space->write.handlers[0] + entrynum;
- }
+ address_space *space = malloc_or_die(sizeof(*space));
+ int accessorindex;
+ int entrynum;
+
+ /* determine the address and data bits */
+ memset(space, 0, sizeof(*space));
+ space->machine = machine;
+ space->cpu = machine->cpu[cpunum];
+ space->spacenum = spacenum;
+ space->name = address_space_names[spacenum];
+ space->endianness = cputype_get_endianness(cputype);
+ space->ashift = cputype_get_addrbus_shift(cputype, spacenum);
+ space->abits = cputype_get_addrbus_width(cputype, spacenum);
+ space->dbits = cputype_get_databus_width(cputype, spacenum);
+ space->addrmask = 0xffffffffUL >> (32 - space->abits);
+ space->bytemask = ADDR2BYTE_END(space, space->addrmask);
+ accessorindex = (space->dbits == 8) ? 0 : (space->dbits == 16) ? 1 : (space->dbits == 32) ? 2 : 3;
+ space->accessors = memory_accessors[accessorindex][(space->endianness == CPU_IS_LE) ? 0 : 1];
+ space->map = NULL;
+ space->log_unmap = TRUE;
+
+ /* allocate subtable information; we malloc this manually because it will be realloc'ed */
+ space->read.subtable = auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT);
+ memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT);
+ space->write.subtable = auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT);
+ memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT);
+
+ /* allocate the handler table */
+ space->read.handlers[0] = auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
+ memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
+ space->write.handlers[0] = auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
+ memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
+ for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++)
+ {
+ space->read.handlers[entrynum] = space->read.handlers[0] + entrynum;
+ space->write.handlers[entrynum] = space->write.handlers[0] + entrynum;
+ }
- /* init the static handlers */
- for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
- {
- space->read.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 0, entrynum);
- space->read.handlers[entrynum]->object = space;
- space->write.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 1, entrynum);
- space->write.handlers[entrynum]->object = space;
- }
+ /* init the static handlers */
+ for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
+ {
+ space->read.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 0, entrynum);
+ space->read.handlers[entrynum]->object = space;
+ space->write.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 1, entrynum);
+ space->write.handlers[entrynum]->object = space;
+ }
- /* make sure we fix up the mask for the unmap and watchpoint handlers */
- space->read.handlers[STATIC_UNMAP]->bytemask = ~0;
- space->write.handlers[STATIC_UNMAP]->bytemask = ~0;
- space->read.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
- space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
-
- /* allocate memory */
- space->read.table = malloc_or_die(1 << LEVEL1_BITS);
- space->write.table = malloc_or_die(1 << LEVEL1_BITS);
-
- /* initialize everything to unmapped */
- memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
- memset(space->write.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
-
- /* initialize the lookups */
- space->readlookup = space->read.table;
- space->writelookup = space->write.table;
-
- /* set the RAM/ROM base */
- space->direct.raw = space->direct.decrypted = cpu->region;
- space->direct.mask = space->bytemask;
- space->direct.min = 1;
- space->direct.max = 0;
- space->direct.entry = STATIC_UNMAP;
- space->directupdate = NULL;
- }
+ /* make sure we fix up the mask for the unmap and watchpoint handlers */
+ space->read.handlers[STATIC_UNMAP]->bytemask = ~0;
+ space->write.handlers[STATIC_UNMAP]->bytemask = ~0;
+ space->read.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
+ space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
+
+ /* allocate memory; these aren't auto-malloc'ed as we need to expand them */
+ space->read.table = malloc_or_die(1 << LEVEL1_BITS);
+ space->write.table = malloc_or_die(1 << LEVEL1_BITS);
+
+ /* initialize everything to unmapped */
+ memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
+ memset(space->write.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
+
+ /* initialize the lookups */
+ space->readlookup = space->read.table;
+ space->writelookup = space->write.table;
+
+ /* set the direct access information base */
+ space->direct.raw = space->direct.decrypted = NULL;
+ space->direct.mask = space->bytemask;
+ space->direct.min = 1;
+ space->direct.max = 0;
+ space->direct.entry = STATIC_UNMAP;
+ space->directupdate = NULL;
+
+ /* link us in */
+ *nextptr = space;
+ nextptr = (address_space **)&space->next;
+ }
}
}
@@ -1692,173 +1546,535 @@ static void memory_init_cpudata(running_machine *machine)
static void memory_init_preflight(running_machine *machine)
{
- int cpunum;
+ memory_private *memdata = machine->memory_data;
+ address_space *space;
/* zap the bank data */
- memset(&bankdata, 0, sizeof(bankdata));
+ memset(&memdata->bankdata, 0, sizeof(memdata->bankdata));
- /* loop over CPUs */
- for (cpunum = 0; cpunum < ARRAY_LENGTH(cpudata); cpunum++)
+ /* loop over valid address spaces */
+ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next)
{
- cpu_data *cpu = &cpudata[cpunum];
- int spacenum;
+ int regionsize = (space->spacenum == ADDRESS_SPACE_PROGRAM) ? memory_region_length(space->machine, space->cpu->tag) : 0;
+ address_map_entry *entry;
+ int entrynum;
- /* loop over valid address spaces */
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- if (cpu->spacemask & (1 << spacenum))
- {
- address_space *space = &cpu->space[spacenum];
- address_map_entry *entry;
- int entrynum;
+ /* allocate the address map */
+ space->map = address_map_alloc(machine->config, machine->gamedrv, cpu_get_index(space->cpu), space->spacenum);
- /* allocate the address map */
- space->map = address_map_alloc(machine->config, machine->gamedrv, cpunum, spacenum);
+ /* extract global parameters specified by the map */
+ space->unmap = (space->map->unmapval == 0) ? 0 : ~0;
+ if (space->map->globalmask != 0)
+ {
+ space->addrmask = space->map->globalmask;
+ space->bytemask = ADDR2BYTE_END(space, space->addrmask);
+ }
- /* extract global parameters specified by the map */
- space->unmap = (space->map->unmapval == 0) ? 0 : ~0;
- if (space->map->globalmask != 0)
+ /* make a pass over the address map, adjusting for the CPU and getting memory pointers */
+ for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
+ {
+ /* computed adjusted addresses first */
+ entry->bytestart = entry->addrstart;
+ entry->byteend = entry->addrend;
+ entry->bytemirror = entry->addrmirror;
+ entry->bytemask = entry->addrmask;
+ adjust_addresses(space, &entry->bytestart, &entry->byteend, &entry->bytemask, &entry->bytemirror);
+
+ /* if this is a ROM handler without a specified region, attach it to the implicit region */
+ if (space->spacenum == ADDRESS_SPACE_PROGRAM && HANDLER_IS_ROM(entry->read.generic) && entry->region == NULL)
+ {
+ /* make sure it fits within the memory region before doing so, however */
+ if (entry->byteend < regionsize)
{
- space->addrmask = space->map->globalmask;
- space->bytemask = ADDR2BYTE_END(space, space->addrmask);
+ entry->region = space->cpu->tag;
+ entry->rgnoffs = entry->bytestart;
}
+ }
- /* make a pass over the address map, adjusting for the CPU and getting memory pointers */
- for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
+ /* validate adjusted addresses against implicit regions */
+ if (entry->region != NULL && entry->share == 0 && entry->baseptr == NULL)
+ {
+ UINT8 *base = memory_region(machine, entry->region);
+ offs_t length = memory_region_length(machine, entry->region);
+
+ /* validate the region */
+ if (base == NULL)
+ fatalerror("Error: CPU '%s' %s space memory map entry %X-%X references non-existant region \"%s\"", space->cpu->tag, space->name, entry->addrstart, entry->addrend, entry->region);
+ if (entry->rgnoffs + (entry->byteend - entry->bytestart + 1) > length)
+ fatalerror("Error: CPU '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)", space->cpu->tag, space->name, entry->addrstart, entry->addrend, entry->region, length);
+ }
+
+ /* convert any region-relative entries to their memory pointers */
+ if (entry->region != NULL)
+ entry->memory = memory_region(machine, entry->region) + entry->rgnoffs;
+
+ /* assign static banks for explicitly specified entries */
+ if (HANDLER_IS_BANK(entry->read.generic))
+ bank_assign_static(HANDLER_TO_BANK(entry->read.generic), space, ROW_READ, entry->bytestart, entry->byteend);
+ if (HANDLER_IS_BANK(entry->write.generic))
+ bank_assign_static(HANDLER_TO_BANK(entry->write.generic), space, ROW_WRITE, entry->bytestart, entry->byteend);
+ }
+
+ /* now loop over all the handlers and enforce the address mask */
+ /* we don't loop over map entries because the mask applies to static handlers as well */
+ for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
+ {
+ space->read.handlers[entrynum]->bytemask &= space->bytemask;
+ space->write.handlers[entrynum]->bytemask &= space->bytemask;
+ }
+ }
+}
+
+
+/*-------------------------------------------------
+ memory_init_populate - populate the memory
+ mapping tables with entries
+-------------------------------------------------*/
+
+static void memory_init_populate(running_machine *machine)
+{
+ memory_private *memdata = machine->memory_data;
+ address_space *space;
+
+ /* loop over valid address spaces */
+ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next)
+ if (space->map != NULL)
+ {
+ const address_map_entry *last_entry = NULL;
+
+ /* install the handlers, using the original, unadjusted memory map */
+ while (last_entry != space->map->entrylist)
+ {
+ const address_map_entry *entry;
+ read_handler rhandler;
+ write_handler whandler;
+
+ /* find the entry before the last one we processed */
+ for (entry = space->map->entrylist; entry->next != last_entry; entry = entry->next) ;
+ last_entry = entry;
+ rhandler = entry->read;
+ whandler = entry->write;
+
+ /* if we have a read port tag, look it up */
+ if (entry->read_porttag != NULL)
{
- /* computed adjusted addresses first */
- entry->bytestart = entry->addrstart;
- entry->byteend = entry->addrend;
- entry->bytemirror = entry->addrmirror;
- entry->bytemask = entry->addrmask;
- adjust_addresses(space, &entry->bytestart, &entry->byteend, &entry->bytemask, &entry->bytemirror);
-
- /* if this is a ROM handler without a specified region, attach it to the implicit region */
- if (spacenum == ADDRESS_SPACE_PROGRAM && HANDLER_IS_ROM(entry->read.generic) && entry->region == NULL)
+ switch (space->dbits)
{
- /* make sure it fits within the memory region before doing so, however */
- if (entry->byteend < cpu->regionsize)
- {
- entry->region = cpu->tag;
- entry->rgnoffs = entry->bytestart;
- }
+ case 8: rhandler.shandler8 = input_port_read_handler8(machine->portconfig, entry->read_porttag); break;
+ case 16: rhandler.shandler16 = input_port_read_handler16(machine->portconfig, entry->read_porttag); break;
+ case 32: rhandler.shandler32 = input_port_read_handler32(machine->portconfig, entry->read_porttag); break;
+ case 64: rhandler.shandler64 = input_port_read_handler64(machine->portconfig, entry->read_porttag); break;
}
+ if (rhandler.generic == NULL)
+ fatalerror("Non-existent port referenced: '%s'\n", entry->read_porttag);
+ }
- /* validate adjusted addresses against implicit regions */
- if (entry->region != NULL && entry->share == 0 && entry->baseptr == NULL)
+ /* install the read handler if present */
+ if (rhandler.generic != NULL)
+ {
+ int bits = (entry->read_bits == 0) ? space->dbits : entry->read_bits;
+ void *object = space;
+ if (entry->read_devtype != NULL)
{
- UINT8 *base = memory_region(machine, entry->region);
- offs_t length = memory_region_length(machine, entry->region);
-
- /* validate the region */
- if (base == NULL)
- fatalerror("Error: CPU %d space %d memory map entry %X-%X references non-existant region \"%s\"", cpunum, spacenum, entry->addrstart, entry->addrend, entry->region);
- if (entry->rgnoffs + (entry->byteend - entry->bytestart + 1) > length)
- fatalerror("Error: CPU %d space %d memory map entry %X-%X extends beyond region \"%s\" size (%X)", cpunum, spacenum, entry->addrstart, entry->addrend, entry->region, length);
+ object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->read_devtype, entry->read_devtag);
+ if (object == NULL)
+ fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->read_devtype), entry->read_devtag);
}
-
- /* convert any region-relative entries to their memory pointers */
- if (entry->region != NULL)
- entry->memory = memory_region(machine, entry->region) + entry->rgnoffs;
-
- /* assign static banks for explicitly specified entries */
- if (HANDLER_IS_BANK(entry->read.generic))
- bank_assign_static(HANDLER_TO_BANK(entry->read.generic), cpunum, spacenum, ROW_READ, entry->bytestart, entry->byteend);
- if (HANDLER_IS_BANK(entry->write.generic))
- bank_assign_static(HANDLER_TO_BANK(entry->write.generic), cpunum, spacenum, ROW_WRITE, entry->bytestart, entry->byteend);
+ space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, rhandler.generic, object, entry->read_name);
}
- /* now loop over all the handlers and enforce the address mask */
- /* we don't loop over map entries because the mask applies to static handlers as well */
- for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
+ /* install the write handler if present */
+ if (whandler.generic != NULL)
{
- space->read.handlers[entrynum]->bytemask &= space->bytemask;
- space->write.handlers[entrynum]->bytemask &= space->bytemask;
+ int bits = (entry->write_bits == 0) ? space->dbits : entry->write_bits;
+ void *object = space;
+ if (entry->write_devtype != NULL)
+ {
+ object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->write_devtype, entry->write_devtag);
+ if (object == NULL)
+ fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->write_devtype), entry->write_devtag);
+ }
+ space_map_range_private(space, ROW_WRITE, bits, entry->write_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, whandler.generic, object, entry->write_name);
}
}
- }
+ }
}
/*-------------------------------------------------
- memory_init_populate - populate the memory
- mapping tables with entries
+ memory_init_allocate - allocate memory for
+ CPU address spaces
-------------------------------------------------*/
-static void memory_init_populate(running_machine *machine)
+static void memory_init_allocate(running_machine *machine)
{
- int cpunum, spacenum;
+ memory_private *memdata = machine->memory_data;
+ address_space *space;
- /* loop over CPUs and address spaces */
- for (cpunum = 0; cpunum < ARRAY_LENGTH(cpudata); cpunum++)
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- if (cpudata[cpunum].spacemask & (1 << spacenum))
- {
- address_space *space = &cpudata[cpunum].space[spacenum];
+ /* loop over valid address spaces */
+ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next)
+ {
+ address_map_entry *unassigned = NULL;
+ address_map_entry *entry;
+ memory_block *prev_memblock_head = memdata->memory_block_list;
+ memory_block *memblock;
+
+ /* make a first pass over the memory map and track blocks with hardcoded pointers */
+ /* we do this to make sure they are found by space_find_backing_memory first */
+ for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
+ if (entry->memory != NULL)
+ block_allocate(space, entry->bytestart, entry->byteend, entry->memory);
+
+ /* loop over all blocks just allocated and assign pointers from them */
+ for (memblock = memdata->memory_block_list; memblock != prev_memblock_head; memblock = memblock->next)
+ unassigned = block_assign_intersecting(space, memblock->bytestart, memblock->byteend, memblock->data);
+
+ /* if we don't have an unassigned pointer yet, try to find one */
+ if (unassigned == NULL)
+ unassigned = block_assign_intersecting(space, ~0, 0, NULL);
+
+ /* loop until we've assigned all memory in this space */
+ while (unassigned != NULL)
+ {
+ offs_t curbytestart, curbyteend;
+ int changed;
+ void *block;
- /* install the handlers, using the original, unadjusted memory map */
- if (space->map != NULL)
- {
- const address_map_entry *last_entry = NULL;
+ /* work in MEMORY_BLOCK_CHUNK-sized chunks */
+ offs_t curblockstart = unassigned->bytestart / MEMORY_BLOCK_CHUNK;
+ offs_t curblockend = unassigned->byteend / MEMORY_BLOCK_CHUNK;
+
+ /* loop while we keep finding unassigned blocks in neighboring MEMORY_BLOCK_CHUNK chunks */
+ do
+ {
+ changed = FALSE;
- while (last_entry != space->map->entrylist)
+ /* scan for unmapped blocks in the adjusted map */
+ for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
+ if (entry->memory == NULL && entry != unassigned && space_needs_backing_store(space, entry))
{
- const address_map_entry *entry;
- read_handler rhandler;
- write_handler whandler;
-
- /* find the entry before the last one we processed */
- for (entry = space->map->entrylist; entry->next != last_entry; entry = entry->next) ;
- last_entry = entry;
- rhandler = entry->read;
- whandler = entry->write;
-
- /* if we have a read port tag, look it up */
- if (entry->read_porttag != NULL)
- {
- switch (space->dbits)
- {
- case 8: rhandler.shandler8 = input_port_read_handler8(machine->portconfig, entry->read_porttag); break;
- case 16: rhandler.shandler16 = input_port_read_handler16(machine->portconfig, entry->read_porttag); break;
- case 32: rhandler.shandler32 = input_port_read_handler32(machine->portconfig, entry->read_porttag); break;
- case 64: rhandler.shandler64 = input_port_read_handler64(machine->portconfig, entry->read_porttag); break;
- }
- if (rhandler.generic == NULL)
- fatalerror("Non-existent port referenced: '%s'\n", entry->read_porttag);
- }
+ offs_t blockstart, blockend;
- /* install the read handler if present */
- if (rhandler.generic != NULL)
- {
- int bits = (entry->read_bits == 0) ? space->dbits : entry->read_bits;
- void *object = space;
- if (entry->read_devtype != NULL)
- {
- object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->read_devtype, entry->read_devtag);
- if (object == NULL)
- fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->read_devtype), entry->read_devtag);
- }
- space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, rhandler.generic, object, entry->read_name);
- }
+ /* get block start/end blocks for this block */
+ blockstart = entry->bytestart / MEMORY_BLOCK_CHUNK;
+ blockend = entry->byteend / MEMORY_BLOCK_CHUNK;
- /* install the write handler if present */
- if (whandler.generic != NULL)
+ /* if we intersect or are adjacent, adjust the start/end */
+ if (blockstart <= curblockend + 1 && blockend >= curblockstart - 1)
{
- int bits = (entry->write_bits == 0) ? space->dbits : entry->write_bits;
- void *object = space;
- if (entry->write_devtype != NULL)
- {
- object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->write_devtype, entry->write_devtag);
- if (object == NULL)
- fatalerror("Unidentified object in memory map: type=%s tag=%s\n", devtype_name(entry->write_devtype), entry->write_devtag);
- }
- space_map_range_private(space, ROW_WRITE, bits, entry->write_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, whandler.generic, object, entry->write_name);
+ if (blockstart < curblockstart)
+ curblockstart = blockstart, changed = TRUE;
+ if (blockend > curblockend)
+ curblockend = blockend, changed = TRUE;
}
}
+ } while (changed);
+
+ /* we now have a block to allocate; do it */
+ curbytestart = curblockstart * MEMORY_BLOCK_CHUNK;
+ curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1);
+ block = block_allocate(space, curbytestart, curbyteend, NULL);
+
+ /* assign memory that intersected the new block */
+ unassigned = block_assign_intersecting(space, curbytestart, curbyteend, block);
+ }
+ }
+}
+
+
+/*-------------------------------------------------
+ memory_init_locate - find all the requested
+ pointers into the final allocated memory
+-------------------------------------------------*/
+
+static void memory_init_locate(running_machine *machine)
+{
+ memory_private *memdata = machine->memory_data;
+ address_space *space;
+ int banknum;
+
+ /* loop over valid address spaces */
+ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next)
+ {
+ const address_map_entry *entry;
+
+ /* fill in base/size entries, and handle shared memory */
+ for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
+ {
+ /* assign base/size values */
+ if (entry->baseptr != NULL)
+ *entry->baseptr = entry->memory;
+ if (entry->baseptroffs_plus1 != 0)
+ *(void **)((UINT8 *)machine->driver_data + entry->baseptroffs_plus1 - 1) = entry->memory;
+ if (entry->sizeptr != NULL)
+ *entry->sizeptr = entry->byteend - entry->bytestart + 1;
+ if (entry->sizeptroffs_plus1 != 0)
+ *(size_t *)((UINT8 *)machine->driver_data + entry->sizeptroffs_plus1 - 1) = entry->byteend - entry->bytestart + 1;
+ }
+ }
+
+ /* once this is done, find the starting bases for the banks */
+ for (banknum = 1; banknum <= MAX_BANKS; banknum++)
+ {
+ bank_info *bank = &memdata->bankdata[banknum];
+ if (bank->used)
+ {
+ address_map_entry *entry;
+
+ /* set the initial bank pointer */
+ for (entry = bank->space->map->entrylist; entry != NULL; entry = entry->next)
+ if (entry->bytestart == bank->bytestart)
+ {
+ memdata->bank_ptr[banknum] = entry->memory;
+ VPRINTF(("assigned bank %d pointer to memory from range %08X-%08X [%p]\n", banknum, entry->addrstart, entry->addrend, entry->memory));
+ break;
}
- }
+
+ /* if the entry was set ahead of time, override the automatically found pointer */
+ if (!bank->dynamic && bank->curentry != MAX_BANK_ENTRIES)
+ memdata->bank_ptr[banknum] = bank->entry[bank->curentry];
+ }
+ }
+
+ /* request a callback to fix up the banks when done */
+ state_save_register_postload(machine, bank_reattach, NULL);
+}
+
+
+/*-------------------------------------------------
+ memory_exit - free memory
+-------------------------------------------------*/
+
+static void memory_exit(running_machine *machine)
+{
+ memory_private *memdata = machine->memory_data;
+ address_space *space, *nextspace;
+
+ /* free the memory blocks */
+ while (memdata->memory_block_list != NULL)
+ {
+ memory_block *block = memdata->memory_block_list;
+ memdata->memory_block_list = block->next;
+ free(block);
+ }
+
+ /* free all the address spaces and tables */
+ for (space = (address_space *)memdata->spacelist; space != NULL; space = nextspace)
+ {
+ nextspace = (address_space *)space->next;
+ if (space->map != NULL)
+ address_map_free(space->map);
+ if (space->read.table != NULL)
+ free(space->read.table);
+ if (space->write.table != NULL)
+ free(space->write.table);
+ free(space);
+ }
}
+
+/***************************************************************************
+ ADDRESS MAP HELPERS
+***************************************************************************/
+
+/*-------------------------------------------------
+ map_detokenize - detokenize an array of
+ address map tokens
+-------------------------------------------------*/
+
+#define check_map(field) do { \
+ if (map->field != 0 && map->field != tmap.field) \
+ fatalerror("%s: %s included a mismatched address map (%s %d) for an existing map with %s %d!\n", driver->source_file, driver->name, #field, tmap.field, #field, map->field); \
+ } while (0)
+
+
+#define check_entry_handler(handler) do { \
+ if (entry->handler.generic != NULL && entry->handler.generic != SMH_RAM) \
+ fatalerror("%s: %s AM_RANGE(0x%x, 0x%x) %s handler already set!\n", driver->source_file, driver->name, entry->addrstart, entry->addrend, #handler); \
+ } while (0)
+
+#define check_entry_field(field) do { \
+ if (entry->field != 0) \
+ fatalerror("%s: %s AM_RANGE(0x%x, 0x%x) setting %s already set!\n", driver->source_file, driver->name, entry->addrstart, entry->addrend, #field); \
+ } while (0)
+
+static void map_detokenize(address_map *map, const game_driver *driver, const char *cputag, const addrmap_token *tokens)
+{
+ address_map_entry **entryptr;
+ address_map_entry *entry;
+ address_map tmap = {0};
+ UINT32 entrytype;
+
+ /* check the first token */
+ TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, tmap.spacenum, 8, tmap.databits, 8);
+ if (entrytype != ADDRMAP_TOKEN_START)
+ fatalerror("%s: %s Address map missing ADDRMAP_TOKEN_START!\n", driver->source_file, driver->name);
+ if (tmap.spacenum >= ADDRESS_SPACES)
+ fatalerror("%s: %s Invalid address space %d for memory map!\n", driver->source_file, driver->name, tmap.spacenum);
+ if (tmap.databits != 8 && tmap.databits != 16 && tmap.databits != 32 && tmap.databits != 64)
+ fatalerror("%s: %s Invalid data bits %d for memory map!\n", driver->source_file, driver->name, tmap.databits);
+ check_map(spacenum);
+ check_map(databits);
+
+ /* fill in the map values */
+ map->spacenum = tmap.spacenum;
+ map->databits = tmap.databits;
+
+ /* find the end of the list */
+ for (entryptr = &map->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) ;
+ entry = NULL;
+
+ /* loop over tokens until we hit the end */
+ while (entrytype != ADDRMAP_TOKEN_END)
+ {
+ /* unpack the token from the first entry */
+ TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8);
+ switch (entrytype)
+ {
+ /* end */
+ case ADDRMAP_TOKEN_END:
+ break;
+
+ /* including */
+ case ADDRMAP_TOKEN_INCLUDE:
+ map_detokenize(map, driver, cputag, TOKEN_GET_PTR(tokens, tokenptr));
+ for (entryptr = &map->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next) ;
+ entry = NULL;
+ break;
+
+ /* global flags */
+ case ADDRMAP_TOKEN_GLOBAL_MASK:
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, tmap.globalmask, 32);
+ check_map(globalmask);
+ map->globalmask = tmap.globalmask;
+ break;
+
+ case ADDRMAP_TOKEN_UNMAP_VALUE:
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, tmap.unmapval, 1);
+ check_map(unmapval);
+ map->unmapval = tmap.unmapval;
+ break;
+
+ /* start a new range */
+ case ADDRMAP_TOKEN_RANGE:
+ entry = *entryptr = malloc_or_die(sizeof(**entryptr));
+ entryptr = &entry->next;
+ memset(entry, 0, sizeof(*entry));
+ TOKEN_GET_UINT64_UNPACK2(tokens, entry->addrstart, 32, entry->addrend, 32);
+ break;
+
+ case ADDRMAP_TOKEN_MASK:
+ check_entry_field(addrmask);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->addrmask, 32);
+ break;
+
+ case ADDRMAP_TOKEN_MIRROR:
+ check_entry_field(addrmirror);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->addrmirror, 32);
+ break;
+
+ case ADDRMAP_TOKEN_READ:
+ check_entry_handler(read);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->read_bits, 8, entry->read_mask, 8);
+ entry->read = TOKEN_GET_PTR(tokens, read);
+ entry->read_name = TOKEN_GET_STRING(tokens);
+ break;
+
+ case ADDRMAP_TOKEN_WRITE:
+ check_entry_handler(write);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->write_bits, 8, entry->write_mask, 8);
+ entry->write = TOKEN_GET_PTR(tokens, write);
+ entry->write_name = TOKEN_GET_STRING(tokens);
+ break;
+
+ case ADDRMAP_TOKEN_DEVICE_READ:
+ check_entry_handler(read);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->read_bits, 8, entry->read_mask, 8);
+ entry->read = TOKEN_GET_PTR(tokens, read);
+ entry->read_name = TOKEN_GET_STRING(tokens);
+ entry->read_devtype = TOKEN_GET_PTR(tokens, devtype);
+ if (entry->read_devtag_string == NULL)
+ entry->read_devtag_string = astring_alloc();
+ entry->read_devtag = device_inherit_tag(entry->read_devtag_string, cputag, TOKEN_GET_STRING(tokens));
+ break;
+
+ case ADDRMAP_TOKEN_DEVICE_WRITE:
+ check_entry_handler(write);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK3(tokens, entrytype, 8, entry->write_bits, 8, entry->write_mask, 8);
+ entry->write = TOKEN_GET_PTR(tokens, write);
+ entry->write_name = TOKEN_GET_STRING(tokens);
+ entry->write_devtype = TOKEN_GET_PTR(tokens, devtype);
+ if (entry->write_devtag_string == NULL)
+ entry->write_devtag_string = astring_alloc();
+ entry->write_devtag = device_inherit_tag(entry->write_devtag_string, cputag, TOKEN_GET_STRING(tokens));
+ break;
+
+ case ADDRMAP_TOKEN_READ_PORT:
+ check_entry_field(read_porttag);
+ entry->read_porttag = TOKEN_GET_STRING(tokens);
+ break;
+
+ case ADDRMAP_TOKEN_REGION:
+ check_entry_field(region);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, entry->rgnoffs, 32);
+ if (entry->region_string == NULL)
+ entry->region_string = astring_alloc();
+ entry->region = device_inherit_tag(entry->region_string, cputag, TOKEN_GET_STRING(tokens));
+ break;
+
+ case ADDRMAP_TOKEN_SHARE:
+ check_entry_field(share);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->share, 24);
+ break;
+
+ case ADDRMAP_TOKEN_BASEPTR:
+ check_entry_field(baseptr);
+ entry->baseptr = (void **)TOKEN_GET_PTR(tokens, voidptr);
+ break;
+
+ case ADDRMAP_TOKEN_BASE_MEMBER:
+ check_entry_field(baseptroffs_plus1);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->baseptroffs_plus1, 24);
+ entry->baseptroffs_plus1++;
+ break;
+
+ case ADDRMAP_TOKEN_SIZEPTR:
+ check_entry_field(sizeptr);
+ entry->sizeptr = TOKEN_GET_PTR(tokens, sizeptr);
+ break;
+
+ case ADDRMAP_TOKEN_SIZE_MEMBER:
+ check_entry_field(sizeptroffs_plus1);
+ TOKEN_UNGET_UINT32(tokens);
+ TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, entry->sizeptroffs_plus1, 24);
+ entry->sizeptroffs_plus1++;
+ break;
+
+ default:
+ fatalerror("Invalid token %d in address map\n", entrytype);
+ break;
+ }
+ }
+}
+
+
+
+/***************************************************************************
+ MEMORY MAPPING HELPERS
+***************************************************************************/
+
/*-------------------------------------------------
space_map_range_private - wrapper for
space_map_range which is used at
@@ -1875,6 +2091,7 @@ static void space_map_range_private(address_space *space, read_or_write readorwr
/* assign banks for RAM/ROM areas */
if (HANDLER_IS_RAM(handler))
{
+ memory_private *memdata = space->machine->memory_data;
offs_t bytestart = addrstart;
offs_t byteend = addrend;
offs_t bytemask = addrmask;
@@ -1884,9 +2101,9 @@ static void space_map_range_private(address_space *space, read_or_write readorwr
adjust_addresses(space, &bytestart, &byteend, &bytemask, &bytemirror);
/* assign a bank to the adjusted addresses */
- handler = (genf *)bank_assign_dynamic(cpu_get_index(space->cpu), space->spacenum, readorwrite, bytestart, byteend);
- if (bank_ptr[HANDLER_TO_BANK(handler)] == NULL)
- bank_ptr[HANDLER_TO_BANK(handler)] = memory_find_base(cpu_get_index(space->cpu), space->spacenum, bytestart);
+ handler = (genf *)bank_assign_dynamic(space, readorwrite, bytestart, byteend);
+ if (memdata->bank_ptr[HANDLER_TO_BANK(handler)] == NULL)
+ memdata->bank_ptr[HANDLER_TO_BANK(handler)] = space_find_backing_memory(space, bytestart);
}
/* then do a normal installation */
@@ -1929,10 +2146,10 @@ static void space_map_range(address_space *space, read_or_write readorwrite, int
/* if we're installing a new bank, make sure we mark it */
if (HANDLER_IS_BANK(handler))
- bank_assign_static(HANDLER_TO_BANK(handler), cpu_get_index(space->cpu), space->spacenum, readorwrite, bytestart, byteend);
+ bank_assign_static(HANDLER_TO_BANK(handler), space, readorwrite, bytestart, byteend);
/* get the final handler index */
- entry = table_assign_handler(tabledata->handlers, object, handler, handler_name, bytestart, byteend, bytemask);
+ entry = table_assign_handler(space, tabledata->handlers, object, handler, handler_name, bytestart, byteend, bytemask);
/* fix up the handler if a stub is required */
if (handlerbits != space->dbits)
@@ -1941,10 +2158,6 @@ static void space_map_range(address_space *space, read_or_write readorwrite, int
/* populate it */
table_populate_range_mirrored(tabledata, bytestart, byteend, bytemirror, entry);
- /* if this is being installed to a live CPU, update the context */
- if (cur_context != -1 && cpu_get_index(space->cpu) == cur_context)
- memory_set_context(space->machine, cur_context);
-
/* reset read/write pointers if necessary (could have moved due to realloc) */
if (reset_write)
space->writelookup = space->write.table;
@@ -1962,13 +2175,94 @@ static void space_map_range(address_space *space, read_or_write readorwrite, int
/*-------------------------------------------------
+ space_find_backing_memory - return a pointer to
+ the base of RAM associated with the given CPU
+ and offset
+-------------------------------------------------*/
+
+static void *space_find_backing_memory(const address_space *space, offs_t byteaddress)
+{
+ memory_private *memdata = space->machine->memory_data;
+ address_map_entry *entry;
+ memory_block *block;
+
+ VPRINTF(("space_find_backing_memory('%s',%s,%08X) -> ", space->cpu->tag, space->name, byteaddress));
+
+ /* look in the address map first */
+ for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
+ {
+ offs_t maskoffs = byteaddress & entry->bytemask;
+ if (maskoffs >= entry->bytestart && maskoffs <= entry->byteend)
+ {
+ VPRINTF(("found in entry %08X-%08X [%p]\n", entry->addrstart, entry->addrend, (UINT8 *)entry->memory + (maskoffs - entry->bytestart)));
+ return (UINT8 *)entry->memory + (maskoffs - entry->bytestart);
+ }
+ }
+
+ /* if not found there, look in the allocated blocks */
+ for (block = memdata->memory_block_list; block != NULL; block = block->next)
+ if (block->space == space && block->bytestart <= byteaddress && block->byteend > byteaddress)
+ {
+ VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart, block->byteend, block->data + (byteaddress - block->bytestart)));
+ return block->data + byteaddress - block->bytestart;
+ }
+
+ VPRINTF(("did not find\n"));
+ return NULL;
+}
+
+
+/*-------------------------------------------------
+ space_needs_backing_store - return whether a
+ given memory map entry implies the need of
+ allocating and registering memory
+-------------------------------------------------*/
+
+static int space_needs_backing_store(const address_space *space, const address_map_entry *entry)
+{
+ FPTR handler;
+
+ if (entry->baseptr != NULL || entry->baseptroffs_plus1 != 0)
+ return TRUE;
+
+ handler = (FPTR)entry->write.generic;
+ if (handler < STATIC_COUNT)
+ {
+ if (handler != STATIC_INVALID &&
+ handler != STATIC_ROM &&
+ handler != STATIC_NOP &&
+ handler != STATIC_UNMAP)
+ return TRUE;
+ }
+
+ handler = (FPTR)entry->read.generic;
+ if (handler < STATIC_COUNT)
+ {
+ if (handler != STATIC_INVALID &&
+ (handler < STATIC_BANK1 || handler > STATIC_BANK1 + MAX_BANKS - 1) &&
+ (handler != STATIC_ROM || space->spacenum != ADDRESS_SPACE_PROGRAM || entry->addrstart >= memory_region_length(space->machine, space->cpu->tag)) &&
+ handler != STATIC_NOP &&
+ handler != STATIC_UNMAP)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
+/***************************************************************************
+ BANKING HELPERS
+***************************************************************************/
+
+/*-------------------------------------------------
bank_assign_static - assign and tag a static
bank
-------------------------------------------------*/
-static void bank_assign_static(int banknum, int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend)
+static void bank_assign_static(int banknum, const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend)
{
- bank_info *bank = &bankdata[banknum];
+ bank_info *bank = &space->machine->memory_data->bankdata[banknum];
/* if we're not yet used, fill in the data */
if (!bank->used)
@@ -1980,8 +2274,7 @@ static void bank_assign_static(int banknum, int cpunum, int spacenum, read_or_wr
/* fill in information about the bank */
bank->used = TRUE;
bank->dynamic = FALSE;
- bank->cpunum = cpunum;
- bank->spacenum = spacenum;
+ bank->space = space;
bank->bytestart = bytestart;
bank->byteend = byteend;
bank->curentry = MAX_BANK_ENTRIES;
@@ -2000,39 +2293,66 @@ static void bank_assign_static(int banknum, int cpunum, int spacenum, read_or_wr
matching bank
-------------------------------------------------*/
-static genf *bank_assign_dynamic(int cpunum, int spacenum, read_or_write readorwrite, offs_t bytestart, offs_t byteend)
+static genf *bank_assign_dynamic(const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend)
{
int banknum;
/* loop over banks, searching for an exact match or an empty */
for (banknum = MAX_BANKS; banknum >= 1; banknum--)
{
- bank_info *bank = &bankdata[banknum];
- if (!bank->used || (bank->dynamic && bank->cpunum == cpunum && bank->spacenum == spacenum && bank->bytestart == bytestart))
+ bank_info *bank = &space->machine->memory_data->bankdata[banknum];
+ if (!bank->used || (bank->dynamic && bank->space == space && bank->bytestart == bytestart))
{
bank->used = TRUE;
bank->dynamic = TRUE;
- bank->cpunum = cpunum;
- bank->spacenum = spacenum;
+ bank->space = space;
bank->bytestart = bytestart;
bank->byteend = byteend;
- VPRINTF(("Assigned bank %d to %d,%d,%08X\n", banknum, cpunum, spacenum, bytestart));
+ VPRINTF(("Assigned bank %d to '%s',%s,%08X\n", banknum, space->cpu->tag, space->name, bytestart));
return BANK_TO_HANDLER(banknum);
}
}
/* if we got here, we failed */
- fatalerror("cpu #%d: ran out of banks for RAM/ROM regions!", cpunum);
+ fatalerror("CPU '%s': ran out of banks for RAM/ROM regions!", space->cpu->tag);
return NULL;
}
/*-------------------------------------------------
+ bank_reattach - reconnect banks after a load
+-------------------------------------------------*/
+
+static STATE_POSTLOAD( bank_reattach )
+{
+ memory_private *memdata = machine->memory_data;
+ int banknum;
+
+ /* once this is done, find the starting bases for the banks */
+ for (banknum = 1; banknum <= MAX_BANKS; banknum++)
+ {
+ bank_info *bank = &memdata->bankdata[banknum];
+ if (bank->used && !bank->dynamic)
+ {
+ /* if this entry has a changed entry, set the appropriate pointer */
+ if (bank->curentry != MAX_BANK_ENTRIES)
+ memdata->bank_ptr[banknum] = bank->entry[bank->curentry];
+ }
+ }
+}
+
+
+
+/***************************************************************************
+ TABLE MANAGEMENT
+***************************************************************************/
+
+/*-------------------------------------------------
table_assign_handler - finds the index of a
handler, or allocates a new one as necessary
-------------------------------------------------*/
-static UINT8 table_assign_handler(handler_data **table, void *object, genf *handler, const char *handler_name, offs_t bytestart, offs_t byteend, offs_t bytemask)
+static UINT8 table_assign_handler(const address_space *space, handler_data **table, void *object, genf *handler, const char *handler_name, offs_t bytestart, offs_t byteend, offs_t bytemask)
{
int entry;
@@ -2048,6 +2368,7 @@ static UINT8 table_assign_handler(handler_data **table, void *object, genf *hand
hdata->bytestart = bytestart;
hdata->byteend = byteend;
hdata->bytemask = bytemask;
+ hdata->bankbaseptr = &space->machine->memory_data->bank_ptr[entry];
hdata->name = handler_name;
}
return entry;
@@ -2260,6 +2581,11 @@ static void table_populate_range_mirrored(address_table *tabledata, offs_t bytes
}
+
+/***************************************************************************
+ SUBTABLE MANAGEMENT
+***************************************************************************/
+
/*-------------------------------------------------
subtable_alloc - allocate a fresh subtable
and set its usecount to 1
@@ -2451,139 +2777,25 @@ static void subtable_close(address_table *tabledata, offs_t l1index)
}
-/*-------------------------------------------------
- Return whether a given memory map entry implies
- the need of allocating and registering memory
--------------------------------------------------*/
-
-static int amentry_needs_backing_store(int cpunum, int spacenum, const address_map_entry *entry)
-{
- FPTR handler;
-
- if (entry->baseptr != NULL || entry->baseptroffs_plus1 != 0)
- return TRUE;
-
- handler = (FPTR)entry->write.generic;
- if (handler < STATIC_COUNT)
- {
- if (handler != STATIC_INVALID &&
- handler != STATIC_ROM &&
- handler != STATIC_NOP &&
- handler != STATIC_UNMAP)
- return TRUE;
- }
-
- handler = (FPTR)entry->read.generic;
- if (handler < STATIC_COUNT)
- {
- if (handler != STATIC_INVALID &&
- (handler < STATIC_BANK1 || handler > STATIC_BANK1 + MAX_BANKS - 1) &&
- (handler != STATIC_ROM || spacenum != ADDRESS_SPACE_PROGRAM || entry->addrstart >= cpudata[cpunum].regionsize) &&
- handler != STATIC_NOP &&
- handler != STATIC_UNMAP)
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-/*-------------------------------------------------
- memory_init_allocate - allocate memory for
- CPU address spaces
--------------------------------------------------*/
-
-static void memory_init_allocate(running_machine *machine)
-{
- int cpunum, spacenum;
-
- /* loop over all CPUs and memory spaces */
- for (cpunum = 0; cpunum < ARRAY_LENGTH(cpudata); cpunum++)
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- if (cpudata[cpunum].spacemask & (1 << spacenum))
- {
- address_space *space = &cpudata[cpunum].space[spacenum];
- address_map_entry *unassigned = NULL;
- address_map_entry *entry;
- memory_block *prev_memblock_head = memory_block_list;
- memory_block *memblock;
-
- /* make a first pass over the memory map and track blocks with hardcoded pointers */
- /* we do this to make sure they are found by memory_find_base first */
- for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
- if (entry->memory != NULL)
- allocate_memory_block(machine, cpunum, spacenum, entry->bytestart, entry->byteend, entry->memory);
-
- /* loop over all blocks just allocated and assign pointers from them */
- for (memblock = memory_block_list; memblock != prev_memblock_head; memblock = memblock->next)
- unassigned = assign_intersecting_blocks(space, memblock->bytestart, memblock->byteend, memblock->data);
-
- /* if we don't have an unassigned pointer yet, try to find one */
- if (unassigned == NULL)
- unassigned = assign_intersecting_blocks(space, ~0, 0, NULL);
-
- /* loop until we've assigned all memory in this space */
- while (unassigned != NULL)
- {
- offs_t curbytestart, curbyteend;
- int changed;
- void *block;
-
- /* work in MEMORY_BLOCK_CHUNK-sized chunks */
- offs_t curblockstart = unassigned->bytestart / MEMORY_BLOCK_CHUNK;
- offs_t curblockend = unassigned->byteend / MEMORY_BLOCK_CHUNK;
-
- /* loop while we keep finding unassigned blocks in neighboring MEMORY_BLOCK_CHUNK chunks */
- do
- {
- changed = FALSE;
-
- /* scan for unmapped blocks in the adjusted map */
- for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
- if (entry->memory == NULL && entry != unassigned && amentry_needs_backing_store(cpunum, spacenum, entry))
- {
- offs_t blockstart, blockend;
-
- /* get block start/end blocks for this block */
- blockstart = entry->bytestart / MEMORY_BLOCK_CHUNK;
- blockend = entry->byteend / MEMORY_BLOCK_CHUNK;
-
- /* if we intersect or are adjacent, adjust the start/end */
- if (blockstart <= curblockend + 1 && blockend >= curblockstart - 1)
- {
- if (blockstart < curblockstart)
- curblockstart = blockstart, changed = TRUE;
- if (blockend > curblockend)
- curblockend = blockend, changed = TRUE;
- }
- }
- } while (changed);
-
- /* we now have a block to allocate; do it */
- curbytestart = curblockstart * MEMORY_BLOCK_CHUNK;
- curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1);
- block = allocate_memory_block(machine, cpunum, spacenum, curbytestart, curbyteend, NULL);
-
- /* assign memory that intersected the new block */
- unassigned = assign_intersecting_blocks(space, curbytestart, curbyteend, block);
- }
- }
-}
+/***************************************************************************
+ MEMORY BLOCK ALLOCATION
+***************************************************************************/
/*-------------------------------------------------
- allocate_memory_block - allocate a single
+ block_allocate - allocate a single
memory block of data
-------------------------------------------------*/
-static void *allocate_memory_block(running_machine *machine, int cpunum, int spacenum, offs_t bytestart, offs_t byteend, void *memory)
+static void *block_allocate(const address_space *space, offs_t bytestart, offs_t byteend, void *memory)
{
+ memory_private *memdata = space->machine->memory_data;
int allocatemem = (memory == NULL);
memory_block *block;
size_t bytestoalloc;
const char *region;
- VPRINTF(("allocate_memory_block(%d,%d,%08X,%08X,%p)\n", cpunum, spacenum, bytestart, byteend, memory));
+ VPRINTF(("block_allocate('%s',%s,%08X,%08X,%p)\n", space->cpu->tag, space->name, bytestart, byteend, memory));
/* determine how much memory to allocate for this */
bytestoalloc = sizeof(*block);
@@ -2597,57 +2809,50 @@ static void *allocate_memory_block(running_machine *machine, int cpunum, int spa
memory = block + 1;
/* register for saving, but only if we're not part of a memory region */
- for (region = memory_region_next(machine, NULL); region != NULL; region = memory_region_next(machine, region))
+ for (region = memory_region_next(space->machine, NULL); region != NULL; region = memory_region_next(space->machine, region))
{
- UINT8 *region_base = memory_region(machine, region);
- UINT32 region_length = memory_region_length(machine, region);
+ UINT8 *region_base = memory_region(space->machine, region);
+ UINT32 region_length = memory_region_length(space->machine, region);
if (region_base != NULL && region_length != 0 && (UINT8 *)memory >= region_base && ((UINT8 *)memory + (byteend - bytestart + 1)) < region_base + region_length)
{
VPRINTF(("skipping save of this memory block as it is covered by a memory region\n"));
break;
}
}
+
+ /* if we didn't find a match, register */
if (region == NULL)
- register_for_save(cpunum, spacenum, bytestart, memory, byteend - bytestart + 1);
+ {
+ int bytes_per_element = space->dbits/8;
+ char name[256];
+
+ sprintf(name, "%08x-%08x", bytestart, byteend);
+ state_save_register_memory("memory", space->cpu->tag, space->spacenum, name, memory, bytes_per_element, (UINT32)(byteend - bytestart + 1) / bytes_per_element);
+ }
/* fill in the tracking block */
- block->cpunum = cpunum;
- block->spacenum = spacenum;
+ block->space = space;
block->isallocated = allocatemem;
block->bytestart = bytestart;
block->byteend = byteend;
block->data = memory;
/* attach us to the head of the list */
- block->next = memory_block_list;
- memory_block_list = block;
+ block->next = memdata->memory_block_list;
+ memdata->memory_block_list = block;
return memory;
}
/*-------------------------------------------------
- register_for_save - register a block of
- memory for save states
--------------------------------------------------*/
-
-static void register_for_save(int cpunum, int spacenum, offs_t bytestart, void *base, size_t numbytes)
-{
- int bytes_per_element = cpudata[cpunum].space[spacenum].dbits/8;
- char name[256];
-
- sprintf(name, "%08x-%08x", bytestart, (int)(bytestart + numbytes - 1));
- state_save_register_memory("memory", address_space_names[spacenum], cpunum, name, base, bytes_per_element, (UINT32)numbytes / bytes_per_element);
-}
-
-
-/*-------------------------------------------------
- assign_intersecting_blocks - find all
+ block_assign_intersecting - find all
intersecting blocks and assign their pointers
-------------------------------------------------*/
-static address_map_entry *assign_intersecting_blocks(address_space *space, offs_t bytestart, offs_t byteend, UINT8 *base)
+static address_map_entry *block_assign_intersecting(address_space *space, offs_t bytestart, offs_t byteend, UINT8 *base)
{
+ memory_private *memdata = space->machine->memory_data;
address_map_entry *entry, *unassigned = NULL;
/* loop over the adjusted map and assign memory to any blocks we can */
@@ -2657,9 +2862,9 @@ static address_map_entry *assign_intersecting_blocks(address_space *space, offs_
if (entry->memory == NULL)
{
/* inherit shared pointers first */
- if (entry->share != 0 && shared_ptr[entry->share] != NULL)
+ if (entry->share != 0 && memdata->shared_ptr[entry->share] != NULL)
{
- entry->memory = shared_ptr[entry->share];
+ entry->memory = memdata->shared_ptr[entry->share];
VPRINTF(("memory range %08X-%08X -> shared_ptr[%d] [%p]\n", entry->addrstart, entry->addrend, entry->share, entry->memory));
}
@@ -2672,11 +2877,11 @@ static address_map_entry *assign_intersecting_blocks(address_space *space, offs_
}
/* if we're the first match on a shared pointer, assign it now */
- if (entry->memory != NULL && entry->share && shared_ptr[entry->share] == NULL)
- shared_ptr[entry->share] = entry->memory;
+ if (entry->memory != NULL && entry->share && memdata->shared_ptr[entry->share] == NULL)
+ memdata->shared_ptr[entry->share] = entry->memory;
/* keep track of the first unassigned entry */
- if (entry->memory == NULL && unassigned == NULL && amentry_needs_backing_store(cpu_get_index(space->cpu), space->spacenum, entry))
+ if (entry->memory == NULL && unassigned == NULL && space_needs_backing_store(space, entry))
unassigned = entry;
}
@@ -2684,120 +2889,10 @@ static address_map_entry *assign_intersecting_blocks(address_space *space, offs_
}
-/*-------------------------------------------------
- reattach_banks - reconnect banks after a load
--------------------------------------------------*/
-
-static STATE_POSTLOAD( reattach_banks )
-{
- int banknum;
-
- /* once this is done, find the starting bases for the banks */
- for (banknum = 1; banknum <= MAX_BANKS; banknum++)
- if (bankdata[banknum].used && !bankdata[banknum].dynamic)
- {
- /* if this entry has a changed entry, set the appropriate pointer */
- if (bankdata[banknum].curentry != MAX_BANK_ENTRIES)
- bank_ptr[banknum] = bankdata[banknum].entry[bankdata[banknum].curentry];
- }
-}
-
-
-/*-------------------------------------------------
- memory_init_locate - find all the requested pointers
- into the final allocated memory
--------------------------------------------------*/
-
-static void memory_init_locate(running_machine *machine)
-{
- int cpunum, spacenum, banknum;
-
- /* loop over CPUs and address spaces */
- for (cpunum = 0; cpunum < ARRAY_LENGTH(cpudata); cpunum++)
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- if (cpudata[cpunum].spacemask & (1 << spacenum))
- {
- address_space *space = &cpudata[cpunum].space[spacenum];
- const address_map_entry *entry;
-
- /* fill in base/size entries, and handle shared memory */
- for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
- {
- /* assign base/size values */
- if (entry->baseptr != NULL)
- *entry->baseptr = entry->memory;
- if (entry->baseptroffs_plus1 != 0)
- *(void **)((UINT8 *)machine->driver_data + entry->baseptroffs_plus1 - 1) = entry->memory;
- if (entry->sizeptr != NULL)
- *entry->sizeptr = entry->byteend - entry->bytestart + 1;
- if (entry->sizeptroffs_plus1 != 0)
- *(size_t *)((UINT8 *)machine->driver_data + entry->sizeptroffs_plus1 - 1) = entry->byteend - entry->bytestart + 1;
- }
- }
-
- /* once this is done, find the starting bases for the banks */
- for (banknum = 1; banknum <= MAX_BANKS; banknum++)
- if (bankdata[banknum].used)
- {
- address_map_entry *entry;
-
- /* set the initial bank pointer */
- for (entry = cpudata[bankdata[banknum].cpunum].space[bankdata[banknum].spacenum].map->entrylist; entry != NULL; entry = entry->next)
- if (entry->bytestart == bankdata[banknum].bytestart)
- {
- bank_ptr[banknum] = entry->memory;
- VPRINTF(("assigned bank %d pointer to memory from range %08X-%08X [%p]\n", banknum, entry->addrstart, entry->addrend, entry->memory));
- break;
- }
-
- /* if the entry was set ahead of time, override the automatically found pointer */
- if (!bankdata[banknum].dynamic && bankdata[banknum].curentry != MAX_BANK_ENTRIES)
- bank_ptr[banknum] = bankdata[banknum].entry[bankdata[banknum].curentry];
- }
-
- /* request a callback to fix up the banks when done */
- state_save_register_postload(machine, reattach_banks, NULL);
-}
-
-
-/*-------------------------------------------------
- memory_find_base - return a pointer to the
- base of RAM associated with the given CPU
- and offset
--------------------------------------------------*/
-
-static void *memory_find_base(int cpunum, int spacenum, offs_t byteaddress)
-{
- address_space *space = &cpudata[cpunum].space[spacenum];
- address_map_entry *entry;
- memory_block *block;
-
- VPRINTF(("memory_find_base(%d,%d,%08X) -> ", cpunum, spacenum, byteaddress));
-
- /* look in the address map first */
- for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
- {
- offs_t maskoffs = byteaddress & entry->bytemask;
- if (maskoffs >= entry->bytestart && maskoffs <= entry->byteend)
- {
- VPRINTF(("found in entry %08X-%08X [%p]\n", entry->addrstart, entry->addrend, (UINT8 *)entry->memory + (maskoffs - entry->bytestart)));
- return (UINT8 *)entry->memory + (maskoffs - entry->bytestart);
- }
- }
-
- /* if not found there, look in the allocated blocks */
- for (block = memory_block_list; block != NULL; block = block->next)
- if (block->cpunum == cpunum && block->spacenum == spacenum && block->bytestart <= byteaddress && block->byteend > byteaddress)
- {
- VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart, block->byteend, block->data + (byteaddress - block->bytestart)));
- return block->data + byteaddress - block->bytestart;
- }
-
- VPRINTF(("did not find\n"));
- return NULL;
-}
-
+/***************************************************************************
+ INTERNAL HANDLERS
+***************************************************************************/
/*-------------------------------------------------
unmapped memory handlers
@@ -2805,40 +2900,40 @@ static void *memory_find_base(int cpunum, int spacenum, offs_t byteaddress)
static READ8_HANDLER( unmap_read8 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory byte read from %08X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset));
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory byte read from %08X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset));
return space->unmap;
}
static READ16_HANDLER( unmap_read16 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory word read from %08X & %04X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset*2), mem_mask);
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory word read from %08X & %04X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset*2), mem_mask);
return space->unmap;
}
static READ32_HANDLER( unmap_read32 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory dword read from %08X & %08X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset*4), mem_mask);
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory dword read from %08X & %08X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset*4), mem_mask);
return space->unmap;
}
static READ64_HANDLER( unmap_read64 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory qword read from %08X & %08X%08X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset*8), (int)(mem_mask >> 32), (int)(mem_mask & 0xffffffff));
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory qword read from %08X & %08X%08X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset*8), (int)(mem_mask >> 32), (int)(mem_mask & 0xffffffff));
return space->unmap;
}
static WRITE8_HANDLER( unmap_write8 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory byte write to %08X = %02X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset), data);
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory byte write to %08X = %02X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset), data);
}
static WRITE16_HANDLER( unmap_write16 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory word write to %08X = %04X & %04X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset*2), data, mem_mask);
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory word write to %08X = %04X & %04X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset*2), data, mem_mask);
}
static WRITE32_HANDLER( unmap_write32 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory dword write to %08X = %08X & %08X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset*4), data, mem_mask);
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory dword write to %08X = %08X & %08X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset*4), data, mem_mask);
}
static WRITE64_HANDLER( unmap_write64 )
{
- if (log_unmap[space->spacenum] && !debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory qword write to %08X = %08X%08X & %08X%08X\n", space->cpu->tag, cpu_get_pc(space->cpu), address_space_names[space->spacenum], cpu_byte_to_address(space->cpu, space->spacenum, offset*8), (int)(data >> 32), (int)(data & 0xffffffff), (int)(mem_mask >> 32), (int)(mem_mask & 0xffffffff));
+ if (space->log_unmap && !space->debugger_access) logerror("CPU '%s' (PC=%08X): unmapped %s memory qword write to %08X = %08X%08X & %08X%08X\n", space->cpu->tag, cpu_get_pc(space->cpu), space->name, cpu_byte_to_address(space->cpu, space->spacenum, offset*8), (int)(data >> 32), (int)(data & 0xffffffff), (int)(mem_mask >> 32), (int)(mem_mask & 0xffffffff));
}
@@ -2863,82 +2958,98 @@ static WRITE64_HANDLER( nop_write64 ) { }
static READ8_HANDLER( watchpoint_read8 )
{
- address_space *modspace = (address_space *)space;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->readlookup;
UINT8 result;
- debug_cpu_memory_read_hook(modspace->machine, cur_context, modspace->spacenum, offset, 0xff);
- modspace->readlookup = space->read.table;
- result = read_byte_generic(modspace, offset);
- modspace->readlookup = wptable;
+
+ debug_cpu_memory_read_hook(spacerw, offset, 0xff);
+ spacerw->readlookup = space->read.table;
+ result = read_byte_generic(spacerw, offset);
+ spacerw->readlookup = oldtable;
return result;
}
static READ16_HANDLER( watchpoint_read16 )
{
- address_space *modspace = (address_space *)space;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->readlookup;
UINT16 result;
- debug_cpu_memory_read_hook(modspace->machine, cur_context, modspace->spacenum, offset << 1, mem_mask);
- modspace->readlookup = modspace->read.table;
- result = read_word_generic(modspace, offset << 1, mem_mask);
- modspace->readlookup = wptable;
+
+ debug_cpu_memory_read_hook(spacerw, offset << 1, mem_mask);
+ spacerw->readlookup = spacerw->read.table;
+ result = read_word_generic(spacerw, offset << 1, mem_mask);
+ spacerw->readlookup = oldtable;
return result;
}
static READ32_HANDLER( watchpoint_read32 )
{
- address_space *modspace = (address_space *)space;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->readlookup;
UINT32 result;
- debug_cpu_memory_read_hook(modspace->machine, cur_context, modspace->spacenum, offset << 2, mem_mask);
- modspace->readlookup = modspace->read.table;
- result = read_dword_generic(modspace, offset << 2, mem_mask);
- modspace->readlookup = wptable;
+
+ debug_cpu_memory_read_hook(spacerw, offset << 2, mem_mask);
+ spacerw->readlookup = spacerw->read.table;
+ result = read_dword_generic(spacerw, offset << 2, mem_mask);
+ spacerw->readlookup = oldtable;
return result;
}
static READ64_HANDLER( watchpoint_read64 )
{
- address_space *modspace = (address_space *)space;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->readlookup;
UINT64 result;
- debug_cpu_memory_read_hook(modspace->machine, cur_context, modspace->spacenum, offset << 3, mem_mask);
- modspace->readlookup = modspace->read.table;
- result = read_qword_generic(modspace, offset << 3, mem_mask);
- modspace->readlookup = wptable;
+
+ debug_cpu_memory_read_hook(spacerw, offset << 3, mem_mask);
+ spacerw->readlookup = spacerw->read.table;
+ result = read_qword_generic(spacerw, offset << 3, mem_mask);
+ spacerw->readlookup = oldtable;
return result;
}
static WRITE8_HANDLER( watchpoint_write8 )
{
- address_space *modspace = (address_space *)space;
- debug_cpu_memory_write_hook(modspace->machine, cur_context, modspace->spacenum, offset, data, 0xff);
- modspace->writelookup = modspace->write.table;
- write_byte_generic(modspace, offset, data);
- modspace->writelookup = wptable;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->writelookup;
+
+ debug_cpu_memory_write_hook(spacerw, offset, data, 0xff);
+ spacerw->writelookup = spacerw->write.table;
+ write_byte_generic(spacerw, offset, data);
+ spacerw->writelookup = oldtable;
}
static WRITE16_HANDLER( watchpoint_write16 )
{
- address_space *modspace = (address_space *)space;
- debug_cpu_memory_write_hook(modspace->machine, cur_context, modspace->spacenum, offset << 1, data, mem_mask);
- modspace->writelookup = modspace->write.table;
- write_word_generic(modspace, offset << 1, data, mem_mask);
- modspace->writelookup = wptable;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->writelookup;
+
+ debug_cpu_memory_write_hook(spacerw, offset << 1, data, mem_mask);
+ spacerw->writelookup = spacerw->write.table;
+ write_word_generic(spacerw, offset << 1, data, mem_mask);
+ spacerw->writelookup = oldtable;
}
static WRITE32_HANDLER( watchpoint_write32 )
{
- address_space *modspace = (address_space *)space;
- debug_cpu_memory_write_hook(modspace->machine, cur_context, modspace->spacenum, offset << 2, data, mem_mask);
- modspace->writelookup = modspace->write.table;
- write_dword_generic(modspace, offset << 2, data, mem_mask);
- modspace->writelookup = wptable;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->writelookup;
+
+ debug_cpu_memory_write_hook(spacerw, offset << 2, data, mem_mask);
+ spacerw->writelookup = spacerw->write.table;
+ write_dword_generic(spacerw, offset << 2, data, mem_mask);
+ spacerw->writelookup = oldtable;
}
static WRITE64_HANDLER( watchpoint_write64 )
{
- address_space *modspace = (address_space *)space;
- debug_cpu_memory_write_hook(modspace->machine, cur_context, modspace->spacenum, offset << 3, data, mem_mask);
- modspace->writelookup = modspace->write.table;
- write_qword_generic(modspace, offset << 3, data, mem_mask);
- modspace->writelookup = wptable;
+ address_space *spacerw = (address_space *)space;
+ UINT8 *oldtable = spacerw->writelookup;
+
+ debug_cpu_memory_write_hook(spacerw, offset << 3, data, mem_mask);
+ spacerw->writelookup = spacerw->write.table;
+ write_qword_generic(spacerw, offset << 3, data, mem_mask);
+ spacerw->writelookup = oldtable;
}
@@ -2983,8 +3094,14 @@ static genf *get_static_handler(int handlerbits, int readorwrite, int which)
}
+
+/***************************************************************************
+ DEBUGGING
+***************************************************************************/
+
/*-------------------------------------------------
- debugging
+ handler_to_string - return friendly string
+ description of a handler
-------------------------------------------------*/
static const char *handler_to_string(const address_table *table, UINT8 entry)
@@ -3018,6 +3135,12 @@ static const char *handler_to_string(const address_table *table, UINT8 entry)
return table->handlers[entry]->name ? table->handlers[entry]->name : "???";
}
+
+/*-------------------------------------------------
+ dump_map - dump the contents of a single
+ address space
+-------------------------------------------------*/
+
static void dump_map(FILE *file, const address_space *space, const address_table *table)
{
int l1count = 1 << LEVEL1_BITS;
@@ -3113,56 +3236,11 @@ static void dump_map(FILE *file, const address_space *space, const address_table
table->handlers[lastentry]->bytestart);
}
-void memory_dump(FILE *file)
-{
- int cpunum, spacenum;
-
- /* skip if we can't open the file */
- if (!file)
- return;
-
- /* loop over CPUs */
- for (cpunum = 0; cpunum < ARRAY_LENGTH(cpudata); cpunum++)
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- if (cpudata[cpunum].spacemask & (1 << spacenum))
- {
- fprintf(file, "\n\n"
- "=========================================\n"
- "CPU %d address space %d read handler dump\n"
- "=========================================\n", cpunum, spacenum);
- dump_map(file, &cpudata[cpunum].space[spacenum], &cpudata[cpunum].space[spacenum].read);
-
- fprintf(file, "\n\n"
- "==========================================\n"
- "CPU %d address space %d write handler dump\n"
- "==========================================\n", cpunum, spacenum);
- dump_map(file, &cpudata[cpunum].space[spacenum], &cpudata[cpunum].space[spacenum].write);
- }
-}
-
/*-------------------------------------------------
- memory_get_handler_string - return a string
- describing the handler at a particular offset
+ mem_dump - internal memory dump
-------------------------------------------------*/
-const char *memory_get_handler_string(int read0_or_write1, int cpunum, int spacenum, offs_t byteaddress)
-{
- address_space *space = &cpudata[cpunum].space[spacenum];
- const address_table *table = read0_or_write1 ? &space->write : &space->read;
- UINT8 entry;
-
- /* perform the lookup */
- byteaddress &= space->bytemask;
- entry = table->table[LEVEL1_INDEX(byteaddress)];
- if (entry >= SUBTABLE_BASE)
- entry = table->table[LEVEL2_INDEX(entry, byteaddress)];
-
- /* 8-bit case: RAM/ROM */
- return handler_to_string(table, entry);
-}
-
-
static void mem_dump(void)
{
FILE *file;
@@ -3172,7 +3250,7 @@ static void mem_dump(void)
file = fopen("memdump.log", "w");
if (file)
{
- memory_dump(file);
+ memory_dump(Machine, file);
fclose(file);
}
}
diff --git a/src/emu/memory.h b/src/emu/memory.h
index ebb8b02f597..2ffb0007ad8 100644
--- a/src/emu/memory.h
+++ b/src/emu/memory.h
@@ -110,7 +110,7 @@ struct _direct_read_data
};
-/* opcode base adjustment handler */
+/* direct region update handler */
typedef offs_t (*direct_update_func) (ATTR_UNUSED const address_space *space, ATTR_UNUSED offs_t address, ATTR_UNUSED direct_read_data *direct);
@@ -140,23 +140,21 @@ typedef void (*write64_device_func)(ATTR_UNUSED const device_config *device, ATT
typedef struct _data_accessors data_accessors;
struct _data_accessors
{
- void (*change_pc)(offs_t byteaddress);
-
- UINT8 (*read_byte)(offs_t byteaddress);
- UINT16 (*read_word)(offs_t byteaddress);
- UINT16 (*read_word_masked)(offs_t byteaddress, UINT16 mask);
- UINT32 (*read_dword)(offs_t byteaddress);
- UINT32 (*read_dword_masked)(offs_t byteaddress, UINT32 mask);
- UINT64 (*read_qword)(offs_t byteaddress);
- UINT64 (*read_qword_masked)(offs_t byteaddress, UINT64 mask);
-
- void (*write_byte)(offs_t byteaddress, UINT8 data);
- void (*write_word)(offs_t byteaddress, UINT16 data);
- void (*write_word_masked)(offs_t byteaddress, UINT16 data, UINT16 mask);
- void (*write_dword)(offs_t byteaddress, UINT32 data);
- void (*write_dword_masked)(offs_t byteaddress, UINT32 data, UINT32 mask);
- void (*write_qword)(offs_t byteaddress, UINT64 data);
- void (*write_qword_masked)(offs_t byteaddress, UINT64 data, UINT64 mask);
+ UINT8 (*read_byte)(const address_space *space, offs_t byteaddress);
+ UINT16 (*read_word)(const address_space *space, offs_t byteaddress);
+ UINT16 (*read_word_masked)(const address_space *space, offs_t byteaddress, UINT16 mask);
+ UINT32 (*read_dword)(const address_space *space, offs_t byteaddress);
+ UINT32 (*read_dword_masked)(const address_space *space, offs_t byteaddress, UINT32 mask);
+ UINT64 (*read_qword)(const address_space *space, offs_t byteaddress);
+ UINT64 (*read_qword_masked)(const address_space *space, offs_t byteaddress, UINT64 mask);
+
+ void (*write_byte)(const address_space *space, offs_t byteaddress, UINT8 data);
+ void (*write_word)(const address_space *space, offs_t byteaddress, UINT16 data);
+ void (*write_word_masked)(const address_space *space, offs_t byteaddress, UINT16 data, UINT16 mask);
+ void (*write_dword)(const address_space *space, offs_t byteaddress, UINT32 data);
+ void (*write_dword_masked)(const address_space *space, offs_t byteaddress, UINT32 data, UINT32 mask);
+ void (*write_qword)(const address_space *space, offs_t byteaddress, UINT64 data);
+ void (*write_qword_masked)(const address_space *space, offs_t byteaddress, UINT64 data, UINT64 mask);
};
@@ -271,9 +269,11 @@ struct _address_table
/* Declared above: typedef struct _address_space address_space; */
struct _address_space
{
+ address_space * next; /* next address space in the global list */
running_machine * machine; /* reference to the owning machine */
const device_config * cpu; /* reference to the owning CPU */
address_map * map; /* original memory map */
+ const char * name; /* friendly name of the address space */
UINT8 * readlookup; /* live lookup table for reads */
UINT8 * writelookup; /* live lookup table for writes */
data_accessors accessors; /* data access handlers */
@@ -287,6 +287,8 @@ struct _address_space
INT8 ashift; /* address shift */
UINT8 abits; /* address bits */
UINT8 dbits; /* data bits */
+ UINT8 debugger_access; /* treat accesses as coming from the debugger */
+ UINT8 log_unmap; /* log unmapped accesses in this space? */
address_table read; /* memory read lookup table */
address_table write; /* memory write lookup table */
};
@@ -548,75 +550,75 @@ union _addrmap64_token
#endif
/* wrappers for dynamic read handler installation */
-#define memory_install_read_handler(machine, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_handler(machine, cpu, space, start, end, mask, mirror, rhandler, (FPTR)NULL, #rhandler, NULL)
-#define memory_install_read8_handler(machine, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_handler8(machine, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-#define memory_install_read16_handler(machine, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_handler16(machine, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-#define memory_install_read32_handler(machine, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_handler32(machine, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-#define memory_install_read64_handler(machine, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_handler64(machine, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-
-#define memory_install_read_device_handler(device, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_device_handler(device, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-#define memory_install_read8_device_handler(device, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_device_handler8(device, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-#define memory_install_read16_device_handler(device, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_device_handler16(device, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-#define memory_install_read32_device_handler(device, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_device_handler32(device, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
-#define memory_install_read64_device_handler(device, cpu, space, start, end, mask, mirror, rhandler) \
- _memory_install_device_handler64(device, cpu, space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read_handler(space, start, end, mask, mirror, rhandler) \
+ _memory_install_handler(space, start, end, mask, mirror, rhandler, (FPTR)NULL, #rhandler, NULL)
+#define memory_install_read8_handler(space, start, end, mask, mirror, rhandler) \
+ _memory_install_handler8(space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read16_handler(space, start, end, mask, mirror, rhandler) \
+ _memory_install_handler16(space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read32_handler(space, start, end, mask, mirror, rhandler) \
+ _memory_install_handler32(space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read64_handler(space, start, end, mask, mirror, rhandler) \
+ _memory_install_handler64(space, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+
+#define memory_install_read_device_handler(space, device, start, end, mask, mirror, rhandler) \
+ _memory_install_device_handler(space, device, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read8_device_handler(space, device, start, end, mask, mirror, rhandler) \
+ _memory_install_device_handler8(space, device, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read16_device_handler(space, device, start, end, mask, mirror, rhandler) \
+ _memory_install_device_handler16(space, device, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read32_device_handler(space, device, start, end, mask, mirror, rhandler) \
+ _memory_install_device_handler32(space, device, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
+#define memory_install_read64_device_handler(space, device, start, end, mask, mirror, rhandler) \
+ _memory_install_device_handler64(space, device, start, end, mask, mirror, rhandler, NULL, #rhandler, NULL)
/* wrappers for dynamic write handler installation */
-#define memory_install_write_handler(machine, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_handler(machine, cpu, space, start, end, mask, mirror, (FPTR)NULL, whandler, NULL, #whandler)
-#define memory_install_write8_handler(machine, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_handler8(machine, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-#define memory_install_write16_handler(machine, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_handler16(machine, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-#define memory_install_write32_handler(machine, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_handler32(machine, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-#define memory_install_write64_handler(machine, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_handler64(machine, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-
-#define memory_install_write_device_handler(device, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_device_handler(device, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-#define memory_install_write8_device_handler(device, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_device_handler8(device, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-#define memory_install_write16_device_handler(device, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_device_handler16(device, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-#define memory_install_write32_device_handler(device, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_device_handler32(device, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
-#define memory_install_write64_device_handler(device, cpu, space, start, end, mask, mirror, whandler) \
- _memory_install_device_handler64(device, cpu, space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write_handler(space, start, end, mask, mirror, whandler) \
+ _memory_install_handler(space, start, end, mask, mirror, (FPTR)NULL, whandler, NULL, #whandler)
+#define memory_install_write8_handler(space, start, end, mask, mirror, whandler) \
+ _memory_install_handler8(space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write16_handler(space, start, end, mask, mirror, whandler) \
+ _memory_install_handler16(space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write32_handler(space, start, end, mask, mirror, whandler) \
+ _memory_install_handler32(space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write64_handler(space, start, end, mask, mirror, whandler) \
+ _memory_install_handler64(space, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+
+#define memory_install_write_device_handler(space, device, start, end, mask, mirror, whandler) \
+ _memory_install_device_handler(space, device, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write8_device_handler(space, device, start, end, mask, mirror, whandler) \
+ _memory_install_device_handler8(space, device, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write16_device_handler(space, device, start, end, mask, mirror, whandler) \
+ _memory_install_device_handler16(space, device, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write32_device_handler(space, device, start, end, mask, mirror, whandler) \
+ _memory_install_device_handler32(space, device, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
+#define memory_install_write64_device_handler(space, device, start, end, mask, mirror, whandler) \
+ _memory_install_device_handler64(space, device, start, end, mask, mirror, NULL, whandler, NULL, #whandler)
/* wrappers for dynamic read/write handler installation */
-#define memory_install_readwrite_handler(machine, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_handler(machine, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite8_handler(machine, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_handler8(machine, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite16_handler(machine, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_handler16(machine, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite32_handler(machine, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_handler32(machine, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite64_handler(machine, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_handler64(machine, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-
-#define memory_install_readwrite_device_handler(device, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_device_handler(device, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite8_device_handler(device, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_device_handler8(device, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite16_device_handler(device, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_device_handler16(device, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite32_device_handler(device, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_device_handler32(device, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
-#define memory_install_readwrite64_device_handler(device, cpu, space, start, end, mask, mirror, rhandler, whandler) \
- _memory_install_device_handler64(device, cpu, space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite_handler(space, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_handler(space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite8_handler(space, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_handler8(space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite16_handler(space, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_handler16(space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite32_handler(space, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_handler32(space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite64_handler(space, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_handler64(space, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+
+#define memory_install_readwrite_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_device_handler(space, device, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite8_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_device_handler8(space, device, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite16_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_device_handler16(space, device, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite32_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_device_handler32(space, device, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
+#define memory_install_readwrite64_device_handler(space, device, start, end, mask, mirror, rhandler, whandler) \
+ _memory_install_device_handler64(space, device, start, end, mask, mirror, rhandler, whandler, #rhandler, #whandler)
/* macros for accessing bytes and words within larger chunks */
@@ -881,7 +883,7 @@ union _addrmap64_token
GLOBAL VARIABLES
***************************************************************************/
-extern address_space * active_address_space[]; /* address spaces */
+extern const address_space * active_address_space[]; /* address spaces */
extern const char *const address_space_names[ADDRESS_SPACES];
@@ -897,12 +899,11 @@ extern const char *const address_space_names[ADDRESS_SPACES];
/* initialize the memory system */
void memory_init(running_machine *machine);
-/* set the current memory context */
-void memory_set_context(running_machine *machine, int activecpu);
+/* find an address space in our internal list; for faster access use cpu_get_address_space() */
+const address_space *memory_find_address_space(const device_config *cpu, int spacenum);
-/* get a pointer to the set of memory accessor functions based on the address space,
- databus width, and endianness */
-const data_accessors *memory_get_accessors(int spacenum, int databits, int endianness);
+/* set the current memory context - soon to be deprecated */
+void memory_set_context(running_machine *machine, int activecpu);
@@ -914,15 +915,12 @@ address_map *address_map_alloc(const machine_config *drv, const game_driver *dri
/* release allocated memory for an address map */
void address_map_free(address_map *map);
-/* return a pointer to the constructed address map for a CPU's address space */
-const address_map *memory_get_address_map(int cpunum, int spacenum);
-
/* ----- direct access control ----- */
/* registers an address range as having a decrypted data pointer */
-void memory_set_decrypted_region(int cpunum, offs_t addrstart, offs_t addrend, void *base);
+void memory_set_decrypted_region(const address_space *space, offs_t addrstart, offs_t addrend, void *base);
/* register a handler for opcode base changes on a given CPU */
direct_update_func memory_set_direct_update_handler(const address_space *space, direct_update_func function);
@@ -930,43 +928,89 @@ direct_update_func memory_set_direct_update_handler(const address_space *space,
/* called by CPU cores to update the opcode base for the given address */
int memory_set_direct_region(const address_space *space, offs_t byteaddress);
+/* return a pointer the memory byte provided in the given address space, or NULL if it is not mapped to a bank */
+void *memory_get_read_ptr(const address_space *space, offs_t byteaddress);
+
+/* return a pointer the memory byte provided in the given address space, or NULL if it is not mapped to a writeable bank */
+void *memory_get_write_ptr(const address_space *space, offs_t byteaddress);
+
+
+
+/* ----- memory banking ----- */
+
+/* configure the addresses for a bank */
+void memory_configure_bank(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride);
+
+/* configure the decrypted addresses for a bank */
+void memory_configure_bank_decrypted(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride);
+
+/* select one pre-configured entry to be the new bank base */
+void memory_set_bank(int banknum, int entrynum);
+
+/* return the currently selected bank */
+int memory_get_bank(int banknum);
+
+/* set the absolute address of a bank base */
+void memory_set_bankptr(int banknum, void *base);
+
+
+
+/* ----- dynamic address space mapping ----- */
+
+/* install a new memory handler into the given address space, returning a pointer to the memory backing it, if present */
+void *_memory_install_handler(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name);
+
+/* same as above but explicitly for 8-bit handlers */
+UINT8 *_memory_install_handler8(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_space_func rhandler, write8_space_func whandler, const char *rhandler_name, const char *whandler_name);
+
+/* same as above but explicitly for 16-bit handlers */
+UINT16 *_memory_install_handler16(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_space_func rhandler, write16_space_func whandler, const char *rhandler_name, const char *whandler_name);
+
+/* same as above but explicitly for 32-bit handlers */
+UINT32 *_memory_install_handler32(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_space_func rhandler, write32_space_func whandler, const char *rhandler_name, const char *whandler_name);
+
+/* same as above but explicitly for 64-bit handlers */
+UINT64 *_memory_install_handler64(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_space_func rhandler, write64_space_func whandler, const char *rhandler_name, const char *whandler_name);
+
+/* install a new device memory handler into the given address space, returning a pointer to the memory backing it, if present */
+void *_memory_install_device_handler(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name);
+
+/* same as above but explicitly for 8-bit handlers */
+UINT8 *_memory_install_device_handler8(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, write8_device_func whandler, const char *rhandler_name, const char *whandler_name);
+
+/* same as above but explicitly for 16-bit handlers */
+UINT16 *_memory_install_device_handler16(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, write16_device_func whandler, const char *rhandler_name, const char *whandler_name);
+
+/* same as above but explicitly for 32-bit handlers */
+UINT32 *_memory_install_device_handler32(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, write32_device_func whandler, const char *rhandler_name, const char *whandler_name);
+/* same as above but explicitly for 64-bit handlers */
+UINT64 *_memory_install_device_handler64(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, write64_device_func whandler, const char *rhandler_name, const char *whandler_name);
-/* return a base pointer to memory */
-void * memory_get_read_ptr(int cpunum, int spacenum, offs_t byteaddress);
-void * memory_get_write_ptr(int cpunum, int spacenum, offs_t byteaddress);
-void * memory_get_op_ptr(running_machine *machine, int cpunum, offs_t byteaddress, int arg);
-/* memory banking */
-void memory_configure_bank(int banknum, int startentry, int numentries, void *base, offs_t stride);
-void memory_configure_bank_decrypted(int banknum, int startentry, int numentries, void *base, offs_t stride);
-void memory_set_bank(int banknum, int entrynum);
-int memory_get_bank(int banknum);
-void memory_set_bankptr(int banknum, void *base);
+/* ----- debugger helpers ----- */
-/* debugging */
-void memory_set_debugger_access(int debugger);
-void memory_set_log_unmap(int spacenum, int log);
-int memory_get_log_unmap(int spacenum);
+/* return a string describing the handler at a particular offset */
+const char *memory_get_handler_string(const address_space *space, int read0_or_write1, offs_t byteaddress);
-/* dynamic address space mapping */
-void * _memory_install_handler (running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name);
-UINT8 * _memory_install_handler8 (running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_space_func rhandler, write8_space_func whandler, const char *rhandler_name, const char *whandler_name);
-UINT16 * _memory_install_handler16(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_space_func rhandler, write16_space_func whandler, const char *rhandler_name, const char *whandler_name);
-UINT32 * _memory_install_handler32(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_space_func rhandler, write32_space_func whandler, const char *rhandler_name, const char *whandler_name);
-UINT64 * _memory_install_handler64(running_machine *machine, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_space_func rhandler, write64_space_func whandler, const char *rhandler_name, const char *whandler_name);
+/* enable/disable read watchpoint tracking for a given address space */
+void memory_enable_read_watchpoints(const address_space *space, int enable);
-/* dynamic device address space mapping */
-void * _memory_install_device_handler (const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name);
-UINT8 * _memory_install_device_handler8 (const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, write8_device_func whandler, const char *rhandler_name, const char *whandler_name);
-UINT16 * _memory_install_device_handler16(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, write16_device_func whandler, const char *rhandler_name, const char *whandler_name);
-UINT32 * _memory_install_device_handler32(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, write32_device_func whandler, const char *rhandler_name, const char *whandler_name);
-UINT64 * _memory_install_device_handler64(const device_config *device, int cpunum, int spacenum, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, write64_device_func whandler, const char *rhandler_name, const char *whandler_name);
+/* enable/disable write watchpoint tracking for a given address space */
+void memory_enable_write_watchpoints(const address_space *space, int enable);
-/* memory debugging */
-void memory_dump(FILE *file);
-const char *memory_get_handler_string(int read0_or_write1, int cpunum, int spacenum, offs_t byteaddress);
+/* control whether subsequent accesses are treated as coming from the debugger */
+void memory_set_debugger_access(const address_space *space, int debugger);
+
+/* sets whether unmapped memory accesses should be logged or not */
+void memory_set_log_unmap(const address_space *space, int log);
+
+/* gets whether unmapped memory accesses are being logged or not */
+int memory_get_log_unmap(const address_space *space);
+
+/* dump the internal memory tables to the given file */
+void memory_dump(running_machine *machine, FILE *file);
@@ -981,22 +1025,37 @@ const char *memory_get_handler_string(int read0_or_write1, int cpunum, int space
INLINE UINT8 memory_read_byte(const address_space *space, offs_t byteaddress)
{
- return (*space->accessors.read_byte)(byteaddress);
+ return (*space->accessors.read_byte)(space, byteaddress);
}
INLINE UINT16 memory_read_word(const address_space *space, offs_t byteaddress)
{
- return (*space->accessors.read_word)(byteaddress);
+ return (*space->accessors.read_word)(space, byteaddress);
+}
+
+INLINE UINT16 memory_read_word_masked(const address_space *space, offs_t byteaddress, UINT16 mask)
+{
+ return (*space->accessors.read_word_masked)(space, byteaddress, mask);
}
INLINE UINT32 memory_read_dword(const address_space *space, offs_t byteaddress)
{
- return (*space->accessors.read_dword)(byteaddress);
+ return (*space->accessors.read_dword)(space, byteaddress);
+}
+
+INLINE UINT32 memory_read_dword_masked(const address_space *space, offs_t byteaddress, UINT32 mask)
+{
+ return (*space->accessors.read_dword_masked)(space, byteaddress, mask);
}
INLINE UINT64 memory_read_qword(const address_space *space, offs_t byteaddress)
{
- return (*space->accessors.read_qword)(byteaddress);
+ return (*space->accessors.read_qword)(space, byteaddress);
+}
+
+INLINE UINT64 memory_read_qword_masked(const address_space *space, offs_t byteaddress, UINT64 mask)
+{
+ return (*space->accessors.read_qword_masked)(space, byteaddress, mask);
}
@@ -1007,22 +1066,37 @@ INLINE UINT64 memory_read_qword(const address_space *space, offs_t byteaddress)
INLINE void memory_write_byte(const address_space *space, offs_t byteaddress, UINT8 data)
{
- (*space->accessors.write_byte)(byteaddress, data);
+ (*space->accessors.write_byte)(space, byteaddress, data);
}
INLINE void memory_write_word(const address_space *space, offs_t byteaddress, UINT16 data)
{
- (*space->accessors.write_word)(byteaddress, data);
+ (*space->accessors.write_word)(space, byteaddress, data);
+}
+
+INLINE void memory_write_word_masked(const address_space *space, offs_t byteaddress, UINT16 data, UINT16 mask)
+{
+ (*space->accessors.write_word_masked)(space, byteaddress, data, mask);
}
INLINE void memory_write_dword(const address_space *space, offs_t byteaddress, UINT32 data)
{
- (*space->accessors.write_dword)(byteaddress, data);
+ (*space->accessors.write_dword)(space, byteaddress, data);
+}
+
+INLINE void memory_write_dword_masked(const address_space *space, offs_t byteaddress, UINT32 data, UINT32 mask)
+{
+ (*space->accessors.write_dword_masked)(space, byteaddress, data, mask);
}
INLINE void memory_write_qword(const address_space *space, offs_t byteaddress, UINT64 data)
{
- (*space->accessors.write_qword)(byteaddress, data);
+ (*space->accessors.write_qword)(space, byteaddress, data);
+}
+
+INLINE void memory_write_qword_masked(const address_space *space, offs_t byteaddress, UINT64 data, UINT64 mask)
+{
+ (*space->accessors.write_qword_masked)(space, byteaddress, data, mask);
}
@@ -1112,11 +1186,6 @@ INLINE UINT64 memory_raw_read_qword(const address_space *space, offs_t byteaddre
}
-/*-------------------------------------------------
- program_* - shortcuts to the above for the
- active program address space
--------------------------------------------------*/
-
/***************************************************************************
FUNCTION PROTOTYPES FOR CORE READ/WRITE ROUTINES
diff --git a/src/mame/audio/atarijsa.c b/src/mame/audio/atarijsa.c
index 90605505367..51a1b707123 100644
--- a/src/mame/audio/atarijsa.c
+++ b/src/mame/audio/atarijsa.c
@@ -145,7 +145,7 @@ void atarijsa_init(running_machine *machine, const char *testport, int testmask)
/* install POKEY memory handlers */
if (has_pokey)
- memory_install_readwrite8_handler(machine, cpu_num, ADDRESS_SPACE_PROGRAM, 0x2c00, 0x2c0f, 0, 0, pokey1_r, pokey1_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[cpu_num], ADDRESS_SPACE_PROGRAM), 0x2c00, 0x2c0f, 0, 0, pokey1_r, pokey1_w);
init_save_state();
atarijsa_reset();
diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c
index 0563b53ad74..71878424c46 100644
--- a/src/mame/audio/cage.c
+++ b/src/mame/audio/cage.c
@@ -170,7 +170,7 @@ void cage_init(running_machine *machine, offs_t speedup)
timer[1] = timer_alloc(cage_timer_callback, NULL);
if (speedup)
- speedup_ram = memory_install_write32_handler(machine, cage_cpu, ADDRESS_SPACE_PROGRAM, speedup, speedup, 0, 0, speedup_w);
+ speedup_ram = memory_install_write32_handler(cpu_get_address_space(machine->cpu[cage_cpu], ADDRESS_SPACE_PROGRAM), speedup, speedup, 0, 0, speedup_w);
state_save_register_global(cpu_to_cage_ready);
state_save_register_global(cage_to_cpu_ready);
diff --git a/src/mame/audio/cinemat.c b/src/mame/audio/cinemat.c
index 6244c173690..ff7cc69632b 100644
--- a/src/mame/audio/cinemat.c
+++ b/src/mame/audio/cinemat.c
@@ -1599,7 +1599,7 @@ static WRITE8_HANDLER( qb3_sound_w )
static MACHINE_RESET( qb3_sound )
{
MACHINE_RESET_CALL(demon_sound);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x04, 0x04, 0, 0, qb3_sound_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x04, 0x04, 0, 0, qb3_sound_w);
/* this patch prevents the sound ROM from eating itself when command $0A is sent */
/* on a cube rotate */
diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c
index 0b027484bef..2321ba60c9e 100644
--- a/src/mame/audio/dcs.c
+++ b/src/mame/audio/dcs.c
@@ -924,7 +924,7 @@ void dcs_init(running_machine *machine)
dcs.sounddata = dcs.bootrom;
dcs.sounddata_words = dcs.bootrom_words;
dcs.sounddata_banks = dcs.sounddata_words / 0x1000;
- memory_configure_bank(20, 0, dcs.sounddata_banks, dcs.sounddata, 0x1000*2);
+ memory_configure_bank(machine, 20, 0, dcs.sounddata_banks, dcs.sounddata, 0x1000*2);
/* create the timers */
dcs.internal_timer = timer_alloc(internal_timer_callback, NULL);
@@ -986,7 +986,7 @@ void dcs2_init(running_machine *machine, int dram_in_mb, offs_t polling_offset)
}
dcs.sounddata_banks = dcs.sounddata_words / soundbank_words;
if (dcs.rev != 2)
- memory_configure_bank(20, 0, dcs.sounddata_banks, dcs.sounddata, soundbank_words*2);
+ memory_configure_bank(machine, 20, 0, dcs.sounddata_banks, dcs.sounddata, soundbank_words*2);
/* allocate memory for the SRAM */
dcs_sram = auto_malloc(0x8000*4);
@@ -1001,7 +1001,7 @@ void dcs2_init(running_machine *machine, int dram_in_mb, offs_t polling_offset)
/* install the speedup handler */
if (polling_offset)
- dcs_polling_base = memory_install_read16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, polling_offset, polling_offset, 0, 0, dcs_polling_r);
+ dcs_polling_base = memory_install_read16_handler(cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_DATA), polling_offset, polling_offset, 0, 0, dcs_polling_r);
/* allocate a watchdog timer for HLE transfers */
transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && dram_in_mb != 0);
@@ -1092,24 +1092,24 @@ static void sdrc_remap_memory(running_machine *machine)
/* if SRAM disabled, clean it out */
if (SDRC_SM_EN == 0)
{
- memory_install_readwrite32_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_PROGRAM, 0x0800, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, 0x0800, 0x37ff, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_PROGRAM), 0x0800, 0x3fff, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), 0x0800, 0x37ff, 0, 0, SMH_UNMAP, SMH_UNMAP);
}
/* otherwise, map the SRAM */
else
{
/* first start with a clean program map */
- memory_install_readwrite32_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_PROGRAM, 0x0800, 0x3fff, 0, 0, SMH_BANK21, SMH_BANK21);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_PROGRAM), 0x0800, 0x3fff, 0, 0, SMH_BANK21, SMH_BANK21);
memory_set_bankptr(21, dcs_sram + 0x4800);
/* set up the data map based on the SRAM banking */
/* map 0: ram from 0800-37ff */
if (SDRC_SM_BK == 0)
{
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, 0x0800, 0x17ff, 0, 0, SMH_BANK22, SMH_BANK22);
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, 0x1800, 0x27ff, 0, 0, SMH_BANK23, SMH_BANK23);
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, 0x2800, 0x37ff, 0, 0, SMH_BANK24, SMH_BANK24);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), 0x0800, 0x17ff, 0, 0, SMH_BANK22, SMH_BANK22);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), 0x1800, 0x27ff, 0, 0, SMH_BANK23, SMH_BANK23);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), 0x2800, 0x37ff, 0, 0, SMH_BANK24, SMH_BANK24);
memory_set_bankptr(22, dcs_sram + 0x0000);
memory_set_bankptr(23, dcs_sram + 0x1000);
memory_set_bankptr(24, dcs_sram + 0x2000);
@@ -1118,9 +1118,9 @@ static void sdrc_remap_memory(running_machine *machine)
/* map 1: nothing from 0800-17ff, alternate RAM at 1800-27ff, same RAM at 2800-37ff */
else
{
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, 0x0800, 0x17ff, 0, 0, SMH_UNMAP, SMH_UNMAP);
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, 0x1800, 0x27ff, 0, 0, SMH_BANK23, SMH_BANK23);
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, 0x2800, 0x37ff, 0, 0, SMH_BANK24, SMH_BANK24);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), 0x0800, 0x17ff, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), 0x1800, 0x27ff, 0, 0, SMH_BANK23, SMH_BANK23);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), 0x2800, 0x37ff, 0, 0, SMH_BANK24, SMH_BANK24);
memory_set_bankptr(23, dcs_sram + 0x3000);
memory_set_bankptr(24, dcs_sram + 0x2000);
}
@@ -1131,14 +1131,14 @@ static void sdrc_remap_memory(running_machine *machine)
{
int baseaddr = (SDRC_ROM_ST == 0) ? 0x0000 : (SDRC_ROM_ST == 1) ? 0x3000 : 0x3400;
int pagesize = (SDRC_ROM_SZ == 0 && SDRC_ROM_ST != 0) ? 4096 : 1024;
- memory_install_read16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, baseaddr, baseaddr + pagesize - 1, 0, 0, SMH_BANK25);
+ memory_install_read16_handler(cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_DATA), baseaddr, baseaddr + pagesize - 1, 0, 0, SMH_BANK25);
}
/* map the DRAM page as bank 26 */
if (SDRC_DM_ST != 0)
{
int baseaddr = (SDRC_DM_ST == 1) ? 0x0000 : (SDRC_DM_ST == 2) ? 0x3000 : 0x3400;
- memory_install_readwrite16_handler(machine, cpu_get_index(dcs.cpu), ADDRESS_SPACE_DATA, baseaddr, baseaddr + 0x3ff, 0, 0, SMH_BANK26, SMH_BANK26);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(dcs.cpu)], ADDRESS_SPACE_DATA), baseaddr, baseaddr + 0x3ff, 0, 0, SMH_BANK26, SMH_BANK26);
}
/* update the bank pointers */
diff --git a/src/mame/audio/jaguar.c b/src/mame/audio/jaguar.c
index cb57f6d0529..38109536f01 100644
--- a/src/mame/audio/jaguar.c
+++ b/src/mame/audio/jaguar.c
@@ -271,7 +271,7 @@ void cojag_sound_init(running_machine *machine)
}
#if ENABLE_SPEEDUP_HACKS
- memory_install_write32_handler(machine, 2, ADDRESS_SPACE_PROGRAM, 0xf1a100, 0xf1a103, 0, 0, dsp_flags_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0xf1a100, 0xf1a103, 0, 0, dsp_flags_w);
#endif
}
diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c
index eb3ef56d8d6..8920b690ccf 100644
--- a/src/mame/audio/leland.c
+++ b/src/mame/audio/leland.c
@@ -1419,11 +1419,11 @@ static WRITE16_HANDLER( i80186_internal_port_w )
temp = (i80186.mem.peripheral & 0xffc0) << 4;
if (i80186.mem.middle_size & 0x0040)
- memory_install_readwrite16_handler(space->machine, 2, ADDRESS_SPACE_PROGRAM, temp, temp + 0x2ff, 0, 0, peripheral_r, peripheral_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(space->cpu, ADDRESS_SPACE_PROGRAM), temp, temp + 0x2ff, 0, 0, peripheral_r, peripheral_w);
else
{
temp &= 0xffff;
- memory_install_readwrite16_handler(space->machine, 2, ADDRESS_SPACE_IO, temp, temp + 0x2ff, 0, 0, peripheral_r, peripheral_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(space->cpu, ADDRESS_SPACE_IO), temp, temp + 0x2ff, 0, 0, peripheral_r, peripheral_w);
}
/* we need to do this at a time when the 80186 context is swapped in */
@@ -1488,11 +1488,11 @@ static WRITE16_HANDLER( i80186_internal_port_w )
/* okay to leave us mapped where we were */
temp = (data & 0x0fff) << 8;
if (data & 0x1000)
- memory_install_readwrite16_handler(space->machine, 2, ADDRESS_SPACE_PROGRAM, temp, temp + 0xff, 0, 0, i80186_internal_port_r, i80186_internal_port_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(space->cpu, ADDRESS_SPACE_PROGRAM), temp, temp + 0xff, 0, 0, i80186_internal_port_r, i80186_internal_port_w);
else
{
temp &= 0xffff;
- memory_install_readwrite16_handler(space->machine, 2, ADDRESS_SPACE_IO, temp, temp + 0xff, 0, 0, i80186_internal_port_r, i80186_internal_port_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(space->cpu, ADDRESS_SPACE_IO), temp, temp + 0xff, 0, 0, i80186_internal_port_r, i80186_internal_port_w);
}
/* popmessage("Sound CPU reset");*/
break;
diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c
index f1228f0b5cf..d55f201d5be 100644
--- a/src/mame/audio/mario.c
+++ b/src/mame/audio/mario.c
@@ -267,9 +267,9 @@ static SOUND_START( mario )
if (audiocpu != -1 && machine->config->cpu[audiocpu].type != CPU_Z80)
{
state->eabank = 1;
- memory_install_read8_handler(machine, audiocpu, ADDRESS_SPACE_PROGRAM, 0x000, 0x7ff, 0, 0, SMH_BANK1);
- memory_configure_bank(1, 0, 1, memory_region(machine, "audio"), 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "audio") + 0x1000, 0x800);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[audiocpu], ADDRESS_SPACE_PROGRAM), 0x000, 0x7ff, 0, 0, SMH_BANK1);
+ memory_configure_bank(machine, 1, 0, 1, memory_region(machine, "audio"), 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "audio") + 0x1000, 0x800);
}
state_save_register_global(state->last);
diff --git a/src/mame/audio/namcoc7x.c b/src/mame/audio/namcoc7x.c
index d9544c6ce5e..3b7c297c5d6 100644
--- a/src/mame/audio/namcoc7x.c
+++ b/src/mame/audio/namcoc7x.c
@@ -89,7 +89,7 @@ void namcoc7x_on_driver_init(running_machine *machine)
// install speedup cheat
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
if (machine->config->cpu[cpunum].type == CPU_M37702)
- memory_install_readwrite16_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, 0x82, 0x83, 0, 0, speedup_r, speedup_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, speedup_r, speedup_w);
}
void namcoc7x_set_host_ram(UINT32 *hostram)
diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c
index b50c02c4eac..72f356c279c 100644
--- a/src/mame/audio/seibu.c
+++ b/src/mame/audio/seibu.c
@@ -105,11 +105,12 @@ static UINT8 decrypt_opcode(int a,int src)
void seibu_sound_decrypt(running_machine *machine,const char *cpu,int length)
{
+ const address_space *space = cputag_get_address_space(machine, cpu, ADDRESS_SPACE_PROGRAM);
UINT8 *decrypt = auto_malloc(length);
UINT8 *rom = memory_region(machine, cpu);
int i;
- memory_set_decrypted_region(mame_find_cpu_index(machine, cpu), 0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, (length < 0x10000) ? (length - 1) : 0x1fff, decrypt);
for (i = 0;i < length;i++)
{
@@ -120,7 +121,7 @@ void seibu_sound_decrypt(running_machine *machine,const char *cpu,int length)
}
if (length > 0x10000)
- memory_configure_bank_decrypted(1, 0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
+ memory_configure_bank_decrypted(machine, 1, 0, (length - 0x10000) / 0x8000, decrypt + 0x10000, 0x8000);
}
@@ -362,7 +363,7 @@ MACHINE_RESET( seibu_sound )
sound_cpu=mame_find_cpu_index(machine, "audio");
update_irq_lines(machine, VECTOR_INIT);
if (romlength > 0x10000)
- memory_configure_bank(1, 0, (romlength - 0x10000) / 0x8000, rom + 0x10000, 0x8000);
+ memory_configure_bank(machine, 1, 0, (romlength - 0x10000) / 0x8000, rom + 0x10000, 0x8000);
}
/***************************************************************************/
diff --git a/src/mame/audio/williams.c b/src/mame/audio/williams.c
index 3bf7c0e2d39..0a90953a45b 100644
--- a/src/mame/audio/williams.c
+++ b/src/mame/audio/williams.c
@@ -282,7 +282,7 @@ void williams_cvsd_init(int pianum)
D3 -> A16
*/
offs_t offset = 0x8000 * ((bank >> 2) & 3) + 0x20000 * (bank & 3);
- memory_configure_bank(5, bank, 1, &ROM[0x10000 + offset], 0);
+ memory_configure_bank(Machine, 5, bank, 1, &ROM[0x10000 + offset], 0);
}
memory_set_bank(5, 0);
@@ -314,7 +314,7 @@ void williams_narc_init(void)
D3 -> A16
*/
offs_t offset = 0x8000 * (bank & 1) + 0x10000 * ((bank >> 3) & 1) + 0x20000 * ((bank >> 1) & 3);
- memory_configure_bank(5, bank, 1, &ROM[0x10000 + offset], 0);
+ memory_configure_bank(Machine, 5, bank, 1, &ROM[0x10000 + offset], 0);
}
memory_set_bankptr(6, &ROM[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
@@ -328,7 +328,7 @@ void williams_narc_init(void)
D3 -> A16
*/
offs_t offset = 0x8000 * (bank & 1) + 0x10000 * ((bank >> 3) & 1) + 0x20000 * ((bank >> 1) & 3);
- memory_configure_bank(7, bank, 1, &ROM[0x10000 + offset], 0);
+ memory_configure_bank(Machine, 7, bank, 1, &ROM[0x10000 + offset], 0);
}
memory_set_bankptr(8, &ROM[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
@@ -349,7 +349,7 @@ void williams_adpcm_init(void)
/* configure banks */
ROM = memory_region(Machine, "adpcm");
- memory_configure_bank(5, 0, 8, &ROM[0x10000], 0x8000);
+ memory_configure_bank(Machine, 5, 0, 8, &ROM[0x10000], 0x8000);
memory_set_bankptr(6, &ROM[0x10000 + 0x4000 + 7 * 0x8000]);
/* expand ADPCM data */
diff --git a/src/mame/drivers/1942.c b/src/mame/drivers/1942.c
index 0458b3ddd33..efbc3a65724 100644
--- a/src/mame/drivers/1942.c
+++ b/src/mame/drivers/1942.c
@@ -478,7 +478,7 @@ ROM_END
static DRIVER_INIT( 1942 )
{
UINT8 *ROM = memory_region(machine, "main");
- memory_configure_bank(1, 0, 3, &ROM[0x10000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 3, &ROM[0x10000], 0x4000);
}
diff --git a/src/mame/drivers/40love.c b/src/mame/drivers/40love.c
index 9cb0c4c7f51..6e690cec422 100644
--- a/src/mame/drivers/40love.c
+++ b/src/mame/drivers/40love.c
@@ -598,7 +598,7 @@ static READ8_HANDLER( undoukai_mcu_status_r )
static DRIVER_INIT( undoukai )
{
UINT8 *ROM = memory_region(machine, "main");
- memory_configure_bank(1, 0, 2, &ROM[0x10000], 0x2000);
+ memory_configure_bank(machine, 1, 0, 2, &ROM[0x10000], 0x2000);
from_mcu = 0xff;
mcu_cmd = -1;
@@ -612,7 +612,7 @@ static DRIVER_INIT( undoukai )
static DRIVER_INIT( 40love )
{
UINT8 *ROM = memory_region(machine, "main");
- memory_configure_bank(1, 0, 2, &ROM[0x10000], 0x2000);
+ memory_configure_bank(machine, 1, 0, 2, &ROM[0x10000], 0x2000);
#if 0
/* character ROM hack
diff --git a/src/mame/drivers/actfancr.c b/src/mame/drivers/actfancr.c
index 89396bf6ce7..9d8db9bf9fb 100644
--- a/src/mame/drivers/actfancr.c
+++ b/src/mame/drivers/actfancr.c
@@ -576,12 +576,12 @@ static READ8_HANDLER( cyclej_r )
static DRIVER_INIT( actfancr )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f0026, 0x1f0027, 0, 0, cycle_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f0026, 0x1f0027, 0, 0, cycle_r);
}
static DRIVER_INIT( actfancj )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f0026, 0x1f0027, 0, 0, cyclej_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f0026, 0x1f0027, 0, 0, cyclej_r);
}
diff --git a/src/mame/drivers/airbustr.c b/src/mame/drivers/airbustr.c
index 3a5f941ddea..2ac262c4852 100644
--- a/src/mame/drivers/airbustr.c
+++ b/src/mame/drivers/airbustr.c
@@ -762,7 +762,7 @@ ROM_END
static DRIVER_INIT( airbustr )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, devram_r); // protection device lives here
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xefff, 0, 0, devram_r); // protection device lives here
}
diff --git a/src/mame/drivers/aladbl.c b/src/mame/drivers/aladbl.c
index 76e5844bb31..e43acad6a0e 100644
--- a/src/mame/drivers/aladbl.c
+++ b/src/mame/drivers/aladbl.c
@@ -156,8 +156,8 @@ static READ16_HANDLER( aladbl_r )
static DRIVER_INIT( aladbl )
{
// 220000 = writes to mcu? 330000 = reads?
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x220000, 0x220001, 0, 0, aladbl_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x330000, 0x330001, 0, 0, aladbl_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x220000, 0x220001, 0, 0, aladbl_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x330000, 0x330001, 0, 0, aladbl_r);
DRIVER_INIT_CALL(megadrij);
}
diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c
index 237c9839f91..e564f3ed879 100644
--- a/src/mame/drivers/alg.c
+++ b/src/mame/drivers/alg.c
@@ -203,11 +203,11 @@ static void alg_cia_0_porta_w(UINT8 data)
/* swap the write handlers between ROM and bank 1 based on the bit */
if ((data & 1) == 0)
/* overlay disabled, map RAM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
else
/* overlay enabled, map Amiga system ROM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
}
@@ -659,8 +659,8 @@ static void alg_init(running_machine *machine)
amiga_machine_config(machine, &alg_intf);
/* set up memory */
- memory_configure_bank(1, 0, 1, amiga_chip_ram, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "user1"), 0);
+ memory_configure_bank(machine, 1, 0, 1, amiga_chip_ram, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user1"), 0);
}
diff --git a/src/mame/drivers/alpha68k.c b/src/mame/drivers/alpha68k.c
index 95dc930d2ba..496579561a7 100644
--- a/src/mame/drivers/alpha68k.c
+++ b/src/mame/drivers/alpha68k.c
@@ -3135,7 +3135,7 @@ static DRIVER_INIT( jongbou )
alpha68k_video_banking = jongbou_video_banking;
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0c0001, 0, 0, jongbou_inputs_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0c0000, 0x0c0001, 0, 0, jongbou_inputs_r);
}
static DRIVER_INIT( paddlema )
@@ -3146,7 +3146,7 @@ static DRIVER_INIT( paddlema )
static DRIVER_INIT( timesold )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40008, 0x40009, 0, 0, timesold_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40008, 0x40009, 0, 0, timesold_cycle_r);
invert_controls=0;
microcontroller_id=0;
coin_id=0x22|(0x22<<8);
@@ -3154,7 +3154,7 @@ static DRIVER_INIT( timesold )
static DRIVER_INIT( timesol1 )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40008, 0x40009, 0, 0, timesol1_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40008, 0x40009, 0, 0, timesol1_cycle_r);
invert_controls=1;
microcontroller_id=0;
coin_id=0x22|(0x22<<8);
@@ -3162,7 +3162,7 @@ static DRIVER_INIT( timesol1 )
static DRIVER_INIT( btlfield )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40008, 0x40009, 0, 0, btlfield_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40008, 0x40009, 0, 0, btlfield_cycle_r);
invert_controls=1;
microcontroller_id=0;
coin_id=0x22|(0x22<<8);
@@ -3177,7 +3177,7 @@ static DRIVER_INIT( btlfildb )
static DRIVER_INIT( skysoldr )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40008, 0x40009, 0, 0, skysoldr_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40008, 0x40009, 0, 0, skysoldr_cycle_r);
memory_set_bankptr(8, (memory_region(machine, "user1"))+0x40000);
invert_controls=0;
microcontroller_id=0;
@@ -3201,7 +3201,7 @@ static DRIVER_INIT( goldmeda )
static DRIVER_INIT( skyadvnt )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40008, 0x40009, 0, 0, skyadvnt_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40008, 0x40009, 0, 0, skyadvnt_cycle_r);
invert_controls=0;
microcontroller_id=0x8814;
coin_id=0x22|(0x22<<8);
@@ -3209,7 +3209,7 @@ static DRIVER_INIT( skyadvnt )
static DRIVER_INIT( skyadvnu )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40008, 0x40009, 0, 0, skyadvnt_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40008, 0x40009, 0, 0, skyadvnt_cycle_r);
invert_controls=0;
microcontroller_id=0x8814;
coin_id=0x23|(0x24<<8);
@@ -3217,7 +3217,7 @@ static DRIVER_INIT( skyadvnu )
static DRIVER_INIT( gangwars )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40206, 0x40207, 0, 0, gangwars_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40206, 0x40207, 0, 0, gangwars_cycle_r);
memory_set_bankptr(8, memory_region(machine, "user1"));
invert_controls=0;
microcontroller_id=0x8512;
@@ -3226,7 +3226,7 @@ static DRIVER_INIT( gangwars )
static DRIVER_INIT( gangwarb )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40206, 0x40207, 0, 0, gangwarb_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x40206, 0x40207, 0, 0, gangwarb_cycle_r);
memory_set_bankptr(8, memory_region(machine, "user1"));
invert_controls=0;
microcontroller_id=0x8512;
diff --git a/src/mame/drivers/appoooh.c b/src/mame/drivers/appoooh.c
index 84ac4e2b41a..11a74d8baf6 100644
--- a/src/mame/drivers/appoooh.c
+++ b/src/mame/drivers/appoooh.c
@@ -554,7 +554,8 @@ static DRIVER_INIT(robowres){
}
static DRIVER_INIT(robowrb){
- memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, "main") + 0x1c000);
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "main") + 0x1c000);
}
diff --git a/src/mame/drivers/arabian.c b/src/mame/drivers/arabian.c
index cbd3774ce99..93371c14828 100644
--- a/src/mame/drivers/arabian.c
+++ b/src/mame/drivers/arabian.c
@@ -436,8 +436,8 @@ ROM_END
static DRIVER_INIT( arabian )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd34b, 0xd34b, 0, 0, custom_flip_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd400, 0xd401, 0, 0, custom_cocktail_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd34b, 0xd34b, 0, 0, custom_flip_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd400, 0xd401, 0, 0, custom_cocktail_w);
}
diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c
index edf791e6ee7..184f91a0a84 100644
--- a/src/mame/drivers/arcadia.c
+++ b/src/mame/drivers/arcadia.c
@@ -72,7 +72,7 @@ static UINT8 coin_counter[2];
static WRITE16_HANDLER( arcadia_multibios_change_game )
{
- memory_install_read16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x800000, 0x97ffff, 0, 0, (data == 0) ? SMH_BANK2 : SMH_NOP);
+ memory_install_read16_handler(space, 0x800000, 0x97ffff, 0, 0, (data == 0) ? SMH_BANK2 : SMH_NOP);
}
@@ -105,11 +105,11 @@ static void arcadia_cia_0_porta_w(UINT8 data)
/* swap the write handlers between ROM and bank 1 based on the bit */
if ((data & 1) == 0)
/* overlay disabled, map RAM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
else
/* overlay enabled, map Amiga system ROM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
/* bit 2 = Power Led on Amiga */
set_led_status(0, (data & 2) ? 0 : 1);
@@ -670,8 +670,8 @@ static void arcadia_init(running_machine *machine)
amiga_machine_config(machine, &arcadia_intf);
/* set up memory */
- memory_configure_bank(1, 0, 1, amiga_chip_ram, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "user1"), 0);
+ memory_configure_bank(machine, 1, 0, 1, amiga_chip_ram, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user1"), 0);
/* OnePlay bios is encrypted, TenPlay is not */
biosrom = (UINT16 *)memory_region(machine, "user2");
diff --git a/src/mame/drivers/arkanoid.c b/src/mame/drivers/arkanoid.c
index 13270705827..dc7151b41bb 100644
--- a/src/mame/drivers/arkanoid.c
+++ b/src/mame/drivers/arkanoid.c
@@ -1100,9 +1100,9 @@ ROM_END
static void arkanoid_bootleg_init( running_machine *machine )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf002, 0xf002, 0, 0, arkanoid_bootleg_f002_r );
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd018, 0xd018, 0, 0, arkanoid_bootleg_d018_w );
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd008, 0xd008, 0, 0, arkanoid_bootleg_d008_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf002, 0xf002, 0, 0, arkanoid_bootleg_f002_r );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd018, 0xd018, 0, 0, arkanoid_bootleg_d018_w );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd008, 0xd008, 0, 0, arkanoid_bootleg_d008_r );
}
static DRIVER_INIT( arkangc )
diff --git a/src/mame/drivers/artmagic.c b/src/mame/drivers/artmagic.c
index 6a39796eb7f..5ce6a40da81 100644
--- a/src/mame/drivers/artmagic.c
+++ b/src/mame/drivers/artmagic.c
@@ -879,7 +879,7 @@ static DRIVER_INIT( ultennis )
protection_handler = ultennis_protection;
/* additional (protection?) hack */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x300000, 0x300001, 0, 0, ultennis_hack_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x300000, 0x300001, 0, 0, ultennis_hack_r);
}
diff --git a/src/mame/drivers/asteroid.c b/src/mame/drivers/asteroid.c
index 96830740d7a..d97ff5291dd 100644
--- a/src/mame/drivers/asteroid.c
+++ b/src/mame/drivers/asteroid.c
@@ -879,14 +879,14 @@ ROM_END
static DRIVER_INIT( asteroib )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2000, 0, 0, input_port_read_handler8(machine->portconfig, "IN0"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2003, 0x2003, 0, 0, input_port_read_handler8(machine->portconfig, "HS"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2000, 0, 0, input_port_read_handler8(machine->portconfig, "IN0"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2003, 0x2003, 0, 0, input_port_read_handler8(machine->portconfig, "HS"));
}
static DRIVER_INIT( asterock )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2007, 0, 0, asterock_IN0_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2007, 0, 0, asterock_IN0_r);
}
diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c
index dea78ca7429..fb49b3bd875 100644
--- a/src/mame/drivers/astrocde.c
+++ b/src/mame/drivers/astrocde.c
@@ -421,12 +421,12 @@ static WRITE8_HANDLER( profpac_banksw_w )
profpac_bank = data;
/* set the main banking */
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0xbfff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(space, 0x4000, 0xbfff, 0, 0, SMH_BANK1);
memory_set_bankptr(1, memory_region(space->machine, "user1") + 0x8000 * bank);
/* bank 0 reads video RAM in the 4000-7FFF range */
if (bank == 0)
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, profpac_videoram_r);
+ memory_install_read8_handler(space, 0x4000, 0x7fff, 0, 0, profpac_videoram_r);
/* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */
if ((data & 0x80) && memory_region(space->machine, "user2") != NULL)
@@ -437,11 +437,11 @@ static WRITE8_HANDLER( profpac_banksw_w )
/* if the bank is in range, map the appropriate bank */
if (bank < 0x28)
{
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_BANK2);
+ memory_install_read8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK2);
memory_set_bankptr(2, memory_region(space->machine, "user2") + 0x4000 * bank);
}
else
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_UNMAP);
+ memory_install_read8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_UNMAP);
}
}
@@ -1672,48 +1672,48 @@ ROM_END
static DRIVER_INIT( seawolf2 )
{
astrocade_video_config = 0x00;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x40, 0x40, 0, 0xff18, seawolf2_sound_1_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x41, 0x41, 0, 0xff18, seawolf2_sound_2_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x42, 0x43, 0, 0xff18, seawolf2_lamps_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x40, 0x40, 0, 0xff18, seawolf2_sound_1_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x41, 0x41, 0, 0xff18, seawolf2_sound_2_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x42, 0x43, 0, 0xff18, seawolf2_lamps_w);
}
static DRIVER_INIT( ebases )
{
astrocade_video_config = AC_SOUND_PRESENT;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x20, 0x20, 0, 0xff07, ebases_coin_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x28, 0x28, 0, 0xff07, ebases_trackball_select_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x20, 0x20, 0, 0xff07, ebases_coin_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x28, 0x28, 0, 0xff07, ebases_trackball_select_w);
}
static DRIVER_INIT( spacezap )
{
astrocade_video_config = AC_SOUND_PRESENT;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x13, 0x13, 0x03ff, 0xff00, spacezap_io_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x13, 0x13, 0x03ff, 0xff00, spacezap_io_r);
}
static DRIVER_INIT( wow )
{
astrocade_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x15, 0x15, 0x0fff, 0xff00, wow_io_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x17, 0x17, 0xffff, 0xff00, wow_speech_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x15, 0x15, 0x0fff, 0xff00, wow_io_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x17, 0x17, 0xffff, 0xff00, wow_speech_r);
}
static DRIVER_INIT( gorf )
{
astrocade_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x15, 0x15, 0x0fff, 0xff00, gorf_io_1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x16, 0x16, 0x0fff, 0xff00, gorf_io_2_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x17, 0x17, 0xffff, 0xff00, gorf_speech_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x15, 0x15, 0x0fff, 0xff00, gorf_io_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x16, 0x16, 0x0fff, 0xff00, gorf_io_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x17, 0x17, 0xffff, 0xff00, gorf_speech_r);
}
static DRIVER_INIT( robby )
{
astrocade_video_config = AC_SOUND_PRESENT;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x15, 0x15, 0x0fff, 0xff00, robby_io_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x15, 0x15, 0x0fff, 0xff00, robby_io_r);
}
@@ -1722,8 +1722,8 @@ static DRIVER_INIT( profpac )
const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
astrocade_video_config = AC_SOUND_PRESENT;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x14, 0x14, 0x0fff, 0xff00, profpac_io_1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x15, 0x15, 0x77ff, 0xff00, profpac_io_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x14, 0x14, 0x0fff, 0xff00, profpac_io_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x15, 0x15, 0x77ff, 0xff00, profpac_io_2_r);
/* reset banking */
profpac_banksw_w(space, 0, 0);
@@ -1736,10 +1736,10 @@ static DRIVER_INIT( demndrgn )
const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
astrocade_video_config = 0x00;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x14, 0x14, 0x1fff, 0xff00, demndrgn_io_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x1c, 0x1c, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREX"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x1d, 0x1d, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREY"));
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x97, 0x97, 0x0000, 0xff00, demndrgn_sound_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x14, 0x14, 0x1fff, 0xff00, demndrgn_io_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x1c, 0x1c, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREX"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x1d, 0x1d, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREY"));
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x97, 0x97, 0x0000, 0xff00, demndrgn_sound_w);
/* reset banking */
profpac_banksw_w(space, 0, 0);
@@ -1752,15 +1752,15 @@ static DRIVER_INIT( tenpindx )
const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
astrocade_video_config = 0x00;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x60, 0x60, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P60"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x61, 0x61, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P61"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x62, 0x62, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P62"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x63, 0x63, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P63"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x64, 0x64, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P64"));
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x65, 0x66, 0x0000, 0xff00, tenpindx_lamp_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x67, 0x67, 0x0000, 0xff00, tenpindx_counter_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x68, 0x68, 0x0000, 0xff00, tenpindx_lights_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x97, 0x97, 0x0000, 0xff00, tenpindx_sound_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x60, 0x60, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P60"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x61, 0x61, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P61"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x62, 0x62, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P62"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x63, 0x63, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P63"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x64, 0x64, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P64"));
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x65, 0x66, 0x0000, 0xff00, tenpindx_lamp_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x67, 0x67, 0x0000, 0xff00, tenpindx_counter_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x68, 0x68, 0x0000, 0xff00, tenpindx_lights_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x97, 0x97, 0x0000, 0xff00, tenpindx_sound_w);
/* reset banking */
profpac_banksw_w(space, 0, 0);
diff --git a/src/mame/drivers/astrof.c b/src/mame/drivers/astrof.c
index 149f9b319f0..8f271ac3c3a 100644
--- a/src/mame/drivers/astrof.c
+++ b/src/mame/drivers/astrof.c
@@ -1190,8 +1190,8 @@ static DRIVER_INIT( abattle )
rom[i] = prom[rom[i]];
/* set up protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa003, 0xa003, 0, 0, shoot_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa004, 0xa004, 0, 0, abattle_coin_prot_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa003, 0xa003, 0, 0, shoot_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa004, 0xa004, 0, 0, abattle_coin_prot_r);
}
@@ -1204,8 +1204,8 @@ static DRIVER_INIT( afire )
rom[i] = ~rom[i];
/* set up protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa003, 0xa003, 0, 0, shoot_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa004, 0xa004, 0, 0, afire_coin_prot_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa003, 0xa003, 0, 0, shoot_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa004, 0xa004, 0, 0, afire_coin_prot_r);
}
@@ -1218,8 +1218,8 @@ static DRIVER_INIT( sstarbtl )
rom[i] = ~rom[i];
/* set up protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa003, 0xa003, 0, 0, shoot_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa004, 0xa004, 0, 0, abattle_coin_prot_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa003, 0xa003, 0, 0, shoot_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa004, 0xa004, 0, 0, abattle_coin_prot_r);
}
diff --git a/src/mame/drivers/asuka.c b/src/mame/drivers/asuka.c
index a015a85280b..3ba6eadf44f 100644
--- a/src/mame/drivers/asuka.c
+++ b/src/mame/drivers/asuka.c
@@ -298,8 +298,8 @@ static WRITE8_HANDLER( asuka_msm5205_stop_w )
static MACHINE_START( asuka )
{
/* configure the banks */
- memory_configure_bank(1, 0, 1, memory_region(machine, "audio"), 0);
- memory_configure_bank(1, 1, 3, memory_region(machine, "audio") + 0x10000, 0x04000);
+ memory_configure_bank(machine, 1, 0, 1, memory_region(machine, "audio"), 0);
+ memory_configure_bank(machine, 1, 1, 3, memory_region(machine, "audio") + 0x10000, 0x04000);
state_save_register_global(adpcm_pos);
}
diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c
index d67123ebe85..726a59c3ebc 100644
--- a/src/mame/drivers/atarig1.c
+++ b/src/mame/drivers/atarig1.c
@@ -192,7 +192,7 @@ static READ16_HANDLER( pitfighb_cheap_slapstic_r )
static void pitfighb_cheap_slapstic_init(running_machine *machine)
{
/* install a read handler */
- bslapstic_base = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x038000, 0x03ffff, 0, 0, pitfighb_cheap_slapstic_r);
+ bslapstic_base = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x038000, 0x03ffff, 0, 0, pitfighb_cheap_slapstic_r);
/* allocate memory for a copy of bank 0 */
bslapstic_bank0 = auto_malloc(0x2000);
diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c
index 5aa9ecba9e3..46f336788fd 100644
--- a/src/mame/drivers/atarig42.c
+++ b/src/mame/drivers/atarig42.c
@@ -686,7 +686,7 @@ static DRIVER_INIT( roadriot )
atarig42_motion_object_base = 0x200;
atarig42_motion_object_mask = 0x1ff;
- sloop_base = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, roadriot_sloop_data_r, roadriot_sloop_data_w);
+ sloop_base = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, roadriot_sloop_data_r, roadriot_sloop_data_w);
memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), sloop_direct_handler);
asic65_config(machine, ASIC65_ROMBASED);
@@ -739,7 +739,7 @@ static DRIVER_INIT( guardian )
/* put an RTS there so we don't die */
*(UINT16 *)&memory_region(machine, "main")[0x80000] = 0x4E75;
- sloop_base = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, guardians_sloop_data_r, guardians_sloop_data_w);
+ sloop_base = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, guardians_sloop_data_r, guardians_sloop_data_w);
memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), sloop_direct_handler);
asic65_config(machine, ASIC65_GUARDIANS);
diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c
index 607f21cc5e3..12ad2054261 100644
--- a/src/mame/drivers/atarigt.c
+++ b/src/mame/drivers/atarigt.c
@@ -1077,7 +1077,7 @@ static DRIVER_INIT( tmek )
protection_w = tmek_protection_w;
/* temp hack */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd72000, 0xd75fff, 0, 0, tmek_pf_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd72000, 0xd75fff, 0, 0, tmek_pf_w);
}
diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c
index 024a8f374d6..35e9bac5383 100644
--- a/src/mame/drivers/atarigx2.c
+++ b/src/mame/drivers/atarigx2.c
@@ -2106,7 +2106,7 @@ static DRIVER_INIT( rrreveng )
atarigx2_motion_object_base = 0x400;
atarigx2_motion_object_mask = 0x3ff;
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xca0fc0, 0xca0fc3, 0, 0, rrreveng_prot_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xca0fc0, 0xca0fc3, 0, 0, rrreveng_prot_r);
}
diff --git a/src/mame/drivers/ataxx.c b/src/mame/drivers/ataxx.c
index 515de03125b..c1118937999 100644
--- a/src/mame/drivers/ataxx.c
+++ b/src/mame/drivers/ataxx.c
@@ -665,7 +665,7 @@ static DRIVER_INIT( ataxx )
leland_rotate_memory(machine, "slave");
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x03, 0, 0, ataxx_trackball_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x03, 0, 0, ataxx_trackball_r);
}
@@ -688,7 +688,7 @@ static DRIVER_INIT( ataxxj )
leland_rotate_memory(machine, "slave");
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x03, 0, 0, ataxx_trackball_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x03, 0, 0, ataxx_trackball_r);
}
@@ -711,9 +711,9 @@ static DRIVER_INIT( wsf )
leland_rotate_memory(machine, "slave");
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P1_P2"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P3_P4"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "BUTTONS"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P1_P2"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P3_P4"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "BUTTONS"));
}
@@ -736,14 +736,14 @@ static DRIVER_INIT( indyheat )
leland_rotate_memory(machine, "slave");
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x02, 0, 0, indyheat_wheel_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x08, 0x0b, 0, 0, indyheat_analog_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P1"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P2"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "P3"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x02, 0, 0, indyheat_wheel_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x08, 0x0b, 0, 0, indyheat_analog_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P1"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P2"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "P3"));
/* set up additional output ports */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x08, 0x0b, 0, 0, indyheat_analog_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x08, 0x0b, 0, 0, indyheat_analog_w);
}
@@ -766,9 +766,9 @@ static DRIVER_INIT( brutforc )
leland_rotate_memory(machine, "slave");
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P2"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P1"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "P3"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P2"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P1"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "P3"));
}
@@ -791,13 +791,13 @@ static DRIVER_INIT( asylum )
leland_rotate_memory(machine, "slave");
/* asylum appears to have some extra RAM for the slave CPU */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xf000, 0xfffb, 0, 0, SMH_BANK4, SMH_BANK4);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xf000, 0xfffb, 0, 0, SMH_BANK4, SMH_BANK4);
memory_set_bankptr(4, auto_malloc(0x1000));
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P2"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P1"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "P3"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0d, 0x0d, 0, 0, input_port_read_handler8(machine->portconfig, "P2"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0e, 0x0e, 0, 0, input_port_read_handler8(machine->portconfig, "P1"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, input_port_read_handler8(machine->portconfig, "P3"));
}
diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c
index 89837ed0eb4..5889c88e856 100644
--- a/src/mame/drivers/backfire.c
+++ b/src/mame/drivers/backfire.c
@@ -682,7 +682,7 @@ static DRIVER_INIT( backfire )
deco156_decrypt(machine);
cpu_set_clockscale(machine->cpu[0], 4.0f); /* core timings aren't accurate */
descramble_sound(machine);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0170018, 0x017001b, 0, 0, backfire_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0170018, 0x017001b, 0, 0, backfire_speedup_r );
}
GAME( 1995, backfire, 0, backfire, backfire, backfire, ROT0, "Data East Corporation", "Backfire! (set 1)", 0 )
diff --git a/src/mame/drivers/balsente.c b/src/mame/drivers/balsente.c
index 3a9aa645fec..03bec1c619f 100644
--- a/src/mame/drivers/balsente.c
+++ b/src/mame/drivers/balsente.c
@@ -1952,41 +1952,41 @@ static DRIVER_INIT( minigol2 ) { expand_roms(machine, 0x0c); balsente_sho
static DRIVER_INIT( toggle ) { expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; /* noanalog */ }
static DRIVER_INIT( nametune )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 0; /* noanalog */
}
static DRIVER_INIT( nstocker )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_NONE | SWAP_HALVES); balsente_shooter = 1; balsente_adc_shift = 1;
}
static DRIVER_INIT( sfootbal )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 0;
}
static DRIVER_INIT( spiker )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f80, 0x9f8f, 0, 0, spiker_expand_r, spiker_expand_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9f80, 0x9f8f, 0, 0, spiker_expand_r, spiker_expand_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, EXPAND_ALL | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 1;
}
static DRIVER_INIT( stompin )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9f00, 0x9f00, 0, 0, balsente_rombank2_select_w);
expand_roms(machine, 0x0c | SWAP_HALVES); balsente_shooter = 0; balsente_adc_shift = 32;
}
static DRIVER_INIT( rescraid ) { expand_roms(machine, EXPAND_NONE); balsente_shooter = 0; /* noanalog */ }
static DRIVER_INIT( grudge )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9400, 0x9400, 0, 0, grudge_steering_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9400, 0x9400, 0, 0, grudge_steering_r);
expand_roms(machine, EXPAND_NONE); balsente_shooter = 0;
}
static DRIVER_INIT( shrike )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9e00, 0x9fff, 0, 0, shrike_shared_6809_r, shrike_shared_6809_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9e01, 0x9e01, 0, 0, shrike_sprite_select_w );
- memory_install_readwrite16_handler(machine, 2, ADDRESS_SPACE_PROGRAM, 0x10000, 0x1001f, 0, 0, shrike_io_68k_r, shrike_io_68k_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9e00, 0x9fff, 0, 0, shrike_shared_6809_r, shrike_shared_6809_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9e01, 0x9e01, 0, 0, shrike_sprite_select_w );
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x10000, 0x1001f, 0, 0, shrike_io_68k_r, shrike_io_68k_w);
expand_roms(machine, EXPAND_ALL); balsente_shooter = 0; balsente_adc_shift = 32;
}
diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c
index d7b671c4c57..c81babd9441 100644
--- a/src/mame/drivers/beathead.c
+++ b/src/mame/drivers/beathead.c
@@ -514,8 +514,8 @@ static DRIVER_INIT( beathead )
atarijsa_init(machine, "IN2", 0x0040);
/* prepare the speedups */
- speedup_data = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000ae8, 0x00000aeb, 0, 0, speedup_r);
- movie_speedup_data = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000804, 0x00000807, 0, 0, movie_speedup_r);
+ speedup_data = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000ae8, 0x00000aeb, 0, 0, speedup_r);
+ movie_speedup_data = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000804, 0x00000807, 0, 0, movie_speedup_r);
}
diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c
index 7735eb0570b..7feaa3bf6b5 100644
--- a/src/mame/drivers/bfm_sc2.c
+++ b/src/mame/drivers/bfm_sc2.c
@@ -374,8 +374,8 @@ send data to them, although obviously there's no response. */
{
UINT8 *rom = memory_region(machine, "main");
- memory_configure_bank(1, 0, 1, &rom[0x10000], 0);
- memory_configure_bank(1, 1, 3, &rom[0x02000], 0x02000);
+ memory_configure_bank(machine, 1, 0, 1, &rom[0x10000], 0);
+ memory_configure_bank(machine, 1, 1, 3, &rom[0x02000], 0x02000);
memory_set_bank(1,3);
}
diff --git a/src/mame/drivers/blktiger.c b/src/mame/drivers/blktiger.c
index 1e1d5656823..9a74078aef7 100644
--- a/src/mame/drivers/blktiger.c
+++ b/src/mame/drivers/blktiger.c
@@ -246,7 +246,7 @@ static const ym2203_interface ym2203_config =
static MACHINE_START( blktiger )
{
/* configure bankswitching */
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
}
static MACHINE_DRIVER_START( blktiger )
diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c
index ec21cdf1d8d..1ae642b62f8 100644
--- a/src/mame/drivers/btime.c
+++ b/src/mame/drivers/btime.c
@@ -1640,19 +1640,20 @@ ROM_START( sdtennis )
ROM_LOAD( "ao_04.10f", 0x1000, 0x1000, CRC(921952af) SHA1(4e9248f3493a5f4651278f27c11f507571242317) )
ROM_END
-static void decrypt_C10707_cpu(running_machine *machine, int cpu, const char *cputag)
+static void decrypt_C10707_cpu(running_machine *machine, const char *cputag)
{
+ const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM);
UINT8 *decrypt = auto_malloc(0x10000);
UINT8 *rom = memory_region(machine, cputag);
offs_t addr;
- memory_set_decrypted_region(cpu, 0x0000, 0xffff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypt);
/* Swap bits 5 & 6 for opcodes */
for (addr = 0; addr < 0x10000; addr++)
decrypt[addr] = swap_bits_5_6(rom[addr]);
- if (cpu == 0)
+ if (space->cpu == machine->cpu[0])
decrypted = decrypt;
}
@@ -1671,10 +1672,11 @@ static READ8_HANDLER( wtennis_reset_hack_r )
static void init_rom1(running_machine *machine)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
decrypted = auto_malloc(0x10000);
- memory_set_decrypted_region(0, 0x0000, 0xffff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted);
/* For now, just copy the RAM array over to ROM. Decryption will happen */
/* at run time, since the CPU applies the decryption only if the previous */
@@ -1702,26 +1704,26 @@ static DRIVER_INIT( zoar )
static DRIVER_INIT( lnc )
{
- decrypt_C10707_cpu(machine, 0, "main");
+ decrypt_C10707_cpu(machine, "main");
}
static DRIVER_INIT( cookrace )
{
memcpy(&audio_rambase[0x200], memory_region(machine, "audio") + 0xf200, 0x200);
- decrypt_C10707_cpu(machine, 0, "main");
+ decrypt_C10707_cpu(machine, "main");
}
static DRIVER_INIT( wtennis )
{
memcpy(&audio_rambase[0x200], memory_region(machine, "audio") + 0xf200, 0x200);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc15f, 0xc15f, 0, 0, wtennis_reset_hack_r);
- decrypt_C10707_cpu(machine, 0, "main");
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc15f, 0xc15f, 0, 0, wtennis_reset_hack_r);
+ decrypt_C10707_cpu(machine, "main");
}
static DRIVER_INIT( sdtennis )
{
- decrypt_C10707_cpu(machine, 0, "main");
- decrypt_C10707_cpu(machine, 1, "audio");
+ decrypt_C10707_cpu(machine, "main");
+ decrypt_C10707_cpu(machine, "audio");
}
diff --git a/src/mame/drivers/bublbobl.c b/src/mame/drivers/bublbobl.c
index 9b559b68ecf..e257d209411 100644
--- a/src/mame/drivers/bublbobl.c
+++ b/src/mame/drivers/bublbobl.c
@@ -1286,7 +1286,7 @@ static DRIVER_INIT( tokio )
static DRIVER_INIT( tokiob )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfe00, 0xfe00, 0, 0, tokiob_mcu_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe00, 0xfe00, 0, 0, tokiob_mcu_r );
DRIVER_INIT_CALL(tokio);
}
diff --git a/src/mame/drivers/bzone.c b/src/mame/drivers/bzone.c
index c8b8d7129a0..a4829ff83a3 100644
--- a/src/mame/drivers/bzone.c
+++ b/src/mame/drivers/bzone.c
@@ -802,13 +802,13 @@ static WRITE8_HANDLER( analog_select_w )
static DRIVER_INIT( bradley )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400, 0x7ff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400, 0x7ff, 0, 0, SMH_BANK1, SMH_BANK1);
memory_set_bankptr(1, auto_malloc(0x400));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1808, 0x1808, 0, 0, input_port_read_handler8(machine->portconfig, "1808"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1809, 0x1809, 0, 0, input_port_read_handler8(machine->portconfig, "1809"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180a, 0x180a, 0, 0, analog_data_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1848, 0x1850, 0, 0, analog_select_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1808, 0x1808, 0, 0, input_port_read_handler8(machine->portconfig, "1808"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1809, 0x1809, 0, 0, input_port_read_handler8(machine->portconfig, "1809"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180a, 0x180a, 0, 0, analog_data_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1848, 0x1850, 0, 0, analog_select_w);
}
diff --git a/src/mame/drivers/calorie.c b/src/mame/drivers/calorie.c
index 495f4e1038a..573e63ef82b 100644
--- a/src/mame/drivers/calorie.c
+++ b/src/mame/drivers/calorie.c
@@ -463,7 +463,8 @@ static DRIVER_INIT( calorie )
static DRIVER_INIT( calorieb )
{
- memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, "main") + 0x10000);
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "main") + 0x10000);
}
diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c
index afcde0d6241..71e82696074 100644
--- a/src/mame/drivers/cave.c
+++ b/src/mame/drivers/cave.c
@@ -4108,7 +4108,7 @@ static DRIVER_INIT( agallet )
unpack_sprites(machine);
// Speed Hack
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb80000, 0xb80001, 0, 0, agallet_irq_cause_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb80000, 0xb80001, 0, 0, agallet_irq_cause_r);
}
static DRIVER_INIT( dfeveron )
diff --git a/src/mame/drivers/cbasebal.c b/src/mame/drivers/cbasebal.c
index 0f20b265bd0..1852ff9ec0a 100644
--- a/src/mame/drivers/cbasebal.c
+++ b/src/mame/drivers/cbasebal.c
@@ -306,7 +306,7 @@ ROM_END
static DRIVER_INIT( cbasebal )
{
- memory_configure_bank(1, 0, 32, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 32, memory_region(machine, "main") + 0x10000, 0x4000);
pang_decode(machine);
}
diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c
index a553a6e843e..da27b4b72f3 100644
--- a/src/mame/drivers/ccastles.c
+++ b/src/mame/drivers/ccastles.c
@@ -229,7 +229,7 @@ static MACHINE_START( ccastles )
video_screen_configure(machine->primary_screen, 320, 256, &visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
/* configure the ROM banking */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0xa000, 0x6000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0xa000, 0x6000);
/* create a timer for IRQs and set up the first callback */
irq_timer = timer_alloc(clock_irq, NULL);
diff --git a/src/mame/drivers/centiped.c b/src/mame/drivers/centiped.c
index bc7e3e99f27..3741af26a2b 100644
--- a/src/mame/drivers/centiped.c
+++ b/src/mame/drivers/centiped.c
@@ -1935,15 +1935,15 @@ ROM_END
static DRIVER_INIT( caterplr )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x100f, 0, 0, caterplr_AY8910_r, caterplr_AY8910_w);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1780, 0x1780, 0, 0, caterplr_rand_r);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000, 0x100f, 0, 0, caterplr_AY8910_r, caterplr_AY8910_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1780, 0x1780, 0, 0, caterplr_rand_r);
}
static DRIVER_INIT( magworm )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1001, 0x1001, 0, 0, ay8910_control_port_0_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1003, 0x1003, 0, 0, ay8910_read_port_0_r, ay8910_write_port_0_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1001, 0x1001, 0, 0, ay8910_control_port_0_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1003, 0x1003, 0, 0, ay8910_read_port_0_r, ay8910_write_port_0_w);
}
diff --git a/src/mame/drivers/chinsan.c b/src/mame/drivers/chinsan.c
index 043e75fdd3e..5f6789b6ff9 100644
--- a/src/mame/drivers/chinsan.c
+++ b/src/mame/drivers/chinsan.c
@@ -73,7 +73,7 @@ static VIDEO_UPDATE(chinsan)
static MACHINE_RESET( chinsan )
{
- memory_configure_bank(1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
}
diff --git a/src/mame/drivers/chqflag.c b/src/mame/drivers/chqflag.c
index 8814b8fc1ba..a517d69416a 100644
--- a/src/mame/drivers/chqflag.c
+++ b/src/mame/drivers/chqflag.c
@@ -54,18 +54,18 @@ static WRITE8_HANDLER( chqflag_bankswitch_w )
/* bit 5 = memory bank select */
if (data & 0x20)
{
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, SMH_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w);
+ memory_install_readwrite8_handler(space, 0x1800, 0x1fff, 0, 0, SMH_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w);
memory_set_bankptr(5, paletteram);
if (K051316_readroms)
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_rom_0_r, K051316_0_w); /* 051316 #1 (ROM test) */
+ memory_install_readwrite8_handler(space, 0x1000, 0x17ff, 0, 0, K051316_rom_0_r, K051316_0_w); /* 051316 #1 (ROM test) */
else
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, K051316_0_r, K051316_0_w); /* 051316 #1 */
+ memory_install_readwrite8_handler(space, 0x1000, 0x17ff, 0, 0, K051316_0_r, K051316_0_w); /* 051316 #1 */
}
else
{
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x17ff, 0, 0, SMH_BANK1, SMH_BANK1); /* RAM */
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x1fff, 0, 0, SMH_BANK2, SMH_BANK2); /* RAM */
+ memory_install_readwrite8_handler(space, 0x1000, 0x17ff, 0, 0, SMH_BANK1, SMH_BANK1); /* RAM */
+ memory_install_readwrite8_handler(space, 0x1800, 0x1fff, 0, 0, SMH_BANK2, SMH_BANK2); /* RAM */
}
/* other bits unknown/unused */
@@ -82,9 +82,9 @@ static WRITE8_HANDLER( chqflag_vreg_w )
/* bit 4 = enable rom reading thru K051316 #1 & #2 */
K051316_readroms = (data & 0x10);
if (K051316_readroms)
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2fff, 0, 0, K051316_rom_1_r); /* 051316 (ROM test) */
+ memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, K051316_rom_1_r); /* 051316 (ROM test) */
else
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x2800, 0x2fff, 0, 0, K051316_1_r); /* 051316 */
+ memory_install_read8_handler(space, 0x2800, 0x2fff, 0, 0, K051316_1_r); /* 051316 */
/* Bits 3-7 probably control palette dimming in a similar way to TMNT2/Saunset Riders, */
/* however I don't have enough evidence to determine the exact behaviour. */
diff --git a/src/mame/drivers/cidelsa.c b/src/mame/drivers/cidelsa.c
index 387e66addf0..8b52605246d 100644
--- a/src/mame/drivers/cidelsa.c
+++ b/src/mame/drivers/cidelsa.c
@@ -566,7 +566,7 @@ static MACHINE_START( draco )
/* setup COP402 memory banking */
- memory_configure_bank(1, 0, 2, memory_region(machine, "audio"), 0x400);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "audio"), 0x400);
memory_set_bank(1, 0);
/* register for state saving */
diff --git a/src/mame/drivers/cinemat.c b/src/mame/drivers/cinemat.c
index 4516ff3a4e3..89e5572108a 100644
--- a/src/mame/drivers/cinemat.c
+++ b/src/mame/drivers/cinemat.c
@@ -1438,36 +1438,36 @@ ROM_END
static DRIVER_INIT( speedfrk )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x03, 0, 0, speedfrk_wheel_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x04, 0x06, 0, 0, speedfrk_gear_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x03, 0, 0, speedfrk_wheel_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x04, 0x06, 0, 0, speedfrk_gear_r);
}
static DRIVER_INIT( sundance )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x0f, 0, 0, sundance_inputs_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x0f, 0, 0, sundance_inputs_r);
}
static DRIVER_INIT( tailg )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x07, 0x07, 0, 0, mux_select_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, mux_select_w);
}
static DRIVER_INIT( boxingb )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0c, 0x0f, 0, 0, boxingb_dial_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x07, 0x07, 0, 0, mux_select_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0c, 0x0f, 0, 0, boxingb_dial_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, mux_select_w);
}
static DRIVER_INIT( qb3 )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0f, 0x0f, 0, 0, qb3_frame_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0, qb3_ram_bank_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, qb3_frame_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0, qb3_ram_bank_w);
- memory_configure_bank(1, 0, 4, rambase, 0x100*2);
+ memory_configure_bank(machine, 1, 0, 4, rambase, 0x100*2);
}
diff --git a/src/mame/drivers/cischeat.c b/src/mame/drivers/cischeat.c
index c8f7f81e84b..16f3f1d9e6b 100644
--- a/src/mame/drivers/cischeat.c
+++ b/src/mame/drivers/cischeat.c
@@ -2703,7 +2703,7 @@ ROM_END
static DRIVER_INIT( wildplt )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x080000, 0x087fff, 0, 0, wildplt_vregs_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x080000, 0x087fff, 0, 0, wildplt_vregs_r );
DRIVER_INIT_CALL(f1gpstar);
}
diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c
index bf9bf8e6eb6..f587b40ca68 100644
--- a/src/mame/drivers/cninja.c
+++ b/src/mame/drivers/cninja.c
@@ -1769,13 +1769,13 @@ static void cninja_patch(running_machine *machine)
static DRIVER_INIT( cninja )
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1bc0a8, 0x1bc0a9, 0, 0, cninja_sound_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1bc0a8, 0x1bc0a9, 0, 0, cninja_sound_w);
cninja_patch(machine);
}
static DRIVER_INIT( stoneage )
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1bc0a8, 0x1bc0a9, 0, 0, stoneage_sound_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1bc0a8, 0x1bc0a9, 0, 0, stoneage_sound_w);
}
static DRIVER_INIT( mutantf )
diff --git a/src/mame/drivers/cojag.c b/src/mame/drivers/cojag.c
index bd11018181b..e6a3f973242 100644
--- a/src/mame/drivers/cojag.c
+++ b/src/mame/drivers/cojag.c
@@ -350,15 +350,15 @@ static MACHINE_RESET( cojag )
/* graphics banks */
if (cojag_is_r3000)
{
- memory_configure_bank(1, 0, 2, rom + 0x800000, 0x400000);
+ memory_configure_bank(machine, 1, 0, 2, rom + 0x800000, 0x400000);
memory_set_bank(1, 0);
}
- memory_configure_bank(8, 0, 2, rom + 0x800000, 0x400000);
+ memory_configure_bank(machine, 8, 0, 2, rom + 0x800000, 0x400000);
memory_set_bank(8, 0);
/* sound banks */
- memory_configure_bank(2, 0, 8, rom + 0x000000, 0x200000);
- memory_configure_bank(9, 0, 8, rom + 0x000000, 0x200000);
+ memory_configure_bank(machine, 2, 0, 8, rom + 0x000000, 0x200000);
+ memory_configure_bank(machine, 9, 0, 8, rom + 0x000000, 0x200000);
memory_set_bank(2, 0);
memory_set_bank(9, 0);
}
@@ -1508,10 +1508,10 @@ static void cojag_common_init(running_machine *machine, UINT16 gpu_jump_offs, UI
/* install synchronization hooks for GPU */
if (cojag_is_r3000)
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, 0, 0, gpu_jump_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, 0, 0, gpu_jump_w);
else
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, 0, 0, gpu_jump_w);
- memory_install_read32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, 0, 0, gpu_jump_r);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, 0, 0, gpu_jump_w);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, 0, 0, gpu_jump_r);
gpu_jump_address = &jaguar_gpu_ram[gpu_jump_offs/4];
gpu_spin_pc = 0xf03000 + spin_pc;
@@ -1526,7 +1526,7 @@ static DRIVER_INIT( area51a )
#if ENABLE_SPEEDUP_HACKS
/* install speedup for main CPU */
- main_speedup = memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa02030, 0xa02033, 0, 0, area51_main_speedup_w);
+ main_speedup = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa02030, 0xa02033, 0, 0, area51_main_speedup_w);
#endif
}
@@ -1538,7 +1538,7 @@ static DRIVER_INIT( area51 )
#if ENABLE_SPEEDUP_HACKS
/* install speedup for main CPU */
main_speedup_max_cycles = 120;
- main_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100062e8, 0x100062eb, 0, 0, cojagr3k_main_speedup_r);
+ main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100062e8, 0x100062eb, 0, 0, cojagr3k_main_speedup_r);
#endif
}
@@ -1552,7 +1552,7 @@ static DRIVER_INIT( maxforce )
#if ENABLE_SPEEDUP_HACKS
/* install speedup for main CPU */
main_speedup_max_cycles = 120;
- main_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000865c, 0x1000865f, 0, 0, cojagr3k_main_speedup_r);
+ main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000865c, 0x1000865f, 0, 0, cojagr3k_main_speedup_r);
#endif
}
@@ -1566,7 +1566,7 @@ static DRIVER_INIT( area51mx )
#if ENABLE_SPEEDUP_HACKS
/* install speedup for main CPU */
- main_speedup = memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa19550, 0xa19557, 0, 0, area51mx_main_speedup_w);
+ main_speedup = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa19550, 0xa19557, 0, 0, area51mx_main_speedup_w);
#endif
}
@@ -1581,7 +1581,7 @@ static DRIVER_INIT( a51mxr3k )
#if ENABLE_SPEEDUP_HACKS
/* install speedup for main CPU */
main_speedup_max_cycles = 120;
- main_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x10006f0c, 0x10006f0f, 0, 0, cojagr3k_main_speedup_r);
+ main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x10006f0c, 0x10006f0f, 0, 0, cojagr3k_main_speedup_r);
#endif
}
@@ -1593,7 +1593,7 @@ static DRIVER_INIT( fishfren )
#if ENABLE_SPEEDUP_HACKS
/* install speedup for main CPU */
main_speedup_max_cycles = 200;
- main_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x10021b60, 0x10021b63, 0, 0, cojagr3k_main_speedup_r);
+ main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x10021b60, 0x10021b63, 0, 0, cojagr3k_main_speedup_r);
#endif
}
@@ -1606,8 +1606,8 @@ static void init_freeze_common(running_machine *machine, offs_t main_speedup_add
/* install speedup for main CPU */
main_speedup_max_cycles = 200;
if (main_speedup_addr != 0)
- main_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, main_speedup_addr, main_speedup_addr + 3, 0, 0, cojagr3k_main_speedup_r);
- main_gpu_wait = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0400d900, 0x0400d900 + 3, 0, 0, main_gpu_wait_r);
+ main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), main_speedup_addr, main_speedup_addr + 3, 0, 0, cojagr3k_main_speedup_r);
+ main_gpu_wait = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0400d900, 0x0400d900 + 3, 0, 0, main_gpu_wait_r);
#endif
}
@@ -1626,7 +1626,7 @@ static DRIVER_INIT( vcircle )
#if ENABLE_SPEEDUP_HACKS
/* install speedup for main CPU */
main_speedup_max_cycles = 50;
- main_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x12005b34, 0x12005b37, 0, 0, cojagr3k_main_speedup_r);
+ main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x12005b34, 0x12005b37, 0, 0, cojagr3k_main_speedup_r);
#endif
}
diff --git a/src/mame/drivers/combatsc.c b/src/mame/drivers/combatsc.c
index 254733787ca..e8b8bd132ca 100644
--- a/src/mame/drivers/combatsc.c
+++ b/src/mame/drivers/combatsc.c
@@ -827,7 +827,7 @@ static DRIVER_INIT( combasct )
static DRIVER_INIT( combasc )
{
/* joystick instead of trackball */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0404, 0x0404, 0, 0, input_port_read_handler8(machine->portconfig, "IN1"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0404, 0x0404, 0, 0, input_port_read_handler8(machine->portconfig, "IN1"));
combasc_init_common();
}
diff --git a/src/mame/drivers/commando.c b/src/mame/drivers/commando.c
index e9ae5fea03d..136c377daa3 100644
--- a/src/mame/drivers/commando.c
+++ b/src/mame/drivers/commando.c
@@ -505,11 +505,12 @@ ROM_END
static DRIVER_INIT( commando )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt = auto_malloc(0xc000);
int A;
- memory_set_decrypted_region(0, 0x0000, 0xbfff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0xbfff, decrypt);
// the first opcode is *not* encrypted
decrypt[0] = rom[0];
@@ -524,11 +525,12 @@ static DRIVER_INIT( commando )
static DRIVER_INIT( spaceinv )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt = auto_malloc(0xc000);
int A;
- memory_set_decrypted_region(0, 0x0000, 0xbfff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0xbfff, decrypt);
// the first opcode *is* encrypted
for (A = 0; A < 0xc000; A++)
diff --git a/src/mame/drivers/coolpool.c b/src/mame/drivers/coolpool.c
index 5f2d1cb5420..e8ae2dcf12b 100644
--- a/src/mame/drivers/coolpool.c
+++ b/src/mame/drivers/coolpool.c
@@ -934,7 +934,7 @@ ROM_END
static DRIVER_INIT( coolpool )
{
- memory_install_read16_handler(machine, 1, ADDRESS_SPACE_IO, 0x07, 0x07, 0, 0, coolpool_input_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, coolpool_input_r);
}
diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c
index a6c8b28ffd9..84fe7f32708 100644
--- a/src/mame/drivers/cosmic.c
+++ b/src/mame/drivers/cosmic.c
@@ -1584,16 +1584,16 @@ static DRIVER_INIT( cosmicg )
static DRIVER_INIT( devzone )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4807, 0x4807, 0, 0, cosmic_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w);
}
static DRIVER_INIT( nomnlnd )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5001, 0, 0, nomnlnd_port_0_1_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4800, 0x4800, 0, 0, SMH_NOP);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4807, 0x4807, 0, 0, cosmic_background_enable_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x480a, 0x480a, 0, 0, dac_0_data_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x5001, 0, 0, nomnlnd_port_0_1_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4800, 0, 0, SMH_NOP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x480a, 0x480a, 0, 0, dac_0_data_w);
}
diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c
index 8a0502ce36c..462c295fc32 100644
--- a/src/mame/drivers/cps1.c
+++ b/src/mame/drivers/cps1.c
@@ -8268,10 +8268,10 @@ static DRIVER_INIT( forgottn )
{
/* Forgotten Worlds has a NEC uPD4701AC on the B-board handling dial inputs from the CN-MOWS connector. */
/* The memory mapping is handled by PAL LWIO */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x800040, 0x800041, 0, 0, forgottn_dial_0_reset_w);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x800048, 0x800049, 0, 0, forgottn_dial_1_reset_w);
- memory_install_read16_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x800052, 0x800055, 0, 0, forgottn_dial_0_r);
- memory_install_read16_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x80005a, 0x80005d, 0, 0, forgottn_dial_1_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800040, 0x800041, 0, 0, forgottn_dial_0_reset_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800048, 0x800049, 0, 0, forgottn_dial_1_reset_w);
+ memory_install_read16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800052, 0x800055, 0, 0, forgottn_dial_0_r);
+ memory_install_read16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80005a, 0x80005d, 0, 0, forgottn_dial_1_r);
DRIVER_INIT_CALL(cps1);
}
@@ -8280,14 +8280,14 @@ static DRIVER_INIT( sf2ue )
{
/* This specific version of SF2 has the CPS-B custom mapped at a different address. */
/* The mapping is handled by a PAL on the B-board */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x800140, 0x80017f, 0, 0, SMH_UNMAP, SMH_UNMAP);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8001c0, 0x8001ff, 0, 0, cps1_cps_b_r, cps1_cps_b_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800140, 0x80017f, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8001c0, 0x8001ff, 0, 0, cps1_cps_b_r, cps1_cps_b_w);
}
static DRIVER_INIT( sf2hack )
{
/* some SF2 hacks have some inputs wired to the LSB instead of MSB */
- memory_install_read16_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x800018, 0x80001f, 0, 0, cps1_hack_dsw_r);
+ memory_install_read16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800018, 0x80001f, 0, 0, cps1_hack_dsw_r);
DRIVER_INIT_CALL(cps1);
}
@@ -8320,7 +8320,7 @@ static DRIVER_INIT( pang3 )
{
/* Pang 3 is the only non-QSound game to have an EEPROM. */
/* It is mapped in the CPS-B address range so probably is on the C-board. */
- memory_install_readwrite16_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x80017a, 0x80017b, 0, 0, cps1_eeprom_port_r, cps1_eeprom_port_w);
+ memory_install_readwrite16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80017a, 0x80017b, 0, 0, cps1_eeprom_port_r, cps1_eeprom_port_w);
DRIVER_INIT_CALL(cps1);
}
@@ -8371,11 +8371,11 @@ static DRIVER_INIT( sf2mdt )
rom[i+3] = rom[i+6];
rom[i+6] = tmp;
}
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x70c01a, 0x70c01b, 0, 0, sf2mdt_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x70c01c, 0x70c01d, 0, 0, sf2mdt_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x70c01e, 0x70c01f, 0, 0, sf2mdt_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x70c010, 0x70c011, 0, 0, sf2mdt_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x70c018, 0x70c019, 0, 0, sf2mdt_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c01a, 0x70c01b, 0, 0, sf2mdt_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c01c, 0x70c01d, 0, 0, sf2mdt_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c01e, 0x70c01f, 0, 0, sf2mdt_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c010, 0x70c011, 0, 0, sf2mdt_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c018, 0x70c019, 0, 0, sf2mdt_r);
DRIVER_INIT_CALL(cps1);
}
diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c
index c6d1f605939..46a0903f1d5 100644
--- a/src/mame/drivers/cps2.c
+++ b/src/mame/drivers/cps2.c
@@ -7325,7 +7325,7 @@ static DRIVER_INIT( ssf2tb )
static DRIVER_INIT ( pzloop2 )
{
DRIVER_INIT_CALL(cps2);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x804000, 0x804001, 0, 0, joy_or_paddle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x804000, 0x804001, 0, 0, joy_or_paddle_r);
}
diff --git a/src/mame/drivers/crgolf.c b/src/mame/drivers/crgolf.c
index bdcf25e7a51..80320f3d3f8 100644
--- a/src/mame/drivers/crgolf.c
+++ b/src/mame/drivers/crgolf.c
@@ -62,7 +62,7 @@ static WRITE8_HANDLER( rom_bank_select_w )
static MACHINE_START( crgolf )
{
/* configure the banking */
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x2000);
memory_set_bank(1, 0);
/* register for save states */
@@ -580,7 +580,7 @@ ROM_END
static DRIVER_INIT( crgolfhi )
{
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xa000, 0xa003, 0, 0, crgolfhi_sample_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xa000, 0xa003, 0, 0, crgolfhi_sample_w);
}
diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c
index 23662e8eba0..5634aff072b 100644
--- a/src/mame/drivers/crimfght.c
+++ b/src/mame/drivers/crimfght.c
@@ -423,11 +423,11 @@ static void crimfght_banking( int lines )
/* bit 5 = select work RAM or palette */
if (lines & 0x20)
{
- memory_install_readwrite8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, SMH_BANK3, paletteram_xBBBBBGGGGGRRRRR_be_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x03ff, 0, 0, SMH_BANK3, paletteram_xBBBBBGGGGGRRRRR_be_w);
memory_set_bankptr(3, paletteram);
}
else
- memory_install_readwrite8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x03ff, 0, 0, SMH_BANK1, SMH_BANK1); /* RAM */
+ memory_install_readwrite8_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x03ff, 0, 0, SMH_BANK1, SMH_BANK1); /* RAM */
/* bit 6 = enable char ROM reading through the video RAM */
K052109_set_RMRD_line((lines & 0x40) ? ASSERT_LINE : CLEAR_LINE);
diff --git a/src/mame/drivers/cshooter.c b/src/mame/drivers/cshooter.c
index fa592ab0228..b3218d14ec4 100644
--- a/src/mame/drivers/cshooter.c
+++ b/src/mame/drivers/cshooter.c
@@ -688,11 +688,12 @@ static DRIVER_INIT( cshooter )
static DRIVER_INIT( cshootre )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
int A;
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt = auto_malloc(0x8000);
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
for (A = 0x0000;A < 0x8000;A++)
{
diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c
index b09c0fe8575..50a84586866 100644
--- a/src/mame/drivers/cubocd32.c
+++ b/src/mame/drivers/cubocd32.c
@@ -62,10 +62,10 @@ static WRITE32_HANDLER( aga_overlay_w )
/* swap the write handlers between ROM and bank 1 based on the bit */
if ((data & 1) == 0)
/* overlay disabled, map RAM on 0x000000 */
- memory_install_write32_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x1fffff, 0, 0, SMH_BANK1);
+ memory_install_write32_handler(space, 0x000000, 0x1fffff, 0, 0, SMH_BANK1);
else
/* overlay enabled, map Amiga system ROM on 0x000000 */
- memory_install_write32_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x1fffff, 0, 0, SMH_UNMAP);
+ memory_install_write32_handler(space, 0x000000, 0x1fffff, 0, 0, SMH_UNMAP);
}
}
@@ -337,8 +337,8 @@ static DRIVER_INIT( cd32 )
amiga_machine_config(machine, &cubocd32_intf);
/* set up memory */
- memory_configure_bank(1, 0, 1, amiga_chip_ram32, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "user1"), 0);
+ memory_configure_bank(machine, 1, 0, 1, amiga_chip_ram32, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user1"), 0);
/* intialize akiko */
amiga_akiko_init(machine);
diff --git a/src/mame/drivers/darkmist.c b/src/mame/drivers/darkmist.c
index 3d1792506f7..36d21ae2215 100644
--- a/src/mame/drivers/darkmist.c
+++ b/src/mame/drivers/darkmist.c
@@ -422,6 +422,7 @@ static void decrypt_snd(running_machine *machine)
static DRIVER_INIT(darkmist)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
int i, len;
UINT8 *ROM = memory_region(machine, "main");
UINT8 *buffer = malloc_or_die(0x10000);
@@ -455,7 +456,7 @@ static DRIVER_INIT(darkmist)
decrypt[i] = p;
}
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
memory_set_bankptr(1,&ROM[0x010000]);
/* adr line swaps */
diff --git a/src/mame/drivers/dassault.c b/src/mame/drivers/dassault.c
index 8a71657488a..aeec54b0699 100644
--- a/src/mame/drivers/dassault.c
+++ b/src/mame/drivers/dassault.c
@@ -844,7 +844,7 @@ static DRIVER_INIT( dassault )
free(tmp);
/* Save time waiting on vblank bit */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3f8000, 0x3f8001, 0, 0, dassault_main_skip);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, dassault_main_skip);
}
static DRIVER_INIT( thndzone )
@@ -864,7 +864,7 @@ static DRIVER_INIT( thndzone )
free(tmp);
/* Save time waiting on vblank bit */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3f8000, 0x3f8001, 0, 0, thndzone_main_skip);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, thndzone_main_skip);
}
/**********************************************************************************/
diff --git a/src/mame/drivers/ddealer.c b/src/mame/drivers/ddealer.c
index a4b5a81a341..0e5d7f70f1f 100644
--- a/src/mame/drivers/ddealer.c
+++ b/src/mame/drivers/ddealer.c
@@ -635,7 +635,7 @@ static READ16_HANDLER( ddealer_mcu_r )
static DRIVER_INIT( ddealer )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfe01c, 0xfe01d, 0, 0, ddealer_mcu_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe01c, 0xfe01d, 0, 0, ddealer_mcu_r );
}
ROM_START( ddealer )
diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c
index 00538807fd8..e3330f333ab 100644
--- a/src/mame/drivers/ddenlovr.c
+++ b/src/mame/drivers/ddenlovr.c
@@ -7604,7 +7604,7 @@ static DRIVER_INIT( rongrong )
version of the game might be a bootleg with the protection
patched. (both sets need this)
*/
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60d4, 0x60d4, 0, 0, SMH_NOP);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60d4, 0x60d4, 0, 0, SMH_NOP);
}
/***************************************************************************
diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c
index a56bddeb322..e3610aa7e85 100644
--- a/src/mame/drivers/ddragon.c
+++ b/src/mame/drivers/ddragon.c
@@ -176,7 +176,7 @@ static TIMER_CALLBACK( ddragon_scanline_callback )
static MACHINE_START( ddragon )
{
/* configure banks */
- memory_configure_bank(1, 0, 8, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 8, memory_region(machine, "main") + 0x10000, 0x4000);
/* allocate timer for scanlines */
scanline_timer = timer_alloc(ddragon_scanline_callback, NULL);
@@ -300,9 +300,9 @@ static WRITE8_HANDLER( darktowr_bankswitch_w )
memory_set_bank(1, newbank);
if (newbank == 4 && oldbank != 4)
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, darktowr_mcu_bank_r, darktowr_mcu_bank_w);
+ memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, darktowr_mcu_bank_r, darktowr_mcu_bank_w);
else if (newbank != 4 && oldbank == 4)
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1);
}
@@ -1932,7 +1932,7 @@ static DRIVER_INIT( darktowr )
sound_irq = M6809_IRQ_LINE;
ym_irq = M6809_FIRQ_LINE;
technos_video_hw = 0;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3808, 0x3808, 0, 0, darktowr_bankswitch_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3808, 0x3808, 0, 0, darktowr_bankswitch_w);
}
@@ -1944,7 +1944,7 @@ static DRIVER_INIT( toffy )
sound_irq = M6809_IRQ_LINE;
ym_irq = M6809_FIRQ_LINE;
technos_video_hw = 0;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3808, 0x3808, 0, 0, toffy_bankswitch_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3808, 0x3808, 0, 0, toffy_bankswitch_w);
/* the program rom has a simple bitswap encryption */
rom = memory_region(machine, "main");
diff --git a/src/mame/drivers/deadang.c b/src/mame/drivers/deadang.c
index 6cfc4b20541..675a2ccd1a9 100644
--- a/src/mame/drivers/deadang.c
+++ b/src/mame/drivers/deadang.c
@@ -410,8 +410,8 @@ static DRIVER_INIT( ghunter )
seibu_sound_decrypt(machine, "audio", 0x2000);
seibu_adpcm_decrypt(machine, "adpcm");
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80000, 0x80001, 0, 0, ghunter_trackball_low_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0001, 0, 0, ghunter_trackball_high_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80000, 0x80001, 0, 0, ghunter_trackball_low_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0001, 0, 0, ghunter_trackball_high_r);
}
/* Game Drivers */
diff --git a/src/mame/drivers/dec8.c b/src/mame/drivers/dec8.c
index bf9d3027b0f..b019d7bd82e 100644
--- a/src/mame/drivers/dec8.c
+++ b/src/mame/drivers/dec8.c
@@ -3445,19 +3445,16 @@ ROM_END
/* Ghostbusters, Darwin, Oscar use a "Deco 222" custom 6502 for sound. */
static DRIVER_INIT( deco222 )
{
- int A,sound_cpu;
+ const address_space *space = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM);
+ int A;
UINT8 *decrypt;
UINT8 *rom;
- sound_cpu = 1;
- /* Oscar has three CPUs */
- if (machine->config->cpu[2].type != CPU_DUMMY) sound_cpu = 2;
-
/* bits 5 and 6 of the opcodes are swapped */
rom = memory_region(machine, "audio");
decrypt = auto_malloc(0x8000);
- memory_set_decrypted_region(sound_cpu, 0x8000, 0xffff, decrypt);
+ memory_set_decrypted_region(space, 0x8000, 0xffff, decrypt);
for (A = 0x8000;A < 0x10000;A++)
decrypt[A-0x8000] = (rom[A] & 0x9f) | ((rom[A] & 0x20) << 1) | ((rom[A] & 0x40) >> 1);
diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c
index af4a52bccca..3e359131c6f 100644
--- a/src/mame/drivers/deco_mlc.c
+++ b/src/mame/drivers/deco_mlc.c
@@ -732,7 +732,7 @@ static DRIVER_INIT( avengrgs )
cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x32dc);
mainCpuIsArm=0;
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01089a0, 0x01089a3, 0, 0, avengrgs_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01089a0, 0x01089a3, 0, 0, avengrgs_speedup_r );
descramble_sound(machine);
}
diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c
index 2fd841095f6..b749a55e794 100644
--- a/src/mame/drivers/decocass.c
+++ b/src/mame/drivers/decocass.c
@@ -1099,14 +1099,15 @@ ROM_END
static DRIVER_INIT( decocass )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
int A;
/* allocate memory and mark all RAM regions with their decrypted pointers */
decrypted = auto_malloc(0x10000);
- memory_set_decrypted_region(0, 0x0000, 0xc7ff, &decrypted[0x0000]);
- memory_set_decrypted_region(0, 0xd000, 0xdbff, &decrypted[0xd000]);
- memory_set_decrypted_region(0, 0xf000, 0xffff, &decrypted[0xf000]);
+ memory_set_decrypted_region(space, 0x0000, 0xc7ff, &decrypted[0x0000]);
+ memory_set_decrypted_region(space, 0xd000, 0xdbff, &decrypted[0xd000]);
+ memory_set_decrypted_region(space, 0xf000, 0xffff, &decrypted[0xf000]);
/* Swap bits 5 & 6 for opcodes */
for (A = 0xf000;A < 0x10000;A++)
@@ -1133,15 +1134,15 @@ static DRIVER_INIT( decocrom )
decrypted2[i] = swap_bits_5_6(rom[i]);
/* convert charram to a banked ROM */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0xafff, 0, 0, SMH_BANK1, decocass_de0091_w);
- memory_configure_bank(1, 0, 1, decocass_charram, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "user3"), 0);
- memory_configure_bank_decrypted(1, 0, 1, &decrypted[0x6000], 0);
- memory_configure_bank_decrypted(1, 1, 1, decrypted2, 0);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0xafff, 0, 0, SMH_BANK1, decocass_de0091_w);
+ memory_configure_bank(machine, 1, 0, 1, decocass_charram, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user3"), 0);
+ memory_configure_bank_decrypted(machine, 1, 0, 1, &decrypted[0x6000], 0);
+ memory_configure_bank_decrypted(machine, 1, 1, 1, decrypted2, 0);
memory_set_bank(1, 0);
/* install the bank selector */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe900, 0xe900, 0, 0, decocass_e900_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe900, 0xe900, 0, 0, decocass_e900_w);
}
diff --git a/src/mame/drivers/dgpix.c b/src/mame/drivers/dgpix.c
index 2b259db7266..2ee1110a802 100644
--- a/src/mame/drivers/dgpix.c
+++ b/src/mame/drivers/dgpix.c
@@ -565,7 +565,7 @@ static DRIVER_INIT( xfiles )
rom[BYTE4_XOR_BE(0x3aa933)] = 0;
// protection related ?
-// memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0c8b440, 0xf0c8b447, 0, 0, SMH_NOP );
+// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c8b440, 0xf0c8b447, 0, 0, SMH_NOP );
flash_roms = 2;
}
@@ -585,7 +585,7 @@ static DRIVER_INIT( kdynastg )
rom[BYTE4_XOR_BE(0x3a45c9)] = 0;
// protection related ?
-// memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x12341234, 0x12341243, 0, 0, SMH_NOP );
+// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x12341234, 0x12341243, 0, 0, SMH_NOP );
flash_roms = 4;
}
diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c
index 8e2efe26fa2..be5d92abddf 100644
--- a/src/mame/drivers/dkong.c
+++ b/src/mame/drivers/dkong.c
@@ -468,7 +468,7 @@ static MACHINE_RESET( strtheat )
MACHINE_RESET_CALL(dkong);
/* The initial state of the counter is 0x08 */
- memory_configure_bank(1, 0, 4, &ROM[0x10000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, &ROM[0x10000], 0x4000);
state->decrypt_counter = 0x08;
memory_set_bank(1, 0);
}
@@ -481,7 +481,7 @@ static MACHINE_RESET( drakton )
MACHINE_RESET_CALL(dkong);
/* The initial state of the counter is 0x09 */
- memory_configure_bank(1, 0, 4, &ROM[0x10000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, &ROM[0x10000], 0x4000);
state->decrypt_counter = 0x09;
memory_set_bank(1, 1);
}
@@ -2877,7 +2877,7 @@ static DRIVER_INIT( drakton )
{7,1,4,0,3,6,2,5},
};
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1 );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1 );
/* While the PAL supports up to 16 decryption methods, only four
are actually used in the PAL. Therefore, we'll take a little
@@ -2899,7 +2899,7 @@ static DRIVER_INIT( strtheat )
{6,3,4,1,0,7,2,5},
};
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1 );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1 );
/* While the PAL supports up to 16 decryption methods, only four
are actually used in the PAL. Therefore, we'll take a little
@@ -2910,8 +2910,8 @@ static DRIVER_INIT( strtheat )
drakton_decrypt_rom(machine, 0x88, 0x1c000, bs[3]);
/* custom handlers supporting Joystick or Steering Wheel */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7c00, 0x7c00, 0, 0, strtheat_inputport_0_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7c80, 0x7c80, 0, 0, strtheat_inputport_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7c00, 0x7c00, 0, 0, strtheat_inputport_0_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7c80, 0x7c80, 0, 0, strtheat_inputport_1_r);
}
/*************************************
diff --git a/src/mame/drivers/dooyong.c b/src/mame/drivers/dooyong.c
index ff8760e9e75..4373d9cb96c 100644
--- a/src/mame/drivers/dooyong.c
+++ b/src/mame/drivers/dooyong.c
@@ -66,7 +66,7 @@ static WRITE8_HANDLER( lastday_bankswitch_w )
static MACHINE_START( lastday )
{
- memory_configure_bank(1, 0, 8, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 8, memory_region(machine, "main") + 0x10000, 0x4000);
}
static WRITE8_HANDLER( flip_screen_w )
diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c
index bf9d09786d8..177a63ab6e5 100644
--- a/src/mame/drivers/dynax.c
+++ b/src/mame/drivers/dynax.c
@@ -5609,7 +5609,7 @@ ROM_END
static DRIVER_INIT( mjreach )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x10060, 0x10060, 0, 0, yarunara_flipscreen_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x10060, 0x10060, 0, 0, yarunara_flipscreen_w);
}
/***************************************************************************
diff --git a/src/mame/drivers/eprom.c b/src/mame/drivers/eprom.c
index ccef155611b..83526460234 100644
--- a/src/mame/drivers/eprom.c
+++ b/src/mame/drivers/eprom.c
@@ -715,8 +715,8 @@ static DRIVER_INIT( eprom )
atarijsa_init(machine, "260010", 0x0002);
/* install CPU synchronization handlers */
- sync_data = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x16cc00, 0x16cc01, 0, 0, sync_r, sync_w);
- sync_data = memory_install_readwrite16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x16cc00, 0x16cc01, 0, 0, sync_r, sync_w);
+ sync_data = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x16cc00, 0x16cc01, 0, 0, sync_r, sync_w);
+ sync_data = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x16cc00, 0x16cc01, 0, 0, sync_r, sync_w);
}
diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c
index 403745c2f87..2328b0f7ab8 100644
--- a/src/mame/drivers/equites.c
+++ b/src/mame/drivers/equites.c
@@ -1843,8 +1843,8 @@ static DRIVER_INIT( gekisou )
unpack_region(machine, "gfx3");
// install special handlers for unknown device (protection?)
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x580000, 0x580001, 0, 0, gekisou_unknown_0_w);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5a0000, 0x5a0001, 0, 0, gekisou_unknown_1_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x580000, 0x580001, 0, 0, gekisou_unknown_0_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5a0000, 0x5a0001, 0, 0, gekisou_unknown_1_w);
}
static DRIVER_INIT( splndrbt )
@@ -1857,7 +1857,7 @@ static DRIVER_INIT( hvoltage )
unpack_region(machine, "gfx3");
#if HVOLTAGE_DEBUG
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000038, 0x000039, 0, 0, hvoltage_debug_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000038, 0x000039, 0, 0, hvoltage_debug_r);
#endif
}
diff --git a/src/mame/drivers/exidy.c b/src/mame/drivers/exidy.c
index a0e07709467..18a9b957965 100644
--- a/src/mame/drivers/exidy.c
+++ b/src/mame/drivers/exidy.c
@@ -1371,7 +1371,7 @@ static DRIVER_INIT( phantoma )
exidy_color_latch[0] = 0x09;
/* the ROM is actually mapped high */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf800, 0xffff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf800, 0xffff, 0, 0, SMH_BANK1);
memory_set_bankptr(1, memory_region(machine, "main") + 0xf800);
}
diff --git a/src/mame/drivers/exidy440.c b/src/mame/drivers/exidy440.c
index 0b706d71799..e91f8b89774 100644
--- a/src/mame/drivers/exidy440.c
+++ b/src/mame/drivers/exidy440.c
@@ -309,9 +309,9 @@ void exidy440_bank_select(running_machine *machine, UINT8 bank)
if (showdown_bank_data[0] != NULL)
{
if (bank == 0 && exidy440_bank != 0)
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, showdown_bank0_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, showdown_bank0_r);
else if (bank != 0 && exidy440_bank == 0)
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_BANK1);
}
/* select the bank and update the bank pointer */
@@ -1936,7 +1936,7 @@ static DRIVER_INIT( claypign )
{
DRIVER_INIT_CALL(exidy440);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ec0, 0x2ec3, 0, 0, claypign_protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2ec0, 0x2ec3, 0, 0, claypign_protection_r);
}
@@ -1945,11 +1945,11 @@ static DRIVER_INIT( topsecex )
DRIVER_INIT_CALL(exidy440);
/* extra input ports and scrolling */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ec5, 0x2ec5, 0, 0, topsecex_input_port_5_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ec6, 0x2ec6, 0, 0, input_port_read_handler8(machine->portconfig, "AN0"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ec7, 0x2ec7, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2ec5, 0x2ec5, 0, 0, topsecex_input_port_5_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2ec6, 0x2ec6, 0, 0, input_port_read_handler8(machine->portconfig, "AN0"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2ec7, 0x2ec7, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
- topsecex_yscroll = memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ec1, 0x2ec1, 0, 0, topsecex_yscroll_w);
+ topsecex_yscroll = memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2ec1, 0x2ec1, 0, 0, topsecex_yscroll_w);
}
diff --git a/src/mame/drivers/exprraid.c b/src/mame/drivers/exprraid.c
index 86b2648bae9..04e423abf27 100644
--- a/src/mame/drivers/exprraid.c
+++ b/src/mame/drivers/exprraid.c
@@ -761,13 +761,13 @@ static DRIVER_INIT( exprraid )
static DRIVER_INIT( wexpresb )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3800, 0, 0, vblank_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3800, 0x3800, 0, 0, vblank_r);
exprraid_gfx_expand(machine);
}
static DRIVER_INIT( wexpresc )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xFFC0, 0xFFC0, 0, 0, vblank_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xFFC0, 0xFFC0, 0, 0, vblank_r);
exprraid_gfx_expand(machine);
}
diff --git a/src/mame/drivers/fastfred.c b/src/mame/drivers/fastfred.c
index 9d105e0f798..8c81868030e 100644
--- a/src/mame/drivers/fastfred.c
+++ b/src/mame/drivers/fastfred.c
@@ -948,8 +948,8 @@ ROM_END
static DRIVER_INIT( flyboy )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc085, 0xc099, 0, 0, flyboy_custom1_io_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc8fb, 0xc900, 0, 0, flyboy_custom2_io_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc085, 0xc099, 0, 0, flyboy_custom1_io_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc8fb, 0xc900, 0, 0, flyboy_custom2_io_r);
fastfred_hardware_type = 1;
}
@@ -960,19 +960,19 @@ static DRIVER_INIT( flyboyb )
static DRIVER_INIT( fastfred )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xcfff, 0, 0, fastfred_custom_io_r, SMH_NOP);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, fastfred_custom_io_r, SMH_NOP);
fastfred_hardware_type = 1;
}
static DRIVER_INIT( jumpcoas )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, SMH_NOP);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, SMH_NOP);
fastfred_hardware_type = 0;
}
static DRIVER_INIT( boggy84 )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, SMH_NOP);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcfff, 0, 0, jumpcoas_custom_io_r, SMH_NOP);
fastfred_hardware_type = 2;
}
diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c
index d1f3d0d209b..00639f86037 100644
--- a/src/mame/drivers/firebeat.c
+++ b/src/mame/drivers/firebeat.c
@@ -2267,9 +2267,9 @@ static void init_lights(running_machine *machine, write32_space_func out1, write
if(!out2) out1 = lamp_output2_w;
if(!out3) out1 = lamp_output3_w;
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7d000804, 0x7d000807, 0, 0, out1);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7d000320, 0x7d000323, 0, 0, out2);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7d000324, 0x7d000327, 0, 0, out3);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7d000804, 0x7d000807, 0, 0, out1);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7d000320, 0x7d000323, 0, 0, out2);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7d000324, 0x7d000327, 0, 0, out3);
}
static void init_firebeat(running_machine *machine)
diff --git a/src/mame/drivers/firefox.c b/src/mame/drivers/firefox.c
index 35c7d9fc924..3a9e6a20cf2 100644
--- a/src/mame/drivers/firefox.c
+++ b/src/mame/drivers/firefox.c
@@ -435,7 +435,7 @@ static void firq_gen(const device_config *device, int state)
static MACHINE_START( firefox )
{
- memory_configure_bank(1, 0, 32, memory_region(machine, "main") + 0x10000, 0x1000);
+ memory_configure_bank(machine, 1, 0, 32, memory_region(machine, "main") + 0x10000, 0x1000);
nvram_1c = devtag_get_device(machine, X2212, "nvram_1c");
nvram_1d = devtag_get_device(machine, X2212, "nvram_1d");
diff --git a/src/mame/drivers/fitfight.c b/src/mame/drivers/fitfight.c
index 82b2a70233a..65efe07d282 100644
--- a/src/mame/drivers/fitfight.c
+++ b/src/mame/drivers/fitfight.c
@@ -984,7 +984,7 @@ static DRIVER_INIT( fitfight )
{
// UINT16 *mem16 = (UINT16 *)memory_region(machine, "main");
// mem16[0x0165B2/2]=0x4e71; // for now so it boots
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x700000, 0x700001, 0, 0, fitfight_700000_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x700000, 0x700001, 0, 0, fitfight_700000_r);
bbprot_kludge = 0;
}
@@ -992,7 +992,7 @@ static DRIVER_INIT( histryma )
{
// UINT16 *mem16 = (UINT16 *)memory_region(machine, "main");
// mem16[0x017FDC/2]=0x4e71; // for now so it boots
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x700000, 0x700001, 0, 0, histryma_700000_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x700000, 0x700001, 0, 0, histryma_700000_r);
bbprot_kludge = 0;
}
diff --git a/src/mame/drivers/freekick.c b/src/mame/drivers/freekick.c
index fcd4fa54616..2ebf6f39e89 100644
--- a/src/mame/drivers/freekick.c
+++ b/src/mame/drivers/freekick.c
@@ -87,7 +87,7 @@ static READ8_HANDLER( spinner_r )
static MACHINE_RESET( pbillrd )
{
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
}
static WRITE8_HANDLER( pbillrd_bankswitch_w )
@@ -1051,7 +1051,8 @@ ROM_END
static DRIVER_INIT(gigas)
{
- memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, "main") + 0x10000);
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "main") + 0x10000);
}
diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c
index f9e0724937b..1c1a3a17157 100644
--- a/src/mame/drivers/gaelco3d.c
+++ b/src/mame/drivers/gaelco3d.c
@@ -200,7 +200,7 @@ static MACHINE_RESET( common )
/* allocate a timer for feeding the autobuffer */
adsp_autobuffer_timer = timer_alloc(adsp_autobuffer_irq, NULL);
- memory_configure_bank(1, 0, 256, memory_region(machine, "user1"), 0x4000);
+ memory_configure_bank(machine, 1, 0, 256, memory_region(machine, "user1"), 0x4000);
memory_set_bank(1, 0);
/* keep the TMS32031 halted until the code is ready to go */
diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c
index 9285b75666f..0bd51817ead 100644
--- a/src/mame/drivers/gaiden.c
+++ b/src/mame/drivers/gaiden.c
@@ -1384,8 +1384,8 @@ static DRIVER_INIT( wildfang )
/* sprite size Y = sprite size X */
gaiden_sprite_sizey = 0;
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x07a006, 0x07a007, 0, 0, wildfang_protection_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x07a804, 0x07a805, 0, 0, wildfang_protection_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x07a006, 0x07a007, 0, 0, wildfang_protection_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x07a804, 0x07a805, 0, 0, wildfang_protection_w);
}
static DRIVER_INIT( raiga )
@@ -1393,8 +1393,8 @@ static DRIVER_INIT( raiga )
/* sprite size Y independent from sprite size X */
gaiden_sprite_sizey = 2;
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x07a006, 0x07a007, 0, 0, raiga_protection_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x07a804, 0x07a805, 0, 0, raiga_protection_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x07a006, 0x07a007, 0, 0, raiga_protection_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x07a804, 0x07a805, 0, 0, raiga_protection_w);
}
static DRIVER_INIT( drgnbowl )
diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c
index a8cb92c7e19..c10452646b5 100644
--- a/src/mame/drivers/galaga.c
+++ b/src/mame/drivers/galaga.c
@@ -3224,7 +3224,7 @@ static DRIVER_INIT (gatsbee)
DRIVER_INIT_CALL(galaga);
/* Gatsbee has a larger character ROM, we need a handler for banking */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1000, 0, 0, gatsbee_bank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000, 0x1000, 0, 0, gatsbee_bank_w);
}
@@ -3265,8 +3265,8 @@ static DRIVER_INIT( xevios )
static DRIVER_INIT( battles )
{
/* replace the Namco I/O handlers with interface to the 4th CPU */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7000, 0x700f, 0, 0, battles_customio_data0_r, battles_customio_data0_w );
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7100, 0x7100, 0, 0, battles_customio0_r, battles_customio0_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x700f, 0, 0, battles_customio_data0_r, battles_customio_data0_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7100, 0x7100, 0, 0, battles_customio0_r, battles_customio0_w );
DRIVER_INIT_CALL(xevious);
}
diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c
index 50d0364c978..82b64d631df 100644
--- a/src/mame/drivers/galaxian.c
+++ b/src/mame/drivers/galaxian.c
@@ -2304,9 +2304,9 @@ static void common_init(
static void unmap_galaxian_sound(running_machine *machine, offs_t base)
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, base + 0x0004, base + 0x0007, 0, 0x07f8, SMH_UNMAP);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, base + 0x0800, base + 0x0807, 0, 0x07f8, SMH_UNMAP);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, base + 0x1800, base + 0x1800, 0, 0x07ff, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base + 0x0004, base + 0x0007, 0, 0x07f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base + 0x0800, base + 0x0807, 0, 0x07f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base + 0x1800, base + 0x1800, 0, 0x07ff, SMH_UNMAP);
}
@@ -2329,7 +2329,7 @@ static DRIVER_INIT( nolock )
DRIVER_INIT_CALL(galaxian);
/* ...but coin lockout disabled/disconnected */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
}
@@ -2339,7 +2339,7 @@ static DRIVER_INIT( azurian )
common_init(machine, scramble_draw_bullet, galaxian_draw_background, NULL, NULL);
/* coin lockout disabled */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
}
@@ -2349,8 +2349,8 @@ static DRIVER_INIT( gmgalax )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info);
/* ROM is banked */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1);
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
/* callback when the game select is toggled */
gmgalax_game_changed(machine->portconfig->fieldlist, NULL, 0, 0);
@@ -2364,7 +2364,7 @@ static DRIVER_INIT( pisces )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info);
/* coin lockout replaced by graphics bank */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, galaxian_gfxbank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0x7f8, galaxian_gfxbank_w);
}
@@ -2374,7 +2374,7 @@ static DRIVER_INIT( batman2 )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
/* coin lockout replaced by graphics bank */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, galaxian_gfxbank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0x7f8, galaxian_gfxbank_w);
}
@@ -2384,7 +2384,7 @@ static DRIVER_INIT( frogg )
common_init(machine, galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
/* ...but needs a full 2k of RAM */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x47ff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x47ff, 0, 0, SMH_BANK1, SMH_BANK1);
memory_set_bankptr(1, auto_malloc(0x800));
}
@@ -2419,12 +2419,13 @@ static DRIVER_INIT( mooncrgx )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
/* LEDs and coin lockout replaced by graphics banking */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6002, 0, 0x7f8, galaxian_gfxbank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6002, 0, 0x7f8, galaxian_gfxbank_w);
}
static DRIVER_INIT( moonqsr )
{
+ const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
UINT8 *decrypt = auto_malloc(0x8000);
/* video extensions */
@@ -2432,7 +2433,7 @@ static DRIVER_INIT( moonqsr )
/* decrypt program code */
decode_mooncrst(machine, 0x8000, decrypt);
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
}
@@ -2442,7 +2443,7 @@ static DRIVER_INIT( pacmanbl )
DRIVER_INIT_CALL(galaxian);
/* ...but coin lockout disabled/disconnected */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
/* also shift the sprite clip offset */
galaxian_sprite_clip_start = 7;
@@ -2468,23 +2469,23 @@ static DRIVER_INIT( zigzag )
common_init(machine, NULL, galaxian_draw_background, NULL, NULL);
/* make ROMs 2 & 3 swappable */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2fff, 0, 0, SMH_BANK1);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x3fff, 0, 0, SMH_BANK2);
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x2000, 0x1000);
- memory_configure_bank(2, 0, 2, memory_region(machine, "main") + 0x2000, 0x1000);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2fff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3fff, 0, 0, SMH_BANK2);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x2000, 0x1000);
+ memory_configure_bank(machine, 2, 0, 2, memory_region(machine, "main") + 0x2000, 0x1000);
/* handler for doing the swaps */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7002, 0x7002, 0, 0x07f8, zigzag_bankswap_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7002, 0x7002, 0, 0x07f8, zigzag_bankswap_w);
zigzag_bankswap_w(space, 0, 0);
/* coin lockout disabled */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0x7f8, SMH_UNMAP);
/* remove the galaxian sound hardware */
unmap_galaxian_sound(machine, 0x6000);
/* install our AY-8910 handler */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4800, 0x4fff, 0, 0, zigzag_ay8910_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4fff, 0, 0, zigzag_ay8910_w);
}
@@ -2501,11 +2502,11 @@ static DRIVER_INIT( checkman )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
/* move the interrupt enable from $b000 to $b001 */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
/* attach the sound command handler */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0xffff, checkman_sound_command_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0xffff, checkman_sound_command_w);
/* decrypt program code */
decode_checkman(machine);
@@ -2518,10 +2519,10 @@ static DRIVER_INIT( checkmaj )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
/* attach the sound command handler */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7800, 0x7800, 0, 0x7ff, checkman_sound_command_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7800, 0, 0x7ff, checkman_sound_command_w);
/* for the title screen */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3800, 0, 0, checkmaj_protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3800, 0x3800, 0, 0, checkmaj_protection_r);
}
@@ -2531,10 +2532,10 @@ static DRIVER_INIT( dingo )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
/* attach the sound command handler */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7800, 0x7800, 0, 0x7ff, checkman_sound_command_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7800, 0, 0x7ff, checkman_sound_command_w);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x3000, 0, 0, dingo_3000_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3035, 0x3035, 0, 0, dingo_3035_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3000, 0, 0, dingo_3000_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3035, 0x3035, 0, 0, dingo_3035_r);
}
@@ -2544,13 +2545,13 @@ static DRIVER_INIT( dingoe )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info);
/* move the interrupt enable from $b000 to $b001 */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
/* attach the sound command handler */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0xffff, checkman_sound_command_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0xffff, checkman_sound_command_w);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3001, 0x3001, 0, 0, dingoe_3001_r); /* Protection check */
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3001, 0x3001, 0, 0, dingoe_3001_r); /* Protection check */
/* decrypt program code */
decode_dingoe(machine);
@@ -2563,14 +2564,14 @@ static DRIVER_INIT( skybase )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info);
/* coin lockout replaced by graphics bank */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa002, 0xa002, 0, 0x7f8, galaxian_gfxbank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa002, 0xa002, 0, 0x7f8, galaxian_gfxbank_w);
/* needs a full 2k of RAM */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x87ff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x87ff, 0, 0, SMH_BANK1, SMH_BANK1);
memory_set_bankptr(1, auto_malloc(0x800));
/* extend ROM */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_BANK2);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x5fff, 0, 0, SMH_BANK2);
memory_set_bankptr(2, memory_region(machine, "main"));
}
@@ -2606,10 +2607,10 @@ static DRIVER_INIT( kingball )
/* video extensions */
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, NULL, NULL);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xb000, 0, 0x7f8, kingball_sound1_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb002, 0xb002, 0, 0x7f8, kingball_sound2_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb003, 0xb003, 0, 0x7f8, kingball_speech_dip_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb000, 0, 0x7f8, kingball_sound1_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb002, 0xb002, 0, 0x7f8, kingball_sound2_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb003, 0xb003, 0, 0x7f8, kingball_speech_dip_w);
state_save_register_global(kingball_speech_dip);
state_save_register_global(kingball_sound);
@@ -2622,19 +2623,19 @@ static DRIVER_INIT( scorpnmc )
common_init(machine, galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
/* move the interrupt enable from $b000 to $b001 */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb000, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb001, 0xb001, 0, 0x7f8, irq_enable_w);
/* extra ROM */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x67ff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x67ff, 0, 0, SMH_BANK1);
memory_set_bankptr(1, memory_region(machine, "main") + 0x5000);
/* install RAM at $4000-$4800 */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x47ff, 0, 0, SMH_BANK2, SMH_BANK2);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x47ff, 0, 0, SMH_BANK2, SMH_BANK2);
memory_set_bankptr(2, auto_malloc(0x800));
/* doesn't appear to use original RAM */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x87ff, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x87ff, 0, 0, SMH_UNMAP, SMH_UNMAP);
}
@@ -2651,7 +2652,7 @@ static DRIVER_INIT( theend )
common_init(machine, theend_draw_bullet, galaxian_draw_background, NULL, NULL);
/* coin counter on the upper bit of port C */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6802, 0x6802, 0, 0x7f8, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6802, 0x6802, 0, 0x7f8, SMH_UNMAP);
}
@@ -2668,16 +2669,16 @@ static DRIVER_INIT( explorer )
common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL);
/* watchdog works for writes as well? (or is it just disabled?) */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7000, 0x7000, 0, 0x7ff, watchdog_reset_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x7000, 0, 0x7ff, watchdog_reset_w);
/* I/O appears to be direct, not via PPIs */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_UNMAP, SMH_UNMAP);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN0"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8001, 0x8001, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN1"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8002, 0x8002, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN2"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8003, 0x8003, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN3"));
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000, 0, 0xfff, soundlatch_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9000, 0x9000, 0, 0xfff, explorer_sound_control_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN0"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8001, 0x8001, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN1"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8002, 0x8002, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN2"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8003, 0x8003, 0, 0xffc, input_port_read_handler8(machine->portconfig, "IN3"));
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0xfff, soundlatch_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9000, 0x9000, 0, 0xfff, explorer_sound_control_w);
}
@@ -2688,7 +2689,7 @@ static DRIVER_INIT( sfx )
galaxian_sfx_tilemap = TRUE;
/* sound board has space for extra ROM */
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1);
memory_set_bankptr(1, memory_region(machine, "audio"));
}
@@ -2699,8 +2700,8 @@ static DRIVER_INIT( atlantis )
common_init(machine, scramble_draw_bullet, scramble_draw_background, NULL, NULL);
/* watchdog is at $7800? (or is it just disabled?) */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7000, 0x7000, 0, 0x7ff, SMH_UNMAP);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7800, 0x7800, 0, 0x7ff, watchdog_reset_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x7000, 0, 0x7ff, SMH_UNMAP);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7800, 0x7800, 0, 0x7ff, watchdog_reset_r);
}
@@ -2738,11 +2739,11 @@ static DRIVER_INIT( froggrmc )
/* video extensions */
common_init(machine, NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa800, 0xa800, 0, 0x7ff, soundlatch_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb001, 0xb001, 0, 0x7f8, froggrmc_sound_control_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa800, 0xa800, 0, 0x7ff, soundlatch_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb001, 0xb001, 0, 0x7f8, froggrmc_sound_control_w);
/* actually needs 2k of RAM */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x87ff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x87ff, 0, 0, SMH_BANK1, SMH_BANK1);
memory_set_bankptr(1, auto_malloc(0x800));
/* decrypt */
@@ -2782,16 +2783,16 @@ static DRIVER_INIT( scorpion )
common_init(machine, scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info);
/* hook up AY8910 */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_IO, 0x00, 0xff, 0, 0, scorpion_ay8910_r, scorpion_ay8910_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x00, 0xff, 0, 0, scorpion_ay8910_r, scorpion_ay8910_w);
/* extra ROM */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5800, 0x67ff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5800, 0x67ff, 0, 0, SMH_BANK1);
memory_set_bankptr(1, memory_region(machine, "main") + 0x5800);
/* no background related */
-// memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6803, 0x6803, 0, 0, SMH_NOP);
+// memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, SMH_NOP);
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x3000, 0x3000, 0, 0, scorpion_sound_status_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3000, 0, 0, scorpion_sound_status_r);
/*
{
const UINT8 *rom = memory_region(machine, "speech");
diff --git a/src/mame/drivers/galivan.c b/src/mame/drivers/galivan.c
index 0357cbe70f4..b80f5c5dc45 100644
--- a/src/mame/drivers/galivan.c
+++ b/src/mame/drivers/galivan.c
@@ -986,16 +986,16 @@ static WRITE8_HANDLER( youmab_84_w )
static DRIVER_INIT( youmab )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x82, 0x82, 0, 0, youmab_extra_bank_w); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0, SMH_BANK2);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x82, 0x82, 0, 0, youmab_extra_bank_w); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2);
memory_set_bankptr( 2, memory_region(machine, "user2") );
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x81, 0x81, 0, 0, youmab_81_w); // ?? often, alternating values
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x84, 0x84, 0, 0, youmab_84_w); // ?? often, sequence..
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x81, 0x81, 0, 0, youmab_81_w); // ?? often, alternating values
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x84, 0x84, 0, 0, youmab_84_w); // ?? often, sequence..
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd800, 0xd81f, 0, 0, SMH_NOP); // scrolling isn't here..
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd800, 0xd81f, 0, 0, SMH_NOP); // scrolling isn't here..
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x8a, 0x8a, 0, 0, youmab_8a_r); // ???
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x8a, 0x8a, 0, 0, youmab_8a_r); // ???
}
diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c
index d54009e036e..e1d3e899cb4 100644
--- a/src/mame/drivers/gladiatr.c
+++ b/src/mame/drivers/gladiatr.c
@@ -1053,7 +1053,7 @@ static DRIVER_INIT(ppking)
}
}
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf6a3,0xf6a3,0,0, f6a3_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf6a3,0xf6a3,0,0, f6a3_r );
}
diff --git a/src/mame/drivers/gng.c b/src/mame/drivers/gng.c
index 2c924683673..09026a1b705 100644
--- a/src/mame/drivers/gng.c
+++ b/src/mame/drivers/gng.c
@@ -61,8 +61,8 @@ static MACHINE_START( gng )
{
/* configure ROM banking */
UINT8 *rombase = memory_region(machine, "main");
- memory_configure_bank(1,0,4,&rombase[0x10000],0x2000);
- memory_configure_bank(1,4,1,&rombase[0x4000],0x2000);
+ memory_configure_bank(machine, 1,0,4,&rombase[0x10000],0x2000);
+ memory_configure_bank(machine, 1,4,1,&rombase[0x4000],0x2000);
}
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
@@ -703,7 +703,7 @@ static READ8_HANDLER( diamond_hack_r )
static DRIVER_INIT( diamond )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6000, 0, 0, diamond_hack_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, diamond_hack_r);
}
diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c
index 144b4229888..1034454e1e4 100644
--- a/src/mame/drivers/gottlieb.c
+++ b/src/mame/drivers/gottlieb.c
@@ -257,9 +257,9 @@ static MACHINE_START( gottlieb )
if (laserdisc != NULL)
{
/* attach to the I/O ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x05805, 0x05807, 0, 0x07f8, laserdisc_status_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x05805, 0x05805, 0, 0x07f8, laserdisc_command_w); /* command for the player */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x05806, 0x05806, 0, 0x07f8, laserdisc_select_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x05805, 0x05807, 0, 0x07f8, laserdisc_status_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x05805, 0x05805, 0, 0x07f8, laserdisc_command_w); /* command for the player */
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x05806, 0x05806, 0, 0x07f8, laserdisc_select_w);
/* allocate a timer for serial transmission, and one for philips code processing */
laserdisc_bit_timer = timer_alloc(laserdisc_bit_callback, NULL);
@@ -2541,7 +2541,7 @@ static DRIVER_INIT( romtiles )
static DRIVER_INIT( stooges )
{
DRIVER_INIT_CALL(ramtiles);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x05803, 0x05803, 0, 0x07f8, stooges_output_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x05803, 0x05803, 0, 0x07f8, stooges_output_w);
}
diff --git a/src/mame/drivers/groundfx.c b/src/mame/drivers/groundfx.c
index f9d842d6bf8..74075cc0a79 100644
--- a/src/mame/drivers/groundfx.c
+++ b/src/mame/drivers/groundfx.c
@@ -486,7 +486,7 @@ static DRIVER_INIT( groundfx )
int data;
/* Speedup handlers */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20b574, 0x20b577, 0, 0, irq_speedup_r_groundfx);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20b574, 0x20b577, 0, 0, irq_speedup_r_groundfx);
/* make piv tile GFX format suitable for gfxdecode */
offset = size/2;
diff --git a/src/mame/drivers/gstream.c b/src/mame/drivers/gstream.c
index e611c71bc9a..98f5a498e9a 100644
--- a/src/mame/drivers/gstream.c
+++ b/src/mame/drivers/gstream.c
@@ -488,7 +488,7 @@ static READ32_HANDLER( gstream_speedup_r )
static DRIVER_INIT( gstream )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd1ee0, 0xd1ee3, 0, 0, gstream_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd1ee0, 0xd1ee3, 0, 0, gstream_speedup_r );
}
GAME( 2002, gstream, 0, gstream, gstream, gstream, ROT270, "Oriental Soft Japan", "G-Stream G2020", GAME_IMPERFECT_SOUND )
diff --git a/src/mame/drivers/gstriker.c b/src/mame/drivers/gstriker.c
index daf0ee49513..402c4270e08 100644
--- a/src/mame/drivers/gstriker.c
+++ b/src/mame/drivers/gstriker.c
@@ -990,11 +990,11 @@ static void mcu_init( running_machine *machine )
pending_command = 0;
mcu_data = 0;
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008a, 0x20008b, 0, 0, twrldc94_mcu_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008a, 0x20008b, 0, 0, twrldc94_mcu_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20008a, 0x20008b, 0, 0, twrldc94_mcu_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20008a, 0x20008b, 0, 0, twrldc94_mcu_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008e, 0x20008f, 0, 0, twrldc94_prot_reg_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008e, 0x20008f, 0, 0, twrldc94_prot_reg_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20008e, 0x20008f, 0, 0, twrldc94_prot_reg_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20008e, 0x20008f, 0, 0, twrldc94_prot_reg_r);
}
static DRIVER_INIT( twrldc94 )
@@ -1014,8 +1014,8 @@ static DRIVER_INIT( vgoalsoc )
gametype = 3;
mcu_init( machine );
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200090, 0x200091, 0, 0, vbl_toggle_w); // vblank toggle
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200090, 0x200091, 0, 0, vbl_toggle_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200090, 0x200091, 0, 0, vbl_toggle_w); // vblank toggle
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200090, 0x200091, 0, 0, vbl_toggle_r);
}
/*** GAME DRIVERS ************************************************************/
diff --git a/src/mame/drivers/gsword.c b/src/mame/drivers/gsword.c
index 565be2003e6..0c21996cb78 100644
--- a/src/mame/drivers/gsword.c
+++ b/src/mame/drivers/gsword.c
@@ -941,7 +941,7 @@ static DRIVER_INIT( gsword )
#endif
#if 1
/* hack for sound protection or time out function */
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4004, 0x4005, 0, 0, gsword_hack_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4004, 0x4005, 0, 0, gsword_hack_r);
#endif
}
@@ -956,7 +956,7 @@ static DRIVER_INIT( gsword2 )
#endif
#if 1
/* hack for sound protection or time out function */
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4004, 0x4005, 0, 0, gsword_hack_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4004, 0x4005, 0, 0, gsword_hack_r);
#endif
}
diff --git a/src/mame/drivers/gunbustr.c b/src/mame/drivers/gunbustr.c
index 1a773f77b01..0423ad4da75 100644
--- a/src/mame/drivers/gunbustr.c
+++ b/src/mame/drivers/gunbustr.c
@@ -431,7 +431,7 @@ static READ32_HANDLER( main_cycle_r )
static DRIVER_INIT( gunbustr )
{
/* Speedup handler */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x203acc, 0x203acf, 0, 0, main_cycle_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x203acc, 0x203acf, 0, 0, main_cycle_r);
}
GAME( 1992, gunbustr, 0, gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito Corporation", "Gunbuster (Japan)", 0 )
diff --git a/src/mame/drivers/gundealr.c b/src/mame/drivers/gundealr.c
index 8271387feb9..191aead96fc 100644
--- a/src/mame/drivers/gundealr.c
+++ b/src/mame/drivers/gundealr.c
@@ -567,7 +567,7 @@ static DRIVER_INIT( gundealr )
static DRIVER_INIT( yamyam )
{
input_ports_hack = 1;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xe000, 0, 0, yamyam_protection_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xe000, 0, 0, yamyam_protection_w);
}
diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c
index 87c1962a3da..ec27bdde041 100644
--- a/src/mame/drivers/harddriv.c
+++ b/src/mame/drivers/harddriv.c
@@ -3414,9 +3414,9 @@ static void init_multisync(running_machine *machine, int compact_inputs)
/* install handlers for the compact driving games' inputs */
if (compact_inputs)
{
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400001, 0, 0, hdc68k_wheel_r);
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x408000, 0x408001, 0, 0, hdc68k_wheel_edge_reset_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xa80000, 0xafffff, 0, 0, hdc68k_port1_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400001, 0, 0, hdc68k_wheel_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x408000, 0x408001, 0, 0, hdc68k_wheel_edge_reset_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xa80000, 0xafffff, 0, 0, hdc68k_port1_r);
}
}
@@ -3425,18 +3425,18 @@ static void init_multisync(running_machine *machine, int compact_inputs)
static void init_adsp(running_machine *machine)
{
/* install ADSP program RAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x800000, 0x807fff, 0, 0, hd68k_adsp_program_r, hd68k_adsp_program_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x800000, 0x807fff, 0, 0, hd68k_adsp_program_r, hd68k_adsp_program_w);
/* install ADSP data RAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x808000, 0x80bfff, 0, 0, hd68k_adsp_data_r, hd68k_adsp_data_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x808000, 0x80bfff, 0, 0, hd68k_adsp_data_r, hd68k_adsp_data_w);
/* install ADSP serial buffer RAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x810000, 0x813fff, 0, 0, hd68k_adsp_buffer_r, hd68k_adsp_buffer_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x810000, 0x813fff, 0, 0, hd68k_adsp_buffer_r, hd68k_adsp_buffer_w);
/* install ADSP control locations */
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x818000, 0x81801f, 0, 0, hd68k_adsp_control_w);
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x818060, 0x81807f, 0, 0, hd68k_adsp_irq_clear_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x838000, 0x83ffff, 0, 0, hd68k_adsp_irq_state_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x818000, 0x81801f, 0, 0, hd68k_adsp_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x818060, 0x81807f, 0, 0, hd68k_adsp_irq_clear_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x838000, 0x83ffff, 0, 0, hd68k_adsp_irq_state_r);
}
@@ -3444,21 +3444,21 @@ static void init_adsp(running_machine *machine)
static void init_ds3(running_machine *machine)
{
/* install ADSP program RAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x800000, 0x807fff, 0, 0, hd68k_ds3_program_r, hd68k_ds3_program_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x800000, 0x807fff, 0, 0, hd68k_ds3_program_r, hd68k_ds3_program_w);
/* install ADSP data RAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x808000, 0x80bfff, 0, 0, hd68k_adsp_data_r, hd68k_adsp_data_w);
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x80c000, 0x80dfff, 0, 0, hdds3_special_r, hdds3_special_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x808000, 0x80bfff, 0, 0, hd68k_adsp_data_r, hd68k_adsp_data_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x80c000, 0x80dfff, 0, 0, hdds3_special_r, hdds3_special_w);
/* install ADSP control locations */
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x820000, 0x8207ff, 0, 0, hd68k_ds3_gdata_r);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x820800, 0x820fff, 0, 0, hd68k_ds3_girq_state_r);
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x820000, 0x8207ff, 0, 0, hd68k_ds3_gdata_w);
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x821000, 0x8217ff, 0, 0, hd68k_adsp_irq_clear_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x822000, 0x8227ff, 0, 0, hd68k_ds3_sdata_r);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x822800, 0x822fff, 0, 0, hd68k_ds3_sirq_state_r);
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x822000, 0x8227ff, 0, 0, hd68k_ds3_sdata_w);
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x823800, 0x823fff, 0, 0, hd68k_ds3_control_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x820000, 0x8207ff, 0, 0, hd68k_ds3_gdata_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x820800, 0x820fff, 0, 0, hd68k_ds3_girq_state_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x820000, 0x8207ff, 0, 0, hd68k_ds3_gdata_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x821000, 0x8217ff, 0, 0, hd68k_adsp_irq_clear_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x822000, 0x8227ff, 0, 0, hd68k_ds3_sdata_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x822800, 0x822fff, 0, 0, hd68k_ds3_sirq_state_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x822000, 0x8227ff, 0, 0, hd68k_ds3_sdata_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x823800, 0x823fff, 0, 0, hd68k_ds3_control_w);
/* if we have a sound DSP, boot it */
if (hdcpu_sound != -1 && machine->config->cpu[hdcpu_sound].type == CPU_ADSP2105)
@@ -3547,26 +3547,26 @@ static void init_dsk(running_machine *machine)
UINT8 *usr3 = memory_region(machine, "user3");
/* install ASIC61 */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x85c000, 0x85c7ff, 0, 0, hd68k_dsk_dsp32_r, hd68k_dsk_dsp32_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x85c000, 0x85c7ff, 0, 0, hd68k_dsk_dsp32_r, hd68k_dsk_dsp32_w);
/* install control registers */
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x85c800, 0x85c81f, 0, 0, hd68k_dsk_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x85c800, 0x85c81f, 0, 0, hd68k_dsk_control_w);
/* install extra RAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x900000, 0x90ffff, 0, 0, hd68k_dsk_ram_r, hd68k_dsk_ram_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x900000, 0x90ffff, 0, 0, hd68k_dsk_ram_r, hd68k_dsk_ram_w);
hddsk_ram = (UINT16 *)(usr3 + 0x40000);
/* install extra ZRAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x910000, 0x910fff, 0, 0, hd68k_dsk_zram_r, hd68k_dsk_zram_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x910000, 0x910fff, 0, 0, hd68k_dsk_zram_r, hd68k_dsk_zram_w);
hddsk_zram = (UINT16 *)(usr3 + 0x50000);
/* install ASIC65 */
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x914000, 0x917fff, 0, 0, asic65_data_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x914000, 0x917fff, 0, 0, asic65_r);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x918000, 0x91bfff, 0, 0, asic65_io_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x914000, 0x917fff, 0, 0, asic65_data_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x914000, 0x917fff, 0, 0, asic65_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x918000, 0x91bfff, 0, 0, asic65_io_r);
/* install extra ROM */
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x940000, 0x9fffff, 0, 0, hd68k_dsk_small_rom_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x940000, 0x9fffff, 0, 0, hd68k_dsk_small_rom_r);
hddsk_rom = (UINT16 *)(usr3 + 0x00000);
/* set up the ASIC65 */
@@ -3580,22 +3580,22 @@ static void init_dsk2(running_machine *machine)
UINT8 *usr3 = memory_region(machine, "user3");
/* install ASIC65 */
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x824000, 0x824003, 0, 0, asic65_data_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x824000, 0x824003, 0, 0, asic65_r);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x825000, 0x825001, 0, 0, asic65_io_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x824000, 0x824003, 0, 0, asic65_data_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x824000, 0x824003, 0, 0, asic65_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x825000, 0x825001, 0, 0, asic65_io_r);
/* install ASIC61 */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x827000, 0x8277ff, 0, 0, hd68k_dsk_dsp32_r, hd68k_dsk_dsp32_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x827000, 0x8277ff, 0, 0, hd68k_dsk_dsp32_r, hd68k_dsk_dsp32_w);
/* install control registers */
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x827800, 0x82781f, 0, 0, hd68k_dsk_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x827800, 0x82781f, 0, 0, hd68k_dsk_control_w);
/* install extra RAM */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x880000, 0x8bffff, 0, 0, hd68k_dsk_ram_r, hd68k_dsk_ram_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x880000, 0x8bffff, 0, 0, hd68k_dsk_ram_r, hd68k_dsk_ram_w);
hddsk_ram = (UINT16 *)(usr3 + 0x100000);
/* install extra ROM */
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x900000, 0x9fffff, 0, 0, hd68k_dsk_rom_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x900000, 0x9fffff, 0, 0, hd68k_dsk_rom_r);
hddsk_rom = (UINT16 *)(usr3 + 0x000000);
/* set up the ASIC65 */
@@ -3607,15 +3607,15 @@ static void init_dsk2(running_machine *machine)
static void init_dspcom(running_machine *machine)
{
/* install ASIC65 */
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x900000, 0x900003, 0, 0, asic65_data_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x900000, 0x900003, 0, 0, asic65_r);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x901000, 0x910001, 0, 0, asic65_io_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x900000, 0x900003, 0, 0, asic65_data_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x900000, 0x900003, 0, 0, asic65_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x901000, 0x910001, 0, 0, asic65_io_r);
/* set up the ASIC65 */
asic65_config(machine, ASIC65_STEELTAL);
/* install DSPCOM control */
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x904000, 0x90401f, 0, 0, hddspcom_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x904000, 0x90401f, 0, 0, hddspcom_control_w);
}
@@ -3625,9 +3625,9 @@ static void init_driver_sound(running_machine *machine)
hdsnd_init(machine);
/* install sound handlers */
- memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x840000, 0x840001, 0, 0, hd68k_snd_data_r, hd68k_snd_data_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x844000, 0x844001, 0, 0, hd68k_snd_status_r);
- memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x84c000, 0x84c001, 0, 0, hd68k_snd_reset_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x840000, 0x840001, 0, 0, hd68k_snd_data_r, hd68k_snd_data_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x844000, 0x844001, 0, 0, hd68k_snd_status_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x84c000, 0x84c001, 0, 0, hd68k_snd_reset_w);
}
@@ -3647,18 +3647,18 @@ static DRIVER_INIT( harddriv )
init_driver_sound(machine);
/* set up gsp speedup handler */
- hdgsp_speedup_addr[0] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
- hdgsp_speedup_addr[1] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfffcfc00, 0xfffcfc0f, 0, 0, hdgsp_speedup2_w);
- memory_install_read16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup_r);
+ hdgsp_speedup_addr[0] = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
+ hdgsp_speedup_addr[1] = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfffcfc00, 0xfffcfc0f, 0, 0, hdgsp_speedup2_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup_r);
hdgsp_speedup_pc = 0xffc00f10;
/* set up msp speedup handler */
- hdmsp_speedup_addr = memory_install_write16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_w);
- memory_install_read16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_r);
+ hdmsp_speedup_addr = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_r);
hdmsp_speedup_pc = 0x00723b00;
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
}
@@ -3670,18 +3670,18 @@ static DRIVER_INIT( harddrvc )
init_driver_sound(machine);
/* set up gsp speedup handler */
- hdgsp_speedup_addr[0] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
- hdgsp_speedup_addr[1] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfffcfc00, 0xfffcfc0f, 0, 0, hdgsp_speedup2_w);
- memory_install_read16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup_r);
+ hdgsp_speedup_addr[0] = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
+ hdgsp_speedup_addr[1] = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfffcfc00, 0xfffcfc0f, 0, 0, hdgsp_speedup2_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup_r);
hdgsp_speedup_pc = 0xfff40ff0;
/* set up msp speedup handler */
- hdmsp_speedup_addr = memory_install_write16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_w);
- memory_install_read16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_r);
+ hdmsp_speedup_addr = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x00751b00, 0x00751b0f, 0, 0, hdmsp_speedup_r);
hdmsp_speedup_pc = 0x00723b00;
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
}
@@ -3693,13 +3693,13 @@ static DRIVER_INIT( stunrun )
atarijsa_init(machine, "IN0", 0x0020);
/* set up gsp speedup handler */
- hdgsp_speedup_addr[0] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
- hdgsp_speedup_addr[1] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfffcfc00, 0xfffcfc0f, 0, 0, hdgsp_speedup2_w);
- memory_install_read16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup_r);
+ hdgsp_speedup_addr[0] = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
+ hdgsp_speedup_addr[1] = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfffcfc00, 0xfffcfc0f, 0, 0, hdgsp_speedup2_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup_r);
hdgsp_speedup_pc = 0xfff41070;
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
}
@@ -3733,17 +3733,17 @@ static DRIVER_INIT( racedriv )
/* set up the slapstic */
slapstic_init(machine, 117);
- hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
+ hd68k_slapstic_base = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
/* synchronization */
- rddsp32_sync[0] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613c00, 0x613c03, 0, 0, rddsp32_sync0_w);
- rddsp32_sync[1] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613e00, 0x613e03, 0, 0, rddsp32_sync1_w);
+ rddsp32_sync[0] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613c00, 0x613c03, 0, 0, rddsp32_sync0_w);
+ rddsp32_sync[1] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613e00, 0x613e03, 0, 0, rddsp32_sync1_w);
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
/* set up dsp32 speedup handlers */
- rddsp32_speedup = memory_install_read32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613e04, 0x613e07, 0, 0, rddsp32_speedup_r);
+ rddsp32_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613e04, 0x613e07, 0, 0, rddsp32_speedup_r);
rddsp32_speedup_pc = 0x6054b0;
}
@@ -3758,25 +3758,25 @@ static void racedrvc_init_common(running_machine *machine, offs_t gsp_protection
/* set up the slapstic */
slapstic_init(machine, 117);
- hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
+ hd68k_slapstic_base = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
/* synchronization */
- rddsp32_sync[0] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613c00, 0x613c03, 0, 0, rddsp32_sync0_w);
- rddsp32_sync[1] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613e00, 0x613e03, 0, 0, rddsp32_sync1_w);
+ rddsp32_sync[0] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613c00, 0x613c03, 0, 0, rddsp32_sync0_w);
+ rddsp32_sync[1] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613e00, 0x613e03, 0, 0, rddsp32_sync1_w);
/* set up protection hacks */
- hdgsp_protection = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, gsp_protection, gsp_protection + 0x0f, 0, 0, hdgsp_protection_w);
+ hdgsp_protection = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), gsp_protection, gsp_protection + 0x0f, 0, 0, hdgsp_protection_w);
/* set up gsp speedup handler */
- hdgsp_speedup_addr[0] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff76f60, 0xfff76f6f, 0, 0, rdgsp_speedup1_w);
- memory_install_read16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff76f60, 0xfff76f6f, 0, 0, rdgsp_speedup1_r);
+ hdgsp_speedup_addr[0] = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff76f60, 0xfff76f6f, 0, 0, rdgsp_speedup1_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff76f60, 0xfff76f6f, 0, 0, rdgsp_speedup1_r);
hdgsp_speedup_pc = 0xfff43a00;
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
/* set up dsp32 speedup handlers */
- rddsp32_speedup = memory_install_read32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613e04, 0x613e07, 0, 0, rddsp32_speedup_r);
+ rddsp32_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613e04, 0x613e07, 0, 0, rddsp32_speedup_r);
rddsp32_speedup_pc = 0x6054b0;
}
@@ -3799,34 +3799,34 @@ static void steeltal_init_common(running_machine *machine, offs_t ds3_transfer_p
init_dspcom(machine);
atarijsa_init(machine, "IN0", 0x0020);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x908000, 0x908001, 0, 0, steeltal_dummy_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x908000, 0x908001, 0, 0, steeltal_dummy_r);
/* set up the SLOOP */
if (!proto_sloop)
{
- hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, st68k_sloop_r, st68k_sloop_w);
- st68k_sloop_alt_base = memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x4e000, 0x4ffff, 0, 0, st68k_sloop_alt_r);
+ hd68k_slapstic_base = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xe0000, 0xfffff, 0, 0, st68k_sloop_r, st68k_sloop_w);
+ st68k_sloop_alt_base = memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0x4e000, 0x4ffff, 0, 0, st68k_sloop_alt_r);
}
else
- hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, st68k_protosloop_r, st68k_protosloop_w);
+ hd68k_slapstic_base = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xe0000, 0xfffff, 0, 0, st68k_protosloop_r, st68k_protosloop_w);
/* synchronization */
stmsp_sync[0] = &hdmsp_ram[TOWORD(0x80010)];
- memory_install_write16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x80010, 0x8007f, 0, 0, stmsp_sync0_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x80010, 0x8007f, 0, 0, stmsp_sync0_w);
stmsp_sync[1] = &hdmsp_ram[TOWORD(0x99680)];
- memory_install_write16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x99680, 0x9968f, 0, 0, stmsp_sync1_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x99680, 0x9968f, 0, 0, stmsp_sync1_w);
stmsp_sync[2] = &hdmsp_ram[TOWORD(0x99d30)];
- memory_install_write16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x99d30, 0x99d4f, 0, 0, stmsp_sync2_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x99d30, 0x99d4f, 0, 0, stmsp_sync2_w);
/* set up protection hacks */
- hdgsp_protection = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff965d0, 0xfff965df, 0, 0, hdgsp_protection_w);
+ hdgsp_protection = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff965d0, 0xfff965df, 0, 0, hdgsp_protection_w);
/* set up msp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_msp, ADDRESS_SPACE_PROGRAM, 0x80020, 0x8002f, 0, 0, stmsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_msp], ADDRESS_SPACE_PROGRAM), 0x80020, 0x8002f, 0, 0, stmsp_speedup_r);
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1f99, 0x1f99, 0, 0, hdds3_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1f99, 0x1f99, 0, 0, hdds3_speedup_r);
hdds3_speedup_addr = &hdadsp_data_memory[0x1f99];
hdds3_speedup_pc = 0xff;
hdds3_transfer_pc = ds3_transfer_pc;
@@ -3847,20 +3847,20 @@ static DRIVER_INIT( strtdriv )
/* set up the slapstic */
slapstic_init(machine, 117);
- hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
+ hd68k_slapstic_base = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xa80000, 0xafffff, 0, 0, hda68k_port1_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xa80000, 0xafffff, 0, 0, hda68k_port1_r);
/* synchronization */
- rddsp32_sync[0] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613c00, 0x613c03, 0, 0, rddsp32_sync0_w);
- rddsp32_sync[1] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x613e00, 0x613e03, 0, 0, rddsp32_sync1_w);
+ rddsp32_sync[0] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613c00, 0x613c03, 0, 0, rddsp32_sync0_w);
+ rddsp32_sync[1] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x613e00, 0x613e03, 0, 0, rddsp32_sync1_w);
/* set up protection hacks */
- hdgsp_protection = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff960a0, 0xfff960af, 0, 0, hdgsp_protection_w);
+ hdgsp_protection = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff960a0, 0xfff960af, 0, 0, hdgsp_protection_w);
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1f99, 0x1f99, 0, 0, hdds3_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1f99, 0x1f99, 0, 0, hdds3_speedup_r);
hdds3_speedup_addr = &hdadsp_data_memory[0x1f99];
hdds3_speedup_pc = 0xff;
hdds3_transfer_pc = 0x43672;
@@ -3874,18 +3874,18 @@ static DRIVER_INIT( hdrivair )
init_ds3(machine);
init_dsk2(machine);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xa80000, 0xafffff, 0, 0, hda68k_port1_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xa80000, 0xafffff, 0, 0, hda68k_port1_r);
/* synchronization */
- rddsp32_sync[0] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x21fe00, 0x21fe03, 0, 0, rddsp32_sync0_w);
- rddsp32_sync[1] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x21ff00, 0x21ff03, 0, 0, rddsp32_sync1_w);
+ rddsp32_sync[0] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x21fe00, 0x21fe03, 0, 0, rddsp32_sync0_w);
+ rddsp32_sync[1] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x21ff00, 0x21ff03, 0, 0, rddsp32_sync1_w);
/* set up protection hacks */
- hdgsp_protection = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff943f0, 0xfff943ff, 0, 0, hdgsp_protection_w);
+ hdgsp_protection = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff943f0, 0xfff943ff, 0, 0, hdgsp_protection_w);
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1f99, 0x1f99, 0, 0, hdds3_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1f99, 0x1f99, 0, 0, hdds3_speedup_r);
hdds3_speedup_addr = &hdadsp_data_memory[0x1f99];
hdds3_speedup_pc = 0x2da;
hdds3_transfer_pc = 0x407b8;
@@ -3899,18 +3899,18 @@ static DRIVER_INIT( hdrivaip )
init_ds3(machine);
init_dsk2(machine);
- memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xa80000, 0xafffff, 0, 0, hda68k_port1_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_main], ADDRESS_SPACE_PROGRAM), 0xa80000, 0xafffff, 0, 0, hda68k_port1_r);
/* synchronization */
- rddsp32_sync[0] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x21fe00, 0x21fe03, 0, 0, rddsp32_sync0_w);
- rddsp32_sync[1] = memory_install_write32_handler(machine, hdcpu_dsp32, ADDRESS_SPACE_PROGRAM, 0x21ff00, 0x21ff03, 0, 0, rddsp32_sync1_w);
+ rddsp32_sync[0] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x21fe00, 0x21fe03, 0, 0, rddsp32_sync0_w);
+ rddsp32_sync[1] = memory_install_write32_handler(cpu_get_address_space(machine->cpu[hdcpu_dsp32], ADDRESS_SPACE_PROGRAM), 0x21ff00, 0x21ff03, 0, 0, rddsp32_sync1_w);
/* set up protection hacks */
- hdgsp_protection = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff916c0, 0xfff916cf, 0, 0, hdgsp_protection_w);
+ hdgsp_protection = memory_install_write16_handler(cpu_get_address_space(machine->cpu[hdcpu_gsp], ADDRESS_SPACE_PROGRAM), 0xfff916c0, 0xfff916cf, 0, 0, hdgsp_protection_w);
/* set up adsp speedup handlers */
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
- memory_install_read16_handler(machine, hdcpu_adsp, ADDRESS_SPACE_DATA, 0x1f9a, 0x1f9a, 0, 0, hdds3_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1fff, 0x1fff, 0, 0, hdadsp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[hdcpu_adsp], ADDRESS_SPACE_DATA), 0x1f9a, 0x1f9a, 0, 0, hdds3_speedup_r);
hdds3_speedup_addr = &hdadsp_data_memory[0x1f9a];
hdds3_speedup_pc = 0x2d9;
hdds3_transfer_pc = 0X407da;
diff --git a/src/mame/drivers/homedata.c b/src/mame/drivers/homedata.c
index 57bb8996967..da251ae7a8f 100644
--- a/src/mame/drivers/homedata.c
+++ b/src/mame/drivers/homedata.c
@@ -1788,15 +1788,15 @@ static DRIVER_INIT( jogakuen )
/* it seems that Mahjong Jogakuen runs on the same board as the others,
but with just these two addresses swapped. Instead of creating a new
MachineDriver, I just fix them here. */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8007, 0x8007, 0, 0, pteacher_blitter_bank_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8005, 0x8005, 0, 0, pteacher_gfx_bank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8007, 0x8007, 0, 0, pteacher_blitter_bank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8005, 0x8005, 0, 0, pteacher_gfx_bank_w);
}
static DRIVER_INIT( mjikaga )
{
/* Mahjong Ikagadesuka is different as well. */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7802, 0x7802, 0, 0, pteacher_snd_r);
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0123, 0x0123, 0, 0, pteacher_snd_answer_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7802, 0x7802, 0, 0, pteacher_snd_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0123, 0x0123, 0, 0, pteacher_snd_answer_w);
}
static DRIVER_INIT( reikaids )
diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c
index 6a31c90c4fc..6e660726dc3 100644
--- a/src/mame/drivers/hornet.c
+++ b/src/mame/drivers/hornet.c
@@ -1028,7 +1028,7 @@ static MACHINE_RESET( hornet )
UINT8 *usr5 = memory_region(machine, "user5");
if (usr3 != NULL)
{
- memory_configure_bank(1, 0, memory_region_length(machine, "user3") / 0x40000, usr3, 0x40000);
+ memory_configure_bank(machine, 1, 0, memory_region_length(machine, "user3") / 0x40000, usr3, 0x40000);
memory_set_bank(1, 0);
}
@@ -1101,7 +1101,7 @@ static MACHINE_RESET( hornet_2board )
if (usr3 != NULL)
{
- memory_configure_bank(1, 0, memory_region_length(machine, "user3") / 0x40000, usr3, 0x40000);
+ memory_configure_bank(machine, 1, 0, memory_region_length(machine, "user3") / 0x40000, usr3, 0x40000);
memory_set_bank(1, 0);
}
cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE);
diff --git a/src/mame/drivers/hshavoc.c b/src/mame/drivers/hshavoc.c
index f72799318e3..ba1688f0b21 100644
--- a/src/mame/drivers/hshavoc.c
+++ b/src/mame/drivers/hshavoc.c
@@ -206,7 +206,7 @@ static READ16_HANDLER( vdp_fake_r )
static DRIVER_INIT(genesis)
{
/* hack -- fix vdp emulation instead */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC00004, 0xC00005, 0, 0, vdp_fake_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xC00004, 0xC00005, 0, 0, vdp_fake_r);
memory_set_bankptr(3, memory_region(machine, "main") );
memory_set_bankptr(4, genesis_68k_ram );
diff --git a/src/mame/drivers/hyprduel.c b/src/mame/drivers/hyprduel.c
index 7b170c46617..ec1666f7289 100644
--- a/src/mame/drivers/hyprduel.c
+++ b/src/mame/drivers/hyprduel.c
@@ -817,12 +817,12 @@ static DRIVER_INIT( hyprduel )
// ROM[(0x174b9*0x20)+0x1f] |= 0x0e; /* I */
// ROM[(0x174e9*0x20)+0x1f] |= 0x0e;
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc07fff, 0, 0, hypr_sharedram1_w);
- memory_install_write16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc07fff, 0, 0, hypr_sharedram1_w);
- memory_install_write16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x000000, 0x003fff, 0, 0, hypr_sharedram1_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc07fff, 0, 0, hypr_sharedram1_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc07fff, 0, 0, hypr_sharedram1_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x000000, 0x003fff, 0, 0, hypr_sharedram1_w);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfe0000, 0xffffff, 0, 0, hypr_sharedram2_w);
- memory_install_write16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xfe0000, 0xffffff, 0, 0, hypr_sharedram2_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe0000, 0xffffff, 0, 0, hypr_sharedram2_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfe0000, 0xffffff, 0, 0, hypr_sharedram2_w);
requested_int = 0x00;
blitter_bit = 2;
diff --git a/src/mame/drivers/iqblock.c b/src/mame/drivers/iqblock.c
index dcb0e57f703..2a359d8371d 100644
--- a/src/mame/drivers/iqblock.c
+++ b/src/mame/drivers/iqblock.c
@@ -492,7 +492,7 @@ static DRIVER_INIT( iqblock )
paletteram_2 = rom + 0x12800;
iqblock_fgvideoram = rom + 0x16800;
iqblock_bgvideoram = rom + 0x17000;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfe26, 0xfe26, 0, 0, iqblock_prot_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe26, 0xfe26, 0, 0, iqblock_prot_w);
iqblock_video_type=1;
}
@@ -514,7 +514,7 @@ static DRIVER_INIT( grndtour )
paletteram_2 = rom + 0x12800;
iqblock_fgvideoram = rom + 0x16800;
iqblock_bgvideoram = rom + 0x17000;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfe39, 0xfe39, 0, 0, grndtour_prot_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe39, 0xfe39, 0, 0, grndtour_prot_w);
iqblock_video_type=0;
}
diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c
index 859ca1e45d5..dd806919969 100644
--- a/src/mame/drivers/itech32.c
+++ b/src/mame/drivers/itech32.c
@@ -3876,8 +3876,8 @@ static DRIVER_INIT( drivedge )
itech32_planes = 1;
is_drivedge = 1;
- memory_install_read32_handler(machine, 2, ADDRESS_SPACE_PROGRAM, 0x8382, 0x8382, 0, 0, drivedge_tms1_speedup_r);
- memory_install_read32_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x8382, 0x8382, 0, 0, drivedge_tms2_speedup_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x8382, 0x8382, 0, 0, drivedge_tms1_speedup_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x8382, 0x8382, 0, 0, drivedge_tms2_speedup_r);
}
@@ -3895,10 +3895,10 @@ static DRIVER_INIT( wcbowl )
itech32_vram_height = 1024;
itech32_planes = 1;
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x680000, 0x680001, 0, 0, trackball_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x680000, 0x680001, 0, 0, trackball_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x578000, 0x57ffff, 0, 0, SMH_NOP);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x680080, 0x680081, 0, 0, wcbowl_prot_result_r, SMH_NOP);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x578000, 0x57ffff, 0, 0, SMH_NOP);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x680080, 0x680081, 0, 0, wcbowl_prot_result_r, SMH_NOP);
}
@@ -3911,8 +3911,8 @@ static void init_sftm_common(running_machine *machine, int prot_addr)
itech020_prot_address = prot_addr;
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x300000, 0x300003, 0, 0, itech020_color2_w);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x380000, 0x380003, 0, 0, itech020_color1_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x300000, 0x300003, 0, 0, itech020_color2_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x380000, 0x380003, 0, 0, itech020_color1_w);
}
@@ -3942,10 +3942,10 @@ static void init_shuffle_bowl_common(running_machine *machine, int prot_addr)
itech020_prot_address = prot_addr;
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x300000, 0x300003, 0, 0, itech020_color2_w);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x380000, 0x380003, 0, 0, itech020_color1_w);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180800, 0x180803, 0, 0, trackball32_4bit_r);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x181000, 0x181003, 0, 0, trackball32_4bit_p2_r);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x300000, 0x300003, 0, 0, itech020_color2_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x380000, 0x380003, 0, 0, itech020_color1_w);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180800, 0x180803, 0, 0, trackball32_4bit_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x181000, 0x181003, 0, 0, trackball32_4bit_p2_r);
}
@@ -3964,7 +3964,7 @@ static DRIVER_INIT( wcbowln ) /* PIC 16C54 labeled as ITBWL-3 */
static void install_timekeeper(running_machine *machine)
{
const device_config *device = device_list_find_by_tag(machine->config->devicelist, M48T02, "m48t02");
- memory_install_readwrite32_device_handler(device, 0, ADDRESS_SPACE_PROGRAM, 0x681000, 0x6817ff, 0, 0, timekeeper_32be_r, timekeeper_32be_w);
+ memory_install_readwrite32_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), device, 0x681000, 0x6817ff, 0, 0, timekeeper_32be_r, timekeeper_32be_w);
}
static DRIVER_INIT( wcbowlt ) /* PIC 16C54 labeled as ITBWL-3 */
@@ -3995,7 +3995,7 @@ static DRIVER_INIT( gt3d )
Hacked versions of this PCB have been found with GT97
through GTClassic. This is _NOT_ a factory modification
*/
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x200003, 0, 0, trackball32_8bit_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x200003, 0, 0, trackball32_8bit_r);
init_gt_common(machine);
}
@@ -4008,8 +4008,8 @@ static DRIVER_INIT( aama )
board share the same sound CPU code and sample ROMs.
This board has all versions of GT for it, GT3D through GTClassic
*/
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180800, 0x180803, 0, 0, trackball32_4bit_r);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x181000, 0x181003, 0, 0, trackball32_4bit_p2_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180800, 0x180803, 0, 0, trackball32_4bit_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x181000, 0x181003, 0, 0, trackball32_4bit_p2_r);
init_gt_common(machine);
}
@@ -4033,7 +4033,7 @@ static DRIVER_INIT( s_ver )
board: GT97 v1.21S, GT98, GT99, GT2K & GT Classic Versions 1.00S
Trackball info is read through 200202 (actually 200203).
*/
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200200, 0x200203, 0, 0, trackball32_4bit_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200200, 0x200203, 0, 0, trackball32_4bit_r);
init_gt_common(machine);
}
@@ -4047,7 +4047,7 @@ static DRIVER_INIT( gt3dl )
Player 1 trackball read through 200003
Player 2 trackball read through 200002
*/
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x200003, 0, 0, trackball32_4bit_combined_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x200003, 0, 0, trackball32_4bit_combined_r);
init_gt_common(machine);
}
@@ -4055,7 +4055,7 @@ static DRIVER_INIT( gt3dl )
static DRIVER_INIT( gtclassp )
{
/* a little extra protection */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x680000, 0x680003, 0, 0, gtclass_prot_result_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x680000, 0x680003, 0, 0, gtclass_prot_result_r);
DRIVER_INIT_CALL(aama);
/* The protection code is:
diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c
index 0c3339723d3..03aaac1eab6 100644
--- a/src/mame/drivers/itech8.c
+++ b/src/mame/drivers/itech8.c
@@ -2679,25 +2679,25 @@ ROM_END
static DRIVER_INIT( grmatch )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0160, 0x0160, 0, 0, grmatch_palette_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0180, 0x0180, 0, 0, grmatch_xscroll_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01e0, 0x01ff, 0, 0, SMH_UNMAP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0160, 0x0160, 0, 0, grmatch_palette_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0180, 0x0180, 0, 0, grmatch_xscroll_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01e0, 0x01ff, 0, 0, SMH_UNMAP);
}
static DRIVER_INIT( slikshot )
{
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x0180, 0x0180, 0, 0, slikshot_z80_r);
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x01cf, 0x01cf, 0, 0, slikshot_z80_control_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01cf, 0x01cf, 0, 0, slikshot_z80_control_w);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0180, 0x0180, 0, 0, slikshot_z80_r);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01cf, 0x01cf, 0, 0, slikshot_z80_control_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01cf, 0x01cf, 0, 0, slikshot_z80_control_w);
}
static DRIVER_INIT( sstrike )
{
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x1180, 0x1180, 0, 0, slikshot_z80_r);
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x11cf, 0x11cf, 0, 0, slikshot_z80_control_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x11cf, 0x11cf, 0, 0, slikshot_z80_control_w);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1180, 0x1180, 0, 0, slikshot_z80_r);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x11cf, 0x11cf, 0, 0, slikshot_z80_control_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x11cf, 0x11cf, 0, 0, slikshot_z80_control_w);
}
@@ -2732,15 +2732,15 @@ static DRIVER_INIT( neckneck )
static DRIVER_INIT( rimrockn )
{
/* additional input ports */
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x0161, 0x0161, 0, 0, input_port_read_handler8(machine->portconfig, "161"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x0162, 0x0162, 0, 0, input_port_read_handler8(machine->portconfig, "162"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x0163, 0x0163, 0, 0, input_port_read_handler8(machine->portconfig, "163"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x0164, 0x0164, 0, 0, input_port_read_handler8(machine->portconfig, "164"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x0165, 0x0165, 0, 0, input_port_read_handler8(machine->portconfig, "165"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0161, 0x0161, 0, 0, input_port_read_handler8(machine->portconfig, "161"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0162, 0x0162, 0, 0, input_port_read_handler8(machine->portconfig, "162"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0163, 0x0163, 0, 0, input_port_read_handler8(machine->portconfig, "163"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0164, 0x0164, 0, 0, input_port_read_handler8(machine->portconfig, "164"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0165, 0x0165, 0, 0, input_port_read_handler8(machine->portconfig, "165"));
/* different banking mechanism (disable the old one) */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01a0, 0x01a0, 0, 0, rimrockn_bank_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01c0, 0x01df, 0, 0, itech8_blitter_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01a0, 0x01a0, 0, 0, rimrockn_bank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01c0, 0x01df, 0, 0, itech8_blitter_w);
}
diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c
index 70da5f30073..921cbb5dfc6 100644
--- a/src/mame/drivers/jack.c
+++ b/src/mame/drivers/jack.c
@@ -1334,11 +1334,12 @@ ROM_END
static void treahunt_decode(running_machine *machine)
{
int A;
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt = auto_malloc(0x4000);
int data;
- memory_set_decrypted_region(0, 0x0000, 0x3fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x3fff, decrypt);
/* Thanks to Mike Balfour for helping out with the decryption */
for (A = 0; A < 0x4000; A++)
@@ -1435,10 +1436,10 @@ static DRIVER_INIT( striv )
}
// Set-up the weirdest questions read ever done
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, striv_question_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xcfff, 0, 0, striv_question_r);
// Nop out unused sprites writes
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xb0ff, 0, 0, SMH_NOP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb0ff, 0, 0, SMH_NOP);
timer_rate = 128;
}
diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c
index 0e3a88a0f63..db9a13b5c3d 100644
--- a/src/mame/drivers/jalmah.c
+++ b/src/mame/drivers/jalmah.c
@@ -2230,45 +2230,45 @@ static READ16_HANDLER( suchipi_mcu_r )
static DRIVER_INIT( urashima )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80004, 0x80005, 0, 0, urashima_mcu_r );
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80012, 0x80013, 0, 0, urashima_mcu_w );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80004, 0x80005, 0, 0, urashima_mcu_r );
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80012, 0x80013, 0, 0, urashima_mcu_w );
mcu_prg = 0x12;
}
static DRIVER_INIT( daireika )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80004, 0x80005, 0, 0, daireika_mcu_r );
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80012, 0x80013, 0, 0, daireika_mcu_w );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80004, 0x80005, 0, 0, daireika_mcu_r );
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80012, 0x80013, 0, 0, daireika_mcu_w );
mcu_prg = 0x11;
}
static DRIVER_INIT( mjzoomin )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80004, 0x80005, 0, 0, mjzoomin_mcu_r );
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80012, 0x80013, 0, 0, mjzoomin_mcu_w );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80004, 0x80005, 0, 0, mjzoomin_mcu_r );
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80012, 0x80013, 0, 0, mjzoomin_mcu_w );
mcu_prg = 0x13;
}
static DRIVER_INIT( kakumei )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80004, 0x80005, 0, 0, kakumei_mcu_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80004, 0x80005, 0, 0, kakumei_mcu_r );
mcu_prg = 0x21;
}
static DRIVER_INIT( kakumei2 )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80004, 0x80005, 0, 0, kakumei_mcu_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80004, 0x80005, 0, 0, kakumei_mcu_r );
mcu_prg = 0x22;
}
static DRIVER_INIT( suchipi )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80004, 0x80005, 0, 0, suchipi_mcu_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80004, 0x80005, 0, 0, suchipi_mcu_r );
mcu_prg = 0x23;
}
diff --git a/src/mame/drivers/jchan.c b/src/mame/drivers/jchan.c
index 3b7f18a6e53..1bcb7d96701 100644
--- a/src/mame/drivers/jchan.c
+++ b/src/mame/drivers/jchan.c
@@ -882,8 +882,8 @@ static DRIVER_INIT( jchan )
{
DRIVER_INIT_CALL( decrypt_toybox_rom );
// install these here, putting them in the memory map causes issues
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x403ffe, 0x403fff, 0, 0, main2sub_cmd_w );
- memory_install_write16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400001, 0, 0, sub2main_cmd_w );
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x403ffe, 0x403fff, 0, 0, main2sub_cmd_w );
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400001, 0, 0, sub2main_cmd_w );
memset(jchan_mcu_com, 0, 4 * sizeof( UINT16 ) );
diff --git a/src/mame/drivers/jedi.c b/src/mame/drivers/jedi.c
index 646f42ec9c6..d858cd0aeb8 100644
--- a/src/mame/drivers/jedi.c
+++ b/src/mame/drivers/jedi.c
@@ -161,7 +161,7 @@ static MACHINE_START( jedi )
timer_adjust_oneshot(state->interrupt_timer, video_screen_get_time_until_pos(machine->primary_screen, 32, 0), 32);
/* configure the banks */
- memory_configure_bank(1, 0, 3, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 3, memory_region(machine, "main") + 0x10000, 0x4000);
/* set up save state */
state_save_register_global(state->nvram_enabled);
diff --git a/src/mame/drivers/junofrst.c b/src/mame/drivers/junofrst.c
index f43f8b32db5..3212b34effc 100644
--- a/src/mame/drivers/junofrst.c
+++ b/src/mame/drivers/junofrst.c
@@ -431,8 +431,8 @@ static DRIVER_INIT( junofrst )
{
UINT8 *decrypted = konami1_decode(machine, "main");
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x1000);
- memory_configure_bank_decrypted(1, 0, 16, decrypted + 0x10000, 0x1000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x1000);
+ memory_configure_bank_decrypted(machine, 1, 0, 16, decrypted + 0x10000, 0x1000);
}
diff --git a/src/mame/drivers/kangaroo.c b/src/mame/drivers/kangaroo.c
index 45020ce4071..a39a6ecdfa1 100644
--- a/src/mame/drivers/kangaroo.c
+++ b/src/mame/drivers/kangaroo.c
@@ -178,7 +178,7 @@ static UINT8 kangaroo_clock;
static MACHINE_START( kangaroo )
{
- memory_configure_bank(1, 0, 2, memory_region(machine, "gfx1"), 0x2000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "gfx1"), 0x2000);
state_save_register_global(kangaroo_clock);
}
@@ -186,7 +186,7 @@ static MACHINE_START( kangaroo )
static MACHINE_START( kangaroo_mcu )
{
MACHINE_START_CALL(kangaroo);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xef00, 0xefff, 0, 0, mcu_sim_r, mcu_sim_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xef00, 0xefff, 0, 0, mcu_sim_r, mcu_sim_w);
kangaroo_clock = 0;
}
diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c
index cce65876f94..1e726ca9864 100644
--- a/src/mame/drivers/kchamp.c
+++ b/src/mame/drivers/kchamp.c
@@ -681,11 +681,12 @@ ROM_END
static DRIVER_INIT( kchampvs )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted = auto_malloc(0x10000);
UINT8 *rom = memory_region(machine, "main");
int A;
- memory_set_decrypted_region(0, 0x0000, 0xffff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted);
for (A = 0;A < 0x10000;A++)
decrypted[A] = (rom[A] & 0x55) | ((rom[A] & 0x88) >> 2) | ((rom[A] & 0x22) << 2);
diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c
index 8dda22dc8d0..eebca6b650e 100644
--- a/src/mame/drivers/konamigv.c
+++ b/src/mame/drivers/konamigv.c
@@ -542,9 +542,9 @@ static DRIVER_INIT( simpbowl )
intelflash_init( 2, FLASH_FUJITSU_29F016A, NULL );
intelflash_init( 3, FLASH_FUJITSU_29F016A, NULL );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f680080, 0x1f68008f, 0, 0, flash_r, flash_w );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f6800c0, 0x1f6800c7, 0, 0, trackball_r );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f6800c8, 0x1f6800cb, 0, 0, unknown_r ); /* ?? */
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f680080, 0x1f68008f, 0, 0, flash_r, flash_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800c0, 0x1f6800c7, 0, 0, trackball_r );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800c8, 0x1f6800cb, 0, 0, unknown_r ); /* ?? */
DRIVER_INIT_CALL(konamigv);
}
@@ -630,9 +630,9 @@ static DRIVER_INIT( btchamp )
{
intelflash_init( 0, FLASH_SHARP_LH28F400, NULL );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f680080, 0x1f68008f, 0, 0, btc_trackball_r, btc_trackball_w );
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f6800e0, 0x1f6800e3, 0, 0, SMH_NOP );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f380000, 0x1f3fffff, 0, 0, btcflash_r, btcflash_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f680080, 0x1f68008f, 0, 0, btc_trackball_r, btc_trackball_w );
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800e0, 0x1f6800e3, 0, 0, SMH_NOP );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f380000, 0x1f3fffff, 0, 0, btcflash_r, btcflash_w );
DRIVER_INIT_CALL(konamigv);
}
@@ -686,8 +686,8 @@ static WRITE32_HANDLER( tokimeki_serial_w )
static DRIVER_INIT( tokimosh )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f680080, 0x1f680083, 0, 0, tokimeki_serial_r );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f680090, 0x1f680093, 0, 0, tokimeki_serial_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f680080, 0x1f680083, 0, 0, tokimeki_serial_r );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f680090, 0x1f680093, 0, 0, tokimeki_serial_w );
DRIVER_INIT_CALL(konamigv);
}
@@ -717,13 +717,13 @@ static DRIVER_INIT( kdeadeye )
{
intelflash_init( 0, FLASH_SHARP_LH28F400, NULL );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f680080, 0x1f680083, 0, 0, input_port_read_handler32(machine->portconfig, "GUNX1") );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f680090, 0x1f680093, 0, 0, input_port_read_handler32(machine->portconfig, "GUNY1") );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f6800a0, 0x1f6800a3, 0, 0, input_port_read_handler32(machine->portconfig, "GUNX2") );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f6800b0, 0x1f6800b3, 0, 0, input_port_read_handler32(machine->portconfig, "GUNY2") );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f6800c0, 0x1f6800c3, 0, 0, input_port_read_handler32(machine->portconfig, "BUTTONS") );
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f6800e0, 0x1f6800e3, 0, 0, kdeadeye_0_w );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f380000, 0x1f3fffff, 0, 0, btcflash_r, btcflash_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f680080, 0x1f680083, 0, 0, input_port_read_handler32(machine->portconfig, "GUNX1") );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f680090, 0x1f680093, 0, 0, input_port_read_handler32(machine->portconfig, "GUNY1") );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800a0, 0x1f6800a3, 0, 0, input_port_read_handler32(machine->portconfig, "GUNX2") );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800b0, 0x1f6800b3, 0, 0, input_port_read_handler32(machine->portconfig, "GUNY2") );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800c0, 0x1f6800c3, 0, 0, input_port_read_handler32(machine->portconfig, "BUTTONS") );
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f6800e0, 0x1f6800e3, 0, 0, kdeadeye_0_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f380000, 0x1f3fffff, 0, 0, btcflash_r, btcflash_w );
DRIVER_INIT_CALL(konamigv);
}
diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c
index 8c6be3ca1f7..60401bf93af 100644
--- a/src/mame/drivers/konamigx.c
+++ b/src/mame/drivers/konamigx.c
@@ -3356,8 +3356,8 @@ static DRIVER_INIT(konamigx)
switch (gameDefs[i].special)
{
case 1: // LE2 guns
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd44000, 0xd44003, 0, 0, le2_gun_H_r );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd44004, 0xd44007, 0, 0, le2_gun_V_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd44000, 0xd44003, 0, 0, le2_gun_H_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd44004, 0xd44007, 0, 0, le2_gun_V_r );
break;
case 2: // tkmmpzdm hack
@@ -3393,7 +3393,7 @@ static DRIVER_INIT(konamigx)
break;
case 7: // install type 4 Xilinx protection for non-type 3/4 games
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xcc0000, 0xcc0007, 0, 0, type4_prot_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc0000, 0xcc0007, 0, 0, type4_prot_w );
break;
case 8: // tbyahhoo
@@ -3408,14 +3408,14 @@ static DRIVER_INIT(konamigx)
switch (readback)
{
case BPP5:
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd4a000, 0xd4a00f, 0, 0, gx5bppspr_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd4a000, 0xd4a00f, 0, 0, gx5bppspr_r);
break;
case BPP66:
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd00000, 0xd01fff, 0, 0, K056832_6bpp_rom_long_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd00000, 0xd01fff, 0, 0, K056832_6bpp_rom_long_r);
case BPP6:
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd4a000, 0xd4a00f, 0, 0, gx6bppspr_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd4a000, 0xd4a00f, 0, 0, gx6bppspr_r);
break;
}
diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c
index 9611dce70c6..dd74748b631 100644
--- a/src/mame/drivers/ksys573.c
+++ b/src/mame/drivers/ksys573.c
@@ -1676,7 +1676,7 @@ static DRIVER_INIT( ge765pwbba )
uPD4701_init( 0 );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f640000, 0x1f6400ff, 0, 0, ge765pwbba_r, ge765pwbba_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f640000, 0x1f6400ff, 0, 0, ge765pwbba_r, ge765pwbba_w );
}
/*
@@ -1787,7 +1787,7 @@ static void gx700pwfbf_init( running_machine *machine, void (*output_callback_fu
gx700pwfbf_output_callback = output_callback_func;
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f640000, 0x1f6400ff, 0, 0, gx700pwbf_io_r, gx700pwbf_io_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f640000, 0x1f6400ff, 0, 0, gx700pwbf_io_r, gx700pwbf_io_w );
state_save_register_global_array( gx700pwbf_output_data );
}
@@ -2030,7 +2030,7 @@ static DRIVER_INIT( gtrfrks )
{
DRIVER_INIT_CALL(konami573);
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f600000, 0x1f6000ff, 0, 0, gtrfrks_io_r, gtrfrks_io_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f600000, 0x1f6000ff, 0, 0, gtrfrks_io_r, gtrfrks_io_w );
}
/* GX894 digital i/o */
@@ -2320,7 +2320,7 @@ static void gx894pwbba_init( running_machine *machine, void (*output_callback_fu
gx894pwbba_output_callback = output_callback_func;
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f640000, 0x1f6400ff, 0, 0, gx894pwbba_r, gx894pwbba_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f640000, 0x1f6400ff, 0, 0, gx894pwbba_r, gx894pwbba_w );
gx894_ram_write_offset = 0;
gx894_ram_read_offset = 0;
@@ -2349,7 +2349,7 @@ static DRIVER_INIT( gtrfrkdigital )
gx894pwbba_init( machine, NULL );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f600000, 0x1f6000ff, 0, 0, gtrfrks_io_r, gtrfrks_io_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f600000, 0x1f6000ff, 0, 0, gtrfrks_io_r, gtrfrks_io_w );
}
/* ddr solo */
@@ -2642,7 +2642,7 @@ static DRIVER_INIT( dmx )
gx894pwbba_init( machine, dmx_output_callback );
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f600000, 0x1f6000ff, 0, 0, dmx_io_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f600000, 0x1f6000ff, 0, 0, dmx_io_w );
}
/* salary man champ */
diff --git a/src/mame/drivers/kyugo.c b/src/mame/drivers/kyugo.c
index 2b84aeee6b7..43c27f81a89 100644
--- a/src/mame/drivers/kyugo.c
+++ b/src/mame/drivers/kyugo.c
@@ -1205,18 +1205,18 @@ ROM_END
static DRIVER_INIT( gyrodine )
{
/* add watchdog */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xe000, 0, 0, watchdog_reset_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xe000, 0, 0, watchdog_reset_w);
}
static DRIVER_INIT( srdmissn )
{
/* shared RAM is mapped at 0xe000 as well */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xe7ff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xe7ff, 0, 0, SMH_BANK1, SMH_BANK1);
memory_set_bankptr(1, shared_ram);
/* extra RAM on sub CPU */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8800, 0x8fff, 0, 0, SMH_BANK2, SMH_BANK2);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8800, 0x8fff, 0, 0, SMH_BANK2, SMH_BANK2);
memory_set_bankptr(2, auto_malloc(0x800));
}
diff --git a/src/mame/drivers/ladybug.c b/src/mame/drivers/ladybug.c
index c15b6fdfe9d..930b506c94c 100644
--- a/src/mame/drivers/ladybug.c
+++ b/src/mame/drivers/ladybug.c
@@ -961,11 +961,12 @@ static DRIVER_INIT( dorodon )
/* decode the opcodes */
offs_t i;
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted = auto_malloc(0x6000);
UINT8 *rom = memory_region(machine, "main");
UINT8 *table = memory_region(machine, "user1");
- memory_set_decrypted_region(0, 0x0000, 0x5fff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0x5fff, decrypted);
for (i = 0; i < 0x6000; i++)
decrypted[i] = table[rom[i]];
diff --git a/src/mame/drivers/leland.c b/src/mame/drivers/leland.c
index 4511984c834..537c5a85ce1 100644
--- a/src/mame/drivers/leland.c
+++ b/src/mame/drivers/leland.c
@@ -1920,11 +1920,11 @@ static void dasm_chunk(char *tag, UINT8 *base, UINT16 pc, UINT32 length, FILE *o
static void init_master_ports(running_machine *machine, UINT8 mvram_base, UINT8 io_base)
{
/* set up the master CPU VRAM I/O */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, mvram_base, mvram_base + 0x1f, 0, 0, leland_mvram_port_r, leland_mvram_port_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), mvram_base, mvram_base + 0x1f, 0, 0, leland_mvram_port_r, leland_mvram_port_w);
/* set up the master CPU I/O ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, io_base, io_base + 0x1f, 0, 0, leland_master_input_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, io_base, io_base + 0x0f, 0, 0, leland_master_output_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), io_base, io_base + 0x1f, 0, 0, leland_master_input_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), io_base, io_base + 0x0f, 0, 0, leland_master_output_w);
}
@@ -1959,8 +1959,8 @@ static DRIVER_INIT( cerberus )
init_master_ports(machine, 0x40, 0x80);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x80, 0x80, 0, 0, cerberus_dial_1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x90, 0x90, 0, 0, cerberus_dial_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x80, 0x80, 0, 0, cerberus_dial_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x90, 0x90, 0, 0, cerberus_dial_2_r);
}
@@ -2079,7 +2079,7 @@ static DRIVER_INIT( alleymas )
/* kludge warning: the game uses location E0CA to determine if the joysticks are available */
/* it gets cleared by the code, but there is no obvious way for the value to be set to a */
/* non-zero value. If the value is zero, the joystick is never read. */
- alleymas_kludge_mem = memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe0ca, 0xe0ca, 0, 0, alleymas_joystick_kludge);
+ alleymas_kludge_mem = memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe0ca, 0xe0ca, 0, 0, alleymas_joystick_kludge);
}
@@ -2132,9 +2132,9 @@ static DRIVER_INIT( dangerz )
init_master_ports(machine, 0x40, 0x80);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf4, 0xf4, 0, 0, dangerz_input_upper_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, dangerz_input_y_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfc, 0xfc, 0, 0, dangerz_input_x_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf4, 0xf4, 0, 0, dangerz_input_upper_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, dangerz_input_y_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, dangerz_input_x_r);
}
@@ -2225,10 +2225,10 @@ static DRIVER_INIT( redlin2p )
init_master_ports(machine, 0x00, 0xc0);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc0, 0, 0, redline_pedal_1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xd0, 0xd0, 0, 0, redline_pedal_2_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, redline_wheel_2_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfb, 0xfb, 0, 0, redline_wheel_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc0, 0, 0, redline_pedal_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xd0, 0xd0, 0, 0, redline_pedal_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, redline_wheel_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfb, 0xfb, 0, 0, redline_wheel_1_r);
}
@@ -2283,9 +2283,9 @@ static DRIVER_INIT( viper )
init_master_ports(machine, 0x00, 0xc0);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xa4, 0xa4, 0, 0, dangerz_input_upper_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb8, 0xb8, 0, 0, dangerz_input_y_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xbc, 0xbc, 0, 0, dangerz_input_x_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xa4, 0xa4, 0, 0, dangerz_input_upper_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xb8, 0xb8, 0, 0, dangerz_input_y_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xbc, 0xbc, 0, 0, dangerz_input_x_r);
}
@@ -2314,8 +2314,8 @@ static DRIVER_INIT( teamqb )
init_master_ports(machine, 0x40, 0x80);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
}
@@ -2344,8 +2344,8 @@ static DRIVER_INIT( aafb )
init_master_ports(machine, 0x00, 0xc0);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
}
@@ -2374,8 +2374,8 @@ static DRIVER_INIT( aafbb )
init_master_ports(machine, 0x80, 0x40);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
}
@@ -2404,8 +2404,8 @@ static DRIVER_INIT( aafbd2p )
init_master_ports(machine, 0x00, 0x40);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7c, 0x7c, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN5"));
}
@@ -2440,9 +2440,9 @@ static DRIVER_INIT( offroad )
init_master_ports(machine, 0x40, 0x80); /* yes, this is intentional */
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, offroad_wheel_3_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf9, 0xf9, 0, 0, offroad_wheel_1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfb, 0xfb, 0, 0, offroad_wheel_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, offroad_wheel_3_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf9, 0xf9, 0, 0, offroad_wheel_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfb, 0xfb, 0, 0, offroad_wheel_2_r);
}
@@ -2476,9 +2476,9 @@ static DRIVER_INIT( offroadt )
init_master_ports(machine, 0x80, 0x40);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, offroad_wheel_3_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf9, 0xf9, 0, 0, offroad_wheel_1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfb, 0xfb, 0, 0, offroad_wheel_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, offroad_wheel_3_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf9, 0xf9, 0, 0, offroad_wheel_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfb, 0xfb, 0, 0, offroad_wheel_2_r);
}
@@ -2510,7 +2510,7 @@ static DRIVER_INIT( pigout )
init_master_ports(machine, 0x00, 0x40);
/* set up additional input ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, input_port_read_handler8(machine->portconfig, "IN4"));
}
diff --git a/src/mame/drivers/lethalj.c b/src/mame/drivers/lethalj.c
index b078a4024ad..fb56ee5ea1c 100644
--- a/src/mame/drivers/lethalj.c
+++ b/src/mame/drivers/lethalj.c
@@ -907,21 +907,21 @@ ROM_END
static DRIVER_INIT( ripribit )
{
ticket_dispenser_init(200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x04100010, 0x0410001f, 0, 0, ripribit_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x04100010, 0x0410001f, 0, 0, ripribit_control_w);
}
static DRIVER_INIT( cfarm )
{
ticket_dispenser_init(200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x04100010, 0x0410001f, 0, 0, cfarm_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x04100010, 0x0410001f, 0, 0, cfarm_control_w);
}
static DRIVER_INIT( cclownz )
{
ticket_dispenser_init(200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x04100010, 0x0410001f, 0, 0, cclownz_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x04100010, 0x0410001f, 0, 0, cclownz_control_w);
}
diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c
index fb601ba2d38..7e230131c47 100644
--- a/src/mame/drivers/liberate.c
+++ b/src/mame/drivers/liberate.c
@@ -898,6 +898,7 @@ ROM_END
static void sound_cpu_decrypt(running_machine *machine)
{
+ const address_space *space = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted = auto_malloc(0x4000);
UINT8 *rom = memory_region(machine, "audio");
int i;
@@ -906,7 +907,7 @@ static void sound_cpu_decrypt(running_machine *machine)
for (i=0xc000; i<0x10000; i++)
decrypted[i-0xc000]=((rom[i] & 0x20) << 1) | ((rom[i] & 0x40) >> 1) | (rom[i] & 0x9f);
- memory_set_decrypted_region(1, 0xc000, 0xffff, decrypted);
+ memory_set_decrypted_region(space, 0xc000, 0xffff, decrypted);
}
static DRIVER_INIT( prosport )
@@ -925,16 +926,17 @@ static DRIVER_INIT( yellowcb )
{
DRIVER_INIT_CALL(prosport);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xa000, 0, 0, input_port_0_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa000, 0xa000, 0, 0, input_port_0_r);
}
static DRIVER_INIT( liberate )
{
int A;
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted = auto_malloc(0x10000);
UINT8 *ROM = memory_region(machine, "main");
- memory_set_decrypted_region(0, 0x0000, 0xffff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted);
/* Swap bits for opcodes only, not data */
for (A = 0;A < 0x10000;A++) {
diff --git a/src/mame/drivers/limenko.c b/src/mame/drivers/limenko.c
index debe7258b47..8fb78223d05 100644
--- a/src/mame/drivers/limenko.c
+++ b/src/mame/drivers/limenko.c
@@ -1007,21 +1007,21 @@ static READ32_HANDLER( spotty_speedup_r )
static DRIVER_INIT( dynabomb )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe2784, 0xe2787, 0, 0, dynabomb_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe2784, 0xe2787, 0, 0, dynabomb_speedup_r );
spriteram_bit = 1;
}
static DRIVER_INIT( legendoh )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x32ab0, 0x32ab3, 0, 0, legendoh_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x32ab0, 0x32ab3, 0, 0, legendoh_speedup_r );
spriteram_bit = 1;
}
static DRIVER_INIT( sb2003 )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x135800, 0x135803, 0, 0, sb2003_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x135800, 0x135803, 0, 0, sb2003_speedup_r );
spriteram_bit = 1;
}
@@ -1041,7 +1041,7 @@ static DRIVER_INIT( spotty )
dst[x+2] = (src[x+1]&0x0f) >> 0;
}
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6626c, 0x6626f, 0, 0, spotty_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6626c, 0x6626f, 0, 0, spotty_speedup_r );
spriteram_bit = 1;
}
diff --git a/src/mame/drivers/lkage.c b/src/mame/drivers/lkage.c
index 9499cdb448c..f7c8cf98b24 100644
--- a/src/mame/drivers/lkage.c
+++ b/src/mame/drivers/lkage.c
@@ -634,9 +634,9 @@ static READ8_HANDLER( fake_status_r )
static DRIVER_INIT( lkageb )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf062, 0xf062, 0, 0, fake_mcu_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf087, 0xf087, 0, 0, fake_status_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf062, 0xf062, 0, 0, fake_mcu_w );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf062, 0xf062, 0, 0, fake_mcu_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf087, 0xf087, 0, 0, fake_status_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf062, 0xf062, 0, 0, fake_mcu_w );
}
GAME( 1984, lkage, 0, lkage, lkage, 0, ROT0, "Taito Corporation", "The Legend of Kage", GAME_NO_COCKTAIL )
diff --git a/src/mame/drivers/looping.c b/src/mame/drivers/looping.c
index ea3a5fd8fde..44af14d8525 100644
--- a/src/mame/drivers/looping.c
+++ b/src/mame/drivers/looping.c
@@ -793,7 +793,7 @@ static DRIVER_INIT( looping )
rom[i] = BITSWAP8(rom[i], 0,1,2,3,4,5,6,7);
/* install protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7000, 0x7007, 0, 0, protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7000, 0x7007, 0, 0, protection_r);
}
diff --git a/src/mame/drivers/m62.c b/src/mame/drivers/m62.c
index 68802e8b0ff..cf0a0ca0780 100644
--- a/src/mame/drivers/m62.c
+++ b/src/mame/drivers/m62.c
@@ -2212,19 +2212,19 @@ ROM_END
static DRIVER_INIT( battroad )
{
/* configure memory banks */
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x2000);
}
static DRIVER_INIT( ldrun2 )
{
/* configure memory banks */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x10000, 0x2000);
}
static DRIVER_INIT( ldrun4 )
{
/* configure memory banks */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
}
static DRIVER_INIT( kidniki )
@@ -2236,26 +2236,26 @@ static DRIVER_INIT( kidniki )
memcpy(ROM + 0x08000, ROM + 0x10000, 0x2000);
/* configure memory banks */
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x2000);
}
static DRIVER_INIT( spelunkr )
{
/* configure memory banks */
- memory_configure_bank(1, 0, 4, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "main") + 0x10000, 0x2000);
}
static DRIVER_INIT( spelunk2 )
{
/* configure memory banks */
- memory_configure_bank(1, 0, 4, memory_region(machine, "main") + 0x20000, 0x1000);
- memory_configure_bank(2, 0, 16, memory_region(machine, "main") + 0x10000, 0x1000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "main") + 0x20000, 0x1000);
+ memory_configure_bank(machine, 2, 0, 16, memory_region(machine, "main") + 0x10000, 0x1000);
}
static DRIVER_INIT( youjyudn )
{
/* configure memory banks */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
}
GAME( 1984, kungfum, 0, kungfum, kungfum, 0, ROT0, "Irem", "Kung-Fu Master", 0 )
diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c
index be5cf003c40..f1e881d79c3 100644
--- a/src/mame/drivers/m72.c
+++ b/src/mame/drivers/m72.c
@@ -325,16 +325,16 @@ INLINE DRIVER_INIT( loht_mcu )
int sndnum = mame_find_cpu_index(machine, "sound");
protection_ram = auto_malloc(0x10000);
- memory_install_read16_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xbffff, 0, 0, SMH_BANK1);
- memory_install_write16_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, m72_main_mcu_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xbffff, 0, 0, SMH_BANK1);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, m72_main_mcu_w);
memory_set_bankptr(1, protection_ram);
- //memory_install_write16_handler(machine, cpunum, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, loht_sample_trigger_w);
- memory_install_write16_handler(machine, cpunum, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, m72_main_mcu_sound_w);
+ //memory_install_write16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, loht_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, m72_main_mcu_sound_w);
/* sound cpu */
- memory_install_write8_handler(machine, sndnum, ADDRESS_SPACE_IO, 0x82, 0x82, 0xff, 0, m72_snd_cpu_sample_w);
- memory_install_read8_handler (machine, sndnum, ADDRESS_SPACE_IO, 0x84, 0x84, 0xff, 0, m72_snd_cpu_sample_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[sndnum], ADDRESS_SPACE_IO), 0x82, 0x82, 0xff, 0, m72_snd_cpu_sample_w);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[sndnum], ADDRESS_SPACE_IO), 0x84, 0x84, 0xff, 0, m72_snd_cpu_sample_r);
#if 0
/* running the mcu at twice the speed, the following
@@ -697,9 +697,9 @@ static void install_protection_handler(running_machine *machine, const UINT8 *co
protection_ram = auto_malloc(0x1000);
protection_code = code;
protection_crc = crc;
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, SMH_BANK1);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0ffa, 0xb0ffb, 0, 0, protection_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb0fff, 0, 0, protection_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, SMH_BANK1);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0ffa, 0xb0ffb, 0, 0, protection_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, protection_w);
memory_set_bankptr(1, protection_ram);
}
@@ -707,42 +707,42 @@ static DRIVER_INIT( bchopper )
{
install_protection_handler(machine, bchopper_code,bchopper_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w);
}
static DRIVER_INIT( mrheli )
{
install_protection_handler(machine, bchopper_code,mrheli_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w);
}
static DRIVER_INIT( nspirit )
{
install_protection_handler(machine, nspirit_code,nspirit_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w);
}
static DRIVER_INIT( nspiritj )
{
install_protection_handler(machine, nspirit_code,nspiritj_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w);
}
static DRIVER_INIT( imgfight )
{
install_protection_handler(machine, imgfight_code,imgfight_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, imgfight_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, imgfight_sample_trigger_w);
}
static DRIVER_INIT( loht )
{
install_protection_handler(machine, loht_code,loht_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, loht_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, loht_sample_trigger_w);
/* since we skip the startup tests, clear video RAM to prevent garbage on title screen */
memset(m72_videoram2,0,0x4000);
@@ -752,33 +752,33 @@ static DRIVER_INIT( xmultipl )
{
install_protection_handler(machine, xmultipl_code,xmultipl_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, xmultipl_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, xmultipl_sample_trigger_w);
}
static DRIVER_INIT( dbreed72 )
{
install_protection_handler(machine, dbreed72_code,dbreed72_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, dbreed72_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, dbreed72_sample_trigger_w);
}
static DRIVER_INIT( airduel )
{
install_protection_handler(machine, airduel_code,airduel_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, airduel_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, airduel_sample_trigger_w);
}
static DRIVER_INIT( dkgenm72 )
{
install_protection_handler(machine, dkgenm72_code,dkgenm72_crc);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, dkgenm72_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, dkgenm72_sample_trigger_w);
}
static DRIVER_INIT( gallop )
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0xc0, 0xc1, 0, 0, gallop_sample_trigger_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, gallop_sample_trigger_w);
}
diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c
index 08eb1903540..b0826c346f9 100644
--- a/src/mame/drivers/m92.c
+++ b/src/mame/drivers/m92.c
@@ -2027,7 +2027,7 @@ static DRIVER_INIT( majtitl2 )
init_m92(machine, 1);
/* This game has an eprom on the game board */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0000, 0xf3fff, 0, 0, m92_eeprom_r, m92_eeprom_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0000, 0xf3fff, 0, 0, m92_eeprom_r, m92_eeprom_w);
m92_game_kludge=2;
}
@@ -2049,7 +2049,7 @@ static DRIVER_INIT( lethalth )
m92_irq_vectorbase=0x20;
/* NOP out the bankswitcher */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x20, 0x21, 0, 0, SMH_NOP);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x20, 0x21, 0, 0, SMH_NOP);
}
static DRIVER_INIT( nbbatman )
diff --git a/src/mame/drivers/macrossp.c b/src/mame/drivers/macrossp.c
index 2916a7274fd..ecb72726fc5 100644
--- a/src/mame/drivers/macrossp.c
+++ b/src/mame/drivers/macrossp.c
@@ -791,13 +791,13 @@ static WRITE32_HANDLER( quizmoon_speedup_w )
static DRIVER_INIT( macrossp )
{
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf10158, 0xf1015b, 0, 0, macrossp_speedup_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf10158, 0xf1015b, 0, 0, macrossp_speedup_w );
}
static DRIVER_INIT( quizmoon )
{
#ifdef UNUSED_FUNCTION
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf00020, 0xf00023, 0, 0, quizmoon_speedup_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00020, 0xf00023, 0, 0, quizmoon_speedup_w );
#endif
}
diff --git a/src/mame/drivers/mappy.c b/src/mame/drivers/mappy.c
index 3605a170a3f..877dd287685 100644
--- a/src/mame/drivers/mappy.c
+++ b/src/mame/drivers/mappy.c
@@ -2131,7 +2131,7 @@ static DRIVER_INIT( grobda )
However, removing the 15XX from the board causes sound to disappear completely, so
the DAC might be built-in after all.
*/
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0002, 0x0002, 0, 0, grobda_DAC_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0002, 0x0002, 0, 0, grobda_DAC_w );
DRIVER_INIT_CALL(58_56);
}
@@ -2139,7 +2139,7 @@ static DRIVER_INIT( grobda )
static DRIVER_INIT( digdug2 )
{
/* appears to not use the watchdog */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8000, 0, 0, SMH_NOP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0, SMH_NOP);
DRIVER_INIT_CALL(58_56);
}
diff --git a/src/mame/drivers/mcr.c b/src/mame/drivers/mcr.c
index 24ea86530e6..cb669c4c7cc 100644
--- a/src/mame/drivers/mcr.c
+++ b/src/mame/drivers/mcr.c
@@ -2479,7 +2479,7 @@ static DRIVER_INIT( twotiger )
mcr_init(90010, 91399, 90913);
mcr_sound_init(machine, MCR_SSIO);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe800, 0xefff, 0, 0x1000, twotiger_videoram_r, twotiger_videoram_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe800, 0xefff, 0, 0x1000, twotiger_videoram_r, twotiger_videoram_w);
}
diff --git a/src/mame/drivers/mcr3.c b/src/mame/drivers/mcr3.c
index 69cf77bae98..f6514f09823 100644
--- a/src/mame/drivers/mcr3.c
+++ b/src/mame/drivers/mcr3.c
@@ -1510,26 +1510,26 @@ static void mcr_common_init(running_machine *machine, int sound_board)
static DRIVER_INIT( demoderm )
{
mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x01, 0x01, 0, 0, demoderm_ip1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x02, 0x02, 0, 0, demoderm_ip2_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, demoderm_op6_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x01, 0x01, 0, 0, demoderm_ip1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x02, 0x02, 0, 0, demoderm_ip2_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x06, 0x06, 0, 0, demoderm_op6_w);
}
static DRIVER_INIT( sarge )
{
mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, turbocs_data_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x06, 0x06, 0, 0, turbocs_data_w);
}
static DRIVER_INIT( maxrpm )
{
mcr_common_init(machine, MCR_TURBO_CHIP_SQUEAK);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x01, 0x01, 0, 0, maxrpm_ip1_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x02, 0x02, 0, 0, maxrpm_ip2_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x05, 0x05, 0, 0, maxrpm_op5_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, maxrpm_op6_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x01, 0x01, 0, 0, maxrpm_ip1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x02, 0x02, 0, 0, maxrpm_ip2_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x05, 0x05, 0, 0, maxrpm_op5_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x06, 0x06, 0, 0, maxrpm_op6_w);
state_save_register_global(maxrpm_adc_control);
state_save_register_global(maxrpm_adc_select);
@@ -1542,26 +1542,26 @@ static DRIVER_INIT( maxrpm )
static DRIVER_INIT( rampage )
{
mcr_common_init(machine, MCR_SOUNDS_GOOD);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x04, 0x04, 0, 0, rampage_ip4_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, rampage_op6_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x04, 0x04, 0, 0, rampage_ip4_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x06, 0x06, 0, 0, rampage_op6_w);
}
static DRIVER_INIT( powerdrv )
{
mcr_common_init(machine, MCR_SOUNDS_GOOD);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x02, 0x02, 0, 0, powerdrv_ip2_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x05, 0x05, 0, 0, powerdrv_op5_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, powerdrv_op6_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x02, 0x02, 0, 0, powerdrv_ip2_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x05, 0x05, 0, 0, powerdrv_op5_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x06, 0x06, 0, 0, powerdrv_op6_w);
}
static DRIVER_INIT( stargrds )
{
mcr_common_init(machine, MCR_SOUNDS_GOOD);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0, stargrds_ip0_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x05, 0x05, 0, 0, stargrds_op5_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x06, 0x06, 0, 0, stargrds_op6_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0, stargrds_ip0_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x05, 0x05, 0, 0, stargrds_op5_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x06, 0x06, 0, 0, stargrds_op6_w);
}
@@ -1600,7 +1600,7 @@ static DRIVER_INIT( turbotag )
cpu_suspend(machine->cpu[1], SUSPEND_REASON_DISABLE, 1);
/* kludge for bad ROM read */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0b53, 0x0b53, 0, 0, turbotag_kludge_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0b53, 0x0b53, 0, 0, turbotag_kludge_r);
}
diff --git a/src/mame/drivers/mcr68.c b/src/mame/drivers/mcr68.c
index 3bf64ec9383..2e834da5ed5 100644
--- a/src/mame/drivers/mcr68.c
+++ b/src/mame/drivers/mcr68.c
@@ -1396,7 +1396,7 @@ static DRIVER_INIT( xenophob )
mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpu_get_clock(machine->cpu[0]) / 10) * (256 + 16));
/* install control port handler */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, xenophobe_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0c0000, 0x0cffff, 0, 0, xenophobe_control_w);
}
@@ -1408,9 +1408,9 @@ static DRIVER_INIT( spyhunt2 )
mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpu_get_clock(machine->cpu[0]) / 10) * (256 + 16));
/* analog port handling is a bit tricky */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, spyhunt2_control_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0d0000, 0x0dffff, 0, 0, spyhunt2_port_0_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0e0000, 0x0effff, 0, 0, spyhunt2_port_1_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0c0000, 0x0cffff, 0, 0, spyhunt2_control_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0d0000, 0x0dffff, 0, 0, spyhunt2_port_0_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0e0000, 0x0effff, 0, 0, spyhunt2_port_1_r);
}
@@ -1424,10 +1424,10 @@ static DRIVER_INIT( blasted )
mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpu_get_clock(machine->cpu[0]) / 10) * (256 + 16));
/* handle control writes */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, blasted_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0c0000, 0x0cffff, 0, 0, blasted_control_w);
/* 6840 is mapped to the lower 8 bits */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a0000, 0x0a000f, 0, 0, mcr68_6840_lower_r, mcr68_6840_lower_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0a0000, 0x0a000f, 0, 0, mcr68_6840_lower_r, mcr68_6840_lower_w);
}
@@ -1439,13 +1439,13 @@ static DRIVER_INIT( archrivl )
mcr68_timing_factor = attotime_make(0, HZ_TO_ATTOSECONDS(cpu_get_clock(machine->cpu[0]) / 10) * (256 + 16));
/* handle control writes */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0c0000, 0x0cffff, 0, 0, archrivl_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0c0000, 0x0cffff, 0, 0, archrivl_control_w);
/* 49-way joystick handling is a bit tricky */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0e0000, 0x0effff, 0, 0, archrivl_port_1_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0e0000, 0x0effff, 0, 0, archrivl_port_1_r);
/* 6840 is mapped to the lower 8 bits */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a0000, 0x0a000f, 0, 0, mcr68_6840_lower_r, mcr68_6840_lower_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0a0000, 0x0a000f, 0, 0, mcr68_6840_lower_r, mcr68_6840_lower_w);
}
diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c
index b34ed09d144..b056268a372 100644
--- a/src/mame/drivers/mediagx.c
+++ b/src/mame/drivers/mediagx.c
@@ -1190,7 +1190,7 @@ static void install_speedups(running_machine *machine, speedup_entry *entries, i
speedup_count = count;
for (i = 0; i < count; i++)
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, entries[i].offset, entries[i].offset + 3, 0, 0, speedup_handlers[i]);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), entries[i].offset, entries[i].offset + 3, 0, 0, speedup_handlers[i]);
#ifdef MAME_DEBUG
add_exit_callback(machine, report_speedups);
diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c
index 99a3a2cc1c5..863e1ef446d 100644
--- a/src/mame/drivers/megadriv.c
+++ b/src/mame/drivers/megadriv.c
@@ -2741,26 +2741,26 @@ static WRITE16_HANDLER( _32x_68k_a15100_w )
if (data & 0x01)
{
_32x_adapter_enabled = 1;
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0880000, 0x08fffff, 0, 0, SMH_BANK11, SMH_BANK11); // 'fixed' 512kb rom bank
+ memory_install_readwrite16_handler(space, 0x0880000, 0x08fffff, 0, 0, SMH_BANK11, SMH_BANK11); // 'fixed' 512kb rom bank
memory_set_bankptr( 11, memory_region(space->machine, "gamecart") );
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0900000, 0x09fffff, 0, 0, SMH_BANK12, SMH_BANK12); // 'bankable' 1024kb rom bank
+ memory_install_readwrite16_handler(space, 0x0900000, 0x09fffff, 0, 0, SMH_BANK12, SMH_BANK12); // 'bankable' 1024kb rom bank
memory_set_bankptr( 12, memory_region(space->machine, "gamecart") );
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10);
+ memory_install_readwrite16_handler(space, 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10);
memory_set_bankptr( 10, memory_region(space->machine, "32x_68k_bios") );
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a15180, 0x0a15181, 0, 0, _32x_68k_a15180_r, _32x_68k_a15180_w); // mode control regs
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a15182, 0x0a15183, 0, 0, _32x_68k_a15182_r, _32x_68k_a15182_w); // screen shift
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a15184, 0x0a15185, 0, 0, _32x_68k_a15184_r, _32x_68k_a15184_w); // autofill length reg
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a15186, 0x0a15187, 0, 0, _32x_68k_a15186_r, _32x_68k_a15186_w); // autofill address reg
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a15188, 0x0a15189, 0, 0, _32x_68k_a15188_r, _32x_68k_a15188_w); // autofill data reg / start fill
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a1518a, 0x0a1518b, 0, 0, _32x_68k_a1518a_r, _32x_68k_a1518a_w); // framebuffer control regs
+ memory_install_readwrite16_handler(space, 0x0a15180, 0x0a15181, 0, 0, _32x_68k_a15180_r, _32x_68k_a15180_w); // mode control regs
+ memory_install_readwrite16_handler(space, 0x0a15182, 0x0a15183, 0, 0, _32x_68k_a15182_r, _32x_68k_a15182_w); // screen shift
+ memory_install_readwrite16_handler(space, 0x0a15184, 0x0a15185, 0, 0, _32x_68k_a15184_r, _32x_68k_a15184_w); // autofill length reg
+ memory_install_readwrite16_handler(space, 0x0a15186, 0x0a15187, 0, 0, _32x_68k_a15186_r, _32x_68k_a15186_w); // autofill address reg
+ memory_install_readwrite16_handler(space, 0x0a15188, 0x0a15189, 0, 0, _32x_68k_a15188_r, _32x_68k_a15188_w); // autofill data reg / start fill
+ memory_install_readwrite16_handler(space, 0x0a1518a, 0x0a1518b, 0, 0, _32x_68k_a1518a_r, _32x_68k_a1518a_w); // framebuffer control regs
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a15200, 0x0a153ff, 0, 0, _32x_68k_palette_r, _32x_68k_palette_w); // access to 'palette' xRRRRRGGGGGBBBBB
+ memory_install_readwrite16_handler(space, 0x0a15200, 0x0a153ff, 0, 0, _32x_68k_palette_r, _32x_68k_palette_w); // access to 'palette' xRRRRRGGGGGBBBBB
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0840000, 0x085ffff, 0, 0, _32x_68k_dram_r, _32x_68k_dram_w); // access to 'display ram' (framebuffer)
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0860000, 0x087ffff, 0, 0, _32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w); // access to 'display ram' (framebuffer)
+ memory_install_readwrite16_handler(space, 0x0840000, 0x085ffff, 0, 0, _32x_68k_dram_r, _32x_68k_dram_w); // access to 'display ram' (framebuffer)
+ memory_install_readwrite16_handler(space, 0x0860000, 0x087ffff, 0, 0, _32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w); // access to 'display ram' (framebuffer)
@@ -2770,7 +2770,7 @@ static WRITE16_HANDLER( _32x_68k_a15100_w )
{
_32x_adapter_enabled = 0;
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10);
+ memory_install_readwrite16_handler(space, 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10);
memory_set_bankptr( 10, memory_region(space->machine, "gamecart") );
@@ -3936,14 +3936,14 @@ static void svp_init(running_machine *machine)
/* SVP stuff */
svp.dram = auto_malloc(0x20000);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x300000, 0x31ffff, 0, 0, SMH_BANK2, SMH_BANK2);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x300000, 0x31ffff, 0, 0, SMH_BANK2, SMH_BANK2);
memory_set_bankptr( 2, svp.dram );
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa15000, 0xa150ff, 0, 0, svp_68k_io_r, svp_68k_io_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15000, 0xa150ff, 0, 0, svp_68k_io_r, svp_68k_io_w);
// "cell arrange" 1 and 2
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x390000, 0x39ffff, 0, 0, svp_68k_cell1_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3a0000, 0x3affff, 0, 0, svp_68k_cell2_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x390000, 0x39ffff, 0, 0, svp_68k_cell1_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3a0000, 0x3affff, 0, 0, svp_68k_cell2_r);
- memory_install_read16_handler(machine, 2, ADDRESS_SPACE_PROGRAM, 0x438, 0x438, 0, 0, svp_speedup_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x438, 0x438, 0, 0, svp_speedup_r);
svp.iram = auto_malloc(0x800);
memory_set_bankptr( 3, svp.iram );
@@ -6611,28 +6611,28 @@ static WRITE8_HANDLER( z80_unmapped_w )
void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine)
{
/* INIT THE PORTS *********************************************************************************************/
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_IO, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
/* catch any addresses that don't get mapped */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, SMH_BANK1, SMH_BANK1);
memory_set_bankptr( 1, genz80.z80_prgram );
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, SMH_BANK6, SMH_BANK6);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, SMH_BANK6, SMH_BANK6);
memory_set_bankptr( 6, genz80.z80_prgram );
// not allowed??
-// memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1);
+// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, SMH_BANK1, SMH_BANK1);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4003, 0, 0, megadriv_z80_YM2612_read, megadriv_z80_YM2612_write);
- memory_install_write8_handler (machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w);
- memory_install_write8_handler (machine, 1, ADDRESS_SPACE_PROGRAM, 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w);
- memory_install_read8_handler (machine, 1, ADDRESS_SPACE_PROGRAM, 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4003, 0, 0, megadriv_z80_YM2612_read, megadriv_z80_YM2612_write);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data);
}
// these are tests for 'special case' hardware to make sure I don't break anything while rearranging things
@@ -6664,20 +6664,20 @@ DRIVER_INIT( _32x )
if (_32x_adapter_enabled == 0)
{
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000000, 0x03fffff, 0, 0, SMH_BANK10, SMH_BANK10);
memory_set_bankptr( 10, memory_region(machine, "gamecart") );
};
a15100_reg = 0x0000;
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa15100, 0xa15101, 0, 0, _32x_68k_a15100_r, _32x_68k_a15100_w); // framebuffer control regs
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa15102, 0xa15103, 0, 0, _32x_68k_a15102_r, _32x_68k_a15102_w); // send irq to sh2
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa15104, 0xa15105, 0, 0, _32x_68k_a15104_r, _32x_68k_a15104_w); // 68k BANK rom set
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa15106, 0xa15107, 0, 0, _32x_68k_a15106_r, _32x_68k_a15106_w); // dreq stuff
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15100, 0xa15101, 0, 0, _32x_68k_a15100_r, _32x_68k_a15100_w); // framebuffer control regs
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15102, 0xa15103, 0, 0, _32x_68k_a15102_r, _32x_68k_a15102_w); // send irq to sh2
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15104, 0xa15105, 0, 0, _32x_68k_a15104_r, _32x_68k_a15104_w); // 68k BANK rom set
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15106, 0xa15107, 0, 0, _32x_68k_a15106_r, _32x_68k_a15106_w); // dreq stuff
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa15120, 0xa1512f, 0, 0, _32x_68k_commsram_r, _32x_68k_commsram_w); // comms reg 0-7
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15120, 0xa1512f, 0, 0, _32x_68k_commsram_r, _32x_68k_commsram_w); // comms reg 0-7
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0a130ec, 0x0a130ef, 0, 0, _32x_68k_MARS_r); // system ID
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0a130ec, 0x0a130ef, 0, 0, _32x_68k_MARS_r); // system ID
diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c
index db9db34c478..d2efcc5d20c 100644
--- a/src/mame/drivers/megaplay.c
+++ b/src/mame/drivers/megaplay.c
@@ -1013,14 +1013,14 @@ static DRIVER_INIT (megaplay)
megplay_stat(machine);
/* for now ... */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa10000, 0xa1001f, 0, 0, OLD_megaplay_genesis_io_r, OLD_megaplay_genesis_io_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa10000, 0xa1001f, 0, 0, OLD_megaplay_genesis_io_r, OLD_megaplay_genesis_io_w);
/* megaplay has ram shared with the bios cpu here */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, SMH_BANK7, SMH_BANK7);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, SMH_BANK7, SMH_BANK7);
memory_set_bankptr(7, &ic36_ram[0]);
/* instead of a RAM mirror the 68k sees the extra ram of the 2nd z80 too */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa02000, 0xa03fff, 0, 0, megadriv_68k_read_z80_extra_ram, megadriv_68k_write_z80_extra_ram);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa02000, 0xa03fff, 0, 0, megadriv_68k_read_z80_extra_ram, megadriv_68k_write_z80_extra_ram);
}
/*
diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c
index 21a96f1813f..95eecaf778c 100644
--- a/src/mame/drivers/megasys1.c
+++ b/src/mame/drivers/megasys1.c
@@ -3981,13 +3981,13 @@ static DRIVER_INIT( jitsupro )
RAM[0x438/2] = 0x4e71; //
/* the sound code writes oki commands to both the lsb and msb */
- memory_install_write16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xa0000, 0xa0003, 0, 0, okim6295_data_0_both_w);
- memory_install_write16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xc0000, 0xc0003, 0, 0, okim6295_data_1_both_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xa0000, 0xa0003, 0, 0, okim6295_data_0_both_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc0000, 0xc0003, 0, 0, okim6295_data_1_both_w);
}
static DRIVER_INIT( peekaboo )
{
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100000, 0x100001, 0, 0, protection_peekaboo_r, protection_peekaboo_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x100001, 0, 0, protection_peekaboo_r, protection_peekaboo_w);
}
static DRIVER_INIT( phantasm )
@@ -4023,7 +4023,7 @@ static DRIVER_INIT( soldam )
astyanax_rom_decode(machine, "main");
/* Sprite RAM is mirrored. Why? */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8c000, 0x8cfff, 0, 0, soldamj_spriteram16_r, soldamj_spriteram16_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8c000, 0x8cfff, 0, 0, soldamj_spriteram16_r, soldamj_spriteram16_w);
}
@@ -4047,7 +4047,7 @@ static DRIVER_INIT( monkelf )
UINT16 *ROM = (UINT16*)memory_region(machine, "main");
ROM[0x00744/2] = 0x4e71;
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xe000f, 0, 0, monkelf_input_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe0000, 0xe000f, 0, 0, monkelf_input_r);
megasys1_ram += 0x10000/2;
diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c
index 619eb420cbc..71ba5ac4f50 100644
--- a/src/mame/drivers/megatech.c
+++ b/src/mame/drivers/megatech.c
@@ -272,7 +272,7 @@ static WRITE8_HANDLER( mt_sms_standard_rom_bank_w )
{
case 0:
logerror("bank w %02x %02x\n", offset, data);
- memory_install_readwrite8_handler(space->machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0xbfff, 0, 0, SMH_BANK5, SMH_UNMAP);
+ memory_install_readwrite8_handler(space, 0x0000, 0xbfff, 0, 0, SMH_BANK5, SMH_UNMAP);
//printf("bank ram??\n");
break;
@@ -306,19 +306,19 @@ READ8_HANDLER( md_sms_ioport_dd_r )
static void megatech_set_genz80_as_sms_standard_ports(running_machine *machine)
{
/* INIT THE PORTS *********************************************************************************************/
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_IO, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_IO, 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r, sms_sn76496_w);
- memory_install_write8_handler (machine, 1, ADDRESS_SPACE_IO, 0x7f, 0x7f, 0, 0, sms_sn76496_w);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_IO, 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_IO, 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x7e, 0x7e, 0, 0, md_sms_vdp_vcounter_r, sms_sn76496_w);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, sms_sn76496_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xbe, 0xbe, 0, 0, md_sms_vdp_data_r, md_sms_vdp_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xbf, 0xbf, 0, 0, md_sms_vdp_ctrl_r, md_sms_vdp_ctrl_w);
- memory_install_read8_handler (machine, 1, ADDRESS_SPACE_IO, 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x10, 0x10, 0, 0, megatech_sms_ioport_dd_r); // super tetris
- memory_install_read8_handler (machine, 1, ADDRESS_SPACE_IO, 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r);
- memory_install_read8_handler (machine, 1, ADDRESS_SPACE_IO, 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r);
- memory_install_read8_handler (machine, 1, ADDRESS_SPACE_IO, 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r);
- memory_install_read8_handler (machine, 1, ADDRESS_SPACE_IO, 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xdc, 0xdc, 0, 0, megatech_sms_ioport_dc_r);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xdd, 0xdd, 0, 0, megatech_sms_ioport_dd_r);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xde, 0xde, 0, 0, megatech_sms_ioport_dd_r);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0xdf, 0xdf, 0, 0, megatech_sms_ioport_dd_r); // adams family
}
static void megatech_set_genz80_as_sms_standard_map(running_machine *machine)
@@ -326,24 +326,24 @@ static void megatech_set_genz80_as_sms_standard_map(running_machine *machine)
/* INIT THE MEMMAP / BANKING *********************************************************************************/
/* catch any addresses that don't get mapped */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
/* fixed rom bank area */
sms_rom = auto_malloc(0x400000);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x0000, 0xbfff, 0, 0, SMH_BANK5, SMH_UNMAP);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, SMH_BANK5, SMH_UNMAP);
memory_set_bankptr( 5, sms_rom );
memcpy(sms_rom, memory_region(machine, "main"), 0x400000);
/* main ram area */
sms_mainram = auto_malloc(0x2000); // 8kb of main ram
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_BANK6, SMH_BANK6);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, SMH_BANK6, SMH_BANK6);
memory_set_bankptr( 6, sms_mainram );
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, SMH_BANK7, SMH_BANK7);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, SMH_BANK7, SMH_BANK7);
memory_set_bankptr( 7, sms_mainram );
memset(sms_mainram,0x00,0x2000);
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w);
megatech_set_genz80_as_sms_standard_ports(machine);
// smsgg_backupram = NULL;
diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c
index 393324d88dc..e65c9b9bc71 100644
--- a/src/mame/drivers/meritm.c
+++ b/src/mame/drivers/meritm.c
@@ -847,7 +847,7 @@ static MACHINE_START(merit_common)
static MACHINE_START(meritm_crt250)
{
- memory_configure_bank(1, 0, 8, memory_region(machine, "main"), 0x10000);
+ memory_configure_bank(machine, 1, 0, 8, memory_region(machine, "main"), 0x10000);
meritm_bank = 0xff;
meritm_crt250_switch_banks();
MACHINE_START_CALL(merit_common);
@@ -865,9 +865,9 @@ static MACHINE_START(meritm_crt260)
{
meritm_ram = auto_malloc( 0x8000 );
memset( meritm_ram, 0x8000, 0x00 );
- memory_configure_bank(1, 0, 128, memory_region(machine, "main"), 0x8000);
- memory_configure_bank(2, 0, 128, memory_region(machine, "main"), 0x8000);
- memory_configure_bank(3, 0, 4, meritm_ram, 0x2000);
+ memory_configure_bank(machine, 1, 0, 128, memory_region(machine, "main"), 0x8000);
+ memory_configure_bank(machine, 2, 0, 128, memory_region(machine, "main"), 0x8000);
+ memory_configure_bank(machine, 3, 0, 4, meritm_ram, 0x2000);
meritm_bank = 0xff;
meritm_psd_a15 = 0;
meritm_switch_banks();
@@ -1384,7 +1384,7 @@ static DRIVER_INIT(megat3te)
ds1204_init(megat3_ds1204_key, megat3_ds1204_nvram);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w );
};
@@ -1403,7 +1403,7 @@ static DRIVER_INIT(megat4te)
ds1204_init(0, megat4te_ds1204_nvram);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w );
};
diff --git a/src/mame/drivers/mhavoc.c b/src/mame/drivers/mhavoc.c
index 004561145cb..a60ca535a78 100644
--- a/src/mame/drivers/mhavoc.c
+++ b/src/mame/drivers/mhavoc.c
@@ -761,8 +761,8 @@ static DRIVER_INIT( mhavocrv )
{
/* install the speech support that was only optionally stuffed for use */
/* in the Return to Vax hack */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x5800, 0x5800, 0, 0, speech_data_w);
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x5900, 0x5900, 0, 0, speech_strobe_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x5800, 0x5800, 0, 0, speech_data_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x5900, 0x5900, 0, 0, speech_strobe_w);
}
diff --git a/src/mame/drivers/midvunit.c b/src/mame/drivers/midvunit.c
index 50f67c7def3..193b3ecaab9 100644
--- a/src/mame/drivers/midvunit.c
+++ b/src/mame/drivers/midvunit.c
@@ -1530,7 +1530,7 @@ static void init_crusnusa_common(running_machine *machine, offs_t speedup)
adc_shift = 24;
/* speedups */
- generic_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, speedup, speedup + 1, 0, 0, generic_speedup_r);
+ generic_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), speedup, speedup + 1, 0, 0, generic_speedup_r);
}
static DRIVER_INIT( crusnusa ) { init_crusnusa_common(machine, 0xc93e); }
static DRIVER_INIT( crusnu40 ) { init_crusnusa_common(machine, 0xc957); }
@@ -1543,21 +1543,21 @@ static void init_crusnwld_common(running_machine *machine, offs_t speedup)
adc_shift = 16;
/* control register is different */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x994000, 0x994000, 0, 0, crusnwld_control_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x994000, 0x994000, 0, 0, crusnwld_control_w);
/* valid values are 450 or 460 */
midway_serial_pic_init(machine, 450);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x991030, 0x991030, 0, 0, offroadc_serial_status_r);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x996000, 0x996000, 0, 0, offroadc_serial_data_r);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x996000, 0x996000, 0, 0, offroadc_serial_data_w);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x991030, 0x991030, 0, 0, offroadc_serial_status_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x996000, 0x996000, 0, 0, offroadc_serial_data_r);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x996000, 0x996000, 0, 0, offroadc_serial_data_w);
/* install strange protection device */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9d0000, 0x9d1fff, 0, 0, bit_data_r);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9d0000, 0x9d0000, 0, 0, bit_reset_w);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9d0000, 0x9d1fff, 0, 0, bit_data_r);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9d0000, 0x9d0000, 0, 0, bit_reset_w);
/* speedups */
if (speedup)
- generic_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, speedup, speedup + 1, 0, 0, generic_speedup_r);
+ generic_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), speedup, speedup + 1, 0, 0, generic_speedup_r);
}
static DRIVER_INIT( crusnwld ) { init_crusnwld_common(machine, 0xd4c0); }
#if 0
@@ -1571,15 +1571,15 @@ static DRIVER_INIT( offroadc )
adc_shift = 16;
/* control register is different */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x994000, 0x994000, 0, 0, crusnwld_control_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x994000, 0x994000, 0, 0, crusnwld_control_w);
/* valid values are 230 or 234 */
midway_serial_pic2_init(machine, 230, 94);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x991030, 0x991030, 0, 0, offroadc_serial_status_r);
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x996000, 0x996000, 0, 0, offroadc_serial_data_r, offroadc_serial_data_w);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x991030, 0x991030, 0, 0, offroadc_serial_status_r);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x996000, 0x996000, 0, 0, offroadc_serial_data_r, offroadc_serial_data_w);
/* speedups */
- generic_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x195aa, 0x195aa, 0, 0, generic_speedup_r);
+ generic_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x195aa, 0x195aa, 0, 0, generic_speedup_r);
}
@@ -1604,7 +1604,7 @@ static DRIVER_INIT( wargods )
midway_serial_pic2_set_default_nvram(default_nvram);
/* speedups */
- generic_speedup = memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2f4c, 0x2f4c, 0, 0, generic_speedup_r);
+ generic_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2f4c, 0x2f4c, 0, 0, generic_speedup_r);
}
diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c
index 68a79804c96..4bb34f71bc1 100644
--- a/src/mame/drivers/midzeus.c
+++ b/src/mame/drivers/midzeus.c
@@ -1329,7 +1329,7 @@ static DRIVER_INIT( invasn )
{
dcs2_init(machine, 0, 0);
midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 94, NULL);
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9c0000, 0x9c0000, 0, 0, invasn_gun_r, invasn_gun_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9c0000, 0x9c0000, 0, 0, invasn_gun_r, invasn_gun_w);
}
@@ -1337,10 +1337,10 @@ static DRIVER_INIT( crusnexo )
{
dcs2_init(machine, 0, 0);
midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL);
- memory_configure_bank(1, 0, 3, memory_region(machine, "user2"), 0x400000*4);
+ memory_configure_bank(machine, 1, 0, 3, memory_region(machine, "user2"), 0x400000*4);
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9b0004, 0x9b0007, 0, 0, crusnexo_leds_r, crusnexo_leds_w);
- memory_install_write32_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x8d0009, 0x8d000a, 0, 0, keypad_select_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9b0004, 0x9b0007, 0, 0, crusnexo_leds_r, crusnexo_leds_w);
+ memory_install_write32_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8d0009, 0x8d000a, 0, 0, keypad_select_w);
}
@@ -1348,7 +1348,7 @@ static DRIVER_INIT( thegrid )
{
dcs2_init(machine, 0, 0);
midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL);
- memory_configure_bank(1, 0, 3, memory_region(machine, "user2"), 0x400000*4);
+ memory_configure_bank(machine, 1, 0, 3, memory_region(machine, "user2"), 0x400000*4);
}
diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c
index 48ab7cc1a4d..cdf496230a1 100644
--- a/src/mame/drivers/mitchell.c
+++ b/src/mame/drivers/mitchell.c
@@ -1997,14 +1997,15 @@ ROM_END
static void bootleg_decode(running_machine *machine)
{
- memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, "main") + 0x50000);
- memory_configure_bank_decrypted(1, 0, 16, memory_region(machine, "main") + 0x60000, 0x4000);
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "main") + 0x50000);
+ memory_configure_bank_decrypted(machine, 1, 0, 16, memory_region(machine, "main") + 0x60000, 0x4000);
}
static void configure_banks(running_machine *machine)
{
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
pang_port5_kludge = 0;
}
diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c
index cd3f27ffabd..72d388e41e9 100644
--- a/src/mame/drivers/model2.c
+++ b/src/mame/drivers/model2.c
@@ -4365,7 +4365,7 @@ ROM_END
static DRIVER_INIT( genprot )
{
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
protstate = protpos = 0;
}
@@ -4373,7 +4373,7 @@ static DRIVER_INIT( pltkids )
{
UINT32 *ROM = (UINT32 *)memory_region(machine, "main");
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
protstate = protpos = 0;
// fix bug in program: it destroys the interrupt table and never fixes it
@@ -4384,7 +4384,7 @@ static DRIVER_INIT( zerogun )
{
UINT32 *ROM = (UINT32 *)memory_region(machine, "main");
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
protstate = protpos = 0;
// fix bug in program: it destroys the interrupt table and never fixes it
@@ -4393,14 +4393,14 @@ static DRIVER_INIT( zerogun )
static DRIVER_INIT( daytonam )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x240000, 0x24ffff, 0, 0, maxx_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x240000, 0x24ffff, 0, 0, maxx_r );
}
static DRIVER_INIT( sgt24h )
{
UINT32 *ROM = (UINT32 *)memory_region(machine, "main");
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
protstate = protpos = 0;
ROM[0x56578/4] = 0x08000004;
@@ -4411,7 +4411,7 @@ static DRIVER_INIT( doa )
{
UINT32 *ROM = (UINT32 *)memory_region(machine, "main");
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d80000, 0x01dfffff, 0, 0, model2_prot_r, model2_prot_w);
protstate = protpos = 0;
ROM[0x630/4] = 0x08000004;
diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c
index d976f8994e8..fb92ade77cc 100644
--- a/src/mame/drivers/model3.c
+++ b/src/mame/drivers/model3.c
@@ -4519,35 +4519,35 @@ static DRIVER_INIT( model3_10 )
{
interleave_vroms(machine);
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc0000000, 0xc00000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc0000000, 0xc00000ff, 0, 0, scsi_r, scsi_w );
- memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
+ memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf8fff000, 0xf8fff0ff, 0, 0, mpc105_reg_r, mpc105_reg_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf8fff000, 0xf8fff0ff, 0, 0, mpc105_reg_r, mpc105_reg_w );
}
static DRIVER_INIT( model3_15 )
{
interleave_vroms(machine);
- memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
+ memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf8fff000, 0xf8fff0ff, 0, 0, mpc105_reg_r, mpc105_reg_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf8fff000, 0xf8fff0ff, 0, 0, mpc105_reg_r, mpc105_reg_w );
}
static DRIVER_INIT( model3_20 )
{
interleave_vroms(machine);
- memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
+ memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc2000000, 0xc20000ff, 0, 0, real3d_dma_r, real3d_dma_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc2000000, 0xc20000ff, 0, 0, real3d_dma_r, real3d_dma_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
}
static DRIVER_INIT( lostwsga )
@@ -4556,7 +4556,7 @@ static DRIVER_INIT( lostwsga )
DRIVER_INIT_CALL(model3_15);
/* TODO: there's an M68K device at 0xC0000000 - FF, maybe lightgun controls ? */
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc1000000, 0xc10000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc1000000, 0xc10000ff, 0, 0, scsi_r, scsi_w );
rom[0x7374f0/4] = 0x38840004; /* This seems to be an actual bug in the original code */
}
@@ -4567,7 +4567,7 @@ static DRIVER_INIT( scud )
DRIVER_INIT_CALL(model3_15);
/* TODO: network device at 0xC0000000 - FF */
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
rom[(0x71275c^4)/4] = 0x60000000;
rom[(0x71277c^4)/4] = 0x60000000;
@@ -4579,7 +4579,7 @@ static DRIVER_INIT( scudp )
DRIVER_INIT_CALL(model3_15);
/* TODO: network device at 0xC0000000 - FF */
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc1000000, 0xc10000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc1000000, 0xc10000ff, 0, 0, scsi_r, scsi_w );
rom[(0x713724^4)/4] = 0x60000000;
rom[(0x713744^4)/4] = 0x60000000;
@@ -4595,7 +4595,7 @@ static DRIVER_INIT( lemans24 )
UINT32 *rom = (UINT32*)memory_region(machine, "user1");
DRIVER_INIT_CALL(model3_15);
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc1000000, 0xc10000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc1000000, 0xc10000ff, 0, 0, scsi_r, scsi_w );
rom[(0x73fe38^4)/4] = 0x38840004; /* This seems to be an actual bug in the original code */
@@ -4626,15 +4626,15 @@ static DRIVER_INIT( vs215 )
rom[(0x70e710^4)/4] = 0x60000000;
interleave_vroms(machine);
- memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
+ memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0800cf8, 0xf0800cff, 0, 0, mpc106_addr_r, mpc106_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc106_data_r, mpc106_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc106_addr_r, mpc106_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc106_data_r, mpc106_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
}
static DRIVER_INIT( vs29815 )
@@ -4645,15 +4645,15 @@ static DRIVER_INIT( vs29815 )
rom[(0x60290c^4)/4] = 0x60000000;
interleave_vroms(machine);
- memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
+ memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0800cf8, 0xf0800cff, 0, 0, mpc106_addr_r, mpc106_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc106_data_r, mpc106_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc106_addr_r, mpc106_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc106_data_r, mpc106_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
}
static DRIVER_INIT( bass )
@@ -4664,27 +4664,27 @@ static DRIVER_INIT( bass )
rom[(0x7999c8^4)/4] = 0x60000000;
interleave_vroms(machine);
- memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
+ memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0800cf8, 0xf0800cff, 0, 0, mpc106_addr_r, mpc106_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc106_data_r, mpc106_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc106_addr_r, mpc106_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfec00000, 0xfedfffff, 0, 0, mpc106_addr_r, mpc106_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc106_data_r, mpc106_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfee00000, 0xfeffffff, 0, 0, mpc106_data_r, mpc106_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf8fff000, 0xf8fff0ff, 0, 0, mpc106_reg_r, mpc106_reg_w );
}
static DRIVER_INIT( getbass )
{
interleave_vroms(machine);
- memory_install_read64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
+ memory_install_read64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xff000000, 0xff7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf9000000, 0xf90000ff, 0, 0, scsi_r, scsi_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w );
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf8fff000, 0xf8fff0ff, 0, 0, mpc105_reg_r, mpc105_reg_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0800cf8, 0xf0800cff, 0, 0, mpc105_addr_r, mpc105_addr_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c00cf8, 0xf0c00cff, 0, 0, mpc105_data_r, mpc105_data_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf8fff000, 0xf8fff0ff, 0, 0, mpc105_reg_r, mpc105_reg_w );
}
static DRIVER_INIT( vs2 )
@@ -4733,7 +4733,7 @@ static DRIVER_INIT( harley )
UINT32 *rom = (UINT32*)memory_region(machine, "user1");
DRIVER_INIT_CALL(model3_20);
- memory_install_readwrite64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc0000000, 0xc00fffff, 0, 0, network_r, network_w );
+ memory_install_readwrite64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc0000000, 0xc00fffff, 0, 0, network_r, network_w );
rom[(0x50e8d4^4)/4] = 0x60000000;
rom[(0x50e8f4^4)/4] = 0x60000000;
@@ -4801,7 +4801,7 @@ static DRIVER_INIT( daytona2 )
UINT32 *rom = (UINT32*)memory_region(machine, "user1");
DRIVER_INIT_CALL(model3_20);
- memory_install_write64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc3800000, 0xc3800007, 0, 0, daytona2_rombank_w );
+ memory_install_write64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc3800000, 0xc3800007, 0, 0, daytona2_rombank_w );
//rom[(0x68468c^4)/4] = 0x60000000;
rom[(0x6063c4^4)/4] = 0x60000000;
@@ -4814,7 +4814,7 @@ static DRIVER_INIT( dayto2pe )
UINT32 *rom = (UINT32*)memory_region(machine, "user1");
DRIVER_INIT_CALL(model3_20);
- memory_install_write64_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc3800000, 0xc3800007, 0, 0, daytona2_rombank_w );
+ memory_install_write64_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc3800000, 0xc3800007, 0, 0, daytona2_rombank_w );
rom[(0x606784^4)/4] = 0x60000000;
rom[(0x69a3fc^4)/4] = 0x60000000; // jump to encrypted code
diff --git a/src/mame/drivers/mouser.c b/src/mame/drivers/mouser.c
index d1fa9543267..b6e8c06d43d 100644
--- a/src/mame/drivers/mouser.c
+++ b/src/mame/drivers/mouser.c
@@ -283,11 +283,12 @@ static DRIVER_INIT( mouser )
/* Decode the opcodes */
offs_t i;
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypted = auto_malloc(0x6000);
UINT8 *table = memory_region(machine, "user1");
- memory_set_decrypted_region(0, 0x0000, 0x5fff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0x5fff, decrypted);
for (i = 0;i < 0x6000;i++)
{
diff --git a/src/mame/drivers/mpu4.c b/src/mame/drivers/mpu4.c
index 71357ec84cb..56668e2f59c 100644
--- a/src/mame/drivers/mpu4.c
+++ b/src/mame/drivers/mpu4.c
@@ -431,7 +431,7 @@ static MACHINE_RESET( mpu4 )
{
UINT8 *rom = memory_region(machine, "main");
- memory_configure_bank(1, 0, 8, &rom[0x01000], 0x10000);
+ memory_configure_bank(machine, 1, 0, 8, &rom[0x01000], 0x10000);
memory_set_bank(1,0);
}
diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c
index d296531d0c6..91bc2211c08 100644
--- a/src/mame/drivers/mquake.c
+++ b/src/mame/drivers/mquake.c
@@ -42,11 +42,11 @@ static void mquake_cia_0_porta_w(UINT8 data)
/* swap the write handlers between ROM and bank 1 based on the bit */
if ((data & 1) == 0)
/* overlay disabled, map RAM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
else
/* overlay enabled, map Amiga system ROM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
}
@@ -451,8 +451,8 @@ static DRIVER_INIT(mquake)
amiga_machine_config(machine, &mquake_intf);
/* set up memory */
- memory_configure_bank(1, 0, 1, amiga_chip_ram, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "user1"), 0);
+ memory_configure_bank(machine, 1, 0, 1, amiga_chip_ram, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user1"), 0);
}
diff --git a/src/mame/drivers/ms32.c b/src/mame/drivers/ms32.c
index b45511ecae8..9681e3b9838 100644
--- a/src/mame/drivers/ms32.c
+++ b/src/mame/drivers/ms32.c
@@ -2104,8 +2104,8 @@ void decrypt_ms32_bg(running_machine *machine, int addr_xor,int data_xor, const
static void configure_banks(running_machine *machine)
{
state_save_register_global(to_main);
- memory_configure_bank(4, 0, 16, memory_region(machine, "audio") + 0x14000, 0x4000);
- memory_configure_bank(5, 0, 16, memory_region(machine, "audio") + 0x14000, 0x4000);
+ memory_configure_bank(machine, 4, 0, 16, memory_region(machine, "audio") + 0x14000, 0x4000);
+ memory_configure_bank(machine, 5, 0, 16, memory_region(machine, "audio") + 0x14000, 0x4000);
}
/* SS91022-10: desertwr, gratiaa, tp2m32, gametngk */
diff --git a/src/mame/drivers/multigam.c b/src/mame/drivers/multigam.c
index a7aa55f71e9..51e88f43eb5 100644
--- a/src/mame/drivers/multigam.c
+++ b/src/mame/drivers/multigam.c
@@ -360,7 +360,7 @@ static void multigam_init_smb3(running_machine *machine)
memcpy(&dst[0x8000], &src[0xa0000 + 0x3c000], 0x4000);
memcpy(&dst[0xc000], &src[0xa0000 + 0x3c000], 0x4000);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, multigam3_mmc3_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, multigam3_mmc3_rom_switch_w );
memory_set_bankptr(1, multigmc_mmc3_6000_ram);
@@ -398,7 +398,7 @@ static WRITE8_HANDLER(multigm3_switch_prg_rom)
}
else
{
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, multigm3_mapper2_w );
+ memory_install_write8_handler(space, 0x8000, 0xffff, 0, 0, multigm3_mapper2_w );
memory_set_bankptr(1, memory_region(space->machine, "main") + 0x6000);
}
diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c
index bb123fde069..642a28ce66f 100644
--- a/src/mame/drivers/namcos11.c
+++ b/src/mame/drivers/namcos11.c
@@ -810,7 +810,7 @@ static DRIVER_INIT( namcos11 )
{
if( namcos11_config_table[ n_game ].keycus_r != NULL )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fa20000, 0x1fa2ffff, 0, 0, namcos11_config_table[ n_game ].keycus_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa20000, 0x1fa2ffff, 0, 0, namcos11_config_table[ n_game ].keycus_r );
}
if( namcos11_config_table[ n_game ].n_daughterboard != 0 )
{
@@ -818,36 +818,36 @@ static DRIVER_INIT( namcos11 )
UINT32 len = memory_region_length( machine, "user2" );
UINT8 *rgn = memory_region( machine, "user2" );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f0fffff, 0, 0, SMH_BANK1 );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f100000, 0x1f1fffff, 0, 0, SMH_BANK2 );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f200000, 0x1f2fffff, 0, 0, SMH_BANK3 );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f300000, 0x1f3fffff, 0, 0, SMH_BANK4 );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f400000, 0x1f4fffff, 0, 0, SMH_BANK5 );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f500000, 0x1f5fffff, 0, 0, SMH_BANK6 );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f600000, 0x1f6fffff, 0, 0, SMH_BANK7 );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f700000, 0x1f7fffff, 0, 0, SMH_BANK8 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f0fffff, 0, 0, SMH_BANK1 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f100000, 0x1f1fffff, 0, 0, SMH_BANK2 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f200000, 0x1f2fffff, 0, 0, SMH_BANK3 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f300000, 0x1f3fffff, 0, 0, SMH_BANK4 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f4fffff, 0, 0, SMH_BANK5 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f500000, 0x1f5fffff, 0, 0, SMH_BANK6 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f600000, 0x1f6fffff, 0, 0, SMH_BANK7 );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f700000, 0x1f7fffff, 0, 0, SMH_BANK8 );
for( bank = 0; bank < 8; bank++ )
{
- memory_configure_bank( bank + 1, 0, len / ( 1024 * 1024 ), rgn, 1024 * 1024 );
+ memory_configure_bank(machine, bank + 1, 0, len / ( 1024 * 1024 ), rgn, 1024 * 1024 );
memory_set_bank( bank + 1, 0 );
}
if( namcos11_config_table[ n_game ].n_daughterboard == 32 )
{
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fa10020, 0x1fa1002f, 0, 0, bankswitch_rom32_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10020, 0x1fa1002f, 0, 0, bankswitch_rom32_w );
}
if( namcos11_config_table[ n_game ].n_daughterboard == 64 )
{
m_n_bankoffset = 0;
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f080000, 0x1f080003, 0, 0, bankswitch_rom64_upper_w );
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fa10020, 0x1fa1002f, 0, 0, SMH_NOP, bankswitch_rom64_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f080000, 0x1f080003, 0, 0, bankswitch_rom64_upper_w );
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10020, 0x1fa1002f, 0, 0, SMH_NOP, bankswitch_rom64_w );
state_save_register_global( m_n_bankoffset );
}
}
else
{
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fa10020, 0x1fa1002f, 0, 0, SMH_NOP );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10020, 0x1fa1002f, 0, 0, SMH_NOP );
}
break;
}
@@ -856,8 +856,8 @@ static DRIVER_INIT( namcos11 )
if( strcmp( machine->gamedrv->name, "ptblnk2a" ) == 0 )
{
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f788000, 0x1f788003, 0, 0, lightgun_w );
- memory_install_read32_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f780000, 0x1f78000f, 0, 0, lightgun_r );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f788000, 0x1f788003, 0, 0, lightgun_w );
+ memory_install_read32_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f780000, 0x1f78000f, 0, 0, lightgun_r );
}
state_save_register_global( m_n_oldcoin );
diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c
index 1f14b7c0e90..cb806027b2e 100644
--- a/src/mame/drivers/namcos12.c
+++ b/src/mame/drivers/namcos12.c
@@ -1164,8 +1164,8 @@ static READ32_HANDLER( system11gun_r )
static void system11gun_install( running_machine *machine )
{
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f788000, 0x1f788003, 0, 0, system11gun_w );
- memory_install_read32_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f780000, 0x1f78000f, 0, 0, system11gun_r );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f788000, 0x1f788003, 0, 0, system11gun_w );
+ memory_install_read32_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f780000, 0x1f78000f, 0, 0, system11gun_r );
}
static UINT8 kcram[ 12 ];
@@ -1216,8 +1216,8 @@ static MACHINE_RESET( namcos12 )
strcmp( machine->gamedrv->name, "tektagtb" ) == 0 ||
strcmp( machine->gamedrv->name, "tektagtc" ) == 0 )
{
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, tektagt_protection_1_r, tektagt_protection_1_w );
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fb80003, 0, 0, tektagt_protection_2_r, tektagt_protection_2_w );
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, tektagt_protection_1_r, tektagt_protection_1_w );
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fb80003, 0, 0, tektagt_protection_2_r, tektagt_protection_2_w );
}
if( strcmp( machine->gamedrv->name, "tektagt" ) == 0 ||
@@ -1239,9 +1239,9 @@ static MACHINE_RESET( namcos12 )
strcmp( machine->gamedrv->name, "ghlpanic" ) == 0 )
{
/* this is based on guesswork, it might not even be keycus. */
- memory_install_read32_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fc20280, 0x1fc2028b, 0, 0, SMH_BANK2 );
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f008000, 0x1f008003, 0, 0, kcon_w );
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f018000, 0x1f018003, 0, 0, kcoff_w );
+ memory_install_read32_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fc20280, 0x1fc2028b, 0, 0, SMH_BANK2 );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f008000, 0x1f008003, 0, 0, kcon_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f018000, 0x1f018003, 0, 0, kcoff_w );
memset( kcram, 0, sizeof( kcram ) );
memory_set_bankptr( 2, kcram );
@@ -1438,7 +1438,7 @@ static DRIVER_INIT( namcos12 )
psx_dma_install_read_handler( 5, namcos12_rom_read );
- memory_configure_bank( 1, 0, memory_region_length( machine, "user2" ) / 0x200000, memory_region( machine, "user2" ), 0x200000 );
+ memory_configure_bank(machine, 1, 0, memory_region_length( machine, "user2" ) / 0x200000, memory_region( machine, "user2" ), 0x200000 );
s12_porta = 0;
s12_rtcstate = 0;
diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c
index c578f74acef..442fef478ff 100644
--- a/src/mame/drivers/namcos22.c
+++ b/src/mame/drivers/namcos22.c
@@ -5092,19 +5092,19 @@ static READ16_HANDLER( mcuc74_speedup_r )
static void install_c74_speedup(running_machine *machine)
{
- memory_install_readwrite16_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x80, 0x81, 0, 0, mcuc74_speedup_r, mcu_speedup_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x80, 0x81, 0, 0, mcuc74_speedup_r, mcu_speedup_w);
}
static void install_130_speedup(running_machine *machine)
{
// install speedup cheat for 1.30 MCU BIOS
- memory_install_readwrite16_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x82, 0x83, 0, 0, mcu130_speedup_r, mcu_speedup_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, mcu130_speedup_r, mcu_speedup_w);
}
static void install_141_speedup(running_machine *machine)
{
// install speedup cheat for 1.41 MCU BIOS
- memory_install_readwrite16_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x82, 0x83, 0, 0, mcu141_speedup_r, mcu_speedup_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, mcu141_speedup_r, mcu_speedup_w);
}
static void namcos22_init( enum namcos22_gametype game_type )
@@ -5123,7 +5123,7 @@ static DRIVER_INIT( alpiner )
{
namcos22s_init(NAMCOS22_ALPINE_RACER);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_IO, M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r);
install_130_speedup(machine);
}
@@ -5132,7 +5132,7 @@ static DRIVER_INIT( alpiner2 )
{
namcos22s_init(NAMCOS22_ALPINE_RACER_2);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_IO, M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r);
install_130_speedup(machine);
}
@@ -5141,7 +5141,7 @@ static DRIVER_INIT( alpinesa )
{
namcos22s_init(NAMCOS22_ALPINE_SURFER);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_IO, M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, alpineracer_mcu_adc_r);
install_141_speedup(machine);
}
@@ -5150,7 +5150,7 @@ static DRIVER_INIT( airco22 )
{
namcos22s_init(NAMCOS22_AIR_COMBAT22);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_IO, M37710_ADC0_L, M37710_ADC7_H, 0, 0, airco22_mcu_adc_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, airco22_mcu_adc_r);
}
static DRIVER_INIT( propcycl )
@@ -5174,7 +5174,7 @@ static DRIVER_INIT( propcycl )
namcos22s_init(NAMCOS22_PROP_CYCLE);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_IO, M37710_ADC0_L, M37710_ADC7_H, 0, 0, propcycle_mcu_adc_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, propcycle_mcu_adc_r);
install_141_speedup(machine);
}
@@ -5255,7 +5255,7 @@ static DRIVER_INIT( cybrcyc )
namcos22s_init(NAMCOS22_CYBER_CYCLES);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_IO, M37710_ADC0_L, M37710_ADC7_H, 0, 0, cybrcycc_mcu_adc_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_IO), M37710_ADC0_L, M37710_ADC7_H, 0, 0, cybrcycc_mcu_adc_r);
install_130_speedup(machine);
}
diff --git a/src/mame/drivers/naughtyb.c b/src/mame/drivers/naughtyb.c
index 60372f784be..15a322d6de6 100644
--- a/src/mame/drivers/naughtyb.c
+++ b/src/mame/drivers/naughtyb.c
@@ -770,7 +770,7 @@ ROM_END
static DRIVER_INIT( popflame )
{
/* install a handler to catch protection checks */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9000, 0x9000, 0, 0, popflame_protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9000, 0x9000, 0, 0, popflame_protection_r);
}
static int question_offset = 0;
@@ -799,7 +799,7 @@ static WRITE8_HANDLER( trvmstr_questions_w )
static DRIVER_INIT( trvmstr )
{
/* install questions' handlers */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc002, 0, 0, trvmstr_questions_r, trvmstr_questions_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xc002, 0, 0, trvmstr_questions_r, trvmstr_questions_w);
}
diff --git a/src/mame/drivers/nbmj8991.c b/src/mame/drivers/nbmj8991.c
index b1c8b956e4e..c61dce6893e 100644
--- a/src/mame/drivers/nbmj8991.c
+++ b/src/mame/drivers/nbmj8991.c
@@ -70,7 +70,7 @@ static MACHINE_RESET( nbmj8991 )
{
if (machine->config->cpu[1].type == CPU_Z80)
{
- memory_configure_bank(1, 0, 4, memory_region(machine, "audio") + 0x8000, 0x8000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "audio") + 0x8000, 0x8000);
memory_set_bank(1, 0);
}
MACHINE_RESET_CALL(nb1413m3);
diff --git a/src/mame/drivers/neodrvr.c b/src/mame/drivers/neodrvr.c
index 3e01bb6ed1a..7180d319401 100644
--- a/src/mame/drivers/neodrvr.c
+++ b/src/mame/drivers/neodrvr.c
@@ -7450,7 +7450,7 @@ static DRIVER_INIT( kf2k3pcb )
neogeo_fixed_layer_bank_type = 2;
DRIVER_INIT_CALL(neogeo);
install_pvc_protection(machine);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc7ffff, 0, 0, SMH_BANK6 ); // 512k bios
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc7ffff, 0, 0, SMH_BANK6 ); // 512k bios
}
static DRIVER_INIT( kof2003 )
@@ -7526,11 +7526,11 @@ static DRIVER_INIT( jockeygp )
extra_ram = auto_malloc(0x2000);
state_save_register_global_pointer(extra_ram, 0x2000 / 2);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x201fff, 0, 0, SMH_BANK8, SMH_BANK8);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x201fff, 0, 0, SMH_BANK8, SMH_BANK8);
memory_set_bankptr(NEOGEO_BANK_EXTRA_RAM, extra_ram);
-// memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x280000, 0x280001, 0, 0, input_port_read_handler16(machine->portconfig, "IN5") );
-// memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2c0000, 0x2c0001, 0, 0, input_port_read_handler16(machine->portconfig, "IN6") );
+// memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x280000, 0x280001, 0, 0, input_port_read_handler16(machine->portconfig, "IN5") );
+// memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2c0000, 0x2c0001, 0, 0, input_port_read_handler16(machine->portconfig, "IN6") );
DRIVER_INIT_CALL(neogeo);
}
@@ -7543,11 +7543,11 @@ static DRIVER_INIT( vliner )
extra_ram = auto_malloc(0x2000);
state_save_register_global_pointer(extra_ram, 0x2000 / 2);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x201fff, 0, 0, SMH_BANK8, SMH_BANK8);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x201fff, 0, 0, SMH_BANK8, SMH_BANK8);
memory_set_bankptr(NEOGEO_BANK_EXTRA_RAM, extra_ram);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x280000, 0x280001, 0, 0, input_port_read_handler16(machine->portconfig, "IN5") );
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2c0000, 0x2c0001, 0, 0, input_port_read_handler16(machine->portconfig, "IN6") );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x280000, 0x280001, 0, 0, input_port_read_handler16(machine->portconfig, "IN5") );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2c0000, 0x2c0001, 0, 0, input_port_read_handler16(machine->portconfig, "IN6") );
DRIVER_INIT_CALL(neogeo);
}
@@ -7555,7 +7555,7 @@ static DRIVER_INIT( vliner )
static DRIVER_INIT( kog )
{
/* overlay cartridge ROM */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0ffffe, 0x0fffff, 0, 0, input_port_read_handler16(machine->portconfig, "JUMPER") );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0ffffe, 0x0fffff, 0, 0, input_port_read_handler16(machine->portconfig, "JUMPER") );
kog_px_decrypt(machine);
neogeo_bootleg_sx_decrypt(machine, 1);
diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c
index 5159504b7f7..3a5ee91ee84 100644
--- a/src/mame/drivers/neogeo.c
+++ b/src/mame/drivers/neogeo.c
@@ -660,8 +660,8 @@ static WRITE16_HANDLER( main_cpu_bank_select_w )
static void main_cpu_banking_init(running_machine *machine)
{
/* create vector banks */
- memory_configure_bank(NEOGEO_BANK_VECTORS, 0, 1, memory_region(machine, "mainbios"), 0);
- memory_configure_bank(NEOGEO_BANK_VECTORS, 1, 1, memory_region(machine, "main"), 0);
+ memory_configure_bank(machine, NEOGEO_BANK_VECTORS, 0, 1, memory_region(machine, "mainbios"), 0);
+ memory_configure_bank(machine, NEOGEO_BANK_VECTORS, 1, 1, memory_region(machine, "main"), 0);
/* set initial main CPU bank */
if (memory_region_length(machine, "main") > 0x100000)
@@ -765,8 +765,8 @@ static void audio_cpu_banking_init(running_machine *machine)
/* audio bios/cartridge selection */
if (memory_region(machine, "audiobios"))
- memory_configure_bank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 0, 1, memory_region(machine, "audiobios"), 0);
- memory_configure_bank(NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 1, 1, memory_region(machine, "audio"), 0);
+ memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 0, 1, memory_region(machine, "audiobios"), 0);
+ memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_MAIN_BANK, 1, 1, memory_region(machine, "audio"), 0);
/* audio banking */
address_mask = memory_region_length(machine, "audio") - 0x10000 - 1;
@@ -777,7 +777,7 @@ static void audio_cpu_banking_init(running_machine *machine)
for (bank = 0; bank < 0x100; bank++)
{
UINT32 bank_address = 0x10000 + (((bank << (11 + region)) & 0x3ffff) & address_mask);
- memory_configure_bank(NEOGEO_BANK_AUDIO_CPU_CART_BANK + region, bank, 1, &rgn[bank_address], 0);
+ memory_configure_bank(machine, NEOGEO_BANK_AUDIO_CPU_CART_BANK + region, bank, 1, &rgn[bank_address], 0);
}
}
diff --git a/src/mame/drivers/ninjakd2.c b/src/mame/drivers/ninjakd2.c
index a12dd43061d..a55c0739f79 100644
--- a/src/mame/drivers/ninjakd2.c
+++ b/src/mame/drivers/ninjakd2.c
@@ -152,15 +152,15 @@ static INTERRUPT_GEN( ninjakd2_interrupt )
static MACHINE_RESET( ninjakd2 )
{
/* initialize main Z80 bank */
- memory_configure_bank(1, 0, 8, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 8, memory_region(machine, "main") + 0x10000, 0x4000);
memory_set_bank(1, 0);
}
static void robokid_init_banks(running_machine *machine)
{
/* initialize main Z80 bank */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main"), 0x4000);
- memory_configure_bank(1, 2, 14, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main"), 0x4000);
+ memory_configure_bank(machine, 1, 2, 14, memory_region(machine, "main") + 0x10000, 0x4000);
memory_set_bank(1, 0);
}
@@ -1457,7 +1457,8 @@ static DRIVER_INIT( ninjakd2 )
static DRIVER_INIT( bootleg )
{
- memory_set_decrypted_region(1, 0x0000, 0x7fff, memory_region(machine, "sound") + 0x10000);
+ const address_space *space = cputag_get_address_space(machine, "sound", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "sound") + 0x10000);
gfx_unscramble(machine);
}
diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c
index 4690960f5d6..56190045378 100644
--- a/src/mame/drivers/nmk16.c
+++ b/src/mame/drivers/nmk16.c
@@ -4549,8 +4549,8 @@ static DRIVER_INIT( bjtwin )
static READ16_HANDLER( vandykeb_r ) { return 0x0000; }
static DRIVER_INIT (vandykeb)
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x08000e, 0x08000f, 0, 0, vandykeb_r );
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x08001e, 0x08001f, 0, 0, SMH_NOP );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x08000e, 0x08000f, 0, 0, vandykeb_r );
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x08001e, 0x08001f, 0, 0, SMH_NOP );
}
diff --git a/src/mame/drivers/offtwall.c b/src/mame/drivers/offtwall.c
index 0fe542ae921..e2b7acadc35 100644
--- a/src/mame/drivers/offtwall.c
+++ b/src/mame/drivers/offtwall.c
@@ -494,9 +494,9 @@ static DRIVER_INIT( offtwall )
atarijsa_init(machine, "260010", 0x0040);
/* install son-of-slapstic workarounds */
- spritecache_count = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
- bankswitch_base = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x037ec2, 0x037f39, 0, 0, bankswitch_r);
- unknown_verify_base = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3fdf1e, 0x3fdf1f, 0, 0, unknown_verify_r);
+ spritecache_count = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
+ bankswitch_base = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x037ec2, 0x037f39, 0, 0, bankswitch_r);
+ unknown_verify_base = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3fdf1e, 0x3fdf1f, 0, 0, unknown_verify_r);
}
@@ -506,9 +506,9 @@ static DRIVER_INIT( offtwalc )
atarijsa_init(machine, "260010", 0x0040);
/* install son-of-slapstic workarounds */
- spritecache_count = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
- bankswitch_base = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x037eca, 0x037f43, 0, 0, bankswitch_r);
- unknown_verify_base = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3fdf24, 0x3fdf25, 0, 0, unknown_verify_r);
+ spritecache_count = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
+ bankswitch_base = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x037eca, 0x037f43, 0, 0, bankswitch_r);
+ unknown_verify_base = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3fdf24, 0x3fdf25, 0, 0, unknown_verify_r);
}
diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c
index d0529a7ca94..dd41a0ace5a 100644
--- a/src/mame/drivers/opwolf.c
+++ b/src/mame/drivers/opwolf.c
@@ -805,7 +805,7 @@ static DRIVER_INIT( opwolf )
opwolf_gun_xoffs = 0xec - (rom[0x03ffb0 / 2] & 0xff);
opwolf_gun_yoffs = 0x1c - (rom[0x03ffae / 2] & 0xff);
- memory_configure_bank(10, 0, 4, memory_region(machine, "audio") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 10, 0, 4, memory_region(machine, "audio") + 0x10000, 0x4000);
}
@@ -819,7 +819,7 @@ static DRIVER_INIT( opwolfb )
opwolf_gun_xoffs = -2;
opwolf_gun_yoffs = 17;
- memory_configure_bank(10, 0, 4, memory_region(machine, "audio") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 10, 0, 4, memory_region(machine, "audio") + 0x10000, 0x4000);
}
diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c
index 1390cf61308..302eff8e9df 100644
--- a/src/mame/drivers/pacman.c
+++ b/src/mame/drivers/pacman.c
@@ -370,8 +370,8 @@ static MACHINE_RESET( mschamp )
UINT8 *rom = memory_region(machine, "main") + 0x10000;
int whichbank = input_port_read(machine, "GAME") & 1;
- memory_configure_bank(1, 0, 2, &rom[0x0000], 0x8000);
- memory_configure_bank(2, 0, 2, &rom[0x4000], 0x8000);
+ memory_configure_bank(machine, 1, 0, 2, &rom[0x0000], 0x8000);
+ memory_configure_bank(machine, 2, 0, 2, &rom[0x4000], 0x8000);
memory_set_bank(1, whichbank);
memory_set_bank(2, whichbank);
@@ -5176,12 +5176,13 @@ ROM_END
static void maketrax_rom_decode(running_machine *machine)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted = auto_malloc(0x4000);
UINT8 *rom = memory_region(machine, "main");
/* patch protection using a copy of the opcodes so ROM checksum */
/* tests will not fail */
- memory_set_decrypted_region(0, 0x0000, 0x3fff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0x3fff, decrypted);
memcpy(decrypted,rom,0x4000);
@@ -5199,20 +5200,21 @@ static void maketrax_rom_decode(running_machine *machine)
static DRIVER_INIT( maketrax )
{
/* set up protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5080, 0x50bf, 0, 0, maketrax_special_port2_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x50c0, 0x50ff, 0, 0, maketrax_special_port3_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5080, 0x50bf, 0, 0, maketrax_special_port2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x50c0, 0x50ff, 0, 0, maketrax_special_port3_r);
maketrax_rom_decode(machine);
}
static void korosuke_rom_decode(running_machine *machine)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted = auto_malloc(0x4000);
UINT8 *rom = memory_region(machine, "main");
/* patch protection using a copy of the opcodes so ROM checksum */
/* tests will not fail */
- memory_set_decrypted_region(0, 0x0000, 0x3fff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0x3fff, decrypted);
memcpy(decrypted,rom,0x4000);
@@ -5230,8 +5232,8 @@ static void korosuke_rom_decode(running_machine *machine)
static DRIVER_INIT( korosuke )
{
/* set up protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5080, 0x5080, 0, 0, korosuke_special_port2_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x50c0, 0x50ff, 0, 0, korosuke_special_port3_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5080, 0x5080, 0, 0, korosuke_special_port2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x50c0, 0x50ff, 0, 0, korosuke_special_port3_r);
korosuke_rom_decode(machine);
}
@@ -5372,7 +5374,7 @@ static DRIVER_INIT( porky )
}
for( i = 0; i < 4; i++)
- memory_configure_bank(i + 1, 0, 2, &ROM[i * 0x2000], 0x8000);
+ memory_configure_bank(machine, i + 1, 0, 2, &ROM[i * 0x2000], 0x8000);
for( i = 0; i < 4; i++)
memory_set_bankptr(i + 1, &ROM[i * 0x2000]);
@@ -5456,11 +5458,11 @@ static READ8_HANDLER( cannonbp_protection_r )
static DRIVER_INIT( cannonbp )
{
/* extra memory */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4800, 0x4bff, 0, 0, SMH_BANK5, SMH_BANK5);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4bff, 0, 0, SMH_BANK5, SMH_BANK5);
memory_set_bankptr(5, auto_malloc(0x400));
/* protection? */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x3fff, 0, 0, cannonbp_protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3fff, 0, 0, cannonbp_protection_r);
}
diff --git a/src/mame/drivers/paradise.c b/src/mame/drivers/paradise.c
index 53a8146e012..084d56765b2 100644
--- a/src/mame/drivers/paradise.c
+++ b/src/mame/drivers/paradise.c
@@ -1007,13 +1007,13 @@ static DRIVER_INIT (paradise)
static DRIVER_INIT (tgtball)
{
paradise_sprite_inc = 4;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x2001, 0x2001, 0, 0, tgtball_flipscreen_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x2001, 0x2001, 0, 0, tgtball_flipscreen_w );
}
static DRIVER_INIT (torus)
{
paradise_sprite_inc = 4;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x2070, 0x2070, 0, 0, torus_coin_counter_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x2070, 0x2070, 0, 0, torus_coin_counter_w);
}
diff --git a/src/mame/drivers/pasha2.c b/src/mame/drivers/pasha2.c
index c6732689d42..3e1d7264330 100644
--- a/src/mame/drivers/pasha2.c
+++ b/src/mame/drivers/pasha2.c
@@ -464,7 +464,7 @@ static READ16_HANDLER( pasha2_speedup_r )
static DRIVER_INIT( pasha2 )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x95744, 0x95747, 0, 0, pasha2_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x95744, 0x95747, 0, 0, pasha2_speedup_r );
memory_set_bankptr(1, memory_region(machine, "user2"));
}
diff --git a/src/mame/drivers/pbaction.c b/src/mame/drivers/pbaction.c
index 216f1f63a65..8752f9d79ce 100644
--- a/src/mame/drivers/pbaction.c
+++ b/src/mame/drivers/pbaction.c
@@ -439,7 +439,7 @@ static DRIVER_INIT( pbactio3 )
pbaction_decode(machine, "main");
/* install a protection (?) workaround */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc000, 0, 0, pbactio3_prot_kludge_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xc000, 0, 0, pbactio3_prot_kludge_r );
}
diff --git a/src/mame/drivers/pcktgal.c b/src/mame/drivers/pcktgal.c
index cf51b105d50..96d2afcc7f6 100644
--- a/src/mame/drivers/pcktgal.c
+++ b/src/mame/drivers/pcktgal.c
@@ -426,17 +426,18 @@ ROM_END
static DRIVER_INIT( deco222 )
{
int A;
+ const address_space *space = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted = auto_malloc(0x10000);
UINT8 *rom = memory_region(machine, "audio");
- memory_set_decrypted_region(1, 0x8000, 0xffff, decrypted);
+ memory_set_decrypted_region(space, 0x8000, 0xffff, decrypted);
/* bits 5 and 6 of the opcodes are swapped */
for (A = 0x8000;A < 0x18000;A++)
decrypted[A-0x8000] = (rom[A] & 0x9f) | ((rom[A] & 0x20) << 1) | ((rom[A] & 0x40) >> 1);
- memory_configure_bank(3, 0, 2, memory_region(machine, "audio") + 0x10000, 0x4000);
- memory_configure_bank_decrypted(3, 0, 2, &decrypted[0x8000], 0x4000);
+ memory_configure_bank(machine, 3, 0, 2, memory_region(machine, "audio") + 0x10000, 0x4000);
+ memory_configure_bank_decrypted(machine, 3, 0, 2, &decrypted[0x8000], 0x4000);
}
static DRIVER_INIT( graphics )
@@ -445,7 +446,7 @@ static DRIVER_INIT( graphics )
int len = memory_region_length(machine, "gfx1");
int i,j,temp[16];
- memory_configure_bank(3, 0, 2, memory_region(machine, "audio") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 3, 0, 2, memory_region(machine, "audio") + 0x10000, 0x4000);
/* Tile graphics roms have some swapped lines, original version only */
for (i = 0x00000;i < len;i += 32)
diff --git a/src/mame/drivers/pengo.c b/src/mame/drivers/pengo.c
index 52f6aa64a74..36948c3606e 100644
--- a/src/mame/drivers/pengo.c
+++ b/src/mame/drivers/pengo.c
@@ -659,11 +659,12 @@ static DRIVER_INIT( penta )
{ 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 }, /* ...1...1...0.... */
{ 0x88,0x0a,0x82,0x00,0xa0,0x22,0xaa,0x28 } /* ...1...1...1.... */
};
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypt = auto_malloc(0x8000);
UINT8 *rom = memory_region(machine, "main");
int A;
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
for (A = 0x0000;A < 0x8000;A++)
{
diff --git a/src/mame/drivers/pgm.c b/src/mame/drivers/pgm.c
index 18b2c2d63e8..0ccc22dcd1c 100644
--- a/src/mame/drivers/pgm.c
+++ b/src/mame/drivers/pgm.c
@@ -1324,8 +1324,8 @@ static DRIVER_INIT( orlegend )
{
pgm_basic_init(machine);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC0400e, 0xC0400f, 0, 0, pgm_asic3_r, pgm_asic3_w);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC04000, 0xC04001, 0, 0, pgm_asic3_reg_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xC0400e, 0xC0400f, 0, 0, pgm_asic3_r, pgm_asic3_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xC04000, 0xC04001, 0, 0, pgm_asic3_reg_w);
}
static void drgwld2_common_init(running_machine *machine)
@@ -1338,7 +1338,7 @@ static void drgwld2_common_init(running_machine *machine)
select and after failing in the 2nd stage (probably there are other checks
out there).
*/
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd80000, 0xd80003, 0, 0, dw2_d80000_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd80000, 0xd80003, 0, 0, dw2_d80000_r);
}
static DRIVER_INIT( drgw2 )
@@ -1381,11 +1381,11 @@ static DRIVER_INIT( kov )
{
pgm_basic_init(machine);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
/* 0x4f0000 - ? is actually ram shared with the protection device,
the protection device provides the region code */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
pgm_kov_decrypt(machine);
}
@@ -1408,9 +1408,9 @@ static DRIVER_INIT( pstar )
pgm_basic_init(machine);
pgm_pstar_decrypt(machine);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4f0025, 0, 0, PSTARS_protram_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, PSTARS_r16);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500005, 0, 0, PSTARS_w16);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4f0000, 0x4f0025, 0, 0, PSTARS_protram_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500000, 0x500003, 0, 0, PSTARS_r16);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500000, 0x500005, 0, 0, PSTARS_w16);
}
@@ -1419,11 +1419,11 @@ static DRIVER_INIT( kovsh )
{
pgm_basic_init(machine);
-// memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
+// memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
/* 0x4f0000 - ? is actually ram shared with the protection device,
the protection device provides the region code */
-// memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
+// memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
pgm_kovsh_decrypt(machine);
}
@@ -1432,11 +1432,11 @@ static DRIVER_INIT( djlzz )
{
pgm_basic_init(machine);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
/* 0x4f0000 - ? is actually ram shared with the protection device,
the protection device provides the region code */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
pgm_djlzz_decrypt(machine);
}
@@ -1445,7 +1445,7 @@ static DRIVER_INIT( dw3 )
{
pgm_basic_init(machine);
-// memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xda0000, 0xdaffff, 0, 0, dw3_prot_r, dw3_prot_w);
+// memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xda0000, 0xdaffff, 0, 0, dw3_prot_r, dw3_prot_w);
pgm_dw3_decrypt(machine);
}
@@ -1693,7 +1693,7 @@ static DRIVER_INIT( killbld )
mem16[0x108a42/2]=0x5202;
mem16[0x108a44/2]=0x0c02;
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd40000, 0xd40003, 0, 0, killbld_prot_r, killbld_prot_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd40000, 0xd40003, 0, 0, killbld_prot_r, killbld_prot_w);
}
/* ddp2 rubbish */
@@ -1744,9 +1744,9 @@ static DRIVER_INIT( ddp2 )
ddp2_protram = auto_malloc(0x2000);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd10000, 0xd10001, 0, 0, ddp2_asic27_0xd10000_r, ddp2_asic27_0xd10000_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd10000, 0xd10001, 0, 0, ddp2_asic27_0xd10000_r, ddp2_asic27_0xd10000_w);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd00000, 0xd01fff, 0, 0, ddp2_protram_r, ddp2_protram_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd00000, 0xd01fff, 0, 0, ddp2_protram_r, ddp2_protram_w);
}
static DRIVER_INIT( puzzli2 )
@@ -1759,11 +1759,11 @@ static DRIVER_INIT( puzzli2 )
pgm_basic_init(machine);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500000, 0x500003, 0, 0, ASIC28_r16, ASIC28_w16);
/* 0x4f0000 - ? is actually ram shared with the protection device,
the protection device provides the region code */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4f0000, 0x4fffff, 0, 0, sango_protram_r);
pgm_puzzli2_decrypt(machine);
@@ -1894,7 +1894,7 @@ static DRIVER_INIT( olds )
pgm_basic_init(machine);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xdcb400, 0xdcb403, 0, 0, olds_r16, olds_w16);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xdcb400, 0xdcb403, 0, 0, olds_r16, olds_w16);
}
diff --git a/src/mame/drivers/phoenix.c b/src/mame/drivers/phoenix.c
index 400167026f0..6eb92287727 100644
--- a/src/mame/drivers/phoenix.c
+++ b/src/mame/drivers/phoenix.c
@@ -1015,7 +1015,7 @@ ROM_END
static DRIVER_INIT( condor )
{
/* additional inputs for coinage */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5000, 0, 0, input_port_read_handler8(machine->portconfig, "DSW1") );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x5000, 0, 0, input_port_read_handler8(machine->portconfig, "DSW1") );
}
static DRIVER_INIT( survival )
diff --git a/src/mame/drivers/pingpong.c b/src/mame/drivers/pingpong.c
index 413cb19ca26..5757f97f6d7 100644
--- a/src/mame/drivers/pingpong.c
+++ b/src/mame/drivers/pingpong.c
@@ -593,18 +593,18 @@ static DRIVER_INIT( cashquiz )
ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
/* questions banking handlers */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4000, 0, 0, cashquiz_question_bank_high_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4001, 0x4001, 0, 0, cashquiz_question_bank_low_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4000, 0, 0, cashquiz_question_bank_high_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4001, 0x4001, 0, 0, cashquiz_question_bank_low_w);
// 8 independents banks for questions
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x50ff, 0, 0, SMH_BANK1);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5100, 0x51ff, 0, 0, SMH_BANK2);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5200, 0x52ff, 0, 0, SMH_BANK3);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5300, 0x53ff, 0, 0, SMH_BANK4);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5400, 0x54ff, 0, 0, SMH_BANK5);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5500, 0x55ff, 0, 0, SMH_BANK6);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5600, 0x56ff, 0, 0, SMH_BANK7);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5700, 0x57ff, 0, 0, SMH_BANK8);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x50ff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5100, 0x51ff, 0, 0, SMH_BANK2);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5200, 0x52ff, 0, 0, SMH_BANK3);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5300, 0x53ff, 0, 0, SMH_BANK4);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5400, 0x54ff, 0, 0, SMH_BANK5);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5500, 0x55ff, 0, 0, SMH_BANK6);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5600, 0x56ff, 0, 0, SMH_BANK7);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5700, 0x57ff, 0, 0, SMH_BANK8);
// setup default banks
for(i = 0; i < 8; i++)
diff --git a/src/mame/drivers/pipedrm.c b/src/mame/drivers/pipedrm.c
index 60ff00824f8..a3961e4fe0f 100644
--- a/src/mame/drivers/pipedrm.c
+++ b/src/mame/drivers/pipedrm.c
@@ -124,11 +124,11 @@ static UINT8 sound_command;
static MACHINE_RESET( pipedrm )
{
/* initialize main Z80 bank */
- memory_configure_bank(1, 0, 8, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 8, memory_region(machine, "main") + 0x10000, 0x2000);
memory_set_bank(1, 0);
/* initialize sound bank */
- memory_configure_bank(2, 0, 2, memory_region(machine, "audio") + 0x10000, 0x8000);
+ memory_configure_bank(machine, 2, 0, 2, memory_region(machine, "audio") + 0x10000, 0x8000);
memory_set_bank(2, 0);
/* state save */
state_save_register_global(pending_command);
@@ -743,15 +743,15 @@ static DRIVER_INIT( pipedrm )
/* sprite RAM lives at the end of palette RAM */
spriteram = &paletteram[0xc00];
spriteram_size = 0x400;
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xcc00, 0xcfff, 0, 0, SMH_BANK3, SMH_BANK3);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc00, 0xcfff, 0, 0, SMH_BANK3, SMH_BANK3);
memory_set_bankptr(3, spriteram);
}
static DRIVER_INIT( hatris )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x20, 0x20, 0, 0, sound_command_nonmi_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x21, 0x21, 0, 0, fromance_gfxreg_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x20, 0x20, 0, 0, sound_command_nonmi_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x21, 0x21, 0, 0, fromance_gfxreg_w);
}
diff --git a/src/mame/drivers/pirates.c b/src/mame/drivers/pirates.c
index 2cda0bae1c5..622def1a053 100644
--- a/src/mame/drivers/pirates.c
+++ b/src/mame/drivers/pirates.c
@@ -485,7 +485,7 @@ static DRIVER_INIT( genix )
/* If this value is increased then something has gone wrong and the protection failed */
/* Write-protect it for now */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x109e98, 0x109e9b, 0, 0, genix_prot_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x109e98, 0x109e9b, 0, 0, genix_prot_r );
}
diff --git a/src/mame/drivers/pokechmp.c b/src/mame/drivers/pokechmp.c
index d3314574ac0..b0c78976ee4 100644
--- a/src/mame/drivers/pokechmp.c
+++ b/src/mame/drivers/pokechmp.c
@@ -285,7 +285,7 @@ MACHINE_DRIVER_END
static DRIVER_INIT( pokechmp )
{
- memory_configure_bank(3, 0, 2, memory_region(machine, "audio") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 3, 0, 2, memory_region(machine, "audio") + 0x10000, 0x4000);
}
diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c
index aec864f2d41..7d070f528ee 100644
--- a/src/mame/drivers/polepos.c
+++ b/src/mame/drivers/polepos.c
@@ -1744,16 +1744,16 @@ static DRIVER_INIT( topracra )
polepos_gear_bit = 0x20;
/* extra direct mapped inputs read */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x02, 0x02, 0, 0, input_port_read_handler8(machine->portconfig, "STEER"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x03, 0x03, 0, 0, input_port_read_handler8(machine->portconfig, "IN0"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x04, 0x04, 0, 0, input_port_read_handler8(machine->portconfig, "DSWA"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x02, 0x02, 0, 0, input_port_read_handler8(machine->portconfig, "STEER"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x03, 0x03, 0, 0, input_port_read_handler8(machine->portconfig, "IN0"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x04, 0x04, 0, 0, input_port_read_handler8(machine->portconfig, "DSWA"));
}
static DRIVER_INIT( polepos2 )
{
/* note that the bootleg version doesn't need this custom IC; it has a hacked ROM in its place */
- memory_install_read16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, polepos2_ic25_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4000, 0x5fff, 0, 0, polepos2_ic25_r);
DRIVER_INIT_CALL(polepos);
}
diff --git a/src/mame/drivers/policetr.c b/src/mame/drivers/policetr.c
index 9f5861f4ed0..16aecc3463b 100644
--- a/src/mame/drivers/policetr.c
+++ b/src/mame/drivers/policetr.c
@@ -700,26 +700,26 @@ ROM_END
static DRIVER_INIT( policetr )
{
- speedup_data = memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000fc8, 0x00000fcb, 0, 0, speedup_w);
+ speedup_data = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000fc8, 0x00000fcb, 0, 0, speedup_w);
speedup_pc = 0x1fc028ac;
}
static DRIVER_INIT( plctr13b )
{
- speedup_data = memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000fc8, 0x00000fcb, 0, 0, speedup_w);
+ speedup_data = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000fc8, 0x00000fcb, 0, 0, speedup_w);
speedup_pc = 0x1fc028bc;
}
static DRIVER_INIT( sshooter )
{
- speedup_data = memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00018fd8, 0x00018fdb, 0, 0, speedup_w);
+ speedup_data = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00018fd8, 0x00018fdb, 0, 0, speedup_w);
speedup_pc = 0x1fc03470;
}
static DRIVER_INIT( sshoot12 )
{
- speedup_data = memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00018fd8, 0x00018fdb, 0, 0, speedup_w);
+ speedup_data = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00018fd8, 0x00018fdb, 0, 0, speedup_w);
speedup_pc = 0x1fc033e0;
}
diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c
index dfde9404898..302dbcf0962 100644
--- a/src/mame/drivers/progolf.c
+++ b/src/mame/drivers/progolf.c
@@ -272,10 +272,11 @@ ROM_END
static DRIVER_INIT( progolf )
{
int A;
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8* decrypted = auto_malloc(0x10000);
- memory_set_decrypted_region(0,0x0000,0xffff, decrypted);
+ memory_set_decrypted_region(space,0x0000,0xffff, decrypted);
/* Swap bits 5 & 6 for opcodes */
for (A = 0;A < 0x10000;A++)
diff --git a/src/mame/drivers/psikyo.c b/src/mame/drivers/psikyo.c
index e43b3531b9d..18d843aff7c 100644
--- a/src/mame/drivers/psikyo.c
+++ b/src/mame/drivers/psikyo.c
@@ -1456,10 +1456,10 @@ static DRIVER_INIT( sngkace )
}
/* input ports */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, sngkace_input_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc0000b, 0, 0, sngkace_input_r);
/* sound latch */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00010, 0xc00013, 0, 0, psikyo_soundlatch_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, psikyo_soundlatch_w);
psikyo_ka302c_banking = 0; // SH201B doesn't have any gfx banking
psikyo_switch_banks(0, 0); // sngkace / samuraia don't use banking
@@ -1628,10 +1628,10 @@ ROM_END
static DRIVER_INIT( gunbird )
{
/* input ports */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, gunbird_input_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc0000b, 0, 0, gunbird_input_r);
/* sound latch */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00010, 0xc00013, 0, 0, psikyo_soundlatch_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, psikyo_soundlatch_w);
psikyo_ka302c_banking = 1;
}
@@ -1686,10 +1686,10 @@ ROM_END
static DRIVER_INIT( s1945jn )
{
/* input ports */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, gunbird_input_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc0000b, 0, 0, gunbird_input_r);
/* sound latch */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
psikyo_ka302c_banking = 1;
}
@@ -1893,13 +1893,13 @@ ROM_END
static DRIVER_INIT( s1945 )
{
/* input ports */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
/* sound latch */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
/* protection and tile bank switching */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
s1945_mcu_init(s1945_table);
psikyo_ka302c_banking = 0; // Banking is controlled by mcu
@@ -1908,13 +1908,13 @@ static DRIVER_INIT( s1945 )
static DRIVER_INIT( s1945a )
{
/* input ports */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
/* sound latch */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
/* protection and tile bank switching */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
s1945_mcu_init(s1945a_table);
psikyo_ka302c_banking = 0; // Banking is controlled by mcu
@@ -1923,13 +1923,13 @@ static DRIVER_INIT( s1945a )
static DRIVER_INIT( s1945j )
{
/* input ports*/
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
/* sound latch */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
/* protection and tile bank switching */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
s1945_mcu_init(s1945j_table);
psikyo_ka302c_banking = 0; // Banking is controlled by mcu
@@ -2020,13 +2020,13 @@ ROM_END
static DRIVER_INIT( tengai )
{
/* input ports */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00000, 0xc0000b, 0, 0, s1945_input_r);
/* sound latch */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00010, 0xc00013, 0, 0, s1945_soundlatch_w);
/* protection */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00004, 0xc0000b, 0, 0, s1945_mcu_w);
s1945_mcu_init(0);
psikyo_ka302c_banking = 0; // Banking is controlled by mcu
diff --git a/src/mame/drivers/psikyo4.c b/src/mame/drivers/psikyo4.c
index 60514b01e71..2cd465cae92 100644
--- a/src/mame/drivers/psikyo4.c
+++ b/src/mame/drivers/psikyo4.c
@@ -1108,7 +1108,7 @@ static void install_hotgmck_pcm_bank(running_machine *machine)
set_hotgmck_pcm_bank(machine, 0);
set_hotgmck_pcm_bank(machine, 1);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5800008, 0x580000b, 0, 0, hotgmck_pcm_bank_w );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5800008, 0x580000b, 0, 0, hotgmck_pcm_bank_w );
state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)0);
state_save_register_postload(machine, hotgmck_pcm_bank_postload, (void *)1);
}
@@ -1122,17 +1122,17 @@ static DRIVER_INIT( hotgmck )
static DRIVER_INIT( loderndf )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000020, 0x6000023, 0, 0, loderndf_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000020, 0x6000023, 0, 0, loderndf_speedup_r );
}
static DRIVER_INIT( loderdfa )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000020, 0x6000023, 0, 0, loderdfa_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000020, 0x6000023, 0, 0, loderdfa_speedup_r );
}
static DRIVER_INIT( hotdebut )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600001c, 0x600001f, 0, 0, hotdebut_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x600001c, 0x600001f, 0, 0, hotdebut_speedup_r );
}
diff --git a/src/mame/drivers/pturn.c b/src/mame/drivers/pturn.c
index e5a8ec59d0e..c09b88dd65c 100644
--- a/src/mame/drivers/pturn.c
+++ b/src/mame/drivers/pturn.c
@@ -521,8 +521,8 @@ ROM_END
static DRIVER_INIT(pturn)
{
/*
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc0dd, 0xc0dd, 0, 0, pturn_protection_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc0db, 0xc0db, 0, 0, pturn_protection2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc0dd, 0xc0dd, 0, 0, pturn_protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc0db, 0xc0db, 0, 0, pturn_protection2_r);
*/
}
diff --git a/src/mame/drivers/qix.c b/src/mame/drivers/qix.c
index ec599689ade..3f6a81b4a22 100644
--- a/src/mame/drivers/qix.c
+++ b/src/mame/drivers/qix.c
@@ -1224,6 +1224,8 @@ static int kram3_decrypt(int address, int value)
static DRIVER_INIT( kram3 )
{
+ const address_space *mainspace = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ const address_space *videospace = cputag_get_address_space(machine, "video", ADDRESS_SPACE_PROGRAM);
const UINT8 *patch;
UINT8 *rom, *decrypted;
int i, size;
@@ -1247,7 +1249,7 @@ static DRIVER_INIT( kram3 )
rom = memory_region(machine, "main");
decrypted = auto_malloc(0x6000);
- memory_set_decrypted_region(0, 0xa000, 0xffff, decrypted);
+ memory_set_decrypted_region(mainspace, 0xa000, 0xffff, decrypted);
memcpy(decrypted,&rom[0xa000],0x6000);
for (i = 0xa000; i < 0x10000; ++i)
@@ -1261,7 +1263,7 @@ static DRIVER_INIT( kram3 )
rom = memory_region(machine, "video");
decrypted = auto_malloc(0x6000);
- memory_set_decrypted_region(1, 0xa000, 0xffff, decrypted);
+ memory_set_decrypted_region(videospace, 0xa000, 0xffff, decrypted);
memcpy(decrypted,&rom[0xa000],0x6000);
for (i = 0xa000; i < 0x10000; ++i)
@@ -1274,15 +1276,15 @@ static DRIVER_INIT( kram3 )
static DRIVER_INIT( zookeep )
{
/* configure the banking */
- memory_configure_bank(1, 0, 1, memory_region(machine, "video") + 0xa000, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "video") + 0x10000, 0);
+ memory_configure_bank(machine, 1, 0, 1, memory_region(machine, "video") + 0xa000, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "video") + 0x10000, 0);
memory_set_bank(1, 0);
}
static DRIVER_INIT( slither )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9800, 0x9bff, 0, 0, pia_1_r, pia_1_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9800, 0x9bff, 0, 0, pia_1_r, pia_1_w);
}
diff --git a/src/mame/drivers/raiden.c b/src/mame/drivers/raiden.c
index 786bbce1b4d..41f3a076639 100644
--- a/src/mame/drivers/raiden.c
+++ b/src/mame/drivers/raiden.c
@@ -473,12 +473,12 @@ static READ16_HANDLER( sub_cpu_spina_r )
static DRIVER_INIT( raiden )
{
- memory_install_read16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4008, 0x4009, 0, 0, sub_cpu_spin_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4008, 0x4009, 0, 0, sub_cpu_spin_r);
}
static void memory_patcha(running_machine *machine)
{
- memory_install_read16_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4008, 0x4009, 0, 0, sub_cpu_spina_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4008, 0x4009, 0, 0, sub_cpu_spina_r);
}
/* This is based on code by Niclas Karlsson Mate, who figured out the
diff --git a/src/mame/drivers/seattle.c b/src/mame/drivers/seattle.c
index 4e5f7db562f..392e4cf1343 100644
--- a/src/mame/drivers/seattle.c
+++ b/src/mame/drivers/seattle.c
@@ -2767,22 +2767,22 @@ static void init_common(running_machine *machine, int ioasic, int serialnum, int
{
case PHOENIX_CONFIG:
/* original Phoenix board only has 4MB of RAM */
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00400000, 0x007fffff, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00400000, 0x007fffff, 0, 0, SMH_UNMAP, SMH_UNMAP);
break;
case SEATTLE_WIDGET_CONFIG:
/* set up the widget board */
device = device_list_find_by_tag(machine->config->devicelist, SMC91C94, "ethernet");
- memory_install_readwrite32_device_handler(device, 0, ADDRESS_SPACE_PROGRAM, 0x16c00000, 0x16c0001f, 0, 0, widget_r, widget_w);
+ memory_install_readwrite32_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), device, 0x16c00000, 0x16c0001f, 0, 0, widget_r, widget_w);
break;
case FLAGSTAFF_CONFIG:
/* set up the analog inputs */
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x14000000, 0x14000003, 0, 0, analog_port_r, analog_port_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x14000000, 0x14000003, 0, 0, analog_port_r, analog_port_w);
/* set up the ethernet controller */
device = device_list_find_by_tag(machine->config->devicelist, SMC91C94, "ethernet");
- memory_install_readwrite32_device_handler(device, 0, ADDRESS_SPACE_PROGRAM, 0x16c00000, 0x16c0003f, 0, 0, ethernet_r, ethernet_w);
+ memory_install_readwrite32_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), device, 0x16c00000, 0x16c0003f, 0, 0, ethernet_r, ethernet_w);
break;
}
@@ -2921,7 +2921,7 @@ static DRIVER_INIT( carnevil )
init_common(machine, MIDWAY_IOASIC_CARNEVIL, 469/* 469 or 486 or 528 */, 80, SEATTLE_CONFIG);
/* set up the gun */
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x16800000, 0x1680001f, 0, 0, carnevil_gun_r, carnevil_gun_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x16800000, 0x1680001f, 0, 0, carnevil_gun_r, carnevil_gun_w);
/* speedups */
add_speedup(machine, 0x8015176C, 0x3C03801A); /* confirmed */
diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c
index 04945e23ce4..601317a676e 100644
--- a/src/mame/drivers/segac2.c
+++ b/src/mame/drivers/segac2.c
@@ -2125,7 +2125,7 @@ static DRIVER_INIT( tfrceacb )
{
/* disable the palette bank switching from the protection chip */
segac2_common_init(machine, NULL);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x800000, 0x800001, 0, 0, SMH_NOP);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800000, 0x800001, 0, 0, SMH_NOP);
}
static DRIVER_INIT( borench )
@@ -2213,36 +2213,36 @@ static DRIVER_INIT( pclub )
{
segac2_common_init(machine, prot_func_pclub);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, print_club_camera_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w);
}
static DRIVER_INIT( pclubjv2 )
{
segac2_common_init(machine, prot_func_pclubjv2);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, print_club_camera_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w);
}
static DRIVER_INIT( pclubjv4 )
{
segac2_common_init(machine, prot_func_pclubjv4);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, print_club_camera_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w);
}
static DRIVER_INIT( pclubjv5 )
{
segac2_common_init(machine, prot_func_pclubjv5);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x880124, 0x880125, 0, 0, print_club_camera_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w);
}
diff --git a/src/mame/drivers/segae.c b/src/mame/drivers/segae.c
index 9900847b1ee..174bab1520a 100644
--- a/src/mame/drivers/segae.c
+++ b/src/mame/drivers/segae.c
@@ -2166,23 +2166,23 @@ static void init_ports_systeme(running_machine *machine)
{
/* INIT THE PORTS *********************************************************************************************/
- memory_install_write8_handler (machine, 0, ADDRESS_SPACE_IO, 0x7b, 0x7b, 0, 0, sms_sn76496_2_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0x7e, 0x7e, 0, 0, sms_vcounter_r, sms_sn76496_w);
- memory_install_write8_handler (machine, 0, ADDRESS_SPACE_IO, 0x7f, 0x7f, 0, 0, sms_sn76496_w);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7b, 0x7b, 0, 0, sms_sn76496_2_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7e, 0x7e, 0, 0, sms_vcounter_r, sms_sn76496_w);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x7f, 0x7f, 0, 0, sms_sn76496_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xba, 0xba, 0, 0, sms_vdp_data_r, sms_vdp_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xbb, 0xbb, 0, 0, sms_vdp_ctrl_r, sms_vdp_ctrl_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xbe, 0xbe, 0, 0, sms_vdp_2_data_r, sms_vdp_2_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xbf, 0xbf, 0, 0, sms_vdp_2_ctrl_r, sms_vdp_2_ctrl_w);
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_IO, 0xe0, 0xe0, 0, 0, input_port_read_handler8(machine->portconfig, "e0"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_IO, 0xe1, 0xe1, 0, 0, input_port_read_handler8(machine->portconfig, "e1"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_IO, 0xe2, 0xe2, 0, 0, input_port_read_handler8(machine->portconfig, "e2"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_IO, 0xf2, 0xf2, 0, 0, input_port_read_handler8(machine->portconfig, "f2"));
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_IO, 0xf3, 0xf3, 0, 0, input_port_read_handler8(machine->portconfig, "f3"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xe0, 0xe0, 0, 0, input_port_read_handler8(machine->portconfig, "e0"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xe1, 0xe1, 0, 0, input_port_read_handler8(machine->portconfig, "e1"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xe2, 0xe2, 0, 0, input_port_read_handler8(machine->portconfig, "e2"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf2, 0xf2, 0, 0, input_port_read_handler8(machine->portconfig, "f2"));
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf3, 0xf3, 0, 0, input_port_read_handler8(machine->portconfig, "f3"));
- memory_install_write8_handler (machine, 0, ADDRESS_SPACE_IO, 0xf7, 0xf7, 0, 0, systeme_bank_w );
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf7, 0xf7, 0, 0, systeme_bank_w );
}
@@ -2192,24 +2192,24 @@ static void init_systeme_map(running_machine *machine)
/* INIT THE MEMMAP / BANKING *********************************************************************************/
/* catch any addresses that don't get mapped */
-// memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
+// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w);
/* fixed rom bank area */
// sms_rom = auto_malloc(0xc000);
-// memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0xbfff, 0, 0, SMH_BANK1, SMH_UNMAP);
+// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, SMH_BANK1, SMH_UNMAP);
// memory_set_bankptr( 1, sms_rom );
- memory_configure_bank(1, 0, 16, memory_region(machine, "z80") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "z80") + 0x10000, 0x4000);
/* alternate way of accessing video ram */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0, segasyse_videoram_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, segasyse_videoram_w);
// memcpy(sms_rom, memory_region(machine, "user1"), 0x8000);
/* main ram area */
sms_mainram = auto_malloc(0x4000);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_BANK2);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_BANK2);
memory_set_bankptr( 2, sms_mainram );
memset(sms_mainram,0x00,0x4000);
@@ -2334,8 +2334,8 @@ static DRIVER_INIT( ridleofp )
{
DRIVER_INIT_CALL(segasyse);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, segae_ridleofp_port_f8_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfa, 0xfa, 0, 0, segae_ridleofp_port_fa_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, segae_ridleofp_port_f8_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfa, 0xfa, 0, 0, segae_ridleofp_port_fa_w);
}
@@ -2343,8 +2343,8 @@ static DRIVER_INIT( hangonjr )
{
DRIVER_INIT_CALL(segasyse);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, segae_hangonjr_port_f8_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfa, 0xfa, 0, 0, segae_hangonjr_port_fa_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, segae_hangonjr_port_f8_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfa, 0xfa, 0, 0, segae_hangonjr_port_fa_w);
}
static DRIVER_INIT( opaopa )
diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c
index 5a9398a4a77..6d038a907d9 100644
--- a/src/mame/drivers/segag80r.c
+++ b/src/mame/drivers/segag80r.c
@@ -1437,11 +1437,11 @@ static DRIVER_INIT( astrob )
segag80r_background_pcb = G80_BACKGROUND_NONE;
/* install speech board */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x38, 0x38, 0, 0, sega_speech_data_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b, 0x3b, 0, 0, sega_speech_control_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x38, 0x38, 0, 0, sega_speech_data_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3b, 0x3b, 0, 0, sega_speech_control_w);
/* install Astro Blaster sound board */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3e, 0x3f, 0, 0, astrob_sound_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3f, 0, 0, astrob_sound_w);
}
@@ -1464,14 +1464,14 @@ static DRIVER_INIT( spaceod )
segag80r_background_pcb = G80_BACKGROUND_SPACEOD;
/* configure ports for the background board */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0x08, 0x0f, 0, 0, spaceod_back_port_r, spaceod_back_port_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x08, 0x0f, 0, 0, spaceod_back_port_r, spaceod_back_port_w);
/* install Space Odyssey sound board */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0e, 0x0f, 0, 0, spaceod_sound_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0e, 0x0f, 0, 0, spaceod_sound_w);
/* install our wacky mangled ports */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xfb, 0, 0, spaceod_mangled_ports_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfc, 0xfc, 0, 0, spaceod_port_fc_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xfb, 0, 0, spaceod_mangled_ports_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, spaceod_port_fc_r);
}
@@ -1485,8 +1485,8 @@ static DRIVER_INIT( monsterb )
monsterb_expand_gfx(machine, "gfx1");
/* install background board handlers */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb8, 0xbd, 0, 0, monsterb_back_port_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, monsterb_vidram_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xb8, 0xbd, 0, 0, monsterb_back_port_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, monsterb_vidram_w);
}
@@ -1501,9 +1501,9 @@ static DRIVER_INIT( monster2 )
monsterb_expand_gfx(machine, "gfx1");
/* install background board handlers */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb4, 0xb5, 0, 0, pignewt_back_color_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb8, 0xbd, 0, 0, pignewt_back_port_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, pignewt_vidram_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xb4, 0xb5, 0, 0, pignewt_back_color_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xb8, 0xbd, 0, 0, pignewt_back_port_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, pignewt_vidram_w);
}
@@ -1517,13 +1517,13 @@ static DRIVER_INIT( pignewt )
monsterb_expand_gfx(machine, "gfx1");
/* install background board handlers */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb4, 0xb5, 0, 0, pignewt_back_color_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xb8, 0xbd, 0, 0, pignewt_back_port_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, pignewt_vidram_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xb4, 0xb5, 0, 0, pignewt_back_color_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xb8, 0xbd, 0, 0, pignewt_back_port_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, pignewt_vidram_w);
/* install Universal sound board */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
}
@@ -1537,8 +1537,8 @@ static DRIVER_INIT( sindbadm )
segag80r_background_pcb = G80_BACKGROUND_SINDBADM;
/* install background board handlers */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x40, 0x41, 0, 0, sindbadm_back_port_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, sindbadm_vidram_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x40, 0x41, 0, 0, sindbadm_back_port_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, sindbadm_vidram_w);
}
diff --git a/src/mame/drivers/segag80v.c b/src/mame/drivers/segag80v.c
index e334f573e6f..0b571f85c5d 100644
--- a/src/mame/drivers/segag80v.c
+++ b/src/mame/drivers/segag80v.c
@@ -1328,8 +1328,8 @@ static DRIVER_INIT( elim2 )
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3e, 0x3e, 0, 0, elim1_sh_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3f, 0x3f, 0, 0, elim2_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, elim1_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, elim2_sh_w);
}
@@ -1340,12 +1340,12 @@ static DRIVER_INIT( elim4 )
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3e, 0x3e, 0, 0, elim1_sh_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3f, 0x3f, 0, 0, elim2_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, elim1_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, elim2_sh_w);
/* configure inputs */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfc, 0xfc, 0, 0, elim4_input_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, elim4_input_r);
}
@@ -1356,10 +1356,10 @@ static DRIVER_INIT( spacfury )
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x38, 0x38, 0, 0, sega_speech_data_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b, 0x3b, 0, 0, sega_speech_control_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3e, 0x3e, 0, 0, spacfury1_sh_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3f, 0x3f, 0, 0, spacfury2_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x38, 0x38, 0, 0, sega_speech_data_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3b, 0x3b, 0, 0, sega_speech_control_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, spacfury1_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, spacfury2_sh_w);
}
@@ -1370,16 +1370,16 @@ static DRIVER_INIT( zektor )
/* configure sound */
has_usb = FALSE;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x38, 0x38, 0, 0, sega_speech_data_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b, 0x3b, 0, 0, sega_speech_control_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3c, 0x3c, 0, 0, ay8910_control_port_0_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d, 0x3d, 0, 0, ay8910_write_port_0_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3e, 0x3e, 0, 0, zektor1_sh_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3f, 0x3f, 0, 0, zektor2_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x38, 0x38, 0, 0, sega_speech_data_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3b, 0x3b, 0, 0, sega_speech_control_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3c, 0x3c, 0, 0, ay8910_control_port_0_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3d, 0x3d, 0, 0, ay8910_write_port_0_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3e, 0x3e, 0, 0, zektor1_sh_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, zektor2_sh_w);
/* configure inputs */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfc, 0xfc, 0, 0, spinner_input_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, spinner_input_r);
}
@@ -1390,12 +1390,12 @@ static DRIVER_INIT( tacscan )
/* configure sound */
has_usb = TRUE;
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
/* configure inputs */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfc, 0xfc, 0, 0, spinner_input_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, spinner_input_r);
}
@@ -1406,15 +1406,15 @@ static DRIVER_INIT( startrek )
/* configure sound */
has_usb = TRUE;
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x38, 0x38, 0, 0, sega_speech_data_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b, 0x3b, 0, 0, sega_speech_control_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x38, 0x38, 0, 0, sega_speech_data_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3b, 0x3b, 0, 0, sega_speech_control_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x3f, 0x3f, 0, 0, sega_usb_status_r, sega_usb_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd000, 0xdfff, 0, 0, sega_usb_ram_r, usb_ram_w);
/* configure inputs */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0xf8, 0xf8, 0, 0, spinner_select_w);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0xfc, 0xfc, 0, 0, spinner_input_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xf8, 0xf8, 0, 0, spinner_select_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xfc, 0xfc, 0, 0, spinner_input_r);
}
diff --git a/src/mame/drivers/segahang.c b/src/mame/drivers/segahang.c
index 3cbdf017737..92680d2332c 100644
--- a/src/mame/drivers/segahang.c
+++ b/src/mame/drivers/segahang.c
@@ -1733,11 +1733,12 @@ static DRIVER_INIT( enduror )
static DRIVER_INIT( endurobl )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT16 *rom = (UINT16 *)memory_region(machine, "main");
UINT16 *decrypt = (UINT16 *)auto_malloc(0x40000);
hangon_generic_init();
- memory_set_decrypted_region(0, 0x000000, 0x03ffff, decrypt);
+ memory_set_decrypted_region(space, 0x000000, 0x03ffff, decrypt);
memcpy(decrypt + 0x00000/2, rom + 0x30000/2, 0x10000);
memcpy(decrypt + 0x10000/2, rom + 0x10000/2, 0x20000);
@@ -1746,11 +1747,12 @@ static DRIVER_INIT( endurobl )
static DRIVER_INIT( endurob2 )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT16 *rom = (UINT16 *)memory_region(machine, "main");
UINT16 *decrypt = (UINT16 *)auto_malloc(0x40000);
hangon_generic_init();
- memory_set_decrypted_region(0, 0x000000, 0x03ffff, decrypt);
+ memory_set_decrypted_region(space, 0x000000, 0x03ffff, decrypt);
memcpy(decrypt, rom, 0x30000);
/* missing data ROM */
diff --git a/src/mame/drivers/segald.c b/src/mame/drivers/segald.c
index 6ef3d967362..fee0d27f629 100644
--- a/src/mame/drivers/segald.c
+++ b/src/mame/drivers/segald.c
@@ -568,7 +568,7 @@ ROM_END
static DRIVER_INIT( astron )
{
UINT8 *ROM = memory_region(machine, "main");
- memory_configure_bank(1, 0, 2, &ROM[0x8000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 2, &ROM[0x8000], 0x4000);
}
diff --git a/src/mame/drivers/segas24.c b/src/mame/drivers/segas24.c
index 8742b113411..15cc72d875a 100644
--- a/src/mame/drivers/segas24.c
+++ b/src/mame/drivers/segas24.c
@@ -1113,8 +1113,8 @@ static MACHINE_START( system24 )
UINT8 *usr1 = memory_region(machine, "romboard");
if (usr1)
{
- memory_configure_bank(1, 0, 16, usr1, 0x40000);
- memory_configure_bank(2, 0, 16, usr1, 0x40000);
+ memory_configure_bank(machine, 1, 0, 16, usr1, 0x40000);
+ memory_configure_bank(machine, 2, 0, 16, usr1, 0x40000);
}
}
diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c
index ac6ec5136a5..cb12bb7df52 100644
--- a/src/mame/drivers/segas32.c
+++ b/src/mame/drivers/segas32.c
@@ -3786,14 +3786,14 @@ static READ16_HANDLER( arescue_slavebusy_r )
static DRIVER_INIT( arescue )
{
segas32_common_init(analog_custom_io_r, analog_custom_io_w, NULL);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00000, 0xa00007, 0, 0, arescue_dsp_r, arescue_dsp_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa00007, 0, 0, arescue_dsp_r, arescue_dsp_w);
dual_pcb_comms = auto_malloc(0x1000);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x810000, 0x810fff, 0, 0, dual_pcb_comms_r, dual_pcb_comms_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x818000, 0x818003, 0, 0, dual_pcb_masterslave);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x810000, 0x810fff, 0, 0, dual_pcb_comms_r, dual_pcb_comms_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x818000, 0x818003, 0, 0, dual_pcb_masterslave);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x810000, 0x810001, 0, 0, arescue_handshake_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x81000e, 0x81000f, 0, 0, arescue_slavebusy_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x810000, 0x810001, 0, 0, arescue_handshake_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x81000e, 0x81000f, 0, 0, arescue_slavebusy_r);
}
@@ -3802,8 +3802,8 @@ static DRIVER_INIT( arabfgt )
segas32_common_init(extra_custom_io_r, NULL, NULL);
/* install protection handlers */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00100, 0xa0011f, 0, 0, arf_wakeup_protection_r);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00000, 0xa00fff, 0, 0, arabfgt_protection_r, arabfgt_protection_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00100, 0xa0011f, 0, 0, arf_wakeup_protection_r);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa00fff, 0, 0, arabfgt_protection_r, arabfgt_protection_w);
}
@@ -3813,8 +3813,8 @@ static DRIVER_INIT( brival )
/* install protection handlers */
system32_protram = auto_malloc (0x1000);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20ba00, 0x20ba07, 0, 0, brival_protection_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00000, 0xa00fff, 0, 0, brival_protection_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20ba00, 0x20ba07, 0, 0, brival_protection_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa00fff, 0, 0, brival_protection_w);
}
@@ -3823,7 +3823,7 @@ static DRIVER_INIT( darkedge )
segas32_common_init(extra_custom_io_r, NULL, NULL);
/* install protection handlers */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00000, 0xa7ffff, 0, 0, darkedge_protection_r, darkedge_protection_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa7ffff, 0, 0, darkedge_protection_r, darkedge_protection_w);
system32_prot_vblank = darkedge_fd1149_vblank;
}
@@ -3832,7 +3832,7 @@ static DRIVER_INIT( dbzvrvs )
segas32_common_init(NULL, NULL, NULL);
/* install protection handlers */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00000, 0xa7ffff, 0, 0, dbzvrvs_protection_r, dbzvrvs_protection_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa7ffff, 0, 0, dbzvrvs_protection_r, dbzvrvs_protection_w);
}
static WRITE16_HANDLER( f1en_comms_echo_w )
@@ -3847,10 +3847,10 @@ static DRIVER_INIT( f1en )
segas32_common_init(analog_custom_io_r, analog_custom_io_w, NULL);
dual_pcb_comms = auto_malloc(0x1000);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x810000, 0x810fff, 0, 0, dual_pcb_comms_r, dual_pcb_comms_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x818000, 0x818003, 0, 0, dual_pcb_masterslave);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x810000, 0x810fff, 0, 0, dual_pcb_comms_r, dual_pcb_comms_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x818000, 0x818003, 0, 0, dual_pcb_masterslave);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x810048, 0x810049, 0, 0, f1en_comms_echo_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x810048, 0x810049, 0, 0, f1en_comms_echo_w);
}
@@ -3865,7 +3865,7 @@ static DRIVER_INIT( ga2 )
segas32_common_init(extra_custom_io_r, NULL, NULL);
decrypt_ga2_protrom(machine);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa00000, 0xa00fff, 0, 0, ga2_dpram_r, ga2_dpram_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa00000, 0xa00fff, 0, 0, ga2_dpram_r, ga2_dpram_w);
}
@@ -3940,7 +3940,7 @@ static DRIVER_INIT( radr )
static DRIVER_INIT( scross )
{
segas32_common_init(analog_custom_io_r, analog_custom_io_w, NULL);
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xb0, 0xbf, 0, 0, scross_bank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xb0, 0xbf, 0, 0, scross_bank_w);
}
@@ -3955,7 +3955,7 @@ static DRIVER_INIT( sonic )
segas32_common_init(sonic_custom_io_r, sonic_custom_io_w, NULL);
/* install protection handlers */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20E5C4, 0x20E5C5, 0, 0, sonic_level_load_protection);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20E5C4, 0x20E5C5, 0, 0, sonic_level_load_protection);
}
@@ -3980,7 +3980,7 @@ static DRIVER_INIT( svf )
static DRIVER_INIT( jleague )
{
segas32_common_init(NULL, NULL, NULL);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20F700, 0x20F705, 0, 0, jleague_protection_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20F700, 0x20F705, 0, 0, jleague_protection_w);
}
diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c
index c75281330f0..6013f878fa5 100644
--- a/src/mame/drivers/segaxbd.c
+++ b/src/mame/drivers/segaxbd.c
@@ -2600,7 +2600,7 @@ static DRIVER_INIT( aburner2 )
xboard_generic_init(machine);
xboard_set_road_priority(0);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x140006, 0x140007, 0, 0x00fff0, aburner2_iochip_0_D_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x140006, 0x140007, 0, 0x00fff0, aburner2_iochip_0_D_w);
}
@@ -2617,14 +2617,14 @@ static DRIVER_INIT( loffire )
adc_reverse[1] = adc_reverse[3] = 1;
/* install extra synchronization on core shared memory */
- loffire_sync = memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x29c000, 0x29c011, 0, 0, loffire_sync0_w);
+ loffire_sync = memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x29c000, 0x29c011, 0, 0, loffire_sync0_w);
}
static DRIVER_INIT( smgp )
{
xboard_generic_init(machine);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2f0000, 0x2f3fff, 0, 0, smgp_excs_r, smgp_excs_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2f0000, 0x2f3fff, 0, 0, smgp_excs_r, smgp_excs_w);
}
diff --git a/src/mame/drivers/seibuspi.c b/src/mame/drivers/seibuspi.c
index b733e5c867e..ca49032acfc 100644
--- a/src/mame/drivers/seibuspi.c
+++ b/src/mame/drivers/seibuspi.c
@@ -1708,9 +1708,9 @@ static MACHINE_RESET( spi )
cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE );
cpu_set_irq_callback(machine->cpu[0], spi_irq_callback);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000680, 0x00000683, 0, 0, sound_fifo_r);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000688, 0x0000068b, 0, 0, z80_prg_fifo_w);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000068c, 0x0000068f, 0, 0, z80_enable_w);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000680, 0x00000683, 0, 0, sound_fifo_r);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000688, 0x0000068b, 0, 0, z80_prg_fifo_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000068c, 0x0000068f, 0, 0, z80_enable_w);
z80_rom = auto_malloc(0x40000);
memory_set_bankptr(4, z80_rom);
@@ -1781,8 +1781,8 @@ static MACHINE_RESET( sxx2f )
memcpy(z80_rom, rom, 0x40000);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000068c, 0x0000068f, 0, 0, eeprom_w);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00000680, 0x00000683, 0, 0, sb_coin_r);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000068c, 0x0000068f, 0, 0, eeprom_w);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00000680, 0x00000683, 0, 0, sb_coin_r);
cpu_set_irq_callback(machine->cpu[0], spi_irq_callback);
sb_coin_latch = 0;
@@ -1953,28 +1953,28 @@ static void init_spi(running_machine *machine)
static DRIVER_INIT( rdft )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00298d0, 0x00298d3, 0, 0, rdft_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00298d0, 0x00298d3, 0, 0, rdft_speedup_r );
init_spi(machine);
}
static DRIVER_INIT( senkyu )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0018cb4, 0x0018cb7, 0, 0, senkyu_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0018cb4, 0x0018cb7, 0, 0, senkyu_speedup_r );
init_spi(machine);
}
static DRIVER_INIT( senkyua )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0018c9c, 0x0018c9f, 0, 0, senkyua_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0018c9c, 0x0018c9f, 0, 0, senkyua_speedup_r );
init_spi(machine);
}
static DRIVER_INIT( batlball )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0018db4, 0x0018db7, 0, 0, batlball_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0018db4, 0x0018db7, 0, 0, batlball_speedup_r );
init_spi(machine);
}
@@ -1982,21 +1982,21 @@ static DRIVER_INIT( batlball )
static DRIVER_INIT( ejanhs )
{
// idle skip doesn't work properly?
-// memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x002d224, 0x002d227, 0, 0, ejanhs_speedup_r );
+// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x002d224, 0x002d227, 0, 0, ejanhs_speedup_r );
init_spi(machine);
}
static DRIVER_INIT( viprp1 )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x001e2e0, 0x001e2e3, 0, 0, viprp1_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x001e2e0, 0x001e2e3, 0, 0, viprp1_speedup_r );
init_spi(machine);
}
static DRIVER_INIT( viprp1o )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x001d49c, 0x001d49f, 0, 0, viprp1o_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x001d49c, 0x001d49f, 0, 0, viprp1o_speedup_r );
init_spi(machine);
}
@@ -2008,12 +2008,12 @@ static void init_rf2(running_machine *machine)
intelflash_init( 0, FLASH_INTEL_E28F008SA, NULL );
intelflash_init( 1, FLASH_INTEL_E28F008SA, NULL );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0282AC, 0x0282AF, 0, 0, rf2_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0282AC, 0x0282AF, 0, 0, rf2_speedup_r );
seibuspi_rise10_text_decrypt(memory_region(machine, "gfx1"));
seibuspi_rise10_bg_decrypt(memory_region(machine, "gfx2"), memory_region_length(machine, "gfx2"));
seibuspi_rise10_sprite_decrypt(memory_region(machine, "gfx3"), 0x600000);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x560, 0x563, 0, 0, sprite_dma_start_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x560, 0x563, 0, 0, sprite_dma_start_w);
}
static DRIVER_INIT( rdft2 )
@@ -2032,12 +2032,12 @@ static DRIVER_INIT( rfjet )
intelflash_init( 0, FLASH_INTEL_E28F008SA, NULL );
intelflash_init( 1, FLASH_INTEL_E28F008SA, NULL );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x002894c, 0x002894f, 0, 0, rfjet_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x002894c, 0x002894f, 0, 0, rfjet_speedup_r );
seibuspi_rise11_text_decrypt(memory_region(machine, "gfx1"));
seibuspi_rise11_bg_decrypt(memory_region(machine, "gfx2"), memory_region_length(machine, "gfx2"));
seibuspi_rise11_sprite_decrypt(memory_region(machine, "gfx3"), 0x800000);
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x560, 0x563, 0, 0, sprite_dma_start_w);
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x560, 0x563, 0, 0, sprite_dma_start_w);
}
/* SYS386 */
diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c
index 18d466a1a48..9cad2a53971 100644
--- a/src/mame/drivers/seta.c
+++ b/src/mame/drivers/seta.c
@@ -9307,10 +9307,10 @@ logerror("%04x: twineagl_200100_w %d = %02x\n",cpu_get_pc(space->cpu),offset,dat
static DRIVER_INIT( twineagl )
{
/* debug? */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x800000, 0x8000ff, 0, 0, twineagl_debug_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800000, 0x8000ff, 0, 0, twineagl_debug_r);
/* This allows 2 simultaneous players and the use of the "Copyright" Dip Switch. */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200100, 0x20010f, 0, 0, twineagl_200100_r, twineagl_200100_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200100, 0x20010f, 0, 0, twineagl_200100_r, twineagl_200100_w);
}
@@ -9340,7 +9340,7 @@ static WRITE16_HANDLER( downtown_protection_w )
static DRIVER_INIT( downtown )
{
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2001ff, 0, 0, downtown_protection_r, downtown_protection_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x2001ff, 0, 0, downtown_protection_r, downtown_protection_w);
}
@@ -9360,7 +9360,7 @@ static READ16_HANDLER( arbalest_debug_r )
static DRIVER_INIT( arbalest )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x80000, 0x8000f, 0, 0, arbalest_debug_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80000, 0x8000f, 0, 0, arbalest_debug_r);
}
@@ -9369,7 +9369,7 @@ static DRIVER_INIT( metafox )
UINT16 *RAM = (UINT16 *) memory_region(machine, "main");
/* This game uses the 21c000-21ffff area for protection? */
-// memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x21c000, 0x21ffff, 0, 0, SMH_NOP, SMH_NOP);
+// memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x21c000, 0x21ffff, 0, 0, SMH_NOP, SMH_NOP);
RAM[0x8ab1c/2] = 0x4e71; // patch protection test: "cp error"
RAM[0x8ab1e/2] = 0x4e71;
@@ -9413,14 +9413,14 @@ static DRIVER_INIT ( blandia )
static DRIVER_INIT( eightfrc )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500004, 0x500005, 0, 0, SMH_NOP); // watchdog??
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500004, 0x500005, 0, 0, SMH_NOP); // watchdog??
}
static DRIVER_INIT( zombraid )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf00002, 0xf00003, 0, 0, zombraid_gun_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf00000, 0xf00001, 0, 0, zombraid_gun_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00002, 0xf00003, 0, 0, zombraid_gun_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf00001, 0, 0, zombraid_gun_w);
}
@@ -9438,7 +9438,7 @@ static DRIVER_INIT( kiwame )
static DRIVER_INIT( rezon )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x500006, 0x500007, 0, 0, SMH_NOP); // irq ack?
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x500006, 0x500007, 0, 0, SMH_NOP); // irq ack?
}
static DRIVER_INIT(wiggie)
@@ -9470,9 +9470,9 @@ static DRIVER_INIT(wiggie)
}
/* X1_010 is not used. */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100000, 0x103fff, 0, 0, SMH_NOP, SMH_NOP);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x103fff, 0, 0, SMH_NOP, SMH_NOP);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xB00008, 0xB00009, 0, 0, wiggie_soundlatch_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xB00008, 0xB00009, 0, 0, wiggie_soundlatch_w);
}
diff --git a/src/mame/drivers/shangkid.c b/src/mame/drivers/shangkid.c
index ba02862c93b..b10d59b4cbb 100644
--- a/src/mame/drivers/shangkid.c
+++ b/src/mame/drivers/shangkid.c
@@ -172,8 +172,8 @@ static DRIVER_INIT( shangkid )
shangkid_gfx_type = 1;
/* set up banking */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x8000, 0x8000);
- memory_configure_bank(2, 0, 2, memory_region(machine, "audio") + 0x0000, 0x10000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x8000, 0x8000);
+ memory_configure_bank(machine, 2, 0, 2, memory_region(machine, "audio") + 0x0000, 0x10000);
}
/***************************************************************************************/
diff --git a/src/mame/drivers/shootout.c b/src/mame/drivers/shootout.c
index 4080a20af27..e4a9375fa27 100644
--- a/src/mame/drivers/shootout.c
+++ b/src/mame/drivers/shootout.c
@@ -459,23 +459,24 @@ ROM_END
static DRIVER_INIT( shootout )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
int length = memory_region_length(machine, "main");
UINT8 *decrypt = auto_malloc(length - 0x8000);
UINT8 *rom = memory_region(machine, "main");
int A;
- memory_set_decrypted_region(0, 0x8000, 0xffff, decrypt);
+ memory_set_decrypted_region(space, 0x8000, 0xffff, decrypt);
for (A = 0x8000;A < length;A++)
decrypt[A-0x8000] = (rom[A] & 0x9f) | ((rom[A] & 0x40) >> 1) | ((rom[A] & 0x20) << 1);
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
- memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x8000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank_decrypted(machine, 1, 0, 16, decrypt + 0x8000, 0x4000);
}
static DRIVER_INIT( shootouj )
{
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
}
diff --git a/src/mame/drivers/simpl156.c b/src/mame/drivers/simpl156.c
index 28a092904dd..d51b38b20c8 100644
--- a/src/mame/drivers/simpl156.c
+++ b/src/mame/drivers/simpl156.c
@@ -1158,7 +1158,7 @@ static READ32_HANDLER( joemacr_speedup_r )
static DRIVER_INIT (joemacr)
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0201018, 0x020101b, 0, 0, joemacr_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0201018, 0x020101b, 0, 0, joemacr_speedup_r );
DRIVER_INIT_CALL(simpl156);
}
@@ -1170,7 +1170,7 @@ static READ32_HANDLER( chainrec_speedup_r )
static DRIVER_INIT (chainrec)
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0201018, 0x020101b, 0, 0, chainrec_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0201018, 0x020101b, 0, 0, chainrec_speedup_r );
DRIVER_INIT_CALL(simpl156);
simpl156_default_eeprom = chainrec_eeprom;
}
@@ -1183,14 +1183,14 @@ static READ32_HANDLER( prtytime_speedup_r )
static DRIVER_INIT (prtytime)
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0201ae0, 0x0201ae3, 0, 0, prtytime_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0201ae0, 0x0201ae3, 0, 0, prtytime_speedup_r );
DRIVER_INIT_CALL(simpl156);
simpl156_default_eeprom = prtytime_eeprom;
}
static DRIVER_INIT (gangonta)
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0201ae0, 0x0201ae3, 0, 0, prtytime_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0201ae0, 0x0201ae3, 0, 0, prtytime_speedup_r );
DRIVER_INIT_CALL(simpl156);
simpl156_default_eeprom = gangonta_eeprom;
}
@@ -1204,7 +1204,7 @@ static READ32_HANDLER( charlien_speedup_r )
static DRIVER_INIT (charlien)
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0201010, 0x0201013, 0, 0, charlien_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0201010, 0x0201013, 0, 0, charlien_speedup_r );
DRIVER_INIT_CALL(simpl156);
}
@@ -1216,7 +1216,7 @@ static READ32_HANDLER( osman_speedup_r )
static DRIVER_INIT (osman)
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0201010, 0x0201013, 0, 0, osman_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0201010, 0x0201013, 0, 0, osman_speedup_r );
DRIVER_INIT_CALL(simpl156);
simpl156_default_eeprom = osman_eeprom;
@@ -1224,7 +1224,7 @@ static DRIVER_INIT (osman)
static DRIVER_INIT (candance)
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0201010, 0x0201013, 0, 0, osman_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0201010, 0x0201013, 0, 0, osman_speedup_r );
DRIVER_INIT_CALL(simpl156);
simpl156_default_eeprom = candance_eeprom;
}
diff --git a/src/mame/drivers/skykid.c b/src/mame/drivers/skykid.c
index 821e134c13c..40d93d8a678 100644
--- a/src/mame/drivers/skykid.c
+++ b/src/mame/drivers/skykid.c
@@ -106,7 +106,7 @@ static WRITE8_HANDLER( skykid_irq_2_ctrl_w )
static MACHINE_START( skykid )
{
/* configure the banks */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x10000, 0x2000);
state_save_register_global(inputport_selected);
}
diff --git a/src/mame/drivers/slapfght.c b/src/mame/drivers/slapfght.c
index 37abb86c36a..3afcaf2ca4d 100644
--- a/src/mame/drivers/slapfght.c
+++ b/src/mame/drivers/slapfght.c
@@ -1769,12 +1769,12 @@ ROM_END
static DRIVER_INIT( tigerh )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, tigerh_mcu_r, tigerh_mcu_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe803, 0xe803, 0, 0, tigerh_mcu_r, tigerh_mcu_w );
}
static DRIVER_INIT( tigerhb )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, tigerhb_e803_r, tigerhb_e803_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe803, 0xe803, 0, 0, tigerhb_e803_r, tigerhb_e803_w );
}
@@ -1843,7 +1843,7 @@ static READ8_HANDLER( gtstarb1_dpram_r )
static void getstar_init( running_machine *machine )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, getstar_e803_r, getstar_e803_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe803, 0xe803, 0, 0, getstar_e803_r, getstar_e803_w );
}
static DRIVER_INIT( getstar )
@@ -1864,8 +1864,8 @@ static DRIVER_INIT( gtstarb1 )
getstar_init(machine);
/* specific handlers for this bootleg */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0, 0x0, 0, 0, gtstarb1_port_0_read );
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xc80f, 0, 0, gtstarb1_dpram_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0, 0x0, 0, 0, gtstarb1_port_0_read );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xc80f, 0, 0, gtstarb1_dpram_r );
}
static DRIVER_INIT( gtstarb2 )
@@ -1902,8 +1902,8 @@ static READ8_HANDLER( slapfigh_mcu_r )
static DRIVER_INIT( slapfigh )
{
slapfigh_prot_pos = 0;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, slapfigh_mcu_r );
-// memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, getstar_mcu_w );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe803, 0xe803, 0, 0, slapfigh_mcu_r );
+// memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe803, 0xe803, 0, 0, getstar_mcu_w );
}
diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c
index 0b57c0cf815..db3da2b9e04 100644
--- a/src/mame/drivers/snesb.c
+++ b/src/mame/drivers/snesb.c
@@ -584,7 +584,7 @@ static DRIVER_INIT(kinstb)
}
shared_ram=auto_malloc(0x100);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x781000, 0x7810ff, 0, 0, sharedram_r, sharedram_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x781000, 0x7810ff, 0, 0, sharedram_r, sharedram_w);
DRIVER_INIT_CALL(snes_hirom);
}
@@ -626,7 +626,7 @@ static DRIVER_INIT( ffight2b )
rom[0x7ffc]=0x54;
ffight2b_coins=0;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7eadce, 0x7eadce, 0, 0, ffight2b_coin_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7eadce, 0x7eadce, 0, 0, ffight2b_coin_r);
DRIVER_INIT_CALL(snes);
@@ -688,15 +688,15 @@ static DRIVER_INIT( sblast2b )
dst[0xfffd]=0x7a;
/* protection checks */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x75bd37, 0x75bd37, 0, 0, sb2b_75bd37_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6a6000, 0x6a6fff, 0, 0, sb2b_6a6xxx_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x75bd37, 0x75bd37, 0, 0, sb2b_75bd37_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6a6000, 0x6a6fff, 0, 0, sb2b_6a6xxx_r);
/* extra inputs */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x770071, 0x770071, 0, 0, sb2b_770071_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x770079, 0x770079, 0, 0, sb2b_770079_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x770071, 0x770071, 0, 0, sb2b_770071_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x770079, 0x770079, 0, 0, sb2b_770079_r);
/* handler to read boot code */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x007000, 0x007fff, 0, 0, sb2b_7xxx_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x007000, 0x007fff, 0, 0, sb2b_7xxx_r);
DRIVER_INIT_CALL(snes_hirom);
}
diff --git a/src/mame/drivers/snk.c b/src/mame/drivers/snk.c
index 45813adec39..69df98b8741 100644
--- a/src/mame/drivers/snk.c
+++ b/src/mame/drivers/snk.c
@@ -6158,7 +6158,7 @@ ROM_END
static DRIVER_INIT( countryc )
{
// replace coin counter with trackball select
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc300, 0xc300, 0, 0, countryc_trackball_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc300, 0xc300, 0, 0, countryc_trackball_w);
}
diff --git a/src/mame/drivers/snowbros.c b/src/mame/drivers/snowbros.c
index 16383a5e14e..e697a90d41d 100644
--- a/src/mame/drivers/snowbros.c
+++ b/src/mame/drivers/snowbros.c
@@ -2304,7 +2304,7 @@ static DRIVER_INIT( moremorp )
// hyperpac_ram[0xf000/2 + i] = PROTDATA[i];
/* explicit check in the code */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x200001, 0, 0, moremorp_0a_read );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, moremorp_0a_read );
}
@@ -2700,7 +2700,7 @@ static DRIVER_INIT(4in1boot)
memcpy(src,buffer,len);
free(buffer);
}
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x200001, 0, 0, _4in1_02_read );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, _4in1_02_read );
}
static DRIVER_INIT(snowbro3)
@@ -2727,7 +2727,7 @@ static READ16_HANDLER( _3in1_read )
static DRIVER_INIT( 3in1semi )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x200001, 0, 0, _3in1_read );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, _3in1_read );
}
static READ16_HANDLER( cookbib3_read )
@@ -2737,7 +2737,7 @@ static READ16_HANDLER( cookbib3_read )
static DRIVER_INIT( cookbib3 )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x200001, 0, 0, cookbib3_read );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x200001, 0, 0, cookbib3_read );
}
diff --git a/src/mame/drivers/ssf2md.c b/src/mame/drivers/ssf2md.c
index 08721310e15..fd414592a3b 100644
--- a/src/mame/drivers/ssf2md.c
+++ b/src/mame/drivers/ssf2md.c
@@ -18,12 +18,12 @@ static READ16_HANDLER( ssf2ghw_dsw_r )
static DRIVER_INIT( ssf2ghw )
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xA130F0, 0xA130FF, 0, 0, SMH_NOP); // custom banking is disabled (!)
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x5fffff, 0, 0, SMH_BANK5, SMH_UNMAP);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xA130F0, 0xA130FF, 0, 0, SMH_NOP); // custom banking is disabled (!)
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x5fffff, 0, 0, SMH_BANK5, SMH_UNMAP);
memory_set_bankptr( 5, memory_region( machine, "main" )+0x400000 );
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x770070, 0x770075, 0, 0, ssf2ghw_dsw_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x770070, 0x770075, 0, 0, ssf2ghw_dsw_r );
DRIVER_INIT_CALL(megadrij);
diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c
index ec74cc65465..3f50b3dec2b 100644
--- a/src/mame/drivers/starwars.c
+++ b/src/mame/drivers/starwars.c
@@ -503,7 +503,7 @@ static DRIVER_INIT( starwars )
starwars_mproc_init(machine);
/* initialize banking */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x6000, 0x10000 - 0x6000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x6000, 0x10000 - 0x6000);
memory_set_bank(1, 0);
}
@@ -524,19 +524,19 @@ static DRIVER_INIT( esb )
memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), esb_setdirect);
/* install read/write handlers for it */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x9fff, 0, 0, esb_slapstic_r, esb_slapstic_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x9fff, 0, 0, esb_slapstic_r, esb_slapstic_w);
/* install additional banking */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xffff, 0, 0, SMH_BANK2);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa000, 0xffff, 0, 0, SMH_BANK2);
/* prepare the matrix processor */
starwars_is_esb = 1;
starwars_mproc_init(machine);
/* initialize banking */
- memory_configure_bank(1, 0, 2, rom + 0x6000, 0x10000 - 0x6000);
+ memory_configure_bank(machine, 1, 0, 2, rom + 0x6000, 0x10000 - 0x6000);
memory_set_bank(1, 0);
- memory_configure_bank(2, 0, 2, rom + 0xa000, 0x1c000 - 0xa000);
+ memory_configure_bank(machine, 2, 0, 2, rom + 0xa000, 0x1c000 - 0xa000);
memory_set_bank(2, 0);
/* additional globals for state saving */
diff --git a/src/mame/drivers/strnskil.c b/src/mame/drivers/strnskil.c
index 573507be58d..8f34d03e755 100644
--- a/src/mame/drivers/strnskil.c
+++ b/src/mame/drivers/strnskil.c
@@ -517,16 +517,16 @@ static DRIVER_INIT( pettanp )
// AM_RANGE(0xd806, 0xd806) AM_READ(protection_r) /* protection data read (pettanp) */
/* Fujitsu MB8841 4-Bit MCU */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd806, 0xd806, 0, 0, pettanp_protection_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd80d, 0xd80d, 0, 0, protection_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd806, 0xd806, 0, 0, pettanp_protection_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd80d, 0xd80d, 0, 0, protection_w);
}
static DRIVER_INIT( banbam )
{
/* Fujitsu MB8841 4-Bit MCU */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd806, 0xd806, 0, 0, banbam_protection_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd80d, 0xd80d, 0, 0, protection_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd806, 0xd806, 0, 0, banbam_protection_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd80d, 0xd80d, 0, 0, protection_w);
}
GAME( 1984, strnskil, 0, strnskil, strnskil, 0, ROT0, "Sun Electronics", "Strength & Skill", 0 )
diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c
index 4c36d14ff06..a0c09b5dbaa 100644
--- a/src/mame/drivers/stv.c
+++ b/src/mame/drivers/stv.c
@@ -2331,10 +2331,10 @@ DRIVER_INIT ( stv )
cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
/* debug .. watch the command buffer rsgun, cottonbm etc. appear to use to communicate between cpus */
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc44, 0x60ffc47, 0, 0, w60ffc44_write );
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc48, 0x60ffc4b, 0, 0, w60ffc48_write );
- memory_install_write32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x60ffc44, 0x60ffc47, 0, 0, w60ffc44_write );
- memory_install_write32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x60ffc48, 0x60ffc4b, 0, 0, w60ffc48_write );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60ffc44, 0x60ffc47, 0, 0, w60ffc44_write );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60ffc48, 0x60ffc4b, 0, 0, w60ffc48_write );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x60ffc44, 0x60ffc47, 0, 0, w60ffc44_write );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x60ffc48, 0x60ffc4b, 0, 0, w60ffc48_write );
smpc_ram[0x23] = DectoBCD(systime.local_time.year /100);
smpc_ram[0x25] = DectoBCD(systime.local_time.year %100);
diff --git a/src/mame/drivers/stvinit.c b/src/mame/drivers/stvinit.c
index aa4e06ef990..0b562957510 100644
--- a/src/mame/drivers/stvinit.c
+++ b/src/mame/drivers/stvinit.c
@@ -354,8 +354,8 @@ DRIVER_INIT( groovef )
cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60060c2);
/* prevent game from hanging on startup -- todo: remove these hacks */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ca6cc, 0x60ca6cf, 0, 0, groovef_hack2_r );
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60fffcc, 0x60fffcf, 0, 0, groovef_hack1_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60ca6cc, 0x60ca6cf, 0, 0, groovef_hack2_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60fffcc, 0x60fffcf, 0, 0, groovef_hack1_r );
DRIVER_INIT_CALL(stv);
@@ -408,7 +408,7 @@ DRIVER_INIT( danchih )
cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602ae26);
/* prevent game from hanging on title screen -- todo: remove these hacks */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffcbc, 0x60ffcbf, 0, 0, danchih_hack_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60ffcbc, 0x60ffcbf, 0, 0, danchih_hack_r );
DRIVER_INIT_CALL(stv);
@@ -451,7 +451,7 @@ DRIVER_INIT( astrass )
cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605b9da);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x06000770, 0x06000773, 0, 0, astrass_hack_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x06000770, 0x06000773, 0, 0, astrass_hack_r );
install_astrass_protection(machine);
diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c
index ae35aad2748..b3a4f1e3921 100644
--- a/src/mame/drivers/suna8.c
+++ b/src/mame/drivers/suna8.c
@@ -74,14 +74,15 @@ static DRIVER_INIT( hardhead )
rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0) ^ 0x58;
}
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
}
/* Non encrypted bootleg */
static DRIVER_INIT( hardhedb )
{
- memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, "main") + 0x48000);
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "main") + 0x48000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
}
/***************************************************************************
@@ -92,12 +93,13 @@ static DRIVER_INIT( hardhedb )
static UINT8 *brickzn_decrypt(running_machine *machine)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *RAM = memory_region(machine, "main");
size_t size = memory_region_length(machine, "main");
UINT8 *decrypt = auto_malloc(size);
int i;
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
/* Opcodes and data */
for (i = 0; i < 0x50000; i++)
@@ -159,8 +161,8 @@ static DRIVER_INIT( brickzn )
decrypt[0x24b5] = 0x00; // HALT -> NOP
decrypt[0x2583] = 0x00; // HALT -> NOP
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
- memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank_decrypted(machine, 1, 0, 16, decrypt + 0x10000, 0x4000);
}
static DRIVER_INIT( brickzn3 )
@@ -190,8 +192,8 @@ static DRIVER_INIT( brickzn3 )
decrypt[0x2487] = 0x00; // HALT -> NOP
decrypt[0x256c] = 0x00; // HALT -> NOP
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
- memory_configure_bank_decrypted(1, 0, 16, decrypt + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank_decrypted(machine, 1, 0, 16, decrypt + 0x10000, 0x4000);
}
@@ -201,13 +203,14 @@ static DRIVER_INIT( brickzn3 )
static DRIVER_INIT( hardhea2 )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *RAM = memory_region(machine, "main");
size_t size = memory_region_length(machine, "main");
UINT8 *decrypt = auto_malloc(size);
UINT8 x;
int i;
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
/* Address lines scrambling */
memcpy(decrypt, RAM, size);
@@ -276,8 +279,8 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41;
}
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
- memory_configure_bank(2, 0, 2, auto_malloc(0x2000 * 2), 0x2000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 2, 0, 2, auto_malloc(0x2000 * 2), 0x2000);
}
@@ -287,13 +290,14 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
static DRIVER_INIT( starfigh )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *RAM = memory_region(machine, "main");
size_t size = memory_region_length(machine, "main");
UINT8 *decrypt = auto_malloc(size);
UINT8 x;
int i;
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
/* Address lines scrambling */
memcpy(decrypt, RAM, size);
@@ -344,7 +348,7 @@ static DRIVER_INIT( starfigh )
RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x45;
}
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
}
@@ -354,13 +358,14 @@ static DRIVER_INIT( starfigh )
static DRIVER_INIT( sparkman )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *RAM = memory_region(machine, "main");
size_t size = memory_region_length(machine, "main");
UINT8 *decrypt = auto_malloc(size);
UINT8 x;
int i;
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
/* Address lines scrambling */
memcpy(decrypt, RAM, size);
@@ -411,7 +416,7 @@ static DRIVER_INIT( sparkman )
RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x44;
}
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
}
/***************************************************************************
@@ -2317,7 +2322,7 @@ ROM_END
static DRIVER_INIT( suna8 )
{
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x4000);
}
/* Working Games */
diff --git a/src/mame/drivers/superchs.c b/src/mame/drivers/superchs.c
index 2e874ebd77b..532289ea663 100644
--- a/src/mame/drivers/superchs.c
+++ b/src/mame/drivers/superchs.c
@@ -501,8 +501,8 @@ static READ16_HANDLER( sub_cycle_r )
static DRIVER_INIT( superchs )
{
/* Speedup handlers */
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100000, 0x100003, 0, 0, main_cycle_r);
- memory_install_read16_handler(machine, 2, ADDRESS_SPACE_PROGRAM, 0x80000a, 0x80000b, 0, 0, sub_cycle_r);
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x100003, 0, 0, main_cycle_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x80000a, 0x80000b, 0, 0, sub_cycle_r);
}
GAME( 1992, superchs, 0, superchs, superchs, superchs, ROT0, "Taito America Corporation", "Super Chase - Criminal Termination (US)", 0 )
diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c
index 18ba1f3bd01..5e9b344c512 100644
--- a/src/mame/drivers/superqix.c
+++ b/src/mame/drivers/superqix.c
@@ -511,7 +511,7 @@ static void machine_init_common(void)
static MACHINE_START( superqix )
{
/* configure the banks */
- memory_configure_bank(1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
machine_init_common();
}
@@ -519,7 +519,7 @@ static MACHINE_START( superqix )
static MACHINE_START( pbillian )
{
/* configure the banks */
- memory_configure_bank(1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main") + 0x10000, 0x4000);
machine_init_common();
}
diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c
index dae9440134a..f0c25c822c9 100644
--- a/src/mame/drivers/suprnova.c
+++ b/src/mame/drivers/suprnova.c
@@ -1021,7 +1021,7 @@ static void init_skns(running_machine *machine)
cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6f8);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000028, 0x600002b, 0, 0, bios_skip_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000028, 0x600002b, 0, 0, bios_skip_r );
}
static void set_drc_pcflush(running_machine *machine, UINT32 addr)
@@ -1032,20 +1032,20 @@ static void set_drc_pcflush(running_machine *machine, UINT32 addr)
static DRIVER_INIT( galpani4 ) { skns_sprite_kludge(-5,-1); init_skns(machine); }
static DRIVER_INIT( galpanis ) { skns_sprite_kludge(-5,-1); init_skns(machine); }
-static DRIVER_INIT( cyvern ) { skns_sprite_kludge(+0,+2); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x604d3c8, 0x604d3cb, 0, 0, cyvern_speedup_r ); set_drc_pcflush(machine, 0x402ebd2); }
-static DRIVER_INIT( galpans2 ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60fb6bc, 0x60fb6bf, 0, 0, galpans2_speedup_r ); set_drc_pcflush(machine, 0x4049ae2); }
-static DRIVER_INIT( gutsn ) { skns_sprite_kludge(+0,+0); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600c780, 0x600c783, 0, 0, gutsn_speedup_r ); set_drc_pcflush(machine, 0x402206e); }
-static DRIVER_INIT( panicstr ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60f19e4, 0x60f19e7, 0, 0, panicstr_speedup_r ); set_drc_pcflush(machine, 0x404e68a); }
-static DRIVER_INIT( senknow ) { skns_sprite_kludge(+1,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60000dc, 0x60000df, 0, 0, senknow_speedup_r ); set_drc_pcflush(machine, 0x4017dce); }
-static DRIVER_INIT( puzzloop ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6081d38, 0x6081d3b, 0, 0, puzzloop_speedup_r ); set_drc_pcflush(machine, 0x401da14); }
-static DRIVER_INIT( puzloopj ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6086714, 0x6086717, 0, 0, puzloopj_speedup_r ); set_drc_pcflush(machine, 0x401dca0); }
-static DRIVER_INIT( puzloopu ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6085cec, 0x6085cef, 0, 0, puzloopu_speedup_r ); set_drc_pcflush(machine, 0x401dab0); }
-static DRIVER_INIT( jjparads ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000994, 0x6000997, 0, 0, jjparads_speedup_r ); set_drc_pcflush(machine, 0x4015e84); }
-static DRIVER_INIT( jjparad2 ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000984, 0x6000987, 0, 0, jjparad2_speedup_r ); set_drc_pcflush(machine, 0x401620a); }
-static DRIVER_INIT( ryouran ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000a14, 0x6000a17, 0, 0, ryouran_speedup_r ); set_drc_pcflush(machine, 0x40182ce); }
-static DRIVER_INIT( teljan ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002fb4, 0x6002fb7, 0, 0, teljan_speedup_r ); set_drc_pcflush(machine, 0x401ba32); }
-static DRIVER_INIT( sengekis ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60b74bc, 0x60b74bf, 0, 0, sengekis_speedup_r ); set_drc_pcflush(machine, 0x60006ec); }
-static DRIVER_INIT( sengekij ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60b7380, 0x60b7383, 0, 0, sengekij_speedup_r ); set_drc_pcflush(machine, 0x60006ec); }
+static DRIVER_INIT( cyvern ) { skns_sprite_kludge(+0,+2); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x604d3c8, 0x604d3cb, 0, 0, cyvern_speedup_r ); set_drc_pcflush(machine, 0x402ebd2); }
+static DRIVER_INIT( galpans2 ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60fb6bc, 0x60fb6bf, 0, 0, galpans2_speedup_r ); set_drc_pcflush(machine, 0x4049ae2); }
+static DRIVER_INIT( gutsn ) { skns_sprite_kludge(+0,+0); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x600c780, 0x600c783, 0, 0, gutsn_speedup_r ); set_drc_pcflush(machine, 0x402206e); }
+static DRIVER_INIT( panicstr ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60f19e4, 0x60f19e7, 0, 0, panicstr_speedup_r ); set_drc_pcflush(machine, 0x404e68a); }
+static DRIVER_INIT( senknow ) { skns_sprite_kludge(+1,+1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60000dc, 0x60000df, 0, 0, senknow_speedup_r ); set_drc_pcflush(machine, 0x4017dce); }
+static DRIVER_INIT( puzzloop ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6081d38, 0x6081d3b, 0, 0, puzzloop_speedup_r ); set_drc_pcflush(machine, 0x401da14); }
+static DRIVER_INIT( puzloopj ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6086714, 0x6086717, 0, 0, puzloopj_speedup_r ); set_drc_pcflush(machine, 0x401dca0); }
+static DRIVER_INIT( puzloopu ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6085cec, 0x6085cef, 0, 0, puzloopu_speedup_r ); set_drc_pcflush(machine, 0x401dab0); }
+static DRIVER_INIT( jjparads ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000994, 0x6000997, 0, 0, jjparads_speedup_r ); set_drc_pcflush(machine, 0x4015e84); }
+static DRIVER_INIT( jjparad2 ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000984, 0x6000987, 0, 0, jjparad2_speedup_r ); set_drc_pcflush(machine, 0x401620a); }
+static DRIVER_INIT( ryouran ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000a14, 0x6000a17, 0, 0, ryouran_speedup_r ); set_drc_pcflush(machine, 0x40182ce); }
+static DRIVER_INIT( teljan ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002fb4, 0x6002fb7, 0, 0, teljan_speedup_r ); set_drc_pcflush(machine, 0x401ba32); }
+static DRIVER_INIT( sengekis ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60b74bc, 0x60b74bf, 0, 0, sengekis_speedup_r ); set_drc_pcflush(machine, 0x60006ec); }
+static DRIVER_INIT( sengekij ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60b7380, 0x60b7383, 0, 0, sengekij_speedup_r ); set_drc_pcflush(machine, 0x60006ec); }
static DRIVER_INIT( sarukani ) { skns_sprite_kludge(-1,-1); init_skns(machine); set_drc_pcflush(machine, 0x4013b42); } // Speedup is in skns_io_w()
diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c
index e0faa883307..3b08c5c49cd 100644
--- a/src/mame/drivers/system1.c
+++ b/src/mame/drivers/system1.c
@@ -39,13 +39,13 @@ static MACHINE_RESET( system1 )
static MACHINE_RESET( system1_banked )
{
MACHINE_RESET_CALL(system1);
- memory_configure_bank(1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
}
static MACHINE_RESET( wbml )
{
system1_define_background_memory(system1_BACKGROUND_MEMORY_BANKED);
- memory_configure_bank(1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "main") + 0x10000, 0x4000);
}
// Noboranka: there seems to be some protection? involving reads / writes to ports in the 2x region
@@ -3995,11 +3995,11 @@ static DRIVER_INIT( dakkochn )
{
mc8123_decrypt_rom(machine, "main", "user1", 1, 4);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x00, 0x00, 0, 0, dakkochn_port_00_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x03, 0x03, 0, 0, dakkochn_port_03_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x04, 0x04, 0, 0, dakkochn_port_04_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0, dakkochn_port_00_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x03, 0x03, 0, 0, dakkochn_port_03_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x04, 0x04, 0, 0, dakkochn_port_04_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x15, 0x15, 0, 0, dakkochn_port_15_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x15, 0x15, 0, 0, dakkochn_port_15_w);
}
@@ -4073,14 +4073,16 @@ static DRIVER_INIT( noboranb )
static DRIVER_INIT( bootleg )
{
- memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, "main") + 0x10000);
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "main") + 0x10000);
}
static DRIVER_INIT( bootlegb )
{
- memory_set_decrypted_region(0, 0x0000, 0x7fff, memory_region(machine, "main") + 0x20000);
- memory_configure_bank_decrypted(1, 0, 4, memory_region(machine, "main") + 0x30000, 0x4000);
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, memory_region(machine, "main") + 0x20000);
+ memory_configure_bank_decrypted(machine, 1, 0, 4, memory_region(machine, "main") + 0x30000, 0x4000);
}
/*************************************
diff --git a/src/mame/drivers/system18.c b/src/mame/drivers/system18.c
index 3a20ec6513f..274a73f01e7 100644
--- a/src/mame/drivers/system18.c
+++ b/src/mame/drivers/system18.c
@@ -753,7 +753,7 @@ static DRIVER_INIT( shdancbl )
mem[i] ^= 0xFF;
MACHINE_RESET_CALL(sys16_onetime);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xffc000, 0xffc001, 0, 0, shdancbl_skip_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xffc000, 0xffc001, 0, 0, shdancbl_skip_r );
sys18_splittab_fg_x=&sys16_textram[0x0f80/2];
sys18_splittab_bg_x=&sys16_textram[0x0fc0/2];
diff --git a/src/mame/drivers/taito_b.c b/src/mame/drivers/taito_b.c
index 2399aa74f08..b81523baa23 100644
--- a/src/mame/drivers/taito_b.c
+++ b/src/mame/drivers/taito_b.c
@@ -3773,7 +3773,7 @@ ROM_END
static DRIVER_INIT( taito_b )
{
- memory_configure_bank(1, 0, 4, memory_region(machine, "audio") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "audio") + 0x10000, 0x4000);
}
GAME( 1989, masterw, 0, masterw, masterw, taito_b, ROT270, "Taito Corporation Japan", "Master of Weapon (World)", GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/taito_f3.c b/src/mame/drivers/taito_f3.c
index e2273cce5ea..6b0bee63e18 100644
--- a/src/mame/drivers/taito_f3.c
+++ b/src/mame/drivers/taito_f3.c
@@ -3659,8 +3659,8 @@ static DRIVER_INIT( bubsympb )
}
}
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_r );
- memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_w );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_r );
+ memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4a001c, 0x4a001f, 0, 0, bubsympb_oki_w );
}
diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c
index 9c5d77066df..e26ce4f1c8b 100644
--- a/src/mame/drivers/taito_l.c
+++ b/src/mame/drivers/taito_l.c
@@ -2939,7 +2939,7 @@ static DRIVER_INIT( evilston )
{
UINT8 *ROM = memory_region(machine, "audio");
ROM[0x72]=0x45; /* reti -> retn ('dead' loop @ $1104 )*/
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa7fe, 0xa7fe, 0, 0, evilston_snd_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa7fe, 0xa7fe, 0, 0, evilston_snd_w);
}
diff --git a/src/mame/drivers/taito_x.c b/src/mame/drivers/taito_x.c
index ae94f6d94c5..ddb614275c9 100644
--- a/src/mame/drivers/taito_x.c
+++ b/src/mame/drivers/taito_x.c
@@ -1382,7 +1382,7 @@ ROM_END
static DRIVER_INIT( kyustrkr )
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x900000, 0x90000f, 0, 0, kyustrkr_input_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x900000, 0x90000f, 0, 0, kyustrkr_input_w);
}
diff --git a/src/mame/drivers/taitosj.c b/src/mame/drivers/taitosj.c
index ff859e88a46..34d228362ea 100644
--- a/src/mame/drivers/taitosj.c
+++ b/src/mame/drivers/taitosj.c
@@ -2731,7 +2731,7 @@ static DRIVER_INIT( spacecr )
init_common(machine);
/* install protection handler */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd48b, 0xd48b, 0, 0, spacecr_prot_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd48b, 0xd48b, 0, 0, spacecr_prot_r);
}
static DRIVER_INIT( alpine )
@@ -2739,8 +2739,8 @@ static DRIVER_INIT( alpine )
init_common(machine);
/* install protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd40b, 0xd40b, 0, 0, alpine_port_2_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd50f, 0xd50f, 0, 0, alpine_protection_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd40b, 0xd40b, 0, 0, alpine_port_2_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd50f, 0xd50f, 0, 0, alpine_protection_w);
}
static DRIVER_INIT( alpinea )
@@ -2748,8 +2748,8 @@ static DRIVER_INIT( alpinea )
init_common(machine);
/* install protection handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd40b, 0xd40b, 0, 0, alpine_port_2_r);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd50e, 0xd50e, 0, 0, alpinea_bankswitch_w);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd40b, 0xd40b, 0, 0, alpine_port_2_r);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd50e, 0xd50e, 0, 0, alpinea_bankswitch_w);
}
static DRIVER_INIT( junglhbr )
@@ -2757,7 +2757,7 @@ static DRIVER_INIT( junglhbr )
init_common(machine);
/* inverter on bits 0 and 1 */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9000, 0xbfff, 0, 0, junglhbr_characterram_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9000, 0xbfff, 0, 0, junglhbr_characterram_w);
}
GAME( 1981, spaceskr, 0, nomcu, spaceskr, taitosj, ROT0, "Taito Corporation", "Space Seeker", GAME_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/tcl.c b/src/mame/drivers/tcl.c
index 211bdfe21a1..5c333781c5b 100644
--- a/src/mame/drivers/tcl.c
+++ b/src/mame/drivers/tcl.c
@@ -175,6 +175,7 @@ static DRIVER_INIT(tcl)
{
/* only the first part is decrypted (and verified)*/
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *dest = memory_region(machine, "main");
int len = memory_region_length(machine, "main");
UINT8 *src = malloc_or_die(len);
@@ -200,7 +201,7 @@ static DRIVER_INIT(tcl)
}
free(src);
- memory_set_decrypted_region(0, 0x0000, 0x7fff, dest+0x10000);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, dest+0x10000);
}
GAME( 1995, tcl, 0, tcl, tcl, tcl, ROT0, "Uniwang", "Taiwan Chess Legend", GAME_NOT_WORKING )
diff --git a/src/mame/drivers/terracre.c b/src/mame/drivers/terracre.c
index 9d75e7a29d3..ac05d84b970 100644
--- a/src/mame/drivers/terracre.c
+++ b/src/mame/drivers/terracre.c
@@ -1019,7 +1019,7 @@ static DRIVER_INIT( amatelas )
static DRIVER_INIT( horekid )
{
mpProtData = mHoreKidProtData;
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x44004, 0x44005, 0, 0, horekid_IN2_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x44004, 0x44005, 0, 0, horekid_IN2_r);
}
/* YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR, COMPANY, FULLNAME, FLAGS */
diff --git a/src/mame/drivers/thepit.c b/src/mame/drivers/thepit.c
index d9030661c8c..8ff631329f8 100644
--- a/src/mame/drivers/thepit.c
+++ b/src/mame/drivers/thepit.c
@@ -1045,7 +1045,7 @@ static READ8_HANDLER( rtriv_question_r )
static DRIVER_INIT( rtriv )
{
// Set-up the weirdest questions read ever done
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4fff, 0, 0, rtriv_question_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4fff, 0, 0, rtriv_question_r);
}
diff --git a/src/mame/drivers/tigeroad.c b/src/mame/drivers/tigeroad.c
index 374fe8a7f56..54146e90269 100644
--- a/src/mame/drivers/tigeroad.c
+++ b/src/mame/drivers/tigeroad.c
@@ -771,12 +771,12 @@ ROM_END
static DRIVER_INIT( tigeroad )
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfe4002, 0xfe4003, 0, 0, tigeroad_soundcmd_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe4002, 0xfe4003, 0, 0, tigeroad_soundcmd_w);
}
static DRIVER_INIT( f1dream )
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfe4002, 0xfe4003, 0, 0, f1dream_control_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe4002, 0xfe4003, 0, 0, f1dream_control_w);
}
diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c
index f474fd6f74e..4908f8bb4da 100644
--- a/src/mame/drivers/tmaster.c
+++ b/src/mame/drivers/tmaster.c
@@ -1350,11 +1350,11 @@ static DRIVER_INIT( galgames )
{
UINT8 *ROM = memory_region(machine, "main");
// configure memory banks
- memory_configure_bank(1, 0, 2, ROM+0x1c0000, 0x40000);
- memory_configure_bank(3, 0, 2, ROM+0x1c0000, 0x40000);
+ memory_configure_bank(machine, 1, 0, 2, ROM+0x1c0000, 0x40000);
+ memory_configure_bank(machine, 3, 0, 2, ROM+0x1c0000, 0x40000);
- memory_configure_bank(2, 0, 1, ROM+0x200000, 0x40000);
- memory_configure_bank(4, 0, 1, ROM+0x200000, 0x40000);
+ memory_configure_bank(machine, 2, 0, 1, ROM+0x200000, 0x40000);
+ memory_configure_bank(machine, 4, 0, 1, ROM+0x200000, 0x40000);
}
GAME( 1996, tm, 0, tm, tm, 0, ROT0, "Midway", "Touchmaster (v3.00 Euro)", 0 )
diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c
index 8b1e90ceaf0..45acb935b1f 100644
--- a/src/mame/drivers/toaplan2.c
+++ b/src/mame/drivers/toaplan2.c
@@ -337,7 +337,7 @@ static MACHINE_RESET( bgaregga )
// Set Z80 bank switch - default bank is 2
current_bank = 4;
- memory_configure_bank(1, 0, 16, Z80, 0x4000);
+ memory_configure_bank(machine, 1, 0, 16, Z80, 0x4000);
memory_set_bank(1, 4);
if (memory_region(machine, "oki1") != NULL)
@@ -386,7 +386,7 @@ static DRIVER_INIT( fixeight )
#if USE_V25
#else
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x28f002, 0x28fbff, 0, 0, SMH_BANK2, SMH_BANK2 );
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x28f002, 0x28fbff, 0, 0, SMH_BANK2, SMH_BANK2 );
memory_set_bankptr(2, fixeight_sec_cpu_mem);
#endif
@@ -913,11 +913,11 @@ static WRITE16_HANDLER( fixeight_sec_cpu_w )
/* game keeping service mode. It writes/reads the settings to/from */
/* these shared RAM locations. The secondary CPU reads/writes them */
/* from/to nvram to store the settings (a 93C45 EEPROM) */
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x28f002, 0x28fbff, 0, 0, SMH_BANK2, SMH_BANK2);
+ memory_install_readwrite16_handler(space, 0x28f002, 0x28fbff, 0, 0, SMH_BANK2, SMH_BANK2);
memory_set_bankptr(2, fixeight_sec_cpu_mem);
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x28f004, 0x28f005, 0, 0, input_port_read_handler16(space->machine->portconfig, "DSWA"), SMH_NOP); /* Dip Switch A - Wrong !!! */
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x28f006, 0x28f007, 0, 0, input_port_read_handler16(space->machine->portconfig, "DSWB"), SMH_NOP); /* Dip Switch B - Wrong !!! */
- memory_install_readwrite16_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x28f008, 0x28f009, 0, 0, input_port_read_handler16(space->machine->portconfig, "JMPR"), SMH_NOP); /* Territory Jumper block - Wrong !!! */
+ memory_install_readwrite16_handler(space, 0x28f004, 0x28f005, 0, 0, input_port_read_handler16(space->machine->portconfig, "DSWA"), SMH_NOP); /* Dip Switch A - Wrong !!! */
+ memory_install_readwrite16_handler(space, 0x28f006, 0x28f007, 0, 0, input_port_read_handler16(space->machine->portconfig, "DSWB"), SMH_NOP); /* Dip Switch B - Wrong !!! */
+ memory_install_readwrite16_handler(space, 0x28f008, 0x28f009, 0, 0, input_port_read_handler16(space->machine->portconfig, "JMPR"), SMH_NOP); /* Territory Jumper block - Wrong !!! */
mcu_data = data;
}
diff --git a/src/mame/drivers/toki.c b/src/mame/drivers/toki.c
index d07872a6ddf..21611e57db2 100644
--- a/src/mame/drivers/toki.c
+++ b/src/mame/drivers/toki.c
@@ -809,13 +809,14 @@ static DRIVER_INIT(jujub)
/* Decrypt data for z80 program */
{
+ const address_space *space = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypt = auto_malloc(0x20000);
UINT8 *rom = memory_region(machine, "audio");
int i;
memcpy(decrypt,rom,0x20000);
- memory_set_decrypted_region(1, 0x0000, 0x1fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x1fff, decrypt);
for (i = 0;i < 0x2000;i++)
{
diff --git a/src/mame/drivers/topshoot.c b/src/mame/drivers/topshoot.c
index 0f1258f9489..c252d440149 100644
--- a/src/mame/drivers/topshoot.c
+++ b/src/mame/drivers/topshoot.c
@@ -302,7 +302,7 @@ static READ16_HANDLER( vdp_fake_r )
static DRIVER_INIT(topshoot)
{
/* hack -- fix vdp emulation instead */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xC00004, 0xC00005, 0, 0, vdp_fake_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xC00004, 0xC00005, 0, 0, vdp_fake_r);
memory_set_bankptr(3, memory_region(machine, "main") );
memory_set_bankptr(4, genesis_68k_ram );
diff --git a/src/mame/drivers/trackfld.c b/src/mame/drivers/trackfld.c
index 0dacd1076e4..17ec5723134 100644
--- a/src/mame/drivers/trackfld.c
+++ b/src/mame/drivers/trackfld.c
@@ -1239,6 +1239,7 @@ static DRIVER_INIT( trackfld )
static DRIVER_INIT( atlantol )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt;
int A;
@@ -1250,9 +1251,9 @@ static DRIVER_INIT( atlantol )
for (A = 0;A < 0x6000;A++)
decrypt[A] = rom[A];
- memory_set_decrypted_region(0, 0x0000, 0xffff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypt);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1000, 0, 0, SMH_NOP );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000, 0x1000, 0, 0, SMH_NOP );
}
static DRIVER_INIT( mastkin )
diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c
index 1d3231fd5b9..c40530250de 100644
--- a/src/mame/drivers/tumbleb.c
+++ b/src/mame/drivers/tumbleb.c
@@ -3296,7 +3296,7 @@ static DRIVER_INIT( tumbleb2 )
tumblepb_patch_code(machine, 0x000132);
#endif
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100000, 0x100001, 0, 0, tumbleb2_soundmcu_w );
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x100001, 0, 0, tumbleb2_soundmcu_w );
}
@@ -3337,7 +3337,7 @@ static READ16_HANDLER( bcstory_1a0_read )
static DRIVER_INIT ( bcstory )
{
tumblepb_gfx1_rearrange(machine);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180008, 0x180009, 0, 0, bcstory_1a0_read ); // io should be here??
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180008, 0x180009, 0, 0, bcstory_1a0_read ); // io should be here??
}
@@ -3578,7 +3578,7 @@ static DRIVER_INIT( htchctch )
HCROM[0x1e228/2] = 0x4e75;
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x140000, 0x1407ff, 0, 0, SMH_NOP ); // kill palette writes as the interrupt code we don't have controls them
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x140000, 0x1407ff, 0, 0, SMH_NOP ); // kill palette writes as the interrupt code we don't have controls them
{
@@ -3644,10 +3644,10 @@ static DRIVER_INIT( chokchok )
DRIVER_INIT_CALL(htchctch);
/* different palette format, closer to tumblep -- is this controlled by a register? the palette was right with the hatch catch trojan */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x140000, 0x140fff, 0, 0, paletteram16_xxxxBBBBGGGGRRRR_word_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x140000, 0x140fff, 0, 0, paletteram16_xxxxBBBBGGGGRRRR_word_w);
/* slightly different banking */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100002, 0x100003, 0, 0, chokchok_tilebank_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100002, 0x100003, 0, 0, chokchok_tilebank_w);
}
static DRIVER_INIT( wlstar )
@@ -3655,7 +3655,7 @@ static DRIVER_INIT( wlstar )
DRIVER_INIT_CALL(htchctch);
/* slightly different banking */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100002, 0x100003, 0, 0, wlstar_tilebank_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100002, 0x100003, 0, 0, wlstar_tilebank_w);
}
static DRIVER_INIT ( dquizgo )
diff --git a/src/mame/drivers/tutankhm.c b/src/mame/drivers/tutankhm.c
index 92ea618cf82..d86ff9c8c1c 100644
--- a/src/mame/drivers/tutankhm.c
+++ b/src/mame/drivers/tutankhm.c
@@ -56,7 +56,7 @@ static WRITE8_HANDLER( irq_enable_w )
static MACHINE_START( tutankhm )
{
- memory_configure_bank(1, 0, 16, memory_region(machine, "main") + 0x10000, 0x1000);
+ memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "main") + 0x10000, 0x1000);
state_save_register_global(irq_toggle);
state_save_register_global(irq_enable);
}
diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c
index 8e9dac951c2..432f9c88702 100644
--- a/src/mame/drivers/upscope.c
+++ b/src/mame/drivers/upscope.c
@@ -88,11 +88,11 @@ static void upscope_cia_0_porta_w(UINT8 data)
/* swap the write handlers between ROM and bank 1 based on the bit */
if ((data & 1) == 0)
/* overlay disabled, map RAM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_BANK1);
else
/* overlay enabled, map Amiga system ROM on 0x000000 */
- memory_install_write16_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
+ memory_install_write16_handler(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x07ffff, 0, 0, SMH_UNMAP);
}
@@ -382,8 +382,8 @@ static DRIVER_INIT( upscope )
generic_nvram = auto_malloc(generic_nvram_size);
/* set up memory */
- memory_configure_bank(1, 0, 1, amiga_chip_ram, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "user1"), 0);
+ memory_configure_bank(machine, 1, 0, 1, amiga_chip_ram, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user1"), 0);
}
diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c
index eed56aa4812..252adc66319 100644
--- a/src/mame/drivers/vamphalf.c
+++ b/src/mame/drivers/vamphalf.c
@@ -1278,7 +1278,7 @@ static READ16_HANDLER( dquizgo2_speedup_r )
static DRIVER_INIT( vamphalf )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0004a6d0, 0x0004a6d3, 0, 0, vamphalf_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0004a6d0, 0x0004a6d3, 0, 0, vamphalf_speedup_r );
palshift = 0;
flip_bit = 0x80;
@@ -1286,7 +1286,7 @@ static DRIVER_INIT( vamphalf )
static DRIVER_INIT( misncrft )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00072eb4, 0x00072eb7, 0, 0, misncrft_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00072eb4, 0x00072eb7, 0, 0, misncrft_speedup_r );
palshift = 0;
flip_bit = 1;
@@ -1294,7 +1294,7 @@ static DRIVER_INIT( misncrft )
static DRIVER_INIT( coolmini )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000d2e80, 0x000d2e83, 0, 0, coolmini_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000d2e80, 0x000d2e83, 0, 0, coolmini_speedup_r );
palshift = 0;
flip_bit = 1;
@@ -1302,7 +1302,7 @@ static DRIVER_INIT( coolmini )
static DRIVER_INIT( suplup )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0011605c, 0x0011605f, 0, 0, suplup_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0011605c, 0x0011605f, 0, 0, suplup_speedup_r );
palshift = 8;
/* no flipscreen */
@@ -1310,7 +1310,7 @@ static DRIVER_INIT( suplup )
static DRIVER_INIT( luplup )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00115e84, 0x00115e87, 0, 0, luplup_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00115e84, 0x00115e87, 0, 0, luplup_speedup_r );
palshift = 8;
/* no flipscreen */
@@ -1318,7 +1318,7 @@ static DRIVER_INIT( luplup )
static DRIVER_INIT( luplup29 )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00113f08, 0x00113f0b, 0, 0, luplup29_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00113f08, 0x00113f0b, 0, 0, luplup29_speedup_r );
palshift = 8;
/* no flipscreen */
@@ -1326,7 +1326,7 @@ static DRIVER_INIT( luplup29 )
static DRIVER_INIT( puzlbang )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00113ecc, 0x00113ecf, 0, 0, puzlbang_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00113ecc, 0x00113ecf, 0, 0, puzlbang_speedup_r );
palshift = 8;
/* no flipscreen */
@@ -1334,7 +1334,7 @@ static DRIVER_INIT( puzlbang )
static DRIVER_INIT( wyvernwg )
{
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00b56fc, 0x00b56ff, 0, 0, wyvernwg_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00b56fc, 0x00b56ff, 0, 0, wyvernwg_speedup_r );
palshift = 0;
flip_bit = 1;
@@ -1346,7 +1346,7 @@ static DRIVER_INIT( wyvernwg )
static DRIVER_INIT( finalgdr )
{
finalgdr_backupram = auto_malloc(0x80*0x100);
- memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x005e874, 0x005e877, 0, 0, finalgdr_speedup_r );
+ memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x005e874, 0x005e877, 0, 0, finalgdr_speedup_r );
palshift = 0;
flip_bit = 1; //?
@@ -1357,7 +1357,7 @@ static DRIVER_INIT( finalgdr )
static DRIVER_INIT( dquizgo2 )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00cde70, 0x00cde73, 0, 0, dquizgo2_speedup_r );
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00cde70, 0x00cde73, 0, 0, dquizgo2_speedup_r );
palshift = 0;
flip_bit = 1;
diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c
index 7d476341f85..38e204a3961 100644
--- a/src/mame/drivers/vegas.c
+++ b/src/mame/drivers/vegas.c
@@ -1568,7 +1568,7 @@ static void remap_dynamic_addresses(running_machine *machine)
/* unmap everything we know about */
for (addr = 0; addr < dynamic_count; addr++)
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, dynamic[addr].start, dynamic[addr].end, 0, 0, SMH_UNMAP, SMH_UNMAP);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dynamic[addr].start, dynamic[addr].end, 0, 0, SMH_UNMAP, SMH_UNMAP);
/* the build the list of stuff */
dynamic_count = 0;
@@ -1688,9 +1688,9 @@ static void remap_dynamic_addresses(running_machine *machine)
{
if (LOG_DYNAMIC) logerror(" installing: %08X-%08X %s,%s\n", dynamic[addr].start, dynamic[addr].end, dynamic[addr].rdname, dynamic[addr].wrname);
if (dynamic[addr].mread != NULL || dynamic[addr].mwrite != NULL)
- _memory_install_handler32(machine, 0, ADDRESS_SPACE_PROGRAM, dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].mread, dynamic[addr].mwrite, dynamic[addr].rdname, dynamic[addr].wrname);
+ _memory_install_handler32(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].mread, dynamic[addr].mwrite, dynamic[addr].rdname, dynamic[addr].wrname);
if (dynamic[addr].dread != NULL || dynamic[addr].dwrite != NULL)
- _memory_install_device_handler32(dynamic[addr].device, 0, ADDRESS_SPACE_PROGRAM, dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].dread, dynamic[addr].dwrite, dynamic[addr].rdname, dynamic[addr].wrname);
+ _memory_install_device_handler32(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dynamic[addr].device, dynamic[addr].start, dynamic[addr].end, 0, 0, dynamic[addr].dread, dynamic[addr].dwrite, dynamic[addr].rdname, dynamic[addr].wrname);
}
if (LOG_DYNAMIC)
diff --git a/src/mame/drivers/vendetta.c b/src/mame/drivers/vendetta.c
index ddf15cf54e5..8999361adfb 100644
--- a/src/mame/drivers/vendetta.c
+++ b/src/mame/drivers/vendetta.c
@@ -208,14 +208,14 @@ static void vendetta_video_banking( running_machine *machine, int select )
{
if ( select & 1 )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, SMH_BANK4, paletteram_xBBBBBGGGGGRRRRR_be_w );
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K053247_r, K053247_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, SMH_BANK4, paletteram_xBBBBBGGGGGRRRRR_be_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K053247_r, K053247_w );
memory_set_bankptr(4, paletteram);
}
else
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, vendetta_K052109_r, vendetta_K052109_w );
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K052109_r, K052109_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), video_banking_base + 0x2000, video_banking_base + 0x2fff, 0, 0, vendetta_K052109_r, vendetta_K052109_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), video_banking_base + 0x0000, video_banking_base + 0x0fff, 0, 0, K052109_r, K052109_w );
}
}
diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c
index e7031624aef..dab901b19cb 100644
--- a/src/mame/drivers/viper.c
+++ b/src/mame/drivers/viper.c
@@ -654,8 +654,8 @@ static DRIVER_INIT(vipercf)
DRIVER_INIT_CALL(viper);
- memory_install_readwrite64_device_handler( ide, 0, ADDRESS_SPACE_PROGRAM, 0xff000000, 0xff000fff, 0, 0, cf_card_data_r, cf_card_data_w );
- memory_install_readwrite64_device_handler( ide, 0, ADDRESS_SPACE_PROGRAM, 0xff200000, 0xff200fff, 0, 0, cf_card_r, cf_card_w );
+ memory_install_readwrite64_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0xff000000, 0xff000fff, 0, 0, cf_card_data_r, cf_card_data_w );
+ memory_install_readwrite64_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0xff200000, 0xff200fff, 0, 0, cf_card_r, cf_card_w );
}
diff --git a/src/mame/drivers/wardner.c b/src/mame/drivers/wardner.c
index 84bbf21b8ee..90a7823bfcc 100644
--- a/src/mame/drivers/wardner.c
+++ b/src/mame/drivers/wardner.c
@@ -143,7 +143,7 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw )
if (data)
{
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, SMH_BANK1);
+ memory_install_read8_handler(space, 0x8000, 0xffff, 0, 0, SMH_BANK1);
switch (data)
{
case 2: bankaddress = 0x10000; break;
@@ -159,10 +159,10 @@ static WRITE8_HANDLER( wardner_ramrom_bank_sw )
}
else
{
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8fff, 0, 0, wardner_sprite_r);
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xadff, 0, 0, SMH_BANK4);
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xae00, 0xafff, 0, 0, SMH_BANK2);
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc7ff, 0, 0, SMH_BANK3);
+ memory_install_read8_handler(space, 0x8000, 0x8fff, 0, 0, wardner_sprite_r);
+ memory_install_read8_handler(space, 0xa000, 0xadff, 0, 0, SMH_BANK4);
+ memory_install_read8_handler(space, 0xae00, 0xafff, 0, 0, SMH_BANK2);
+ memory_install_read8_handler(space, 0xc000, 0xc7ff, 0, 0, SMH_BANK3);
memory_set_bankptr(1, &RAM[0x0000]);
memory_set_bankptr(2, rambase_ae00);
memory_set_bankptr(3, rambase_c000);
diff --git a/src/mame/drivers/williams.c b/src/mame/drivers/williams.c
index efb48ea343b..9d193d85438 100644
--- a/src/mame/drivers/williams.c
+++ b/src/mame/drivers/williams.c
@@ -521,13 +521,13 @@ ADDRESS_MAP_END
void defender_install_io_space(running_machine *machine)
{
/* this routine dynamically installs the memory mapped above from c000-cfff */
- memory_install_write8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc00f, 0, 0x03e0, SMH_BANK4);
- memory_install_write8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xc010, 0xc01f, 0, 0x03e0, defender_video_control_w);
- memory_install_write8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xc3ff, 0xc3ff, 0, 0, williams_watchdog_reset_w);
- memory_install_readwrite8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xc400, 0xc4ff, 0, 0x0300, SMH_BANK3, williams_cmos_w);
- memory_install_read8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xcbff, 0, 0x03e0, williams_video_counter_r);
- memory_install_readwrite8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xcc00, 0xcc03, 0, 0x03e0, pia_1_r, pia_1_w);
- memory_install_readwrite8_handler (machine, 0, ADDRESS_SPACE_PROGRAM, 0xcc04, 0xcc07, 0, 0x03e0, pia_0_r, pia_0_w);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xc00f, 0, 0x03e0, SMH_BANK4);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc010, 0xc01f, 0, 0x03e0, defender_video_control_w);
+ memory_install_write8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc3ff, 0xc3ff, 0, 0, williams_watchdog_reset_w);
+ memory_install_readwrite8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc400, 0xc4ff, 0, 0x0300, SMH_BANK3, williams_cmos_w);
+ memory_install_read8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xcbff, 0, 0x03e0, williams_video_counter_r);
+ memory_install_readwrite8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc00, 0xcc03, 0, 0x03e0, pia_1_r, pia_1_w);
+ memory_install_readwrite8_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc04, 0xcc07, 0, 0x03e0, pia_0_r, pia_0_w);
memory_set_bankptr(3, generic_nvram);
memory_set_bankptr(4, paletteram);
}
@@ -2638,7 +2638,7 @@ static DRIVER_INIT( mayday )
CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf);
/* install a handler to catch protection checks */
- mayday_protection = memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa190, 0xa191, 0, 0, mayday_protection_r);
+ mayday_protection = memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa190, 0xa191, 0, 0, mayday_protection_r);
}
@@ -2676,7 +2676,7 @@ static DRIVER_INIT( bubbles )
CONFIGURE_PIAS(williams_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf);
/* bubbles has a full 8-bit-wide CMOS */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xcc00, 0xcfff, 0, 0, bubbles_cmos_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcc00, 0xcfff, 0, 0, bubbles_cmos_w);
}
@@ -2722,13 +2722,13 @@ static DRIVER_INIT( spdball )
/* add a third PIA */
pia_config(3, &spdball_pia_3_intf);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc808, 0xc80b, 0, 0, pia_3_r, pia_3_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc808, 0xc80b, 0, 0, pia_3_r, pia_3_w);
/* install extra input handlers */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xc800, 0, 0, input_port_read_handler8(machine->portconfig, "AN0"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc801, 0xc801, 0, 0, input_port_read_handler8(machine->portconfig, "AN1"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc802, 0xc802, 0, 0, input_port_read_handler8(machine->portconfig, "AN2"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc803, 0xc803, 0, 0, input_port_read_handler8(machine->portconfig, "AN3"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc800, 0xc800, 0, 0, input_port_read_handler8(machine->portconfig, "AN0"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc801, 0xc801, 0, 0, input_port_read_handler8(machine->portconfig, "AN1"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc802, 0xc802, 0, 0, input_port_read_handler8(machine->portconfig, "AN2"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc803, 0xc803, 0, 0, input_port_read_handler8(machine->portconfig, "AN3"));
}
@@ -2736,7 +2736,7 @@ static DRIVER_INIT( alienar )
{
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
CONFIGURE_PIAS(williams_muxed_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xcbff, 0xcbff, 0, 0, SMH_NOP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, SMH_NOP);
}
@@ -2744,7 +2744,7 @@ static DRIVER_INIT( alienaru )
{
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
CONFIGURE_PIAS(williams_muxed_pia_0_intf, williams_pia_1_intf, williams_snd_pia_intf);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xcbff, 0xcbff, 0, 0, SMH_NOP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0, SMH_NOP);
}
diff --git a/src/mame/drivers/witch.c b/src/mame/drivers/witch.c
index 63acda33cc4..c971fb2d646 100644
--- a/src/mame/drivers/witch.c
+++ b/src/mame/drivers/witch.c
@@ -852,7 +852,7 @@ static DRIVER_INIT(witch)
UINT8 *ROM = (UINT8 *)memory_region(machine, "main");
memory_set_bankptr(1,&ROM[0x10000+UNBANKED_SIZE]);
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x7000, 0x700f, 0, 0, prot_read_700x);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x7000, 0x700f, 0, 0, prot_read_700x);
bank = -1;
}
diff --git a/src/mame/drivers/wiz.c b/src/mame/drivers/wiz.c
index 2ea12486b73..e578d8c9bc1 100644
--- a/src/mame/drivers/wiz.c
+++ b/src/mame/drivers/wiz.c
@@ -1037,13 +1037,14 @@ static DRIVER_INIT( stinger )
{ 5,3,7, 0x80 },
{ 5,7,3, 0x28 }
};
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
int size = memory_region_length(machine, "main");
UINT8 *decrypt = auto_malloc(size);
int A;
const UINT8 *tbl;
- memory_set_decrypted_region(0, 0x0000, 0xffff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypt);
for (A = 0x0000;A < 0x10000;A++)
{
@@ -1073,13 +1074,13 @@ static DRIVER_INIT( stinger )
static DRIVER_INIT( scion )
{
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4001, 0, 0, SMH_NOP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4001, 0, 0, SMH_NOP);
}
static DRIVER_INIT( wiz )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd400, 0xd400, 0, 0, wiz_protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd400, 0xd400, 0, 0, wiz_protection_r);
}
diff --git a/src/mame/drivers/xxmissio.c b/src/mame/drivers/xxmissio.c
index a6785245e4d..e59ce6f4c25 100644
--- a/src/mame/drivers/xxmissio.c
+++ b/src/mame/drivers/xxmissio.c
@@ -94,7 +94,7 @@ static INTERRUPT_GEN( xxmissio_interrupt_s )
static MACHINE_START( xxmissio )
{
- memory_configure_bank(1, 0, 8, memory_region(machine, "user1"), 0x4000);
+ memory_configure_bank(machine, 1, 0, 8, memory_region(machine, "user1"), 0x4000);
memory_set_bank(1, 0);
}
diff --git a/src/mame/drivers/yunsun16.c b/src/mame/drivers/yunsun16.c
index c00e933af2b..0ee268f18e1 100644
--- a/src/mame/drivers/yunsun16.c
+++ b/src/mame/drivers/yunsun16.c
@@ -167,7 +167,7 @@ number 0 on each voice. That sample is 00000-00000.
static DRIVER_INIT( magicbub )
{
// remove_mem_write16_handler (0, 0x800180, 0x800181 );
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x800188, 0x800189, 0, 0, magicbub_sound_command_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800188, 0x800189, 0, 0, magicbub_sound_command_w);
}
/***************************************************************************
diff --git a/src/mame/drivers/zaxxon.c b/src/mame/drivers/zaxxon.c
index d5d53355c2f..735e2f3b9b5 100644
--- a/src/mame/drivers/zaxxon.c
+++ b/src/mame/drivers/zaxxon.c
@@ -1394,7 +1394,7 @@ ROM_END
*
*************************************/
-static void zaxxonb_decode(running_machine *machine, const char *region)
+static void zaxxonb_decode(running_machine *machine, const char *cputag)
{
/*
the values vary, but the translation mask is always laid out like this:
@@ -1439,11 +1439,12 @@ static void zaxxonb_decode(running_machine *machine, const char *region)
};
int A;
- UINT8 *rom = memory_region(machine, region);
- int size = memory_region_length(machine, region);
+ const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM);
+ UINT8 *rom = memory_region(machine, cputag);
+ int size = memory_region_length(machine, cputag);
UINT8 *decrypt = auto_malloc(size);
- memory_set_decrypted_region(0, 0x0000, size - 1, decrypt);
+ memory_set_decrypted_region(space, 0x0000, size - 1, decrypt);
for (A = 0x0000; A < size; A++)
{
@@ -1501,15 +1502,15 @@ static DRIVER_INIT( razmataz )
nprinces_decode(machine, "main");
/* additional input ports are wired */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc004, 0xc004, 0, 0x18f3, input_port_read_handler8(machine->portconfig, "SW04"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc008, 0xc008, 0, 0x18f3, input_port_read_handler8(machine->portconfig, "SW08"));
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc00c, 0xc00c, 0, 0x18f3, input_port_read_handler8(machine->portconfig, "SW0C"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc004, 0xc004, 0, 0x18f3, input_port_read_handler8(machine->portconfig, "SW04"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc008, 0xc008, 0, 0x18f3, input_port_read_handler8(machine->portconfig, "SW08"));
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc00c, 0xc00c, 0, 0x18f3, input_port_read_handler8(machine->portconfig, "SW0C"));
/* unknown behavior expected here */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc80a, 0xc80a, 0, 0, razmataz_counter_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc80a, 0xc80a, 0, 0, razmataz_counter_r);
/* connect the universal sound board */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe03c, 0xe03c, 0, 0x1f00, sega_usb_status_r, sega_usb_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe03c, 0xe03c, 0, 0x1f00, sega_usb_status_r, sega_usb_data_w);
/* additional state saving */
state_save_register_global_array(razmataz_dial_pos);
@@ -1522,7 +1523,7 @@ static DRIVER_INIT( ixion )
szaxxon_decode(machine, "main");
/* connect the universal sound board */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe03c, 0xe03c, 0, 0x1f00, sega_usb_status_r, sega_usb_data_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe03c, 0xe03c, 0, 0x1f00, sega_usb_status_r, sega_usb_data_w);
}
diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c
index de0a652f13d..b02031d7a40 100644
--- a/src/mame/drivers/zn.c
+++ b/src/mame/drivers/zn.c
@@ -662,13 +662,13 @@ static WRITE32_HANDLER( zn_qsound_w )
static DRIVER_INIT( coh1000c )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 ); /* fixed game rom */
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 ); /* banked game rom */
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, bank_coh1000c_w ); /* bankswitch */
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb40010, 0x1fb40013, 0, 0, capcom_kickharness_r );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb40020, 0x1fb40023, 0, 0, capcom_kickharness_r );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 ); /* fixed game rom */
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 ); /* banked game rom */
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, bank_coh1000c_w ); /* bankswitch */
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40010, 0x1fb40013, 0, 0, capcom_kickharness_r );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40020, 0x1fb40023, 0, 0, capcom_kickharness_r );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w );
zn_driver_init(machine);
@@ -883,13 +883,13 @@ static WRITE32_HANDLER( bank_coh3002c_w )
static DRIVER_INIT( coh3002c )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 ); /* fixed game rom */
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 ); /* banked game rom */
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb40010, 0x1fb40013, 0, 0, capcom_kickharness_r );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb40020, 0x1fb40023, 0, 0, capcom_kickharness_r );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, bank_coh3002c_w ); /* bankswitch */
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 ); /* fixed game rom */
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 ); /* banked game rom */
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40010, 0x1fb40013, 0, 0, capcom_kickharness_r );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40020, 0x1fb40023, 0, 0, capcom_kickharness_r );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, bank_coh3002c_w ); /* bankswitch */
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fbfffff, 0, 0, SMH_BANK3 ); /* country rom */
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb60000, 0x1fb60003, 0, 0, zn_qsound_w );
zn_driver_init(machine);
}
@@ -1173,10 +1173,10 @@ static DRIVER_INIT( coh1000ta )
{
taitofx1_eeprom_size1 = 0x200; taitofx1_eeprom1 = auto_malloc( taitofx1_eeprom_size1 );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked game rom */
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, bank_coh1000t_w ); /* bankswitch */
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fb80003, 0, 0, taitofx1a_ymsound_r, taitofx1a_ymsound_w );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked game rom */
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40000, 0x1fb40003, 0, 0, bank_coh1000t_w ); /* bankswitch */
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fb80003, 0, 0, taitofx1a_ymsound_r, taitofx1a_ymsound_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 );
zn_driver_init(machine);
mb3773_init();
@@ -1270,13 +1270,13 @@ static DRIVER_INIT( coh1000tb )
taitofx1_eeprom_size1 = 0x400; taitofx1_eeprom1 = auto_malloc( taitofx1_eeprom_size1 );
taitofx1_eeprom_size2 = 0x200; taitofx1_eeprom2 = auto_malloc( taitofx1_eeprom_size2 );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked game rom */
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 );
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, bank_coh1000t_w ); /* bankswitch */
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb80000, 0x1fb80003, 0, 0, taitofx1b_volume_w );
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fba0000, 0x1fba0003, 0, 0, taitofx1b_sound_w );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbc0000, 0x1fbc0003, 0, 0, taitofx1b_sound_r );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, SMH_BANK3, SMH_BANK3 );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked game rom */
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00000 + ( taitofx1_eeprom_size1 - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 );
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40000, 0x1fb40003, 0, 0, bank_coh1000t_w ); /* bankswitch */
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb80000, 0x1fb80003, 0, 0, taitofx1b_volume_w );
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fba0000, 0x1fba0003, 0, 0, taitofx1b_sound_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbc0000, 0x1fbc0003, 0, 0, taitofx1b_sound_r );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbe0000, 0x1fbe0000 + ( taitofx1_eeprom_size2 - 1 ), 0, 0, SMH_BANK3, SMH_BANK3 );
zn_driver_init(machine);
mb3773_init();
@@ -1461,8 +1461,8 @@ static READ32_HANDLER( coh3002t_unknown_r )
static DRIVER_INIT( coh3002t )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb40000, 0x1fb40003, 0, 0, coh3002t_unknown_r, coh3002t_unknown_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb40000, 0x1fb40003, 0, 0, coh3002t_unknown_r, coh3002t_unknown_w );
zn_driver_init(machine);
}
@@ -1635,11 +1635,11 @@ static DRIVER_INIT( coh1000w )
{
const device_config *ide = device_list_find_by_tag(machine->config->devicelist, IDE_CONTROLLER, "ide");
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 );
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f000003, 0, 0, SMH_NOP );
- memory_install_readwrite32_device_handler( ide, 0, ADDRESS_SPACE_PROGRAM, 0x1f7e4000, 0x1f7e4fff, 0, 0, ide_controller32_r, ide_controller32_w );
- memory_install_readwrite32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f7e8000, 0x1f7e8003, 0, 0, SMH_NOP, SMH_NOP );
- memory_install_readwrite32_device_handler( ide, 0, ADDRESS_SPACE_PROGRAM, 0x1f7f4000, 0x1f7f4fff, 0, 0, ide_controller32_r, ide_controller32_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 );
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f000003, 0, 0, SMH_NOP );
+ memory_install_readwrite32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1f7e4000, 0x1f7e4fff, 0, 0, ide_controller32_r, ide_controller32_w );
+ memory_install_readwrite32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f7e8000, 0x1f7e8003, 0, 0, SMH_NOP, SMH_NOP );
+ memory_install_readwrite32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1f7f4000, 0x1f7f4fff, 0, 0, ide_controller32_r, ide_controller32_w );
zn_driver_init(machine);
}
@@ -1826,9 +1826,9 @@ static WRITE32_HANDLER( coh1002e_latch_w )
static DRIVER_INIT( coh1002e )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fa10300, 0x1fa10303, 0, 0, coh1002e_bank_w );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00007, 0, 0, coh1002e_latch_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10300, 0x1fa10303, 0, 0, coh1002e_bank_w );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00007, 0, 0, coh1002e_latch_w );
zn_driver_init(machine);
}
@@ -1985,12 +1985,12 @@ static READ32_HANDLER( bam2_unk_r )
static DRIVER_INIT( bam2 )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00007, 0, 0, bam2_mcu_r );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fa20000, 0x1fa20003, 0, 0, bam2_unk_r );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fa10300, 0x1fa10303, 0, 0, bam2_sec_w );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00007, 0, 0, bam2_mcu_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f3fffff, 0, 0, SMH_BANK1 );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f400000, 0x1f7fffff, 0, 0, SMH_BANK2 );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00007, 0, 0, bam2_mcu_r );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa20000, 0x1fa20003, 0, 0, bam2_unk_r );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fa10300, 0x1fa10303, 0, 0, bam2_sec_w );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00007, 0, 0, bam2_mcu_w );
zn_driver_init(machine);
}
@@ -2305,17 +2305,17 @@ static READ32_HANDLER( nbajamex_80_r )
static DRIVER_INIT( coh1000a )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff00, 0x1fbfff03, 0, 0, acpsx_00_w );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff10, 0x1fbfff13, 0, 0, acpsx_10_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f1fffff, 0, 0, SMH_BANK1 );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff00, 0x1fbfff03, 0, 0, acpsx_00_w );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff10, 0x1fbfff13, 0, 0, acpsx_10_w );
if( strcmp( machine->gamedrv->name, "nbajamex" ) == 0 )
{
nbajamex_eeprom_size = 0x8000; nbajamex_eeprom = auto_malloc( nbajamex_eeprom_size );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f200000, 0x1f200000 + ( nbajamex_eeprom_size - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff08, 0x1fbfff0b, 0, 0, nbajamex_08_r );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff80, 0x1fbfff83, 0, 0, nbajamex_80_r, nbajamex_80_w );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f200000, 0x1f200000 + ( nbajamex_eeprom_size - 1 ), 0, 0, SMH_BANK2, SMH_BANK2 );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff08, 0x1fbfff0b, 0, 0, nbajamex_08_r );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff80, 0x1fbfff83, 0, 0, nbajamex_80_r, nbajamex_80_w );
memory_set_bankptr( 2, nbajamex_eeprom ); /* ram/eeprom/?? */
}
@@ -2325,9 +2325,9 @@ static DRIVER_INIT( coh1000a )
{
const device_config *ide = device_list_find_by_tag(machine->config->devicelist, IDE_CONTROLLER, "ide");
- memory_install_read32_device_handler( ide, 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff8c, 0x1fbfff8f, 0, 0, jdredd_idestat_r );
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff8c, 0x1fbfff8f, 0, 0, SMH_NOP );
- memory_install_readwrite32_device_handler( ide, 0, ADDRESS_SPACE_PROGRAM, 0x1fbfff90, 0x1fbfff9f, 0, 0, jdredd_ide_r, jdredd_ide_w );
+ memory_install_read32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1fbfff8c, 0x1fbfff8f, 0, 0, jdredd_idestat_r );
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fbfff8c, 0x1fbfff8f, 0, 0, SMH_NOP );
+ memory_install_readwrite32_device_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), ide, 0x1fbfff90, 0x1fbfff9f, 0, 0, jdredd_ide_r, jdredd_ide_w );
}
zn_driver_init(machine);
@@ -2484,8 +2484,8 @@ static WRITE32_HANDLER( coh1001l_bnk_w )
static DRIVER_INIT( coh1001l )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked rom */
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, coh1001l_bnk_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 ); /* banked rom */
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, coh1001l_bnk_w );
zn_driver_init(machine);
}
@@ -2527,9 +2527,9 @@ static WRITE32_HANDLER( coh1002v_bnk_w )
static DRIVER_INIT( coh1002v )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f27ffff, 0, 0, SMH_BANK1 );
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fbfffff, 0, 0, SMH_BANK2 );
- memory_install_write32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, coh1002v_bnk_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f27ffff, 0, 0, SMH_BANK1 );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fbfffff, 0, 0, SMH_BANK2 );
+ memory_install_write32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, coh1002v_bnk_w );
zn_driver_init(machine);
}
@@ -2730,9 +2730,9 @@ static WRITE32_HANDLER( cbaj_z80_w )
static DRIVER_INIT( coh1002m )
{
- memory_install_read32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 );
- memory_install_readwrite32_handler( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00000, 0x1fb00003, 0, 0, cbaj_z80_r, cbaj_z80_w );
- memory_install_write32_handler ( machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fb00004, 0x1fb00007, 0, 0, coh1002m_bank_w );
+ memory_install_read32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1f000000, 0x1f7fffff, 0, 0, SMH_BANK1 );
+ memory_install_readwrite32_handler( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00000, 0x1fb00003, 0, 0, cbaj_z80_r, cbaj_z80_w );
+ memory_install_write32_handler ( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1fb00004, 0x1fb00007, 0, 0, coh1002m_bank_w );
zn_driver_init(machine);
}
diff --git a/src/mame/includes/decocrpt.h b/src/mame/includes/decocrpt.h
index e339ef1c3f8..f0a3ffd87ac 100644
--- a/src/mame/includes/decocrpt.h
+++ b/src/mame/includes/decocrpt.h
@@ -7,7 +7,7 @@ void deco56_remap_gfx(running_machine *machine, const char *tag);
/*----------- defined in machine/deco102.c -----------*/
-void deco102_decrypt_cpu(running_machine *machine, const char *region, int address_xor, int data_select_xor, int opcode_select_xor);
+void deco102_decrypt_cpu(running_machine *machine, const char *cputag, int address_xor, int data_select_xor, int opcode_select_xor);
/*----------- defined in machine/deco156.c -----------*/
diff --git a/src/mame/machine/acitya.c b/src/mame/machine/acitya.c
index 1a2f45d68a1..5d6ecb0b507 100644
--- a/src/mame/machine/acitya.c
+++ b/src/mame/machine/acitya.c
@@ -198,7 +198,7 @@ MACHINE_RESET( acitya )
/* The initial state of the counter is 0x0B */
counter = 0x0B;
- memory_configure_bank(1, 0, 4, &RAM[0x10000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, &RAM[0x10000], 0x4000);
memory_set_bank(1, 3);
state_save_register_global(counter);
diff --git a/src/mame/machine/atari.c b/src/mame/machine/atari.c
index 130a4747d59..e5ef70a40eb 100644
--- a/src/mame/machine/atari.c
+++ b/src/mame/machine/atari.c
@@ -145,7 +145,7 @@ void a600xl_mmu(running_machine *machine, UINT8 new_mmu)
rbank2 = SMH_BANK2;
wbank2 = SMH_UNMAP;
}
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x57ff, 0, 0, rbank2, wbank2);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x57ff, 0, 0, rbank2, wbank2);
if (rbank2 == SMH_BANK2)
memory_set_bankptr(2, memory_region(machine, "main")+0x5000);
}
@@ -177,8 +177,8 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu)
wbank4 = SMH_BANK4;
base4 = memory_region(machine, "main")+0x0d800; /* 4K RAM + 8K RAM */
}
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, rbank3, wbank3);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xd800, 0xffff, 0, 0, rbank4, wbank4);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xcfff, 0, 0, rbank3, wbank3);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xd800, 0xffff, 0, 0, rbank4, wbank4);
memory_set_bankptr(3, base3);
memory_set_bankptr(4, base4);
@@ -197,7 +197,7 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu)
wbank1 = SMH_UNMAP;
base1 = memory_region(machine, "main")+0x10000; /* 8K BASIC */
}
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, rbank1, wbank1);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa000, 0xbfff, 0, 0, rbank1, wbank1);
memory_set_bankptr(1, base1);
/* check if self-test ROM changed */
@@ -215,7 +215,7 @@ void a800xl_mmu(running_machine *machine, UINT8 new_mmu)
wbank2 = SMH_UNMAP;
base2 = memory_region(machine, "main")+0x15000; /* 0x0800 bytes */
}
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x57ff, 0, 0, rbank2, wbank2);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x57ff, 0, 0, rbank2, wbank2);
memory_set_bankptr(2, base2);
}
@@ -633,9 +633,9 @@ DRIVER_INIT( atari )
/* install RAM */
ram_top = MIN(mess_ram_size, ram_size) - 1;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
0x0000, ram_top, 0, 0, SMH_BANK2);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
0x0000, ram_top, 0, 0, SMH_BANK2);
memory_set_bankptr(2, mess_ram);
}
@@ -677,9 +677,9 @@ static void a800_setbank(running_machine *machine, int n)
break;
}
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0,
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0,
read_addr ? SMH_BANK1 : SMH_NOP);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0,
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0,
write_addr ? SMH_BANK1 : SMH_NOP);
if (read_addr)
memory_set_bankptr(1, read_addr);
@@ -786,9 +786,9 @@ static void atari_machine_start(running_machine *machine, int type, const pia682
/* install RAM */
ram_top = MIN(mess_ram_size, ram_size) - 1;
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
0x0000, ram_top, 0, 0, SMH_BANK2);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
0x0000, ram_top, 0, 0, SMH_BANK2);
memory_set_bankptr(2, mess_ram);
}
diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c
index 4b384414021..15b2fe299f7 100644
--- a/src/mame/machine/atarigen.c
+++ b/src/mame/machine/atarigen.c
@@ -548,7 +548,7 @@ void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, o
slapstic_init(machine, chipnum);
/* install the memory handlers */
- atarigen_slapstic = memory_install_readwrite16_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
+ atarigen_slapstic = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
/* allocate memory for a copy of bank 0 */
atarigen_slapstic_bank0 = auto_malloc(0x2000);
diff --git a/src/mame/machine/balsente.c b/src/mame/machine/balsente.c
index 834ebcea002..d83f5072e66 100644
--- a/src/mame/machine/balsente.c
+++ b/src/mame/machine/balsente.c
@@ -185,8 +185,8 @@ MACHINE_RESET( balsente )
/* point the banks to bank 0 */
numbanks = (memory_region_length(machine, "main") > 0x40000) ? 16 : 8;
- memory_configure_bank(1, 0, numbanks, &memory_region(machine, "main")[0x10000], 0x6000);
- memory_configure_bank(2, 0, numbanks, &memory_region(machine, "main")[0x12000], 0x6000);
+ memory_configure_bank(machine, 1, 0, numbanks, &memory_region(machine, "main")[0x10000], 0x6000);
+ memory_configure_bank(machine, 2, 0, numbanks, &memory_region(machine, "main")[0x12000], 0x6000);
memory_set_bank(1, 0);
memory_set_bank(2, 0);
diff --git a/src/mame/machine/beezer.c b/src/mame/machine/beezer.c
index 9a2f7e31d02..27304d0006d 100644
--- a/src/mame/machine/beezer.c
+++ b/src/mame/machine/beezer.c
@@ -123,15 +123,15 @@ WRITE8_HANDLER( beezer_bankswitch_w )
{
if ((data & 0x07) == 0)
{
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc600, 0xc7ff, 0, 0, watchdog_reset_w);
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xc9ff, 0, 0, beezer_map_w);
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xca00, 0xcbff, 0, 0, beezer_line_r);
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xce00, 0xcfff, 0, 0, via_0_r, via_0_w);
+ memory_install_write8_handler(space, 0xc600, 0xc7ff, 0, 0, watchdog_reset_w);
+ memory_install_write8_handler(space, 0xc800, 0xc9ff, 0, 0, beezer_map_w);
+ memory_install_read8_handler(space, 0xca00, 0xcbff, 0, 0, beezer_line_r);
+ memory_install_readwrite8_handler(space, 0xce00, 0xcfff, 0, 0, via_0_r, via_0_w);
}
else
{
UINT8 *rom = memory_region(space->machine, "main") + 0x10000;
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_BANK1);
+ memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_BANK1);
memory_set_bankptr(1, rom + (data & 0x07) * 0x2000 + ((data & 0x08) ? 0x1000: 0));
}
}
diff --git a/src/mame/machine/cclimber.c b/src/mame/machine/cclimber.c
index e0aaf75b55b..48f13c6d534 100644
--- a/src/mame/machine/cclimber.c
+++ b/src/mame/machine/cclimber.c
@@ -6,11 +6,12 @@
static void cclimber_decode(running_machine *machine, const UINT8 convtable[8][16])
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt = auto_malloc(0x10000);
int A;
- memory_set_decrypted_region(0, 0x0000, 0xffff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypt);
for (A = 0x0000;A < 0x10000;A++)
{
diff --git a/src/mame/machine/cps2crpt.c b/src/mame/machine/cps2crpt.c
index ff5f114574b..c90d41fcc63 100644
--- a/src/mame/machine/cps2crpt.c
+++ b/src/mame/machine/cps2crpt.c
@@ -632,6 +632,7 @@ static void optimise_sboxes(struct optimised_sbox* out, const struct sbox* in)
static void cps2_decrypt(running_machine *machine, const UINT32 *master_key, UINT32 upper_limit)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT16 *rom = (UINT16 *)memory_region(machine, "main");
int length = memory_region_length(machine, "main");
UINT16 *dec = auto_malloc(length);
@@ -719,7 +720,7 @@ static void cps2_decrypt(running_machine *machine, const UINT32 *master_key, UIN
}
}
- memory_set_decrypted_region(0, 0x000000, length - 1, dec);
+ memory_set_decrypted_region(space, 0x000000, length - 1, dec);
m68k_set_encrypted_opcode_range(machine->cpu[0],0,length);
}
diff --git a/src/mame/machine/dec0.c b/src/mame/machine/dec0.c
index 583864bee3c..a6d1ef0fb32 100644
--- a/src/mame/machine/dec0.c
+++ b/src/mame/machine/dec0.c
@@ -545,8 +545,8 @@ DRIVER_INIT( hippodrm )
{
UINT8 *RAM = memory_region(machine, "sub");
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180000, 0x180fff, 0, 0, hippodrm_68000_share_r, hippodrm_68000_share_w);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xffc800, 0xffcfff, 0, 0, sprite_mirror_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180000, 0x180fff, 0, 0, hippodrm_68000_share_r, hippodrm_68000_share_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xffc800, 0xffcfff, 0, 0, sprite_mirror_w);
h6280_decrypt(machine, "sub");
@@ -570,7 +570,7 @@ DRIVER_INIT( slyspy )
DRIVER_INIT( robocop )
{
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x180000, 0x180fff, 0, 0, robocop_68000_share_r, robocop_68000_share_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180000, 0x180fff, 0, 0, robocop_68000_share_r, robocop_68000_share_w);
}
DRIVER_INIT( baddudes )
diff --git a/src/mame/machine/deco102.c b/src/mame/machine/deco102.c
index f5de59b252a..343a17cbfdc 100644
--- a/src/mame/machine/deco102.c
+++ b/src/mame/machine/deco102.c
@@ -47,17 +47,18 @@ static UINT16 decrypt(UINT16 data, int address, int select_xor)
bs[8],bs[9],bs[10],bs[11],bs[12],bs[13],bs[14],bs[15]);
}
-void deco102_decrypt_cpu(running_machine *machine, const char *region, int address_xor, int data_select_xor, int opcode_select_xor)
+void deco102_decrypt_cpu(running_machine *machine, const char *cputag, int address_xor, int data_select_xor, int opcode_select_xor)
{
int i;
- UINT16 *rom = (UINT16 *)memory_region(machine, region);
- int size = memory_region_length(machine, region);
+ const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM);
+ UINT16 *rom = (UINT16 *)memory_region(machine, cputag);
+ int size = memory_region_length(machine, cputag);
UINT16 *opcodes = auto_malloc(size);
UINT16 *buf = malloc_or_die(size);
memcpy(buf,rom,size);
- memory_set_decrypted_region(0, 0, size - 1, opcodes);
+ memory_set_decrypted_region(space, 0, size - 1, opcodes);
m68k_set_encrypted_opcode_range(machine->cpu[0],0,size);
for (i = 0;i < size/2;i++)
diff --git a/src/mame/machine/fd1089.c b/src/mame/machine/fd1089.c
index e4679a40e98..855382f99f6 100644
--- a/src/mame/machine/fd1089.c
+++ b/src/mame/machine/fd1089.c
@@ -400,12 +400,13 @@ static UINT16 *decrypted;
static void sys16_decrypt(running_machine *machine, const UINT8 *key,int cputype)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT16 *rom = (UINT16 *)memory_region(machine, "main");
int size = memory_region_length(machine, "main");
int A;
decrypted = (UINT16 *)auto_malloc(size);
- memory_set_decrypted_region(0, 0x000000, size - 1, decrypted);
+ memory_set_decrypted_region(space, 0x000000, size - 1, decrypted);
for (A = 0;A < size;A+=2)
{
diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c
index a599b5664d5..d9607bcab7a 100644
--- a/src/mame/machine/fddebug.c
+++ b/src/mame/machine/fddebug.c
@@ -438,7 +438,7 @@ INLINE int pc_is_valid(running_machine *machine, UINT32 pc, UINT32 flags)
return 0;
if (pc & 0xff000000)
return 0;
- if (memory_get_op_ptr(machine, cpunum_get_active(), pc, 0) == NULL)
+ if (memory_decrypted_read_ptr(cpu_get_address_space(Machine->activecpu, ADDRESS_SPACE_PROGRAM), pc) == NULL)
return 0;
return 1;
}
@@ -462,7 +462,7 @@ INLINE int addr_is_valid(running_machine *machine, UINT32 addr, UINT32 flags)
return 0;
/* if we're invalid, fail */
- if (strcmp(memory_get_handler_string(0, cpunum_get_active(), ADDRESS_SPACE_PROGRAM, addr), "segaic16_memory_mapper_lsb_r") == 0)
+ if (strcmp(memory_get_handler_string(cpu_get_address_space(machine->activecpu, ADDRESS_SPACE_PROGRAM), 0, addr), "segaic16_memory_mapper_lsb_r") == 0)
return 2;
return 1;
diff --git a/src/mame/machine/galaxold.c b/src/mame/machine/galaxold.c
index 6db464d9439..10ffe283ee3 100644
--- a/src/mame/machine/galaxold.c
+++ b/src/mame/machine/galaxold.c
@@ -160,8 +160,8 @@ WRITE8_HANDLER( zigzag_sillyprotection_w )
DRIVER_INIT( zigzag )
{
UINT8 *RAM = memory_region(machine, "main");
- memory_configure_bank(1, 0, 2, &RAM[0x2000], 0x1000);
- memory_configure_bank(2, 0, 2, &RAM[0x2000], 0x1000);
+ memory_configure_bank(machine, 1, 0, 2, &RAM[0x2000], 0x1000);
+ memory_configure_bank(machine, 2, 0, 2, &RAM[0x2000], 0x1000);
memory_set_bank(1, 0);
memory_set_bank(2, 1);
}
@@ -210,7 +210,7 @@ DRIVER_INIT( dingoe )
rom[i] = BITSWAP8(rom[i],7,6,5,0,3,2,1,4);
}
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3001, 0x3001, 0, 0, dingoe_3001_r); /* Protection check */
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3001, 0x3001, 0, 0, dingoe_3001_r); /* Protection check */
}
@@ -257,19 +257,19 @@ CUSTOM_INPUT( _4in1_fake_port_r )
DRIVER_INIT( pisces )
{
/* the coin lockout was replaced */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0, galaxold_gfxbank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0, galaxold_gfxbank_w);
}
DRIVER_INIT( checkmaj )
{
/* for the title screen */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3800, 0, 0, checkmaj_protection_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3800, 0x3800, 0, 0, checkmaj_protection_r);
}
DRIVER_INIT( dingo )
{
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3000, 0x3000, 0, 0, dingo_3000_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3035, 0x3035, 0, 0, dingo_3035_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3000, 0x3000, 0, 0, dingo_3000_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3035, 0x3035, 0, 0, dingo_3035_r);
}
@@ -287,7 +287,7 @@ static UINT8 decode_mooncrst(UINT8 data,offs_t addr)
DRIVER_INIT( mooncrsu )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xa002, 0, 0, galaxold_gfxbank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa000, 0xa002, 0, 0, galaxold_gfxbank_w);
}
DRIVER_INIT( mooncrst )
@@ -304,16 +304,17 @@ DRIVER_INIT( mooncrst )
DRIVER_INIT( mooncrgx )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6002, 0, 0, galaxold_gfxbank_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6002, 0, 0, galaxold_gfxbank_w);
}
DRIVER_INIT( moonqsr )
{
offs_t i;
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt = auto_malloc(0x8000);
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
for (i = 0;i < 0x8000;i++)
decrypt[i] = decode_mooncrst(rom[i],i);
@@ -395,7 +396,7 @@ DRIVER_INIT( 4in1 )
RAM[i] = RAM[i] ^ (i & 0xff);
/* games are banked at 0x0000 - 0x3fff */
- memory_configure_bank(1, 0, 4, &RAM[0x10000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, &RAM[0x10000], 0x4000);
_4in1_bank_w(space, 0, 0); /* set the initial CPU bank */
@@ -410,5 +411,5 @@ INTERRUPT_GEN( hunchbks_vh_interrupt )
DRIVER_INIT( ladybugg )
{
/* Doesn't actually use the bank, but it mustn't have a coin lock! */
-memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0, galaxold_gfxbank_w);
+memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6002, 0x6002, 0, 0, galaxold_gfxbank_w);
}
diff --git a/src/mame/machine/kabuki.c b/src/mame/machine/kabuki.c
index 597c5e047a2..d45ba0c515c 100644
--- a/src/mame/machine/kabuki.c
+++ b/src/mame/machine/kabuki.c
@@ -161,12 +161,13 @@ static void kabuki_decode(UINT8 *src,UINT8 *dest_op,UINT8 *dest_data,
static void mitchell_decode(running_machine *machine, int swap_key1,int swap_key2,int addr_key,int xor_key)
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
UINT8 *decrypt = auto_malloc(memory_region_length(machine, "main"));
int numbanks = (memory_region_length(machine, "main") - 0x10000) / 0x4000;
int i;
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
kabuki_decode(rom,decrypt,rom,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key);
rom += 0x10000;
@@ -174,7 +175,7 @@ static void mitchell_decode(running_machine *machine, int swap_key1,int swap_key
for (i = 0; i < numbanks; i++)
kabuki_decode(rom+i*0x4000,decrypt+i*0x4000,rom+i*0x4000,0x8000,0x4000, swap_key1,swap_key2,addr_key,xor_key);
- memory_configure_bank_decrypted(1, 0, numbanks, decrypt, 0x4000);
+ memory_configure_bank_decrypted(machine, 1, 0, numbanks, decrypt, 0x4000);
/*
{
FILE *f;
@@ -201,10 +202,11 @@ void block_decode(running_machine *machine) { mitchell_decode(machine,0x02461
static void cps1_decode(running_machine *machine,int swap_key1,int swap_key2,int addr_key,int xor_key)
{
+ const address_space *space = cputag_get_address_space(machine, "audio", ADDRESS_SPACE_PROGRAM);
UINT8 *decrypt = auto_malloc(0x8000);
UINT8 *rom = memory_region(machine, "audio");
- memory_set_decrypted_region(1, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
kabuki_decode(rom,decrypt,rom,0x0000,0x8000, swap_key1,swap_key2,addr_key,xor_key);
}
diff --git a/src/mame/machine/konami1.c b/src/mame/machine/konami1.c
index 95c2342b46e..7d2ab17136b 100644
--- a/src/mame/machine/konami1.c
+++ b/src/mame/machine/konami1.c
@@ -42,12 +42,13 @@ static UINT8 konami1_decodebyte( UINT8 opcode, UINT16 address )
UINT8 *konami1_decode(running_machine *machine, const char *cpu)
{
+ const address_space *space = cputag_get_address_space(machine, cpu, ADDRESS_SPACE_PROGRAM);
const UINT8 *rom = memory_region(machine, cpu);
int size = memory_region_length(machine, cpu);
int A;
UINT8 *decrypted = auto_malloc(size);
- memory_set_decrypted_region(mame_find_cpu_index(machine, cpu), 0x0000, 0xffff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0xffff, decrypted);
for (A = 0;A < size;A++)
{
diff --git a/src/mame/machine/konppc.c b/src/mame/machine/konppc.c
index ef2624e6551..e5f9782b034 100644
--- a/src/mame/machine/konppc.c
+++ b/src/mame/machine/konppc.c
@@ -122,7 +122,7 @@ void set_cgboard_texture_bank(int board, int bank, UINT8 *rom)
{
texture_bank[board] = bank;
- memory_configure_bank(bank, 0, 2, rom, 0x800000);
+ memory_configure_bank(Machine, bank, 0, 2, rom, 0x800000);
}
/*****************************************************************************/
diff --git a/src/mame/machine/mc8123.c b/src/mame/machine/mc8123.c
index 532e4f37f1a..94f7938dde4 100644
--- a/src/mame/machine/mc8123.c
+++ b/src/mame/machine/mc8123.c
@@ -376,15 +376,16 @@ static UINT8 mc8123_decrypt(offs_t addr,UINT8 val,const UINT8 *key,int opcode)
void mc8123_decrypt_rom(running_machine *machine, const char *cpu, const char *keyrgn, int banknum, int numbanks)
{
+ const address_space *space = cputag_get_address_space(machine, cpu, ADDRESS_SPACE_PROGRAM);
UINT8 *decrypted1 = auto_malloc(numbanks == 1 ? 0xc000 : 0x8000);
UINT8 *decrypted2 = numbanks > 1 ? auto_malloc(0x4000 * numbanks) : decrypted1 + 0x8000;
UINT8 *rom = memory_region(machine, cpu);
UINT8 *key = memory_region(machine, keyrgn);
int A, bank;
- memory_set_decrypted_region(mame_find_cpu_index(machine, cpu), 0x0000, 0x7fff, decrypted1);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypted1);
if (numbanks > 1)
- memory_configure_bank_decrypted(banknum, 0, numbanks, decrypted2, 0x4000);
+ memory_configure_bank_decrypted(machine, banknum, 0, numbanks, decrypted2, 0x4000);
for (A = 0x0000;A < 0x8000;A++)
{
diff --git a/src/mame/machine/mhavoc.c b/src/mame/machine/mhavoc.c
index 20eac5d99cc..0de45d778fc 100644
--- a/src/mame/machine/mhavoc.c
+++ b/src/mame/machine/mhavoc.c
@@ -87,9 +87,9 @@ MACHINE_RESET( mhavoc )
const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
has_gamma_cpu = (machine->cpu[1] != NULL);
- memory_configure_bank(1, 0, 1, mhavoc_zram0, 0);
- memory_configure_bank(1, 1, 1, mhavoc_zram1, 0);
- memory_configure_bank(2, 0, 4, memory_region(machine, "alpha") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 1, mhavoc_zram0, 0);
+ memory_configure_bank(machine, 1, 1, 1, mhavoc_zram1, 0);
+ memory_configure_bank(machine, 2, 0, 4, memory_region(machine, "alpha") + 0x10000, 0x2000);
/* reset RAM/ROM banks to 0 */
mhavoc_ram_banksel_w(space, 0, 0);
diff --git a/src/mame/machine/midtunit.c b/src/mame/machine/midtunit.c
index 50ffb410f42..7e60f47a8eb 100644
--- a/src/mame/machine/midtunit.c
+++ b/src/mame/machine/midtunit.c
@@ -447,10 +447,10 @@ DRIVER_INIT( mktunit )
init_tunit_generic(machine, SOUND_ADPCM);
/* protection */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1b00000, 0x1b6ffff, 0, 0, mk_prot_r, mk_prot_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1b00000, 0x1b6ffff, 0, 0, mk_prot_r, mk_prot_w);
/* sound chip protection (hidden RAM) */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xfb9c, 0xfbc6, 0, 0, SMH_BANK9, SMH_BANK9);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfb9c, 0xfbc6, 0, 0, SMH_BANK9, SMH_BANK9);
memory_set_bankptr(9, auto_malloc(0x80));
}
@@ -463,20 +463,20 @@ static void init_nbajam_common(running_machine *machine, int te_protection)
if (!te_protection)
{
nbajam_prot_table = nbajam_prot_values;
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1b14020, 0x1b2503f, 0, 0, nbajam_prot_r, nbajam_prot_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1b14020, 0x1b2503f, 0, 0, nbajam_prot_r, nbajam_prot_w);
}
else
{
nbajam_prot_table = nbajamte_prot_values;
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1b15f40, 0x1b37f5f, 0, 0, nbajam_prot_r, nbajam_prot_w);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1b95f40, 0x1bb7f5f, 0, 0, nbajam_prot_r, nbajam_prot_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1b15f40, 0x1b37f5f, 0, 0, nbajam_prot_r, nbajam_prot_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1b95f40, 0x1bb7f5f, 0, 0, nbajam_prot_r, nbajam_prot_w);
}
/* sound chip protection (hidden RAM) */
if (!te_protection)
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xfbaa, 0xfbd4, 0, 0, SMH_BANK9, SMH_BANK9);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbaa, 0xfbd4, 0, 0, SMH_BANK9, SMH_BANK9);
else
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xfbec, 0xfc16, 0, 0, SMH_BANK9, SMH_BANK9);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbec, 0xfc16, 0, 0, SMH_BANK9, SMH_BANK9);
memory_set_bankptr(9, auto_malloc(0x80));
}
@@ -496,18 +496,18 @@ DRIVER_INIT( jdreddp )
init_tunit_generic(machine, SOUND_ADPCM_LARGE);
/* looks like the watchdog needs to be disabled */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d81060, 0x01d8107f, 0, 0, SMH_NOP);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d81060, 0x01d8107f, 0, 0, SMH_NOP);
/* protection */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1b00000, 0x1bfffff, 0, 0, jdredd_prot_r, jdredd_prot_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1b00000, 0x1bfffff, 0, 0, jdredd_prot_r, jdredd_prot_w);
/* sound chip protection (hidden RAM) */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xfbcf, 0xfbf9, 0, 0, SMH_BANK7, SMH_BANK9);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfbcf, 0xfbf9, 0, 0, SMH_BANK7, SMH_BANK9);
memory_set_bankptr(9, auto_malloc(0x80));
#if ENABLE_ALL_JDREDD_LEVELS
/* how about the final levels? */
- jdredd_hack = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xFFBA7FF0, 0xFFBA7FFf, 0, 0, jdredd_hack_r);
+ jdredd_hack = memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xFFBA7FF0, 0xFFBA7FFf, 0, 0, jdredd_hack_r);
#endif
}
@@ -528,13 +528,13 @@ DRIVER_INIT( mk2 )
midtunit_gfx_rom_large = 1;
/* protection */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00f20c60, 0x00f20c7f, 0, 0, mk2_prot_w);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00f42820, 0x00f4283f, 0, 0, mk2_prot_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01a190e0, 0x01a190ff, 0, 0, mk2_prot_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01a191c0, 0x01a191df, 0, 0, mk2_prot_shift_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01a3d0c0, 0x01a3d0ff, 0, 0, mk2_prot_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01d9d1e0, 0x01d9d1ff, 0, 0, mk2_prot_const_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01def920, 0x01def93f, 0, 0, mk2_prot_const_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00f20c60, 0x00f20c7f, 0, 0, mk2_prot_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x00f42820, 0x00f4283f, 0, 0, mk2_prot_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01a190e0, 0x01a190ff, 0, 0, mk2_prot_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01a191c0, 0x01a191df, 0, 0, mk2_prot_shift_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01a3d0c0, 0x01a3d0ff, 0, 0, mk2_prot_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01d9d1e0, 0x01d9d1ff, 0, 0, mk2_prot_const_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01def920, 0x01def93f, 0, 0, mk2_prot_const_r);
}
diff --git a/src/mame/machine/midwunit.c b/src/mame/machine/midwunit.c
index 5f40f100924..10f1ed1a88e 100644
--- a/src/mame/machine/midwunit.c
+++ b/src/mame/machine/midwunit.c
@@ -467,13 +467,13 @@ DRIVER_INIT( mk3r10 )
DRIVER_INIT( umk3 )
{
init_mk3_common(machine);
- umk3_palette = memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0106a060, 0x0106a09f, 0, 0, umk3_palette_hack_w);
+ umk3_palette = memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0106a060, 0x0106a09f, 0, 0, umk3_palette_hack_w);
}
DRIVER_INIT( umk3r11 )
{
init_mk3_common(machine);
- umk3_palette = memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0106a060, 0x0106a09f, 0, 0, umk3_palette_hack_w);
+ umk3_palette = memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0106a060, 0x0106a09f, 0, 0, umk3_palette_hack_w);
}
@@ -558,7 +558,7 @@ DRIVER_INIT( wwfmania )
init_wunit_generic(machine);
/* enable I/O shuffling */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01800000, 0x0180000f, 0, 0, wwfmania_io_0_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01800000, 0x0180000f, 0, 0, wwfmania_io_0_w);
/* serial prefixes 430, 528 */
midway_serial_pic_init(machine, 528);
diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c
index a02a54b3606..b607897fecb 100644
--- a/src/mame/machine/midyunit.c
+++ b/src/mame/machine/midyunit.c
@@ -293,25 +293,25 @@ static void init_generic(running_machine *machine, int bpp, int sound, int prot_
{
case SOUND_CVSD_SMALL:
williams_cvsd_init(0);
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, prot_start, prot_end, 0, 0, cvsd_protection_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, cvsd_protection_w);
cvsd_protection_base = memory_region(machine, "cvsd") + 0x10000 + (prot_start - 0x8000);
break;
case SOUND_CVSD:
williams_cvsd_init(0);
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
memory_set_bankptr(9, auto_malloc(0x80));
break;
case SOUND_ADPCM:
williams_adpcm_init();
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
memory_set_bankptr(9, auto_malloc(0x80));
break;
case SOUND_NARC:
williams_narc_init();
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
memory_set_bankptr(9, auto_malloc(0x80));
break;
@@ -480,12 +480,12 @@ static void term2_init_common(running_machine *machine, write16_space_func hack_
init_generic(machine, 6, SOUND_ADPCM, 0xfa8d, 0xfa9c);
/* special inputs */
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01c00000, 0x01c0005f, 0, 0, term2_input_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01e00000, 0x01e0001f, 0, 0, term2_sound_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01c00000, 0x01c0005f, 0, 0, term2_input_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01e00000, 0x01e0001f, 0, 0, term2_sound_w);
/* HACK: this prevents the freeze on the movies */
/* until we figure whats causing it, this is better than nothing */
- t2_hack_mem = memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x010aa0e0, 0x010aa0ff, 0, 0, hack_w);
+ t2_hack_mem = memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x010aa0e0, 0x010aa0ff, 0, 0, hack_w);
}
DRIVER_INIT( term2 ) { term2_init_common(machine, term2_hack_w); }
diff --git a/src/mame/machine/mspacman.c b/src/mame/machine/mspacman.c
index a10dda40f46..c5b3c1e5646 100644
--- a/src/mame/machine/mspacman.c
+++ b/src/mame/machine/mspacman.c
@@ -182,7 +182,7 @@ MACHINE_RESET( mspacman )
UINT8 *RAM = memory_region(machine, "main");
mspacman_decode(machine);
- memory_configure_bank(1, 0, 2, &RAM[0x00000], 0x10000);
+ memory_configure_bank(machine, 1, 0, 2, &RAM[0x00000], 0x10000);
memory_set_bank(1, 0);
}
diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c
index be97be07113..b1ada9bfa4a 100644
--- a/src/mame/machine/namcos1.c
+++ b/src/mame/machine/namcos1.c
@@ -692,12 +692,12 @@ static void set_bank(running_machine *machine, int banknum, const bankhandler *h
if (!handler->bank_handler_r)
{
if (namcos1_active_bank[banknum].bank_handler_r)
- memory_install_read8_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_r[banknum]);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_r[banknum]);
}
else
{
if (!namcos1_active_bank[banknum].bank_handler_r)
- memory_install_read8_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_r[banknum]);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_r[banknum]);
}
/* write handlers (except for the 0xe000-0xffff range) */
@@ -706,12 +706,12 @@ static void set_bank(running_machine *machine, int banknum, const bankhandler *h
if (!handler->bank_handler_w)
{
if (namcos1_active_bank[banknum].bank_handler_w)
- memory_install_write8_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_w[banknum]);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_w[banknum]);
}
else
{
if (!namcos1_active_bank[banknum].bank_handler_r)
- memory_install_write8_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_w[banknum]);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_w[banknum]);
}
}
@@ -1235,7 +1235,7 @@ DRIVER_INIT( tankfrc4 )
};
namcos1_driver_init(machine, &tankfrce_specific);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, tankfrc4_input_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x1400, 0x1401, 0, 0, tankfrc4_input_r);
}
/*******************************************************************************
@@ -1326,7 +1326,7 @@ static READ8_HANDLER( quester_paddle_r )
DRIVER_INIT( quester )
{
namcos1_driver_init(machine, NULL);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, quester_paddle_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x1400, 0x1401, 0, 0, quester_paddle_r);
}
@@ -1415,7 +1415,7 @@ static READ8_HANDLER( berabohm_buttons_r )
DRIVER_INIT( berabohm )
{
namcos1_driver_init(machine, NULL);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, berabohm_buttons_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x1400, 0x1401, 0, 0, berabohm_buttons_r);
}
@@ -1485,5 +1485,5 @@ static READ8_HANDLER( faceoff_inputs_r )
DRIVER_INIT( faceoff )
{
namcos1_driver_init(machine, NULL);
- memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, faceoff_inputs_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[3], ADDRESS_SPACE_PROGRAM), 0x1400, 0x1401, 0, 0, faceoff_inputs_r);
}
diff --git a/src/mame/machine/neoboot.c b/src/mame/machine/neoboot.c
index 8b7a64800b8..d69bffed90f 100644
--- a/src/mame/machine/neoboot.c
+++ b/src/mame/machine/neoboot.c
@@ -178,9 +178,9 @@ static WRITE16_HANDLER( kof10th_bankswitch_w )
void install_kof10th_protection ( running_machine *machine )
{
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, kof10th_RAMB_r);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x23ffff, 0, 0, kof10th_custom_w);
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x240000, 0x2fffff, 0, 0, kof10th_bankswitch_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe000, 0x2fffff, 0, 0, kof10th_RAMB_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x23ffff, 0, 0, kof10th_custom_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x240000, 0x2fffff, 0, 0, kof10th_bankswitch_w);
}
void decrypt_kof10th(running_machine *machine)
@@ -485,7 +485,7 @@ void patch_cthd2003( running_machine *machine )
UINT16 *mem16 = (UINT16 *)memory_region(machine, "main");
/* special ROM banking handler */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, cthd2003_bankswitch_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2ffff0, 0x2fffff, 0, 0, cthd2003_bankswitch_w);
// theres still a problem on the character select screen but it seems to be related to cpu core timing issues,
// overclocking the 68k prevents it.
@@ -729,7 +729,7 @@ static WRITE16_HANDLER ( ms5plus_bankswitch_w )
void install_ms5plus_protection(running_machine *machine)
{
// special ROM banking handler / additional protection
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM,0x2ffff0, 0x2fffff,0, 0, mslug5_prot_r, ms5plus_bankswitch_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),0x2ffff0, 0x2fffff,0, 0, mslug5_prot_r, ms5plus_bankswitch_w);
}
@@ -972,7 +972,7 @@ void kf2k3bl_px_decrypt( running_machine *machine )
void kf2k3bl_install_protection(running_machine *machine)
{
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, kof2003_r, kof2003_w );
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe000, 0x2fffff, 0, 0, kof2003_r, kof2003_w );
}
@@ -1000,7 +1000,7 @@ void kf2k3pl_px_decrypt( running_machine *machine )
void kf2k3pl_install_protection(running_machine *machine)
{
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, kof2003_r, kof2003p_w );
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe000, 0x2fffff, 0, 0, kof2003_r, kof2003p_w );
}
@@ -1031,7 +1031,7 @@ void kf2k3upl_px_decrypt( running_machine *machine )
void kf2k3upl_install_protection(running_machine *machine)
{
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, kof2003_r, kof2003_w );
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe000, 0x2fffff, 0, 0, kof2003_r, kof2003_w );
}
diff --git a/src/mame/machine/neoprot.c b/src/mame/machine/neoprot.c
index 9e811348d00..d158bcf8fec 100644
--- a/src/mame/machine/neoprot.c
+++ b/src/mame/machine/neoprot.c
@@ -104,7 +104,7 @@ void fatfury2_install_protection(running_machine *machine)
{
/* the protection involves reading and writing addresses in the */
/* 0x2xxxxx range. There are several checks all around the code. */
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2fffff, 0, 0, fatfury2_protection_16_r, fatfury2_protection_16_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x200000, 0x2fffff, 0, 0, fatfury2_protection_16_r, fatfury2_protection_16_w);
state_save_register_global(fatfury2_prot_data);
}
@@ -146,7 +146,7 @@ void install_kof98_protection(running_machine *machine)
/* when 0x20aaaa contains 0x0090 (word) then 0x100 (normally the neogeo header) should return 0x00c200fd
worked out using real hw */
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20aaaa, 0x20aaab, 0, 0, kof98_prot_w);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x20aaaa, 0x20aaab, 0, 0, kof98_prot_w);
}
@@ -402,15 +402,15 @@ static void sma_install_random_read_handler(running_machine *machine, int addr1,
{
state_save_register_global(neogeo_rng);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, addr1, addr1 + 1, 0, 0, sma_random_r);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, addr2, addr2 + 1, 0, 0, sma_random_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), addr1, addr1 + 1, 0, 0, sma_random_r);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), addr2, addr2 + 1, 0, 0, sma_random_r);
}
void kof99_install_protection(running_machine *machine)
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2ffff1, 0, 0, kof99_bankswitch_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2ffff0, 0x2ffff1, 0, 0, kof99_bankswitch_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
sma_install_random_read_handler(machine, 0x2ffff8, 0x2ffffa);
}
@@ -418,8 +418,8 @@ void kof99_install_protection(running_machine *machine)
void garou_install_protection(running_machine *machine)
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fffc0, 0x2fffc1, 0, 0, garou_bankswitch_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fffc0, 0x2fffc1, 0, 0, garou_bankswitch_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
sma_install_random_read_handler(machine, 0x2fffcc, 0x2ffff0);
}
@@ -427,8 +427,8 @@ void garou_install_protection(running_machine *machine)
void garouo_install_protection(running_machine *machine)
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fffc0, 0x2fffc1, 0, 0, garouo_bankswitch_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fffc0, 0x2fffc1, 0, 0, garouo_bankswitch_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
sma_install_random_read_handler(machine, 0x2fffcc, 0x2ffff0);
}
@@ -436,8 +436,8 @@ void garouo_install_protection(running_machine *machine)
void mslug3_install_protection(running_machine *machine)
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fffe4, 0x2fffe5, 0, 0, mslug3_bankswitch_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fffe4, 0x2fffe5, 0, 0, mslug3_bankswitch_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
// sma_install_random_read_handler(machine, 0x2ffff8, 0x2ffffa);
}
@@ -445,8 +445,8 @@ void mslug3_install_protection(running_machine *machine)
void kof2000_install_protection(running_machine *machine)
{
- memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fffec, 0x2fffed, 0, 0, kof2000_bankswitch_w);
- memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
+ memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fffec, 0x2fffed, 0, 0, kof2000_bankswitch_w);
+ memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
sma_install_random_read_handler(machine, 0x2fffd8, 0x2fffda);
}
@@ -524,5 +524,5 @@ void install_pvc_protection( running_machine *machine )
pvc_cartridge_ram = auto_malloc(0x2000);
state_save_register_global_pointer(pvc_cartridge_ram, 0x2000 / 2);
- memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r, pvc_prot_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r, pvc_prot_w);
}
diff --git a/src/mame/machine/playch10.c b/src/mame/machine/playch10.c
index acee6d3c3b3..fb520799fa5 100644
--- a/src/mame/machine/playch10.c
+++ b/src/mame/machine/playch10.c
@@ -439,7 +439,7 @@ static WRITE8_HANDLER( aboard_vrom_switch_w )
DRIVER_INIT( pcaboard )
{
/* switches vrom with writes to the $803e-$8041 area */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0x8fff, 0, 0, aboard_vrom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0x8fff, 0, 0, aboard_vrom_switch_w );
/* common init */
DRIVER_INIT_CALL(playch10);
@@ -469,7 +469,7 @@ DRIVER_INIT( pcbboard )
memcpy( &prg[0x08000], &prg[0x28000], 0x8000 );
/* Roms are banked at $8000 to $bfff */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, bboard_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, bboard_rom_switch_w );
/* common init */
DRIVER_INIT_CALL(playch10);
@@ -490,7 +490,7 @@ static WRITE8_HANDLER( cboard_vrom_switch_w )
DRIVER_INIT( pccboard )
{
/* switches vrom with writes to $6000 */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6000, 0, 0, cboard_vrom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, cboard_vrom_switch_w );
/* common init */
DRIVER_INIT_CALL(playch10);
@@ -511,7 +511,7 @@ DRIVER_INIT( pcdboard )
mmc1_rom_mask = 0x07;
/* MMC mapper at writes to $8000-$ffff */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
/* common init */
DRIVER_INIT_CALL(playch10);
@@ -522,7 +522,7 @@ DRIVER_INIT( pcdboard )
DRIVER_INIT( pcdboard_2 )
{
/* extra ram at $6000-$7fff */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
/* common init */
@@ -611,13 +611,13 @@ DRIVER_INIT( pceboard )
memcpy( &prg[0x08000], &prg[0x28000], 0x8000 );
/* basically a mapper 9 on a nes */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, eboard_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, eboard_rom_switch_w );
/* ppu_latch callback */
ppu_latch = mapper9_latch;
/* nvram at $6000-$6fff */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x1000));
/* common init */
@@ -639,7 +639,7 @@ DRIVER_INIT( pcfboard )
mmc1_rom_mask = 0x07;
/* MMC mapper at writes to $8000-$ffff */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
/* common init */
DRIVER_INIT_CALL(playch10);
@@ -650,7 +650,7 @@ DRIVER_INIT( pcfboard )
DRIVER_INIT( pcfboard_2 )
{
/* extra ram at $6000-$6fff */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x1000));
/* common init */
@@ -823,10 +823,10 @@ DRIVER_INIT( pcgboard )
memcpy( &prg[0x0c000], &prg[0x4c000], 0x4000 );
/* MMC3 mapper at writes to $8000-$ffff */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, gboard_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, gboard_rom_switch_w );
/* extra ram at $6000-$7fff */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
gboard_banks[0] = 0x1e;
@@ -874,7 +874,7 @@ DRIVER_INIT( pciboard )
memcpy( &prg[0x08000], &prg[0x10000], 0x8000 );
/* Roms are banked at $8000 to $bfff */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, iboard_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, iboard_rom_switch_w );
/* common init */
DRIVER_INIT_CALL(playch10);
@@ -937,10 +937,10 @@ DRIVER_INIT( pchboard )
memcpy( &prg[0x0c000], &prg[0x4c000], 0x4000 );
/* Roms are banked at $8000 to $bfff */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, hboard_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, hboard_rom_switch_w );
/* extra ram at $6000-$7fff */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
gboard_banks[0] = 0x1e;
@@ -969,11 +969,11 @@ DRIVER_INIT( pckboard )
mmc1_rom_mask = 0x0f;
/* extra ram at $6000-$7fff */
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
/* Roms are banked at $8000 to $bfff */
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
/* common init */
DRIVER_INIT_CALL(playch10);
diff --git a/src/mame/machine/s16fd.c b/src/mame/machine/s16fd.c
index 668706e8071..6bfb6acf8e9 100644
--- a/src/mame/machine/s16fd.c
+++ b/src/mame/machine/s16fd.c
@@ -43,7 +43,7 @@ static void set_decrypted_region(void)
if (fd1094_set_decrypted != NULL)
(*fd1094_set_decrypted)(Machine, (UINT8 *)fd1094_userregion);
else
- memory_set_decrypted_region(0, 0, fd1094_cpuregionsize - 1, fd1094_userregion);
+ memory_set_decrypted_region(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0, fd1094_cpuregionsize - 1, fd1094_userregion);
}
/* this function checks the cache to see if the current state is cached,
diff --git a/src/mame/machine/s24fd.c b/src/mame/machine/s24fd.c
index 5bc2290ce5e..1f7dc5eb91e 100644
--- a/src/mame/machine/s24fd.c
+++ b/src/mame/machine/s24fd.c
@@ -57,7 +57,7 @@ static void s24_fd1094_setstate_and_decrypt(int state)
{
/* copy cached state */
s24_fd1094_userregion=s24_fd1094_cacheregion[i];
- memory_set_decrypted_region(1, 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
+ memory_set_decrypted_region(cpu_get_address_space(Machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
m68k_set_encrypted_opcode_range(Machine->cpu[1],0,s24_fd1094_cpuregionsize);
return;
@@ -78,7 +78,7 @@ static void s24_fd1094_setstate_and_decrypt(int state)
/* copy newly decrypted data to user region */
s24_fd1094_userregion=s24_fd1094_cacheregion[fd1094_current_cacheposition];
- memory_set_decrypted_region(1, 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
+ memory_set_decrypted_region(cpu_get_address_space(Machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
m68k_set_encrypted_opcode_range(Machine->cpu[1],0,s24_fd1094_cpuregionsize);
fd1094_current_cacheposition++;
diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c
index ebb2843b00f..ed26737d8fe 100644
--- a/src/mame/machine/scramble.c
+++ b/src/mame/machine/scramble.c
@@ -240,12 +240,12 @@ DRIVER_INIT( scramble_ppi )
DRIVER_INIT( scobra )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa803, 0xa803, 0, 0, scrambold_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa803, 0xa803, 0, 0, scrambold_background_enable_w);
}
DRIVER_INIT( atlantis )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6803, 0x6803, 0, 0, scrambold_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, scrambold_background_enable_w);
}
DRIVER_INIT( scramble )
@@ -255,14 +255,14 @@ DRIVER_INIT( scramble )
DRIVER_INIT( stratgyx )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb000, 0xb000, 0, 0, scrambold_background_green_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb002, 0xb002, 0, 0, scrambold_background_blue_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb00a, 0xb00a, 0, 0, scrambold_background_red_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb000, 0xb000, 0, 0, scrambold_background_green_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb002, 0xb002, 0, 0, scrambold_background_blue_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb00a, 0xb00a, 0, 0, scrambold_background_red_w);
}
DRIVER_INIT( tazmani2 )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb002, 0xb002, 0, 0, scrambold_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb002, 0xb002, 0, 0, scrambold_background_enable_w);
}
DRIVER_INIT( ckongs )
@@ -272,14 +272,14 @@ DRIVER_INIT( ckongs )
DRIVER_INIT( mariner )
{
/* extra ROM */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5800, 0x67ff, 0, 0, SMH_BANK1, SMH_UNMAP);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5800, 0x67ff, 0, 0, SMH_BANK1, SMH_UNMAP);
memory_set_bankptr(1, memory_region(machine, "main") + 0x5800);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9008, 0x9008, 0, 0, mariner_protection_2_r);
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb401, 0xb401, 0, 0, mariner_protection_1_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9008, 0x9008, 0, 0, mariner_protection_2_r);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb401, 0xb401, 0, 0, mariner_protection_1_r);
/* ??? (it's NOT a background enable) */
- /*memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6803, 0x6803, 0, 0, SMH_NOP);*/
+ /*memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6803, 0x6803, 0, 0, SMH_NOP);*/
}
DRIVER_INIT( frogger )
@@ -355,15 +355,15 @@ DRIVER_INIT( cavelon )
UINT8 *ROM = memory_region(machine, "main");
/* banked ROM */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_BANK1);
- memory_configure_bank(1, 0, 2, &ROM[0x00000], 0x10000);
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, SMH_BANK1);
+ memory_configure_bank(machine, 1, 0, 2, &ROM[0x00000], 0x10000);
cavelon_banksw();
/* A15 switches memory banks */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, cavelon_banksw_r, cavelon_banksw_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, cavelon_banksw_r, cavelon_banksw_w);
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2000, 0, 0, SMH_NOP); /* ??? */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3800, 0x3801, 0, 0, SMH_NOP); /* looks suspicously like
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2000, 0, 0, SMH_NOP); /* ??? */
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3800, 0x3801, 0, 0, SMH_NOP); /* looks suspicously like
an AY8910, but not sure */
state_save_register_global(cavelon_bank);
}
@@ -372,7 +372,7 @@ DRIVER_INIT( cavelon )
DRIVER_INIT( darkplnt )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb00a, 0xb00a, 0, 0, darkplnt_bullet_color_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb00a, 0xb00a, 0, 0, darkplnt_bullet_color_w);
}
DRIVER_INIT( mimonkey )
@@ -408,17 +408,17 @@ DRIVER_INIT( mimonkey )
ctr++;
}
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa804, 0xa804, 0, 0, scrambold_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa804, 0xa804, 0, 0, scrambold_background_enable_w);
}
DRIVER_INIT( mimonsco )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa804, 0xa804, 0, 0, scrambold_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa804, 0xa804, 0, 0, scrambold_background_enable_w);
}
DRIVER_INIT( mimonscr )
{
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6804, 0x6804, 0, 0, scrambold_background_enable_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6804, 0x6804, 0, 0, scrambold_background_enable_w);
}
diff --git a/src/mame/machine/segacrpt.c b/src/mame/machine/segacrpt.c
index fec38ba1439..a0ee06a4d95 100644
--- a/src/mame/machine/segacrpt.c
+++ b/src/mame/machine/segacrpt.c
@@ -233,16 +233,17 @@ static void look_for_known_plaintext(void)
}
#endif
-static void sega_decode(running_machine *machine, const char *region, const UINT8 convtable[32][4])
+static void sega_decode(running_machine *machine, const char *cputag, const UINT8 convtable[32][4])
{
int A;
- int length = memory_region_length(machine, region);
+ const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM);
+ int length = memory_region_length(machine, cputag);
int cryptlen = MIN(length, 0x8000);
- UINT8 *rom = memory_region(machine, region);
+ UINT8 *rom = memory_region(machine, cputag);
UINT8 *decrypted = auto_malloc(0xc000);
- memory_set_decrypted_region(0, 0x0000, cryptlen - 1, decrypted);
+ memory_set_decrypted_region(space, 0x0000, cryptlen - 1, decrypted);
for (A = 0x0000;A < cryptlen;A++)
{
@@ -285,7 +286,7 @@ static void sega_decode(running_machine *machine, const char *region, const UINT
-void buckrog_decode(running_machine *machine, const char *region)
+void buckrog_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -310,11 +311,11 @@ void buckrog_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void pengo_decode(running_machine *machine, const char *region)
+void pengo_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -339,11 +340,11 @@ void pengo_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void szaxxon_decode(running_machine *machine, const char *region)
+void szaxxon_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -368,11 +369,11 @@ void szaxxon_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void suprloco_decode(running_machine *machine, const char *region)
+void suprloco_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -397,11 +398,11 @@ void suprloco_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void yamato_decode(running_machine *machine, const char *region)
+void yamato_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -426,10 +427,10 @@ void yamato_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void toprollr_decode(running_machine *machine, const char *region)
+void toprollr_decode(running_machine *machine, const char *cputag)
{
/* same tables as in Yamato, but encrypted ROM is banked */
UINT8 *decrypted;
@@ -458,7 +459,8 @@ void toprollr_decode(running_machine *machine, const char *region)
int A;
- UINT8 *rom = memory_region(machine, region);
+ const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM);
+ UINT8 *rom = memory_region(machine, cputag);
int bankstart;
decrypted = auto_malloc(0x6000*3);
@@ -489,14 +491,14 @@ void toprollr_decode(running_machine *machine, const char *region)
rom[A+bankstart] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xor);
}
- memory_configure_bank(1,0,3, memory_region(machine, region),0x6000);
- memory_configure_bank_decrypted(1,0,3,decrypted,0x6000);
- memory_set_decrypted_region(0, 0x0000, 0x5fff, decrypted);
+ memory_configure_bank(machine, 1,0,3, memory_region(machine, cputag),0x6000);
+ memory_configure_bank_decrypted(machine, 1,0,3,decrypted,0x6000);
+ memory_set_decrypted_region(space, 0x0000, 0x5fff, decrypted);
memory_set_bank(1, 0);
}
-void sindbadm_decode(running_machine *machine, const char *region)
+void sindbadm_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -521,11 +523,11 @@ void sindbadm_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void regulus_decode(running_machine *machine, const char *region)
+void regulus_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -550,11 +552,11 @@ void regulus_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void mrviking_decode(running_machine *machine, const char *region)
+void mrviking_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -579,11 +581,11 @@ void mrviking_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void swat_decode(running_machine *machine, const char *region)
+void swat_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -608,11 +610,11 @@ void swat_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void flicky_decode(running_machine *machine, const char *region)
+void flicky_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -637,11 +639,11 @@ void flicky_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void futspy_decode(running_machine *machine, const char *region)
+void futspy_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -666,11 +668,11 @@ void futspy_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void wmatch_decode(running_machine *machine, const char *region)
+void wmatch_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -695,11 +697,11 @@ void wmatch_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void bullfgtj_decode(running_machine *machine, const char *region)
+void bullfgtj_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -724,11 +726,11 @@ void bullfgtj_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void pbaction_decode(running_machine *machine, const char *region)
+void pbaction_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -753,11 +755,11 @@ void pbaction_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void spatter_decode(running_machine *machine, const char *region)
+void spatter_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -782,11 +784,11 @@ void spatter_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void jongkyo_decode(running_machine *machine, const char *region)
+void jongkyo_decode(running_machine *machine, const char *cputag)
{
/* encrypted ROM is banked */
UINT8 *decrypted;
@@ -815,7 +817,8 @@ void jongkyo_decode(running_machine *machine, const char *region)
int A;
- UINT8 *rom = memory_region(machine, region);
+ const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM);
+ UINT8 *rom = memory_region(machine, cputag);
decrypted = auto_malloc(0x9000);
for (A = 0x0000;A < 0x9000;A++)
@@ -847,14 +850,14 @@ void jongkyo_decode(running_machine *machine, const char *region)
rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xor);
}
- memory_configure_bank(1,0,8, memory_region(machine, region)+0x7000,0x0400);
- memory_configure_bank_decrypted(1,0,8,decrypted+0x7000,0x0400);
- memory_set_decrypted_region(0, 0x0000, 0x6bff, decrypted);
+ memory_configure_bank(machine, 1,0,8, memory_region(machine, cputag)+0x7000,0x0400);
+ memory_configure_bank_decrypted(machine, 1,0,8,decrypted+0x7000,0x0400);
+ memory_set_decrypted_region(space, 0x0000, 0x6bff, decrypted);
memory_set_bank(1, 0);
}
-void pitfall2_decode(running_machine *machine, const char *region)
+void pitfall2_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -879,11 +882,11 @@ void pitfall2_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void nprinces_decode(running_machine *machine, const char *region)
+void nprinces_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -908,11 +911,11 @@ void nprinces_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void seganinj_decode(running_machine *machine, const char *region)
+void seganinj_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -937,11 +940,11 @@ void seganinj_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void imsorry_decode(running_machine *machine, const char *region)
+void imsorry_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -966,11 +969,11 @@ void imsorry_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void teddybb_decode(running_machine *machine, const char *region)
+void teddybb_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -995,11 +998,11 @@ void teddybb_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void myheroj_decode(running_machine *machine, const char *region)
+void myheroj_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -1024,11 +1027,11 @@ void myheroj_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void hvymetal_decode(running_machine *machine, const char *region)
+void hvymetal_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -1053,11 +1056,11 @@ void hvymetal_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
-void lvcards_decode(running_machine *machine, const char *region)
+void lvcards_decode(running_machine *machine, const char *cputag)
{
static const UINT8 convtable[32][4] =
{
@@ -1082,7 +1085,7 @@ void lvcards_decode(running_machine *machine, const char *region)
};
- sega_decode(machine, region, convtable);
+ sega_decode(machine, cputag, convtable);
}
@@ -1098,7 +1101,7 @@ void lvcards_decode(running_machine *machine, const char *region)
******************************************************************************/
-static void sega_decode_2(running_machine *machine,const char *region,
+static void sega_decode_2(running_machine *machine,const char *cputag,
const UINT8 opcode_xor[64],const int opcode_swap_select[64],
const UINT8 data_xor[64],const int data_swap_select[64])
{
@@ -1114,10 +1117,11 @@ static void sega_decode_2(running_machine *machine,const char *region,
};
- UINT8 *rom = memory_region(machine, region);
+ const address_space *space = cputag_get_address_space(machine, cputag, ADDRESS_SPACE_PROGRAM);
+ UINT8 *rom = memory_region(machine, cputag);
UINT8 *decrypted = auto_malloc(0x8000);
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypted);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypted);
for (A = 0x0000;A < 0x8000;A++)
@@ -1145,7 +1149,7 @@ static void sega_decode_2(running_machine *machine,const char *region,
-void fdwarrio_decode(running_machine *machine, const char *region)
+void fdwarrio_decode(running_machine *machine, const char *cputag)
{
static const UINT8 opcode_xor[64] =
{
@@ -1189,11 +1193,11 @@ void fdwarrio_decode(running_machine *machine, const char *region)
};
- sega_decode_2(machine,region,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
}
-void astrofl_decode(running_machine *machine, const char *region)
+void astrofl_decode(running_machine *machine, const char *cputag)
{
static const UINT8 opcode_xor[64] =
{
@@ -1234,11 +1238,11 @@ void astrofl_decode(running_machine *machine, const char *region)
};
- sega_decode_2(machine,region,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
}
-void wboy2_decode(running_machine *machine, const char *region)
+void wboy2_decode(running_machine *machine, const char *cputag)
{
static const UINT8 opcode_xor[64] =
{
@@ -1299,11 +1303,11 @@ void wboy2_decode(running_machine *machine, const char *region)
};
- sega_decode_2(machine,region,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
}
-void robowres_decode(running_machine *machine, const char *region)
+void robowres_decode(running_machine *machine, const char *cputag)
{
static const UINT8 opcode_xor[64] =
{
@@ -1352,7 +1356,7 @@ void robowres_decode(running_machine *machine, const char *region)
};
- sega_decode_2(machine,region,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
+ sega_decode_2(machine,cputag,opcode_xor,opcode_swap_select,data_xor,data_swap_select);
}
@@ -1363,7 +1367,7 @@ void robowres_decode(running_machine *machine, const char *region)
******************************************************************************/
-static void sega_decode_317(running_machine *machine, const char *region, int order, int opcode_shift, int data_shift)
+static void sega_decode_317(running_machine *machine, const char *cputag, int order, int opcode_shift, int data_shift)
{
static const UINT8 xor1_317[1+64] =
{
@@ -1412,12 +1416,12 @@ static void sega_decode_317(running_machine *machine, const char *region, int or
};
if (order)
- sega_decode_2( machine, region, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift );
+ sega_decode_2( machine, cputag, xor2_317+opcode_shift, swap2_317+opcode_shift, xor1_317+data_shift, swap1_317+data_shift );
else
- sega_decode_2( machine, region, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift );
+ sega_decode_2( machine, cputag, xor1_317+opcode_shift, swap1_317+opcode_shift, xor2_317+data_shift, swap2_317+data_shift );
}
-void spcpostn_decode(running_machine *machine, const char *region) { sega_decode_317( machine, region, 0, 0, 1 ); }
-void calorie_decode(running_machine *machine, const char *region) { sega_decode_317( machine, region, 1, 0, 0 ); }
-void gardia_decode(running_machine *machine, const char *region) { sega_decode_317( machine, region, 1, 1, 1 ); }
-void gardiab_decode(running_machine *machine, const char *region) { sega_decode_317( machine, region, 0, 1, 2 ); }
+void spcpostn_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 0, 0, 1 ); }
+void calorie_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 1, 0, 0 ); }
+void gardia_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 1, 1, 1 ); }
+void gardiab_decode(running_machine *machine, const char *cputag) { sega_decode_317( machine, cputag, 0, 1, 2 ); }
diff --git a/src/mame/machine/segacrpt.h b/src/mame/machine/segacrpt.h
index 952850a8c91..962a17b958e 100644
--- a/src/mame/machine/segacrpt.h
+++ b/src/mame/machine/segacrpt.h
@@ -1,35 +1,35 @@
-void buckrog_decode(running_machine *machine, const char *region);
-void pengo_decode(running_machine *machine, const char *region);
-void szaxxon_decode(running_machine *machine, const char *region);
-void suprloco_decode(running_machine *machine, const char *region);
-void yamato_decode(running_machine *machine, const char *region);
-void toprollr_decode(running_machine *machine, const char *region);
-void sindbadm_decode(running_machine *machine, const char *region);
-void regulus_decode(running_machine *machine, const char *region);
-void mrviking_decode(running_machine *machine, const char *region);
-void swat_decode(running_machine *machine, const char *region);
-void flicky_decode(running_machine *machine, const char *region);
-void futspy_decode(running_machine *machine, const char *region);
-void wmatch_decode(running_machine *machine, const char *region);
-void bullfgtj_decode(running_machine *machine, const char *region);
-void pbaction_decode(running_machine *machine, const char *region);
-void spatter_decode(running_machine *machine, const char *region);
-void jongkyo_decode(running_machine *machine, const char *region);
-void pitfall2_decode(running_machine *machine, const char *region);
-void nprinces_decode(running_machine *machine, const char *region);
-void seganinj_decode(running_machine *machine, const char *region);
-void imsorry_decode(running_machine *machine, const char *region);
-void teddybb_decode(running_machine *machine, const char *region);
-void myheroj_decode(running_machine *machine, const char *region);
-void hvymetal_decode(running_machine *machine, const char *region);
-void lvcards_decode(running_machine *machine, const char *region);
+void buckrog_decode(running_machine *machine, const char *cputag);
+void pengo_decode(running_machine *machine, const char *cputag);
+void szaxxon_decode(running_machine *machine, const char *cputag);
+void suprloco_decode(running_machine *machine, const char *cputag);
+void yamato_decode(running_machine *machine, const char *cputag);
+void toprollr_decode(running_machine *machine, const char *cputag);
+void sindbadm_decode(running_machine *machine, const char *cputag);
+void regulus_decode(running_machine *machine, const char *cputag);
+void mrviking_decode(running_machine *machine, const char *cputag);
+void swat_decode(running_machine *machine, const char *cputag);
+void flicky_decode(running_machine *machine, const char *cputag);
+void futspy_decode(running_machine *machine, const char *cputag);
+void wmatch_decode(running_machine *machine, const char *cputag);
+void bullfgtj_decode(running_machine *machine, const char *cputag);
+void pbaction_decode(running_machine *machine, const char *cputag);
+void spatter_decode(running_machine *machine, const char *cputag);
+void jongkyo_decode(running_machine *machine, const char *cputag);
+void pitfall2_decode(running_machine *machine, const char *cputag);
+void nprinces_decode(running_machine *machine, const char *cputag);
+void seganinj_decode(running_machine *machine, const char *cputag);
+void imsorry_decode(running_machine *machine, const char *cputag);
+void teddybb_decode(running_machine *machine, const char *cputag);
+void myheroj_decode(running_machine *machine, const char *cputag);
+void hvymetal_decode(running_machine *machine, const char *cputag);
+void lvcards_decode(running_machine *machine, const char *cputag);
-void fdwarrio_decode(running_machine *machine, const char *region);
-void astrofl_decode(running_machine *machine, const char *region);
-void wboy2_decode(running_machine *machine, const char *region);
-void robowres_decode(running_machine *machine, const char *region);
-void calorie_decode(running_machine *machine, const char *region);
-void spcpostn_decode(running_machine *machine, const char *region);
-void gardia_decode(running_machine *machine, const char *region);
-void gardiab_decode(running_machine *machine, const char *region);
+void fdwarrio_decode(running_machine *machine, const char *cputag);
+void astrofl_decode(running_machine *machine, const char *cputag);
+void wboy2_decode(running_machine *machine, const char *cputag);
+void robowres_decode(running_machine *machine, const char *cputag);
+void calorie_decode(running_machine *machine, const char *cputag);
+void spcpostn_decode(running_machine *machine, const char *cputag);
+void gardia_decode(running_machine *machine, const char *cputag);
+void gardiab_decode(running_machine *machine, const char *cputag);
diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c
index 5189bb7f094..98d85631723 100644
--- a/src/mame/machine/segaic16.c
+++ b/src/mame/machine/segaic16.c
@@ -189,7 +189,7 @@ void segaic16_memory_mapper_set_decrypted(running_machine *machine, UINT8 *decry
if (region_start >= romsize)
continue;
- memory_configure_bank_decrypted(banknum, 0, 1, decrypted + region_start, 0);
+ memory_configure_bank_decrypted(machine, banknum, 0, 1, decrypted + region_start, 0);
memory_set_bank(banknum, 0);
}
}
@@ -327,7 +327,7 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper
if (LOG_MEMORY_MAP) mame_printf_debug("----\nRemapping:\n");
/* first reset everything back to the beginning */
- memory_install_readwrite16_handler(machine, cpu_get_index(chip->cpu), ADDRESS_SPACE_PROGRAM, 0x000000, 0xffffff, 0, 0, segaic16_memory_mapper_lsb_r, segaic16_memory_mapper_lsb_w);
+ memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(chip->cpu)], ADDRESS_SPACE_PROGRAM), 0x000000, 0xffffff, 0, 0, segaic16_memory_mapper_lsb_r, segaic16_memory_mapper_lsb_w);
/* loop over the regions */
for (rgnum = 0; chip->map[rgnum].regbase != 0; rgnum++)
@@ -361,16 +361,16 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper
/* map it */
if (read)
- memory_install_read16_handler(machine, cpu_get_index(chip->cpu), ADDRESS_SPACE_PROGRAM, region_start, region_end, 0, region_mirror, read);
+ memory_install_read16_handler(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), region_start, region_end, 0, region_mirror, read);
if (write)
- memory_install_write16_handler(machine, cpu_get_index(chip->cpu), ADDRESS_SPACE_PROGRAM, region_start, region_end, 0, region_mirror, write);
+ memory_install_write16_handler(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), region_start, region_end, 0, region_mirror, write);
/* set the bank pointer */
if (banknum && read)
{
if (rgn->base)
{
- memory_configure_bank(banknum, 0, 1, *rgn->base, 0);
+ memory_configure_bank(machine, banknum, 0, 1, *rgn->base, 0);
memory_set_bank(banknum, 0);
}
else if (rgn->romoffset != ~0)
@@ -381,9 +381,9 @@ static void update_memory_mapping(running_machine *machine, struct memory_mapper
if (!decrypted)
decrypted = fd1089_get_decrypted_base();
- memory_configure_bank(banknum, 0, 1, (UINT8 *)chip->cpu->region + region_start, 0);
+ memory_configure_bank(machine, banknum, 0, 1, (UINT8 *)chip->cpu->region + region_start, 0);
if (decrypted)
- memory_configure_bank_decrypted(banknum, 0, 1, decrypted ? (decrypted + region_start) : 0, 0);
+ memory_configure_bank_decrypted(machine, banknum, 0, 1, decrypted ? (decrypted + region_start) : 0, 0);
memory_set_bank(banknum, 0);
}
}
diff --git a/src/mame/machine/segas32.c b/src/mame/machine/segas32.c
index 501028f8773..247264e8434 100644
--- a/src/mame/machine/segas32.c
+++ b/src/mame/machine/segas32.c
@@ -36,12 +36,13 @@ static const UINT8 ga2_v25_opcode_table[256] = {
static void nec_v25_cpu_decrypt(running_machine *machine)
{
int i;
+ const address_space *space = cputag_get_address_space(machine, "mcu", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "mcu");
UINT8* decrypted = auto_malloc(0x100000);
UINT8* temp = malloc_or_die(0x100000);
// set CPU3 opcode base
- memory_set_decrypted_region(2, 0x00000, 0xfffff, decrypted);
+ memory_set_decrypted_region(space, 0x00000, 0xfffff, decrypted);
// make copy of ROM so original can be overwritten
memcpy(temp, rom, 0x10000);
diff --git a/src/mame/machine/simpsons.c b/src/mame/machine/simpsons.c
index 992d3b88760..f8a1ced0286 100644
--- a/src/mame/machine/simpsons.c
+++ b/src/mame/machine/simpsons.c
@@ -132,11 +132,11 @@ MACHINE_RESET( simpsons )
simpsons_firq_enabled = 0;
/* init the default banks */
- memory_configure_bank(1, 0, 64, memory_region(machine, "main") + 0x10000, 0x2000);
+ memory_configure_bank(machine, 1, 0, 64, memory_region(machine, "main") + 0x10000, 0x2000);
memory_set_bank(1, 0);
- memory_configure_bank(2, 0, 2, memory_region(machine, "audio") + 0x10000, 0);
- memory_configure_bank(2, 2, 6, memory_region(machine, "audio") + 0x10000, 0x4000);
+ memory_configure_bank(machine, 2, 0, 2, memory_region(machine, "audio") + 0x10000, 0);
+ memory_configure_bank(machine, 2, 2, 6, memory_region(machine, "audio") + 0x10000, 0x4000);
memory_set_bank(2, 0);
simpsons_video_banking( machine, 0 );
diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c
index 935d59cd990..6b3e6e018a4 100644
--- a/src/mame/machine/stfight.c
+++ b/src/mame/machine/stfight.c
@@ -49,11 +49,12 @@ static int stfight_coin_mech_query;
DRIVER_INIT( empcity )
{
+ const address_space *space = cputag_get_address_space(machine, "main", ADDRESS_SPACE_PROGRAM);
UINT8 *rom = memory_region(machine, "main");
int A;
decrypt = auto_malloc(0x8000);
- memory_set_decrypted_region(0, 0x0000, 0x7fff, decrypt);
+ memory_set_decrypted_region(space, 0x0000, 0x7fff, decrypt);
for (A = 0;A < 0x8000;A++)
{
diff --git a/src/mame/machine/stvprot.c b/src/mame/machine/stvprot.c
index 1bfd8397946..669ad8abb30 100644
--- a/src/mame/machine/stvprot.c
+++ b/src/mame/machine/stvprot.c
@@ -329,7 +329,7 @@ static WRITE32_HANDLER ( a_bus_ctrl_w )
void install_standard_protection(running_machine *machine)
{
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4fffff0, 0x4ffffff, 0, 0, a_bus_ctrl_r, a_bus_ctrl_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4fffff0, 0x4ffffff, 0, 0, a_bus_ctrl_r, a_bus_ctrl_w);
}
static READ32_HANDLER(astrass_prot_r)
@@ -363,7 +363,7 @@ static WRITE32_HANDLER(astrass_prot_w)
void install_astrass_protection(running_machine *machine)
{
ctrl_index = -1;
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4fffff0, 0x4ffffff, 0, 0, astrass_prot_r, astrass_prot_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4fffff0, 0x4ffffff, 0, 0, astrass_prot_r, astrass_prot_w);
}
@@ -505,9 +505,9 @@ void install_decathlt_protection(running_machine *machine)
{
/* It uploads 2 tables here, then performs what looks like a number of transfers, setting
a source address of some kind (scrambled?) and then making many reads from a single address */
- memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x37FFFF0, 0x37FFFFF, 0, 0, decathlt_prot_r, decathlt_prot_w);
+ memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x37FFFF0, 0x37FFFFF, 0, 0, decathlt_prot_r, decathlt_prot_w);
/* It uploads 2 tables here too, but nothing else, mirror? unused? */
-// memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x27FFFF0, 0x27FFFFF, 0, 0, decathlt_prot_r, decathlt_prot_w);
+// memory_install_readwrite32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x27FFFF0, 0x27FFFFF, 0, 0, decathlt_prot_r, decathlt_prot_w);
}
void stv_register_protection_savestates(void)
diff --git a/src/mame/machine/taitosj.c b/src/mame/machine/taitosj.c
index ae65cc70cdd..47fba2513b1 100644
--- a/src/mame/machine/taitosj.c
+++ b/src/mame/machine/taitosj.c
@@ -26,8 +26,8 @@ static UINT32 address;
MACHINE_START( taitosj )
{
- memory_configure_bank(1, 0, 1, memory_region(machine, "main") + 0x6000, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "main") + 0x10000, 0);
+ memory_configure_bank(machine, 1, 0, 1, memory_region(machine, "main") + 0x6000, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "main") + 0x10000, 0);
state_save_register_global(fromz80);
state_save_register_global(toz80);
diff --git a/src/mame/machine/theglobp.c b/src/mame/machine/theglobp.c
index ac35d5c549c..e19f13d2001 100644
--- a/src/mame/machine/theglobp.c
+++ b/src/mame/machine/theglobp.c
@@ -252,7 +252,7 @@ MACHINE_RESET( theglobp )
/* The initial state of the counter is 0x0A */
counter = 0x0A;
- memory_configure_bank(1, 0, 4, &RAM[0x10000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, &RAM[0x10000], 0x4000);
memory_set_bank(1, 2);
state_save_register_global(counter);
diff --git a/src/mame/machine/tnzs.c b/src/mame/machine/tnzs.c
index 8829130df5c..a2998f1c6eb 100644
--- a/src/mame/machine/tnzs.c
+++ b/src/mame/machine/tnzs.c
@@ -551,7 +551,7 @@ DRIVER_INIT( drtoppel )
memcpy(&RAM[0x08000],&RAM[0x18000],0x4000);
/* drtoppel writes to the palette RAM area even if it has PROMs! We have to patch it out. */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf800, 0xfbff, 0, 0, SMH_NOP);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf800, 0xfbff, 0, 0, SMH_NOP);
}
DRIVER_INIT( chukatai )
@@ -569,7 +569,7 @@ DRIVER_INIT( tnzs )
memcpy(&RAM[0x08000],&RAM[0x2c000],0x4000);
/* we need to install a kludge to avoid problems with a bug in the original code */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xef10, 0xef10, 0, 0, tnzs_sync_kludge_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xef10, 0xef10, 0, 0, tnzs_sync_kludge_w);
}
DRIVER_INIT( tnzsb )
@@ -582,7 +582,7 @@ DRIVER_INIT( tnzsb )
memcpy(&RAM[0x08000],&RAM[0x2c000],0x4000);
/* we need to install a kludge to avoid problems with a bug in the original code */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xef10, 0xef10, 0, 0, tnzs_sync_kludge_w);
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xef10, 0xef10, 0, 0, tnzs_sync_kludge_w);
}
DRIVER_INIT( kabukiz )
@@ -595,9 +595,9 @@ DRIVER_INIT( insectx )
mcu_type = MCU_NONE_INSECTX;
/* this game has no mcu, replace the handler with plain input port handlers */
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xc000, 0xc000, 0, 0, input_port_2_r );
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xc001, 0xc001, 0, 0, input_port_3_r );
- memory_install_read8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0xc002, 0xc002, 0, 0, input_port_4_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc000, 0xc000, 0, 0, input_port_2_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc001, 0xc001, 0, 0, input_port_3_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc002, 0xc002, 0, 0, input_port_4_r );
}
DRIVER_INIT( kageki )
diff --git a/src/mame/machine/vsnes.c b/src/mame/machine/vsnes.c
index 0ccaa92e5cf..5172fad9387 100644
--- a/src/mame/machine/vsnes.c
+++ b/src/mame/machine/vsnes.c
@@ -293,7 +293,7 @@ static WRITE8_HANDLER( vsnormal_vrom_banking )
DRIVER_INIT( vsnormal )
{
/* vrom switching is enabled with bit 2 of $4016 */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, vsnormal_vrom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, vsnormal_vrom_banking );
}
static WRITE8_HANDLER( ppuRC2C05_protection )
@@ -322,7 +322,7 @@ DRIVER_INIT( suprmrio )
DRIVER_INIT_CALL(vsnormal);
/* extra ram at $6000 is enabled with bit 1 of $4016 */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
/* now override the vidaccess callback */
@@ -388,7 +388,7 @@ static WRITE8_HANDLER( gun_in0_w )
DRIVER_INIT( duckhunt )
{
/* vrom switching is enabled with bit 2 of $4016 */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w );
/* common init */
init_vsnes(machine);
@@ -436,7 +436,7 @@ DRIVER_INIT( goonies )
memcpy( &prg[0x08000], &prg[0x18000], 0x8000 );
/* banking is done with writes to the $8000-$ffff area */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, goonies_rom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, goonies_rom_banking );
/* common init */
init_vsnes(machine);
@@ -453,7 +453,7 @@ DRIVER_INIT( vsgradus )
memcpy( &prg[0x08000], &prg[0x18000], 0x8000 );
/* banking is done with writes to the $8000-$ffff area */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, goonies_rom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, goonies_rom_banking );
/* common init */
init_vsnes(machine);
@@ -479,7 +479,7 @@ DRIVER_INIT( hogalley )
{
/* vrom switching is enabled with bit 2 of $4016 */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w );
/* common init */
init_vsnes(machine);
@@ -524,11 +524,11 @@ DRIVER_INIT( vsgshoe )
memcpy (&prg[0x08000], &prg[0x12000], 0x2000);
/* Protection */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2002, 0x2002, 0, 0, vsgshoe_security_r );
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2002, 0x2002, 0, 0, vsgshoe_security_r );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
/* vrom switching is enabled with bit 2 of $4016 */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, gun_in0_r, vsgshoe_gun_in0_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, gun_in0_r, vsgshoe_gun_in0_w );
/* common init */
init_vsnes(machine);
@@ -664,7 +664,7 @@ DRIVER_INIT( drmario )
memcpy( &prg[0x0c000], &prg[0x1c000], 0x4000 );
/* MMC1 mapper at writes to $8000-$ffff */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, drmario_rom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, drmario_rom_banking );
drmario_shiftreg = 0;
drmario_shiftcount = 0;
@@ -761,7 +761,7 @@ DRIVER_INIT( cstlevna )
memcpy( &prg[0x08000], &prg[0x28000], 0x8000 );
/* banking is done with writes to the $8000-$ffff area */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, castlevania_rom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, castlevania_rom_banking );
/* common init */
init_vsnes(machine);
@@ -789,11 +789,11 @@ DRIVER_INIT( topgun )
memcpy( &prg[0x08000], &prg[0x28000], 0x8000 );
/* banking is done with writes to the $8000-$ffff area */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, castlevania_rom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, castlevania_rom_banking );
/* tap on the PPU, due to some tricky protection */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2002, 0x2002, 0, 0, topgun_security_r );
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2002, 0x2002, 0, 0, topgun_security_r );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
/* common init */
init_vsnes(machine);
@@ -971,10 +971,10 @@ DRIVER_INIT( MMC3 )
memcpy( &prg[0xe000], &prg[(MMC3_prg_chunks-1) * 0x4000 + 0x12000], 0x2000 );
/* MMC3 mapper at writes to $8000-$ffff */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, mapper4_w );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mapper4_w );
/* extra ram at $6000-$7fff */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
/* common init */
@@ -1019,7 +1019,7 @@ DRIVER_INIT( rbibb )
DRIVER_INIT_CALL(MMC3);
/* RBI Base ball hack */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5e00, 0x5e01, 0, 0, rbi_hack_r) ;
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5e00, 0x5e01, 0, 0, rbi_hack_r) ;
remapped_colortable = rp2c04003_colortable;
}
@@ -1069,10 +1069,10 @@ DRIVER_INIT( supxevs )
DRIVER_INIT_CALL(MMC3);
/* Vs. Super Xevious Protection */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x54ff, 0x54ff, 0, 0, supxevs_read_prot_1_r );
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5678, 0x5678, 0, 0, supxevs_read_prot_2_r );
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x578f, 0x578f, 0, 0, supxevs_read_prot_3_r );
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5567, 0x5567, 0, 0, supxevs_read_prot_4_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x54ff, 0x54ff, 0, 0, supxevs_read_prot_1_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5678, 0x5678, 0, 0, supxevs_read_prot_2_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x578f, 0x578f, 0, 0, supxevs_read_prot_3_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5567, 0x5567, 0, 0, supxevs_read_prot_4_r );
remapped_colortable = rp2c04001_colortable;
}
@@ -1104,7 +1104,7 @@ DRIVER_INIT( tkoboxng )
DRIVER_INIT_CALL(MMC3);
/* security device at $5e00-$5e01 */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x5e00, 0x5e01, 0, 0, tko_security_r );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5e00, 0x5e01, 0, 0, tko_security_r );
/* now override the vidaccess callback */
/* we need to remap color tables */
@@ -1118,7 +1118,7 @@ DRIVER_INIT( vsfdf )
{
DRIVER_INIT_CALL(MMC3);
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w );
vsnes_gun_controller = 1;
vsnes_do_vrom_bank = 0;
@@ -1171,7 +1171,7 @@ DRIVER_INIT( platoon )
memcpy( &prg[0x08000], &prg[0x10000], 0x4000 );
memcpy( &prg[0x0c000], &prg[0x2c000], 0x4000 );
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xffff, 0, 0, mapper68_rom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mapper68_rom_banking );
init_vsnes(machine);
@@ -1198,10 +1198,10 @@ static READ8_HANDLER ( set_bnglngby_irq_r )
DRIVER_INIT( bnglngby )
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0231, 0x0231, 0, 0, set_bnglngby_irq_r, set_bnglngby_irq_w );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0231, 0x0231, 0, 0, set_bnglngby_irq_r, set_bnglngby_irq_w );
/* extra ram */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
ret = 0;
@@ -1231,8 +1231,8 @@ DRIVER_INIT( jajamaru )
//Maybe it should be a DOP (double NOP)
/* Protection */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2002, 0x2002, 0, 0, jajamaru_security_r );
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2002, 0x2002, 0, 0, jajamaru_security_r );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
/* common init */
init_vsnes(machine);
@@ -1254,8 +1254,8 @@ static READ8_HANDLER( mightybj_security_r )
DRIVER_INIT( mightybj )
{
/* Protection */
- memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2002, 0x2002, 0, 0, mightybj_security_r );
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
+ memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2002, 0x2002, 0, 0, mightybj_security_r );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x2001, 0, 0, ppuRC2C05_protection );
/* common init */
init_vsnes(machine);
@@ -1286,12 +1286,12 @@ DRIVER_INIT( vstennis )
UINT8 *prg = memory_region( machine, "main" );
/* vrom switching is enabled with bit 2 of $4016 */
- memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, vstennis_vrom_banking );
- memory_install_write8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x4016, 0x4016, 0, 0, vstennis_vrom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, vstennis_vrom_banking );
+ memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, vstennis_vrom_banking );
/* shared ram at $6000 */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
- memory_install_readwrite8_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, &prg[0x6000]);
}
@@ -1361,7 +1361,7 @@ DRIVER_INIT( btlecity )
DRIVER_INIT( vstetris )
{
/* extra ram at $6000 is enabled with bit 1 of $4016 */
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1 );
memory_set_bankptr(1, auto_malloc(0x2000));
init_vsnes(machine);
diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c
index 69902c52620..1146bb35390 100644
--- a/src/mame/machine/williams.c
+++ b/src/mame/machine/williams.c
@@ -375,8 +375,8 @@ MACHINE_RESET( williams )
MACHINE_RESET_CALL(williams_common);
/* configure the memory bank */
- memory_configure_bank(1, 0, 1, williams_videoram, 0);
- memory_configure_bank(1, 1, 1, memory_region(machine, "main") + 0x10000, 0);
+ memory_configure_bank(machine, 1, 0, 1, williams_videoram, 0);
+ memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "main") + 0x10000, 0);
}
@@ -449,8 +449,8 @@ MACHINE_RESET( williams2 )
pia_reset();
/* configure memory banks */
- memory_configure_bank(1, 0, 1, williams_videoram, 0);
- memory_configure_bank(1, 1, 4, memory_region(machine, "main") + 0x10000, 0x10000);
+ memory_configure_bank(machine, 1, 0, 1, williams_videoram, 0);
+ memory_configure_bank(machine, 1, 1, 4, memory_region(machine, "main") + 0x10000, 0x10000);
/* make sure our banking is reset */
williams2_bank_select_w(space, 0, 0);
@@ -495,8 +495,8 @@ WRITE8_HANDLER( williams2_bank_select_w )
{
/* page 0 is video ram */
case 0:
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x8fff, 0, 0, SMH_BANK1);
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x87ff, 0, 0, SMH_BANK4);
+ memory_install_read8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK1);
+ memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK4);
memory_set_bank(1, 0);
memory_set_bankptr(4, &williams_videoram[0x8000]);
break;
@@ -504,15 +504,15 @@ WRITE8_HANDLER( williams2_bank_select_w )
/* pages 1 and 2 are ROM */
case 1:
case 2:
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x8fff, 0, 0, SMH_BANK1);
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x87ff, 0, 0, SMH_BANK4);
+ memory_install_read8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK1);
+ memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK4);
memory_set_bank(1, 1 + ((vram_bank & 6) >> 1));
memory_set_bankptr(4, &williams_videoram[0x8000]);
break;
/* page 3 accesses palette RAM; the remaining areas are as if page 1 ROM was selected */
case 3:
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x87ff, 0, 0, SMH_BANK4, williams2_paletteram_w);
+ memory_install_readwrite8_handler(space, 0x8000, 0x87ff, 0, 0, SMH_BANK4, williams2_paletteram_w);
memory_set_bank(1, 1 + ((vram_bank & 4) >> 1));
memory_set_bankptr(4, paletteram);
break;
@@ -727,7 +727,7 @@ MACHINE_RESET( defender )
MACHINE_RESET_CALL(williams_common);
/* configure the banking and make sure it is reset to 0 */
- memory_configure_bank(1, 0, 9, &memory_region(machine, "main")[0x10000], 0x1000);
+ memory_configure_bank(machine, 1, 0, 9, &memory_region(machine, "main")[0x10000], 0x1000);
defender_bank_select_w(space, 0, 0);
state_save_register_postload(machine, defender_postload, NULL);
@@ -762,13 +762,13 @@ WRITE8_HANDLER( defender_bank_select_w )
case 7:
case 8:
case 9:
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_UNMAP);
+ memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, SMH_BANK1, SMH_UNMAP);
memory_set_bank(1, vram_bank - 1);
break;
/* pages A-F are not connected */
default:
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xcfff, 0, 0, SMH_NOP, SMH_NOP);
+ memory_install_readwrite8_handler(space, 0xc000, 0xcfff, 0, 0, SMH_NOP, SMH_NOP);
break;
}
}
@@ -821,11 +821,11 @@ MACHINE_RESET( blaster )
MACHINE_RESET_CALL(williams_common);
/* banking is different for blaster */
- memory_configure_bank(1, 0, 1, williams_videoram, 0);
- memory_configure_bank(1, 1, 16, memory_region(machine, "main") + 0x18000, 0x4000);
+ memory_configure_bank(machine, 1, 0, 1, williams_videoram, 0);
+ memory_configure_bank(machine, 1, 1, 16, memory_region(machine, "main") + 0x18000, 0x4000);
- memory_configure_bank(2, 0, 1, williams_videoram + 0x4000, 0);
- memory_configure_bank(2, 1, 16, memory_region(machine, "main") + 0x10000, 0x0000);
+ memory_configure_bank(machine, 2, 0, 1, williams_videoram + 0x4000, 0);
+ memory_configure_bank(machine, 2, 1, 16, memory_region(machine, "main") + 0x10000, 0x0000);
state_save_register_global(blaster_bank);
}
diff --git a/src/mame/video/bfm_adr2.c b/src/mame/video/bfm_adr2.c
index 7dcbc2ae9e5..1951af64bf4 100644
--- a/src/mame/video/bfm_adr2.c
+++ b/src/mame/video/bfm_adr2.c
@@ -188,7 +188,7 @@ VIDEO_RESET( adder2 )
{
UINT8 *rom = memory_region(machine, "adder2");
- memory_configure_bank(2, 0, 4, &rom[0x00000], 0x08000);
+ memory_configure_bank(machine, 2, 0, 4, &rom[0x00000], 0x08000);
memory_set_bank(2,0&0x03);
}
diff --git a/src/mame/video/combatsc.c b/src/mame/video/combatsc.c
index 713d5cb5d71..e81dc40276d 100644
--- a/src/mame/video/combatsc.c
+++ b/src/mame/video/combatsc.c
@@ -416,14 +416,14 @@ WRITE8_HANDLER( combascb_bankselect_w )
if (data == 0x1f)
{
memory_set_bankptr(1,page + 0x20000 + 0x4000 * (data & 1));
- memory_install_read8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4400, 0x4403, 0, 0, combascb_io_r);/* IO RAM & Video Registers */
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4400, 0x4400, 0, 0, combascb_priority_w);
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4800, 0x4800, 0, 0, combascb_sh_irqtrigger_w);
- memory_install_write8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4c00, 0x4c00, 0, 0, combasc_vreg_w);
+ memory_install_read8_handler(space, 0x4400, 0x4403, 0, 0, combascb_io_r);/* IO RAM & Video Registers */
+ memory_install_write8_handler(space, 0x4400, 0x4400, 0, 0, combascb_priority_w);
+ memory_install_write8_handler(space, 0x4800, 0x4800, 0, 0, combascb_sh_irqtrigger_w);
+ memory_install_write8_handler(space, 0x4c00, 0x4c00, 0, 0, combasc_vreg_w);
}
else
{
- memory_install_readwrite8_handler(space->machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_BANK1, SMH_UNMAP); /* banked ROM */
+ memory_install_readwrite8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_BANK1, SMH_UNMAP); /* banked ROM */
}
}
}
diff --git a/src/mame/video/galivan.c b/src/mame/video/galivan.c
index 7de955de24b..5fcb957cca6 100644
--- a/src/mame/video/galivan.c
+++ b/src/mame/video/galivan.c
@@ -184,7 +184,7 @@ VIDEO_START( galivan )
{
/* configure ROM banking */
UINT8 *rombase = memory_region(machine, "main");
- memory_configure_bank(1, 0, 2, &rombase[0x10000], 0x2000);
+ memory_configure_bank(machine, 1, 0, 2, &rombase[0x10000], 0x2000);
bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows, 16,16,128,128);
tx_tilemap = tilemap_create(get_tx_tile_info,tilemap_scan_cols,8,8,32,32);
@@ -203,7 +203,7 @@ VIDEO_START( ninjemak )
{
/* configure ROM banking */
UINT8 *rombase = memory_region(machine, "main");
- memory_configure_bank(1, 0, 4, &rombase[0x10000], 0x2000);
+ memory_configure_bank(machine, 1, 0, 4, &rombase[0x10000], 0x2000);
bg_tilemap = tilemap_create(ninjemak_get_bg_tile_info,tilemap_scan_cols, 16,16,512,32);
tx_tilemap = tilemap_create(ninjemak_get_tx_tile_info,tilemap_scan_cols,8,8,32,32);
diff --git a/src/mame/video/gunsmoke.c b/src/mame/video/gunsmoke.c
index fe1026c49e5..e2fb57e630b 100644
--- a/src/mame/video/gunsmoke.c
+++ b/src/mame/video/gunsmoke.c
@@ -134,7 +134,7 @@ VIDEO_START( gunsmoke )
{
/* configure ROM banking */
UINT8 *rombase = memory_region(machine, "main");
- memory_configure_bank(1, 0, 4, &rombase[0x10000], 0x4000);
+ memory_configure_bank(machine, 1, 0, 4, &rombase[0x10000], 0x4000);
/* create tilemaps */
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols, 32, 32, 2048, 8);
diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c
index a30b12c5ae4..c7ab4aa5ef8 100644
--- a/src/mame/video/jaguar.c
+++ b/src/mame/video/jaguar.c
@@ -480,7 +480,7 @@ static void jaguar_set_palette(UINT16 vmode)
static UINT8 *get_jaguar_memory(UINT32 offset)
{
- return memory_get_read_ptr(1, ADDRESS_SPACE_PROGRAM, offset);
+ return memory_get_read_ptr(cpu_get_address_space(Machine->cpu[1], ADDRESS_SPACE_PROGRAM), offset);
}
diff --git a/src/mame/video/phoenix.c b/src/mame/video/phoenix.c
index 27bef34408c..b1c4b331641 100644
--- a/src/mame/video/phoenix.c
+++ b/src/mame/video/phoenix.c
@@ -181,8 +181,8 @@ VIDEO_START( phoenix )
videoram_pg[0] = auto_malloc(0x1000);
videoram_pg[1] = auto_malloc(0x1000);
- memory_configure_bank(1, 0, 1, videoram_pg[0], 0);
- memory_configure_bank(1, 1, 1, videoram_pg[1], 0);
+ memory_configure_bank(machine, 1, 0, 1, videoram_pg[0], 0);
+ memory_configure_bank(machine, 1, 1, 1, videoram_pg[1], 0);
memory_set_bank(1, 0);
videoram_pg_index = 0;
diff --git a/src/mame/video/simpsons.c b/src/mame/video/simpsons.c
index 863ee15165e..7755a4abce9 100644
--- a/src/mame/video/simpsons.c
+++ b/src/mame/video/simpsons.c
@@ -104,16 +104,16 @@ void simpsons_video_banking(running_machine *machine, int bank)
{
if (bank & 1)
{
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, SMH_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0, SMH_BANK5, paletteram_xBBBBBGGGGGRRRRR_be_w);
memory_set_bankptr(5, paletteram);
}
else
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x0fff, 0, 0, K052109_r, K052109_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0, K052109_r, K052109_w);
if (bank & 2)
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K053247_r, simpsons_K053247_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, simpsons_K053247_r, simpsons_K053247_w);
else
- memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, simpsons_K052109_r, simpsons_K052109_w);
+ memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, simpsons_K052109_r, simpsons_K052109_w);
}
diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c
index 42cbbec94d6..2dbd466b454 100644
--- a/src/mame/video/taitoic.c
+++ b/src/mame/video/taitoic.c
@@ -533,6 +533,7 @@ Newer version of the I/O chip ?
***************************************************************************/
#include "driver.h"
+#include "deprecat.h"
#include "taitoic.h"
#define TOPSPEED_ROAD_COLORS
@@ -579,12 +580,16 @@ INLINE void taitoic_drawscanline(
static int has_write_handler(int cpunum, write16_space_func handler)
{
- const address_map *map = memory_get_address_map(cpunum, ADDRESS_SPACE_PROGRAM);
- const address_map_entry *entry;
- if (map != NULL)
- for (entry = map->entrylist; entry != NULL; entry = entry->next)
- if (entry->write.shandler16 == handler)
- return 1;
+ if (Machine->cpu[cpunum] != NULL)
+ {
+ const address_space *space = cpu_get_address_space(Machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM);
+ const address_map_entry *entry;
+
+ if (space != NULL && space->map != NULL)
+ for (entry = space->map->entrylist; entry != NULL; entry = entry->next)
+ if (entry->write.shandler16 == handler)
+ return 1;
+ }
return 0;
}
diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c
index 002e02a51d0..ebeb45cca80 100644
--- a/src/osd/windows/debugwin.c
+++ b/src/osd/windows/debugwin.c
@@ -1767,33 +1767,34 @@ static void memory_determine_combo_items(running_machine *machine)
int itemnum;
// first add all the CPUs' address spaces
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
- if (cpuinfo->valid)
- for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
- if (cpuinfo->space[spacenum].databytes != 0)
- {
- memorycombo_item *ci = malloc_or_die(sizeof(*ci));
- TCHAR *t_tag, *t_name, *t_space;
-
- memset(ci, 0, sizeof(*ci));
- ci->cpunum = cpunum;
- ci->spacenum = spacenum;
- ci->prefsize = MIN(cpuinfo->space[spacenum].databytes, 8);
-
- t_tag = tstring_from_utf8(machine->config->cpu[cpunum].tag);
- t_name = tstring_from_utf8(cpu_get_name(machine->cpu[cpunum]));
- t_space = tstring_from_utf8(address_space_names[spacenum]);
- _sntprintf(ci->name, ARRAY_LENGTH(ci->name), TEXT("CPU #%d \"%s\" (%s) %s memory"), cpunum, t_tag, t_name, t_space);
- free(t_space),
- free(t_name);
- free(t_tag);
-
- *tail = ci;
- tail = &ci->next;
- }
- }
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (cpuinfo->valid)
+ for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
+ if (cpuinfo->space[spacenum].databytes != 0)
+ {
+ memorycombo_item *ci = malloc_or_die(sizeof(*ci));
+ TCHAR *t_tag, *t_name, *t_space;
+
+ memset(ci, 0, sizeof(*ci));
+ ci->cpunum = cpunum;
+ ci->spacenum = spacenum;
+ ci->prefsize = MIN(cpuinfo->space[spacenum].databytes, 8);
+
+ t_tag = tstring_from_utf8(machine->config->cpu[cpunum].tag);
+ t_name = tstring_from_utf8(cpu_get_name(machine->cpu[cpunum]));
+ t_space = tstring_from_utf8(address_space_names[spacenum]);
+ _sntprintf(ci->name, ARRAY_LENGTH(ci->name), TEXT("CPU #%d \"%s\" (%s) %s memory"), cpunum, t_tag, t_name, t_space);
+ free(t_space),
+ free(t_name);
+ free(t_tag);
+
+ *tail = ci;
+ tail = &ci->next;
+ }
+ }
// then add all the memory regions
for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = memory_region_next(machine, rgntag))
@@ -2259,24 +2260,25 @@ static void disasm_create_window(running_machine *machine)
SendMessage(info->otherwnd[0], WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE);
// populate the combobox
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- TCHAR* t_cpunum_name;
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
- if (cpuinfo->valid)
- if (cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes)
- {
- TCHAR name[100];
- int item;
- t_cpunum_name = tstring_from_utf8(cpu_get_name(machine->cpu[cpunum]));
- _sntprintf(name, ARRAY_LENGTH(name), TEXT("CPU #%d (%s)"), cpunum, t_cpunum_name);
- free(t_cpunum_name);
- t_cpunum_name = NULL;
- item = SendMessage(info->otherwnd[0], CB_ADDSTRING, 0, (LPARAM)name);
- if (cpunum == curcpu)
- cursel = item;
- }
- }
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
+ if (machine->cpu[cpunum] != NULL)
+ {
+ TCHAR* t_cpunum_name;
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
+ if (cpuinfo->valid)
+ if (cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes)
+ {
+ TCHAR name[100];
+ int item;
+ t_cpunum_name = tstring_from_utf8(cpu_get_name(machine->cpu[cpunum]));
+ _sntprintf(name, ARRAY_LENGTH(name), TEXT("CPU #%d (%s)"), cpunum, t_cpunum_name);
+ free(t_cpunum_name);
+ t_cpunum_name = NULL;
+ item = SendMessage(info->otherwnd[0], CB_ADDSTRING, 0, (LPARAM)name);
+ if (cpunum == curcpu)
+ cursel = item;
+ }
+ }
SendMessage(info->otherwnd[0], CB_SETCURSEL, cursel, 0);
// set the child functions
@@ -2405,19 +2407,20 @@ static int disasm_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar
{
// find the matching entry
UINT32 cpunum;
- for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
- {
- const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
- if (cpuinfo->valid)
- if (cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes)
- if (sel-- == 0)
- {
- debug_view_begin_update(info->view[0].view);
- debug_view_set_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM, cpunum);
- debug_view_end_update(info->view[0].view);
- disasm_update_caption(info->machine, info->wnd);
- }
- }
+ for (cpunum = 0; cpunum < ARRAY_LENGTH(info->machine->cpu); cpunum++)
+ if (info->machine->cpu[cpunum] != NULL)
+ {
+ const cpu_debug_data *cpuinfo = cpu_get_debug_data(info->machine->cpu[cpunum]);
+ if (cpuinfo->valid)
+ if (cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes)
+ if (sel-- == 0)
+ {
+ debug_view_begin_update(info->view[0].view);
+ debug_view_set_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM, cpunum);
+ debug_view_end_update(info->view[0].view);
+ disasm_update_caption(info->machine, info->wnd);
+ }
+ }
// reset the focus
SetFocus(info->focuswnd);
@@ -2455,11 +2458,11 @@ static int disasm_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar
if (debug_view_get_property_UINT32(info->view[0].view, DVP_CURSOR_VISIBLE))
{
UINT32 cpu_num = 0;
- debug_cpu_info *cpuinfo ;
+ cpu_debug_data *cpuinfo ;
/* for BYTE2ADDR */
cpu_num = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM);
- cpuinfo = (debug_cpu_info *)debug_get_cpu_info(cpu_num);
+ cpuinfo = (cpu_debug_data *)cpu_get_debug_data(info->machine->cpu[cpu_num]);
active_address = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_ACTIVE_ADDRESS);
sprintf(command, "go %X", BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM));
@@ -2471,7 +2474,7 @@ static int disasm_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar
if (debug_view_get_property_UINT32(info->view[0].view, DVP_CURSOR_VISIBLE))
{
UINT32 cpu_num = 0;
- debug_cpu_info *cpuinfo ;
+ cpu_debug_data *cpuinfo ;
debug_cpu_breakpoint *bp;
INT8 bp_exists = 0;
UINT32 bp_num = 0;
@@ -2481,7 +2484,7 @@ static int disasm_handle_command(debugwin_info *info, WPARAM wparam, LPARAM lpar
/* is there already a breakpoint there? */
cpu_num = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM);
- cpuinfo = (debug_cpu_info*)debug_get_cpu_info(cpu_num);
+ cpuinfo = cpu_get_debug_data(info->machine->cpu[cpu_num]);
for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
{