From 8669a28810ab8b8c89017a8252626f121abd054a Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Tue, 11 Sep 2012 05:50:50 +0000 Subject: Add safe_pc() and safe_pcbase() methods to device_t. Convert all cpu_get_pc() to safe_pc() and cpu_getpreviouspc() to safe_basepc(). Removed the old macros. --- src/emu/cpu/m6502/opsce02.h | 2 +- src/emu/cpu/m6800/m6800.c | 8 +- src/emu/cpu/m68000/68307bus.c | 4 +- src/emu/cpu/m68000/68307ser.c | 4 +- src/emu/cpu/m68000/68307sim.c | 12 +-- src/emu/cpu/m68000/68307tmu.c | 4 +- src/emu/cpu/m68000/68340dma.c | 4 +- src/emu/cpu/m68000/68340ser.c | 4 +- src/emu/cpu/m68000/68340sim.c | 12 +-- src/emu/cpu/m68000/68340tmu.c | 4 +- src/emu/cpu/m68000/m68kcpu.c | 8 +- src/emu/cpu/sh2/sh2comn.c | 2 +- src/emu/cpu/tlcs90/tlcs90.c | 2 +- src/emu/cpu/tms34010/34010gfx.c | 2 +- src/emu/cpu/tms34010/tms34010.c | 4 +- src/emu/debug/dvdisasm.c | 4 +- src/emu/devcpu.h | 3 - src/emu/device.h | 2 + src/emu/distate.c | 8 +- src/emu/distate.h | 28 ++++++- src/emu/machine/53c810.c | 4 +- src/emu/machine/am53cf96.c | 10 +-- src/emu/machine/k056230.c | 8 +- src/emu/machine/ldpr8210.c | 8 +- src/emu/machine/ldv1000.c | 2 +- src/emu/machine/ldvp931.c | 6 +- src/emu/machine/ncr539x.c | 6 +- src/emu/machine/tmp68301.c | 2 +- src/emu/machine/wd33c93.c | 8 +- src/emu/sound/nile.c | 4 +- src/emu/video/hd63484.c | 10 +-- src/emu/video/pc_vga.c | 2 +- src/emu/video/voodoo.c | 2 +- src/mame/audio/beezer.c | 2 +- src/mame/audio/cage.c | 10 +-- src/mame/audio/dcs.c | 14 ++-- src/mame/audio/exidy.c | 8 +- src/mame/audio/harddriv.c | 36 ++++----- src/mame/audio/invinco.c | 2 +- src/mame/audio/jaguar.c | 8 +- src/mame/audio/leland.c | 152 +++++++++++++++++------------------ src/mame/audio/mw8080bw.c | 2 +- src/mame/audio/segasnd.c | 12 +-- src/mame/audio/seibu.c | 8 +- src/mame/audio/snes_snd.c | 4 +- src/mame/audio/taito_en.c | 4 +- src/mame/audio/taitosnd.c | 4 +- src/mame/drivers/1943.c | 2 +- src/mame/drivers/2mindril.c | 8 +- src/mame/drivers/39in1.c | 12 +-- src/mame/drivers/8080bw.c | 4 +- src/mame/drivers/88games.c | 2 +- src/mame/drivers/acommand.c | 2 +- src/mame/drivers/aeroboto.c | 2 +- src/mame/drivers/albazg.c | 6 +- src/mame/drivers/aleck64.c | 4 +- src/mame/drivers/alpha68k.c | 10 +-- src/mame/drivers/artmagic.c | 4 +- src/mame/drivers/astrafr.c | 16 ++-- src/mame/drivers/astrocorp.c | 6 +- src/mame/drivers/atarigt.c | 18 ++--- src/mame/drivers/atarigx2.c | 8 +- src/mame/drivers/backfire.c | 10 +-- src/mame/drivers/bbusters.c | 2 +- src/mame/drivers/beathead.c | 4 +- src/mame/drivers/bfcobra.c | 8 +- src/mame/drivers/bfm_sc4h.c | 14 ++-- src/mame/drivers/bfm_swp.c | 4 +- src/mame/drivers/bigevglf.c | 2 +- src/mame/drivers/bionicc.c | 4 +- src/mame/drivers/bking.c | 2 +- src/mame/drivers/blockhl.c | 2 +- src/mame/drivers/bmcbowl.c | 4 +- src/mame/drivers/btime.c | 16 ++-- src/mame/drivers/cabaret.c | 2 +- src/mame/drivers/calchase.c | 4 +- src/mame/drivers/cave.c | 14 ++-- src/mame/drivers/cbasebal.c | 2 +- src/mame/drivers/cbuster.c | 4 +- src/mame/drivers/cd32.c | 14 ++-- src/mame/drivers/cdi.c | 2 +- src/mame/drivers/centiped.c | 2 +- src/mame/drivers/chaknpop.c | 2 +- src/mame/drivers/cninja.c | 10 +-- src/mame/drivers/cntsteer.c | 2 +- src/mame/drivers/cobra.c | 8 +- src/mame/drivers/coolpool.c | 24 +++--- src/mame/drivers/cps1.c | 2 +- src/mame/drivers/crbaloon.c | 4 +- src/mame/drivers/crgolf.c | 2 +- src/mame/drivers/cvs.c | 6 +- src/mame/drivers/cyclemb.c | 12 +-- src/mame/drivers/d9final.c | 2 +- src/mame/drivers/darius.c | 12 +-- src/mame/drivers/dblewing.c | 8 +- src/mame/drivers/dcheese.c | 2 +- src/mame/drivers/ddenlovr.c | 72 ++++++++--------- src/mame/drivers/ddragon.c | 14 ++-- src/mame/drivers/ddragon3.c | 2 +- src/mame/drivers/dec0.c | 12 +-- src/mame/drivers/deco32.c | 18 ++--- src/mame/drivers/deco_mlc.c | 10 +-- src/mame/drivers/djmain.c | 6 +- src/mame/drivers/dkong.c | 12 +-- src/mame/drivers/dorachan.c | 4 +- src/mame/drivers/dunhuang.c | 8 +- src/mame/drivers/dynax.c | 34 ++++---- src/mame/drivers/enigma2.c | 4 +- src/mame/drivers/eolithsp.c | 6 +- src/mame/drivers/epos.c | 2 +- src/mame/drivers/esd16.c | 4 +- src/mame/drivers/esripsys.c | 2 +- src/mame/drivers/exerion.c | 2 +- src/mame/drivers/fantland.c | 6 +- src/mame/drivers/fastfred.c | 12 +-- src/mame/drivers/firetrap.c | 6 +- src/mame/drivers/fitfight.c | 12 +-- src/mame/drivers/flstory.c | 6 +- src/mame/drivers/fromanc2.c | 2 +- src/mame/drivers/fuukifg2.c | 2 +- src/mame/drivers/gaelco3d.c | 36 ++++----- src/mame/drivers/gaiden.c | 8 +- src/mame/drivers/galastrm.c | 2 +- src/mame/drivers/galaxian.c | 6 +- src/mame/drivers/galaxold.c | 8 +- src/mame/drivers/gaplus.c | 2 +- src/mame/drivers/gbusters.c | 8 +- src/mame/drivers/gcpinbal.c | 4 +- src/mame/drivers/gei.c | 2 +- src/mame/drivers/ghosteo.c | 2 +- src/mame/drivers/gladiatr.c | 2 +- src/mame/drivers/glass.c | 4 +- src/mame/drivers/goal92.c | 2 +- src/mame/drivers/goindol.c | 8 +- src/mame/drivers/gradius3.c | 8 +- src/mame/drivers/gsword.c | 4 +- src/mame/drivers/gunbustr.c | 4 +- src/mame/drivers/halleys.c | 4 +- src/mame/drivers/hexion.c | 2 +- src/mame/drivers/hitpoker.c | 8 +- src/mame/drivers/hng64.c | 24 +++--- src/mame/drivers/homedata.c | 22 ++--- src/mame/drivers/hotblock.c | 6 +- src/mame/drivers/hyprduel.c | 8 +- src/mame/drivers/igs009.c | 8 +- src/mame/drivers/igs011.c | 44 +++++----- src/mame/drivers/igs_m027.c | 2 +- src/mame/drivers/igspoker.c | 6 +- src/mame/drivers/itech32.c | 20 ++--- src/mame/drivers/jackie.c | 2 +- src/mame/drivers/jaguar.c | 10 +-- src/mame/drivers/jalmah.c | 14 ++-- src/mame/drivers/jokrwild.c | 4 +- src/mame/drivers/kaneko16.c | 10 +-- src/mame/drivers/kickgoal.c | 2 +- src/mame/drivers/kinst.c | 2 +- src/mame/drivers/koftball.c | 2 +- src/mame/drivers/konamigv.c | 4 +- src/mame/drivers/konamigx.c | 74 ++++++++--------- src/mame/drivers/konamim2.c | 12 +-- src/mame/drivers/ksys573.c | 12 +-- src/mame/drivers/ladybug.c | 2 +- src/mame/drivers/lastfght.c | 40 +++++----- src/mame/drivers/lethal.c | 2 +- src/mame/drivers/liberate.c | 10 +-- src/mame/drivers/littlerb.c | 10 +-- src/mame/drivers/looping.c | 4 +- src/mame/drivers/lwings.c | 4 +- src/mame/drivers/m107.c | 2 +- src/mame/drivers/m92.c | 8 +- src/mame/drivers/macrossp.c | 10 +-- src/mame/drivers/macs.c | 2 +- src/mame/drivers/mainevt.c | 4 +- src/mame/drivers/malzak.c | 2 +- src/mame/drivers/mcr.c | 6 +- src/mame/drivers/mcr3.c | 2 +- src/mame/drivers/mcr68.c | 2 +- src/mame/drivers/mediagx.c | 6 +- src/mame/drivers/megadrvb.c | 12 +-- src/mame/drivers/megaplay.c | 2 +- src/mame/drivers/meritm.c | 2 +- src/mame/drivers/metro.c | 16 ++-- src/mame/drivers/midqslvr.c | 2 +- src/mame/drivers/midvunit.c | 12 +-- src/mame/drivers/midzeus.c | 30 +++---- src/mame/drivers/missile.c | 6 +- src/mame/drivers/mitchell.c | 2 +- src/mame/drivers/mjkjidai.c | 4 +- src/mame/drivers/mjsister.c | 4 +- src/mame/drivers/model1.c | 22 ++--- src/mame/drivers/model2.c | 22 ++--- src/mame/drivers/model3.c | 12 +-- src/mame/drivers/mole.c | 2 +- src/mame/drivers/monzagp.c | 6 +- src/mame/drivers/mosaic.c | 4 +- src/mame/drivers/mpu3.c | 4 +- src/mame/drivers/mpu4hw.c | 10 +-- src/mame/drivers/mpu4vid.c | 14 ++-- src/mame/drivers/mpu5hw.c | 4 +- src/mame/drivers/mquake.c | 6 +- src/mame/drivers/msisaac.c | 4 +- src/mame/drivers/mw8080bw.c | 2 +- src/mame/drivers/mystwarr.c | 2 +- src/mame/drivers/namcona1.c | 4 +- src/mame/drivers/namconb1.c | 2 +- src/mame/drivers/namcos10.c | 8 +- src/mame/drivers/namcos11.c | 4 +- src/mame/drivers/namcos21.c | 14 ++-- src/mame/drivers/namcos22.c | 10 +-- src/mame/drivers/namcos23.c | 38 ++++----- src/mame/drivers/naughtyb.c | 8 +- src/mame/drivers/neogeo.c | 30 +++---- src/mame/drivers/neoprint.c | 14 ++-- src/mame/drivers/ninjaw.c | 2 +- src/mame/drivers/nmk16.c | 10 +-- src/mame/drivers/nwk-tr.c | 12 +-- src/mame/drivers/nyny.c | 2 +- src/mame/drivers/offtwall.c | 8 +- src/mame/drivers/ojankohs.c | 2 +- src/mame/drivers/opwolf.c | 8 +- src/mame/drivers/overdriv.c | 4 +- src/mame/drivers/pacman.c | 18 ++--- src/mame/drivers/pandoras.c | 2 +- src/mame/drivers/paradise.c | 2 +- src/mame/drivers/parodius.c | 6 +- src/mame/drivers/pasha2.c | 2 +- src/mame/drivers/pbaction.c | 2 +- src/mame/drivers/pcat_nit.c | 2 +- src/mame/drivers/pcxt.c | 4 +- src/mame/drivers/pgm.c | 12 +-- src/mame/drivers/pirates.c | 4 +- src/mame/drivers/pktgaldx.c | 2 +- src/mame/drivers/playmark.c | 6 +- src/mame/drivers/pluto5.c | 4 +- src/mame/drivers/plygonet.c | 8 +- src/mame/drivers/pntnpuzl.c | 2 +- src/mame/drivers/polepos.c | 2 +- src/mame/drivers/policetr.c | 4 +- src/mame/drivers/ppmast93.c | 2 +- src/mame/drivers/psikyo.c | 10 +-- src/mame/drivers/punchout.c | 6 +- src/mame/drivers/qdrmfgp.c | 2 +- src/mame/drivers/quizo.c | 2 +- src/mame/drivers/quizpun2.c | 2 +- src/mame/drivers/r2dtank.c | 10 +-- src/mame/drivers/raiden.c | 2 +- src/mame/drivers/realbrk.c | 6 +- src/mame/drivers/rmhaihai.c | 6 +- src/mame/drivers/rollerg.c | 2 +- src/mame/drivers/roul.c | 2 +- src/mame/drivers/route16.c | 4 +- src/mame/drivers/royalmah.c | 20 ++--- src/mame/drivers/sandscrp.c | 2 +- src/mame/drivers/saturn.c | 18 ++--- src/mame/drivers/scramble.c | 2 +- src/mame/drivers/sderby.c | 4 +- src/mame/drivers/seattle.c | 38 ++++----- src/mame/drivers/segac2.c | 4 +- src/mame/drivers/segag80r.c | 2 +- src/mame/drivers/segag80v.c | 4 +- src/mame/drivers/segald.c | 18 ++--- src/mame/drivers/segaorun.c | 12 +-- src/mame/drivers/segas16b.c | 4 +- src/mame/drivers/segas18.c | 4 +- src/mame/drivers/segas24.c | 18 ++--- src/mame/drivers/segas32.c | 34 ++++---- src/mame/drivers/seibuspi.c | 64 +++++++-------- src/mame/drivers/seicross.c | 2 +- src/mame/drivers/seta.c | 22 ++--- src/mame/drivers/seta2.c | 2 +- src/mame/drivers/sf.c | 2 +- src/mame/drivers/shangha3.c | 4 +- src/mame/drivers/simpl156.c | 10 +-- src/mame/drivers/slapfght.c | 16 ++-- src/mame/drivers/snesb.c | 2 +- src/mame/drivers/solomon.c | 6 +- src/mame/drivers/sothello.c | 2 +- src/mame/drivers/spaceg.c | 4 +- src/mame/drivers/spdodgeb.c | 4 +- src/mame/drivers/spoker.c | 8 +- src/mame/drivers/spy.c | 10 +-- src/mame/drivers/srmp6.c | 4 +- src/mame/drivers/ssfindo.c | 16 ++-- src/mame/drivers/sshangha.c | 4 +- src/mame/drivers/ssv.c | 6 +- src/mame/drivers/stadhero.c | 4 +- src/mame/drivers/starwars.c | 2 +- src/mame/drivers/strnskil.c | 10 +-- src/mame/drivers/stv.c | 8 +- src/mame/drivers/suna16.c | 16 ++-- src/mame/drivers/suna8.c | 52 ++++++------ src/mame/drivers/supbtime.c | 2 +- src/mame/drivers/superchs.c | 4 +- src/mame/drivers/superqix.c | 26 +++--- src/mame/drivers/suprgolf.c | 4 +- src/mame/drivers/suprnova.c | 32 ++++---- src/mame/drivers/surpratk.c | 6 +- src/mame/drivers/system1.c | 14 ++-- src/mame/drivers/system16.c | 4 +- src/mame/drivers/taito_f2.c | 10 +-- src/mame/drivers/taito_f3.c | 4 +- src/mame/drivers/taito_l.c | 26 +++--- src/mame/drivers/taito_o.c | 2 +- src/mame/drivers/taito_z.c | 14 ++-- src/mame/drivers/taitoair.c | 6 +- src/mame/drivers/taitojc.c | 12 +-- src/mame/drivers/taitotz.c | 6 +- src/mame/drivers/tecmosys.c | 6 +- src/mame/drivers/tehkanwc.c | 2 +- src/mame/drivers/tetrisp2.c | 4 +- src/mame/drivers/thedeep.c | 4 +- src/mame/drivers/thunderx.c | 16 ++-- src/mame/drivers/tickee.c | 2 +- src/mame/drivers/tigeroad.c | 4 +- src/mame/drivers/tmaster.c | 8 +- src/mame/drivers/tmnt.c | 4 +- src/mame/drivers/toaplan2.c | 6 +- src/mame/drivers/tomcat.c | 4 +- src/mame/drivers/topspeed.c | 6 +- src/mame/drivers/trvmadns.c | 4 +- src/mame/drivers/tumbleb.c | 4 +- src/mame/drivers/twinkle.c | 6 +- src/mame/drivers/undrfire.c | 2 +- src/mame/drivers/vamphalf.c | 40 +++++----- src/mame/drivers/vball.c | 4 +- src/mame/drivers/vegas.c | 54 ++++++------- src/mame/drivers/vendetta.c | 2 +- src/mame/drivers/viper.c | 26 +++--- src/mame/drivers/voyager.c | 2 +- src/mame/drivers/vsnes.c | 4 +- src/mame/drivers/wecleman.c | 2 +- src/mame/drivers/wgp.c | 8 +- src/mame/drivers/wheelfir.c | 2 +- src/mame/drivers/witch.c | 2 +- src/mame/drivers/xexex.c | 2 +- src/mame/drivers/xmen.c | 2 +- src/mame/drivers/xtheball.c | 2 +- src/mame/drivers/xyonix.c | 4 +- src/mame/drivers/yunsung8.c | 2 +- src/mame/drivers/zn.c | 6 +- src/mame/includes/megadriv.h | 4 +- src/mame/machine/3do.c | 28 +++---- src/mame/machine/ajax.c | 4 +- src/mame/machine/amiga.c | 10 +-- src/mame/machine/archimds.c | 16 ++-- src/mame/machine/arkanoid.c | 114 +++++++++++++------------- src/mame/machine/asic65.c | 2 +- src/mame/machine/atarigen.c | 2 +- src/mame/machine/balsente.c | 4 +- src/mame/machine/bonzeadv.c | 6 +- src/mame/machine/btime.c | 6 +- src/mame/machine/bublbobl.c | 44 +++++----- src/mame/machine/buggychl.c | 16 ++-- src/mame/machine/cchip.c | 2 +- src/mame/machine/cd32.c | 4 +- src/mame/machine/cdi070.c | 2 +- src/mame/machine/cdicdic.c | 2 +- src/mame/machine/cdislave.c | 2 +- src/mame/machine/chaknpop.c | 18 ++--- src/mame/machine/dc.c | 4 +- src/mame/machine/dec0.c | 10 +-- src/mame/machine/decocass.c | 104 ++++++++++++------------ src/mame/machine/decoprot.c | 60 +++++++------- src/mame/machine/fddebug.c | 8 +- src/mame/machine/flstory.c | 18 ++--- src/mame/machine/gaelco2.c | 8 +- src/mame/machine/gaelcrpt.c | 2 +- src/mame/machine/galaxold.c | 12 +-- src/mame/machine/harddriv.c | 34 ++++---- src/mame/machine/kaneko_hit.c | 12 +-- src/mame/machine/kaneko_toybox.c | 2 +- src/mame/machine/konamigx.c | 2 +- src/mame/machine/konppc.c | 4 +- src/mame/machine/leland.c | 44 +++++----- src/mame/machine/lkage.c | 16 ++-- src/mame/machine/lsasquad.c | 24 +++--- src/mame/machine/m68kfmly.c | 20 ++--- src/mame/machine/maniach.c | 16 ++-- src/mame/machine/mcr.c | 2 +- src/mame/machine/mcr68.c | 10 +-- src/mame/machine/md_cart.c | 38 ++++----- src/mame/machine/mega32x.c | 2 +- src/mame/machine/megadriv.c | 42 +++++----- src/mame/machine/megavdp.c | 4 +- src/mame/machine/mexico86.c | 18 ++--- src/mame/machine/midtunit.c | 24 +++--- src/mame/machine/midwayic.c | 8 +- src/mame/machine/midwunit.c | 14 ++-- src/mame/machine/midxunit.c | 18 ++--- src/mame/machine/midyunit.c | 16 ++-- src/mame/machine/model1.c | 14 ++-- src/mame/machine/n64.c | 34 ++++---- src/mame/machine/namcoio.c | 4 +- src/mame/machine/namcond1.c | 2 +- src/mame/machine/namcos1.c | 32 ++++---- src/mame/machine/namcos2.c | 2 +- src/mame/machine/naomi.c | 26 +++--- src/mame/machine/neoboot.c | 8 +- src/mame/machine/neoprot.c | 10 +-- src/mame/machine/nmk004.c | 4 +- src/mame/machine/opwolf.c | 6 +- src/mame/machine/pgmprot1.c | 16 ++-- src/mame/machine/pgmprot2.c | 26 +++--- src/mame/machine/pgmprot3.c | 12 +-- src/mame/machine/pgmprot4.c | 8 +- src/mame/machine/pgmprot6.c | 6 +- src/mame/machine/retofinv.c | 16 ++-- src/mame/machine/scramble.c | 12 +-- src/mame/machine/segaic16.c | 2 +- src/mame/machine/segas32.c | 6 +- src/mame/machine/seicop.c | 24 +++--- src/mame/machine/slapfght.c | 162 ++++++++++++++++++------------------- src/mame/machine/slapstic.c | 4 +- src/mame/machine/smpc.c | 4 +- src/mame/machine/snes.c | 34 ++++---- src/mame/machine/stvprot.c | 32 ++++---- src/mame/machine/taitoio.c | 20 ++--- src/mame/machine/taitosj.c | 34 ++++---- src/mame/machine/tatsumi.c | 40 +++++----- src/mame/machine/tnzs.c | 28 +++---- src/mame/machine/toaplan1.c | 28 +++---- src/mame/machine/twincobr.c | 26 +++--- src/mame/machine/tx1.c | 2 +- src/mame/machine/volfied.c | 6 +- src/mame/machine/xevious.c | 20 ++--- src/mame/video/airbustr.c | 2 +- src/mame/video/battlera.c | 6 +- src/mame/video/beathead.c | 2 +- src/mame/video/bwing.c | 2 +- src/mame/video/capbowl.c | 4 +- src/mame/video/cischeat.c | 8 +- src/mame/video/cvs.c | 2 +- src/mame/video/dc.c | 6 +- src/mame/video/dcheese.c | 6 +- src/mame/video/dogfgt.c | 2 +- src/mame/video/dooyong.c | 2 +- src/mame/video/dynax.c | 2 +- src/mame/video/flstory.c | 4 +- src/mame/video/galivan.c | 2 +- src/mame/video/galpani2.c | 2 +- src/mame/video/ginganin.c | 2 +- src/mame/video/gticlub.c | 10 +-- src/mame/video/hexion.c | 20 ++--- src/mame/video/homedata.c | 6 +- src/mame/video/itech8.c | 6 +- src/mame/video/jaguar.c | 8 +- src/mame/video/kaneko_grap2.c | 2 +- src/mame/video/kaneko_spr.c | 2 +- src/mame/video/konamiic.c | 10 +-- src/mame/video/konicdev.c | 56 ++++++------- src/mame/video/lethalj.c | 2 +- src/mame/video/m107.c | 2 +- src/mame/video/m92.c | 4 +- src/mame/video/mcd212.c | 2 +- src/mame/video/megasys1.c | 4 +- src/mame/video/midvunit.c | 4 +- src/mame/video/midzeus.c | 10 +-- src/mame/video/midzeus2.c | 4 +- src/mame/video/mitchell.c | 6 +- src/mame/video/mjkjidai.c | 2 +- src/mame/video/othldrby.c | 2 +- src/mame/video/policetr.c | 14 ++-- src/mame/video/scn2674.c | 16 ++-- src/mame/video/segag80r.c | 4 +- src/mame/video/seta.c | 2 +- src/mame/video/seta2.c | 10 +-- src/mame/video/st0016.c | 2 +- src/mame/video/st0020.c | 10 +-- src/mame/video/stvvdp1.c | 6 +- src/mame/video/suna16.c | 4 +- src/mame/video/taito_l.c | 6 +- src/mame/video/taitoic.c | 10 +-- src/mame/video/tatsumi.c | 4 +- src/mame/video/victory.c | 38 ++++----- src/mame/video/williams.c | 2 +- src/mess/audio/mea8000.c | 14 ++-- src/mess/devices/sonydriv.c | 6 +- src/mess/drivers/a2600.c | 24 +++--- src/mess/drivers/apollo.c | 4 +- src/mess/drivers/bebox.c | 2 +- src/mess/drivers/camplynx.c | 6 +- src/mess/drivers/craft.c | 2 +- src/mess/drivers/cxhumax.c | 2 +- src/mess/drivers/dc.c | 4 +- src/mess/drivers/esq1.c | 2 +- src/mess/drivers/esq5505.c | 6 +- src/mess/drivers/ex800.c | 46 +++++------ src/mess/drivers/gba.c | 14 ++-- src/mess/drivers/gp2x.c | 4 +- src/mess/drivers/gp32.c | 76 +++++++++--------- src/mess/drivers/ip20.c | 6 +- src/mess/drivers/ip22.c | 8 +- src/mess/drivers/mac.c | 26 +++--- src/mess/drivers/nc.c | 6 +- src/mess/drivers/next.c | 36 ++++----- src/mess/drivers/ng_aes.c | 22 ++--- src/mess/drivers/pasogo.c | 6 +- src/mess/drivers/pasopia7.c | 4 +- src/mess/drivers/pc8801.c | 2 +- src/mess/drivers/pc88va.c | 2 +- src/mess/drivers/pc9801.c | 2 +- src/mess/drivers/rainbow.c | 2 +- src/mess/drivers/rex6000.c | 2 +- src/mess/drivers/rvoice.c | 4 +- src/mess/drivers/scv.c | 2 +- src/mess/drivers/sgi_ip2.c | 2 +- src/mess/drivers/sgi_ip6.c | 2 +- src/mess/drivers/smc777.c | 10 +-- src/mess/drivers/socrates.c | 2 +- src/mess/drivers/ssystem3.c | 2 +- src/mess/drivers/supracan.c | 2 +- src/mess/drivers/vboy.c | 2 +- src/mess/drivers/vii.c | 2 +- src/mess/drivers/vk100.c | 4 +- src/mess/drivers/x1.c | 8 +- src/mess/drivers/x68k.c | 10 +-- src/mess/machine/3c505.c | 8 +- src/mess/machine/a2cffa.c | 2 +- src/mess/machine/a2memexp.c | 4 +- src/mess/machine/a2mockingboard.c | 6 +- src/mess/machine/a2scsi.c | 6 +- src/mess/machine/a2videoterm.c | 4 +- src/mess/machine/amigacd.c | 58 +++++++------- src/mess/machine/amigacrt.c | 10 +-- src/mess/machine/apollo_kbd.c | 2 +- src/mess/machine/apple2.c | 4 +- src/mess/machine/bbc.c | 4 +- src/mess/machine/bebox.c | 4 +- src/mess/machine/c65.c | 4 +- src/mess/machine/coco.c | 4 +- src/mess/machine/compis.c | 132 +++++++++++++++--------------- src/mess/machine/cuda.c | 20 ++--- src/mess/machine/dccons.c | 10 +-- src/mess/machine/dec_lk201.c | 14 ++-- src/mess/machine/dgn_beta.c | 2 +- src/mess/machine/egret.c | 6 +- src/mess/machine/gamecom.c | 2 +- src/mess/machine/gb.c | 38 ++++----- src/mess/machine/hp48.c | 30 +++---- src/mess/machine/intv.c | 2 +- src/mess/machine/isa_hdc.c | 4 +- src/mess/machine/isa_ide_cd.c | 2 +- src/mess/machine/lisa.c | 14 ++-- src/mess/machine/mac.c | 30 +++---- src/mess/machine/macpci.c | 16 ++-- src/mess/machine/mb8795.c | 28 +++---- src/mess/machine/mc6843.c | 40 +++++----- src/mess/machine/mc6846.c | 36 ++++----- src/mess/machine/mc6854.c | 30 +++---- src/mess/machine/mface2.c | 2 +- src/mess/machine/mos6530.c | 4 +- src/mess/machine/ncr5380.c | 6 +- src/mess/machine/ncr5390.c | 18 ++--- src/mess/machine/nes.c | 4 +- src/mess/machine/nextmo.c | 36 ++++----- src/mess/machine/nubus_asntmc3b.c | 4 +- src/mess/machine/omti8621.c | 2 +- src/mess/machine/oric.c | 4 +- src/mess/machine/pc.c | 2 +- src/mess/machine/pc1403.c | 2 +- src/mess/machine/pce.c | 4 +- src/mess/machine/pokemini.c | 14 ++-- src/mess/machine/psxcd.c | 4 +- src/mess/machine/rm380z.c | 12 +-- src/mess/machine/rmnimbus.c | 164 +++++++++++++++++++------------------- src/mess/machine/sc499.c | 2 +- src/mess/machine/sgi.c | 2 +- src/mess/machine/sms.c | 4 +- src/mess/machine/sym1.c | 4 +- src/mess/machine/tandy1t.c | 6 +- src/mess/machine/thomflop.c | 92 ++++++++++----------- src/mess/machine/thomson.c | 92 ++++++++++----------- src/mess/machine/wswan.c | 6 +- src/mess/machine/z80ne.c | 2 +- src/mess/video/crtc_ega.c | 2 +- src/mess/video/gba.c | 2 +- src/mess/video/mac.c | 12 +-- src/mess/video/newport.c | 2 +- src/mess/video/nubus_48gc.c | 2 +- src/mess/video/nubus_cb264.c | 4 +- src/mess/video/nubus_m2hires.c | 8 +- src/mess/video/nubus_spec8.c | 6 +- src/mess/video/nubus_specpdq.c | 22 ++--- src/mess/video/nubus_wsportrait.c | 2 +- src/mess/video/rm380z.c | 2 +- src/mess/video/rmnimbus.c | 4 +- src/mess/video/ssystem3.c | 2 +- src/mess/video/stic.c | 2 +- src/mess/video/x68k.c | 4 +- 589 files changed, 3228 insertions(+), 3207 deletions(-) diff --git a/src/emu/cpu/m6502/opsce02.h b/src/emu/cpu/m6502/opsce02.h index 64549135932..28f00a791fd 100644 --- a/src/emu/cpu/m6502/opsce02.h +++ b/src/emu/cpu/m6502/opsce02.h @@ -291,7 +291,7 @@ t1=RDOPARG(); \ t2=RDOPARG(); \ t3=RDOPARG(); \ - logerror("m65ce02 at pc:%.4x reserved op aug %.2x %.2x %.2x\n", cpu_get_pc(cpustate->device),t1,t2,t3); + logerror("m65ce02 at pc:%.4x reserved op aug %.2x %.2x %.2x\n", cpustate->device->safe_pc(),t1,t2,t3); /* 65ce02 ****************************************************** * BBR Branch if bit is reset diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index e14fcb2761b..2ba284bae5c 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -1601,7 +1601,7 @@ READ8_HANDLER( m6801_io_r ) case IO_ICR2H: case IO_ICR2L: default: - logerror("M6801 '%s' PC %04x: warning - read from reserved internal register %02x\n",space->device().tag(),cpu_get_pc(&space->device()),offset); + logerror("M6801 '%s' PC %04x: warning - read from reserved internal register %02x\n",space->device().tag(),space->device().safe_pc(),offset); } return data; @@ -1635,7 +1635,7 @@ WRITE8_HANDLER( m6801_io_w ) write_port2(cpustate); if (cpustate->port2_ddr & 2) - logerror("CPU '%s' PC %04x: warning - port 2 bit 1 set as output (OLVL) - not supported\n",space->device().tag(),cpu_get_pc(&space->device())); + logerror("CPU '%s' PC %04x: warning - port 2 bit 1 set as output (OLVL) - not supported\n",space->device().tag(),space->device().safe_pc()); } break; @@ -1770,7 +1770,7 @@ WRITE8_HANDLER( m6801_io_w ) case IO_ICRH: case IO_ICRL: case IO_RDR: - //logerror("CPU '%s' PC %04x: warning - write %02x to read only internal register %02x\n",space->device().tag(),cpu_get_pc(&space->device()),data,offset); + //logerror("CPU '%s' PC %04x: warning - write %02x to read only internal register %02x\n",space->device().tag(),space->device().safe_pc(),data,offset); break; case IO_P3CSR: @@ -1832,7 +1832,7 @@ WRITE8_HANDLER( m6801_io_w ) case IO_ICR2H: case IO_ICR2L: default: - logerror("M6801 '%s' PC %04x: warning - write %02x to reserved internal register %02x\n",space->device().tag(),cpu_get_pc(&space->device()),data,offset); + logerror("M6801 '%s' PC %04x: warning - write %02x to reserved internal register %02x\n",space->device().tag(),space->device().safe_pc(),data,offset); break; } } diff --git a/src/emu/cpu/m68000/68307bus.c b/src/emu/cpu/m68000/68307bus.c index 06a9e303136..bc6785916bd 100644 --- a/src/emu/cpu/m68000/68307bus.c +++ b/src/emu/cpu/m68000/68307bus.c @@ -14,7 +14,7 @@ READ8_HANDLER( m68307_internal_mbus_r ) if (mbus) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset) @@ -61,7 +61,7 @@ WRITE8_HANDLER( m68307_internal_mbus_w ) if (mbus) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset) { diff --git a/src/emu/cpu/m68000/68307ser.c b/src/emu/cpu/m68000/68307ser.c index 7a8e1a1ca77..6ed1942115d 100644 --- a/src/emu/cpu/m68000/68307ser.c +++ b/src/emu/cpu/m68000/68307ser.c @@ -29,7 +29,7 @@ READ8_HANDLER( m68307_internal_serial_r ) else { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset) { @@ -97,7 +97,7 @@ WRITE8_HANDLER( m68307_internal_serial_w ) m68307_serial* serial = m68k->m68307SERIAL; assert(serial != NULL); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if (serial) { diff --git a/src/emu/cpu/m68000/68307sim.c b/src/emu/cpu/m68000/68307sim.c index 8698f2f2cec..2e922dabbe2 100644 --- a/src/emu/cpu/m68000/68307sim.c +++ b/src/emu/cpu/m68000/68307sim.c @@ -10,7 +10,7 @@ READ16_HANDLER( m68307_internal_sim_r ) m68307_sim* sim = m68k->m68307SIM; assert(sim != NULL); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if (sim) { @@ -47,7 +47,7 @@ WRITE16_HANDLER( m68307_internal_sim_w ) m68307_sim* sim = m68k->m68307SIM; assert(sim != NULL); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if (sim) { @@ -152,7 +152,7 @@ void m68307_sim::write_paddr(UINT16 data, UINT16 mem_mask) UINT16 m68307_sim::read_padat(address_space *space, UINT16 mem_mask) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); if (m68k->m_m68307_porta_r) @@ -179,7 +179,7 @@ UINT16 m68307_sim::read_padat(address_space *space, UINT16 mem_mask) void m68307_sim::write_padat(address_space *space, UINT16 data, UINT16 mem_mask) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); COMBINE_DATA(&m_padat); @@ -205,7 +205,7 @@ void m68307_sim::write_pbddr(UINT16 data, UINT16 mem_mask) UINT16 m68307_sim::read_pbdat(address_space *space, UINT16 mem_mask) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); if (m68k->m_m68307_portb_r) @@ -232,7 +232,7 @@ UINT16 m68307_sim::read_pbdat(address_space *space, UINT16 mem_mask) void m68307_sim::write_pbdat(address_space *space, UINT16 data, UINT16 mem_mask) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); COMBINE_DATA(&m_pbdat); diff --git a/src/emu/cpu/m68000/68307tmu.c b/src/emu/cpu/m68000/68307tmu.c index 104a65c6738..d4ab8b894e6 100644 --- a/src/emu/cpu/m68000/68307tmu.c +++ b/src/emu/cpu/m68000/68307tmu.c @@ -12,7 +12,7 @@ READ16_HANDLER( m68307_internal_timer_r ) if (timer) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); int which = offset & 0x8; switch (offset&0x7) @@ -40,7 +40,7 @@ WRITE16_HANDLER( m68307_internal_timer_w ) if (timer) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); int which = offset & 0x8; switch (offset&0x7) diff --git a/src/emu/cpu/m68000/68340dma.c b/src/emu/cpu/m68000/68340dma.c index 2d52f3473cc..567349b9745 100644 --- a/src/emu/cpu/m68000/68340dma.c +++ b/src/emu/cpu/m68000/68340dma.c @@ -12,7 +12,7 @@ READ32_HANDLER( m68340_internal_dma_r ) if (dma) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_dma_r %08x, (%08x)\n", pc, offset*4,mem_mask); } @@ -27,7 +27,7 @@ WRITE32_HANDLER( m68340_internal_dma_w ) if (dma) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_dma_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask); } } diff --git a/src/emu/cpu/m68000/68340ser.c b/src/emu/cpu/m68000/68340ser.c index 8009201729e..e438a92a22e 100644 --- a/src/emu/cpu/m68000/68340ser.c +++ b/src/emu/cpu/m68000/68340ser.c @@ -12,7 +12,7 @@ READ32_HANDLER( m68340_internal_serial_r ) if (serial) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_serial_r %08x, (%08x)\n", pc, offset*4,mem_mask); } @@ -27,7 +27,7 @@ WRITE32_HANDLER( m68340_internal_serial_w ) if (serial) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_serial_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask); } diff --git a/src/emu/cpu/m68000/68340sim.c b/src/emu/cpu/m68000/68340sim.c index 4f8089142f8..25753696909 100644 --- a/src/emu/cpu/m68000/68340sim.c +++ b/src/emu/cpu/m68000/68340sim.c @@ -12,7 +12,7 @@ READ16_HANDLER( m68340_internal_sim_r ) if (sim) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset<<1) { @@ -63,7 +63,7 @@ READ8_HANDLER( m68340_internal_sim_ports_r ) if (sim) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset) { @@ -119,7 +119,7 @@ READ32_HANDLER( m68340_internal_sim_cs_r ) if (sim) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset<<2) { @@ -149,7 +149,7 @@ WRITE16_HANDLER( m68340_internal_sim_w ) if (sim) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset<<1) { @@ -199,7 +199,7 @@ WRITE8_HANDLER( m68340_internal_sim_ports_w ) if (sim) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset) { @@ -252,7 +252,7 @@ WRITE32_HANDLER( m68340_internal_sim_cs_w ) if (sim) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); switch (offset<<2) { diff --git a/src/emu/cpu/m68000/68340tmu.c b/src/emu/cpu/m68000/68340tmu.c index b68718fa47b..8a878a6a993 100644 --- a/src/emu/cpu/m68000/68340tmu.c +++ b/src/emu/cpu/m68000/68340tmu.c @@ -13,7 +13,7 @@ READ32_HANDLER( m68340_internal_timer_r ) if (timer) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_timer_r %08x, (%08x)\n", pc, offset*4,mem_mask); } @@ -28,7 +28,7 @@ WRITE32_HANDLER( m68340_internal_timer_w ) if (timer) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_timer_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask); } } diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index a4b88ac4bda..d27872cd03e 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -2077,7 +2077,7 @@ static READ16_HANDLER( m68307_internal_base_r ) { m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68307_internal_base_r %08x, (%04x)\n", pc, offset*2,mem_mask); switch (offset<<1) @@ -2096,7 +2096,7 @@ static WRITE16_HANDLER( m68307_internal_base_w ) { m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask); int base = 0; //int mask = 0; @@ -2764,7 +2764,7 @@ CPU_GET_INFO( scc68070 ) static READ32_HANDLER( m68340_internal_base_r ) { m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_base_r %08x, (%08x)\n", pc, offset*4,mem_mask); return m68k->m68340_base; } @@ -2773,7 +2773,7 @@ static WRITE32_HANDLER( m68340_internal_base_w ) { m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x m68340_internal_base_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask); // other conditions? diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index d67ceace009..21129b19e7c 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -522,7 +522,7 @@ WRITE32_HANDLER( sh2_internal_w ) // logerror("sh2_internal_w: Write %08x (%x), %08x @ %08x\n", 0xfffffe00+offset*4, offset, data, mem_mask); // if(offset != 0x20) -// printf("sh2_internal_w: Write %08x (%x), %08x @ %08x (PC %x)\n", 0xfffffe00+offset*4, offset, data, mem_mask, cpu_get_pc(&space->device())); +// printf("sh2_internal_w: Write %08x (%x), %08x @ %08x (PC %x)\n", 0xfffffe00+offset*4, offset, data, mem_mask, space->device().safe_pc()); switch( offset ) { diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c index b2824e451eb..71033a66866 100644 --- a/src/emu/cpu/tlcs90/tlcs90.c +++ b/src/emu/cpu/tlcs90/tlcs90.c @@ -1967,7 +1967,7 @@ static CPU_EXECUTE( t90 ) break; default: - fatalerror("%04x: unimplemented opcode, op=%02x\n",cpu_get_pc(device),cpustate->op); + fatalerror("%04x: unimplemented opcode, op=%02x\n",device->safe_pc(),cpustate->op); } if ( cpustate->op != EI ) diff --git a/src/emu/cpu/tms34010/34010gfx.c b/src/emu/cpu/tms34010/34010gfx.c index 39d02ad6d52..6afda3e2be6 100644 --- a/src/emu/cpu/tms34010/34010gfx.c +++ b/src/emu/cpu/tms34010/34010gfx.c @@ -84,7 +84,7 @@ static int apply_window(tms34010_state *tms, const char *inst_name,int srcbpp, U int diff, cycles = 3; if (WINDOW_CHECKING(tms) == 2) - logerror("%08x: %s apply_window window mode %d not supported!\n", cpu_get_pc(tms->device), inst_name, WINDOW_CHECKING(tms)); + logerror("%08x: %s apply_window window mode %d not supported!\n", tms->device->safe_pc(), inst_name, WINDOW_CHECKING(tms)); CLR_V(tms); if (WINDOW_CHECKING(tms) == 1) diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index 5f4eab8e87c..800ab90740a 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -1224,7 +1224,7 @@ WRITE16_HANDLER( tms34010_io_register_w ) break; case REG_PMASK: - if (data) logerror("Plane masking not supported. PC=%08X\n", cpu_get_pc(&space->device())); + if (data) logerror("Plane masking not supported. PC=%08X\n", space->device().safe_pc()); break; case REG_DPYCTL: @@ -1375,7 +1375,7 @@ WRITE16_HANDLER( tms34020_io_register_w ) case REG020_PMASKL: case REG020_PMASKH: - if (data) logerror("Plane masking not supported. PC=%08X\n", cpu_get_pc(&space->device())); + if (data) logerror("Plane masking not supported. PC=%08X\n", space->device().safe_pc()); break; case REG020_DPYCTL: diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c index a8041abc168..6cc43afb4c4 100644 --- a/src/emu/debug/dvdisasm.c +++ b/src/emu/debug/dvdisasm.c @@ -202,7 +202,7 @@ void debug_view_disasm::view_char(int chval) case DCH_HOME: // set the active column to the PC { const debug_view_disasm_source &source = downcast(*m_source); - offs_t pc = source.m_space->address_to_byte(cpu_get_pc(&source.m_device)) & source.m_space->logbytemask(); + offs_t pc = source.m_space->address_to_byte(source.m_device.safe_pc()) & source.m_space->logbytemask(); // figure out which row the pc is on for (int curline = 0; curline < m_allocated.y; curline++) @@ -468,7 +468,7 @@ void debug_view_disasm::view_update() { const debug_view_disasm_source &source = downcast(*m_source); - offs_t pc = cpu_get_pc(&source.m_device); + offs_t pc = source.m_device.safe_pc(); offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask(); // update our context; if the expression is dirty, recompute diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h index 0eee7f3f862..1590fc4cbfb 100644 --- a/src/emu/devcpu.h +++ b/src/emu/devcpu.h @@ -294,9 +294,6 @@ const device_type name = &legacy_device_creator // CPU timing #define cpu_get_reg(cpu, _reg) device_state(cpu)->state(_reg) -#define cpu_get_previouspc(cpu) ((offs_t)device_state(cpu)->state(STATE_GENPCBASE)) -#define cpu_get_pc(cpu) ((offs_t)device_state(cpu)->state(STATE_GENPC)) - #define cpu_set_reg(cpu, _reg, val) device_state(cpu)->set_state(_reg, val) // helpers for using machine/cputag instead of cpu objects diff --git a/src/emu/device.h b/src/emu/device.h index ebbb1590a89..259ed93e750 100644 --- a/src/emu/device.h +++ b/src/emu/device.h @@ -230,6 +230,8 @@ public: // debugging device_debug *debug() const { return m_debug; } + offs_t safe_pc(); + offs_t safe_pcbase(); void set_default_bios(UINT8 bios) { m_default_bios = bios; } void set_system_bios(UINT8 bios) { m_system_bios = bios; } diff --git a/src/emu/distate.c b/src/emu/distate.c index 6a0621d3eac..c8745a33449 100644 --- a/src/emu/distate.c +++ b/src/emu/distate.c @@ -523,8 +523,8 @@ device_state_entry &device_state_interface::state_add(int index, const char *sym m_state_list.append(*entry); // set the fast entry if applicable - if (index >= k_fast_state_min && index <= k_fast_state_max) - m_fast_state[index - k_fast_state_min] = entry; + if (index >= FAST_STATE_MIN && index <= FAST_STATE_MAX) + m_fast_state[index - FAST_STATE_MIN] = entry; return *entry; } @@ -595,8 +595,8 @@ void device_state_interface::interface_post_start() const device_state_entry *device_state_interface::state_find_entry(int index) { // use fast lookup if possible - if (index >= k_fast_state_min && index <= k_fast_state_max) - return m_fast_state[index - k_fast_state_min]; + if (index >= FAST_STATE_MIN && index <= FAST_STATE_MAX) + return m_fast_state[index - FAST_STATE_MIN]; // otherwise, scan the first for (const device_state_entry *entry = m_state_list.first(); entry != NULL; entry = entry->m_next) diff --git a/src/emu/distate.h b/src/emu/distate.h index 66b756e566b..b64a10f1348 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -186,12 +186,12 @@ protected: const device_state_entry *state_find_entry(int index); // constants - static const int k_fast_state_min = -4; // range for fast state - static const int k_fast_state_max = 256; // lookups + static const int FAST_STATE_MIN = -4; // range for fast state + static const int FAST_STATE_MAX = 256; // lookups // state simple_list m_state_list; // head of state list - device_state_entry * m_fast_state[k_fast_state_max + 1 - k_fast_state_min]; + device_state_entry * m_fast_state[FAST_STATE_MAX + 1 - FAST_STATE_MIN]; // fast access to common entries }; @@ -204,6 +204,28 @@ typedef device_interface_iterator state_interface_iterat // INLINE HELPERS //************************************************************************** +//------------------------------------------------- +// device_t::safe_pc - return the current PC +// or 0 if no state object exists +//------------------------------------------------- + +inline offs_t device_t::safe_pc() +{ + return (m_state != NULL) ? m_state->pc() : 0; +} + + +//------------------------------------------------- +// device_t::safe_pcbase - return the current PC +// base or 0 if no state object exists +//------------------------------------------------- + +inline offs_t device_t::safe_pcbase() +{ + return (m_state != NULL) ? m_state->pcbase() : 0; +} + + //------------------------------------------------- // device_state - return a pointer to the device // state interface for this device diff --git a/src/emu/machine/53c810.c b/src/emu/machine/53c810.c index feb9d499731..3a1434ff017 100644 --- a/src/emu/machine/53c810.c +++ b/src/emu/machine/53c810.c @@ -393,7 +393,7 @@ void lsi53c810_device::dma_exec() UINT8 lsi53c810_device::lsi53c810_reg_r( int offset ) { -// logerror("53c810: read reg %d:0x%x (PC=%x)\n", offset, offset, cpu_get_pc(&space->device())); +// logerror("53c810: read reg %d:0x%x (PC=%x)\n", offset, offset, space->device().safe_pc()); switch(offset) { case 0x00: /* SCNTL0 */ @@ -476,7 +476,7 @@ UINT8 lsi53c810_device::lsi53c810_reg_r( int offset ) void lsi53c810_device::lsi53c810_reg_w(int offset, UINT8 data) { -// logerror("53c810: %02x to reg %d:0x%x (PC=%x)\n", data, offset, offset, cpu_get_pc(&space->device())); +// logerror("53c810: %02x to reg %d:0x%x (PC=%x)\n", data, offset, offset, space->device().safe_pc()); switch(offset) { case 0x00: /* SCNTL0 */ diff --git a/src/emu/machine/am53cf96.c b/src/emu/machine/am53cf96.c index f0bd3582cac..fd7d94a9406 100644 --- a/src/emu/machine/am53cf96.c +++ b/src/emu/machine/am53cf96.c @@ -32,11 +32,11 @@ READ8_MEMBER( am53cf96_device::read ) if (offset == REG_FIFO) { -// mame_printf_debug("53cf96: read FIFO PC=%x\n", cpu_get_pc(&space.device())); +// mame_printf_debug("53cf96: read FIFO PC=%x\n", space.device().safe_pc()); return 0; } -// logerror("53cf96: read reg %d = %x (PC=%x)\n", reg, rv>>shift, cpu_get_pc(&space.device())); +// logerror("53cf96: read reg %d = %x (PC=%x)\n", reg, rv>>shift, space.device().safe_pc()); if (offset == REG_IRQSTATE) { @@ -55,7 +55,7 @@ void am53cf96_device::device_timer(emu_timer &timer, device_timer_id tid, int pa WRITE8_MEMBER( am53cf96_device::write ) { -// logerror("53cf96: w %x to reg %d (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); +// logerror("53cf96: w %x to reg %d (PC=%x)\n", data, offset, space.device().safe_pc()); // if writing to the target ID, cache it off for later if (offset == REG_STATUS) @@ -93,7 +93,7 @@ WRITE8_MEMBER( am53cf96_device::write ) case 2: // reset device scsi_regs[REG_IRQSTATE] = 8; // indicate success - logerror("53cf96: reset target ID = %d (PC = %x)\n", last_id, cpu_get_pc(&space.device())); + logerror("53cf96: reset target ID = %d (PC = %x)\n", last_id, space.device().safe_pc()); if (devices[last_id]) { devices[last_id]->reset(); @@ -121,7 +121,7 @@ WRITE8_MEMBER( am53cf96_device::write ) scsi_regs[REG_INTSTATE] = 4; } - logerror("53cf96: command %x exec. target ID = %d (PC = %x)\n", fifo[1], last_id, cpu_get_pc(&space.device())); + logerror("53cf96: command %x exec. target ID = %d (PC = %x)\n", fifo[1], last_id, space.device().safe_pc()); if (devices[last_id]) { int length; diff --git a/src/emu/machine/k056230.c b/src/emu/machine/k056230.c index 4a5ead590b0..e37662323aa 100644 --- a/src/emu/machine/k056230.c +++ b/src/emu/machine/k056230.c @@ -82,7 +82,7 @@ READ8_DEVICE_HANDLER_TRAMPOLINE(k056230, k056230_r) } } -// mame_printf_debug("k056230_r: %d at %08X\n", offset, cpu_get_pc(&space->device())); +// mame_printf_debug("k056230_r: %d at %08X\n", offset, space->device().safe_pc()); return 0; } @@ -132,17 +132,17 @@ WRITE8_DEVICE_HANDLER_TRAMPOLINE(k056230, k056230_w) break; } } -// mame_printf_debug("k056230_w: %d, %02X at %08X\n", offset, data, cpu_get_pc(&space->device())); +// mame_printf_debug("k056230_w: %d, %02X at %08X\n", offset, data, space->device().safe_pc()); } READ32_DEVICE_HANDLER_TRAMPOLINE(k056230, lanc_ram_r) { - //mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space->device())); + //mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, space->device().safe_pc()); return m_ram[offset & 0x7ff]; } WRITE32_DEVICE_HANDLER_TRAMPOLINE(k056230, lanc_ram_w) { - //mame_printf_debug("LANC_RAM_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device())); + //mame_printf_debug("LANC_RAM_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space->device().safe_pc()); COMBINE_DATA(m_ram + (offset & 0x7ff)); } diff --git a/src/emu/machine/ldpr8210.c b/src/emu/machine/ldpr8210.c index 82ddd80d78c..79f7f3cf366 100644 --- a/src/emu/machine/ldpr8210.c +++ b/src/emu/machine/ldpr8210.c @@ -544,7 +544,7 @@ READ8_MEMBER( pioneer_pr8210_device::i8049_pia_r ) break; default: - mame_printf_debug("%03X:Unknown PR-8210 PIA read from offset %02X\n", cpu_get_pc(&space.device()), offset); + mame_printf_debug("%03X:Unknown PR-8210 PIA read from offset %02X\n", space.device().safe_pc(), offset); break; } return result; @@ -616,7 +616,7 @@ WRITE8_MEMBER( pioneer_pr8210_device::i8049_pia_w ) // no other writes known default: - mame_printf_debug("%03X:Unknown PR-8210 PIA write to offset %02X = %02X\n", cpu_get_pc(&space.device()), offset, data); + mame_printf_debug("%03X:Unknown PR-8210 PIA write to offset %02X = %02X\n", space.device().safe_pc(), offset, data); break; } } @@ -1097,13 +1097,13 @@ WRITE8_MEMBER( simutrek_special_device::i8748_port2_w ) { int direction = (data & 0x08) ? 1 : -1; if (LOG_SIMUTREK) - printf("%3d:JUMP TRG (Simutrek PC=%03X)\n", screen().vpos(), cpu_get_pc(&space.device())); + printf("%3d:JUMP TRG (Simutrek PC=%03X)\n", screen().vpos(), space.device().safe_pc()); advance_slider(direction); } // bit $04 controls who owns the JUMP TRG command if (LOG_SIMUTREK && ((data ^ prev) & 0x04)) - printf("%3d:Simutrek ownership line = %d (Simutrek PC=%03X)\n", screen().vpos(), (data >> 2) & 1, cpu_get_pc(&space.device())); + printf("%3d:Simutrek ownership line = %d (Simutrek PC=%03X)\n", screen().vpos(), (data >> 2) & 1, space.device().safe_pc()); m_controlnext = (~data >> 2) & 1; // bits $03 control something (status?) diff --git a/src/emu/machine/ldv1000.c b/src/emu/machine/ldv1000.c index 14cf1ac7b49..1d7e270b6c2 100644 --- a/src/emu/machine/ldv1000.c +++ b/src/emu/machine/ldv1000.c @@ -469,7 +469,7 @@ READ8_MEMBER( pioneer_ldv1000_device::z80_controller_r ) WRITE8_MEMBER( pioneer_ldv1000_device::z80_controller_w ) { if (LOG_STATUS_CHANGES && data != m_status) - printf("%04X:CONTROLLER.W=%02X\n", cpu_get_pc(&space.device()), data); + printf("%04X:CONTROLLER.W=%02X\n", space.device().safe_pc(), data); m_status = data; } diff --git a/src/emu/machine/ldvp931.c b/src/emu/machine/ldvp931.c index 7adb45b6e75..f4b5fde8017 100644 --- a/src/emu/machine/ldvp931.c +++ b/src/emu/machine/ldvp931.c @@ -382,7 +382,7 @@ WRITE8_MEMBER( phillips_22vp931_device::i8049_output0_w ) if (LOG_PORTS && (m_i8049_out0 ^ data) & 0xff) { - printf("%03X:out0:", cpu_get_pc(&space.device())); + printf("%03X:out0:", space.device().safe_pc()); if ( (data & 0x80)) printf(" ???"); if ( (data & 0x40)) printf(" LED1"); if ( (data & 0x20)) printf(" LED2"); @@ -422,7 +422,7 @@ WRITE8_MEMBER( phillips_22vp931_device::i8049_output1_w ) if (LOG_PORTS && (m_i8049_out1 ^ data) & 0x08) { - mame_printf_debug("%03X:out1:", cpu_get_pc(&space.device())); + mame_printf_debug("%03X:out1:", space.device().safe_pc()); if (!(data & 0x08)) mame_printf_debug(" SMS"); mame_printf_debug("\n"); m_i8049_out1 = data; @@ -570,7 +570,7 @@ WRITE8_MEMBER( phillips_22vp931_device::i8049_port1_w ) if (LOG_PORTS && (m_i8049_port1 ^ data) & 0x1f) { - printf("%03X:port1:", cpu_get_pc(&space.device())); + printf("%03X:port1:", space.device().safe_pc()); if (!(data & 0x10)) printf(" SPEED"); if (!(data & 0x08)) printf(" TIMENABLE"); if (!(data & 0x04)) printf(" REV"); diff --git a/src/emu/machine/ncr539x.c b/src/emu/machine/ncr539x.c index d786eb6249a..d2288e33db2 100644 --- a/src/emu/machine/ncr539x.c +++ b/src/emu/machine/ncr539x.c @@ -346,7 +346,7 @@ READ8_MEMBER( ncr539x_device::read ) #if VERBOSE #if VERBOSE_READS - printf("539x: Read @ %s (%02x) (PC=%x) (status %02x irq_status %02x)\n", rdregs[offset], offset, cpu_get_pc(&space.device()), m_status, m_irq_status); + printf("539x: Read @ %s (%02x) (PC=%x) (status %02x irq_status %02x)\n", rdregs[offset], offset, space.device().safe_pc(), m_status, m_irq_status); #endif #endif @@ -377,7 +377,7 @@ READ8_MEMBER( ncr539x_device::read ) update_fifo_internal_state(fifo_bytes); #if VERBOSE - printf("Read %02x from FIFO[%d], FIFO now contains %d bytes (PC=%x, m_buffer_remaining %x)\n", rv, m_fifo_ptr-1, fifo_bytes, cpu_get_pc(&space.device()), m_buffer_remaining); + printf("Read %02x from FIFO[%d], FIFO now contains %d bytes (PC=%x, m_buffer_remaining %x)\n", rv, m_fifo_ptr-1, fifo_bytes, space.device().safe_pc(), m_buffer_remaining); #endif if (fifo_bytes == 0) @@ -484,7 +484,7 @@ READ8_MEMBER( ncr539x_device::read ) WRITE8_MEMBER( ncr539x_device::write ) { #if VERBOSE - if (offset != 2) printf("539x: Write %02x @ %s (%02x) (PC=%x)\n", data, wrregs[offset], offset, cpu_get_pc(&space.device())); + if (offset != 2) printf("539x: Write %02x @ %s (%02x) (PC=%x)\n", data, wrregs[offset], offset, space.device().safe_pc()); #endif switch (offset) diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c index 369cf9949e5..49c48b3d572 100644 --- a/src/emu/machine/tmp68301.c +++ b/src/emu/machine/tmp68301.c @@ -166,7 +166,7 @@ WRITE16_HANDLER( tmp68301_regs_w ) if (!ACCESSING_BITS_0_7) return; -// logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n",cpu_get_pc(&space->device()),offset*2,data,mem_mask^0xffff); +// logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n",space->device().safe_pc(),offset*2,data,mem_mask^0xffff); switch( offset * 2 ) { diff --git a/src/emu/machine/wd33c93.c b/src/emu/machine/wd33c93.c index 463a78960a4..d15b04abced 100644 --- a/src/emu/machine/wd33c93.c +++ b/src/emu/machine/wd33c93.c @@ -487,7 +487,7 @@ WRITE8_MEMBER(wd33c93_device::write) case 1: { - LOG(( "WD33C93: PC=%08x - Write REG=%02x, data = %02x\n", cpu_get_pc(&space.device()), sasr, data )); + LOG(( "WD33C93: PC=%08x - Write REG=%02x, data = %02x\n", space.device().safe_pc(), sasr, data )); /* update the register */ regs[sasr] = data; @@ -495,7 +495,7 @@ WRITE8_MEMBER(wd33c93_device::write) /* if we receive a command, schedule to process it */ if ( sasr == WD_COMMAND ) { - LOG(( "WDC33C93: PC=%08x - Executing command %08x - unit %d\n", cpu_get_pc(&space.device()), data, getunit() )); + LOG(( "WDC33C93: PC=%08x - Executing command %08x - unit %d\n", space.device().safe_pc(), data, getunit() )); /* signal we're processing it */ regs[WD_AUXILIARY_STATUS] |= ASR_CIP; @@ -646,7 +646,7 @@ READ8_MEMBER(wd33c93_device::read) irq_callback(machine(), 0); } - LOG(( "WD33C93: PC=%08x - Status read (%02x)\n", cpu_get_pc(&space.device()), regs[WD_SCSI_STATUS] )); + LOG(( "WD33C93: PC=%08x - Status read (%02x)\n", space.device().safe_pc(), regs[WD_SCSI_STATUS] )); } else if ( sasr == WD_DATA ) { @@ -715,7 +715,7 @@ READ8_MEMBER(wd33c93_device::read) } } - LOG(( "WD33C93: PC=%08x - Data read (%02x)\n", cpu_get_pc(&space.device()), regs[WD_DATA] )); + LOG(( "WD33C93: PC=%08x - Data read (%02x)\n", space.device().safe_pc(), regs[WD_DATA] )); /* get the register value */ ret = regs[sasr]; diff --git a/src/emu/sound/nile.c b/src/emu/sound/nile.c index 5214b05df38..1aef7546c85 100644 --- a/src/emu/sound/nile.c +++ b/src/emu/sound/nile.c @@ -78,7 +78,7 @@ WRITE16_DEVICE_HANDLER( nile_sndctrl_w ) COMBINE_DATA(&info->ctrl); -// printf("CTRL: %04x -> %04x (PC=%x)\n", ctrl, info->ctrl, cpu_get_pc(&space->device())); +// printf("CTRL: %04x -> %04x (PC=%x)\n", ctrl, info->ctrl, space->device().safe_pc()); ctrl^=info->ctrl; } @@ -133,7 +133,7 @@ WRITE16_DEVICE_HANDLER( nile_snd_w ) info->vpos[v] = info->frac[v] = info->lponce[v] = 0; } - //printf("v%02d: %04x to reg %02d (PC=%x)\n", v, info->sound_regs[offset], r, cpu_get_pc(&space->device())); + //printf("v%02d: %04x to reg %02d (PC=%x)\n", v, info->sound_regs[offset], r, space->device().safe_pc()); } static STREAM_UPDATE( nile_update ) diff --git a/src/emu/video/hd63484.c b/src/emu/video/hd63484.c index 79c2d810d8f..d1125086633 100644 --- a/src/emu/video/hd63484.c +++ b/src/emu/video/hd63484.c @@ -1468,8 +1468,8 @@ static void hd63484_command_w(device_t *device, UINT16 cmd) READ16_DEVICE_HANDLER( hd63484_status_r ) { -// if (cpu_get_pc(&space->device()) != 0xfced6 && cpu_get_pc(&space->device()) != 0xfe1d6) -// logerror("%05x: HD63484 status read\n",cpu_get_pc(&space->device())); +// if (space->device().safe_pc() != 0xfced6 && space->device().safe_pc() != 0xfe1d6) +// logerror("%05x: HD63484 status read\n",space->device().safe_pc()); return 0xff22 | (device->machine().rand() & 0x0004); /* write FIFO ready + command end + (read FIFO ready or read FIFO not ready) */ } @@ -1496,7 +1496,7 @@ WRITE16_DEVICE_HANDLER( hd63484_data_w ) hd63484->regno += 2; /* autoincrement */ #if LOG_COMMANDS -// logerror("PC %05x: HD63484 register %02x write %04x\n", cpu_get_pc(&space->device()), hd63484->regno, hd63484->reg[hd63484->regno/2]); +// logerror("PC %05x: HD63484 register %02x write %04x\n", space->device().safe_pc(), hd63484->regno, hd63484->reg[hd63484->regno/2]); #endif if (hd63484->regno == 0) /* FIFO */ @@ -1513,14 +1513,14 @@ READ16_DEVICE_HANDLER( hd63484_data_r ) else if (hd63484->regno == 0) { #if LOG_COMMANDS -// logerror("%05x: HD63484 read FIFO\n", cpu_get_pc(&space->device())); +// logerror("%05x: HD63484 read FIFO\n", space->device().safe_pc()); #endif res = hd63484->readfifo; } else { #if LOG_COMMANDS -// logerror("%05x: HD63484 read register %02x\n", cpu_get_pc(&space->device()), hd63484->regno); +// logerror("%05x: HD63484 read register %02x\n", space->device().safe_pc(), hd63484->regno); #endif res = 0; } diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c index 415ab10ef10..d07e232e5f8 100644 --- a/src/emu/video/pc_vga.c +++ b/src/emu/video/pc_vga.c @@ -1667,7 +1667,7 @@ READ8_HANDLER(vga_port_03d0_r) data = vga_crtc_r(space, offset); if(offset == 8) { - logerror("VGA: 0x3d8 read at %08x\n",cpu_get_pc(&space->device())); + logerror("VGA: 0x3d8 read at %08x\n",space->device().safe_pc()); data = 0; // TODO: PC-200 reads back CGA register here, everything else returns open bus OR CGA emulation of register 0x3d8 } diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index fbfe693dc88..3bccbc714b3 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -3866,7 +3866,7 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) /* don't log multiple identical status reads from the same address */ if (regnum == status) { - offs_t pc = cpu_get_pc(v->cpu); + offs_t pc = v->cpu->safe_pc(); if (pc == v->last_status_pc && result == v->last_status_value) logit = FALSE; v->last_status_pc = pc; diff --git a/src/mame/audio/beezer.c b/src/mame/audio/beezer.c index 0bc952d3bbc..21e30eeff94 100644 --- a/src/mame/audio/beezer.c +++ b/src/mame/audio/beezer.c @@ -499,7 +499,7 @@ READ8_DEVICE_HANDLER( beezer_sh6840_r ) return 0; /* offset 1 reads the status register: bits 2 1 0 correspond to ints on channels 2,1,0, and bit 7 is an 'OR' of bits 2,1,0 */ case 1: - logerror("%04X:beezer_sh6840_r - unexpected read, status register is TODO!\n", cpu_get_pc(state->m_maincpu)); + logerror("%04X:beezer_sh6840_r - unexpected read, status register is TODO!\n", state->m_maincpu->safe_pc()); return 0; /* offsets 2,4,6 read channel 0,1,2 MSBs and latch the LSB*/ case 2: case 4: case 6: diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c index a466e9c1fc2..635014b4d7a 100644 --- a/src/mame/audio/cage.c +++ b/src/mame/audio/cage.c @@ -410,7 +410,7 @@ static READ32_HANDLER( tms32031_io_r ) } if (LOG_32031_IOPORTS) - logerror("CAGE:%06X:%s read -> %08X\n", cpu_get_pc(&space->device()), register_names[offset & 0x7f], result); + logerror("CAGE:%06X:%s read -> %08X\n", space->device().safe_pc(), register_names[offset & 0x7f], result); return result; } @@ -423,7 +423,7 @@ static WRITE32_HANDLER( tms32031_io_w ) COMBINE_DATA(&tms32031_io_regs[offset]); if (LOG_32031_IOPORTS) - logerror("CAGE:%06X:%s write = %08X\n", cpu_get_pc(&space->device()), register_names[offset & 0x7f], tms32031_io_regs[offset]); + logerror("CAGE:%06X:%s write = %08X\n", space->device().safe_pc(), register_names[offset & 0x7f], tms32031_io_regs[offset]); switch (offset) { @@ -506,7 +506,7 @@ static READ32_HANDLER( cage_from_main_r ) { cage_t *state = &cage; if (LOG_COMM) - logerror("%06X:CAGE read command = %04X\n", cpu_get_pc(&space->device()), state->from_main); + logerror("%06X:CAGE read command = %04X\n", space->device().safe_pc(), state->from_main); state->cpu_to_cage_ready = 0; update_control_lines(space->machine()); device_set_input_line(state->cpu, TMS3203X_IRQ0, CLEAR_LINE); @@ -519,7 +519,7 @@ static WRITE32_HANDLER( cage_from_main_ack_w ) if (LOG_COMM) { cage_t *state = &cage; - logerror("%06X:CAGE ack command = %04X\n", cpu_get_pc(&space->device()), state->from_main); + logerror("%06X:CAGE ack command = %04X\n", space->device().safe_pc(), state->from_main); } } @@ -528,7 +528,7 @@ static WRITE32_HANDLER( cage_to_main_w ) { cage_t *state = &cage; if (LOG_COMM) - logerror("%06X:Data from CAGE = %04X\n", cpu_get_pc(&space->device()), data); + logerror("%06X:Data from CAGE = %04X\n", space->device().safe_pc(), data); driver_device *drvstate = space->machine().driver_data(); drvstate->soundlatch_word_w(*space, 0, data, mem_mask); state->cage_to_cpu_ready = 1; diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index bd6326ba136..43959bf020d 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -1451,7 +1451,7 @@ WRITE32_HANDLER( dsio_idma_addr_w ) { dsio_state &dsio = dcs.dsio; if (LOG_DCS_TRANSFERS) - logerror("%08X:IDMA_addr = %04X\n", cpu_get_pc(&space->device()), data); + logerror("%08X:IDMA_addr = %04X\n", space->device().safe_pc(), data); downcast(dcs.cpu)->idma_addr_w(data); if (data == 0) dsio.start_on_next_write = 2; @@ -1461,7 +1461,7 @@ WRITE32_HANDLER( dsio_idma_addr_w ) WRITE32_HANDLER( dsio_idma_data_w ) { dsio_state &dsio = dcs.dsio; - UINT32 pc = cpu_get_pc(&space->device()); + UINT32 pc = space->device().safe_pc(); if (ACCESSING_BITS_0_15) { if (LOG_DCS_TRANSFERS) @@ -1487,7 +1487,7 @@ READ32_HANDLER( dsio_idma_data_r ) UINT32 result; result = downcast(dcs.cpu)->idma_data_r(); if (LOG_DCS_TRANSFERS) - logerror("%08X:IDMA_data_r(%04X) = %04X\n", cpu_get_pc(&space->device()), downcast(dcs.cpu)->idma_addr_r(), result); + logerror("%08X:IDMA_data_r(%04X) = %04X\n", space->device().safe_pc(), downcast(dcs.cpu)->idma_addr_r(), result); return result; } @@ -1622,7 +1622,7 @@ static READ16_HANDLER( input_latch_r ) if (dcs.auto_ack) input_latch_ack_w(space,0,0,0xffff); if (LOG_DCS_IO) - logerror("%08X:input_latch_r(%04X)\n", cpu_get_pc(&space->device()), dcs.input_data); + logerror("%08X:input_latch_r(%04X)\n", space->device().safe_pc(), dcs.input_data); return dcs.input_data; } @@ -1644,7 +1644,7 @@ static TIMER_CALLBACK( latch_delayed_w ) static WRITE16_HANDLER( output_latch_w ) { if (LOG_DCS_IO) - logerror("%08X:output_latch_w(%04X) (empty=%d)\n", cpu_get_pc(&space->device()), data, IS_OUTPUT_EMPTY()); + logerror("%08X:output_latch_w(%04X) (empty=%d)\n", space->device().safe_pc(), data, IS_OUTPUT_EMPTY()); space->machine().scheduler().synchronize(FUNC(latch_delayed_w), data); } @@ -1698,7 +1698,7 @@ static TIMER_CALLBACK( output_control_delayed_w ) static WRITE16_HANDLER( output_control_w ) { if (LOG_DCS_IO) - logerror("%04X:output_control = %04X\n", cpu_get_pc(&space->device()), data); + logerror("%04X:output_control = %04X\n", space->device().safe_pc(), data); space->machine().scheduler().synchronize(FUNC(output_control_delayed_w), data); } @@ -1884,7 +1884,7 @@ static WRITE16_HANDLER( adsp_control_w ) /* bit 9 forces a reset */ if (data & 0x0200) { - logerror("%04X:Rebooting DCS due to SYSCONTROL write\n", cpu_get_pc(&space->device())); + logerror("%04X:Rebooting DCS due to SYSCONTROL write\n", space->device().safe_pc()); device_set_input_line(dcs.cpu, INPUT_LINE_RESET, PULSE_LINE); dcs_boot(space->machine()); dcs.control_regs[SYSCONTROL_REG] = 0; diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c index 1910126aede..7638b289ec4 100644 --- a/src/mame/audio/exidy.c +++ b/src/mame/audio/exidy.c @@ -686,7 +686,7 @@ READ8_DEVICE_HANDLER( exidy_sh6840_r ) return 0; /* offset 1 reads the status register: bits 2 1 0 correspond to ints on channels 2,1,0, and bit 7 is an 'OR' of bits 2,1,0 */ case 1: - logerror("%04X:exidy_sh6840_r - unexpected read, status register is TODO!\n", cpu_get_pc(state->m_maincpu)); + logerror("%04X:exidy_sh6840_r - unexpected read, status register is TODO!\n", state->m_maincpu->safe_pc()); return 0; /* offsets 2,4,6 read channel 0,1,2 MSBs and latch the LSB*/ case 2: case 4: case 6: @@ -1043,7 +1043,7 @@ READ8_DEVICE_HANDLER( victory_sound_response_r ) exidy_sound_state *state = get_safe_token(device); UINT8 ret = state->m_pia1->b_output(); - if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound response read = %02X\n", cpu_get_previouspc(state->m_maincpu), ret); + if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound response read = %02X\n", state->m_maincpu->safe_pcbase(), ret); state->m_pia1->cb1_w(0); @@ -1056,7 +1056,7 @@ READ8_DEVICE_HANDLER( victory_sound_status_r ) exidy_sound_state *state = get_safe_token(device); UINT8 ret = (state->m_pia1->ca1_r() << 7) | (state->m_pia1->cb1_r() << 6); - if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound status read = %02X\n", cpu_get_previouspc(state->m_maincpu), ret); + if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound status read = %02X\n", state->m_maincpu->safe_pcbase(), ret); return ret; } @@ -1073,7 +1073,7 @@ WRITE8_DEVICE_HANDLER( victory_sound_command_w ) { exidy_sound_state *state = get_safe_token(device); - if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound command = %02X\n", cpu_get_previouspc(state->m_maincpu), data); + if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound command = %02X\n", state->m_maincpu->safe_pcbase(), data); device->machine().scheduler().synchronize(FUNC(delayed_command_w), data, state->m_pia1); } diff --git a/src/mame/audio/harddriv.c b/src/mame/audio/harddriv.c index 6deaef8c97f..dbfc3e27253 100644 --- a/src/mame/audio/harddriv.c +++ b/src/mame/audio/harddriv.c @@ -54,7 +54,7 @@ static void update_68k_interrupts(running_machine &machine) READ16_MEMBER(harddriv_state::hd68k_snd_data_r) { m_soundflag = 0; - logerror("%06X:main read from sound=%04X\n", cpu_get_previouspc(&space.device()), m_sounddata); + logerror("%06X:main read from sound=%04X\n", space.device().safe_pcbase(), m_sounddata); return m_sounddata; } @@ -77,7 +77,7 @@ static TIMER_CALLBACK( delayed_68k_w ) WRITE16_MEMBER(harddriv_state::hd68k_snd_data_w) { machine().scheduler().synchronize(FUNC(delayed_68k_w), data); - logerror("%06X:main write to sound=%04X\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:main write to sound=%04X\n", space.device().safe_pcbase(), data); } @@ -87,7 +87,7 @@ WRITE16_MEMBER(harddriv_state::hd68k_snd_reset_w) device_set_input_line(m_soundcpu, INPUT_LINE_RESET, CLEAR_LINE); m_mainflag = m_soundflag = 0; update_68k_interrupts(machine()); - logerror("%06X:Reset sound\n", cpu_get_previouspc(&space.device())); + logerror("%06X:Reset sound\n", space.device().safe_pcbase()); } @@ -102,7 +102,7 @@ READ16_MEMBER(harddriv_state::hdsnd68k_data_r) { m_mainflag = 0; update_68k_interrupts(machine()); - logerror("%06X:sound read from main=%04X\n", cpu_get_previouspc(&space.device()), m_maindata); + logerror("%06X:sound read from main=%04X\n", space.device().safe_pcbase(), m_maindata); return m_maindata; } @@ -111,7 +111,7 @@ WRITE16_MEMBER(harddriv_state::hdsnd68k_data_w) { COMBINE_DATA(&m_sounddata); m_soundflag = 1; - logerror("%06X:sound write to main=%04X\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:sound write to main=%04X\n", space.device().safe_pcbase(), data); } @@ -124,14 +124,14 @@ WRITE16_MEMBER(harddriv_state::hdsnd68k_data_w) READ16_MEMBER(harddriv_state::hdsnd68k_switches_r) { - logerror("%06X:hdsnd68k_switches_r(%04X)\n", cpu_get_previouspc(&space.device()), offset); + logerror("%06X:hdsnd68k_switches_r(%04X)\n", space.device().safe_pcbase(), offset); return 0; } READ16_MEMBER(harddriv_state::hdsnd68k_320port_r) { - logerror("%06X:hdsnd68k_320port_r(%04X)\n", cpu_get_previouspc(&space.device()), offset); + logerror("%06X:hdsnd68k_320port_r(%04X)\n", space.device().safe_pcbase(), offset); return 0; } @@ -143,7 +143,7 @@ READ16_MEMBER(harddriv_state::hdsnd68k_status_r) // D14 = 'Sound Flag' // D13 = Test Switch // D12 = 5220 Ready Flag (0=Ready) - logerror("%06X:hdsnd68k_status_r(%04X)\n", cpu_get_previouspc(&space.device()), offset); + logerror("%06X:hdsnd68k_status_r(%04X)\n", space.device().safe_pcbase(), offset); return (m_mainflag << 15) | (m_soundflag << 14) | 0x2000 | 0;//((ioport("IN0")->read() & 0x0020) << 8) | 0; } @@ -167,17 +167,17 @@ WRITE16_MEMBER(harddriv_state::hdsnd68k_latches_w) { case 0: /* SPWR - 5220 write strobe */ /* data == 0 means high, 1 means low */ - logerror("%06X:SPWR=%d\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:SPWR=%d\n", space.device().safe_pcbase(), data); break; case 1: /* SPRES - 5220 hard reset */ /* data == 0 means low, 1 means high */ - logerror("%06X:SPRES=%d\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:SPRES=%d\n", space.device().safe_pcbase(), data); break; case 2: /* SPRATE */ /* data == 0 means 8kHz, 1 means 10kHz */ - logerror("%06X:SPRATE=%d\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:SPRATE=%d\n", space.device().safe_pcbase(), data); break; case 3: /* CRAMEN */ @@ -186,7 +186,7 @@ WRITE16_MEMBER(harddriv_state::hdsnd68k_latches_w) break; case 4: /* RES320 */ - logerror("%06X:RES320=%d\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:RES320=%d\n", space.device().safe_pcbase(), data); if (m_sounddsp != NULL) device_set_input_line(m_sounddsp, INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE); break; @@ -199,7 +199,7 @@ WRITE16_MEMBER(harddriv_state::hdsnd68k_latches_w) WRITE16_MEMBER(harddriv_state::hdsnd68k_speech_w) { - logerror("%06X:hdsnd68k_speech_w(%04X)=%04X\n", cpu_get_previouspc(&space.device()), offset, data); + logerror("%06X:hdsnd68k_speech_w(%04X)=%04X\n", space.device().safe_pcbase(), offset, data); } @@ -249,7 +249,7 @@ READ16_MEMBER(harddriv_state::hdsnd68k_320com_r) if (m_cramen) return m_comram[offset & 0x1ff]; - logerror("%06X:hdsnd68k_320com_r(%04X) -- not allowed\n", cpu_get_previouspc(&space.device()), offset); + logerror("%06X:hdsnd68k_320com_r(%04X) -- not allowed\n", space.device().safe_pcbase(), offset); return 0xffff; } @@ -260,7 +260,7 @@ WRITE16_MEMBER(harddriv_state::hdsnd68k_320com_w) if (m_cramen) COMBINE_DATA(&m_comram[offset & 0x1ff]); else - logerror("%06X:hdsnd68k_320com_w(%04X)=%04X -- not allowed\n", cpu_get_previouspc(&space.device()), offset, data); + logerror("%06X:hdsnd68k_320com_w(%04X)=%04X -- not allowed\n", space.device().safe_pcbase(), offset, data); } @@ -308,7 +308,7 @@ WRITE16_DEVICE_HANDLER( hdsnddsp_dac_w ) WRITE16_MEMBER(harddriv_state::hdsnddsp_comport_w) { /* COM port TD0-7 */ - logerror("%06X:hdsnddsp_comport_w=%d\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:hdsnddsp_comport_w=%d\n", space.device().safe_pcbase(), data); } @@ -316,7 +316,7 @@ WRITE16_MEMBER(harddriv_state::hdsnddsp_mute_w) { /* mute DAC audio, D0=1 */ /* m_dacmute = data & 1; -- NOT STUFFED */ - logerror("%06X:mute DAC=%d\n", cpu_get_previouspc(&space.device()), data); + logerror("%06X:mute DAC=%d\n", space.device().safe_pcbase(), data); } @@ -360,6 +360,6 @@ READ16_MEMBER(harddriv_state::hdsnddsp_comram_r) READ16_MEMBER(harddriv_state::hdsnddsp_compare_r) { - logerror("%06X:hdsnddsp_compare_r(%04X)\n", cpu_get_previouspc(&space.device()), offset); + logerror("%06X:hdsnddsp_compare_r(%04X)\n", space.device().safe_pcbase(), offset); return 0; } diff --git a/src/mame/audio/invinco.c b/src/mame/audio/invinco.c index 92e48c849c5..fb7ea82ce31 100644 --- a/src/mame/audio/invinco.c +++ b/src/mame/audio/invinco.c @@ -108,6 +108,6 @@ WRITE8_HANDLER( invinco_audio_w ) } #if 0 - logerror("Went LO: %02X %04X\n", bitsGoneLow, cpu_get_pc(&space->device())); + logerror("Went LO: %02X %04X\n", bitsGoneLow, space->device().safe_pc()); #endif } diff --git a/src/mame/audio/jaguar.c b/src/mame/audio/jaguar.c index 7739ae54cec..0c405cd908a 100644 --- a/src/mame/audio/jaguar.c +++ b/src/mame/audio/jaguar.c @@ -217,7 +217,7 @@ void jaguar_state::sound_start() READ16_MEMBER( jaguar_state::jerry_regs_r ) { if (offset != JINTCTRL && offset != JINTCTRL+2) - logerror("%08X:jerry read register @ F10%03X\n", cpu_get_previouspc(&space.device()), offset * 2); + logerror("%08X:jerry read register @ F10%03X\n", space.device().safe_pcbase(), offset * 2); switch (offset) { @@ -244,7 +244,7 @@ WRITE16_MEMBER( jaguar_state::jerry_regs_w ) } if (offset != JINTCTRL && offset != JINTCTRL+2 && offset != ASICTRL) - logerror("%08X:jerry write register @ F10%03X = %04X\n", cpu_get_previouspc(&space.device()), offset * 2, data); + logerror("%08X:jerry write register @ F10%03X = %04X\n", space.device().safe_pcbase(), offset * 2, data); } @@ -322,7 +322,7 @@ void jaguar_state::serial_update() READ32_MEMBER( jaguar_state::serial_r ) { - logerror("%08X:jaguar_serial_r(%X)\n", cpu_get_previouspc(&space.device()), offset); + logerror("%08X:jaguar_serial_r(%X)\n", space.device().safe_pcbase(), offset); return 0; } @@ -358,7 +358,7 @@ WRITE32_MEMBER( jaguar_state::serial_w ) break; default: - logerror("%08X:jaguar_serial_w(%X,%X)\n", cpu_get_previouspc(&space.device()), offset, data); + logerror("%08X:jaguar_serial_w(%X,%X)\n", space.device().safe_pcbase(), offset, data); break; } } diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c index 6de4f5bf808..4486416d95a 100644 --- a/src/mame/audio/leland.c +++ b/src/mame/audio/leland.c @@ -1258,21 +1258,21 @@ static READ16_DEVICE_HANDLER( i80186_internal_port_r ) switch (offset) { case 0x22/2: - logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(state->m_i80186.cpu)); + logerror("%05X:ERROR - read from 80186 EOI\n", state->m_i80186.cpu->safe_pc()); break; case 0x24/2: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", state->m_i80186.cpu->safe_pc()); if (state->m_i80186.intr.poll_status & 0x8000) int_callback(state->m_i80186.cpu, 0); return state->m_i80186.intr.poll_status; case 0x26/2: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.poll_status; case 0x28/2: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", state->m_i80186.cpu->safe_pc()); temp = (state->m_i80186.intr.timer >> 3) & 0x01; temp |= (state->m_i80186.intr.dma[0] >> 1) & 0x04; temp |= (state->m_i80186.intr.dma[1] >> 0) & 0x08; @@ -1283,56 +1283,56 @@ static READ16_DEVICE_HANDLER( i80186_internal_port_r ) return temp; case 0x2a/2: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.priority_mask; case 0x2c/2: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.in_service; case 0x2e/2: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", state->m_i80186.cpu->safe_pc()); temp = state->m_i80186.intr.request & ~0x0001; if (state->m_i80186.intr.status & 0x0007) temp |= 1; return temp; case 0x30/2: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.status; case 0x32/2: - if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.timer; case 0x34/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.dma[0]; case 0x36/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.dma[1]; case 0x38/2: - if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.ext[0]; case 0x3a/2: - if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.ext[1]; case 0x3c/2: - if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.ext[2]; case 0x3e/2: - if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.intr.ext[3]; case 0x50/2: case 0x58/2: case 0x60/2: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4); which = (offset - 0x50/2) / 4; if (ACCESSING_BITS_0_7) internal_timer_sync(state, which); @@ -1341,87 +1341,87 @@ static READ16_DEVICE_HANDLER( i80186_internal_port_r ) case 0x52/2: case 0x5a/2: case 0x62/2: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4); which = (offset - 0x50/2) / 4; return state->m_i80186.timer[which].maxA; case 0x54/2: case 0x5c/2: - logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(state->m_i80186.cpu), (offset/2 - 0x50) / 4); + logerror("%05X:read 80186 Timer %d max B\n", state->m_i80186.cpu->safe_pc(), (offset/2 - 0x50) / 4); which = (offset - 0x50/2) / 4; return state->m_i80186.timer[which].maxB; case 0x56/2: case 0x5e/2: case 0x66/2: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4); which = (offset - 0x50/2) / 4; return state->m_i80186.timer[which].control; case 0xa0/2: - if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.mem.upper; case 0xa2/2: - if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.mem.lower; case 0xa4/2: - if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.mem.peripheral; case 0xa6/2: - if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.mem.middle; case 0xa8/2: - if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(state->m_i80186.cpu)); + if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", state->m_i80186.cpu->safe_pc()); return state->m_i80186.mem.middle_size; case 0xc0/2: case 0xd0/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); return state->m_i80186.dma[which].source; case 0xc2/2: case 0xd2/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); return state->m_i80186.dma[which].source >> 16; case 0xc4/2: case 0xd4/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); return state->m_i80186.dma[which].dest; case 0xc6/2: case 0xd6/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); return state->m_i80186.dma[which].dest >> 16; case 0xc8/2: case 0xd8/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); return state->m_i80186.dma[which].count; case 0xca/2: case 0xda/2: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); return state->m_i80186.dma[which].control; default: - logerror("%05X:read 80186 port %02X\n", cpu_get_pc(state->m_i80186.cpu), offset*2); + logerror("%05X:read 80186 port %02X\n", state->m_i80186.cpu->safe_pc(), offset*2); break; } return 0x00; @@ -1449,21 +1449,21 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) switch (offset) { case 0x22/2: - if (LOG_PORTS) logerror("%05X:80186 EOI = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 EOI = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); handle_eoi(device, 0x8000); update_interrupt_state(device); break; case 0x24/2: - logerror("%05X:ERROR - write to 80186 interrupt poll = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + logerror("%05X:ERROR - write to 80186 interrupt poll = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); break; case 0x26/2: - logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); break; case 0x28/2: - if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.timer = (state->m_i80186.intr.timer & ~0x08) | ((data << 3) & 0x08); state->m_i80186.intr.dma[0] = (state->m_i80186.intr.dma[0] & ~0x08) | ((data << 1) & 0x08); state->m_i80186.intr.dma[1] = (state->m_i80186.intr.dma[1] & ~0x08) | ((data << 0) & 0x08); @@ -1475,69 +1475,69 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) break; case 0x2a/2: - if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.priority_mask = data & 0x0007; update_interrupt_state(device); break; case 0x2c/2: - if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.in_service = data & 0x00ff; update_interrupt_state(device); break; case 0x2e/2: - if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.request = (state->m_i80186.intr.request & ~0x00c0) | (data & 0x00c0); update_interrupt_state(device); break; case 0x30/2: - if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.status = (state->m_i80186.intr.status & ~0x8000) | (data & 0x8000); state->m_i80186.intr.status = (state->m_i80186.intr.status & ~0x0007) | (data & 0x0007); update_interrupt_state(device); break; case 0x32/2: - if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.timer = data & 0x000f; break; case 0x34/2: - if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.dma[0] = data & 0x000f; break; case 0x36/2: - if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.dma[1] = data & 0x000f; break; case 0x38/2: - if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.ext[0] = data & 0x007f; break; case 0x3a/2: - if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.ext[1] = data & 0x007f; break; case 0x3c/2: - if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.ext[2] = data & 0x001f; break; case 0x3e/2: - if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.intr.ext[3] = data & 0x001f; break; case 0x50/2: case 0x58/2: case 0x60/2: - if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4, data, mem_mask); which = (offset - 0x50/2) / 4; internal_timer_update(state, which, data, -1, -1, -1); break; @@ -1545,14 +1545,14 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0x52/2: case 0x5a/2: case 0x62/2: - if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4, data, mem_mask); which = (offset - 0x50/2) / 4; internal_timer_update(state, which, -1, data, -1, -1); break; case 0x54/2: case 0x5c/2: - if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4, data, mem_mask); which = (offset - 0x50/2) / 4; internal_timer_update(state, which, -1, -1, data, -1); break; @@ -1560,33 +1560,33 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0x56/2: case 0x5e/2: case 0x66/2: - if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4, data, mem_mask); which = (offset - 0x50/2) / 4; internal_timer_update(state, which, -1, -1, -1, data); break; case 0xa0/2: - if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.mem.upper = data | 0xc038; break; case 0xa2/2: - if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.mem.lower = (data & 0x3fff) | 0x0038; break; case 0xa4/2: - if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.mem.peripheral = data | 0x0038; break; case 0xa6/2: - if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.mem.middle = data | 0x01f8; break; case 0xa8/2: - if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); state->m_i80186.mem.middle_size = data | 0x8038; temp = (state->m_i80186.mem.peripheral & 0xffc0) << 4; @@ -1608,7 +1608,7 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0xc0/2: case 0xd0/2: - if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8, data, mem_mask); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); state->m_i80186.dma[which].source = (state->m_i80186.dma[which].source & ~0x0ffff) | (data & 0x0ffff); @@ -1616,7 +1616,7 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0xc2/2: case 0xd2/2: - if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8, data, mem_mask); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); state->m_i80186.dma[which].source = (state->m_i80186.dma[which].source & ~0xf0000) | ((data << 16) & 0xf0000); @@ -1624,7 +1624,7 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0xc4/2: case 0xd4/2: - if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8, data, mem_mask); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); state->m_i80186.dma[which].dest = (state->m_i80186.dma[which].dest & ~0x0ffff) | (data & 0x0ffff); @@ -1632,7 +1632,7 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0xc6/2: case 0xd6/2: - if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8, data, mem_mask); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); state->m_i80186.dma[which].dest = (state->m_i80186.dma[which].dest & ~0xf0000) | ((data << 16) & 0xf0000); @@ -1640,7 +1640,7 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0xc8/2: case 0xd8/2: - if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8, data, mem_mask); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); state->m_i80186.dma[which].count = data; @@ -1648,14 +1648,14 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) case 0xca/2: case 0xda/2: - if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8, data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8, data, mem_mask); which = (offset - 0xc0/2) / 8; state->m_dma_stream->update(); update_dma_control(state, which, data); break; case 0xfe/2: - if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask); + if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask); /* we assume here there that this doesn't happen too often */ /* plus, we can't really remove the old memory range, so we also assume that it's */ @@ -1674,7 +1674,7 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) break; default: - logerror("%05X:80186 port %02X = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), offset*2, data, mem_mask); + logerror("%05X:80186 port %02X = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), offset*2, data, mem_mask); break; } } @@ -1830,7 +1830,7 @@ WRITE8_DEVICE_HANDLER( leland_80186_control_w ) if (LOG_COMM) { - logerror("%04X:80186 control = %02X", cpu_get_previouspc(state->m_i80186.cpu), data); + logerror("%04X:80186 control = %02X", state->m_i80186.cpu->safe_pcbase(), data); if (!(data & 0x80)) logerror(" /RESET"); if (!(data & 0x40)) logerror(" ZNMI"); if (!(data & 0x20)) logerror(" INT0"); @@ -1902,7 +1902,7 @@ WRITE8_DEVICE_HANDLER( leland_80186_command_lo_w ) WRITE8_DEVICE_HANDLER( leland_80186_command_hi_w ) { leland_sound_state *state = get_safe_token(device); - if (LOG_COMM) logerror("%04X:Write sound command latch hi = %02X\n", cpu_get_previouspc(state->m_i80186.cpu), data); + if (LOG_COMM) logerror("%04X:Write sound command latch hi = %02X\n", state->m_i80186.cpu->safe_pcbase(), data); state->m_sound_command = (state->m_sound_command & 0x00ff) | (data << 8); } @@ -1910,7 +1910,7 @@ WRITE8_DEVICE_HANDLER( leland_80186_command_hi_w ) static READ16_DEVICE_HANDLER( main_to_sound_comm_r ) { leland_sound_state *state = get_safe_token(device); - if (LOG_COMM) logerror("%05X:Read sound command latch = %02X\n", cpu_get_pc(state->m_i80186.cpu), state->m_sound_command); + if (LOG_COMM) logerror("%05X:Read sound command latch = %02X\n", state->m_i80186.cpu->safe_pc(), state->m_sound_command); return state->m_sound_command; } @@ -1953,7 +1953,7 @@ static TIMER_CALLBACK( delayed_response_r ) READ8_DEVICE_HANDLER( leland_80186_response_r ) { leland_sound_state *state = get_safe_token(device); - offs_t pc = cpu_get_previouspc(state->m_i80186.cpu); + offs_t pc = state->m_i80186.cpu->safe_pcbase(); if (LOG_COMM) logerror("%04X:Read sound response latch = %02X\n", pc, state->m_sound_response); @@ -1966,7 +1966,7 @@ READ8_DEVICE_HANDLER( leland_80186_response_r ) static WRITE16_DEVICE_HANDLER( sound_to_main_comm_w ) { leland_sound_state *state = get_safe_token(device); - if (LOG_COMM) logerror("%05X:Write sound response latch = %02X\n", cpu_get_pc(state->m_i80186.cpu), data); + if (LOG_COMM) logerror("%05X:Write sound response latch = %02X\n", state->m_i80186.cpu->safe_pc(), data); state->m_sound_response = data; } @@ -2015,7 +2015,7 @@ static WRITE16_DEVICE_HANDLER( dac_w ) /* set the new value */ d->value = (INT16)(UINT8)data - 0x80; - if (LOG_DAC) logerror("%05X:DAC %d value = %02X\n", cpu_get_pc(state->m_i80186.cpu), offset, (UINT8)data); + if (LOG_DAC) logerror("%05X:DAC %d value = %02X\n", state->m_i80186.cpu->safe_pc(), offset, (UINT8)data); /* if we haven't overflowed the buffer, add the value value to it */ if (count < DAC_BUFFER_SIZE - 1) @@ -2038,7 +2038,7 @@ static WRITE16_DEVICE_HANDLER( dac_w ) if (ACCESSING_BITS_8_15) { d->volume = ((data >> 8) ^ 0x00) / DAC_VOLUME_SCALE; - if (LOG_DAC) logerror("%05X:DAC %d volume = %02X\n", cpu_get_pc(state->m_i80186.cpu), offset, data); + if (LOG_DAC) logerror("%05X:DAC %d volume = %02X\n", state->m_i80186.cpu->safe_pc(), offset, data); } } @@ -2071,7 +2071,7 @@ static WRITE16_DEVICE_HANDLER( redline_dac_w ) /* update the volume */ d->volume = (offset & 0xff) / DAC_VOLUME_SCALE; - if (LOG_DAC) logerror("%05X:DAC %d value = %02X, volume = %02X\n", cpu_get_pc(state->m_i80186.cpu), which, data, (offset & 0x1fe) / 2); + if (LOG_DAC) logerror("%05X:DAC %d value = %02X, volume = %02X\n", state->m_i80186.cpu->safe_pc(), which, data, (offset & 0x1fe) / 2); } @@ -2088,7 +2088,7 @@ static WRITE16_DEVICE_HANDLER( dac_10bit_w ) /* set the new value */ d->value = (INT16)data16 - 0x200; - if (LOG_DAC) logerror("%05X:DAC 10-bit value = %02X\n", cpu_get_pc(state->m_i80186.cpu), data16); + if (LOG_DAC) logerror("%05X:DAC 10-bit value = %02X\n", state->m_i80186.cpu->safe_pc(), data16); /* if we haven't overflowed the buffer, add the value value to it */ if (count < DAC_BUFFER_SIZE - 1) @@ -2164,7 +2164,7 @@ static WRITE16_DEVICE_HANDLER( ataxx_dac_control ) return; } } - logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", cpu_get_pc(state->m_i80186.cpu), 5, offset, data); + logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", state->m_i80186.cpu->safe_pc(), 5, offset, data); } @@ -2211,11 +2211,11 @@ static READ16_DEVICE_HANDLER( peripheral_r ) if (state->m_is_redline) return pit8254_r(device, offset | 0x80, mem_mask); else - logerror("%05X:Unexpected peripheral read %d/%02X\n", cpu_get_pc(state->m_i80186.cpu), select, offset*2); + logerror("%05X:Unexpected peripheral read %d/%02X\n", state->m_i80186.cpu->safe_pc(), select, offset*2); break; default: - logerror("%05X:Unexpected peripheral read %d/%02X\n", cpu_get_pc(state->m_i80186.cpu), select, offset*2); + logerror("%05X:Unexpected peripheral read %d/%02X\n", state->m_i80186.cpu->safe_pc(), select, offset*2); break; } return 0xffff; @@ -2257,7 +2257,7 @@ static WRITE16_DEVICE_HANDLER( peripheral_w ) break; default: - logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", cpu_get_pc(state->m_i80186.cpu), select, offset, data); + logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", state->m_i80186.cpu->safe_pc(), select, offset, data); break; } } diff --git a/src/mame/audio/mw8080bw.c b/src/mame/audio/mw8080bw.c index 71cd369d69f..bc59822faff 100644 --- a/src/mame/audio/mw8080bw.c +++ b/src/mame/audio/mw8080bw.c @@ -259,7 +259,7 @@ WRITE8_MEMBER(mw8080bw_state::gunfight_audio_w) break; default: - logerror("%04x: Unknown sh port write %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: Unknown sh port write %02x\n", space.device().safe_pc(), data); break; } } diff --git a/src/mame/audio/segasnd.c b/src/mame/audio/segasnd.c index 598160fcf7b..80a2624b7b9 100644 --- a/src/mame/audio/segasnd.c +++ b/src/mame/audio/segasnd.c @@ -465,7 +465,7 @@ READ8_DEVICE_HANDLER( sega_usb_status_r ) { usb_state *usb = get_safe_token(device); - LOG(("%04X:usb_data_r = %02X\n", cpu_get_pc(usb->maincpu), (usb->out_latch & 0x81) | (usb->in_latch & 0x7e))); + LOG(("%04X:usb_data_r = %02X\n", usb->maincpu->safe_pc(), (usb->out_latch & 0x81) | (usb->in_latch & 0x7e))); device_adjust_icount(usb->maincpu, -200); @@ -496,7 +496,7 @@ WRITE8_DEVICE_HANDLER( sega_usb_data_w ) { usb_state *usb = get_safe_token(device); - LOG(("%04X:usb_data_w = %02X\n", cpu_get_pc(usb->maincpu), data)); + LOG(("%04X:usb_data_w = %02X\n", usb->maincpu->safe_pc(), data)); device->machine().scheduler().synchronize(FUNC(delayed_usb_data_w), data, usb); /* boost the interleave so that sequences can be sent */ @@ -519,7 +519,7 @@ WRITE8_DEVICE_HANDLER( sega_usb_ram_w ) if (usb->in_latch & 0x80) usb->program_ram[offset] = data; else - LOG(("%04X:sega_usb_ram_w(%03X) = %02X while /LOAD disabled\n", cpu_get_pc(usb->maincpu), offset, data)); + LOG(("%04X:sega_usb_ram_w(%03X) = %02X while /LOAD disabled\n", usb->maincpu->safe_pc(), offset, data)); } @@ -536,7 +536,7 @@ static READ8_DEVICE_HANDLER( usb_p1_r ) /* bits 0-6 are inputs and map to bits 0-6 of the input latch */ if ((usb->in_latch & 0x7f) != 0) - LOG(("%03X: P1 read = %02X\n", cpu_get_pc(usb->maincpu), usb->in_latch & 0x7f)); + LOG(("%03X: P1 read = %02X\n", usb->maincpu->safe_pc(), usb->in_latch & 0x7f)); return usb->in_latch & 0x7f; } @@ -547,7 +547,7 @@ static WRITE8_DEVICE_HANDLER( usb_p1_w ) /* bit 7 maps to bit 0 on the output latch */ usb->out_latch = (usb->out_latch & 0xfe) | (data >> 7); - LOG(("%03X: P1 write = %02X\n", cpu_get_pc(usb->maincpu), data)); + LOG(("%03X: P1 write = %02X\n", usb->maincpu->safe_pc(), data)); } @@ -570,7 +570,7 @@ static WRITE8_DEVICE_HANDLER( usb_p2_w ) if ((old & 0x80) && !(data & 0x80)) usb->t1_clock = 0; - LOG(("%03X: P2 write -> bank=%d ready=%d clock=%d\n", cpu_get_pc(usb->maincpu), data & 3, (data >> 6) & 1, (data >> 7) & 1)); + LOG(("%03X: P2 write -> bank=%d ready=%d clock=%d\n", usb->maincpu->safe_pc(), data & 3, (data >> 6) & 1, (data >> 7) & 1)); } diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c index e2b2ff21d9a..7c0c9d06712 100644 --- a/src/mame/audio/seibu.c +++ b/src/mame/audio/seibu.c @@ -383,7 +383,7 @@ static WRITE8_HANDLER( seibu_pending_w ) READ16_HANDLER( seibu_main_word_r ) { - //logerror("%06x: seibu_main_word_r(%x)\n",cpu_get_pc(&space->device()),offset); + //logerror("%06x: seibu_main_word_r(%x)\n",space->device().safe_pc(),offset); switch (offset) { case 2: @@ -392,14 +392,14 @@ READ16_HANDLER( seibu_main_word_r ) case 5: return main2sub_pending ? 1 : 0; default: - //logerror("%06x: seibu_main_word_r(%x)\n",cpu_get_pc(&space->device()),offset); + //logerror("%06x: seibu_main_word_r(%x)\n",space->device().safe_pc(),offset); return 0xffff; } } WRITE16_HANDLER( seibu_main_word_w ) { - //printf("%06x: seibu_main_word_w(%x,%02x)\n",cpu_get_pc(&space->device()),offset,data); + //printf("%06x: seibu_main_word_w(%x,%02x)\n",space->device().safe_pc(),offset,data); if (ACCESSING_BITS_0_7) { switch (offset) @@ -418,7 +418,7 @@ WRITE16_HANDLER( seibu_main_word_w ) main2sub_pending = 1; break; default: - //logerror("%06x: seibu_main_word_w(%x,%02x)\n",cpu_get_pc(&space->device()),offset,data); + //logerror("%06x: seibu_main_word_w(%x,%02x)\n",space->device().safe_pc(),offset,data); break; } } diff --git a/src/mame/audio/snes_snd.c b/src/mame/audio/snes_snd.c index 81a51134281..1e66084dcc7 100644 --- a/src/mame/audio/snes_snd.c +++ b/src/mame/audio/snes_snd.c @@ -1124,7 +1124,7 @@ READ8_DEVICE_HANDLER( spc_io_r ) case 0x5: /* Port 1 */ case 0x6: /* Port 2 */ case 0x7: /* Port 3 */ - // mame_printf_debug("SPC: rd %02x @ %d, PC=%x\n", spc700->port_in[offset - 4], offset - 4, cpu_get_pc(&space->device())); + // mame_printf_debug("SPC: rd %02x @ %d, PC=%x\n", spc700->port_in[offset - 4], offset - 4, space->device().safe_pc()); return spc700->port_in[offset - 4]; case 0x8: //normal RAM, can be read even if the ram disabled flag ($f0 bit 1) is active case 0x9: @@ -1193,7 +1193,7 @@ WRITE8_DEVICE_HANDLER( spc_io_w ) case 0x5: /* Port 1 */ case 0x6: /* Port 2 */ case 0x7: /* Port 3 */ - // mame_printf_debug("SPC: %02x to APU @ %d (PC=%x)\n", data, offset & 3, cpu_get_pc(&space->device())); + // mame_printf_debug("SPC: %02x to APU @ %d (PC=%x)\n", data, offset & 3, space->device().safe_pc()); spc700->port_out[offset - 4] = data; device->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(20)); break; diff --git a/src/mame/audio/taito_en.c b/src/mame/audio/taito_en.c index c85b2d2d6eb..85cf9e64561 100644 --- a/src/mame/audio/taito_en.c +++ b/src/mame/audio/taito_en.c @@ -94,7 +94,7 @@ static WRITE16_HANDLER( en_volume_w ) static READ16_HANDLER( es5510_dsp_r ) { -// logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(&space->device()),offset,es5510_dsp_ram[offset]); +// logerror("%06x: DSP read offset %04x (data is %04x)\n",space->device().safe_pc(),offset,es5510_dsp_ram[offset]); // if (es_tmp) return es5510_dsp_ram[offset]; /* switch (offset) { @@ -128,7 +128,7 @@ static WRITE16_HANDLER( es5510_dsp_w ) UINT8 *snd_mem = (UINT8 *)space->machine().root_device().memregion("ensoniq.0")->base(); // if (offset>4 && offset!=0x80 && offset!=0xa0 && offset!=0xc0 && offset!=0xe0) -// logerror("%06x: DSP write offset %04x %04x\n",cpu_get_pc(&space->device()),offset,data); +// logerror("%06x: DSP write offset %04x %04x\n",space->device().safe_pc(),offset,data); COMBINE_DATA(&es5510_dsp_ram[offset]); diff --git a/src/mame/audio/taitosnd.c b/src/mame/audio/taitosnd.c index 6bbcf5c3ae5..abdc517ef77 100644 --- a/src/mame/audio/taitosnd.c +++ b/src/mame/audio/taitosnd.c @@ -110,7 +110,7 @@ WRITE8_DEVICE_HANDLER( tc0140syt_comm_w ) break; case 0x04: // port status - //logerror("taitosnd: Master issued control value %02x (PC = %08x) \n",data, cpu_get_pc(&space->device()) ); + //logerror("taitosnd: Master issued control value %02x (PC = %08x) \n",data, space->device().safe_pc() ); /* this does a hi-lo transition to reset the sound cpu */ if (data) device_set_input_line(tc0140syt->slavecpu, INPUT_LINE_RESET, ASSERT_LINE); @@ -241,7 +241,7 @@ READ8_DEVICE_HANDLER( tc0140syt_slave_comm_r ) break; case 0x01: // mode #1 - //logerror("taitosnd: Slave cpu receives 0/1 : %01x%01x PC=%4x\n", tc0140syt->slavedata[1] , tc0140syt->slavedata[0],cpu_get_pc(&space->device())); + //logerror("taitosnd: Slave cpu receives 0/1 : %01x%01x PC=%4x\n", tc0140syt->slavedata[1] , tc0140syt->slavedata[0],space->device().safe_pc()); tc0140syt->status &= ~TC0140SYT_PORT01_FULL; res = tc0140syt->slavedata[tc0140syt->submode ++]; break; diff --git a/src/mame/drivers/1943.c b/src/mame/drivers/1943.c index 8ba066db431..5cb603c12b1 100644 --- a/src/mame/drivers/1943.c +++ b/src/mame/drivers/1943.c @@ -44,7 +44,7 @@ READ8_MEMBER(_1943_state::c1943_protection_r) */ int data = cpu_get_reg(&space.device(), Z80_BC) >> 8; -// logerror("protection read, PC: %04x Result:%02x\n", cpu_get_pc(&space.device()), data); +// logerror("protection read, PC: %04x Result:%02x\n", space.device().safe_pc(), data); return data; } diff --git a/src/mame/drivers/2mindril.c b/src/mame/drivers/2mindril.c index c310a03323b..f8432bbb161 100644 --- a/src/mame/drivers/2mindril.c +++ b/src/mame/drivers/2mindril.c @@ -69,7 +69,7 @@ READ16_MEMBER(_2mindril_state::drill_io_r) // if (offset * 2 == 0x4) - /*popmessage("PC=%08x %04x %04x %04x %04x %04x %04x %04x %04x", cpu_get_pc(&space.device()), m_iodata[0/2], m_iodata[2/2], m_iodata[4/2], m_iodata[6/2], + /*popmessage("PC=%08x %04x %04x %04x %04x %04x %04x %04x %04x", space.device().safe_pc(), m_iodata[0/2], m_iodata[2/2], m_iodata[4/2], m_iodata[6/2], m_iodata[8/2], m_iodata[0xa/2], m_iodata[0xc/2], m_iodata[0xe/2]);*/ switch(offset) @@ -78,7 +78,7 @@ READ16_MEMBER(_2mindril_state::drill_io_r) case 0x2/2: { int arm_pwr = ioport("IN0")->read();//throw - //popmessage("PC=%08x %02x",cpu_get_pc(&space.device()),arm_pwr); + //popmessage("PC=%08x %02x",space.device().safe_pc(),arm_pwr); if(arm_pwr > 0xe0) return ~0x1800; if(arm_pwr > 0xc0) return ~0x1400; @@ -88,7 +88,7 @@ READ16_MEMBER(_2mindril_state::drill_io_r) } case 0x4/2: return (m_defender_sensor) | (m_shutter_sensor); case 0xe/2: return ioport("IN2")->read();//coins -// default: printf("PC=%08x [%04x] -> %04x R\n", cpu_get_pc(&space.device()), offset * 2, m_iodata[offset]); +// default: printf("PC=%08x [%04x] -> %04x R\n", space.device().safe_pc(), offset * 2, m_iodata[offset]); } return 0xffff; @@ -110,7 +110,7 @@ WRITE16_MEMBER(_2mindril_state::drill_io_w) } // if(data != 0 && offset != 8) -// printf("PC=%08x [%04x] <- %04x W\n", cpu_get_pc(&space.device()), offset * 2, data); +// printf("PC=%08x [%04x] <- %04x W\n", space.device().safe_pc(), offset * 2, data); } /* diff --git a/src/mame/drivers/39in1.c b/src/mame/drivers/39in1.c index 17d698de7a7..901f2cf6cc0 100644 --- a/src/mame/drivers/39in1.c +++ b/src/mame/drivers/39in1.c @@ -1370,13 +1370,13 @@ READ32_MEMBER(_39in1_state::unknown_r) READ32_MEMBER(_39in1_state::cpld_r) { - //if (cpu_get_pc(&space.device()) != 0xe3af4) printf("CPLD read @ %x (PC %x state %d)\n", offset, cpu_get_pc(&space.device()), state); + //if (space.device().safe_pc() != 0xe3af4) printf("CPLD read @ %x (PC %x state %d)\n", offset, space.device().safe_pc(), state); - if (cpu_get_pc(&space.device()) == 0x3f04) + if (space.device().safe_pc() == 0x3f04) { return 0xf0; // any non-zero value works here } - else if (cpu_get_pc(&space.device()) == 0xe3af4) + else if (space.device().safe_pc() == 0xe3af4) { return ioport("MCUIPT")->read(); } @@ -1431,11 +1431,11 @@ WRITE32_MEMBER(_39in1_state::cpld_w) m_seed = data<<16; } - if (cpu_get_pc(&space.device()) == 0x280c) + if (space.device().safe_pc() == 0x280c) { m_state = 1; } - if (cpu_get_pc(&space.device()) == 0x2874) + if (space.device().safe_pc() == 0x2874) { m_state = 2; m_magic = space.read_byte(0xa02d4ff0); @@ -1446,7 +1446,7 @@ WRITE32_MEMBER(_39in1_state::cpld_w) #if 0 else { - printf("%08x: CPLD_W: %08x = %08x & %08x\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + printf("%08x: CPLD_W: %08x = %08x & %08x\n", space.device().safe_pc(), offset, data, mem_mask); } #endif } diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c index 5e904e2ce24..52f4a811fa2 100644 --- a/src/mame/drivers/8080bw.c +++ b/src/mame/drivers/8080bw.c @@ -1731,12 +1731,12 @@ INPUT_PORTS_END READ8_MEMBER(_8080bw_state::indianbt_r) { - switch(cpu_get_pc(&space.device())) + switch(space.device().safe_pc()) { case 0x5fed: return 0x10; case 0x5ffc: return 0; } - logerror("unknown port 0 read @ %x\n",cpu_get_pc(&space.device())); + logerror("unknown port 0 read @ %x\n",space.device().safe_pc()); return machine().rand(); } diff --git a/src/mame/drivers/88games.c b/src/mame/drivers/88games.c index 41f096389fe..f930f8f966f 100644 --- a/src/mame/drivers/88games.c +++ b/src/mame/drivers/88games.c @@ -269,7 +269,7 @@ static KONAMI_SETLINES_CALLBACK( k88games_banking ) UINT8 *RAM = state->memregion("maincpu")->base(); int offs; - logerror("%04x: bank select %02x\n", cpu_get_pc(device), lines); + logerror("%04x: bank select %02x\n", device->safe_pc(), lines); /* bits 0-2 select ROM bank for 0000-1fff */ /* bit 3: when 1, palette RAM at 1000-1fff */ diff --git a/src/mame/drivers/acommand.c b/src/mame/drivers/acommand.c index 595577ab3f6..5b74eff646e 100644 --- a/src/mame/drivers/acommand.c +++ b/src/mame/drivers/acommand.c @@ -305,7 +305,7 @@ WRITE16_MEMBER(acommand_state::ac_txscroll_w) READ16_MEMBER(acommand_state::ac_devices_r) { - logerror("(PC=%06x) read at %04x\n",cpu_get_pc(&space.device()),offset*2); + logerror("(PC=%06x) read at %04x\n",space.device().safe_pc(),offset*2); switch(offset) { diff --git a/src/mame/drivers/aeroboto.c b/src/mame/drivers/aeroboto.c index 8d49fce9699..e88f35fdab3 100644 --- a/src/mame/drivers/aeroboto.c +++ b/src/mame/drivers/aeroboto.c @@ -34,7 +34,7 @@ READ8_MEMBER(aeroboto_state::aeroboto_201_r) /* serie of values to be returned from 3004, and display "PASS 201" if it is */ static const UINT8 res[4] = { 0xff, 0x9f, 0x1b, 0x03 }; - logerror("PC %04x: read 3004\n", cpu_get_pc(&space.device())); + logerror("PC %04x: read 3004\n", space.device().safe_pc()); return res[(m_count++) & 3]; } diff --git a/src/mame/drivers/albazg.c b/src/mame/drivers/albazg.c index 44620334c2c..20ed3544c06 100644 --- a/src/mame/drivers/albazg.c +++ b/src/mame/drivers/albazg.c @@ -134,13 +134,13 @@ WRITE8_MEMBER(albazg_state::yumefuda_cram_w) /*Custom RAM (Thrash Protection)*/ READ8_MEMBER(albazg_state::custom_ram_r) { -// logerror("Custom RAM read at %02x PC = %x\n", offset + 0xaf80, cpu_get_pc(&space.device())); +// logerror("Custom RAM read at %02x PC = %x\n", offset + 0xaf80, space.device().safe_pc()); return m_cus_ram[offset];// ^ 0x55; } WRITE8_MEMBER(albazg_state::custom_ram_w) { -// logerror("Custom RAM write at %02x : %02x PC = %x\n", offset + 0xaf80, data, cpu_get_pc(&space.device())); +// logerror("Custom RAM write at %02x : %02x PC = %x\n", offset + 0xaf80, data, space.device().safe_pc()); if(m_prot_lock) m_cus_ram[offset] = data; } @@ -148,7 +148,7 @@ WRITE8_MEMBER(albazg_state::custom_ram_w) /*this might be used as NVRAM commands btw*/ WRITE8_MEMBER(albazg_state::prot_lock_w) { -// logerror("PC %04x Prot lock value written %02x\n", cpu_get_pc(&space.device()), data); +// logerror("PC %04x Prot lock value written %02x\n", space.device().safe_pc(), data); m_prot_lock = data; } diff --git a/src/mame/drivers/aleck64.c b/src/mame/drivers/aleck64.c index 74bd4874038..fdb9ac1e48e 100644 --- a/src/mame/drivers/aleck64.c +++ b/src/mame/drivers/aleck64.c @@ -188,7 +188,7 @@ static WRITE32_HANDLER( aleck_dips_w ) break; default: - logerror("Unknown aleck_dips_w(0x%08x, 0x%08x, %08x) @ 0x%08x PC=%08x\n", offset, data, mem_mask, 0xc0800000 + offset*4, cpu_get_pc(&space->device())); + logerror("Unknown aleck_dips_w(0x%08x, 0x%08x, %08x) @ 0x%08x PC=%08x\n", offset, data, mem_mask, 0xc0800000 + offset*4, space->device().safe_pc()); } } @@ -227,7 +227,7 @@ static READ32_HANDLER( aleck_dips_r ) } default: { - logerror("Unknown aleck_dips_r(0x%08x, 0x%08x) @ 0x%08x PC=%08x\n", offset, 0xc0800000 + offset*4, mem_mask, cpu_get_pc(&space->device())); + logerror("Unknown aleck_dips_r(0x%08x, 0x%08x) @ 0x%08x PC=%08x\n", offset, 0xc0800000 + offset*4, mem_mask, space->device().safe_pc()); return 0; } } diff --git a/src/mame/drivers/alpha68k.c b/src/mame/drivers/alpha68k.c index f486ce6f025..ae8a2a05341 100644 --- a/src/mame/drivers/alpha68k.c +++ b/src/mame/drivers/alpha68k.c @@ -216,14 +216,14 @@ WRITE16_MEMBER(alpha68k_state::tnextspc_coin_counters_w) WRITE16_MEMBER(alpha68k_state::tnextspc_unknown_w) { - logerror("tnextspc_unknown_w : PC = %04x - offset = %04x - data = %04x\n", cpu_get_pc(&space.device()), offset, data); + logerror("tnextspc_unknown_w : PC = %04x - offset = %04x - data = %04x\n", space.device().safe_pc(), offset, data); if (offset == 0) alpha68k_flipscreen_w(machine(), data & 0x100); } WRITE16_MEMBER(alpha68k_state::alpha_microcontroller_w) { - logerror("%04x: Alpha write trigger at %04x (%04x)\n", cpu_get_pc(&space.device()), offset, data); + logerror("%04x: Alpha write trigger at %04x (%04x)\n", space.device().safe_pc(), offset, data); /* 0x44 = coin clear signal to microcontroller? */ if (offset == 0x2d && ACCESSING_BITS_0_7) alpha68k_flipscreen_w(machine(), data & 1); @@ -404,7 +404,7 @@ READ16_MEMBER(alpha68k_state::kyros_alpha_trigger_r) break; } - logerror("%04x: Alpha read trigger at %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Alpha read trigger at %04x\n", space.device().safe_pc(), offset); return 0; /* Values returned don't matter */ } @@ -498,7 +498,7 @@ READ16_MEMBER(alpha68k_state::alpha_II_trigger_r) break; } - logerror("%04x: Alpha read trigger at %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Alpha read trigger at %04x\n", space.device().safe_pc(), offset); return 0; /* Values returned don't matter */ } @@ -643,7 +643,7 @@ READ16_MEMBER(alpha68k_state::alpha_V_trigger_r) break; } - logerror("%04x: Alpha read trigger at %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Alpha read trigger at %04x\n", space.device().safe_pc(), offset); return 0; /* Values returned don't matter */ } diff --git a/src/mame/drivers/artmagic.c b/src/mame/drivers/artmagic.c index bab7c06643f..e2a2f2d22e8 100644 --- a/src/mame/drivers/artmagic.c +++ b/src/mame/drivers/artmagic.c @@ -124,7 +124,7 @@ WRITE16_MEMBER(artmagic_state::control_w) oki->set_bank_base((((data >> 4) & 1) * 0x40000) % oki->region()->bytes()); } - logerror("%06X:control_w(%d) = %04X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:control_w(%d) = %04X\n", space.device().safe_pc(), offset, data); } @@ -145,7 +145,7 @@ static TIMER_CALLBACK( irq_off ) READ16_MEMBER(artmagic_state::ultennis_hack_r) { /* IRQ5 points to: jsr (a5); rte */ - UINT32 pc = cpu_get_pc(&space.device()); + UINT32 pc = space.device().safe_pc(); if (pc == 0x18c2 || pc == 0x18e4) { m_hack_irq = 1; diff --git a/src/mame/drivers/astrafr.c b/src/mame/drivers/astrafr.c index 2ffcf92456f..6fe2205c0a5 100644 --- a/src/mame/drivers/astrafr.c +++ b/src/mame/drivers/astrafr.c @@ -53,7 +53,7 @@ public: DECLARE_READ8_MEMBER( astra_fgpa_r ) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (offset==fgpa_first_read_addr) { @@ -68,7 +68,7 @@ public: DECLARE_WRITE8_MEMBER( astra_fgpa_w ) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (offset==fgpa_rom_write_addr) { @@ -84,7 +84,7 @@ public: /* 2nd copy for the 2nd board (assume same addresses for now */ DECLARE_READ8_MEMBER( astra_fgpa_slave_r ) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (offset==fgpa_first_read_addr) { @@ -99,7 +99,7 @@ public: DECLARE_WRITE8_MEMBER( astra_fgpa_slave_w ) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (offset==fgpa_rom_write_addr) { @@ -126,7 +126,7 @@ public: READ32_MEMBER(astrafr_state::astrafr_mem_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_maincpu, offset * 4); switch ( cs ) @@ -153,7 +153,7 @@ READ32_MEMBER(astrafr_state::astrafr_mem_r) WRITE32_MEMBER(astrafr_state::astrafr_mem_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int address = offset * 4; int cs = m68340_get_cs(m_maincpu, address); @@ -183,7 +183,7 @@ WRITE32_MEMBER(astrafr_state::astrafr_mem_w) READ32_MEMBER(astrafr_state::astrafr_slave_mem_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_slavecpu, offset * 4); switch ( cs ) @@ -208,7 +208,7 @@ READ32_MEMBER(astrafr_state::astrafr_slave_mem_r) WRITE32_MEMBER(astrafr_state::astrafr_slave_mem_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int address = offset * 4; int cs = m68340_get_cs(m_slavecpu, address); diff --git a/src/mame/drivers/astrocorp.c b/src/mame/drivers/astrocorp.c index dcd77699581..1c4b7965218 100644 --- a/src/mame/drivers/astrocorp.c +++ b/src/mame/drivers/astrocorp.c @@ -192,7 +192,7 @@ WRITE16_MEMBER(astrocorp_state::astrocorp_sound_bank_w) { okim6295_device *oki = downcast(device); oki->set_bank_base(0x40000 * ((data >> 8) & 1)); -// logerror("CPU #0 PC %06X: OKI bank %08X\n", cpu_get_pc(&space->device()), data); +// logerror("CPU #0 PC %06X: OKI bank %08X\n", space->device().safe_pc(), data); } } @@ -203,7 +203,7 @@ WRITE16_MEMBER(astrocorp_state::skilldrp_sound_bank_w) { okim6295_device *oki = downcast(device); oki->set_bank_base(0x40000 * (data & 1)); -// logerror("CPU #0 PC %06X: OKI bank %08X\n", cpu_get_pc(&space->device()), data); +// logerror("CPU #0 PC %06X: OKI bank %08X\n", space->device().safe_pc(), data); } } @@ -274,7 +274,7 @@ WRITE16_MEMBER(astrocorp_state::astrocorp_screen_enable_w) COMBINE_DATA(&m_screen_enable); // popmessage("%04X",data); if (m_screen_enable & (~1)) - logerror("CPU #0 PC %06X: screen enable = %04X\n", cpu_get_pc(&space.device()), m_screen_enable); + logerror("CPU #0 PC %06X: screen enable = %04X\n", space.device().safe_pc(), m_screen_enable); } READ16_MEMBER(astrocorp_state::astrocorp_unk_r) diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c index e23660ff877..2ab86f5b2ae 100644 --- a/src/mame/drivers/atarigt.c +++ b/src/mame/drivers/atarigt.c @@ -283,7 +283,7 @@ static void tmek_protection_w(address_space *space, offs_t offset, UINT16 data) Read ($38488) */ - if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", cpu_get_previouspc(&space->device()), offset, data); + if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", space->device().safe_pcbase(), offset, data); /* track accesses */ tmek_update_mode(state, offset); @@ -299,7 +299,7 @@ static void tmek_protection_w(address_space *space, offs_t offset, UINT16 data) static void tmek_protection_r(address_space *space, offs_t offset, UINT16 *data) { atarigt_state *state = space->machine().driver_data(); - if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", cpu_get_previouspc(&space->device()), offset); + if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", space->device().safe_pcbase(), offset); /* track accesses */ tmek_update_mode(state, offset); @@ -368,7 +368,7 @@ static void primrage_protection_w(address_space *space, offs_t offset, UINT16 da atarigt_state *state = space->machine().driver_data(); if (LOG_PROTECTION) { - UINT32 pc = cpu_get_previouspc(&space->device()); + UINT32 pc = space->device().safe_pcbase(); switch (pc) { /* protection code from 20f90 - 21000 */ @@ -401,7 +401,7 @@ static void primrage_protection_w(address_space *space, offs_t offset, UINT16 da /* catch anything else */ default: - logerror("%06X:Unknown protection W@%06X = %04X\n", cpu_get_previouspc(&space->device()), offset, data); + logerror("%06X:Unknown protection W@%06X = %04X\n", space->device().safe_pcbase(), offset, data); break; } } @@ -442,7 +442,7 @@ static void primrage_protection_r(address_space *space, offs_t offset, UINT16 *d if (LOG_PROTECTION) { - UINT32 pc = cpu_get_previouspc(&space->device()); + UINT32 pc = space->device().safe_pcbase(); UINT32 p1, p2, a6; switch (pc) { @@ -505,7 +505,7 @@ if (LOG_PROTECTION) /* catch anything else */ default: - logerror("%06X:Unknown protection R@%06X\n", cpu_get_previouspc(&space->device()), offset); + logerror("%06X:Unknown protection R@%06X\n", space->device().safe_pcbase(), offset); break; } } @@ -1244,19 +1244,19 @@ ROM_END WRITE32_MEMBER(atarigt_state::tmek_pf_w) { - offs_t pc = cpu_get_pc(&space.device()); + offs_t pc = space.device().safe_pc(); /* protected version */ if (pc == 0x2EB3C || pc == 0x2EB48) { - logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space.device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space.device(), M68K_A4) - 2); + logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", space.device().safe_pc(), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space.device(), M68K_A4) - 2); /* skip these writes to make more stuff visible */ return; } /* unprotected version */ if (pc == 0x25834 || pc == 0x25860) - logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space.device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space.device(), M68K_A3) - 2); + logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", space.device().safe_pc(), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space.device(), M68K_A3) - 2); atarigen_playfield32_w(&space, offset, data, mem_mask); } diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c index 5beecbda9d3..6f9c57942da 100644 --- a/src/mame/drivers/atarigx2.c +++ b/src/mame/drivers/atarigx2.c @@ -146,7 +146,7 @@ WRITE32_MEMBER(atarigx2_state::mo_command_w) WRITE32_MEMBER(atarigx2_state::atarigx2_protection_w) { { - int pc = cpu_get_previouspc(&space.device()); + int pc = space.device().safe_pcbase(); // if (pc == 0x11cbe || pc == 0x11c30) // logerror("%06X:Protection W@%04X = %04X (result to %06X)\n", pc, offset, data, cpu_get_reg(&space.device(), M68K_A2)); // else @@ -1126,14 +1126,14 @@ READ32_MEMBER(atarigx2_state::atarigx2_protection_r) result = machine().rand() << 16; else result = 0xffff << 16; - logerror("%06X:Unhandled protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset, result); + logerror("%06X:Unhandled protection R@%04X = %04X\n", space.device().safe_pcbase(), offset, result); } } if (ACCESSING_BITS_16_31) - logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset * 4, result >> 16); + logerror("%06X:Protection R@%04X = %04X\n", space.device().safe_pcbase(), offset * 4, result >> 16); else - logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset * 4 + 2, result); + logerror("%06X:Protection R@%04X = %04X\n", space.device().safe_pcbase(), offset * 4 + 2, result); return result; } diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c index 1232587ee6f..8ee18b28898 100644 --- a/src/mame/drivers/backfire.c +++ b/src/mame/drivers/backfire.c @@ -189,7 +189,7 @@ READ32_MEMBER(backfire_state::backfire_eeprom_r) READ32_MEMBER(backfire_state::backfire_control2_r) { -// logerror("%08x:Read eprom %08x (%08x)\n", cpu_get_pc(&space.device()), offset << 1, mem_mask); +// logerror("%08x:Read eprom %08x (%08x)\n", space.device().safe_pc(), offset << 1, mem_mask); return (m_eeprom->read_bit() << 24) | ioport("IN1")->read() | (ioport("IN1")->read() << 16); } @@ -197,7 +197,7 @@ READ32_MEMBER(backfire_state::backfire_control2_r) READ32_MEMBER(backfire_state::backfire_control3_r) { -// logerror("%08x:Read eprom %08x (%08x)\n", cpu_get_pc(&space.device()), offset << 1, mem_mask); +// logerror("%08x:Read eprom %08x (%08x)\n", space.device().safe_pc(), offset << 1, mem_mask); return (m_eeprom->read_bit() << 24) | ioport("IN2")->read() | (ioport("IN2")->read() << 16); } #endif @@ -699,10 +699,10 @@ static void descramble_sound( running_machine &machine ) READ32_MEMBER(backfire_state::backfire_speedup_r) { - //mame_printf_debug( "%08x\n",cpu_get_pc(&space.device())); + //mame_printf_debug( "%08x\n",space.device().safe_pc()); - if (cpu_get_pc(&space.device() )== 0xce44) device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfire - if (cpu_get_pc(&space.device()) == 0xcee4) device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfirea + if (space.device() .safe_pc()== 0xce44) device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfire + if (space.device().safe_pc() == 0xcee4) device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfirea return m_mainram[0x18/4]; } diff --git a/src/mame/drivers/bbusters.c b/src/mame/drivers/bbusters.c index 3bb8529741b..2a1cbca70f9 100644 --- a/src/mame/drivers/bbusters.c +++ b/src/mame/drivers/bbusters.c @@ -279,7 +279,7 @@ READ16_MEMBER(bbusters_state::control_3_r) WRITE16_MEMBER(bbusters_state::gun_select_w) { - logerror("%08x: gun r\n",cpu_get_pc(&space.device())); + logerror("%08x: gun r\n",space.device().safe_pc()); device_set_input_line(&space.device(), 2, HOLD_LINE); diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c index 968dab0b658..1fcefe3c502 100644 --- a/src/mame/drivers/beathead.c +++ b/src/mame/drivers/beathead.c @@ -498,7 +498,7 @@ ROM_END READ32_MEMBER( beathead_state::speedup_r ) { int result = *m_speedup_data; - if ((cpu_get_previouspc(&space.device()) & 0xfffff) == 0x006f0 && result == cpu_get_reg(&space.device(), ASAP_R3)) + if ((space.device().safe_pcbase() & 0xfffff) == 0x006f0 && result == cpu_get_reg(&space.device(), ASAP_R3)) device_spin_until_interrupt(&space.device()); return result; } @@ -507,7 +507,7 @@ READ32_MEMBER( beathead_state::speedup_r ) READ32_MEMBER( beathead_state::movie_speedup_r ) { int result = *m_movie_speedup_data; - if ((cpu_get_previouspc(&space.device()) & 0xfffff) == 0x00a88 && (cpu_get_reg(&space.device(), ASAP_R28) & 0xfffff) == 0x397c0 && + if ((space.device().safe_pcbase() & 0xfffff) == 0x00a88 && (cpu_get_reg(&space.device(), ASAP_R28) & 0xfffff) == 0x397c0 && m_movie_speedup_data[4] == cpu_get_reg(&space.device(), ASAP_R1)) { UINT32 temp = (INT16)result + m_movie_speedup_data[4] * 262; diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c index a1bf41219f0..f5526654017 100644 --- a/src/mame/drivers/bfcobra.c +++ b/src/mame/drivers/bfcobra.c @@ -779,7 +779,7 @@ READ8_MEMBER(bfcobra_state::ramdac_r) } default: { - mame_printf_debug("Unhandled RAMDAC read (PC:%.4x)\n", cpu_get_previouspc(&space.device())); + mame_printf_debug("Unhandled RAMDAC read (PC:%.4x)\n", space.device().safe_pcbase()); } } @@ -930,7 +930,7 @@ READ8_MEMBER(bfcobra_state::chipset_r) } default: { - mame_printf_debug("Flare One unknown read: 0x%.2x (PC:0x%.4x)\n", offset, cpu_get_previouspc(&space.device())); + mame_printf_debug("Flare One unknown read: 0x%.2x (PC:0x%.4x)\n", offset, space.device().safe_pcbase()); } } @@ -946,7 +946,7 @@ WRITE8_MEMBER(bfcobra_state::chipset_w) case 0x03: { if (data > 0x3f) - popmessage("%x: Unusual bank access (%x)\n", cpu_get_previouspc(&space.device()), data); + popmessage("%x: Unusual bank access (%x)\n", space.device().safe_pcbase(), data); data &= 0x3f; m_bank_data[offset] = data; @@ -1020,7 +1020,7 @@ WRITE8_MEMBER(bfcobra_state::chipset_w) } default: { - mame_printf_debug("Flare One unknown write: 0x%.2x with 0x%.2x (PC:0x%.4x)\n", offset, data, cpu_get_previouspc(&space.device())); + mame_printf_debug("Flare One unknown write: 0x%.2x with 0x%.2x (PC:0x%.4x)\n", offset, data, space.device().safe_pcbase()); } } } diff --git a/src/mame/drivers/bfm_sc4h.c b/src/mame/drivers/bfm_sc4h.c index c048e5c1afa..d156a49bbbb 100644 --- a/src/mame/drivers/bfm_sc4h.c +++ b/src/mame/drivers/bfm_sc4h.c @@ -64,7 +64,7 @@ UINT8 read_input_matrix(running_machine &machine, int row) READ16_MEMBER(sc4_state::sc4_cs1_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (offset<0x100000/2) { @@ -113,7 +113,7 @@ READ16_MEMBER(sc4_state::sc4_cs1_r) READ16_MEMBER(sc4_state::sc4_mem_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68307_get_cs(m_maincpu, offset * 2); int base = 0, end = 0, base2 = 0, end2 = 0; // if (!(debugger_access())) printf("cs is %d\n", cs); @@ -269,7 +269,7 @@ WRITE8_MEMBER(sc4_state::mux_output2_w) WRITE16_MEMBER(sc4_state::sc4_mem_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68307_get_cs(m_maincpu, offset * 2); int base = 0, end = 0, base2 = 0, end2 = 0; @@ -395,7 +395,7 @@ ADDRESS_MAP_END READ32_MEMBER(sc4_adder4_state::adder4_mem_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_adder4cpu, offset * 4); switch ( cs ) @@ -417,7 +417,7 @@ READ32_MEMBER(sc4_adder4_state::adder4_mem_r) WRITE32_MEMBER(sc4_adder4_state::adder4_mem_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_adder4cpu, offset * 4); switch ( cs ) @@ -554,7 +554,7 @@ void bfm_sc4_68307_portb_w(address_space *space, bool dedicated, UINT16 data, UI { // if (dedicated == false) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); //m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device()); // serial output to the VFD at least.. logerror("%08x bfm_sc4_68307_portb_w %04x %04x\n", pc, data, line_mask); @@ -567,7 +567,7 @@ void bfm_sc4_68307_portb_w(address_space *space, bool dedicated, UINT16 data, UI } UINT8 bfm_sc4_68307_porta_r(address_space *space, bool dedicated, UINT8 line_mask) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); logerror("%08x bfm_sc4_68307_porta_r\n", pc); return space->machine().rand(); } diff --git a/src/mame/drivers/bfm_swp.c b/src/mame/drivers/bfm_swp.c index a306a1d14e2..f594b0bc49f 100644 --- a/src/mame/drivers/bfm_swp.c +++ b/src/mame/drivers/bfm_swp.c @@ -146,7 +146,7 @@ protected: READ32_MEMBER(bfm_swp_state::bfm_swp_mem_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_maincpu, offset * 4); switch ( cs ) @@ -168,7 +168,7 @@ READ32_MEMBER(bfm_swp_state::bfm_swp_mem_r) WRITE32_MEMBER(bfm_swp_state::bfm_swp_mem_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_maincpu, offset * 4); switch ( cs ) diff --git a/src/mame/drivers/bigevglf.c b/src/mame/drivers/bigevglf.c index 04832f6255c..8e33313085b 100644 --- a/src/mame/drivers/bigevglf.c +++ b/src/mame/drivers/bigevglf.c @@ -81,7 +81,7 @@ static TIMER_CALLBACK( from_sound_latch_callback ) } WRITE8_MEMBER(bigevglf_state::beg_fromsound_w)/* write to D800 sets bit 1 in status */ { - machine().scheduler().synchronize(FUNC(from_sound_latch_callback), (cpu_get_pc(&space.device()) << 16) | data); + machine().scheduler().synchronize(FUNC(from_sound_latch_callback), (space.device().safe_pc() << 16) | data); } READ8_MEMBER(bigevglf_state::beg_fromsound_r) diff --git a/src/mame/drivers/bionicc.c b/src/mame/drivers/bionicc.c index 52e3aea63b9..ff1fedcdbc6 100644 --- a/src/mame/drivers/bionicc.c +++ b/src/mame/drivers/bionicc.c @@ -73,14 +73,14 @@ WRITE16_MEMBER(bionicc_state::hacked_controls_w) { - logerror("%06x: hacked_controls_w %04x %02x\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06x: hacked_controls_w %04x %02x\n", space.device().safe_pc(), offset, data); COMBINE_DATA(&m_inp[offset]); } READ16_MEMBER(bionicc_state::hacked_controls_r) { - logerror("%06x: hacked_controls_r %04x %04x\n", cpu_get_pc(&space.device()), offset, m_inp[offset]); + logerror("%06x: hacked_controls_r %04x %04x\n", space.device().safe_pc(), offset, m_inp[offset]); return m_inp[offset]; } diff --git a/src/mame/drivers/bking.c b/src/mame/drivers/bking.c index 298a93bba7b..019af2e3a3a 100644 --- a/src/mame/drivers/bking.c +++ b/src/mame/drivers/bking.c @@ -196,7 +196,7 @@ READ8_MEMBER(bking_state::bking3_68705_port_c_r) int port_c_in = 0; if (main_sent) port_c_in |= 0x01; if (!mcu_sent) port_c_in |= 0x02; -//logerror("%04x: 68705 port C read %02x\n",cpu_get_pc(&space.device()),port_c_in); +//logerror("%04x: 68705 port C read %02x\n",space.device().safe_pc(),port_c_in); return port_c_in; } #endif diff --git a/src/mame/drivers/blockhl.c b/src/mame/drivers/blockhl.c index 0a2a49834f8..20d7997647e 100644 --- a/src/mame/drivers/blockhl.c +++ b/src/mame/drivers/blockhl.c @@ -335,7 +335,7 @@ static KONAMI_SETLINES_CALLBACK( blockhl_banking ) /* other bits unknown */ if ((lines & 0x84) != 0x80) - logerror("%04x: setlines %02x\n", cpu_get_pc(device), lines); + logerror("%04x: setlines %02x\n", device->safe_pc(), lines); } diff --git a/src/mame/drivers/bmcbowl.c b/src/mame/drivers/bmcbowl.c index 40366f40783..495812cdc7b 100644 --- a/src/mame/drivers/bmcbowl.c +++ b/src/mame/drivers/bmcbowl.c @@ -203,7 +203,7 @@ READ16_MEMBER(bmcbowl_state::bmc_random_read) READ16_MEMBER(bmcbowl_state::bmc_protection_r) { - switch(cpu_get_previouspc(&space.device())) + switch(space.device().safe_pcbase()) { case 0xca68: switch(cpu_get_reg(&space.device(), M68K_D2)) @@ -214,7 +214,7 @@ READ16_MEMBER(bmcbowl_state::bmc_protection_r) } break; } - logerror("Protection read @ %X\n",cpu_get_previouspc(&space.device())); + logerror("Protection read @ %X\n",space.device().safe_pcbase()); return machine().rand(); } diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index 5ebbcd5827d..54af6f3cbb7 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -211,11 +211,11 @@ static void btime_decrypt( address_space *space ) /* xxxx xxx1 xxxx x1xx are encrypted. */ /* get the address of the next opcode */ - addr = cpu_get_pc(&space->device()); + addr = space->device().safe_pc(); /* however if the previous instruction was JSR (which caused a write to */ /* the stack), fetch the address of the next instruction. */ - addr1 = cpu_get_previouspc(&space->device()); + addr1 = space->device().safe_pcbase(); src1 = (addr1 < 0x9000) ? state->m_rambase : state->memregion("maincpu")->base(); if (decrypted[addr1] == 0x20) /* JSR $xxxx */ addr = src1[addr1 + 1] + 256 * src1[addr1 + 2]; @@ -240,7 +240,7 @@ WRITE8_MEMBER(btime_state::lnc_w) else if (offset == 0x9000) { return; } /* AM_NOP */ else if (offset == 0x9002) { audio_command_w(space, 0, data); return; } else if (offset >= 0xb000 && offset <= 0xb1ff) ; - else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), cpu_get_pc(&space.device()), data, offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset); m_rambase[offset] = data; @@ -258,7 +258,7 @@ WRITE8_MEMBER(btime_state::mmonkey_w) else if (offset == 0x9000) { return; } /* AM_NOP */ else if (offset == 0x9002) { audio_command_w(space, 0, data); return; } else if (offset >= 0xb000 && offset <= 0xbfff) { mmonkey_protection_w(space, offset - 0xb000, data); return; } - else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), cpu_get_pc(&space.device()), data, offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset); m_rambase[offset] = data; @@ -276,7 +276,7 @@ WRITE8_MEMBER(btime_state::btime_w) else if (offset == 0x4002) btime_video_control_w(space, 0, data); else if (offset == 0x4003) audio_command_w(space, 0, data); else if (offset == 0x4004) bnj_scroll1_w(space, 0, data); - else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), cpu_get_pc(&space.device()), data, offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset); m_rambase[offset] = data; @@ -295,7 +295,7 @@ WRITE8_MEMBER(btime_state::tisland_w) else if (offset == 0x4004) bnj_scroll1_w(space, 0, data); else if (offset == 0x4005) bnj_scroll2_w(space, 0, data); // else if (offset == 0x8000) btime_video_control_w(space,0,data); - else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), cpu_get_pc(&space.device()), data, offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset); m_rambase[offset] = data; @@ -313,7 +313,7 @@ WRITE8_MEMBER(btime_state::zoar_w) else if (offset == 0x9804) bnj_scroll2_w(space, 0, data); else if (offset == 0x9805) bnj_scroll1_w(space, 0, data); else if (offset == 0x9806) audio_command_w(space, 0, data); - else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), cpu_get_pc(&space.device()), data, offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset); m_rambase[offset] = data; @@ -327,7 +327,7 @@ WRITE8_MEMBER(btime_state::disco_w) else if (offset >= 0x8000 && offset <= 0x881f) ; else if (offset == 0x9a00) audio_command_w(space, 0, data); else if (offset == 0x9c00) disco_video_control_w(space, 0, data); - else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), cpu_get_pc(&space.device()), data, offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset); m_rambase[offset] = data; diff --git a/src/mame/drivers/cabaret.c b/src/mame/drivers/cabaret.c index 9e294ce7dca..cc30815d5c1 100644 --- a/src/mame/drivers/cabaret.c +++ b/src/mame/drivers/cabaret.c @@ -140,7 +140,7 @@ WRITE8_MEMBER(cabaret_state::cabaret_nmi_and_coins_w) { if ((m_nmi_enable ^ data) & (~0xdd)) { - logerror("PC %06X: nmi_and_coins = %02x\n",cpu_get_pc(&space.device()),data); + logerror("PC %06X: nmi_and_coins = %02x\n",space.device().safe_pc(),data); // popmessage("%02x",data); } diff --git a/src/mame/drivers/calchase.c b/src/mame/drivers/calchase.c index 89c3d8e2200..089169f7808 100644 --- a/src/mame/drivers/calchase.c +++ b/src/mame/drivers/calchase.c @@ -356,7 +356,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i #if 0 if ((state->m_mxtc_config_reg[0x63] & 0x50) | ( state->m_mxtc_config_reg[0x63] & 0xA0)) // Only DO if comes a change to disable ROM. { - if ( cpu_get_pc(busdevice->machine().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d); + if ( busdevice->machine(->safe_pc().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d); } #endif @@ -961,7 +961,7 @@ MACHINE_CONFIG_END READ32_MEMBER(calchase_state::calchase_idle_skip_r) { - if(cpu_get_pc(&space.device())==0x1406f48) + if(space.device().safe_pc()==0x1406f48) device_spin_until_interrupt(m_maincpu); return m_idle_skip_ram; diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c index 662b6aa3dac..818ea97ee92 100644 --- a/src/mame/drivers/cave.c +++ b/src/mame/drivers/cave.c @@ -263,7 +263,7 @@ READ16_MEMBER(cave_state::soundlatch_ack_r) } else { - logerror("CPU #1 - PC %04X: Sound Buffer 2 Underflow Error\n", cpu_get_pc(&space.device())); + logerror("CPU #1 - PC %04X: Sound Buffer 2 Underflow Error\n", space.device().safe_pc()); return 0xff; } } @@ -276,7 +276,7 @@ WRITE8_MEMBER(cave_state::soundlatch_ack_w) if (m_soundbuf_len < 32) m_soundbuf_len++; else - logerror("CPU #1 - PC %04X: Sound Buffer 2 Overflow Error\n", cpu_get_pc(&space.device())); + logerror("CPU #1 - PC %04X: Sound Buffer 2 Overflow Error\n", space.device().safe_pc()); } @@ -1051,7 +1051,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(cave_state::hotdogst_rombank_w) { if (data & ~0x0f) - logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data); membank("bank2")->set_entry(data & 0x0f); } @@ -1088,7 +1088,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(cave_state::mazinger_rombank_w) { if (data & ~0x07) - logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data); membank("bank2")->set_entry(data & 0x07); } @@ -1119,7 +1119,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(cave_state::metmqstr_rombank_w) { if (data & ~0x0f) - logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data); membank("bank1")->set_entry(data & 0x0f); } @@ -1167,7 +1167,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(cave_state::pwrinst2_rombank_w) { if (data & ~0x07) - logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data); membank("bank1")->set_entry(data & 0x07); } @@ -1209,7 +1209,7 @@ WRITE8_MEMBER(cave_state::mirror_ram_w) WRITE8_MEMBER(cave_state::sailormn_rombank_w) { if (data & ~0x1f) - logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data); membank("bank1")->set_entry(data & 0x1f); } diff --git a/src/mame/drivers/cbasebal.c b/src/mame/drivers/cbasebal.c index 61acf8455ac..db2d6f37a3f 100644 --- a/src/mame/drivers/cbasebal.c +++ b/src/mame/drivers/cbasebal.c @@ -31,7 +31,7 @@ WRITE8_MEMBER(cbasebal_state::cbasebal_bankswitch_w) { /* bits 0-4 select ROM bank */ - //logerror("%04x: bankswitch %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: bankswitch %02x\n", space.device().safe_pc(), data); membank("bank1")->set_entry(data & 0x1f); /* bit 5 used but unknown */ diff --git a/src/mame/drivers/cbuster.c b/src/mame/drivers/cbuster.c index c802b76eb6f..a82c30b9ddf 100644 --- a/src/mame/drivers/cbuster.c +++ b/src/mame/drivers/cbuster.c @@ -75,7 +75,7 @@ WRITE16_MEMBER(cbuster_state::twocrude_control_w) break; } - logerror("Warning %04x- %02x written to control %02x\n", cpu_get_pc(&space.device()), data, offset); + logerror("Warning %04x- %02x written to control %02x\n", space.device().safe_pc(), data, offset); } READ16_MEMBER(cbuster_state::twocrude_control_r) @@ -90,7 +90,7 @@ READ16_MEMBER(cbuster_state::twocrude_control_r) return ioport("DSW")->read(); case 4: /* Protection */ - logerror("%04x : protection control read at 30c000 %d\n", cpu_get_pc(&space.device()), offset); + logerror("%04x : protection control read at 30c000 %d\n", space.device().safe_pc(), offset); return m_prot; case 6: /* Credits, VBL in byte 7 */ diff --git a/src/mame/drivers/cd32.c b/src/mame/drivers/cd32.c index 7fe36844ebc..118ff1da28a 100644 --- a/src/mame/drivers/cd32.c +++ b/src/mame/drivers/cd32.c @@ -1236,7 +1236,7 @@ static void cndypuzl_input_hack(running_machine &machine) { cd32_state *state = machine.driver_data(); - if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes()) + if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes()) { //(*state->m_chip_ram_w)(0x051c02, 0x0000); @@ -1255,7 +1255,7 @@ static void haremchl_input_hack(running_machine &machine) { cd32_state *state = machine.driver_data(); - if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes()) + if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes()) { //amiga_chip_ram_w8(state, 0x002907, 0x00); @@ -1275,7 +1275,7 @@ static void lsrquiz_input_hack(running_machine &machine) { cd32_state *state = machine.driver_data(); - if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes()) + if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes()) { //amiga_chip_ram_w8(state, 0x001e1b, 0x00); @@ -1296,7 +1296,7 @@ static void lsrquiz2_input_hack(running_machine &machine) { cd32_state *state = machine.driver_data(); - if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes()) + if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes()) { //amiga_chip_ram_w8(state, 0x046107, 0x00); @@ -1316,7 +1316,7 @@ static void lasstixx_input_hack(running_machine &machine) { cd32_state *state = machine.driver_data(); - if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes()) + if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes()) { //amiga_chip_ram_w8(state, 0x00281c, 0x00); @@ -1336,7 +1336,7 @@ static void mgnumber_input_hack(running_machine &machine) { cd32_state *state = machine.driver_data(); - if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes()) + if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes()) { //(*state->m_chip_ram_w)(0x04bfa0, 0x0000); @@ -1355,7 +1355,7 @@ static void mgprem11_input_hack(running_machine &machine) { cd32_state *state = machine.driver_data(); - if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes()) + if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes()) { //amiga_chip_ram_w8(state, 0x044f7e, 0x00); diff --git a/src/mame/drivers/cdi.c b/src/mame/drivers/cdi.c index 2cb301ba69c..807a2aa3a5b 100644 --- a/src/mame/drivers/cdi.c +++ b/src/mame/drivers/cdi.c @@ -44,7 +44,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } #else diff --git a/src/mame/drivers/centiped.c b/src/mame/drivers/centiped.c index 9dff8f1ed29..16ee897961b 100644 --- a/src/mame/drivers/centiped.c +++ b/src/mame/drivers/centiped.c @@ -612,7 +612,7 @@ WRITE8_MEMBER(centiped_state::mazeinv_input_select_w) READ8_MEMBER(centiped_state::bullsdrt_data_port_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0033: case 0x6b19: diff --git a/src/mame/drivers/chaknpop.c b/src/mame/drivers/chaknpop.c index cc41bfd4a05..c92901d384e 100644 --- a/src/mame/drivers/chaknpop.c +++ b/src/mame/drivers/chaknpop.c @@ -130,7 +130,7 @@ WRITE8_MEMBER(chaknpop_state::unknown_port_2_w) WRITE8_MEMBER(chaknpop_state::coinlock_w) { - logerror("%04x: coin lock %sable\n", cpu_get_pc(&space.device()), data ? "dis" : "en"); + logerror("%04x: coin lock %sable\n", space.device().safe_pc(), data ? "dis" : "en"); } diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c index 06a36aeb67c..a9a443f97b4 100644 --- a/src/mame/drivers/cninja.c +++ b/src/mame/drivers/cninja.c @@ -91,7 +91,7 @@ READ16_MEMBER(cninja_state::cninja_irq_r) return 0; } - logerror("%08x: Unmapped IRQ read %d\n", cpu_get_pc(&space.device()), offset); + logerror("%08x: Unmapped IRQ read %d\n", space.device().safe_pc(), offset); return 0; } @@ -106,7 +106,7 @@ WRITE16_MEMBER(cninja_state::cninja_irq_w) 0xc8: Raster IRQ turned on (68k IRQ level 4) 0xd8: Raster IRQ turned on (68k IRQ level 3) */ - logerror("%08x: IRQ write %d %08x\n", cpu_get_pc(&space.device()), offset, data); + logerror("%08x: IRQ write %d %08x\n", space.device().safe_pc(), offset, data); m_irq_mask = data & 0xff; return; @@ -123,7 +123,7 @@ WRITE16_MEMBER(cninja_state::cninja_irq_w) return; } - logerror("%08x: Unmapped IRQ write %d %04x\n", cpu_get_pc(&space.device()), offset, data); + logerror("%08x: Unmapped IRQ write %d %04x\n", space.device().safe_pc(), offset, data); } READ16_MEMBER(cninja_state::robocop2_prot_r) @@ -137,10 +137,10 @@ READ16_MEMBER(cninja_state::robocop2_prot_r) case 0x4e6: /* Dip switches */ return ioport("DSW")->read(); case 0x504: /* PC: 6b6. b4, 2c, 36 written before read */ - logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space.device()), offset); + logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset); return 0x84; } - logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space.device()), offset); + logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset); return 0; } diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c index f60b4ed1fc7..3e759e3bfda 100644 --- a/src/mame/drivers/cntsteer.c +++ b/src/mame/drivers/cntsteer.c @@ -472,7 +472,7 @@ WRITE8_MEMBER(cntsteer_state::cntsteer_sound_w) WRITE8_MEMBER(cntsteer_state::zerotrgt_ctrl_w) { /*TODO: check this.*/ - logerror("CTRL: %04x: %04x: %04x\n", cpu_get_pc(&space.device()), offset, data); + logerror("CTRL: %04x: %04x: %04x\n", space.device().safe_pc(), offset, data); // if (offset == 0) device_set_input_line(m_subcpu, INPUT_LINE_RESET, ASSERT_LINE); // Wrong - bits 0 & 1 used on this diff --git a/src/mame/drivers/cobra.c b/src/mame/drivers/cobra.c index 559db4a79c6..2ffe2d95e60 100644 --- a/src/mame/drivers/cobra.c +++ b/src/mame/drivers/cobra.c @@ -1052,7 +1052,7 @@ void cobra_fifo::push(const device_t *cpu, UINT64 data) if (cpu != NULL) { // cpu has a name and a PC - sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu)); + sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast(cpu)->safe_pc()); } else { @@ -1072,7 +1072,7 @@ void cobra_fifo::push(const device_t *cpu, UINT64 data) if (cpu != NULL) { // cpu has a name and a PC - sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu)); + sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast(cpu)->safe_pc()); } else { @@ -1129,7 +1129,7 @@ bool cobra_fifo::pop(const device_t *cpu, UINT64 *result) if (cpu != NULL) { // cpu has a name and a PC - sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu)); + sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast(cpu)->safe_pc()); } else { @@ -1150,7 +1150,7 @@ bool cobra_fifo::pop(const device_t *cpu, UINT64 *result) if (cpu != NULL) { // cpu has a name and a PC - sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu)); + sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast(cpu)->safe_pc()); } else { diff --git a/src/mame/drivers/coolpool.c b/src/mame/drivers/coolpool.c index b4118527b66..9fb66ab4587 100644 --- a/src/mame/drivers/coolpool.c +++ b/src/mame/drivers/coolpool.c @@ -218,7 +218,7 @@ static TIMER_DEVICE_CALLBACK( amerdart_audio_int_gen ) WRITE16_MEMBER(coolpool_state::amerdart_misc_w) { - logerror("%08x:IOP_system_w %04x\n",cpu_get_pc(&space.device()),data); + logerror("%08x:IOP_system_w %04x\n",space.device().safe_pc(),data); coin_counter_w(machine(), 0, ~data & 0x0001); coin_counter_w(machine(), 1, ~data & 0x0002); @@ -250,7 +250,7 @@ READ16_MEMBER(coolpool_state::amerdart_dsp_bio_line_r) READ16_MEMBER(coolpool_state::amerdart_iop_r) { -// logerror("%08x:IOP read %04x\n",cpu_get_pc(&space.device()),m_iop_answer); +// logerror("%08x:IOP read %04x\n",space.device().safe_pc(),m_iop_answer); cputag_set_input_line(machine(), "maincpu", 1, CLEAR_LINE); return m_iop_answer; @@ -259,7 +259,7 @@ READ16_MEMBER(coolpool_state::amerdart_iop_r) WRITE16_MEMBER(coolpool_state::amerdart_iop_w) { -// logerror("%08x:IOP write %04x\n", cpu_get_pc(&space.device()), data); +// logerror("%08x:IOP write %04x\n", space.device().safe_pc(), data); COMBINE_DATA(&m_iop_cmd); m_cmd_pending = 1; } @@ -267,7 +267,7 @@ WRITE16_MEMBER(coolpool_state::amerdart_iop_w) READ16_MEMBER(coolpool_state::amerdart_dsp_cmd_r) { -// logerror("%08x:DSP cmd_r %04x\n", cpu_get_pc(&space.device()), m_iop_cmd); +// logerror("%08x:DSP cmd_r %04x\n", space.device().safe_pc(), m_iop_cmd); m_cmd_pending = 0; return m_iop_cmd; } @@ -275,7 +275,7 @@ READ16_MEMBER(coolpool_state::amerdart_dsp_cmd_r) WRITE16_MEMBER(coolpool_state::amerdart_dsp_answer_w) { -// logerror("%08x:DSP answer %04x\n", cpu_get_pc(&space.device()), data); +// logerror("%08x:DSP answer %04x\n", space.device().safe_pc(), data); m_iop_answer = data; cputag_set_input_line(machine(), "maincpu", 1, ASSERT_LINE); } @@ -423,7 +423,7 @@ READ16_MEMBER(coolpool_state::amerdart_trackball_r) m_result = (m_result & 0x0fff) | (amerdart_trackball_direction(&space, 2, ((m_result >> 12) & 0xf)) << 12); -// logerror("%08X:read port 6 (X=%02X Y=%02X oldX=%02X oldY=%02X oldRes=%04X Res=%04X)\n", cpu_get_pc(&space.device()), m_newx, m_newy, m_oldx, m_oldy, m_lastresult, m_result); +// logerror("%08X:read port 6 (X=%02X Y=%02X oldX=%02X oldY=%02X oldRes=%04X Res=%04X)\n", space.device().safe_pc(), m_newx, m_newy, m_oldx, m_oldy, m_lastresult, m_result); m_lastresult = m_result; @@ -439,7 +439,7 @@ READ16_MEMBER(coolpool_state::amerdart_trackball_r) WRITE16_MEMBER(coolpool_state::coolpool_misc_w) { - logerror("%08x:IOP_system_w %04x\n",cpu_get_pc(&space.device()),data); + logerror("%08x:IOP_system_w %04x\n",space.device().safe_pc(),data); coin_counter_w(machine(), 0, ~data & 0x0001); coin_counter_w(machine(), 1, ~data & 0x0002); @@ -471,7 +471,7 @@ static TIMER_CALLBACK( deferred_iop_w ) WRITE16_MEMBER(coolpool_state::coolpool_iop_w) { - logerror("%08x:IOP write %04x\n", cpu_get_pc(&space.device()), data); + logerror("%08x:IOP write %04x\n", space.device().safe_pc(), data); machine().scheduler().synchronize(FUNC(deferred_iop_w), data); } @@ -479,7 +479,7 @@ WRITE16_MEMBER(coolpool_state::coolpool_iop_w) READ16_MEMBER(coolpool_state::coolpool_iop_r) { - logerror("%08x:IOP read %04x\n",cpu_get_pc(&space.device()),m_iop_answer); + logerror("%08x:IOP read %04x\n",space.device().safe_pc(),m_iop_answer); cputag_set_input_line(machine(), "maincpu", 1, CLEAR_LINE); return m_iop_answer; @@ -498,7 +498,7 @@ READ16_MEMBER(coolpool_state::dsp_cmd_r) { m_cmd_pending = 0; - logerror("%08x:IOP cmd_r %04x\n", cpu_get_pc(&space.device()), m_iop_cmd); + logerror("%08x:IOP cmd_r %04x\n", space.device().safe_pc(), m_iop_cmd); return m_iop_cmd; } @@ -506,7 +506,7 @@ READ16_MEMBER(coolpool_state::dsp_cmd_r) WRITE16_MEMBER(coolpool_state::dsp_answer_w) { - logerror("%08x:IOP answer %04x\n", cpu_get_pc(&space.device()), data); + logerror("%08x:IOP answer %04x\n", space.device().safe_pc(), data); m_iop_answer = data; cputag_set_input_line(machine(), "maincpu", 1, ASSERT_LINE); } @@ -625,7 +625,7 @@ READ16_MEMBER(coolpool_state::coolpool_input_r) } } -// logerror("%08X:read port 7 (X=%02X Y=%02X oldX=%02X oldY=%02X res=%04X)\n", cpu_get_pc(&space.device()), +// logerror("%08X:read port 7 (X=%02X Y=%02X oldX=%02X oldY=%02X res=%04X)\n", space.device().safe_pc(), // m_newx[1], m_newy[1], m_oldx[1], m_oldy[1], m_result); m_lastresult = m_result; return m_result; diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c index 1b53d4e9384..6b379ca8963 100644 --- a/src/mame/drivers/cps1.c +++ b/src/mame/drivers/cps1.c @@ -355,7 +355,7 @@ READ16_MEMBER(cps_state::qsound_rom_r) return rom[offset] | 0xff00; else { - popmessage("%06x: read sound ROM byte %04x", cpu_get_pc(&space.device()), offset); + popmessage("%06x: read sound ROM byte %04x", space.device().safe_pc(), offset); return 0; } } diff --git a/src/mame/drivers/crbaloon.c b/src/mame/drivers/crbaloon.c index 30b0f6de0e0..6e384427a19 100644 --- a/src/mame/drivers/crbaloon.c +++ b/src/mame/drivers/crbaloon.c @@ -61,7 +61,7 @@ WRITE8_MEMBER(crbaloon_state::pc3092_w) { m_pc3092_data[offset] = data & 0x0f; - if (LOG_PC3092) logerror("%04X: write PC3092 #%d = 0x%02x\n", cpu_get_pc(&space.device()), offset, m_pc3092_data[offset]); + if (LOG_PC3092) logerror("%04X: write PC3092 #%d = 0x%02x\n", space.device().safe_pc(), offset, m_pc3092_data[offset]); pc3092_update(machine()); } @@ -141,7 +141,7 @@ READ8_MEMBER(crbaloon_state::pc3259_r) break; } - if (LOG_PC3259) logerror("%04X: read PC3259 #%d = 0x%02x\n", cpu_get_pc(&space.device()), reg, ret); + if (LOG_PC3259) logerror("%04X: read PC3259 #%d = 0x%02x\n", space.device().safe_pc(), reg, ret); return ret | (ioport("DSW1")->read() & 0xf0); } diff --git a/src/mame/drivers/crgolf.c b/src/mame/drivers/crgolf.c index 86ccf0e815f..23928de5bfa 100644 --- a/src/mame/drivers/crgolf.c +++ b/src/mame/drivers/crgolf.c @@ -138,7 +138,7 @@ WRITE8_MEMBER(crgolf_state::switch_input_select_w) WRITE8_MEMBER(crgolf_state::unknown_w) { - logerror("%04X:unknown_w = %02X\n", cpu_get_pc(&space.device()), data); + logerror("%04X:unknown_w = %02X\n", space.device().safe_pc(), data); } diff --git a/src/mame/drivers/cvs.c b/src/mame/drivers/cvs.c index 1f84a1f9aa6..065916a9384 100644 --- a/src/mame/drivers/cvs.c +++ b/src/mame/drivers/cvs.c @@ -267,7 +267,7 @@ READ8_MEMBER(cvs_state::cvs_input_r) case 0x04: ret = ioport("IN3")->read(); break; case 0x06: ret = ioport("DSW3")->read(); break; case 0x07: ret = ioport("DSW2")->read(); break; - default: logerror("%04x : CVS: Reading unmapped input port 0x%02x\n", cpu_get_pc(&space.device()), offset & 0x0f); break; + default: logerror("%04x : CVS: Reading unmapped input port 0x%02x\n", space.device().safe_pc(), offset & 0x0f); break; } return ret; @@ -375,13 +375,13 @@ WRITE8_MEMBER(cvs_state::cvs_speech_rom_address_lo_w) /* assuming that d0-d2 are cleared here */ m_speech_rom_bit_address = (m_speech_rom_bit_address & 0xf800) | (data << 3); - LOG(("%04x : CVS: Speech Lo %02x Address = %04x\n", cpu_get_pc(&space.device()), data, m_speech_rom_bit_address >> 3)); + LOG(("%04x : CVS: Speech Lo %02x Address = %04x\n", space.device().safe_pc(), data, m_speech_rom_bit_address >> 3)); } WRITE8_MEMBER(cvs_state::cvs_speech_rom_address_hi_w) { m_speech_rom_bit_address = (m_speech_rom_bit_address & 0x07ff) | (data << 11); - LOG(("%04x : CVS: Speech Hi %02x Address = %04x\n", cpu_get_pc(&space.device()), data, m_speech_rom_bit_address >> 3)); + LOG(("%04x : CVS: Speech Hi %02x Address = %04x\n", space.device().safe_pc(), data, m_speech_rom_bit_address >> 3)); } diff --git a/src/mame/drivers/cyclemb.c b/src/mame/drivers/cyclemb.c index ad9a2df2382..80e2c609d0b 100644 --- a/src/mame/drivers/cyclemb.c +++ b/src/mame/drivers/cyclemb.c @@ -419,7 +419,7 @@ READ8_MEMBER( cyclemb_state::skydest_i8741_0_r ) { if(offset == 1) //status port { - //printf("STATUS PC=%04x\n",cpu_get_pc(m_maincpu)); + //printf("STATUS PC=%04x\n",m_maincpu->safe_pc()); return 1; } @@ -427,14 +427,14 @@ READ8_MEMBER( cyclemb_state::skydest_i8741_0_r ) { UINT8 i,pt; - //printf("%04x\n",cpu_get_pc(m_maincpu)); + //printf("%04x\n",m_maincpu->safe_pc()); /* TODO: internal state of this */ - if(cpu_get_pc(m_maincpu) == m_dsw_pc_hack) + if(m_maincpu->safe_pc() == m_dsw_pc_hack) m_mcu[0].rxd = (ioport("DSW1")->read() & 0x1f) << 2; else if(m_mcu[0].rst) { - //printf("READ PC=%04x\n",cpu_get_pc(m_maincpu)); + //printf("READ PC=%04x\n",m_maincpu->safe_pc()); { switch(m_mcu[0].state) @@ -500,7 +500,7 @@ WRITE8_MEMBER( cyclemb_state::skydest_i8741_0_w ) { if(offset == 1) //command port { - //printf("%02x CMD PC=%04x\n",data,cpu_get_pc(m_maincpu)); + //printf("%02x CMD PC=%04x\n",data,m_maincpu->safe_pc()); switch(data) { case 0: @@ -535,7 +535,7 @@ WRITE8_MEMBER( cyclemb_state::skydest_i8741_0_w ) } else { - //printf("%02x DATA PC=%04x\n",data,cpu_get_pc(m_maincpu)); + //printf("%02x DATA PC=%04x\n",data,m_maincpu->safe_pc()); m_mcu[0].txd = data; diff --git a/src/mame/drivers/d9final.c b/src/mame/drivers/d9final.c index c55b95687db..15a1579354d 100644 --- a/src/mame/drivers/d9final.c +++ b/src/mame/drivers/d9final.c @@ -102,7 +102,7 @@ WRITE8_MEMBER(d9final_state::d9final_bank_w) /* game checks this after three attract cycles, otherwise coin inputs stop to work. */ READ8_MEMBER(d9final_state::prot_latch_r) { -// printf("PC=%06x\n",cpu_get_pc(&space.device())); +// printf("PC=%06x\n",space.device().safe_pc()); return 0x04; } diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c index a47fc722431..1c96731031c 100644 --- a/src/mame/drivers/darius.c +++ b/src/mame/drivers/darius.c @@ -158,7 +158,7 @@ WRITE16_MEMBER(darius_state::cpua_ctrl_w) parse_control(machine()); - logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data); + logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data); } WRITE16_MEMBER(darius_state::darius_watchdog_w) @@ -195,7 +195,7 @@ READ16_MEMBER(darius_state::darius_ioc_r) return ioport("DSW")->read(); } -logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",cpu_get_pc(&space.device()),offset); +logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",space.device().safe_pc(),offset); return 0xff; } @@ -231,7 +231,7 @@ WRITE16_MEMBER(darius_state::darius_ioc_w) return; } -logerror("CPU #0 PC %06x: warning - write unmapped ioc offset %06x with %04x\n",cpu_get_pc(&space.device()),offset,data); +logerror("CPU #0 PC %06x: warning - write unmapped ioc offset %06x with %04x\n",space.device().safe_pc(),offset,data); } @@ -516,7 +516,7 @@ static const msm5205_interface msm5205_config = READ8_MEMBER(darius_state::adpcm_command_read) { - /* logerror("read port 0: %02x PC=%4x\n",adpcm_command, cpu_get_pc(&space.device()) ); */ + /* logerror("read port 0: %02x PC=%4x\n",adpcm_command, space.device().safe_pc() ); */ return m_adpcm_command; } @@ -534,13 +534,13 @@ WRITE8_MEMBER(darius_state::adpcm_nmi_disable) { m_nmi_enable = 0; - /* logerror("write port 0: NMI DISABLE PC=%4x\n", data, cpu_get_pc(&space.device()) ); */ + /* logerror("write port 0: NMI DISABLE PC=%4x\n", data, space.device().safe_pc() ); */ } WRITE8_MEMBER(darius_state::adpcm_nmi_enable) { m_nmi_enable = 1; - /* logerror("write port 1: NMI ENABLE PC=%4x\n", cpu_get_pc(&space.device()) ); */ + /* logerror("write port 1: NMI ENABLE PC=%4x\n", space.device().safe_pc() ); */ } WRITE8_MEMBER(darius_state::adpcm_data_w) diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c index a0b9ac5be53..2258b6c55ec 100644 --- a/src/mame/drivers/dblewing.c +++ b/src/mame/drivers/dblewing.c @@ -172,7 +172,7 @@ READ16_MEMBER(dblewing_state::dblewing_prot_r) case 0x532: return m_580_data; } -// printf("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask); +// printf("dblewing prot r %08x, %04x, %04x\n", space.device().safe_pc(), offset * 2, mem_mask); if ((offset*2) == 0x0f8) return 0; // m_080_data; if ((offset*2) == 0x104) return 0; @@ -184,7 +184,7 @@ READ16_MEMBER(dblewing_state::dblewing_prot_r) if ((offset*2) == 0x54a) return 0; // 3rd player 2nd boss if ((offset*2) == 0x786) return 0; - mame_printf_debug("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask); + mame_printf_debug("dblewing prot r %08x, %04x, %04x\n", space.device().safe_pc(), offset * 2, mem_mask); return 0;//machine().rand(); } @@ -193,7 +193,7 @@ WRITE16_MEMBER(dblewing_state::dblewing_prot_w) { // if (offset * 2 != 0x380) -// printf("dblewing prot w %08x, %04x, %04x %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask, data); +// printf("dblewing prot w %08x, %04x, %04x %04x\n", space.device().safe_pc(), offset * 2, mem_mask, data); switch (offset * 2) { @@ -295,7 +295,7 @@ WRITE16_MEMBER(dblewing_state::dblewing_prot_w) return; // p2 inputs select screen OK } -// printf("dblewing prot w %08x, %04x, %04x %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask, data); +// printf("dblewing prot w %08x, %04x, %04x %04x\n", space.device().safe_pc(), offset * 2, mem_mask, data); if ((offset * 2) == 0x008) { m_008_data = data; return; } if ((offset * 2) == 0x080) { m_080_data = data; return; } // p3 3rd boss? diff --git a/src/mame/drivers/dcheese.c b/src/mame/drivers/dcheese.c index 1619c3d523b..3ccfe8b4a2a 100644 --- a/src/mame/drivers/dcheese.c +++ b/src/mame/drivers/dcheese.c @@ -183,7 +183,7 @@ WRITE8_MEMBER(dcheese_state::sound_control_w) if ((diff & 0x40) && (data & 0x40)) m_bsmt->reset(); if (data != 0x40 && data != 0x60) - logerror("%04X:sound_control_w = %02X\n", cpu_get_pc(&space.device()), data); + logerror("%04X:sound_control_w = %02X\n", space.device().safe_pc(), data); } diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index ed9fcc3e101..5a734c0cc49 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -824,7 +824,7 @@ g_profiler.start(PROFILER_VIDEO); ; #ifdef MAME_DEBUG popmessage("unknown blitter command %02x", data); - logerror("%06x: unknown blitter command %02x\n", cpu_get_pc(&space->device()), data); + logerror("%06x: unknown blitter command %02x\n", space->device().safe_pc(), data); #endif } @@ -843,7 +843,7 @@ g_profiler.start(PROFILER_VIDEO); break; default: - logerror("%06x: Blitter %d reg %02x = %02x\n", cpu_get_pc(&space->device()), blitter, state->m_ddenlovr_blit_regs[blitter], data); + logerror("%06x: Blitter %d reg %02x = %02x\n", space->device().safe_pc(), blitter, state->m_ddenlovr_blit_regs[blitter], data); break; } } @@ -1190,7 +1190,7 @@ g_profiler.start(PROFILER_VIDEO); ; #ifdef MAME_DEBUG popmessage("unknown blitter command %02x", data); - logerror("%06x: unknown blitter command %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: unknown blitter command %02x\n", space.device().safe_pc(), data); #endif } @@ -1199,7 +1199,7 @@ g_profiler.start(PROFILER_VIDEO); break; default: - logerror("%06x: Blitter 0 reg %02x = %02x\n", cpu_get_pc(&space.device()), m_ddenlovr_blit_latch, data); + logerror("%06x: Blitter 0 reg %02x = %02x\n", space.device().safe_pc(), m_ddenlovr_blit_latch, data); break; } @@ -1244,7 +1244,7 @@ READ8_MEMBER(dynax_state::rongrong_gfxrom_r) if (address >= size) { - logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space.device()), address); + logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", space.device().safe_pc(), address); address %= size; } @@ -1589,7 +1589,7 @@ WRITE16_MEMBER(dynax_state::ddenlovr_select2_16_w) READ8_MEMBER(dynax_state::rongrong_input2_r) { -// logerror("%04x: input2_r offset %d select %x\n", cpu_get_pc(&space.device()), offset, m_input_sel); +// logerror("%04x: input2_r offset %d select %x\n", space.device().safe_pc(), offset, m_input_sel); /* 0 and 1 are read from offset 1, 2 from offset 0... */ switch (m_input_sel) { @@ -1615,7 +1615,7 @@ static READ8_DEVICE_HANDLER( quiz365_input_r ) READ16_MEMBER(dynax_state::quiz365_input2_r) { -// logerror("%04x: input2_r offset %d select %x\n",cpu_get_pc(&space.device()), offset, m_input_sel); +// logerror("%04x: input2_r offset %d select %x\n",space.device().safe_pc(), offset, m_input_sel); /* 0 and 1 are read from offset 1, 2 from offset 0... */ switch (m_input_sel) { @@ -1632,7 +1632,7 @@ WRITE8_MEMBER(dynax_state::rongrong_blitter_busy_w) m_rongrong_blitter_busy_select = data; if (data != 0x18) - logerror("%04x: rongrong_blitter_busy_w data = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: rongrong_blitter_busy_w data = %02x\n", space.device().safe_pc(), data); } READ8_MEMBER(dynax_state::rongrong_blitter_busy_r) @@ -1642,7 +1642,7 @@ READ8_MEMBER(dynax_state::rongrong_blitter_busy_r) case 0x18: return 0; // bit 5 = blitter busy default: - logerror("%04x: rongrong_blitter_busy_r with select = %02x\n", cpu_get_pc(&space.device()), m_rongrong_blitter_busy_select); + logerror("%04x: rongrong_blitter_busy_r with select = %02x\n", space.device().safe_pc(), m_rongrong_blitter_busy_select); } return 0xff; } @@ -1969,7 +1969,7 @@ READ8_MEMBER(dynax_state::rongrong_input_r) WRITE8_MEMBER(dynax_state::rongrong_select_w) { -//logerror("%04x: rongrong_select_w %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: rongrong_select_w %02x\n",space.device().safe_pc(),data); /* bits 0-4 = **both** ROM bank **AND** input select */ membank("bank1")->set_entry(data & 0x1f); @@ -2238,7 +2238,7 @@ READ8_MEMBER(dynax_state::funkyfig_dsw_r) if (!BIT(m_dsw_sel, 0)) return ioport("DSW1")->read(); if (!BIT(m_dsw_sel, 1)) return ioport("DSW2")->read(); if (!BIT(m_dsw_sel, 2)) return ioport("DSW3")->read(); - logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel); + logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", space.device().safe_pc(), m_dsw_sel); return 0xff; } @@ -2249,7 +2249,7 @@ READ8_MEMBER(dynax_state::funkyfig_coin_r) case 0x22: return ioport("IN2")->read(); case 0x23: return m_funkyfig_lockout; } - logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -2260,7 +2260,7 @@ READ8_MEMBER(dynax_state::funkyfig_key_r) case 0x20: return ioport("IN0")->read(); case 0x21: return ioport("IN1")->read(); } - logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -2273,13 +2273,13 @@ WRITE8_MEMBER(dynax_state::funkyfig_lockout_w) coin_counter_w(machine(), 0, data & 0x01); coin_lockout_w(machine(), 0, (~data) & 0x02); if (data & ~0x03) - logerror("%06x: warning, unknown bits written, lockout = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: warning, unknown bits written, lockout = %02x\n", space.device().safe_pc(), data); break; // case 0xef: 16 bytes on startup default: - logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data); + logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data); } } @@ -2391,7 +2391,7 @@ READ8_MEMBER(dynax_state::hanakanz_gfxrom_r) if (address >= size) { - logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space.device()), address); + logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", space.device().safe_pc(), address); address %= size; } @@ -2422,7 +2422,7 @@ WRITE8_MEMBER(dynax_state::hanakanz_coincounter_w) coin_counter_w(machine(), 1, data & 2); if (data & 0xf0) - logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data); #ifdef MAME_DEBUG // popmessage("93 = %02x", data); @@ -2620,7 +2620,7 @@ WRITE8_MEMBER(dynax_state::mjchuuka_coincounter_w) coin_lockout_w(machine(), 0, (~data) & 0x08); if (data & 0x74) - logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data); #ifdef MAME_DEBUG // popmessage("40 = %02x",data); @@ -2678,7 +2678,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(dynax_state::mjmyster_rambank_w) { membank("bank2")->set_entry(data & 0x07); - //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: rambank = %02x\n", space.device().safe_pc(), data); } WRITE8_MEMBER(dynax_state::mjmyster_select2_w) @@ -2699,7 +2699,7 @@ READ8_MEMBER(dynax_state::mjmyster_coins_r) case 0x03: return 0xff; } - logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -2713,7 +2713,7 @@ READ8_MEMBER(dynax_state::mjmyster_keyb_r) else if (BIT(m_keyb, 2)) ret = ioport("KEY2")->read(); else if (BIT(m_keyb, 3)) ret = ioport("KEY3")->read(); else if (BIT(m_keyb, 4)) ret = ioport("KEY4")->read(); - else logerror("%06x: warning, unknown bits read, keyb = %02x\n", cpu_get_pc(&space.device()), m_keyb); + else logerror("%06x: warning, unknown bits read, keyb = %02x\n", space.device().safe_pc(), m_keyb); m_keyb <<= 1; @@ -2727,7 +2727,7 @@ READ8_MEMBER(dynax_state::mjmyster_dsw_r) if (!BIT(m_dsw_sel, 2)) return ioport("DSW2")->read(); if (!BIT(m_dsw_sel, 3)) return ioport("DSW1")->read(); if (!BIT(m_dsw_sel, 4)) return ioport("DSW5")->read(); - logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel); + logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", space.device().safe_pc(), m_dsw_sel); return 0xff; } @@ -2745,7 +2745,7 @@ WRITE8_MEMBER(dynax_state::mjmyster_coincounter_w) break; default: - logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data); + logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data); } } @@ -2841,7 +2841,7 @@ READ8_MEMBER(dynax_state::hginga_coins_r) case 0x22: return 0x7f; // bit 7 = blitter busy, bit 6 = hopper case 0x23: return m_coins; } - logerror("%04x: coins_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%04x: coins_r with select = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -2870,7 +2870,7 @@ WRITE8_MEMBER(dynax_state::hginga_coins_w) m_coins = data; break; default: - logerror("%04x: coins_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data); + logerror("%04x: coins_w with select = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data); } } @@ -2892,7 +2892,7 @@ READ8_MEMBER(dynax_state::hginga_input_r) case 0xa2: return ioport(keynames1[m_keyb++])->read(); } - logerror("%04x: input_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%04x: input_r with select = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -2985,7 +2985,7 @@ READ8_MEMBER(dynax_state::hgokou_input_r) case 0x22: return hgokou_player_r(&space, 0); case 0x23: return m_coins; } - logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel); + logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", space.device().safe_pc(), m_dsw_sel); return 0xff; } @@ -3012,7 +3012,7 @@ WRITE8_MEMBER(dynax_state::hgokou_input_w) case 0x2f: break; // ? written with 2f (hgokou) default: - logerror("%04x: input_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel, data); + logerror("%04x: input_w with select = %02x, data = %02x\n", space.device().safe_pc(), m_dsw_sel, data); } } @@ -3088,7 +3088,7 @@ READ8_MEMBER(dynax_state::hgokbang_input_r) m_input_sel |= 1; return ret; } - logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel); + logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", space.device().safe_pc(), m_dsw_sel); return 0xff; } @@ -3148,7 +3148,7 @@ READ8_MEMBER(dynax_state::hparadis_input_r) case 0x80: return ioport(keynames0[m_keyb++])->read(); // P1 (Keys) case 0x81: return ioport(keynames1[m_keyb++])->read(); // P2 (Keys) } - logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%06x: warning, unknown bits read, input_sel = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -3169,7 +3169,7 @@ WRITE8_MEMBER(dynax_state::hparadis_coin_w) case 0x0c: coin_counter_w(machine(), 0, data & 1); break; case 0x0d: break; default: - logerror("%04x: coins_w with select = %02x, data = %02x\n",cpu_get_pc(&space.device()), m_input_sel, data); + logerror("%04x: coins_w with select = %02x, data = %02x\n",space.device().safe_pc(), m_input_sel, data); } } @@ -3220,7 +3220,7 @@ READ8_MEMBER(dynax_state::mjmywrld_coins_r) case 0x83: return 0x00; } - logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%06x: warning, unknown bits read, input_sel = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -3400,7 +3400,7 @@ WRITE8_MEMBER(dynax_state::mjflove_coincounter_w) if (data & 0xfe) { - logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data); // popmessage("COIN = %02x", data); } } @@ -3517,7 +3517,7 @@ WRITE8_MEMBER(dynax_state::sryudens_coincounter_w) m_hopper = data & 0x04; if (data & 0x68) - logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data); #ifdef MAME_DEBUG // popmessage("COIN = %02x", data); @@ -3527,7 +3527,7 @@ WRITE8_MEMBER(dynax_state::sryudens_coincounter_w) WRITE8_MEMBER(dynax_state::sryudens_rambank_w) { membank("bank2")->set_entry(data & 0x0f); - //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: rambank = %02x\n", space.device().safe_pc(), data); } static ADDRESS_MAP_START( sryudens_portmap, AS_IO, 8, dynax_state ) @@ -3577,7 +3577,7 @@ WRITE8_MEMBER(dynax_state::janshinp_coincounter_w) coin_counter_w(machine(), 1, data & 2); if (data & ~0x8b) - logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data); #ifdef MAME_DEBUG // popmessage("COIN = %02x", data); diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index b9962856168..5810402d9cc 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -223,7 +223,7 @@ WRITE8_MEMBER(ddragon_state::toffy_bankswitch_w) READ8_MEMBER(ddragon_state::darktowr_mcu_bank_r) { - // logerror("BankRead %05x %08x\n",cpu_get_pc(&space.device()),offset); + // logerror("BankRead %05x %08x\n",space.device().safe_pc(),offset); /* Horrible hack - the alternate TStrike set is mismatched against the MCU, so just hack around the protection here. (The hacks are 'right' as I have @@ -232,9 +232,9 @@ READ8_MEMBER(ddragon_state::darktowr_mcu_bank_r) if (!strcmp(machine().system().name, "tstrike")) { /* Static protection checks at boot-up */ - if (cpu_get_pc(&space.device()) == 0x9ace) + if (space.device().safe_pc() == 0x9ace) return 0; - if (cpu_get_pc(&space.device()) == 0x9ae4) + if (space.device().safe_pc() == 0x9ae4) return 0x63; /* Just return whatever the code is expecting */ @@ -251,7 +251,7 @@ READ8_MEMBER(ddragon_state::darktowr_mcu_bank_r) WRITE8_MEMBER(ddragon_state::darktowr_mcu_bank_w) { - logerror("BankWrite %05x %08x %08x\n", cpu_get_pc(&space.device()), offset, data); + logerror("BankWrite %05x %08x %08x\n", space.device().safe_pc(), offset, data); if (offset == 0x1400 || offset == 0) { @@ -355,14 +355,14 @@ CUSTOM_INPUT_MEMBER(ddragon_state::sub_cpu_busy) WRITE8_MEMBER(ddragon_state::darktowr_mcu_w) { - logerror("McuWrite %05x %08x %08x\n",cpu_get_pc(&space.device()), offset, data); + logerror("McuWrite %05x %08x %08x\n",space.device().safe_pc(), offset, data); m_darktowr_mcu_ports[offset] = data; } READ8_MEMBER(ddragon_state::ddragon_hd63701_internal_registers_r) { - logerror("%04x: read %d\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: read %d\n", space.device().safe_pc(), offset); return 0; } @@ -396,7 +396,7 @@ READ8_MEMBER(ddragon_state::ddragon_spriteram_r) { /* Double Dragon crash fix - see notes above */ - if (offset == 0x49 && cpu_get_pc(&space.device()) == 0x6261 && m_spriteram[offset] == 0x1f) + if (offset == 0x49 && space.device().safe_pc() == 0x6261 && m_spriteram[offset] == 0x1f) return 0x1; return m_spriteram[offset]; diff --git a/src/mame/drivers/ddragon3.c b/src/mame/drivers/ddragon3.c index 5ba070d8e74..8839608dd3b 100644 --- a/src/mame/drivers/ddragon3.c +++ b/src/mame/drivers/ddragon3.c @@ -196,7 +196,7 @@ WRITE16_MEMBER(ddragon3_state::ddragon3_io_w) break; default: - logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset, (unsigned)data, cpu_get_pc(&space.device()) ); + logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset, (unsigned)data, space.device().safe_pc() ); break; } } diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c index a89a68368ee..f9bf5bf45b7 100644 --- a/src/mame/drivers/dec0.c +++ b/src/mame/drivers/dec0.c @@ -200,7 +200,7 @@ WRITE16_MEMBER(dec0_state::dec0_control_w) break; case 0xa: /* Mix Psel(?). */ - logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1)); + logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1)); break; case 0xc: /* Cblk - coin blockout. Seems to be unused by the games */ @@ -208,11 +208,11 @@ WRITE16_MEMBER(dec0_state::dec0_control_w) case 0xe: /* Reset Intel 8751? - not sure, all the games write here at startup */ dec0_i8751_reset(machine()); - logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1)); + logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1)); break; default: - logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1)); + logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1)); break; } } @@ -238,7 +238,7 @@ WRITE16_MEMBER(dec0_automat_state::automat_control_w) break; case 0xa: /* Mix Psel(?). */ - logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1)); + logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1)); break; case 0xc: /* Cblk - coin blockout. Seems to be unused by the games */ @@ -246,7 +246,7 @@ WRITE16_MEMBER(dec0_automat_state::automat_control_w) #endif default: - logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1)); + logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1)); break; } } @@ -358,7 +358,7 @@ READ16_MEMBER(dec0_state::slyspy_protection_r) case 6: return 0x2; } - logerror("%04x, Unknown protection read at 30c000 %d\n", cpu_get_pc(&space.device()), offset); + logerror("%04x, Unknown protection read at 30c000 %d\n", space.device().safe_pc(), offset); return 0; } diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index 54e8f304422..78ee8a39e36 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -314,7 +314,7 @@ READ32_MEMBER(deco32_state::deco32_irq_controller_r) // return 0xffffff80 | vblank | (0x40); //test for lock load guns } - logerror("%08x: Unmapped IRQ read %08x (%08x)\n",cpu_get_pc(&space.device()),offset,mem_mask); + logerror("%08x: Unmapped IRQ read %08x (%08x)\n",space.device().safe_pc(),offset,mem_mask); return 0xffffffff; } @@ -324,7 +324,7 @@ WRITE32_MEMBER(deco32_state::deco32_irq_controller_w) switch (offset) { case 0: /* IRQ enable - probably an irq mask, but only values used are 0xc8 and 0xca */ -// logerror("%08x: IRQ write %d %08x\n",cpu_get_pc(&space.device()),offset,data); +// logerror("%08x: IRQ write %d %08x\n",space.device().safe_pc(),offset,data); m_raster_enable=(data&0xff)==0xc8; /* 0xca seems to be off */ break; @@ -364,7 +364,7 @@ READ32_MEMBER(deco32_state::captaven_prot_r) case 0xed4: return ioport("IN2")->read(); /* Misc */ } - logerror("%08x: Unmapped protection read %04x\n",cpu_get_pc(&space.device()),offset<<2); + logerror("%08x: Unmapped protection read %04x\n",space.device().safe_pc(),offset<<2); return 0xffffffff; } @@ -405,13 +405,13 @@ WRITE32_MEMBER(deco32_state::fghthist_eeprom_w) READ32_MEMBER(deco32_state::dragngun_service_r) { -// logerror("%08x:Read service\n",cpu_get_pc(&space.device())); +// logerror("%08x:Read service\n",space.device().safe_pc()); return ioport("IN2")->read(); } READ32_MEMBER(deco32_state::lockload_gun_mirror_r) { -//logerror("%08x:Read gun %d\n",cpu_get_pc(&space.device()),offset); +//logerror("%08x:Read gun %d\n",space.device().safe_pc(),offset); //return ((machine().rand()%0xffff)<<16) | machine().rand()%0xffff; if (offset) /* Mirror of player 1 and player 2 fire buttons */ return ioport("IN4")->read() | ((machine().rand()%0xff)<<16); @@ -420,7 +420,7 @@ READ32_MEMBER(deco32_state::lockload_gun_mirror_r) READ32_MEMBER(deco32_state::dragngun_prot_r) { -// logerror("%08x:Read prot %08x (%08x)\n",cpu_get_pc(&space.device()),offset<<1,mem_mask); +// logerror("%08x:Read prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask); if (!m_strobe) m_strobe=8; else m_strobe=0; @@ -487,7 +487,7 @@ READ32_MEMBER(deco32_state::tattass_prot_r) case 0x35a: return m_tattass_eprom_bit << 16; } - logerror("%08x:Read prot %08x (%08x)\n",cpu_get_pc(&space.device()),offset<<1,mem_mask); + logerror("%08x:Read prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask); return 0xffffffff; } @@ -645,7 +645,7 @@ READ32_MEMBER(deco32_state::nslasher_prot_r) case 0x35a: return (machine().device("eeprom")->read_bit()<< 16) | 0xffff; // Debug switch in low word?? } - //logerror("%08x: Read unmapped prot %08x (%08x)\n",cpu_get_pc(&space.device()),offset<<1,mem_mask); + //logerror("%08x: Read unmapped prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask); return 0xffffffff; } @@ -666,7 +666,7 @@ WRITE32_MEMBER(deco32_state::nslasher_eeprom_w) WRITE32_MEMBER(deco32_state::nslasher_prot_w) { - //logerror("%08x:write prot %08x (%08x) %08x\n",cpu_get_pc(&space.device()),offset<<1,mem_mask,data); + //logerror("%08x:write prot %08x (%08x) %08x\n",space.device().safe_pc(),offset<<1,mem_mask,data); /* Only sound port of chip is used - no protection */ if (offset==0x700/4) { diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c index 5df09cc8d63..1c24609e568 100644 --- a/src/mame/drivers/deco_mlc.c +++ b/src/mame/drivers/deco_mlc.c @@ -111,7 +111,7 @@ READ32_MEMBER(deco_mlc_state::test2_r) { // if (offset==0) // return ioport("IN0")->read(); //0xffffffff; -// logerror("%08x: Test2_r %d\n",cpu_get_pc(&space.device()),offset); +// logerror("%08x: Test2_r %d\n",space.device().safe_pc(),offset); return machine().rand(); //0xffffffff; } @@ -123,7 +123,7 @@ READ32_MEMBER(deco_mlc_state::test3_r) */ //if (offset==0) // return machine().rand()|(machine().rand()<<16); -// logerror("%08x: Test3_r %d\n",cpu_get_pc(&space.device()),offset); +// logerror("%08x: Test3_r %d\n",space.device().safe_pc(),offset); return 0xffffffff; } @@ -156,7 +156,7 @@ WRITE32_MEMBER(deco_mlc_state::avengrs_palette_w) READ32_MEMBER(deco_mlc_state::decomlc_vbl_r) { m_vbl_i ^=0xffffffff; -//logerror("vbl r %08x\n", cpu_get_pc(&space.device())); +//logerror("vbl r %08x\n", space.device().safe_pc()); // Todo: Vblank probably in $10 return m_vbl_i; } @@ -241,7 +241,7 @@ READ32_MEMBER(deco_mlc_state::stadhr96_prot_146_r) */ offset<<=1; - logerror("%08x: Read prot %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%08x: Read prot %04x\n", space.device().safe_pc(), offset); if (offset==0x5c4) return 0xaa55 << 16; @@ -722,7 +722,7 @@ static void descramble_sound( running_machine &machine ) READ32_MEMBER(deco_mlc_state::avengrgs_speedup_r) { UINT32 a=m_mlc_ram[0x89a0/4]; - UINT32 p=cpu_get_pc(&space.device()); + UINT32 p=space.device().safe_pc(); if ((p==0x3234 || p==0x32dc) && (a&1)) device_spin_until_interrupt(&space.device()); diff --git a/src/mame/drivers/djmain.c b/src/mame/drivers/djmain.c index 263284bd579..b7bec7dd04e 100644 --- a/src/mame/drivers/djmain.c +++ b/src/mame/drivers/djmain.c @@ -375,17 +375,17 @@ WRITE32_MEMBER(djmain_state::light_ctrl_2_w) WRITE32_MEMBER(djmain_state::unknown590000_w) { - //logerror("%08X: unknown 590000 write %08X: %08X & %08X\n", cpu_get_previouspc(&space.device()), offset, data, mem_mask); + //logerror("%08X: unknown 590000 write %08X: %08X & %08X\n", space.device().safe_pcbase(), offset, data, mem_mask); } WRITE32_MEMBER(djmain_state::unknown802000_w) { - //logerror("%08X: unknown 802000 write %08X: %08X & %08X\n", cpu_get_previouspc(&space.device()), offset, data, mem_mask); + //logerror("%08X: unknown 802000 write %08X: %08X & %08X\n", space.device().safe_pcbase(), offset, data, mem_mask); } WRITE32_MEMBER(djmain_state::unknownc02000_w) { - //logerror("%08X: unknown c02000 write %08X: %08X & %08X\n", cpu_get_previouspc(&space.device()), offset, data, mem_mask); + //logerror("%08X: unknown c02000 write %08X: %08X & %08X\n", space.device().safe_pcbase(), offset, data, mem_mask); } diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c index e79a63f24aa..f78eaa60227 100644 --- a/src/mame/drivers/dkong.c +++ b/src/mame/drivers/dkong.c @@ -642,7 +642,7 @@ READ8_MEMBER(dkong_state::epos_decrypt_rom) WRITE8_MEMBER(dkong_state::s2650_data_w) { #if DEBUG_PROTECTION - logerror("write : pc = %04x, loopback = %02x\n",cpu_get_pc(&space.device()), data); + logerror("write : pc = %04x, loopback = %02x\n",space.device().safe_pc(), data); #endif m_hunchloopback = data; @@ -651,7 +651,7 @@ WRITE8_MEMBER(dkong_state::s2650_data_w) WRITE8_MEMBER(dkong_state::s2650_fo_w) { #if DEBUG_PROTECTION - logerror("write : pc = %04x, FO = %02x\n",cpu_get_pc(&space.device()), data); + logerror("write : pc = %04x, FO = %02x\n",space.device().safe_pc(), data); #endif m_main_fo = data; @@ -663,7 +663,7 @@ WRITE8_MEMBER(dkong_state::s2650_fo_w) READ8_MEMBER(dkong_state::s2650_port0_r) { #if DEBUG_PROTECTION - logerror("port 0 : pc = %04x, loopback = %02x fo=%d\n",cpu_get_pc(&space.device()), m_hunchloopback, m_main_fo); + logerror("port 0 : pc = %04x, loopback = %02x fo=%d\n",space.device().safe_pc(), m_hunchloopback, m_main_fo); #endif switch (m_protect_type) @@ -680,7 +680,7 @@ READ8_MEMBER(dkong_state::s2650_port0_r) else return m_hunchloopback--; } - fatalerror("Unhandled read from port 0 : pc = %4x\n",cpu_get_pc(&space.device())); + fatalerror("Unhandled read from port 0 : pc = %4x\n",space.device().safe_pc()); } @@ -688,7 +688,7 @@ READ8_MEMBER(dkong_state::s2650_port1_r) { #if DEBUG_PROTECTION - logerror("port 1 : pc = %04x, loopback = %02x fo=%d\n",cpu_get_pc(&space.device()), m_hunchloopback, m_main_fo); + logerror("port 1 : pc = %04x, loopback = %02x fo=%d\n",space.device().safe_pc(), m_hunchloopback, m_main_fo); #endif switch (m_protect_type) @@ -702,7 +702,7 @@ READ8_MEMBER(dkong_state::s2650_port1_r) else return ++m_prot_cnt; } - fatalerror("Unhandled read from port 1 : pc = %4x\n",cpu_get_pc(&space.device())); + fatalerror("Unhandled read from port 1 : pc = %4x\n",space.device().safe_pc()); } diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c index 40b81e5ec89..70cd1c9844f 100644 --- a/src/mame/drivers/dorachan.c +++ b/src/mame/drivers/dorachan.c @@ -46,14 +46,14 @@ CUSTOM_INPUT_MEMBER(dorachan_state::dorachan_protection_r) { UINT8 ret = 0; - switch (cpu_get_previouspc(m_main_cpu)) + switch (m_main_cpu->safe_pcbase()) { case 0x70ce: ret = 0xf2; break; case 0x72a2: ret = 0xd5; break; case 0x72b5: ret = 0xcb; break; default: - mame_printf_debug("unhandled $2400 read @ %x\n", cpu_get_previouspc(m_main_cpu)); + mame_printf_debug("unhandled $2400 read @ %x\n", m_main_cpu->safe_pcbase()); break; } diff --git a/src/mame/drivers/dunhuang.c b/src/mame/drivers/dunhuang.c index ea698f113aa..1611f749252 100644 --- a/src/mame/drivers/dunhuang.c +++ b/src/mame/drivers/dunhuang.c @@ -269,7 +269,7 @@ WRITE8_MEMBER(dunhuang_state::dunhuang_clear_y_w) WRITE8_MEMBER(dunhuang_state::dunhuang_horiz_clear_w) { int i; -// logerror("%06x: horiz clear, y = %02x, data = %02d\n", cpu_get_pc(&space.device()), m_clear_y,data); +// logerror("%06x: horiz clear, y = %02x, data = %02d\n", space.device().safe_pc(), m_clear_y,data); for (i = 0; i < 0x40; i++) { int addr = m_clear_y * 0x40 + i; @@ -285,7 +285,7 @@ WRITE8_MEMBER(dunhuang_state::dunhuang_horiz_clear_w) WRITE8_MEMBER(dunhuang_state::dunhuang_vert_clear_w) { int i; -// logerror("%06x: vert clear, x = %02x, y = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_pos_x,m_pos_y,data); +// logerror("%06x: vert clear, x = %02x, y = %02x, data = %02x\n", space.device().safe_pc(), m_pos_x,m_pos_y,data); for (i = 0; i < 0x08; i++) { int addr = (m_pos_x & 0x3f) + (i & 0x07) * 0x40; @@ -343,7 +343,7 @@ WRITE8_MEMBER(dunhuang_state::dunhuang_block_h_w) int i,j, addr; UINT8 *tile_addr; -// logerror("%06x: block dst %x, src %x, xy %x %x, wh %x %x, clr %x\n", cpu_get_pc(&space.device()), m_block_dest, (m_block_addr_hi << 8) + m_block_addr_lo, m_block_x,m_block_y,m_block_w+1,m_block_h+1,m_block_c); +// logerror("%06x: block dst %x, src %x, xy %x %x, wh %x %x, clr %x\n", space.device().safe_pc(), m_block_dest, (m_block_addr_hi << 8) + m_block_addr_lo, m_block_x,m_block_y,m_block_w+1,m_block_h+1,m_block_c); m_block_h = data; @@ -382,7 +382,7 @@ WRITE8_MEMBER(dunhuang_state::dunhuang_block_h_w) break; default: - popmessage("%06x: block dst=%x", cpu_get_pc(&space.device()), m_block_dest); + popmessage("%06x: block dst=%x", space.device().safe_pc(), m_block_dest); } } diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index e8ab1a90db9..35bf58ed207 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -279,7 +279,7 @@ WRITE8_MEMBER(dynax_state::hnoridur_rombank_w) { int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000; - //logerror("%04x: rom bank = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: rom bank = %02x\n", space.device().safe_pc(), data); if (data < bank_n) membank("bank1")->set_entry(data); else @@ -751,7 +751,7 @@ WRITE8_MEMBER(dynax_state::yarunara_rombank_w) { int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000; - //logerror("%04x: rom bank = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: rom bank = %02x\n", space.device().safe_pc(), data); if (data < bank_n) membank("bank1")->set_entry(data); else @@ -779,7 +779,7 @@ WRITE8_MEMBER(dynax_state::yarunara_blit_romregion_w) case 0x81: dynax_blit_romregion_w(space, 0, 3); return; case 0x82: dynax_blit_romregion_w(space, 0, 4); return; // mjcomv1 } - logerror("%04x: unmapped romregion=%02X\n", cpu_get_pc(&space.device()), data); + logerror("%04x: unmapped romregion=%02X\n", space.device().safe_pc(), data); } static ADDRESS_MAP_START( yarunara_io_map, AS_IO, 8, dynax_state ) @@ -1152,7 +1152,7 @@ WRITE8_MEMBER(dynax_state::htengoku_coin_w) case 0xff: break; // CRT controller? default: - logerror("%04x: coins_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data); + logerror("%04x: coins_w with select = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data); } } @@ -1167,7 +1167,7 @@ READ8_MEMBER(dynax_state::htengoku_input_r) case 0x82: return ioport(keynames0[m_keyb++])->read(); case 0x0d: return 0xff; // unused } - logerror("%04x: input_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%04x: input_r with select = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -1181,7 +1181,7 @@ READ8_MEMBER(dynax_state::htengoku_coin_r) case 0x02: return 0xbf | ((m_hopper && !(machine().primary_screen->frame_number() % 10)) ? 0 : (1 << 6)); // bit 7 = blitter busy, bit 6 = hopper case 0x03: return m_coins; } - logerror("%04x: coin_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel); + logerror("%04x: coin_r with select = %02x\n", space.device().safe_pc(), m_input_sel); return 0xff; } @@ -1200,7 +1200,7 @@ WRITE8_MEMBER(dynax_state::htengoku_blit_romregion_w) case 0x81: dynax_blit_romregion_w(space, 0, 1); return; case 0x00: dynax_blit_romregion_w(space, 0, 2); return; } - logerror("%04x: unmapped romregion=%02X\n", cpu_get_pc(&space.device()), data); + logerror("%04x: unmapped romregion=%02X\n", space.device().safe_pc(), data); } static ADDRESS_MAP_START( htengoku_io_map, AS_IO, 8, dynax_state ) @@ -1273,7 +1273,7 @@ WRITE8_MEMBER(dynax_state::tenkai_ip_w) break; return; } - logerror("%04x: unmapped ip_sel=%02x written with %02x\n", cpu_get_pc(&space.device()), m_input_sel, data); + logerror("%04x: unmapped ip_sel=%02x written with %02x\n", space.device().safe_pc(), m_input_sel, data); } READ8_MEMBER(dynax_state::tenkai_ip_r) @@ -1291,7 +1291,7 @@ READ8_MEMBER(dynax_state::tenkai_ip_r) return ioport("COINS")->read(); // coins default: - logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", cpu_get_pc(&space.device()), m_input_sel, offset); + logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", space.device().safe_pc(), m_input_sel, offset); return 0xff; } } @@ -1306,17 +1306,17 @@ READ8_MEMBER(dynax_state::tenkai_ip_r) // player 2 case 0x81: if (m_keyb >= 5) - logerror("%04x: unmapped keyb=%02x read\n", cpu_get_pc(&space.device()), m_keyb); + logerror("%04x: unmapped keyb=%02x read\n", space.device().safe_pc(), m_keyb); return 0xff;//ioport(keynames1[m_keyb++])->read(); // player 1 case 0x82: if (m_keyb >= 5) - logerror("%04x: unmapped keyb=%02x read\n", cpu_get_pc(&space.device()), m_keyb); + logerror("%04x: unmapped keyb=%02x read\n", space.device().safe_pc(), m_keyb); return ioport(keynames0[m_keyb++])->read(); default: - logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", cpu_get_pc(&space.device()), m_input_sel, offset); + logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", space.device().safe_pc(), m_input_sel, offset); return 0xff; } } @@ -1432,7 +1432,7 @@ READ8_MEMBER(dynax_state::tenkai_8000_r) else if (m_rombank == 0x12) return tenkai_palette_r(space, offset); - logerror("%04x: unmapped offset %04X read with rombank=%02X\n", cpu_get_pc(&space.device()), offset, m_rombank); + logerror("%04x: unmapped offset %04X read with rombank=%02X\n", space.device().safe_pc(), offset, m_rombank); return 0x00; } @@ -1452,7 +1452,7 @@ WRITE8_MEMBER(dynax_state::tenkai_8000_w) return; } - logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", cpu_get_pc(&space.device()), offset, data, m_rombank); + logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", space.device().safe_pc(), offset, data, m_rombank); } static void tenkai_show_6c( running_machine &machine ) @@ -1481,7 +1481,7 @@ WRITE8_MEMBER(dynax_state::tenkai_blit_romregion_w) case 0x83: dynax_blit_romregion_w(space, 0, 1); return; case 0x80: dynax_blit_romregion_w(space, 0, 2); return; } - logerror("%04x: unmapped romregion=%02X\n", cpu_get_pc(&space.device()), data); + logerror("%04x: unmapped romregion=%02X\n", space.device().safe_pc(), data); } static ADDRESS_MAP_START( tenkai_map, AS_PROGRAM, 8, dynax_state ) @@ -1591,7 +1591,7 @@ READ8_MEMBER(dynax_state::gekisha_8000_r) case 0x8067: return ioport("DSW2")->read(); } - logerror("%04x: unmapped offset %04X read with rombank=%02X\n",cpu_get_pc(&space.device()), offset, m_rombank); + logerror("%04x: unmapped offset %04X read with rombank=%02X\n",space.device().safe_pc(), offset, m_rombank); return 0x00; } @@ -1647,7 +1647,7 @@ WRITE8_MEMBER(dynax_state::gekisha_8000_w) // break; } } - logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", cpu_get_pc(&space.device()), offset, data, m_rombank); + logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", space.device().safe_pc(), offset, data, m_rombank); } diff --git a/src/mame/drivers/enigma2.c b/src/mame/drivers/enigma2.c index c411033f120..b924b2f43d8 100644 --- a/src/mame/drivers/enigma2.c +++ b/src/mame/drivers/enigma2.c @@ -359,7 +359,7 @@ READ8_MEMBER(enigma2_state::dip_switch_r) { UINT8 ret = 0x00; - if (LOG_PROT) logerror("DIP SW Read: %x at %x (prot data %x)\n", offset, cpu_get_pc(&space.device()), m_protection_data); + if (LOG_PROT) logerror("DIP SW Read: %x at %x (prot data %x)\n", offset, space.device().safe_pc(), m_protection_data); switch (offset) { case 0x01: @@ -372,7 +372,7 @@ READ8_MEMBER(enigma2_state::dip_switch_r) break; case 0x02: - if (cpu_get_pc(&space.device()) == 0x07e5) + if (space.device().safe_pc() == 0x07e5) ret = 0xaa; else ret = 0xf4; diff --git a/src/mame/drivers/eolithsp.c b/src/mame/drivers/eolithsp.c index a7c16800649..4f5c23fefa6 100644 --- a/src/mame/drivers/eolithsp.c +++ b/src/mame/drivers/eolithsp.c @@ -21,12 +21,12 @@ static int eolith_scanline = 0; void eolith_speedup_read(address_space *space) { /* for debug */ - //if ((cpu_get_pc(&space->device())!=eolith_speedup_address) && (eolith_vblank!=1) ) + //if ((space->device().safe_pc()!=eolith_speedup_address) && (eolith_vblank!=1) ) // printf("%s:eolith speedup_read data %02x\n",space->machine().describe_context(), eolith_vblank); if (eolith_vblank==0 && eolith_scanline < eolith_speedup_resume_scanline) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if ((pc==eolith_speedup_address) || (pc==eolith_speedup_address2)) { @@ -117,7 +117,7 @@ CUSTOM_INPUT_MEMBER(eolith_state::eolith_speedup_getvblank) // StealSee doesn't use interrupts, just the vblank CUSTOM_INPUT_MEMBER(eolith_state::stealsee_speedup_getvblank) { - int pc = cpu_get_pc(m_maincpu); + int pc = m_maincpu->safe_pc(); if (pc==0x400081ec) if(!eolith_vblank) diff --git a/src/mame/drivers/epos.c b/src/mame/drivers/epos.c index 452996432a4..5db961b8d33 100644 --- a/src/mame/drivers/epos.c +++ b/src/mame/drivers/epos.c @@ -42,7 +42,7 @@ WRITE8_MEMBER(epos_state::dealer_decrypt_rom) else m_counter = (m_counter - 1) & 0x03; -// logerror("PC %08x: ctr=%04x\n",cpu_get_pc(&space.device()), m_counter); +// logerror("PC %08x: ctr=%04x\n",space.device().safe_pc(), m_counter); membank("bank1")->set_entry(m_counter); diff --git a/src/mame/drivers/esd16.c b/src/mame/drivers/esd16.c index 7711f94b931..0c5a1dcfa77 100644 --- a/src/mame/drivers/esd16.c +++ b/src/mame/drivers/esd16.c @@ -107,7 +107,7 @@ READ16_MEMBER(esd16_state::esd_eeprom_r) return ((m_eeprom->read_bit() & 0x01) << 15); } -// logerror("(0x%06x) unk EEPROM read: %04x\n", cpu_get_pc(&space.device()), mem_mask); +// logerror("(0x%06x) unk EEPROM read: %04x\n", space.device().safe_pc(), mem_mask); return 0; } @@ -116,7 +116,7 @@ WRITE16_MEMBER(esd16_state::esd_eeprom_w) if (ACCESSING_BITS_8_15) ioport("EEPROMOUT")->write(data, 0xffff); -// logerror("(0x%06x) Unk EEPROM write: %04x %04x\n", cpu_get_pc(&space.device()), data, mem_mask); +// logerror("(0x%06x) Unk EEPROM write: %04x %04x\n", space.device().safe_pc(), data, mem_mask); } diff --git a/src/mame/drivers/esripsys.c b/src/mame/drivers/esripsys.c index 07bf6b13983..893315be497 100644 --- a/src/mame/drivers/esripsys.c +++ b/src/mame/drivers/esripsys.c @@ -553,7 +553,7 @@ WRITE8_MEMBER(esripsys_state::tms5220_w) /* Not used in later revisions */ WRITE8_MEMBER(esripsys_state::control_w) { - logerror("Sound control write: %.2x (PC:0x%.4x)\n", data, cpu_get_previouspc(&space.device())); + logerror("Sound control write: %.2x (PC:0x%.4x)\n", data, space.device().safe_pcbase()); } diff --git a/src/mame/drivers/exerion.c b/src/mame/drivers/exerion.c index 44fff4bc403..7873185fba7 100644 --- a/src/mame/drivers/exerion.c +++ b/src/mame/drivers/exerion.c @@ -172,7 +172,7 @@ WRITE8_MEMBER(exerion_state::exerion_portb_w) READ8_MEMBER(exerion_state::exerion_protection_r) { - if (cpu_get_pc(&space.device()) == 0x4143) + if (space.device().safe_pc() == 0x4143) return memregion("maincpu")->base()[0x33c0 + (m_main_ram[0xd] << 2) + offset]; else return m_main_ram[0x8 + offset]; diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c index e34cdc67f64..97128910c90 100644 --- a/src/mame/drivers/fantland.c +++ b/src/mame/drivers/fantland.c @@ -64,7 +64,7 @@ WRITE8_MEMBER(fantland_state::fantland_nmi_enable_w) m_nmi_enable = data; if ((m_nmi_enable != 0) && (m_nmi_enable != 8)) - logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space.device()), data); + logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", space.device().safe_pc(), data); } WRITE16_MEMBER(fantland_state::fantland_nmi_enable_16_w) @@ -169,7 +169,7 @@ WRITE8_MEMBER(fantland_state::borntofi_nmi_enable_w) // data & 0x31 changes when lightgun fires if ((m_nmi_enable != 0) && (m_nmi_enable != 8)) - logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space.device()), data); + logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", space.device().safe_pc(), data); // popmessage("%02X", data); } @@ -345,7 +345,7 @@ WRITE8_MEMBER(fantland_state::borntofi_msm5205_w) { case 0x00: borntofi_adpcm_stop(msm, voice); break; case 0x03: borntofi_adpcm_start(msm, voice); break; - default: logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", cpu_get_pc(&space.device()), reg, data); + default: logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", space.device().safe_pc(), reg, data); } } else diff --git a/src/mame/drivers/fastfred.c b/src/mame/drivers/fastfred.c index 4b92d2be87e..178d99480f8 100644 --- a/src/mame/drivers/fastfred.c +++ b/src/mame/drivers/fastfred.c @@ -21,7 +21,7 @@ // to change if a different ROM set ever surfaces. READ8_MEMBER(fastfred_state::fastfred_custom_io_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x03c0: return 0x9d; case 0x03e6: return 0x9f; @@ -47,14 +47,14 @@ READ8_MEMBER(fastfred_state::fastfred_custom_io_r) case 0x7b58: return 0x20; } - logerror("Uncaught custom I/O read %04X at %04X\n", 0xc800+offset, cpu_get_pc(&space.device())); + logerror("Uncaught custom I/O read %04X at %04X\n", 0xc800+offset, space.device().safe_pc()); return 0x00; } READ8_MEMBER(fastfred_state::flyboy_custom1_io_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x049d: return 0xad; /* compare */ case 0x04b9: /* compare with 0x9e ??? When ??? */ @@ -75,14 +75,14 @@ READ8_MEMBER(fastfred_state::flyboy_custom1_io_r) return 0x00; } - logerror("Uncaught custom I/O read %04X at %04X\n", 0xc085+offset, cpu_get_pc(&space.device())); + logerror("Uncaught custom I/O read %04X at %04X\n", 0xc085+offset, space.device().safe_pc()); return 0x00; } READ8_MEMBER(fastfred_state::flyboy_custom2_io_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0395: return 0xf7; /* $C900 compare */ case 0x03f5: /* $c8fd */ @@ -100,7 +100,7 @@ READ8_MEMBER(fastfred_state::flyboy_custom2_io_r) return 0x00; } - logerror("Uncaught custom I/O read %04X at %04X\n", 0xc8fb+offset, cpu_get_pc(&space.device())); + logerror("Uncaught custom I/O read %04X at %04X\n", 0xc8fb+offset, space.device().safe_pc()); return 0x00; } diff --git a/src/mame/drivers/firetrap.c b/src/mame/drivers/firetrap.c index ad1588caf72..5c90dbbd221 100644 --- a/src/mame/drivers/firetrap.c +++ b/src/mame/drivers/firetrap.c @@ -194,7 +194,7 @@ READ8_MEMBER(firetrap_state::firetrap_8751_bootleg_r) UINT8 coin = 0; UINT8 port = ioport("IN2")->read() & 0x70; - if (cpu_get_pc(&space.device()) == 0x1188) + if (space.device().safe_pc() == 0x1188) return ~m_coin_command_pending; if (port != 0x70) @@ -214,7 +214,7 @@ READ8_MEMBER(firetrap_state::firetrap_8751_bootleg_r) READ8_MEMBER(firetrap_state::firetrap_8751_r) { - //logerror("PC:%04x read from 8751\n",cpu_get_pc(&space.device())); + //logerror("PC:%04x read from 8751\n",space.device().safe_pc()); return m_i8751_return; } @@ -293,7 +293,7 @@ WRITE8_MEMBER(firetrap_state::firetrap_8751_w) else { m_i8751_return = 0xff; - logerror("%04x: Unknown i8751 command %02x!\n",cpu_get_pc(&space.device()),data); + logerror("%04x: Unknown i8751 command %02x!\n",space.device().safe_pc(),data); } /* Signal main cpu task is complete */ diff --git a/src/mame/drivers/fitfight.c b/src/mame/drivers/fitfight.c index cc462806e33..d194a502d4d 100644 --- a/src/mame/drivers/fitfight.c +++ b/src/mame/drivers/fitfight.c @@ -220,35 +220,35 @@ ADDRESS_MAP_END READ8_MEMBER(fitfight_state::snd_porta_r) { - //mame_printf_debug("PA R @%x\n",cpu_get_pc(&space.device())); + //mame_printf_debug("PA R @%x\n",space.device().safe_pc()); return machine().rand(); } READ8_MEMBER(fitfight_state::snd_portb_r) { - //mame_printf_debug("PB R @%x\n",cpu_get_pc(&space.device())); + //mame_printf_debug("PB R @%x\n",space.device().safe_pc()); return machine().rand(); } READ8_MEMBER(fitfight_state::snd_portc_r) { - //mame_printf_debug("PC R @%x\n",cpu_get_pc(&space.device())); + //mame_printf_debug("PC R @%x\n",space.device().safe_pc()); return machine().rand(); } WRITE8_MEMBER(fitfight_state::snd_porta_w) { - //mame_printf_debug("PA W %x @%x\n",data,cpu_get_pc(&space.device())); + //mame_printf_debug("PA W %x @%x\n",data,space.device().safe_pc()); } WRITE8_MEMBER(fitfight_state::snd_portb_w) { - //mame_printf_debug("PB W %x @%x\n",data,cpu_get_pc(&space.device())); + //mame_printf_debug("PB W %x @%x\n",data,space.device().safe_pc()); } WRITE8_MEMBER(fitfight_state::snd_portc_w) { - //mame_printf_debug("PC W %x @%x\n",data,cpu_get_pc(&space.device())); + //mame_printf_debug("PC W %x @%x\n",data,space.device().safe_pc()); } static ADDRESS_MAP_START( snd_io, AS_IO, 8, fitfight_state ) diff --git a/src/mame/drivers/flstory.c b/src/mame/drivers/flstory.c index 3f591ac1f01..de45053e994 100644 --- a/src/mame/drivers/flstory.c +++ b/src/mame/drivers/flstory.c @@ -154,7 +154,7 @@ ADDRESS_MAP_END READ8_MEMBER(flstory_state::rumba_mcu_r) { - //printf("PC=%04x R %02x\n",cpu_get_pc(&space.device()),m_mcu_cmd); + //printf("PC=%04x R %02x\n",space.device().safe_pc(),m_mcu_cmd); if((m_mcu_cmd & 0xf0) == 0x00) // end packet cmd, value returned is meaningless (probably used for main <-> mcu comms syncronization) return 0; @@ -197,7 +197,7 @@ READ8_MEMBER(flstory_state::rumba_mcu_r) return 0; } //case 0x42: return 0x06; - //default: printf("PC=%04x R %02x\n",cpu_get_pc(&space.device()),m_mcu_cmd); break; + //default: printf("PC=%04x R %02x\n",space.device().safe_pc(),m_mcu_cmd); break; } return 0; @@ -265,7 +265,7 @@ WRITE8_MEMBER(flstory_state::rumba_mcu_w) */ m_mcu_bb_res = data; - //printf("PC=%04x W %02x -> %02x\n",cpu_get_pc(&space.device()),m_mcu_cmd,data); + //printf("PC=%04x W %02x -> %02x\n",space.device().safe_pc(),m_mcu_cmd,data); break; } case 0xb4: // when the bird touches the top / bottom / left / right of the screen, for correct repositioning diff --git a/src/mame/drivers/fromanc2.c b/src/mame/drivers/fromanc2.c index 0656e86e165..c1f71e4464b 100644 --- a/src/mame/drivers/fromanc2.c +++ b/src/mame/drivers/fromanc2.c @@ -63,7 +63,7 @@ READ16_MEMBER(fromanc2_state::fromanc2_keymatrix_r) case 0x04: ret = ioport("KEY2")->read(); break; case 0x08: ret = ioport("KEY3")->read(); break; default: ret = 0xffff; - logerror("PC:%08X unknown %02X\n", cpu_get_pc(&space.device()), m_portselect); + logerror("PC:%08X unknown %02X\n", space.device().safe_pc(), m_portselect); break; } diff --git a/src/mame/drivers/fuukifg2.c b/src/mame/drivers/fuukifg2.c index 80ddfa7bfe3..58de68a833c 100644 --- a/src/mame/drivers/fuukifg2.c +++ b/src/mame/drivers/fuukifg2.c @@ -117,7 +117,7 @@ WRITE8_MEMBER(fuuki16_state::fuuki16_sound_rombank_w) if (data <= 2) membank("bank1")->set_entry(data); else - logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", space.device().safe_pc(), data); } WRITE8_MEMBER(fuuki16_state::fuuki16_oki_banking_w) diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index 1fccb82f4da..9c35818cdae 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -273,7 +273,7 @@ WRITE32_MEMBER(gaelco3d_state::irq_ack32_w) else if (ACCESSING_BITS_0_7) gaelco_serial_tr_w(machine().device("serial"), 0, data & 0x01); else - logerror("%06X:irq_ack_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:irq_ack_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } @@ -313,11 +313,11 @@ READ32_MEMBER(gaelco3d_state::eeprom_data32_r) { UINT8 data = gaelco_serial_data_r(machine().device("serial"),0); if (LOG) - logerror("%06X:read(%02X) = %08X & %08X\n", cpu_get_pc(machine().device("maincpu")), offset, data, mem_mask); + logerror("%06X:read(%02X) = %08X & %08X\n", machine().device("maincpu")->safe_pc(), offset, data, mem_mask); return data | 0xffffff00; } else - logerror("%06X:read(%02X) = mask %08X\n", cpu_get_pc(machine().device("maincpu")), offset, mem_mask); + logerror("%06X:read(%02X) = mask %08X\n", machine().device("maincpu")->safe_pc(), offset, mem_mask); return 0xffffffff; } @@ -378,7 +378,7 @@ static TIMER_CALLBACK( delayed_sound_w ) WRITE16_MEMBER(gaelco3d_state::sound_data_w) { if (LOG) - logerror("%06X:sound_data_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:sound_data_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); if (ACCESSING_BITS_0_7) machine().scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff); } @@ -396,7 +396,7 @@ READ16_MEMBER(gaelco3d_state::sound_data_r) READ16_MEMBER(gaelco3d_state::sound_status_r) { if (LOG) - logerror("%06X:sound_status_r(%02X) = %02X\n", cpu_get_pc(&space.device()), offset, m_sound_status); + logerror("%06X:sound_status_r(%02X) = %02X\n", space.device().safe_pc(), offset, m_sound_status); if (ACCESSING_BITS_0_7) return m_sound_status; return 0xffff; @@ -441,7 +441,7 @@ WRITE16_MEMBER(gaelco3d_state::analog_port_clock_w) else { if (LOG) - logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } } @@ -462,7 +462,7 @@ WRITE16_MEMBER(gaelco3d_state::analog_port_latch_w) else { if (LOG) - logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } } @@ -477,7 +477,7 @@ WRITE16_MEMBER(gaelco3d_state::analog_port_latch_w) READ32_MEMBER(gaelco3d_state::tms_m68k_ram_r) { -// logerror("%06X:tms_m68k_ram_r(%04X) = %08X\n", cpu_get_pc(&space.device()), offset, !(offset & 1) ? ((INT32)m_m68k_ram_base[offset/2] >> 16) : (int)(INT16)m_m68k_ram_base[offset/2]); +// logerror("%06X:tms_m68k_ram_r(%04X) = %08X\n", space.device().safe_pc(), offset, !(offset & 1) ? ((INT32)m_m68k_ram_base[offset/2] >> 16) : (int)(INT16)m_m68k_ram_base[offset/2]); return (INT32)(INT16)m_m68k_ram_base[offset ^ m_tms_offset_xor]; } @@ -508,7 +508,7 @@ WRITE16_MEMBER(gaelco3d_state::tms_reset_w) /* this is set to 0 while data is uploaded, then set to $ffff after it is done */ /* it does not ever appear to be touched after that */ if (LOG) - logerror("%06X:tms_reset_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:tms_reset_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); cputag_set_input_line(machine(), "tms", INPUT_LINE_RESET, (data == 0xffff) ? CLEAR_LINE : ASSERT_LINE); } @@ -518,7 +518,7 @@ WRITE16_MEMBER(gaelco3d_state::tms_irq_w) /* this is written twice, 0,1, in quick succession */ /* done after uploading, and after modifying the comm area */ if (LOG) - logerror("%06X:tms_irq_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:tms_irq_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); if (ACCESSING_BITS_0_7) cputag_set_input_line(machine(), "tms", 0, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE); } @@ -527,7 +527,7 @@ WRITE16_MEMBER(gaelco3d_state::tms_irq_w) WRITE16_MEMBER(gaelco3d_state::tms_control3_w) { if (LOG) - logerror("%06X:tms_control3_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:tms_control3_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } @@ -535,7 +535,7 @@ WRITE16_MEMBER(gaelco3d_state::tms_comm_w) { COMBINE_DATA(&m_tms_comm_base[offset ^ m_tms_offset_xor]); if (LOG) - logerror("%06X:tms_comm_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask); + logerror("%06X:tms_comm_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset*2, data, mem_mask); } @@ -739,27 +739,27 @@ WRITE32_MEMBER(gaelco3d_state::radikalb_lamp_w) { /* arbitrary data written */ if (ACCESSING_BITS_0_7) - logerror("%06X:unknown_127_w = %02X\n", cpu_get_pc(&space.device()), data & 0xff); + logerror("%06X:unknown_127_w = %02X\n", space.device().safe_pc(), data & 0xff); else - logerror("%06X:unknown_127_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:unknown_127_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } WRITE32_MEMBER(gaelco3d_state::unknown_137_w) { /* only written $00 or $ff */ if (ACCESSING_BITS_0_7) - logerror("%06X:unknown_137_w = %02X\n", cpu_get_pc(&space.device()), data & 0xff); + logerror("%06X:unknown_137_w = %02X\n", space.device().safe_pc(), data & 0xff); else - logerror("%06X:unknown_137_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:unknown_137_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } WRITE32_MEMBER(gaelco3d_state::unknown_13a_w) { /* only written $0000 or $0001 */ if (ACCESSING_BITS_0_15) - logerror("%06X:unknown_13a_w = %04X\n", cpu_get_pc(&space.device()), data & 0xffff); + logerror("%06X:unknown_13a_w = %04X\n", space.device().safe_pc(), data & 0xffff); else - logerror("%06X:unknown_13a_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:unknown_13a_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c index 91803a9b164..a7f7400c0c8 100644 --- a/src/mame/drivers/gaiden.c +++ b/src/mame/drivers/gaiden.c @@ -176,7 +176,7 @@ WRITE16_MEMBER(gaiden_state::wildfang_protection_w) data >>= 8; -// logerror("PC %06x: prot = %02x\n",cpu_get_pc(&space.device()),data); +// logerror("PC %06x: prot = %02x\n",space.device().safe_pc(),data); switch (data & 0xf0) { @@ -214,7 +214,7 @@ WRITE16_MEMBER(gaiden_state::wildfang_protection_w) READ16_MEMBER(gaiden_state::wildfang_protection_r) { -// logerror("PC %06x: read prot %02x\n", cpu_get_pc(&space.device()), m_prot); +// logerror("PC %06x: read prot %02x\n", space.device().safe_pc(), m_prot); return m_prot; } @@ -337,7 +337,7 @@ WRITE16_MEMBER(gaiden_state::raiga_protection_w) { data >>= 8; -// logerror("PC %06x: prot = %02x\n", cpu_get_pc(&space.device()), data); +// logerror("PC %06x: prot = %02x\n", space.device().safe_pc(), data); switch (data & 0xf0) { @@ -383,7 +383,7 @@ WRITE16_MEMBER(gaiden_state::raiga_protection_w) READ16_MEMBER(gaiden_state::raiga_protection_r) { -// logerror("PC %06x: read prot %02x\n", cpu_get_pc(&space.device()), m_prot); +// logerror("PC %06x: read prot %02x\n", space.device().safe_pc(), m_prot); return m_prot; } diff --git a/src/mame/drivers/galastrm.c b/src/mame/drivers/galastrm.c index d2c4e1f9f62..c98ffcdb5c8 100644 --- a/src/mame/drivers/galastrm.c +++ b/src/mame/drivers/galastrm.c @@ -140,7 +140,7 @@ popmessage(t); coin_counter_w(machine(), 1, data & 0x04000000); m_coin_word = (data >> 16) &0xffff; } -//logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&device()),offset); +//logerror("CPU #0 PC %06x: write input %06x\n",device->safe_pc(),offset); } } } diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index d3c750330b1..fcc9e2040f8 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -1244,7 +1244,7 @@ READ8_MEMBER(galaxian_state::jumpbug_protection_r) case 0x0235: return 0x02; case 0x0311: return 0xff; /* not checked */ } - logerror("Unknown protection read. Offset: %04X PC=%04X\n",0xb000+offset,cpu_get_pc(&space.device())); + logerror("Unknown protection read. Offset: %04X PC=%04X\n",0xb000+offset,space.device().safe_pc()); return 0xff; } @@ -1271,7 +1271,7 @@ static TIMER_DEVICE_CALLBACK( checkmaj_irq0_gen ) READ8_MEMBER(galaxian_state::checkmaj_protection_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0f15: return 0xf5; case 0x0f8f: return 0x7c; @@ -1280,7 +1280,7 @@ READ8_MEMBER(galaxian_state::checkmaj_protection_r) case 0x10f1: return 0xaa; case 0x1402: return 0xaa; default: - logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space.device())); + logerror("Unknown protection read. PC=%04X\n",space.device().safe_pc()); } return 0; diff --git a/src/mame/drivers/galaxold.c b/src/mame/drivers/galaxold.c index cc3b3cb650b..8943bbdf453 100644 --- a/src/mame/drivers/galaxold.c +++ b/src/mame/drivers/galaxold.c @@ -397,7 +397,7 @@ Stephh's notes (based on the games Z80 code and some tests) for other games : /* Send sound data to the sound cpu and cause an nmi */ READ8_MEMBER(galaxold_state::drivfrcg_port0_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x002e: case 0x0297: @@ -895,7 +895,7 @@ ADDRESS_MAP_END READ8_MEMBER(galaxold_state::hexpoola_data_port_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0022: return 0; @@ -916,7 +916,7 @@ ADDRESS_MAP_END READ8_MEMBER(galaxold_state::bullsdrtg_data_port_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0083: case 0x008c: @@ -928,7 +928,7 @@ READ8_MEMBER(galaxold_state::bullsdrtg_data_port_r) case 0x6b58: return 1; default: - logerror("Reading data port at PC=%04X\n", cpu_get_pc(&space.device())); + logerror("Reading data port at PC=%04X\n", space.device().safe_pc()); break; } diff --git a/src/mame/drivers/gaplus.c b/src/mame/drivers/gaplus.c index d49daf9a254..312dec26c8c 100644 --- a/src/mame/drivers/gaplus.c +++ b/src/mame/drivers/gaplus.c @@ -206,7 +206,7 @@ WRITE8_MEMBER(gaplus_state::gaplus_freset_w) device_t *io56xx = machine().device("56xx"); int bit = !BIT(offset, 11); - logerror("%04x: freset %d\n",cpu_get_pc(&space.device()), bit); + logerror("%04x: freset %d\n",space.device().safe_pc(), bit); namcoio_set_reset_line(io58xx, bit ? CLEAR_LINE : ASSERT_LINE); namcoio_set_reset_line(io56xx, bit ? CLEAR_LINE : ASSERT_LINE); diff --git a/src/mame/drivers/gbusters.c b/src/mame/drivers/gbusters.c index 004eb5128b8..94c0b02276f 100644 --- a/src/mame/drivers/gbusters.c +++ b/src/mame/drivers/gbusters.c @@ -56,7 +56,7 @@ WRITE8_MEMBER(gbusters_state::gbusters_1f98_w) /* other bits unused/unknown */ if (data & 0xfe) { - //logerror("%04x: (1f98) write %02x\n",cpu_get_pc(&space.device()), data); + //logerror("%04x: (1f98) write %02x\n",space.device().safe_pc(), data); //popmessage("$1f98 = %02x", data); } } @@ -84,13 +84,13 @@ WRITE8_MEMBER(gbusters_state::gbusters_coin_counter_w) sprintf(baf, "ccnt = %02x", data); popmessage(baf); #endif - logerror("%04x: (ccount) write %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: (ccount) write %02x\n", space.device().safe_pc(), data); } } WRITE8_MEMBER(gbusters_state::gbusters_unknown_w) { - logerror("%04x: write %02x to 0x1f9c\n",cpu_get_pc(&space.device()), data); + logerror("%04x: write %02x to 0x1f9c\n",space.device().safe_pc(), data); { char baf[40]; @@ -430,7 +430,7 @@ static KONAMI_SETLINES_CALLBACK( gbusters_banking ) if (lines & 0xf0) { - //logerror("%04x: (lines) write %02x\n",cpu_get_pc(device), lines); + //logerror("%04x: (lines) write %02x\n",device->safe_pc(), lines); //popmessage("lines = %02x", lines); } diff --git a/src/mame/drivers/gcpinbal.c b/src/mame/drivers/gcpinbal.c index c6dd77fcb8f..827bdf5bcec 100644 --- a/src/mame/drivers/gcpinbal.c +++ b/src/mame/drivers/gcpinbal.c @@ -101,7 +101,7 @@ READ16_MEMBER(gcpinbal_state::ioc_r) } -//logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",cpu_get_pc(&space.device()),offset); +//logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",space.device().safe_pc(),offset); return m_ioc_ram[offset]; } @@ -192,7 +192,7 @@ WRITE16_MEMBER(gcpinbal_state::ioc_w) break; default: - logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", cpu_get_pc(&space.device()), offset, data); + logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", space.device().safe_pc(), offset, data); break; } diff --git a/src/mame/drivers/gei.c b/src/mame/drivers/gei.c index 0f15d12109c..82a8449fe5d 100644 --- a/src/mame/drivers/gei.c +++ b/src/mame/drivers/gei.c @@ -260,7 +260,7 @@ WRITE8_MEMBER(gei_state::nmi_w) READ8_MEMBER(gei_state::catchall) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (pc != 0x3c74 && pc != 0x0364 && pc != 0x036d) /* weed out spurious blit reads */ logerror("%04x: unmapped memory read from %04x\n",pc,offset); diff --git a/src/mame/drivers/ghosteo.c b/src/mame/drivers/ghosteo.c index 6356bf4e8af..893860e71ab 100644 --- a/src/mame/drivers/ghosteo.c +++ b/src/mame/drivers/ghosteo.c @@ -559,7 +559,7 @@ READ32_MEMBER(ghosteo_state::bballoon_speedup_r) UINT32 ret = s3c2410_lcd_r(s3c2410, offset+0x10/4, mem_mask); - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); // these are vblank waits if (pc == 0x3001c0e4 || pc == 0x3001c0d8) diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c index 7bad1e29383..04eca081df1 100644 --- a/src/mame/drivers/gladiatr.c +++ b/src/mame/drivers/gladiatr.c @@ -995,7 +995,7 @@ DRIVER_INIT_MEMBER(gladiatr_state,gladiatr) READ8_MEMBER(gladiatr_state::f6a3_r) { - if(cpu_get_previouspc(&space.device())==0x8e) + if(space.device().safe_pcbase()==0x8e) m_nvram[0x6a3]=1; return m_nvram[0x6a3]; diff --git a/src/mame/drivers/glass.c b/src/mame/drivers/glass.c index 216b56f56f6..9b7e9dd5f3c 100644 --- a/src/mame/drivers/glass.c +++ b/src/mame/drivers/glass.c @@ -320,7 +320,7 @@ static void glass_ROM16_split_gfx( running_machine &machine, const char *src_reg READ16_MEMBER( glass_state::glass_mainram_r ) { UINT16 ret = m_mainram[offset]; - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (offset == (0xfede96 - 0xfec000)>>1) { @@ -353,7 +353,7 @@ READ16_MEMBER( glass_state::glass_mainram_r ) WRITE16_MEMBER( glass_state::glass_mainram_w ) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); COMBINE_DATA(&m_mainram[offset]); diff --git a/src/mame/drivers/goal92.c b/src/mame/drivers/goal92.c index 786e25a983c..9ba47506ad4 100644 --- a/src/mame/drivers/goal92.c +++ b/src/mame/drivers/goal92.c @@ -40,7 +40,7 @@ READ16_MEMBER(goal92_state::goal92_inputs_r) return ioport("DSW2")->read(); default: - logerror("reading unhandled goal92 inputs %04X %04X @ PC = %04X\n", offset, mem_mask,cpu_get_pc(&space.device())); + logerror("reading unhandled goal92 inputs %04X %04X @ PC = %04X\n", offset, mem_mask,space.device().safe_pc()); } return 0; diff --git a/src/mame/drivers/goindol.c b/src/mame/drivers/goindol.c index b51d7b3e9a2..e00dd633d6d 100644 --- a/src/mame/drivers/goindol.c +++ b/src/mame/drivers/goindol.c @@ -52,7 +52,7 @@ READ8_MEMBER(goindol_state::prot_f422_r) WRITE8_MEMBER(goindol_state::prot_fc44_w) { - logerror("%04x: prot_fc44_w(%02x)\n", cpu_get_pc(&space.device()), data); + logerror("%04x: prot_fc44_w(%02x)\n", space.device().safe_pc(), data); m_ram[0x0419] = 0x5b; m_ram[0x041a] = 0x3f; m_ram[0x041b] = 0x6d; @@ -61,21 +61,21 @@ WRITE8_MEMBER(goindol_state::prot_fc44_w) WRITE8_MEMBER(goindol_state::prot_fd99_w) { - logerror("%04x: prot_fd99_w(%02x)\n", cpu_get_pc(&space.device()), data); + logerror("%04x: prot_fd99_w(%02x)\n", space.device().safe_pc(), data); m_ram[0x0421] = 0x3f; } WRITE8_MEMBER(goindol_state::prot_fc66_w) { - logerror("%04x: prot_fc66_w(%02x)\n", cpu_get_pc(&space.device()), data); + logerror("%04x: prot_fc66_w(%02x)\n", space.device().safe_pc(), data); m_ram[0x0423] = 0x06; } WRITE8_MEMBER(goindol_state::prot_fcb0_w) { - logerror("%04x: prot_fcb0_w(%02x)\n", cpu_get_pc(&space.device()), data); + logerror("%04x: prot_fcb0_w(%02x)\n", space.device().safe_pc(), data); m_ram[0x0425] = 0x06; } diff --git a/src/mame/drivers/gradius3.c b/src/mame/drivers/gradius3.c index cb06b2786d7..0a59befd99c 100644 --- a/src/mame/drivers/gradius3.c +++ b/src/mame/drivers/gradius3.c @@ -41,7 +41,7 @@ WRITE16_MEMBER(gradius3_state::k052109_halfword_w) /* is this a bug in the game or something else? */ if (!ACCESSING_BITS_0_7) k052109_w(m_k052109, offset, (data >> 8) & 0xff); -// logerror("%06x half %04x = %04x\n",cpu_get_pc(&space.device()),offset,data); +// logerror("%06x half %04x = %04x\n",space.device().safe_pc(),offset,data); } READ16_MEMBER(gradius3_state::k051937_halfword_r) @@ -88,7 +88,7 @@ WRITE16_MEMBER(gradius3_state::cpuA_ctrl_w) m_irqAen = data & 0x20; /* other bits unknown */ - //logerror("%06x: write %04x to c0000\n",cpu_get_pc(&space.device()),data); + //logerror("%06x: write %04x to c0000\n",space.device().safe_pc(),data); } } @@ -124,11 +124,11 @@ WRITE16_MEMBER(gradius3_state::cpuB_irqtrigger_w) if (m_irqBmask & 4) { - logerror("%04x trigger cpu B irq 4 %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x trigger cpu B irq 4 %02x\n",space.device().safe_pc(),data); device_set_input_line(m_subcpu, 4, HOLD_LINE); } else - logerror("%04x MISSED cpu B irq 4 %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x MISSED cpu B irq 4 %02x\n",space.device().safe_pc(),data); } WRITE16_MEMBER(gradius3_state::sound_command_w) diff --git a/src/mame/drivers/gsword.c b/src/mame/drivers/gsword.c index 152548a3984..b7a65203284 100644 --- a/src/mame/drivers/gsword.c +++ b/src/mame/drivers/gsword.c @@ -197,7 +197,7 @@ static READ8_HANDLER( gsword_8741_2_r ) case 0x04: /* Player 2 Controller */ return space->machine().root_device().ioport("IN3")->read(); // default: -// logerror("8741-2 unknown read %d PC=%04x\n",offset,cpu_get_pc(&space->device())); +// logerror("8741-2 unknown read %d PC=%04x\n",offset,space->device().safe_pc()); } /* unknown */ return 0; @@ -215,7 +215,7 @@ static READ8_HANDLER( gsword_8741_3_r ) return space->machine().root_device().ioport("IN3")->read(); } /* unknown */ -// logerror("8741-3 unknown read %d PC=%04x\n",offset,cpu_get_pc(&space->device())); +// logerror("8741-3 unknown read %d PC=%04x\n",offset,space->device().safe_pc()); return 0; } diff --git a/src/mame/drivers/gunbustr.c b/src/mame/drivers/gunbustr.c index cd80a05699d..9845d958bb8 100644 --- a/src/mame/drivers/gunbustr.c +++ b/src/mame/drivers/gunbustr.c @@ -117,7 +117,7 @@ WRITE32_MEMBER(gunbustr_state::gunbustr_input_w) coin_counter_w(machine(), 1, data & 0x04000000); m_coin_word = (data >> 16) &0xffff; } - //logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&device()),offset); + //logerror("CPU #0 PC %06x: write input %06x\n",device->safe_pc(),offset); break; } } @@ -434,7 +434,7 @@ ROM_END READ32_MEMBER(gunbustr_state::main_cycle_r) { - if (cpu_get_pc(&space.device())==0x55a && (m_ram[0x3acc/4]&0xff000000)==0) + if (space.device().safe_pc()==0x55a && (m_ram[0x3acc/4]&0xff000000)==0) device_spin_until_interrupt(&space.device()); return m_ram[0x3acc/4]; diff --git a/src/mame/drivers/halleys.c b/src/mame/drivers/halleys.c index 1b24775543a..7e55bb91ce3 100644 --- a/src/mame/drivers/halleys.c +++ b/src/mame/drivers/halleys.c @@ -1019,7 +1019,7 @@ WRITE8_MEMBER(halleys_state::bgtile_w) READ8_MEMBER(halleys_state::blitter_status_r) { - if (m_game_id==GAME_HALLEYS && cpu_get_pc(&space.device())==0x8017) return(0x55); // HACK: trick SRAM test on startup + if (m_game_id==GAME_HALLEYS && space.device().safe_pc()==0x8017) return(0x55); // HACK: trick SRAM test on startup return(0); } @@ -1090,7 +1090,7 @@ READ8_MEMBER(halleys_state::collision_id_r) UPDATE: re-implemented pixel collision to accompany the hack method. */ - if (m_game_id==GAME_HALLEYS && cpu_get_pc(&space.device())==m_collision_detection) // HACK: collision detection bypass + if (m_game_id==GAME_HALLEYS && space.device().safe_pc()==m_collision_detection) // HACK: collision detection bypass { if (m_collision_count) { m_collision_count--; return(m_collision_list[m_collision_count]); } diff --git a/src/mame/drivers/hexion.c b/src/mame/drivers/hexion.c index 9fd32815146..66ef278d351 100644 --- a/src/mame/drivers/hexion.c +++ b/src/mame/drivers/hexion.c @@ -89,7 +89,7 @@ Notes: WRITE8_MEMBER(hexion_state::coincntr_w) { -//logerror("%04x: coincntr_w %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: coincntr_w %02x\n",space.device().safe_pc(),data); /* bits 0/1 = coin counters */ coin_counter_w(machine(), 0,data & 0x01); diff --git a/src/mame/drivers/hitpoker.c b/src/mame/drivers/hitpoker.c index 353cbecec6b..d3daa8fc254 100644 --- a/src/mame/drivers/hitpoker.c +++ b/src/mame/drivers/hitpoker.c @@ -216,10 +216,10 @@ READ8_MEMBER(hitpoker_state::hitpoker_pic_r) if(offset == 0) { - if(cpu_get_pc(&space.device()) == 0x3143 || - cpu_get_pc(&space.device()) == 0x314e || - cpu_get_pc(&space.device()) == 0x3164 || - cpu_get_pc(&space.device()) == 0x3179) + if(space.device().safe_pc() == 0x3143 || + space.device().safe_pc() == 0x314e || + space.device().safe_pc() == 0x3164 || + space.device().safe_pc() == 0x3179) return m_pic_data; return (m_pic_data & 0x7f) | (m_pic_data & 0x40 ? 0x80 : 0x00); diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index 518b9836ecf..9e6656274d3 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -476,21 +476,21 @@ READ32_MEMBER(hng64_state::hng64_random_read) READ32_MEMBER(hng64_state::hng64_com_r) { - logerror("com read (PC=%08x): %08x %08x = %08x\n", cpu_get_pc(&space.device()), (offset*4)+0xc0000000, mem_mask, m_com_ram[offset]); + logerror("com read (PC=%08x): %08x %08x = %08x\n", space.device().safe_pc(), (offset*4)+0xc0000000, mem_mask, m_com_ram[offset]); return m_com_ram[offset]; } WRITE32_MEMBER(hng64_state::hng64_com_w) { - logerror("com write (PC=%08x): %08x %08x = %08x\n", cpu_get_pc(&space.device()), (offset*4)+0xc0000000, mem_mask, data); + logerror("com write (PC=%08x): %08x %08x = %08x\n", space.device().safe_pc(), (offset*4)+0xc0000000, mem_mask, data); COMBINE_DATA(&m_com_ram[offset]); } WRITE32_MEMBER(hng64_state::hng64_com_share_w) { - logerror("commw (PC=%08x): %08x %08x %08x\n", cpu_get_pc(&space.device()), data, (offset*4)+0xc0001000, mem_mask); + logerror("commw (PC=%08x): %08x %08x %08x\n", space.device().safe_pc(), data, (offset*4)+0xc0001000, mem_mask); if (offset == 0x0) COMBINE_DATA(&m_com_shared_a); if (offset == 0x1) COMBINE_DATA(&m_com_shared_b); @@ -498,7 +498,7 @@ WRITE32_MEMBER(hng64_state::hng64_com_share_w) READ32_MEMBER(hng64_state::hng64_com_share_r) { - logerror("commr (PC=%08x): %08x %08x\n", cpu_get_pc(&space.device()), (offset*4)+0xc0001000, mem_mask); + logerror("commr (PC=%08x): %08x %08x\n", space.device().safe_pc(), (offset*4)+0xc0001000, mem_mask); //if(offset == 0x0) return m_com_shared_a; //if(offset == 0x1) return m_com_shared_b; @@ -529,7 +529,7 @@ READ32_MEMBER(hng64_state::hng64_sysregs_r) #if 0 if((offset*4) != 0x1084) - printf("HNG64 port read (PC=%08x) 0x%08x\n", cpu_get_pc(&space.device()), offset*4); + printf("HNG64 port read (PC=%08x) 0x%08x\n", space.device().safe_pc(), offset*4); #endif rtc_addr = offset >> 1; @@ -605,14 +605,14 @@ WRITE32_MEMBER(hng64_state::hng64_sysregs_w) #if 0 if(((offset*4) & 0xff00) == 0x1100) - printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device())); + printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], space.device().safe_pc()); #endif switch(offset*4) { case 0x1084: //MIPS->MCU latch port m_mcu_en = (data & 0xff); //command-based, i.e. doesn't control halt line and such? - //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device())); + //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], space.device().safe_pc()); break; //0x110c global irq mask? /* irq ack */ @@ -624,7 +624,7 @@ WRITE32_MEMBER(hng64_state::hng64_sysregs_w) hng64_do_dma(&space); break; //default: - // printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device())); + // printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], space.device().safe_pc()); } } @@ -751,7 +751,7 @@ READ32_MEMBER(hng64_state::racing_io_r) READ32_MEMBER(hng64_state::hng64_dualport_r) { - //printf("dualport R %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(&space.device())); + //printf("dualport R %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], space.device().safe_pc()); /* command table: @@ -789,7 +789,7 @@ Beast Busters 2 outputs (all at offset == 0x1c): WRITE32_MEMBER(hng64_state::hng64_dualport_w) { - //printf("dualport WRITE %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(&space.device())); + //printf("dualport WRITE %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], space.device().safe_pc()); COMBINE_DATA (&m_dualport[offset]); } @@ -862,8 +862,8 @@ WRITE32_MEMBER(hng64_state::dl_w) #if 0 READ32_MEMBER(hng64_state::dl_r) { - //mame_printf_debug("dl R (%08x) : %x %x\n", cpu_get_pc(&space.device()), offset, hng64_dl[offset]); - //usrintf_showmessage("dl R (%08x) : %x %x", cpu_get_pc(&space.device()), offset, hng64_dl[offset]); + //mame_printf_debug("dl R (%08x) : %x %x\n", space.device().safe_pc(), offset, hng64_dl[offset]); + //usrintf_showmessage("dl R (%08x) : %x %x", space.device().safe_pc(), offset, hng64_dl[offset]); return hng64_dl[offset]; } #endif diff --git a/src/mame/drivers/homedata.c b/src/mame/drivers/homedata.c index c2ef47f023b..f9889ce5958 100644 --- a/src/mame/drivers/homedata.c +++ b/src/mame/drivers/homedata.c @@ -309,7 +309,7 @@ WRITE8_MEMBER(homedata_state::mrokumei_sound_io_w) m_dac->write_signed8(data); break; default: - logerror("%04x: I/O write to port %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: I/O write to port %04x\n", space.device().safe_pc(), offset); break; } } @@ -352,7 +352,7 @@ WRITE8_MEMBER(homedata_state::reikaids_upd7807_portc_w) 1 \ ROM bank 0 / */ -// logerror("%04x: port C wr %02x (STATUS %d DATA %d)\n", cpu_get_pc(&space.device()), data, BIT(data, 2), BIT(data, 6)); +// logerror("%04x: port C wr %02x (STATUS %d DATA %d)\n", space.device().safe_pc(), data, BIT(data, 2), BIT(data, 6)); membank("bank2")->set_entry(data & 0x03); @@ -379,21 +379,21 @@ READ8_MEMBER(homedata_state::reikaids_io_r) m_vblank = 0; - //logerror("%04x: io_r %02x\n", cpu_get_pc(&space.device()), res); + //logerror("%04x: io_r %02x\n", space.device().safe_pc(), res); return res; } READ8_MEMBER(homedata_state::reikaids_snd_command_r) { - //logerror("%04x: sndmcd_r (%02x)\n", cpu_get_pc(&space.device()), m_snd_command); + //logerror("%04x: sndmcd_r (%02x)\n", space.device().safe_pc(), m_snd_command); return m_snd_command; } WRITE8_MEMBER(homedata_state::reikaids_snd_command_w) { m_snd_command = data; - //logerror("%04x: coprocessor_command_w %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: coprocessor_command_w %02x\n", space.device().safe_pc(), data); } @@ -407,13 +407,13 @@ WRITE8_MEMBER(homedata_state::reikaids_snd_command_w) WRITE8_MEMBER(homedata_state::pteacher_snd_command_w) { - //logerror("%04x: snd_command_w %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: snd_command_w %02x\n", space.device().safe_pc(), data); m_from_cpu = data; } READ8_MEMBER(homedata_state::pteacher_snd_r) { - //logerror("%04x: pteacher_snd_r %02x\n",cpu_get_pc(&space.device()),to_cpu); + //logerror("%04x: pteacher_snd_r %02x\n",space.device().safe_pc(),to_cpu); return m_to_cpu; } @@ -439,7 +439,7 @@ READ8_MEMBER(homedata_state::pteacher_keyboard_r) static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" }; int dips = ioport("DSW")->read(); - // logerror("%04x: keyboard_r with port A = %02x\n",cpu_get_pc(&space.device()),upd7807_porta); + // logerror("%04x: keyboard_r with port A = %02x\n",space.device().safe_pc(),upd7807_porta); if (m_upd7807_porta & 0x80) { @@ -462,7 +462,7 @@ READ8_MEMBER(homedata_state::pteacher_upd7807_porta_r) if (!BIT(m_upd7807_portc, 6)) m_upd7807_porta = m_from_cpu; else - logerror("%04x: read PA with PC *not* clear\n", cpu_get_pc(&space.device())); + logerror("%04x: read PA with PC *not* clear\n", space.device().safe_pc()); return m_upd7807_porta; } @@ -470,7 +470,7 @@ READ8_MEMBER(homedata_state::pteacher_upd7807_porta_r) WRITE8_MEMBER(homedata_state::pteacher_snd_answer_w) { m_to_cpu = data; - //logerror("%04x: to_cpu = %02x\n", cpu_get_pc(&space.device()), m_to_cpu); + //logerror("%04x: to_cpu = %02x\n", space.device().safe_pc(), m_to_cpu); } WRITE8_MEMBER(homedata_state::pteacher_upd7807_porta_w) @@ -491,7 +491,7 @@ WRITE8_MEMBER(homedata_state::pteacher_upd7807_portc_w) 0 input (coin) */ - // logerror("%04x: port C wr %02x\n", cpu_get_pc(&space.device()), data); + // logerror("%04x: port C wr %02x\n", space.device().safe_pc(), data); membank("bank2")->set_entry((data & 0x0c) >> 2); diff --git a/src/mame/drivers/hotblock.c b/src/mame/drivers/hotblock.c index df68f480425..0d835f857ff 100644 --- a/src/mame/drivers/hotblock.c +++ b/src/mame/drivers/hotblock.c @@ -93,8 +93,8 @@ READ8_MEMBER(hotblock_state::hotblock_port4_r) WRITE8_MEMBER(hotblock_state::hotblock_port4_w) { -// mame_printf_debug("port4_w: pc = %06x : data %04x\n", cpu_get_pc(&space.device()), data); -// popmessage("port4_w: pc = %06x : data %04x", cpu_get_pc(&space.device()), data); +// mame_printf_debug("port4_w: pc = %06x : data %04x\n", space.device().safe_pc(), data); +// popmessage("port4_w: pc = %06x : data %04x", space.device().safe_pc(), data); m_port4 = data; } @@ -103,7 +103,7 @@ WRITE8_MEMBER(hotblock_state::hotblock_port4_w) WRITE8_MEMBER(hotblock_state::hotblock_port0_w) { -// popmessage("port4_w: pc = %06x : data %04x", cpu_get_pc(&space.device()), data); +// popmessage("port4_w: pc = %06x : data %04x", space.device().safe_pc(), data); m_port0 = data; } diff --git a/src/mame/drivers/hyprduel.c b/src/mame/drivers/hyprduel.c index 81d27dad36c..4cc4266bce2 100644 --- a/src/mame/drivers/hyprduel.c +++ b/src/mame/drivers/hyprduel.c @@ -296,7 +296,7 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_blitter_w) int shift = (dst_offs & 0x80) ? 0 : 8; UINT16 mask = (dst_offs & 0x80) ? 0x00ff : 0xff00; -// logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", cpu_get_pc(&space.device()), tmap, src_offs, dst_offs); +// logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", space.device().safe_pc(), tmap, src_offs, dst_offs); dst_offs >>= 7 + 1; switch (tmap) @@ -306,7 +306,7 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_blitter_w) case 3: break; default: - logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", cpu_get_pc(&space.device()), tmap); + logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", space.device().safe_pc(), tmap); return; } @@ -316,7 +316,7 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_blitter_w) src_offs %= src_len; b1 = blt_read(src, src_offs); -// logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", cpu_get_pc(&space.device()), b1, src_offs); +// logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", space.device().safe_pc(), b1, src_offs); src_offs++; count = ((~b1) & 0x3f) + 1; @@ -400,7 +400,7 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_blitter_w) default: - logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n", cpu_get_pc(&space.device()), b1, src_offs - 1); + logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n", space.device().safe_pc(), b1, src_offs - 1); return; } diff --git a/src/mame/drivers/igs009.c b/src/mame/drivers/igs009.c index 34f754322ca..3412638eb70 100644 --- a/src/mame/drivers/igs009.c +++ b/src/mame/drivers/igs009.c @@ -376,7 +376,7 @@ WRITE8_MEMBER(igs009_state::jingbell_nmi_and_coins_w) { if ((m_nmi_enable ^ data) & (~0xdd)) { - logerror("PC %06X: nmi_and_coins = %02x\n",cpu_get_pc(&space.device()),data); + logerror("PC %06X: nmi_and_coins = %02x\n",space.device().safe_pc(),data); // popmessage("%02x",data); } @@ -432,7 +432,7 @@ WRITE8_MEMBER(igs009_state::jingbell_magic_w) default: // popmessage("magic %x <- %04x",m_igs_magic[0],data); - logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0], data); + logerror("%06x: warning, writing to igs_magic %02x = %02x\n", space.device().safe_pc(), m_igs_magic[0], data); } } @@ -446,11 +446,11 @@ READ8_MEMBER(igs009_state::jingbell_magic_r) if ( !(m_igs_magic[1] & 0x04) ) return ioport("DSW3")->read(); if ( !(m_igs_magic[1] & 0x08) ) return ioport("DSW4")->read(); if ( !(m_igs_magic[1] & 0x10) ) return ioport("DSW5")->read(); - logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[1]); + logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", space.device().safe_pc(), m_igs_magic[1]); break; default: - logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0]); + logerror("%06x: warning, reading with igs_magic = %02x\n", space.device().safe_pc(), m_igs_magic[0]); } return 0; diff --git a/src/mame/drivers/igs011.c b/src/mame/drivers/igs011.c index 52d62a25c8a..801b54bf46b 100644 --- a/src/mame/drivers/igs011.c +++ b/src/mame/drivers/igs011.c @@ -223,10 +223,10 @@ WRITE16_MEMBER(igs011_state::igs011_priority_w) { COMBINE_DATA(&m_priority); -// logerror("%06x: priority = %02x\n", cpu_get_pc(&space.device()), m_priority); +// logerror("%06x: priority = %02x\n", space.device().safe_pc(), m_priority); if (data & ~0x7) - logerror("%06x: warning, unknown bits written to priority = %02x\n", cpu_get_pc(&space.device()), m_priority); + logerror("%06x: warning, unknown bits written to priority = %02x\n", space.device().safe_pc(), m_priority); } @@ -445,7 +445,7 @@ WRITE16_MEMBER(igs011_state::igs011_blit_flags_w) COMBINE_DATA(&blitter.flags); #if LOG_BLITTER - logerror("%06x: blit x %03x, y %03x, w %03x, h %03x, gfx %03x%04x, depth %02x, pen %02x, flags %03x\n", cpu_get_pc(&space.device()), + logerror("%06x: blit x %03x, y %03x, w %03x, h %03x, gfx %03x%04x, depth %02x, pen %02x, flags %03x\n", space.device().safe_pc(), blitter.x,blitter.y,blitter.w,blitter.h,blitter.gfx_hi,blitter.gfx_lo,blitter.depth,blitter.pen,blitter.flags); #endif @@ -1374,7 +1374,7 @@ WRITE16_MEMBER(igs011_state::drgnwrld_igs003_w) coin_counter_w(machine(), 0,data & 2); if (data & ~0x2) - logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: warning, unknown bits written in coin counter = %02x\n", space.device().safe_pc(), data); break; @@ -1387,7 +1387,7 @@ WRITE16_MEMBER(igs011_state::drgnwrld_igs003_w) default: // popmessage("igs003 %x <- %04x",m_igs003_reg[0],data); - logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data); + logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data); } } READ16_MEMBER(igs011_state::drgnwrld_igs003_r) @@ -1421,7 +1421,7 @@ READ16_MEMBER(igs011_state::drgnwrld_igs003_r) case 0x34: return 0x32; default: - logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]); + logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]); } return 0; @@ -1441,7 +1441,7 @@ WRITE16_MEMBER(igs011_state::lhb_inputs_w) } if ( m_igs_input_sel & (~0xff) ) - logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel); + logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel); // popmessage("sel2 %02x",m_igs_input_sel&~0x1f); } @@ -1458,7 +1458,7 @@ READ16_MEMBER(igs011_state::lhb_inputs_r) if (~m_igs_input_sel & 0x08) return ioport("KEY3")->read(); if (~m_igs_input_sel & 0x10) return ioport("KEY4")->read(); - logerror("%06x: warning, reading with igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel); + logerror("%06x: warning, reading with igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel); break; } return 0; @@ -1486,7 +1486,7 @@ WRITE16_MEMBER(igs011_state::lhb2_igs003_w) } if ( m_igs_input_sel & ~0x7f ) - logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel); + logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel); // popmessage("sel2 %02x",m_igs_input_sel&~0x1f); break; @@ -1501,13 +1501,13 @@ WRITE16_MEMBER(igs011_state::lhb2_igs003_w) } if ( m_lhb2_pen_hi & ~0xf ) - logerror("%06x: warning, unknown bits written in lhb2_pen_hi = %02x\n", cpu_get_pc(&space.device()), m_lhb2_pen_hi); + logerror("%06x: warning, unknown bits written in lhb2_pen_hi = %02x\n", space.device().safe_pc(), m_lhb2_pen_hi); // popmessage("oki %02x",m_lhb2_pen_hi & 0x08); break; default: - logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data); + logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data); } } READ16_MEMBER(igs011_state::lhb2_igs003_r) @@ -1522,7 +1522,7 @@ READ16_MEMBER(igs011_state::lhb2_igs003_r) if (~m_igs_input_sel & 0x10) return ioport("KEY4")->read(); /* fall through */ default: - logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]); + logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]); break; // case 0x03: @@ -1581,13 +1581,13 @@ WRITE16_MEMBER(igs011_state::wlcc_igs003_w) } if (data & ~0x33) - logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: warning, unknown bits written in coin counter = %02x\n", space.device().safe_pc(), data); // popmessage("coin %02x",data); break; default: - logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data); + logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data); } } READ16_MEMBER(igs011_state::wlcc_igs003_r) @@ -1619,7 +1619,7 @@ READ16_MEMBER(igs011_state::wlcc_igs003_r) case 0x34: return 0x32; default: - logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]); + logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]); } return 0; @@ -1647,13 +1647,13 @@ WRITE16_MEMBER(igs011_state::xymg_igs003_w) } if ( m_igs_input_sel & 0x40 ) - logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel); + logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel); // popmessage("sel2 %02x",m_igs_input_sel&~0x1f); break; default: - logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data); + logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data); } } READ16_MEMBER(igs011_state::xymg_igs003_r) @@ -1693,7 +1693,7 @@ READ16_MEMBER(igs011_state::xymg_igs003_r) case 0x34: return 0x32; default: - logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]); + logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]); break; } @@ -1719,13 +1719,13 @@ WRITE16_MEMBER(igs011_state::vbowl_igs003_w) } if (data & ~0x3) - logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: warning, unknown bits written in coin counter = %02x\n", space.device().safe_pc(), data); break; default: // popmessage("igs003 %x <- %04x",m_igs003_reg[0],data); - logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data); + logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data); } } READ16_MEMBER(igs011_state::vbowl_igs003_r) @@ -1761,7 +1761,7 @@ READ16_MEMBER(igs011_state::vbowl_igs003_r) case 0x34: return 0x32; default: - logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]); + logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]); } return 0; @@ -2507,7 +2507,7 @@ WRITE16_MEMBER(igs011_state::vbowl_pen_hi_w) } if (data & ~0x7) - logerror("%06x: warning, unknown bits written to pen_hi = %04x\n", cpu_get_pc(&space.device()), m_priority); + logerror("%06x: warning, unknown bits written to pen_hi = %04x\n", space.device().safe_pc(), m_priority); } WRITE16_MEMBER(igs011_state::vbowl_link_0_w){ } diff --git a/src/mame/drivers/igs_m027.c b/src/mame/drivers/igs_m027.c index 4aac900e9be..05cac89f2cf 100644 --- a/src/mame/drivers/igs_m027.c +++ b/src/mame/drivers/igs_m027.c @@ -80,7 +80,7 @@ WRITE32_MEMBER(igs_m027_state::igs_cg_videoram_w) { COMBINE_DATA(&m_igs_cg_videoram[offset]); //if(data!=0) - logerror("PC(%08X) CG @%x = %x!\n",cpu_get_pc(&space.device()),offset ,m_igs_cg_videoram[offset]); + logerror("PC(%08X) CG @%x = %x!\n",space.device().safe_pc(),offset ,m_igs_cg_videoram[offset]); diff --git a/src/mame/drivers/igspoker.c b/src/mame/drivers/igspoker.c index 2074543bfca..6a550ea9791 100644 --- a/src/mame/drivers/igspoker.c +++ b/src/mame/drivers/igspoker.c @@ -242,7 +242,7 @@ WRITE8_MEMBER(igspoker_state::igs_nmi_and_coins_w) m_nmi_enable = data & 0x80; // nmi enable? #ifdef VERBOSE - logerror("PC %06X: NMI change %02x\n",cpu_get_pc(&space.device()),m_nmi_enable); + logerror("PC %06X: NMI change %02x\n",space.device().safe_pc(),m_nmi_enable); #endif m_out[0] = data; @@ -294,7 +294,7 @@ WRITE8_MEMBER(igspoker_state::igs_lamps_w) READ8_MEMBER(igspoker_state::custom_io_r) { #ifdef VERBOSE - logerror("PC %06X: Protection read %02x\n",cpu_get_pc(&space.device()), (int) m_protection_res); + logerror("PC %06X: Protection read %02x\n",space.device().safe_pc(), (int) m_protection_res); #endif return m_protection_res; } @@ -302,7 +302,7 @@ READ8_MEMBER(igspoker_state::custom_io_r) WRITE8_MEMBER(igspoker_state::custom_io_w) { #ifdef VERBOSE - logerror("PC %06X: Protection write %02x\n",cpu_get_pc(&space.device()),data); + logerror("PC %06X: Protection write %02x\n",space.device().safe_pc(),data); #endif switch (data) diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index 934c35f9b6a..4b48f012313 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -833,14 +833,14 @@ WRITE32_MEMBER(itech32_state::tms2_trigger_w) READ32_MEMBER(itech32_state::drivedge_tms1_speedup_r) { - if (m_tms1_ram[0x382] == 0 && cpu_get_pc(&space.device()) == 0xee) START_TMS_SPINNING(0); + if (m_tms1_ram[0x382] == 0 && space.device().safe_pc() == 0xee) START_TMS_SPINNING(0); return m_tms1_ram[0x382]; } READ32_MEMBER(itech32_state::drivedge_tms2_speedup_r) { - if (m_tms2_ram[0x382] == 0 && cpu_get_pc(&space.device()) == 0x809808) START_TMS_SPINNING(1); + if (m_tms2_ram[0x382] == 0 && space.device().safe_pc() == 0x809808) START_TMS_SPINNING(1); return m_tms2_ram[0x382]; } @@ -929,10 +929,10 @@ ADDRESS_MAP_END READ32_MEMBER(itech32_state::test1_r) { - if (ACCESSING_BITS_24_31 && !m_written[0x100 + offset*4+0]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0x100 + offset*4+0); - if (ACCESSING_BITS_16_23 && !m_written[0x100 + offset*4+1]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0x100 + offset*4+1); - if (ACCESSING_BITS_8_15 && !m_written[0x100 + offset*4+2]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0x100 + offset*4+2); - if (ACCESSING_BITS_0_7 && !m_written[0x100 + offset*4+3]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0x100 + offset*4+3); + if (ACCESSING_BITS_24_31 && !m_written[0x100 + offset*4+0]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0x100 + offset*4+0); + if (ACCESSING_BITS_16_23 && !m_written[0x100 + offset*4+1]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0x100 + offset*4+1); + if (ACCESSING_BITS_8_15 && !m_written[0x100 + offset*4+2]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0x100 + offset*4+2); + if (ACCESSING_BITS_0_7 && !m_written[0x100 + offset*4+3]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0x100 + offset*4+3); return ((UINT32 *)m_main_ram)[0x100/4 + offset]; } @@ -947,10 +947,10 @@ WRITE32_MEMBER(itech32_state::test1_w) READ32_MEMBER(itech32_state::test2_r) { - if (ACCESSING_BITS_24_31 && !m_written[0xc00 + offset*4+0]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0xc00 + offset*4+0); - if (ACCESSING_BITS_16_23 && !m_written[0xc00 + offset*4+1]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0xc00 + offset*4+1); - if (ACCESSING_BITS_8_15 && !m_written[0xc00 + offset*4+2]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0xc00 + offset*4+2); - if (ACCESSING_BITS_0_7 && !m_written[0xc00 + offset*4+3]) logerror("%06X:read from uninitialized memory %04X\n", cpu_get_pc(&space.device()), 0xc00 + offset*4+3); + if (ACCESSING_BITS_24_31 && !m_written[0xc00 + offset*4+0]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0xc00 + offset*4+0); + if (ACCESSING_BITS_16_23 && !m_written[0xc00 + offset*4+1]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0xc00 + offset*4+1); + if (ACCESSING_BITS_8_15 && !m_written[0xc00 + offset*4+2]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0xc00 + offset*4+2); + if (ACCESSING_BITS_0_7 && !m_written[0xc00 + offset*4+3]) logerror("%06X:read from uninitialized memory %04X\n", space.device().safe_pc(), 0xc00 + offset*4+3); return ((UINT32 *)m_main_ram)[0xc00/4 + offset]; } diff --git a/src/mame/drivers/jackie.c b/src/mame/drivers/jackie.c index 584e099eb98..d4016fc182e 100644 --- a/src/mame/drivers/jackie.c +++ b/src/mame/drivers/jackie.c @@ -350,7 +350,7 @@ READ8_MEMBER(jackie_state::expram_r) UINT8 *rom = memregion("gfx3")->base(); offset += m_exp_bank * 0x8000; -// logerror("PC %06X: %04x = %02x\n",cpu_get_pc(&space.device()),offset,rom[offset]); +// logerror("PC %06X: %04x = %02x\n",space.device().safe_pc(),offset,rom[offset]); return rom[offset]; } diff --git a/src/mame/drivers/jaguar.c b/src/mame/drivers/jaguar.c index 69786d4ee8e..6a1c059e6f9 100644 --- a/src/mame/drivers/jaguar.c +++ b/src/mame/drivers/jaguar.c @@ -558,7 +558,7 @@ READ32_MEMBER(jaguar_state::misc_control_r) WRITE32_MEMBER(jaguar_state::misc_control_w) { - logerror("%08X:misc_control_w(%02X)\n", cpu_get_previouspc(&space.device()), data); + logerror("%08X:misc_control_w(%02X)\n", space.device().safe_pcbase(), data); /* D7 = board reset (low) D6 = audio must & reset (high) @@ -751,7 +751,7 @@ WRITE32_MEMBER(jaguar_state::joystick_w) WRITE32_MEMBER(jaguar_state::latch_w) { - logerror("%08X:latch_w(%X)\n", cpu_get_previouspc(&space.device()), data); + logerror("%08X:latch_w(%X)\n", space.device().safe_pcbase(), data); /* adjust banking */ if (memregion("romboard")->base()) @@ -795,7 +795,7 @@ WRITE32_MEMBER(jaguar_state::eeprom_data_w) m_nvram[offset] = data & 0xff000000; } // else -// logerror("%08X:error writing to disabled EEPROM\n", cpu_get_previouspc(&space.device())); +// logerror("%08X:error writing to disabled EEPROM\n", space.device().safe_pcbase()); m_eeprom_enable = false; } @@ -833,7 +833,7 @@ WRITE32_MEMBER(jaguar_state::gpu_jump_w) { /* update the data in memory */ COMBINE_DATA(m_gpu_jump_address); - logerror("%08X:GPU jump address = %08X\n", cpu_get_previouspc(&space.device()), *m_gpu_jump_address); + logerror("%08X:GPU jump address = %08X\n", space.device().safe_pcbase(), *m_gpu_jump_address); /* if the GPU is suspended, release it now */ gpu_resume(); @@ -848,7 +848,7 @@ READ32_MEMBER(jaguar_state::gpu_jump_r) { /* if the current GPU command is just pointing back to the spin loop, and */ /* we're reading it from the spin loop, we can optimize */ - if (*m_gpu_jump_address == m_gpu_spin_pc && cpu_get_previouspc(&space.device()) == m_gpu_spin_pc) + if (*m_gpu_jump_address == m_gpu_spin_pc && space.device().safe_pcbase() == m_gpu_spin_pc) { #if ENABLE_SPEEDUP_HACKS /* spin if we're allowed */ diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c index 5ba936722d1..e57ccdfe132 100644 --- a/src/mame/drivers/jalmah.c +++ b/src/mame/drivers/jalmah.c @@ -972,7 +972,7 @@ WRITE16_MEMBER(jalmah_state::jalmah_okirom_w) memcpy(&oki[0x20000], &oki[(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000], 0x20000); } - //popmessage("PC=%06x %02x %02x %02x %08x",cpu_get_pc(&space.device()),m_oki_rom,m_oki_za,m_oki_bank,(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000); + //popmessage("PC=%06x %02x %02x %02x %08x",space.device().safe_pc(),m_oki_rom,m_oki_za,m_oki_bank,(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000); } WRITE16_MEMBER(jalmah_state::jalmah_okibank_w) @@ -986,7 +986,7 @@ WRITE16_MEMBER(jalmah_state::jalmah_okibank_w) memcpy(&oki[0x20000], &oki[(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000], 0x20000); } - //popmessage("PC=%06x %02x %02x %02x %08x",cpu_get_pc(&space.device()),m_oki_rom,m_oki_za,m_oki_bank,(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000); + //popmessage("PC=%06x %02x %02x %02x %08x",space.device().safe_pc(),m_oki_rom,m_oki_za,m_oki_bank,(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000); } WRITE16_MEMBER(jalmah_state::jalmah_flip_screen_w) @@ -1761,7 +1761,7 @@ READ16_MEMBER(jalmah_state::urashima_mcu_r) res = resp[m_respcount++]; if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0; -// logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),res); +// logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),res); return res; } @@ -1979,7 +1979,7 @@ READ16_MEMBER(jalmah_state::daireika_mcu_r) res = resp[m_respcount++]; if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0; -// logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),res); +// logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),res); return res; } @@ -2258,7 +2258,7 @@ READ16_MEMBER(jalmah_state::mjzoomin_mcu_r) res = resp[m_respcount++]; if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0; -// logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),res); +// logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),res); return res; } @@ -2395,7 +2395,7 @@ READ16_MEMBER(jalmah_state::kakumei_mcu_r) res = resp[m_respcount++]; if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0; -// popmessage("%04x: mcu_r %02x",cpu_get_pc(&space.device()),res); +// popmessage("%04x: mcu_r %02x",space.device().safe_pc(),res); return res; } @@ -2416,7 +2416,7 @@ READ16_MEMBER(jalmah_state::suchipi_mcu_r) res = resp[m_respcount++]; if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0; -// popmessage("%04x: mcu_r %02x",cpu_get_pc(&space.device()),res); +// popmessage("%04x: mcu_r %02x",space.device().safe_pc(),res); return res; } diff --git a/src/mame/drivers/jokrwild.c b/src/mame/drivers/jokrwild.c index 28cd23f8e31..5f8d052a48b 100644 --- a/src/mame/drivers/jokrwild.c +++ b/src/mame/drivers/jokrwild.c @@ -184,10 +184,10 @@ static PALETTE_INIT( jokrwild ) READ8_MEMBER(jokrwild_state::rng_r) { - if(cpu_get_pc(&space.device()) == 0xab32) + if(space.device().safe_pc() == 0xab32) return (offset == 0) ? 0x9e : 0x27; - if(cpu_get_pc(&space.device()) == 0xab3a) + if(space.device().safe_pc() == 0xab3a) return (offset == 2) ? 0x49 : 0x92; return machine().rand() & 0xff; diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c index 80ed9a0cfec..4f01fd93b2d 100644 --- a/src/mame/drivers/kaneko16.c +++ b/src/mame/drivers/kaneko16.c @@ -337,7 +337,7 @@ WRITE16_MEMBER(kaneko16_gtmr_state::bloodwar_oki_0_bank_w) { okim6295_device *oki = downcast(device); oki->set_bank_base(0x40000 * (data & 0xf) ); -// logerror("CPU #0 PC %06X : OKI0 bank %08X\n",cpu_get_pc(&space->device()),data); +// logerror("CPU #0 PC %06X : OKI0 bank %08X\n",space->device().safe_pc(),data); } } @@ -348,7 +348,7 @@ WRITE16_MEMBER(kaneko16_gtmr_state::bloodwar_oki_1_bank_w) { okim6295_device *oki = downcast(device); oki->set_bank_base(0x40000 * data ); -// logerror("CPU #0 PC %06X : OKI1 bank %08X\n",cpu_get_pc(&space->device()),data); +// logerror("CPU #0 PC %06X : OKI1 bank %08X\n",space->device().safe_pc(),data); } } @@ -478,7 +478,7 @@ WRITE16_MEMBER(kaneko16_gtmr_state::gtmr_oki_0_bank_w) { okim6295_device *oki = downcast(device); oki->set_bank_base( 0x40000 * (data & 0xF) ); -// logerror("CPU #0 PC %06X : OKI0 bank %08X\n",cpu_get_pc(&space->device()),data); +// logerror("CPU #0 PC %06X : OKI0 bank %08X\n",space->device().safe_pc(),data); } } @@ -489,7 +489,7 @@ WRITE16_MEMBER(kaneko16_gtmr_state::gtmr_oki_1_bank_w) { okim6295_device *oki = downcast(device); oki->set_bank_base( 0x40000 * (data & 0x1) ); -// logerror("CPU #0 PC %06X : OKI1 bank %08X\n",cpu_get_pc(&space->device()),data); +// logerror("CPU #0 PC %06X : OKI1 bank %08X\n",space->device().safe_pc(),data); } } @@ -552,7 +552,7 @@ READ16_MEMBER(kaneko16_gtmr_state::gtmr2_wheel_r) case 0x0800: // 360' Wheel return (ioport("WHEEL2")->read() << 8); default: - logerror("gtmr2_wheel_r : read at %06x with joystick\n", cpu_get_pc(&space.device())); + logerror("gtmr2_wheel_r : read at %06x with joystick\n", space.device().safe_pc()); return (~0); } } diff --git a/src/mame/drivers/kickgoal.c b/src/mame/drivers/kickgoal.c index a9b2ee49f60..18c340282ef 100644 --- a/src/mame/drivers/kickgoal.c +++ b/src/mame/drivers/kickgoal.c @@ -155,7 +155,7 @@ WRITE16_MEMBER(kickgoal_state::kickgoal_snd_w) okim6295_device *oki = downcast(device); if (ACCESSING_BITS_0_7) { - logerror("PC:%06x Writing %04x to Sound CPU\n",cpu_get_previouspc(&space->device()),data); + logerror("PC:%06x Writing %04x to Sound CPU\n",space->device().safe_pcbase(),data); if (data >= 0x40) { if (data == 0xfe) { oki->write(0,0x40); /* Stop playing the melody */ diff --git a/src/mame/drivers/kinst.c b/src/mame/drivers/kinst.c index e5ccd2d5f37..e873ecac5d0 100644 --- a/src/mame/drivers/kinst.c +++ b/src/mame/drivers/kinst.c @@ -362,7 +362,7 @@ READ32_MEMBER(kinst_state::kinst_control_r) case 4: /* $a0 */ result = ioport(portnames[offset])->read(); - if (cpu_get_pc(&space.device()) == 0x802d428) + if (space.device().safe_pc() == 0x802d428) device_spin_until_interrupt(&space.device()); break; } diff --git a/src/mame/drivers/koftball.c b/src/mame/drivers/koftball.c index 6054135a528..9501a2de8e1 100644 --- a/src/mame/drivers/koftball.c +++ b/src/mame/drivers/koftball.c @@ -137,7 +137,7 @@ READ16_MEMBER(koftball_state::prot_r) case 0x8000: return 0x0f0f; } - logerror("unk prot r %x %x\n",m_prot_data, cpu_get_previouspc(&space.device())); + logerror("unk prot r %x %x\n",m_prot_data, space.device().safe_pcbase()); return machine().rand(); } diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c index f1ecd4ac25d..986ddab8ac2 100644 --- a/src/mame/drivers/konamigv.c +++ b/src/mame/drivers/konamigv.c @@ -585,7 +585,7 @@ WRITE32_MEMBER(konamigv_state::btcflash_w) READ32_MEMBER(konamigv_state::btc_trackball_r) { -// mame_printf_debug( "r %08x %08x %08x\n", cpu_get_pc(&space.device()), offset, mem_mask ); +// mame_printf_debug( "r %08x %08x %08x\n", space.device().safe_pc(), offset, mem_mask ); if( offset == 1 && mem_mask == 0xffff0000 ) { @@ -608,7 +608,7 @@ READ32_MEMBER(konamigv_state::btc_trackball_r) WRITE32_MEMBER(konamigv_state::btc_trackball_w) { -// mame_printf_debug( "w %08x %08x %08x %08x\n", cpu_get_pc(&space.device()), offset, data, mem_mask ); +// mame_printf_debug( "w %08x %08x %08x %08x\n", space.device().safe_pc(), offset, data, mem_mask ); } DRIVER_INIT_MEMBER(konamigv_state,btchamp) diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c index c12d6c9deb7..d4496403f4d 100644 --- a/src/mame/drivers/konamigx.c +++ b/src/mame/drivers/konamigx.c @@ -482,7 +482,7 @@ WRITE32_MEMBER(konamigx_state::eeprom_w) */ konamigx_wrport1_1 = (data>>16)&0xff; -// logerror("write %x to IRQ register (PC=%x)\n", konamigx_wrport1_1, cpu_get_pc(&space.device())); +// logerror("write %x to IRQ register (PC=%x)\n", konamigx_wrport1_1, space.device().safe_pc()); // gx_syncen is to ensure each IRQ is trigger at least once after being enabled if (konamigx_wrport1_1 & 0x80) gx_syncen |= konamigx_wrport1_1 & 0x1f; @@ -546,7 +546,7 @@ READ32_MEMBER(konamigx_state::waitskip_r) { UINT32 data = gx_workram[waitskip.offs+offset]; - if (cpu_get_pc(&space.device()) == waitskip.pc && (data & mem_mask) == (waitskip.data & mem_mask)) + if (space.device().safe_pc() == waitskip.pc && (data & mem_mask) == (waitskip.data & mem_mask)) { device_spin_until_trigger(&space.device(), resume_trigger); suspension_active = 1; @@ -730,7 +730,7 @@ READ32_MEMBER(konamigx_state::sound020_r) rv |= LSW<<8; } -// mame_printf_debug("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device())); +// mame_printf_debug("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc()); // we clearly have some problem because some games require these hacks // perhaps 68000/68020 timing is skewed? @@ -740,43 +740,43 @@ READ32_MEMBER(konamigx_state::sound020_r) if (reg == 0) rv |= 0xff00; break; case 2: // Winning Spike - if (cpu_get_pc(&space.device()) == 0x2026fe) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x2026fe) rv = 0xc0c0c0c0; break; case 3: // Run'n Gun 2 - if (cpu_get_pc(&space.device()) == 0x24f0b6) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x24f122) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x24f0b6) rv = 0xffffffff; + if (space.device().safe_pc() == 0x24f122) rv = 0xc0c0c0c0; break; case 4: // Rushing Heroes - if (cpu_get_pc(&space.device()) == 0x20eda6) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x20eda6) rv = 0xc0c0c0c0; break; case 5: // Vs. Net Soccer ver. UAB - if (cpu_get_pc(&space.device()) == 0x24c5d2) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x24c63e) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x24c5d2) rv = 0xffffffff; + if (space.device().safe_pc() == 0x24c63e) rv = 0xc0c0c0c0; break; case 6: // Slam Dunk 2 - if (cpu_get_pc(&space.device()) == 0x24f1b0) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x24f21c) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x24f1b0) rv = 0xffffffff; + if (space.device().safe_pc() == 0x24f21c) rv = 0xc0c0c0c0; break; case 7: // Vs. Net Soccer ver. AAA - if (cpu_get_pc(&space.device()) == 0x24c6b6) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x24c722) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x24c6b6) rv = 0xffffffff; + if (space.device().safe_pc() == 0x24c722) rv = 0xc0c0c0c0; break; case 8: // Vs. Net Soccer ver. EAD - if (cpu_get_pc(&space.device()) == 0x24c416) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x24c482) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x24c416) rv = 0xffffffff; + if (space.device().safe_pc() == 0x24c482) rv = 0xc0c0c0c0; break; case 9: // Vs. Net Soccer ver. EAB - if (cpu_get_pc(&space.device()) == 0x24c400) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x24c46c) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x24c400) rv = 0xffffffff; + if (space.device().safe_pc() == 0x24c46c) rv = 0xc0c0c0c0; break; case 10: // Vs. Net Soccer ver. JAB - if (cpu_get_pc(&space.device()) == 0x24c584) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x24c5f0) rv = 0xc0c0c0c0; + if (space.device().safe_pc() == 0x24c584) rv = 0xffffffff; + if (space.device().safe_pc() == 0x24c5f0) rv = 0xc0c0c0c0; break; case 11: // Racin' Force if (reg == 0) { - if (cpu_get_pc(&space.device()) == 0x0202190) + if (space.device().safe_pc() == 0x0202190) rv |= 0x4000; } break; @@ -784,33 +784,33 @@ READ32_MEMBER(konamigx_state::sound020_r) case 12: // Open Golf / Golfing Greats 2 if (reg == 0) { - if ((cpu_get_pc(&space.device()) == 0x0245e80) || (cpu_get_pc(&space.device()) == 0x02459d6) || (cpu_get_pc(&space.device()) == 0x0245e40) ) + if ((space.device().safe_pc() == 0x0245e80) || (space.device().safe_pc() == 0x02459d6) || (space.device().safe_pc() == 0x0245e40) ) rv |= 0x4000; } break; case 13: // Soccer Superstars - //if(cpu_get_pc(&space.device()) != 0x236dce && cpu_get_pc(&space.device()) != 0x236d8a && cpu_get_pc(&space.device()) != 0x236d8a) - // printf("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device())); - if (cpu_get_pc(&space.device()) == 0x0236e04) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x0236e12) rv = 0xffffffff; + //if(space.device().safe_pc() != 0x236dce && space.device().safe_pc() != 0x236d8a && space.device().safe_pc() != 0x236d8a) + // printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc()); + if (space.device().safe_pc() == 0x0236e04) rv = 0xffffffff; + if (space.device().safe_pc() == 0x0236e12) rv = 0xffffffff; break; case 14: // Soccer Superstars ver. JAC - //if(cpu_get_pc(&space.device()) != 0x2367b4) - // printf("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device())); - if (cpu_get_pc(&space.device()) == 0x02367ea) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x02367f8) rv = 0xffffffff; + //if(space.device().safe_pc() != 0x2367b4) + // printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc()); + if (space.device().safe_pc() == 0x02367ea) rv = 0xffffffff; + if (space.device().safe_pc() == 0x02367f8) rv = 0xffffffff; break; case 15: // Soccer Superstars ver. JAA - //if(cpu_get_pc(&space.device()) != 0x23670a) - // printf("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device())); - if (cpu_get_pc(&space.device()) == 0x0236740) rv = 0xffffffff; - if (cpu_get_pc(&space.device()) == 0x023674e) rv = 0xffffffff; + //if(space.device().safe_pc() != 0x23670a) + // printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc()); + if (space.device().safe_pc() == 0x0236740) rv = 0xffffffff; + if (space.device().safe_pc() == 0x023674e) rv = 0xffffffff; break; case 16: // Dragoon Might ver. JAA { UINT32 cur_pc; - cur_pc = cpu_get_pc(&space.device()); + cur_pc = space.device().safe_pc(); switch(cur_pc) { @@ -1114,20 +1114,20 @@ WRITE32_MEMBER(konamigx_state::type4_prot_w) else if(last_prot_op == 0x515) // vsnetscr screen 1 { int adr; - //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, cpu_get_pc(&space.device())); + //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc()); for (adr = 0; adr < 0x400; adr += 2) space.write_word(0xc01c00+adr, space.read_word(0xc01800+adr)); } else if(last_prot_op == 0x115d) // vsnetscr screen 2 { int adr; - //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, cpu_get_pc(&space.device())); + //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc()); for (adr = 0; adr < 0x400; adr += 2) space.write_word(0xc18c00+adr, space.read_word(0xc18800+adr)); } else { - printf("GXT4: unknown protection command %x (PC=%x)\n", last_prot_op, cpu_get_pc(&space.device())); + printf("GXT4: unknown protection command %x (PC=%x)\n", last_prot_op, space.device().safe_pc()); } if (konamigx_wrport1_1 & 0x10) diff --git a/src/mame/drivers/konamim2.c b/src/mame/drivers/konamim2.c index df3139143d9..bb1bca71d1d 100644 --- a/src/mame/drivers/konamim2.c +++ b/src/mame/drivers/konamim2.c @@ -346,7 +346,7 @@ READ64_MEMBER(konamim2_state::unk3_r) READ64_MEMBER(konamim2_state::unk4_r) { UINT64 r = 0; -// logerror("unk4_r: %08X, %08X%08X at %08X\n", offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), cpu_get_pc(&space.device())); +// logerror("unk4_r: %08X, %08X%08X at %08X\n", offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), space.device().safe_pc()); if (ACCESSING_BITS_32_63) { @@ -363,13 +363,13 @@ READ64_MEMBER(konamim2_state::unk4_r) WRITE64_MEMBER(konamim2_state::unk4_w) { // logerror("unk4_w: %08X%08X, %08X, %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), -// offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), cpu_get_pc(&space.device())); +// offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), space.device().safe_pc()); if (ACCESSING_BITS_0_31) { if (data & 0x800000) { -// mame_printf_debug("CPU '%s': CPU1 IRQ at %08X\n", device().tag(), cpu_get_pc(&space.device())); +// mame_printf_debug("CPU '%s': CPU1 IRQ at %08X\n", device().tag(), space.device().safe_pc()); cputag_set_input_line(machine(), "sub", INPUT_LINE_IRQ0, ASSERT_LINE); } @@ -902,7 +902,7 @@ READ64_MEMBER(konamim2_state::cde_r) default: { -// mame_printf_debug("cde_r: %08X at %08X\n", reg*4, cpu_get_pc(&space.device())); +// mame_printf_debug("cde_r: %08X at %08X\n", reg*4, space.device().safe_pc()); break; } } @@ -936,7 +936,7 @@ WRITE64_MEMBER(konamim2_state::cde_w) { case 0x028/4: // Command write { - //printf("cde_w: %08X, %08X at %08X\n", d, reg*4, cpu_get_pc(&space.device())); + //printf("cde_w: %08X, %08X at %08X\n", d, reg*4, space.device().safe_pc()); if (d == 0x0180) { @@ -1064,7 +1064,7 @@ WRITE64_MEMBER(konamim2_state::cde_w) default: { -// mame_printf_debug("cde_w: %08X, %08X at %08X\n", d, reg*4, cpu_get_pc(&space.device())); +// mame_printf_debug("cde_w: %08X, %08X at %08X\n", d, reg*4, space.device().safe_pc()); break; } } diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 482a3ab8460..41012f3fa36 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -873,7 +873,7 @@ READ32_MEMBER(ksys573_state::atapi_r) break; } -// mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(&space.device())); +// mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, space.device().safe_pc()); data <<= shift; } @@ -1031,11 +1031,11 @@ WRITE32_MEMBER(ksys573_state::atapi_w) } atapi_regs[reg] = data; -// mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, cpu_get_pc(&space.device())); +// mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, space.device().safe_pc()); if (reg == ATAPI_REG_CMDSTATUS) { -// mame_printf_debug("ATAPI command %x issued! (PC=%x)\n", data, cpu_get_pc(&space.device())); +// mame_printf_debug("ATAPI command %x issued! (PC=%x)\n", data, space.device().safe_pc()); switch (data) { @@ -1246,7 +1246,7 @@ READ32_MEMBER(ksys573_state::flash_r) if( m_flash_bank < 0 ) { - mame_printf_debug( "%08x: flash_r( %08x, %08x ) no bank selected %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, m_control ); + mame_printf_debug( "%08x: flash_r( %08x, %08x ) no bank selected %08x\n", space.device().safe_pc(), offset, mem_mask, m_control ); data = 0xffffffff; } else @@ -1284,7 +1284,7 @@ WRITE32_MEMBER(ksys573_state::flash_w) if( m_flash_bank < 0 ) { - mame_printf_debug( "%08x: flash_w( %08x, %08x, %08x ) no bank selected %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, data, m_control ); + mame_printf_debug( "%08x: flash_w( %08x, %08x, %08x ) no bank selected %08x\n", space.device().safe_pc(), offset, mem_mask, data, m_control ); } else { @@ -2013,7 +2013,7 @@ READ32_MEMBER(ksys573_state::gx894pwbba_r) } verboselog( machine(), 2, "gx894pwbba_r( %08x, %08x ) %08x\n", offset, mem_mask, data ); -// printf( "%08x: gx894pwbba_r( %08x, %08x ) %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, data ); +// printf( "%08x: gx894pwbba_r( %08x, %08x ) %08x\n", space.device().safe_pc(), offset, mem_mask, data ); return data; } diff --git a/src/mame/drivers/ladybug.c b/src/mame/drivers/ladybug.c index 8f5ed2c3dee..c52c5d62503 100644 --- a/src/mame/drivers/ladybug.c +++ b/src/mame/drivers/ladybug.c @@ -119,7 +119,7 @@ WRITE8_MEMBER(ladybug_state::sraider_misc_w) m_sraider_0x38 = data&0x3f; break; default: - mame_printf_debug("(%04X) write to %02X\n", cpu_get_pc(&space.device()), offset); + mame_printf_debug("(%04X) write to %02X\n", space.device().safe_pc(), offset); break; } } diff --git a/src/mame/drivers/lastfght.c b/src/mame/drivers/lastfght.c index 7f855fc8ddd..004d159cd8a 100644 --- a/src/mame/drivers/lastfght.c +++ b/src/mame/drivers/lastfght.c @@ -210,11 +210,11 @@ WRITE16_MEMBER(lastfght_state::lastfght_hi_w) { if (ACCESSING_BITS_8_15) - logerror("%06x: 600000.b = %02x\n", cpu_get_pc(&space.device()), data >> 8); + logerror("%06x: 600000.b = %02x\n", space.device().safe_pc(), data >> 8); if (ACCESSING_BITS_0_7) { m_hi = data << 8; - //logerror("%06x: lastfght_hi = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%06x: lastfght_hi = %02x\n", space.device().safe_pc(), data); } } @@ -223,11 +223,11 @@ WRITE16_MEMBER(lastfght_state::lastfght_x_w) { if (ACCESSING_BITS_8_15) - logerror("%06x: 800008.b = %02x\n", cpu_get_pc(&space.device()), data >> 8); + logerror("%06x: 800008.b = %02x\n", space.device().safe_pc(), data >> 8); if (ACCESSING_BITS_0_7) { m_x = m_hi | data; - //logerror("%06x: lastfght_x = %02x\n", cpu_get_pc(&space.device()),data); + //logerror("%06x: lastfght_x = %02x\n", space.device().safe_pc(),data); } } @@ -238,12 +238,12 @@ WRITE16_MEMBER(lastfght_state::lastfght_yw_w) if (ACCESSING_BITS_8_15) { m_y = m_hi | (data >> 8); - //logerror("%06x: lastfght_y = %02x\n", cpu_get_pc(&space.device()), data >> 8); + //logerror("%06x: lastfght_y = %02x\n", space.device().safe_pc(), data >> 8); } if (ACCESSING_BITS_0_7) { m_w = m_hi | data; - //logerror("%06x: lastfght_w = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%06x: lastfght_w = %02x\n", space.device().safe_pc(), data); } } @@ -254,10 +254,10 @@ WRITE16_MEMBER(lastfght_state::lastfght_h_w) if (ACCESSING_BITS_8_15) { m_h = m_hi | (data >> 8); - //logerror("%06x: lastfght_h = %02x\n", cpu_get_pc(&space.device()), data >> 8); + //logerror("%06x: lastfght_h = %02x\n", space.device().safe_pc(), data >> 8); } if (ACCESSING_BITS_0_7) - logerror("%06x: 80000d.b = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: 80000d.b = %02x\n", space.device().safe_pc(), data); } // source delta x << 6, source x << 6 @@ -267,12 +267,12 @@ WRITE16_MEMBER(lastfght_state::lastfght_sx_w) if (ACCESSING_BITS_8_15) { m_dsx = m_hi | (data >> 8); - //logerror("%06x: lastfght_dsx = %02x\n", cpu_get_pc(&space.device()), data >> 8); + //logerror("%06x: lastfght_dsx = %02x\n", space.device().safe_pc(), data >> 8); } if (ACCESSING_BITS_0_7) { m_sx = m_hi | data; - //logerror("%06x: lastfght_sx = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%06x: lastfght_sx = %02x\n", space.device().safe_pc(), data); } } @@ -283,12 +283,12 @@ WRITE16_MEMBER(lastfght_state::lastfght_sy_w) if (ACCESSING_BITS_8_15) { m_sy = m_hi | (data >> 8); - //logerror("%06x: lastfght_sy = %02x\n", cpu_get_pc(&space.device()), data >> 8); + //logerror("%06x: lastfght_sy = %02x\n", space.device().safe_pc(), data >> 8); } if (ACCESSING_BITS_0_7) { m_sy1 = m_hi | data; - //logerror("%06x: lastfght_sy1 = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%06x: lastfght_sy1 = %02x\n", space.device().safe_pc(), data); } } @@ -299,12 +299,12 @@ WRITE16_MEMBER(lastfght_state::lastfght_sr_w) if (ACCESSING_BITS_8_15) { m_sp = (m_hi >> 8) >> 4; - //logerror("%06x: lastfght_sp = %02x\n", cpu_get_pc(&space.device()), data >> 8); + //logerror("%06x: lastfght_sp = %02x\n", space.device().safe_pc(), data >> 8); } if (ACCESSING_BITS_0_7) { m_sr = data; - //logerror("%06x: lastfght_sr = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%06x: lastfght_sr = %02x\n", space.device().safe_pc(), data); } } @@ -315,12 +315,12 @@ WRITE16_MEMBER(lastfght_state::lastfght_sd_w) if (ACCESSING_BITS_8_15) { m_sx1 = m_hi | (data >> 8); - //logerror("%06x: lastfght_sx1 = %02x\n", cpu_get_pc(&space.device()), data >> 8); + //logerror("%06x: lastfght_sx1 = %02x\n", space.device().safe_pc(), data >> 8); } if (ACCESSING_BITS_0_7) { m_dsy = m_hi | data; - //logerror("%06x: lastfght_dsy = %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%06x: lastfght_dsy = %02x\n", space.device().safe_pc(), data); } } @@ -335,7 +335,7 @@ WRITE16_MEMBER(lastfght_state::lastfght_blit_w) bitmap_ind16 &dest = m_bitmap[m_dest]; #if 0 - logerror("%06x: blit x %03x, y %03x, w %03x, h %03x, sx %03x.%02x, sx1 %03x.%02x, dsx %03x.%02x, sy %03x.%02x, sy1 %03x.%02x, dsy %03x.%02x, sp %02x, sr %02x, data %02x\n", cpu_get_pc(&space.device()), + logerror("%06x: blit x %03x, y %03x, w %03x, h %03x, sx %03x.%02x, sx1 %03x.%02x, dsx %03x.%02x, sy %03x.%02x, sy1 %03x.%02x, dsy %03x.%02x, sp %02x, sr %02x, data %02x\n", space.device().safe_pc(), m_x, m_y, m_w + 1, m_h + 1, m_sx >> 6, m_sx & 0x3f, m_sx1 >> 6, m_dsx & 0x3f, m_sx1 >> 6, m_sx1 & 0x3f, m_sy >> 6, m_sy & 0x3f, m_sy1 >> 6, m_dsy & 0x3f, m_sy1 >> 6, m_sy1 & 0x3f, @@ -359,7 +359,7 @@ WRITE16_MEMBER(lastfght_state::lastfght_blit_w) } } if (ACCESSING_BITS_0_7) - logerror("%06x: 600007.b = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: 600007.b = %02x\n", space.device().safe_pc(), data); } // toggle framebuffer @@ -415,9 +415,9 @@ READ16_MEMBER(lastfght_state::lastfght_sound_r) WRITE16_MEMBER(lastfght_state::lastfght_sound_w) { if (ACCESSING_BITS_8_15) - logerror("%06x: sound_w msb = %02x\n", cpu_get_pc(&space.device()), data >> 8); + logerror("%06x: sound_w msb = %02x\n", space.device().safe_pc(), data >> 8); if (ACCESSING_BITS_0_7) - logerror("%06x: sound_w lsb = %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: sound_w lsb = %02x\n", space.device().safe_pc(), data); } /*************************************************************************** diff --git a/src/mame/drivers/lethal.c b/src/mame/drivers/lethal.c index 78d46d83c14..11476703fe7 100644 --- a/src/mame/drivers/lethal.c +++ b/src/mame/drivers/lethal.c @@ -397,7 +397,7 @@ WRITE8_MEMBER(lethal_state::le_4800_w) break; default: - logerror("Unknown LE 48xx register write: %x to %x (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); + logerror("Unknown LE 48xx register write: %x to %x (PC=%x)\n", data, offset, space.device().safe_pc()); break; } } diff --git a/src/mame/drivers/liberate.c b/src/mame/drivers/liberate.c index 17403f24ec3..6154f93f9b0 100644 --- a/src/mame/drivers/liberate.c +++ b/src/mame/drivers/liberate.c @@ -42,13 +42,13 @@ READ8_MEMBER(liberate_state::deco16_bank_r) return m_spriteram[offset - 0x800]; if (offset < 0x2200) { - logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset); return 0; } if (offset < 0x2800) return m_scratchram[offset - 0x2200]; - logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset); return 0; } @@ -60,7 +60,7 @@ READ8_MEMBER(liberate_state::deco16_io_r) if (offset == 3) return ioport("DSW1")->read(); /* Dip 1 */ if (offset == 4) return ioport("DSW2")->read(); /* Dip 2 */ - logerror("%04x: Read input %d\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Read input %d\n", space.device().safe_pc(), offset); return 0xff; } @@ -93,13 +93,13 @@ READ8_MEMBER(liberate_state::prosoccr_bank_r) return m_spriteram[offset - 0xc00]; if (offset < 0x2200) { - logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset); return 0; } if (offset < 0x2800) return m_scratchram[offset - 0x2200]; - logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset); + logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset); return 0; } diff --git a/src/mame/drivers/littlerb.c b/src/mame/drivers/littlerb.c index 73abea4d104..3ea530e765e 100644 --- a/src/mame/drivers/littlerb.c +++ b/src/mame/drivers/littlerb.c @@ -345,7 +345,7 @@ static void littlerb_recalc_address(running_machine &machine) READ16_MEMBER(littlerb_state::littlerb_vdp_r) { - logerror("%06x littlerb_vdp_r offs %04x mask %04x (address %08x)\n", cpu_get_pc(&space.device()), offset, mem_mask, m_write_address); + logerror("%06x littlerb_vdp_r offs %04x mask %04x (address %08x)\n", space.device().safe_pc(), offset, mem_mask, m_write_address); UINT16 res = 0; switch (offset & 3) @@ -378,7 +378,7 @@ WRITE16_MEMBER(littlerb_state::littlerb_vdp_w) m_type2_writes = 0; } - if (LOG_VDP) logerror("%06x littlerb_vdp_w offs %04x data %04x mask %04x\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + if (LOG_VDP) logerror("%06x littlerb_vdp_w offs %04x data %04x mask %04x\n", space.device().safe_pc(), offset, data, mem_mask); } else { @@ -386,16 +386,16 @@ WRITE16_MEMBER(littlerb_state::littlerb_vdp_w) { if (m_type2_writes==0) { - if (LOG_VDP) logerror("data write started %06x %04x data %04x mask %04x\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + if (LOG_VDP) logerror("data write started %06x %04x data %04x mask %04x\n", space.device().safe_pc(), offset, data, mem_mask); } if (m_type2_writes==0) m_write_address_laststart = m_write_address; m_write_address_lastend = m_write_address; m_type2_writes++; - m_lasttype2pc = cpu_get_pc(&space.device()); + m_lasttype2pc = space.device().safe_pc(); } else { - if (LOG_VDP) logerror("xxx %06x littlerb_vdp_w offs %04x data %04x mask %04x\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + if (LOG_VDP) logerror("xxx %06x littlerb_vdp_w offs %04x data %04x mask %04x\n", space.device().safe_pc(), offset, data, mem_mask); } } diff --git a/src/mame/drivers/looping.c b/src/mame/drivers/looping.c index b2cf2211c8f..c6a72ed8aec 100644 --- a/src/mame/drivers/looping.c +++ b/src/mame/drivers/looping.c @@ -444,8 +444,8 @@ WRITE8_MEMBER(looping_state::ballon_enable_w) WRITE8_MEMBER(looping_state::out_0_w){ mame_printf_debug("out0 = %02X\n", data); } WRITE8_MEMBER(looping_state::out_2_w){ mame_printf_debug("out2 = %02X\n", data); } -READ8_MEMBER(looping_state::adc_r){ mame_printf_debug("%04X:ADC read\n", cpu_get_pc(&space.device())); return 0xff; } -WRITE8_MEMBER(looping_state::adc_w){ mame_printf_debug("%04X:ADC write = %02X\n", cpu_get_pc(&space.device()), data); } +READ8_MEMBER(looping_state::adc_r){ mame_printf_debug("%04X:ADC read\n", space.device().safe_pc()); return 0xff; } +WRITE8_MEMBER(looping_state::adc_w){ mame_printf_debug("%04X:ADC write = %02X\n", space.device().safe_pc(), data); } WRITE8_MEMBER(looping_state::plr2_w) { diff --git a/src/mame/drivers/lwings.c b/src/mame/drivers/lwings.c index 69a280db855..53047211d13 100644 --- a/src/mame/drivers/lwings.c +++ b/src/mame/drivers/lwings.c @@ -106,7 +106,7 @@ static INTERRUPT_GEN( avengers_interrupt ) WRITE8_MEMBER(lwings_state::avengers_protection_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (pc == 0x2eeb) { @@ -238,7 +238,7 @@ READ8_MEMBER(lwings_state::avengers_protection_r) int x, y; int dx, dy, dist, dir; - if (cpu_get_pc(&space.device()) == 0x7c7) + if (space.device().safe_pc() == 0x7c7) { /* palette data */ return avengers_fetch_paldata(machine()); diff --git a/src/mame/drivers/m107.c b/src/mame/drivers/m107.c index 923cd0292ce..ba02507d841 100644 --- a/src/mame/drivers/m107.c +++ b/src/mame/drivers/m107.c @@ -85,7 +85,7 @@ WRITE16_MEMBER(m107_state::m107_bankswitch_w) { membank("bank1")->set_entry((data & 0x06) >> 1); if (data & 0xf9) - logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space.device()), data); + logerror("%05x: bankswitch %04x\n", space.device().safe_pc(), data); } } diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c index cad22372d10..f4a12b0966e 100644 --- a/src/mame/drivers/m92.c +++ b/src/mame/drivers/m92.c @@ -253,14 +253,14 @@ static TIMER_DEVICE_CALLBACK( m92_scanline_interrupt ) READ16_MEMBER(m92_state::m92_eeprom_r) { UINT8 *RAM = memregion("eeprom")->base(); -// logerror("%05x: EEPROM RE %04x\n",cpu_get_pc(&space.device()),offset); +// logerror("%05x: EEPROM RE %04x\n",space.device().safe_pc(),offset); return RAM[offset] | 0xff00; } WRITE16_MEMBER(m92_state::m92_eeprom_w) { UINT8 *RAM = memregion("eeprom")->base(); -// logerror("%05x: EEPROM WR %04x\n",cpu_get_pc(&space.device()),offset); +// logerror("%05x: EEPROM WR %04x\n",space.device().safe_pc(),offset); if (ACCESSING_BITS_0_7) RAM[offset] = data; } @@ -283,7 +283,7 @@ WRITE16_MEMBER(m92_state::m92_bankswitch_w) { membank("bank1")->set_entry((data & 0x06) >> 1); if (data & 0xf9) - logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space.device()), data); + logerror("%05x: bankswitch %04x\n", space.device().safe_pc(), data); } } @@ -304,7 +304,7 @@ WRITE16_MEMBER(m92_state::m92_soundlatch_w) READ16_MEMBER(m92_state::m92_sound_status_r) { -//logerror("%06x: read sound status\n",cpu_get_pc(&space.device())); +//logerror("%06x: read sound status\n",space.device().safe_pc()); return m_sound_status; } diff --git a/src/mame/drivers/macrossp.c b/src/mame/drivers/macrossp.c index 9eca06cc656..14f014c1d2b 100644 --- a/src/mame/drivers/macrossp.c +++ b/src/mame/drivers/macrossp.c @@ -320,7 +320,7 @@ WRITE32_MEMBER(macrossp_state::paletteram32_macrossp_w) READ32_MEMBER(macrossp_state::macrossp_soundstatus_r) { - // logerror("%08x read soundstatus\n", cpu_get_pc(&space.device())); + // logerror("%08x read soundstatus\n", space.device().safe_pc()); /* bit 1 is sound status */ /* bit 0 unknown - it is expected to toggle, vblank? */ @@ -335,7 +335,7 @@ WRITE32_MEMBER(macrossp_state::macrossp_soundcmd_w) if (ACCESSING_BITS_16_31) { - //logerror("%08x write soundcmd %08x (%08x)\n",cpu_get_pc(&space.device()),data,mem_mask); + //logerror("%08x write soundcmd %08x (%08x)\n",space.device().safe_pc(),data,mem_mask); soundlatch_word_w(space, 0, data >> 16, 0xffff); m_sndpending = 1; device_set_input_line(m_audiocpu, 2, HOLD_LINE); @@ -347,7 +347,7 @@ WRITE32_MEMBER(macrossp_state::macrossp_soundcmd_w) READ16_MEMBER(macrossp_state::macrossp_soundcmd_r) { - // logerror("%06x read soundcmd\n",cpu_get_pc(&space.device())); + // logerror("%06x read soundcmd\n",space.device().safe_pc()); m_sndpending = 0; return soundlatch_word_r(space, offset, mem_mask); } @@ -770,7 +770,7 @@ PC :00018110 018110: beq 18104 */ COMBINE_DATA(&m_mainram[0x10158 / 4]); - if (cpu_get_pc(&space.device()) == 0x001810A) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc() == 0x001810A) device_spin_until_interrupt(&space.device()); } #ifdef UNUSED_FUNCTION @@ -778,7 +778,7 @@ WRITE32_MEMBER(macrossp_state::quizmoon_speedup_w) { COMBINE_DATA(&m_mainram[0x00020 / 4]); - if (cpu_get_pc(&space.device()) == 0x1cc) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc() == 0x1cc) device_spin_until_interrupt(&space.device()); } #endif diff --git a/src/mame/drivers/macs.c b/src/mame/drivers/macs.c index fbc6b0dedee..7fd8b8d7a4d 100644 --- a/src/mame/drivers/macs.c +++ b/src/mame/drivers/macs.c @@ -131,7 +131,7 @@ READ8_MEMBER(macs_state::macs_input_r) case 5: return ioport("DSW3")->read(); case 6: return ioport("DSW4")->read(); case 7: return ioport("SYS1")->read(); - default: popmessage("Unmapped I/O read at PC = %06x offset = %02x",cpu_get_pc(&space.device()),offset+0xc0); + default: popmessage("Unmapped I/O read at PC = %06x offset = %02x",space.device().safe_pc(),offset+0xc0); } return 0xff; diff --git a/src/mame/drivers/mainevt.c b/src/mame/drivers/mainevt.c index aa0d8e10996..9da494c34a6 100644 --- a/src/mame/drivers/mainevt.c +++ b/src/mame/drivers/mainevt.c @@ -110,7 +110,7 @@ WRITE8_MEMBER(mainevt_state::mainevt_sh_bankswitch_w) { int bank_A, bank_B; -//logerror("CPU #1 PC: %04x bank switch = %02x\n",cpu_get_pc(&space.device()),data); +//logerror("CPU #1 PC: %04x bank switch = %02x\n",space.device().safe_pc(),data); /* bits 0-3 select the 007232 banks */ bank_A = (data & 0x3); @@ -126,7 +126,7 @@ WRITE8_MEMBER(mainevt_state::dv_sh_bankswitch_w) device_t *device = machine().device("k007232"); int bank_A, bank_B; -//logerror("CPU #1 PC: %04x bank switch = %02x\n",cpu_get_pc(&space->device()),data); +//logerror("CPU #1 PC: %04x bank switch = %02x\n",space->device().safe_pc(),data); /* bits 0-3 select the 007232 banks */ bank_A = (data & 0x3); diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c index 92ce4a5271c..531cdf792a8 100644 --- a/src/mame/drivers/malzak.c +++ b/src/mame/drivers/malzak.c @@ -152,7 +152,7 @@ WRITE8_MEMBER(malzak_state::port40_w) // Bits 1-3 are all set high upon death, until the game continues // Bit 6 is used only in Malzak II, and is set high after checking // the selected version -// logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n", cpu_get_pc(machine().device("maincpu")), data); +// logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n", machine().device("maincpu")->safe_pc(), data); membank("bank1")->set_entry((data & 0x40) >> 6); } diff --git a/src/mame/drivers/mcr.c b/src/mame/drivers/mcr.c index 1b7a90fe749..fe229ac3e95 100644 --- a/src/mame/drivers/mcr.c +++ b/src/mame/drivers/mcr.c @@ -569,8 +569,8 @@ READ8_MEMBER(mcr_state::nflfoot_ip2_r) nflfoot_serial_in_active = FALSE; } - if (cpu_get_pc(&space.device()) != 0x107) - logerror("%04X:ip2_r = %02X\n", cpu_get_pc(&space.device()), val); + if (space.device().safe_pc() != 0x107) + logerror("%04X:ip2_r = %02X\n", space.device().safe_pc(), val); return val; } @@ -580,7 +580,7 @@ WRITE8_MEMBER(mcr_state::nflfoot_op4_w) z80sio_device *sio = machine().device("ipu_sio"); /* bit 7 = J3-7 on IPU board = /RXDA on SIO */ - logerror("%04X:op4_w(%d%d%d)\n", cpu_get_pc(&space.device()), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1); + logerror("%04X:op4_w(%d%d%d)\n", space.device().safe_pc(), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1); /* look for a non-zero start bit to go active */ if (!nflfoot_serial_out_active && (data & 0x80)) diff --git a/src/mame/drivers/mcr3.c b/src/mame/drivers/mcr3.c index b3b63103917..4f3eca5a10c 100644 --- a/src/mame/drivers/mcr3.c +++ b/src/mame/drivers/mcr3.c @@ -460,7 +460,7 @@ READ8_MEMBER(mcr3_state::turbotag_kludge_r) /* Unfortunately, the game refuses to start if any bad ROM is */ /* found; to work around this, we catch the checksum byte read */ /* and modify it to what we know we will be getting. */ - if (cpu_get_previouspc(&space.device()) == 0xb29) + if (space.device().safe_pcbase() == 0xb29) return 0x82; else return 0x92; diff --git a/src/mame/drivers/mcr68.c b/src/mame/drivers/mcr68.c index cec7259e265..f1ff7258984 100644 --- a/src/mame/drivers/mcr68.c +++ b/src/mame/drivers/mcr68.c @@ -228,7 +228,7 @@ WRITE16_MEMBER(mcr68_state::pigskin_protection_w) m_protection_data[3] = m_protection_data[4]; m_protection_data[4] = data & 0xff; - logerror("%06X:protection_w=%02X\n", cpu_get_previouspc(&space.device()), data & 0xff); + logerror("%06X:protection_w=%02X\n", space.device().safe_pcbase(), data & 0xff); } } diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index de0f3ea30a8..3f9cbccd683 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -596,7 +596,7 @@ READ32_MEMBER(mediagx_state::parallel_port_r) { UINT8 nibble = m_parallel_latched;//(ioport(m_portnames[m_parallel_pointer / 3])->read_safe(0) >> (4 * (m_parallel_pointer % 3))) & 15; r |= ((~nibble & 0x08) << 12) | ((nibble & 0x07) << 11); - logerror("%08X:parallel_port_r()\n", cpu_get_pc(&space.device())); + logerror("%08X:parallel_port_r()\n", space.device().safe_pc()); #if 0 if (m_controls_data == 0x18) { @@ -645,7 +645,7 @@ WRITE32_MEMBER(mediagx_state::parallel_port_w) 7x..ff = advance pointer */ - logerror("%08X:", cpu_get_pc(&space.device())); + logerror("%08X:", space.device().safe_pc()); m_parallel_latched = (ioport(portnames[m_parallel_pointer / 3])->read_safe(0) >> (4 * (m_parallel_pointer % 3))) & 15; //parallel_pointer++; @@ -1266,7 +1266,7 @@ INLINE UINT32 generic_speedup(address_space *space, int idx) { mediagx_state *state = space->machine().driver_data(); - if (cpu_get_pc(&space->device()) == state->m_speedup_table[idx].pc) + if (space->device().safe_pc() == state->m_speedup_table[idx].pc) { state->m_speedup_hits[idx]++; device_spin_until_interrupt(&space->device()); diff --git a/src/mame/drivers/megadrvb.c b/src/mame/drivers/megadrvb.c index 2b2ac22bd67..2959ae7eb0b 100644 --- a/src/mame/drivers/megadrvb.c +++ b/src/mame/drivers/megadrvb.c @@ -273,13 +273,13 @@ static WRITE16_HANDLER( aladmdb_w ) - aladmdb_w : 1b2d18 - data = aa00 (only once on reset) - aladmdb_w : 1b2d42 - data = 0000 (only once on reset) */ - logerror("aladmdb_w : %06x - data = %04x\n",cpu_get_pc(&space->device()),data); + logerror("aladmdb_w : %06x - data = %04x\n",space->device().safe_pc(),data); } static READ16_HANDLER( aladmdb_r ) { md_boot_state *state = space->machine().driver_data(); - if (cpu_get_pc(&space->device())==0x1b2a56) + if (space->device().safe_pc()==0x1b2a56) { state->m_aladmdb_mcu_port = state->ioport("MCU")->read(); @@ -288,11 +288,11 @@ static READ16_HANDLER( aladmdb_r ) else return (0x100); //MCU status, needed if you fall into a pitfall } - if (cpu_get_pc(&space->device())==0x1b2a72) return 0x0000; - if (cpu_get_pc(&space->device())==0x1b2d24) return (space->machine().root_device().ioport("MCU")->read() & 0x00f0) | 0x1200; // difficulty - if (cpu_get_pc(&space->device())==0x1b2d4e) return 0x0000; + if (space->device().safe_pc()==0x1b2a72) return 0x0000; + if (space->device().safe_pc()==0x1b2d24) return (space->machine().root_device().ioport("MCU")->read() & 0x00f0) | 0x1200; // difficulty + if (space->device().safe_pc()==0x1b2d4e) return 0x0000; - logerror("aladbl_r : %06x\n",cpu_get_pc(&space->device())); + logerror("aladbl_r : %06x\n",space->device().safe_pc()); return 0x0000; } diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c index 2bc97c0904a..6d83407f8b4 100644 --- a/src/mame/drivers/megaplay.c +++ b/src/mame/drivers/megaplay.c @@ -573,7 +573,7 @@ static WRITE8_HANDLER( megaplay_game_w ) state->m_bios_mode = MP_GAME; state->m_readpos = 1; // popmessage("Game bank selected: 0x%03x", state->m_game_banksel); - logerror("BIOS [0x%04x]: 68K address space bank selected: 0x%03x\n", cpu_get_previouspc(&space->device()), state->m_game_banksel); + logerror("BIOS [0x%04x]: 68K address space bank selected: 0x%03x\n", space->device().safe_pcbase(), state->m_game_banksel); } state->m_mp_bios_bank_addr = ((state->m_mp_bios_bank_addr >> 1) | (data << 23)) & 0xff8000; diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c index 30b50d48738..beb08cab351 100644 --- a/src/mame/drivers/meritm.c +++ b/src/mame/drivers/meritm.c @@ -472,7 +472,7 @@ static void meritm_switch_banks( running_machine &machine ) WRITE8_MEMBER(meritm_state::meritm_psd_a15_w) { m_psd_a15 = data; - //logerror( "Writing PSD_A15 with %02x at PC=%04X\n", data, cpu_get_pc(&space.device()) ); + //logerror( "Writing PSD_A15 with %02x at PC=%04X\n", data, space.device().safe_pc() ); meritm_switch_banks(machine()); }; diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c index c3c8b43b3c8..fb5fa2fe821 100644 --- a/src/mame/drivers/metro.c +++ b/src/mame/drivers/metro.c @@ -174,7 +174,7 @@ static IRQ_CALLBACK( metro_irq_callback ) WRITE16_MEMBER(metro_state::metro_irq_cause_w) { - //if (data & ~0x15) logerror("CPU #0 PC %06X : unknown bits of irqcause written: %04X\n", cpu_get_pc(&space.device()), data); + //if (data & ~0x15) logerror("CPU #0 PC %06X : unknown bits of irqcause written: %04X\n", space.device().safe_pc(), data); if (ACCESSING_BITS_0_7) { @@ -477,14 +477,14 @@ WRITE16_MEMBER(metro_state::metro_coin_lockout_1word_w) // coin_lockout_w(machine(), 0, data & 1); // coin_lockout_w(machine(), 1, data & 2); } - if (data & ~3) logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~3) logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", space.device().safe_pc(), data); } WRITE16_MEMBER(metro_state::metro_coin_lockout_4words_w) { // coin_lockout_w(machine(), (offset >> 1) & 1, offset & 1); - if (data & ~1) logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~1) logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", space.device().safe_pc(), data); } @@ -608,7 +608,7 @@ WRITE16_MEMBER(metro_state::metro_blitter_w) int shift = (dst_offs & 0x80) ? 0 : 8; UINT16 mask = (dst_offs & 0x80) ? 0x00ff : 0xff00; -// logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", cpu_get_pc(&space.device()), tmap, src_offs, dst_offs); +// logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", space.device().safe_pc(), tmap, src_offs, dst_offs); dst_offs >>= 7 + 1; switch (tmap) @@ -618,7 +618,7 @@ WRITE16_MEMBER(metro_state::metro_blitter_w) case 3: break; default: - logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", cpu_get_pc(&space.device()), tmap); + logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", space.device().safe_pc(), tmap); return; } @@ -628,7 +628,7 @@ WRITE16_MEMBER(metro_state::metro_blitter_w) src_offs %= src_len; b1 = blt_read(src, src_offs); -// logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", cpu_get_pc(&space.device()), b1, src_offs); +// logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", space.device().safe_pc(), b1, src_offs); src_offs++; count = ((~b1) & 0x3f) + 1; @@ -704,7 +704,7 @@ WRITE16_MEMBER(metro_state::metro_blitter_w) break; default: - logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n",cpu_get_pc(&space.device()),b1,src_offs-1); + logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n",space.device().safe_pc(),b1,src_offs-1); return; } @@ -781,7 +781,7 @@ READ16_MEMBER(metro_state::balcube_dsw_r) case 0x17FFE: return BIT(dsw2, 6) ? 0x40 : 0; case 0x0FFFE: return BIT(dsw2, 7) ? 0x40 : 0; } - logerror("CPU #0 PC %06X : unknown dsw address read: %04X\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06X : unknown dsw address read: %04X\n", space.device().safe_pc(), offset); return 0xffff; } diff --git a/src/mame/drivers/midqslvr.c b/src/mame/drivers/midqslvr.c index 9bdc9f06a0b..55d1224ea55 100644 --- a/src/mame/drivers/midqslvr.c +++ b/src/mame/drivers/midqslvr.c @@ -273,7 +273,7 @@ static UINT8 piix4_config_r(device_t *busdevice, device_t *device, int function, return (((class_code_val[function]) >> (reg & 3)*8) & 0xff); } - printf("%08x PIIX4: read %d, %02X\n", cpu_get_pc(&space->device()), function, reg); + printf("%08x PIIX4: read %d, %02X\n", space->device().safe_pc(), function, reg); return state->m_piix4_config_reg[function][reg]; } diff --git a/src/mame/drivers/midvunit.c b/src/mame/drivers/midvunit.c index 873b0bc2868..31664f4be6a 100644 --- a/src/mame/drivers/midvunit.c +++ b/src/mame/drivers/midvunit.c @@ -253,13 +253,13 @@ READ32_MEMBER(midvunit_state::tms32031_control_r) /* timer is clocked at 100ns */ int which = (offset >> 4) & 1; INT32 result = (m_timer[which]->time_elapsed() * m_timer_rate).as_double(); -// logerror("%06X:tms32031_control_r(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, result); +// logerror("%06X:tms32031_control_r(%02X) = %08X\n", space.device().safe_pc(), offset, result); return result; } /* log anything else except the memory control register */ if (offset != 0x64) - logerror("%06X:tms32031_control_r(%02X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:tms32031_control_r(%02X)\n", space.device().safe_pc(), offset); return m_tms32031_control[offset]; } @@ -277,7 +277,7 @@ WRITE32_MEMBER(midvunit_state::tms32031_control_w) else if (offset == 0x20 || offset == 0x30) { int which = (offset >> 4) & 1; -// logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data); +// logerror("%06X:tms32031_control_w(%02X) = %08X\n", space.device().safe_pc(), offset, data); if (data & 0x40) m_timer[which]->reset(); @@ -288,7 +288,7 @@ WRITE32_MEMBER(midvunit_state::tms32031_control_w) m_timer_rate = 10000000.; } else - logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:tms32031_control_w(%02X) = %08X\n", space.device().safe_pc(), offset, data); } @@ -409,7 +409,7 @@ READ32_MEMBER(midvunit_state::midvplus_misc_r) } if (offset != 0 && offset != 3) - logerror("%06X:midvplus_misc_r(%d) = %08X\n", cpu_get_pc(&space.device()), offset, result); + logerror("%06X:midvplus_misc_r(%d) = %08X\n", space.device().safe_pc(), offset, result); return result; } @@ -438,7 +438,7 @@ WRITE32_MEMBER(midvunit_state::midvplus_misc_w) } if (logit) - logerror("%06X:midvplus_misc_w(%d) = %08X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:midvplus_misc_w(%d) = %08X\n", space.device().safe_pc(), offset, data); } diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index e4f5bfa00b3..ccb55d40783 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -134,7 +134,7 @@ WRITE32_MEMBER(midzeus_state::cmos_w) if (bitlatch[2] && !cmos_protected) COMBINE_DATA(&m_nvram[offset]); else - logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", cpu_get_pc(&space.device()), bitlatch[2], cmos_protected); + logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", space.device().safe_pc(), bitlatch[2], cmos_protected); cmos_protected = TRUE; } @@ -188,7 +188,7 @@ WRITE32_MEMBER(midzeus_state::zpram_w) if (bitlatch[2]) COMBINE_DATA(&m_nvram[offset]); else - logerror("%06X:zpram_w with bitlatch[2] = %d\n", cpu_get_pc(&space.device()), bitlatch[2]); + logerror("%06X:zpram_w with bitlatch[2] = %d\n", space.device().safe_pc(), bitlatch[2]); } @@ -229,7 +229,7 @@ READ32_MEMBER(midzeus_state::bitlatches_r) /* unknown purpose */ default: - logerror("%06X:bitlatches_r(%X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:bitlatches_r(%X)\n", space.device().safe_pc(), offset); break; } return ~0; @@ -246,19 +246,19 @@ WRITE32_MEMBER(midzeus_state::bitlatches_w) /* unknown purpose */ default: if (oldval ^ data) - logerror("%06X:bitlatches_w(%X) = %X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:bitlatches_w(%X) = %X\n", space.device().safe_pc(), offset, data); break; /* unknown purpose; crusnexo toggles this between 0 and 1 every 20 frames; thegrid writes 1 */ case 0: if (data != 0 && data != 1) - logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data); break; /* unknown purpose; mk4/invasn write 1 here at initialization; crusnexo/thegrid write 3 */ case 1: if (data != 1 && data != 3) - logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data); break; /* CMOS/ZPRAM extra enable latch; only low bit is used */ @@ -268,7 +268,7 @@ WRITE32_MEMBER(midzeus_state::bitlatches_w) /* unknown purpose; invasn writes 2 here at startup */ case 4: if (data != 2) - logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data); break; /* ROM bank selection on Zeus 2 */ @@ -279,19 +279,19 @@ WRITE32_MEMBER(midzeus_state::bitlatches_w) /* unknown purpose; crusnexo/thegrid write 1 at startup */ case 7: if (data != 1) - logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data); break; /* unknown purpose; crusnexo writes 4 at startup; thegrid writes 6 */ case 8: if (data != 4 && data != 6) - logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data); break; /* unknown purpose; thegrid writes 1 at startup */ case 9: if (data != 1) - logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data); break; } } @@ -357,7 +357,7 @@ WRITE32_MEMBER(midzeus_state::crusnexo_leds_w) READ32_MEMBER(midzeus_state::linkram_r) { - logerror("%06X:unknown_8a000_r(%02X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:unknown_8a000_r(%02X)\n", space.device().safe_pc(), offset); if (offset == 0) return 0x30313042; else if (offset == 0x3c) @@ -367,7 +367,7 @@ READ32_MEMBER(midzeus_state::linkram_r) WRITE32_MEMBER(midzeus_state::linkram_w) { - logerror("%06X:unknown_8a000_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:unknown_8a000_w(%02X) = %08X\n", space.device().safe_pc(), offset, data); COMBINE_DATA(&linkram[offset]); } @@ -392,7 +392,7 @@ READ32_MEMBER(midzeus_state::tms32031_control_r) /* log anything else except the memory control register */ if (offset != 0x64) - logerror("%06X:tms32031_control_r(%02X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:tms32031_control_r(%02X)\n", space.device().safe_pc(), offset); return tms32031_control[offset]; } @@ -414,7 +414,7 @@ WRITE32_MEMBER(midzeus_state::tms32031_control_w) timer[which]->adjust(attotime::never); } else - logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%06X:tms32031_control_w(%02X) = %08X\n", space.device().safe_pc(), offset, data); } @@ -465,7 +465,7 @@ READ32_MEMBER(midzeus_state::analog_r) { static const char * const tags[] = { "ANALOG0", "ANALOG1", "ANALOG2", "ANALOG3" }; if (offset < 8 || offset > 11) - logerror("%06X:analog_r(%X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:analog_r(%X)\n", space.device().safe_pc(), offset); return ioport(tags[offset & 3])->read(); } diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index 1bd8a557705..d31b7d11c09 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -555,7 +555,7 @@ static MACHINE_RESET( missile ) INLINE int get_madsel(address_space *space) { missile_state *state = space->machine().driver_data(); - UINT16 pc = cpu_get_previouspc(&space->device()); + UINT16 pc = space->device().safe_pcbase(); /* if we're at a different instruction than last time, reset our delay counter */ if (pc != state->m_madsel_lastpc) @@ -766,7 +766,7 @@ WRITE8_MEMBER(missile_state::missile_w) /* anything else */ else - logerror("%04X:Unknown write to %04X = %02X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%04X:Unknown write to %04X = %02X\n", space.device().safe_pc(), offset, data); } @@ -821,7 +821,7 @@ READ8_MEMBER(missile_state::missile_r) /* anything else */ else - logerror("%04X:Unknown read from %04X\n", cpu_get_pc(&space.device()), offset); + logerror("%04X:Unknown read from %04X\n", space.device().safe_pc(), offset); return result; } diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c index e8825829648..386d50ef7e7 100644 --- a/src/mame/drivers/mitchell.c +++ b/src/mame/drivers/mitchell.c @@ -280,7 +280,7 @@ WRITE8_MEMBER(mitchell_state::input_w) { case 0: default: - logerror("PC %04x: write %02x to port 01\n", cpu_get_pc(&space.device()), data); + logerror("PC %04x: write %02x to port 01\n", space.device().safe_pc(), data); break; case 1: mahjong_input_select_w(space, offset, data); diff --git a/src/mame/drivers/mjkjidai.c b/src/mame/drivers/mjkjidai.c index bad7c32e8f4..0cbf5902b5f 100644 --- a/src/mame/drivers/mjkjidai.c +++ b/src/mame/drivers/mjkjidai.c @@ -164,7 +164,7 @@ READ8_MEMBER(mjkjidai_state::keyboard_r) int res = 0x3f,i; static const char *const keynames[] = { "PL2_1", "PL2_2", "PL2_3", "PL2_4", "PL2_5", "PL2_6", "PL1_1", "PL1_2", "PL1_3", "PL1_4", "PL1_5", "PL1_6" }; -// logerror("%04x: keyboard_r\n", cpu_get_pc(&space.device())); +// logerror("%04x: keyboard_r\n", space.device().safe_pc()); for (i = 0; i < 12; i++) { @@ -189,7 +189,7 @@ READ8_MEMBER(mjkjidai_state::keyboard_r) WRITE8_MEMBER(mjkjidai_state::keyboard_select_w) { -// logerror("%04x: keyboard_select %d = %02x\n",cpu_get_pc(&space.device()),offset,data); +// logerror("%04x: keyboard_select %d = %02x\n",space.device().safe_pc(),offset,data); switch (offset) { diff --git a/src/mame/drivers/mjsister.c b/src/mame/drivers/mjsister.c index da4cfbfcbba..75c0cbf315d 100644 --- a/src/mame/drivers/mjsister.c +++ b/src/mame/drivers/mjsister.c @@ -218,7 +218,7 @@ WRITE8_MEMBER(mjsister_state::mjsister_banksel1_w) case 0xf: m_vrambank = 1 ; break; default: - logerror("%04x p30_w:%02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x p30_w:%02x\n", space.device().safe_pc(), data); } if (tmp != m_colorbank) @@ -239,7 +239,7 @@ WRITE8_MEMBER(mjsister_state::mjsister_banksel2_w) case 0xd: m_rombank1 = 1; break; default: - logerror("%04x p31_w:%02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x p31_w:%02x\n", space.device().safe_pc(), data); } membank("bank1")->set_entry(m_rombank0 * 2 + m_rombank1); diff --git a/src/mame/drivers/model1.c b/src/mame/drivers/model1.c index 600f1b9f462..2cbf710fa49 100644 --- a/src/mame/drivers/model1.c +++ b/src/mame/drivers/model1.c @@ -797,7 +797,7 @@ WRITE16_MEMBER(model1_state::md1_w) if(0 && offset) return; if(1 && m_dump) - logerror("TGP: md1_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device())); + logerror("TGP: md1_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc()); } WRITE16_MEMBER(model1_state::md0_w) @@ -806,7 +806,7 @@ WRITE16_MEMBER(model1_state::md0_w) if(0 && offset) return; if(1 && m_dump) - logerror("TGP: md0_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device())); + logerror("TGP: md0_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc()); } WRITE16_MEMBER(model1_state::p_w) @@ -814,14 +814,14 @@ WRITE16_MEMBER(model1_state::p_w) UINT16 old = m_generic_paletteram_16[offset]; paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask); if(0 && m_generic_paletteram_16[offset] != old) - logerror("XVIDEO: p_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device())); + logerror("XVIDEO: p_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc()); } WRITE16_MEMBER(model1_state::mr_w) { COMBINE_DATA(m_mr+offset); if(0 && offset == 0x1138/2) - logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x500000, data, mem_mask, cpu_get_pc(&space.device())); + logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x500000, data, mem_mask, space.device().safe_pc()); } WRITE16_MEMBER(model1_state::mr2_w) @@ -829,23 +829,23 @@ WRITE16_MEMBER(model1_state::mr2_w) COMBINE_DATA(m_mr2+offset); #if 0 if(0 && offset == 0x6e8/2) { - logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x400000, data, mem_mask, cpu_get_pc(&space.device())); + logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x400000, data, mem_mask, space.device().safe_pc()); } if(offset/2 == 0x3680/4) - logerror("MW f80[r25], %04x%04x (%x)\n", m_mr2[0x3680/2+1], m_mr2[0x3680/2], cpu_get_pc(&space.device())); + logerror("MW f80[r25], %04x%04x (%x)\n", m_mr2[0x3680/2+1], m_mr2[0x3680/2], space.device().safe_pc()); if(offset/2 == 0x06ca/4) - logerror("MW fca[r19], %04x%04x (%x)\n", m_mr2[0x06ca/2+1], m_mr2[0x06ca/2], cpu_get_pc(&space.device())); + logerror("MW fca[r19], %04x%04x (%x)\n", m_mr2[0x06ca/2+1], m_mr2[0x06ca/2], space.device().safe_pc()); if(offset/2 == 0x1eca/4) - logerror("MW fca[r22], %04x%04x (%x)\n", m_mr2[0x1eca/2+1], m_mr2[0x1eca/2], cpu_get_pc(&space.device())); + logerror("MW fca[r22], %04x%04x (%x)\n", m_mr2[0x1eca/2+1], m_mr2[0x1eca/2], space.device().safe_pc()); #endif // wingwar scene position, pc=e1ce -> d735 if(offset/2 == 0x1f08/4) - logerror("MW 8[r10], %f (%x)\n", *(float *)(m_mr2+0x1f08/2), cpu_get_pc(&space.device())); + logerror("MW 8[r10], %f (%x)\n", *(float *)(m_mr2+0x1f08/2), space.device().safe_pc()); if(offset/2 == 0x1f0c/4) - logerror("MW c[r10], %f (%x)\n", *(float *)(m_mr2+0x1f0c/2), cpu_get_pc(&space.device())); + logerror("MW c[r10], %f (%x)\n", *(float *)(m_mr2+0x1f0c/2), space.device().safe_pc()); if(offset/2 == 0x1f10/4) - logerror("MW 10[r10], %f (%x)\n", *(float *)(m_mr2+0x1f10/2), cpu_get_pc(&space.device())); + logerror("MW 10[r10], %f (%x)\n", *(float *)(m_mr2+0x1f10/2), space.device().safe_pc()); } READ16_MEMBER(model1_state::snd_68k_ready_r) diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c index c1a593d4c37..806f6883c91 100644 --- a/src/mame/drivers/model2.c +++ b/src/mame/drivers/model2.c @@ -119,7 +119,7 @@ static int copro_fifoin_pop(device_t *device, UINT32 *result) if (state->m_dsp_type == DSP_TYPE_TGP) return 0; - fatalerror("Copro FIFOIN underflow (at %08X)\n", cpu_get_pc(device)); + fatalerror("Copro FIFOIN underflow (at %08X)\n", device->safe_pc()); return 0; } @@ -153,11 +153,11 @@ static void copro_fifoin_push(device_t *device, UINT32 data) model2_state *state = device->machine().driver_data(); if (state->m_copro_fifoin_num == COPRO_FIFOIN_SIZE) { - fatalerror("Copro FIFOIN overflow (at %08X)\n", cpu_get_pc(device)); + fatalerror("Copro FIFOIN overflow (at %08X)\n", device->safe_pc()); return; } - //mame_printf_debug("COPRO FIFOIN at %08X, %08X, %f\n", cpu_get_pc(device), data, *(float*)&data); + //mame_printf_debug("COPRO FIFOIN at %08X, %08X, %f\n", device->safe_pc(), data, *(float*)&data); state->m_copro_fifoin_data[state->m_copro_fifoin_wpos++] = data; if (state->m_copro_fifoin_wpos == COPRO_FIFOIN_SIZE) @@ -225,7 +225,7 @@ static void copro_fifoout_push(device_t *device, UINT32 data) //if (state->m_copro_fifoout_wpos == state->m_copro_fifoout_rpos) if (state->m_copro_fifoout_num == COPRO_FIFOOUT_SIZE) { - fatalerror("Copro FIFOOUT overflow (at %08X)\n", cpu_get_pc(device)); + fatalerror("Copro FIFOOUT overflow (at %08X)\n", device->safe_pc()); return; } @@ -666,7 +666,7 @@ WRITE32_MEMBER(model2_state::copro_fifo_w) } else { - //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc()); if (m_dsp_type == DSP_TYPE_SHARC) copro_fifoin_push(machine().device("dsp"), data); else @@ -777,7 +777,7 @@ WRITE32_MEMBER(model2_state::geo_sharc_fifo_w) } else { - //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc()); } } @@ -843,7 +843,7 @@ READ32_MEMBER(model2_state::geo_r) } // fatalerror("geo_r: %08X, %08X\n", address, mem_mask); - mame_printf_debug("geo_r: PC:%08x - %08X\n", cpu_get_pc(&space.device()), address); + mame_printf_debug("geo_r: PC:%08x - %08X\n", space.device().safe_pc(), address); return 0; } @@ -1074,7 +1074,7 @@ READ32_MEMBER(model2_state::model2_prot_r) else return 0xfff0; } - else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); + else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, space.device().safe_pc()); return retval; } @@ -1144,7 +1144,7 @@ WRITE32_MEMBER(model2_state::model2_prot_w) strcpy((char *)m_protram, " TECMO LTD. DEAD OR ALIVE 1996.10.22 VER. 1.00"); } } - else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); } @@ -1905,7 +1905,7 @@ static const scsp_interface scsp_config = READ32_MEMBER(model2_state::copro_sharc_input_fifo_r) { UINT32 result = 0; - //mame_printf_debug("SHARC FIFOIN pop at %08X\n", cpu_get_pc(&space.device())); + //mame_printf_debug("SHARC FIFOIN pop at %08X\n", space.device().safe_pc()); copro_fifoin_pop(machine().device("dsp"), &result); return result; @@ -1924,7 +1924,7 @@ READ32_MEMBER(model2_state::copro_sharc_buffer_r) WRITE32_MEMBER(model2_state::copro_sharc_buffer_w) { - //mame_printf_debug("sharc_buffer_w: %08X at %08X, %08X, %f\n", offset, cpu_get_pc(&space.device()), data, *(float*)&data); + //mame_printf_debug("sharc_buffer_w: %08X at %08X, %08X, %f\n", offset, space.device().safe_pc(), data, *(float*)&data); m_bufferram[offset & 0x7fff] = data; } diff --git a/src/mame/drivers/model3.c b/src/mame/drivers/model3.c index 27428c4cee0..8ce01cda2fb 100644 --- a/src/mame/drivers/model3.c +++ b/src/mame/drivers/model3.c @@ -1183,7 +1183,7 @@ static void real3d_dma_callback(running_machine &machine, UINT32 src, UINT32 dst case 0x9c: /* Unknown */ break; default: - logerror("dma_callback: %08X, %08X, %d at %08X", src, dst, length, cpu_get_pc(machine.device("maincpu"))); + logerror("dma_callback: %08X, %08X, %d at %08X", src, dst, length, machine.device("maincpu")->safe_pc()); break; } } @@ -1464,7 +1464,7 @@ WRITE64_MEMBER(model3_state::model3_ctrl_w) } break; default: - //mame_printf_debug("Lightgun: Unknown command %02X at %08X\n", (UINT32)(data >> 24), cpu_get_pc(&space.device())); + //mame_printf_debug("Lightgun: Unknown command %02X at %08X\n", (UINT32)(data >> 24), space.device().safe_pc()); break; } } @@ -1491,7 +1491,7 @@ WRITE64_MEMBER(model3_state::model3_ctrl_w) READ64_MEMBER(model3_state::model3_sys_r) { -// printf("model3_sys_r: mask %llx @ %x (PC %x)\n", mem_mask, offset, cpu_get_pc(&space.device())); +// printf("model3_sys_r: mask %llx @ %x (PC %x)\n", mem_mask, offset, space.device().safe_pc()); switch (offset) { @@ -1516,7 +1516,7 @@ READ64_MEMBER(model3_state::model3_sys_r) else logerror("m3_sys: Unk sys_r @ 0x10: mask = %x\n", (UINT32)mem_mask); break; case 0x18/8: -// printf("read irq_state %x (PC %x)\n", m_irq_state, cpu_get_pc(&space.device())); +// printf("read irq_state %x (PC %x)\n", m_irq_state, space.device().safe_pc()); return (UINT64)m_irq_state<<56 | 0xff000000; } @@ -1668,14 +1668,14 @@ WRITE8_MEMBER(model3_state::model3_sound_w) READ64_MEMBER(model3_state::network_r) { - mame_printf_debug("network_r: %02X at %08X\n", offset, cpu_get_pc(&space.device())); + mame_printf_debug("network_r: %02X at %08X\n", offset, space.device().safe_pc()); return m_network_ram[offset]; } WRITE64_MEMBER(model3_state::network_w) { COMBINE_DATA(m_network_ram + offset); - mame_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), cpu_get_pc(&space.device())); + mame_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), space.device().safe_pc()); } diff --git a/src/mame/drivers/mole.c b/src/mame/drivers/mole.c index 5857f81a9bb..d244da1bd21 100644 --- a/src/mame/drivers/mole.c +++ b/src/mame/drivers/mole.c @@ -165,7 +165,7 @@ READ8_MEMBER(mole_state::mole_protection_r) { case 0x08: return 0xb0; /* random mole placement */ case 0x26: - if (cpu_get_pc(&space.device()) == 0x53d7) + if (space.device().safe_pc() == 0x53d7) { return 0x06; /* bonus round */ } diff --git a/src/mame/drivers/monzagp.c b/src/mame/drivers/monzagp.c index 390e3d68c89..98ed2c7bf81 100644 --- a/src/mame/drivers/monzagp.c +++ b/src/mame/drivers/monzagp.c @@ -179,17 +179,17 @@ WRITE8_MEMBER(monzagp_state::port_w) WRITE8_MEMBER(monzagp_state::port0_w) { -// printf("P0 %x = %x\n",cpu_get_pc(&space.device()),data); +// printf("P0 %x = %x\n",space.device().safe_pc(),data); } WRITE8_MEMBER(monzagp_state::port1_w) { -// printf("P1 %x = %x\n",cpu_get_pc(&space.device()),data); +// printf("P1 %x = %x\n",space.device().safe_pc(),data); } WRITE8_MEMBER(monzagp_state::port2_w) { -// printf("P2 %x = %x\n",cpu_get_pc(&space.device()),data); +// printf("P2 %x = %x\n",space.device().safe_pc(),data); m_coordy=data; } diff --git a/src/mame/drivers/mosaic.c b/src/mame/drivers/mosaic.c index 4b5409d6031..dea7d832020 100644 --- a/src/mame/drivers/mosaic.c +++ b/src/mame/drivers/mosaic.c @@ -41,7 +41,7 @@ READ8_MEMBER(mosaic_state::protection_r) { int res = (m_prot_val >> 8) & 0xff; - logerror("%06x: protection_r %02x\n", cpu_get_pc(&space.device()), res); + logerror("%06x: protection_r %02x\n", space.device().safe_pc(), res); m_prot_val <<= 8; @@ -51,7 +51,7 @@ READ8_MEMBER(mosaic_state::protection_r) WRITE8_MEMBER(mosaic_state::gfire2_protection_w) { - logerror("%06x: protection_w %02x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: protection_w %02x\n", space.device().safe_pc(), data); switch(data) { diff --git a/src/mame/drivers/mpu3.c b/src/mame/drivers/mpu3.c index 4f0da829c11..8f23904564f 100644 --- a/src/mame/drivers/mpu3.c +++ b/src/mame/drivers/mpu3.c @@ -811,7 +811,7 @@ WRITE8_MEMBER(mpu3_state::characteriser_w) int x; int call=data; if (!m_current_chr_table) - fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device())); + fatalerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase()); if (offset == 0) { @@ -839,7 +839,7 @@ WRITE8_MEMBER(mpu3_state::characteriser_w) READ8_MEMBER(mpu3_state::characteriser_r) { if (!m_current_chr_table) - fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device())); + fatalerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase()); if (offset == 0) { diff --git a/src/mame/drivers/mpu4hw.c b/src/mame/drivers/mpu4hw.c index a844bf0c2d0..a6f2122d4ac 100644 --- a/src/mame/drivers/mpu4hw.c +++ b/src/mame/drivers/mpu4hw.c @@ -2075,10 +2075,10 @@ WRITE8_MEMBER(mpu4_state::characteriser_w) { int x; int call=data; - LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(&space.device()),offset,data)); + LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", space.device().safe_pcbase(),offset,data)); if (!m_current_chr_table) { - logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device())); + logerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase()); return; } @@ -2145,7 +2145,7 @@ READ8_MEMBER(mpu4_state::characteriser_r) { if (!m_current_chr_table) { - logerror("No Characteriser Table @ %04x", cpu_get_previouspc(&space.device())); + logerror("No Characteriser Table @ %04x", space.device().safe_pcbase()); /* a cheat ... many early games use a standard check */ int addr = cpu_get_reg(&space.device(), M6809_X); @@ -2215,9 +2215,9 @@ WRITE8_MEMBER(mpu4_state::bwb_characteriser_w) { int x; int call=data; - LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", cpu_get_previouspc(&space.device()),offset,data)); + LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", space.device().safe_pcbase(),offset,data)); if (!m_current_chr_table) - fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device())); + fatalerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase()); if ((offset & 0x3f)== 0)//initialisation is always at 0x800 { diff --git a/src/mame/drivers/mpu4vid.c b/src/mame/drivers/mpu4vid.c index b0059e15f7b..fdb0ea768ac 100644 --- a/src/mame/drivers/mpu4vid.c +++ b/src/mame/drivers/mpu4vid.c @@ -1600,11 +1600,11 @@ static WRITE16_HANDLER( characteriser16_w ) mpu4_state *state = space->machine().driver_data(); int x; int call=data; - LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(&space->device()),offset,data)); + LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", space->device().safe_pcbase(),offset,data)); if (!state->m_current_chr_table) { - logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device())); + logerror("No Characteriser Table @ %04x\n", space->device().safe_pcbase()); return; } @@ -1630,19 +1630,19 @@ static WRITE16_HANDLER( characteriser16_w ) static READ16_HANDLER( characteriser16_r ) { mpu4_state *state = space->machine().driver_data(); - LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", cpu_get_previouspc(&space->device()),offset,state->m_current_chr_table[state->m_prot_col].response)); + LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", space->device().safe_pcbase(),offset,state->m_current_chr_table[state->m_prot_col].response)); LOG_CHR(("Characteriser read offset %02X \n",offset)); LOG_CHR(("Characteriser read data %02X \n",state->m_current_chr_table[state->m_prot_col].response)); if (!state->m_current_chr_table) { - logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device())); + logerror("No Characteriser Table @ %04x\n", space->device().safe_pcbase()); return 0x00; } /* hack for 'invalid questions' error on time machine.. I guess it wants them to decode properly for startup check? */ - if (cpu_get_previouspc(&space->device())==0x283a) + if (space->device().safe_pcbase()==0x283a) { return 0x00; } @@ -1672,10 +1672,10 @@ static WRITE16_HANDLER( bwb_characteriser16_w ) mpu4_state *state = space->machine().driver_data(); int x; int call=data &0xff; - LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", cpu_get_previouspc(&space->device()),offset,data)); + LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", space->device().safe_pcbase(),offset,data)); if (!state->m_current_chr_table) { - logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device())); + logerror("No Characteriser Table @ %04x\n", space->device().safe_pcbase()); return; } diff --git a/src/mame/drivers/mpu5hw.c b/src/mame/drivers/mpu5hw.c index b1f7d6d4c1c..0f692b44b57 100644 --- a/src/mame/drivers/mpu5hw.c +++ b/src/mame/drivers/mpu5hw.c @@ -64,7 +64,7 @@ protected: READ32_MEMBER(mpu5_state::mpu5_mem_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_maincpu, offset * 4); switch ( cs ) @@ -86,7 +86,7 @@ READ32_MEMBER(mpu5_state::mpu5_mem_r) WRITE32_MEMBER(mpu5_state::mpu5_mem_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_maincpu, offset * 4); switch ( cs ) diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index e1fbea21d52..05615d68038 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -100,7 +100,7 @@ ADDRESS_MAP_END static WRITE16_HANDLER( output_w ) { if (ACCESSING_BITS_0_7) - logerror("%06x:output_w(%x) = %02x\n", cpu_get_pc(&space->device()), offset, data); + logerror("%06x:output_w(%x) = %02x\n", space->device().safe_pc(), offset, data); } @@ -108,13 +108,13 @@ static READ16_HANDLER( coin_chip_r ) { if (offset == 1) return space->machine().root_device().ioport("COINCHIP")->read(); - logerror("%06x:coin_chip_r(%02x) & %04x\n", cpu_get_pc(&space->device()), offset, mem_mask); + logerror("%06x:coin_chip_r(%02x) & %04x\n", space->device().safe_pc(), offset, mem_mask); return 0xffff; } static WRITE16_HANDLER( coin_chip_w ) { - logerror("%06x:coin_chip_w(%02x) = %04x & %04x\n", cpu_get_pc(&space->device()), offset, data, mem_mask); + logerror("%06x:coin_chip_w(%02x) = %04x & %04x\n", space->device().safe_pc(), offset, data, mem_mask); } // inputs at 282000, 282002 (full word) diff --git a/src/mame/drivers/msisaac.c b/src/mame/drivers/msisaac.c index 7b81673328e..d348f964e2d 100644 --- a/src/mame/drivers/msisaac.c +++ b/src/mame/drivers/msisaac.c @@ -145,7 +145,7 @@ MCU simulation TODO: return 0x45; default: - logerror("CPU#0 read from MCU pc=%4x, mcu_val=%2x\n", cpu_get_pc(&space.device()), m_mcu_val); + logerror("CPU#0 read from MCU pc=%4x, mcu_val=%2x\n", space.device().safe_pc(), m_mcu_val); return m_mcu_val; } #endif @@ -166,7 +166,7 @@ WRITE8_MEMBER(msisaac_state::msisaac_mcu_w) buggychl_mcu_w(offset,data); #else //if(data != 0x0a && data != 0x42 && data != 0x02) - // popmessage("PC = %04x %02x", cpu_get_pc(&space.device()), data); + // popmessage("PC = %04x %02x", space.device().safe_pc(), data); m_mcu_val = data; #endif } diff --git a/src/mame/drivers/mw8080bw.c b/src/mame/drivers/mw8080bw.c index 5fb2d8a7cf5..9a601f42514 100644 --- a/src/mame/drivers/mw8080bw.c +++ b/src/mame/drivers/mw8080bw.c @@ -2191,7 +2191,7 @@ WRITE8_MEMBER(mw8080bw_state::spcenctr_io_w) m_spcenctr_trench_width = data; /* - - - - - 1 1 1 */ else - logerror("%04x: Unmapped I/O port write to %02x = %02x\n", cpu_get_pc(&space.device()), offset, data); + logerror("%04x: Unmapped I/O port write to %02x = %02x\n", space.device().safe_pc(), offset, data); } diff --git a/src/mame/drivers/mystwarr.c b/src/mame/drivers/mystwarr.c index f84a91b7e4e..ce2b10700ae 100644 --- a/src/mame/drivers/mystwarr.c +++ b/src/mame/drivers/mystwarr.c @@ -235,7 +235,7 @@ WRITE16_MEMBER(mystwarr_state::K053247_scattered_word_w) { if (offset & 0x0078) { -// mame_printf_debug("spr write %x to %x (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); +// mame_printf_debug("spr write %x to %x (PC=%x)\n", data, offset, space.device().safe_pc()); COMBINE_DATA(m_spriteram+offset); } else diff --git a/src/mame/drivers/namcona1.c b/src/mame/drivers/namcona1.c index 8d4cbcb921b..4ed14f1739a 100644 --- a/src/mame/drivers/namcona1.c +++ b/src/mame/drivers/namcona1.c @@ -787,7 +787,7 @@ READ16_MEMBER(namcona1_state::na1mcu_shared_r) #if 0 if (offset >= 0x70000/2) { - logerror("MD: %04x @ %x PC %x\n", ((data>>8)&0xff) | ((data<<8)&0xff00), offset*2, cpu_get_pc(&space.device())); + logerror("MD: %04x @ %x PC %x\n", ((data>>8)&0xff) | ((data<<8)&0xff00), offset*2, space.device().safe_pc()); } #endif @@ -844,7 +844,7 @@ WRITE8_MEMBER(namcona1_state::port4_w) { if ((data & 0x08) && !(m_mcu_port4 & 0x08)) { - logerror("launching 68k, PC=%x\n", cpu_get_pc(&space.device())); + logerror("launching 68k, PC=%x\n", space.device().safe_pc()); // reset and launch the 68k cputag_set_input_line(machine(), "maincpu", INPUT_LINE_RESET, CLEAR_LINE); diff --git a/src/mame/drivers/namconb1.c b/src/mame/drivers/namconb1.c index e196beb74bc..3a69cdadccc 100644 --- a/src/mame/drivers/namconb1.c +++ b/src/mame/drivers/namconb1.c @@ -741,7 +741,7 @@ READ32_MEMBER(namconb1_state::custom_key_r) break; /* no protection? */ } - logerror( "custom_key_r(%d); pc=%08x\n", offset, cpu_get_pc(&space.device()) ); + logerror( "custom_key_r(%d); pc=%08x\n", offset, space.device().safe_pc() ); return 0; } /* custom_key_r */ diff --git a/src/mame/drivers/namcos10.c b/src/mame/drivers/namcos10.c index abeb70ec15b..9584711b6c5 100644 --- a/src/mame/drivers/namcos10.c +++ b/src/mame/drivers/namcos10.c @@ -421,25 +421,25 @@ READ32_MEMBER(namcos10_state::nand_status_r ) WRITE32_MEMBER(namcos10_state::nand_address1_w ) { - logerror("nand_a1_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nand_a1_w %08x (%08x)\n", data, space.device().safe_pc()); nand_address = ( nand_address & 0x00ffffff ) | ( ( data & 0xff ) << 24 ); } WRITE32_MEMBER(namcos10_state::nand_address2_w ) { - logerror("nand_a2_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nand_a2_w %08x (%08x)\n", data, space.device().safe_pc()); nand_address = ( nand_address & 0xff00ffff ) | ( ( data & 0xff ) << 16 ); } WRITE32_MEMBER(namcos10_state::nand_address3_w ) { - logerror("nand_a3_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nand_a3_w %08x (%08x)\n", data, space.device().safe_pc()); nand_address = ( nand_address & 0xffff00ff ) | ( ( data & 0xff ) << 8 ); } WRITE32_MEMBER(namcos10_state::nand_address4_w ) { - logerror("nand_a4_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nand_a4_w %08x (%08x)\n", data, space.device().safe_pc()); nand_address = ( nand_address & 0xffffff00 ) | ( ( data & 0xff ) << 0 ); } diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c index 689e12ce73f..5560efdc7b1 100644 --- a/src/mame/drivers/namcos11.c +++ b/src/mame/drivers/namcos11.c @@ -757,7 +757,7 @@ WRITE16_MEMBER(namcos11_state::c76_shared_w) READ16_MEMBER(namcos11_state::c76_inputs_r) { -// logerror("'c76' Read port %d @ %06X\n", offset, cpu_get_pc(&space.device())); +// logerror("'c76' Read port %d @ %06X\n", offset, space.device().safe_pc()); switch (offset) { @@ -855,7 +855,7 @@ ADDRESS_MAP_END READ16_MEMBER(namcos11_state::c76_speedup_r) { - if ((cpu_get_pc(&space.device()) == 0xc153) && (!(m_su_83 & 0xff00))) + if ((space.device().safe_pc() == 0xc153) && (!(m_su_83 & 0xff00))) { device_spin_until_interrupt(&space.device()); } diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c index 2db3ea01077..aa1202ae664 100644 --- a/src/mame/drivers/namcos21.c +++ b/src/mame/drivers/namcos21.c @@ -342,20 +342,20 @@ READ16_MEMBER(namcos21_state::dspcuskey_r) UINT16 result = 0; if( m_gametype == NAMCOS21_SOLVALOU ) { - switch( cpu_get_pc(&space.device()) ) + switch( space.device().safe_pc() ) { case 0x805e: result = 0x0000; break; case 0x805f: result = 0xfeba; break; case 0x8067: result = 0xffff; break; case 0x806e: result = 0x0145; break; default: - logerror( "unk cuskey_r; pc=0x%x\n", cpu_get_pc(&space.device()) ); + logerror( "unk cuskey_r; pc=0x%x\n", space.device().safe_pc() ); break; } } else if( m_gametype == NAMCOS21_CYBERSLED ) { - switch( cpu_get_pc(&space.device()) ) + switch( space.device().safe_pc() ) { case 0x8061: result = 0xfe95; break; case 0x8069: result = 0xffff; break; @@ -366,7 +366,7 @@ READ16_MEMBER(namcos21_state::dspcuskey_r) } else if( m_gametype == NAMCOS21_AIRCOMBAT ) { - switch( cpu_get_pc(&space.device()) ) + switch( space.device().safe_pc() ) { case 0x8062: result = 0xfeb9; break; case 0x806a: result = 0xffff; break; @@ -880,7 +880,7 @@ WRITE16_MEMBER(namcos21_state::slave_port3_w) WRITE16_MEMBER(namcos21_state::slave_XF_output_w) { - if (ENABLE_LOGGING) logerror( "0x%x:slaveXF(%d)\n", cpu_get_pc(&space.device()), data ); + if (ENABLE_LOGGING) logerror( "0x%x:slaveXF(%d)\n", space.device().safe_pc(), data ); } /* slave_XF_output_w */ READ16_MEMBER(namcos21_state::slave_portf_r) @@ -935,7 +935,7 @@ WRITE16_MEMBER(namcos21_state::pointram_control_w) #if 0 logerror( "dsp_control_w:'%s':%x[%x]:=%04x ", cpu->tag, - cpu_get_pc(cpu), + cpu->safe_pc(), offset, m_pointram_control ); @@ -1120,7 +1120,7 @@ WRITE16_MEMBER(namcos21_state::winrun_dspcomram_w) READ16_MEMBER(namcos21_state::winrun_cuskey_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); switch( pc ) { case 0x0064: /* winrun91 */ diff --git a/src/mame/drivers/namcos22.c b/src/mame/drivers/namcos22.c index 5d631971291..638ed0e6bc1 100644 --- a/src/mame/drivers/namcos22.c +++ b/src/mame/drivers/namcos22.c @@ -1619,7 +1619,7 @@ WRITE16_MEMBER(namcos22_state::upload_code_to_slave_dsp_w) break; default: - logerror( "%08x: master port#7: 0x%04x\n", cpu_get_previouspc(&space.device()), data ); + logerror( "%08x: master port#7: 0x%04x\n", space.device().safe_pcbase(), data ); break; } break; @@ -2378,7 +2378,7 @@ READ32_MEMBER(namcos22_state::namcos22_keycus_r) // this chip is also used for reading random values in some games // for example in timecris to determine where certain enemies will emerge // but it is not yet understood how this works -// printf("Hit keycus mask %x PC=%x\n", mem_mask, cpu_get_pc(&space.device())); +// printf("Hit keycus mask %x PC=%x\n", mem_mask, space.device().safe_pc()); if (ACCESSING_BITS_0_15) return m_keycus_id; @@ -5409,7 +5409,7 @@ INPUT_PORTS_END /* Rave Racer */ // for MCU BIOS v1.41 READ16_MEMBER(namcos22_state::mcu141_speedup_r) { - if ((cpu_get_pc(&space.device()) == 0xc12d) && (!(m_su_82 & 0xff00))) + if ((space.device().safe_pc() == 0xc12d) && (!(m_su_82 & 0xff00))) { device_spin_until_interrupt(&space.device()); } @@ -5425,7 +5425,7 @@ WRITE16_MEMBER(namcos22_state::mcu_speedup_w) // for MCU BIOS v1.30 READ16_MEMBER(namcos22_state::mcu130_speedup_r) { - if ((cpu_get_pc(&space.device()) == 0xc12a) && (!(m_su_82 & 0xff00))) + if ((space.device().safe_pc() == 0xc12a) && (!(m_su_82 & 0xff00))) { device_spin_until_interrupt(&space.device()); } @@ -5436,7 +5436,7 @@ READ16_MEMBER(namcos22_state::mcu130_speedup_r) // for NSTX7702 v1.00 (C74) READ16_MEMBER(namcos22_state::mcuc74_speedup_r) { - if (((cpu_get_pc(&space.device()) == 0xc0df) || (cpu_get_pc(&space.device()) == 0xc101)) && (!(m_su_82 & 0xff00))) + if (((space.device().safe_pc() == 0xc0df) || (space.device().safe_pc() == 0xc101)) && (!(m_su_82 & 0xff00))) { device_spin_until_interrupt(&space.device()); } diff --git a/src/mame/drivers/namcos23.c b/src/mame/drivers/namcos23.c index ffea2f079ba..59d2a533a14 100644 --- a/src/mame/drivers/namcos23.c +++ b/src/mame/drivers/namcos23.c @@ -1518,7 +1518,7 @@ READ16_MEMBER(namcos23_state::s23_c417_r) case 0: return 0x8e | (machine().primary_screen->vblank() ? 0x0000 : 0x8000); case 1: return c417.adr; case 4: - // logerror("c417_r %04x = %04x (%08x, %08x)\n", c417.adr, c417.ram[c417.adr], cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + // logerror("c417_r %04x = %04x (%08x, %08x)\n", c417.adr, c417.ram[c417.adr], space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); return c417.ram[c417.adr]; case 5: if(c417.pointrom_adr >= m_ptrom_limit) @@ -1531,7 +1531,7 @@ READ16_MEMBER(namcos23_state::s23_c417_r) } - logerror("c417_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c417_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); return 0; } @@ -1553,7 +1553,7 @@ WRITE16_MEMBER(namcos23_state::s23_c417_w) c417.pointrom_adr = 0; break; case 4: - // logerror("c417_w %04x = %04x (%08x, %08x)\n", c417.adr, data, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + // logerror("c417_w %04x = %04x (%08x, %08x)\n", c417.adr, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); COMBINE_DATA(c417.ram + c417.adr); break; case 7: @@ -1561,7 +1561,7 @@ WRITE16_MEMBER(namcos23_state::s23_c417_w) cputag_set_input_line(machine(), "maincpu", MIPS3_IRQ2, CLEAR_LINE); break; default: - logerror("c417_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c417_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); break; } } @@ -1570,7 +1570,7 @@ READ16_MEMBER(namcos23_state::s23_c412_ram_r) { c412_t &c412 = m_c412; - // logerror("c412_ram_r %06x (%08x, %08x)\n", offset, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + // logerror("c412_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); if(offset < 0x100000) return c412.sdram_a[offset & 0xfffff]; else if(offset < 0x200000) @@ -1587,7 +1587,7 @@ WRITE16_MEMBER(namcos23_state::s23_c412_ram_w) { c412_t &c412 = m_c412; - // logerror("c412_ram_w %06x = %04x (%08x, %08x)\n", offset, data, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + // logerror("c412_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); if(offset < 0x100000) COMBINE_DATA(c412.sdram_a + (offset & 0xfffff)); else if(offset < 0x200000) @@ -1611,7 +1611,7 @@ READ16_MEMBER(namcos23_state::s23_c412_r) case 10: return s23_c412_ram_r(space, c412.adr, mem_mask); } - logerror("c412_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c412_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); return 0; } @@ -1624,7 +1624,7 @@ WRITE16_MEMBER(namcos23_state::s23_c412_w) case 9: c412.adr = ((data & mem_mask) << 16) | (c412.adr & (0xffffffff ^ (mem_mask << 16))); break; case 10: s23_c412_ram_w(space, c412.adr, data, mem_mask); c412.adr += 2; break; default: - logerror("c412_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c412_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); break; } } @@ -1633,7 +1633,7 @@ READ16_MEMBER(namcos23_state::s23_c421_ram_r) { c421_t &c421 = m_c421; - // logerror("c421_ram_r %06x (%08x, %08x)\n", offset, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + // logerror("c421_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); if(offset < 0x40000) return c421.dram_a[offset & 0x3ffff]; else if(offset < 0x80000) @@ -1648,7 +1648,7 @@ WRITE16_MEMBER(namcos23_state::s23_c421_ram_w) { c421_t &c421 = m_c421; - // logerror("c421_ram_w %06x = %04x (%08x, %08x)\n", offset, data, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + // logerror("c421_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); if(offset < 0x40000) COMBINE_DATA(c421.dram_a + (offset & 0x3ffff)); else if(offset < 0x80000) @@ -1667,7 +1667,7 @@ READ16_MEMBER(namcos23_state::s23_c421_r) case 3: return c421.adr; } - logerror("c421_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c421_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); return 0; } @@ -1680,7 +1680,7 @@ WRITE16_MEMBER(namcos23_state::s23_c421_w) case 2: c421.adr = ((data & mem_mask) << 16) | (c421.adr & (0xffffffff ^ (mem_mask << 16))); break; case 3: c421.adr = (data & mem_mask) | (c421.adr & (0xffffffff ^ mem_mask)); break; default: - logerror("c421_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c421_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); break; } } @@ -1717,11 +1717,11 @@ WRITE16_MEMBER(namcos23_state::s23_ctl_w) case 6: // gmen wars spams this heavily with 0 prior to starting the GMEN board test if (data != 0) - logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); break; default: - logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("ctl_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); } } @@ -1736,7 +1736,7 @@ READ16_MEMBER(namcos23_state::s23_ctl_r) return res; } } - logerror("ctl_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("ctl_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); return 0xffff; } @@ -1780,7 +1780,7 @@ WRITE16_MEMBER(namcos23_state::s23_c361_w) break; default: - logerror("c361_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c361_w %x, %04x @ %04x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); } } @@ -1790,7 +1790,7 @@ READ16_MEMBER(namcos23_state::s23_c361_r) case 5: return machine().primary_screen->vpos()*2 | (machine().primary_screen->vblank() ? 1 : 0); case 6: return machine().primary_screen->vblank(); } - logerror("c361_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("c361_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); return 0xffff; } @@ -2185,7 +2185,7 @@ READ32_MEMBER(namcos23_state::p3d_r) case 0xa: return 1; // Busy flag } - logerror("p3d_r %02x @ %08x (%08x, %08x)\n", offset, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("p3d_r %02x @ %08x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); return 0; } @@ -2203,7 +2203,7 @@ WRITE32_MEMBER(namcos23_state::p3d_w) m_c361.timer->adjust(attotime::never); return; } - logerror("p3d_w %02x, %08x @ %08x (%08x, %08x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); + logerror("p3d_w %02x, %08x @ %08x (%08x, %08x)\n", offset, data, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31)); } static void render_apply_transform(INT32 xi, INT32 yi, INT32 zi, const namcos23_render_entry *re, poly_vertex &pv) diff --git a/src/mame/drivers/naughtyb.c b/src/mame/drivers/naughtyb.c index 6112000d61e..961168afdb8 100644 --- a/src/mame/drivers/naughtyb.c +++ b/src/mame/drivers/naughtyb.c @@ -156,16 +156,16 @@ READ8_MEMBER(naughtyb_state::popflame_protection_r)/* Not used by bootleg/hack * return seed00[m_prot_count] | seedxx; #if 0 - if ( cpu_get_pc(&space.device()) == (0x26F2 + 0x03) ) + if ( space.device().safe_pc() == (0x26F2 + 0x03) ) { popflame_prot_count = 0; return 0x01; } /* Must not carry when rotated left */ - if ( cpu_get_pc(&space.device()) == (0x26F9 + 0x03) ) + if ( space.device().safe_pc() == (0x26F9 + 0x03) ) return 0x80; /* Must carry when rotated left */ - if ( cpu_get_pc(&space.device()) == (0x270F + 0x03) ) + if ( space.device().safe_pc() == (0x270F + 0x03) ) { switch( popflame_prot_count++ ) { @@ -175,7 +175,7 @@ READ8_MEMBER(naughtyb_state::popflame_protection_r)/* Not used by bootleg/hack * case 3: return 0x38; /* x011 1xxx, matches 0x07 at $2693, stored in $400D */ } } - logerror("CPU #0 PC %06x: unmapped protection read\n", cpu_get_pc(&space.device())); + logerror("CPU #0 PC %06x: unmapped protection read\n", space.device().safe_pc()); return 0x00; #endif } diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index 34fb3f86138..40bfe45b2ee 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -224,7 +224,7 @@ void neogeo_set_display_counter_msb( address_space *space, UINT16 data ) state->m_display_counter = (state->m_display_counter & 0x0000ffff) | ((UINT32)data << 16); - if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", cpu_get_pc(&space->device()), state->m_display_counter); + if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", space->device().safe_pc(), state->m_display_counter); } @@ -234,7 +234,7 @@ void neogeo_set_display_counter_lsb( address_space *space, UINT16 data ) state->m_display_counter = (state->m_display_counter & 0xffff0000) | data; - if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", cpu_get_pc(&space->device()), state->m_display_counter); + if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", space->device().safe_pc(), state->m_display_counter); if (state->m_display_position_interrupt_control & IRQ2CTRL_LOAD_RELATIVE) { @@ -434,7 +434,7 @@ WRITE16_MEMBER(neogeo_state::io_control_w) // case 0x33: break; // coui lockout default: - logerror("PC: %x Unmapped I/O control write. Offset: %x Data: %x\n", cpu_get_pc(&space.device()), offset, data); + logerror("PC: %x Unmapped I/O control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset, data); break; } } @@ -460,7 +460,7 @@ READ16_MEMBER(neogeo_state::neogeo_unmapped_r) else { m_recurse = 1; - ret = space.read_word(cpu_get_pc(&space.device())); + ret = space.read_word(space.device().safe_pc()); m_recurse = 0; } @@ -583,7 +583,7 @@ WRITE16_MEMBER(neogeo_state::audio_command_w) /* boost the interleave to let the audio CPU read the command */ machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); - if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(&space.device()), data, mem_mask); + if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", space.device().safe_pc(), data, mem_mask); } } @@ -592,7 +592,7 @@ READ8_MEMBER(neogeo_state::audio_command_r) { UINT8 ret = soundlatch_byte_r(space, 0); - if (LOG_CPU_COMM) logerror(" AUD CPU PC %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret); + if (LOG_CPU_COMM) logerror(" AUD CPU PC %04x: audio_command_r %02x\n", space.device().safe_pc(), ret); /* this is a guess */ audio_cpu_clear_nmi_w(space, 0, 0); @@ -604,7 +604,7 @@ READ8_MEMBER(neogeo_state::audio_command_r) WRITE8_MEMBER(neogeo_state::audio_result_w) { - if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC %04x: audio_result_w %02x\n", cpu_get_pc(&space.device()), data); + if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC %04x: audio_result_w %02x\n", space.device().safe_pc(), data); m_audio_result = data; } @@ -614,7 +614,7 @@ CUSTOM_INPUT_MEMBER(neogeo_state::get_audio_result) { UINT32 ret = m_audio_result; -// if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(machine().device("maincpu")), ret); +// if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", machine().device("maincpu")->safe_pc(), ret); return ret; } @@ -654,7 +654,7 @@ void neogeo_set_main_cpu_bank_address( address_space *space, UINT32 bank_address { neogeo_state *state = space->machine().driver_data(); - if (LOG_MAIN_CPU_BANKING) logerror("MAIN CPU PC %06x: neogeo_set_main_cpu_bank_address %06x\n", cpu_get_pc(&space->device()), bank_address); + if (LOG_MAIN_CPU_BANKING) logerror("MAIN CPU PC %06x: neogeo_set_main_cpu_bank_address %06x\n", space->device().safe_pc(), bank_address); state->m_main_cpu_bank_address = bank_address; @@ -668,14 +668,14 @@ WRITE16_MEMBER(neogeo_state::main_cpu_bank_select_w) UINT32 len = memregion("maincpu")->bytes(); if ((len <= 0x100000) && (data & 0x07)) - logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", cpu_get_pc(&space.device()), data); + logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", space.device().safe_pc(), data); else { bank_address = ((data & 0x07) + 1) * 0x100000; if (bank_address >= len) { - logerror("PC %06x: warning: bankswitch to empty bank %02x\n", cpu_get_pc(&space.device()), data); + logerror("PC %06x: warning: bankswitch to empty bank %02x\n", space.device().safe_pc(), data); bank_address = 0x100000; } @@ -721,7 +721,7 @@ static void audio_cpu_bank_select( address_space *space, int region, UINT8 bank { neogeo_state *state = space->machine().driver_data(); - if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: audio_cpu_bank_select: Region: %d Bank: %02x\n", cpu_get_pc(&space->device()), region, bank); + if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: audio_cpu_bank_select: Region: %d Bank: %02x\n", space->device().safe_pc(), region, bank); state->m_audio_cpu_banks[region] = bank; @@ -777,7 +777,7 @@ static void _set_audio_cpu_rom_source( address_space *space ) cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, PULSE_LINE); - if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: selectign %s ROM\n", cpu_get_pc(&space->device()), state->m_audio_cpu_rom_source ? "CARTRIDGE" : "BIOS"); + if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: selectign %s ROM\n", space->device().safe_pc(), state->m_audio_cpu_rom_source ? "CARTRIDGE" : "BIOS"); } } @@ -858,11 +858,11 @@ WRITE16_MEMBER(neogeo_state::system_control_w) case 0x02: /* unknown - HC32 middle pin 1 */ case 0x03: /* unknown - uPD4990 pin ? */ case 0x04: /* unknown - HC32 middle pin 10 */ - logerror("PC: %x Unmapped system control write. Offset: %x Data: %x\n", cpu_get_pc(&space.device()), offset & 0x07, bit); + logerror("PC: %x Unmapped system control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset & 0x07, bit); break; } - if (LOG_VIDEO_SYSTEM && ((offset & 0x07) != 0x06)) logerror("PC: %x System control write. Offset: %x Data: %x\n", cpu_get_pc(&space.device()), offset & 0x07, bit); + if (LOG_VIDEO_SYSTEM && ((offset & 0x07) != 0x06)) logerror("PC: %x System control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset & 0x07, bit); } } diff --git a/src/mame/drivers/neoprint.c b/src/mame/drivers/neoprint.c index 0db3ac64b39..ebbe242137d 100644 --- a/src/mame/drivers/neoprint.c +++ b/src/mame/drivers/neoprint.c @@ -131,8 +131,8 @@ SCREEN_UPDATE_IND16(nprsp) READ16_MEMBER(neoprint_state::neoprint_calendar_r) { - //if(cpu_get_pc(&space.device()) != 0x4b38 )//&& cpu_get_pc(&space.device()) != 0x5f86 && cpu_get_pc(&space.device()) != 0x5f90) - // printf("%08x\n",cpu_get_pc(&space.device())); + //if(space.device().safe_pc() != 0x4b38 )//&& space.device().safe_pc() != 0x5f86 && space.device().safe_pc() != 0x5f90) + // printf("%08x\n",space.device().safe_pc()); return (upd4990a_databit_r(machine().device("upd4990a"), 0) << 15); } @@ -151,8 +151,8 @@ READ8_MEMBER(neoprint_state::neoprint_unk_r) m_vblank = (machine().primary_screen->frame_number() & 0x1) ? 0x10 : 0x00; - //if(cpu_get_pc(&space.device()) != 0x1504 && cpu_get_pc(&space.device()) != 0x5f86 && cpu_get_pc(&space.device()) != 0x5f90) - // printf("%08x\n",cpu_get_pc(&space.device())); + //if(space.device().safe_pc() != 0x1504 && space.device().safe_pc() != 0x5f86 && space.device().safe_pc() != 0x5f90) + // printf("%08x\n",space.device().safe_pc()); return m_vblank| 4 | 3; } @@ -185,7 +185,7 @@ WRITE16_MEMBER(neoprint_state::audio_command_w) /* boost the interleave to let the audio CPU read the command */ machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); - //if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(&space.device()), data, mem_mask); + //if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", space.device().safe_pc(), data, mem_mask); } } @@ -194,7 +194,7 @@ READ8_MEMBER(neoprint_state::audio_command_r) { UINT8 ret = soundlatch_byte_r(space, 0); - //if (LOG_CPU_COMM) logerror(" AUD CPU PC %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret); + //if (LOG_CPU_COMM) logerror(" AUD CPU PC %04x: audio_command_r %02x\n", space.device().safe_pc(), ret); /* this is a guess */ audio_cpu_clear_nmi_w(space, 0, 0); @@ -208,7 +208,7 @@ WRITE8_MEMBER(neoprint_state::audio_result_w) { - //if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC %04x: audio_result_w %02x\n", cpu_get_pc(&space.device()), data); + //if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC %04x: audio_result_w %02x\n", space.device().safe_pc(), data); m_audio_result = data; } diff --git a/src/mame/drivers/ninjaw.c b/src/mame/drivers/ninjaw.c index f8fba72ca4e..77aec683fbd 100644 --- a/src/mame/drivers/ninjaw.c +++ b/src/mame/drivers/ninjaw.c @@ -344,7 +344,7 @@ WRITE16_MEMBER(ninjaw_state::cpua_ctrl_w) parse_control(machine()); - logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data); + logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data); } diff --git a/src/mame/drivers/nmk16.c b/src/mame/drivers/nmk16.c index 22d42d7a6be..eb7990ca139 100644 --- a/src/mame/drivers/nmk16.c +++ b/src/mame/drivers/nmk16.c @@ -229,7 +229,7 @@ WRITE8_MEMBER(nmk16_state::ssmissin_soundbank_w) WRITE16_MEMBER(nmk16_state::tharrier_mcu_control_w) { -// logerror("%04x: mcu_control_w %02x\n",cpu_get_pc(&space.device()),data); +// logerror("%04x: mcu_control_w %02x\n",space.device().safe_pc(),data); } READ16_MEMBER(nmk16_state::tharrier_mcu_r) @@ -245,8 +245,8 @@ READ16_MEMBER(nmk16_state::tharrier_mcu_r) int res; - if (cpu_get_pc(&space.device())==0x8aa) res = (m_mainram[0x9064/2])|0x20; /* Task Force Harrier */ - else if (cpu_get_pc(&space.device())==0x8ce) res = (m_mainram[0x9064/2])|0x60; /* Task Force Harrier */ + if (space.device().safe_pc()==0x8aa) res = (m_mainram[0x9064/2])|0x20; /* Task Force Harrier */ + else if (space.device().safe_pc()==0x8ce) res = (m_mainram[0x9064/2])|0x60; /* Task Force Harrier */ else { res = to_main[m_prot_count++]; @@ -4659,7 +4659,7 @@ WRITE16_MEMBER(nmk16_state::twinactn_flipscreen_w) flip_screen_set(data & 1); if (data & (~1)) - logerror("%06x: unknown flip screen bit written %04x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: unknown flip screen bit written %04x\n", space.device().safe_pc(), data); } #endif @@ -4708,7 +4708,7 @@ WRITE8_MEMBER(nmk16_state::twinactn_oki_bank_w) if (data & (~3)) logerror("%s: invalid oki bank %02x\n", machine().describe_context(), data); -// logerror("%04x: oki bank %02x\n", cpu_get_pc(&space->device()), data); +// logerror("%04x: oki bank %02x\n", space->device().safe_pc(), data); } static ADDRESS_MAP_START( twinactn_sound_cpu, AS_PROGRAM, 8, nmk16_state ) diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index d90afe7e3ef..5bb9bafd452 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -394,7 +394,7 @@ READ32_MEMBER(nwktr_state::lanc1_r) default: { - //printf("lanc1_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space.device())); + //printf("lanc1_r: %08X, %08X at %08X\n", offset, mem_mask, space.device().safe_pc()); return 0xffffffff; } } @@ -402,7 +402,7 @@ READ32_MEMBER(nwktr_state::lanc1_r) WRITE32_MEMBER(nwktr_state::lanc1_w) { - //printf("lanc1_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + //printf("lanc1_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc()); } READ32_MEMBER(nwktr_state::lanc2_r) @@ -430,7 +430,7 @@ READ32_MEMBER(nwktr_state::lanc2_r) } } - //printf("lanc2_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space.device())); + //printf("lanc2_r: %08X, %08X at %08X\n", offset, mem_mask, space.device().safe_pc()); return r; } @@ -454,7 +454,7 @@ WRITE32_MEMBER(nwktr_state::lanc2_w) m_fpga_uploaded = 1; - //printf("lanc2_fpga_w: %02X at %08X\n", value, cpu_get_pc(&space.device())); + //printf("lanc2_fpga_w: %02X at %08X\n", value, space.device().safe_pc()); } else if (ACCESSING_BITS_8_15) { @@ -473,7 +473,7 @@ WRITE32_MEMBER(nwktr_state::lanc2_w) } else { - //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc()); } } if (offset == 4) @@ -503,7 +503,7 @@ WRITE32_MEMBER(nwktr_state::lanc2_w) } } - //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc()); } /*****************************************************************************/ diff --git a/src/mame/drivers/nyny.c b/src/mame/drivers/nyny.c index 990555e3468..799116ea134 100644 --- a/src/mame/drivers/nyny.c +++ b/src/mame/drivers/nyny.c @@ -464,7 +464,7 @@ WRITE8_MEMBER(nyny_state::nyny_ay8910_37_port_a_w) { /* not sure what this does */ - /*logerror("%x PORT A write %x at Y=%x X=%x\n", cpu_get_pc(&space->device()), data, space->machine().primary_screen->vpos(), space->machine().primary_screen->hpos());*/ + /*logerror("%x PORT A write %x at Y=%x X=%x\n", space->device().safe_pc(), data, space->machine().primary_screen->vpos(), space->machine().primary_screen->hpos());*/ } diff --git a/src/mame/drivers/offtwall.c b/src/mame/drivers/offtwall.c index 393ed336558..a40baf374f8 100644 --- a/src/mame/drivers/offtwall.c +++ b/src/mame/drivers/offtwall.c @@ -163,11 +163,11 @@ READ16_MEMBER(offtwall_state::bankrom_r) { /* this is the banked ROM read */ - logerror("%06X: %04X\n", cpu_get_previouspc(&space.device()), offset); + logerror("%06X: %04X\n", space.device().safe_pcbase(), offset); /* if the values are $3e000 or $3e002 are being read by code just below the ROM bank area, we need to return the correct value to give the proper checksum */ - if ((offset == 0x3000 || offset == 0x3001) && cpu_get_previouspc(&space.device()) > 0x37000) + if ((offset == 0x3000 || offset == 0x3001) && space.device().safe_pcbase() > 0x37000) { UINT32 checksum = (space.read_word(0x3fd210) << 16) | space.read_word(0x3fd212); UINT32 us = 0xaaaa5555 - checksum; @@ -202,7 +202,7 @@ READ16_MEMBER(offtwall_state::bankrom_r) READ16_MEMBER(offtwall_state::spritecache_count_r) { - int prevpc = cpu_get_previouspc(&space.device()); + int prevpc = space.device().safe_pcbase(); /* if this read is coming from $99f8 or $9992, it's in the sprite copy loop */ if (prevpc == 0x99f8 || prevpc == 0x9992) @@ -256,7 +256,7 @@ READ16_MEMBER(offtwall_state::spritecache_count_r) READ16_MEMBER(offtwall_state::unknown_verify_r) { - int prevpc = cpu_get_previouspc(&space.device()); + int prevpc = space.device().safe_pcbase(); if (prevpc < 0x5c5e || prevpc > 0xc432) return m_unknown_verify_base[offset]; else diff --git a/src/mame/drivers/ojankohs.c b/src/mame/drivers/ojankohs.c index 593ea8f4b50..7f370f6bbd2 100644 --- a/src/mame/drivers/ojankohs.c +++ b/src/mame/drivers/ojankohs.c @@ -127,7 +127,7 @@ READ8_MEMBER(ojankohs_state::ojankohs_keymatrix_r) ret &= ioport("KEY4")->read(); break; default: ret = 0xff; - logerror("PC:%04X unknown %02X\n", cpu_get_pc(&space.device()), m_portselect); + logerror("PC:%04X unknown %02X\n", space.device().safe_pc(), m_portselect); break; } diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c index cb648b0987f..7d2d8df5caa 100644 --- a/src/mame/drivers/opwolf.c +++ b/src/mame/drivers/opwolf.c @@ -501,7 +501,7 @@ WRITE8_MEMBER(opwolf_state::opwolf_adpcm_b_w) msm5205_reset_w(device, 0); } -// logerror("CPU #1 b00%i-data=%2x pc=%4x\n",offset,data,cpu_get_pc(&space->device()) ); +// logerror("CPU #1 b00%i-data=%2x pc=%4x\n",offset,data,space->device().safe_pc() ); } @@ -524,18 +524,18 @@ WRITE8_MEMBER(opwolf_state::opwolf_adpcm_c_w) msm5205_reset_w(device, 0); } -// logerror("CPU #1 c00%i-data=%2x pc=%4x\n",offset,data,cpu_get_pc(&space->device()) ); +// logerror("CPU #1 c00%i-data=%2x pc=%4x\n",offset,data,space->device().safe_pc() ); } WRITE8_MEMBER(opwolf_state::opwolf_adpcm_d_w) { -// logerror("CPU #1 d00%i-data=%2x pc=%4x\n",offset,data,cpu_get_pc(&space.device()) ); +// logerror("CPU #1 d00%i-data=%2x pc=%4x\n",offset,data,space.device().safe_pc() ); } WRITE8_MEMBER(opwolf_state::opwolf_adpcm_e_w) { -// logerror("CPU #1 e00%i-data=%2x pc=%4x\n",offset,data,cpu_get_pc(&space.device()) ); +// logerror("CPU #1 e00%i-data=%2x pc=%4x\n",offset,data,space.device().safe_pc() ); } static ADDRESS_MAP_START( opwolf_sound_z80_map, AS_PROGRAM, 8, opwolf_state ) diff --git a/src/mame/drivers/overdriv.c b/src/mame/drivers/overdriv.c index f8f37fb36b4..2513f2710dd 100644 --- a/src/mame/drivers/overdriv.c +++ b/src/mame/drivers/overdriv.c @@ -64,7 +64,7 @@ static const eeprom_interface eeprom_intf = WRITE16_MEMBER(overdriv_state::eeprom_w) { -//logerror("%06x: write %04x to eeprom_w\n",cpu_get_pc(&space.device()),data); +//logerror("%06x: write %04x to eeprom_w\n",space.device().safe_pc(),data); if (ACCESSING_BITS_0_7) { /* bit 0 is data */ @@ -109,7 +109,7 @@ WRITE16_MEMBER(overdriv_state::cpuA_ctrl_w) coin_counter_w(machine(), 0, data & 0x10); coin_counter_w(machine(), 1, data & 0x20); -//logerror("%06x: write %04x to cpuA_ctrl_w\n",cpu_get_pc(&space.device()),data); +//logerror("%06x: write %04x to cpuA_ctrl_w\n",space.device().safe_pc(),data); } } diff --git a/src/mame/drivers/pacman.c b/src/mame/drivers/pacman.c index 56991765fbc..b56cd429d16 100644 --- a/src/mame/drivers/pacman.c +++ b/src/mame/drivers/pacman.c @@ -572,7 +572,7 @@ READ8_MEMBER(pacman_state::alibaba_mystery_2_r) READ8_MEMBER(pacman_state::maketrax_special_port2_r) { int data = ioport("DSW1")->read(); - int pc = cpu_get_previouspc(&space.device()); + int pc = space.device().safe_pcbase(); if ((pc == 0x1973) || (pc == 0x2389)) return data | 0x40; @@ -592,7 +592,7 @@ READ8_MEMBER(pacman_state::maketrax_special_port2_r) READ8_MEMBER(pacman_state::maketrax_special_port3_r) { - int pc = cpu_get_previouspc(&space.device()); + int pc = space.device().safe_pcbase(); if (pc == 0x040e) return 0x20; @@ -614,7 +614,7 @@ READ8_MEMBER(pacman_state::maketrax_special_port3_r) READ8_MEMBER(pacman_state::korosuke_special_port2_r) { int data = ioport("DSW1")->read(); - int pc = cpu_get_previouspc(&space.device()); + int pc = space.device().safe_pcbase(); if ((pc == 0x196e) || (pc == 0x2387)) return data | 0x40; @@ -634,7 +634,7 @@ READ8_MEMBER(pacman_state::korosuke_special_port2_r) READ8_MEMBER(pacman_state::korosuke_special_port3_r) { - int pc = cpu_get_previouspc(&space.device()); + int pc = space.device().safe_pcbase(); if (pc == 0x0445) return 0x20; @@ -710,7 +710,7 @@ WRITE8_MEMBER(pacman_state::porky_banking_w) READ8_MEMBER(pacman_state::drivfrcp_port1_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0030: case 0x0291: @@ -722,7 +722,7 @@ READ8_MEMBER(pacman_state::drivfrcp_port1_r) READ8_MEMBER(pacman_state::_8bpm_port1_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0030: case 0x0466: @@ -734,7 +734,7 @@ READ8_MEMBER(pacman_state::_8bpm_port1_r) READ8_MEMBER(pacman_state::porky_port1_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0034: return 0x01; @@ -6125,7 +6125,7 @@ READ8_MEMBER(pacman_state::cannonbp_protection_r) switch (offset) { default: - logerror("CPU0 %04x: Unhandled protection read, offset %04x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU0 %04x: Unhandled protection read, offset %04x\n", space.device().safe_pc(), offset); return 0x00; case 0x0000: // unknown @@ -6148,7 +6148,7 @@ READ8_MEMBER(pacman_state::cannonbp_protection_r) m_cannonb_bit_to_read = 7; return 0x00; case 0x0001: // affects the ball hitting the blocks as well as jump address after bonus round - if (cpu_get_pc(&space.device()) == 0x2b97) + if (space.device().safe_pc() == 0x2b97) return (BIT(0x46, m_cannonb_bit_to_read--) << 7); else return 0xff; /* value taken from the bootlegs */ diff --git a/src/mame/drivers/pandoras.c b/src/mame/drivers/pandoras.c index af0d2695625..96b9c723968 100644 --- a/src/mame/drivers/pandoras.c +++ b/src/mame/drivers/pandoras.c @@ -82,7 +82,7 @@ WRITE8_MEMBER(pandoras_state::pandoras_int_control_w) case 0x07: device_set_input_line(m_subcpu, INPUT_LINE_NMI, PULSE_LINE); break; - default: logerror("%04x: (irq_ctrl) write %02x to %02x\n",cpu_get_pc(&space.device()), data, offset); + default: logerror("%04x: (irq_ctrl) write %02x to %02x\n",space.device().safe_pc(), data, offset); break; } } diff --git a/src/mame/drivers/paradise.c b/src/mame/drivers/paradise.c index 1aa6122af90..3f750289661 100644 --- a/src/mame/drivers/paradise.c +++ b/src/mame/drivers/paradise.c @@ -99,7 +99,7 @@ WRITE8_MEMBER(paradise_state::paradise_rombank_w) if (bank >= bank_n) { - logerror("PC %04X - invalid rom bank %x\n", cpu_get_pc(&space.device()), bank); + logerror("PC %04X - invalid rom bank %x\n", space.device().safe_pc(), bank); bank %= bank_n; } diff --git a/src/mame/drivers/parodius.c b/src/mame/drivers/parodius.c index 8bf231b1795..220e06b1053 100644 --- a/src/mame/drivers/parodius.c +++ b/src/mame/drivers/parodius.c @@ -76,7 +76,7 @@ WRITE8_MEMBER(parodius_state::parodius_videobank_w) { if (m_videobank & 0xf8) - logerror("%04x: videobank = %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: videobank = %02x\n",space.device().safe_pc(),data); /* bit 0 = select palette or work RAM at 0000-07ff */ /* bit 1 = select 052109 or 053245 at 2000-27ff */ @@ -88,7 +88,7 @@ WRITE8_MEMBER(parodius_state::parodius_3fc0_w) { if ((data & 0xf4) != 0x10) - logerror("%04x: 3fc0 = %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: 3fc0 = %02x\n",space.device().safe_pc(),data); /* bit 0/1 = coin counters */ coin_counter_w(machine(), 0, data & 0x01); @@ -427,7 +427,7 @@ ROM_END static KONAMI_SETLINES_CALLBACK( parodius_banking ) { if (lines & 0xf0) - logerror("%04x: setlines %02x\n", cpu_get_pc(device), lines); + logerror("%04x: setlines %02x\n", device->safe_pc(), lines); device->machine().root_device().membank("bank1")->set_entry((lines & 0x0f) ^ 0x0f); } diff --git a/src/mame/drivers/pasha2.c b/src/mame/drivers/pasha2.c index 5cbcea658fc..20aa3af6b48 100644 --- a/src/mame/drivers/pasha2.c +++ b/src/mame/drivers/pasha2.c @@ -476,7 +476,7 @@ ROM_END READ16_MEMBER(pasha2_state::pasha2_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x8302) + if(space.device().safe_pc() == 0x8302) device_spin_until_interrupt(&space.device()); return m_wram[(0x95744 / 2) + offset]; diff --git a/src/mame/drivers/pbaction.c b/src/mame/drivers/pbaction.c index c3b51b834ee..944e5a7298f 100644 --- a/src/mame/drivers/pbaction.c +++ b/src/mame/drivers/pbaction.c @@ -472,7 +472,7 @@ READ8_MEMBER(pbaction_state::pbactio3_prot_kludge_r) { /* on startup, the game expect this location to NOT act as RAM */ - if (cpu_get_pc(&space.device()) == 0xab80) + if (space.device().safe_pc() == 0xab80) return 0; return m_work_ram[0]; diff --git a/src/mame/drivers/pcat_nit.c b/src/mame/drivers/pcat_nit.c index 1febc80abb0..4316ae11d36 100644 --- a/src/mame/drivers/pcat_nit.c +++ b/src/mame/drivers/pcat_nit.c @@ -151,7 +151,7 @@ static const microtouch_serial_interface pcat_nit_microtouch_interface = WRITE8_MEMBER(pcat_nit_state::pcat_nit_rombank_w) { - logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(&space.device()) ); + logerror( "rom bank #%02x at PC=%08X\n", data, space.device().safe_pc() ); if ( data & 0x40 ) { // rom bank diff --git a/src/mame/drivers/pcxt.c b/src/mame/drivers/pcxt.c index c5c748c4261..d504f1b2438 100644 --- a/src/mame/drivers/pcxt.c +++ b/src/mame/drivers/pcxt.c @@ -166,7 +166,7 @@ static SCREEN_UPDATE_RGB32( tetriskr ) READ8_MEMBER(pcxt_state::disk_iobank_r) { - //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,cpu_get_pc(&space.device())); + //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,space.device().safe_pc()); //if(offset == 0) return ioport("DSW")->read(); if(offset == 1) return ioport("IN1")->read(); @@ -386,7 +386,7 @@ static I8255A_INTERFACE( ppi8255_1_intf ) READ8_MEMBER(pcxt_state::fdc765_status_r) { UINT8 tmp; -// popmessage("Read FDC status @ PC=%05x",cpu_get_pc(&space.device())); +// popmessage("Read FDC status @ PC=%05x",space.device().safe_pc()); tmp = m_status | 0x80; m_clr_status++; if(m_clr_status == 0x10) diff --git a/src/mame/drivers/pgm.c b/src/mame/drivers/pgm.c index 5bfc6038eb8..7287e1503a7 100644 --- a/src/mame/drivers/pgm.c +++ b/src/mame/drivers/pgm.c @@ -224,7 +224,7 @@ READ16_MEMBER(pgm_state::z80_ram_r) WRITE16_MEMBER(pgm_state::z80_ram_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (ACCESSING_BITS_8_15) m_z80_mainram[offset * 2] = data >> 8; @@ -233,14 +233,14 @@ WRITE16_MEMBER(pgm_state::z80_ram_w) if (pc != 0xf12 && pc != 0xde2 && pc != 0x100c50 && pc != 0x100b20) if (PGMLOGERROR) - logerror("Z80: write %04x, %04x @ %04x (%06x)\n", offset * 2, data, mem_mask, cpu_get_pc(&space.device())); + logerror("Z80: write %04x, %04x @ %04x (%06x)\n", offset * 2, data, mem_mask, space.device().safe_pc()); } WRITE16_MEMBER(pgm_state::z80_reset_w) { if (PGMLOGERROR) - logerror("Z80: reset %04x @ %04x (%06x)\n", data, mem_mask, cpu_get_pc(&space.device())); + logerror("Z80: reset %04x @ %04x (%06x)\n", data, mem_mask, space.device().safe_pc()); if (data == 0x5050) { @@ -266,7 +266,7 @@ WRITE16_MEMBER(pgm_state::z80_reset_w) WRITE16_MEMBER(pgm_state::z80_ctrl_w) { if (PGMLOGERROR) - logerror("Z80: ctrl %04x @ %04x (%06x)\n", data, mem_mask, cpu_get_pc(&space.device())); + logerror("Z80: ctrl %04x @ %04x (%06x)\n", data, mem_mask, space.device().safe_pc()); } WRITE16_MEMBER(pgm_state::m68k_l1_w) @@ -275,7 +275,7 @@ WRITE16_MEMBER(pgm_state::m68k_l1_w) if(ACCESSING_BITS_0_7) { if (PGMLOGERROR) - logerror("SL 1 m68.w %02x (%06x) IRQ\n", data & 0xff, cpu_get_pc(&space.device())); + logerror("SL 1 m68.w %02x (%06x) IRQ\n", data & 0xff, space.device().safe_pc()); soundlatch_byte_w(space, 0, data); device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE ); } @@ -284,7 +284,7 @@ WRITE16_MEMBER(pgm_state::m68k_l1_w) WRITE8_MEMBER(pgm_state::z80_l3_w) { if (PGMLOGERROR) - logerror("SL 3 z80.w %02x (%04x)\n", data, cpu_get_pc(&space.device())); + logerror("SL 3 z80.w %02x (%04x)\n", data, space.device().safe_pc()); soundlatch3_byte_w(space, 0, data); } diff --git a/src/mame/drivers/pirates.c b/src/mame/drivers/pirates.c index 91034f00163..fa84f67e52d 100644 --- a/src/mame/drivers/pirates.c +++ b/src/mame/drivers/pirates.c @@ -123,7 +123,7 @@ WRITE16_MEMBER(pirates_state::pirates_out_w) /* bit 7 used (function unknown) */ } -// logerror("%06x: out_w %04x\n",cpu_get_pc(&space.device()),data); +// logerror("%06x: out_w %04x\n",space.device().safe_pc(),data); } CUSTOM_INPUT_MEMBER(pirates_state::prot_r) @@ -139,7 +139,7 @@ CUSTOM_INPUT_MEMBER(pirates_state::prot_r) 602e and 62a6 */ /* For Genix, see 6576 for setting values and 67c2,d3b4 and dbc2 for tests. */ - pc = cpu_get_pc(machine().device("main")); + pc = machine().device("main")->safe_pc(); if (pc == 0x6134) { bit = prot & 1; diff --git a/src/mame/drivers/pktgaldx.c b/src/mame/drivers/pktgaldx.c index c1f7f6d29b3..a9b7bbd262b 100644 --- a/src/mame/drivers/pktgaldx.c +++ b/src/mame/drivers/pktgaldx.c @@ -104,7 +104,7 @@ READ16_MEMBER(pktgaldx_state::pckgaldx_unknown_r) READ16_MEMBER(pktgaldx_state::pckgaldx_protection_r) { - logerror("pckgaldx_protection_r address %06x\n",cpu_get_pc(&space.device())); + logerror("pckgaldx_protection_r address %06x\n",space.device().safe_pc()); return -1; } diff --git a/src/mame/drivers/playmark.c b/src/mame/drivers/playmark.c index 59c951a8e2b..0f3338a0a1d 100644 --- a/src/mame/drivers/playmark.c +++ b/src/mame/drivers/playmark.c @@ -135,12 +135,12 @@ READ8_MEMBER(playmark_state::playmark_snd_command_r) if ((m_oki_control & 0x38) == 0x30) { data = m_snd_command; - // logerror("PC$%03x PortB reading %02x from the 68K\n", cpu_get_previouspc(&space.device()), data); + // logerror("PC$%03x PortB reading %02x from the 68K\n", space.device().safe_pcbase(), data); } else if ((m_oki_control & 0x38) == 0x28) { data = (m_oki->read(space, 0) & 0x0f); - // logerror("PC$%03x PortB reading %02x from the OKI status port\n", cpu_get_previouspc(&space.device()), data); + // logerror("PC$%03x PortB reading %02x from the OKI status port\n", space.device().safe_pcbase(), data); } return data; @@ -200,7 +200,7 @@ WRITE8_MEMBER(playmark_state::playmark_snd_control_w) if ((data & 0x38) == 0x18) { - // logerror("PC$%03x Writing %02x to OKI1, PortC=%02x, Code=%02x\n",cpu_get_previouspc(&space.device()),playmark_oki_command,playmark_oki_control,playmark_snd_command); + // logerror("PC$%03x Writing %02x to OKI1, PortC=%02x, Code=%02x\n",space.device().safe_pcbase(),playmark_oki_command,playmark_oki_control,playmark_snd_command); okim6295_device *oki = machine().device("oki"); oki->write(space, 0, m_oki_command); } diff --git a/src/mame/drivers/pluto5.c b/src/mame/drivers/pluto5.c index 86b8500db2f..3aeba928ffc 100644 --- a/src/mame/drivers/pluto5.c +++ b/src/mame/drivers/pluto5.c @@ -202,7 +202,7 @@ public: READ32_MEMBER(pluto5_state::pluto5_mem_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_maincpu, offset * 4); switch ( cs ) @@ -220,7 +220,7 @@ READ32_MEMBER(pluto5_state::pluto5_mem_r) WRITE32_MEMBER(pluto5_state::pluto5_mem_w) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); int cs = m68340_get_cs(m_maincpu, offset * 4); switch ( cs ) diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index d83dd6b6b2f..d79e6e4a22e 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -200,7 +200,7 @@ READ32_MEMBER(polygonet_state::dsp_host_interface_r) if (mem_mask == 0x0000ff00) { value <<= 8; } if (mem_mask == 0xff000000) { value <<= 24; } - logerror("Dsp HI Read (host-side) %08x (HI %04x) = %08x (@%x)\n", mem_mask, hi_addr, value, cpu_get_pc(&space.device())); + logerror("Dsp HI Read (host-side) %08x (HI %04x) = %08x (@%x)\n", mem_mask, hi_addr, value, space.device().safe_pc()); return value; } @@ -214,13 +214,13 @@ WRITE32_MEMBER(polygonet_state::shared_ram_write) { logerror("68k WRITING %04x to shared ram %x (@%x)\n", (m_shared_ram[offset] & 0xffff0000) >> 16, 0xc000 + (offset<<1), - cpu_get_pc(&space.device())); + space.device().safe_pc()); } else if (mem_mask == 0x0000ffff) { logerror("68k WRITING %04x to shared ram %x (@%x)\n", (m_shared_ram[offset] & 0x0000ffff), 0xc000 +((offset<<1)+1), - cpu_get_pc(&space.device())); + space.device().safe_pc()); } else { @@ -229,7 +229,7 @@ WRITE32_MEMBER(polygonet_state::shared_ram_write) 0xc000 + (offset<<1), 0xc000 +((offset<<1)+1), mem_mask, - cpu_get_pc(&space.device())); + space.device().safe_pc()); } /* write to the current dsp56k word */ diff --git a/src/mame/drivers/pntnpuzl.c b/src/mame/drivers/pntnpuzl.c index 56f37a8f389..630d2b02055 100644 --- a/src/mame/drivers/pntnpuzl.c +++ b/src/mame/drivers/pntnpuzl.c @@ -231,7 +231,7 @@ WRITE16_MEMBER(pntnpuzl_state::pntnpuzl_200000_w) WRITE16_MEMBER(pntnpuzl_state::pntnpuzl_280018_w) { -// logerror("%04x: 280018: %04x\n",cpu_get_pc(&space.device()),data); +// logerror("%04x: 280018: %04x\n",space.device().safe_pc(),data); m_serial >>= 1; if (data & 0x2000) m_serial |= 0x400; diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c index 40f0c18a9d3..dd9136072e7 100644 --- a/src/mame/drivers/polepos.c +++ b/src/mame/drivers/polepos.c @@ -259,7 +259,7 @@ READ16_MEMBER(polepos_state::polepos2_ic25_r) m_last_result = (INT8)m_last_signed * (UINT8)m_last_unsigned; } -// logerror("%04X: read IC25 @ %04X = %02X\n", cpu_get_pc(&space.device()), offset, result); +// logerror("%04X: read IC25 @ %04X = %02X\n", space.device().safe_pc(), offset, result); return result | (result << 8); } diff --git a/src/mame/drivers/policetr.c b/src/mame/drivers/policetr.c index 8d395995847..2183101b89a 100644 --- a/src/mame/drivers/policetr.c +++ b/src/mame/drivers/policetr.c @@ -152,7 +152,7 @@ WRITE32_MEMBER(policetr_state::control_w) /* log any unknown bits */ if (data & 0x4f1fffff) - logerror("%08X: control_w = %08X & %08X\n", cpu_get_previouspc(&space.device()), data, mem_mask); + logerror("%08X: control_w = %08X & %08X\n", space.device().safe_pcbase(), data, mem_mask); } @@ -203,7 +203,7 @@ WRITE32_MEMBER(policetr_state::speedup_w) COMBINE_DATA(m_speedup_data); /* see if the PC matches */ - if ((cpu_get_previouspc(&space.device()) & 0x1fffffff) == m_speedup_pc) + if ((space.device().safe_pcbase() & 0x1fffffff) == m_speedup_pc) { UINT64 curr_cycles = machine().firstcpu->total_cycles(); diff --git a/src/mame/drivers/ppmast93.c b/src/mame/drivers/ppmast93.c index c7637094af6..1f5c3ef4581 100644 --- a/src/mame/drivers/ppmast93.c +++ b/src/mame/drivers/ppmast93.c @@ -218,7 +218,7 @@ WRITE8_MEMBER(ppmast93_state::ppmast_sound_w) case 0: case 1: ym2413_w(machine().device("ymsnd"),offset,data); break; case 2: machine().device("dac")->write_unsigned8(data);break; - default: logerror("%x %x - %x\n",offset,data,cpu_get_previouspc(&space.device())); + default: logerror("%x %x - %x\n",offset,data,space.device().safe_pcbase()); } } diff --git a/src/mame/drivers/psikyo.c b/src/mame/drivers/psikyo.c index b747fbf3d8f..3461fc87298 100644 --- a/src/mame/drivers/psikyo.c +++ b/src/mame/drivers/psikyo.c @@ -127,7 +127,7 @@ READ32_MEMBER(psikyo_state::sngkace_input_r) case 0x0: return ioport("P1_P2")->read(); case 0x1: return ioport("DSW")->read(); case 0x2: return ioport("COIN")->read(); - default: logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset * 2); + default: logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset * 2); return 0; } } @@ -138,7 +138,7 @@ READ32_MEMBER(psikyo_state::gunbird_input_r) { case 0x0: return ioport("P1_P2")->read(); case 0x1: return ioport("DSW")->read(); - default: logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset * 2); + default: logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset * 2); return 0; } } @@ -247,12 +247,12 @@ WRITE32_MEMBER(psikyo_state::s1945_mcu_w) m_s1945_mcu_latching |= 4; break; default: -// logerror("MCU: function %02x, direction %02x, latch1 %02x, latch2 %02x (%x)\n", data, m_s1945_mcu_direction, m_s1945_mcu_latch1, m_s1945_mcu_latch2, cpu_get_pc(&space.device())); +// logerror("MCU: function %02x, direction %02x, latch1 %02x, latch2 %02x (%x)\n", data, m_s1945_mcu_direction, m_s1945_mcu_latch1, m_s1945_mcu_latch2, space.device().safe_pc()); break; } break; default: -// logerror("MCU.w %x, %02x (%x)\n", offset, data, cpu_get_pc(&space.device())); +// logerror("MCU.w %x, %02x (%x)\n", offset, data, space.device().safe_pc()); ; } } @@ -291,7 +291,7 @@ READ32_MEMBER(psikyo_state::s1945_input_r) case 0x0: return ioport("P1_P2")->read(); case 0x1: return (ioport("DSW")->read() & 0xffff000f) | s1945_mcu_r(space, offset - 1, mem_mask); case 0x2: return s1945_mcu_r(space, offset - 1, mem_mask); - default: logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset * 2); + default: logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset * 2); return 0; } } diff --git a/src/mame/drivers/punchout.c b/src/mame/drivers/punchout.c index c55d8e47ce4..7f1c398cec3 100644 --- a/src/mame/drivers/punchout.c +++ b/src/mame/drivers/punchout.c @@ -154,7 +154,7 @@ WRITE8_MEMBER(punchout_state::punchout_2a03_reset_w) READ8_MEMBER(punchout_state::spunchout_rp5c01_r) { - logerror("%04x: prot_r %x\n", cpu_get_previouspc(&space.device()), offset); + logerror("%04x: prot_r %x\n", space.device().safe_pcbase(), offset); if (offset <= 0x0c) { @@ -266,7 +266,7 @@ WRITE8_MEMBER(punchout_state::spunchout_rp5c01_w) { data &= 0x0f; - logerror("%04x: prot_w %x = %02x\n",cpu_get_previouspc(&space.device()),offset,data); + logerror("%04x: prot_w %x = %02x\n",space.device().safe_pcbase(),offset,data); if (offset <= 0x0c) { @@ -301,7 +301,7 @@ READ8_MEMBER(punchout_state::spunchout_exp_r) /* PC = 0x0313 */ /* (ret or 0x10) -> (D7DF),(D7A0) - (D7DF),(D7A0) = 0d0h(ret nc) */ - if (cpu_get_previouspc(&space.device()) == 0x0313) + if (space.device().safe_pcbase() == 0x0313) ret |= 0xc0; return ret; diff --git a/src/mame/drivers/qdrmfgp.c b/src/mame/drivers/qdrmfgp.c index 1dbf28830a3..f17d46860e0 100644 --- a/src/mame/drivers/qdrmfgp.c +++ b/src/mame/drivers/qdrmfgp.c @@ -239,7 +239,7 @@ READ16_MEMBER(qdrmfgp_state::gp2_ide_std_r) { if (offset == 0x07) { - switch (cpu_get_previouspc(&space.device())) + switch (space.device().safe_pcbase()) { case 0xdb4c: if ((m_workram[0x5fa4/2] - cpu_get_reg(&space.device(), M68K_D0)) <= 0x10) diff --git a/src/mame/drivers/quizo.c b/src/mame/drivers/quizo.c index e75a0517d43..2c87d921d2f 100644 --- a/src/mame/drivers/quizo.c +++ b/src/mame/drivers/quizo.c @@ -126,7 +126,7 @@ WRITE8_MEMBER(quizo_state::port60_w) { if(data>9) { - logerror("ROMBANK %x @ %x\n", data, cpu_get_pc(&space.device())); + logerror("ROMBANK %x @ %x\n", data, space.device().safe_pc()); data=0; } m_port60=data; diff --git a/src/mame/drivers/quizpun2.c b/src/mame/drivers/quizpun2.c index 4d24ad74841..d00f7a574b4 100644 --- a/src/mame/drivers/quizpun2.c +++ b/src/mame/drivers/quizpun2.c @@ -204,7 +204,7 @@ static void log_protection( address_space *space, const char *warning ) { quizpun2_state *state = space->machine().driver_data(); struct prot_t &prot = state->m_prot; - logerror("%04x: protection - %s (state %x, wait %x, param %02x, cmd %02x, addr %02x)\n", cpu_get_pc(&space->device()), warning, + logerror("%04x: protection - %s (state %x, wait %x, param %02x, cmd %02x, addr %02x)\n", space->device().safe_pc(), warning, prot.state, prot.wait_param, prot.param, diff --git a/src/mame/drivers/r2dtank.c b/src/mame/drivers/r2dtank.c index 468cf6c3c0e..7c2c3f44e18 100644 --- a/src/mame/drivers/r2dtank.c +++ b/src/mame/drivers/r2dtank.c @@ -117,7 +117,7 @@ READ8_MEMBER(r2dtank_state::audio_command_r) { UINT8 ret = soundlatch_byte_r(space, 0); -if (LOG_AUDIO_COMM) logerror("%08X CPU#1 Audio Command Read: %x\n", cpu_get_pc(&space.device()), ret); +if (LOG_AUDIO_COMM) logerror("%08X CPU#1 Audio Command Read: %x\n", space.device().safe_pc(), ret); return ret; } @@ -128,14 +128,14 @@ WRITE8_MEMBER(r2dtank_state::audio_command_w) soundlatch_byte_w(space, 0, ~data); cputag_set_input_line(machine(), "audiocpu", M6800_IRQ_LINE, HOLD_LINE); -if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Command Write: %x\n", cpu_get_pc(&space.device()), data^0xff); +if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Command Write: %x\n", space.device().safe_pc(), data^0xff); } READ8_MEMBER(r2dtank_state::audio_answer_r) { UINT8 ret = soundlatch2_byte_r(space, 0); -if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Answer Read: %x\n", cpu_get_pc(&space.device()), ret); +if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Answer Read: %x\n", space.device().safe_pc(), ret); return ret; } @@ -144,13 +144,13 @@ if (LOG_AUDIO_COMM) logerror("%08X CPU#0 Audio Answer Read: %x\n", cpu_get_pc( WRITE8_MEMBER(r2dtank_state::audio_answer_w) { /* HACK - prevents lock-up, but causes game to end some in-between sreens prematurely */ - if (cpu_get_pc(&space.device()) == 0xfb12) + if (space.device().safe_pc() == 0xfb12) data = 0x00; soundlatch2_byte_w(space, 0, data); cputag_set_input_line(machine(), "maincpu", M6809_IRQ_LINE, HOLD_LINE); -if (LOG_AUDIO_COMM) logerror("%08X CPU#1 Audio Answer Write: %x\n", cpu_get_pc(&space.device()), data); +if (LOG_AUDIO_COMM) logerror("%08X CPU#1 Audio Answer Write: %x\n", space.device().safe_pc(), data); } diff --git a/src/mame/drivers/raiden.c b/src/mame/drivers/raiden.c index d3adc97f878..f1a1593cefb 100644 --- a/src/mame/drivers/raiden.c +++ b/src/mame/drivers/raiden.c @@ -555,7 +555,7 @@ ROM_END #ifdef SYNC_HACK READ16_MEMBER(raiden_state::sub_cpu_spin_r) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); int ret=m_shared_ram[0x4]; // main set diff --git a/src/mame/drivers/realbrk.c b/src/mame/drivers/realbrk.c index 3883110e84e..31ebefc18be 100644 --- a/src/mame/drivers/realbrk.c +++ b/src/mame/drivers/realbrk.c @@ -63,7 +63,7 @@ READ16_MEMBER(realbrk_state::realbrk_dsw_r) ((ioport("SW3")->read() & 0x0300) << 4) | ((ioport("SW4")->read() & 0x0300) << 6) ; - logerror("CPU #0 PC %06X: read with unknown dsw_select = %02x\n",cpu_get_pc(&space.device()),m_dsw_select[0]); + logerror("CPU #0 PC %06X: read with unknown dsw_select = %02x\n",space.device().safe_pc(),m_dsw_select[0]); return 0xffff; } @@ -123,7 +123,7 @@ READ16_MEMBER(realbrk_state::backup_ram_r) { /*TODO: understand the format & cmds of the backup-ram,maybe it's an unemulated tmp68301 feature?*/ - if(cpu_get_previouspc(&space.device()) == 0x02c08e) + if(space.device().safe_pcbase() == 0x02c08e) return 0xffff; else return m_backup_ram[offset]; @@ -134,7 +134,7 @@ READ16_MEMBER(realbrk_state::backup_ram_dx_r) { /*TODO: understand the format & cmds of the backup-ram,maybe it's an unemulated tmp68301 feature?*/ - if(cpu_get_previouspc(&space.device()) == 0x02f046) + if(space.device().safe_pcbase() == 0x02f046) return 0xffff; else return m_backup_ram[offset]; diff --git a/src/mame/drivers/rmhaihai.c b/src/mame/drivers/rmhaihai.c index c3d3573f56d..af889d2bf96 100644 --- a/src/mame/drivers/rmhaihai.c +++ b/src/mame/drivers/rmhaihai.c @@ -103,8 +103,8 @@ READ8_MEMBER(rmhaihai_state::keyboard_r) { static const char *const keynames[] = { "KEY0", "KEY1" }; - logerror("%04x: keyboard_r\n",cpu_get_pc(&space.device())); - switch(cpu_get_pc(&space.device())) + logerror("%04x: keyboard_r\n",space.device().safe_pc()); + switch(space.device().safe_pc()) { /* read keyboard */ case 0x0aba: // rmhaihai, rmhaisei @@ -151,7 +151,7 @@ READ8_MEMBER(rmhaihai_state::keyboard_r) WRITE8_MEMBER(rmhaihai_state::keyboard_w) { -logerror("%04x: keyboard_w %02x\n",cpu_get_pc(&space.device()),data); +logerror("%04x: keyboard_w %02x\n",space.device().safe_pc(),data); m_keyboard_cmd = data; } diff --git a/src/mame/drivers/rollerg.c b/src/mame/drivers/rollerg.c index 3c6b3524191..0d8b90ba129 100644 --- a/src/mame/drivers/rollerg.c +++ b/src/mame/drivers/rollerg.c @@ -24,7 +24,7 @@ static KONAMI_SETLINES_CALLBACK( rollerg_banking ); WRITE8_MEMBER(rollerg_state::rollerg_0010_w) { - logerror("%04x: write %02x to 0010\n",cpu_get_pc(&space.device()), data); + logerror("%04x: write %02x to 0010\n",space.device().safe_pc(), data); /* bits 0/1 are coin counters */ coin_counter_w(machine(), 0, data & 0x01); diff --git a/src/mame/drivers/roul.c b/src/mame/drivers/roul.c index b046db14ca2..aedc6ca135c 100644 --- a/src/mame/drivers/roul.c +++ b/src/mame/drivers/roul.c @@ -120,7 +120,7 @@ bit 7 -> blitter ready bit 6 -> ??? (after unknown blitter command : [80][80][08][02]) */ // return 0x80; // blitter ready -// logerror("Read unknown port $f5 at %04x\n",cpu_get_pc(&space.device())); +// logerror("Read unknown port $f5 at %04x\n",space.device().safe_pc()); return machine().rand() & 0x00c0; } diff --git a/src/mame/drivers/route16.c b/src/mame/drivers/route16.c index 87faf56069c..36b612220a3 100644 --- a/src/mame/drivers/route16.c +++ b/src/mame/drivers/route16.c @@ -941,9 +941,9 @@ ROM_END READ8_MEMBER(route16_state::routex_prot_read) { - if (cpu_get_pc(&space.device()) == 0x2f) return 0xfb; + if (space.device().safe_pc() == 0x2f) return 0xfb; - logerror ("cpu '%s' (PC=%08X): unmapped prot read\n", space.device().tag(), cpu_get_pc(&space.device())); + logerror ("cpu '%s' (PC=%08X): unmapped prot read\n", space.device().tag(), space.device().safe_pc()); return 0x00; } diff --git a/src/mame/drivers/royalmah.c b/src/mame/drivers/royalmah.c index d8e31b1dd93..5a46941d914 100644 --- a/src/mame/drivers/royalmah.c +++ b/src/mame/drivers/royalmah.c @@ -395,7 +395,7 @@ WRITE8_MEMBER(royalmah_state::suzume_bank_w) m_suzume_bank = data; -logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data); +logerror("%04x: bank %02x\n",space.device().safe_pc(),data); /* bits 6, 4 and 3 used for something input related? */ @@ -430,7 +430,7 @@ WRITE8_MEMBER(royalmah_state::tontonb_bank_w) UINT8 *rom = memregion("maincpu")->base(); int address; -logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data); +logerror("%04x: bank %02x\n",space.device().safe_pc(),data); if (data == 0) return; // tontonb fix? @@ -448,7 +448,7 @@ WRITE8_MEMBER(royalmah_state::dynax_bank_w) UINT8 *rom = memregion("maincpu")->base(); int address; -//logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: bank %02x\n",space.device().safe_pc(),data); m_dsw_select = data & 0x60; @@ -896,7 +896,7 @@ READ8_MEMBER(royalmah_state::mjifb_rom_io_r) case 0x9011: return ioport("SYSTEM")->read(); } - logerror("%04X: unmapped input read at %04X\n", cpu_get_pc(&space.device()), offset); + logerror("%04X: unmapped input read at %04X\n", space.device().safe_pc(), offset); return 0xff; } @@ -925,7 +925,7 @@ WRITE8_MEMBER(royalmah_state::mjifb_rom_io_w) return; } - logerror("%04X: unmapped input write at %04X = %02X\n", cpu_get_pc(&space.device()), offset,data); + logerror("%04X: unmapped input write at %04X = %02X\n", space.device().safe_pc(), offset,data); } WRITE8_MEMBER(royalmah_state::mjifb_videoram_w) @@ -1005,7 +1005,7 @@ READ8_MEMBER(royalmah_state::mjdejavu_rom_io_r) case 0x9011: return ioport("SYSTEM")->read(); } - logerror("%04X: unmapped input read at %04X\n", cpu_get_pc(&space.device()), offset); + logerror("%04X: unmapped input read at %04X\n", space.device().safe_pc(), offset); return 0xff; } @@ -1031,7 +1031,7 @@ WRITE8_MEMBER(royalmah_state::mjdejavu_rom_io_w) return; } - logerror("%04X: unmapped input write at %04X = %02X\n", cpu_get_pc(&space.device()), offset,data); + logerror("%04X: unmapped input write at %04X = %02X\n", space.device().safe_pc(), offset,data); } static ADDRESS_MAP_START( mjdejavu_map, AS_PROGRAM, 8, royalmah_state ) @@ -1123,7 +1123,7 @@ READ8_MEMBER(royalmah_state::cafetime_dsw_r) case 0x03: return ioport("DSW4")->read(); case 0x04: return ioport("DSWTOP")->read(); } - logerror("%04X: unmapped dsw read %02X\n", cpu_get_pc(&space.device()), m_dsw_select); + logerror("%04X: unmapped dsw read %02X\n", space.device().safe_pc(), m_dsw_select); return 0xff; } @@ -1192,7 +1192,7 @@ READ8_MEMBER(royalmah_state::mjvegasa_rom_io_r) return rtc->read(space, offset & 0xf); } - logerror("%04X: unmapped IO read at %04X\n", cpu_get_pc(&space.device()), offset); + logerror("%04X: unmapped IO read at %04X\n", space.device().safe_pc(), offset); return 0xff; } @@ -1215,7 +1215,7 @@ WRITE8_MEMBER(royalmah_state::mjvegasa_rom_io_w) return; } - logerror("%04X: unmapped IO write at %04X = %02X\n", cpu_get_pc(&space.device()), offset,data); + logerror("%04X: unmapped IO write at %04X = %02X\n", space.device().safe_pc(), offset,data); } WRITE8_MEMBER(royalmah_state::mjvegasa_coin_counter_w) diff --git a/src/mame/drivers/sandscrp.c b/src/mame/drivers/sandscrp.c index 0872500ceea..a6b316be4b3 100644 --- a/src/mame/drivers/sandscrp.c +++ b/src/mame/drivers/sandscrp.c @@ -291,7 +291,7 @@ WRITE8_MEMBER(sandscrp_state::sandscrp_bankswitch_w) UINT8 *RAM = memregion("maincpu")->base(); int bank = data & 0x07; - if ( bank != data ) logerror("CPU #1 - PC %04X: Bank %02X\n",cpu_get_pc(&space.device()),data); + if ( bank != data ) logerror("CPU #1 - PC %04X: Bank %02X\n",space.device().safe_pc(),data); if (bank < 3) RAM = &RAM[0x4000 * bank]; else RAM = &RAM[0x4000 * (bank-3) + 0x10000]; diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index 66477fd0193..c4fe82c3d03 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -290,11 +290,11 @@ static READ32_HANDLER( saturn_scu_r ) { case 0x5c/4: // Super Major League and Shin Megami Tensei - Akuma Zensho reads from there (undocumented), DMA status mirror? - if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(&space->device())); + if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",space->device().safe_pc()); res = state->m_scu_regs[0x7c/4]; break; case 0x7c/4: - if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(&space->device())); + if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",space->device().safe_pc()); res = state->m_scu_regs[offset]; break; case 0x80/4: @@ -305,19 +305,19 @@ static READ32_HANDLER( saturn_scu_r ) res = dsp_ram_addr_r(); break; case 0xa0/4: - if(LOG_SCU) logerror("(PC=%08x) IRQ mask reg read %08x MASK=%08x\n",cpu_get_pc(&space->device()),mem_mask,state->m_scu_regs[0xa0/4]); + if(LOG_SCU) logerror("(PC=%08x) IRQ mask reg read %08x MASK=%08x\n",space->device().safe_pc(),mem_mask,state->m_scu_regs[0xa0/4]); res = state->m_scu.ism; break; case 0xa4/4: - if(LOG_SCU) logerror("(PC=%08x) IRQ status reg read %08x MASK=%08x\n",cpu_get_pc(&space->device()),mem_mask,state->m_scu_regs[0xa0/4]); + if(LOG_SCU) logerror("(PC=%08x) IRQ status reg read %08x MASK=%08x\n",space->device().safe_pc(),mem_mask,state->m_scu_regs[0xa0/4]); res = state->m_scu.ist; break; case 0xc8/4: - logerror("(PC=%08x) SCU version reg read\n",cpu_get_pc(&space->device())); + logerror("(PC=%08x) SCU version reg read\n",space->device().safe_pc()); res = 0x00000004;/*SCU Version 4, OK? */ break; default: - if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",cpu_get_pc(&space->device()),offset,state->m_scu_regs[offset]); + if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",space->device().safe_pc(),offset,state->m_scu_regs[offset]); res = state->m_scu_regs[offset]; break; } @@ -393,7 +393,7 @@ static WRITE32_HANDLER( saturn_scu_w ) scu_test_pending_irq(space->machine()); break; case 0xa4/4: /* IRQ control */ - if(LOG_SCU) logerror("PC=%08x IRQ status reg set:%08x %08x\n",cpu_get_pc(&space->device()),state->m_scu_regs[41],mem_mask); + if(LOG_SCU) logerror("PC=%08x IRQ status reg set:%08x %08x\n",space->device().safe_pc(),state->m_scu_regs[41],mem_mask); state->m_scu.ist &= state->m_scu_regs[offset]; break; case 0xa8/4: if(LOG_SCU) logerror("A-Bus IRQ ACK %08x\n",state->m_scu_regs[42]); break; @@ -643,7 +643,7 @@ static WRITE32_HANDLER( minit_w ) { saturn_state *state = space->machine().driver_data(); - //logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->device().tag(), cpu_get_pc(&space->device()),data); + //logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->device().tag(), space->device().safe_pc(),data); space->machine().scheduler().boost_interleave(state->m_minit_boost_timeslice, attotime::from_usec(state->m_minit_boost)); space->machine().scheduler().trigger(1000); sh2_set_frt_input(state->m_slave, PULSE_LINE); @@ -653,7 +653,7 @@ static WRITE32_HANDLER( sinit_w ) { saturn_state *state = space->machine().driver_data(); - //logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->device().tag(), cpu_get_pc(&space->device()),data); + //logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->device().tag(), space->device().safe_pc(),data); space->machine().scheduler().boost_interleave(state->m_sinit_boost_timeslice, attotime::from_usec(state->m_sinit_boost)); sh2_set_frt_input(state->m_maincpu, PULSE_LINE); } diff --git a/src/mame/drivers/scramble.c b/src/mame/drivers/scramble.c index c7e67373738..c598a5428e9 100644 --- a/src/mame/drivers/scramble.c +++ b/src/mame/drivers/scramble.c @@ -322,7 +322,7 @@ ADDRESS_MAP_END READ8_MEMBER(scramble_state::hncholms_prot_r) { - if(cpu_get_pc(&space.device()) == 0x2b || cpu_get_pc(&space.device()) == 0xa27) + if(space.device().safe_pc() == 0x2b || space.device().safe_pc() == 0xa27) return 1; else return 0; diff --git a/src/mame/drivers/sderby.c b/src/mame/drivers/sderby.c index 49562135889..b126a408dd3 100644 --- a/src/mame/drivers/sderby.c +++ b/src/mame/drivers/sderby.c @@ -82,7 +82,7 @@ READ16_MEMBER(sderby_state::sderby_input_r) return 0xffff; // to avoid game to reset (needs more work) } - logerror("sderby_input_r : offset = %x - PC = %06x\n",offset*2,cpu_get_pc(&space.device())); + logerror("sderby_input_r : offset = %x - PC = %06x\n",offset*2,space.device().safe_pc()); return 0xffff; } @@ -126,7 +126,7 @@ READ16_MEMBER(sderby_state::roulette_input_r) READ16_MEMBER(sderby_state::rprot_r) { - logerror("rprot_r : offset = %02x\n",cpu_get_pc(&space.device())); + logerror("rprot_r : offset = %02x\n",space.device().safe_pc()); /* This is the only mask I found that allow a normal play. Using other values, the game hangs waiting for response, diff --git a/src/mame/drivers/seattle.c b/src/mame/drivers/seattle.c index c07136766b2..4c2c9a04636 100644 --- a/src/mame/drivers/seattle.c +++ b/src/mame/drivers/seattle.c @@ -818,7 +818,7 @@ static UINT32 pci_bridge_r(address_space *space, UINT8 reg, UINT8 type) } if (LOG_PCI) - logerror("%08X:PCI bridge read: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, result); + logerror("%08X:PCI bridge read: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, result); return result; } @@ -828,7 +828,7 @@ static void pci_bridge_w(address_space *space, UINT8 reg, UINT8 type, UINT32 dat seattle_state *state = space->machine().driver_data(); state->m_galileo.pci_bridge_regs[reg] = data; if (LOG_PCI) - logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, data); + logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, data); } @@ -856,7 +856,7 @@ static UINT32 pci_3dfx_r(address_space *space, UINT8 reg, UINT8 type) } if (LOG_PCI) - logerror("%08X:PCI 3dfx read: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, result); + logerror("%08X:PCI 3dfx read: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, result); return result; } @@ -879,7 +879,7 @@ static void pci_3dfx_w(address_space *space, UINT8 reg, UINT8 type, UINT32 data) break; } if (LOG_PCI) - logerror("%08X:PCI 3dfx write: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, data); + logerror("%08X:PCI 3dfx write: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, data); } @@ -907,7 +907,7 @@ static UINT32 pci_ide_r(address_space *space, UINT8 reg, UINT8 type) } if (LOG_PCI) - logerror("%08X:PCI IDE read: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, result); + logerror("%08X:PCI IDE read: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, result); return result; } @@ -917,7 +917,7 @@ static void pci_ide_w(address_space *space, UINT8 reg, UINT8 type, UINT32 data) seattle_state *state = space->machine().driver_data(); state->m_galileo.pci_ide_regs[reg] = data; if (LOG_PCI) - logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, data); + logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, data); } @@ -1153,7 +1153,7 @@ READ32_MEMBER(seattle_state::galileo_r) device_eat_cycles(&space.device(), 100); if (LOG_TIMERS) - logerror("%08X:hires_timer_r = %08X\n", cpu_get_pc(&space.device()), result); + logerror("%08X:hires_timer_r = %08X\n", space.device().safe_pc(), result); break; } @@ -1186,7 +1186,7 @@ READ32_MEMBER(seattle_state::galileo_r) else { result = ~0; - logerror("%08X:PCIBus read: bus %d unit %d func %d reg %d type %d = %08X\n", cpu_get_pc(&space.device()), bus, unit, func, reg, type, result); + logerror("%08X:PCIBus read: bus %d unit %d func %d reg %d type %d = %08X\n", space.device().safe_pc(), bus, unit, func, reg, type, result); } break; } @@ -1196,11 +1196,11 @@ READ32_MEMBER(seattle_state::galileo_r) case GREG_INT_MASK: case GREG_TIMER_CONTROL: // if (LOG_GALILEO) -// logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space.device()), offset*4, result); +// logerror("%08X:Galileo read from offset %03X = %08X\n", space.device().safe_pc(), offset*4, result); break; default: - logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space.device()), offset*4, result); + logerror("%08X:Galileo read from offset %03X = %08X\n", space.device().safe_pc(), offset*4, result); break; } @@ -1225,7 +1225,7 @@ WRITE32_MEMBER(seattle_state::galileo_w) int which = offset % 4; if (LOG_DMA) - logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask); + logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); /* keep the read only activity bit */ galileo.reg[offset] &= ~0x4000; @@ -1255,7 +1255,7 @@ WRITE32_MEMBER(seattle_state::galileo_w) if (!timer->active) timer->count = data; if (LOG_TIMERS) - logerror("%08X:timer/counter %d count = %08X [start=%08X]\n", cpu_get_pc(&space.device()), offset % 4, data, timer->count); + logerror("%08X:timer/counter %d count = %08X [start=%08X]\n", space.device().safe_pc(), offset % 4, data, timer->count); break; } @@ -1264,7 +1264,7 @@ WRITE32_MEMBER(seattle_state::galileo_w) int which, mask; if (LOG_TIMERS) - logerror("%08X:timer/counter control = %08X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:timer/counter control = %08X\n", space.device().safe_pc(), data); for (which = 0, mask = 0x01; which < 4; which++, mask <<= 2) { galileo_timer *timer = &galileo.timer[which]; @@ -1323,7 +1323,7 @@ WRITE32_MEMBER(seattle_state::galileo_w) /* anything else, just log */ else - logerror("%08X:PCIBus write: bus %d unit %d func %d reg %d type %d = %08X\n", cpu_get_pc(&space.device()), bus, unit, func, reg, type, data); + logerror("%08X:PCIBus write: bus %d unit %d func %d reg %d type %d = %08X\n", space.device().safe_pc(), bus, unit, func, reg, type, data); break; } @@ -1334,11 +1334,11 @@ WRITE32_MEMBER(seattle_state::galileo_w) case GREG_CONFIG_ADDRESS: case GREG_INT_MASK: if (LOG_GALILEO) - logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask); + logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); break; default: - logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask); + logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); break; } } @@ -1372,7 +1372,7 @@ WRITE32_MEMBER(seattle_state::seattle_voodoo_w) /* spin until we send the magic trigger */ device_spin_until_trigger(&space.device(), 45678); - if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo (already stalled)\n", cpu_get_pc(&space.device())); + if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo (already stalled)\n", space.device().safe_pc()); } @@ -1392,7 +1392,7 @@ static void voodoo_stall(device_t *device, int stall) } else { - if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo\n", cpu_get_pc(device->machine().device("maincpu"))); + if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo\n", device->machine().device("maincpu")->safe_pc()); device_spin_until_trigger(device->machine().device("maincpu"), 45678); } } @@ -1451,7 +1451,7 @@ WRITE32_MEMBER(seattle_state::analog_port_w) static const char *const portnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5", "AN6", "AN7" }; if (data < 8 || data > 15) - logerror("%08X:Unexpected analog port select = %08X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Unexpected analog port select = %08X\n", space.device().safe_pc(), data); m_pending_analog_read = ioport(portnames[data & 7])->read(); } diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index 74a38cec962..5f9ea9ac781 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -497,7 +497,7 @@ static WRITE16_HANDLER( control_w ) static READ16_HANDLER( prot_r ) { segac2_state *state = space->machine().driver_data(); - if (LOG_PROTECTION) logerror("%06X:protection r=%02X\n", cpu_get_previouspc(&space->device()), state->m_prot_func ? state->m_prot_read_buf : 0xff); + if (LOG_PROTECTION) logerror("%06X:protection r=%02X\n", space->device().safe_pcbase(), state->m_prot_func ? state->m_prot_read_buf : 0xff); return state->m_prot_read_buf | 0xf0; } @@ -523,7 +523,7 @@ static WRITE16_HANDLER( prot_w ) /* determine the value to return, should a read occur */ if (state->m_prot_func) state->m_prot_read_buf = state->m_prot_func(table_index); - if (LOG_PROTECTION) logerror("%06X:protection w=%02X, new result=%02X\n", cpu_get_previouspc(&space->device()), data & 0x0f, state->m_prot_read_buf); + if (LOG_PROTECTION) logerror("%06X:protection w=%02X, new result=%02X\n", space->device().safe_pcbase(), data & 0x0f, state->m_prot_read_buf); /* if the palette changed, force an update */ if (new_sp_palbase != state->m_sp_palbase || new_bg_palbase != state->m_bg_palbase) diff --git a/src/mame/drivers/segag80r.c b/src/mame/drivers/segag80r.c index da6e2213fe4..3015352fc18 100644 --- a/src/mame/drivers/segag80r.c +++ b/src/mame/drivers/segag80r.c @@ -171,7 +171,7 @@ static offs_t decrypt_offset(address_space *space, offs_t offset) segag80r_state *state = space->machine().driver_data(); /* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */ - offs_t pc = cpu_get_previouspc(&space->device()); + offs_t pc = space->device().safe_pcbase(); if ((UINT16)pc == 0xffff || space->read_byte(pc) != 0x32) return offset; diff --git a/src/mame/drivers/segag80v.c b/src/mame/drivers/segag80v.c index cec3a3a602e..41818897f9d 100644 --- a/src/mame/drivers/segag80v.c +++ b/src/mame/drivers/segag80v.c @@ -190,7 +190,7 @@ static offs_t decrypt_offset(address_space *space, offs_t offset) segag80v_state *state = space->machine().driver_data(); /* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */ - offs_t pc = cpu_get_previouspc(&space->device()); + offs_t pc = space->device().safe_pcbase(); if ((UINT16)pc == 0xffff || space->read_byte(pc) != 0x32) return offset; @@ -361,7 +361,7 @@ WRITE8_MEMBER(segag80v_state::unknown_w) /* writing an 0x04 here enables interrupts */ /* some games write 0x00/0x01 here as well */ if (data != 0x00 && data != 0x01 && data != 0x04) - mame_printf_debug("%04X:unknown_w = %02X\n", cpu_get_pc(&space.device()), data); + mame_printf_debug("%04X:unknown_w = %02X\n", space.device().safe_pc(), data); } diff --git a/src/mame/drivers/segald.c b/src/mame/drivers/segald.c index c0233f80e83..9820b7ef6ee 100644 --- a/src/mame/drivers/segald.c +++ b/src/mame/drivers/segald.c @@ -125,7 +125,7 @@ READ8_MEMBER(segald_state::astron_DISC_read) if (m_nmi_enable) m_ldv1000_input_latch = m_laserdisc->status_r(); - logerror("DISC read (0x%04x) @ 0x%04x [0x%x]\n", m_ldv1000_input_latch, offset, cpu_get_pc(&space.device())); + logerror("DISC read (0x%04x) @ 0x%04x [0x%x]\n", m_ldv1000_input_latch, offset, space.device().safe_pc()); return m_ldv1000_input_latch; } @@ -133,21 +133,21 @@ READ8_MEMBER(segald_state::astron_DISC_read) READ8_MEMBER(segald_state::astron_OUT_read) { - logerror("OUT read (0x%04x) @ 0x%04x [0x%x]\n", m_out_ram[offset], offset, cpu_get_pc(&space.device())); + logerror("OUT read (0x%04x) @ 0x%04x [0x%x]\n", m_out_ram[offset], offset, space.device().safe_pc()); return m_out_ram[offset]; } READ8_MEMBER(segald_state::astron_OBJ_read) { - logerror("OBJ read (0x%04x) @ 0x%04x [0x%x]\n", m_obj_ram[offset], offset, cpu_get_pc(&space.device())); + logerror("OBJ read (0x%04x) @ 0x%04x [0x%x]\n", m_obj_ram[offset], offset, space.device().safe_pc()); return m_obj_ram[offset]; } READ8_MEMBER(segald_state::astron_COLOR_read) { - logerror("COLOR read (0x%04x) @ 0x%04x [0x%x]\n", m_color_ram[offset], offset, cpu_get_pc(&space.device())); + logerror("COLOR read (0x%04x) @ 0x%04x [0x%x]\n", m_color_ram[offset], offset, space.device().safe_pc()); return m_color_ram[offset]; } @@ -156,7 +156,7 @@ READ8_MEMBER(segald_state::astron_COLOR_read) WRITE8_MEMBER(segald_state::astron_DISC_write) { - logerror("DISC write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device())); + logerror("DISC write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, space.device().safe_pc()); m_ldv1000_output_latch = data; @@ -167,7 +167,7 @@ WRITE8_MEMBER(segald_state::astron_DISC_write) WRITE8_MEMBER(segald_state::astron_OUT_write) { - logerror("OUT write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device())); + logerror("OUT write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, space.device().safe_pc()); switch(offset) { @@ -205,7 +205,7 @@ WRITE8_MEMBER(segald_state::astron_OBJ_write) { m_obj_ram[offset] = data; - logerror("OBJ write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device())); + logerror("OBJ write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, space.device().safe_pc()); } WRITE8_MEMBER(segald_state::astron_COLOR_write) @@ -228,14 +228,14 @@ WRITE8_MEMBER(segald_state::astron_COLOR_write) a = (highBits & 0x80) ? 0 : 255; palette_set_color(machine(), palIndex, MAKE_ARGB(a, r, g, b)); - logerror("COLOR write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device())); + logerror("COLOR write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, space.device().safe_pc()); } WRITE8_MEMBER(segald_state::astron_FIX_write) { m_fix_ram[offset] = data; - /* logerror("FIX write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device())); */ + /* logerror("FIX write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, space.device().safe_pc()); */ } WRITE8_MEMBER(segald_state::astron_io_bankswitch_w) diff --git a/src/mame/drivers/segaorun.c b/src/mame/drivers/segaorun.c index 6c078d78246..d6d27c5a51e 100644 --- a/src/mame/drivers/segaorun.c +++ b/src/mame/drivers/segaorun.c @@ -483,7 +483,7 @@ READ16_MEMBER( segaorun_state::misc_io_r ) { if (!m_custom_io_r.isnull()) return m_custom_io_r(space, offset, mem_mask); - logerror("%06X:misc_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2); + logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); return open_bus_r(space, 0, mem_mask); } @@ -499,7 +499,7 @@ WRITE16_MEMBER( segaorun_state::misc_io_w ) m_custom_io_w(space, offset, data, mem_mask); return; } - logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask); + logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask); } @@ -656,7 +656,7 @@ READ16_MEMBER( segaorun_state::outrun_custom_io_r ) return watchdog_reset_r(space, 0); } - logerror("%06X:outrun_custom_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2); + logerror("%06X:outrun_custom_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); return open_bus_r(space, 0, mem_mask); } @@ -698,7 +698,7 @@ WRITE16_MEMBER( segaorun_state::outrun_custom_io_w ) m_sprites->draw_write(space, offset, data, mem_mask); return; } - logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask); + logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask); } @@ -727,7 +727,7 @@ READ16_MEMBER( segaorun_state::shangon_custom_io_r ) return ioport(ports[m_adc_select])->read_safe(0x0010); } } - logerror("%06X:misc_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2); + logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); return open_bus_r(space,0,mem_mask); } @@ -764,7 +764,7 @@ WRITE16_MEMBER( segaorun_state::shangon_custom_io_w ) // ADC trigger return; } - logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask); + logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask); } diff --git a/src/mame/drivers/segas16b.c b/src/mame/drivers/segas16b.c index e2044870641..e28163cc728 100644 --- a/src/mame/drivers/segas16b.c +++ b/src/mame/drivers/segas16b.c @@ -1124,7 +1124,7 @@ READ16_MEMBER( segas16b_state::standard_io_r ) case 0x2000/2: return ioport((offset & 1) ? "DSW1" : "DSW2")->read(); } - logerror("%06X:standard_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2); + logerror("%06X:standard_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); return open_bus_r(space, 0, mem_mask); } @@ -1159,7 +1159,7 @@ WRITE16_MEMBER( segas16b_state::standard_io_w ) coin_counter_w(machine(), 0, data & 0x01); return; } - logerror("%06X:standard_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask); + logerror("%06X:standard_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask); } diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index 4ac04112469..472b521d14b 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -341,7 +341,7 @@ READ16_MEMBER( segas18_state::misc_io_r ) } if (!m_custom_io_r.isnull()) return m_custom_io_r(space, offset, mem_mask); - logerror("%06X:misc_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2); + logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); return open_bus_r(space, 0, mem_mask); } @@ -375,7 +375,7 @@ WRITE16_MEMBER( segas18_state::misc_io_w ) m_custom_io_w(space, offset, data, mem_mask); return; } - logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask); + logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask); } diff --git a/src/mame/drivers/segas24.c b/src/mame/drivers/segas24.c index 98a2bda45a7..a1bd6dab928 100644 --- a/src/mame/drivers/segas24.c +++ b/src/mame/drivers/segas24.c @@ -669,13 +669,13 @@ READ16_MEMBER( segas24_state::hotrod3_ctrl_r ) READ16_MEMBER( segas24_state::iod_r ) { - logerror("IO daughterboard read %02x (%x)\n", offset, cpu_get_pc(&space.device())); + logerror("IO daughterboard read %02x (%x)\n", offset, space.device().safe_pc()); return 0xffff; } WRITE16_MEMBER( segas24_state::iod_w ) { - logerror("IO daughterboard write %02x, %04x & %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device())); + logerror("IO daughterboard write %02x, %04x & %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc()); } @@ -783,7 +783,7 @@ WRITE16_MEMBER( segas24_state::mlatch_w ) int i; UINT8 mxor = 0; if(!mlatch_table) { - logerror("Protection: magic latch accessed but no table loaded (%s:%x)\n", space.device().tag(), cpu_get_pc(&space.device())); + logerror("Protection: magic latch accessed but no table loaded (%s:%x)\n", space.device().tag(), space.device().safe_pc()); return; } @@ -794,9 +794,9 @@ WRITE16_MEMBER( segas24_state::mlatch_w ) if(mlatch & (1<device().tag(), cpu_get_pc(&space->device())); + // logerror("IO read %02x (%s:%x)\n", offset, space->device().tag(), space->device().safe_pc()); if(offset < 8) return (this->*io_r)(offset); else if (offset < 0x20) { @@ -1049,7 +1049,7 @@ READ16_MEMBER ( segas24_state::sys16_io_r ) case 0xf: return io_dir; default: - logerror("IO control read %02x (%s:%x)\n", offset, space.device().tag(), cpu_get_pc(&space.device())); + logerror("IO control read %02x (%s:%x)\n", offset, space.device().tag(), space.device().safe_pc()); return 0xff; } } else @@ -1061,7 +1061,7 @@ WRITE16_MEMBER( segas24_state::sys16_io_w ) if(ACCESSING_BITS_0_7) { if(offset < 8) { if(!(io_dir & (1 << offset))) { - logerror("IO port write on input-only port (%d, [%02x], %02x, %s:%x)\n", offset, io_dir, data & 0xff, space.device().tag(), cpu_get_pc(&space.device())); + logerror("IO port write on input-only port (%d, [%02x], %02x, %s:%x)\n", offset, io_dir, data & 0xff, space.device().tag(), space.device().safe_pc()); return; } (this->*io_w)(offset, data); @@ -1075,7 +1075,7 @@ WRITE16_MEMBER( segas24_state::sys16_io_w ) io_dir = data; break; default: - logerror("IO control write %02x, %02x (%s:%x)\n", offset, data & 0xff, space.device().tag(), cpu_get_pc(&space.device())); + logerror("IO control write %02x, %02x (%s:%x)\n", offset, data & 0xff, space.device().tag(), space.device().safe_pc()); } } } diff --git a/src/mame/drivers/segas32.c b/src/mame/drivers/segas32.c index c79d19ff4e7..ef65c4a84ed 100644 --- a/src/mame/drivers/segas32.c +++ b/src/mame/drivers/segas32.c @@ -452,7 +452,7 @@ static void int_control_w(address_space *space, int offset, UINT8 data) segas32_state *state = space->machine().driver_data(); int duration; -// logerror("%06X:int_control_w(%X) = %02X\n", cpu_get_pc(&space->device()), offset, data); +// logerror("%06X:int_control_w(%X) = %02X\n", space->device().safe_pc(), offset, data); switch (offset) { case 0: @@ -765,7 +765,7 @@ READ16_MEMBER(segas32_state::io_expansion_r) if (!m_custom_io_r[0].isnull()) return (m_custom_io_r[0])(space, offset, mem_mask); else - logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:io_expansion_r(%X)\n", space.device().safe_pc(), offset); return 0xffff; } @@ -779,7 +779,7 @@ WRITE16_MEMBER(segas32_state::io_expansion_w) if (!m_custom_io_w[0].isnull()) (m_custom_io_w[0])(space, offset, data, mem_mask); else - logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff); + logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff); } @@ -789,7 +789,7 @@ READ32_MEMBER(segas32_state::io_expansion_0_r) return (m_custom_io_r[0])(space, offset*2+0, mem_mask) | ((m_custom_io_r[0])(space, offset*2+1, mem_mask >> 16) << 16); else - logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:io_expansion_r(%X)\n", space.device().safe_pc(), offset); return 0xffffffff; } @@ -808,7 +808,7 @@ WRITE32_MEMBER(segas32_state::io_expansion_0_w) if (!m_custom_io_w[0].isnull()) (m_custom_io_w[0])(space, offset*2+0, data, mem_mask); else - logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff); + logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff); } if (ACCESSING_BITS_16_23) @@ -816,7 +816,7 @@ WRITE32_MEMBER(segas32_state::io_expansion_0_w) if (!m_custom_io_w[0].isnull()) (m_custom_io_w[0])(space, offset*2+1, data >> 16, mem_mask >> 16); else - logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff); + logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff); } } @@ -827,7 +827,7 @@ READ32_MEMBER(segas32_state::io_expansion_1_r) return (m_custom_io_r[1])(space, offset*2+0, mem_mask) | ((m_custom_io_r[1])(space, offset*2+1, mem_mask >> 16) << 16); else - logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset); + logerror("%06X:io_expansion_r(%X)\n", space.device().safe_pc(), offset); return 0xffffffff; } @@ -840,14 +840,14 @@ WRITE32_MEMBER(segas32_state::io_expansion_1_w) if (!m_custom_io_w[1].isnull()) (m_custom_io_w[1])(space, offset*2+0, data, mem_mask); else - logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff); + logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff); } if (ACCESSING_BITS_16_23) { if (!m_custom_io_w[1].isnull()) (m_custom_io_w[1])(space, offset*2+1, data >> 16, mem_mask >> 16); else - logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff); + logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff); } } @@ -872,7 +872,7 @@ READ16_MEMBER(segas32_state::analog_custom_io_r) m_analog_value[offset & 3] <<= 1; return result; } - logerror("%06X:unknown analog_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask); + logerror("%06X:unknown analog_custom_io_r(%X) & %04X\n", space.device().safe_pc(), offset*2, mem_mask); return 0xffff; } @@ -889,7 +889,7 @@ WRITE16_MEMBER(segas32_state::analog_custom_io_w) m_analog_value[offset & 3] = ioport(names[offset & 3])->read_safe(0); return; } - logerror("%06X:unknown analog_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask); + logerror("%06X:unknown analog_custom_io_w(%X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask); } @@ -905,7 +905,7 @@ READ16_MEMBER(segas32_state::extra_custom_io_r) return ioport(names[offset & 3])->read_safe(0xffff); } - logerror("%06X:unknown extra_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask); + logerror("%06X:unknown extra_custom_io_r(%X) & %04X\n", space.device().safe_pc(), offset*2, mem_mask); return 0xffff; } @@ -926,7 +926,7 @@ WRITE16_MEMBER(segas32_state::orunners_custom_io_w) m_analog_bank = data & 1; return; } - logerror("%06X:unknown orunners_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask); + logerror("%06X:unknown orunners_custom_io_w(%X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask); } @@ -945,7 +945,7 @@ READ16_MEMBER(segas32_state::sonic_custom_io_r) return (UINT8)(ioport(names[offset/2])->read() - m_sonic_last[offset/2]); } - logerror("%06X:unknown sonic_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask); + logerror("%06X:unknown sonic_custom_io_r(%X) & %04X\n", space.device().safe_pc(), offset*2, mem_mask); return 0xffff; } @@ -964,7 +964,7 @@ WRITE16_MEMBER(segas32_state::sonic_custom_io_w) return; } - logerror("%06X:unknown sonic_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask); + logerror("%06X:unknown sonic_custom_io_w(%X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask); } @@ -977,7 +977,7 @@ WRITE16_MEMBER(segas32_state::sonic_custom_io_w) WRITE16_MEMBER(segas32_state::random_number_16_w) { -// mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask); +// mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask); } READ16_MEMBER(segas32_state::random_number_16_r) @@ -987,7 +987,7 @@ READ16_MEMBER(segas32_state::random_number_16_r) WRITE32_MEMBER(segas32_state::random_number_32_w) { -// mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask); +// mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask); } READ32_MEMBER(segas32_state::random_number_32_r) diff --git a/src/mame/drivers/seibuspi.c b/src/mame/drivers/seibuspi.c index 0582b649846..c105e05ccd9 100644 --- a/src/mame/drivers/seibuspi.c +++ b/src/mame/drivers/seibuspi.c @@ -747,7 +747,7 @@ static UINT8 z80_fifoout_pop(address_space *space) UINT8 r; if (state->m_fifoout_wpos == state->m_fifoout_rpos) { - logerror("Sound FIFOOUT underflow at %08X\n", cpu_get_pc(&space->device())); + logerror("Sound FIFOOUT underflow at %08X\n", space->device().safe_pc()); } r = state->m_fifoout_data[state->m_fifoout_rpos++]; if(state->m_fifoout_rpos == FIFO_SIZE) @@ -773,7 +773,7 @@ static void z80_fifoout_push(address_space *space, UINT8 data) } if(state->m_fifoout_wpos == state->m_fifoout_rpos) { - fatalerror("Sound FIFOOUT overflow at %08X\n", cpu_get_pc(&space->device())); + fatalerror("Sound FIFOOUT overflow at %08X\n", space->device().safe_pc()); } state->m_fifoout_read_request = 1; @@ -785,7 +785,7 @@ static UINT8 z80_fifoin_pop(address_space *space) UINT8 r; if (state->m_fifoin_wpos == state->m_fifoin_rpos) { - fatalerror("Sound FIFOIN underflow at %08X\n", cpu_get_pc(&space->device())); + fatalerror("Sound FIFOIN underflow at %08X\n", space->device().safe_pc()); } r = state->m_fifoin_data[state->m_fifoin_rpos++]; if(state->m_fifoin_rpos == FIFO_SIZE) @@ -811,7 +811,7 @@ static void z80_fifoin_push(address_space *space, UINT8 data) } if(state->m_fifoin_wpos == state->m_fifoin_rpos) { - fatalerror("Sound FIFOIN overflow at %08X\n", cpu_get_pc(&space->device())); + fatalerror("Sound FIFOIN overflow at %08X\n", space->device().safe_pc()); } state->m_fifoin_read_request = 1; @@ -1945,25 +1945,25 @@ MACHINE_CONFIG_END READ32_MEMBER(seibuspi_state::senkyu_speedup_r) { - if (cpu_get_pc(&space.device())==0x00305bb2) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x00305bb2) device_spin_until_interrupt(&space.device()); // idle return m_spimainram[(0x0018cb4-0x800)/4]; } READ32_MEMBER(seibuspi_state::senkyua_speedup_r) { - if (cpu_get_pc(&space.device())== 0x30582e) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()== 0x30582e) device_spin_until_interrupt(&space.device()); // idle return m_spimainram[(0x0018c9c-0x800)/4]; } READ32_MEMBER(seibuspi_state::batlball_speedup_r) { -// printf("cpu_get_pc(&space.device()) %06x\n", cpu_get_pc(&space.device())); +// printf("space.device().safe_pc() %06x\n", space.device().safe_pc()); /* batlbalu */ - if (cpu_get_pc(&space.device())==0x00305996) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x00305996) device_spin_until_interrupt(&space.device()); // idle /* batlball */ - if (cpu_get_pc(&space.device())==0x003058aa) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x003058aa) device_spin_until_interrupt(&space.device()); // idle return m_spimainram[(0x0018db4-0x800)/4]; } @@ -1971,21 +1971,21 @@ READ32_MEMBER(seibuspi_state::batlball_speedup_r) READ32_MEMBER(seibuspi_state::rdft_speedup_r) { /* rdft */ - if (cpu_get_pc(&space.device())==0x0203f0a) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0203f0a) device_spin_until_interrupt(&space.device()); // idle /* rdftau */ - if (cpu_get_pc(&space.device())==0x0203f16) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0203f16) device_spin_until_interrupt(&space.device()); // idle /* rdftj */ - if (cpu_get_pc(&space.device())==0x0203f22) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0203f22) device_spin_until_interrupt(&space.device()); // idle /* rdftdi */ - if (cpu_get_pc(&space.device())==0x0203f46) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0203f46) device_spin_until_interrupt(&space.device()); // idle /* rdftu */ - if (cpu_get_pc(&space.device())==0x0203f3a) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0203f3a) device_spin_until_interrupt(&space.device()); // idle -// mame_printf_debug("%08x\n",cpu_get_pc(&space.device())); +// mame_printf_debug("%08x\n",space.device().safe_pc()); return m_spimainram[(0x00298d0-0x800)/4]; } @@ -1993,15 +1993,15 @@ READ32_MEMBER(seibuspi_state::rdft_speedup_r) READ32_MEMBER(seibuspi_state::viprp1_speedup_r) { /* viprp1 */ - if (cpu_get_pc(&space.device())==0x0202769) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0202769) device_spin_until_interrupt(&space.device()); // idle /* viprp1s */ - if (cpu_get_pc(&space.device())==0x02027e9) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x02027e9) device_spin_until_interrupt(&space.device()); // idle /* viprp1ot */ - if (cpu_get_pc(&space.device())==0x02026bd) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x02026bd) device_spin_until_interrupt(&space.device()); // idle -// mame_printf_debug("%08x\n",cpu_get_pc(&space.device())); +// mame_printf_debug("%08x\n",space.device().safe_pc()); return m_spimainram[(0x001e2e0-0x800)/4]; } @@ -2009,8 +2009,8 @@ READ32_MEMBER(seibuspi_state::viprp1_speedup_r) READ32_MEMBER(seibuspi_state::viprp1o_speedup_r) { /* viperp1o */ - if (cpu_get_pc(&space.device())==0x0201f99) device_spin_until_interrupt(&space.device()); // idle -// mame_printf_debug("%08x\n",cpu_get_pc(&space.device())); + if (space.device().safe_pc()==0x0201f99) device_spin_until_interrupt(&space.device()); // idle +// mame_printf_debug("%08x\n",space.device().safe_pc()); return m_spimainram[(0x001d49c-0x800)/4]; } @@ -2018,8 +2018,8 @@ READ32_MEMBER(seibuspi_state::viprp1o_speedup_r) // causes input problems? READ32_MEMBER(seibuspi_state::ejanhs_speedup_r) { -// mame_printf_debug("%08x\n",cpu_get_pc(&space.device())); - if (cpu_get_pc(&space.device())==0x03032c7) device_spin_until_interrupt(&space.device()); // idle +// mame_printf_debug("%08x\n",space.device().safe_pc()); + if (space.device().safe_pc()==0x03032c7) device_spin_until_interrupt(&space.device()); // idle return m_spimainram[(0x002d224-0x800)/4]; } #endif @@ -2028,18 +2028,18 @@ READ32_MEMBER(seibuspi_state::rf2_speedup_r) { /* rdft22kc */ - if (cpu_get_pc(&space.device())==0x0203926) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0203926) device_spin_until_interrupt(&space.device()); // idle /* rdft2, rdft2j */ - if (cpu_get_pc(&space.device())==0x0204372) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0204372) device_spin_until_interrupt(&space.device()); // idle /* rdft2us */ - if (cpu_get_pc(&space.device())==0x020420e) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x020420e) device_spin_until_interrupt(&space.device()); // idle /* rdft2a */ - if (cpu_get_pc(&space.device())==0x0204366) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0204366) device_spin_until_interrupt(&space.device()); // idle -// mame_printf_debug("%08x\n",cpu_get_pc(&space.device())); +// mame_printf_debug("%08x\n",space.device().safe_pc()); return m_spimainram[(0x0282AC-0x800)/4]; } @@ -2047,10 +2047,10 @@ READ32_MEMBER(seibuspi_state::rf2_speedup_r) READ32_MEMBER(seibuspi_state::rfjet_speedup_r) { /* rfjet, rfjetu, rfjeta */ - if (cpu_get_pc(&space.device())==0x0206082) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0206082) device_spin_until_interrupt(&space.device()); // idle /* rfjetus */ - if (cpu_get_pc(&space.device())==0x0205b39) + if (space.device().safe_pc()==0x0205b39) { UINT32 r; device_spin_until_interrupt(&space.device()); // idle @@ -2060,9 +2060,9 @@ READ32_MEMBER(seibuspi_state::rfjet_speedup_r) } /* rfjetj */ - if (cpu_get_pc(&space.device())==0x0205f2e) device_spin_until_interrupt(&space.device()); // idle + if (space.device().safe_pc()==0x0205f2e) device_spin_until_interrupt(&space.device()); // idle -// mame_printf_debug("%08x\n",cpu_get_pc(&space.device())); +// mame_printf_debug("%08x\n",space.device().safe_pc()); return m_spimainram[(0x002894c-0x800)/4]; diff --git a/src/mame/drivers/seicross.c b/src/mame/drivers/seicross.c index 6157fb3cbaa..a5baf0056f0 100644 --- a/src/mame/drivers/seicross.c +++ b/src/mame/drivers/seicross.c @@ -90,7 +90,7 @@ READ8_MEMBER(seicross_state::friskyt_portB_r) WRITE8_MEMBER(seicross_state::friskyt_portB_w) { - //logerror("PC %04x: 8910 port B = %02x\n", cpu_get_pc(&space->device()), data); + //logerror("PC %04x: 8910 port B = %02x\n", space->device().safe_pc(), data); /* bit 0 is IRQ enable */ m_irq_mask = data & 1; diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c index 075c06e1337..8ac8f1ec30f 100644 --- a/src/mame/drivers/seta.c +++ b/src/mame/drivers/seta.c @@ -1392,7 +1392,7 @@ static void uPD71054_update_timer( running_machine &machine, device_t *cpu, int } else { uPD71054->timer[no]->adjust( attotime::never, no); logerror( "CPU #0 PC %06X: uPD71054 error, timer %d duration is 0\n", - (cpu != NULL) ? cpu_get_pc(cpu) : -1, no ); + (cpu != NULL) ? cpu->safe_pc() : -1, no ); } } @@ -1698,7 +1698,7 @@ READ16_MEMBER(seta_state::calibr50_ip_r) case 0x16/2: return (dir2 >> 8); // upper 4 bits of p2 rotation case 0x18/2: return 0xffff; // ? (value's read but not used) default: - logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2); + logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset*2); return 0; } } @@ -2510,7 +2510,7 @@ READ16_MEMBER(seta_state::krzybowl_input_r) case 0xc/2: return dir2y & 0xff; case 0xe/2: return dir2y >> 8; default: - logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2); + logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset*2); return 0; } } @@ -2675,7 +2675,7 @@ READ16_MEMBER(seta_state::kiwame_input_r) case 0x08/2: return 0xffff; default: - logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2); + logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset*2); return 0x0000; } } @@ -2701,12 +2701,12 @@ ADDRESS_MAP_END READ16_MEMBER(seta_state::thunderl_protection_r) { -// logerror("PC %06X - Protection Read\n", cpu_get_pc(&space.device())); +// logerror("PC %06X - Protection Read\n", space.device().safe_pc()); return 0x00dd; } WRITE16_MEMBER(seta_state::thunderl_protection_w) { -// logerror("PC %06X - Protection Written: %04X <- %04X\n", cpu_get_pc(&space.device()), offset*2, data); +// logerror("PC %06X - Protection Written: %04X <- %04X\n", space.device().safe_pc(), offset*2, data); } /* Similar to downtown etc. */ @@ -2872,14 +2872,14 @@ READ16_MEMBER(seta_state::pairlove_prot_r) int retdata; retdata = m_pairslove_protram[offset]; - //mame_printf_debug("pairs love protection? read %06x %04x %04x\n",cpu_get_pc(&space.device()), offset,retdata); + //mame_printf_debug("pairs love protection? read %06x %04x %04x\n",space.device().safe_pc(), offset,retdata); m_pairslove_protram[offset] = m_pairslove_protram_old[offset]; return retdata; } WRITE16_MEMBER(seta_state::pairlove_prot_w) { - //mame_printf_debug("pairs love protection? write %06x %04x %04x\n",cpu_get_pc(&space.device()), offset,data); + //mame_printf_debug("pairs love protection? write %06x %04x %04x\n",space.device().safe_pc(), offset,data); m_pairslove_protram_old[offset] = m_pairslove_protram[offset]; m_pairslove_protram[offset] = data; } @@ -2956,7 +2956,7 @@ READ16_MEMBER(seta_state::inttoote_key_r) case 0x80: return ioport("BET4")->read(); } - logerror("%06X: unknown read, select = %04x\n",cpu_get_pc(&space.device()), *m_inttoote_key_select); + logerror("%06X: unknown read, select = %04x\n",space.device().safe_pc(), *m_inttoote_key_select); return 0xffff; } @@ -10708,12 +10708,12 @@ READ16_MEMBER(seta_state::twineagl_200100_r) { // protection check at boot - logerror("%04x: twineagl_200100_r %d\n",cpu_get_pc(&space.device()),offset); + logerror("%04x: twineagl_200100_r %d\n",space.device().safe_pc(),offset); return m_twineagl_xram[offset]; } WRITE16_MEMBER(seta_state::twineagl_200100_w) { - logerror("%04x: twineagl_200100_w %d = %02x\n",cpu_get_pc(&space.device()),offset,data); + logerror("%04x: twineagl_200100_w %d = %02x\n",space.device().safe_pc(),offset,data); if (ACCESSING_BITS_0_7) { diff --git a/src/mame/drivers/seta2.c b/src/mame/drivers/seta2.c index 204ec4cb844..35a7c940cd4 100644 --- a/src/mame/drivers/seta2.c +++ b/src/mame/drivers/seta2.c @@ -124,7 +124,7 @@ WRITE16_MEMBER(seta2_state::seta2_sound_bank_w) int banks = (machine().root_device().memregion( "x1snd" )->bytes() - 0x100000) / 0x20000; if (data >= banks) { - logerror("CPU #0 PC %06X: invalid sound bank %04X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 PC %06X: invalid sound bank %04X\n",space.device().safe_pc(),data); data %= banks; } memcpy(ROM + offset * 0x20000, ROM + 0x100000 + data * 0x20000, 0x20000); diff --git a/src/mame/drivers/sf.c b/src/mame/drivers/sf.c index 120f3dbf901..8613dfc1fb5 100644 --- a/src/mame/drivers/sf.c +++ b/src/mame/drivers/sf.c @@ -146,7 +146,7 @@ WRITE16_MEMBER(sf_state::protection_w) } default: { - logerror("Write protection at %06x (%04x)\n", cpu_get_pc(&space.device()), data & 0xffff); + logerror("Write protection at %06x (%04x)\n", space.device().safe_pc(), data & 0xffff); logerror("*** Unknown protection %d\n", space.read_byte(0xffc684)); break; } diff --git a/src/mame/drivers/shangha3.c b/src/mame/drivers/shangha3.c index c80ee11811d..184125b488a 100644 --- a/src/mame/drivers/shangha3.c +++ b/src/mame/drivers/shangha3.c @@ -46,13 +46,13 @@ READ16_MEMBER(shangha3_state::shangha3_prot_r) { static const int result[] = { 0x0,0x1,0x3,0x7,0xf,0xe,0xc,0x8,0x0}; - logerror("PC %04x: read 20004e\n",cpu_get_pc(&space.device())); + logerror("PC %04x: read 20004e\n",space.device().safe_pc()); return result[m_prot_count++ % 9]; } WRITE16_MEMBER(shangha3_state::shangha3_prot_w) { - logerror("PC %04x: write %02x to 20004e\n",cpu_get_pc(&space.device()),data); + logerror("PC %04x: write %02x to 20004e\n",space.device().safe_pc(),data); } diff --git a/src/mame/drivers/simpl156.c b/src/mame/drivers/simpl156.c index 509e374463f..819c7a21ab4 100644 --- a/src/mame/drivers/simpl156.c +++ b/src/mame/drivers/simpl156.c @@ -1054,7 +1054,7 @@ DRIVER_INIT_MEMBER(simpl156_state,simpl156) /* Everything seems more stable if we run the CPU speed x4 and use Idle skips.. maybe it has an internal multipler? */ READ32_MEMBER(simpl156_state::joemacr_speedup_r) { - if (cpu_get_pc(&space.device()) == 0x284) + if (space.device().safe_pc() == 0x284) device_spin_until_time(&space.device(), attotime::from_usec(400)); return m_systemram[0x18/4]; } @@ -1068,7 +1068,7 @@ DRIVER_INIT_MEMBER(simpl156_state,joemacr) READ32_MEMBER(simpl156_state::chainrec_speedup_r) { - if (cpu_get_pc(&space.device()) == 0x2d4) + if (space.device().safe_pc() == 0x2d4) device_spin_until_time(&space.device(), attotime::from_usec(400)); return m_systemram[0x18/4]; } @@ -1081,7 +1081,7 @@ DRIVER_INIT_MEMBER(simpl156_state,chainrec) READ32_MEMBER(simpl156_state::prtytime_speedup_r) { - if (cpu_get_pc(&space.device()) == 0x4f0) + if (space.device().safe_pc() == 0x4f0) device_spin_until_time(&space.device(), attotime::from_usec(400)); return m_systemram[0xae0/4]; } @@ -1095,7 +1095,7 @@ DRIVER_INIT_MEMBER(simpl156_state,prtytime) READ32_MEMBER(simpl156_state::charlien_speedup_r) { - if (cpu_get_pc(&space.device()) == 0xc8c8) + if (space.device().safe_pc() == 0xc8c8) device_spin_until_time(&space.device(), attotime::from_usec(400)); return m_systemram[0x10/4]; } @@ -1108,7 +1108,7 @@ DRIVER_INIT_MEMBER(simpl156_state,charlien) READ32_MEMBER(simpl156_state::osman_speedup_r) { - if (cpu_get_pc(&space.device()) == 0x5974) + if (space.device().safe_pc() == 0x5974) device_spin_until_time(&space.device(), attotime::from_usec(400)); return m_systemram[0x10/4]; } diff --git a/src/mame/drivers/slapfght.c b/src/mame/drivers/slapfght.c index 7eea25bf4b6..297e5991990 100644 --- a/src/mame/drivers/slapfght.c +++ b/src/mame/drivers/slapfght.c @@ -1770,10 +1770,10 @@ READ8_MEMBER(slapfght_state::gtstarb1_port_0_read) 6D38: 20 F8 jr nz,$6D32 6D3A: 10 E0 djnz $6D1C */ - if (cpu_get_pc(&space.device()) == 0x6d1e) return 0; - if (cpu_get_pc(&space.device()) == 0x6d24) return 6; - if (cpu_get_pc(&space.device()) == 0x6d2c) return 2; - if (cpu_get_pc(&space.device()) == 0x6d34) return 4; + if (space.device().safe_pc() == 0x6d1e) return 0; + if (space.device().safe_pc() == 0x6d24) return 6; + if (space.device().safe_pc() == 0x6d2c) return 2; + if (space.device().safe_pc() == 0x6d34) return 4; /* The bootleg hangs in the "test mode" before diplaying (wrong) lives settings : 6AD4: DB 00 in a,($00) @@ -1794,11 +1794,11 @@ READ8_MEMBER(slapfght_state::gtstarb1_port_0_read) 6AF7: 20 FA jr nz,$6AF3 This seems to be what used to be the MCU status. */ - if (cpu_get_pc(&space.device()) == 0x6ad6) return 2; /* bit 1 must be ON */ - if (cpu_get_pc(&space.device()) == 0x6ae4) return 2; /* bit 1 must be ON */ - if (cpu_get_pc(&space.device()) == 0x6af5) return 0; /* bit 2 must be OFF */ + if (space.device().safe_pc() == 0x6ad6) return 2; /* bit 1 must be ON */ + if (space.device().safe_pc() == 0x6ae4) return 2; /* bit 1 must be ON */ + if (space.device().safe_pc() == 0x6af5) return 0; /* bit 2 must be OFF */ - logerror("Port Read PC=%04x\n",cpu_get_pc(&space.device())); + logerror("Port Read PC=%04x\n",space.device().safe_pc()); return 0; } diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c index 957a490bfa3..1b7ffc17dfb 100644 --- a/src/mame/drivers/snesb.c +++ b/src/mame/drivers/snesb.c @@ -206,7 +206,7 @@ READ8_MEMBER(snesb_state::sb2b_6a6xxx_r) case 0xfb7: return 0x47; } - logerror("Unknown protection read read %x @ %x\n",offset, cpu_get_pc(&space.device())); + logerror("Unknown protection read read %x @ %x\n",offset, space.device().safe_pc()); return 0; } diff --git a/src/mame/drivers/solomon.c b/src/mame/drivers/solomon.c index 10999e804f1..f1196391d86 100644 --- a/src/mame/drivers/solomon.c +++ b/src/mame/drivers/solomon.c @@ -23,17 +23,17 @@ WRITE8_MEMBER(solomon_state::solomon_sh_command_w) READ8_MEMBER(solomon_state::solomon_0xe603_r) { - if (cpu_get_pc(&space.device()) == 0x161) // all the time .. return 0 to act as before for coin / startup etc. + if (space.device().safe_pc() == 0x161) // all the time .. return 0 to act as before for coin / startup etc. { return 0; } - else if (cpu_get_pc(&space.device()) == 0x4cf0) // stop it clearing the screen at certain scores + else if (space.device().safe_pc() == 0x4cf0) // stop it clearing the screen at certain scores { return (cpu_get_reg(&space.device(), Z80_BC) & 0x08); } else { - mame_printf_debug("unhandled solomon_0xe603_r %04x\n", cpu_get_pc(&space.device())); + mame_printf_debug("unhandled solomon_0xe603_r %04x\n", space.device().safe_pc()); return 0; } } diff --git a/src/mame/drivers/sothello.c b/src/mame/drivers/sothello.c index ce79d97b5d4..165d45dc174 100644 --- a/src/mame/drivers/sothello.c +++ b/src/mame/drivers/sothello.c @@ -214,7 +214,7 @@ static void unlock_shared_ram(address_space *space) } else { - logerror("Sub cpu active! @%x\n",cpu_get_pc(&space->device())); + logerror("Sub cpu active! @%x\n",space->device().safe_pc()); } } diff --git a/src/mame/drivers/spaceg.c b/src/mame/drivers/spaceg.c index e39e4d30855..ec1fab4f4fe 100644 --- a/src/mame/drivers/spaceg.c +++ b/src/mame/drivers/spaceg.c @@ -255,8 +255,8 @@ WRITE8_MEMBER(spaceg_state::zvideoram_w) break; default: - logerror("mode = %02x pc = %04x\n", *m_io9401, cpu_get_pc(&space.device())); - popmessage("mode = %02x pc = %04x\n", *m_io9401, cpu_get_pc(&space.device())); + logerror("mode = %02x pc = %04x\n", *m_io9401, space.device().safe_pc()); + popmessage("mode = %02x pc = %04x\n", *m_io9401, space.device().safe_pc()); return; } diff --git a/src/mame/drivers/spdodgeb.c b/src/mame/drivers/spdodgeb.c index 8a6ade8b7fa..4871b26bb77 100644 --- a/src/mame/drivers/spdodgeb.c +++ b/src/mame/drivers/spdodgeb.c @@ -211,7 +211,7 @@ static void mcu63705_update_inputs(running_machine &machine) READ8_MEMBER(spdodgeb_state::mcu63701_r) { -// logerror("CPU #0 PC %04x: read from port %02x of 63701 data address 3801\n",cpu_get_pc(&space.device()),offset); +// logerror("CPU #0 PC %04x: read from port %02x of 63701 data address 3801\n",space.device().safe_pc(),offset); if (m_mcu63701_command == 0) return 0x6a; else switch (offset) @@ -227,7 +227,7 @@ READ8_MEMBER(spdodgeb_state::mcu63701_r) WRITE8_MEMBER(spdodgeb_state::mcu63701_w) { -// logerror("CPU #0 PC %04x: write %02x to 63701 control address 3800\n",cpu_get_pc(&space.device()),data); +// logerror("CPU #0 PC %04x: write %02x to 63701 control address 3800\n",space.device().safe_pc(),data); m_mcu63701_command = data; mcu63705_update_inputs(machine()); } diff --git a/src/mame/drivers/spoker.c b/src/mame/drivers/spoker.c index 71cad3d4208..ca7519808c3 100644 --- a/src/mame/drivers/spoker.c +++ b/src/mame/drivers/spoker.c @@ -132,7 +132,7 @@ WRITE8_MEMBER(spoker_state::spoker_nmi_and_coins_w) if ((data) & (0x22)) { - logerror("PC %06X: nmi_and_coins = %02x\n",cpu_get_pc(&space.device()),data); + logerror("PC %06X: nmi_and_coins = %02x\n",space.device().safe_pc(),data); // popmessage("%02x",data); } @@ -193,7 +193,7 @@ WRITE8_MEMBER(spoker_state::spoker_magic_w) default: // popmessage("magic %x <- %04x",igs_magic[0],data); - logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0], data); + logerror("%06x: warning, writing to igs_magic %02x = %02x\n", space.device().safe_pc(), m_igs_magic[0], data); } } @@ -208,11 +208,11 @@ READ8_MEMBER(spoker_state::spoker_magic_r) if ( !(m_igs_magic[1] & 0x04) ) return ioport("DSW3")->read(); if ( !(m_igs_magic[1] & 0x08) ) return ioport("DSW4")->read(); if ( !(m_igs_magic[1] & 0x10) ) return ioport("DSW5")->read(); - logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[1]); + logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", space.device().safe_pc(), m_igs_magic[1]); break; default: - logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0]); + logerror("%06x: warning, reading with igs_magic = %02x\n", space.device().safe_pc(), m_igs_magic[0]); } return 0; diff --git a/src/mame/drivers/spy.c b/src/mame/drivers/spy.c index dc01406670e..fe938570ccc 100644 --- a/src/mame/drivers/spy.c +++ b/src/mame/drivers/spy.c @@ -45,12 +45,12 @@ READ8_MEMBER(spy_state::spy_bankedram1_r) { if (m_pmcbank) { - //logerror("%04x read pmcram %04x\n", cpu_get_pc(&space.device()), offset); + //logerror("%04x read pmcram %04x\n", space.device().safe_pc(), offset); return m_pmcram[offset]; } else { - //logerror("%04x read pmc internal ram %04x\n", cpu_get_pc(&space.device()), offset); + //logerror("%04x read pmc internal ram %04x\n", space.device().safe_pc(), offset); return 0; } } @@ -69,11 +69,11 @@ WRITE8_MEMBER(spy_state::spy_bankedram1_w) { if (m_pmcbank) { - //logerror("%04x pmcram %04x = %02x\n", cpu_get_pc(&space.device()), offset, data); + //logerror("%04x pmcram %04x = %02x\n", space.device().safe_pc(), offset, data); m_pmcram[offset] = data; } //else - //logerror("%04x pmc internal ram %04x = %02x\n", cpu_get_pc(&space.device()), offset, data); + //logerror("%04x pmc internal ram %04x = %02x\n", space.device().safe_pc(), offset, data); } else m_ram[offset] = data; @@ -304,7 +304,7 @@ WRITE8_MEMBER(spy_state::spy_3f90_w) /* bit 7 = PMC-BK */ m_pmcbank = (data & 0x80) >> 7; -//logerror("%04x: 3f90_w %02x\n", cpu_get_pc(&space.device()), data); +//logerror("%04x: 3f90_w %02x\n", space.device().safe_pc(), data); /* bit 6 = PMC-START */ if ((data & 0x40) && !(m_old_3f90 & 0x40)) { diff --git a/src/mame/drivers/srmp6.c b/src/mame/drivers/srmp6.c index 4f3ebf866af..b57884c2fa0 100644 --- a/src/mame/drivers/srmp6.c +++ b/src/mame/drivers/srmp6.c @@ -361,7 +361,7 @@ WRITE16_MEMBER(srmp6_state::video_regs_w) case 0x56/2: // written 8,9,8,9 successively default: - logerror("video_regs_w (PC=%06X): %04x = %04x & %04x\n", cpu_get_previouspc(&space.device()), offset*2, data, mem_mask); + logerror("video_regs_w (PC=%06X): %04x = %04x & %04x\n", space.device().safe_pcbase(), offset*2, data, mem_mask); break; } COMBINE_DATA(&m_video_regs[offset]); @@ -370,7 +370,7 @@ WRITE16_MEMBER(srmp6_state::video_regs_w) READ16_MEMBER(srmp6_state::video_regs_r) { - logerror("video_regs_r (PC=%06X): %04x\n", cpu_get_previouspc(&space.device()), offset*2); + logerror("video_regs_r (PC=%06X): %04x\n", space.device().safe_pcbase(), offset*2); return m_video_regs[offset]; } diff --git a/src/mame/drivers/ssfindo.c b/src/mame/drivers/ssfindo.c index 3d1452ecf54..a3dde6d692a 100644 --- a/src/mame/drivers/ssfindo.c +++ b/src/mame/drivers/ssfindo.c @@ -354,17 +354,17 @@ ssfindo_speedup_func ssfindo_speedup; static void ssfindo_speedups(address_space* space) { - if (cpu_get_pc(&space->device())==0x2d6c8) // ssfindo + if (space->device().safe_pc()==0x2d6c8) // ssfindo device_spin_until_time(&space->device(), attotime::from_usec(20)); - else if (cpu_get_pc(&space->device())==0x2d6bc) // ssfindo + else if (space->device().safe_pc()==0x2d6bc) // ssfindo device_spin_until_time(&space->device(), attotime::from_usec(20)); } static void ppcar_speedups(address_space* space) { - if (cpu_get_pc(&space->device())==0x000bc8) // ppcar + if (space->device().safe_pc()==0x000bc8) // ppcar device_spin_until_time(&space->device(), attotime::from_usec(20)); - else if (cpu_get_pc(&space->device())==0x000bbc) // ppcar + else if (space->device().safe_pc()==0x000bbc) // ppcar device_spin_until_time(&space->device(), attotime::from_usec(20)); } @@ -378,7 +378,7 @@ READ32_MEMBER(ssfindo_state::PS7500_IO_r) case IOLINES: //TODO: eeprom 24c01 #if 0 - mame_printf_debug("IOLINESR %i @%x\n", offset, cpu_get_pc(&space.device())); + mame_printf_debug("IOLINESR %i @%x\n", offset, space.device().safe_pc()); #endif if(m_flashType == 1) @@ -434,13 +434,13 @@ WRITE32_MEMBER(ssfindo_state::PS7500_IO_w) if(data&0xc0) m_adrLatch=0; - if(cpu_get_pc(&space.device()) == 0xbac0 && m_flashType == 1) + if(space.device().safe_pc() == 0xbac0 && m_flashType == 1) { m_flashN=data&1; } #if 0 - logerror("IOLINESW %i = %x @%x\n",offset,data,cpu_get_pc(&space.device())); + logerror("IOLINESW %i = %x @%x\n",offset,data,space.device().safe_pc()); #endif break; @@ -520,7 +520,7 @@ WRITE32_MEMBER(ssfindo_state::io_w) COMBINE_DATA(&temp); #if 0 - logerror("[io_w] = %x @%x [latch=%x]\n",data,cpu_get_pc(&space.device()),m_adrLatch); + logerror("[io_w] = %x @%x [latch=%x]\n",data,space.device().safe_pc(),m_adrLatch); #endif if(m_adrLatch==1) diff --git a/src/mame/drivers/sshangha.c b/src/mame/drivers/sshangha.c index 24bc3469a90..90dd901a101 100644 --- a/src/mame/drivers/sshangha.c +++ b/src/mame/drivers/sshangha.c @@ -64,7 +64,7 @@ WRITE16_MEMBER(sshangha_state::sshangha_protection16_w) { COMBINE_DATA(&m_prot_data[offset]); - logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %04x\n",cpu_get_pc(&space.device()),offset<<1,data); + logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %04x\n",space.device().safe_pc(),offset<<1,data); } /* Protection/IO chip 146 */ @@ -82,7 +82,7 @@ READ16_MEMBER(sshangha_state::sshangha_protection16_r) // Protection TODO } - logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",cpu_get_pc(&space.device()),offset<<1); + logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",space.device().safe_pc(),offset<<1); return m_prot_data[offset]; } diff --git a/src/mame/drivers/ssv.c b/src/mame/drivers/ssv.c index 3302629ef05..d5d4c068d27 100644 --- a/src/mame/drivers/ssv.c +++ b/src/mame/drivers/ssv.c @@ -526,7 +526,7 @@ READ16_MEMBER(ssv_state::hypreact_input_r) if (input_sel & 0x0002) return ioport("KEY1")->read(); if (input_sel & 0x0004) return ioport("KEY2")->read(); if (input_sel & 0x0008) return ioport("KEY3")->read(); - logerror("CPU #0 PC %06X: unknown input read: %04X\n",cpu_get_pc(&space.device()),input_sel); + logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel); return 0xffff; } @@ -651,7 +651,7 @@ READ16_MEMBER(ssv_state::srmp4_input_r) if (input_sel & 0x0004) return ioport("KEY1")->read(); if (input_sel & 0x0008) return ioport("KEY2")->read(); if (input_sel & 0x0010) return ioport("KEY3")->read(); - logerror("CPU #0 PC %06X: unknown input read: %04X\n",cpu_get_pc(&space.device()),input_sel); + logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel); return 0xffff; } @@ -699,7 +699,7 @@ READ16_MEMBER(ssv_state::srmp7_input_r) if (input_sel & 0x0004) return ioport("KEY1")->read(); if (input_sel & 0x0008) return ioport("KEY2")->read(); if (input_sel & 0x0010) return ioport("KEY3")->read(); - logerror("CPU #0 PC %06X: unknown input read: %04X\n",cpu_get_pc(&space.device()),input_sel); + logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel); return 0xffff; } diff --git a/src/mame/drivers/stadhero.c b/src/mame/drivers/stadhero.c index edb223d09fd..4df67d5da18 100644 --- a/src/mame/drivers/stadhero.c +++ b/src/mame/drivers/stadhero.c @@ -34,7 +34,7 @@ READ16_MEMBER(stadhero_state::stadhero_control_r) return ioport("DSW")->read(); } - logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",cpu_get_pc(&space.device()),0x30c000+offset); + logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",space.device().safe_pc(),0x30c000+offset); return ~0; } @@ -49,7 +49,7 @@ WRITE16_MEMBER(stadhero_state::stadhero_control_w) cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE); break; default: - logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+offset); + logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+offset); break; } } diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c index 210268aceed..deb3014c409 100644 --- a/src/mame/drivers/starwars.c +++ b/src/mame/drivers/starwars.c @@ -125,7 +125,7 @@ DIRECT_UPDATE_MEMBER(starwars_state::esb_setdirect) /* if we are in the slapstic region, process it */ if ((address & 0xe000) == 0x8000) { - offs_t pc = cpu_get_pc(&direct.space().device()); + offs_t pc = direct.space().device().safe_pc(); /* filter out duplicates; we get these because the handler gets called for multiple reasons: diff --git a/src/mame/drivers/strnskil.c b/src/mame/drivers/strnskil.c index a21348da9e1..671591ce750 100644 --- a/src/mame/drivers/strnskil.c +++ b/src/mame/drivers/strnskil.c @@ -38,7 +38,7 @@ READ8_MEMBER(strnskil_state::pettanp_protection_r) { int res; - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x6066: res = 0xa5; break; case 0x60dc: res = 0x20; break; /* bits 0-3 unknown */ @@ -49,7 +49,7 @@ READ8_MEMBER(strnskil_state::pettanp_protection_r) default: res = 0xff; break; } - logerror("%04x: protection_r -> %02x\n",cpu_get_pc(&space.device()),res); + logerror("%04x: protection_r -> %02x\n",space.device().safe_pc(),res); return res; } @@ -57,7 +57,7 @@ READ8_MEMBER(strnskil_state::banbam_protection_r) { int res; - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x6094: res = 0xa5; break; case 0x6118: res = 0x20; break; /* bits 0-3 unknown */ @@ -68,13 +68,13 @@ READ8_MEMBER(strnskil_state::banbam_protection_r) default: res = 0xff; break; } - logerror("%04x: protection_r -> %02x\n",cpu_get_pc(&space.device()),res); + logerror("%04x: protection_r -> %02x\n",space.device().safe_pc(),res); return res; } WRITE8_MEMBER(strnskil_state::protection_w) { - logerror("%04x: protection_w %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: protection_w %02x\n",space.device().safe_pc(),data); } /****************************************************************************/ diff --git a/src/mame/drivers/stv.c b/src/mame/drivers/stv.c index 94363c5f5b7..f14331bef71 100644 --- a/src/mame/drivers/stv.c +++ b/src/mame/drivers/stv.c @@ -367,9 +367,9 @@ DRIVER_INIT_MEMBER(saturn_state,critcrsh) READ32_MEMBER(saturn_state::magzun_hef_hack_r) { - if(cpu_get_pc(&space.device())==0x604bf20) return 0x00000001; //HWEF + if(space.device().safe_pc()==0x604bf20) return 0x00000001; //HWEF - if(cpu_get_pc(&space.device())==0x604bfbe) return 0x00000002; //HREF + if(space.device().safe_pc()==0x604bfbe) return 0x00000002; //HREF return m_workram_h[0x08e830/4]; } @@ -377,7 +377,7 @@ READ32_MEMBER(saturn_state::magzun_hef_hack_r) READ32_MEMBER(saturn_state::magzun_rx_hack_r) { - if(cpu_get_pc(&space.device())==0x604c006) return 0x40; + if(space.device().safe_pc()==0x604c006) return 0x40; return m_workram_h[0x0ff3b4/4]; } @@ -653,7 +653,7 @@ bp 6001d22 (60ffef0) READ32_MEMBER(saturn_state::astrass_hack_r) { - if(cpu_get_pc(&space.device()) == 0x60011ba) return 0x00000000; + if(space.device().safe_pc() == 0x60011ba) return 0x00000000; return m_workram_h[0x000770/4]; } diff --git a/src/mame/drivers/suna16.c b/src/mame/drivers/suna16.c index 12686643211..5bde3d7aa09 100644 --- a/src/mame/drivers/suna16.c +++ b/src/mame/drivers/suna16.c @@ -44,7 +44,7 @@ WRITE16_MEMBER(suna16_state::suna16_soundlatch_w) { soundlatch_byte_w(space, 0, data & 0xff ); } - if (data & ~0xff) logerror("CPU#0 PC %06X - Sound latch unknown bits: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~0xff) logerror("CPU#0 PC %06X - Sound latch unknown bits: %04X\n", space.device().safe_pc(), data); } @@ -58,7 +58,7 @@ WRITE16_MEMBER(suna16_state::bssoccer_leds_w) set_led_status(machine(), 3, data & 0x08); coin_counter_w(machine(), 0, data & 0x10); } - if (data & ~0x1f) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~0x1f) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", space.device().safe_pc(), data); } @@ -70,7 +70,7 @@ WRITE16_MEMBER(suna16_state::uballoon_leds_w) set_led_status(machine(), 0, data & 0x02); set_led_status(machine(), 1, data & 0x04); } - if (data & ~0x07) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~0x07) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", space.device().safe_pc(), data); } @@ -80,7 +80,7 @@ WRITE16_MEMBER(suna16_state::bestbest_coin_w) { coin_counter_w(machine(), 0, data & 0x04); } - if (data & ~0x04) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~0x04) logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", space.device().safe_pc(), data); } @@ -161,7 +161,7 @@ WRITE16_MEMBER(suna16_state::bestbest_prot_w) case 0x00: m_prot = m_prot ^ 0x0009; break; case 0x08: m_prot = m_prot ^ 0x0002; break; case 0x0c: m_prot = m_prot ^ 0x0003; break; - //default: logerror("CPU#0 PC %06X - Unknown protection value: %04X\n", cpu_get_pc(&space.device()), data); + //default: logerror("CPU#0 PC %06X - Unknown protection value: %04X\n", space.device().safe_pc(), data); } } } @@ -262,7 +262,7 @@ WRITE8_MEMBER(suna16_state::bssoccer_pcm_1_bankswitch_w) { UINT8 *RAM = memregion("pcm1")->base(); int bank = data & 7; - if (bank & ~7) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data); + if (bank & ~7) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data); membank("bank1")->set_base(&RAM[bank * 0x10000 + 0x1000]); } @@ -270,7 +270,7 @@ WRITE8_MEMBER(suna16_state::bssoccer_pcm_2_bankswitch_w) { UINT8 *RAM = memregion("pcm2")->base(); int bank = data & 7; - if (bank & ~7) logerror("CPU#3 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data); + if (bank & ~7) logerror("CPU#3 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data); membank("bank2")->set_base(&RAM[bank * 0x10000 + 0x1000]); } @@ -340,7 +340,7 @@ WRITE8_MEMBER(suna16_state::uballoon_pcm_1_bankswitch_w) { UINT8 *RAM = memregion("pcm1")->base(); int bank = data & 1; - if (bank & ~1) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data); + if (bank & ~1) logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data); membank("bank1")->set_base(&RAM[bank * 0x10000 + 0x400]); } diff --git a/src/mame/drivers/suna8.c b/src/mame/drivers/suna8.c index 532dea2bd95..8a7e9f5e39a 100644 --- a/src/mame/drivers/suna8.c +++ b/src/mame/drivers/suna8.c @@ -491,7 +491,7 @@ READ8_MEMBER(suna8_state::hardhead_ip_r) case 2: return ioport("DSW1")->read(); case 3: return ioport("DSW2")->read(); default: - logerror("CPU #0 - PC %04X: Unknown IP read: %02X\n", cpu_get_pc(&space.device()), *m_hardhead_ip); + logerror("CPU #0 - PC %04X: Unknown IP read: %02X\n", space.device().safe_pc(), *m_hardhead_ip); return 0xff; } } @@ -505,7 +505,7 @@ WRITE8_MEMBER(suna8_state::hardhead_bankswitch_w) { int bank = data & 0x0f; - if (data & ~0xef) logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0xef) logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",space.device().safe_pc(),data); membank("bank1")->set_entry(bank); } @@ -561,7 +561,7 @@ WRITE8_MEMBER(suna8_state::rranger_bankswitch_w) int bank = data & 0x07; if ((~data & 0x10) && (bank >= 4)) bank += 4; - if (data & ~0xf7) logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0xf7) logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",space.device().safe_pc(),data); membank("bank1")->set_entry(bank); @@ -653,14 +653,14 @@ WRITE8_MEMBER(suna8_state::brickzn_multi_w) { m_palettebank = data & 0x01; - logerror("CPU #0 - PC %04X: palettebank = %02X\n",cpu_get_pc(&space.device()),data); - if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown palettebank bits: %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: palettebank = %02X\n",space.device().safe_pc(),data); + if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown palettebank bits: %02X\n",space.device().safe_pc(),data); } else if ((m_protection_val & 0xfc) == 0x90) { soundlatch_byte_w(space, 0, data); - logerror("CPU #0 - PC %04X: soundlatch = %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: soundlatch = %02X\n",space.device().safe_pc(),data); } else if ((m_protection_val & 0xfc) == 0x04) { @@ -668,8 +668,8 @@ WRITE8_MEMBER(suna8_state::brickzn_multi_w) set_led_status(machine(), 1, data & 0x02); coin_counter_w(machine(), 0, data & 0x04); - logerror("CPU #0 - PC %04X: leds = %02X\n",cpu_get_pc(&space.device()),data); - if (data & ~0x07) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: leds = %02X\n",space.device().safe_pc(),data); + if (data & ~0x07) logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",space.device().safe_pc(),data); } else if ((m_protection_val & 0xfc) == 0x9c) { @@ -678,18 +678,18 @@ WRITE8_MEMBER(suna8_state::brickzn_multi_w) // To be done: run-time opcode decryption change. Done in driver_init for now. - logerror("CPU #0 - PC %04X: op-decrypt = %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: op-decrypt = %02X\n",space.device().safe_pc(),data); } else if ((m_protection_val & 0xfc) == 0x80) { // disables rom banking? // see code at 11b1: - logerror("CPU #0 - PC %04X: rombank_disable = %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: rombank_disable = %02X\n",space.device().safe_pc(),data); } else { - logerror("CPU #0 - PC %04X: ignore = %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: ignore = %02X\n",space.device().safe_pc(),data); } } @@ -705,8 +705,8 @@ WRITE8_MEMBER(suna8_state::brickzn_prot_w) flip_screen_set(data & 0x01); m_spritebank = (data >> 1) & 1; - logerror("CPU #0 - PC %04X: protection_val = %02X\n",cpu_get_pc(&space.device()),data); -// if (data & ~0x03) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: protection_val = %02X\n",space.device().safe_pc(),data); +// if (data & ~0x03) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data); } /* @@ -726,7 +726,7 @@ WRITE8_MEMBER(suna8_state::brickzn_prot2_w) m_prot2_prev = m_prot2; m_prot2 = data; - logerror("CPU #0 - PC %04X: unknown = %02X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 - PC %04X: unknown = %02X\n",space.device().safe_pc(),data); } /* @@ -737,7 +737,7 @@ WRITE8_MEMBER(suna8_state::brickzn_rombank_w) { int bank = data & 0x0f; - if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data); membank("bank1")->set_entry(bank + (membank("bank1")->entry() & 0x10)); @@ -796,7 +796,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(suna8_state::hardhea2_nmi_w) { m_nmi_enable = data & 0x01; -// if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown nmi bits: %02X\n",cpu_get_pc(&space.device()),data); +// if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown nmi bits: %02X\n",space.device().safe_pc(),data); } /* @@ -806,7 +806,7 @@ WRITE8_MEMBER(suna8_state::hardhea2_nmi_w) WRITE8_MEMBER(suna8_state::hardhea2_flipscreen_w) { flip_screen_set(data & 0x01); - if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",space.device().safe_pc(),data); } WRITE8_MEMBER(suna8_state::hardhea2_leds_w) @@ -814,7 +814,7 @@ WRITE8_MEMBER(suna8_state::hardhea2_leds_w) set_led_status(machine(), 0, data & 0x01); set_led_status(machine(), 1, data & 0x02); coin_counter_w(machine(), 0, data & 0x04); - if (data & ~0x07) logerror("CPU#0 - PC %06X: unknown leds bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0x07) logerror("CPU#0 - PC %06X: unknown leds bits: %02X\n",space.device().safe_pc(),data); } /* @@ -825,7 +825,7 @@ WRITE8_MEMBER(suna8_state::hardhea2_leds_w) WRITE8_MEMBER(suna8_state::hardhea2_spritebank_w) { m_spritebank = (data >> 1) & 1; - if (data & ~0x02) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0x02) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data); } /* @@ -836,7 +836,7 @@ WRITE8_MEMBER(suna8_state::hardhea2_rombank_w) { int bank = data & 0x0f; - if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data); membank("bank1")->set_entry(bank); @@ -911,7 +911,7 @@ ADDRESS_MAP_END WRITE8_MEMBER(suna8_state::starfigh_spritebank_latch_w) { m_spritebank_latch = (data >> 2) & 1; - if (data & ~0x04) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data); + if (data & ~0x04) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data); } WRITE8_MEMBER(suna8_state::starfigh_spritebank_w) @@ -973,7 +973,7 @@ WRITE8_MEMBER(suna8_state::sparkman_cmd_prot_w) case 0x81: m_trash_prot = 1; break; case 0x99: m_trash_prot = 1; break; case 0x54: m_spritebank = 1; break; - default: logerror("CPU #0 - PC %04X: unknown protection command: %02X\n",cpu_get_pc(&space.device()),data); + default: logerror("CPU #0 - PC %04X: unknown protection command: %02X\n",space.device().safe_pc(),data); } } @@ -990,14 +990,14 @@ WRITE8_MEMBER(suna8_state::suna8_wram_w) WRITE8_MEMBER(suna8_state::sparkman_flipscreen_w) { flip_screen_set(data & 0x01); - //if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(&space.device()),data); + //if (data & ~0x01) logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",space.device().safe_pc(),data); } WRITE8_MEMBER(suna8_state::sparkman_leds_w) { set_led_status(machine(), 0, data & 0x01); set_led_status(machine(), 1, data & 0x02); - //if (data & ~0x03) logerror("CPU#0 - PC %06X: unknown leds bits: %02X\n",cpu_get_pc(&space.device()),data); + //if (data & ~0x03) logerror("CPU#0 - PC %06X: unknown leds bits: %02X\n",space.device().safe_pc(),data); } WRITE8_MEMBER(suna8_state::sparkman_coin_counter_w) @@ -1016,7 +1016,7 @@ WRITE8_MEMBER(suna8_state::sparkman_spritebank_w) m_spritebank = 0; else m_spritebank = (data) & 1; - //if (data & ~0x02) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data); + //if (data & ~0x02) logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data); } /* @@ -1027,7 +1027,7 @@ WRITE8_MEMBER(suna8_state::sparkman_rombank_w) { int bank = data & 0x0f; - //if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data); + //if (data & ~0x0f) logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data); membank("bank1")->set_entry(bank); m_rombank = data; diff --git a/src/mame/drivers/supbtime.c b/src/mame/drivers/supbtime.c index 7d519742a0f..eda89b9f932 100644 --- a/src/mame/drivers/supbtime.c +++ b/src/mame/drivers/supbtime.c @@ -46,7 +46,7 @@ READ16_MEMBER(supbtime_state::supbtime_controls_r) return 0; } - logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", space.device().safe_pc(), offset); return ~0; } diff --git a/src/mame/drivers/superchs.c b/src/mame/drivers/superchs.c index 83003efd3a6..88022675cd6 100644 --- a/src/mame/drivers/superchs.c +++ b/src/mame/drivers/superchs.c @@ -437,7 +437,7 @@ ROM_END READ32_MEMBER(superchs_state::main_cycle_r) { - if (cpu_get_pc(&space.device())==0x702) + if (space.device().safe_pc()==0x702) device_spin_until_interrupt(&space.device()); return m_ram[0]; @@ -445,7 +445,7 @@ READ32_MEMBER(superchs_state::main_cycle_r) READ16_MEMBER(superchs_state::sub_cycle_r) { - if (cpu_get_pc(&space.device())==0x454) + if (space.device().safe_pc()==0x454) device_spin_until_interrupt(&space.device()); return m_ram[2]&0xffff; diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c index bab5735458c..17849da9b1a 100644 --- a/src/mame/drivers/superqix.c +++ b/src/mame/drivers/superqix.c @@ -172,13 +172,13 @@ The MCU acts this way: READ8_MEMBER(superqix_state::in4_mcu_r) { -// logerror("%04x: in4_mcu_r\n",cpu_get_pc(&space->device())); +// logerror("%04x: in4_mcu_r\n",space->device().safe_pc()); return ioport("P2")->read() | (m_from_mcu_pending << 6) | (m_from_z80_pending << 7); } READ8_MEMBER(superqix_state::sqix_from_mcu_r) { -// logerror("%04x: read mcu answer (%02x)\n",cpu_get_pc(&space->device()),m_from_mcu); +// logerror("%04x: read mcu answer (%02x)\n",space->device().safe_pc(),m_from_mcu); return m_from_mcu; } @@ -198,7 +198,7 @@ READ8_MEMBER(superqix_state::mcu_acknowledge_r) WRITE8_MEMBER(superqix_state::sqix_z80_mcu_w) { -// logerror("%04x: sqix_z80_mcu_w %02x\n",cpu_get_pc(&space->device()),data); +// logerror("%04x: sqix_z80_mcu_w %02x\n",space->device().safe_pc(),data); m_portb = data; } @@ -234,7 +234,7 @@ WRITE8_MEMBER(superqix_state::bootleg_mcu_p1_w) case 7: if ((data & 1) == 0) { -// logerror("%04x: MCU -> Z80 %02x\n",cpu_get_pc(&space.device()),m_port3); +// logerror("%04x: MCU -> Z80 %02x\n",space.device().safe_pc(),m_port3); m_from_mcu = m_port3_latch; m_from_mcu_pending = 1; m_from_z80_pending = 0; // ???? @@ -260,7 +260,7 @@ READ8_MEMBER(superqix_state::bootleg_mcu_p3_r) } else if ((m_port1 & 0x40) == 0) { -// logerror("%04x: read Z80 command %02x\n",cpu_get_pc(&space.device()),m_from_z80); +// logerror("%04x: read Z80 command %02x\n",space.device().safe_pc(),m_from_z80); m_from_z80_pending = 0; return m_from_z80; } @@ -297,7 +297,7 @@ WRITE8_MEMBER(superqix_state::sqixu_mcu_p2_w) // bit 7 = clock latch from port 3 to Z80 if ((m_port2 & 0x80) != 0 && (data & 0x80) == 0) { -// logerror("%04x: MCU -> Z80 %02x\n",cpu_get_pc(&space.device()),m_port3); +// logerror("%04x: MCU -> Z80 %02x\n",space.device().safe_pc(),m_port3); m_from_mcu = m_port3; m_from_mcu_pending = 1; m_from_z80_pending = 0; // ???? @@ -308,7 +308,7 @@ WRITE8_MEMBER(superqix_state::sqixu_mcu_p2_w) READ8_MEMBER(superqix_state::sqixu_mcu_p3_r) { -// logerror("%04x: read Z80 command %02x\n",cpu_get_pc(&space.device()),m_from_z80); +// logerror("%04x: read Z80 command %02x\n",space.device().safe_pc(),m_from_z80); m_from_z80_pending = 0; return m_from_z80; } @@ -403,7 +403,7 @@ static TIMER_CALLBACK( delayed_mcu_z80_w ) READ8_MEMBER(superqix_state::hotsmash_68705_portA_r) { -// logerror("%04x: 68705 reads port A = %02x\n",cpu_get_pc(&space.device()),m_portA_in); +// logerror("%04x: 68705 reads port A = %02x\n",space.device().safe_pc(),m_portA_in); return m_portA_in; } @@ -438,7 +438,7 @@ WRITE8_MEMBER(superqix_state::hotsmash_68705_portC_w) case 0x3: // command from Z80 m_portA_in = m_from_z80; -// logerror("%04x: z80 reads command %02x\n",cpu_get_pc(&space.device()),m_from_z80); +// logerror("%04x: z80 reads command %02x\n",space.device().safe_pc(),m_from_z80); break; case 0x4: @@ -466,14 +466,14 @@ WRITE8_MEMBER(superqix_state::hotsmash_z80_mcu_w) READ8_MEMBER(superqix_state::hotsmash_from_mcu_r) { -// logerror("%04x: z80 reads answer %02x\n",cpu_get_pc(&space.device()),m_from_mcu); +// logerror("%04x: z80 reads answer %02x\n",space.device().safe_pc(),m_from_mcu); m_from_mcu_pending = 0; return m_from_mcu; } READ8_MEMBER(superqix_state::hotsmash_ay_port_a_r) { -// logerror("%04x: ay_port_a_r and mcu_pending is %d\n",cpu_get_pc(&space->device()),m_from_mcu_pending); +// logerror("%04x: ay_port_a_r and mcu_pending is %d\n",space->device().safe_pc(),m_from_mcu_pending); return ioport("SYSTEM")->read() | 0x40 | ((m_from_mcu_pending^1) << 7); } @@ -509,13 +509,13 @@ READ8_MEMBER(superqix_state::pbillian_from_mcu_r) case 0x81: m_curr_player = 1; return 0; } -// logerror("408[%x] r at %x\n",m_from_z80,cpu_get_pc(&space.device())); +// logerror("408[%x] r at %x\n",m_from_z80,space.device().safe_pc()); return 0; } READ8_MEMBER(superqix_state::pbillian_ay_port_a_r) { -// logerror("%04x: ay_port_a_r\n",cpu_get_pc(&space->device())); +// logerror("%04x: ay_port_a_r\n",space->device().safe_pc()); /* bits 76------ MCU status bits */ return (machine().rand() & 0xc0) | machine().root_device().ioport("BUTTONS")->read(); } diff --git a/src/mame/drivers/suprgolf.c b/src/mame/drivers/suprgolf.c index 3b6c716b11a..52b32f6e344 100644 --- a/src/mame/drivers/suprgolf.c +++ b/src/mame/drivers/suprgolf.c @@ -269,7 +269,7 @@ WRITE8_MEMBER(suprgolf_state::rom_bank_select_w) //popmessage("%08x %02x",((data & 0x3f) * 0x4000),data); -// mame_printf_debug("ROM_BANK 0x8000 - %X @%X\n",data,cpu_get_previouspc(&space->device())); +// mame_printf_debug("ROM_BANK 0x8000 - %X @%X\n",data,space->device().safe_pcbase()); membank("bank2")->set_base(region_base + (data&0x3f ) * 0x4000); m_msm_nmi_mask = data & 0x40; @@ -279,7 +279,7 @@ WRITE8_MEMBER(suprgolf_state::rom_bank_select_w) WRITE8_MEMBER(suprgolf_state::rom2_bank_select_w) { UINT8 *region_base = memregion("user2")->base(); -// mame_printf_debug("ROM_BANK 0x4000 - %X @%X\n",data,cpu_get_previouspc(&space.device())); +// mame_printf_debug("ROM_BANK 0x4000 - %X @%X\n",data,space.device().safe_pcbase()); membank("bank1")->set_base(region_base + (data&0x0f) * 0x4000); diff --git a/src/mame/drivers/suprnova.c b/src/mame/drivers/suprnova.c index f61c94279d4..c00aed50763 100644 --- a/src/mame/drivers/suprnova.c +++ b/src/mame/drivers/suprnova.c @@ -642,7 +642,7 @@ WRITE32_MEMBER(skns_state::skns_io_w) cputag_set_input_line(machine(), "maincpu",0xf,CLEAR_LINE);*/ /* idle skip for vblokbrk/sarukani, i can't find a better place to put it :-( but i think it works ok unless its making the game too fast */ - if (cpu_get_pc(&space.device())==0x04013B42) + if (space.device().safe_pc()==0x04013B42) { if (!strcmp(machine().system().name,"vblokbrk") || !strcmp(machine().system().name,"sarukani")) @@ -867,7 +867,7 @@ READ32_MEMBER(skns_state::gutsn_speedup_r) 04022072: CMP/EQ R2,R3 04022074: BT $0402206C */ - if (cpu_get_pc(&space.device())==0x402206e) + if (space.device().safe_pc()==0x402206e) { if(m_main_ram[0x00078/4] == m_main_ram[0x0c780/4]) device_spin_until_interrupt(&space.device()); @@ -877,25 +877,25 @@ READ32_MEMBER(skns_state::gutsn_speedup_r) READ32_MEMBER(skns_state::cyvern_speedup_r) { - if (cpu_get_pc(&space.device())==0x402ebd2) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x402ebd2) device_spin_until_interrupt(&space.device()); return m_main_ram[0x4d3c8/4]; } READ32_MEMBER(skns_state::puzzloopj_speedup_r) { - if (cpu_get_pc(&space.device())==0x401dca0) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x401dca0) device_spin_until_interrupt(&space.device()); return m_main_ram[0x86714/4]; } READ32_MEMBER(skns_state::puzzloopa_speedup_r) { - if (cpu_get_pc(&space.device())==0x401d9d4) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x401d9d4) device_spin_until_interrupt(&space.device()); return m_main_ram[0x85bcc/4]; } READ32_MEMBER(skns_state::puzzloopu_speedup_r) { - if (cpu_get_pc(&space.device())==0x401dab0) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x401dab0) device_spin_until_interrupt(&space.device()); return m_main_ram[0x85cec/4]; } @@ -908,61 +908,61 @@ READ32_MEMBER(skns_state::puzzloope_speedup_r) 0401DA18: BF $0401DA26 0401DA26: BRA $0401DA12 */ - if (cpu_get_pc(&space.device())==0x401da14) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x401da14) device_spin_until_interrupt(&space.device()); return m_main_ram[0x81d38/4]; } READ32_MEMBER(skns_state::senknow_speedup_r) { - if (cpu_get_pc(&space.device())==0x4017dce) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x4017dce) device_spin_until_interrupt(&space.device()); return m_main_ram[0x0000dc/4]; } READ32_MEMBER(skns_state::teljan_speedup_r) { - if (cpu_get_pc(&space.device())==0x401ba32) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x401ba32) device_spin_until_interrupt(&space.device()); return m_main_ram[0x002fb4/4]; } READ32_MEMBER(skns_state::jjparads_speedup_r) { - if (cpu_get_pc(&space.device())==0x4015e84) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x4015e84) device_spin_until_interrupt(&space.device()); return m_main_ram[0x000994/4]; } READ32_MEMBER(skns_state::jjparad2_speedup_r) { - if (cpu_get_pc(&space.device())==0x401620a) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x401620a) device_spin_until_interrupt(&space.device()); return m_main_ram[0x000984/4]; } READ32_MEMBER(skns_state::ryouran_speedup_r) { - if (cpu_get_pc(&space.device())==0x40182ce) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x40182ce) device_spin_until_interrupt(&space.device()); return m_main_ram[0x000a14/4]; } READ32_MEMBER(skns_state::galpans2_speedup_r) { - if (cpu_get_pc(&space.device())==0x4049ae2) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x4049ae2) device_spin_until_interrupt(&space.device()); return m_main_ram[0x0fb6bc/4]; } READ32_MEMBER(skns_state::panicstr_speedup_r) { - if (cpu_get_pc(&space.device())==0x404e68a) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x404e68a) device_spin_until_interrupt(&space.device()); return m_main_ram[0x0f19e4/4]; } READ32_MEMBER(skns_state::sengekis_speedup_r)// 60006ee 600308e { - if (cpu_get_pc(&space.device())==0x60006ec) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x60006ec) device_spin_until_interrupt(&space.device()); return m_main_ram[0xb74bc/4]; } READ32_MEMBER(skns_state::sengekij_speedup_r)// 60006ee 600308e { - if (cpu_get_pc(&space.device())==0x60006ec) device_spin_until_interrupt(&space.device()); + if (space.device().safe_pc()==0x60006ec) device_spin_until_interrupt(&space.device()); return m_main_ram[0xb7380/4]; } diff --git a/src/mame/drivers/surpratk.c b/src/mame/drivers/surpratk.c index c9ea5f53af5..218ce3311d4 100644 --- a/src/mame/drivers/surpratk.c +++ b/src/mame/drivers/surpratk.c @@ -60,7 +60,7 @@ WRITE8_MEMBER(surpratk_state::bankedram_w) WRITE8_MEMBER(surpratk_state::surpratk_videobank_w) { - logerror("%04x: videobank = %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: videobank = %02x\n",space.device().safe_pc(),data); /* bit 0 = select 053245 at 0000-07ff */ /* bit 1 = select palette at 0000-07ff */ /* bit 2 = select palette bank 0 or 1 */ @@ -71,7 +71,7 @@ WRITE8_MEMBER(surpratk_state::surpratk_5fc0_w) { if ((data & 0xf4) != 0x10) - logerror("%04x: 3fc0 = %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: 3fc0 = %02x\n",space.device().safe_pc(),data); /* bit 0/1 = coin counters */ coin_counter_w(machine(), 0, data & 0x01); @@ -322,7 +322,7 @@ ROM_END static KONAMI_SETLINES_CALLBACK( surpratk_banking ) { - logerror("%04x: setlines %02x\n",cpu_get_pc(device), lines); + logerror("%04x: setlines %02x\n",device->safe_pc(), lines); device->machine().root_device().membank("bank1")->set_entry(lines & 0x1f); } diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c index 678daac775b..930db6ced4d 100644 --- a/src/mame/drivers/system1.c +++ b/src/mame/drivers/system1.c @@ -567,7 +567,7 @@ WRITE8_MEMBER(system1_state::mcu_io_w) default: logerror("%03X: MCU movx write mode %02X offset %04X = %02X\n", - cpu_get_pc(&space.device()), m_mcu_control, offset, data); + space.device().safe_pc(), m_mcu_control, offset, data); break; } } @@ -588,7 +588,7 @@ READ8_MEMBER(system1_state::mcu_io_r) default: logerror("%03X: MCU movx read mode %02X offset %04X\n", - cpu_get_pc(&space.device()), m_mcu_control, offset); + space.device().safe_pc(), m_mcu_control, offset); return 0xff; } } @@ -681,25 +681,25 @@ READ8_MEMBER(system1_state::nob_mcu_status_r) READ8_MEMBER(system1_state::nobb_inport1c_r) { -// logerror("IN $1c : pc = %04x - data = 0x80\n",cpu_get_pc(&space.device())); +// logerror("IN $1c : pc = %04x - data = 0x80\n",space.device().safe_pc()); return(0x80); // infinite loop (at 0x0fb3) until bit 7 is set } READ8_MEMBER(system1_state::nobb_inport22_r) { -// logerror("IN $22 : pc = %04x - data = %02x\n",cpu_get_pc(&space.device()),nobb_inport17_step); +// logerror("IN $22 : pc = %04x - data = %02x\n",space.device().safe_pc(),nobb_inport17_step); return(0);//nobb_inport17_step); } READ8_MEMBER(system1_state::nobb_inport23_r) { -// logerror("IN $23 : pc = %04x - step = %02x\n",cpu_get_pc(&space.device()),m_nobb_inport23_step); +// logerror("IN $23 : pc = %04x - step = %02x\n",space.device().safe_pc(),m_nobb_inport23_step); return(m_nobb_inport23_step); } WRITE8_MEMBER(system1_state::nobb_outport24_w) { -// logerror("OUT $24 : pc = %04x - data = %02x\n",cpu_get_pc(&space.device()),data); +// logerror("OUT $24 : pc = %04x - data = %02x\n",space.device().safe_pc(),data); m_nobb_inport23_step = data; } @@ -4705,7 +4705,7 @@ DRIVER_INIT_MEMBER(system1_state,myherok) READ8_MEMBER(system1_state::nob_start_r) { /* in reality, it's likely some M1-dependent behavior */ - return (cpu_get_pc(&space.device()) <= 0x0003) ? 0x80 : memregion("maincpu")->base()[1]; + return (space.device().safe_pc() <= 0x0003) ? 0x80 : memregion("maincpu")->base()[1]; } DRIVER_INIT_MEMBER(system1_state,nob) diff --git a/src/mame/drivers/system16.c b/src/mame/drivers/system16.c index 1f02073bce4..a809f145f25 100644 --- a/src/mame/drivers/system16.c +++ b/src/mame/drivers/system16.c @@ -413,7 +413,7 @@ WRITE8_MEMBER(segas1x_bootleg_state::tturfbl_soundbank_w) break; default: m_soundbank_ptr = NULL; - logerror("Invalid bank setting %02X (%04X)\n", data, cpu_get_pc(&space.device())); + logerror("Invalid bank setting %02X (%04X)\n", data, space.device().safe_pc()); break; } } @@ -1222,7 +1222,7 @@ WRITE8_MEMBER(segas1x_bootleg_state::shdancbl_bankctrl_w) break; default: m_soundbank_ptr = NULL; - logerror("Invalid bank setting %02X (%04X)\n", data, cpu_get_pc(&space.device())); + logerror("Invalid bank setting %02X (%04X)\n", data, space.device().safe_pc()); break; } } diff --git a/src/mame/drivers/taito_f2.c b/src/mame/drivers/taito_f2.c index ca4dc4d07ba..d312727abfb 100644 --- a/src/mame/drivers/taito_f2.c +++ b/src/mame/drivers/taito_f2.c @@ -348,7 +348,7 @@ READ16_MEMBER(taitof2_state::ninjak_input_r) // return (coin_word & mem_mask); } - logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n", space.device().safe_pc(), offset); return 0xff; } @@ -372,7 +372,7 @@ READ16_MEMBER(taitof2_state::cameltry_paddle_r) return res; } - logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n", space.device().safe_pc(), offset); return 0; } @@ -392,7 +392,7 @@ READ16_MEMBER(taitof2_state::mjnquest_dsw_r) } } - logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n", space.device().safe_pc(), offset); return 0xff; } @@ -418,7 +418,7 @@ READ16_MEMBER(taitof2_state::mjnquest_input_r) } - logerror("CPU #0 mjnquest_input %06x: warning - read unknown input %06x\n", cpu_get_pc(&space.device()), m_mjnquest_input); + logerror("CPU #0 mjnquest_input %06x: warning - read unknown input %06x\n", space.device().safe_pc(), m_mjnquest_input); return 0xff; } @@ -663,7 +663,7 @@ WRITE16_MEMBER(taitof2_state::driveout_sound_command_w) WRITE16_MEMBER(taitof2_state::cchip2_word_w) { - logerror("cchip2_w pc: %06x offset %04x: %02x\n", cpu_get_pc(&space.device()), offset, data); + logerror("cchip2_w pc: %06x offset %04x: %02x\n", space.device().safe_pc(), offset, data); COMBINE_DATA(&m_cchip2_ram[offset]); } diff --git a/src/mame/drivers/taito_f3.c b/src/mame/drivers/taito_f3.c index 5658abdbcb3..3302d7a7c01 100644 --- a/src/mame/drivers/taito_f3.c +++ b/src/mame/drivers/taito_f3.c @@ -64,7 +64,7 @@ READ32_MEMBER(taito_f3_state::f3_control_r) if (offset < 6) return ioport(iptnames[offset])->read(); - logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", space.device().safe_pc(), offset); return 0xffffffff; } @@ -105,7 +105,7 @@ WRITE32_MEMBER(taito_f3_state::f3_control_w) } return; } - logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %08x\n",cpu_get_pc(&space.device()),offset,data); + logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %08x\n",space.device().safe_pc(),offset,data); } WRITE32_MEMBER(taito_f3_state::f3_sound_reset_0_w) diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c index 9de8b3f504a..b1634e70442 100644 --- a/src/mame/drivers/taito_l.c +++ b/src/mame/drivers/taito_l.c @@ -375,7 +375,7 @@ WRITE8_MEMBER(taitol_state::rombankswitch_w) logerror("New rom size : %x\n", (m_high + 1) * 0x2000); } - //logerror("robs %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device())); + //logerror("robs %d, %02x (%04x)\n", offset, data, space.device().safe_pc()); m_cur_rombank = data; membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x2000 * m_cur_rombank); } @@ -394,7 +394,7 @@ WRITE8_MEMBER(taitol_state::rombank2switch_w) logerror("New rom2 size : %x\n", (m_high2 + 1) * 0x4000); } - //logerror("robs2 %02x (%04x)\n", data, cpu_get_pc(&space.device())); + //logerror("robs2 %02x (%04x)\n", data, space.device().safe_pc()); m_cur_rombank2 = data; membank("bank6")->set_base(machine().root_device().memregion("slave")->base() + 0x4000 * m_cur_rombank2); @@ -417,7 +417,7 @@ WRITE8_MEMBER(taitol_state::rambankswitch_w) if (m_cur_rambank[offset] != data) { m_cur_rambank[offset] = data; -//logerror("rabs %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device())); +//logerror("rabs %d, %02x (%04x)\n", offset, data, space.device().safe_pc()); if (data >= 0x14 && data <= 0x1f) { data -= 0x14; @@ -431,7 +431,7 @@ WRITE8_MEMBER(taitol_state::rambankswitch_w) } else { - logerror("unknown rambankswitch %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device())); + logerror("unknown rambankswitch %d, %02x (%04x)\n", offset, data, space.device().safe_pc()); m_current_notifier[offset] = 0; m_current_base[offset] = m_empty_ram; } @@ -504,8 +504,8 @@ READ8_MEMBER(taitol_state::extport_select_and_ym2203_r) WRITE8_MEMBER(taitol_state::mcu_data_w) { m_last_data = data; - m_last_data_adr = cpu_get_pc(&space.device()); -// logerror("mcu write %02x (%04x)\n", data, cpu_get_pc(&space.device())); + m_last_data_adr = space.device().safe_pc(); +// logerror("mcu write %02x (%04x)\n", data, space.device().safe_pc()); switch (data) { case 0x43: @@ -517,13 +517,13 @@ WRITE8_MEMBER(taitol_state::mcu_data_w) WRITE8_MEMBER(taitol_state::mcu_control_w) { -// logerror("mcu control %02x (%04x)\n", data, cpu_get_pc(&space.device())); +// logerror("mcu control %02x (%04x)\n", data, space.device().safe_pc()); } READ8_MEMBER(taitol_state::mcu_data_r) { -// logerror("mcu read (%04x) [%02x, %04x]\n", cpu_get_pc(&space.device()), last_data, last_data_adr); +// logerror("mcu read (%04x) [%02x, %04x]\n", space.device().safe_pc(), last_data, last_data_adr); if (m_mcu_pos == m_mcu_reply_len) return 0; @@ -532,14 +532,14 @@ READ8_MEMBER(taitol_state::mcu_data_r) READ8_MEMBER(taitol_state::mcu_control_r) { -// logerror("mcu control read (%04x)\n", cpu_get_pc(&space.device())); +// logerror("mcu control read (%04x)\n", space.device().safe_pc()); return 0x1; } #if 0 WRITE8_MEMBER(taitol_state::sound_w) { - logerror("Sound_w %02x (%04x)\n", data, cpu_get_pc(&space.device())); + logerror("Sound_w %02x (%04x)\n", data, space.device().safe_pc()); } #endif @@ -559,7 +559,7 @@ READ8_MEMBER(taitol_state::mux_r) case 7: return ioport("IN2")->read(); default: - logerror("Mux read from unknown port %d (%04x)\n", m_mux_ctrl, cpu_get_pc(&space.device())); + logerror("Mux read from unknown port %d (%04x)\n", m_mux_ctrl, space.device().safe_pc()); return 0xff; } } @@ -573,7 +573,7 @@ WRITE8_MEMBER(taitol_state::mux_w) control2_w(space, 0, data); break; default: - logerror("Mux write to unknown port %d, %02x (%04x)\n", m_mux_ctrl, data, cpu_get_pc(&space.device())); + logerror("Mux write to unknown port %d, %02x (%04x)\n", m_mux_ctrl, data, space.device().safe_pc()); } } @@ -1788,7 +1788,7 @@ WRITE8_MEMBER(taitol_state::portA_w) m_cur_bank = data & 0x03; bankaddress = m_cur_bank * 0x4000; membank("bank7")->set_base(&RAM[bankaddress]); - //logerror ("YM2203 bank change val=%02x pc=%04x\n", m_cur_bank, cpu_get_pc(&space->device()) ); + //logerror ("YM2203 bank change val=%02x pc=%04x\n", m_cur_bank, space->device().safe_pc() ); } } diff --git a/src/mame/drivers/taito_o.c b/src/mame/drivers/taito_o.c index ed836387690..9e7a4534210 100644 --- a/src/mame/drivers/taito_o.c +++ b/src/mame/drivers/taito_o.c @@ -55,7 +55,7 @@ READ16_MEMBER(taitoo_state::io_r) { case 0: retval = ioport("IN0")->read() & (clear_hack ? 0xf7ff : 0xffff); break; case 1: retval = ioport("IN1")->read() & (clear_hack ? 0xfff7 : 0xffff); break; - default: logerror("IO R %x %x = %x @ %x\n", offset, mem_mask, retval, cpu_get_pc(&space.device())); + default: logerror("IO R %x %x = %x @ %x\n", offset, mem_mask, retval, space.device().safe_pc()); } return retval; } diff --git a/src/mame/drivers/taito_z.c b/src/mame/drivers/taito_z.c index d5d488c8157..35fdb65f1d3 100644 --- a/src/mame/drivers/taito_z.c +++ b/src/mame/drivers/taito_z.c @@ -988,7 +988,7 @@ static void parse_cpu_control( running_machine &machine ) WRITE16_MEMBER(taitoz_state::cpua_ctrl_w) { - //logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data); + //logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data); if (mem_mask == 0xff00) data >>= 8; data &= 0xff; @@ -1194,7 +1194,7 @@ READ16_MEMBER(taitoz_state::bshark_stick_r) return ioport("Y_ADJUST")->read(); } - logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", space.device().safe_pc(), offset); return 0xff; } @@ -1217,7 +1217,7 @@ READ16_MEMBER(taitoz_state::nightstr_stick_r) return ioport("Y_ADJUST")->read(); } - logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", space.device().safe_pc(), offset); return 0xff; } @@ -1247,7 +1247,7 @@ READ16_MEMBER(taitoz_state::sci_steer_input_r) return (steer & 0xff00) >> 8; } - logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %06x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %06x\n", space.device().safe_pc(), offset); return 0xff; } @@ -1318,7 +1318,7 @@ READ16_MEMBER(taitoz_state::dblaxle_steer_input_r) return steer & 0xff; } - logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %02x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %02x\n", space.device().safe_pc(), offset); return 0x00; } @@ -1335,7 +1335,7 @@ READ16_MEMBER(taitoz_state::chasehq_motor_r) return 0x55; /* motor cpu status ? */ default: - logerror("CPU #0 PC %06x: warning - read motor cpu %03x\n",cpu_get_pc(&space.device()),offset); + logerror("CPU #0 PC %06x: warning - read motor cpu %03x\n",space.device().safe_pc(),offset); return 0; } } @@ -1353,7 +1353,7 @@ WRITE16_MEMBER(taitoz_state::chasehq_motor_w) break; } - logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n",cpu_get_pc(&space.device()),data,offset); + logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n",space.device().safe_pc(),data,offset); } diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c index e003a8f92ce..b4f207b4ae8 100644 --- a/src/mame/drivers/taitoair.c +++ b/src/mame/drivers/taitoair.c @@ -240,7 +240,7 @@ WRITE16_MEMBER(taitoair_state::system_control_w) device_set_input_line(m_dsp, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE); - logerror("68K:%06x writing %04x to TMS32025. %s HOLD , %s RESET\n", cpu_get_previouspc(&space.device()), data, ((data & 4) ? "Clear" : "Assert"), ((data & 1) ? "Clear" : "Assert")); + logerror("68K:%06x writing %04x to TMS32025. %s HOLD , %s RESET\n", space.device().safe_pcbase(), data, ((data & 4) ? "Clear" : "Assert"), ((data & 1) ? "Clear" : "Assert")); } READ16_MEMBER(taitoair_state::lineram_r) @@ -274,7 +274,7 @@ READ16_MEMBER(taitoair_state::dsp_HOLD_signal_r) { /* HOLD signal is active low */ - // logerror("TMS32025:%04x Reading %01x level from HOLD signal\n", cpu_get_previouspc(&space.device()), m_dsp_hold_signal); + // logerror("TMS32025:%04x Reading %01x level from HOLD signal\n", space.device().safe_pcbase(), m_dsp_hold_signal); return m_dsp_hold_signal; } @@ -282,7 +282,7 @@ READ16_MEMBER(taitoair_state::dsp_HOLD_signal_r) WRITE16_MEMBER(taitoair_state::dsp_HOLDA_signal_w) { if (offset) - logerror("TMS32025:%04x Writing %01x level to HOLD-Acknowledge signal\n", cpu_get_previouspc(&space.device()), data); + logerror("TMS32025:%04x Writing %01x level to HOLD-Acknowledge signal\n", space.device().safe_pcbase(), data); } diff --git a/src/mame/drivers/taitojc.c b/src/mame/drivers/taitojc.c index 15794f86137..8240dcac569 100644 --- a/src/mame/drivers/taitojc.c +++ b/src/mame/drivers/taitojc.c @@ -518,7 +518,7 @@ static void debug_dsp_command(running_machine &machine) WRITE32_MEMBER(taitojc_state::dsp_shared_w) { - //mame_printf_debug("dsp_shared: %08X, %04X at %08X\n", offset, data >> 16, cpu_get_pc(&space.device())); + //mame_printf_debug("dsp_shared: %08X, %04X at %08X\n", offset, data >> 16, space.device().safe_pc()); if (ACCESSING_BITS_24_31) { m_dsp_shared_ram[offset] &= 0x00ff; @@ -588,7 +588,7 @@ static UINT8 mcu_comm_reg_r(address_space *space, int reg) } default: { - //mame_printf_debug("hc11_reg_r: %02X at %08X\n", reg, cpu_get_pc(&space->device())); + //mame_printf_debug("hc11_reg_r: %02X at %08X\n", reg, space->device().safe_pc()); break; } } @@ -615,7 +615,7 @@ static void mcu_comm_reg_w(address_space *space, int reg, UINT8 data) } default: { - //mame_printf_debug("hc11_reg_w: %02X, %02X at %08X\n", reg, data, cpu_get_pc(&space->device())); + //mame_printf_debug("hc11_reg_w: %02X, %02X at %08X\n", reg, data, space->device().safe_pc()); break; } } @@ -978,7 +978,7 @@ READ16_MEMBER(taitojc_state::dsp_texaddr_r) WRITE16_MEMBER(taitojc_state::dsp_texaddr_w) { m_dsp_tex_address = data; -// mame_printf_debug("texaddr = %08X at %08X\n", data, cpu_get_pc(&space.device())); +// mame_printf_debug("texaddr = %08X at %08X\n", data, space.device().safe_pc()); m_texture_x = (((data >> 0) & 0x1f) << 1) | ((data >> 12) & 0x1); m_texture_y = (((data >> 5) & 0x1f) << 1) | ((data >> 13) & 0x1); @@ -1301,7 +1301,7 @@ MACHINE_CONFIG_END READ16_MEMBER(taitojc_state::taitojc_dsp_idle_skip_r) { - if(cpu_get_pc(&space.device())==0x404c) + if(space.device().safe_pc()==0x404c) device_spin_until_time(&space.device(), attotime::from_usec(500)); return m_dsp_shared_ram[0x7f0]; @@ -1309,7 +1309,7 @@ READ16_MEMBER(taitojc_state::taitojc_dsp_idle_skip_r) READ16_MEMBER(taitojc_state::dendego2_dsp_idle_skip_r) { - if(cpu_get_pc(&space.device())==0x402e) + if(space.device().safe_pc()==0x402e) device_spin_until_time(&space.device(), attotime::from_usec(500)); return m_dsp_shared_ram[0x7f0]; diff --git a/src/mame/drivers/taitotz.c b/src/mame/drivers/taitotz.c index 3a504a54608..b11f40211df 100644 --- a/src/mame/drivers/taitotz.c +++ b/src/mame/drivers/taitotz.c @@ -1587,7 +1587,7 @@ WRITE64_MEMBER(taitotz_state::video_chip_w) case 0xb: { m_video_ram_ptr = m_video_reg & 0xfffffff; - //logerror("video_chip_ram sel %08X at %08X\n", m_video_reg & 0x0fffffff, cpu_get_pc(&space.device())); + //logerror("video_chip_ram sel %08X at %08X\n", m_video_reg & 0x0fffffff, space.device().safe_pc()); break; } case 0x0: @@ -1675,7 +1675,7 @@ WRITE64_MEMBER(taitotz_state::video_fifo_w) { if (m_video_fifo_ptr >= 8) { - logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data >> 32), cpu_get_pc(&space.device())); + logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data >> 32), space.device().safe_pc()); } m_video_fifo_ptr++; } @@ -1683,7 +1683,7 @@ WRITE64_MEMBER(taitotz_state::video_fifo_w) { if (m_video_fifo_ptr >= 8) { - logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data), cpu_get_pc(&space.device())); + logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data), space.device().safe_pc()); } m_video_fifo_ptr++; } diff --git a/src/mame/drivers/tecmosys.c b/src/mame/drivers/tecmosys.c index d9032bbbe75..707300e2463 100644 --- a/src/mame/drivers/tecmosys.c +++ b/src/mame/drivers/tecmosys.c @@ -239,11 +239,11 @@ WRITE16_MEMBER(tecmosys_state::unk880000_w) case 0x22/2: machine().watchdog_reset(); - //logerror( "watchdog_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, cpu_get_pc(&space.device()) ); + //logerror( "watchdog_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, space.device().safe_pc() ); break; default: - logerror( "unk880000_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, cpu_get_pc(&space.device()) ); + logerror( "unk880000_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, space.device().safe_pc() ); break; } } @@ -252,7 +252,7 @@ READ16_MEMBER(tecmosys_state::unk880000_r) { //UINT16 ret = m_880000regs[offset]; - logerror( "unk880000_r( %06x ) @ %06x = %04x\n", (offset * 2 ) +0x880000, cpu_get_pc(&space.device()), m_880000regs[offset] ); + logerror( "unk880000_r( %06x ) @ %06x = %04x\n", (offset * 2 ) +0x880000, space.device().safe_pc(), m_880000regs[offset] ); /* this code allows scroll regs to be updated, but tkdensho at least resets perodically */ diff --git a/src/mame/drivers/tehkanwc.c b/src/mame/drivers/tehkanwc.c index 665bdac21ec..97fce6755cd 100644 --- a/src/mame/drivers/tehkanwc.c +++ b/src/mame/drivers/tehkanwc.c @@ -155,7 +155,7 @@ WRITE8_MEMBER(tehkanwc_state::sound_answer_w) /* in Gridiron, the sound CPU goes in a tight loop after the self test, */ /* probably waiting to be reset by a watchdog */ - if (cpu_get_pc(&space.device()) == 0x08bc) machine().scheduler().timer_set(attotime::from_seconds(1), FUNC(reset_callback)); + if (space.device().safe_pc() == 0x08bc) machine().scheduler().timer_set(attotime::from_seconds(1), FUNC(reset_callback)); } diff --git a/src/mame/drivers/tetrisp2.c b/src/mame/drivers/tetrisp2.c index 63ac268b6c7..9eed29ff059 100644 --- a/src/mame/drivers/tetrisp2.c +++ b/src/mame/drivers/tetrisp2.c @@ -189,7 +189,7 @@ WRITE16_MEMBER(tetrisp2_state::nndmseal_sound_bank_w) memcpy(machine().root_device().memregion("oki")->base(), rom + (m_bank_lo * 0x80000), 0x20000); -// logerror("PC:%06X sound bank_lo = %02X\n",cpu_get_pc(&space.device()),m_bank_lo); +// logerror("PC:%06X sound bank_lo = %02X\n",space.device().safe_pc(),m_bank_lo); } else { @@ -197,7 +197,7 @@ WRITE16_MEMBER(tetrisp2_state::nndmseal_sound_bank_w) memcpy(machine().root_device().memregion("oki")->base() + 0x20000, rom + (m_bank_lo * 0x80000) + (m_bank_hi * 0x20000), 0x20000); -// logerror("PC:%06X sound bank_hi = %02X\n",cpu_get_pc(&space.device()),m_bank_hi); +// logerror("PC:%06X sound bank_hi = %02X\n",space.device().safe_pc(),m_bank_hi); } } } diff --git a/src/mame/drivers/thedeep.c b/src/mame/drivers/thedeep.c index b03a55bcf82..9402f4b7ea0 100644 --- a/src/mame/drivers/thedeep.c +++ b/src/mame/drivers/thedeep.c @@ -125,7 +125,7 @@ WRITE8_MEMBER(thedeep_state::thedeep_protection_w) break; default: - logerror( "pc %04x: protection_command %02x\n", cpu_get_pc(&space.device()),m_protection_command); + logerror( "pc %04x: protection_command %02x\n", space.device().safe_pc(),m_protection_command); } } @@ -143,7 +143,7 @@ READ8_MEMBER(thedeep_state::thedeep_protection_r) WRITE8_MEMBER(thedeep_state::thedeep_e100_w) { if (data != 1) - logerror("pc %04x: e100 = %02x\n", cpu_get_pc(&space.device()),data); + logerror("pc %04x: e100 = %02x\n", space.device().safe_pc(),data); } static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, thedeep_state ) diff --git a/src/mame/drivers/thunderx.c b/src/mame/drivers/thunderx.c index eca4b6ecae2..3bcb13b26b3 100644 --- a/src/mame/drivers/thunderx.c +++ b/src/mame/drivers/thunderx.c @@ -62,12 +62,12 @@ READ8_MEMBER(thunderx_state::thunderx_bankedram_r) { if (m_pmcbank) { -// logerror("%04x read pmcram %04x\n",cpu_get_pc(&space.device()),offset); +// logerror("%04x read pmcram %04x\n",space.device().safe_pc(),offset); return m_pmcram[offset]; } else { - logerror("%04x read pmc internal ram %04x\n",cpu_get_pc(&space.device()),offset); + logerror("%04x read pmc internal ram %04x\n",space.device().safe_pc(),offset); return 0; } } @@ -84,11 +84,11 @@ WRITE8_MEMBER(thunderx_state::thunderx_bankedram_w) { if (m_pmcbank) { - logerror("%04x pmcram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data); + logerror("%04x pmcram %04x = %02x\n",space.device().safe_pc(),offset,data); m_pmcram[offset] = data; } else - logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data); + logerror("%04x pmc internal ram %04x = %02x\n",space.device().safe_pc(),offset,data); } else paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data); @@ -293,7 +293,7 @@ READ8_MEMBER(thunderx_state::thunderx_1f98_r) WRITE8_MEMBER(thunderx_state::thunderx_1f98_w) { - // logerror("%04x: 1f98_w %02x\n", cpu_get_pc(&space.device()),data); + // logerror("%04x: 1f98_w %02x\n", space.device().safe_pc(),data); /* bit 0 = enable char ROM reading through the video RAM */ k052109_set_rmrd_line(m_k052109, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE); @@ -318,7 +318,7 @@ WRITE8_MEMBER(thunderx_state::scontra_bankswitch_w) UINT8 *RAM = memregion("maincpu")->base(); int offs; -//logerror("%04x: bank switch %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: bank switch %02x\n",space.device().safe_pc(),data); /* bits 0-3 ROM bank */ offs = 0x10000 + (data & 0x0f)*0x2000; @@ -337,7 +337,7 @@ WRITE8_MEMBER(thunderx_state::scontra_bankswitch_w) WRITE8_MEMBER(thunderx_state::thunderx_videobank_w) { - //logerror("%04x: select video ram bank %02x\n",cpu_get_pc(&space.device()),data); + //logerror("%04x: select video ram bank %02x\n",space.device().safe_pc(),data); /* 0x01 = work RAM at 4000-5fff */ /* 0x00 = palette at 5800-5fff */ /* 0x10 = unknown RAM at 5800-5fff */ @@ -991,7 +991,7 @@ ROM_END static KONAMI_SETLINES_CALLBACK( thunderx_banking ) { - //logerror("thunderx %04x: bank select %02x\n", cpu_get_pc(device->cpu), lines); + //logerror("thunderx %04x: bank select %02x\n", device->cpu->safe_pc(), lines); device->machine().root_device().membank("bank1")->set_entry(((lines & 0x0f) ^ 0x08)); } diff --git a/src/mame/drivers/tickee.c b/src/mame/drivers/tickee.c index cecf92399dd..868479f6577 100644 --- a/src/mame/drivers/tickee.c +++ b/src/mame/drivers/tickee.c @@ -293,7 +293,7 @@ WRITE16_MEMBER(tickee_state::tickee_control_w) } if (olddata != m_control[offset]) - logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", cpu_get_pc(&space.device()), offset, m_control[offset], olddata); + logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", space.device().safe_pc(), offset, m_control[offset], olddata); } diff --git a/src/mame/drivers/tigeroad.c b/src/mame/drivers/tigeroad.c index 07d1816caa4..6e74b8361f3 100644 --- a/src/mame/drivers/tigeroad.c +++ b/src/mame/drivers/tigeroad.c @@ -84,7 +84,7 @@ static void f1dream_protection_w(address_space *space) tigeroad_state *state = space->machine().driver_data(); int indx; int value = 255; - int prevpc = cpu_get_previouspc(&space->device()); + int prevpc = space->device().safe_pcbase(); if (prevpc == 0x244c) { @@ -145,7 +145,7 @@ static void f1dream_protection_w(address_space *space) WRITE16_MEMBER(tigeroad_state::f1dream_control_w) { - logerror("protection write, PC: %04x FFE1 Value:%01x\n",cpu_get_pc(&space.device()), m_ram16[0x3fe0/2]); + logerror("protection write, PC: %04x FFE1 Value:%01x\n",space.device().safe_pc(), m_ram16[0x3fe0/2]); f1dream_protection_w(&space); } diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c index c406f28c165..7ccf9c31f05 100644 --- a/src/mame/drivers/tmaster.c +++ b/src/mame/drivers/tmaster.c @@ -613,7 +613,7 @@ READ16_MEMBER(tmaster_state::galgames_eeprom_r) WRITE16_MEMBER(tmaster_state::galgames_eeprom_w) { if (data & ~0x0003) - logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",space.device().safe_pc(),data); if ( ACCESSING_BITS_0_7 ) { @@ -706,7 +706,7 @@ WRITE16_MEMBER(tmaster_state::galgames_cart_sel_w) default: machine().device(galgames_eeprom_names[0])->set_cs_line(CLEAR_LINE); galgames_update_rombank(machine(), 0); - logerror("%06x: unknown cart sel = %04x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: unknown cart sel = %04x\n", space.device().safe_pc(), data); break; } } @@ -728,13 +728,13 @@ WRITE16_MEMBER(tmaster_state::galgames_cart_clock_w) { membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_RAM); // ram galgames_update_rombank(machine(), m_galgames_cart); - logerror("%06x: romram bank = %04x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: romram bank = %04x\n", space.device().safe_pc(), data); } else { membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_ROM0); // rom membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_RAM); // ram - logerror("%06x: unknown romram bank = %04x\n", cpu_get_pc(&space.device()), data); + logerror("%06x: unknown romram bank = %04x\n", space.device().safe_pc(), data); } } } diff --git a/src/mame/drivers/tmnt.c b/src/mame/drivers/tmnt.c index 60f8a621cc2..987f3722b2c 100644 --- a/src/mame/drivers/tmnt.c +++ b/src/mame/drivers/tmnt.c @@ -380,8 +380,8 @@ READ16_MEMBER(tmnt_state::ssriders_protection_r) return data; default: - popmessage("%06x: unknown protection read",cpu_get_pc(&space.device())); - logerror("%06x: read 1c0800 (D7=%02x 1058fc=%02x 105a0a=%02x)\n",cpu_get_pc(&space.device()),(UINT32)cpu_get_reg(&space.device(), M68K_D7),cmd,data); + popmessage("%06x: unknown protection read",space.device().safe_pc()); + logerror("%06x: read 1c0800 (D7=%02x 1058fc=%02x 105a0a=%02x)\n",space.device().safe_pc(),(UINT32)cpu_get_reg(&space.device(), M68K_D7),cmd,data); return 0xffff; } } diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c index 5c29435cd27..86b03c1bb31 100644 --- a/src/mame/drivers/toaplan2.c +++ b/src/mame/drivers/toaplan2.c @@ -637,7 +637,7 @@ WRITE16_MEMBER(toaplan2_state::toaplan2_hd647180_cpu_w) { m_mcu_data = data & 0xff; - logerror("PC:%08x Writing command (%04x) to secondary CPU shared port\n", cpu_get_previouspc(&space.device()), m_mcu_data); + logerror("PC:%08x Writing command (%04x) to secondary CPU shared port\n", space.device().safe_pcbase(), m_mcu_data); } } @@ -699,7 +699,7 @@ WRITE16_MEMBER(toaplan2_state::ghox_mcu_w) } else { - logerror("PC:%08x Writing %08x to HD647180 cpu shared ram status port\n", cpu_get_previouspc(&space.device()), m_mcu_data); + logerror("PC:%08x Writing %08x to HD647180 cpu shared ram status port\n", space.device().safe_pcbase(), m_mcu_data); } toaplan2_shared_ram16[0x56 / 2] = 0x004e; // Return a RTS instruction toaplan2_shared_ram16[0x58 / 2] = 0x0075; @@ -1012,7 +1012,7 @@ WRITE16_MEMBER(toaplan2_state::bbakraid_eeprom_w) { if (data & ~0x001f) - logerror("CPU #0 PC:%06X - Unknown EEPROM data being written %04X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 PC:%06X - Unknown EEPROM data being written %04X\n",space.device().safe_pc(),data); if ( ACCESSING_BITS_0_7 ) ioport("EEPROMOUT")->write(data, 0xff); diff --git a/src/mame/drivers/tomcat.c b/src/mame/drivers/tomcat.c index fcc3ad98c23..fcd57d3b554 100644 --- a/src/mame/drivers/tomcat.c +++ b/src/mame/drivers/tomcat.c @@ -223,7 +223,7 @@ READ16_MEMBER(tomcat_state::tomcat_320bio_r) READ16_MEMBER(tomcat_state::dsp_BIO_r) { - if ( cpu_get_pc(&space.device()) == 0x0001 ) + if ( space.device().safe_pc() == 0x0001 ) { if ( m_dsp_idle == 0 ) { @@ -232,7 +232,7 @@ READ16_MEMBER(tomcat_state::dsp_BIO_r) } return !m_dsp_BIO; } - else if ( cpu_get_pc(&space.device()) == 0x0003 ) + else if ( space.device().safe_pc() == 0x0003 ) { if ( m_dsp_BIO == 1 ) { diff --git a/src/mame/drivers/topspeed.c b/src/mame/drivers/topspeed.c index c50dc47101e..eac566b98cb 100644 --- a/src/mame/drivers/topspeed.c +++ b/src/mame/drivers/topspeed.c @@ -312,7 +312,7 @@ WRITE16_MEMBER(topspeed_state::cpua_ctrl_w) parse_control(machine()); - logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data); + logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data); } @@ -393,7 +393,7 @@ READ16_MEMBER(topspeed_state::topspeed_motor_r) return 0x55; /* motor cpu status ? */ default: - logerror("CPU #0 PC %06x: warning - read from motor cpu %03x\n", cpu_get_pc(&space.device()), offset); + logerror("CPU #0 PC %06x: warning - read from motor cpu %03x\n", space.device().safe_pc(), offset); return 0; } } @@ -401,7 +401,7 @@ READ16_MEMBER(topspeed_state::topspeed_motor_r) WRITE16_MEMBER(topspeed_state::topspeed_motor_w) { /* Writes $900000-25 and $900200-219 */ - logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n", cpu_get_pc(&space.device()), data, offset); + logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n", space.device().safe_pc(), data, offset); } diff --git a/src/mame/drivers/trvmadns.c b/src/mame/drivers/trvmadns.c index 1e3a6fd4f73..3e3834311c5 100644 --- a/src/mame/drivers/trvmadns.c +++ b/src/mame/drivers/trvmadns.c @@ -200,12 +200,12 @@ WRITE8_MEMBER(trvmadns_state::trvmadns_tileram_w) { if(offset==0) { - if(cpu_get_previouspc(&space.device())==0x29e9)// || cpu_get_previouspc(&space.device())==0x1b3f) //29f5 + if(space.device().safe_pcbase()==0x29e9)// || space.device().safe_pcbase()==0x1b3f) //29f5 { cputag_set_input_line(machine(), "maincpu", 0, HOLD_LINE); } // else -// logerror("%x \n", cpu_get_previouspc(&space.device())); +// logerror("%x \n", space.device().safe_pcbase()); } diff --git a/src/mame/drivers/tumbleb.c b/src/mame/drivers/tumbleb.c index ae1da97c978..53dfabe3433 100644 --- a/src/mame/drivers/tumbleb.c +++ b/src/mame/drivers/tumbleb.c @@ -3199,9 +3199,9 @@ DRIVER_INIT_MEMBER(tumbleb_state,fncywld) READ16_MEMBER(tumbleb_state::bcstory_1a0_read) { - //mame_printf_debug("bcstory_io %06x\n",cpu_get_pc(&space.device())); + //mame_printf_debug("bcstory_io %06x\n",space.device().safe_pc()); - if (cpu_get_pc(&space.device())==0x0560) return 0x1a0; + if (space.device().safe_pc()==0x0560) return 0x1a0; else return ioport("SYSTEM")->read(); } diff --git a/src/mame/drivers/twinkle.c b/src/mame/drivers/twinkle.c index 7441dcf953e..ca9fc47117a 100644 --- a/src/mame/drivers/twinkle.c +++ b/src/mame/drivers/twinkle.c @@ -601,12 +601,12 @@ WRITE32_MEMBER(twinkle_state::shared_psx_w) if (mem_mask == 0xff) { m_spu_shared[offset*2] = data; -// printf("shared_psx_w: %x to %x (%x), mask %x (PC=%x)\n", data, offset, offset*2, mem_mask, cpu_get_pc(&space.device())); +// printf("shared_psx_w: %x to %x (%x), mask %x (PC=%x)\n", data, offset, offset*2, mem_mask, space.device().safe_pc()); } else if (mem_mask == 0xff0000) { m_spu_shared[(offset*2)+1] = data; -// printf("shared_psx_w: %x to %x (%x), mask %x (PC=%x)\n", data, offset, (offset*2)+1, mem_mask, cpu_get_pc(&space.device())); +// printf("shared_psx_w: %x to %x (%x), mask %x (PC=%x)\n", data, offset, (offset*2)+1, mem_mask, space.device().safe_pc()); } else { @@ -621,7 +621,7 @@ READ32_MEMBER(twinkle_state::shared_psx_r) result = m_spu_shared[offset*2] | m_spu_shared[(offset*2)+1]<<16; -// printf("shared_psx_r: @ %x (%x %x), mask %x = %x (PC=%x)\n", offset, offset*2, (offset*2)+1, mem_mask, result, cpu_get_pc(&space.device())); +// printf("shared_psx_r: @ %x (%x %x), mask %x = %x (PC=%x)\n", offset, offset*2, (offset*2)+1, mem_mask, result, space.device().safe_pc()); result = 0; // HACK to prevent the games from freezing while we sort out the rest of the 68k's boot sequence diff --git a/src/mame/drivers/undrfire.c b/src/mame/drivers/undrfire.c index 8742c0adec5..54684b39e0c 100644 --- a/src/mame/drivers/undrfire.c +++ b/src/mame/drivers/undrfire.c @@ -393,7 +393,7 @@ READ32_MEMBER(undrfire_state::undrfire_lightgun_r) } } -logerror("CPU #0 PC %06x: warning - read unmapped lightgun offset %06x\n",cpu_get_pc(&space.device()),offset); +logerror("CPU #0 PC %06x: warning - read unmapped lightgun offset %06x\n",space.device().safe_pc(),offset); return 0x0; } diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c index 7633dbecc3d..853e2c1668e 100644 --- a/src/mame/drivers/vamphalf.c +++ b/src/mame/drivers/vamphalf.c @@ -2218,7 +2218,7 @@ static int irq_active(address_space *space) READ16_MEMBER(vamphalf_state::vamphalf_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x82de) + if(space.device().safe_pc() == 0x82de) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2231,7 +2231,7 @@ READ16_MEMBER(vamphalf_state::vamphalf_speedup_r) READ16_MEMBER(vamphalf_state::vamphafk_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x82de) + if(space.device().safe_pc() == 0x82de) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2244,7 +2244,7 @@ READ16_MEMBER(vamphalf_state::vamphafk_speedup_r) READ16_MEMBER(vamphalf_state::misncrft_speedup_r) { - if(cpu_get_pc(&space.device()) == 0xecc8) + if(space.device().safe_pc() == 0xecc8) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2257,7 +2257,7 @@ READ16_MEMBER(vamphalf_state::misncrft_speedup_r) READ16_MEMBER(vamphalf_state::coolmini_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x75f7a) + if(space.device().safe_pc() == 0x75f7a) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2270,7 +2270,7 @@ READ16_MEMBER(vamphalf_state::coolmini_speedup_r) READ16_MEMBER(vamphalf_state::suplup_speedup_r) { - if(cpu_get_pc(&space.device()) == 0xaf18a ) + if(space.device().safe_pc() == 0xaf18a ) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2283,7 +2283,7 @@ READ16_MEMBER(vamphalf_state::suplup_speedup_r) READ16_MEMBER(vamphalf_state::luplup_speedup_r) { - if(cpu_get_pc(&space.device()) == 0xaefac ) + if(space.device().safe_pc() == 0xaefac ) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2296,7 +2296,7 @@ READ16_MEMBER(vamphalf_state::luplup_speedup_r) READ16_MEMBER(vamphalf_state::luplup29_speedup_r) { - if(cpu_get_pc(&space.device()) == 0xae6c0 ) + if(space.device().safe_pc() == 0xae6c0 ) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2309,7 +2309,7 @@ READ16_MEMBER(vamphalf_state::luplup29_speedup_r) READ16_MEMBER(vamphalf_state::puzlbang_speedup_r) { - if(cpu_get_pc(&space.device()) == 0xae6d2 ) + if(space.device().safe_pc() == 0xae6d2 ) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2322,7 +2322,7 @@ READ16_MEMBER(vamphalf_state::puzlbang_speedup_r) READ32_MEMBER(vamphalf_state::wyvernwg_speedup_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if(pc == 0x10758) { @@ -2337,7 +2337,7 @@ READ32_MEMBER(vamphalf_state::wyvernwg_speedup_r) READ32_MEMBER(vamphalf_state::wyvernwga_speedup_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if(pc == 0x10758) { @@ -2354,7 +2354,7 @@ READ32_MEMBER(vamphalf_state::wyvernwga_speedup_r) READ32_MEMBER(vamphalf_state::finalgdr_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x1c212) + if(space.device().safe_pc() == 0x1c212) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2367,7 +2367,7 @@ READ32_MEMBER(vamphalf_state::finalgdr_speedup_r) READ32_MEMBER(vamphalf_state::mrkicker_speedup_r) { - UINT32 pc = cpu_get_pc(&space.device()); + UINT32 pc = space.device().safe_pc(); if(pc == 0x469de || pc == 0x46a36) { // if(irq_active(&space)) @@ -2382,7 +2382,7 @@ READ32_MEMBER(vamphalf_state::mrkicker_speedup_r) READ16_MEMBER(vamphalf_state::dquizgo2_speedup_r) { - if(cpu_get_pc(&space.device()) == 0xaa622) + if(space.device().safe_pc() == 0xaa622) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2395,11 +2395,11 @@ READ16_MEMBER(vamphalf_state::dquizgo2_speedup_r) READ32_MEMBER(vamphalf_state::aoh_speedup_r) { - if(cpu_get_pc(&space.device()) == 0xb994 ) + if(space.device().safe_pc() == 0xb994 ) { device_eat_cycles(&space.device(), 500); } - else if (cpu_get_pc(&space.device()) == 0xba40 ) + else if (space.device().safe_pc() == 0xba40 ) { device_eat_cycles(&space.device(), 500); } @@ -2410,7 +2410,7 @@ READ32_MEMBER(vamphalf_state::aoh_speedup_r) READ16_MEMBER(vamphalf_state::jmpbreak_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x983c) + if(space.device().safe_pc() == 0x983c) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2423,7 +2423,7 @@ READ16_MEMBER(vamphalf_state::jmpbreak_speedup_r) READ16_MEMBER(vamphalf_state::mrdig_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x1710) + if(space.device().safe_pc() == 0x1710) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); @@ -2437,7 +2437,7 @@ READ16_MEMBER(vamphalf_state::mrdig_speedup_r) READ16_MEMBER(vamphalf_state::dtfamily_speedup_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if (pc == 0x12fa6) device_spin_until_interrupt(&space.device()); @@ -2449,7 +2449,7 @@ READ16_MEMBER(vamphalf_state::dtfamily_speedup_r) READ16_MEMBER(vamphalf_state::toyland_speedup_r) { - if (cpu_get_pc(&space.device()) == 0x130c2) + if (space.device().safe_pc() == 0x130c2) device_spin_until_interrupt(&space.device()); return m_wram[0x780d8 / 2]; @@ -2458,7 +2458,7 @@ READ16_MEMBER(vamphalf_state::toyland_speedup_r) READ16_MEMBER(vamphalf_state::boonggab_speedup_r) { - if(cpu_get_pc(&space.device()) == 0x13198) + if(space.device().safe_pc() == 0x13198) { if(irq_active(&space)) device_spin_until_interrupt(&space.device()); diff --git a/src/mame/drivers/vball.c b/src/mame/drivers/vball.c index 3eb67297725..0e6fddf42ae 100644 --- a/src/mame/drivers/vball.c +++ b/src/mame/drivers/vball.c @@ -191,13 +191,13 @@ WRITE8_MEMBER(vball_state::vb_scrollx_hi_w) m_vb_scrollx_hi = (data & 0x02) << 7; vb_bgprombank_w(machine(), (data >> 2) & 0x07); vb_spprombank_w(machine(), (data >> 5) & 0x07); - //logerror("%04x: vb_scrollx_hi = %d\n", cpu_get_previouspc(&space.device()), m_vb_scrollx_hi); + //logerror("%04x: vb_scrollx_hi = %d\n", space.device().safe_pcbase(), m_vb_scrollx_hi); } WRITE8_MEMBER(vball_state::vb_scrollx_lo_w) { m_vb_scrollx_lo = data; - //logerror("%04x: vb_scrollx_lo =%d\n", cpu_get_previouspc(&space.device()), m_vb_scrollx_lo); + //logerror("%04x: vb_scrollx_lo =%d\n", space.device().safe_pcbase(), m_vb_scrollx_lo); } diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c index 95eba823700..e1bbaa451a3 100644 --- a/src/mame/drivers/vegas.c +++ b/src/mame/drivers/vegas.c @@ -631,7 +631,7 @@ static WRITE32_HANDLER( timekeeper_w ) state->m_cmos_unlocked = 0; } else - logerror("%08X:timekeeper_w(%04X,%08X & %08X) without CMOS unlocked\n", cpu_get_pc(&space->device()), offset, data, mem_mask); + logerror("%08X:timekeeper_w(%04X,%08X & %08X) without CMOS unlocked\n", space->device().safe_pc(), offset, data, mem_mask); } @@ -677,7 +677,7 @@ static READ32_HANDLER( pci_bridge_r ) } if (LOG_PCI) - logerror("%06X:PCI bridge read: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, result); + logerror("%06X:PCI bridge read: reg %d = %08X\n", space->device().safe_pc(), offset, result); return result; } @@ -687,7 +687,7 @@ static WRITE32_HANDLER( pci_bridge_w ) vegas_state *state = space->machine().driver_data(); state->m_pci_bridge_regs[offset] = data; if (LOG_PCI) - logerror("%06X:PCI bridge write: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, data); + logerror("%06X:PCI bridge write: reg %d = %08X\n", space->device().safe_pc(), offset, data); } @@ -717,7 +717,7 @@ static READ32_HANDLER( pci_ide_r ) } if (LOG_PCI) - logerror("%06X:PCI IDE read: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, result); + logerror("%06X:PCI IDE read: reg %d = %08X\n", space->device().safe_pc(), offset, result); return result; } @@ -750,7 +750,7 @@ static WRITE32_HANDLER( pci_ide_w ) break; } if (LOG_PCI) - logerror("%06X:PCI IDE write: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, data); + logerror("%06X:PCI IDE write: reg %d = %08X\n", space->device().safe_pc(), offset, data); } @@ -790,7 +790,7 @@ static READ32_HANDLER( pci_3dfx_r ) } if (LOG_PCI) - logerror("%06X:PCI 3dfx read: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, result); + logerror("%06X:PCI 3dfx read: reg %d = %08X\n", space->device().safe_pc(), offset, result); return result; } @@ -842,7 +842,7 @@ static WRITE32_HANDLER( pci_3dfx_w ) } if (LOG_PCI) - logerror("%06X:PCI 3dfx write: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, data); + logerror("%06X:PCI 3dfx write: reg %d = %08X\n", space->device().safe_pc(), offset, data); } @@ -961,37 +961,37 @@ static READ32_HANDLER( nile_r ) { case NREG_CPUSTAT+0: /* CPU status */ case NREG_CPUSTAT+1: /* CPU status */ - if (LOG_NILE) logerror("%08X:NILE READ: CPU status(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result); + if (LOG_NILE) logerror("%08X:NILE READ: CPU status(%03X) = %08X\n", space->device().safe_pc(), offset*4, result); logit = 0; break; case NREG_INTCTRL+0: /* Interrupt control */ case NREG_INTCTRL+1: /* Interrupt control */ - if (LOG_NILE) logerror("%08X:NILE READ: interrupt control(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result); + if (LOG_NILE) logerror("%08X:NILE READ: interrupt control(%03X) = %08X\n", space->device().safe_pc(), offset*4, result); logit = 0; break; case NREG_INTSTAT0+0: /* Interrupt status 0 */ case NREG_INTSTAT0+1: /* Interrupt status 0 */ - if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 0(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result); + if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 0(%03X) = %08X\n", space->device().safe_pc(), offset*4, result); logit = 0; break; case NREG_INTSTAT1+0: /* Interrupt status 1 */ case NREG_INTSTAT1+1: /* Interrupt status 1 */ - if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 1/enable(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result); + if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 1/enable(%03X) = %08X\n", space->device().safe_pc(), offset*4, result); logit = 0; break; case NREG_INTCLR+0: /* Interrupt clear */ case NREG_INTCLR+1: /* Interrupt clear */ - if (LOG_NILE) logerror("%08X:NILE READ: interrupt clear(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result); + if (LOG_NILE) logerror("%08X:NILE READ: interrupt clear(%03X) = %08X\n", space->device().safe_pc(), offset*4, result); logit = 0; break; case NREG_INTPPES+0: /* PCI Interrupt control */ case NREG_INTPPES+1: /* PCI Interrupt control */ - if (LOG_NILE) logerror("%08X:NILE READ: PCI interrupt control(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result); + if (LOG_NILE) logerror("%08X:NILE READ: PCI interrupt control(%03X) = %08X\n", space->device().safe_pc(), offset*4, result); logit = 0; break; @@ -1018,7 +1018,7 @@ static READ32_HANDLER( nile_r ) result = state->m_nile_regs[offset + 1] = state->m_timer[which]->remaining().as_double() * (double)SYSTEM_CLOCK; } - if (LOG_TIMERS) logerror("%08X:NILE READ: timer %d counter(%03X) = %08X\n", cpu_get_pc(&space->device()), which, offset*4, result); + if (LOG_TIMERS) logerror("%08X:NILE READ: timer %d counter(%03X) = %08X\n", space->device().safe_pc(), which, offset*4, result); logit = 0; break; @@ -1059,7 +1059,7 @@ static READ32_HANDLER( nile_r ) } if (LOG_NILE && logit) - logerror("%06X:nile read from offset %03X = %08X\n", cpu_get_pc(&space->device()), offset*4, result); + logerror("%06X:nile read from offset %03X = %08X\n", space->device().safe_pc(), offset*4, result); return result; } @@ -1076,34 +1076,34 @@ static WRITE32_HANDLER( nile_w ) { case NREG_CPUSTAT+0: /* CPU status */ case NREG_CPUSTAT+1: /* CPU status */ - if (LOG_NILE) logerror("%08X:NILE WRITE: CPU status(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask); + if (LOG_NILE) logerror("%08X:NILE WRITE: CPU status(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask); logit = 0; break; case NREG_INTCTRL+0: /* Interrupt control */ case NREG_INTCTRL+1: /* Interrupt control */ - if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt control(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask); + if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt control(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask); logit = 0; update_nile_irqs(space->machine()); break; case NREG_INTSTAT0+0: /* Interrupt status 0 */ case NREG_INTSTAT0+1: /* Interrupt status 0 */ - if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt status 0(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask); + if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt status 0(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask); logit = 0; update_nile_irqs(space->machine()); break; case NREG_INTSTAT1+0: /* Interrupt status 1 */ case NREG_INTSTAT1+1: /* Interrupt status 1 */ - if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt status 1/enable(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask); + if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt status 1/enable(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask); logit = 0; update_nile_irqs(space->machine()); break; case NREG_INTCLR+0: /* Interrupt clear */ case NREG_INTCLR+1: /* Interrupt clear */ - if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt clear(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask); + if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt clear(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask); logit = 0; state->m_nile_irq_state &= ~(state->m_nile_regs[offset] & ~0xf00); update_nile_irqs(space->machine()); @@ -1111,7 +1111,7 @@ static WRITE32_HANDLER( nile_w ) case NREG_INTPPES+0: /* PCI Interrupt control */ case NREG_INTPPES+1: /* PCI Interrupt control */ - if (LOG_NILE) logerror("%08X:NILE WRITE: PCI interrupt control(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask); + if (LOG_NILE) logerror("%08X:NILE WRITE: PCI interrupt control(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask); logit = 0; break; @@ -1136,7 +1136,7 @@ static WRITE32_HANDLER( nile_w ) case NREG_T2CTRL+1: /* general purpose timer control (control bits) */ case NREG_T3CTRL+1: /* watchdog timer control (control bits) */ which = (offset - NREG_T0CTRL) / 4; - if (LOG_NILE) logerror("%08X:NILE WRITE: timer %d control(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), which, offset*4, data, mem_mask); + if (LOG_NILE) logerror("%08X:NILE WRITE: timer %d control(%03X) = %08X & %08X\n", space->device().safe_pc(), which, offset*4, data, mem_mask); logit = 0; /* timer just enabled? */ @@ -1165,7 +1165,7 @@ static WRITE32_HANDLER( nile_w ) case NREG_T2CNTR: /* general purpose timer control (counter) */ case NREG_T3CNTR: /* watchdog timer control (counter) */ which = (offset - NREG_T0CTRL) / 4; - if (LOG_TIMERS) logerror("%08X:NILE WRITE: timer %d counter(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), which, offset*4, data, mem_mask); + if (LOG_TIMERS) logerror("%08X:NILE WRITE: timer %d counter(%03X) = %08X & %08X\n", space->device().safe_pc(), which, offset*4, data, mem_mask); logit = 0; if (state->m_nile_regs[offset - 1] & 1) @@ -1220,7 +1220,7 @@ static WRITE32_HANDLER( nile_w ) } if (LOG_NILE && logit) - logerror("%06X:nile write to offset %03X = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask); + logerror("%06X:nile write to offset %03X = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask); } @@ -1394,7 +1394,7 @@ static WRITE32_HANDLER( sio_w ) if (ACCESSING_BITS_16_23) offset += 2; if (ACCESSING_BITS_24_31) offset += 3; if (LOG_SIO && offset != 0) - logerror("%08X:sio write to offset %X = %02X\n", cpu_get_pc(&space->device()), offset, data >> (offset*8)); + logerror("%08X:sio write to offset %X = %02X\n", space->device().safe_pc(), offset, data >> (offset*8)); if (offset < 4) state->m_sio_data[offset] = data >> (offset*8); if (offset == 1) @@ -1413,7 +1413,7 @@ static READ32_HANDLER( sio_r ) if (offset < 4) result = state->m_sio_data[0] | (state->m_sio_data[1] << 8) | (state->m_sio_data[2] << 16) | (state->m_sio_data[3] << 24); if (LOG_SIO && offset != 2) - logerror("%08X:sio read from offset %X = %02X\n", cpu_get_pc(&space->device()), offset, result >> (offset*8)); + logerror("%08X:sio read from offset %X = %02X\n", space->device().safe_pc(), offset, result >> (offset*8)); return result; } @@ -1438,7 +1438,7 @@ static WRITE32_HANDLER( analog_port_w ) static const char *const portnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5", "AN6", "AN7" }; if (data < 8 || data > 15) - logerror("%08X:Unexpected analog port select = %08X\n", cpu_get_pc(&space->device()), data); + logerror("%08X:Unexpected analog port select = %08X\n", space->device().safe_pc(), data); state->m_pending_analog_read = state->ioport(portnames[data & 7])->read_safe(0); } diff --git a/src/mame/drivers/vendetta.c b/src/mame/drivers/vendetta.c index 94f5d2a56d9..528e59a61c7 100644 --- a/src/mame/drivers/vendetta.c +++ b/src/mame/drivers/vendetta.c @@ -784,7 +784,7 @@ ROM_END static KONAMI_SETLINES_CALLBACK( vendetta_banking ) { if (lines >= 0x1c) - logerror("PC = %04x : Unknown bank selected %02x\n", cpu_get_pc(device), lines); + logerror("PC = %04x : Unknown bank selected %02x\n", device->safe_pc(), lines); else device->machine().root_device().membank("bank1")->set_entry(lines); } diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index 3588fc33195..565efab7ced 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -683,11 +683,11 @@ READ32_MEMBER(viper_state::epic_r) const char *regname = epic_get_register_name(reg); if (regname) { - printf("EPIC: read %08X (%s) at %08X\n", reg, regname, cpu_get_pc(&space.device())); + printf("EPIC: read %08X (%s) at %08X\n", reg, regname, space.device().safe_pc()); } else { - printf("EPIC: read %08X at %08X\n", reg, cpu_get_pc(&space.device())); + printf("EPIC: read %08X at %08X\n", reg, space.device().safe_pc()); } } @@ -868,11 +868,11 @@ WRITE32_MEMBER(viper_state::epic_w) const char *regname = epic_get_register_name(reg); if (regname) { - printf("EPIC: write %08X, %08X (%s) at %08X\n", data, reg, regname, cpu_get_pc(&space.device())); + printf("EPIC: write %08X, %08X (%s) at %08X\n", data, reg, regname, space.device().safe_pc()); } else { - printf("EPIC: write %08X, %08X at %08X\n", data, reg, cpu_get_pc(&space.device())); + printf("EPIC: write %08X, %08X at %08X\n", data, reg, space.device().safe_pc()); } } @@ -1448,7 +1448,7 @@ static UINT32 voodoo3_pci_r(device_t *busdevice, device_t *device, int function, } default: - fatalerror("voodoo3_pci_r: %08X at %08X\n", reg, cpu_get_pc(device->machine().device("maincpu"))); + fatalerror("voodoo3_pci_r: %08X at %08X\n", reg, device->machine().device("maincpu")->safe_pc()); } return 0; } @@ -1518,7 +1518,7 @@ static void voodoo3_pci_w(device_t *busdevice, device_t *device, int function, i } default: - fatalerror("voodoo3_pci_w: %08X, %08X at %08X\n", data, reg, cpu_get_pc(device->machine().device("maincpu"))); + fatalerror("voodoo3_pci_w: %08X, %08X at %08X\n", data, reg, device->machine().device("maincpu")->safe_pc()); } } @@ -1529,7 +1529,7 @@ READ64_MEMBER(viper_state::voodoo3_io_r) } WRITE64_MEMBER(viper_state::voodoo3_io_w) { -// printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device())); +// printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, space.device().safe_pc()); device_t *device = machine().device("voodoo"); write64be_with_32le_device_handler(banshee_io_w, device, offset, data, mem_mask); @@ -1542,7 +1542,7 @@ READ64_MEMBER(viper_state::voodoo3_r) } WRITE64_MEMBER(viper_state::voodoo3_w) { -// printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device())); +// printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, space.device().safe_pc()); device_t *device = machine().device("voodoo"); write64be_with_32le_device_handler(banshee_w, device, offset, data, mem_mask); @@ -1555,7 +1555,7 @@ READ64_MEMBER(viper_state::voodoo3_lfb_r) } WRITE64_MEMBER(viper_state::voodoo3_lfb_w) { -// printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device())); +// printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, space.device().safe_pc()); device_t *device = machine().device("voodoo"); write64be_with_32le_device_handler(banshee_fb_w, device, offset, data, mem_mask); @@ -1752,7 +1752,7 @@ READ64_MEMBER(viper_state::e70000_r) ds2430_bit_timer->reset(); ds2430_bit_timer->start_time(); -// printf("e70000_r: %08X (mask %08X%08X) at %08X\n", offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(cpu)); +// printf("e70000_r: %08X (mask %08X%08X) at %08X\n", offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu->safe_pc()); } return 0; @@ -1767,7 +1767,7 @@ WRITE64_MEMBER(viper_state::e70000_w) ds2430_timer->adjust(attotime::from_usec(40), 1); // presence pulse for 240 microsecs unk1_bit = 1; -// printf("e70000_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(&space.device())); +// printf("e70000_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, space.device().safe_pc()); } else { @@ -1792,7 +1792,7 @@ WRITE64_MEMBER(viper_state::unk1a_w) { if (ACCESSING_BITS_56_63) { - // printf("unk1a_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(cpu)); + // printf("unk1a_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu->safe_pc()); } } @@ -1801,7 +1801,7 @@ WRITE64_MEMBER(viper_state::unk1b_w) if (ACCESSING_BITS_56_63) { unk1_bit = 0; - // printf("unk1b_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(cpu)); + // printf("unk1b_w: %08X%08X, %08X (mask %08X%08X) at %08X\n", (UINT32)(data >> 32), (UINT32)data, offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu->safe_pc()); } } diff --git a/src/mame/drivers/voyager.c b/src/mame/drivers/voyager.c index 4629a363362..d95198f808a 100644 --- a/src/mame/drivers/voyager.c +++ b/src/mame/drivers/voyager.c @@ -249,7 +249,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i #if 0 if ((state->m_mxtc_config_reg[0x63] & 0x50) | ( state->m_mxtc_config_reg[0x63] & 0xA0)) // Only DO if comes a change to disable ROM. { - if ( cpu_get_pc(busdevice->machine().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d); + if ( busdevice->machine(->safe_pc().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d); } #endif diff --git a/src/mame/drivers/vsnes.c b/src/mame/drivers/vsnes.c index 62015e9b69d..e68db255d1b 100644 --- a/src/mame/drivers/vsnes.c +++ b/src/mame/drivers/vsnes.c @@ -171,7 +171,7 @@ WRITE8_MEMBER(vsnes_state::vsnes_coin_counter_w) //"bnglngby" and "cluclu" if( data & 0xfe ) { - logerror("vsnes_coin_counter_w: pc = 0x%04x - data = 0x%02x\n", cpu_get_pc(&space.device()), data); + logerror("vsnes_coin_counter_w: pc = 0x%04x - data = 0x%02x\n", space.device().safe_pc(), data); } } @@ -187,7 +187,7 @@ WRITE8_MEMBER(vsnes_state::vsnes_coin_counter_1_w) if( data & 0xfe ) //vsbball service mode { //do something? - logerror("vsnes_coin_counter_1_w: pc = 0x%04x - data = 0x%02x\n", cpu_get_pc(&space.device()), data); + logerror("vsnes_coin_counter_1_w: pc = 0x%04x - data = 0x%02x\n", space.device().safe_pc(), data); } } diff --git a/src/mame/drivers/wecleman.c b/src/mame/drivers/wecleman.c index 696532deb11..38533f8204c 100644 --- a/src/mame/drivers/wecleman.c +++ b/src/mame/drivers/wecleman.c @@ -329,7 +329,7 @@ WRITE16_MEMBER(wecleman_state::irqctrl_w) { if (ACCESSING_BITS_0_7) { - // logerror("CPU #0 - PC = %06X - $140005 <- %02X (old value: %02X)\n",cpu_get_pc(&space.device()), data&0xFF, old_data&0xFF); + // logerror("CPU #0 - PC = %06X - $140005 <- %02X (old value: %02X)\n",space.device().safe_pc(), data&0xFF, old_data&0xFF); // Bit 0 : SUBINT if ( (m_irqctrl & 1) && (!(data & 1)) ) // 1->0 transition diff --git a/src/mame/drivers/wgp.c b/src/mame/drivers/wgp.c index e1ea9ef6f79..95206ee09c6 100644 --- a/src/mame/drivers/wgp.c +++ b/src/mame/drivers/wgp.c @@ -433,7 +433,7 @@ WRITE16_MEMBER(wgp_state::cpua_ctrl_w)/* assumes Z80 sandwiched between 68Ks */ parse_control(machine()); - logerror("CPU #0 PC %06x: write %04x to cpu control\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 PC %06x: write %04x to cpu control\n",space.device().safe_pc(),data); } @@ -485,7 +485,7 @@ static INTERRUPT_GEN( wgp_cpub_interrupt ) READ16_MEMBER(wgp_state::lan_status_r) { - logerror("CPU #2 PC %06x: warning - read lan status\n",cpu_get_pc(&space.device())); + logerror("CPU #2 PC %06x: warning - read lan status\n",space.device().safe_pc()); return (0x4 << 8); /* CPUB expects this in code at $104d0 (Wgp) */ } @@ -512,7 +512,7 @@ WRITE16_MEMBER(wgp_state::rotate_port_w) { case 0x00: { -//logerror("CPU #0 PC %06x: warning - port %04x write %04x\n",cpu_get_pc(&space.device()),port_sel,data); +//logerror("CPU #0 PC %06x: warning - port %04x write %04x\n",space.device().safe_pc(),port_sel,data); m_rotate_ctrl[m_port_sel] = data; return; @@ -586,7 +586,7 @@ READ16_MEMBER(wgp_state::wgp_adinput_r) return ioport(UNKNOWN_PORT_TAG)->read_safe(0x00); /* unknown */ } -logerror("CPU #0 PC %06x: warning - read unmapped a/d input offset %06x\n",cpu_get_pc(&space.device()),offset); +logerror("CPU #0 PC %06x: warning - read unmapped a/d input offset %06x\n",space.device().safe_pc(),offset); return 0xff; } diff --git a/src/mame/drivers/wheelfir.c b/src/mame/drivers/wheelfir.c index bf52bd64964..4ee9eb890d4 100644 --- a/src/mame/drivers/wheelfir.c +++ b/src/mame/drivers/wheelfir.c @@ -503,7 +503,7 @@ WRITE16_MEMBER(wheelfir_state::wheelfir_blit_w) { vpage=LAYER_BG; /* - printf("bg -> %d %d %d %d %d %d @ %x\n",dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0,cpu_get_pc(&space.device())); + printf("bg -> %d %d %d %d %d %d @ %x\n",dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0,space.device().safe_pc()); for(int i=0;i<16;++i) { diff --git a/src/mame/drivers/witch.c b/src/mame/drivers/witch.c index 5057ee323fb..f8647ff831c 100644 --- a/src/mame/drivers/witch.c +++ b/src/mame/drivers/witch.c @@ -413,7 +413,7 @@ READ8_MEMBER(witch_state::prot_read_700x) Otherwise later in game some I/O (controls) reads are skipped. */ - switch(cpu_get_pc(&space.device())) + switch(space.device().safe_pc()) { case 0x23f: case 0x246: diff --git a/src/mame/drivers/xexex.c b/src/mame/drivers/xexex.c index 44597a92156..c4f4b1495a5 100644 --- a/src/mame/drivers/xexex.c +++ b/src/mame/drivers/xexex.c @@ -163,7 +163,7 @@ WRITE16_MEMBER(xexex_state::spriteram_mirror_w) READ16_MEMBER(xexex_state::xexex_waitskip_r) { - if (cpu_get_pc(&space.device()) == 0x1158) + if (space.device().safe_pc() == 0x1158) { device_spin_until_trigger(&space.device(), m_resume_trigger); m_suspension_active = 1; diff --git a/src/mame/drivers/xmen.c b/src/mame/drivers/xmen.c index 25e75464003..553b34db25e 100644 --- a/src/mame/drivers/xmen.c +++ b/src/mame/drivers/xmen.c @@ -44,7 +44,7 @@ static const eeprom_interface eeprom_intf = WRITE16_MEMBER(xmen_state::eeprom_w) { - logerror("%06x: write %04x to 108000\n",cpu_get_pc(&space.device()),data); + logerror("%06x: write %04x to 108000\n",space.device().safe_pc(),data); if (ACCESSING_BITS_0_7) { /* bit 0 = coin counter */ diff --git a/src/mame/drivers/xtheball.c b/src/mame/drivers/xtheball.c index 8005e74c564..44e62edb9bb 100644 --- a/src/mame/drivers/xtheball.c +++ b/src/mame/drivers/xtheball.c @@ -127,7 +127,7 @@ WRITE16_MEMBER(xtheball_state::bit_controls_w) { if (bitvals[offset] != (data & 1)) { - logerror("%08x:bit_controls_w(%x,%d)\n", cpu_get_pc(&space.device()), offset, data & 1); + logerror("%08x:bit_controls_w(%x,%d)\n", space.device().safe_pc(), offset, data & 1); switch (offset) { diff --git a/src/mame/drivers/xyonix.c b/src/mame/drivers/xyonix.c index 0595b82a646..18291089913 100644 --- a/src/mame/drivers/xyonix.c +++ b/src/mame/drivers/xyonix.c @@ -74,7 +74,7 @@ static void handle_coins(running_machine &machine, int coin) READ8_MEMBER(xyonix_state::xyonix_io_r) { - int regPC = cpu_get_pc(&space.device()); + int regPC = space.device().safe_pc(); if (regPC == 0x27ba) return 0x88; @@ -126,7 +126,7 @@ READ8_MEMBER(xyonix_state::xyonix_io_r) WRITE8_MEMBER(xyonix_state::xyonix_io_w) { - //logerror ("xyonix_port_e0_w %02x - PC = %04x\n", data, cpu_get_pc(&space.device())); + //logerror ("xyonix_port_e0_w %02x - PC = %04x\n", data, space.device().safe_pc()); m_e0_data = data; } diff --git a/src/mame/drivers/yunsung8.c b/src/mame/drivers/yunsung8.c index 6a0fd976e71..30dfef870ce 100644 --- a/src/mame/drivers/yunsung8.c +++ b/src/mame/drivers/yunsung8.c @@ -52,7 +52,7 @@ WRITE8_MEMBER(yunsung8_state::yunsung8_bankswitch_w) membank("bank1")->set_entry(data & 0x07); if (data & ~0x37) - logerror("CPU #0 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU #0 - PC %04X: Bank %02X\n", space.device().safe_pc(), data); } /* diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index f3a9b11e0e1..fadde83ba3e 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -1806,7 +1806,7 @@ WRITE32_MEMBER(zn_state::bam2_mcu_w) else if (ACCESSING_BITS_16_31) { m_bam2_mcu_command = data>>16; - logerror("MCU command: %04x (PC %08x)\n", m_bam2_mcu_command, cpu_get_pc(&space.device())); + logerror("MCU command: %04x (PC %08x)\n", m_bam2_mcu_command, space.device().safe_pc()); } } } @@ -1816,11 +1816,11 @@ READ32_MEMBER(zn_state::bam2_mcu_r) switch (offset) { case 0: - logerror("MCU port 0 read @ PC %08x mask %08x\n", cpu_get_pc(&space.device()), mem_mask); + logerror("MCU port 0 read @ PC %08x mask %08x\n", space.device().safe_pc(), mem_mask); break; case 1: - logerror("MCU status read @ PC %08x mask %08x\n", cpu_get_pc(&space.device()), mem_mask); + logerror("MCU status read @ PC %08x mask %08x\n", space.device().safe_pc(), mem_mask); switch (m_bam2_mcu_command) { diff --git a/src/mame/includes/megadriv.h b/src/mame/includes/megadriv.h index 8c9dade54fe..e8d1258932b 100644 --- a/src/mame/includes/megadriv.h +++ b/src/mame/includes/megadriv.h @@ -135,7 +135,7 @@ public: // jzth protection DECLARE_WRITE16_MEMBER( bl_710000_w ) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); logerror("%06x writing to bl_710000_w %04x %04x\n", pc, data, mem_mask); @@ -191,7 +191,7 @@ public: DECLARE_READ16_MEMBER( bl_710000_r ) { UINT16 ret; - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); logerror("%06x reading from bl_710000_r\n", pc); if (m_protcount==6) { ret = 0xe; } diff --git a/src/mame/machine/3do.c b/src/mame/machine/3do.c index c516dd62f26..e80674cd352 100644 --- a/src/mame/machine/3do.c +++ b/src/mame/machine/3do.c @@ -62,12 +62,12 @@ Expansion bus stuff: READ32_MEMBER(_3do_state::_3do_nvarea_r){ - logerror( "%08X: NVRAM read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset ); + logerror( "%08X: NVRAM read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset ); return 0; } WRITE32_MEMBER(_3do_state::_3do_nvarea_w){ - logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset, data, mem_mask ); + logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset, data, mem_mask ); } @@ -100,7 +100,7 @@ WRITE32_MEMBER(_3do_state::_3do_nvarea_w){ READ32_MEMBER(_3do_state::_3do_slow2_r){ UINT32 data = 0; - logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset ); + logerror( "%08X: UNK_318 read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset ); switch( offset ) { case 0: /* Boot ROM checks here and expects to read 1, 0, 1, 0 in the lowest bit */ @@ -114,7 +114,7 @@ READ32_MEMBER(_3do_state::_3do_slow2_r){ WRITE32_MEMBER(_3do_state::_3do_slow2_w) { - logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset, data, mem_mask ); + logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset, data, mem_mask ); switch( offset ) { @@ -146,7 +146,7 @@ READ32_MEMBER(_3do_state::_3do_svf_r) UINT32 addr = ( offset & ( 0x07fc / 4 ) ) << 9; UINT32 *p = m_vram + addr; - logerror( "%08X: SVF read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4 ); + logerror( "%08X: SVF read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset*4 ); switch( offset & ( 0xE000 / 4 ) ) { @@ -171,7 +171,7 @@ WRITE32_MEMBER(_3do_state::_3do_svf_w) UINT32 addr = ( offset & ( 0x07fc / 4 ) ) << 9; UINT32 *p = m_vram + addr; - logerror( "%08X: SVF write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask ); + logerror( "%08X: SVF write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask ); switch( offset & ( 0xe000 / 4 ) ) { @@ -207,7 +207,7 @@ WRITE32_MEMBER(_3do_state::_3do_svf_w) READ32_MEMBER(_3do_state::_3do_madam_r){ - logerror( "%08X: MADAM read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4 ); + logerror( "%08X: MADAM read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset*4 ); switch( offset ) { case 0x0000/4: /* 03300000 - Revision */ @@ -358,7 +358,7 @@ READ32_MEMBER(_3do_state::_3do_madam_r){ case 0x07f8/4: return m_madam.mult_status; default: - logerror( "%08X: unhandled MADAM read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4 ); + logerror( "%08X: unhandled MADAM read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset*4 ); break; } return 0; @@ -366,7 +366,7 @@ READ32_MEMBER(_3do_state::_3do_madam_r){ WRITE32_MEMBER(_3do_state::_3do_madam_w){ - logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask ); + logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask ); switch( offset ) { case 0x0000/4: @@ -537,7 +537,7 @@ WRITE32_MEMBER(_3do_state::_3do_madam_w){ break; default: - logerror( "%08X: unhandled MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask ); + logerror( "%08X: unhandled MADAM write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask ); break; } } @@ -554,7 +554,7 @@ void _3do_madam_init( running_machine &machine ) READ32_MEMBER(_3do_state::_3do_clio_r) { - logerror( "%08X: CLIO read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset * 4 ); + logerror( "%08X: CLIO read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset * 4 ); switch( offset ) { @@ -693,7 +693,7 @@ READ32_MEMBER(_3do_state::_3do_clio_r) return m_clio.uncle_rom; default: - logerror( "%08X: unhandled CLIO read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset * 4 ); + logerror( "%08X: unhandled CLIO read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset * 4 ); break; } return 0; @@ -701,7 +701,7 @@ READ32_MEMBER(_3do_state::_3do_clio_r) WRITE32_MEMBER(_3do_state::_3do_clio_w) { - logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask ); + logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask ); switch( offset ) { @@ -945,7 +945,7 @@ WRITE32_MEMBER(_3do_state::_3do_clio_w) break; default: - logerror( "%08X: unhandled CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask ); + logerror( "%08X: unhandled CLIO write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask ); break; } } diff --git a/src/mame/machine/ajax.c b/src/mame/machine/ajax.c index 4feca2d2326..4a55c4f2733 100644 --- a/src/mame/machine/ajax.c +++ b/src/mame/machine/ajax.c @@ -126,7 +126,7 @@ READ8_MEMBER(ajax_state::ajax_ls138_f10_r) break; default: - logerror("%04x: (ls138_f10) read from an unknown address %02x\n",cpu_get_pc(&space.device()), offset); + logerror("%04x: (ls138_f10) read from an unknown address %02x\n",space.device().safe_pc(), offset); } return data; @@ -159,7 +159,7 @@ WRITE8_MEMBER(ajax_state::ajax_ls138_f10_w) break; default: - logerror("%04x: (ls138_f10) write %02x to an unknown address %02x\n", cpu_get_pc(&space.device()), data, offset); + logerror("%04x: (ls138_f10) write %02x to an unknown address %02x\n", space.device().safe_pc(), data, offset); } } diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index 88695b4578f..276bc644735 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -263,7 +263,7 @@ static void amiga_m68k_reset(device_t *device) amiga_state *state = device->machine().driver_data(); address_space *space = device->memory().space(AS_PROGRAM); - logerror("Executed RESET at PC=%06x\n", cpu_get_pc(&space->device())); + logerror("Executed RESET at PC=%06x\n", space->device().safe_pc()); /* Initialize the various chips */ devtag_reset(device->machine(), "cia_0"); @@ -1043,7 +1043,7 @@ READ16_HANDLER( amiga_cia_r ) data = mos6526_r(cia, offset >> 7); if (LOG_CIA) - logerror("%06x:cia_%c_read(%03x) = %04x & %04x\n", cpu_get_pc(&space->device()), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data << shift, mem_mask); + logerror("%06x:cia_%c_read(%03x) = %04x & %04x\n", space->device().safe_pc(), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data << shift, mem_mask); return data << shift; } @@ -1061,7 +1061,7 @@ WRITE16_HANDLER( amiga_cia_w ) device_t *cia; if (LOG_CIA) - logerror("%06x:cia_%c_write(%03x) = %04x & %04x\n", cpu_get_pc(&space->device()), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data, mem_mask); + logerror("%06x:cia_%c_write(%03x) = %04x & %04x\n", space->device().safe_pc(), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data, mem_mask); /* offsets 0000-07ff reference CIA B, and are accessed via the MSB */ if ((offset & 0x0800) == 0) @@ -1229,7 +1229,7 @@ READ16_HANDLER( amiga_custom_r ) } if (LOG_CUSTOM) - logerror("%06X:read from custom %s\n", cpu_get_pc(&space->device()), amiga_custom_names[offset & 0xff]); + logerror("%06X:read from custom %s\n", space->device().safe_pc(), amiga_custom_names[offset & 0xff]); return 0xffff; } @@ -1263,7 +1263,7 @@ WRITE16_HANDLER( amiga_custom_w ) offset &= 0xff; if (LOG_CUSTOM) - logerror("%06X:write to custom %s = %04X\n", cpu_get_pc(&space->device()), amiga_custom_names[offset & 0xff], data); + logerror("%06X:write to custom %s = %04X\n", space->device().safe_pc(), amiga_custom_names[offset & 0xff], data); switch (offset) { diff --git a/src/mame/machine/archimds.c b/src/mame/machine/archimds.c index 4558e9119ff..c7fd7b43ec0 100644 --- a/src/mame/machine/archimds.c +++ b/src/mame/machine/archimds.c @@ -473,7 +473,7 @@ static void latch_timer_cnt(int tmr) static READ32_HANDLER( ioc_ctrl_r ) { if(IOC_LOG) - logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( &space->device() ),offset & 0x1f); + logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], space->device() .safe_pc( ),offset & 0x1f); switch (offset & 0x1f) { @@ -535,7 +535,7 @@ static READ32_HANDLER( ioc_ctrl_r ) case T3_LATCH_HI: return (ioc_timerout[3]>>8)&0xff; default: if(!IOC_LOG) - logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( &space->device() ),offset & 0x1f); + logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], space->device() .safe_pc( ),offset & 0x1f); break; } @@ -546,7 +546,7 @@ static READ32_HANDLER( ioc_ctrl_r ) static WRITE32_HANDLER( ioc_ctrl_w ) { if(IOC_LOG) - logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( &space->device() )); + logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], space->device() .safe_pc( )); switch (offset&0x1f) { @@ -654,7 +654,7 @@ static WRITE32_HANDLER( ioc_ctrl_w ) default: if(!IOC_LOG) - logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( &space->device() )); + logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], space->device() .safe_pc( )); ioc_regs[offset&0x1f] = data & 0xff; break; @@ -778,7 +778,7 @@ WRITE32_HANDLER(archimedes_ioc_w) } - logerror("(PC=%08x) I/O: W %x @ %x (mask %08x)\n", cpu_get_pc(&space->device()), data, (offset*4)+0x3000000, mem_mask); + logerror("(PC=%08x) I/O: W %x @ %x (mask %08x)\n", space->device().safe_pc(), data, (offset*4)+0x3000000, mem_mask); } READ32_HANDLER(archimedes_vidc_r) @@ -865,7 +865,7 @@ WRITE32_HANDLER(archimedes_vidc_w) r = (val & 0x000f) >> 0; if(reg == 0x40 && val & 0xfff) - logerror("WARNING: border color write here (PC=%08x)!\n",cpu_get_pc(&space->device())); + logerror("WARNING: border color write here (PC=%08x)!\n",space->device().safe_pc()); palette_set_color_rgb(space->machine(), reg >> 2, pal4bit(r), pal4bit(g), pal4bit(b) ); @@ -982,7 +982,7 @@ WRITE32_HANDLER(archimedes_memc_w) case 7: /* Control */ memc_pagesize = ((data>>2) & 3); - logerror("(PC = %08x) MEMC: %x to Control (page size %d, %s, %s)\n", cpu_get_pc(&space->device()), data & 0x1ffc, page_sizes[memc_pagesize], ((data>>10)&1) ? "Video DMA on" : "Video DMA off", ((data>>11)&1) ? "Sound DMA on" : "Sound DMA off"); + logerror("(PC = %08x) MEMC: %x to Control (page size %d, %s, %s)\n", space->device().safe_pc(), data & 0x1ffc, page_sizes[memc_pagesize], ((data>>10)&1) ? "Video DMA on" : "Video DMA off", ((data>>11)&1) ? "Sound DMA on" : "Sound DMA off"); video_dma_on = ((data>>10)&1); audio_dma_on = ((data>>11)&1); @@ -1087,6 +1087,6 @@ WRITE32_HANDLER(archimedes_memc_page_w) // now go ahead and set the mapping in the page table memc_pages[log] = phys + (memc*0x80); -// printf("PC=%08x = MEMC_PAGE(%d): W %08x: log %x to phys %x, MEMC %d, perms %d\n", cpu_get_pc(&space->device()),memc_pagesize, data, log, phys, memc, perms); +// printf("PC=%08x = MEMC_PAGE(%d): W %08x: log %x to phys %x, MEMC %d, perms %d\n", space->device().safe_pc(),memc_pagesize, data, log, phys, memc, perms); } diff --git a/src/mame/machine/arkanoid.c b/src/mame/machine/arkanoid.c index f82732e3334..a2dfa04f01b 100644 --- a/src/mame/machine/arkanoid.c +++ b/src/mame/machine/arkanoid.c @@ -173,10 +173,10 @@ TO DO (2006.09.12) : */ -#define LOG_F000_R if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_f000_r - cmd = %02x - val = %02x\n", cpu_get_pc(&space.device()), m_bootleg_cmd, arkanoid_bootleg_val); -#define LOG_F002_R if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_f002_r - cmd = %02x - val = %02x\n", cpu_get_pc(&space.device()), m_bootleg_cmd, arkanoid_bootleg_val); -#define LOG_D018_W if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_d018_w - data = %02x - cmd = %02x\n", cpu_get_pc(&space.device()), data, m_bootleg_cmd); -#define LOG_D008_R if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_d008_r - val = %02x\n", cpu_get_pc(&space.device()), arkanoid_bootleg_d008_val); +#define LOG_F000_R if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_f000_r - cmd = %02x - val = %02x\n", space.device().safe_pc(), m_bootleg_cmd, arkanoid_bootleg_val); +#define LOG_F002_R if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_f002_r - cmd = %02x - val = %02x\n", space.device().safe_pc(), m_bootleg_cmd, arkanoid_bootleg_val); +#define LOG_D018_W if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_d018_w - data = %02x - cmd = %02x\n", space.device().safe_pc(), data, m_bootleg_cmd); +#define LOG_D008_R if (ARKANOID_BOOTLEG_VERBOSE) logerror("%04x: arkanoid_bootleg_d008_r - val = %02x\n", space.device().safe_pc(), arkanoid_bootleg_d008_val); /* Kludge for some bootlegs that read this address */ @@ -214,7 +214,7 @@ READ8_MEMBER(arkanoid_state::arkanoid_bootleg_f000_r) LOG_F000_R break; default: - logerror("%04x: arkanoid_bootleg_f000_r - cmd = %02x - unknown bootleg !\n", cpu_get_pc(&space.device()), m_bootleg_cmd); + logerror("%04x: arkanoid_bootleg_f000_r - cmd = %02x - unknown bootleg !\n", space.device().safe_pc(), m_bootleg_cmd); break; } @@ -301,7 +301,7 @@ READ8_MEMBER(arkanoid_state::arkanoid_bootleg_f002_r) LOG_F002_R break; default: - logerror("%04x: arkanoid_bootleg_f002_r - cmd = %02x - unknown bootleg !\n", cpu_get_pc(&space.device()), m_bootleg_cmd); + logerror("%04x: arkanoid_bootleg_f002_r - cmd = %02x - unknown bootleg !\n", space.device().safe_pc(), m_bootleg_cmd); break; } @@ -320,27 +320,27 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_bootleg_d018_w) switch (data) { case 0x36: /* unneeded value : no call 0x2050, unused A and overwritten HL (0x0313 -> 0x0340) */ - if (cpu_get_pc(&space.device()) == 0x7c47) + if (space.device().safe_pc() == 0x7c47) m_bootleg_cmd = 0x00; break; case 0x38: /* unneeded value : no call 0x2050, unused A and fixed HL (0x7bd5) */ - if (cpu_get_pc(&space.device()) == 0x7b87) + if (space.device().safe_pc() == 0x7b87) m_bootleg_cmd = 0x00; break; case 0x8a: /* unneeded value : no call 0x2050, unused A and overwritten HL (0x7b77 -> 0x7c1c) */ - if (cpu_get_pc(&space.device()) == 0x9661) + if (space.device().safe_pc() == 0x9661) m_bootleg_cmd = 0x00; break; case 0xe3: /* unneeded value : call 0x2050 but fixed A (0x00) and fixed HL (0xed83) */ - if (cpu_get_pc(&space.device()) == 0x67e3) + if (space.device().safe_pc() == 0x67e3) m_bootleg_cmd = 0x00; break; case 0xf7: /* unneeded value : 3 * 'NOP' at 0x034f + 2 * 'NOP' at 0x35b */ - if (cpu_get_pc(&space.device()) == 0x0349) + if (space.device().safe_pc() == 0x0349) m_bootleg_cmd = 0x00; break; case 0xff: /* unneeded value : no call 0x2050, unused A and overwritten HL (0x7c4f -> 0x7d31) */ - if (cpu_get_pc(&space.device()) == 0x9670) + if (space.device().safe_pc() == 0x9670) m_bootleg_cmd = 0x00; break; default: @@ -353,37 +353,37 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_bootleg_d018_w) switch (data) { case 0x36: /* unneeded value : call 0x2050 but fixed A (0x2d) */ - if (cpu_get_pc(&space.device()) == 0x7c4c) + if (space.device().safe_pc() == 0x7c4c) m_bootleg_cmd = 0x00; break; case 0x38: /* unneeded value : call 0x2050 but fixed A (0xf3) */ - if (cpu_get_pc(&space.device()) == 0x7b87) + if (space.device().safe_pc() == 0x7b87) m_bootleg_cmd = 0x00; break; case 0x88: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e3) + if (space.device().safe_pc() == 0x67e3) m_bootleg_cmd = 0x00; - if (cpu_get_pc(&space.device()) == 0x7c47) + if (space.device().safe_pc() == 0x7c47) m_bootleg_cmd = 0x00; break; case 0x89: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e5) + if (space.device().safe_pc() == 0x67e5) m_bootleg_cmd = 0x00; break; case 0x8a: /* unneeded value : call 0x2050 but fixed A (0xa5) */ - if (cpu_get_pc(&space.device()) == 0x9661) + if (space.device().safe_pc() == 0x9661) m_bootleg_cmd = 0x00; break; case 0xc0: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e7) + if (space.device().safe_pc() == 0x67e7) m_bootleg_cmd = 0x00; break; case 0xe3: /* unneeded value : call 0x2050 but fixed A (0x61) */ - if (cpu_get_pc(&space.device()) == 0x67e9) + if (space.device().safe_pc() == 0x67e9) m_bootleg_cmd = 0x00; break; case 0xff: /* unneeded value : call 0x2050 but fixed A (0xe2) */ - if (cpu_get_pc(&space.device()) == 0x9670) + if (space.device().safe_pc() == 0x9670) m_bootleg_cmd = 0x00; break; default: @@ -396,11 +396,11 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_bootleg_d018_w) switch (data) { case 0x05: /* Check 1 */ - if (cpu_get_pc(&space.device()) == 0x0363) + if (space.device().safe_pc() == 0x0363) m_bootleg_cmd = 0x05; break; case 0x0a: /* Check 2 */ - if (cpu_get_pc(&space.device()) == 0x0372) + if (space.device().safe_pc() == 0x0372) m_bootleg_cmd = 0x0a; break; default: @@ -413,41 +413,41 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_bootleg_d018_w) switch (data) { case 0x36: /* unneeded value : call 0x2050 but fixed A (0x2d) */ - if (cpu_get_pc(&space.device()) == 0x7c4c) + if (space.device().safe_pc() == 0x7c4c) m_bootleg_cmd = 0x00; break; case 0x38: /* unneeded value : call 0x2050 but fixed A (0xf3) */ - if (cpu_get_pc(&space.device()) == 0x7b87) + if (space.device().safe_pc() == 0x7b87) m_bootleg_cmd = 0x00; break; case 0x88: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e3) + if (space.device().safe_pc() == 0x67e3) m_bootleg_cmd = 0x00; - if (cpu_get_pc(&space.device()) == 0x7c47) + if (space.device().safe_pc() == 0x7c47) m_bootleg_cmd = 0x00; break; case 0x89: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e5) + if (space.device().safe_pc() == 0x67e5) m_bootleg_cmd = 0x00; break; case 0x8a: /* unneeded value : call 0x2050 but unused HL and fixed DE (0x7c1c) */ - if (cpu_get_pc(&space.device()) == 0x9661) + if (space.device().safe_pc() == 0x9661) m_bootleg_cmd = 0x00; break; case 0xc0: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e7) + if (space.device().safe_pc() == 0x67e7) m_bootleg_cmd = 0x00; break; case 0xe3: /* unneeded value : call 0x2050 but fixed A (0x61) */ - if (cpu_get_pc(&space.device()) == 0x67e9) + if (space.device().safe_pc() == 0x67e9) m_bootleg_cmd = 0x00; break; case 0xf7: /* unneeded value : call 0x2050 but never called (check code at 0x0340) */ - if (cpu_get_pc(&space.device()) == 0x0349) + if (space.device().safe_pc() == 0x0349) m_bootleg_cmd = 0x00; break; case 0xff: /* unneeded value : no call 0x2050, unused A and fixed HL (0x7d31) */ - if (cpu_get_pc(&space.device()) == 0x9670) + if (space.device().safe_pc() == 0x9670) m_bootleg_cmd = 0x00; break; default: @@ -460,40 +460,40 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_bootleg_d018_w) switch (data) { case 0x36: /* unneeded value : call 0x2050 but fixed A (0x2d) */ - if (cpu_get_pc(&space.device()) == 0x7c4c) + if (space.device().safe_pc() == 0x7c4c) m_bootleg_cmd = 0x00; break; case 0x38: /* unneeded value : call 0x2050 but fixed A (0xf3) */ - if (cpu_get_pc(&space.device()) == 0x7b87) + if (space.device().safe_pc() == 0x7b87) m_bootleg_cmd = 0x00; break; case 0x88: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e3) + if (space.device().safe_pc() == 0x67e3) m_bootleg_cmd = 0x00; - if (cpu_get_pc(&space.device()) == 0x7c47) + if (space.device().safe_pc() == 0x7c47) m_bootleg_cmd = 0x00; case 0x89: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e5) + if (space.device().safe_pc() == 0x67e5) m_bootleg_cmd = 0x00; break; case 0x8a: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x9661) + if (space.device().safe_pc() == 0x9661) m_bootleg_cmd = data; break; case 0xc0: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e7) + if (space.device().safe_pc() == 0x67e7) m_bootleg_cmd = 0x00; break; case 0xe3: /* unneeded value : call 0x2050 but fixed A (0x61) */ - if (cpu_get_pc(&space.device()) == 0x67e9) + if (space.device().safe_pc() == 0x67e9) m_bootleg_cmd = 0x00; break; case 0xf7: /* unneeded value : 3 * 'NOP' at 0x034f + 'JR NZ,$035D' at 0x35b */ - if (cpu_get_pc(&space.device()) == 0x0349) + if (space.device().safe_pc() == 0x0349) m_bootleg_cmd = 0x00; break; case 0xff: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x9670) + if (space.device().safe_pc() == 0x9670) m_bootleg_cmd = data; break; default: @@ -506,48 +506,48 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_bootleg_d018_w) switch (data) { case 0x24: /* A read from 0xf002 (expected to be 0x9b) */ - if (cpu_get_pc(&space.device()) == 0xbd7a) + if (space.device().safe_pc() == 0xbd7a) m_bootleg_cmd = data; break; case 0x36: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x7c4c) + if (space.device().safe_pc() == 0x7c4c) m_bootleg_cmd = data; break; case 0x38: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x7b87) + if (space.device().safe_pc() == 0x7b87) m_bootleg_cmd = data; break; case 0x88: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e3) + if (space.device().safe_pc() == 0x67e3) m_bootleg_cmd = 0x00; - if (cpu_get_pc(&space.device()) == 0x7c47) + if (space.device().safe_pc() == 0x7c47) m_bootleg_cmd = 0x00; case 0x89: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e5) + if (space.device().safe_pc() == 0x67e5) m_bootleg_cmd = 0x00; break; case 0x8a: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x9661) + if (space.device().safe_pc() == 0x9661) m_bootleg_cmd = data; break; case 0xc0: /* unneeded value : no read back */ - if (cpu_get_pc(&space.device()) == 0x67e7) + if (space.device().safe_pc() == 0x67e7) m_bootleg_cmd = 0x00; break; case 0xc3: /* A read from 0xf002 (expected to be 0x1d) */ - if (cpu_get_pc(&space.device()) == 0xbd8a) + if (space.device().safe_pc() == 0xbd8a) m_bootleg_cmd = data; break; case 0xe3: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x67e9) + if (space.device().safe_pc() == 0x67e9) m_bootleg_cmd = data; break; case 0xf7: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x0349) + if (space.device().safe_pc() == 0x0349) m_bootleg_cmd = data; break; case 0xff: /* call 0x2050 with A read from 0xf002 and wrong HL */ - if (cpu_get_pc(&space.device()) == 0x9670) + if (space.device().safe_pc() == 0x9670) m_bootleg_cmd = data; break; default: @@ -558,7 +558,7 @@ WRITE8_MEMBER(arkanoid_state::arkanoid_bootleg_d018_w) break; default: - logerror("%04x: arkanoid_bootleg_d018_w - data = %02x - unknown bootleg !\n", cpu_get_pc(&space.device()), data); + logerror("%04x: arkanoid_bootleg_d018_w - data = %02x - unknown bootleg !\n", space.device().safe_pc(), data); break; } } @@ -625,7 +625,7 @@ READ8_MEMBER(arkanoid_state::arkanoid_bootleg_d008_r) arkanoid_bootleg_d008_bit[2] = 0; /* untested bit */ arkanoid_bootleg_d008_bit[3] = 0; /* untested bit */ arkanoid_bootleg_d008_bit[5] = 0; /* untested bit */ - logerror("%04x: arkanoid_bootleg_d008_r - unknown bootleg !\n",cpu_get_pc(&space.device())); + logerror("%04x: arkanoid_bootleg_d008_r - unknown bootleg !\n",space.device().safe_pc()); break; } diff --git a/src/mame/machine/asic65.c b/src/mame/machine/asic65.c index b4d6f159b10..da50800f478 100644 --- a/src/mame/machine/asic65.c +++ b/src/mame/machine/asic65.c @@ -211,7 +211,7 @@ WRITE16_HANDLER( asic65_data_w ) else { int command = (data < MAX_COMMANDS) ? command_map[asic65.type][data] : OP_UNKNOWN; - if (asic65.log) fprintf(asic65.log, "\n(%06X)%c%04X:", cpu_get_previouspc(&space->device()), (command == OP_UNKNOWN) ? '*' : ' ', data); + if (asic65.log) fprintf(asic65.log, "\n(%06X)%c%04X:", space->device().safe_pcbase(), (command == OP_UNKNOWN) ? '*' : ' ', data); /* set the command number and reset the parameter/result indices */ asic65.command = data; diff --git a/src/mame/machine/atarigen.c b/src/mame/machine/atarigen.c index c47f3a30c50..bce95e21c66 100644 --- a/src/mame/machine/atarigen.c +++ b/src/mame/machine/atarigen.c @@ -463,7 +463,7 @@ DIRECT_UPDATE_MEMBER(atarigen_state::atarigen_slapstic_setdirect) address &= ~m_slapstic_mirror; if (address >= m_slapstic_base && address < m_slapstic_base + 0x8000) { - offs_t pc = cpu_get_previouspc(&direct.space().device()); + offs_t pc = direct.space().device().safe_pcbase(); if (pc != m_slapstic_last_pc || address != m_slapstic_last_address) { m_slapstic_last_pc = pc; diff --git a/src/mame/machine/balsente.c b/src/mame/machine/balsente.c index 566e3b22abd..b8458f4fb02 100644 --- a/src/mame/machine/balsente.c +++ b/src/mame/machine/balsente.c @@ -1047,7 +1047,7 @@ WRITE8_MEMBER(balsente_state::balsente_chip_select_w) "PULSE_WIDTH", "WAVE_SELECT" }; - logerror("s%04X: CEM#%d:%s=%f\n", cpu_get_previouspc(&space.device()), i, names[m_dac_register], voltage); + logerror("s%04X: CEM#%d:%s=%f\n", space.device().safe_pcbase(), i, names[m_dac_register], voltage); } #endif } @@ -1177,7 +1177,7 @@ static void update_grudge_steering(running_machine &machine) READ8_MEMBER(balsente_state::grudge_steering_r) { - logerror("%04X:grudge_steering_r(@%d)\n", cpu_get_pc(&space.device()), machine().primary_screen->vpos()); + logerror("%04X:grudge_steering_r(@%d)\n", space.device().safe_pc(), machine().primary_screen->vpos()); m_grudge_steering_result |= 0x80; return m_grudge_steering_result; } diff --git a/src/mame/machine/bonzeadv.c b/src/mame/machine/bonzeadv.c index 7bd6b25067f..c015259e214 100644 --- a/src/mame/machine/bonzeadv.c +++ b/src/mame/machine/bonzeadv.c @@ -384,8 +384,8 @@ WRITE16_HANDLER( bonzeadv_cchip_ram_w ) { asuka_state *state = space->machine().driver_data(); -// if (cpu_get_pc(&space->device())!=0xa028) -// logerror("%08x: write %04x %04x cchip\n", cpu_get_pc(&space->device()), offset, data); +// if (space->device().safe_pc()!=0xa028) +// logerror("%08x: write %04x %04x cchip\n", space->device().safe_pc(), offset, data); if (state->m_current_bank == 0) { @@ -440,7 +440,7 @@ READ16_HANDLER( bonzeadv_cchip_ram_r ) { asuka_state *state = space->machine().driver_data(); -// logerror("%08x: read %04x cchip\n", cpu_get_pc(&space->device()), offset); +// logerror("%08x: read %04x cchip\n", space->device().safe_pc(), offset); if (state->m_current_bank == 0) { diff --git a/src/mame/machine/btime.c b/src/mame/machine/btime.c index 2d70f7fb3ed..a3cb6932b48 100644 --- a/src/mame/machine/btime.c +++ b/src/mame/machine/btime.c @@ -16,7 +16,7 @@ READ8_MEMBER(btime_state::mmonkey_protection_r) else if (offset >= 0x0d00 && offset <= 0x0d02) ret = RAM[BASE + offset]; /* addition result */ else - logerror("Unknown protection read. PC=%04X Offset=%04X\n", cpu_get_pc(&space.device()), offset); + logerror("Unknown protection read. PC=%04X Offset=%04X\n", space.device().safe_pc(), offset); return ret; } @@ -71,7 +71,7 @@ WRITE8_MEMBER(btime_state::mmonkey_protection_w) break; default: - logerror("Unemulated protection command=%02X. PC=%04X\n", m_protection_command, cpu_get_pc(&space.device())); + logerror("Unemulated protection command=%02X. PC=%04X\n", m_protection_command, space.device().safe_pc()); break; } @@ -87,6 +87,6 @@ WRITE8_MEMBER(btime_state::mmonkey_protection_w) else if (offset >= 0x0d00 && offset <= 0x0d05) RAM[BASE + offset] = data; /* source table */ else - logerror("Unknown protection write=%02X. PC=%04X Offset=%04X\n", data, cpu_get_pc(&space.device()), offset); + logerror("Unknown protection write=%02X. PC=%04X Offset=%04X\n", data, space.device().safe_pc(), offset); } diff --git a/src/mame/machine/bublbobl.c b/src/mame/machine/bublbobl.c index 4b29df8e21c..42d2a7d039b 100644 --- a/src/mame/machine/bublbobl.c +++ b/src/mame/machine/bublbobl.c @@ -184,14 +184,14 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_ddr4_w) READ8_MEMBER(bublbobl_state::bublbobl_mcu_port1_r) { - //logerror("%04x: 6801U4 port 1 read\n", cpu_get_pc(&space.device())); + //logerror("%04x: 6801U4 port 1 read\n", space.device().safe_pc()); m_port1_in = ioport("IN0")->read(); return (m_port1_out & m_ddr1) | (m_port1_in & ~m_ddr1); } WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port1_w) { - //logerror("%04x: 6801U4 port 1 write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 6801U4 port 1 write %02x\n", space.device().safe_pc(), data); // bit 4: coin lockout coin_lockout_global_w(machine(), ~data & 0x10); @@ -215,13 +215,13 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port1_w) READ8_MEMBER(bublbobl_state::bublbobl_mcu_port2_r) { - //logerror("%04x: 6801U4 port 2 read\n", cpu_get_pc(&space.device())); + //logerror("%04x: 6801U4 port 2 read\n", space.device().safe_pc()); return (m_port2_out & m_ddr2) | (m_port2_in & ~m_ddr2); } WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port2_w) { - //logerror("%04x: 6801U4 port 2 write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 6801U4 port 2 write %02x\n", space.device().safe_pc(), data); static const char *const portnames[] = { "DSW0", "DSW1", "IN1", "IN2" }; // bits 0-3: bits 8-11 of shared RAM address @@ -255,25 +255,25 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port2_w) READ8_MEMBER(bublbobl_state::bublbobl_mcu_port3_r) { - //logerror("%04x: 6801U4 port 3 read\n", cpu_get_pc(&space.device())); + //logerror("%04x: 6801U4 port 3 read\n", space.device().safe_pc()); return (m_port3_out & m_ddr3) | (m_port3_in & ~m_ddr3); } WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port3_w) { - //logerror("%04x: 6801U4 port 3 write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 6801U4 port 3 write %02x\n", space.device().safe_pc(), data); m_port3_out = data; } READ8_MEMBER(bublbobl_state::bublbobl_mcu_port4_r) { - //logerror("%04x: 6801U4 port 4 read\n", cpu_get_pc(&space.device())); + //logerror("%04x: 6801U4 port 4 read\n", space.device().safe_pc()); return (m_port4_out & m_ddr4) | (m_port4_in & ~m_ddr4); } WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port4_w) { - //logerror("%04x: 6801U4 port 4 write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 6801U4 port 4 write %02x\n", space.device().safe_pc(), data); // bits 0-7 of shared RAM address @@ -292,7 +292,7 @@ in boblbobl, so they don't matter. All checks are patched out in sboblbob. READ8_MEMBER(bublbobl_state::boblbobl_ic43_a_r) { // if (offset >= 2) - // logerror("%04x: ic43_a_r (offs %d) res = %02x\n", cpu_get_pc(&space.device()), offset, res); + // logerror("%04x: ic43_a_r (offs %d) res = %02x\n", space.device().safe_pc(), offset, res); if (offset == 0) return m_ic43_a << 4; @@ -342,13 +342,13 @@ WRITE8_MEMBER(bublbobl_state::boblbobl_ic43_b_w) { static const int xorval[4] = { 4, 1, 8, 2 }; - // logerror("%04x: ic43_b_w (offs %d) %02x\n", cpu_get_pc(&space.device()), offset, data); + // logerror("%04x: ic43_b_w (offs %d) %02x\n", space.device().safe_pc(), offset, data); m_ic43_b = (data >> 4) ^ xorval[offset]; } READ8_MEMBER(bublbobl_state::boblbobl_ic43_b_r) { - // logerror("%04x: ic43_b_r (offs %d)\n", cpu_get_pc(&space.device()), offset); + // logerror("%04x: ic43_b_r (offs %d)\n", space.device().safe_pc(), offset); if (offset == 0) return m_ic43_b << 4; else @@ -382,13 +382,13 @@ INTERRUPT_GEN( bublbobl_m68705_interrupt ) READ8_MEMBER(bublbobl_state::bublbobl_68705_port_a_r) { - //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in); + //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in); return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a); } WRITE8_MEMBER(bublbobl_state::bublbobl_68705_port_a_w) { - //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data); m_port_a_out = data; } @@ -425,7 +425,7 @@ READ8_MEMBER(bublbobl_state::bublbobl_68705_port_b_r) WRITE8_MEMBER(bublbobl_state::bublbobl_68705_port_b_w) { - //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data); static const char *const portnames[] = { "DSW0", "DSW1", "IN1", "IN2" }; if ((m_ddr_b & 0x01) && (~data & 0x01) && (m_port_b_out & 0x01)) @@ -435,7 +435,7 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_68705_port_b_w) if ((m_ddr_b & 0x02) && (data & 0x02) && (~m_port_b_out & 0x02)) /* positive edge trigger */ { m_address = (m_address & 0xff00) | m_port_a_out; - //logerror("%04x: 68705 address %02x\n", cpu_get_pc(&space.device()), m_port_a_out); + //logerror("%04x: 68705 address %02x\n", space.device().safe_pc(), m_port_a_out); } if ((m_ddr_b & 0x04) && (data & 0x04) && (~m_port_b_out & 0x04)) /* positive edge trigger */ { @@ -447,26 +447,26 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_68705_port_b_w) { if ((m_address & 0x0800) == 0x0000) { - //logerror("%04x: 68705 read input port %02x\n", cpu_get_pc(&space.device()), m_address); + //logerror("%04x: 68705 read input port %02x\n", space.device().safe_pc(), m_address); m_latch = ioport(portnames[m_address & 3])->read(); } else if ((m_address & 0x0c00) == 0x0c00) { - //logerror("%04x: 68705 read %02x from address %04x\n", cpu_get_pc(&space.device()), m_mcu_sharedram[m_address], m_address); + //logerror("%04x: 68705 read %02x from address %04x\n", space.device().safe_pc(), m_mcu_sharedram[m_address], m_address); m_latch = m_mcu_sharedram[m_address & 0x03ff]; } else - logerror("%04x: 68705 unknown read address %04x\n", cpu_get_pc(&space.device()), m_address); + logerror("%04x: 68705 unknown read address %04x\n", space.device().safe_pc(), m_address); } else /* write */ { if ((m_address & 0x0c00) == 0x0c00) { - //logerror("%04x: 68705 write %02x to address %04x\n", cpu_get_pc(&space.device()), m_port_a_out, m_address); + //logerror("%04x: 68705 write %02x to address %04x\n", space.device().safe_pc(), m_port_a_out, m_address); m_mcu_sharedram[m_address & 0x03ff] = m_port_a_out; } else - logerror("%04x: 68705 unknown write to address %04x\n", cpu_get_pc(&space.device()), m_address); + logerror("%04x: 68705 unknown write to address %04x\n", space.device().safe_pc(), m_address); } } if ((m_ddr_b & 0x20) && (~data & 0x20) && (m_port_b_out & 0x20)) @@ -479,11 +479,11 @@ WRITE8_MEMBER(bublbobl_state::bublbobl_68705_port_b_w) } if ((m_ddr_b & 0x40) && (~data & 0x40) && (m_port_b_out & 0x40)) { - logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data); } if ((m_ddr_b & 0x80) && (~data & 0x80) && (m_port_b_out & 0x80)) { - logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data); } m_port_b_out = data; diff --git a/src/mame/machine/buggychl.c b/src/mame/machine/buggychl.c index 60aacf129c3..8a1e2d873e4 100644 --- a/src/mame/machine/buggychl.c +++ b/src/mame/machine/buggychl.c @@ -41,14 +41,14 @@ INLINE buggychl_mcu_state *get_safe_token( device_t *device ) static READ8_DEVICE_HANDLER( buggychl_68705_port_a_r ) { buggychl_mcu_state *state = get_safe_token(device); - //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(state->m_mcu), state->m_port_a_in); + //logerror("%04x: 68705 port A read %02x\n", state->m_mcu->safe_pc(), state->m_port_a_in); return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a); } static WRITE8_DEVICE_HANDLER( buggychl_68705_port_a_w ) { buggychl_mcu_state *state = get_safe_token(device); - //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(state->m_mcu), data); + //logerror("%04x: 68705 port A write %02x\n", state->m_mcu->safe_pc(), data); state->m_port_a_out = data; } @@ -88,7 +88,7 @@ static READ8_DEVICE_HANDLER( buggychl_68705_port_b_r ) static WRITE8_DEVICE_HANDLER( buggychl_68705_port_b_w ) { buggychl_mcu_state *state = get_safe_token(device); - logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(state->m_mcu), data); + logerror("%04x: 68705 port B write %02x\n", state->m_mcu->safe_pc(), data); if ((state->m_ddr_b & 0x02) && (~data & 0x02) && (state->m_port_b_out & 0x02)) { @@ -132,14 +132,14 @@ static READ8_DEVICE_HANDLER( buggychl_68705_port_c_r ) state->m_port_c_in |= 0x01; if (!state->m_mcu_sent) state->m_port_c_in |= 0x02; - logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(state->m_mcu), state->m_port_c_in); + logerror("%04x: 68705 port C read %02x\n", state->m_mcu->safe_pc(), state->m_port_c_in); return (state->m_port_c_out & state->m_ddr_c) | (state->m_port_c_in & ~state->m_ddr_c); } static WRITE8_DEVICE_HANDLER( buggychl_68705_port_c_w ) { buggychl_mcu_state *state = get_safe_token(device); - logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(state->m_mcu), data); + logerror("%04x: 68705 port C write %02x\n", state->m_mcu->safe_pc(), data); state->m_port_c_out = data; } @@ -153,7 +153,7 @@ static WRITE8_DEVICE_HANDLER( buggychl_68705_ddr_c_w ) WRITE8_DEVICE_HANDLER( buggychl_mcu_w ) { buggychl_mcu_state *state = get_safe_token(device); - logerror("%04x: mcu_w %02x\n", cpu_get_pc(state->m_mcu), data); + logerror("%04x: mcu_w %02x\n", state->m_mcu->safe_pc(), data); state->m_from_main = data; state->m_main_sent = 1; device_set_input_line(state->m_mcu, 0, ASSERT_LINE); @@ -162,7 +162,7 @@ WRITE8_DEVICE_HANDLER( buggychl_mcu_w ) READ8_DEVICE_HANDLER( buggychl_mcu_r ) { buggychl_mcu_state *state = get_safe_token(device); - logerror("%04x: mcu_r %02x\n", cpu_get_pc(state->m_mcu), state->m_from_mcu); + logerror("%04x: mcu_r %02x\n", state->m_mcu->safe_pc(), state->m_from_mcu); state->m_mcu_sent = 0; return state->m_from_mcu; } @@ -174,7 +174,7 @@ READ8_DEVICE_HANDLER( buggychl_mcu_status_r ) /* bit 0 = when 1, mcu is ready to receive data from main cpu */ /* bit 1 = when 1, mcu has sent data to the main cpu */ - //logerror("%04x: mcu_status_r\n",cpu_get_pc(state->m_mcu)); + //logerror("%04x: mcu_status_r\n",state->m_mcu->safe_pc()); if (!state->m_main_sent) res |= 0x01; if (state->m_mcu_sent) diff --git a/src/mame/machine/cchip.c b/src/mame/machine/cchip.c index 7787e6465bf..a2aea9185c2 100644 --- a/src/mame/machine/cchip.c +++ b/src/mame/machine/cchip.c @@ -90,7 +90,7 @@ WRITE16_HANDLER( cchip1_ram_w ) } else { -logerror("cchip1_w pc: %06x bank %02x offset %04x: %02x\n",cpu_get_pc(&space->device()),current_bank,offset,data); +logerror("cchip1_w pc: %06x bank %02x offset %04x: %02x\n",space->device().safe_pc(),current_bank,offset,data); } } diff --git a/src/mame/machine/cd32.c b/src/mame/machine/cd32.c index 32faee37b63..ab0a8efe0e7 100644 --- a/src/mame/machine/cd32.c +++ b/src/mame/machine/cd32.c @@ -779,7 +779,7 @@ READ32_DEVICE_HANDLER( amiga_akiko32_r ) if ( LOG_AKIKO && offset < (0x30/4) ) { - logerror( "Reading AKIKO reg %0x [%s] at PC=%06x\n", offset, get_akiko_reg_name(offset), cpu_get_pc(&space->device()) ); + logerror( "Reading AKIKO reg %0x [%s] at PC=%06x\n", offset, get_akiko_reg_name(offset), space->device().safe_pc() ); } switch( offset ) @@ -842,7 +842,7 @@ WRITE32_DEVICE_HANDLER( amiga_akiko32_w ) if ( LOG_AKIKO && offset < (0x30/4) ) { - logerror( "Writing AKIKO reg %0x [%s] with %08x at PC=%06x\n", offset, get_akiko_reg_name(offset), data, cpu_get_pc(&space->device()) ); + logerror( "Writing AKIKO reg %0x [%s] with %08x at PC=%06x\n", offset, get_akiko_reg_name(offset), data, space->device().safe_pc() ); } switch( offset ) diff --git a/src/mame/machine/cdi070.c b/src/mame/machine/cdi070.c index 03bc9e9425d..344402e8d39 100644 --- a/src/mame/machine/cdi070.c +++ b/src/mame/machine/cdi070.c @@ -34,7 +34,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } #else diff --git a/src/mame/machine/cdicdic.c b/src/mame/machine/cdicdic.c index 3882131150b..c50c97b916c 100644 --- a/src/mame/machine/cdicdic.c +++ b/src/mame/machine/cdicdic.c @@ -40,7 +40,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } #else diff --git a/src/mame/machine/cdislave.c b/src/mame/machine/cdislave.c index 234569bd718..6dfda7ba671 100644 --- a/src/mame/machine/cdislave.c +++ b/src/mame/machine/cdislave.c @@ -39,7 +39,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } #else diff --git a/src/mame/machine/chaknpop.c b/src/mame/machine/chaknpop.c index 80f80fbe25d..322b72e1b93 100644 --- a/src/mame/machine/chaknpop.c +++ b/src/mame/machine/chaknpop.c @@ -67,21 +67,21 @@ static void mcu_update_seed( running_machine &machine, UINT8 data ) READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_r) { - //logerror("%04x: MCU port_a read\n", cpu_get_pc(&space.device())); + //logerror("%04x: MCU port_a read\n", space.device().safe_pc()); return m_mcu_result; } READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_r) { - //logerror("%04x: MCU port_b read\n", cpu_get_pc(&space.device())); + //logerror("%04x: MCU port_b read\n", space.device().safe_pc()); return 0xff; } READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_r) { - //logerror("%04x: MCU port_c read\n", cpu_get_pc(&space.device())); + //logerror("%04x: MCU port_c read\n", space.device().safe_pc()); return 0x00; } @@ -101,7 +101,7 @@ WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_w) mcu_update_seed(machine(), m_mcu_result); - logerror("%04x: MCU command 0x%02x, result 0x%02x\n", cpu_get_pc(&space.device()), mcu_command, m_mcu_result); + logerror("%04x: MCU command 0x%02x, result 0x%02x\n", space.device().safe_pc(), mcu_command, m_mcu_result); } else if (mcu_command >= 0x28 && mcu_command <= 0x2a) { @@ -112,7 +112,7 @@ WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_w) mcu_update_seed(machine(), m_mcu_result); - logerror("%04x: MCU command 0x%02x, result 0x%02x\n", cpu_get_pc(&space.device()), mcu_command, m_mcu_result); + logerror("%04x: MCU command 0x%02x, result 0x%02x\n", space.device().safe_pc(), mcu_command, m_mcu_result); } else if (mcu_command < 0x80) { @@ -122,24 +122,24 @@ WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_w) { m_mcu_select = mcu_command - 0x40; - logerror("%04x: MCU select 0x%02x\n", cpu_get_pc(&space.device()), m_mcu_select); + logerror("%04x: MCU select 0x%02x\n", space.device().safe_pc(), m_mcu_select); } } else if (mcu_command == 0x9c|| mcu_command == 0xde) { mcu_update_seed(machine(), data); - logerror("%04x: MCU command 0x%02x\n", cpu_get_pc(&space.device()), mcu_command); + logerror("%04x: MCU command 0x%02x\n", space.device().safe_pc(), mcu_command); } } WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_w) { - //logerror("%04x: MCU port_b write 0x%02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: MCU port_b write 0x%02x\n", space.device().safe_pc(), data); } WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_w) { - //logerror("%04x: MCU port_c write 0x%02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: MCU port_c write 0x%02x\n", space.device().safe_pc(), data); } diff --git a/src/mame/machine/dc.c b/src/mame/machine/dc.c index b0f023a43d7..b5c6205987d 100644 --- a/src/mame/machine/dc.c +++ b/src/mame/machine/dc.c @@ -353,7 +353,7 @@ READ64_HANDLER( dc_sysctrl_r ) #if DEBUG_SYSCTRL if ((reg != 0x40) && (reg != 0x41) && (reg != 0x42) && (reg != 0x23) && (reg > 2)) // filter out IRQ status reads { - mame_printf_verbose("SYSCTRL: [%08x] read %x @ %x (reg %x: %s), mask %" I64FMT "x (PC=%x)\n", 0x5f6800+reg*4, state->dc_sysctrl_regs[reg], offset, reg, sysctrl_names[reg], mem_mask, cpu_get_pc(&space->device())); + mame_printf_verbose("SYSCTRL: [%08x] read %x @ %x (reg %x: %s), mask %" I64FMT "x (PC=%x)\n", 0x5f6800+reg*4, state->dc_sysctrl_regs[reg], offset, reg, sysctrl_names[reg], mem_mask, space->device().safe_pc()); } #endif @@ -615,7 +615,7 @@ READ64_HANDLER( pvr_ctrl_r ) reg = decode_reg_64(offset, mem_mask, &shift); #if DEBUG_PVRCTRL - mame_printf_verbose("PVRCTRL: [%08x] read %x @ %x (reg %x), mask %" I64FMT "x (PC=%x)\n", 0x5f7c00+reg*4, state->pvrctrl_regs[reg], offset, reg, mem_mask, cpu_get_pc(&space->device())); + mame_printf_verbose("PVRCTRL: [%08x] read %x @ %x (reg %x), mask %" I64FMT "x (PC=%x)\n", 0x5f7c00+reg*4, state->pvrctrl_regs[reg], offset, reg, mem_mask, space->device().safe_pc()); #endif return (UINT64)state->pvrctrl_regs[reg] << shift; diff --git a/src/mame/machine/dec0.c b/src/mame/machine/dec0.c index f9e93dd00ce..ed845f1b66a 100644 --- a/src/mame/machine/dec0.c +++ b/src/mame/machine/dec0.c @@ -28,11 +28,11 @@ READ16_MEMBER(dec0_state::dec0_controls_r) return ioport("DSW")->read(); case 8: /* Intel 8751 mc, Bad Dudes & Heavy Barrel only */ - //logerror("CPU #0 PC %06x: warning - read i8751 %06x - %04x\n", cpu_get_pc(&space.device()), 0x30c000+offset, m_i8751_return); + //logerror("CPU #0 PC %06x: warning - read i8751 %06x - %04x\n", space.device().safe_pc(), 0x30c000+offset, m_i8751_return); return m_i8751_return; } - logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", cpu_get_pc(&space.device()), 0x30c000+offset); + logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", space.device().safe_pc(), 0x30c000+offset); return ~0; } @@ -80,7 +80,7 @@ READ16_MEMBER(dec0_state::midres_controls_r) return 0; /* ?? watchdog ?? */ } - logerror("PC %06x unknown control read at %02x\n", cpu_get_pc(&space.device()), 0x180000+offset); + logerror("PC %06x unknown control read at %02x\n", space.device().safe_pc(), 0x180000+offset); return ~0; } @@ -331,14 +331,14 @@ WRITE16_MEMBER(dec0_state::sprite_mirror_w) READ16_MEMBER(dec0_state::robocop_68000_share_r) { -//logerror("%08x: Share read %04x\n",cpu_get_pc(&space.device()),offset); +//logerror("%08x: Share read %04x\n",space.device().safe_pc(),offset); return m_robocop_shared_ram[offset]; } WRITE16_MEMBER(dec0_state::robocop_68000_share_w) { -// logerror("%08x: Share write %04x %04x\n",cpu_get_pc(&space.device()),offset,data); +// logerror("%08x: Share write %04x %04x\n",space.device().safe_pc(),offset,data); m_robocop_shared_ram[offset]=data&0xff; diff --git a/src/mame/machine/decocass.c b/src/mame/machine/decocass.c index f31efb2784c..18abebb699c 100644 --- a/src/mame/machine/decocass.c +++ b/src/mame/machine/decocass.c @@ -210,7 +210,7 @@ READ8_HANDLER( decocass_input_r ) WRITE8_HANDLER( decocass_reset_w ) { decocass_state *state = space->machine().driver_data(); - LOG(1,("%10s 6502-PC: %04x decocass_reset_w(%02x): $%02x\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(1,("%10s 6502-PC: %04x decocass_reset_w(%02x): $%02x\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); state->m_decocass_reset = data; /* CPU #1 active high reset */ @@ -289,7 +289,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_3_inv_2_r ) data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c; LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data & 1) ? "OBF" : "-", (data & 2) ? "IBF" : "-")); } @@ -337,7 +337,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_3_inv_2_r ) (((prom[promaddr] >> 4) & 1) << MAP7(state->m_type1_outmap)); LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); state->m_latch1 = save; /* latch the data for the next A0 == 0 read */ } @@ -369,7 +369,7 @@ static READ8_HANDLER( decocass_type1_pass_136_r ) data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c; LOG(4,("%10s 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x <- (%s %s)\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data & 1) ? "OBF" : "-", (data & 2) ? "IBF" : "-")); } @@ -417,7 +417,7 @@ static READ8_HANDLER( decocass_type1_pass_136_r ) (((prom[promaddr] >> 4) & 1) << MAP7(state->m_type1_outmap)); LOG(3,("%10s 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); state->m_latch1 = save; /* latch the data for the next A0 == 0 read */ } @@ -449,7 +449,7 @@ static READ8_HANDLER( decocass_type1_latch_27_pass_3_inv_2_r ) data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c; LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data & 1) ? "OBF" : "-", (data & 2) ? "IBF" : "-")); } @@ -497,7 +497,7 @@ static READ8_HANDLER( decocass_type1_latch_27_pass_3_inv_2_r ) (((state->m_latch1 >> MAP7(state->m_type1_inmap)) & 1) << MAP7(state->m_type1_outmap)); LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); state->m_latch1 = save; /* latch the data for the next A0 == 0 read */ } @@ -529,7 +529,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_5_inv_2_r ) data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c; LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x <- (%s %s)\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data & 1) ? "OBF" : "-", (data & 2) ? "IBF" : "-")); } @@ -577,7 +577,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_5_inv_2_r ) (((prom[promaddr] >> 4) & 1) << MAP7(state->m_type1_outmap)); LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); state->m_latch1 = save; /* latch the data for the next A0 == 0 read */ } @@ -611,7 +611,7 @@ static READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r ) data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c; LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x <- (%s %s)\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data & 1) ? "OBF" : "-", (data & 2) ? "IBF" : "-")); } @@ -659,7 +659,7 @@ static READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r ) (((prom[promaddr] >> 4) & 1) << MAP7(state->m_type1_outmap)); LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x\n", - space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); state->m_latch1 = save; /* latch the data for the next A0 == 0 read */ } @@ -689,7 +689,7 @@ static READ8_HANDLER( decocass_type2_r ) { UINT8 *prom = state->memregion("dongle")->base(); data = prom[256 * state->m_type2_d2_latch + state->m_type2_promaddr]; - LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, 256 * state->m_type2_d2_latch + state->m_type2_promaddr)); + LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- prom[%03x]\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, 256 * state->m_type2_d2_latch + state->m_type2_promaddr)); } else { @@ -703,7 +703,7 @@ static READ8_HANDLER( decocass_type2_r ) else data = offset & 0xff; - LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- 8041-%s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, offset & 1 ? "STATUS" : "DATA")); + LOG(3,("%10s 6502-PC: %04x decocass_type2_r(%02x): $%02x <- 8041-%s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, offset & 1 ? "STATUS" : "DATA")); } return data; } @@ -715,18 +715,18 @@ static WRITE8_HANDLER( decocass_type2_w ) { if (1 == (offset & 1)) { - LOG(4,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM+D2 latch", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM+D2 latch", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } else { state->m_type2_promaddr = data; - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM addr $%02x\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, state->m_type2_promaddr)); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> set PROM addr $%02x\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, state->m_type2_promaddr)); return; } } else { - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s ", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, offset & 1 ? "8041-CMND" : "8041 DATA")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s ", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, offset & 1 ? "8041-CMND" : "8041 DATA")); } if (1 == (offset & 1)) { @@ -773,7 +773,7 @@ static READ8_HANDLER( decocass_type3_r ) { UINT8 *prom = state->memregion("dongle")->base(); data = prom[state->m_type3_ctrs]; - LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, state->m_type3_ctrs)); + LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- prom[$%03x]\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, state->m_type3_ctrs)); if (++state->m_type3_ctrs == 4096) state->m_type3_ctrs = 0; } @@ -782,12 +782,12 @@ static READ8_HANDLER( decocass_type3_r ) if (0 == (offset & E5XX_MASK)) { data = upi41_master_r(state->m_mcu, 1); - LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } else { data = 0xff; /* open data bus? */ - LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } } @@ -796,7 +796,7 @@ static READ8_HANDLER( decocass_type3_r ) if (1 == state->m_type3_pal_19) { save = data = 0xff; /* open data bus? */ - LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- open bus", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } else { @@ -938,7 +938,7 @@ static READ8_HANDLER( decocass_type3_r ) (BIT(save, 7) << 7); } state->m_type3_d0_latch = save & 1; - LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- 8041-DATA\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.')); + LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- 8041-DATA\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data >= 32) ? data : '.')); } else { @@ -952,7 +952,7 @@ static READ8_HANDLER( decocass_type3_r ) (BIT(save, 5) << 5) | (BIT(save, 6) << 7) | (BIT(save, 7) << 6); - LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.')); + LOG(3,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data >= 32) ? data : '.')); state->m_type3_d0_latch = save & 1; } } @@ -969,7 +969,7 @@ static WRITE8_HANDLER( decocass_type3_w ) if (1 == state->m_type3_pal_19) { state->m_type3_ctrs = data << 4; - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, "LDCTRS")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, "LDCTRS")); return; } else @@ -981,11 +981,11 @@ static WRITE8_HANDLER( decocass_type3_w ) if (1 == state->m_type3_pal_19) { /* write nowhere?? */ - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, "nowhere?")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, "nowhere?")); return; } } - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); upi41_master_w(state->m_mcu, offset, data); } @@ -1012,12 +1012,12 @@ static READ8_HANDLER( decocass_type4_r ) if (0 == (offset & E5XX_MASK)) { data = upi41_master_r(state->m_mcu, 1); - LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } else { data = 0xff; /* open data bus? */ - LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } else @@ -1027,7 +1027,7 @@ static READ8_HANDLER( decocass_type4_r ) UINT8 *prom = space->machine().root_device().memregion("dongle")->base(); data = prom[state->m_type4_ctrs]; - LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.', state->m_type4_ctrs)); + LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- PROM[%04x]\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data >= 32) ? data : '.', state->m_type4_ctrs)); state->m_type4_ctrs = (state->m_type4_ctrs + 1) & 0x7fff; } else @@ -1035,12 +1035,12 @@ static READ8_HANDLER( decocass_type4_r ) if (0 == (offset & E5XX_MASK)) { data = upi41_master_r(state->m_mcu, 0); - LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.')); + LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data >= 32) ? data : '.')); } else { data = 0xff; /* open data bus? */ - LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } } @@ -1056,7 +1056,7 @@ static WRITE8_HANDLER( decocass_type4_w ) if (1 == state->m_type4_latch) { state->m_type4_ctrs = (state->m_type4_ctrs & 0x00ff) | ((data & 0x7f) << 8); - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS MSB (%04x)\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, state->m_type4_ctrs)); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS MSB (%04x)\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, state->m_type4_ctrs)); return; } else @@ -1070,11 +1070,11 @@ static WRITE8_HANDLER( decocass_type4_w ) if (state->m_type4_latch) { state->m_type4_ctrs = (state->m_type4_ctrs & 0xff00) | data; - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS LSB (%04x)\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, state->m_type4_ctrs)); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> CTRS LSB (%04x)\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, state->m_type4_ctrs)); return; } } - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); upi41_master_w(state->m_mcu, offset, data); } @@ -1097,12 +1097,12 @@ static READ8_HANDLER( decocass_type5_r ) if (0 == (offset & E5XX_MASK)) { data = upi41_master_r(state->m_mcu, 1); - LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } else { data = 0xff; /* open data bus? */ - LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } else @@ -1110,19 +1110,19 @@ static READ8_HANDLER( decocass_type5_r ) if (state->m_type5_latch) { data = 0x55; /* Only a fixed value? It looks like this is all we need to do */ - LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- fixed value???\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.')); + LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- fixed value???\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data >= 32) ? data : '.')); } else { if (0 == (offset & E5XX_MASK)) { data = upi41_master_r(state->m_mcu, 0); - LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.')); + LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data >= 32) ? data : '.')); } else { data = 0xff; /* open data bus? */ - LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } } @@ -1137,7 +1137,7 @@ static WRITE8_HANDLER( decocass_type5_w ) { if (1 == state->m_type5_latch) { - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, "latch #2??")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, "latch #2??")); return; } else @@ -1149,11 +1149,11 @@ static WRITE8_HANDLER( decocass_type5_w ) if (state->m_type5_latch) { /* write nowhere?? */ - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, "nowhere?")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, "nowhere?")); return; } } - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); upi41_master_w(state->m_mcu, offset, data); } @@ -1175,12 +1175,12 @@ static READ8_HANDLER( decocass_nodong_r ) if (0 == (offset & E5XX_MASK)) { data = upi41_master_r(state->m_mcu, 1); - LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- 8041 STATUS\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } else { data = 0xff; /* open data bus? */ - LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } else @@ -1188,12 +1188,12 @@ static READ8_HANDLER( decocass_nodong_r ) if (0 == (offset & E5XX_MASK)) { data = upi41_master_r(state->m_mcu, 0); - LOG(3,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, (data >= 32) ? data : '.')); + LOG(3,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, (data >= 32) ? data : '.')); } else { data = 0xff; /* open data bus? */ - LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- open bus\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } @@ -1228,7 +1228,7 @@ READ8_HANDLER( decocass_e5xx_r ) LOG(4,("%10s 6502-PC: %04x decocass_e5xx_r(%02x): $%02x <- STATUS (%s%s%s%s%s%s%s%s)\n", space->machine().time().as_string(6), - cpu_get_previouspc(&space->device()), + space->device().safe_pcbase(), offset, data, data & 0x01 ? "" : "REQ/", data & 0x02 ? "" : " FNO/", @@ -1260,7 +1260,7 @@ WRITE8_HANDLER( decocass_e5xx_w ) if (0 == (offset & E5XX_MASK)) { - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); upi41_master_w(state->m_mcu, offset & 1, data); #ifdef MAME_DEBUG decocass_fno(space->machine(), offset, data); @@ -1268,7 +1268,7 @@ WRITE8_HANDLER( decocass_e5xx_w ) } else { - LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> dongle\n", space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data)); + LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> dongle\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data)); } } @@ -1758,7 +1758,7 @@ WRITE8_HANDLER( i8041_p1_w ) { LOG(4,("%10s 8041-PC: %03x i8041_p1_w: $%02x (%s%s%s%s%s%s%s%s)\n", space->machine().time().as_string(6), - cpu_get_previouspc(&space->device()), + space->device().safe_pcbase(), data, data & 0x01 ? "" : "DATA-WRT", data & 0x02 ? "" : " DATA-CLK", @@ -1795,7 +1795,7 @@ READ8_HANDLER( i8041_p1_r ) { LOG(4,("%10s 8041-PC: %03x i8041_p1_r: $%02x (%s%s%s%s%s%s%s%s)\n", space->machine().time().as_string(6), - cpu_get_previouspc(&space->device()), + space->device().safe_pcbase(), data, data & 0x01 ? "" : "DATA-WRT", data & 0x02 ? "" : " DATA-CLK", @@ -1817,7 +1817,7 @@ WRITE8_HANDLER( i8041_p2_w ) { LOG(4,("%10s 8041-PC: %03x i8041_p2_w: $%02x (%s%s%s%s%s%s%s%s)\n", space->machine().time().as_string(6), - cpu_get_previouspc(&space->device()), + space->device().safe_pcbase(), data, data & 0x01 ? "" : "FNO/", data & 0x02 ? "" : " EOT/", @@ -1843,7 +1843,7 @@ READ8_HANDLER( i8041_p2_r ) { LOG(4,("%10s 8041-PC: %03x i8041_p2_r: $%02x (%s%s%s%s%s%s%s%s)\n", space->machine().time().as_string(6), - cpu_get_previouspc(&space->device()), + space->device().safe_pcbase(), data, data & 0x01 ? "" : "FNO/", data & 0x02 ? "" : " EOT/", diff --git a/src/mame/machine/decoprot.c b/src/mame/machine/decoprot.c index ce4837f676a..2ee400c43f3 100644 --- a/src/mame/machine/decoprot.c +++ b/src/mame/machine/decoprot.c @@ -121,7 +121,7 @@ WRITE16_HANDLER( deco16_104_prot_w ) /* Wizard Fire */ && offset != (0x370 >> 1) && offset != (0x3c0 >> 1) && offset != (0x430 >> 1) && offset != (0x460 >> 1) && offset != (0x5a0 >> 1) && offset != (0x5b0 >> 1) && offset != (0x6e0 >> 1) && offset != (0x7d0 >> 1) ) - logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n", cpu_get_pc(&space->device()), offset << 1, data); + logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n", space->device().safe_pc(), offset << 1, data); COMBINE_DATA(&deco16_prot_ram[offset]); } @@ -220,7 +220,7 @@ READ16_HANDLER( deco16_104_prot_r ) /* Wizard Fire */ return ((deco16_prot_ram[0x460/2]&0x0007)<<13) | ((deco16_prot_ram[0x460/2]&0x0008)<<9); } - logerror("Deco Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + logerror("Deco Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset<<1); return 0; } @@ -249,7 +249,7 @@ if (offset!=0x32 && offset!=0x36/2 && offset!=0x9e/2 && offset!=0x76/2 && offset!=0x40/2 && offset!=0x54/2 && offset!=0x56/2 && offset!=0x58/2 && offset!=0x6a/2 && offset!=0x2c/2 && offset!=0 && offset!=0x34 && offset!=0x8a && offset!=0x8e && offset!=0x92 && offset!=0x96 ) -logerror("Protection PC %06x: warning - write %04x to %04x\n",cpu_get_pc(&space->device()),data,offset<<1); +logerror("Protection PC %06x: warning - write %04x to %04x\n",space->device().safe_pc(),data,offset<<1); } @@ -409,7 +409,7 @@ READ16_HANDLER( deco16_60_prot_r ) /* Edward Randy */ return ((deco16_prot_ram[0x32/2]&0x00f0)<<8) | ((deco16_prot_ram[0x32/2]&0x000e)<<7) | ((deco16_prot_ram[0x32/2]&0x0001)<<11); } - logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset*2); + logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset*2); return 0; } @@ -455,7 +455,7 @@ WRITE16_HANDLER( deco16_66_prot_w ) /* Mutant Fighter */ && offset!=0xb6 && offset!=0xfa && offset!=0xe4 && offset!=0x3a && offset!=0x1e && offset!=0x38 && offset!=0x92 && offset!=0xa2 && offset!=0x308 && offset!=0x40e ) - logerror("Protection PC %06x: warning - write %04x to %04x\n",cpu_get_pc(&space->device()),data,offset); + logerror("Protection PC %06x: warning - write %04x to %04x\n",space->device().safe_pc(),data,offset); } READ16_HANDLER( deco16_66_prot_r ) /* Mutant Fighter */ @@ -553,7 +553,7 @@ READ16_HANDLER( deco16_66_prot_r ) /* Mutant Fighter */ { int ret=mutantf_port_0e_hack; mutantf_port_0e_hack=0x800; - //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1); return ret; } @@ -561,7 +561,7 @@ READ16_HANDLER( deco16_66_prot_r ) /* Mutant Fighter */ { int ret=mutantf_port_6a_hack; mutantf_port_6a_hack=0x2866; - //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1); return ret; } @@ -569,20 +569,20 @@ READ16_HANDLER( deco16_66_prot_r ) /* Mutant Fighter */ { int ret=mutantf_port_e8_hack; mutantf_port_e8_hack=0x2401; - //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1); return ret; } case 0xaa: /* ??? */ - //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1); return 0xc080; case 0x42: /* Strange, but consistent */ - //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1); return deco16_prot_ram[0x2c/2]^0x5302; case 0x48: /* Correct for test data, but I wonder if the 0x1800 is from an address, not a constant */ - //logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + //logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset<<1); return (0x1800) & (~deco16_prot_ram[0x36/2]); case 0x52: @@ -599,7 +599,7 @@ READ16_HANDLER( deco16_66_prot_r ) /* Mutant Fighter */ popmessage("Deco66: Read unmapped port %04x\n",offset*2); #endif - logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset<<1); + logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset<<1); return 0; } @@ -661,7 +661,7 @@ READ16_HANDLER( deco16_104_cninja_prot_r ) return space->machine().root_device().ioport("IN0")->read(); } - logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset); + logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset); return 0; } @@ -757,8 +757,8 @@ READ16_HANDLER( deco16_146_funkyjet_prot_r ) return space->machine().root_device().ioport("DSW")->read(); } - if (cpu_get_pc(&space->device())!=0xc0ea) - logerror("CPU #0 PC %06x: warning - read unmapped control address %06x (ctrl %04x)\n", cpu_get_pc(&space->device()), offset<<1, space->machine().root_device().ioport("INPUTS")->read()); + if (space->device().safe_pc()!=0xc0ea) + logerror("CPU #0 PC %06x: warning - read unmapped control address %06x (ctrl %04x)\n", space->device().safe_pc(), offset<<1, space->machine().root_device().ioport("INPUTS")->read()); return 0; } @@ -807,11 +807,11 @@ WRITE16_HANDLER( deco16_104_rohga_prot_w ) offset=offset*2; - //logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data); + //logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",space->device().safe_pc(),offset,data); if (offset==0xee || offset==0x42 || offset==0xa8) return; -// logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data); +// logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",space->device().safe_pc(),offset,data); #if 1 // 66 7c 7e 28 58 4a 9e @@ -828,7 +828,7 @@ WRITE16_HANDLER( deco16_104_rohga_prot_w ) return; // if (offset==0x3c) -// logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data); +// logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",space->device().safe_pc(),offset,data); // Actually read: // 22 24 26 2c 2e 30 32 3c 40 44 46 48 60 62 66 6a 6e 76 7e 80 82 84 86 88 8a 8c 90 94 96 98 9a 9c a0 c0 c4 c6 c8 cc ce d6 dc de @@ -856,7 +856,7 @@ WRITE16_HANDLER( deco16_104_rohga_prot_w ) return; #endif - logerror("CONTROL PC %06x: warning - write unmapped protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data); + logerror("CONTROL PC %06x: warning - write unmapped protection memory address %04x %04x\n",space->device().safe_pc(),offset,data); } READ16_HANDLER( deco16_104_rohga_prot_r ) @@ -864,7 +864,7 @@ READ16_HANDLER( deco16_104_rohga_prot_r ) const UINT16* prot_ram=decoprot_buffer_ram_selected ? decoprot_buffer_ram : deco16_prot_ram; // if (offset!=0x88/2 && offset!=0x44c/2 && offset!=0x36c/2 && offset!=0x292/2) -// logerror("Protection PC %06x: warning - read prot address %04x\n",cpu_get_pc(&space->device()),offset<<1); +// logerror("Protection PC %06x: warning - read prot address %04x\n",space->device().safe_pc(),offset<<1); switch (offset) { case 0x88/2: /* Player 1 & 2 input ports */ @@ -1209,7 +1209,7 @@ READ16_HANDLER( deco16_104_rohga_prot_r ) return DECO_PORT(0x58); } - logerror("Protection PC %06x: warning - read unmapped protection address %04x\n",cpu_get_pc(&space->device()),offset<<1); + logerror("Protection PC %06x: warning - read unmapped protection address %04x\n",space->device().safe_pc(),offset<<1); return 0; } @@ -1241,7 +1241,7 @@ static WRITE16_HANDLER( deco16_146_core_prot_w ) COMBINE_DATA(&decoprot_buffer_ram[offset>>1]); // if (offset!=0x5e0 && offset!=0x340 && offset!=0 && offset!=0x3d0 && offset!=0x280) -// logerror("%08x: Write protection port %04x, data %04x (%08x)\n", cpu_get_pc(&space->device()), offset, data, mem_mask); +// logerror("%08x: Write protection port %04x, data %04x (%08x)\n", space->device().safe_pc(), offset, data, mem_mask); } static READ16_HANDLER( deco16_146_core_prot_r ) @@ -1639,7 +1639,7 @@ static READ16_HANDLER( deco16_146_core_prot_r ) return val & (~deco16_mask); } - //logerror("Protection PC %06x: warning - read fully unmapped protection address %04x\n", cpu_get_pc(&space->device()), offset); + //logerror("Protection PC %06x: warning - read fully unmapped protection address %04x\n", space->device().safe_pc(), offset); return 0; } @@ -1691,7 +1691,7 @@ READ32_HANDLER( deco16_146_fghthist_prot_r ) && addr!=0x1ae && addr!=0x1d6 && addr!=0x4f8 && addr!=0x614 // cnofirmed && addr!=0x5ae && addr!=0x50a && addr!=0x476 && addr!=0x328 && addr!=0x3e && addr!=0x558 // dbl check these later && addr!=0x444 && addr!=0x46a // confirmed - && cpu_get_pc(&space->device())!=0x16448 // hmm + && space->device().safe_pc()!=0x16448 // hmm && addr!=0x67a && addr!=0x6c2 && addr!=0xac && addr!=0x416 && addr!=0x2c2 // confirmed && addr!=0x3d8 @@ -1714,10 +1714,10 @@ READ32_HANDLER( deco16_146_fghthist_prot_r ) && addr!=0x440 && addr!=0x460 ) { - logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", cpu_get_pc(&space->device()), addr, val); + logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", space->device().safe_pc(), addr, val); popmessage("Read protection port %04x", addr); } - // logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", cpu_get_pc(&space->device()), addr, val); + // logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", space->device().safe_pc(), addr, val); return (val<<16)|0xffff; } @@ -1745,7 +1745,7 @@ READ16_HANDLER( dietgo_104_prot_r ) case 0x506: return space->machine().root_device().ioport("DSW")->read(); } - logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space->device()), offset<<1); + logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space->device().safe_pc(), offset<<1); return 0; } @@ -1759,7 +1759,7 @@ WRITE16_HANDLER( dietgo_104_prot_w ) cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE); return; } - logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n", cpu_get_pc(&space->device()), offset << 1, data); + logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n", space->device().safe_pc(), offset << 1, data); } /**********************************************************************************/ @@ -1777,7 +1777,7 @@ READ16_HANDLER( deco16_104_pktgaldx_prot_r ) case 0x51a: return DECO_PORT(2); } - logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space->device()), offset<<1); + logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space->device().safe_pc(), offset<<1); return 0; } @@ -1785,7 +1785,7 @@ READ16_HANDLER( deco16_104_pktgaldx_prot_r ) WRITE16_HANDLER( deco16_104_pktgaldx_prot_w ) { COMBINE_DATA(&deco16_prot_ram[offset]); -// logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n",cpu_get_pc(&space->device()),offset<<1,data); +// logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n",space->device().safe_pc(),offset<<1,data); } /**********************************************************************************/ diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index f63fbe39530..57f8a628efd 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -919,7 +919,7 @@ static void execute_fdunlock(running_machine &machine, int ref, int params, cons /* support 0 or 1 parameters */ if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset)) - offset = cpu_get_pc(cpu); + offset = cpu->safe_pc(); keyaddr = addr_to_keyaddr(offset / 2); /* toggle the ignore PC status */ @@ -961,7 +961,7 @@ static void execute_fdignore(running_machine &machine, int ref, int params, cons return; } if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset)) - offset = cpu_get_pc(cpu); + offset = cpu->safe_pc(); offset /= 2; /* toggle the ignore PC status */ @@ -1060,7 +1060,7 @@ static void execute_fdpc(running_machine &machine, int ref, int params, const ch /* support 0 or 1 parameters */ if (!debug_command_parameter_number(machine, param[0], &newpc)) - newpc = cpu_get_pc(cpu); + newpc = cpu->safe_pc(); /* set the new PC */ cpu_set_reg(cpu, STATE_GENPC, newpc); @@ -1078,7 +1078,7 @@ static void execute_fdpc(running_machine &machine, int ref, int params, const ch static void execute_fdsearch(running_machine &machine, int ref, int params, const char **param) { address_space *space = debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); int length, first = TRUE; UINT8 instrdata[2]; UINT16 decoded; diff --git a/src/mame/machine/flstory.c b/src/mame/machine/flstory.c index 6cf2d3d3921..2dc30065cd5 100644 --- a/src/mame/machine/flstory.c +++ b/src/mame/machine/flstory.c @@ -23,14 +23,14 @@ READ8_MEMBER(flstory_state::flstory_68705_port_a_r) { - //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in); + //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in); return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a); } WRITE8_MEMBER(flstory_state::flstory_68705_port_a_w) { - //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data); m_port_a_out = data; } @@ -57,7 +57,7 @@ READ8_MEMBER(flstory_state::flstory_68705_port_b_r) WRITE8_MEMBER(flstory_state::flstory_68705_port_b_w) { - //logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(&space.device()),data); + //logerror("%04x: 68705 port B write %02x\n",space.device().safe_pc(),data); if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02)) { @@ -93,13 +93,13 @@ READ8_MEMBER(flstory_state::flstory_68705_port_c_r) if (!m_mcu_sent) m_port_c_in |= 0x02; - //logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(&space.device()), port_c_in); + //logerror("%04x: 68705 port C read %02x\n", space.device().safe_pc(), port_c_in); return (m_port_c_out & m_ddr_c) | (m_port_c_in & ~m_ddr_c); } WRITE8_MEMBER(flstory_state::flstory_68705_port_c_w) { - logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: 68705 port C write %02x\n", space.device().safe_pc(), data); m_port_c_out = data; } @@ -111,7 +111,7 @@ WRITE8_MEMBER(flstory_state::flstory_68705_ddr_c_w) WRITE8_MEMBER(flstory_state::flstory_mcu_w) { - logerror("%04x: mcu_w %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: mcu_w %02x\n", space.device().safe_pc(), data); m_from_main = data; m_main_sent = 1; device_set_input_line(m_mcu, 0, ASSERT_LINE); @@ -120,7 +120,7 @@ WRITE8_MEMBER(flstory_state::flstory_mcu_w) READ8_MEMBER(flstory_state::flstory_mcu_r) { - logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()), m_from_mcu); + logerror("%04x: mcu_r %02x\n",space.device().safe_pc(), m_from_mcu); m_mcu_sent = 0; return m_from_mcu; } @@ -131,7 +131,7 @@ READ8_MEMBER(flstory_state::flstory_mcu_status_r) /* bit 0 = when 1, mcu is ready to receive data from main cpu */ /* bit 1 = when 1, mcu has sent data to the main cpu */ - //logerror("%04x: mcu_status_r\n", cpu_get_pc(&space.device())); + //logerror("%04x: mcu_status_r\n", space.device().safe_pc()); if (!m_main_sent) res |= 0x01; if (m_mcu_sent) @@ -258,7 +258,7 @@ WRITE8_MEMBER(flstory_state::victnine_mcu_w) READ8_MEMBER(flstory_state::victnine_mcu_r) { - //logerror("%04x: mcu read (0x%02x)\n", cpu_get_previouspc(&space.device()), m_from_mcu); + //logerror("%04x: mcu read (0x%02x)\n", space.device().safe_pcbase(), m_from_mcu); return m_from_mcu - VICTNINE_MCU_SEED; } diff --git a/src/mame/machine/gaelco2.c b/src/mame/machine/gaelco2.c index c68e7110665..43e3f7a2689 100644 --- a/src/mame/machine/gaelco2.c +++ b/src/mame/machine/gaelco2.c @@ -236,7 +236,7 @@ WRITE16_MEMBER(gaelco2_state::wrally2_adc_clk) } } else - logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } @@ -252,7 +252,7 @@ WRITE16_MEMBER(gaelco2_state::wrally2_adc_cs) } } else - logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask); + logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask); } /*************************************************************************** @@ -300,13 +300,13 @@ WRITE16_DEVICE_HANDLER( gaelco2_eeprom_data_w ) READ16_MEMBER(gaelco2_state::snowboar_protection_r) { - logerror("%06x: protection read from %04x\n", cpu_get_pc(&space.device()), offset*2); + logerror("%06x: protection read from %04x\n", space.device().safe_pc(), offset*2); return 0x0000; } WRITE16_MEMBER(gaelco2_state::snowboar_protection_w) { COMBINE_DATA(&m_snowboar_protection[offset]); - logerror("%06x: protection write %04x to %04x\n", cpu_get_pc(&space.device()), data, offset*2); + logerror("%06x: protection write %04x to %04x\n", space.device().safe_pc(), data, offset*2); } diff --git a/src/mame/machine/gaelcrpt.c b/src/mame/machine/gaelcrpt.c index 3c6cf952aa3..e1dff00e98f 100644 --- a/src/mame/machine/gaelcrpt.c +++ b/src/mame/machine/gaelcrpt.c @@ -124,7 +124,7 @@ UINT16 gaelco_decrypt(address_space *space, int offset, int data, int param1, in { static int lastpc, lastoffset, lastencword, lastdecword; - int thispc = cpu_get_pc(&space->device()); + int thispc = space->device().safe_pc(); // int savedata = data; /* check if 2nd half of 32 bit */ diff --git a/src/mame/machine/galaxold.c b/src/mame/machine/galaxold.c index fef06e6c2bc..66a1f2a3c32 100644 --- a/src/mame/machine/galaxold.c +++ b/src/mame/machine/galaxold.c @@ -132,7 +132,7 @@ WRITE8_MEMBER(galaxold_state::galaxold_leds_w) #ifdef UNUSED_FUNCTION READ8_MEMBER(galaxold_state::checkmaj_protection_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x0f15: return 0xf5; case 0x0f8f: return 0x7c; @@ -141,7 +141,7 @@ READ8_MEMBER(galaxold_state::checkmaj_protection_r) case 0x10f1: return 0xaa; case 0x1402: return 0xaa; default: - logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space.device())); + logerror("Unknown protection read. PC=%04X\n",space.device().safe_pc()); } return 0; @@ -225,23 +225,23 @@ DRIVER_INIT_MEMBER(galaxold_state,dingoe) READ8_MEMBER(galaxold_state::scramblb_protection_1_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x01da: return 0x80; case 0x01e4: return 0x00; default: - logerror("%04x: read protection 1\n",cpu_get_pc(&space.device())); + logerror("%04x: read protection 1\n",space.device().safe_pc()); return 0; } } READ8_MEMBER(galaxold_state::scramblb_protection_2_r) { - switch (cpu_get_pc(&space.device())) + switch (space.device().safe_pc()) { case 0x01ca: return 0x90; default: - logerror("%04x: read protection 2\n",cpu_get_pc(&space.device())); + logerror("%04x: read protection 2\n",space.device().safe_pc()); return 0; } } diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 06ec1cc3146..322d8f53155 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -597,12 +597,12 @@ WRITE16_HANDLER( hd68k_adsp_data_w ) /* any write to $1FFF is taken to be a trigger; synchronize the CPUs */ if (offset == 0x1fff) { - logerror("%06X:ADSP sync address written (%04X)\n", cpu_get_previouspc(&space->device()), data); + logerror("%06X:ADSP sync address written (%04X)\n", space->device().safe_pcbase(), data); space->machine().scheduler().synchronize(); device_triggerint(state->m_adsp); } else - logerror("%06X:ADSP W@%04X (%04X)\n", cpu_get_previouspc(&space->device()), offset, data); + logerror("%06X:ADSP W@%04X (%04X)\n", space->device().safe_pcbase(), offset, data); } @@ -758,7 +758,7 @@ WRITE16_HANDLER( hd68k_adsp_control_w ) WRITE16_HANDLER( hd68k_adsp_irq_clear_w ) { harddriv_state *state = space->machine().driver_data(); - logerror("%06X:68k clears ADSP interrupt\n", cpu_get_previouspc(&space->device())); + logerror("%06X:68k clears ADSP interrupt\n", space->device().safe_pcbase()); state->m_adsp_irq_state = 0; atarigen_update_interrupts(space->machine()); } @@ -770,7 +770,7 @@ READ16_HANDLER( hd68k_adsp_irq_state_r ) int result = 0xfffd; if (state->m_adsp_xflag) result ^= 2; if (state->m_adsp_irq_state) result ^= 1; - logerror("%06X:68k reads ADSP interrupt state = %04x\n", cpu_get_previouspc(&space->device()), result); + logerror("%06X:68k reads ADSP interrupt state = %04x\n", space->device().safe_pcbase(), result); return result; } @@ -803,7 +803,7 @@ READ16_HANDLER( hdadsp_special_r ) break; default: - logerror("%04X:hdadsp_special_r(%04X)\n", cpu_get_previouspc(&space->device()), offset); + logerror("%04X:hdadsp_special_r(%04X)\n", space->device().safe_pcbase(), offset); break; } return 0; @@ -832,7 +832,7 @@ WRITE16_HANDLER( hdadsp_special_w ) break; case 6: /* /GINT */ - logerror("%04X:ADSP signals interrupt\n", cpu_get_previouspc(&space->device())); + logerror("%04X:ADSP signals interrupt\n", space->device().safe_pcbase()); state->m_adsp_irq_state = 1; atarigen_update_interrupts(space->machine()); break; @@ -842,7 +842,7 @@ WRITE16_HANDLER( hdadsp_special_w ) break; default: - logerror("%04X:hdadsp_special_w(%04X)=%04X\n", cpu_get_previouspc(&space->device()), offset, data); + logerror("%04X:hdadsp_special_w(%04X)=%04X\n", space->device().safe_pcbase(), offset, data); break; } } @@ -950,12 +950,12 @@ READ16_HANDLER( hd68k_ds3_girq_state_r ) READ16_HANDLER( hd68k_ds3_gdata_r ) { harddriv_state *state = space->machine().driver_data(); - offs_t pc = cpu_get_pc(&space->device()); + offs_t pc = space->device().safe_pc(); state->m_ds3_gflag = 0; update_ds3_irq(state); - logerror("%06X:hd68k_ds3_gdata_r(%04X)\n", cpu_get_previouspc(&space->device()), state->m_ds3_gdata); + logerror("%06X:hd68k_ds3_gdata_r(%04X)\n", space->device().safe_pcbase(), state->m_ds3_gdata); /* attempt to optimize the transfer if conditions are right */ if (&space->device() == state->m_maincpu && pc == state->m_ds3_transfer_pc && @@ -999,7 +999,7 @@ WRITE16_HANDLER( hd68k_ds3_gdata_w ) { harddriv_state *state = space->machine().driver_data(); - logerror("%06X:hd68k_ds3_gdata_w(%04X)\n", cpu_get_previouspc(&space->device()), state->m_ds3_gdata); + logerror("%06X:hd68k_ds3_gdata_w(%04X)\n", space->device().safe_pcbase(), state->m_ds3_gdata); COMBINE_DATA(&state->m_ds3_g68data); state->m_ds3_g68flag = 1; @@ -1079,7 +1079,7 @@ WRITE16_HANDLER( hdds3_special_w ) switch (offset & 7) { case 0: - logerror("%04X:ADSP sets gdata to %04X\n", cpu_get_previouspc(&space->device()), data); + logerror("%04X:ADSP sets gdata to %04X\n", space->device().safe_pcbase(), data); state->m_ds3_gdata = data; state->m_ds3_gflag = 1; update_ds3_irq(state); @@ -1089,7 +1089,7 @@ WRITE16_HANDLER( hdds3_special_w ) break; case 1: - logerror("%04X:ADSP sets interrupt = %d\n", cpu_get_previouspc(&space->device()), (data >> 1) & 1); + logerror("%04X:ADSP sets interrupt = %d\n", space->device().safe_pcbase(), (data >> 1) & 1); state->m_adsp_irq_state = (data >> 1) & 1; hd68k_update_interrupts(space->machine()); break; @@ -1546,7 +1546,7 @@ READ16_HANDLER( hdgsp_speedup_r ) /* if both this address and the other important address are not $ffff */ /* then we can spin until something gets written */ if (result != 0xffff && state->m_gsp_speedup_addr[1][0] != 0xffff && - &space->device() == state->m_gsp && cpu_get_pc(&space->device()) == state->m_gsp_speedup_pc) + &space->device() == state->m_gsp && space->device().safe_pc() == state->m_gsp_speedup_pc) { state->m_gsp_speedup_count[0]++; device_spin_until_interrupt(&space->device()); @@ -1595,7 +1595,7 @@ READ16_HANDLER( rdgsp_speedup1_r ) int result = state->m_gsp_speedup_addr[0][offset]; /* if this address is equal to $f000, spin until something gets written */ - if (&space->device() == state->m_gsp && cpu_get_pc(&space->device()) == state->m_gsp_speedup_pc && + if (&space->device() == state->m_gsp && space->device().safe_pc() == state->m_gsp_speedup_pc && (result & 0xff) < cpu_get_reg(&space->device(), TMS34010_A1)) { state->m_gsp_speedup_count[0]++; @@ -1632,7 +1632,7 @@ READ16_HANDLER( hdmsp_speedup_r ) harddriv_state *state = space->machine().driver_data(); int data = state->m_msp_speedup_addr[offset]; - if (data == 0 && &space->device() == state->m_msp && cpu_get_pc(&space->device()) == state->m_msp_speedup_pc) + if (data == 0 && &space->device() == state->m_msp && space->device().safe_pc() == state->m_msp_speedup_pc) { state->m_msp_speedup_count[0]++; device_spin_until_interrupt(&space->device()); @@ -1667,7 +1667,7 @@ READ16_HANDLER( hdadsp_speedup_r ) harddriv_state *state = space->machine().driver_data(); int data = state->m_adsp_data_memory[0x1fff]; - if (data == 0xffff && &space->device() == state->m_adsp && cpu_get_pc(&space->device()) <= 0x3b) + if (data == 0xffff && &space->device() == state->m_adsp && space->device().safe_pc() <= 0x3b) { state->m_adsp_speedup_count[0]++; device_spin_until_interrupt(&space->device()); @@ -1682,7 +1682,7 @@ READ16_HANDLER( hdds3_speedup_r ) harddriv_state *state = space->machine().driver_data(); int data = *state->m_ds3_speedup_addr; - if (data != 0 && &space->device() == state->m_adsp && cpu_get_pc(&space->device()) == state->m_ds3_speedup_pc) + if (data != 0 && &space->device() == state->m_adsp && space->device().safe_pc() == state->m_ds3_speedup_pc) { state->m_adsp_speedup_count[2]++; device_spin_until_interrupt(&space->device()); diff --git a/src/mame/machine/kaneko_hit.c b/src/mame/machine/kaneko_hit.c index 77f931d2938..32df7ec634f 100644 --- a/src/mame/machine/kaneko_hit.c +++ b/src/mame/machine/kaneko_hit.c @@ -194,7 +194,7 @@ READ16_MEMBER(kaneko_hit_device::kaneko_hit_type0_r) return (machine().rand() & 0xffff); default: - logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1); + logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",space.device().safe_pc(),offset<<1); } return 0; @@ -219,7 +219,7 @@ WRITE16_MEMBER(kaneko_hit_device::kaneko_hit_type0_w) case 0x12/2: hit.mult_b = data; break; default: - logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1); + logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",space.device().safe_pc(),offset<<1); } } @@ -286,7 +286,7 @@ READ16_MEMBER(kaneko_hit_device::kaneko_hit_type1_r) case 0x32/2: return hit.y2s; default: - logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1); + logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",space.device().safe_pc(),offset<<1); } return 0; @@ -314,7 +314,7 @@ WRITE16_MEMBER(kaneko_hit_device::kaneko_hit_type1_w) case 0x38/2: break; default: - logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1); + logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",space.device().safe_pc(),offset<<1); } } @@ -422,7 +422,7 @@ WRITE16_MEMBER(kaneko_hit_device::kaneko_hit_type2_w) hit3.mode=data;break; default: - logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x [ %06x] = %06x\n",cpu_get_pc(&space.device()),offset<<1, idx, data); + logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x [ %06x] = %06x\n",space.device().safe_pc(),offset<<1, idx, data); } type2_recalc_collisions(hit3); @@ -474,7 +474,7 @@ READ16_MEMBER(kaneko_hit_device::kaneko_hit_type2_r) case 0x88: return hit3.z1toz2; default: - logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x [ %06x]\n",cpu_get_pc(&space.device()),offset<<1, idx); + logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x [ %06x]\n",space.device().safe_pc(),offset<<1, idx); } return 0; diff --git a/src/mame/machine/kaneko_toybox.c b/src/mame/machine/kaneko_toybox.c index eb81826f458..626766d89e6 100644 --- a/src/mame/machine/kaneko_toybox.c +++ b/src/mame/machine/kaneko_toybox.c @@ -179,7 +179,7 @@ WRITE16_MEMBER(kaneko_toybox_device::toybox_mcu_com3_w){ toybox_mcu_com_w(offset */ READ16_MEMBER(kaneko_toybox_device::toybox_mcu_status_r) { - logerror("CPU %s (PC=%06X) : read MCU status\n", space.device().tag(), cpu_get_previouspc(&space.device())); + logerror("CPU %s (PC=%06X) : read MCU status\n", space.device().tag(), space.device().safe_pcbase()); return 0; // most games test bit 0 for failure } diff --git a/src/mame/machine/konamigx.c b/src/mame/machine/konamigx.c index 0a6907cab2e..cd5c0398345 100644 --- a/src/mame/machine/konamigx.c +++ b/src/mame/machine/konamigx.c @@ -143,7 +143,7 @@ WRITE16_MEMBER(konamigx_state::K055550_word_w) break; default: -// logerror("%06x: unknown K055550 command %02x\n", cpu_get_pc(&space.device()), data); +// logerror("%06x: unknown K055550 command %02x\n", space.device().safe_pc(), data); break; } } diff --git a/src/mame/machine/konppc.c b/src/mame/machine/konppc.c index a843a6c8ce4..dfc26037212 100644 --- a/src/mame/machine/konppc.c +++ b/src/mame/machine/konppc.c @@ -129,7 +129,7 @@ READ32_HANDLER( cgboard_dsp_comm_r_ppc ) { if (cgboard_id < MAX_CG_BOARDS) { -// mame_printf_debug("dsp_cmd_r: (board %d) %08X, %08X at %08X\n", cgboard_id, offset, mem_mask, cpu_get_pc(&space->device())); +// mame_printf_debug("dsp_cmd_r: (board %d) %08X, %08X at %08X\n", cgboard_id, offset, mem_mask, space->device().safe_pc()); return dsp_comm_sharc[cgboard_id][offset] | (dsp_state[cgboard_id] << 16); } else @@ -144,7 +144,7 @@ WRITE32_HANDLER( cgboard_dsp_comm_w_ppc ) const char *pcitag = (cgboard_id == 0) ? "k033906_1" : "k033906_2"; device_t *dsp = space->machine().device(dsptag); device_t *k033906 = space->machine().device(pcitag); -// mame_printf_debug("dsp_cmd_w: (board %d) %08X, %08X, %08X at %08X\n", cgboard_id, data, offset, mem_mask, cpu_get_pc(&space->device())); +// mame_printf_debug("dsp_cmd_w: (board %d) %08X, %08X, %08X at %08X\n", cgboard_id, data, offset, mem_mask, space->device().safe_pc()); if (cgboard_id < MAX_CG_BOARDS) { diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c index 3651ba87af9..54dad66e42e 100644 --- a/src/mame/machine/leland.c +++ b/src/mame/machine/leland.c @@ -109,7 +109,7 @@ WRITE8_MEMBER(leland_state::alleymas_joystick_kludge) { /* catch the case where they clear this memory location at PC $1827 and change */ /* the value written to be a 1 */ - if (cpu_get_previouspc(&space.device()) == 0x1827) + if (space.device().safe_pcbase() == 0x1827) *m_alleymas_kludge_mem = 1; else *m_alleymas_kludge_mem = data; @@ -469,7 +469,7 @@ WRITE8_MEMBER(leland_state::leland_master_alt_bankswitch_w) /* update any bankswitching */ if (LOG_BANKSWITCHING_M) if ((m_alternate_bank ^ data) & 0x0f) - logerror("%04X:alternate_bank = %02X\n", cpu_get_pc(&space.device()), data & 0x0f); + logerror("%04X:alternate_bank = %02X\n", space.device().safe_pc(), data & 0x0f); m_alternate_bank = data & 15; (*m_update_master_bank)(machine()); @@ -852,11 +852,11 @@ WRITE8_MEMBER(leland_state::leland_battery_ram_w) { if (m_battery_ram_enable) { - if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", cpu_get_pc(&space.device()), offset, data); + if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", space.device().safe_pc(), offset, data); m_battery_ram[offset] = data; } else - logerror("%04X:BatteryW@%04X (invalid!)\n", cpu_get_pc(&space.device()), offset); + logerror("%04X:BatteryW@%04X (invalid!)\n", space.device().safe_pc(), offset); } @@ -864,13 +864,13 @@ WRITE8_MEMBER(leland_state::ataxx_battery_ram_w) { if (m_battery_ram_enable) { - if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", cpu_get_pc(&space.device()), offset, data); + if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", space.device().safe_pc(), offset, data); m_battery_ram[offset] = data; } else if ((m_master_bank & 0x30) == 0x20) m_ataxx_qram[((m_master_bank & 0xc0) << 8) + offset] = data; else - logerror("%04X:BatteryW@%04X (invalid!)\n", cpu_get_pc(&space.device()), offset); + logerror("%04X:BatteryW@%04X (invalid!)\n", space.device().safe_pc(), offset); } @@ -1065,7 +1065,7 @@ WRITE8_MEMBER(leland_state::leland_master_analog_key_w) /* update top board banking for some games */ if (LOG_BANKSWITCHING_M) if ((m_top_board_bank ^ data) & 0xc0) - logerror("%04X:top_board_bank = %02X\n", cpu_get_pc(&space.device()), data & 0xc0); + logerror("%04X:top_board_bank = %02X\n", space.device().safe_pc(), data & 0xc0); m_top_board_bank = data & 0xc0; (*m_update_master_bank)(machine()); break; @@ -1116,7 +1116,7 @@ READ8_MEMBER(leland_state::leland_master_input_r) case 0x11: /* /GIN1 */ result = ioport("IN3")->read(); - if (LOG_EEPROM) logerror("%04X:EE read\n", cpu_get_pc(&space.device())); + if (LOG_EEPROM) logerror("%04X:EE read\n", space.device().safe_pc()); break; default: @@ -1140,7 +1140,7 @@ WRITE8_MEMBER(leland_state::leland_master_output_w) cputag_set_input_line(machine(), "slave", 0, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE); eeprom = machine().device("eeprom"); - if (LOG_EEPROM) logerror("%04X:EE write %d%d%d\n", cpu_get_pc(&space.device()), + if (LOG_EEPROM) logerror("%04X:EE write %d%d%d\n", space.device().safe_pc(), (data >> 6) & 1, (data >> 5) & 1, (data >> 4) & 1); eeprom->write_bit ((data & 0x10) >> 4); eeprom->set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE); @@ -1204,7 +1204,7 @@ WRITE8_MEMBER(leland_state::ataxx_master_output_w) case 0x04: /* /MBNK */ if (LOG_BANKSWITCHING_M) if ((m_master_bank ^ data) & 0xff) - logerror("%04X:master_bank = %02X\n", cpu_get_pc(&space.device()), data & 0xff); + logerror("%04X:master_bank = %02X\n", space.device().safe_pc(), data & 0xff); m_master_bank = data; ataxx_bankswitch(machine()); break; @@ -1257,22 +1257,22 @@ WRITE8_MEMBER(leland_state::ataxx_paletteram_and_misc_w) else if (offset == 0x7fc) { m_xrom1_addr = (m_xrom1_addr & 0xff00) | (data & 0x00ff); - if (LOG_XROM) logerror("%04X:XROM1 address low write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom1_addr); + if (LOG_XROM) logerror("%04X:XROM1 address low write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom1_addr); } else if (offset == 0x7fd) { m_xrom1_addr = (m_xrom1_addr & 0x00ff) | ((data << 8) & 0xff00); - if (LOG_XROM) logerror("%04X:XROM1 address high write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom1_addr); + if (LOG_XROM) logerror("%04X:XROM1 address high write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom1_addr); } else if (offset == 0x7fe) { m_xrom2_addr = (m_xrom2_addr & 0xff00) | (data & 0x00ff); - if (LOG_XROM) logerror("%04X:XROM2 address low write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom2_addr); + if (LOG_XROM) logerror("%04X:XROM2 address low write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom2_addr); } else if (offset == 0x7ff) { m_xrom2_addr = (m_xrom2_addr & 0x00ff) | ((data << 8) & 0xff00); - if (LOG_XROM) logerror("%04X:XROM2 address high write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom2_addr); + if (LOG_XROM) logerror("%04X:XROM2 address high write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom2_addr); } else m_extra_tram[offset] = data; @@ -1286,13 +1286,13 @@ READ8_MEMBER(leland_state::ataxx_paletteram_and_misc_r) else if (offset == 0x7fc || offset == 0x7fd) { int result = m_xrom_base[0x00000 | m_xrom1_addr | ((offset & 1) << 16)]; - if (LOG_XROM) logerror("%04X:XROM1 read(%d) = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), offset - 0x7fc, result, m_xrom1_addr); + if (LOG_XROM) logerror("%04X:XROM1 read(%d) = %02X (addr=%04X)\n", space.device().safe_pc(), offset - 0x7fc, result, m_xrom1_addr); return result; } else if (offset == 0x7fe || offset == 0x7ff) { int result = m_xrom_base[0x20000 | m_xrom2_addr | ((offset & 1) << 16)]; - if (LOG_XROM) logerror("%04X:XROM2 read(%d) = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), offset - 0x7fc, result, m_xrom2_addr); + if (LOG_XROM) logerror("%04X:XROM2 read(%d) = %02X (addr=%04X)\n", space.device().safe_pc(), offset - 0x7fc, result, m_xrom2_addr); return result; } else @@ -1346,12 +1346,12 @@ WRITE8_MEMBER(leland_state::leland_slave_small_banksw_w) if (bankaddress >= m_slave_length) { - logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 1); + logerror("%04X:Slave bank %02X out of range!", space.device().safe_pc(), data & 1); bankaddress = 0x10000; } membank("bank3")->set_base(&m_slave_base[bankaddress]); - if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data & 1, bankaddress); + if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", space.device().safe_pc(), data & 1, bankaddress); } @@ -1361,12 +1361,12 @@ WRITE8_MEMBER(leland_state::leland_slave_large_banksw_w) if (bankaddress >= m_slave_length) { - logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 15); + logerror("%04X:Slave bank %02X out of range!", space.device().safe_pc(), data & 15); bankaddress = 0x10000; } membank("bank3")->set_base(&m_slave_base[bankaddress]); - if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data & 15, bankaddress); + if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", space.device().safe_pc(), data & 15, bankaddress); } @@ -1385,12 +1385,12 @@ WRITE8_MEMBER(leland_state::ataxx_slave_banksw_w) if (bankaddress >= m_slave_length) { - logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 0x3f); + logerror("%04X:Slave bank %02X out of range!", space.device().safe_pc(), data & 0x3f); bankaddress = 0x2000; } membank("bank3")->set_base(&m_slave_base[bankaddress]); - if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data, bankaddress); + if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", space.device().safe_pc(), data, bankaddress); } diff --git a/src/mame/machine/lkage.c b/src/mame/machine/lkage.c index cab18cbb51b..395f6b4b1a3 100644 --- a/src/mame/machine/lkage.c +++ b/src/mame/machine/lkage.c @@ -23,14 +23,14 @@ READ8_MEMBER(lkage_state::lkage_68705_port_a_r) { - //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in); + //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in); return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a); } WRITE8_MEMBER(lkage_state::lkage_68705_port_a_w) { - //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data); m_port_a_out = data; } @@ -58,7 +58,7 @@ READ8_MEMBER(lkage_state::lkage_68705_port_b_r) WRITE8_MEMBER(lkage_state::lkage_68705_port_b_w) { - //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data); if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02)) { @@ -96,14 +96,14 @@ READ8_MEMBER(lkage_state::lkage_68705_port_c_r) if (!m_mcu_sent) m_port_c_in |= 0x02; - //logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(&space.device()), m_port_c_in); + //logerror("%04x: 68705 port C read %02x\n", space.device().safe_pc(), m_port_c_in); return (m_port_c_out & m_ddr_c) | (m_port_c_in & ~m_ddr_c); } WRITE8_MEMBER(lkage_state::lkage_68705_port_c_w) { - logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: 68705 port C write %02x\n", space.device().safe_pc(), data); m_port_c_out = data; } @@ -116,7 +116,7 @@ WRITE8_MEMBER(lkage_state::lkage_68705_ddr_c_w) WRITE8_MEMBER(lkage_state::lkage_mcu_w) { - logerror("%04x: mcu_w %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: mcu_w %02x\n", space.device().safe_pc(), data); m_from_main = data; m_main_sent = 1; device_set_input_line(m_mcu, 0, ASSERT_LINE); @@ -125,7 +125,7 @@ WRITE8_MEMBER(lkage_state::lkage_mcu_w) READ8_MEMBER(lkage_state::lkage_mcu_r) { - logerror("%04x: mcu_r %02x\n", cpu_get_pc(&space.device()), m_from_mcu); + logerror("%04x: mcu_r %02x\n", space.device().safe_pc(), m_from_mcu); m_mcu_sent = 0; return m_from_mcu; } @@ -136,7 +136,7 @@ READ8_MEMBER(lkage_state::lkage_mcu_status_r) /* bit 0 = when 1, mcu is ready to receive data from main cpu */ /* bit 1 = when 1, mcu has sent data to the main cpu */ - //logerror("%04x: mcu_status_r\n", cpu_get_pc(&space.device())); + //logerror("%04x: mcu_status_r\n", space.device().safe_pc()); if (!m_main_sent) res |= 0x01; if (m_mcu_sent) diff --git a/src/mame/machine/lsasquad.c b/src/mame/machine/lsasquad.c index 32e81324874..e9cca55b9d7 100644 --- a/src/mame/machine/lsasquad.c +++ b/src/mame/machine/lsasquad.c @@ -39,28 +39,28 @@ WRITE8_MEMBER(lsasquad_state::lsasquad_sound_command_w) m_sound_pending |= 0x01; m_sound_cmd = data; - //logerror("%04x: sound cmd %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: sound cmd %02x\n", space.device().safe_pc(), data); machine().scheduler().synchronize(FUNC(nmi_callback), data); } READ8_MEMBER(lsasquad_state::lsasquad_sh_sound_command_r) { m_sound_pending &= ~0x01; - //logerror("%04x: read sound cmd %02x\n", cpu_get_pc(&space.device()), m_sound_cmd); + //logerror("%04x: read sound cmd %02x\n", space.device().safe_pc(), m_sound_cmd); return m_sound_cmd; } WRITE8_MEMBER(lsasquad_state::lsasquad_sh_result_w) { m_sound_pending |= 0x02; - //logerror("%04x: sound res %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: sound res %02x\n", space.device().safe_pc(), data); m_sound_result = data; } READ8_MEMBER(lsasquad_state::lsasquad_sound_result_r) { m_sound_pending &= ~0x02; - //logerror("%04x: read sound res %02x\n", cpu_get_pc(&space.device()), m_sound_result); + //logerror("%04x: read sound res %02x\n", space.device().safe_pc(), m_sound_result); return m_sound_result; } @@ -77,7 +77,7 @@ READ8_MEMBER(lsasquad_state::daikaiju_sh_sound_command_r) { m_sound_pending &= ~0x01; m_sound_pending |= 0x02; - //logerror("%04x: read sound cmd %02x\n", cpu_get_pc(&space.device()), m_sound_cmd); + //logerror("%04x: read sound cmd %02x\n", space.device().safe_pc(), m_sound_cmd); return m_sound_cmd; } @@ -101,14 +101,14 @@ READ8_MEMBER(lsasquad_state::daikaiju_sound_status_r) READ8_MEMBER(lsasquad_state::lsasquad_68705_port_a_r) { - //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in); + //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in); return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a); } WRITE8_MEMBER(lsasquad_state::lsasquad_68705_port_a_w) { - //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data); m_port_a_out = data; } @@ -136,7 +136,7 @@ READ8_MEMBER(lsasquad_state::lsasquad_68705_port_b_r) WRITE8_MEMBER(lsasquad_state::lsasquad_68705_port_b_w) { - //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data); if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02)) { @@ -165,7 +165,7 @@ WRITE8_MEMBER(lsasquad_state::lsasquad_68705_ddr_b_w) WRITE8_MEMBER(lsasquad_state::lsasquad_mcu_w) { - //logerror("%04x: mcu_w %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: mcu_w %02x\n", space.device().safe_pc(), data); m_from_main = data; m_main_sent = 1; device_set_input_line(m_mcu, 0, ASSERT_LINE); @@ -174,7 +174,7 @@ WRITE8_MEMBER(lsasquad_state::lsasquad_mcu_w) READ8_MEMBER(lsasquad_state::lsasquad_mcu_r) { - //logerror("%04x: mcu_r %02x\n", cpu_get_pc(&space.device()), m_from_mcu); + //logerror("%04x: mcu_r %02x\n", space.device().safe_pc(), m_from_mcu); m_mcu_sent = 0; return m_from_mcu; } @@ -185,7 +185,7 @@ READ8_MEMBER(lsasquad_state::lsasquad_mcu_status_r) /* bit 0 = when 1, mcu is ready to receive data from main cpu */ /* bit 1 = when 0, mcu has sent data to the main cpu */ - //logerror("%04x: mcu_status_r\n",cpu_get_pc(&space.device())); + //logerror("%04x: mcu_status_r\n",space.device().safe_pc()); if (!m_main_sent) res |= 0x01; if (!m_mcu_sent) @@ -200,7 +200,7 @@ READ8_MEMBER(lsasquad_state::daikaiju_mcu_status_r) /* bit 0 = when 1, mcu is ready to receive data from main cpu */ /* bit 1 = when 0, mcu has sent data to the main cpu */ - //logerror("%04x: mcu_status_r\n",cpu_get_pc(&space.device())); + //logerror("%04x: mcu_status_r\n",space.device().safe_pc()); if (!m_main_sent) res |= 0x01; if (!m_mcu_sent) diff --git a/src/mame/machine/m68kfmly.c b/src/mame/machine/m68kfmly.c index f3b95140f3a..068afd1e629 100644 --- a/src/mame/machine/m68kfmly.c +++ b/src/mame/machine/m68kfmly.c @@ -148,70 +148,70 @@ static UINT16 tmp68301_timer[0x50]; READ16_HANDLER( tmp68301_address_decoder_r ) { - LOG(("PC %08X: TMP68301_address_decoder_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffc00 + (offset * 2)))); + LOG(("PC %08X: TMP68301_address_decoder_r (%08X)\n", space->device().safe_pc(), (0xfffc00 + (offset * 2)))); return tmp68301_address_decoder[offset]; } WRITE16_HANDLER( tmp68301_address_decoder_w ) { - LOG(("PC %08X: TMP68301_address_decoder_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffc00 + (offset * 2)), data)); + LOG(("PC %08X: TMP68301_address_decoder_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffc00 + (offset * 2)), data)); tmp68301_address_decoder[offset] = data; } READ16_HANDLER( tmp68301_interrupt_controller_r ) { - LOG(("PC %08X: TMP68301_interrupt_controller_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffc80 + (offset * 2)))); + LOG(("PC %08X: TMP68301_interrupt_controller_r (%08X)\n", space->device().safe_pc(), (0xfffc80 + (offset * 2)))); return tmp68301_interrupt_controller[offset]; } WRITE16_HANDLER( tmp68301_interrupt_controller_w ) { - LOG(("PC %08X: TMP68301_interrupt_controller_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffc80 + (offset * 2)), data)); + LOG(("PC %08X: TMP68301_interrupt_controller_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffc80 + (offset * 2)), data)); tmp68301_interrupt_controller[offset] = data; } READ16_HANDLER( tmp68301_parallel_interface_r ) { - LOG(("PC %08X: TMP68301_parallel_interface_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffd00 + (offset * 2)))); + LOG(("PC %08X: TMP68301_parallel_interface_r (%08X)\n", space->device().safe_pc(), (0xfffd00 + (offset * 2)))); return tmp68301_parallel_interface[offset]; } WRITE16_HANDLER( tmp68301_parallel_interface_w ) { - LOG(("PC %08X: TMP68301_parallel_interface_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffd00 + (offset * 2)), data)); + LOG(("PC %08X: TMP68301_parallel_interface_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffd00 + (offset * 2)), data)); tmp68301_parallel_interface[offset] = data; } READ16_HANDLER( tmp68301_serial_interface_r ) { - LOG(("PC %08X: TMP68301_serial_interface_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffd80 + (offset * 2)))); + LOG(("PC %08X: TMP68301_serial_interface_r (%08X)\n", space->device().safe_pc(), (0xfffd80 + (offset * 2)))); return tmp68301_serial_interface[offset]; } WRITE16_HANDLER( tmp68301_serial_interface_w ) { - LOG(("PC %08X: TMP68301_serial_interface_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffd80 + (offset * 2)), data)); + LOG(("PC %08X: TMP68301_serial_interface_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffd80 + (offset * 2)), data)); tmp68301_serial_interface[offset] = data; } READ16_HANDLER( tmp68301_timer_r ) { - LOG(("PC %08X: TMP68301_timer_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffe00 + (offset * 2)))); + LOG(("PC %08X: TMP68301_timer_r (%08X)\n", space->device().safe_pc(), (0xfffe00 + (offset * 2)))); return tmp68301_timer[offset]; } WRITE16_HANDLER( tmp68301_timer_w ) { - LOG(("PC %08X: TMP68301_timer_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffe00 + (offset * 2)), data)); + LOG(("PC %08X: TMP68301_timer_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffe00 + (offset * 2)), data)); tmp68301_timer[offset] = data; } diff --git a/src/mame/machine/maniach.c b/src/mame/machine/maniach.c index 9451419dea6..fd07c38ce4d 100644 --- a/src/mame/machine/maniach.c +++ b/src/mame/machine/maniach.c @@ -23,7 +23,7 @@ READ8_HANDLER( maniach_68705_port_a_r ) { matmania_state *state = space->machine().driver_data(); - //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space->device()), state->m_port_a_in); + //logerror("%04x: 68705 port A read %02x\n", space->device().safe_pc(), state->m_port_a_in); return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a); } @@ -31,7 +31,7 @@ WRITE8_HANDLER( maniach_68705_port_a_w ) { matmania_state *state = space->machine().driver_data(); - //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space->device()), data); + //logerror("%04x: 68705 port A write %02x\n", space->device().safe_pc(), data); state->m_port_a_out = data; } @@ -62,7 +62,7 @@ WRITE8_HANDLER( maniach_68705_port_b_w ) { matmania_state *state = space->machine().driver_data(); - //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space->device()), data); + //logerror("%04x: 68705 port B write %02x\n", space->device().safe_pc(), data); if (BIT(state->m_ddr_b, 1) && BIT(~data, 1) && BIT(state->m_port_b_out, 1)) { @@ -99,7 +99,7 @@ READ8_HANDLER( maniach_68705_port_c_r ) if (!state->m_mcu_sent) state->m_port_c_in |= 0x02; - //logerror("%04x: 68705 port C read %02x\n",state->m_cpu_get_pc(&space->device()), state->m_port_c_in); + //logerror("%04x: 68705 port C read %02x\n",state->m_space->device().safe_pc(), state->m_port_c_in); return (state->m_port_c_out & state->m_ddr_c) | (state->m_port_c_in & ~state->m_ddr_c); } @@ -108,7 +108,7 @@ WRITE8_HANDLER( maniach_68705_port_c_w ) { matmania_state *state = space->machine().driver_data(); - //logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(&space->device()), data); + //logerror("%04x: 68705 port C write %02x\n", space->device().safe_pc(), data); state->m_port_c_out = data; } @@ -123,7 +123,7 @@ WRITE8_HANDLER( maniach_mcu_w ) { matmania_state *state = space->machine().driver_data(); - //logerror("%04x: 3040_w %02x\n", cpu_get_pc(&space->device()), data); + //logerror("%04x: 3040_w %02x\n", space->device().safe_pc(), data); state->m_from_main = data; state->m_main_sent = 1; } @@ -132,7 +132,7 @@ READ8_HANDLER( maniach_mcu_r ) { matmania_state *state = space->machine().driver_data(); - //logerror("%04x: 3040_r %02x\n", cpu_get_pc(&space->device()), state->m_from_mcu); + //logerror("%04x: 3040_r %02x\n", space->device().safe_pc(), state->m_from_mcu); state->m_mcu_sent = 0; return state->m_from_mcu; } @@ -144,7 +144,7 @@ READ8_HANDLER( maniach_mcu_status_r ) /* bit 0 = when 0, mcu has sent data to the main cpu */ /* bit 1 = when 1, mcu is ready to receive data from main cpu */ - //logerror("%04x: 3041_r\n", cpu_get_pc(&space->device())); + //logerror("%04x: 3041_r\n", space->device().safe_pc()); if (!state->m_mcu_sent) res |= 0x01; if (!state->m_main_sent) diff --git a/src/mame/machine/mcr.c b/src/mame/machine/mcr.c index 5fd0583888e..9dcbb76b995 100644 --- a/src/mame/machine/mcr.c +++ b/src/mame/machine/mcr.c @@ -246,7 +246,7 @@ WRITE8_MEMBER(mcr_state::mcr_ipu_laserdisk_w) /* bit 1 enables (1) LD left channel audio */ /* bit 0 enables (1) LD video if PIX SW == 1 */ if (data != 0) - logerror("%04X:mcr_ipu_laserdisk_w(%d) = %02X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%04X:mcr_ipu_laserdisk_w(%d) = %02X\n", space.device().safe_pc(), offset, data); } diff --git a/src/mame/machine/mcr68.c b/src/mame/machine/mcr68.c index c5d75f9baae..9f62f0ff813 100644 --- a/src/mame/machine/mcr68.c +++ b/src/mame/machine/mcr68.c @@ -539,13 +539,13 @@ WRITE8_MEMBER(mcr68_state::mcr68_6840_w_common) if (diffs & 0x02) reload_count(counter); - LOG(("%06X:Counter %d control = %02X\n", cpu_get_previouspc(&space.device()), counter, data)); + LOG(("%06X:Counter %d control = %02X\n", space.device().safe_pcbase(), counter, data)); } /* offsets 2, 4, and 6 are MSB buffer registers */ else if ((offset & 1) == 0) { - LOG(("%06X:MSB = %02X\n", cpu_get_previouspc(&space.device()), data)); + LOG(("%06X:MSB = %02X\n", space.device().safe_pcbase(), data)); m_m6840_msb_buffer = data; } @@ -564,7 +564,7 @@ WRITE8_MEMBER(mcr68_state::mcr68_6840_w_common) if (!(m6840->control & 0x10)) reload_count(counter); - LOG(("%06X:Counter %d latch = %04X\n", cpu_get_previouspc(&space.device()), counter, m6840->latch)); + LOG(("%06X:Counter %d latch = %04X\n", space.device().safe_pcbase(), counter, m6840->latch)); } } @@ -578,7 +578,7 @@ READ16_MEMBER(mcr68_state::mcr68_6840_r_common) /* offset 1 is the status register */ else if (offset == 1) { - LOG(("%06X:Status read = %04X\n", cpu_get_previouspc(&space.device()), m_m6840_status)); + LOG(("%06X:Status read = %04X\n", space.device().safe_pcbase(), m_m6840_status)); m_m6840_status_read_since_int |= m_m6840_status & 0x07; return m_m6840_status; } @@ -596,7 +596,7 @@ READ16_MEMBER(mcr68_state::mcr68_6840_r_common) m_m6840_lsb_buffer = result & 0xff; - LOG(("%06X:Counter %d read = %04X\n", cpu_get_previouspc(&space.device()), counter, result)); + LOG(("%06X:Counter %d read = %04X\n", space.device().safe_pcbase(), counter, result)); return result >> 8; } diff --git a/src/mame/machine/md_cart.c b/src/mame/machine/md_cart.c index e2dc83786f5..b9492819e78 100644 --- a/src/mame/machine/md_cart.c +++ b/src/mame/machine/md_cart.c @@ -418,7 +418,7 @@ static WRITE16_HANDLER( chifi3_bank_w ) } else { - logerror("%06x chifi3, bankw? %04x %04x\n", cpu_get_pc(&space->device()), offset, data); + logerror("%06x chifi3, bankw? %04x %04x\n", space->device().safe_pc(), offset, data); } } @@ -435,39 +435,39 @@ static READ16_HANDLER( chifi3_prot_r ) 04cefa chifi3, prot_r? 65262 */ - if (cpu_get_pc(&space->device()) == 0x01782) // makes 'VS' screen appear + if (space->device().safe_pc() == 0x01782) // makes 'VS' screen appear { retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff; retdat <<= 8; return retdat; } - else if (cpu_get_pc(&space->device()) == 0x1c24) // background gfx etc. + else if (space->device().safe_pc() == 0x1c24) // background gfx etc. { retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff; retdat <<= 8; return retdat; } - else if (cpu_get_pc(&space->device()) == 0x10c4a) // unknown + else if (space->device().safe_pc() == 0x10c4a) // unknown { return space->machine().rand(); } - else if (cpu_get_pc(&space->device()) == 0x10c50) // unknown + else if (space->device().safe_pc() == 0x10c50) // unknown { return space->machine().rand(); } - else if (cpu_get_pc(&space->device()) == 0x10c52) // relates to the game speed.. + else if (space->device().safe_pc() == 0x10c52) // relates to the game speed.. { retdat = cpu_get_reg(&space->device(), M68K_D4) & 0xff; retdat <<= 8; return retdat; } - else if (cpu_get_pc(&space->device()) == 0x061ae) + else if (space->device().safe_pc() == 0x061ae) { retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff; retdat <<= 8; return retdat; } - else if (cpu_get_pc(&space->device()) == 0x061b0) + else if (space->device().safe_pc() == 0x061b0) { retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff; retdat <<= 8; @@ -475,7 +475,7 @@ static READ16_HANDLER( chifi3_prot_r ) } else { - logerror("%06x chifi3, prot_r? %04x\n", cpu_get_pc(&space->device()), offset); + logerror("%06x chifi3, prot_r? %04x\n", space->device().safe_pc(), offset); } return 0; @@ -504,20 +504,20 @@ static WRITE16_HANDLER( kaiju_bank_w ) *************************************/ static READ16_HANDLER( soulb_400006_r ) { -// printf("%06x soulb_400006_r\n",cpu_get_pc(&space->device())); +// printf("%06x soulb_400006_r\n",space->device().safe_pc()); return 0xf000; } static READ16_HANDLER( soulb_400002_r ) { -// printf("%06x soulb_400002_r\n",cpu_get_pc(&space->device())); +// printf("%06x soulb_400002_r\n",space->device().safe_pc()); return 0x9800; } static READ16_HANDLER( soulb_400004_r ) { // return 0x9800; -// printf("%06x soulb_400004_r\n",cpu_get_pc(&space->device())); +// printf("%06x soulb_400004_r\n",space->device().safe_pc()); // return 0xc900; //aa @@ -742,11 +742,11 @@ static READ16_HANDLER( topfig_6BD294_r ) /* colours on title screen */ cpu #0 (PC=001771A2): unmapped program memory word read from 006BD294 & 00FF */ - if (cpu_get_pc(&space->device())==0x1771a2) return 0x50; + if (space->device().safe_pc()==0x1771a2) return 0x50; else { x++; - logerror("%06x topfig_6BD294_r %04x\n",cpu_get_pc(&space->device()), x); + logerror("%06x topfig_6BD294_r %04x\n",space->device().safe_pc(), x); return x; } } @@ -755,14 +755,14 @@ static READ16_HANDLER( topfig_6F5344_r ) // after char select { static int x = -1; - if (cpu_get_pc(&space->device())==0x4C94E) + if (space->device().safe_pc()==0x4C94E) { return cpu_get_reg(space->machine().device("maincpu"), (M68K_D0)) & 0xff; } else { x++; - logerror("%06x topfig_6F5344_r %04x\n",cpu_get_pc(&space->device()), x); + logerror("%06x topfig_6F5344_r %04x\n",space->device().safe_pc(), x); return x; } } @@ -773,7 +773,7 @@ static WRITE16_HANDLER( topfig_bank_w ) if (data == 0x002a) { memcpy(ROM + 0x060000, ROM + 0x570000, 0x8000); // == 0x2e*0x8000?! - // printf("%06x offset %06x, data %04x\n",cpu_get_pc(&space->device()), offset, data); + // printf("%06x offset %06x, data %04x\n",space->device().safe_pc(), offset, data); } else if (data==0x0035) // characters ingame @@ -789,11 +789,11 @@ static WRITE16_HANDLER( topfig_bank_w ) memcpy(ROM + 0x060000, ROM + 0x460000, 0x8000); memcpy(ROM + 0x020000, ROM + 0x420000, 0x8000); memcpy(ROM + 0x058000, ROM + 0x458000, 0x8000); - // printf("%06x offset %06x, data %04x\n",cpu_get_pc(&space->device()), offset, data); + // printf("%06x offset %06x, data %04x\n",space->device().safe_pc(), offset, data); } else { - logerror("%06x offset %06x, data %04x\n", cpu_get_pc(&space->device()), offset, data); + logerror("%06x offset %06x, data %04x\n", space->device().safe_pc(), offset, data); } } diff --git a/src/mame/machine/mega32x.c b/src/mame/machine/mega32x.c index 8bbf18f72f8..bdaec546baa 100644 --- a/src/mame/machine/mega32x.c +++ b/src/mame/machine/mega32x.c @@ -446,7 +446,7 @@ READ16_MEMBER( sega_32x_device::_32x_dreq_common_r ) printf("Fifo block a isn't filled!\n"); if (current_fifo_readblock == fifo_block_b && !fifo_block_b_full) - printf("%08x Fifo block b isn't filled!\n",cpu_get_pc(&space.device())); + printf("%08x Fifo block b isn't filled!\n",space.device().safe_pc()); if (current_fifo_read_pos==4) diff --git a/src/mame/machine/megadriv.c b/src/mame/machine/megadriv.c index d4cf1ea19ae..767ee10153c 100644 --- a/src/mame/machine/megadriv.c +++ b/src/mame/machine/megadriv.c @@ -86,13 +86,13 @@ static void megadriv_z80_bank_w(UINT16 data) static WRITE16_HANDLER( megadriv_68k_z80_bank_write ) { - //logerror("%06x: 68k writing bit to bank register %01x\n", cpu_get_pc(&space->device()),data&0x01); + //logerror("%06x: 68k writing bit to bank register %01x\n", space->device().safe_pc(),data&0x01); megadriv_z80_bank_w(data&0x01); } static WRITE8_HANDLER(megadriv_z80_z80_bank_w) { - //logerror("%04x: z80 writing bit to bank register %01x\n", cpu_get_pc(&space->device()),data&0x01); + //logerror("%04x: z80 writing bit to bank register %01x\n", space->device().safe_pc(),data&0x01); megadriv_z80_bank_w(data&0x01); } @@ -419,7 +419,7 @@ READ16_HANDLER( megadriv_68k_io_read ) switch (offset) { case 0: - logerror("%06x read version register\n", cpu_get_pc(&space->device())); + logerror("%06x read version register\n", space->device().safe_pc()); retdata = megadrive_region_export<<7 | // Export megadrive_region_pal<<6 | // NTSC (sega_cd_connected?0x00:0x20) | // 0x20 = no sega cd @@ -603,7 +603,7 @@ static READ16_HANDLER( megadriv_68k_read_z80_ram ) } else { - logerror("%06x: 68000 attempting to access Z80 (read) address space without bus\n", cpu_get_pc(&space->device())); + logerror("%06x: 68000 attempting to access Z80 (read) address space without bus\n", space->device().safe_pc()); return space->machine().rand(); } } @@ -630,7 +630,7 @@ static WRITE16_HANDLER( megadriv_68k_write_z80_ram ) } else { - logerror("%06x: 68000 attempting to access Z80 (write) address space without bus\n", cpu_get_pc(&space->device())); + logerror("%06x: 68000 attempting to access Z80 (write) address space without bus\n", space->device().safe_pc()); } } @@ -655,13 +655,13 @@ static READ16_HANDLER( megadriv_68k_check_z80_bus ) if (genz80.z80_has_bus || genz80.z80_is_reset) retvalue = nextvalue | 0x0100; else retvalue = (nextvalue & 0xfeff); - //logerror("%06x: 68000 check z80 Bus (byte MSB access) returning %04x mask %04x\n", cpu_get_pc(&space->device()),retvalue, mem_mask); + //logerror("%06x: 68000 check z80 Bus (byte MSB access) returning %04x mask %04x\n", space->device().safe_pc(),retvalue, mem_mask); return retvalue; } else if (!ACCESSING_BITS_8_15) // is this valid? { - //logerror("%06x: 68000 check z80 Bus (byte LSB access) %04x\n", cpu_get_pc(&space->device()),mem_mask); + //logerror("%06x: 68000 check z80 Bus (byte LSB access) %04x\n", space->device().safe_pc(),mem_mask); if (genz80.z80_has_bus || genz80.z80_is_reset) retvalue = 0x0001; else retvalue = 0x0000; @@ -669,11 +669,11 @@ static READ16_HANDLER( megadriv_68k_check_z80_bus ) } else { - //logerror("%06x: 68000 check z80 Bus (word access) %04x\n", cpu_get_pc(&space->device()),mem_mask); + //logerror("%06x: 68000 check z80 Bus (word access) %04x\n", space->device().safe_pc(),mem_mask); if (genz80.z80_has_bus || genz80.z80_is_reset) retvalue = nextvalue | 0x0100; else retvalue = (nextvalue & 0xfeff); - // mame_printf_debug("%06x: 68000 check z80 Bus (word access) %04x %04x\n", cpu_get_pc(&space->device()),mem_mask, retvalue); + // mame_printf_debug("%06x: 68000 check z80 Bus (word access) %04x %04x\n", space->device().safe_pc(),mem_mask, retvalue); return retvalue; } } @@ -710,12 +710,12 @@ static WRITE16_HANDLER( megadriv_68k_req_z80_bus ) { if (data & 0x0100) { - //logerror("%06x: 68000 request z80 Bus (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 request z80 Bus (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_has_bus = 0; } else { - //logerror("%06x: 68000 return z80 Bus (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 return z80 Bus (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_has_bus = 1; } } @@ -723,12 +723,12 @@ static WRITE16_HANDLER( megadriv_68k_req_z80_bus ) { if (data & 0x0001) { - //logerror("%06x: 68000 request z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 request z80 Bus (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_has_bus = 0; } else { - //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_has_bus = 1; } } @@ -736,12 +736,12 @@ static WRITE16_HANDLER( megadriv_68k_req_z80_bus ) { if (data & 0x0100) { - //logerror("%06x: 68000 request z80 Bus (word access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 request z80 Bus (word access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_has_bus = 0; } else { - //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_has_bus = 1; } } @@ -757,12 +757,12 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset ) { if (data & 0x0100) { - //logerror("%06x: 68000 clear z80 reset (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 clear z80 reset (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_is_reset = 0; } else { - //logerror("%06x: 68000 start z80 reset (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 start z80 reset (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_is_reset = 1; } } @@ -770,12 +770,12 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset ) { if (data & 0x0001) { - //logerror("%06x: 68000 clear z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 clear z80 reset (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_is_reset = 0; } else { - //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_is_reset = 1; } } @@ -783,12 +783,12 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset ) { if (data & 0x0100) { - //logerror("%06x: 68000 clear z80 reset (word access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 clear z80 reset (word access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_is_reset = 0; } else { - //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask); + //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask); genz80.z80_is_reset = 1; } } diff --git a/src/mame/machine/megavdp.c b/src/mame/machine/megavdp.c index d918ee01f1e..629d9bd3626 100644 --- a/src/mame/machine/megavdp.c +++ b/src/mame/machine/megavdp.c @@ -1266,7 +1266,7 @@ READ16_MEMBER( sega_genesis_vdp_device::megadriv_vdp_r ) // if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read control port access, offset %04x mem_mask %04x\n",offset,mem_mask); retvalue = megadriv_vdp_ctrl_port_r(space.machine()); // retvalue = space->machine().rand(); - // mame_printf_debug("%06x: Read Control Port at scanline %d hpos %d (return %04x)\n",cpu_get_pc(&space->device()),genesis_get_scanline_counter(machine), get_hposition(space.machine()),retvalue); + // mame_printf_debug("%06x: Read Control Port at scanline %d hpos %d (return %04x)\n",space->device().safe_pc(),genesis_get_scanline_counter(machine), get_hposition(space.machine()),retvalue); break; case 0x08: @@ -1276,7 +1276,7 @@ READ16_MEMBER( sega_genesis_vdp_device::megadriv_vdp_r ) // if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read HV counter port access, offset %04x mem_mask %04x\n",offset,mem_mask); retvalue = megadriv_read_hv_counters(space.machine()); // retvalue = space->machine().rand(); - // mame_printf_debug("%06x: Read HV counters at scanline %d hpos %d (return %04x)\n",cpu_get_pc(&space->device()),genesis_get_scanline_counter(machine), get_hposition(space.machine()),retvalue); + // mame_printf_debug("%06x: Read HV counters at scanline %d hpos %d (return %04x)\n",space->device().safe_pc(),genesis_get_scanline_counter(machine), get_hposition(space.machine()),retvalue); break; case 0x10: diff --git a/src/mame/machine/mexico86.c b/src/mame/machine/mexico86.c index 205a2b3451a..2ef66774aeb 100644 --- a/src/mame/machine/mexico86.c +++ b/src/mame/machine/mexico86.c @@ -227,14 +227,14 @@ INTERRUPT_GEN( mexico86_m68705_interrupt ) READ8_MEMBER(mexico86_state::mexico86_68705_port_a_r) { - //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in); + //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in); return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a); } WRITE8_MEMBER(mexico86_state::mexico86_68705_port_a_w) { - //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data); m_port_a_out = data; } @@ -268,7 +268,7 @@ READ8_MEMBER(mexico86_state::mexico86_68705_port_b_r) WRITE8_MEMBER(mexico86_state::mexico86_68705_port_b_w) { - //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data); + //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data); if (BIT(m_ddr_b, 0) && BIT(~data, 0) && BIT(m_port_b_out, 0)) { @@ -278,7 +278,7 @@ WRITE8_MEMBER(mexico86_state::mexico86_68705_port_b_w) if (BIT(m_ddr_b, 1) && BIT(data, 1) && BIT(~m_port_b_out, 1)) /* positive edge trigger */ { m_address = m_port_a_out; - //if (m_address >= 0x80) logerror("%04x: 68705 address %02x\n", cpu_get_pc(&space.device()), m_port_a_out); + //if (m_address >= 0x80) logerror("%04x: 68705 address %02x\n", space.device().safe_pc(), m_port_a_out); } if (BIT(m_ddr_b, 3) && BIT(~data, 3) && BIT(m_port_b_out, 3)) @@ -287,18 +287,18 @@ WRITE8_MEMBER(mexico86_state::mexico86_68705_port_b_w) { if (data & 0x04) { - //logerror("%04x: 68705 read %02x from address %04x\n", cpu_get_pc(&space.device()), m_protection_ram[m_address], m_address); + //logerror("%04x: 68705 read %02x from address %04x\n", space.device().safe_pc(), m_protection_ram[m_address], m_address); m_latch = m_protection_ram[m_address]; } else { - //logerror("%04x: 68705 read input port %04x\n", cpu_get_pc(&space.device()), m_address); + //logerror("%04x: 68705 read input port %04x\n", space.device().safe_pc(), m_address); m_latch = ioport((m_address & 1) ? "IN2" : "IN1")->read(); } } else /* write */ { - //logerror("%04x: 68705 write %02x to address %04x\n",cpu_get_pc(&space.device()), port_a_out, m_address); + //logerror("%04x: 68705 write %02x to address %04x\n",space.device().safe_pc(), port_a_out, m_address); m_protection_ram[m_address] = m_port_a_out; } } @@ -312,12 +312,12 @@ WRITE8_MEMBER(mexico86_state::mexico86_68705_port_b_w) if (BIT(m_ddr_b, 6) && BIT(~data, 6) && BIT(m_port_b_out, 6)) { - logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data); } if (BIT(m_ddr_b, 7) && BIT(~data, 7) && BIT(m_port_b_out, 7)) { - logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data); + logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data); } m_port_b_out = data; diff --git a/src/mame/machine/midtunit.c b/src/mame/machine/midtunit.c index 25401b114c8..7d224dd629f 100644 --- a/src/mame/machine/midtunit.c +++ b/src/mame/machine/midtunit.c @@ -82,7 +82,7 @@ WRITE16_MEMBER(midtunit_state::midtunit_cmos_w) } else { - logerror("%08X:Unexpected CMOS W @ %05X\n", cpu_get_pc(&space.device()), offset); + logerror("%08X:Unexpected CMOS W @ %05X\n", space.device().safe_pc(), offset); popmessage("Bad CMOS write"); } } @@ -130,12 +130,12 @@ static const UINT8 mk_prot_values[] = READ16_MEMBER(midtunit_state::mk_prot_r) { - logerror("%08X:Protection R @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, mk_prot_values[mk_prot_index] << 9); + logerror("%08X:Protection R @ %05X = %04X\n", space.device().safe_pc(), offset, mk_prot_values[mk_prot_index] << 9); /* just in case */ if (mk_prot_index >= sizeof(mk_prot_values)) { - logerror("%08X:Unexpected protection R @ %05X\n", cpu_get_pc(&space.device()), offset); + logerror("%08X:Unexpected protection R @ %05X\n", space.device().safe_pc(), offset); mk_prot_index = 0; } @@ -160,11 +160,11 @@ WRITE16_MEMBER(midtunit_state::mk_prot_w) /* just in case */ if (i == sizeof(mk_prot_values)) { - logerror("%08X:Unhandled protection W @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%08X:Unhandled protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data); mk_prot_index = 0; } - logerror("%08X:Protection W @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%08X:Protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data); } } @@ -332,7 +332,7 @@ static const UINT8 jdredd_prot_values_80020[] = WRITE16_MEMBER(midtunit_state::jdredd_prot_w) { - logerror("%08X:jdredd_prot_w(%04X,%04X)\n", cpu_get_previouspc(&space.device()), offset*16, data); + logerror("%08X:jdredd_prot_w(%04X,%04X)\n", space.device().safe_pcbase(), offset*16, data); switch (offset) { @@ -380,7 +380,7 @@ READ16_MEMBER(midtunit_state::jdredd_prot_r) if (jdredd_prot_table && jdredd_prot_index < jdredd_prot_max) result = jdredd_prot_table[jdredd_prot_index++] << 9; - logerror("%08X:jdredd_prot_r(%04X) = %04X\n", cpu_get_previouspc(&space.device()), offset*16, result); + logerror("%08X:jdredd_prot_r(%04X) = %04X\n", space.device().safe_pcbase(), offset*16, result); return result; } @@ -389,7 +389,7 @@ READ16_MEMBER(midtunit_state::jdredd_prot_r) static UINT16 *jdredd_hack; READ16_MEMBER(midtunit_state::jdredd_hack_r) { - if (cpu_get_pc(&space.device()) == 0xFFBA7EB0) + if (space.device().safe_pc() == 0xFFBA7EB0) { fprintf(stderr, "jdredd_hack_r\n"); return 0; @@ -580,7 +580,7 @@ MACHINE_RESET( midtunit ) READ16_MEMBER(midtunit_state::midtunit_sound_state_r) { -/* logerror("%08X:Sound status read\n", cpu_get_pc(&space.device()));*/ +/* logerror("%08X:Sound status read\n", space.device().safe_pc());*/ if (chip_type == SOUND_DCS) return dcs_control_r(machine()) >> 4; @@ -595,7 +595,7 @@ READ16_MEMBER(midtunit_state::midtunit_sound_state_r) READ16_MEMBER(midtunit_state::midtunit_sound_r) { - logerror("%08X:Sound data read\n", cpu_get_pc(&space.device())); + logerror("%08X:Sound data read\n", space.device().safe_pc()); if (chip_type == SOUND_DCS) return dcs_data_r(machine()) & 0xff; @@ -608,7 +608,7 @@ WRITE16_MEMBER(midtunit_state::midtunit_sound_w) /* check for out-of-bounds accesses */ if (!offset) { - logerror("%08X:Unexpected write to sound (lo) = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Unexpected write to sound (lo) = %04X\n", space.device().safe_pc(), data); return; } @@ -627,7 +627,7 @@ WRITE16_MEMBER(midtunit_state::midtunit_sound_w) break; case SOUND_DCS: - logerror("%08X:Sound write = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Sound write = %04X\n", space.device().safe_pc(), data); dcs_reset_w(machine(), ~data & 0x100); dcs_data_w(machine(), data & 0xff); /* the games seem to check for $82 loops, so this should be just barely enough */ diff --git a/src/mame/machine/midwayic.c b/src/mame/machine/midwayic.c index a9289c2382f..93cf028a458 100644 --- a/src/mame/machine/midwayic.c +++ b/src/mame/machine/midwayic.c @@ -744,7 +744,7 @@ static UINT16 ioasic_fifo_r(device_t *device) /* main CPU is handling the I/O ASIC interrupt */ if (ioasic.fifo_bytes == 0 && ioasic.has_dcs) { - ioasic.fifo_force_buffer_empty_pc = cpu_get_pc(ioasic.dcs_cpu); + ioasic.fifo_force_buffer_empty_pc = ioasic.dcs_cpu->safe_pc(); if (LOG_FIFO) logerror("fifo_r(%04X): FIFO empty, PC = %04X\n", result, ioasic.fifo_force_buffer_empty_pc); } @@ -774,7 +774,7 @@ static UINT16 ioasic_fifo_status_r(device_t *device) /* sure the FIFO clear bit is set */ if (ioasic.fifo_force_buffer_empty_pc && device == ioasic.dcs_cpu) { - offs_t currpc = cpu_get_pc(ioasic.dcs_cpu); + offs_t currpc = ioasic.dcs_cpu->safe_pc(); if (currpc >= ioasic.fifo_force_buffer_empty_pc && currpc < ioasic.fifo_force_buffer_empty_pc + 0x10) { ioasic.fifo_force_buffer_empty_pc = 0; @@ -932,7 +932,7 @@ READ32_HANDLER( midway_ioasic_r ) } if (LOG_IOASIC && offset != IOASIC_SOUNDSTAT && offset != IOASIC_SOUNDIN) - logerror("%06X:ioasic_r(%d) = %08X\n", cpu_get_pc(&space->device()), offset, result); + logerror("%06X:ioasic_r(%d) = %08X\n", space->device().safe_pc(), offset, result); return result; } @@ -957,7 +957,7 @@ WRITE32_HANDLER( midway_ioasic_w ) newreg = ioasic.reg[offset]; if (LOG_IOASIC && offset != IOASIC_SOUNDOUT) - logerror("%06X:ioasic_w(%d) = %08X\n", cpu_get_pc(&space->device()), offset, data); + logerror("%06X:ioasic_w(%d) = %08X\n", space->device().safe_pc(), offset, data); switch (offset) { diff --git a/src/mame/machine/midwunit.c b/src/mame/machine/midwunit.c index 628d63b82d4..081fbdff8e5 100644 --- a/src/mame/machine/midwunit.c +++ b/src/mame/machine/midwunit.c @@ -51,7 +51,7 @@ WRITE16_MEMBER(midwunit_state::midwunit_cmos_w) } else { - logerror("%08X:Unexpected CMOS W @ %05X\n", cpu_get_pc(&space.device()), offset); + logerror("%08X:Unexpected CMOS W @ %05X\n", space.device().safe_pc(), offset); popmessage("Bad CMOS write"); } } @@ -83,7 +83,7 @@ WRITE16_MEMBER(midwunit_state::midwunit_io_w) switch (offset) { case 1: - logerror("%08X:Control W @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%08X:Control W @ %05X = %04X\n", space.device().safe_pc(), offset, data); /* bit 4 reset sound CPU */ dcs_reset_w(machine(), newword & 0x10); @@ -99,7 +99,7 @@ WRITE16_MEMBER(midwunit_state::midwunit_io_w) break; default: - logerror("%08X:Unknown I/O write to %d = %04X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%08X:Unknown I/O write to %d = %04X\n", space.device().safe_pc(), offset, data); break; } m_iodata[offset] = newword; @@ -132,7 +132,7 @@ READ16_MEMBER(midwunit_state::midwunit_io_r) return (midway_serial_pic_status_r() << 12) | midwunit_sound_state_r(space,0,0xffff); default: - logerror("%08X:Unknown I/O read from %d\n", cpu_get_pc(&space.device()), offset); + logerror("%08X:Unknown I/O read from %d\n", space.device().safe_pc(), offset); break; } return ~0; @@ -381,7 +381,7 @@ WRITE16_MEMBER(midwunit_state::midwunit_security_w) READ16_MEMBER(midwunit_state::midwunit_sound_r) { - logerror("%08X:Sound read\n", cpu_get_pc(&space.device())); + logerror("%08X:Sound read\n", space.device().safe_pc()); return dcs_data_r(machine()) & 0xff; } @@ -398,14 +398,14 @@ WRITE16_MEMBER(midwunit_state::midwunit_sound_w) /* check for out-of-bounds accesses */ if (offset) { - logerror("%08X:Unexpected write to sound (hi) = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Unexpected write to sound (hi) = %04X\n", space.device().safe_pc(), data); return; } /* call through based on the sound type */ if (ACCESSING_BITS_0_7) { - logerror("%08X:Sound write = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Sound write = %04X\n", space.device().safe_pc(), data); dcs_data_w(machine(), data & 0xff); } } diff --git a/src/mame/machine/midxunit.c b/src/mame/machine/midxunit.c index daa8c8aabe5..0240a16258e 100644 --- a/src/mame/machine/midxunit.c +++ b/src/mame/machine/midxunit.c @@ -87,8 +87,8 @@ WRITE16_MEMBER(midxunit_state::midxunit_io_w) output_set_value("Player2_Gun_LED", (~data & 0x20) >> 5 ); output_set_value("Player3_Gun_LED", (~data & 0x40) >> 6 ); - logerror("%08X:I/O write to %d = %04X\n", cpu_get_pc(&space.device()), offset, data); -// logerror("%08X:Unknown I/O write to %d = %04X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%08X:I/O write to %d = %04X\n", space.device().safe_pc(), offset, data); +// logerror("%08X:Unknown I/O write to %d = %04X\n", space.device().safe_pc(), offset, data); break; } m_iodata[offset] = newword; @@ -103,7 +103,7 @@ WRITE16_MEMBER(midxunit_state::midxunit_unknown_w) dcs_reset_w(machine(), data & 2); if (ACCESSING_BITS_0_7 && offset % 0x40000 == 0) - logerror("%08X:midxunit_unknown_w @ %d = %02X\n", cpu_get_pc(&space.device()), offs, data & 0xff); + logerror("%08X:midxunit_unknown_w @ %d = %02X\n", space.device().safe_pc(), offs, data & 0xff); } @@ -129,7 +129,7 @@ READ16_MEMBER(midxunit_state::midxunit_io_r) return ioport(portnames[offset])->read(); default: - logerror("%08X:Unknown I/O read from %d\n", cpu_get_pc(&space.device()), offset); + logerror("%08X:Unknown I/O read from %d\n", space.device().safe_pc(), offset); break; } return ~0; @@ -238,7 +238,7 @@ READ16_MEMBER(midxunit_state::midxunit_uart_r) break; } -/* logerror("%08X:UART R @ %X = %02X\n", cpu_get_pc(&space.device()), offset, result);*/ +/* logerror("%08X:UART R @ %X = %02X\n", space.device().safe_pc(), offset, result);*/ return result; } @@ -274,7 +274,7 @@ WRITE16_MEMBER(midxunit_state::midxunit_uart_w) break; } -/* logerror("%08X:UART W @ %X = %02X\n", cpu_get_pc(&space.device()), offset, data);*/ +/* logerror("%08X:UART W @ %X = %02X\n", space.device().safe_pc(), offset, data);*/ } @@ -361,7 +361,7 @@ WRITE16_MEMBER(midxunit_state::midxunit_security_clock_w) READ16_MEMBER(midxunit_state::midxunit_sound_r) { - logerror("%08X:Sound read\n", cpu_get_pc(&space.device())); + logerror("%08X:Sound read\n", space.device().safe_pc()); return dcs_data_r(machine()) & 0xff; } @@ -378,14 +378,14 @@ WRITE16_MEMBER(midxunit_state::midxunit_sound_w) /* check for out-of-bounds accesses */ if (offset) { - logerror("%08X:Unexpected write to sound (hi) = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Unexpected write to sound (hi) = %04X\n", space.device().safe_pc(), data); return; } /* call through based on the sound type */ if (ACCESSING_BITS_0_7) { - logerror("%08X:Sound write = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Sound write = %04X\n", space.device().safe_pc(), data); dcs_data_w(machine(), data & 0xff); } } diff --git a/src/mame/machine/midyunit.c b/src/mame/machine/midyunit.c index b2954df200c..d53640dd50c 100644 --- a/src/mame/machine/midyunit.c +++ b/src/mame/machine/midyunit.c @@ -27,7 +27,7 @@ WRITE16_MEMBER(midyunit_state::midyunit_cmos_w) { - logerror("%08x:CMOS Write @ %05X\n", cpu_get_pc(&space.device()), offset); + logerror("%08x:CMOS Write @ %05X\n", space.device().safe_pc(), offset); COMBINE_DATA(&m_cmos_ram[offset + m_cmos_page]); } @@ -49,7 +49,7 @@ WRITE16_MEMBER(midyunit_state::midyunit_cmos_enable_w) { m_cmos_w_enable = (~data >> 9) & 1; - logerror("%08x:Protection write = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08x:Protection write = %04X\n", space.device().safe_pc(), data); /* only go down this path if we have a data structure */ if (m_prot_data) @@ -98,7 +98,7 @@ WRITE16_MEMBER(midyunit_state::midyunit_cmos_enable_w) READ16_MEMBER(midyunit_state::midyunit_protection_r) { /* return the most recently clocked value */ - logerror("%08X:Protection read = %04X\n", cpu_get_pc(&space.device()), m_prot_result); + logerror("%08X:Protection read = %04X\n", space.device().safe_pc(), m_prot_result); return m_prot_result; } @@ -185,7 +185,7 @@ WRITE16_MEMBER(midyunit_state::term2_sound_w) WRITE16_MEMBER(midyunit_state::term2_hack_w) { - if (offset == 1 && cpu_get_pc(&space.device()) == 0xffce6520) + if (offset == 1 && space.device().safe_pc() == 0xffce6520) { m_t2_hack_mem[offset] = 0; return; @@ -195,7 +195,7 @@ WRITE16_MEMBER(midyunit_state::term2_hack_w) WRITE16_MEMBER(midyunit_state::term2la3_hack_w) { - if (offset == 0 && cpu_get_pc(&space.device()) == 0xffce5230) + if (offset == 0 && space.device().safe_pc() == 0xffce5230) { m_t2_hack_mem[offset] = 0; return; @@ -205,7 +205,7 @@ WRITE16_MEMBER(midyunit_state::term2la3_hack_w) WRITE16_MEMBER(midyunit_state::term2la2_hack_w) { - if (offset == 0 && cpu_get_pc(&space.device()) == 0xffce4b80) + if (offset == 0 && space.device().safe_pc() == 0xffce4b80) { m_t2_hack_mem[offset] = 0; return; @@ -215,7 +215,7 @@ WRITE16_MEMBER(midyunit_state::term2la2_hack_w) WRITE16_MEMBER(midyunit_state::term2la1_hack_w) { - if (offset == 0 && cpu_get_pc(&space.device()) == 0xffce33f0) + if (offset == 0 && space.device().safe_pc() == 0xffce33f0) { m_t2_hack_mem[offset] = 0; return; @@ -580,7 +580,7 @@ WRITE16_MEMBER(midyunit_state::midyunit_sound_w) /* check for out-of-bounds accesses */ if (offset) { - logerror("%08X:Unexpected write to sound (hi) = %04X\n", cpu_get_pc(&space.device()), data); + logerror("%08X:Unexpected write to sound (hi) = %04X\n", space.device().safe_pc(), data); return; } diff --git a/src/mame/machine/model1.c b/src/mame/machine/model1.c index b988eb28feb..edb8e4a3a6f 100644 --- a/src/mame/machine/model1.c +++ b/src/mame/machine/model1.c @@ -16,7 +16,7 @@ static UINT32 fifoout_pop(address_space *space) model1_state *state = space->machine().driver_data(); UINT32 v; if(state->m_fifoout_wpos == state->m_fifoout_rpos) { - fatalerror("TGP FIFOOUT underflow (%x)\n", cpu_get_pc(&space->device())); + fatalerror("TGP FIFOOUT underflow (%x)\n", space->device().safe_pc()); } v = state->m_fifoout_data[state->m_fifoout_rpos++]; if(state->m_fifoout_rpos == FIFO_SIZE) @@ -60,7 +60,7 @@ static UINT32 fifoin_pop(model1_state *state) static void fifoin_push(address_space *space, UINT32 data) { model1_state *state = space->machine().driver_data(); - // logerror("TGP FIFOIN write %08x (%x)\n", data, cpu_get_pc(&space->device())); + // logerror("TGP FIFOIN write %08x (%x)\n", data, space->device().safe_pc()); state->m_fifoin_data[state->m_fifoin_wpos++] = data; if(state->m_fifoin_wpos == FIFO_SIZE) state->m_fifoin_wpos = 0; @@ -1948,7 +1948,7 @@ WRITE16_MEMBER(model1_state::model1_tgp_copro_w) { if(offset) { m_copro_w = (m_copro_w & 0x0000ffff) | (data << 16); - m_pushpc = cpu_get_pc(&space.device()); + m_pushpc = space.device().safe_pc(); fifoin_push(&space, m_copro_w); } else m_copro_w = (m_copro_w & 0xffff0000) | data; @@ -1967,7 +1967,7 @@ WRITE16_MEMBER(model1_state::model1_tgp_copro_adr_w) READ16_MEMBER(model1_state::model1_tgp_copro_ram_r) { if(!offset) { - logerror("TGP f0 ram read %04x, %08x (%f) (%x)\n", m_ram_adr, m_ram_data[m_ram_adr], u2f(m_ram_data[m_ram_adr]), cpu_get_pc(&space.device())); + logerror("TGP f0 ram read %04x, %08x (%f) (%x)\n", m_ram_adr, m_ram_data[m_ram_adr], u2f(m_ram_data[m_ram_adr]), space.device().safe_pc()); return m_ram_data[m_ram_adr]; } else return m_ram_data[m_ram_adr++] >> 16; @@ -1978,7 +1978,7 @@ WRITE16_MEMBER(model1_state::model1_tgp_copro_ram_w) COMBINE_DATA(m_ram_latch+offset); if(offset) { UINT32 v = m_ram_latch[0]|(m_ram_latch[1]<<16); - logerror("TGP f0 ram write %04x, %08x (%f) (%x)\n", m_ram_adr, v, u2f(v), cpu_get_pc(&space.device())); + logerror("TGP f0 ram write %04x, %08x (%f) (%x)\n", m_ram_adr, v, u2f(v), space.device().safe_pc()); m_ram_data[m_ram_adr] = v; m_ram_adr++; } @@ -2077,7 +2077,7 @@ static void copro_fifoin_push(address_space *space, UINT32 data) model1_state *state = space->machine().driver_data(); if (state->m_copro_fifoin_num == FIFO_SIZE) { - fatalerror("Copro FIFOIN overflow (at %08X)\n", cpu_get_pc(&space->device())); + fatalerror("Copro FIFOIN overflow (at %08X)\n", space->device().safe_pc()); return; } @@ -2123,7 +2123,7 @@ static void copro_fifoout_push(device_t *device, UINT32 data) model1_state *state = device->machine().driver_data(); if (state->m_copro_fifoout_num == FIFO_SIZE) { - fatalerror("Copro FIFOOUT overflow (at %08X)\n", cpu_get_pc(device)); + fatalerror("Copro FIFOOUT overflow (at %08X)\n", device->safe_pc()); return; } diff --git a/src/mame/machine/n64.c b/src/mame/machine/n64.c index 9c395340102..012c10719c2 100644 --- a/src/mame/machine/n64.c +++ b/src/mame/machine/n64.c @@ -263,7 +263,7 @@ READ32_MEMBER( n64_periphs::mi_reg_r ) break; default: - logerror("mi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&mem_map->device())); + logerror("mi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, mem_map->device().safe_pc()); break; } @@ -350,7 +350,7 @@ WRITE32_MEMBER( n64_periphs::mi_reg_w ) } default: - logerror("mi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("mi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); break; } } @@ -469,7 +469,7 @@ READ32_MEMBER( n64_periphs::rdram_reg_r ) //printf("rdram_reg_r %08x = %08x\n", offset * 4, rdram_regs[offset]); fflush(stdout); if(offset > 0x24/4) { - logerror("rdram_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu)); + logerror("rdram_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc()); return 0; } return rdram_regs[offset]; @@ -480,7 +480,7 @@ WRITE32_MEMBER( n64_periphs::rdram_reg_w ) //printf("rdram_reg_w %08x %08x %08x\n", offset * 4, data, mem_mask); fflush(stdout); if(offset > 0x24/4) { - logerror("rdram_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("rdram_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); return; } COMBINE_DATA(&rdram_regs[offset]); @@ -673,7 +673,7 @@ UINT32 n64_periphs::sp_reg_r(UINT32 offset) break; default: - logerror("sp_reg_r: %08X at %08X\n", offset, cpu_get_pc(maincpu)); + logerror("sp_reg_r: %08X at %08X\n", offset, maincpu->safe_pc()); break; } @@ -868,7 +868,7 @@ void n64_periphs::sp_reg_w(UINT32 offset, UINT32 data, UINT32 mem_mask) break; default: - logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); break; } } @@ -888,7 +888,7 @@ void n64_periphs::sp_reg_w(UINT32 offset, UINT32 data, UINT32 mem_mask) break; default: - logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); break; } } @@ -940,7 +940,7 @@ READ32_DEVICE_HANDLER( n64_dp_reg_r ) } default: - logerror("dp_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(device)); + logerror("dp_reg_r: %08X, %08X at %08X\n", offset, mem_mask, device->safe_pc()); break; } @@ -984,7 +984,7 @@ WRITE32_DEVICE_HANDLER( n64_dp_reg_w ) } default: - logerror("dp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(device)); + logerror("dp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, device->safe_pc()); break; } } @@ -1115,7 +1115,7 @@ READ32_MEMBER( n64_periphs::vi_reg_r ) break; default: - logerror("vi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu)); + logerror("vi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc()); break; } @@ -1205,7 +1205,7 @@ WRITE32_MEMBER( n64_periphs::vi_reg_w ) */ default: - logerror("vi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("vi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); break; } } @@ -1354,7 +1354,7 @@ READ32_MEMBER( n64_periphs::ai_reg_r ) break; default: - logerror("ai_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu)); + logerror("ai_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc()); break; } @@ -1396,7 +1396,7 @@ WRITE32_MEMBER( n64_periphs::ai_reg_w ) break; default: - logerror("ai_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("ai_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); break; } } @@ -1532,7 +1532,7 @@ READ32_MEMBER( n64_periphs::pi_reg_r ) break; default: - logerror("pi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu)); + logerror("pi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc()); break; } @@ -1635,7 +1635,7 @@ WRITE32_MEMBER( n64_periphs::pi_reg_w ) break; default: - logerror("pi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("pi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); break; } } @@ -1647,7 +1647,7 @@ READ32_MEMBER( n64_periphs::ri_reg_r ) //printf("ri_reg_r %08x = %08x\n", offset * 4, ri_regs[offset]); if(offset > 0x1c/4) { - logerror("ri_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu)); + logerror("ri_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc()); return 0; } return ri_regs[offset]; @@ -1658,7 +1658,7 @@ WRITE32_MEMBER( n64_periphs::ri_reg_w ) //printf("ri_reg_w %08x %08x %08x\n", offset * 4, data, mem_mask); if(offset > 0x1c/4) { - logerror("ri_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu)); + logerror("ri_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc()); return; } COMBINE_DATA(&ri_regs[offset]); diff --git a/src/mame/machine/namcoio.c b/src/mame/machine/namcoio.c index c14914a2c03..4fea996ec79 100644 --- a/src/mame/machine/namcoio.c +++ b/src/mame/machine/namcoio.c @@ -462,7 +462,7 @@ READ8_DEVICE_HANDLER( namcoio_r ) namcoio_state *namcoio = get_safe_token(device); offset &= 0x3f; -// LOG(("%04x: I/O read: mode %d, offset %d = %02x\n", cpu_get_pc(&space->device()), offset / 16, namcoio_ram[(offset & 0x30) + 8], offset & 0x0f, namcoio_ram[offset]&0x0f)); +// LOG(("%04x: I/O read: mode %d, offset %d = %02x\n", space->device().safe_pc(), offset / 16, namcoio_ram[(offset & 0x30) + 8], offset & 0x0f, namcoio_ram[offset]&0x0f)); return 0xf0 | namcoio->ram[offset]; } @@ -473,7 +473,7 @@ WRITE8_DEVICE_HANDLER( namcoio_w ) offset &= 0x3f; data &= 0x0f; // RAM is 4-bit wide -// LOG(("%04x: I/O write %d: offset %d = %02x\n", cpu_get_pc(&space->device()), offset / 16, offset & 0x0f, data)); +// LOG(("%04x: I/O write %d: offset %d = %02x\n", space->device().safe_pc(), offset / 16, offset & 0x0f, data)); namcoio->ram[offset] = data; } diff --git a/src/mame/machine/namcond1.c b/src/mame/machine/namcond1.c index 6530ebfd6e6..9efd1d5acd2 100644 --- a/src/mame/machine/namcond1.c +++ b/src/mame/machine/namcond1.c @@ -72,7 +72,7 @@ READ16_MEMBER(namcond1_state::namcond1_cuskey_r) default : logerror( "offset $%X accessed from $%X\n", - offset<<1, cpu_get_pc(&space.device()) ); + offset<<1, space.device().safe_pc() ); return( 0 ); } } diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index c4824f5de7c..ca80fcb5102 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -88,13 +88,13 @@ static READ8_HANDLER( faceoff_inputs_r ); static READ8_HANDLER( no_key_r ) { - popmessage("CPU %s PC %08x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset); + popmessage("CPU %s PC %08x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset); return 0; } static WRITE8_HANDLER( no_key_w ) { - popmessage("CPU %s PC %08x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data); + popmessage("CPU %s PC %08x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data); } @@ -200,7 +200,7 @@ CPU #0 PC e3d4: keychip read 0003 [AND #$37 = key no.] static READ8_HANDLER( key_type1_r ) { namcos1_state *state = space->machine().driver_data(); -// logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset); +// logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset); if (offset < 3) { @@ -232,7 +232,7 @@ static READ8_HANDLER( key_type1_r ) static WRITE8_HANDLER( key_type1_w ) { namcos1_state *state = space->machine().driver_data(); -// logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data); +// logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data); if (offset < 4) state->m_key[offset] = data; @@ -385,7 +385,7 @@ CPU #0 PC e574: keychip read 0001 static READ8_HANDLER( key_type2_r ) { namcos1_state *state = space->machine().driver_data(); -// logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset); +// logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset); state->m_key_numerator_high_word = 0; @@ -405,7 +405,7 @@ static READ8_HANDLER( key_type2_r ) static WRITE8_HANDLER( key_type2_w ) { namcos1_state *state = space->machine().driver_data(); -// logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data); +// logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data); if (offset < 5) { @@ -515,7 +515,7 @@ static READ8_HANDLER( key_type3_r ) namcos1_state *state = space->machine().driver_data(); int op; -// logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset); +// logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset); /* I need to handle blastoff's read from 0858. The game previously writes to 0858, using it as temporary storage, so maybe it expects to act as RAM, however @@ -531,7 +531,7 @@ static READ8_HANDLER( key_type3_r ) if (op == state->m_key_bottom4) return (offset << 4) | (state->m_key[state->m_key_swap4_arg] & 0x0f); if (op == state->m_key_top4) return (offset << 4) | (state->m_key[state->m_key_swap4_arg] >> 4); - popmessage("CPU %s PC %08x: keychip read %04x", space->device().tag(), cpu_get_pc(&space->device()), offset); + popmessage("CPU %s PC %08x: keychip read %04x", space->device().tag(), space->device().safe_pc(), offset); return 0; } @@ -539,7 +539,7 @@ static READ8_HANDLER( key_type3_r ) static WRITE8_HANDLER( key_type3_w ) { namcos1_state *state = space->machine().driver_data(); -// logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data); +// logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data); state->m_key[(offset & 0x70) >> 4] = data; } @@ -571,7 +571,7 @@ WRITE8_MEMBER(namcos1_state::namcos1_sound_bankswitch_w) WRITE8_MEMBER(namcos1_state::namcos1_cpu_control_w) { -// logerror("reset control pc=%04x %02x\n",cpu_get_pc(&space.device()),data); +// logerror("reset control pc=%04x %02x\n",space.device().safe_pc(),data); if ((data & 1) ^ m_reset) { m_mcu_patch_data = 0; @@ -646,21 +646,21 @@ static WRITE8_HANDLER( soundram_w ) static WRITE8_HANDLER( rom_w ) { - logerror("CPU %s PC %04x: warning - write %02x to rom address %04x\n", space->device().tag(), cpu_get_pc(&space->device()), data, offset); + logerror("CPU %s PC %04x: warning - write %02x to rom address %04x\n", space->device().tag(), space->device().safe_pc(), data, offset); } /* error handlers */ static READ8_HANDLER( unknown_r ) { - logerror("CPU %s PC %04x: warning - read from unknown chip\n", space->device().tag(), cpu_get_pc(&space->device()) ); -// popmessage("CPU %s PC %04x: read from unknown chip", space->device().tag(), cpu_get_pc(&space->device()) ); + logerror("CPU %s PC %04x: warning - read from unknown chip\n", space->device().tag(), space->device().safe_pc() ); +// popmessage("CPU %s PC %04x: read from unknown chip", space->device().tag(), space->device().safe_pc() ); return 0; } static WRITE8_HANDLER( unknown_w ) { - logerror("CPU %s PC %04x: warning - wrote to unknown chip\n", space->device().tag(), cpu_get_pc(&space->device()) ); -// popmessage("CPU %s PC %04x: wrote to unknown chip", space->device().tag(), cpu_get_pc(&space->device()) ); + logerror("CPU %s PC %04x: warning - wrote to unknown chip\n", space->device().tag(), space->device().safe_pc() ); +// popmessage("CPU %s PC %04x: wrote to unknown chip", space->device().tag(), space->device().safe_pc() ); } /* Main bankswitching routine */ @@ -939,7 +939,7 @@ WRITE8_MEMBER(namcos1_state::namcos1_mcu_bankswitch_w) WRITE8_MEMBER(namcos1_state::namcos1_mcu_patch_w) { - //logerror("mcu C000 write pc=%04x data=%02x\n",cpu_get_pc(&space.device()),data); + //logerror("mcu C000 write pc=%04x data=%02x\n",space.device().safe_pc(),data); if (m_mcu_patch_data == 0xa6) return; m_mcu_patch_data = data; m_triram[0] = data; diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c index bfe0d5224c2..45323094234 100644 --- a/src/mame/machine/namcos2.c +++ b/src/mame/machine/namcos2.c @@ -343,7 +343,7 @@ READ16_HANDLER( namcos2_68k_key_r ) { // case 3: return 0x142; case 4: return 0x142; - // case 3: popmessage("blah %08x",cpu_get_pc(&space->device())); + // case 3: popmessage("blah %08x",space->device().safe_pc()); default: return space->machine().rand(); } break; diff --git a/src/mame/machine/naomi.c b/src/mame/machine/naomi.c index d8dde92022a..deaa1b184df 100644 --- a/src/mame/machine/naomi.c +++ b/src/mame/machine/naomi.c @@ -28,32 +28,32 @@ UINT16 actel_id; static READ64_HANDLER( naomi_biose_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc04173c) + if (space->device().safe_pc()==0xc04173c) device_spin_until_time(&space->device(), attotime::from_usec(500)); //device_spin_until_interrupt(&space->device()); // else -// printf("%08x\n", cpu_get_pc(&space->device())); +// printf("%08x\n", space->device().safe_pc()); return naomi_ram64[0x2ad238/8]; } static READ64_HANDLER( naomi_biosh_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc045ffc) + if (space->device().safe_pc()==0xc045ffc) device_spin_until_time(&space->device(), attotime::from_usec(500)); -// printf("%08x\n", cpu_get_pc(&space->device())); +// printf("%08x\n", space->device().safe_pc()); return naomi_ram64[0x2b0600/8]; } static READ64_HANDLER( naomi2_biose_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc04637c) + if (space->device().safe_pc()==0xc04637c) device_spin_until_time(&space->device(), attotime::from_usec(500)); //device_spin_until_interrupt(&space->device()); // else -// printf("%08x\n", cpu_get_pc(&space->device())); +// printf("%08x\n", space->device().safe_pc()); return naomi_ram64[0x2b0600/8]; } @@ -243,7 +243,7 @@ DRIVER_INIT_MEMBER(dc_state,naomigd_mp) static READ64_HANDLER( naomigd_ggxxsla_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0x0c0c9adc) + if (space->device().safe_pc()==0x0c0c9adc) device_spin_until_time(&space->device(), attotime::from_usec(500)); return naomi_ram64[0x1aae18/8]; @@ -257,7 +257,7 @@ DRIVER_INIT_MEMBER(dc_state,ggxxsla) static READ64_HANDLER( naomigd_ggxx_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc0b5c3c) // or 0xc0bab0c + if (space->device().safe_pc()==0xc0b5c3c) // or 0xc0bab0c device_spin_until_time(&space->device(), attotime::from_usec(500)); return naomi_ram64[0x1837b8/8]; @@ -272,10 +272,10 @@ DRIVER_INIT_MEMBER(dc_state,ggxx) static READ64_HANDLER( naomigd_ggxxrl_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc0b84bc) // or 0xc0bab0c + if (space->device().safe_pc()==0xc0b84bc) // or 0xc0bab0c device_spin_until_time(&space->device(), attotime::from_usec(500)); - //printf("%08x\n", cpu_get_pc(&space->device())); + //printf("%08x\n", space->device().safe_pc()); return naomi_ram64[0x18d6c8/8]; } @@ -289,7 +289,7 @@ DRIVER_INIT_MEMBER(dc_state,ggxxrl) /* at least speeds up the annoying copyright screens ;-) */ static READ64_HANDLER( naomigd_sfz3ugd_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc36a2dc) + if (space->device().safe_pc()==0xc36a2dc) device_spin_until_time(&space->device(), attotime::from_usec(500)); return naomi_ram64[0x5dc900/8]; @@ -334,11 +334,11 @@ DRIVER_INIT_MEMBER(dc_state,kick4csh) static READ64_HANDLER( hotd2_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc0cfcbc) + if (space->device().safe_pc()==0xc0cfcbc) device_spin_until_time(&space->device(), attotime::from_usec(500)); //device_spin_until_interrupt(&space->device()); // else -// printf("%08x\n", cpu_get_pc(&space->device())); +// printf("%08x\n", space->device().safe_pc()); return naomi_ram64[0xa25fb8/8]; } diff --git a/src/mame/machine/neoboot.c b/src/mame/machine/neoboot.c index a75bf4b9f21..0cafdef28aa 100644 --- a/src/mame/machine/neoboot.c +++ b/src/mame/machine/neoboot.c @@ -702,19 +702,19 @@ void lans2004_decrypt_68k( running_machine &machine ) static READ16_HANDLER( mslug5_prot_r ) { - logerror("PC %06x: access protected\n",cpu_get_pc(&space->device())); + logerror("PC %06x: access protected\n",space->device().safe_pc()); return 0xa0; } static WRITE16_HANDLER ( ms5plus_bankswitch_w ) { int bankaddress; - logerror("offset: %06x PC %06x: set banking %04x\n",offset,cpu_get_pc(&space->device()),data); + logerror("offset: %06x PC %06x: set banking %04x\n",offset,space->device().safe_pc(),data); if ((offset == 0)&&(data == 0xa0)) { bankaddress=0xa0; neogeo_set_main_cpu_bank_address(space, bankaddress); - logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,cpu_get_pc(&space->device()),bankaddress); + logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space->device().safe_pc(),bankaddress); } else if(offset == 2) { @@ -722,7 +722,7 @@ static WRITE16_HANDLER ( ms5plus_bankswitch_w ) //data=data&7; bankaddress=data*0x100000; neogeo_set_main_cpu_bank_address(space, bankaddress); - logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,cpu_get_pc(&space->device()),bankaddress); + logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space->device().safe_pc(),bankaddress); } } diff --git a/src/mame/machine/neoprot.c b/src/mame/machine/neoprot.c index 422f52edc8c..2c1440775e3 100644 --- a/src/mame/machine/neoprot.c +++ b/src/mame/machine/neoprot.c @@ -42,7 +42,7 @@ static READ16_HANDLER( fatfury2_protection_16_r ) return ((res & 0xf0) >> 4) | ((res & 0x0f) << 4); default: - logerror("unknown protection read at pc %06x, offset %08x\n", cpu_get_pc(&space->device()), offset << 1); + logerror("unknown protection read at pc %06x, offset %08x\n", space->device().safe_pc(), offset << 1); return 0; } } @@ -89,7 +89,7 @@ static WRITE16_HANDLER( fatfury2_protection_16_w ) break; default: - logerror("unknown protection write at pc %06x, offset %08x, data %02x\n", cpu_get_pc(&space->device()), offset, data); + logerror("unknown protection write at pc %06x, offset %08x, data %02x\n", space->device().safe_pc(), offset, data); break; } } @@ -124,19 +124,19 @@ static WRITE16_HANDLER ( kof98_prot_w ) switch (data) { case 0x0090: - logerror ("%06x kof98 - protection 0x0090 old %04x %04x\n", cpu_get_pc(&space->device()), mem16[0x100/2], mem16[0x102/2]); + logerror ("%06x kof98 - protection 0x0090 old %04x %04x\n", space->device().safe_pc(), mem16[0x100/2], mem16[0x102/2]); mem16[0x100/2] = 0x00c2; mem16[0x102/2] = 0x00fd; break; case 0x00f0: - logerror ("%06x kof98 - protection 0x00f0 old %04x %04x\n", cpu_get_pc(&space->device()), mem16[0x100/2], mem16[0x102/2]); + logerror ("%06x kof98 - protection 0x00f0 old %04x %04x\n", space->device().safe_pc(), mem16[0x100/2], mem16[0x102/2]); mem16[0x100/2] = 0x4e45; mem16[0x102/2] = 0x4f2d; break; default: // 00aa is written, but not needed? - logerror ("%06x kof98 - unknown protection write %04x\n", cpu_get_pc(&space->device()), data); + logerror ("%06x kof98 - unknown protection write %04x\n", space->device().safe_pc(), data); break; } } diff --git a/src/mame/machine/nmk004.c b/src/mame/machine/nmk004.c index e969a51da76..38833fea28c 100644 --- a/src/mame/machine/nmk004.c +++ b/src/mame/machine/nmk004.c @@ -1062,7 +1062,7 @@ WRITE16_HANDLER( NMK004_w ) { if (ACCESSING_BITS_0_7) { -//logerror("%06x: NMK004_w %02x\n",cpu_get_pc(&space->device()),data); +//logerror("%06x: NMK004_w %02x\n",space->device().safe_pc(),data); NMK004_state.from_main = data & 0xff; } } @@ -1072,7 +1072,7 @@ READ16_HANDLER( NMK004_r ) //static int last; int res = NMK004_state.to_main; -//if (res != last) logerror("%06x: NMK004_r %02x\n",cpu_get_pc(&space->device()),res); +//if (res != last) logerror("%06x: NMK004_r %02x\n",space->device().safe_pc(),res); //last = res; return res; diff --git a/src/mame/machine/opwolf.c b/src/mame/machine/opwolf.c index 37635754c13..ca4c7913eb6 100644 --- a/src/mame/machine/opwolf.c +++ b/src/mame/machine/opwolf.c @@ -411,7 +411,7 @@ WRITE16_MEMBER(opwolf_state::opwolf_cchip_data_w) m_cchip_ram[(m_current_bank * 0x400) + offset] = data & 0xff; // if (offset != 0x64 && offset != 0x65 && offset != 0x66 && offset != 0x67 && offset != 0x68 && offset != 0x69) -// logerror("%08x: opwolf c write %04x %04x\n", cpu_get_pc(&space.device()), offset, data); +// logerror("%08x: opwolf c write %04x %04x\n", space.device().safe_pc(), offset, data); if (m_current_bank == 0) { @@ -512,8 +512,8 @@ READ16_MEMBER(opwolf_state::opwolf_cchip_status_r) READ16_MEMBER(opwolf_state::opwolf_cchip_data_r) { -// if (offset!=0x7f && offset!=0x1c && offset!=0x1d && offset!=0x1e && offset!=0x1f && offset!=0x20 && cpu_get_pc(&space.device())!=0xc18 && cpu_get_pc(&space.device())!=0xc2e && cpu_get_pc(&space.device())!=0xc9e && offset!=0x50 && offset!=0x51 && offset!=0x52 && offset!=0x53 && offset!=0x5 && offset!=0x13 && offset!=0x79 && offset!=0x12 && offset!=0x34) -// logerror("%08x: opwolf c read %04x (bank %04x)\n", cpu_get_pc(&space.device()), offset, m_current_bank); +// if (offset!=0x7f && offset!=0x1c && offset!=0x1d && offset!=0x1e && offset!=0x1f && offset!=0x20 && space.device().safe_pc()!=0xc18 && space.device().safe_pc()!=0xc2e && space.device().safe_pc()!=0xc9e && offset!=0x50 && offset!=0x51 && offset!=0x52 && offset!=0x53 && offset!=0x5 && offset!=0x13 && offset!=0x79 && offset!=0x12 && offset!=0x34) +// logerror("%08x: opwolf c read %04x (bank %04x)\n", space.device().safe_pc(), offset, m_current_bank); return m_cchip_ram[(m_current_bank * 0x400) + offset]; } diff --git a/src/mame/machine/pgmprot1.c b/src/mame/machine/pgmprot1.c index 8d1aae37be0..40ae54f8989 100644 --- a/src/mame/machine/pgmprot1.c +++ b/src/mame/machine/pgmprot1.c @@ -121,7 +121,7 @@ static READ16_HANDLER( pgm_arm7_type1_ram_r ) UINT16 *share16 = reinterpret_cast(state->m_arm7_shareram.target()); if (PGMARM7LOGERROR) - logerror("M68K: ARM7 Shared RAM Read: %04x = %04x (%08x) (%06x)\n", BYTE_XOR_LE(offset), share16[BYTE_XOR_LE(offset)], mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: ARM7 Shared RAM Read: %04x = %04x (%08x) (%06x)\n", BYTE_XOR_LE(offset), share16[BYTE_XOR_LE(offset)], mem_mask, space->device().safe_pc()); return share16[BYTE_XOR_LE(offset << 1)]; } @@ -131,7 +131,7 @@ static WRITE16_HANDLER( pgm_arm7_type1_ram_w ) UINT16 *share16 = reinterpret_cast(state->m_arm7_shareram.target()); if (PGMARM7LOGERROR) - logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, space->device().safe_pc()); COMBINE_DATA(&share16[BYTE_XOR_LE(offset << 1)]); } @@ -154,7 +154,7 @@ static READ32_HANDLER( pgm_arm7_type1_shareram_r ) pgm_arm_type1_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("ARM7: ARM7 Shared RAM Read: %04x = %08x (%08x) (%06x)\n", offset << 2, state->m_arm7_shareram[offset], mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: ARM7 Shared RAM Read: %04x = %08x (%08x) (%06x)\n", offset << 2, state->m_arm7_shareram[offset], mem_mask, space->device().safe_pc()); return state->m_arm7_shareram[offset]; } @@ -163,7 +163,7 @@ static WRITE32_HANDLER( pgm_arm7_type1_shareram_w ) pgm_arm_type1_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, space->device().safe_pc()); COMBINE_DATA(&state->m_arm7_shareram[offset]); } @@ -562,21 +562,21 @@ void command_handler_ddp3(pgm_arm_type1_state *state, int pc) break; case 0x67: // set high bits - // printf("%06x command %02x | %04x\n", cpu_get_pc(&space->device()), state->m_ddp3lastcommand, state->m_value0); + // printf("%06x command %02x | %04x\n", space->device().safe_pc(), state->m_ddp3lastcommand, state->m_value0); state->m_valueresponse = 0x880000; state->m_curslots = (state->m_value0 & 0xff00)>>8; state->m_slots[state->m_curslots] = (state->m_value0 & 0x00ff) << 16; break; case 0xe5: // set low bits for operation? - // printf("%06x command %02x | %04x\n", cpu_get_pc(&space->device()), state->m_ddp3lastcommand, state->m_value0); + // printf("%06x command %02x | %04x\n", space->device().safe_pc(), state->m_ddp3lastcommand, state->m_value0); state->m_valueresponse = 0x880000; state->m_slots[state->m_curslots] |= (state->m_value0 & 0xffff); break; case 0x8e: // read back result of operations - // printf("%06x command %02x | %04x\n", cpu_get_pc(&space->device()), state->m_ddp3lastcommand, state->m_value0); + // printf("%06x command %02x | %04x\n", space->device().safe_pc(), state->m_ddp3lastcommand, state->m_value0); state->m_valueresponse = state->m_slots[state->m_value0&0xff]; break; @@ -1351,7 +1351,7 @@ void command_handler_oldsplus(pgm_arm_type1_state *state, int pc) static WRITE16_HANDLER( pgm_arm7_type1_sim_w ) { pgm_arm_type1_state *state = space->machine().driver_data(); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if (offset == 0) { diff --git a/src/mame/machine/pgmprot2.c b/src/mame/machine/pgmprot2.c index 1682119a32e..5dcbfc3cc64 100644 --- a/src/mame/machine/pgmprot2.c +++ b/src/mame/machine/pgmprot2.c @@ -40,7 +40,7 @@ static READ32_HANDLER( arm7_latch_arm_r ) device_set_input_line(state->m_prot, ARM7_FIRQ_LINE, CLEAR_LINE ); // guess if (PGMARM7LOGERROR) - logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_kov2_latchdata_68k_w, mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_kov2_latchdata_68k_w, mem_mask, space->device().safe_pc()); return state->m_kov2_latchdata_68k_w; } @@ -49,7 +49,7 @@ static WRITE32_HANDLER( arm7_latch_arm_w ) pgm_arm_type2_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, space->device().safe_pc()); COMBINE_DATA(&state->m_kov2_latchdata_arm_w); } @@ -59,7 +59,7 @@ static READ32_HANDLER( arm7_shareram_r ) pgm_arm_type2_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("ARM7: ARM7 Shared RAM Read: %04x = %08x (%08x) (%06x)\n", offset << 2, state->m_arm7_shareram[offset], mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: ARM7 Shared RAM Read: %04x = %08x (%08x) (%06x)\n", offset << 2, state->m_arm7_shareram[offset], mem_mask, space->device().safe_pc()); return state->m_arm7_shareram[offset]; } @@ -68,7 +68,7 @@ static WRITE32_HANDLER( arm7_shareram_w ) pgm_arm_type2_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, space->device().safe_pc()); COMBINE_DATA(&state->m_arm7_shareram[offset]); } @@ -77,7 +77,7 @@ static READ16_HANDLER( arm7_latch_68k_r ) pgm_arm_type2_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_kov2_latchdata_arm_w & 0x0000ffff, mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_kov2_latchdata_arm_w & 0x0000ffff, mem_mask, space->device().safe_pc()); return state->m_kov2_latchdata_arm_w; } @@ -86,7 +86,7 @@ static WRITE16_HANDLER( arm7_latch_68k_w ) pgm_arm_type2_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, space->device().safe_pc()); COMBINE_DATA(&state->m_kov2_latchdata_68k_w); device_set_input_line(state->m_prot, ARM7_FIRQ_LINE, ASSERT_LINE ); // guess @@ -98,7 +98,7 @@ static READ16_HANDLER( arm7_ram_r ) UINT16 *share16 = reinterpret_cast(state->m_arm7_shareram.target()); if (PGMARM7LOGERROR) - logerror("M68K: ARM7 Shared RAM Read: %04x = %04x (%08x) (%06x)\n", BYTE_XOR_LE(offset), share16[BYTE_XOR_LE(offset)], mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: ARM7 Shared RAM Read: %04x = %04x (%08x) (%06x)\n", BYTE_XOR_LE(offset), share16[BYTE_XOR_LE(offset)], mem_mask, space->device().safe_pc()); return share16[BYTE_XOR_LE(offset)]; } @@ -108,7 +108,7 @@ static WRITE16_HANDLER( arm7_ram_w ) UINT16 *share16 = reinterpret_cast(state->m_arm7_shareram.target()); if (PGMARM7LOGERROR) - logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, space->device().safe_pc()); COMBINE_DATA(&share16[BYTE_XOR_LE(offset)]); } @@ -176,7 +176,7 @@ static void kov2_latch_init( running_machine &machine ) static WRITE32_HANDLER( kov2_arm_region_w ) { pgm_arm_type2_state *state = space->machine().driver_data(); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); int regionhack = state->ioport("RegionHack")->read(); if (pc==0x190 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0); COMBINE_DATA(&state->m_arm7_shareram[0x138/4]); @@ -229,7 +229,7 @@ DRIVER_INIT_MEMBER(pgm_arm_type2_state,kov2p) static WRITE32_HANDLER( martmast_arm_region_w ) { pgm_arm_type2_state *state = space->machine().driver_data(); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); int regionhack = state->ioport("RegionHack")->read(); if (pc==0x170 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0); COMBINE_DATA(&state->m_arm7_shareram[0x138/4]); @@ -250,7 +250,7 @@ DRIVER_INIT_MEMBER(pgm_arm_type2_state,martmast) static WRITE32_HANDLER( ddp2_arm_region_w ) { pgm_arm_type2_state *state = space->machine().driver_data(); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); int regionhack = state->ioport("RegionHack")->read(); if (pc==0x0174 && regionhack != 0xff) data = (data & 0x0000ffff) | (regionhack << 16); COMBINE_DATA(&state->m_arm7_shareram[0x0]); @@ -259,7 +259,7 @@ static WRITE32_HANDLER( ddp2_arm_region_w ) static READ32_HANDLER( ddp2_speedup_r ) { pgm_arm_type2_state *state = space->machine().driver_data(); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); UINT32 data = state->m_arm_ram[0x300c/4]; if (pc==0x080109b4) @@ -282,7 +282,7 @@ static READ16_HANDLER( ddp2_main_speedup_r ) { UINT16 data = pgm_mainram[0x0ee54/2]; - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if (pc == 0x149dce) device_spin_until_interrupt(&space->device()); if (pc == 0x149cfe) device_spin_until_interrupt(&space->device()); diff --git a/src/mame/machine/pgmprot3.c b/src/mame/machine/pgmprot3.c index fc911b2ab20..03fec839b7a 100644 --- a/src/mame/machine/pgmprot3.c +++ b/src/mame/machine/pgmprot3.c @@ -94,7 +94,7 @@ static WRITE16_HANDLER( svg_latch_68k_w ) { pgm_arm_type3_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, space->device().safe_pc()); COMBINE_DATA(&state->m_svg_latchdata_68k_w); } @@ -104,7 +104,7 @@ static READ16_HANDLER( svg_latch_68k_r ) pgm_arm_type3_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_svg_latchdata_arm_w & 0x0000ffff, mem_mask, cpu_get_pc(&space->device())); + logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_svg_latchdata_arm_w & 0x0000ffff, mem_mask, space->device().safe_pc()); return state->m_svg_latchdata_arm_w; } @@ -115,7 +115,7 @@ static READ32_HANDLER( svg_latch_arm_r ) pgm_arm_type3_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_svg_latchdata_68k_w, mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_svg_latchdata_68k_w, mem_mask, space->device().safe_pc()); return state->m_svg_latchdata_68k_w; } @@ -124,7 +124,7 @@ static WRITE32_HANDLER( svg_latch_arm_w ) pgm_arm_type3_state *state = space->machine().driver_data(); if (PGMARM7LOGERROR) - logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, cpu_get_pc(&space->device())); + logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, space->device().safe_pc()); COMBINE_DATA(&state->m_svg_latchdata_arm_w); } @@ -269,7 +269,7 @@ DRIVER_INIT_MEMBER(pgm_arm_type3_state,killbldp) static READ32_HANDLER( dmnfrnt_speedup_r ) { pgm_arm_type3_state *state = space->machine().driver_data(); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if (pc == 0x8000fea) device_eat_cycles(&space->device(), 500); // else printf("dmn_speedup_r %08x\n", pc); return state->m_arm_ram[0x000444/4]; @@ -278,7 +278,7 @@ static READ32_HANDLER( dmnfrnt_speedup_r ) static READ16_HANDLER( dmnfrnt_main_speedup_r ) { UINT16 data = pgm_mainram[0xa03c/2]; - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if (pc == 0x10193a) device_spin_until_interrupt(&space->device()); else if (pc == 0x1019a4) device_spin_until_interrupt(&space->device()); return data; diff --git a/src/mame/machine/pgmprot4.c b/src/mame/machine/pgmprot4.c index 1e2de8a0e77..c0bb9edc343 100644 --- a/src/mame/machine/pgmprot4.c +++ b/src/mame/machine/pgmprot4.c @@ -286,7 +286,7 @@ static WRITE16_HANDLER( killbld_igs025_prot_w ) state->m_kb_cmd = data; else //offset==2 { - logerror("%06X: ASIC25 W CMD %X VAL %X\n", cpu_get_pc(&space->device()), state->m_kb_cmd, data); + logerror("%06X: ASIC25 W CMD %X VAL %X\n", space->device().safe_pc(), state->m_kb_cmd, data); if (state->m_kb_cmd == 0) state->m_kb_reg = data; else if (state->m_kb_cmd == 2) @@ -342,7 +342,7 @@ static READ16_HANDLER( killbld_igs025_prot_r ) } } - logerror("%06X: ASIC25 R CMD %X VAL %X\n", cpu_get_pc(&space->device()), state->m_kb_cmd, res); + logerror("%06X: ASIC25 R CMD %X VAL %X\n", space->device().safe_pc(), state->m_kb_cmd, res); return res; } @@ -461,7 +461,7 @@ static WRITE16_HANDLER( drgw3_igs025_prot_w ) state->m_kb_cmd=data; else //offset==2 { - printf("%06X: ASIC25 W CMD %X VAL %X\n",cpu_get_pc(&space->device()),state->m_kb_cmd,data); + printf("%06X: ASIC25 W CMD %X VAL %X\n",space->device().safe_pc(),state->m_kb_cmd,data); if(state->m_kb_cmd==0) reg=data; else if(state->m_kb_cmd==3) //?????????? @@ -518,7 +518,7 @@ static READ16_HANDLER( drgw3_igs025_prot_r ) } } - logerror("%06X: ASIC25 R CMD %X VAL %X\n",cpu_get_pc(&space->device()),state->m_kb_cmd,res); + logerror("%06X: ASIC25 R CMD %X VAL %X\n",space->device().safe_pc(),state->m_kb_cmd,res); return res; } diff --git a/src/mame/machine/pgmprot6.c b/src/mame/machine/pgmprot6.c index 37dea95b2e2..844a767702e 100644 --- a/src/mame/machine/pgmprot6.c +++ b/src/mame/machine/pgmprot6.c @@ -125,7 +125,7 @@ static READ16_HANDLER( olds_r ) } } - logerror("%06X: ASIC25 R CMD %X VAL %X\n", cpu_get_pc(&space->device()), state->m_kb_cmd, res); + logerror("%06X: ASIC25 R CMD %X VAL %X\n", space->device().safe_pc(), state->m_kb_cmd, res); return res; } @@ -136,7 +136,7 @@ static WRITE16_HANDLER( olds_w ) state->m_kb_cmd = data; else //offset==2 { - logerror("%06X: ASIC25 W CMD %X VAL %X\n",cpu_get_pc(&space->device()), state->m_kb_cmd, data); + logerror("%06X: ASIC25 W CMD %X VAL %X\n",space->device().safe_pc(), state->m_kb_cmd, data); if (state->m_kb_cmd == 0) state->m_kb_reg = data; else if(state->m_kb_cmd == 2) //a bitswap= @@ -185,7 +185,7 @@ static WRITE16_HANDLER( olds_w ) static READ16_HANDLER( olds_prot_swap_r ) { - if (cpu_get_pc(&space->device()) < 0x100000) //bios + if (space->device().safe_pc() < 0x100000) //bios return pgm_mainram[0x178f4 / 2]; else //game return pgm_mainram[0x178d8 / 2]; diff --git a/src/mame/machine/retofinv.c b/src/mame/machine/retofinv.c index c87eb986645..2b81378a4cf 100644 --- a/src/mame/machine/retofinv.c +++ b/src/mame/machine/retofinv.c @@ -12,13 +12,13 @@ READ8_MEMBER(retofinv_state::retofinv_68705_portA_r) { -//logerror("%04x: 68705 port A read %02x\n",cpu_get_pc(&space.device()),m_portA_in); +//logerror("%04x: 68705 port A read %02x\n",space.device().safe_pc(),m_portA_in); return (m_portA_out & m_ddrA) | (m_portA_in & ~m_ddrA); } WRITE8_MEMBER(retofinv_state::retofinv_68705_portA_w) { -//logerror("%04x: 68705 port A write %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: 68705 port A write %02x\n",space.device().safe_pc(),data); m_portA_out = data; } @@ -46,7 +46,7 @@ READ8_MEMBER(retofinv_state::retofinv_68705_portB_r) WRITE8_MEMBER(retofinv_state::retofinv_68705_portB_w) { -//logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: 68705 port B write %02x\n",space.device().safe_pc(),data); if ((m_ddrB & 0x02) && (~data & 0x02) && (m_portB_out & 0x02)) { @@ -86,13 +86,13 @@ READ8_MEMBER(retofinv_state::retofinv_68705_portC_r) m_portC_in = 0; if (m_main_sent) m_portC_in |= 0x01; if (!m_mcu_sent) m_portC_in |= 0x02; -//logerror("%04x: 68705 port C read %02x\n",cpu_get_pc(&space.device()),m_portC_in); +//logerror("%04x: 68705 port C read %02x\n",space.device().safe_pc(),m_portC_in); return (m_portC_out & m_ddrC) | (m_portC_in & ~m_ddrC); } WRITE8_MEMBER(retofinv_state::retofinv_68705_portC_w) { -logerror("%04x: 68705 port C write %02x\n",cpu_get_pc(&space.device()),data); +logerror("%04x: 68705 port C write %02x\n",space.device().safe_pc(),data); m_portC_out = data; } @@ -104,7 +104,7 @@ WRITE8_MEMBER(retofinv_state::retofinv_68705_ddrC_w) WRITE8_MEMBER(retofinv_state::retofinv_mcu_w) { -logerror("%04x: mcu_w %02x\n",cpu_get_pc(&space.device()),data); +logerror("%04x: mcu_w %02x\n",space.device().safe_pc(),data); m_from_main = data; m_main_sent = 1; cputag_set_input_line(machine(), "68705", 0, ASSERT_LINE); @@ -112,7 +112,7 @@ logerror("%04x: mcu_w %02x\n",cpu_get_pc(&space.device()),data); READ8_MEMBER(retofinv_state::retofinv_mcu_r) { -logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),m_from_mcu); +logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),m_from_mcu); m_mcu_sent = 0; return m_from_mcu; } @@ -123,7 +123,7 @@ READ8_MEMBER(retofinv_state::retofinv_mcu_status_r) /* bit 4 = when 1, mcu is ready to receive data from main cpu */ /* bit 5 = when 1, mcu has sent data to the main cpu */ -//logerror("%04x: mcu_status_r\n",cpu_get_pc(&space.device())); +//logerror("%04x: mcu_status_r\n",space.device().safe_pc()); if (!m_main_sent) res |= 0x10; if (m_mcu_sent) res |= 0x20; diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c index 8631ee4eb66..b30c20d19f2 100644 --- a/src/mame/machine/scramble.c +++ b/src/mame/machine/scramble.c @@ -58,7 +58,7 @@ WRITE8_DEVICE_HANDLER( scramble_protection_w ) READ8_DEVICE_HANDLER( scramble_protection_r ) { - switch (cpu_get_pc(device->machine().device("maincpu"))) + switch (device->machine().device("maincpu")->safe_pc()) { case 0x00a8: return 0xf0; case 0x00be: return 0xb0; @@ -88,16 +88,16 @@ static READ8_HANDLER( mariner_protection_2_r ) READ8_HANDLER( triplep_pip_r ) { - logerror("PC %04x: triplep read port 2\n",cpu_get_pc(&space->device())); - if (cpu_get_pc(&space->device()) == 0x015a) return 0xff; - else if (cpu_get_pc(&space->device()) == 0x0886) return 0x05; + logerror("PC %04x: triplep read port 2\n",space->device().safe_pc()); + if (space->device().safe_pc() == 0x015a) return 0xff; + else if (space->device().safe_pc() == 0x0886) return 0x05; else return 0; } READ8_HANDLER( triplep_pap_r ) { - logerror("PC %04x: triplep read port 3\n",cpu_get_pc(&space->device())); - if (cpu_get_pc(&space->device()) == 0x015d) return 0x04; + logerror("PC %04x: triplep read port 3\n",space->device().safe_pc()); + if (space->device().safe_pc() == 0x015d) return 0x04; else return 0; } diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c index 72f53ccb88e..44cc8e5f611 100644 --- a/src/mame/machine/segaic16.c +++ b/src/mame/machine/segaic16.c @@ -102,7 +102,7 @@ READ16_MEMBER( sega_16bit_common_base::open_bus_r ) // read original encrypted memory at that address m_open_bus_recurse = true; - UINT16 result = space.read_word(cpu_get_pc(&space.device())); + UINT16 result = space.read_word(space.device().safe_pc()); m_open_bus_recurse = false; return result; } diff --git a/src/mame/machine/segas32.c b/src/mame/machine/segas32.c index 57be34861d6..d536fc57874 100644 --- a/src/mame/machine/segas32.c +++ b/src/mame/machine/segas32.c @@ -224,14 +224,14 @@ void darkedge_fd1149_vblank(device_t *device) WRITE16_MEMBER(segas32_state::darkedge_protection_w) { logerror("%06x:darkedge_prot_w(%06X) = %04X & %04X\n", - cpu_get_pc(&space.device()), 0xa00000 + 2*offset, data, mem_mask); + space.device().safe_pc(), 0xa00000 + 2*offset, data, mem_mask); } READ16_MEMBER(segas32_state::darkedge_protection_r) { logerror("%06x:darkedge_prot_r(%06X) & %04X\n", - cpu_get_pc(&space.device()), 0xa00000 + 2*offset, mem_mask); + space.device().safe_pc(), 0xa00000 + 2*offset, mem_mask); return 0xffff; } @@ -284,7 +284,7 @@ READ16_MEMBER(segas32_state::dbzvrvs_protection_r) // protection ram is 8-bits wide and only occupies every other address READ16_MEMBER(segas32_state::arabfgt_protection_r) { - int PC = cpu_get_pc(&space.device()); + int PC = space.device().safe_pc(); int cmpVal; if (PC == 0xfe0325 || PC == 0xfe01e5 || PC == 0xfe035e || PC == 0xfe03cc) diff --git a/src/mame/machine/seicop.c b/src/mame/machine/seicop.c index 36f8dbe3cad..af73e380f29 100644 --- a/src/mame/machine/seicop.c +++ b/src/mame/machine/seicop.c @@ -1672,7 +1672,7 @@ READ16_HANDLER( copdxbl_0_r ) { default: { - logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", cpu_get_pc(&space->device()), retvalue, offset*2); + logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", space->device().safe_pc(), retvalue, offset*2); return retvalue; } @@ -1698,7 +1698,7 @@ WRITE16_HANDLER( copdxbl_0_w ) { default: { - logerror("%06x: COPX unhandled write data %04x at offset %04x\n", cpu_get_pc(&space->device()), data, offset*2); + logerror("%06x: COPX unhandled write data %04x at offset %04x\n", space->device().safe_pc(), data, offset*2); break; } @@ -1852,7 +1852,7 @@ static READ16_HANDLER( generic_cop_r ) return cop_angle; default: - seibu_cop_log("%06x: COPX unhandled read returning %04x from offset %04x\n", cpu_get_pc(&space->device()), retvalue, offset*2); + seibu_cop_log("%06x: COPX unhandled read returning %04x from offset %04x\n", space->device().safe_pc(), retvalue, offset*2); return retvalue; } } @@ -1870,7 +1870,7 @@ static WRITE16_HANDLER( generic_cop_w ) switch (offset) { default: - seibu_cop_log("%06x: COPX unhandled write data %04x at offset %04x\n", cpu_get_pc(&space->device()), data, offset*2); + seibu_cop_log("%06x: COPX unhandled write data %04x at offset %04x\n", space->device().safe_pc(), data, offset*2); break; /* Sprite DMA */ @@ -1977,28 +1977,28 @@ static WRITE16_HANDLER( generic_cop_w ) case (0x078/2): /* DMA source address */ { cop_dma_src[cop_dma_trigger] = data; // << 6 to get actual address - //seibu_cop_log("%06x: COPX set layer clear address to %04x (actual %08x)\n", cpu_get_pc(&space->device()), data, data<<6); + //seibu_cop_log("%06x: COPX set layer clear address to %04x (actual %08x)\n", space->device().safe_pc(), data, data<<6); break; } case (0x07a/2): /* DMA length */ { cop_dma_size[cop_dma_trigger] = data; - //seibu_cop_log("%06x: COPX set layer clear length to %04x (actual %08x)\n", cpu_get_pc(&space->device()), data, data<<5); + //seibu_cop_log("%06x: COPX set layer clear length to %04x (actual %08x)\n", space->device().safe_pc(), data, data<<5); break; } case (0x07c/2): /* DMA destination */ { cop_dma_dst[cop_dma_trigger] = data; - //seibu_cop_log("%06x: COPX set layer clear value to %04x (actual %08x)\n", cpu_get_pc(&space->device()), data, data<<6); + //seibu_cop_log("%06x: COPX set layer clear value to %04x (actual %08x)\n", space->device().safe_pc(), data, data<<6); break; } case (0x07e/2): /* DMA parameter */ { cop_dma_trigger = data; - //seibu_cop_log("%06x: COPX set layer clear trigger? to %04x\n", cpu_get_pc(&space->device()), data); + //seibu_cop_log("%06x: COPX set layer clear trigger? to %04x\n", space->device().safe_pc(), data); if (data>=0x1ff) { seibu_cop_log("invalid DMA trigger!, >0x1ff\n"); @@ -2051,7 +2051,7 @@ static WRITE16_HANDLER( generic_cop_w ) int command; #if LOG_CMDS - seibu_cop_log("%06x: COPX execute table macro command %04x %04x | regs %08x %08x %08x %08x %08x\n", cpu_get_pc(&space->device()), data, cop_mcu_ram[offset], cop_register[0], cop_register[1], cop_register[2], cop_register[3], cop_register[4]); + seibu_cop_log("%06x: COPX execute table macro command %04x %04x | regs %08x %08x %08x %08x %08x\n", space->device().safe_pc(), data, cop_mcu_ram[offset], cop_register[0], cop_register[1], cop_register[2], cop_register[3], cop_register[4]); #endif command = -1; @@ -2298,7 +2298,7 @@ static WRITE16_HANDLER( generic_cop_w ) //(heatbrl) | 9 | ffff | b080 | b40 bc0 bc2 if(COP_CMD(0xb40,0xbc0,0xbc2,0x000,0x000,0x000,0x000,0x000,u1,u2)) { - UINT8 start_x,start_y,end_x,end_y; + UINT8 start_x,/*start_y,*/end_x,end_y; cop_collision_info[0].hitbox = space->read_word(cop_register[2]); cop_collision_info[0].hitbox_y = space->read_word((cop_register[2]&0xffff0000)|(cop_collision_info[0].hitbox)); cop_collision_info[0].hitbox_x = space->read_word(((cop_register[2]&0xffff0000)|(cop_collision_info[0].hitbox))+2); @@ -2335,7 +2335,7 @@ static WRITE16_HANDLER( generic_cop_w ) //(heatbrl) | 6 | ffff | b880 | b60 be0 be2 if(COP_CMD(0xb60,0xbe0,0xbe2,0x000,0x000,0x000,0x000,0x000,u1,u2)) { - UINT8 start_x,start_y, end_x,end_y; + UINT8 start_x,/*start_y,*/end_x,end_y; /* Take hitbox param, TODO */ cop_collision_info[1].hitbox = space->read_word(cop_register[3]); @@ -2498,7 +2498,7 @@ static WRITE16_HANDLER( generic_cop_w ) /* DMA go register */ case (0x2fc/2): { - //seibu_cop_log("%06x: COPX execute current layer clear??? %04x\n", cpu_get_pc(&space->device()), data); + //seibu_cop_log("%06x: COPX execute current layer clear??? %04x\n", space->device().safe_pc(), data); if (cop_dma_trigger >= 0x80 && cop_dma_trigger <= 0x87) { diff --git a/src/mame/machine/slapfght.c b/src/mame/machine/slapfght.c index 9fa4c3762c0..45bc30c0f78 100644 --- a/src/mame/machine/slapfght.c +++ b/src/mame/machine/slapfght.c @@ -266,13 +266,13 @@ READ8_MEMBER(slapfght_state::getstar_e803_r) getstar_val = 0x76; break; default: - logerror("%04x: getstar_e803_r - cmd = %02x\n",cpu_get_pc(&space.device()),m_getstar_cmd); + logerror("%04x: getstar_e803_r - cmd = %02x\n",space.device().safe_pc(),m_getstar_cmd); break; } break; case GTSTARB1: /* value isn't computed by the bootleg but we want to please the "test mode" */ - if (cpu_get_pc(&space.device()) == 0x6b04) return (lives_lookup_table[m_gs_a]); + if (space.device().safe_pc() == 0x6b04) return (lives_lookup_table[m_gs_a]); break; case GTSTARB2: /* @@ -285,14 +285,14 @@ READ8_MEMBER(slapfght_state::getstar_e803_r) 0576: BE cp (hl) 0577: C2 6E 05 jp nz,$056E */ - if (cpu_get_pc(&space.device()) == 0x056e) return (getstar_val); - if (cpu_get_pc(&space.device()) == 0x0570) return (getstar_val+1); - if (cpu_get_pc(&space.device()) == 0x0577) return ((getstar_val+0x05) ^ 0x56); + if (space.device().safe_pc() == 0x056e) return (getstar_val); + if (space.device().safe_pc() == 0x0570) return (getstar_val+1); + if (space.device().safe_pc() == 0x0577) return ((getstar_val+0x05) ^ 0x56); /* value isn't computed by the bootleg but we want to please the "test mode" */ - if (cpu_get_pc(&space.device()) == 0x6b04) return (lgsb2_lookup_table[m_gs_a]); + if (space.device().safe_pc() == 0x6b04) return (lgsb2_lookup_table[m_gs_a]); break; default: - logerror("%04x: getstar_e803_r - cmd = %02x - unknown set !\n",cpu_get_pc(&space.device()),m_getstar_cmd); + logerror("%04x: getstar_e803_r - cmd = %02x - unknown set !\n",space.device().safe_pc(),m_getstar_cmd); break; } return getstar_val; @@ -304,183 +304,183 @@ WRITE8_MEMBER(slapfght_state::getstar_e803_w) { case GETSTAR: /* unknown effect - not read back */ - if (cpu_get_pc(&space.device()) == 0x00bf) + if (space.device().safe_pc() == 0x00bf) { m_getstar_cmd = 0x00; GS_RESET_REGS } /* players inputs */ - if (cpu_get_pc(&space.device()) == 0x0560) + if (space.device().safe_pc() == 0x0560) { m_getstar_cmd = 0x25; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x056d) + if (space.device().safe_pc() == 0x056d) { m_getstar_cmd = 0x25; GS_SAVE_REGS } /* lose life */ - if (cpu_get_pc(&space.device()) == 0x0a0a) + if (space.device().safe_pc() == 0x0a0a) { m_getstar_cmd = 0x21; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0a17) + if (space.device().safe_pc() == 0x0a17) { m_getstar_cmd = 0x21; GS_SAVE_REGS } /* unknown effect */ - if (cpu_get_pc(&space.device()) == 0x0a51) + if (space.device().safe_pc() == 0x0a51) { m_getstar_cmd = 0x29; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0a6e) + if (space.device().safe_pc() == 0x0a6e) { m_getstar_cmd = 0x29; GS_SAVE_REGS } /* continue play */ - if (cpu_get_pc(&space.device()) == 0x0ae3) + if (space.device().safe_pc() == 0x0ae3) { m_getstar_cmd = 0x20; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0af0) + if (space.device().safe_pc() == 0x0af0) { m_getstar_cmd = 0x20; GS_SAVE_REGS } /* unknown effect - not read back */ - if (cpu_get_pc(&space.device()) == 0x0b62) + if (space.device().safe_pc() == 0x0b62) { m_getstar_cmd = 0x00; /* 0x1f */ GS_RESET_REGS } /* change player (if 2 players game) */ - if (cpu_get_pc(&space.device()) == 0x0bab) + if (space.device().safe_pc() == 0x0bab) { m_getstar_cmd = 0x2a; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0bb8) + if (space.device().safe_pc() == 0x0bb8) { m_getstar_cmd = 0x2a; GS_SAVE_REGS } /* game phase */ - if (cpu_get_pc(&space.device()) == 0x0d37) + if (space.device().safe_pc() == 0x0d37) { m_getstar_cmd = 0x24; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0d44) + if (space.device().safe_pc() == 0x0d44) { m_getstar_cmd = 0x24; GS_SAVE_REGS } /* starting lives */ - if (cpu_get_pc(&space.device()) == 0x0d79) + if (space.device().safe_pc() == 0x0d79) { m_getstar_cmd = 0x23; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0d8a) + if (space.device().safe_pc() == 0x0d8a) { m_getstar_cmd = 0x23; GS_SAVE_REGS } /* starting difficulty */ - if (cpu_get_pc(&space.device()) == 0x0dc1) + if (space.device().safe_pc() == 0x0dc1) { m_getstar_cmd = 0x22; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0dd0) + if (space.device().safe_pc() == 0x0dd0) { m_getstar_cmd = 0x22; GS_SAVE_REGS } /* starting lives (again) */ - if (cpu_get_pc(&space.device()) == 0x1011) + if (space.device().safe_pc() == 0x1011) { m_getstar_cmd = 0x23; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x101e) + if (space.device().safe_pc() == 0x101e) { m_getstar_cmd = 0x23; GS_SAVE_REGS } /* hardware test */ - if (cpu_get_pc(&space.device()) == 0x107a) + if (space.device().safe_pc() == 0x107a) { m_getstar_cmd = 0x73; GS_RESET_REGS } /* game phase (again) */ - if (cpu_get_pc(&space.device()) == 0x10c6) + if (space.device().safe_pc() == 0x10c6) { m_getstar_cmd = 0x24; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x10d3) + if (space.device().safe_pc() == 0x10d3) { m_getstar_cmd = 0x24; GS_SAVE_REGS } /* background */ - if (cpu_get_pc(&space.device()) == 0x1910) + if (space.device().safe_pc() == 0x1910) { m_getstar_cmd = 0x26; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x191d) + if (space.device().safe_pc() == 0x191d) { m_getstar_cmd = 0x26; GS_SAVE_REGS } /* foreground */ - if (cpu_get_pc(&space.device()) == 0x19d5) + if (space.device().safe_pc() == 0x19d5) { m_getstar_cmd = 0x37; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x19e4) + if (space.device().safe_pc() == 0x19e4) { m_getstar_cmd = 0x37; GS_SAVE_REGS } - if (cpu_get_pc(&space.device()) == 0x19f1) + if (space.device().safe_pc() == 0x19f1) { m_getstar_cmd = 0x37; /* do NOT update the registers because there are 2 writes before 2 reads ! */ } /* laser position */ - if (cpu_get_pc(&space.device()) == 0x26af) + if (space.device().safe_pc() == 0x26af) { m_getstar_cmd = 0x38; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x26be) + if (space.device().safe_pc() == 0x26be) { m_getstar_cmd = 0x38; GS_SAVE_REGS } - if (cpu_get_pc(&space.device()) == 0x26cb) + if (space.device().safe_pc() == 0x26cb) { m_getstar_cmd = 0x38; /* do NOT update the registers because there are 2 writes before 2 reads ! */ } /* starting lives (for "test mode") */ - if (cpu_get_pc(&space.device()) == 0x6a27) + if (space.device().safe_pc() == 0x6a27) { m_getstar_cmd = 0x23; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x6a38) + if (space.device().safe_pc() == 0x6a38) { m_getstar_cmd = 0x23; GS_SAVE_REGS @@ -488,183 +488,183 @@ WRITE8_MEMBER(slapfght_state::getstar_e803_w) break; case GETSTARJ: /* unknown effect - not read back */ - if (cpu_get_pc(&space.device()) == 0x00bf) + if (space.device().safe_pc() == 0x00bf) { m_getstar_cmd = 0x00; GS_RESET_REGS } /* players inputs */ - if (cpu_get_pc(&space.device()) == 0x0560) + if (space.device().safe_pc() == 0x0560) { m_getstar_cmd = 0x25; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x056d) + if (space.device().safe_pc() == 0x056d) { m_getstar_cmd = 0x25; GS_SAVE_REGS } /* lose life */ - if (cpu_get_pc(&space.device()) == 0x0ad5) + if (space.device().safe_pc() == 0x0ad5) { m_getstar_cmd = 0x21; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0ae2) + if (space.device().safe_pc() == 0x0ae2) { m_getstar_cmd = 0x21; GS_SAVE_REGS } /* unknown effect */ - if (cpu_get_pc(&space.device()) == 0x0b1c) + if (space.device().safe_pc() == 0x0b1c) { m_getstar_cmd = 0x29; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0b29) + if (space.device().safe_pc() == 0x0b29) { m_getstar_cmd = 0x29; GS_SAVE_REGS } /* continue play */ - if (cpu_get_pc(&space.device()) == 0x0bae) + if (space.device().safe_pc() == 0x0bae) { m_getstar_cmd = 0x20; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0bbb) + if (space.device().safe_pc() == 0x0bbb) { m_getstar_cmd = 0x20; GS_SAVE_REGS } /* unknown effect - not read back */ - if (cpu_get_pc(&space.device()) == 0x0c2d) + if (space.device().safe_pc() == 0x0c2d) { m_getstar_cmd = 0x00; /* 0x1f */ GS_RESET_REGS } /* change player (if 2 players game) */ - if (cpu_get_pc(&space.device()) == 0x0c76) + if (space.device().safe_pc() == 0x0c76) { m_getstar_cmd = 0x2a; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0c83) + if (space.device().safe_pc() == 0x0c83) { m_getstar_cmd = 0x2a; GS_SAVE_REGS } /* game phase */ - if (cpu_get_pc(&space.device()) == 0x0e02) + if (space.device().safe_pc() == 0x0e02) { m_getstar_cmd = 0x24; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0e0f) + if (space.device().safe_pc() == 0x0e0f) { m_getstar_cmd = 0x24; GS_SAVE_REGS } /* starting lives */ - if (cpu_get_pc(&space.device()) == 0x0e44) + if (space.device().safe_pc() == 0x0e44) { m_getstar_cmd = 0x23; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0e55) + if (space.device().safe_pc() == 0x0e55) { m_getstar_cmd = 0x23; GS_SAVE_REGS } /* starting difficulty */ - if (cpu_get_pc(&space.device()) == 0x0e8c) + if (space.device().safe_pc() == 0x0e8c) { m_getstar_cmd = 0x22; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x0e9b) + if (space.device().safe_pc() == 0x0e9b) { m_getstar_cmd = 0x22; GS_SAVE_REGS } /* starting lives (again) */ - if (cpu_get_pc(&space.device()) == 0x10d6) + if (space.device().safe_pc() == 0x10d6) { m_getstar_cmd = 0x23; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x10e3) + if (space.device().safe_pc() == 0x10e3) { m_getstar_cmd = 0x23; GS_SAVE_REGS } /* hardware test */ - if (cpu_get_pc(&space.device()) == 0x113f) + if (space.device().safe_pc() == 0x113f) { m_getstar_cmd = 0x73; GS_RESET_REGS } /* game phase (again) */ - if (cpu_get_pc(&space.device()) == 0x118b) + if (space.device().safe_pc() == 0x118b) { m_getstar_cmd = 0x24; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x1198) + if (space.device().safe_pc() == 0x1198) { m_getstar_cmd = 0x24; GS_SAVE_REGS } /* background */ - if (cpu_get_pc(&space.device()) == 0x19f8) + if (space.device().safe_pc() == 0x19f8) { m_getstar_cmd = 0x26; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x1a05) + if (space.device().safe_pc() == 0x1a05) { m_getstar_cmd = 0x26; GS_SAVE_REGS } /* foreground */ - if (cpu_get_pc(&space.device()) == 0x1abd) + if (space.device().safe_pc() == 0x1abd) { m_getstar_cmd = 0x37; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x1acc) + if (space.device().safe_pc() == 0x1acc) { m_getstar_cmd = 0x37; GS_SAVE_REGS } - if (cpu_get_pc(&space.device()) == 0x1ad9) + if (space.device().safe_pc() == 0x1ad9) { m_getstar_cmd = 0x37; /* do NOT update the registers because there are 2 writes before 2 reads ! */ } /* laser position */ - if (cpu_get_pc(&space.device()) == 0x2792) + if (space.device().safe_pc() == 0x2792) { m_getstar_cmd = 0x38; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x27a1) + if (space.device().safe_pc() == 0x27a1) { m_getstar_cmd = 0x38; GS_SAVE_REGS } - if (cpu_get_pc(&space.device()) == 0x27ae) + if (space.device().safe_pc() == 0x27ae) { m_getstar_cmd = 0x38; /* do NOT update the registers because there are 2 writes before 2 reads ! */ } /* starting lives (for "test mode") */ - if (cpu_get_pc(&space.device()) == 0x6ae2) + if (space.device().safe_pc() == 0x6ae2) { m_getstar_cmd = 0x23; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x6af3) + if (space.device().safe_pc() == 0x6af3) { m_getstar_cmd = 0x23; GS_SAVE_REGS @@ -696,12 +696,12 @@ WRITE8_MEMBER(slapfght_state::getstar_e803_w) 6B01: 3A 03 E8 ld a,($E803) We save the regs though to hack it in 'getstar_e803_r' read handler. */ - if (cpu_get_pc(&space.device()) == 0x6ae2) + if (space.device().safe_pc() == 0x6ae2) { m_getstar_cmd = 0x00; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x6af3) + if (space.device().safe_pc() == 0x6af3) { m_getstar_cmd = 0x00; GS_SAVE_REGS @@ -735,19 +735,19 @@ WRITE8_MEMBER(slapfght_state::getstar_e803_w) 6B01: 3A 03 E8 ld a,($E803) We save the regs though to hack it in 'getstar_e803_r' read handler. */ - if (cpu_get_pc(&space.device()) == 0x6ae2) + if (space.device().safe_pc() == 0x6ae2) { m_getstar_cmd = 0x00; GS_RESET_REGS } - if (cpu_get_pc(&space.device()) == 0x6af3) + if (space.device().safe_pc() == 0x6af3) { m_getstar_cmd = 0x00; GS_SAVE_REGS } break; default: - logerror("%04x: getstar_e803_w - data = %02x - unknown set !\n",cpu_get_pc(&space.device()),data); + logerror("%04x: getstar_e803_w - data = %02x - unknown set !\n",space.device().safe_pc(),data); break; } } @@ -756,7 +756,7 @@ WRITE8_MEMBER(slapfght_state::getstar_e803_w) WRITE8_MEMBER(slapfght_state::getstar_sh_intenable_w) { m_getstar_sh_intenabled = 1; - logerror("cpu #1 PC=%d: %d written to a0e0\n",cpu_get_pc(&space.device()),data); + logerror("cpu #1 PC=%d: %d written to a0e0\n",space.device().safe_pc(),data); } @@ -879,7 +879,7 @@ READ8_MEMBER(slapfght_state::tigerhb_e803_r) tigerhb_val = 0x83; break; default: - logerror("%04x: tigerhb_e803_r - cmd = %02x\n",cpu_get_pc(&space.device()),m_getstar_cmd); + logerror("%04x: tigerhb_e803_r - cmd = %02x\n",space.device().safe_pc(),m_getstar_cmd); break; } return tigerhb_val; @@ -894,7 +894,7 @@ WRITE8_MEMBER(slapfght_state::tigerhb_e803_w) m_tigerhb_cmd = 0x73; break; default: - logerror("%04x: tigerhb_e803_w - data = %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: tigerhb_e803_w - data = %02x\n",space.device().safe_pc(),data); m_tigerhb_cmd = 0x00; break; } diff --git a/src/mame/machine/slapstic.c b/src/mame/machine/slapstic.c index 430f9fd6bf3..6821d14fa25 100644 --- a/src/mame/machine/slapstic.c +++ b/src/mame/machine/slapstic.c @@ -876,10 +876,10 @@ static int alt2_kludge(address_space *space, offs_t offset) if (access_68k) { /* first verify that the prefetched PC matches the first alternate */ - if (MATCHES_MASK_VALUE(cpu_get_pc(&space->device()) >> 1, slapstic.alt1)) + if (MATCHES_MASK_VALUE(space->device().safe_pc() >> 1, slapstic.alt1)) { /* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */ - UINT16 opcode = space->direct().read_decrypted_word(cpu_get_previouspc(&space->device()) & 0xffffff); + UINT16 opcode = space->direct().read_decrypted_word(space->device().safe_pcbase() & 0xffffff); if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148) { /* fetch the value of the register for the second operand, and see */ diff --git a/src/mame/machine/smpc.c b/src/mame/machine/smpc.c index 8dffd82d832..1274c9308aa 100644 --- a/src/mame/machine/smpc.c +++ b/src/mame/machine/smpc.c @@ -716,7 +716,7 @@ static void smpc_comreg_exec(address_space *space, UINT8 data, UINT8 is_stv) smpc_nmi_set(space->machine(),data & 1); break; default: - printf ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space->device().tag(), cpu_get_pc(&space->device()), data); + printf ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space->device().tag(), space->device().safe_pc(), data); } } @@ -883,7 +883,7 @@ READ8_HANDLER( saturn_SMPC_r ) } } - if (LOG_SMPC) logerror ("cpu %s (PC=%08X) SMPC: Read from Byte Offset %02x (%d) Returns %02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, offset>>1, return_data); + if (LOG_SMPC) logerror ("cpu %s (PC=%08X) SMPC: Read from Byte Offset %02x (%d) Returns %02x\n", space->device().tag(), space->device().safe_pc(), offset, offset>>1, return_data); return return_data; diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 9ea546a3f94..3efe257e484 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -308,7 +308,7 @@ READ8_HANDLER( snes_open_bus_r ) return 0xff; recurse = 1; - result = space->read_byte(cpu_get_pc(&space->device()) - 1); //LAST opcode that's fetched on the bus + result = space->read_byte(space->device().safe_pc() - 1); //LAST opcode that's fetched on the bus recurse = 0; return result; } @@ -572,7 +572,7 @@ READ8_HANDLER( snes_r_io ) // case 0x4101: //PC: a104 - a10e - a12a //only nss_actr (DSW actually reads in word units ...) default: -// mame_printf_debug("snes_r: offset = %x pc = %x\n",offset,cpu_get_pc(&space->device())); +// mame_printf_debug("snes_r: offset = %x pc = %x\n",offset,space->device().safe_pc()); // Added break; after commenting above line. If uncommenting, drop the break; break; } @@ -604,7 +604,7 @@ WRITE8_HANDLER( snes_w_io ) // APU is mirrored from 2140 to 217f if (offset >= APU00 && offset < WMDATA) { -// printf("816: %02x to APU @ %d (PC=%06x)\n", data, offset & 3,cpu_get_pc(&space->device())); +// printf("816: %02x to APU @ %d (PC=%06x)\n", data, offset & 3,space->device().safe_pc()); spc_port_in(state->m_spc700, offset & 0x3, data); space->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(20)); return; @@ -875,7 +875,7 @@ READ8_HANDLER( snes_r_bank1 ) } else { - logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address); + logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",space->device().safe_pc(),address); value = snes_open_bus_r(space, 0); /* Reserved */ } } @@ -934,7 +934,7 @@ READ8_HANDLER( snes_r_bank2 ) } else { - logerror( "(PC=%06x) snes_r_bank2: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address ); + logerror( "(PC=%06x) snes_r_bank2: Unmapped external chip read: %04x\n",space->device().safe_pc(),address ); value = snes_open_bus_r(space, 0); } } @@ -1025,7 +1025,7 @@ READ8_HANDLER( snes_r_bank4 ) value = (address >= 0x4000) ? dsp_get_sr() : dsp_get_dr(); else { - logerror("(PC=%06x) snes_r_bank4: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address); + logerror("(PC=%06x) snes_r_bank4: Unmapped external chip read: %04x\n",space->device().safe_pc(),address); value = snes_open_bus_r(space, 0); /* Reserved */ } } @@ -1058,7 +1058,7 @@ READ8_HANDLER( snes_r_bank5 ) } else { - logerror("(PC=%06x) snes_r_bank5: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address); + logerror("(PC=%06x) snes_r_bank5: Unmapped external chip read: %04x\n",space->device().safe_pc(),address); value = snes_open_bus_r(space, 0); /* Reserved */ } } @@ -1094,7 +1094,7 @@ READ8_HANDLER( snes_r_bank6 ) } else /* Area 0x6000-0x8000 with offset < 0x300000 is reserved */ { - logerror("(PC=%06x) snes_r_bank6: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address); + logerror("(PC=%06x) snes_r_bank6: Unmapped external chip read: %04x\n",space->device().safe_pc(),address); value = snes_open_bus_r(space, 0); } } @@ -1221,7 +1221,7 @@ WRITE8_HANDLER( snes_w_bank1 ) else dsp_set_sr(data); else - logerror( "(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset ); + logerror( "(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset ); } /* 0x300000 - 0x3fffff */ @@ -1278,7 +1278,7 @@ WRITE8_HANDLER( snes_w_bank2 ) else dsp_set_sr(data); else - logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x300000); + logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x300000); } /* 0x600000 - 0x6fffff */ @@ -1307,14 +1307,14 @@ WRITE8_HANDLER( snes_w_bank4 ) else if (state->m_cart[0].mode & 5) /* Mode 20 & 22 */ { if (address >= 0x8000) - logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x600000); + logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x600000); else if (state->m_has_addon_chip == HAS_DSP1) dsp_set_dr(data); else logerror("snes_w_bank4: Attempt to write to reserved address: %X = %02x\n", offset + 0x600000, data); } else if (state->m_cart[0].mode & 0x0a) - logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x600000); + logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x600000); } /* 0x700000 - 0x7dffff */ @@ -1336,7 +1336,7 @@ WRITE8_HANDLER( snes_w_bank5 ) logerror("snes_w_bank5: Attempt to write to reserved address: %X = %02x\n", offset + 0x700000, data); } else if (state->m_cart[0].mode & 0x0a) - logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x700000); + logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x700000); } @@ -1387,7 +1387,7 @@ WRITE8_HANDLER( snes_w_bank6 ) else dsp_set_sr(data); else - logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x800000); + logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x800000); } @@ -1405,7 +1405,7 @@ WRITE8_HANDLER( snes_w_bank7 ) snes_ram[0xe00000 + offset] = data; // SFX RAM } else - logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0xc00000); + logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0xc00000); } else if (state->m_has_addon_chip == HAS_ST010 || state->m_has_addon_chip == HAS_ST011) { @@ -1434,10 +1434,10 @@ WRITE8_HANDLER( snes_w_bank7 ) snes_w_bank4(space, offset - 0x200000, data); } else - logerror("(PC=%06x) snes_w_bank7: Attempt to write to ROM address: %X = %02x\n",cpu_get_pc(&space->device()),offset + 0xc00000, data); + logerror("(PC=%06x) snes_w_bank7: Attempt to write to ROM address: %X = %02x\n",space->device().safe_pc(),offset + 0xc00000, data); } else if (state->m_cart[0].mode & 0x0a) - logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0xc00000); + logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0xc00000); } diff --git a/src/mame/machine/stvprot.c b/src/mame/machine/stvprot.c index 83d221df4b8..b4f9d828164 100644 --- a/src/mame/machine/stvprot.c +++ b/src/mame/machine/stvprot.c @@ -120,9 +120,9 @@ static READ32_HANDLER( twcup98_prot_r ) { if(offset == 3) { - logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]); + logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]); #ifdef MAME_DEBUG - popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]); + popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]); #endif switch(a_bus[3]) { @@ -141,7 +141,7 @@ static READ32_HANDLER( twcup98_prot_r ) static WRITE32_HANDLER ( twcup98_prot_w ) { COMBINE_DATA(&a_bus[offset]); - logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data); + logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data); if(offset == 3) { logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); @@ -179,9 +179,9 @@ static READ32_HANDLER( sss_prot_r ) { if(offset == 3) { - logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]); + logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]); #ifdef MAME_DEBUG - popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]); + popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]); #endif switch(a_bus[3]) { @@ -208,7 +208,7 @@ static READ32_HANDLER( sss_prot_r ) static WRITE32_HANDLER ( sss_prot_w ) { COMBINE_DATA(&a_bus[offset]); - logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data); + logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data); if(offset == 3) { //logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); @@ -244,9 +244,9 @@ static READ32_HANDLER( rsgun_prot_r ) { if(offset == 3) { - logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]); + logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]); #ifdef MAME_DEBUG - popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]); + popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]); #endif switch(a_bus[3]) { @@ -278,7 +278,7 @@ static READ32_HANDLER( rsgun_prot_r ) static WRITE32_HANDLER ( rsgun_prot_w ) { COMBINE_DATA(&a_bus[offset]); - logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data); + logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data); if(offset == 3) { //logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); @@ -319,9 +319,9 @@ static READ32_HANDLER( elandore_prot_r ) { if(offset == 3) { - logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]); + logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]); #ifdef MAME_DEBUG - popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]); + popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]); #endif switch(a_bus[3]) { @@ -349,7 +349,7 @@ static READ32_HANDLER( elandore_prot_r ) static WRITE32_HANDLER ( elandore_prot_w ) { COMBINE_DATA(&a_bus[offset]); - logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data); + logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data); if(offset == 3) { /* a bus value 2 seed is used too here. */ @@ -426,9 +426,9 @@ static READ32_HANDLER( ffreveng_prot_r ) { if(offset == 3) { - logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]); + logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]); #ifdef MAME_DEBUG - popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]); + popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]); #endif switch(a_bus[3]) { @@ -455,7 +455,7 @@ static READ32_HANDLER( ffreveng_prot_r ) static WRITE32_HANDLER ( ffreveng_prot_w ) { COMBINE_DATA(&a_bus[offset]); - logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data); + logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data); if(offset == 3) { //logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); @@ -554,7 +554,7 @@ static READ32_HANDLER( decathlt_prot_r ) } else { - logerror("%06x Decathlete prot R offset %04x mask %08x regs %08x, %08x, %08x, %08x\n",cpu_get_pc(&space->device()), offset, mem_mask, decathlt_protregs[0], decathlt_protregs[1], decathlt_protregs[2], decathlt_protregs[3]); + logerror("%06x Decathlete prot R offset %04x mask %08x regs %08x, %08x, %08x, %08x\n",space->device().safe_pc(), offset, mem_mask, decathlt_protregs[0], decathlt_protregs[1], decathlt_protregs[2], decathlt_protregs[3]); } return decathlt_protregs[offset]; diff --git a/src/mame/machine/taitoio.c b/src/mame/machine/taitoio.c index 421416aa961..5177f80c597 100644 --- a/src/mame/machine/taitoio.c +++ b/src/mame/machine/taitoio.c @@ -113,7 +113,7 @@ READ8_DEVICE_HANDLER( tc0220ioc_r ) return tc0220ioc->read_7(0); default: -//logerror("PC %06x: warning - read TC0220IOC address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("PC %06x: warning - read TC0220IOC address %02x\n",space->device().safe_pc(),offset); return 0xff; } } @@ -138,12 +138,12 @@ WRITE8_DEVICE_HANDLER( tc0220ioc_w ) coin_counter_w(device->machine(), 1, data & 0x08); //if (data & 0xf0) -//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",space->device().safe_pc(),data,offset); break; default: -//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",space->device().safe_pc(),data,offset); break; } } @@ -270,7 +270,7 @@ READ8_DEVICE_HANDLER( tc0510nio_r ) return tc0510nio->read_7(0); default: -//logerror("PC %06x: warning - read TC0510NIO address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("PC %06x: warning - read TC0510NIO address %02x\n",space->device().safe_pc(),offset); return 0xff; } } @@ -295,7 +295,7 @@ WRITE8_DEVICE_HANDLER( tc0510nio_w ) break; default: -//logerror("PC %06x: warning - write %02x to TC0510NIO address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %02x to TC0510NIO address %02x\n",space->device().safe_pc(),data,offset); break; } } @@ -312,7 +312,7 @@ WRITE16_DEVICE_HANDLER( tc0510nio_halfword_w ) else { /* driftout writes the coin counters here - bug? */ -//logerror("CPU #0 PC %06x: warning - write to MSB of TC0510NIO address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("CPU #0 PC %06x: warning - write to MSB of TC0510NIO address %02x\n",space->device().safe_pc(),offset); tc0510nio_w(device, offset, (data >> 8) & 0xff); } } @@ -421,7 +421,7 @@ READ8_DEVICE_HANDLER( tc0640fio_r ) return tc0640fio->read_7(0); default: -//logerror("PC %06x: warning - read TC0640FIO address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("PC %06x: warning - read TC0640FIO address %02x\n",space->device().safe_pc(),offset); return 0xff; } } @@ -446,7 +446,7 @@ WRITE8_DEVICE_HANDLER( tc0640fio_w ) break; default: -//logerror("PC %06x: warning - write %02x to TC0640FIO address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %02x to TC0640FIO address %02x\n",space->device().safe_pc(),data,offset); break; } } @@ -463,7 +463,7 @@ WRITE16_DEVICE_HANDLER( tc0640fio_halfword_w ) else { tc0640fio_w(device, offset, (data >> 8) & 0xff); -//logerror("CPU #0 PC %06x: warning - write to MSB of TC0640FIO address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("CPU #0 PC %06x: warning - write to MSB of TC0640FIO address %02x\n",space->device().safe_pc(),offset); } } @@ -479,7 +479,7 @@ WRITE16_DEVICE_HANDLER( tc0640fio_halfword_byteswap_w ) else { tc0640fio_w(device, offset, data & 0xff); -//logerror("CPU #0 PC %06x: warning - write to LSB of TC0640FIO address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("CPU #0 PC %06x: warning - write to LSB of TC0640FIO address %02x\n",space->device().safe_pc(),offset); } } diff --git a/src/mame/machine/taitosj.c b/src/mame/machine/taitosj.c index 3535a81a166..9a9dfaac3b9 100644 --- a/src/mame/machine/taitosj.c +++ b/src/mame/machine/taitosj.c @@ -79,18 +79,18 @@ WRITE8_MEMBER(taitosj_state::taitosj_bankswitch_w) ***************************************************************************/ READ8_MEMBER(taitosj_state::taitosj_fake_data_r) { - LOG(("%04x: protection read\n",cpu_get_pc(&space.device()))); + LOG(("%04x: protection read\n",space.device().safe_pc())); return 0; } WRITE8_MEMBER(taitosj_state::taitosj_fake_data_w) { - LOG(("%04x: protection write %02x\n",cpu_get_pc(&space.device()),data)); + LOG(("%04x: protection write %02x\n",space.device().safe_pc(),data)); } READ8_MEMBER(taitosj_state::taitosj_fake_status_r) { - LOG(("%04x: protection status read\n",cpu_get_pc(&space.device()))); + LOG(("%04x: protection status read\n",space.device().safe_pc())); return 0xff; } @@ -98,7 +98,7 @@ READ8_MEMBER(taitosj_state::taitosj_fake_status_r) /* timer callback : */ READ8_MEMBER(taitosj_state::taitosj_mcu_data_r) { - LOG(("%04x: protection read %02x\n",cpu_get_pc(&space.device()),m_toz80)); + LOG(("%04x: protection read %02x\n",space.device().safe_pc(),m_toz80)); m_zaccept = 1; return m_toz80; } @@ -114,7 +114,7 @@ static TIMER_CALLBACK( taitosj_mcu_real_data_w ) WRITE8_MEMBER(taitosj_state::taitosj_mcu_data_w) { - LOG(("%04x: protection write %02x\n",cpu_get_pc(&space.device()),data)); + LOG(("%04x: protection write %02x\n",space.device().safe_pc(),data)); machine().scheduler().synchronize(FUNC(taitosj_mcu_real_data_w), data); /* temporarily boost the interleave to sync things up */ machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10)); @@ -132,13 +132,13 @@ READ8_MEMBER(taitosj_state::taitosj_mcu_status_r) READ8_MEMBER(taitosj_state::taitosj_68705_portA_r) { - LOG(("%04x: 68705 port A read %02x\n",cpu_get_pc(&space.device()),m_portA_in)); + LOG(("%04x: 68705 port A read %02x\n",space.device().safe_pc(),m_portA_in)); return m_portA_in; } WRITE8_MEMBER(taitosj_state::taitosj_68705_portA_w) { - LOG(("%04x: 68705 port A write %02x\n",cpu_get_pc(&space.device()),data)); + LOG(("%04x: 68705 port A write %02x\n",space.device().safe_pc(),data)); m_portA_out = data; } @@ -186,11 +186,11 @@ static TIMER_CALLBACK( taitosj_mcu_status_real_w ) WRITE8_MEMBER(taitosj_state::taitosj_68705_portB_w) { - LOG(("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data)); + LOG(("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data)); if (~data & 0x01) { - LOG(("%04x: 68705 68INTRQ **NOT SUPPORTED**!\n", cpu_get_pc(&space.device()))); + LOG(("%04x: 68705 68INTRQ **NOT SUPPORTED**!\n", space.device().safe_pc())); } if (~data & 0x02) { @@ -198,7 +198,7 @@ WRITE8_MEMBER(taitosj_state::taitosj_68705_portB_w) machine().scheduler().synchronize(FUNC(taitosj_mcu_data_real_r)); cputag_set_input_line(machine(), "mcu", 0, CLEAR_LINE); m_portA_in = m_fromz80; - LOG(("%04x: 68705 <- Z80 %02x\n", cpu_get_pc(&space.device()), m_portA_in)); + LOG(("%04x: 68705 <- Z80 %02x\n", space.device().safe_pc(), m_portA_in)); } if (~data & 0x08) m_busreq = 1; @@ -206,7 +206,7 @@ WRITE8_MEMBER(taitosj_state::taitosj_68705_portB_w) m_busreq = 0; if (~data & 0x04) { - LOG(("%04x: 68705 -> Z80 %02x\n", cpu_get_pc(&space.device()), m_portA_out)); + LOG(("%04x: 68705 -> Z80 %02x\n", space.device().safe_pc(), m_portA_out)); /* 68705 is writing data for the Z80 */ machine().scheduler().synchronize(FUNC(taitosj_mcu_status_real_w), m_portA_out); @@ -214,7 +214,7 @@ WRITE8_MEMBER(taitosj_state::taitosj_68705_portB_w) if (~data & 0x10) { address_space *cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM); - LOG(("%04x: 68705 write %02x to address %04x\n",cpu_get_pc(&space.device()), m_portA_out, m_address)); + LOG(("%04x: 68705 write %02x to address %04x\n",space.device().safe_pc(), m_portA_out, m_address)); cpu0space->write_byte(m_address, m_portA_out); @@ -225,16 +225,16 @@ WRITE8_MEMBER(taitosj_state::taitosj_68705_portB_w) { address_space *cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM); m_portA_in = cpu0space->read_byte(m_address); - LOG(("%04x: 68705 read %02x from address %04x\n", cpu_get_pc(&space.device()), m_portA_in, m_address)); + LOG(("%04x: 68705 read %02x from address %04x\n", space.device().safe_pc(), m_portA_in, m_address)); } if (~data & 0x40) { - LOG(("%04x: 68705 address low %02x\n", cpu_get_pc(&space.device()), m_portA_out)); + LOG(("%04x: 68705 address low %02x\n", space.device().safe_pc(), m_portA_out)); m_address = (m_address & 0xff00) | m_portA_out; } if (~data & 0x80) { - LOG(("%04x: 68705 address high %02x\n", cpu_get_pc(&space.device()), m_portA_out)); + LOG(("%04x: 68705 address high %02x\n", space.device().safe_pc(), m_portA_out)); m_address = (m_address & 0x00ff) | (m_portA_out << 8); } } @@ -254,7 +254,7 @@ READ8_MEMBER(taitosj_state::taitosj_68705_portC_r) int res; res = (m_zready << 0) | (m_zaccept << 1) | ((m_busreq^1) << 2); - LOG(("%04x: 68705 port C read %02x\n",cpu_get_pc(&space.device()),res)); + LOG(("%04x: 68705 port C read %02x\n",space.device().safe_pc(),res)); return res; } @@ -263,7 +263,7 @@ READ8_MEMBER(taitosj_state::taitosj_68705_portC_r) READ8_MEMBER(taitosj_state::spacecr_prot_r) { - int pc = cpu_get_pc(&space.device()); + int pc = space.device().safe_pc(); if( pc != 0x368A && pc != 0x36A6 ) logerror("Read protection from an unknown location: %04X\n",pc); diff --git a/src/mame/machine/tatsumi.c b/src/mame/machine/tatsumi.c index 5e2c9ed24f2..ea9a33b0767 100644 --- a/src/mame/machine/tatsumi.c +++ b/src/mame/machine/tatsumi.c @@ -76,7 +76,7 @@ READ16_MEMBER(tatsumi_state::apache3_v30_v20_r) else if ((m_control_word & 0xe0) == 0x80) offset += 0x00000; // main ram else - logerror("%08x: unmapped read z80 rom %08x\n", cpu_get_pc(&space.device()), offset); + logerror("%08x: unmapped read z80 rom %08x\n", space.device().safe_pc(), offset); return 0xff00 | targetspace->read_byte(offset); } @@ -85,7 +85,7 @@ WRITE16_MEMBER(tatsumi_state::apache3_v30_v20_w) address_space *targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM); if ((m_control_word & 0xe0) != 0x80) - logerror("%08x: write unmapped v30 rom %08x\n", cpu_get_pc(&space.device()), offset); + logerror("%08x: write unmapped v30 rom %08x\n", space.device().safe_pc(), offset); /* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */ if (ACCESSING_BITS_0_7) @@ -181,7 +181,7 @@ WRITE16_MEMBER(tatsumi_state::roundup5_control_w) cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_HALT, CLEAR_LINE); // if (offset == 1 && (tatsumi_control_w & 0xfeff) != (last_bank & 0xfeff)) -// logerror("%08x: Changed bank to %04x (%d)\n", cpu_get_pc(&space.device()), tatsumi_control_w,offset); +// logerror("%08x: Changed bank to %04x (%d)\n", space.device().safe_pc(), tatsumi_control_w,offset); //todo - watchdog @@ -227,7 +227,7 @@ WRITE16_MEMBER(tatsumi_state::roundup5_control_w) WRITE16_MEMBER(tatsumi_state::roundup5_d0000_w) { COMBINE_DATA(&m_roundup5_d0000_ram[offset]); -// logerror("d_68k_d0000_w %06x %04x\n", cpu_get_pc(&space.device()), data); +// logerror("d_68k_d0000_w %06x %04x\n", space.device().safe_pc(), data); } WRITE16_MEMBER(tatsumi_state::roundup5_e0000_w) @@ -239,14 +239,14 @@ WRITE16_MEMBER(tatsumi_state::roundup5_e0000_w) COMBINE_DATA(&m_roundup5_e0000_ram[offset]); cputag_set_input_line(machine(), "sub", INPUT_LINE_IRQ4, CLEAR_LINE); // guess, probably wrong -// logerror("d_68k_e0000_w %06x %04x\n", cpu_get_pc(&space.device()), data); +// logerror("d_68k_e0000_w %06x %04x\n", space.device().safe_pc(), data); } /******************************************************************************/ READ16_MEMBER(tatsumi_state::cyclwarr_control_r) { -// logerror("%08x: control_r\n", cpu_get_pc(&space.device())); +// logerror("%08x: control_r\n", space.device().safe_pc()); return m_control_word; } @@ -255,7 +255,7 @@ WRITE16_MEMBER(tatsumi_state::cyclwarr_control_w) COMBINE_DATA(&m_control_word); // if ((m_control_word&0xfe) != (m_last_control&0xfe)) -// logerror("%08x: control_w %04x\n", cpu_get_pc(&space.device()), data); +// logerror("%08x: control_w %04x\n", space.device().safe_pc(), data); /* @@ -280,7 +280,7 @@ WRITE16_MEMBER(tatsumi_state::cyclwarr_control_w) // hack - if (cpu_get_pc(&space.device()) == 0x2c3c34) + if (space.device().safe_pc() == 0x2c3c34) { // cpu_set_reset_line(1, CLEAR_LINE); // logerror("hack 68k2 on\n"); @@ -295,12 +295,12 @@ READ16_MEMBER(tatsumi_state::tatsumi_v30_68000_r) { const UINT16* rom=(UINT16*)machine().root_device().memregion("sub")->base(); -logerror("%05X:68000_r(%04X),cw=%04X\n", cpu_get_pc(&space.device()), offset*2, m_control_word); +logerror("%05X:68000_r(%04X),cw=%04X\n", space.device().safe_pc(), offset*2, m_control_word); /* Read from 68k RAM */ if ((m_control_word&0x1f)==0x18) { // hack to make roundup 5 boot - if (cpu_get_pc(&space.device())==0xec575) + if (space.device().safe_pc()==0xec575) { UINT8 *dst = memregion("maincpu")->base(); dst[BYTE_XOR_LE(0xec57a)]=0x46; @@ -340,9 +340,9 @@ READ8_DEVICE_HANDLER(tatsumi_hack_ym2151_r) address_space *space = device->machine().device("audiocpu")->memory().space(AS_PROGRAM); int r=ym2151_status_port_r(device,0); - if (cpu_get_pc(&space->device())==0x2aca || cpu_get_pc(&space->device())==0x29fe - || cpu_get_pc(&space->device())==0xf9721 - || cpu_get_pc(&space->device())==0x1b96 || cpu_get_pc(&space->device())==0x1c65) // BigFight + if (space->device().safe_pc()==0x2aca || space->device().safe_pc()==0x29fe + || space->device().safe_pc()==0xf9721 + || space->device().safe_pc()==0x1b96 || space->device().safe_pc()==0x1c65) // BigFight return 0x80; return r; } @@ -354,14 +354,14 @@ READ8_DEVICE_HANDLER(tatsumi_hack_oki_r) address_space *space = device->machine().device("audiocpu")->memory().space(AS_PROGRAM); int r=downcast(device)->read(*space,0); - if (cpu_get_pc(&space->device())==0x2b70 || cpu_get_pc(&space->device())==0x2bb5 - || cpu_get_pc(&space->device())==0x2acc - || cpu_get_pc(&space->device())==0x1c79 // BigFight - || cpu_get_pc(&space->device())==0x1cbe // BigFight - || cpu_get_pc(&space->device())==0xf9881) + if (space->device().safe_pc()==0x2b70 || space->device().safe_pc()==0x2bb5 + || space->device().safe_pc()==0x2acc + || space->device().safe_pc()==0x1c79 // BigFight + || space->device().safe_pc()==0x1cbe // BigFight + || space->device().safe_pc()==0xf9881) return 0xf; - if (cpu_get_pc(&space->device())==0x2ba3 || cpu_get_pc(&space->device())==0x2a9b || cpu_get_pc(&space->device())==0x2adc - || cpu_get_pc(&space->device())==0x1cac) // BigFight + if (space->device().safe_pc()==0x2ba3 || space->device().safe_pc()==0x2a9b || space->device().safe_pc()==0x2adc + || space->device().safe_pc()==0x1cac) // BigFight return 0; return r; } diff --git a/src/mame/machine/tnzs.c b/src/mame/machine/tnzs.c index 74c2bdf98af..d9e8217c946 100644 --- a/src/mame/machine/tnzs.c +++ b/src/mame/machine/tnzs.c @@ -50,14 +50,14 @@ READ8_MEMBER(tnzs_state::mcu_tnzs_r) data = upi41_master_r(m_mcu, offset & 1); device_yield(&space.device()); -// logerror("PC %04x: read %02x from mcu $c00%01x\n", cpu_get_previouspc(&space.device()), data, offset); +// logerror("PC %04x: read %02x from mcu $c00%01x\n", space.device().safe_pcbase(), data, offset); return data; } WRITE8_MEMBER(tnzs_state::mcu_tnzs_w) { -// logerror("PC %04x: write %02x to mcu $c00%01x\n", cpu_get_previouspc(&space.device()), data, offset); +// logerror("PC %04x: write %02x to mcu $c00%01x\n", space.device().safe_pcbase(), data, offset); upi41_master_w(m_mcu, offset & 1, data); } @@ -75,7 +75,7 @@ READ8_MEMBER(tnzs_state::tnzs_port1_r) default: data = 0xff; break; } -// logerror("I8742:%04x Read %02x from port 1\n", cpu_get_previouspc(&space.device()), data); +// logerror("I8742:%04x Read %02x from port 1\n", space.device().safe_pcbase(), data); return data; } @@ -84,14 +84,14 @@ READ8_MEMBER(tnzs_state::tnzs_port2_r) { int data = ioport("IN2")->read(); -// logerror("I8742:%04x Read %02x from port 2\n", cpu_get_previouspc(&space.device()), data); +// logerror("I8742:%04x Read %02x from port 2\n", space.device().safe_pcbase(), data); return data; } WRITE8_MEMBER(tnzs_state::tnzs_port2_w) { -// logerror("I8742:%04x Write %02x to port 2\n", cpu_get_previouspc(&space.device()), data); +// logerror("I8742:%04x Write %02x to port 2\n", space.device().safe_pcbase(), data); coin_lockout_w(machine(), 0, (data & 0x40)); coin_lockout_w(machine(), 1, (data & 0x80)); @@ -107,7 +107,7 @@ READ8_MEMBER(tnzs_state::arknoid2_sh_f000_r) { int val; -// logerror("PC %04x: read input %04x\n", cpu_get_pc(&space.device()), 0xf000 + offset); +// logerror("PC %04x: read input %04x\n", space.device().safe_pc(), 0xf000 + offset); val = ioport((offset / 2) ? "AN2" : "AN1")->read_safe(0); if (offset & 1) @@ -212,7 +212,7 @@ READ8_MEMBER(tnzs_state::mcu_arknoid2_r) { static const char mcu_startup[] = "\x55\xaa\x5a"; -// logerror("PC %04x: read mcu %04x\n", cpu_get_pc(&space.device()), 0xc000 + offset); +// logerror("PC %04x: read mcu %04x\n", space.device().safe_pc(), 0xc000 + offset); if (offset == 0) { @@ -273,7 +273,7 @@ WRITE8_MEMBER(tnzs_state::mcu_arknoid2_w) { if (offset == 0) { -// logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset); +// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); if (m_mcu_command == 0x41) { m_mcu_credits = (m_mcu_credits + data) & 0xff; @@ -290,7 +290,7 @@ WRITE8_MEMBER(tnzs_state::mcu_arknoid2_w) 0x80: release coin lockout (issued only in test mode) during initialization, a sequence of 4 bytes sets coin/credit settings */ -// logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset); +// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); if (m_mcu_initializing) { @@ -318,7 +318,7 @@ READ8_MEMBER(tnzs_state::mcu_extrmatn_r) { static const char mcu_startup[] = "\x5a\xa5\x55"; -// logerror("PC %04x: read mcu %04x\n", cpu_get_pc(&space.device()), 0xc000 + offset); +// logerror("PC %04x: read mcu %04x\n", space.device().safe_pc(), 0xc000 + offset); if (offset == 0) { @@ -402,7 +402,7 @@ WRITE8_MEMBER(tnzs_state::mcu_extrmatn_w) { if (offset == 0) { -// logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset); +// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); if (m_mcu_command == 0x41) { m_mcu_credits = (m_mcu_credits + data) & 0xff; @@ -424,7 +424,7 @@ WRITE8_MEMBER(tnzs_state::mcu_extrmatn_w) during initialization, a sequence of 4 bytes sets coin/credit settings */ -// logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset); +// logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset); if (m_mcu_initializing) { @@ -729,7 +729,7 @@ MACHINE_START( tnzs ) WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bankswitch_w) { -// logerror("PC %04x: writing %02x to bankswitch\n", cpu_get_pc(&space.device()),data); +// logerror("PC %04x: writing %02x to bankswitch\n", space.device().safe_pc(),data); /* bit 4 resets the second CPU */ if (data & 0x10) @@ -743,7 +743,7 @@ WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bankswitch_w) WRITE8_MEMBER(tnzs_state::tnzs_bankswitch1_w) { -// logerror("PC %04x: writing %02x to bankswitch 1\n", cpu_get_pc(&space.device()),data); +// logerror("PC %04x: writing %02x to bankswitch 1\n", space.device().safe_pc(),data); switch (m_mcu_type) { diff --git a/src/mame/machine/toaplan1.c b/src/mame/machine/toaplan1.c index f897d434d60..57e92fd2624 100644 --- a/src/mame/machine/toaplan1.c +++ b/src/mame/machine/toaplan1.c @@ -69,7 +69,7 @@ WRITE16_MEMBER(toaplan1_state::demonwld_dsp_addrsel_w) m_main_ram_seg = ((data & 0xe000) << 9); m_dsp_addr_w = ((data & 0x1fff) << 1); - logerror("DSP PC:%04x IO write %04x (%08x) at port 0\n", cpu_get_previouspc(&space.device()), data, m_main_ram_seg + m_dsp_addr_w); + logerror("DSP PC:%04x IO write %04x (%08x) at port 0\n", space.device().safe_pcbase(), data, m_main_ram_seg + m_dsp_addr_w); } READ16_MEMBER(toaplan1_state::demonwld_dsp_r) @@ -83,9 +83,9 @@ READ16_MEMBER(toaplan1_state::demonwld_dsp_r) case 0xc00000: mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM); input_data = mainspace->read_word(m_main_ram_seg + m_dsp_addr_w); break; - default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n", cpu_get_previouspc(&space.device()), m_main_ram_seg + m_dsp_addr_w); + default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n", space.device().safe_pcbase(), m_main_ram_seg + m_dsp_addr_w); } - logerror("DSP PC:%04x IO read %04x at %08x (port 1)\n", cpu_get_previouspc(&space.device()), input_data, m_main_ram_seg + m_dsp_addr_w); + logerror("DSP PC:%04x IO read %04x at %08x (port 1)\n", space.device().safe_pcbase(), input_data, m_main_ram_seg + m_dsp_addr_w); return input_data; } @@ -100,9 +100,9 @@ WRITE16_MEMBER(toaplan1_state::demonwld_dsp_w) mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM); mainspace->write_word(m_main_ram_seg + m_dsp_addr_w, data); break; - default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n", cpu_get_previouspc(&space.device()), m_main_ram_seg + m_dsp_addr_w); + default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n", space.device().safe_pcbase(), m_main_ram_seg + m_dsp_addr_w); } - logerror("DSP PC:%04x IO write %04x at %08x (port 1)\n", cpu_get_previouspc(&space.device()), data, m_main_ram_seg + m_dsp_addr_w); + logerror("DSP PC:%04x IO write %04x at %08x (port 1)\n", space.device().safe_pcbase(), data, m_main_ram_seg + m_dsp_addr_w); } WRITE16_MEMBER(toaplan1_state::demonwld_dsp_bio_w) @@ -114,7 +114,7 @@ WRITE16_MEMBER(toaplan1_state::demonwld_dsp_bio_w) /* communication to main processor*/ - logerror("DSP PC:%04x IO write %04x at port 3\n", cpu_get_previouspc(&space.device()), data); + logerror("DSP PC:%04x IO write %04x at port 3\n", space.device().safe_pcbase(), data); if (data & 0x8000) { m_dsp_BIO = CLEAR_LINE; } @@ -164,7 +164,7 @@ static void demonwld_restore_dsp(running_machine &machine) WRITE16_MEMBER(toaplan1_state::demonwld_dsp_ctrl_w) { #if 0 - logerror("68000:%08x Writing %08x to %08x.\n",cpu_get_pc(&space.device()) ,data ,0xe0000a + offset); + logerror("68000:%08x Writing %08x to %08x.\n",space.device().safe_pc() ,data ,0xe0000a + offset); #endif if (ACCESSING_BITS_0_7) @@ -173,12 +173,12 @@ WRITE16_MEMBER(toaplan1_state::demonwld_dsp_ctrl_w) { case 0x00: demonwld_dsp(machine(), 1); break; /* Enable the INT line to the DSP */ case 0x01: demonwld_dsp(machine(), 0); break; /* Inhibit the INT line to the DSP */ - default: logerror("68000:%04x Writing unknown command %08x to %08x\n",cpu_get_previouspc(&space.device()) ,data ,0xe0000a + offset); break; + default: logerror("68000:%04x Writing unknown command %08x to %08x\n",space.device().safe_pcbase() ,data ,0xe0000a + offset); break; } } else { - logerror("68000:%04x Writing unknown command %08x to %08x\n",cpu_get_previouspc(&space.device()) ,data ,0xe0000a + offset); + logerror("68000:%04x Writing unknown command %08x to %08x\n",space.device().safe_pcbase() ,data ,0xe0000a + offset); } } @@ -186,7 +186,7 @@ WRITE16_MEMBER(toaplan1_state::demonwld_dsp_ctrl_w) READ16_MEMBER(toaplan1_state::samesame_port_6_word_r) { /* Bit 0x80 is secondary CPU (HD647180) ready signal */ - logerror("PC:%04x Warning !!! IO reading from $14000a\n",cpu_get_previouspc(&space.device())); + logerror("PC:%04x Warning !!! IO reading from $14000a\n",space.device().safe_pcbase()); return (0x80 | ioport("TJUMP")->read()) & 0xff; } @@ -313,7 +313,7 @@ WRITE16_MEMBER(toaplan1_state::toaplan1_reset_sound) if (ACCESSING_BITS_0_7 && (data == 0)) { - logerror("PC:%04x Resetting Sound CPU and Sound chip (%08x)\n", cpu_get_previouspc(&space.device()), data); + logerror("PC:%04x Resetting Sound CPU and Sound chip (%08x)\n", space.device().safe_pcbase(), data); devtag_reset(machine(), "ymsnd"); device_t *audiocpu = machine().device("audiocpu"); if (audiocpu != NULL && audiocpu->type() == Z80) @@ -334,7 +334,7 @@ WRITE8_MEMBER(toaplan1_state::rallybik_coin_w) case 0x0d: coin_lockout_w(machine(), 0, 0); coin_lockout_w(machine(), 2, 0); break; case 0x0e: coin_lockout_w(machine(), 1, 1); coin_lockout_w(machine(), 3, 1); break; case 0x0f: coin_lockout_w(machine(), 1, 0); coin_lockout_w(machine(), 3, 0); m_coin_count=1; break; - default: logerror("PC:%04x Writing unknown data (%04x) to coin count/lockout port\n",cpu_get_previouspc(&space.device()),data); break; + default: logerror("PC:%04x Writing unknown data (%04x) to coin count/lockout port\n",space.device().safe_pcbase(),data); break; } } @@ -364,7 +364,7 @@ WRITE8_MEMBER(toaplan1_state::toaplan1_coin_w) case 0x02: coin_lockout_w(machine(), 1,1); break; /* Lock coin slot B */ case 0x01: coin_lockout_w(machine(), 0,1); break; /* Lock coin slot A */ case 0x00: coin_lockout_global_w(machine(), 1); break; /* Lock all coin slots */ - default: logerror("PC:%04x Writing unknown data (%04x) to coin count/lockout port\n",cpu_get_previouspc(&space.device()),data); break; + default: logerror("PC:%04x Writing unknown data (%04x) to coin count/lockout port\n",space.device().safe_pcbase(),data); break; } } @@ -376,7 +376,7 @@ WRITE16_MEMBER(toaplan1_state::samesame_coin_w) } if (ACCESSING_BITS_8_15 && (data&0xff00)) { - logerror("PC:%04x Writing unknown MSB data (%04x) to coin count/lockout port\n",cpu_get_previouspc(&space.device()),data); + logerror("PC:%04x Writing unknown MSB data (%04x) to coin count/lockout port\n",space.device().safe_pcbase(),data); } } diff --git a/src/mame/machine/twincobr.c b/src/mame/machine/twincobr.c index 1f5898cd53b..8f890d3c59a 100644 --- a/src/mame/machine/twincobr.c +++ b/src/mame/machine/twincobr.c @@ -46,7 +46,7 @@ WRITE16_MEMBER(twincobr_state::twincobr_dsp_addrsel_w) m_main_ram_seg = ((data & 0xe000) << 3); m_dsp_addr_w = ((data & 0x1fff) << 1); - LOG(("DSP PC:%04x IO write %04x (%08x) at port 0\n",cpu_get_previouspc(&space.device()),data,m_main_ram_seg + m_dsp_addr_w)); + LOG(("DSP PC:%04x IO write %04x (%08x) at port 0\n",space.device().safe_pcbase(),data,m_main_ram_seg + m_dsp_addr_w)); } READ16_MEMBER(twincobr_state::twincobr_dsp_r) @@ -61,9 +61,9 @@ READ16_MEMBER(twincobr_state::twincobr_dsp_r) case 0x50000: mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM); input_data = mainspace->read_word(m_main_ram_seg + m_dsp_addr_w); break; - default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(&space.device()),m_main_ram_seg + m_dsp_addr_w); break; + default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break; } - LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",cpu_get_previouspc(&space.device()),input_data,m_main_ram_seg + m_dsp_addr_w)); + LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",space.device().safe_pcbase(),input_data,m_main_ram_seg + m_dsp_addr_w)); return input_data; } @@ -79,9 +79,9 @@ WRITE16_MEMBER(twincobr_state::twincobr_dsp_w) case 0x50000: mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM); mainspace->write_word(m_main_ram_seg + m_dsp_addr_w, data); break; - default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(&space.device()),m_main_ram_seg + m_dsp_addr_w); break; + default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break; } - LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",cpu_get_previouspc(&space.device()),data,m_main_ram_seg + m_dsp_addr_w)); + LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",space.device().safe_pcbase(),data,m_main_ram_seg + m_dsp_addr_w)); } WRITE16_MEMBER(twincobr_state::wardner_dsp_addrsel_w) @@ -96,7 +96,7 @@ WRITE16_MEMBER(twincobr_state::wardner_dsp_addrsel_w) if (m_main_ram_seg == 0x6000) m_main_ram_seg = 0x7000; - LOG(("DSP PC:%04x IO write %04x (%08x) at port 0\n",cpu_get_previouspc(&space.device()),data,m_main_ram_seg + m_dsp_addr_w)); + LOG(("DSP PC:%04x IO write %04x (%08x) at port 0\n",space.device().safe_pcbase(),data,m_main_ram_seg + m_dsp_addr_w)); } READ16_MEMBER(twincobr_state::wardner_dsp_r) @@ -112,9 +112,9 @@ READ16_MEMBER(twincobr_state::wardner_dsp_r) input_data = mainspace->read_byte(m_main_ram_seg + (m_dsp_addr_w + 0)) | (mainspace->read_byte(m_main_ram_seg + (m_dsp_addr_w + 1)) << 8); break; - default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(&space.device()),m_main_ram_seg + m_dsp_addr_w); break; + default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break; } - LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",cpu_get_previouspc(&space.device()),input_data,m_main_ram_seg + m_dsp_addr_w)); + LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",space.device().safe_pcbase(),input_data,m_main_ram_seg + m_dsp_addr_w)); return input_data; } @@ -131,9 +131,9 @@ WRITE16_MEMBER(twincobr_state::wardner_dsp_w) mainspace->write_byte(m_main_ram_seg + (m_dsp_addr_w + 0), (data & 0xff)); mainspace->write_byte(m_main_ram_seg + (m_dsp_addr_w + 1), ((data >> 8) & 0xff)); break; - default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(&space.device()),m_main_ram_seg + m_dsp_addr_w); break; + default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",space.device().safe_pcbase(),m_main_ram_seg + m_dsp_addr_w); break; } - LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",cpu_get_previouspc(&space.device()),data,m_main_ram_seg + m_dsp_addr_w)); + LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",space.device().safe_pcbase(),data,m_main_ram_seg + m_dsp_addr_w)); } WRITE16_MEMBER(twincobr_state::twincobr_dsp_bio_w) @@ -143,7 +143,7 @@ WRITE16_MEMBER(twincobr_state::twincobr_dsp_bio_w) /* Actually only DSP data bit 15 controls this */ /* data 0x0000 means set DSP BIO line active and disable */ /* communication to main processor*/ - LOG(("DSP PC:%04x IO write %04x at port 3\n",cpu_get_previouspc(&space.device()),data)); + LOG(("DSP PC:%04x IO write %04x at port 3\n",space.device().safe_pcbase(),data)); if (data & 0x8000) { m_dsp_BIO = CLEAR_LINE; } @@ -164,7 +164,7 @@ READ16_MEMBER(twincobr_state::fsharkbt_dsp_r) /* Port is read three times during startup. First and last data */ /* read must equal, but second data read must be different */ m_fsharkbt_8741 += 1; - LOG(("DSP PC:%04x IO read %04x from 8741 MCU (port 2)\n",cpu_get_previouspc(&space.device()),(m_fsharkbt_8741 & 0x08))); + LOG(("DSP PC:%04x IO read %04x from 8741 MCU (port 2)\n",space.device().safe_pcbase(),(m_fsharkbt_8741 & 0x08))); return (m_fsharkbt_8741 & 1); } @@ -172,7 +172,7 @@ WRITE16_MEMBER(twincobr_state::fsharkbt_dsp_w) { /* Flying Shark bootleg DSP writes data to an extra MCU (8741) at IO port 2 */ #if 0 - logerror("DSP PC:%04x IO write from DSP RAM:%04x to 8741 MCU (port 2)\n",cpu_get_previouspc(&space.device()),m_fsharkbt_8741); + logerror("DSP PC:%04x IO write from DSP RAM:%04x to 8741 MCU (port 2)\n",space.device().safe_pcbase(),m_fsharkbt_8741); #endif } diff --git a/src/mame/machine/tx1.c b/src/mame/machine/tx1.c index e87061bca42..6142cf5f69b 100644 --- a/src/mame/machine/tx1.c +++ b/src/mame/machine/tx1.c @@ -368,7 +368,7 @@ static void kick_sn74s516(running_machine &machine, UINT16 *data, const int ins) } math.dbgaddr = math.promaddr; - math.dbgpc = cpu_get_previouspc(machine.device("math_cpu")); + math.dbgpc = machine.device("math_cpu")->safe_pcbase(); } diff --git a/src/mame/machine/volfied.c b/src/mame/machine/volfied.c index 5e1aab9f2a4..73e45a47a64 100644 --- a/src/mame/machine/volfied.c +++ b/src/mame/machine/volfied.c @@ -344,7 +344,7 @@ WRITE16_MEMBER(volfied_state::volfied_cchip_ram_w) m_cchip_ram[(m_current_bank * 0x400) + offset] = data; // if (offset != 0x8) -// logerror("%08x: volfied c write %04x %04x\n", cpu_get_pc(&space.device()), offset, data); +// logerror("%08x: volfied c write %04x %04x\n", space.device().safe_pc(), offset, data); if (m_current_bank == 0) { @@ -444,8 +444,8 @@ READ16_MEMBER(volfied_state::volfied_cchip_ram_r) } } -// if (cpu_get_pc(&space.device())!=0x15ca8 && cpu_get_pc(&space.device())!=0x15cd8 && cpu_get_pc(&space.device())!=0x15cde) -// logerror("%08x: volfied c read %04x (bank %04x)\n", cpu_get_pc(&space.device()), offset, current_bank); +// if (space.device().safe_pc()!=0x15ca8 && space.device().safe_pc()!=0x15cd8 && space.device().safe_pc()!=0x15cde) +// logerror("%08x: volfied c read %04x (bank %04x)\n", space.device().safe_pc(), offset, current_bank); /* Unknown */ if (m_current_bank == 2 && offset == 0x005) diff --git a/src/mame/machine/xevious.c b/src/mame/machine/xevious.c index 77b6d2b9332..c98b68a65c7 100644 --- a/src/mame/machine/xevious.c +++ b/src/mame/machine/xevious.c @@ -63,7 +63,7 @@ TIMER_DEVICE_CALLBACK( battles_nmi_generate ) READ8_HANDLER( battles_customio0_r ) { - logerror("CPU0 %04x: custom I/O Read = %02x\n",cpu_get_pc(&space->device()),battles_customio_command); + logerror("CPU0 %04x: custom I/O Read = %02x\n",space->device().safe_pc(),battles_customio_command); return battles_customio_command; } @@ -71,7 +71,7 @@ READ8_HANDLER( battles_customio3_r ) { int return_data; - if( cpu_get_pc(&space->device()) == 0xAE ){ + if( space->device().safe_pc() == 0xAE ){ /* CPU4 0xAA - 0xB9 : waiting for MB8851 ? */ return_data = ( (battles_customio_command & 0x10) << 3) | 0x00 @@ -81,7 +81,7 @@ READ8_HANDLER( battles_customio3_r ) | 0x60 | (battles_customio_prev_command & 0x0f); } - logerror("CPU3 %04x: custom I/O Read = %02x\n",cpu_get_pc(&space->device()),return_data); + logerror("CPU3 %04x: custom I/O Read = %02x\n",space->device().safe_pc(),return_data); return return_data; } @@ -91,7 +91,7 @@ WRITE8_HANDLER( battles_customio0_w ) { timer_device *timer = space->machine().device("battles_nmi"); - logerror("CPU0 %04x: custom I/O Write = %02x\n",cpu_get_pc(&space->device()),data); + logerror("CPU0 %04x: custom I/O Write = %02x\n",space->device().safe_pc(),data); battles_customio_command = data; battles_customio_command_count = 0; @@ -108,7 +108,7 @@ WRITE8_HANDLER( battles_customio0_w ) WRITE8_HANDLER( battles_customio3_w ) { - logerror("CPU3 %04x: custom I/O Write = %02x\n",cpu_get_pc(&space->device()),data); + logerror("CPU3 %04x: custom I/O Write = %02x\n",space->device().safe_pc(),data); battles_customio_command = data; } @@ -117,27 +117,27 @@ WRITE8_HANDLER( battles_customio3_w ) READ8_HANDLER( battles_customio_data0_r ) { - logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",cpu_get_pc(&space->device()),offset,battles_customio_data); + logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",space->device().safe_pc(),offset,battles_customio_data); return battles_customio_data; } READ8_HANDLER( battles_customio_data3_r ) { - logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",cpu_get_pc(&space->device()),offset,battles_customio_data); + logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",space->device().safe_pc(),offset,battles_customio_data); return battles_customio_data; } WRITE8_HANDLER( battles_customio_data0_w ) { - logerror("CPU0 %04x: custom I/O parameter %02x Write = %02x\n",cpu_get_pc(&space->device()),offset,data); + logerror("CPU0 %04x: custom I/O parameter %02x Write = %02x\n",space->device().safe_pc(),offset,data); battles_customio_data = data; } WRITE8_HANDLER( battles_customio_data3_w ) { - logerror("CPU3 %04x: custom I/O parameter %02x Write = %02x\n",cpu_get_pc(&space->device()),offset,data); + logerror("CPU3 %04x: custom I/O parameter %02x Write = %02x\n",space->device().safe_pc(),offset,data); battles_customio_data = data; } @@ -155,7 +155,7 @@ WRITE8_HANDLER( battles_CPU4_coin_w ) WRITE8_HANDLER( battles_noise_sound_w ) { - logerror("CPU3 %04x: 50%02x Write = %02x\n",cpu_get_pc(&space->device()),offset,data); + logerror("CPU3 %04x: 50%02x Write = %02x\n",space->device().safe_pc(),offset,data); if( (battles_sound_played == 0) && (data == 0xFF) ){ samples_device *samples = space->machine().device("samples"); if( customio[0] == 0x40 ){ diff --git a/src/mame/video/airbustr.c b/src/mame/video/airbustr.c index 4d51bee1fd6..67d5ca76a18 100644 --- a/src/mame/video/airbustr.c +++ b/src/mame/video/airbustr.c @@ -80,7 +80,7 @@ WRITE8_MEMBER(airbustr_state::airbustr_scrollregs_w) case 0x06: m_bg_scrollx = data; break; case 0x08: m_highbits = ~data; break; // complemented high bits - default: logerror("CPU #2 - port %02X written with %02X - PC = %04X\n", offset, data, cpu_get_pc(&space.device())); + default: logerror("CPU #2 - port %02X written with %02X - PC = %04X\n", offset, data, space.device().safe_pc()); } m_bg_tilemap->set_scrolly(0, ((m_highbits << 5) & 0x100) + m_bg_scrolly); diff --git a/src/mame/video/battlera.c b/src/mame/video/battlera.c index 900a17ddbf8..cbb5e3817ce 100644 --- a/src/mame/video/battlera.c +++ b/src/mame/video/battlera.c @@ -159,7 +159,7 @@ WRITE8_MEMBER(battlera_state::HuC6270_data_w) case 16: case 17: case 18: - logerror("%04x: dma 2 %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: dma 2 %02x\n",space.device().safe_pc(),data); break; case 19: /* SATB */ @@ -221,7 +221,7 @@ WRITE8_MEMBER(battlera_state::HuC6270_data_w) case 16: case 17: case 18: - logerror("%04x: dma 2 %02x\n",cpu_get_pc(&space.device()),data); + logerror("%04x: dma 2 %02x\n",space.device().safe_pc(),data); break; case 19: /* SATB - Sprites */ @@ -230,7 +230,7 @@ WRITE8_MEMBER(battlera_state::HuC6270_data_w) } break; } - logerror("%04x: unknown write to VDC_register %02x (%02x) at %02x\n",cpu_get_pc(&space.device()),m_VDC_register,data,offset); + logerror("%04x: unknown write to VDC_register %02x (%02x) at %02x\n",space.device().safe_pc(),m_VDC_register,data,offset); } /******************************************************************************/ diff --git a/src/mame/video/beathead.c b/src/mame/video/beathead.c index a57ebad7f93..96b7b68ca02 100644 --- a/src/mame/video/beathead.c +++ b/src/mame/video/beathead.c @@ -153,7 +153,7 @@ READ32_MEMBER( beathead_state::hsync_ram_r ) { /* offset 0 is probably write-only */ if (offset == 0) - logerror("%08X:Unexpected HSYNC RAM read at offset 0\n", cpu_get_previouspc(&space.device())); + logerror("%08X:Unexpected HSYNC RAM read at offset 0\n", space.device().safe_pcbase()); /* offset 1 reads the data */ else diff --git a/src/mame/video/bwing.c b/src/mame/video/bwing.c index 8e1cdc29ee5..7091c86f6e4 100644 --- a/src/mame/video/bwing.c +++ b/src/mame/video/bwing.c @@ -119,7 +119,7 @@ WRITE8_MEMBER(bwing_state::bwing_scrollreg_w) m_srbank = data >> 6; #if BW_DEBUG - logerror("(%s)%04x: w=%02x a=%04x f=%d\n", device().tag, cpu_get_pc(&space.device()), data, 0x1b00 + offset, machine().primary_screen->frame_number()); + logerror("(%s)%04x: w=%02x a=%04x f=%d\n", device().tag, space.device().safe_pc(), data, 0x1b00 + offset, machine().primary_screen->frame_number()); #endif break; } diff --git a/src/mame/video/capbowl.c b/src/mame/video/capbowl.c index 81dffe16d23..fb47ac35d1c 100644 --- a/src/mame/video/capbowl.c +++ b/src/mame/video/capbowl.c @@ -107,7 +107,7 @@ WRITE8_MEMBER(capbowl_state::bowlrama_blitter_w) break; default: - logerror("PC=%04X Write to unsupported blitter address %02X Data=%02X\n", cpu_get_pc(&space.device()), offset, data); + logerror("PC=%04X Write to unsupported blitter address %02X Data=%02X\n", space.device().safe_pc(), offset, data); break; } } @@ -138,7 +138,7 @@ READ8_MEMBER(capbowl_state::bowlrama_blitter_r) break; default: - logerror("PC=%04X Read from unsupported blitter address %02X\n", cpu_get_pc(&space.device()), offset); + logerror("PC=%04X Read from unsupported blitter address %02X\n", space.device().safe_pc(), offset); break; } diff --git a/src/mame/video/cischeat.c b/src/mame/video/cischeat.c index 4d67260697d..5b70c2524a2 100644 --- a/src/mame/video/cischeat.c +++ b/src/mame/video/cischeat.c @@ -60,13 +60,13 @@ Note: if MAME_DEBUG is defined, pressing Z or X with: #define SHOW_READ_ERROR(_format_,_offset_)\ {\ popmessage(_format_,_offset_);\ - logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \ + logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \ logerror(_format_ "\n",_offset_);\ } #define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\ {\ popmessage(_format_,_offset_,_data_);\ - logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \ + logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \ logerror(_format_ "\n",_offset_,_data_); \ } @@ -74,12 +74,12 @@ Note: if MAME_DEBUG is defined, pressing Z or X with: #define SHOW_READ_ERROR(_format_,_offset_)\ {\ - logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \ + logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \ logerror(_format_ "\n",_offset_);\ } #define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\ {\ - logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \ + logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \ logerror(_format_ "\n",_offset_,_data_); \ } diff --git a/src/mame/video/cvs.c b/src/mame/video/cvs.c index abaff9eb53a..ac7f701a055 100644 --- a/src/mame/video/cvs.c +++ b/src/mame/video/cvs.c @@ -86,7 +86,7 @@ WRITE8_MEMBER(cvs_state::cvs_video_fx_w) { if (data & 0xce) - logerror("%4x : CVS: Unimplemented CVS video fx = %2x\n",cpu_get_pc(&space.device()), data & 0xce); + logerror("%4x : CVS: Unimplemented CVS video fx = %2x\n",space.device().safe_pc(), data & 0xce); m_stars_on = data & 0x01; diff --git a/src/mame/video/dc.c b/src/mame/video/dc.c index a5b740dd4a3..51acd9399de 100644 --- a/src/mame/video/dc.c +++ b/src/mame/video/dc.c @@ -1014,7 +1014,7 @@ READ64_HANDLER( pvr_ta_r ) #if DEBUG_PVRTA_REGS if (reg != 0x43) - mame_printf_verbose("PVRTA: [%08x] read %x @ %x (reg %x), mask %" I64FMT "x (PC=%x)\n", 0x5f8000+reg*4, state->pvrta_regs[reg], offset, reg, mem_mask, cpu_get_pc(&space->device())); + mame_printf_verbose("PVRTA: [%08x] read %x @ %x (reg %x), mask %" I64FMT "x (PC=%x)\n", 0x5f8000+reg*4, state->pvrta_regs[reg], offset, reg, mem_mask, space->device().safe_pc()); #endif return (UINT64)state->pvrta_regs[reg] << shift; } @@ -2739,7 +2739,7 @@ READ32_HANDLER( elan_regs_r ) case 0x78/4: // IRQ MASK return 0; default: - printf("%08x %08x\n",cpu_get_pc(&space->device()),offset*4); + printf("%08x %08x\n",space->device().safe_pc(),offset*4); break; } @@ -2751,7 +2751,7 @@ WRITE32_HANDLER( elan_regs_w ) switch(offset) { default: - printf("%08x %08x %08x W\n",cpu_get_pc(&space->device()),offset*4,data); + printf("%08x %08x %08x W\n",space->device().safe_pc(),offset*4,data); break; } } diff --git a/src/mame/video/dcheese.c b/src/mame/video/dcheese.c index 0cafb066692..9b118c67077 100644 --- a/src/mame/video/dcheese.c +++ b/src/mame/video/dcheese.c @@ -290,7 +290,7 @@ WRITE16_MEMBER(dcheese_state::madmax_blitter_vidparam_w) break; default: - logerror("%06X:write to %06X = %04X & %04x\n", cpu_get_pc(&space.device()), 0x2a0000 + 2 * offset, data, mem_mask); + logerror("%06X:write to %06X = %04X & %04x\n", space.device().safe_pc(), 0x2a0000 + 2 * offset, data, mem_mask); break; } } @@ -299,7 +299,7 @@ WRITE16_MEMBER(dcheese_state::madmax_blitter_vidparam_w) WRITE16_MEMBER(dcheese_state::madmax_blitter_unknown_w) { /* written to just before the blitter command register is written */ - logerror("%06X:write to %06X = %04X & %04X\n", cpu_get_pc(&space.device()), 0x300000 + 2 * offset, data, mem_mask); + logerror("%06X:write to %06X = %04X & %04X\n", space.device().safe_pc(), 0x300000 + 2 * offset, data, mem_mask); } @@ -316,6 +316,6 @@ READ16_MEMBER(dcheese_state::madmax_blitter_vidparam_r) return 0xffff ^ (1 << 5); /* log everything else */ - logerror("%06X:read from %06X\n", cpu_get_pc(&space.device()), 0x2a0000 + 2 * offset); + logerror("%06X:read from %06X\n", space.device().safe_pc(), 0x2a0000 + 2 * offset); return 0xffff; } diff --git a/src/mame/video/dogfgt.c b/src/mame/video/dogfgt.c index b931095f8a5..ec85ca26a08 100644 --- a/src/mame/video/dogfgt.c +++ b/src/mame/video/dogfgt.c @@ -167,7 +167,7 @@ WRITE8_MEMBER(dogfgt_state::dogfgt_1800_w) flip_screen_set(data & 0x80); /* other bits unused? */ - logerror("PC %04x: 1800 = %02x\n", cpu_get_pc(&space.device()), data); + logerror("PC %04x: 1800 = %02x\n", space.device().safe_pc(), data); } diff --git a/src/mame/video/dooyong.c b/src/mame/video/dooyong.c index 0f129675a7c..3257ee6d3b5 100644 --- a/src/mame/video/dooyong.c +++ b/src/mame/video/dooyong.c @@ -149,7 +149,7 @@ WRITE8_MEMBER(dooyong_state::primella_ctrl_w) /* bit 5 used but unknown */ -// logerror("%04x: bankswitch = %02x\n",cpu_get_pc(&space.device()),data&0xe0); +// logerror("%04x: bankswitch = %02x\n",space.device().safe_pc(),data&0xe0); } WRITE8_MEMBER(dooyong_state::paletteram_flytiger_w) diff --git a/src/mame/video/dynax.c b/src/mame/video/dynax.c index a6fbeab37dd..ada6d6b9388 100644 --- a/src/mame/video/dynax.c +++ b/src/mame/video/dynax.c @@ -238,7 +238,7 @@ WRITE8_MEMBER(dynax_state::dynax_flipscreen_w) { m_flipscreen = data & 1; if (data & ~1) - logerror("CPU#0 PC %06X: Warning, flip screen <- %02X\n", cpu_get_pc(&space.device()), data); + logerror("CPU#0 PC %06X: Warning, flip screen <- %02X\n", space.device().safe_pc(), data); LOG(("F=%02X ", data)); } diff --git a/src/mame/video/flstory.c b/src/mame/video/flstory.c index 4a6473b8d40..9d8eb8be2a4 100644 --- a/src/mame/video/flstory.c +++ b/src/mame/video/flstory.c @@ -128,7 +128,7 @@ WRITE8_MEMBER(flstory_state::flstory_gfxctrl_w) flip_screen_set(m_flipscreen); -//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(&space.device()), data); +//popmessage("%04x: gfxctrl = %02x\n", space.device().safe_pc(), data); } @@ -151,7 +151,7 @@ WRITE8_MEMBER(flstory_state::victnine_gfxctrl_w) flip_screen_set(m_flipscreen); } -//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(&space.device()), data); +//popmessage("%04x: gfxctrl = %02x\n", space.device().safe_pc(), data); } diff --git a/src/mame/video/galivan.c b/src/mame/video/galivan.c index 4a8e2e9c6af..d4f53bff6d8 100644 --- a/src/mame/video/galivan.c +++ b/src/mame/video/galivan.c @@ -229,7 +229,7 @@ WRITE8_MEMBER(galivan_state::galivan_gfxbank_w) /* bit 7 selects one of two ROM banks for c000-dfff */ membank("bank1")->set_entry((data & 0x80) >> 7); - /* logerror("Address: %04X - port 40 = %02x\n", cpu_get_pc(&space.device()), data); */ + /* logerror("Address: %04X - port 40 = %02x\n", space.device().safe_pc(), data); */ } WRITE8_MEMBER(galivan_state::ninjemak_gfxbank_w) diff --git a/src/mame/video/galpani2.c b/src/mame/video/galpani2.c index bdd6e243061..d85e329631c 100644 --- a/src/mame/video/galpani2.c +++ b/src/mame/video/galpani2.c @@ -32,7 +32,7 @@ INLINE UINT16 galpani2_bg8_regs_r(address_space *space, offs_t offset, int n) { case 0x16: return space->machine().rand() & 1; default: - logerror("CPU #0 PC %06X : Warning, bg8 #%d screen reg %04X read\n",cpu_get_pc(space->cpu),_n_,offset*2); + logerror("CPU #0 PC %06X : Warning, bg8 #%d screen reg %04X read\n",space->cpu->safe_pc(),_n_,offset*2); } return state->m_bg8_regs[_n_][offset]; } diff --git a/src/mame/video/ginganin.c b/src/mame/video/ginganin.c index 3837bad1f17..407dc2c1afc 100644 --- a/src/mame/video/ginganin.c +++ b/src/mame/video/ginganin.c @@ -178,7 +178,7 @@ WRITE16_MEMBER(ginganin_state::ginganin_vregs16_w) device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE); break; default: - logerror("CPU #0 PC %06X : Warning, videoreg %04X <- %04X\n", cpu_get_pc(&space.device()), offset, data); + logerror("CPU #0 PC %06X : Warning, videoreg %04X <- %04X\n", space.device().safe_pc(), offset, data); } } diff --git a/src/mame/video/gticlub.c b/src/mame/video/gticlub.c index 7146d517036..10d2a02a6bb 100644 --- a/src/mame/video/gticlub.c +++ b/src/mame/video/gticlub.c @@ -390,7 +390,7 @@ READ32_HANDLER( K001005_r ) } default: - mame_printf_debug("K001005_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space->device())); + mame_printf_debug("K001005_r: %08X, %08X at %08X\n", offset, mem_mask, space->device().safe_pc()); break; } return 0; @@ -421,7 +421,7 @@ WRITE32_HANDLER( K001005_w ) sharc_set_flag_input(space->machine().device("dsp"), 1, ASSERT_LINE); } - // mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, cpu_get_pc(&space->device())); + // mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, space->device().safe_pc()); K001005_fifo[K001005_fifo_write_ptr] = data; K001005_fifo_write_ptr++; K001005_fifo_write_ptr &= 0x7ff; @@ -446,13 +446,13 @@ WRITE32_HANDLER( K001005_w ) #endif // !!! HACK to get past the FIFO B test (GTI Club & Thunder Hurricane) !!! - if (cpu_get_pc(&space->device()) == 0x201ee) + if (space->device().safe_pc() == 0x201ee) { // This is used to make the SHARC timeout device_spin_until_trigger(&space->device(), 10000); } // !!! HACK to get past the FIFO B test (Winding Heat & Midnight Run) !!! - if (cpu_get_pc(&space->device()) == 0x201e6) + if (space->device().safe_pc() == 0x201e6) { // This is used to make the SHARC timeout device_spin_until_trigger(&space->device(), 10000); @@ -545,7 +545,7 @@ WRITE32_HANDLER( K001005_w ) break; default: - //mame_printf_debug("K001005_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device())); + //mame_printf_debug("K001005_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space->device().safe_pc()); break; } diff --git a/src/mame/video/hexion.c b/src/mame/video/hexion.c index e6d8de44bc8..5b54ada764f 100644 --- a/src/mame/video/hexion.c +++ b/src/mame/video/hexion.c @@ -82,7 +82,7 @@ WRITE8_MEMBER(hexion_state::hexion_bankswitch_w) if (data & 0x30) popmessage("bankswitch %02x",data&0xf0); -//logerror("%04x: bankswitch_w %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: bankswitch_w %02x\n",space.device().safe_pc(),data); } READ8_MEMBER(hexion_state::hexion_bankedram_r) @@ -101,7 +101,7 @@ READ8_MEMBER(hexion_state::hexion_bankedram_r) } else { -//logerror("%04x: bankedram_r offset %04x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,m_bankctrl); +//logerror("%04x: bankedram_r offset %04x, bankctrl = %02x\n",space.device().safe_pc(),offset,m_bankctrl); return 0; } } @@ -110,43 +110,43 @@ WRITE8_MEMBER(hexion_state::hexion_bankedram_w) { if (m_bankctrl == 3 && offset == 0 && (data & 0xfe) == 0) { -//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl); +//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl); m_rambank = data & 1; } else if (m_bankctrl == 0) { if (m_pmcbank) { -//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl); +//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl); m_vram[m_rambank][offset] = data; m_bg_tilemap[m_rambank]->mark_tile_dirty(offset/4); } else - logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data); + logerror("%04x pmc internal ram %04x = %02x\n",space.device().safe_pc(),offset,data); } else if (m_bankctrl == 2 && offset < 0x800) { if (m_pmcbank) { -//logerror("%04x: unkram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl); +//logerror("%04x: unkram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl); m_unkram[offset] = data; } else - logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data); + logerror("%04x pmc internal ram %04x = %02x\n",space.device().safe_pc(),offset,data); } else -logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl); +logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl); } WRITE8_MEMBER(hexion_state::hexion_bankctrl_w) { -//logerror("%04x: bankctrl_w %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: bankctrl_w %02x\n",space.device().safe_pc(),data); m_bankctrl = data; } WRITE8_MEMBER(hexion_state::hexion_gfxrom_select_w) { -//logerror("%04x: gfxrom_select_w %02x\n",cpu_get_pc(&space.device()),data); +//logerror("%04x: gfxrom_select_w %02x\n",space.device().safe_pc(),data); m_gfxrom_select = data; } diff --git a/src/mame/video/homedata.c b/src/mame/video/homedata.c index 322eb4f2d0f..a6b380b0e16 100644 --- a/src/mame/video/homedata.c +++ b/src/mame/video/homedata.c @@ -714,7 +714,7 @@ WRITE8_MEMBER(homedata_state::reikaids_videoram_w) WRITE8_MEMBER(homedata_state::reikaids_gfx_bank_w) { -//logerror( "%04x: [setbank %02x]\n",cpu_get_pc(&space.device()),data); +//logerror( "%04x: [setbank %02x]\n",space.device().safe_pc(),data); if (m_gfx_bank[m_reikaids_which] != data) { @@ -727,7 +727,7 @@ WRITE8_MEMBER(homedata_state::reikaids_gfx_bank_w) WRITE8_MEMBER(homedata_state::pteacher_gfx_bank_w) { -// logerror("%04x: gfxbank:=%02x\n", cpu_get_pc(&space.device()), data); +// logerror("%04x: gfxbank:=%02x\n", space.device().safe_pc(), data); if (m_gfx_bank[0] != data) { m_gfx_bank[0] = data; @@ -737,7 +737,7 @@ WRITE8_MEMBER(homedata_state::pteacher_gfx_bank_w) WRITE8_MEMBER(homedata_state::homedata_blitter_param_w) { -//logerror("%04x: blitter_param_w %02x\n", cpu_get_pc(&space.device()), data); +//logerror("%04x: blitter_param_w %02x\n", space.device().safe_pc(), data); m_blitter_param[m_blitter_param_count] = data; m_blitter_param_count++; m_blitter_param_count &= 3; diff --git a/src/mame/video/itech8.c b/src/mame/video/itech8.c index dfdab00b9f2..98d12bcd673 100644 --- a/src/mame/video/itech8.c +++ b/src/mame/video/itech8.c @@ -203,7 +203,7 @@ WRITE8_MEMBER(itech8_state::itech8_palette_w) WRITE8_MEMBER(itech8_state::itech8_page_w) { machine().primary_screen->update_partial(machine().primary_screen->vpos()); - logerror("%04x:display_page = %02X (%d)\n", cpu_get_pc(&space.device()), data, machine().primary_screen->vpos()); + logerror("%04x:display_page = %02X (%d)\n", space.device().safe_pc(), data, machine().primary_screen->vpos()); m_page_select = data; } @@ -444,7 +444,7 @@ READ8_MEMBER(itech8_state::itech8_blitter_r) static const char *const portnames[] = { "AN_C", "AN_D", "AN_E", "AN_F" }; /* debugging */ - if (FULL_LOGGING) logerror("%04x:blitter_r(%02x)\n", cpu_get_previouspc(&space.device()), offset / 2); + if (FULL_LOGGING) logerror("%04x:blitter_r(%02x)\n", space.device().safe_pcbase(), offset / 2); /* low bit seems to be ignored */ offset /= 2; @@ -507,7 +507,7 @@ WRITE8_MEMBER(itech8_state::itech8_blitter_w) } /* debugging */ - if (FULL_LOGGING) logerror("%04x:blitter_w(%02x)=%02x\n", cpu_get_previouspc(&space.device()), offset, data); + if (FULL_LOGGING) logerror("%04x:blitter_w(%02x)=%02x\n", space.device().safe_pcbase(), offset, data); } diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c index 29da4e07e5a..f68c9746c37 100644 --- a/src/mame/video/jaguar.c +++ b/src/mame/video/jaguar.c @@ -539,7 +539,7 @@ READ32_MEMBER( jaguar_state::blitter_r ) return m_blitter_status & 3; default: - logerror("%08X:Blitter read register @ F022%02X\n", cpu_get_previouspc(&space.device()), offset * 4); + logerror("%08X:Blitter read register @ F022%02X\n", space.device().safe_pcbase(), offset * 4); return 0; } } @@ -556,7 +556,7 @@ WRITE32_MEMBER( jaguar_state::blitter_w ) } if (LOG_BLITTER_WRITE) - logerror("%08X:Blitter write register @ F022%02X = %08X\n", cpu_get_previouspc(&space.device()), offset * 4, data); + logerror("%08X:Blitter write register @ F022%02X = %08X\n", space.device().safe_pcbase(), offset * 4, data); } @@ -570,7 +570,7 @@ WRITE32_MEMBER( jaguar_state::blitter_w ) READ16_MEMBER( jaguar_state::tom_regs_r ) { if (offset != INT1 && offset != INT2 && offset != HC && offset != VC) - logerror("%08X:TOM read register @ F00%03X\n", cpu_get_previouspc(&space.device()), offset * 2); + logerror("%08X:TOM read register @ F00%03X\n", space.device().safe_pcbase(), offset * 2); switch (offset) { @@ -669,7 +669,7 @@ WRITE16_MEMBER( jaguar_state::tom_regs_w ) } if (offset != INT2 && offset != VI && offset != INT1) - logerror("%08X:TOM write register @ F00%03X = %04X\n", cpu_get_previouspc(&space.device()), offset * 2, data); + logerror("%08X:TOM write register @ F00%03X = %04X\n", space.device().safe_pcbase(), offset * 2, data); } diff --git a/src/mame/video/kaneko_grap2.c b/src/mame/video/kaneko_grap2.c index 7eb98406240..9fffc2f1f5a 100644 --- a/src/mame/video/kaneko_grap2.c +++ b/src/mame/video/kaneko_grap2.c @@ -81,7 +81,7 @@ READ16_MEMBER(kaneko_grap2_device::galpani3_regs1_r) } default: - logerror("cpu '%s' (PC=%06X): galpani3_regs1_r %02x %04x\n", space.device().tag(), cpu_get_previouspc(&space.device()), offset, mem_mask); + logerror("cpu '%s' (PC=%06X): galpani3_regs1_r %02x %04x\n", space.device().tag(), space.device().safe_pcbase(), offset, mem_mask); break; } diff --git a/src/mame/video/kaneko_spr.c b/src/mame/video/kaneko_spr.c index 98bf5f7af59..2739eb62ab2 100644 --- a/src/mame/video/kaneko_spr.c +++ b/src/mame/video/kaneko_spr.c @@ -535,7 +535,7 @@ WRITE16_MEMBER(kaneko16_sprite_device::kaneko16_sprites_regs_w) break; } -// logerror("CPU #0 PC %06X : Warning, sprites reg %04X <- %04X\n",cpu_get_pc(&space.device()),offset*2,data); +// logerror("CPU #0 PC %06X : Warning, sprites reg %04X <- %04X\n",space.device().safe_pc(),offset*2,data); } diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c index b70af100aea..b6791a62343 100644 --- a/src/mame/video/konamiic.c +++ b/src/mame/video/konamiic.c @@ -1463,7 +1463,7 @@ READ16_HANDLER( K055673_GX6bpp_rom_word_r ) case 7: return ROM[romofs+2]; default: - LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, cpu_get_pc(&space->device()))); + LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, space->device().safe_pc())); break; } @@ -1666,7 +1666,7 @@ static UINT8 K054000_ram[0x20]; static WRITE8_HANDLER( K054000_w ) { -//logerror("%04x: write %02x to 054000 address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("%04x: write %02x to 054000 address %02x\n",space->device().safe_pc(),data,offset); K054000_ram[offset] = data; } @@ -1676,7 +1676,7 @@ static READ8_HANDLER( K054000_r ) int Acx,Acy,Aax,Aay; int Bcx,Bcy,Bax,Bay; -//logerror("%04x: read 054000 address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("%04x: read 054000 address %02x\n",space->device().safe_pc(),offset); if (offset != 0x18) return 0; @@ -2265,7 +2265,7 @@ READ32_HANDLER( K056832_5bpp_rom_long_r ) } else { - LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask)); + LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask)); } return 0; } @@ -2290,7 +2290,7 @@ READ32_HANDLER( K056832_6bpp_rom_long_r ) } else { - LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask)); + LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask)); } return 0; } diff --git a/src/mame/video/konicdev.c b/src/mame/video/konicdev.c index 115869e0b8c..b25ae638ba6 100644 --- a/src/mame/video/konicdev.c +++ b/src/mame/video/konicdev.c @@ -2299,7 +2299,7 @@ READ8_DEVICE_HANDLER( k052109_r ) else if (offset >= 0x3a00 && offset < 0x3c00) { /* B x scroll */ } // else -//logerror("%04x: read from unknown 052109 address %04x\n",cpu_get_pc(&space->device()),offset); +//logerror("%04x: read from unknown 052109 address %04x\n",space->device().safe_pc(),offset); } return k052109->ram[offset]; @@ -2323,7 +2323,7 @@ READ8_DEVICE_HANDLER( k052109_r ) addr = (code << 5) + (offset & 0x1f); addr &= device->machine().root_device().memregion(k052109->memory_region)->bytes() - 1; -// logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", cpu_get_pc(&space->device()), offset, k052109->romsubbank, bank, addr); +// logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", space->device().safe_pc(), offset, k052109->romsubbank, bank, addr); return device->machine().root_device().memregion(k052109->memory_region)->base()[addr]; } @@ -2354,13 +2354,13 @@ WRITE8_DEVICE_HANDLER( k052109_w ) if (k052109->scrollctrl != data) { //popmessage("scrollcontrol = %02x", data); -//logerror("%04x: rowscrollcontrol = %02x\n", cpu_get_pc(&space->device()), data); +//logerror("%04x: rowscrollcontrol = %02x\n", space->device().safe_pc(), data); k052109->scrollctrl = data; } } else if (offset == 0x1d00) { -//logerror("%04x: 052109 register 1d00 = %02x\n", cpu_get_pc(&space->device()), data); +//logerror("%04x: 052109 register 1d00 = %02x\n", space->device().safe_pc(), data); /* bit 2 = irq enable */ /* the custom chip can also generate NMI and FIRQ, for use with a 6809 */ k052109->irq_enabled = data & 0x04; @@ -2393,12 +2393,12 @@ WRITE8_DEVICE_HANDLER( k052109_w ) } else if (offset == 0x1e00 || offset == 0x3e00) // Surprise Attack uses offset 0x3e00 { -//logerror("%04x: 052109 register 1e00 = %02x\n",cpu_get_pc(&space->device()),data); +//logerror("%04x: 052109 register 1e00 = %02x\n",space->device().safe_pc(),data); k052109->romsubbank = data; } else if (offset == 0x1e80) { -//if ((data & 0xfe)) logerror("%04x: 052109 register 1e80 = %02x\n",cpu_get_pc(&space->device()),data); +//if ((data & 0xfe)) logerror("%04x: 052109 register 1e80 = %02x\n",space->device().safe_pc(),data); k052109->tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); k052109->tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); k052109->tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); @@ -2453,7 +2453,7 @@ WRITE8_DEVICE_HANDLER( k052109_w ) k052109->charrombank_2[3] = (data >> 4) & 0x0f; } // else -// logerror("%04x: write %02x to unknown 052109 address %04x\n",cpu_get_pc(&space->device()),data,offset); +// logerror("%04x: write %02x to unknown 052109 address %04x\n",space->device().safe_pc(),data,offset); } } @@ -3009,7 +3009,7 @@ READ8_DEVICE_HANDLER( k051937_r ) /* some games need bit 0 to pulse */ return (k051960->k051937_counter++) & 1; } - //logerror("%04x: read unknown 051937 address %x\n", cpu_get_pc(device->cpu), offset); + //logerror("%04x: read unknown 051937 address %x\n", device->cpu->safe_pc(), offset); return 0; } @@ -3040,12 +3040,12 @@ WRITE8_DEVICE_HANDLER( k051937_w ) /* bit 5 = enable gfx ROM reading */ k051960->readroms = data & 0x20; - //logerror("%04x: write %02x to 051937 address %x\n", cpu_get_pc(machine.cpu), data, offset); + //logerror("%04x: write %02x to 051937 address %x\n", machine.cpu->safe_pc(), data, offset); } else if (offset == 1) { -// popmessage("%04x: write %02x to 051937 address %x", cpu_get_pc(machine.cpu), data, offset); -//logerror("%04x: write %02x to unknown 051937 address %x\n", cpu_get_pc(machine.cpu), data, offset); +// popmessage("%04x: write %02x to 051937 address %x", machine.cpu->safe_pc(), data, offset); +//logerror("%04x: write %02x to unknown 051937 address %x\n", machine.cpu->safe_pc(), data, offset); } else if (offset >= 2 && offset < 5) { @@ -3053,8 +3053,8 @@ WRITE8_DEVICE_HANDLER( k051937_w ) } else { - // popmessage("%04x: write %02x to 051937 address %x", cpu_get_pc(machine.cpu), data, offset); - //logerror("%04x: write %02x to unknown 051937 address %x\n", cpu_get_pc(machine.cpu), data, offset); + // popmessage("%04x: write %02x to 051937 address %x", machine.cpu->safe_pc(), data, offset); + //logerror("%04x: write %02x to unknown 051937 address %x\n", machine.cpu->safe_pc(), data, offset); } } @@ -4542,7 +4542,7 @@ READ16_DEVICE_HANDLER( k055673_GX6bpp_rom_word_r ) case 7: return ROM[romofs + 2]; default: -// LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, cpu_get_pc(&space->device()))); +// LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, space->device().safe_pc())); break; } @@ -4559,12 +4559,12 @@ READ8_DEVICE_HANDLER( k053246_r ) addr = (k053246->kx46_regs[6] << 17) | (k053246->kx46_regs[7] << 9) | (k053246->kx46_regs[4] << 1) | ((offset & 1) ^ 1); addr &= device->machine().root_device().memregion(k053246->memory_region)->bytes() - 1; // if (VERBOSE) -// popmessage("%04x: offset %02x addr %06x", cpu_get_pc(&space->device()), offset, addr); +// popmessage("%04x: offset %02x addr %06x", space->device().safe_pc(), offset, addr); return device->machine().root_device().memregion(k053246->memory_region)->base()[addr]; } else { -// LOG(("%04x: read from unknown 053246 address %x\n", cpu_get_pc(&space->device()), offset)); +// LOG(("%04x: read from unknown 053246 address %x\n", space->device().safe_pc(), offset)); return 0; } } @@ -6175,7 +6175,7 @@ WRITE8_DEVICE_HANDLER( k054000_w ) { k054000_state *k054000 = k054000_get_safe_token(device); - //logerror("%04x: write %02x to 054000 address %02x\n",cpu_get_pc(&space->device()),data,offset); + //logerror("%04x: write %02x to 054000 address %02x\n",space->device().safe_pc(),data,offset); k054000->regs[offset] = data; } @@ -6185,7 +6185,7 @@ READ8_DEVICE_HANDLER( k054000_r ) int Acx, Acy, Aax, Aay; int Bcx, Bcy, Bax, Bay; - //logerror("%04x: read 054000 address %02x\n", cpu_get_pc(&space->device()), offset); + //logerror("%04x: read 054000 address %02x\n", space->device().safe_pc(), offset); if (offset != 0x18) return 0; @@ -6322,7 +6322,7 @@ INLINE k051733_state *k051733_get_safe_token( device_t *device ) WRITE8_DEVICE_HANDLER( k051733_w ) { k051733_state *k051733= k051733_get_safe_token(device); - //logerror("%04x: write %02x to 051733 address %02x\n", cpu_get_pc(&space->device()), data, offset); + //logerror("%04x: write %02x to 051733 address %02x\n", space->device().safe_pc(), data, offset); k051733->ram[offset] = data; } @@ -6853,7 +6853,7 @@ READ16_DEVICE_HANDLER( k056832_5bpp_rom_word_r ) return k056832_rom_read_b(device, offset * 2 + 1, 4, 5, 0)<<16; else { - //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask)); + //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask)); } return 0; } @@ -6870,7 +6870,7 @@ READ32_DEVICE_HANDLER( k056832_5bpp_rom_long_r ) return k056832_rom_read_b(device, offset * 4 + 3, 4, 5, 1); else { - //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask)); + //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask)); } return 0; } @@ -6887,7 +6887,7 @@ READ32_DEVICE_HANDLER( k056832_6bpp_rom_long_r ) return k056832_rom_read_b(device, offset * 4 + 3, 4, 6, 0); else { - //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask)); + //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask)); } return 0; } @@ -9383,7 +9383,7 @@ READ32_DEVICE_HANDLER( k001005_r ) } default: - //mame_printf_debug("k001005->r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space->device())); + //mame_printf_debug("k001005->r: %08X, %08X at %08X\n", offset, mem_mask, space->device().safe_pc()); break; } return 0; @@ -9416,7 +9416,7 @@ WRITE32_DEVICE_HANDLER( k001005_w ) sharc_set_flag_input(k001005->dsp, 1, ASSERT_LINE); } - // mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, cpu_get_pc(&space->device())); + // mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, space->device().safe_pc()); k001005->fifo[k001005->fifo_write_ptr] = data; k001005->fifo_write_ptr++; k001005->fifo_write_ptr &= 0x7ff; @@ -9424,13 +9424,13 @@ WRITE32_DEVICE_HANDLER( k001005_w ) k001005->_3d_fifo[k001005->_3d_fifo_ptr++] = data; // !!! HACK to get past the FIFO B test (GTI Club & Thunder Hurricane) !!! - if (cpu_get_pc(k001005->cpu) == 0x201ee) + if (k001005->cpu->safe_pc() == 0x201ee) { // This is used to make the SHARC timeout device_spin_until_trigger(k001005->cpu, 10000); } // !!! HACK to get past the FIFO B test (Winding Heat & Midnight Run) !!! - if (cpu_get_pc(k001005->cpu) == 0x201e6) + if (k001005->cpu->safe_pc() == 0x201e6) { // This is used to make the SHARC timeout device_spin_until_trigger(k001005->cpu, 10000); @@ -9480,7 +9480,7 @@ WRITE32_DEVICE_HANDLER( k001005_w ) break; default: - //mame_printf_debug("k001005->w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device())); + //mame_printf_debug("k001005->w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space->device().safe_pc()); break; } @@ -10494,7 +10494,7 @@ WRITE32_DEVICE_HANDLER( k001604_reg_w ) if (offset != 0x08 && offset != 0x09 && offset != 0x0a /*&& offset != 0x17 && offset != 0x18*/) { - //printf("K001604_reg_w (%d), %02X, %08X, %08X at %08X\n", chip, offset, data, mem_mask, cpu_get_pc(&space->device())); + //printf("K001604_reg_w (%d), %02X, %08X, %08X at %08X\n", chip, offset, data, mem_mask, space->device().safe_pc()); } } diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c index a064bd1a55a..ea729b46e66 100644 --- a/src/mame/video/lethalj.c +++ b/src/mame/video/lethalj.c @@ -63,7 +63,7 @@ READ16_MEMBER(lethalj_state::lethalj_gun_r) result = m_guny + 4; break; } -/* logerror("%08X:lethalj_gun_r(%d) = %04X\n", cpu_get_pc(&space.device()), offset, result); */ +/* logerror("%08X:lethalj_gun_r(%d) = %04X\n", space.device().safe_pc(), offset, result); */ return result; } diff --git a/src/mame/video/m107.c b/src/mame/video/m107.c index aa920a8c30e..74b32bcf840 100644 --- a/src/mame/video/m107.c +++ b/src/mame/video/m107.c @@ -372,7 +372,7 @@ WRITE16_MEMBER(m107_state::m107_spritebuffer_w) /* TODO: this register looks a lot more complex than how the game uses it. All of them seems to test various bit combinations during POST. */ -// logerror("%04x: buffered spriteram\n",cpu_get_pc(&space.device())); +// logerror("%04x: buffered spriteram\n",space.device().safe_pc()); m_sprite_display = (!(data & 0x1000)); memcpy(m_buffered_spriteram, m_spriteram, 0x1000); diff --git a/src/mame/video/m92.c b/src/mame/video/m92.c index ad52d4d37ac..04393c0734f 100644 --- a/src/mame/video/m92.c +++ b/src/mame/video/m92.c @@ -84,7 +84,7 @@ WRITE16_MEMBER(m92_state::m92_spritecontrol_w) spriteram to the buffer. It seems safe to assume 1 word can be copied per clock. */ machine().scheduler().timer_set(attotime::from_hz(XTAL_26_66666MHz) * 0x400, FUNC(spritebuffer_callback)); } -// logerror("%04x: m92_spritecontrol_w %08x %08x\n",cpu_get_pc(&space.device()),offset,data); +// logerror("%04x: m92_spritecontrol_w %08x %08x\n",space.device().safe_pc(),offset,data); } WRITE16_MEMBER(m92_state::m92_videocontrol_w) @@ -121,7 +121,7 @@ WRITE16_MEMBER(m92_state::m92_videocontrol_w) /* Access to upper palette bank */ m_palette_bank = (m_videocontrol >> 1) & 1; -// logerror("%04x: m92_videocontrol_w %d = %02x\n",cpu_get_pc(&space.device()),offset,data); +// logerror("%04x: m92_videocontrol_w %d = %02x\n",space.device().safe_pc(),offset,data); } READ16_MEMBER(m92_state::m92_paletteram_r) diff --git a/src/mame/video/mcd212.c b/src/mame/video/mcd212.c index 3e29b11d3ef..a3edcd49a0b 100644 --- a/src/mame/video/mcd212.c +++ b/src/mame/video/mcd212.c @@ -34,7 +34,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } #else diff --git a/src/mame/video/megasys1.c b/src/mame/video/megasys1.c index 4a1593e0308..1c57578c467 100644 --- a/src/mame/video/megasys1.c +++ b/src/mame/video/megasys1.c @@ -202,7 +202,7 @@ static void create_tilemaps(running_machine &machine); #define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\ { \ popmessage(_format_,_offset_,_data_);\ - logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \ + logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \ logerror(_format_,_offset_,_data_);\ logerror("\n");\ } @@ -211,7 +211,7 @@ static void create_tilemaps(running_machine &machine); #define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\ {\ - logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \ + logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \ logerror(_format_,_offset_,_data_); \ logerror("\n");\ } diff --git a/src/mame/video/midvunit.c b/src/mame/video/midvunit.c index 4ef2a4a76a5..8010d57d235 100644 --- a/src/mame/video/midvunit.c +++ b/src/mame/video/midvunit.c @@ -349,7 +349,7 @@ void midvunit_renderer::process_dma_queue() WRITE32_MEMBER(midvunit_state::midvunit_dma_queue_w) { if (LOG_DMA && machine().input().code_pressed(KEYCODE_L)) - logerror("%06X:queue(%X) = %08X\n", cpu_get_pc(&space.device()), m_dma_data_index, data); + logerror("%06X:queue(%X) = %08X\n", space.device().safe_pc(), m_dma_data_index, data); if (m_dma_data_index < 16) m_dma_data[m_dma_data_index++] = data; } @@ -367,7 +367,7 @@ READ32_MEMBER(midvunit_state::midvunit_dma_trigger_r) if (offset) { if (LOG_DMA && machine().input().code_pressed(KEYCODE_L)) - logerror("%06X:trigger\n", cpu_get_pc(&space.device())); + logerror("%06X:trigger\n", space.device().safe_pc()); m_poly->process_dma_queue(); m_dma_data_index = 0; } diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c index 9fa4ab5ea6a..d102122f030 100644 --- a/src/mame/video/midzeus.c +++ b/src/mame/video/midzeus.c @@ -428,11 +428,11 @@ READ32_MEMBER(midzeus_state::zeus_r) if (logit) { if (offset & 1) - logerror("%06X:zeus32_r(%02X) = %08X -- unexpected in 32-bit mode\n", cpu_get_pc(&space.device()), offset, result); + logerror("%06X:zeus32_r(%02X) = %08X -- unexpected in 32-bit mode\n", space.device().safe_pc(), offset, result); else if (offset != 0xe0) - logerror("%06X:zeus32_r(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, result); + logerror("%06X:zeus32_r(%02X) = %08X\n", space.device().safe_pc(), offset, result); else - logerror("%06X:zeus32_r(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, result); + logerror("%06X:zeus32_r(%02X) = %08X\n", space.device().safe_pc(), offset, result); } } @@ -444,7 +444,7 @@ READ32_MEMBER(midzeus_state::zeus_r) else result &= 0xffff; if (logit) - logerror("%06X:zeus16_r(%02X) = %04X\n", cpu_get_pc(&space.device()), offset, result); + logerror("%06X:zeus16_r(%02X) = %04X\n", space.device().safe_pc(), offset, result); } return result; } @@ -462,7 +462,7 @@ WRITE32_MEMBER(midzeus_state::zeus_w) int logit = zeus_enable_logging || ((offset < 0xb0 || offset > 0xb7) && (offset < 0xe0 || offset > 0xe1)); if (logit) - logerror("%06X:zeus_w", cpu_get_pc(&space.device())); + logerror("%06X:zeus_w", space.device().safe_pc()); /* 32-bit mode */ if (zeusbase[0x80] & 0x00020000) diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index 42a87e3bb63..f57eb3d430a 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -426,7 +426,7 @@ READ32_HANDLER( zeus2_r ) #endif if (logit) - logerror("%06X:zeus2_r(%02X)\n", cpu_get_pc(&space->device()), offset); + logerror("%06X:zeus2_r(%02X)\n", space->device().safe_pc(), offset); switch (offset) { @@ -472,7 +472,7 @@ WRITE32_HANDLER( zeus2_w ) offset != 0x40 && offset != 0x41 && offset != 0x48 && offset != 0x49 && offset != 0x4e && offset != 0x50 && offset != 0x51 && offset != 0x57 && offset != 0x58 && offset != 0x59 && offset != 0x5a && offset != 0x5e); if (logit) - logerror("%06X:zeus2_w", cpu_get_pc(&space->device())); + logerror("%06X:zeus2_w", space->device().safe_pc()); zeus_register32_w(space->machine(), offset, data, logit); } diff --git a/src/mame/video/mitchell.c b/src/mame/video/mitchell.c index 40455eebef2..3d123f7a132 100644 --- a/src/mame/video/mitchell.c +++ b/src/mame/video/mitchell.c @@ -139,7 +139,7 @@ READ8_MEMBER(mitchell_state::pang_colorram_r) WRITE8_MEMBER(mitchell_state::pang_gfxctrl_w) { -logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data); +logerror("PC %04x: pang_gfxctrl_w %02x\n",space.device().safe_pc(),data); { #if 0 char baf[40]; @@ -178,7 +178,7 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data); WRITE8_MEMBER(mitchell_state::pangbl_gfxctrl_w) { -logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data); +logerror("PC %04x: pang_gfxctrl_w %02x\n",space.device().safe_pc(),data); { #if 0 char baf[40]; @@ -215,7 +215,7 @@ logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data); WRITE8_MEMBER(mitchell_state::mstworld_gfxctrl_w) { -logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data); +logerror("PC %04x: pang_gfxctrl_w %02x\n",space.device().safe_pc(),data); { char baf[40]; sprintf(baf,"%02x",data); diff --git a/src/mame/video/mjkjidai.c b/src/mame/video/mjkjidai.c index 9dee144db4b..f2bd05964f2 100644 --- a/src/mame/video/mjkjidai.c +++ b/src/mame/video/mjkjidai.c @@ -50,7 +50,7 @@ WRITE8_MEMBER(mjkjidai_state::mjkjidai_ctrl_w) { UINT8 *rom = memregion("maincpu")->base(); -// logerror("%04x: port c0 = %02x\n",cpu_get_pc(&space.device()),data); +// logerror("%04x: port c0 = %02x\n",space.device().safe_pc(),data); /* bit 0 = NMI enable */ m_nmi_mask = data & 1; diff --git a/src/mame/video/othldrby.c b/src/mame/video/othldrby.c index 60482292619..d34a97a13c5 100644 --- a/src/mame/video/othldrby.c +++ b/src/mame/video/othldrby.c @@ -120,7 +120,7 @@ WRITE16_MEMBER(othldrby_state::othldrby_vreg_w) if (m_vreg_addr < OTHLDRBY_VREG_SIZE) m_vreg[m_vreg_addr++] = data; else - popmessage("%06x: VREG OUT OF BOUNDS %04x", cpu_get_pc(&space.device()), m_vreg_addr); + popmessage("%06x: VREG OUT OF BOUNDS %04x", space.device().safe_pc(), m_vreg_addr); } diff --git a/src/mame/video/policetr.c b/src/mame/video/policetr.c index a7598d1d990..2028bd72b25 100644 --- a/src/mame/video/policetr.c +++ b/src/mame/video/policetr.c @@ -143,7 +143,7 @@ WRITE32_MEMBER(policetr_state::policetr_video_w) { /* we assume 4-byte accesses */ if (mem_mask) - logerror("%08X: policetr_video_w access with mask %08X\n", cpu_get_previouspc(&space.device()), mem_mask); + logerror("%08X: policetr_video_w access with mask %08X\n", space.device().safe_pcbase(), mem_mask); /* 4 offsets */ switch (offset) @@ -193,7 +193,7 @@ WRITE32_MEMBER(policetr_state::policetr_video_w) /* log anything else */ default: - logerror("%08X: policetr_video_w(2) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch); + logerror("%08X: policetr_video_w(2) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch); break; } break; @@ -207,7 +207,7 @@ WRITE32_MEMBER(policetr_state::policetr_video_w) /* latch 0x00 is unknown; 0, 1, and 2 get written into the upper 12 bits before rendering */ case 0x00: if (data != (0 << 20) && data != (1 << 20) && data != (2 << 20)) - logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch); + logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch); break; /* latch 0x10 specifies destination bitmap X and Y offsets */ @@ -219,13 +219,13 @@ WRITE32_MEMBER(policetr_state::policetr_video_w) /* latch 0x20 is unknown; either 0xef or 0x100 is written every IRQ4 */ case 0x20: if (data != (0x100 << 12) && data != (0xef << 12)) - logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch); + logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch); break; /* latch 0x40 is unknown; a 0 is written every IRQ4 */ case 0x40: if (data != 0) - logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch); + logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch); break; /* latch 0x50 clears IRQ4 */ @@ -240,7 +240,7 @@ WRITE32_MEMBER(policetr_state::policetr_video_w) /* log anything else */ default: - logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch); + logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch); break; } break; @@ -300,7 +300,7 @@ READ32_MEMBER(policetr_state::policetr_video_r) } /* log anything else */ - logerror("%08X: policetr_video_r with latch %02X\n", cpu_get_previouspc(&space.device()), m_video_latch); + logerror("%08X: policetr_video_r with latch %02X\n", space.device().safe_pcbase(), m_video_latch); return 0; } diff --git a/src/mame/video/scn2674.c b/src/mame/video/scn2674.c index 7e192a388df..5198197a05f 100644 --- a/src/mame/video/scn2674.c +++ b/src/mame/video/scn2674.c @@ -519,19 +519,19 @@ READ16_MEMBER( scn2674_device::mpu4_vid_scn2674_r ) */ case 0: - LOG2674(("Read Irq Register %02x %06x\n",m_scn2674_irq_register,cpu_get_pc(&space.device()))); + LOG2674(("Read Irq Register %02x %06x\n",m_scn2674_irq_register,space.device().safe_pc())); return m_scn2674_irq_register; case 1: - LOG2674(("Read Status Register %02X %06x\n",m_scn2674_status_register,cpu_get_pc(&space.device()))); + LOG2674(("Read Status Register %02X %06x\n",m_scn2674_status_register,space.device().safe_pc())); return m_scn2674_status_register; - case 2: LOG2674(("Read Screen1_l Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen1_l; - case 3: LOG2674(("Read Screen1_h Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen1_h; - case 4: LOG2674(("Read Cursor_l Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_cursor_l; - case 5: LOG2674(("Read Cursor_h Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_cursor_h; - case 6: LOG2674(("Read Screen2_l Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen2_l; - case 7: LOG2674(("Read Screen2_h Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen2_h; + case 2: LOG2674(("Read Screen1_l Register %06x\n",space.device().safe_pc()));return m_scn2674_screen1_l; + case 3: LOG2674(("Read Screen1_h Register %06x\n",space.device().safe_pc()));return m_scn2674_screen1_h; + case 4: LOG2674(("Read Cursor_l Register %06x\n",space.device().safe_pc()));return m_scn2674_cursor_l; + case 5: LOG2674(("Read Cursor_h Register %06x\n",space.device().safe_pc()));return m_scn2674_cursor_h; + case 6: LOG2674(("Read Screen2_l Register %06x\n",space.device().safe_pc()));return m_scn2674_screen2_l; + case 7: LOG2674(("Read Screen2_h Register %06x\n",space.device().safe_pc()));return m_scn2674_screen2_h; } return 0xffff; diff --git a/src/mame/video/segag80r.c b/src/mame/video/segag80r.c index 0fd202ade9c..f31d2ad7869 100644 --- a/src/mame/video/segag80r.c +++ b/src/mame/video/segag80r.c @@ -283,7 +283,7 @@ READ8_MEMBER(segag80r_state::segag80r_video_port_r) { if (offset == 0) { - logerror("%04X:segag80r_video_port_r(%d)\n", cpu_get_pc(&space.device()), offset); + logerror("%04X:segag80r_video_port_r(%d)\n", space.device().safe_pc(), offset); return 0xff; } else @@ -303,7 +303,7 @@ WRITE8_MEMBER(segag80r_state::segag80r_video_port_w) { if (offset == 0) { - logerror("%04X:segag80r_video_port_w(%d) = %02X\n", cpu_get_pc(&space.device()), offset, data); + logerror("%04X:segag80r_video_port_w(%d) = %02X\n", space.device().safe_pc(), offset, data); } else { diff --git a/src/mame/video/seta.c b/src/mame/video/seta.c index 50989864e94..10edd61a92e 100644 --- a/src/mame/video/seta.c +++ b/src/mame/video/seta.c @@ -306,7 +306,7 @@ WRITE16_MEMBER(seta_state::seta_vregs_w) if ( (samples_len > 0x100000) && ((addr+0x40000) <= samples_len) ) memcpy(&rom[0xc0000],&rom[addr],0x40000); else - logerror("PC %06X - Invalid samples bank %02X !\n", cpu_get_pc(&space.device()), new_bank); + logerror("PC %06X - Invalid samples bank %02X !\n", space.device().safe_pc(), new_bank); } else if (samples_len == 0x480000) /* zombraid */ { diff --git a/src/mame/video/seta2.c b/src/mame/video/seta2.c index 99e72fce2b4..ef09a8b33f3 100644 --- a/src/mame/video/seta2.c +++ b/src/mame/video/seta2.c @@ -128,25 +128,25 @@ WRITE16_MEMBER(seta2_state::seta2_vregs_w) COMBINE_DATA(&m_vregs[offset]); if ( m_vregs[offset] != olddata ) - logerror("CPU #0 PC %06X: Video Reg %02X <- %04X\n",cpu_get_pc(&space.device()),offset*2,data); + logerror("CPU #0 PC %06X: Video Reg %02X <- %04X\n",space.device().safe_pc(),offset*2,data); switch( offset*2 ) { case 0x1c: // FLIP SCREEN (myangel) <- this is actually zoom flip_screen_set(data & 1 ); - if (data & ~1) logerror("CPU #0 PC %06X: flip screen unknown bits %04X\n",cpu_get_pc(&space.device()),data); + if (data & ~1) logerror("CPU #0 PC %06X: flip screen unknown bits %04X\n",space.device().safe_pc(),data); break; case 0x2a: // FLIP X (pzlbowl) flip_screen_x_set(data & 1 ); - if (data & ~1) logerror("CPU #0 PC %06X: flipx unknown bits %04X\n",cpu_get_pc(&space.device()),data); + if (data & ~1) logerror("CPU #0 PC %06X: flipx unknown bits %04X\n",space.device().safe_pc(),data); break; case 0x2c: // FLIP Y (pzlbowl) flip_screen_y_set(data & 1 ); - if (data & ~1) logerror("CPU #0 PC %06X: flipy unknown bits %04X\n",cpu_get_pc(&space.device()),data); + if (data & ~1) logerror("CPU #0 PC %06X: flipy unknown bits %04X\n",space.device().safe_pc(),data); break; case 0x30: // BLANK SCREEN (pzlbowl, myangel) - if (data & ~1) logerror("CPU #0 PC %06X: blank unknown bits %04X\n",cpu_get_pc(&space.device()),data); + if (data & ~1) logerror("CPU #0 PC %06X: blank unknown bits %04X\n",space.device().safe_pc(),data); break; } } diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c index 90ca39b8dac..78a20b8d301 100644 --- a/src/mame/video/st0016.c +++ b/src/mame/video/st0016.c @@ -205,7 +205,7 @@ WRITE8_MEMBER(st0016_state::st0016_vregs_w) { /* samples ? sound dma ? */ // speaglsht: unknown DMA copy : src - 2B6740, dst - 4400, len - 1E400 - logerror("unknown DMA copy : src - %X, dst - %X, len - %X, PC - %X\n",srcadr,dstadr,length,cpu_get_previouspc(&space.device())); + logerror("unknown DMA copy : src - %X, dst - %X, len - %X, PC - %X\n",srcadr,dstadr,length,space.device().safe_pcbase()); break; } } diff --git a/src/mame/video/st0020.c b/src/mame/video/st0020.c index 830454ee7ba..7f4c43e791e 100644 --- a/src/mame/video/st0020.c +++ b/src/mame/video/st0020.c @@ -115,7 +115,7 @@ READ16_MEMBER(st0020_device::st0020_blit_r) return 0; } - logerror("CPU #0 PC: %06X - Blit reg read: %02X\n",cpu_get_pc(&space.device()),offset*2); + logerror("CPU #0 PC: %06X - Blit reg read: %02X\n",space.device().safe_pc(),offset*2); return 0; } @@ -137,7 +137,7 @@ WRITE16_MEMBER(st0020_device::st0020_blit_w) case 0x8a/2: { if (data & ~0x43) - logerror("CPU #0 PC: %06X - Unknown st0020_gfxram_bank bit written %04X\n",cpu_get_pc(&space.device()),data); + logerror("CPU #0 PC: %06X - Unknown st0020_gfxram_bank bit written %04X\n",space.device().safe_pc(),data); if (ACCESSING_BITS_0_7) m_st0020_gfxram_bank = data & 3; @@ -162,7 +162,7 @@ WRITE16_MEMBER(st0020_device::st0020_blit_w) if (!rom) { - logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",cpu_get_pc(&space.device()),src,dst,len); + logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",space.device().safe_pc(),src,dst,len); return; } @@ -184,13 +184,13 @@ WRITE16_MEMBER(st0020_device::st0020_blit_w) } else { - logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",cpu_get_pc(&space.device()),src,dst,len); + logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",space.device().safe_pc(),src,dst,len); } } break; default: - logerror("CPU #0 PC: %06X - Blit reg written: %02X <- %04X\n",cpu_get_pc(&space.device()),offset*2,data); + logerror("CPU #0 PC: %06X - Blit reg written: %02X <- %04X\n",space.device().safe_pc(),offset*2,data); } } diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c index 24ee1fd1126..54ac991d630 100644 --- a/src/mame/video/stvvdp1.c +++ b/src/mame/video/stvvdp1.c @@ -168,7 +168,7 @@ READ16_HANDLER( saturn_vdp1_regs_r ) { saturn_state *state = space->machine().driver_data(); - //logerror ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset); + //logerror ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), space->device().safe_pc(), offset); switch(offset) { @@ -194,7 +194,7 @@ READ16_HANDLER( saturn_vdp1_regs_r ) return modr; default: - printf ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset*2); + printf ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), space->device().safe_pc(), offset*2); break; } @@ -346,7 +346,7 @@ WRITE32_HANDLER ( saturn_vdp1_vram_w ) // if (((offset * 4) > 0xdf) && ((offset * 4) < 0x140)) // { -// logerror("cpu %s (PC=%08X): VRAM dword write to %08X = %08X & %08X\n", space->device().tag(), cpu_get_pc(&space->device()), offset*4, data, mem_mask); +// logerror("cpu %s (PC=%08X): VRAM dword write to %08X = %08X & %08X\n", space->device().tag(), space->device().safe_pc(), offset*4, data, mem_mask); // } data = state->m_vdp1_vram[offset]; diff --git a/src/mame/video/suna16.c b/src/mame/video/suna16.c index 93e66cd96bf..730a67012d1 100644 --- a/src/mame/video/suna16.c +++ b/src/mame/video/suna16.c @@ -67,7 +67,7 @@ WRITE16_MEMBER(suna16_state::suna16_flipscreen_w) flip_screen_set(data & 1 ); m_color_bank = ( data & 4 ) >> 2; } - if (data & ~(1|4)) logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~(1|4)) logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", space.device().safe_pc(), data); } WRITE16_MEMBER(suna16_state::bestbest_flipscreen_w) @@ -77,7 +77,7 @@ WRITE16_MEMBER(suna16_state::bestbest_flipscreen_w) flip_screen_set(data & 0x10 ); //m_color_bank = ( data & 0x07 ); } - if (data & ~(0x10)) logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(&space.device()), data); + if (data & ~(0x10)) logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", space.device().safe_pc(), data); } diff --git a/src/mame/video/taito_l.c b/src/mame/video/taito_l.c index e6b8e53820d..5329d8d8d5d 100644 --- a/src/mame/video/taito_l.c +++ b/src/mame/video/taito_l.c @@ -103,7 +103,7 @@ WRITE8_MEMBER(taitol_state::taitol_bankc_w) if (m_bankc[offset] != data) { m_bankc[offset] = data; -// logerror("Bankc %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device())); +// logerror("Bankc %d, %02x (%04x)\n", offset, data, space.device().safe_pc()); m_bg18_tilemap->mark_all_dirty(); m_bg19_tilemap->mark_all_dirty(); @@ -119,7 +119,7 @@ READ8_MEMBER(taitol_state::taitol_bankc_r) WRITE8_MEMBER(taitol_state::taitol_control_w) { -// logerror("Control Write %02x (%04x)\n", data, cpu_get_pc(&space.device())); +// logerror("Control Write %02x (%04x)\n", data, space.device().safe_pc()); m_cur_ctrl = data; //popmessage("%02x",data); @@ -140,7 +140,7 @@ WRITE8_MEMBER(taitol_state::taitol_control_w) READ8_MEMBER(taitol_state::taitol_control_r) { -// logerror("Control Read %02x (%04x)\n", cur_ctrl, cpu_get_pc(&space.device())); +// logerror("Control Read %02x (%04x)\n", cur_ctrl, space.device().safe_pc()); return m_cur_ctrl; } diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c index fc410057bfa..39b29b7805a 100644 --- a/src/mame/video/taitoic.c +++ b/src/mame/video/taitoic.c @@ -4848,7 +4848,7 @@ READ16_DEVICE_HANDLER( tc0110pcr_word_r ) return tc0110pcr->ram[tc0110pcr->addr]; default: -//logerror("PC %06x: warning - read TC0110PCR address %02x\n",cpu_get_pc(&space->device()),offset); +//logerror("PC %06x: warning - read TC0110PCR address %02x\n",space->device().safe_pc(),offset); return 0xff; } } @@ -4872,7 +4872,7 @@ WRITE16_DEVICE_HANDLER( tc0110pcr_word_w ) break; default: -//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",space->device().safe_pc(),data,offset); break; } } @@ -4895,7 +4895,7 @@ WRITE16_DEVICE_HANDLER( tc0110pcr_step1_word_w ) break; default: -//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",space->device().safe_pc(),data,offset); break; } } @@ -4920,7 +4920,7 @@ WRITE16_DEVICE_HANDLER( tc0110pcr_step1_rbswap_word_w ) break; default: -//logerror("PC %06x: warning - write %04x to TC0110PCR offset %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %04x to TC0110PCR offset %02x\n",space->device().safe_pc(),data,offset); break; } } @@ -4945,7 +4945,7 @@ WRITE16_DEVICE_HANDLER( tc0110pcr_step1_4bpg_word_w ) break; default: -//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",cpu_get_pc(&space->device()),data,offset); +//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",space->device().safe_pc(),data,offset); break; } } diff --git a/src/mame/video/tatsumi.c b/src/mame/video/tatsumi.c index 0dfcbe87a0e..da8ca04ae40 100644 --- a/src/mame/video/tatsumi.c +++ b/src/mame/video/tatsumi.c @@ -10,7 +10,7 @@ WRITE16_MEMBER(tatsumi_state::tatsumi_sprite_control_w) /* 0xe0 is bank switch, others unknown */ // if ((offset==0xe0 && data&0xefff) || offset!=0xe0) -// logerror("%08x: Tatsumi TZB215 sprite control %04x %08x\n", cpu_get_pc(&space.device()), offset, data); +// logerror("%08x: Tatsumi TZB215 sprite control %04x %08x\n", space.device().safe_pc(), offset, data); } /******************************************************************************/ @@ -153,7 +153,7 @@ WRITE16_MEMBER(tatsumi_state::roundup5_crt_w) if (offset==1 && ACCESSING_BITS_0_7) { m_roundupt_crt_reg[m_roundupt_crt_selected_reg]=data; // if (m_roundupt_crt_selected_reg!=0xa && m_roundupt_crt_selected_reg!=0xb && m_roundupt_crt_selected_reg!=29) -// logerror("%08x: Crt write %02x %02x\n",cpu_get_pc(&space.device()),m_roundupt_crt_selected_reg,data); +// logerror("%08x: Crt write %02x %02x\n",space.device().safe_pc(),m_roundupt_crt_selected_reg,data); } } diff --git a/src/mame/video/victory.c b/src/mame/video/victory.c index 7acf151b09f..094f416e203 100644 --- a/src/mame/video/victory.c +++ b/src/mame/video/victory.c @@ -132,7 +132,7 @@ READ8_MEMBER(victory_state::victory_video_control_r) { case 0x00: /* 5XFIQ */ result = m_fgcollx; - if (LOG_COLLISION) logerror("%04X:5XFIQ read = %02X\n", cpu_get_previouspc(&space.device()), result); + if (LOG_COLLISION) logerror("%04X:5XFIQ read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x01: /* 5CLFIQ */ @@ -142,12 +142,12 @@ READ8_MEMBER(victory_state::victory_video_control_r) m_fgcoll = 0; victory_update_irq(machine()); } - if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", cpu_get_previouspc(&space.device()), result); + if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x02: /* 5BACKX */ result = m_bgcollx & 0xfc; - if (LOG_COLLISION) logerror("%04X:5BACKX read = %02X\n", cpu_get_previouspc(&space.device()), result); + if (LOG_COLLISION) logerror("%04X:5BACKX read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x03: /* 5BACKY */ @@ -157,7 +157,7 @@ READ8_MEMBER(victory_state::victory_video_control_r) m_bgcoll = 0; victory_update_irq(machine()); } - if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", cpu_get_previouspc(&space.device()), result); + if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", space.device().safe_pcbase(), result); return result; case 0x04: /* 5STAT */ @@ -172,11 +172,11 @@ READ8_MEMBER(victory_state::victory_video_control_r) result |= (~m_vblank_irq & 1) << 5; result |= (~m_bgcoll & 1) << 4; result |= (machine().primary_screen->vpos() & 0x100) >> 5; - if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", cpu_get_previouspc(&space.device()), result); + if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", space.device().safe_pcbase(), result); return result; default: - logerror("%04X:victory_video_control_r(%02X)\n", cpu_get_previouspc(&space.device()), offset); + logerror("%04X:victory_video_control_r(%02X)\n", space.device().safe_pcbase(), offset); break; } return 0; @@ -196,12 +196,12 @@ WRITE8_MEMBER(victory_state::victory_video_control_w) switch (offset) { case 0x00: /* LOAD IL */ - if (LOG_MICROCODE) logerror("%04X:IL=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:IL=%02X\n", space.device().safe_pcbase(), data); micro.i = (micro.i & 0xff00) | (data & 0x00ff); break; case 0x01: /* LOAD IH */ - if (LOG_MICROCODE) logerror("%04X:IH=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:IH=%02X\n", space.device().safe_pcbase(), data); micro.i = (micro.i & 0x00ff) | ((data << 8) & 0xff00); if (micro.cmdlo == 5) { @@ -211,7 +211,7 @@ WRITE8_MEMBER(victory_state::victory_video_control_w) break; case 0x02: /* LOAD CMD */ - if (LOG_MICROCODE) logerror("%04X:CMD=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:CMD=%02X\n", space.device().safe_pcbase(), data); micro.cmd = data; micro.cmdlo = data & 7; if (micro.cmdlo == 0) @@ -226,12 +226,12 @@ WRITE8_MEMBER(victory_state::victory_video_control_w) break; case 0x03: /* LOAD G */ - if (LOG_MICROCODE) logerror("%04X:G=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:G=%02X\n", space.device().safe_pcbase(), data); micro.g = data; break; case 0x04: /* LOAD X */ - if (LOG_MICROCODE) logerror("%04X:X=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:X=%02X\n", space.device().safe_pcbase(), data); micro.xp = data; if (micro.cmdlo == 3) { @@ -241,7 +241,7 @@ WRITE8_MEMBER(victory_state::victory_video_control_w) break; case 0x05: /* LOAD Y */ - if (LOG_MICROCODE) logerror("%04X:Y=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:Y=%02X\n", space.device().safe_pcbase(), data); micro.yp = data; if (micro.cmdlo == 4) { @@ -251,12 +251,12 @@ WRITE8_MEMBER(victory_state::victory_video_control_w) break; case 0x06: /* LOAD R */ - if (LOG_MICROCODE) logerror("%04X:R=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:R=%02X\n", space.device().safe_pcbase(), data); micro.r = data; break; case 0x07: /* LOAD B */ - if (LOG_MICROCODE) logerror("%04X:B=%02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:B=%02X\n", space.device().safe_pcbase(), data); micro.b = data; if (micro.cmdlo == 2) { @@ -271,12 +271,12 @@ WRITE8_MEMBER(victory_state::victory_video_control_w) break; case 0x08: /* SCROLLX */ - if (LOG_MICROCODE) logerror("%04X:SCROLLX write = %02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:SCROLLX write = %02X\n", space.device().safe_pcbase(), data); m_scrollx = data; break; case 0x09: /* SCROLLY */ - if (LOG_MICROCODE) logerror("%04X:SCROLLY write = %02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:SCROLLY write = %02X\n", space.device().safe_pcbase(), data); m_scrolly = data; break; @@ -288,18 +288,18 @@ WRITE8_MEMBER(victory_state::victory_video_control_w) // D3 = SINVERT // D2 = BIR12 // D1 = SELOVER - if (LOG_MICROCODE) logerror("%04X:CONTROL write = %02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:CONTROL write = %02X\n", space.device().safe_pcbase(), data); m_video_control = data; break; case 0x0b: /* CLRVIRQ */ - if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", cpu_get_previouspc(&space.device()), data); + if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", space.device().safe_pcbase(), data); m_vblank_irq = 0; victory_update_irq(machine()); break; default: - if (LOG_MICROCODE) logerror("%04X:victory_video_control_w(%02X) = %02X\n", cpu_get_previouspc(&space.device()), offset, data); + if (LOG_MICROCODE) logerror("%04X:victory_video_control_w(%02X) = %02X\n", space.device().safe_pcbase(), offset, data); break; } } diff --git a/src/mame/video/williams.c b/src/mame/video/williams.c index f0cb6b30a44..94bdc9960eb 100644 --- a/src/mame/video/williams.c +++ b/src/mame/video/williams.c @@ -543,7 +543,7 @@ WRITE8_MEMBER(williams_state::williams_blitter_w) /* Log blits */ logerror("%04X:Blit @ %3d : %02X%02X -> %02X%02X, %3dx%3d, mask=%02X, flags=%02X, icount=%d, win=%d\n", - cpu_get_pc(&space.device()), machine().primary_screen->vpos(), + space.device().safe_pc(), machine().primary_screen->vpos(), m_blitterram[2], m_blitterram[3], m_blitterram[4], m_blitterram[5], m_blitterram[6], m_blitterram[7], diff --git a/src/mess/audio/mea8000.c b/src/mess/audio/mea8000.c index 072c000b336..dc03551169c 100644 --- a/src/mess/audio/mea8000.c +++ b/src/mess/audio/mea8000.c @@ -556,12 +556,12 @@ READ8_DEVICE_HANDLER ( mea8000_r ) case 1: /* ready to accept next frame */ #if 0 - LOG(( "$%04x %f: mea8000_r ready=%i\n", cpu_get_previouspc( device->machine().firstcpu ), machine.time().as_double(), mea8000_accept_byte( mea8000 ) )); + LOG(( "$%04x %f: mea8000_r ready=%i\n", device->machine().firstcpu ->safe_pcbase( ), machine.time().as_double(), mea8000_accept_byte( mea8000 ) )); #endif return mea8000_accept_byte(mea8000) << 7; default: - logerror( "$%04x mea8000_r invalid read offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset ); + logerror( "$%04x mea8000_r invalid read offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset ); } return 0; } @@ -577,19 +577,19 @@ WRITE8_DEVICE_HANDLER ( mea8000_w ) { /* got pitch byte before first frame */ mea8000->pitch = 2 * data; - LOG(( "$%04x %f: mea8000_w pitch %i\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mea8000->pitch )); + LOG(( "$%04x %f: mea8000_w pitch %i\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mea8000->pitch )); mea8000->state = MEA8000_WAIT_FIRST; mea8000->bufpos = 0; } else if (mea8000->bufpos == 4) { /* overflow */ - LOG(( "$%04x %f: mea8000_w data overflow %02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data )); + LOG(( "$%04x %f: mea8000_w data overflow %02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data )); } else { /* enqueue frame byte */ - LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), + LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data, mea8000->bufpos )); mea8000->buf[mea8000->bufpos] = data; mea8000->bufpos++; @@ -623,7 +623,7 @@ WRITE8_DEVICE_HANDLER ( mea8000_w ) mea8000_stop_frame(device->machine(), mea8000); LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n", - cpu_get_previouspc(device->machine().firstcpu), device->machine().time().as_double(), data, + device->machine().firstcpu->safe_pcbase(), device->machine().time().as_double(), data, stop, mea8000->cont, mea8000->roe )); mea8000_update_req(device); @@ -631,7 +631,7 @@ WRITE8_DEVICE_HANDLER ( mea8000_w ) } default: - logerror( "$%04x mea8000_w invalid write offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset ); + logerror( "$%04x mea8000_w invalid write offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset ); } } diff --git a/src/mess/devices/sonydriv.c b/src/mess/devices/sonydriv.c index bc909e8bd4a..ff66e55073c 100644 --- a/src/mess/devices/sonydriv.c +++ b/src/mess/devices/sonydriv.c @@ -271,7 +271,7 @@ int sony_read_status(device_t *device) if (LOG_SONY_EXTRA) { printf("sony.status(): action=%x pc=0x%08x%s\n", - action, (int) cpu_get_pc(device->machine().firstcpu), sony.floppy_enable ? "" : " (no drive enabled)"); + action, (int) device->machine().firstcpu->safe_pc(), sony.floppy_enable ? "" : " (no drive enabled)"); } if ((! sony_enable2()) && sony.floppy_enable) @@ -333,7 +333,7 @@ int sony_read_status(device_t *device) } break; case 0x0a: /* At track 0: 0=track zero 1=not track zero */ - logerror("sony.status(): reading Track 0 pc=0x%08x\n", (int) cpu_get_pc(device->machine().firstcpu)); + logerror("sony.status(): reading Track 0 pc=0x%08x\n", (int) device->machine().firstcpu->safe_pc()); if (cur_image) result = floppy_tk00_r(&cur_image->device()); else @@ -407,7 +407,7 @@ static void sony_doaction(device_t *device) if (LOG_SONY) { logerror("sony_doaction(): action=%d pc=0x%08x%s\n", - action, (int) cpu_get_pc(device->machine().firstcpu), (sony.floppy_enable) ? "" : " (MOTOR OFF)"); + action, (int) device->machine().firstcpu->safe_pc(), (sony.floppy_enable) ? "" : " (MOTOR OFF)"); } if (sony.floppy_enable) diff --git a/src/mess/drivers/a2600.c b/src/mess/drivers/a2600.c index e2a640fc064..16b54d30e75 100644 --- a/src/mess/drivers/a2600.c +++ b/src/mess/drivers/a2600.c @@ -655,7 +655,7 @@ static void modeFV_switch(running_machine &machine, UINT16 offset, UINT8 data) { a2600_state *state = machine.driver_data(); //printf("ModeFV %04x\n",offset); - if (!state->m_FVlocked && ( cpu_get_pc(machine.device("maincpu")) & 0x1F00 ) == 0x1F00 ) + if (!state->m_FVlocked && ( machine.device("maincpu")->safe_pc() & 0x1F00 ) == 0x1F00 ) { state->m_FVlocked = 1; state->m_current_bank = state->m_current_bank ^ 0x01; @@ -673,7 +673,7 @@ static void modeJVP_switch(running_machine &machine, UINT16 offset, UINT8 data) state->m_current_bank ^= 1; break; default: - printf("%04X: write to unknown mapper address %02X\n", cpu_get_pc(machine.device("maincpu")), 0xfa0 + offset ); + printf("%04X: write to unknown mapper address %02X\n", machine.device("maincpu")->safe_pc(), 0xfa0 + offset ); break; } state->m_bank_base[1] = CART + 0x1000 * state->m_current_bank; @@ -805,11 +805,11 @@ READ8_MEMBER(a2600_state::modeSS_r) { UINT8 data = ( offset & 0x800 ) ? m_bank_base[2][offset & 0x7FF] : m_bank_base[1][offset]; - //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc(machine().device("maincpu")), offset); + //logerror("%04X: read from modeSS area offset = %04X\n", machine().device("maincpu")->safe_pc(), offset); /* Check for control register "write" */ if ( offset == 0xFF8 ) { - //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc(machine().device("maincpu")), m_modeSS_byte); + //logerror("%04X: write to modeSS control register data = %02X\n", machine().device("maincpu")->safe_pc(), m_modeSS_byte); m_modeSS_write_enabled = m_modeSS_byte & 0x02; m_modeSS_write_delay = m_modeSS_byte >> 5; switch ( m_modeSS_byte & 0x1C ) @@ -862,7 +862,7 @@ READ8_MEMBER(a2600_state::modeSS_r) { /* Cassette port read */ double tap_val = machine().device(CASSETTE_TAG)->input(); - //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(machine().device("maincpu")), tap_val); + //logerror("%04X: Cassette port read, tap_val = %f\n", machine().device("maincpu")->safe_pc(), tap_val); if ( tap_val < 0 ) { data = 0x00; @@ -878,10 +878,10 @@ READ8_MEMBER(a2600_state::modeSS_r) if ( m_modeSS_write_enabled ) { int diff = machine().device("maincpu")->total_cycles() - m_modeSS_byte_started; - //logerror("%04X: offset = %04X, %d\n", cpu_get_pc(machine().device("maincpu")), offset, diff); + //logerror("%04X: offset = %04X, %d\n", machine().device("maincpu")->safe_pc(), offset, diff); if ( diff - m_modeSS_diff_adjust == 5 ) { - //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc(machine().device("maincpu")), offset, m_modeSS_byte ); + //logerror("%04X: RAM write offset = %04X, data = %02X\n", machine().device("maincpu")->safe_pc(), offset, m_modeSS_byte ); if ( offset & 0x800 ) { if ( m_modeSS_high_ram_enabled ) @@ -919,7 +919,7 @@ READ8_MEMBER(a2600_state::modeSS_r) } /* Because the mame core caches opcode data and doesn't perform reads like normal */ /* we have to put in this little hack here to get Suicide Mission to work. */ - if ( offset != 0xFF8 && ( cpu_get_pc(machine().device("maincpu")) & 0x1FFF ) == 0x1FF8 ) + if ( offset != 0xFF8 && ( machine().device("maincpu")->safe_pc() & 0x1FFF ) == 0x1FF8 ) { modeSS_r( space, 0xFF8 ); } @@ -984,7 +984,7 @@ READ8_MEMBER(a2600_state::modeDPC_r) UINT8 data_fetcher = offset & 0x07; UINT8 data = 0xFF; - logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc(machine().device("maincpu")), offset); + logerror("%04X: Read from DPC offset $%02X\n", machine().device("maincpu")->safe_pc(), offset); if ( offset < 0x08 ) { switch( offset & 0x06 ) @@ -1091,13 +1091,13 @@ WRITE8_MEMBER(a2600_state::modeDPC_w) m_dpc.movamt = data; break; case 0x28: /* Not used */ - logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(machine().device("maincpu")), offset, data); + logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", machine().device("maincpu")->safe_pc(), offset, data); break; case 0x30: /* Random number generator reset */ m_dpc.shift_reg = 0; break; case 0x38: /* Not used */ - logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(machine().device("maincpu")), offset, data); + logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", machine().device("maincpu")->safe_pc(), offset, data); break; } } @@ -1498,7 +1498,7 @@ READ8_MEMBER(a2600_state::a2600_get_databus_contents) UINT16 last_address, prev_address; UINT8 last_byte, prev_byte; - last_address = cpu_get_pc(machine().device("maincpu")) - 1; + last_address = machine().device("maincpu")->safe_pc() - 1; if ( ! ( last_address & 0x1080 ) ) { return offset; diff --git a/src/mess/drivers/apollo.c b/src/mess/drivers/apollo.c index 115cd2f5b08..2e47a45819c 100644 --- a/src/mess/drivers/apollo.c +++ b/src/mess/drivers/apollo.c @@ -129,7 +129,7 @@ const char *apollo_cpu_context(device_t *cpu) { int s = t / osd_ticks_per_second(); int ms = (t % osd_ticks_per_second()) / 1000; - sprintf(statebuf, "%d.%03d %s pc=%08x", s, ms, cpu->tag(), cpu_get_previouspc(cpu)); + sprintf(statebuf, "%d.%03d %s pc=%08x", s, ms, cpu->tag(), cpu->safe_pcbase()); } else { strcpy(statebuf, "(no context)"); } @@ -551,7 +551,7 @@ WRITE32_MEMBER(apollo_state::apollo_unmapped_w) WRITE32_MEMBER(apollo_state::apollo_rom_w) { offs_t address = offset * 4; - offs_t pc = cpu_get_previouspc(&space.device()); + offs_t pc = space.device().safe_pcbase(); if (pc == 0x00002c1c && address == 0x00000004 && VERBOSE < 2) { // don't log invalid code in 3500_boot_12191_7.bin diff --git a/src/mess/drivers/bebox.c b/src/mess/drivers/bebox.c index 853667d423d..f625aeb484b 100644 --- a/src/mess/drivers/bebox.c +++ b/src/mess/drivers/bebox.c @@ -79,7 +79,7 @@ static READ64_HANDLER(bb_slave_64be_r) pci_bus_device *device = space->machine().device("pcibus"); // 2e94 is the real address, 2e84 is where the PC appears to be under full DRC - if ((cpu_get_pc(&space->device()) == 0xfff02e94) || (cpu_get_pc(&space->device()) == 0xfff02e84)) + if ((space->device().safe_pc() == 0xfff02e94) || (space->device().safe_pc() == 0xfff02e84)) { return 0x108000ff; // indicate slave CPU } diff --git a/src/mess/drivers/camplynx.c b/src/mess/drivers/camplynx.c index f7ab5b8241f..fdca12549c8 100644 --- a/src/mess/drivers/camplynx.c +++ b/src/mess/drivers/camplynx.c @@ -121,7 +121,7 @@ WRITE8_MEMBER( camplynx_state::lynx48k_bank_w ) if (data & 4) membank("bank1")->set_entry(2); else - logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data); + logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->safe_pc(), data); } WRITE8_MEMBER( camplynx_state::lynx128k_bank_w ) @@ -157,7 +157,7 @@ WRITE8_MEMBER( camplynx_state::lynx128k_bank_w ) membank("bank8")->set_base(base + 0x2e000); } else - logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data); + logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->safe_pc(), data); /* Set write banks */ bank = data & 0xd0; @@ -186,7 +186,7 @@ WRITE8_MEMBER( camplynx_state::lynx128k_bank_w ) membank("bank18")->set_base(base + 0x2e000); } else - logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data); + logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->safe_pc(), data); } static ADDRESS_MAP_START( lynx48k_mem, AS_PROGRAM, 8, camplynx_state ) diff --git a/src/mess/drivers/craft.c b/src/mess/drivers/craft.c index 2332ab88d94..d65a7afa8cf 100644 --- a/src/mess/drivers/craft.c +++ b/src/mess/drivers/craft.c @@ -24,7 +24,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } #else diff --git a/src/mess/drivers/cxhumax.c b/src/mess/drivers/cxhumax.c index af95257c247..d9a6e73289c 100644 --- a/src/mess/drivers/cxhumax.c +++ b/src/mess/drivers/cxhumax.c @@ -150,7 +150,7 @@ READ32_MEMBER( cxhumax_state::cx_scratch_r ) UINT32 data = m_scratch_reg; verboselog( machine(), 9, "(SCRATCH) %08X -> %08X\n", 0xE0400024 + (offset << 2), data); - if((cpu_get_pc(m_maincpu)==0xF0003BB8) || (cpu_get_pc(m_maincpu)==0x01003724) || (cpu_get_pc(m_maincpu)==0x00005d8c)) { // HDCI-2000 + if((m_maincpu->safe_pc()==0xF0003BB8) || (m_maincpu->safe_pc()==0x01003724) || (m_maincpu->safe_pc()==0x00005d8c)) { // HDCI-2000 //we're in disabled debug_printf unsigned char* buf = (unsigned char *)alloca(200); unsigned char temp; diff --git a/src/mess/drivers/dc.c b/src/mess/drivers/dc.c index 57e38d1cc84..d46addde490 100644 --- a/src/mess/drivers/dc.c +++ b/src/mess/drivers/dc.c @@ -44,7 +44,7 @@ static UINT64 *dc_ram; static READ64_HANDLER( dcus_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc0ba52a) + if (space->device().safe_pc()==0xc0ba52a) device_spin_until_time(&space->device(), attotime::from_usec(2500)); // device_spinuntil_int(&space->device()); @@ -53,7 +53,7 @@ static READ64_HANDLER( dcus_idle_skip_r ) static READ64_HANDLER( dcjp_idle_skip_r ) { - if (cpu_get_pc(&space->device())==0xc0bac62) + if (space->device().safe_pc()==0xc0bac62) device_spin_until_time(&space->device(), attotime::from_usec(2500)); // device_spinuntil_int(&space->device()); diff --git a/src/mess/drivers/esq1.c b/src/mess/drivers/esq1.c index a8d49bd4d62..e215b2bb339 100644 --- a/src/mess/drivers/esq1.c +++ b/src/mess/drivers/esq1.c @@ -205,7 +205,7 @@ static void duart_output(device_t *device, UINT8 data) int bank = ((data >> 1) & 0x7); esq1_state *state = device->machine().driver_data(); // printf("DP [%02x]: %d mlo %d mhi %d tape %d\n", data, data&1, (data>>4)&1, (data>>5)&1, (data>>6)&3); -// printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, cpu_get_pc(device->machine().firstcpu)); +// printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, device->machine().firstcpu->safe_pc()); state->membank("osbank")->set_base(state->memregion("osrom")->base() + (bank * 0x1000) ); state->m_seq_bank = (data & 0x8) ? 0x8000 : 0x0000; diff --git a/src/mess/drivers/esq5505.c b/src/mess/drivers/esq5505.c index 10c2efedb2a..682d225a819 100644 --- a/src/mess/drivers/esq5505.c +++ b/src/mess/drivers/esq5505.c @@ -136,7 +136,7 @@ void esq5505_state::machine_reset() READ16_MEMBER(esq5505_state::es5510_dsp_r) { -// logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(&space->device()),offset,es5510_dsp_ram[offset]); +// logerror("%06x: DSP read offset %04x (data is %04x)\n",space->device().safe_pc(),offset,es5510_dsp_ram[offset]); switch(offset) { @@ -299,7 +299,7 @@ static void duart_output(device_t *device, UINT8 data) floppy->ss_w((data & 2)>>1); } -// printf("DUART output: %02x (PC=%x)\n", data, cpu_get_pc(state->m_maincpu)); +// printf("DUART output: %02x (PC=%x)\n", data, state->m_maincpu->safe_pc()); } static void duart_tx(device_t *device, int channel, UINT8 data) @@ -308,7 +308,7 @@ static void duart_tx(device_t *device, int channel, UINT8 data) if (channel == 1) { -// printf("ch %d: [%02x] (PC=%x)\n", channel, data, cpu_get_pc(state->m_maincpu)); +// printf("ch %d: [%02x] (PC=%x)\n", channel, data, state->m_maincpu->safe_pc()); switch (state->m_system_type) { case GENERIC: diff --git a/src/mess/drivers/ex800.c b/src/mess/drivers/ex800.c index 69a9449ddde..3111fc44250 100644 --- a/src/mess/drivers/ex800.c +++ b/src/mess/drivers/ex800.c @@ -215,19 +215,19 @@ static MACHINE_START(ex800) READ8_MEMBER(ex800_state::ex800_porta_r) { - logerror("PA R @%x\n", cpu_get_pc(&space.device())); + logerror("PA R @%x\n", space.device().safe_pc()); return machine().rand(); } READ8_MEMBER(ex800_state::ex800_portb_r) { - logerror("PB R @%x\n", cpu_get_pc(&space.device())); + logerror("PB R @%x\n", space.device().safe_pc()); return machine().rand(); } READ8_MEMBER(ex800_state::ex800_portc_r) { - logerror("PC R @%x\n", cpu_get_pc(&space.device())); + logerror("PC R @%x\n", space.device().safe_pc()); return machine().rand(); } @@ -236,31 +236,31 @@ WRITE8_MEMBER(ex800_state::ex800_porta_w) if (PA6) logerror("BNK0 selected.\n"); if (PA7) logerror("BNK1 selected.\n"); - logerror("PA W %x @%x\n", data, cpu_get_pc(&space.device())); + logerror("PA W %x @%x\n", data, space.device().safe_pc()); } WRITE8_MEMBER(ex800_state::ex800_portb_w) { if (data & 3) - logerror("PB0/1 Line feed @%x\n", cpu_get_pc(&space.device())); + logerror("PB0/1 Line feed @%x\n", space.device().safe_pc()); if (!(data & 4)) - logerror("PB2 Line feed @%x\n", cpu_get_pc(&space.device())); + logerror("PB2 Line feed @%x\n", space.device().safe_pc()); if (data & 8) - logerror("PB3 Online LED on @%x\n", cpu_get_pc(&space.device())); + logerror("PB3 Online LED on @%x\n", space.device().safe_pc()); else - logerror("PB3 Online LED off @%x\n", cpu_get_pc(&space.device())); + logerror("PB3 Online LED off @%x\n", space.device().safe_pc()); if (data & 16) - logerror("PB4 Serial @%x\n", cpu_get_pc(&space.device())); + logerror("PB4 Serial @%x\n", space.device().safe_pc()); if (data & 32) - logerror("PB4 Serial @%x\n", cpu_get_pc(&space.device())); + logerror("PB4 Serial @%x\n", space.device().safe_pc()); if (data & 64) - logerror("PB4 Serial @%x\n", cpu_get_pc(&space.device())); + logerror("PB4 Serial @%x\n", space.device().safe_pc()); if (data & 128) - logerror("PB3 Paper empty LED on @%x\n", cpu_get_pc(&space.device())); + logerror("PB3 Paper empty LED on @%x\n", space.device().safe_pc()); else - logerror("PB3 Paper empty LED off @%x\n", cpu_get_pc(&space.device())); + logerror("PB3 Paper empty LED off @%x\n", space.device().safe_pc()); -// logerror("PB W %x @%x\n", data, cpu_get_pc(&space.device())); +// logerror("PB W %x @%x\n", data, space.device().safe_pc()); } WRITE8_MEMBER(ex800_state::ex800_portc_w) @@ -271,7 +271,7 @@ WRITE8_MEMBER(ex800_state::ex800_portc_w) else beep_set_state(speaker, 1); - logerror("PC W %x @%x\n", data, cpu_get_pc(&space.device())); + logerror("PC W %x @%x\n", data, space.device().safe_pc()); } @@ -279,46 +279,46 @@ WRITE8_MEMBER(ex800_state::ex800_portc_w) READ8_MEMBER(ex800_state::ex800_devsel_r) { - logerror("DEVSEL R @%x with offset %x\n", cpu_get_pc(&space.device()), offset); + logerror("DEVSEL R @%x with offset %x\n", space.device().safe_pc(), offset); return machine().rand(); } WRITE8_MEMBER(ex800_state::ex800_devsel_w) { - logerror("DEVSEL W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset); + logerror("DEVSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset); } READ8_MEMBER(ex800_state::ex800_gate5a_r) { - logerror("GATE5A R @%x with offset %x\n", cpu_get_pc(&space.device()), offset); + logerror("GATE5A R @%x with offset %x\n", space.device().safe_pc(), offset); return machine().rand(); } WRITE8_MEMBER(ex800_state::ex800_gate5a_w) { - logerror("GATE5A W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset); + logerror("GATE5A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset); } READ8_MEMBER(ex800_state::ex800_iosel_r) { - logerror("IOSEL R @%x with offset %x\n", cpu_get_pc(&space.device()), offset); + logerror("IOSEL R @%x with offset %x\n", space.device().safe_pc(), offset); return machine().rand(); } WRITE8_MEMBER(ex800_state::ex800_iosel_w) { - logerror("IOSEL W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset); + logerror("IOSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset); } READ8_MEMBER(ex800_state::ex800_gate7a_r) { - logerror("GATE7A R @%x with offset %x\n", cpu_get_pc(&space.device()), offset); + logerror("GATE7A R @%x with offset %x\n", space.device().safe_pc(), offset); return machine().rand(); } WRITE8_MEMBER(ex800_state::ex800_gate7a_w) { - logerror("GATE7A W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset); + logerror("GATE7A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset); } diff --git a/src/mess/drivers/gba.c b/src/mess/drivers/gba.c index be0fe7dcbc9..db265e819f2 100644 --- a/src/mess/drivers/gba.c +++ b/src/mess/drivers/gba.c @@ -35,7 +35,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } @@ -869,7 +869,7 @@ READ32_MEMBER(gba_state::gba_io_r) double time, ticks; int timer = offset-(0x100/4); -// printf("Read timer reg %x (PC=%x)\n", timer, cpu_get_pc(&space.device())); +// printf("Read timer reg %x (PC=%x)\n", timer, space.device().safe_pc()); // update times for if (m_timer_regs[timer] & 0x800000) @@ -1670,7 +1670,7 @@ WRITE32_MEMBER(gba_state::gba_io_w) m_timer_regs[offset] = (m_timer_regs[offset] & ~(mem_mask & 0xFFFF0000)) | (data & (mem_mask & 0xFFFF0000)); -// printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, cpu_get_pc(&space.device())); +// printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, space.device().safe_pc()); if (ACCESSING_BITS_0_15) { @@ -1829,7 +1829,7 @@ WRITE32_MEMBER(gba_state::gba_io_w) case 0x0200/4: if( (mem_mask) & 0x0000ffff ) { -// printf("IE (%08x) = %04x raw %x (%08x) (scan %d PC %x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, data, ~mem_mask, machine.primary_screen->vpos(), cpu_get_pc(&space.device())); +// printf("IE (%08x) = %04x raw %x (%08x) (scan %d PC %x)\n", 0x04000000 + ( offset << 2 ), data & mem_mask, data, ~mem_mask, machine.primary_screen->vpos(), space.device().safe_pc()); m_IE = ( m_IE & ~mem_mask ) | ( data & mem_mask ); #if 0 if (m_IE & m_IF) @@ -2318,7 +2318,7 @@ READ32_MEMBER(gba_state::eeprom_r) // printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %08x\n", offset, ~mem_mask, m_eeprom_state, activecpu_get_pc(), out); return out; } -// printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, m_eeprom_state, cpu_get_pc(&space.device()), 0); +// printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, m_eeprom_state, space.device().safe_pc(), 0); return 0; } @@ -2330,7 +2330,7 @@ WRITE32_MEMBER(gba_state::eeprom_w) data >>= 16; } -// printf("eeprom_w: %x @ %x (state %d) (PC=%x)\n", data, offset, m_eeprom_state, cpu_get_pc(&space.device())); +// printf("eeprom_w: %x @ %x (state %d) (PC=%x)\n", data, offset, m_eeprom_state, space.device().safe_pc()); switch (m_eeprom_state) { @@ -2395,7 +2395,7 @@ WRITE32_MEMBER(gba_state::eeprom_w) if (m_eeprom_bits == 0) { - mame_printf_verbose("%08x: EEPROM: %02x to %x\n", cpu_get_pc(machine().device("maincpu")), m_eep_data, m_eeprom_addr ); + mame_printf_verbose("%08x: EEPROM: %02x to %x\n", machine().device("maincpu")->safe_pc(), m_eep_data, m_eeprom_addr ); if (m_eeprom_addr >= sizeof( m_gba_eeprom)) { fatalerror( "eeprom: invalid address (%x)\n", m_eeprom_addr); diff --git a/src/mess/drivers/gp2x.c b/src/mess/drivers/gp2x.c index a1a8fdaec42..d0efb1d866b 100644 --- a/src/mess/drivers/gp2x.c +++ b/src/mess/drivers/gp2x.c @@ -250,7 +250,7 @@ READ32_MEMBER( gp2x_state::nand_r ) break; default: - logerror("NAND: read unk command %x (PC %x)\n", m_nand_cmd, cpu_get_pc(m_maincpu)); + logerror("NAND: read unk command %x (PC %x)\n", m_nand_cmd, m_maincpu->safe_pc()); break; } } @@ -266,7 +266,7 @@ WRITE32_MEMBER( gp2x_state::nand_w ) { case 4: // command m_nand_cmd = data; -// printf("NAND: command %x (PC %x0)\n", data, cpu_get_pc(m_maincpu)); +// printf("NAND: command %x (PC %x0)\n", data, m_maincpu->safe_pc()); m_nand_stage = 0; m_nand_subword_stage = 0; break; diff --git a/src/mess/drivers/gp32.c b/src/mess/drivers/gp32.c index 7cdd196bd82..6dbb909a38d 100644 --- a/src/mess/drivers/gp32.c +++ b/src/mess/drivers/gp32.c @@ -314,7 +314,7 @@ READ32_MEMBER(gp32_state::s3c240x_lcd_r) } break; } - verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( )); return data; } @@ -378,7 +378,7 @@ static void s3c240x_lcd_recalc( running_machine &machine) WRITE32_MEMBER(gp32_state::s3c240x_lcd_w) { UINT32 old_value = m_s3c240x_lcd_regs[offset]; - verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_lcd_regs[offset]); switch (offset) { @@ -400,13 +400,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_lcd_w) READ32_MEMBER(gp32_state::s3c240x_lcd_palette_r) { UINT32 data = m_s3c240x_lcd_palette[offset]; - verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_lcd_palette_w) { - verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_lcd_palette[offset]); if (mem_mask != 0xffffffff) { @@ -455,13 +455,13 @@ static UINT32 s3c240x_get_pclk(gp32_state *state, int reg) READ32_MEMBER(gp32_state::s3c240x_clkpow_r) { UINT32 data = m_s3c240x_clkpow_regs[offset]; - verboselog( machine(), 9, "(CLKPOW) %08X -> %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(CLKPOW) %08X -> %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_clkpow_w) { - verboselog( machine(), 9, "(CLKPOW) %08X <- %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(CLKPOW) %08X <- %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_clkpow_regs[offset]); switch (offset) { @@ -522,14 +522,14 @@ static void s3c240x_request_irq( running_machine &machine, UINT32 int_type) READ32_MEMBER(gp32_state::s3c240x_irq_r) { UINT32 data = m_s3c240x_irq_regs[offset]; - verboselog( machine(), 9, "(IRQ) %08X -> %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(IRQ) %08X -> %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_irq_w) { UINT32 old_value = m_s3c240x_irq_regs[offset]; - verboselog( machine(), 9, "(IRQ) %08X <- %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(IRQ) %08X <- %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_irq_regs[offset]); switch (offset) { @@ -579,7 +579,7 @@ static const char *const timer_reg_names[] = READ32_MEMBER(gp32_state::s3c240x_pwm_r) { UINT32 data = m_s3c240x_pwm_regs[offset]; - verboselog( machine(), 9, "(PWM) %08X -> %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(PWM) %08X -> %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( )); return data; } @@ -644,7 +644,7 @@ static void s3c240x_pwm_recalc( running_machine &machine, int timer) WRITE32_MEMBER(gp32_state::s3c240x_pwm_w) { UINT32 old_value = m_s3c240x_pwm_regs[offset]; - verboselog( machine(), 9, "(PWM) %08X <- %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(PWM) %08X <- %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_pwm_regs[offset]); switch (offset) { @@ -839,14 +839,14 @@ static void s3c240x_dma_recalc( running_machine &machine, int dma) READ32_MEMBER(gp32_state::s3c240x_dma_r) { UINT32 data = m_s3c240x_dma_regs[offset]; - verboselog( machine(), 9, "(DMA) %08X -> %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(DMA) %08X -> %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_dma_w) { UINT32 old_value = m_s3c240x_dma_regs[offset]; - verboselog( machine(), 9, "(DMA) %08X <- %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(DMA) %08X <- %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_dma_regs[offset]); switch (offset) { @@ -1103,14 +1103,14 @@ READ32_MEMBER(gp32_state::s3c240x_gpio_r) } break; } - verboselog( machine(), 9, "(GPIO) %08X -> %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(GPIO) %08X -> %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_gpio_w) { COMBINE_DATA(&m_s3c240x_gpio[offset]); - verboselog( machine(), 9, "(GPIO) %08X <- %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(GPIO) %08X <- %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( )); switch (offset) { // PBCON @@ -1170,13 +1170,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_gpio_w) READ32_MEMBER(gp32_state::s3c240x_memcon_r) { UINT32 data = m_s3c240x_memcon_regs[offset]; - verboselog( machine(), 9, "(MEMCON) %08X -> %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(MEMCON) %08X -> %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_memcon_w) { - verboselog( machine(), 9, "(MEMCON) %08X <- %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(MEMCON) %08X <- %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_memcon_regs[offset]); } @@ -1186,13 +1186,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_memcon_w) READ32_MEMBER(gp32_state::s3c240x_usb_host_r) { UINT32 data = m_s3c240x_usb_host_regs[offset]; - verboselog( machine(), 9, "(USB H) %08X -> %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(USB H) %08X -> %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_usb_host_w) { - verboselog( machine(), 9, "(USB H) %08X <- %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(USB H) %08X <- %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_usb_host_regs[offset]); } @@ -1211,13 +1211,13 @@ READ32_MEMBER(gp32_state::s3c240x_uart_0_r) } break; } - verboselog( machine(), 9, "(UART 0) %08X -> %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(UART 0) %08X -> %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_uart_0_w) { - verboselog( machine(), 9, "(UART 0) %08X <- %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(UART 0) %08X <- %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_uart_0_regs[offset]); } @@ -1236,13 +1236,13 @@ READ32_MEMBER(gp32_state::s3c240x_uart_1_r) } break; } - verboselog( machine(), 9, "(UART 1) %08X -> %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(UART 1) %08X -> %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_uart_1_w) { - verboselog( machine(), 9, "(UART 1) %08X <- %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(UART 1) %08X <- %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_uart_1_regs[offset]); } @@ -1252,13 +1252,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_uart_1_w) READ32_MEMBER(gp32_state::s3c240x_usb_device_r) { UINT32 data = m_s3c240x_usb_device_regs[offset]; - verboselog( machine(), 9, "(USB D) %08X -> %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(USB D) %08X -> %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_usb_device_w) { - verboselog( machine(), 9, "(USB D) %08X <- %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(USB D) %08X <- %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_usb_device_regs[offset]); } @@ -1268,13 +1268,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_usb_device_w) READ32_MEMBER(gp32_state::s3c240x_watchdog_r) { UINT32 data = m_s3c240x_watchdog_regs[offset]; - verboselog( machine(), 9, "(WDOG) %08X -> %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(WDOG) %08X -> %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_watchdog_w) { - verboselog( machine(), 9, "(WDOG) %08X <- %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(WDOG) %08X <- %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_watchdog_regs[offset]); } @@ -1388,13 +1388,13 @@ READ32_MEMBER(gp32_state::s3c240x_iic_r) } break; } - verboselog( machine(), 9, "(IIC) %08X -> %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(IIC) %08X -> %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_iic_w) { - verboselog( machine(), 9, "(IIC) %08X <- %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(IIC) %08X <- %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_iic_regs[offset]); switch (offset) { @@ -1542,14 +1542,14 @@ READ32_MEMBER(gp32_state::s3c240x_iis_r) break; } #endif - verboselog( machine(), 9, "(IIS) %08X -> %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(IIS) %08X -> %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_iis_w) { UINT32 old_value = m_s3c240x_iis_regs[offset]; - verboselog( machine(), 9, "(IIS) %08X <- %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(IIS) %08X <- %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_iis_regs[offset]); switch (offset) { @@ -1596,13 +1596,13 @@ static TIMER_CALLBACK( s3c240x_iis_timer_exp ) READ32_MEMBER(gp32_state::s3c240x_rtc_r) { UINT32 data = m_s3c240x_rtc_regs[offset]; - verboselog( machine(), 9, "(RTC) %08X -> %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(RTC) %08X -> %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_rtc_w) { - verboselog( machine(), 9, "(RTC) %08X <- %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(RTC) %08X <- %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_rtc_regs[offset]); } @@ -1612,13 +1612,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_rtc_w) READ32_MEMBER(gp32_state::s3c240x_adc_r) { UINT32 data = m_s3c240x_adc_regs[offset]; - verboselog( machine(), 9, "(ADC) %08X -> %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(ADC) %08X -> %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_adc_w) { - verboselog( machine(), 9, "(ADC) %08X <- %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(ADC) %08X <- %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_adc_regs[offset]); } @@ -1628,13 +1628,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_adc_w) READ32_MEMBER(gp32_state::s3c240x_spi_r) { UINT32 data = m_s3c240x_spi_regs[offset]; - verboselog( machine(), 9, "(SPI) %08X -> %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(SPI) %08X -> %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_spi_w) { - verboselog( machine(), 9, "(SPI) %08X <- %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(SPI) %08X <- %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_spi_regs[offset]); } @@ -1644,13 +1644,13 @@ WRITE32_MEMBER(gp32_state::s3c240x_spi_w) READ32_MEMBER(gp32_state::s3c240x_mmc_r) { UINT32 data = m_s3c240x_mmc_regs[offset]; - verboselog( machine(), 9, "(MMC) %08X -> %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(MMC) %08X -> %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( )); return data; } WRITE32_MEMBER(gp32_state::s3c240x_mmc_w) { - verboselog( machine(), 9, "(MMC) %08X <- %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, cpu_get_pc( &space.device())); + verboselog( machine(), 9, "(MMC) %08X <- %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( )); COMBINE_DATA(&m_s3c240x_mmc_regs[offset]); } diff --git a/src/mess/drivers/ip20.c b/src/mess/drivers/ip20.c index 9c37d309fb7..8f58d4fc42c 100644 --- a/src/mess/drivers/ip20.c +++ b/src/mess/drivers/ip20.c @@ -74,7 +74,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, c va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } @@ -443,13 +443,13 @@ WRITE32_MEMBER(ip20_state::hpc_w) // INT/INT2/INT3 interrupt controllers READ32_MEMBER(ip20_state::int_r) { - mame_printf_info("INT: read @ ofs %x (mask %x) (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); + mame_printf_info("INT: read @ ofs %x (mask %x) (PC=%x)\n", offset, mem_mask, space.device().safe_pc()); return 0; } WRITE32_MEMBER(ip20_state::int_w) { - mame_printf_info("INT: write %x to ofs %x (mask %x) (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + mame_printf_info("INT: write %x to ofs %x (mask %x) (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); } static ADDRESS_MAP_START( ip204415_map, AS_PROGRAM, 32, ip20_state ) diff --git a/src/mess/drivers/ip22.c b/src/mess/drivers/ip22.c index 0215b776bbc..161d8e93b17 100644 --- a/src/mess/drivers/ip22.c +++ b/src/mess/drivers/ip22.c @@ -144,7 +144,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, c va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror("%08x: %s", cpu_get_pc(machine.device("maincpu")), buf); + logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf); } } @@ -253,7 +253,7 @@ READ32_MEMBER(ip22_state::hpc3_pbus6_r) return ret8; case 0x030/4: //verboselog(( machine, 2, "Serial 1 Command Transfer Read, 0x1fbd9830: %02x\n", 0x04 ); - switch(cpu_get_pc(&space.device())) + switch(space.device().safe_pc()) { case 0x9fc1d9e4: // interpreter (ip244415) case 0x9fc1d9e0: // DRC (ip244415) @@ -499,7 +499,7 @@ READ32_MEMBER(ip22_state::hpc3_hd0_r) return 0; } default: - //verboselog((machine, 0, "Unknown HPC3 HD0 Read: %08x (%08x) [%x] PC=%x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, offset, cpu_get_pc(&space.device()) ); + //verboselog((machine, 0, "Unknown HPC3 HD0 Read: %08x (%08x) [%x] PC=%x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, offset, space.device().safe_pc() ); return 0; } return 0; @@ -1370,7 +1370,7 @@ static void scsi_irq(running_machine &machine, int state) dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor); - printf("PC is %08x\n", cpu_get_pc(machine.device("maincpu"))); + printf("PC is %08x\n", machine.device("maincpu")->safe_pc()); printf("DMA to device: length %x xie %d eox %d\n", length, xie, eox); if (length <= 0x4000) diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c index b96dfb9e0f1..679a7390169 100644 --- a/src/mess/drivers/mac.c +++ b/src/mess/drivers/mac.c @@ -182,7 +182,7 @@ READ8_MEMBER( mac_state::mac_sonora_vctl_r ) { if (offset == 2) { -// printf("Sonora: read monitor ID at PC=%x\n", cpu_get_pc(m_maincpu)); +// printf("Sonora: read monitor ID at PC=%x\n", m_maincpu->safe_pc()); return (6 << 4); // 640x480 RGB monitor } @@ -240,7 +240,7 @@ READ8_MEMBER ( mac_state::mac_rbv_r ) { data &= ~0x38; data |= (space.machine().root_device().ioport("MONTYPE")->read_safe(2)<<3); -// printf("rbv_r montype: %02x (PC %x)\n", data, cpu_get_pc(space.cpu)); +// printf("rbv_r montype: %02x (PC %x)\n", data, space.cpu->safe_pc()); } // bit 7 of these registers always reads as 0 on RBV @@ -256,12 +256,12 @@ READ8_MEMBER ( mac_state::mac_rbv_r ) switch (offset) { case 13: // IFR -// printf("Read IER = %02x (PC=%x) 2=%02x\n", m_rbv_ier, cpu_get_pc(m_maincpu), m_rbv_regs[2]); +// printf("Read IER = %02x (PC=%x) 2=%02x\n", m_rbv_ier, m_maincpu->safe_pc(), m_rbv_regs[2]); data = m_rbv_ifr; break; case 14: // IER -// printf("Read IFR = %02x (PC=%x) 2=%02x\n", m_rbv_ifr, cpu_get_pc(m_maincpu), m_rbv_regs[2]); +// printf("Read IFR = %02x (PC=%x) 2=%02x\n", m_rbv_ifr, m_maincpu->safe_pc(), m_rbv_regs[2]); data = m_rbv_ier; break; @@ -271,7 +271,7 @@ READ8_MEMBER ( mac_state::mac_rbv_r ) } } -// printf("rbv_r: %x = %02x (PC=%x)\n", offset, data, cpu_get_pc(m_maincpu)); +// printf("rbv_r: %x = %02x (PC=%x)\n", offset, data, m_maincpu->safe_pc()); return data; } @@ -281,7 +281,7 @@ WRITE8_MEMBER ( mac_state::mac_rbv_w ) if (offset < 0x100) { // if (offset == 0x10) -// printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu)); +// printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, m_maincpu->safe_pc()); switch (offset) { case 0x00: @@ -364,7 +364,7 @@ WRITE8_MEMBER ( mac_state::mac_rbv_w ) switch (offset) { case 13: // IFR -// printf("%02x to IFR (PC=%x)\n", data, cpu_get_pc(m_maincpu)); +// printf("%02x to IFR (PC=%x)\n", data, m_maincpu->safe_pc()); if (data & 0x80) { data = 0x7f; @@ -373,7 +373,7 @@ WRITE8_MEMBER ( mac_state::mac_rbv_w ) break; case 14: // IER -// printf("%02x to IER (PC=%x)\n", data, cpu_get_pc(m_maincpu)); +// printf("%02x to IER (PC=%x)\n", data, m_maincpu->safe_pc()); if (data & 0x80) // 1 bits write 1s { m_rbv_ier |= data & 0x7f; @@ -440,24 +440,24 @@ READ32_MEMBER(mac_state::buserror_r) READ8_MEMBER(mac_state::scciop_r) { -// printf("scciop_r @ %x (PC=%x)\n", offset, cpu_get_pc(m_maincpu)); +// printf("scciop_r @ %x (PC=%x)\n", offset, m_maincpu->safe_pc()); return 0; } WRITE8_MEMBER(mac_state::scciop_w) { -// printf("scciop_w %x @ %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu)); +// printf("scciop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->safe_pc()); } READ8_MEMBER(mac_state::swimiop_r) { -// printf("swimiop_r @ %x (PC=%x)\n", offset, cpu_get_pc(m_maincpu)); +// printf("swimiop_r @ %x (PC=%x)\n", offset, m_maincpu->safe_pc()); return 0; } WRITE8_MEMBER(mac_state::swimiop_w) { -// printf("swimiop_w %x @ %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu)); +// printf("swimiop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->safe_pc()); } READ8_MEMBER(mac_state::pmac_diag_r) @@ -478,7 +478,7 @@ READ8_MEMBER(mac_state::amic_dma_r) WRITE8_MEMBER(mac_state::amic_dma_w) { -// printf("amic_dma_w: %02x at %x (PC=%x)\n", data, offset+0x1000, cpu_get_pc(m_maincpu)); +// printf("amic_dma_w: %02x at %x (PC=%x)\n", data, offset+0x1000, m_maincpu->safe_pc()); } // HMC has one register: a 35-bit shift register which is accessed one bit at a time (see pmac6100 code at 4030383c which makes this obvious) diff --git a/src/mess/drivers/nc.c b/src/mess/drivers/nc.c index 6eaaebbc3ea..974bc490b2a 100644 --- a/src/mess/drivers/nc.c +++ b/src/mess/drivers/nc.c @@ -1426,7 +1426,7 @@ WRITE8_MEMBER(nc_state::nc200_uart_control_w) } /* bit 5 is used in disk interface */ - LOG_DEBUG(("bit 5: PC: %04x %02x\n", cpu_get_pc(machine().device("maincpu")), data & (1 << 5))); + LOG_DEBUG(("bit 5: PC: %04x %02x\n", machine().device("maincpu")->safe_pc(), data & (1 << 5))); } @@ -1445,7 +1445,7 @@ WRITE8_MEMBER(nc_state::nc200_uart_control_w) WRITE8_MEMBER(nc_state::nc200_memory_card_wait_state_w) { device_t *fdc = machine().device("upd765"); - LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", cpu_get_pc(machine().device("maincpu")), data)); + LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", machine().device("maincpu")->safe_pc(), data)); #if 0 floppy_drive_set_motor_state(0, 1); floppy_drive_set_ready_state(0, 1, 1); @@ -1458,7 +1458,7 @@ WRITE8_MEMBER(nc_state::nc200_memory_card_wait_state_w) /* bit 0 seems to be the same as nc100 */ WRITE8_MEMBER(nc_state::nc200_poweroff_control_w) { - LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", cpu_get_pc(machine().device("maincpu")), data)); + LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", machine().device("maincpu")->safe_pc(), data)); nc200_video_set_backlight(machine(), ((data ^ (1 << 2)) >> 2) & 0x01); } diff --git a/src/mess/drivers/next.c b/src/mess/drivers/next.c index 8d036f81696..3660cb56059 100644 --- a/src/mess/drivers/next.c +++ b/src/mess/drivers/next.c @@ -79,7 +79,7 @@ UINT32 next_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co READ8_MEMBER( next_state::io_r ) { if(!space.debugger_access()) - printf("io_r %08x (%08x)\n",offset+0x02000000, cpu_get_pc(&space.device())); + printf("io_r %08x (%08x)\n",offset+0x02000000, space.device().safe_pc()); if(offset == 0xc0) return 0; @@ -90,21 +90,21 @@ READ8_MEMBER( next_state::io_r ) WRITE8_MEMBER( next_state::io_w ) { if(!space.debugger_access()) - printf("io_w %08x, %02x (%08x)\n",offset+0x02000000,data, cpu_get_pc(&space.device())); + printf("io_w %08x, %02x (%08x)\n",offset+0x02000000,data, space.device().safe_pc()); } /* map ROM at 0x01000000-0x0101ffff? */ READ32_MEMBER( next_state::rom_map_r ) { if(0 && !space.debugger_access()) - printf("%08x ROM MAP?\n",cpu_get_pc(&space.device())); + printf("%08x ROM MAP?\n",space.device().safe_pc()); return 0x01000000; } READ32_MEMBER( next_state::scr2_r ) { if(0 && !space.debugger_access()) - printf("%08x\n",cpu_get_pc(&space.device())); + printf("%08x\n",space.device().safe_pc()); /* x--- ---- ---- ---- ---- ---- ---- ---- dsp reset -x-- ---- ---- ---- ---- ---- ---- ---- dsp block end @@ -141,7 +141,7 @@ READ32_MEMBER( next_state::scr2_r ) WRITE32_MEMBER( next_state::scr2_w ) { if(0 && !space.debugger_access()) - printf("scr2_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); + printf("scr2_w %08x (%08x)\n", data, space.device().safe_pc()); COMBINE_DATA(&scr2); rtc->ce_w(BIT(scr2, 8)); @@ -456,7 +456,7 @@ READ32_MEMBER( next_state::dma_regs_r) } const char *name = dma_name(slot); - logerror("dma_regs_r %s:%d %08x (%08x)\n", name, reg, res, cpu_get_pc(&space.device())); + logerror("dma_regs_r %s:%d %08x (%08x)\n", name, reg, res, space.device().safe_pc()); return res; } @@ -468,7 +468,7 @@ WRITE32_MEMBER( next_state::dma_regs_w) const char *name = dma_name(slot); - logerror("dma_regs_w %s:%d %08x (%08x)\n", name, reg, data, cpu_get_pc(&space.device())); + logerror("dma_regs_w %s:%d %08x (%08x)\n", name, reg, data, space.device().safe_pc()); switch(reg) { case 0: dma_slots[slot].start = data; @@ -493,8 +493,8 @@ READ32_MEMBER( next_state::dma_ctrl_r) const char *name = dma_name(slot); - if(cpu_get_pc(&space.device()) != 0x409bb4e) - logerror("dma_ctrl_r %s:%d %02x (%08x)\n", name, reg, dma_slots[slot].state, cpu_get_pc(&space.device())); + if(space.device().safe_pc() != 0x409bb4e) + logerror("dma_ctrl_r %s:%d %02x (%08x)\n", name, reg, dma_slots[slot].state, space.device().safe_pc()); return reg ? 0 : dma_slots[slot].state << 24; } @@ -504,7 +504,7 @@ WRITE32_MEMBER( next_state::dma_ctrl_w) int slot = offset >> 2; int reg = offset & 3; const char *name = dma_name(slot); - logerror("dma_ctrl_w %s:%d %08x @ %08x (%08x)\n", name, reg, data, mem_mask, cpu_get_pc(&space.device())); + logerror("dma_ctrl_w %s:%d %08x @ %08x (%08x)\n", name, reg, data, mem_mask, space.device().safe_pc()); if(!reg) { if(ACCESSING_BITS_16_23) dma_do_ctrl_w(slot, data >> 16); @@ -517,7 +517,7 @@ void next_state::dma_do_ctrl_w(int slot, UINT8 data) { const char *name = dma_name(slot); #if 0 - fprintf(stderr, "dma_ctrl_w %s %02x (%08x)\n", name, data, cpu_get_pc(maincpu)); + fprintf(stderr, "dma_ctrl_w %s %02x (%08x)\n", name, data, maincpu->safe_pc()); fprintf(stderr, " ->%s%s%s%s%s%s%s\n", data & DMA_SETENABLE ? " enable" : "", @@ -529,7 +529,7 @@ void next_state::dma_do_ctrl_w(int slot, UINT8 data) data & DMA_INITBUFTURBO ? " initbufturbo" : ""); #endif if(data & DMA_SETENABLE) - logerror("dma enable %s %s %08x (%08x)\n", name, data & DMA_SETREAD ? "read" : "write", (dma_slots[slot].limit-dma_slots[slot].start) & 0x7fffffff, cpu_get_pc(maincpu)); + logerror("dma enable %s %s %08x (%08x)\n", name, data & DMA_SETREAD ? "read" : "write", (dma_slots[slot].limit-dma_slots[slot].start) & 0x7fffffff, maincpu->safe_pc()); dma_slot &ds = dma_slots[slot]; if(data & (DMA_RESET|DMA_INITBUF|DMA_INITBUFTURBO)) { @@ -561,7 +561,7 @@ const int next_state::scsi_clocks[4] = { 10000000, 12000000, 20000000, 16000000 READ32_MEMBER( next_state::scsictrl_r ) { UINT32 res = (scsictrl << 24) | (scsistat << 16); - logerror("scsictrl_read %08x @ %08x (%08x)\n", res, mem_mask, cpu_get_pc(&space.device())); + logerror("scsictrl_read %08x @ %08x (%08x)\n", res, mem_mask, space.device().safe_pc()); return res; } @@ -581,11 +581,11 @@ WRITE32_MEMBER( next_state::scsictrl_w ) scsictrl & 0x04 ? " flush" : "", scsictrl & 0x02 ? " reset" : "", scsictrl & 0x01 ? "wd3392" : "ncr5390", - cpu_get_pc(&space.device())); + space.device().safe_pc()); } if(ACCESSING_BITS_16_23) { scsistat = data >> 16; - logerror("SCSIstat %02x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("SCSIstat %02x (%08x)\n", data, space.device().safe_pc()); } } @@ -608,7 +608,7 @@ READ32_MEMBER( next_state::dsp_r) WRITE32_MEMBER( next_state::fdc_control_w ) { - logerror("FDC write %02x (%08x)\n", data >> 24, cpu_get_pc(&space.device())); + logerror("FDC write %02x (%08x)\n", data >> 24, space.device().safe_pc()); } READ32_MEMBER( next_state::fdc_control_r ) @@ -647,14 +647,14 @@ READ32_MEMBER( next_state::fdc_control_r ) READ32_MEMBER( next_state::phy_r ) { - logerror("phy_r %d %08x (%08x)\n", offset, phy[offset], cpu_get_pc(&space.device())); + logerror("phy_r %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc()); return phy[offset] | (0 << 24); } WRITE32_MEMBER( next_state::phy_w ) { COMBINE_DATA(phy+offset); - logerror("phy_w %d %08x (%08x)\n", offset, phy[offset], cpu_get_pc(&space.device())); + logerror("phy_w %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc()); } void next_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mess/drivers/ng_aes.c b/src/mess/drivers/ng_aes.c index ab6a44574f3..967669a0bad 100644 --- a/src/mess/drivers/ng_aes.c +++ b/src/mess/drivers/ng_aes.c @@ -333,7 +333,7 @@ WRITE16_MEMBER(ng_aes_state::io_control_w) // case 0x33: break; // coui lockout default: - logerror("PC: %x Unmapped I/O control write. Offset: %x Data: %x\n", cpu_get_pc(&space.device()), offset, data); + logerror("PC: %x Unmapped I/O control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset, data); break; } } @@ -513,7 +513,7 @@ WRITE16_MEMBER(ng_aes_state::audio_command_w) /* boost the interleave to let the audio CPU read the command */ machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); - if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(&space.device()), data, mem_mask); + if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", space.device().safe_pc(), data, mem_mask); } } @@ -522,7 +522,7 @@ READ8_MEMBER(ng_aes_state::audio_command_r) { UINT8 ret = soundlatch_byte_r(space, 0); - if (LOG_CPU_COMM) logerror(" AUD CPU PC %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret); + if (LOG_CPU_COMM) logerror(" AUD CPU PC %04x: audio_command_r %02x\n", space.device().safe_pc(), ret); /* this is a guess */ audio_cpu_clear_nmi_w(space, 0, 0); @@ -534,7 +534,7 @@ READ8_MEMBER(ng_aes_state::audio_command_r) WRITE8_MEMBER(ng_aes_state::audio_result_w) { - if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC %04x: audio_result_w %02x\n", cpu_get_pc(&space.device()), data); + if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC %04x: audio_result_w %02x\n", space.device().safe_pc(), data); m_audio_result = data; } @@ -545,7 +545,7 @@ static CUSTOM_INPUT( get_audio_result ) neogeo_state *state = field.machine().driver_data(); UINT32 ret = state->m_audio_result; -// if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field.machine().device("maincpu")), ret); +// if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", field.machine(->safe_pc().device("maincpu")), ret); return ret; } @@ -588,14 +588,14 @@ WRITE16_MEMBER(ng_aes_state::main_cpu_bank_select_w) UINT32 len = memregion("maincpu")->bytes(); if ((len <= 0x100000) && (data & 0x07)) - logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", cpu_get_pc(&space.device()), data); + logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", space.device().safe_pc(), data); else { bank_address = ((data & 0x07) + 1) * 0x100000; if (bank_address >= len) { - logerror("PC %06x: warning: bankswitch to empty bank %02x\n", cpu_get_pc(&space.device()), data); + logerror("PC %06x: warning: bankswitch to empty bank %02x\n", space.device().safe_pc(), data); bank_address = 0x100000; } @@ -642,7 +642,7 @@ static void audio_cpu_bank_select( address_space *space, int region, UINT8 bank { neogeo_state *state = space->machine().driver_data(); - if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: audio_cpu_bank_select: Region: %d Bank: %02x\n", cpu_get_pc(&space->device()), region, bank); + if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: audio_cpu_bank_select: Region: %d Bank: %02x\n", space->device().safe_pc(), region, bank); state->m_audio_cpu_banks[region] = bank; @@ -698,7 +698,7 @@ static void _set_audio_cpu_rom_source( address_space *space ) cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, PULSE_LINE); - if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: selectign %s ROM\n", cpu_get_pc(&space->device()), state->m_audio_cpu_rom_source ? "CARTRIDGE" : "BIOS"); + if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: selectign %s ROM\n", space->device().safe_pc(), state->m_audio_cpu_rom_source ? "CARTRIDGE" : "BIOS"); } } @@ -779,11 +779,11 @@ WRITE16_MEMBER(ng_aes_state::system_control_w) case 0x02: /* unknown - HC32 middle pin 1 */ case 0x03: /* unknown - uPD4990 pin ? */ case 0x04: /* unknown - HC32 middle pin 10 */ - logerror("PC: %x Unmapped system control write. Offset: %x Data: %x\n", cpu_get_pc(&space.device()), offset & 0x07, bit); + logerror("PC: %x Unmapped system control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset & 0x07, bit); break; } - if (LOG_VIDEO_SYSTEM && ((offset & 0x07) != 0x06)) logerror("PC: %x System control write. Offset: %x Data: %x\n", cpu_get_pc(&space.device()), offset & 0x07, bit); + if (LOG_VIDEO_SYSTEM && ((offset & 0x07) != 0x06)) logerror("PC: %x System control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset & 0x07, bit); } } diff --git a/src/mess/drivers/pasogo.c b/src/mess/drivers/pasogo.c index 887e2208c10..bf42f1a56b2 100644 --- a/src/mess/drivers/pasogo.c +++ b/src/mess/drivers/pasogo.c @@ -177,7 +177,7 @@ READ8_MEMBER( pasogo_state::vg230_io_r ) } if (log) - logerror("%.5x vg230 %02x read %.2x\n",(int) cpu_get_pc(m_maincpu),vg230->index,data); + logerror("%.5x vg230 %02x read %.2x\n",(int) m_maincpu->safe_pc(),vg230->index,data); // data=machine.root_device().memregion("maincpu")->base()[0x4000+offset]; } else @@ -221,7 +221,7 @@ WRITE8_MEMBER( pasogo_state::vg230_io_w ) } if (log) - logerror("%.5x vg230 %02x write %.2x\n",(int)cpu_get_pc(m_maincpu),vg230->index,data); + logerror("%.5x vg230 %02x write %.2x\n",(int)m_maincpu->safe_pc(),vg230->index,data); } else vg230->index=data; @@ -288,7 +288,7 @@ WRITE8_MEMBER( pasogo_state::ems_w ) ems->mapper[ems->index].address=(ems->mapper[ems->index].data[0]<<14)|((ems->mapper[ems->index].data[1]&0xf)<<22); ems->mapper[ems->index].on=ems->mapper[ems->index].data[1]&0x80; ems->mapper[ems->index].type=(ems->mapper[ems->index].data[1]&0x70)>>4; - logerror("%.5x ems mapper %d(%05x)on:%d type:%d address:%07x\n",(int)cpu_get_pc(m_maincpu),ems->index, ems->data<<12, + logerror("%.5x ems mapper %d(%05x)on:%d type:%d address:%07x\n",(int)m_maincpu->safe_pc(),ems->index, ems->data<<12, ems->mapper[ems->index].on, ems->mapper[ems->index].type, ems->mapper[ems->index].address ); switch (ems->mapper[ems->index].type) diff --git a/src/mess/drivers/pasopia7.c b/src/mess/drivers/pasopia7.c index 2e0642076f0..e82063c3c19 100644 --- a/src/mess/drivers/pasopia7.c +++ b/src/mess/drivers/pasopia7.c @@ -615,7 +615,7 @@ READ8_MEMBER( pasopia7_state::pasopia7_io_r ) return pasopia7_fdc_r(space, offset & 7); else { - logerror("(PC=%06x) Read i/o address %02x\n",cpu_get_pc(m_maincpu),io_port); + logerror("(PC=%06x) Read i/o address %02x\n",m_maincpu->safe_pc(),io_port); } return 0xff; @@ -672,7 +672,7 @@ WRITE8_MEMBER( pasopia7_state::pasopia7_io_w ) pasopia7_fdc_w(space, offset & 7, data); else { - logerror("(PC=%06x) Write i/o address %02x = %02x\n",cpu_get_pc(m_maincpu),offset,data); + logerror("(PC=%06x) Write i/o address %02x = %02x\n",m_maincpu->safe_pc(),offset,data); } } diff --git a/src/mess/drivers/pc8801.c b/src/mess/drivers/pc8801.c index a05f63afa17..2bdeaa82900 100644 --- a/src/mess/drivers/pc8801.c +++ b/src/mess/drivers/pc8801.c @@ -1887,7 +1887,7 @@ WRITE8_MEMBER(pc8801_state::upd765_mc_w) READ8_MEMBER(pc8801_state::upd765_tc_r) { - //printf("%04x 1\n",cpu_get_pc(m_fdccpu)); + //printf("%04x 1\n",m_fdccpu->safe_pc()); upd765_tc_w(machine().device("upd765"), 1); //TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha. diff --git a/src/mess/drivers/pc88va.c b/src/mess/drivers/pc88va.c index 9c90f568624..2e5305d25ff 100644 --- a/src/mess/drivers/pc88va.c +++ b/src/mess/drivers/pc88va.c @@ -641,7 +641,7 @@ WRITE8_MEMBER(pc88va_state::idp_command_w) case SPROV: m_cmd = SPROV; /* TODO: where it returns the info? */ break; /* TODO: 0x89 shouldn't trigger, should be one of the above commands */ - default: m_cmd = 0x00; printf("PC=%05x: Unknown IDP %02x cmd set\n",cpu_get_pc(&space.device()),data); break; + default: m_cmd = 0x00; printf("PC=%05x: Unknown IDP %02x cmd set\n",space.device().safe_pc(),data); break; } } diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c index d0a01ce4388..e0b7d3790b2 100644 --- a/src/mess/drivers/pc9801.c +++ b/src/mess/drivers/pc9801.c @@ -719,7 +719,7 @@ READ8_MEMBER(pc9801_state::pc9801_40_r) printf("Read to undefined port [%02x]\n",offset+0x40); else { - //printf("Read to 8251 kbd port [%02x] %08x\n",offset+0x40,cpu_get_pc(m_maincpu)); + //printf("Read to 8251 kbd port [%02x] %08x\n",offset+0x40,m_maincpu->safe_pc()); if(offset == 1) { UINT8 res; diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c index 971748bf83f..4eb7ef22612 100644 --- a/src/mess/drivers/rainbow.c +++ b/src/mess/drivers/rainbow.c @@ -331,7 +331,7 @@ READ8_MEMBER( rainbow_state::diagnostic_r ) WRITE8_MEMBER( rainbow_state::diagnostic_w ) { -// printf("%02x to diag port (PC=%x)\n", data, cpu_get_pc(&space.device())); +// printf("%02x to diag port (PC=%x)\n", data, space.device().safe_pc()); if (!(data & 1)) { diff --git a/src/mess/drivers/rex6000.c b/src/mess/drivers/rex6000.c index 641d19214ab..c2769fd3cdf 100644 --- a/src/mess/drivers/rex6000.c +++ b/src/mess/drivers/rex6000.c @@ -141,7 +141,7 @@ UINT8 rex6000_state::identify_bank_type(UINT32 bank) } else { - //logerror("%04x: unkonwn memory bank %x\n", cpu_get_pc(m_maincpu), bank); + //logerror("%04x: unkonwn memory bank %x\n", m_maincpu->safe_pc(), bank); return BANK_UNKNOWN; } } diff --git a/src/mess/drivers/rvoice.c b/src/mess/drivers/rvoice.c index f3335245238..78d7d4b3b6d 100644 --- a/src/mess/drivers/rvoice.c +++ b/src/mess/drivers/rvoice.c @@ -132,7 +132,7 @@ static MACHINE_RESET( rvoicepc ) READ8_MEMBER(rvoice_state::main_hd63701_internal_registers_r) { UINT8 data = 0; - logerror("main hd637B01Y0: %04x: read from 0x%02X: ", cpu_get_pc(&space.device()), offset); + logerror("main hd637B01Y0: %04x: read from 0x%02X: ", space.device().safe_pc(), offset); switch(offset) { case 0x00: // Port 1 DDR @@ -214,7 +214,7 @@ READ8_MEMBER(rvoice_state::main_hd63701_internal_registers_r) WRITE8_MEMBER(rvoice_state::main_hd63701_internal_registers_w) { - logerror("main hd637B01Y0: %04x: write to 0x%02X: ", cpu_get_pc(&space.device()), offset); + logerror("main hd637B01Y0: %04x: write to 0x%02X: ", space.device().safe_pc(), offset); switch(offset) { case 0x00: // Port 1 DDR diff --git a/src/mess/drivers/scv.c b/src/mess/drivers/scv.c index da0840cf8ec..1b071bbbeaf 100644 --- a/src/mess/drivers/scv.c +++ b/src/mess/drivers/scv.c @@ -290,7 +290,7 @@ static void scv_set_banks( running_machine &machine ) WRITE8_MEMBER( scv_state::scv_portc_w ) { - //logerror("%04x: scv_portc_w: data = 0x%02x\n", cpu_get_pc(machine().device("maincpu")), data ); + //logerror("%04x: scv_portc_w: data = 0x%02x\n", machine().device("maincpu")->safe_pc(), data ); m_portc = data; scv_set_banks( machine() ); diff --git a/src/mess/drivers/sgi_ip2.c b/src/mess/drivers/sgi_ip2.c index eb158b5e2e6..236bb2917a8 100644 --- a/src/mess/drivers/sgi_ip2.c +++ b/src/mess/drivers/sgi_ip2.c @@ -117,7 +117,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror("%08x: %s", cpu_get_pc(machine.device("maincpu")), buf); + logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf); } } #else diff --git a/src/mess/drivers/sgi_ip6.c b/src/mess/drivers/sgi_ip6.c index f797e736e22..1de7c9c36dc 100644 --- a/src/mess/drivers/sgi_ip6.c +++ b/src/mess/drivers/sgi_ip6.c @@ -55,7 +55,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror("%08x: %s", cpu_get_pc(machine.device("maincpu")), buf); + logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf); } } #else diff --git a/src/mess/drivers/smc777.c b/src/mess/drivers/smc777.c index 16d9ad9bda4..f60072525ac 100644 --- a/src/mess/drivers/smc777.c +++ b/src/mess/drivers/smc777.c @@ -633,11 +633,11 @@ READ8_MEMBER(smc777_state::smc777_io_r) else if(low_offs >= 0x18 && low_offs <= 0x19) { logerror("6845 read %02x",low_offs & 1); } else if(low_offs >= 0x1a && low_offs <= 0x1b) { return key_r(space,low_offs & 1); } else if(low_offs == 0x1c) { return system_input_r(space,0); } - else if(low_offs == 0x1d) { logerror("System and control data R PC=%04x\n",cpu_get_pc(&space.device())); return 0xff; } + else if(low_offs == 0x1d) { logerror("System and control data R PC=%04x\n",space.device().safe_pc()); return 0xff; } else if(low_offs == 0x20) { return display_reg_r(space,0); } else if(low_offs == 0x21) { return smc777_irq_mask_r(space,0); } - else if(low_offs == 0x25) { logerror("RTC read PC=%04x\n",cpu_get_pc(&space.device())); return 0xff; } - else if(low_offs == 0x26) { logerror("RS-232c RX %04x\n",cpu_get_pc(&space.device())); return 0xff; } + else if(low_offs == 0x25) { logerror("RTC read PC=%04x\n",space.device().safe_pc()); return 0xff; } + else if(low_offs == 0x26) { logerror("RS-232c RX %04x\n",space.device().safe_pc()); return 0xff; } else if(low_offs >= 0x28 && low_offs <= 0x2c) { logerror("FDC 2 read %02x\n",low_offs & 7); return 0xff; } else if(low_offs >= 0x2d && low_offs <= 0x2f) { logerror("RS-232c no. 2 read %02x\n",low_offs & 3); return 0xff; } else if(low_offs >= 0x30 && low_offs <= 0x34) { return smc777_fdc1_r(space,low_offs & 7); } @@ -655,7 +655,7 @@ READ8_MEMBER(smc777_state::smc777_io_r) else if(low_offs == 0x7e || low_offs == 0x7f) { logerror("Kanji ROM read %02x\n",low_offs & 1); } else if(low_offs >= 0x80) { return smc777_fbuf_r(space,offset & 0xff7f); } - logerror("Undefined read at %04x offset = %02x\n",cpu_get_pc(&space.device()),low_offs); + logerror("Undefined read at %04x offset = %02x\n",space.device().safe_pc(),low_offs); return 0xff; } @@ -697,7 +697,7 @@ WRITE8_MEMBER(smc777_state::smc777_io_w) else if(low_offs == 0x75) { logerror("VTR Controller ROM write %02x\n",data); } else if(low_offs == 0x7e || low_offs == 0x7f) { logerror("Kanji ROM write [%02x] %02x\n",low_offs & 1,data); } else if(low_offs >= 0x80) { smc777_fbuf_w(space,offset & 0xff7f,data); } - else { logerror("Undefined write at %04x offset = %02x data = %02x\n",cpu_get_pc(&space.device()),low_offs,data); } + else { logerror("Undefined write at %04x offset = %02x data = %02x\n",space.device().safe_pc(),low_offs,data); } } static ADDRESS_MAP_START( smc777_io , AS_IO, 8, smc777_state ) diff --git a/src/mess/drivers/socrates.c b/src/mess/drivers/socrates.c index a5a3d58e19c..93971b536f1 100644 --- a/src/mess/drivers/socrates.c +++ b/src/mess/drivers/socrates.c @@ -268,7 +268,7 @@ READ8_MEMBER(socrates_state::read_f3)// used for read-only i/o ports as mame/mes WRITE8_MEMBER(socrates_state::kbmcu_strobe) // strobe the keyboard MCU { - //logerror("0x%04X: kbmcu written with %02X!\n", cpu_get_pc(m_maincpu), data); //if (cpu_get_pc(m_maincpu) != 0x31D) + //logerror("0x%04X: kbmcu written with %02X!\n", m_maincpu->safe_pc(), data); //if (m_maincpu->safe_pc() != 0x31D) // if two writes happen within one frame, reset the keyboard latches m_kbmcu_rscount++; if (m_kbmcu_rscount > 1) diff --git a/src/mess/drivers/ssystem3.c b/src/mess/drivers/ssystem3.c index 938d1847718..703a9539c2b 100644 --- a/src/mess/drivers/ssystem3.c +++ b/src/mess/drivers/ssystem3.c @@ -92,7 +92,7 @@ static void ssystem3_playfield_write(running_machine &machine, int reset, int si if (d) state->m_playfield.data|=1<<(state->m_playfield.bit^7); state->m_playfield.bit++; if (state->m_playfield.bit==8) { - logerror("%.4x playfield wrote %d %02x\n", (int)cpu_get_pc(machine.device("maincpu")), state->m_playfield.count, state->m_playfield.data); + logerror("%.4x playfield wrote %d %02x\n", (int)machine.device("maincpu")->safe_pc(), state->m_playfield.count, state->m_playfield.data); state->m_playfield.u.data[state->m_playfield.count]=state->m_playfield.data; state->m_playfield.bit=0; state->m_playfield.count=(state->m_playfield.count+1)%ARRAY_LENGTH(state->m_playfield.u.data); diff --git a/src/mess/drivers/supracan.c b/src/mess/drivers/supracan.c index 0b186a3977a..3aed17cf1f4 100644 --- a/src/mess/drivers/supracan.c +++ b/src/mess/drivers/supracan.c @@ -212,7 +212,7 @@ INLINE void verboselog(const char *tag, running_machine &machine, int n_level, c va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%06x: %s: %s", cpu_get_pc(machine.device(tag)), tag, buf ); + logerror( "%06x: %s: %s", machine.device(tag)->safe_pc(), tag, buf ); } } diff --git a/src/mess/drivers/vboy.c b/src/mess/drivers/vboy.c index 65563195f1e..da7e8d500a8 100644 --- a/src/mess/drivers/vboy.c +++ b/src/mess/drivers/vboy.c @@ -793,7 +793,7 @@ READ16_MEMBER( vboy_state::vip_r ) case 0x42: //XPCTRL return m_vip_regs.XPCTRL; case 0x44: //VER - printf("%08x read VER\n",cpu_get_pc(m_maincpu)); + printf("%08x read VER\n",m_maincpu->safe_pc()); return m_vip_regs.VER; case 0x48: //SPT0 return m_vip_regs.SPT[0]; diff --git a/src/mess/drivers/vii.c b/src/mess/drivers/vii.c index 12eee714709..9b407893a90 100644 --- a/src/mess/drivers/vii.c +++ b/src/mess/drivers/vii.c @@ -167,7 +167,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%04x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%04x: %s", machine.device("maincpu")->safe_pc(), buf ); } } #else diff --git a/src/mess/drivers/vk100.c b/src/mess/drivers/vk100.c index 5a011821f59..b36c412f1ee 100644 --- a/src/mess/drivers/vk100.c +++ b/src/mess/drivers/vk100.c @@ -561,7 +561,7 @@ READ8_MEMBER(vk100_state::SYSTAT_A) { UINT8 dipswitchLUT[8] = { 1,3,5,7,6,4,2,0 }; // the dipswitches map in a weird order to offsets #ifdef SYSTAT_A_VERBOSE - if (cpu_get_pc(m_maincpu) != 0x31D) logerror("0x%04X: SYSTAT_A Read!\n", cpu_get_pc(m_maincpu)); + if (m_maincpu->safe_pc() != 0x31D) logerror("0x%04X: SYSTAT_A Read!\n", m_maincpu->safe_pc()); #endif return ((m_vgGO?0:1)<<7)|(vram_read(machine())<<3)|(((ioport("SWITCHES")->read()>>dipswitchLUT[offset])&1)?0x4:0)|(m_vsync?0x2:0); } @@ -585,7 +585,7 @@ READ8_MEMBER(vk100_state::SYSTAT_A) READ8_MEMBER(vk100_state::SYSTAT_B) { #ifdef SYSTAT_B_VERBOSE - logerror("0x%04X: SYSTAT_B Read!\n", cpu_get_pc(m_maincpu)); + logerror("0x%04X: SYSTAT_B Read!\n", m_maincpu->safe_pc()); #endif return (m_ACTS<<7)|0x7F; } diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index c8ab05f1985..bdf3fadf9bf 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -1632,7 +1632,7 @@ READ8_MEMBER( x1_state::x1_io_r ) else if(offset >= 0x4000 && offset <= 0xffff) { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; } else { - //logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(&space->device()),offset); + //logerror("(PC=%06x) Read i/o address %04x\n",space->device().safe_pc(),offset); } return 0xff; } @@ -1675,7 +1675,7 @@ WRITE8_MEMBER( x1_state::x1_io_w ) else if(offset >= 0x4000 && offset <= 0xffff) { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } else { - //logerror("(PC=%06x) Write %02x at i/o address %04x\n",cpu_get_pc(&space->device()),data,offset); + //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space->device().safe_pc(),data,offset); } } @@ -1722,7 +1722,7 @@ READ8_MEMBER( x1_state::x1turbo_io_r ) else if(offset >= 0x4000 && offset <= 0xffff) { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; } else { - //logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(&space->device()),offset); + //logerror("(PC=%06x) Read i/o address %04x\n",space->device().safe_pc(),offset); } return 0xff; } @@ -1778,7 +1778,7 @@ WRITE8_MEMBER( x1_state::x1turbo_io_w ) else if(offset >= 0x4000 && offset <= 0xffff) { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; } else { - //logerror("(PC=%06x) Write %02x at i/o address %04x\n",cpu_get_pc(&space->device()),data,offset); + //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space->device().safe_pc(),data,offset); } } diff --git a/src/mess/drivers/x68k.c b/src/mess/drivers/x68k.c index 4dcfd8e9537..0b37a5f9384 100644 --- a/src/mess/drivers/x68k.c +++ b/src/mess/drivers/x68k.c @@ -1039,7 +1039,7 @@ static WRITE16_HANDLER( x68k_fdc_w ) logerror("FDC: Drive #%i: Drive selection set to %02x\n",data & 0x03,data); break; default: -// logerror("FDC: [%08x] Wrote %04x to invalid FDC port %04x\n",cpu_get_pc(&space->device()),data,offset); +// logerror("FDC: [%08x] Wrote %04x to invalid FDC port %04x\n",space->device().safe_pc(),data,offset); break; } } @@ -1255,7 +1255,7 @@ static WRITE16_HANDLER( x68k_sysport_w ) state->m_sysport.sram_writeprotect = data; break; default: -// logerror("SYS: [%08x] Wrote %04x to invalid or unimplemented system port %04x\n",cpu_get_pc(&space->device()),data,offset); +// logerror("SYS: [%08x] Wrote %04x to invalid or unimplemented system port %04x\n",space->device().safe_pc(),data,offset); break; } } @@ -1296,7 +1296,7 @@ static READ16_HANDLER( x68k_mfp_r ) // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full, // MFP Timer C, and the power switch -// logerror("MFP: [%08x] Reading offset %i\n",cpu_get_pc(&space->device()),offset); +// logerror("MFP: [%08x] Reading offset %i\n",space->device().safe_pc(),offset); switch(offset) { #if 0 @@ -1310,7 +1310,7 @@ static READ16_HANDLER( x68k_mfp_r ) // ret |= 0x08; // FM IRQ signal if(machine.primary_screen->hpos() > state->m_crtc.width - 32) ret |= 0x80; // Hsync signal -// logerror("MFP: [%08x] Reading offset %i (ret=%02x)\n",cpu_get_pc(&space->device()),offset,ret); +// logerror("MFP: [%08x] Reading offset %i (ret=%02x)\n",space->device().safe_pc(),offset,ret); return ret; // bit 5 is always 1 case 3: return state->m_mfp.iera; @@ -1477,7 +1477,7 @@ static WRITE16_HANDLER( x68k_mfp_w ) // Keyboard control command. state->m_mfp.usart.send_buffer = data; x68k_keyboard_ctrl_w(state, data); -// logerror("MFP: [%08x] USART Sent data %04x\n",cpu_get_pc(&space->device()),data); +// logerror("MFP: [%08x] USART Sent data %04x\n",space->device().safe_pc(),data); } break; default: diff --git a/src/mess/machine/3c505.c b/src/mess/machine/3c505.c index 9b74caf4398..3c6c7c8a49e 100644 --- a/src/mess/machine/3c505.c +++ b/src/mess/machine/3c505.c @@ -280,7 +280,7 @@ const char *threecom3c505_device::cpu_context() if (cpu != NULL) { sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(), - cpu_get_previouspc(cpu), tag()); + cpu->safe_pcbase(), tag()); } else { @@ -1252,8 +1252,8 @@ UINT8 threecom3c505_device::read_data_port(){ void threecom3c505_device::write_control_port( UINT8 data) { - // if (cpu_get_previouspc(m_device->machine->firstcpu) == 0x3C4BAD48) verbose = 3; - // if (cpu_get_previouspc(m_device->machine->firstcpu) == 0x010464DC) verbose = 3; + // if (m_device->machine->firstcpu->safe_pcbase() == 0x3C4BAD48) verbose = 3; + // if (m_device->machine->firstcpu->safe_pcbase() == 0x010464DC) verbose = 3; if (verbose <= 2 && (data & (DMAE | TCEN /*| CMDE*/)) != 0) { @@ -1398,7 +1398,7 @@ UINT8 threecom3c505_device::read_port(offs_t offset) // omit excessive logging if (data == last_data) { - UINT32 pc = cpu_get_previouspc(machine().device(MAINCPU)); + UINT32 pc = machine().device(MAINCPU)->safe_pcbase(); if (pc == last_pc) { return data; } diff --git a/src/mess/machine/a2cffa.c b/src/mess/machine/a2cffa.c index b1cb169f663..f18caa8e7a6 100644 --- a/src/mess/machine/a2cffa.c +++ b/src/mess/machine/a2cffa.c @@ -233,7 +233,7 @@ void a2bus_cffa2000_device::write_c800(address_space &space, UINT16 offset, UINT { if (!m_writeprotect) { -// printf("Write %02x to EEPROM at %x (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); +// printf("Write %02x to EEPROM at %x (PC=%x)\n", data, offset, space.device().safe_pc()); m_eeprom[offset + 0x800] = data; } } diff --git a/src/mess/machine/a2memexp.c b/src/mess/machine/a2memexp.c index 8309798460d..34d90f2241a 100644 --- a/src/mess/machine/a2memexp.c +++ b/src/mess/machine/a2memexp.c @@ -140,7 +140,7 @@ UINT8 a2bus_memexp_device::read_c0nx(address_space &space, UINT8 offset) m_regs[2] = ((m_liveptr>>16) & 0xff) | m_bankhior; } -// printf("Read c0n%x (PC=%x) = %02x\n", offset, cpu_get_pc(&space.device()), retval); +// printf("Read c0n%x (PC=%x) = %02x\n", offset, space.device().safe_pc(), retval); return retval; } @@ -152,7 +152,7 @@ UINT8 a2bus_memexp_device::read_c0nx(address_space &space, UINT8 offset) void a2bus_memexp_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) { -// printf("Write %02x to c0n%x (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); +// printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc()); switch (offset) { diff --git a/src/mess/machine/a2mockingboard.c b/src/mess/machine/a2mockingboard.c index 98e51703f13..51f72502b29 100644 --- a/src/mess/machine/a2mockingboard.c +++ b/src/mess/machine/a2mockingboard.c @@ -161,7 +161,7 @@ void a2bus_ayboard_device::device_reset() UINT8 a2bus_ayboard_device::read_cnxx(address_space &space, UINT8 offset) { -// printf("Mockingboard(%d): read @ Cn%02X (PC=%x)\n", m_slot, offset, cpu_get_pc(&space.device())); +// printf("Mockingboard(%d): read @ Cn%02X (PC=%x)\n", m_slot, offset, space.device().safe_pc()); if (m_isPhasor) { UINT8 retVal = 0; @@ -227,7 +227,7 @@ void a2bus_ayboard_device::write_cnxx(address_space &space, UINT8 offset, UINT8 viaSel = (offset & 0x80) ? 2 : 1; } -// printf("Phasor(%d): write %02x to Cn%02X (PC=%x) (native %d viaSel %d)\n", m_slot, data, offset, cpu_get_pc(&space.device()), m_PhasorNative ? 1 : 0, viaSel); +// printf("Phasor(%d): write %02x to Cn%02X (PC=%x) (native %d viaSel %d)\n", m_slot, data, offset, space.device().safe_pc(), m_PhasorNative ? 1 : 0, viaSel); if (viaSel & 1) { @@ -251,7 +251,7 @@ void a2bus_ayboard_device::write_cnxx(address_space &space, UINT8 offset, UINT8 } else { - printf("Mockingboard(%d): unk write %02x to Cn%02X (PC=%x)\n", m_slot, data, offset, cpu_get_pc(&space.device())); + printf("Mockingboard(%d): unk write %02x to Cn%02X (PC=%x)\n", m_slot, data, offset, space.device().safe_pc()); } } } diff --git a/src/mess/machine/a2scsi.c b/src/mess/machine/a2scsi.c index 2609be4ce99..6870168d105 100644 --- a/src/mess/machine/a2scsi.c +++ b/src/mess/machine/a2scsi.c @@ -125,7 +125,7 @@ void a2bus_scsi_device::device_reset() UINT8 a2bus_scsi_device::read_c0nx(address_space &space, UINT8 offset) { - printf("Read c0n%x (PC=%x)\n", offset, cpu_get_pc(&space.device())); + printf("Read c0n%x (PC=%x)\n", offset, space.device().safe_pc()); switch (offset) { @@ -153,7 +153,7 @@ UINT8 a2bus_scsi_device::read_c0nx(address_space &space, UINT8 offset) void a2bus_scsi_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) { - printf("Write %02x to c0n%x (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); + printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc()); switch (offset) { @@ -206,7 +206,7 @@ UINT8 a2bus_scsi_device::read_cnxx(address_space &space, UINT8 offset) void a2bus_scsi_device::write_cnxx(address_space &space, UINT8 offset, UINT8 data) { - printf("Write %02x to cn%02x (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); + printf("Write %02x to cn%02x (PC=%x)\n", data, offset, space.device().safe_pc()); } /*------------------------------------------------- diff --git a/src/mess/machine/a2videoterm.c b/src/mess/machine/a2videoterm.c index dedd69ca661..dfe9b35cbbd 100644 --- a/src/mess/machine/a2videoterm.c +++ b/src/mess/machine/a2videoterm.c @@ -240,7 +240,7 @@ void a2bus_videx80_device::device_reset() UINT8 a2bus_videx80_device::read_c0nx(address_space &space, UINT8 offset) { -// printf("Read c0n%x (PC=%x)\n", offset, cpu_get_pc(&space.device())); +// printf("Read c0n%x (PC=%x)\n", offset, space.device().safe_pc()); m_rambank = ((offset>>2) & 3) * 512; @@ -259,7 +259,7 @@ UINT8 a2bus_videx80_device::read_c0nx(address_space &space, UINT8 offset) void a2bus_videx80_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) { -// printf("Write %02x to c0n%x (PC=%x)\n", data, offset, cpu_get_pc(&space.device())); +// printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc()); if (offset == 0) { diff --git a/src/mess/machine/amigacd.c b/src/mess/machine/amigacd.c index c1463320f1f..a0aba92fb52 100644 --- a/src/mess/machine/amigacd.c +++ b/src/mess/machine/amigacd.c @@ -131,7 +131,7 @@ static READ16_HANDLER( amiga_dmac_r ) case 0x20: { UINT8 v = dmac_data.istr; - LOG(( "DMAC: PC=%08x - ISTR Read(%04x)\n", cpu_get_pc(&space->device()), dmac_data.istr )); + LOG(( "DMAC: PC=%08x - ISTR Read(%04x)\n", space->device().safe_pc(), dmac_data.istr )); dmac_data.istr &= ~0x0f; return v; @@ -140,35 +140,35 @@ static READ16_HANDLER( amiga_dmac_r ) case 0x21: { - LOG(( "DMAC: PC=%08x - CNTR Read(%04x)\n", cpu_get_pc(&space->device()), dmac_data.cntr )); + LOG(( "DMAC: PC=%08x - CNTR Read(%04x)\n", space->device().safe_pc(), dmac_data.cntr )); return dmac_data.cntr; } break; case 0x40: /* wtc hi */ { - LOG(( "DMAC: PC=%08x - WTC HI Read\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - WTC HI Read\n", space->device().safe_pc() )); return (dmac_data.wtc >> 16); } break; case 0x41: /* wtc lo */ { - LOG(( "DMAC: PC=%08x - WTC LO Read\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - WTC LO Read\n", space->device().safe_pc() )); return dmac_data.wtc; } break; case 0x42: /* acr hi */ { - LOG(( "DMAC: PC=%08x - ACR HI Read\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - ACR HI Read\n", space->device().safe_pc() )); return (dmac_data.acr >> 16); } break; case 0x43: /* acr lo */ { - LOG(( "DMAC: PC=%08x - ACR LO Read\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - ACR LO Read\n", space->device().safe_pc() )); return dmac_data.acr; } break; @@ -176,14 +176,14 @@ static READ16_HANDLER( amiga_dmac_r ) case 0x48: /* wd33c93 SCSI expansion */ case 0x49: { - LOG(( "DMAC: PC=%08x - WD33C93 Read(%d)\n", cpu_get_pc(&space->device()), offset & 1 )); + LOG(( "DMAC: PC=%08x - WD33C93 Read(%d)\n", space->device().safe_pc(), offset & 1 )); return 0x00; /* Not available without SCSI expansion */ } break; case 0x50: { - LOG(( "DMAC: PC=%08x - CDROM RESP Read\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - CDROM RESP Read\n", space->device().safe_pc() )); return matsucd_response_r(space->machine()); } break; @@ -192,7 +192,7 @@ static READ16_HANDLER( amiga_dmac_r ) case 0x52: case 0x53: { - LOG(( "DMAC: PC=%08x - XT IO Read(%d)\n", cpu_get_pc(&space->device()), (offset & 3)-1 )); + LOG(( "DMAC: PC=%08x - XT IO Read(%d)\n", space->device().safe_pc(), (offset & 3)-1 )); return 0xff; } break; @@ -215,41 +215,41 @@ static READ16_HANDLER( amiga_dmac_r ) case 0x67: { device_t *tpi = space->machine().device("tpi6525"); - LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", cpu_get_pc(&space->device()), (offset - 0x58) )); + LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", space->device().safe_pc(), (offset - 0x58) )); return tpi6525_r(tpi, offset - 0x58); } break; case 0x70: /* DMA start strobe */ { - LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", space->device().safe_pc() )); dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME )); } break; case 0x71: /* DMA stop strobe */ { - LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", space->device().safe_pc() )); dmac_data.dma_timer->reset( ); } break; case 0x72: /* Clear IRQ strobe */ { - LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", space->device().safe_pc() )); dmac_data.istr &= ~ISTR_INT_P; } break; case 0x74: /* Flush strobe */ { - LOG(( "DMAC: PC=%08x - Flush Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - Flush Strobe\n", space->device().safe_pc() )); dmac_data.istr |= ISTR_FE_FLG; } break; default: - logerror( "DMAC-READ: PC=%08x, offset = %02x\n", cpu_get_pc(&space->device()), offset ); + logerror( "DMAC-READ: PC=%08x, offset = %02x\n", space->device().safe_pc(), offset ); break; } @@ -264,7 +264,7 @@ static WRITE16_HANDLER( amiga_dmac_w ) { case 0x21: /* control write */ { - LOG(( "DMAC: PC=%08x - CNTR Write(%04x)\n", cpu_get_pc(&space->device()), data )); + LOG(( "DMAC: PC=%08x - CNTR Write(%04x)\n", space->device().safe_pc(), data )); dmac_data.cntr = data; check_interrupts(space->machine()); } @@ -272,7 +272,7 @@ static WRITE16_HANDLER( amiga_dmac_w ) case 0x40: /* wtc hi */ { - LOG(( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", cpu_get_pc(&space->device()), data )); + LOG(( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", space->device().safe_pc(), data )); dmac_data.wtc &= 0x0000ffff; dmac_data.wtc |= ((UINT32)data) << 16; } @@ -280,7 +280,7 @@ static WRITE16_HANDLER( amiga_dmac_w ) case 0x41: /* wtc lo */ { - LOG(( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", cpu_get_pc(&space->device()), data )); + LOG(( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", space->device().safe_pc(), data )); dmac_data.wtc &= 0xffff0000; dmac_data.wtc |= data; } @@ -288,7 +288,7 @@ static WRITE16_HANDLER( amiga_dmac_w ) case 0x42: /* acr hi */ { - LOG(( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", cpu_get_pc(&space->device()), data )); + LOG(( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", space->device().safe_pc(), data )); dmac_data.acr &= 0x0000ffff; dmac_data.acr |= ((UINT32)data) << 16; } @@ -296,7 +296,7 @@ static WRITE16_HANDLER( amiga_dmac_w ) case 0x43: /* acr lo */ { - LOG(( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", cpu_get_pc(&space->device()), data )); + LOG(( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", space->device().safe_pc(), data )); dmac_data.acr &= 0xffff0000; dmac_data.acr |= data; } @@ -304,7 +304,7 @@ static WRITE16_HANDLER( amiga_dmac_w ) case 0x47: /* dawr */ { - LOG(( "DMAC: PC=%08x - DAWR Write - data = %04x\n", cpu_get_pc(&space->device()), data )); + LOG(( "DMAC: PC=%08x - DAWR Write - data = %04x\n", space->device().safe_pc(), data )); dmac_data.dawr = data; } break; @@ -312,14 +312,14 @@ static WRITE16_HANDLER( amiga_dmac_w ) case 0x48: /* wd33c93 SCSI expansion */ case 0x49: { - LOG(( "DMAC: PC=%08x - WD33C93 Write(%d) - data = %04x\n", cpu_get_pc(&space->device()), offset & 1, data )); + LOG(( "DMAC: PC=%08x - WD33C93 Write(%d) - data = %04x\n", space->device().safe_pc(), offset & 1, data )); /* Not available without SCSI expansion */ } break; case 0x50: { - LOG(( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", cpu_get_pc(&space->device()), data )); + LOG(( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", space->device().safe_pc(), data )); matsucd_command_w(space->machine(), data ); } break; @@ -342,41 +342,41 @@ static WRITE16_HANDLER( amiga_dmac_w ) case 0x67: { device_t *tpi = space->machine().device("tpi6525"); - LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", cpu_get_pc(&space->device()), (offset - 0x58), data )); + LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", space->device().safe_pc(), (offset - 0x58), data )); tpi6525_w(tpi, offset - 0x58, data); } break; case 0x70: /* DMA start strobe */ { - LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", space->device().safe_pc() )); dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME )); } break; case 0x71: /* DMA stop strobe */ { - LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", space->device().safe_pc() )); dmac_data.dma_timer->reset( ); } break; case 0x72: /* Clear IRQ strobe */ { - LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", space->device().safe_pc() )); dmac_data.istr &= ~ISTR_INT_P; } break; case 0x74: /* Flush Strobe */ { - LOG(( "DMAC: PC=%08x - Flush Strobe\n", cpu_get_pc(&space->device()) )); + LOG(( "DMAC: PC=%08x - Flush Strobe\n", space->device().safe_pc() )); dmac_data.istr |= ISTR_FE_FLG; } break; default: - logerror( "DMAC-WRITE: PC=%08x, offset = %02x, data = %04x\n", cpu_get_pc(&space->device()), offset, data ); + logerror( "DMAC-WRITE: PC=%08x, offset = %02x, data = %04x\n", space->device().safe_pc(), offset, data ); break; } } diff --git a/src/mess/machine/amigacrt.c b/src/mess/machine/amigacrt.c index 0298d617e9b..e5f88ff383c 100644 --- a/src/mess/machine/amigacrt.c +++ b/src/mess/machine/amigacrt.c @@ -113,7 +113,7 @@ static void amiga_ar1_nmi( running_machine &machine ) static WRITE16_HANDLER( amiga_ar1_chipmem_w ) { amiga_state *state = space->machine().driver_data(); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); /* see if we're inside the AR1 rom */ if ( ((pc >> 16) & 0xff ) != 0xf0 ) @@ -192,7 +192,7 @@ static void amiga_ar23_freeze( running_machine &machine ); static READ16_HANDLER( amiga_ar23_cia_r ) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); if ( ACCESSING_BITS_0_7 && offset == 2048 && pc >= 0x40 && pc < 0x120 ) { @@ -263,7 +263,7 @@ static WRITE16_HANDLER( amiga_ar23_chipmem_w ) static void amiga_ar23_freeze( running_machine &machine ) { amiga_state *state = machine.driver_data(); - int pc = cpu_get_pc(machine.device("maincpu")); + int pc = machine.device("maincpu")->safe_pc(); /* only freeze if we're not inside the cart's ROM */ if ( ((pc >> 16) & 0xfe ) != 0x40 ) @@ -299,7 +299,7 @@ static void amiga_ar23_nmi( running_machine &machine ) #if 0 static WRITE16_HANDLER( amiga_ar23_custom_w ) { - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); /* see if we're inside the AR2 rom */ if ( ((pc >> 16) & 0xfe ) != 0x40 ) @@ -320,7 +320,7 @@ static READ16_HANDLER( amiga_ar23_custom_r ) { UINT16 data = amiga_custom_r( offset, mem_mask ); - int pc = cpu_get_pc(&space->device()); + int pc = space->device().safe_pc(); /* see if we're inside the AR2 rom */ if ( ((pc >> 16) & 0xfe ) != 0x40 ) diff --git a/src/mess/machine/apollo_kbd.c b/src/mess/machine/apollo_kbd.c index 6141d20ae50..39c6d92840d 100644 --- a/src/mess/machine/apollo_kbd.c +++ b/src/mess/machine/apollo_kbd.c @@ -149,7 +149,7 @@ const char *apollo_kbd_device::cpu_context() if (cpu != NULL) { sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(), - cpu_get_previouspc(cpu), tag()); + cpu->safe_pcbase(), tag()); } else { diff --git a/src/mess/machine/apple2.c b/src/mess/machine/apple2.c index 39537256074..96a659ecdec 100644 --- a/src/mess/machine/apple2.c +++ b/src/mess/machine/apple2.c @@ -1450,12 +1450,12 @@ READ8_MEMBER ( apple2_state::apple2_c05x_r ) if (offset == 0xa) // RAM { apple2_setvar(space.machine(), VAR_TK2000RAM, ~0); - printf("TK2000: RAM (PC %x)\n", cpu_get_pc(m_maincpu)); + printf("TK2000: RAM (PC %x)\n", m_maincpu->safe_pc()); } else if (offset == 0xb) // ROM { apple2_setvar(space.machine(), 0, ~VAR_TK2000RAM); - printf("TK2000: ROM (PC %x)\n", cpu_get_pc(m_maincpu)); + printf("TK2000: ROM (PC %x)\n", m_maincpu->safe_pc()); } } diff --git a/src/mess/machine/bbc.c b/src/mess/machine/bbc.c index 28a684c0f09..96946fcb413 100644 --- a/src/mess/machine/bbc.c +++ b/src/mess/machine/bbc.c @@ -121,7 +121,7 @@ static int vdudriverset(running_machine &machine) { bbc_state *state = machine.driver_data(); int PC; - PC = cpu_get_pc(machine.device("maincpu")); // this needs to be set to the 6502 program counter + PC = machine.device("maincpu")->safe_pc(); // this needs to be set to the 6502 program counter return (((PC >= 0xc000) && (PC <= 0xdfff)) || ((state->m_pagedRAM) && ((PC >= 0xa000) && (PC <= 0xafff)))); } @@ -398,7 +398,7 @@ WRITE8_MEMBER(bbc_state::bbcm_ACCCON_write) static int bbcm_vdudriverset(running_machine &machine) { int PC; - PC = cpu_get_pc(machine.device("maincpu")); + PC = machine.device("maincpu")->safe_pc(); return ((PC >= 0xc000) && (PC <= 0xdfff)); } diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c index 25d4795fb07..c65a2d83079 100644 --- a/src/mess/machine/bebox.c +++ b/src/mess/machine/bebox.c @@ -170,7 +170,7 @@ WRITE64_HANDLER( bebox_cpu0_imask_w ) if (LOG_CPUIMASK) { logerror("BeBox CPU #0 pc=0x%08X imask=0x%08x\n", - (unsigned) cpu_get_pc( &space->device()), state->m_cpu_imask[0]); + (unsigned) space->device().safe_pc( ), state->m_cpu_imask[0]); } bebox_update_interrupts(space->machine()); } @@ -188,7 +188,7 @@ WRITE64_HANDLER( bebox_cpu1_imask_w ) if (LOG_CPUIMASK) { logerror("BeBox CPU #1 pc=0x%08X imask=0x%08x\n", - (unsigned) cpu_get_pc( &space->device() ), state->m_cpu_imask[1]); + (unsigned) space->device() .safe_pc( ), state->m_cpu_imask[1]); } bebox_update_interrupts(space->machine()); } diff --git a/src/mess/machine/c65.c b/src/mess/machine/c65.c index 03faf452fcc..667f78ca0a0 100644 --- a/src/mess/machine/c65.c +++ b/src/mess/machine/c65.c @@ -508,7 +508,7 @@ static void c65_fdc_state(void) static void c65_fdc_w( running_machine &machine, int offset, int data ) { c65_state *state = machine.driver_data(); - DBG_LOG(machine, 1, "fdc write", ("%.5x %.2x %.2x\n", cpu_get_pc(machine.device("maincpu")), offset, data)); + DBG_LOG(machine, 1, "fdc write", ("%.5x %.2x %.2x\n", machine.device("maincpu")->safe_pc(), offset, data)); switch (offset & 0xf) { case 0: @@ -593,7 +593,7 @@ static int c65_fdc_r( running_machine &machine, int offset ) data = state->m_fdc.reg[offset & 0xf]; break; } - DBG_LOG(machine, 1, "fdc read", ("%.5x %.2x %.2x\n", cpu_get_pc(machine.device("maincpu")), offset, data)); + DBG_LOG(machine, 1, "fdc read", ("%.5x %.2x %.2x\n", machine.device("maincpu")->safe_pc(), offset, data)); return data; } diff --git a/src/mess/machine/coco.c b/src/mess/machine/coco.c index 49482134e14..accabcc79aa 100644 --- a/src/mess/machine/coco.c +++ b/src/mess/machine/coco.c @@ -261,8 +261,8 @@ UINT8 coco_state::floating_bus_read(void) address_space *program = m_maincpu->space(AS_PROGRAM); // get the previous and current PC - UINT16 prev_pc = cpu_get_previouspc(m_maincpu); - UINT16 pc = cpu_get_pc(m_maincpu); + UINT16 prev_pc = m_maincpu->safe_pcbase(); + UINT16 pc = m_maincpu->safe_pc(); // get the byte; and skip over header bytes byte = program->read_byte(prev_pc); diff --git a/src/mess/machine/compis.c b/src/mess/machine/compis.c index 770de5df14b..1b04662e890 100644 --- a/src/mess/machine/compis.c +++ b/src/mess/machine/compis.c @@ -550,7 +550,7 @@ void compis_state::handle_eoi(int data) case 0x0d: m_i186.intr.in_service &= ~0x20; break; case 0x0e: m_i186.intr.in_service &= ~0x40; break; case 0x0f: m_i186.intr.in_service &= ~0x80; break; - default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(m_maincpu), data & 0x1f); + default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", m_maincpu->safe_pc(), data & 0x1f); } if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine().time().as_double(), data & 0x1f); } @@ -718,7 +718,7 @@ void compis_state::internal_timer_update(int which, int new_count, int new_maxA, diff = new_control ^ t->control; if (diff & 0x001c) logerror("%05X:ERROR! -unsupported timer mode %04X\n", - cpu_get_pc(m_maincpu), new_control); + m_maincpu->safe_pc(), new_control); /* if we have real changes, update things */ if (diff != 0) @@ -820,7 +820,7 @@ void compis_state::update_dma_control(int which, int new_control) diff = new_control ^ d->control; if (diff & 0x6811) logerror("%05X:ERROR! - unsupported DMA mode %04X\n", - cpu_get_pc(m_maincpu), new_control); + m_maincpu->safe_pc(), new_control); /* if we're going live, set a timer */ if ((diff & 0x0002) && (new_control & 0x0002)) @@ -877,21 +877,21 @@ READ16_MEMBER( compis_state::compis_i186_internal_port_r ) switch (offset) { case 0x11: - logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(m_maincpu)); + logerror("%05X:ERROR - read from 80186 EOI\n", m_maincpu->safe_pc()); break; case 0x12: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", m_maincpu->safe_pc()); if (m_i186.intr.poll_status & 0x8000) int_callback(machine().device("maincpu"), 0); return m_i186.intr.poll_status; case 0x13: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", m_maincpu->safe_pc()); return m_i186.intr.poll_status; case 0x14: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", m_maincpu->safe_pc()); temp = (m_i186.intr.timer >> 3) & 0x01; temp |= (m_i186.intr.dma[0] >> 1) & 0x04; temp |= (m_i186.intr.dma[1] >> 0) & 0x08; @@ -902,56 +902,56 @@ READ16_MEMBER( compis_state::compis_i186_internal_port_r ) return temp; case 0x15: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", m_maincpu->safe_pc()); return m_i186.intr.priority_mask; case 0x16: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", m_maincpu->safe_pc()); return m_i186.intr.in_service; case 0x17: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", m_maincpu->safe_pc()); temp = m_i186.intr.request & ~0x0001; if (m_i186.intr.status & 0x0007) temp |= 1; return temp; case 0x18: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", m_maincpu->safe_pc()); return m_i186.intr.status; case 0x19: - if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", m_maincpu->safe_pc()); return m_i186.intr.timer; case 0x1a: - if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", m_maincpu->safe_pc()); return m_i186.intr.dma[0]; case 0x1b: - if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", m_maincpu->safe_pc()); return m_i186.intr.dma[1]; case 0x1c: - if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", m_maincpu->safe_pc()); return m_i186.intr.ext[0]; case 0x1d: - if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", m_maincpu->safe_pc()); return m_i186.intr.ext[1]; case 0x1e: - if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", m_maincpu->safe_pc()); return m_i186.intr.ext[2]; case 0x1f: - if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", m_maincpu->safe_pc()); return m_i186.intr.ext[3]; case 0x28: case 0x2c: case 0x30: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(m_maincpu), (offset - 0x28) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", m_maincpu->safe_pc(), (offset - 0x28) / 4); which = (offset - 0x28) / 4; if (!(offset & 1)) internal_timer_sync(which); @@ -960,87 +960,87 @@ READ16_MEMBER( compis_state::compis_i186_internal_port_r ) case 0x29: case 0x2d: case 0x31: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(m_maincpu), (offset - 0x29) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", m_maincpu->safe_pc(), (offset - 0x29) / 4); which = (offset - 0x29) / 4; return m_i186.timer[which].maxA; case 0x2a: case 0x2e: - logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(m_maincpu), (offset - 0x2a) / 4); + logerror("%05X:read 80186 Timer %d max B\n", m_maincpu->safe_pc(), (offset - 0x2a) / 4); which = (offset - 0x2a) / 4; return m_i186.timer[which].maxB; case 0x2b: case 0x2f: case 0x33: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(m_maincpu), (offset - 0x2b) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", m_maincpu->safe_pc(), (offset - 0x2b) / 4); which = (offset - 0x2b) / 4; return m_i186.timer[which].control; case 0x50: - if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", m_maincpu->safe_pc()); return m_i186.mem.upper; case 0x51: - if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", m_maincpu->safe_pc()); return m_i186.mem.lower; case 0x52: - if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", m_maincpu->safe_pc()); return m_i186.mem.peripheral; case 0x53: - if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", m_maincpu->safe_pc()); return m_i186.mem.middle; case 0x54: - if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(m_maincpu)); + if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", m_maincpu->safe_pc()); return m_i186.mem.middle_size; case 0x60: case 0x68: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(m_maincpu), (offset - 0x60) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", m_maincpu->safe_pc(), (offset - 0x60) / 8); which = (offset - 0x60) / 8; // stream_update(dma_stream, 0); return m_i186.dma[which].source; case 0x61: case 0x69: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(m_maincpu), (offset - 0x61) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", m_maincpu->safe_pc(), (offset - 0x61) / 8); which = (offset - 0x61) / 8; // stream_update(dma_stream, 0); return m_i186.dma[which].source >> 16; case 0x62: case 0x6a: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(m_maincpu), (offset - 0x62) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", m_maincpu->safe_pc(), (offset - 0x62) / 8); which = (offset - 0x62) / 8; // stream_update(dma_stream, 0); return m_i186.dma[which].dest; case 0x63: case 0x6b: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(m_maincpu), (offset - 0x63) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", m_maincpu->safe_pc(), (offset - 0x63) / 8); which = (offset - 0x63) / 8; // stream_update(dma_stream, 0); return m_i186.dma[which].dest >> 16; case 0x64: case 0x6c: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(m_maincpu), (offset - 0x64) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", m_maincpu->safe_pc(), (offset - 0x64) / 8); which = (offset - 0x64) / 8; // stream_update(dma_stream, 0); return m_i186.dma[which].count; case 0x65: case 0x6d: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(m_maincpu), (offset - 0x65) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", m_maincpu->safe_pc(), (offset - 0x65) / 8); which = (offset - 0x65) / 8; // stream_update(dma_stream, 0); return m_i186.dma[which].control; default: - logerror("%05X:read 80186 port %02X\n", cpu_get_pc(m_maincpu), offset); + logerror("%05X:read 80186 port %02X\n", m_maincpu->safe_pc(), offset); break; } return 0x00; @@ -1061,21 +1061,21 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) switch (offset) { case 0x11: - if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", m_maincpu->safe_pc(), data16); handle_eoi(0x8000); update_interrupt_state(machine()); break; case 0x12: - logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", cpu_get_pc(m_maincpu), data16); + logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", m_maincpu->safe_pc(), data16); break; case 0x13: - logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", cpu_get_pc(m_maincpu), data16); + logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", m_maincpu->safe_pc(), data16); break; case 0x14: - if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.timer = (m_i186.intr.timer & ~0x08) | ((data16 << 3) & 0x08); m_i186.intr.dma[0] = (m_i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08); m_i186.intr.dma[1] = (m_i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08); @@ -1087,68 +1087,68 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) break; case 0x15: - if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.priority_mask = data16 & 0x0007; update_interrupt_state(machine()); break; case 0x16: - if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.in_service = data16 & 0x00ff; update_interrupt_state(machine()); break; case 0x17: - if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.request = (m_i186.intr.request & ~0x00c0) | (data16 & 0x00c0); update_interrupt_state(machine()); break; case 0x18: - if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.status = (m_i186.intr.status & ~0x8007) | (data16 & 0x8007); update_interrupt_state(machine()); break; case 0x19: - if (LOG_PORTS) logerror("%05X:80186 timer interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 timer interrupt control = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.timer = data16 & 0x000f; break; case 0x1a: - if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.dma[0] = data16 & 0x000f; break; case 0x1b: - if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.dma[1] = data16 & 0x000f; break; case 0x1c: - if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.ext[0] = data16 & 0x007f; break; case 0x1d: - if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.ext[1] = data16 & 0x007f; break; case 0x1e: - if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.ext[2] = data16 & 0x001f; break; case 0x1f: - if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", m_maincpu->safe_pc(), data16); m_i186.intr.ext[3] = data16 & 0x001f; break; case 0x28: case 0x2c: case 0x30: - if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x28) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", m_maincpu->safe_pc(), (offset - 0x28) / 4, data16); which = (offset - 0x28) / 4; internal_timer_update(which, data16, -1, -1, -1); break; @@ -1156,14 +1156,14 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x29: case 0x2d: case 0x31: - if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x29) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", m_maincpu->safe_pc(), (offset - 0x29) / 4, data16); which = (offset - 0x29) / 4; internal_timer_update(which, -1, data16, -1, -1); break; case 0x2a: case 0x2e: - if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x2a) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", m_maincpu->safe_pc(), (offset - 0x2a) / 4, data16); which = (offset - 0x2a) / 4; internal_timer_update(which, -1, -1, data16, -1); break; @@ -1171,33 +1171,33 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x2b: case 0x2f: case 0x33: - if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x2b) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", m_maincpu->safe_pc(), (offset - 0x2b) / 4, data16); which = (offset - 0x2b) / 4; internal_timer_update(which, -1, -1, -1, data16); break; case 0x50: - if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", m_maincpu->safe_pc(), data16); m_i186.mem.upper = data16 | 0xc038; break; case 0x51: - if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", m_maincpu->safe_pc(), data16); m_i186.mem.lower = (data16 & 0x3fff) | 0x0038; //printf("%X\n",m_i186.mem.lower); break; case 0x52: - if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", m_maincpu->safe_pc(), data16); m_i186.mem.peripheral = data16 | 0x0038; break; case 0x53: - if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", m_maincpu->safe_pc(), data16); m_i186.mem.middle = data16 | 0x01f8; break; case 0x54: - if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", m_maincpu->safe_pc(), data16); m_i186.mem.middle_size = data16 | 0x8038; temp = (m_i186.mem.peripheral & 0xffc0) << 4; @@ -1221,7 +1221,7 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x60: case 0x68: - if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x60) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", m_maincpu->safe_pc(), (offset - 0x60) / 8, data16); which = (offset - 0x60) / 8; // stream_update(dma_stream, 0); m_i186.dma[which].source = (m_i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff); @@ -1229,7 +1229,7 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x61: case 0x69: - if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x61) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", m_maincpu->safe_pc(), (offset - 0x61) / 8, data16); which = (offset - 0x61) / 8; // stream_update(dma_stream, 0); m_i186.dma[which].source = (m_i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000); @@ -1237,7 +1237,7 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x62: case 0x6a: - if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x62) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", m_maincpu->safe_pc(), (offset - 0x62) / 8, data16); which = (offset - 0x62) / 8; // stream_update(dma_stream, 0); m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff); @@ -1245,7 +1245,7 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x63: case 0x6b: - if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x63) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", m_maincpu->safe_pc(), (offset - 0x63) / 8, data16); which = (offset - 0x63) / 8; // stream_update(dma_stream, 0); m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000); @@ -1253,7 +1253,7 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x64: case 0x6c: - if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x64) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", m_maincpu->safe_pc(), (offset - 0x64) / 8, data16); which = (offset - 0x64) / 8; // stream_update(dma_stream, 0); m_i186.dma[which].count = data16; @@ -1261,14 +1261,14 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x65: case 0x6d: - if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x65) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", m_maincpu->safe_pc(), (offset - 0x65) / 8, data16); which = (offset - 0x65) / 8; // stream_update(dma_stream, 0); update_dma_control(which, data16); break; case 0x7f: - if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", cpu_get_pc(m_maincpu), data16); + if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", m_maincpu->safe_pc(), data16); /* we assume here there that this doesn't happen too often */ /* plus, we can't really remove the old memory range, so we also assume that it's */ @@ -1289,7 +1289,7 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) break; default: - logerror("%05X:80186 port %02X = %04X\n", cpu_get_pc(m_maincpu), offset, data16); + logerror("%05X:80186 port %02X = %04X\n", m_maincpu->safe_pc(), offset, data16); break; } } diff --git a/src/mess/machine/cuda.c b/src/mess/machine/cuda.c index 547e90e1eb1..de423c2eb00 100644 --- a/src/mess/machine/cuda.c +++ b/src/mess/machine/cuda.c @@ -108,7 +108,7 @@ const rom_entry *cuda_device::device_rom_region() const void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data) { -// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], cpu_get_pc(m_maincpu)); +// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->safe_pc()); switch (offset) { @@ -138,21 +138,21 @@ void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data) if (treq != ((data>>1)&1)) { #ifdef CUDA_SUPER_VERBOSE - printf("CU-> TREQ: %d (PC=%x)\n", (data>>1)&1, cpu_get_pc(m_maincpu)); + printf("CU-> TREQ: %d (PC=%x)\n", (data>>1)&1, m_maincpu->safe_pc()); #endif treq = (data>>1) & 1; } if (via_data != ((data>>5)&1)) { #ifdef CUDA_SUPER_VERBOSE - printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, cpu_get_pc(m_maincpu)); + printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->safe_pc()); #endif via_data = (data>>5) & 1; } if (via_clock != ((data>>4)&1)) { #ifdef CUDA_SUPER_VERBOSE - printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, cpu_get_pc(m_maincpu)); + printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->safe_pc()); #endif via_clock = (data>>4) & 1; via6522_device *via1 = machine().device("via6522_0"); @@ -165,7 +165,7 @@ void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data) if ((data & 8) != reset_line) { #ifdef CUDA_SUPER_VERBOSE - printf("680x0 reset: %d -> %d (PC=%x)\n", (ports[2] & 8)>>3, (data & 8)>>3, cpu_get_pc(m_maincpu)); + printf("680x0 reset: %d -> %d (PC=%x)\n", (ports[2] & 8)>>3, (data & 8)>>3, m_maincpu->safe_pc()); #endif reset_line = (data & 8); // falling edge, should reset the machine too @@ -193,7 +193,7 @@ READ8_MEMBER( cuda_device::ddr_r ) WRITE8_MEMBER( cuda_device::ddr_w ) { -// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, cpu_get_pc(m_maincpu)); +// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->safe_pc()); send_port(space, offset, ports[offset] & data); @@ -251,7 +251,7 @@ READ8_MEMBER( cuda_device::ports_r ) incoming |= 0x01; } -// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], cpu_get_pc(m_maincpu)); +// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->safe_pc()); return incoming; } @@ -279,7 +279,7 @@ WRITE8_MEMBER( cuda_device::pll_w ) (data & 0x40) ? 1 : 0, (data & 0x20) ? 1 : 0, (data & 0x10) ? 1 : 0, - (data & 0x08) ? 1 : 0, cpu_get_pc(m_maincpu)); + (data & 0x08) ? 1 : 0, m_maincpu->safe_pc()); } #endif pll_ctrl = data; @@ -300,7 +300,7 @@ WRITE8_MEMBER( cuda_device::timer_ctrl_w ) { attotime::from_seconds(8), attotime::from_msec(250.0f), attotime::from_msec(125.1f), attotime::from_msec(62.5f), attotime::from_msec(31.3f) }, }; -// printf("%02x to timer control (PC=%x)\n", data, cpu_get_pc(m_maincpu)); +// printf("%02x to timer control (PC=%x)\n", data, m_maincpu->safe_pc()); if (data & 0x50) { @@ -334,7 +334,7 @@ READ8_MEMBER( cuda_device::timer_counter_r ) WRITE8_MEMBER( cuda_device::timer_counter_w ) { -// printf("%02x to timer counter (PC=%x)\n", data, cpu_get_pc(m_maincpu)); +// printf("%02x to timer counter (PC=%x)\n", data, m_maincpu->safe_pc()); timer_counter = data; ripple_counter = timer_counter; } diff --git a/src/mess/machine/dccons.c b/src/mess/machine/dccons.c index 9931bc74bdc..3d672c6ee84 100644 --- a/src/mess/machine/dccons.c +++ b/src/mess/machine/dccons.c @@ -261,7 +261,7 @@ static READ32_HANDLER( atapi_r ) } #endif - mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(&space->device())); + mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, space->device().safe_pc()); } // printf( "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data ); @@ -420,11 +420,11 @@ static WRITE32_HANDLER( atapi_w ) } #endif atapi_regs[reg] = data; -// mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, cpu_get_pc(&space->device())); +// mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, space->device().safe_pc()); if (reg == ATAPI_REG_CMDSTATUS) { - printf("ATAPI command %x issued! (PC=%x)\n", data, cpu_get_pc(&space->device())); + printf("ATAPI command %x issued! (PC=%x)\n", data, space->device().safe_pc()); switch (data) { @@ -603,7 +603,7 @@ READ64_HANDLER( dc_mess_gdrom_r ) off=offset << 1; } -// printf("gdrom_r: @ %x (off %x), mask %llx (PC %x)\n", offset, off, mem_mask, cpu_get_pc(&space->device())); +// printf("gdrom_r: @ %x (off %x), mask %llx (PC %x)\n", offset, off, mem_mask, space->device().safe_pc()); if (offset == 3) { @@ -632,7 +632,7 @@ WRITE64_HANDLER( dc_mess_gdrom_w ) off=offset << 1; } -// printf("GDROM: [%08x=%x]write %llx to %x, mask %llx (PC %x)\n", 0x5f7000+off*4, dat, data, offset, mem_mask, cpu_get_pc(&space->device())); +// printf("GDROM: [%08x=%x]write %llx to %x, mask %llx (PC %x)\n", 0x5f7000+off*4, dat, data, offset, mem_mask, space->device().safe_pc()); if (off >= 0x20) { diff --git a/src/mess/machine/dec_lk201.c b/src/mess/machine/dec_lk201.c index df1428498c0..f4197e2d108 100644 --- a/src/mess/machine/dec_lk201.c +++ b/src/mess/machine/dec_lk201.c @@ -107,7 +107,7 @@ READ8_MEMBER( lk201_device::ddr_r ) WRITE8_MEMBER( lk201_device::ddr_w ) { -// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, cpu_get_pc(m_maincpu)); +// printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->safe_pc()); send_port(space, offset, ports[offset] & data); @@ -135,7 +135,7 @@ READ8_MEMBER( lk201_device::ports_r ) // add in ddr-masked version of port writes incoming |= (ports[offset] & ddrs[offset]); -// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], cpu_get_pc(m_maincpu)); +// printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->safe_pc()); return incoming; } @@ -149,7 +149,7 @@ WRITE8_MEMBER( lk201_device::ports_w ) void lk201_device::send_port(address_space &space, UINT8 offset, UINT8 data) { -// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], cpu_get_pc(m_maincpu)); +// printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->safe_pc()); switch (offset) { @@ -187,7 +187,7 @@ READ8_MEMBER( lk201_device::sci_r ) break; } -// printf("SCI read @ %x = %02x (PC=%x)\n", offset, incoming, cpu_get_pc(m_maincpu)); +// printf("SCI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->safe_pc()); return incoming; } @@ -212,7 +212,7 @@ WRITE8_MEMBER( lk201_device::sci_w ) break; } -// printf("SCI %02x to %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu)); +// printf("SCI %02x to %x (PC=%x)\n", data, offset, m_maincpu->safe_pc()); } READ8_MEMBER( lk201_device::spi_r ) @@ -232,7 +232,7 @@ READ8_MEMBER( lk201_device::spi_r ) break; } -// printf("SPI read @ %x = %02x (PC=%x)\n", offset, incoming, cpu_get_pc(m_maincpu)); +// printf("SPI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->safe_pc()); return incoming; } @@ -251,7 +251,7 @@ WRITE8_MEMBER( lk201_device::spi_w ) break; } -// printf("SPI %02x to %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu)); +// printf("SPI %02x to %x (PC=%x)\n", data, offset, m_maincpu->safe_pc()); } /* diff --git a/src/mess/machine/dgn_beta.c b/src/mess/machine/dgn_beta.c index 27fe31ce5c8..5c53fe0959f 100644 --- a/src/mess/machine/dgn_beta.c +++ b/src/mess/machine/dgn_beta.c @@ -265,7 +265,7 @@ static void UpdateBanks(running_machine &machine, int first, int last) int MapPage; char page_num[10]; - LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,cpu_get_pc(&space_0->device()))); + LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,space_0->device().safe_pc())); for(Page=first;Page<=last;Page++) { sprintf(page_num,"bank%d",Page+1); diff --git a/src/mess/machine/egret.c b/src/mess/machine/egret.c index 230de55ed4a..fbc9effeb11 100644 --- a/src/mess/machine/egret.c +++ b/src/mess/machine/egret.c @@ -137,21 +137,21 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data) if (xcvr_session != ((data>>1)&1)) { #ifdef EGRET_SUPER_VERBOSE - printf("EG-> XCVR_SESSION: %d (PC=%x)\n", (data>>1)&1, cpu_get_pc(m_maincpu)); + printf("EG-> XCVR_SESSION: %d (PC=%x)\n", (data>>1)&1, m_maincpu->safe_pc()); #endif xcvr_session = (data>>1) & 1; } if (via_data != ((data>>5)&1)) { #ifdef EGRET_SUPER_VERBOSE - printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, cpu_get_pc(m_maincpu)); + printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->safe_pc()); #endif via_data = (data>>5) & 1; } if (via_clock != ((data>>4)&1)) { #ifdef EGRET_SUPER_VERBOSE - printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, cpu_get_pc(m_maincpu)); + printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->safe_pc()); #endif via_clock = (data>>4) & 1; via6522_device *via1 = machine().device("via6522_0"); diff --git a/src/mess/machine/gamecom.c b/src/mess/machine/gamecom.c index 49a278029c8..f62610e101c 100644 --- a/src/mess/machine/gamecom.c +++ b/src/mess/machine/gamecom.c @@ -329,7 +329,7 @@ WRITE8_MEMBER( gamecom_state::gamecom_internal_w ) case SM8521_55: case SM8521_56: case SM8521_57: case SM8521_58: case SM8521_59: case SM8521_5A: case SM8521_5B: case SM8521_5C: case SM8521_5D: - logerror( "%X: Write to reserved address (0x%02X). Value written: 0x%02X\n", cpu_get_pc(m_maincpu), offset, data ); + logerror( "%X: Write to reserved address (0x%02X). Value written: 0x%02X\n", m_maincpu->safe_pc(), offset, data ); break; } m_p_ram[offset] = data; diff --git a/src/mess/machine/gb.c b/src/mess/machine/gb.c index 7e2e403db02..82154ca3dfd 100644 --- a/src/mess/machine/gb.c +++ b/src/mess/machine/gb.c @@ -430,7 +430,7 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc2) WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc3) { - logerror( "0x%04X: write to mbc3 rom bank select register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data ); + logerror( "0x%04X: write to mbc3 rom bank select register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data ); data &= 0x7F; /* Only uses lower 7 bits */ /* Selecting bank 0 == selecting bank 1 */ if( data == 0 ) @@ -447,7 +447,7 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc5) Writing into 2000-2FFF sets the lower 8 bits Writing into 3000-3FFF sets the 9th bit */ - logerror( "0x%04X: MBC5 ROM Bank select write 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data ); + logerror( "0x%04X: MBC5 ROM Bank select write 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data ); if( offset & 0x1000 ) { m_ROMBank = (m_ROMBank & 0xFF ) | ( ( data & 0x01 ) << 8 ); @@ -462,12 +462,12 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc5) WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc6) { - logerror( "0x%04X: write to mbc6 ram enable area: %04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data ); + logerror( "0x%04X: write to mbc6 ram enable area: %04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data ); } WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc6_1) { - logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x2000 + offset, data ); + logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x2000 + offset, data ); if ( offset & 0x0800 ) { if ( data == 0x00 ) @@ -483,7 +483,7 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc6_1) WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc6_2) { - logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x3000 + offset, data ); + logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x3000 + offset, data ); if ( offset & 0x0800 ) { if ( data == 0x00 ) @@ -499,7 +499,7 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc6_2) WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc7) { - logerror( "0x%04X: write to mbc7 rom select register: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x2000 + offset, data ); + logerror( "0x%04X: write to mbc7 rom select register: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x2000 + offset, data ); /* Bit 12 must be set for writing to the mbc register */ if ( offset & 0x0100 ) { @@ -510,7 +510,7 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc7) WRITE8_MEMBER(gb_state::gb_rom_bank_unknown_mbc7) { - logerror( "0x%04X: write to mbc7 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x3000 + offset, data ); + logerror( "0x%04X: write to mbc7 rom area: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x3000 + offset, data ); /* Bit 12 must be set for writing to the mbc register */ if ( offset & 0x0100 ) { @@ -528,7 +528,7 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_unknown_mbc7) WRITE8_MEMBER(gb_state::gb_rom_bank_select_wisdom) { - logerror( "0x%04X: wisdom tree mapper write to address 0x%04X\n", cpu_get_pc( &space.device() ), offset ); + logerror( "0x%04X: wisdom tree mapper write to address 0x%04X\n", space.device() .safe_pc( ), offset ); /* The address determines the bank to select */ m_ROMBank = ( offset << 1 ) & 0x1FF; membank( "bank5" )->set_base( m_ROMMap[ m_ROMBank ] ); @@ -549,7 +549,7 @@ WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc1) WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc3) { - logerror( "0x%04X: write mbc3 ram bank select register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data ); + logerror( "0x%04X: write mbc3 ram bank select register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data ); if( data & 0x8 ) { /* RTC banks */ if ( m_CartType & TIMER ) @@ -573,7 +573,7 @@ WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc3) WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc5) { - logerror( "0x%04X: MBC5 RAM Bank select write 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data ); + logerror( "0x%04X: MBC5 RAM Bank select write 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data ); data &= 0x0F; if( m_CartType & RUMBLE ) { @@ -588,7 +588,7 @@ WRITE8_MEMBER(gb_state::gb_ram_enable) { /* FIXME: Currently we don't handle this, but a value of 0xA will enable * writing to the cart's RAM banks */ - logerror( "0x%04X: Write to ram enable register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data ); + logerror( "0x%04X: Write to ram enable register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data ); } WRITE8_MEMBER(gb_state::gb_mem_mode_select_mbc1) @@ -599,7 +599,7 @@ WRITE8_MEMBER(gb_state::gb_mem_mode_select_mbc1) WRITE8_MEMBER(gb_state::gb_mem_mode_select_mbc3) { - logerror( "0x%04X: Write to mbc3 mem mode select register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data ); + logerror( "0x%04X: Write to mbc3 mem mode select register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data ); if( m_CartType & TIMER ) { /* FIXME: RTC Latch goes here */ @@ -613,7 +613,7 @@ WRITE8_MEMBER(gb_state::gb_mem_mode_select_mbc3) WRITE8_MEMBER(gb_state::gb_ram_tama5) { - logerror( "0x%04X: TAMA5 write 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0xA000 + offset, data ); + logerror( "0x%04X: TAMA5 write 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0xA000 + offset, data ); switch( offset & 0x0001 ) { case 0x0000: /* Write to data register */ @@ -657,7 +657,7 @@ WRITE8_MEMBER(gb_state::gb_ram_tama5) } case 0x80: /* Unknown, some kind of read (when 07=01)/write (when 07=00/02) */ default: - logerror( "0x%04X: Unknown addressing mode\n", cpu_get_pc( &space.device() ) ); + logerror( "0x%04X: Unknown addressing mode\n", space.device() .safe_pc( ) ); break; } break; @@ -684,7 +684,7 @@ WRITE8_MEMBER(gb_state::gb_ram_tama5) m_MBC3RTCData[0] = ( m_gbTama5Byte & 0xF0 ) >> 4; break; default: - logerror( "0x%04X: Unknown tama5 command 0x%02X\n", cpu_get_pc( &space.device() ), data ); + logerror( "0x%04X: Unknown tama5 command 0x%02X\n", space.device() .safe_pc( ), data ); break; } m_gbLastTama5Command = data; @@ -697,7 +697,7 @@ WRITE8_MEMBER(gb_state::gb_ram_tama5) WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_0000_w) { - logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x000 ); + logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x000 ); if ( data & 0x40 ) { m_mmm01_bank_offset = m_mmm01_reg1; @@ -709,7 +709,7 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_0000_w) WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_2000_w) { - logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x2000 ); + logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x2000 ); m_mmm01_reg1 = data & m_ROMMask; m_mmm01_bank = m_mmm01_reg1 & m_mmm01_bank_mask; @@ -722,12 +722,12 @@ WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_2000_w) WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_4000_w) { - logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x4000 ); + logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x4000 ); } WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_6000_w) { - logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x6000 ); + logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x6000 ); /* Not sure if this is correct, Taito Variety Pack sets these values */ /* Momotarou Collection 2 writes 01 and 21 here */ switch( data ) diff --git a/src/mess/machine/hp48.c b/src/mess/machine/hp48.c index 371002ea203..95624cda2aa 100644 --- a/src/mess/machine/hp48.c +++ b/src/mess/machine/hp48.c @@ -166,7 +166,7 @@ static void hp48_rs232_send_byte( running_machine &machine ) UINT8 data = HP48_IO_8(0x16); /* byte to send */ LOG_SERIAL(( "%05x %f hp48_rs232_send_byte: start sending, data=%02x\n", - cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), data )); + machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), data )); /* set byte sending and send buffer full */ state->m_io[0x12] |= 3; @@ -244,7 +244,7 @@ void hp48_reg_out( device_t *device, int out ) { hp48_state *state = device->machine().driver_data(); LOG(( "%05x %f hp48_reg_out: %03x\n", - cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), out )); + device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), out )); /* bits 0-8: keyboard lines */ state->m_out = out & 0x1ff; @@ -282,7 +282,7 @@ int hp48_reg_in( device_t *device ) { int in = hp48_get_in(device->machine()); LOG(( "%05x %f hp48_reg_in: %04x\n", - cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), in )); + device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), in )); return in; } @@ -327,7 +327,7 @@ static TIMER_CALLBACK( hp48_kbd_cb ) void hp48_rsi( device_t *device ) { hp48_state *state = device->machine().driver_data(); - LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double() )); + LOG(( "%05x %f hp48_rsi\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double() )); /* enables interrupts on key repeat (normally, there is only one interrupt, when the key is pressed) @@ -370,7 +370,7 @@ static WRITE8_HANDLER ( hp48_io_w ) { hp48_state *state = space->machine().driver_data(); LOG(( "%05x %f hp48_io_w: off=%02x data=%x\n", - cpu_get_previouspc(&space->device()), space->machine().time().as_double(), offset, data )); + space->device().safe_pcbase(), space->machine().time().as_double(), offset, data )); switch( offset ) { @@ -413,7 +413,7 @@ static WRITE8_HANDLER ( hp48_io_w ) /* cards */ case 0x0e: - LOG(( "%05x: card control write %02x\n", cpu_get_previouspc(&space->device()), data )); + LOG(( "%05x: card control write %02x\n", space->device().safe_pcbase(), data )); /* bit 0: software interrupt */ if ( data & 1 ) @@ -432,7 +432,7 @@ static WRITE8_HANDLER ( hp48_io_w ) break; case 0x0f: - LOG(( "%05x: card info write %02x\n", cpu_get_previouspc(&space->device()), data )); + LOG(( "%05x: card info write %02x\n", space->device().safe_pcbase(), data )); state->m_io[0x0f] = data; break; @@ -563,7 +563,7 @@ static READ8_HANDLER ( hp48_io_r ) /* cards */ case 0x0e: /* detection */ data = state->m_io[0x0e]; - LOG(( "%05x: card control read %02x\n", cpu_get_previouspc(&space->device()), data )); + LOG(( "%05x: card control read %02x\n", space->device().safe_pcbase(), data )); break; case 0x0f: /* card info */ data = 0; @@ -581,7 +581,7 @@ static READ8_HANDLER ( hp48_io_r ) if ( state->m_port_size[0] && state->m_port_write[0] ) data |= 4; if ( state->m_port_size[1] && state->m_port_write[1] ) data |= 8; } - LOG(( "%05x: card info read %02x\n", cpu_get_previouspc(&space->device()), data )); + LOG(( "%05x: card info read %02x\n", space->device().safe_pcbase(), data )); break; @@ -589,7 +589,7 @@ static READ8_HANDLER ( hp48_io_r ) } LOG(( "%05x %f hp48_io_r: off=%02x data=%x\n", - cpu_get_previouspc(&space->device()), space->machine().time().as_double(), offset, data )); + space->device().safe_pcbase(), space->machine().time().as_double(), offset, data )); return data; } @@ -603,7 +603,7 @@ static READ8_HANDLER ( hp48_bank_r ) offset &= 0x7e; if ( state->m_bank_switch != offset ) { - LOG(( "%05x %f hp48_bank_r: off=%03x\n", cpu_get_previouspc(&space->device()), space->machine().time().as_double(), offset )); + LOG(( "%05x %f hp48_bank_r: off=%03x\n", space->device().safe_pcbase(), space->machine().time().as_double(), offset )); state->m_bank_switch = offset; hp48_apply_modules(state); } @@ -834,7 +834,7 @@ static void hp48_reset_modules( running_machine &machine ) /* RESET opcode */ void hp48_mem_reset( device_t *device ) { - LOG(( "%05x %f hp48_mem_reset\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double() )); + LOG(( "%05x %f hp48_mem_reset\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double() )); hp48_reset_modules(device->machine()); } @@ -845,7 +845,7 @@ void hp48_mem_config( device_t *device, int v ) hp48_state *state = device->machine().driver_data(); int i; - LOG(( "%05x %f hp48_mem_config: %05x\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), v )); + LOG(( "%05x %f hp48_mem_config: %05x\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), v )); /* find the highest priority unconfigured module (except non-configurable NCE1)... */ for ( i = 0; i < 5; i++ ) @@ -877,7 +877,7 @@ void hp48_mem_unconfig( device_t *device, int v ) { hp48_state *state = device->machine().driver_data(); int i; - LOG(( "%05x %f hp48_mem_unconfig: %05x\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), v )); + LOG(( "%05x %f hp48_mem_unconfig: %05x\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), v )); /* find the highest priority fully configured module at address v (except NCE1)... */ for ( i = 0; i < 5; i++ ) @@ -921,7 +921,7 @@ int hp48_mem_id( device_t *device ) } LOG(( "%05x %f hp48_mem_id = %02x\n", - cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data )); + device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data )); return data; /* everything is configured */ } diff --git a/src/mess/machine/intv.c b/src/mess/machine/intv.c index 27dc0372d85..47dff96e5d3 100644 --- a/src/mess/machine/intv.c +++ b/src/mess/machine/intv.c @@ -253,7 +253,7 @@ WRITE8_MEMBER( intv_state::intvkbd_dualport8_msb_w ) intvkbd_tms9927_w(space, offset-0xc0, data); break; default: - logerror("%04X: Unknown write %02x to 0x40%02x\n",cpu_get_pc(&space.device()),data,offset); + logerror("%04X: Unknown write %02x to 0x40%02x\n",space.device().safe_pc(),data,offset); break; } } diff --git a/src/mess/machine/isa_hdc.c b/src/mess/machine/isa_hdc.c index 079deb24627..e2ae64d81d2 100644 --- a/src/mess/machine/isa_hdc.c +++ b/src/mess/machine/isa_hdc.c @@ -796,7 +796,7 @@ static READ8_DEVICE_HANDLER(pc_HDC_r ) } if (LOG_HDC_CALL) - logerror("pc_HDC_r(): pc=%06X offs=%d result=0x%02x\n", cpu_get_pc(device->machine().firstcpu), offset, data); + logerror("pc_HDC_r(): pc=%06X offs=%d result=0x%02x\n", device->machine().firstcpu->safe_pc(), offset, data); return data; } @@ -805,7 +805,7 @@ static WRITE8_DEVICE_HANDLER( pc_HDC_w ) { isa8_hdc_device *hdc = downcast(device); if (LOG_HDC_CALL) - logerror("pc_HDC_w(): pc=%06X offs=%d data=0x%02x\n", cpu_get_pc(device->machine().firstcpu), offset, data); + logerror("pc_HDC_w(): pc=%06X offs=%d data=0x%02x\n", device->machine().firstcpu->safe_pc(), offset, data); switch( offset ) { diff --git a/src/mess/machine/isa_ide_cd.c b/src/mess/machine/isa_ide_cd.c index 46e493cbec8..c6a7ef37e26 100644 --- a/src/mess/machine/isa_ide_cd.c +++ b/src/mess/machine/isa_ide_cd.c @@ -127,7 +127,7 @@ READ16_MEMBER( isa16_ide_cd_device::atapi_r ) } if (m_cur_drive==1) return 0x00; data = atapi_regs[reg]; - //logerror("ATAPI: reg %d = %x (offset %x mask %x) [%08x][read]\n", reg, data, offset, mem_mask,cpu_get_pc(machine().device("maincpu"))); + //logerror("ATAPI: reg %d = %x (offset %x mask %x) [%08x][read]\n", reg, data, offset, mem_mask,machine().device("maincpu")->safe_pc()); data <<= shift; } return data; diff --git a/src/mess/machine/lisa.c b/src/mess/machine/lisa.c index a85ac230efa..8da893e2da6 100644 --- a/src/mess/machine/lisa.c +++ b/src/mess/machine/lisa.c @@ -1515,12 +1515,12 @@ READ16_MEMBER(lisa_state::lisa_r) if ((time_in_frame >= 364) && (time_in_frame <= 375)) { answer = m_videoROM_ptr[m_videoROM_address|0x80] << 8; - logerror("reading1 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc(machine().device("maincpu")), time_in_frame); + logerror("reading1 %06X=%04x PC=%06x time=%d\n", address, answer, machine().device("maincpu")->safe_pc(), time_in_frame); } else { answer = m_videoROM_ptr[m_videoROM_address] << 8; - logerror("reading2 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc(machine().device("maincpu")), time_in_frame); + logerror("reading2 %06X=%04x PC=%06x time=%d\n", address, answer, machine().device("maincpu")->safe_pc(), time_in_frame); } } @@ -1782,19 +1782,19 @@ INLINE void cpu_board_control_access(running_machine &machine, offs_t offset) state->m_seg &= ~2; break; case 0x0010: /* SETUP register SET */ - logerror("setup SET PC=%x\n", cpu_get_pc(machine.device("maincpu"))); + logerror("setup SET PC=%x\n", machine.device("maincpu")->safe_pc()); state->m_setup = 1; break; case 0x0012: /* SETUP register RESET */ - logerror("setup UNSET PC=%x\n", cpu_get_pc(machine.device("maincpu"))); + logerror("setup UNSET PC=%x\n", machine.device("maincpu")->safe_pc()); state->m_setup = 0; break; case 0x001A: /* Enable Vertical Retrace Interrupt */ - logerror("enable retrace PC=%x\n", cpu_get_pc(machine.device("maincpu"))); + logerror("enable retrace PC=%x\n", machine.device("maincpu")->safe_pc()); state->m_VTMSK = 1; break; case 0x0018: /* Disable Vertical Retrace Interrupt */ - logerror("disable retrace PC=%x\n", cpu_get_pc(machine.device("maincpu"))); + logerror("disable retrace PC=%x\n", machine.device("maincpu")->safe_pc()); state->m_VTMSK = 0; set_VTIR(machine, 2); break; @@ -1928,7 +1928,7 @@ READ16_MEMBER(lisa_state::lisa_IO_r) else answer |= 0x04; /* huh... we need to emulate some other bits */ - logerror("read status PC=%x val=%x\n", cpu_get_pc(machine().device("maincpu")), answer); + logerror("read status PC=%x val=%x\n", machine().device("maincpu")->safe_pc(), answer); break; } diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c index 31f3f77071b..0f8d2c29673 100644 --- a/src/mess/machine/mac.c +++ b/src/mess/machine/mac.c @@ -1049,7 +1049,7 @@ WRITE16_MEMBER ( mac_state::macii_scsi_w ) { int reg = (offset>>3) & 0xf; -// logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space->device())); +// logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, space->device().safe_pc()); if ((reg == 0) && (offset == 0x100)) { @@ -1158,7 +1158,7 @@ READ16_MEMBER ( mac_state::mac_iwm_r ) result = applefdc_r(fdc, (offset >> 8)); if (LOG_MAC_IWM) - printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, cpu_get_pc(m_maincpu)); + printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, m_maincpu->safe_pc()); return (result << 8) | result; } @@ -1168,7 +1168,7 @@ WRITE16_MEMBER ( mac_state::mac_iwm_w ) device_t *fdc = space.machine().device("fdc"); if (LOG_MAC_IWM) - printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, cpu_get_pc(m_maincpu)); + printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, m_maincpu->safe_pc()); if (ACCESSING_BITS_0_7) applefdc_w(fdc, (offset >> 8), data & 0xff); @@ -1266,7 +1266,7 @@ static READ8_DEVICE_HANDLER(mac_via_in_a) { mac_state *mac = device->machine().driver_data(); -// printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(device->machine().device("maincpu"))); +// printf("VIA1 IN_A (PC %x)\n", device->machine().device("maincpu")->safe_pc()); switch (mac->m_model) { @@ -1376,7 +1376,7 @@ static READ8_DEVICE_HANDLER(mac_via_in_b) val |= 1; } -// printf("VIA1 IN_B = %02x (PC %x)\n", val, cpu_get_pc(device->machine().device("maincpu"))); +// printf("VIA1 IN_B = %02x (PC %x)\n", val, device->machine().device("maincpu")->safe_pc()); return val; } @@ -1387,7 +1387,7 @@ static WRITE8_DEVICE_HANDLER(mac_via_out_a) device_t *fdc = device->machine().device("fdc"); mac_state *mac = device->machine().driver_data(); -// printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu"))); +// printf("VIA1 OUT A: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc()); if (ADB_IS_PM_VIA1) { @@ -1431,7 +1431,7 @@ static WRITE8_DEVICE_HANDLER(mac_via_out_b) int new_rtc_rTCClk; mac_state *mac = device->machine().driver_data(); -// printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu"))); +// printf("VIA1 OUT B: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc()); if (ADB_IS_PM_VIA1) { @@ -1534,7 +1534,7 @@ static WRITE8_DEVICE_HANDLER(mac_via_out_b) else if (ADB_IS_EGRET) { #if LOG_ADB - printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, cpu_get_pc(mac->m_maincpu)); + printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->safe_pc()); #endif mac->m_egret->set_via_full((data&0x10) ? 1 : 0); mac->m_egret->set_sys_session((data&0x20) ? 1 : 0); @@ -1542,7 +1542,7 @@ static WRITE8_DEVICE_HANDLER(mac_via_out_b) else if (ADB_IS_CUDA) { #if LOG_ADB - printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, cpu_get_pc(mac->m_maincpu)); + printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->safe_pc()); #endif mac->m_cuda->set_byteack((data&0x10) ? 1 : 0); mac->m_cuda->set_tip((data&0x20) ? 1 : 0); @@ -1609,7 +1609,7 @@ READ16_MEMBER ( mac_state::mac_via2_r ) data = m_via2->read(space, offset); if (LOG_VIA) - logerror("mac_via2_r: offset=0x%02x = %02x (PC=%x)\n", offset*2, data, cpu_get_pc(space.machine().device("maincpu"))); + logerror("mac_via2_r: offset=0x%02x = %02x (PC=%x)\n", offset*2, data, space.machine().device("maincpu")->safe_pc()); return (data & 0xff) | (data << 8); } @@ -1620,7 +1620,7 @@ WRITE16_MEMBER ( mac_state::mac_via2_w ) offset &= 0x0f; if (LOG_VIA) - logerror("mac_via2_w: offset=%x data=0x%08x mask=%x (PC=%x)\n", offset, data, mem_mask, cpu_get_pc(space.machine().device("maincpu"))); + logerror("mac_via2_w: offset=%x data=0x%08x mask=%x (PC=%x)\n", offset, data, mem_mask, space.machine().device("maincpu")->safe_pc()); if (ACCESSING_BITS_0_7) m_via2->write(space, offset, data & 0xff); @@ -1654,7 +1654,7 @@ static READ8_DEVICE_HANDLER(mac_via2_in_b) { mac_state *mac =device->machine().driver_data(); -// logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(device->machine().device("maincpu"))); +// logerror("VIA2 IN B (PC %x)\n", device->machine().device("maincpu")->safe_pc()); if (ADB_IS_PM_VIA2) { @@ -1685,7 +1685,7 @@ static WRITE8_DEVICE_HANDLER(mac_via2_out_a) { mac_state *mac = device->machine().driver_data(); -// logerror("VIA2 OUT A: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu"))); +// logerror("VIA2 OUT A: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc()); if (ADB_IS_PM_VIA2) { mac->m_pm_data_send = data; @@ -1697,7 +1697,7 @@ static WRITE8_DEVICE_HANDLER(mac_via2_out_b) { mac_state *mac = device->machine().driver_data(); -// logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu"))); +// logerror("VIA2 OUT B: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc()); if (ADB_IS_PM_VIA2) { @@ -2012,7 +2012,7 @@ DIRECT_UPDATE_MEMBER(mac_state::overlay_opbaseoverride) READ32_MEMBER(mac_state::mac_read_id) { -// printf("Mac read ID reg @ PC=%x\n", cpu_get_pc(m_maincpu)); +// printf("Mac read ID reg @ PC=%x\n", m_maincpu->safe_pc()); switch (m_model) { diff --git a/src/mess/machine/macpci.c b/src/mess/machine/macpci.c index 0ee51aa6328..92e9c61bb3d 100644 --- a/src/mess/machine/macpci.c +++ b/src/mess/machine/macpci.c @@ -53,7 +53,7 @@ static READ8_DEVICE_HANDLER(mac_via_in_a) { // macpci_state *mac = device->machine().driver_data(); -// printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(mac->m_maincpu)); +// printf("VIA1 IN_A (PC %x)\n", mac->m_maincpu->safe_pc()); return 0x80; } @@ -65,7 +65,7 @@ static READ8_DEVICE_HANDLER(mac_via_in_b) val |= mac->m_cuda->get_treq()<<3; -// printf("VIA1 IN B = %02x (PC %x)\n", val, cpu_get_pc(mac->m_maincpu)); +// printf("VIA1 IN B = %02x (PC %x)\n", val, mac->m_maincpu->safe_pc()); return val; } @@ -74,17 +74,17 @@ static WRITE8_DEVICE_HANDLER(mac_via_out_a) { // macpci_state *mac = device->machine().driver_data(); -// printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(mac->m_maincpu)); +// printf("VIA1 OUT A: %02x (PC %x)\n", data, mac->m_maincpu->safe_pc()); } static WRITE8_DEVICE_HANDLER(mac_via_out_b) { macpci_state *mac = device->machine().driver_data(); -// printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(mac->m_maincpu)); +// printf("VIA1 OUT B: %02x (PC %x)\n", data, mac->m_maincpu->safe_pc()); #if LOG_ADB - printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, cpu_get_pc(mac->m_maincpu)); + printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->safe_pc()); #endif mac->m_cuda->set_byteack((data&0x10) ? 1 : 0); mac->m_cuda->set_tip((data&0x20) ? 1 : 0); @@ -98,7 +98,7 @@ READ16_MEMBER ( macpci_state::mac_via_r ) offset &= 0x0f; if (LOG_VIA) - printf("mac_via_r: offset=0x%02x (PC=%x)\n", offset, cpu_get_pc(m_maincpu)); + printf("mac_via_r: offset=0x%02x (PC=%x)\n", offset, m_maincpu->safe_pc()); data = m_via1->read(space, offset); device_adjust_icount(m_maincpu, m_via_cycles); @@ -112,7 +112,7 @@ WRITE16_MEMBER ( macpci_state::mac_via_w ) offset &= 0x0f; if (LOG_VIA) - printf("mac_via_w: offset=0x%02x data=0x%08x (PC=%x)\n", offset, data, cpu_get_pc(m_maincpu)); + printf("mac_via_w: offset=0x%02x data=0x%08x (PC=%x)\n", offset, data, m_maincpu->safe_pc()); if (ACCESSING_BITS_0_7) m_via1->write(space, offset, data & 0xff); @@ -181,7 +181,7 @@ MAC_DRIVER_INIT(pippin, PCIMODEL_MAC_PIPPIN) READ32_MEMBER(macpci_state::mac_read_id) { - printf("Mac read ID reg @ PC=%x\n", cpu_get_pc(m_maincpu)); + printf("Mac read ID reg @ PC=%x\n", m_maincpu->safe_pc()); switch (m_model) { diff --git a/src/mess/machine/mb8795.c b/src/mess/machine/mb8795.c index fcc0ea89061..279d659af35 100644 --- a/src/mess/machine/mb8795.c +++ b/src/mess/machine/mb8795.c @@ -86,7 +86,7 @@ bool mb8795_device::mcast_chk(const UINT8 *buf, int len) READ8_MEMBER(mb8795_device::txstat_r) { - // fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, cpu_get_pc(&space.device())); + // fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, space.device().safe_pc()); return txstat; } @@ -94,12 +94,12 @@ WRITE8_MEMBER(mb8795_device::txstat_w) { txstat = txstat & (0xf0 | ~data); check_irq(); - fprintf(stderr, "mb8795: txstat_w %02x (%08x)\n", txstat, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: txstat_w %02x (%08x)\n", txstat, space.device().safe_pc()); } READ8_MEMBER(mb8795_device::txmask_r) { - fprintf(stderr, "mb8795: txmask_r %02x (%08x)\n", txmask, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: txmask_r %02x (%08x)\n", txmask, space.device().safe_pc()); return txmask; } @@ -107,12 +107,12 @@ WRITE8_MEMBER(mb8795_device::txmask_w) { txmask = data & 0xaf; check_irq(); - fprintf(stderr, "mb8795: txmask_w %02x (%08x)\n", txmask, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: txmask_w %02x (%08x)\n", txmask, space.device().safe_pc()); } READ8_MEMBER(mb8795_device::rxstat_r) { - fprintf(stderr, "mb8795: rxstat_r %02x (%08x)\n", rxstat, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: rxstat_r %02x (%08x)\n", rxstat, space.device().safe_pc()); return rxstat; } @@ -120,12 +120,12 @@ WRITE8_MEMBER(mb8795_device::rxstat_w) { rxstat = rxstat & (0x70 | ~data); check_irq(); - fprintf(stderr, "mb8795: rxstat_w %02x (%08x)\n", rxstat, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: rxstat_w %02x (%08x)\n", rxstat, space.device().safe_pc()); } READ8_MEMBER(mb8795_device::rxmask_r) { - fprintf(stderr, "mb8795: rxmask_r %02x (%08x)\n", rxmask, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: rxmask_r %02x (%08x)\n", rxmask, space.device().safe_pc()); return rxmask; } @@ -133,31 +133,31 @@ WRITE8_MEMBER(mb8795_device::rxmask_w) { rxmask = data & 0x9f; check_irq(); - fprintf(stderr, "mb8795: rxmask_w %02x (%08x)\n", rxmask, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: rxmask_w %02x (%08x)\n", rxmask, space.device().safe_pc()); } READ8_MEMBER(mb8795_device::txmode_r) { - fprintf(stderr, "mb8795: txmode_r %02x (%08x)\n", txmode, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: txmode_r %02x (%08x)\n", txmode, space.device().safe_pc()); return txmode; } WRITE8_MEMBER(mb8795_device::txmode_w) { txmode = data; - fprintf(stderr, "mb8795: txmode_w %02x (%08x)\n", txmode, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: txmode_w %02x (%08x)\n", txmode, space.device().safe_pc()); } READ8_MEMBER(mb8795_device::rxmode_r) { - fprintf(stderr, "mb8795: rxmode_r %02x (%08x)\n", rxmode, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: rxmode_r %02x (%08x)\n", rxmode, space.device().safe_pc()); return rxmode; } WRITE8_MEMBER(mb8795_device::rxmode_w) { rxmode = data; - fprintf(stderr, "mb8795: rxmode_w %02x (%08x)\n", rxmode, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: rxmode_w %02x (%08x)\n", rxmode, space.device().safe_pc()); } WRITE8_MEMBER(mb8795_device::reset_w) @@ -168,7 +168,7 @@ WRITE8_MEMBER(mb8795_device::reset_w) READ8_MEMBER(mb8795_device::tdc_lsb_r) { - fprintf(stderr, "mb8795: tdc_lsb_r %02x (%08x)\n", txcount & 0xff, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: tdc_lsb_r %02x (%08x)\n", txcount & 0xff, space.device().safe_pc()); return txcount; } @@ -177,7 +177,7 @@ READ8_MEMBER(mb8795_device::mac_r) if(offset < 6) return mac[offset]; if(offset == 7) { - fprintf(stderr, "mb8795: tdc_msb_r %02x (%08x)\n", txcount >> 8, cpu_get_pc(&space.device())); + fprintf(stderr, "mb8795: tdc_msb_r %02x (%08x)\n", txcount >> 8, space.device().safe_pc()); return (txcount >> 8) & 0x3f; } return 0; diff --git a/src/mess/machine/mc6843.c b/src/mess/machine/mc6843.c index 13c69bc6807..f49531bf9b5 100644 --- a/src/mess/machine/mc6843.c +++ b/src/mess/machine/mc6843.c @@ -427,7 +427,7 @@ READ8_DEVICE_HANDLER ( mc6843_r ) int cmd = mc6843->CMR & 0x0f; LOG(( "%f $%04x mc6843_r: data input cmd=%s(%i), pos=%i/%i, GCR=%i, ", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843_cmd[cmd], cmd, mc6843->data_idx, mc6843->data_size, mc6843->GCR )); @@ -480,7 +480,7 @@ READ8_DEVICE_HANDLER ( mc6843_r ) { /* XXX TODO: other read modes */ data = mc6843->data[0]; - logerror( "$%04x mc6843 read in unsupported command mode %i\n", cpu_get_previouspc( device->machine().firstcpu ), cmd ); + logerror( "$%04x mc6843 read in unsupported command mode %i\n", device->machine().firstcpu ->safe_pcbase( ), cmd ); } LOG(( "data=%02X\n", data )); @@ -491,14 +491,14 @@ READ8_DEVICE_HANDLER ( mc6843_r ) case 1: /* Current-Track Address Register (CTAR) */ data = mc6843->CTAR; LOG(( "%f $%04x mc6843_r: read CTAR %i (actual=%i)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, floppy_drive_get_current_track( mc6843_floppy_image( device ) ) )); break; case 2: /* Interrupt Status Register (ISR) */ data = mc6843->ISR; LOG(( "%f $%04x mc6843_r: read ISR %02X: cmd=%scomplete settle=%scomplete sense-rq=%i STRB=%i\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, (data & 1) ? "" : "not-" , (data & 2) ? "" : "not-", (data >> 2) & 1, (data >> 3) & 1 )); @@ -524,7 +524,7 @@ READ8_DEVICE_HANDLER ( mc6843_r ) data = mc6843->STRA; LOG(( "%f $%04x mc6843_r: read STRA %02X: data-rq=%i del-dta=%i ready=%i t0=%i wp=%i trk-dif=%i idx=%i busy=%i\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1, (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 )); break; @@ -533,7 +533,7 @@ READ8_DEVICE_HANDLER ( mc6843_r ) case 4: /* Status Register B (STRB) */ data = mc6843->STRB; LOG(( "%f $%04x mc6843_r: read STRB %02X: data-err=%i CRC-err=%i dta--mrk-err=%i sect-mrk-err=%i seek-err=%i fi=%i wr-err=%i hard-err=%i\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1, (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 )); @@ -545,12 +545,12 @@ READ8_DEVICE_HANDLER ( mc6843_r ) case 7: /* Logical-Track Address Register (LTAR) */ data = mc6843->LTAR; LOG(( "%f $%04x mc6843_r: read LTAR %i (actual=%i)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, floppy_drive_get_current_track( mc6843_floppy_image( device ) ) )); break; default: - logerror( "$%04x mc6843 invalid read offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset ); + logerror( "$%04x mc6843 invalid read offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset ); } return data; @@ -567,7 +567,7 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) int FWF = (mc6843->CMR >> 4) & 1; LOG(( "%f $%04x mc6843_w: data output cmd=%s(%i), pos=%i/%i, GCR=%i, data=%02X\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843_cmd[cmd], cmd, mc6843->data_idx, mc6843->data_size, mc6843->GCR, data )); @@ -584,7 +584,7 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) /* end of sector write */ device_t* img = mc6843_floppy_image( device ); - LOG(( "%f $%04x mc6843_w: write sector %i\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->data_id )); + LOG(( "%f $%04x mc6843_w: write sector %i\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->data_id )); floppy_drive_write_sector_data( img, mc6843->side, mc6843->data_id, @@ -648,7 +648,7 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) UINT8 track = mc6843->data[1]; UINT8 sector = mc6843->data[3]; UINT8 filler = 0xe5; /* standard Thomson filler */ - LOG(( "%f $%04x mc6843_w: address id detected track=%i sector=%i\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), track, sector)); + LOG(( "%f $%04x mc6843_w: address id detected track=%i sector=%i\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), track, sector)); floppy_drive_format_sector( img, mc6843->side, sector, track, 0, sector, 0, filler ); } else @@ -670,7 +670,7 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) else { /* XXX TODO: other write modes */ - logerror( "$%04x mc6843 write %02X in unsupported command mode %i (FWF=%i)\n", cpu_get_previouspc( device->machine().firstcpu ), data, cmd, FWF ); + logerror( "$%04x mc6843 write %02X in unsupported command mode %i (FWF=%i)\n", device->machine().firstcpu ->safe_pcbase( ), data, cmd, FWF ); } break; } @@ -678,7 +678,7 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) case 1: /* Current-Track Address Register (CTAR) */ mc6843->CTAR = data & 0x7f; LOG(( "%f $%04x mc6843_w: set CTAR to %i %02X (actual=%i) \n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->CTAR, data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->CTAR, data, floppy_drive_get_current_track( mc6843_floppy_image( device ) ) )); break; @@ -687,7 +687,7 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) int cmd = data & 15; LOG(( "%f $%04x mc6843_w: set CMR to $%02X: cmd=%s(%i) FWF=%i DMA=%i ISR3-intr=%i fun-intr=%i\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, mc6843_cmd[cmd], cmd, (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 )); @@ -734,36 +734,36 @@ WRITE8_DEVICE_HANDLER ( mc6843_w ) /* assume CLK freq = 1MHz (IBM 3740 compatibility) */ LOG(( "%f $%04x mc6843_w: set SUR to $%02X: head settling time=%fms, track-to-track seek time=%f\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, 4.096 * (data & 15), 1.024 * ((data >> 4) & 15) )); break; case 4: /* Sector Address Register (SAR) */ mc6843->SAR = data & 0x1f; - LOG(( "%f $%04x mc6843_w: set SAR to %i (%02X)\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->SAR, data )); + LOG(( "%f $%04x mc6843_w: set SAR to %i (%02X)\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->SAR, data )); break; case 5: /* General Count Register (GCR) */ mc6843->GCR = data & 0x7f; - LOG(( "%f $%04x mc6843_w: set GCR to %i (%02X)\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->GCR, data )); + LOG(( "%f $%04x mc6843_w: set GCR to %i (%02X)\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->GCR, data )); break; case 6: /* CRC Control Register (CCR) */ mc6843->CCR = data & 3; LOG(( "%f $%04x mc6843_w: set CCR to %02X: CRC=%s shift=%i\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data, (data & 1) ? "enabled" : "disabled", (data >> 1) & 1 )); break; case 7: /* Logical-Track Address Register (LTAR) */ mc6843->LTAR = data & 0x7f; LOG(( "%f $%04x mc6843_w: set LTAR to %i %02X (actual=%i)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->LTAR, data, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->LTAR, data, floppy_drive_get_current_track( mc6843_floppy_image( device ) ) )); break; default: - logerror( "$%04x mc6843 invalid write offset %i (data=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), offset, data ); + logerror( "$%04x mc6843 invalid write offset %i (data=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), offset, data ); } } diff --git a/src/mess/machine/mc6846.c b/src/mess/machine/mc6846.c index 9f7d17143dc..482425b3de5 100644 --- a/src/mess/machine/mc6846.c +++ b/src/mess/machine/mc6846.c @@ -267,7 +267,7 @@ READ8_DEVICE_HANDLER ( mc6846_r ) case 0: case 4: LOG (( "$%04x %f: mc6846 CSR read $%02X intr=%i (timer=%i, cp1=%i, cp2=%i)\n", - cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), + device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->csr, (mc6846->csr >> 7) & 1, mc6846->csr & 1, (mc6846->csr >> 1) & 1, (mc6846->csr >> 2) & 1 )); mc6846->csr0_to_be_cleared = mc6846->csr & 1; @@ -276,15 +276,15 @@ READ8_DEVICE_HANDLER ( mc6846_r ) return mc6846->csr; case 1: - LOG (( "$%04x %f: mc6846 PCR read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->pcr )); + LOG (( "$%04x %f: mc6846 PCR read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->pcr )); return mc6846->pcr; case 2: - LOG (( "$%04x %f: mc6846 DDR read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->ddr )); + LOG (( "$%04x %f: mc6846 DDR read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->ddr )); return mc6846->ddr; case 3: - LOG (( "$%04x %f: mc6846 PORT read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), PORT )); + LOG (( "$%04x %f: mc6846 PORT read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), PORT )); if ( ! (mc6846->pcr & 0x80) ) { if ( mc6846->csr1_to_be_cleared ) @@ -298,11 +298,11 @@ READ8_DEVICE_HANDLER ( mc6846_r ) return PORT; case 5: - LOG (( "$%04x %f: mc6846 TCR read $%02X\n",cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->tcr )); + LOG (( "$%04x %f: mc6846 TCR read $%02X\n",device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->tcr )); return mc6846->tcr; case 6: - LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846_counter( device ) >> 8 )); + LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846_counter( device ) >> 8 )); if ( mc6846->csr0_to_be_cleared ) { mc6846->csr &= ~1; @@ -312,7 +312,7 @@ READ8_DEVICE_HANDLER ( mc6846_r ) return mc6846_counter( device ) >> 8; case 7: - LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846_counter( device ) & 0xff )); + LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846_counter( device ) & 0xff )); if ( mc6846->csr0_to_be_cleared ) { mc6846->csr &= ~1; @@ -322,7 +322,7 @@ READ8_DEVICE_HANDLER ( mc6846_r ) return mc6846_counter( device ) & 0xff; default: - logerror( "$%04x mc6846 invalid read offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset ); + logerror( "$%04x mc6846 invalid read offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset ); } return 0; } @@ -353,7 +353,7 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) "latcged,pos-edge", "latcged,pos-edge,intr" }; LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n", - cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data, + device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data, (data >> 7) & 1, cp2[ (data >> 3) & 7 ], cp1[ data & 7 ] )); } @@ -366,7 +366,7 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) mc6846_update_irq( device ); } if ( data & 4 ) - logerror( "$%04x mc6846 CP1 latching not implemented\n", cpu_get_previouspc( device->machine().firstcpu ) ); + logerror( "$%04x mc6846 CP1 latching not implemented\n", device->machine().firstcpu ->safe_pcbase( ) ); if (data & 0x20) { if (data & 0x10) @@ -376,12 +376,12 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) mc6846->iface->out_cp2_func( device, 0, mc6846->cp2_cpu ); } else - logerror( "$%04x mc6846 acknowledge not implemented\n", cpu_get_previouspc( device->machine().firstcpu ) ); + logerror( "$%04x mc6846 acknowledge not implemented\n", device->machine().firstcpu ->safe_pcbase( ) ); } break; case 2: - LOG (( "$%04x %f: mc6846 DDR write $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data )); + LOG (( "$%04x %f: mc6846 DDR write $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data )); if ( ! (mc6846->pcr & 0x80) ) { mc6846->ddr = data; @@ -391,7 +391,7 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) break; case 3: - LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data,mc6846->ddr )); + LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data,mc6846->ddr )); if ( ! (mc6846->pcr & 0x80) ) { mc6846->pdr = data; @@ -400,12 +400,12 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) if ( mc6846->csr1_to_be_cleared && (mc6846->csr & 2) ) { mc6846->csr &= ~2; - LOG (( "$%04x %f: mc6846 CP1 intr reset\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double() )); + LOG (( "$%04x %f: mc6846 CP1 intr reset\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double() )); } if ( mc6846->csr2_to_be_cleared && (mc6846->csr & 4) ) { mc6846->csr &= ~4; - LOG (( "$%04x %f: mc6846 CP2 intr reset\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double() )); + LOG (( "$%04x %f: mc6846 CP2 intr reset\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double() )); } mc6846->csr1_to_be_cleared = 0; mc6846->csr2_to_be_cleared = 0; @@ -421,7 +421,7 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) "freq-cmp", "freq-cmp", "pulse-cmp", "pulse-cmp" }; LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n", - cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data, + device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data, (data >> 7) & 1, (data & 0x40) ? "extern" : "sys", (data & 0x40) ? 1 : 8, mode[ (data >> 1) & 7 ], (data & 1) ? "enabled" : "0" )); @@ -455,7 +455,7 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) case 7: mc6846->latch = ( ((UINT16) mc6846->time_MSB) << 8 ) + data; - LOG (( "$%04x %f: mc6846 COUNT write %i\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->latch )); + LOG (( "$%04x %f: mc6846 COUNT write %i\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->latch )); if (!(mc6846->tcr & 0x38)) { /* timer initialization */ @@ -471,7 +471,7 @@ WRITE8_DEVICE_HANDLER ( mc6846_w ) break; default: - logerror( "$%04x mc6846 invalid write offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset ); + logerror( "$%04x mc6846 invalid write offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset ); } } diff --git a/src/mess/machine/mc6854.c b/src/mess/machine/mc6854.c index 6159f100378..9c43eed5fd9 100644 --- a/src/mess/machine/mc6854.c +++ b/src/mess/machine/mc6854.c @@ -808,7 +808,7 @@ READ8_DEVICE_HANDLER ( mc6854_r ) case 0: /* status register 1 */ mc6854_update_sr1( mc6854 ); LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->sr1, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->sr1, ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0, ( mc6854->sr1 & FD ) ? 1 : 0, ( mc6854->sr1 & CTS ) ? 1 : 0, ( mc6854->sr1 & TU ) ? 1 : 0, ( mc6854->sr1 & TDRA) ? 1 : 0, @@ -818,7 +818,7 @@ READ8_DEVICE_HANDLER ( mc6854_r ) case 1: /* status register 2 */ mc6854_update_sr2( mc6854 ); LOG(( "%f $%04x mc6854_r: get SR2=$%02X (ap=%i,fv=%i,ridle=%i,rabt=%i,err=%i,dcd=%i,ovrn=%i,rda2=%i)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->sr2, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->sr2, ( mc6854->sr2 & AP ) ? 1 : 0, ( mc6854->sr2 & FV ) ? 1 : 0, ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0, ( mc6854->sr2 & ERR ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0, @@ -830,12 +830,12 @@ READ8_DEVICE_HANDLER ( mc6854_r ) { UINT8 data = mc6854_rfifo_pop( device ); LOG(( "%f $%04x mc6854_r: get data $%02X\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data )); + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data )); return data; } default: - logerror( "$%04x mc6854 invalid read offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset ); + logerror( "$%04x mc6854 invalid read offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset ); } return 0; } @@ -851,7 +851,7 @@ WRITE8_DEVICE_HANDLER ( mc6854_w ) case 0: /* control register 1 */ mc6854->cr1 = data; LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr1, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->cr1, AC ? 1 : 0, RIE ? 'r' : '-', TIE ? 't' : '-', DISCONTINUE ? "discontinue," : "", @@ -859,7 +859,7 @@ WRITE8_DEVICE_HANDLER ( mc6854_w ) )); if ( mc6854->cr1 & 0xc ) logerror( "$%04x mc6854 DMA not handled (CR1=$%02X)\n", - cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr1 ); + device->machine().firstcpu ->safe_pcbase( ), mc6854->cr1 ); if ( DISCONTINUE ) { /* abort receive FIFO but keeps shift register & synchro */ @@ -888,15 +888,15 @@ WRITE8_DEVICE_HANDLER ( mc6854_w ) /* control register 3 */ mc6854->cr3 = data; LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr3, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->cr3, LCF ? (CEX ? 16 : 8) : 0, AEX ? 1 : 0, IDL0 ? 0 : 1, FDSE ? 1 : 0, LOOP ? 1 : 0, TST ? 1 : 0, DTR ? 1 : 0 )); if ( LOOP ) - logerror( "$%04x mc6854 loop mode not handled (CR3=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr3 ); + logerror( "$%04x mc6854 loop mode not handled (CR3=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), mc6854->cr3 ); if ( TST ) - logerror( "$%04x mc6854 test mode not handled (CR3=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr3 ); + logerror( "$%04x mc6854 test mode not handled (CR3=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), mc6854->cr3 ); mc6854->out_dtr_func( DTR ? 1 : 0 ); @@ -906,13 +906,13 @@ WRITE8_DEVICE_HANDLER ( mc6854_w ) /* control register 2 */ mc6854->cr2 = data; LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n", - device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr2, + device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->cr2, PSE ? 1 : 0, TWOBYTES ? 2 : 1, FMIDLE ? 1 : 0, FCTDRA ? "fc" : "tdra", TLAST ? 1 : 0, data & 0x20 ? 'r' : '-', data & 0x40 ? 't' : '-', RTS ? 1 : 0 )); if ( PSE ) - logerror( "$%04x mc6854 status prioritization not handled (CR2=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr2 ); + logerror( "$%04x mc6854 status prioritization not handled (CR2=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), mc6854->cr2 ); if ( TLAST ) mc6854_tfifo_terminate( device ); if ( data & 0x20 ) @@ -936,7 +936,7 @@ WRITE8_DEVICE_HANDLER ( mc6854_w ) break; case 2: /* transmitter data: continue data */ - LOG(( "%f $%04xmc6854_w: push data=$%02X\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data )); + LOG(( "%f $%04xmc6854_w: push data=$%02X\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data )); mc6854_tfifo_push( device, data ); break; @@ -945,7 +945,7 @@ WRITE8_DEVICE_HANDLER ( mc6854_w ) { /* control register 4 */ mc6854->cr4 = data; - LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr4, + LOG(( "%f $%04x mc6854_w: set CR4=$%02X (interframe=%i,tlen=%i,rlen=%i,%s%s)\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->cr4, TWOINTER ? 2 : 1, TWL, RWL, ABT ? ( ABTEX ? "abort-ext," : "abort,") : "", @@ -960,14 +960,14 @@ WRITE8_DEVICE_HANDLER ( mc6854_w ) else { /* transmitter data: last data */ - LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data )); + LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data )); mc6854_tfifo_push( device, data ); mc6854_tfifo_terminate( device ); } break; default: - logerror( "$%04x mc6854 invalid write offset %i (data=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), offset, data ); + logerror( "$%04x mc6854 invalid write offset %i (data=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), offset, data ); } } diff --git a/src/mess/machine/mface2.c b/src/mess/machine/mface2.c index b8269761968..cb09c8e665b 100644 --- a/src/mess/machine/mface2.c +++ b/src/mess/machine/mface2.c @@ -39,7 +39,7 @@ DIRECT_UPDATE_MEMBER( cpc_multiface2_device::amstrad_multiface_directoverride ) { int pc; - pc = cpu_get_pc(machine().device("maincpu")); + pc = machine().device("maincpu")->safe_pc(); /* there are two places where CALL &0065 can be found in the multiface rom. At this address there is a RET. diff --git a/src/mess/machine/mos6530.c b/src/mess/machine/mos6530.c index c4c9734763c..23e20ed9c68 100644 --- a/src/mess/machine/mos6530.c +++ b/src/mess/machine/mos6530.c @@ -227,7 +227,7 @@ WRITE8_DEVICE_HANDLER( mos6530_w ) if (!port->out_port_func.isnull()) port->out_port_func(0, data); else - logerror("6530MIOT chip %s: Port %c is being written to but has no handler. PC: %08X - %02X\n", device->tag(), 'A' + (offset & 1), cpu_get_pc(device->machine().firstcpu), data); + logerror("6530MIOT chip %s: Port %c is being written to but has no handler. PC: %08X - %02X\n", device->tag(), 'A' + (offset & 1), device->machine().firstcpu->safe_pc(), data); } } } @@ -289,7 +289,7 @@ READ8_DEVICE_HANDLER( mos6530_r ) port->in = port->in_port_func(0); } else - logerror("6530MIOT chip %s: Port %c is being read but has no handler. PC: %08X\n", device->tag(), 'A' + (offset & 1), cpu_get_pc(device->machine().firstcpu)); + logerror("6530MIOT chip %s: Port %c is being read but has no handler. PC: %08X\n", device->tag(), 'A' + (offset & 1), device->machine().firstcpu->safe_pc()); /* apply the DDR to the result */ val = (out & port->ddr) | (port->in & ~port->ddr); diff --git a/src/mess/machine/ncr5380.c b/src/mess/machine/ncr5380.c index ca49e8b8bc6..75eef713180 100644 --- a/src/mess/machine/ncr5380.c +++ b/src/mess/machine/ncr5380.c @@ -237,7 +237,7 @@ UINT8 ncr5380_device::ncr5380_read_reg(UINT32 offset) } if (VERBOSE) - logerror("NCR5380: read %s (reg %d) = %02x [PC=%x]\n", rnames[reg], reg, rv, cpu_get_pc(machine().firstcpu)); + logerror("NCR5380: read %s (reg %d) = %02x [PC=%x]\n", rnames[reg], reg, rv, machine().firstcpu->safe_pc()); return rv; } @@ -247,7 +247,7 @@ void ncr5380_device::ncr5380_write_reg(UINT32 offset, UINT8 data) int reg = offset & 7; if (VERBOSE) - logerror("NCR5380: %02x to %s (reg %d) [PC=%x]\n", data, wnames[reg], reg, cpu_get_pc(machine().firstcpu)); + logerror("NCR5380: %02x to %s (reg %d) [PC=%x]\n", data, wnames[reg], reg, machine().firstcpu->safe_pc()); switch( reg ) { @@ -334,7 +334,7 @@ void ncr5380_device::ncr5380_write_reg(UINT32 offset, UINT8 data) if (get_cmd_len(m_5380_Command[0]) == m_cmd_ptr) { if (VERBOSE) - logerror("NCR5380: Command (to ID %d): %x %x %x %x %x %x %x %x %x %x (PC %x)\n", m_last_id, m_5380_Command[0], m_5380_Command[1], m_5380_Command[2], m_5380_Command[3], m_5380_Command[4], m_5380_Command[5], m_5380_Command[6], m_5380_Command[7], m_5380_Command[8], m_5380_Command[9], cpu_get_pc(machine().firstcpu)); + logerror("NCR5380: Command (to ID %d): %x %x %x %x %x %x %x %x %x %x (PC %x)\n", m_last_id, m_5380_Command[0], m_5380_Command[1], m_5380_Command[2], m_5380_Command[3], m_5380_Command[4], m_5380_Command[5], m_5380_Command[6], m_5380_Command[7], m_5380_Command[8], m_5380_Command[9], machine().firstcpu->safe_pc()); m_scsi_devices[m_last_id]->SetCommand(&m_5380_Command[0], 16); m_scsi_devices[m_last_id]->ExecCommand(&m_d_limit); diff --git a/src/mess/machine/ncr5390.c b/src/mess/machine/ncr5390.c index 0e7dd38c267..880bcf6ae1d 100644 --- a/src/mess/machine/ncr5390.c +++ b/src/mess/machine/ncr5390.c @@ -550,7 +550,7 @@ void ncr5390_device::delay_cycles(int cycles) READ8_MEMBER(ncr5390_device::tcount_lo_r) { - logerror("%s: tcount_lo_r %02x (%08x)\n", tag(), tcount & 0xff, cpu_get_pc(&space.device())); + logerror("%s: tcount_lo_r %02x (%08x)\n", tag(), tcount & 0xff, space.device().safe_pc()); return tcount; } @@ -558,12 +558,12 @@ WRITE8_MEMBER(ncr5390_device::tcount_lo_w) { tcount = (tcount & 0xff00) | data; status &= ~S_TC0; - logerror("%s: tcount_lo_w %02x (%08x)\n", tag(), data, cpu_get_pc(&space.device())); + logerror("%s: tcount_lo_w %02x (%08x)\n", tag(), data, space.device().safe_pc()); } READ8_MEMBER(ncr5390_device::tcount_hi_r) { - logerror("%s: tcount_hi_r %02x (%08x)\n", tag(), tcount >> 8, cpu_get_pc(&space.device())); + logerror("%s: tcount_hi_r %02x (%08x)\n", tag(), tcount >> 8, space.device().safe_pc()); return tcount >> 8; } @@ -571,7 +571,7 @@ WRITE8_MEMBER(ncr5390_device::tcount_hi_w) { tcount = (tcount & 0x00ff) | (data << 8); status &= ~S_TC0; - logerror("%s: tcount_hi_w %02x (%08x)\n", tag(), data, cpu_get_pc(&space.device())); + logerror("%s: tcount_hi_w %02x (%08x)\n", tag(), data, space.device().safe_pc()); } UINT8 ncr5390_device::fifo_pop() @@ -611,13 +611,13 @@ WRITE8_MEMBER(ncr5390_device::fifo_w) READ8_MEMBER(ncr5390_device::command_r) { - logerror("%s: command_r (%08x)\n", tag(), cpu_get_pc(&space.device())); + logerror("%s: command_r (%08x)\n", tag(), space.device().safe_pc()); return command[0]; } WRITE8_MEMBER(ncr5390_device::command_w) { - // logerror("%s: command_w %02x (%08x)\n", tag(), data, cpu_get_pc(&space.device())); + // logerror("%s: command_w %02x (%08x)\n", tag(), data, space.device().safe_pc()); if(command_pos == 2) { status |= S_GROSS_ERROR; check_irq(); @@ -756,7 +756,7 @@ READ8_MEMBER(ncr5390_device::status_r) { UINT32 ctrl = scsi_bus->ctrl_r(); UINT8 res = status | (ctrl & S_MSG ? 4 : 0) | (ctrl & S_CTL ? 2 : 0) | (ctrl & S_INP ? 1 : 0); - logerror("%s: status_r %02x (%08x)\n", tag(), res, cpu_get_pc(&space.device())); + logerror("%s: status_r %02x (%08x)\n", tag(), res, space.device().safe_pc()); if(irq) status &= ~(S_GROSS_ERROR|S_PARITY|S_TCC); return res; @@ -777,7 +777,7 @@ READ8_MEMBER(ncr5390_device::istatus_r) if(res) command_pop_and_chain(); - logerror("%s: istatus_r %02x (%08x)\n", tag(), res, cpu_get_pc(&space.device())); + logerror("%s: istatus_r %02x (%08x)\n", tag(), res, space.device().safe_pc()); return res; } @@ -788,7 +788,7 @@ WRITE8_MEMBER(ncr5390_device::timeout_w) READ8_MEMBER(ncr5390_device::seq_step_r) { - logerror("%s: seq_step_r %d (%08x)\n", tag(), seq, cpu_get_pc(&space.device())); + logerror("%s: seq_step_r %d (%08x)\n", tag(), seq, space.device().safe_pc()); return seq; } diff --git a/src/mess/machine/nes.c b/src/mess/machine/nes.c index 68b6884825e..b17cdacfd94 100644 --- a/src/mess/machine/nes.c +++ b/src/mess/machine/nes.c @@ -376,7 +376,7 @@ READ8_MEMBER(nes_state::nes_IN0_r) } if (LOG_JOY) - logerror("joy 0 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, cpu_get_pc(&space.device()), m_in_0.shift, m_in_0.i0); + logerror("joy 0 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, space.device().safe_pc(), m_in_0.shift, m_in_0.i0); m_in_0.shift++; } @@ -465,7 +465,7 @@ READ8_MEMBER(nes_state::nes_IN1_r) } if (LOG_JOY) - logerror("joy 1 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, cpu_get_pc(&space.device()), m_in_1.shift, m_in_1.i0); + logerror("joy 1 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, space.device().safe_pc(), m_in_1.shift, m_in_1.i0); m_in_1.shift++; } diff --git a/src/mess/machine/nextmo.c b/src/mess/machine/nextmo.c index a79fc9cfbf4..163644096c6 100644 --- a/src/mess/machine/nextmo.c +++ b/src/mess/machine/nextmo.c @@ -37,7 +37,7 @@ void nextmo_device::device_reset() READ8_MEMBER(nextmo_device::r4_r) { - logerror("nextmo: r4_r %02x (%08x)\n", r4, cpu_get_pc(&space.device())); + logerror("nextmo: r4_r %02x (%08x)\n", r4, space.device().safe_pc()); return r4; } @@ -46,43 +46,43 @@ WRITE8_MEMBER(nextmo_device::r4_w) if(r4 & 1) device_reset(); r4 = (r4 & (~data & 0xfc)) | (data & 3); - logerror("nextmo: r4_w %02x (%08x)\n", r4, cpu_get_pc(&space.device())); + logerror("nextmo: r4_w %02x (%08x)\n", r4, space.device().safe_pc()); } READ8_MEMBER(nextmo_device::r5_r) { - logerror("nextmo: r5_r %02x (%08x)\n", r5, cpu_get_pc(&space.device())); + logerror("nextmo: r5_r %02x (%08x)\n", r5, space.device().safe_pc()); return r5; } WRITE8_MEMBER(nextmo_device::r5_w) { r5 = data; - logerror("nextmo: r5_w %02x (%08x)\n", r5, cpu_get_pc(&space.device())); + logerror("nextmo: r5_w %02x (%08x)\n", r5, space.device().safe_pc()); } READ8_MEMBER(nextmo_device::r6_r) { - logerror("nextmo: r6_r %02x (%08x)\n", r6, cpu_get_pc(&space.device())); + logerror("nextmo: r6_r %02x (%08x)\n", r6, space.device().safe_pc()); return r6; } WRITE8_MEMBER(nextmo_device::r6_w) { r6 = data; - logerror("nextmo: r6_w %02x (%08x)\n", r6, cpu_get_pc(&space.device())); + logerror("nextmo: r6_w %02x (%08x)\n", r6, space.device().safe_pc()); } READ8_MEMBER(nextmo_device::r7_r) { - logerror("nextmo: r7_r %02x (%08x)\n", r7, cpu_get_pc(&space.device())); + logerror("nextmo: r7_r %02x (%08x)\n", r7, space.device().safe_pc()); return r7; } WRITE8_MEMBER(nextmo_device::r7_w) { r7 = data; - logerror("nextmo: r7_w %02x (%08x)\n", r7, cpu_get_pc(&space.device())); + logerror("nextmo: r7_w %02x (%08x)\n", r7, space.device().safe_pc()); if(r7 & 0xc0) { logerror("nextmo: start dma %02x %02x\n", r6, r7); sector_pos = 0; @@ -130,57 +130,57 @@ void nextmo_device::check_dma_end() READ8_MEMBER(nextmo_device::r8_r) { - logerror("nextmo: r8_r (%08x)\n", cpu_get_pc(&space.device())); + logerror("nextmo: r8_r (%08x)\n", space.device().safe_pc()); return 0x00; } WRITE8_MEMBER(nextmo_device::r8_w) { - logerror("nextmo: r8_w %02x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nextmo: r8_w %02x (%08x)\n", data, space.device().safe_pc()); } READ8_MEMBER(nextmo_device::r9_r) { - logerror("nextmo: r9_r (%08x)\n", cpu_get_pc(&space.device())); + logerror("nextmo: r9_r (%08x)\n", space.device().safe_pc()); return 0x00; } WRITE8_MEMBER(nextmo_device::r9_w) { - logerror("nextmo: r9_w %02x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nextmo: r9_w %02x (%08x)\n", data, space.device().safe_pc()); } READ8_MEMBER(nextmo_device::ra_r) { - logerror("nextmo: ra_r (%08x)\n", cpu_get_pc(&space.device())); + logerror("nextmo: ra_r (%08x)\n", space.device().safe_pc()); return 0x00; } WRITE8_MEMBER(nextmo_device::ra_w) { - logerror("nextmo: ra_w %02x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nextmo: ra_w %02x (%08x)\n", data, space.device().safe_pc()); } READ8_MEMBER(nextmo_device::rb_r) { - logerror("nextmo: rb_r (%08x)\n", cpu_get_pc(&space.device())); + logerror("nextmo: rb_r (%08x)\n", space.device().safe_pc()); return 0x24; } WRITE8_MEMBER(nextmo_device::rb_w) { - logerror("nextmo: rb_w %02x (%08x)\n", data, cpu_get_pc(&space.device())); + logerror("nextmo: rb_w %02x (%08x)\n", data, space.device().safe_pc()); } READ8_MEMBER(nextmo_device::r10_r) { - logerror("nextmo: r10_r %d (%08x)\n", offset, cpu_get_pc(&space.device())); + logerror("nextmo: r10_r %d (%08x)\n", offset, space.device().safe_pc()); return 0x00; } WRITE8_MEMBER(nextmo_device::r10_w) { - logerror("nextmo: r10_w %d, %02x (%08x)\n", offset, data, cpu_get_pc(&space.device())); + logerror("nextmo: r10_w %d, %02x (%08x)\n", offset, data, space.device().safe_pc()); } void nextmo_device::check_ecc() diff --git a/src/mess/machine/nubus_asntmc3b.c b/src/mess/machine/nubus_asntmc3b.c index 7bb6977b394..e48b94f6bd7 100644 --- a/src/mess/machine/nubus_asntmc3b.c +++ b/src/mess/machine/nubus_asntmc3b.c @@ -165,7 +165,7 @@ WRITE32_MEMBER( nubus_mac8390_device::en_w ) } else { - fatalerror("asntmc3nb: write %08x to DP83902 @ %x with unhandled mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device())); + fatalerror("asntmc3nb: write %08x to DP83902 @ %x with unhandled mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); } } @@ -183,7 +183,7 @@ READ32_MEMBER( nubus_mac8390_device::en_r ) } else { - fatalerror("asntmc3nb: read DP83902 @ %x with unhandled mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); + fatalerror("asntmc3nb: read DP83902 @ %x with unhandled mask %08x (PC=%x)\n", offset, mem_mask, space.device().safe_pc()); } return 0; diff --git a/src/mess/machine/omti8621.c b/src/mess/machine/omti8621.c index cdd52b9c426..7c64e110ca4 100644 --- a/src/mess/machine/omti8621.c +++ b/src/mess/machine/omti8621.c @@ -218,7 +218,7 @@ static const char *cpu_context(const device_t *device) { int ms = (t % osd_ticks_per_second()) / 1000; sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(), - cpu_get_previouspc(cpu), device->tag()); + cpu->safe_pcbase(), device->tag()); } else { strcpy(statebuf, "(no context)"); } diff --git a/src/mess/machine/oric.c b/src/mess/machine/oric.c index 490cbeb1e1d..a7e806748f8 100644 --- a/src/mess/machine/oric.c +++ b/src/mess/machine/oric.c @@ -729,12 +729,12 @@ WRITE8_MEMBER(oric_state::oric_jasmin_w) wd17xx_reset(fdc); break; case 0x0a: - //logerror("jasmin overlay ram w: %02x PC: %04x\n", data, cpu_get_pc(machine().device("maincpu"))); + //logerror("jasmin overlay ram w: %02x PC: %04x\n", data, machine().device("maincpu")->safe_pc()); m_port_3fa_w = data; oric_jasmin_set_mem_0x0c000(machine()); break; case 0x0b: - //logerror("jasmin romdis w: %02x PC: %04x\n", data, cpu_get_pc(machine().device("maincpu"))); + //logerror("jasmin romdis w: %02x PC: %04x\n", data, machine().device("maincpu")->safe_pc()); m_port_3fb_w = data; oric_jasmin_set_mem_0x0c000(machine()); break; diff --git a/src/mess/machine/pc.c b/src/mess/machine/pc.c index fc31cbaa70b..951466d8f9c 100644 --- a/src/mess/machine/pc.c +++ b/src/mess/machine/pc.c @@ -532,7 +532,7 @@ static UINT8 nmi_enabled; WRITE8_MEMBER(pc_state::pc_nmi_enable_w) { - logerror( "%08X: changing NMI state to %s\n", cpu_get_pc(&space.device()), data & 0x80 ? "enabled" : "disabled" ); + logerror( "%08X: changing NMI state to %s\n", space.device().safe_pc(), data & 0x80 ? "enabled" : "disabled" ); nmi_enabled = data & 0x80; } diff --git a/src/mess/machine/pc1403.c b/src/mess/machine/pc1403.c index 39485839d01..1f1642c5f93 100644 --- a/src/mess/machine/pc1403.c +++ b/src/mess/machine/pc1403.c @@ -128,7 +128,7 @@ void pc1403_outc(device_t *device, int data) { pc1403_state *state = device->machine().driver_data(); state->m_portc = data; -// logerror("%g pc %.4x outc %.2x\n", device->machine().time().as_double(), cpu_get_pc(device->machine().device("maincpu")), data); +// logerror("%g pc %.4x outc %.2x\n", device->machine().time().as_double(), device->machine().device("maincpu")->safe_pc(), data); } diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c index 8a486e79c37..375740f9f6b 100644 --- a/src/mess/machine/pce.c +++ b/src/mess/machine/pce.c @@ -1336,7 +1336,7 @@ WRITE8_MEMBER(pce_state::pce_cd_intf_w) if(offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports return pce_cd_acard_w(space,offset,data); - logerror("%04X: write to CD interface offset %02X, data %02X\n", cpu_get_pc(&space.device()), offset, data ); + logerror("%04X: write to CD interface offset %02X, data %02X\n", space.device().safe_pc(), offset, data ); switch( offset & 0xf ) { @@ -1590,7 +1590,7 @@ READ8_MEMBER(pce_state::pce_cd_intf_r) if(offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports return pce_cd_acard_r(space,offset); - logerror("%04X: read from CD interface offset %02X\n", cpu_get_pc(&space.device()), offset ); + logerror("%04X: read from CD interface offset %02X\n", space.device().safe_pc(), offset ); if((offset & 0xc0) == 0xc0 && m_sys3_card) //System 3 Card header handling { diff --git a/src/mess/machine/pokemini.c b/src/mess/machine/pokemini.c index 82117f54b0d..c6ae40c7e1b 100644 --- a/src/mess/machine/pokemini.c +++ b/src/mess/machine/pokemini.c @@ -395,7 +395,7 @@ WRITE8_DEVICE_HANDLER( pokemini_hwreg_w ) static const int timer_to_cycles_fast[8] = { 2, 8, 32, 64, 128, 256, 1024, 4096 }; static const int timer_to_cycles_slow[8] = { 128, 256, 512, 1024, 2048, 4096, 8192, 16384 }; - //logerror( "%0X: Write to hardware address: %02X, %02X\n", cpu_get_pc( &space->device() ), offset, data ); + //logerror( "%0X: Write to hardware address: %02X, %02X\n", space->device() .safe_pc( ), offset, data ); switch( offset ) { @@ -409,7 +409,7 @@ WRITE8_DEVICE_HANDLER( pokemini_hwreg_w ) case 0x02: /* CPU related? Bit 0-7 R/W Unknown */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data ); + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data ); break; case 0x08: /* Seconds-timer control Bit 0 R/W Timer enable @@ -441,7 +441,7 @@ WRITE8_DEVICE_HANDLER( pokemini_hwreg_w ) Bit 5 R Battery status: 0 - battery OK, 1 - battery low Bit 6-7 Unused */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data ); + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data ); break; case 0x18: /* Timer 1 pre-scale + enable Bit 0-2 R/W low timer 1 prescaler select @@ -956,7 +956,7 @@ WRITE8_DEVICE_HANDLER( pokemini_hwreg_w ) */ case 0x35: /* Timer 1 sound-pivot (high, unused) */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data ); + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data ); break; case 0x36: /* Timer 1 counter (low), read only */ @@ -1035,7 +1035,7 @@ WRITE8_DEVICE_HANDLER( pokemini_hwreg_w ) */ case 0x3D: /* Timer 2 sound-pivot (high, unused) */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data ); + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data ); break; case 0x3E: /* Timer 2 counter (low), read only Bit 0-7 R/W Timer 2 counter value bit 0-7 @@ -1300,7 +1300,7 @@ WRITE8_DEVICE_HANDLER( pokemini_hwreg_w ) Map size 2: 0x00 to 0x60 Bit 7 Unused */ - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data ); + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data ); break; case 0x87: /* Sprite tile data memory offset (low) Bit 0-5 Always "0" @@ -1341,7 +1341,7 @@ WRITE8_DEVICE_HANDLER( pokemini_hwreg_w ) // lcd_data_w( data ); break; default: - logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data ); + logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data ); break; } state->m_pm_reg[offset] = data; diff --git a/src/mess/machine/psxcd.c b/src/mess/machine/psxcd.c index e1d8eeb2e3f..4fb4038a2fb 100644 --- a/src/mess/machine/psxcd.c +++ b/src/mess/machine/psxcd.c @@ -222,7 +222,7 @@ unsigned char psxcd_device::read_byte(const unsigned int addr) } #ifdef debug_cdrom_registers - printf("cdrom: read byte %08x = %02x (PC=%x)\n",addr,ret,cpu_get_pc(machine().device("maincpu"))); + printf("cdrom: read byte %08x = %02x (PC=%x)\n",addr,ret,machine().device("maincpu")->safe_pc()); #endif return ret; @@ -235,7 +235,7 @@ unsigned char psxcd_device::read_byte(const unsigned int addr) void psxcd_device::write_byte(const unsigned int addr, const unsigned char byte) { #ifdef debug_cdrom_registers - printf("cdrom: write byte %08x = %02x (PC=%x)\n",addr,byte,cpu_get_pc(machine().device("maincpu"))); + printf("cdrom: write byte %08x = %02x (PC=%x)\n",addr,byte,machine().device("maincpu")->safe_pc()); #endif switch (addr&3) diff --git a/src/mess/machine/rm380z.c b/src/mess/machine/rm380z.c index fa7302eda9b..ee6a1e892f9 100644 --- a/src/mess/machine/rm380z.c +++ b/src/mess/machine/rm380z.c @@ -29,7 +29,7 @@ WRITE8_MEMBER( rm380z_state::port_write ) switch ( offset ) { case 0xFC: // PORT0 - //printf("FBFCw[%2.2x] FBFD [%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",data,m_fbfd,m_fbfe,cpu_get_pc(machine().device("maincpu")),writenum); + //printf("FBFCw[%2.2x] FBFD [%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",data,m_fbfd,m_fbfe,machine().device("maincpu")->safe_pc(),writenum); m_port0 = data; if (data&0x01) { @@ -43,7 +43,7 @@ WRITE8_MEMBER( rm380z_state::port_write ) break; case 0xFD: // screen line counter (?) - //printf("FBFC [%2.2x] FBFDw[%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,data,m_fbfe,cpu_get_pc(machine().device("maincpu")),writenum); + //printf("FBFC [%2.2x] FBFDw[%2.2x] FBFE [%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,data,m_fbfe,machine().device("maincpu")->safe_pc(),writenum); m_old_old_fbfd=m_old_fbfd; m_old_fbfd=m_fbfd; @@ -56,7 +56,7 @@ WRITE8_MEMBER( rm380z_state::port_write ) break; case 0xFE: // line on screen to write to divided by 2 - //printf("FBFC [%2.2x] FBFD [%2.2x] FBFEw[%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,m_fbfd,data,cpu_get_pc(machine().device("maincpu")),writenum); + //printf("FBFC [%2.2x] FBFD [%2.2x] FBFEw[%2.2x] PC [%4.4x] writenum [%4.4x]\n",m_port0,m_fbfd,data,machine().device("maincpu")->safe_pc(),writenum); m_fbfe=data; break; @@ -81,7 +81,7 @@ READ8_MEMBER( rm380z_state::port_read ) data = m_port0_kbd; //if (m_port0_kbd!=0) m_port0_kbd=0; //m_port0_kbd=0; - //printf("read of port0 (kbd) from PC [%x]\n",cpu_get_pc(machine().device("maincpu"))); + //printf("read of port0 (kbd) from PC [%x]\n",machine().device("maincpu")->safe_pc()); break; case 0xFD: // "counter" (?) @@ -91,7 +91,7 @@ READ8_MEMBER( rm380z_state::port_read ) case 0xFE: // PORT1 data = m_port1; - //printf("read of port1 from PC [%x]\n",cpu_get_pc(machine().device("maincpu"))); + //printf("read of port1 from PC [%x]\n",machine().device("maincpu")->safe_pc()); break; case 0xFF: // user port @@ -134,7 +134,7 @@ READ8_MEMBER( rm380z_state::rm380z_portlow_r ) WRITE8_MEMBER( rm380z_state::rm380z_portlow_w ) { - //printf("port write [%x] [%x] at PC [%x]\n",offset,data,cpu_get_pc(machine().device("maincpu"))); + //printf("port write [%x] [%x] at PC [%x]\n",offset,data,machine().device("maincpu")->safe_pc()); } READ8_MEMBER( rm380z_state::rm380z_porthi_r ) diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c index bd4fa563e86..c03b97d012a 100644 --- a/src/mess/machine/rmnimbus.c +++ b/src/mess/machine/rmnimbus.c @@ -375,7 +375,7 @@ static void handle_eoi(running_machine &machine,int data) case 0x0d: state->m_i186.intr.in_service &= ~0x20; break; case 0x0e: state->m_i186.intr.in_service &= ~0x40; break; case 0x0f: state->m_i186.intr.in_service &= ~0x80; break; - default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(machine.device(MAINCPU_TAG)), data & 0x1f); + default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", machine.device(MAINCPU_TAG)->safe_pc(), data & 0x1f); } if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine.time().as_double(), data & 0x1f); } @@ -589,7 +589,7 @@ static void internal_timer_update(running_machine &machine, diff = new_control ^ t->control; if (diff & 0x001c) logerror("%05X:ERROR! -unsupported timer mode %04X\n", - cpu_get_pc(machine.device(MAINCPU_TAG)), new_control); + machine.device(MAINCPU_TAG)->safe_pc(), new_control); /* if we have real changes, update things */ if (diff != 0) @@ -690,7 +690,7 @@ static void update_dma_control(running_machine &machine, int which, int new_cont diff = new_control ^ d->control; if ((LOG_DMA) && (diff & 0x6811)) logerror("%05X:ERROR! - unsupported DMA mode %04X\n", - cpu_get_pc(machine.device(MAINCPU_TAG)), new_control); + machine.device(MAINCPU_TAG)->safe_pc(), new_control); #if 0 /* if we're going live, set a timer */ if ((diff & 0x0002) && (new_control & 0x0002)) @@ -745,7 +745,7 @@ static void drq_callback(running_machine &machine, int which) if(!(dma->control & ST_STOP)) { logerror("%05X:ERROR! - drq%d with dma channel stopped\n", - cpu_get_pc(machine.device(MAINCPU_TAG)), which); + machine.device(MAINCPU_TAG)->safe_pc(), which); return; } @@ -860,21 +860,21 @@ READ16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_r) switch (offset) { case 0x11: - logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(&space.device())); + logerror("%05X:ERROR - read from 80186 EOI\n", space.device().safe_pc()); break; case 0x12: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", space.device().safe_pc()); if (m_i186.intr.poll_status & 0x8000) int_callback(machine().device(MAINCPU_TAG), 0); return m_i186.intr.poll_status; case 0x13: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", space.device().safe_pc()); return m_i186.intr.poll_status; case 0x14: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", space.device().safe_pc()); temp = (m_i186.intr.timer >> 3) & 0x01; temp |= (m_i186.intr.dma[0] >> 1) & 0x04; temp |= (m_i186.intr.dma[1] >> 0) & 0x08; @@ -885,56 +885,56 @@ READ16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_r) return temp; case 0x15: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", space.device().safe_pc()); return m_i186.intr.priority_mask; case 0x16: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", space.device().safe_pc()); return m_i186.intr.in_service; case 0x17: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", space.device().safe_pc()); temp = m_i186.intr.request & ~0x0001; if (m_i186.intr.status & 0x0007) temp |= 1; return temp; case 0x18: - if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", space.device().safe_pc()); return m_i186.intr.status; case 0x19: - if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", space.device().safe_pc()); return m_i186.intr.timer; case 0x1a: - if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", space.device().safe_pc()); return m_i186.intr.dma[0]; case 0x1b: - if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", space.device().safe_pc()); return m_i186.intr.dma[1]; case 0x1c: - if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", space.device().safe_pc()); return m_i186.intr.ext[0]; case 0x1d: - if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", space.device().safe_pc()); return m_i186.intr.ext[1]; case 0x1e: - if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", space.device().safe_pc()); return m_i186.intr.ext[2]; case 0x1f: - if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", space.device().safe_pc()); return m_i186.intr.ext[3]; case 0x28: case 0x2c: case 0x30: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(&space.device()), (offset - 0x28) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", space.device().safe_pc(), (offset - 0x28) / 4); which = (offset - 0x28) / 4; if (!(offset & 1)) internal_timer_sync(machine(), which); @@ -943,81 +943,81 @@ READ16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_r) case 0x29: case 0x2d: case 0x31: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(&space.device()), (offset - 0x29) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", space.device().safe_pc(), (offset - 0x29) / 4); which = (offset - 0x29) / 4; return m_i186.timer[which].maxA; case 0x2a: case 0x2e: - logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(&space.device()), (offset - 0x2a) / 4); + logerror("%05X:read 80186 Timer %d max B\n", space.device().safe_pc(), (offset - 0x2a) / 4); which = (offset - 0x2a) / 4; return m_i186.timer[which].maxB; case 0x2b: case 0x2f: case 0x33: - if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(&space.device()), (offset - 0x2b) / 4); + if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", space.device().safe_pc(), (offset - 0x2b) / 4); which = (offset - 0x2b) / 4; return m_i186.timer[which].control; case 0x50: - if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", space.device().safe_pc()); return m_i186.mem.upper; case 0x51: - if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", space.device().safe_pc()); return m_i186.mem.lower; case 0x52: - if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", space.device().safe_pc()); return m_i186.mem.peripheral; case 0x53: - if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", space.device().safe_pc()); return m_i186.mem.middle; case 0x54: - if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(&space.device())); + if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", space.device().safe_pc()); return m_i186.mem.middle_size; case 0x60: case 0x68: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(&space.device()), (offset - 0x60) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", space.device().safe_pc(), (offset - 0x60) / 8); which = (offset - 0x60) / 8; return m_i186.dma[which].source; case 0x61: case 0x69: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(&space.device()), (offset - 0x61) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", space.device().safe_pc(), (offset - 0x61) / 8); which = (offset - 0x61) / 8; return m_i186.dma[which].source >> 16; case 0x62: case 0x6a: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(&space.device()), (offset - 0x62) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", space.device().safe_pc(), (offset - 0x62) / 8); which = (offset - 0x62) / 8; return m_i186.dma[which].dest; case 0x63: case 0x6b: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(&space.device()), (offset - 0x63) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", space.device().safe_pc(), (offset - 0x63) / 8); which = (offset - 0x63) / 8; return m_i186.dma[which].dest >> 16; case 0x64: case 0x6c: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(&space.device()), (offset - 0x64) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", space.device().safe_pc(), (offset - 0x64) / 8); which = (offset - 0x64) / 8; return m_i186.dma[which].count; case 0x65: case 0x6d: - if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(&space.device()), (offset - 0x65) / 8); + if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", space.device().safe_pc(), (offset - 0x65) / 8); which = (offset - 0x65) / 8; return m_i186.dma[which].control; default: - logerror("%05X:read 80186 port %02X\n", cpu_get_pc(&space.device()), offset); + logerror("%05X:read 80186 port %02X\n", space.device().safe_pc(), offset); break; } return 0x00; @@ -1036,21 +1036,21 @@ WRITE16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_w) switch (offset) { case 0x11: - if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", space.device().safe_pc(), data16); handle_eoi(machine(),0x8000); update_interrupt_state(machine()); break; case 0x12: - logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", cpu_get_pc(&space.device()), data16); + logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", space.device().safe_pc(), data16); break; case 0x13: - logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", cpu_get_pc(&space.device()), data16); + logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", space.device().safe_pc(), data16); break; case 0x14: - if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", space.device().safe_pc(), data16); m_i186.intr.timer = (m_i186.intr.timer & ~0x08) | ((data16 << 3) & 0x08); m_i186.intr.dma[0] = (m_i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08); m_i186.intr.dma[1] = (m_i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08); @@ -1062,68 +1062,68 @@ WRITE16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_w) break; case 0x15: - if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", space.device().safe_pc(), data16); m_i186.intr.priority_mask = data16 & 0x0007; update_interrupt_state(machine()); break; case 0x16: - if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", space.device().safe_pc(), data16); m_i186.intr.in_service = data16 & 0x00ff; update_interrupt_state(machine()); break; case 0x17: - if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", space.device().safe_pc(), data16); m_i186.intr.request = (m_i186.intr.request & ~0x00c0) | (data16 & 0x00c0); update_interrupt_state(machine()); break; case 0x18: - if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", space.device().safe_pc(), data16); m_i186.intr.status = (m_i186.intr.status & ~0x8007) | (data16 & 0x8007); update_interrupt_state(machine()); break; case 0x19: - if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", space.device().safe_pc(), data16); m_i186.intr.timer = data16 & 0x000f; break; case 0x1a: - if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", space.device().safe_pc(), data16); m_i186.intr.dma[0] = data16 & 0x000f; break; case 0x1b: - if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", space.device().safe_pc(), data16); m_i186.intr.dma[1] = data16 & 0x000f; break; case 0x1c: - if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", space.device().safe_pc(), data16); m_i186.intr.ext[0] = data16 & 0x007f; break; case 0x1d: - if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", space.device().safe_pc(), data16); m_i186.intr.ext[1] = data16 & 0x007f; break; case 0x1e: - if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", space.device().safe_pc(), data16); m_i186.intr.ext[2] = data16 & 0x001f; break; case 0x1f: - if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", space.device().safe_pc(), data16); m_i186.intr.ext[3] = data16 & 0x001f; break; case 0x28: case 0x2c: case 0x30: - if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", cpu_get_pc(&space.device()), (offset - 0x28) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", space.device().safe_pc(), (offset - 0x28) / 4, data16); which = (offset - 0x28) / 4; internal_timer_update(machine(),which, data16, -1, -1, -1); break; @@ -1131,14 +1131,14 @@ WRITE16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_w) case 0x29: case 0x2d: case 0x31: - if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", cpu_get_pc(&space.device()), (offset - 0x29) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", space.device().safe_pc(), (offset - 0x29) / 4, data16); which = (offset - 0x29) / 4; internal_timer_update(machine(),which, -1, data16, -1, -1); break; case 0x2a: case 0x2e: - if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", cpu_get_pc(&space.device()), (offset - 0x2a) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", space.device().safe_pc(), (offset - 0x2a) / 4, data16); which = (offset - 0x2a) / 4; internal_timer_update(machine(),which, -1, -1, data16, -1); break; @@ -1146,33 +1146,33 @@ WRITE16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_w) case 0x2b: case 0x2f: case 0x33: - if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", cpu_get_pc(&space.device()), (offset - 0x2b) / 4, data16); + if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", space.device().safe_pc(), (offset - 0x2b) / 4, data16); which = (offset - 0x2b) / 4; internal_timer_update(machine(),which, -1, -1, -1, data16); break; case 0x50: - if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", space.device().safe_pc(), data16); m_i186.mem.upper = data16 | 0xc038; break; case 0x51: - if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", space.device().safe_pc(), data16); m_i186.mem.lower = (data16 & 0x3fff) | 0x0038; printf("%X",m_i186.mem.lower); break; case 0x52: - if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", space.device().safe_pc(), data16); m_i186.mem.peripheral = data16 | 0x0038; break; case 0x53: - if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", space.device().safe_pc(), data16); m_i186.mem.middle = data16 | 0x01f8; break; case 0x54: - if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", space.device().safe_pc(), data16); m_i186.mem.middle_size = data16 | 0x8038; /* we need to do this at a time when the I86 context is swapped in */ @@ -1183,48 +1183,48 @@ WRITE16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_w) case 0x60: case 0x68: - if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x60) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", space.device().safe_pc(), (offset - 0x60) / 8, data16); which = (offset - 0x60) / 8; m_i186.dma[which].source = (m_i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff); break; case 0x61: case 0x69: - if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x61) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", space.device().safe_pc(), (offset - 0x61) / 8, data16); which = (offset - 0x61) / 8; m_i186.dma[which].source = (m_i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000); break; case 0x62: case 0x6a: - if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x62) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", space.device().safe_pc(), (offset - 0x62) / 8, data16); which = (offset - 0x62) / 8; m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff); break; case 0x63: case 0x6b: - if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x63) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", space.device().safe_pc(), (offset - 0x63) / 8, data16); which = (offset - 0x63) / 8; m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000); break; case 0x64: case 0x6c: - if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(&space.device()), (offset - 0x64) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", space.device().safe_pc(), (offset - 0x64) / 8, data16); which = (offset - 0x64) / 8; m_i186.dma[which].count = data16; break; case 0x65: case 0x6d: - if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(&space.device()), (offset - 0x65) / 8, data16); + if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", space.device().safe_pc(), (offset - 0x65) / 8, data16); which = (offset - 0x65) / 8; update_dma_control(machine(), which, data16); break; case 0x7f: - if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", cpu_get_pc(&space.device()), data16); + if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", space.device().safe_pc(), data16); /* we assume here there that this doesn't happen too often */ /* plus, we can't really remove the old memory range, so we also assume that it's */ @@ -1244,7 +1244,7 @@ WRITE16_MEMBER(rmnimbus_state::nimbus_i186_internal_port_w) break; default: - logerror("%05X:80186 port %02X = %04X\n", cpu_get_pc(&space.device()), offset, data16); + logerror("%05X:80186 port %02X = %04X\n", space.device().safe_pc(), offset, data16); break; } } @@ -2082,7 +2082,7 @@ static void memory_reset(running_machine &machine) READ16_MEMBER(rmnimbus_state::nimbus_io_r) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); logerror("Nimbus IOR at pc=%08X from %04X mask=%04X, data=%04X\n",pc,(offset*2)+0x30,mem_mask,m_IOPorts[offset]); @@ -2095,7 +2095,7 @@ READ16_MEMBER(rmnimbus_state::nimbus_io_r) WRITE16_MEMBER(rmnimbus_state::nimbus_io_w) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); logerror("Nimbus IOW at %08X write of %04X to %04X mask=%04X\n",pc,data,(offset*2)+0x30,mem_mask); @@ -2314,7 +2314,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_disk_r) device_t *fdc = machine().device(FDC_TAG); scsibus_device *hdc = machine().device(SCSIBUS_TAG); - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); rmnimbus_state *state = machine().driver_data(); device_t *drive = machine().device(nimbus_wd17xx_interface.floppy_drive_tags[FDC_DRIVE()]); @@ -2381,7 +2381,7 @@ WRITE8_MEMBER(rmnimbus_state::nimbus_disk_w) { device_t *fdc = machine().device(FDC_TAG); scsibus_device *hdc = machine().device(SCSIBUS_TAG); - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); UINT8 reg400_old = m_nimbus_drives.reg400; if(LOG_DISK_FDD && ((offset*2)<=0x10)) @@ -2557,7 +2557,7 @@ static void ipc_dumpregs() READ8_MEMBER(rmnimbus_state::nimbus_pc8031_r) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); UINT8 result; switch(offset*2) @@ -2581,7 +2581,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_pc8031_r) WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_w) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); switch(offset*2) { @@ -2607,7 +2607,7 @@ WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_w) READ8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_r) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); UINT8 result = 0; switch (offset & 0x01) @@ -2632,7 +2632,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_r) WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_w) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); if(LOG_PC8031) logerror("8031 PCIOW %04X write of %02X to %04X\n",pc,data,offset); @@ -2672,7 +2672,7 @@ WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_w) READ8_MEMBER(rmnimbus_state::nimbus_pc8031_port_r) { device_t *er59256 = machine().device(ER59256_TAG); - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); UINT8 result = 0; if(LOG_PC8031_PORT) @@ -2689,7 +2689,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_pc8031_port_r) WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_port_w) { device_t *er59256 = machine().device(ER59256_TAG); - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); switch (offset) { @@ -2705,7 +2705,7 @@ WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_port_w) /* IO Unit */ READ8_MEMBER(rmnimbus_state::nimbus_iou_r) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); UINT8 result=0; if(offset==0) @@ -2721,7 +2721,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_iou_r) WRITE8_MEMBER(rmnimbus_state::nimbus_iou_w) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); device_t *msm5205 = machine().device(MSM5205_TAG); if(LOG_IOU) @@ -2782,7 +2782,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_sound_ay8910_r) WRITE8_MEMBER(rmnimbus_state::nimbus_sound_ay8910_w) { - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); device_t *ay8910 = machine().device(AY8910_TAG); if(LOG_SOUND) @@ -2854,7 +2854,7 @@ static TIMER_CALLBACK(mouse_callback) rmnimbus_state *drvstate = machine.driver_data(); UINT8 x = 0; UINT8 y = 0; -// int pc=cpu_get_pc(machine.device(MAINCPU_TAG)); +// int pc=machine.device(MAINCPU_TAG)->safe_pc(); UINT8 intstate_x; UINT8 intstate_y; @@ -3000,7 +3000,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_mouse_js_r) */ UINT8 result; - //int pc=cpu_get_pc(machine().device(MAINCPU_TAG)); + //int pc=machine().device(MAINCPU_TAG)->safe_pc(); _mouse_joy_state *state = &m_nimbus_mouse; if (ioport("config")->read() & 0x01) diff --git a/src/mess/machine/sc499.c b/src/mess/machine/sc499.c index 812ddda9720..257a3fe3fa9 100644 --- a/src/mess/machine/sc499.c +++ b/src/mess/machine/sc499.c @@ -257,7 +257,7 @@ const char *sc499_device::cpu_context() if (cpu != NULL) { sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(), - cpu_get_previouspc(cpu), tag()); + cpu->safe_pcbase(), tag()); } else { diff --git a/src/mess/machine/sgi.c b/src/mess/machine/sgi.c index 711e003e90d..7c1d532e04e 100644 --- a/src/mess/machine/sgi.c +++ b/src/mess/machine/sgi.c @@ -20,7 +20,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", (unsigned) cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", (unsigned) machine.device("maincpu")->safe_pc(), buf ); } } diff --git a/src/mess/machine/sms.c b/src/mess/machine/sms.c index 7e170cf9aa6..56440931355 100644 --- a/src/mess/machine/sms.c +++ b/src/mess/machine/sms.c @@ -1226,7 +1226,7 @@ WRITE8_MEMBER(sms_state::sms_bios_w) { m_bios_port = data; - logerror("bios write %02x, pc: %04x\n", data, cpu_get_pc(&space.device())); + logerror("bios write %02x, pc: %04x\n", data, space.device().safe_pc()); setup_rom(&space); } @@ -2087,7 +2087,7 @@ READ8_MEMBER(sms_state::sms_store_control_r) WRITE8_MEMBER(sms_state::sms_store_control_w) { - logerror("0x%04X: sms_store_control write 0x%02X\n", cpu_get_pc(&space.device()), data); + logerror("0x%04X: sms_store_control write 0x%02X\n", space.device().safe_pc(), data); if (data & 0x02) { machine().device("maincpu")->resume(SUSPEND_REASON_HALT); diff --git a/src/mess/machine/sym1.c b/src/mess/machine/sym1.c index ec9b3fbaad7..fd1efcc24ca 100644 --- a/src/mess/machine/sym1.c +++ b/src/mess/machine/sym1.c @@ -123,7 +123,7 @@ static READ8_DEVICE_HANDLER(sym1_riot_b_r) static WRITE8_DEVICE_HANDLER(sym1_riot_a_w) { sym1_state *state = device->machine().driver_data(); - logerror("%x: riot_a_w 0x%02x\n", cpu_get_pc( device->machine().device("maincpu") ), data); + logerror("%x: riot_a_w 0x%02x\n", device->machine().device("maincpu") ->safe_pc( ), data); /* save for later use */ state->m_riot_port_a = data; @@ -133,7 +133,7 @@ static WRITE8_DEVICE_HANDLER(sym1_riot_a_w) static WRITE8_DEVICE_HANDLER(sym1_riot_b_w) { sym1_state *state = device->machine().driver_data(); - logerror("%x: riot_b_w 0x%02x\n", cpu_get_pc( device->machine().device("maincpu") ), data); + logerror("%x: riot_b_w 0x%02x\n", device->machine().device("maincpu") ->safe_pc( ), data); /* save for later use */ state->m_riot_port_b = data; diff --git a/src/mess/machine/tandy1t.c b/src/mess/machine/tandy1t.c index 20d9727fb06..2bdd0fa2f1c 100644 --- a/src/mess/machine/tandy1t.c +++ b/src/mess/machine/tandy1t.c @@ -165,9 +165,9 @@ static struct WRITE8_HANDLER ( pc_t1t_p37x_w ) { -// DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", cpu_get_pc( &space->device()),offset, data)); +// DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", space->device().safe_pc( ),offset, data)); if (offset!=4) - logerror("T1T_p37x_w %.5x #%d $%02x\n", cpu_get_pc( &space->device()),offset, data); + logerror("T1T_p37x_w %.5x #%d $%02x\n", space->device().safe_pc( ),offset, data); tandy.data[offset]=data; switch( offset ) { @@ -180,7 +180,7 @@ WRITE8_HANDLER ( pc_t1t_p37x_w ) READ8_HANDLER ( pc_t1t_p37x_r ) { int data = tandy.data[offset]; -// DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", cpu_get_pc( &space->device()), offset, data)); +// DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", space->device().safe_pc( ), offset, data)); return data; } diff --git a/src/mess/machine/thomflop.c b/src/mess/machine/thomflop.c index 114bde783bc..fbd85c2b763 100644 --- a/src/mess/machine/thomflop.c +++ b/src/mess/machine/thomflop.c @@ -280,7 +280,7 @@ static READ8_HANDLER ( to7_5p14_r ) else if ( offset == 8 ) return to7_5p14_select; else - logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } @@ -304,7 +304,7 @@ static WRITE8_HANDLER( to7_5p14_w ) case 4: drive = 2; side = 0; break; case 5: drive = 3; side = 1; break; default: - logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ); + logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ); } wd17xx_dden_w(fdc, BIT(data, 7)); @@ -317,13 +317,13 @@ static WRITE8_HANDLER( to7_5p14_w ) wd17xx_set_drive( fdc, drive ); wd17xx_set_side( fdc, side ); LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, drive, side, (BIT(data, 7) ? "FM" : "MFM"))); } } else logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data ); } @@ -366,7 +366,7 @@ static READ8_HANDLER ( to7_5p14sd_r ) else if ( offset >= 8 && offset <= 9 ) return to7_5p14sd_select; else - logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } @@ -410,12 +410,12 @@ static WRITE8_HANDLER( to7_5p14sd_w ) mc6843_set_drive( space->machine().device("mc6843"), drive ); mc6843_set_side( space->machine().device("mc6843"), side ); LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, drive, side )); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, drive, side )); } } else logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data ); } static void to7_5p14_index_pulse_callback( device_t *controller,device_t *image, int state ) @@ -592,7 +592,7 @@ static UINT8 to7_qdd_read_byte( running_machine &machine ) data = to7qdd->data[ to7qdd->data_idx ]; VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), to7qdd->data_idx, to7qdd->data_size, data )); to7qdd->data_idx++; @@ -633,7 +633,7 @@ static void to7_qdd_write_byte( running_machine &machine, UINT8 data ) to7qdd->data_idx++; VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data, + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data, to7qdd->start_idx, to7qdd->data_idx )); /* end of tentative id field */ @@ -647,7 +647,7 @@ static void to7_qdd_write_byte( running_machine &machine, UINT8 data ) UINT8 filler = 0xff; LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector )); + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector )); floppy_drive_format_sector( to7_qdd_image(machine), 0, sector, 0, 0, sector, 128, filler ); @@ -677,7 +677,7 @@ static void to7_qdd_write_byte( running_machine &machine, UINT8 data ) int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector )); + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector )); floppy_drive_write_sector_data( to7_qdd_image(machine), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); thom_floppy_active( machine, 1 ); @@ -700,7 +700,7 @@ static READ8_HANDLER ( to7_qdd_r ) case 0: /* MC6852 status */ to7_qdd_stat_update(space->machine()); VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), to7qdd->status, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), to7qdd->status, to7qdd->status & QDD_S_IRQ ? 1 : 0, to7qdd->status & QDD_S_PE ? 1 : 0, to7qdd->status & QDD_S_OVR ? 1 : 0, @@ -723,12 +723,12 @@ static READ8_HANDLER ( to7_qdd_r ) data |= 0x40; /* disk present */ if ( to7qdd->index_pulse ) data |= 0x80; /* disk start */ - VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); return data; } default: - logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } } @@ -750,7 +750,7 @@ static WRITE8_HANDLER( to7_qdd_w ) to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); to7_qdd_stat_update(space->machine()); VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', data & QDD_C1_STRIPSYNC ? "strip-sync " : "", data & QDD_C1_CLRSYNC ? "clear-sync " : "", @@ -774,7 +774,7 @@ static WRITE8_HANDLER( to7_qdd_w ) parity = par[ (data >> 3) & 7 ]; to7_qdd_stat_update(space->machine()); VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2, data & QDD_C2_TSYNC ? "sync" : "ff", data & QDD_C2_EIE ? "irq-err" : "" )); @@ -792,7 +792,7 @@ static WRITE8_HANDLER( to7_qdd_w ) to7qdd->status &= ~QDD_S_NCTS; to7_qdd_stat_update(space->machine()); VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, data & QDD_C3_CLRTUF ? "clr-tuf " : "", data & QDD_C3_CLRCTS ? "clr-cts " : "", data & QDD_C3_SYNCLEN ? 1 : 2, @@ -804,7 +804,7 @@ static WRITE8_HANDLER( to7_qdd_w ) break; case 3: /* MC6852 data out => does not seem to be used */ - VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); break; } @@ -812,16 +812,16 @@ static WRITE8_HANDLER( to7_qdd_w ) case 8: /* set drive */ to7qdd->drive = data; - VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); break; case 12: /* motor pulse ? */ thom_floppy_active( space->machine(), 0 ); - VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); break; default: - logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data ); } } @@ -1052,7 +1052,7 @@ static UINT8 thmfc_floppy_read_byte ( running_machine &machine ) UINT8 data = thmfc1->data[ thmfc1->data_idx ]; VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, data )); @@ -1095,7 +1095,7 @@ static UINT8 thmfc_floppy_raw_read_byte ( running_machine &machine ) data = thmfc1->data[ thmfc1->data_raw_idx ]; VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), thmfc1->data_raw_idx, thmfc1->data_raw_size, data )); thmfc1->data_raw_idx++; @@ -1133,7 +1133,7 @@ static void thmfc_floppy_qdd_write_byte ( running_machine &machine, UINT8 data ) } VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data, + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data, thmfc1->data_idx,thmfc1->data_raw_idx )); if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 && @@ -1145,7 +1145,7 @@ static void thmfc_floppy_qdd_write_byte ( running_machine &machine, UINT8 data ) int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ]; UINT8 filler = 0xff; - LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector )); + LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector )); floppy_drive_format_sector( thmfc_floppy_image(machine), 0, sector, 0, 0, sector, 128, filler ); thom_floppy_active( machine, 1 ); @@ -1175,7 +1175,7 @@ static void thmfc_floppy_qdd_write_byte ( running_machine &machine, UINT8 data ) (int) thmfc1->data[ i + 2 ]; LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector )); + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector )); floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 ); thom_floppy_active( machine, 1 ); @@ -1190,7 +1190,7 @@ static void thmfc_floppy_qdd_write_byte ( running_machine &machine, UINT8 data ) else { thmfc1->data_raw_idx++; - VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data )); + VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data )); } } @@ -1201,7 +1201,7 @@ static void thmfc_floppy_qdd_write_byte ( running_machine &machine, UINT8 data ) static void thmfc_floppy_write_byte ( running_machine &machine, UINT8 data ) { VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", - machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), + machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), thmfc1->data_idx, thmfc1->data_size - 1, data )); thmfc1->data_raw_size = 0; @@ -1215,7 +1215,7 @@ static void thmfc_floppy_write_byte ( running_machine &machine, UINT8 data ) /* intelligent formatting */ static void thmfc_floppy_format_byte ( running_machine &machine, UINT8 data ) { - VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data )); + VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data )); thmfc1->data_raw_size = 0; @@ -1260,7 +1260,7 @@ READ8_HANDLER ( thmfc_floppy_r ) case 0: /* STAT0 */ thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL; - VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), thmfc1->stat0 )); + VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), thmfc1->stat0 )); return thmfc1->stat0; case 1: /* STAT1 */ @@ -1292,7 +1292,7 @@ READ8_HANDLER ( thmfc_floppy_r ) data |= 0x10; if (!floppy_wpt_r(&img->device())) data |= 0x04; - VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); return data; } @@ -1310,12 +1310,12 @@ READ8_HANDLER ( thmfc_floppy_r ) { /* undocumented => emulate TO7 QDD controller ? */ UINT8 data = thmfc1->ipl << 7; - VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); return data; } default: - logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } } @@ -1333,7 +1333,7 @@ WRITE8_HANDLER ( thmfc_floppy_w ) chrn_id id; thmfc1->formatting = (data >> 2) & 1; LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, (BIT(data, 5) ? "FM" : "MFM"), wsync, (data >> 3) & 1, thmfc1->formatting, data & 3 )); @@ -1419,12 +1419,12 @@ WRITE8_HANDLER ( thmfc_floppy_w ) if ( thmfc1->sector_size > 256 ) { logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n", - cpu_get_previouspc(space->machine().device("maincpu")), thmfc1->sector_size ); + space->machine().device("maincpu")->safe_pcbase(), thmfc1->sector_size ); thmfc1->sector_size = 256; } LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, thmfc1->sector_size, (data >> 1) & 7, thmfc1->side )); break; @@ -1453,7 +1453,7 @@ WRITE8_HANDLER ( thmfc_floppy_w ) thom_floppy_active( space->machine(), 0 ); LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, thmfc1->drive, seek, motor )); if ( seek ) @@ -1484,7 +1484,7 @@ WRITE8_HANDLER ( thmfc_floppy_w ) { /* TODO: implement other forms of raw track writing */ LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); } break; @@ -1492,32 +1492,32 @@ WRITE8_HANDLER ( thmfc_floppy_w ) case 4: /* WCLK (unemulated) */ /* clock configuration: FF for data, 0A for synchro */ LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); break; case 5: /* WSECT */ thmfc1->sector = data; LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); break; case 6: /* WTRCK */ thmfc1->track = data; LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, floppy_drive_get_current_track( thmfc_floppy_image(space->machine()) ) )); break; case 7: /* WCELL */ /* precompensation (unemulated) */ LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data )); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data )); break; default: logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data ); } } @@ -1717,11 +1717,11 @@ static READ8_HANDLER ( to7_network_r ) { /* network ID of the computer */ UINT8 id = space->machine().root_device().ioport("fconfig")->read() >> 3; - VLOG(( "%f $%04x to7_network_r: read id $%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), id )); + VLOG(( "%f $%04x to7_network_r: read id $%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), id )); return id; } - logerror( "%f $%04x to7_network_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror( "%f $%04x to7_network_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } @@ -1734,7 +1734,7 @@ static WRITE8_HANDLER ( to7_network_w ) else { logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n", - space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data ); } } diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index 10ac5d13c67..98af0fe6e76 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -103,7 +103,7 @@ static int to7_get_cassette ( running_machine &machine ) if ( bitpos >= to7_k7_bitsize ) bitpos = to7_k7_bitsize -1; VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", - cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), state, pos, bitpos, + machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), state, pos, bitpos, to7_k7_bits[ bitpos ] )); return to7_k7_bits[ bitpos ]; } @@ -124,7 +124,7 @@ static int to7_get_cassette ( running_machine &machine ) } k = ( chg >= 13 ) ? 1 : 0; VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", - cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), state, pos, bitpos, + machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), state, pos, bitpos, k, chg )); return k; } @@ -152,7 +152,7 @@ static WRITE8_DEVICE_HANDLER ( to7_set_cassette_motor ) double pos = img->get_position(); LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n", - cpu_get_previouspc(device->machine().device("maincpu")), img->machine().time().as_double(), data ? "off" : "on", + device->machine().device("maincpu")->safe_pcbase(), img->machine().time().as_double(), data ? "off" : "on", (int) (pos / TO7_BIT_LENGTH) )); if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) @@ -203,7 +203,7 @@ static int mo5_get_cassette ( running_machine &machine ) hbit = hbit >= 0; VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", - cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), state, pos, + machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), state, pos, (int) (pos / MO5_HBIT_LENGTH), hbit )); return hbit; } @@ -228,7 +228,7 @@ static WRITE8_DEVICE_HANDLER ( mo5_set_cassette_motor ) double pos = img->get_position(); LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n", - cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data ? "off" : "on", + device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ? "off" : "on", (int) (pos / MO5_HBIT_LENGTH) )); if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) @@ -734,7 +734,7 @@ WRITE8_MEMBER( to7_io_line_device::porta_out ) int tx = data & 1; int dtr = ( data & 2 ) ? 1 : 0; - LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", cpu_get_previouspc(machine().device("maincpu")), machine().time().as_double(), tx, dtr )); + LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", machine().device("maincpu")->safe_pcbase(), machine().time().as_double(), tx, dtr )); if ( dtr ) m_connection_state |= SERIAL_STATE_DTR; else @@ -758,7 +758,7 @@ READ8_MEMBER( to7_io_line_device::porta_in ) else cts = !printer->busy_r(); - LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(machine().device("maincpu")), machine().time().as_double(), to7_io_mode(machine()), cts, dsr, rd )); + LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", machine().device("maincpu")->safe_pcbase(), machine().time().as_double(), to7_io_mode(machine()), cts, dsr, rd )); return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0); } @@ -769,7 +769,7 @@ static WRITE8_DEVICE_HANDLER( to7_io_portb_out ) { centronics_device *printer = device->machine().device("centronics"); - LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data )); + LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data )); /* set 8-bit data */ printer->write( *device->machine().memory().first_space(), 0, data); @@ -781,7 +781,7 @@ static WRITE8_DEVICE_HANDLER( to7_io_cb2_out ) { centronics_device *printer = device->machine().device("centronics"); - LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data )); + LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data )); /* send STROBE to printer */ printer->strobe_w(data); @@ -1283,7 +1283,7 @@ READ8_HANDLER ( to7_midi_r ) /* bit 6: parity error (ignored) */ /* bit 7: interrupt */ LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), to7_midi_status, + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), to7_midi_status, (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0, (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0, (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0, @@ -1303,7 +1303,7 @@ READ8_HANDLER ( to7_midi_r ) to7_midi_status &= ~ACIA_6850_OVRN; to7_midi_overrun = 0; LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data )); + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data )); to7_midi_update_irq( space->machine() ); } return data; @@ -1312,7 +1312,7 @@ READ8_HANDLER ( to7_midi_r ) default: logerror( "$%04x to7_midi_r: invalid offset %i\n", - cpu_get_previouspc(space->machine().device("maincpu")), offset ); + space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } } @@ -1331,7 +1331,7 @@ WRITE8_HANDLER ( to7_midi_w ) if ( (data & 3) == 3 ) { /* reset */ - LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data )); + LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data )); to7_midi_overrun = 0; to7_midi_status = 2; to7_midi_intr = 0; @@ -1348,7 +1348,7 @@ WRITE8_HANDLER ( to7_midi_w ) static const int stop[8] = { 2,2,1,1,2,1,1,1 }; static const char parity[8] = { 'e','o','e','o','-','-','e','o' }; LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data, bits[ (data >> 2) & 7 ], stop[ (data >> 2) & 7 ], @@ -1362,7 +1362,7 @@ WRITE8_HANDLER ( to7_midi_w ) case 1: /* output data */ - LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data )); + LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data )); if ( data == 0x55 ) /* cable-detect: shortcut */ chardev_fake_in( to7_midi_chardev, 0x55 ); @@ -1376,7 +1376,7 @@ WRITE8_HANDLER ( to7_midi_w ) default: - logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", space->machine().device("maincpu")->safe_pcbase(), offset, data ); } } @@ -1546,7 +1546,7 @@ MACHINE_START ( to7 ) static WRITE8_DEVICE_HANDLER ( to770_sys_cb2_out ) { /* video overlay: black pixels are transparent and show TV image underneath */ - LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc(device->machine().device("maincpu")), data )); + LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", device->machine().device("maincpu")->safe_pcbase(), data )); } @@ -1690,7 +1690,7 @@ READ8_HANDLER ( to770_gatearray_r ) case 2: return (lt3 << 7) | (inil << 6); case 3: return (init << 7); default: - logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror( "$%04x to770_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } } @@ -1921,7 +1921,7 @@ READ8_HANDLER ( mo5_gatearray_r ) case 2: return (lt3 << 7) | (inil << 6); case 3: return (init << 7); default: - logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } } @@ -2203,14 +2203,14 @@ MACHINE_START ( mo5 ) WRITE8_HANDLER ( to9_ieee_w ) { - logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data, offset ); + logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data, offset ); } READ8_HANDLER ( to9_ieee_r ) { - logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), offset ); + logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset ); return 0; } @@ -2241,7 +2241,7 @@ READ8_HANDLER ( to9_gatearray_r ) case 2: return (lt3 << 7) | (inil << 6); case 3: return (v.init << 7) | (init << 6); /* != TO7/70 */ default: - logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror( "$%04x to9_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } } @@ -2339,7 +2339,7 @@ READ8_HANDLER ( to9_vreg_r ) WRITE8_HANDLER ( to9_vreg_w ) { - LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), offset, 0xe7da + offset, data )); + LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset, 0xe7da + offset, data )); switch ( offset ) { @@ -2668,7 +2668,7 @@ READ8_HANDLER ( to9_kbd_r ) /* bit 7: interrupt */ LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), to9_kbd_status, + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), to9_kbd_status, (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0, (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, @@ -2685,13 +2685,13 @@ READ8_HANDLER ( to9_kbd_r ) else to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF); to9_kbd_overrun = 0; - LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), to9_kbd_in )); + LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), to9_kbd_in )); to9_kbd_update_irq(space->machine()); } return to9_kbd_in; default: - logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror( "$%04x to9_kbd_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset ); return 0; } } @@ -2713,7 +2713,7 @@ WRITE8_HANDLER ( to9_kbd_w ) to9_kbd_overrun = 0; to9_kbd_status = ACIA_6850_TDRE; to9_kbd_intr = 0; - LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data )); + LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data )); } else { @@ -2727,7 +2727,7 @@ WRITE8_HANDLER ( to9_kbd_w ) to9_kbd_intr = data >> 5; LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data, to9_kbd_parity, to9_kbd_intr >> 2, (to9_kbd_intr & 3) ? 1 : 0 )); } @@ -2758,19 +2758,19 @@ WRITE8_HANDLER ( to9_kbd_w ) case 0xFE: to9_kbd_periph = 0; break; default: - logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data ); + logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data ); } thom_set_caps_led( space->machine(), !to9_kbd_caps ); LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data, + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data, to9_kbd_caps, to9_kbd_pad, to9_kbd_periph )); break; default: - logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", space->machine().device("maincpu")->safe_pcbase(), offset, data ); } } @@ -3916,12 +3916,12 @@ READ8_HANDLER ( to8_gatearray_r ) break; default: - logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror( "$%04x to8_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset ); res = 0; } LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset, 0xe7e4 + offset, res, to7_lightpen )); return res; @@ -3932,7 +3932,7 @@ READ8_HANDLER ( to8_gatearray_r ) WRITE8_HANDLER ( to8_gatearray_w ) { LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset, 0xe7e4 + offset, data )); switch ( offset ) @@ -3964,7 +3964,7 @@ WRITE8_HANDLER ( to8_gatearray_w ) default: logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n", - cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + space->machine().device("maincpu")->safe_pcbase(), offset, data ); } } @@ -4019,7 +4019,7 @@ READ8_HANDLER ( to8_vreg_r ) WRITE8_HANDLER ( to8_vreg_w ) { LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset, 0xe7da + offset, data )); switch ( offset ) @@ -4075,7 +4075,7 @@ static READ8_DEVICE_HANDLER ( to8_sys_porta_in ) { int ktest = to8_kbd_ktest (device->machine()); - LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), ktest )); + LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), ktest )); return ktest; } @@ -4757,7 +4757,7 @@ static WRITE8_DEVICE_HANDLER ( mo6_game_porta_out ) { centronics_device *printer = device->machine().device("centronics"); - LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data )); + LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data )); /* centronics data */ printer->write( *device->machine().memory().first_space(), 0, data); @@ -4769,7 +4769,7 @@ static WRITE8_DEVICE_HANDLER ( mo6_game_cb2_out ) { centronics_device *printer = device->machine().device("centronics"); - LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data )); + LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data )); /* centronics strobe */ printer->strobe_w(data); @@ -4975,12 +4975,12 @@ READ8_HANDLER ( mo6_gatearray_r ) break; default: - logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset ); + logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset ); res = 0; } LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset, 0xa7e4 + offset, res, to7_lightpen )); return res; @@ -4991,7 +4991,7 @@ READ8_HANDLER ( mo6_gatearray_r ) WRITE8_HANDLER ( mo6_gatearray_w ) { LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset, 0xa7e4 + offset, data )); switch ( offset ) @@ -5021,7 +5021,7 @@ WRITE8_HANDLER ( mo6_gatearray_w ) break; default: - logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc(space->machine().device("maincpu")), offset, data ); + logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", space->machine().device("maincpu")->safe_pcbase(), offset, data ); } } @@ -5061,7 +5061,7 @@ READ8_HANDLER ( mo6_vreg_r ) WRITE8_HANDLER ( mo6_vreg_w ) { LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset, 0xa7da + offset, data )); switch ( offset ) @@ -5219,7 +5219,7 @@ READ8_HANDLER ( mo5nr_net_r ) if ( to7_controller_type ) return to7_floppy_r ( space, offset ); - logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), offset ); + logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset ); return 0; } @@ -5232,7 +5232,7 @@ WRITE8_HANDLER ( mo5nr_net_w ) to7_floppy_w ( space, offset, data ); else logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", - cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data, offset ); + space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data, offset ); } diff --git a/src/mess/machine/wswan.c b/src/mess/machine/wswan.c index 23608e2b528..f8b83615038 100644 --- a/src/mess/machine/wswan.c +++ b/src/mess/machine/wswan.c @@ -289,7 +289,7 @@ READ8_MEMBER( wswan_state::wswan_port_r ) UINT8 value = m_ws_portram[offset]; if ( offset != 2 ) - logerror( "PC=%X: port read %02X\n", cpu_get_pc( machine().device("maincpu") ), offset ); + logerror( "PC=%X: port read %02X\n", machine().device("maincpu") ->safe_pc( ), offset ); switch( offset ) { case 0x02: /* Current line */ @@ -360,7 +360,7 @@ WRITE8_MEMBER( wswan_state::wswan_port_w ) address_space *mem = m_maincpu->memory().space(AS_PROGRAM); wswan_state *state = machine().driver_data(); UINT8 input; - logerror( "PC=%X: port write %02X <- %02X\n", cpu_get_pc( &mem->device() ), offset, data ); + logerror( "PC=%X: port write %02X <- %02X\n", mem->device().safe_pc(), offset, data ); switch( offset ) { case 0x00: /* Display control @@ -1254,7 +1254,7 @@ WRITE8_MEMBER( wswan_state::wswan_port_w ) m_ws_portram[0xcb] = m_rtc.year; break; default: - logerror( "%X: Unknown RTC command (%X) requested\n", cpu_get_pc( &mem->device() ), data ); + logerror( "%X: Unknown RTC command (%X) requested\n", mem->device().safe_pc(), data ); } break; case 0xcb: /* RTC Data */ diff --git a/src/mess/machine/z80ne.c b/src/mess/machine/z80ne.c index 869b3ebb48b..3729bcfb7fb 100644 --- a/src/mess/machine/z80ne.c +++ b/src/mess/machine/z80ne.c @@ -707,7 +707,7 @@ READ8_DEVICE_HANDLER(lx390_reset_bank) offs_t pc; /* if PC is not in range, we are under integrated debugger control, DON'T SWAP */ - pc = cpu_get_pc(device->machine().device("z80ne")); + pc = device->machine().device("z80ne")->safe_pc(); if((pc >= 0xf000) && (pc <=0xffff)) { LOG(("lx390_reset_bank, reset memory bank 1\n")); diff --git a/src/mess/video/crtc_ega.c b/src/mess/video/crtc_ega.c index 478335fa408..0b71320323e 100644 --- a/src/mess/video/crtc_ega.c +++ b/src/mess/video/crtc_ega.c @@ -80,7 +80,7 @@ READ8_MEMBER( crtc_ega_device::register_r ) WRITE8_MEMBER( crtc_ega_device::register_w ) { - if (LOG) logerror("CRTC_EGA PC %04x: reg 0x%02x = 0x%02x\n", cpu_get_pc(machine().firstcpu), m_register_address_latch, data); + if (LOG) logerror("CRTC_EGA PC %04x: reg 0x%02x = 0x%02x\n", machine().firstcpu->safe_pc(), m_register_address_latch, data); switch (m_register_address_latch) { diff --git a/src/mess/video/gba.c b/src/mess/video/gba.c index 1d6c4075148..bddae38de88 100644 --- a/src/mess/video/gba.c +++ b/src/mess/video/gba.c @@ -22,7 +22,7 @@ INLINE void verboselog(running_machine &machine, int n_level, const char *s_fmt, va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c index aea6b857e7b..56c0ec16bcb 100644 --- a/src/mess/video/mac.c +++ b/src/mess/video/mac.c @@ -714,7 +714,7 @@ VIDEO_RESET(macdafb) READ32_MEMBER(mac_state::dafb_r) { -// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, cpu_get_pc(m_maincpu)); +// if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->safe_pc()); switch (offset<<2) { @@ -745,7 +745,7 @@ READ32_MEMBER(mac_state::dafb_r) WRITE32_MEMBER(mac_state::dafb_w) { -// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, cpu_get_pc(m_maincpu)); +// if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->safe_pc()); switch (offset<<2) { @@ -809,14 +809,14 @@ WRITE32_MEMBER(mac_state::dafb_w) READ32_MEMBER(mac_state::dafb_dac_r) { -// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, cpu_get_pc(m_maincpu)); +// printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->safe_pc()); return 0; } WRITE32_MEMBER(mac_state::dafb_dac_w) { -// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, cpu_get_pc(m_maincpu)); +// if ((offset > 0) && (offset != 0x10/4)) printf("DAFB: Write %08x to DAC @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->safe_pc()); switch (offset<<2) { @@ -1018,7 +1018,7 @@ READ32_MEMBER(mac_state::macwd_r) break; default: -// printf("macwd_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(m_maincpu)); +// printf("macwd_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, m_maincpu->safe_pc()); break; } return 0; @@ -1052,7 +1052,7 @@ WRITE32_MEMBER(mac_state::macwd_w) break; default: -// printf("macwd_w: %x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(m_maincpu)); +// printf("macwd_w: %x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, m_maincpu->safe_pc()); break; } } diff --git a/src/mess/video/newport.c b/src/mess/video/newport.c index 697cf16bd2e..94fbf944765 100644 --- a/src/mess/video/newport.c +++ b/src/mess/video/newport.c @@ -38,7 +38,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog(running_machine &machine, int n_level, c va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf ); + logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf ); } } diff --git a/src/mess/video/nubus_48gc.c b/src/mess/video/nubus_48gc.c index 101bddf2a45..db5eec63a06 100644 --- a/src/mess/video/nubus_48gc.c +++ b/src/mess/video/nubus_48gc.c @@ -335,7 +335,7 @@ WRITE32_MEMBER( jmfb_device::mac_48gc_w ) READ32_MEMBER( jmfb_device::mac_48gc_r ) { -// printf("48gc_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, cpu_get_pc(machine().device("maincpu"))); +// printf("48gc_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, machine().device("maincpu")->safe_pc()); switch (offset) { diff --git a/src/mess/video/nubus_cb264.c b/src/mess/video/nubus_cb264.c index 5dd26dddf91..7f8a3037759 100644 --- a/src/mess/video/nubus_cb264.c +++ b/src/mess/video/nubus_cb264.c @@ -247,7 +247,7 @@ WRITE32_MEMBER( nubus_cb264_device::cb264_w ) break; default: -// printf("cb264_w: %x to reg %x (mask %x PC %x)\n", data, offset*4, mem_mask, cpu_get_pc(&space->device())); +// printf("cb264_w: %x to reg %x (mask %x PC %x)\n", data, offset*4, mem_mask, space->device().safe_pc()); break; } } @@ -265,7 +265,7 @@ READ32_MEMBER( nubus_cb264_device::cb264_r ) return m_cb264_toggle; // bit 0 is vblank? default: - logerror("cb264_r: reg %x (mask %x PC %x)\n", offset*4, mem_mask, cpu_get_pc(&space.device())); + logerror("cb264_r: reg %x (mask %x PC %x)\n", offset*4, mem_mask, space.device().safe_pc()); break; } diff --git a/src/mess/video/nubus_m2hires.c b/src/mess/video/nubus_m2hires.c index 3d29c51a181..212e4d28e9d 100644 --- a/src/mess/video/nubus_m2hires.c +++ b/src/mess/video/nubus_m2hires.c @@ -257,7 +257,7 @@ WRITE32_MEMBER( nubus_m2hires_device::m2hires_w ) break; case 0x5038: // DAC control -// printf("%08x to DAC control (PC=%x)\n", data, cpu_get_pc(&space.device())); +// printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc()); m_clutoffs = (data>>24)&0xff; break; @@ -266,7 +266,7 @@ WRITE32_MEMBER( nubus_m2hires_device::m2hires_w ) if (m_count == 3) { -// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], cpu_get_pc(&space.device()) ); +// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() ); m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]); m_clutoffs++; if (m_clutoffs > 255) @@ -287,7 +287,7 @@ WRITE32_MEMBER( nubus_m2hires_device::m2hires_w ) break; default: -// printf("m2hires_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device())); +// printf("m2hires_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); break; } } @@ -301,7 +301,7 @@ READ32_MEMBER( nubus_m2hires_device::m2hires_r ) } /* else { - printf("m2hires_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); + printf("m2hires_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, space.device().safe_pc()); }*/ return 0; diff --git a/src/mess/video/nubus_spec8.c b/src/mess/video/nubus_spec8.c index e33803193a6..1950ce7c2ff 100644 --- a/src/mess/video/nubus_spec8.c +++ b/src/mess/video/nubus_spec8.c @@ -267,7 +267,7 @@ WRITE32_MEMBER( nubus_spec8s3_device::spec8s3_w ) { int actual_color = BITSWAP8(m_clutoffs, 0, 1, 2, 3, 4, 5, 6, 7); -// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", actual_color, m_colors[0], m_colors[1], m_colors[2], cpu_get_pc(&space.device()) ); +// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", actual_color, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() ); m_palette[actual_color] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]); m_clutoffs++; if (m_clutoffs > 255) @@ -313,7 +313,7 @@ WRITE32_MEMBER( nubus_spec8s3_device::spec8s3_w ) break; default: -// if (offset >= 0x3800) printf("spec8s3_w: %08x @ %x (mask %08x PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device())); +// if (offset >= 0x3800) printf("spec8s3_w: %08x @ %x (mask %08x PC=%x)\n", data, offset, mem_mask, space.device().safe_pc()); break; } } @@ -341,7 +341,7 @@ READ32_MEMBER( nubus_spec8s3_device::spec8s3_r ) return 0; default: -// if (offset >= 0x3800) printf("spec8s3_r: @ %x (mask %08x PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); +// if (offset >= 0x3800) printf("spec8s3_r: @ %x (mask %08x PC=%x)\n", offset, mem_mask, space.device().safe_pc()); break; } return 0; diff --git a/src/mess/video/nubus_specpdq.c b/src/mess/video/nubus_specpdq.c index 5ae02643f1f..7a655de8f6f 100644 --- a/src/mess/video/nubus_specpdq.c +++ b/src/mess/video/nubus_specpdq.c @@ -291,7 +291,7 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w ) break; case 0x120000: // DAC address -// printf("%08x to DAC control (PC=%x)\n", data, cpu_get_pc(&space.device())); +// printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc()); m_clutoffs = ((data>>8)&0xff)^0xff; break; @@ -300,7 +300,7 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w ) if (m_count == 3) { -// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], cpu_get_pc(&space.device()) ); +// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() ); palette_set_color(space.machine(), m_clutoffs, MAKE_RGB(m_colors[0], m_colors[1], m_colors[2])); m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]); m_clutoffs++; @@ -386,40 +386,40 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w ) // blitter control case 0x182006: -// printf("%08x (%d) to blitter ctrl 1 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device())); +// printf("%08x (%d) to blitter ctrl 1 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc()); break; case 0x182008: -// printf("%08x (%d) to blitter ctrl 2 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device())); +// printf("%08x (%d) to blitter ctrl 2 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc()); m_patofsx = (data ^ 0xffffffff) & 7; m_patofsy = ((data ^ 0xffffffff)>>3) & 7; break; case 0x18200e: -// printf("%08x (%d) to blitter ctrl 3 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device())); +// printf("%08x (%d) to blitter ctrl 3 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc()); m_width = data ^ 0xffffffff; break; case 0x18200b: -// printf("%08x (%d) to blitter ctrl 4 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device())); +// printf("%08x (%d) to blitter ctrl 4 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc()); m_height = (data ^ 0xffffffff) & 0xffff; break; case 0x18200a: data ^= 0xffffffff; -// printf("%08x to blitter ctrl 5 (PC=%x)\n", data, cpu_get_pc(&space.device())); +// printf("%08x to blitter ctrl 5 (PC=%x)\n", data, space.device().safe_pc()); m_vram_src = data>>2; break; case 0x182009: data ^= 0xffffffff; -// printf("%08x to blitter ctrl 6 (PC=%x)\n", data, cpu_get_pc(&space.device())); +// printf("%08x to blitter ctrl 6 (PC=%x)\n", data, space.device().safe_pc()); m_vram_addr = data>>2; break; case 0x182007: data ^= 0xffffffff; -// printf("%08x to blitter ctrl 7 (PC=%x)\n", data, cpu_get_pc(&space.device())); +// printf("%08x to blitter ctrl 7 (PC=%x)\n", data, space.device().safe_pc()); // fill rectangle if (data == 2) @@ -460,14 +460,14 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w ) break; default: -// printf("specpdq_w: %08x @ %x (mask %08x PC=%x)\n", data^0xffffffff, offset, mem_mask, cpu_get_pc(&space.device())); +// printf("specpdq_w: %08x @ %x (mask %08x PC=%x)\n", data^0xffffffff, offset, mem_mask, space.device().safe_pc()); break; } } READ32_MEMBER( nubus_specpdq_device::specpdq_r ) { -// if (offset != 0xc005c && offset != 0xc005e) printf("specpdq_r: @ %x (mask %08x PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device())); +// if (offset != 0xc005c && offset != 0xc005e) printf("specpdq_r: @ %x (mask %08x PC=%x)\n", offset, mem_mask, space.device().safe_pc()); if (offset >= 0xc0000 && offset < 0x100000) { diff --git a/src/mess/video/nubus_wsportrait.c b/src/mess/video/nubus_wsportrait.c index 2107e290e40..73af0a3ad8e 100644 --- a/src/mess/video/nubus_wsportrait.c +++ b/src/mess/video/nubus_wsportrait.c @@ -254,7 +254,7 @@ WRITE32_MEMBER( nubus_wsportrait_device::wsportrait_w ) if (m_count == 3) { -// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], cpu_get_pc(&space.device()) ); +// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() ); m_palette[m_clutoffs] = MAKE_RGB(m_colors[2], m_colors[2], m_colors[2]); m_clutoffs++; if (m_clutoffs > 255) diff --git a/src/mess/video/rm380z.c b/src/mess/video/rm380z.c index 2d4298644c4..9164011c6b6 100644 --- a/src/mess/video/rm380z.c +++ b/src/mess/video/rm380z.c @@ -196,7 +196,7 @@ WRITE8_MEMBER( rm380z_state::videoram_write ) { rm380z_state *state = machine().driver_data(); - //printf("vramw [%2.2x][%2.2x] port0 [%2.2x] fbfd [%2.2x] fbfe [%2.2x] PC [%4.4x]\n",offset,data,state->m_port0,m_fbfd,m_fbfe,cpu_get_pc(machine().device("maincpu"))); + //printf("vramw [%2.2x][%2.2x] port0 [%2.2x] fbfd [%2.2x] fbfe [%2.2x] PC [%4.4x]\n",offset,data,state->m_port0,m_fbfd,m_fbfe,machine().device("maincpu")->safe_pc()); int lineWidth=0x80; if (m_videomode==RM380Z_VIDEOMODE_40COL) diff --git a/src/mess/video/rmnimbus.c b/src/mess/video/rmnimbus.c index 97e0b40b562..1da619921fb 100644 --- a/src/mess/video/rmnimbus.c +++ b/src/mess/video/rmnimbus.c @@ -105,7 +105,7 @@ static void video_regdump(running_machine &machine, int ref, int params, const c READ16_MEMBER(rmnimbus_state::nimbus_video_io_r) { rmnimbus_state *state = machine().driver_data(); - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); UINT16 result; switch (offset) @@ -266,7 +266,7 @@ static UINT16 read_reg_00A(rmnimbus_state *state) WRITE16_MEMBER(rmnimbus_state::nimbus_video_io_w) { rmnimbus_state *state = machine().driver_data(); - int pc=cpu_get_pc(&space.device()); + int pc=space.device().safe_pc(); if(offsetm_lcd.data[state->m_lcd.count/8]&=~(1<<(state->m_lcd.count&7)); if (data) state->m_lcd.data[state->m_lcd.count/8]|=1<<(state->m_lcd.count&7); if (state->m_lcd.count+1==40) { - logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)cpu_get_pc(machine.device("maincpu")), + logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine.device("maincpu")->safe_pc(), state->m_lcd.data[0], state->m_lcd.data[1], state->m_lcd.data[2], state->m_lcd.data[3], state->m_lcd.data[4]); } state->m_lcd.count=(state->m_lcd.count+1)%40; diff --git a/src/mess/video/stic.c b/src/mess/video/stic.c index 7fb098e877b..5d6bee63072 100644 --- a/src/mess/video/stic.c +++ b/src/mess/video/stic.c @@ -157,7 +157,7 @@ WRITE16_MEMBER( intv_state::intv_stic_w ) case STIC_CSR + STIC_CSR1: case STIC_CSR + STIC_CSR2: case STIC_CSR + STIC_CSR3: - logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, cpu_get_pc(&space.device())); + logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, space.device().safe_pc()); break; /* Border Color */ case STIC_BCR: diff --git a/src/mess/video/x68k.c b/src/mess/video/x68k.c index 05dbaf6fab3..0323a1aa932 100644 --- a/src/mess/video/x68k.c +++ b/src/mess/video/x68k.c @@ -461,7 +461,7 @@ WRITE16_HANDLER( x68k_crtc_w ) } break; } -// logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc(space->machine().device("maincpu")),data,offset); +// logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",space->machine().device("maincpu")->safe_pc(),data,offset); } READ16_HANDLER( x68k_crtc_r ) @@ -478,7 +478,7 @@ READ16_HANDLER( x68k_crtc_r ) if(offset < 24) { -// logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",cpu_get_pc(space->machine().device("maincpu")),state->m_crtc.reg[offset],offset); +// logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",space->machine().device("maincpu")->safe_pc(),state->m_crtc.reg[offset],offset); switch(offset) { case 9: -- cgit v1.2.3