Previous 199869 Revisions Next

r17789 Tuesday 11th September, 2012 at 05:50:50 UTC by Aaron Giles
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]devcpu.h device.h distate.c distate.h
[src/emu/cpu/m6502]opsce02.h
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/m68000]68307bus.c 68307ser.c 68307sim.c 68307tmu.c 68340dma.c 68340ser.c 68340sim.c 68340tmu.c m68kcpu.c
[src/emu/cpu/sh2]sh2comn.c
[src/emu/cpu/tlcs90]tlcs90.c
[src/emu/cpu/tms34010]34010gfx.c tms34010.c
[src/emu/debug]dvdisasm.c
[src/emu/machine]53c810.c am53cf96.c k056230.c ldpr8210.c ldv1000.c ldvp931.c ncr539x.c tmp68301.c wd33c93.c
[src/emu/sound]nile.c
[src/emu/video]hd63484.c pc_vga.c voodoo.c
[src/mame/audio]beezer.c cage.c dcs.c exidy.c harddriv.c invinco.c jaguar.c leland.c mw8080bw.c segasnd.c seibu.c snes_snd.c taito_en.c taitosnd.c
[src/mame/drivers]1943.c 2mindril.c 39in1.c 8080bw.c 88games.c acommand.c aeroboto.c albazg.c aleck64.c alpha68k.c artmagic.c astrafr.c astrocorp.c atarigt.c atarigx2.c backfire.c bbusters.c beathead.c bfcobra.c bfm_sc4h.c bfm_swp.c bigevglf.c bionicc.c bking.c blockhl.c bmcbowl.c btime.c cabaret.c calchase.c cave.c cbasebal.c cbuster.c cd32.c cdi.c centiped.c chaknpop.c cninja.c cntsteer.c cobra.c coolpool.c cps1.c crbaloon.c crgolf.c cvs.c cyclemb.c d9final.c darius.c dblewing.c dcheese.c ddenlovr.c ddragon.c ddragon3.c dec0.c deco32.c deco_mlc.c djmain.c dkong.c dorachan.c dunhuang.c dynax.c enigma2.c eolithsp.c epos.c esd16.c esripsys.c exerion.c fantland.c fastfred.c firetrap.c fitfight.c flstory.c fromanc2.c fuukifg2.c gaelco3d.c gaiden.c galastrm.c galaxian.c galaxold.c gaplus.c gbusters.c gcpinbal.c gei.c ghosteo.c gladiatr.c glass.c goal92.c goindol.c gradius3.c gsword.c gunbustr.c halleys.c hexion.c hitpoker.c hng64.c homedata.c hotblock.c hyprduel.c igs009.c igs011.c igs_m027.c igspoker.c itech32.c jackie.c jaguar.c jalmah.c jokrwild.c kaneko16.c kickgoal.c kinst.c koftball.c konamigv.c konamigx.c konamim2.c ksys573.c ladybug.c lastfght.c lethal.c liberate.c littlerb.c looping.c lwings.c m107.c m92.c macrossp.c macs.c mainevt.c malzak.c mcr.c mcr3.c mcr68.c mediagx.c megadrvb.c megaplay.c meritm.c metro.c midqslvr.c midvunit.c midzeus.c missile.c mitchell.c mjkjidai.c mjsister.c model1.c model2.c model3.c mole.c monzagp.c mosaic.c mpu3.c mpu4hw.c mpu4vid.c mpu5hw.c mquake.c msisaac.c mw8080bw.c mystwarr.c namcona1.c namconb1.c namcos10.c namcos11.c namcos21.c namcos22.c namcos23.c naughtyb.c neogeo.c neoprint.c ninjaw.c nmk16.c nwk-tr.c nyny.c offtwall.c ojankohs.c opwolf.c overdriv.c pacman.c pandoras.c paradise.c parodius.c pasha2.c pbaction.c pcat_nit.c pcxt.c pgm.c pirates.c pktgaldx.c playmark.c pluto5.c plygonet.c pntnpuzl.c polepos.c policetr.c ppmast93.c psikyo.c punchout.c qdrmfgp.c quizo.c quizpun2.c r2dtank.c raiden.c realbrk.c rmhaihai.c rollerg.c roul.c route16.c royalmah.c sandscrp.c saturn.c scramble.c sderby.c seattle.c segac2.c segag80r.c segag80v.c segald.c segaorun.c segas16b.c segas18.c segas24.c segas32.c seibuspi.c seicross.c seta.c seta2.c sf.c shangha3.c simpl156.c slapfght.c snesb.c solomon.c sothello.c spaceg.c spdodgeb.c spoker.c spy.c srmp6.c ssfindo.c sshangha.c ssv.c stadhero.c starwars.c strnskil.c stv.c suna16.c suna8.c supbtime.c superchs.c superqix.c suprgolf.c suprnova.c surpratk.c system1.c system16.c taito_f2.c taito_f3.c taito_l.c taito_o.c taito_z.c taitoair.c taitojc.c taitotz.c tecmosys.c tehkanwc.c tetrisp2.c thedeep.c thunderx.c tickee.c tigeroad.c tmaster.c tmnt.c toaplan2.c tomcat.c topspeed.c trvmadns.c tumbleb.c twinkle.c undrfire.c vamphalf.c vball.c vegas.c vendetta.c viper.c voyager.c vsnes.c wecleman.c wgp.c wheelfir.c witch.c xexex.c xmen.c xtheball.c xyonix.c yunsung8.c zn.c
[src/mame/includes]megadriv.h
[src/mame/machine]3do.c ajax.c amiga.c archimds.c arkanoid.c asic65.c atarigen.c balsente.c bonzeadv.c btime.c bublbobl.c buggychl.c cchip.c cd32.c cdi070.c cdicdic.c cdislave.c chaknpop.c dc.c dec0.c decocass.c decoprot.c fddebug.c flstory.c gaelco2.c gaelcrpt.c galaxold.c harddriv.c kaneko_hit.c kaneko_toybox.c konamigx.c konppc.c leland.c lkage.c lsasquad.c m68kfmly.c maniach.c mcr.c mcr68.c md_cart.c mega32x.c megadriv.c megavdp.c mexico86.c midtunit.c midwayic.c midwunit.c midxunit.c midyunit.c model1.c n64.c namcoio.c namcond1.c namcos1.c namcos2.c naomi.c neoboot.c neoprot.c nmk004.c opwolf.c pgmprot1.c pgmprot2.c pgmprot3.c pgmprot4.c pgmprot6.c retofinv.c scramble.c segaic16.c segas32.c seicop.c slapfght.c slapstic.c smpc.c snes.c stvprot.c taitoio.c taitosj.c tatsumi.c tnzs.c toaplan1.c twincobr.c tx1.c volfied.c xevious.c
[src/mame/video]airbustr.c battlera.c beathead.c bwing.c capbowl.c cischeat.c cvs.c dc.c dcheese.c dogfgt.c dooyong.c dynax.c flstory.c galivan.c galpani2.c ginganin.c gticlub.c hexion.c homedata.c itech8.c jaguar.c kaneko_grap2.c kaneko_spr.c konamiic.c konicdev.c lethalj.c m107.c m92.c mcd212.c megasys1.c midvunit.c midzeus.c midzeus2.c mitchell.c mjkjidai.c othldrby.c policetr.c scn2674.c segag80r.c seta.c seta2.c st0016.c st0020.c stvvdp1.c suna16.c taito_l.c taitoic.c tatsumi.c victory.c williams.c
[src/mess/audio]mea8000.c
[src/mess/devices]sonydriv.c
[src/mess/drivers]a2600.c apollo.c bebox.c camplynx.c craft.c cxhumax.c dc.c esq1.c esq5505.c ex800.c gba.c gp2x.c gp32.c ip20.c ip22.c mac.c nc.c next.c ng_aes.c pasogo.c pasopia7.c pc8801.c pc88va.c pc9801.c rainbow.c rex6000.c rvoice.c scv.c sgi_ip2.c sgi_ip6.c smc777.c socrates.c ssystem3.c supracan.c vboy.c vii.c vk100.c x1.c x68k.c
[src/mess/machine]3c505.c a2cffa.c a2memexp.c a2mockingboard.c a2scsi.c a2videoterm.c amigacd.c amigacrt.c apollo_kbd.c apple2.c bbc.c bebox.c c65.c coco.c compis.c cuda.c dccons.c dec_lk201.c dgn_beta.c egret.c gamecom.c gb.c hp48.c intv.c isa_hdc.c isa_ide_cd.c lisa.c mac.c macpci.c mb8795.c mc6843.c mc6846.c mc6854.c mface2.c mos6530.c ncr5380.c ncr5390.c nes.c nextmo.c nubus_asntmc3b.c omti8621.c oric.c pc.c pc1403.c pce.c pokemini.c psxcd.c rm380z.c rmnimbus.c sc499.c sgi.c sms.c sym1.c tandy1t.c thomflop.c thomson.c wswan.c z80ne.c
[src/mess/video]crtc_ega.c gba.c mac.c newport.c nubus_48gc.c nubus_cb264.c nubus_m2hires.c nubus_spec8.c nubus_specpdq.c nubus_wsportrait.c rm380z.c rmnimbus.c ssystem3.c stic.c x68k.c

trunk/src/mame/audio/jaguar.c
r17788r17789
217217READ16_MEMBER( jaguar_state::jerry_regs_r )
218218{
219219   if (offset != JINTCTRL && offset != JINTCTRL+2)
220      logerror("%08X:jerry read register @ F10%03X\n", cpu_get_previouspc(&space.device()), offset * 2);
220      logerror("%08X:jerry read register @ F10%03X\n", space.device().safe_pcbase(), offset * 2);
221221
222222   switch (offset)
223223   {
r17788r17789
244244   }
245245
246246   if (offset != JINTCTRL && offset != JINTCTRL+2 && offset != ASICTRL)
247      logerror("%08X:jerry write register @ F10%03X = %04X\n", cpu_get_previouspc(&space.device()), offset * 2, data);
247      logerror("%08X:jerry write register @ F10%03X = %04X\n", space.device().safe_pcbase(), offset * 2, data);
248248}
249249
250250
r17788r17789
322322
323323READ32_MEMBER( jaguar_state::serial_r )
324324{
325   logerror("%08X:jaguar_serial_r(%X)\n", cpu_get_previouspc(&space.device()), offset);
325   logerror("%08X:jaguar_serial_r(%X)\n", space.device().safe_pcbase(), offset);
326326   return 0;
327327}
328328
r17788r17789
358358         break;
359359
360360      default:
361         logerror("%08X:jaguar_serial_w(%X,%X)\n", cpu_get_previouspc(&space.device()), offset, data);
361         logerror("%08X:jaguar_serial_w(%X,%X)\n", space.device().safe_pcbase(), offset, data);
362362         break;
363363   }
364364}
trunk/src/mame/audio/cage.c
r17788r17789
410410   }
411411
412412   if (LOG_32031_IOPORTS)
413      logerror("CAGE:%06X:%s read -> %08X\n", cpu_get_pc(&space->device()), register_names[offset & 0x7f], result);
413      logerror("CAGE:%06X:%s read -> %08X\n", space->device().safe_pc(), register_names[offset & 0x7f], result);
414414   return result;
415415}
416416
r17788r17789
423423   COMBINE_DATA(&tms32031_io_regs[offset]);
424424
425425   if (LOG_32031_IOPORTS)
426      logerror("CAGE:%06X:%s write = %08X\n", cpu_get_pc(&space->device()), register_names[offset & 0x7f], tms32031_io_regs[offset]);
426      logerror("CAGE:%06X:%s write = %08X\n", space->device().safe_pc(), register_names[offset & 0x7f], tms32031_io_regs[offset]);
427427
428428   switch (offset)
429429   {
r17788r17789
506506{
507507   cage_t *state = &cage;
508508   if (LOG_COMM)
509      logerror("%06X:CAGE read command = %04X\n", cpu_get_pc(&space->device()), state->from_main);
509      logerror("%06X:CAGE read command = %04X\n", space->device().safe_pc(), state->from_main);
510510   state->cpu_to_cage_ready = 0;
511511   update_control_lines(space->machine());
512512   device_set_input_line(state->cpu, TMS3203X_IRQ0, CLEAR_LINE);
r17788r17789
519519   if (LOG_COMM)
520520   {
521521      cage_t *state = &cage;
522      logerror("%06X:CAGE ack command = %04X\n", cpu_get_pc(&space->device()), state->from_main);
522      logerror("%06X:CAGE ack command = %04X\n", space->device().safe_pc(), state->from_main);
523523   }
524524}
525525
r17788r17789
528528{
529529   cage_t *state = &cage;
530530   if (LOG_COMM)
531      logerror("%06X:Data from CAGE = %04X\n", cpu_get_pc(&space->device()), data);
531      logerror("%06X:Data from CAGE = %04X\n", space->device().safe_pc(), data);
532532   driver_device *drvstate = space->machine().driver_data<driver_device>();
533533   drvstate->soundlatch_word_w(*space, 0, data, mem_mask);
534534   state->cage_to_cpu_ready = 1;
trunk/src/mame/audio/segasnd.c
r17788r17789
465465{
466466   usb_state *usb = get_safe_token(device);
467467
468   LOG(("%04X:usb_data_r = %02X\n", cpu_get_pc(usb->maincpu), (usb->out_latch & 0x81) | (usb->in_latch & 0x7e)));
468   LOG(("%04X:usb_data_r = %02X\n", usb->maincpu->safe_pc(), (usb->out_latch & 0x81) | (usb->in_latch & 0x7e)));
469469
470470   device_adjust_icount(usb->maincpu, -200);
471471
r17788r17789
496496{
497497   usb_state *usb = get_safe_token(device);
498498
499   LOG(("%04X:usb_data_w = %02X\n", cpu_get_pc(usb->maincpu), data));
499   LOG(("%04X:usb_data_w = %02X\n", usb->maincpu->safe_pc(), data));
500500   device->machine().scheduler().synchronize(FUNC(delayed_usb_data_w), data, usb);
501501
502502   /* boost the interleave so that sequences can be sent */
r17788r17789
519519   if (usb->in_latch & 0x80)
520520      usb->program_ram[offset] = data;
521521   else
522      LOG(("%04X:sega_usb_ram_w(%03X) = %02X while /LOAD disabled\n", cpu_get_pc(usb->maincpu), offset, data));
522      LOG(("%04X:sega_usb_ram_w(%03X) = %02X while /LOAD disabled\n", usb->maincpu->safe_pc(), offset, data));
523523}
524524
525525
r17788r17789
536536
537537   /* bits 0-6 are inputs and map to bits 0-6 of the input latch */
538538   if ((usb->in_latch & 0x7f) != 0)
539      LOG(("%03X: P1 read = %02X\n", cpu_get_pc(usb->maincpu), usb->in_latch & 0x7f));
539      LOG(("%03X: P1 read = %02X\n", usb->maincpu->safe_pc(), usb->in_latch & 0x7f));
540540   return usb->in_latch & 0x7f;
541541}
542542
r17788r17789
547547
548548   /* bit 7 maps to bit 0 on the output latch */
549549   usb->out_latch = (usb->out_latch & 0xfe) | (data >> 7);
550   LOG(("%03X: P1 write = %02X\n", cpu_get_pc(usb->maincpu), data));
550   LOG(("%03X: P1 write = %02X\n", usb->maincpu->safe_pc(), data));
551551}
552552
553553
r17788r17789
570570   if ((old & 0x80) && !(data & 0x80))
571571      usb->t1_clock = 0;
572572
573   LOG(("%03X: P2 write -> bank=%d ready=%d clock=%d\n", cpu_get_pc(usb->maincpu), data & 3, (data >> 6) & 1, (data >> 7) & 1));
573   LOG(("%03X: P2 write -> bank=%d ready=%d clock=%d\n", usb->maincpu->safe_pc(), data & 3, (data >> 6) & 1, (data >> 7) & 1));
574574}
575575
576576
trunk/src/mame/audio/taitosnd.c
r17788r17789
110110         break;
111111
112112      case 0x04:      // port status
113         //logerror("taitosnd: Master issued control value %02x (PC = %08x) \n",data, cpu_get_pc(&space->device()) );
113         //logerror("taitosnd: Master issued control value %02x (PC = %08x) \n",data, space->device().safe_pc() );
114114         /* this does a hi-lo transition to reset the sound cpu */
115115         if (data)
116116            device_set_input_line(tc0140syt->slavecpu, INPUT_LINE_RESET, ASSERT_LINE);
r17788r17789
241241         break;
242242
243243      case 0x01:      // mode #1
244         //logerror("taitosnd: Slave cpu receives 0/1 : %01x%01x PC=%4x\n", tc0140syt->slavedata[1] , tc0140syt->slavedata[0],cpu_get_pc(&space->device()));
244         //logerror("taitosnd: Slave cpu receives 0/1 : %01x%01x PC=%4x\n", tc0140syt->slavedata[1] , tc0140syt->slavedata[0],space->device().safe_pc());
245245         tc0140syt->status &= ~TC0140SYT_PORT01_FULL;
246246         res = tc0140syt->slavedata[tc0140syt->submode ++];
247247         break;
trunk/src/mame/audio/leland.c
r17788r17789
12581258   switch (offset)
12591259   {
12601260      case 0x22/2:
1261         logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(state->m_i80186.cpu));
1261         logerror("%05X:ERROR - read from 80186 EOI\n", state->m_i80186.cpu->safe_pc());
12621262         break;
12631263
12641264      case 0x24/2:
1265         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(state->m_i80186.cpu));
1265         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", state->m_i80186.cpu->safe_pc());
12661266         if (state->m_i80186.intr.poll_status & 0x8000)
12671267            int_callback(state->m_i80186.cpu, 0);
12681268         return state->m_i80186.intr.poll_status;
12691269
12701270      case 0x26/2:
1271         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(state->m_i80186.cpu));
1271         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", state->m_i80186.cpu->safe_pc());
12721272         return state->m_i80186.intr.poll_status;
12731273
12741274      case 0x28/2:
1275         if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(state->m_i80186.cpu));
1275         if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", state->m_i80186.cpu->safe_pc());
12761276         temp  = (state->m_i80186.intr.timer  >> 3) & 0x01;
12771277         temp |= (state->m_i80186.intr.dma[0] >> 1) & 0x04;
12781278         temp |= (state->m_i80186.intr.dma[1] >> 0) & 0x08;
r17788r17789
12831283         return temp;
12841284
12851285      case 0x2a/2:
1286         if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(state->m_i80186.cpu));
1286         if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", state->m_i80186.cpu->safe_pc());
12871287         return state->m_i80186.intr.priority_mask;
12881288
12891289      case 0x2c/2:
1290         if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(state->m_i80186.cpu));
1290         if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", state->m_i80186.cpu->safe_pc());
12911291         return state->m_i80186.intr.in_service;
12921292
12931293      case 0x2e/2:
1294         if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(state->m_i80186.cpu));
1294         if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", state->m_i80186.cpu->safe_pc());
12951295         temp = state->m_i80186.intr.request & ~0x0001;
12961296         if (state->m_i80186.intr.status & 0x0007)
12971297            temp |= 1;
12981298         return temp;
12991299
13001300      case 0x30/2:
1301         if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(state->m_i80186.cpu));
1301         if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", state->m_i80186.cpu->safe_pc());
13021302         return state->m_i80186.intr.status;
13031303
13041304      case 0x32/2:
1305         if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(state->m_i80186.cpu));
1305         if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", state->m_i80186.cpu->safe_pc());
13061306         return state->m_i80186.intr.timer;
13071307
13081308      case 0x34/2:
1309         if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(state->m_i80186.cpu));
1309         if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", state->m_i80186.cpu->safe_pc());
13101310         return state->m_i80186.intr.dma[0];
13111311
13121312      case 0x36/2:
1313         if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(state->m_i80186.cpu));
1313         if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", state->m_i80186.cpu->safe_pc());
13141314         return state->m_i80186.intr.dma[1];
13151315
13161316      case 0x38/2:
1317         if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(state->m_i80186.cpu));
1317         if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", state->m_i80186.cpu->safe_pc());
13181318         return state->m_i80186.intr.ext[0];
13191319
13201320      case 0x3a/2:
1321         if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(state->m_i80186.cpu));
1321         if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", state->m_i80186.cpu->safe_pc());
13221322         return state->m_i80186.intr.ext[1];
13231323
13241324      case 0x3c/2:
1325         if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(state->m_i80186.cpu));
1325         if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", state->m_i80186.cpu->safe_pc());
13261326         return state->m_i80186.intr.ext[2];
13271327
13281328      case 0x3e/2:
1329         if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(state->m_i80186.cpu));
1329         if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", state->m_i80186.cpu->safe_pc());
13301330         return state->m_i80186.intr.ext[3];
13311331
13321332      case 0x50/2:
13331333      case 0x58/2:
13341334      case 0x60/2:
1335         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4);
1335         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4);
13361336         which = (offset - 0x50/2) / 4;
13371337         if (ACCESSING_BITS_0_7)
13381338            internal_timer_sync(state, which);
r17788r17789
13411341      case 0x52/2:
13421342      case 0x5a/2:
13431343      case 0x62/2:
1344         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4);
1344         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4);
13451345         which = (offset - 0x50/2) / 4;
13461346         return state->m_i80186.timer[which].maxA;
13471347
13481348      case 0x54/2:
13491349      case 0x5c/2:
1350         logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(state->m_i80186.cpu), (offset/2 - 0x50) / 4);
1350         logerror("%05X:read 80186 Timer %d max B\n", state->m_i80186.cpu->safe_pc(), (offset/2 - 0x50) / 4);
13511351         which = (offset - 0x50/2) / 4;
13521352         return state->m_i80186.timer[which].maxB;
13531353
13541354      case 0x56/2:
13551355      case 0x5e/2:
13561356      case 0x66/2:
1357         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0x50/2) / 4);
1357         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", state->m_i80186.cpu->safe_pc(), (offset - 0x50/2) / 4);
13581358         which = (offset - 0x50/2) / 4;
13591359         return state->m_i80186.timer[which].control;
13601360
13611361      case 0xa0/2:
1362         if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(state->m_i80186.cpu));
1362         if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", state->m_i80186.cpu->safe_pc());
13631363         return state->m_i80186.mem.upper;
13641364
13651365      case 0xa2/2:
1366         if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(state->m_i80186.cpu));
1366         if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", state->m_i80186.cpu->safe_pc());
13671367         return state->m_i80186.mem.lower;
13681368
13691369      case 0xa4/2:
1370         if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(state->m_i80186.cpu));
1370         if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", state->m_i80186.cpu->safe_pc());
13711371         return state->m_i80186.mem.peripheral;
13721372
13731373      case 0xa6/2:
1374         if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(state->m_i80186.cpu));
1374         if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", state->m_i80186.cpu->safe_pc());
13751375         return state->m_i80186.mem.middle;
13761376
13771377      case 0xa8/2:
1378         if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(state->m_i80186.cpu));
1378         if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", state->m_i80186.cpu->safe_pc());
13791379         return state->m_i80186.mem.middle_size;
13801380
13811381      case 0xc0/2:
13821382      case 0xd0/2:
1383         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8);
1383         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8);
13841384         which = (offset - 0xc0/2) / 8;
13851385         state->m_dma_stream->update();
13861386         return state->m_i80186.dma[which].source;
13871387
13881388      case 0xc2/2:
13891389      case 0xd2/2:
1390         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8);
1390         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8);
13911391         which = (offset - 0xc0/2) / 8;
13921392         state->m_dma_stream->update();
13931393         return state->m_i80186.dma[which].source >> 16;
13941394
13951395      case 0xc4/2:
13961396      case 0xd4/2:
1397         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8);
1397         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8);
13981398         which = (offset - 0xc0/2) / 8;
13991399         state->m_dma_stream->update();
14001400         return state->m_i80186.dma[which].dest;
14011401
14021402      case 0xc6/2:
14031403      case 0xd6/2:
1404         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8);
1404         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8);
14051405         which = (offset - 0xc0/2) / 8;
14061406         state->m_dma_stream->update();
14071407         return state->m_i80186.dma[which].dest >> 16;
14081408
14091409      case 0xc8/2:
14101410      case 0xd8/2:
1411         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8);
1411         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8);
14121412         which = (offset - 0xc0/2) / 8;
14131413         state->m_dma_stream->update();
14141414         return state->m_i80186.dma[which].count;
14151415
14161416      case 0xca/2:
14171417      case 0xda/2:
1418         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(state->m_i80186.cpu), (offset - 0xc0/2) / 8);
1418         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", state->m_i80186.cpu->safe_pc(), (offset - 0xc0/2) / 8);
14191419         which = (offset - 0xc0/2) / 8;
14201420         state->m_dma_stream->update();
14211421         return state->m_i80186.dma[which].control;
14221422
14231423      default:
1424         logerror("%05X:read 80186 port %02X\n", cpu_get_pc(state->m_i80186.cpu), offset*2);
1424         logerror("%05X:read 80186 port %02X\n", state->m_i80186.cpu->safe_pc(), offset*2);
14251425         break;
14261426   }
14271427   return 0x00;
r17788r17789
14491449   switch (offset)
14501450   {
14511451      case 0x22/2:
1452         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1452         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14531453         handle_eoi(device, 0x8000);
14541454         update_interrupt_state(device);
14551455         break;
14561456
14571457      case 0x24/2:
1458         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1458         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14591459         break;
14601460
14611461      case 0x26/2:
1462         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1462         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14631463         break;
14641464
14651465      case 0x28/2:
1466         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1466         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14671467         state->m_i80186.intr.timer  = (state->m_i80186.intr.timer  & ~0x08) | ((data << 3) & 0x08);
14681468         state->m_i80186.intr.dma[0] = (state->m_i80186.intr.dma[0] & ~0x08) | ((data << 1) & 0x08);
14691469         state->m_i80186.intr.dma[1] = (state->m_i80186.intr.dma[1] & ~0x08) | ((data << 0) & 0x08);
r17788r17789
14751475         break;
14761476
14771477      case 0x2a/2:
1478         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1478         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14791479         state->m_i80186.intr.priority_mask = data & 0x0007;
14801480         update_interrupt_state(device);
14811481         break;
14821482
14831483      case 0x2c/2:
1484         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1484         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14851485         state->m_i80186.intr.in_service = data & 0x00ff;
14861486         update_interrupt_state(device);
14871487         break;
14881488
14891489      case 0x2e/2:
1490         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1490         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14911491         state->m_i80186.intr.request = (state->m_i80186.intr.request & ~0x00c0) | (data & 0x00c0);
14921492         update_interrupt_state(device);
14931493         break;
14941494
14951495      case 0x30/2:
1496         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1496         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
14971497         state->m_i80186.intr.status = (state->m_i80186.intr.status & ~0x8000) | (data & 0x8000);
14981498         state->m_i80186.intr.status = (state->m_i80186.intr.status & ~0x0007) | (data & 0x0007);
14991499         update_interrupt_state(device);
15001500         break;
15011501
15021502      case 0x32/2:
1503         if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1503         if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15041504         state->m_i80186.intr.timer = data & 0x000f;
15051505         break;
15061506
15071507      case 0x34/2:
1508         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1508         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15091509         state->m_i80186.intr.dma[0] = data & 0x000f;
15101510         break;
15111511
15121512      case 0x36/2:
1513         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1513         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15141514         state->m_i80186.intr.dma[1] = data & 0x000f;
15151515         break;
15161516
15171517      case 0x38/2:
1518         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1518         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15191519         state->m_i80186.intr.ext[0] = data & 0x007f;
15201520         break;
15211521
15221522      case 0x3a/2:
1523         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1523         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15241524         state->m_i80186.intr.ext[1] = data & 0x007f;
15251525         break;
15261526
15271527      case 0x3c/2:
1528         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1528         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15291529         state->m_i80186.intr.ext[2] = data & 0x001f;
15301530         break;
15311531
15321532      case 0x3e/2:
1533         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1533         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15341534         state->m_i80186.intr.ext[3] = data & 0x001f;
15351535         break;
15361536
15371537      case 0x50/2:
15381538      case 0x58/2:
15391539      case 0x60/2:
1540         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);
1540         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);
15411541         which = (offset - 0x50/2) / 4;
15421542         internal_timer_update(state, which, data, -1, -1, -1);
15431543         break;
r17788r17789
15451545      case 0x52/2:
15461546      case 0x5a/2:
15471547      case 0x62/2:
1548         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);
1548         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);
15491549         which = (offset - 0x50/2) / 4;
15501550         internal_timer_update(state, which, -1, data, -1, -1);
15511551         break;
15521552
15531553      case 0x54/2:
15541554      case 0x5c/2:
1555         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);
1555         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);
15561556         which = (offset - 0x50/2) / 4;
15571557         internal_timer_update(state, which, -1, -1, data, -1);
15581558         break;
r17788r17789
15601560      case 0x56/2:
15611561      case 0x5e/2:
15621562      case 0x66/2:
1563         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);
1563         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);
15641564         which = (offset - 0x50/2) / 4;
15651565         internal_timer_update(state, which, -1, -1, -1, data);
15661566         break;
15671567
15681568      case 0xa0/2:
1569         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1569         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15701570         state->m_i80186.mem.upper = data | 0xc038;
15711571         break;
15721572
15731573      case 0xa2/2:
1574         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1574         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15751575         state->m_i80186.mem.lower = (data & 0x3fff) | 0x0038;
15761576         break;
15771577
15781578      case 0xa4/2:
1579         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1579         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15801580         state->m_i80186.mem.peripheral = data | 0x0038;
15811581         break;
15821582
15831583      case 0xa6/2:
1584         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1584         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15851585         state->m_i80186.mem.middle = data | 0x01f8;
15861586         break;
15871587
15881588      case 0xa8/2:
1589         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1589         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
15901590         state->m_i80186.mem.middle_size = data | 0x8038;
15911591
15921592         temp = (state->m_i80186.mem.peripheral & 0xffc0) << 4;
r17788r17789
16081608
16091609      case 0xc0/2:
16101610      case 0xd0/2:
1611         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);
1611         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);
16121612         which = (offset - 0xc0/2) / 8;
16131613         state->m_dma_stream->update();
16141614         state->m_i80186.dma[which].source = (state->m_i80186.dma[which].source & ~0x0ffff) | (data & 0x0ffff);
r17788r17789
16161616
16171617      case 0xc2/2:
16181618      case 0xd2/2:
1619         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);
1619         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);
16201620         which = (offset - 0xc0/2) / 8;
16211621         state->m_dma_stream->update();
16221622         state->m_i80186.dma[which].source = (state->m_i80186.dma[which].source & ~0xf0000) | ((data << 16) & 0xf0000);
r17788r17789
16241624
16251625      case 0xc4/2:
16261626      case 0xd4/2:
1627         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);
1627         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);
16281628         which = (offset - 0xc0/2) / 8;
16291629         state->m_dma_stream->update();
16301630         state->m_i80186.dma[which].dest = (state->m_i80186.dma[which].dest & ~0x0ffff) | (data & 0x0ffff);
r17788r17789
16321632
16331633      case 0xc6/2:
16341634      case 0xd6/2:
1635         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);
1635         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);
16361636         which = (offset - 0xc0/2) / 8;
16371637         state->m_dma_stream->update();
16381638         state->m_i80186.dma[which].dest = (state->m_i80186.dma[which].dest & ~0xf0000) | ((data << 16) & 0xf0000);
r17788r17789
16401640
16411641      case 0xc8/2:
16421642      case 0xd8/2:
1643         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);
1643         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);
16441644         which = (offset - 0xc0/2) / 8;
16451645         state->m_dma_stream->update();
16461646         state->m_i80186.dma[which].count = data;
r17788r17789
16481648
16491649      case 0xca/2:
16501650      case 0xda/2:
1651         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);
1651         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);
16521652         which = (offset - 0xc0/2) / 8;
16531653         state->m_dma_stream->update();
16541654         update_dma_control(state, which, data);
16551655         break;
16561656
16571657      case 0xfe/2:
1658         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), data, mem_mask);
1658         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), data, mem_mask);
16591659
16601660         /* we assume here there that this doesn't happen too often */
16611661         /* plus, we can't really remove the old memory range, so we also assume that it's */
r17788r17789
16741674         break;
16751675
16761676      default:
1677         logerror("%05X:80186 port %02X = %04X & %04X\n", cpu_get_pc(state->m_i80186.cpu), offset*2, data, mem_mask);
1677         logerror("%05X:80186 port %02X = %04X & %04X\n", state->m_i80186.cpu->safe_pc(), offset*2, data, mem_mask);
16781678         break;
16791679   }
16801680}
r17788r17789
18301830
18311831   if (LOG_COMM)
18321832   {
1833      logerror("%04X:80186 control = %02X", cpu_get_previouspc(state->m_i80186.cpu), data);
1833      logerror("%04X:80186 control = %02X", state->m_i80186.cpu->safe_pcbase(), data);
18341834      if (!(data & 0x80)) logerror("  /RESET");
18351835      if (!(data & 0x40)) logerror("  ZNMI");
18361836      if (!(data & 0x20)) logerror("  INT0");
r17788r17789
19021902WRITE8_DEVICE_HANDLER( leland_80186_command_hi_w )
19031903{
19041904   leland_sound_state *state = get_safe_token(device);
1905   if (LOG_COMM) logerror("%04X:Write sound command latch hi = %02X\n", cpu_get_previouspc(state->m_i80186.cpu), data);
1905   if (LOG_COMM) logerror("%04X:Write sound command latch hi = %02X\n", state->m_i80186.cpu->safe_pcbase(), data);
19061906   state->m_sound_command = (state->m_sound_command & 0x00ff) | (data << 8);
19071907}
19081908
r17788r17789
19101910static READ16_DEVICE_HANDLER( main_to_sound_comm_r )
19111911{
19121912   leland_sound_state *state = get_safe_token(device);
1913   if (LOG_COMM) logerror("%05X:Read sound command latch = %02X\n", cpu_get_pc(state->m_i80186.cpu), state->m_sound_command);
1913   if (LOG_COMM) logerror("%05X:Read sound command latch = %02X\n", state->m_i80186.cpu->safe_pc(), state->m_sound_command);
19141914   return state->m_sound_command;
19151915}
19161916
r17788r17789
19531953READ8_DEVICE_HANDLER( leland_80186_response_r )
19541954{
19551955   leland_sound_state *state = get_safe_token(device);
1956   offs_t pc = cpu_get_previouspc(state->m_i80186.cpu);
1956   offs_t pc = state->m_i80186.cpu->safe_pcbase();
19571957
19581958   if (LOG_COMM) logerror("%04X:Read sound response latch = %02X\n", pc, state->m_sound_response);
19591959
r17788r17789
19661966static WRITE16_DEVICE_HANDLER( sound_to_main_comm_w )
19671967{
19681968   leland_sound_state *state = get_safe_token(device);
1969   if (LOG_COMM) logerror("%05X:Write sound response latch = %02X\n", cpu_get_pc(state->m_i80186.cpu), data);
1969   if (LOG_COMM) logerror("%05X:Write sound response latch = %02X\n", state->m_i80186.cpu->safe_pc(), data);
19701970   state->m_sound_response = data;
19711971}
19721972
r17788r17789
20152015
20162016      /* set the new value */
20172017      d->value = (INT16)(UINT8)data - 0x80;
2018      if (LOG_DAC) logerror("%05X:DAC %d value = %02X\n", cpu_get_pc(state->m_i80186.cpu), offset, (UINT8)data);
2018      if (LOG_DAC) logerror("%05X:DAC %d value = %02X\n", state->m_i80186.cpu->safe_pc(), offset, (UINT8)data);
20192019
20202020      /* if we haven't overflowed the buffer, add the value value to it */
20212021      if (count < DAC_BUFFER_SIZE - 1)
r17788r17789
20382038   if (ACCESSING_BITS_8_15)
20392039   {
20402040      d->volume = ((data >> 8) ^ 0x00) / DAC_VOLUME_SCALE;
2041      if (LOG_DAC) logerror("%05X:DAC %d volume = %02X\n", cpu_get_pc(state->m_i80186.cpu), offset, data);
2041      if (LOG_DAC) logerror("%05X:DAC %d volume = %02X\n", state->m_i80186.cpu->safe_pc(), offset, data);
20422042   }
20432043}
20442044
r17788r17789
20712071
20722072   /* update the volume */
20732073   d->volume = (offset & 0xff) / DAC_VOLUME_SCALE;
2074   if (LOG_DAC) logerror("%05X:DAC %d value = %02X, volume = %02X\n", cpu_get_pc(state->m_i80186.cpu), which, data, (offset & 0x1fe) / 2);
2074   if (LOG_DAC) logerror("%05X:DAC %d value = %02X, volume = %02X\n", state->m_i80186.cpu->safe_pc(), which, data, (offset & 0x1fe) / 2);
20752075}
20762076
20772077
r17788r17789
20882088
20892089   /* set the new value */
20902090   d->value = (INT16)data16 - 0x200;
2091   if (LOG_DAC) logerror("%05X:DAC 10-bit value = %02X\n", cpu_get_pc(state->m_i80186.cpu), data16);
2091   if (LOG_DAC) logerror("%05X:DAC 10-bit value = %02X\n", state->m_i80186.cpu->safe_pc(), data16);
20922092
20932093   /* if we haven't overflowed the buffer, add the value value to it */
20942094   if (count < DAC_BUFFER_SIZE - 1)
r17788r17789
21642164            return;
21652165      }
21662166   }
2167   logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", cpu_get_pc(state->m_i80186.cpu), 5, offset, data);
2167   logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", state->m_i80186.cpu->safe_pc(), 5, offset, data);
21682168}
21692169
21702170
r17788r17789
22112211         if (state->m_is_redline)
22122212            return pit8254_r(device, offset | 0x80, mem_mask);
22132213         else
2214            logerror("%05X:Unexpected peripheral read %d/%02X\n", cpu_get_pc(state->m_i80186.cpu), select, offset*2);
2214            logerror("%05X:Unexpected peripheral read %d/%02X\n", state->m_i80186.cpu->safe_pc(), select, offset*2);
22152215         break;
22162216
22172217      default:
2218         logerror("%05X:Unexpected peripheral read %d/%02X\n", cpu_get_pc(state->m_i80186.cpu), select, offset*2);
2218         logerror("%05X:Unexpected peripheral read %d/%02X\n", state->m_i80186.cpu->safe_pc(), select, offset*2);
22192219         break;
22202220   }
22212221   return 0xffff;
r17788r17789
22572257         break;
22582258
22592259      default:
2260         logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", cpu_get_pc(state->m_i80186.cpu), select, offset, data);
2260         logerror("%05X:Unexpected peripheral write %d/%02X = %02X\n", state->m_i80186.cpu->safe_pc(), select, offset, data);
22612261         break;
22622262   }
22632263}
trunk/src/mame/audio/taito_en.c
r17788r17789
9494
9595static READ16_HANDLER( es5510_dsp_r )
9696{
97//  logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(&space->device()),offset,es5510_dsp_ram[offset]);
97//  logerror("%06x: DSP read offset %04x (data is %04x)\n",space->device().safe_pc(),offset,es5510_dsp_ram[offset]);
9898//  if (es_tmp) return es5510_dsp_ram[offset];
9999/*
100100    switch (offset) {
r17788r17789
128128   UINT8 *snd_mem = (UINT8 *)space->machine().root_device().memregion("ensoniq.0")->base();
129129
130130//  if (offset>4 && offset!=0x80  && offset!=0xa0  && offset!=0xc0  && offset!=0xe0)
131//      logerror("%06x: DSP write offset %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
131//      logerror("%06x: DSP write offset %04x %04x\n",space->device().safe_pc(),offset,data);
132132
133133   COMBINE_DATA(&es5510_dsp_ram[offset]);
134134
trunk/src/mame/audio/seibu.c
r17788r17789
383383
384384READ16_HANDLER( seibu_main_word_r )
385385{
386   //logerror("%06x: seibu_main_word_r(%x)\n",cpu_get_pc(&space->device()),offset);
386   //logerror("%06x: seibu_main_word_r(%x)\n",space->device().safe_pc(),offset);
387387   switch (offset)
388388   {
389389      case 2:
r17788r17789
392392      case 5:
393393         return main2sub_pending ? 1 : 0;
394394      default:
395         //logerror("%06x: seibu_main_word_r(%x)\n",cpu_get_pc(&space->device()),offset);
395         //logerror("%06x: seibu_main_word_r(%x)\n",space->device().safe_pc(),offset);
396396         return 0xffff;
397397   }
398398}
399399
400400WRITE16_HANDLER( seibu_main_word_w )
401401{
402   //printf("%06x: seibu_main_word_w(%x,%02x)\n",cpu_get_pc(&space->device()),offset,data);
402   //printf("%06x: seibu_main_word_w(%x,%02x)\n",space->device().safe_pc(),offset,data);
403403   if (ACCESSING_BITS_0_7)
404404   {
405405      switch (offset)
r17788r17789
418418            main2sub_pending = 1;
419419            break;
420420         default:
421            //logerror("%06x: seibu_main_word_w(%x,%02x)\n",cpu_get_pc(&space->device()),offset,data);
421            //logerror("%06x: seibu_main_word_w(%x,%02x)\n",space->device().safe_pc(),offset,data);
422422            break;
423423      }
424424   }
trunk/src/mame/audio/dcs.c
r17788r17789
14511451{
14521452   dsio_state &dsio = dcs.dsio;
14531453   if (LOG_DCS_TRANSFERS)
1454      logerror("%08X:IDMA_addr = %04X\n", cpu_get_pc(&space->device()), data);
1454      logerror("%08X:IDMA_addr = %04X\n", space->device().safe_pc(), data);
14551455   downcast<adsp2181_device *>(dcs.cpu)->idma_addr_w(data);
14561456   if (data == 0)
14571457      dsio.start_on_next_write = 2;
r17788r17789
14611461WRITE32_HANDLER( dsio_idma_data_w )
14621462{
14631463   dsio_state &dsio = dcs.dsio;
1464   UINT32 pc = cpu_get_pc(&space->device());
1464   UINT32 pc = space->device().safe_pc();
14651465   if (ACCESSING_BITS_0_15)
14661466   {
14671467      if (LOG_DCS_TRANSFERS)
r17788r17789
14871487   UINT32 result;
14881488   result = downcast<adsp2181_device *>(dcs.cpu)->idma_data_r();
14891489   if (LOG_DCS_TRANSFERS)
1490      logerror("%08X:IDMA_data_r(%04X) = %04X\n", cpu_get_pc(&space->device()), downcast<adsp2181_device *>(dcs.cpu)->idma_addr_r(), result);
1490      logerror("%08X:IDMA_data_r(%04X) = %04X\n", space->device().safe_pc(), downcast<adsp2181_device *>(dcs.cpu)->idma_addr_r(), result);
14911491   return result;
14921492}
14931493
r17788r17789
16221622   if (dcs.auto_ack)
16231623      input_latch_ack_w(space,0,0,0xffff);
16241624   if (LOG_DCS_IO)
1625      logerror("%08X:input_latch_r(%04X)\n", cpu_get_pc(&space->device()), dcs.input_data);
1625      logerror("%08X:input_latch_r(%04X)\n", space->device().safe_pc(), dcs.input_data);
16261626   return dcs.input_data;
16271627}
16281628
r17788r17789
16441644static WRITE16_HANDLER( output_latch_w )
16451645{
16461646   if (LOG_DCS_IO)
1647      logerror("%08X:output_latch_w(%04X) (empty=%d)\n", cpu_get_pc(&space->device()), data, IS_OUTPUT_EMPTY());
1647      logerror("%08X:output_latch_w(%04X) (empty=%d)\n", space->device().safe_pc(), data, IS_OUTPUT_EMPTY());
16481648   space->machine().scheduler().synchronize(FUNC(latch_delayed_w), data);
16491649}
16501650
r17788r17789
16981698static WRITE16_HANDLER( output_control_w )
16991699{
17001700   if (LOG_DCS_IO)
1701      logerror("%04X:output_control = %04X\n", cpu_get_pc(&space->device()), data);
1701      logerror("%04X:output_control = %04X\n", space->device().safe_pc(), data);
17021702   space->machine().scheduler().synchronize(FUNC(output_control_delayed_w), data);
17031703}
17041704
r17788r17789
18841884         /* bit 9 forces a reset */
18851885         if (data & 0x0200)
18861886         {
1887            logerror("%04X:Rebooting DCS due to SYSCONTROL write\n", cpu_get_pc(&space->device()));
1887            logerror("%04X:Rebooting DCS due to SYSCONTROL write\n", space->device().safe_pc());
18881888            device_set_input_line(dcs.cpu, INPUT_LINE_RESET, PULSE_LINE);
18891889            dcs_boot(space->machine());
18901890            dcs.control_regs[SYSCONTROL_REG] = 0;
trunk/src/mame/audio/exidy.c
r17788r17789
686686      return 0;
687687      /* 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 */
688688      case 1:
689      logerror("%04X:exidy_sh6840_r - unexpected read, status register is TODO!\n", cpu_get_pc(state->m_maincpu));
689      logerror("%04X:exidy_sh6840_r - unexpected read, status register is TODO!\n", state->m_maincpu->safe_pc());
690690      return 0;
691691      /* offsets 2,4,6 read channel 0,1,2 MSBs and latch the LSB*/
692692      case 2: case 4: case 6:
r17788r17789
10431043   exidy_sound_state *state = get_safe_token(device);
10441044   UINT8 ret = state->m_pia1->b_output();
10451045
1046   if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound response read = %02X\n", cpu_get_previouspc(state->m_maincpu), ret);
1046   if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound response read = %02X\n", state->m_maincpu->safe_pcbase(), ret);
10471047
10481048   state->m_pia1->cb1_w(0);
10491049
r17788r17789
10561056   exidy_sound_state *state = get_safe_token(device);
10571057   UINT8 ret = (state->m_pia1->ca1_r() << 7) | (state->m_pia1->cb1_r() << 6);
10581058
1059   if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound status read = %02X\n", cpu_get_previouspc(state->m_maincpu), ret);
1059   if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound status read = %02X\n", state->m_maincpu->safe_pcbase(), ret);
10601060
10611061   return ret;
10621062}
r17788r17789
10731073{
10741074   exidy_sound_state *state = get_safe_token(device);
10751075
1076   if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound command = %02X\n", cpu_get_previouspc(state->m_maincpu), data);
1076   if (VICTORY_LOG_SOUND) logerror("%04X:!!!! Sound command = %02X\n", state->m_maincpu->safe_pcbase(), data);
10771077
10781078   device->machine().scheduler().synchronize(FUNC(delayed_command_w), data, state->m_pia1);
10791079}
trunk/src/mame/audio/invinco.c
r17788r17789
108108   }
109109
110110#if 0
111   logerror("Went LO: %02X  %04X\n", bitsGoneLow, cpu_get_pc(&space->device()));
111   logerror("Went LO: %02X  %04X\n", bitsGoneLow, space->device().safe_pc());
112112#endif
113113}
trunk/src/mame/audio/harddriv.c
r17788r17789
5454READ16_MEMBER(harddriv_state::hd68k_snd_data_r)
5555{
5656   m_soundflag = 0;
57   logerror("%06X:main read from sound=%04X\n", cpu_get_previouspc(&space.device()), m_sounddata);
57   logerror("%06X:main read from sound=%04X\n", space.device().safe_pcbase(), m_sounddata);
5858   return m_sounddata;
5959}
6060
r17788r17789
7777WRITE16_MEMBER(harddriv_state::hd68k_snd_data_w)
7878{
7979   machine().scheduler().synchronize(FUNC(delayed_68k_w), data);
80   logerror("%06X:main write to sound=%04X\n", cpu_get_previouspc(&space.device()), data);
80   logerror("%06X:main write to sound=%04X\n", space.device().safe_pcbase(), data);
8181}
8282
8383
r17788r17789
8787   device_set_input_line(m_soundcpu, INPUT_LINE_RESET, CLEAR_LINE);
8888   m_mainflag = m_soundflag = 0;
8989   update_68k_interrupts(machine());
90   logerror("%06X:Reset sound\n", cpu_get_previouspc(&space.device()));
90   logerror("%06X:Reset sound\n", space.device().safe_pcbase());
9191}
9292
9393
r17788r17789
102102{
103103   m_mainflag = 0;
104104   update_68k_interrupts(machine());
105   logerror("%06X:sound read from main=%04X\n", cpu_get_previouspc(&space.device()), m_maindata);
105   logerror("%06X:sound read from main=%04X\n", space.device().safe_pcbase(), m_maindata);
106106   return m_maindata;
107107}
108108
r17788r17789
111111{
112112   COMBINE_DATA(&m_sounddata);
113113   m_soundflag = 1;
114   logerror("%06X:sound write to main=%04X\n", cpu_get_previouspc(&space.device()), data);
114   logerror("%06X:sound write to main=%04X\n", space.device().safe_pcbase(), data);
115115}
116116
117117
r17788r17789
124124
125125READ16_MEMBER(harddriv_state::hdsnd68k_switches_r)
126126{
127   logerror("%06X:hdsnd68k_switches_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
127   logerror("%06X:hdsnd68k_switches_r(%04X)\n", space.device().safe_pcbase(), offset);
128128   return 0;
129129}
130130
131131
132132READ16_MEMBER(harddriv_state::hdsnd68k_320port_r)
133133{
134   logerror("%06X:hdsnd68k_320port_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
134   logerror("%06X:hdsnd68k_320port_r(%04X)\n", space.device().safe_pcbase(), offset);
135135   return 0;
136136}
137137
r17788r17789
143143//            D14 = 'Sound Flag'
144144//            D13 = Test Switch
145145//            D12 = 5220 Ready Flag (0=Ready)
146   logerror("%06X:hdsnd68k_status_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
146   logerror("%06X:hdsnd68k_status_r(%04X)\n", space.device().safe_pcbase(), offset);
147147   return (m_mainflag << 15) | (m_soundflag << 14) | 0x2000 | 0;//((ioport("IN0")->read() & 0x0020) << 8) | 0;
148148}
149149
r17788r17789
167167   {
168168      case 0:   /* SPWR - 5220 write strobe */
169169         /* data == 0 means high, 1 means low */
170         logerror("%06X:SPWR=%d\n", cpu_get_previouspc(&space.device()), data);
170         logerror("%06X:SPWR=%d\n", space.device().safe_pcbase(), data);
171171         break;
172172
173173      case 1:   /* SPRES - 5220 hard reset */
174174         /* data == 0 means low, 1 means high */
175         logerror("%06X:SPRES=%d\n", cpu_get_previouspc(&space.device()), data);
175         logerror("%06X:SPRES=%d\n", space.device().safe_pcbase(), data);
176176         break;
177177
178178      case 2:   /* SPRATE */
179179         /* data == 0 means 8kHz, 1 means 10kHz */
180         logerror("%06X:SPRATE=%d\n", cpu_get_previouspc(&space.device()), data);
180         logerror("%06X:SPRATE=%d\n", space.device().safe_pcbase(), data);
181181         break;
182182
183183      case 3:   /* CRAMEN */
r17788r17789
186186         break;
187187
188188      case 4:   /* RES320 */
189         logerror("%06X:RES320=%d\n", cpu_get_previouspc(&space.device()), data);
189         logerror("%06X:RES320=%d\n", space.device().safe_pcbase(), data);
190190         if (m_sounddsp != NULL)
191191            device_set_input_line(m_sounddsp, INPUT_LINE_HALT, data ? CLEAR_LINE : ASSERT_LINE);
192192         break;
r17788r17789
199199
200200WRITE16_MEMBER(harddriv_state::hdsnd68k_speech_w)
201201{
202   logerror("%06X:hdsnd68k_speech_w(%04X)=%04X\n", cpu_get_previouspc(&space.device()), offset, data);
202   logerror("%06X:hdsnd68k_speech_w(%04X)=%04X\n", space.device().safe_pcbase(), offset, data);
203203}
204204
205205
r17788r17789
249249   if (m_cramen)
250250      return m_comram[offset & 0x1ff];
251251
252   logerror("%06X:hdsnd68k_320com_r(%04X) -- not allowed\n", cpu_get_previouspc(&space.device()), offset);
252   logerror("%06X:hdsnd68k_320com_r(%04X) -- not allowed\n", space.device().safe_pcbase(), offset);
253253   return 0xffff;
254254}
255255
r17788r17789
260260   if (m_cramen)
261261      COMBINE_DATA(&m_comram[offset & 0x1ff]);
262262   else
263      logerror("%06X:hdsnd68k_320com_w(%04X)=%04X -- not allowed\n", cpu_get_previouspc(&space.device()), offset, data);
263      logerror("%06X:hdsnd68k_320com_w(%04X)=%04X -- not allowed\n", space.device().safe_pcbase(), offset, data);
264264}
265265
266266
r17788r17789
308308WRITE16_MEMBER(harddriv_state::hdsnddsp_comport_w)
309309{
310310   /* COM port TD0-7 */
311   logerror("%06X:hdsnddsp_comport_w=%d\n", cpu_get_previouspc(&space.device()), data);
311   logerror("%06X:hdsnddsp_comport_w=%d\n", space.device().safe_pcbase(), data);
312312}
313313
314314
r17788r17789
316316{
317317   /* mute DAC audio, D0=1 */
318318/*  m_dacmute = data & 1;     -- NOT STUFFED */
319   logerror("%06X:mute DAC=%d\n", cpu_get_previouspc(&space.device()), data);
319   logerror("%06X:mute DAC=%d\n", space.device().safe_pcbase(), data);
320320}
321321
322322
r17788r17789
360360
361361READ16_MEMBER(harddriv_state::hdsnddsp_compare_r)
362362{
363   logerror("%06X:hdsnddsp_compare_r(%04X)\n", cpu_get_previouspc(&space.device()), offset);
363   logerror("%06X:hdsnddsp_compare_r(%04X)\n", space.device().safe_pcbase(), offset);
364364   return 0;
365365}
trunk/src/mame/audio/beezer.c
r17788r17789
499499      return 0;
500500      /* 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 */
501501      case 1:
502      logerror("%04X:beezer_sh6840_r - unexpected read, status register is TODO!\n", cpu_get_pc(state->m_maincpu));
502      logerror("%04X:beezer_sh6840_r - unexpected read, status register is TODO!\n", state->m_maincpu->safe_pc());
503503      return 0;
504504      /* offsets 2,4,6 read channel 0,1,2 MSBs and latch the LSB*/
505505      case 2: case 4: case 6:
trunk/src/mame/audio/snes_snd.c
r17788r17789
11241124      case 0x5:      /* Port 1 */
11251125      case 0x6:      /* Port 2 */
11261126      case 0x7:      /* Port 3 */
1127         // mame_printf_debug("SPC: rd %02x @ %d, PC=%x\n", spc700->port_in[offset - 4], offset - 4, cpu_get_pc(&space->device()));
1127         // mame_printf_debug("SPC: rd %02x @ %d, PC=%x\n", spc700->port_in[offset - 4], offset - 4, space->device().safe_pc());
11281128         return spc700->port_in[offset - 4];
11291129      case 0x8: //normal RAM, can be read even if the ram disabled flag ($f0 bit 1) is active
11301130      case 0x9:
r17788r17789
11931193      case 0x5:      /* Port 1 */
11941194      case 0x6:      /* Port 2 */
11951195      case 0x7:      /* Port 3 */
1196         // mame_printf_debug("SPC: %02x to APU @ %d (PC=%x)\n", data, offset & 3, cpu_get_pc(&space->device()));
1196         // mame_printf_debug("SPC: %02x to APU @ %d (PC=%x)\n", data, offset & 3, space->device().safe_pc());
11971197         spc700->port_out[offset - 4] = data;
11981198         device->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
11991199         break;
trunk/src/mame/audio/mw8080bw.c
r17788r17789
259259      break;
260260
261261   default:
262      logerror("%04x:  Unknown sh port write %02x\n", cpu_get_pc(&space.device()), data);
262      logerror("%04x:  Unknown sh port write %02x\n", space.device().safe_pc(), data);
263263      break;
264264   }
265265}
trunk/src/mame/machine/xevious.c
r17788r17789
6363
6464READ8_HANDLER( battles_customio0_r )
6565{
66   logerror("CPU0 %04x: custom I/O Read = %02x\n",cpu_get_pc(&space->device()),battles_customio_command);
66   logerror("CPU0 %04x: custom I/O Read = %02x\n",space->device().safe_pc(),battles_customio_command);
6767   return battles_customio_command;
6868}
6969
r17788r17789
7171{
7272   int   return_data;
7373
74   if( cpu_get_pc(&space->device()) == 0xAE ){
74   if( space->device().safe_pc() == 0xAE ){
7575      /* CPU4 0xAA - 0xB9 : waiting for MB8851 ? */
7676      return_data =   ( (battles_customio_command & 0x10) << 3)
7777                  | 0x00
r17788r17789
8181                  | 0x60
8282                  | (battles_customio_prev_command & 0x0f);
8383   }
84   logerror("CPU3 %04x: custom I/O Read = %02x\n",cpu_get_pc(&space->device()),return_data);
84   logerror("CPU3 %04x: custom I/O Read = %02x\n",space->device().safe_pc(),return_data);
8585
8686   return return_data;
8787}
r17788r17789
9191{
9292   timer_device *timer = space->machine().device<timer_device>("battles_nmi");
9393
94   logerror("CPU0 %04x: custom I/O Write = %02x\n",cpu_get_pc(&space->device()),data);
94   logerror("CPU0 %04x: custom I/O Write = %02x\n",space->device().safe_pc(),data);
9595
9696   battles_customio_command = data;
9797   battles_customio_command_count = 0;
r17788r17789
108108
109109WRITE8_HANDLER( battles_customio3_w )
110110{
111   logerror("CPU3 %04x: custom I/O Write = %02x\n",cpu_get_pc(&space->device()),data);
111   logerror("CPU3 %04x: custom I/O Write = %02x\n",space->device().safe_pc(),data);
112112
113113   battles_customio_command = data;
114114}
r17788r17789
117117
118118READ8_HANDLER( battles_customio_data0_r )
119119{
120   logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",cpu_get_pc(&space->device()),offset,battles_customio_data);
120   logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",space->device().safe_pc(),offset,battles_customio_data);
121121
122122   return battles_customio_data;
123123}
124124
125125READ8_HANDLER( battles_customio_data3_r )
126126{
127   logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",cpu_get_pc(&space->device()),offset,battles_customio_data);
127   logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",space->device().safe_pc(),offset,battles_customio_data);
128128   return battles_customio_data;
129129}
130130
131131
132132WRITE8_HANDLER( battles_customio_data0_w )
133133{
134   logerror("CPU0 %04x: custom I/O parameter %02x Write = %02x\n",cpu_get_pc(&space->device()),offset,data);
134   logerror("CPU0 %04x: custom I/O parameter %02x Write = %02x\n",space->device().safe_pc(),offset,data);
135135   battles_customio_data = data;
136136}
137137
138138WRITE8_HANDLER( battles_customio_data3_w )
139139{
140   logerror("CPU3 %04x: custom I/O parameter %02x Write = %02x\n",cpu_get_pc(&space->device()),offset,data);
140   logerror("CPU3 %04x: custom I/O parameter %02x Write = %02x\n",space->device().safe_pc(),offset,data);
141141   battles_customio_data = data;
142142}
143143
r17788r17789
155155
156156WRITE8_HANDLER( battles_noise_sound_w )
157157{
158   logerror("CPU3 %04x: 50%02x Write = %02x\n",cpu_get_pc(&space->device()),offset,data);
158   logerror("CPU3 %04x: 50%02x Write = %02x\n",space->device().safe_pc(),offset,data);
159159   if( (battles_sound_played == 0) && (data == 0xFF) ){
160160      samples_device *samples = space->machine().device<samples_device>("samples");
161161      if( customio[0] == 0x40 ){
trunk/src/mame/machine/taitoio.c
r17788r17789
113113         return tc0220ioc->read_7(0);
114114
115115      default:
116//logerror("PC %06x: warning - read TC0220IOC address %02x\n",cpu_get_pc(&space->device()),offset);
116//logerror("PC %06x: warning - read TC0220IOC address %02x\n",space->device().safe_pc(),offset);
117117         return 0xff;
118118   }
119119}
r17788r17789
138138         coin_counter_w(device->machine(), 1, data & 0x08);
139139
140140//if (data & 0xf0)
141//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",cpu_get_pc(&space->device()),data,offset);
141//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",space->device().safe_pc(),data,offset);
142142
143143         break;
144144
145145      default:
146//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",cpu_get_pc(&space->device()),data,offset);
146//logerror("PC %06x: warning - write %02x to TC0220IOC address %02x\n",space->device().safe_pc(),data,offset);
147147         break;
148148   }
149149}
r17788r17789
270270         return tc0510nio->read_7(0);
271271
272272      default:
273//logerror("PC %06x: warning - read TC0510NIO address %02x\n",cpu_get_pc(&space->device()),offset);
273//logerror("PC %06x: warning - read TC0510NIO address %02x\n",space->device().safe_pc(),offset);
274274         return 0xff;
275275   }
276276}
r17788r17789
295295         break;
296296
297297      default:
298//logerror("PC %06x: warning - write %02x to TC0510NIO address %02x\n",cpu_get_pc(&space->device()),data,offset);
298//logerror("PC %06x: warning - write %02x to TC0510NIO address %02x\n",space->device().safe_pc(),data,offset);
299299         break;
300300   }
301301}
r17788r17789
312312   else
313313   {
314314      /* driftout writes the coin counters here - bug? */
315//logerror("CPU #0 PC %06x: warning - write to MSB of TC0510NIO address %02x\n",cpu_get_pc(&space->device()),offset);
315//logerror("CPU #0 PC %06x: warning - write to MSB of TC0510NIO address %02x\n",space->device().safe_pc(),offset);
316316      tc0510nio_w(device, offset, (data >> 8) & 0xff);
317317   }
318318}
r17788r17789
421421         return tc0640fio->read_7(0);
422422
423423      default:
424//logerror("PC %06x: warning - read TC0640FIO address %02x\n",cpu_get_pc(&space->device()),offset);
424//logerror("PC %06x: warning - read TC0640FIO address %02x\n",space->device().safe_pc(),offset);
425425         return 0xff;
426426   }
427427}
r17788r17789
446446         break;
447447
448448      default:
449//logerror("PC %06x: warning - write %02x to TC0640FIO address %02x\n",cpu_get_pc(&space->device()),data,offset);
449//logerror("PC %06x: warning - write %02x to TC0640FIO address %02x\n",space->device().safe_pc(),data,offset);
450450         break;
451451   }
452452}
r17788r17789
463463   else
464464   {
465465      tc0640fio_w(device, offset, (data >> 8) & 0xff);
466//logerror("CPU #0 PC %06x: warning - write to MSB of TC0640FIO address %02x\n",cpu_get_pc(&space->device()),offset);
466//logerror("CPU #0 PC %06x: warning - write to MSB of TC0640FIO address %02x\n",space->device().safe_pc(),offset);
467467   }
468468}
469469
r17788r17789
479479   else
480480   {
481481      tc0640fio_w(device, offset, data & 0xff);
482//logerror("CPU #0 PC %06x: warning - write to LSB of TC0640FIO address %02x\n",cpu_get_pc(&space->device()),offset);
482//logerror("CPU #0 PC %06x: warning - write to LSB of TC0640FIO address %02x\n",space->device().safe_pc(),offset);
483483   }
484484}
485485
trunk/src/mame/machine/nmk004.c
r17788r17789
10621062{
10631063   if (ACCESSING_BITS_0_7)
10641064   {
1065//logerror("%06x: NMK004_w %02x\n",cpu_get_pc(&space->device()),data);
1065//logerror("%06x: NMK004_w %02x\n",space->device().safe_pc(),data);
10661066      NMK004_state.from_main = data & 0xff;
10671067   }
10681068}
r17788r17789
10721072//static int last;
10731073   int res = NMK004_state.to_main;
10741074
1075//if (res != last) logerror("%06x: NMK004_r %02x\n",cpu_get_pc(&space->device()),res);
1075//if (res != last) logerror("%06x: NMK004_r %02x\n",space->device().safe_pc(),res);
10761076//last = res;
10771077
10781078   return res;
trunk/src/mame/machine/stvprot.c
r17788r17789
120120   {
121121      if(offset == 3)
122122      {
123         logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]);
123         logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]);
124124         #ifdef MAME_DEBUG
125         popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]);
125         popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]);
126126         #endif
127127         switch(a_bus[3])
128128         {
r17788r17789
141141static WRITE32_HANDLER ( twcup98_prot_w )
142142{
143143   COMBINE_DATA(&a_bus[offset]);
144   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data);
144   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data);
145145   if(offset == 3)
146146   {
147147      logerror("MAIN : %08x  DATA : %08x\n",a_bus[3],a_bus[2]);
r17788r17789
179179   {
180180      if(offset == 3)
181181      {
182         logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]);
182         logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]);
183183         #ifdef MAME_DEBUG
184         popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]);
184         popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]);
185185         #endif
186186         switch(a_bus[3])
187187         {
r17788r17789
208208static WRITE32_HANDLER ( sss_prot_w )
209209{
210210   COMBINE_DATA(&a_bus[offset]);
211   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data);
211   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data);
212212   if(offset == 3)
213213   {
214214      //logerror("MAIN : %08x  DATA : %08x\n",a_bus[3],a_bus[2]);
r17788r17789
244244   {
245245      if(offset == 3)
246246      {
247         logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]);
247         logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]);
248248         #ifdef MAME_DEBUG
249         popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]);
249         popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]);
250250         #endif
251251         switch(a_bus[3])
252252         {
r17788r17789
278278static WRITE32_HANDLER ( rsgun_prot_w )
279279{
280280   COMBINE_DATA(&a_bus[offset]);
281   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data);
281   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data);
282282   if(offset == 3)
283283   {
284284      //logerror("MAIN : %08x  DATA : %08x\n",a_bus[3],a_bus[2]);
r17788r17789
319319   {
320320      if(offset == 3)
321321      {
322         logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]);
322         logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]);
323323         #ifdef MAME_DEBUG
324         popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]);
324         popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]);
325325         #endif
326326         switch(a_bus[3])
327327         {
r17788r17789
349349static WRITE32_HANDLER ( elandore_prot_w )
350350{
351351   COMBINE_DATA(&a_bus[offset]);
352   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data);
352   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data);
353353   if(offset == 3)
354354   {
355355      /* a bus value 2 seed is used too here. */
r17788r17789
426426   {
427427      if(offset == 3)
428428      {
429         logerror("A-Bus control protection read at %06x with data = %08x\n",cpu_get_pc(&space->device()),a_bus[3]);
429         logerror("A-Bus control protection read at %06x with data = %08x\n",space->device().safe_pc(),a_bus[3]);
430430         #ifdef MAME_DEBUG
431         popmessage("Prot read at %06x with data = %08x",cpu_get_pc(&space->device()),a_bus[3]);
431         popmessage("Prot read at %06x with data = %08x",space->device().safe_pc(),a_bus[3]);
432432         #endif
433433         switch(a_bus[3])
434434         {
r17788r17789
455455static WRITE32_HANDLER ( ffreveng_prot_w )
456456{
457457   COMBINE_DATA(&a_bus[offset]);
458   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",cpu_get_pc(&space->device()),offset,data);
458   logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space->device().safe_pc(),offset,data);
459459   if(offset == 3)
460460   {
461461      //logerror("MAIN : %08x  DATA : %08x\n",a_bus[3],a_bus[2]);
r17788r17789
554554   }
555555   else
556556   {
557      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]);
557      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]);
558558   }
559559
560560   return decathlt_protregs[offset];
trunk/src/mame/machine/bublbobl.c
r17788r17789
184184READ8_MEMBER(bublbobl_state::bublbobl_mcu_port1_r)
185185{
186186
187   //logerror("%04x: 6801U4 port 1 read\n", cpu_get_pc(&space.device()));
187   //logerror("%04x: 6801U4 port 1 read\n", space.device().safe_pc());
188188   m_port1_in = ioport("IN0")->read();
189189   return (m_port1_out & m_ddr1) | (m_port1_in & ~m_ddr1);
190190}
191191
192192WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port1_w)
193193{
194   //logerror("%04x: 6801U4 port 1 write %02x\n", cpu_get_pc(&space.device()), data);
194   //logerror("%04x: 6801U4 port 1 write %02x\n", space.device().safe_pc(), data);
195195
196196   // bit 4: coin lockout
197197   coin_lockout_global_w(machine(), ~data & 0x10);
r17788r17789
215215READ8_MEMBER(bublbobl_state::bublbobl_mcu_port2_r)
216216{
217217
218   //logerror("%04x: 6801U4 port 2 read\n", cpu_get_pc(&space.device()));
218   //logerror("%04x: 6801U4 port 2 read\n", space.device().safe_pc());
219219   return (m_port2_out & m_ddr2) | (m_port2_in & ~m_ddr2);
220220}
221221
222222WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port2_w)
223223{
224   //logerror("%04x: 6801U4 port 2 write %02x\n", cpu_get_pc(&space.device()), data);
224   //logerror("%04x: 6801U4 port 2 write %02x\n", space.device().safe_pc(), data);
225225   static const char *const portnames[] = { "DSW0", "DSW1", "IN1", "IN2" };
226226
227227   // bits 0-3: bits 8-11 of shared RAM address
r17788r17789
255255
256256READ8_MEMBER(bublbobl_state::bublbobl_mcu_port3_r)
257257{
258   //logerror("%04x: 6801U4 port 3 read\n", cpu_get_pc(&space.device()));
258   //logerror("%04x: 6801U4 port 3 read\n", space.device().safe_pc());
259259   return (m_port3_out & m_ddr3) | (m_port3_in & ~m_ddr3);
260260}
261261
262262WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port3_w)
263263{
264   //logerror("%04x: 6801U4 port 3 write %02x\n", cpu_get_pc(&space.device()), data);
264   //logerror("%04x: 6801U4 port 3 write %02x\n", space.device().safe_pc(), data);
265265   m_port3_out = data;
266266}
267267
268268READ8_MEMBER(bublbobl_state::bublbobl_mcu_port4_r)
269269{
270   //logerror("%04x: 6801U4 port 4 read\n", cpu_get_pc(&space.device()));
270   //logerror("%04x: 6801U4 port 4 read\n", space.device().safe_pc());
271271   return (m_port4_out & m_ddr4) | (m_port4_in & ~m_ddr4);
272272}
273273
274274WRITE8_MEMBER(bublbobl_state::bublbobl_mcu_port4_w)
275275{
276   //logerror("%04x: 6801U4 port 4 write %02x\n", cpu_get_pc(&space.device()), data);
276   //logerror("%04x: 6801U4 port 4 write %02x\n", space.device().safe_pc(), data);
277277
278278   // bits 0-7 of shared RAM address
279279
r17788r17789
292292READ8_MEMBER(bublbobl_state::boblbobl_ic43_a_r)
293293{
294294   // if (offset >= 2)
295   //     logerror("%04x: ic43_a_r (offs %d) res = %02x\n", cpu_get_pc(&space.device()), offset, res);
295   //     logerror("%04x: ic43_a_r (offs %d) res = %02x\n", space.device().safe_pc(), offset, res);
296296
297297   if (offset == 0)
298298      return m_ic43_a << 4;
r17788r17789
342342{
343343   static const int xorval[4] = { 4, 1, 8, 2 };
344344
345   //  logerror("%04x: ic43_b_w (offs %d) %02x\n", cpu_get_pc(&space.device()), offset, data);
345   //  logerror("%04x: ic43_b_w (offs %d) %02x\n", space.device().safe_pc(), offset, data);
346346   m_ic43_b = (data >> 4) ^ xorval[offset];
347347}
348348
349349READ8_MEMBER(bublbobl_state::boblbobl_ic43_b_r)
350350{
351   //  logerror("%04x: ic43_b_r (offs %d)\n", cpu_get_pc(&space.device()), offset);
351   //  logerror("%04x: ic43_b_r (offs %d)\n", space.device().safe_pc(), offset);
352352   if (offset == 0)
353353      return m_ic43_b << 4;
354354   else
r17788r17789
382382
383383READ8_MEMBER(bublbobl_state::bublbobl_68705_port_a_r)
384384{
385   //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in);
385   //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in);
386386   return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
387387}
388388
389389WRITE8_MEMBER(bublbobl_state::bublbobl_68705_port_a_w)
390390{
391   //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data);
391   //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data);
392392   m_port_a_out = data;
393393}
394394
r17788r17789
425425
426426WRITE8_MEMBER(bublbobl_state::bublbobl_68705_port_b_w)
427427{
428   //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data);
428   //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data);
429429   static const char *const portnames[] = { "DSW0", "DSW1", "IN1", "IN2" };
430430
431431   if ((m_ddr_b & 0x01) && (~data & 0x01) && (m_port_b_out & 0x01))
r17788r17789
435435   if ((m_ddr_b & 0x02) && (data & 0x02) && (~m_port_b_out & 0x02)) /* positive edge trigger */
436436   {
437437      m_address = (m_address & 0xff00) | m_port_a_out;
438      //logerror("%04x: 68705 address %02x\n", cpu_get_pc(&space.device()), m_port_a_out);
438      //logerror("%04x: 68705 address %02x\n", space.device().safe_pc(), m_port_a_out);
439439   }
440440   if ((m_ddr_b & 0x04) && (data & 0x04) && (~m_port_b_out & 0x04)) /* positive edge trigger */
441441   {
r17788r17789
447447      {
448448         if ((m_address & 0x0800) == 0x0000)
449449         {
450            //logerror("%04x: 68705 read input port %02x\n", cpu_get_pc(&space.device()), m_address);
450            //logerror("%04x: 68705 read input port %02x\n", space.device().safe_pc(), m_address);
451451            m_latch = ioport(portnames[m_address & 3])->read();
452452         }
453453         else if ((m_address & 0x0c00) == 0x0c00)
454454         {
455            //logerror("%04x: 68705 read %02x from address %04x\n", cpu_get_pc(&space.device()), m_mcu_sharedram[m_address], m_address);
455            //logerror("%04x: 68705 read %02x from address %04x\n", space.device().safe_pc(), m_mcu_sharedram[m_address], m_address);
456456            m_latch = m_mcu_sharedram[m_address & 0x03ff];
457457         }
458458         else
459            logerror("%04x: 68705 unknown read address %04x\n", cpu_get_pc(&space.device()), m_address);
459            logerror("%04x: 68705 unknown read address %04x\n", space.device().safe_pc(), m_address);
460460      }
461461      else   /* write */
462462      {
463463         if ((m_address & 0x0c00) == 0x0c00)
464464         {
465            //logerror("%04x: 68705 write %02x to address %04x\n", cpu_get_pc(&space.device()), m_port_a_out, m_address);
465            //logerror("%04x: 68705 write %02x to address %04x\n", space.device().safe_pc(), m_port_a_out, m_address);
466466            m_mcu_sharedram[m_address & 0x03ff] = m_port_a_out;
467467         }
468468         else
469            logerror("%04x: 68705 unknown write to address %04x\n", cpu_get_pc(&space.device()), m_address);
469            logerror("%04x: 68705 unknown write to address %04x\n", space.device().safe_pc(), m_address);
470470      }
471471   }
472472   if ((m_ddr_b & 0x20) && (~data & 0x20) && (m_port_b_out & 0x20))
r17788r17789
479479   }
480480   if ((m_ddr_b & 0x40) && (~data & 0x40) && (m_port_b_out & 0x40))
481481   {
482      logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data);
482      logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data);
483483   }
484484   if ((m_ddr_b & 0x80) && (~data & 0x80) && (m_port_b_out & 0x80))
485485   {
486      logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data);
486      logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data);
487487   }
488488
489489   m_port_b_out = data;
trunk/src/mame/machine/3do.c
r17788r17789
6262
6363
6464READ32_MEMBER(_3do_state::_3do_nvarea_r){
65   logerror( "%08X: NVRAM read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset );
65   logerror( "%08X: NVRAM read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset );
6666   return 0;
6767}
6868
6969WRITE32_MEMBER(_3do_state::_3do_nvarea_w){
70   logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset, data, mem_mask );
70   logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset, data, mem_mask );
7171}
7272
7373
r17788r17789
100100READ32_MEMBER(_3do_state::_3do_slow2_r){
101101   UINT32 data = 0;
102102
103   logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset );
103   logerror( "%08X: UNK_318 read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset );
104104
105105   switch( offset ) {
106106   case 0:      /* Boot ROM checks here and expects to read 1, 0, 1, 0 in the lowest bit */
r17788r17789
114114
115115WRITE32_MEMBER(_3do_state::_3do_slow2_w)
116116{
117   logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset, data, mem_mask );
117   logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset, data, mem_mask );
118118
119119   switch( offset )
120120   {
r17788r17789
146146   UINT32 addr = ( offset & ( 0x07fc / 4 ) ) << 9;
147147   UINT32 *p = m_vram + addr;
148148
149   logerror( "%08X: SVF read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4 );
149   logerror( "%08X: SVF read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset*4 );
150150
151151   switch( offset & ( 0xE000 / 4 ) )
152152   {
r17788r17789
171171   UINT32 addr = ( offset & ( 0x07fc / 4 ) ) << 9;
172172   UINT32 *p = m_vram + addr;
173173
174   logerror( "%08X: SVF write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask );
174   logerror( "%08X: SVF write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask );
175175
176176   switch( offset & ( 0xe000 / 4 ) )
177177   {
r17788r17789
207207
208208
209209READ32_MEMBER(_3do_state::_3do_madam_r){
210   logerror( "%08X: MADAM read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4 );
210   logerror( "%08X: MADAM read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset*4 );
211211
212212   switch( offset ) {
213213   case 0x0000/4:      /* 03300000 - Revision */
r17788r17789
358358   case 0x07f8/4:
359359      return m_madam.mult_status;
360360   default:
361      logerror( "%08X: unhandled MADAM read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4 );
361      logerror( "%08X: unhandled MADAM read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset*4 );
362362      break;
363363   }
364364   return 0;
r17788r17789
366366
367367
368368WRITE32_MEMBER(_3do_state::_3do_madam_w){
369   logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask );
369   logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask );
370370
371371   switch( offset ) {
372372   case 0x0000/4:
r17788r17789
537537      break;
538538
539539   default:
540      logerror( "%08X: unhandled MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask );
540      logerror( "%08X: unhandled MADAM write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask );
541541      break;
542542   }
543543}
r17788r17789
554554
555555READ32_MEMBER(_3do_state::_3do_clio_r)
556556{
557   logerror( "%08X: CLIO read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset * 4 );
557   logerror( "%08X: CLIO read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset * 4 );
558558
559559   switch( offset )
560560   {
r17788r17789
693693      return m_clio.uncle_rom;
694694
695695   default:
696      logerror( "%08X: unhandled CLIO read offset = %08X\n", cpu_get_pc(machine().device("maincpu")), offset * 4 );
696      logerror( "%08X: unhandled CLIO read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset * 4 );
697697      break;
698698   }
699699   return 0;
r17788r17789
701701
702702WRITE32_MEMBER(_3do_state::_3do_clio_w)
703703{
704   logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask );
704   logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask );
705705
706706   switch( offset )
707707   {
r17788r17789
945945      break;
946946
947947   default:
948      logerror( "%08X: unhandled CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(machine().device("maincpu")), offset*4, data, mem_mask );
948      logerror( "%08X: unhandled CLIO write offset = %08X, data = %08X, mask = %08X\n", machine().device("maincpu")->safe_pc(), offset*4, data, mem_mask );
949949      break;
950950   }
951951}
trunk/src/mame/machine/asic65.c
r17788r17789
211211   else
212212   {
213213      int command = (data < MAX_COMMANDS) ? command_map[asic65.type][data] : OP_UNKNOWN;
214      if (asic65.log) fprintf(asic65.log, "\n(%06X)%c%04X:", cpu_get_previouspc(&space->device()), (command == OP_UNKNOWN) ? '*' : ' ', data);
214      if (asic65.log) fprintf(asic65.log, "\n(%06X)%c%04X:", space->device().safe_pcbase(), (command == OP_UNKNOWN) ? '*' : ' ', data);
215215
216216      /* set the command number and reset the parameter/result indices */
217217      asic65.command = data;
trunk/src/mame/machine/tnzs.c
r17788r17789
5050   data = upi41_master_r(m_mcu, offset & 1);
5151   device_yield(&space.device());
5252
53//  logerror("PC %04x: read %02x from mcu $c00%01x\n", cpu_get_previouspc(&space.device()), data, offset);
53//  logerror("PC %04x: read %02x from mcu $c00%01x\n", space.device().safe_pcbase(), data, offset);
5454
5555   return data;
5656}
5757
5858WRITE8_MEMBER(tnzs_state::mcu_tnzs_w)
5959{
60//  logerror("PC %04x: write %02x to mcu $c00%01x\n", cpu_get_previouspc(&space.device()), data, offset);
60//  logerror("PC %04x: write %02x to mcu $c00%01x\n", space.device().safe_pcbase(), data, offset);
6161
6262   upi41_master_w(m_mcu, offset & 1, data);
6363}
r17788r17789
7575      default:   data = 0xff; break;
7676   }
7777
78//  logerror("I8742:%04x  Read %02x from port 1\n", cpu_get_previouspc(&space.device()), data);
78//  logerror("I8742:%04x  Read %02x from port 1\n", space.device().safe_pcbase(), data);
7979
8080   return data;
8181}
r17788r17789
8484{
8585   int data = ioport("IN2")->read();
8686
87//  logerror("I8742:%04x  Read %02x from port 2\n", cpu_get_previouspc(&space.device()), data);
87//  logerror("I8742:%04x  Read %02x from port 2\n", space.device().safe_pcbase(), data);
8888
8989   return data;
9090}
9191
9292WRITE8_MEMBER(tnzs_state::tnzs_port2_w)
9393{
94//  logerror("I8742:%04x  Write %02x to port 2\n", cpu_get_previouspc(&space.device()), data);
94//  logerror("I8742:%04x  Write %02x to port 2\n", space.device().safe_pcbase(), data);
9595
9696   coin_lockout_w(machine(), 0, (data & 0x40));
9797   coin_lockout_w(machine(), 1, (data & 0x80));
r17788r17789
107107{
108108   int val;
109109
110//  logerror("PC %04x: read input %04x\n", cpu_get_pc(&space.device()), 0xf000 + offset);
110//  logerror("PC %04x: read input %04x\n", space.device().safe_pc(), 0xf000 + offset);
111111
112112   val = ioport((offset / 2) ? "AN2" : "AN1")->read_safe(0);
113113   if (offset & 1)
r17788r17789
212212{
213213   static const char mcu_startup[] = "\x55\xaa\x5a";
214214
215//  logerror("PC %04x: read mcu %04x\n", cpu_get_pc(&space.device()), 0xc000 + offset);
215//  logerror("PC %04x: read mcu %04x\n", space.device().safe_pc(), 0xc000 + offset);
216216
217217   if (offset == 0)
218218   {
r17788r17789
273273{
274274   if (offset == 0)
275275   {
276//      logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset);
276//      logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset);
277277      if (m_mcu_command == 0x41)
278278      {
279279         m_mcu_credits = (m_mcu_credits + data) & 0xff;
r17788r17789
290290        0x80: release coin lockout (issued only in test mode)
291291        during initialization, a sequence of 4 bytes sets coin/credit settings
292292        */
293//      logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset);
293//      logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset);
294294
295295      if (m_mcu_initializing)
296296      {
r17788r17789
318318{
319319   static const char mcu_startup[] = "\x5a\xa5\x55";
320320
321//  logerror("PC %04x: read mcu %04x\n", cpu_get_pc(&space.device()), 0xc000 + offset);
321//  logerror("PC %04x: read mcu %04x\n", space.device().safe_pc(), 0xc000 + offset);
322322
323323   if (offset == 0)
324324   {
r17788r17789
402402{
403403   if (offset == 0)
404404   {
405//      logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset);
405//      logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset);
406406      if (m_mcu_command == 0x41)
407407      {
408408         m_mcu_credits = (m_mcu_credits + data) & 0xff;
r17788r17789
424424        during initialization, a sequence of 4 bytes sets coin/credit settings
425425        */
426426
427//      logerror("PC %04x: write %02x to mcu %04x\n", cpu_get_pc(&space.device()), data, 0xc000 + offset);
427//      logerror("PC %04x: write %02x to mcu %04x\n", space.device().safe_pc(), data, 0xc000 + offset);
428428
429429      if (m_mcu_initializing)
430430      {
r17788r17789
729729WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bankswitch_w)
730730{
731731
732//  logerror("PC %04x: writing %02x to bankswitch\n", cpu_get_pc(&space.device()),data);
732//  logerror("PC %04x: writing %02x to bankswitch\n", space.device().safe_pc(),data);
733733
734734   /* bit 4 resets the second CPU */
735735   if (data & 0x10)
r17788r17789
743743
744744WRITE8_MEMBER(tnzs_state::tnzs_bankswitch1_w)
745745{
746//  logerror("PC %04x: writing %02x to bankswitch 1\n", cpu_get_pc(&space.device()),data);
746//  logerror("PC %04x: writing %02x to bankswitch 1\n", space.device().safe_pc(),data);
747747
748748   switch (m_mcu_type)
749749   {
trunk/src/mame/machine/midyunit.c
r17788r17789
2727
2828WRITE16_MEMBER(midyunit_state::midyunit_cmos_w)
2929{
30   logerror("%08x:CMOS Write @ %05X\n", cpu_get_pc(&space.device()), offset);
30   logerror("%08x:CMOS Write @ %05X\n", space.device().safe_pc(), offset);
3131   COMBINE_DATA(&m_cmos_ram[offset + m_cmos_page]);
3232}
3333
r17788r17789
4949{
5050   m_cmos_w_enable = (~data >> 9) & 1;
5151
52   logerror("%08x:Protection write = %04X\n", cpu_get_pc(&space.device()), data);
52   logerror("%08x:Protection write = %04X\n", space.device().safe_pc(), data);
5353
5454   /* only go down this path if we have a data structure */
5555   if (m_prot_data)
r17788r17789
9898READ16_MEMBER(midyunit_state::midyunit_protection_r)
9999{
100100   /* return the most recently clocked value */
101   logerror("%08X:Protection read = %04X\n", cpu_get_pc(&space.device()), m_prot_result);
101   logerror("%08X:Protection read = %04X\n", space.device().safe_pc(), m_prot_result);
102102   return m_prot_result;
103103}
104104
r17788r17789
185185
186186WRITE16_MEMBER(midyunit_state::term2_hack_w)
187187{
188   if (offset == 1 && cpu_get_pc(&space.device()) == 0xffce6520)
188   if (offset == 1 && space.device().safe_pc() == 0xffce6520)
189189   {
190190      m_t2_hack_mem[offset] = 0;
191191      return;
r17788r17789
195195
196196WRITE16_MEMBER(midyunit_state::term2la3_hack_w)
197197{
198   if (offset == 0 && cpu_get_pc(&space.device()) == 0xffce5230)
198   if (offset == 0 && space.device().safe_pc() == 0xffce5230)
199199   {
200200      m_t2_hack_mem[offset] = 0;
201201      return;
r17788r17789
205205
206206WRITE16_MEMBER(midyunit_state::term2la2_hack_w)
207207{
208   if (offset == 0 && cpu_get_pc(&space.device()) == 0xffce4b80)
208   if (offset == 0 && space.device().safe_pc() == 0xffce4b80)
209209   {
210210      m_t2_hack_mem[offset] = 0;
211211      return;
r17788r17789
215215
216216WRITE16_MEMBER(midyunit_state::term2la1_hack_w)
217217{
218   if (offset == 0 && cpu_get_pc(&space.device()) == 0xffce33f0)
218   if (offset == 0 && space.device().safe_pc() == 0xffce33f0)
219219   {
220220      m_t2_hack_mem[offset] = 0;
221221      return;
r17788r17789
580580   /* check for out-of-bounds accesses */
581581   if (offset)
582582   {
583      logerror("%08X:Unexpected write to sound (hi) = %04X\n", cpu_get_pc(&space.device()), data);
583      logerror("%08X:Unexpected write to sound (hi) = %04X\n", space.device().safe_pc(), data);
584584      return;
585585   }
586586
trunk/src/mame/machine/naomi.c
r17788r17789
2828
2929static READ64_HANDLER( naomi_biose_idle_skip_r )
3030{
31   if (cpu_get_pc(&space->device())==0xc04173c)
31   if (space->device().safe_pc()==0xc04173c)
3232      device_spin_until_time(&space->device(), attotime::from_usec(500));
3333      //device_spin_until_interrupt(&space->device());
3434//  else
35//      printf("%08x\n", cpu_get_pc(&space->device()));
35//      printf("%08x\n", space->device().safe_pc());
3636
3737   return naomi_ram64[0x2ad238/8];
3838}
3939
4040static READ64_HANDLER( naomi_biosh_idle_skip_r )
4141{
42   if (cpu_get_pc(&space->device())==0xc045ffc)
42   if (space->device().safe_pc()==0xc045ffc)
4343      device_spin_until_time(&space->device(), attotime::from_usec(500));
4444
45//   printf("%08x\n", cpu_get_pc(&space->device()));
45//   printf("%08x\n", space->device().safe_pc());
4646
4747   return naomi_ram64[0x2b0600/8];
4848}
4949
5050static READ64_HANDLER( naomi2_biose_idle_skip_r )
5151{
52   if (cpu_get_pc(&space->device())==0xc04637c)
52   if (space->device().safe_pc()==0xc04637c)
5353      device_spin_until_time(&space->device(), attotime::from_usec(500));
5454      //device_spin_until_interrupt(&space->device());
5555//  else
56//      printf("%08x\n", cpu_get_pc(&space->device()));
56//      printf("%08x\n", space->device().safe_pc());
5757
5858   return naomi_ram64[0x2b0600/8];
5959}
r17788r17789
243243
244244static READ64_HANDLER( naomigd_ggxxsla_idle_skip_r )
245245{
246   if (cpu_get_pc(&space->device())==0x0c0c9adc)
246   if (space->device().safe_pc()==0x0c0c9adc)
247247      device_spin_until_time(&space->device(), attotime::from_usec(500));
248248
249249   return naomi_ram64[0x1aae18/8];
r17788r17789
257257
258258static READ64_HANDLER( naomigd_ggxx_idle_skip_r )
259259{
260   if (cpu_get_pc(&space->device())==0xc0b5c3c) // or 0xc0bab0c
260   if (space->device().safe_pc()==0xc0b5c3c) // or 0xc0bab0c
261261      device_spin_until_time(&space->device(), attotime::from_usec(500));
262262
263263   return naomi_ram64[0x1837b8/8];
r17788r17789
272272
273273static READ64_HANDLER( naomigd_ggxxrl_idle_skip_r )
274274{
275   if (cpu_get_pc(&space->device())==0xc0b84bc) // or 0xc0bab0c
275   if (space->device().safe_pc()==0xc0b84bc) // or 0xc0bab0c
276276      device_spin_until_time(&space->device(), attotime::from_usec(500));
277277
278   //printf("%08x\n", cpu_get_pc(&space->device()));
278   //printf("%08x\n", space->device().safe_pc());
279279
280280   return naomi_ram64[0x18d6c8/8];
281281}
r17788r17789
289289/* at least speeds up the annoying copyright screens ;-) */
290290static READ64_HANDLER( naomigd_sfz3ugd_idle_skip_r )
291291{
292   if (cpu_get_pc(&space->device())==0xc36a2dc)
292   if (space->device().safe_pc()==0xc36a2dc)
293293      device_spin_until_time(&space->device(), attotime::from_usec(500));
294294
295295   return naomi_ram64[0x5dc900/8];
r17788r17789
334334
335335static READ64_HANDLER( hotd2_idle_skip_r )
336336{
337   if (cpu_get_pc(&space->device())==0xc0cfcbc)
337   if (space->device().safe_pc()==0xc0cfcbc)
338338      device_spin_until_time(&space->device(), attotime::from_usec(500));
339339      //device_spin_until_interrupt(&space->device());
340340//  else
341//  printf("%08x\n", cpu_get_pc(&space->device()));
341//  printf("%08x\n", space->device().safe_pc());
342342
343343   return naomi_ram64[0xa25fb8/8];
344344}
trunk/src/mame/machine/kaneko_hit.c
r17788r17789
194194         return (machine().rand() & 0xffff);
195195
196196      default:
197         logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1);
197         logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",space.device().safe_pc(),offset<<1);
198198   }
199199
200200   return 0;
r17788r17789
219219      case 0x12/2: hit.mult_b = data; break;
220220
221221      default:
222         logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1);
222         logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",space.device().safe_pc(),offset<<1);
223223   }
224224}
225225
r17788r17789
286286      case 0x32/2: return hit.y2s;
287287
288288      default:
289         logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1);
289         logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",space.device().safe_pc(),offset<<1);
290290   }
291291
292292   return 0;
r17788r17789
314314      case 0x38/2: break;
315315
316316      default:
317         logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1);
317         logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",space.device().safe_pc(),offset<<1);
318318   }
319319}
320320
r17788r17789
422422               hit3.mode=data;break;
423423
424424      default:
425         logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x [ %06x] = %06x\n",cpu_get_pc(&space.device()),offset<<1, idx, data);
425         logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x [ %06x] = %06x\n",space.device().safe_pc(),offset<<1, idx, data);
426426   }
427427
428428   type2_recalc_collisions(hit3);
r17788r17789
474474      case 0x88: return hit3.z1toz2;
475475
476476      default:
477         logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x [ %06x]\n",cpu_get_pc(&space.device()),offset<<1, idx);
477         logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x [ %06x]\n",space.device().safe_pc(),offset<<1, idx);
478478   }
479479
480480   return 0;
trunk/src/mame/machine/m68kfmly.c
r17788r17789
148148
149149READ16_HANDLER( tmp68301_address_decoder_r )
150150{
151   LOG(("PC %08X: TMP68301_address_decoder_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffc00 + (offset * 2))));
151   LOG(("PC %08X: TMP68301_address_decoder_r (%08X)\n", space->device().safe_pc(), (0xfffc00 + (offset * 2))));
152152
153153   return tmp68301_address_decoder[offset];
154154}
155155
156156WRITE16_HANDLER( tmp68301_address_decoder_w )
157157{
158   LOG(("PC %08X: TMP68301_address_decoder_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffc00 + (offset * 2)), data));
158   LOG(("PC %08X: TMP68301_address_decoder_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffc00 + (offset * 2)), data));
159159
160160   tmp68301_address_decoder[offset] = data;
161161}
162162
163163READ16_HANDLER( tmp68301_interrupt_controller_r )
164164{
165   LOG(("PC %08X: TMP68301_interrupt_controller_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffc80 + (offset * 2))));
165   LOG(("PC %08X: TMP68301_interrupt_controller_r (%08X)\n", space->device().safe_pc(), (0xfffc80 + (offset * 2))));
166166
167167   return tmp68301_interrupt_controller[offset];
168168}
169169
170170WRITE16_HANDLER( tmp68301_interrupt_controller_w )
171171{
172   LOG(("PC %08X: TMP68301_interrupt_controller_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffc80 + (offset * 2)), data));
172   LOG(("PC %08X: TMP68301_interrupt_controller_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffc80 + (offset * 2)), data));
173173
174174   tmp68301_interrupt_controller[offset] = data;
175175}
176176
177177READ16_HANDLER( tmp68301_parallel_interface_r )
178178{
179   LOG(("PC %08X: TMP68301_parallel_interface_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffd00 + (offset * 2))));
179   LOG(("PC %08X: TMP68301_parallel_interface_r (%08X)\n", space->device().safe_pc(), (0xfffd00 + (offset * 2))));
180180
181181   return tmp68301_parallel_interface[offset];
182182}
183183
184184WRITE16_HANDLER( tmp68301_parallel_interface_w )
185185{
186   LOG(("PC %08X: TMP68301_parallel_interface_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffd00 + (offset * 2)), data));
186   LOG(("PC %08X: TMP68301_parallel_interface_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffd00 + (offset * 2)), data));
187187
188188   tmp68301_parallel_interface[offset] = data;
189189}
190190
191191READ16_HANDLER( tmp68301_serial_interface_r )
192192{
193   LOG(("PC %08X: TMP68301_serial_interface_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffd80 + (offset * 2))));
193   LOG(("PC %08X: TMP68301_serial_interface_r (%08X)\n", space->device().safe_pc(), (0xfffd80 + (offset * 2))));
194194
195195   return tmp68301_serial_interface[offset];
196196}
197197
198198WRITE16_HANDLER( tmp68301_serial_interface_w )
199199{
200   LOG(("PC %08X: TMP68301_serial_interface_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffd80 + (offset * 2)), data));
200   LOG(("PC %08X: TMP68301_serial_interface_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffd80 + (offset * 2)), data));
201201
202202   tmp68301_serial_interface[offset] = data;
203203}
204204
205205READ16_HANDLER( tmp68301_timer_r )
206206{
207   LOG(("PC %08X: TMP68301_timer_r (%08X)\n", cpu_get_pc(&space->device()), (0xfffe00 + (offset * 2))));
207   LOG(("PC %08X: TMP68301_timer_r (%08X)\n", space->device().safe_pc(), (0xfffe00 + (offset * 2))));
208208
209209   return tmp68301_timer[offset];
210210}
211211
212212WRITE16_HANDLER( tmp68301_timer_w )
213213{
214   LOG(("PC %08X: TMP68301_timer_w (%08X = %04X)\n", cpu_get_pc(&space->device()), (0xfffe00 + (offset * 2)), data));
214   LOG(("PC %08X: TMP68301_timer_w (%08X = %04X)\n", space->device().safe_pc(), (0xfffe00 + (offset * 2)), data));
215215
216216   tmp68301_timer[offset] = data;
217217}
trunk/src/mame/machine/twincobr.c
r17788r17789
4646   m_main_ram_seg = ((data & 0xe000) << 3);
4747   m_dsp_addr_w   = ((data & 0x1fff) << 1);
4848
49   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));
49   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));
5050}
5151
5252READ16_MEMBER(twincobr_state::twincobr_dsp_r)
r17788r17789
6161      case 0x50000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
6262                  input_data = mainspace->read_word(m_main_ram_seg + m_dsp_addr_w);
6363                  break;
64      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;
64      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;
6565   }
66   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));
66   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));
6767   return input_data;
6868}
6969
r17788r17789
7979      case 0x50000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
8080                  mainspace->write_word(m_main_ram_seg + m_dsp_addr_w, data);
8181                  break;
82      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;
82      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;
8383   }
84   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));
84   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));
8585}
8686
8787WRITE16_MEMBER(twincobr_state::wardner_dsp_addrsel_w)
r17788r17789
9696
9797   if (m_main_ram_seg == 0x6000) m_main_ram_seg = 0x7000;
9898
99   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));
99   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));
100100}
101101
102102READ16_MEMBER(twincobr_state::wardner_dsp_r)
r17788r17789
112112                  input_data =  mainspace->read_byte(m_main_ram_seg + (m_dsp_addr_w + 0))
113113                           | (mainspace->read_byte(m_main_ram_seg + (m_dsp_addr_w + 1)) << 8);
114114                  break;
115      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;
115      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;
116116   }
117   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));
117   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));
118118   return input_data;
119119}
120120
r17788r17789
131131                  mainspace->write_byte(m_main_ram_seg + (m_dsp_addr_w + 0), (data & 0xff));
132132                  mainspace->write_byte(m_main_ram_seg + (m_dsp_addr_w + 1), ((data >> 8) & 0xff));
133133                  break;
134      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;
134      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;
135135   }
136   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));
136   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));
137137}
138138
139139WRITE16_MEMBER(twincobr_state::twincobr_dsp_bio_w)
r17788r17789
143143   /*              Actually only DSP data bit 15 controls this */
144144   /* data 0x0000  means set DSP BIO line active and disable */
145145   /*              communication to main processor*/
146   LOG(("DSP PC:%04x IO write %04x at port 3\n",cpu_get_previouspc(&space.device()),data));
146   LOG(("DSP PC:%04x IO write %04x at port 3\n",space.device().safe_pcbase(),data));
147147   if (data & 0x8000) {
148148      m_dsp_BIO = CLEAR_LINE;
149149   }
r17788r17789
164164   /* Port is read three times during startup. First and last data */
165165   /*   read must equal, but second data read must be different */
166166   m_fsharkbt_8741 += 1;
167   LOG(("DSP PC:%04x IO read %04x from 8741 MCU (port 2)\n",cpu_get_previouspc(&space.device()),(m_fsharkbt_8741 & 0x08)));
167   LOG(("DSP PC:%04x IO read %04x from 8741 MCU (port 2)\n",space.device().safe_pcbase(),(m_fsharkbt_8741 & 0x08)));
168168   return (m_fsharkbt_8741 & 1);
169169}
170170
r17788r17789
172172{
173173   /* Flying Shark bootleg DSP writes data to an extra MCU (8741) at IO port 2 */
174174#if 0
175   logerror("DSP PC:%04x IO write from DSP RAM:%04x to 8741 MCU (port 2)\n",cpu_get_previouspc(&space.device()),m_fsharkbt_8741);
175   logerror("DSP PC:%04x IO write from DSP RAM:%04x to 8741 MCU (port 2)\n",space.device().safe_pcbase(),m_fsharkbt_8741);
176176#endif
177177}
178178
trunk/src/mame/machine/neoboot.c
r17788r17789
702702
703703static READ16_HANDLER( mslug5_prot_r )
704704{
705   logerror("PC %06x: access protected\n",cpu_get_pc(&space->device()));
705   logerror("PC %06x: access protected\n",space->device().safe_pc());
706706   return 0xa0;
707707}
708708
709709static WRITE16_HANDLER ( ms5plus_bankswitch_w )
710710{
711711   int bankaddress;
712   logerror("offset: %06x PC %06x: set banking %04x\n",offset,cpu_get_pc(&space->device()),data);
712   logerror("offset: %06x PC %06x: set banking %04x\n",offset,space->device().safe_pc(),data);
713713   if ((offset == 0)&&(data == 0xa0))
714714   {
715715      bankaddress=0xa0;
716716      neogeo_set_main_cpu_bank_address(space, bankaddress);
717      logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,cpu_get_pc(&space->device()),bankaddress);
717      logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space->device().safe_pc(),bankaddress);
718718   }
719719   else if(offset == 2)
720720   {
r17788r17789
722722      //data=data&7;
723723      bankaddress=data*0x100000;
724724      neogeo_set_main_cpu_bank_address(space, bankaddress);
725      logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,cpu_get_pc(&space->device()),bankaddress);
725      logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space->device().safe_pc(),bankaddress);
726726   }
727727}
728728
trunk/src/mame/machine/mega32x.c
r17788r17789
446446            printf("Fifo block a isn't filled!\n");
447447
448448         if (current_fifo_readblock == fifo_block_b && !fifo_block_b_full)
449            printf("%08x Fifo block b isn't filled!\n",cpu_get_pc(&space.device()));
449            printf("%08x Fifo block b isn't filled!\n",space.device().safe_pc());
450450
451451
452452         if (current_fifo_read_pos==4)
trunk/src/mame/machine/cdicdic.c
r17788r17789
4040      va_start( v, s_fmt );
4141      vsprintf( buf, s_fmt, v );
4242      va_end( v );
43      logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
43      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
4444   }
4545}
4646#else
trunk/src/mame/machine/namcoio.c
r17788r17789
462462   namcoio_state *namcoio = get_safe_token(device);
463463   offset &= 0x3f;
464464
465//  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));
465//  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));
466466
467467   return 0xf0 | namcoio->ram[offset];
468468}
r17788r17789
473473   offset &= 0x3f;
474474   data &= 0x0f;   // RAM is 4-bit wide
475475
476//  LOG(("%04x: I/O write %d: offset %d = %02x\n", cpu_get_pc(&space->device()), offset / 16, offset & 0x0f, data));
476//  LOG(("%04x: I/O write %d: offset %d = %02x\n", space->device().safe_pc(), offset / 16, offset & 0x0f, data));
477477
478478   namcoio->ram[offset] = data;
479479}
trunk/src/mame/machine/midtunit.c
r17788r17789
8282   }
8383   else
8484   {
85      logerror("%08X:Unexpected CMOS W @ %05X\n", cpu_get_pc(&space.device()), offset);
85      logerror("%08X:Unexpected CMOS W @ %05X\n", space.device().safe_pc(), offset);
8686      popmessage("Bad CMOS write");
8787   }
8888}
r17788r17789
130130
131131READ16_MEMBER(midtunit_state::mk_prot_r)
132132{
133   logerror("%08X:Protection R @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, mk_prot_values[mk_prot_index] << 9);
133   logerror("%08X:Protection R @ %05X = %04X\n", space.device().safe_pc(), offset, mk_prot_values[mk_prot_index] << 9);
134134
135135   /* just in case */
136136   if (mk_prot_index >= sizeof(mk_prot_values))
137137   {
138      logerror("%08X:Unexpected protection R @ %05X\n", cpu_get_pc(&space.device()), offset);
138      logerror("%08X:Unexpected protection R @ %05X\n", space.device().safe_pc(), offset);
139139      mk_prot_index = 0;
140140   }
141141
r17788r17789
160160      /* just in case */
161161      if (i == sizeof(mk_prot_values))
162162      {
163         logerror("%08X:Unhandled protection W @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, data);
163         logerror("%08X:Unhandled protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data);
164164         mk_prot_index = 0;
165165      }
166166
167      logerror("%08X:Protection W @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, data);
167      logerror("%08X:Protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data);
168168   }
169169}
170170
r17788r17789
332332
333333WRITE16_MEMBER(midtunit_state::jdredd_prot_w)
334334{
335   logerror("%08X:jdredd_prot_w(%04X,%04X)\n", cpu_get_previouspc(&space.device()), offset*16, data);
335   logerror("%08X:jdredd_prot_w(%04X,%04X)\n", space.device().safe_pcbase(), offset*16, data);
336336
337337   switch (offset)
338338   {
r17788r17789
380380   if (jdredd_prot_table && jdredd_prot_index < jdredd_prot_max)
381381      result = jdredd_prot_table[jdredd_prot_index++] << 9;
382382
383   logerror("%08X:jdredd_prot_r(%04X) = %04X\n", cpu_get_previouspc(&space.device()), offset*16, result);
383   logerror("%08X:jdredd_prot_r(%04X) = %04X\n", space.device().safe_pcbase(), offset*16, result);
384384   return result;
385385}
386386
r17788r17789
389389static UINT16 *jdredd_hack;
390390READ16_MEMBER(midtunit_state::jdredd_hack_r)
391391{
392   if (cpu_get_pc(&space.device()) == 0xFFBA7EB0)
392   if (space.device().safe_pc() == 0xFFBA7EB0)
393393   {
394394      fprintf(stderr, "jdredd_hack_r\n");
395395      return 0;
r17788r17789
580580
581581READ16_MEMBER(midtunit_state::midtunit_sound_state_r)
582582{
583/*  logerror("%08X:Sound status read\n", cpu_get_pc(&space.device()));*/
583/*  logerror("%08X:Sound status read\n", space.device().safe_pc());*/
584584
585585   if (chip_type == SOUND_DCS)
586586      return dcs_control_r(machine()) >> 4;
r17788r17789
595595
596596READ16_MEMBER(midtunit_state::midtunit_sound_r)
597597{
598   logerror("%08X:Sound data read\n", cpu_get_pc(&space.device()));
598   logerror("%08X:Sound data read\n", space.device().safe_pc());
599599
600600   if (chip_type == SOUND_DCS)
601601      return dcs_data_r(machine()) & 0xff;
r17788r17789
608608   /* check for out-of-bounds accesses */
609609   if (!offset)
610610   {
611      logerror("%08X:Unexpected write to sound (lo) = %04X\n", cpu_get_pc(&space.device()), data);
611      logerror("%08X:Unexpected write to sound (lo) = %04X\n", space.device().safe_pc(), data);
612612      return;
613613   }
614614
r17788r17789
627627            break;
628628
629629         case SOUND_DCS:
630            logerror("%08X:Sound write = %04X\n", cpu_get_pc(&space.device()), data);
630            logerror("%08X:Sound write = %04X\n", space.device().safe_pc(), data);
631631            dcs_reset_w(machine(), ~data & 0x100);
632632            dcs_data_w(machine(), data & 0xff);
633633            /* the games seem to check for $82 loops, so this should be just barely enough */
trunk/src/mame/machine/namcos1.c
r17788r17789
8888
8989static READ8_HANDLER( no_key_r )
9090{
91   popmessage("CPU %s PC %08x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset);
91   popmessage("CPU %s PC %08x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset);
9292   return 0;
9393}
9494
9595static WRITE8_HANDLER( no_key_w )
9696{
97   popmessage("CPU %s PC %08x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data);
97   popmessage("CPU %s PC %08x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data);
9898}
9999
100100
r17788r17789
200200static READ8_HANDLER( key_type1_r )
201201{
202202   namcos1_state *state = space->machine().driver_data<namcos1_state>();
203//  logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset);
203//  logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset);
204204
205205   if (offset < 3)
206206   {
r17788r17789
232232static WRITE8_HANDLER( key_type1_w )
233233{
234234   namcos1_state *state = space->machine().driver_data<namcos1_state>();
235//  logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data);
235//  logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data);
236236
237237   if (offset < 4)
238238      state->m_key[offset] = data;
r17788r17789
385385static READ8_HANDLER( key_type2_r )
386386{
387387   namcos1_state *state = space->machine().driver_data<namcos1_state>();
388//  logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset);
388//  logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset);
389389
390390   state->m_key_numerator_high_word = 0;
391391
r17788r17789
405405static WRITE8_HANDLER( key_type2_w )
406406{
407407   namcos1_state *state = space->machine().driver_data<namcos1_state>();
408//  logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data);
408//  logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data);
409409
410410   if (offset < 5)
411411   {
r17788r17789
515515   namcos1_state *state = space->machine().driver_data<namcos1_state>();
516516   int op;
517517
518//  logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset);
518//  logerror("CPU %s PC %04x: keychip read %04x\n", space->device().tag(), space->device().safe_pc(), offset);
519519
520520   /* I need to handle blastoff's read from 0858. The game previously writes to 0858,
521521       using it as temporary storage, so maybe it expects to act as RAM, however
r17788r17789
531531   if (op == state->m_key_bottom4)   return (offset << 4) | (state->m_key[state->m_key_swap4_arg] & 0x0f);
532532   if (op == state->m_key_top4)      return (offset << 4) | (state->m_key[state->m_key_swap4_arg] >> 4);
533533
534   popmessage("CPU %s PC %08x: keychip read %04x", space->device().tag(), cpu_get_pc(&space->device()), offset);
534   popmessage("CPU %s PC %08x: keychip read %04x", space->device().tag(), space->device().safe_pc(), offset);
535535
536536   return 0;
537537}
r17788r17789
539539static WRITE8_HANDLER( key_type3_w )
540540{
541541   namcos1_state *state = space->machine().driver_data<namcos1_state>();
542//  logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, data);
542//  logerror("CPU %s PC %04x: keychip write %04x=%02x\n", space->device().tag(), space->device().safe_pc(), offset, data);
543543
544544   state->m_key[(offset & 0x70) >> 4] = data;
545545}
r17788r17789
571571
572572WRITE8_MEMBER(namcos1_state::namcos1_cpu_control_w)
573573{
574//  logerror("reset control pc=%04x %02x\n",cpu_get_pc(&space.device()),data);
574//  logerror("reset control pc=%04x %02x\n",space.device().safe_pc(),data);
575575   if ((data & 1) ^ m_reset)
576576   {
577577      m_mcu_patch_data = 0;
r17788r17789
646646
647647static WRITE8_HANDLER( rom_w )
648648{
649   logerror("CPU %s PC %04x: warning - write %02x to rom address %04x\n", space->device().tag(), cpu_get_pc(&space->device()), data, offset);
649   logerror("CPU %s PC %04x: warning - write %02x to rom address %04x\n", space->device().tag(), space->device().safe_pc(), data, offset);
650650}
651651
652652/* error handlers */
653653static READ8_HANDLER( unknown_r )
654654{
655   logerror("CPU %s PC %04x: warning - read from unknown chip\n", space->device().tag(), cpu_get_pc(&space->device()) );
656//  popmessage("CPU %s PC %04x: read from unknown chip", space->device().tag(), cpu_get_pc(&space->device()) );
655   logerror("CPU %s PC %04x: warning - read from unknown chip\n", space->device().tag(), space->device().safe_pc() );
656//  popmessage("CPU %s PC %04x: read from unknown chip", space->device().tag(), space->device().safe_pc() );
657657   return 0;
658658}
659659
660660static WRITE8_HANDLER( unknown_w )
661661{
662   logerror("CPU %s PC %04x: warning - wrote to unknown chip\n", space->device().tag(), cpu_get_pc(&space->device()) );
663//  popmessage("CPU %s PC %04x: wrote to unknown chip", space->device().tag(), cpu_get_pc(&space->device()) );
662   logerror("CPU %s PC %04x: warning - wrote to unknown chip\n", space->device().tag(), space->device().safe_pc() );
663//  popmessage("CPU %s PC %04x: wrote to unknown chip", space->device().tag(), space->device().safe_pc() );
664664}
665665
666666/* Main bankswitching routine */
r17788r17789
939939
940940WRITE8_MEMBER(namcos1_state::namcos1_mcu_patch_w)
941941{
942   //logerror("mcu C000 write pc=%04x data=%02x\n",cpu_get_pc(&space.device()),data);
942   //logerror("mcu C000 write pc=%04x data=%02x\n",space.device().safe_pc(),data);
943943   if (m_mcu_patch_data == 0xa6) return;
944944   m_mcu_patch_data = data;
945945   m_triram[0] = data;
trunk/src/mame/machine/pgmprot1.c
r17788r17789
121121   UINT16 *share16 = reinterpret_cast<UINT16 *>(state->m_arm7_shareram.target());
122122
123123   if (PGMARM7LOGERROR)
124      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()));
124      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());
125125   return share16[BYTE_XOR_LE(offset << 1)];
126126}
127127
r17788r17789
131131   UINT16 *share16 = reinterpret_cast<UINT16 *>(state->m_arm7_shareram.target());
132132
133133   if (PGMARM7LOGERROR)
134      logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, cpu_get_pc(&space->device()));
134      logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, space->device().safe_pc());
135135   COMBINE_DATA(&share16[BYTE_XOR_LE(offset << 1)]);
136136}
137137
r17788r17789
154154   pgm_arm_type1_state *state = space->machine().driver_data<pgm_arm_type1_state>();
155155
156156   if (PGMARM7LOGERROR)
157      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()));
157      logerror("ARM7: ARM7 Shared RAM Read: %04x = %08x (%08x) (%06x)\n", offset << 2, state->m_arm7_shareram[offset], mem_mask, space->device().safe_pc());
158158   return state->m_arm7_shareram[offset];
159159}
160160
r17788r17789
163163   pgm_arm_type1_state *state = space->machine().driver_data<pgm_arm_type1_state>();
164164
165165   if (PGMARM7LOGERROR)
166      logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, cpu_get_pc(&space->device()));
166      logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, space->device().safe_pc());
167167   COMBINE_DATA(&state->m_arm7_shareram[offset]);
168168}
169169
r17788r17789
562562         break;
563563
564564      case 0x67: // set high bits
565   //      printf("%06x command %02x | %04x\n", cpu_get_pc(&space->device()), state->m_ddp3lastcommand, state->m_value0);
565   //      printf("%06x command %02x | %04x\n", space->device().safe_pc(), state->m_ddp3lastcommand, state->m_value0);
566566         state->m_valueresponse = 0x880000;
567567         state->m_curslots = (state->m_value0 & 0xff00)>>8;
568568         state->m_slots[state->m_curslots] = (state->m_value0 & 0x00ff) << 16;
569569         break;
570570
571571      case 0xe5: // set low bits for operation?
572      //  printf("%06x command %02x | %04x\n", cpu_get_pc(&space->device()), state->m_ddp3lastcommand, state->m_value0);
572      //  printf("%06x command %02x | %04x\n", space->device().safe_pc(), state->m_ddp3lastcommand, state->m_value0);
573573         state->m_valueresponse = 0x880000;
574574         state->m_slots[state->m_curslots] |= (state->m_value0 & 0xffff);
575575         break;
576576
577577
578578      case 0x8e: // read back result of operations
579   //      printf("%06x command %02x | %04x\n", cpu_get_pc(&space->device()), state->m_ddp3lastcommand, state->m_value0);
579   //      printf("%06x command %02x | %04x\n", space->device().safe_pc(), state->m_ddp3lastcommand, state->m_value0);
580580         state->m_valueresponse = state->m_slots[state->m_value0&0xff];
581581         break;
582582
r17788r17789
13511351static WRITE16_HANDLER( pgm_arm7_type1_sim_w )
13521352{
13531353   pgm_arm_type1_state *state = space->machine().driver_data<pgm_arm_type1_state>();
1354   int pc = cpu_get_pc(&space->device());
1354   int pc = space->device().safe_pc();
13551355
13561356   if (offset == 0)
13571357   {
trunk/src/mame/machine/volfied.c
r17788r17789
344344   m_cchip_ram[(m_current_bank * 0x400) + offset] = data;
345345
346346//  if (offset != 0x8)
347//      logerror("%08x:  volfied c write %04x %04x\n", cpu_get_pc(&space.device()), offset, data);
347//      logerror("%08x:  volfied c write %04x %04x\n", space.device().safe_pc(), offset, data);
348348
349349   if (m_current_bank == 0)
350350   {
r17788r17789
444444      }
445445   }
446446
447//  if (cpu_get_pc(&space.device())!=0x15ca8 && cpu_get_pc(&space.device())!=0x15cd8 && cpu_get_pc(&space.device())!=0x15cde)
448//      logerror("%08x:  volfied c read %04x (bank %04x)\n", cpu_get_pc(&space.device()), offset, current_bank);
447//  if (space.device().safe_pc()!=0x15ca8 && space.device().safe_pc()!=0x15cd8 && space.device().safe_pc()!=0x15cde)
448//      logerror("%08x:  volfied c read %04x (bank %04x)\n", space.device().safe_pc(), offset, current_bank);
449449
450450   /* Unknown */
451451   if (m_current_bank == 2 && offset == 0x005)
trunk/src/mame/machine/balsente.c
r17788r17789
10471047               "PULSE_WIDTH",
10481048               "WAVE_SELECT"
10491049            };
1050            logerror("s%04X:   CEM#%d:%s=%f\n", cpu_get_previouspc(&space.device()), i, names[m_dac_register], voltage);
1050            logerror("s%04X:   CEM#%d:%s=%f\n", space.device().safe_pcbase(), i, names[m_dac_register], voltage);
10511051         }
10521052#endif
10531053      }
r17788r17789
11771177
11781178READ8_MEMBER(balsente_state::grudge_steering_r)
11791179{
1180   logerror("%04X:grudge_steering_r(@%d)\n", cpu_get_pc(&space.device()), machine().primary_screen->vpos());
1180   logerror("%04X:grudge_steering_r(@%d)\n", space.device().safe_pc(), machine().primary_screen->vpos());
11811181   m_grudge_steering_result |= 0x80;
11821182   return m_grudge_steering_result;
11831183}
trunk/src/mame/machine/megadriv.c
r17788r17789
8686
8787static WRITE16_HANDLER( megadriv_68k_z80_bank_write )
8888{
89   //logerror("%06x: 68k writing bit to bank register %01x\n", cpu_get_pc(&space->device()),data&0x01);
89   //logerror("%06x: 68k writing bit to bank register %01x\n", space->device().safe_pc(),data&0x01);
9090   megadriv_z80_bank_w(data&0x01);
9191}
9292
9393static WRITE8_HANDLER(megadriv_z80_z80_bank_w)
9494{
95   //logerror("%04x: z80 writing bit to bank register %01x\n", cpu_get_pc(&space->device()),data&0x01);
95   //logerror("%04x: z80 writing bit to bank register %01x\n", space->device().safe_pc(),data&0x01);
9696   megadriv_z80_bank_w(data&0x01);
9797}
9898
r17788r17789
419419   switch (offset)
420420   {
421421      case 0:
422         logerror("%06x read version register\n", cpu_get_pc(&space->device()));
422         logerror("%06x read version register\n", space->device().safe_pc());
423423         retdata = megadrive_region_export<<7 | // Export
424424                   megadrive_region_pal<<6 | // NTSC
425425                   (sega_cd_connected?0x00:0x20) | // 0x20 = no sega cd
r17788r17789
603603   }
604604   else
605605   {
606      logerror("%06x: 68000 attempting to access Z80 (read) address space without bus\n", cpu_get_pc(&space->device()));
606      logerror("%06x: 68000 attempting to access Z80 (read) address space without bus\n", space->device().safe_pc());
607607      return space->machine().rand();
608608   }
609609}
r17788r17789
630630   }
631631   else
632632   {
633      logerror("%06x: 68000 attempting to access Z80 (write) address space without bus\n", cpu_get_pc(&space->device()));
633      logerror("%06x: 68000 attempting to access Z80 (write) address space without bus\n", space->device().safe_pc());
634634   }
635635}
636636
r17788r17789
655655      if (genz80.z80_has_bus || genz80.z80_is_reset) retvalue = nextvalue | 0x0100;
656656      else retvalue = (nextvalue & 0xfeff);
657657
658      //logerror("%06x: 68000 check z80 Bus (byte MSB access) returning %04x mask %04x\n", cpu_get_pc(&space->device()),retvalue, mem_mask);
658      //logerror("%06x: 68000 check z80 Bus (byte MSB access) returning %04x mask %04x\n", space->device().safe_pc(),retvalue, mem_mask);
659659      return retvalue;
660660
661661   }
662662   else if (!ACCESSING_BITS_8_15) // is this valid?
663663   {
664      //logerror("%06x: 68000 check z80 Bus (byte LSB access) %04x\n", cpu_get_pc(&space->device()),mem_mask);
664      //logerror("%06x: 68000 check z80 Bus (byte LSB access) %04x\n", space->device().safe_pc(),mem_mask);
665665      if (genz80.z80_has_bus || genz80.z80_is_reset) retvalue = 0x0001;
666666      else retvalue = 0x0000;
667667
r17788r17789
669669   }
670670   else
671671   {
672      //logerror("%06x: 68000 check z80 Bus (word access) %04x\n", cpu_get_pc(&space->device()),mem_mask);
672      //logerror("%06x: 68000 check z80 Bus (word access) %04x\n", space->device().safe_pc(),mem_mask);
673673      if (genz80.z80_has_bus || genz80.z80_is_reset) retvalue = nextvalue | 0x0100;
674674      else retvalue = (nextvalue & 0xfeff);
675675
676   //  mame_printf_debug("%06x: 68000 check z80 Bus (word access) %04x %04x\n", cpu_get_pc(&space->device()),mem_mask, retvalue);
676   //  mame_printf_debug("%06x: 68000 check z80 Bus (word access) %04x %04x\n", space->device().safe_pc(),mem_mask, retvalue);
677677      return retvalue;
678678   }
679679}
r17788r17789
710710   {
711711      if (data & 0x0100)
712712      {
713         //logerror("%06x: 68000 request z80 Bus (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
713         //logerror("%06x: 68000 request z80 Bus (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
714714         genz80.z80_has_bus = 0;
715715      }
716716      else
717717      {
718         //logerror("%06x: 68000 return z80 Bus (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
718         //logerror("%06x: 68000 return z80 Bus (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
719719         genz80.z80_has_bus = 1;
720720      }
721721   }
r17788r17789
723723   {
724724      if (data & 0x0001)
725725      {
726         //logerror("%06x: 68000 request z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
726         //logerror("%06x: 68000 request z80 Bus (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
727727         genz80.z80_has_bus = 0;
728728      }
729729      else
730730      {
731         //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
731         //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
732732         genz80.z80_has_bus = 1;
733733      }
734734   }
r17788r17789
736736   {
737737      if (data & 0x0100)
738738      {
739         //logerror("%06x: 68000 request z80 Bus (word access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
739         //logerror("%06x: 68000 request z80 Bus (word access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
740740         genz80.z80_has_bus = 0;
741741      }
742742      else
743743      {
744         //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
744         //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
745745         genz80.z80_has_bus = 1;
746746      }
747747   }
r17788r17789
757757   {
758758      if (data & 0x0100)
759759      {
760         //logerror("%06x: 68000 clear z80 reset (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
760         //logerror("%06x: 68000 clear z80 reset (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
761761         genz80.z80_is_reset = 0;
762762      }
763763      else
764764      {
765         //logerror("%06x: 68000 start z80 reset (byte MSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
765         //logerror("%06x: 68000 start z80 reset (byte MSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
766766         genz80.z80_is_reset = 1;
767767      }
768768   }
r17788r17789
770770   {
771771      if (data & 0x0001)
772772      {
773         //logerror("%06x: 68000 clear z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
773         //logerror("%06x: 68000 clear z80 reset (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
774774         genz80.z80_is_reset = 0;
775775      }
776776      else
777777      {
778         //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
778         //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
779779         genz80.z80_is_reset = 1;
780780      }
781781   }
r17788r17789
783783   {
784784      if (data & 0x0100)
785785      {
786         //logerror("%06x: 68000 clear z80 reset (word access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
786         //logerror("%06x: 68000 clear z80 reset (word access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
787787         genz80.z80_is_reset = 0;
788788      }
789789      else
790790      {
791         //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(&space->device()),data,mem_mask);
791         //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", space->device().safe_pc(),data,mem_mask);
792792         genz80.z80_is_reset = 1;
793793      }
794794   }
trunk/src/mame/machine/mexico86.c
r17788r17789
227227READ8_MEMBER(mexico86_state::mexico86_68705_port_a_r)
228228{
229229
230   //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in);
230   //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in);
231231   return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
232232}
233233
234234WRITE8_MEMBER(mexico86_state::mexico86_68705_port_a_w)
235235{
236236
237   //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data);
237   //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data);
238238   m_port_a_out = data;
239239}
240240
r17788r17789
268268
269269WRITE8_MEMBER(mexico86_state::mexico86_68705_port_b_w)
270270{
271   //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data);
271   //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data);
272272
273273   if (BIT(m_ddr_b, 0) && BIT(~data, 0) && BIT(m_port_b_out, 0))
274274   {
r17788r17789
278278   if (BIT(m_ddr_b, 1) && BIT(data, 1) && BIT(~m_port_b_out, 1)) /* positive edge trigger */
279279   {
280280      m_address = m_port_a_out;
281      //if (m_address >= 0x80) logerror("%04x: 68705 address %02x\n", cpu_get_pc(&space.device()), m_port_a_out);
281      //if (m_address >= 0x80) logerror("%04x: 68705 address %02x\n", space.device().safe_pc(), m_port_a_out);
282282   }
283283
284284   if (BIT(m_ddr_b, 3) && BIT(~data, 3) && BIT(m_port_b_out, 3))
r17788r17789
287287      {
288288         if (data & 0x04)
289289         {
290            //logerror("%04x: 68705 read %02x from address %04x\n", cpu_get_pc(&space.device()), m_protection_ram[m_address], m_address);
290            //logerror("%04x: 68705 read %02x from address %04x\n", space.device().safe_pc(), m_protection_ram[m_address], m_address);
291291            m_latch = m_protection_ram[m_address];
292292         }
293293         else
294294         {
295            //logerror("%04x: 68705 read input port %04x\n", cpu_get_pc(&space.device()), m_address);
295            //logerror("%04x: 68705 read input port %04x\n", space.device().safe_pc(), m_address);
296296            m_latch = ioport((m_address & 1) ? "IN2" : "IN1")->read();
297297         }
298298      }
299299      else    /* write */
300300      {
301            //logerror("%04x: 68705 write %02x to address %04x\n",cpu_get_pc(&space.device()), port_a_out, m_address);
301            //logerror("%04x: 68705 write %02x to address %04x\n",space.device().safe_pc(), port_a_out, m_address);
302302            m_protection_ram[m_address] = m_port_a_out;
303303      }
304304   }
r17788r17789
312312
313313   if (BIT(m_ddr_b, 6) && BIT(~data, 6) && BIT(m_port_b_out, 6))
314314   {
315      logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data);
315      logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data);
316316   }
317317
318318   if (BIT(m_ddr_b, 7) && BIT(~data, 7) && BIT(m_port_b_out, 7))
319319   {
320      logerror("%04x: 68705 unknown port B bit %02x\n", cpu_get_pc(&space.device()), data);
320      logerror("%04x: 68705 unknown port B bit %02x\n", space.device().safe_pc(), data);
321321   }
322322
323323   m_port_b_out = data;
trunk/src/mame/machine/chaknpop.c
r17788r17789
6767
6868READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_r)
6969{
70   //logerror("%04x: MCU port_a read\n", cpu_get_pc(&space.device()));
70   //logerror("%04x: MCU port_a read\n", space.device().safe_pc());
7171   return m_mcu_result;
7272}
7373
7474
7575READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_r)
7676{
77   //logerror("%04x: MCU port_b read\n", cpu_get_pc(&space.device()));
77   //logerror("%04x: MCU port_b read\n", space.device().safe_pc());
7878
7979   return 0xff;
8080}
8181
8282READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_r)
8383{
84   //logerror("%04x: MCU port_c read\n", cpu_get_pc(&space.device()));
84   //logerror("%04x: MCU port_c read\n", space.device().safe_pc());
8585   return 0x00;
8686}
8787
r17788r17789
101101
102102      mcu_update_seed(machine(), m_mcu_result);
103103
104      logerror("%04x: MCU command 0x%02x, result 0x%02x\n", cpu_get_pc(&space.device()), mcu_command, m_mcu_result);
104      logerror("%04x: MCU command 0x%02x, result 0x%02x\n", space.device().safe_pc(), mcu_command, m_mcu_result);
105105   }
106106   else if (mcu_command >= 0x28 && mcu_command <= 0x2a)
107107   {
r17788r17789
112112
113113      mcu_update_seed(machine(), m_mcu_result);
114114
115      logerror("%04x: MCU command 0x%02x, result 0x%02x\n", cpu_get_pc(&space.device()), mcu_command, m_mcu_result);
115      logerror("%04x: MCU command 0x%02x, result 0x%02x\n", space.device().safe_pc(), mcu_command, m_mcu_result);
116116   }
117117   else if (mcu_command < 0x80)
118118   {
r17788r17789
122122      {
123123         m_mcu_select = mcu_command - 0x40;
124124
125         logerror("%04x: MCU select 0x%02x\n", cpu_get_pc(&space.device()), m_mcu_select);
125         logerror("%04x: MCU select 0x%02x\n", space.device().safe_pc(), m_mcu_select);
126126      }
127127   }
128128   else if (mcu_command == 0x9c|| mcu_command == 0xde)
129129   {
130130      mcu_update_seed(machine(), data);
131131
132      logerror("%04x: MCU command 0x%02x\n", cpu_get_pc(&space.device()), mcu_command);
132      logerror("%04x: MCU command 0x%02x\n", space.device().safe_pc(), mcu_command);
133133   }
134134}
135135
136136WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_w)
137137{
138   //logerror("%04x: MCU port_b write 0x%02x\n", cpu_get_pc(&space.device()), data);
138   //logerror("%04x: MCU port_b write 0x%02x\n", space.device().safe_pc(), data);
139139}
140140
141141WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_w)
142142{
143   //logerror("%04x: MCU port_c write 0x%02x\n", cpu_get_pc(&space.device()), data);
143   //logerror("%04x: MCU port_c write 0x%02x\n", space.device().safe_pc(), data);
144144}
145145
trunk/src/mame/machine/taitosj.c
r17788r17789
7979***************************************************************************/
8080READ8_MEMBER(taitosj_state::taitosj_fake_data_r)
8181{
82   LOG(("%04x: protection read\n",cpu_get_pc(&space.device())));
82   LOG(("%04x: protection read\n",space.device().safe_pc()));
8383   return 0;
8484}
8585
8686WRITE8_MEMBER(taitosj_state::taitosj_fake_data_w)
8787{
88   LOG(("%04x: protection write %02x\n",cpu_get_pc(&space.device()),data));
88   LOG(("%04x: protection write %02x\n",space.device().safe_pc(),data));
8989}
9090
9191READ8_MEMBER(taitosj_state::taitosj_fake_status_r)
9292{
93   LOG(("%04x: protection status read\n",cpu_get_pc(&space.device())));
93   LOG(("%04x: protection status read\n",space.device().safe_pc()));
9494   return 0xff;
9595}
9696
r17788r17789
9898/* timer callback : */
9999READ8_MEMBER(taitosj_state::taitosj_mcu_data_r)
100100{
101   LOG(("%04x: protection read %02x\n",cpu_get_pc(&space.device()),m_toz80));
101   LOG(("%04x: protection read %02x\n",space.device().safe_pc(),m_toz80));
102102   m_zaccept = 1;
103103   return m_toz80;
104104}
r17788r17789
114114
115115WRITE8_MEMBER(taitosj_state::taitosj_mcu_data_w)
116116{
117   LOG(("%04x: protection write %02x\n",cpu_get_pc(&space.device()),data));
117   LOG(("%04x: protection write %02x\n",space.device().safe_pc(),data));
118118   machine().scheduler().synchronize(FUNC(taitosj_mcu_real_data_w), data);
119119   /* temporarily boost the interleave to sync things up */
120120   machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(10));
r17788r17789
132132
133133READ8_MEMBER(taitosj_state::taitosj_68705_portA_r)
134134{
135   LOG(("%04x: 68705 port A read %02x\n",cpu_get_pc(&space.device()),m_portA_in));
135   LOG(("%04x: 68705 port A read %02x\n",space.device().safe_pc(),m_portA_in));
136136   return m_portA_in;
137137}
138138
139139WRITE8_MEMBER(taitosj_state::taitosj_68705_portA_w)
140140{
141   LOG(("%04x: 68705 port A write %02x\n",cpu_get_pc(&space.device()),data));
141   LOG(("%04x: 68705 port A write %02x\n",space.device().safe_pc(),data));
142142   m_portA_out = data;
143143}
144144
r17788r17789
186186
187187WRITE8_MEMBER(taitosj_state::taitosj_68705_portB_w)
188188{
189   LOG(("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data));
189   LOG(("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data));
190190
191191   if (~data & 0x01)
192192   {
193      LOG(("%04x: 68705  68INTRQ **NOT SUPPORTED**!\n", cpu_get_pc(&space.device())));
193      LOG(("%04x: 68705  68INTRQ **NOT SUPPORTED**!\n", space.device().safe_pc()));
194194   }
195195   if (~data & 0x02)
196196   {
r17788r17789
198198      machine().scheduler().synchronize(FUNC(taitosj_mcu_data_real_r));
199199      cputag_set_input_line(machine(), "mcu", 0, CLEAR_LINE);
200200      m_portA_in = m_fromz80;
201      LOG(("%04x: 68705 <- Z80 %02x\n", cpu_get_pc(&space.device()), m_portA_in));
201      LOG(("%04x: 68705 <- Z80 %02x\n", space.device().safe_pc(), m_portA_in));
202202   }
203203   if (~data & 0x08)
204204      m_busreq = 1;
r17788r17789
206206      m_busreq = 0;
207207   if (~data & 0x04)
208208   {
209      LOG(("%04x: 68705 -> Z80 %02x\n", cpu_get_pc(&space.device()), m_portA_out));
209      LOG(("%04x: 68705 -> Z80 %02x\n", space.device().safe_pc(), m_portA_out));
210210
211211      /* 68705 is writing data for the Z80 */
212212      machine().scheduler().synchronize(FUNC(taitosj_mcu_status_real_w), m_portA_out);
r17788r17789
214214   if (~data & 0x10)
215215   {
216216      address_space *cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
217      LOG(("%04x: 68705 write %02x to address %04x\n",cpu_get_pc(&space.device()), m_portA_out, m_address));
217      LOG(("%04x: 68705 write %02x to address %04x\n",space.device().safe_pc(), m_portA_out, m_address));
218218
219219      cpu0space->write_byte(m_address, m_portA_out);
220220
r17788r17789
225225   {
226226      address_space *cpu0space = machine().device("maincpu")->memory().space(AS_PROGRAM);
227227      m_portA_in = cpu0space->read_byte(m_address);
228      LOG(("%04x: 68705 read %02x from address %04x\n", cpu_get_pc(&space.device()), m_portA_in, m_address));
228      LOG(("%04x: 68705 read %02x from address %04x\n", space.device().safe_pc(), m_portA_in, m_address));
229229   }
230230   if (~data & 0x40)
231231   {
232      LOG(("%04x: 68705 address low %02x\n", cpu_get_pc(&space.device()), m_portA_out));
232      LOG(("%04x: 68705 address low %02x\n", space.device().safe_pc(), m_portA_out));
233233      m_address = (m_address & 0xff00) | m_portA_out;
234234   }
235235   if (~data & 0x80)
236236   {
237      LOG(("%04x: 68705 address high %02x\n", cpu_get_pc(&space.device()), m_portA_out));
237      LOG(("%04x: 68705 address high %02x\n", space.device().safe_pc(), m_portA_out));
238238      m_address = (m_address & 0x00ff) | (m_portA_out << 8);
239239   }
240240}
r17788r17789
254254   int res;
255255
256256   res = (m_zready << 0) | (m_zaccept << 1) | ((m_busreq^1) << 2);
257   LOG(("%04x: 68705 port C read %02x\n",cpu_get_pc(&space.device()),res));
257   LOG(("%04x: 68705 port C read %02x\n",space.device().safe_pc(),res));
258258   return res;
259259}
260260
r17788r17789
263263
264264READ8_MEMBER(taitosj_state::spacecr_prot_r)
265265{
266   int pc = cpu_get_pc(&space.device());
266   int pc = space.device().safe_pc();
267267
268268   if( pc != 0x368A && pc != 0x36A6 )
269269      logerror("Read protection from an unknown location: %04X\n",pc);
trunk/src/mame/machine/amiga.c
r17788r17789
263263   amiga_state *state = device->machine().driver_data<amiga_state>();
264264   address_space *space = device->memory().space(AS_PROGRAM);
265265
266   logerror("Executed RESET at PC=%06x\n", cpu_get_pc(&space->device()));
266   logerror("Executed RESET at PC=%06x\n", space->device().safe_pc());
267267
268268   /* Initialize the various chips */
269269   devtag_reset(device->machine(), "cia_0");
r17788r17789
10431043   data = mos6526_r(cia, offset >> 7);
10441044
10451045   if (LOG_CIA)
1046      logerror("%06x:cia_%c_read(%03x) = %04x & %04x\n", cpu_get_pc(&space->device()), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data << shift, mem_mask);
1046      logerror("%06x:cia_%c_read(%03x) = %04x & %04x\n", space->device().safe_pc(), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data << shift, mem_mask);
10471047
10481048   return data << shift;
10491049}
r17788r17789
10611061   device_t *cia;
10621062
10631063   if (LOG_CIA)
1064      logerror("%06x:cia_%c_write(%03x) = %04x & %04x\n", cpu_get_pc(&space->device()), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data, mem_mask);
1064      logerror("%06x:cia_%c_write(%03x) = %04x & %04x\n", space->device().safe_pc(), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data, mem_mask);
10651065
10661066   /* offsets 0000-07ff reference CIA B, and are accessed via the MSB */
10671067   if ((offset & 0x0800) == 0)
r17788r17789
12291229   }
12301230
12311231   if (LOG_CUSTOM)
1232      logerror("%06X:read from custom %s\n", cpu_get_pc(&space->device()), amiga_custom_names[offset & 0xff]);
1232      logerror("%06X:read from custom %s\n", space->device().safe_pc(), amiga_custom_names[offset & 0xff]);
12331233
12341234   return 0xffff;
12351235}
r17788r17789
12631263   offset &= 0xff;
12641264
12651265   if (LOG_CUSTOM)
1266      logerror("%06X:write to custom %s = %04X\n", cpu_get_pc(&space->device()), amiga_custom_names[offset & 0xff], data);
1266      logerror("%06X:write to custom %s = %04X\n", space->device().safe_pc(), amiga_custom_names[offset & 0xff], data);
12671267
12681268   switch (offset)
12691269   {
trunk/src/mame/machine/lkage.c
r17788r17789
2323READ8_MEMBER(lkage_state::lkage_68705_port_a_r)
2424{
2525
26   //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in);
26   //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in);
2727   return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
2828}
2929
3030WRITE8_MEMBER(lkage_state::lkage_68705_port_a_w)
3131{
3232
33   //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data);
33   //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data);
3434   m_port_a_out = data;
3535}
3636
r17788r17789
5858WRITE8_MEMBER(lkage_state::lkage_68705_port_b_w)
5959{
6060
61   //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data);
61   //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data);
6262
6363   if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02))
6464   {
r17788r17789
9696   if (!m_mcu_sent)
9797      m_port_c_in |= 0x02;
9898
99   //logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(&space.device()), m_port_c_in);
99   //logerror("%04x: 68705 port C read %02x\n", space.device().safe_pc(), m_port_c_in);
100100   return (m_port_c_out & m_ddr_c) | (m_port_c_in & ~m_ddr_c);
101101}
102102
103103WRITE8_MEMBER(lkage_state::lkage_68705_port_c_w)
104104{
105105
106   logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(&space.device()), data);
106   logerror("%04x: 68705 port C write %02x\n", space.device().safe_pc(), data);
107107   m_port_c_out = data;
108108}
109109
r17788r17789
116116WRITE8_MEMBER(lkage_state::lkage_mcu_w)
117117{
118118
119   logerror("%04x: mcu_w %02x\n", cpu_get_pc(&space.device()), data);
119   logerror("%04x: mcu_w %02x\n", space.device().safe_pc(), data);
120120   m_from_main = data;
121121   m_main_sent = 1;
122122   device_set_input_line(m_mcu, 0, ASSERT_LINE);
r17788r17789
125125READ8_MEMBER(lkage_state::lkage_mcu_r)
126126{
127127
128   logerror("%04x: mcu_r %02x\n", cpu_get_pc(&space.device()), m_from_mcu);
128   logerror("%04x: mcu_r %02x\n", space.device().safe_pc(), m_from_mcu);
129129   m_mcu_sent = 0;
130130   return m_from_mcu;
131131}
r17788r17789
136136
137137   /* bit 0 = when 1, mcu is ready to receive data from main cpu */
138138   /* bit 1 = when 1, mcu has sent data to the main cpu */
139   //logerror("%04x: mcu_status_r\n", cpu_get_pc(&space.device()));
139   //logerror("%04x: mcu_status_r\n", space.device().safe_pc());
140140   if (!m_main_sent)
141141      res |= 0x01;
142142   if (m_mcu_sent)
trunk/src/mame/machine/neoprot.c
r17788r17789
4242         return ((res & 0xf0) >> 4) | ((res & 0x0f) << 4);
4343
4444      default:
45         logerror("unknown protection read at pc %06x, offset %08x\n", cpu_get_pc(&space->device()), offset << 1);
45         logerror("unknown protection read at pc %06x, offset %08x\n", space->device().safe_pc(), offset << 1);
4646         return 0;
4747   }
4848}
r17788r17789
8989         break;
9090
9191      default:
92         logerror("unknown protection write at pc %06x, offset %08x, data %02x\n", cpu_get_pc(&space->device()), offset, data);
92         logerror("unknown protection write at pc %06x, offset %08x, data %02x\n", space->device().safe_pc(), offset, data);
9393         break;
9494   }
9595}
r17788r17789
124124   switch (data)
125125   {
126126   case 0x0090:
127      logerror ("%06x kof98 - protection 0x0090 old %04x %04x\n", cpu_get_pc(&space->device()), mem16[0x100/2], mem16[0x102/2]);
127      logerror ("%06x kof98 - protection 0x0090 old %04x %04x\n", space->device().safe_pc(), mem16[0x100/2], mem16[0x102/2]);
128128      mem16[0x100/2] = 0x00c2;
129129      mem16[0x102/2] = 0x00fd;
130130      break;
131131
132132   case 0x00f0:
133      logerror ("%06x kof98 - protection 0x00f0 old %04x %04x\n", cpu_get_pc(&space->device()), mem16[0x100/2], mem16[0x102/2]);
133      logerror ("%06x kof98 - protection 0x00f0 old %04x %04x\n", space->device().safe_pc(), mem16[0x100/2], mem16[0x102/2]);
134134      mem16[0x100/2] = 0x4e45;
135135      mem16[0x102/2] = 0x4f2d;
136136      break;
137137
138138   default: // 00aa is written, but not needed?
139      logerror ("%06x kof98 - unknown protection write %04x\n", cpu_get_pc(&space->device()), data);
139      logerror ("%06x kof98 - unknown protection write %04x\n", space->device().safe_pc(), data);
140140      break;
141141   }
142142}
trunk/src/mame/machine/cdislave.c
r17788r17789
3939      va_start( v, s_fmt );
4040      vsprintf( buf, s_fmt, v );
4141      va_end( v );
42      logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
42      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
4343   }
4444}
4545#else
trunk/src/mame/machine/midwunit.c
r17788r17789
5151   }
5252   else
5353   {
54      logerror("%08X:Unexpected CMOS W @ %05X\n", cpu_get_pc(&space.device()), offset);
54      logerror("%08X:Unexpected CMOS W @ %05X\n", space.device().safe_pc(), offset);
5555      popmessage("Bad CMOS write");
5656   }
5757}
r17788r17789
8383   switch (offset)
8484   {
8585      case 1:
86         logerror("%08X:Control W @ %05X = %04X\n", cpu_get_pc(&space.device()), offset, data);
86         logerror("%08X:Control W @ %05X = %04X\n", space.device().safe_pc(), offset, data);
8787
8888         /* bit 4 reset sound CPU */
8989         dcs_reset_w(machine(), newword & 0x10);
r17788r17789
9999         break;
100100
101101      default:
102         logerror("%08X:Unknown I/O write to %d = %04X\n", cpu_get_pc(&space.device()), offset, data);
102         logerror("%08X:Unknown I/O write to %d = %04X\n", space.device().safe_pc(), offset, data);
103103         break;
104104   }
105105   m_iodata[offset] = newword;
r17788r17789
132132         return (midway_serial_pic_status_r() << 12) | midwunit_sound_state_r(space,0,0xffff);
133133
134134      default:
135         logerror("%08X:Unknown I/O read from %d\n", cpu_get_pc(&space.device()), offset);
135         logerror("%08X:Unknown I/O read from %d\n", space.device().safe_pc(), offset);
136136         break;
137137   }
138138   return ~0;
r17788r17789
381381
382382READ16_MEMBER(midwunit_state::midwunit_sound_r)
383383{
384   logerror("%08X:Sound read\n", cpu_get_pc(&space.device()));
384   logerror("%08X:Sound read\n", space.device().safe_pc());
385385
386386   return dcs_data_r(machine()) & 0xff;
387387}
r17788r17789
398398   /* check for out-of-bounds accesses */
399399   if (offset)
400400   {
401      logerror("%08X:Unexpected write to sound (hi) = %04X\n", cpu_get_pc(&space.device()), data);
401      logerror("%08X:Unexpected write to sound (hi) = %04X\n", space.device().safe_pc(), data);
402402      return;
403403   }
404404
405405   /* call through based on the sound type */
406406   if (ACCESSING_BITS_0_7)
407407   {
408      logerror("%08X:Sound write = %04X\n", cpu_get_pc(&space.device()), data);
408      logerror("%08X:Sound write = %04X\n", space.device().safe_pc(), data);
409409      dcs_data_w(machine(), data & 0xff);
410410   }
411411}
trunk/src/mame/machine/namcos2.c
r17788r17789
343343      {
344344   //  case 3: return 0x142;
345345      case 4: return 0x142;
346   //  case 3: popmessage("blah %08x",cpu_get_pc(&space->device()));
346   //  case 3: popmessage("blah %08x",space->device().safe_pc());
347347      default: return space->machine().rand();
348348      }
349349      break;
trunk/src/mame/machine/pgmprot2.c
r17788r17789
4040   device_set_input_line(state->m_prot, ARM7_FIRQ_LINE, CLEAR_LINE ); // guess
4141
4242   if (PGMARM7LOGERROR)
43      logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_kov2_latchdata_68k_w, mem_mask, cpu_get_pc(&space->device()));
43      logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_kov2_latchdata_68k_w, mem_mask, space->device().safe_pc());
4444   return state->m_kov2_latchdata_68k_w;
4545}
4646
r17788r17789
4949   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
5050
5151   if (PGMARM7LOGERROR)
52      logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, cpu_get_pc(&space->device()));
52      logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, space->device().safe_pc());
5353
5454   COMBINE_DATA(&state->m_kov2_latchdata_arm_w);
5555}
r17788r17789
5959   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
6060
6161   if (PGMARM7LOGERROR)
62      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()));
62      logerror("ARM7: ARM7 Shared RAM Read: %04x = %08x (%08x) (%06x)\n", offset << 2, state->m_arm7_shareram[offset], mem_mask, space->device().safe_pc());
6363   return state->m_arm7_shareram[offset];
6464}
6565
r17788r17789
6868   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
6969
7070   if (PGMARM7LOGERROR)
71      logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, cpu_get_pc(&space->device()));
71      logerror("ARM7: ARM7 Shared RAM Write: %04x = %08x (%08x) (%06x)\n", offset << 2, data, mem_mask, space->device().safe_pc());
7272   COMBINE_DATA(&state->m_arm7_shareram[offset]);
7373}
7474
r17788r17789
7777   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
7878
7979   if (PGMARM7LOGERROR)
80      logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_kov2_latchdata_arm_w & 0x0000ffff, mem_mask, cpu_get_pc(&space->device()));
80      logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_kov2_latchdata_arm_w & 0x0000ffff, mem_mask, space->device().safe_pc());
8181   return state->m_kov2_latchdata_arm_w;
8282}
8383
r17788r17789
8686   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
8787
8888   if (PGMARM7LOGERROR)
89      logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, cpu_get_pc(&space->device()));
89      logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, space->device().safe_pc());
9090   COMBINE_DATA(&state->m_kov2_latchdata_68k_w);
9191
9292   device_set_input_line(state->m_prot, ARM7_FIRQ_LINE, ASSERT_LINE ); // guess
r17788r17789
9898   UINT16 *share16 = reinterpret_cast<UINT16 *>(state->m_arm7_shareram.target());
9999
100100   if (PGMARM7LOGERROR)
101      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()));
101      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());
102102   return share16[BYTE_XOR_LE(offset)];
103103}
104104
r17788r17789
108108   UINT16 *share16 = reinterpret_cast<UINT16 *>(state->m_arm7_shareram.target());
109109
110110   if (PGMARM7LOGERROR)
111      logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, cpu_get_pc(&space->device()));
111      logerror("M68K: ARM7 Shared RAM Write: %04x = %04x (%04x) (%06x)\n", BYTE_XOR_LE(offset), data, mem_mask, space->device().safe_pc());
112112   COMBINE_DATA(&share16[BYTE_XOR_LE(offset)]);
113113}
114114
r17788r17789
176176static WRITE32_HANDLER( kov2_arm_region_w )
177177{
178178   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
179   int pc = cpu_get_pc(&space->device());
179   int pc = space->device().safe_pc();
180180   int regionhack = state->ioport("RegionHack")->read();
181181   if (pc==0x190 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0);
182182   COMBINE_DATA(&state->m_arm7_shareram[0x138/4]);
r17788r17789
229229static WRITE32_HANDLER( martmast_arm_region_w )
230230{
231231   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
232   int pc = cpu_get_pc(&space->device());
232   int pc = space->device().safe_pc();
233233   int regionhack = state->ioport("RegionHack")->read();
234234   if (pc==0x170 && regionhack != 0xff) data = (data & 0xffff0000) | (regionhack << 0);
235235   COMBINE_DATA(&state->m_arm7_shareram[0x138/4]);
r17788r17789
250250static WRITE32_HANDLER( ddp2_arm_region_w )
251251{
252252   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
253   int pc = cpu_get_pc(&space->device());
253   int pc = space->device().safe_pc();
254254   int regionhack = state->ioport("RegionHack")->read();
255255   if (pc==0x0174 && regionhack != 0xff) data = (data & 0x0000ffff) | (regionhack << 16);
256256   COMBINE_DATA(&state->m_arm7_shareram[0x0]);
r17788r17789
259259static READ32_HANDLER( ddp2_speedup_r )
260260{
261261   pgm_arm_type2_state *state = space->machine().driver_data<pgm_arm_type2_state>();
262   int pc = cpu_get_pc(&space->device());
262   int pc = space->device().safe_pc();
263263   UINT32 data = state->m_arm_ram[0x300c/4];
264264
265265   if (pc==0x080109b4)
r17788r17789
282282{
283283
284284   UINT16 data = pgm_mainram[0x0ee54/2];
285   int pc = cpu_get_pc(&space->device());
285   int pc = space->device().safe_pc();
286286
287287   if (pc == 0x149dce) device_spin_until_interrupt(&space->device());
288288   if (pc == 0x149cfe) device_spin_until_interrupt(&space->device());
trunk/src/mame/machine/tx1.c
r17788r17789
368368   }
369369
370370   math.dbgaddr = math.promaddr;
371   math.dbgpc = cpu_get_previouspc(machine.device("math_cpu"));
371   math.dbgpc = machine.device("math_cpu")->safe_pcbase();
372372}
373373
374374
trunk/src/mame/machine/decoprot.c
r17788r17789
121121      && offset != (0x370 >> 1) && offset != (0x3c0 >> 1) && offset != (0x430 >> 1) && offset != (0x460 >> 1)
122122      && offset != (0x5a0 >> 1) && offset != (0x5b0 >> 1) && offset != (0x6e0 >> 1) && offset != (0x7d0 >> 1)
123123      )
124      logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n", cpu_get_pc(&space->device()), offset << 1, data);
124      logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n", space->device().safe_pc(), offset << 1, data);
125125
126126   COMBINE_DATA(&deco16_prot_ram[offset]);
127127}
r17788r17789
220220         return ((deco16_prot_ram[0x460/2]&0x0007)<<13) | ((deco16_prot_ram[0x460/2]&0x0008)<<9);
221221   }
222222
223   logerror("Deco Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
223   logerror("Deco Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset<<1);
224224   return 0;
225225}
226226
r17788r17789
249249   && offset!=0x40/2 && offset!=0x54/2 && offset!=0x56/2 && offset!=0x58/2 && offset!=0x6a/2 && offset!=0x2c/2
250250   && offset!=0 && offset!=0x34 && offset!=0x8a && offset!=0x8e && offset!=0x92 && offset!=0x96
251251   )
252logerror("Protection PC %06x: warning - write %04x to %04x\n",cpu_get_pc(&space->device()),data,offset<<1);
252logerror("Protection PC %06x: warning - write %04x to %04x\n",space->device().safe_pc(),data,offset<<1);
253253
254254}
255255
r17788r17789
409409         return ((deco16_prot_ram[0x32/2]&0x00f0)<<8) | ((deco16_prot_ram[0x32/2]&0x000e)<<7) | ((deco16_prot_ram[0x32/2]&0x0001)<<11);
410410   }
411411
412   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset*2);
412   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset*2);
413413   return 0;
414414}
415415
r17788r17789
455455      && offset!=0xb6 && offset!=0xfa && offset!=0xe4 && offset!=0x3a && offset!=0x1e
456456      && offset!=0x38 && offset!=0x92 && offset!=0xa2 && offset!=0x308 && offset!=0x40e
457457   )
458   logerror("Protection PC %06x: warning - write %04x to %04x\n",cpu_get_pc(&space->device()),data,offset);
458   logerror("Protection PC %06x: warning - write %04x to %04x\n",space->device().safe_pc(),data,offset);
459459}
460460
461461READ16_HANDLER( deco16_66_prot_r ) /* Mutant Fighter */
r17788r17789
553553         {
554554            int ret=mutantf_port_0e_hack;
555555            mutantf_port_0e_hack=0x800;
556            //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
556            //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1);
557557            return ret;
558558         }
559559
r17788r17789
561561         {
562562            int ret=mutantf_port_6a_hack;
563563            mutantf_port_6a_hack=0x2866;
564            //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
564            //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1);
565565            return ret;
566566         }
567567
r17788r17789
569569         {
570570            int ret=mutantf_port_e8_hack;
571571            mutantf_port_e8_hack=0x2401;
572            //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
572            //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1);
573573            return ret;
574574         }
575575
576576      case 0xaa: /* ??? */
577         //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
577         //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1);
578578         return 0xc080;
579579
580580      case 0x42: /* Strange, but consistent */
581         //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
581         //logerror("Protection PC %06x: warning - read unknown memory address %04x\n",space->device().safe_pc(),offset<<1);
582582         return deco16_prot_ram[0x2c/2]^0x5302;
583583
584584      case 0x48: /* Correct for test data, but I wonder if the 0x1800 is from an address, not a constant */
585         //logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
585         //logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset<<1);
586586         return (0x1800) & (~deco16_prot_ram[0x36/2]);
587587
588588      case 0x52:
r17788r17789
599599   popmessage("Deco66:  Read unmapped port %04x\n",offset*2);
600600#endif
601601
602   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset<<1);
602   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset<<1);
603603   return 0;
604604}
605605
r17788r17789
661661         return space->machine().root_device().ioport("IN0")->read();
662662   }
663663
664   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",cpu_get_pc(&space->device()),offset);
664   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",space->device().safe_pc(),offset);
665665   return 0;
666666}
667667
r17788r17789
757757         return space->machine().root_device().ioport("DSW")->read();
758758   }
759759
760   if (cpu_get_pc(&space->device())!=0xc0ea)
761      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());
760   if (space->device().safe_pc()!=0xc0ea)
761      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());
762762
763763   return 0;
764764}
r17788r17789
807807
808808   offset=offset*2;
809809
810   //logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
810   //logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",space->device().safe_pc(),offset,data);
811811   if (offset==0xee || offset==0x42 || offset==0xa8)
812812      return;
813813
814//  logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
814//  logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",space->device().safe_pc(),offset,data);
815815
816816#if 1
817817// 66 7c 7e 28 58 4a 9e
r17788r17789
828828      return;
829829
830830//  if (offset==0x3c)
831//      logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
831//      logerror("CONTROL PC %06x: warning - write protection memory address %04x %04x\n",space->device().safe_pc(),offset,data);
832832// Actually read:
833833//  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
834834
r17788r17789
856856      return;
857857#endif
858858
859   logerror("CONTROL PC %06x: warning - write unmapped protection memory address %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
859   logerror("CONTROL PC %06x: warning - write unmapped protection memory address %04x %04x\n",space->device().safe_pc(),offset,data);
860860}
861861
862862READ16_HANDLER( deco16_104_rohga_prot_r )
r17788r17789
864864   const UINT16* prot_ram=decoprot_buffer_ram_selected ? decoprot_buffer_ram : deco16_prot_ram;
865865
866866//  if (offset!=0x88/2 && offset!=0x44c/2 && offset!=0x36c/2 && offset!=0x292/2)
867//      logerror("Protection PC %06x: warning - read prot address %04x\n",cpu_get_pc(&space->device()),offset<<1);
867//      logerror("Protection PC %06x: warning - read prot address %04x\n",space->device().safe_pc(),offset<<1);
868868
869869   switch (offset) {
870870      case 0x88/2: /* Player 1 & 2 input ports */
r17788r17789
12091209         return DECO_PORT(0x58);
12101210   }
12111211
1212   logerror("Protection PC %06x: warning - read unmapped protection address %04x\n",cpu_get_pc(&space->device()),offset<<1);
1212   logerror("Protection PC %06x: warning - read unmapped protection address %04x\n",space->device().safe_pc(),offset<<1);
12131213
12141214   return 0;
12151215}
r17788r17789
12411241      COMBINE_DATA(&decoprot_buffer_ram[offset>>1]);
12421242
12431243//  if (offset!=0x5e0 && offset!=0x340 && offset!=0 && offset!=0x3d0 && offset!=0x280)
1244//      logerror("%08x:  Write protection port %04x, data %04x (%08x)\n", cpu_get_pc(&space->device()), offset, data, mem_mask);
1244//      logerror("%08x:  Write protection port %04x, data %04x (%08x)\n", space->device().safe_pc(), offset, data, mem_mask);
12451245}
12461246
12471247static READ16_HANDLER( deco16_146_core_prot_r )
r17788r17789
16391639      return val & (~deco16_mask);
16401640   }
16411641
1642   //logerror("Protection PC %06x: warning - read fully unmapped protection address %04x\n", cpu_get_pc(&space->device()), offset);
1642   //logerror("Protection PC %06x: warning - read fully unmapped protection address %04x\n", space->device().safe_pc(), offset);
16431643
16441644   return 0;
16451645}
r17788r17789
16911691      && addr!=0x1ae && addr!=0x1d6 && addr!=0x4f8 && addr!=0x614 // cnofirmed
16921692      && addr!=0x5ae && addr!=0x50a && addr!=0x476 && addr!=0x328 && addr!=0x3e && addr!=0x558 // dbl check these later
16931693      && addr!=0x444 && addr!=0x46a // confirmed
1694      && cpu_get_pc(&space->device())!=0x16448 // hmm
1694      && space->device().safe_pc()!=0x16448 // hmm
16951695      && addr!=0x67a
16961696      && addr!=0x6c2 && addr!=0xac && addr!=0x416 && addr!=0x2c2 // confirmed
16971697      && addr!=0x3d8
r17788r17789
17141714      && addr!=0x440 && addr!=0x460
17151715      )
17161716   {
1717      logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", cpu_get_pc(&space->device()), addr, val);
1717      logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", space->device().safe_pc(), addr, val);
17181718      popmessage("Read protection port %04x", addr);
17191719   }
1720   //  logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", cpu_get_pc(&space->device()), addr, val);
1720   //  logerror("Protection PC %06x: warning - read unmapped protection address %04x (ret %04x)\n", space->device().safe_pc(), addr, val);
17211721
17221722   return (val<<16)|0xffff;
17231723}
r17788r17789
17451745   case 0x506: return space->machine().root_device().ioport("DSW")->read();
17461746   }
17471747
1748   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space->device()), offset<<1);
1748   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space->device().safe_pc(), offset<<1);
17491749
17501750   return 0;
17511751}
r17788r17789
17591759      cputag_set_input_line(space->machine(), "audiocpu", 0, HOLD_LINE);
17601760      return;
17611761   }
1762   logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n", cpu_get_pc(&space->device()), offset << 1, data);
1762   logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n", space->device().safe_pc(), offset << 1, data);
17631763}
17641764
17651765/**********************************************************************************/
r17788r17789
17771777   case 0x51a: return DECO_PORT(2);
17781778   }
17791779
1780   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space->device()), offset<<1);
1780   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space->device().safe_pc(), offset<<1);
17811781
17821782   return 0;
17831783}
r17788r17789
17851785WRITE16_HANDLER( deco16_104_pktgaldx_prot_w )
17861786{
17871787   COMBINE_DATA(&deco16_prot_ram[offset]);
1788//  logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n",cpu_get_pc(&space->device()),offset<<1,data);
1788//  logerror("Protection PC %06x: warning - write unmapped memory address %04x %04x\n",space->device().safe_pc(),offset<<1,data);
17891789}
17901790
17911791/**********************************************************************************/
trunk/src/mame/machine/tatsumi.c
r17788r17789
7676   else if ((m_control_word & 0xe0) == 0x80)
7777      offset += 0x00000; // main ram
7878   else
79      logerror("%08x: unmapped read z80 rom %08x\n", cpu_get_pc(&space.device()), offset);
79      logerror("%08x: unmapped read z80 rom %08x\n", space.device().safe_pc(), offset);
8080   return 0xff00 | targetspace->read_byte(offset);
8181}
8282
r17788r17789
8585   address_space *targetspace = machine().device("audiocpu")->memory().space(AS_PROGRAM);
8686
8787   if ((m_control_word & 0xe0) != 0x80)
88      logerror("%08x: write unmapped v30 rom %08x\n", cpu_get_pc(&space.device()), offset);
88      logerror("%08x: write unmapped v30 rom %08x\n", space.device().safe_pc(), offset);
8989
9090   /* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */
9191   if (ACCESSING_BITS_0_7)
r17788r17789
181181      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_HALT, CLEAR_LINE);
182182
183183//  if (offset == 1 && (tatsumi_control_w & 0xfeff) != (last_bank & 0xfeff))
184//      logerror("%08x:  Changed bank to %04x (%d)\n", cpu_get_pc(&space.device()), tatsumi_control_w,offset);
184//      logerror("%08x:  Changed bank to %04x (%d)\n", space.device().safe_pc(), tatsumi_control_w,offset);
185185
186186//todo - watchdog
187187
r17788r17789
227227WRITE16_MEMBER(tatsumi_state::roundup5_d0000_w)
228228{
229229   COMBINE_DATA(&m_roundup5_d0000_ram[offset]);
230//  logerror("d_68k_d0000_w %06x %04x\n", cpu_get_pc(&space.device()), data);
230//  logerror("d_68k_d0000_w %06x %04x\n", space.device().safe_pc(), data);
231231}
232232
233233WRITE16_MEMBER(tatsumi_state::roundup5_e0000_w)
r17788r17789
239239   COMBINE_DATA(&m_roundup5_e0000_ram[offset]);
240240   cputag_set_input_line(machine(), "sub", INPUT_LINE_IRQ4, CLEAR_LINE); // guess, probably wrong
241241
242//  logerror("d_68k_e0000_w %06x %04x\n", cpu_get_pc(&space.device()), data);
242//  logerror("d_68k_e0000_w %06x %04x\n", space.device().safe_pc(), data);
243243}
244244
245245/******************************************************************************/
246246
247247READ16_MEMBER(tatsumi_state::cyclwarr_control_r)
248248{
249//  logerror("%08x:  control_r\n", cpu_get_pc(&space.device()));
249//  logerror("%08x:  control_r\n", space.device().safe_pc());
250250   return m_control_word;
251251}
252252
r17788r17789
255255   COMBINE_DATA(&m_control_word);
256256
257257//  if ((m_control_word&0xfe) != (m_last_control&0xfe))
258//      logerror("%08x:  control_w %04x\n", cpu_get_pc(&space.device()), data);
258//      logerror("%08x:  control_w %04x\n", space.device().safe_pc(), data);
259259
260260/*
261261
r17788r17789
280280
281281
282282   // hack
283   if (cpu_get_pc(&space.device()) == 0x2c3c34)
283   if (space.device().safe_pc() == 0x2c3c34)
284284   {
285285//      cpu_set_reset_line(1, CLEAR_LINE);
286286//      logerror("hack 68k2 on\n");
r17788r17789
295295{
296296   const UINT16* rom=(UINT16*)machine().root_device().memregion("sub")->base();
297297
298logerror("%05X:68000_r(%04X),cw=%04X\n", cpu_get_pc(&space.device()), offset*2, m_control_word);
298logerror("%05X:68000_r(%04X),cw=%04X\n", space.device().safe_pc(), offset*2, m_control_word);
299299   /* Read from 68k RAM */
300300   if ((m_control_word&0x1f)==0x18)
301301   {
302302      // hack to make roundup 5 boot
303      if (cpu_get_pc(&space.device())==0xec575)
303      if (space.device().safe_pc()==0xec575)
304304      {
305305         UINT8 *dst = memregion("maincpu")->base();
306306         dst[BYTE_XOR_LE(0xec57a)]=0x46;
r17788r17789
340340   address_space *space = device->machine().device("audiocpu")->memory().space(AS_PROGRAM);
341341   int r=ym2151_status_port_r(device,0);
342342
343   if (cpu_get_pc(&space->device())==0x2aca || cpu_get_pc(&space->device())==0x29fe
344      || cpu_get_pc(&space->device())==0xf9721
345      || cpu_get_pc(&space->device())==0x1b96 || cpu_get_pc(&space->device())==0x1c65) // BigFight
343   if (space->device().safe_pc()==0x2aca || space->device().safe_pc()==0x29fe
344      || space->device().safe_pc()==0xf9721
345      || space->device().safe_pc()==0x1b96 || space->device().safe_pc()==0x1c65) // BigFight
346346      return 0x80;
347347   return r;
348348}
r17788r17789
354354   address_space *space = device->machine().device("audiocpu")->memory().space(AS_PROGRAM);
355355   int r=downcast<okim6295_device *>(device)->read(*space,0);
356356
357   if (cpu_get_pc(&space->device())==0x2b70 || cpu_get_pc(&space->device())==0x2bb5
358      || cpu_get_pc(&space->device())==0x2acc
359      || cpu_get_pc(&space->device())==0x1c79 // BigFight
360      || cpu_get_pc(&space->device())==0x1cbe // BigFight
361      || cpu_get_pc(&space->device())==0xf9881)
357   if (space->device().safe_pc()==0x2b70 || space->device().safe_pc()==0x2bb5
358      || space->device().safe_pc()==0x2acc
359      || space->device().safe_pc()==0x1c79 // BigFight
360      || space->device().safe_pc()==0x1cbe // BigFight
361      || space->device().safe_pc()==0xf9881)
362362      return 0xf;
363   if (cpu_get_pc(&space->device())==0x2ba3 || cpu_get_pc(&space->device())==0x2a9b || cpu_get_pc(&space->device())==0x2adc
364      || cpu_get_pc(&space->device())==0x1cac) // BigFight
363   if (space->device().safe_pc()==0x2ba3 || space->device().safe_pc()==0x2a9b || space->device().safe_pc()==0x2adc
364      || space->device().safe_pc()==0x1cac) // BigFight
365365      return 0;
366366   return r;
367367}
trunk/src/mame/machine/retofinv.c
r17788r17789
1212
1313READ8_MEMBER(retofinv_state::retofinv_68705_portA_r)
1414{
15//logerror("%04x: 68705 port A read %02x\n",cpu_get_pc(&space.device()),m_portA_in);
15//logerror("%04x: 68705 port A read %02x\n",space.device().safe_pc(),m_portA_in);
1616   return (m_portA_out & m_ddrA) | (m_portA_in & ~m_ddrA);
1717}
1818
1919WRITE8_MEMBER(retofinv_state::retofinv_68705_portA_w)
2020{
21//logerror("%04x: 68705 port A write %02x\n",cpu_get_pc(&space.device()),data);
21//logerror("%04x: 68705 port A write %02x\n",space.device().safe_pc(),data);
2222   m_portA_out = data;
2323}
2424
r17788r17789
4646
4747WRITE8_MEMBER(retofinv_state::retofinv_68705_portB_w)
4848{
49//logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(&space.device()),data);
49//logerror("%04x: 68705 port B write %02x\n",space.device().safe_pc(),data);
5050
5151   if ((m_ddrB & 0x02) && (~data & 0x02) && (m_portB_out & 0x02))
5252   {
r17788r17789
8686   m_portC_in = 0;
8787   if (m_main_sent) m_portC_in |= 0x01;
8888   if (!m_mcu_sent) m_portC_in |= 0x02;
89//logerror("%04x: 68705 port C read %02x\n",cpu_get_pc(&space.device()),m_portC_in);
89//logerror("%04x: 68705 port C read %02x\n",space.device().safe_pc(),m_portC_in);
9090   return (m_portC_out & m_ddrC) | (m_portC_in & ~m_ddrC);
9191}
9292
9393WRITE8_MEMBER(retofinv_state::retofinv_68705_portC_w)
9494{
95logerror("%04x: 68705 port C write %02x\n",cpu_get_pc(&space.device()),data);
95logerror("%04x: 68705 port C write %02x\n",space.device().safe_pc(),data);
9696   m_portC_out = data;
9797}
9898
r17788r17789
104104
105105WRITE8_MEMBER(retofinv_state::retofinv_mcu_w)
106106{
107logerror("%04x: mcu_w %02x\n",cpu_get_pc(&space.device()),data);
107logerror("%04x: mcu_w %02x\n",space.device().safe_pc(),data);
108108   m_from_main = data;
109109   m_main_sent = 1;
110110   cputag_set_input_line(machine(), "68705", 0, ASSERT_LINE);
r17788r17789
112112
113113READ8_MEMBER(retofinv_state::retofinv_mcu_r)
114114{
115logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),m_from_mcu);
115logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),m_from_mcu);
116116   m_mcu_sent = 0;
117117   return m_from_mcu;
118118}
r17788r17789
123123
124124   /* bit 4 = when 1, mcu is ready to receive data from main cpu */
125125   /* bit 5 = when 1, mcu has sent data to the main cpu */
126//logerror("%04x: mcu_status_r\n",cpu_get_pc(&space.device()));
126//logerror("%04x: mcu_status_r\n",space.device().safe_pc());
127127   if (!m_main_sent) res |= 0x10;
128128   if (m_mcu_sent) res |= 0x20;
129129
trunk/src/mame/machine/maniach.c
r17788r17789
2323{
2424   matmania_state *state = space->machine().driver_data<matmania_state>();
2525
26   //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space->device()), state->m_port_a_in);
26   //logerror("%04x: 68705 port A read %02x\n", space->device().safe_pc(), state->m_port_a_in);
2727   return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a);
2828}
2929
r17788r17789
3131{
3232   matmania_state *state = space->machine().driver_data<matmania_state>();
3333
34   //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space->device()), data);
34   //logerror("%04x: 68705 port A write %02x\n", space->device().safe_pc(), data);
3535   state->m_port_a_out = data;
3636}
3737
r17788r17789
6262{
6363   matmania_state *state = space->machine().driver_data<matmania_state>();
6464
65   //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space->device()), data);
65   //logerror("%04x: 68705 port B write %02x\n", space->device().safe_pc(), data);
6666
6767   if (BIT(state->m_ddr_b, 1) && BIT(~data, 1) && BIT(state->m_port_b_out, 1))
6868   {
r17788r17789
9999   if (!state->m_mcu_sent)
100100      state->m_port_c_in |= 0x02;
101101
102   //logerror("%04x: 68705 port C read %02x\n",state->m_cpu_get_pc(&space->device()), state->m_port_c_in);
102   //logerror("%04x: 68705 port C read %02x\n",state->m_space->device().safe_pc(), state->m_port_c_in);
103103
104104   return (state->m_port_c_out & state->m_ddr_c) | (state->m_port_c_in & ~state->m_ddr_c);
105105}
r17788r17789
108108{
109109   matmania_state *state = space->machine().driver_data<matmania_state>();
110110
111   //logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(&space->device()), data);
111   //logerror("%04x: 68705 port C write %02x\n", space->device().safe_pc(), data);
112112   state->m_port_c_out = data;
113113}
114114
r17788r17789
123123{
124124   matmania_state *state = space->machine().driver_data<matmania_state>();
125125
126   //logerror("%04x: 3040_w %02x\n", cpu_get_pc(&space->device()), data);
126   //logerror("%04x: 3040_w %02x\n", space->device().safe_pc(), data);
127127   state->m_from_main = data;
128128   state->m_main_sent = 1;
129129}
r17788r17789
132132{
133133   matmania_state *state = space->machine().driver_data<matmania_state>();
134134
135   //logerror("%04x: 3040_r %02x\n", cpu_get_pc(&space->device()), state->m_from_mcu);
135   //logerror("%04x: 3040_r %02x\n", space->device().safe_pc(), state->m_from_mcu);
136136   state->m_mcu_sent = 0;
137137   return state->m_from_mcu;
138138}
r17788r17789
144144
145145   /* bit 0 = when 0, mcu has sent data to the main cpu */
146146   /* bit 1 = when 1, mcu is ready to receive data from main cpu */
147   //logerror("%04x: 3041_r\n", cpu_get_pc(&space->device()));
147   //logerror("%04x: 3041_r\n", space->device().safe_pc());
148148   if (!state->m_mcu_sent)
149149      res |= 0x01;
150150   if (!state->m_main_sent)
trunk/src/mame/machine/harddriv.c
r17788r17789
597597   /* any write to $1FFF is taken to be a trigger; synchronize the CPUs */
598598   if (offset == 0x1fff)
599599   {
600      logerror("%06X:ADSP sync address written (%04X)\n", cpu_get_previouspc(&space->device()), data);
600      logerror("%06X:ADSP sync address written (%04X)\n", space->device().safe_pcbase(), data);
601601      space->machine().scheduler().synchronize();
602602      device_triggerint(state->m_adsp);
603603   }
604604   else
605      logerror("%06X:ADSP W@%04X (%04X)\n", cpu_get_previouspc(&space->device()), offset, data);
605      logerror("%06X:ADSP W@%04X (%04X)\n", space->device().safe_pcbase(), offset, data);
606606}
607607
608608
r17788r17789
758758WRITE16_HANDLER( hd68k_adsp_irq_clear_w )
759759{
760760   harddriv_state *state = space->machine().driver_data<harddriv_state>();
761   logerror("%06X:68k clears ADSP interrupt\n", cpu_get_previouspc(&space->device()));
761   logerror("%06X:68k clears ADSP interrupt\n", space->device().safe_pcbase());
762762   state->m_adsp_irq_state = 0;
763763   atarigen_update_interrupts(space->machine());
764764}
r17788r17789
770770   int result = 0xfffd;
771771   if (state->m_adsp_xflag) result ^= 2;
772772   if (state->m_adsp_irq_state) result ^= 1;
773   logerror("%06X:68k reads ADSP interrupt state = %04x\n", cpu_get_previouspc(&space->device()), result);
773   logerror("%06X:68k reads ADSP interrupt state = %04x\n", space->device().safe_pcbase(), result);
774774   return result;
775775}
776776
r17788r17789
803803         break;
804804
805805      default:
806         logerror("%04X:hdadsp_special_r(%04X)\n", cpu_get_previouspc(&space->device()), offset);
806         logerror("%04X:hdadsp_special_r(%04X)\n", space->device().safe_pcbase(), offset);
807807         break;
808808   }
809809   return 0;
r17788r17789
832832         break;
833833
834834      case 6:   /* /GINT */
835         logerror("%04X:ADSP signals interrupt\n", cpu_get_previouspc(&space->device()));
835         logerror("%04X:ADSP signals interrupt\n", space->device().safe_pcbase());
836836         state->m_adsp_irq_state = 1;
837837         atarigen_update_interrupts(space->machine());
838838         break;
r17788r17789
842842         break;
843843
844844      default:
845         logerror("%04X:hdadsp_special_w(%04X)=%04X\n", cpu_get_previouspc(&space->device()), offset, data);
845         logerror("%04X:hdadsp_special_w(%04X)=%04X\n", space->device().safe_pcbase(), offset, data);
846846         break;
847847   }
848848}
r17788r17789
950950READ16_HANDLER( hd68k_ds3_gdata_r )
951951{
952952   harddriv_state *state = space->machine().driver_data<harddriv_state>();
953   offs_t pc = cpu_get_pc(&space->device());
953   offs_t pc = space->device().safe_pc();
954954
955955   state->m_ds3_gflag = 0;
956956   update_ds3_irq(state);
957957
958   logerror("%06X:hd68k_ds3_gdata_r(%04X)\n", cpu_get_previouspc(&space->device()), state->m_ds3_gdata);
958   logerror("%06X:hd68k_ds3_gdata_r(%04X)\n", space->device().safe_pcbase(), state->m_ds3_gdata);
959959
960960   /* attempt to optimize the transfer if conditions are right */
961961   if (&space->device() == state->m_maincpu && pc == state->m_ds3_transfer_pc &&
r17788r17789
999999{
10001000   harddriv_state *state = space->machine().driver_data<harddriv_state>();
10011001
1002   logerror("%06X:hd68k_ds3_gdata_w(%04X)\n", cpu_get_previouspc(&space->device()), state->m_ds3_gdata);
1002   logerror("%06X:hd68k_ds3_gdata_w(%04X)\n", space->device().safe_pcbase(), state->m_ds3_gdata);
10031003
10041004   COMBINE_DATA(&state->m_ds3_g68data);
10051005   state->m_ds3_g68flag = 1;
r17788r17789
10791079   switch (offset & 7)
10801080   {
10811081      case 0:
1082         logerror("%04X:ADSP sets gdata to %04X\n", cpu_get_previouspc(&space->device()), data);
1082         logerror("%04X:ADSP sets gdata to %04X\n", space->device().safe_pcbase(), data);
10831083         state->m_ds3_gdata = data;
10841084         state->m_ds3_gflag = 1;
10851085         update_ds3_irq(state);
r17788r17789
10891089         break;
10901090
10911091      case 1:
1092         logerror("%04X:ADSP sets interrupt = %d\n", cpu_get_previouspc(&space->device()), (data >> 1) & 1);
1092         logerror("%04X:ADSP sets interrupt = %d\n", space->device().safe_pcbase(), (data >> 1) & 1);
10931093         state->m_adsp_irq_state = (data >> 1) & 1;
10941094         hd68k_update_interrupts(space->machine());
10951095         break;
r17788r17789
15461546   /* if both this address and the other important address are not $ffff */
15471547   /* then we can spin until something gets written */
15481548   if (result != 0xffff && state->m_gsp_speedup_addr[1][0] != 0xffff &&
1549      &space->device() == state->m_gsp && cpu_get_pc(&space->device()) == state->m_gsp_speedup_pc)
1549      &space->device() == state->m_gsp && space->device().safe_pc() == state->m_gsp_speedup_pc)
15501550   {
15511551      state->m_gsp_speedup_count[0]++;
15521552      device_spin_until_interrupt(&space->device());
r17788r17789
15951595   int result = state->m_gsp_speedup_addr[0][offset];
15961596
15971597   /* if this address is equal to $f000, spin until something gets written */
1598   if (&space->device() == state->m_gsp && cpu_get_pc(&space->device()) == state->m_gsp_speedup_pc &&
1598   if (&space->device() == state->m_gsp && space->device().safe_pc() == state->m_gsp_speedup_pc &&
15991599      (result & 0xff) < cpu_get_reg(&space->device(), TMS34010_A1))
16001600   {
16011601      state->m_gsp_speedup_count[0]++;
r17788r17789
16321632   harddriv_state *state = space->machine().driver_data<harddriv_state>();
16331633   int data = state->m_msp_speedup_addr[offset];
16341634
1635   if (data == 0 && &space->device() == state->m_msp && cpu_get_pc(&space->device()) == state->m_msp_speedup_pc)
1635   if (data == 0 && &space->device() == state->m_msp && space->device().safe_pc() == state->m_msp_speedup_pc)
16361636   {
16371637      state->m_msp_speedup_count[0]++;
16381638      device_spin_until_interrupt(&space->device());
r17788r17789
16671667   harddriv_state *state = space->machine().driver_data<harddriv_state>();
16681668   int data = state->m_adsp_data_memory[0x1fff];
16691669
1670   if (data == 0xffff && &space->device() == state->m_adsp && cpu_get_pc(&space->device()) <= 0x3b)
1670   if (data == 0xffff && &space->device() == state->m_adsp && space->device().safe_pc() <= 0x3b)
16711671   {
16721672      state->m_adsp_speedup_count[0]++;
16731673      device_spin_until_interrupt(&space->device());
r17788r17789
16821682   harddriv_state *state = space->machine().driver_data<harddriv_state>();
16831683   int data = *state->m_ds3_speedup_addr;
16841684
1685   if (data != 0 && &space->device() == state->m_adsp && cpu_get_pc(&space->device()) == state->m_ds3_speedup_pc)
1685   if (data != 0 && &space->device() == state->m_adsp && space->device().safe_pc() == state->m_ds3_speedup_pc)
16861686   {
16871687      state->m_adsp_speedup_count[2]++;
16881688      device_spin_until_interrupt(&space->device());
trunk/src/mame/machine/mcr68.c
r17788r17789
539539      if (diffs & 0x02)
540540         reload_count(counter);
541541
542      LOG(("%06X:Counter %d control = %02X\n", cpu_get_previouspc(&space.device()), counter, data));
542      LOG(("%06X:Counter %d control = %02X\n", space.device().safe_pcbase(), counter, data));
543543   }
544544
545545   /* offsets 2, 4, and 6 are MSB buffer registers */
546546   else if ((offset & 1) == 0)
547547   {
548      LOG(("%06X:MSB = %02X\n", cpu_get_previouspc(&space.device()), data));
548      LOG(("%06X:MSB = %02X\n", space.device().safe_pcbase(), data));
549549      m_m6840_msb_buffer = data;
550550   }
551551
r17788r17789
564564      if (!(m6840->control & 0x10))
565565         reload_count(counter);
566566
567      LOG(("%06X:Counter %d latch = %04X\n", cpu_get_previouspc(&space.device()), counter, m6840->latch));
567      LOG(("%06X:Counter %d latch = %04X\n", space.device().safe_pcbase(), counter, m6840->latch));
568568   }
569569}
570570
r17788r17789
578578   /* offset 1 is the status register */
579579   else if (offset == 1)
580580   {
581      LOG(("%06X:Status read = %04X\n", cpu_get_previouspc(&space.device()), m_m6840_status));
581      LOG(("%06X:Status read = %04X\n", space.device().safe_pcbase(), m_m6840_status));
582582      m_m6840_status_read_since_int |= m_m6840_status & 0x07;
583583      return m_m6840_status;
584584   }
r17788r17789
596596
597597      m_m6840_lsb_buffer = result & 0xff;
598598
599      LOG(("%06X:Counter %d read = %04X\n", cpu_get_previouspc(&space.device()), counter, result));
599      LOG(("%06X:Counter %d read = %04X\n", space.device().safe_pcbase(), counter, result));
600600      return result >> 8;
601601   }
602602
trunk/src/mame/machine/pgmprot3.c
r17788r17789
9494{
9595   pgm_arm_type3_state *state = space->machine().driver_data<pgm_arm_type3_state>();
9696   if (PGMARM7LOGERROR)
97      logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, cpu_get_pc(&space->device()));
97      logerror("M68K: Latch write: %04x (%04x) (%06x)\n", data & 0x0000ffff, mem_mask, space->device().safe_pc());
9898   COMBINE_DATA(&state->m_svg_latchdata_68k_w);
9999}
100100
r17788r17789
104104   pgm_arm_type3_state *state = space->machine().driver_data<pgm_arm_type3_state>();
105105
106106   if (PGMARM7LOGERROR)
107      logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_svg_latchdata_arm_w & 0x0000ffff, mem_mask, cpu_get_pc(&space->device()));
107      logerror("M68K: Latch read: %04x (%04x) (%06x)\n", state->m_svg_latchdata_arm_w & 0x0000ffff, mem_mask, space->device().safe_pc());
108108   return state->m_svg_latchdata_arm_w;
109109}
110110
r17788r17789
115115   pgm_arm_type3_state *state = space->machine().driver_data<pgm_arm_type3_state>();
116116
117117   if (PGMARM7LOGERROR)
118      logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_svg_latchdata_68k_w, mem_mask, cpu_get_pc(&space->device()));
118      logerror("ARM7: Latch read: %08x (%08x) (%06x)\n", state->m_svg_latchdata_68k_w, mem_mask, space->device().safe_pc());
119119   return state->m_svg_latchdata_68k_w;
120120}
121121
r17788r17789
124124   pgm_arm_type3_state *state = space->machine().driver_data<pgm_arm_type3_state>();
125125
126126   if (PGMARM7LOGERROR)
127      logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, cpu_get_pc(&space->device()));
127      logerror("ARM7: Latch write: %08x (%08x) (%06x)\n", data, mem_mask, space->device().safe_pc());
128128
129129   COMBINE_DATA(&state->m_svg_latchdata_arm_w);
130130}
r17788r17789
269269static READ32_HANDLER( dmnfrnt_speedup_r )
270270{
271271   pgm_arm_type3_state *state = space->machine().driver_data<pgm_arm_type3_state>();
272   int pc = cpu_get_pc(&space->device());
272   int pc = space->device().safe_pc();
273273   if (pc == 0x8000fea) device_eat_cycles(&space->device(), 500);
274274//  else printf("dmn_speedup_r %08x\n", pc);
275275   return state->m_arm_ram[0x000444/4];
r17788r17789
278278static READ16_HANDLER( dmnfrnt_main_speedup_r )
279279{
280280   UINT16 data = pgm_mainram[0xa03c/2];
281   int pc = cpu_get_pc(&space->device());
281   int pc = space->device().safe_pc();
282282   if (pc == 0x10193a) device_spin_until_interrupt(&space->device());
283283   else if (pc == 0x1019a4) device_spin_until_interrupt(&space->device());
284284   return data;
trunk/src/mame/machine/model1.c
r17788r17789
1616   model1_state *state = space->machine().driver_data<model1_state>();
1717   UINT32 v;
1818   if(state->m_fifoout_wpos == state->m_fifoout_rpos) {
19      fatalerror("TGP FIFOOUT underflow (%x)\n", cpu_get_pc(&space->device()));
19      fatalerror("TGP FIFOOUT underflow (%x)\n", space->device().safe_pc());
2020   }
2121   v = state->m_fifoout_data[state->m_fifoout_rpos++];
2222   if(state->m_fifoout_rpos == FIFO_SIZE)
r17788r17789
6060static void fifoin_push(address_space *space, UINT32 data)
6161{
6262   model1_state *state = space->machine().driver_data<model1_state>();
63   //  logerror("TGP FIFOIN write %08x (%x)\n", data, cpu_get_pc(&space->device()));
63   //  logerror("TGP FIFOIN write %08x (%x)\n", data, space->device().safe_pc());
6464   state->m_fifoin_data[state->m_fifoin_wpos++] = data;
6565   if(state->m_fifoin_wpos == FIFO_SIZE)
6666      state->m_fifoin_wpos = 0;
r17788r17789
19481948{
19491949   if(offset) {
19501950      m_copro_w = (m_copro_w & 0x0000ffff) | (data << 16);
1951      m_pushpc = cpu_get_pc(&space.device());
1951      m_pushpc = space.device().safe_pc();
19521952      fifoin_push(&space, m_copro_w);
19531953   } else
19541954      m_copro_w = (m_copro_w & 0xffff0000) | data;
r17788r17789
19671967READ16_MEMBER(model1_state::model1_tgp_copro_ram_r)
19681968{
19691969   if(!offset) {
1970      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()));
1970      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());
19711971      return m_ram_data[m_ram_adr];
19721972   } else
19731973      return m_ram_data[m_ram_adr++] >> 16;
r17788r17789
19781978   COMBINE_DATA(m_ram_latch+offset);
19791979   if(offset) {
19801980      UINT32 v = m_ram_latch[0]|(m_ram_latch[1]<<16);
1981      logerror("TGP f0 ram write %04x, %08x (%f) (%x)\n", m_ram_adr, v, u2f(v), cpu_get_pc(&space.device()));
1981      logerror("TGP f0 ram write %04x, %08x (%f) (%x)\n", m_ram_adr, v, u2f(v), space.device().safe_pc());
19821982      m_ram_data[m_ram_adr] = v;
19831983      m_ram_adr++;
19841984   }
r17788r17789
20772077   model1_state *state = space->machine().driver_data<model1_state>();
20782078   if (state->m_copro_fifoin_num == FIFO_SIZE)
20792079   {
2080      fatalerror("Copro FIFOIN overflow (at %08X)\n", cpu_get_pc(&space->device()));
2080      fatalerror("Copro FIFOIN overflow (at %08X)\n", space->device().safe_pc());
20812081      return;
20822082   }
20832083
r17788r17789
21232123   model1_state *state = device->machine().driver_data<model1_state>();
21242124   if (state->m_copro_fifoout_num == FIFO_SIZE)
21252125   {
2126      fatalerror("Copro FIFOOUT overflow (at %08X)\n", cpu_get_pc(device));
2126      fatalerror("Copro FIFOOUT overflow (at %08X)\n", device->safe_pc());
21272127      return;
21282128   }
21292129
trunk/src/mame/machine/megavdp.c
r17788r17789
12661266      //  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);
12671267         retvalue = megadriv_vdp_ctrl_port_r(space.machine());
12681268      //  retvalue = space->machine().rand();
1269      //  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);
1269      //  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);
12701270         break;
12711271
12721272      case 0x08:
r17788r17789
12761276      //  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);
12771277         retvalue = megadriv_read_hv_counters(space.machine());
12781278      //  retvalue = space->machine().rand();
1279      //  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);
1279      //  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);
12801280         break;
12811281
12821282      case 0x10:
trunk/src/mame/machine/cd32.c
r17788r17789
779779
780780   if ( LOG_AKIKO && offset < (0x30/4) )
781781   {
782      logerror( "Reading AKIKO reg %0x [%s] at PC=%06x\n", offset, get_akiko_reg_name(offset), cpu_get_pc(&space->device()) );
782      logerror( "Reading AKIKO reg %0x [%s] at PC=%06x\n", offset, get_akiko_reg_name(offset), space->device().safe_pc() );
783783   }
784784
785785   switch( offset )
r17788r17789
842842
843843   if ( LOG_AKIKO && offset < (0x30/4) )
844844   {
845      logerror( "Writing AKIKO reg %0x [%s] with %08x at PC=%06x\n", offset, get_akiko_reg_name(offset), data, cpu_get_pc(&space->device()) );
845      logerror( "Writing AKIKO reg %0x [%s] with %08x at PC=%06x\n", offset, get_akiko_reg_name(offset), data, space->device().safe_pc() );
846846   }
847847
848848   switch( offset )
trunk/src/mame/machine/btime.c
r17788r17789
1616   else if (offset >= 0x0d00 && offset <= 0x0d02)
1717      ret = RAM[BASE + offset];  /* addition result */
1818   else
19      logerror("Unknown protection read.  PC=%04X  Offset=%04X\n", cpu_get_pc(&space.device()), offset);
19      logerror("Unknown protection read.  PC=%04X  Offset=%04X\n", space.device().safe_pc(), offset);
2020
2121   return ret;
2222}
r17788r17789
7171            break;
7272
7373         default:
74            logerror("Unemulated protection command=%02X.  PC=%04X\n", m_protection_command, cpu_get_pc(&space.device()));
74            logerror("Unemulated protection command=%02X.  PC=%04X\n", m_protection_command, space.device().safe_pc());
7575            break;
7676         }
7777
r17788r17789
8787   else if (offset >= 0x0d00 && offset <= 0x0d05)
8888      RAM[BASE + offset] = data;   /* source table */
8989   else
90      logerror("Unknown protection write=%02X.  PC=%04X  Offset=%04X\n", data, cpu_get_pc(&space.device()), offset);
90      logerror("Unknown protection write=%02X.  PC=%04X  Offset=%04X\n", data, space.device().safe_pc(), offset);
9191}
9292
trunk/src/mame/machine/md_cart.c
r17788r17789
418418   }
419419   else
420420   {
421      logerror("%06x chifi3, bankw? %04x %04x\n", cpu_get_pc(&space->device()), offset, data);
421      logerror("%06x chifi3, bankw? %04x %04x\n", space->device().safe_pc(), offset, data);
422422   }
423423
424424}
r17788r17789
435435    04cefa chifi3, prot_r? 65262
436436    */
437437
438   if (cpu_get_pc(&space->device()) == 0x01782) // makes 'VS' screen appear
438   if (space->device().safe_pc() == 0x01782) // makes 'VS' screen appear
439439   {
440440      retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff;
441441      retdat <<= 8;
442442      return retdat;
443443   }
444   else if (cpu_get_pc(&space->device()) == 0x1c24) // background gfx etc.
444   else if (space->device().safe_pc() == 0x1c24) // background gfx etc.
445445   {
446446      retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff;
447447      retdat <<= 8;
448448      return retdat;
449449   }
450   else if (cpu_get_pc(&space->device()) == 0x10c4a) // unknown
450   else if (space->device().safe_pc() == 0x10c4a) // unknown
451451   {
452452      return space->machine().rand();
453453   }
454   else if (cpu_get_pc(&space->device()) == 0x10c50) // unknown
454   else if (space->device().safe_pc() == 0x10c50) // unknown
455455   {
456456      return space->machine().rand();
457457   }
458   else if (cpu_get_pc(&space->device()) == 0x10c52) // relates to the game speed..
458   else if (space->device().safe_pc() == 0x10c52) // relates to the game speed..
459459   {
460460      retdat = cpu_get_reg(&space->device(), M68K_D4) & 0xff;
461461      retdat <<= 8;
462462      return retdat;
463463   }
464   else if (cpu_get_pc(&space->device()) == 0x061ae)
464   else if (space->device().safe_pc() == 0x061ae)
465465   {
466466      retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff;
467467      retdat <<= 8;
468468      return retdat;
469469   }
470   else if (cpu_get_pc(&space->device()) == 0x061b0)
470   else if (space->device().safe_pc() == 0x061b0)
471471   {
472472      retdat = cpu_get_reg(&space->device(), M68K_D3) & 0xff;
473473      retdat <<= 8;
r17788r17789
475475   }
476476   else
477477   {
478      logerror("%06x chifi3, prot_r? %04x\n", cpu_get_pc(&space->device()), offset);
478      logerror("%06x chifi3, prot_r? %04x\n", space->device().safe_pc(), offset);
479479   }
480480
481481   return 0;
r17788r17789
504504 *************************************/
505505static READ16_HANDLER( soulb_400006_r )
506506{
507//  printf("%06x soulb_400006_r\n",cpu_get_pc(&space->device()));
507//  printf("%06x soulb_400006_r\n",space->device().safe_pc());
508508   return 0xf000;
509509}
510510
511511static READ16_HANDLER( soulb_400002_r )
512512{
513//  printf("%06x soulb_400002_r\n",cpu_get_pc(&space->device()));
513//  printf("%06x soulb_400002_r\n",space->device().safe_pc());
514514   return 0x9800;
515515}
516516
517517static READ16_HANDLER( soulb_400004_r )
518518{
519519//  return 0x9800;
520//  printf("%06x soulb_400004_r\n",cpu_get_pc(&space->device()));
520//  printf("%06x soulb_400004_r\n",space->device().safe_pc());
521521//
522522   return 0xc900;
523523//aa
r17788r17789
742742     cpu #0 (PC=001771A2): unmapped program memory word read from 006BD294 & 00FF
743743     */
744744
745   if (cpu_get_pc(&space->device())==0x1771a2) return 0x50;
745   if (space->device().safe_pc()==0x1771a2) return 0x50;
746746   else
747747   {
748748      x++;
749      logerror("%06x topfig_6BD294_r %04x\n",cpu_get_pc(&space->device()), x);
749      logerror("%06x topfig_6BD294_r %04x\n",space->device().safe_pc(), x);
750750      return x;
751751   }
752752}
r17788r17789
755755{
756756   static int x = -1;
757757
758   if (cpu_get_pc(&space->device())==0x4C94E)
758   if (space->device().safe_pc()==0x4C94E)
759759   {
760760      return cpu_get_reg(space->machine().device("maincpu"), (M68K_D0)) & 0xff;
761761   }
762762   else
763763   {
764764      x++;
765      logerror("%06x topfig_6F5344_r %04x\n",cpu_get_pc(&space->device()), x);
765      logerror("%06x topfig_6F5344_r %04x\n",space->device().safe_pc(), x);
766766      return x;
767767   }
768768}
r17788r17789
773773   if (data == 0x002a)
774774   {
775775      memcpy(ROM + 0x060000, ROM + 0x570000, 0x8000); // == 0x2e*0x8000?!
776      //  printf("%06x offset %06x, data %04x\n",cpu_get_pc(&space->device()), offset, data);
776      //  printf("%06x offset %06x, data %04x\n",space->device().safe_pc(), offset, data);
777777
778778   }
779779   else if (data==0x0035) // characters ingame
r17788r17789
789789      memcpy(ROM + 0x060000, ROM + 0x460000, 0x8000);
790790      memcpy(ROM + 0x020000, ROM + 0x420000, 0x8000);
791791      memcpy(ROM + 0x058000, ROM + 0x458000, 0x8000);
792      //  printf("%06x offset %06x, data %04x\n",cpu_get_pc(&space->device()), offset, data);
792      //  printf("%06x offset %06x, data %04x\n",space->device().safe_pc(), offset, data);
793793   }
794794   else
795795   {
796      logerror("%06x offset %06x, data %04x\n", cpu_get_pc(&space->device()), offset, data);
796      logerror("%06x offset %06x, data %04x\n", space->device().safe_pc(), offset, data);
797797   }
798798
799799}
trunk/src/mame/machine/flstory.c
r17788r17789
2323READ8_MEMBER(flstory_state::flstory_68705_port_a_r)
2424{
2525
26   //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in);
26   //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in);
2727   return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
2828}
2929
3030WRITE8_MEMBER(flstory_state::flstory_68705_port_a_w)
3131{
3232
33   //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data);
33   //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data);
3434   m_port_a_out = data;
3535}
3636
r17788r17789
5757
5858WRITE8_MEMBER(flstory_state::flstory_68705_port_b_w)
5959{
60   //logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(&space.device()),data);
60   //logerror("%04x: 68705 port B write %02x\n",space.device().safe_pc(),data);
6161
6262   if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02))
6363   {
r17788r17789
9393   if (!m_mcu_sent)
9494      m_port_c_in |= 0x02;
9595
96   //logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(&space.device()), port_c_in);
96   //logerror("%04x: 68705 port C read %02x\n", space.device().safe_pc(), port_c_in);
9797   return (m_port_c_out & m_ddr_c) | (m_port_c_in & ~m_ddr_c);
9898}
9999
100100WRITE8_MEMBER(flstory_state::flstory_68705_port_c_w)
101101{
102   logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(&space.device()), data);
102   logerror("%04x: 68705 port C write %02x\n", space.device().safe_pc(), data);
103103   m_port_c_out = data;
104104}
105105
r17788r17789
111111WRITE8_MEMBER(flstory_state::flstory_mcu_w)
112112{
113113
114   logerror("%04x: mcu_w %02x\n", cpu_get_pc(&space.device()), data);
114   logerror("%04x: mcu_w %02x\n", space.device().safe_pc(), data);
115115   m_from_main = data;
116116   m_main_sent = 1;
117117   device_set_input_line(m_mcu, 0, ASSERT_LINE);
r17788r17789
120120READ8_MEMBER(flstory_state::flstory_mcu_r)
121121{
122122
123   logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()), m_from_mcu);
123   logerror("%04x: mcu_r %02x\n",space.device().safe_pc(), m_from_mcu);
124124   m_mcu_sent = 0;
125125   return m_from_mcu;
126126}
r17788r17789
131131
132132   /* bit 0 = when 1, mcu is ready to receive data from main cpu */
133133   /* bit 1 = when 1, mcu has sent data to the main cpu */
134   //logerror("%04x: mcu_status_r\n", cpu_get_pc(&space.device()));
134   //logerror("%04x: mcu_status_r\n", space.device().safe_pc());
135135   if (!m_main_sent)
136136      res |= 0x01;
137137   if (m_mcu_sent)
r17788r17789
258258
259259READ8_MEMBER(flstory_state::victnine_mcu_r)
260260{
261   //logerror("%04x: mcu read (0x%02x)\n", cpu_get_previouspc(&space.device()), m_from_mcu);
261   //logerror("%04x: mcu read (0x%02x)\n", space.device().safe_pcbase(), m_from_mcu);
262262
263263   return m_from_mcu - VICTNINE_MCU_SEED;
264264}
trunk/src/mame/machine/smpc.c
r17788r17789
716716         smpc_nmi_set(space->machine(),data & 1);
717717         break;
718718      default:
719         printf ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space->device().tag(), cpu_get_pc(&space->device()), data);
719         printf ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space->device().tag(), space->device().safe_pc(), data);
720720   }
721721}
722722
r17788r17789
883883      }
884884   }
885885
886   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);
886   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);
887887
888888
889889   return return_data;
trunk/src/mame/machine/segas32.c
r17788r17789
224224WRITE16_MEMBER(segas32_state::darkedge_protection_w)
225225{
226226   logerror("%06x:darkedge_prot_w(%06X) = %04X & %04X\n",
227      cpu_get_pc(&space.device()), 0xa00000 + 2*offset, data, mem_mask);
227      space.device().safe_pc(), 0xa00000 + 2*offset, data, mem_mask);
228228}
229229
230230
231231READ16_MEMBER(segas32_state::darkedge_protection_r)
232232{
233233   logerror("%06x:darkedge_prot_r(%06X) & %04X\n",
234      cpu_get_pc(&space.device()), 0xa00000 + 2*offset, mem_mask);
234      space.device().safe_pc(), 0xa00000 + 2*offset, mem_mask);
235235   return 0xffff;
236236}
237237
r17788r17789
284284// protection ram is 8-bits wide and only occupies every other address
285285READ16_MEMBER(segas32_state::arabfgt_protection_r)
286286{
287   int PC = cpu_get_pc(&space.device());
287   int PC = space.device().safe_pc();
288288   int cmpVal;
289289
290290   if (PC == 0xfe0325 || PC == 0xfe01e5 || PC == 0xfe035e || PC == 0xfe03cc)
trunk/src/mame/machine/slapfght.c
r17788r17789
266266               getstar_val = 0x76;
267267               break;
268268            default:
269               logerror("%04x: getstar_e803_r - cmd = %02x\n",cpu_get_pc(&space.device()),m_getstar_cmd);
269               logerror("%04x: getstar_e803_r - cmd = %02x\n",space.device().safe_pc(),m_getstar_cmd);
270270               break;
271271         }
272272         break;
273273      case GTSTARB1:
274274         /* value isn't computed by the bootleg but we want to please the "test mode" */
275         if (cpu_get_pc(&space.device()) == 0x6b04) return (lives_lookup_table[m_gs_a]);
275         if (space.device().safe_pc() == 0x6b04) return (lives_lookup_table[m_gs_a]);
276276         break;
277277      case GTSTARB2:
278278         /*
r17788r17789
285285            0576: BE            cp   (hl)
286286            0577: C2 6E 05      jp   nz,$056E
287287            */
288         if (cpu_get_pc(&space.device()) == 0x056e) return (getstar_val);
289         if (cpu_get_pc(&space.device()) == 0x0570) return (getstar_val+1);
290         if (cpu_get_pc(&space.device()) == 0x0577) return ((getstar_val+0x05) ^ 0x56);
288         if (space.device().safe_pc() == 0x056e) return (getstar_val);
289         if (space.device().safe_pc() == 0x0570) return (getstar_val+1);
290         if (space.device().safe_pc() == 0x0577) return ((getstar_val+0x05) ^ 0x56);
291291         /* value isn't computed by the bootleg but we want to please the "test mode" */
292         if (cpu_get_pc(&space.device()) == 0x6b04) return (lgsb2_lookup_table[m_gs_a]);
292         if (space.device().safe_pc() == 0x6b04) return (lgsb2_lookup_table[m_gs_a]);
293293         break;
294294      default:
295         logerror("%04x: getstar_e803_r - cmd = %02x - unknown set !\n",cpu_get_pc(&space.device()),m_getstar_cmd);
295         logerror("%04x: getstar_e803_r - cmd = %02x - unknown set !\n",space.device().safe_pc(),m_getstar_cmd);
296296         break;
297297   }
298298   return getstar_val;
r17788r17789
304304   {
305305      case GETSTAR:
306306         /* unknown effect - not read back */
307         if (cpu_get_pc(&space.device()) == 0x00bf)
307         if (space.device().safe_pc() == 0x00bf)
308308         {
309309            m_getstar_cmd = 0x00;
310310            GS_RESET_REGS
311311         }
312312         /* players inputs */
313         if (cpu_get_pc(&space.device()) == 0x0560)
313         if (space.device().safe_pc() == 0x0560)
314314         {
315315            m_getstar_cmd = 0x25;
316316            GS_RESET_REGS
317317         }
318         if (cpu_get_pc(&space.device()) == 0x056d)
318         if (space.device().safe_pc() == 0x056d)
319319         {
320320            m_getstar_cmd = 0x25;
321321            GS_SAVE_REGS
322322         }
323323         /* lose life */
324         if (cpu_get_pc(&space.device()) == 0x0a0a)
324         if (space.device().safe_pc() == 0x0a0a)
325325         {
326326            m_getstar_cmd = 0x21;
327327            GS_RESET_REGS
328328         }
329         if (cpu_get_pc(&space.device()) == 0x0a17)
329         if (space.device().safe_pc() == 0x0a17)
330330         {
331331            m_getstar_cmd = 0x21;
332332            GS_SAVE_REGS
333333         }
334334         /* unknown effect */
335         if (cpu_get_pc(&space.device()) == 0x0a51)
335         if (space.device().safe_pc() == 0x0a51)
336336         {
337337            m_getstar_cmd = 0x29;
338338            GS_RESET_REGS
339339         }
340         if (cpu_get_pc(&space.device()) == 0x0a6e)
340         if (space.device().safe_pc() == 0x0a6e)
341341         {
342342            m_getstar_cmd = 0x29;
343343            GS_SAVE_REGS
344344         }
345345         /* continue play */
346         if (cpu_get_pc(&space.device()) == 0x0ae3)
346         if (space.device().safe_pc() == 0x0ae3)
347347         {
348348            m_getstar_cmd = 0x20;
349349            GS_RESET_REGS
350350         }
351         if (cpu_get_pc(&space.device()) == 0x0af0)
351         if (space.device().safe_pc() == 0x0af0)
352352         {
353353            m_getstar_cmd = 0x20;
354354            GS_SAVE_REGS
355355         }
356356         /* unknown effect - not read back */
357         if (cpu_get_pc(&space.device()) == 0x0b62)
357         if (space.device().safe_pc() == 0x0b62)
358358         {
359359            m_getstar_cmd = 0x00;     /* 0x1f */
360360            GS_RESET_REGS
361361         }
362362         /* change player (if 2 players game) */
363         if (cpu_get_pc(&space.device()) == 0x0bab)
363         if (space.device().safe_pc() == 0x0bab)
364364         {
365365            m_getstar_cmd = 0x2a;
366366            GS_RESET_REGS
367367         }
368         if (cpu_get_pc(&space.device()) == 0x0bb8)
368         if (space.device().safe_pc() == 0x0bb8)
369369         {
370370            m_getstar_cmd = 0x2a;
371371            GS_SAVE_REGS
372372         }
373373         /* game phase */
374         if (cpu_get_pc(&space.device()) == 0x0d37)
374         if (space.device().safe_pc() == 0x0d37)
375375         {
376376            m_getstar_cmd = 0x24;
377377            GS_RESET_REGS
378378         }
379         if (cpu_get_pc(&space.device()) == 0x0d44)
379         if (space.device().safe_pc() == 0x0d44)
380380         {
381381            m_getstar_cmd = 0x24;
382382            GS_SAVE_REGS
383383         }
384384         /* starting lives */
385         if (cpu_get_pc(&space.device()) == 0x0d79)
385         if (space.device().safe_pc() == 0x0d79)
386386         {
387387            m_getstar_cmd = 0x23;
388388            GS_RESET_REGS
389389         }
390         if (cpu_get_pc(&space.device()) == 0x0d8a)
390         if (space.device().safe_pc() == 0x0d8a)
391391         {
392392            m_getstar_cmd = 0x23;
393393            GS_SAVE_REGS
394394         }
395395         /* starting difficulty */
396         if (cpu_get_pc(&space.device()) == 0x0dc1)
396         if (space.device().safe_pc() == 0x0dc1)
397397         {
398398            m_getstar_cmd = 0x22;
399399            GS_RESET_REGS
400400         }
401         if (cpu_get_pc(&space.device()) == 0x0dd0)
401         if (space.device().safe_pc() == 0x0dd0)
402402         {
403403            m_getstar_cmd = 0x22;
404404            GS_SAVE_REGS
405405         }
406406         /* starting lives (again) */
407         if (cpu_get_pc(&space.device()) == 0x1011)
407         if (space.device().safe_pc() == 0x1011)
408408         {
409409            m_getstar_cmd = 0x23;
410410            GS_RESET_REGS
411411         }
412         if (cpu_get_pc(&space.device()) == 0x101e)
412         if (space.device().safe_pc() == 0x101e)
413413         {
414414            m_getstar_cmd = 0x23;
415415            GS_SAVE_REGS
416416         }
417417         /* hardware test */
418         if (cpu_get_pc(&space.device()) == 0x107a)
418         if (space.device().safe_pc() == 0x107a)
419419         {
420420            m_getstar_cmd = 0x73;
421421            GS_RESET_REGS
422422         }
423423         /* game phase (again) */
424         if (cpu_get_pc(&space.device()) == 0x10c6)
424         if (space.device().safe_pc() == 0x10c6)
425425         {
426426            m_getstar_cmd = 0x24;
427427            GS_RESET_REGS
428428         }
429         if (cpu_get_pc(&space.device()) == 0x10d3)
429         if (space.device().safe_pc() == 0x10d3)
430430         {
431431            m_getstar_cmd = 0x24;
432432            GS_SAVE_REGS
433433         }
434434         /* background */
435         if (cpu_get_pc(&space.device()) == 0x1910)
435         if (space.device().safe_pc() == 0x1910)
436436         {
437437            m_getstar_cmd = 0x26;
438438            GS_RESET_REGS
439439         }
440         if (cpu_get_pc(&space.device()) == 0x191d)
440         if (space.device().safe_pc() == 0x191d)
441441         {
442442            m_getstar_cmd = 0x26;
443443            GS_SAVE_REGS
444444         }
445445         /* foreground */
446         if (cpu_get_pc(&space.device()) == 0x19d5)
446         if (space.device().safe_pc() == 0x19d5)
447447         {
448448            m_getstar_cmd = 0x37;
449449            GS_RESET_REGS
450450         }
451         if (cpu_get_pc(&space.device()) == 0x19e4)
451         if (space.device().safe_pc() == 0x19e4)
452452         {
453453            m_getstar_cmd = 0x37;
454454            GS_SAVE_REGS
455455         }
456         if (cpu_get_pc(&space.device()) == 0x19f1)
456         if (space.device().safe_pc() == 0x19f1)
457457         {
458458            m_getstar_cmd = 0x37;
459459            /* do NOT update the registers because there are 2 writes before 2 reads ! */
460460         }
461461         /* laser position */
462         if (cpu_get_pc(&space.device()) == 0x26af)
462         if (space.device().safe_pc() == 0x26af)
463463         {
464464            m_getstar_cmd = 0x38;
465465            GS_RESET_REGS
466466         }
467         if (cpu_get_pc(&space.device()) == 0x26be)
467         if (space.device().safe_pc() == 0x26be)
468468         {
469469            m_getstar_cmd = 0x38;
470470            GS_SAVE_REGS
471471         }
472         if (cpu_get_pc(&space.device()) == 0x26cb)
472         if (space.device().safe_pc() == 0x26cb)
473473         {
474474            m_getstar_cmd = 0x38;
475475            /* do NOT update the registers because there are 2 writes before 2 reads ! */
476476         }
477477         /* starting lives (for "test mode") */
478         if (cpu_get_pc(&space.device()) == 0x6a27)
478         if (space.device().safe_pc() == 0x6a27)
479479         {
480480            m_getstar_cmd = 0x23;
481481            GS_RESET_REGS
482482         }
483         if (cpu_get_pc(&space.device()) == 0x6a38)
483         if (space.device().safe_pc() == 0x6a38)
484484         {
485485            m_getstar_cmd = 0x23;
486486            GS_SAVE_REGS
r17788r17789
488488         break;
489489      case GETSTARJ:
490490         /* unknown effect - not read back */
491         if (cpu_get_pc(&space.device()) == 0x00bf)
491         if (space.device().safe_pc() == 0x00bf)
492492         {
493493            m_getstar_cmd = 0x00;
494494            GS_RESET_REGS
495495         }
496496         /* players inputs */
497         if (cpu_get_pc(&space.device()) == 0x0560)
497         if (space.device().safe_pc() == 0x0560)
498498         {
499499            m_getstar_cmd = 0x25;
500500            GS_RESET_REGS
501501         }
502         if (cpu_get_pc(&space.device()) == 0x056d)
502         if (space.device().safe_pc() == 0x056d)
503503         {
504504            m_getstar_cmd = 0x25;
505505            GS_SAVE_REGS
506506         }
507507         /* lose life */
508         if (cpu_get_pc(&space.device()) == 0x0ad5)
508         if (space.device().safe_pc() == 0x0ad5)
509509         {
510510            m_getstar_cmd = 0x21;
511511            GS_RESET_REGS
512512         }
513         if (cpu_get_pc(&space.device()) == 0x0ae2)
513         if (space.device().safe_pc() == 0x0ae2)
514514         {
515515            m_getstar_cmd = 0x21;
516516            GS_SAVE_REGS
517517         }
518518         /* unknown effect */
519         if (cpu_get_pc(&space.device()) == 0x0b1c)
519         if (space.device().safe_pc() == 0x0b1c)
520520         {
521521            m_getstar_cmd = 0x29;
522522            GS_RESET_REGS
523523         }
524         if (cpu_get_pc(&space.device()) == 0x0b29)
524         if (space.device().safe_pc() == 0x0b29)
525525         {
526526            m_getstar_cmd = 0x29;
527527            GS_SAVE_REGS
528528         }
529529         /* continue play */
530         if (cpu_get_pc(&space.device()) == 0x0bae)
530         if (space.device().safe_pc() == 0x0bae)
531531         {
532532            m_getstar_cmd = 0x20;
533533            GS_RESET_REGS
534534         }
535         if (cpu_get_pc(&space.device()) == 0x0bbb)
535         if (space.device().safe_pc() == 0x0bbb)
536536         {
537537            m_getstar_cmd = 0x20;
538538            GS_SAVE_REGS
539539         }
540540         /* unknown effect - not read back */
541         if (cpu_get_pc(&space.device()) == 0x0c2d)
541         if (space.device().safe_pc() == 0x0c2d)
542542         {
543543            m_getstar_cmd = 0x00;     /* 0x1f */
544544            GS_RESET_REGS
545545         }
546546         /* change player (if 2 players game) */
547         if (cpu_get_pc(&space.device()) == 0x0c76)
547         if (space.device().safe_pc() == 0x0c76)
548548         {
549549            m_getstar_cmd = 0x2a;
550550            GS_RESET_REGS
551551         }
552         if (cpu_get_pc(&space.device()) == 0x0c83)
552         if (space.device().safe_pc() == 0x0c83)
553553         {
554554            m_getstar_cmd = 0x2a;
555555            GS_SAVE_REGS
556556         }
557557         /* game phase */
558         if (cpu_get_pc(&space.device()) == 0x0e02)
558         if (space.device().safe_pc() == 0x0e02)
559559         {
560560            m_getstar_cmd = 0x24;
561561            GS_RESET_REGS
562562         }
563         if (cpu_get_pc(&space.device()) == 0x0e0f)
563         if (space.device().safe_pc() == 0x0e0f)
564564         {
565565            m_getstar_cmd = 0x24;
566566            GS_SAVE_REGS
567567         }
568568         /* starting lives */
569         if (cpu_get_pc(&space.device()) == 0x0e44)
569         if (space.device().safe_pc() == 0x0e44)
570570         {
571571            m_getstar_cmd = 0x23;
572572            GS_RESET_REGS
573573         }
574         if (cpu_get_pc(&space.device()) == 0x0e55)
574         if (space.device().safe_pc() == 0x0e55)
575575         {
576576            m_getstar_cmd = 0x23;
577577            GS_SAVE_REGS
578578         }
579579         /* starting difficulty */
580         if (cpu_get_pc(&space.device()) == 0x0e8c)
580         if (space.device().safe_pc() == 0x0e8c)
581581         {
582582            m_getstar_cmd = 0x22;
583583            GS_RESET_REGS
584584         }
585         if (cpu_get_pc(&space.device()) == 0x0e9b)
585         if (space.device().safe_pc() == 0x0e9b)
586586         {
587587            m_getstar_cmd = 0x22;
588588            GS_SAVE_REGS
589589         }
590590         /* starting lives (again) */
591         if (cpu_get_pc(&space.device()) == 0x10d6)
591         if (space.device().safe_pc() == 0x10d6)
592592         {
593593            m_getstar_cmd = 0x23;
594594            GS_RESET_REGS
595595         }
596         if (cpu_get_pc(&space.device()) == 0x10e3)
596         if (space.device().safe_pc() == 0x10e3)
597597         {
598598            m_getstar_cmd = 0x23;
599599            GS_SAVE_REGS
600600         }
601601         /* hardware test */
602         if (cpu_get_pc(&space.device()) == 0x113f)
602         if (space.device().safe_pc() == 0x113f)
603603         {
604604            m_getstar_cmd = 0x73;
605605            GS_RESET_REGS
606606         }
607607         /* game phase (again) */
608         if (cpu_get_pc(&space.device()) == 0x118b)
608         if (space.device().safe_pc() == 0x118b)
609609         {
610610            m_getstar_cmd = 0x24;
611611            GS_RESET_REGS
612612         }
613         if (cpu_get_pc(&space.device()) == 0x1198)
613         if (space.device().safe_pc() == 0x1198)
614614         {
615615            m_getstar_cmd = 0x24;
616616            GS_SAVE_REGS
617617         }
618618         /* background */
619         if (cpu_get_pc(&space.device()) == 0x19f8)
619         if (space.device().safe_pc() == 0x19f8)
620620         {
621621            m_getstar_cmd = 0x26;
622622            GS_RESET_REGS
623623         }
624         if (cpu_get_pc(&space.device()) == 0x1a05)
624         if (space.device().safe_pc() == 0x1a05)
625625         {
626626            m_getstar_cmd = 0x26;
627627            GS_SAVE_REGS
628628         }
629629         /* foreground */
630         if (cpu_get_pc(&space.device()) == 0x1abd)
630         if (space.device().safe_pc() == 0x1abd)
631631         {
632632            m_getstar_cmd = 0x37;
633633            GS_RESET_REGS
634634         }
635         if (cpu_get_pc(&space.device()) == 0x1acc)
635         if (space.device().safe_pc() == 0x1acc)
636636         {
637637            m_getstar_cmd = 0x37;
638638            GS_SAVE_REGS
639639         }
640         if (cpu_get_pc(&space.device()) == 0x1ad9)
640         if (space.device().safe_pc() == 0x1ad9)
641641         {
642642            m_getstar_cmd = 0x37;
643643            /* do NOT update the registers because there are 2 writes before 2 reads ! */
644644         }
645645         /* laser position */
646         if (cpu_get_pc(&space.device()) == 0x2792)
646         if (space.device().safe_pc() == 0x2792)
647647         {
648648            m_getstar_cmd = 0x38;
649649            GS_RESET_REGS
650650         }
651         if (cpu_get_pc(&space.device()) == 0x27a1)
651         if (space.device().safe_pc() == 0x27a1)
652652         {
653653            m_getstar_cmd = 0x38;
654654            GS_SAVE_REGS
655655         }
656         if (cpu_get_pc(&space.device()) == 0x27ae)
656         if (space.device().safe_pc() == 0x27ae)
657657         {
658658            m_getstar_cmd = 0x38;
659659            /* do NOT update the registers because there are 2 writes before 2 reads ! */
660660         }
661661         /* starting lives (for "test mode") */
662         if (cpu_get_pc(&space.device()) == 0x6ae2)
662         if (space.device().safe_pc() == 0x6ae2)
663663         {
664664            m_getstar_cmd = 0x23;
665665            GS_RESET_REGS
666666         }
667         if (cpu_get_pc(&space.device()) == 0x6af3)
667         if (space.device().safe_pc() == 0x6af3)
668668         {
669669            m_getstar_cmd = 0x23;
670670            GS_SAVE_REGS
r17788r17789
696696                6B01: 3A 03 E8      ld   a,($E803)
697697               We save the regs though to hack it in 'getstar_e803_r' read handler.
698698            */
699         if (cpu_get_pc(&space.device()) == 0x6ae2)
699         if (space.device().safe_pc() == 0x6ae2)
700700         {
701701            m_getstar_cmd = 0x00;
702702            GS_RESET_REGS
703703         }
704         if (cpu_get_pc(&space.device()) == 0x6af3)
704         if (space.device().safe_pc() == 0x6af3)
705705         {
706706            m_getstar_cmd = 0x00;
707707            GS_SAVE_REGS
r17788r17789
735735                6B01: 3A 03 E8      ld   a,($E803)
736736               We save the regs though to hack it in 'getstar_e803_r' read handler.
737737            */
738         if (cpu_get_pc(&space.device()) == 0x6ae2)
738         if (space.device().safe_pc() == 0x6ae2)
739739         {
740740            m_getstar_cmd = 0x00;
741741            GS_RESET_REGS
742742         }
743         if (cpu_get_pc(&space.device()) == 0x6af3)
743         if (space.device().safe_pc() == 0x6af3)
744744         {
745745            m_getstar_cmd = 0x00;
746746            GS_SAVE_REGS
747747         }
748748         break;
749749      default:
750         logerror("%04x: getstar_e803_w - data = %02x - unknown set !\n",cpu_get_pc(&space.device()),data);
750         logerror("%04x: getstar_e803_w - data = %02x - unknown set !\n",space.device().safe_pc(),data);
751751         break;
752752   }
753753}
r17788r17789
756756WRITE8_MEMBER(slapfght_state::getstar_sh_intenable_w)
757757{
758758   m_getstar_sh_intenabled = 1;
759   logerror("cpu #1 PC=%d: %d written to a0e0\n",cpu_get_pc(&space.device()),data);
759   logerror("cpu #1 PC=%d: %d written to a0e0\n",space.device().safe_pc(),data);
760760}
761761
762762
r17788r17789
879879         tigerhb_val = 0x83;
880880         break;
881881      default:
882         logerror("%04x: tigerhb_e803_r - cmd = %02x\n",cpu_get_pc(&space.device()),m_getstar_cmd);
882         logerror("%04x: tigerhb_e803_r - cmd = %02x\n",space.device().safe_pc(),m_getstar_cmd);
883883         break;
884884   }
885885   return tigerhb_val;
r17788r17789
894894         m_tigerhb_cmd = 0x73;
895895         break;
896896      default:
897         logerror("%04x: tigerhb_e803_w - data = %02x\n",cpu_get_pc(&space.device()),data);
897         logerror("%04x: tigerhb_e803_w - data = %02x\n",space.device().safe_pc(),data);
898898         m_tigerhb_cmd = 0x00;
899899         break;
900900   }
trunk/src/mame/machine/kaneko_toybox.c
r17788r17789
179179*/
180180READ16_MEMBER(kaneko_toybox_device::toybox_mcu_status_r)
181181{
182   logerror("CPU %s (PC=%06X) : read MCU status\n", space.device().tag(), cpu_get_previouspc(&space.device()));
182   logerror("CPU %s (PC=%06X) : read MCU status\n", space.device().tag(), space.device().safe_pcbase());
183183   return 0; // most games test bit 0 for failure
184184}
185185
trunk/src/mame/machine/pgmprot4.c
r17788r17789
286286      state->m_kb_cmd = data;
287287   else //offset==2
288288   {
289      logerror("%06X: ASIC25 W CMD %X  VAL %X\n", cpu_get_pc(&space->device()), state->m_kb_cmd, data);
289      logerror("%06X: ASIC25 W CMD %X  VAL %X\n", space->device().safe_pc(), state->m_kb_cmd, data);
290290      if (state->m_kb_cmd == 0)
291291         state->m_kb_reg = data;
292292      else if (state->m_kb_cmd == 2)
r17788r17789
342342
343343      }
344344   }
345   logerror("%06X: ASIC25 R CMD %X  VAL %X\n", cpu_get_pc(&space->device()), state->m_kb_cmd, res);
345   logerror("%06X: ASIC25 R CMD %X  VAL %X\n", space->device().safe_pc(), state->m_kb_cmd, res);
346346   return res;
347347}
348348
r17788r17789
461461      state->m_kb_cmd=data;
462462   else //offset==2
463463   {
464      printf("%06X: ASIC25 W CMD %X  VAL %X\n",cpu_get_pc(&space->device()),state->m_kb_cmd,data);
464      printf("%06X: ASIC25 W CMD %X  VAL %X\n",space->device().safe_pc(),state->m_kb_cmd,data);
465465      if(state->m_kb_cmd==0)
466466         reg=data;
467467      else if(state->m_kb_cmd==3)   //??????????
r17788r17789
518518
519519      }
520520   }
521   logerror("%06X: ASIC25 R CMD %X  VAL %X\n",cpu_get_pc(&space->device()),state->m_kb_cmd,res);
521   logerror("%06X: ASIC25 R CMD %X  VAL %X\n",space->device().safe_pc(),state->m_kb_cmd,res);
522522   return res;
523523}
524524
trunk/src/mame/machine/decocass.c
r17788r17789
210210WRITE8_HANDLER( decocass_reset_w )
211211{
212212   decocass_state *state = space->machine().driver_data<decocass_state>();
213   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));
213   LOG(1,("%10s 6502-PC: %04x decocass_reset_w(%02x): $%02x\n", space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data));
214214   state->m_decocass_reset = data;
215215
216216   /* CPU #1 active high reset */
r17788r17789
289289
290290      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
291291      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n",
292         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data,
292         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data,
293293         (data & 1) ? "OBF" : "-",
294294         (data & 2) ? "IBF" : "-"));
295295   }
r17788r17789
337337         (((prom[promaddr] >> 4) & 1)            << MAP7(state->m_type1_outmap));
338338
339339      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_3_inv_2_r(%02x): $%02x\n",
340         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data));
340         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data));
341341
342342      state->m_latch1 = save;      /* latch the data for the next A0 == 0 read */
343343   }
r17788r17789
369369
370370      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
371371      LOG(4,("%10s 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x <- (%s %s)\n",
372         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data,
372         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data,
373373         (data & 1) ? "OBF" : "-",
374374         (data & 2) ? "IBF" : "-"));
375375   }
r17788r17789
417417         (((prom[promaddr] >> 4) & 1)            << MAP7(state->m_type1_outmap));
418418
419419      LOG(3,("%10s 6502-PC: %04x decocass_type1_pass_136_r(%02x): $%02x\n",
420         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data));
420         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data));
421421
422422      state->m_latch1 = save;      /* latch the data for the next A0 == 0 read */
423423   }
r17788r17789
449449
450450      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
451451      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x <- (%s %s)\n",
452         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data,
452         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data,
453453         (data & 1) ? "OBF" : "-",
454454         (data & 2) ? "IBF" : "-"));
455455   }
r17788r17789
497497         (((state->m_latch1 >> MAP7(state->m_type1_inmap)) & 1)      << MAP7(state->m_type1_outmap));
498498
499499      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_27_pass_3_inv_2_r(%02x): $%02x\n",
500         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data));
500         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data));
501501
502502      state->m_latch1 = save;      /* latch the data for the next A0 == 0 read */
503503   }
r17788r17789
529529
530530      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
531531      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x <- (%s %s)\n",
532         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data,
532         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data,
533533         (data & 1) ? "OBF" : "-",
534534         (data & 2) ? "IBF" : "-"));
535535   }
r17788r17789
577577         (((prom[promaddr] >> 4) & 1)            << MAP7(state->m_type1_outmap));
578578
579579      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_26_pass_5_inv_2_r(%02x): $%02x\n",
580         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data));
580         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data));
581581
582582      state->m_latch1 = save;      /* latch the data for the next A0 == 0 read */
583583   }
r17788r17789
611611
612612      data = (BIT(data, 0) << 0) | (BIT(data, 1) << 1) | 0x7c;
613613      LOG(4,("%10s 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x <- (%s %s)\n",
614         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data,
614         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data,
615615         (data & 1) ? "OBF" : "-",
616616         (data & 2) ? "IBF" : "-"));
617617   }
r17788r17789
659659         (((prom[promaddr] >> 4) & 1)            << MAP7(state->m_type1_outmap));
660660
661661      LOG(3,("%10s 6502-PC: %04x decocass_type1_latch_16_pass_3_inv_1_r(%02x): $%02x\n",
662         space->machine().time().as_string(6), cpu_get_previouspc(&space->device()), offset, data));
662         space->machine().time().as_string(6), space->device().safe_pcbase(), offset, data));
663663
664664      state->m_latch1 = save;      /* latch the data for the next A0 == 0 read */
665665   }
r17788r17789
689689      {
690690         UINT8 *prom = state->memregion("dongle")->base();
691691         data = prom[256 * state->m_type2_d2_latch + state->m_type2_promaddr];
692         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));
692         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));
693693      }
694694      else
695695      {
r17788r17789
703703      else
704704         data = offset & 0xff;
705705
706      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"));
706      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"));
707707   }
708708   return data;
709709}
r17788r17789
715715   {
716716      if (1 == (offset & 1))
717717      {
718         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));
718         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));
719719      }
720720      else
721721      {
722722         state->m_type2_promaddr = data;
723         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));
723         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));
724724         return;
725725      }
726726   }
727727   else
728728   {
729      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"));
729      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"));
730730   }
731731   if (1 == (offset & 1))
732732   {
r17788r17789
773773      {
774774         UINT8 *prom = state->memregion("dongle")->base();
775775         data = prom[state->m_type3_ctrs];
776         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));
776         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));
777777         if (++state->m_type3_ctrs == 4096)
778778            state->m_type3_ctrs = 0;
779779      }
r17788r17789
782782         if (0 == (offset & E5XX_MASK))
783783         {
784784            data = upi41_master_r(state->m_mcu, 1);
785            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));
785            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));
786786         }
787787         else
788788         {
789789            data = 0xff;   /* open data bus? */
790            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));
790            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));
791791         }
792792      }
793793   }
r17788r17789
796796      if (1 == state->m_type3_pal_19)
797797      {
798798         save = data = 0xff;    /* open data bus? */
799         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));
799         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));
800800      }
801801      else
802802      {
r17788r17789
938938                  (BIT(save, 7) << 7);
939939            }
940940            state->m_type3_d0_latch = save & 1;
941            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 : '.'));
941            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 : '.'));
942942         }
943943         else
944944         {
r17788r17789
952952               (BIT(save, 5) << 5) |
953953               (BIT(save, 6) << 7) |
954954               (BIT(save, 7) << 6);
955            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 : '.'));
955            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 : '.'));
956956            state->m_type3_d0_latch = save & 1;
957957         }
958958      }
r17788r17789
969969      if (1 == state->m_type3_pal_19)
970970      {
971971         state->m_type3_ctrs = data << 4;
972         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"));
972         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"));
973973         return;
974974      }
975975      else
r17788r17789
981981      if (1 == state->m_type3_pal_19)
982982      {
983983         /* write nowhere?? */
984         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?"));
984         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?"));
985985         return;
986986      }
987987   }
988   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"));
988   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"));
989989   upi41_master_w(state->m_mcu, offset, data);
990990}
991991
r17788r17789
10121012      if (0 == (offset & E5XX_MASK))
10131013      {
10141014         data = upi41_master_r(state->m_mcu, 1);
1015         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));
1015         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));
10161016      }
10171017      else
10181018      {
10191019         data = 0xff;   /* open data bus? */
1020         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));
1020         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));
10211021      }
10221022   }
10231023   else
r17788r17789
10271027         UINT8 *prom = space->machine().root_device().memregion("dongle")->base();
10281028
10291029         data = prom[state->m_type4_ctrs];
1030         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));
1030         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));
10311031         state->m_type4_ctrs = (state->m_type4_ctrs + 1) & 0x7fff;
10321032      }
10331033      else
r17788r17789
10351035         if (0 == (offset & E5XX_MASK))
10361036         {
10371037            data = upi41_master_r(state->m_mcu, 0);
1038            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 : '.'));
1038            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 : '.'));
10391039         }
10401040         else
10411041         {
10421042            data = 0xff;   /* open data bus? */
1043            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));
1043            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));
10441044         }
10451045      }
10461046   }
r17788r17789
10561056      if (1 == state->m_type4_latch)
10571057      {
10581058         state->m_type4_ctrs = (state->m_type4_ctrs & 0x00ff) | ((data & 0x7f) << 8);
1059         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));
1059         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));
10601060         return;
10611061      }
10621062      else
r17788r17789
10701070      if (state->m_type4_latch)
10711071      {
10721072         state->m_type4_ctrs = (state->m_type4_ctrs & 0xff00) | data;
1073         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));
1073         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));
10741074         return;
10751075      }
10761076   }
1077   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"));
1077   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"));
10781078   upi41_master_w(state->m_mcu, offset, data);
10791079}
10801080
r17788r17789
10971097      if (0 == (offset & E5XX_MASK))
10981098      {
10991099         data = upi41_master_r(state->m_mcu, 1);
1100         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));
1100         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));
11011101      }
11021102      else
11031103      {
11041104         data = 0xff;   /* open data bus? */
1105         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));
1105         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));
11061106      }
11071107   }
11081108   else
r17788r17789
11101110      if (state->m_type5_latch)
11111111      {
11121112         data = 0x55;   /* Only a fixed value? It looks like this is all we need to do */
1113         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 : '.'));
1113         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 : '.'));
11141114      }
11151115      else
11161116      {
11171117         if (0 == (offset & E5XX_MASK))
11181118         {
11191119            data = upi41_master_r(state->m_mcu, 0);
1120            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 : '.'));
1120            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 : '.'));
11211121         }
11221122         else
11231123         {
11241124            data = 0xff;   /* open data bus? */
1125            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));
1125            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));
11261126         }
11271127      }
11281128   }
r17788r17789
11371137   {
11381138      if (1 == state->m_type5_latch)
11391139      {
1140         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??"));
1140         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??"));
11411141         return;
11421142      }
11431143      else
r17788r17789
11491149      if (state->m_type5_latch)
11501150      {
11511151         /* write nowhere?? */
1152         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?"));
1152         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?"));
11531153         return;
11541154      }
11551155   }
1156   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"));
1156   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"));
11571157   upi41_master_w(state->m_mcu, offset, data);
11581158}
11591159
r17788r17789
11751175      if (0 == (offset & E5XX_MASK))
11761176      {
11771177         data = upi41_master_r(state->m_mcu, 1);
1178         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));
1178         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));
11791179      }
11801180      else
11811181      {
11821182         data = 0xff;   /* open data bus? */
1183         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));
1183         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));
11841184      }
11851185   }
11861186   else
r17788r17789
11881188      if (0 == (offset & E5XX_MASK))
11891189      {
11901190         data = upi41_master_r(state->m_mcu, 0);
1191         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 : '.'));
1191         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 : '.'));
11921192      }
11931193      else
11941194      {
11951195         data = 0xff;   /* open data bus? */
1196         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));
1196         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));
11971197      }
11981198   }
11991199
r17788r17789
12281228
12291229      LOG(4,("%10s 6502-PC: %04x decocass_e5xx_r(%02x): $%02x <- STATUS (%s%s%s%s%s%s%s%s)\n",
12301230         space->machine().time().as_string(6),
1231         cpu_get_previouspc(&space->device()),
1231         space->device().safe_pcbase(),
12321232         offset, data,
12331233         data & 0x01 ? "" : "REQ/",
12341234         data & 0x02 ? "" : " FNO/",
r17788r17789
12601260
12611261   if (0 == (offset & E5XX_MASK))
12621262   {
1263      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"));
1263      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"));
12641264      upi41_master_w(state->m_mcu, offset & 1, data);
12651265#ifdef MAME_DEBUG
12661266      decocass_fno(space->machine(), offset, data);
r17788r17789
12681268   }
12691269   else
12701270   {
1271      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));
1271      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));
12721272   }
12731273}
12741274
r17788r17789
17581758   {
17591759      LOG(4,("%10s 8041-PC: %03x i8041_p1_w: $%02x (%s%s%s%s%s%s%s%s)\n",
17601760         space->machine().time().as_string(6),
1761         cpu_get_previouspc(&space->device()),
1761         space->device().safe_pcbase(),
17621762         data,
17631763         data & 0x01 ? "" : "DATA-WRT",
17641764         data & 0x02 ? "" : " DATA-CLK",
r17788r17789
17951795   {
17961796      LOG(4,("%10s 8041-PC: %03x i8041_p1_r: $%02x (%s%s%s%s%s%s%s%s)\n",
17971797         space->machine().time().as_string(6),
1798         cpu_get_previouspc(&space->device()),
1798         space->device().safe_pcbase(),
17991799         data,
18001800         data & 0x01 ? "" : "DATA-WRT",
18011801         data & 0x02 ? "" : " DATA-CLK",
r17788r17789
18171817   {
18181818      LOG(4,("%10s 8041-PC: %03x i8041_p2_w: $%02x (%s%s%s%s%s%s%s%s)\n",
18191819         space->machine().time().as_string(6),
1820         cpu_get_previouspc(&space->device()),
1820         space->device().safe_pcbase(),
18211821         data,
18221822         data & 0x01 ? "" : "FNO/",
18231823         data & 0x02 ? "" : " EOT/",
r17788r17789
18431843   {
18441844      LOG(4,("%10s 8041-PC: %03x i8041_p2_r: $%02x (%s%s%s%s%s%s%s%s)\n",
18451845         space->machine().time().as_string(6),
1846         cpu_get_previouspc(&space->device()),
1846         space->device().safe_pcbase(),
18471847         data,
18481848         data & 0x01 ? "" : "FNO/",
18491849         data & 0x02 ? "" : " EOT/",
trunk/src/mame/machine/konppc.c
r17788r17789
129129{
130130   if (cgboard_id < MAX_CG_BOARDS)
131131   {
132//      mame_printf_debug("dsp_cmd_r: (board %d) %08X, %08X at %08X\n", cgboard_id, offset, mem_mask, cpu_get_pc(&space->device()));
132//      mame_printf_debug("dsp_cmd_r: (board %d) %08X, %08X at %08X\n", cgboard_id, offset, mem_mask, space->device().safe_pc());
133133      return dsp_comm_sharc[cgboard_id][offset] | (dsp_state[cgboard_id] << 16);
134134   }
135135   else
r17788r17789
144144   const char *pcitag = (cgboard_id == 0) ? "k033906_1" : "k033906_2";
145145   device_t *dsp = space->machine().device(dsptag);
146146   device_t *k033906 = space->machine().device(pcitag);
147//  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()));
147//  mame_printf_debug("dsp_cmd_w: (board %d) %08X, %08X, %08X at %08X\n", cgboard_id, data, offset, mem_mask, space->device().safe_pc());
148148
149149   if (cgboard_id < MAX_CG_BOARDS)
150150   {
trunk/src/mame/machine/leland.c
r17788r17789
109109{
110110   /* catch the case where they clear this memory location at PC $1827 and change */
111111   /* the value written to be a 1 */
112   if (cpu_get_previouspc(&space.device()) == 0x1827)
112   if (space.device().safe_pcbase() == 0x1827)
113113      *m_alleymas_kludge_mem = 1;
114114   else
115115      *m_alleymas_kludge_mem = data;
r17788r17789
469469   /* update any bankswitching */
470470   if (LOG_BANKSWITCHING_M)
471471      if ((m_alternate_bank ^ data) & 0x0f)
472         logerror("%04X:alternate_bank = %02X\n", cpu_get_pc(&space.device()), data & 0x0f);
472         logerror("%04X:alternate_bank = %02X\n", space.device().safe_pc(), data & 0x0f);
473473   m_alternate_bank = data & 15;
474474   (*m_update_master_bank)(machine());
475475
r17788r17789
852852{
853853   if (m_battery_ram_enable)
854854   {
855      if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", cpu_get_pc(&space.device()), offset, data);
855      if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", space.device().safe_pc(), offset, data);
856856      m_battery_ram[offset] = data;
857857   }
858858   else
859      logerror("%04X:BatteryW@%04X (invalid!)\n", cpu_get_pc(&space.device()), offset);
859      logerror("%04X:BatteryW@%04X (invalid!)\n", space.device().safe_pc(), offset);
860860}
861861
862862
r17788r17789
864864{
865865   if (m_battery_ram_enable)
866866   {
867      if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", cpu_get_pc(&space.device()), offset, data);
867      if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", space.device().safe_pc(), offset, data);
868868      m_battery_ram[offset] = data;
869869   }
870870   else if ((m_master_bank & 0x30) == 0x20)
871871      m_ataxx_qram[((m_master_bank & 0xc0) << 8) + offset] = data;
872872   else
873      logerror("%04X:BatteryW@%04X (invalid!)\n", cpu_get_pc(&space.device()), offset);
873      logerror("%04X:BatteryW@%04X (invalid!)\n", space.device().safe_pc(), offset);
874874}
875875
876876
r17788r17789
10651065         /* update top board banking for some games */
10661066         if (LOG_BANKSWITCHING_M)
10671067            if ((m_top_board_bank ^ data) & 0xc0)
1068               logerror("%04X:top_board_bank = %02X\n", cpu_get_pc(&space.device()), data & 0xc0);
1068               logerror("%04X:top_board_bank = %02X\n", space.device().safe_pc(), data & 0xc0);
10691069         m_top_board_bank = data & 0xc0;
10701070         (*m_update_master_bank)(machine());
10711071         break;
r17788r17789
11161116
11171117      case 0x11:   /* /GIN1 */
11181118         result = ioport("IN3")->read();
1119         if (LOG_EEPROM) logerror("%04X:EE read\n", cpu_get_pc(&space.device()));
1119         if (LOG_EEPROM) logerror("%04X:EE read\n", space.device().safe_pc());
11201120         break;
11211121
11221122      default:
r17788r17789
11401140         cputag_set_input_line(machine(), "slave", 0, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
11411141
11421142         eeprom = machine().device<eeprom_device>("eeprom");
1143         if (LOG_EEPROM) logerror("%04X:EE write %d%d%d\n", cpu_get_pc(&space.device()),
1143         if (LOG_EEPROM) logerror("%04X:EE write %d%d%d\n", space.device().safe_pc(),
11441144               (data >> 6) & 1, (data >> 5) & 1, (data >> 4) & 1);
11451145         eeprom->write_bit     ((data & 0x10) >> 4);
11461146         eeprom->set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
r17788r17789
12041204      case 0x04:   /* /MBNK */
12051205         if (LOG_BANKSWITCHING_M)
12061206            if ((m_master_bank ^ data) & 0xff)
1207               logerror("%04X:master_bank = %02X\n", cpu_get_pc(&space.device()), data & 0xff);
1207               logerror("%04X:master_bank = %02X\n", space.device().safe_pc(), data & 0xff);
12081208         m_master_bank = data;
12091209         ataxx_bankswitch(machine());
12101210         break;
r17788r17789
12571257   else if (offset == 0x7fc)
12581258   {
12591259      m_xrom1_addr = (m_xrom1_addr & 0xff00) | (data & 0x00ff);
1260      if (LOG_XROM) logerror("%04X:XROM1 address low write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom1_addr);
1260      if (LOG_XROM) logerror("%04X:XROM1 address low write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom1_addr);
12611261   }
12621262   else if (offset == 0x7fd)
12631263   {
12641264      m_xrom1_addr = (m_xrom1_addr & 0x00ff) | ((data << 8) & 0xff00);
1265      if (LOG_XROM) logerror("%04X:XROM1 address high write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom1_addr);
1265      if (LOG_XROM) logerror("%04X:XROM1 address high write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom1_addr);
12661266   }
12671267   else if (offset == 0x7fe)
12681268   {
12691269      m_xrom2_addr = (m_xrom2_addr & 0xff00) | (data & 0x00ff);
1270      if (LOG_XROM) logerror("%04X:XROM2 address low write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom2_addr);
1270      if (LOG_XROM) logerror("%04X:XROM2 address low write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom2_addr);
12711271   }
12721272   else if (offset == 0x7ff)
12731273   {
12741274      m_xrom2_addr = (m_xrom2_addr & 0x00ff) | ((data << 8) & 0xff00);
1275      if (LOG_XROM) logerror("%04X:XROM2 address high write = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), data, m_xrom2_addr);
1275      if (LOG_XROM) logerror("%04X:XROM2 address high write = %02X (addr=%04X)\n", space.device().safe_pc(), data, m_xrom2_addr);
12761276   }
12771277   else
12781278      m_extra_tram[offset] = data;
r17788r17789
12861286   else if (offset == 0x7fc || offset == 0x7fd)
12871287   {
12881288      int result = m_xrom_base[0x00000 | m_xrom1_addr | ((offset & 1) << 16)];
1289      if (LOG_XROM) logerror("%04X:XROM1 read(%d) = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), offset - 0x7fc, result, m_xrom1_addr);
1289      if (LOG_XROM) logerror("%04X:XROM1 read(%d) = %02X (addr=%04X)\n", space.device().safe_pc(), offset - 0x7fc, result, m_xrom1_addr);
12901290      return result;
12911291   }
12921292   else if (offset == 0x7fe || offset == 0x7ff)
12931293   {
12941294      int result = m_xrom_base[0x20000 | m_xrom2_addr | ((offset & 1) << 16)];
1295      if (LOG_XROM) logerror("%04X:XROM2 read(%d) = %02X (addr=%04X)\n", cpu_get_pc(&space.device()), offset - 0x7fc, result, m_xrom2_addr);
1295      if (LOG_XROM) logerror("%04X:XROM2 read(%d) = %02X (addr=%04X)\n", space.device().safe_pc(), offset - 0x7fc, result, m_xrom2_addr);
12961296      return result;
12971297   }
12981298   else
r17788r17789
13461346
13471347   if (bankaddress >= m_slave_length)
13481348   {
1349      logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 1);
1349      logerror("%04X:Slave bank %02X out of range!", space.device().safe_pc(), data & 1);
13501350      bankaddress = 0x10000;
13511351   }
13521352   membank("bank3")->set_base(&m_slave_base[bankaddress]);
13531353
1354   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data & 1, bankaddress);
1354   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", space.device().safe_pc(), data & 1, bankaddress);
13551355}
13561356
13571357
r17788r17789
13611361
13621362   if (bankaddress >= m_slave_length)
13631363   {
1364      logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 15);
1364      logerror("%04X:Slave bank %02X out of range!", space.device().safe_pc(), data & 15);
13651365      bankaddress = 0x10000;
13661366   }
13671367   membank("bank3")->set_base(&m_slave_base[bankaddress]);
13681368
1369   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data & 15, bankaddress);
1369   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", space.device().safe_pc(), data & 15, bankaddress);
13701370}
13711371
13721372
r17788r17789
13851385
13861386   if (bankaddress >= m_slave_length)
13871387   {
1388      logerror("%04X:Slave bank %02X out of range!", cpu_get_pc(&space.device()), data & 0x3f);
1388      logerror("%04X:Slave bank %02X out of range!", space.device().safe_pc(), data & 0x3f);
13891389      bankaddress = 0x2000;
13901390   }
13911391   membank("bank3")->set_base(&m_slave_base[bankaddress]);
13921392
1393   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_get_pc(&space.device()), data, bankaddress);
1393   if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", space.device().safe_pc(), data, bankaddress);
13941394}
13951395
13961396
trunk/src/mame/machine/midwayic.c
r17788r17789
744744      /* main CPU is handling the I/O ASIC interrupt */
745745      if (ioasic.fifo_bytes == 0 && ioasic.has_dcs)
746746      {
747         ioasic.fifo_force_buffer_empty_pc = cpu_get_pc(ioasic.dcs_cpu);
747         ioasic.fifo_force_buffer_empty_pc = ioasic.dcs_cpu->safe_pc();
748748         if (LOG_FIFO)
749749            logerror("fifo_r(%04X): FIFO empty, PC = %04X\n", result, ioasic.fifo_force_buffer_empty_pc);
750750      }
r17788r17789
774774   /* sure the FIFO clear bit is set */
775775   if (ioasic.fifo_force_buffer_empty_pc && device == ioasic.dcs_cpu)
776776   {
777      offs_t currpc = cpu_get_pc(ioasic.dcs_cpu);
777      offs_t currpc = ioasic.dcs_cpu->safe_pc();
778778      if (currpc >= ioasic.fifo_force_buffer_empty_pc && currpc < ioasic.fifo_force_buffer_empty_pc + 0x10)
779779      {
780780         ioasic.fifo_force_buffer_empty_pc = 0;
r17788r17789
932932   }
933933
934934   if (LOG_IOASIC && offset != IOASIC_SOUNDSTAT && offset != IOASIC_SOUNDIN)
935      logerror("%06X:ioasic_r(%d) = %08X\n", cpu_get_pc(&space->device()), offset, result);
935      logerror("%06X:ioasic_r(%d) = %08X\n", space->device().safe_pc(), offset, result);
936936
937937   return result;
938938}
r17788r17789
957957   newreg = ioasic.reg[offset];
958958
959959   if (LOG_IOASIC && offset != IOASIC_SOUNDOUT)
960      logerror("%06X:ioasic_w(%d) = %08X\n", cpu_get_pc(&space->device()), offset, data);
960      logerror("%06X:ioasic_w(%d) = %08X\n", space->device().safe_pc(), offset, data);
961961
962962   switch (offset)
963963   {
trunk/src/mame/machine/bonzeadv.c
r17788r17789
384384{
385385   asuka_state *state = space->machine().driver_data<asuka_state>();
386386
387//  if (cpu_get_pc(&space->device())!=0xa028)
388//  logerror("%08x:  write %04x %04x cchip\n", cpu_get_pc(&space->device()), offset, data);
387//  if (space->device().safe_pc()!=0xa028)
388//  logerror("%08x:  write %04x %04x cchip\n", space->device().safe_pc(), offset, data);
389389
390390   if (state->m_current_bank == 0)
391391   {
r17788r17789
440440{
441441   asuka_state *state = space->machine().driver_data<asuka_state>();
442442
443//  logerror("%08x:  read %04x cchip\n", cpu_get_pc(&space->device()), offset);
443//  logerror("%08x:  read %04x cchip\n", space->device().safe_pc(), offset);
444444
445445   if (state->m_current_bank == 0)
446446   {
trunk/src/mame/machine/konamigx.c
r17788r17789
143143         break;
144144
145145         default:
146//              logerror("%06x: unknown K055550 command %02x\n", cpu_get_pc(&space.device()), data);
146//              logerror("%06x: unknown K055550 command %02x\n", space.device().safe_pc(), data);
147147         break;
148148      }
149149   }
trunk/src/mame/machine/toaplan1.c
r17788r17789
6969
7070   m_main_ram_seg = ((data & 0xe000) << 9);
7171   m_dsp_addr_w   = ((data & 0x1fff) << 1);
72   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);
72   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);
7373}
7474
7575READ16_MEMBER(toaplan1_state::demonwld_dsp_r)
r17788r17789
8383      case 0xc00000:   mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
8484                  input_data = mainspace->read_word(m_main_ram_seg + m_dsp_addr_w);
8585                  break;
86      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);
86      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);
8787   }
88   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);
88   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);
8989   return input_data;
9090}
9191
r17788r17789
100100                  mainspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
101101                  mainspace->write_word(m_main_ram_seg + m_dsp_addr_w, data);
102102                  break;
103      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);
103      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);
104104   }
105   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);
105   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);
106106}
107107
108108WRITE16_MEMBER(toaplan1_state::demonwld_dsp_bio_w)
r17788r17789
114114   /*              communication to main processor*/
115115
116116
117   logerror("DSP PC:%04x IO write %04x at port 3\n", cpu_get_previouspc(&space.device()), data);
117   logerror("DSP PC:%04x IO write %04x at port 3\n", space.device().safe_pcbase(), data);
118118   if (data & 0x8000) {
119119      m_dsp_BIO = CLEAR_LINE;
120120   }
r17788r17789
164164WRITE16_MEMBER(toaplan1_state::demonwld_dsp_ctrl_w)
165165{
166166#if 0
167   logerror("68000:%08x  Writing %08x to %08x.\n",cpu_get_pc(&space.device()) ,data ,0xe0000a + offset);
167   logerror("68000:%08x  Writing %08x to %08x.\n",space.device().safe_pc() ,data ,0xe0000a + offset);
168168#endif
169169
170170   if (ACCESSING_BITS_0_7)
r17788r17789
173173      {
174174         case 0x00:   demonwld_dsp(machine(), 1); break;   /* Enable the INT line to the DSP */
175175         case 0x01:   demonwld_dsp(machine(), 0); break;   /* Inhibit the INT line to the DSP */
176         default:   logerror("68000:%04x  Writing unknown command %08x to %08x\n",cpu_get_previouspc(&space.device()) ,data ,0xe0000a + offset); break;
176         default:   logerror("68000:%04x  Writing unknown command %08x to %08x\n",space.device().safe_pcbase() ,data ,0xe0000a + offset); break;
177177      }
178178   }
179179   else
180180   {
181      logerror("68000:%04x  Writing unknown command %08x to %08x\n",cpu_get_previouspc(&space.device()) ,data ,0xe0000a + offset);
181      logerror("68000:%04x  Writing unknown command %08x to %08x\n",space.device().safe_pcbase() ,data ,0xe0000a + offset);
182182   }
183183}
184184
r17788r17789
186186READ16_MEMBER(toaplan1_state::samesame_port_6_word_r)
187187{
188188   /* Bit 0x80 is secondary CPU (HD647180) ready signal */
189   logerror("PC:%04x Warning !!! IO reading from $14000a\n",cpu_get_previouspc(&space.device()));
189   logerror("PC:%04x Warning !!! IO reading from $14000a\n",space.device().safe_pcbase());
190190   return (0x80 | ioport("TJUMP")->read()) & 0xff;
191191}
192192
r17788r17789
313313
314314   if (ACCESSING_BITS_0_7 && (data == 0))
315315   {
316      logerror("PC:%04x  Resetting Sound CPU and Sound chip (%08x)\n", cpu_get_previouspc(&space.device()), data);
316      logerror("PC:%04x  Resetting Sound CPU and Sound chip (%08x)\n", space.device().safe_pcbase(), data);
317317      devtag_reset(machine(), "ymsnd");
318318      device_t *audiocpu = machine().device("audiocpu");
319319      if (audiocpu != NULL && audiocpu->type() == Z80)
r17788r17789
334334      case 0x0d: coin_lockout_w(machine(), 0, 0); coin_lockout_w(machine(), 2, 0); break;
335335      case 0x0e: coin_lockout_w(machine(), 1, 1); coin_lockout_w(machine(), 3, 1); break;
336336      case 0x0f: coin_lockout_w(machine(), 1, 0); coin_lockout_w(machine(), 3, 0); m_coin_count=1; break;
337      default:   logerror("PC:%04x  Writing unknown data (%04x) to coin count/lockout port\n",cpu_get_previouspc(&space.device()),data); break;
337      default:   logerror("PC:%04x  Writing unknown data (%04x) to coin count/lockout port\n",space.device().safe_pcbase(),data); break;
338338   }
339339}
340340
r17788r17789
364364      case 0x02: coin_lockout_w(machine(), 1,1); break;   /* Lock coin slot B */
365365      case 0x01: coin_lockout_w(machine(), 0,1); break;   /* Lock coin slot A */
366366      case 0x00: coin_lockout_global_w(machine(), 1); break;   /* Lock all coin slots */
367      default:   logerror("PC:%04x  Writing unknown data (%04x) to coin count/lockout port\n",cpu_get_previouspc(&space.device()),data); break;
367      default:   logerror("PC:%04x  Writing unknown data (%04x) to coin count/lockout port\n",space.device().safe_pcbase(),data); break;
368368   }
369369}
370370
r17788r17789
376376   }
377377   if (ACCESSING_BITS_8_15 && (data&0xff00))
378378   {
379      logerror("PC:%04x  Writing unknown MSB data (%04x) to coin count/lockout port\n",cpu_get_previouspc(&space.device()),data);
379      logerror("PC:%04x  Writing unknown MSB data (%04x) to coin count/lockout port\n",space.device().safe_pcbase(),data);
380380   }
381381}
382382
trunk/src/mame/machine/dc.c
r17788r17789
353353   #if DEBUG_SYSCTRL
354354   if ((reg != 0x40) && (reg != 0x41) && (reg != 0x42) && (reg != 0x23) && (reg > 2))   // filter out IRQ status reads
355355   {
356      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()));
356      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());
357357   }
358358   #endif
359359
r17788r17789
615615   reg = decode_reg_64(offset, mem_mask, &shift);
616616
617617   #if DEBUG_PVRCTRL
618   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()));
618   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());
619619   #endif
620620
621621   return (UINT64)state->pvrctrl_regs[reg] << shift;
trunk/src/mame/machine/scramble.c
r17788r17789
5858
5959READ8_DEVICE_HANDLER( scramble_protection_r )
6060{
61   switch (cpu_get_pc(device->machine().device("maincpu")))
61   switch (device->machine().device("maincpu")->safe_pc())
6262   {
6363   case 0x00a8: return 0xf0;
6464   case 0x00be: return 0xb0;
r17788r17789
8888
8989READ8_HANDLER( triplep_pip_r )
9090{
91   logerror("PC %04x: triplep read port 2\n",cpu_get_pc(&space->device()));
92   if (cpu_get_pc(&space->device()) == 0x015a) return 0xff;
93   else if (cpu_get_pc(&space->device()) == 0x0886) return 0x05;
91   logerror("PC %04x: triplep read port 2\n",space->device().safe_pc());
92   if (space->device().safe_pc() == 0x015a) return 0xff;
93   else if (space->device().safe_pc() == 0x0886) return 0x05;
9494   else return 0;
9595}
9696
9797READ8_HANDLER( triplep_pap_r )
9898{
99   logerror("PC %04x: triplep read port 3\n",cpu_get_pc(&space->device()));
100   if (cpu_get_pc(&space->device()) == 0x015d) return 0x04;
99   logerror("PC %04x: triplep read port 3\n",space->device().safe_pc());
100   if (space->device().safe_pc() == 0x015d) return 0x04;
101101   else return 0;
102102}
103103
trunk/src/mame/machine/fddebug.c
r17788r17789
919919
920920   /* support 0 or 1 parameters */
921921   if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset))
922      offset = cpu_get_pc(cpu);
922      offset = cpu->safe_pc();
923923   keyaddr = addr_to_keyaddr(offset / 2);
924924
925925   /* toggle the ignore PC status */
r17788r17789
961961      return;
962962   }
963963   if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset))
964      offset = cpu_get_pc(cpu);
964      offset = cpu->safe_pc();
965965   offset /= 2;
966966
967967   /* toggle the ignore PC status */
r17788r17789
10601060
10611061   /* support 0 or 1 parameters */
10621062   if (!debug_command_parameter_number(machine, param[0], &newpc))
1063      newpc = cpu_get_pc(cpu);
1063      newpc = cpu->safe_pc();
10641064
10651065   /* set the new PC */
10661066   cpu_set_reg(cpu, STATE_GENPC, newpc);
r17788r17789
10781078static void execute_fdsearch(running_machine &machine, int ref, int params, const char **param)
10791079{
10801080   address_space *space = debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM);
1081   int pc = cpu_get_pc(&space->device());
1081   int pc = space->device().safe_pc();
10821082   int length, first = TRUE;
10831083   UINT8 instrdata[2];
10841084   UINT16 decoded;
trunk/src/mame/machine/midxunit.c
r17788r17789
8787         output_set_value("Player2_Gun_LED", (~data & 0x20) >> 5 );
8888         output_set_value("Player3_Gun_LED", (~data & 0x40) >> 6 );
8989
90         logerror("%08X:I/O write to %d = %04X\n", cpu_get_pc(&space.device()), offset, data);
91//          logerror("%08X:Unknown I/O write to %d = %04X\n", cpu_get_pc(&space.device()), offset, data);
90         logerror("%08X:I/O write to %d = %04X\n", space.device().safe_pc(), offset, data);
91//          logerror("%08X:Unknown I/O write to %d = %04X\n", space.device().safe_pc(), offset, data);
9292         break;
9393   }
9494   m_iodata[offset] = newword;
r17788r17789
103103      dcs_reset_w(machine(), data & 2);
104104
105105   if (ACCESSING_BITS_0_7 && offset % 0x40000 == 0)
106      logerror("%08X:midxunit_unknown_w @ %d = %02X\n", cpu_get_pc(&space.device()), offs, data & 0xff);
106      logerror("%08X:midxunit_unknown_w @ %d = %02X\n", space.device().safe_pc(), offs, data & 0xff);
107107}
108108
109109
r17788r17789
129129         return ioport(portnames[offset])->read();
130130
131131      default:
132         logerror("%08X:Unknown I/O read from %d\n", cpu_get_pc(&space.device()), offset);
132         logerror("%08X:Unknown I/O read from %d\n", space.device().safe_pc(), offset);
133133         break;
134134   }
135135   return ~0;
r17788r17789
238238         break;
239239   }
240240
241/*  logerror("%08X:UART R @ %X = %02X\n", cpu_get_pc(&space.device()), offset, result);*/
241/*  logerror("%08X:UART R @ %X = %02X\n", space.device().safe_pc(), offset, result);*/
242242   return result;
243243}
244244
r17788r17789
274274         break;
275275   }
276276
277/*  logerror("%08X:UART W @ %X = %02X\n", cpu_get_pc(&space.device()), offset, data);*/
277/*  logerror("%08X:UART W @ %X = %02X\n", space.device().safe_pc(), offset, data);*/
278278}
279279
280280
r17788r17789
361361
362362READ16_MEMBER(midxunit_state::midxunit_sound_r)
363363{
364   logerror("%08X:Sound read\n", cpu_get_pc(&space.device()));
364   logerror("%08X:Sound read\n", space.device().safe_pc());
365365
366366   return dcs_data_r(machine()) & 0xff;
367367}
r17788r17789
378378   /* check for out-of-bounds accesses */
379379   if (offset)
380380   {
381      logerror("%08X:Unexpected write to sound (hi) = %04X\n", cpu_get_pc(&space.device()), data);
381      logerror("%08X:Unexpected write to sound (hi) = %04X\n", space.device().safe_pc(), data);
382382      return;
383383   }
384384
385385   /* call through based on the sound type */
386386   if (ACCESSING_BITS_0_7)
387387   {
388      logerror("%08X:Sound write = %04X\n", cpu_get_pc(&space.device()), data);
388      logerror("%08X:Sound write = %04X\n", space.device().safe_pc(), data);
389389      dcs_data_w(machine(), data & 0xff);
390390   }
391391}
trunk/src/mame/machine/segaic16.c
r17788r17789
102102
103103   // read original encrypted memory at that address
104104   m_open_bus_recurse = true;
105   UINT16 result = space.read_word(cpu_get_pc(&space.device()));
105   UINT16 result = space.read_word(space.device().safe_pc());
106106   m_open_bus_recurse = false;
107107   return result;
108108}
trunk/src/mame/machine/buggychl.c
r17788r17789
4141static READ8_DEVICE_HANDLER( buggychl_68705_port_a_r )
4242{
4343   buggychl_mcu_state *state = get_safe_token(device);
44   //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(state->m_mcu), state->m_port_a_in);
44   //logerror("%04x: 68705 port A read %02x\n", state->m_mcu->safe_pc(), state->m_port_a_in);
4545   return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a);
4646}
4747
4848static WRITE8_DEVICE_HANDLER( buggychl_68705_port_a_w )
4949{
5050   buggychl_mcu_state *state = get_safe_token(device);
51   //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(state->m_mcu), data);
51   //logerror("%04x: 68705 port A write %02x\n", state->m_mcu->safe_pc(), data);
5252   state->m_port_a_out = data;
5353}
5454
r17788r17789
8888static WRITE8_DEVICE_HANDLER( buggychl_68705_port_b_w )
8989{
9090   buggychl_mcu_state *state = get_safe_token(device);
91   logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(state->m_mcu), data);
91   logerror("%04x: 68705 port B write %02x\n", state->m_mcu->safe_pc(), data);
9292
9393   if ((state->m_ddr_b & 0x02) && (~data & 0x02) && (state->m_port_b_out & 0x02))
9494   {
r17788r17789
132132      state->m_port_c_in |= 0x01;
133133   if (!state->m_mcu_sent)
134134      state->m_port_c_in |= 0x02;
135   logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(state->m_mcu), state->m_port_c_in);
135   logerror("%04x: 68705 port C read %02x\n", state->m_mcu->safe_pc(), state->m_port_c_in);
136136   return (state->m_port_c_out & state->m_ddr_c) | (state->m_port_c_in & ~state->m_ddr_c);
137137}
138138
139139static WRITE8_DEVICE_HANDLER( buggychl_68705_port_c_w )
140140{
141141   buggychl_mcu_state *state = get_safe_token(device);
142   logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(state->m_mcu), data);
142   logerror("%04x: 68705 port C write %02x\n", state->m_mcu->safe_pc(), data);
143143   state->m_port_c_out = data;
144144}
145145
r17788r17789
153153WRITE8_DEVICE_HANDLER( buggychl_mcu_w )
154154{
155155   buggychl_mcu_state *state = get_safe_token(device);
156   logerror("%04x: mcu_w %02x\n", cpu_get_pc(state->m_mcu), data);
156   logerror("%04x: mcu_w %02x\n", state->m_mcu->safe_pc(), data);
157157   state->m_from_main = data;
158158   state->m_main_sent = 1;
159159   device_set_input_line(state->m_mcu, 0, ASSERT_LINE);
r17788r17789
162162READ8_DEVICE_HANDLER( buggychl_mcu_r )
163163{
164164   buggychl_mcu_state *state = get_safe_token(device);
165   logerror("%04x: mcu_r %02x\n", cpu_get_pc(state->m_mcu), state->m_from_mcu);
165   logerror("%04x: mcu_r %02x\n", state->m_mcu->safe_pc(), state->m_from_mcu);
166166   state->m_mcu_sent = 0;
167167   return state->m_from_mcu;
168168}
r17788r17789
174174
175175   /* bit 0 = when 1, mcu is ready to receive data from main cpu */
176176   /* bit 1 = when 1, mcu has sent data to the main cpu */
177   //logerror("%04x: mcu_status_r\n",cpu_get_pc(state->m_mcu));
177   //logerror("%04x: mcu_status_r\n",state->m_mcu->safe_pc());
178178   if (!state->m_main_sent)
179179      res |= 0x01;
180180   if (state->m_mcu_sent)
trunk/src/mame/machine/n64.c
r17788r17789
263263         break;
264264
265265      default:
266         logerror("mi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&mem_map->device()));
266         logerror("mi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, mem_map->device().safe_pc());
267267         break;
268268   }
269269
r17788r17789
350350      }
351351
352352      default:
353         logerror("mi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
353         logerror("mi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
354354         break;
355355   }
356356}
r17788r17789
469469   //printf("rdram_reg_r %08x = %08x\n", offset * 4, rdram_regs[offset]); fflush(stdout);
470470   if(offset > 0x24/4)
471471   {
472      logerror("rdram_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu));
472      logerror("rdram_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc());
473473      return 0;
474474   }
475475   return rdram_regs[offset];
r17788r17789
480480   //printf("rdram_reg_w %08x %08x %08x\n", offset * 4, data, mem_mask); fflush(stdout);
481481   if(offset > 0x24/4)
482482   {
483      logerror("rdram_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
483      logerror("rdram_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
484484      return;
485485   }
486486   COMBINE_DATA(&rdram_regs[offset]);
r17788r17789
673673         break;
674674
675675        default:
676            logerror("sp_reg_r: %08X at %08X\n", offset, cpu_get_pc(maincpu));
676            logerror("sp_reg_r: %08X at %08X\n", offset, maincpu->safe_pc());
677677            break;
678678   }
679679
r17788r17789
868868            break;
869869
870870         default:
871            logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
871            logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
872872            break;
873873      }
874874   }
r17788r17789
888888                break;
889889
890890            default:
891                logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
891                logerror("sp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
892892                break;
893893      }
894894   }
r17788r17789
940940      }
941941
942942      default:
943         logerror("dp_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(device));
943         logerror("dp_reg_r: %08X, %08X at %08X\n", offset, mem_mask, device->safe_pc());
944944         break;
945945   }
946946
r17788r17789
984984      }
985985
986986      default:
987         logerror("dp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(device));
987         logerror("dp_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, device->safe_pc());
988988         break;
989989   }
990990}
r17788r17789
11151115         break;
11161116
11171117      default:
1118         logerror("vi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu));
1118         logerror("vi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc());
11191119         break;
11201120   }
11211121
r17788r17789
12051205        */
12061206
12071207      default:
1208         logerror("vi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
1208         logerror("vi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
12091209         break;
12101210   }
12111211}
r17788r17789
13541354         break;
13551355
13561356        default:
1357            logerror("ai_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu));
1357            logerror("ai_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc());
13581358            break;
13591359    }
13601360
r17788r17789
13961396            break;
13971397
13981398        default:
1399            logerror("ai_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
1399            logerror("ai_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
14001400            break;
14011401    }
14021402}
r17788r17789
15321532            break;
15331533
15341534      default:
1535         logerror("pi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu));
1535         logerror("pi_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc());
15361536         break;
15371537   }
15381538
r17788r17789
16351635            break;
16361636
16371637      default:
1638         logerror("pi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
1638         logerror("pi_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
16391639         break;
16401640   }
16411641}
r17788r17789
16471647   //printf("ri_reg_r %08x = %08x\n", offset * 4, ri_regs[offset]);
16481648   if(offset > 0x1c/4)
16491649   {
1650      logerror("ri_reg_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(maincpu));
1650      logerror("ri_reg_r: %08X, %08X at %08X\n", offset, mem_mask, maincpu->safe_pc());
16511651      return 0;
16521652   }
16531653   return ri_regs[offset];
r17788r17789
16581658   //printf("ri_reg_w %08x %08x %08x\n", offset * 4, data, mem_mask);
16591659   if(offset > 0x1c/4)
16601660   {
1661      logerror("ri_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(maincpu));
1661      logerror("ri_reg_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, maincpu->safe_pc());
16621662      return;
16631663   }
16641664   COMBINE_DATA(&ri_regs[offset]);
trunk/src/mame/machine/snes.c
r17788r17789
308308      return 0xff;
309309
310310   recurse = 1;
311   result = space->read_byte(cpu_get_pc(&space->device()) - 1); //LAST opcode that's fetched on the bus
311   result = space->read_byte(space->device().safe_pc() - 1); //LAST opcode that's fetched on the bus
312312   recurse = 0;
313313   return result;
314314}
r17788r17789
572572//      case 0x4101: //PC: a104 - a10e - a12a   //only nss_actr (DSW actually reads in word units ...)
573573
574574      default:
575//          mame_printf_debug("snes_r: offset = %x pc = %x\n",offset,cpu_get_pc(&space->device()));
575//          mame_printf_debug("snes_r: offset = %x pc = %x\n",offset,space->device().safe_pc());
576576// Added break; after commenting above line.  If uncommenting, drop the break;
577577                        break;
578578   }
r17788r17789
604604   // APU is mirrored from 2140 to 217f
605605   if (offset >= APU00 && offset < WMDATA)
606606   {
607//      printf("816: %02x to APU @ %d (PC=%06x)\n", data, offset & 3,cpu_get_pc(&space->device()));
607//      printf("816: %02x to APU @ %d (PC=%06x)\n", data, offset & 3,space->device().safe_pc());
608608      spc_port_in(state->m_spc700, offset & 0x3, data);
609609      space->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(20));
610610      return;
r17788r17789
875875      }
876876      else
877877      {
878         logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address);
878         logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",space->device().safe_pc(),address);
879879         value = snes_open_bus_r(space, 0);                        /* Reserved */
880880      }
881881   }
r17788r17789
934934      }
935935      else
936936      {
937         logerror( "(PC=%06x) snes_r_bank2: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address );
937         logerror( "(PC=%06x) snes_r_bank2: Unmapped external chip read: %04x\n",space->device().safe_pc(),address );
938938         value = snes_open_bus_r(space, 0);
939939      }
940940   }
r17788r17789
10251025         value = (address >= 0x4000) ? dsp_get_sr() : dsp_get_dr();
10261026      else
10271027      {
1028         logerror("(PC=%06x) snes_r_bank4: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address);
1028         logerror("(PC=%06x) snes_r_bank4: Unmapped external chip read: %04x\n",space->device().safe_pc(),address);
10291029         value = snes_open_bus_r(space, 0);                     /* Reserved */
10301030      }
10311031   }
r17788r17789
10581058      }
10591059      else
10601060      {
1061         logerror("(PC=%06x) snes_r_bank5: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address);
1061         logerror("(PC=%06x) snes_r_bank5: Unmapped external chip read: %04x\n",space->device().safe_pc(),address);
10621062         value = snes_open_bus_r(space, 0);                        /* Reserved */
10631063      }
10641064   }
r17788r17789
10941094         }
10951095         else                  /* Area 0x6000-0x8000 with offset < 0x300000 is reserved */
10961096         {
1097            logerror("(PC=%06x) snes_r_bank6: Unmapped external chip read: %04x\n",cpu_get_pc(&space->device()),address);
1097            logerror("(PC=%06x) snes_r_bank6: Unmapped external chip read: %04x\n",space->device().safe_pc(),address);
10981098            value = snes_open_bus_r(space, 0);
10991099         }
11001100      }
r17788r17789
12211221      else
12221222         dsp_set_sr(data);
12231223   else
1224      logerror( "(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset );
1224      logerror( "(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset );
12251225}
12261226
12271227/* 0x300000 - 0x3fffff */
r17788r17789
12781278      else
12791279         dsp_set_sr(data);
12801280   else
1281      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x300000);
1281      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x300000);
12821282}
12831283
12841284/* 0x600000 - 0x6fffff */
r17788r17789
13071307   else if (state->m_cart[0].mode & 5)               /* Mode 20 & 22 */
13081308   {
13091309      if (address >= 0x8000)
1310         logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x600000);
1310         logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x600000);
13111311      else if (state->m_has_addon_chip == HAS_DSP1)
13121312         dsp_set_dr(data);
13131313      else
13141314         logerror("snes_w_bank4: Attempt to write to reserved address: %X = %02x\n", offset + 0x600000, data);
13151315   }
13161316   else if (state->m_cart[0].mode & 0x0a)
1317      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x600000);
1317      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x600000);
13181318}
13191319
13201320/* 0x700000 - 0x7dffff */
r17788r17789
13361336         logerror("snes_w_bank5: Attempt to write to reserved address: %X = %02x\n", offset + 0x700000, data);
13371337   }
13381338   else if (state->m_cart[0].mode & 0x0a)
1339      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x700000);
1339      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x700000);
13401340}
13411341
13421342
r17788r17789
13871387      else
13881388         dsp_set_sr(data);
13891389   else
1390      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0x800000);
1390      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0x800000);
13911391}
13921392
13931393
r17788r17789
14051405         snes_ram[0xe00000 + offset] = data;      // SFX RAM
14061406      }
14071407      else
1408         logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0xc00000);
1408         logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0xc00000);
14091409   }
14101410   else if (state->m_has_addon_chip == HAS_ST010 || state->m_has_addon_chip == HAS_ST011)
14111411   {
r17788r17789
14341434            snes_w_bank4(space, offset - 0x200000, data);
14351435      }
14361436      else
1437         logerror("(PC=%06x) snes_w_bank7: Attempt to write to ROM address: %X = %02x\n",cpu_get_pc(&space->device()),offset + 0xc00000, data);
1437         logerror("(PC=%06x) snes_w_bank7: Attempt to write to ROM address: %X = %02x\n",space->device().safe_pc(),offset + 0xc00000, data);
14381438   }
14391439   else if (state->m_cart[0].mode & 0x0a)
1440      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(&space->device()),offset + 0xc00000);
1440      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space->device().safe_pc(),offset + 0xc00000);
14411441}
14421442
14431443
trunk/src/mame/machine/atarigen.c
r17788r17789
463463   address &= ~m_slapstic_mirror;
464464   if (address >= m_slapstic_base && address < m_slapstic_base + 0x8000)
465465   {
466      offs_t pc = cpu_get_previouspc(&direct.space().device());
466      offs_t pc = direct.space().device().safe_pcbase();
467467      if (pc != m_slapstic_last_pc || address != m_slapstic_last_address)
468468      {
469469         m_slapstic_last_pc = pc;
trunk/src/mame/machine/gaelco2.c
r17788r17789
236236      }
237237   }
238238   else
239      logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
239      logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
240240}
241241
242242
r17788r17789
252252      }
253253   }
254254   else
255      logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
255      logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
256256}
257257
258258/***************************************************************************
r17788r17789
300300
301301READ16_MEMBER(gaelco2_state::snowboar_protection_r)
302302{
303   logerror("%06x: protection read from %04x\n", cpu_get_pc(&space.device()), offset*2);
303   logerror("%06x: protection read from %04x\n", space.device().safe_pc(), offset*2);
304304   return 0x0000;
305305}
306306
307307WRITE16_MEMBER(gaelco2_state::snowboar_protection_w)
308308{
309309   COMBINE_DATA(&m_snowboar_protection[offset]);
310   logerror("%06x: protection write %04x to %04x\n", cpu_get_pc(&space.device()), data, offset*2);
310   logerror("%06x: protection write %04x to %04x\n", space.device().safe_pc(), data, offset*2);
311311
312312}
trunk/src/mame/machine/pgmprot6.c
r17788r17789
125125
126126      }
127127   }
128   logerror("%06X: ASIC25 R CMD %X  VAL %X\n", cpu_get_pc(&space->device()), state->m_kb_cmd, res);
128   logerror("%06X: ASIC25 R CMD %X  VAL %X\n", space->device().safe_pc(), state->m_kb_cmd, res);
129129   return res;
130130}
131131
r17788r17789
136136      state->m_kb_cmd = data;
137137   else //offset==2
138138   {
139      logerror("%06X: ASIC25 W CMD %X  VAL %X\n",cpu_get_pc(&space->device()), state->m_kb_cmd, data);
139      logerror("%06X: ASIC25 W CMD %X  VAL %X\n",space->device().safe_pc(), state->m_kb_cmd, data);
140140      if (state->m_kb_cmd == 0)
141141         state->m_kb_reg = data;
142142      else if(state->m_kb_cmd == 2)   //a bitswap=
r17788r17789
185185
186186static READ16_HANDLER( olds_prot_swap_r )
187187{
188   if (cpu_get_pc(&space->device()) < 0x100000)      //bios
188   if (space->device().safe_pc() < 0x100000)      //bios
189189      return pgm_mainram[0x178f4 / 2];
190190   else                  //game
191191      return pgm_mainram[0x178d8 / 2];
trunk/src/mame/machine/mcr.c
r17788r17789
246246   /* bit 1 enables (1) LD left channel audio */
247247   /* bit 0 enables (1) LD video if PIX SW == 1 */
248248   if (data != 0)
249      logerror("%04X:mcr_ipu_laserdisk_w(%d) = %02X\n", cpu_get_pc(&space.device()), offset, data);
249      logerror("%04X:mcr_ipu_laserdisk_w(%d) = %02X\n", space.device().safe_pc(), offset, data);
250250}
251251
252252
trunk/src/mame/machine/arkanoid.c
r17788r17789
173173*/
174174
175175
176#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);
177#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);
178#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);
179#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);
176#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);
177#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);
178#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);
179#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);
180180
181181
182182/* Kludge for some bootlegs that read this address */
r17788r17789
214214         LOG_F000_R
215215         break;
216216      default:
217         logerror("%04x: arkanoid_bootleg_f000_r - cmd = %02x - unknown bootleg !\n", cpu_get_pc(&space.device()), m_bootleg_cmd);
217         logerror("%04x: arkanoid_bootleg_f000_r - cmd = %02x - unknown bootleg !\n", space.device().safe_pc(), m_bootleg_cmd);
218218         break;
219219   }
220220
r17788r17789
301301         LOG_F002_R
302302         break;
303303      default:
304         logerror("%04x: arkanoid_bootleg_f002_r - cmd = %02x - unknown bootleg !\n", cpu_get_pc(&space.device()), m_bootleg_cmd);
304         logerror("%04x: arkanoid_bootleg_f002_r - cmd = %02x - unknown bootleg !\n", space.device().safe_pc(), m_bootleg_cmd);
305305         break;
306306   }
307307
r17788r17789
320320         switch (data)
321321         {
322322            case 0x36:  /* unneeded value : no call 0x2050, unused A and overwritten HL (0x0313 -> 0x0340) */
323               if (cpu_get_pc(&space.device()) == 0x7c47)
323               if (space.device().safe_pc() == 0x7c47)
324324                  m_bootleg_cmd = 0x00;
325325               break;
326326            case 0x38:  /* unneeded value : no call 0x2050, unused A and fixed HL (0x7bd5) */
327               if (cpu_get_pc(&space.device()) == 0x7b87)
327               if (space.device().safe_pc() == 0x7b87)
328328                  m_bootleg_cmd = 0x00;
329329               break;
330330            case 0x8a:  /* unneeded value : no call 0x2050, unused A and overwritten HL (0x7b77 -> 0x7c1c) */
331               if (cpu_get_pc(&space.device()) == 0x9661)
331               if (space.device().safe_pc() == 0x9661)
332332                  m_bootleg_cmd = 0x00;
333333               break;
334334            case 0xe3:  /* unneeded value : call 0x2050 but fixed A (0x00) and fixed HL (0xed83) */
335               if (cpu_get_pc(&space.device()) == 0x67e3)
335               if (space.device().safe_pc() == 0x67e3)
336336                  m_bootleg_cmd = 0x00;
337337               break;
338338            case 0xf7:  /* unneeded value : 3 * 'NOP' at 0x034f + 2 * 'NOP' at 0x35b */
339               if (cpu_get_pc(&space.device()) == 0x0349)
339               if (space.device().safe_pc() == 0x0349)
340340                  m_bootleg_cmd = 0x00;
341341               break;
342342            case 0xff:  /* unneeded value : no call 0x2050, unused A and overwritten HL (0x7c4f -> 0x7d31) */
343               if (cpu_get_pc(&space.device()) == 0x9670)
343               if (space.device().safe_pc() == 0x9670)
344344                  m_bootleg_cmd = 0x00;
345345               break;
346346            default:
r17788r17789
353353         switch (data)
354354         {
355355            case 0x36:  /* unneeded value : call 0x2050 but fixed A (0x2d) */
356               if (cpu_get_pc(&space.device()) == 0x7c4c)
356               if (space.device().safe_pc() == 0x7c4c)
357357                  m_bootleg_cmd = 0x00;
358358               break;
359359            case 0x38:  /* unneeded value : call 0x2050 but fixed A (0xf3) */
360               if (cpu_get_pc(&space.device()) == 0x7b87)
360               if (space.device().safe_pc() == 0x7b87)
361361                  m_bootleg_cmd = 0x00;
362362               break;
363363            case 0x88:  /* unneeded value : no read back */
364               if (cpu_get_pc(&space.device()) == 0x67e3)
364               if (space.device().safe_pc() == 0x67e3)
365365                  m_bootleg_cmd = 0x00;
366               if (cpu_get_pc(&space.device()) == 0x7c47)
366               if (space.device().safe_pc() == 0x7c47)
367367                  m_bootleg_cmd = 0x00;
368368               break;
369369            case 0x89:  /* unneeded value : no read back */
370               if (cpu_get_pc(&space.device()) == 0x67e5)
370               if (space.device().safe_pc() == 0x67e5)
371371                  m_bootleg_cmd = 0x00;
372372               break;
373373            case 0x8a:  /* unneeded value : call 0x2050 but fixed A (0xa5) */
374               if (cpu_get_pc(&space.device()) == 0x9661)
374               if (space.device().safe_pc() == 0x9661)
375375                  m_bootleg_cmd = 0x00;
376376               break;
377377            case 0xc0:  /* unneeded value : no read back */
378               if (cpu_get_pc(&space.device()) == 0x67e7)
378               if (space.device().safe_pc() == 0x67e7)
379379                  m_bootleg_cmd = 0x00;
380380               break;
381381            case 0xe3:  /* unneeded value : call 0x2050 but fixed A (0x61) */
382               if (cpu_get_pc(&space.device()) == 0x67e9)
382               if (space.device().safe_pc() == 0x67e9)
383383                  m_bootleg_cmd = 0x00;
384384               break;
385385            case 0xff:  /* unneeded value : call 0x2050 but fixed A (0xe2) */
386               if (cpu_get_pc(&space.device()) == 0x9670)
386               if (space.device().safe_pc() == 0x9670)
387387                  m_bootleg_cmd = 0x00;
388388               break;
389389            default:
r17788r17789
396396         switch (data)
397397         {
398398            case 0x05:  /* Check 1 */
399               if (cpu_get_pc(&space.device()) == 0x0363)
399               if (space.device().safe_pc() == 0x0363)
400400                  m_bootleg_cmd = 0x05;
401401               break;
402402            case 0x0a:  /* Check 2 */
403               if (cpu_get_pc(&space.device()) == 0x0372)
403               if (space.device().safe_pc() == 0x0372)
404404                  m_bootleg_cmd = 0x0a;
405405               break;
406406            default:
r17788r17789
413413         switch (data)
414414         {
415415            case 0x36:  /* unneeded value : call 0x2050 but fixed A (0x2d) */
416               if (cpu_get_pc(&space.device()) == 0x7c4c)
416               if (space.device().safe_pc() == 0x7c4c)
417417                  m_bootleg_cmd = 0x00;
418418               break;
419419            case 0x38:  /* unneeded value : call 0x2050 but fixed A (0xf3) */
420               if (cpu_get_pc(&space.device()) == 0x7b87)
420               if (space.device().safe_pc() == 0x7b87)
421421                  m_bootleg_cmd = 0x00;
422422               break;
423423            case 0x88:  /* unneeded value : no read back */
424               if (cpu_get_pc(&space.device()) == 0x67e3)
424               if (space.device().safe_pc() == 0x67e3)
425425                  m_bootleg_cmd = 0x00;
426               if (cpu_get_pc(&space.device()) == 0x7c47)
426               if (space.device().safe_pc() == 0x7c47)
427427                  m_bootleg_cmd = 0x00;
428428               break;
429429            case 0x89:  /* unneeded value : no read back */
430               if (cpu_get_pc(&space.device()) == 0x67e5)
430               if (space.device().safe_pc() == 0x67e5)
431431                  m_bootleg_cmd = 0x00;
432432               break;
433433            case 0x8a:  /* unneeded value : call 0x2050 but unused HL and fixed DE (0x7c1c) */
434               if (cpu_get_pc(&space.device()) == 0x9661)
434               if (space.device().safe_pc() == 0x9661)
435435                  m_bootleg_cmd = 0x00;
436436               break;
437437            case 0xc0:  /* unneeded value : no read back */
438               if (cpu_get_pc(&space.device()) == 0x67e7)
438               if (space.device().safe_pc() == 0x67e7)
439439                  m_bootleg_cmd = 0x00;
440440               break;
441441            case 0xe3:  /* unneeded value : call 0x2050 but fixed A (0x61) */
442               if (cpu_get_pc(&space.device()) == 0x67e9)
442               if (space.device().safe_pc() == 0x67e9)
443443                  m_bootleg_cmd = 0x00;
444444               break;
445445            case 0xf7:  /* unneeded value : call 0x2050 but never called (check code at 0x0340) */
446               if (cpu_get_pc(&space.device()) == 0x0349)
446               if (space.device().safe_pc() == 0x0349)
447447                  m_bootleg_cmd = 0x00;
448448               break;
449449            case 0xff:  /* unneeded value : no call 0x2050, unused A and fixed HL (0x7d31) */
450               if (cpu_get_pc(&space.device()) == 0x9670)
450               if (space.device().safe_pc() == 0x9670)
451451                  m_bootleg_cmd = 0x00;
452452               break;
453453            default:
r17788r17789
460460         switch (data)
461461         {
462462            case 0x36:  /* unneeded value : call 0x2050 but fixed A (0x2d) */
463               if (cpu_get_pc(&space.device()) == 0x7c4c)
463               if (space.device().safe_pc() == 0x7c4c)
464464                  m_bootleg_cmd = 0x00;
465465               break;
466466            case 0x38:  /* unneeded value : call 0x2050 but fixed A (0xf3) */
467               if (cpu_get_pc(&space.device()) == 0x7b87)
467               if (space.device().safe_pc() == 0x7b87)
468468                  m_bootleg_cmd = 0x00;
469469               break;
470470            case 0x88:  /* unneeded value : no read back */
471               if (cpu_get_pc(&space.device()) == 0x67e3)
471               if (space.device().safe_pc() == 0x67e3)
472472                  m_bootleg_cmd = 0x00;
473               if (cpu_get_pc(&space.device()) == 0x7c47)
473               if (space.device().safe_pc() == 0x7c47)
474474                  m_bootleg_cmd = 0x00;
475475            case 0x89:  /* unneeded value : no read back */
476               if (cpu_get_pc(&space.device()) == 0x67e5)
476               if (space.device().safe_pc() == 0x67e5)
477477                  m_bootleg_cmd = 0x00;
478478               break;
479479            case 0x8a:  /* call 0x2050 with A read from 0xf002 and wrong HL */
480               if (cpu_get_pc(&space.device()) == 0x9661)
480               if (space.device().safe_pc() == 0x9661)
481481                  m_bootleg_cmd = data;
482482               break;
483483            case 0xc0:  /* unneeded value : no read back */
484               if (cpu_get_pc(&space.device()) == 0x67e7)
484               if (space.device().safe_pc() == 0x67e7)
485485                  m_bootleg_cmd = 0x00;
486486               break;
487487            case 0xe3:  /* unneeded value : call 0x2050 but fixed A (0x61) */
488               if (cpu_get_pc(&space.device()) == 0x67e9)
488               if (space.device().safe_pc() == 0x67e9)
489489                  m_bootleg_cmd = 0x00;
490490               break;
491491            case 0xf7:  /* unneeded value : 3 * 'NOP' at 0x034f + 'JR NZ,$035D' at 0x35b */
492               if (cpu_get_pc(&space.device()) == 0x0349)
492               if (space.device().safe_pc() == 0x0349)
493493                  m_bootleg_cmd = 0x00;
494494               break;
495495            case 0xff:  /* call 0x2050 with A read from 0xf002 and wrong HL */
496               if (cpu_get_pc(&space.device()) == 0x9670)
496               if (space.device().safe_pc() == 0x9670)
497497                  m_bootleg_cmd = data;
498498               break;
499499            default:
r17788r17789
506506         switch (data)
507507         {
508508            case 0x24:  /* A read from 0xf002 (expected to be 0x9b) */
509               if (cpu_get_pc(&space.device()) == 0xbd7a)
509               if (space.device().safe_pc() == 0xbd7a)
510510                  m_bootleg_cmd = data;
511511               break;
512512            case 0x36:  /* call 0x2050 with A read from 0xf002 and wrong HL */
513               if (cpu_get_pc(&space.device()) == 0x7c4c)
513               if (space.device().safe_pc() == 0x7c4c)
514514                  m_bootleg_cmd = data;
515515               break;
516516            case 0x38:  /* call 0x2050 with A read from 0xf002 and wrong HL */
517               if (cpu_get_pc(&space.device()) == 0x7b87)
517               if (space.device().safe_pc() == 0x7b87)
518518                  m_bootleg_cmd = data;
519519               break;
520520            case 0x88:  /* unneeded value : no read back */
521               if (cpu_get_pc(&space.device()) == 0x67e3)
521               if (space.device().safe_pc() == 0x67e3)
522522                  m_bootleg_cmd = 0x00;
523               if (cpu_get_pc(&space.device()) == 0x7c47)
523               if (space.device().safe_pc() == 0x7c47)
524524                  m_bootleg_cmd = 0x00;
525525            case 0x89:  /* unneeded value : no read back */
526               if (cpu_get_pc(&space.device()) == 0x67e5)
526               if (space.device().safe_pc() == 0x67e5)
527527                  m_bootleg_cmd = 0x00;
528528               break;
529529            case 0x8a:  /* call 0x2050 with A read from 0xf002 and wrong HL */
530               if (cpu_get_pc(&space.device()) == 0x9661)
530               if (space.device().safe_pc() == 0x9661)
531531                  m_bootleg_cmd = data;
532532               break;
533533            case 0xc0:  /* unneeded value : no read back */
534               if (cpu_get_pc(&space.device()) == 0x67e7)
534               if (space.device().safe_pc() == 0x67e7)
535535                  m_bootleg_cmd = 0x00;
536536               break;
537537            case 0xc3:  /* A read from 0xf002 (expected to be 0x1d) */
538               if (cpu_get_pc(&space.device()) == 0xbd8a)
538               if (space.device().safe_pc() == 0xbd8a)
539539                  m_bootleg_cmd = data;
540540               break;
541541            case 0xe3:  /* call 0x2050 with A read from 0xf002 and wrong HL */
542               if (cpu_get_pc(&space.device()) == 0x67e9)
542               if (space.device().safe_pc() == 0x67e9)
543543                  m_bootleg_cmd = data;
544544               break;
545545            case 0xf7:  /* call 0x2050 with A read from 0xf002 and wrong HL */
546               if (cpu_get_pc(&space.device()) == 0x0349)
546               if (space.device().safe_pc() == 0x0349)
547547                  m_bootleg_cmd = data;
548548               break;
549549            case 0xff:  /* call 0x2050 with A read from 0xf002 and wrong HL */
550               if (cpu_get_pc(&space.device()) == 0x9670)
550               if (space.device().safe_pc() == 0x9670)
551551                  m_bootleg_cmd = data;
552552               break;
553553            default:
r17788r17789
558558         break;
559559
560560      default:
561         logerror("%04x: arkanoid_bootleg_d018_w - data = %02x - unknown bootleg !\n", cpu_get_pc(&space.device()), data);
561         logerror("%04x: arkanoid_bootleg_d018_w - data = %02x - unknown bootleg !\n", space.device().safe_pc(), data);
562562         break;
563563   }
564564}
r17788r17789
625625         arkanoid_bootleg_d008_bit[2] = 0;  /* untested bit */
626626         arkanoid_bootleg_d008_bit[3] = 0;  /* untested bit */
627627         arkanoid_bootleg_d008_bit[5] = 0;  /* untested bit */
628         logerror("%04x: arkanoid_bootleg_d008_r - unknown bootleg !\n",cpu_get_pc(&space.device()));
628         logerror("%04x: arkanoid_bootleg_d008_r - unknown bootleg !\n",space.device().safe_pc());
629629         break;
630630   }
631631
trunk/src/mame/machine/archimds.c
r17788r17789
473473static READ32_HANDLER( ioc_ctrl_r )
474474{
475475   if(IOC_LOG)
476   logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( &space->device() ),offset & 0x1f);
476   logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], space->device() .safe_pc( ),offset & 0x1f);
477477
478478   switch (offset & 0x1f)
479479   {
r17788r17789
535535      case T3_LATCH_HI: return (ioc_timerout[3]>>8)&0xff;
536536      default:
537537         if(!IOC_LOG)
538            logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( &space->device() ),offset & 0x1f);
538            logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], space->device() .safe_pc( ),offset & 0x1f);
539539         break;
540540   }
541541
r17788r17789
546546static WRITE32_HANDLER( ioc_ctrl_w )
547547{
548548   if(IOC_LOG)
549   logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( &space->device() ));
549   logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], space->device() .safe_pc( ));
550550
551551   switch (offset&0x1f)
552552   {
r17788r17789
654654
655655      default:
656656         if(!IOC_LOG)
657            logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( &space->device() ));
657            logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], space->device() .safe_pc( ));
658658
659659         ioc_regs[offset&0x1f] = data & 0xff;
660660         break;
r17788r17789
778778   }
779779
780780
781   logerror("(PC=%08x) I/O: W %x @ %x (mask %08x)\n", cpu_get_pc(&space->device()), data, (offset*4)+0x3000000, mem_mask);
781   logerror("(PC=%08x) I/O: W %x @ %x (mask %08x)\n", space->device().safe_pc(), data, (offset*4)+0x3000000, mem_mask);
782782}
783783
784784READ32_HANDLER(archimedes_vidc_r)
r17788r17789
865865      r = (val & 0x000f) >> 0;
866866
867867      if(reg == 0x40 && val & 0xfff)
868         logerror("WARNING: border color write here (PC=%08x)!\n",cpu_get_pc(&space->device()));
868         logerror("WARNING: border color write here (PC=%08x)!\n",space->device().safe_pc());
869869
870870      palette_set_color_rgb(space->machine(), reg >> 2, pal4bit(r), pal4bit(g), pal4bit(b) );
871871
r17788r17789
982982         case 7:   /* Control */
983983            memc_pagesize = ((data>>2) & 3);
984984
985            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");
985            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");
986986
987987            video_dma_on = ((data>>10)&1);
988988            audio_dma_on = ((data>>11)&1);
r17788r17789
10871087   // now go ahead and set the mapping in the page table
10881088   memc_pages[log] = phys + (memc*0x80);
10891089
1090//  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);
1090//  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);
10911091}
10921092
trunk/src/mame/machine/galaxold.c
r17788r17789
132132#ifdef UNUSED_FUNCTION
133133READ8_MEMBER(galaxold_state::checkmaj_protection_r)
134134{
135   switch (cpu_get_pc(&space.device()))
135   switch (space.device().safe_pc())
136136   {
137137   case 0x0f15:  return 0xf5;
138138   case 0x0f8f:  return 0x7c;
r17788r17789
141141   case 0x10f1:  return 0xaa;
142142   case 0x1402:  return 0xaa;
143143   default:
144      logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space.device()));
144      logerror("Unknown protection read. PC=%04X\n",space.device().safe_pc());
145145   }
146146
147147   return 0;
r17788r17789
225225
226226READ8_MEMBER(galaxold_state::scramblb_protection_1_r)
227227{
228   switch (cpu_get_pc(&space.device()))
228   switch (space.device().safe_pc())
229229   {
230230   case 0x01da: return 0x80;
231231   case 0x01e4: return 0x00;
232232   default:
233      logerror("%04x: read protection 1\n",cpu_get_pc(&space.device()));
233      logerror("%04x: read protection 1\n",space.device().safe_pc());
234234      return 0;
235235   }
236236}
237237
238238READ8_MEMBER(galaxold_state::scramblb_protection_2_r)
239239{
240   switch (cpu_get_pc(&space.device()))
240   switch (space.device().safe_pc())
241241   {
242242   case 0x01ca: return 0x90;
243243   default:
244      logerror("%04x: read protection 2\n",cpu_get_pc(&space.device()));
244      logerror("%04x: read protection 2\n",space.device().safe_pc());
245245      return 0;
246246   }
247247}
trunk/src/mame/machine/gaelcrpt.c
r17788r17789
124124{
125125   static int lastpc, lastoffset, lastencword, lastdecword;
126126
127   int thispc = cpu_get_pc(&space->device());
127   int thispc = space->device().safe_pc();
128128//  int savedata = data;
129129
130130   /* check if 2nd half of 32 bit */
trunk/src/mame/machine/dec0.c
r17788r17789
2828         return ioport("DSW")->read();
2929
3030      case 8: /* Intel 8751 mc, Bad Dudes & Heavy Barrel only */
31         //logerror("CPU #0 PC %06x: warning - read i8751 %06x - %04x\n", cpu_get_pc(&space.device()), 0x30c000+offset, m_i8751_return);
31         //logerror("CPU #0 PC %06x: warning - read i8751 %06x - %04x\n", space.device().safe_pc(), 0x30c000+offset, m_i8751_return);
3232         return m_i8751_return;
3333   }
3434
35   logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", cpu_get_pc(&space.device()), 0x30c000+offset);
35   logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", space.device().safe_pc(), 0x30c000+offset);
3636   return ~0;
3737}
3838
r17788r17789
8080         return 0;   /* ?? watchdog ?? */
8181   }
8282
83   logerror("PC %06x unknown control read at %02x\n", cpu_get_pc(&space.device()), 0x180000+offset);
83   logerror("PC %06x unknown control read at %02x\n", space.device().safe_pc(), 0x180000+offset);
8484   return ~0;
8585}
8686
r17788r17789
331331
332332READ16_MEMBER(dec0_state::robocop_68000_share_r)
333333{
334//logerror("%08x: Share read %04x\n",cpu_get_pc(&space.device()),offset);
334//logerror("%08x: Share read %04x\n",space.device().safe_pc(),offset);
335335
336336   return m_robocop_shared_ram[offset];
337337}
338338
339339WRITE16_MEMBER(dec0_state::robocop_68000_share_w)
340340{
341//  logerror("%08x: Share write %04x %04x\n",cpu_get_pc(&space.device()),offset,data);
341//  logerror("%08x: Share write %04x %04x\n",space.device().safe_pc(),offset,data);
342342
343343   m_robocop_shared_ram[offset]=data&0xff;
344344
trunk/src/mame/machine/lsasquad.c
r17788r17789
3939   m_sound_pending |= 0x01;
4040   m_sound_cmd = data;
4141
42   //logerror("%04x: sound cmd %02x\n", cpu_get_pc(&space.device()), data);
42   //logerror("%04x: sound cmd %02x\n", space.device().safe_pc(), data);
4343   machine().scheduler().synchronize(FUNC(nmi_callback), data);
4444}
4545
4646READ8_MEMBER(lsasquad_state::lsasquad_sh_sound_command_r)
4747{
4848   m_sound_pending &= ~0x01;
49   //logerror("%04x: read sound cmd %02x\n", cpu_get_pc(&space.device()), m_sound_cmd);
49   //logerror("%04x: read sound cmd %02x\n", space.device().safe_pc(), m_sound_cmd);
5050   return m_sound_cmd;
5151}
5252
5353WRITE8_MEMBER(lsasquad_state::lsasquad_sh_result_w)
5454{
5555   m_sound_pending |= 0x02;
56   //logerror("%04x: sound res %02x\n", cpu_get_pc(&space.device()), data);
56   //logerror("%04x: sound res %02x\n", space.device().safe_pc(), data);
5757   m_sound_result = data;
5858}
5959
6060READ8_MEMBER(lsasquad_state::lsasquad_sound_result_r)
6161{
6262   m_sound_pending &= ~0x02;
63   //logerror("%04x: read sound res %02x\n", cpu_get_pc(&space.device()), m_sound_result);
63   //logerror("%04x: read sound res %02x\n", space.device().safe_pc(), m_sound_result);
6464   return m_sound_result;
6565}
6666
r17788r17789
7777{
7878   m_sound_pending &= ~0x01;
7979   m_sound_pending |= 0x02;
80   //logerror("%04x: read sound cmd %02x\n", cpu_get_pc(&space.device()), m_sound_cmd);
80   //logerror("%04x: read sound cmd %02x\n", space.device().safe_pc(), m_sound_cmd);
8181   return m_sound_cmd;
8282}
8383
r17788r17789
101101READ8_MEMBER(lsasquad_state::lsasquad_68705_port_a_r)
102102{
103103
104   //logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(&space.device()), m_port_a_in);
104   //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in);
105105   return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
106106}
107107
108108WRITE8_MEMBER(lsasquad_state::lsasquad_68705_port_a_w)
109109{
110110
111   //logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(&space.device()), data);
111   //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data);
112112   m_port_a_out = data;
113113}
114114
r17788r17789
136136WRITE8_MEMBER(lsasquad_state::lsasquad_68705_port_b_w)
137137{
138138
139   //logerror("%04x: 68705 port B write %02x\n", cpu_get_pc(&space.device()), data);
139   //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data);
140140
141141   if ((m_ddr_b & 0x02) && (~data & 0x02) && (m_port_b_out & 0x02))
142142   {
r17788r17789
165165WRITE8_MEMBER(lsasquad_state::lsasquad_mcu_w)
166166{
167167
168   //logerror("%04x: mcu_w %02x\n", cpu_get_pc(&space.device()), data);
168   //logerror("%04x: mcu_w %02x\n", space.device().safe_pc(), data);
169169   m_from_main = data;
170170   m_main_sent = 1;
171171   device_set_input_line(m_mcu, 0, ASSERT_LINE);
r17788r17789
174174READ8_MEMBER(lsasquad_state::lsasquad_mcu_r)
175175{
176176
177   //logerror("%04x: mcu_r %02x\n", cpu_get_pc(&space.device()), m_from_mcu);
177   //logerror("%04x: mcu_r %02x\n", space.device().safe_pc(), m_from_mcu);
178178   m_mcu_sent = 0;
179179   return m_from_mcu;
180180}
r17788r17789
185185
186186   /* bit 0 = when 1, mcu is ready to receive data from main cpu */
187187   /* bit 1 = when 0, mcu has sent data to the main cpu */
188   //logerror("%04x: mcu_status_r\n",cpu_get_pc(&space.device()));
188   //logerror("%04x: mcu_status_r\n",space.device().safe_pc());
189189   if (!m_main_sent)
190190      res |= 0x01;
191191   if (!m_mcu_sent)
r17788r17789
200200
201201   /* bit 0 = when 1, mcu is ready to receive data from main cpu */
202202   /* bit 1 = when 0, mcu has sent data to the main cpu */
203   //logerror("%04x: mcu_status_r\n",cpu_get_pc(&space.device()));
203   //logerror("%04x: mcu_status_r\n",space.device().safe_pc());
204204   if (!m_main_sent)
205205      res |= 0x01;
206206   if (!m_mcu_sent)
trunk/src/mame/machine/cchip.c
r17788r17789
9090   }
9191   else
9292   {
93logerror("cchip1_w pc: %06x bank %02x offset %04x: %02x\n",cpu_get_pc(&space->device()),current_bank,offset,data);
93logerror("cchip1_w pc: %06x bank %02x offset %04x: %02x\n",space->device().safe_pc(),current_bank,offset,data);
9494   }
9595}
9696
trunk/src/mame/machine/namcond1.c
r17788r17789
7272
7373        default :
7474            logerror( "offset $%X accessed from $%X\n",
75                      offset<<1, cpu_get_pc(&space.device()) );
75                      offset<<1, space.device().safe_pc() );
7676            return( 0 );
7777    }
7878}
trunk/src/mame/machine/opwolf.c
r17788r17789
411411   m_cchip_ram[(m_current_bank * 0x400) + offset] = data & 0xff;
412412
413413//  if (offset != 0x64 && offset != 0x65 && offset != 0x66 && offset != 0x67 && offset != 0x68 && offset != 0x69)
414//      logerror("%08x:  opwolf c write %04x %04x\n", cpu_get_pc(&space.device()), offset, data);
414//      logerror("%08x:  opwolf c write %04x %04x\n", space.device().safe_pc(), offset, data);
415415
416416   if (m_current_bank == 0)
417417   {
r17788r17789
512512READ16_MEMBER(opwolf_state::opwolf_cchip_data_r)
513513{
514514
515//  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)
516//      logerror("%08x:  opwolf c read %04x (bank %04x)\n", cpu_get_pc(&space.device()), offset, m_current_bank);
515//  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)
516//      logerror("%08x:  opwolf c read %04x (bank %04x)\n", space.device().safe_pc(), offset, m_current_bank);
517517
518518   return m_cchip_ram[(m_current_bank * 0x400) + offset];
519519}
trunk/src/mame/machine/seicop.c
r17788r17789
16721672   {
16731673      default:
16741674      {
1675         logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", cpu_get_pc(&space->device()), retvalue, offset*2);
1675         logerror("%06x: COPX unhandled read returning %04x from offset %04x\n", space->device().safe_pc(), retvalue, offset*2);
16761676         return retvalue;
16771677      }
16781678
r17788r17789
16981698   {
16991699      default:
17001700      {
1701         logerror("%06x: COPX unhandled write data %04x at offset %04x\n", cpu_get_pc(&space->device()), data, offset*2);
1701         logerror("%06x: COPX unhandled write data %04x at offset %04x\n", space->device().safe_pc(), data, offset*2);
17021702         break;
17031703      }
17041704
r17788r17789
18521852         return cop_angle;
18531853
18541854      default:
1855         seibu_cop_log("%06x: COPX unhandled read returning %04x from offset %04x\n", cpu_get_pc(&space->device()), retvalue, offset*2);
1855         seibu_cop_log("%06x: COPX unhandled read returning %04x from offset %04x\n", space->device().safe_pc(), retvalue, offset*2);
18561856         return retvalue;
18571857   }
18581858}
r17788r17789
18701870   switch (offset)
18711871   {
18721872      default:
1873         seibu_cop_log("%06x: COPX unhandled write data %04x at offset %04x\n", cpu_get_pc(&space->device()), data, offset*2);
1873         seibu_cop_log("%06x: COPX unhandled write data %04x at offset %04x\n", space->device().safe_pc(), data, offset*2);
18741874         break;
18751875
18761876      /* Sprite DMA */
r17788r17789
19771977      case (0x078/2): /* DMA source address */
19781978      {
19791979         cop_dma_src[cop_dma_trigger] = data; // << 6 to get actual address
1980         //seibu_cop_log("%06x: COPX set layer clear address to %04x (actual %08x)\n", cpu_get_pc(&space->device()), data, data<<6);
1980         //seibu_cop_log("%06x: COPX set layer clear address to %04x (actual %08x)\n", space->device().safe_pc(), data, data<<6);
19811981         break;
19821982      }
19831983
19841984      case (0x07a/2): /* DMA length */
19851985      {
19861986         cop_dma_size[cop_dma_trigger] = data;
1987         //seibu_cop_log("%06x: COPX set layer clear length to %04x (actual %08x)\n", cpu_get_pc(&space->device()), data, data<<5);
1987         //seibu_cop_log("%06x: COPX set layer clear length to %04x (actual %08x)\n", space->device().safe_pc(), data, data<<5);
19881988         break;
19891989      }
19901990
19911991      case (0x07c/2): /* DMA destination */
19921992      {
19931993         cop_dma_dst[cop_dma_trigger] = data;
1994         //seibu_cop_log("%06x: COPX set layer clear value to %04x (actual %08x)\n", cpu_get_pc(&space->device()), data, data<<6);
1994         //seibu_cop_log("%06x: COPX set layer clear value to %04x (actual %08x)\n", space->device().safe_pc(), data, data<<6);
19951995         break;
19961996      }
19971997
19981998      case (0x07e/2): /* DMA parameter */
19991999      {
20002000         cop_dma_trigger = data;
2001         //seibu_cop_log("%06x: COPX set layer clear trigger? to %04x\n", cpu_get_pc(&space->device()), data);
2001         //seibu_cop_log("%06x: COPX set layer clear trigger? to %04x\n", space->device().safe_pc(), data);
20022002         if (data>=0x1ff)
20032003         {
20042004            seibu_cop_log("invalid DMA trigger!, >0x1ff\n");
r17788r17789
20512051         int command;
20522052
20532053         #if LOG_CMDS
2054         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]);
2054         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]);
20552055         #endif
20562056
20572057         command = -1;
r17788r17789
22982298         //(heatbrl)  | 9 | ffff | b080 | b40 bc0 bc2
22992299         if(COP_CMD(0xb40,0xbc0,0xbc2,0x000,0x000,0x000,0x000,0x000,u1,u2))
23002300         {
2301            UINT8 start_x,start_y,end_x,end_y;
2301            UINT8 start_x,/*start_y,*/end_x,end_y;
23022302            cop_collision_info[0].hitbox = space->read_word(cop_register[2]);
23032303            cop_collision_info[0].hitbox_y = space->read_word((cop_register[2]&0xffff0000)|(cop_collision_info[0].hitbox));
23042304            cop_collision_info[0].hitbox_x = space->read_word(((cop_register[2]&0xffff0000)|(cop_collision_info[0].hitbox))+2);
r17788r17789
23352335         //(heatbrl)  | 6 | ffff | b880 | b60 be0 be2
23362336         if(COP_CMD(0xb60,0xbe0,0xbe2,0x000,0x000,0x000,0x000,0x000,u1,u2))
23372337         {
2338            UINT8 start_x,start_y, end_x,end_y;
2338            UINT8 start_x,/*start_y,*/end_x,end_y;
23392339
23402340            /* Take hitbox param, TODO */
23412341            cop_collision_info[1].hitbox = space->read_word(cop_register[3]);
r17788r17789
24982498      /* DMA go register */
24992499      case (0x2fc/2):
25002500      {
2501         //seibu_cop_log("%06x: COPX execute current layer clear??? %04x\n", cpu_get_pc(&space->device()), data);
2501         //seibu_cop_log("%06x: COPX execute current layer clear??? %04x\n", space->device().safe_pc(), data);
25022502
25032503         if (cop_dma_trigger >= 0x80 && cop_dma_trigger <= 0x87)
25042504         {
trunk/src/mame/machine/slapstic.c
r17788r17789
876876   if (access_68k)
877877   {
878878      /* first verify that the prefetched PC matches the first alternate */
879      if (MATCHES_MASK_VALUE(cpu_get_pc(&space->device()) >> 1, slapstic.alt1))
879      if (MATCHES_MASK_VALUE(space->device().safe_pc() >> 1, slapstic.alt1))
880880      {
881881         /* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */
882         UINT16 opcode = space->direct().read_decrypted_word(cpu_get_previouspc(&space->device()) & 0xffffff);
882         UINT16 opcode = space->direct().read_decrypted_word(space->device().safe_pcbase() & 0xffffff);
883883         if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148)
884884         {
885885            /* fetch the value of the register for the second operand, and see */
trunk/src/mame/machine/ajax.c
r17788r17789
126126         break;
127127
128128      default:
129         logerror("%04x: (ls138_f10) read from an unknown address %02x\n",cpu_get_pc(&space.device()), offset);
129         logerror("%04x: (ls138_f10) read from an unknown address %02x\n",space.device().safe_pc(), offset);
130130   }
131131
132132   return data;
r17788r17789
159159         break;
160160
161161      default:
162         logerror("%04x: (ls138_f10) write %02x to an unknown address %02x\n", cpu_get_pc(&space.device()), data, offset);
162         logerror("%04x: (ls138_f10) write %02x to an unknown address %02x\n", space.device().safe_pc(), data, offset);
163163   }
164164}
165165
trunk/src/mame/machine/cdi070.c
r17788r17789
3434        va_start( v, s_fmt );
3535        vsprintf( buf, s_fmt, v );
3636        va_end( v );
37        logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
37        logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
3838    }
3939}
4040#else
trunk/src/mame/includes/megadriv.h
r17788r17789
135135   // jzth protection
136136   DECLARE_WRITE16_MEMBER( bl_710000_w )
137137   {
138      int pc = cpu_get_pc(&space.device());
138      int pc = space.device().safe_pc();
139139
140140      logerror("%06x writing to bl_710000_w %04x %04x\n", pc, data, mem_mask);
141141
r17788r17789
191191   DECLARE_READ16_MEMBER( bl_710000_r )
192192   {
193193      UINT16 ret;
194      int pc = cpu_get_pc(&space.device());
194      int pc = space.device().safe_pc();
195195      logerror("%06x reading from bl_710000_r\n", pc);
196196
197197      if (m_protcount==6) { ret = 0xe; }
trunk/src/mame/video/mitchell.c
r17788r17789
139139WRITE8_MEMBER(mitchell_state::pang_gfxctrl_w)
140140{
141141
142logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data);
142logerror("PC %04x: pang_gfxctrl_w %02x\n",space.device().safe_pc(),data);
143143{
144144#if 0
145145   char baf[40];
r17788r17789
178178WRITE8_MEMBER(mitchell_state::pangbl_gfxctrl_w)
179179{
180180
181logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data);
181logerror("PC %04x: pang_gfxctrl_w %02x\n",space.device().safe_pc(),data);
182182{
183183#if 0
184184   char baf[40];
r17788r17789
215215WRITE8_MEMBER(mitchell_state::mstworld_gfxctrl_w)
216216{
217217
218logerror("PC %04x: pang_gfxctrl_w %02x\n",cpu_get_pc(&space.device()),data);
218logerror("PC %04x: pang_gfxctrl_w %02x\n",space.device().safe_pc(),data);
219219{
220220   char baf[40];
221221   sprintf(baf,"%02x",data);
trunk/src/mame/video/mcd212.c
r17788r17789
3434        va_start( v, s_fmt );
3535        vsprintf( buf, s_fmt, v );
3636        va_end( v );
37        logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
37        logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
3838    }
3939}
4040#else
trunk/src/mame/video/stvvdp1.c
r17788r17789
168168{
169169   saturn_state *state = space->machine().driver_data<saturn_state>();
170170
171   //logerror ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset);
171   //logerror ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), space->device().safe_pc(), offset);
172172
173173   switch(offset)
174174   {
r17788r17789
194194
195195         return modr;
196196      default:
197         printf ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), cpu_get_pc(&space->device()), offset*2);
197         printf ("cpu %s (PC=%08X) VDP1: Read from Registers, Offset %04x\n", space->device().tag(), space->device().safe_pc(), offset*2);
198198         break;
199199   }
200200
r17788r17789
346346
347347//  if (((offset * 4) > 0xdf) && ((offset * 4) < 0x140))
348348//  {
349//      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);
349//      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);
350350//  }
351351
352352   data = state->m_vdp1_vram[offset];
trunk/src/mame/video/hexion.c
r17788r17789
8282if (data & 0x30)
8383   popmessage("bankswitch %02x",data&0xf0);
8484
85//logerror("%04x: bankswitch_w %02x\n",cpu_get_pc(&space.device()),data);
85//logerror("%04x: bankswitch_w %02x\n",space.device().safe_pc(),data);
8686}
8787
8888READ8_MEMBER(hexion_state::hexion_bankedram_r)
r17788r17789
101101   }
102102   else
103103   {
104//logerror("%04x: bankedram_r offset %04x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,m_bankctrl);
104//logerror("%04x: bankedram_r offset %04x, bankctrl = %02x\n",space.device().safe_pc(),offset,m_bankctrl);
105105      return 0;
106106   }
107107}
r17788r17789
110110{
111111   if (m_bankctrl == 3 && offset == 0 && (data & 0xfe) == 0)
112112   {
113//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl);
113//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl);
114114      m_rambank = data & 1;
115115   }
116116   else if (m_bankctrl == 0)
117117   {
118118      if (m_pmcbank)
119119      {
120//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl);
120//logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl);
121121         m_vram[m_rambank][offset] = data;
122122         m_bg_tilemap[m_rambank]->mark_tile_dirty(offset/4);
123123      }
124124      else
125         logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data);
125         logerror("%04x pmc internal ram %04x = %02x\n",space.device().safe_pc(),offset,data);
126126   }
127127   else if (m_bankctrl == 2 && offset < 0x800)
128128   {
129129      if (m_pmcbank)
130130      {
131//logerror("%04x: unkram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl);
131//logerror("%04x: unkram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl);
132132         m_unkram[offset] = data;
133133      }
134134      else
135         logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data);
135         logerror("%04x pmc internal ram %04x = %02x\n",space.device().safe_pc(),offset,data);
136136   }
137137   else
138logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",cpu_get_pc(&space.device()),offset,data,m_bankctrl);
138logerror("%04x: bankedram_w offset %04x, data %02x, bankctrl = %02x\n",space.device().safe_pc(),offset,data,m_bankctrl);
139139}
140140
141141WRITE8_MEMBER(hexion_state::hexion_bankctrl_w)
142142{
143//logerror("%04x: bankctrl_w %02x\n",cpu_get_pc(&space.device()),data);
143//logerror("%04x: bankctrl_w %02x\n",space.device().safe_pc(),data);
144144   m_bankctrl = data;
145145}
146146
147147WRITE8_MEMBER(hexion_state::hexion_gfxrom_select_w)
148148{
149//logerror("%04x: gfxrom_select_w %02x\n",cpu_get_pc(&space.device()),data);
149//logerror("%04x: gfxrom_select_w %02x\n",space.device().safe_pc(),data);
150150   m_gfxrom_select = data;
151151}
152152
trunk/src/mame/video/galpani2.c
r17788r17789
3232   {
3333      case 0x16:   return space->machine().rand() & 1;
3434      default:
35         logerror("CPU #0 PC %06X : Warning, bg8 #%d screen reg %04X read\n",cpu_get_pc(space->cpu),_n_,offset*2);
35         logerror("CPU #0 PC %06X : Warning, bg8 #%d screen reg %04X read\n",space->cpu->safe_pc(),_n_,offset*2);
3636   }
3737   return state->m_bg8_regs[_n_][offset];
3838}
trunk/src/mame/video/policetr.c
r17788r17789
143143{
144144   /* we assume 4-byte accesses */
145145   if (mem_mask)
146      logerror("%08X: policetr_video_w access with mask %08X\n", cpu_get_previouspc(&space.device()), mem_mask);
146      logerror("%08X: policetr_video_w access with mask %08X\n", space.device().safe_pcbase(), mem_mask);
147147
148148   /* 4 offsets */
149149   switch (offset)
r17788r17789
193193
194194            /* log anything else */
195195            default:
196               logerror("%08X: policetr_video_w(2) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch);
196               logerror("%08X: policetr_video_w(2) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch);
197197               break;
198198         }
199199         break;
r17788r17789
207207            /* latch 0x00 is unknown; 0, 1, and 2 get written into the upper 12 bits before rendering */
208208            case 0x00:
209209               if (data != (0 << 20) && data != (1 << 20) && data != (2 << 20))
210                  logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch);
210                  logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch);
211211               break;
212212
213213            /* latch 0x10 specifies destination bitmap X and Y offsets */
r17788r17789
219219            /* latch 0x20 is unknown; either 0xef or 0x100 is written every IRQ4 */
220220            case 0x20:
221221               if (data != (0x100 << 12) && data != (0xef << 12))
222                  logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch);
222                  logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch);
223223               break;
224224
225225            /* latch 0x40 is unknown; a 0 is written every IRQ4 */
226226            case 0x40:
227227               if (data != 0)
228                  logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch);
228                  logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch);
229229               break;
230230
231231            /* latch 0x50 clears IRQ4 */
r17788r17789
240240
241241            /* log anything else */
242242            default:
243               logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", cpu_get_previouspc(&space.device()), data, mem_mask, m_video_latch);
243               logerror("%08X: policetr_video_w(3) = %08X & %08X with latch %02X\n", space.device().safe_pcbase(), data, mem_mask, m_video_latch);
244244               break;
245245         }
246246         break;
r17788r17789
300300   }
301301
302302   /* log anything else */
303   logerror("%08X: policetr_video_r with latch %02X\n", cpu_get_previouspc(&space.device()), m_video_latch);
303   logerror("%08X: policetr_video_r with latch %02X\n", space.device().safe_pcbase(), m_video_latch);
304304   return 0;
305305}
306306
trunk/src/mame/video/st0020.c
r17788r17789
115115         return 0;
116116   }
117117
118   logerror("CPU #0 PC: %06X - Blit reg read: %02X\n",cpu_get_pc(&space.device()),offset*2);
118   logerror("CPU #0 PC: %06X - Blit reg read: %02X\n",space.device().safe_pc(),offset*2);
119119   return 0;
120120}
121121
r17788r17789
137137      case 0x8a/2:
138138      {
139139         if (data & ~0x43)
140            logerror("CPU #0 PC: %06X - Unknown st0020_gfxram_bank bit written %04X\n",cpu_get_pc(&space.device()),data);
140            logerror("CPU #0 PC: %06X - Unknown st0020_gfxram_bank bit written %04X\n",space.device().safe_pc(),data);
141141
142142         if (ACCESSING_BITS_0_7)
143143            m_st0020_gfxram_bank = data & 3;
r17788r17789
162162
163163         if (!rom)
164164         {
165            logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",cpu_get_pc(&space.device()),src,dst,len);
165            logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",space.device().safe_pc(),src,dst,len);
166166            return;
167167         }
168168
r17788r17789
184184         }
185185         else
186186         {
187            logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",cpu_get_pc(&space.device()),src,dst,len);
187            logerror("CPU #0 PC: %06X - Blit out of range: src %x, dst %x, len %x\n",space.device().safe_pc(),src,dst,len);
188188         }
189189      }
190190      break;
191191
192192      default:
193         logerror("CPU #0 PC: %06X - Blit reg written: %02X <- %04X\n",cpu_get_pc(&space.device()),offset*2,data);
193         logerror("CPU #0 PC: %06X - Blit reg written: %02X <- %04X\n",space.device().safe_pc(),offset*2,data);
194194   }
195195}
196196
trunk/src/mame/video/scn2674.c
r17788r17789
519519        */
520520
521521      case 0:
522         LOG2674(("Read Irq Register %02x %06x\n",m_scn2674_irq_register,cpu_get_pc(&space.device())));
522         LOG2674(("Read Irq Register %02x %06x\n",m_scn2674_irq_register,space.device().safe_pc()));
523523         return m_scn2674_irq_register;
524524
525525      case 1:
526         LOG2674(("Read Status Register %02X %06x\n",m_scn2674_status_register,cpu_get_pc(&space.device())));
526         LOG2674(("Read Status Register %02X %06x\n",m_scn2674_status_register,space.device().safe_pc()));
527527         return m_scn2674_status_register;
528528
529      case 2: LOG2674(("Read Screen1_l Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen1_l;
530      case 3: LOG2674(("Read Screen1_h Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen1_h;
531      case 4: LOG2674(("Read Cursor_l Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_cursor_l;
532      case 5: LOG2674(("Read Cursor_h Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_cursor_h;
533      case 6:   LOG2674(("Read Screen2_l Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen2_l;
534      case 7: LOG2674(("Read Screen2_h Register %06x\n",cpu_get_pc(&space.device())));return m_scn2674_screen2_h;
529      case 2: LOG2674(("Read Screen1_l Register %06x\n",space.device().safe_pc()));return m_scn2674_screen1_l;
530      case 3: LOG2674(("Read Screen1_h Register %06x\n",space.device().safe_pc()));return m_scn2674_screen1_h;
531      case 4: LOG2674(("Read Cursor_l Register %06x\n",space.device().safe_pc()));return m_scn2674_cursor_l;
532      case 5: LOG2674(("Read Cursor_h Register %06x\n",space.device().safe_pc()));return m_scn2674_cursor_h;
533      case 6:   LOG2674(("Read Screen2_l Register %06x\n",space.device().safe_pc()));return m_scn2674_screen2_l;
534      case 7: LOG2674(("Read Screen2_h Register %06x\n",space.device().safe_pc()));return m_scn2674_screen2_h;
535535   }
536536
537537   return 0xffff;
trunk/src/mame/video/seta2.c
r17788r17789
128128
129129   COMBINE_DATA(&m_vregs[offset]);
130130   if ( m_vregs[offset] != olddata )
131      logerror("CPU #0 PC %06X: Video Reg %02X <- %04X\n",cpu_get_pc(&space.device()),offset*2,data);
131      logerror("CPU #0 PC %06X: Video Reg %02X <- %04X\n",space.device().safe_pc(),offset*2,data);
132132
133133   switch( offset*2 )
134134   {
135135   case 0x1c:   // FLIP SCREEN (myangel)    <- this is actually zoom
136136      flip_screen_set(data & 1 );
137      if (data & ~1)   logerror("CPU #0 PC %06X: flip screen unknown bits %04X\n",cpu_get_pc(&space.device()),data);
137      if (data & ~1)   logerror("CPU #0 PC %06X: flip screen unknown bits %04X\n",space.device().safe_pc(),data);
138138      break;
139139   case 0x2a:   // FLIP X (pzlbowl)
140140      flip_screen_x_set(data & 1 );
141      if (data & ~1)   logerror("CPU #0 PC %06X: flipx unknown bits %04X\n",cpu_get_pc(&space.device()),data);
141      if (data & ~1)   logerror("CPU #0 PC %06X: flipx unknown bits %04X\n",space.device().safe_pc(),data);
142142      break;
143143   case 0x2c:   // FLIP Y (pzlbowl)
144144      flip_screen_y_set(data & 1 );
145      if (data & ~1)   logerror("CPU #0 PC %06X: flipy unknown bits %04X\n",cpu_get_pc(&space.device()),data);
145      if (data & ~1)   logerror("CPU #0 PC %06X: flipy unknown bits %04X\n",space.device().safe_pc(),data);
146146      break;
147147
148148   case 0x30:   // BLANK SCREEN (pzlbowl, myangel)
149      if (data & ~1)   logerror("CPU #0 PC %06X: blank unknown bits %04X\n",cpu_get_pc(&space.device()),data);
149      if (data & ~1)   logerror("CPU #0 PC %06X: blank unknown bits %04X\n",space.device().safe_pc(),data);
150150      break;
151151   }
152152}
trunk/src/mame/video/dynax.c
r17788r17789
238238{
239239   m_flipscreen = data & 1;
240240   if (data & ~1)
241      logerror("CPU#0 PC %06X: Warning, flip screen <- %02X\n", cpu_get_pc(&space.device()), data);
241      logerror("CPU#0 PC %06X: Warning, flip screen <- %02X\n", space.device().safe_pc(), data);
242242   LOG(("F=%02X ", data));
243243}
244244
trunk/src/mame/video/midzeus.c
r17788r17789
428428      if (logit)
429429      {
430430         if (offset & 1)
431            logerror("%06X:zeus32_r(%02X) = %08X -- unexpected in 32-bit mode\n", cpu_get_pc(&space.device()), offset, result);
431            logerror("%06X:zeus32_r(%02X) = %08X -- unexpected in 32-bit mode\n", space.device().safe_pc(), offset, result);
432432         else if (offset != 0xe0)
433            logerror("%06X:zeus32_r(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, result);
433            logerror("%06X:zeus32_r(%02X) = %08X\n", space.device().safe_pc(), offset, result);
434434         else
435            logerror("%06X:zeus32_r(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, result);
435            logerror("%06X:zeus32_r(%02X) = %08X\n", space.device().safe_pc(), offset, result);
436436      }
437437   }
438438
r17788r17789
444444      else
445445         result &= 0xffff;
446446      if (logit)
447         logerror("%06X:zeus16_r(%02X) = %04X\n", cpu_get_pc(&space.device()), offset, result);
447         logerror("%06X:zeus16_r(%02X) = %04X\n", space.device().safe_pc(), offset, result);
448448   }
449449   return result;
450450}
r17788r17789
462462   int logit = zeus_enable_logging || ((offset < 0xb0 || offset > 0xb7) && (offset < 0xe0 || offset > 0xe1));
463463
464464   if (logit)
465      logerror("%06X:zeus_w", cpu_get_pc(&space.device()));
465      logerror("%06X:zeus_w", space.device().safe_pc());
466466
467467   /* 32-bit mode */
468468   if (zeusbase[0x80] & 0x00020000)
trunk/src/mame/video/gticlub.c
r17788r17789
390390         }
391391
392392      default:
393         mame_printf_debug("K001005_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space->device()));
393         mame_printf_debug("K001005_r: %08X, %08X at %08X\n", offset, mem_mask, space->device().safe_pc());
394394         break;
395395   }
396396   return 0;
r17788r17789
421421            sharc_set_flag_input(space->machine().device("dsp"), 1, ASSERT_LINE);
422422         }
423423
424       //  mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, cpu_get_pc(&space->device()));
424       //  mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, space->device().safe_pc());
425425         K001005_fifo[K001005_fifo_write_ptr] = data;
426426         K001005_fifo_write_ptr++;
427427         K001005_fifo_write_ptr &= 0x7ff;
r17788r17789
446446#endif
447447
448448         // !!! HACK to get past the FIFO B test (GTI Club & Thunder Hurricane) !!!
449         if (cpu_get_pc(&space->device()) == 0x201ee)
449         if (space->device().safe_pc() == 0x201ee)
450450         {
451451            // This is used to make the SHARC timeout
452452            device_spin_until_trigger(&space->device(), 10000);
453453         }
454454         // !!! HACK to get past the FIFO B test (Winding Heat & Midnight Run) !!!
455         if (cpu_get_pc(&space->device()) == 0x201e6)
455         if (space->device().safe_pc() == 0x201e6)
456456         {
457457            // This is used to make the SHARC timeout
458458            device_spin_until_trigger(&space->device(), 10000);
r17788r17789
545545         break;
546546
547547      default:
548         //mame_printf_debug("K001005_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device()));
548         //mame_printf_debug("K001005_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space->device().safe_pc());
549549         break;
550550   }
551551
trunk/src/mame/video/taitoic.c
r17788r17789
48484848         return tc0110pcr->ram[tc0110pcr->addr];
48494849
48504850      default:
4851//logerror("PC %06x: warning - read TC0110PCR address %02x\n",cpu_get_pc(&space->device()),offset);
4851//logerror("PC %06x: warning - read TC0110PCR address %02x\n",space->device().safe_pc(),offset);
48524852         return 0xff;
48534853   }
48544854}
r17788r17789
48724872         break;
48734873
48744874      default:
4875//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",cpu_get_pc(&space->device()),data,offset);
4875//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",space->device().safe_pc(),data,offset);
48764876         break;
48774877   }
48784878}
r17788r17789
48954895         break;
48964896
48974897      default:
4898//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",cpu_get_pc(&space->device()),data,offset);
4898//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",space->device().safe_pc(),data,offset);
48994899         break;
49004900   }
49014901}
r17788r17789
49204920         break;
49214921
49224922      default:
4923//logerror("PC %06x: warning - write %04x to TC0110PCR offset %02x\n",cpu_get_pc(&space->device()),data,offset);
4923//logerror("PC %06x: warning - write %04x to TC0110PCR offset %02x\n",space->device().safe_pc(),data,offset);
49244924         break;
49254925   }
49264926}
r17788r17789
49454945         break;
49464946
49474947      default:
4948//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",cpu_get_pc(&space->device()),data,offset);
4948//logerror("PC %06x: warning - write %04x to TC0110PCR address %02x\n",space->device().safe_pc(),data,offset);
49494949         break;
49504950   }
49514951}
trunk/src/mame/video/lethalj.c
r17788r17789
6363         result = m_guny + 4;
6464         break;
6565   }
66/*  logerror("%08X:lethalj_gun_r(%d) = %04X\n", cpu_get_pc(&space.device()), offset, result); */
66/*  logerror("%08X:lethalj_gun_r(%d) = %04X\n", space.device().safe_pc(), offset, result); */
6767   return result;
6868}
6969
trunk/src/mame/video/itech8.c
r17788r17789
203203WRITE8_MEMBER(itech8_state::itech8_page_w)
204204{
205205   machine().primary_screen->update_partial(machine().primary_screen->vpos());
206   logerror("%04x:display_page = %02X (%d)\n", cpu_get_pc(&space.device()), data, machine().primary_screen->vpos());
206   logerror("%04x:display_page = %02X (%d)\n", space.device().safe_pc(), data, machine().primary_screen->vpos());
207207   m_page_select = data;
208208}
209209
r17788r17789
444444   static const char *const portnames[] = { "AN_C", "AN_D", "AN_E", "AN_F" };
445445
446446   /* debugging */
447   if (FULL_LOGGING) logerror("%04x:blitter_r(%02x)\n", cpu_get_previouspc(&space.device()), offset / 2);
447   if (FULL_LOGGING) logerror("%04x:blitter_r(%02x)\n", space.device().safe_pcbase(), offset / 2);
448448
449449   /* low bit seems to be ignored */
450450   offset /= 2;
r17788r17789
507507   }
508508
509509   /* debugging */
510   if (FULL_LOGGING) logerror("%04x:blitter_w(%02x)=%02x\n", cpu_get_previouspc(&space.device()), offset, data);
510   if (FULL_LOGGING) logerror("%04x:blitter_w(%02x)=%02x\n", space.device().safe_pcbase(), offset, data);
511511}
512512
513513
trunk/src/mame/video/othldrby.c
r17788r17789
120120   if (m_vreg_addr < OTHLDRBY_VREG_SIZE)
121121      m_vreg[m_vreg_addr++] = data;
122122   else
123      popmessage("%06x: VREG OUT OF BOUNDS %04x", cpu_get_pc(&space.device()), m_vreg_addr);
123      popmessage("%06x: VREG OUT OF BOUNDS %04x", space.device().safe_pc(), m_vreg_addr);
124124}
125125
126126
trunk/src/mame/video/flstory.c
r17788r17789
128128
129129   flip_screen_set(m_flipscreen);
130130
131//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(&space.device()), data);
131//popmessage("%04x: gfxctrl = %02x\n", space.device().safe_pc(), data);
132132
133133}
134134
r17788r17789
151151      flip_screen_set(m_flipscreen);
152152   }
153153
154//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(&space.device()), data);
154//popmessage("%04x: gfxctrl = %02x\n", space.device().safe_pc(), data);
155155
156156}
157157
trunk/src/mame/video/segag80r.c
r17788r17789
283283{
284284   if (offset == 0)
285285   {
286      logerror("%04X:segag80r_video_port_r(%d)\n", cpu_get_pc(&space.device()), offset);
286      logerror("%04X:segag80r_video_port_r(%d)\n", space.device().safe_pc(), offset);
287287      return 0xff;
288288   }
289289   else
r17788r17789
303303{
304304   if (offset == 0)
305305   {
306      logerror("%04X:segag80r_video_port_w(%d) = %02X\n", cpu_get_pc(&space.device()), offset, data);
306      logerror("%04X:segag80r_video_port_w(%d) = %02X\n", space.device().safe_pc(), offset, data);
307307   }
308308   else
309309   {
trunk/src/mame/video/dc.c
r17788r17789
10141014
10151015   #if DEBUG_PVRTA_REGS
10161016   if (reg != 0x43)
1017      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()));
1017      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());
10181018   #endif
10191019   return (UINT64)state->pvrta_regs[reg] << shift;
10201020}
r17788r17789
27392739      case 0x78/4: // IRQ MASK
27402740         return 0;
27412741      default:
2742         printf("%08x %08x\n",cpu_get_pc(&space->device()),offset*4);
2742         printf("%08x %08x\n",space->device().safe_pc(),offset*4);
27432743         break;
27442744   }
27452745
r17788r17789
27512751   switch(offset)
27522752   {
27532753      default:
2754         printf("%08x %08x %08x W\n",cpu_get_pc(&space->device()),offset*4,data);
2754         printf("%08x %08x %08x W\n",space->device().safe_pc(),offset*4,data);
27552755         break;
27562756   }
27572757}
trunk/src/mame/video/midzeus2.c
r17788r17789
426426#endif
427427
428428   if (logit)
429      logerror("%06X:zeus2_r(%02X)\n", cpu_get_pc(&space->device()), offset);
429      logerror("%06X:zeus2_r(%02X)\n", space->device().safe_pc(), offset);
430430
431431   switch (offset)
432432   {
r17788r17789
472472             offset != 0x40 && offset != 0x41 && offset != 0x48 && offset != 0x49 && offset != 0x4e &&
473473             offset != 0x50 && offset != 0x51 && offset != 0x57 && offset != 0x58 && offset != 0x59 && offset != 0x5a && offset != 0x5e);
474474   if (logit)
475      logerror("%06X:zeus2_w", cpu_get_pc(&space->device()));
475      logerror("%06X:zeus2_w", space->device().safe_pc());
476476   zeus_register32_w(space->machine(), offset, data, logit);
477477}
478478
trunk/src/mame/video/capbowl.c
r17788r17789
107107         break;
108108
109109      default:
110         logerror("PC=%04X Write to unsupported blitter address %02X Data=%02X\n", cpu_get_pc(&space.device()), offset, data);
110         logerror("PC=%04X Write to unsupported blitter address %02X Data=%02X\n", space.device().safe_pc(), offset, data);
111111         break;
112112   }
113113}
r17788r17789
138138         break;
139139
140140      default:
141         logerror("PC=%04X Read from unsupported blitter address %02X\n", cpu_get_pc(&space.device()), offset);
141         logerror("PC=%04X Read from unsupported blitter address %02X\n", space.device().safe_pc(), offset);
142142         break;
143143   }
144144
trunk/src/mame/video/st0016.c
r17788r17789
205205         {
206206            /* samples ? sound dma ? */
207207            // speaglsht:  unknown DMA copy : src - 2B6740, dst - 4400, len - 1E400
208            logerror("unknown DMA copy : src - %X, dst - %X, len - %X, PC - %X\n",srcadr,dstadr,length,cpu_get_previouspc(&space.device()));
208            logerror("unknown DMA copy : src - %X, dst - %X, len - %X, PC - %X\n",srcadr,dstadr,length,space.device().safe_pcbase());
209209            break;
210210         }
211211      }
trunk/src/mame/video/beathead.c
r17788r17789
153153{
154154   /* offset 0 is probably write-only */
155155   if (offset == 0)
156      logerror("%08X:Unexpected HSYNC RAM read at offset 0\n", cpu_get_previouspc(&space.device()));
156      logerror("%08X:Unexpected HSYNC RAM read at offset 0\n", space.device().safe_pcbase());
157157
158158   /* offset 1 reads the data */
159159   else
trunk/src/mame/video/mjkjidai.c
r17788r17789
5050{
5151   UINT8 *rom = memregion("maincpu")->base();
5252
53//  logerror("%04x: port c0 = %02x\n",cpu_get_pc(&space.device()),data);
53//  logerror("%04x: port c0 = %02x\n",space.device().safe_pc(),data);
5454
5555   /* bit 0 = NMI enable */
5656   m_nmi_mask = data & 1;
trunk/src/mame/video/cischeat.c
r17788r17789
6060#define SHOW_READ_ERROR(_format_,_offset_)\
6161{\
6262   popmessage(_format_,_offset_);\
63   logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \
63   logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \
6464   logerror(_format_ "\n",_offset_);\
6565}
6666#define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\
6767{\
6868   popmessage(_format_,_offset_,_data_);\
69   logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \
69   logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \
7070   logerror(_format_ "\n",_offset_,_data_); \
7171}
7272
r17788r17789
7474
7575#define SHOW_READ_ERROR(_format_,_offset_)\
7676{\
77   logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \
77   logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \
7878   logerror(_format_ "\n",_offset_);\
7979}
8080#define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\
8181{\
82   logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \
82   logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \
8383   logerror(_format_ "\n",_offset_,_data_); \
8484}
8585
trunk/src/mame/video/midvunit.c
r17788r17789
349349WRITE32_MEMBER(midvunit_state::midvunit_dma_queue_w)
350350{
351351   if (LOG_DMA && machine().input().code_pressed(KEYCODE_L))
352      logerror("%06X:queue(%X) = %08X\n", cpu_get_pc(&space.device()), m_dma_data_index, data);
352      logerror("%06X:queue(%X) = %08X\n", space.device().safe_pc(), m_dma_data_index, data);
353353   if (m_dma_data_index < 16)
354354      m_dma_data[m_dma_data_index++] = data;
355355}
r17788r17789
367367   if (offset)
368368   {
369369      if (LOG_DMA && machine().input().code_pressed(KEYCODE_L))
370         logerror("%06X:trigger\n", cpu_get_pc(&space.device()));
370         logerror("%06X:trigger\n", space.device().safe_pc());
371371      m_poly->process_dma_queue();
372372      m_dma_data_index = 0;
373373   }
trunk/src/mame/video/kaneko_grap2.c
r17788r17789
8181      }
8282
8383      default:
84         logerror("cpu '%s' (PC=%06X): galpani3_regs1_r %02x %04x\n", space.device().tag(), cpu_get_previouspc(&space.device()), offset, mem_mask);
84         logerror("cpu '%s' (PC=%06X): galpani3_regs1_r %02x %04x\n", space.device().tag(), space.device().safe_pcbase(), offset, mem_mask);
8585         break;
8686
8787   }
trunk/src/mame/video/suna16.c
r17788r17789
6767      flip_screen_set(data & 1 );
6868      m_color_bank = ( data & 4 ) >> 2;
6969   }
70   if (data & ~(1|4))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
70   if (data & ~(1|4))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", space.device().safe_pc(), data);
7171}
7272
7373WRITE16_MEMBER(suna16_state::bestbest_flipscreen_w)
r17788r17789
7777      flip_screen_set(data & 0x10 );
7878      //m_color_bank = ( data & 0x07 );
7979   }
80   if (data & ~(0x10))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
80   if (data & ~(0x10))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", space.device().safe_pc(), data);
8181}
8282
8383
trunk/src/mame/video/jaguar.c
r17788r17789
539539         return m_blitter_status & 3;
540540
541541      default:
542         logerror("%08X:Blitter read register @ F022%02X\n", cpu_get_previouspc(&space.device()), offset * 4);
542         logerror("%08X:Blitter read register @ F022%02X\n", space.device().safe_pcbase(), offset * 4);
543543         return 0;
544544   }
545545}
r17788r17789
556556   }
557557
558558   if (LOG_BLITTER_WRITE)
559   logerror("%08X:Blitter write register @ F022%02X = %08X\n", cpu_get_previouspc(&space.device()), offset * 4, data);
559   logerror("%08X:Blitter write register @ F022%02X = %08X\n", space.device().safe_pcbase(), offset * 4, data);
560560}
561561
562562
r17788r17789
570570READ16_MEMBER( jaguar_state::tom_regs_r )
571571{
572572   if (offset != INT1 && offset != INT2 && offset != HC && offset != VC)
573      logerror("%08X:TOM read register @ F00%03X\n", cpu_get_previouspc(&space.device()), offset * 2);
573      logerror("%08X:TOM read register @ F00%03X\n", space.device().safe_pcbase(), offset * 2);
574574
575575   switch (offset)
576576   {
r17788r17789
669669   }
670670
671671   if (offset != INT2 && offset != VI && offset != INT1)
672      logerror("%08X:TOM write register @ F00%03X = %04X\n", cpu_get_previouspc(&space.device()), offset * 2, data);
672      logerror("%08X:TOM write register @ F00%03X = %04X\n", space.device().safe_pcbase(), offset * 2, data);
673673}
674674
675675
trunk/src/mame/video/cvs.c
r17788r17789
8686{
8787
8888   if (data & 0xce)
89      logerror("%4x : CVS: Unimplemented CVS video fx = %2x\n",cpu_get_pc(&space.device()), data & 0xce);
89      logerror("%4x : CVS: Unimplemented CVS video fx = %2x\n",space.device().safe_pc(), data & 0xce);
9090
9191   m_stars_on = data & 0x01;
9292
trunk/src/mame/video/seta.c
r17788r17789
306306                  if ( (samples_len > 0x100000) && ((addr+0x40000) <= samples_len) )
307307                     memcpy(&rom[0xc0000],&rom[addr],0x40000);
308308                  else
309                     logerror("PC %06X - Invalid samples bank %02X !\n", cpu_get_pc(&space.device()), new_bank);
309                     logerror("PC %06X - Invalid samples bank %02X !\n", space.device().safe_pc(), new_bank);
310310               }
311311               else if (samples_len == 0x480000)   /* zombraid */
312312               {
trunk/src/mame/video/battlera.c
r17788r17789
159159         case 16:
160160         case 17:
161161         case 18:
162            logerror("%04x: dma 2 %02x\n",cpu_get_pc(&space.device()),data);
162            logerror("%04x: dma 2 %02x\n",space.device().safe_pc(),data);
163163            break;
164164
165165         case 19: /* SATB */
r17788r17789
221221         case 16:
222222         case 17:
223223         case 18:
224            logerror("%04x: dma 2 %02x\n",cpu_get_pc(&space.device()),data);
224            logerror("%04x: dma 2 %02x\n",space.device().safe_pc(),data);
225225            break;
226226
227227         case 19: /* SATB - Sprites */
r17788r17789
230230         }
231231         break;
232232   }
233   logerror("%04x: unknown write to  VDC_register %02x (%02x) at %02x\n",cpu_get_pc(&space.device()),m_VDC_register,data,offset);
233   logerror("%04x: unknown write to  VDC_register %02x (%02x) at %02x\n",space.device().safe_pc(),m_VDC_register,data,offset);
234234}
235235
236236/******************************************************************************/
trunk/src/mame/video/ginganin.c
r17788r17789
178178      device_set_input_line(m_audiocpu, INPUT_LINE_NMI, PULSE_LINE);
179179      break;
180180   default:
181      logerror("CPU #0 PC %06X : Warning, videoreg %04X <- %04X\n", cpu_get_pc(&space.device()), offset, data);
181      logerror("CPU #0 PC %06X : Warning, videoreg %04X <- %04X\n", space.device().safe_pc(), offset, data);
182182   }
183183}
184184
trunk/src/mame/video/victory.c
r17788r17789
132132   {
133133      case 0x00:   /* 5XFIQ */
134134         result = m_fgcollx;
135         if (LOG_COLLISION) logerror("%04X:5XFIQ read = %02X\n", cpu_get_previouspc(&space.device()), result);
135         if (LOG_COLLISION) logerror("%04X:5XFIQ read = %02X\n", space.device().safe_pcbase(), result);
136136         return result;
137137
138138      case 0x01:   /* 5CLFIQ */
r17788r17789
142142            m_fgcoll = 0;
143143            victory_update_irq(machine());
144144         }
145         if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", cpu_get_previouspc(&space.device()), result);
145         if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", space.device().safe_pcbase(), result);
146146         return result;
147147
148148      case 0x02:   /* 5BACKX */
149149         result = m_bgcollx & 0xfc;
150         if (LOG_COLLISION) logerror("%04X:5BACKX read = %02X\n", cpu_get_previouspc(&space.device()), result);
150         if (LOG_COLLISION) logerror("%04X:5BACKX read = %02X\n", space.device().safe_pcbase(), result);
151151         return result;
152152
153153      case 0x03:   /* 5BACKY */
r17788r17789
157157            m_bgcoll = 0;
158158            victory_update_irq(machine());
159159         }
160         if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", cpu_get_previouspc(&space.device()), result);
160         if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", space.device().safe_pcbase(), result);
161161         return result;
162162
163163      case 0x04:   /* 5STAT */
r17788r17789
172172         result |= (~m_vblank_irq & 1) << 5;
173173         result |= (~m_bgcoll & 1) << 4;
174174         result |= (machine().primary_screen->vpos() & 0x100) >> 5;
175         if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", cpu_get_previouspc(&space.device()), result);
175         if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", space.device().safe_pcbase(), result);
176176         return result;
177177
178178      default:
179         logerror("%04X:victory_video_control_r(%02X)\n", cpu_get_previouspc(&space.device()), offset);
179         logerror("%04X:victory_video_control_r(%02X)\n", space.device().safe_pcbase(), offset);
180180         break;
181181   }
182182   return 0;
r17788r17789
196196   switch (offset)
197197   {
198198      case 0x00:   /* LOAD IL */
199         if (LOG_MICROCODE) logerror("%04X:IL=%02X\n", cpu_get_previouspc(&space.device()), data);
199         if (LOG_MICROCODE) logerror("%04X:IL=%02X\n", space.device().safe_pcbase(), data);
200200         micro.i = (micro.i & 0xff00) | (data & 0x00ff);
201201         break;
202202
203203      case 0x01:   /* LOAD IH */
204         if (LOG_MICROCODE) logerror("%04X:IH=%02X\n", cpu_get_previouspc(&space.device()), data);
204         if (LOG_MICROCODE) logerror("%04X:IH=%02X\n", space.device().safe_pcbase(), data);
205205         micro.i = (micro.i & 0x00ff) | ((data << 8) & 0xff00);
206206         if (micro.cmdlo == 5)
207207         {
r17788r17789
211211         break;
212212
213213      case 0x02:   /* LOAD CMD */
214         if (LOG_MICROCODE) logerror("%04X:CMD=%02X\n", cpu_get_previouspc(&space.device()), data);
214         if (LOG_MICROCODE) logerror("%04X:CMD=%02X\n", space.device().safe_pcbase(), data);
215215         micro.cmd = data;
216216         micro.cmdlo = data & 7;
217217         if (micro.cmdlo == 0)
r17788r17789
226226         break;
227227
228228      case 0x03:   /* LOAD G */
229         if (LOG_MICROCODE) logerror("%04X:G=%02X\n", cpu_get_previouspc(&space.device()), data);
229         if (LOG_MICROCODE) logerror("%04X:G=%02X\n", space.device().safe_pcbase(), data);
230230         micro.g = data;
231231         break;
232232
233233      case 0x04:   /* LOAD X */
234         if (LOG_MICROCODE) logerror("%04X:X=%02X\n", cpu_get_previouspc(&space.device()), data);
234         if (LOG_MICROCODE) logerror("%04X:X=%02X\n", space.device().safe_pcbase(), data);
235235         micro.xp = data;
236236         if (micro.cmdlo == 3)
237237         {
r17788r17789
241241         break;
242242
243243      case 0x05:   /* LOAD Y */
244         if (LOG_MICROCODE) logerror("%04X:Y=%02X\n", cpu_get_previouspc(&space.device()), data);
244         if (LOG_MICROCODE) logerror("%04X:Y=%02X\n", space.device().safe_pcbase(), data);
245245         micro.yp = data;
246246         if (micro.cmdlo == 4)
247247         {
r17788r17789
251251         break;
252252
253253      case 0x06:   /* LOAD R */
254         if (LOG_MICROCODE) logerror("%04X:R=%02X\n", cpu_get_previouspc(&space.device()), data);
254         if (LOG_MICROCODE) logerror("%04X:R=%02X\n", space.device().safe_pcbase(), data);
255255         micro.r = data;
256256         break;
257257
258258      case 0x07:   /* LOAD B */
259         if (LOG_MICROCODE) logerror("%04X:B=%02X\n", cpu_get_previouspc(&space.device()), data);
259         if (LOG_MICROCODE) logerror("%04X:B=%02X\n", space.device().safe_pcbase(), data);
260260         micro.b = data;
261261         if (micro.cmdlo == 2)
262262         {
r17788r17789
271271         break;
272272
273273      case 0x08:   /* SCROLLX */
274         if (LOG_MICROCODE) logerror("%04X:SCROLLX write = %02X\n", cpu_get_previouspc(&space.device()), data);
274         if (LOG_MICROCODE) logerror("%04X:SCROLLX write = %02X\n", space.device().safe_pcbase(), data);
275275         m_scrollx = data;
276276         break;
277277
278278      case 0x09:   /* SCROLLY */
279         if (LOG_MICROCODE) logerror("%04X:SCROLLY write = %02X\n", cpu_get_previouspc(&space.device()), data);
279         if (LOG_MICROCODE) logerror("%04X:SCROLLY write = %02X\n", space.device().safe_pcbase(), data);
280280         m_scrolly = data;
281281         break;
282282
r17788r17789
288288         // D3 = SINVERT
289289         // D2 = BIR12
290290         // D1 = SELOVER
291         if (LOG_MICROCODE) logerror("%04X:CONTROL write = %02X\n", cpu_get_previouspc(&space.device()), data);
291         if (LOG_MICROCODE) logerror("%04X:CONTROL write = %02X\n", space.device().safe_pcbase(), data);
292292         m_video_control = data;
293293         break;
294294
295295      case 0x0b:   /* CLRVIRQ */
296         if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", cpu_get_previouspc(&space.device()), data);
296         if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", space.device().safe_pcbase(), data);
297297         m_vblank_irq = 0;
298298         victory_update_irq(machine());
299299         break;
300300
301301      default:
302         if (LOG_MICROCODE) logerror("%04X:victory_video_control_w(%02X) = %02X\n", cpu_get_previouspc(&space.device()), offset, data);
302         if (LOG_MICROCODE) logerror("%04X:victory_video_control_w(%02X) = %02X\n", space.device().safe_pcbase(), offset, data);
303303         break;
304304   }
305305}
trunk/src/mame/video/dogfgt.c
r17788r17789
167167   flip_screen_set(data & 0x80);
168168
169169   /* other bits unused? */
170   logerror("PC %04x: 1800 = %02x\n", cpu_get_pc(&space.device()), data);
170   logerror("PC %04x: 1800 = %02x\n", space.device().safe_pc(), data);
171171}
172172
173173
trunk/src/mame/video/galivan.c
r17788r17789
229229   /* bit 7 selects one of two ROM banks for c000-dfff */
230230   membank("bank1")->set_entry((data & 0x80) >> 7);
231231
232   /*  logerror("Address: %04X - port 40 = %02x\n", cpu_get_pc(&space.device()), data); */
232   /*  logerror("Address: %04X - port 40 = %02x\n", space.device().safe_pc(), data); */
233233}
234234
235235WRITE8_MEMBER(galivan_state::ninjemak_gfxbank_w)
trunk/src/mame/video/tatsumi.c
r17788r17789
1010
1111   /* 0xe0 is bank switch, others unknown */
1212//  if ((offset==0xe0 && data&0xefff) || offset!=0xe0)
13//      logerror("%08x:  Tatsumi TZB215 sprite control %04x %08x\n", cpu_get_pc(&space.device()), offset, data);
13//      logerror("%08x:  Tatsumi TZB215 sprite control %04x %08x\n", space.device().safe_pc(), offset, data);
1414}
1515
1616/******************************************************************************/
r17788r17789
153153   if (offset==1 && ACCESSING_BITS_0_7) {
154154      m_roundupt_crt_reg[m_roundupt_crt_selected_reg]=data;
155155//      if (m_roundupt_crt_selected_reg!=0xa && m_roundupt_crt_selected_reg!=0xb && m_roundupt_crt_selected_reg!=29)
156//      logerror("%08x:  Crt write %02x %02x\n",cpu_get_pc(&space.device()),m_roundupt_crt_selected_reg,data);
156//      logerror("%08x:  Crt write %02x %02x\n",space.device().safe_pc(),m_roundupt_crt_selected_reg,data);
157157   }
158158}
159159
trunk/src/mame/video/konamiic.c
r17788r17789
14631463      case 7:
14641464         return ROM[romofs+2];
14651465      default:
1466         LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, cpu_get_pc(&space->device())));
1466         LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, space->device().safe_pc()));
14671467         break;
14681468   }
14691469
r17788r17789
16661666
16671667static WRITE8_HANDLER( K054000_w )
16681668{
1669//logerror("%04x: write %02x to 054000 address %02x\n",cpu_get_pc(&space->device()),data,offset);
1669//logerror("%04x: write %02x to 054000 address %02x\n",space->device().safe_pc(),data,offset);
16701670
16711671   K054000_ram[offset] = data;
16721672}
r17788r17789
16761676   int Acx,Acy,Aax,Aay;
16771677   int Bcx,Bcy,Bax,Bay;
16781678
1679//logerror("%04x: read 054000 address %02x\n",cpu_get_pc(&space->device()),offset);
1679//logerror("%04x: read 054000 address %02x\n",space->device().safe_pc(),offset);
16801680
16811681   if (offset != 0x18) return 0;
16821682
r17788r17789
22652265   }
22662266   else
22672267   {
2268      LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask));
2268      LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask));
22692269   }
22702270   return 0;
22712271}
r17788r17789
22902290   }
22912291   else
22922292   {
2293      LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask));
2293      LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask));
22942294   }
22952295   return 0;
22962296}
trunk/src/mame/video/konicdev.c
r17788r17789
22992299         else if (offset >= 0x3a00 && offset < 0x3c00)
23002300         {   /* B x scroll */   }
23012301//          else
2302//logerror("%04x: read from unknown 052109 address %04x\n",cpu_get_pc(&space->device()),offset);
2302//logerror("%04x: read from unknown 052109 address %04x\n",space->device().safe_pc(),offset);
23032303      }
23042304
23052305      return k052109->ram[offset];
r17788r17789
23232323      addr = (code << 5) + (offset & 0x1f);
23242324      addr &= device->machine().root_device().memregion(k052109->memory_region)->bytes() - 1;
23252325
2326//      logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", cpu_get_pc(&space->device()), offset, k052109->romsubbank, bank, addr);
2326//      logerror("%04x: off = %04x sub = %02x (bnk = %x) adr = %06x\n", space->device().safe_pc(), offset, k052109->romsubbank, bank, addr);
23272327
23282328      return device->machine().root_device().memregion(k052109->memory_region)->base()[addr];
23292329   }
r17788r17789
23542354         if (k052109->scrollctrl != data)
23552355         {
23562356//popmessage("scrollcontrol = %02x", data);
2357//logerror("%04x: rowscrollcontrol = %02x\n", cpu_get_pc(&space->device()), data);
2357//logerror("%04x: rowscrollcontrol = %02x\n", space->device().safe_pc(), data);
23582358            k052109->scrollctrl = data;
23592359         }
23602360      }
23612361      else if (offset == 0x1d00)
23622362      {
2363//logerror("%04x: 052109 register 1d00 = %02x\n", cpu_get_pc(&space->device()), data);
2363//logerror("%04x: 052109 register 1d00 = %02x\n", space->device().safe_pc(), data);
23642364         /* bit 2 = irq enable */
23652365         /* the custom chip can also generate NMI and FIRQ, for use with a 6809 */
23662366         k052109->irq_enabled = data & 0x04;
r17788r17789
23932393      }
23942394      else if (offset == 0x1e00 || offset == 0x3e00) // Surprise Attack uses offset 0x3e00
23952395      {
2396//logerror("%04x: 052109 register 1e00 = %02x\n",cpu_get_pc(&space->device()),data);
2396//logerror("%04x: 052109 register 1e00 = %02x\n",space->device().safe_pc(),data);
23972397         k052109->romsubbank = data;
23982398      }
23992399      else if (offset == 0x1e80)
24002400      {
2401//if ((data & 0xfe)) logerror("%04x: 052109 register 1e80 = %02x\n",cpu_get_pc(&space->device()),data);
2401//if ((data & 0xfe)) logerror("%04x: 052109 register 1e80 = %02x\n",space->device().safe_pc(),data);
24022402         k052109->tilemap[0]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
24032403         k052109->tilemap[1]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
24042404         k052109->tilemap[2]->set_flip((data & 1) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
r17788r17789
24532453         k052109->charrombank_2[3] = (data >> 4) & 0x0f;
24542454      }
24552455//      else
2456//          logerror("%04x: write %02x to unknown 052109 address %04x\n",cpu_get_pc(&space->device()),data,offset);
2456//          logerror("%04x: write %02x to unknown 052109 address %04x\n",space->device().safe_pc(),data,offset);
24572457   }
24582458}
24592459
r17788r17789
30093009         /* some games need bit 0 to pulse */
30103010         return (k051960->k051937_counter++) & 1;
30113011      }
3012      //logerror("%04x: read unknown 051937 address %x\n", cpu_get_pc(device->cpu), offset);
3012      //logerror("%04x: read unknown 051937 address %x\n", device->cpu->safe_pc(), offset);
30133013      return 0;
30143014   }
30153015
r17788r17789
30403040
30413041      /* bit 5 = enable gfx ROM reading */
30423042      k051960->readroms = data & 0x20;
3043      //logerror("%04x: write %02x to 051937 address %x\n", cpu_get_pc(machine.cpu), data, offset);
3043      //logerror("%04x: write %02x to 051937 address %x\n", machine.cpu->safe_pc(), data, offset);
30443044   }
30453045   else if (offset == 1)
30463046   {
3047//  popmessage("%04x: write %02x to 051937 address %x", cpu_get_pc(machine.cpu), data, offset);
3048//logerror("%04x: write %02x to unknown 051937 address %x\n", cpu_get_pc(machine.cpu), data, offset);
3047//  popmessage("%04x: write %02x to 051937 address %x", machine.cpu->safe_pc(), data, offset);
3048//logerror("%04x: write %02x to unknown 051937 address %x\n", machine.cpu->safe_pc(), data, offset);
30493049   }
30503050   else if (offset >= 2 && offset < 5)
30513051   {
r17788r17789
30533053   }
30543054   else
30553055   {
3056   //  popmessage("%04x: write %02x to 051937 address %x", cpu_get_pc(machine.cpu), data, offset);
3057   //logerror("%04x: write %02x to unknown 051937 address %x\n", cpu_get_pc(machine.cpu), data, offset);
3056   //  popmessage("%04x: write %02x to 051937 address %x", machine.cpu->safe_pc(), data, offset);
3057   //logerror("%04x: write %02x to unknown 051937 address %x\n", machine.cpu->safe_pc(), data, offset);
30583058   }
30593059}
30603060
r17788r17789
45424542      case 7:
45434543         return ROM[romofs + 2];
45444544      default:
4545//          LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, cpu_get_pc(&space->device())));
4545//          LOG(("55673_rom_word_r: Unknown read offset %x (PC=%x)\n", offset, space->device().safe_pc()));
45464546         break;
45474547   }
45484548
r17788r17789
45594559      addr = (k053246->kx46_regs[6] << 17) | (k053246->kx46_regs[7] << 9) | (k053246->kx46_regs[4] << 1) | ((offset & 1) ^ 1);
45604560      addr &= device->machine().root_device().memregion(k053246->memory_region)->bytes() - 1;
45614561//      if (VERBOSE)
4562//          popmessage("%04x: offset %02x addr %06x", cpu_get_pc(&space->device()), offset, addr);
4562//          popmessage("%04x: offset %02x addr %06x", space->device().safe_pc(), offset, addr);
45634563      return device->machine().root_device().memregion(k053246->memory_region)->base()[addr];
45644564   }
45654565   else
45664566   {
4567//      LOG(("%04x: read from unknown 053246 address %x\n", cpu_get_pc(&space->device()), offset));
4567//      LOG(("%04x: read from unknown 053246 address %x\n", space->device().safe_pc(), offset));
45684568      return 0;
45694569   }
45704570}
r17788r17789
61756175{
61766176   k054000_state *k054000 = k054000_get_safe_token(device);
61776177
6178   //logerror("%04x: write %02x to 054000 address %02x\n",cpu_get_pc(&space->device()),data,offset);
6178   //logerror("%04x: write %02x to 054000 address %02x\n",space->device().safe_pc(),data,offset);
61796179   k054000->regs[offset] = data;
61806180}
61816181
r17788r17789
61856185   int Acx, Acy, Aax, Aay;
61866186   int Bcx, Bcy, Bax, Bay;
61876187
6188   //logerror("%04x: read 054000 address %02x\n", cpu_get_pc(&space->device()), offset);
6188   //logerror("%04x: read 054000 address %02x\n", space->device().safe_pc(), offset);
61896189
61906190   if (offset != 0x18)
61916191      return 0;
r17788r17789
63226322WRITE8_DEVICE_HANDLER( k051733_w )
63236323{
63246324   k051733_state *k051733= k051733_get_safe_token(device);
6325   //logerror("%04x: write %02x to 051733 address %02x\n", cpu_get_pc(&space->device()), data, offset);
6325   //logerror("%04x: write %02x to 051733 address %02x\n", space->device().safe_pc(), data, offset);
63266326
63276327   k051733->ram[offset] = data;
63286328}
r17788r17789
68536853      return k056832_rom_read_b(device, offset * 2 + 1, 4, 5, 0)<<16;
68546854   else
68556855   {
6856      //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask));
6856      //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask));
68576857   }
68586858   return 0;
68596859}
r17788r17789
68706870      return k056832_rom_read_b(device, offset * 4 + 3, 4, 5, 1);
68716871   else
68726872   {
6873      //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask));
6873      //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask));
68746874   }
68756875   return 0;
68766876}
r17788r17789
68876887      return k056832_rom_read_b(device, offset * 4 + 3, 4, 6, 0);
68886888   else
68896889   {
6890      //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", cpu_get_pc(&space->device()), mem_mask));
6890      //LOG(("Non-byte read of tilemap ROM, PC=%x (mask=%x)\n", space->device().safe_pc(), mem_mask));
68916891   }
68926892   return 0;
68936893}
r17788r17789
93839383         }
93849384
93859385      default:
9386         //mame_printf_debug("k001005->r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space->device()));
9386         //mame_printf_debug("k001005->r: %08X, %08X at %08X\n", offset, mem_mask, space->device().safe_pc());
93879387         break;
93889388   }
93899389   return 0;
r17788r17789
94169416            sharc_set_flag_input(k001005->dsp, 1, ASSERT_LINE);
94179417         }
94189418
9419       //  mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, cpu_get_pc(&space->device()));
9419       //  mame_printf_debug("K001005 FIFO write: %08X at %08X\n", data, space->device().safe_pc());
94209420         k001005->fifo[k001005->fifo_write_ptr] = data;
94219421         k001005->fifo_write_ptr++;
94229422         k001005->fifo_write_ptr &= 0x7ff;
r17788r17789
94249424         k001005->_3d_fifo[k001005->_3d_fifo_ptr++] = data;
94259425
94269426         // !!! HACK to get past the FIFO B test (GTI Club & Thunder Hurricane) !!!
9427         if (cpu_get_pc(k001005->cpu) == 0x201ee)
9427         if (k001005->cpu->safe_pc() == 0x201ee)
94289428         {
94299429            // This is used to make the SHARC timeout
94309430            device_spin_until_trigger(k001005->cpu, 10000);
94319431         }
94329432         // !!! HACK to get past the FIFO B test (Winding Heat & Midnight Run) !!!
9433         if (cpu_get_pc(k001005->cpu) == 0x201e6)
9433         if (k001005->cpu->safe_pc() == 0x201e6)
94349434         {
94359435            // This is used to make the SHARC timeout
94369436            device_spin_until_trigger(k001005->cpu, 10000);
r17788r17789
94809480         break;
94819481
94829482      default:
9483         //mame_printf_debug("k001005->w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device()));
9483         //mame_printf_debug("k001005->w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space->device().safe_pc());
94849484         break;
94859485   }
94869486
r17788r17789
1049410494
1049510495   if (offset != 0x08 && offset != 0x09 && offset != 0x0a /*&& offset != 0x17 && offset != 0x18*/)
1049610496   {
10497      //printf("K001604_reg_w (%d), %02X, %08X, %08X at %08X\n", chip, offset, data, mem_mask, cpu_get_pc(&space->device()));
10497      //printf("K001604_reg_w (%d), %02X, %08X, %08X at %08X\n", chip, offset, data, mem_mask, space->device().safe_pc());
1049810498   }
1049910499}
1050010500
trunk/src/mame/video/homedata.c
r17788r17789
714714
715715WRITE8_MEMBER(homedata_state::reikaids_gfx_bank_w)
716716{
717//logerror( "%04x: [setbank %02x]\n",cpu_get_pc(&space.device()),data);
717//logerror( "%04x: [setbank %02x]\n",space.device().safe_pc(),data);
718718
719719   if (m_gfx_bank[m_reikaids_which] != data)
720720   {
r17788r17789
727727
728728WRITE8_MEMBER(homedata_state::pteacher_gfx_bank_w)
729729{
730//  logerror("%04x: gfxbank:=%02x\n", cpu_get_pc(&space.device()), data);
730//  logerror("%04x: gfxbank:=%02x\n", space.device().safe_pc(), data);
731731   if (m_gfx_bank[0] != data)
732732   {
733733      m_gfx_bank[0] = data;
r17788r17789
737737
738738WRITE8_MEMBER(homedata_state::homedata_blitter_param_w)
739739{
740//logerror("%04x: blitter_param_w %02x\n", cpu_get_pc(&space.device()), data);
740//logerror("%04x: blitter_param_w %02x\n", space.device().safe_pc(), data);
741741   m_blitter_param[m_blitter_param_count] = data;
742742   m_blitter_param_count++;
743743   m_blitter_param_count &= 3;
trunk/src/mame/video/taito_l.c
r17788r17789
103103   if (m_bankc[offset] != data)
104104   {
105105      m_bankc[offset] = data;
106//      logerror("Bankc %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device()));
106//      logerror("Bankc %d, %02x (%04x)\n", offset, data, space.device().safe_pc());
107107
108108      m_bg18_tilemap->mark_all_dirty();
109109      m_bg19_tilemap->mark_all_dirty();
r17788r17789
119119WRITE8_MEMBER(taitol_state::taitol_control_w)
120120{
121121
122//  logerror("Control Write %02x (%04x)\n", data, cpu_get_pc(&space.device()));
122//  logerror("Control Write %02x (%04x)\n", data, space.device().safe_pc());
123123
124124   m_cur_ctrl = data;
125125//popmessage("%02x",data);
r17788r17789
140140READ8_MEMBER(taitol_state::taitol_control_r)
141141{
142142
143//  logerror("Control Read %02x (%04x)\n", cur_ctrl, cpu_get_pc(&space.device()));
143//  logerror("Control Read %02x (%04x)\n", cur_ctrl, space.device().safe_pc());
144144   return m_cur_ctrl;
145145}
146146
trunk/src/mame/video/m92.c
r17788r17789
8484        spriteram to the buffer.  It seems safe to assume 1 word can be copied per clock. */
8585      machine().scheduler().timer_set(attotime::from_hz(XTAL_26_66666MHz) * 0x400, FUNC(spritebuffer_callback));
8686   }
87//  logerror("%04x: m92_spritecontrol_w %08x %08x\n",cpu_get_pc(&space.device()),offset,data);
87//  logerror("%04x: m92_spritecontrol_w %08x %08x\n",space.device().safe_pc(),offset,data);
8888}
8989
9090WRITE16_MEMBER(m92_state::m92_videocontrol_w)
r17788r17789
121121   /* Access to upper palette bank */
122122    m_palette_bank = (m_videocontrol >> 1) & 1;
123123
124//  logerror("%04x: m92_videocontrol_w %d = %02x\n",cpu_get_pc(&space.device()),offset,data);
124//  logerror("%04x: m92_videocontrol_w %d = %02x\n",space.device().safe_pc(),offset,data);
125125}
126126
127127READ16_MEMBER(m92_state::m92_paletteram_r)
trunk/src/mame/video/m107.c
r17788r17789
372372      /*
373373        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.
374374        */
375//      logerror("%04x: buffered spriteram\n",cpu_get_pc(&space.device()));
375//      logerror("%04x: buffered spriteram\n",space.device().safe_pc());
376376      m_sprite_display   = (!(data & 0x1000));
377377
378378      memcpy(m_buffered_spriteram, m_spriteram, 0x1000);
trunk/src/mame/video/megasys1.c
r17788r17789
202202#define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\
203203{ \
204204   popmessage(_format_,_offset_,_data_);\
205   logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \
205   logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \
206206   logerror(_format_,_offset_,_data_);\
207207   logerror("\n");\
208208}
r17788r17789
211211
212212#define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\
213213{\
214   logerror("CPU #0 PC %06X : Warning, ",cpu_get_pc(&space.device())); \
214   logerror("CPU #0 PC %06X : Warning, ",space.device().safe_pc()); \
215215   logerror(_format_,_offset_,_data_); \
216216   logerror("\n");\
217217}
trunk/src/mame/video/airbustr.c
r17788r17789
8080      case 0x06:   m_bg_scrollx = data;   break;
8181      case 0x08:   m_highbits   = ~data;   break;   // complemented high bits
8282
83      default:   logerror("CPU #2 - port %02X written with %02X - PC = %04X\n", offset, data, cpu_get_pc(&space.device()));
83      default:   logerror("CPU #2 - port %02X written with %02X - PC = %04X\n", offset, data, space.device().safe_pc());
8484   }
8585
8686   m_bg_tilemap->set_scrolly(0, ((m_highbits << 5) & 0x100) + m_bg_scrolly);
trunk/src/mame/video/dcheese.c
r17788r17789
290290         break;
291291
292292      default:
293         logerror("%06X:write to %06X = %04X & %04x\n", cpu_get_pc(&space.device()), 0x2a0000 + 2 * offset, data, mem_mask);
293         logerror("%06X:write to %06X = %04X & %04x\n", space.device().safe_pc(), 0x2a0000 + 2 * offset, data, mem_mask);
294294         break;
295295   }
296296}
r17788r17789
299299WRITE16_MEMBER(dcheese_state::madmax_blitter_unknown_w)
300300{
301301   /* written to just before the blitter command register is written */
302   logerror("%06X:write to %06X = %04X & %04X\n", cpu_get_pc(&space.device()), 0x300000 + 2 * offset, data, mem_mask);
302   logerror("%06X:write to %06X = %04X & %04X\n", space.device().safe_pc(), 0x300000 + 2 * offset, data, mem_mask);
303303}
304304
305305
r17788r17789
316316      return 0xffff ^ (1 << 5);
317317
318318   /* log everything else */
319   logerror("%06X:read from %06X\n", cpu_get_pc(&space.device()), 0x2a0000 + 2 * offset);
319   logerror("%06X:read from %06X\n", space.device().safe_pc(), 0x2a0000 + 2 * offset);
320320   return 0xffff;
321321}
trunk/src/mame/video/bwing.c
r17788r17789
119119         m_srbank = data >> 6;
120120
121121         #if BW_DEBUG
122            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());
122            logerror("(%s)%04x: w=%02x a=%04x f=%d\n", device().tag, space.device().safe_pc(), data, 0x1b00 + offset, machine().primary_screen->frame_number());
123123         #endif
124124      break;
125125   }
trunk/src/mame/video/dooyong.c
r17788r17789
149149
150150   /* bit 5 used but unknown */
151151
152//  logerror("%04x: bankswitch = %02x\n",cpu_get_pc(&space.device()),data&0xe0);
152//  logerror("%04x: bankswitch = %02x\n",space.device().safe_pc(),data&0xe0);
153153}
154154
155155WRITE8_MEMBER(dooyong_state::paletteram_flytiger_w)
trunk/src/mame/video/williams.c
r17788r17789
543543
544544   /* Log blits */
545545   logerror("%04X:Blit @ %3d : %02X%02X -> %02X%02X, %3dx%3d, mask=%02X, flags=%02X, icount=%d, win=%d\n",
546         cpu_get_pc(&space.device()), machine().primary_screen->vpos(),
546         space.device().safe_pc(), machine().primary_screen->vpos(),
547547         m_blitterram[2], m_blitterram[3],
548548         m_blitterram[4], m_blitterram[5],
549549         m_blitterram[6], m_blitterram[7],
trunk/src/mame/video/kaneko_spr.c
r17788r17789
535535         break;
536536   }
537537
538//  logerror("CPU #0 PC %06X : Warning, sprites reg %04X <- %04X\n",cpu_get_pc(&space.device()),offset*2,data);
538//  logerror("CPU #0 PC %06X : Warning, sprites reg %04X <- %04X\n",space.device().safe_pc(),offset*2,data);
539539}
540540
541541
trunk/src/mame/drivers/bfcobra.c
r17788r17789
779779      }
780780      default:
781781      {
782         mame_printf_debug("Unhandled RAMDAC read (PC:%.4x)\n", cpu_get_previouspc(&space.device()));
782         mame_printf_debug("Unhandled RAMDAC read (PC:%.4x)\n", space.device().safe_pcbase());
783783      }
784784   }
785785
r17788r17789
930930      }
931931      default:
932932      {
933         mame_printf_debug("Flare One unknown read: 0x%.2x (PC:0x%.4x)\n", offset, cpu_get_previouspc(&space.device()));
933         mame_printf_debug("Flare One unknown read: 0x%.2x (PC:0x%.4x)\n", offset, space.device().safe_pcbase());
934934      }
935935   }
936936
r17788r17789
946946      case 0x03:
947947      {
948948         if (data > 0x3f)
949            popmessage("%x: Unusual bank access (%x)\n", cpu_get_previouspc(&space.device()), data);
949            popmessage("%x: Unusual bank access (%x)\n", space.device().safe_pcbase(), data);
950950
951951         data &= 0x3f;
952952         m_bank_data[offset] = data;
r17788r17789
10201020      }
10211021      default:
10221022      {
1023         mame_printf_debug("Flare One unknown write: 0x%.2x with 0x%.2x (PC:0x%.4x)\n", offset, data, cpu_get_previouspc(&space.device()));
1023         mame_printf_debug("Flare One unknown write: 0x%.2x with 0x%.2x (PC:0x%.4x)\n", offset, data, space.device().safe_pcbase());
10241024      }
10251025   }
10261026}
trunk/src/mame/drivers/mitchell.c
r17788r17789
280280   {
281281      case 0:
282282      default:
283         logerror("PC %04x: write %02x to port 01\n", cpu_get_pc(&space.device()), data);
283         logerror("PC %04x: write %02x to port 01\n", space.device().safe_pc(), data);
284284         break;
285285      case 1:
286286         mahjong_input_select_w(space, offset, data);
trunk/src/mame/drivers/deco_mlc.c
r17788r17789
111111{
112112//  if (offset==0)
113113//      return ioport("IN0")->read(); //0xffffffff;
114//   logerror("%08x:  Test2_r %d\n",cpu_get_pc(&space.device()),offset);
114//   logerror("%08x:  Test2_r %d\n",space.device().safe_pc(),offset);
115115   return machine().rand(); //0xffffffff;
116116}
117117
r17788r17789
123123*/
124124//if (offset==0)
125125//  return machine().rand()|(machine().rand()<<16);
126//  logerror("%08x:  Test3_r %d\n",cpu_get_pc(&space.device()),offset);
126//  logerror("%08x:  Test3_r %d\n",space.device().safe_pc(),offset);
127127   return 0xffffffff;
128128}
129129
r17788r17789
156156READ32_MEMBER(deco_mlc_state::decomlc_vbl_r)
157157{
158158   m_vbl_i ^=0xffffffff;
159//logerror("vbl r %08x\n", cpu_get_pc(&space.device()));
159//logerror("vbl r %08x\n", space.device().safe_pc());
160160   // Todo: Vblank probably in $10
161161   return m_vbl_i;
162162}
r17788r17789
241241    */
242242   offset<<=1;
243243
244   logerror("%08x:  Read prot %04x\n", cpu_get_pc(&space.device()), offset);
244   logerror("%08x:  Read prot %04x\n", space.device().safe_pc(), offset);
245245
246246   if (offset==0x5c4)
247247      return 0xaa55 << 16;
r17788r17789
722722READ32_MEMBER(deco_mlc_state::avengrgs_speedup_r)
723723{
724724   UINT32 a=m_mlc_ram[0x89a0/4];
725   UINT32 p=cpu_get_pc(&space.device());
725   UINT32 p=space.device().safe_pc();
726726
727727   if ((p==0x3234 || p==0x32dc) && (a&1)) device_spin_until_interrupt(&space.device());
728728
trunk/src/mame/drivers/pasha2.c
r17788r17789
476476READ16_MEMBER(pasha2_state::pasha2_speedup_r)
477477{
478478
479   if(cpu_get_pc(&space.device()) == 0x8302)
479   if(space.device().safe_pc() == 0x8302)
480480      device_spin_until_interrupt(&space.device());
481481
482482   return m_wram[(0x95744 / 2) + offset];
trunk/src/mame/drivers/cntsteer.c
r17788r17789
472472WRITE8_MEMBER(cntsteer_state::zerotrgt_ctrl_w)
473473{
474474   /*TODO: check this.*/
475   logerror("CTRL: %04x: %04x: %04x\n", cpu_get_pc(&space.device()), offset, data);
475   logerror("CTRL: %04x: %04x: %04x\n", space.device().safe_pc(), offset, data);
476476//  if (offset == 0) device_set_input_line(m_subcpu, INPUT_LINE_RESET, ASSERT_LINE);
477477
478478   // Wrong - bits 0 & 1 used on this
trunk/src/mame/drivers/bking.c
r17788r17789
196196   int port_c_in = 0;
197197   if (main_sent) port_c_in |= 0x01;
198198   if (!mcu_sent) port_c_in |= 0x02;
199//logerror("%04x: 68705 port C read %02x\n",cpu_get_pc(&space.device()),port_c_in);
199//logerror("%04x: 68705 port C read %02x\n",space.device().safe_pc(),port_c_in);
200200   return port_c_in;
201201}
202202#endif
trunk/src/mame/drivers/dblewing.c
r17788r17789
172172      case 0x532: return m_580_data;
173173   }
174174
175//  printf("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask);
175//  printf("dblewing prot r %08x, %04x, %04x\n", space.device().safe_pc(), offset * 2, mem_mask);
176176
177177   if ((offset*2) == 0x0f8) return 0; // m_080_data;
178178   if ((offset*2) == 0x104) return 0;
r17788r17789
184184   if ((offset*2) == 0x54a) return 0; // 3rd player 2nd boss
185185   if ((offset*2) == 0x786) return 0;
186186
187   mame_printf_debug("dblewing prot r %08x, %04x, %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask);
187   mame_printf_debug("dblewing prot r %08x, %04x, %04x\n", space.device().safe_pc(), offset * 2, mem_mask);
188188
189189   return 0;//machine().rand();
190190}
r17788r17789
193193{
194194
195195//  if (offset * 2 != 0x380)
196//  printf("dblewing prot w %08x, %04x, %04x %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask, data);
196//  printf("dblewing prot w %08x, %04x, %04x %04x\n", space.device().safe_pc(), offset * 2, mem_mask, data);
197197
198198   switch (offset * 2)
199199   {
r17788r17789
295295         return;  // p2 inputs select screen  OK
296296   }
297297
298//  printf("dblewing prot w %08x, %04x, %04x %04x\n", cpu_get_pc(&space.device()), offset * 2, mem_mask, data);
298//  printf("dblewing prot w %08x, %04x, %04x %04x\n", space.device().safe_pc(), offset * 2, mem_mask, data);
299299
300300   if ((offset * 2) == 0x008) { m_008_data = data; return; }
301301   if ((offset * 2) == 0x080) { m_080_data = data; return; } // p3 3rd boss?
trunk/src/mame/drivers/taito_o.c
r17788r17789
5555   {
5656      case 0: retval = ioport("IN0")->read() & (clear_hack ? 0xf7ff : 0xffff); break;
5757      case 1: retval = ioport("IN1")->read() & (clear_hack ? 0xfff7 : 0xffff); break;
58      default: logerror("IO R %x %x = %x @ %x\n", offset, mem_mask, retval, cpu_get_pc(&space.device()));
58      default: logerror("IO R %x %x = %x @ %x\n", offset, mem_mask, retval, space.device().safe_pc());
5959   }
6060   return retval;
6161}
trunk/src/mame/drivers/ddragon3.c
r17788r17789
196196         break;
197197
198198      default:
199         logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset, (unsigned)data, cpu_get_pc(&space.device()) );
199         logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset, (unsigned)data, space.device().safe_pc() );
200200         break;
201201   }
202202}
trunk/src/mame/drivers/mediagx.c
r17788r17789
596596   {
597597      UINT8 nibble = m_parallel_latched;//(ioport(m_portnames[m_parallel_pointer / 3])->read_safe(0) >> (4 * (m_parallel_pointer % 3))) & 15;
598598      r |= ((~nibble & 0x08) << 12) | ((nibble & 0x07) << 11);
599      logerror("%08X:parallel_port_r()\n", cpu_get_pc(&space.device()));
599      logerror("%08X:parallel_port_r()\n", space.device().safe_pc());
600600#if 0
601601      if (m_controls_data == 0x18)
602602      {
r17788r17789
645645                7x..ff = advance pointer
646646        */
647647
648      logerror("%08X:", cpu_get_pc(&space.device()));
648      logerror("%08X:", space.device().safe_pc());
649649
650650      m_parallel_latched = (ioport(portnames[m_parallel_pointer / 3])->read_safe(0) >> (4 * (m_parallel_pointer % 3))) & 15;
651651      //parallel_pointer++;
r17788r17789
12661266{
12671267   mediagx_state *state = space->machine().driver_data<mediagx_state>();
12681268
1269   if (cpu_get_pc(&space->device()) == state->m_speedup_table[idx].pc)
1269   if (space->device().safe_pc() == state->m_speedup_table[idx].pc)
12701270   {
12711271      state->m_speedup_hits[idx]++;
12721272      device_spin_until_interrupt(&space->device());
trunk/src/mame/drivers/policetr.c
r17788r17789
152152
153153   /* log any unknown bits */
154154   if (data & 0x4f1fffff)
155      logerror("%08X: control_w = %08X & %08X\n", cpu_get_previouspc(&space.device()), data, mem_mask);
155      logerror("%08X: control_w = %08X & %08X\n", space.device().safe_pcbase(), data, mem_mask);
156156}
157157
158158
r17788r17789
203203   COMBINE_DATA(m_speedup_data);
204204
205205   /* see if the PC matches */
206   if ((cpu_get_previouspc(&space.device()) & 0x1fffffff) == m_speedup_pc)
206   if ((space.device().safe_pcbase() & 0x1fffffff) == m_speedup_pc)
207207   {
208208      UINT64 curr_cycles = machine().firstcpu->total_cycles();
209209
trunk/src/mame/drivers/megadrvb.c
r17788r17789
273273      - aladmdb_w : 1b2d18 - data = aa00 (only once on reset)
274274      - aladmdb_w : 1b2d42 - data = 0000 (only once on reset)
275275    */
276   logerror("aladmdb_w : %06x - data = %04x\n",cpu_get_pc(&space->device()),data);
276   logerror("aladmdb_w : %06x - data = %04x\n",space->device().safe_pc(),data);
277277}
278278
279279static READ16_HANDLER( aladmdb_r )
280280{
281281   md_boot_state *state = space->machine().driver_data<md_boot_state>();
282   if (cpu_get_pc(&space->device())==0x1b2a56)
282   if (space->device().safe_pc()==0x1b2a56)
283283   {
284284      state->m_aladmdb_mcu_port = state->ioport("MCU")->read();
285285
r17788r17789
288288      else
289289         return (0x100); //MCU status, needed if you fall into a pitfall
290290   }
291   if (cpu_get_pc(&space->device())==0x1b2a72) return 0x0000;
292   if (cpu_get_pc(&space->device())==0x1b2d24) return (space->machine().root_device().ioport("MCU")->read() & 0x00f0) | 0x1200;    // difficulty
293   if (cpu_get_pc(&space->device())==0x1b2d4e) return 0x0000;
291   if (space->device().safe_pc()==0x1b2a72) return 0x0000;
292   if (space->device().safe_pc()==0x1b2d24) return (space->machine().root_device().ioport("MCU")->read() & 0x00f0) | 0x1200;    // difficulty
293   if (space->device().safe_pc()==0x1b2d4e) return 0x0000;
294294
295   logerror("aladbl_r : %06x\n",cpu_get_pc(&space->device()));
295   logerror("aladbl_r : %06x\n",space->device().safe_pc());
296296
297297   return 0x0000;
298298}
trunk/src/mame/drivers/gaplus.c
r17788r17789
206206   device_t *io56xx = machine().device("56xx");
207207   int bit = !BIT(offset, 11);
208208
209   logerror("%04x: freset %d\n",cpu_get_pc(&space.device()), bit);
209   logerror("%04x: freset %d\n",space.device().safe_pc(), bit);
210210
211211   namcoio_set_reset_line(io58xx, bit ? CLEAR_LINE : ASSERT_LINE);
212212   namcoio_set_reset_line(io56xx, bit ? CLEAR_LINE : ASSERT_LINE);
trunk/src/mame/drivers/seta2.c
r17788r17789
124124      int banks = (machine().root_device().memregion( "x1snd" )->bytes() - 0x100000) / 0x20000;
125125      if (data >= banks)
126126      {
127         logerror("CPU #0 PC %06X: invalid sound bank %04X\n",cpu_get_pc(&space.device()),data);
127         logerror("CPU #0 PC %06X: invalid sound bank %04X\n",space.device().safe_pc(),data);
128128         data %= banks;
129129      }
130130      memcpy(ROM + offset * 0x20000, ROM + 0x100000 + data * 0x20000, 0x20000);
trunk/src/mame/drivers/zn.c
r17788r17789
18061806      else if (ACCESSING_BITS_16_31)
18071807      {
18081808         m_bam2_mcu_command = data>>16;
1809         logerror("MCU command: %04x (PC %08x)\n", m_bam2_mcu_command, cpu_get_pc(&space.device()));
1809         logerror("MCU command: %04x (PC %08x)\n", m_bam2_mcu_command, space.device().safe_pc());
18101810      }
18111811   }
18121812}
r17788r17789
18161816   switch (offset)
18171817   {
18181818      case 0:
1819         logerror("MCU port 0 read @ PC %08x mask %08x\n", cpu_get_pc(&space.device()), mem_mask);
1819         logerror("MCU port 0 read @ PC %08x mask %08x\n", space.device().safe_pc(), mem_mask);
18201820         break;
18211821
18221822      case 1:
1823         logerror("MCU status read @ PC %08x mask %08x\n", cpu_get_pc(&space.device()), mem_mask);
1823         logerror("MCU status read @ PC %08x mask %08x\n", space.device().safe_pc(), mem_mask);
18241824
18251825         switch (m_bam2_mcu_command)
18261826         {
trunk/src/mame/drivers/paradise.c
r17788r17789
9999
100100   if (bank >= bank_n)
101101   {
102      logerror("PC %04X - invalid rom bank %x\n", cpu_get_pc(&space.device()), bank);
102      logerror("PC %04X - invalid rom bank %x\n", space.device().safe_pc(), bank);
103103      bank %= bank_n;
104104   }
105105
trunk/src/mame/drivers/fitfight.c
r17788r17789
220220
221221READ8_MEMBER(fitfight_state::snd_porta_r)
222222{
223   //mame_printf_debug("PA R @%x\n",cpu_get_pc(&space.device()));
223   //mame_printf_debug("PA R @%x\n",space.device().safe_pc());
224224   return machine().rand();
225225}
226226
227227READ8_MEMBER(fitfight_state::snd_portb_r)
228228{
229   //mame_printf_debug("PB R @%x\n",cpu_get_pc(&space.device()));
229   //mame_printf_debug("PB R @%x\n",space.device().safe_pc());
230230   return machine().rand();
231231}
232232
233233READ8_MEMBER(fitfight_state::snd_portc_r)
234234{
235   //mame_printf_debug("PC R @%x\n",cpu_get_pc(&space.device()));
235   //mame_printf_debug("PC R @%x\n",space.device().safe_pc());
236236   return machine().rand();
237237}
238238
239239WRITE8_MEMBER(fitfight_state::snd_porta_w)
240240{
241   //mame_printf_debug("PA W %x @%x\n",data,cpu_get_pc(&space.device()));
241   //mame_printf_debug("PA W %x @%x\n",data,space.device().safe_pc());
242242}
243243
244244WRITE8_MEMBER(fitfight_state::snd_portb_w)
245245{
246   //mame_printf_debug("PB W %x @%x\n",data,cpu_get_pc(&space.device()));
246   //mame_printf_debug("PB W %x @%x\n",data,space.device().safe_pc());
247247}
248248
249249WRITE8_MEMBER(fitfight_state::snd_portc_w)
250250{
251   //mame_printf_debug("PC W %x @%x\n",data,cpu_get_pc(&space.device()));
251   //mame_printf_debug("PC W %x @%x\n",data,space.device().safe_pc());
252252}
253253
254254static ADDRESS_MAP_START( snd_io, AS_IO, 8, fitfight_state )
trunk/src/mame/drivers/deco32.c
r17788r17789
314314//      return 0xffffff80 | vblank | (0x40); //test for lock load guns
315315   }
316316
317   logerror("%08x: Unmapped IRQ read %08x (%08x)\n",cpu_get_pc(&space.device()),offset,mem_mask);
317   logerror("%08x: Unmapped IRQ read %08x (%08x)\n",space.device().safe_pc(),offset,mem_mask);
318318   return 0xffffffff;
319319}
320320
r17788r17789
324324
325325   switch (offset) {
326326   case 0: /* IRQ enable - probably an irq mask, but only values used are 0xc8 and 0xca */
327//      logerror("%08x:  IRQ write %d %08x\n",cpu_get_pc(&space.device()),offset,data);
327//      logerror("%08x:  IRQ write %d %08x\n",space.device().safe_pc(),offset,data);
328328      m_raster_enable=(data&0xff)==0xc8; /* 0xca seems to be off */
329329      break;
330330
r17788r17789
364364   case 0xed4: return ioport("IN2")->read(); /* Misc */
365365   }
366366
367   logerror("%08x: Unmapped protection read %04x\n",cpu_get_pc(&space.device()),offset<<2);
367   logerror("%08x: Unmapped protection read %04x\n",space.device().safe_pc(),offset<<2);
368368   return 0xffffffff;
369369}
370370
r17788r17789
405405
406406READ32_MEMBER(deco32_state::dragngun_service_r)
407407{
408//  logerror("%08x:Read service\n",cpu_get_pc(&space.device()));
408//  logerror("%08x:Read service\n",space.device().safe_pc());
409409   return ioport("IN2")->read();
410410}
411411
412412READ32_MEMBER(deco32_state::lockload_gun_mirror_r)
413413{
414//logerror("%08x:Read gun %d\n",cpu_get_pc(&space.device()),offset);
414//logerror("%08x:Read gun %d\n",space.device().safe_pc(),offset);
415415//return ((machine().rand()%0xffff)<<16) | machine().rand()%0xffff;
416416   if (offset) /* Mirror of player 1 and player 2 fire buttons */
417417      return ioport("IN4")->read() | ((machine().rand()%0xff)<<16);
r17788r17789
420420
421421READ32_MEMBER(deco32_state::dragngun_prot_r)
422422{
423//  logerror("%08x:Read prot %08x (%08x)\n",cpu_get_pc(&space.device()),offset<<1,mem_mask);
423//  logerror("%08x:Read prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask);
424424
425425   if (!m_strobe) m_strobe=8;
426426   else m_strobe=0;
r17788r17789
487487   case 0x35a: return m_tattass_eprom_bit << 16;
488488   }
489489
490   logerror("%08x:Read prot %08x (%08x)\n",cpu_get_pc(&space.device()),offset<<1,mem_mask);
490   logerror("%08x:Read prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask);
491491
492492   return 0xffffffff;
493493}
r17788r17789
645645   case 0x35a: return (machine().device<eeprom_device>("eeprom")->read_bit()<< 16) | 0xffff; // Debug switch in low word??
646646   }
647647
648   //logerror("%08x: Read unmapped prot %08x (%08x)\n",cpu_get_pc(&space.device()),offset<<1,mem_mask);
648   //logerror("%08x: Read unmapped prot %08x (%08x)\n",space.device().safe_pc(),offset<<1,mem_mask);
649649
650650   return 0xffffffff;
651651}
r17788r17789
666666
667667WRITE32_MEMBER(deco32_state::nslasher_prot_w)
668668{
669   //logerror("%08x:write prot %08x (%08x) %08x\n",cpu_get_pc(&space.device()),offset<<1,mem_mask,data);
669   //logerror("%08x:write prot %08x (%08x) %08x\n",space.device().safe_pc(),offset<<1,mem_mask,data);
670670
671671   /* Only sound port of chip is used - no protection */
672672   if (offset==0x700/4) {
trunk/src/mame/drivers/malzak.c
r17788r17789
152152//  Bits 1-3 are all set high upon death, until the game continues
153153//  Bit 6 is used only in Malzak II, and is set high after checking
154154//        the selected version
155//  logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n", cpu_get_pc(machine().device("maincpu")), data);
155//  logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n", machine().device("maincpu")->safe_pc(), data);
156156   membank("bank1")->set_entry((data & 0x40) >> 6);
157157}
158158
trunk/src/mame/drivers/midzeus.c
r17788r17789
134134   if (bitlatch[2] && !cmos_protected)
135135      COMBINE_DATA(&m_nvram[offset]);
136136   else
137      logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", cpu_get_pc(&space.device()), bitlatch[2], cmos_protected);
137      logerror("%06X:timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", space.device().safe_pc(), bitlatch[2], cmos_protected);
138138   cmos_protected = TRUE;
139139}
140140
r17788r17789
188188   if (bitlatch[2])
189189      COMBINE_DATA(&m_nvram[offset]);
190190   else
191      logerror("%06X:zpram_w with bitlatch[2] = %d\n", cpu_get_pc(&space.device()), bitlatch[2]);
191      logerror("%06X:zpram_w with bitlatch[2] = %d\n", space.device().safe_pc(), bitlatch[2]);
192192}
193193
194194
r17788r17789
229229
230230      /* unknown purpose */
231231      default:
232         logerror("%06X:bitlatches_r(%X)\n", cpu_get_pc(&space.device()), offset);
232         logerror("%06X:bitlatches_r(%X)\n", space.device().safe_pc(), offset);
233233         break;
234234   }
235235   return ~0;
r17788r17789
246246      /* unknown purpose */
247247      default:
248248         if (oldval ^ data)
249            logerror("%06X:bitlatches_w(%X) = %X\n", cpu_get_pc(&space.device()), offset, data);
249            logerror("%06X:bitlatches_w(%X) = %X\n", space.device().safe_pc(), offset, data);
250250         break;
251251
252252      /* unknown purpose; crusnexo toggles this between 0 and 1 every 20 frames; thegrid writes 1 */
253253      case 0:
254254         if (data != 0 && data != 1)
255            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data);
255            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data);
256256         break;
257257
258258      /* unknown purpose; mk4/invasn write 1 here at initialization; crusnexo/thegrid write 3 */
259259      case 1:
260260         if (data != 1 && data != 3)
261            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data);
261            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data);
262262         break;
263263
264264      /* CMOS/ZPRAM extra enable latch; only low bit is used */
r17788r17789
268268      /* unknown purpose; invasn writes 2 here at startup */
269269      case 4:
270270         if (data != 2)
271            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data);
271            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data);
272272         break;
273273
274274      /* ROM bank selection on Zeus 2 */
r17788r17789
279279      /* unknown purpose; crusnexo/thegrid write 1 at startup */
280280      case 7:
281281         if (data != 1)
282            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data);
282            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data);
283283         break;
284284
285285      /* unknown purpose; crusnexo writes 4 at startup; thegrid writes 6 */
286286      case 8:
287287         if (data != 4 && data != 6)
288            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data);
288            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data);
289289         break;
290290
291291      /* unknown purpose; thegrid writes 1 at startup */
292292      case 9:
293293         if (data != 1)
294            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", cpu_get_pc(&space.device()), offset, data);
294            logerror("%06X:bitlatches_w(%X) = %X (unexpected)\n", space.device().safe_pc(), offset, data);
295295         break;
296296   }
297297}
r17788r17789
357357
358358READ32_MEMBER(midzeus_state::linkram_r)
359359{
360   logerror("%06X:unknown_8a000_r(%02X)\n", cpu_get_pc(&space.device()), offset);
360   logerror("%06X:unknown_8a000_r(%02X)\n", space.device().safe_pc(), offset);
361361   if (offset == 0)
362362      return 0x30313042;
363363   else if (offset == 0x3c)
r17788r17789
367367
368368WRITE32_MEMBER(midzeus_state::linkram_w)
369369{
370   logerror("%06X:unknown_8a000_w(%02X) = %08X\n", cpu_get_pc(&space.device()),  offset, data);
370   logerror("%06X:unknown_8a000_w(%02X) = %08X\n", space.device().safe_pc(),  offset, data);
371371   COMBINE_DATA(&linkram[offset]);
372372}
373373
r17788r17789
392392
393393   /* log anything else except the memory control register */
394394   if (offset != 0x64)
395      logerror("%06X:tms32031_control_r(%02X)\n", cpu_get_pc(&space.device()), offset);
395      logerror("%06X:tms32031_control_r(%02X)\n", space.device().safe_pc(), offset);
396396
397397   return tms32031_control[offset];
398398}
r17788r17789
414414         timer[which]->adjust(attotime::never);
415415   }
416416   else
417      logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data);
417      logerror("%06X:tms32031_control_w(%02X) = %08X\n", space.device().safe_pc(), offset, data);
418418}
419419
420420
r17788r17789
465465{
466466   static const char * const tags[] = { "ANALOG0", "ANALOG1", "ANALOG2", "ANALOG3" };
467467   if (offset < 8 || offset > 11)
468      logerror("%06X:analog_r(%X)\n", cpu_get_pc(&space.device()), offset);
468      logerror("%06X:analog_r(%X)\n", space.device().safe_pc(), offset);
469469   return ioport(tags[offset & 3])->read();
470470}
471471
trunk/src/mame/drivers/tomcat.c
r17788r17789
223223
224224READ16_MEMBER(tomcat_state::dsp_BIO_r)
225225{
226   if ( cpu_get_pc(&space.device()) == 0x0001 )
226   if ( space.device().safe_pc() == 0x0001 )
227227   {
228228      if ( m_dsp_idle == 0 )
229229      {
r17788r17789
232232      }
233233      return !m_dsp_BIO;
234234   }
235   else if ( cpu_get_pc(&space.device()) == 0x0003 )
235   else if ( space.device().safe_pc() == 0x0003 )
236236   {
237237      if ( m_dsp_BIO == 1 )
238238      {
trunk/src/mame/drivers/fastfred.c
r17788r17789
2121// to change if a different ROM set ever surfaces.
2222READ8_MEMBER(fastfred_state::fastfred_custom_io_r)
2323{
24    switch (cpu_get_pc(&space.device()))
24    switch (space.device().safe_pc())
2525    {
2626    case 0x03c0: return 0x9d;
2727    case 0x03e6: return 0x9f;
r17788r17789
4747    case 0x7b58: return 0x20;
4848    }
4949
50    logerror("Uncaught custom I/O read %04X at %04X\n", 0xc800+offset, cpu_get_pc(&space.device()));
50    logerror("Uncaught custom I/O read %04X at %04X\n", 0xc800+offset, space.device().safe_pc());
5151    return 0x00;
5252}
5353
5454READ8_MEMBER(fastfred_state::flyboy_custom1_io_r)
5555{
5656
57   switch (cpu_get_pc(&space.device()))
57   switch (space.device().safe_pc())
5858   {
5959    case 0x049d: return 0xad;   /* compare */
6060    case 0x04b9:         /* compare with 0x9e ??? When ??? */
r17788r17789
7575    return 0x00;
7676   }
7777
78   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc085+offset, cpu_get_pc(&space.device()));
78   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc085+offset, space.device().safe_pc());
7979   return 0x00;
8080}
8181
8282READ8_MEMBER(fastfred_state::flyboy_custom2_io_r)
8383{
8484
85   switch (cpu_get_pc(&space.device()))
85   switch (space.device().safe_pc())
8686   {
8787    case 0x0395: return 0xf7;   /* $C900 compare         */
8888    case 0x03f5:         /* $c8fd                 */
r17788r17789
100100    return 0x00;
101101   }
102102
103   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc8fb+offset, cpu_get_pc(&space.device()));
103   logerror("Uncaught custom I/O read %04X at %04X\n", 0xc8fb+offset, space.device().safe_pc());
104104   return 0x00;
105105}
106106
trunk/src/mame/drivers/lwings.c
r17788r17789
106106
107107WRITE8_MEMBER(lwings_state::avengers_protection_w)
108108{
109   int pc = cpu_get_pc(&space.device());
109   int pc = space.device().safe_pc();
110110
111111   if (pc == 0x2eeb)
112112   {
r17788r17789
238238   int x, y;
239239   int dx, dy, dist, dir;
240240
241   if (cpu_get_pc(&space.device()) == 0x7c7)
241   if (space.device().safe_pc() == 0x7c7)
242242   {
243243      /* palette data */
244244      return avengers_fetch_paldata(machine());
trunk/src/mame/drivers/xtheball.c
r17788r17789
127127   {
128128      if (bitvals[offset] != (data & 1))
129129      {
130         logerror("%08x:bit_controls_w(%x,%d)\n", cpu_get_pc(&space.device()), offset, data & 1);
130         logerror("%08x:bit_controls_w(%x,%d)\n", space.device().safe_pc(), offset, data & 1);
131131
132132         switch (offset)
133133         {
trunk/src/mame/drivers/punchout.c
r17788r17789
154154
155155READ8_MEMBER(punchout_state::spunchout_rp5c01_r)
156156{
157   logerror("%04x: prot_r %x\n", cpu_get_previouspc(&space.device()), offset);
157   logerror("%04x: prot_r %x\n", space.device().safe_pcbase(), offset);
158158
159159   if (offset <= 0x0c)
160160   {
r17788r17789
266266{
267267   data &= 0x0f;
268268
269   logerror("%04x: prot_w %x = %02x\n",cpu_get_previouspc(&space.device()),offset,data);
269   logerror("%04x: prot_w %x = %02x\n",space.device().safe_pcbase(),offset,data);
270270
271271   if (offset <= 0x0c)
272272   {
r17788r17789
301301   /* PC = 0x0313 */
302302   /* (ret or 0x10) -> (D7DF),(D7A0) - (D7DF),(D7A0) = 0d0h(ret nc) */
303303
304   if (cpu_get_previouspc(&space.device()) == 0x0313)
304   if (space.device().safe_pcbase() == 0x0313)
305305      ret |= 0xc0;
306306
307307   return ret;
trunk/src/mame/drivers/88games.c
r17788r17789
269269   UINT8 *RAM = state->memregion("maincpu")->base();
270270   int offs;
271271
272   logerror("%04x: bank select %02x\n", cpu_get_pc(device), lines);
272   logerror("%04x: bank select %02x\n", device->safe_pc(), lines);
273273
274274   /* bits 0-2 select ROM bank for 0000-1fff */
275275   /* bit 3: when 1, palette RAM at 1000-1fff */
trunk/src/mame/drivers/ddenlovr.c
r17788r17789
824824                     ;
825825            #ifdef MAME_DEBUG
826826               popmessage("unknown blitter command %02x", data);
827               logerror("%06x: unknown blitter command %02x\n", cpu_get_pc(&space->device()), data);
827               logerror("%06x: unknown blitter command %02x\n", space->device().safe_pc(), data);
828828            #endif
829829         }
830830
r17788r17789
843843         break;
844844
845845      default:
846         logerror("%06x: Blitter %d reg %02x = %02x\n", cpu_get_pc(&space->device()), blitter, state->m_ddenlovr_blit_regs[blitter], data);
846         logerror("%06x: Blitter %d reg %02x = %02x\n", space->device().safe_pc(), blitter, state->m_ddenlovr_blit_regs[blitter], data);
847847         break;
848848      }
849849   }
r17788r17789
11901190                     ;
11911191            #ifdef MAME_DEBUG
11921192               popmessage("unknown blitter command %02x", data);
1193               logerror("%06x: unknown blitter command %02x\n", cpu_get_pc(&space.device()), data);
1193               logerror("%06x: unknown blitter command %02x\n", space.device().safe_pc(), data);
11941194            #endif
11951195         }
11961196
r17788r17789
11991199         break;
12001200
12011201      default:
1202         logerror("%06x: Blitter 0 reg %02x = %02x\n", cpu_get_pc(&space.device()), m_ddenlovr_blit_latch, data);
1202         logerror("%06x: Blitter 0 reg %02x = %02x\n", space.device().safe_pc(), m_ddenlovr_blit_latch, data);
12031203         break;
12041204   }
12051205
r17788r17789
12441244
12451245   if (address >= size)
12461246   {
1247      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space.device()), address);
1247      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", space.device().safe_pc(), address);
12481248      address %= size;
12491249   }
12501250
r17788r17789
15891589
15901590READ8_MEMBER(dynax_state::rongrong_input2_r)
15911591{
1592//  logerror("%04x: input2_r offset %d select %x\n", cpu_get_pc(&space.device()), offset, m_input_sel);
1592//  logerror("%04x: input2_r offset %d select %x\n", space.device().safe_pc(), offset, m_input_sel);
15931593   /* 0 and 1 are read from offset 1, 2 from offset 0... */
15941594   switch (m_input_sel)
15951595   {
r17788r17789
16151615
16161616READ16_MEMBER(dynax_state::quiz365_input2_r)
16171617{
1618//  logerror("%04x: input2_r offset %d select %x\n",cpu_get_pc(&space.device()), offset, m_input_sel);
1618//  logerror("%04x: input2_r offset %d select %x\n",space.device().safe_pc(), offset, m_input_sel);
16191619   /* 0 and 1 are read from offset 1, 2 from offset 0... */
16201620   switch (m_input_sel)
16211621   {
r17788r17789
16321632   m_rongrong_blitter_busy_select = data;
16331633
16341634   if (data != 0x18)
1635      logerror("%04x: rongrong_blitter_busy_w data = %02x\n", cpu_get_pc(&space.device()), data);
1635      logerror("%04x: rongrong_blitter_busy_w data = %02x\n", space.device().safe_pc(), data);
16361636}
16371637
16381638READ8_MEMBER(dynax_state::rongrong_blitter_busy_r)
r17788r17789
16421642      case 0x18:   return 0;   // bit 5 = blitter busy
16431643
16441644      default:
1645         logerror("%04x: rongrong_blitter_busy_r with select = %02x\n", cpu_get_pc(&space.device()), m_rongrong_blitter_busy_select);
1645         logerror("%04x: rongrong_blitter_busy_r with select = %02x\n", space.device().safe_pc(), m_rongrong_blitter_busy_select);
16461646   }
16471647   return 0xff;
16481648}
r17788r17789
19691969
19701970WRITE8_MEMBER(dynax_state::rongrong_select_w)
19711971{
1972//logerror("%04x: rongrong_select_w %02x\n",cpu_get_pc(&space.device()),data);
1972//logerror("%04x: rongrong_select_w %02x\n",space.device().safe_pc(),data);
19731973
19741974   /* bits 0-4 = **both** ROM bank **AND** input select */
19751975   membank("bank1")->set_entry(data & 0x1f);
r17788r17789
22382238   if (!BIT(m_dsw_sel, 0))  return ioport("DSW1")->read();
22392239   if (!BIT(m_dsw_sel, 1))  return ioport("DSW2")->read();
22402240   if (!BIT(m_dsw_sel, 2))  return ioport("DSW3")->read();
2241   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
2241   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", space.device().safe_pc(), m_dsw_sel);
22422242   return 0xff;
22432243}
22442244
r17788r17789
22492249      case 0x22:   return ioport("IN2")->read();
22502250      case 0x23:   return m_funkyfig_lockout;
22512251   }
2252   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
2252   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", space.device().safe_pc(), m_input_sel);
22532253   return 0xff;
22542254}
22552255
r17788r17789
22602260      case 0x20:   return ioport("IN0")->read();
22612261      case 0x21:   return ioport("IN1")->read();
22622262   }
2263   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
2263   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", space.device().safe_pc(), m_input_sel);
22642264   return 0xff;
22652265}
22662266
r17788r17789
22732273         coin_counter_w(machine(), 0,   data  & 0x01);
22742274         coin_lockout_w(machine(), 0, (~data) & 0x02);
22752275         if (data & ~0x03)
2276            logerror("%06x: warning, unknown bits written, lockout = %02x\n", cpu_get_pc(&space.device()), data);
2276            logerror("%06x: warning, unknown bits written, lockout = %02x\n", space.device().safe_pc(), data);
22772277         break;
22782278
22792279//      case 0xef:  16 bytes on startup
22802280
22812281      default:
2282         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
2282         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data);
22832283   }
22842284}
22852285
r17788r17789
23912391
23922392   if (address >= size)
23932393   {
2394      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space.device()), address);
2394      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", space.device().safe_pc(), address);
23952395      address %= size;
23962396   }
23972397
r17788r17789
24222422   coin_counter_w(machine(), 1, data & 2);
24232423
24242424   if (data & 0xf0)
2425      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
2425      logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data);
24262426
24272427#ifdef MAME_DEBUG
24282428//      popmessage("93 = %02x", data);
r17788r17789
26202620   coin_lockout_w(machine(), 0, (~data) & 0x08);
26212621
26222622   if (data & 0x74)
2623      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
2623      logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data);
26242624
26252625#ifdef MAME_DEBUG
26262626//    popmessage("40 = %02x",data);
r17788r17789
26782678WRITE8_MEMBER(dynax_state::mjmyster_rambank_w)
26792679{
26802680   membank("bank2")->set_entry(data & 0x07);
2681   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data);
2681   //logerror("%04x: rambank = %02x\n", space.device().safe_pc(), data);
26822682}
26832683
26842684WRITE8_MEMBER(dynax_state::mjmyster_select2_w)
r17788r17789
26992699      case 0x03:   return 0xff;
27002700   }
27012701
2702   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
2702   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", space.device().safe_pc(), m_input_sel);
27032703
27042704   return 0xff;
27052705}
r17788r17789
27132713   else if (BIT(m_keyb, 2))   ret = ioport("KEY2")->read();
27142714   else if (BIT(m_keyb, 3))   ret = ioport("KEY3")->read();
27152715   else if (BIT(m_keyb, 4))   ret = ioport("KEY4")->read();
2716   else   logerror("%06x: warning, unknown bits read, keyb = %02x\n", cpu_get_pc(&space.device()), m_keyb);
2716   else   logerror("%06x: warning, unknown bits read, keyb = %02x\n", space.device().safe_pc(), m_keyb);
27172717
27182718   m_keyb <<= 1;
27192719
r17788r17789
27272727   if (!BIT(m_dsw_sel, 2))   return ioport("DSW2")->read();
27282728   if (!BIT(m_dsw_sel, 3))   return ioport("DSW1")->read();
27292729   if (!BIT(m_dsw_sel, 4))   return ioport("DSW5")->read();
2730   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
2730   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", space.device().safe_pc(), m_dsw_sel);
27312731   return 0xff;
27322732}
27332733
r17788r17789
27452745         break;
27462746
27472747      default:
2748         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
2748         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data);
27492749   }
27502750}
27512751
r17788r17789
28412841      case 0x22:   return 0x7f;   // bit 7 = blitter busy, bit 6 = hopper
28422842      case 0x23:   return m_coins;
28432843   }
2844   logerror("%04x: coins_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
2844   logerror("%04x: coins_r with select = %02x\n", space.device().safe_pc(), m_input_sel);
28452845   return 0xff;
28462846}
28472847
r17788r17789
28702870         m_coins = data;
28712871         break;
28722872      default:
2873         logerror("%04x: coins_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
2873         logerror("%04x: coins_w with select = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data);
28742874   }
28752875}
28762876
r17788r17789
28922892      case 0xa2:
28932893         return ioport(keynames1[m_keyb++])->read();
28942894   }
2895   logerror("%04x: input_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
2895   logerror("%04x: input_r with select = %02x\n", space.device().safe_pc(), m_input_sel);
28962896   return 0xff;
28972897}
28982898
r17788r17789
29852985      case 0x22:   return hgokou_player_r(&space, 0);
29862986      case 0x23:   return m_coins;
29872987   }
2988   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
2988   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", space.device().safe_pc(), m_dsw_sel);
29892989   return 0xff;
29902990}
29912991
r17788r17789
30123012      case 0x2f:   break;   // ? written with 2f (hgokou)
30133013
30143014      default:
3015         logerror("%04x: input_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel, data);
3015         logerror("%04x: input_w with select = %02x, data = %02x\n", space.device().safe_pc(), m_dsw_sel, data);
30163016   }
30173017}
30183018
r17788r17789
30883088         m_input_sel |= 1;
30893089         return ret;
30903090   }
3091   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
3091   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", space.device().safe_pc(), m_dsw_sel);
30923092   return 0xff;
30933093}
30943094
r17788r17789
31483148      case 0x80:   return ioport(keynames0[m_keyb++])->read();   // P1 (Keys)
31493149      case 0x81:   return ioport(keynames1[m_keyb++])->read();   // P2 (Keys)
31503150   }
3151   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
3151   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", space.device().safe_pc(), m_input_sel);
31523152   return 0xff;
31533153}
31543154
r17788r17789
31693169      case 0x0c:   coin_counter_w(machine(), 0, data & 1);   break;
31703170      case 0x0d:   break;
31713171      default:
3172         logerror("%04x: coins_w with select = %02x, data = %02x\n",cpu_get_pc(&space.device()), m_input_sel, data);
3172         logerror("%04x: coins_w with select = %02x, data = %02x\n",space.device().safe_pc(), m_input_sel, data);
31733173   }
31743174}
31753175
r17788r17789
32203220      case 0x83:   return 0x00;
32213221   }
32223222
3223   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
3223   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", space.device().safe_pc(), m_input_sel);
32243224
32253225   return 0xff;
32263226}
r17788r17789
34003400
34013401   if (data & 0xfe)
34023402   {
3403      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
3403      logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data);
34043404//      popmessage("COIN = %02x", data);
34053405   }
34063406}
r17788r17789
35173517   m_hopper = data & 0x04;
35183518
35193519   if (data & 0x68)
3520      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
3520      logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data);
35213521
35223522#ifdef MAME_DEBUG
35233523//  popmessage("COIN = %02x", data);
r17788r17789
35273527WRITE8_MEMBER(dynax_state::sryudens_rambank_w)
35283528{
35293529   membank("bank2")->set_entry(data & 0x0f);
3530   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data);
3530   //logerror("%04x: rambank = %02x\n", space.device().safe_pc(), data);
35313531}
35323532
35333533static ADDRESS_MAP_START( sryudens_portmap, AS_IO, 8, dynax_state )
r17788r17789
35773577   coin_counter_w(machine(), 1, data & 2);
35783578
35793579   if (data & ~0x8b)
3580      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
3580      logerror("%04x: warning, coin counter = %02x\n", space.device().safe_pc(), data);
35813581
35823582#ifdef MAME_DEBUG
35833583//  popmessage("COIN = %02x", data);
trunk/src/mame/drivers/kaneko16.c
r17788r17789
337337   {
338338      okim6295_device *oki = downcast<okim6295_device *>(device);
339339      oki->set_bank_base(0x40000 * (data & 0xf) );
340//      logerror("CPU #0 PC %06X : OKI0  bank %08X\n",cpu_get_pc(&space->device()),data);
340//      logerror("CPU #0 PC %06X : OKI0  bank %08X\n",space->device().safe_pc(),data);
341341   }
342342}
343343
r17788r17789
348348   {
349349      okim6295_device *oki = downcast<okim6295_device *>(device);
350350      oki->set_bank_base(0x40000 * data );
351//      logerror("CPU #0 PC %06X : OKI1  bank %08X\n",cpu_get_pc(&space->device()),data);
351//      logerror("CPU #0 PC %06X : OKI1  bank %08X\n",space->device().safe_pc(),data);
352352   }
353353}
354354
r17788r17789
478478   {
479479      okim6295_device *oki = downcast<okim6295_device *>(device);
480480      oki->set_bank_base( 0x40000 * (data & 0xF) );
481//      logerror("CPU #0 PC %06X : OKI0 bank %08X\n",cpu_get_pc(&space->device()),data);
481//      logerror("CPU #0 PC %06X : OKI0 bank %08X\n",space->device().safe_pc(),data);
482482   }
483483}
484484
r17788r17789
489489   {
490490      okim6295_device *oki = downcast<okim6295_device *>(device);
491491      oki->set_bank_base( 0x40000 * (data & 0x1) );
492//      logerror("CPU #0 PC %06X : OKI1 bank %08X\n",cpu_get_pc(&space->device()),data);
492//      logerror("CPU #0 PC %06X : OKI1 bank %08X\n",space->device().safe_pc(),data);
493493   }
494494}
495495
r17788r17789
552552      case 0x0800:   // 360' Wheel
553553         return   (ioport("WHEEL2")->read() << 8);
554554      default:
555         logerror("gtmr2_wheel_r : read at %06x with joystick\n", cpu_get_pc(&space.device()));
555         logerror("gtmr2_wheel_r : read at %06x with joystick\n", space.device().safe_pc());
556556         return   (~0);
557557   }
558558}
trunk/src/mame/drivers/namcos10.c
r17788r17789
421421
422422WRITE32_MEMBER(namcos10_state::nand_address1_w )
423423{
424   logerror("nand_a1_w %08x (%08x)\n", data, cpu_get_pc(&space.device()));
424   logerror("nand_a1_w %08x (%08x)\n", data, space.device().safe_pc());
425425   nand_address = ( nand_address & 0x00ffffff ) | ( ( data & 0xff ) << 24 );
426426}
427427
428428WRITE32_MEMBER(namcos10_state::nand_address2_w )
429429{
430   logerror("nand_a2_w %08x (%08x)\n", data, cpu_get_pc(&space.device()));
430   logerror("nand_a2_w %08x (%08x)\n", data, space.device().safe_pc());
431431   nand_address = ( nand_address & 0xff00ffff ) | ( ( data & 0xff ) << 16 );
432432}
433433
434434WRITE32_MEMBER(namcos10_state::nand_address3_w )
435435{
436   logerror("nand_a3_w %08x (%08x)\n", data, cpu_get_pc(&space.device()));
436   logerror("nand_a3_w %08x (%08x)\n", data, space.device().safe_pc());
437437   nand_address = ( nand_address & 0xffff00ff ) | ( ( data & 0xff ) << 8 );
438438}
439439
440440WRITE32_MEMBER(namcos10_state::nand_address4_w )
441441{
442   logerror("nand_a4_w %08x (%08x)\n", data, cpu_get_pc(&space.device()));
442   logerror("nand_a4_w %08x (%08x)\n", data, space.device().safe_pc());
443443   nand_address = ( nand_address & 0xffffff00 ) | ( ( data & 0xff ) << 0 );
444444}
445445
trunk/src/mame/drivers/mcr3.c
r17788r17789
460460   /* Unfortunately, the game refuses to start if any bad ROM is   */
461461   /* found; to work around this, we catch the checksum byte read  */
462462   /* and modify it to what we know we will be getting.            */
463   if (cpu_get_previouspc(&space.device()) == 0xb29)
463   if (space.device().safe_pcbase() == 0xb29)
464464      return 0x82;
465465   else
466466      return 0x92;
trunk/src/mame/drivers/stadhero.c
r17788r17789
3434         return ioport("DSW")->read();
3535   }
3636
37   logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",cpu_get_pc(&space.device()),0x30c000+offset);
37   logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",space.device().safe_pc(),0x30c000+offset);
3838   return ~0;
3939}
4040
r17788r17789
4949         cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
5050         break;
5151      default:
52         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+offset);
52         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+offset);
5353         break;
5454   }
5555}
trunk/src/mame/drivers/viper.c
r17788r17789
683683      const char *regname = epic_get_register_name(reg);
684684      if (regname)
685685      {
686         printf("EPIC: read %08X (%s) at %08X\n", reg, regname, cpu_get_pc(&space.device()));
686         printf("EPIC: read %08X (%s) at %08X\n", reg, regname, space.device().safe_pc());
687687      }
688688      else
689689      {
690         printf("EPIC: read %08X at %08X\n", reg, cpu_get_pc(&space.device()));
690         printf("EPIC: read %08X at %08X\n", reg, space.device().safe_pc());
691691      }
692692   }
693693
r17788r17789
868868      const char *regname = epic_get_register_name(reg);
869869      if (regname)
870870      {
871         printf("EPIC: write %08X, %08X (%s) at %08X\n", data, reg, regname, cpu_get_pc(&space.device()));
871         printf("EPIC: write %08X, %08X (%s) at %08X\n", data, reg, regname, space.device().safe_pc());
872872      }
873873      else
874874      {
875         printf("EPIC: write %08X, %08X at %08X\n", data, reg, cpu_get_pc(&space.device()));
875         printf("EPIC: write %08X, %08X at %08X\n", data, reg, space.device().safe_pc());
876876      }
877877   }
878878
r17788r17789
14481448      }
14491449
14501450      default:
1451         fatalerror("voodoo3_pci_r: %08X at %08X\n", reg, cpu_get_pc(device->machine().device("maincpu")));
1451         fatalerror("voodoo3_pci_r: %08X at %08X\n", reg, device->machine().device("maincpu")->safe_pc());
14521452   }
14531453   return 0;
14541454}
r17788r17789
15181518      }
15191519
15201520      default:
1521         fatalerror("voodoo3_pci_w: %08X, %08X at %08X\n", data, reg, cpu_get_pc(device->machine().device("maincpu")));
1521         fatalerror("voodoo3_pci_w: %08X, %08X at %08X\n", data, reg, device->machine().device("maincpu")->safe_pc());
15221522   }
15231523}
15241524
r17788r17789
15291529}
15301530WRITE64_MEMBER(viper_state::voodoo3_io_w)
15311531{
1532//  printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device()));
1532//  printf("voodoo3_io_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, space.device().safe_pc());
15331533
15341534   device_t *device = machine().device("voodoo");
15351535   write64be_with_32le_device_handler(banshee_io_w, device, offset, data, mem_mask);
r17788r17789
15421542}
15431543WRITE64_MEMBER(viper_state::voodoo3_w)
15441544{
1545//  printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device()));
1545//  printf("voodoo3_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, space.device().safe_pc());
15461546
15471547   device_t *device = machine().device("voodoo");
15481548   write64be_with_32le_device_handler(banshee_w, device,  offset, data, mem_mask);
r17788r17789
15551555}
15561556WRITE64_MEMBER(viper_state::voodoo3_lfb_w)
15571557{
1558//  printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, cpu_get_pc(&space.device()));
1558//  printf("voodoo3_lfb_w: %08X%08X, %08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), offset, space.device().safe_pc());
15591559
15601560   device_t *device = machine().device("voodoo");
15611561   write64be_with_32le_device_handler(banshee_fb_w, device, offset, data, mem_mask);
r17788r17789
17521752      ds2430_bit_timer->reset();
17531753      ds2430_bit_timer->start_time();
17541754
1755//      printf("e70000_r: %08X (mask %08X%08X) at %08X\n", offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu_get_pc(cpu));
1755//      printf("e70000_r: %08X (mask %08X%08X) at %08X\n", offset, (UINT32)(mem_mask >> 32), (UINT32)mem_mask, cpu->safe_pc());
17561756   }
17571757
17581758   return 0;
r17788r17789
17671767         ds2430_timer->adjust(attotime::from_usec(40), 1);   // presence pulse for 240 microsecs
17681768
17691769         unk1_bit = 1;
1770//          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()));
1770//          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());
17711771      }
17721772      else
17731773      {
r17788r17789
17921792{
17931793   if (ACCESSING_BITS_56_63)
17941794   {
1795   //  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));
1795   //  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());
17961796   }
17971797}
17981798
r17788r17789
18011801   if (ACCESSING_BITS_56_63)
18021802   {
18031803      unk1_bit = 0;
1804   //  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));
1804   //  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());
18051805   }
18061806}
18071807
trunk/src/mame/drivers/mw8080bw.c
r17788r17789
21912191      m_spcenctr_trench_width = data;         /*  -  -  -  -  -  1  1  1 */
21922192
21932193   else
2194      logerror("%04x:  Unmapped I/O port write to %02x = %02x\n", cpu_get_pc(&space.device()), offset, data);
2194      logerror("%04x:  Unmapped I/O port write to %02x = %02x\n", space.device().safe_pc(), offset, data);
21952195}
21962196
21972197
trunk/src/mame/drivers/suna8.c
r17788r17789
491491      case 2:   return ioport("DSW1")->read();
492492      case 3:   return ioport("DSW2")->read();
493493      default:
494         logerror("CPU #0 - PC %04X: Unknown IP read: %02X\n", cpu_get_pc(&space.device()), *m_hardhead_ip);
494         logerror("CPU #0 - PC %04X: Unknown IP read: %02X\n", space.device().safe_pc(), *m_hardhead_ip);
495495         return 0xff;
496496   }
497497}
r17788r17789
505505{
506506   int bank = data & 0x0f;
507507
508   if (data & ~0xef)   logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",cpu_get_pc(&space.device()),data);
508   if (data & ~0xef)   logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",space.device().safe_pc(),data);
509509   membank("bank1")->set_entry(bank);
510510}
511511
r17788r17789
561561   int bank = data & 0x07;
562562   if ((~data & 0x10) && (bank >= 4))   bank += 4;
563563
564   if (data & ~0xf7)   logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",cpu_get_pc(&space.device()),data);
564   if (data & ~0xf7)   logerror("CPU #0 - PC %04X: unknown bank bits: %02X\n",space.device().safe_pc(),data);
565565
566566   membank("bank1")->set_entry(bank);
567567
r17788r17789
653653   {
654654      m_palettebank = data & 0x01;
655655
656      logerror("CPU #0 - PC %04X: palettebank = %02X\n",cpu_get_pc(&space.device()),data);
657      if (data & ~0x01)   logerror("CPU #0 - PC %04X: unknown palettebank bits: %02X\n",cpu_get_pc(&space.device()),data);
656      logerror("CPU #0 - PC %04X: palettebank = %02X\n",space.device().safe_pc(),data);
657      if (data & ~0x01)   logerror("CPU #0 - PC %04X: unknown palettebank bits: %02X\n",space.device().safe_pc(),data);
658658   }
659659   else if ((m_protection_val & 0xfc) == 0x90)
660660   {
661661      soundlatch_byte_w(space, 0, data);
662662
663      logerror("CPU #0 - PC %04X: soundlatch = %02X\n",cpu_get_pc(&space.device()),data);
663      logerror("CPU #0 - PC %04X: soundlatch = %02X\n",space.device().safe_pc(),data);
664664   }
665665   else if ((m_protection_val & 0xfc) == 0x04)
666666   {
r17788r17789
668668      set_led_status(machine(), 1, data & 0x02);
669669      coin_counter_w(machine(), 0, data & 0x04);
670670
671      logerror("CPU #0 - PC %04X: leds = %02X\n",cpu_get_pc(&space.device()),data);
672      if (data & ~0x07)   logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",cpu_get_pc(&space.device()),data);
671      logerror("CPU #0 - PC %04X: leds = %02X\n",space.device().safe_pc(),data);
672      if (data & ~0x07)   logerror("CPU #0 - PC %04X: unknown leds bits: %02X\n",space.device().safe_pc(),data);
673673   }
674674   else if ((m_protection_val & 0xfc) == 0x9c)
675675   {
r17788r17789
678678
679679      // To be done: run-time opcode decryption change. Done in driver_init for now.
680680
681      logerror("CPU #0 - PC %04X: op-decrypt = %02X\n",cpu_get_pc(&space.device()),data);
681      logerror("CPU #0 - PC %04X: op-decrypt = %02X\n",space.device().safe_pc(),data);
682682   }
683683   else if ((m_protection_val & 0xfc) == 0x80)
684684   {
685685      // disables rom banking?
686686      // see code at 11b1:
687687
688      logerror("CPU #0 - PC %04X: rombank_disable = %02X\n",cpu_get_pc(&space.device()),data);
688      logerror("CPU #0 - PC %04X: rombank_disable = %02X\n",space.device().safe_pc(),data);
689689   }
690690   else
691691   {
692      logerror("CPU #0 - PC %04X: ignore = %02X\n",cpu_get_pc(&space.device()),data);
692      logerror("CPU #0 - PC %04X: ignore = %02X\n",space.device().safe_pc(),data);
693693   }
694694}
695695
r17788r17789
705705   flip_screen_set(data & 0x01);
706706   m_spritebank = (data >> 1) & 1;
707707
708   logerror("CPU #0 - PC %04X: protection_val = %02X\n",cpu_get_pc(&space.device()),data);
709//   if (data & ~0x03)   logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data);
708   logerror("CPU #0 - PC %04X: protection_val = %02X\n",space.device().safe_pc(),data);
709//   if (data & ~0x03)   logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data);
710710}
711711
712712/*
r17788r17789
726726   m_prot2_prev = m_prot2;
727727   m_prot2 = data;
728728
729   logerror("CPU #0 - PC %04X: unknown = %02X\n",cpu_get_pc(&space.device()),data);
729   logerror("CPU #0 - PC %04X: unknown = %02X\n",space.device().safe_pc(),data);
730730}
731731
732732/*
r17788r17789
737737{
738738   int bank = data & 0x0f;
739739
740   if (data & ~0x0f)   logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data);
740   if (data & ~0x0f)   logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data);
741741
742742   membank("bank1")->set_entry(bank + (membank("bank1")->entry() & 0x10));
743743
r17788r17789
796796WRITE8_MEMBER(suna8_state::hardhea2_nmi_w)
797797{
798798   m_nmi_enable = data & 0x01;
799//  if (data & ~0x01)   logerror("CPU #0 - PC %04X: unknown nmi bits: %02X\n",cpu_get_pc(&space.device()),data);
799//  if (data & ~0x01)   logerror("CPU #0 - PC %04X: unknown nmi bits: %02X\n",space.device().safe_pc(),data);
800800}
801801
802802/*
r17788r17789
806806WRITE8_MEMBER(suna8_state::hardhea2_flipscreen_w)
807807{
808808   flip_screen_set(data & 0x01);
809   if (data & ~0x01)   logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(&space.device()),data);
809   if (data & ~0x01)   logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",space.device().safe_pc(),data);
810810}
811811
812812WRITE8_MEMBER(suna8_state::hardhea2_leds_w)
r17788r17789
814814   set_led_status(machine(), 0, data & 0x01);
815815   set_led_status(machine(), 1, data & 0x02);
816816   coin_counter_w(machine(), 0, data & 0x04);
817   if (data & ~0x07)   logerror("CPU#0  - PC %06X: unknown leds bits: %02X\n",cpu_get_pc(&space.device()),data);
817   if (data & ~0x07)   logerror("CPU#0  - PC %06X: unknown leds bits: %02X\n",space.device().safe_pc(),data);
818818}
819819
820820/*
r17788r17789
825825WRITE8_MEMBER(suna8_state::hardhea2_spritebank_w)
826826{
827827   m_spritebank = (data >> 1) & 1;
828   if (data & ~0x02)   logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data);
828   if (data & ~0x02)   logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data);
829829}
830830
831831/*
r17788r17789
836836{
837837   int bank = data & 0x0f;
838838
839   if (data & ~0x0f)   logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data);
839   if (data & ~0x0f)   logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data);
840840
841841   membank("bank1")->set_entry(bank);
842842
r17788r17789
911911WRITE8_MEMBER(suna8_state::starfigh_spritebank_latch_w)
912912{
913913   m_spritebank_latch = (data >> 2) & 1;
914   if (data & ~0x04)   logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data);
914   if (data & ~0x04)   logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data);
915915}
916916
917917WRITE8_MEMBER(suna8_state::starfigh_spritebank_w)
r17788r17789
973973      case 0x81: m_trash_prot = 1; break;
974974      case 0x99: m_trash_prot = 1; break;
975975      case 0x54: m_spritebank = 1; break;
976      default: logerror("CPU #0 - PC %04X: unknown protection command: %02X\n",cpu_get_pc(&space.device()),data);
976      default: logerror("CPU #0 - PC %04X: unknown protection command: %02X\n",space.device().safe_pc(),data);
977977   }
978978}
979979
r17788r17789
990990WRITE8_MEMBER(suna8_state::sparkman_flipscreen_w)
991991{
992992   flip_screen_set(data & 0x01);
993   //if (data & ~0x01)     logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(&space.device()),data);
993   //if (data & ~0x01)     logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",space.device().safe_pc(),data);
994994}
995995
996996WRITE8_MEMBER(suna8_state::sparkman_leds_w)
997997{
998998   set_led_status(machine(), 0, data & 0x01);
999999   set_led_status(machine(), 1, data & 0x02);
1000   //if (data & ~0x03) logerror("CPU#0  - PC %06X: unknown leds bits: %02X\n",cpu_get_pc(&space.device()),data);
1000   //if (data & ~0x03) logerror("CPU#0  - PC %06X: unknown leds bits: %02X\n",space.device().safe_pc(),data);
10011001}
10021002
10031003WRITE8_MEMBER(suna8_state::sparkman_coin_counter_w)
r17788r17789
10161016      m_spritebank = 0;
10171017   else
10181018      m_spritebank = (data) & 1;
1019   //if (data & ~0x02)     logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(&space.device()),data);
1019   //if (data & ~0x02)     logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",space.device().safe_pc(),data);
10201020}
10211021
10221022/*
r17788r17789
10271027{
10281028   int bank = data & 0x0f;
10291029
1030   //if (data & ~0x0f)     logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",cpu_get_pc(&space.device()),data);
1030   //if (data & ~0x0f)     logerror("CPU #0 - PC %04X: unknown rom bank bits: %02X\n",space.device().safe_pc(),data);
10311031
10321032   membank("bank1")->set_entry(bank);
10331033   m_rombank = data;
trunk/src/mame/drivers/btime.c
r17788r17789
211211   /* xxxx xxx1 xxxx x1xx are encrypted. */
212212
213213   /* get the address of the next opcode */
214   addr = cpu_get_pc(&space->device());
214   addr = space->device().safe_pc();
215215
216216   /* however if the previous instruction was JSR (which caused a write to */
217217   /* the stack), fetch the address of the next instruction. */
218   addr1 = cpu_get_previouspc(&space->device());
218   addr1 = space->device().safe_pcbase();
219219   src1 = (addr1 < 0x9000) ? state->m_rambase : state->memregion("maincpu")->base();
220220   if (decrypted[addr1] == 0x20)   /* JSR $xxxx */
221221      addr = src1[addr1 + 1] + 256 * src1[addr1 + 2];
r17788r17789
240240   else if (offset == 0x9000)                     { return; }  /* AM_NOP */
241241   else if (offset == 0x9002)                     { audio_command_w(space, 0, data); return; }
242242   else if (offset >= 0xb000 && offset <= 0xb1ff)   ;
243   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);
243   else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset);
244244
245245   m_rambase[offset] = data;
246246
r17788r17789
258258   else if (offset == 0x9000)                     { return; }  /* AM_NOP */
259259   else if (offset == 0x9002)                     { audio_command_w(space, 0, data); return; }
260260   else if (offset >= 0xb000 && offset <= 0xbfff) { mmonkey_protection_w(space, offset - 0xb000, data); return; }
261   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);
261   else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset);
262262
263263   m_rambase[offset] = data;
264264
r17788r17789
276276   else if (offset == 0x4002)                     btime_video_control_w(space, 0, data);
277277   else if (offset == 0x4003)                     audio_command_w(space, 0, data);
278278   else if (offset == 0x4004)                     bnj_scroll1_w(space, 0, data);
279   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);
279   else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset);
280280
281281   m_rambase[offset] = data;
282282
r17788r17789
295295   else if (offset == 0x4004)                     bnj_scroll1_w(space, 0, data);
296296   else if (offset == 0x4005)              bnj_scroll2_w(space, 0, data);
297297//  else if (offset == 0x8000)                     btime_video_control_w(space,0,data);
298   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);
298   else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset);
299299
300300   m_rambase[offset] = data;
301301
r17788r17789
313313   else if (offset == 0x9804)                     bnj_scroll2_w(space, 0, data);
314314   else if (offset == 0x9805)                     bnj_scroll1_w(space, 0, data);
315315   else if (offset == 0x9806)                     audio_command_w(space, 0, data);
316   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);
316   else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset);
317317
318318   m_rambase[offset] = data;
319319
r17788r17789
327327   else if (offset >= 0x8000 && offset <= 0x881f) ;
328328   else if (offset == 0x9a00)                     audio_command_w(space, 0, data);
329329   else if (offset == 0x9c00)                     disco_video_control_w(space, 0, data);
330   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);
330   else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n", space.device().tag(), space.device().safe_pc(), data, offset);
331331
332332   m_rambase[offset] = data;
333333
trunk/src/mame/drivers/gaelco3d.c
r17788r17789
273273   else if (ACCESSING_BITS_0_7)
274274      gaelco_serial_tr_w(machine().device("serial"), 0, data & 0x01);
275275   else
276      logerror("%06X:irq_ack_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
276      logerror("%06X:irq_ack_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
277277}
278278
279279
r17788r17789
313313   {
314314      UINT8 data = gaelco_serial_data_r(machine().device("serial"),0);
315315      if (LOG)
316         logerror("%06X:read(%02X) = %08X & %08X\n", cpu_get_pc(machine().device("maincpu")), offset, data, mem_mask);
316         logerror("%06X:read(%02X) = %08X & %08X\n", machine().device("maincpu")->safe_pc(), offset, data, mem_mask);
317317      return  data | 0xffffff00;
318318   }
319319   else
320      logerror("%06X:read(%02X) = mask %08X\n", cpu_get_pc(machine().device("maincpu")), offset, mem_mask);
320      logerror("%06X:read(%02X) = mask %08X\n", machine().device("maincpu")->safe_pc(), offset, mem_mask);
321321
322322   return 0xffffffff;
323323}
r17788r17789
378378WRITE16_MEMBER(gaelco3d_state::sound_data_w)
379379{
380380   if (LOG)
381      logerror("%06X:sound_data_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
381      logerror("%06X:sound_data_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
382382   if (ACCESSING_BITS_0_7)
383383      machine().scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff);
384384}
r17788r17789
396396READ16_MEMBER(gaelco3d_state::sound_status_r)
397397{
398398   if (LOG)
399      logerror("%06X:sound_status_r(%02X) = %02X\n", cpu_get_pc(&space.device()), offset, m_sound_status);
399      logerror("%06X:sound_status_r(%02X) = %02X\n", space.device().safe_pc(), offset, m_sound_status);
400400   if (ACCESSING_BITS_0_7)
401401      return m_sound_status;
402402   return 0xffff;
r17788r17789
441441   else
442442   {
443443      if (LOG)
444         logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
444         logerror("%06X:analog_port_clock_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
445445   }
446446}
447447
r17788r17789
462462   else
463463   {
464464      if (LOG)
465         logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
465         logerror("%06X:analog_port_latch_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
466466   }
467467
468468}
r17788r17789
477477
478478READ32_MEMBER(gaelco3d_state::tms_m68k_ram_r)
479479{
480//  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]);
480//  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]);
481481   return (INT32)(INT16)m_m68k_ram_base[offset ^ m_tms_offset_xor];
482482}
483483
r17788r17789
508508   /* this is set to 0 while data is uploaded, then set to $ffff after it is done */
509509   /* it does not ever appear to be touched after that */
510510   if (LOG)
511      logerror("%06X:tms_reset_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
511      logerror("%06X:tms_reset_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
512512      cputag_set_input_line(machine(), "tms", INPUT_LINE_RESET, (data == 0xffff) ? CLEAR_LINE : ASSERT_LINE);
513513}
514514
r17788r17789
518518   /* this is written twice, 0,1, in quick succession */
519519   /* done after uploading, and after modifying the comm area */
520520   if (LOG)
521      logerror("%06X:tms_irq_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
521      logerror("%06X:tms_irq_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
522522   if (ACCESSING_BITS_0_7)
523523      cputag_set_input_line(machine(), "tms", 0, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
524524}
r17788r17789
527527WRITE16_MEMBER(gaelco3d_state::tms_control3_w)
528528{
529529   if (LOG)
530      logerror("%06X:tms_control3_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
530      logerror("%06X:tms_control3_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
531531}
532532
533533
r17788r17789
535535{
536536   COMBINE_DATA(&m_tms_comm_base[offset ^ m_tms_offset_xor]);
537537   if (LOG)
538      logerror("%06X:tms_comm_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
538      logerror("%06X:tms_comm_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset*2, data, mem_mask);
539539}
540540
541541
r17788r17789
739739{
740740   /* arbitrary data written */
741741   if (ACCESSING_BITS_0_7)
742      logerror("%06X:unknown_127_w = %02X\n", cpu_get_pc(&space.device()), data & 0xff);
742      logerror("%06X:unknown_127_w = %02X\n", space.device().safe_pc(), data & 0xff);
743743   else
744      logerror("%06X:unknown_127_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
744      logerror("%06X:unknown_127_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
745745}
746746
747747WRITE32_MEMBER(gaelco3d_state::unknown_137_w)
748748{
749749   /* only written $00 or $ff */
750750   if (ACCESSING_BITS_0_7)
751      logerror("%06X:unknown_137_w = %02X\n", cpu_get_pc(&space.device()), data & 0xff);
751      logerror("%06X:unknown_137_w = %02X\n", space.device().safe_pc(), data & 0xff);
752752   else
753      logerror("%06X:unknown_137_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
753      logerror("%06X:unknown_137_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
754754}
755755
756756WRITE32_MEMBER(gaelco3d_state::unknown_13a_w)
757757{
758758   /* only written $0000 or $0001 */
759759   if (ACCESSING_BITS_0_15)
760      logerror("%06X:unknown_13a_w = %04X\n", cpu_get_pc(&space.device()), data & 0xffff);
760      logerror("%06X:unknown_13a_w = %04X\n", space.device().safe_pc(), data & 0xffff);
761761   else
762      logerror("%06X:unknown_13a_w(%02X) = %08X & %08X\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
762      logerror("%06X:unknown_13a_w(%02X) = %08X & %08X\n", space.device().safe_pc(), offset, data, mem_mask);
763763}
764764
765765
trunk/src/mame/drivers/namconb1.c
r17788r17789
741741      break; /* no protection? */
742742   }
743743
744   logerror( "custom_key_r(%d); pc=%08x\n", offset, cpu_get_pc(&space.device()) );
744   logerror( "custom_key_r(%d); pc=%08x\n", offset, space.device().safe_pc() );
745745   return 0;
746746} /* custom_key_r */
747747
trunk/src/mame/drivers/strnskil.c
r17788r17789
3838{
3939   int res;
4040
41   switch (cpu_get_pc(&space.device()))
41   switch (space.device().safe_pc())
4242   {
4343      case 0x6066:   res = 0xa5;   break;
4444      case 0x60dc:   res = 0x20;   break;   /* bits 0-3 unknown */
r17788r17789
4949      default:      res = 0xff; break;
5050   }
5151
52   logerror("%04x: protection_r -> %02x\n",cpu_get_pc(&space.device()),res);
52   logerror("%04x: protection_r -> %02x\n",space.device().safe_pc(),res);
5353   return res;
5454}
5555
r17788r17789
5757{
5858   int res;
5959
60   switch (cpu_get_pc(&space.device()))
60   switch (space.device().safe_pc())
6161   {
6262      case 0x6094:   res = 0xa5;   break;
6363      case 0x6118:   res = 0x20;   break;   /* bits 0-3 unknown */
r17788r17789
6868      default:      res = 0xff; break;
6969   }
7070
71   logerror("%04x: protection_r -> %02x\n",cpu_get_pc(&space.device()),res);
71   logerror("%04x: protection_r -> %02x\n",space.device().safe_pc(),res);
7272   return res;
7373}
7474
7575WRITE8_MEMBER(strnskil_state::protection_w)
7676{
77   logerror("%04x: protection_w %02x\n",cpu_get_pc(&space.device()),data);
77   logerror("%04x: protection_w %02x\n",space.device().safe_pc(),data);
7878}
7979
8080/****************************************************************************/
trunk/src/mame/drivers/model2.c
r17788r17789
119119      if (state->m_dsp_type == DSP_TYPE_TGP)
120120         return 0;
121121
122      fatalerror("Copro FIFOIN underflow (at %08X)\n", cpu_get_pc(device));
122      fatalerror("Copro FIFOIN underflow (at %08X)\n", device->safe_pc());
123123      return 0;
124124   }
125125
r17788r17789
153153   model2_state *state = device->machine().driver_data<model2_state>();
154154   if (state->m_copro_fifoin_num == COPRO_FIFOIN_SIZE)
155155   {
156      fatalerror("Copro FIFOIN overflow (at %08X)\n", cpu_get_pc(device));
156      fatalerror("Copro FIFOIN overflow (at %08X)\n", device->safe_pc());
157157      return;
158158   }
159159
160   //mame_printf_debug("COPRO FIFOIN at %08X, %08X, %f\n", cpu_get_pc(device), data, *(float*)&data);
160   //mame_printf_debug("COPRO FIFOIN at %08X, %08X, %f\n", device->safe_pc(), data, *(float*)&data);
161161
162162   state->m_copro_fifoin_data[state->m_copro_fifoin_wpos++] = data;
163163   if (state->m_copro_fifoin_wpos == COPRO_FIFOIN_SIZE)
r17788r17789
225225   //if (state->m_copro_fifoout_wpos == state->m_copro_fifoout_rpos)
226226   if (state->m_copro_fifoout_num == COPRO_FIFOOUT_SIZE)
227227   {
228      fatalerror("Copro FIFOOUT overflow (at %08X)\n", cpu_get_pc(device));
228      fatalerror("Copro FIFOOUT overflow (at %08X)\n", device->safe_pc());
229229      return;
230230   }
231231
r17788r17789
666666   }
667667   else
668668   {
669      //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
669      //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc());
670670      if (m_dsp_type == DSP_TYPE_SHARC)
671671         copro_fifoin_push(machine().device("dsp"), data);
672672      else
r17788r17789
777777    }
778778    else
779779    {
780        //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
780        //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc());
781781    }
782782}
783783
r17788r17789
843843   }
844844
845845//  fatalerror("geo_r: %08X, %08X\n", address, mem_mask);
846   mame_printf_debug("geo_r: PC:%08x - %08X\n", cpu_get_pc(&space.device()), address);
846   mame_printf_debug("geo_r: PC:%08x - %08X\n", space.device().safe_pc(), address);
847847
848848   return 0;
849849}
r17788r17789
10741074      else
10751075         return 0xfff0;
10761076   }
1077   else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device()));
1077   else logerror("Unhandled Protection READ @ %x mask %x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
10781078
10791079   return retval;
10801080}
r17788r17789
11441144         strcpy((char *)m_protram, "  TECMO LTD.  DEAD OR ALIVE  1996.10.22  VER. 1.00");
11451145      }
11461146   }
1147   else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
1147   else logerror("Unhandled Protection WRITE %x @ %x mask %x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
11481148
11491149}
11501150
r17788r17789
19051905READ32_MEMBER(model2_state::copro_sharc_input_fifo_r)
19061906{
19071907   UINT32 result = 0;
1908   //mame_printf_debug("SHARC FIFOIN pop at %08X\n", cpu_get_pc(&space.device()));
1908   //mame_printf_debug("SHARC FIFOIN pop at %08X\n", space.device().safe_pc());
19091909
19101910   copro_fifoin_pop(machine().device("dsp"), &result);
19111911   return result;
r17788r17789
19241924
19251925WRITE32_MEMBER(model2_state::copro_sharc_buffer_w)
19261926{
1927   //mame_printf_debug("sharc_buffer_w: %08X at %08X, %08X, %f\n", offset, cpu_get_pc(&space.device()), data, *(float*)&data);
1927   //mame_printf_debug("sharc_buffer_w: %08X at %08X, %08X, %f\n", offset, space.device().safe_pc(), data, *(float*)&data);
19281928   m_bufferram[offset & 0x7fff] = data;
19291929}
19301930
trunk/src/mame/drivers/sshangha.c
r17788r17789
6464{
6565   COMBINE_DATA(&m_prot_data[offset]);
6666
67   logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %04x\n",cpu_get_pc(&space.device()),offset<<1,data);
67   logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %04x\n",space.device().safe_pc(),offset<<1,data);
6868}
6969
7070/* Protection/IO chip 146 */
r17788r17789
8282      // Protection TODO
8383   }
8484
85   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",cpu_get_pc(&space.device()),offset<<1);
85   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",space.device().safe_pc(),offset<<1);
8686   return m_prot_data[offset];
8787}
8888
trunk/src/mame/drivers/monzagp.c
r17788r17789
179179
180180WRITE8_MEMBER(monzagp_state::port0_w)
181181{
182//  printf("P0 %x = %x\n",cpu_get_pc(&space.device()),data);
182//  printf("P0 %x = %x\n",space.device().safe_pc(),data);
183183}
184184
185185WRITE8_MEMBER(monzagp_state::port1_w)
186186{
187//  printf("P1 %x = %x\n",cpu_get_pc(&space.device()),data);
187//  printf("P1 %x = %x\n",space.device().safe_pc(),data);
188188}
189189
190190WRITE8_MEMBER(monzagp_state::port2_w)
191191{
192//  printf("P2 %x = %x\n",cpu_get_pc(&space.device()),data);
192//  printf("P2 %x = %x\n",space.device().safe_pc(),data);
193193   m_coordy=data;
194194}
195195
trunk/src/mame/drivers/scramble.c
r17788r17789
322322
323323READ8_MEMBER(scramble_state::hncholms_prot_r)
324324{
325   if(cpu_get_pc(&space.device()) == 0x2b || cpu_get_pc(&space.device()) == 0xa27)
325   if(space.device().safe_pc() == 0x2b || space.device().safe_pc() == 0xa27)
326326      return 1;
327327   else
328328      return 0;
trunk/src/mame/drivers/mole.c
r17788r17789
165165   {
166166   case 0x08: return 0xb0; /* random mole placement */
167167   case 0x26:
168      if (cpu_get_pc(&space.device()) == 0x53d7)
168      if (space.device().safe_pc() == 0x53d7)
169169      {
170170         return 0x06; /* bonus round */
171171      }
trunk/src/mame/drivers/tehkanwc.c
r17788r17789
155155
156156   /* in Gridiron, the sound CPU goes in a tight loop after the self test, */
157157   /* probably waiting to be reset by a watchdog */
158   if (cpu_get_pc(&space.device()) == 0x08bc) machine().scheduler().timer_set(attotime::from_seconds(1), FUNC(reset_callback));
158   if (space.device().safe_pc() == 0x08bc) machine().scheduler().timer_set(attotime::from_seconds(1), FUNC(reset_callback));
159159}
160160
161161
trunk/src/mame/drivers/bionicc.c
r17788r17789
7373WRITE16_MEMBER(bionicc_state::hacked_controls_w)
7474{
7575
76   logerror("%06x: hacked_controls_w %04x %02x\n", cpu_get_pc(&space.device()), offset, data);
76   logerror("%06x: hacked_controls_w %04x %02x\n", space.device().safe_pc(), offset, data);
7777   COMBINE_DATA(&m_inp[offset]);
7878}
7979
8080READ16_MEMBER(bionicc_state::hacked_controls_r)
8181{
8282
83   logerror("%06x: hacked_controls_r %04x %04x\n", cpu_get_pc(&space.device()), offset, m_inp[offset]);
83   logerror("%06x: hacked_controls_r %04x %04x\n", space.device().safe_pc(), offset, m_inp[offset]);
8484   return m_inp[offset];
8585}
8686
trunk/src/mame/drivers/playmark.c
r17788r17789
135135   if ((m_oki_control & 0x38) == 0x30)
136136   {
137137      data = m_snd_command;
138      // logerror("PC$%03x PortB reading %02x from the 68K\n", cpu_get_previouspc(&space.device()), data);
138      // logerror("PC$%03x PortB reading %02x from the 68K\n", space.device().safe_pcbase(), data);
139139   }
140140   else if ((m_oki_control & 0x38) == 0x28)
141141   {
142142      data = (m_oki->read(space, 0) & 0x0f);
143      // logerror("PC$%03x PortB reading %02x from the OKI status port\n", cpu_get_previouspc(&space.device()), data);
143      // logerror("PC$%03x PortB reading %02x from the OKI status port\n", space.device().safe_pcbase(), data);
144144   }
145145
146146   return data;
r17788r17789
200200
201201   if ((data & 0x38) == 0x18)
202202   {
203      // 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);
203      // 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);
204204      okim6295_device *oki = machine().device<okim6295_device>("oki");
205205      oki->write(space, 0, m_oki_command);
206206   }
trunk/src/mame/drivers/pgm.c
r17788r17789
224224
225225WRITE16_MEMBER(pgm_state::z80_ram_w)
226226{
227   int pc = cpu_get_pc(&space.device());
227   int pc = space.device().safe_pc();
228228
229229   if (ACCESSING_BITS_8_15)
230230      m_z80_mainram[offset * 2] = data >> 8;
r17788r17789
233233
234234   if (pc != 0xf12 && pc != 0xde2 && pc != 0x100c50 && pc != 0x100b20)
235235      if (PGMLOGERROR)
236         logerror("Z80: write %04x, %04x @ %04x (%06x)\n", offset * 2, data, mem_mask, cpu_get_pc(&space.device()));
236         logerror("Z80: write %04x, %04x @ %04x (%06x)\n", offset * 2, data, mem_mask, space.device().safe_pc());
237237}
238238
239239WRITE16_MEMBER(pgm_state::z80_reset_w)
240240{
241241
242242   if (PGMLOGERROR)
243      logerror("Z80: reset %04x @ %04x (%06x)\n", data, mem_mask, cpu_get_pc(&space.device()));
243      logerror("Z80: reset %04x @ %04x (%06x)\n", data, mem_mask, space.device().safe_pc());
244244
245245   if (data == 0x5050)
246246   {
r17788r17789
266266WRITE16_MEMBER(pgm_state::z80_ctrl_w)
267267{
268268   if (PGMLOGERROR)
269      logerror("Z80: ctrl %04x @ %04x (%06x)\n", data, mem_mask, cpu_get_pc(&space.device()));
269      logerror("Z80: ctrl %04x @ %04x (%06x)\n", data, mem_mask, space.device().safe_pc());
270270}
271271
272272WRITE16_MEMBER(pgm_state::m68k_l1_w)
r17788r17789
275275   if(ACCESSING_BITS_0_7)
276276   {
277277      if (PGMLOGERROR)
278         logerror("SL 1 m68.w %02x (%06x) IRQ\n", data & 0xff, cpu_get_pc(&space.device()));
278         logerror("SL 1 m68.w %02x (%06x) IRQ\n", data & 0xff, space.device().safe_pc());
279279      soundlatch_byte_w(space, 0, data);
280280      device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE );
281281   }
r17788r17789
284284WRITE8_MEMBER(pgm_state::z80_l3_w)
285285{
286286   if (PGMLOGERROR)
287      logerror("SL 3 z80.w %02x (%04x)\n", data, cpu_get_pc(&space.device()));
287      logerror("SL 3 z80.w %02x (%04x)\n", data, space.device().safe_pc());
288288   soundlatch3_byte_w(space, 0, data);
289289}
290290
trunk/src/mame/drivers/namcos21.c
r17788r17789
342342   UINT16 result = 0;
343343   if( m_gametype == NAMCOS21_SOLVALOU )
344344   {
345      switch( cpu_get_pc(&space.device()) )
345      switch( space.device().safe_pc() )
346346      {
347347      case 0x805e: result = 0x0000; break;
348348      case 0x805f: result = 0xfeba; break;
349349      case 0x8067: result = 0xffff; break;
350350      case 0x806e: result = 0x0145; break;
351351      default:
352         logerror( "unk cuskey_r; pc=0x%x\n", cpu_get_pc(&space.device()) );
352         logerror( "unk cuskey_r; pc=0x%x\n", space.device().safe_pc() );
353353         break;
354354      }
355355   }
356356   else if( m_gametype == NAMCOS21_CYBERSLED )
357357   {
358      switch( cpu_get_pc(&space.device()) )
358      switch( space.device().safe_pc() )
359359      {
360360      case 0x8061: result = 0xfe95; break;
361361      case 0x8069: result = 0xffff; break;
r17788r17789
366366   }
367367   else if( m_gametype == NAMCOS21_AIRCOMBAT )
368368   {
369      switch( cpu_get_pc(&space.device()) )
369      switch( space.device().safe_pc() )
370370      {
371371      case 0x8062: result = 0xfeb9; break;
372372      case 0x806a: result = 0xffff; break;
r17788r17789
880880
881881WRITE16_MEMBER(namcos21_state::slave_XF_output_w)
882882{
883   if (ENABLE_LOGGING) logerror( "0x%x:slaveXF(%d)\n", cpu_get_pc(&space.device()), data );
883   if (ENABLE_LOGGING) logerror( "0x%x:slaveXF(%d)\n", space.device().safe_pc(), data );
884884} /* slave_XF_output_w */
885885
886886READ16_MEMBER(namcos21_state::slave_portf_r)
r17788r17789
935935#if 0
936936   logerror( "dsp_control_w:'%s':%x[%x]:=%04x ",
937937      cpu->tag,
938      cpu_get_pc(cpu),
938      cpu->safe_pc(),
939939      offset,
940940      m_pointram_control );
941941
r17788r17789
11201120
11211121READ16_MEMBER(namcos21_state::winrun_cuskey_r)
11221122{
1123   int pc = cpu_get_pc(&space.device());
1123   int pc = space.device().safe_pc();
11241124   switch( pc )
11251125   {
11261126   case 0x0064: /* winrun91 */
trunk/src/mame/drivers/darius.c
r17788r17789
158158
159159   parse_control(machine());
160160
161   logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data);
161   logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data);
162162}
163163
164164WRITE16_MEMBER(darius_state::darius_watchdog_w)
r17788r17789
195195         return ioport("DSW")->read();
196196   }
197197
198logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",cpu_get_pc(&space.device()),offset);
198logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",space.device().safe_pc(),offset);
199199
200200   return 0xff;
201201}
r17788r17789
231231         return;
232232   }
233233
234logerror("CPU #0 PC %06x: warning - write unmapped ioc offset %06x with %04x\n",cpu_get_pc(&space.device()),offset,data);
234logerror("CPU #0 PC %06x: warning - write unmapped ioc offset %06x with %04x\n",space.device().safe_pc(),offset,data);
235235}
236236
237237
r17788r17789
516516READ8_MEMBER(darius_state::adpcm_command_read)
517517{
518518
519   /* logerror("read port 0: %02x  PC=%4x\n",adpcm_command, cpu_get_pc(&space.device()) ); */
519   /* logerror("read port 0: %02x  PC=%4x\n",adpcm_command, space.device().safe_pc() ); */
520520   return m_adpcm_command;
521521}
522522
r17788r17789
534534{
535535
536536   m_nmi_enable = 0;
537   /* logerror("write port 0: NMI DISABLE  PC=%4x\n", data, cpu_get_pc(&space.device()) ); */
537   /* logerror("write port 0: NMI DISABLE  PC=%4x\n", data, space.device().safe_pc() ); */
538538}
539539
540540WRITE8_MEMBER(darius_state::adpcm_nmi_enable)
541541{
542542   m_nmi_enable = 1;
543   /* logerror("write port 1: NMI ENABLE   PC=%4x\n", cpu_get_pc(&space.device()) ); */
543   /* logerror("write port 1: NMI ENABLE   PC=%4x\n", space.device().safe_pc() ); */
544544}
545545
546546WRITE8_MEMBER(darius_state::adpcm_data_w)
trunk/src/mame/drivers/kinst.c
r17788r17789
362362
363363      case 4:      /* $a0 */
364364         result = ioport(portnames[offset])->read();
365         if (cpu_get_pc(&space.device()) == 0x802d428)
365         if (space.device().safe_pc() == 0x802d428)
366366            device_spin_until_interrupt(&space.device());
367367         break;
368368   }
trunk/src/mame/drivers/cbasebal.c
r17788r17789
3131{
3232
3333   /* bits 0-4 select ROM bank */
34   //logerror("%04x: bankswitch %02x\n", cpu_get_pc(&space.device()), data);
34   //logerror("%04x: bankswitch %02x\n", space.device().safe_pc(), data);
3535   membank("bank1")->set_entry(data & 0x1f);
3636
3737   /* bit 5 used but unknown */
trunk/src/mame/drivers/beathead.c
r17788r17789
498498READ32_MEMBER( beathead_state::speedup_r )
499499{
500500   int result = *m_speedup_data;
501   if ((cpu_get_previouspc(&space.device()) & 0xfffff) == 0x006f0 && result == cpu_get_reg(&space.device(), ASAP_R3))
501   if ((space.device().safe_pcbase() & 0xfffff) == 0x006f0 && result == cpu_get_reg(&space.device(), ASAP_R3))
502502      device_spin_until_interrupt(&space.device());
503503   return result;
504504}
r17788r17789
507507READ32_MEMBER( beathead_state::movie_speedup_r )
508508{
509509   int result = *m_movie_speedup_data;
510   if ((cpu_get_previouspc(&space.device()) & 0xfffff) == 0x00a88 && (cpu_get_reg(&space.device(), ASAP_R28) & 0xfffff) == 0x397c0 &&
510   if ((space.device().safe_pcbase() & 0xfffff) == 0x00a88 && (cpu_get_reg(&space.device(), ASAP_R28) & 0xfffff) == 0x397c0 &&
511511      m_movie_speedup_data[4] == cpu_get_reg(&space.device(), ASAP_R1))
512512   {
513513      UINT32 temp = (INT16)result + m_movie_speedup_data[4] * 262;
trunk/src/mame/drivers/suprgolf.c
r17788r17789
269269
270270   //popmessage("%08x %02x",((data & 0x3f) * 0x4000),data);
271271
272//  mame_printf_debug("ROM_BANK 0x8000 - %X @%X\n",data,cpu_get_previouspc(&space->device()));
272//  mame_printf_debug("ROM_BANK 0x8000 - %X @%X\n",data,space->device().safe_pcbase());
273273   membank("bank2")->set_base(region_base + (data&0x3f ) * 0x4000);
274274
275275   m_msm_nmi_mask = data & 0x40;
r17788r17789
279279WRITE8_MEMBER(suprgolf_state::rom2_bank_select_w)
280280{
281281   UINT8 *region_base = memregion("user2")->base();
282//  mame_printf_debug("ROM_BANK 0x4000 - %X @%X\n",data,cpu_get_previouspc(&space.device()));
282//  mame_printf_debug("ROM_BANK 0x4000 - %X @%X\n",data,space.device().safe_pcbase());
283283
284284   membank("bank1")->set_base(region_base + (data&0x0f) * 0x4000);
285285
trunk/src/mame/drivers/snesb.c
r17788r17789
206206      case 0xfb7:   return 0x47;
207207   }
208208
209   logerror("Unknown protection read read %x @ %x\n",offset, cpu_get_pc(&space.device()));
209   logerror("Unknown protection read read %x @ %x\n",offset, space.device().safe_pc());
210210
211211   return 0;
212212}
trunk/src/mame/drivers/pcxt.c
r17788r17789
166166
167167READ8_MEMBER(pcxt_state::disk_iobank_r)
168168{
169   //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,cpu_get_pc(&space.device()));
169   //printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,space.device().safe_pc());
170170   //if(offset == 0) return ioport("DSW")->read();
171171   if(offset == 1) return ioport("IN1")->read();
172172
r17788r17789
386386READ8_MEMBER(pcxt_state::fdc765_status_r)
387387{
388388   UINT8 tmp;
389//  popmessage("Read FDC status @ PC=%05x",cpu_get_pc(&space.device()));
389//  popmessage("Read FDC status @ PC=%05x",space.device().safe_pc());
390390   tmp = m_status | 0x80;
391391   m_clr_status++;
392392   if(m_clr_status == 0x10)
trunk/src/mame/drivers/toaplan2.c
r17788r17789
637637   {
638638
639639      m_mcu_data = data & 0xff;
640      logerror("PC:%08x Writing command (%04x) to secondary CPU shared port\n", cpu_get_previouspc(&space.device()), m_mcu_data);
640      logerror("PC:%08x Writing command (%04x) to secondary CPU shared port\n", space.device().safe_pcbase(), m_mcu_data);
641641   }
642642}
643643
r17788r17789
699699      }
700700      else
701701      {
702         logerror("PC:%08x Writing %08x to HD647180 cpu shared ram status port\n", cpu_get_previouspc(&space.device()), m_mcu_data);
702         logerror("PC:%08x Writing %08x to HD647180 cpu shared ram status port\n", space.device().safe_pcbase(), m_mcu_data);
703703      }
704704      toaplan2_shared_ram16[0x56 / 2] = 0x004e;   // Return a RTS instruction
705705      toaplan2_shared_ram16[0x58 / 2] = 0x0075;
r17788r17789
10121012{
10131013
10141014   if (data & ~0x001f)
1015      logerror("CPU #0 PC:%06X - Unknown EEPROM data being written %04X\n",cpu_get_pc(&space.device()),data);
1015      logerror("CPU #0 PC:%06X - Unknown EEPROM data being written %04X\n",space.device().safe_pc(),data);
10161016
10171017   if ( ACCESSING_BITS_0_7 )
10181018      ioport("EEPROMOUT")->write(data, 0xff);
trunk/src/mame/drivers/mjkjidai.c
r17788r17789
164164   int res = 0x3f,i;
165165   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" };
166166
167//  logerror("%04x: keyboard_r\n", cpu_get_pc(&space.device()));
167//  logerror("%04x: keyboard_r\n", space.device().safe_pc());
168168
169169   for (i = 0; i < 12; i++)
170170   {
r17788r17789
189189WRITE8_MEMBER(mjkjidai_state::keyboard_select_w)
190190{
191191
192//  logerror("%04x: keyboard_select %d = %02x\n",cpu_get_pc(&space.device()),offset,data);
192//  logerror("%04x: keyboard_select %d = %02x\n",space.device().safe_pc(),offset,data);
193193
194194   switch (offset)
195195   {
trunk/src/mame/drivers/wecleman.c
r17788r17789
329329{
330330   if (ACCESSING_BITS_0_7)
331331   {
332      // logerror("CPU #0 - PC = %06X - $140005 <- %02X (old value: %02X)\n",cpu_get_pc(&space.device()), data&0xFF, old_data&0xFF);
332      // logerror("CPU #0 - PC = %06X - $140005 <- %02X (old value: %02X)\n",space.device().safe_pc(), data&0xFF, old_data&0xFF);
333333
334334      // Bit 0 : SUBINT
335335      if ( (m_irqctrl & 1) && (!(data & 1)) )   // 1->0 transition
trunk/src/mame/drivers/crbaloon.c
r17788r17789
6161{
6262   m_pc3092_data[offset] = data & 0x0f;
6363
64   if (LOG_PC3092) logerror("%04X:  write PC3092 #%d = 0x%02x\n", cpu_get_pc(&space.device()), offset, m_pc3092_data[offset]);
64   if (LOG_PC3092) logerror("%04X:  write PC3092 #%d = 0x%02x\n", space.device().safe_pc(), offset, m_pc3092_data[offset]);
6565
6666   pc3092_update(machine());
6767}
r17788r17789
141141      break;
142142   }
143143
144   if (LOG_PC3259) logerror("%04X:  read PC3259 #%d = 0x%02x\n", cpu_get_pc(&space.device()), reg, ret);
144   if (LOG_PC3259) logerror("%04X:  read PC3259 #%d = 0x%02x\n", space.device().safe_pc(), reg, ret);
145145
146146   return ret | (ioport("DSW1")->read() & 0xf0);
147147}
trunk/src/mame/drivers/voyager.c
r17788r17789
249249            #if 0
250250            if ((state->m_mxtc_config_reg[0x63] & 0x50) | ( state->m_mxtc_config_reg[0x63] & 0xA0)) // Only DO if comes a change to disable ROM.
251251            {
252               if ( cpu_get_pc(busdevice->machine().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d);
252               if ( busdevice->machine(->safe_pc().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d);
253253            }
254254            #endif
255255
trunk/src/mame/drivers/roul.c
r17788r17789
120120bit 6 -> ??? (after unknown blitter command : [80][80][08][02])
121121*/
122122//  return 0x80; // blitter ready
123//  logerror("Read unknown port $f5 at %04x\n",cpu_get_pc(&space.device()));
123//  logerror("Read unknown port $f5 at %04x\n",space.device().safe_pc());
124124   return machine().rand() & 0x00c0;
125125}
126126
trunk/src/mame/drivers/centiped.c
r17788r17789
612612
613613READ8_MEMBER(centiped_state::bullsdrt_data_port_r)
614614{
615   switch (cpu_get_pc(&space.device()))
615   switch (space.device().safe_pc())
616616   {
617617      case 0x0033:
618618      case 0x6b19:
trunk/src/mame/drivers/wgp.c
r17788r17789
433433
434434   parse_control(machine());
435435
436   logerror("CPU #0 PC %06x: write %04x to cpu control\n",cpu_get_pc(&space.device()),data);
436   logerror("CPU #0 PC %06x: write %04x to cpu control\n",space.device().safe_pc(),data);
437437}
438438
439439
r17788r17789
485485
486486READ16_MEMBER(wgp_state::lan_status_r)
487487{
488   logerror("CPU #2 PC %06x: warning - read lan status\n",cpu_get_pc(&space.device()));
488   logerror("CPU #2 PC %06x: warning - read lan status\n",space.device().safe_pc());
489489
490490   return  (0x4 << 8);   /* CPUB expects this in code at $104d0 (Wgp) */
491491}
r17788r17789
512512   {
513513      case 0x00:
514514      {
515//logerror("CPU #0 PC %06x: warning - port %04x write %04x\n",cpu_get_pc(&space.device()),port_sel,data);
515//logerror("CPU #0 PC %06x: warning - port %04x write %04x\n",space.device().safe_pc(),port_sel,data);
516516
517517         m_rotate_ctrl[m_port_sel] = data;
518518         return;
r17788r17789
586586         return ioport(UNKNOWN_PORT_TAG)->read_safe(0x00);   /* unknown */
587587   }
588588
589logerror("CPU #0 PC %06x: warning - read unmapped a/d input offset %06x\n",cpu_get_pc(&space.device()),offset);
589logerror("CPU #0 PC %06x: warning - read unmapped a/d input offset %06x\n",space.device().safe_pc(),offset);
590590
591591   return 0xff;
592592}
trunk/src/mame/drivers/taitoair.c
r17788r17789
240240
241241   device_set_input_line(m_dsp, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
242242
243   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"));
243   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"));
244244}
245245
246246READ16_MEMBER(taitoair_state::lineram_r)
r17788r17789
274274{
275275
276276   /* HOLD signal is active low */
277   //  logerror("TMS32025:%04x Reading %01x level from HOLD signal\n", cpu_get_previouspc(&space.device()), m_dsp_hold_signal);
277   //  logerror("TMS32025:%04x Reading %01x level from HOLD signal\n", space.device().safe_pcbase(), m_dsp_hold_signal);
278278
279279   return m_dsp_hold_signal;
280280}
r17788r17789
282282WRITE16_MEMBER(taitoair_state::dsp_HOLDA_signal_w)
283283{
284284   if (offset)
285      logerror("TMS32025:%04x Writing %01x level to HOLD-Acknowledge signal\n", cpu_get_previouspc(&space.device()), data);
285      logerror("TMS32025:%04x Writing %01x level to HOLD-Acknowledge signal\n", space.device().safe_pcbase(), data);
286286}
287287
288288
trunk/src/mame/drivers/metro.c
r17788r17789
174174
175175WRITE16_MEMBER(metro_state::metro_irq_cause_w)
176176{
177   //if (data & ~0x15) logerror("CPU #0 PC %06X : unknown bits of irqcause written: %04X\n", cpu_get_pc(&space.device()), data);
177   //if (data & ~0x15) logerror("CPU #0 PC %06X : unknown bits of irqcause written: %04X\n", space.device().safe_pc(), data);
178178
179179   if (ACCESSING_BITS_0_7)
180180   {
r17788r17789
477477//      coin_lockout_w(machine(), 0, data & 1);
478478//      coin_lockout_w(machine(), 1, data & 2);
479479   }
480   if (data & ~3)   logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", cpu_get_pc(&space.device()), data);
480   if (data & ~3)   logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", space.device().safe_pc(), data);
481481}
482482
483483
484484WRITE16_MEMBER(metro_state::metro_coin_lockout_4words_w)
485485{
486486//  coin_lockout_w(machine(), (offset >> 1) & 1, offset & 1);
487   if (data & ~1)   logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", cpu_get_pc(&space.device()), data);
487   if (data & ~1)   logerror("CPU #0 PC %06X : unknown bits of coin lockout written: %04X\n", space.device().safe_pc(), data);
488488}
489489
490490
r17788r17789
608608      int shift   = (dst_offs & 0x80) ? 0 : 8;
609609      UINT16 mask = (dst_offs & 0x80) ? 0x00ff : 0xff00;
610610
611//      logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", cpu_get_pc(&space.device()), tmap, src_offs, dst_offs);
611//      logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", space.device().safe_pc(), tmap, src_offs, dst_offs);
612612
613613      dst_offs >>= 7 + 1;
614614      switch (tmap)
r17788r17789
618618         case 3:
619619            break;
620620         default:
621            logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", cpu_get_pc(&space.device()), tmap);
621            logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", space.device().safe_pc(), tmap);
622622            return;
623623      }
624624
r17788r17789
628628
629629         src_offs %= src_len;
630630         b1 = blt_read(src, src_offs);
631//          logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", cpu_get_pc(&space.device()), b1, src_offs);
631//          logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", space.device().safe_pc(), b1, src_offs);
632632         src_offs++;
633633
634634         count = ((~b1) & 0x3f) + 1;
r17788r17789
704704            break;
705705
706706         default:
707            logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n",cpu_get_pc(&space.device()),b1,src_offs-1);
707            logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n",space.device().safe_pc(),b1,src_offs-1);
708708            return;
709709         }
710710
r17788r17789
781781      case 0x17FFE:   return BIT(dsw2, 6) ? 0x40 : 0;
782782      case 0x0FFFE:   return BIT(dsw2, 7) ? 0x40 : 0;
783783   }
784   logerror("CPU #0 PC %06X : unknown dsw address read: %04X\n", cpu_get_pc(&space.device()), offset);
784   logerror("CPU #0 PC %06X : unknown dsw address read: %04X\n", space.device().safe_pc(), offset);
785785   return 0xffff;
786786}
787787
trunk/src/mame/drivers/surpratk.c
r17788r17789
6060WRITE8_MEMBER(surpratk_state::surpratk_videobank_w)
6161{
6262
63   logerror("%04x: videobank = %02x\n",cpu_get_pc(&space.device()),data);
63   logerror("%04x: videobank = %02x\n",space.device().safe_pc(),data);
6464   /* bit 0 = select 053245 at 0000-07ff */
6565   /* bit 1 = select palette at 0000-07ff */
6666   /* bit 2 = select palette bank 0 or 1 */
r17788r17789
7171{
7272
7373   if ((data & 0xf4) != 0x10)
74      logerror("%04x: 3fc0 = %02x\n",cpu_get_pc(&space.device()),data);
74      logerror("%04x: 3fc0 = %02x\n",space.device().safe_pc(),data);
7575
7676   /* bit 0/1 = coin counters */
7777   coin_counter_w(machine(), 0, data & 0x01);
r17788r17789
322322
323323static KONAMI_SETLINES_CALLBACK( surpratk_banking )
324324{
325   logerror("%04x: setlines %02x\n",cpu_get_pc(device), lines);
325   logerror("%04x: setlines %02x\n",device->safe_pc(), lines);
326326   device->machine().root_device().membank("bank1")->set_entry(lines & 0x1f);
327327}
328328
trunk/src/mame/drivers/littlerb.c
r17788r17789
345345
346346READ16_MEMBER(littlerb_state::littlerb_vdp_r)
347347{
348   logerror("%06x littlerb_vdp_r offs %04x mask %04x (address %08x)\n", cpu_get_pc(&space.device()), offset, mem_mask, m_write_address);
348   logerror("%06x littlerb_vdp_r offs %04x mask %04x (address %08x)\n", space.device().safe_pc(), offset, mem_mask, m_write_address);
349349   UINT16 res = 0;
350350
351351   switch (offset & 3)
r17788r17789
378378         m_type2_writes = 0;
379379      }
380380
381      if (LOG_VDP) logerror("%06x littlerb_vdp_w offs %04x data %04x mask %04x\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
381      if (LOG_VDP) logerror("%06x littlerb_vdp_w offs %04x data %04x mask %04x\n", space.device().safe_pc(), offset, data, mem_mask);
382382   }
383383   else
384384   {
r17788r17789
386386      {
387387         if (m_type2_writes==0)
388388         {
389            if (LOG_VDP) logerror("data write started %06x %04x data %04x mask %04x\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
389            if (LOG_VDP) logerror("data write started %06x %04x data %04x mask %04x\n", space.device().safe_pc(), offset, data, mem_mask);
390390         }
391391         if (m_type2_writes==0) m_write_address_laststart = m_write_address;
392392         m_write_address_lastend = m_write_address;
393393         m_type2_writes++;
394         m_lasttype2pc = cpu_get_pc(&space.device());
394         m_lasttype2pc = space.device().safe_pc();
395395      }
396396      else
397397      {
398         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);
398         if (LOG_VDP) logerror("xxx %06x littlerb_vdp_w offs %04x data %04x mask %04x\n", space.device().safe_pc(), offset, data, mem_mask);
399399      }
400400   }
401401
trunk/src/mame/drivers/namcos23.c
r17788r17789
15181518   case 0: return 0x8e | (machine().primary_screen->vblank() ? 0x0000 : 0x8000);
15191519   case 1: return c417.adr;
15201520   case 4:
1521      //      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));
1521      //      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));
15221522      return c417.ram[c417.adr];
15231523   case 5:
15241524      if(c417.pointrom_adr >= m_ptrom_limit)
r17788r17789
15311531
15321532   }
15331533
1534   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));
1534   logerror("c417_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
15351535   return 0;
15361536}
15371537
r17788r17789
15531553      c417.pointrom_adr = 0;
15541554      break;
15551555   case 4:
1556      //        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));
1556      //        logerror("c417_w %04x = %04x (%08x, %08x)\n", c417.adr, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
15571557      COMBINE_DATA(c417.ram + c417.adr);
15581558      break;
15591559   case 7:
r17788r17789
15611561      cputag_set_input_line(machine(), "maincpu", MIPS3_IRQ2, CLEAR_LINE);
15621562      break;
15631563   default:
1564      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));
1564      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));
15651565      break;
15661566   }
15671567}
r17788r17789
15701570{
15711571   c412_t &c412 = m_c412;
15721572
1573   //  logerror("c412_ram_r %06x (%08x, %08x)\n", offset, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
1573   //  logerror("c412_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
15741574   if(offset < 0x100000)
15751575      return c412.sdram_a[offset & 0xfffff];
15761576   else if(offset < 0x200000)
r17788r17789
15871587{
15881588   c412_t &c412 = m_c412;
15891589
1590   //  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));
1590   //  logerror("c412_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
15911591   if(offset < 0x100000)
15921592      COMBINE_DATA(c412.sdram_a + (offset & 0xfffff));
15931593   else if(offset < 0x200000)
r17788r17789
16111611   case 10: return s23_c412_ram_r(space, c412.adr, mem_mask);
16121612   }
16131613
1614   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));
1614   logerror("c412_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
16151615   return 0;
16161616}
16171617
r17788r17789
16241624   case 9: c412.adr = ((data & mem_mask) << 16) | (c412.adr & (0xffffffff ^ (mem_mask << 16))); break;
16251625   case 10: s23_c412_ram_w(space, c412.adr, data, mem_mask); c412.adr += 2; break;
16261626   default:
1627      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));
1627      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));
16281628      break;
16291629   }
16301630}
r17788r17789
16331633{
16341634   c421_t &c421 = m_c421;
16351635
1636   //  logerror("c421_ram_r %06x (%08x, %08x)\n", offset, cpu_get_pc(&space.device()), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
1636   //  logerror("c421_ram_r %06x (%08x, %08x)\n", offset, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
16371637   if(offset < 0x40000)
16381638      return c421.dram_a[offset & 0x3ffff];
16391639   else if(offset < 0x80000)
r17788r17789
16481648{
16491649   c421_t &c421 = m_c421;
16501650
1651   //  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));
1651   //  logerror("c421_ram_w %06x = %04x (%08x, %08x)\n", offset, data, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
16521652   if(offset < 0x40000)
16531653      COMBINE_DATA(c421.dram_a + (offset & 0x3ffff));
16541654   else if(offset < 0x80000)
r17788r17789
16671667   case 3: return c421.adr;
16681668   }
16691669
1670   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));
1670   logerror("c421_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
16711671   return 0;
16721672}
16731673
r17788r17789
16801680   case 2: c421.adr = ((data & mem_mask) << 16) | (c421.adr & (0xffffffff ^ (mem_mask << 16))); break;
16811681   case 3: c421.adr = (data & mem_mask) | (c421.adr & (0xffffffff ^ mem_mask)); break;
16821682   default:
1683      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));
1683      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));
16841684      break;
16851685   }
16861686}
r17788r17789
17171717
17181718   case 6:   // gmen wars spams this heavily with 0 prior to starting the GMEN board test
17191719      if (data != 0)
1720         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));
1720         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));
17211721      break;
17221722
17231723   default:
1724      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));
1724      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));
17251725   }
17261726}
17271727
r17788r17789
17361736      return res;
17371737   }
17381738   }
1739   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));
1739   logerror("ctl_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
17401740   return 0xffff;
17411741}
17421742
r17788r17789
17801780      break;
17811781
17821782   default:
1783      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));
1783      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));
17841784   }
17851785}
17861786
r17788r17789
17901790   case 5: return machine().primary_screen->vpos()*2 | (machine().primary_screen->vblank() ? 1 : 0);
17911791   case 6: return machine().primary_screen->vblank();
17921792   }
1793   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));
1793   logerror("c361_r %x @ %04x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
17941794   return 0xffff;
17951795}
17961796
r17788r17789
21852185   case 0xa: return 1; // Busy flag
21862186   }
21872187
2188   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));
2188   logerror("p3d_r %02x @ %08x (%08x, %08x)\n", offset, mem_mask, space.device().safe_pc(), (unsigned int)cpu_get_reg(&space.device(), MIPS3_R31));
21892189   return 0;
21902190}
21912191
r17788r17789
22032203      m_c361.timer->adjust(attotime::never);
22042204      return;
22052205   }
2206   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));
2206   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));
22072207}
22082208
22092209static void render_apply_transform(INT32 xi, INT32 yi, INT32 zi, const namcos23_render_entry *re, poly_vertex &pv)
trunk/src/mame/drivers/mjsister.c
r17788r17789
218218      case 0xf: m_vrambank = 1 ; break;
219219
220220      default:
221         logerror("%04x p30_w:%02x\n", cpu_get_pc(&space.device()), data);
221         logerror("%04x p30_w:%02x\n", space.device().safe_pc(), data);
222222   }
223223
224224   if (tmp != m_colorbank)
r17788r17789
239239      case 0xd: m_rombank1 = 1; break;
240240
241241      default:
242         logerror("%04x p31_w:%02x\n", cpu_get_pc(&space.device()), data);
242         logerror("%04x p31_w:%02x\n", space.device().safe_pc(), data);
243243   }
244244
245245   membank("bank1")->set_entry(m_rombank0 * 2 + m_rombank1);
trunk/src/mame/drivers/yunsung8.c
r17788r17789
5252   membank("bank1")->set_entry(data & 0x07);
5353
5454   if (data & ~0x37)
55      logerror("CPU #0 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
55      logerror("CPU #0 - PC %04X: Bank %02X\n", space.device().safe_pc(), data);
5656}
5757
5858/*
trunk/src/mame/drivers/wheelfir.c
r17788r17789
503503         {
504504            vpage=LAYER_BG;
505505/*
506                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()));
506                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());
507507
508508                for(int i=0;i<16;++i)
509509                {
trunk/src/mame/drivers/jaguar.c
r17788r17789
558558
559559WRITE32_MEMBER(jaguar_state::misc_control_w)
560560{
561   logerror("%08X:misc_control_w(%02X)\n", cpu_get_previouspc(&space.device()), data);
561   logerror("%08X:misc_control_w(%02X)\n", space.device().safe_pcbase(), data);
562562
563563   /*  D7    = board reset (low)
564564        D6    = audio must & reset (high)
r17788r17789
751751
752752WRITE32_MEMBER(jaguar_state::latch_w)
753753{
754   logerror("%08X:latch_w(%X)\n", cpu_get_previouspc(&space.device()), data);
754   logerror("%08X:latch_w(%X)\n", space.device().safe_pcbase(), data);
755755
756756   /* adjust banking */
757757   if (memregion("romboard")->base())
r17788r17789
795795         m_nvram[offset] = data & 0xff000000;
796796   }
797797//  else
798//      logerror("%08X:error writing to disabled EEPROM\n", cpu_get_previouspc(&space.device()));
798//      logerror("%08X:error writing to disabled EEPROM\n", space.device().safe_pcbase());
799799   m_eeprom_enable = false;
800800}
801801
r17788r17789
833833{
834834   /* update the data in memory */
835835   COMBINE_DATA(m_gpu_jump_address);
836   logerror("%08X:GPU jump address = %08X\n", cpu_get_previouspc(&space.device()), *m_gpu_jump_address);
836   logerror("%08X:GPU jump address = %08X\n", space.device().safe_pcbase(), *m_gpu_jump_address);
837837
838838   /* if the GPU is suspended, release it now */
839839   gpu_resume();
r17788r17789
848848{
849849   /* if the current GPU command is just pointing back to the spin loop, and */
850850   /* we're reading it from the spin loop, we can optimize */
851   if (*m_gpu_jump_address == m_gpu_spin_pc && cpu_get_previouspc(&space.device()) == m_gpu_spin_pc)
851   if (*m_gpu_jump_address == m_gpu_spin_pc && space.device().safe_pcbase() == m_gpu_spin_pc)
852852   {
853853#if ENABLE_SPEEDUP_HACKS
854854      /* spin if we're allowed */
trunk/src/mame/drivers/liberate.c
r17788r17789
4242      return m_spriteram[offset - 0x800];
4343   if (offset < 0x2200)
4444   {
45      logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset);
45      logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset);
4646      return 0;
4747   }
4848   if (offset < 0x2800)
4949      return m_scratchram[offset - 0x2200];
5050
51   logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset);
51   logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset);
5252   return 0;
5353}
5454
r17788r17789
6060   if (offset == 3) return ioport("DSW1")->read(); /* Dip 1 */
6161   if (offset == 4) return ioport("DSW2")->read(); /* Dip 2 */
6262
63   logerror("%04x:  Read input %d\n", cpu_get_pc(&space.device()), offset);
63   logerror("%04x:  Read input %d\n", space.device().safe_pc(), offset);
6464   return 0xff;
6565}
6666
r17788r17789
9393      return m_spriteram[offset - 0xc00];
9494   if (offset < 0x2200)
9595   {
96      logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset);
96      logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset);
9797      return 0;
9898   }
9999   if (offset < 0x2800)
100100      return m_scratchram[offset - 0x2200];
101101
102   logerror("%04x: Unmapped bank read %04x\n", cpu_get_pc(&space.device()), offset);
102   logerror("%04x: Unmapped bank read %04x\n", space.device().safe_pc(), offset);
103103   return 0;
104104}
105105
trunk/src/mame/drivers/seta.c
r17788r17789
13921392   } else {
13931393      uPD71054->timer[no]->adjust( attotime::never, no);
13941394      logerror( "CPU #0 PC %06X: uPD71054 error, timer %d duration is 0\n",
1395            (cpu != NULL) ? cpu_get_pc(cpu) : -1, no );
1395            (cpu != NULL) ? cpu->safe_pc() : -1, no );
13961396   }
13971397}
13981398
r17788r17789
16981698      case 0x16/2:   return (dir2 >> 8);         // upper 4 bits of p2 rotation
16991699      case 0x18/2:   return 0xffff;            // ? (value's read but not used)
17001700      default:
1701         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2);
1701         logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset*2);
17021702         return 0;
17031703   }
17041704}
r17788r17789
25102510      case 0xc/2:   return dir2y & 0xff;
25112511      case 0xe/2:   return dir2y >> 8;
25122512      default:
2513         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2);
2513         logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset*2);
25142514         return 0;
25152515   }
25162516}
r17788r17789
26752675      case 0x08/2:   return 0xffff;
26762676
26772677      default:
2678         logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset*2);
2678         logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset*2);
26792679         return 0x0000;
26802680   }
26812681}
r17788r17789
27012701
27022702READ16_MEMBER(seta_state::thunderl_protection_r)
27032703{
2704//  logerror("PC %06X - Protection Read\n", cpu_get_pc(&space.device()));
2704//  logerror("PC %06X - Protection Read\n", space.device().safe_pc());
27052705   return 0x00dd;
27062706}
27072707WRITE16_MEMBER(seta_state::thunderl_protection_w)
27082708{
2709//  logerror("PC %06X - Protection Written: %04X <- %04X\n", cpu_get_pc(&space.device()), offset*2, data);
2709//  logerror("PC %06X - Protection Written: %04X <- %04X\n", space.device().safe_pc(), offset*2, data);
27102710}
27112711
27122712/* Similar to downtown etc. */
r17788r17789
28722872   int retdata;
28732873
28742874   retdata = m_pairslove_protram[offset];
2875   //mame_printf_debug("pairs love protection? read %06x %04x %04x\n",cpu_get_pc(&space.device()), offset,retdata);
2875   //mame_printf_debug("pairs love protection? read %06x %04x %04x\n",space.device().safe_pc(), offset,retdata);
28762876   m_pairslove_protram[offset] = m_pairslove_protram_old[offset];
28772877   return retdata;
28782878}
28792879
28802880WRITE16_MEMBER(seta_state::pairlove_prot_w)
28812881{
2882   //mame_printf_debug("pairs love protection? write %06x %04x %04x\n",cpu_get_pc(&space.device()), offset,data);
2882   //mame_printf_debug("pairs love protection? write %06x %04x %04x\n",space.device().safe_pc(), offset,data);
28832883   m_pairslove_protram_old[offset] = m_pairslove_protram[offset];
28842884   m_pairslove_protram[offset] = data;
28852885}
r17788r17789
29562956      case 0x80:   return ioport("BET4")->read();
29572957   }
29582958
2959   logerror("%06X: unknown read, select = %04x\n",cpu_get_pc(&space.device()), *m_inttoote_key_select);
2959   logerror("%06X: unknown read, select = %04x\n",space.device().safe_pc(), *m_inttoote_key_select);
29602960   return 0xffff;
29612961}
29622962
r17788r17789
1070810708{
1070910709
1071010710   // protection check at boot
10711   logerror("%04x: twineagl_200100_r %d\n",cpu_get_pc(&space.device()),offset);
10711   logerror("%04x: twineagl_200100_r %d\n",space.device().safe_pc(),offset);
1071210712   return m_twineagl_xram[offset];
1071310713}
1071410714WRITE16_MEMBER(seta_state::twineagl_200100_w)
1071510715{
10716   logerror("%04x: twineagl_200100_w %d = %02x\n",cpu_get_pc(&space.device()),offset,data);
10716   logerror("%04x: twineagl_200100_w %d = %02x\n",space.device().safe_pc(),offset,data);
1071710717
1071810718   if (ACCESSING_BITS_0_7)
1071910719   {
trunk/src/mame/drivers/vball.c
r17788r17789
191191   m_vb_scrollx_hi = (data & 0x02) << 7;
192192   vb_bgprombank_w(machine(), (data >> 2) & 0x07);
193193   vb_spprombank_w(machine(), (data >> 5) & 0x07);
194   //logerror("%04x: vb_scrollx_hi = %d\n", cpu_get_previouspc(&space.device()), m_vb_scrollx_hi);
194   //logerror("%04x: vb_scrollx_hi = %d\n", space.device().safe_pcbase(), m_vb_scrollx_hi);
195195}
196196
197197WRITE8_MEMBER(vball_state::vb_scrollx_lo_w)
198198{
199199   m_vb_scrollx_lo = data;
200   //logerror("%04x: vb_scrollx_lo =%d\n", cpu_get_previouspc(&space.device()), m_vb_scrollx_lo);
200   //logerror("%04x: vb_scrollx_lo =%d\n", space.device().safe_pcbase(), m_vb_scrollx_lo);
201201}
202202
203203
trunk/src/mame/drivers/stv.c
r17788r17789
367367READ32_MEMBER(saturn_state::magzun_hef_hack_r)
368368{
369369
370   if(cpu_get_pc(&space.device())==0x604bf20) return 0x00000001; //HWEF
370   if(space.device().safe_pc()==0x604bf20) return 0x00000001; //HWEF
371371
372   if(cpu_get_pc(&space.device())==0x604bfbe) return 0x00000002; //HREF
372   if(space.device().safe_pc()==0x604bfbe) return 0x00000002; //HREF
373373
374374   return m_workram_h[0x08e830/4];
375375}
r17788r17789
377377READ32_MEMBER(saturn_state::magzun_rx_hack_r)
378378{
379379
380   if(cpu_get_pc(&space.device())==0x604c006) return 0x40;
380   if(space.device().safe_pc()==0x604c006) return 0x40;
381381
382382   return m_workram_h[0x0ff3b4/4];
383383}
r17788r17789
653653READ32_MEMBER(saturn_state::astrass_hack_r)
654654{
655655
656   if(cpu_get_pc(&space.device()) == 0x60011ba) return 0x00000000;
656   if(space.device().safe_pc() == 0x60011ba) return 0x00000000;
657657
658658   return m_workram_h[0x000770/4];
659659}
trunk/src/mame/drivers/vamphalf.c
r17788r17789
22182218
22192219READ16_MEMBER(vamphalf_state::vamphalf_speedup_r)
22202220{
2221   if(cpu_get_pc(&space.device()) == 0x82de)
2221   if(space.device().safe_pc() == 0x82de)
22222222   {
22232223      if(irq_active(&space))
22242224         device_spin_until_interrupt(&space.device());
r17788r17789
22312231
22322232READ16_MEMBER(vamphalf_state::vamphafk_speedup_r)
22332233{
2234   if(cpu_get_pc(&space.device()) == 0x82de)
2234   if(space.device().safe_pc() == 0x82de)
22352235   {
22362236      if(irq_active(&space))
22372237         device_spin_until_interrupt(&space.device());
r17788r17789
22442244
22452245READ16_MEMBER(vamphalf_state::misncrft_speedup_r)
22462246{
2247   if(cpu_get_pc(&space.device()) == 0xecc8)
2247   if(space.device().safe_pc() == 0xecc8)
22482248   {
22492249      if(irq_active(&space))
22502250         device_spin_until_interrupt(&space.device());
r17788r17789
22572257
22582258READ16_MEMBER(vamphalf_state::coolmini_speedup_r)
22592259{
2260   if(cpu_get_pc(&space.device()) == 0x75f7a)
2260   if(space.device().safe_pc() == 0x75f7a)
22612261   {
22622262      if(irq_active(&space))
22632263         device_spin_until_interrupt(&space.device());
r17788r17789
22702270
22712271READ16_MEMBER(vamphalf_state::suplup_speedup_r)
22722272{
2273   if(cpu_get_pc(&space.device()) == 0xaf18a )
2273   if(space.device().safe_pc() == 0xaf18a )
22742274   {
22752275      if(irq_active(&space))
22762276         device_spin_until_interrupt(&space.device());
r17788r17789
22832283
22842284READ16_MEMBER(vamphalf_state::luplup_speedup_r)
22852285{
2286   if(cpu_get_pc(&space.device()) == 0xaefac )
2286   if(space.device().safe_pc() == 0xaefac )
22872287   {
22882288      if(irq_active(&space))
22892289         device_spin_until_interrupt(&space.device());
r17788r17789
22962296
22972297READ16_MEMBER(vamphalf_state::luplup29_speedup_r)
22982298{
2299   if(cpu_get_pc(&space.device()) == 0xae6c0 )
2299   if(space.device().safe_pc() == 0xae6c0 )
23002300   {
23012301      if(irq_active(&space))
23022302         device_spin_until_interrupt(&space.device());
r17788r17789
23092309
23102310READ16_MEMBER(vamphalf_state::puzlbang_speedup_r)
23112311{
2312   if(cpu_get_pc(&space.device()) == 0xae6d2 )
2312   if(space.device().safe_pc() == 0xae6d2 )
23132313   {
23142314      if(irq_active(&space))
23152315         device_spin_until_interrupt(&space.device());
r17788r17789
23222322
23232323READ32_MEMBER(vamphalf_state::wyvernwg_speedup_r)
23242324{
2325   int pc = cpu_get_pc(&space.device());
2325   int pc = space.device().safe_pc();
23262326
23272327   if(pc == 0x10758)
23282328   {
r17788r17789
23372337
23382338READ32_MEMBER(vamphalf_state::wyvernwga_speedup_r)
23392339{
2340   int pc = cpu_get_pc(&space.device());
2340   int pc = space.device().safe_pc();
23412341
23422342   if(pc == 0x10758)
23432343   {
r17788r17789
23542354
23552355READ32_MEMBER(vamphalf_state::finalgdr_speedup_r)
23562356{
2357   if(cpu_get_pc(&space.device()) == 0x1c212)
2357   if(space.device().safe_pc() == 0x1c212)
23582358   {
23592359      if(irq_active(&space))
23602360         device_spin_until_interrupt(&space.device());
r17788r17789
23672367
23682368READ32_MEMBER(vamphalf_state::mrkicker_speedup_r)
23692369{
2370   UINT32 pc = cpu_get_pc(&space.device());
2370   UINT32 pc = space.device().safe_pc();
23712371   if(pc == 0x469de || pc == 0x46a36)
23722372   {
23732373//      if(irq_active(&space))
r17788r17789
23822382
23832383READ16_MEMBER(vamphalf_state::dquizgo2_speedup_r)
23842384{
2385   if(cpu_get_pc(&space.device()) == 0xaa622)
2385   if(space.device().safe_pc() == 0xaa622)
23862386   {
23872387      if(irq_active(&space))
23882388         device_spin_until_interrupt(&space.device());
r17788r17789
23952395
23962396READ32_MEMBER(vamphalf_state::aoh_speedup_r)
23972397{
2398   if(cpu_get_pc(&space.device()) == 0xb994 )
2398   if(space.device().safe_pc() == 0xb994 )
23992399   {
24002400      device_eat_cycles(&space.device(), 500);
24012401   }
2402   else if (cpu_get_pc(&space.device()) == 0xba40 )
2402   else if (space.device().safe_pc() == 0xba40 )
24032403   {
24042404      device_eat_cycles(&space.device(), 500);
24052405   }
r17788r17789
24102410
24112411READ16_MEMBER(vamphalf_state::jmpbreak_speedup_r)
24122412{
2413   if(cpu_get_pc(&space.device()) == 0x983c)
2413   if(space.device().safe_pc() == 0x983c)
24142414   {
24152415      if(irq_active(&space))
24162416         device_spin_until_interrupt(&space.device());
r17788r17789
24232423
24242424READ16_MEMBER(vamphalf_state::mrdig_speedup_r)
24252425{
2426   if(cpu_get_pc(&space.device()) == 0x1710)
2426   if(space.device().safe_pc() == 0x1710)
24272427   {
24282428      if(irq_active(&space))
24292429         device_spin_until_interrupt(&space.device());
r17788r17789
24372437READ16_MEMBER(vamphalf_state::dtfamily_speedup_r)
24382438{
24392439
2440   int pc = cpu_get_pc(&space.device());
2440   int pc = space.device().safe_pc();
24412441
24422442   if (pc == 0x12fa6)
24432443      device_spin_until_interrupt(&space.device());
r17788r17789
24492449READ16_MEMBER(vamphalf_state::toyland_speedup_r)
24502450{
24512451
2452   if (cpu_get_pc(&space.device()) == 0x130c2)
2452   if (space.device().safe_pc() == 0x130c2)
24532453      device_spin_until_interrupt(&space.device());
24542454
24552455   return m_wram[0x780d8 / 2];
r17788r17789
24582458
24592459READ16_MEMBER(vamphalf_state::boonggab_speedup_r)
24602460{
2461   if(cpu_get_pc(&space.device()) == 0x13198)
2461   if(space.device().safe_pc() == 0x13198)
24622462   {
24632463      if(irq_active(&space))
24642464         device_spin_until_interrupt(&space.device());
trunk/src/mame/drivers/raiden.c
r17788r17789
555555#ifdef SYNC_HACK
556556READ16_MEMBER(raiden_state::sub_cpu_spin_r)
557557{
558   int pc=cpu_get_pc(&space.device());
558   int pc=space.device().safe_pc();
559559   int ret=m_shared_ram[0x4];
560560
561561   // main set
trunk/src/mame/drivers/fromanc2.c
r17788r17789
6363   case 0x04:   ret = ioport("KEY2")->read(); break;
6464   case 0x08:   ret = ioport("KEY3")->read(); break;
6565   default:   ret = 0xffff;
66         logerror("PC:%08X unknown %02X\n", cpu_get_pc(&space.device()), m_portselect);
66         logerror("PC:%08X unknown %02X\n", space.device().safe_pc(), m_portselect);
6767         break;
6868   }
6969
trunk/src/mame/drivers/realbrk.c
r17788r17789
6363                     ((ioport("SW3")->read() & 0x0300) << 4) |
6464                     ((ioport("SW4")->read() & 0x0300) << 6) ;
6565
66   logerror("CPU #0 PC %06X: read with unknown dsw_select = %02x\n",cpu_get_pc(&space.device()),m_dsw_select[0]);
66   logerror("CPU #0 PC %06X: read with unknown dsw_select = %02x\n",space.device().safe_pc(),m_dsw_select[0]);
6767   return 0xffff;
6868}
6969
r17788r17789
123123{
124124   /*TODO: understand the format & cmds of the backup-ram,maybe it's an
125125            unemulated tmp68301 feature?*/
126   if(cpu_get_previouspc(&space.device()) == 0x02c08e)
126   if(space.device().safe_pcbase() == 0x02c08e)
127127      return 0xffff;
128128   else
129129      return m_backup_ram[offset];
r17788r17789
134134{
135135   /*TODO: understand the format & cmds of the backup-ram,maybe it's an
136136            unemulated tmp68301 feature?*/
137   if(cpu_get_previouspc(&space.device()) == 0x02f046)
137   if(space.device().safe_pcbase() == 0x02f046)
138138      return 0xffff;
139139   else
140140      return m_backup_ram[offset];
trunk/src/mame/drivers/superchs.c
r17788r17789
437437
438438READ32_MEMBER(superchs_state::main_cycle_r)
439439{
440   if (cpu_get_pc(&space.device())==0x702)
440   if (space.device().safe_pc()==0x702)
441441      device_spin_until_interrupt(&space.device());
442442
443443   return m_ram[0];
r17788r17789
445445
446446READ16_MEMBER(superchs_state::sub_cycle_r)
447447{
448   if (cpu_get_pc(&space.device())==0x454)
448   if (space.device().safe_pc()==0x454)
449449      device_spin_until_interrupt(&space.device());
450450
451451   return m_ram[2]&0xffff;
trunk/src/mame/drivers/mainevt.c
r17788r17789
110110{
111111   int bank_A, bank_B;
112112
113//logerror("CPU #1 PC: %04x bank switch = %02x\n",cpu_get_pc(&space.device()),data);
113//logerror("CPU #1 PC: %04x bank switch = %02x\n",space.device().safe_pc(),data);
114114
115115   /* bits 0-3 select the 007232 banks */
116116   bank_A = (data & 0x3);
r17788r17789
126126   device_t *device = machine().device("k007232");
127127   int bank_A, bank_B;
128128
129//logerror("CPU #1 PC: %04x bank switch = %02x\n",cpu_get_pc(&space->device()),data);
129//logerror("CPU #1 PC: %04x bank switch = %02x\n",space->device().safe_pc(),data);
130130
131131   /* bits 0-3 select the 007232 banks */
132132   bank_A = (data & 0x3);
trunk/src/mame/drivers/hitpoker.c
r17788r17789
216216
217217   if(offset == 0)
218218   {
219      if(cpu_get_pc(&space.device()) == 0x3143 ||
220         cpu_get_pc(&space.device()) == 0x314e ||
221         cpu_get_pc(&space.device()) == 0x3164 ||
222         cpu_get_pc(&space.device()) == 0x3179)
219      if(space.device().safe_pc() == 0x3143 ||
220         space.device().safe_pc() == 0x314e ||
221         space.device().safe_pc() == 0x3164 ||
222         space.device().safe_pc() == 0x3179)
223223         return m_pic_data;
224224
225225      return (m_pic_data & 0x7f) | (m_pic_data & 0x40 ? 0x80 : 0x00);
trunk/src/mame/drivers/meritm.c
r17788r17789
472472WRITE8_MEMBER(meritm_state::meritm_psd_a15_w)
473473{
474474   m_psd_a15 = data;
475   //logerror( "Writing PSD_A15 with %02x at PC=%04X\n", data, cpu_get_pc(&space.device()) );
475   //logerror( "Writing PSD_A15 with %02x at PC=%04X\n", data, space.device().safe_pc() );
476476   meritm_switch_banks(machine());
477477};
478478
trunk/src/mame/drivers/koftball.c
r17788r17789
137137      case 0x8000: return 0x0f0f;
138138   }
139139
140   logerror("unk prot r %x %x\n",m_prot_data,   cpu_get_previouspc(&space.device()));
140   logerror("unk prot r %x %x\n",m_prot_data,   space.device().safe_pcbase());
141141   return machine().rand();
142142}
143143
trunk/src/mame/drivers/vsnes.c
r17788r17789
171171    //"bnglngby" and "cluclu"
172172   if( data & 0xfe )
173173   {
174      logerror("vsnes_coin_counter_w: pc = 0x%04x - data = 0x%02x\n", cpu_get_pc(&space.device()), data);
174      logerror("vsnes_coin_counter_w: pc = 0x%04x - data = 0x%02x\n", space.device().safe_pc(), data);
175175   }
176176}
177177
r17788r17789
187187   if( data & 0xfe ) //vsbball service mode
188188   {
189189   //do something?
190      logerror("vsnes_coin_counter_1_w: pc = 0x%04x - data = 0x%02x\n", cpu_get_pc(&space.device()), data);
190      logerror("vsnes_coin_counter_1_w: pc = 0x%04x - data = 0x%02x\n", space.device().safe_pc(), data);
191191   }
192192
193193}
trunk/src/mame/drivers/cninja.c
r17788r17789
9191      return 0;
9292   }
9393
94   logerror("%08x:  Unmapped IRQ read %d\n", cpu_get_pc(&space.device()), offset);
94   logerror("%08x:  Unmapped IRQ read %d\n", space.device().safe_pc(), offset);
9595   return 0;
9696}
9797
r17788r17789
106106            0xc8:   Raster IRQ turned on (68k IRQ level 4)
107107            0xd8:   Raster IRQ turned on (68k IRQ level 3)
108108        */
109      logerror("%08x:  IRQ write %d %08x\n", cpu_get_pc(&space.device()), offset, data);
109      logerror("%08x:  IRQ write %d %08x\n", space.device().safe_pc(), offset, data);
110110      m_irq_mask = data & 0xff;
111111      return;
112112
r17788r17789
123123      return;
124124   }
125125
126   logerror("%08x:  Unmapped IRQ write %d %04x\n", cpu_get_pc(&space.device()), offset, data);
126   logerror("%08x:  Unmapped IRQ write %d %04x\n", space.device().safe_pc(), offset, data);
127127}
128128
129129READ16_MEMBER(cninja_state::robocop2_prot_r)
r17788r17789
137137      case 0x4e6: /* Dip switches */
138138         return ioport("DSW")->read();
139139      case 0x504: /* PC: 6b6.  b4, 2c, 36 written before read */
140         logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space.device()), offset);
140         logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset);
141141         return 0x84;
142142   }
143   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", cpu_get_pc(&space.device()), offset);
143   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", space.device().safe_pc(), offset);
144144   return 0;
145145}
146146
trunk/src/mame/drivers/missile.c
r17788r17789
555555INLINE int get_madsel(address_space *space)
556556{
557557   missile_state *state = space->machine().driver_data<missile_state>();
558   UINT16 pc = cpu_get_previouspc(&space->device());
558   UINT16 pc = space->device().safe_pcbase();
559559
560560   /* if we're at a different instruction than last time, reset our delay counter */
561561   if (pc != state->m_madsel_lastpc)
r17788r17789
766766
767767   /* anything else */
768768   else
769      logerror("%04X:Unknown write to %04X = %02X\n", cpu_get_pc(&space.device()), offset, data);
769      logerror("%04X:Unknown write to %04X = %02X\n", space.device().safe_pc(), offset, data);
770770}
771771
772772
r17788r17789
821821
822822   /* anything else */
823823   else
824      logerror("%04X:Unknown read from %04X\n", cpu_get_pc(&space.device()), offset);
824      logerror("%04X:Unknown read from %04X\n", space.device().safe_pc(), offset);
825825   return result;
826826}
827827
trunk/src/mame/drivers/igs_m027.c
r17788r17789
8080{
8181   COMBINE_DATA(&m_igs_cg_videoram[offset]);
8282   //if(data!=0)
83   logerror("PC(%08X) CG @%x = %x!\n",cpu_get_pc(&space.device()),offset ,m_igs_cg_videoram[offset]);
83   logerror("PC(%08X) CG @%x = %x!\n",space.device().safe_pc(),offset ,m_igs_cg_videoram[offset]);
8484
8585
8686
trunk/src/mame/drivers/route16.c
r17788r17789
941941
942942READ8_MEMBER(route16_state::routex_prot_read)
943943{
944   if (cpu_get_pc(&space.device()) == 0x2f) return 0xfb;
944   if (space.device().safe_pc() == 0x2f) return 0xfb;
945945
946   logerror ("cpu '%s' (PC=%08X): unmapped prot read\n", space.device().tag(), cpu_get_pc(&space.device()));
946   logerror ("cpu '%s' (PC=%08X): unmapped prot read\n", space.device().tag(), space.device().safe_pc());
947947   return 0x00;
948948
949949}
trunk/src/mame/drivers/tecmosys.c
r17788r17789
239239
240240      case 0x22/2:
241241         machine().watchdog_reset();
242         //logerror( "watchdog_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, cpu_get_pc(&space.device()) );
242         //logerror( "watchdog_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, space.device().safe_pc() );
243243         break;
244244
245245      default:
246         logerror( "unk880000_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, cpu_get_pc(&space.device()) );
246         logerror( "unk880000_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, space.device().safe_pc() );
247247         break;
248248   }
249249}
r17788r17789
252252{
253253   //UINT16 ret = m_880000regs[offset];
254254
255   logerror( "unk880000_r( %06x ) @ %06x = %04x\n", (offset * 2 ) +0x880000, cpu_get_pc(&space.device()), m_880000regs[offset] );
255   logerror( "unk880000_r( %06x ) @ %06x = %04x\n", (offset * 2 ) +0x880000, space.device().safe_pc(), m_880000regs[offset] );
256256
257257   /* this code allows scroll regs to be updated, but tkdensho at least resets perodically */
258258
trunk/src/mame/drivers/supbtime.c
r17788r17789
4646         return 0;
4747   }
4848
49   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", cpu_get_pc(&space.device()), offset);
49   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", space.device().safe_pc(), offset);
5050   return ~0;
5151}
5252
trunk/src/mame/drivers/gbusters.c
r17788r17789
5656   /* other bits unused/unknown */
5757   if (data & 0xfe)
5858   {
59      //logerror("%04x: (1f98) write %02x\n",cpu_get_pc(&space.device()), data);
59      //logerror("%04x: (1f98) write %02x\n",space.device().safe_pc(), data);
6060      //popmessage("$1f98 = %02x", data);
6161   }
6262}
r17788r17789
8484      sprintf(baf, "ccnt = %02x", data);
8585      popmessage(baf);
8686#endif
87      logerror("%04x: (ccount) write %02x\n", cpu_get_pc(&space.device()), data);
87      logerror("%04x: (ccount) write %02x\n", space.device().safe_pc(), data);
8888   }
8989}
9090
9191WRITE8_MEMBER(gbusters_state::gbusters_unknown_w)
9292{
93   logerror("%04x: write %02x to 0x1f9c\n",cpu_get_pc(&space.device()), data);
93   logerror("%04x: write %02x to 0x1f9c\n",space.device().safe_pc(), data);
9494
9595{
9696char baf[40];
r17788r17789
430430
431431   if (lines & 0xf0)
432432   {
433      //logerror("%04x: (lines) write %02x\n",cpu_get_pc(device), lines);
433      //logerror("%04x: (lines) write %02x\n",device->safe_pc(), lines);
434434      //popmessage("lines = %02x", lines);
435435   }
436436
trunk/src/mame/drivers/megaplay.c
r17788r17789
573573      state->m_bios_mode = MP_GAME;
574574      state->m_readpos = 1;
575575//      popmessage("Game bank selected: 0x%03x", state->m_game_banksel);
576      logerror("BIOS [0x%04x]: 68K address space bank selected: 0x%03x\n", cpu_get_previouspc(&space->device()), state->m_game_banksel);
576      logerror("BIOS [0x%04x]: 68K address space bank selected: 0x%03x\n", space->device().safe_pcbase(), state->m_game_banksel);
577577   }
578578
579579   state->m_mp_bios_bank_addr = ((state->m_mp_bios_bank_addr >> 1) | (data << 23)) & 0xff8000;
trunk/src/mame/drivers/r2dtank.c
r17788r17789
117117{
118118   UINT8 ret = soundlatch_byte_r(space, 0);
119119
120if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Command Read: %x\n", cpu_get_pc(&space.device()), ret);
120if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Command Read: %x\n", space.device().safe_pc(), ret);
121121
122122   return ret;
123123}
r17788r17789
128128   soundlatch_byte_w(space, 0, ~data);
129129   cputag_set_input_line(machine(), "audiocpu", M6800_IRQ_LINE, HOLD_LINE);
130130
131if (LOG_AUDIO_COMM) logerror("%08X   CPU#0  Audio Command Write: %x\n", cpu_get_pc(&space.device()), data^0xff);
131if (LOG_AUDIO_COMM) logerror("%08X   CPU#0  Audio Command Write: %x\n", space.device().safe_pc(), data^0xff);
132132}
133133
134134
135135READ8_MEMBER(r2dtank_state::audio_answer_r)
136136{
137137   UINT8 ret = soundlatch2_byte_r(space, 0);
138if (LOG_AUDIO_COMM) logerror("%08X  CPU#0  Audio Answer Read: %x\n", cpu_get_pc(&space.device()), ret);
138if (LOG_AUDIO_COMM) logerror("%08X  CPU#0  Audio Answer Read: %x\n", space.device().safe_pc(), ret);
139139
140140   return ret;
141141}
r17788r17789
144144WRITE8_MEMBER(r2dtank_state::audio_answer_w)
145145{
146146   /* HACK - prevents lock-up, but causes game to end some in-between sreens prematurely */
147   if (cpu_get_pc(&space.device()) == 0xfb12)
147   if (space.device().safe_pc() == 0xfb12)
148148      data = 0x00;
149149
150150   soundlatch2_byte_w(space, 0, data);
151151   cputag_set_input_line(machine(), "maincpu", M6809_IRQ_LINE, HOLD_LINE);
152152
153if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Answer Write: %x\n", cpu_get_pc(&space.device()), data);
153if (LOG_AUDIO_COMM) logerror("%08X  CPU#1  Audio Answer Write: %x\n", space.device().safe_pc(), data);
154154}
155155
156156
trunk/src/mame/drivers/crgolf.c
r17788r17789
138138
139139WRITE8_MEMBER(crgolf_state::unknown_w)
140140{
141   logerror("%04X:unknown_w = %02X\n", cpu_get_pc(&space.device()), data);
141   logerror("%04X:unknown_w = %02X\n", space.device().safe_pc(), data);
142142}
143143
144144
trunk/src/mame/drivers/rmhaihai.c
r17788r17789
103103{
104104   static const char *const keynames[] = { "KEY0", "KEY1" };
105105
106   logerror("%04x: keyboard_r\n",cpu_get_pc(&space.device()));
107   switch(cpu_get_pc(&space.device()))
106   logerror("%04x: keyboard_r\n",space.device().safe_pc());
107   switch(space.device().safe_pc())
108108   {
109109      /* read keyboard */
110110      case 0x0aba:   // rmhaihai, rmhaisei
r17788r17789
151151
152152WRITE8_MEMBER(rmhaihai_state::keyboard_w)
153153{
154logerror("%04x: keyboard_w %02x\n",cpu_get_pc(&space.device()),data);
154logerror("%04x: keyboard_w %02x\n",space.device().safe_pc(),data);
155155   m_keyboard_cmd = data;
156156}
157157
trunk/src/mame/drivers/topspeed.c
r17788r17789
312312
313313   parse_control(machine());
314314
315   logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data);
315   logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data);
316316}
317317
318318
r17788r17789
393393         return 0x55;   /* motor cpu status ? */
394394
395395      default:
396         logerror("CPU #0 PC %06x: warning - read from motor cpu %03x\n", cpu_get_pc(&space.device()), offset);
396         logerror("CPU #0 PC %06x: warning - read from motor cpu %03x\n", space.device().safe_pc(), offset);
397397         return 0;
398398   }
399399}
r17788r17789
401401WRITE16_MEMBER(topspeed_state::topspeed_motor_w)
402402{
403403   /* Writes $900000-25 and $900200-219 */
404   logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n", cpu_get_pc(&space.device()), data, offset);
404   logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n", space.device().safe_pc(), data, offset);
405405}
406406
407407
trunk/src/mame/drivers/fantland.c
r17788r17789
6464   m_nmi_enable = data;
6565
6666   if ((m_nmi_enable != 0) && (m_nmi_enable != 8))
67      logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space.device()), data);
67      logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", space.device().safe_pc(), data);
6868}
6969
7070WRITE16_MEMBER(fantland_state::fantland_nmi_enable_16_w)
r17788r17789
169169   // data & 0x31 changes when lightgun fires
170170
171171   if ((m_nmi_enable != 0) && (m_nmi_enable != 8))
172      logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space.device()), data);
172      logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", space.device().safe_pc(), data);
173173
174174//  popmessage("%02X", data);
175175}
r17788r17789
345345      {
346346         case 0x00:      borntofi_adpcm_stop(msm, voice); break;
347347         case 0x03:      borntofi_adpcm_start(msm, voice); break;
348         default:      logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", cpu_get_pc(&space.device()), reg, data);
348         default:      logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", space.device().safe_pc(), reg, data);
349349      }
350350   }
351351   else
trunk/src/mame/drivers/thunderx.c
r17788r17789
6262   {
6363      if (m_pmcbank)
6464      {
65//          logerror("%04x read pmcram %04x\n",cpu_get_pc(&space.device()),offset);
65//          logerror("%04x read pmcram %04x\n",space.device().safe_pc(),offset);
6666         return m_pmcram[offset];
6767      }
6868      else
6969      {
70         logerror("%04x read pmc internal ram %04x\n",cpu_get_pc(&space.device()),offset);
70         logerror("%04x read pmc internal ram %04x\n",space.device().safe_pc(),offset);
7171         return 0;
7272      }
7373   }
r17788r17789
8484   {
8585      if (m_pmcbank)
8686      {
87         logerror("%04x pmcram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data);
87         logerror("%04x pmcram %04x = %02x\n",space.device().safe_pc(),offset,data);
8888         m_pmcram[offset] = data;
8989      }
9090      else
91         logerror("%04x pmc internal ram %04x = %02x\n",cpu_get_pc(&space.device()),offset,data);
91         logerror("%04x pmc internal ram %04x = %02x\n",space.device().safe_pc(),offset,data);
9292   }
9393   else
9494      paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
r17788r17789
293293WRITE8_MEMBER(thunderx_state::thunderx_1f98_w)
294294{
295295
296   // logerror("%04x: 1f98_w %02x\n", cpu_get_pc(&space.device()),data);
296   // logerror("%04x: 1f98_w %02x\n", space.device().safe_pc(),data);
297297
298298   /* bit 0 = enable char ROM reading through the video RAM */
299299   k052109_set_rmrd_line(m_k052109, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
r17788r17789
318318   UINT8 *RAM = memregion("maincpu")->base();
319319   int offs;
320320
321//logerror("%04x: bank switch %02x\n",cpu_get_pc(&space.device()),data);
321//logerror("%04x: bank switch %02x\n",space.device().safe_pc(),data);
322322
323323   /* bits 0-3 ROM bank */
324324   offs = 0x10000 + (data & 0x0f)*0x2000;
r17788r17789
337337
338338WRITE8_MEMBER(thunderx_state::thunderx_videobank_w)
339339{
340   //logerror("%04x: select video ram bank %02x\n",cpu_get_pc(&space.device()),data);
340   //logerror("%04x: select video ram bank %02x\n",space.device().safe_pc(),data);
341341   /* 0x01 = work RAM at 4000-5fff */
342342   /* 0x00 = palette at 5800-5fff */
343343   /* 0x10 = unknown RAM at 5800-5fff */
r17788r17789
991991
992992static KONAMI_SETLINES_CALLBACK( thunderx_banking )
993993{
994   //logerror("thunderx %04x: bank select %02x\n", cpu_get_pc(device->cpu), lines);
994   //logerror("thunderx %04x: bank select %02x\n", device->cpu->safe_pc(), lines);
995995   device->machine().root_device().membank("bank1")->set_entry(((lines & 0x0f) ^ 0x08));
996996}
997997
trunk/src/mame/drivers/sothello.c
r17788r17789
214214    }
215215    else
216216    {
217        logerror("Sub cpu active! @%x\n",cpu_get_pc(&space->device()));
217        logerror("Sub cpu active! @%x\n",space->device().safe_pc());
218218    }
219219}
220220
trunk/src/mame/drivers/tumbleb.c
r17788r17789
31993199
32003200READ16_MEMBER(tumbleb_state::bcstory_1a0_read)
32013201{
3202   //mame_printf_debug("bcstory_io %06x\n",cpu_get_pc(&space.device()));
3202   //mame_printf_debug("bcstory_io %06x\n",space.device().safe_pc());
32033203
3204   if (cpu_get_pc(&space.device())==0x0560) return 0x1a0;
3204   if (space.device().safe_pc()==0x0560) return 0x1a0;
32053205   else return ioport("SYSTEM")->read();
32063206}
32073207
trunk/src/mame/drivers/cd32.c
r17788r17789
12361236{
12371237   cd32_state *state = machine.driver_data<cd32_state>();
12381238
1239   if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes())
1239   if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes())
12401240   {
12411241      //(*state->m_chip_ram_w)(0x051c02, 0x0000);
12421242
r17788r17789
12551255{
12561256   cd32_state *state = machine.driver_data<cd32_state>();
12571257
1258   if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes())
1258   if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes())
12591259   {
12601260      //amiga_chip_ram_w8(state, 0x002907, 0x00);
12611261
r17788r17789
12751275{
12761276   cd32_state *state = machine.driver_data<cd32_state>();
12771277
1278   if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes())
1278   if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes())
12791279   {
12801280      //amiga_chip_ram_w8(state, 0x001e1b, 0x00);
12811281
r17788r17789
12961296{
12971297   cd32_state *state = machine.driver_data<cd32_state>();
12981298
1299   if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes())
1299   if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes())
13001300   {
13011301      //amiga_chip_ram_w8(state, 0x046107, 0x00);
13021302
r17788r17789
13161316{
13171317   cd32_state *state = machine.driver_data<cd32_state>();
13181318
1319   if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes())
1319   if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes())
13201320   {
13211321      //amiga_chip_ram_w8(state, 0x00281c, 0x00);
13221322
r17788r17789
13361336{
13371337   cd32_state *state = machine.driver_data<cd32_state>();
13381338
1339   if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes())
1339   if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes())
13401340   {
13411341      //(*state->m_chip_ram_w)(0x04bfa0, 0x0000);
13421342
r17788r17789
13551355{
13561356   cd32_state *state = machine.driver_data<cd32_state>();
13571357
1358   if (cpu_get_pc(machine.device("maincpu")) < state->m_chip_ram.bytes())
1358   if (machine.device("maincpu")->safe_pc() < state->m_chip_ram.bytes())
13591359   {
13601360      //amiga_chip_ram_w8(state, 0x044f7e, 0x00);
13611361
trunk/src/mame/drivers/taitotz.c
r17788r17789
15871587               case 0xb:
15881588               {
15891589                  m_video_ram_ptr = m_video_reg & 0xfffffff;
1590                  //logerror("video_chip_ram sel %08X at %08X\n", m_video_reg & 0x0fffffff, cpu_get_pc(&space.device()));
1590                  //logerror("video_chip_ram sel %08X at %08X\n", m_video_reg & 0x0fffffff, space.device().safe_pc());
15911591                  break;
15921592               }
15931593               case 0x0:
r17788r17789
16751675      {
16761676         if (m_video_fifo_ptr >= 8)
16771677         {
1678            logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data >> 32), cpu_get_pc(&space.device()));
1678            logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data >> 32), space.device().safe_pc());
16791679         }
16801680         m_video_fifo_ptr++;
16811681      }
r17788r17789
16831683      {
16841684         if (m_video_fifo_ptr >= 8)
16851685         {
1686            logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data), cpu_get_pc(&space.device()));
1686            logerror("FIFO packet w: %08X at %08X\n", (UINT32)(data), space.device().safe_pc());
16871687         }
16881688         m_video_fifo_ptr++;
16891689      }
trunk/src/mame/drivers/cabaret.c
r17788r17789
140140{
141141   if ((m_nmi_enable ^ data) & (~0xdd))
142142   {
143      logerror("PC %06X: nmi_and_coins = %02x\n",cpu_get_pc(&space.device()),data);
143      logerror("PC %06X: nmi_and_coins = %02x\n",space.device().safe_pc(),data);
144144//      popmessage("%02x",data);
145145   }
146146
trunk/src/mame/drivers/lastfght.c
r17788r17789
210210{
211211
212212   if (ACCESSING_BITS_8_15)
213      logerror("%06x: 600000.b = %02x\n", cpu_get_pc(&space.device()), data >> 8);
213      logerror("%06x: 600000.b = %02x\n", space.device().safe_pc(), data >> 8);
214214   if (ACCESSING_BITS_0_7)
215215   {
216216      m_hi = data << 8;
217      //logerror("%06x: lastfght_hi  = %02x\n", cpu_get_pc(&space.device()), data);
217      //logerror("%06x: lastfght_hi  = %02x\n", space.device().safe_pc(), data);
218218   }
219219}
220220
r17788r17789
223223{
224224
225225   if (ACCESSING_BITS_8_15)
226      logerror("%06x: 800008.b = %02x\n", cpu_get_pc(&space.device()), data >> 8);
226      logerror("%06x: 800008.b = %02x\n", space.device().safe_pc(), data >> 8);
227227   if (ACCESSING_BITS_0_7)
228228   {
229229      m_x = m_hi | data;
230      //logerror("%06x: lastfght_x   = %02x\n", cpu_get_pc(&space.device()),data);
230      //logerror("%06x: lastfght_x   = %02x\n", space.device().safe_pc(),data);
231231   }
232232}
233233
r17788r17789
238238   if (ACCESSING_BITS_8_15)
239239   {
240240      m_y = m_hi | (data >> 8);
241      //logerror("%06x: lastfght_y   = %02x\n", cpu_get_pc(&space.device()), data >> 8);
241      //logerror("%06x: lastfght_y   = %02x\n", space.device().safe_pc(), data >> 8);
242242   }
243243   if (ACCESSING_BITS_0_7)
244244   {
245245      m_w = m_hi | data;
246      //logerror("%06x: lastfght_w   = %02x\n", cpu_get_pc(&space.device()), data);
246      //logerror("%06x: lastfght_w   = %02x\n", space.device().safe_pc(), data);
247247   }
248248}
249249
r17788r17789
254254   if (ACCESSING_BITS_8_15)
255255   {
256256      m_h = m_hi | (data >> 8);
257      //logerror("%06x: lastfght_h   = %02x\n", cpu_get_pc(&space.device()), data >> 8);
257      //logerror("%06x: lastfght_h   = %02x\n", space.device().safe_pc(), data >> 8);
258258   }
259259   if (ACCESSING_BITS_0_7)
260      logerror("%06x: 80000d.b = %02x\n", cpu_get_pc(&space.device()), data);
260      logerror("%06x: 80000d.b = %02x\n", space.device().safe_pc(), data);
261261}
262262
263263// source delta x << 6, source x << 6
r17788r17789
267267   if (ACCESSING_BITS_8_15)
268268   {
269269      m_dsx = m_hi | (data >> 8);
270      //logerror("%06x: lastfght_dsx = %02x\n", cpu_get_pc(&space.device()), data >> 8);
270      //logerror("%06x: lastfght_dsx = %02x\n", space.device().safe_pc(), data >> 8);
271271   }
272272   if (ACCESSING_BITS_0_7)
273273   {
274274      m_sx = m_hi | data;
275      //logerror("%06x: lastfght_sx  = %02x\n", cpu_get_pc(&space.device()), data);
275      //logerror("%06x: lastfght_sx  = %02x\n", space.device().safe_pc(), data);
276276   }
277277}
278278
r17788r17789
283283   if (ACCESSING_BITS_8_15)
284284   {
285285      m_sy = m_hi | (data >> 8);
286      //logerror("%06x: lastfght_sy  = %02x\n", cpu_get_pc(&space.device()), data >> 8);
286      //logerror("%06x: lastfght_sy  = %02x\n", space.device().safe_pc(), data >> 8);
287287   }
288288   if (ACCESSING_BITS_0_7)
289289   {
290290      m_sy1 = m_hi | data;
291      //logerror("%06x: lastfght_sy1 = %02x\n", cpu_get_pc(&space.device()), data);
291      //logerror("%06x: lastfght_sy1 = %02x\n", space.device().safe_pc(), data);
292292   }
293293}
294294
r17788r17789
299299   if (ACCESSING_BITS_8_15)
300300   {
301301      m_sp = (m_hi >> 8) >> 4;
302      //logerror("%06x: lastfght_sp  = %02x\n", cpu_get_pc(&space.device()), data >> 8);
302      //logerror("%06x: lastfght_sp  = %02x\n", space.device().safe_pc(), data >> 8);
303303   }
304304   if (ACCESSING_BITS_0_7)
305305   {
306306      m_sr = data;
307      //logerror("%06x: lastfght_sr  = %02x\n", cpu_get_pc(&space.device()), data);
307      //logerror("%06x: lastfght_sr  = %02x\n", space.device().safe_pc(), data);
308308   }
309309}
310310
r17788r17789
315315   if (ACCESSING_BITS_8_15)
316316   {
317317      m_sx1 = m_hi | (data >> 8);
318      //logerror("%06x: lastfght_sx1 = %02x\n", cpu_get_pc(&space.device()), data >> 8);
318      //logerror("%06x: lastfght_sx1 = %02x\n", space.device().safe_pc(), data >> 8);
319319   }
320320   if (ACCESSING_BITS_0_7)
321321   {
322322      m_dsy = m_hi | data;
323      //logerror("%06x: lastfght_dsy = %02x\n", cpu_get_pc(&space.device()), data);
323      //logerror("%06x: lastfght_dsy = %02x\n", space.device().safe_pc(), data);
324324   }
325325}
326326
r17788r17789
335335      bitmap_ind16 &dest = m_bitmap[m_dest];
336336
337337#if 0
338      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()),
338      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(),
339339            m_x, m_y, m_w + 1, m_h + 1,
340340            m_sx >> 6, m_sx & 0x3f, m_sx1 >> 6, m_dsx & 0x3f, m_sx1 >> 6, m_sx1 & 0x3f,
341341            m_sy >> 6, m_sy & 0x3f, m_sy1 >> 6, m_dsy & 0x3f, m_sy1 >> 6, m_sy1 & 0x3f,
r17788r17789
359359      }
360360   }
361361   if (ACCESSING_BITS_0_7)
362      logerror("%06x: 600007.b = %02x\n", cpu_get_pc(&space.device()), data);
362      logerror("%06x: 600007.b = %02x\n", space.device().safe_pc(), data);
363363}
364364
365365// toggle framebuffer
r17788r17789
415415WRITE16_MEMBER(lastfght_state::lastfght_sound_w)
416416{
417417   if (ACCESSING_BITS_8_15)
418      logerror("%06x: sound_w msb = %02x\n", cpu_get_pc(&space.device()), data >> 8);
418      logerror("%06x: sound_w msb = %02x\n", space.device().safe_pc(), data >> 8);
419419   if (ACCESSING_BITS_0_7)
420      logerror("%06x: sound_w lsb = %02x\n", cpu_get_pc(&space.device()), data);
420      logerror("%06x: sound_w lsb = %02x\n", space.device().safe_pc(), data);
421421}
422422
423423/***************************************************************************
trunk/src/mame/drivers/superqix.c
r17788r17789
172172
173173READ8_MEMBER(superqix_state::in4_mcu_r)
174174{
175//  logerror("%04x: in4_mcu_r\n",cpu_get_pc(&space->device()));
175//  logerror("%04x: in4_mcu_r\n",space->device().safe_pc());
176176   return ioport("P2")->read() | (m_from_mcu_pending << 6) | (m_from_z80_pending << 7);
177177}
178178
179179READ8_MEMBER(superqix_state::sqix_from_mcu_r)
180180{
181//  logerror("%04x: read mcu answer (%02x)\n",cpu_get_pc(&space->device()),m_from_mcu);
181//  logerror("%04x: read mcu answer (%02x)\n",space->device().safe_pc(),m_from_mcu);
182182   return m_from_mcu;
183183}
184184
r17788r17789
198198
199199WRITE8_MEMBER(superqix_state::sqix_z80_mcu_w)
200200{
201//  logerror("%04x: sqix_z80_mcu_w %02x\n",cpu_get_pc(&space->device()),data);
201//  logerror("%04x: sqix_z80_mcu_w %02x\n",space->device().safe_pc(),data);
202202   m_portb = data;
203203}
204204
r17788r17789
234234      case 7:
235235         if ((data & 1) == 0)
236236         {
237//              logerror("%04x: MCU -> Z80 %02x\n",cpu_get_pc(&space.device()),m_port3);
237//              logerror("%04x: MCU -> Z80 %02x\n",space.device().safe_pc(),m_port3);
238238            m_from_mcu = m_port3_latch;
239239            m_from_mcu_pending = 1;
240240            m_from_z80_pending = 0;   // ????
r17788r17789
260260   }
261261   else if ((m_port1 & 0x40) == 0)
262262   {
263//      logerror("%04x: read Z80 command %02x\n",cpu_get_pc(&space.device()),m_from_z80);
263//      logerror("%04x: read Z80 command %02x\n",space.device().safe_pc(),m_from_z80);
264264      m_from_z80_pending = 0;
265265      return m_from_z80;
266266   }
r17788r17789
297297   // bit 7 = clock latch from port 3 to Z80
298298   if ((m_port2 & 0x80) != 0 && (data & 0x80) == 0)
299299   {
300//      logerror("%04x: MCU -> Z80 %02x\n",cpu_get_pc(&space.device()),m_port3);
300//      logerror("%04x: MCU -> Z80 %02x\n",space.device().safe_pc(),m_port3);
301301      m_from_mcu = m_port3;
302302      m_from_mcu_pending = 1;
303303      m_from_z80_pending = 0;   // ????
r17788r17789
308308
309309READ8_MEMBER(superqix_state::sqixu_mcu_p3_r)
310310{
311//  logerror("%04x: read Z80 command %02x\n",cpu_get_pc(&space.device()),m_from_z80);
311//  logerror("%04x: read Z80 command %02x\n",space.device().safe_pc(),m_from_z80);
312312   m_from_z80_pending = 0;
313313   return m_from_z80;
314314}
r17788r17789
403403
404404READ8_MEMBER(superqix_state::hotsmash_68705_portA_r)
405405{
406//  logerror("%04x: 68705 reads port A = %02x\n",cpu_get_pc(&space.device()),m_portA_in);
406//  logerror("%04x: 68705 reads port A = %02x\n",space.device().safe_pc(),m_portA_in);
407407   return m_portA_in;
408408}
409409
r17788r17789
438438
439439         case 0x3:   // command from Z80
440440            m_portA_in = m_from_z80;
441//              logerror("%04x: z80 reads command %02x\n",cpu_get_pc(&space.device()),m_from_z80);
441//              logerror("%04x: z80 reads command %02x\n",space.device().safe_pc(),m_from_z80);
442442            break;
443443
444444         case 0x4:
r17788r17789
466466
467467READ8_MEMBER(superqix_state::hotsmash_from_mcu_r)
468468{
469//  logerror("%04x: z80 reads answer %02x\n",cpu_get_pc(&space.device()),m_from_mcu);
469//  logerror("%04x: z80 reads answer %02x\n",space.device().safe_pc(),m_from_mcu);
470470   m_from_mcu_pending = 0;
471471   return m_from_mcu;
472472}
473473
474474READ8_MEMBER(superqix_state::hotsmash_ay_port_a_r)
475475{
476//  logerror("%04x: ay_port_a_r and mcu_pending is %d\n",cpu_get_pc(&space->device()),m_from_mcu_pending);
476//  logerror("%04x: ay_port_a_r and mcu_pending is %d\n",space->device().safe_pc(),m_from_mcu_pending);
477477   return ioport("SYSTEM")->read() | 0x40 | ((m_from_mcu_pending^1) << 7);
478478}
479479
r17788r17789
509509      case 0x81: m_curr_player = 1; return 0;
510510   }
511511
512//  logerror("408[%x] r at %x\n",m_from_z80,cpu_get_pc(&space.device()));
512//  logerror("408[%x] r at %x\n",m_from_z80,space.device().safe_pc());
513513   return 0;
514514}
515515
516516READ8_MEMBER(superqix_state::pbillian_ay_port_a_r)
517517{
518//  logerror("%04x: ay_port_a_r\n",cpu_get_pc(&space->device()));
518//  logerror("%04x: ay_port_a_r\n",space->device().safe_pc());
519519   /* bits 76------  MCU status bits */
520520   return (machine().rand() & 0xc0) | machine().root_device().ioport("BUTTONS")->read();
521521}
trunk/src/mame/drivers/bfm_sc4h.c
r17788r17789
6464
6565READ16_MEMBER(sc4_state::sc4_cs1_r)
6666{
67   int pc = cpu_get_pc(&space.device());
67   int pc = space.device().safe_pc();
6868
6969   if (offset<0x100000/2)
7070   {
r17788r17789
113113
114114READ16_MEMBER(sc4_state::sc4_mem_r)
115115{
116   int pc = cpu_get_pc(&space.device());
116   int pc = space.device().safe_pc();
117117   int cs = m68307_get_cs(m_maincpu, offset * 2);
118118   int base = 0, end = 0, base2 = 0, end2 = 0;
119119//  if (!(debugger_access())) printf("cs is %d\n", cs);
r17788r17789
269269
270270WRITE16_MEMBER(sc4_state::sc4_mem_w)
271271{
272   int pc = cpu_get_pc(&space.device());
272   int pc = space.device().safe_pc();
273273   int cs = m68307_get_cs(m_maincpu, offset * 2);
274274   int base = 0, end = 0, base2 = 0, end2 = 0;
275275
r17788r17789
395395
396396READ32_MEMBER(sc4_adder4_state::adder4_mem_r)
397397{
398   int pc = cpu_get_pc(&space.device());
398   int pc = space.device().safe_pc();
399399   int cs = m68340_get_cs(m_adder4cpu, offset * 4);
400400
401401   switch ( cs )
r17788r17789
417417
418418WRITE32_MEMBER(sc4_adder4_state::adder4_mem_w)
419419{
420   int pc = cpu_get_pc(&space.device());
420   int pc = space.device().safe_pc();
421421   int cs = m68340_get_cs(m_adder4cpu, offset * 4);
422422
423423   switch ( cs )
r17788r17789
554554{
555555//  if (dedicated == false)
556556   {
557      int pc = cpu_get_pc(&space->device());
557      int pc = space->device().safe_pc();
558558      //m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
559559      // serial output to the VFD at least..
560560      logerror("%08x bfm_sc4_68307_portb_w %04x %04x\n", pc, data, line_mask);
r17788r17789
567567}
568568UINT8 bfm_sc4_68307_porta_r(address_space *space, bool dedicated, UINT8 line_mask)
569569{
570   int pc = cpu_get_pc(&space->device());
570   int pc = space->device().safe_pc();
571571   logerror("%08x bfm_sc4_68307_porta_r\n", pc);
572572   return space->machine().rand();
573573}
trunk/src/mame/drivers/tigeroad.c
r17788r17789
8484   tigeroad_state *state = space->machine().driver_data<tigeroad_state>();
8585   int indx;
8686   int value = 255;
87   int prevpc = cpu_get_previouspc(&space->device());
87   int prevpc = space->device().safe_pcbase();
8888
8989   if (prevpc == 0x244c)
9090   {
r17788r17789
145145
146146WRITE16_MEMBER(tigeroad_state::f1dream_control_w)
147147{
148   logerror("protection write, PC: %04x  FFE1 Value:%01x\n",cpu_get_pc(&space.device()), m_ram16[0x3fe0/2]);
148   logerror("protection write, PC: %04x  FFE1 Value:%01x\n",space.device().safe_pc(), m_ram16[0x3fe0/2]);
149149   f1dream_protection_w(&space);
150150}
151151
trunk/src/mame/drivers/spaceg.c
r17788r17789
255255         break;
256256
257257      default:
258         logerror("mode = %02x pc = %04x\n", *m_io9401, cpu_get_pc(&space.device()));
259         popmessage("mode = %02x pc = %04x\n", *m_io9401, cpu_get_pc(&space.device()));
258         logerror("mode = %02x pc = %04x\n", *m_io9401, space.device().safe_pc());
259         popmessage("mode = %02x pc = %04x\n", *m_io9401, space.device().safe_pc());
260260         return;
261261   }
262262
trunk/src/mame/drivers/gei.c
r17788r17789
260260
261261READ8_MEMBER(gei_state::catchall)
262262{
263   int pc = cpu_get_pc(&space.device());
263   int pc = space.device().safe_pc();
264264
265265   if (pc != 0x3c74 && pc != 0x0364 && pc != 0x036d)   /* weed out spurious blit reads */
266266      logerror("%04x: unmapped memory read from %04x\n",pc,offset);
trunk/src/mame/drivers/segas32.c
r17788r17789
452452   segas32_state *state = space->machine().driver_data<segas32_state>();
453453   int duration;
454454
455//  logerror("%06X:int_control_w(%X) = %02X\n", cpu_get_pc(&space->device()), offset, data);
455//  logerror("%06X:int_control_w(%X) = %02X\n", space->device().safe_pc(), offset, data);
456456   switch (offset)
457457   {
458458      case 0:
r17788r17789
765765   if (!m_custom_io_r[0].isnull())
766766      return (m_custom_io_r[0])(space, offset, mem_mask);
767767   else
768      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset);
768      logerror("%06X:io_expansion_r(%X)\n", space.device().safe_pc(), offset);
769769   return 0xffff;
770770}
771771
r17788r17789
779779   if (!m_custom_io_w[0].isnull())
780780      (m_custom_io_w[0])(space, offset, data, mem_mask);
781781   else
782      logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
782      logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff);
783783}
784784
785785
r17788r17789
789789      return (m_custom_io_r[0])(space, offset*2+0, mem_mask) |
790790           ((m_custom_io_r[0])(space, offset*2+1, mem_mask >> 16) << 16);
791791   else
792      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset);
792      logerror("%06X:io_expansion_r(%X)\n", space.device().safe_pc(), offset);
793793   return 0xffffffff;
794794}
795795
r17788r17789
808808      if (!m_custom_io_w[0].isnull())
809809         (m_custom_io_w[0])(space, offset*2+0, data, mem_mask);
810810      else
811         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
811         logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff);
812812
813813   }
814814   if (ACCESSING_BITS_16_23)
r17788r17789
816816      if (!m_custom_io_w[0].isnull())
817817         (m_custom_io_w[0])(space, offset*2+1, data >> 16, mem_mask >> 16);
818818      else
819         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
819         logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff);
820820   }
821821}
822822
r17788r17789
827827      return (m_custom_io_r[1])(space, offset*2+0, mem_mask) |
828828           ((m_custom_io_r[1])(space, offset*2+1, mem_mask >> 16) << 16);
829829   else
830      logerror("%06X:io_expansion_r(%X)\n", cpu_get_pc(&space.device()), offset);
830      logerror("%06X:io_expansion_r(%X)\n", space.device().safe_pc(), offset);
831831   return 0xffffffff;
832832}
833833
r17788r17789
840840      if (!m_custom_io_w[1].isnull())
841841         (m_custom_io_w[1])(space, offset*2+0, data, mem_mask);
842842      else
843         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
843         logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff);
844844   }
845845   if (ACCESSING_BITS_16_23)
846846   {
847847      if (!m_custom_io_w[1].isnull())
848848         (m_custom_io_w[1])(space, offset*2+1, data >> 16, mem_mask >> 16);
849849      else
850         logerror("%06X:io_expansion_w(%X) = %02X\n", cpu_get_pc(&space.device()), offset, data & 0xff);
850         logerror("%06X:io_expansion_w(%X) = %02X\n", space.device().safe_pc(), offset, data & 0xff);
851851   }
852852}
853853
r17788r17789
872872         m_analog_value[offset & 3] <<= 1;
873873         return result;
874874   }
875   logerror("%06X:unknown analog_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask);
875   logerror("%06X:unknown analog_custom_io_r(%X) & %04X\n", space.device().safe_pc(), offset*2, mem_mask);
876876   return 0xffff;
877877}
878878
r17788r17789
889889         m_analog_value[offset & 3] = ioport(names[offset & 3])->read_safe(0);
890890         return;
891891   }
892   logerror("%06X:unknown analog_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
892   logerror("%06X:unknown analog_custom_io_w(%X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask);
893893}
894894
895895
r17788r17789
905905         return ioport(names[offset & 3])->read_safe(0xffff);
906906   }
907907
908   logerror("%06X:unknown extra_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask);
908   logerror("%06X:unknown extra_custom_io_r(%X) & %04X\n", space.device().safe_pc(), offset*2, mem_mask);
909909   return 0xffff;
910910}
911911
r17788r17789
926926         m_analog_bank = data & 1;
927927         return;
928928   }
929   logerror("%06X:unknown orunners_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
929   logerror("%06X:unknown orunners_custom_io_w(%X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask);
930930}
931931
932932
r17788r17789
945945         return (UINT8)(ioport(names[offset/2])->read() - m_sonic_last[offset/2]);
946946   }
947947
948   logerror("%06X:unknown sonic_custom_io_r(%X) & %04X\n", cpu_get_pc(&space.device()), offset*2, mem_mask);
948   logerror("%06X:unknown sonic_custom_io_r(%X) & %04X\n", space.device().safe_pc(), offset*2, mem_mask);
949949   return 0xffff;
950950}
951951
r17788r17789
964964         return;
965965   }
966966
967   logerror("%06X:unknown sonic_custom_io_w(%X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
967   logerror("%06X:unknown sonic_custom_io_w(%X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask);
968968}
969969
970970
r17788r17789
977977
978978WRITE16_MEMBER(segas32_state::random_number_16_w)
979979{
980//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
980//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask);
981981}
982982
983983READ16_MEMBER(segas32_state::random_number_16_r)
r17788r17789
987987
988988WRITE32_MEMBER(segas32_state::random_number_32_w)
989989{
990//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", cpu_get_pc(&space.device()), offset*2, data, mem_mask);
990//  mame_printf_debug("%06X:random_seed_w(%04X) = %04X & %04X\n", space.device().safe_pc(), offset*2, data, mem_mask);
991991}
992992
993993READ32_MEMBER(segas32_state::random_number_32_r)
trunk/src/mame/drivers/looping.c
r17788r17789
444444WRITE8_MEMBER(looping_state::out_0_w){ mame_printf_debug("out0 = %02X\n", data); }
445445WRITE8_MEMBER(looping_state::out_2_w){ mame_printf_debug("out2 = %02X\n", data); }
446446
447READ8_MEMBER(looping_state::adc_r){ mame_printf_debug("%04X:ADC read\n", cpu_get_pc(&space.device())); return 0xff; }
448WRITE8_MEMBER(looping_state::adc_w){ mame_printf_debug("%04X:ADC write = %02X\n", cpu_get_pc(&space.device()), data); }
447READ8_MEMBER(looping_state::adc_r){ mame_printf_debug("%04X:ADC read\n", space.device().safe_pc()); return 0xff; }
448WRITE8_MEMBER(looping_state::adc_w){ mame_printf_debug("%04X:ADC write = %02X\n", space.device().safe_pc(), data); }
449449
450450WRITE8_MEMBER(looping_state::plr2_w)
451451{
trunk/src/mame/drivers/slapfght.c
r17788r17789
17701770        6D38: 20 F8         jr   nz,$6D32
17711771        6D3A: 10 E0         djnz $6D1C
17721772    */
1773   if (cpu_get_pc(&space.device()) == 0x6d1e) return 0;
1774   if (cpu_get_pc(&space.device()) == 0x6d24) return 6;
1775   if (cpu_get_pc(&space.device()) == 0x6d2c) return 2;
1776   if (cpu_get_pc(&space.device()) == 0x6d34) return 4;
1773   if (space.device().safe_pc() == 0x6d1e) return 0;
1774   if (space.device().safe_pc() == 0x6d24) return 6;
1775   if (space.device().safe_pc() == 0x6d2c) return 2;
1776   if (space.device().safe_pc() == 0x6d34) return 4;
17771777
17781778   /* The bootleg hangs in the "test mode" before diplaying (wrong) lives settings :
17791779        6AD4: DB 00         in   a,($00)
r17788r17789
17941794        6AF7: 20 FA         jr   nz,$6AF3
17951795       This seems to be what used to be the MCU status.
17961796    */
1797   if (cpu_get_pc(&space.device()) == 0x6ad6) return 2; /* bit 1 must be ON */
1798   if (cpu_get_pc(&space.device()) == 0x6ae4) return 2; /* bit 1 must be ON */
1799   if (cpu_get_pc(&space.device()) == 0x6af5) return 0; /* bit 2 must be OFF */
1797   if (space.device().safe_pc() == 0x6ad6) return 2; /* bit 1 must be ON */
1798   if (space.device().safe_pc() == 0x6ae4) return 2; /* bit 1 must be ON */
1799   if (space.device().safe_pc() == 0x6af5) return 0; /* bit 2 must be OFF */
18001800
1801   logerror("Port Read PC=%04x\n",cpu_get_pc(&space.device()));
1801   logerror("Port Read PC=%04x\n",space.device().safe_pc());
18021802
18031803   return 0;
18041804}
trunk/src/mame/drivers/offtwall.c
r17788r17789
163163{
164164
165165   /* this is the banked ROM read */
166   logerror("%06X: %04X\n", cpu_get_previouspc(&space.device()), offset);
166   logerror("%06X: %04X\n", space.device().safe_pcbase(), offset);
167167
168168   /* if the values are $3e000 or $3e002 are being read by code just below the
169169        ROM bank area, we need to return the correct value to give the proper checksum */
170   if ((offset == 0x3000 || offset == 0x3001) && cpu_get_previouspc(&space.device()) > 0x37000)
170   if ((offset == 0x3000 || offset == 0x3001) && space.device().safe_pcbase() > 0x37000)
171171   {
172172      UINT32 checksum = (space.read_word(0x3fd210) << 16) | space.read_word(0x3fd212);
173173      UINT32 us = 0xaaaa5555 - checksum;
r17788r17789
202202
203203READ16_MEMBER(offtwall_state::spritecache_count_r)
204204{
205   int prevpc = cpu_get_previouspc(&space.device());
205   int prevpc = space.device().safe_pcbase();
206206
207207   /* if this read is coming from $99f8 or $9992, it's in the sprite copy loop */
208208   if (prevpc == 0x99f8 || prevpc == 0x9992)
r17788r17789
256256
257257READ16_MEMBER(offtwall_state::unknown_verify_r)
258258{
259   int prevpc = cpu_get_previouspc(&space.device());
259   int prevpc = space.device().safe_pcbase();
260260   if (prevpc < 0x5c5e || prevpc > 0xc432)
261261      return m_unknown_verify_base[offset];
262262   else
trunk/src/mame/drivers/eolithsp.c
r17788r17789
2121void eolith_speedup_read(address_space *space)
2222{
2323   /* for debug */
24  //if ((cpu_get_pc(&space->device())!=eolith_speedup_address) && (eolith_vblank!=1) )
24  //if ((space->device().safe_pc()!=eolith_speedup_address) && (eolith_vblank!=1) )
2525  //    printf("%s:eolith speedup_read data %02x\n",space->machine().describe_context(), eolith_vblank);
2626
2727   if (eolith_vblank==0 && eolith_scanline < eolith_speedup_resume_scanline)
2828   {
29      int pc = cpu_get_pc(&space->device());
29      int pc = space->device().safe_pc();
3030
3131      if ((pc==eolith_speedup_address) || (pc==eolith_speedup_address2))
3232      {
r17788r17789
117117// StealSee doesn't use interrupts, just the vblank
118118CUSTOM_INPUT_MEMBER(eolith_state::stealsee_speedup_getvblank)
119119{
120   int pc = cpu_get_pc(m_maincpu);
120   int pc = m_maincpu->safe_pc();
121121
122122   if (pc==0x400081ec)
123123      if(!eolith_vblank)
trunk/src/mame/drivers/halleys.c
r17788r17789
10191019
10201020READ8_MEMBER(halleys_state::blitter_status_r)
10211021{
1022   if (m_game_id==GAME_HALLEYS && cpu_get_pc(&space.device())==0x8017) return(0x55); // HACK: trick SRAM test on startup
1022   if (m_game_id==GAME_HALLEYS && space.device().safe_pc()==0x8017) return(0x55); // HACK: trick SRAM test on startup
10231023
10241024   return(0);
10251025}
r17788r17789
10901090    UPDATE: re-implemented pixel collision to accompany the hack method.
10911091*/
10921092
1093   if (m_game_id==GAME_HALLEYS && cpu_get_pc(&space.device())==m_collision_detection) // HACK: collision detection bypass
1093   if (m_game_id==GAME_HALLEYS && space.device().safe_pc()==m_collision_detection) // HACK: collision detection bypass
10941094   {
10951095      if (m_collision_count) { m_collision_count--; return(m_collision_list[m_collision_count]); }
10961096
trunk/src/mame/drivers/djmain.c
r17788r17789
375375
376376WRITE32_MEMBER(djmain_state::unknown590000_w)
377377{
378   //logerror("%08X: unknown 590000 write %08X: %08X & %08X\n", cpu_get_previouspc(&space.device()), offset, data, mem_mask);
378   //logerror("%08X: unknown 590000 write %08X: %08X & %08X\n", space.device().safe_pcbase(), offset, data, mem_mask);
379379}
380380
381381WRITE32_MEMBER(djmain_state::unknown802000_w)
382382{
383   //logerror("%08X: unknown 802000 write %08X: %08X & %08X\n", cpu_get_previouspc(&space.device()), offset, data, mem_mask);
383   //logerror("%08X: unknown 802000 write %08X: %08X & %08X\n", space.device().safe_pcbase(), offset, data, mem_mask);
384384}
385385
386386WRITE32_MEMBER(djmain_state::unknownc02000_w)
387387{
388   //logerror("%08X: unknown c02000 write %08X: %08X & %08X\n", cpu_get_previouspc(&space.device()), offset, data, mem_mask);
388   //logerror("%08X: unknown c02000 write %08X: %08X & %08X\n", space.device().safe_pcbase(), offset, data, mem_mask);
389389}
390390
391391
trunk/src/mame/drivers/neogeo.c
r17788r17789
224224
225225   state->m_display_counter = (state->m_display_counter & 0x0000ffff) | ((UINT32)data << 16);
226226
227   if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", cpu_get_pc(&space->device()), state->m_display_counter);
227   if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", space->device().safe_pc(), state->m_display_counter);
228228}
229229
230230
r17788r17789
234234
235235   state->m_display_counter = (state->m_display_counter & 0xffff0000) | data;
236236
237   if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", cpu_get_pc(&space->device()), state->m_display_counter);
237   if (LOG_VIDEO_SYSTEM) logerror("PC %06x: set_display_counter %08x\n", space->device().safe_pc(), state->m_display_counter);
238238
239239   if (state->m_display_position_interrupt_control & IRQ2CTRL_LOAD_RELATIVE)
240240   {
r17788r17789
434434//  case 0x33: break; // coui lockout
435435
436436   default:
437      logerror("PC: %x  Unmapped I/O control write.  Offset: %x  Data: %x\n", cpu_get_pc(&space.device()), offset, data);
437      logerror("PC: %x  Unmapped I/O control write.  Offset: %x  Data: %x\n", space.device().safe_pc(), offset, data);
438438      break;
439439   }
440440}
r17788r17789
460460   else
461461   {
462462      m_recurse = 1;
463      ret = space.read_word(cpu_get_pc(&space.device()));
463      ret = space.read_word(space.device().safe_pc());
464464      m_recurse = 0;
465465   }
466466
r17788r17789
583583      /* boost the interleave to let the audio CPU read the command */
584584      machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
585585
586      if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(&space.device()), data, mem_mask);
586      if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", space.device().safe_pc(), data, mem_mask);
587587   }
588588}
589589
r17788r17789
592592{
593593   UINT8 ret = soundlatch_byte_r(space, 0);
594594
595   if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret);
595   if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", space.device().safe_pc(), ret);
596596
597597   /* this is a guess */
598598   audio_cpu_clear_nmi_w(space, 0, 0);
r17788r17789
604604WRITE8_MEMBER(neogeo_state::audio_result_w)
605605{
606606
607   if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC   %04x: audio_result_w %02x\n", cpu_get_pc(&space.device()), data);
607   if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC   %04x: audio_result_w %02x\n", space.device().safe_pc(), data);
608608
609609   m_audio_result = data;
610610}
r17788r17789
614614{
615615   UINT32 ret = m_audio_result;
616616
617//  if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(machine().device("maincpu")), ret);
617//  if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", machine().device("maincpu")->safe_pc(), ret);
618618
619619   return ret;
620620}
r17788r17789
654654{
655655   neogeo_state *state = space->machine().driver_data<neogeo_state>();
656656
657   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);
657   if (LOG_MAIN_CPU_BANKING) logerror("MAIN CPU PC %06x: neogeo_set_main_cpu_bank_address %06x\n", space->device().safe_pc(), bank_address);
658658
659659   state->m_main_cpu_bank_address = bank_address;
660660
r17788r17789
668668   UINT32 len = memregion("maincpu")->bytes();
669669
670670   if ((len <= 0x100000) && (data & 0x07))
671      logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", cpu_get_pc(&space.device()), data);
671      logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", space.device().safe_pc(), data);
672672   else
673673   {
674674      bank_address = ((data & 0x07) + 1) * 0x100000;
675675
676676      if (bank_address >= len)
677677      {
678         logerror("PC %06x: warning: bankswitch to empty bank %02x\n", cpu_get_pc(&space.device()), data);
678         logerror("PC %06x: warning: bankswitch to empty bank %02x\n", space.device().safe_pc(), data);
679679         bank_address = 0x100000;
680680      }
681681
r17788r17789
721721{
722722   neogeo_state *state = space->machine().driver_data<neogeo_state>();
723723
724   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);
724   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);
725725
726726   state->m_audio_cpu_banks[region] = bank;
727727
r17788r17789
777777
778778      cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, PULSE_LINE);
779779
780      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");
780      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");
781781   }
782782}
783783
r17788r17789
858858      case 0x02: /* unknown - HC32 middle pin 1 */
859859      case 0x03: /* unknown - uPD4990 pin ? */
860860      case 0x04: /* unknown - HC32 middle pin 10 */
861         logerror("PC: %x  Unmapped system control write.  Offset: %x  Data: %x\n", cpu_get_pc(&space.device()), offset & 0x07, bit);
861         logerror("PC: %x  Unmapped system control write.  Offset: %x  Data: %x\n", space.device().safe_pc(), offset & 0x07, bit);
862862         break;
863863      }
864864
865      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);
865      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);
866866   }
867867}
868868
trunk/src/mame/drivers/d9final.c
r17788r17789
102102/* game checks this after three attract cycles, otherwise coin inputs stop to work. */
103103READ8_MEMBER(d9final_state::prot_latch_r)
104104{
105//  printf("PC=%06x\n",cpu_get_pc(&space.device()));
105//  printf("PC=%06x\n",space.device().safe_pc());
106106
107107   return 0x04;
108108}
trunk/src/mame/drivers/ladybug.c
r17788r17789
119119         m_sraider_0x38 = data&0x3f;
120120         break;
121121      default:
122         mame_printf_debug("(%04X) write to %02X\n", cpu_get_pc(&space.device()), offset);
122         mame_printf_debug("(%04X) write to %02X\n", space.device().safe_pc(), offset);
123123         break;
124124   }
125125}
trunk/src/mame/drivers/taito_f2.c
r17788r17789
348348//          return (coin_word & mem_mask);
349349   }
350350
351   logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n", cpu_get_pc(&space.device()), offset);
351   logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n", space.device().safe_pc(), offset);
352352
353353   return 0xff;
354354}
r17788r17789
372372         return res;
373373   }
374374
375   logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n", cpu_get_pc(&space.device()), offset);
375   logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n", space.device().safe_pc(), offset);
376376
377377   return 0;
378378}
r17788r17789
392392      }
393393   }
394394
395   logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n", cpu_get_pc(&space.device()), offset);
395   logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n", space.device().safe_pc(), offset);
396396
397397   return 0xff;
398398}
r17788r17789
418418
419419   }
420420
421   logerror("CPU #0 mjnquest_input %06x: warning - read unknown input %06x\n", cpu_get_pc(&space.device()), m_mjnquest_input);
421   logerror("CPU #0 mjnquest_input %06x: warning - read unknown input %06x\n", space.device().safe_pc(), m_mjnquest_input);
422422
423423   return 0xff;
424424}
r17788r17789
663663WRITE16_MEMBER(taitof2_state::cchip2_word_w)
664664{
665665
666   logerror("cchip2_w pc: %06x offset %04x: %02x\n", cpu_get_pc(&space.device()), offset, data);
666   logerror("cchip2_w pc: %06x offset %04x: %02x\n", space.device().safe_pc(), offset, data);
667667
668668   COMBINE_DATA(&m_cchip2_ram[offset]);
669669}
trunk/src/mame/drivers/pandoras.c
r17788r17789
8282      case 0x07:   device_set_input_line(m_subcpu, INPUT_LINE_NMI, PULSE_LINE);
8383            break;
8484
85      default:   logerror("%04x: (irq_ctrl) write %02x to %02x\n",cpu_get_pc(&space.device()), data, offset);
85      default:   logerror("%04x: (irq_ctrl) write %02x to %02x\n",space.device().safe_pc(), data, offset);
8686            break;
8787   }
8888}
trunk/src/mame/drivers/ddragon.c
r17788r17789
223223
224224READ8_MEMBER(ddragon_state::darktowr_mcu_bank_r)
225225{
226   // logerror("BankRead %05x %08x\n",cpu_get_pc(&space.device()),offset);
226   // logerror("BankRead %05x %08x\n",space.device().safe_pc(),offset);
227227
228228   /* Horrible hack - the alternate TStrike set is mismatched against the MCU,
229229   so just hack around the protection here.  (The hacks are 'right' as I have
r17788r17789
232232   if (!strcmp(machine().system().name, "tstrike"))
233233   {
234234      /* Static protection checks at boot-up */
235      if (cpu_get_pc(&space.device()) == 0x9ace)
235      if (space.device().safe_pc() == 0x9ace)
236236         return 0;
237      if (cpu_get_pc(&space.device()) == 0x9ae4)
237      if (space.device().safe_pc() == 0x9ae4)
238238         return 0x63;
239239
240240      /* Just return whatever the code is expecting */
r17788r17789
251251
252252WRITE8_MEMBER(ddragon_state::darktowr_mcu_bank_w)
253253{
254   logerror("BankWrite %05x %08x %08x\n", cpu_get_pc(&space.device()), offset, data);
254   logerror("BankWrite %05x %08x %08x\n", space.device().safe_pc(), offset, data);
255255
256256   if (offset == 0x1400 || offset == 0)
257257   {
r17788r17789
355355
356356WRITE8_MEMBER(ddragon_state::darktowr_mcu_w)
357357{
358   logerror("McuWrite %05x %08x %08x\n",cpu_get_pc(&space.device()), offset, data);
358   logerror("McuWrite %05x %08x %08x\n",space.device().safe_pc(), offset, data);
359359   m_darktowr_mcu_ports[offset] = data;
360360}
361361
362362
363363READ8_MEMBER(ddragon_state::ddragon_hd63701_internal_registers_r)
364364{
365   logerror("%04x: read %d\n", cpu_get_pc(&space.device()), offset);
365   logerror("%04x: read %d\n", space.device().safe_pc(), offset);
366366   return 0;
367367}
368368
r17788r17789
396396{
397397
398398   /* Double Dragon crash fix - see notes above */
399   if (offset == 0x49 && cpu_get_pc(&space.device()) == 0x6261 && m_spriteram[offset] == 0x1f)
399   if (offset == 0x49 && space.device().safe_pc() == 0x6261 && m_spriteram[offset] == 0x1f)
400400      return 0x1;
401401
402402   return m_spriteram[offset];
trunk/src/mame/drivers/acommand.c
r17788r17789
305305
306306READ16_MEMBER(acommand_state::ac_devices_r)
307307{
308   logerror("(PC=%06x) read at %04x\n",cpu_get_pc(&space.device()),offset*2);
308   logerror("(PC=%06x) read at %04x\n",space.device().safe_pc(),offset*2);
309309
310310   switch(offset)
311311   {
trunk/src/mame/drivers/ppmast93.c
r17788r17789
218218      case 0:
219219      case 1: ym2413_w(machine().device("ymsnd"),offset,data); break;
220220      case 2: machine().device<dac_device>("dac")->write_unsigned8(data);break;
221      default: logerror("%x %x - %x\n",offset,data,cpu_get_previouspc(&space.device()));
221      default: logerror("%x %x - %x\n",offset,data,space.device().safe_pcbase());
222222   }
223223}
224224
trunk/src/mame/drivers/taito_l.c
r17788r17789
375375         logerror("New rom size : %x\n", (m_high + 1) * 0x2000);
376376      }
377377
378      //logerror("robs %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device()));
378      //logerror("robs %d, %02x (%04x)\n", offset, data, space.device().safe_pc());
379379      m_cur_rombank = data;
380380      membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x2000 * m_cur_rombank);
381381   }
r17788r17789
394394         logerror("New rom2 size : %x\n", (m_high2 + 1) * 0x4000);
395395      }
396396
397      //logerror("robs2 %02x (%04x)\n", data, cpu_get_pc(&space.device()));
397      //logerror("robs2 %02x (%04x)\n", data, space.device().safe_pc());
398398
399399      m_cur_rombank2 = data;
400400      membank("bank6")->set_base(machine().root_device().memregion("slave")->base() + 0x4000 * m_cur_rombank2);
r17788r17789
417417   if (m_cur_rambank[offset] != data)
418418   {
419419      m_cur_rambank[offset] = data;
420//logerror("rabs %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device()));
420//logerror("rabs %d, %02x (%04x)\n", offset, data, space.device().safe_pc());
421421      if (data >= 0x14 && data <= 0x1f)
422422      {
423423         data -= 0x14;
r17788r17789
431431      }
432432      else
433433      {
434         logerror("unknown rambankswitch %d, %02x (%04x)\n", offset, data, cpu_get_pc(&space.device()));
434         logerror("unknown rambankswitch %d, %02x (%04x)\n", offset, data, space.device().safe_pc());
435435         m_current_notifier[offset] = 0;
436436         m_current_base[offset] = m_empty_ram;
437437      }
r17788r17789
504504WRITE8_MEMBER(taitol_state::mcu_data_w)
505505{
506506   m_last_data = data;
507   m_last_data_adr = cpu_get_pc(&space.device());
508//  logerror("mcu write %02x (%04x)\n", data, cpu_get_pc(&space.device()));
507   m_last_data_adr = space.device().safe_pc();
508//  logerror("mcu write %02x (%04x)\n", data, space.device().safe_pc());
509509   switch (data)
510510   {
511511   case 0x43:
r17788r17789
517517
518518WRITE8_MEMBER(taitol_state::mcu_control_w)
519519{
520//  logerror("mcu control %02x (%04x)\n", data, cpu_get_pc(&space.device()));
520//  logerror("mcu control %02x (%04x)\n", data, space.device().safe_pc());
521521}
522522
523523READ8_MEMBER(taitol_state::mcu_data_r)
524524{
525525
526//  logerror("mcu read (%04x) [%02x, %04x]\n", cpu_get_pc(&space.device()), last_data, last_data_adr);
526//  logerror("mcu read (%04x) [%02x, %04x]\n", space.device().safe_pc(), last_data, last_data_adr);
527527   if (m_mcu_pos == m_mcu_reply_len)
528528      return 0;
529529
r17788r17789
532532
533533READ8_MEMBER(taitol_state::mcu_control_r)
534534{
535//  logerror("mcu control read (%04x)\n", cpu_get_pc(&space.device()));
535//  logerror("mcu control read (%04x)\n", space.device().safe_pc());
536536   return 0x1;
537537}
538538
539539#if 0
540540WRITE8_MEMBER(taitol_state::sound_w)
541541{
542   logerror("Sound_w %02x (%04x)\n", data, cpu_get_pc(&space.device()));
542   logerror("Sound_w %02x (%04x)\n", data, space.device().safe_pc());
543543}
544544#endif
545545
r17788r17789
559559   case 7:
560560      return ioport("IN2")->read();
561561   default:
562      logerror("Mux read from unknown port %d (%04x)\n", m_mux_ctrl, cpu_get_pc(&space.device()));
562      logerror("Mux read from unknown port %d (%04x)\n", m_mux_ctrl, space.device().safe_pc());
563563      return 0xff;
564564   }
565565}
r17788r17789
573573      control2_w(space, 0, data);
574574      break;
575575   default:
576      logerror("Mux write to unknown port %d, %02x (%04x)\n", m_mux_ctrl, data, cpu_get_pc(&space.device()));
576      logerror("Mux write to unknown port %d, %02x (%04x)\n", m_mux_ctrl, data, space.device().safe_pc());
577577   }
578578}
579579
r17788r17789
17881788      m_cur_bank = data & 0x03;
17891789      bankaddress = m_cur_bank * 0x4000;
17901790      membank("bank7")->set_base(&RAM[bankaddress]);
1791      //logerror ("YM2203 bank change val=%02x  pc=%04x\n", m_cur_bank, cpu_get_pc(&space->device()) );
1791      //logerror ("YM2203 bank change val=%02x  pc=%04x\n", m_cur_bank, space->device().safe_pc() );
17921792   }
17931793}
17941794
trunk/src/mame/drivers/segald.c
r17788r17789
125125   if (m_nmi_enable)
126126      m_ldv1000_input_latch = m_laserdisc->status_r();
127127
128   logerror("DISC read   (0x%04x) @ 0x%04x [0x%x]\n", m_ldv1000_input_latch, offset, cpu_get_pc(&space.device()));
128   logerror("DISC read   (0x%04x) @ 0x%04x [0x%x]\n", m_ldv1000_input_latch, offset, space.device().safe_pc());
129129
130130   return m_ldv1000_input_latch;
131131}
r17788r17789
133133READ8_MEMBER(segald_state::astron_OUT_read)
134134{
135135
136   logerror("OUT read   (0x%04x) @ 0x%04x [0x%x]\n", m_out_ram[offset], offset, cpu_get_pc(&space.device()));
136   logerror("OUT read   (0x%04x) @ 0x%04x [0x%x]\n", m_out_ram[offset], offset, space.device().safe_pc());
137137   return m_out_ram[offset];
138138}
139139
140140READ8_MEMBER(segald_state::astron_OBJ_read)
141141{
142142
143   logerror("OBJ read   (0x%04x) @ 0x%04x [0x%x]\n", m_obj_ram[offset], offset, cpu_get_pc(&space.device()));
143   logerror("OBJ read   (0x%04x) @ 0x%04x [0x%x]\n", m_obj_ram[offset], offset, space.device().safe_pc());
144144   return m_obj_ram[offset];
145145}
146146
147147READ8_MEMBER(segald_state::astron_COLOR_read)
148148{
149149
150   logerror("COLOR read   (0x%04x) @ 0x%04x [0x%x]\n", m_color_ram[offset], offset, cpu_get_pc(&space.device()));
150   logerror("COLOR read   (0x%04x) @ 0x%04x [0x%x]\n", m_color_ram[offset], offset, space.device().safe_pc());
151151   return m_color_ram[offset];
152152}
153153
r17788r17789
156156WRITE8_MEMBER(segald_state::astron_DISC_write)
157157{
158158
159   logerror("DISC write : 0x%04x @  0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device()));
159   logerror("DISC write : 0x%04x @  0x%04x [0x%x]\n", data, offset, space.device().safe_pc());
160160
161161   m_ldv1000_output_latch = data;
162162
r17788r17789
167167WRITE8_MEMBER(segald_state::astron_OUT_write)
168168{
169169
170   logerror("OUT write : 0x%04x @  0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device()));
170   logerror("OUT write : 0x%04x @  0x%04x [0x%x]\n", data, offset, space.device().safe_pc());
171171
172172   switch(offset)
173173   {
r17788r17789
205205{
206206
207207   m_obj_ram[offset] = data;
208   logerror("OBJ write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device()));
208   logerror("OBJ write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, space.device().safe_pc());
209209}
210210
211211WRITE8_MEMBER(segald_state::astron_COLOR_write)
r17788r17789
228228   a = (highBits & 0x80) ? 0 : 255;
229229
230230   palette_set_color(machine(), palIndex, MAKE_ARGB(a, r, g, b));
231   logerror("COLOR write : 0x%04x @   0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device()));
231   logerror("COLOR write : 0x%04x @   0x%04x [0x%x]\n", data, offset, space.device().safe_pc());
232232}
233233
234234WRITE8_MEMBER(segald_state::astron_FIX_write)
235235{
236236
237237   m_fix_ram[offset] = data;
238   /* logerror("FIX write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(&space.device())); */
238   /* logerror("FIX write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, space.device().safe_pc()); */
239239}
240240
241241WRITE8_MEMBER(segald_state::astron_io_bankswitch_w)
trunk/src/mame/drivers/tickee.c
r17788r17789
293293   }
294294
295295   if (olddata != m_control[offset])
296      logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", cpu_get_pc(&space.device()), offset, m_control[offset], olddata);
296      logerror("%08X:tickee_control_w(%d) = %04X (was %04X)\n", space.device().safe_pc(), offset, m_control[offset], olddata);
297297}
298298
299299
trunk/src/mame/drivers/m92.c
r17788r17789
253253READ16_MEMBER(m92_state::m92_eeprom_r)
254254{
255255   UINT8 *RAM = memregion("eeprom")->base();
256//  logerror("%05x: EEPROM RE %04x\n",cpu_get_pc(&space.device()),offset);
256//  logerror("%05x: EEPROM RE %04x\n",space.device().safe_pc(),offset);
257257   return RAM[offset] | 0xff00;
258258}
259259
260260WRITE16_MEMBER(m92_state::m92_eeprom_w)
261261{
262262   UINT8 *RAM = memregion("eeprom")->base();
263//  logerror("%05x: EEPROM WR %04x\n",cpu_get_pc(&space.device()),offset);
263//  logerror("%05x: EEPROM WR %04x\n",space.device().safe_pc(),offset);
264264   if (ACCESSING_BITS_0_7)
265265      RAM[offset] = data;
266266}
r17788r17789
283283   {
284284      membank("bank1")->set_entry((data & 0x06) >> 1);
285285      if (data & 0xf9)
286         logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space.device()), data);
286         logerror("%05x: bankswitch %04x\n", space.device().safe_pc(), data);
287287   }
288288}
289289
r17788r17789
304304
305305READ16_MEMBER(m92_state::m92_sound_status_r)
306306{
307//logerror("%06x: read sound status\n",cpu_get_pc(&space.device()));
307//logerror("%06x: read sound status\n",space.device().safe_pc());
308308   return m_sound_status;
309309}
310310
trunk/src/mame/drivers/fuukifg2.c
r17788r17789
117117   if (data <= 2)
118118      membank("bank1")->set_entry(data);
119119   else
120      logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", cpu_get_pc(&space.device()), data);
120      logerror("CPU #1 - PC %04X: unknown bank bits: %02X\n", space.device().safe_pc(), data);
121121}
122122
123123WRITE8_MEMBER(fuuki16_state::fuuki16_oki_banking_w)
trunk/src/mame/drivers/sderby.c
r17788r17789
8282         return 0xffff;         // to avoid game to reset (needs more work)
8383   }
8484
85   logerror("sderby_input_r : offset = %x - PC = %06x\n",offset*2,cpu_get_pc(&space.device()));
85   logerror("sderby_input_r : offset = %x - PC = %06x\n",offset*2,space.device().safe_pc());
8686
8787   return 0xffff;
8888}
r17788r17789
126126
127127READ16_MEMBER(sderby_state::rprot_r)
128128{
129   logerror("rprot_r : offset = %02x\n",cpu_get_pc(&space.device()));
129   logerror("rprot_r : offset = %02x\n",space.device().safe_pc());
130130
131131/* This is the only mask I found that allow a normal play.
132132   Using other values, the game hangs waiting for response,
trunk/src/mame/drivers/shangha3.c
r17788r17789
4646{
4747   static const int result[] = { 0x0,0x1,0x3,0x7,0xf,0xe,0xc,0x8,0x0};
4848
49   logerror("PC %04x: read 20004e\n",cpu_get_pc(&space.device()));
49   logerror("PC %04x: read 20004e\n",space.device().safe_pc());
5050
5151   return result[m_prot_count++ % 9];
5252}
5353WRITE16_MEMBER(shangha3_state::shangha3_prot_w)
5454{
55   logerror("PC %04x: write %02x to 20004e\n",cpu_get_pc(&space.device()),data);
55   logerror("PC %04x: write %02x to 20004e\n",space.device().safe_pc(),data);
5656}
5757
5858
trunk/src/mame/drivers/39in1.c
r17788r17789
13701370READ32_MEMBER(_39in1_state::cpld_r)
13711371{
13721372
1373   //if (cpu_get_pc(&space.device()) != 0xe3af4) printf("CPLD read @ %x (PC %x state %d)\n", offset, cpu_get_pc(&space.device()), state);
1373   //if (space.device().safe_pc() != 0xe3af4) printf("CPLD read @ %x (PC %x state %d)\n", offset, space.device().safe_pc(), state);
13741374
1375   if (cpu_get_pc(&space.device()) == 0x3f04)
1375   if (space.device().safe_pc() == 0x3f04)
13761376   {
13771377      return 0xf0;     // any non-zero value works here
13781378   }
1379   else if (cpu_get_pc(&space.device()) == 0xe3af4)
1379   else if (space.device().safe_pc() == 0xe3af4)
13801380   {
13811381      return ioport("MCUIPT")->read();
13821382   }
r17788r17789
14311431      m_seed = data<<16;
14321432   }
14331433
1434   if (cpu_get_pc(&space.device()) == 0x280c)
1434   if (space.device().safe_pc() == 0x280c)
14351435   {
14361436      m_state = 1;
14371437   }
1438   if (cpu_get_pc(&space.device()) == 0x2874)
1438   if (space.device().safe_pc() == 0x2874)
14391439   {
14401440      m_state = 2;
14411441      m_magic = space.read_byte(0xa02d4ff0);
r17788r17789
14461446#if 0
14471447   else
14481448   {
1449      printf("%08x: CPLD_W: %08x = %08x & %08x\n", cpu_get_pc(&space.device()), offset, data, mem_mask);
1449      printf("%08x: CPLD_W: %08x = %08x & %08x\n", space.device().safe_pc(), offset, data, mem_mask);
14501450   }
14511451#endif
14521452}
trunk/src/mame/drivers/cyclemb.c
r17788r17789
419419{
420420   if(offset == 1) //status port
421421   {
422      //printf("STATUS PC=%04x\n",cpu_get_pc(m_maincpu));
422      //printf("STATUS PC=%04x\n",m_maincpu->safe_pc());
423423
424424      return 1;
425425   }
r17788r17789
427427   {
428428      UINT8 i,pt;
429429
430      //printf("%04x\n",cpu_get_pc(m_maincpu));
430      //printf("%04x\n",m_maincpu->safe_pc());
431431
432432      /* TODO: internal state of this */
433      if(cpu_get_pc(m_maincpu) == m_dsw_pc_hack)
433      if(m_maincpu->safe_pc() == m_dsw_pc_hack)
434434         m_mcu[0].rxd = (ioport("DSW1")->read() & 0x1f) << 2;
435435      else if(m_mcu[0].rst)
436436      {
437         //printf("READ PC=%04x\n",cpu_get_pc(m_maincpu));
437         //printf("READ PC=%04x\n",m_maincpu->safe_pc());
438438         {
439439
440440            switch(m_mcu[0].state)
r17788r17789
500500{
501501   if(offset == 1) //command port
502502   {
503      //printf("%02x CMD PC=%04x\n",data,cpu_get_pc(m_maincpu));
503      //printf("%02x CMD PC=%04x\n",data,m_maincpu->safe_pc());
504504      switch(data)
505505      {
506506         case 0:
r17788r17789
535535   }
536536   else
537537   {
538      //printf("%02x DATA PC=%04x\n",data,cpu_get_pc(m_maincpu));
538      //printf("%02x DATA PC=%04x\n",data,m_maincpu->safe_pc());
539539
540540      m_mcu[0].txd = data;
541541
trunk/src/mame/drivers/mcr.c
r17788r17789
569569         nflfoot_serial_in_active = FALSE;
570570   }
571571
572   if (cpu_get_pc(&space.device()) != 0x107)
573      logerror("%04X:ip2_r = %02X\n", cpu_get_pc(&space.device()), val);
572   if (space.device().safe_pc() != 0x107)
573      logerror("%04X:ip2_r = %02X\n", space.device().safe_pc(), val);
574574   return val;
575575}
576576
r17788r17789
580580   z80sio_device *sio = machine().device<z80sio_device>("ipu_sio");
581581
582582   /* bit 7 = J3-7 on IPU board = /RXDA on SIO */
583   logerror("%04X:op4_w(%d%d%d)\n", cpu_get_pc(&space.device()), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1);
583   logerror("%04X:op4_w(%d%d%d)\n", space.device().safe_pc(), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1);
584584
585585   /* look for a non-zero start bit to go active */
586586   if (!nflfoot_serial_out_active && (data & 0x80))
trunk/src/mame/drivers/mpu4vid.c
r17788r17789
16001600   mpu4_state *state = space->machine().driver_data<mpu4_state>();
16011601   int x;
16021602   int call=data;
1603   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(&space->device()),offset,data));
1603   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", space->device().safe_pcbase(),offset,data));
16041604
16051605   if (!state->m_current_chr_table)
16061606   {
1607      logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
1607      logerror("No Characteriser Table @ %04x\n", space->device().safe_pcbase());
16081608      return;
16091609   }
16101610
r17788r17789
16301630static READ16_HANDLER( characteriser16_r )
16311631{
16321632   mpu4_state *state = space->machine().driver_data<mpu4_state>();
1633   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));
1633   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));
16341634   LOG_CHR(("Characteriser read offset %02X \n",offset));
16351635   LOG_CHR(("Characteriser read data %02X \n",state->m_current_chr_table[state->m_prot_col].response));
16361636
16371637   if (!state->m_current_chr_table)
16381638   {
1639      logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
1639      logerror("No Characteriser Table @ %04x\n", space->device().safe_pcbase());
16401640      return 0x00;
16411641   }
16421642
16431643
16441644   /* hack for 'invalid questions' error on time machine.. I guess it wants them to decode properly for startup check? */
1645   if (cpu_get_previouspc(&space->device())==0x283a)
1645   if (space->device().safe_pcbase()==0x283a)
16461646   {
16471647      return 0x00;
16481648   }
r17788r17789
16721672   mpu4_state *state = space->machine().driver_data<mpu4_state>();
16731673   int x;
16741674   int call=data &0xff;
1675   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", cpu_get_previouspc(&space->device()),offset,data));
1675   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", space->device().safe_pcbase(),offset,data));
16761676   if (!state->m_current_chr_table)
16771677   {
1678      logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
1678      logerror("No Characteriser Table @ %04x\n", space->device().safe_pcbase());
16791679      return;
16801680   }
16811681
trunk/src/mame/drivers/bfm_swp.c
r17788r17789
146146
147147READ32_MEMBER(bfm_swp_state::bfm_swp_mem_r)
148148{
149   int pc = cpu_get_pc(&space.device());
149   int pc = space.device().safe_pc();
150150   int cs = m68340_get_cs(m_maincpu, offset * 4);
151151
152152   switch ( cs )
r17788r17789
168168
169169WRITE32_MEMBER(bfm_swp_state::bfm_swp_mem_w)
170170{
171   int pc = cpu_get_pc(&space.device());
171   int pc = space.device().safe_pc();
172172   int cs = m68340_get_cs(m_maincpu, offset * 4);
173173
174174   switch ( cs )
trunk/src/mame/drivers/dcheese.c
r17788r17789
183183   if ((diff & 0x40) && (data & 0x40))
184184      m_bsmt->reset();
185185   if (data != 0x40 && data != 0x60)
186      logerror("%04X:sound_control_w = %02X\n", cpu_get_pc(&space.device()), data);
186      logerror("%04X:sound_control_w = %02X\n", space.device().safe_pc(), data);
187187}
188188
189189
trunk/src/mame/drivers/trvmadns.c
r17788r17789
200200{
201201   if(offset==0)
202202   {
203      if(cpu_get_previouspc(&space.device())==0x29e9)// || cpu_get_previouspc(&space.device())==0x1b3f) //29f5
203      if(space.device().safe_pcbase()==0x29e9)// || space.device().safe_pcbase()==0x1b3f) //29f5
204204      {
205205         cputag_set_input_line(machine(), "maincpu", 0, HOLD_LINE);
206206      }
207207//      else
208//          logerror("%x \n", cpu_get_previouspc(&space.device()));
208//          logerror("%x \n", space.device().safe_pcbase());
209209
210210   }
211211
trunk/src/mame/drivers/albazg.c
r17788r17789
134134/*Custom RAM (Thrash Protection)*/
135135READ8_MEMBER(albazg_state::custom_ram_r)
136136{
137//  logerror("Custom RAM read at %02x PC = %x\n", offset + 0xaf80, cpu_get_pc(&space.device()));
137//  logerror("Custom RAM read at %02x PC = %x\n", offset + 0xaf80, space.device().safe_pc());
138138   return m_cus_ram[offset];// ^ 0x55;
139139}
140140
141141WRITE8_MEMBER(albazg_state::custom_ram_w)
142142{
143//  logerror("Custom RAM write at %02x : %02x PC = %x\n", offset + 0xaf80, data, cpu_get_pc(&space.device()));
143//  logerror("Custom RAM write at %02x : %02x PC = %x\n", offset + 0xaf80, data, space.device().safe_pc());
144144   if(m_prot_lock)
145145      m_cus_ram[offset] = data;
146146}
r17788r17789
148148/*this might be used as NVRAM commands btw*/
149149WRITE8_MEMBER(albazg_state::prot_lock_w)
150150{
151//  logerror("PC %04x Prot lock value written %02x\n", cpu_get_pc(&space.device()), data);
151//  logerror("PC %04x Prot lock value written %02x\n", space.device().safe_pc(), data);
152152   m_prot_lock = data;
153153}
154154
trunk/src/mame/drivers/backfire.c
r17788r17789
189189READ32_MEMBER(backfire_state::backfire_control2_r)
190190{
191191
192//  logerror("%08x:Read eprom %08x (%08x)\n", cpu_get_pc(&space.device()), offset << 1, mem_mask);
192//  logerror("%08x:Read eprom %08x (%08x)\n", space.device().safe_pc(), offset << 1, mem_mask);
193193   return (m_eeprom->read_bit() << 24) | ioport("IN1")->read() | (ioport("IN1")->read() << 16);
194194}
195195
r17788r17789
197197READ32_MEMBER(backfire_state::backfire_control3_r)
198198{
199199
200//  logerror("%08x:Read eprom %08x (%08x)\n", cpu_get_pc(&space.device()), offset << 1, mem_mask);
200//  logerror("%08x:Read eprom %08x (%08x)\n", space.device().safe_pc(), offset << 1, mem_mask);
201201   return (m_eeprom->read_bit() << 24) | ioport("IN2")->read() | (ioport("IN2")->read() << 16);
202202}
203203#endif
r17788r17789
699699READ32_MEMBER(backfire_state::backfire_speedup_r)
700700{
701701
702   //mame_printf_debug( "%08x\n",cpu_get_pc(&space.device()));
702   //mame_printf_debug( "%08x\n",space.device().safe_pc());
703703
704   if (cpu_get_pc(&space.device() )== 0xce44)  device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfire
705   if (cpu_get_pc(&space.device()) == 0xcee4)  device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfirea
704   if (space.device() .safe_pc()== 0xce44)  device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfire
705   if (space.device().safe_pc() == 0xcee4)  device_spin_until_time(&space.device(), attotime::from_usec(400)); // backfirea
706706
707707   return m_mainram[0x18/4];
708708}
trunk/src/mame/drivers/starwars.c
r17788r17789
125125   /* if we are in the slapstic region, process it */
126126   if ((address & 0xe000) == 0x8000)
127127   {
128      offs_t pc = cpu_get_pc(&direct.space().device());
128      offs_t pc = direct.space().device().safe_pc();
129129
130130      /* filter out duplicates; we get these because the handler gets called for
131131           multiple reasons:
trunk/src/mame/drivers/exerion.c
r17788r17789
172172
173173READ8_MEMBER(exerion_state::exerion_protection_r)
174174{
175   if (cpu_get_pc(&space.device()) == 0x4143)
175   if (space.device().safe_pc() == 0x4143)
176176      return memregion("maincpu")->base()[0x33c0 + (m_main_ram[0xd] << 2) + offset];
177177   else
178178      return m_main_ram[0x8 + offset];
trunk/src/mame/drivers/segas18.c
r17788r17789
341341   }
342342   if (!m_custom_io_r.isnull())
343343      return m_custom_io_r(space, offset, mem_mask);
344   logerror("%06X:misc_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2);
344   logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2);
345345   return open_bus_r(space, 0, mem_mask);
346346}
347347
r17788r17789
375375      m_custom_io_w(space, offset, data, mem_mask);
376376      return;
377377   }
378   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask);
378   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask);
379379}
380380
381381
trunk/src/mame/drivers/mosaic.c
r17788r17789
4141{
4242   int res = (m_prot_val >> 8) & 0xff;
4343
44   logerror("%06x: protection_r %02x\n", cpu_get_pc(&space.device()), res);
44   logerror("%06x: protection_r %02x\n", space.device().safe_pc(), res);
4545
4646   m_prot_val <<= 8;
4747
r17788r17789
5151WRITE8_MEMBER(mosaic_state::gfire2_protection_w)
5252{
5353
54   logerror("%06x: protection_w %02x\n", cpu_get_pc(&space.device()), data);
54   logerror("%06x: protection_w %02x\n", space.device().safe_pc(), data);
5555
5656   switch(data)
5757   {
trunk/src/mame/drivers/astrocorp.c
r17788r17789
192192   {
193193      okim6295_device *oki = downcast<okim6295_device *>(device);
194194      oki->set_bank_base(0x40000 * ((data >> 8) & 1));
195//      logerror("CPU #0 PC %06X: OKI bank %08X\n", cpu_get_pc(&space->device()), data);
195//      logerror("CPU #0 PC %06X: OKI bank %08X\n", space->device().safe_pc(), data);
196196   }
197197}
198198
r17788r17789
203203   {
204204      okim6295_device *oki = downcast<okim6295_device *>(device);
205205      oki->set_bank_base(0x40000 * (data & 1));
206//      logerror("CPU #0 PC %06X: OKI bank %08X\n", cpu_get_pc(&space->device()), data);
206//      logerror("CPU #0 PC %06X: OKI bank %08X\n", space->device().safe_pc(), data);
207207   }
208208}
209209
r17788r17789
274274   COMBINE_DATA(&m_screen_enable);
275275//  popmessage("%04X",data);
276276   if (m_screen_enable & (~1))
277      logerror("CPU #0 PC %06X: screen enable = %04X\n", cpu_get_pc(&space.device()), m_screen_enable);
277      logerror("CPU #0 PC %06X: screen enable = %04X\n", space.device().safe_pc(), m_screen_enable);
278278}
279279
280280READ16_MEMBER(astrocorp_state::astrocorp_unk_r)
trunk/src/mame/drivers/mpu4hw.c
r17788r17789
20752075{
20762076   int x;
20772077   int call=data;
2078   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(&space.device()),offset,data));
2078   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", space.device().safe_pcbase(),offset,data));
20792079   if (!m_current_chr_table)
20802080   {
2081      logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device()));
2081      logerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase());
20822082      return;
20832083   }
20842084
r17788r17789
21452145{
21462146   if (!m_current_chr_table)
21472147   {
2148      logerror("No Characteriser Table @ %04x", cpu_get_previouspc(&space.device()));
2148      logerror("No Characteriser Table @ %04x", space.device().safe_pcbase());
21492149
21502150      /* a cheat ... many early games use a standard check */
21512151      int addr = cpu_get_reg(&space.device(), M6809_X);
r17788r17789
22152215{
22162216   int x;
22172217   int call=data;
2218   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", cpu_get_previouspc(&space.device()),offset,data));
2218   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", space.device().safe_pcbase(),offset,data));
22192219   if (!m_current_chr_table)
2220      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device()));
2220      fatalerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase());
22212221
22222222   if ((offset & 0x3f)== 0)//initialisation is always at 0x800
22232223   {
trunk/src/mame/drivers/cobra.c
r17788r17789
10521052      if (cpu != NULL)
10531053      {
10541054         // cpu has a name and a PC
1055         sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu));
1055         sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast<device_t *>(cpu)->safe_pc());
10561056      }
10571057      else
10581058      {
r17788r17789
10721072         if (cpu != NULL)
10731073         {
10741074            // cpu has a name and a PC
1075            sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu));
1075            sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast<device_t *>(cpu)->safe_pc());
10761076         }
10771077         else
10781078         {
r17788r17789
11291129         if (cpu != NULL)
11301130         {
11311131            // cpu has a name and a PC
1132            sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu));
1132            sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast<device_t *>(cpu)->safe_pc());
11331133         }
11341134         else
11351135         {
r17788r17789
11501150      if (cpu != NULL)
11511151      {
11521152         // cpu has a name and a PC
1153         sprintf(accessor_location, "(%s) %08X", cpu->tag(), cpu_get_pc((device_t *)cpu));
1153         sprintf(accessor_location, "(%s) %08X", cpu->tag(), const_cast<device_t *>(cpu)->safe_pc());
11541154      }
11551155      else
11561156      {
trunk/src/mame/drivers/twinkle.c
r17788r17789
601601   if (mem_mask == 0xff)
602602   {
603603      m_spu_shared[offset*2] = data;
604//      printf("shared_psx_w: %x to %x (%x), mask %x (PC=%x)\n", data, offset, offset*2, mem_mask, cpu_get_pc(&space.device()));
604//      printf("shared_psx_w: %x to %x (%x), mask %x (PC=%x)\n", data, offset, offset*2, mem_mask, space.device().safe_pc());
605605   }
606606   else if (mem_mask == 0xff0000)
607607   {
608608      m_spu_shared[(offset*2)+1] = data;
609//      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()));
609//      printf("shared_psx_w: %x to %x (%x), mask %x (PC=%x)\n", data, offset, (offset*2)+1, mem_mask, space.device().safe_pc());
610610   }
611611   else
612612   {
r17788r17789
621621
622622   result = m_spu_shared[offset*2] | m_spu_shared[(offset*2)+1]<<16;
623623
624//  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()));
624//  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());
625625
626626   result = 0;   // HACK to prevent the games from freezing while we sort out the rest of the 68k's boot sequence
627627
trunk/src/mame/drivers/simpl156.c
r17788r17789
10541054/* Everything seems more stable if we run the CPU speed x4 and use Idle skips.. maybe it has an internal multipler? */
10551055READ32_MEMBER(simpl156_state::joemacr_speedup_r)
10561056{
1057   if (cpu_get_pc(&space.device()) == 0x284)
1057   if (space.device().safe_pc() == 0x284)
10581058      device_spin_until_time(&space.device(), attotime::from_usec(400));
10591059   return m_systemram[0x18/4];
10601060}
r17788r17789
10681068
10691069READ32_MEMBER(simpl156_state::chainrec_speedup_r)
10701070{
1071   if (cpu_get_pc(&space.device()) == 0x2d4)
1071   if (space.device().safe_pc() == 0x2d4)
10721072      device_spin_until_time(&space.device(), attotime::from_usec(400));
10731073   return m_systemram[0x18/4];
10741074}
r17788r17789
10811081
10821082READ32_MEMBER(simpl156_state::prtytime_speedup_r)
10831083{
1084   if (cpu_get_pc(&space.device()) == 0x4f0)
1084   if (space.device().safe_pc() == 0x4f0)
10851085      device_spin_until_time(&space.device(), attotime::from_usec(400));
10861086   return m_systemram[0xae0/4];
10871087}
r17788r17789
10951095
10961096READ32_MEMBER(simpl156_state::charlien_speedup_r)
10971097{
1098   if (cpu_get_pc(&space.device()) == 0xc8c8)
1098   if (space.device().safe_pc() == 0xc8c8)
10991099      device_spin_until_time(&space.device(), attotime::from_usec(400));
11001100   return m_systemram[0x10/4];
11011101}
r17788r17789
11081108
11091109READ32_MEMBER(simpl156_state::osman_speedup_r)
11101110{
1111   if (cpu_get_pc(&space.device()) == 0x5974)
1111   if (space.device().safe_pc() == 0x5974)
11121112      device_spin_until_time(&space.device(), attotime::from_usec(400));
11131113   return m_systemram[0x10/4];
11141114}
trunk/src/mame/drivers/artmagic.c
r17788r17789
124124      oki->set_bank_base((((data >> 4) & 1) * 0x40000) % oki->region()->bytes());
125125   }
126126
127   logerror("%06X:control_w(%d) = %04X\n", cpu_get_pc(&space.device()), offset, data);
127   logerror("%06X:control_w(%d) = %04X\n", space.device().safe_pc(), offset, data);
128128}
129129
130130
r17788r17789
145145READ16_MEMBER(artmagic_state::ultennis_hack_r)
146146{
147147   /* IRQ5 points to: jsr (a5); rte */
148   UINT32 pc = cpu_get_pc(&space.device());
148   UINT32 pc = space.device().safe_pc();
149149   if (pc == 0x18c2 || pc == 0x18e4)
150150   {
151151      m_hack_irq = 1;
trunk/src/mame/drivers/hexion.c
r17788r17789
8989
9090WRITE8_MEMBER(hexion_state::coincntr_w)
9191{
92//logerror("%04x: coincntr_w %02x\n",cpu_get_pc(&space.device()),data);
92//logerror("%04x: coincntr_w %02x\n",space.device().safe_pc(),data);
9393
9494   /* bits 0/1 = coin counters */
9595   coin_counter_w(machine(), 0,data & 0x01);
trunk/src/mame/drivers/midqslvr.c
r17788r17789
273273      return (((class_code_val[function]) >> (reg & 3)*8) & 0xff);
274274   }
275275
276   printf("%08x PIIX4: read %d, %02X\n", cpu_get_pc(&space->device()), function, reg);
276   printf("%08x PIIX4: read %d, %02X\n", space->device().safe_pc(), function, reg);
277277
278278   return state->m_piix4_config_reg[function][reg];
279279}
trunk/src/mame/drivers/seibuspi.c
r17788r17789
747747   UINT8 r;
748748   if (state->m_fifoout_wpos == state->m_fifoout_rpos)
749749   {
750      logerror("Sound FIFOOUT underflow at %08X\n", cpu_get_pc(&space->device()));
750      logerror("Sound FIFOOUT underflow at %08X\n", space->device().safe_pc());
751751   }
752752   r = state->m_fifoout_data[state->m_fifoout_rpos++];
753753   if(state->m_fifoout_rpos == FIFO_SIZE)
r17788r17789
773773   }
774774   if(state->m_fifoout_wpos == state->m_fifoout_rpos)
775775   {
776      fatalerror("Sound FIFOOUT overflow at %08X\n", cpu_get_pc(&space->device()));
776      fatalerror("Sound FIFOOUT overflow at %08X\n", space->device().safe_pc());
777777   }
778778
779779   state->m_fifoout_read_request = 1;
r17788r17789
785785   UINT8 r;
786786   if (state->m_fifoin_wpos == state->m_fifoin_rpos)
787787   {
788      fatalerror("Sound FIFOIN underflow at %08X\n", cpu_get_pc(&space->device()));
788      fatalerror("Sound FIFOIN underflow at %08X\n", space->device().safe_pc());
789789   }
790790   r = state->m_fifoin_data[state->m_fifoin_rpos++];
791791   if(state->m_fifoin_rpos == FIFO_SIZE)
r17788r17789
811811   }
812812   if(state->m_fifoin_wpos == state->m_fifoin_rpos)
813813   {
814      fatalerror("Sound FIFOIN overflow at %08X\n", cpu_get_pc(&space->device()));
814      fatalerror("Sound FIFOIN overflow at %08X\n", space->device().safe_pc());
815815   }
816816
817817   state->m_fifoin_read_request = 1;
r17788r17789
19451945
19461946READ32_MEMBER(seibuspi_state::senkyu_speedup_r)
19471947{
1948   if (cpu_get_pc(&space.device())==0x00305bb2) device_spin_until_interrupt(&space.device()); // idle
1948   if (space.device().safe_pc()==0x00305bb2) device_spin_until_interrupt(&space.device()); // idle
19491949   return m_spimainram[(0x0018cb4-0x800)/4];
19501950}
19511951
19521952READ32_MEMBER(seibuspi_state::senkyua_speedup_r)
19531953{
1954   if (cpu_get_pc(&space.device())== 0x30582e) device_spin_until_interrupt(&space.device()); // idle
1954   if (space.device().safe_pc()== 0x30582e) device_spin_until_interrupt(&space.device()); // idle
19551955   return m_spimainram[(0x0018c9c-0x800)/4];
19561956}
19571957
19581958READ32_MEMBER(seibuspi_state::batlball_speedup_r)
19591959{
1960//  printf("cpu_get_pc(&space.device()) %06x\n", cpu_get_pc(&space.device()));
1960//  printf("space.device().safe_pc() %06x\n", space.device().safe_pc());
19611961
19621962   /* batlbalu */
1963   if (cpu_get_pc(&space.device())==0x00305996) device_spin_until_interrupt(&space.device()); // idle
1963   if (space.device().safe_pc()==0x00305996) device_spin_until_interrupt(&space.device()); // idle
19641964
19651965   /* batlball */
1966   if (cpu_get_pc(&space.device())==0x003058aa) device_spin_until_interrupt(&space.device()); // idle
1966   if (space.device().safe_pc()==0x003058aa) device_spin_until_interrupt(&space.device()); // idle
19671967
19681968   return m_spimainram[(0x0018db4-0x800)/4];
19691969}
r17788r17789
19711971READ32_MEMBER(seibuspi_state::rdft_speedup_r)
19721972{
19731973   /* rdft */
1974   if (cpu_get_pc(&space.device())==0x0203f0a) device_spin_until_interrupt(&space.device()); // idle
1974   if (space.device().safe_pc()==0x0203f0a) device_spin_until_interrupt(&space.device()); // idle
19751975
19761976   /* rdftau */
1977   if (cpu_get_pc(&space.device())==0x0203f16) device_spin_until_interrupt(&space.device()); // idle
1977   if (space.device().safe_pc()==0x0203f16) device_spin_until_interrupt(&space.device()); // idle
19781978
19791979   /* rdftj */
1980   if (cpu_get_pc(&space.device())==0x0203f22) device_spin_until_interrupt(&space.device()); // idle
1980   if (space.device().safe_pc()==0x0203f22) device_spin_until_interrupt(&space.device()); // idle
19811981
19821982   /* rdftdi */
1983   if (cpu_get_pc(&space.device())==0x0203f46) device_spin_until_interrupt(&space.device()); // idle
1983   if (space.device().safe_pc()==0x0203f46) device_spin_until_interrupt(&space.device()); // idle
19841984
19851985   /* rdftu */
1986   if (cpu_get_pc(&space.device())==0x0203f3a) device_spin_until_interrupt(&space.device()); // idle
1986   if (space.device().safe_pc()==0x0203f3a) device_spin_until_interrupt(&space.device()); // idle
19871987
1988//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
1988//  mame_printf_debug("%08x\n",space.device().safe_pc());
19891989
19901990   return m_spimainram[(0x00298d0-0x800)/4];
19911991}
r17788r17789
19931993READ32_MEMBER(seibuspi_state::viprp1_speedup_r)
19941994{
19951995   /* viprp1 */
1996   if (cpu_get_pc(&space.device())==0x0202769) device_spin_until_interrupt(&space.device()); // idle
1996   if (space.device().safe_pc()==0x0202769) device_spin_until_interrupt(&space.device()); // idle
19971997
19981998   /* viprp1s */
1999   if (cpu_get_pc(&space.device())==0x02027e9) device_spin_until_interrupt(&space.device()); // idle
1999   if (space.device().safe_pc()==0x02027e9) device_spin_until_interrupt(&space.device()); // idle
20002000
20012001   /* viprp1ot */
2002   if (cpu_get_pc(&space.device())==0x02026bd) device_spin_until_interrupt(&space.device()); // idle
2002   if (space.device().safe_pc()==0x02026bd) device_spin_until_interrupt(&space.device()); // idle
20032003
2004//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
2004//  mame_printf_debug("%08x\n",space.device().safe_pc());
20052005
20062006   return m_spimainram[(0x001e2e0-0x800)/4];
20072007}
r17788r17789
20092009READ32_MEMBER(seibuspi_state::viprp1o_speedup_r)
20102010{
20112011   /* viperp1o */
2012   if (cpu_get_pc(&space.device())==0x0201f99) device_spin_until_interrupt(&space.device()); // idle
2013//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
2012   if (space.device().safe_pc()==0x0201f99) device_spin_until_interrupt(&space.device()); // idle
2013//  mame_printf_debug("%08x\n",space.device().safe_pc());
20142014   return m_spimainram[(0x001d49c-0x800)/4];
20152015}
20162016
r17788r17789
20182018// causes input problems?
20192019READ32_MEMBER(seibuspi_state::ejanhs_speedup_r)
20202020{
2021// mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
2022 if (cpu_get_pc(&space.device())==0x03032c7) device_spin_until_interrupt(&space.device()); // idle
2021// mame_printf_debug("%08x\n",space.device().safe_pc());
2022 if (space.device().safe_pc()==0x03032c7) device_spin_until_interrupt(&space.device()); // idle
20232023 return m_spimainram[(0x002d224-0x800)/4];
20242024}
20252025#endif
r17788r17789
20282028{
20292029
20302030   /* rdft22kc */
2031   if (cpu_get_pc(&space.device())==0x0203926) device_spin_until_interrupt(&space.device()); // idle
2031   if (space.device().safe_pc()==0x0203926) device_spin_until_interrupt(&space.device()); // idle
20322032
20332033   /* rdft2, rdft2j */
2034   if (cpu_get_pc(&space.device())==0x0204372) device_spin_until_interrupt(&space.device()); // idle
2034   if (space.device().safe_pc()==0x0204372) device_spin_until_interrupt(&space.device()); // idle
20352035
20362036   /* rdft2us */
2037   if (cpu_get_pc(&space.device())==0x020420e) device_spin_until_interrupt(&space.device()); // idle
2037   if (space.device().safe_pc()==0x020420e) device_spin_until_interrupt(&space.device()); // idle
20382038
20392039   /* rdft2a */
2040   if (cpu_get_pc(&space.device())==0x0204366) device_spin_until_interrupt(&space.device()); // idle
2040   if (space.device().safe_pc()==0x0204366) device_spin_until_interrupt(&space.device()); // idle
20412041
2042//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
2042//  mame_printf_debug("%08x\n",space.device().safe_pc());
20432043
20442044   return m_spimainram[(0x0282AC-0x800)/4];
20452045}
r17788r17789
20472047READ32_MEMBER(seibuspi_state::rfjet_speedup_r)
20482048{
20492049   /* rfjet, rfjetu, rfjeta */
2050   if (cpu_get_pc(&space.device())==0x0206082) device_spin_until_interrupt(&space.device()); // idle
2050   if (space.device().safe_pc()==0x0206082) device_spin_until_interrupt(&space.device()); // idle
20512051
20522052   /* rfjetus */
2053   if (cpu_get_pc(&space.device())==0x0205b39)
2053   if (space.device().safe_pc()==0x0205b39)
20542054   {
20552055      UINT32 r;
20562056      device_spin_until_interrupt(&space.device()); // idle
r17788r17789
20602060   }
20612061
20622062   /* rfjetj */
2063   if (cpu_get_pc(&space.device())==0x0205f2e) device_spin_until_interrupt(&space.device()); // idle
2063   if (space.device().safe_pc()==0x0205f2e) device_spin_until_interrupt(&space.device()); // idle
20642064
2065//  mame_printf_debug("%08x\n",cpu_get_pc(&space.device()));
2065//  mame_printf_debug("%08x\n",space.device().safe_pc());
20662066
20672067
20682068   return m_spimainram[(0x002894c-0x800)/4];
trunk/src/mame/drivers/coolpool.c
r17788r17789
218218
219219WRITE16_MEMBER(coolpool_state::amerdart_misc_w)
220220{
221   logerror("%08x:IOP_system_w %04x\n",cpu_get_pc(&space.device()),data);
221   logerror("%08x:IOP_system_w %04x\n",space.device().safe_pc(),data);
222222
223223   coin_counter_w(machine(), 0, ~data & 0x0001);
224224   coin_counter_w(machine(), 1, ~data & 0x0002);
r17788r17789
250250READ16_MEMBER(coolpool_state::amerdart_iop_r)
251251{
252252
253//  logerror("%08x:IOP read %04x\n",cpu_get_pc(&space.device()),m_iop_answer);
253//  logerror("%08x:IOP read %04x\n",space.device().safe_pc(),m_iop_answer);
254254   cputag_set_input_line(machine(), "maincpu", 1, CLEAR_LINE);
255255
256256   return m_iop_answer;
r17788r17789
259259WRITE16_MEMBER(coolpool_state::amerdart_iop_w)
260260{
261261
262//  logerror("%08x:IOP write %04x\n", cpu_get_pc(&space.device()), data);
262//  logerror("%08x:IOP write %04x\n", space.device().safe_pc(), data);
263263   COMBINE_DATA(&m_iop_cmd);
264264   m_cmd_pending = 1;
265265}
r17788r17789
267267READ16_MEMBER(coolpool_state::amerdart_dsp_cmd_r)
268268{
269269
270//  logerror("%08x:DSP cmd_r %04x\n", cpu_get_pc(&space.device()), m_iop_cmd);
270//  logerror("%08x:DSP cmd_r %04x\n", space.device().safe_pc(), m_iop_cmd);
271271   m_cmd_pending = 0;
272272   return m_iop_cmd;
273273}
r17788r17789
275275WRITE16_MEMBER(coolpool_state::amerdart_dsp_answer_w)
276276{
277277
278//  logerror("%08x:DSP answer %04x\n", cpu_get_pc(&space.device()), data);
278//  logerror("%08x:DSP answer %04x\n", space.device().safe_pc(), data);
279279   m_iop_answer = data;
280280   cputag_set_input_line(machine(), "maincpu", 1, ASSERT_LINE);
281281}
r17788r17789
423423   m_result = (m_result & 0x0fff) | (amerdart_trackball_direction(&space, 2, ((m_result >> 12) & 0xf)) << 12);
424424
425425
426//  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);
426//  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);
427427
428428   m_lastresult = m_result;
429429
r17788r17789
439439
440440WRITE16_MEMBER(coolpool_state::coolpool_misc_w)
441441{
442   logerror("%08x:IOP_system_w %04x\n",cpu_get_pc(&space.device()),data);
442   logerror("%08x:IOP_system_w %04x\n",space.device().safe_pc(),data);
443443
444444   coin_counter_w(machine(), 0, ~data & 0x0001);
445445   coin_counter_w(machine(), 1, ~data & 0x0002);
r17788r17789
471471
472472WRITE16_MEMBER(coolpool_state::coolpool_iop_w)
473473{
474   logerror("%08x:IOP write %04x\n", cpu_get_pc(&space.device()), data);
474   logerror("%08x:IOP write %04x\n", space.device().safe_pc(), data);
475475   machine().scheduler().synchronize(FUNC(deferred_iop_w), data);
476476}
477477
r17788r17789
479479READ16_MEMBER(coolpool_state::coolpool_iop_r)
480480{
481481
482   logerror("%08x:IOP read %04x\n",cpu_get_pc(&space.device()),m_iop_answer);
482   logerror("%08x:IOP read %04x\n",space.device().safe_pc(),m_iop_answer);
483483   cputag_set_input_line(machine(), "maincpu", 1, CLEAR_LINE);
484484
485485   return m_iop_answer;
r17788r17789
498498{
499499
500500   m_cmd_pending = 0;
501   logerror("%08x:IOP cmd_r %04x\n", cpu_get_pc(&space.device()), m_iop_cmd);
501   logerror("%08x:IOP cmd_r %04x\n", space.device().safe_pc(), m_iop_cmd);
502502   return m_iop_cmd;
503503}
504504
r17788r17789
506506WRITE16_MEMBER(coolpool_state::dsp_answer_w)
507507{
508508
509   logerror("%08x:IOP answer %04x\n", cpu_get_pc(&space.device()), data);
509   logerror("%08x:IOP answer %04x\n", space.device().safe_pc(), data);
510510   m_iop_answer = data;
511511   cputag_set_input_line(machine(), "maincpu", 1, ASSERT_LINE);
512512}
r17788r17789
625625      }
626626   }
627627
628//  logerror("%08X:read port 7 (X=%02X Y=%02X oldX=%02X oldY=%02X res=%04X)\n", cpu_get_pc(&space.device()),
628//  logerror("%08X:read port 7 (X=%02X Y=%02X oldX=%02X oldY=%02X res=%04X)\n", space.device().safe_pc(),
629629//      m_newx[1], m_newy[1], m_oldx[1], m_oldy[1], m_result);
630630   m_lastresult = m_result;
631631   return m_result;
trunk/src/mame/drivers/astrafr.c
r17788r17789
5353
5454   DECLARE_READ8_MEMBER( astra_fgpa_r )
5555   {
56      int pc = cpu_get_pc(&space.device());
56      int pc = space.device().safe_pc();
5757
5858      if (offset==fgpa_first_read_addr)
5959      {
r17788r17789
6868
6969   DECLARE_WRITE8_MEMBER( astra_fgpa_w )
7070   {
71      int pc = cpu_get_pc(&space.device());
71      int pc = space.device().safe_pc();
7272
7373      if (offset==fgpa_rom_write_addr)
7474      {
r17788r17789
8484   /* 2nd copy for the 2nd board (assume same addresses for now */
8585   DECLARE_READ8_MEMBER( astra_fgpa_slave_r )
8686   {
87      int pc = cpu_get_pc(&space.device());
87      int pc = space.device().safe_pc();
8888
8989      if (offset==fgpa_first_read_addr)
9090      {
r17788r17789
9999
100100   DECLARE_WRITE8_MEMBER( astra_fgpa_slave_w )
101101   {
102      int pc = cpu_get_pc(&space.device());
102      int pc = space.device().safe_pc();
103103
104104      if (offset==fgpa_rom_write_addr)
105105      {
r17788r17789
126126
127127READ32_MEMBER(astrafr_state::astrafr_mem_r)
128128{
129   int pc = cpu_get_pc(&space.device());
129   int pc = space.device().safe_pc();
130130   int cs = m68340_get_cs(m_maincpu, offset * 4);
131131
132132   switch ( cs )
r17788r17789
153153
154154WRITE32_MEMBER(astrafr_state::astrafr_mem_w)
155155{
156   int pc = cpu_get_pc(&space.device());
156   int pc = space.device().safe_pc();
157157   int address = offset * 4;
158158   int cs = m68340_get_cs(m_maincpu, address);
159159
r17788r17789
183183
184184READ32_MEMBER(astrafr_state::astrafr_slave_mem_r)
185185{
186   int pc = cpu_get_pc(&space.device());
186   int pc = space.device().safe_pc();
187187   int cs = m68340_get_cs(m_slavecpu, offset * 4);
188188
189189   switch ( cs )
r17788r17789
208208
209209WRITE32_MEMBER(astrafr_state::astrafr_slave_mem_w)
210210{
211   int pc = cpu_get_pc(&space.device());
211   int pc = space.device().safe_pc();
212212   int address = offset * 4;
213213   int cs = m68340_get_cs(m_slavecpu, address);
214214
trunk/src/mame/drivers/system1.c
r17788r17789
567567
568568      default:
569569         logerror("%03X: MCU movx write mode %02X offset %04X = %02X\n",
570                cpu_get_pc(&space.device()), m_mcu_control, offset, data);
570                space.device().safe_pc(), m_mcu_control, offset, data);
571571         break;
572572   }
573573}
r17788r17789
588588
589589      default:
590590         logerror("%03X: MCU movx read mode %02X offset %04X\n",
591                cpu_get_pc(&space.device()), m_mcu_control, offset);
591                space.device().safe_pc(), m_mcu_control, offset);
592592         return 0xff;
593593   }
594594}
r17788r17789
681681
682682READ8_MEMBER(system1_state::nobb_inport1c_r)
683683{
684//  logerror("IN  $1c : pc = %04x - data = 0x80\n",cpu_get_pc(&space.device()));
684//  logerror("IN  $1c : pc = %04x - data = 0x80\n",space.device().safe_pc());
685685   return(0x80);   // infinite loop (at 0x0fb3) until bit 7 is set
686686}
687687
688688READ8_MEMBER(system1_state::nobb_inport22_r)
689689{
690//  logerror("IN  $22 : pc = %04x - data = %02x\n",cpu_get_pc(&space.device()),nobb_inport17_step);
690//  logerror("IN  $22 : pc = %04x - data = %02x\n",space.device().safe_pc(),nobb_inport17_step);
691691   return(0);//nobb_inport17_step);
692692}
693693
694694READ8_MEMBER(system1_state::nobb_inport23_r)
695695{
696//  logerror("IN  $23 : pc = %04x - step = %02x\n",cpu_get_pc(&space.device()),m_nobb_inport23_step);
696//  logerror("IN  $23 : pc = %04x - step = %02x\n",space.device().safe_pc(),m_nobb_inport23_step);
697697   return(m_nobb_inport23_step);
698698}
699699
700700WRITE8_MEMBER(system1_state::nobb_outport24_w)
701701{
702//  logerror("OUT $24 : pc = %04x - data = %02x\n",cpu_get_pc(&space.device()),data);
702//  logerror("OUT $24 : pc = %04x - data = %02x\n",space.device().safe_pc(),data);
703703   m_nobb_inport23_step = data;
704704}
705705
r17788r17789
47054705READ8_MEMBER(system1_state::nob_start_r)
47064706{
47074707   /* in reality, it's likely some M1-dependent behavior */
4708   return (cpu_get_pc(&space.device()) <= 0x0003) ? 0x80 : memregion("maincpu")->base()[1];
4708   return (space.device().safe_pc() <= 0x0003) ? 0x80 : memregion("maincpu")->base()[1];
47094709}
47104710
47114711DRIVER_INIT_MEMBER(system1_state,nob)
trunk/src/mame/drivers/quizo.c
r17788r17789
126126{
127127   if(data>9)
128128   {
129      logerror("ROMBANK %x @ %x\n", data, cpu_get_pc(&space.device()));
129      logerror("ROMBANK %x @ %x\n", data, space.device().safe_pc());
130130      data=0;
131131   }
132132   m_port60=data;
trunk/src/mame/drivers/suprnova.c
r17788r17789
642642                cputag_set_input_line(machine(), "maincpu",0xf,CLEAR_LINE);*/
643643
644644         /* 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 */
645         if (cpu_get_pc(&space.device())==0x04013B42)
645         if (space.device().safe_pc()==0x04013B42)
646646         {
647647            if (!strcmp(machine().system().name,"vblokbrk") ||
648648               !strcmp(machine().system().name,"sarukani"))
r17788r17789
867867    04022072: CMP/EQ  R2,R3
868868    04022074: BT      $0402206C
869869*/
870   if (cpu_get_pc(&space.device())==0x402206e)
870   if (space.device().safe_pc()==0x402206e)
871871   {
872872      if(m_main_ram[0x00078/4] == m_main_ram[0x0c780/4])
873873         device_spin_until_interrupt(&space.device());
r17788r17789
877877
878878READ32_MEMBER(skns_state::cyvern_speedup_r)
879879{
880   if (cpu_get_pc(&space.device())==0x402ebd2) device_spin_until_interrupt(&space.device());
880   if (space.device().safe_pc()==0x402ebd2) device_spin_until_interrupt(&space.device());
881881   return m_main_ram[0x4d3c8/4];
882882}
883883
884884READ32_MEMBER(skns_state::puzzloopj_speedup_r)
885885{
886   if (cpu_get_pc(&space.device())==0x401dca0) device_spin_until_interrupt(&space.device());
886   if (space.device().safe_pc()==0x401dca0) device_spin_until_interrupt(&space.device());
887887   return m_main_ram[0x86714/4];
888888}
889889
890890READ32_MEMBER(skns_state::puzzloopa_speedup_r)
891891{
892   if (cpu_get_pc(&space.device())==0x401d9d4) device_spin_until_interrupt(&space.device());
892   if (space.device().safe_pc()==0x401d9d4) device_spin_until_interrupt(&space.device());
893893   return m_main_ram[0x85bcc/4];
894894}
895895
896896READ32_MEMBER(skns_state::puzzloopu_speedup_r)
897897{
898   if (cpu_get_pc(&space.device())==0x401dab0) device_spin_until_interrupt(&space.device());
898   if (space.device().safe_pc()==0x401dab0) device_spin_until_interrupt(&space.device());
899899   return m_main_ram[0x85cec/4];
900900}
901901
r17788r17789
908908    0401DA18: BF      $0401DA26
909909    0401DA26: BRA     $0401DA12
910910*/
911   if (cpu_get_pc(&space.device())==0x401da14) device_spin_until_interrupt(&space.device());
911   if (space.device().safe_pc()==0x401da14) device_spin_until_interrupt(&space.device());
912912   return m_main_ram[0x81d38/4];
913913}
914914
915915READ32_MEMBER(skns_state::senknow_speedup_r)
916916{
917   if (cpu_get_pc(&space.device())==0x4017dce) device_spin_until_interrupt(&space.device());
917   if (space.device().safe_pc()==0x4017dce) device_spin_until_interrupt(&space.device());
918918   return m_main_ram[0x0000dc/4];
919919}
920920
921921READ32_MEMBER(skns_state::teljan_speedup_r)
922922{
923   if (cpu_get_pc(&space.device())==0x401ba32) device_spin_until_interrupt(&space.device());
923   if (space.device().safe_pc()==0x401ba32) device_spin_until_interrupt(&space.device());
924924   return m_main_ram[0x002fb4/4];
925925}
926926
927927READ32_MEMBER(skns_state::jjparads_speedup_r)
928928{
929   if (cpu_get_pc(&space.device())==0x4015e84) device_spin_until_interrupt(&space.device());
929   if (space.device().safe_pc()==0x4015e84) device_spin_until_interrupt(&space.device());
930930   return m_main_ram[0x000994/4];
931931}
932932
933933READ32_MEMBER(skns_state::jjparad2_speedup_r)
934934{
935   if (cpu_get_pc(&space.device())==0x401620a) device_spin_until_interrupt(&space.device());
935   if (space.device().safe_pc()==0x401620a) device_spin_until_interrupt(&space.device());
936936   return m_main_ram[0x000984/4];
937937}
938938
939939READ32_MEMBER(skns_state::ryouran_speedup_r)
940940{
941   if (cpu_get_pc(&space.device())==0x40182ce) device_spin_until_interrupt(&space.device());
941   if (space.device().safe_pc()==0x40182ce) device_spin_until_interrupt(&space.device());
942942   return m_main_ram[0x000a14/4];
943943}
944944
945945READ32_MEMBER(skns_state::galpans2_speedup_r)
946946{
947   if (cpu_get_pc(&space.device())==0x4049ae2) device_spin_until_interrupt(&space.device());
947   if (space.device().safe_pc()==0x4049ae2) device_spin_until_interrupt(&space.device());
948948   return m_main_ram[0x0fb6bc/4];
949949}
950950
951951READ32_MEMBER(skns_state::panicstr_speedup_r)
952952{
953   if (cpu_get_pc(&space.device())==0x404e68a) device_spin_until_interrupt(&space.device());
953   if (space.device().safe_pc()==0x404e68a) device_spin_until_interrupt(&space.device());
954954   return m_main_ram[0x0f19e4/4];
955955}
956956
957957READ32_MEMBER(skns_state::sengekis_speedup_r)// 60006ee  600308e
958958{
959   if (cpu_get_pc(&space.device())==0x60006ec) device_spin_until_interrupt(&space.device());
959   if (space.device().safe_pc()==0x60006ec) device_spin_until_interrupt(&space.device());
960960   return m_main_ram[0xb74bc/4];
961961}
962962
963963READ32_MEMBER(skns_state::sengekij_speedup_r)// 60006ee  600308e
964964{
965   if (cpu_get_pc(&space.device())==0x60006ec) device_spin_until_interrupt(&space.device());
965   if (space.device().safe_pc()==0x60006ec) device_spin_until_interrupt(&space.device());
966966   return m_main_ram[0xb7380/4];
967967}
968968
trunk/src/mame/drivers/witch.c
r17788r17789
413413    Otherwise later in game some I/O (controls) reads are skipped.
414414*/
415415
416  switch(cpu_get_pc(&space.device()))
416  switch(space.device().safe_pc())
417417  {
418418   case 0x23f:
419419   case 0x246:
trunk/src/mame/drivers/dynax.c
r17788r17789
279279{
280280   int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
281281
282   //logerror("%04x: rom bank = %02x\n", cpu_get_pc(&space.device()), data);
282   //logerror("%04x: rom bank = %02x\n", space.device().safe_pc(), data);
283283   if (data < bank_n)
284284      membank("bank1")->set_entry(data);
285285   else
r17788r17789
751751{
752752       int bank_n = (machine().root_device().memregion("maincpu")->bytes() - 0x10000) / 0x8000;
753753
754       //logerror("%04x: rom bank = %02x\n", cpu_get_pc(&space.device()), data);
754       //logerror("%04x: rom bank = %02x\n", space.device().safe_pc(), data);
755755       if (data < bank_n)
756756               membank("bank1")->set_entry(data);
757757       else
r17788r17789
779779      case 0x81:   dynax_blit_romregion_w(space, 0, 3);   return;
780780      case 0x82:   dynax_blit_romregion_w(space, 0, 4);   return;   // mjcomv1
781781   }
782   logerror("%04x: unmapped romregion=%02X\n", cpu_get_pc(&space.device()), data);
782   logerror("%04x: unmapped romregion=%02X\n", space.device().safe_pc(), data);
783783}
784784
785785static ADDRESS_MAP_START( yarunara_io_map, AS_IO, 8, dynax_state )
r17788r17789
11521152
11531153      case 0xff:   break;   // CRT controller?
11541154      default:
1155         logerror("%04x: coins_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
1155         logerror("%04x: coins_w with select = %02x, data = %02x\n", space.device().safe_pc(), m_input_sel, data);
11561156   }
11571157}
11581158
r17788r17789
11671167      case 0x82:   return ioport(keynames0[m_keyb++])->read();
11681168      case 0x0d:   return 0xff;   // unused
11691169   }
1170   logerror("%04x: input_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
1170   logerror("%04x: input_r with select = %02x\n", space.device().safe_pc(), m_input_sel);
11711171   return 0xff;
11721172}
11731173
r17788r17789
11811181      case 0x02:   return 0xbf | ((m_hopper && !(machine().primary_screen->frame_number() % 10)) ? 0 : (1 << 6));   // bit 7 = blitter busy, bit 6 = hopper
11821182      case 0x03:   return m_coins;
11831183   }
1184   logerror("%04x: coin_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
1184   logerror("%04x: coin_r with select = %02x\n", space.device().safe_pc(), m_input_sel);
11851185   return 0xff;
11861186}
11871187
r17788r17789
12001200      case 0x81:   dynax_blit_romregion_w(space, 0, 1);   return;
12011201      case 0x00:   dynax_blit_romregion_w(space, 0, 2);   return;
12021202   }
1203   logerror("%04x: unmapped romregion=%02X\n", cpu_get_pc(&space.device()), data);
1203   logerror("%04x: unmapped romregion=%02X\n", space.device().safe_pc(), data);
12041204}
12051205
12061206static ADDRESS_MAP_START( htengoku_io_map, AS_IO, 8, dynax_state )
r17788r17789
12731273         break;
12741274      return;
12751275   }
1276   logerror("%04x: unmapped ip_sel=%02x written with %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
1276   logerror("%04x: unmapped ip_sel=%02x written with %02x\n", space.device().safe_pc(), m_input_sel, data);
12771277}
12781278
12791279READ8_MEMBER(dynax_state::tenkai_ip_r)
r17788r17789
12911291               return ioport("COINS")->read();   // coins
12921292
12931293            default:
1294               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", cpu_get_pc(&space.device()), m_input_sel, offset);
1294               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", space.device().safe_pc(), m_input_sel, offset);
12951295               return 0xff;
12961296         }
12971297      }
r17788r17789
13061306            // player 2
13071307            case 0x81:
13081308               if (m_keyb >= 5)
1309                  logerror("%04x: unmapped keyb=%02x read\n", cpu_get_pc(&space.device()), m_keyb);
1309                  logerror("%04x: unmapped keyb=%02x read\n", space.device().safe_pc(), m_keyb);
13101310               return 0xff;//ioport(keynames1[m_keyb++])->read();
13111311
13121312            // player 1
13131313            case 0x82:
13141314               if (m_keyb >= 5)
1315                  logerror("%04x: unmapped keyb=%02x read\n", cpu_get_pc(&space.device()), m_keyb);
1315                  logerror("%04x: unmapped keyb=%02x read\n", space.device().safe_pc(), m_keyb);
13161316               return ioport(keynames0[m_keyb++])->read();
13171317
13181318            default:
1319               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", cpu_get_pc(&space.device()), m_input_sel, offset);
1319               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", space.device().safe_pc(), m_input_sel, offset);
13201320               return 0xff;
13211321         }
13221322      }
r17788r17789
14321432   else if (m_rombank == 0x12)
14331433      return tenkai_palette_r(space, offset);
14341434
1435   logerror("%04x: unmapped offset %04X read with rombank=%02X\n", cpu_get_pc(&space.device()), offset, m_rombank);
1435   logerror("%04x: unmapped offset %04X read with rombank=%02X\n", space.device().safe_pc(), offset, m_rombank);
14361436   return 0x00;
14371437}
14381438
r17788r17789
14521452      return;
14531453   }
14541454
1455   logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", cpu_get_pc(&space.device()), offset, data, m_rombank);
1455   logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", space.device().safe_pc(), offset, data, m_rombank);
14561456}
14571457
14581458static void tenkai_show_6c( running_machine &machine )
r17788r17789
14811481      case 0x83:   dynax_blit_romregion_w(space, 0, 1);   return;
14821482      case 0x80:   dynax_blit_romregion_w(space, 0, 2);   return;
14831483   }
1484   logerror("%04x: unmapped romregion=%02X\n", cpu_get_pc(&space.device()), data);
1484   logerror("%04x: unmapped romregion=%02X\n", space.device().safe_pc(), data);
14851485}
14861486
14871487static ADDRESS_MAP_START( tenkai_map, AS_PROGRAM, 8, dynax_state )
r17788r17789
15911591      case 0x8067:   return ioport("DSW2")->read();
15921592   }
15931593
1594   logerror("%04x: unmapped offset %04X read with rombank=%02X\n",cpu_get_pc(&space.device()), offset, m_rombank);
1594   logerror("%04x: unmapped offset %04X read with rombank=%02X\n",space.device().safe_pc(), offset, m_rombank);
15951595   return 0x00;
15961596}
15971597
r17788r17789
16471647//              break;
16481648      }
16491649   }
1650   logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", cpu_get_pc(&space.device()), offset, data, m_rombank);
1650   logerror("%04x: unmapped offset %04X=%02X written with rombank=%02X\n", space.device().safe_pc(), offset, data, m_rombank);
16511651}
16521652
16531653
trunk/src/mame/drivers/mpu5hw.c
r17788r17789
6464
6565READ32_MEMBER(mpu5_state::mpu5_mem_r)
6666{
67   int pc = cpu_get_pc(&space.device());
67   int pc = space.device().safe_pc();
6868   int cs = m68340_get_cs(m_maincpu, offset * 4);
6969
7070   switch ( cs )
r17788r17789
8686
8787WRITE32_MEMBER(mpu5_state::mpu5_mem_w)
8888{
89   int pc = cpu_get_pc(&space.device());
89   int pc = space.device().safe_pc();
9090   int cs = m68340_get_cs(m_maincpu, offset * 4);
9191
9292   switch ( cs )
trunk/src/mame/drivers/itech32.c
r17788r17789
833833
834834READ32_MEMBER(itech32_state::drivedge_tms1_speedup_r)
835835{
836   if (m_tms1_ram[0x382] == 0 && cpu_get_pc(&space.device()) == 0xee) START_TMS_SPINNING(0);
836   if (m_tms1_ram[0x382] == 0 && space.device().safe_pc() == 0xee) START_TMS_SPINNING(0);
837837   return m_tms1_ram[0x382];
838838}
839839
840840
841841READ32_MEMBER(itech32_state::drivedge_tms2_speedup_r)
842842{
843   if (m_tms2_ram[0x382] == 0 && cpu_get_pc(&space.device()) == 0x809808) START_TMS_SPINNING(1);
843   if (m_tms2_ram[0x382] == 0 && space.device().safe_pc() == 0x809808) START_TMS_SPINNING(1);
844844   return m_tms2_ram[0x382];
845845}
846846
r17788r17789
929929
930930READ32_MEMBER(itech32_state::test1_r)
931931{
932   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);
933   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);
934   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);
935   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);
932   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);
933   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);
934   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);
935   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);
936936   return ((UINT32 *)m_main_ram)[0x100/4 + offset];
937937}
938938
r17788r17789
947947
948948READ32_MEMBER(itech32_state::test2_r)
949949{
950   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);
951   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);
952   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);
953   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);
950   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);
951   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);
952   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);
953   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);
954954   return ((UINT32 *)m_main_ram)[0xc00/4 + offset];
955955}
956956
trunk/src/mame/drivers/chaknpop.c
r17788r17789
130130
131131WRITE8_MEMBER(chaknpop_state::coinlock_w)
132132{
133   logerror("%04x: coin lock %sable\n", cpu_get_pc(&space.device()), data ? "dis" : "en");
133   logerror("%04x: coin lock %sable\n", space.device().safe_pc(), data ? "dis" : "en");
134134}
135135
136136
trunk/src/mame/drivers/calchase.c
r17788r17789
356356            #if 0
357357            if ((state->m_mxtc_config_reg[0x63] & 0x50) | ( state->m_mxtc_config_reg[0x63] & 0xA0)) // Only DO if comes a change to disable ROM.
358358            {
359               if ( cpu_get_pc(busdevice->machine().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d);
359               if ( busdevice->machine(->safe_pc().device("maincpu"))==0xff74e) cpu_set_reg(busdevice->machine().device("maincpu"), STATE_GENPC, 0xff74d);
360360            }
361361            #endif
362362
r17788r17789
961961READ32_MEMBER(calchase_state::calchase_idle_skip_r)
962962{
963963
964   if(cpu_get_pc(&space.device())==0x1406f48)
964   if(space.device().safe_pc()==0x1406f48)
965965      device_spin_until_interrupt(m_maincpu);
966966
967967   return m_idle_skip_ram;
trunk/src/mame/drivers/undrfire.c
r17788r17789
393393      }
394394   }
395395
396logerror("CPU #0 PC %06x: warning - read unmapped lightgun offset %06x\n",cpu_get_pc(&space.device()),offset);
396logerror("CPU #0 PC %06x: warning - read unmapped lightgun offset %06x\n",space.device().safe_pc(),offset);
397397
398398   return 0x0;
399399}
trunk/src/mame/drivers/mpu3.c
r17788r17789
811811   int x;
812812   int call=data;
813813   if (!m_current_chr_table)
814      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device()));
814      fatalerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase());
815815
816816   if (offset == 0)
817817   {
r17788r17789
839839READ8_MEMBER(mpu3_state::characteriser_r)
840840{
841841   if (!m_current_chr_table)
842      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device()));
842      fatalerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase());
843843
844844   if (offset == 0)
845845   {
trunk/src/mame/drivers/gaiden.c
r17788r17789
176176
177177      data >>= 8;
178178
179//      logerror("PC %06x: prot = %02x\n",cpu_get_pc(&space.device()),data);
179//      logerror("PC %06x: prot = %02x\n",space.device().safe_pc(),data);
180180
181181      switch (data & 0xf0)
182182      {
r17788r17789
214214
215215READ16_MEMBER(gaiden_state::wildfang_protection_r)
216216{
217//  logerror("PC %06x: read prot %02x\n", cpu_get_pc(&space.device()), m_prot);
217//  logerror("PC %06x: read prot %02x\n", space.device().safe_pc(), m_prot);
218218   return m_prot;
219219}
220220
r17788r17789
337337   {
338338      data >>= 8;
339339
340//      logerror("PC %06x: prot = %02x\n", cpu_get_pc(&space.device()), data);
340//      logerror("PC %06x: prot = %02x\n", space.device().safe_pc(), data);
341341
342342      switch (data & 0xf0)
343343      {
r17788r17789
383383
384384READ16_MEMBER(gaiden_state::raiga_protection_r)
385385{
386//  logerror("PC %06x: read prot %02x\n", cpu_get_pc(&space.device()), m_prot);
386//  logerror("PC %06x: read prot %02x\n", space.device().safe_pc(), m_prot);
387387   return m_prot;
388388}
389389
trunk/src/mame/drivers/aleck64.c
r17788r17789
188188         break;
189189
190190      default:
191         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()));
191         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());
192192   }
193193}
194194
r17788r17789
227227      }
228228      default:
229229      {
230         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()));
230         logerror("Unknown aleck_dips_r(0x%08x, 0x%08x) @ 0x%08x PC=%08x\n", offset, 0xc0800000 + offset*4, mem_mask, space->device().safe_pc());
231231         return 0;
232232      }
233233   }
trunk/src/mame/drivers/vegas.c
r17788r17789
631631      state->m_cmos_unlocked = 0;
632632   }
633633   else
634      logerror("%08X:timekeeper_w(%04X,%08X & %08X) without CMOS unlocked\n", cpu_get_pc(&space->device()), offset, data, mem_mask);
634      logerror("%08X:timekeeper_w(%04X,%08X & %08X) without CMOS unlocked\n", space->device().safe_pc(), offset, data, mem_mask);
635635}
636636
637637
r17788r17789
677677   }
678678
679679   if (LOG_PCI)
680      logerror("%06X:PCI bridge read: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, result);
680      logerror("%06X:PCI bridge read: reg %d = %08X\n", space->device().safe_pc(), offset, result);
681681   return result;
682682}
683683
r17788r17789
687687   vegas_state *state = space->machine().driver_data<vegas_state>();
688688   state->m_pci_bridge_regs[offset] = data;
689689   if (LOG_PCI)
690      logerror("%06X:PCI bridge write: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, data);
690      logerror("%06X:PCI bridge write: reg %d = %08X\n", space->device().safe_pc(), offset, data);
691691}
692692
693693
r17788r17789
717717   }
718718
719719   if (LOG_PCI)
720      logerror("%06X:PCI IDE read: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, result);
720      logerror("%06X:PCI IDE read: reg %d = %08X\n", space->device().safe_pc(), offset, result);
721721   return result;
722722}
723723
r17788r17789
750750         break;
751751   }
752752   if (LOG_PCI)
753      logerror("%06X:PCI IDE write: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, data);
753      logerror("%06X:PCI IDE write: reg %d = %08X\n", space->device().safe_pc(), offset, data);
754754}
755755
756756
r17788r17789
790790   }
791791
792792   if (LOG_PCI)
793      logerror("%06X:PCI 3dfx read: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, result);
793      logerror("%06X:PCI 3dfx read: reg %d = %08X\n", space->device().safe_pc(), offset, result);
794794   return result;
795795}
796796
r17788r17789
842842
843843   }
844844   if (LOG_PCI)
845      logerror("%06X:PCI 3dfx write: reg %d = %08X\n", cpu_get_pc(&space->device()), offset, data);
845      logerror("%06X:PCI 3dfx write: reg %d = %08X\n", space->device().safe_pc(), offset, data);
846846}
847847
848848
r17788r17789
961961   {
962962      case NREG_CPUSTAT+0:   /* CPU status */
963963      case NREG_CPUSTAT+1:   /* CPU status */
964         if (LOG_NILE) logerror("%08X:NILE READ: CPU status(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
964         if (LOG_NILE) logerror("%08X:NILE READ: CPU status(%03X) = %08X\n", space->device().safe_pc(), offset*4, result);
965965         logit = 0;
966966         break;
967967
968968      case NREG_INTCTRL+0:   /* Interrupt control */
969969      case NREG_INTCTRL+1:   /* Interrupt control */
970         if (LOG_NILE) logerror("%08X:NILE READ: interrupt control(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
970         if (LOG_NILE) logerror("%08X:NILE READ: interrupt control(%03X) = %08X\n", space->device().safe_pc(), offset*4, result);
971971         logit = 0;
972972         break;
973973
974974      case NREG_INTSTAT0+0:   /* Interrupt status 0 */
975975      case NREG_INTSTAT0+1:   /* Interrupt status 0 */
976         if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 0(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
976         if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 0(%03X) = %08X\n", space->device().safe_pc(), offset*4, result);
977977         logit = 0;
978978         break;
979979
980980      case NREG_INTSTAT1+0:   /* Interrupt status 1 */
981981      case NREG_INTSTAT1+1:   /* Interrupt status 1 */
982         if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 1/enable(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
982         if (LOG_NILE) logerror("%08X:NILE READ: interrupt status 1/enable(%03X) = %08X\n", space->device().safe_pc(), offset*4, result);
983983         logit = 0;
984984         break;
985985
986986      case NREG_INTCLR+0:      /* Interrupt clear */
987987      case NREG_INTCLR+1:      /* Interrupt clear */
988         if (LOG_NILE) logerror("%08X:NILE READ: interrupt clear(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
988         if (LOG_NILE) logerror("%08X:NILE READ: interrupt clear(%03X) = %08X\n", space->device().safe_pc(), offset*4, result);
989989         logit = 0;
990990         break;
991991
992992      case NREG_INTPPES+0:   /* PCI Interrupt control */
993993      case NREG_INTPPES+1:   /* PCI Interrupt control */
994         if (LOG_NILE) logerror("%08X:NILE READ: PCI interrupt control(%03X) = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
994         if (LOG_NILE) logerror("%08X:NILE READ: PCI interrupt control(%03X) = %08X\n", space->device().safe_pc(), offset*4, result);
995995         logit = 0;
996996         break;
997997
r17788r17789
10181018            result = state->m_nile_regs[offset + 1] = state->m_timer[which]->remaining().as_double() * (double)SYSTEM_CLOCK;
10191019         }
10201020
1021         if (LOG_TIMERS) logerror("%08X:NILE READ: timer %d counter(%03X) = %08X\n", cpu_get_pc(&space->device()), which, offset*4, result);
1021         if (LOG_TIMERS) logerror("%08X:NILE READ: timer %d counter(%03X) = %08X\n", space->device().safe_pc(), which, offset*4, result);
10221022         logit = 0;
10231023         break;
10241024
r17788r17789
10591059   }
10601060
10611061   if (LOG_NILE && logit)
1062      logerror("%06X:nile read from offset %03X = %08X\n", cpu_get_pc(&space->device()), offset*4, result);
1062      logerror("%06X:nile read from offset %03X = %08X\n", space->device().safe_pc(), offset*4, result);
10631063   return result;
10641064}
10651065
r17788r17789
10761076   {
10771077      case NREG_CPUSTAT+0:   /* CPU status */
10781078      case NREG_CPUSTAT+1:   /* CPU status */
1079         if (LOG_NILE) logerror("%08X:NILE WRITE: CPU status(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1079         if (LOG_NILE) logerror("%08X:NILE WRITE: CPU status(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask);
10801080         logit = 0;
10811081         break;
10821082
10831083      case NREG_INTCTRL+0:   /* Interrupt control */
10841084      case NREG_INTCTRL+1:   /* Interrupt control */
1085         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt control(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1085         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt control(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask);
10861086         logit = 0;
10871087         update_nile_irqs(space->machine());
10881088         break;
10891089
10901090      case NREG_INTSTAT0+0:   /* Interrupt status 0 */
10911091      case NREG_INTSTAT0+1:   /* Interrupt status 0 */
1092         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt status 0(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1092         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt status 0(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask);
10931093         logit = 0;
10941094         update_nile_irqs(space->machine());
10951095         break;
10961096
10971097      case NREG_INTSTAT1+0:   /* Interrupt status 1 */
10981098      case NREG_INTSTAT1+1:   /* Interrupt status 1 */
1099         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);
1099         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt status 1/enable(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask);
11001100         logit = 0;
11011101         update_nile_irqs(space->machine());
11021102         break;
11031103
11041104      case NREG_INTCLR+0:      /* Interrupt clear */
11051105      case NREG_INTCLR+1:      /* Interrupt clear */
1106         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt clear(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1106         if (LOG_NILE) logerror("%08X:NILE WRITE: interrupt clear(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask);
11071107         logit = 0;
11081108         state->m_nile_irq_state &= ~(state->m_nile_regs[offset] & ~0xf00);
11091109         update_nile_irqs(space->machine());
r17788r17789
11111111
11121112      case NREG_INTPPES+0:   /* PCI Interrupt control */
11131113      case NREG_INTPPES+1:   /* PCI Interrupt control */
1114         if (LOG_NILE) logerror("%08X:NILE WRITE: PCI interrupt control(%03X) = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1114         if (LOG_NILE) logerror("%08X:NILE WRITE: PCI interrupt control(%03X) = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask);
11151115         logit = 0;
11161116         break;
11171117
r17788r17789
11361136      case NREG_T2CTRL+1:      /* general purpose timer control (control bits) */
11371137      case NREG_T3CTRL+1:      /* watchdog timer control (control bits) */
11381138         which = (offset - NREG_T0CTRL) / 4;
1139         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);
1139         if (LOG_NILE) logerror("%08X:NILE WRITE: timer %d control(%03X) = %08X & %08X\n", space->device().safe_pc(), which, offset*4, data, mem_mask);
11401140         logit = 0;
11411141
11421142         /* timer just enabled? */
r17788r17789
11651165      case NREG_T2CNTR:      /* general purpose timer control (counter) */
11661166      case NREG_T3CNTR:      /* watchdog timer control (counter) */
11671167         which = (offset - NREG_T0CTRL) / 4;
1168         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);
1168         if (LOG_TIMERS) logerror("%08X:NILE WRITE: timer %d counter(%03X) = %08X & %08X\n", space->device().safe_pc(), which, offset*4, data, mem_mask);
11691169         logit = 0;
11701170
11711171         if (state->m_nile_regs[offset - 1] & 1)
r17788r17789
12201220   }
12211221
12221222   if (LOG_NILE && logit)
1223      logerror("%06X:nile write to offset %03X = %08X & %08X\n", cpu_get_pc(&space->device()), offset*4, data, mem_mask);
1223      logerror("%06X:nile write to offset %03X = %08X & %08X\n", space->device().safe_pc(), offset*4, data, mem_mask);
12241224}
12251225
12261226
r17788r17789
13941394   if (ACCESSING_BITS_16_23) offset += 2;
13951395   if (ACCESSING_BITS_24_31) offset += 3;
13961396   if (LOG_SIO && offset != 0)
1397      logerror("%08X:sio write to offset %X = %02X\n", cpu_get_pc(&space->device()), offset, data >> (offset*8));
1397      logerror("%08X:sio write to offset %X = %02X\n", space->device().safe_pc(), offset, data >> (offset*8));
13981398   if (offset < 4)
13991399      state->m_sio_data[offset] = data >> (offset*8);
14001400   if (offset == 1)
r17788r17789
14131413   if (offset < 4)
14141414      result = state->m_sio_data[0] | (state->m_sio_data[1] << 8) | (state->m_sio_data[2] << 16) | (state->m_sio_data[3] << 24);
14151415   if (LOG_SIO && offset != 2)
1416      logerror("%08X:sio read from offset %X = %02X\n", cpu_get_pc(&space->device()), offset, result >> (offset*8));
1416      logerror("%08X:sio read from offset %X = %02X\n", space->device().safe_pc(), offset, result >> (offset*8));
14171417   return result;
14181418}
14191419
r17788r17789
14381438   static const char *const portnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5", "AN6", "AN7" };
14391439
14401440   if (data < 8 || data > 15)
1441      logerror("%08X:Unexpected analog port select = %08X\n", cpu_get_pc(&space->device()), data);
1441      logerror("%08X:Unexpected analog port select = %08X\n", space->device().safe_pc(), data);
14421442   state->m_pending_analog_read = state->ioport(portnames[data & 7])->read_safe(0);
14431443}
14441444
trunk/src/mame/drivers/enigma2.c
r17788r17789
359359{
360360   UINT8 ret = 0x00;
361361
362   if (LOG_PROT) logerror("DIP SW Read: %x at %x (prot data %x)\n", offset, cpu_get_pc(&space.device()), m_protection_data);
362   if (LOG_PROT) logerror("DIP SW Read: %x at %x (prot data %x)\n", offset, space.device().safe_pc(), m_protection_data);
363363   switch (offset)
364364   {
365365   case 0x01:
r17788r17789
372372      break;
373373
374374   case 0x02:
375      if (cpu_get_pc(&space.device()) == 0x07e5)
375      if (space.device().safe_pc() == 0x07e5)
376376         ret = 0xaa;
377377      else
378378         ret = 0xf4;
trunk/src/mame/drivers/igspoker.c
r17788r17789
242242
243243   m_nmi_enable = data & 0x80;     // nmi enable?
244244#ifdef VERBOSE
245   logerror("PC %06X: NMI change %02x\n",cpu_get_pc(&space.device()),m_nmi_enable);
245   logerror("PC %06X: NMI change %02x\n",space.device().safe_pc(),m_nmi_enable);
246246#endif
247247
248248   m_out[0] = data;
r17788r17789
294294READ8_MEMBER(igspoker_state::custom_io_r)
295295{
296296#ifdef VERBOSE
297   logerror("PC %06X: Protection read %02x\n",cpu_get_pc(&space.device()), (int) m_protection_res);
297   logerror("PC %06X: Protection read %02x\n",space.device().safe_pc(), (int) m_protection_res);
298298#endif
299299   return m_protection_res;
300300}
r17788r17789
302302WRITE8_MEMBER(igspoker_state::custom_io_w)
303303{
304304#ifdef VERBOSE
305   logerror("PC %06X: Protection write %02x\n",cpu_get_pc(&space.device()),data);
305   logerror("PC %06X: Protection write %02x\n",space.device().safe_pc(),data);
306306#endif
307307
308308   switch (data)
trunk/src/mame/drivers/segaorun.c
r17788r17789
483483{
484484   if (!m_custom_io_r.isnull())
485485      return m_custom_io_r(space, offset, mem_mask);
486   logerror("%06X:misc_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2);
486   logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2);
487487   return open_bus_r(space, 0, mem_mask);
488488}
489489
r17788r17789
499499      m_custom_io_w(space, offset, data, mem_mask);
500500      return;
501501   }
502   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask);
502   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask);
503503}
504504
505505
r17788r17789
656656         return watchdog_reset_r(space, 0);
657657   }
658658
659   logerror("%06X:outrun_custom_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2);
659   logerror("%06X:outrun_custom_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2);
660660   return open_bus_r(space, 0, mem_mask);
661661}
662662
r17788r17789
698698         m_sprites->draw_write(space, offset, data, mem_mask);
699699         return;
700700   }
701   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask);
701   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask);
702702}
703703
704704
r17788r17789
727727         return ioport(ports[m_adc_select])->read_safe(0x0010);
728728      }
729729   }
730   logerror("%06X:misc_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2);
730   logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2);
731731   return open_bus_r(space,0,mem_mask);
732732}
733733
r17788r17789
764764         // ADC trigger
765765         return;
766766   }
767   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask);
767   logerror("%06X:misc_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask);
768768}
769769
770770
trunk/src/mame/drivers/namcona1.c
r17788r17789
787787#if 0
788788   if (offset >= 0x70000/2)
789789   {
790      logerror("MD: %04x @ %x PC %x\n", ((data>>8)&0xff) | ((data<<8)&0xff00), offset*2, cpu_get_pc(&space.device()));
790      logerror("MD: %04x @ %x PC %x\n", ((data>>8)&0xff) | ((data<<8)&0xff00), offset*2, space.device().safe_pc());
791791   }
792792#endif
793793
r17788r17789
844844{
845845   if ((data & 0x08) && !(m_mcu_port4 & 0x08))
846846   {
847      logerror("launching 68k, PC=%x\n", cpu_get_pc(&space.device()));
847      logerror("launching 68k, PC=%x\n", space.device().safe_pc());
848848
849849      // reset and launch the 68k
850850      cputag_set_input_line(machine(), "maincpu", INPUT_LINE_RESET, CLEAR_LINE);
trunk/src/mame/drivers/cdi.c
r17788r17789
4444        va_start( v, s_fmt );
4545        vsprintf( buf, s_fmt, v );
4646        va_end( v );
47        logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
47        logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
4848    }
4949}
5050#else
trunk/src/mame/drivers/dkong.c
r17788r17789
642642WRITE8_MEMBER(dkong_state::s2650_data_w)
643643{
644644#if DEBUG_PROTECTION
645    logerror("write : pc = %04x, loopback = %02x\n",cpu_get_pc(&space.device()), data);
645    logerror("write : pc = %04x, loopback = %02x\n",space.device().safe_pc(), data);
646646#endif
647647
648648    m_hunchloopback = data;
r17788r17789
651651WRITE8_MEMBER(dkong_state::s2650_fo_w)
652652{
653653#if DEBUG_PROTECTION
654    logerror("write : pc = %04x, FO = %02x\n",cpu_get_pc(&space.device()), data);
654    logerror("write : pc = %04x, FO = %02x\n",space.device().safe_pc(), data);
655655#endif
656656
657657    m_main_fo = data;
r17788r17789
663663READ8_MEMBER(dkong_state::s2650_port0_r)
664664{
665665#if DEBUG_PROTECTION
666    logerror("port 0 : pc = %04x, loopback = %02x fo=%d\n",cpu_get_pc(&space.device()), m_hunchloopback, m_main_fo);
666    logerror("port 0 : pc = %04x, loopback = %02x fo=%d\n",space.device().safe_pc(), m_hunchloopback, m_main_fo);
667667#endif
668668
669669    switch (m_protect_type)
r17788r17789
680680          else
681681             return m_hunchloopback--;
682682    }
683    fatalerror("Unhandled read from port 0 : pc = %4x\n",cpu_get_pc(&space.device()));
683    fatalerror("Unhandled read from port 0 : pc = %4x\n",space.device().safe_pc());
684684}
685685
686686
r17788r17789
688688{
689689
690690#if DEBUG_PROTECTION
691    logerror("port 1 : pc = %04x, loopback = %02x fo=%d\n",cpu_get_pc(&space.device()), m_hunchloopback, m_main_fo);
691    logerror("port 1 : pc = %04x, loopback = %02x fo=%d\n",space.device().safe_pc(), m_hunchloopback, m_main_fo);
692692#endif
693693
694694    switch (m_protect_type)
r17788r17789
702702           else
703703              return ++m_prot_cnt;
704704    }
705    fatalerror("Unhandled read from port 1 : pc = %4x\n",cpu_get_pc(&space.device()));
705    fatalerror("Unhandled read from port 1 : pc = %4x\n",space.device().safe_pc());
706706}
707707
708708
trunk/src/mame/drivers/seicross.c
r17788r17789
9090WRITE8_MEMBER(seicross_state::friskyt_portB_w)
9191{
9292
93   //logerror("PC %04x: 8910 port B = %02x\n", cpu_get_pc(&space->device()), data);
93   //logerror("PC %04x: 8910 port B = %02x\n", space->device().safe_pc(), data);
9494   /* bit 0 is IRQ enable */
9595   m_irq_mask = data & 1;
9696
trunk/src/mame/drivers/system16.c
r17788r17789
413413         break;
414414      default:
415415         m_soundbank_ptr = NULL;
416         logerror("Invalid bank setting %02X (%04X)\n", data, cpu_get_pc(&space.device()));
416         logerror("Invalid bank setting %02X (%04X)\n", data, space.device().safe_pc());
417417         break;
418418   }
419419}
r17788r17789
12221222         break;
12231223      default:
12241224         m_soundbank_ptr = NULL;
1225         logerror("Invalid bank setting %02X (%04X)\n", data, cpu_get_pc(&space.device()));
1225         logerror("Invalid bank setting %02X (%04X)\n", data, space.device().safe_pc());
12261226         break;
12271227   }
12281228}
trunk/src/mame/drivers/nyny.c
r17788r17789
464464{
465465   /* not sure what this does */
466466
467   /*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());*/
467   /*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());*/
468468}
469469
470470
trunk/src/mame/drivers/model1.c
r17788r17789
797797   if(0 && offset)
798798      return;
799799   if(1 && m_dump)
800      logerror("TGP: md1_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()));
800      logerror("TGP: md1_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc());
801801}
802802
803803WRITE16_MEMBER(model1_state::md0_w)
r17788r17789
806806   if(0 && offset)
807807      return;
808808   if(1 && m_dump)
809      logerror("TGP: md0_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()));
809      logerror("TGP: md0_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc());
810810}
811811
812812WRITE16_MEMBER(model1_state::p_w)
r17788r17789
814814   UINT16 old = m_generic_paletteram_16[offset];
815815   paletteram_xBBBBBGGGGGRRRRR_word_w(space, offset, data, mem_mask);
816816   if(0 && m_generic_paletteram_16[offset] != old)
817      logerror("XVIDEO: p_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()));
817      logerror("XVIDEO: p_w %x, %04x @ %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc());
818818}
819819
820820WRITE16_MEMBER(model1_state::mr_w)
821821{
822822   COMBINE_DATA(m_mr+offset);
823823   if(0 && offset == 0x1138/2)
824      logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x500000, data, mem_mask, cpu_get_pc(&space.device()));
824      logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x500000, data, mem_mask, space.device().safe_pc());
825825}
826826
827827WRITE16_MEMBER(model1_state::mr2_w)
r17788r17789
829829   COMBINE_DATA(m_mr2+offset);
830830#if 0
831831   if(0 && offset == 0x6e8/2) {
832      logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x400000, data, mem_mask, cpu_get_pc(&space.device()));
832      logerror("MR.w %x, %04x @ %04x (%x)\n", offset*2+0x400000, data, mem_mask, space.device().safe_pc());
833833   }
834834   if(offset/2 == 0x3680/4)
835      logerror("MW f80[r25], %04x%04x (%x)\n", m_mr2[0x3680/2+1], m_mr2[0x3680/2], cpu_get_pc(&space.device()));
835      logerror("MW f80[r25], %04x%04x (%x)\n", m_mr2[0x3680/2+1], m_mr2[0x3680/2], space.device().safe_pc());
836836   if(offset/2 == 0x06ca/4)
837      logerror("MW fca[r19], %04x%04x (%x)\n", m_mr2[0x06ca/2+1], m_mr2[0x06ca/2], cpu_get_pc(&space.device()));
837      logerror("MW fca[r19], %04x%04x (%x)\n", m_mr2[0x06ca/2+1], m_mr2[0x06ca/2], space.device().safe_pc());
838838   if(offset/2 == 0x1eca/4)
839      logerror("MW fca[r22], %04x%04x (%x)\n", m_mr2[0x1eca/2+1], m_mr2[0x1eca/2], cpu_get_pc(&space.device()));
839      logerror("MW fca[r22], %04x%04x (%x)\n", m_mr2[0x1eca/2+1], m_mr2[0x1eca/2], space.device().safe_pc());
840840#endif
841841
842842   // wingwar scene position, pc=e1ce -> d735
843843   if(offset/2 == 0x1f08/4)
844      logerror("MW  8[r10], %f (%x)\n", *(float *)(m_mr2+0x1f08/2), cpu_get_pc(&space.device()));
844      logerror("MW  8[r10], %f (%x)\n", *(float *)(m_mr2+0x1f08/2), space.device().safe_pc());
845845   if(offset/2 == 0x1f0c/4)
846      logerror("MW  c[r10], %f (%x)\n", *(float *)(m_mr2+0x1f0c/2), cpu_get_pc(&space.device()));
846      logerror("MW  c[r10], %f (%x)\n", *(float *)(m_mr2+0x1f0c/2), space.device().safe_pc());
847847   if(offset/2 == 0x1f10/4)
848      logerror("MW 10[r10], %f (%x)\n", *(float *)(m_mr2+0x1f10/2), cpu_get_pc(&space.device()));
848      logerror("MW 10[r10], %f (%x)\n", *(float *)(m_mr2+0x1f10/2), space.device().safe_pc());
849849}
850850
851851READ16_MEMBER(model1_state::snd_68k_ready_r)
trunk/src/mame/drivers/polepos.c
r17788r17789
259259      m_last_result = (INT8)m_last_signed * (UINT8)m_last_unsigned;
260260   }
261261
262//  logerror("%04X: read IC25 @ %04X = %02X\n", cpu_get_pc(&space.device()), offset, result);
262//  logerror("%04X: read IC25 @ %04X = %02X\n", space.device().safe_pc(), offset, result);
263263
264264   return result | (result << 8);
265265}
trunk/src/mame/drivers/qdrmfgp.c
r17788r17789
239239   {
240240      if (offset == 0x07)
241241      {
242         switch (cpu_get_previouspc(&space.device()))
242         switch (space.device().safe_pcbase())
243243         {
244244            case 0xdb4c:
245245               if ((m_workram[0x5fa4/2] - cpu_get_reg(&space.device(), M68K_D0)) <= 0x10)
trunk/src/mame/drivers/cps1.c
r17788r17789
355355      return rom[offset] | 0xff00;
356356   else
357357   {
358      popmessage("%06x: read sound ROM byte %04x", cpu_get_pc(&space.device()), offset);
358      popmessage("%06x: read sound ROM byte %04x", space.device().safe_pc(), offset);
359359      return 0;
360360   }
361361}
trunk/src/mame/drivers/namcos11.c
r17788r17789
757757
758758READ16_MEMBER(namcos11_state::c76_inputs_r)
759759{
760//  logerror("'c76' Read port %d @ %06X\n", offset, cpu_get_pc(&space.device()));
760//  logerror("'c76' Read port %d @ %06X\n", offset, space.device().safe_pc());
761761
762762   switch (offset)
763763   {
r17788r17789
855855READ16_MEMBER(namcos11_state::c76_speedup_r)
856856{
857857
858   if ((cpu_get_pc(&space.device()) == 0xc153) && (!(m_su_83 & 0xff00)))
858   if ((space.device().safe_pc() == 0xc153) && (!(m_su_83 & 0xff00)))
859859   {
860860      device_spin_until_interrupt(&space.device());
861861   }
trunk/src/mame/drivers/kickgoal.c
r17788r17789
155155   okim6295_device *oki = downcast<okim6295_device *>(device);
156156   if (ACCESSING_BITS_0_7)
157157   {
158      logerror("PC:%06x Writing %04x to Sound CPU\n",cpu_get_previouspc(&space->device()),data);
158      logerror("PC:%06x Writing %04x to Sound CPU\n",space->device().safe_pcbase(),data);
159159      if (data >= 0x40) {
160160         if (data == 0xfe) {
161161            oki->write(0,0x40);   /* Stop playing the melody */
trunk/src/mame/drivers/galaxian.c
r17788r17789
12441244      case 0x0235:  return 0x02;
12451245      case 0x0311:  return 0xff;  /* not checked */
12461246   }
1247   logerror("Unknown protection read. Offset: %04X  PC=%04X\n",0xb000+offset,cpu_get_pc(&space.device()));
1247   logerror("Unknown protection read. Offset: %04X  PC=%04X\n",0xb000+offset,space.device().safe_pc());
12481248   return 0xff;
12491249}
12501250
r17788r17789
12711271
12721272READ8_MEMBER(galaxian_state::checkmaj_protection_r)
12731273{
1274   switch (cpu_get_pc(&space.device()))
1274   switch (space.device().safe_pc())
12751275   {
12761276      case 0x0f15:  return 0xf5;
12771277      case 0x0f8f:  return 0x7c;
r17788r17789
12801280      case 0x10f1:  return 0xaa;
12811281      case 0x1402:  return 0xaa;
12821282      default:
1283         logerror("Unknown protection read. PC=%04X\n",cpu_get_pc(&space.device()));
1283         logerror("Unknown protection read. PC=%04X\n",space.device().safe_pc());
12841284   }
12851285
12861286   return 0;
trunk/src/mame/drivers/bbusters.c
r17788r17789
279279WRITE16_MEMBER(bbusters_state::gun_select_w)
280280{
281281
282   logerror("%08x: gun r\n",cpu_get_pc(&space.device()));
282   logerror("%08x: gun r\n",space.device().safe_pc());
283283
284284   device_set_input_line(&space.device(), 2, HOLD_LINE);
285285
trunk/src/mame/drivers/hyprduel.c
r17788r17789
296296      int shift = (dst_offs & 0x80) ? 0 : 8;
297297      UINT16 mask = (dst_offs & 0x80) ? 0x00ff : 0xff00;
298298
299//      logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", cpu_get_pc(&space.device()), tmap, src_offs, dst_offs);
299//      logerror("CPU #0 PC %06X : Blitter regs %08X, %08X, %08X\n", space.device().safe_pc(), tmap, src_offs, dst_offs);
300300
301301      dst_offs >>= 7 + 1;
302302      switch (tmap)
r17788r17789
306306         case 3:
307307            break;
308308         default:
309            logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", cpu_get_pc(&space.device()), tmap);
309            logerror("CPU #0 PC %06X : Blitter unknown destination: %08X\n", space.device().safe_pc(), tmap);
310310            return;
311311      }
312312
r17788r17789
316316
317317         src_offs %= src_len;
318318         b1 = blt_read(src, src_offs);
319//          logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", cpu_get_pc(&space.device()), b1, src_offs);
319//          logerror("CPU #0 PC %06X : Blitter opcode %02X at %06X\n", space.device().safe_pc(), b1, src_offs);
320320         src_offs++;
321321
322322         count = ((~b1) & 0x3f) + 1;
r17788r17789
400400
401401
402402            default:
403               logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n", cpu_get_pc(&space.device()), b1, src_offs - 1);
403               logerror("CPU #0 PC %06X : Blitter unknown opcode %02X at %06X\n", space.device().safe_pc(), b1, src_offs - 1);
404404               return;
405405         }
406406
trunk/src/mame/drivers/flstory.c
r17788r17789
154154
155155READ8_MEMBER(flstory_state::rumba_mcu_r)
156156{
157   //printf("PC=%04x R %02x\n",cpu_get_pc(&space.device()),m_mcu_cmd);
157   //printf("PC=%04x R %02x\n",space.device().safe_pc(),m_mcu_cmd);
158158
159159   if((m_mcu_cmd & 0xf0) == 0x00) // end packet cmd, value returned is meaningless (probably used for main <-> mcu comms syncronization)
160160      return 0;
r17788r17789
197197         return 0;
198198      }
199199      //case 0x42: return 0x06;
200      //default:  printf("PC=%04x R %02x\n",cpu_get_pc(&space.device()),m_mcu_cmd); break;
200      //default:  printf("PC=%04x R %02x\n",space.device().safe_pc(),m_mcu_cmd); break;
201201   }
202202
203203   return 0;
r17788r17789
265265                */
266266
267267            m_mcu_bb_res = data;
268            //printf("PC=%04x W %02x -> %02x\n",cpu_get_pc(&space.device()),m_mcu_cmd,data);
268            //printf("PC=%04x W %02x -> %02x\n",space.device().safe_pc(),m_mcu_cmd,data);
269269            break;
270270         }
271271         case 0xb4: // when the bird touches the top / bottom / left / right of the screen, for correct repositioning
trunk/src/mame/drivers/bmcbowl.c
r17788r17789
203203
204204READ16_MEMBER(bmcbowl_state::bmc_protection_r)
205205{
206   switch(cpu_get_previouspc(&space.device()))
206   switch(space.device().safe_pcbase())
207207   {
208208      case 0xca68:
209209         switch(cpu_get_reg(&space.device(), M68K_D2))
r17788r17789
214214         }
215215         break;
216216   }
217   logerror("Protection read @ %X\n",cpu_get_previouspc(&space.device()));
217   logerror("Protection read @ %X\n",space.device().safe_pcbase());
218218   return machine().rand();
219219}
220220
trunk/src/mame/drivers/pcat_nit.c
r17788r17789
151151
152152WRITE8_MEMBER(pcat_nit_state::pcat_nit_rombank_w)
153153{
154   logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(&space.device()) );
154   logerror( "rom bank #%02x at PC=%08X\n", data, space.device().safe_pc() );
155155   if ( data & 0x40 )
156156   {
157157      // rom bank
trunk/src/mame/drivers/segag80r.c
r17788r17789
171171   segag80r_state *state = space->machine().driver_data<segag80r_state>();
172172
173173   /* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */
174   offs_t pc = cpu_get_previouspc(&space->device());
174   offs_t pc = space->device().safe_pcbase();
175175   if ((UINT16)pc == 0xffff || space->read_byte(pc) != 0x32)
176176      return offset;
177177
trunk/src/mame/drivers/tmnt.c
r17788r17789
380380         return data;
381381
382382      default:
383         popmessage("%06x: unknown protection read",cpu_get_pc(&space.device()));
384         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);
383         popmessage("%06x: unknown protection read",space.device().safe_pc());
384         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);
385385         return 0xffff;
386386    }
387387}
trunk/src/mame/drivers/taitojc.c
r17788r17789
518518
519519WRITE32_MEMBER(taitojc_state::dsp_shared_w)
520520{
521   //mame_printf_debug("dsp_shared: %08X, %04X at %08X\n", offset, data >> 16, cpu_get_pc(&space.device()));
521   //mame_printf_debug("dsp_shared: %08X, %04X at %08X\n", offset, data >> 16, space.device().safe_pc());
522522   if (ACCESSING_BITS_24_31)
523523   {
524524      m_dsp_shared_ram[offset] &= 0x00ff;
r17788r17789
588588      }
589589      default:
590590      {
591         //mame_printf_debug("hc11_reg_r: %02X at %08X\n", reg, cpu_get_pc(&space->device()));
591         //mame_printf_debug("hc11_reg_r: %02X at %08X\n", reg, space->device().safe_pc());
592592         break;
593593      }
594594   }
r17788r17789
615615      }
616616      default:
617617      {
618         //mame_printf_debug("hc11_reg_w: %02X, %02X at %08X\n", reg, data, cpu_get_pc(&space->device()));
618         //mame_printf_debug("hc11_reg_w: %02X, %02X at %08X\n", reg, data, space->device().safe_pc());
619619         break;
620620      }
621621   }
r17788r17789
978978WRITE16_MEMBER(taitojc_state::dsp_texaddr_w)
979979{
980980   m_dsp_tex_address = data;
981//  mame_printf_debug("texaddr = %08X at %08X\n", data, cpu_get_pc(&space.device()));
981//  mame_printf_debug("texaddr = %08X at %08X\n", data, space.device().safe_pc());
982982
983983   m_texture_x = (((data >> 0) & 0x1f) << 1) | ((data >> 12) & 0x1);
984984   m_texture_y = (((data >> 5) & 0x1f) << 1) | ((data >> 13) & 0x1);
r17788r17789
13011301
13021302READ16_MEMBER(taitojc_state::taitojc_dsp_idle_skip_r)
13031303{
1304   if(cpu_get_pc(&space.device())==0x404c)
1304   if(space.device().safe_pc()==0x404c)
13051305      device_spin_until_time(&space.device(), attotime::from_usec(500));
13061306
13071307   return m_dsp_shared_ram[0x7f0];
r17788r17789
13091309
13101310READ16_MEMBER(taitojc_state::dendego2_dsp_idle_skip_r)
13111311{
1312   if(cpu_get_pc(&space.device())==0x402e)
1312   if(space.device().safe_pc()==0x402e)
13131313      device_spin_until_time(&space.device(), attotime::from_usec(500));
13141314
13151315   return m_dsp_shared_ram[0x7f0];
trunk/src/mame/drivers/igs009.c
r17788r17789
376376{
377377   if ((m_nmi_enable ^ data) & (~0xdd))
378378   {
379      logerror("PC %06X: nmi_and_coins = %02x\n",cpu_get_pc(&space.device()),data);
379      logerror("PC %06X: nmi_and_coins = %02x\n",space.device().safe_pc(),data);
380380//      popmessage("%02x",data);
381381   }
382382
r17788r17789
432432
433433      default:
434434//          popmessage("magic %x <- %04x",m_igs_magic[0],data);
435         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0], data);
435         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", space.device().safe_pc(), m_igs_magic[0], data);
436436   }
437437}
438438
r17788r17789
446446         if ( !(m_igs_magic[1] & 0x04) )   return ioport("DSW3")->read();
447447         if ( !(m_igs_magic[1] & 0x08) )   return ioport("DSW4")->read();
448448         if ( !(m_igs_magic[1] & 0x10) )   return ioport("DSW5")->read();
449         logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[1]);
449         logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", space.device().safe_pc(), m_igs_magic[1]);
450450         break;
451451
452452      default:
453         logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0]);
453         logerror("%06x: warning, reading with igs_magic = %02x\n", space.device().safe_pc(), m_igs_magic[0]);
454454   }
455455
456456   return 0;
trunk/src/mame/drivers/spy.c
r17788r17789
4545   {
4646      if (m_pmcbank)
4747      {
48         //logerror("%04x read pmcram %04x\n", cpu_get_pc(&space.device()), offset);
48         //logerror("%04x read pmcram %04x\n", space.device().safe_pc(), offset);
4949         return m_pmcram[offset];
5050      }
5151      else
5252      {
53         //logerror("%04x read pmc internal ram %04x\n", cpu_get_pc(&space.device()), offset);
53         //logerror("%04x read pmc internal ram %04x\n", space.device().safe_pc(), offset);
5454         return 0;
5555      }
5656   }
r17788r17789
6969   {
7070      if (m_pmcbank)
7171      {
72         //logerror("%04x pmcram %04x = %02x\n", cpu_get_pc(&space.device()), offset, data);
72         //logerror("%04x pmcram %04x = %02x\n", space.device().safe_pc(), offset, data);
7373         m_pmcram[offset] = data;
7474      }
7575      //else
76         //logerror("%04x pmc internal ram %04x = %02x\n", cpu_get_pc(&space.device()), offset, data);
76         //logerror("%04x pmc internal ram %04x = %02x\n", space.device().safe_pc(), offset, data);
7777   }
7878   else
7979      m_ram[offset] = data;
r17788r17789
304304   /* bit 7 = PMC-BK */
305305   m_pmcbank = (data & 0x80) >> 7;
306306
307//logerror("%04x: 3f90_w %02x\n", cpu_get_pc(&space.device()), data);
307//logerror("%04x: 3f90_w %02x\n", space.device().safe_pc(), data);
308308   /* bit 6 = PMC-START */
309309   if ((data & 0x40) && !(m_old_3f90 & 0x40))
310310   {
trunk/src/mame/drivers/psikyo.c
r17788r17789
127127      case 0x0:   return ioport("P1_P2")->read();
128128      case 0x1:   return ioport("DSW")->read();
129129      case 0x2:   return ioport("COIN")->read();
130      default:   logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset * 2);
130      default:   logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset * 2);
131131            return 0;
132132   }
133133}
r17788r17789
138138   {
139139      case 0x0:   return ioport("P1_P2")->read();
140140      case 0x1:   return ioport("DSW")->read();
141      default:   logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset * 2);
141      default:   logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset * 2);
142142            return 0;
143143   }
144144}
r17788r17789
247247         m_s1945_mcu_latching |= 4;
248248         break;
249249      default:
250//          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()));
250//          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());
251251         break;
252252      }
253253      break;
254254   default:
255//      logerror("MCU.w %x, %02x (%x)\n", offset, data, cpu_get_pc(&space.device()));
255//      logerror("MCU.w %x, %02x (%x)\n", offset, data, space.device().safe_pc());
256256      ;
257257   }
258258}
r17788r17789
291291      case 0x0:   return ioport("P1_P2")->read();
292292      case 0x1:   return (ioport("DSW")->read() & 0xffff000f) | s1945_mcu_r(space, offset - 1, mem_mask);
293293      case 0x2:   return s1945_mcu_r(space, offset - 1, mem_mask);
294      default:   logerror("PC %06X - Read input %02X !\n", cpu_get_pc(&space.device()), offset * 2);
294      default:   logerror("PC %06X - Read input %02X !\n", space.device().safe_pc(), offset * 2);
295295               return 0;
296296   }
297297}
trunk/src/mame/drivers/esd16.c
r17788r17789
107107      return ((m_eeprom->read_bit() & 0x01) << 15);
108108   }
109109
110//  logerror("(0x%06x) unk EEPROM read: %04x\n", cpu_get_pc(&space.device()), mem_mask);
110//  logerror("(0x%06x) unk EEPROM read: %04x\n", space.device().safe_pc(), mem_mask);
111111   return 0;
112112}
113113
r17788r17789
116116   if (ACCESSING_BITS_8_15)
117117      ioport("EEPROMOUT")->write(data, 0xffff);
118118
119//  logerror("(0x%06x) Unk EEPROM write: %04x %04x\n", cpu_get_pc(&space.device()), data, mem_mask);
119//  logerror("(0x%06x) Unk EEPROM write: %04x %04x\n", space.device().safe_pc(), data, mem_mask);
120120}
121121
122122
trunk/src/mame/drivers/model3.c
r17788r17789
11831183      case 0x9c:      /* Unknown */
11841184         break;
11851185      default:
1186         logerror("dma_callback: %08X, %08X, %d at %08X", src, dst, length, cpu_get_pc(machine.device("maincpu")));
1186         logerror("dma_callback: %08X, %08X, %d at %08X", src, dst, length, machine.device("maincpu")->safe_pc());
11871187         break;
11881188   }
11891189}
r17788r17789
14641464                  }
14651465                  break;
14661466               default:
1467                  //mame_printf_debug("Lightgun: Unknown command %02X at %08X\n", (UINT32)(data >> 24), cpu_get_pc(&space.device()));
1467                  //mame_printf_debug("Lightgun: Unknown command %02X at %08X\n", (UINT32)(data >> 24), space.device().safe_pc());
14681468                  break;
14691469            }
14701470         }
r17788r17789
14911491
14921492READ64_MEMBER(model3_state::model3_sys_r)
14931493{
1494//  printf("model3_sys_r: mask %llx @ %x (PC %x)\n", mem_mask, offset, cpu_get_pc(&space.device()));
1494//  printf("model3_sys_r: mask %llx @ %x (PC %x)\n", mem_mask, offset, space.device().safe_pc());
14951495
14961496   switch (offset)
14971497   {
r17788r17789
15161516         else logerror("m3_sys: Unk sys_r @ 0x10: mask = %x\n", (UINT32)mem_mask);
15171517         break;
15181518      case 0x18/8:
1519//          printf("read irq_state %x (PC %x)\n", m_irq_state, cpu_get_pc(&space.device()));
1519//          printf("read irq_state %x (PC %x)\n", m_irq_state, space.device().safe_pc());
15201520         return (UINT64)m_irq_state<<56 | 0xff000000;
15211521   }
15221522
r17788r17789
16681668
16691669READ64_MEMBER(model3_state::network_r)
16701670{
1671   mame_printf_debug("network_r: %02X at %08X\n", offset, cpu_get_pc(&space.device()));
1671   mame_printf_debug("network_r: %02X at %08X\n", offset, space.device().safe_pc());
16721672   return m_network_ram[offset];
16731673}
16741674
16751675WRITE64_MEMBER(model3_state::network_w)
16761676{
16771677   COMBINE_DATA(m_network_ram + offset);
1678   mame_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), cpu_get_pc(&space.device()));
1678   mame_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), space.device().safe_pc());
16791679}
16801680
16811681
trunk/src/mame/drivers/xexex.c
r17788r17789
163163READ16_MEMBER(xexex_state::xexex_waitskip_r)
164164{
165165
166   if (cpu_get_pc(&space.device()) == 0x1158)
166   if (space.device().safe_pc() == 0x1158)
167167   {
168168      device_spin_until_trigger(&space.device(), m_resume_trigger);
169169      m_suspension_active = 1;
trunk/src/mame/drivers/epos.c
r17788r17789
4242   else
4343      m_counter = (m_counter - 1) & 0x03;
4444
45//  logerror("PC %08x: ctr=%04x\n",cpu_get_pc(&space.device()), m_counter);
45//  logerror("PC %08x: ctr=%04x\n",space.device().safe_pc(), m_counter);
4646
4747   membank("bank1")->set_entry(m_counter);
4848
trunk/src/mame/drivers/glass.c
r17788r17789
320320READ16_MEMBER( glass_state::glass_mainram_r )
321321{
322322   UINT16 ret = m_mainram[offset];
323   int pc = cpu_get_pc(&space.device());
323   int pc = space.device().safe_pc();
324324
325325   if (offset == (0xfede96 - 0xfec000)>>1)
326326   {
r17788r17789
353353
354354WRITE16_MEMBER( glass_state::glass_mainram_w )
355355{
356   int pc = cpu_get_pc(&space.device());
356   int pc = space.device().safe_pc();
357357
358358   COMBINE_DATA(&m_mainram[offset]);
359359
trunk/src/mame/drivers/neoprint.c
r17788r17789
131131
132132READ16_MEMBER(neoprint_state::neoprint_calendar_r)
133133{
134   //if(cpu_get_pc(&space.device()) != 0x4b38 )//&& cpu_get_pc(&space.device()) != 0x5f86 && cpu_get_pc(&space.device()) != 0x5f90)
135   //  printf("%08x\n",cpu_get_pc(&space.device()));
134   //if(space.device().safe_pc() != 0x4b38 )//&& space.device().safe_pc() != 0x5f86 && space.device().safe_pc() != 0x5f90)
135   //  printf("%08x\n",space.device().safe_pc());
136136
137137   return (upd4990a_databit_r(machine().device("upd4990a"), 0) << 15);
138138}
r17788r17789
151151
152152   m_vblank = (machine().primary_screen->frame_number() & 0x1) ? 0x10 : 0x00;
153153
154   //if(cpu_get_pc(&space.device()) != 0x1504 && cpu_get_pc(&space.device()) != 0x5f86 && cpu_get_pc(&space.device()) != 0x5f90)
155   //  printf("%08x\n",cpu_get_pc(&space.device()));
154   //if(space.device().safe_pc() != 0x1504 && space.device().safe_pc() != 0x5f86 && space.device().safe_pc() != 0x5f90)
155   //  printf("%08x\n",space.device().safe_pc());
156156
157157   return m_vblank| 4 | 3;
158158}
r17788r17789
185185      /* boost the interleave to let the audio CPU read the command */
186186      machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
187187
188      //if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(&space.device()), data, mem_mask);
188      //if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", space.device().safe_pc(), data, mem_mask);
189189   }
190190}
191191
r17788r17789
194194{
195195   UINT8 ret = soundlatch_byte_r(space, 0);
196196
197   //if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret);
197   //if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", space.device().safe_pc(), ret);
198198
199199   /* this is a guess */
200200   audio_cpu_clear_nmi_w(space, 0, 0);
r17788r17789
208208{
209209
210210
211   //if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC   %04x: audio_result_w %02x\n", cpu_get_pc(&space.device()), data);
211   //if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC   %04x: audio_result_w %02x\n", space.device().safe_pc(), data);
212212
213213   m_audio_result = data;
214214}
trunk/src/mame/drivers/seattle.c
r17788r17789
818818   }
819819
820820   if (LOG_PCI)
821      logerror("%08X:PCI bridge read: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, result);
821      logerror("%08X:PCI bridge read: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, result);
822822   return result;
823823}
824824
r17788r17789
828828   seattle_state *state = space->machine().driver_data<seattle_state>();
829829   state->m_galileo.pci_bridge_regs[reg] = data;
830830   if (LOG_PCI)
831      logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, data);
831      logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, data);
832832}
833833
834834
r17788r17789
856856   }
857857
858858   if (LOG_PCI)
859      logerror("%08X:PCI 3dfx read: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, result);
859      logerror("%08X:PCI 3dfx read: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, result);
860860   return result;
861861}
862862
r17788r17789
879879         break;
880880   }
881881   if (LOG_PCI)
882      logerror("%08X:PCI 3dfx write: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, data);
882      logerror("%08X:PCI 3dfx write: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, data);
883883}
884884
885885
r17788r17789
907907   }
908908
909909   if (LOG_PCI)
910      logerror("%08X:PCI IDE read: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, result);
910      logerror("%08X:PCI IDE read: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, result);
911911   return result;
912912}
913913
r17788r17789
917917   seattle_state *state = space->machine().driver_data<seattle_state>();
918918   state->m_galileo.pci_ide_regs[reg] = data;
919919   if (LOG_PCI)
920      logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", cpu_get_pc(&space->device()), reg, type, data);
920      logerror("%08X:PCI bridge write: reg %d type %d = %08X\n", space->device().safe_pc(), reg, type, data);
921921}
922922
923923
r17788r17789
11531153         device_eat_cycles(&space.device(), 100);
11541154
11551155         if (LOG_TIMERS)
1156            logerror("%08X:hires_timer_r = %08X\n", cpu_get_pc(&space.device()), result);
1156            logerror("%08X:hires_timer_r = %08X\n", space.device().safe_pc(), result);
11571157         break;
11581158      }
11591159
r17788r17789
11861186         else
11871187         {
11881188            result = ~0;
1189            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);
1189            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);
11901190         }
11911191         break;
11921192      }
r17788r17789
11961196      case GREG_INT_MASK:
11971197      case GREG_TIMER_CONTROL:
11981198//          if (LOG_GALILEO)
1199//              logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space.device()), offset*4, result);
1199//              logerror("%08X:Galileo read from offset %03X = %08X\n", space.device().safe_pc(), offset*4, result);
12001200         break;
12011201
12021202      default:
1203         logerror("%08X:Galileo read from offset %03X = %08X\n", cpu_get_pc(&space.device()), offset*4, result);
1203         logerror("%08X:Galileo read from offset %03X = %08X\n", space.device().safe_pc(), offset*4, result);
12041204         break;
12051205   }
12061206
r17788r17789
12251225         int which = offset % 4;
12261226
12271227         if (LOG_DMA)
1228            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask);
1228            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask);
12291229
12301230         /* keep the read only activity bit */
12311231         galileo.reg[offset] &= ~0x4000;
r17788r17789
12551255         if (!timer->active)
12561256            timer->count = data;
12571257         if (LOG_TIMERS)
1258            logerror("%08X:timer/counter %d count = %08X [start=%08X]\n", cpu_get_pc(&space.device()), offset % 4, data, timer->count);
1258            logerror("%08X:timer/counter %d count = %08X [start=%08X]\n", space.device().safe_pc(), offset % 4, data, timer->count);
12591259         break;
12601260      }
12611261
r17788r17789
12641264         int which, mask;
12651265
12661266         if (LOG_TIMERS)
1267            logerror("%08X:timer/counter control = %08X\n", cpu_get_pc(&space.device()), data);
1267            logerror("%08X:timer/counter control = %08X\n", space.device().safe_pc(), data);
12681268         for (which = 0, mask = 0x01; which < 4; which++, mask <<= 2)
12691269         {
12701270            galileo_timer *timer = &galileo.timer[which];
r17788r17789
13231323
13241324         /* anything else, just log */
13251325         else
1326            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);
1326            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);
13271327         break;
13281328      }
13291329
r17788r17789
13341334      case GREG_CONFIG_ADDRESS:
13351335      case GREG_INT_MASK:
13361336         if (LOG_GALILEO)
1337            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask);
1337            logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask);
13381338         break;
13391339
13401340      default:
1341         logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", cpu_get_pc(&space.device()), offset*4, data, mem_mask);
1341         logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask);
13421342         break;
13431343   }
13441344}
r17788r17789
13721372
13731373   /* spin until we send the magic trigger */
13741374   device_spin_until_trigger(&space.device(), 45678);
1375   if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo (already stalled)\n", cpu_get_pc(&space.device()));
1375   if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo (already stalled)\n", space.device().safe_pc());
13761376}
13771377
13781378
r17788r17789
13921392      }
13931393      else
13941394      {
1395         if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo\n", cpu_get_pc(device->machine().device("maincpu")));
1395         if (LOG_DMA) logerror("%08X:Stalling CPU on voodoo\n", device->machine().device("maincpu")->safe_pc());
13961396         device_spin_until_trigger(device->machine().device("maincpu"), 45678);
13971397      }
13981398   }
r17788r17789
14511451   static const char *const portnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5", "AN6", "AN7" };
14521452
14531453   if (data < 8 || data > 15)
1454      logerror("%08X:Unexpected analog port select = %08X\n", cpu_get_pc(&space.device()), data);
1454      logerror("%08X:Unexpected analog port select = %08X\n", space.device().safe_pc(), data);
14551455   m_pending_analog_read = ioport(portnames[data & 7])->read();
14561456}
14571457
trunk/src/mame/drivers/galastrm.c
r17788r17789
140140            coin_counter_w(machine(), 1, data & 0x04000000);
141141            m_coin_word = (data >> 16) &0xffff;
142142         }
143//logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&device()),offset);
143//logerror("CPU #0 PC %06x: write input %06x\n",device->safe_pc(),offset);
144144      }
145145   }
146146}
trunk/src/mame/drivers/tetrisp2.c
r17788r17789
189189
190190         memcpy(machine().root_device().memregion("oki")->base(), rom + (m_bank_lo * 0x80000), 0x20000);
191191
192//          logerror("PC:%06X sound bank_lo = %02X\n",cpu_get_pc(&space.device()),m_bank_lo);
192//          logerror("PC:%06X sound bank_lo = %02X\n",space.device().safe_pc(),m_bank_lo);
193193      }
194194      else
195195      {
r17788r17789
197197
198198         memcpy(machine().root_device().memregion("oki")->base() + 0x20000, rom + (m_bank_lo * 0x80000) + (m_bank_hi * 0x20000), 0x20000);
199199
200//          logerror("PC:%06X sound bank_hi = %02X\n",cpu_get_pc(&space.device()),m_bank_hi);
200//          logerror("PC:%06X sound bank_hi = %02X\n",space.device().safe_pc(),m_bank_hi);
201201      }
202202   }
203203}
trunk/src/mame/drivers/alpha68k.c
r17788r17789
216216
217217WRITE16_MEMBER(alpha68k_state::tnextspc_unknown_w)
218218{
219   logerror("tnextspc_unknown_w : PC = %04x - offset = %04x - data = %04x\n", cpu_get_pc(&space.device()), offset, data);
219   logerror("tnextspc_unknown_w : PC = %04x - offset = %04x - data = %04x\n", space.device().safe_pc(), offset, data);
220220   if (offset == 0)
221221      alpha68k_flipscreen_w(machine(), data & 0x100);
222222}
223223
224224WRITE16_MEMBER(alpha68k_state::alpha_microcontroller_w)
225225{
226   logerror("%04x:  Alpha write trigger at %04x (%04x)\n", cpu_get_pc(&space.device()), offset, data);
226   logerror("%04x:  Alpha write trigger at %04x (%04x)\n", space.device().safe_pc(), offset, data);
227227   /* 0x44 = coin clear signal to microcontroller? */
228228   if (offset == 0x2d && ACCESSING_BITS_0_7)
229229      alpha68k_flipscreen_w(machine(), data & 1);
r17788r17789
404404      break;
405405   }
406406
407   logerror("%04x:  Alpha read trigger at %04x\n", cpu_get_pc(&space.device()), offset);
407   logerror("%04x:  Alpha read trigger at %04x\n", space.device().safe_pc(), offset);
408408
409409   return 0; /* Values returned don't matter */
410410}
r17788r17789
498498         break;
499499   }
500500
501   logerror("%04x:  Alpha read trigger at %04x\n", cpu_get_pc(&space.device()), offset);
501   logerror("%04x:  Alpha read trigger at %04x\n", space.device().safe_pc(), offset);
502502
503503   return 0; /* Values returned don't matter */
504504}
r17788r17789
643643         break;
644644   }
645645
646   logerror("%04x:  Alpha read trigger at %04x\n", cpu_get_pc(&space.device()), offset);
646   logerror("%04x:  Alpha read trigger at %04x\n", space.device().safe_pc(), offset);
647647
648648   return 0; /* Values returned don't matter */
649649}
trunk/src/mame/drivers/tmaster.c
r17788r17789
613613WRITE16_MEMBER(tmaster_state::galgames_eeprom_w)
614614{
615615   if (data & ~0x0003)
616      logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",cpu_get_pc(&space.device()),data);
616      logerror("CPU #0 PC: %06X - Unknown EEPROM bit written %04X\n",space.device().safe_pc(),data);
617617
618618   if ( ACCESSING_BITS_0_7 )
619619   {
r17788r17789
706706         default:
707707            machine().device<eeprom_device>(galgames_eeprom_names[0])->set_cs_line(CLEAR_LINE);
708708            galgames_update_rombank(machine(), 0);
709            logerror("%06x: unknown cart sel = %04x\n", cpu_get_pc(&space.device()), data);
709            logerror("%06x: unknown cart sel = %04x\n", space.device().safe_pc(), data);
710710            break;
711711      }
712712   }
r17788r17789
728728      {
729729         membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_RAM);   // ram
730730         galgames_update_rombank(machine(), m_galgames_cart);
731         logerror("%06x: romram bank = %04x\n", cpu_get_pc(&space.device()), data);
731         logerror("%06x: romram bank = %04x\n", space.device().safe_pc(), data);
732732      }
733733      else
734734      {
735735         membank(GALGAMES_BANK_000000_R)->set_entry(GALGAMES_ROM0);   // rom
736736         membank(GALGAMES_BANK_200000_R)->set_entry(GALGAMES_RAM);   // ram
737         logerror("%06x: unknown romram bank = %04x\n", cpu_get_pc(&space.device()), data);
737         logerror("%06x: unknown romram bank = %04x\n", space.device().safe_pc(), data);
738738      }
739739   }
740740}
trunk/src/mame/drivers/namcos22.c
r17788r17789
16191619            break;
16201620
16211621         default:
1622            logerror( "%08x: master port#7: 0x%04x\n", cpu_get_previouspc(&space.device()), data );
1622            logerror( "%08x: master port#7: 0x%04x\n", space.device().safe_pcbase(), data );
16231623            break;
16241624      }
16251625      break;
r17788r17789
23782378   // this chip is also used for reading random values in some games
23792379   // for example in timecris to determine where certain enemies will emerge
23802380   // but it is not yet understood how this works
2381//  printf("Hit keycus mask %x PC=%x\n", mem_mask, cpu_get_pc(&space.device()));
2381//  printf("Hit keycus mask %x PC=%x\n", mem_mask, space.device().safe_pc());
23822382
23832383   if (ACCESSING_BITS_0_15)
23842384      return m_keycus_id;
r17788r17789
54095409// for MCU BIOS v1.41
54105410READ16_MEMBER(namcos22_state::mcu141_speedup_r)
54115411{
5412   if ((cpu_get_pc(&space.device()) == 0xc12d) && (!(m_su_82 & 0xff00)))
5412   if ((space.device().safe_pc() == 0xc12d) && (!(m_su_82 & 0xff00)))
54135413   {
54145414      device_spin_until_interrupt(&space.device());
54155415   }
r17788r17789
54255425// for MCU BIOS v1.30
54265426READ16_MEMBER(namcos22_state::mcu130_speedup_r)
54275427{
5428   if ((cpu_get_pc(&space.device()) == 0xc12a) && (!(m_su_82 & 0xff00)))
5428   if ((space.device().safe_pc() == 0xc12a) && (!(m_su_82 & 0xff00)))
54295429   {
54305430      device_spin_until_interrupt(&space.device());
54315431   }
r17788r17789
54365436// for NSTX7702 v1.00 (C74)
54375437READ16_MEMBER(namcos22_state::mcuc74_speedup_r)
54385438{
5439   if (((cpu_get_pc(&space.device()) == 0xc0df) || (cpu_get_pc(&space.device()) == 0xc101)) && (!(m_su_82 & 0xff00)))
5439   if (((space.device().safe_pc() == 0xc0df) || (space.device().safe_pc() == 0xc101)) && (!(m_su_82 & 0xff00)))
54405440   {
54415441      device_spin_until_interrupt(&space.device());
54425442   }
trunk/src/mame/drivers/pluto5.c
r17788r17789
202202
203203READ32_MEMBER(pluto5_state::pluto5_mem_r)
204204{
205   int pc = cpu_get_pc(&space.device());
205   int pc = space.device().safe_pc();
206206   int cs = m68340_get_cs(m_maincpu, offset * 4);
207207
208208   switch ( cs )
r17788r17789
220220
221221WRITE32_MEMBER(pluto5_state::pluto5_mem_w)
222222{
223   int pc = cpu_get_pc(&space.device());
223   int pc = space.device().safe_pc();
224224   int cs = m68340_get_cs(m_maincpu, offset * 4);
225225
226226   switch ( cs )
trunk/src/mame/drivers/galaxold.c
r17788r17789
397397/* Send sound data to the sound cpu and cause an nmi */
398398READ8_MEMBER(galaxold_state::drivfrcg_port0_r)
399399{
400   switch (cpu_get_pc(&space.device()))
400   switch (space.device().safe_pc())
401401   {
402402      case 0x002e:
403403      case 0x0297:
r17788r17789
895895
896896READ8_MEMBER(galaxold_state::hexpoola_data_port_r)
897897{
898   switch (cpu_get_pc(&space.device()))
898   switch (space.device().safe_pc())
899899   {
900900      case 0x0022:
901901         return 0;
r17788r17789
916916
917917READ8_MEMBER(galaxold_state::bullsdrtg_data_port_r)
918918{
919   switch (cpu_get_pc(&space.device()))
919   switch (space.device().safe_pc())
920920   {
921921      case 0x0083:
922922      case 0x008c:
r17788r17789
928928      case 0x6b58:
929929         return 1;
930930      default:
931         logerror("Reading data port at PC=%04X\n", cpu_get_pc(&space.device()));
931         logerror("Reading data port at PC=%04X\n", space.device().safe_pc());
932932         break;
933933   }
934934
trunk/src/mame/drivers/ssv.c
r17788r17789
526526   if (input_sel & 0x0002)   return ioport("KEY1")->read();
527527   if (input_sel & 0x0004)   return ioport("KEY2")->read();
528528   if (input_sel & 0x0008)   return ioport("KEY3")->read();
529   logerror("CPU #0 PC %06X: unknown input read: %04X\n",cpu_get_pc(&space.device()),input_sel);
529   logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel);
530530   return 0xffff;
531531}
532532
r17788r17789
651651   if (input_sel & 0x0004)   return ioport("KEY1")->read();
652652   if (input_sel & 0x0008)   return ioport("KEY2")->read();
653653   if (input_sel & 0x0010)   return ioport("KEY3")->read();
654   logerror("CPU #0 PC %06X: unknown input read: %04X\n",cpu_get_pc(&space.device()),input_sel);
654   logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel);
655655   return 0xffff;
656656}
657657
r17788r17789
699699   if (input_sel & 0x0004)   return ioport("KEY1")->read();
700700   if (input_sel & 0x0008)   return ioport("KEY2")->read();
701701   if (input_sel & 0x0010)   return ioport("KEY3")->read();
702   logerror("CPU #0 PC %06X: unknown input read: %04X\n",cpu_get_pc(&space.device()),input_sel);
702   logerror("CPU #0 PC %06X: unknown input read: %04X\n",space.device().safe_pc(),input_sel);
703703   return 0xffff;
704704}
705705
trunk/src/mame/drivers/dec0.c
r17788r17789
200200         break;
201201
202202      case 0xa: /* Mix Psel(?). */
203         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1));
203         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1));
204204         break;
205205
206206      case 0xc: /* Cblk - coin blockout.  Seems to be unused by the games */
r17788r17789
208208
209209      case 0xe: /* Reset Intel 8751? - not sure, all the games write here at startup */
210210         dec0_i8751_reset(machine());
211         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1));
211         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1));
212212         break;
213213
214214      default:
215         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1));
215         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1));
216216         break;
217217   }
218218}
r17788r17789
238238         break;
239239
240240      case 0xa: /* Mix Psel(?). */
241         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1));
241         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1));
242242         break;
243243
244244      case 0xc: /* Cblk - coin blockout.  Seems to be unused by the games */
r17788r17789
246246#endif
247247
248248      default:
249         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+(offset<<1));
249         logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",space.device().safe_pc(),data,0x30c010+(offset<<1));
250250         break;
251251   }
252252}
r17788r17789
358358      case 6:      return 0x2;
359359   }
360360
361   logerror("%04x, Unknown protection read at 30c000 %d\n", cpu_get_pc(&space.device()), offset);
361   logerror("%04x, Unknown protection read at 30c000 %d\n", space.device().safe_pc(), offset);
362362   return 0;
363363}
364364
trunk/src/mame/drivers/midvunit.c
r17788r17789
253253      /* timer is clocked at 100ns */
254254      int which = (offset >> 4) & 1;
255255      INT32 result = (m_timer[which]->time_elapsed() * m_timer_rate).as_double();
256//      logerror("%06X:tms32031_control_r(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, result);
256//      logerror("%06X:tms32031_control_r(%02X) = %08X\n", space.device().safe_pc(), offset, result);
257257      return result;
258258   }
259259
260260   /* log anything else except the memory control register */
261261   if (offset != 0x64)
262      logerror("%06X:tms32031_control_r(%02X)\n", cpu_get_pc(&space.device()), offset);
262      logerror("%06X:tms32031_control_r(%02X)\n", space.device().safe_pc(), offset);
263263
264264   return m_tms32031_control[offset];
265265}
r17788r17789
277277   else if (offset == 0x20 || offset == 0x30)
278278   {
279279      int which = (offset >> 4) & 1;
280//  logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data);
280//  logerror("%06X:tms32031_control_w(%02X) = %08X\n", space.device().safe_pc(), offset, data);
281281      if (data & 0x40)
282282         m_timer[which]->reset();
283283
r17788r17789
288288         m_timer_rate = 10000000.;
289289   }
290290   else
291      logerror("%06X:tms32031_control_w(%02X) = %08X\n", cpu_get_pc(&space.device()), offset, data);
291      logerror("%06X:tms32031_control_w(%02X) = %08X\n", space.device().safe_pc(), offset, data);
292292}
293293
294294
r17788r17789
409409   }
410410
411411   if (offset != 0 && offset != 3)
412      logerror("%06X:midvplus_misc_r(%d) = %08X\n", cpu_get_pc(&space.device()), offset, result);
412      logerror("%06X:midvplus_misc_r(%d) = %08X\n", space.device().safe_pc(), offset, result);
413413   return result;
414414}
415415
r17788r17789
438438   }
439439
440440   if (logit)
441      logerror("%06X:midvplus_misc_w(%d) = %08X\n", cpu_get_pc(&space.device()), offset, data);
441      logerror("%06X:midvplus_misc_w(%d) = %08X\n", space.device().safe_pc(), offset, data);
442442}
443443
444444
trunk/src/mame/drivers/opwolf.c
r17788r17789
501501      msm5205_reset_w(device, 0);
502502   }
503503
504//  logerror("CPU #1     b00%i-data=%2x   pc=%4x\n",offset,data,cpu_get_pc(&space->device()) );
504//  logerror("CPU #1     b00%i-data=%2x   pc=%4x\n",offset,data,space->device().safe_pc() );
505505}
506506
507507
r17788r17789
524524      msm5205_reset_w(device, 0);
525525   }
526526
527//  logerror("CPU #1     c00%i-data=%2x   pc=%4x\n",offset,data,cpu_get_pc(&space->device()) );
527//  logerror("CPU #1     c00%i-data=%2x   pc=%4x\n",offset,data,space->device().safe_pc() );
528528}
529529
530530
531531WRITE8_MEMBER(opwolf_state::opwolf_adpcm_d_w)
532532{
533//   logerror("CPU #1         d00%i-data=%2x   pc=%4x\n",offset,data,cpu_get_pc(&space.device()) );
533//   logerror("CPU #1         d00%i-data=%2x   pc=%4x\n",offset,data,space.device().safe_pc() );
534534}
535535
536536WRITE8_MEMBER(opwolf_state::opwolf_adpcm_e_w)
537537{
538//  logerror("CPU #1         e00%i-data=%2x   pc=%4x\n",offset,data,cpu_get_pc(&space.device()) );
538//  logerror("CPU #1         e00%i-data=%2x   pc=%4x\n",offset,data,space.device().safe_pc() );
539539}
540540
541541static ADDRESS_MAP_START( opwolf_sound_z80_map, AS_PROGRAM, 8, opwolf_state )
trunk/src/mame/drivers/suna16.c
r17788r17789
4444   {
4545      soundlatch_byte_w(space, 0, data & 0xff );
4646   }
47   if (data & ~0xff)   logerror("CPU#0 PC %06X - Sound latch unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
47   if (data & ~0xff)   logerror("CPU#0 PC %06X - Sound latch unknown bits: %04X\n", space.device().safe_pc(), data);
4848}
4949
5050
r17788r17789
5858      set_led_status(machine(), 3, data & 0x08);
5959      coin_counter_w(machine(), 0, data & 0x10);
6060   }
61   if (data & ~0x1f)   logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
61   if (data & ~0x1f)   logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", space.device().safe_pc(), data);
6262}
6363
6464
r17788r17789
7070      set_led_status(machine(), 0, data & 0x02);
7171      set_led_status(machine(), 1, data & 0x04);
7272   }
73   if (data & ~0x07)   logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
73   if (data & ~0x07)   logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", space.device().safe_pc(), data);
7474}
7575
7676
r17788r17789
8080   {
8181      coin_counter_w(machine(), 0, data & 0x04);
8282   }
83   if (data & ~0x04)   logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", cpu_get_pc(&space.device()), data);
83   if (data & ~0x04)   logerror("CPU#0 PC %06X - Leds unknown bits: %04X\n", space.device().safe_pc(), data);
8484}
8585
8686
r17788r17789
161161         case 0x00:   m_prot = m_prot ^ 0x0009;   break;
162162         case 0x08:   m_prot = m_prot ^ 0x0002;   break;
163163         case 0x0c:   m_prot = m_prot ^ 0x0003;   break;
164         //default:    logerror("CPU#0 PC %06X - Unknown protection value: %04X\n", cpu_get_pc(&space.device()), data);
164         //default:    logerror("CPU#0 PC %06X - Unknown protection value: %04X\n", space.device().safe_pc(), data);
165165      }
166166   }
167167}
r17788r17789
262262{
263263   UINT8 *RAM = memregion("pcm1")->base();
264264   int bank = data & 7;
265   if (bank & ~7)   logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data);
265   if (bank & ~7)   logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data);
266266   membank("bank1")->set_base(&RAM[bank * 0x10000 + 0x1000]);
267267}
268268
r17788r17789
270270{
271271   UINT8 *RAM = memregion("pcm2")->base();
272272   int bank = data & 7;
273   if (bank & ~7)   logerror("CPU#3 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data);
273   if (bank & ~7)   logerror("CPU#3 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data);
274274   membank("bank2")->set_base(&RAM[bank * 0x10000 + 0x1000]);
275275}
276276
r17788r17789
340340{
341341   UINT8 *RAM = memregion("pcm1")->base();
342342   int bank = data & 1;
343   if (bank & ~1)   logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", cpu_get_pc(&space.device()), data);
343   if (bank & ~1)   logerror("CPU#2 PC %06X - ROM bank unknown bits: %02X\n", space.device().safe_pc(), data);
344344   membank("bank1")->set_base(&RAM[bank * 0x10000 + 0x400]);
345345}
346346
trunk/src/mame/drivers/bigevglf.c
r17788r17789
8181}
8282WRITE8_MEMBER(bigevglf_state::beg_fromsound_w)/* write to D800 sets bit 1 in status */
8383{
84   machine().scheduler().synchronize(FUNC(from_sound_latch_callback), (cpu_get_pc(&space.device()) << 16) | data);
84   machine().scheduler().synchronize(FUNC(from_sound_latch_callback), (space.device().safe_pc() << 16) | data);
8585}
8686
8787READ8_MEMBER(bigevglf_state::beg_fromsound_r)
trunk/src/mame/drivers/cbuster.c
r17788r17789
7575
7676      break;
7777   }
78   logerror("Warning %04x- %02x written to control %02x\n", cpu_get_pc(&space.device()), data, offset);
78   logerror("Warning %04x- %02x written to control %02x\n", space.device().safe_pc(), data, offset);
7979}
8080
8181READ16_MEMBER(cbuster_state::twocrude_control_r)
r17788r17789
9090         return ioport("DSW")->read();
9191
9292      case 4: /* Protection */
93         logerror("%04x : protection control read at 30c000 %d\n", cpu_get_pc(&space.device()), offset);
93         logerror("%04x : protection control read at 30c000 %d\n", space.device().safe_pc(), offset);
9494         return m_prot;
9595
9696      case 6: /* Credits, VBL in byte 7 */
trunk/src/mame/drivers/ghosteo.c
r17788r17789
559559   UINT32 ret = s3c2410_lcd_r(s3c2410, offset+0x10/4, mem_mask);
560560
561561
562   int pc = cpu_get_pc(&space.device());
562   int pc = space.device().safe_pc();
563563
564564   // these are vblank waits
565565   if (pc == 0x3001c0e4 || pc == 0x3001c0d8)
trunk/src/mame/drivers/dunhuang.c
r17788r17789
269269WRITE8_MEMBER(dunhuang_state::dunhuang_horiz_clear_w)
270270{
271271   int i;
272//  logerror("%06x: horiz clear, y = %02x, data = %02d\n", cpu_get_pc(&space.device()), m_clear_y,data);
272//  logerror("%06x: horiz clear, y = %02x, data = %02d\n", space.device().safe_pc(), m_clear_y,data);
273273   for (i = 0; i < 0x40; i++)
274274   {
275275      int addr = m_clear_y * 0x40 + i;
r17788r17789
285285WRITE8_MEMBER(dunhuang_state::dunhuang_vert_clear_w)
286286{
287287   int i;
288//  logerror("%06x: vert clear, x = %02x, y = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_pos_x,m_pos_y,data);
288//  logerror("%06x: vert clear, x = %02x, y = %02x, data = %02x\n", space.device().safe_pc(), m_pos_x,m_pos_y,data);
289289   for (i = 0; i < 0x08; i++)
290290   {
291291      int addr = (m_pos_x & 0x3f) + (i & 0x07) * 0x40;
r17788r17789
343343   int i,j, addr;
344344   UINT8 *tile_addr;
345345
346//  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);
346//  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);
347347
348348   m_block_h = data;
349349
r17788r17789
382382         break;
383383
384384      default:
385         popmessage("%06x: block dst=%x", cpu_get_pc(&space.device()), m_block_dest);
385         popmessage("%06x: block dst=%x", space.device().safe_pc(), m_block_dest);
386386   }
387387}
388388
trunk/src/mame/drivers/ojankohs.c
r17788r17789
127127               ret &= ioport("KEY4")->read();
128128               break;
129129      default:   ret = 0xff;
130               logerror("PC:%04X unknown %02X\n", cpu_get_pc(&space.device()), m_portselect);
130               logerror("PC:%04X unknown %02X\n", space.device().safe_pc(), m_portselect);
131131               break;
132132   }
133133
trunk/src/mame/drivers/spdodgeb.c
r17788r17789
211211
212212READ8_MEMBER(spdodgeb_state::mcu63701_r)
213213{
214//  logerror("CPU #0 PC %04x: read from port %02x of 63701 data address 3801\n",cpu_get_pc(&space.device()),offset);
214//  logerror("CPU #0 PC %04x: read from port %02x of 63701 data address 3801\n",space.device().safe_pc(),offset);
215215
216216   if (m_mcu63701_command == 0) return 0x6a;
217217   else switch (offset)
r17788r17789
227227
228228WRITE8_MEMBER(spdodgeb_state::mcu63701_w)
229229{
230//  logerror("CPU #0 PC %04x: write %02x to 63701 control address 3800\n",cpu_get_pc(&space.device()),data);
230//  logerror("CPU #0 PC %04x: write %02x to 63701 control address 3800\n",space.device().safe_pc(),data);
231231   m_mcu63701_command = data;
232232   mcu63705_update_inputs(machine());
233233}
trunk/src/mame/drivers/cvs.c
r17788r17789
267267   case 0x04:  ret = ioport("IN3")->read(); break;
268268   case 0x06:  ret = ioport("DSW3")->read(); break;
269269   case 0x07:  ret = ioport("DSW2")->read(); break;
270   default:    logerror("%04x : CVS: Reading unmapped input port 0x%02x\n", cpu_get_pc(&space.device()), offset & 0x0f); break;
270   default:    logerror("%04x : CVS: Reading unmapped input port 0x%02x\n", space.device().safe_pc(), offset & 0x0f); break;
271271   }
272272
273273   return ret;
r17788r17789
375375
376376   /* assuming that d0-d2 are cleared here */
377377   m_speech_rom_bit_address = (m_speech_rom_bit_address & 0xf800) | (data << 3);
378   LOG(("%04x : CVS: Speech Lo %02x Address = %04x\n", cpu_get_pc(&space.device()), data, m_speech_rom_bit_address >> 3));
378   LOG(("%04x : CVS: Speech Lo %02x Address = %04x\n", space.device().safe_pc(), data, m_speech_rom_bit_address >> 3));
379379}
380380
381381WRITE8_MEMBER(cvs_state::cvs_speech_rom_address_hi_w)
382382{
383383   m_speech_rom_bit_address = (m_speech_rom_bit_address & 0x07ff) | (data << 11);
384   LOG(("%04x : CVS: Speech Hi %02x Address = %04x\n", cpu_get_pc(&space.device()), data, m_speech_rom_bit_address >> 3));
384   LOG(("%04x : CVS: Speech Hi %02x Address = %04x\n", space.device().safe_pc(), data, m_speech_rom_bit_address >> 3));
385385}
386386
387387
trunk/src/mame/drivers/plygonet.c
r17788r17789
200200   if (mem_mask == 0x0000ff00)   { value <<= 8;  }
201201   if (mem_mask == 0xff000000) { value <<= 24; }
202202
203   logerror("Dsp HI Read (host-side) %08x (HI %04x) = %08x (@%x)\n", mem_mask, hi_addr, value, cpu_get_pc(&space.device()));
203   logerror("Dsp HI Read (host-side) %08x (HI %04x) = %08x (@%x)\n", mem_mask, hi_addr, value, space.device().safe_pc());
204204
205205   return value;
206206}
r17788r17789
214214   {
215215      logerror("68k WRITING %04x to shared ram %x (@%x)\n", (m_shared_ram[offset] & 0xffff0000) >> 16,
216216                                                0xc000 + (offset<<1),
217                                                cpu_get_pc(&space.device()));
217                                                space.device().safe_pc());
218218   }
219219   else if (mem_mask == 0x0000ffff)
220220   {
221221      logerror("68k WRITING %04x to shared ram %x (@%x)\n", (m_shared_ram[offset] & 0x0000ffff),
222222                                                0xc000 +((offset<<1)+1),
223                                                cpu_get_pc(&space.device()));
223                                                space.device().safe_pc());
224224   }
225225   else
226226   {
r17788r17789
229229                                                              0xc000 + (offset<<1),
230230                                                              0xc000 +((offset<<1)+1),
231231                                                              mem_mask,
232                                                              cpu_get_pc(&space.device()));
232                                                              space.device().safe_pc());
233233   }
234234
235235   /* write to the current dsp56k word */
trunk/src/mame/drivers/jackie.c
r17788r17789
350350   UINT8 *rom = memregion("gfx3")->base();
351351
352352   offset += m_exp_bank * 0x8000;
353//  logerror("PC %06X: %04x = %02x\n",cpu_get_pc(&space.device()),offset,rom[offset]);
353//  logerror("PC %06X: %04x = %02x\n",space.device().safe_pc(),offset,rom[offset]);
354354   return rom[offset];
355355}
356356
trunk/src/mame/drivers/goal92.c
r17788r17789
4040         return ioport("DSW2")->read();
4141
4242      default:
43         logerror("reading unhandled goal92 inputs %04X %04X @ PC = %04X\n", offset, mem_mask,cpu_get_pc(&space.device()));
43         logerror("reading unhandled goal92 inputs %04X %04X @ PC = %04X\n", offset, mem_mask,space.device().safe_pc());
4444   }
4545
4646   return 0;
trunk/src/mame/drivers/blockhl.c
r17788r17789
335335   /* other bits unknown */
336336
337337   if ((lines & 0x84) != 0x80)
338      logerror("%04x: setlines %02x\n", cpu_get_pc(device), lines);
338      logerror("%04x: setlines %02x\n", device->safe_pc(), lines);
339339}
340340
341341
trunk/src/mame/drivers/gcpinbal.c
r17788r17789
101101
102102   }
103103
104//logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",cpu_get_pc(&space.device()),offset);
104//logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",space.device().safe_pc(),offset);
105105
106106   return m_ioc_ram[offset];
107107}
r17788r17789
192192         break;
193193
194194      default:
195         logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", cpu_get_pc(&space.device()), offset, data);
195         logerror("CPU #0 PC %06x: warning - write ioc offset %06x with %04x\n", space.device().safe_pc(), offset, data);
196196         break;
197197   }
198198
trunk/src/mame/drivers/segag80v.c
r17788r17789
190190   segag80v_state *state = space->machine().driver_data<segag80v_state>();
191191
192192   /* ignore anything but accesses via opcode $32 (LD $(XXYY),A) */
193   offs_t pc = cpu_get_previouspc(&space->device());
193   offs_t pc = space->device().safe_pcbase();
194194   if ((UINT16)pc == 0xffff || space->read_byte(pc) != 0x32)
195195      return offset;
196196
r17788r17789
361361   /* writing an 0x04 here enables interrupts */
362362   /* some games write 0x00/0x01 here as well */
363363   if (data != 0x00 && data != 0x01 && data != 0x04)
364      mame_printf_debug("%04X:unknown_w = %02X\n", cpu_get_pc(&space.device()), data);
364      mame_printf_debug("%04X:unknown_w = %02X\n", space.device().safe_pc(), data);
365365}
366366
367367
trunk/src/mame/drivers/macs.c
r17788r17789
131131      case 5: return ioport("DSW3")->read();
132132      case 6: return ioport("DSW4")->read();
133133      case 7: return ioport("SYS1")->read();
134      default:   popmessage("Unmapped I/O read at PC = %06x offset = %02x",cpu_get_pc(&space.device()),offset+0xc0);
134      default:   popmessage("Unmapped I/O read at PC = %06x offset = %02x",space.device().safe_pc(),offset+0xc0);
135135   }
136136
137137   return 0xff;
trunk/src/mame/drivers/8080bw.c
r17788r17789
17311731
17321732READ8_MEMBER(_8080bw_state::indianbt_r)
17331733{
1734   switch(cpu_get_pc(&space.device()))
1734   switch(space.device().safe_pc())
17351735   {
17361736      case 0x5fed:   return 0x10;
17371737      case 0x5ffc:   return 0;
17381738   }
1739   logerror("unknown port 0 read @ %x\n",cpu_get_pc(&space.device()));
1739   logerror("unknown port 0 read @ %x\n",space.device().safe_pc());
17401740   return machine().rand();
17411741}
17421742
trunk/src/mame/drivers/xyonix.c
r17788r17789
7474
7575READ8_MEMBER(xyonix_state::xyonix_io_r)
7676{
77   int regPC = cpu_get_pc(&space.device());
77   int regPC = space.device().safe_pc();
7878
7979   if (regPC == 0x27ba)
8080      return 0x88;
r17788r17789
126126WRITE8_MEMBER(xyonix_state::xyonix_io_w)
127127{
128128
129   //logerror ("xyonix_port_e0_w %02x - PC = %04x\n", data, cpu_get_pc(&space.device()));
129   //logerror ("xyonix_port_e0_w %02x - PC = %04x\n", data, space.device().safe_pc());
130130   m_e0_data = data;
131131}
132132
trunk/src/mame/drivers/1943.c
r17788r17789
4444    */
4545
4646   int data = cpu_get_reg(&space.device(), Z80_BC) >> 8;
47//  logerror("protection read, PC: %04x Result:%02x\n", cpu_get_pc(&space.device()), data);
47//  logerror("protection read, PC: %04x Result:%02x\n", space.device().safe_pc(), data);
4848   return data;
4949}
5050
trunk/src/mame/drivers/esripsys.c
r17788r17789
553553/* Not used in later revisions */
554554WRITE8_MEMBER(esripsys_state::control_w)
555555{
556   logerror("Sound control write: %.2x (PC:0x%.4x)\n", data, cpu_get_previouspc(&space.device()));
556   logerror("Sound control write: %.2x (PC:0x%.4x)\n", data, space.device().safe_pcbase());
557557}
558558
559559
trunk/src/mame/drivers/jalmah.c
r17788r17789
972972      memcpy(&oki[0x20000], &oki[(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000], 0x20000);
973973   }
974974
975   //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);
975   //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);
976976}
977977
978978WRITE16_MEMBER(jalmah_state::jalmah_okibank_w)
r17788r17789
986986      memcpy(&oki[0x20000], &oki[(m_oki_rom * 0x80000) + ((m_oki_bank+m_oki_za) * 0x20000) + 0x40000], 0x20000);
987987   }
988988
989   //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);
989   //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);
990990}
991991
992992WRITE16_MEMBER(jalmah_state::jalmah_flip_screen_w)
r17788r17789
17611761   res = resp[m_respcount++];
17621762   if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0;
17631763
1764//  logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),res);
1764//  logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),res);
17651765
17661766   return res;
17671767}
r17788r17789
19791979   res = resp[m_respcount++];
19801980   if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0;
19811981
1982//  logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),res);
1982//  logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),res);
19831983
19841984   return res;
19851985}
r17788r17789
22582258   res = resp[m_respcount++];
22592259   if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0;
22602260
2261//  logerror("%04x: mcu_r %02x\n",cpu_get_pc(&space.device()),res);
2261//  logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),res);
22622262
22632263   return res;
22642264}
r17788r17789
23952395   res = resp[m_respcount++];
23962396   if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0;
23972397
2398//  popmessage("%04x: mcu_r %02x",cpu_get_pc(&space.device()),res);
2398//  popmessage("%04x: mcu_r %02x",space.device().safe_pc(),res);
23992399
24002400   return res;
24012401}
r17788r17789
24162416   res = resp[m_respcount++];
24172417   if (m_respcount >= sizeof(resp)/sizeof(resp[0])) m_respcount = 0;
24182418
2419//  popmessage("%04x: mcu_r %02x",cpu_get_pc(&space.device()),res);
2419//  popmessage("%04x: mcu_r %02x",space.device().safe_pc(),res);
24202420
24212421   return res;
24222422}
trunk/src/mame/drivers/spoker.c
r17788r17789
132132
133133   if ((data) & (0x22))
134134   {
135      logerror("PC %06X: nmi_and_coins = %02x\n",cpu_get_pc(&space.device()),data);
135      logerror("PC %06X: nmi_and_coins = %02x\n",space.device().safe_pc(),data);
136136//      popmessage("%02x",data);
137137   }
138138
r17788r17789
193193
194194      default:
195195//          popmessage("magic %x <- %04x",igs_magic[0],data);
196         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0], data);
196         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", space.device().safe_pc(), m_igs_magic[0], data);
197197   }
198198}
199199
r17788r17789
208208         if ( !(m_igs_magic[1] & 0x04) )   return ioport("DSW3")->read();
209209         if ( !(m_igs_magic[1] & 0x08) )   return ioport("DSW4")->read();
210210         if ( !(m_igs_magic[1] & 0x10) )   return ioport("DSW5")->read();
211         logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[1]);
211         logerror("%06x: warning, reading dsw with igs_magic[1] = %02x\n", space.device().safe_pc(), m_igs_magic[1]);
212212         break;
213213
214214      default:
215         logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0]);
215         logerror("%06x: warning, reading with igs_magic = %02x\n", space.device().safe_pc(), m_igs_magic[0]);
216216   }
217217
218218   return 0;
trunk/src/mame/drivers/aeroboto.c
r17788r17789
3434   /* serie of values to be returned from 3004, and display "PASS 201" if it is */
3535   static const UINT8 res[4] = { 0xff, 0x9f, 0x1b, 0x03 };
3636
37   logerror("PC %04x: read 3004\n", cpu_get_pc(&space.device()));
37   logerror("PC %04x: read 3004\n", space.device().safe_pc());
3838   return res[(m_count++) & 3];
3939}
4040
trunk/src/mame/drivers/konamigv.c
r17788r17789
585585READ32_MEMBER(konamigv_state::btc_trackball_r)
586586{
587587
588//  mame_printf_debug( "r %08x %08x %08x\n", cpu_get_pc(&space.device()), offset, mem_mask );
588//  mame_printf_debug( "r %08x %08x %08x\n", space.device().safe_pc(), offset, mem_mask );
589589
590590   if( offset == 1 && mem_mask == 0xffff0000 )
591591   {
r17788r17789
608608
609609WRITE32_MEMBER(konamigv_state::btc_trackball_w)
610610{
611//  mame_printf_debug( "w %08x %08x %08x %08x\n", cpu_get_pc(&space.device()), offset, data, mem_mask );
611//  mame_printf_debug( "w %08x %08x %08x %08x\n", space.device().safe_pc(), offset, data, mem_mask );
612612}
613613
614614DRIVER_INIT_MEMBER(konamigv_state,btchamp)
trunk/src/mame/drivers/firetrap.c
r17788r17789
194194   UINT8 coin = 0;
195195   UINT8 port = ioport("IN2")->read() & 0x70;
196196
197   if (cpu_get_pc(&space.device()) == 0x1188)
197   if (space.device().safe_pc() == 0x1188)
198198      return ~m_coin_command_pending;
199199
200200   if (port != 0x70)
r17788r17789
214214
215215READ8_MEMBER(firetrap_state::firetrap_8751_r)
216216{
217   //logerror("PC:%04x read from 8751\n",cpu_get_pc(&space.device()));
217   //logerror("PC:%04x read from 8751\n",space.device().safe_pc());
218218   return m_i8751_return;
219219}
220220
r17788r17789
293293   else
294294   {
295295      m_i8751_return = 0xff;
296      logerror("%04x: Unknown i8751 command %02x!\n",cpu_get_pc(&space.device()),data);
296      logerror("%04x: Unknown i8751 command %02x!\n",space.device().safe_pc(),data);
297297   }
298298
299299   /* Signal main cpu task is complete */
trunk/src/mame/drivers/thedeep.c
r17788r17789
125125      break;
126126
127127      default:
128         logerror( "pc %04x: protection_command %02x\n", cpu_get_pc(&space.device()),m_protection_command);
128         logerror( "pc %04x: protection_command %02x\n", space.device().safe_pc(),m_protection_command);
129129   }
130130}
131131
r17788r17789
143143WRITE8_MEMBER(thedeep_state::thedeep_e100_w)
144144{
145145   if (data != 1)
146      logerror("pc %04x: e100 = %02x\n", cpu_get_pc(&space.device()),data);
146      logerror("pc %04x: e100 = %02x\n", space.device().safe_pc(),data);
147147}
148148
149149static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, thedeep_state )
trunk/src/mame/drivers/ksys573.c
r17788r17789
873873         break;
874874      }
875875
876//      mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(&space.device()));
876//      mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, space.device().safe_pc());
877877
878878      data <<= shift;
879879   }
r17788r17789
10311031      }
10321032
10331033      atapi_regs[reg] = data;
1034//      mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, cpu_get_pc(&space.device()));
1034//      mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, space.device().safe_pc());
10351035
10361036      if (reg == ATAPI_REG_CMDSTATUS)
10371037      {
1038//          mame_printf_debug("ATAPI command %x issued! (PC=%x)\n", data, cpu_get_pc(&space.device()));
1038//          mame_printf_debug("ATAPI command %x issued! (PC=%x)\n", data, space.device().safe_pc());
10391039
10401040         switch (data)
10411041         {
r17788r17789
12461246
12471247   if( m_flash_bank < 0 )
12481248   {
1249      mame_printf_debug( "%08x: flash_r( %08x, %08x ) no bank selected %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, m_control );
1249      mame_printf_debug( "%08x: flash_r( %08x, %08x ) no bank selected %08x\n", space.device().safe_pc(), offset, mem_mask, m_control );
12501250      data = 0xffffffff;
12511251   }
12521252   else
r17788r17789
12841284
12851285   if( m_flash_bank < 0 )
12861286   {
1287      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 );
1287      mame_printf_debug( "%08x: flash_w( %08x, %08x, %08x ) no bank selected %08x\n", space.device().safe_pc(), offset, mem_mask, data, m_control );
12881288   }
12891289   else
12901290   {
r17788r17789
20132013   }
20142014
20152015   verboselog( machine(), 2, "gx894pwbba_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
2016//  printf( "%08x: gx894pwbba_r( %08x, %08x ) %08x\n", cpu_get_pc(&space.device()), offset, mem_mask, data );
2016//  printf( "%08x: gx894pwbba_r( %08x, %08x ) %08x\n", space.device().safe_pc(), offset, mem_mask, data );
20172017   return data;
20182018}
20192019
trunk/src/mame/drivers/mcr68.c
r17788r17789
228228      m_protection_data[3] = m_protection_data[4];
229229      m_protection_data[4] = data & 0xff;
230230
231      logerror("%06X:protection_w=%02X\n", cpu_get_previouspc(&space.device()), data & 0xff);
231      logerror("%06X:protection_w=%02X\n", space.device().safe_pcbase(), data & 0xff);
232232   }
233233}
234234
trunk/src/mame/drivers/pbaction.c
r17788r17789
472472{
473473
474474   /* on startup, the game expect this location to NOT act as RAM */
475   if (cpu_get_pc(&space.device()) == 0xab80)
475   if (space.device().safe_pc() == 0xab80)
476476      return 0;
477477
478478   return m_work_ram[0];
trunk/src/mame/drivers/overdriv.c
r17788r17789
6464
6565WRITE16_MEMBER(overdriv_state::eeprom_w)
6666{
67//logerror("%06x: write %04x to eeprom_w\n",cpu_get_pc(&space.device()),data);
67//logerror("%06x: write %04x to eeprom_w\n",space.device().safe_pc(),data);
6868   if (ACCESSING_BITS_0_7)
6969   {
7070      /* bit 0 is data */
r17788r17789
109109      coin_counter_w(machine(), 0, data & 0x10);
110110      coin_counter_w(machine(), 1, data & 0x20);
111111
112//logerror("%06x: write %04x to cpuA_ctrl_w\n",cpu_get_pc(&space.device()),data);
112//logerror("%06x: write %04x to cpuA_ctrl_w\n",space.device().safe_pc(),data);
113113   }
114114}
115115
trunk/src/mame/drivers/gsword.c
r17788r17789
197197   case 0x04: /* Player 2 Controller */
198198      return space->machine().root_device().ioport("IN3")->read();
199199//  default:
200//      logerror("8741-2 unknown read %d PC=%04x\n",offset,cpu_get_pc(&space->device()));
200//      logerror("8741-2 unknown read %d PC=%04x\n",offset,space->device().safe_pc());
201201   }
202202   /* unknown */
203203   return 0;
r17788r17789
215215      return space->machine().root_device().ioport("IN3")->read();
216216   }
217217   /* unknown */
218//  logerror("8741-3 unknown read %d PC=%04x\n",offset,cpu_get_pc(&space->device()));
218//  logerror("8741-3 unknown read %d PC=%04x\n",offset,space->device().safe_pc());
219219   return 0;
220220}
221221
trunk/src/mame/drivers/xmen.c
r17788r17789
4444WRITE16_MEMBER(xmen_state::eeprom_w)
4545{
4646
47   logerror("%06x: write %04x to 108000\n",cpu_get_pc(&space.device()),data);
47   logerror("%06x: write %04x to 108000\n",space.device().safe_pc(),data);
4848   if (ACCESSING_BITS_0_7)
4949   {
5050      /* bit 0 = coin counter */
trunk/src/mame/drivers/lethal.c
r17788r17789
397397               break;
398398
399399            default:
400               logerror("Unknown LE 48xx register write: %x to %x (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
400               logerror("Unknown LE 48xx register write: %x to %x (PC=%x)\n", data, offset, space.device().safe_pc());
401401               break;
402402         }
403403      }
trunk/src/mame/drivers/2mindril.c
r17788r17789
6969
7070
7171//  if (offset * 2 == 0x4)
72   /*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],
72   /*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],
7373                                        m_iodata[8/2], m_iodata[0xa/2], m_iodata[0xc/2], m_iodata[0xe/2]);*/
7474
7575   switch(offset)
r17788r17789
7878      case 0x2/2:
7979      {
8080         int arm_pwr = ioport("IN0")->read();//throw
81         //popmessage("PC=%08x %02x",cpu_get_pc(&space.device()),arm_pwr);
81         //popmessage("PC=%08x %02x",space.device().safe_pc(),arm_pwr);
8282
8383         if(arm_pwr > 0xe0) return ~0x1800;
8484         if(arm_pwr > 0xc0) return ~0x1400;
r17788r17789
8888      }
8989      case 0x4/2: return (m_defender_sensor) | (m_shutter_sensor);
9090      case 0xe/2: return ioport("IN2")->read();//coins
91//      default:  printf("PC=%08x [%04x] -> %04x R\n", cpu_get_pc(&space.device()), offset * 2, m_iodata[offset]);
91//      default:  printf("PC=%08x [%04x] -> %04x R\n", space.device().safe_pc(), offset * 2, m_iodata[offset]);
9292   }
9393
9494   return 0xffff;
r17788r17789
110110   }
111111
112112//  if(data != 0 && offset != 8)
113//  printf("PC=%08x [%04x] <- %04x W\n", cpu_get_pc(&space.device()), offset * 2, data);
113//  printf("PC=%08x [%04x] <- %04x W\n", space.device().safe_pc(), offset * 2, data);
114114}
115115
116116/*
trunk/src/mame/drivers/naughtyb.c
r17788r17789
156156      return seed00[m_prot_count] | seedxx;
157157
158158#if 0
159   if ( cpu_get_pc(&space.device()) == (0x26F2 + 0x03) )
159   if ( space.device().safe_pc() == (0x26F2 + 0x03) )
160160   {
161161      popflame_prot_count = 0;
162162      return 0x01;
163163   } /* Must not carry when rotated left */
164164
165   if ( cpu_get_pc(&space.device()) == (0x26F9 + 0x03) )
165   if ( space.device().safe_pc() == (0x26F9 + 0x03) )
166166      return 0x80; /* Must carry when rotated left */
167167
168   if ( cpu_get_pc(&space.device()) == (0x270F + 0x03) )
168   if ( space.device().safe_pc() == (0x270F + 0x03) )
169169   {
170170      switch( popflame_prot_count++ )
171171      {
r17788r17789
175175         case 3: return 0x38; /* x011 1xxx, matches 0x07 at $2693, stored in $400D */
176176      }
177177   }
178   logerror("CPU #0 PC %06x: unmapped protection read\n", cpu_get_pc(&space.device()));
178   logerror("CPU #0 PC %06x: unmapped protection read\n", space.device().safe_pc());
179179   return 0x00;
180180#endif
181181}
trunk/src/mame/drivers/taito_z.c
r17788r17789
988988
989989WRITE16_MEMBER(taitoz_state::cpua_ctrl_w)
990990{
991   //logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data);
991   //logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data);
992992
993993   if (mem_mask == 0xff00) data >>= 8;
994994   data &= 0xff;
r17788r17789
11941194         return ioport("Y_ADJUST")->read();
11951195   }
11961196
1197   logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", cpu_get_pc(&space.device()), offset);
1197   logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", space.device().safe_pc(), offset);
11981198
11991199   return 0xff;
12001200}
r17788r17789
12171217         return ioport("Y_ADJUST")->read();
12181218   }
12191219
1220   logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", cpu_get_pc(&space.device()), offset);
1220   logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", space.device().safe_pc(), offset);
12211221
12221222   return 0xff;
12231223}
r17788r17789
12471247         return (steer & 0xff00) >> 8;
12481248   }
12491249
1250   logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %06x\n", cpu_get_pc(&space.device()), offset);
1250   logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %06x\n", space.device().safe_pc(), offset);
12511251
12521252   return 0xff;
12531253}
r17788r17789
13181318         return steer & 0xff;
13191319   }
13201320
1321   logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %02x\n", cpu_get_pc(&space.device()), offset);
1321   logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %02x\n", space.device().safe_pc(), offset);
13221322
13231323   return 0x00;
13241324}
r17788r17789
13351335         return 0x55;   /* motor cpu status ? */
13361336
13371337      default:
1338         logerror("CPU #0 PC %06x: warning - read motor cpu %03x\n",cpu_get_pc(&space.device()),offset);
1338         logerror("CPU #0 PC %06x: warning - read motor cpu %03x\n",space.device().safe_pc(),offset);
13391339         return 0;
13401340   }
13411341}
r17788r17789
13531353         break;
13541354   }
13551355
1356   logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n",cpu_get_pc(&space.device()),data,offset);
1356   logerror("CPU #0 PC %06x: warning - write %04x to motor cpu %03x\n",space.device().safe_pc(),data,offset);
13571357}
13581358
13591359
trunk/src/mame/drivers/gunbustr.c
r17788r17789
117117            coin_counter_w(machine(), 1, data & 0x04000000);
118118            m_coin_word = (data >> 16) &0xffff;
119119         }
120         //logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&device()),offset);
120         //logerror("CPU #0 PC %06x: write input %06x\n",device->safe_pc(),offset);
121121         break;
122122      }
123123   }
r17788r17789
434434
435435READ32_MEMBER(gunbustr_state::main_cycle_r)
436436{
437   if (cpu_get_pc(&space.device())==0x55a && (m_ram[0x3acc/4]&0xff000000)==0)
437   if (space.device().safe_pc()==0x55a && (m_ram[0x3acc/4]&0xff000000)==0)
438438      device_spin_until_interrupt(&space.device());
439439
440440   return m_ram[0x3acc/4];
trunk/src/mame/drivers/msisaac.c
r17788r17789
145145         return 0x45;
146146
147147      default:
148         logerror("CPU#0 read from MCU pc=%4x, mcu_val=%2x\n", cpu_get_pc(&space.device()), m_mcu_val);
148         logerror("CPU#0 read from MCU pc=%4x, mcu_val=%2x\n", space.device().safe_pc(), m_mcu_val);
149149         return m_mcu_val;
150150   }
151151#endif
r17788r17789
166166   buggychl_mcu_w(offset,data);
167167#else
168168   //if(data != 0x0a && data != 0x42 && data != 0x02)
169   //  popmessage("PC = %04x %02x", cpu_get_pc(&space.device()), data);
169   //  popmessage("PC = %04x %02x", space.device().safe_pc(), data);
170170   m_mcu_val = data;
171171#endif
172172}
trunk/src/mame/drivers/pntnpuzl.c
r17788r17789
231231
232232WRITE16_MEMBER(pntnpuzl_state::pntnpuzl_280018_w)
233233{
234// logerror("%04x: 280018: %04x\n",cpu_get_pc(&space.device()),data);
234// logerror("%04x: 280018: %04x\n",space.device().safe_pc(),data);
235235   m_serial >>= 1;
236236   if (data & 0x2000)
237237      m_serial |= 0x400;
trunk/src/mame/drivers/gradius3.c
r17788r17789
4141   /* is this a bug in the game or something else? */
4242   if (!ACCESSING_BITS_0_7)
4343      k052109_w(m_k052109, offset, (data >> 8) & 0xff);
44//      logerror("%06x half %04x = %04x\n",cpu_get_pc(&space.device()),offset,data);
44//      logerror("%06x half %04x = %04x\n",space.device().safe_pc(),offset,data);
4545}
4646
4747READ16_MEMBER(gradius3_state::k051937_halfword_r)
r17788r17789
8888      m_irqAen = data & 0x20;
8989
9090      /* other bits unknown */
91   //logerror("%06x: write %04x to c0000\n",cpu_get_pc(&space.device()),data);
91   //logerror("%06x: write %04x to c0000\n",space.device().safe_pc(),data);
9292   }
9393}
9494
r17788r17789
124124
125125   if (m_irqBmask & 4)
126126   {
127      logerror("%04x trigger cpu B irq 4 %02x\n",cpu_get_pc(&space.device()),data);
127      logerror("%04x trigger cpu B irq 4 %02x\n",space.device().safe_pc(),data);
128128      device_set_input_line(m_subcpu, 4, HOLD_LINE);
129129   }
130130   else
131      logerror("%04x MISSED cpu B irq 4 %02x\n",cpu_get_pc(&space.device()),data);
131      logerror("%04x MISSED cpu B irq 4 %02x\n",space.device().safe_pc(),data);
132132}
133133
134134WRITE16_MEMBER(gradius3_state::sound_command_w)
trunk/src/mame/drivers/mystwarr.c
r17788r17789
235235{
236236   if (offset & 0x0078)
237237   {
238//      mame_printf_debug("spr write %x to %x (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
238//      mame_printf_debug("spr write %x to %x (PC=%x)\n", data, offset, space.device().safe_pc());
239239      COMBINE_DATA(m_spriteram+offset);
240240   }
241241   else
trunk/src/mame/drivers/ssfindo.c
r17788r17789
354354
355355static void ssfindo_speedups(address_space* space)
356356{
357   if (cpu_get_pc(&space->device())==0x2d6c8) // ssfindo
357   if (space->device().safe_pc()==0x2d6c8) // ssfindo
358358      device_spin_until_time(&space->device(), attotime::from_usec(20));
359   else if (cpu_get_pc(&space->device())==0x2d6bc) // ssfindo
359   else if (space->device().safe_pc()==0x2d6bc) // ssfindo
360360      device_spin_until_time(&space->device(), attotime::from_usec(20));
361361}
362362
363363static void ppcar_speedups(address_space* space)
364364{
365   if (cpu_get_pc(&space->device())==0x000bc8) // ppcar
365   if (space->device().safe_pc()==0x000bc8) // ppcar
366366      device_spin_until_time(&space->device(), attotime::from_usec(20));
367   else if (cpu_get_pc(&space->device())==0x000bbc) // ppcar
367   else if (space->device().safe_pc()==0x000bbc) // ppcar
368368      device_spin_until_time(&space->device(), attotime::from_usec(20));
369369}
370370
r17788r17789
378378
379379      case IOLINES: //TODO: eeprom  24c01
380380#if 0
381      mame_printf_debug("IOLINESR %i @%x\n", offset, cpu_get_pc(&space.device()));
381      mame_printf_debug("IOLINESR %i @%x\n", offset, space.device().safe_pc());
382382#endif
383383
384384      if(m_flashType == 1)
r17788r17789
434434            if(data&0xc0)
435435               m_adrLatch=0;
436436
437         if(cpu_get_pc(&space.device()) == 0xbac0 && m_flashType == 1)
437         if(space.device().safe_pc() == 0xbac0 && m_flashType == 1)
438438         {
439439            m_flashN=data&1;
440440         }
441441
442442#if 0
443            logerror("IOLINESW %i = %x  @%x\n",offset,data,cpu_get_pc(&space.device()));
443            logerror("IOLINESW %i = %x  @%x\n",offset,data,space.device().safe_pc());
444444#endif
445445         break;
446446
r17788r17789
520520   COMBINE_DATA(&temp);
521521
522522#if 0
523   logerror("[io_w] = %x @%x [latch=%x]\n",data,cpu_get_pc(&space.device()),m_adrLatch);
523   logerror("[io_w] = %x @%x [latch=%x]\n",data,space.device().safe_pc(),m_adrLatch);
524524#endif
525525
526526   if(m_adrLatch==1)
trunk/src/mame/drivers/segas24.c
r17788r17789
669669
670670READ16_MEMBER( segas24_state::iod_r )
671671{
672   logerror("IO daughterboard read %02x (%x)\n", offset, cpu_get_pc(&space.device()));
672   logerror("IO daughterboard read %02x (%x)\n", offset, space.device().safe_pc());
673673   return 0xffff;
674674}
675675
676676WRITE16_MEMBER( segas24_state::iod_w )
677677{
678   logerror("IO daughterboard write %02x, %04x & %04x (%x)\n", offset, data, mem_mask, cpu_get_pc(&space.device()));
678   logerror("IO daughterboard write %02x, %04x & %04x (%x)\n", offset, data, mem_mask, space.device().safe_pc());
679679}
680680
681681
r17788r17789
783783      int i;
784784      UINT8 mxor = 0;
785785      if(!mlatch_table) {
786         logerror("Protection: magic latch accessed but no table loaded (%s:%x)\n", space.device().tag(), cpu_get_pc(&space.device()));
786         logerror("Protection: magic latch accessed but no table loaded (%s:%x)\n", space.device().tag(), space.device().safe_pc());
787787         return;
788788      }
789789
r17788r17789
794794            if(mlatch & (1<<i))
795795               mxor |= 1 << mlatch_table[i];
796796         mlatch = data ^ mxor;
797         logerror("Magic latching %02x ^ %02x as %02x (%s:%x)\n", data & 0xff, mxor, mlatch, space.device().tag(), cpu_get_pc(&space.device()));
797         logerror("Magic latching %02x ^ %02x as %02x (%s:%x)\n", data & 0xff, mxor, mlatch, space.device().tag(), space.device().safe_pc());
798798      } else {
799         logerror("Magic latch reset (%s:%x)\n", space.device().tag(), cpu_get_pc(&space.device()));
799         logerror("Magic latch reset (%s:%x)\n", space.device().tag(), space.device().safe_pc());
800800         mlatch = 0x00;
801801      }
802802   }
r17788r17789
10311031
10321032READ16_MEMBER ( segas24_state::sys16_io_r )
10331033{
1034   //  logerror("IO read %02x (%s:%x)\n", offset, space->device().tag(), cpu_get_pc(&space->device()));
1034   //  logerror("IO read %02x (%s:%x)\n", offset, space->device().tag(), space->device().safe_pc());
10351035   if(offset < 8)
10361036      return (this->*io_r)(offset);
10371037   else if (offset < 0x20) {
r17788r17789
10491049      case 0xf:
10501050         return io_dir;
10511051      default:
1052         logerror("IO control read %02x (%s:%x)\n", offset, space.device().tag(), cpu_get_pc(&space.device()));
1052         logerror("IO control read %02x (%s:%x)\n", offset, space.device().tag(), space.device().safe_pc());
10531053         return 0xff;
10541054      }
10551055   } else
r17788r17789
10611061   if(ACCESSING_BITS_0_7) {
10621062      if(offset < 8) {
10631063         if(!(io_dir & (1 << offset))) {
1064            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()));
1064            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());
10651065            return;
10661066         }
10671067         (this->*io_w)(offset, data);
r17788r17789
10751075            io_dir = data;
10761076            break;
10771077         default:
1078            logerror("IO control write %02x, %02x (%s:%x)\n", offset, data & 0xff, space.device().tag(), cpu_get_pc(&space.device()));
1078            logerror("IO control write %02x, %02x (%s:%x)\n", offset, data & 0xff, space.device().tag(), space.device().safe_pc());
10791079         }
10801080      }
10811081   }
trunk/src/mame/drivers/konamigx.c
r17788r17789
482482        */
483483
484484      konamigx_wrport1_1 = (data>>16)&0xff;
485//      logerror("write %x to IRQ register (PC=%x)\n", konamigx_wrport1_1, cpu_get_pc(&space.device()));
485//      logerror("write %x to IRQ register (PC=%x)\n", konamigx_wrport1_1, space.device().safe_pc());
486486
487487      // gx_syncen is to ensure each IRQ is trigger at least once after being enabled
488488      if (konamigx_wrport1_1 & 0x80) gx_syncen |= konamigx_wrport1_1 & 0x1f;
r17788r17789
546546{
547547   UINT32 data = gx_workram[waitskip.offs+offset];
548548
549   if (cpu_get_pc(&space.device()) == waitskip.pc && (data & mem_mask) == (waitskip.data & mem_mask))
549   if (space.device().safe_pc() == waitskip.pc && (data & mem_mask) == (waitskip.data & mem_mask))
550550   {
551551      device_spin_until_trigger(&space.device(), resume_trigger);
552552      suspension_active = 1;
r17788r17789
730730      rv |= LSW<<8;
731731   }
732732
733//  mame_printf_debug("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device()));
733//  mame_printf_debug("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
734734
735735   // we clearly have some problem because some games require these hacks
736736   // perhaps 68000/68020 timing is skewed?
r17788r17789
740740         if (reg == 0) rv |= 0xff00;
741741         break;
742742      case 2: // Winning Spike
743         if (cpu_get_pc(&space.device()) == 0x2026fe) rv = 0xc0c0c0c0;
743         if (space.device().safe_pc() == 0x2026fe) rv = 0xc0c0c0c0;
744744         break;
745745      case 3: // Run'n Gun 2
746         if (cpu_get_pc(&space.device()) == 0x24f0b6) rv = 0xffffffff;
747         if (cpu_get_pc(&space.device()) == 0x24f122) rv = 0xc0c0c0c0;
746         if (space.device().safe_pc() == 0x24f0b6) rv = 0xffffffff;
747         if (space.device().safe_pc() == 0x24f122) rv = 0xc0c0c0c0;
748748         break;
749749      case 4:   // Rushing Heroes
750         if (cpu_get_pc(&space.device()) == 0x20eda6) rv = 0xc0c0c0c0;
750         if (space.device().safe_pc() == 0x20eda6) rv = 0xc0c0c0c0;
751751         break;
752752      case 5:   // Vs. Net Soccer ver. UAB
753         if (cpu_get_pc(&space.device()) == 0x24c5d2) rv = 0xffffffff;
754         if (cpu_get_pc(&space.device()) == 0x24c63e) rv = 0xc0c0c0c0;
753         if (space.device().safe_pc() == 0x24c5d2) rv = 0xffffffff;
754         if (space.device().safe_pc() == 0x24c63e) rv = 0xc0c0c0c0;
755755         break;
756756      case 6: // Slam Dunk 2
757         if (cpu_get_pc(&space.device()) == 0x24f1b0) rv = 0xffffffff;
758         if (cpu_get_pc(&space.device()) == 0x24f21c) rv = 0xc0c0c0c0;
757         if (space.device().safe_pc() == 0x24f1b0) rv = 0xffffffff;
758         if (space.device().safe_pc() == 0x24f21c) rv = 0xc0c0c0c0;
759759         break;
760760      case 7:   // Vs. Net Soccer ver. AAA
761         if (cpu_get_pc(&space.device()) == 0x24c6b6) rv = 0xffffffff;
762         if (cpu_get_pc(&space.device()) == 0x24c722) rv = 0xc0c0c0c0;
761         if (space.device().safe_pc() == 0x24c6b6) rv = 0xffffffff;
762         if (space.device().safe_pc() == 0x24c722) rv = 0xc0c0c0c0;
763763         break;
764764      case 8:   // Vs. Net Soccer ver. EAD
765         if (cpu_get_pc(&space.device()) == 0x24c416) rv = 0xffffffff;
766         if (cpu_get_pc(&space.device()) == 0x24c482) rv = 0xc0c0c0c0;
765         if (space.device().safe_pc() == 0x24c416) rv = 0xffffffff;
766         if (space.device().safe_pc() == 0x24c482) rv = 0xc0c0c0c0;
767767         break;
768768      case 9:   // Vs. Net Soccer ver. EAB
769         if (cpu_get_pc(&space.device()) == 0x24c400) rv = 0xffffffff;
770         if (cpu_get_pc(&space.device()) == 0x24c46c) rv = 0xc0c0c0c0;
769         if (space.device().safe_pc() == 0x24c400) rv = 0xffffffff;
770         if (space.device().safe_pc() == 0x24c46c) rv = 0xc0c0c0c0;
771771         break;
772772      case 10: // Vs. Net Soccer ver. JAB
773         if (cpu_get_pc(&space.device()) == 0x24c584) rv = 0xffffffff;
774         if (cpu_get_pc(&space.device()) == 0x24c5f0) rv = 0xc0c0c0c0;
773         if (space.device().safe_pc() == 0x24c584) rv = 0xffffffff;
774         if (space.device().safe_pc() == 0x24c5f0) rv = 0xc0c0c0c0;
775775         break;
776776      case 11: // Racin' Force
777777         if (reg == 0)
778778         {
779            if (cpu_get_pc(&space.device()) == 0x0202190)
779            if (space.device().safe_pc() == 0x0202190)
780780               rv |= 0x4000;
781781         }
782782         break;
r17788r17789
784784      case 12: // Open Golf / Golfing Greats 2
785785         if (reg == 0)
786786         {
787            if ((cpu_get_pc(&space.device()) == 0x0245e80) || (cpu_get_pc(&space.device()) == 0x02459d6) || (cpu_get_pc(&space.device()) == 0x0245e40) )
787            if ((space.device().safe_pc() == 0x0245e80) || (space.device().safe_pc() == 0x02459d6) || (space.device().safe_pc() == 0x0245e40) )
788788               rv |= 0x4000;
789789         }
790790         break;
791791      case 13: // Soccer Superstars
792         //if(cpu_get_pc(&space.device()) != 0x236dce && cpu_get_pc(&space.device()) != 0x236d8a && cpu_get_pc(&space.device()) != 0x236d8a)
793         //  printf("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device()));
794         if (cpu_get_pc(&space.device()) == 0x0236e04)  rv = 0xffffffff;
795         if (cpu_get_pc(&space.device()) == 0x0236e12)  rv = 0xffffffff;
792         //if(space.device().safe_pc() != 0x236dce && space.device().safe_pc() != 0x236d8a && space.device().safe_pc() != 0x236d8a)
793         //  printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
794         if (space.device().safe_pc() == 0x0236e04)  rv = 0xffffffff;
795         if (space.device().safe_pc() == 0x0236e12)  rv = 0xffffffff;
796796         break;
797797      case 14: // Soccer Superstars ver. JAC
798         //if(cpu_get_pc(&space.device()) != 0x2367b4)
799         //  printf("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device()));
800         if (cpu_get_pc(&space.device()) == 0x02367ea)  rv = 0xffffffff;
801         if (cpu_get_pc(&space.device()) == 0x02367f8)  rv = 0xffffffff;
798         //if(space.device().safe_pc() != 0x2367b4)
799         //  printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
800         if (space.device().safe_pc() == 0x02367ea)  rv = 0xffffffff;
801         if (space.device().safe_pc() == 0x02367f8)  rv = 0xffffffff;
802802         break;
803803      case 15: // Soccer Superstars ver. JAA
804         //if(cpu_get_pc(&space.device()) != 0x23670a)
805         //  printf("Read 68k @ %x (PC=%x)\n", reg, cpu_get_pc(&space.device()));
806         if (cpu_get_pc(&space.device()) == 0x0236740)  rv = 0xffffffff;
807         if (cpu_get_pc(&space.device()) == 0x023674e)  rv = 0xffffffff;
804         //if(space.device().safe_pc() != 0x23670a)
805         //  printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
806         if (space.device().safe_pc() == 0x0236740)  rv = 0xffffffff;
807         if (space.device().safe_pc() == 0x023674e)  rv = 0xffffffff;
808808         break;
809809      case 16: // Dragoon Might ver. JAA
810810         {
811811            UINT32 cur_pc;
812812
813            cur_pc = cpu_get_pc(&space.device());
813            cur_pc = space.device().safe_pc();
814814
815815            switch(cur_pc)
816816            {
r17788r17789
11141114            else if(last_prot_op == 0x515) // vsnetscr screen 1
11151115            {
11161116               int adr;
1117               //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, cpu_get_pc(&space.device()));
1117               //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc());
11181118               for (adr = 0; adr < 0x400; adr += 2)
11191119                  space.write_word(0xc01c00+adr, space.read_word(0xc01800+adr));
11201120            }
11211121            else if(last_prot_op == 0x115d) // vsnetscr screen 2
11221122            {
11231123               int adr;
1124               //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, cpu_get_pc(&space.device()));
1124               //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc());
11251125               for (adr = 0; adr < 0x400; adr += 2)
11261126                  space.write_word(0xc18c00+adr, space.read_word(0xc18800+adr));
11271127            }
11281128            else
11291129            {
1130               printf("GXT4: unknown protection command %x (PC=%x)\n", last_prot_op, cpu_get_pc(&space.device()));
1130               printf("GXT4: unknown protection command %x (PC=%x)\n", last_prot_op, space.device().safe_pc());
11311131            }
11321132
11331133            if (konamigx_wrport1_1 & 0x10)
trunk/src/mame/drivers/dorachan.c
r17788r17789
4646{
4747   UINT8 ret = 0;
4848
49   switch (cpu_get_previouspc(m_main_cpu))
49   switch (m_main_cpu->safe_pcbase())
5050   {
5151   case 0x70ce: ret = 0xf2; break;
5252   case 0x72a2: ret = 0xd5; break;
5353   case 0x72b5: ret = 0xcb; break;
5454
5555   default:
56      mame_printf_debug("unhandled $2400 read @ %x\n", cpu_get_previouspc(m_main_cpu));
56      mame_printf_debug("unhandled $2400 read @ %x\n", m_main_cpu->safe_pcbase());
5757      break;
5858   }
5959
trunk/src/mame/drivers/parodius.c
r17788r17789
7676{
7777
7878   if (m_videobank & 0xf8)
79      logerror("%04x: videobank = %02x\n",cpu_get_pc(&space.device()),data);
79      logerror("%04x: videobank = %02x\n",space.device().safe_pc(),data);
8080
8181   /* bit 0 = select palette or work RAM at 0000-07ff */
8282   /* bit 1 = select 052109 or 053245 at 2000-27ff */
r17788r17789
8888{
8989
9090   if ((data & 0xf4) != 0x10)
91      logerror("%04x: 3fc0 = %02x\n",cpu_get_pc(&space.device()),data);
91      logerror("%04x: 3fc0 = %02x\n",space.device().safe_pc(),data);
9292
9393   /* bit 0/1 = coin counters */
9494   coin_counter_w(machine(), 0, data & 0x01);
r17788r17789
427427static KONAMI_SETLINES_CALLBACK( parodius_banking )
428428{
429429   if (lines & 0xf0)
430      logerror("%04x: setlines %02x\n", cpu_get_pc(device), lines);
430      logerror("%04x: setlines %02x\n", device->safe_pc(), lines);
431431
432432   device->machine().root_device().membank("bank1")->set_entry((lines & 0x0f) ^ 0x0f);
433433}
trunk/src/mame/drivers/quizpun2.c
r17788r17789
204204{
205205   quizpun2_state *state = space->machine().driver_data<quizpun2_state>();
206206   struct prot_t &prot = state->m_prot;
207   logerror("%04x: protection - %s (state %x, wait %x, param %02x, cmd %02x, addr %02x)\n", cpu_get_pc(&space->device()), warning,
207   logerror("%04x: protection - %s (state %x, wait %x, param %02x, cmd %02x, addr %02x)\n", space->device().safe_pc(), warning,
208208      prot.state,
209209      prot.wait_param,
210210      prot.param,
trunk/src/mame/drivers/segac2.c
r17788r17789
497497static READ16_HANDLER( prot_r )
498498{
499499   segac2_state *state = space->machine().driver_data<segac2_state>();
500   if (LOG_PROTECTION) logerror("%06X:protection r=%02X\n", cpu_get_previouspc(&space->device()), state->m_prot_func ? state->m_prot_read_buf : 0xff);
500   if (LOG_PROTECTION) logerror("%06X:protection r=%02X\n", space->device().safe_pcbase(), state->m_prot_func ? state->m_prot_read_buf : 0xff);
501501   return state->m_prot_read_buf | 0xf0;
502502}
503503
r17788r17789
523523   /* determine the value to return, should a read occur */
524524   if (state->m_prot_func)
525525      state->m_prot_read_buf = state->m_prot_func(table_index);
526   if (LOG_PROTECTION) logerror("%06X:protection w=%02X, new result=%02X\n", cpu_get_previouspc(&space->device()), data & 0x0f, state->m_prot_read_buf);
526   if (LOG_PROTECTION) logerror("%06X:protection w=%02X, new result=%02X\n", space->device().safe_pcbase(), data & 0x0f, state->m_prot_read_buf);
527527
528528   /* if the palette changed, force an update */
529529   if (new_sp_palbase != state->m_sp_palbase || new_bg_palbase != state->m_bg_palbase)
trunk/src/mame/drivers/sandscrp.c
r17788r17789
291291   UINT8 *RAM = memregion("maincpu")->base();
292292   int bank = data & 0x07;
293293
294   if ( bank != data )   logerror("CPU #1 - PC %04X: Bank %02X\n",cpu_get_pc(&space.device()),data);
294   if ( bank != data )   logerror("CPU #1 - PC %04X: Bank %02X\n",space.device().safe_pc(),data);
295295
296296   if (bank < 3)   RAM = &RAM[0x4000 * bank];
297297   else         RAM = &RAM[0x4000 * (bank-3) + 0x10000];
trunk/src/mame/drivers/homedata.c
r17788r17789
309309         m_dac->write_signed8(data);
310310         break;
311311      default:
312         logerror("%04x: I/O write to port %04x\n", cpu_get_pc(&space.device()), offset);
312         logerror("%04x: I/O write to port %04x\n", space.device().safe_pc(), offset);
313313         break;
314314   }
315315}
r17788r17789
352352       1 \ ROM bank
353353       0 /
354354      */
355//  logerror("%04x: port C wr %02x (STATUS %d DATA %d)\n", cpu_get_pc(&space.device()), data, BIT(data, 2), BIT(data, 6));
355//  logerror("%04x: port C wr %02x (STATUS %d DATA %d)\n", space.device().safe_pc(), data, BIT(data, 2), BIT(data, 6));
356356
357357   membank("bank2")->set_entry(data & 0x03);
358358
r17788r17789
379379
380380   m_vblank = 0;
381381
382   //logerror("%04x: io_r %02x\n", cpu_get_pc(&space.device()), res);
382   //logerror("%04x: io_r %02x\n", space.device().safe_pc(), res);
383383
384384   return res;
385385}
386386
387387READ8_MEMBER(homedata_state::reikaids_snd_command_r)
388388{
389   //logerror("%04x: sndmcd_r (%02x)\n", cpu_get_pc(&space.device()), m_snd_command);
389   //logerror("%04x: sndmcd_r (%02x)\n", space.device().safe_pc(), m_snd_command);
390390   return m_snd_command;
391391}
392392
393393WRITE8_MEMBER(homedata_state::reikaids_snd_command_w)
394394{
395395   m_snd_command = data;
396   //logerror("%04x: coprocessor_command_w %02x\n", cpu_get_pc(&space.device()), data);
396   //logerror("%04x: coprocessor_command_w %02x\n", space.device().safe_pc(), data);
397397}
398398
399399
r17788r17789
407407
408408WRITE8_MEMBER(homedata_state::pteacher_snd_command_w)
409409{
410   //logerror("%04x: snd_command_w %02x\n", cpu_get_pc(&space.device()), data);
410   //logerror("%04x: snd_command_w %02x\n", space.device().safe_pc(), data);
411411   m_from_cpu = data;
412412}
413413
414414READ8_MEMBER(homedata_state::pteacher_snd_r)
415415{
416   //logerror("%04x: pteacher_snd_r %02x\n",cpu_get_pc(&space.device()),to_cpu);
416   //logerror("%04x: pteacher_snd_r %02x\n",space.device().safe_pc(),to_cpu);
417417   return m_to_cpu;
418418}
419419
r17788r17789
439439   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" };
440440   int dips = ioport("DSW")->read();
441441
442   //  logerror("%04x: keyboard_r with port A = %02x\n",cpu_get_pc(&space.device()),upd7807_porta);
442   //  logerror("%04x: keyboard_r with port A = %02x\n",space.device().safe_pc(),upd7807_porta);
443443
444444   if (m_upd7807_porta & 0x80)
445445   {
r17788r17789
462462   if (!BIT(m_upd7807_portc, 6))
463463      m_upd7807_porta = m_from_cpu;
464464   else
465      logerror("%04x: read PA with PC *not* clear\n", cpu_get_pc(&space.device()));
465      logerror("%04x: read PA with PC *not* clear\n", space.device().safe_pc());
466466
467467   return m_upd7807_porta;
468468}
r17788r17789
470470WRITE8_MEMBER(homedata_state::pteacher_snd_answer_w)
471471{
472472   m_to_cpu = data;
473   //logerror("%04x: to_cpu = %02x\n", cpu_get_pc(&space.device()), m_to_cpu);
473   //logerror("%04x: to_cpu = %02x\n", space.device().safe_pc(), m_to_cpu);
474474}
475475
476476WRITE8_MEMBER(homedata_state::pteacher_upd7807_porta_w)
r17788r17789
491491       0 input (coin)
492492      */
493493
494   //  logerror("%04x: port C wr %02x\n", cpu_get_pc(&space.device()), data);
494   //  logerror("%04x: port C wr %02x\n", space.device().safe_pc(), data);
495495
496496   membank("bank2")->set_entry((data & 0x0c) >> 2);
497497
trunk/src/mame/drivers/jokrwild.c
r17788r17789
184184
185185READ8_MEMBER(jokrwild_state::rng_r)
186186{
187   if(cpu_get_pc(&space.device()) == 0xab32)
187   if(space.device().safe_pc() == 0xab32)
188188      return (offset == 0) ? 0x9e : 0x27;
189189
190   if(cpu_get_pc(&space.device()) == 0xab3a)
190   if(space.device().safe_pc() == 0xab3a)
191191      return (offset == 2) ? 0x49 : 0x92;
192192
193193   return machine().rand() & 0xff;
trunk/src/mame/drivers/hng64.c
r17788r17789
476476READ32_MEMBER(hng64_state::hng64_com_r)
477477{
478478
479   logerror("com read  (PC=%08x): %08x %08x = %08x\n", cpu_get_pc(&space.device()), (offset*4)+0xc0000000, mem_mask, m_com_ram[offset]);
479   logerror("com read  (PC=%08x): %08x %08x = %08x\n", space.device().safe_pc(), (offset*4)+0xc0000000, mem_mask, m_com_ram[offset]);
480480   return m_com_ram[offset];
481481}
482482
483483WRITE32_MEMBER(hng64_state::hng64_com_w)
484484{
485485
486   logerror("com write (PC=%08x): %08x %08x = %08x\n", cpu_get_pc(&space.device()), (offset*4)+0xc0000000, mem_mask, data);
486   logerror("com write (PC=%08x): %08x %08x = %08x\n", space.device().safe_pc(), (offset*4)+0xc0000000, mem_mask, data);
487487   COMBINE_DATA(&m_com_ram[offset]);
488488}
489489
490490WRITE32_MEMBER(hng64_state::hng64_com_share_w)
491491{
492492
493   logerror("commw  (PC=%08x): %08x %08x %08x\n", cpu_get_pc(&space.device()), data, (offset*4)+0xc0001000, mem_mask);
493   logerror("commw  (PC=%08x): %08x %08x %08x\n", space.device().safe_pc(), data, (offset*4)+0xc0001000, mem_mask);
494494
495495   if (offset == 0x0) COMBINE_DATA(&m_com_shared_a);
496496   if (offset == 0x1) COMBINE_DATA(&m_com_shared_b);
r17788r17789
498498
499499READ32_MEMBER(hng64_state::hng64_com_share_r)
500500{
501   logerror("commr  (PC=%08x): %08x %08x\n", cpu_get_pc(&space.device()), (offset*4)+0xc0001000, mem_mask);
501   logerror("commr  (PC=%08x): %08x %08x\n", space.device().safe_pc(), (offset*4)+0xc0001000, mem_mask);
502502
503503   //if(offset == 0x0) return m_com_shared_a;
504504   //if(offset == 0x1) return m_com_shared_b;
r17788r17789
529529
530530#if 0
531531   if((offset*4) != 0x1084)
532      printf("HNG64 port read (PC=%08x) 0x%08x\n", cpu_get_pc(&space.device()), offset*4);
532      printf("HNG64 port read (PC=%08x) 0x%08x\n", space.device().safe_pc(), offset*4);
533533#endif
534534
535535   rtc_addr = offset >> 1;
r17788r17789
605605
606606#if 0
607607   if(((offset*4) & 0xff00) == 0x1100)
608      printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device()));
608      printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], space.device().safe_pc());
609609#endif
610610
611611   switch(offset*4)
612612   {
613613      case 0x1084: //MIPS->MCU latch port
614614         m_mcu_en = (data & 0xff); //command-based, i.e. doesn't control halt line and such?
615         //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device()));
615         //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], space.device().safe_pc());
616616         break;
617617      //0x110c global irq mask?
618618      /* irq ack */
r17788r17789
624624         hng64_do_dma(&space);
625625         break;
626626      //default:
627      //  printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], cpu_get_pc(&space.device()));
627      //  printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, m_sysregs[offset], space.device().safe_pc());
628628   }
629629}
630630
r17788r17789
751751READ32_MEMBER(hng64_state::hng64_dualport_r)
752752{
753753
754   //printf("dualport R %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(&space.device()));
754   //printf("dualport R %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], space.device().safe_pc());
755755
756756   /*
757757    command table:
r17788r17789
789789WRITE32_MEMBER(hng64_state::hng64_dualport_w)
790790{
791791
792   //printf("dualport WRITE %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(&space.device()));
792   //printf("dualport WRITE %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], space.device().safe_pc());
793793   COMBINE_DATA (&m_dualport[offset]);
794794}
795795
r17788r17789
862862#if 0
863863READ32_MEMBER(hng64_state::dl_r)
864864{
865   //mame_printf_debug("dl R (%08x) : %x %x\n", cpu_get_pc(&space.device()), offset, hng64_dl[offset]);
866   //usrintf_showmessage("dl R (%08x) : %x %x", cpu_get_pc(&space.device()), offset, hng64_dl[offset]);
865   //mame_printf_debug("dl R (%08x) : %x %x\n", space.device().safe_pc(), offset, hng64_dl[offset]);
866   //usrintf_showmessage("dl R (%08x) : %x %x", space.device().safe_pc(), offset, hng64_dl[offset]);
867867   return hng64_dl[offset];
868868}
869869#endif
trunk/src/mame/drivers/solomon.c
r17788r17789
2323
2424READ8_MEMBER(solomon_state::solomon_0xe603_r)
2525{
26   if (cpu_get_pc(&space.device()) == 0x161) // all the time .. return 0 to act as before  for coin / startup etc.
26   if (space.device().safe_pc() == 0x161) // all the time .. return 0 to act as before  for coin / startup etc.
2727   {
2828      return 0;
2929   }
30   else if (cpu_get_pc(&space.device()) == 0x4cf0) // stop it clearing the screen at certain scores
30   else if (space.device().safe_pc() == 0x4cf0) // stop it clearing the screen at certain scores
3131   {
3232      return (cpu_get_reg(&space.device(), Z80_BC) & 0x08);
3333   }
3434   else
3535   {
36      mame_printf_debug("unhandled solomon_0xe603_r %04x\n", cpu_get_pc(&space.device()));
36      mame_printf_debug("unhandled solomon_0xe603_r %04x\n", space.device().safe_pc());
3737      return 0;
3838   }
3939}
trunk/src/mame/drivers/macrossp.c
r17788r17789
320320READ32_MEMBER(macrossp_state::macrossp_soundstatus_r)
321321{
322322
323   //  logerror("%08x read soundstatus\n", cpu_get_pc(&space.device()));
323   //  logerror("%08x read soundstatus\n", space.device().safe_pc());
324324
325325   /* bit 1 is sound status */
326326   /* bit 0 unknown - it is expected to toggle, vblank? */
r17788r17789
335335
336336   if (ACCESSING_BITS_16_31)
337337   {
338      //logerror("%08x write soundcmd %08x (%08x)\n",cpu_get_pc(&space.device()),data,mem_mask);
338      //logerror("%08x write soundcmd %08x (%08x)\n",space.device().safe_pc(),data,mem_mask);
339339      soundlatch_word_w(space, 0, data >> 16, 0xffff);
340340      m_sndpending = 1;
341341      device_set_input_line(m_audiocpu, 2, HOLD_LINE);
r17788r17789
347347READ16_MEMBER(macrossp_state::macrossp_soundcmd_r)
348348{
349349
350   //  logerror("%06x read soundcmd\n",cpu_get_pc(&space.device()));
350   //  logerror("%06x read soundcmd\n",space.device().safe_pc());
351351   m_sndpending = 0;
352352   return soundlatch_word_r(space, offset, mem_mask);
353353}
r17788r17789
770770*/
771771
772772   COMBINE_DATA(&m_mainram[0x10158 / 4]);
773   if (cpu_get_pc(&space.device()) == 0x001810A) device_spin_until_interrupt(&space.device());
773   if (space.device().safe_pc() == 0x001810A) device_spin_until_interrupt(&space.device());
774774}
775775
776776#ifdef UNUSED_FUNCTION
r17788r17789
778778{
779779
780780   COMBINE_DATA(&m_mainram[0x00020 / 4]);
781   if (cpu_get_pc(&space.device()) == 0x1cc) device_spin_until_interrupt(&space.device());
781   if (space.device().safe_pc() == 0x1cc) device_spin_until_interrupt(&space.device());
782782}
783783#endif
784784
trunk/src/mame/drivers/gladiatr.c
r17788r17789
995995
996996READ8_MEMBER(gladiatr_state::f6a3_r)
997997{
998   if(cpu_get_previouspc(&space.device())==0x8e)
998   if(space.device().safe_pcbase()==0x8e)
999999      m_nvram[0x6a3]=1;
10001000
10011001   return m_nvram[0x6a3];
trunk/src/mame/drivers/goindol.c
r17788r17789
5252WRITE8_MEMBER(goindol_state::prot_fc44_w)
5353{
5454
55   logerror("%04x: prot_fc44_w(%02x)\n", cpu_get_pc(&space.device()), data);
55   logerror("%04x: prot_fc44_w(%02x)\n", space.device().safe_pc(), data);
5656   m_ram[0x0419] = 0x5b;
5757   m_ram[0x041a] = 0x3f;
5858   m_ram[0x041b] = 0x6d;
r17788r17789
6161WRITE8_MEMBER(goindol_state::prot_fd99_w)
6262{
6363
64   logerror("%04x: prot_fd99_w(%02x)\n", cpu_get_pc(&space.device()), data);
64   logerror("%04x: prot_fd99_w(%02x)\n", space.device().safe_pc(), data);
6565   m_ram[0x0421] = 0x3f;
6666}
6767
6868WRITE8_MEMBER(goindol_state::prot_fc66_w)
6969{
7070
71   logerror("%04x: prot_fc66_w(%02x)\n", cpu_get_pc(&space.device()), data);
71   logerror("%04x: prot_fc66_w(%02x)\n", space.device().safe_pc(), data);
7272   m_ram[0x0423] = 0x06;
7373}
7474
7575WRITE8_MEMBER(goindol_state::prot_fcb0_w)
7676{
7777
78   logerror("%04x: prot_fcb0_w(%02x)\n", cpu_get_pc(&space.device()), data);
78   logerror("%04x: prot_fcb0_w(%02x)\n", space.device().safe_pc(), data);
7979   m_ram[0x0425] = 0x06;
8080}
8181
trunk/src/mame/drivers/hotblock.c
r17788r17789
9393
9494WRITE8_MEMBER(hotblock_state::hotblock_port4_w)
9595{
96//  mame_printf_debug("port4_w: pc = %06x : data %04x\n", cpu_get_pc(&space.device()), data);
97//  popmessage("port4_w: pc = %06x : data %04x", cpu_get_pc(&space.device()), data);
96//  mame_printf_debug("port4_w: pc = %06x : data %04x\n", space.device().safe_pc(), data);
97//  popmessage("port4_w: pc = %06x : data %04x", space.device().safe_pc(), data);
9898
9999   m_port4 = data;
100100}
r17788r17789
103103
104104WRITE8_MEMBER(hotblock_state::hotblock_port0_w)
105105{
106//  popmessage("port4_w: pc = %06x : data %04x", cpu_get_pc(&space.device()), data);
106//  popmessage("port4_w: pc = %06x : data %04x", space.device().safe_pc(), data);
107107
108108   m_port0 = data;
109109}
trunk/src/mame/drivers/vendetta.c
r17788r17789
784784static KONAMI_SETLINES_CALLBACK( vendetta_banking )
785785{
786786   if (lines >= 0x1c)
787      logerror("PC = %04x : Unknown bank selected %02x\n", cpu_get_pc(device), lines);
787      logerror("PC = %04x : Unknown bank selected %02x\n", device->safe_pc(), lines);
788788   else
789789      device->machine().root_device().membank("bank1")->set_entry(lines);
790790}
trunk/src/mame/drivers/segas16b.c
r17788r17789
11241124      case 0x2000/2:
11251125         return ioport((offset & 1) ? "DSW1" : "DSW2")->read();
11261126   }
1127   logerror("%06X:standard_io_r - unknown read access to address %04X\n", cpu_get_pc(&space.device()), offset * 2);
1127   logerror("%06X:standard_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2);
11281128   return open_bus_r(space, 0, mem_mask);
11291129}
11301130
r17788r17789
11591159         coin_counter_w(machine(), 0, data & 0x01);
11601160         return;
11611161   }
1162   logerror("%06X:standard_io_w - unknown write access to address %04X = %04X & %04X\n", cpu_get_pc(&space.device()), offset * 2, data, mem_mask);
1162   logerror("%06X:standard_io_w - unknown write access to address %04X = %04X & %04X\n", space.device().safe_pc(), offset * 2, data, mem_mask);
11631163}
11641164
11651165
trunk/src/mame/drivers/saturn.c
r17788r17789
290290   {
291291      case 0x5c/4:
292292      //  Super Major League and Shin Megami Tensei - Akuma Zensho reads from there (undocumented), DMA status mirror?
293         if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(&space->device()));
293         if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",space->device().safe_pc());
294294         res = state->m_scu_regs[0x7c/4];
295295         break;
296296      case 0x7c/4:
297         if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(&space->device()));
297         if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",space->device().safe_pc());
298298         res = state->m_scu_regs[offset];
299299         break;
300300      case 0x80/4:
r17788r17789
305305           res = dsp_ram_addr_r();
306306           break;
307307        case 0xa0/4:
308          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]);
308          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]);
309309          res = state->m_scu.ism;
310310          break;
311311       case 0xa4/4:
312          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]);
312          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]);
313313         res = state->m_scu.ist;
314314         break;
315315      case 0xc8/4:
316         logerror("(PC=%08x) SCU version reg read\n",cpu_get_pc(&space->device()));
316         logerror("(PC=%08x) SCU version reg read\n",space->device().safe_pc());
317317         res = 0x00000004;/*SCU Version 4, OK? */
318318         break;
319319      default:
320          if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",cpu_get_pc(&space->device()),offset,state->m_scu_regs[offset]);
320          if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",space->device().safe_pc(),offset,state->m_scu_regs[offset]);
321321          res = state->m_scu_regs[offset];
322322         break;
323323   }
r17788r17789
393393         scu_test_pending_irq(space->machine());
394394         break;
395395      case 0xa4/4: /* IRQ control */
396         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);
396         if(LOG_SCU) logerror("PC=%08x IRQ status reg set:%08x %08x\n",space->device().safe_pc(),state->m_scu_regs[41],mem_mask);
397397         state->m_scu.ist &= state->m_scu_regs[offset];
398398         break;
399399      case 0xa8/4: if(LOG_SCU) logerror("A-Bus IRQ ACK %08x\n",state->m_scu_regs[42]); break;
r17788r17789
643643{
644644   saturn_state *state = space->machine().driver_data<saturn_state>();
645645
646   //logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->device().tag(), cpu_get_pc(&space->device()),data);
646   //logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->device().tag(), space->device().safe_pc(),data);
647647   space->machine().scheduler().boost_interleave(state->m_minit_boost_timeslice, attotime::from_usec(state->m_minit_boost));
648648   space->machine().scheduler().trigger(1000);
649649   sh2_set_frt_input(state->m_slave, PULSE_LINE);
r17788r17789
653653{
654654   saturn_state *state = space->machine().driver_data<saturn_state>();
655655
656   //logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->device().tag(), cpu_get_pc(&space->device()),data);
656   //logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->device().tag(), space->device().safe_pc(),data);
657657   space->machine().scheduler().boost_interleave(state->m_sinit_boost_timeslice, attotime::from_usec(state->m_sinit_boost));
658658   sh2_set_frt_input(state->m_maincpu, PULSE_LINE);
659659}
trunk/src/mame/drivers/pktgaldx.c
r17788r17789
104104
105105READ16_MEMBER(pktgaldx_state::pckgaldx_protection_r)
106106{
107   logerror("pckgaldx_protection_r address %06x\n",cpu_get_pc(&space.device()));
107   logerror("pckgaldx_protection_r address %06x\n",space.device().safe_pc());
108108   return -1;
109109}
110110
trunk/src/mame/drivers/atarigx2.c
r17788r17789
146146WRITE32_MEMBER(atarigx2_state::atarigx2_protection_w)
147147{
148148   {
149      int pc = cpu_get_previouspc(&space.device());
149      int pc = space.device().safe_pcbase();
150150//      if (pc == 0x11cbe || pc == 0x11c30)
151151//          logerror("%06X:Protection W@%04X = %04X  (result to %06X)\n", pc, offset, data, cpu_get_reg(&space.device(), M68K_A2));
152152//      else
r17788r17789
11261126            result = machine().rand() << 16;
11271127         else
11281128            result = 0xffff << 16;
1129         logerror("%06X:Unhandled protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset, result);
1129         logerror("%06X:Unhandled protection R@%04X = %04X\n", space.device().safe_pcbase(), offset, result);
11301130      }
11311131   }
11321132
11331133   if (ACCESSING_BITS_16_31)
1134      logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset * 4, result >> 16);
1134      logerror("%06X:Protection R@%04X = %04X\n", space.device().safe_pcbase(), offset * 4, result >> 16);
11351135   else
1136      logerror("%06X:Protection R@%04X = %04X\n", cpu_get_previouspc(&space.device()), offset * 4 + 2, result);
1136      logerror("%06X:Protection R@%04X = %04X\n", space.device().safe_pcbase(), offset * 4 + 2, result);
11371137   return result;
11381138}
11391139
trunk/src/mame/drivers/nwk-tr.c
r17788r17789
394394
395395      default:
396396      {
397         //printf("lanc1_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space.device()));
397         //printf("lanc1_r: %08X, %08X at %08X\n", offset, mem_mask, space.device().safe_pc());
398398         return 0xffffffff;
399399      }
400400   }
r17788r17789
402402
403403WRITE32_MEMBER(nwktr_state::lanc1_w)
404404{
405   //printf("lanc1_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
405   //printf("lanc1_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc());
406406}
407407
408408READ32_MEMBER(nwktr_state::lanc2_r)
r17788r17789
430430      }
431431   }
432432
433   //printf("lanc2_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space.device()));
433   //printf("lanc2_r: %08X, %08X at %08X\n", offset, mem_mask, space.device().safe_pc());
434434
435435   return r;
436436}
r17788r17789
454454
455455         m_fpga_uploaded = 1;
456456
457         //printf("lanc2_fpga_w: %02X at %08X\n", value, cpu_get_pc(&space.device()));
457         //printf("lanc2_fpga_w: %02X at %08X\n", value, space.device().safe_pc());
458458      }
459459      else if (ACCESSING_BITS_8_15)
460460      {
r17788r17789
473473      }
474474      else
475475      {
476         //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
476         //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc());
477477      }
478478   }
479479   if (offset == 4)
r17788r17789
503503      }
504504   }
505505
506   //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
506   //printf("lanc2_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc());
507507}
508508
509509/*****************************************************************************/
trunk/src/mame/drivers/taito_f3.c
r17788r17789
6464   if (offset < 6)
6565      return ioport(iptnames[offset])->read();
6666
67   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", cpu_get_pc(&space.device()), offset);
67   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", space.device().safe_pc(), offset);
6868   return 0xffffffff;
6969}
7070
r17788r17789
105105         }
106106         return;
107107   }
108   logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %08x\n",cpu_get_pc(&space.device()),offset,data);
108   logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %08x\n",space.device().safe_pc(),offset,data);
109109}
110110
111111WRITE32_MEMBER(taito_f3_state::f3_sound_reset_0_w)
trunk/src/mame/drivers/m107.c
r17788r17789
8585   {
8686      membank("bank1")->set_entry((data & 0x06) >> 1);
8787      if (data & 0xf9)
88         logerror("%05x: bankswitch %04x\n", cpu_get_pc(&space.device()), data);
88         logerror("%05x: bankswitch %04x\n", space.device().safe_pc(), data);
8989   }
9090}
9191
trunk/src/mame/drivers/ninjaw.c
r17788r17789
344344
345345   parse_control(machine());
346346
347   logerror("CPU #0 PC %06x: write %04x to cpu control\n", cpu_get_pc(&space.device()), data);
347   logerror("CPU #0 PC %06x: write %04x to cpu control\n", space.device().safe_pc(), data);
348348}
349349
350350
trunk/src/mame/drivers/pacman.c
r17788r17789
572572READ8_MEMBER(pacman_state::maketrax_special_port2_r)
573573{
574574   int data = ioport("DSW1")->read();
575   int pc = cpu_get_previouspc(&space.device());
575   int pc = space.device().safe_pcbase();
576576
577577   if ((pc == 0x1973) || (pc == 0x2389)) return data | 0x40;
578578
r17788r17789
592592
593593READ8_MEMBER(pacman_state::maketrax_special_port3_r)
594594{
595   int pc = cpu_get_previouspc(&space.device());
595   int pc = space.device().safe_pcbase();
596596
597597   if (pc == 0x040e) return 0x20;
598598
r17788r17789
614614READ8_MEMBER(pacman_state::korosuke_special_port2_r)
615615{
616616   int data = ioport("DSW1")->read();
617   int pc = cpu_get_previouspc(&space.device());
617   int pc = space.device().safe_pcbase();
618618
619619   if ((pc == 0x196e) || (pc == 0x2387)) return data | 0x40;
620620
r17788r17789
634634
635635READ8_MEMBER(pacman_state::korosuke_special_port3_r)
636636{
637   int pc = cpu_get_previouspc(&space.device());
637   int pc = space.device().safe_pcbase();
638638
639639   if (pc == 0x0445) return 0x20;
640640
r17788r17789
710710
711711READ8_MEMBER(pacman_state::drivfrcp_port1_r)
712712{
713   switch (cpu_get_pc(&space.device()))
713   switch (space.device().safe_pc())
714714   {
715715      case 0x0030:
716716      case 0x0291:
r17788r17789
722722
723723READ8_MEMBER(pacman_state::_8bpm_port1_r)
724724{
725   switch (cpu_get_pc(&space.device()))
725   switch (space.device().safe_pc())
726726   {
727727      case 0x0030:
728728      case 0x0466:
r17788r17789
734734
735735READ8_MEMBER(pacman_state::porky_port1_r)
736736{
737   switch (cpu_get_pc(&space.device()))
737   switch (space.device().safe_pc())
738738   {
739739      case 0x0034:
740740         return 0x01;
r17788r17789
61256125   switch (offset)
61266126   {
61276127      default:
6128         logerror("CPU0 %04x: Unhandled protection read, offset %04x\n", cpu_get_pc(&space.device()), offset);
6128         logerror("CPU0 %04x: Unhandled protection read, offset %04x\n", space.device().safe_pc(), offset);
61296129         return 0x00;
61306130
61316131      case 0x0000: // unknown
r17788r17789
61486148         m_cannonb_bit_to_read = 7;
61496149         return 0x00;
61506150      case 0x0001: // affects the ball hitting the blocks as well as jump address after bonus round
6151         if (cpu_get_pc(&space.device()) == 0x2b97)
6151         if (space.device().safe_pc() == 0x2b97)
61526152            return (BIT(0x46, m_cannonb_bit_to_read--) << 7);
61536153         else
61546154            return 0xff;            /* value taken from the bootlegs */
trunk/src/mame/drivers/igs011.c
r17788r17789
223223{
224224   COMBINE_DATA(&m_priority);
225225
226//  logerror("%06x: priority = %02x\n", cpu_get_pc(&space.device()), m_priority);
226//  logerror("%06x: priority = %02x\n", space.device().safe_pc(), m_priority);
227227
228228   if (data & ~0x7)
229      logerror("%06x: warning, unknown bits written to priority = %02x\n", cpu_get_pc(&space.device()), m_priority);
229      logerror("%06x: warning, unknown bits written to priority = %02x\n", space.device().safe_pc(), m_priority);
230230}
231231
232232
r17788r17789
445445   COMBINE_DATA(&blitter.flags);
446446
447447#if LOG_BLITTER
448   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()),
448   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(),
449449               blitter.x,blitter.y,blitter.w,blitter.h,blitter.gfx_hi,blitter.gfx_lo,blitter.depth,blitter.pen,blitter.flags);
450450#endif
451451
r17788r17789
13741374            coin_counter_w(machine(), 0,data & 2);
13751375
13761376         if (data & ~0x2)
1377            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space.device()), data);
1377            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", space.device().safe_pc(), data);
13781378
13791379         break;
13801380
r17788r17789
13871387
13881388      default:
13891389//          popmessage("igs003 %x <- %04x",m_igs003_reg[0],data);
1390         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data);
1390         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data);
13911391   }
13921392}
13931393READ16_MEMBER(igs011_state::drgnwrld_igs003_r)
r17788r17789
14211421      case 0x34:   return 0x32;
14221422
14231423      default:
1424         logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]);
1424         logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]);
14251425   }
14261426
14271427   return 0;
r17788r17789
14411441   }
14421442
14431443   if ( m_igs_input_sel & (~0xff) )
1444      logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel);
1444      logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel);
14451445
14461446//  popmessage("sel2 %02x",m_igs_input_sel&~0x1f);
14471447}
r17788r17789
14581458         if (~m_igs_input_sel & 0x08)   return ioport("KEY3")->read();
14591459         if (~m_igs_input_sel & 0x10)   return ioport("KEY4")->read();
14601460
1461         logerror("%06x: warning, reading with igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel);
1461         logerror("%06x: warning, reading with igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel);
14621462         break;
14631463   }
14641464   return 0;
r17788r17789
14861486         }
14871487
14881488         if ( m_igs_input_sel & ~0x7f )
1489            logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel);
1489            logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel);
14901490
14911491//          popmessage("sel2 %02x",m_igs_input_sel&~0x1f);
14921492         break;
r17788r17789
15011501         }
15021502
15031503         if ( m_lhb2_pen_hi & ~0xf )
1504            logerror("%06x: warning, unknown bits written in lhb2_pen_hi = %02x\n", cpu_get_pc(&space.device()), m_lhb2_pen_hi);
1504            logerror("%06x: warning, unknown bits written in lhb2_pen_hi = %02x\n", space.device().safe_pc(), m_lhb2_pen_hi);
15051505
15061506//          popmessage("oki %02x",m_lhb2_pen_hi & 0x08);
15071507         break;
15081508
15091509      default:
1510         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data);
1510         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data);
15111511   }
15121512}
15131513READ16_MEMBER(igs011_state::lhb2_igs003_r)
r17788r17789
15221522         if (~m_igs_input_sel & 0x10)   return ioport("KEY4")->read();
15231523         /* fall through */
15241524      default:
1525         logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]);
1525         logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]);
15261526         break;
15271527
15281528//      case 0x03:
r17788r17789
15811581         }
15821582
15831583         if (data & ~0x33)
1584            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space.device()), data);
1584            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", space.device().safe_pc(), data);
15851585
15861586//          popmessage("coin %02x",data);
15871587         break;
15881588
15891589      default:
1590         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data);
1590         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data);
15911591   }
15921592}
15931593READ16_MEMBER(igs011_state::wlcc_igs003_r)
r17788r17789
16191619      case 0x34:   return 0x32;
16201620
16211621      default:
1622         logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]);
1622         logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]);
16231623   }
16241624
16251625   return 0;
r17788r17789
16471647         }
16481648
16491649         if ( m_igs_input_sel & 0x40 )
1650            logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space.device()), m_igs_input_sel);
1650            logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", space.device().safe_pc(), m_igs_input_sel);
16511651
16521652//          popmessage("sel2 %02x",m_igs_input_sel&~0x1f);
16531653         break;
16541654
16551655      default:
1656         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data);
1656         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data);
16571657   }
16581658}
16591659READ16_MEMBER(igs011_state::xymg_igs003_r)
r17788r17789
16931693      case 0x34:   return 0x32;
16941694
16951695      default:
1696         logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]);
1696         logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]);
16971697         break;
16981698   }
16991699
r17788r17789
17191719         }
17201720
17211721         if (data & ~0x3)
1722            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space.device()), data);
1722            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", space.device().safe_pc(), data);
17231723
17241724         break;
17251725
17261726      default:
17271727//          popmessage("igs003 %x <- %04x",m_igs003_reg[0],data);
1728         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0], data);
1728         logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", space.device().safe_pc(), m_igs003_reg[0], data);
17291729   }
17301730}
17311731READ16_MEMBER(igs011_state::vbowl_igs003_r)
r17788r17789
17611761      case 0x34:   return 0x32;
17621762
17631763      default:
1764         logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space.device()), m_igs003_reg[0]);
1764         logerror("%06x: warning, reading with igs003_reg = %02x\n", space.device().safe_pc(), m_igs003_reg[0]);
17651765   }
17661766
17671767   return 0;
r17788r17789
25072507   }
25082508
25092509   if (data & ~0x7)
2510      logerror("%06x: warning, unknown bits written to pen_hi = %04x\n", cpu_get_pc(&space.device()), m_priority);
2510      logerror("%06x: warning, unknown bits written to pen_hi = %04x\n", space.device().safe_pc(), m_priority);
25112511}
25122512
25132513WRITE16_MEMBER(igs011_state::vbowl_link_0_w){ }
trunk/src/mame/drivers/srmp6.c
r17788r17789
361361      case 0x56/2: // written 8,9,8,9 successively
362362
363363      default:
364         logerror("video_regs_w (PC=%06X): %04x = %04x & %04x\n", cpu_get_previouspc(&space.device()), offset*2, data, mem_mask);
364         logerror("video_regs_w (PC=%06X): %04x = %04x & %04x\n", space.device().safe_pcbase(), offset*2, data, mem_mask);
365365         break;
366366   }
367367   COMBINE_DATA(&m_video_regs[offset]);
r17788r17789
370370READ16_MEMBER(srmp6_state::video_regs_r)
371371{
372372
373   logerror("video_regs_r (PC=%06X): %04x\n", cpu_get_previouspc(&space.device()), offset*2);
373   logerror("video_regs_r (PC=%06X): %04x\n", space.device().safe_pcbase(), offset*2);
374374   return m_video_regs[offset];
375375}
376376
trunk/src/mame/drivers/sf.c
r17788r17789
146146      }
147147   default:
148148      {
149         logerror("Write protection at %06x (%04x)\n", cpu_get_pc(&space.device()), data & 0xffff);
149         logerror("Write protection at %06x (%04x)\n", space.device().safe_pc(), data & 0xffff);
150150         logerror("*** Unknown protection %d\n", space.read_byte(0xffc684));
151151         break;
152152      }
trunk/src/mame/drivers/konamim2.c
r17788r17789
346346READ64_MEMBER(konamim2_state::unk4_r)
347347{
348348   UINT64 r = 0;
349//  logerror("unk4_r: %08X, %08X%08X at %08X\n", offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), cpu_get_pc(&space.device()));
349//  logerror("unk4_r: %08X, %08X%08X at %08X\n", offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), space.device().safe_pc());
350350
351351   if (ACCESSING_BITS_32_63)
352352   {
r17788r17789
363363WRITE64_MEMBER(konamim2_state::unk4_w)
364364{
365365//  logerror("unk4_w: %08X%08X, %08X, %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data),
366//      offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), cpu_get_pc(&space.device()));
366//      offset, (UINT32)(mem_mask>>32), (UINT32)(mem_mask), space.device().safe_pc());
367367
368368   if (ACCESSING_BITS_0_31)
369369   {
370370      if (data & 0x800000)
371371      {
372//          mame_printf_debug("CPU '%s': CPU1 IRQ at %08X\n", device().tag(), cpu_get_pc(&space.device()));
372//          mame_printf_debug("CPU '%s': CPU1 IRQ at %08X\n", device().tag(), space.device().safe_pc());
373373         cputag_set_input_line(machine(), "sub", INPUT_LINE_IRQ0, ASSERT_LINE);
374374      }
375375
r17788r17789
902902
903903      default:
904904      {
905//                      mame_printf_debug("cde_r: %08X at %08X\n", reg*4, cpu_get_pc(&space.device()));
905//                      mame_printf_debug("cde_r: %08X at %08X\n", reg*4, space.device().safe_pc());
906906         break;
907907      }
908908   }
r17788r17789
936936   {
937937      case 0x028/4:      // Command write
938938      {
939         //printf("cde_w: %08X, %08X at %08X\n", d, reg*4, cpu_get_pc(&space.device()));
939         //printf("cde_w: %08X, %08X at %08X\n", d, reg*4, space.device().safe_pc());
940940
941941         if (d == 0x0180)
942942         {
r17788r17789
10641064
10651065      default:
10661066      {
1067//                      mame_printf_debug("cde_w: %08X, %08X at %08X\n", d, reg*4, cpu_get_pc(&space.device()));
1067//                      mame_printf_debug("cde_w: %08X, %08X at %08X\n", d, reg*4, space.device().safe_pc());
10681068         break;
10691069      }
10701070   }
trunk/src/mame/drivers/cave.c
r17788r17789
263263   }
264264   else
265265   {
266      logerror("CPU #1 - PC %04X: Sound Buffer 2 Underflow Error\n", cpu_get_pc(&space.device()));
266      logerror("CPU #1 - PC %04X: Sound Buffer 2 Underflow Error\n", space.device().safe_pc());
267267      return 0xff;
268268   }
269269}
r17788r17789
276276   if (m_soundbuf_len < 32)
277277      m_soundbuf_len++;
278278   else
279      logerror("CPU #1 - PC %04X: Sound Buffer 2 Overflow Error\n", cpu_get_pc(&space.device()));
279      logerror("CPU #1 - PC %04X: Sound Buffer 2 Overflow Error\n", space.device().safe_pc());
280280}
281281
282282
r17788r17789
10511051WRITE8_MEMBER(cave_state::hotdogst_rombank_w)
10521052{
10531053   if (data & ~0x0f)
1054      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
1054      logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data);
10551055
10561056   membank("bank2")->set_entry(data & 0x0f);
10571057}
r17788r17789
10881088WRITE8_MEMBER(cave_state::mazinger_rombank_w)
10891089{
10901090   if (data & ~0x07)
1091      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
1091      logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data);
10921092
10931093   membank("bank2")->set_entry(data & 0x07);
10941094}
r17788r17789
11191119WRITE8_MEMBER(cave_state::metmqstr_rombank_w)
11201120{
11211121   if (data & ~0x0f)
1122      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
1122      logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data);
11231123
11241124   membank("bank1")->set_entry(data & 0x0f);
11251125}
r17788r17789
11671167WRITE8_MEMBER(cave_state::pwrinst2_rombank_w)
11681168{
11691169   if (data & ~0x07)
1170      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
1170      logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data);
11711171
11721172   membank("bank1")->set_entry(data & 0x07);
11731173}
r17788r17789
12091209WRITE8_MEMBER(cave_state::sailormn_rombank_w)
12101210{
12111211   if (data & ~0x1f)
1212      logerror("CPU #1 - PC %04X: Bank %02X\n", cpu_get_pc(&space.device()), data);
1212      logerror("CPU #1 - PC %04X: Bank %02X\n", space.device().safe_pc(), data);
12131213
12141214   membank("bank1")->set_entry(data & 0x1f);
12151215}
trunk/src/mame/drivers/atarigt.c
r17788r17789
283283        Read ($38488)
284284*/
285285
286   if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", cpu_get_previouspc(&space->device()), offset, data);
286   if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", space->device().safe_pcbase(), offset, data);
287287
288288   /* track accesses */
289289   tmek_update_mode(state, offset);
r17788r17789
299299static void tmek_protection_r(address_space *space, offs_t offset, UINT16 *data)
300300{
301301   atarigt_state *state = space->machine().driver_data<atarigt_state>();
302   if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", cpu_get_previouspc(&space->device()), offset);
302   if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", space->device().safe_pcbase(), offset);
303303
304304   /* track accesses */
305305   tmek_update_mode(state, offset);
r17788r17789
368368   atarigt_state *state = space->machine().driver_data<atarigt_state>();
369369   if (LOG_PROTECTION)
370370   {
371   UINT32 pc = cpu_get_previouspc(&space->device());
371   UINT32 pc = space->device().safe_pcbase();
372372   switch (pc)
373373   {
374374      /* protection code from 20f90 - 21000 */
r17788r17789
401401
402402      /* catch anything else */
403403      default:
404         logerror("%06X:Unknown protection W@%06X = %04X\n", cpu_get_previouspc(&space->device()), offset, data);
404         logerror("%06X:Unknown protection W@%06X = %04X\n", space->device().safe_pcbase(), offset, data);
405405         break;
406406   }
407407   }
r17788r17789
442442
443443if (LOG_PROTECTION)
444444{
445   UINT32 pc = cpu_get_previouspc(&space->device());
445   UINT32 pc = space->device().safe_pcbase();
446446   UINT32 p1, p2, a6;
447447   switch (pc)
448448   {
r17788r17789
505505
506506      /* catch anything else */
507507      default:
508         logerror("%06X:Unknown protection R@%06X\n", cpu_get_previouspc(&space->device()), offset);
508         logerror("%06X:Unknown protection R@%06X\n", space->device().safe_pcbase(), offset);
509509         break;
510510   }
511511}
r17788r17789
12441244
12451245WRITE32_MEMBER(atarigt_state::tmek_pf_w)
12461246{
1247   offs_t pc = cpu_get_pc(&space.device());
1247   offs_t pc = space.device().safe_pc();
12481248
12491249   /* protected version */
12501250   if (pc == 0x2EB3C || pc == 0x2EB48)
12511251   {
1252      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);
1252      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);
12531253      /* skip these writes to make more stuff visible */
12541254      return;
12551255   }
12561256
12571257   /* unprotected version */
12581258   if (pc == 0x25834 || pc == 0x25860)
1259      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);
1259      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);
12601260
12611261   atarigen_playfield32_w(&space, offset, data, mem_mask);
12621262}
trunk/src/mame/drivers/rollerg.c
r17788r17789
2424
2525WRITE8_MEMBER(rollerg_state::rollerg_0010_w)
2626{
27   logerror("%04x: write %02x to 0010\n",cpu_get_pc(&space.device()), data);
27   logerror("%04x: write %02x to 0010\n",space.device().safe_pc(), data);
2828
2929   /* bits 0/1 are coin counters */
3030   coin_counter_w(machine(), 0, data & 0x01);
trunk/src/mame/drivers/pirates.c
r17788r17789
123123      /* bit 7 used (function unknown) */
124124   }
125125
126//  logerror("%06x: out_w %04x\n",cpu_get_pc(&space.device()),data);
126//  logerror("%06x: out_w %04x\n",space.device().safe_pc(),data);
127127}
128128
129129CUSTOM_INPUT_MEMBER(pirates_state::prot_r)
r17788r17789
139139       602e and 62a6 */
140140   /* For Genix, see 6576 for setting values and 67c2,d3b4 and dbc2 for tests. */
141141
142   pc = cpu_get_pc(machine().device("main"));
142   pc = machine().device("main")->safe_pc();
143143   if (pc == 0x6134)
144144   {
145145      bit = prot & 1;
trunk/src/mame/drivers/royalmah.c
r17788r17789
395395
396396   m_suzume_bank = data;
397397
398logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data);
398logerror("%04x: bank %02x\n",space.device().safe_pc(),data);
399399
400400   /* bits 6, 4 and 3 used for something input related? */
401401
r17788r17789
430430   UINT8 *rom = memregion("maincpu")->base();
431431   int address;
432432
433logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data);
433logerror("%04x: bank %02x\n",space.device().safe_pc(),data);
434434
435435   if (data == 0) return;   // tontonb fix?
436436
r17788r17789
448448   UINT8 *rom = memregion("maincpu")->base();
449449   int address;
450450
451//logerror("%04x: bank %02x\n",cpu_get_pc(&space.device()),data);
451//logerror("%04x: bank %02x\n",space.device().safe_pc(),data);
452452
453453   m_dsw_select = data & 0x60;
454454
r17788r17789
896896      case 0x9011:   return ioport("SYSTEM")->read();
897897   }
898898
899   logerror("%04X: unmapped input read at %04X\n", cpu_get_pc(&space.device()), offset);
899   logerror("%04X: unmapped input read at %04X\n", space.device().safe_pc(), offset);
900900   return 0xff;
901901}
902902
r17788r17789
925925         return;
926926   }
927927
928   logerror("%04X: unmapped input write at %04X = %02X\n", cpu_get_pc(&space.device()), offset,data);
928   logerror("%04X: unmapped input write at %04X = %02X\n", space.device().safe_pc(), offset,data);
929929}
930930
931931WRITE8_MEMBER(royalmah_state::mjifb_videoram_w)
r17788r17789
10051005      case 0x9011:   return ioport("SYSTEM")->read();
10061006   }
10071007
1008   logerror("%04X: unmapped input read at %04X\n", cpu_get_pc(&space.device()), offset);
1008   logerror("%04X: unmapped input read at %04X\n", space.device().safe_pc(), offset);
10091009   return 0xff;
10101010}
10111011
r17788r17789
10311031         return;
10321032   }
10331033
1034   logerror("%04X: unmapped input write at %04X = %02X\n", cpu_get_pc(&space.device()), offset,data);
1034   logerror("%04X: unmapped input write at %04X = %02X\n", space.device().safe_pc(), offset,data);
10351035}
10361036
10371037static ADDRESS_MAP_START( mjdejavu_map, AS_PROGRAM, 8, royalmah_state )
r17788r17789
11231123      case 0x03: return ioport("DSW4")->read();
11241124      case 0x04: return ioport("DSWTOP")->read();
11251125   }
1126   logerror("%04X: unmapped dsw read %02X\n", cpu_get_pc(&space.device()), m_dsw_select);
1126   logerror("%04X: unmapped dsw read %02X\n", space.device().safe_pc(), m_dsw_select);
11271127   return 0xff;
11281128}
11291129
r17788r17789
11921192      return rtc->read(space, offset & 0xf);
11931193   }
11941194
1195   logerror("%04X: unmapped IO read at %04X\n", cpu_get_pc(&space.device()), offset);
1195   logerror("%04X: unmapped IO read at %04X\n", space.device().safe_pc(), offset);
11961196   return 0xff;
11971197}
11981198
r17788r17789
12151215      return;
12161216   }
12171217
1218   logerror("%04X: unmapped IO write at %04X = %02X\n", cpu_get_pc(&space.device()), offset,data);
1218   logerror("%04X: unmapped IO write at %04X = %02X\n", space.device().safe_pc(), offset,data);
12191219}
12201220
12211221WRITE8_MEMBER(royalmah_state::mjvegasa_coin_counter_w)
trunk/src/mame/drivers/mquake.c
r17788r17789
100100static WRITE16_HANDLER( output_w )
101101{
102102   if (ACCESSING_BITS_0_7)
103      logerror("%06x:output_w(%x) = %02x\n", cpu_get_pc(&space->device()), offset, data);
103      logerror("%06x:output_w(%x) = %02x\n", space->device().safe_pc(), offset, data);
104104}
105105
106106
r17788r17789
108108{
109109   if (offset == 1)
110110      return space->machine().root_device().ioport("COINCHIP")->read();
111   logerror("%06x:coin_chip_r(%02x) & %04x\n", cpu_get_pc(&space->device()), offset, mem_mask);
111   logerror("%06x:coin_chip_r(%02x) & %04x\n", space->device().safe_pc(), offset, mem_mask);
112112   return 0xffff;
113113}
114114
115115static WRITE16_HANDLER( coin_chip_w )
116116{
117   logerror("%06x:coin_chip_w(%02x) = %04x & %04x\n", cpu_get_pc(&space->device()), offset, data, mem_mask);
117   logerror("%06x:coin_chip_w(%02x) = %04x & %04x\n", space->device().safe_pc(), offset, data, mem_mask);
118118}
119119
120120// inputs at 282000, 282002 (full word)
trunk/src/mame/drivers/nmk16.c
r17788r17789
229229
230230WRITE16_MEMBER(nmk16_state::tharrier_mcu_control_w)
231231{
232//  logerror("%04x: mcu_control_w %02x\n",cpu_get_pc(&space.device()),data);
232//  logerror("%04x: mcu_control_w %02x\n",space.device().safe_pc(),data);
233233}
234234
235235READ16_MEMBER(nmk16_state::tharrier_mcu_r)
r17788r17789
245245
246246      int res;
247247
248      if (cpu_get_pc(&space.device())==0x8aa) res = (m_mainram[0x9064/2])|0x20; /* Task Force Harrier */
249      else if (cpu_get_pc(&space.device())==0x8ce) res = (m_mainram[0x9064/2])|0x60; /* Task Force Harrier */
248      if (space.device().safe_pc()==0x8aa) res = (m_mainram[0x9064/2])|0x20; /* Task Force Harrier */
249      else if (space.device().safe_pc()==0x8ce) res = (m_mainram[0x9064/2])|0x60; /* Task Force Harrier */
250250      else
251251      {
252252         res = to_main[m_prot_count++];
r17788r17789
46594659      flip_screen_set(data & 1);
46604660
46614661   if (data & (~1))
4662      logerror("%06x: unknown flip screen bit written %04x\n", cpu_get_pc(&space.device()), data);
4662      logerror("%06x: unknown flip screen bit written %04x\n", space.device().safe_pc(), data);
46634663}
46644664#endif
46654665
r17788r17789
47084708   if (data & (~3))
47094709      logerror("%s: invalid oki bank %02x\n", machine().describe_context(), data);
47104710
4711//  logerror("%04x: oki bank %02x\n", cpu_get_pc(&space->device()), data);
4711//  logerror("%04x: oki bank %02x\n", space->device().safe_pc(), data);
47124712}
47134713
47144714static ADDRESS_MAP_START( twinactn_sound_cpu, AS_PROGRAM, 8, nmk16_state )
trunk/src/emu/debug/dvdisasm.c
r17788r17789
202202      case DCH_HOME:            // set the active column to the PC
203203      {
204204         const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
205         offs_t pc = source.m_space->address_to_byte(cpu_get_pc(&source.m_device)) & source.m_space->logbytemask();
205         offs_t pc = source.m_space->address_to_byte(source.m_device.safe_pc()) & source.m_space->logbytemask();
206206
207207         // figure out which row the pc is on
208208         for (int curline = 0; curline < m_allocated.y; curline++)
r17788r17789
468468{
469469   const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
470470
471   offs_t pc = cpu_get_pc(&source.m_device);
471   offs_t pc = source.m_device.safe_pc();
472472   offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask();
473473
474474   // update our context; if the expression is dirty, recompute
trunk/src/emu/cpu/m68000/68340ser.c
r17788r17789
1212
1313   if (serial)
1414   {
15      int pc = cpu_get_pc(&space->device());
15      int pc = space->device().safe_pc();
1616      logerror("%08x m68340_internal_serial_r %08x, (%08x)\n", pc, offset*4,mem_mask);
1717   }
1818
r17788r17789
2727
2828   if (serial)
2929   {
30      int pc = cpu_get_pc(&space->device());
30      int pc = space->device().safe_pc();
3131      logerror("%08x m68340_internal_serial_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
3232   }
3333
trunk/src/emu/cpu/m68000/68307sim.c
r17788r17789
1010   m68307_sim* sim = m68k->m68307SIM;
1111   assert(sim != NULL);
1212
13   int pc = cpu_get_pc(&space->device());
13   int pc = space->device().safe_pc();
1414
1515   if (sim)
1616   {
r17788r17789
4747   m68307_sim* sim = m68k->m68307SIM;
4848   assert(sim != NULL);
4949
50   int pc = cpu_get_pc(&space->device());
50   int pc = space->device().safe_pc();
5151
5252   if (sim)
5353   {
r17788r17789
152152
153153UINT16 m68307_sim::read_padat(address_space *space, UINT16 mem_mask)
154154{
155   int pc = cpu_get_pc(&space->device());
155   int pc = space->device().safe_pc();
156156   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
157157
158158   if (m68k->m_m68307_porta_r)
r17788r17789
179179
180180void m68307_sim::write_padat(address_space *space, UINT16 data, UINT16 mem_mask)
181181{
182   int pc = cpu_get_pc(&space->device());
182   int pc = space->device().safe_pc();
183183   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
184184   COMBINE_DATA(&m_padat);
185185
r17788r17789
205205
206206UINT16 m68307_sim::read_pbdat(address_space *space, UINT16 mem_mask)
207207{
208   int pc = cpu_get_pc(&space->device());
208   int pc = space->device().safe_pc();
209209   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
210210
211211   if (m68k->m_m68307_portb_r)
r17788r17789
232232
233233void m68307_sim::write_pbdat(address_space *space, UINT16 data, UINT16 mem_mask)
234234{
235   int pc = cpu_get_pc(&space->device());
235   int pc = space->device().safe_pc();
236236   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
237237   COMBINE_DATA(&m_pbdat);
238238
trunk/src/emu/cpu/m68000/68307bus.c
r17788r17789
1414
1515   if (mbus)
1616   {
17      int pc = cpu_get_pc(&space->device());
17      int pc = space->device().safe_pc();
1818
1919
2020      switch (offset)
r17788r17789
6161
6262   if (mbus)
6363   {
64      int pc = cpu_get_pc(&space->device());
64      int pc = space->device().safe_pc();
6565
6666      switch (offset)
6767      {
trunk/src/emu/cpu/m68000/68307ser.c
r17788r17789
2929      else
3030      {
3131
32         int pc = cpu_get_pc(&space->device());
32         int pc = space->device().safe_pc();
3333
3434         switch (offset)
3535         {
r17788r17789
9797   m68307_serial* serial = m68k->m68307SERIAL;
9898   assert(serial != NULL);
9999
100   int pc = cpu_get_pc(&space->device());
100   int pc = space->device().safe_pc();
101101
102102   if (serial)
103103   {
trunk/src/emu/cpu/m68000/68340dma.c
r17788r17789
1212
1313   if (dma)
1414   {
15      int pc = cpu_get_pc(&space->device());
15      int pc = space->device().safe_pc();
1616      logerror("%08x m68340_internal_dma_r %08x, (%08x)\n", pc, offset*4,mem_mask);
1717   }
1818
r17788r17789
2727
2828   if (dma)
2929   {
30      int pc = cpu_get_pc(&space->device());
30      int pc = space->device().safe_pc();
3131      logerror("%08x m68340_internal_dma_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
3232   }
3333}
trunk/src/emu/cpu/m68000/68340tmu.c
r17788r17789
1313
1414   if (timer)
1515   {
16      int pc = cpu_get_pc(&space->device());
16      int pc = space->device().safe_pc();
1717      logerror("%08x m68340_internal_timer_r %08x, (%08x)\n", pc, offset*4,mem_mask);
1818   }
1919
r17788r17789
2828
2929   if (timer)
3030   {
31      int pc = cpu_get_pc(&space->device());
31      int pc = space->device().safe_pc();
3232      logerror("%08x m68340_internal_timer_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
3333   }
3434}
trunk/src/emu/cpu/m68000/68307tmu.c
r17788r17789
1212
1313   if (timer)
1414   {
15      int pc = cpu_get_pc(&space->device());
15      int pc = space->device().safe_pc();
1616      int which = offset & 0x8;
1717
1818      switch (offset&0x7)
r17788r17789
4040
4141   if (timer)
4242   {
43      int pc = cpu_get_pc(&space->device());
43      int pc = space->device().safe_pc();
4444      int which = offset & 0x8;
4545
4646      switch (offset&0x7)
trunk/src/emu/cpu/m68000/m68kcpu.c
r17788r17789
20772077{
20782078   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
20792079
2080   int pc = cpu_get_pc(&space->device());
2080   int pc = space->device().safe_pc();
20812081   logerror("%08x m68307_internal_base_r %08x, (%04x)\n", pc, offset*2,mem_mask);
20822082
20832083   switch (offset<<1)
r17788r17789
20962096{
20972097   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
20982098
2099   int pc = cpu_get_pc(&space->device());
2099   int pc = space->device().safe_pc();
21002100   logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", pc, offset*2,data,mem_mask);
21012101   int base = 0;
21022102   //int mask = 0;
r17788r17789
27642764static READ32_HANDLER( m68340_internal_base_r )
27652765{
27662766   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
2767   int pc = cpu_get_pc(&space->device());
2767   int pc = space->device().safe_pc();
27682768   logerror("%08x m68340_internal_base_r %08x, (%08x)\n", pc, offset*4,mem_mask);
27692769   return m68k->m68340_base;
27702770}
r17788r17789
27732773{
27742774   m68ki_cpu_core *m68k = m68k_get_safe_token(&space->device());
27752775
2776   int pc = cpu_get_pc(&space->device());
2776   int pc = space->device().safe_pc();
27772777   logerror("%08x m68340_internal_base_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask);
27782778
27792779   // other conditions?
trunk/src/emu/cpu/m68000/68340sim.c
r17788r17789
1212
1313   if (sim)
1414   {
15      int pc = cpu_get_pc(&space->device());
15      int pc = space->device().safe_pc();
1616
1717      switch (offset<<1)
1818      {
r17788r17789
6363
6464   if (sim)
6565   {
66      int pc = cpu_get_pc(&space->device());
66      int pc = space->device().safe_pc();
6767
6868      switch (offset)
6969      {
r17788r17789
119119
120120   if (sim)
121121   {
122      int pc = cpu_get_pc(&space->device());
122      int pc = space->device().safe_pc();
123123
124124      switch (offset<<2)
125125      {
r17788r17789
149149
150150   if (sim)
151151   {
152      int pc = cpu_get_pc(&space->device());
152      int pc = space->device().safe_pc();
153153
154154      switch (offset<<1)
155155      {
r17788r17789
199199
200200   if (sim)
201201   {
202      int pc = cpu_get_pc(&space->device());
202      int pc = space->device().safe_pc();
203203
204204      switch (offset)
205205      {
r17788r17789
252252
253253   if (sim)
254254   {
255      int pc = cpu_get_pc(&space->device());
255      int pc = space->device().safe_pc();
256256
257257      switch (offset<<2)
258258      {
trunk/src/emu/cpu/tms34010/tms34010.c
r17788r17789
12241224         break;
12251225
12261226      case REG_PMASK:
1227         if (data) logerror("Plane masking not supported. PC=%08X\n", cpu_get_pc(&space->device()));
1227         if (data) logerror("Plane masking not supported. PC=%08X\n", space->device().safe_pc());
12281228         break;
12291229
12301230      case REG_DPYCTL:
r17788r17789
13751375
13761376      case REG020_PMASKL:
13771377      case REG020_PMASKH:
1378         if (data) logerror("Plane masking not supported. PC=%08X\n", cpu_get_pc(&space->device()));
1378         if (data) logerror("Plane masking not supported. PC=%08X\n", space->device().safe_pc());
13791379         break;
13801380
13811381      case REG020_DPYCTL:
trunk/src/emu/cpu/tms34010/34010gfx.c
r17788r17789
8484      int diff, cycles = 3;
8585
8686      if (WINDOW_CHECKING(tms) == 2)
87         logerror("%08x: %s apply_window window mode %d not supported!\n", cpu_get_pc(tms->device), inst_name, WINDOW_CHECKING(tms));
87         logerror("%08x: %s apply_window window mode %d not supported!\n", tms->device->safe_pc(), inst_name, WINDOW_CHECKING(tms));
8888
8989      CLR_V(tms);
9090      if (WINDOW_CHECKING(tms) == 1)
trunk/src/emu/cpu/tlcs90/tlcs90.c
r17788r17789
19671967            break;
19681968
19691969         default:
1970            fatalerror("%04x: unimplemented opcode, op=%02x\n",cpu_get_pc(device),cpustate->op);
1970            fatalerror("%04x: unimplemented opcode, op=%02x\n",device->safe_pc(),cpustate->op);
19711971      }
19721972
19731973      if ( cpustate->op != EI )
trunk/src/emu/cpu/m6502/opsce02.h
r17788r17789
291291   t1=RDOPARG();                           \
292292   t2=RDOPARG();                           \
293293   t3=RDOPARG();                           \
294   logerror("m65ce02 at pc:%.4x reserved op aug %.2x %.2x %.2x\n", cpu_get_pc(cpustate->device),t1,t2,t3);
294   logerror("m65ce02 at pc:%.4x reserved op aug %.2x %.2x %.2x\n", cpustate->device->safe_pc(),t1,t2,t3);
295295
296296/* 65ce02 ******************************************************
297297 *  BBR Branch if bit is reset
trunk/src/emu/cpu/sh2/sh2comn.c
r17788r17789
522522   //      logerror("sh2_internal_w:  Write %08x (%x), %08x @ %08x\n", 0xfffffe00+offset*4, offset, data, mem_mask);
523523
524524//    if(offset != 0x20)
525//        printf("sh2_internal_w:  Write %08x (%x), %08x @ %08x (PC %x)\n", 0xfffffe00+offset*4, offset, data, mem_mask, cpu_get_pc(&space->device()));
525//        printf("sh2_internal_w:  Write %08x (%x), %08x @ %08x (PC %x)\n", 0xfffffe00+offset*4, offset, data, mem_mask, space->device().safe_pc());
526526
527527   switch( offset )
528528   {
trunk/src/emu/cpu/m6800/m6800.c
r17788r17789
16011601   case IO_ICR2H:
16021602   case IO_ICR2L:
16031603   default:
1604      logerror("M6801 '%s' PC %04x: warning - read from reserved internal register %02x\n",space->device().tag(),cpu_get_pc(&space->device()),offset);
1604      logerror("M6801 '%s' PC %04x: warning - read from reserved internal register %02x\n",space->device().tag(),space->device().safe_pc(),offset);
16051605   }
16061606
16071607   return data;
r17788r17789
16351635         write_port2(cpustate);
16361636
16371637         if (cpustate->port2_ddr & 2)
1638            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()));
1638            logerror("CPU '%s' PC %04x: warning - port 2 bit 1 set as output (OLVL) - not supported\n",space->device().tag(),space->device().safe_pc());
16391639      }
16401640      break;
16411641
r17788r17789
17701770   case IO_ICRH:
17711771   case IO_ICRL:
17721772   case IO_RDR:
1773      //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);
1773      //logerror("CPU '%s' PC %04x: warning - write %02x to read only internal register %02x\n",space->device().tag(),space->device().safe_pc(),data,offset);
17741774      break;
17751775
17761776   case IO_P3CSR:
r17788r17789
18321832   case IO_ICR2H:
18331833   case IO_ICR2L:
18341834   default:
1835      logerror("M6801 '%s' PC %04x: warning - write %02x to reserved internal register %02x\n",space->device().tag(),cpu_get_pc(&space->device()),data,offset);
1835      logerror("M6801 '%s' PC %04x: warning - write %02x to reserved internal register %02x\n",space->device().tag(),space->device().safe_pc(),data,offset);
18361836      break;
18371837   }
18381838}
trunk/src/emu/video/hd63484.c
r17788r17789
14681468
14691469READ16_DEVICE_HANDLER( hd63484_status_r )
14701470{
1471//  if (cpu_get_pc(&space->device()) != 0xfced6 && cpu_get_pc(&space->device()) != 0xfe1d6)
1472//      logerror("%05x: HD63484 status read\n",cpu_get_pc(&space->device()));
1471//  if (space->device().safe_pc() != 0xfced6 && space->device().safe_pc() != 0xfe1d6)
1472//      logerror("%05x: HD63484 status read\n",space->device().safe_pc());
14731473
14741474   return 0xff22 | (device->machine().rand() & 0x0004);   /* write FIFO ready + command end    +  (read FIFO ready or read FIFO not ready) */
14751475}
r17788r17789
14961496      hd63484->regno += 2;   /* autoincrement */
14971497
14981498#if LOG_COMMANDS
1499//  logerror("PC %05x: HD63484 register %02x write %04x\n", cpu_get_pc(&space->device()), hd63484->regno, hd63484->reg[hd63484->regno/2]);
1499//  logerror("PC %05x: HD63484 register %02x write %04x\n", space->device().safe_pc(), hd63484->regno, hd63484->reg[hd63484->regno/2]);
15001500#endif
15011501
15021502   if (hd63484->regno == 0)   /* FIFO */
r17788r17789
15131513   else if (hd63484->regno == 0)
15141514   {
15151515#if LOG_COMMANDS
1516//      logerror("%05x: HD63484 read FIFO\n", cpu_get_pc(&space->device()));
1516//      logerror("%05x: HD63484 read FIFO\n", space->device().safe_pc());
15171517#endif
15181518      res = hd63484->readfifo;
15191519   }
15201520   else
15211521   {
15221522#if LOG_COMMANDS
1523//      logerror("%05x: HD63484 read register %02x\n", cpu_get_pc(&space->device()), hd63484->regno);
1523//      logerror("%05x: HD63484 read register %02x\n", space->device().safe_pc(), hd63484->regno);
15241524#endif
15251525      res = 0;
15261526   }
trunk/src/emu/video/voodoo.c
r17788r17789
38663866      /* don't log multiple identical status reads from the same address */
38673867      if (regnum == status)
38683868      {
3869         offs_t pc = cpu_get_pc(v->cpu);
3869         offs_t pc = v->cpu->safe_pc();
38703870         if (pc == v->last_status_pc && result == v->last_status_value)
38713871            logit = FALSE;
38723872         v->last_status_pc = pc;
trunk/src/emu/video/pc_vga.c
r17788r17789
16671667      data = vga_crtc_r(space, offset);
16681668   if(offset == 8)
16691669   {
1670      logerror("VGA: 0x3d8 read at %08x\n",cpu_get_pc(&space->device()));
1670      logerror("VGA: 0x3d8 read at %08x\n",space->device().safe_pc());
16711671      data = 0; // TODO: PC-200 reads back CGA register here, everything else returns open bus OR CGA emulation of register 0x3d8
16721672   }
16731673
trunk/src/emu/distate.c
r17788r17789
523523   m_state_list.append(*entry);
524524
525525   // set the fast entry if applicable
526   if (index >= k_fast_state_min && index <= k_fast_state_max)
527      m_fast_state[index - k_fast_state_min] = entry;
526   if (index >= FAST_STATE_MIN && index <= FAST_STATE_MAX)
527      m_fast_state[index - FAST_STATE_MIN] = entry;
528528
529529   return *entry;
530530}
r17788r17789
595595const device_state_entry *device_state_interface::state_find_entry(int index)
596596{
597597   // use fast lookup if possible
598   if (index >= k_fast_state_min && index <= k_fast_state_max)
599      return m_fast_state[index - k_fast_state_min];
598   if (index >= FAST_STATE_MIN && index <= FAST_STATE_MAX)
599      return m_fast_state[index - FAST_STATE_MIN];
600600
601601   // otherwise, scan the first
602602   for (const device_state_entry *entry = m_state_list.first(); entry != NULL; entry = entry->m_next)
trunk/src/emu/distate.h
r17788r17789
186186   const device_state_entry *state_find_entry(int index);
187187
188188   // constants
189   static const int k_fast_state_min = -4;                     // range for fast state
190   static const int k_fast_state_max = 256;                  // lookups
189   static const int FAST_STATE_MIN = -4;                     // range for fast state
190   static const int FAST_STATE_MAX = 256;                     // lookups
191191
192192   // state
193193   simple_list<device_state_entry>         m_state_list;         // head of state list
194   device_state_entry *               m_fast_state[k_fast_state_max + 1 - k_fast_state_min];
194   device_state_entry *               m_fast_state[FAST_STATE_MAX + 1 - FAST_STATE_MIN];
195195                                                   // fast access to common entries
196196};
197197
r17788r17789
205205//**************************************************************************
206206
207207//-------------------------------------------------
208//  device_t::safe_pc - return the current PC
209//   or 0 if no state object exists
210//-------------------------------------------------
211
212inline offs_t device_t::safe_pc()
213{
214   return (m_state != NULL) ? m_state->pc() : 0;
215}
216
217
218//-------------------------------------------------
219//  device_t::safe_pcbase - return the current PC
220//   base or 0 if no state object exists
221//-------------------------------------------------
222
223inline offs_t device_t::safe_pcbase()
224{
225   return (m_state != NULL) ? m_state->pcbase() : 0;
226}
227
228
229//-------------------------------------------------
208230//  device_state - return a pointer to the device
209231//  state interface for this device
210232//-------------------------------------------------
trunk/src/emu/sound/nile.c
r17788r17789
7878
7979   COMBINE_DATA(&info->ctrl);
8080
81//  printf("CTRL: %04x -> %04x (PC=%x)\n", ctrl, info->ctrl, cpu_get_pc(&space->device()));
81//  printf("CTRL: %04x -> %04x (PC=%x)\n", ctrl, info->ctrl, space->device().safe_pc());
8282
8383   ctrl^=info->ctrl;
8484}
r17788r17789
133133      info->vpos[v] = info->frac[v] = info->lponce[v] = 0;
134134   }
135135
136   //printf("v%02d: %04x to reg %02d (PC=%x)\n", v, info->sound_regs[offset], r, cpu_get_pc(&space->device()));
136   //printf("v%02d: %04x to reg %02d (PC=%x)\n", v, info->sound_regs[offset], r, space->device().safe_pc());
137137}
138138
139139static STREAM_UPDATE( nile_update )
trunk/src/emu/devcpu.h
r17788r17789
294294
295295// CPU timing
296296#define cpu_get_reg(cpu, _reg)            device_state(cpu)->state(_reg)
297#define   cpu_get_previouspc(cpu)            ((offs_t)device_state(cpu)->state(STATE_GENPCBASE))
298#define   cpu_get_pc(cpu)                  ((offs_t)device_state(cpu)->state(STATE_GENPC))
299
300297#define cpu_set_reg(cpu, _reg, val)         device_state(cpu)->set_state(_reg, val)
301298
302299// helpers for using machine/cputag instead of cpu objects
trunk/src/emu/device.h
r17788r17789
230230
231231   // debugging
232232   device_debug *debug() const { return m_debug; }
233   offs_t safe_pc();
234   offs_t safe_pcbase();
233235
234236   void set_default_bios(UINT8 bios) { m_default_bios = bios; }
235237   void set_system_bios(UINT8 bios) { m_system_bios = bios; }
trunk/src/emu/machine/ldpr8210.c
r17788r17789
544544         break;
545545
546546      default:
547         mame_printf_debug("%03X:Unknown PR-8210 PIA read from offset %02X\n", cpu_get_pc(&space.device()), offset);
547         mame_printf_debug("%03X:Unknown PR-8210 PIA read from offset %02X\n", space.device().safe_pc(), offset);
548548         break;
549549   }
550550   return result;
r17788r17789
616616
617617      // no other writes known
618618      default:
619         mame_printf_debug("%03X:Unknown PR-8210 PIA write to offset %02X = %02X\n", cpu_get_pc(&space.device()), offset, data);
619         mame_printf_debug("%03X:Unknown PR-8210 PIA write to offset %02X = %02X\n", space.device().safe_pc(), offset, data);
620620         break;
621621   }
622622}
r17788r17789
10971097   {
10981098      int direction = (data & 0x08) ? 1 : -1;
10991099      if (LOG_SIMUTREK)
1100         printf("%3d:JUMP TRG (Simutrek PC=%03X)\n", screen().vpos(), cpu_get_pc(&space.device()));
1100         printf("%3d:JUMP TRG (Simutrek PC=%03X)\n", screen().vpos(), space.device().safe_pc());
11011101      advance_slider(direction);
11021102   }
11031103
11041104   // bit $04 controls who owns the JUMP TRG command
11051105   if (LOG_SIMUTREK && ((data ^ prev) & 0x04))
1106      printf("%3d:Simutrek ownership line = %d (Simutrek PC=%03X)\n", screen().vpos(), (data >> 2) & 1, cpu_get_pc(&space.device()));
1106      printf("%3d:Simutrek ownership line = %d (Simutrek PC=%03X)\n", screen().vpos(), (data >> 2) & 1, space.device().safe_pc());
11071107   m_controlnext = (~data >> 2) & 1;
11081108
11091109   // bits $03 control something (status?)
trunk/src/emu/machine/ldvp931.c
r17788r17789
382382
383383   if (LOG_PORTS && (m_i8049_out0 ^ data) & 0xff)
384384   {
385      printf("%03X:out0:", cpu_get_pc(&space.device()));
385      printf("%03X:out0:", space.device().safe_pc());
386386      if ( (data & 0x80)) printf(" ???");
387387      if ( (data & 0x40)) printf(" LED1");
388388      if ( (data & 0x20)) printf(" LED2");
r17788r17789
422422
423423   if (LOG_PORTS && (m_i8049_out1 ^ data) & 0x08)
424424   {
425      mame_printf_debug("%03X:out1:", cpu_get_pc(&space.device()));
425      mame_printf_debug("%03X:out1:", space.device().safe_pc());
426426      if (!(data & 0x08)) mame_printf_debug(" SMS");
427427      mame_printf_debug("\n");
428428      m_i8049_out1 = data;
r17788r17789
570570
571571   if (LOG_PORTS && (m_i8049_port1 ^ data) & 0x1f)
572572   {
573      printf("%03X:port1:", cpu_get_pc(&space.device()));
573      printf("%03X:port1:", space.device().safe_pc());
574574      if (!(data & 0x10)) printf(" SPEED");
575575      if (!(data & 0x08)) printf(" TIMENABLE");
576576      if (!(data & 0x04)) printf(" REV");
trunk/src/emu/machine/k056230.c
r17788r17789
8282      }
8383   }
8484
85//  mame_printf_debug("k056230_r: %d at %08X\n", offset, cpu_get_pc(&space->device()));
85//  mame_printf_debug("k056230_r: %d at %08X\n", offset, space->device().safe_pc());
8686
8787   return 0;
8888}
r17788r17789
132132         break;
133133      }
134134   }
135//  mame_printf_debug("k056230_w: %d, %02X at %08X\n", offset, data, cpu_get_pc(&space->device()));
135//  mame_printf_debug("k056230_w: %d, %02X at %08X\n", offset, data, space->device().safe_pc());
136136}
137137
138138READ32_DEVICE_HANDLER_TRAMPOLINE(k056230, lanc_ram_r)
139139{
140   //mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, cpu_get_pc(&space->device()));
140   //mame_printf_debug("LANC_RAM_r: %08X, %08X at %08X\n", offset, mem_mask, space->device().safe_pc());
141141   return m_ram[offset & 0x7ff];
142142}
143143
144144WRITE32_DEVICE_HANDLER_TRAMPOLINE(k056230, lanc_ram_w)
145145{
146   //mame_printf_debug("LANC_RAM_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(&space->device()));
146   //mame_printf_debug("LANC_RAM_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space->device().safe_pc());
147147   COMBINE_DATA(m_ram + (offset & 0x7ff));
148148}
trunk/src/emu/machine/53c810.c
r17788r17789
393393
394394UINT8 lsi53c810_device::lsi53c810_reg_r( int offset )
395395{
396//   logerror("53c810: read reg %d:0x%x (PC=%x)\n", offset, offset, cpu_get_pc(&space->device()));
396//   logerror("53c810: read reg %d:0x%x (PC=%x)\n", offset, offset, space->device().safe_pc());
397397   switch(offset)
398398   {
399399      case 0x00:      /* SCNTL0 */
r17788r17789
476476
477477void lsi53c810_device::lsi53c810_reg_w(int offset, UINT8 data)
478478{
479//   logerror("53c810: %02x to reg %d:0x%x (PC=%x)\n", data, offset, offset, cpu_get_pc(&space->device()));
479//   logerror("53c810: %02x to reg %d:0x%x (PC=%x)\n", data, offset, offset, space->device().safe_pc());
480480   switch(offset)
481481   {
482482      case 0x00:      /* SCNTL0 */
trunk/src/emu/machine/wd33c93.c
r17788r17789
487487
488488      case 1:
489489      {
490         LOG(( "WD33C93: PC=%08x - Write REG=%02x, data = %02x\n", cpu_get_pc(&space.device()), sasr, data ));
490         LOG(( "WD33C93: PC=%08x - Write REG=%02x, data = %02x\n", space.device().safe_pc(), sasr, data ));
491491
492492         /* update the register */
493493         regs[sasr] = data;
r17788r17789
495495         /* if we receive a command, schedule to process it */
496496         if ( sasr == WD_COMMAND )
497497         {
498            LOG(( "WDC33C93: PC=%08x - Executing command %08x - unit %d\n", cpu_get_pc(&space.device()), data, getunit() ));
498            LOG(( "WDC33C93: PC=%08x - Executing command %08x - unit %d\n", space.device().safe_pc(), data, getunit() ));
499499
500500            /* signal we're processing it */
501501            regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
r17788r17789
646646               irq_callback(machine(), 0);
647647            }
648648
649            LOG(( "WD33C93: PC=%08x - Status read (%02x)\n", cpu_get_pc(&space.device()), regs[WD_SCSI_STATUS] ));
649            LOG(( "WD33C93: PC=%08x - Status read (%02x)\n", space.device().safe_pc(), regs[WD_SCSI_STATUS] ));
650650         }
651651         else if ( sasr == WD_DATA )
652652         {
r17788r17789
715715            }
716716         }
717717
718         LOG(( "WD33C93: PC=%08x - Data read (%02x)\n", cpu_get_pc(&space.device()), regs[WD_DATA] ));
718         LOG(( "WD33C93: PC=%08x - Data read (%02x)\n", space.device().safe_pc(), regs[WD_DATA] ));
719719
720720         /* get the register value */
721721         ret = regs[sasr];
trunk/src/emu/machine/ncr539x.c
r17788r17789
346346
347347   #if VERBOSE
348348   #if VERBOSE_READS
349   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);
349   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);
350350   #endif
351351   #endif
352352
r17788r17789
377377               update_fifo_internal_state(fifo_bytes);
378378
379379               #if VERBOSE
380               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);
380               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);
381381               #endif
382382
383383               if (fifo_bytes == 0)
r17788r17789
484484WRITE8_MEMBER( ncr539x_device::write )
485485{
486486   #if VERBOSE
487   if (offset != 2) printf("539x: Write %02x @ %s (%02x) (PC=%x)\n", data, wrregs[offset], offset, cpu_get_pc(&space.device()));
487   if (offset != 2) printf("539x: Write %02x @ %s (%02x) (PC=%x)\n", data, wrregs[offset], offset, space.device().safe_pc());
488488   #endif
489489
490490   switch (offset)
trunk/src/emu/machine/ldv1000.c
r17788r17789
469469WRITE8_MEMBER( pioneer_ldv1000_device::z80_controller_w )
470470{
471471   if (LOG_STATUS_CHANGES && data != m_status)
472      printf("%04X:CONTROLLER.W=%02X\n", cpu_get_pc(&space.device()), data);
472      printf("%04X:CONTROLLER.W=%02X\n", space.device().safe_pc(), data);
473473   m_status = data;
474474}
475475
trunk/src/emu/machine/am53cf96.c
r17788r17789
3232
3333   if (offset == REG_FIFO)
3434   {
35//      mame_printf_debug("53cf96: read FIFO PC=%x\n", cpu_get_pc(&space.device()));
35//      mame_printf_debug("53cf96: read FIFO PC=%x\n", space.device().safe_pc());
3636      return 0;
3737   }
3838
39//  logerror("53cf96: read reg %d = %x (PC=%x)\n", reg, rv>>shift, cpu_get_pc(&space.device()));
39//  logerror("53cf96: read reg %d = %x (PC=%x)\n", reg, rv>>shift, space.device().safe_pc());
4040
4141   if (offset == REG_IRQSTATE)
4242   {
r17788r17789
5555
5656WRITE8_MEMBER( am53cf96_device::write )
5757{
58//  logerror("53cf96: w %x to reg %d (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
58//  logerror("53cf96: w %x to reg %d (PC=%x)\n", data, offset, space.device().safe_pc());
5959
6060   // if writing to the target ID, cache it off for later
6161   if (offset == REG_STATUS)
r17788r17789
9393         case 2: // reset device
9494            scsi_regs[REG_IRQSTATE] = 8;   // indicate success
9595
96            logerror("53cf96: reset  target ID = %d (PC = %x)\n", last_id, cpu_get_pc(&space.device()));
96            logerror("53cf96: reset  target ID = %d (PC = %x)\n", last_id, space.device().safe_pc());
9797            if (devices[last_id])
9898            {
9999               devices[last_id]->reset();
r17788r17789
121121               scsi_regs[REG_INTSTATE] = 4;
122122            }
123123
124            logerror("53cf96: command %x exec.  target ID = %d (PC = %x)\n", fifo[1], last_id, cpu_get_pc(&space.device()));
124            logerror("53cf96: command %x exec.  target ID = %d (PC = %x)\n", fifo[1], last_id, space.device().safe_pc());
125125            if (devices[last_id])
126126            {
127127               int length;
trunk/src/emu/machine/tmp68301.c
r17788r17789
166166
167167   if (!ACCESSING_BITS_0_7)   return;
168168
169//  logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n",cpu_get_pc(&space->device()),offset*2,data,mem_mask^0xffff);
169//  logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n",space->device().safe_pc(),offset*2,data,mem_mask^0xffff);
170170
171171   switch( offset * 2 )
172172   {
trunk/src/mess/devices/sonydriv.c
r17788r17789
271271   if (LOG_SONY_EXTRA)
272272   {
273273      printf("sony.status(): action=%x pc=0x%08x%s\n",
274         action, (int) cpu_get_pc(device->machine().firstcpu), sony.floppy_enable ? "" : " (no drive enabled)");
274         action, (int) device->machine().firstcpu->safe_pc(), sony.floppy_enable ? "" : " (no drive enabled)");
275275   }
276276
277277   if ((! sony_enable2()) && sony.floppy_enable)
r17788r17789
333333         }
334334         break;
335335      case 0x0a:   /* At track 0: 0=track zero 1=not track zero */
336         logerror("sony.status(): reading Track 0 pc=0x%08x\n", (int) cpu_get_pc(device->machine().firstcpu));
336         logerror("sony.status(): reading Track 0 pc=0x%08x\n", (int) device->machine().firstcpu->safe_pc());
337337         if (cur_image)
338338            result = floppy_tk00_r(&cur_image->device());
339339         else
r17788r17789
407407   if (LOG_SONY)
408408   {
409409      logerror("sony_doaction(): action=%d pc=0x%08x%s\n",
410         action, (int) cpu_get_pc(device->machine().firstcpu), (sony.floppy_enable) ? "" : " (MOTOR OFF)");
410         action, (int) device->machine().firstcpu->safe_pc(), (sony.floppy_enable) ? "" : " (MOTOR OFF)");
411411   }
412412
413413   if (sony.floppy_enable)
trunk/src/mess/audio/mea8000.c
r17788r17789
556556   case 1:
557557      /* ready to accept next frame */
558558#if 0
559      LOG(( "$%04x %f: mea8000_r ready=%i\n", cpu_get_previouspc( device->machine().firstcpu ), machine.time().as_double(), mea8000_accept_byte( mea8000 ) ));
559      LOG(( "$%04x %f: mea8000_r ready=%i\n", device->machine().firstcpu ->safe_pcbase( ), machine.time().as_double(), mea8000_accept_byte( mea8000 ) ));
560560#endif
561561      return mea8000_accept_byte(mea8000) << 7;
562562
563563   default:
564      logerror( "$%04x mea8000_r invalid read offset %i\n",  cpu_get_previouspc( device->machine().firstcpu ), offset );
564      logerror( "$%04x mea8000_r invalid read offset %i\n",  device->machine().firstcpu ->safe_pcbase( ), offset );
565565   }
566566   return 0;
567567}
r17788r17789
577577      {
578578         /* got pitch byte before first frame */
579579         mea8000->pitch = 2 * data;
580         LOG(( "$%04x %f: mea8000_w pitch %i\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mea8000->pitch ));
580         LOG(( "$%04x %f: mea8000_w pitch %i\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mea8000->pitch ));
581581         mea8000->state = MEA8000_WAIT_FIRST;
582582         mea8000->bufpos = 0;
583583      }
584584      else if (mea8000->bufpos == 4)
585585      {
586586         /* overflow */
587         LOG(( "$%04x %f: mea8000_w data overflow %02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data ));
587         LOG(( "$%04x %f: mea8000_w data overflow %02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data ));
588588      }
589589      else
590590      {
591591         /* enqueue frame byte */
592         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(),
592         LOG(( "$%04x %f: mea8000_w data %02X in frame pos %i\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(),
593593               data, mea8000->bufpos ));
594594         mea8000->buf[mea8000->bufpos] = data;
595595         mea8000->bufpos++;
r17788r17789
623623         mea8000_stop_frame(device->machine(), mea8000);
624624
625625      LOG(( "$%04x %f: mea8000_w command %02X stop=%i cont=%i roe=%i\n",
626            cpu_get_previouspc(device->machine().firstcpu), device->machine().time().as_double(), data,
626            device->machine().firstcpu->safe_pcbase(), device->machine().time().as_double(), data,
627627            stop, mea8000->cont, mea8000->roe ));
628628
629629      mea8000_update_req(device);
r17788r17789
631631   }
632632
633633   default:
634      logerror( "$%04x mea8000_w invalid write offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset );
634      logerror( "$%04x mea8000_w invalid write offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset );
635635   }
636636}
637637
trunk/src/mess/machine/dgn_beta.c
r17788r17789
265265   int                  MapPage;
266266   char                page_num[10];
267267
268   LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,cpu_get_pc(&space_0->device())));
268   LOG_BANK_UPDATE(("\n\nUpdating banks %d to %d at PC=$%X\n",first,last,space_0->device().safe_pc()));
269269   for(Page=first;Page<=last;Page++)
270270   {
271271      sprintf(page_num,"bank%d",Page+1);
trunk/src/mess/machine/a2mockingboard.c
r17788r17789
161161
162162UINT8 a2bus_ayboard_device::read_cnxx(address_space &space, UINT8 offset)
163163{
164//    printf("Mockingboard(%d): read @ Cn%02X (PC=%x)\n", m_slot, offset, cpu_get_pc(&space.device()));
164//    printf("Mockingboard(%d): read @ Cn%02X (PC=%x)\n", m_slot, offset, space.device().safe_pc());
165165    if (m_isPhasor)
166166    {
167167        UINT8 retVal = 0;
r17788r17789
227227                viaSel = (offset & 0x80) ? 2 : 1;
228228            }
229229
230//            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);
230//            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);
231231
232232            if (viaSel & 1)
233233            {
r17788r17789
251251        }
252252        else
253253        {
254            printf("Mockingboard(%d): unk write %02x to Cn%02X (PC=%x)\n", m_slot, data, offset, cpu_get_pc(&space.device()));
254            printf("Mockingboard(%d): unk write %02x to Cn%02X (PC=%x)\n", m_slot, data, offset, space.device().safe_pc());
255255        }
256256    }
257257}
trunk/src/mess/machine/pokemini.c
r17788r17789
395395   static const int timer_to_cycles_fast[8] = { 2, 8, 32, 64, 128, 256, 1024, 4096 };
396396   static const int timer_to_cycles_slow[8] = { 128, 256, 512, 1024, 2048, 4096, 8192, 16384 };
397397
398   //logerror( "%0X: Write to hardware address: %02X, %02X\n", cpu_get_pc( &space->device() ), offset, data );
398   //logerror( "%0X: Write to hardware address: %02X, %02X\n", space->device() .safe_pc( ), offset, data );
399399
400400   switch( offset )
401401   {
r17788r17789
409409   case 0x02:   /* CPU related?
410410               Bit 0-7 R/W Unknown
411411            */
412      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data );
412      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data );
413413      break;
414414   case 0x08:   /* Seconds-timer control
415415               Bit 0   R/W Timer enable
r17788r17789
441441               Bit 5   R   Battery status: 0 - battery OK, 1 - battery low
442442               Bit 6-7     Unused
443443            */
444      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data );
444      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data );
445445      break;
446446   case 0x18:   /* Timer 1 pre-scale + enable
447447               Bit 0-2 R/W low timer 1 prescaler select
r17788r17789
956956            */
957957   case 0x35:   /* Timer 1 sound-pivot (high, unused)
958958            */
959      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data );
959      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data );
960960      break;
961961   case 0x36:   /* Timer 1 counter (low), read only
962962            */
r17788r17789
10351035            */
10361036   case 0x3D:   /* Timer 2 sound-pivot (high, unused)
10371037            */
1038      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data );
1038      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data );
10391039      break;
10401040   case 0x3E:   /* Timer 2 counter (low), read only
10411041               Bit 0-7 R/W Timer 2 counter value bit 0-7
r17788r17789
13001300                           Map size 2: 0x00 to 0x60
13011301               Bit 7       Unused
13021302            */
1303      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data );
1303      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data );
13041304      break;
13051305   case 0x87:   /* Sprite tile data memory offset (low)
13061306               Bit 0-5     Always "0"
r17788r17789
13411341//      lcd_data_w( data );
13421342      break;
13431343   default:
1344      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", cpu_get_pc( device->machine().firstcpu ), offset, data );
1344      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", device->machine().firstcpu ->safe_pc( ), offset, data );
13451345      break;
13461346   }
13471347   state->m_pm_reg[offset] = data;
trunk/src/mess/machine/mos6530.c
r17788r17789
227227         if (!port->out_port_func.isnull())
228228            port->out_port_func(0, data);
229229         else
230            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);
230            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);
231231      }
232232   }
233233}
r17788r17789
289289            port->in = port->in_port_func(0);
290290         }
291291         else
292            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));
292            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());
293293
294294         /* apply the DDR to the result */
295295         val = (out & port->ddr) | (port->in & ~port->ddr);
trunk/src/mess/machine/mc6854.c
r17788r17789
808808   case 0: /* status register 1 */
809809      mc6854_update_sr1( mc6854 );
810810      LOG(( "%f $%04x mc6854_r: get SR1=$%02X (rda=%i,s2rq=%i,fd=%i,cts=%i,tu=%i,tdra=%i,irq=%i)\n",
811            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->sr1,
811            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->sr1,
812812            ( mc6854->sr1 & RDA) ? 1 : 0, ( mc6854->sr1 & S2RQ) ? 1 : 0,
813813            ( mc6854->sr1 & FD ) ? 1 : 0, ( mc6854->sr1 & CTS ) ? 1 : 0,
814814            ( mc6854->sr1 & TU ) ? 1 : 0, ( mc6854->sr1 & TDRA) ? 1 : 0,
r17788r17789
818818   case 1: /* status register 2 */
819819      mc6854_update_sr2( mc6854 );
820820      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",
821            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->sr2,
821            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->sr2,
822822            ( mc6854->sr2 & AP   ) ? 1 : 0, ( mc6854->sr2 & FV  ) ? 1 : 0,
823823            ( mc6854->sr2 & RIDLE) ? 1 : 0, ( mc6854->sr2 & RABT) ? 1 : 0,
824824            ( mc6854->sr2 & ERR  ) ? 1 : 0, ( mc6854->sr2 & DCD ) ? 1 : 0,
r17788r17789
830830   {
831831      UINT8 data = mc6854_rfifo_pop( device );
832832      LOG(( "%f $%04x mc6854_r: get data $%02X\n",
833            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data ));
833            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data ));
834834      return data;
835835   }
836836
837837   default:
838      logerror( "$%04x mc6854 invalid read offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset );
838      logerror( "$%04x mc6854 invalid read offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset );
839839   }
840840   return 0;
841841}
r17788r17789
851851   case 0: /* control register 1 */
852852      mc6854->cr1 = data;
853853      LOG(( "%f $%04x mc6854_w: set CR1=$%02X (ac=%i,irq=%c%c,%sreset=%c%c)\n",
854            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr1,
854            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->cr1,
855855            AC ? 1 : 0,
856856            RIE ? 'r' : '-', TIE ? 't' : '-',
857857            DISCONTINUE ? "discontinue," : "",
r17788r17789
859859             ));
860860      if ( mc6854->cr1 & 0xc )
861861         logerror( "$%04x mc6854 DMA not handled (CR1=$%02X)\n",
862              cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr1 );
862              device->machine().firstcpu ->safe_pcbase( ), mc6854->cr1 );
863863      if ( DISCONTINUE )
864864      {
865865         /* abort receive FIFO but keeps shift register & synchro */
r17788r17789
888888         /* control register 3 */
889889         mc6854->cr3 = data;
890890         LOG(( "%f $%04x mc6854_w: set CR3=$%02X (lcf=%i,aex=%i,idl=%i,fdse=%i,loop=%i,tst=%i,dtr=%i)\n",
891               device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr3,
891               device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->cr3,
892892               LCF ? (CEX ? 16 : 8) : 0,  AEX ? 1 : 0,
893893               IDL0 ? 0 : 1, FDSE ? 1 : 0, LOOP ? 1 : 0,
894894               TST ? 1 : 0, DTR ? 1 : 0
895895                ));
896896         if ( LOOP )
897            logerror( "$%04x mc6854 loop mode not handled (CR3=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr3 );
897            logerror( "$%04x mc6854 loop mode not handled (CR3=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), mc6854->cr3 );
898898         if ( TST )
899            logerror( "$%04x mc6854 test mode not handled (CR3=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr3 );
899            logerror( "$%04x mc6854 test mode not handled (CR3=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), mc6854->cr3 );
900900
901901         mc6854->out_dtr_func( DTR ? 1 : 0 );
902902
r17788r17789
906906         /* control register 2 */
907907         mc6854->cr2 = data;
908908         LOG(( "%f $%04x mc6854_w: set CR2=$%02X (pse=%i,bytes=%i,fmidle=%i,%s,tlast=%i,clr=%c%c,rts=%i)\n",
909               device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr2,
909               device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6854->cr2,
910910               PSE ? 1 : 0,  TWOBYTES ? 2 : 1,  FMIDLE ? 1 : 0,
911911               FCTDRA ? "fc" : "tdra", TLAST ? 1 : 0,
912912               data & 0x20 ? 'r' : '-',  data & 0x40 ? 't' : '-',
913913               RTS ? 1 : 0 ));
914914         if ( PSE )
915            logerror( "$%04x mc6854 status prioritization not handled (CR2=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), mc6854->cr2 );
915            logerror( "$%04x mc6854 status prioritization not handled (CR2=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), mc6854->cr2 );
916916         if ( TLAST )
917917            mc6854_tfifo_terminate( device );
918918         if ( data & 0x20 )
r17788r17789
936936      break;
937937
938938   case 2: /* transmitter data: continue data */
939      LOG(( "%f $%04xmc6854_w: push data=$%02X\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data ));
939      LOG(( "%f $%04xmc6854_w: push data=$%02X\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data ));
940940      mc6854_tfifo_push( device, data );
941941      break;
942942
r17788r17789
945945      {
946946         /* control register 4 */
947947         mc6854->cr4 = data;
948         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,
948         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,
949949               TWOINTER ? 2 : 1,
950950               TWL, RWL,
951951               ABT ? ( ABTEX ? "abort-ext," : "abort,") : "",
r17788r17789
960960      else
961961      {
962962         /* transmitter data: last data */
963         LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data ));
963         LOG(( "%f $%04x mc6854_w: push last-data=$%02X\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data ));
964964         mc6854_tfifo_push( device, data );
965965         mc6854_tfifo_terminate( device );
966966      }
967967      break;
968968
969969   default:
970      logerror( "$%04x mc6854 invalid write offset %i (data=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), offset, data );
970      logerror( "$%04x mc6854 invalid write offset %i (data=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), offset, data );
971971   }
972972}
973973
trunk/src/mess/machine/gamecom.c
r17788r17789
329329   case SM8521_55: case SM8521_56: case SM8521_57: case SM8521_58:
330330   case SM8521_59: case SM8521_5A: case SM8521_5B: case SM8521_5C:
331331   case SM8521_5D:
332      logerror( "%X: Write to reserved address (0x%02X). Value written: 0x%02X\n", cpu_get_pc(m_maincpu), offset, data );
332      logerror( "%X: Write to reserved address (0x%02X). Value written: 0x%02X\n", m_maincpu->safe_pc(), offset, data );
333333      break;
334334   }
335335   m_p_ram[offset] = data;
trunk/src/mess/machine/mc6846.c
r17788r17789
267267   case 0:
268268   case 4:
269269      LOG (( "$%04x %f: mc6846 CSR read $%02X intr=%i (timer=%i, cp1=%i, cp2=%i)\n",
270             cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(),
270             device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(),
271271             mc6846->csr, (mc6846->csr >> 7) & 1,
272272             mc6846->csr & 1, (mc6846->csr >> 1) & 1, (mc6846->csr >> 2) & 1 ));
273273      mc6846->csr0_to_be_cleared = mc6846->csr & 1;
r17788r17789
276276      return mc6846->csr;
277277
278278   case 1:
279      LOG (( "$%04x %f: mc6846 PCR read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->pcr ));
279      LOG (( "$%04x %f: mc6846 PCR read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->pcr ));
280280      return mc6846->pcr;
281281
282282   case 2:
283      LOG (( "$%04x %f: mc6846 DDR read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->ddr ));
283      LOG (( "$%04x %f: mc6846 DDR read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->ddr ));
284284      return mc6846->ddr;
285285
286286   case 3:
287      LOG (( "$%04x %f: mc6846 PORT read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), PORT ));
287      LOG (( "$%04x %f: mc6846 PORT read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), PORT ));
288288      if ( ! (mc6846->pcr & 0x80) )
289289      {
290290         if ( mc6846->csr1_to_be_cleared )
r17788r17789
298298      return PORT;
299299
300300   case 5:
301      LOG (( "$%04x %f: mc6846 TCR read $%02X\n",cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->tcr ));
301      LOG (( "$%04x %f: mc6846 TCR read $%02X\n",device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->tcr ));
302302      return mc6846->tcr;
303303
304304   case 6:
305      LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846_counter( device ) >> 8 ));
305      LOG (( "$%04x %f: mc6846 COUNTER hi read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846_counter( device ) >> 8 ));
306306      if ( mc6846->csr0_to_be_cleared )
307307      {
308308         mc6846->csr &= ~1;
r17788r17789
312312      return mc6846_counter( device ) >> 8;
313313
314314   case 7:
315      LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846_counter( device ) & 0xff ));
315      LOG (( "$%04x %f: mc6846 COUNTER low read $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846_counter( device ) & 0xff ));
316316      if ( mc6846->csr0_to_be_cleared )
317317      {
318318         mc6846->csr &= ~1;
r17788r17789
322322      return mc6846_counter( device ) & 0xff;
323323
324324   default:
325      logerror( "$%04x mc6846 invalid read offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset );
325      logerror( "$%04x mc6846 invalid read offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset );
326326   }
327327   return 0;
328328}
r17788r17789
353353         "latcged,pos-edge", "latcged,pos-edge,intr"
354354      };
355355      LOG (( "$%04x %f: mc6846 PCR write $%02X reset=%i cp2=%s cp1=%s\n",
356             cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data,
356             device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data,
357357             (data >> 7) & 1, cp2[ (data >> 3) & 7 ], cp1[ data & 7 ] ));
358358
359359   }
r17788r17789
366366      mc6846_update_irq( device );
367367   }
368368   if ( data & 4 )
369      logerror( "$%04x mc6846 CP1 latching not implemented\n", cpu_get_previouspc( device->machine().firstcpu ) );
369      logerror( "$%04x mc6846 CP1 latching not implemented\n", device->machine().firstcpu ->safe_pcbase( ) );
370370   if (data & 0x20)
371371   {
372372      if (data & 0x10)
r17788r17789
376376            mc6846->iface->out_cp2_func( device, 0, mc6846->cp2_cpu );
377377      }
378378      else
379         logerror( "$%04x mc6846 acknowledge not implemented\n", cpu_get_previouspc( device->machine().firstcpu ) );
379         logerror( "$%04x mc6846 acknowledge not implemented\n", device->machine().firstcpu ->safe_pcbase( ) );
380380   }
381381   break;
382382
383383   case 2:
384      LOG (( "$%04x %f: mc6846 DDR write $%02X\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data ));
384      LOG (( "$%04x %f: mc6846 DDR write $%02X\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data ));
385385      if ( ! (mc6846->pcr & 0x80) )
386386      {
387387         mc6846->ddr = data;
r17788r17789
391391      break;
392392
393393   case 3:
394      LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data,mc6846->ddr ));
394      LOG (( "$%04x %f: mc6846 PORT write $%02X (mask=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data,mc6846->ddr ));
395395      if ( ! (mc6846->pcr & 0x80) )
396396      {
397397         mc6846->pdr = data;
r17788r17789
400400         if ( mc6846->csr1_to_be_cleared && (mc6846->csr & 2) )
401401         {
402402            mc6846->csr &= ~2;
403            LOG (( "$%04x %f: mc6846 CP1 intr reset\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double() ));
403            LOG (( "$%04x %f: mc6846 CP1 intr reset\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double() ));
404404         }
405405         if ( mc6846->csr2_to_be_cleared && (mc6846->csr & 4) )
406406         {
407407            mc6846->csr &= ~4;
408            LOG (( "$%04x %f: mc6846 CP2 intr reset\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double() ));
408            LOG (( "$%04x %f: mc6846 CP2 intr reset\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double() ));
409409         }
410410         mc6846->csr1_to_be_cleared = 0;
411411         mc6846->csr2_to_be_cleared = 0;
r17788r17789
421421            "freq-cmp", "freq-cmp", "pulse-cmp", "pulse-cmp"
422422         };
423423      LOG (( "$%04x %f: mc6846 TCR write $%02X reset=%i clock=%s scale=%i mode=%s out=%s\n",
424             cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), data,
424             device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), data,
425425             (data >> 7) & 1, (data & 0x40) ? "extern" : "sys",
426426             (data & 0x40) ? 1 : 8, mode[ (data >> 1) & 7 ],
427427             (data & 1) ? "enabled" : "0" ));
r17788r17789
455455
456456   case 7:
457457      mc6846->latch = ( ((UINT16) mc6846->time_MSB) << 8 ) + data;
458      LOG (( "$%04x %f: mc6846 COUNT write %i\n", cpu_get_previouspc( device->machine().firstcpu ), device->machine().time().as_double(), mc6846->latch  ));
458      LOG (( "$%04x %f: mc6846 COUNT write %i\n", device->machine().firstcpu ->safe_pcbase( ), device->machine().time().as_double(), mc6846->latch  ));
459459      if (!(mc6846->tcr & 0x38))
460460      {
461461         /* timer initialization */
r17788r17789
471471      break;
472472
473473   default:
474      logerror( "$%04x mc6846 invalid write offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset );
474      logerror( "$%04x mc6846 invalid write offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset );
475475   }
476476}
477477
trunk/src/mess/machine/egret.c
r17788r17789
137137            if (xcvr_session != ((data>>1)&1))
138138            {
139139               #ifdef EGRET_SUPER_VERBOSE
140                    printf("EG-> XCVR_SESSION: %d (PC=%x)\n", (data>>1)&1, cpu_get_pc(m_maincpu));
140                    printf("EG-> XCVR_SESSION: %d (PC=%x)\n", (data>>1)&1, m_maincpu->safe_pc());
141141               #endif
142142               xcvr_session = (data>>1) & 1;
143143            }
144144                if (via_data != ((data>>5)&1))
145145                {
146146               #ifdef EGRET_SUPER_VERBOSE
147                    printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, cpu_get_pc(m_maincpu));
147                    printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->safe_pc());
148148               #endif
149149               via_data = (data>>5) & 1;
150150                }
151151                if (via_clock != ((data>>4)&1))
152152                {
153153               #ifdef EGRET_SUPER_VERBOSE
154                    printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, cpu_get_pc(m_maincpu));
154                    printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->safe_pc());
155155               #endif
156156               via_clock = (data>>4) & 1;
157157               via6522_device *via1 = machine().device<via6522_device>("via6522_0");
trunk/src/mess/machine/mface2.c
r17788r17789
3939{
4040      int pc;
4141
42      pc = cpu_get_pc(machine().device("maincpu"));
42      pc = machine().device("maincpu")->safe_pc();
4343      /* there are two places where CALL &0065 can be found
4444        in the multiface rom. At this address there is a RET.
4545
trunk/src/mess/machine/wswan.c
r17788r17789
289289   UINT8 value = m_ws_portram[offset];
290290
291291   if ( offset != 2 )
292      logerror( "PC=%X: port read %02X\n", cpu_get_pc( machine().device("maincpu") ), offset );
292      logerror( "PC=%X: port read %02X\n", machine().device("maincpu") ->safe_pc( ), offset );
293293   switch( offset )
294294   {
295295      case 0x02:      /* Current line */
r17788r17789
360360   address_space *mem = m_maincpu->memory().space(AS_PROGRAM);
361361   wswan_state *state = machine().driver_data<wswan_state>();
362362   UINT8 input;
363   logerror( "PC=%X: port write %02X <- %02X\n", cpu_get_pc( &mem->device() ), offset, data );
363   logerror( "PC=%X: port write %02X <- %02X\n", mem->device().safe_pc(), offset, data );
364364   switch( offset )
365365   {
366366      case 0x00:   /* Display control
r17788r17789
12541254            m_ws_portram[0xcb] = m_rtc.year;
12551255            break;
12561256         default:
1257            logerror( "%X: Unknown RTC command (%X) requested\n", cpu_get_pc( &mem->device() ), data );
1257            logerror( "%X: Unknown RTC command (%X) requested\n", mem->device().safe_pc(), data );
12581258         }
12591259         break;
12601260      case 0xcb:   /* RTC Data */
trunk/src/mess/machine/z80ne.c
r17788r17789
707707   offs_t pc;
708708
709709   /* if PC is not in range, we are under integrated debugger control, DON'T SWAP */
710   pc = cpu_get_pc(device->machine().device("z80ne"));
710   pc = device->machine().device("z80ne")->safe_pc();
711711   if((pc >= 0xf000) && (pc <=0xffff))
712712   {
713713      LOG(("lx390_reset_bank, reset memory bank 1\n"));
trunk/src/mess/machine/apollo_kbd.c
r17788r17789
149149   if (cpu != NULL)
150150   {
151151      sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(),
152            cpu_get_previouspc(cpu), tag());
152            cpu->safe_pcbase(), tag());
153153   }
154154   else
155155   {
trunk/src/mess/machine/isa_hdc.c
r17788r17789
796796   }
797797
798798   if (LOG_HDC_CALL)
799      logerror("pc_HDC_r(): pc=%06X offs=%d result=0x%02x\n", cpu_get_pc(device->machine().firstcpu), offset, data);
799      logerror("pc_HDC_r(): pc=%06X offs=%d result=0x%02x\n", device->machine().firstcpu->safe_pc(), offset, data);
800800
801801   return data;
802802}
r17788r17789
805805{
806806   isa8_hdc_device   *hdc  = downcast<isa8_hdc_device *>(device);
807807   if (LOG_HDC_CALL)
808      logerror("pc_HDC_w(): pc=%06X offs=%d data=0x%02x\n", cpu_get_pc(device->machine().firstcpu), offset, data);
808      logerror("pc_HDC_w(): pc=%06X offs=%d data=0x%02x\n", device->machine().firstcpu->safe_pc(), offset, data);
809809
810810   switch( offset )
811811   {
trunk/src/mess/machine/dec_lk201.c
r17788r17789
107107
108108WRITE8_MEMBER( lk201_device::ddr_w )
109109{
110//    printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, cpu_get_pc(m_maincpu));
110//    printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->safe_pc());
111111
112112   send_port(space, offset, ports[offset] & data);
113113
r17788r17789
135135   // add in ddr-masked version of port writes
136136   incoming |= (ports[offset] & ddrs[offset]);
137137
138//    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));
138//    printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->safe_pc());
139139
140140   return incoming;
141141}
r17788r17789
149149
150150void lk201_device::send_port(address_space &space, UINT8 offset, UINT8 data)
151151{
152//    printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], cpu_get_pc(m_maincpu));
152//    printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->safe_pc());
153153
154154   switch (offset)
155155   {
r17788r17789
187187            break;
188188   }
189189
190//    printf("SCI read @ %x = %02x (PC=%x)\n", offset, incoming, cpu_get_pc(m_maincpu));
190//    printf("SCI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->safe_pc());
191191
192192   return incoming;
193193}
r17788r17789
212212            break;
213213   }
214214
215//    printf("SCI %02x to %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu));
215//    printf("SCI %02x to %x (PC=%x)\n", data, offset, m_maincpu->safe_pc());
216216}
217217
218218READ8_MEMBER( lk201_device::spi_r )
r17788r17789
232232         break;
233233   }
234234
235//    printf("SPI read @ %x = %02x (PC=%x)\n", offset, incoming, cpu_get_pc(m_maincpu));
235//    printf("SPI read @ %x = %02x (PC=%x)\n", offset, incoming, m_maincpu->safe_pc());
236236
237237   return incoming;
238238}
r17788r17789
251251         break;
252252   }
253253
254//    printf("SPI %02x to %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu));
254//    printf("SPI %02x to %x (PC=%x)\n", data, offset, m_maincpu->safe_pc());
255255}
256256
257257/*
trunk/src/mess/machine/nes.c
r17788r17789
376376      }
377377
378378      if (LOG_JOY)
379         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);
379         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);
380380
381381      m_in_0.shift++;
382382   }
r17788r17789
465465      }
466466
467467      if (LOG_JOY)
468         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);
468         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);
469469
470470      m_in_1.shift++;
471471   }
trunk/src/mess/machine/sym1.c
r17788r17789
123123static WRITE8_DEVICE_HANDLER(sym1_riot_a_w)
124124{
125125   sym1_state *state = device->machine().driver_data<sym1_state>();
126   logerror("%x: riot_a_w 0x%02x\n", cpu_get_pc( device->machine().device("maincpu") ), data);
126   logerror("%x: riot_a_w 0x%02x\n", device->machine().device("maincpu") ->safe_pc( ), data);
127127
128128   /* save for later use */
129129   state->m_riot_port_a = data;
r17788r17789
133133static WRITE8_DEVICE_HANDLER(sym1_riot_b_w)
134134{
135135   sym1_state *state = device->machine().driver_data<sym1_state>();
136   logerror("%x: riot_b_w 0x%02x\n", cpu_get_pc( device->machine().device("maincpu") ), data);
136   logerror("%x: riot_b_w 0x%02x\n", device->machine().device("maincpu") ->safe_pc( ), data);
137137
138138   /* save for later use */
139139   state->m_riot_port_b = data;
trunk/src/mess/machine/3c505.c
r17788r17789
280280   if (cpu != NULL)
281281   {
282282      sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(),
283            cpu_get_previouspc(cpu), tag());
283            cpu->safe_pcbase(), tag());
284284   }
285285   else
286286   {
r17788r17789
12521252
12531253void threecom3c505_device::write_control_port( UINT8 data)
12541254{
1255   // if (cpu_get_previouspc(m_device->machine->firstcpu) == 0x3C4BAD48) verbose = 3;
1256   // if (cpu_get_previouspc(m_device->machine->firstcpu) == 0x010464DC) verbose = 3;
1255   // if (m_device->machine->firstcpu->safe_pcbase() == 0x3C4BAD48) verbose = 3;
1256   // if (m_device->machine->firstcpu->safe_pcbase() == 0x010464DC) verbose = 3;
12571257
12581258   if (verbose <= 2 && (data & (DMAE | TCEN /*| CMDE*/)) != 0)
12591259   {
r17788r17789
13981398      // omit excessive logging
13991399      if (data == last_data)
14001400      {
1401         UINT32 pc = cpu_get_previouspc(machine().device(MAINCPU));
1401         UINT32 pc = machine().device(MAINCPU)->safe_pcbase();
14021402         if (pc == last_pc) {
14031403            return data;
14041404         }
trunk/src/mess/machine/sc499.c
r17788r17789
257257   if (cpu != NULL)
258258   {
259259      sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(),
260            cpu_get_previouspc(cpu), tag());
260            cpu->safe_pcbase(), tag());
261261   }
262262   else
263263   {
trunk/src/mess/machine/bebox.c
r17788r17789
170170      if (LOG_CPUIMASK)
171171      {
172172         logerror("BeBox CPU #0 pc=0x%08X imask=0x%08x\n",
173            (unsigned) cpu_get_pc( &space->device()), state->m_cpu_imask[0]);
173            (unsigned) space->device().safe_pc( ), state->m_cpu_imask[0]);
174174      }
175175      bebox_update_interrupts(space->machine());
176176   }
r17788r17789
188188      if (LOG_CPUIMASK)
189189      {
190190         logerror("BeBox CPU #1 pc=0x%08X imask=0x%08x\n",
191            (unsigned) cpu_get_pc( &space->device() ), state->m_cpu_imask[1]);
191            (unsigned) space->device() .safe_pc( ), state->m_cpu_imask[1]);
192192      }
193193      bebox_update_interrupts(space->machine());
194194   }
trunk/src/mess/machine/intv.c
r17788r17789
253253            intvkbd_tms9927_w(space, offset-0xc0, data);
254254            break;
255255         default:
256            logerror("%04X: Unknown write %02x to 0x40%02x\n",cpu_get_pc(&space.device()),data,offset);
256            logerror("%04X: Unknown write %02x to 0x40%02x\n",space.device().safe_pc(),data,offset);
257257            break;
258258      }
259259   }
trunk/src/mess/machine/a2scsi.c
r17788r17789
125125
126126UINT8 a2bus_scsi_device::read_c0nx(address_space &space, UINT8 offset)
127127{
128    printf("Read c0n%x (PC=%x)\n", offset, cpu_get_pc(&space.device()));
128    printf("Read c0n%x (PC=%x)\n", offset, space.device().safe_pc());
129129
130130    switch (offset)
131131    {
r17788r17789
153153
154154void a2bus_scsi_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
155155{
156    printf("Write %02x to c0n%x (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
156    printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc());
157157
158158    switch (offset)
159159    {
r17788r17789
206206
207207void a2bus_scsi_device::write_cnxx(address_space &space, UINT8 offset, UINT8 data)
208208{
209    printf("Write %02x to cn%02x (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
209    printf("Write %02x to cn%02x (PC=%x)\n", data, offset, space.device().safe_pc());
210210}
211211
212212/*-------------------------------------------------
trunk/src/mess/machine/pc.c
r17788r17789
532532
533533WRITE8_MEMBER(pc_state::pc_nmi_enable_w)
534534{
535   logerror( "%08X: changing NMI state to %s\n", cpu_get_pc(&space.device()), data & 0x80 ? "enabled" : "disabled" );
535   logerror( "%08X: changing NMI state to %s\n", space.device().safe_pc(), data & 0x80 ? "enabled" : "disabled" );
536536
537537   nmi_enabled = data & 0x80;
538538}
trunk/src/mess/machine/pce.c
r17788r17789
13361336   if(offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports
13371337      return pce_cd_acard_w(space,offset,data);
13381338
1339   logerror("%04X: write to CD interface offset %02X, data %02X\n", cpu_get_pc(&space.device()), offset, data );
1339   logerror("%04X: write to CD interface offset %02X, data %02X\n", space.device().safe_pc(), offset, data );
13401340
13411341   switch( offset & 0xf )
13421342   {
r17788r17789
15901590   if(offset & 0x200 && m_sys3_card && m_acard) // route Arcade Card handling ports
15911591      return pce_cd_acard_r(space,offset);
15921592
1593   logerror("%04X: read from CD interface offset %02X\n", cpu_get_pc(&space.device()), offset );
1593   logerror("%04X: read from CD interface offset %02X\n", space.device().safe_pc(), offset );
15941594
15951595   if((offset & 0xc0) == 0xc0 && m_sys3_card) //System 3 Card header handling
15961596   {
trunk/src/mess/machine/dccons.c
r17788r17789
261261      }
262262      #endif
263263
264      mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, cpu_get_pc(&space->device()));
264      mame_printf_debug("ATAPI: read reg %d = %x (PC=%x)\n", reg, data, space->device().safe_pc());
265265   }
266266
267267//  printf( "atapi_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
r17788r17789
420420      }
421421#endif
422422      atapi_regs[reg] = data;
423//      mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, cpu_get_pc(&space->device()));
423//      mame_printf_debug("ATAPI: reg %d = %x (offset %x mask %x PC=%x)\n", reg, data, offset, mem_mask, space->device().safe_pc());
424424
425425      if (reg == ATAPI_REG_CMDSTATUS)
426426      {
427         printf("ATAPI command %x issued! (PC=%x)\n", data, cpu_get_pc(&space->device()));
427         printf("ATAPI command %x issued! (PC=%x)\n", data, space->device().safe_pc());
428428
429429         switch (data)
430430         {
r17788r17789
603603      off=offset << 1;
604604   }
605605
606//  printf("gdrom_r: @ %x (off %x), mask %llx (PC %x)\n", offset, off, mem_mask, cpu_get_pc(&space->device()));
606//  printf("gdrom_r: @ %x (off %x), mask %llx (PC %x)\n", offset, off, mem_mask, space->device().safe_pc());
607607
608608   if (offset == 3)
609609   {
r17788r17789
632632      off=offset << 1;
633633   }
634634
635//  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()));
635//  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());
636636
637637   if (off >= 0x20)
638638   {
trunk/src/mess/machine/sgi.c
r17788r17789
2020      va_start( v, s_fmt );
2121      vsprintf( buf, s_fmt, v );
2222      va_end( v );
23      logerror( "%08x: %s", (unsigned) cpu_get_pc(machine.device("maincpu")), buf );
23      logerror( "%08x: %s", (unsigned) machine.device("maincpu")->safe_pc(), buf );
2424   }
2525}
2626
trunk/src/mess/machine/bbc.c
r17788r17789
121121{
122122   bbc_state *state = machine.driver_data<bbc_state>();
123123   int PC;
124   PC = cpu_get_pc(machine.device("maincpu")); // this needs to be set to the 6502 program counter
124   PC = machine.device("maincpu")->safe_pc(); // this needs to be set to the 6502 program counter
125125   return (((PC >= 0xc000) && (PC <= 0xdfff)) || ((state->m_pagedRAM) && ((PC >= 0xa000) && (PC <= 0xafff))));
126126}
127127
r17788r17789
398398static int bbcm_vdudriverset(running_machine &machine)
399399{
400400   int PC;
401   PC = cpu_get_pc(machine.device("maincpu"));
401   PC = machine.device("maincpu")->safe_pc();
402402   return ((PC >= 0xc000) && (PC <= 0xdfff));
403403}
404404
trunk/src/mess/machine/mb8795.c
r17788r17789
8686
8787READ8_MEMBER(mb8795_device::txstat_r)
8888{
89   //  fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, cpu_get_pc(&space.device()));
89   //  fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, space.device().safe_pc());
9090   return txstat;
9191}
9292
r17788r17789
9494{
9595   txstat = txstat & (0xf0 | ~data);
9696   check_irq();
97   fprintf(stderr, "mb8795: txstat_w %02x (%08x)\n", txstat, cpu_get_pc(&space.device()));
97   fprintf(stderr, "mb8795: txstat_w %02x (%08x)\n", txstat, space.device().safe_pc());
9898}
9999
100100READ8_MEMBER(mb8795_device::txmask_r)
101101{
102   fprintf(stderr, "mb8795: txmask_r %02x (%08x)\n", txmask, cpu_get_pc(&space.device()));
102   fprintf(stderr, "mb8795: txmask_r %02x (%08x)\n", txmask, space.device().safe_pc());
103103   return txmask;
104104}
105105
r17788r17789
107107{
108108   txmask = data & 0xaf;
109109   check_irq();
110   fprintf(stderr, "mb8795: txmask_w %02x (%08x)\n", txmask, cpu_get_pc(&space.device()));
110   fprintf(stderr, "mb8795: txmask_w %02x (%08x)\n", txmask, space.device().safe_pc());
111111}
112112
113113READ8_MEMBER(mb8795_device::rxstat_r)
114114{
115   fprintf(stderr, "mb8795: rxstat_r %02x (%08x)\n", rxstat, cpu_get_pc(&space.device()));
115   fprintf(stderr, "mb8795: rxstat_r %02x (%08x)\n", rxstat, space.device().safe_pc());
116116   return rxstat;
117117}
118118
r17788r17789
120120{
121121   rxstat = rxstat & (0x70 | ~data);
122122   check_irq();
123   fprintf(stderr, "mb8795: rxstat_w %02x (%08x)\n", rxstat, cpu_get_pc(&space.device()));
123   fprintf(stderr, "mb8795: rxstat_w %02x (%08x)\n", rxstat, space.device().safe_pc());
124124}
125125
126126READ8_MEMBER(mb8795_device::rxmask_r)
127127{
128   fprintf(stderr, "mb8795: rxmask_r %02x (%08x)\n", rxmask, cpu_get_pc(&space.device()));
128   fprintf(stderr, "mb8795: rxmask_r %02x (%08x)\n", rxmask, space.device().safe_pc());
129129   return rxmask;
130130}
131131
r17788r17789
133133{
134134   rxmask = data & 0x9f;
135135   check_irq();
136   fprintf(stderr, "mb8795: rxmask_w %02x (%08x)\n", rxmask, cpu_get_pc(&space.device()));
136   fprintf(stderr, "mb8795: rxmask_w %02x (%08x)\n", rxmask, space.device().safe_pc());
137137}
138138
139139READ8_MEMBER(mb8795_device::txmode_r)
140140{
141   fprintf(stderr, "mb8795: txmode_r %02x (%08x)\n", txmode, cpu_get_pc(&space.device()));
141   fprintf(stderr, "mb8795: txmode_r %02x (%08x)\n", txmode, space.device().safe_pc());
142142   return txmode;
143143}
144144
145145WRITE8_MEMBER(mb8795_device::txmode_w)
146146{
147147   txmode = data;
148   fprintf(stderr, "mb8795: txmode_w %02x (%08x)\n", txmode, cpu_get_pc(&space.device()));
148   fprintf(stderr, "mb8795: txmode_w %02x (%08x)\n", txmode, space.device().safe_pc());
149149}
150150
151151READ8_MEMBER(mb8795_device::rxmode_r)
152152{
153   fprintf(stderr, "mb8795: rxmode_r %02x (%08x)\n", rxmode, cpu_get_pc(&space.device()));
153   fprintf(stderr, "mb8795: rxmode_r %02x (%08x)\n", rxmode, space.device().safe_pc());
154154   return rxmode;
155155}
156156
157157WRITE8_MEMBER(mb8795_device::rxmode_w)
158158{
159159   rxmode = data;
160   fprintf(stderr, "mb8795: rxmode_w %02x (%08x)\n", rxmode, cpu_get_pc(&space.device()));
160   fprintf(stderr, "mb8795: rxmode_w %02x (%08x)\n", rxmode, space.device().safe_pc());
161161}
162162
163163WRITE8_MEMBER(mb8795_device::reset_w)
r17788r17789
168168
169169READ8_MEMBER(mb8795_device::tdc_lsb_r)
170170{
171   fprintf(stderr, "mb8795: tdc_lsb_r %02x (%08x)\n", txcount & 0xff, cpu_get_pc(&space.device()));
171   fprintf(stderr, "mb8795: tdc_lsb_r %02x (%08x)\n", txcount & 0xff, space.device().safe_pc());
172172   return txcount;
173173}
174174
r17788r17789
177177   if(offset < 6)
178178      return mac[offset];
179179   if(offset == 7) {
180      fprintf(stderr, "mb8795: tdc_msb_r %02x (%08x)\n", txcount >> 8, cpu_get_pc(&space.device()));
180      fprintf(stderr, "mb8795: tdc_msb_r %02x (%08x)\n", txcount >> 8, space.device().safe_pc());
181181      return (txcount >> 8) & 0x3f;
182182   }
183183   return 0;
trunk/src/mess/machine/cuda.c
r17788r17789
108108
109109void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data)
110110{
111//    printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], cpu_get_pc(m_maincpu));
111//    printf("PORT %c write %02x (DDR = %02x) (PC=%x)\n", 'A' + offset, data, ddrs[offset], m_maincpu->safe_pc());
112112
113113   switch (offset)
114114   {
r17788r17789
138138            if (treq != ((data>>1)&1))
139139            {
140140               #ifdef CUDA_SUPER_VERBOSE
141                    printf("CU-> TREQ: %d (PC=%x)\n", (data>>1)&1, cpu_get_pc(m_maincpu));
141                    printf("CU-> TREQ: %d (PC=%x)\n", (data>>1)&1, m_maincpu->safe_pc());
142142               #endif
143143               treq = (data>>1) & 1;
144144            }
145145                if (via_data != ((data>>5)&1))
146146                {
147147               #ifdef CUDA_SUPER_VERBOSE
148                    printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, cpu_get_pc(m_maincpu));
148                    printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->safe_pc());
149149               #endif
150150               via_data = (data>>5) & 1;
151151                }
152152                if (via_clock != ((data>>4)&1))
153153                {
154154               #ifdef CUDA_SUPER_VERBOSE
155                    printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, cpu_get_pc(m_maincpu));
155                    printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->safe_pc());
156156               #endif
157157               via_clock = (data>>4) & 1;
158158               via6522_device *via1 = machine().device<via6522_device>("via6522_0");
r17788r17789
165165         if ((data & 8) != reset_line)
166166         {
167167            #ifdef CUDA_SUPER_VERBOSE
168            printf("680x0 reset: %d -> %d (PC=%x)\n", (ports[2] & 8)>>3, (data & 8)>>3, cpu_get_pc(m_maincpu));
168            printf("680x0 reset: %d -> %d (PC=%x)\n", (ports[2] & 8)>>3, (data & 8)>>3, m_maincpu->safe_pc());
169169            #endif
170170            reset_line = (data & 8);
171171            // falling edge, should reset the machine too
r17788r17789
193193
194194WRITE8_MEMBER( cuda_device::ddr_w )
195195{
196//    printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, cpu_get_pc(m_maincpu));
196//    printf("%02x to PORT %c DDR (PC=%x)\n", data, 'A' + offset, m_maincpu->safe_pc());
197197
198198   send_port(space, offset, ports[offset] & data);
199199
r17788r17789
251251        incoming |= 0x01;
252252    }
253253
254//    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));
254//    printf("PORT %c read = %02x (DDR = %02x latch = %02x) (PC=%x)\n", 'A' + offset, ports[offset], ddrs[offset], ports[offset], m_maincpu->safe_pc());
255255
256256   return incoming;
257257}
r17788r17789
279279         (data & 0x40) ? 1 : 0,
280280         (data & 0x20) ? 1 : 0,
281281         (data & 0x10) ? 1 : 0,
282         (data & 0x08) ? 1 : 0, cpu_get_pc(m_maincpu));
282         (data & 0x08) ? 1 : 0, m_maincpu->safe_pc());
283283   }
284284   #endif
285285   pll_ctrl = data;
r17788r17789
300300        { attotime::from_seconds(8), attotime::from_msec(250.0f), attotime::from_msec(125.1f), attotime::from_msec(62.5f), attotime::from_msec(31.3f) },
301301    };
302302
303//    printf("%02x to timer control (PC=%x)\n", data, cpu_get_pc(m_maincpu));
303//    printf("%02x to timer control (PC=%x)\n", data, m_maincpu->safe_pc());
304304
305305    if (data & 0x50)
306306    {
r17788r17789
334334
335335WRITE8_MEMBER( cuda_device::timer_counter_w )
336336{
337//    printf("%02x to timer counter (PC=%x)\n", data, cpu_get_pc(m_maincpu));
337//    printf("%02x to timer counter (PC=%x)\n", data, m_maincpu->safe_pc());
338338   timer_counter = data;
339339    ripple_counter = timer_counter;
340340}
trunk/src/mess/machine/hp48.c
r17788r17789
166166   UINT8 data = HP48_IO_8(0x16); /* byte to send */
167167
168168   LOG_SERIAL(( "%05x %f hp48_rs232_send_byte: start sending, data=%02x\n",
169           cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), data ));
169           machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), data ));
170170
171171   /* set byte sending and send buffer full */
172172   state->m_io[0x12] |= 3;
r17788r17789
244244{
245245   hp48_state *state = device->machine().driver_data<hp48_state>();
246246   LOG(( "%05x %f hp48_reg_out: %03x\n",
247         cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), out ));
247         device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), out ));
248248
249249   /* bits 0-8: keyboard lines */
250250   state->m_out = out & 0x1ff;
r17788r17789
282282{
283283   int in = hp48_get_in(device->machine());
284284   LOG(( "%05x %f hp48_reg_in: %04x\n",
285         cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), in ));
285         device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), in ));
286286   return in;
287287}
288288
r17788r17789
327327void hp48_rsi( device_t *device )
328328{
329329   hp48_state *state = device->machine().driver_data<hp48_state>();
330   LOG(( "%05x %f hp48_rsi\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double() ));
330   LOG(( "%05x %f hp48_rsi\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double() ));
331331
332332   /* enables interrupts on key repeat
333333       (normally, there is only one interrupt, when the key is pressed)
r17788r17789
370370{
371371   hp48_state *state = space->machine().driver_data<hp48_state>();
372372   LOG(( "%05x %f hp48_io_w: off=%02x data=%x\n",
373         cpu_get_previouspc(&space->device()), space->machine().time().as_double(), offset, data ));
373         space->device().safe_pcbase(), space->machine().time().as_double(), offset, data ));
374374
375375   switch( offset )
376376   {
r17788r17789
413413
414414   /* cards */
415415   case 0x0e:
416      LOG(( "%05x: card control write %02x\n", cpu_get_previouspc(&space->device()), data ));
416      LOG(( "%05x: card control write %02x\n", space->device().safe_pcbase(), data ));
417417
418418      /* bit 0: software interrupt */
419419      if ( data & 1 )
r17788r17789
432432      break;
433433
434434   case 0x0f:
435      LOG(( "%05x: card info write %02x\n", cpu_get_previouspc(&space->device()), data ));
435      LOG(( "%05x: card info write %02x\n", space->device().safe_pcbase(), data ));
436436      state->m_io[0x0f] = data;
437437      break;
438438
r17788r17789
563563   /* cards */
564564   case 0x0e: /* detection */
565565      data = state->m_io[0x0e];
566      LOG(( "%05x: card control read %02x\n", cpu_get_previouspc(&space->device()), data ));
566      LOG(( "%05x: card control read %02x\n", space->device().safe_pcbase(), data ));
567567      break;
568568   case 0x0f: /* card info */
569569      data = 0;
r17788r17789
581581         if ( state->m_port_size[0] && state->m_port_write[0] ) data |= 4;
582582         if ( state->m_port_size[1] && state->m_port_write[1] ) data |= 8;
583583      }
584      LOG(( "%05x: card info read %02x\n", cpu_get_previouspc(&space->device()), data ));
584      LOG(( "%05x: card info read %02x\n", space->device().safe_pcbase(), data ));
585585      break;
586586
587587
r17788r17789
589589   }
590590
591591   LOG(( "%05x %f hp48_io_r: off=%02x data=%x\n",
592         cpu_get_previouspc(&space->device()), space->machine().time().as_double(), offset, data ));
592         space->device().safe_pcbase(), space->machine().time().as_double(), offset, data ));
593593   return data;
594594}
595595
r17788r17789
603603   offset &= 0x7e;
604604   if ( state->m_bank_switch != offset )
605605   {
606      LOG(( "%05x %f hp48_bank_r: off=%03x\n", cpu_get_previouspc(&space->device()), space->machine().time().as_double(), offset ));
606      LOG(( "%05x %f hp48_bank_r: off=%03x\n", space->device().safe_pcbase(), space->machine().time().as_double(), offset ));
607607      state->m_bank_switch = offset;
608608      hp48_apply_modules(state);
609609   }
r17788r17789
834834/* RESET opcode */
835835void hp48_mem_reset( device_t *device )
836836{
837   LOG(( "%05x %f hp48_mem_reset\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double() ));
837   LOG(( "%05x %f hp48_mem_reset\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double() ));
838838   hp48_reset_modules(device->machine());
839839}
840840
r17788r17789
845845   hp48_state *state = device->machine().driver_data<hp48_state>();
846846   int i;
847847
848   LOG(( "%05x %f hp48_mem_config: %05x\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), v ));
848   LOG(( "%05x %f hp48_mem_config: %05x\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), v ));
849849
850850   /* find the highest priority unconfigured module (except non-configurable NCE1)... */
851851   for ( i = 0; i < 5; i++ )
r17788r17789
877877{
878878   hp48_state *state = device->machine().driver_data<hp48_state>();
879879   int i;
880   LOG(( "%05x %f hp48_mem_unconfig: %05x\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), v ));
880   LOG(( "%05x %f hp48_mem_unconfig: %05x\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), v ));
881881
882882   /* find the highest priority fully configured module at address v (except NCE1)... */
883883   for ( i = 0; i < 5; i++ )
r17788r17789
921921   }
922922
923923   LOG(( "%05x %f hp48_mem_id = %02x\n",
924         cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data ));
924         device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ));
925925
926926   return data; /* everything is configured */
927927}
trunk/src/mess/machine/macpci.c
r17788r17789
5353{
5454//  macpci_state *mac = device->machine().driver_data<macpci_state>();
5555
56//    printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(mac->m_maincpu));
56//    printf("VIA1 IN_A (PC %x)\n", mac->m_maincpu->safe_pc());
5757
5858   return 0x80;
5959}
r17788r17789
6565
6666    val |= mac->m_cuda->get_treq()<<3;
6767
68//    printf("VIA1 IN B = %02x (PC %x)\n", val, cpu_get_pc(mac->m_maincpu));
68//    printf("VIA1 IN B = %02x (PC %x)\n", val, mac->m_maincpu->safe_pc());
6969
7070    return val;
7171}
r17788r17789
7474{
7575//  macpci_state *mac = device->machine().driver_data<macpci_state>();
7676
77//    printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(mac->m_maincpu));
77//    printf("VIA1 OUT A: %02x (PC %x)\n", data, mac->m_maincpu->safe_pc());
7878}
7979
8080static WRITE8_DEVICE_HANDLER(mac_via_out_b)
8181{
8282   macpci_state *mac = device->machine().driver_data<macpci_state>();
8383
84//    printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(mac->m_maincpu));
84//    printf("VIA1 OUT B: %02x (PC %x)\n", data, mac->m_maincpu->safe_pc());
8585
8686    #if LOG_ADB
87    printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, cpu_get_pc(mac->m_maincpu));
87    printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->safe_pc());
8888    #endif
8989    mac->m_cuda->set_byteack((data&0x10) ? 1 : 0);
9090    mac->m_cuda->set_tip((data&0x20) ? 1 : 0);
r17788r17789
9898   offset &= 0x0f;
9999
100100   if (LOG_VIA)
101      printf("mac_via_r: offset=0x%02x (PC=%x)\n", offset, cpu_get_pc(m_maincpu));
101      printf("mac_via_r: offset=0x%02x (PC=%x)\n", offset, m_maincpu->safe_pc());
102102   data = m_via1->read(space, offset);
103103
104104   device_adjust_icount(m_maincpu, m_via_cycles);
r17788r17789
112112   offset &= 0x0f;
113113
114114   if (LOG_VIA)
115      printf("mac_via_w: offset=0x%02x data=0x%08x (PC=%x)\n", offset, data, cpu_get_pc(m_maincpu));
115      printf("mac_via_w: offset=0x%02x data=0x%08x (PC=%x)\n", offset, data, m_maincpu->safe_pc());
116116
117117   if (ACCESSING_BITS_0_7)
118118      m_via1->write(space, offset, data & 0xff);
r17788r17789
181181
182182READ32_MEMBER(macpci_state::mac_read_id)
183183{
184    printf("Mac read ID reg @ PC=%x\n", cpu_get_pc(m_maincpu));
184    printf("Mac read ID reg @ PC=%x\n", m_maincpu->safe_pc());
185185
186186   switch (m_model)
187187   {
trunk/src/mess/machine/c65.c
r17788r17789
508508static void c65_fdc_w( running_machine &machine, int offset, int data )
509509{
510510   c65_state *state = machine.driver_data<c65_state>();
511   DBG_LOG(machine, 1, "fdc write", ("%.5x %.2x %.2x\n", cpu_get_pc(machine.device("maincpu")), offset, data));
511   DBG_LOG(machine, 1, "fdc write", ("%.5x %.2x %.2x\n", machine.device("maincpu")->safe_pc(), offset, data));
512512   switch (offset & 0xf)
513513   {
514514   case 0:
r17788r17789
593593      data = state->m_fdc.reg[offset & 0xf];
594594      break;
595595   }
596   DBG_LOG(machine, 1, "fdc read", ("%.5x %.2x %.2x\n", cpu_get_pc(machine.device("maincpu")), offset, data));
596   DBG_LOG(machine, 1, "fdc read", ("%.5x %.2x %.2x\n", machine.device("maincpu")->safe_pc(), offset, data));
597597   return data;
598598}
599599
trunk/src/mess/machine/ncr5380.c
r17788r17789
237237   }
238238
239239   if (VERBOSE)
240      logerror("NCR5380: read %s (reg %d) = %02x [PC=%x]\n", rnames[reg], reg, rv, cpu_get_pc(machine().firstcpu));
240      logerror("NCR5380: read %s (reg %d) = %02x [PC=%x]\n", rnames[reg], reg, rv, machine().firstcpu->safe_pc());
241241
242242   return rv;
243243}
r17788r17789
247247   int reg = offset & 7;
248248
249249   if (VERBOSE)
250      logerror("NCR5380: %02x to %s (reg %d) [PC=%x]\n", data, wnames[reg], reg, cpu_get_pc(machine().firstcpu));
250      logerror("NCR5380: %02x to %s (reg %d) [PC=%x]\n", data, wnames[reg], reg, machine().firstcpu->safe_pc());
251251
252252   switch( reg )
253253   {
r17788r17789
334334               if (get_cmd_len(m_5380_Command[0]) == m_cmd_ptr)
335335               {
336336                  if (VERBOSE)
337                     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));
337                     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());
338338
339339                  m_scsi_devices[m_last_id]->SetCommand(&m_5380_Command[0], 16);
340340                  m_scsi_devices[m_last_id]->ExecCommand(&m_d_limit);
trunk/src/mess/machine/rm380z.c
r17788r17789
2929   switch ( offset )
3030   {
3131   case 0xFC:      // PORT0
32      //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);
32      //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);
3333      m_port0 = data;
3434      if (data&0x01)
3535      {
r17788r17789
4343      break;
4444
4545   case 0xFD:      // screen line counter (?)
46      //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);
46      //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);
4747
4848      m_old_old_fbfd=m_old_fbfd;
4949      m_old_fbfd=m_fbfd;
r17788r17789
5656      break;
5757
5858   case 0xFE:      // line on screen to write to divided by 2
59      //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);
59      //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);
6060      m_fbfe=data;
6161      break;
6262
r17788r17789
8181      data = m_port0_kbd;
8282      //if (m_port0_kbd!=0) m_port0_kbd=0;
8383      //m_port0_kbd=0;
84      //printf("read of port0 (kbd) from PC [%x]\n",cpu_get_pc(machine().device("maincpu")));
84      //printf("read of port0 (kbd) from PC [%x]\n",machine().device("maincpu")->safe_pc());
8585      break;
8686
8787   case 0xFD:      // "counter" (?)
r17788r17789
9191
9292   case 0xFE:      // PORT1
9393      data = m_port1;
94      //printf("read of port1 from PC [%x]\n",cpu_get_pc(machine().device("maincpu")));
94      //printf("read of port1 from PC [%x]\n",machine().device("maincpu")->safe_pc());
9595      break;
9696
9797   case 0xFF:      // user port
r17788r17789
134134
135135WRITE8_MEMBER( rm380z_state::rm380z_portlow_w )
136136{
137   //printf("port write [%x] [%x] at PC [%x]\n",offset,data,cpu_get_pc(machine().device("maincpu")));
137   //printf("port write [%x] [%x] at PC [%x]\n",offset,data,machine().device("maincpu")->safe_pc());
138138}
139139
140140READ8_MEMBER( rm380z_state::rm380z_porthi_r )
trunk/src/mess/machine/isa_ide_cd.c
r17788r17789
127127      }
128128      if (m_cur_drive==1) return 0x00;
129129      data = atapi_regs[reg];
130      //logerror("ATAPI: reg %d = %x (offset %x mask %x) [%08x][read]\n", reg, data, offset, mem_mask,cpu_get_pc(machine().device("maincpu")));
130      //logerror("ATAPI: reg %d = %x (offset %x mask %x) [%08x][read]\n", reg, data, offset, mem_mask,machine().device("maincpu")->safe_pc());
131131       data <<= shift;
132132   }
133133   return data;
trunk/src/mess/machine/a2cffa.c
r17788r17789
233233{
234234   if (!m_writeprotect)
235235   {
236//      printf("Write %02x to EEPROM at %x (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
236//      printf("Write %02x to EEPROM at %x (PC=%x)\n", data, offset, space.device().safe_pc());
237237      m_eeprom[offset + 0x800] = data;
238238   }
239239}
trunk/src/mess/machine/coco.c
r17788r17789
261261   address_space *program = m_maincpu->space(AS_PROGRAM);
262262
263263   // get the previous and current PC
264   UINT16 prev_pc = cpu_get_previouspc(m_maincpu);
265   UINT16 pc = cpu_get_pc(m_maincpu);
264   UINT16 prev_pc = m_maincpu->safe_pcbase();
265   UINT16 pc = m_maincpu->safe_pc();
266266
267267   // get the byte; and skip over header bytes
268268   byte = program->read_byte(prev_pc);
trunk/src/mess/machine/gb.c
r17788r17789
430430
431431WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc3)
432432{
433   logerror( "0x%04X: write to mbc3 rom bank select register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data );
433   logerror( "0x%04X: write to mbc3 rom bank select register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data );
434434   data &= 0x7F; /* Only uses lower 7 bits */
435435   /* Selecting bank 0 == selecting bank 1 */
436436   if( data == 0 )
r17788r17789
447447      Writing into 2000-2FFF sets the lower 8 bits
448448      Writing into 3000-3FFF sets the 9th bit
449449    */
450   logerror( "0x%04X: MBC5 ROM Bank select write 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data );
450   logerror( "0x%04X: MBC5 ROM Bank select write 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data );
451451   if( offset & 0x1000 )
452452   {
453453      m_ROMBank = (m_ROMBank & 0xFF ) | ( ( data & 0x01 ) << 8 );
r17788r17789
462462
463463WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc6)
464464{
465   logerror( "0x%04X: write to mbc6 ram enable area: %04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data );
465   logerror( "0x%04X: write to mbc6 ram enable area: %04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data );
466466}
467467
468468WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc6_1)
469469{
470   logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x2000 + offset, data );
470   logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x2000 + offset, data );
471471   if ( offset & 0x0800 )
472472   {
473473      if ( data == 0x00 )
r17788r17789
483483
484484WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc6_2)
485485{
486   logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x3000 + offset, data );
486   logerror( "0x%04X: write to mbc6 rom area: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x3000 + offset, data );
487487   if ( offset & 0x0800 )
488488   {
489489      if ( data == 0x00 )
r17788r17789
499499
500500WRITE8_MEMBER(gb_state::gb_rom_bank_select_mbc7)
501501{
502   logerror( "0x%04X: write to mbc7 rom select register: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x2000 + offset, data );
502   logerror( "0x%04X: write to mbc7 rom select register: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x2000 + offset, data );
503503   /* Bit 12 must be set for writing to the mbc register */
504504   if ( offset & 0x0100 )
505505   {
r17788r17789
510510
511511WRITE8_MEMBER(gb_state::gb_rom_bank_unknown_mbc7)
512512{
513        logerror( "0x%04X: write to mbc7 rom area: 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0x3000 + offset, data );
513        logerror( "0x%04X: write to mbc7 rom area: 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0x3000 + offset, data );
514514   /* Bit 12 must be set for writing to the mbc register */
515515   if ( offset & 0x0100 )
516516   {
r17788r17789
528528
529529WRITE8_MEMBER(gb_state::gb_rom_bank_select_wisdom)
530530{
531   logerror( "0x%04X: wisdom tree mapper write to address 0x%04X\n", cpu_get_pc( &space.device() ), offset );
531   logerror( "0x%04X: wisdom tree mapper write to address 0x%04X\n", space.device() .safe_pc( ), offset );
532532   /* The address determines the bank to select */
533533   m_ROMBank = ( offset << 1 ) & 0x1FF;
534534   membank( "bank5" )->set_base( m_ROMMap[ m_ROMBank ] );
r17788r17789
549549
550550WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc3)
551551{
552   logerror( "0x%04X: write mbc3 ram bank select register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data );
552   logerror( "0x%04X: write mbc3 ram bank select register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data );
553553   if( data & 0x8 )
554554   {   /* RTC banks */
555555      if ( m_CartType & TIMER )
r17788r17789
573573
574574WRITE8_MEMBER(gb_state::gb_ram_bank_select_mbc5)
575575{
576   logerror( "0x%04X: MBC5 RAM Bank select write 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data );
576   logerror( "0x%04X: MBC5 RAM Bank select write 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data );
577577   data &= 0x0F;
578578   if( m_CartType & RUMBLE )
579579   {
r17788r17789
588588{
589589   /* FIXME: Currently we don't handle this, but a value of 0xA will enable
590590     * writing to the cart's RAM banks */
591   logerror( "0x%04X: Write to ram enable register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data );
591   logerror( "0x%04X: Write to ram enable register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data );
592592}
593593
594594WRITE8_MEMBER(gb_state::gb_mem_mode_select_mbc1)
r17788r17789
599599
600600WRITE8_MEMBER(gb_state::gb_mem_mode_select_mbc3)
601601{
602        logerror( "0x%04X: Write to mbc3 mem mode select register 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), offset, data );
602        logerror( "0x%04X: Write to mbc3 mem mode select register 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), offset, data );
603603   if( m_CartType & TIMER )
604604   {
605605      /* FIXME: RTC Latch goes here */
r17788r17789
613613
614614WRITE8_MEMBER(gb_state::gb_ram_tama5)
615615{
616   logerror( "0x%04X: TAMA5 write 0x%04X <- 0x%02X\n", cpu_get_pc( &space.device() ), 0xA000 + offset, data );
616   logerror( "0x%04X: TAMA5 write 0x%04X <- 0x%02X\n", space.device() .safe_pc( ), 0xA000 + offset, data );
617617   switch( offset & 0x0001 )
618618   {
619619   case 0x0000:    /* Write to data register */
r17788r17789
657657            }
658658         case 0x80:      /* Unknown, some kind of read (when 07=01)/write (when 07=00/02) */
659659         default:
660            logerror( "0x%04X: Unknown addressing mode\n", cpu_get_pc( &space.device() ) );
660            logerror( "0x%04X: Unknown addressing mode\n", space.device() .safe_pc( ) );
661661            break;
662662         }
663663         break;
r17788r17789
684684         m_MBC3RTCData[0] = ( m_gbTama5Byte & 0xF0 ) >> 4;
685685         break;
686686      default:
687         logerror( "0x%04X: Unknown tama5 command 0x%02X\n", cpu_get_pc( &space.device() ), data );
687         logerror( "0x%04X: Unknown tama5 command 0x%02X\n", space.device() .safe_pc( ), data );
688688         break;
689689      }
690690      m_gbLastTama5Command = data;
r17788r17789
697697
698698WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_0000_w)
699699{
700   logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x000 );
700   logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x000 );
701701   if ( data & 0x40 )
702702   {
703703      m_mmm01_bank_offset = m_mmm01_reg1;
r17788r17789
709709
710710WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_2000_w)
711711{
712   logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x2000 );
712   logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x2000 );
713713
714714   m_mmm01_reg1 = data & m_ROMMask;
715715   m_mmm01_bank = m_mmm01_reg1 & m_mmm01_bank_mask;
r17788r17789
722722
723723WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_4000_w)
724724{
725   logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x4000 );
725   logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x4000 );
726726}
727727
728728WRITE8_MEMBER(gb_state::gb_rom_bank_mmm01_6000_w)
729729{
730   logerror( "0x%04X: write 0x%02X to 0x%04X\n", cpu_get_pc( &space.device() ), data, offset+0x6000 );
730   logerror( "0x%04X: write 0x%02X to 0x%04X\n", space.device() .safe_pc( ), data, offset+0x6000 );
731731   /* Not sure if this is correct, Taito Variety Pack sets these values */
732732   /* Momotarou Collection 2 writes 01 and 21 here */
733733   switch( data )
trunk/src/mess/machine/thomson.c
r17788r17789
103103         if ( bitpos >= to7_k7_bitsize )
104104            bitpos = to7_k7_bitsize -1;
105105         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n",
106            cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), state, pos, bitpos,
106            machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), state, pos, bitpos,
107107            to7_k7_bits[ bitpos ] ));
108108         return to7_k7_bits[ bitpos ];
109109      }
r17788r17789
124124         }
125125         k = ( chg >= 13 ) ? 1 : 0;
126126         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n",
127            cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), state, pos, bitpos,
127            machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), state, pos, bitpos,
128128            k, chg ));
129129         return k;
130130      }
r17788r17789
152152   double pos = img->get_position();
153153
154154   LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n",
155          cpu_get_previouspc(device->machine().device("maincpu")), img->machine().time().as_double(), data ? "off" : "on",
155          device->machine().device("maincpu")->safe_pcbase(), img->machine().time().as_double(), data ? "off" : "on",
156156          (int) (pos / TO7_BIT_LENGTH) ));
157157
158158   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 )
r17788r17789
203203      hbit = hbit >= 0;
204204
205205      VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n",
206         cpu_get_previouspc(machine.device("maincpu")), machine.time().as_double(), state, pos,
206         machine.device("maincpu")->safe_pcbase(), machine.time().as_double(), state, pos,
207207         (int) (pos / MO5_HBIT_LENGTH), hbit ));
208208      return hbit;
209209   }
r17788r17789
228228   double pos = img->get_position();
229229
230230   LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n",
231          cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), data ? "off" : "on",
231          device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ? "off" : "on",
232232          (int) (pos / MO5_HBIT_LENGTH) ));
233233
234234   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED &&  !data && pos > 0.3 )
r17788r17789
734734   int tx  = data & 1;
735735   int dtr = ( data & 2 ) ? 1 : 0;
736736
737   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 ));
737   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  machine().device("maincpu")->safe_pcbase(), machine().time().as_double(), tx, dtr ));
738738   if ( dtr )
739739      m_connection_state |=  SERIAL_STATE_DTR;
740740   else
r17788r17789
758758   else
759759      cts = !printer->busy_r();
760760
761   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 ));
761   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 ));
762762
763763   return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0);
764764}
r17788r17789
769769{
770770   centronics_device *printer = device->machine().device<centronics_device>("centronics");
771771
772   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 ));
772   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ));
773773
774774   /* set 8-bit data */
775775   printer->write( *device->machine().memory().first_space(), 0, data);
r17788r17789
781781{
782782   centronics_device *printer = device->machine().device<centronics_device>("centronics");
783783
784   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 ));
784   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 ));
785785
786786   /* send STROBE to printer */
787787   printer->strobe_w(data);
r17788r17789
12831283      /* bit 6:     parity error (ignored) */
12841284      /* bit 7:     interrupt */
12851285      LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
1286           cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), to7_midi_status,
1286           space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), to7_midi_status,
12871287           (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
12881288           (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0,
12891289           (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
r17788r17789
13031303                                to7_midi_status &= ~ACIA_6850_OVRN;
13041304                        to7_midi_overrun = 0;
13051305                        LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n",
1306                                   cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data ));
1306                                   space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data ));
13071307                        to7_midi_update_irq( space->machine() );
13081308                }
13091309                return data;
r17788r17789
13121312
13131313   default:
13141314      logerror( "$%04x to7_midi_r: invalid offset %i\n",
1315           cpu_get_previouspc(space->machine().device("maincpu")),  offset );
1315           space->machine().device("maincpu")->safe_pcbase(),  offset );
13161316      return 0;
13171317   }
13181318}
r17788r17789
13311331      if ( (data & 3) == 3 )
13321332      {
13331333         /* reset */
1334         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data ));
1334         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data ));
13351335         to7_midi_overrun = 0;
13361336         to7_midi_status = 2;
13371337         to7_midi_intr = 0;
r17788r17789
13481348            static const int stop[8] = { 2,2,1,1,2,1,1,1 };
13491349            static const char parity[8] = { 'e','o','e','o','-','-','e','o' };
13501350            LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
1351                 cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
1351                 space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
13521352                 data,
13531353                 bits[ (data >> 2) & 7 ],
13541354                 stop[ (data >> 2) & 7 ],
r17788r17789
13621362
13631363
13641364   case 1: /* output data */
1365      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data ));
1365      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data ));
13661366      if ( data == 0x55 )
13671367         /* cable-detect: shortcut */
13681368         chardev_fake_in( to7_midi_chardev, 0x55 );
r17788r17789
13761376
13771377
13781378   default:
1379      logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
1379      logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", space->machine().device("maincpu")->safe_pcbase(), offset, data );
13801380   }
13811381}
13821382
r17788r17789
15461546static WRITE8_DEVICE_HANDLER ( to770_sys_cb2_out )
15471547{
15481548   /* video overlay: black pixels are transparent and show TV image underneath */
1549   LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc(device->machine().device("maincpu")), data ));
1549   LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", device->machine().device("maincpu")->safe_pcbase(), data ));
15501550}
15511551
15521552
r17788r17789
16901690   case 2: return (lt3 << 7) | (inil << 6);
16911691   case 3: return (init << 7);
16921692   default:
1693      logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset );
1693      logerror( "$%04x to770_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset );
16941694      return 0;
16951695   }
16961696}
r17788r17789
19211921   case 2: return (lt3 << 7) | (inil << 6);
19221922   case 3: return (init << 7);
19231923   default:
1924      logerror( "$%04x mo5_gatearray_r: invalid offset %i\n",  cpu_get_previouspc(space->machine().device("maincpu")), offset );
1924      logerror( "$%04x mo5_gatearray_r: invalid offset %i\n",  space->machine().device("maincpu")->safe_pcbase(), offset );
19251925      return 0;
19261926   }
19271927}
r17788r17789
22032203
22042204WRITE8_HANDLER ( to9_ieee_w )
22052205{
2206   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 );
2206   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 );
22072207}
22082208
22092209
22102210
22112211READ8_HANDLER  ( to9_ieee_r )
22122212{
2213   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 );
2213   logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset );
22142214   return 0;
22152215}
22162216
r17788r17789
22412241   case 2: return (lt3 << 7) | (inil << 6);
22422242   case 3: return (v.init << 7) | (init << 6); /* != TO7/70 */
22432243   default:
2244      logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset );
2244      logerror( "$%04x to9_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset );
22452245      return 0;
22462246   }
22472247}
r17788r17789
23392339
23402340WRITE8_HANDLER ( to9_vreg_w )
23412341{
2342   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 ));
2342   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 ));
23432343
23442344   switch ( offset )
23452345   {
r17788r17789
26682668      /* bit 7:     interrupt */
26692669
26702670      LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
2671           cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), to9_kbd_status,
2671           space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), to9_kbd_status,
26722672           (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0,
26732673           (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0,
26742674           (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0,
r17788r17789
26852685         else
26862686            to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF);
26872687         to9_kbd_overrun = 0;
2688         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 ));
2688         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 ));
26892689         to9_kbd_update_irq(space->machine());
26902690      }
26912691      return to9_kbd_in;
26922692
26932693   default:
2694      logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")),  offset );
2694      logerror( "$%04x to9_kbd_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(),  offset );
26952695      return 0;
26962696   }
26972697}
r17788r17789
27132713         to9_kbd_overrun = 0;
27142714         to9_kbd_status = ACIA_6850_TDRE;
27152715         to9_kbd_intr = 0;
2716         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data ));
2716         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data ));
27172717      }
27182718      else
27192719      {
r17788r17789
27272727         to9_kbd_intr = data >> 5;
27282728
27292729         LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
2730              cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
2730              space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
27312731              data, to9_kbd_parity, to9_kbd_intr >> 2,
27322732              (to9_kbd_intr & 3) ? 1 : 0 ));
27332733      }
r17788r17789
27582758      case 0xFE: to9_kbd_periph = 0; break;
27592759
27602760      default:
2761         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data );
2761         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data );
27622762      }
27632763
27642764      thom_set_caps_led( space->machine(), !to9_kbd_caps );
27652765
27662766      LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n",
2767            cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data,
2767            space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data,
27682768            to9_kbd_caps, to9_kbd_pad, to9_kbd_periph ));
27692769
27702770      break;
27712771
27722772   default:
2773      logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
2773      logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", space->machine().device("maincpu")->safe_pcbase(), offset, data );
27742774   }
27752775}
27762776
r17788r17789
39163916      break;
39173917
39183918   default:
3919      logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset );
3919      logerror( "$%04x to8_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset );
39203920      res = 0;
39213921   }
39223922
39233923   LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
3924        cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
3924        space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
39253925        offset, 0xe7e4 + offset, res, to7_lightpen ));
39263926
39273927   return res;
r17788r17789
39323932WRITE8_HANDLER ( to8_gatearray_w )
39333933{
39343934   LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n",
3935        cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
3935        space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
39363936        offset, 0xe7e4 + offset, data ));
39373937
39383938   switch ( offset )
r17788r17789
39643964
39653965   default:
39663966      logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n",
3967           cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
3967           space->machine().device("maincpu")->safe_pcbase(), offset, data );
39683968   }
39693969}
39703970
r17788r17789
40194019WRITE8_HANDLER ( to8_vreg_w )
40204020{
40214021   LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n",
4022        cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
4022        space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
40234023        offset, 0xe7da + offset, data ));
40244024
40254025   switch ( offset )
r17788r17789
40754075{
40764076   int ktest = to8_kbd_ktest (device->machine());
40774077
4078   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(device->machine().device("maincpu")), device->machine().time().as_double(), ktest ));
4078   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), ktest ));
40794079
40804080   return ktest;
40814081}
r17788r17789
47574757{
47584758   centronics_device *printer = device->machine().device<centronics_device>("centronics");
47594759
4760   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 ));
4760   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ));
47614761
47624762   /* centronics data */
47634763   printer->write( *device->machine().memory().first_space(), 0, data);
r17788r17789
47694769{
47704770   centronics_device *printer = device->machine().device<centronics_device>("centronics");
47714771
4772   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 ));
4772   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", device->machine().device("maincpu")->safe_pcbase(), device->machine().time().as_double(), data ));
47734773
47744774   /* centronics strobe */
47754775   printer->strobe_w(data);
r17788r17789
49754975      break;
49764976
49774977   default:
4978      logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc(space->machine().device("maincpu")), offset );
4978      logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", space->machine().device("maincpu")->safe_pcbase(), offset );
49794979      res = 0;
49804980   }
49814981
49824982   LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
4983        cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
4983        space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
49844984        offset, 0xa7e4 + offset, res, to7_lightpen ));
49854985
49864986   return res;
r17788r17789
49914991WRITE8_HANDLER ( mo6_gatearray_w )
49924992{
49934993   LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n",
4994        cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
4994        space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
49954995        offset, 0xa7e4 + offset, data ));
49964996
49974997   switch ( offset )
r17788r17789
50215021      break;
50225022
50235023   default:
5024      logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
5024      logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", space->machine().device("maincpu")->safe_pcbase(), offset, data );
50255025   }
50265026}
50275027
r17788r17789
50615061WRITE8_HANDLER ( mo6_vreg_w )
50625062{
50635063   LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n",
5064        cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(),
5064        space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(),
50655065        offset, 0xa7da + offset, data ));
50665066
50675067   switch ( offset )
r17788r17789
52195219   if ( to7_controller_type )
52205220      return to7_floppy_r ( space, offset );
52215221
5222   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), offset );
5222   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), offset );
52235223
52245224   return 0;
52255225}
r17788r17789
52325232      to7_floppy_w ( space, offset, data );
52335233   else
52345234      logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n",
5235           cpu_get_previouspc(space->machine().device("maincpu")), space->machine().time().as_double(), data, offset );
5235           space->machine().device("maincpu")->safe_pcbase(), space->machine().time().as_double(), data, offset );
52365236}
52375237
52385238
trunk/src/mess/machine/psxcd.c
r17788r17789
222222   }
223223
224224   #ifdef debug_cdrom_registers
225      printf("cdrom: read byte %08x = %02x (PC=%x)\n",addr,ret,cpu_get_pc(machine().device("maincpu")));
225      printf("cdrom: read byte %08x = %02x (PC=%x)\n",addr,ret,machine().device("maincpu")->safe_pc());
226226   #endif
227227
228228   return ret;
r17788r17789
235235void psxcd_device::write_byte(const unsigned int addr, const unsigned char byte)
236236{
237237   #ifdef debug_cdrom_registers
238      printf("cdrom: write byte %08x = %02x (PC=%x)\n",addr,byte,cpu_get_pc(machine().device("maincpu")));
238      printf("cdrom: write byte %08x = %02x (PC=%x)\n",addr,byte,machine().device("maincpu")->safe_pc());
239239   #endif
240240
241241   switch (addr&3)
trunk/src/mess/machine/thomflop.c
r17788r17789
280280   else if ( offset == 8 )
281281      return to7_5p14_select;
282282   else
283      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset );
283      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset );
284284   return 0;
285285}
286286
r17788r17789
304304      case 4: drive = 2; side = 0; break;
305305      case 5: drive = 3; side = 1; break;
306306      default:
307         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 );
307         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data );
308308      }
309309
310310      wd17xx_dden_w(fdc, BIT(data, 7));
r17788r17789
317317         wd17xx_set_drive( fdc, drive );
318318         wd17xx_set_side( fdc, side );
319319         LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n",
320               space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")),
320               space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(),
321321               data, drive, side, (BIT(data, 7) ? "FM" : "MFM")));
322322      }
323323   }
324324   else
325325      logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n",
326            space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
326            space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data );
327327}
328328
329329
r17788r17789
366366   else if ( offset >= 8 && offset <= 9 )
367367      return to7_5p14sd_select;
368368   else
369      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset );
369      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset );
370370   return 0;
371371}
372372
r17788r17789
410410         mc6843_set_drive( space->machine().device("mc6843"), drive );
411411         mc6843_set_side( space->machine().device("mc6843"), side );
412412         LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n",
413               space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data, drive, side ));
413               space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data, drive, side ));
414414      }
415415   }
416416   else
417417      logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n",
418            space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
418            space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data );
419419}
420420
421421static void to7_5p14_index_pulse_callback( device_t *controller,device_t *image, int state )
r17788r17789
592592      data = to7qdd->data[ to7qdd->data_idx ];
593593
594594   VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n",
595          machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")),
595          machine.time().as_double(), machine.device("maincpu")->safe_pcbase(),
596596          to7qdd->data_idx, to7qdd->data_size, data ));
597597
598598   to7qdd->data_idx++;
r17788r17789
633633      to7qdd->data_idx++;
634634
635635      VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n",
636         machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data,
636         machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data,
637637         to7qdd->start_idx, to7qdd->data_idx ));
638638
639639      /* end of tentative id field */
r17788r17789
647647         UINT8 filler = 0xff;
648648
649649         LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
650               machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector ));
650               machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector ));
651651
652652         floppy_drive_format_sector( to7_qdd_image(machine),
653653                      0, sector, 0, 0, sector, 128, filler );
r17788r17789
677677            int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ];
678678
679679            LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
680                  machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector ));
680                  machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector ));
681681
682682            floppy_drive_write_sector_data( to7_qdd_image(machine), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
683683                                thom_floppy_active( machine, 1 );
r17788r17789
700700   case 0: /* MC6852 status */
701701      to7_qdd_stat_update(space->machine());
702702      VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n",
703             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), to7qdd->status,
703             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), to7qdd->status,
704704             to7qdd->status & QDD_S_IRQ  ? 1 : 0,
705705             to7qdd->status & QDD_S_PE   ? 1 : 0,
706706             to7qdd->status & QDD_S_OVR  ? 1 : 0,
r17788r17789
723723         data |= 0x40; /* disk present */
724724      if ( to7qdd->index_pulse )
725725         data |= 0x80; /* disk start */
726      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
726      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
727727      return data;
728728   }
729729
730730   default:
731      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset );
731      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset );
732732      return 0;
733733   }
734734}
r17788r17789
750750      to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data &  (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 );
751751      to7_qdd_stat_update(space->machine());
752752      VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n",
753             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
753             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
754754             data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-',
755755             data & QDD_C1_STRIPSYNC ? "strip-sync " : "",
756756             data & QDD_C1_CLRSYNC ? "clear-sync " : "",
r17788r17789
774774         parity = par[ (data >> 3) & 7 ];
775775         to7_qdd_stat_update(space->machine());
776776         VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n",
777                space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
777                space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
778778                bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2,
779779                data & QDD_C2_TSYNC ? "sync" : "ff",
780780                data & QDD_C2_EIE ? "irq-err" : "" ));
r17788r17789
792792            to7qdd->status &= ~QDD_S_NCTS;
793793         to7_qdd_stat_update(space->machine());
794794         VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n",
795                space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
795                space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
796796                data & QDD_C3_CLRTUF ? "clr-tuf " : "",
797797                data & QDD_C3_CLRCTS ? "clr-cts " : "",
798798                data & QDD_C3_SYNCLEN ? 1 : 2,
r17788r17789
804804         break;
805805
806806      case 3: /* MC6852 data out => does not seem to be used */
807         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
807         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
808808         break;
809809
810810      }
r17788r17789
812812
813813   case 8: /* set drive */
814814      to7qdd->drive = data;
815      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
815      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
816816      break;
817817
818818   case 12: /* motor pulse ? */
819819      thom_floppy_active( space->machine(), 0 );
820      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
820      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
821821      break;
822822
823823   default:
824      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 );
824      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 );
825825   }
826826}
827827
r17788r17789
10521052   UINT8 data = thmfc1->data[ thmfc1->data_idx ];
10531053
10541054   VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n",
1055          machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")),
1055          machine.time().as_double(), machine.device("maincpu")->safe_pcbase(),
10561056          thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1,
10571057          data ));
10581058
r17788r17789
10951095      data = thmfc1->data[ thmfc1->data_raw_idx ];
10961096
10971097   VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n",
1098          machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")),
1098          machine.time().as_double(), machine.device("maincpu")->safe_pcbase(),
10991099          thmfc1->data_raw_idx, thmfc1->data_raw_size, data ));
11001100
11011101   thmfc1->data_raw_idx++;
r17788r17789
11331133      }
11341134
11351135      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n",
1136         machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data,
1136         machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data,
11371137         thmfc1->data_idx,thmfc1->data_raw_idx ));
11381138
11391139      if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 &&
r17788r17789
11451145         int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ];
11461146         UINT8 filler = 0xff;
11471147
1148         LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector ));
1148         LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector ));
11491149
11501150         floppy_drive_format_sector( thmfc_floppy_image(machine), 0, sector, 0, 0, sector, 128, filler );
11511151                        thom_floppy_active( machine, 1 );
r17788r17789
11751175               (int) thmfc1->data[ i + 2 ];
11761176
11771177            LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
1178                  machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), sector ));
1178                  machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), sector ));
11791179
11801180            floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 );
11811181                                thom_floppy_active( machine, 1 );
r17788r17789
11901190   else
11911191   {
11921192      thmfc1->data_raw_idx++;
1193      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data ));
1193      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data ));
11941194   }
11951195
11961196}
r17788r17789
12011201static void thmfc_floppy_write_byte ( running_machine &machine, UINT8 data )
12021202{
12031203   VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n",
1204      machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")),
1204      machine.time().as_double(), machine.device("maincpu")->safe_pcbase(),
12051205      thmfc1->data_idx, thmfc1->data_size - 1, data ));
12061206
12071207   thmfc1->data_raw_size = 0;
r17788r17789
12151215/* intelligent formatting */
12161216static void thmfc_floppy_format_byte ( running_machine &machine, UINT8 data )
12171217{
1218   VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", machine.time().as_double(), cpu_get_previouspc(machine.device("maincpu")), data ));
1218   VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", machine.time().as_double(), machine.device("maincpu")->safe_pcbase(), data ));
12191219
12201220   thmfc1->data_raw_size = 0;
12211221
r17788r17789
12601260
12611261   case 0: /* STAT0 */
12621262      thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL;
1263      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), thmfc1->stat0 ));
1263      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), thmfc1->stat0 ));
12641264      return thmfc1->stat0;
12651265
12661266   case 1: /* STAT1 */
r17788r17789
12921292         data |= 0x10;
12931293      if (!floppy_wpt_r(&img->device()))
12941294         data |= 0x04;
1295      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
1295      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
12961296      return data;
12971297   }
12981298
r17788r17789
13101310   {
13111311      /* undocumented => emulate TO7 QDD controller ? */
13121312      UINT8 data = thmfc1->ipl << 7;
1313      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
1313      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
13141314      return data;
13151315   }
13161316
13171317   default:
1318      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset );
1318      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset );
13191319      return 0;
13201320   }
13211321}
r17788r17789
13331333      chrn_id id;
13341334      thmfc1->formatting = (data >> 2) & 1;
13351335      LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n",
1336             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
1336             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
13371337             (BIT(data, 5) ? "FM" : "MFM"),
13381338             wsync, (data >> 3) & 1,
13391339             thmfc1->formatting, data & 3 ));
r17788r17789
14191419      if ( thmfc1->sector_size > 256 )
14201420      {
14211421         logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n",
1422              cpu_get_previouspc(space->machine().device("maincpu")), thmfc1->sector_size );
1422              space->machine().device("maincpu")->safe_pcbase(), thmfc1->sector_size );
14231423         thmfc1->sector_size = 256;
14241424      }
14251425
14261426      LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n",
1427             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
1427             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
14281428             thmfc1->sector_size, (data >> 1) & 7, thmfc1->side ));
14291429      break;
14301430
r17788r17789
14531453      thom_floppy_active( space->machine(), 0 );
14541454
14551455      LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n",
1456             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
1456             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
14571457             thmfc1->drive, seek, motor ));
14581458
14591459      if ( seek )
r17788r17789
14841484      {
14851485         /* TODO: implement other forms of raw track writing */
14861486         LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n",
1487                space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
1487                space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
14881488      }
14891489      break;
14901490
r17788r17789
14921492   case 4: /* WCLK (unemulated) */
14931493      /* clock configuration: FF for data, 0A for synchro */
14941494      LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n",
1495             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
1495             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
14961496             (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" ));
14971497      break;
14981498
14991499   case 5: /* WSECT */
15001500      thmfc1->sector = data;
15011501      LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n",
1502             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
1502             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
15031503      break;
15041504
15051505   case 6: /* WTRCK */
15061506      thmfc1->track = data;
15071507      LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
1508             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data,
1508             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data,
15091509             floppy_drive_get_current_track( thmfc_floppy_image(space->machine()) ) ));
15101510      break;
15111511
15121512   case 7: /* WCELL */
15131513      /* precompensation (unemulated) */
15141514      LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n",
1515             space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), data ));
1515             space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), data ));
15161516      break;
15171517
15181518   default:
15191519      logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n",
1520            space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
1520            space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data );
15211521   }
15221522}
15231523
r17788r17789
17171717   {
17181718      /* network ID of the computer */
17191719      UINT8 id = space->machine().root_device().ioport("fconfig")->read() >> 3;
1720      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), id ));
1720      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), id ));
17211721      return id;
17221722   }
17231723
1724   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset );
1724   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset );
17251725   return 0;
17261726}
17271727
r17788r17789
17341734   else
17351735   {
17361736      logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n",
1737           space->machine().time().as_double(), cpu_get_previouspc(space->machine().device("maincpu")), offset, data );
1737           space->machine().time().as_double(), space->machine().device("maincpu")->safe_pcbase(), offset, data );
17381738   }
17391739}
17401740
trunk/src/mess/machine/oric.c
r17788r17789
729729         wd17xx_reset(fdc);
730730         break;
731731      case 0x0a:
732         //logerror("jasmin overlay ram w: %02x PC: %04x\n", data, cpu_get_pc(machine().device("maincpu")));
732         //logerror("jasmin overlay ram w: %02x PC: %04x\n", data, machine().device("maincpu")->safe_pc());
733733         m_port_3fa_w = data;
734734         oric_jasmin_set_mem_0x0c000(machine());
735735         break;
736736      case 0x0b:
737         //logerror("jasmin romdis w: %02x PC: %04x\n", data, cpu_get_pc(machine().device("maincpu")));
737         //logerror("jasmin romdis w: %02x PC: %04x\n", data, machine().device("maincpu")->safe_pc());
738738         m_port_3fb_w = data;
739739         oric_jasmin_set_mem_0x0c000(machine());
740740         break;
trunk/src/mess/machine/ncr5390.c
r17788r17789
550550
551551READ8_MEMBER(ncr5390_device::tcount_lo_r)
552552{
553   logerror("%s: tcount_lo_r %02x (%08x)\n", tag(), tcount & 0xff, cpu_get_pc(&space.device()));
553   logerror("%s: tcount_lo_r %02x (%08x)\n", tag(), tcount & 0xff, space.device().safe_pc());
554554   return tcount;
555555}
556556
r17788r17789
558558{
559559   tcount = (tcount & 0xff00) | data;
560560   status &= ~S_TC0;
561   logerror("%s: tcount_lo_w %02x (%08x)\n", tag(), data, cpu_get_pc(&space.device()));
561   logerror("%s: tcount_lo_w %02x (%08x)\n", tag(), data, space.device().safe_pc());
562562}
563563
564564READ8_MEMBER(ncr5390_device::tcount_hi_r)
565565{
566   logerror("%s: tcount_hi_r %02x (%08x)\n", tag(), tcount >> 8, cpu_get_pc(&space.device()));
566   logerror("%s: tcount_hi_r %02x (%08x)\n", tag(), tcount >> 8, space.device().safe_pc());
567567   return tcount >> 8;
568568}
569569
r17788r17789
571571{
572572   tcount = (tcount & 0x00ff) | (data << 8);
573573   status &= ~S_TC0;
574   logerror("%s: tcount_hi_w %02x (%08x)\n", tag(), data, cpu_get_pc(&space.device()));
574   logerror("%s: tcount_hi_w %02x (%08x)\n", tag(), data, space.device().safe_pc());
575575}
576576
577577UINT8 ncr5390_device::fifo_pop()
r17788r17789
611611
612612READ8_MEMBER(ncr5390_device::command_r)
613613{
614   logerror("%s: command_r (%08x)\n", tag(), cpu_get_pc(&space.device()));
614   logerror("%s: command_r (%08x)\n", tag(), space.device().safe_pc());
615615   return command[0];
616616}
617617
618618WRITE8_MEMBER(ncr5390_device::command_w)
619619{
620   //  logerror("%s: command_w %02x (%08x)\n", tag(), data, cpu_get_pc(&space.device()));
620   //  logerror("%s: command_w %02x (%08x)\n", tag(), data, space.device().safe_pc());
621621   if(command_pos == 2) {
622622      status |= S_GROSS_ERROR;
623623      check_irq();
r17788r17789
756756{
757757   UINT32 ctrl = scsi_bus->ctrl_r();
758758   UINT8 res = status | (ctrl & S_MSG ? 4 : 0) | (ctrl & S_CTL ? 2 : 0) | (ctrl & S_INP ? 1 : 0);
759   logerror("%s: status_r %02x (%08x)\n", tag(), res, cpu_get_pc(&space.device()));
759   logerror("%s: status_r %02x (%08x)\n", tag(), res, space.device().safe_pc());
760760   if(irq)
761761      status &= ~(S_GROSS_ERROR|S_PARITY|S_TCC);
762762   return res;
r17788r17789
777777   if(res)
778778      command_pop_and_chain();
779779
780   logerror("%s: istatus_r %02x (%08x)\n", tag(), res, cpu_get_pc(&space.device()));
780   logerror("%s: istatus_r %02x (%08x)\n", tag(), res, space.device().safe_pc());
781781   return res;
782782}
783783
r17788r17789
788788
789789READ8_MEMBER(ncr5390_device::seq_step_r)
790790{
791   logerror("%s: seq_step_r %d (%08x)\n", tag(), seq, cpu_get_pc(&space.device()));
791   logerror("%s: seq_step_r %d (%08x)\n", tag(), seq, space.device().safe_pc());
792792   return seq;
793793}
794794
trunk/src/mess/machine/nextmo.c
r17788r17789
3737
3838READ8_MEMBER(nextmo_device::r4_r)
3939{
40   logerror("nextmo: r4_r %02x (%08x)\n", r4, cpu_get_pc(&space.device()));
40   logerror("nextmo: r4_r %02x (%08x)\n", r4, space.device().safe_pc());
4141   return r4;
4242}
4343
r17788r17789
4646   if(r4 & 1)
4747      device_reset();
4848   r4 = (r4 & (~data & 0xfc)) | (data & 3);
49   logerror("nextmo: r4_w %02x (%08x)\n", r4, cpu_get_pc(&space.device()));
49   logerror("nextmo: r4_w %02x (%08x)\n", r4, space.device().safe_pc());
5050}
5151
5252READ8_MEMBER(nextmo_device::r5_r)
5353{
54   logerror("nextmo: r5_r %02x (%08x)\n", r5, cpu_get_pc(&space.device()));
54   logerror("nextmo: r5_r %02x (%08x)\n", r5, space.device().safe_pc());
5555   return r5;
5656}
5757
5858WRITE8_MEMBER(nextmo_device::r5_w)
5959{
6060   r5 = data;
61   logerror("nextmo: r5_w %02x (%08x)\n", r5, cpu_get_pc(&space.device()));
61   logerror("nextmo: r5_w %02x (%08x)\n", r5, space.device().safe_pc());
6262}
6363
6464READ8_MEMBER(nextmo_device::r6_r)
6565{
66   logerror("nextmo: r6_r %02x (%08x)\n", r6, cpu_get_pc(&space.device()));
66   logerror("nextmo: r6_r %02x (%08x)\n", r6, space.device().safe_pc());
6767   return r6;
6868}
6969
7070WRITE8_MEMBER(nextmo_device::r6_w)
7171{
7272   r6 = data;
73   logerror("nextmo: r6_w %02x (%08x)\n", r6, cpu_get_pc(&space.device()));
73   logerror("nextmo: r6_w %02x (%08x)\n", r6, space.device().safe_pc());
7474}
7575
7676READ8_MEMBER(nextmo_device::r7_r)
7777{
78   logerror("nextmo: r7_r %02x (%08x)\n", r7, cpu_get_pc(&space.device()));
78   logerror("nextmo: r7_r %02x (%08x)\n", r7, space.device().safe_pc());
7979   return r7;
8080}
8181
8282WRITE8_MEMBER(nextmo_device::r7_w)
8383{
8484   r7 = data;
85   logerror("nextmo: r7_w %02x (%08x)\n", r7, cpu_get_pc(&space.device()));
85   logerror("nextmo: r7_w %02x (%08x)\n", r7, space.device().safe_pc());
8686   if(r7 & 0xc0) {
8787      logerror("nextmo: start dma %02x %02x\n", r6, r7);
8888      sector_pos = 0;
r17788r17789
130130
131131READ8_MEMBER(nextmo_device::r8_r)
132132{
133   logerror("nextmo: r8_r (%08x)\n", cpu_get_pc(&space.device()));
133   logerror("nextmo: r8_r (%08x)\n", space.device().safe_pc());
134134   return 0x00;
135135}
136136
137137WRITE8_MEMBER(nextmo_device::r8_w)
138138{
139   logerror("nextmo: r8_w %02x (%08x)\n", data, cpu_get_pc(&space.device()));
139   logerror("nextmo: r8_w %02x (%08x)\n", data, space.device().safe_pc());
140140}
141141
142142READ8_MEMBER(nextmo_device::r9_r)
143143{
144   logerror("nextmo: r9_r (%08x)\n", cpu_get_pc(&space.device()));
144   logerror("nextmo: r9_r (%08x)\n", space.device().safe_pc());
145145   return 0x00;
146146}
147147
148148WRITE8_MEMBER(nextmo_device::r9_w)
149149{
150   logerror("nextmo: r9_w %02x (%08x)\n", data, cpu_get_pc(&space.device()));
150   logerror("nextmo: r9_w %02x (%08x)\n", data, space.device().safe_pc());
151151}
152152
153153READ8_MEMBER(nextmo_device::ra_r)
154154{
155   logerror("nextmo: ra_r (%08x)\n", cpu_get_pc(&space.device()));
155   logerror("nextmo: ra_r (%08x)\n", space.device().safe_pc());
156156   return 0x00;
157157}
158158
159159WRITE8_MEMBER(nextmo_device::ra_w)
160160{
161   logerror("nextmo: ra_w %02x (%08x)\n", data, cpu_get_pc(&space.device()));
161   logerror("nextmo: ra_w %02x (%08x)\n", data, space.device().safe_pc());
162162}
163163
164164READ8_MEMBER(nextmo_device::rb_r)
165165{
166   logerror("nextmo: rb_r (%08x)\n", cpu_get_pc(&space.device()));
166   logerror("nextmo: rb_r (%08x)\n", space.device().safe_pc());
167167   return 0x24;
168168}
169169
170170WRITE8_MEMBER(nextmo_device::rb_w)
171171{
172   logerror("nextmo: rb_w %02x (%08x)\n", data, cpu_get_pc(&space.device()));
172   logerror("nextmo: rb_w %02x (%08x)\n", data, space.device().safe_pc());
173173}
174174
175175READ8_MEMBER(nextmo_device::r10_r)
176176{
177   logerror("nextmo: r10_r %d (%08x)\n", offset, cpu_get_pc(&space.device()));
177   logerror("nextmo: r10_r %d (%08x)\n", offset, space.device().safe_pc());
178178   return 0x00;
179179}
180180
181181WRITE8_MEMBER(nextmo_device::r10_w)
182182{
183   logerror("nextmo: r10_w %d, %02x (%08x)\n", offset, data, cpu_get_pc(&space.device()));
183   logerror("nextmo: r10_w %d, %02x (%08x)\n", offset, data, space.device().safe_pc());
184184}
185185
186186void nextmo_device::check_ecc()
trunk/src/mess/machine/amigacrt.c
r17788r17789
113113static WRITE16_HANDLER( amiga_ar1_chipmem_w )
114114{
115115   amiga_state *state = space->machine().driver_data<amiga_state>();
116   int pc = cpu_get_pc(&space->device());
116   int pc = space->device().safe_pc();
117117
118118   /* see if we're inside the AR1 rom */
119119   if ( ((pc >> 16) & 0xff ) != 0xf0 )
r17788r17789
192192
193193static READ16_HANDLER( amiga_ar23_cia_r )
194194{
195   int pc = cpu_get_pc(&space->device());
195   int pc = space->device().safe_pc();
196196
197197   if ( ACCESSING_BITS_0_7 && offset == 2048 && pc >= 0x40 && pc < 0x120 )
198198   {
r17788r17789
263263static void amiga_ar23_freeze( running_machine &machine )
264264{
265265   amiga_state *state = machine.driver_data<amiga_state>();
266   int pc = cpu_get_pc(machine.device("maincpu"));
266   int pc = machine.device("maincpu")->safe_pc();
267267
268268   /* only freeze if we're not inside the cart's ROM */
269269   if ( ((pc >> 16) & 0xfe ) != 0x40 )
r17788r17789
299299#if 0
300300static WRITE16_HANDLER( amiga_ar23_custom_w )
301301{
302   int pc = cpu_get_pc(&space->device());
302   int pc = space->device().safe_pc();
303303
304304   /* see if we're inside the AR2 rom */
305305   if ( ((pc >> 16) & 0xfe ) != 0x40 )
r17788r17789
320320{
321321   UINT16 data = amiga_custom_r( offset, mem_mask );
322322
323   int pc = cpu_get_pc(&space->device());
323   int pc = space->device().safe_pc();
324324
325325   /* see if we're inside the AR2 rom */
326326   if ( ((pc >> 16) & 0xfe ) != 0x40 )
trunk/src/mess/machine/sms.c
r17788r17789
12261226{
12271227   m_bios_port = data;
12281228
1229   logerror("bios write %02x, pc: %04x\n", data, cpu_get_pc(&space.device()));
1229   logerror("bios write %02x, pc: %04x\n", data, space.device().safe_pc());
12301230
12311231   setup_rom(&space);
12321232}
r17788r17789
20872087
20882088WRITE8_MEMBER(sms_state::sms_store_control_w)
20892089{
2090   logerror("0x%04X: sms_store_control write 0x%02X\n", cpu_get_pc(&space.device()), data);
2090   logerror("0x%04X: sms_store_control write 0x%02X\n", space.device().safe_pc(), data);
20912091   if (data & 0x02)
20922092   {
20932093      machine().device<cpu_device>("maincpu")->resume(SUSPEND_REASON_HALT);
trunk/src/mess/machine/tandy1t.c
r17788r17789
165165
166166WRITE8_HANDLER ( pc_t1t_p37x_w )
167167{
168//  DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", cpu_get_pc( &space->device()),offset, data));
168//  DBG_LOG(2,"T1T_p37x_w",("%.5x #%d $%02x\n", space->device().safe_pc( ),offset, data));
169169   if (offset!=4)
170      logerror("T1T_p37x_w %.5x #%d $%02x\n", cpu_get_pc( &space->device()),offset, data);
170      logerror("T1T_p37x_w %.5x #%d $%02x\n", space->device().safe_pc( ),offset, data);
171171   tandy.data[offset]=data;
172172   switch( offset )
173173   {
r17788r17789
180180 READ8_HANDLER ( pc_t1t_p37x_r )
181181{
182182   int data = tandy.data[offset];
183//  DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", cpu_get_pc( &space->device()), offset, data));
183//  DBG_LOG(1,"T1T_p37x_r",("%.5x #%d $%02x\n", space->device().safe_pc( ), offset, data));
184184    return data;
185185}
186186
trunk/src/mess/machine/compis.c
r17788r17789
550550         case 0x0d:   m_i186.intr.in_service &= ~0x20;   break;
551551         case 0x0e:   m_i186.intr.in_service &= ~0x40;   break;
552552         case 0x0f:   m_i186.intr.in_service &= ~0x80;   break;
553         default:   logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(m_maincpu), data & 0x1f);
553         default:   logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", m_maincpu->safe_pc(), data & 0x1f);
554554      }
555555      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine().time().as_double(), data & 0x1f);
556556   }
r17788r17789
718718      diff = new_control ^ t->control;
719719      if (diff & 0x001c)
720720         logerror("%05X:ERROR! -unsupported timer mode %04X\n",
721            cpu_get_pc(m_maincpu), new_control);
721            m_maincpu->safe_pc(), new_control);
722722
723723      /* if we have real changes, update things */
724724      if (diff != 0)
r17788r17789
820820   diff = new_control ^ d->control;
821821   if (diff & 0x6811)
822822      logerror("%05X:ERROR! - unsupported DMA mode %04X\n",
823         cpu_get_pc(m_maincpu), new_control);
823         m_maincpu->safe_pc(), new_control);
824824
825825   /* if we're going live, set a timer */
826826   if ((diff & 0x0002) && (new_control & 0x0002))
r17788r17789
877877   switch (offset)
878878   {
879879      case 0x11:
880         logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(m_maincpu));
880         logerror("%05X:ERROR - read from 80186 EOI\n", m_maincpu->safe_pc());
881881         break;
882882
883883      case 0x12:
884         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(m_maincpu));
884         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", m_maincpu->safe_pc());
885885         if (m_i186.intr.poll_status & 0x8000)
886886            int_callback(machine().device("maincpu"), 0);
887887         return m_i186.intr.poll_status;
888888
889889      case 0x13:
890         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(m_maincpu));
890         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", m_maincpu->safe_pc());
891891         return m_i186.intr.poll_status;
892892
893893      case 0x14:
894         if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(m_maincpu));
894         if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", m_maincpu->safe_pc());
895895         temp  = (m_i186.intr.timer  >> 3) & 0x01;
896896         temp |= (m_i186.intr.dma[0] >> 1) & 0x04;
897897         temp |= (m_i186.intr.dma[1] >> 0) & 0x08;
r17788r17789
902902         return temp;
903903
904904      case 0x15:
905         if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(m_maincpu));
905         if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", m_maincpu->safe_pc());
906906         return m_i186.intr.priority_mask;
907907
908908      case 0x16:
909         if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(m_maincpu));
909         if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", m_maincpu->safe_pc());
910910         return m_i186.intr.in_service;
911911
912912      case 0x17:
913         if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(m_maincpu));
913         if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", m_maincpu->safe_pc());
914914         temp = m_i186.intr.request & ~0x0001;
915915         if (m_i186.intr.status & 0x0007)
916916            temp |= 1;
917917         return temp;
918918
919919      case 0x18:
920         if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(m_maincpu));
920         if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", m_maincpu->safe_pc());
921921         return m_i186.intr.status;
922922
923923      case 0x19:
924         if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(m_maincpu));
924         if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", m_maincpu->safe_pc());
925925         return m_i186.intr.timer;
926926
927927      case 0x1a:
928         if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(m_maincpu));
928         if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", m_maincpu->safe_pc());
929929         return m_i186.intr.dma[0];
930930
931931      case 0x1b:
932         if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(m_maincpu));
932         if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", m_maincpu->safe_pc());
933933         return m_i186.intr.dma[1];
934934
935935      case 0x1c:
936         if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(m_maincpu));
936         if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", m_maincpu->safe_pc());
937937         return m_i186.intr.ext[0];
938938
939939      case 0x1d:
940         if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(m_maincpu));
940         if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", m_maincpu->safe_pc());
941941         return m_i186.intr.ext[1];
942942
943943      case 0x1e:
944         if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(m_maincpu));
944         if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", m_maincpu->safe_pc());
945945         return m_i186.intr.ext[2];
946946
947947      case 0x1f:
948         if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(m_maincpu));
948         if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", m_maincpu->safe_pc());
949949         return m_i186.intr.ext[3];
950950
951951      case 0x28:
952952      case 0x2c:
953953      case 0x30:
954         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(m_maincpu), (offset - 0x28) / 4);
954         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", m_maincpu->safe_pc(), (offset - 0x28) / 4);
955955         which = (offset - 0x28) / 4;
956956         if (!(offset & 1))
957957            internal_timer_sync(which);
r17788r17789
960960      case 0x29:
961961      case 0x2d:
962962      case 0x31:
963         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(m_maincpu), (offset - 0x29) / 4);
963         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", m_maincpu->safe_pc(), (offset - 0x29) / 4);
964964         which = (offset - 0x29) / 4;
965965         return m_i186.timer[which].maxA;
966966
967967      case 0x2a:
968968      case 0x2e:
969         logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(m_maincpu), (offset - 0x2a) / 4);
969         logerror("%05X:read 80186 Timer %d max B\n", m_maincpu->safe_pc(), (offset - 0x2a) / 4);
970970         which = (offset - 0x2a) / 4;
971971         return m_i186.timer[which].maxB;
972972
973973      case 0x2b:
974974      case 0x2f:
975975      case 0x33:
976         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(m_maincpu), (offset - 0x2b) / 4);
976         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", m_maincpu->safe_pc(), (offset - 0x2b) / 4);
977977         which = (offset - 0x2b) / 4;
978978         return m_i186.timer[which].control;
979979
980980      case 0x50:
981         if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(m_maincpu));
981         if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", m_maincpu->safe_pc());
982982         return m_i186.mem.upper;
983983
984984      case 0x51:
985         if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(m_maincpu));
985         if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", m_maincpu->safe_pc());
986986         return m_i186.mem.lower;
987987
988988      case 0x52:
989         if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(m_maincpu));
989         if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", m_maincpu->safe_pc());
990990         return m_i186.mem.peripheral;
991991
992992      case 0x53:
993         if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(m_maincpu));
993         if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", m_maincpu->safe_pc());
994994         return m_i186.mem.middle;
995995
996996      case 0x54:
997         if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(m_maincpu));
997         if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", m_maincpu->safe_pc());
998998         return m_i186.mem.middle_size;
999999
10001000      case 0x60:
10011001      case 0x68:
1002         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(m_maincpu), (offset - 0x60) / 8);
1002         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", m_maincpu->safe_pc(), (offset - 0x60) / 8);
10031003         which = (offset - 0x60) / 8;
10041004//          stream_update(dma_stream, 0);
10051005         return m_i186.dma[which].source;
10061006
10071007      case 0x61:
10081008      case 0x69:
1009         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(m_maincpu), (offset - 0x61) / 8);
1009         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", m_maincpu->safe_pc(), (offset - 0x61) / 8);
10101010         which = (offset - 0x61) / 8;
10111011//          stream_update(dma_stream, 0);
10121012         return m_i186.dma[which].source >> 16;
10131013
10141014      case 0x62:
10151015      case 0x6a:
1016         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(m_maincpu), (offset - 0x62) / 8);
1016         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", m_maincpu->safe_pc(), (offset - 0x62) / 8);
10171017         which = (offset - 0x62) / 8;
10181018//          stream_update(dma_stream, 0);
10191019         return m_i186.dma[which].dest;
10201020
10211021      case 0x63:
10221022      case 0x6b:
1023         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(m_maincpu), (offset - 0x63) / 8);
1023         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", m_maincpu->safe_pc(), (offset - 0x63) / 8);
10241024         which = (offset - 0x63) / 8;
10251025//          stream_update(dma_stream, 0);
10261026         return m_i186.dma[which].dest >> 16;
10271027
10281028      case 0x64:
10291029      case 0x6c:
1030         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(m_maincpu), (offset - 0x64) / 8);
1030         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", m_maincpu->safe_pc(), (offset - 0x64) / 8);
10311031         which = (offset - 0x64) / 8;
10321032//          stream_update(dma_stream, 0);
10331033         return m_i186.dma[which].count;
10341034
10351035      case 0x65:
10361036      case 0x6d:
1037         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(m_maincpu), (offset - 0x65) / 8);
1037         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", m_maincpu->safe_pc(), (offset - 0x65) / 8);
10381038         which = (offset - 0x65) / 8;
10391039//          stream_update(dma_stream, 0);
10401040         return m_i186.dma[which].control;
10411041
10421042      default:
1043         logerror("%05X:read 80186 port %02X\n", cpu_get_pc(m_maincpu), offset);
1043         logerror("%05X:read 80186 port %02X\n", m_maincpu->safe_pc(), offset);
10441044         break;
10451045   }
10461046   return 0x00;
r17788r17789
10611061   switch (offset)
10621062   {
10631063      case 0x11:
1064         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", cpu_get_pc(m_maincpu), data16);
1064         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", m_maincpu->safe_pc(), data16);
10651065         handle_eoi(0x8000);
10661066         update_interrupt_state(machine());
10671067         break;
10681068
10691069      case 0x12:
1070         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", cpu_get_pc(m_maincpu), data16);
1070         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", m_maincpu->safe_pc(), data16);
10711071         break;
10721072
10731073      case 0x13:
1074         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", cpu_get_pc(m_maincpu), data16);
1074         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", m_maincpu->safe_pc(), data16);
10751075         break;
10761076
10771077      case 0x14:
1078         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", cpu_get_pc(m_maincpu), data16);
1078         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", m_maincpu->safe_pc(), data16);
10791079         m_i186.intr.timer  = (m_i186.intr.timer  & ~0x08) | ((data16 << 3) & 0x08);
10801080         m_i186.intr.dma[0] = (m_i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08);
10811081         m_i186.intr.dma[1] = (m_i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08);
r17788r17789
10871087         break;
10881088
10891089      case 0x15:
1090         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", cpu_get_pc(m_maincpu), data16);
1090         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", m_maincpu->safe_pc(), data16);
10911091         m_i186.intr.priority_mask = data16 & 0x0007;
10921092         update_interrupt_state(machine());
10931093         break;
10941094
10951095      case 0x16:
1096         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", cpu_get_pc(m_maincpu), data16);
1096         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", m_maincpu->safe_pc(), data16);
10971097         m_i186.intr.in_service = data16 & 0x00ff;
10981098         update_interrupt_state(machine());
10991099         break;
11001100
11011101      case 0x17:
1102         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", cpu_get_pc(m_maincpu), data16);
1102         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", m_maincpu->safe_pc(), data16);
11031103         m_i186.intr.request = (m_i186.intr.request & ~0x00c0) | (data16 & 0x00c0);
11041104         update_interrupt_state(machine());
11051105         break;
11061106
11071107      case 0x18:
1108         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", cpu_get_pc(m_maincpu), data16);
1108         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", m_maincpu->safe_pc(), data16);
11091109         m_i186.intr.status = (m_i186.intr.status & ~0x8007) | (data16 & 0x8007);
11101110         update_interrupt_state(machine());
11111111         break;
11121112
11131113      case 0x19:
1114         if (LOG_PORTS) logerror("%05X:80186 timer interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16);
1114         if (LOG_PORTS) logerror("%05X:80186 timer interrupt control = %04X\n", m_maincpu->safe_pc(), data16);
11151115         m_i186.intr.timer = data16 & 0x000f;
11161116         break;
11171117
11181118      case 0x1a:
1119         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16);
1119         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", m_maincpu->safe_pc(), data16);
11201120         m_i186.intr.dma[0] = data16 & 0x000f;
11211121         break;
11221122
11231123      case 0x1b:
1124         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16);
1124         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", m_maincpu->safe_pc(), data16);
11251125         m_i186.intr.dma[1] = data16 & 0x000f;
11261126         break;
11271127
11281128      case 0x1c:
1129         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16);
1129         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", m_maincpu->safe_pc(), data16);
11301130         m_i186.intr.ext[0] = data16 & 0x007f;
11311131         break;
11321132
11331133      case 0x1d:
1134         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16);
1134         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", m_maincpu->safe_pc(), data16);
11351135         m_i186.intr.ext[1] = data16 & 0x007f;
11361136         break;
11371137
11381138      case 0x1e:
1139         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16);
1139         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", m_maincpu->safe_pc(), data16);
11401140         m_i186.intr.ext[2] = data16 & 0x001f;
11411141         break;
11421142
11431143      case 0x1f:
1144         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", cpu_get_pc(m_maincpu), data16);
1144         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", m_maincpu->safe_pc(), data16);
11451145         m_i186.intr.ext[3] = data16 & 0x001f;
11461146         break;
11471147
11481148      case 0x28:
11491149      case 0x2c:
11501150      case 0x30:
1151         if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x28) / 4, data16);
1151         if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", m_maincpu->safe_pc(), (offset - 0x28) / 4, data16);
11521152         which = (offset - 0x28) / 4;
11531153         internal_timer_update(which, data16, -1, -1, -1);
11541154         break;
r17788r17789
11561156      case 0x29:
11571157      case 0x2d:
11581158      case 0x31:
1159         if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x29) / 4, data16);
1159         if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", m_maincpu->safe_pc(), (offset - 0x29) / 4, data16);
11601160         which = (offset - 0x29) / 4;
11611161         internal_timer_update(which, -1, data16, -1, -1);
11621162         break;
11631163
11641164      case 0x2a:
11651165      case 0x2e:
1166         if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x2a) / 4, data16);
1166         if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", m_maincpu->safe_pc(), (offset - 0x2a) / 4, data16);
11671167         which = (offset - 0x2a) / 4;
11681168         internal_timer_update(which, -1, -1, data16, -1);
11691169         break;
r17788r17789
11711171      case 0x2b:
11721172      case 0x2f:
11731173      case 0x33:
1174         if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x2b) / 4, data16);
1174         if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", m_maincpu->safe_pc(), (offset - 0x2b) / 4, data16);
11751175         which = (offset - 0x2b) / 4;
11761176         internal_timer_update(which, -1, -1, -1, data16);
11771177         break;
11781178
11791179      case 0x50:
1180         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", cpu_get_pc(m_maincpu), data16);
1180         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", m_maincpu->safe_pc(), data16);
11811181         m_i186.mem.upper = data16 | 0xc038;
11821182         break;
11831183
11841184      case 0x51:
1185         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", cpu_get_pc(m_maincpu), data16);
1185         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", m_maincpu->safe_pc(), data16);
11861186         m_i186.mem.lower = (data16 & 0x3fff) | 0x0038; //printf("%X\n",m_i186.mem.lower);
11871187         break;
11881188
11891189      case 0x52:
1190         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", cpu_get_pc(m_maincpu), data16);
1190         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", m_maincpu->safe_pc(), data16);
11911191         m_i186.mem.peripheral = data16 | 0x0038;
11921192         break;
11931193
11941194      case 0x53:
1195         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", cpu_get_pc(m_maincpu), data16);
1195         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", m_maincpu->safe_pc(), data16);
11961196         m_i186.mem.middle = data16 | 0x01f8;
11971197         break;
11981198
11991199      case 0x54:
1200         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", cpu_get_pc(m_maincpu), data16);
1200         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", m_maincpu->safe_pc(), data16);
12011201         m_i186.mem.middle_size = data16 | 0x8038;
12021202
12031203         temp = (m_i186.mem.peripheral & 0xffc0) << 4;
r17788r17789
12211221
12221222      case 0x60:
12231223      case 0x68:
1224         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x60) / 8, data16);
1224         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", m_maincpu->safe_pc(), (offset - 0x60) / 8, data16);
12251225         which = (offset - 0x60) / 8;
12261226//          stream_update(dma_stream, 0);
12271227         m_i186.dma[which].source = (m_i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff);
r17788r17789
12291229
12301230      case 0x61:
12311231      case 0x69:
1232         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x61) / 8, data16);
1232         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", m_maincpu->safe_pc(), (offset - 0x61) / 8, data16);
12331233         which = (offset - 0x61) / 8;
12341234//          stream_update(dma_stream, 0);
12351235         m_i186.dma[which].source = (m_i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000);
r17788r17789
12371237
12381238      case 0x62:
12391239      case 0x6a:
1240         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x62) / 8, data16);
1240         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", m_maincpu->safe_pc(), (offset - 0x62) / 8, data16);
12411241         which = (offset - 0x62) / 8;
12421242//          stream_update(dma_stream, 0);
12431243         m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff);
r17788r17789
12451245
12461246      case 0x63:
12471247      case 0x6b:
1248         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x63) / 8, data16);
1248         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", m_maincpu->safe_pc(), (offset - 0x63) / 8, data16);
12491249         which = (offset - 0x63) / 8;
12501250//          stream_update(dma_stream, 0);
12511251         m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000);
r17788r17789
12531253
12541254      case 0x64:
12551255      case 0x6c:
1256         if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x64) / 8, data16);
1256         if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", m_maincpu->safe_pc(), (offset - 0x64) / 8, data16);
12571257         which = (offset - 0x64) / 8;
12581258//          stream_update(dma_stream, 0);
12591259         m_i186.dma[which].count = data16;
r17788r17789
12611261
12621262      case 0x65:
12631263      case 0x6d:
1264         if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(m_maincpu), (offset - 0x65) / 8, data16);
1264         if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", m_maincpu->safe_pc(), (offset - 0x65) / 8, data16);
12651265         which = (offset - 0x65) / 8;
12661266//          stream_update(dma_stream, 0);
12671267         update_dma_control(which, data16);
12681268         break;
12691269
12701270      case 0x7f:
1271         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", cpu_get_pc(m_maincpu), data16);
1271         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", m_maincpu->safe_pc(), data16);
12721272
12731273         /* we assume here there that this doesn't happen too often */
12741274         /* plus, we can't really remove the old memory range, so we also assume that it's */
r17788r17789
12891289         break;
12901290
12911291      default:
1292         logerror("%05X:80186 port %02X = %04X\n", cpu_get_pc(m_maincpu), offset, data16);
1292         logerror("%05X:80186 port %02X = %04X\n", m_maincpu->safe_pc(), offset, data16);
12931293         break;
12941294   }
12951295}
trunk/src/mess/machine/mac.c
r17788r17789
10491049{
10501050   int reg = (offset>>3) & 0xf;
10511051
1052//  logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space->device()));
1052//  logerror("macplus_scsi_w: data %x offset %x mask %x (PC=%x)\n", data, offset, mem_mask, space->device().safe_pc());
10531053
10541054   if ((reg == 0) && (offset == 0x100))
10551055   {
r17788r17789
11581158   result = applefdc_r(fdc, (offset >> 8));
11591159
11601160   if (LOG_MAC_IWM)
1161      printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, cpu_get_pc(m_maincpu));
1161      printf("mac_iwm_r: offset=0x%08x mem_mask %04x = %02x (PC %x)\n", offset, mem_mask, result, m_maincpu->safe_pc());
11621162
11631163   return (result << 8) | result;
11641164}
r17788r17789
11681168   device_t *fdc = space.machine().device("fdc");
11691169
11701170   if (LOG_MAC_IWM)
1171      printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, cpu_get_pc(m_maincpu));
1171      printf("mac_iwm_w: offset=0x%08x data=0x%04x mask %04x (PC=%x)\n", offset, data, mem_mask, m_maincpu->safe_pc());
11721172
11731173   if (ACCESSING_BITS_0_7)
11741174      applefdc_w(fdc, (offset >> 8), data & 0xff);
r17788r17789
12661266{
12671267   mac_state *mac = device->machine().driver_data<mac_state>();
12681268
1269//  printf("VIA1 IN_A (PC %x)\n", cpu_get_pc(device->machine().device("maincpu")));
1269//  printf("VIA1 IN_A (PC %x)\n", device->machine().device("maincpu")->safe_pc());
12701270
12711271   switch (mac->m_model)
12721272   {
r17788r17789
13761376         val |= 1;
13771377   }
13781378
1379//  printf("VIA1 IN_B = %02x (PC %x)\n", val, cpu_get_pc(device->machine().device("maincpu")));
1379//  printf("VIA1 IN_B = %02x (PC %x)\n", val, device->machine().device("maincpu")->safe_pc());
13801380
13811381   return val;
13821382}
r17788r17789
13871387   device_t *fdc = device->machine().device("fdc");
13881388   mac_state *mac = device->machine().driver_data<mac_state>();
13891389
1390//  printf("VIA1 OUT A: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu")));
1390//  printf("VIA1 OUT A: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc());
13911391
13921392   if (ADB_IS_PM_VIA1)
13931393   {
r17788r17789
14311431   int new_rtc_rTCClk;
14321432   mac_state *mac = device->machine().driver_data<mac_state>();
14331433
1434//  printf("VIA1 OUT B: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu")));
1434//  printf("VIA1 OUT B: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc());
14351435
14361436   if (ADB_IS_PM_VIA1)
14371437   {
r17788r17789
15341534   else if (ADB_IS_EGRET)
15351535   {
15361536      #if LOG_ADB
1537      printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, cpu_get_pc(mac->m_maincpu));
1537      printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->safe_pc());
15381538      #endif
15391539        mac->m_egret->set_via_full((data&0x10) ? 1 : 0);
15401540        mac->m_egret->set_sys_session((data&0x20) ? 1 : 0);
r17788r17789
15421542   else if (ADB_IS_CUDA)
15431543   {
15441544      #if LOG_ADB
1545      printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, cpu_get_pc(mac->m_maincpu));
1545      printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->safe_pc());
15461546      #endif
15471547        mac->m_cuda->set_byteack((data&0x10) ? 1 : 0);
15481548        mac->m_cuda->set_tip((data&0x20) ? 1 : 0);
r17788r17789
16091609   data = m_via2->read(space, offset);
16101610
16111611   if (LOG_VIA)
1612      logerror("mac_via2_r: offset=0x%02x = %02x (PC=%x)\n", offset*2, data, cpu_get_pc(space.machine().device("maincpu")));
1612      logerror("mac_via2_r: offset=0x%02x = %02x (PC=%x)\n", offset*2, data, space.machine().device("maincpu")->safe_pc());
16131613
16141614   return (data & 0xff) | (data << 8);
16151615}
r17788r17789
16201620   offset &= 0x0f;
16211621
16221622   if (LOG_VIA)
1623      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")));
1623      logerror("mac_via2_w: offset=%x data=0x%08x mask=%x (PC=%x)\n", offset, data, mem_mask, space.machine().device("maincpu")->safe_pc());
16241624
16251625   if (ACCESSING_BITS_0_7)
16261626      m_via2->write(space, offset, data & 0xff);
r17788r17789
16541654{
16551655   mac_state *mac =device->machine().driver_data<mac_state>();
16561656
1657//  logerror("VIA2 IN B (PC %x)\n", cpu_get_pc(device->machine().device("maincpu")));
1657//  logerror("VIA2 IN B (PC %x)\n", device->machine().device("maincpu")->safe_pc());
16581658
16591659   if (ADB_IS_PM_VIA2)
16601660   {
r17788r17789
16851685{
16861686   mac_state *mac = device->machine().driver_data<mac_state>();
16871687
1688//  logerror("VIA2 OUT A: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu")));
1688//  logerror("VIA2 OUT A: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc());
16891689   if (ADB_IS_PM_VIA2)
16901690   {
16911691      mac->m_pm_data_send = data;
r17788r17789
16971697{
16981698   mac_state *mac = device->machine().driver_data<mac_state>();
16991699
1700//  logerror("VIA2 OUT B: %02x (PC %x)\n", data, cpu_get_pc(device->machine().device("maincpu")));
1700//  logerror("VIA2 OUT B: %02x (PC %x)\n", data, device->machine().device("maincpu")->safe_pc());
17011701
17021702   if (ADB_IS_PM_VIA2)
17031703   {
r17788r17789
20122012
20132013READ32_MEMBER(mac_state::mac_read_id)
20142014{
2015//    printf("Mac read ID reg @ PC=%x\n", cpu_get_pc(m_maincpu));
2015//    printf("Mac read ID reg @ PC=%x\n", m_maincpu->safe_pc());
20162016
20172017   switch (m_model)
20182018   {
trunk/src/mess/machine/a2videoterm.c
r17788r17789
240240
241241UINT8 a2bus_videx80_device::read_c0nx(address_space &space, UINT8 offset)
242242{
243//    printf("Read c0n%x (PC=%x)\n", offset, cpu_get_pc(&space.device()));
243//    printf("Read c0n%x (PC=%x)\n", offset, space.device().safe_pc());
244244
245245    m_rambank = ((offset>>2) & 3) * 512;
246246
r17788r17789
259259
260260void a2bus_videx80_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
261261{
262//    printf("Write %02x to c0n%x (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
262//    printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc());
263263
264264    if (offset == 0)
265265    {
trunk/src/mess/machine/amigacd.c
r17788r17789
131131      case 0x20:
132132      {
133133         UINT8   v = dmac_data.istr;
134         LOG(( "DMAC: PC=%08x - ISTR Read(%04x)\n", cpu_get_pc(&space->device()), dmac_data.istr ));
134         LOG(( "DMAC: PC=%08x - ISTR Read(%04x)\n", space->device().safe_pc(), dmac_data.istr ));
135135
136136         dmac_data.istr &= ~0x0f;
137137         return v;
r17788r17789
140140
141141      case 0x21:
142142      {
143         LOG(( "DMAC: PC=%08x - CNTR Read(%04x)\n", cpu_get_pc(&space->device()), dmac_data.cntr ));
143         LOG(( "DMAC: PC=%08x - CNTR Read(%04x)\n", space->device().safe_pc(), dmac_data.cntr ));
144144         return dmac_data.cntr;
145145      }
146146      break;
147147
148148      case 0x40:   /* wtc hi */
149149      {
150         LOG(( "DMAC: PC=%08x - WTC HI Read\n", cpu_get_pc(&space->device()) ));
150         LOG(( "DMAC: PC=%08x - WTC HI Read\n", space->device().safe_pc() ));
151151         return (dmac_data.wtc >> 16);
152152      }
153153      break;
154154
155155      case 0x41:   /* wtc lo */
156156      {
157         LOG(( "DMAC: PC=%08x - WTC LO Read\n", cpu_get_pc(&space->device()) ));
157         LOG(( "DMAC: PC=%08x - WTC LO Read\n", space->device().safe_pc() ));
158158         return dmac_data.wtc;
159159      }
160160      break;
161161
162162      case 0x42:   /* acr hi */
163163      {
164         LOG(( "DMAC: PC=%08x - ACR HI Read\n", cpu_get_pc(&space->device()) ));
164         LOG(( "DMAC: PC=%08x - ACR HI Read\n", space->device().safe_pc() ));
165165         return (dmac_data.acr >> 16);
166166      }
167167      break;
168168
169169      case 0x43:   /* acr lo */
170170      {
171         LOG(( "DMAC: PC=%08x - ACR LO Read\n", cpu_get_pc(&space->device()) ));
171         LOG(( "DMAC: PC=%08x - ACR LO Read\n", space->device().safe_pc() ));
172172         return dmac_data.acr;
173173      }
174174      break;
r17788r17789
176176      case 0x48:   /* wd33c93 SCSI expansion */
177177      case 0x49:
178178      {
179         LOG(( "DMAC: PC=%08x - WD33C93 Read(%d)\n", cpu_get_pc(&space->device()), offset & 1 ));
179         LOG(( "DMAC: PC=%08x - WD33C93 Read(%d)\n", space->device().safe_pc(), offset & 1 ));
180180         return 0x00;   /* Not available without SCSI expansion */
181181      }
182182      break;
183183
184184      case 0x50:
185185      {
186         LOG(( "DMAC: PC=%08x - CDROM RESP Read\n", cpu_get_pc(&space->device()) ));
186         LOG(( "DMAC: PC=%08x - CDROM RESP Read\n", space->device().safe_pc() ));
187187         return matsucd_response_r(space->machine());
188188      }
189189      break;
r17788r17789
192192      case 0x52:
193193      case 0x53:
194194      {
195         LOG(( "DMAC: PC=%08x - XT IO Read(%d)\n", cpu_get_pc(&space->device()), (offset & 3)-1 ));
195         LOG(( "DMAC: PC=%08x - XT IO Read(%d)\n", space->device().safe_pc(), (offset & 3)-1 ));
196196         return 0xff;
197197      }
198198      break;
r17788r17789
215215      case 0x67:
216216      {
217217         device_t *tpi = space->machine().device("tpi6525");
218         LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", cpu_get_pc(&space->device()), (offset - 0x58) ));
218         LOG(( "DMAC: PC=%08x - TPI6525 Read(%d)\n", space->device().safe_pc(), (offset - 0x58) ));
219219         return tpi6525_r(tpi, offset - 0x58);
220220      }
221221      break;
222222
223223      case 0x70:   /* DMA start strobe */
224224      {
225         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", cpu_get_pc(&space->device()) ));
225         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", space->device().safe_pc() ));
226226         dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME ));
227227      }
228228      break;
229229
230230      case 0x71:   /* DMA stop strobe */
231231      {
232         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", cpu_get_pc(&space->device()) ));
232         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", space->device().safe_pc() ));
233233         dmac_data.dma_timer->reset(  );
234234      }
235235      break;
236236
237237      case 0x72:   /* Clear IRQ strobe */
238238      {
239         LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", cpu_get_pc(&space->device()) ));
239         LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", space->device().safe_pc() ));
240240         dmac_data.istr &= ~ISTR_INT_P;
241241      }
242242      break;
243243
244244      case 0x74:   /* Flush strobe */
245245      {
246         LOG(( "DMAC: PC=%08x - Flush Strobe\n", cpu_get_pc(&space->device()) ));
246         LOG(( "DMAC: PC=%08x - Flush Strobe\n", space->device().safe_pc() ));
247247         dmac_data.istr |= ISTR_FE_FLG;
248248      }
249249      break;
250250
251251      default:
252         logerror( "DMAC-READ: PC=%08x, offset = %02x\n", cpu_get_pc(&space->device()), offset );
252         logerror( "DMAC-READ: PC=%08x, offset = %02x\n", space->device().safe_pc(), offset );
253253      break;
254254   }
255255
r17788r17789
264264   {
265265      case 0x21:   /* control write */
266266      {
267         LOG(( "DMAC: PC=%08x - CNTR Write(%04x)\n", cpu_get_pc(&space->device()), data ));
267         LOG(( "DMAC: PC=%08x - CNTR Write(%04x)\n", space->device().safe_pc(), data ));
268268         dmac_data.cntr = data;
269269         check_interrupts(space->machine());
270270      }
r17788r17789
272272
273273      case 0x40:   /* wtc hi */
274274      {
275         LOG(( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", cpu_get_pc(&space->device()), data ));
275         LOG(( "DMAC: PC=%08x - WTC HI Write - data = %04x\n", space->device().safe_pc(), data ));
276276         dmac_data.wtc &= 0x0000ffff;
277277         dmac_data.wtc |= ((UINT32)data) << 16;
278278      }
r17788r17789
280280
281281      case 0x41:   /* wtc lo */
282282      {
283         LOG(( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", cpu_get_pc(&space->device()), data ));
283         LOG(( "DMAC: PC=%08x - WTC LO Write - data = %04x\n", space->device().safe_pc(), data ));
284284         dmac_data.wtc &= 0xffff0000;
285285         dmac_data.wtc |= data;
286286      }
r17788r17789
288288
289289      case 0x42:   /* acr hi */
290290      {
291         LOG(( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", cpu_get_pc(&space->device()), data ));
291         LOG(( "DMAC: PC=%08x - ACR HI Write - data = %04x\n", space->device().safe_pc(), data ));
292292         dmac_data.acr &= 0x0000ffff;
293293         dmac_data.acr |= ((UINT32)data) << 16;
294294      }
r17788r17789
296296
297297      case 0x43:   /* acr lo */
298298      {
299         LOG(( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", cpu_get_pc(&space->device()), data ));
299         LOG(( "DMAC: PC=%08x - ACR LO Write - data = %04x\n", space->device().safe_pc(), data ));
300300         dmac_data.acr &= 0xffff0000;
301301         dmac_data.acr |= data;
302302      }
r17788r17789
304304
305305      case 0x47:   /* dawr */
306306      {
307         LOG(( "DMAC: PC=%08x - DAWR Write - data = %04x\n", cpu_get_pc(&space->device()), data ));
307         LOG(( "DMAC: PC=%08x - DAWR Write - data = %04x\n", space->device().safe_pc(), data ));
308308         dmac_data.dawr = data;
309309      }
310310      break;
r17788r17789
312312      case 0x48:   /* wd33c93 SCSI expansion */
313313      case 0x49:
314314      {
315         LOG(( "DMAC: PC=%08x - WD33C93 Write(%d) - data = %04x\n", cpu_get_pc(&space->device()), offset & 1, data ));
315         LOG(( "DMAC: PC=%08x - WD33C93 Write(%d) - data = %04x\n", space->device().safe_pc(), offset & 1, data ));
316316         /* Not available without SCSI expansion */
317317      }
318318      break;
319319
320320      case 0x50:
321321      {
322         LOG(( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", cpu_get_pc(&space->device()), data ));
322         LOG(( "DMAC: PC=%08x - CDROM CMD Write - data = %04x\n", space->device().safe_pc(), data ));
323323         matsucd_command_w(space->machine(), data );
324324      }
325325      break;
r17788r17789
342342      case 0x67:
343343      {
344344         device_t *tpi = space->machine().device("tpi6525");
345         LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", cpu_get_pc(&space->device()), (offset - 0x58), data ));
345         LOG(( "DMAC: PC=%08x - TPI6525 Write(%d) - data = %04x\n", space->device().safe_pc(), (offset - 0x58), data ));
346346         tpi6525_w(tpi, offset - 0x58, data);
347347      }
348348      break;
349349
350350      case 0x70:   /* DMA start strobe */
351351      {
352         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", cpu_get_pc(&space->device()) ));
352         LOG(( "DMAC: PC=%08x - DMA Start Strobe\n", space->device().safe_pc() ));
353353         dmac_data.dma_timer->adjust(attotime::from_msec( CD_SECTOR_TIME ));
354354      }
355355      break;
356356
357357      case 0x71:   /* DMA stop strobe */
358358      {
359         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", cpu_get_pc(&space->device()) ));
359         LOG(( "DMAC: PC=%08x - DMA Stop Strobe\n", space->device().safe_pc() ));
360360         dmac_data.dma_timer->reset(  );
361361      }
362362      break;
363363
364364      case 0x72:   /* Clear IRQ strobe */
365365      {
366         LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", cpu_get_pc(&space->device()) ));
366         LOG(( "DMAC: PC=%08x - IRQ Clear Strobe\n", space->device().safe_pc() ));
367367         dmac_data.istr &= ~ISTR_INT_P;
368368      }
369369      break;
370370
371371      case 0x74:   /* Flush Strobe */
372372      {
373         LOG(( "DMAC: PC=%08x - Flush Strobe\n", cpu_get_pc(&space->device()) ));
373         LOG(( "DMAC: PC=%08x - Flush Strobe\n", space->device().safe_pc() ));
374374         dmac_data.istr |= ISTR_FE_FLG;
375375      }
376376      break;
377377
378378      default:
379         logerror( "DMAC-WRITE: PC=%08x, offset = %02x, data = %04x\n", cpu_get_pc(&space->device()), offset, data );
379         logerror( "DMAC-WRITE: PC=%08x, offset = %02x, data = %04x\n", space->device().safe_pc(), offset, data );
380380      break;
381381   }
382382}
trunk/src/mess/machine/nubus_asntmc3b.c
r17788r17789
165165    }
166166    else
167167    {
168        fatalerror("asntmc3nb: write %08x to DP83902 @ %x with unhandled mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
168        fatalerror("asntmc3nb: write %08x to DP83902 @ %x with unhandled mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
169169    }
170170}
171171
r17788r17789
183183    }
184184    else
185185    {
186        fatalerror("asntmc3nb: read DP83902 @ %x with unhandled mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device()));
186        fatalerror("asntmc3nb: read DP83902 @ %x with unhandled mask %08x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
187187    }
188188
189189    return 0;
trunk/src/mess/machine/a2memexp.c
r17788r17789
140140        m_regs[2] = ((m_liveptr>>16) & 0xff) | m_bankhior;
141141    }
142142
143//    printf("Read c0n%x (PC=%x) = %02x\n", offset, cpu_get_pc(&space.device()), retval);
143//    printf("Read c0n%x (PC=%x) = %02x\n", offset, space.device().safe_pc(), retval);
144144
145145   return retval;
146146}
r17788r17789
152152
153153void a2bus_memexp_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
154154{
155//    printf("Write %02x to c0n%x (PC=%x)\n", data, offset, cpu_get_pc(&space.device()));
155//    printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc());
156156
157157    switch (offset)
158158    {
trunk/src/mess/machine/lisa.c
r17788r17789
15151515               if ((time_in_frame >= 364) && (time_in_frame <= 375))
15161516               {
15171517                  answer = m_videoROM_ptr[m_videoROM_address|0x80] << 8;
1518            logerror("reading1 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc(machine().device("maincpu")), time_in_frame);
1518            logerror("reading1 %06X=%04x PC=%06x time=%d\n", address, answer, machine().device("maincpu")->safe_pc(), time_in_frame);
15191519               }
15201520               else
15211521               {
15221522                  answer = m_videoROM_ptr[m_videoROM_address] << 8;
1523            logerror("reading2 %06X=%04x PC=%06x time=%d\n", address, answer, cpu_get_pc(machine().device("maincpu")), time_in_frame);
1523            logerror("reading2 %06X=%04x PC=%06x time=%d\n", address, answer, machine().device("maincpu")->safe_pc(), time_in_frame);
15241524               }
15251525            }
15261526
r17788r17789
17821782      state->m_seg &= ~2;
17831783      break;
17841784   case 0x0010:   /* SETUP register SET */
1785      logerror("setup SET PC=%x\n", cpu_get_pc(machine.device("maincpu")));
1785      logerror("setup SET PC=%x\n", machine.device("maincpu")->safe_pc());
17861786      state->m_setup = 1;
17871787      break;
17881788   case 0x0012:   /* SETUP register RESET */
1789      logerror("setup UNSET PC=%x\n", cpu_get_pc(machine.device("maincpu")));
1789      logerror("setup UNSET PC=%x\n", machine.device("maincpu")->safe_pc());
17901790      state->m_setup = 0;
17911791      break;
17921792   case 0x001A:   /* Enable Vertical Retrace Interrupt */
1793      logerror("enable retrace PC=%x\n", cpu_get_pc(machine.device("maincpu")));
1793      logerror("enable retrace PC=%x\n", machine.device("maincpu")->safe_pc());
17941794      state->m_VTMSK = 1;
17951795      break;
17961796   case 0x0018:   /* Disable Vertical Retrace Interrupt */
1797      logerror("disable retrace PC=%x\n", cpu_get_pc(machine.device("maincpu")));
1797      logerror("disable retrace PC=%x\n", machine.device("maincpu")->safe_pc());
17981798      state->m_VTMSK = 0;
17991799      set_VTIR(machine, 2);
18001800      break;
r17788r17789
19281928         else
19291929                  answer |= 0x04;
19301930         /* huh... we need to emulate some other bits */
1931         logerror("read status PC=%x val=%x\n", cpu_get_pc(machine().device("maincpu")), answer);
1931         logerror("read status PC=%x val=%x\n", machine().device("maincpu")->safe_pc(), answer);
19321932
19331933         break;
19341934      }
trunk/src/mess/machine/pc1403.c
r17788r17789
128128{
129129   pc1403_state *state = device->machine().driver_data<pc1403_state>();
130130    state->m_portc = data;
131//    logerror("%g pc %.4x outc %.2x\n", device->machine().time().as_double(), cpu_get_pc(device->machine().device("maincpu")), data);
131//    logerror("%g pc %.4x outc %.2x\n", device->machine().time().as_double(), device->machine().device("maincpu")->safe_pc(), data);
132132}
133133
134134
trunk/src/mess/machine/mc6843.c
r17788r17789
427427      int cmd = mc6843->CMR & 0x0f;
428428
429429      LOG(( "%f $%04x mc6843_r: data input cmd=%s(%i), pos=%i/%i, GCR=%i, ",
430            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ),
430            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ),
431431            mc6843_cmd[cmd], cmd, mc6843->data_idx,
432432            mc6843->data_size, mc6843->GCR ));
433433
r17788r17789
480480      {
481481         /* XXX TODO: other read modes */
482482         data = mc6843->data[0];
483         logerror( "$%04x mc6843 read in unsupported command mode %i\n", cpu_get_previouspc( device->machine().firstcpu ), cmd );
483         logerror( "$%04x mc6843 read in unsupported command mode %i\n", device->machine().firstcpu ->safe_pcbase( ), cmd );
484484      }
485485
486486      LOG(( "data=%02X\n", data ));
r17788r17789
491491   case 1: /* Current-Track Address Register (CTAR) */
492492      data = mc6843->CTAR;
493493      LOG(( "%f $%04x mc6843_r: read CTAR %i (actual=%i)\n",
494            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data,
494            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data,
495495            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
496496      break;
497497
498498   case 2: /* Interrupt Status Register (ISR) */
499499      data = mc6843->ISR;
500500      LOG(( "%f $%04x mc6843_r: read ISR %02X: cmd=%scomplete settle=%scomplete sense-rq=%i STRB=%i\n",
501            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data,
501            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data,
502502            (data & 1) ? "" : "not-" , (data & 2) ? "" : "not-",
503503            (data >> 2) & 1, (data >> 3) & 1 ));
504504
r17788r17789
524524
525525      data = mc6843->STRA;
526526      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",
527            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data,
527            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data,
528528            data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1,
529529            (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 ));
530530      break;
r17788r17789
533533   case 4: /* Status Register B (STRB) */
534534      data = mc6843->STRB;
535535      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",
536            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data,
536            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data,
537537            data & 1, (data >> 1) & 1, (data >> 2) & 1, (data >> 3) & 1,
538538            (data >> 4) & 1, (data >> 5) & 1, (data >> 6) & 1, (data >> 7) & 1 ));
539539
r17788r17789
545545   case 7: /* Logical-Track Address Register (LTAR) */
546546      data = mc6843->LTAR;
547547      LOG(( "%f $%04x mc6843_r: read LTAR %i (actual=%i)\n",
548            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data,
548            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data,
549549            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
550550      break;
551551
552552   default:
553      logerror( "$%04x mc6843 invalid read offset %i\n", cpu_get_previouspc( device->machine().firstcpu ), offset );
553      logerror( "$%04x mc6843 invalid read offset %i\n", device->machine().firstcpu ->safe_pcbase( ), offset );
554554   }
555555
556556   return data;
r17788r17789
567567      int FWF = (mc6843->CMR >> 4) & 1;
568568
569569      LOG(( "%f $%04x mc6843_w: data output cmd=%s(%i), pos=%i/%i, GCR=%i, data=%02X\n",
570            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ),
570            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ),
571571            mc6843_cmd[cmd], cmd, mc6843->data_idx,
572572            mc6843->data_size, mc6843->GCR, data ));
573573
r17788r17789
584584            /* end of sector write */
585585            device_t* img = mc6843_floppy_image( device );
586586
587            LOG(( "%f $%04x mc6843_w: write sector %i\n", device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->data_id ));
587            LOG(( "%f $%04x mc6843_w: write sector %i\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->data_id ));
588588
589589            floppy_drive_write_sector_data(
590590               img, mc6843->side, mc6843->data_id,
r17788r17789
648648               UINT8 track  = mc6843->data[1];
649649               UINT8 sector = mc6843->data[3];
650650               UINT8 filler = 0xe5; /* standard Thomson filler */
651               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));
651               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));
652652               floppy_drive_format_sector( img, mc6843->side, sector, track, 0, sector, 0, filler );
653653            }
654654            else
r17788r17789
670670      else
671671      {
672672         /* XXX TODO: other write modes */
673         logerror( "$%04x mc6843 write %02X in unsupported command mode %i (FWF=%i)\n", cpu_get_previouspc( device->machine().firstcpu ), data, cmd, FWF );
673         logerror( "$%04x mc6843 write %02X in unsupported command mode %i (FWF=%i)\n", device->machine().firstcpu ->safe_pcbase( ), data, cmd, FWF );
674674      }
675675      break;
676676   }
r17788r17789
678678   case 1: /* Current-Track Address Register (CTAR) */
679679      mc6843->CTAR = data & 0x7f;
680680      LOG(( "%f $%04x mc6843_w: set CTAR to %i %02X (actual=%i) \n",
681            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->CTAR, data,
681            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->CTAR, data,
682682            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
683683      break;
684684
r17788r17789
687687      int cmd = data & 15;
688688
689689      LOG(( "%f $%04x mc6843_w: set CMR to $%02X: cmd=%s(%i) FWF=%i DMA=%i ISR3-intr=%i fun-intr=%i\n",
690            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ),
690            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ),
691691            data, mc6843_cmd[cmd], cmd, (data >> 4) & 1, (data >> 5) & 1,
692692            (data >> 6) & 1, (data >> 7) & 1 ));
693693
r17788r17789
734734
735735      /* assume CLK freq = 1MHz (IBM 3740 compatibility) */
736736      LOG(( "%f $%04x mc6843_w: set SUR to $%02X: head settling time=%fms, track-to-track seek time=%f\n",
737            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ),
737            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ),
738738            data, 4.096 * (data & 15), 1.024 * ((data >> 4) & 15) ));
739739      break;
740740
741741   case 4: /* Sector Address Register (SAR) */
742742      mc6843->SAR = data & 0x1f;
743      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 ));
743      LOG(( "%f $%04x mc6843_w: set SAR to %i (%02X)\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->SAR, data ));
744744      break;
745745
746746   case 5: /* General Count Register (GCR) */
747747      mc6843->GCR = data & 0x7f;
748      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 ));
748      LOG(( "%f $%04x mc6843_w: set GCR to %i (%02X)\n", device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->GCR, data ));
749749      break;
750750
751751   case 6: /* CRC Control Register (CCR) */
752752      mc6843->CCR = data & 3;
753753      LOG(( "%f $%04x mc6843_w: set CCR to %02X: CRC=%s shift=%i\n",
754            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), data,
754            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), data,
755755            (data & 1) ? "enabled" : "disabled", (data >> 1) & 1 ));
756756      break;
757757
758758   case 7: /* Logical-Track Address Register (LTAR) */
759759      mc6843->LTAR = data & 0x7f;
760760      LOG(( "%f $%04x mc6843_w: set LTAR to %i %02X (actual=%i)\n",
761            device->machine().time().as_double(), cpu_get_previouspc( device->machine().firstcpu ), mc6843->LTAR, data,
761            device->machine().time().as_double(), device->machine().firstcpu ->safe_pcbase( ), mc6843->LTAR, data,
762762            floppy_drive_get_current_track( mc6843_floppy_image( device ) ) ));
763763      break;
764764
765765   default:
766      logerror( "$%04x mc6843 invalid write offset %i (data=$%02X)\n", cpu_get_previouspc( device->machine().firstcpu ), offset, data );
766      logerror( "$%04x mc6843 invalid write offset %i (data=$%02X)\n", device->machine().firstcpu ->safe_pcbase( ), offset, data );
767767   }
768768}
769769
trunk/src/mess/machine/rmnimbus.c
r17788r17789
375375         case 0x0d:   state->m_i186.intr.in_service &= ~0x20;   break;
376376         case 0x0e:   state->m_i186.intr.in_service &= ~0x40;   break;
377377         case 0x0f:   state->m_i186.intr.in_service &= ~0x80;   break;
378         default:   logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(machine.device(MAINCPU_TAG)), data & 0x1f);
378         default:   logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", machine.device(MAINCPU_TAG)->safe_pc(), data & 0x1f);
379379      }
380380      if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", machine.time().as_double(), data & 0x1f);
381381   }
r17788r17789
589589      diff = new_control ^ t->control;
590590      if (diff & 0x001c)
591591         logerror("%05X:ERROR! -unsupported timer mode %04X\n",
592            cpu_get_pc(machine.device(MAINCPU_TAG)), new_control);
592            machine.device(MAINCPU_TAG)->safe_pc(), new_control);
593593
594594      /* if we have real changes, update things */
595595      if (diff != 0)
r17788r17789
690690   diff = new_control ^ d->control;
691691   if ((LOG_DMA) && (diff & 0x6811))
692692      logerror("%05X:ERROR! - unsupported DMA mode %04X\n",
693         cpu_get_pc(machine.device(MAINCPU_TAG)), new_control);
693         machine.device(MAINCPU_TAG)->safe_pc(), new_control);
694694#if 0
695695   /* if we're going live, set a timer */
696696   if ((diff & 0x0002) && (new_control & 0x0002))
r17788r17789
745745    if(!(dma->control & ST_STOP))
746746    {
747747        logerror("%05X:ERROR! - drq%d with dma channel stopped\n",
748      cpu_get_pc(machine.device(MAINCPU_TAG)), which);
748      machine.device(MAINCPU_TAG)->safe_pc(), which);
749749
750750        return;
751751    }
r17788r17789
860860   switch (offset)
861861   {
862862      case 0x11:
863         logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(&space.device()));
863         logerror("%05X:ERROR - read from 80186 EOI\n", space.device().safe_pc());
864864         break;
865865
866866      case 0x12:
867         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(&space.device()));
867         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", space.device().safe_pc());
868868         if (m_i186.intr.poll_status & 0x8000)
869869            int_callback(machine().device(MAINCPU_TAG), 0);
870870         return m_i186.intr.poll_status;
871871
872872      case 0x13:
873         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(&space.device()));
873         if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", space.device().safe_pc());
874874         return m_i186.intr.poll_status;
875875
876876      case 0x14:
877         if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(&space.device()));
877         if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", space.device().safe_pc());
878878         temp  = (m_i186.intr.timer  >> 3) & 0x01;
879879         temp |= (m_i186.intr.dma[0] >> 1) & 0x04;
880880         temp |= (m_i186.intr.dma[1] >> 0) & 0x08;
r17788r17789
885885         return temp;
886886
887887      case 0x15:
888         if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(&space.device()));
888         if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", space.device().safe_pc());
889889         return m_i186.intr.priority_mask;
890890
891891      case 0x16:
892         if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(&space.device()));
892         if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", space.device().safe_pc());
893893         return m_i186.intr.in_service;
894894
895895      case 0x17:
896         if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(&space.device()));
896         if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", space.device().safe_pc());
897897         temp = m_i186.intr.request & ~0x0001;
898898         if (m_i186.intr.status & 0x0007)
899899            temp |= 1;
900900         return temp;
901901
902902      case 0x18:
903         if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(&space.device()));
903         if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", space.device().safe_pc());
904904         return m_i186.intr.status;
905905
906906      case 0x19:
907         if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(&space.device()));
907         if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", space.device().safe_pc());
908908         return m_i186.intr.timer;
909909
910910      case 0x1a:
911         if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(&space.device()));
911         if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", space.device().safe_pc());
912912         return m_i186.intr.dma[0];
913913
914914      case 0x1b:
915         if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(&space.device()));
915         if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", space.device().safe_pc());
916916         return m_i186.intr.dma[1];
917917
918918      case 0x1c:
919         if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(&space.device()));
919         if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", space.device().safe_pc());
920920         return m_i186.intr.ext[0];
921921
922922      case 0x1d:
923         if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(&space.device()));
923         if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", space.device().safe_pc());
924924         return m_i186.intr.ext[1];
925925
926926      case 0x1e:
927         if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(&space.device()));
927         if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", space.device().safe_pc());
928928         return m_i186.intr.ext[2];
929929
930930      case 0x1f:
931         if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(&space.device()));
931         if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", space.device().safe_pc());
932932         return m_i186.intr.ext[3];
933933
934934      case 0x28:
935935      case 0x2c:
936936      case 0x30:
937         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(&space.device()), (offset - 0x28) / 4);
937         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", space.device().safe_pc(), (offset - 0x28) / 4);
938938         which = (offset - 0x28) / 4;
939939         if (!(offset & 1))
940940            internal_timer_sync(machine(), which);
r17788r17789
943943      case 0x29:
944944      case 0x2d:
945945      case 0x31:
946         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(&space.device()), (offset - 0x29) / 4);
946         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", space.device().safe_pc(), (offset - 0x29) / 4);
947947         which = (offset - 0x29) / 4;
948948         return m_i186.timer[which].maxA;
949949
950950      case 0x2a:
951951      case 0x2e:
952         logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(&space.device()), (offset - 0x2a) / 4);
952         logerror("%05X:read 80186 Timer %d max B\n", space.device().safe_pc(), (offset - 0x2a) / 4);
953953         which = (offset - 0x2a) / 4;
954954         return m_i186.timer[which].maxB;
955955
956956      case 0x2b:
957957      case 0x2f:
958958      case 0x33:
959         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(&space.device()), (offset - 0x2b) / 4);
959         if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", space.device().safe_pc(), (offset - 0x2b) / 4);
960960         which = (offset - 0x2b) / 4;
961961         return m_i186.timer[which].control;
962962
963963      case 0x50:
964         if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(&space.device()));
964         if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", space.device().safe_pc());
965965         return m_i186.mem.upper;
966966
967967      case 0x51:
968         if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(&space.device()));
968         if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", space.device().safe_pc());
969969         return m_i186.mem.lower;
970970
971971      case 0x52:
972         if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(&space.device()));
972         if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", space.device().safe_pc());
973973         return m_i186.mem.peripheral;
974974
975975      case 0x53:
976         if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(&space.device()));
976         if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", space.device().safe_pc());
977977         return m_i186.mem.middle;
978978
979979      case 0x54:
980         if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(&space.device()));
980         if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", space.device().safe_pc());
981981         return m_i186.mem.middle_size;
982982
983983      case 0x60:
984984      case 0x68:
985         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(&space.device()), (offset - 0x60) / 8);
985         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", space.device().safe_pc(), (offset - 0x60) / 8);
986986         which = (offset - 0x60) / 8;
987987         return m_i186.dma[which].source;
988988
989989      case 0x61:
990990      case 0x69:
991         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(&space.device()), (offset - 0x61) / 8);
991         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", space.device().safe_pc(), (offset - 0x61) / 8);
992992         which = (offset - 0x61) / 8;
993993         return m_i186.dma[which].source >> 16;
994994
995995      case 0x62:
996996      case 0x6a:
997         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(&space.device()), (offset - 0x62) / 8);
997         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", space.device().safe_pc(), (offset - 0x62) / 8);
998998         which = (offset - 0x62) / 8;
999999         return m_i186.dma[which].dest;
10001000
10011001      case 0x63:
10021002      case 0x6b:
1003         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(&space.device()), (offset - 0x63) / 8);
1003         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", space.device().safe_pc(), (offset - 0x63) / 8);
10041004         which = (offset - 0x63) / 8;
10051005         return m_i186.dma[which].dest >> 16;
10061006
10071007      case 0x64:
10081008      case 0x6c:
1009         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(&space.device()), (offset - 0x64) / 8);
1009         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", space.device().safe_pc(), (offset - 0x64) / 8);
10101010         which = (offset - 0x64) / 8;
10111011         return m_i186.dma[which].count;
10121012
10131013      case 0x65:
10141014      case 0x6d:
1015         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(&space.device()), (offset - 0x65) / 8);
1015         if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", space.device().safe_pc(), (offset - 0x65) / 8);
10161016         which = (offset - 0x65) / 8;
10171017         return m_i186.dma[which].control;
10181018
10191019      default:
1020         logerror("%05X:read 80186 port %02X\n", cpu_get_pc(&space.device()), offset);
1020         logerror("%05X:read 80186 port %02X\n", space.device().safe_pc(), offset);
10211021         break;
10221022   }
10231023   return 0x00;
r17788r17789
10361036   switch (offset)
10371037   {
10381038      case 0x11:
1039         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", cpu_get_pc(&space.device()), data16);
1039         if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", space.device().safe_pc(), data16);
10401040         handle_eoi(machine(),0x8000);
10411041         update_interrupt_state(machine());
10421042         break;
10431043
10441044      case 0x12:
1045         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", cpu_get_pc(&space.device()), data16);
1045         logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", space.device().safe_pc(), data16);
10461046         break;
10471047
10481048      case 0x13:
1049         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", cpu_get_pc(&space.device()), data16);
1049         logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", space.device().safe_pc(), data16);
10501050         break;
10511051
10521052      case 0x14:
1053         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", cpu_get_pc(&space.device()), data16);
1053         if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", space.device().safe_pc(), data16);
10541054         m_i186.intr.timer  = (m_i186.intr.timer  & ~0x08) | ((data16 << 3) & 0x08);
10551055         m_i186.intr.dma[0] = (m_i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08);
10561056         m_i186.intr.dma[1] = (m_i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08);
r17788r17789
10621062         break;
10631063
10641064      case 0x15:
1065         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", cpu_get_pc(&space.device()), data16);
1065         if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", space.device().safe_pc(), data16);
10661066         m_i186.intr.priority_mask = data16 & 0x0007;
10671067         update_interrupt_state(machine());
10681068         break;
10691069
10701070      case 0x16:
1071         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", cpu_get_pc(&space.device()), data16);
1071         if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", space.device().safe_pc(), data16);
10721072         m_i186.intr.in_service = data16 & 0x00ff;
10731073         update_interrupt_state(machine());
10741074         break;
10751075
10761076      case 0x17:
1077         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", cpu_get_pc(&space.device()), data16);
1077         if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", space.device().safe_pc(), data16);
10781078         m_i186.intr.request = (m_i186.intr.request & ~0x00c0) | (data16 & 0x00c0);
10791079         update_interrupt_state(machine());
10801080         break;
10811081
10821082      case 0x18:
1083         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", cpu_get_pc(&space.device()), data16);
1083         if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", space.device().safe_pc(), data16);
10841084         m_i186.intr.status = (m_i186.intr.status & ~0x8007) | (data16 & 0x8007);
10851085         update_interrupt_state(machine());
10861086         break;
10871087
10881088      case 0x19:
1089         if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", cpu_get_pc(&space.device()), data16);
1089         if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", space.device().safe_pc(), data16);
10901090         m_i186.intr.timer = data16 & 0x000f;
10911091         break;
10921092
10931093      case 0x1a:
1094         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16);
1094         if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", space.device().safe_pc(), data16);
10951095         m_i186.intr.dma[0] = data16 & 0x000f;
10961096         break;
10971097
10981098      case 0x1b:
1099         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16);
1099         if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", space.device().safe_pc(), data16);
11001100         m_i186.intr.dma[1] = data16 & 0x000f;
11011101         break;
11021102
11031103      case 0x1c:
1104         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16);
1104         if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", space.device().safe_pc(), data16);
11051105         m_i186.intr.ext[0] = data16 & 0x007f;
11061106         break;
11071107
11081108      case 0x1d:
1109         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16);
1109         if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", space.device().safe_pc(), data16);
11101110         m_i186.intr.ext[1] = data16 & 0x007f;
11111111         break;
11121112
11131113      case 0x1e:
1114         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16);
1114         if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", space.device().safe_pc(), data16);
11151115         m_i186.intr.ext[2] = data16 & 0x001f;
11161116         break;
11171117
11181118      case 0x1f:
1119         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", cpu_get_pc(&space.device()), data16);
1119         if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", space.device().safe_pc(), data16);
11201120         m_i186.intr.ext[3] = data16 & 0x001f;
11211121         break;
11221122
11231123      case 0x28:
11241124      case 0x2c:
11251125      case 0x30:
1126         if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", cpu_get_pc(&space.device()), (offset - 0x28) / 4, data16);
1126         if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", space.device().safe_pc(), (offset - 0x28) / 4, data16);
11271127         which = (offset - 0x28) / 4;
11281128         internal_timer_update(machine(),which, data16, -1, -1, -1);
11291129         break;
r17788r17789
11311131      case 0x29:
11321132      case 0x2d:
11331133      case 0x31:
1134         if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", cpu_get_pc(&space.device()), (offset - 0x29) / 4, data16);
1134         if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", space.device().safe_pc(), (offset - 0x29) / 4, data16);
11351135         which = (offset - 0x29) / 4;
11361136         internal_timer_update(machine(),which, -1, data16, -1, -1);
11371137         break;
11381138
11391139      case 0x2a:
11401140      case 0x2e:
1141         if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", cpu_get_pc(&space.device()), (offset - 0x2a) / 4, data16);
1141         if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", space.device().safe_pc(), (offset - 0x2a) / 4, data16);
11421142         which = (offset - 0x2a) / 4;
11431143         internal_timer_update(machine(),which, -1, -1, data16, -1);
11441144         break;
r17788r17789
11461146      case 0x2b:
11471147      case 0x2f:
11481148      case 0x33:
1149         if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", cpu_get_pc(&space.device()), (offset - 0x2b) / 4, data16);
1149         if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", space.device().safe_pc(), (offset - 0x2b) / 4, data16);
11501150         which = (offset - 0x2b) / 4;
11511151         internal_timer_update(machine(),which, -1, -1, -1, data16);
11521152         break;
11531153
11541154      case 0x50:
1155         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", cpu_get_pc(&space.device()), data16);
1155         if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", space.device().safe_pc(), data16);
11561156         m_i186.mem.upper = data16 | 0xc038;
11571157         break;
11581158
11591159      case 0x51:
1160         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", cpu_get_pc(&space.device()), data16);
1160         if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", space.device().safe_pc(), data16);
11611161         m_i186.mem.lower = (data16 & 0x3fff) | 0x0038; printf("%X",m_i186.mem.lower);
11621162         break;
11631163
11641164      case 0x52:
1165         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", cpu_get_pc(&space.device()), data16);
1165         if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", space.device().safe_pc(), data16);
11661166         m_i186.mem.peripheral = data16 | 0x0038;
11671167         break;
11681168
11691169      case 0x53:
1170         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", cpu_get_pc(&space.device()), data16);
1170         if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", space.device().safe_pc(), data16);
11711171         m_i186.mem.middle = data16 | 0x01f8;
11721172         break;
11731173
11741174      case 0x54:
1175         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", cpu_get_pc(&space.device()), data16);
1175         if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", space.device().safe_pc(), data16);
11761176         m_i186.mem.middle_size = data16 | 0x8038;
11771177
11781178         /* we need to do this at a time when the I86 context is swapped in */
r17788r17789
11831183
11841184      case 0x60:
11851185      case 0x68:
1186         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x60) / 8, data16);
1186         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", space.device().safe_pc(), (offset - 0x60) / 8, data16);
11871187         which = (offset - 0x60) / 8;
11881188         m_i186.dma[which].source = (m_i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff);
11891189         break;
11901190
11911191      case 0x61:
11921192      case 0x69:
1193         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x61) / 8, data16);
1193         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", space.device().safe_pc(), (offset - 0x61) / 8, data16);
11941194         which = (offset - 0x61) / 8;
11951195         m_i186.dma[which].source = (m_i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000);
11961196         break;
11971197
11981198      case 0x62:
11991199      case 0x6a:
1200         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x62) / 8, data16);
1200         if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", space.device().safe_pc(), (offset - 0x62) / 8, data16);
12011201         which = (offset - 0x62) / 8;
12021202         m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff);
12031203         break;
12041204
12051205      case 0x63:
12061206      case 0x6b:
1207         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(&space.device()), (offset - 0x63) / 8, data16);
1207         if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", space.device().safe_pc(), (offset - 0x63) / 8, data16);
12081208         which = (offset - 0x63) / 8;
12091209         m_i186.dma[which].dest = (m_i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000);
12101210         break;
12111211
12121212      case 0x64:
12131213      case 0x6c:
1214         if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(&space.device()), (offset - 0x64) / 8, data16);
1214         if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", space.device().safe_pc(), (offset - 0x64) / 8, data16);
12151215         which = (offset - 0x64) / 8;
12161216         m_i186.dma[which].count = data16;
12171217         break;
12181218
12191219      case 0x65:
12201220      case 0x6d:
1221         if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(&space.device()), (offset - 0x65) / 8, data16);
1221         if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", space.device().safe_pc(), (offset - 0x65) / 8, data16);
12221222         which = (offset - 0x65) / 8;
12231223         update_dma_control(machine(), which, data16);
12241224         break;
12251225
12261226      case 0x7f:
1227         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", cpu_get_pc(&space.device()), data16);
1227         if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", space.device().safe_pc(), data16);
12281228
12291229         /* we assume here there that this doesn't happen too often */
12301230         /* plus, we can't really remove the old memory range, so we also assume that it's */
r17788r17789
12441244         break;
12451245
12461246      default:
1247         logerror("%05X:80186 port %02X = %04X\n", cpu_get_pc(&space.device()), offset, data16);
1247         logerror("%05X:80186 port %02X = %04X\n", space.device().safe_pc(), offset, data16);
12481248         break;
12491249   }
12501250}
r17788r17789
20822082
20832083READ16_MEMBER(rmnimbus_state::nimbus_io_r)
20842084{
2085    int pc=cpu_get_pc(&space.device());
2085    int pc=space.device().safe_pc();
20862086
20872087    logerror("Nimbus IOR at pc=%08X from %04X mask=%04X, data=%04X\n",pc,(offset*2)+0x30,mem_mask,m_IOPorts[offset]);
20882088
r17788r17789
20952095
20962096WRITE16_MEMBER(rmnimbus_state::nimbus_io_w)
20972097{
2098    int pc=cpu_get_pc(&space.device());
2098    int pc=space.device().safe_pc();
20992099
21002100    logerror("Nimbus IOW at %08X write of %04X to %04X mask=%04X\n",pc,data,(offset*2)+0x30,mem_mask);
21012101
r17788r17789
23142314   device_t *fdc = machine().device(FDC_TAG);
23152315   scsibus_device *hdc = machine().device<scsibus_device>(SCSIBUS_TAG);
23162316
2317   int pc=cpu_get_pc(&space.device());
2317   int pc=space.device().safe_pc();
23182318   rmnimbus_state *state = machine().driver_data<rmnimbus_state>();
23192319   device_t *drive = machine().device(nimbus_wd17xx_interface.floppy_drive_tags[FDC_DRIVE()]);
23202320
r17788r17789
23812381{
23822382   device_t *fdc = machine().device(FDC_TAG);
23832383   scsibus_device *hdc = machine().device<scsibus_device>(SCSIBUS_TAG);
2384    int                 pc=cpu_get_pc(&space.device());
2384    int                 pc=space.device().safe_pc();
23852385    UINT8               reg400_old = m_nimbus_drives.reg400;
23862386
23872387    if(LOG_DISK_FDD && ((offset*2)<=0x10))
r17788r17789
25572557
25582558READ8_MEMBER(rmnimbus_state::nimbus_pc8031_r)
25592559{
2560   int pc=cpu_get_pc(&space.device());
2560   int pc=space.device().safe_pc();
25612561    UINT8   result;
25622562
25632563    switch(offset*2)
r17788r17789
25812581
25822582WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_w)
25832583{
2584   int pc=cpu_get_pc(&space.device());
2584   int pc=space.device().safe_pc();
25852585
25862586    switch(offset*2)
25872587    {
r17788r17789
26072607
26082608READ8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_r)
26092609{
2610   int pc=cpu_get_pc(&space.device());
2610   int pc=space.device().safe_pc();
26112611    UINT8   result = 0;
26122612
26132613    switch (offset & 0x01)
r17788r17789
26322632
26332633WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_iou_w)
26342634{
2635   int pc=cpu_get_pc(&space.device());
2635   int pc=space.device().safe_pc();
26362636
26372637    if(LOG_PC8031)
26382638        logerror("8031 PCIOW %04X write of %02X to %04X\n",pc,data,offset);
r17788r17789
26722672READ8_MEMBER(rmnimbus_state::nimbus_pc8031_port_r)
26732673{
26742674   device_t *er59256 = machine().device(ER59256_TAG);
2675    int pc=cpu_get_pc(&space.device());
2675    int pc=space.device().safe_pc();
26762676    UINT8   result = 0;
26772677
26782678    if(LOG_PC8031_PORT)
r17788r17789
26892689WRITE8_MEMBER(rmnimbus_state::nimbus_pc8031_port_w)
26902690{
26912691   device_t *er59256 = machine().device(ER59256_TAG);
2692    int pc=cpu_get_pc(&space.device());
2692    int pc=space.device().safe_pc();
26932693
26942694    switch (offset)
26952695    {
r17788r17789
27052705/* IO Unit */
27062706READ8_MEMBER(rmnimbus_state::nimbus_iou_r)
27072707{
2708   int pc=cpu_get_pc(&space.device());
2708   int pc=space.device().safe_pc();
27092709    UINT8   result=0;
27102710
27112711    if(offset==0)
r17788r17789
27212721
27222722WRITE8_MEMBER(rmnimbus_state::nimbus_iou_w)
27232723{
2724   int pc=cpu_get_pc(&space.device());
2724   int pc=space.device().safe_pc();
27252725    device_t *msm5205 = machine().device(MSM5205_TAG);
27262726
27272727    if(LOG_IOU)
r17788r17789
27822782
27832783WRITE8_MEMBER(rmnimbus_state::nimbus_sound_ay8910_w)
27842784{
2785   int pc=cpu_get_pc(&space.device());
2785   int pc=space.device().safe_pc();
27862786   device_t *ay8910 = machine().device(AY8910_TAG);
27872787
27882788    if(LOG_SOUND)
r17788r17789
28542854   rmnimbus_state *drvstate = machine.driver_data<rmnimbus_state>();
28552855    UINT8   x = 0;
28562856    UINT8   y = 0;
2857//  int     pc=cpu_get_pc(machine.device(MAINCPU_TAG));
2857//  int     pc=machine.device(MAINCPU_TAG)->safe_pc();
28582858
28592859    UINT8   intstate_x;
28602860    UINT8   intstate_y;
r17788r17789
30003000
30013001    */
30023002   UINT8 result;
3003   //int pc=cpu_get_pc(machine().device(MAINCPU_TAG));
3003   //int pc=machine().device(MAINCPU_TAG)->safe_pc();
30043004   _mouse_joy_state *state = &m_nimbus_mouse;
30053005
30063006   if (ioport("config")->read() & 0x01)
trunk/src/mess/machine/apple2.c
r17788r17789
14501450            if (offset == 0xa)  // RAM
14511451            {
14521452                apple2_setvar(space.machine(), VAR_TK2000RAM, ~0);
1453                printf("TK2000: RAM (PC %x)\n", cpu_get_pc(m_maincpu));
1453                printf("TK2000: RAM (PC %x)\n", m_maincpu->safe_pc());
14541454            }
14551455            else if (offset == 0xb) // ROM
14561456            {
14571457                apple2_setvar(space.machine(), 0, ~VAR_TK2000RAM);
1458                printf("TK2000: ROM (PC %x)\n", cpu_get_pc(m_maincpu));
1458                printf("TK2000: ROM (PC %x)\n", m_maincpu->safe_pc());
14591459            }
14601460        }
14611461
trunk/src/mess/machine/omti8621.c
r17788r17789
218218      int ms = (t % osd_ticks_per_second()) / 1000;
219219
220220      sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(),
221            cpu_get_previouspc(cpu), device->tag());
221            cpu->safe_pcbase(), device->tag());
222222   } else {
223223      strcpy(statebuf, "(no context)");
224224   }
trunk/src/mess/video/stic.c
r17788r17789
157157      case STIC_CSR + STIC_CSR1:
158158      case STIC_CSR + STIC_CSR2:
159159      case STIC_CSR + STIC_CSR3:
160         logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, cpu_get_pc(&space.device()));
160         logerror("Setting color_stack[%x] = %x (%x)\n", offset & (STIC_CSRS - 1),data & STIC_CSR_BG, space.device().safe_pc());
161161         break;
162162      /* Border Color */
163163      case STIC_BCR:
trunk/src/mess/video/nubus_wsportrait.c
r17788r17789
254254
255255         if (m_count == 3)
256256         {
257//              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()) );
257//              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() );
258258            m_palette[m_clutoffs] = MAKE_RGB(m_colors[2], m_colors[2], m_colors[2]);
259259            m_clutoffs++;
260260            if (m_clutoffs > 255)
trunk/src/mess/video/nubus_cb264.c
r17788r17789
247247         break;
248248
249249      default:
250//          printf("cb264_w: %x to reg %x (mask %x PC %x)\n", data, offset*4, mem_mask, cpu_get_pc(&space->device()));
250//          printf("cb264_w: %x to reg %x (mask %x PC %x)\n", data, offset*4, mem_mask, space->device().safe_pc());
251251         break;
252252   }
253253}
r17788r17789
265265         return m_cb264_toggle;   // bit 0 is vblank?
266266
267267      default:
268         logerror("cb264_r: reg %x (mask %x PC %x)\n", offset*4, mem_mask, cpu_get_pc(&space.device()));
268         logerror("cb264_r: reg %x (mask %x PC %x)\n", offset*4, mem_mask, space.device().safe_pc());
269269         break;
270270   }
271271
trunk/src/mess/video/mac.c
r17788r17789
714714
715715READ32_MEMBER(mac_state::dafb_r)
716716{
717//  if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, cpu_get_pc(m_maincpu));
717//  if (offset != 0x108/4) printf("DAFB: Read @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->safe_pc());
718718
719719   switch (offset<<2)
720720   {
r17788r17789
745745
746746WRITE32_MEMBER(mac_state::dafb_w)
747747{
748//  if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, cpu_get_pc(m_maincpu));
748//  if (offset != 0x10c/4) printf("DAFB: Write %08x @ %x (mask %x PC=%x)\n", data, offset*4, mem_mask, m_maincpu->safe_pc());
749749
750750   switch (offset<<2)
751751   {
r17788r17789
809809
810810READ32_MEMBER(mac_state::dafb_dac_r)
811811{
812//  printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, cpu_get_pc(m_maincpu));
812//  printf("DAFB: Read DAC @ %x (mask %x PC=%x)\n", offset*4, mem_mask, m_maincpu->safe_pc());
813813
814814   return 0;
815815}
816816
817817WRITE32_MEMBER(mac_state::dafb_dac_w)
818818{
819//  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));
819//  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());
820820
821821   switch (offset<<2)
822822   {
r17788r17789
10181018            break;
10191019
10201020        default:
1021//            printf("macwd_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(m_maincpu));
1021//            printf("macwd_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, m_maincpu->safe_pc());
10221022            break;
10231023    }
10241024    return 0;
r17788r17789
10521052            break;
10531053
10541054        default:
1055//            printf("macwd_w: %x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(m_maincpu));
1055//            printf("macwd_w: %x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, m_maincpu->safe_pc());
10561056            break;
10571057    }
10581058}
trunk/src/mess/video/rm380z.c
r17788r17789
196196{
197197   rm380z_state *state = machine().driver_data<rm380z_state>();
198198
199   //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")));
199   //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());
200200
201201   int lineWidth=0x80;
202202   if (m_videomode==RM380Z_VIDEOMODE_40COL)
trunk/src/mess/video/newport.c
r17788r17789
3838      va_start( v, s_fmt );
3939      vsprintf( buf, s_fmt, v );
4040      va_end( v );
41      logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
41      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
4242   }
4343}
4444
trunk/src/mess/video/nubus_specpdq.c
r17788r17789
291291         break;
292292
293293      case 0x120000:   // DAC address
294//          printf("%08x to DAC control (PC=%x)\n", data, cpu_get_pc(&space.device()));
294//          printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc());
295295         m_clutoffs = ((data>>8)&0xff)^0xff;
296296         break;
297297
r17788r17789
300300
301301         if (m_count == 3)
302302         {
303//              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()) );
303//              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() );
304304            palette_set_color(space.machine(), m_clutoffs, MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]));
305305            m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]);
306306            m_clutoffs++;
r17788r17789
386386
387387      // blitter control
388388      case 0x182006:
389//          printf("%08x (%d) to blitter ctrl 1 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device()));
389//          printf("%08x (%d) to blitter ctrl 1 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc());
390390         break;
391391
392392      case 0x182008:
393//          printf("%08x (%d) to blitter ctrl 2 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device()));
393//          printf("%08x (%d) to blitter ctrl 2 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc());
394394         m_patofsx = (data ^ 0xffffffff) & 7;
395395         m_patofsy = ((data ^ 0xffffffff)>>3) & 7;
396396         break;
397397
398398      case 0x18200e:
399//          printf("%08x (%d) to blitter ctrl 3 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device()));
399//          printf("%08x (%d) to blitter ctrl 3 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc());
400400         m_width = data ^ 0xffffffff;
401401         break;
402402
403403      case 0x18200b:
404//          printf("%08x (%d) to blitter ctrl 4 (PC=%x)\n", data^0xffffffff, data^0xffffffff, cpu_get_pc(&space.device()));
404//          printf("%08x (%d) to blitter ctrl 4 (PC=%x)\n", data^0xffffffff, data^0xffffffff, space.device().safe_pc());
405405         m_height = (data ^ 0xffffffff) & 0xffff;
406406         break;
407407
408408      case 0x18200a:
409409         data ^= 0xffffffff;
410//          printf("%08x to blitter ctrl 5 (PC=%x)\n", data, cpu_get_pc(&space.device()));
410//          printf("%08x to blitter ctrl 5 (PC=%x)\n", data, space.device().safe_pc());
411411         m_vram_src = data>>2;
412412         break;
413413
414414      case 0x182009:
415415         data ^= 0xffffffff;
416//          printf("%08x to blitter ctrl 6 (PC=%x)\n", data, cpu_get_pc(&space.device()));
416//          printf("%08x to blitter ctrl 6 (PC=%x)\n", data, space.device().safe_pc());
417417         m_vram_addr = data>>2;
418418         break;
419419
420420      case 0x182007:
421421         data ^= 0xffffffff;
422//          printf("%08x to blitter ctrl 7 (PC=%x)\n", data, cpu_get_pc(&space.device()));
422//          printf("%08x to blitter ctrl 7 (PC=%x)\n", data, space.device().safe_pc());
423423
424424         // fill rectangle
425425         if (data == 2)
r17788r17789
460460         break;
461461
462462      default:
463//          printf("specpdq_w: %08x @ %x (mask %08x  PC=%x)\n", data^0xffffffff, offset, mem_mask, cpu_get_pc(&space.device()));
463//          printf("specpdq_w: %08x @ %x (mask %08x  PC=%x)\n", data^0xffffffff, offset, mem_mask, space.device().safe_pc());
464464         break;
465465   }
466466}
467467
468468READ32_MEMBER( nubus_specpdq_device::specpdq_r )
469469{
470//  if (offset != 0xc005c && offset != 0xc005e) printf("specpdq_r: @ %x (mask %08x  PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device()));
470//  if (offset != 0xc005c && offset != 0xc005e) printf("specpdq_r: @ %x (mask %08x  PC=%x)\n", offset, mem_mask, space.device().safe_pc());
471471
472472   if (offset >= 0xc0000 && offset < 0x100000)
473473   {
trunk/src/mess/video/x68k.c
r17788r17789
461461      }
462462      break;
463463   }
464//  logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc(space->machine().device("maincpu")),data,offset);
464//  logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",space->machine().device("maincpu")->safe_pc(),data,offset);
465465}
466466
467467READ16_HANDLER( x68k_crtc_r )
r17788r17789
478478
479479   if(offset < 24)
480480   {
481//      logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",cpu_get_pc(space->machine().device("maincpu")),state->m_crtc.reg[offset],offset);
481//      logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",space->machine().device("maincpu")->safe_pc(),state->m_crtc.reg[offset],offset);
482482      switch(offset)
483483      {
484484      case 9:
trunk/src/mess/video/crtc_ega.c
r17788r17789
8080
8181WRITE8_MEMBER( crtc_ega_device::register_w )
8282{
83   if (LOG)  logerror("CRTC_EGA PC %04x: reg 0x%02x = 0x%02x\n", cpu_get_pc(machine().firstcpu), m_register_address_latch, data);
83   if (LOG)  logerror("CRTC_EGA PC %04x: reg 0x%02x = 0x%02x\n", machine().firstcpu->safe_pc(), m_register_address_latch, data);
8484
8585   switch (m_register_address_latch)
8686   {
trunk/src/mess/video/nubus_48gc.c
r17788r17789
335335
336336READ32_MEMBER( jmfb_device::mac_48gc_r )
337337{
338//  printf("48gc_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, cpu_get_pc(machine().device("maincpu")));
338//  printf("48gc_r: @ %x, mask %08x [PC=%x]\n", offset, mem_mask, machine().device("maincpu")->safe_pc());
339339
340340   switch (offset)
341341   {
trunk/src/mess/video/nubus_m2hires.c
r17788r17789
257257         break;
258258
259259      case 0x5038:   // DAC control
260//          printf("%08x to DAC control (PC=%x)\n", data, cpu_get_pc(&space.device()));
260//          printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc());
261261         m_clutoffs = (data>>24)&0xff;
262262         break;
263263
r17788r17789
266266
267267         if (m_count == 3)
268268         {
269//              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()) );
269//              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() );
270270            m_palette[m_clutoffs] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]);
271271            m_clutoffs++;
272272            if (m_clutoffs > 255)
r17788r17789
287287         break;
288288
289289      default:
290//          printf("m2hires_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
290//          printf("m2hires_w: %08x @ %x, mask %08x (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
291291         break;
292292   }
293293}
r17788r17789
301301   }
302302/*  else
303303    {
304        printf("m2hires_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device()));
304        printf("m2hires_r: @ %x, mask %08x (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
305305    }*/
306306
307307   return 0;
trunk/src/mess/video/ssystem3.c
r17788r17789
1818      state->m_lcd.data[state->m_lcd.count/8]&=~(1<<(state->m_lcd.count&7));
1919      if (data) state->m_lcd.data[state->m_lcd.count/8]|=1<<(state->m_lcd.count&7);
2020      if (state->m_lcd.count+1==40) {
21         logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)cpu_get_pc(machine.device("maincpu")),
21         logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine.device("maincpu")->safe_pc(),
2222            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]);
2323      }
2424      state->m_lcd.count=(state->m_lcd.count+1)%40;
trunk/src/mess/video/rmnimbus.c
r17788r17789
105105READ16_MEMBER(rmnimbus_state::nimbus_video_io_r)
106106{
107107   rmnimbus_state *state = machine().driver_data<rmnimbus_state>();
108    int     pc=cpu_get_pc(&space.device());
108    int     pc=space.device().safe_pc();
109109    UINT16  result;
110110
111111    switch (offset)
r17788r17789
266266WRITE16_MEMBER(rmnimbus_state::nimbus_video_io_w)
267267{
268268    rmnimbus_state *state = machine().driver_data<rmnimbus_state>();
269   int pc=cpu_get_pc(&space.device());
269   int pc=space.device().safe_pc();
270270
271271    if(offset<reg028)
272272    {
trunk/src/mess/video/nubus_spec8.c
r17788r17789
267267         {
268268            int actual_color = BITSWAP8(m_clutoffs, 0, 1, 2, 3, 4, 5, 6, 7);
269269
270//              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()) );
270//              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() );
271271            m_palette[actual_color] = MAKE_RGB(m_colors[0], m_colors[1], m_colors[2]);
272272            m_clutoffs++;
273273            if (m_clutoffs > 255)
r17788r17789
313313         break;
314314
315315      default:
316//          if (offset >= 0x3800) printf("spec8s3_w: %08x @ %x (mask %08x  PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
316//          if (offset >= 0x3800) printf("spec8s3_w: %08x @ %x (mask %08x  PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
317317         break;
318318   }
319319}
r17788r17789
341341         return 0;
342342
343343      default:
344//          if (offset >= 0x3800) printf("spec8s3_r: @ %x (mask %08x  PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device()));
344//          if (offset >= 0x3800) printf("spec8s3_r: @ %x (mask %08x  PC=%x)\n", offset, mem_mask, space.device().safe_pc());
345345         break;
346346   }
347347   return 0;
trunk/src/mess/video/gba.c
r17788r17789
2222      va_start( v, s_fmt );
2323      vsprintf( buf, s_fmt, v );
2424      va_end( v );
25      logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
25      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
2626   }
2727}
2828
trunk/src/mess/drivers/rainbow.c
r17788r17789
331331
332332WRITE8_MEMBER( rainbow_state::diagnostic_w )
333333{
334//    printf("%02x to diag port (PC=%x)\n", data, cpu_get_pc(&space.device()));
334//    printf("%02x to diag port (PC=%x)\n", data, space.device().safe_pc());
335335
336336    if (!(data & 1))
337337    {
trunk/src/mess/drivers/pc9801.c
r17788r17789
719719         printf("Read to undefined port [%02x]\n",offset+0x40);
720720      else
721721      {
722         //printf("Read to 8251 kbd port [%02x] %08x\n",offset+0x40,cpu_get_pc(m_maincpu));
722         //printf("Read to 8251 kbd port [%02x] %08x\n",offset+0x40,m_maincpu->safe_pc());
723723         if(offset == 1)
724724         {
725725            UINT8 res;
trunk/src/mess/drivers/pc88va.c
r17788r17789
641641      case SPROV:  m_cmd = SPROV; /* TODO: where it returns the info? */ break;
642642
643643      /* TODO: 0x89 shouldn't trigger, should be one of the above commands */
644      default:   m_cmd = 0x00; printf("PC=%05x: Unknown IDP %02x cmd set\n",cpu_get_pc(&space.device()),data); break;
644      default:   m_cmd = 0x00; printf("PC=%05x: Unknown IDP %02x cmd set\n",space.device().safe_pc(),data); break;
645645   }
646646}
647647
trunk/src/mess/drivers/vii.c
r17788r17789
167167      va_start( v, s_fmt );
168168      vsprintf( buf, s_fmt, v );
169169      va_end( v );
170      logerror( "%04x: %s", cpu_get_pc(machine.device("maincpu")), buf );
170      logerror( "%04x: %s", machine.device("maincpu")->safe_pc(), buf );
171171   }
172172}
173173#else
trunk/src/mess/drivers/x1.c
r17788r17789
16321632   else if(offset >= 0x4000 && offset <= 0xffff)   { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; }
16331633   else
16341634   {
1635      //logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(&space->device()),offset);
1635      //logerror("(PC=%06x) Read i/o address %04x\n",space->device().safe_pc(),offset);
16361636   }
16371637   return 0xff;
16381638}
r17788r17789
16751675   else if(offset >= 0x4000 && offset <= 0xffff)   { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; }
16761676   else
16771677   {
1678      //logerror("(PC=%06x) Write %02x at i/o address %04x\n",cpu_get_pc(&space->device()),data,offset);
1678      //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space->device().safe_pc(),data,offset);
16791679   }
16801680}
16811681
r17788r17789
17221722   else if(offset >= 0x4000 && offset <= 0xffff)   { return m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)]; }
17231723   else
17241724   {
1725      //logerror("(PC=%06x) Read i/o address %04x\n",cpu_get_pc(&space->device()),offset);
1725      //logerror("(PC=%06x) Read i/o address %04x\n",space->device().safe_pc(),offset);
17261726   }
17271727   return 0xff;
17281728}
r17788r17789
17781778   else if(offset >= 0x4000 && offset <= 0xffff)   { m_gfx_bitmap_ram[offset-0x4000+(m_scrn_reg.gfx_bank*0xc000)] = data; }
17791779   else
17801780   {
1781      //logerror("(PC=%06x) Write %02x at i/o address %04x\n",cpu_get_pc(&space->device()),data,offset);
1781      //logerror("(PC=%06x) Write %02x at i/o address %04x\n",space->device().safe_pc(),data,offset);
17821782   }
17831783}
17841784
trunk/src/mess/drivers/sgi_ip6.c
r17788r17789
5555      va_start( v, s_fmt );
5656      vsprintf( buf, s_fmt, v );
5757      va_end( v );
58      logerror("%08x: %s", cpu_get_pc(machine.device("maincpu")), buf);
58      logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf);
5959   }
6060}
6161#else
trunk/src/mess/drivers/smc777.c
r17788r17789
633633   else if(low_offs >= 0x18 && low_offs <= 0x19) { logerror("6845 read %02x",low_offs & 1); }
634634   else if(low_offs >= 0x1a && low_offs <= 0x1b) { return key_r(space,low_offs & 1); }
635635   else if(low_offs == 0x1c)                 { return system_input_r(space,0); }
636   else if(low_offs == 0x1d)                 { logerror("System and control data R PC=%04x\n",cpu_get_pc(&space.device())); return 0xff; }
636   else if(low_offs == 0x1d)                 { logerror("System and control data R PC=%04x\n",space.device().safe_pc()); return 0xff; }
637637   else if(low_offs == 0x20)                 { return display_reg_r(space,0); }
638638   else if(low_offs == 0x21)                 { return smc777_irq_mask_r(space,0); }
639   else if(low_offs == 0x25)                 { logerror("RTC read PC=%04x\n",cpu_get_pc(&space.device())); return 0xff; }
640   else if(low_offs == 0x26)                 { logerror("RS-232c RX %04x\n",cpu_get_pc(&space.device())); return 0xff; }
639   else if(low_offs == 0x25)                 { logerror("RTC read PC=%04x\n",space.device().safe_pc()); return 0xff; }
640   else if(low_offs == 0x26)                 { logerror("RS-232c RX %04x\n",space.device().safe_pc()); return 0xff; }
641641   else if(low_offs >= 0x28 && low_offs <= 0x2c) { logerror("FDC 2 read %02x\n",low_offs & 7); return 0xff; }
642642   else if(low_offs >= 0x2d && low_offs <= 0x2f) { logerror("RS-232c no. 2 read %02x\n",low_offs & 3); return 0xff; }
643643   else if(low_offs >= 0x30 && low_offs <= 0x34) { return smc777_fdc1_r(space,low_offs & 7); }
r17788r17789
655655   else if(low_offs == 0x7e || low_offs == 0x7f) { logerror("Kanji ROM read %02x\n",low_offs & 1); }
656656   else if(low_offs >= 0x80)                 { return smc777_fbuf_r(space,offset & 0xff7f); }
657657
658   logerror("Undefined read at %04x offset = %02x\n",cpu_get_pc(&space.device()),low_offs);
658   logerror("Undefined read at %04x offset = %02x\n",space.device().safe_pc(),low_offs);
659659   return 0xff;
660660}
661661
r17788r17789
697697   else if(low_offs == 0x75)                 { logerror("VTR Controller ROM write %02x\n",data); }
698698   else if(low_offs == 0x7e || low_offs == 0x7f) { logerror("Kanji ROM write [%02x] %02x\n",low_offs & 1,data); }
699699   else if(low_offs >= 0x80)                 { smc777_fbuf_w(space,offset & 0xff7f,data); }
700   else                                { logerror("Undefined write at %04x offset = %02x data = %02x\n",cpu_get_pc(&space.device()),low_offs,data); }
700   else                                { logerror("Undefined write at %04x offset = %02x data = %02x\n",space.device().safe_pc(),low_offs,data); }
701701}
702702
703703static ADDRESS_MAP_START( smc777_io , AS_IO, 8, smc777_state )
trunk/src/mess/drivers/ip22.c
r17788r17789
144144      va_start( v, s_fmt );
145145      vsprintf( buf, s_fmt, v );
146146      va_end( v );
147      logerror("%08x: %s", cpu_get_pc(machine.device("maincpu")), buf);
147      logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf);
148148   }
149149}
150150
r17788r17789
253253      return ret8;
254254   case 0x030/4:
255255      //verboselog(( machine, 2, "Serial 1 Command Transfer Read, 0x1fbd9830: %02x\n", 0x04 );
256      switch(cpu_get_pc(&space.device()))
256      switch(space.device().safe_pc())
257257      {
258258         case 0x9fc1d9e4:   // interpreter (ip244415)
259259         case 0x9fc1d9e0:   // DRC (ip244415)
r17788r17789
499499         return 0;
500500      }
501501   default:
502      //verboselog((machine, 0, "Unknown HPC3 HD0 Read: %08x (%08x) [%x] PC=%x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, offset, cpu_get_pc(&space.device()) );
502      //verboselog((machine, 0, "Unknown HPC3 HD0 Read: %08x (%08x) [%x] PC=%x\n", 0x1fbc0000 + ( offset << 2 ), mem_mask, offset, space.device().safe_pc() );
503503      return 0;
504504   }
505505   return 0;
r17788r17789
13701370
13711371            dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor);
13721372
1373            printf("PC is %08x\n", cpu_get_pc(machine.device("maincpu")));
1373            printf("PC is %08x\n", machine.device("maincpu")->safe_pc());
13741374            printf("DMA to device: length %x xie %d eox %d\n", length, xie, eox);
13751375
13761376            if (length <= 0x4000)
trunk/src/mess/drivers/a2600.c
r17788r17789
655655{
656656   a2600_state *state = machine.driver_data<a2600_state>();
657657   //printf("ModeFV %04x\n",offset);
658   if (!state->m_FVlocked && ( cpu_get_pc(machine.device("maincpu")) & 0x1F00 ) == 0x1F00 )
658   if (!state->m_FVlocked && ( machine.device("maincpu")->safe_pc() & 0x1F00 ) == 0x1F00 )
659659   {
660660      state->m_FVlocked = 1;
661661      state->m_current_bank = state->m_current_bank ^ 0x01;
r17788r17789
673673      state->m_current_bank ^= 1;
674674      break;
675675   default:
676      printf("%04X: write to unknown mapper address %02X\n", cpu_get_pc(machine.device("maincpu")), 0xfa0 + offset );
676      printf("%04X: write to unknown mapper address %02X\n", machine.device("maincpu")->safe_pc(), 0xfa0 + offset );
677677      break;
678678   }
679679   state->m_bank_base[1] = CART + 0x1000 * state->m_current_bank;
r17788r17789
805805{
806806   UINT8 data = ( offset & 0x800 ) ? m_bank_base[2][offset & 0x7FF] : m_bank_base[1][offset];
807807
808   //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc(machine().device("maincpu")), offset);
808   //logerror("%04X: read from modeSS area offset = %04X\n", machine().device("maincpu")->safe_pc(), offset);
809809   /* Check for control register "write" */
810810   if ( offset == 0xFF8 )
811811   {
812      //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc(machine().device("maincpu")), m_modeSS_byte);
812      //logerror("%04X: write to modeSS control register data = %02X\n", machine().device("maincpu")->safe_pc(), m_modeSS_byte);
813813      m_modeSS_write_enabled = m_modeSS_byte & 0x02;
814814      m_modeSS_write_delay = m_modeSS_byte >> 5;
815815      switch ( m_modeSS_byte & 0x1C )
r17788r17789
862862   {
863863      /* Cassette port read */
864864      double tap_val = machine().device<cassette_image_device>(CASSETTE_TAG)->input();
865      //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(machine().device("maincpu")), tap_val);
865      //logerror("%04X: Cassette port read, tap_val = %f\n", machine().device("maincpu")->safe_pc(), tap_val);
866866      if ( tap_val < 0 )
867867      {
868868         data = 0x00;
r17788r17789
878878      if ( m_modeSS_write_enabled )
879879      {
880880         int diff = machine().device<cpu_device>("maincpu")->total_cycles() - m_modeSS_byte_started;
881         //logerror("%04X: offset = %04X, %d\n", cpu_get_pc(machine().device("maincpu")), offset, diff);
881         //logerror("%04X: offset = %04X, %d\n", machine().device("maincpu")->safe_pc(), offset, diff);
882882         if ( diff - m_modeSS_diff_adjust == 5 )
883883         {
884            //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc(machine().device("maincpu")), offset, m_modeSS_byte );
884            //logerror("%04X: RAM write offset = %04X, data = %02X\n", machine().device("maincpu")->safe_pc(), offset, m_modeSS_byte );
885885            if ( offset & 0x800 )
886886            {
887887               if ( m_modeSS_high_ram_enabled )
r17788r17789
919919   }
920920   /* Because the mame core caches opcode data and doesn't perform reads like normal */
921921   /* we have to put in this little hack here to get Suicide Mission to work. */
922   if ( offset != 0xFF8 && ( cpu_get_pc(machine().device("maincpu")) & 0x1FFF ) == 0x1FF8 )
922   if ( offset != 0xFF8 && ( machine().device("maincpu")->safe_pc() & 0x1FFF ) == 0x1FF8 )
923923   {
924924      modeSS_r( space, 0xFF8 );
925925   }
r17788r17789
984984   UINT8   data_fetcher = offset & 0x07;
985985   UINT8   data = 0xFF;
986986
987   logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc(machine().device("maincpu")), offset);
987   logerror("%04X: Read from DPC offset $%02X\n", machine().device("maincpu")->safe_pc(), offset);
988988   if ( offset < 0x08 )
989989   {
990990      switch( offset & 0x06 )
r17788r17789
10911091      m_dpc.movamt = data;
10921092      break;
10931093   case 0x28:         /* Not used */
1094      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(machine().device("maincpu")), offset, data);
1094      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", machine().device("maincpu")->safe_pc(), offset, data);
10951095      break;
10961096   case 0x30:         /* Random number generator reset */
10971097      m_dpc.shift_reg = 0;
10981098      break;
10991099   case 0x38:         /* Not used */
1100      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(machine().device("maincpu")), offset, data);
1100      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", machine().device("maincpu")->safe_pc(), offset, data);
11011101      break;
11021102   }
11031103}
r17788r17789
14981498   UINT16   last_address, prev_address;
14991499   UINT8   last_byte, prev_byte;
15001500
1501   last_address = cpu_get_pc(machine().device("maincpu")) - 1;
1501   last_address = machine().device("maincpu")->safe_pc() - 1;
15021502   if ( ! ( last_address & 0x1080 ) )
15031503   {
15041504      return offset;
trunk/src/mess/drivers/rex6000.c
r17788r17789
141141   }
142142   else
143143   {
144      //logerror("%04x: unkonwn memory bank %x\n", cpu_get_pc(m_maincpu), bank);
144      //logerror("%04x: unkonwn memory bank %x\n", m_maincpu->safe_pc(), bank);
145145      return BANK_UNKNOWN;
146146   }
147147}
trunk/src/mess/drivers/ex800.c
r17788r17789
215215
216216READ8_MEMBER(ex800_state::ex800_porta_r)
217217{
218   logerror("PA R @%x\n", cpu_get_pc(&space.device()));
218   logerror("PA R @%x\n", space.device().safe_pc());
219219   return machine().rand();
220220}
221221
222222READ8_MEMBER(ex800_state::ex800_portb_r)
223223{
224   logerror("PB R @%x\n", cpu_get_pc(&space.device()));
224   logerror("PB R @%x\n", space.device().safe_pc());
225225   return machine().rand();
226226}
227227
228228READ8_MEMBER(ex800_state::ex800_portc_r)
229229{
230   logerror("PC R @%x\n", cpu_get_pc(&space.device()));
230   logerror("PC R @%x\n", space.device().safe_pc());
231231   return machine().rand();
232232}
233233
r17788r17789
236236   if (PA6) logerror("BNK0 selected.\n");
237237   if (PA7) logerror("BNK1 selected.\n");
238238
239   logerror("PA W %x @%x\n", data, cpu_get_pc(&space.device()));
239   logerror("PA W %x @%x\n", data, space.device().safe_pc());
240240}
241241
242242WRITE8_MEMBER(ex800_state::ex800_portb_w)
243243{
244244   if (data & 3)
245      logerror("PB0/1 Line feed @%x\n", cpu_get_pc(&space.device()));
245      logerror("PB0/1 Line feed @%x\n", space.device().safe_pc());
246246   if (!(data & 4))
247      logerror("PB2 Line feed @%x\n", cpu_get_pc(&space.device()));
247      logerror("PB2 Line feed @%x\n", space.device().safe_pc());
248248   if (data & 8)
249      logerror("PB3 Online LED on @%x\n", cpu_get_pc(&space.device()));
249      logerror("PB3 Online LED on @%x\n", space.device().safe_pc());
250250   else
251      logerror("PB3 Online LED off @%x\n", cpu_get_pc(&space.device()));
251      logerror("PB3 Online LED off @%x\n", space.device().safe_pc());
252252   if (data & 16)
253      logerror("PB4 Serial @%x\n", cpu_get_pc(&space.device()));
253      logerror("PB4 Serial @%x\n", space.device().safe_pc());
254254   if (data & 32)
255      logerror("PB4 Serial @%x\n", cpu_get_pc(&space.device()));
255      logerror("PB4 Serial @%x\n", space.device().safe_pc());
256256   if (data & 64)
257      logerror("PB4 Serial @%x\n", cpu_get_pc(&space.device()));
257      logerror("PB4 Serial @%x\n", space.device().safe_pc());
258258   if (data & 128)
259      logerror("PB3 Paper empty LED on @%x\n", cpu_get_pc(&space.device()));
259      logerror("PB3 Paper empty LED on @%x\n", space.device().safe_pc());
260260   else
261      logerror("PB3 Paper empty LED off @%x\n", cpu_get_pc(&space.device()));
261      logerror("PB3 Paper empty LED off @%x\n", space.device().safe_pc());
262262
263//  logerror("PB W %x @%x\n", data, cpu_get_pc(&space.device()));
263//  logerror("PB W %x @%x\n", data, space.device().safe_pc());
264264}
265265
266266WRITE8_MEMBER(ex800_state::ex800_portc_w)
r17788r17789
271271   else
272272      beep_set_state(speaker, 1);
273273
274   logerror("PC W %x @%x\n", data, cpu_get_pc(&space.device()));
274   logerror("PC W %x @%x\n", data, space.device().safe_pc());
275275}
276276
277277
r17788r17789
279279
280280READ8_MEMBER(ex800_state::ex800_devsel_r)
281281{
282   logerror("DEVSEL R @%x with offset %x\n", cpu_get_pc(&space.device()), offset);
282   logerror("DEVSEL R @%x with offset %x\n", space.device().safe_pc(), offset);
283283   return machine().rand();
284284}
285285
286286WRITE8_MEMBER(ex800_state::ex800_devsel_w)
287287{
288   logerror("DEVSEL W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset);
288   logerror("DEVSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
289289}
290290
291291READ8_MEMBER(ex800_state::ex800_gate5a_r)
292292{
293   logerror("GATE5A R @%x with offset %x\n", cpu_get_pc(&space.device()), offset);
293   logerror("GATE5A R @%x with offset %x\n", space.device().safe_pc(), offset);
294294   return machine().rand();
295295}
296296
297297WRITE8_MEMBER(ex800_state::ex800_gate5a_w)
298298{
299   logerror("GATE5A W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset);
299   logerror("GATE5A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
300300}
301301
302302READ8_MEMBER(ex800_state::ex800_iosel_r)
303303{
304   logerror("IOSEL R @%x with offset %x\n", cpu_get_pc(&space.device()), offset);
304   logerror("IOSEL R @%x with offset %x\n", space.device().safe_pc(), offset);
305305   return machine().rand();
306306}
307307
308308WRITE8_MEMBER(ex800_state::ex800_iosel_w)
309309{
310   logerror("IOSEL W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset);
310   logerror("IOSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
311311}
312312
313313READ8_MEMBER(ex800_state::ex800_gate7a_r)
314314{
315   logerror("GATE7A R @%x with offset %x\n", cpu_get_pc(&space.device()), offset);
315   logerror("GATE7A R @%x with offset %x\n", space.device().safe_pc(), offset);
316316   return machine().rand();
317317}
318318
319319WRITE8_MEMBER(ex800_state::ex800_gate7a_w)
320320{
321   logerror("GATE7A W %x @%x with offset %x\n", data, cpu_get_pc(&space.device()), offset);
321   logerror("GATE7A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
322322}
323323
324324
trunk/src/mess/drivers/vboy.c
r17788r17789
793793      case 0x42:   //XPCTRL
794794               return m_vip_regs.XPCTRL;
795795      case 0x44:   //VER
796               printf("%08x read VER\n",cpu_get_pc(m_maincpu));
796               printf("%08x read VER\n",m_maincpu->safe_pc());
797797               return m_vip_regs.VER;
798798      case 0x48:   //SPT0
799799               return m_vip_regs.SPT[0];
trunk/src/mess/drivers/ssystem3.c
r17788r17789
9292      if (d) state->m_playfield.data|=1<<(state->m_playfield.bit^7);
9393      state->m_playfield.bit++;
9494      if (state->m_playfield.bit==8) {
95   logerror("%.4x playfield wrote %d %02x\n", (int)cpu_get_pc(machine.device("maincpu")), state->m_playfield.count, state->m_playfield.data);
95   logerror("%.4x playfield wrote %d %02x\n", (int)machine.device("maincpu")->safe_pc(), state->m_playfield.count, state->m_playfield.data);
9696   state->m_playfield.u.data[state->m_playfield.count]=state->m_playfield.data;
9797   state->m_playfield.bit=0;
9898   state->m_playfield.count=(state->m_playfield.count+1)%ARRAY_LENGTH(state->m_playfield.u.data);
trunk/src/mess/drivers/camplynx.c
r17788r17789
121121   if (data & 4)
122122      membank("bank1")->set_entry(2);
123123   else
124      logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data);
124      logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->safe_pc(), data);
125125}
126126
127127WRITE8_MEMBER( camplynx_state::lynx128k_bank_w )
r17788r17789
157157      membank("bank8")->set_base(base + 0x2e000);
158158   }
159159   else
160      logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data);
160      logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->safe_pc(), data);
161161
162162   /* Set write banks */
163163   bank = data & 0xd0;
r17788r17789
186186      membank("bank18")->set_base(base + 0x2e000);
187187   }
188188   else
189      logerror("%04X: Cannot understand bankswitch command %X\n",cpu_get_pc(m_maincpu), data);
189      logerror("%04X: Cannot understand bankswitch command %X\n",m_maincpu->safe_pc(), data);
190190}
191191
192192static ADDRESS_MAP_START( lynx48k_mem, AS_PROGRAM, 8, camplynx_state )
trunk/src/mess/drivers/ng_aes.c
r17788r17789
333333//  case 0x33: break; // coui lockout
334334
335335   default:
336      logerror("PC: %x  Unmapped I/O control write.  Offset: %x  Data: %x\n", cpu_get_pc(&space.device()), offset, data);
336      logerror("PC: %x  Unmapped I/O control write.  Offset: %x  Data: %x\n", space.device().safe_pc(), offset, data);
337337      break;
338338   }
339339}
r17788r17789
513513      /* boost the interleave to let the audio CPU read the command */
514514      machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50));
515515
516      if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", cpu_get_pc(&space.device()), data, mem_mask);
516      if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_command_w %04x - %04x\n", space.device().safe_pc(), data, mem_mask);
517517   }
518518}
519519
r17788r17789
522522{
523523   UINT8 ret = soundlatch_byte_r(space, 0);
524524
525   if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", cpu_get_pc(&space.device()), ret);
525   if (LOG_CPU_COMM) logerror(" AUD CPU PC   %04x: audio_command_r %02x\n", space.device().safe_pc(), ret);
526526
527527   /* this is a guess */
528528   audio_cpu_clear_nmi_w(space, 0, 0);
r17788r17789
534534WRITE8_MEMBER(ng_aes_state::audio_result_w)
535535{
536536
537   if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC   %04x: audio_result_w %02x\n", cpu_get_pc(&space.device()), data);
537   if (LOG_CPU_COMM && (m_audio_result != data)) logerror(" AUD CPU PC   %04x: audio_result_w %02x\n", space.device().safe_pc(), data);
538538
539539   m_audio_result = data;
540540}
r17788r17789
545545   neogeo_state *state = field.machine().driver_data<neogeo_state>();
546546   UINT32 ret = state->m_audio_result;
547547
548//  if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field.machine().device("maincpu")), ret);
548//  if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", field.machine(->safe_pc().device("maincpu")), ret);
549549
550550   return ret;
551551}
r17788r17789
588588   UINT32 len = memregion("maincpu")->bytes();
589589
590590   if ((len <= 0x100000) && (data & 0x07))
591      logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", cpu_get_pc(&space.device()), data);
591      logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", space.device().safe_pc(), data);
592592   else
593593   {
594594      bank_address = ((data & 0x07) + 1) * 0x100000;
595595
596596      if (bank_address >= len)
597597      {
598         logerror("PC %06x: warning: bankswitch to empty bank %02x\n", cpu_get_pc(&space.device()), data);
598         logerror("PC %06x: warning: bankswitch to empty bank %02x\n", space.device().safe_pc(), data);
599599         bank_address = 0x100000;
600600      }
601601
r17788r17789
642642{
643643   neogeo_state *state = space->machine().driver_data<neogeo_state>();
644644
645   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);
645   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);
646646
647647   state->m_audio_cpu_banks[region] = bank;
648648
r17788r17789
698698
699699      cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, PULSE_LINE);
700700
701      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");
701      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");
702702   }
703703}
704704
r17788r17789
779779      case 0x02: /* unknown - HC32 middle pin 1 */
780780      case 0x03: /* unknown - uPD4990 pin ? */
781781      case 0x04: /* unknown - HC32 middle pin 10 */
782         logerror("PC: %x  Unmapped system control write.  Offset: %x  Data: %x\n", cpu_get_pc(&space.device()), offset & 0x07, bit);
782         logerror("PC: %x  Unmapped system control write.  Offset: %x  Data: %x\n", space.device().safe_pc(), offset & 0x07, bit);
783783         break;
784784      }
785785
786      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);
786      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);
787787   }
788788}
789789
trunk/src/mess/drivers/gp2x.c
r17788r17789
250250            break;
251251
252252         default:
253            logerror("NAND: read unk command %x (PC %x)\n", m_nand_cmd, cpu_get_pc(m_maincpu));
253            logerror("NAND: read unk command %x (PC %x)\n", m_nand_cmd, m_maincpu->safe_pc());
254254            break;
255255      }
256256   }
r17788r17789
266266   {
267267      case 4:   // command
268268         m_nand_cmd = data;
269//          printf("NAND: command %x (PC %x0)\n", data, cpu_get_pc(m_maincpu));
269//          printf("NAND: command %x (PC %x0)\n", data, m_maincpu->safe_pc());
270270         m_nand_stage = 0;
271271         m_nand_subword_stage = 0;
272272         break;
trunk/src/mess/drivers/pasopia7.c
r17788r17789
615615      return pasopia7_fdc_r(space, offset & 7);
616616   else
617617   {
618      logerror("(PC=%06x) Read i/o address %02x\n",cpu_get_pc(m_maincpu),io_port);
618      logerror("(PC=%06x) Read i/o address %02x\n",m_maincpu->safe_pc(),io_port);
619619   }
620620
621621   return 0xff;
r17788r17789
672672      pasopia7_fdc_w(space, offset & 7, data);
673673   else
674674   {
675      logerror("(PC=%06x) Write i/o address %02x = %02x\n",cpu_get_pc(m_maincpu),offset,data);
675      logerror("(PC=%06x) Write i/o address %02x = %02x\n",m_maincpu->safe_pc(),offset,data);
676676   }
677677}
678678
trunk/src/mess/drivers/esq1.c
r17788r17789
205205   int bank = ((data >> 1) & 0x7);
206206   esq1_state *state = device->machine().driver_data<esq1_state>();
207207//  printf("DP [%02x]: %d mlo %d mhi %d tape %d\n", data, data&1, (data>>4)&1, (data>>5)&1, (data>>6)&3);
208//  printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, cpu_get_pc(device->machine().firstcpu));
208//  printf("[%02x] bank %d => offset %x (PC=%x)\n", data, bank, bank * 0x1000, device->machine().firstcpu->safe_pc());
209209    state->membank("osbank")->set_base(state->memregion("osrom")->base() + (bank * 0x1000) );
210210
211211    state->m_seq_bank = (data & 0x8) ? 0x8000 : 0x0000;
trunk/src/mess/drivers/nc.c
r17788r17789
14261426   }
14271427
14281428   /* bit 5 is used in disk interface */
1429   LOG_DEBUG(("bit 5: PC: %04x %02x\n", cpu_get_pc(machine().device("maincpu")), data & (1 << 5)));
1429   LOG_DEBUG(("bit 5: PC: %04x %02x\n", machine().device("maincpu")->safe_pc(), data & (1 << 5)));
14301430}
14311431
14321432
r17788r17789
14451445WRITE8_MEMBER(nc_state::nc200_memory_card_wait_state_w)
14461446{
14471447   device_t *fdc = machine().device("upd765");
1448   LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", cpu_get_pc(machine().device("maincpu")), data));
1448   LOG_DEBUG(("nc200 memory card wait state: PC: %04x %02x\n", machine().device("maincpu")->safe_pc(), data));
14491449#if 0
14501450   floppy_drive_set_motor_state(0, 1);
14511451   floppy_drive_set_ready_state(0, 1, 1);
r17788r17789
14581458/* bit 0 seems to be the same as nc100 */
14591459WRITE8_MEMBER(nc_state::nc200_poweroff_control_w)
14601460{
1461   LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", cpu_get_pc(machine().device("maincpu")), data));
1461   LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", machine().device("maincpu")->safe_pc(), data));
14621462
14631463   nc200_video_set_backlight(machine(), ((data ^ (1 << 2)) >> 2) & 0x01);
14641464}
trunk/src/mess/drivers/mac.c
r17788r17789
182182{
183183   if (offset == 2)
184184   {
185//        printf("Sonora: read monitor ID at PC=%x\n", cpu_get_pc(m_maincpu));
185//        printf("Sonora: read monitor ID at PC=%x\n", m_maincpu->safe_pc());
186186      return (6 << 4);   // 640x480 RGB monitor
187187   }
188188
r17788r17789
240240      {
241241         data &= ~0x38;
242242         data |= (space.machine().root_device().ioport("MONTYPE")->read_safe(2)<<3);
243//            printf("rbv_r montype: %02x (PC %x)\n", data, cpu_get_pc(space.cpu));
243//            printf("rbv_r montype: %02x (PC %x)\n", data, space.cpu->safe_pc());
244244      }
245245
246246      // bit 7 of these registers always reads as 0 on RBV
r17788r17789
256256      switch (offset)
257257      {
258258         case 13:   // IFR
259//              printf("Read IER = %02x (PC=%x) 2=%02x\n", m_rbv_ier, cpu_get_pc(m_maincpu), m_rbv_regs[2]);
259//              printf("Read IER = %02x (PC=%x) 2=%02x\n", m_rbv_ier, m_maincpu->safe_pc(), m_rbv_regs[2]);
260260            data = m_rbv_ifr;
261261            break;
262262
263263         case 14:   // IER
264//              printf("Read IFR = %02x (PC=%x) 2=%02x\n", m_rbv_ifr, cpu_get_pc(m_maincpu), m_rbv_regs[2]);
264//              printf("Read IFR = %02x (PC=%x) 2=%02x\n", m_rbv_ifr, m_maincpu->safe_pc(), m_rbv_regs[2]);
265265            data = m_rbv_ier;
266266            break;
267267
r17788r17789
271271      }
272272   }
273273
274//  printf("rbv_r: %x = %02x (PC=%x)\n", offset, data, cpu_get_pc(m_maincpu));
274//  printf("rbv_r: %x = %02x (PC=%x)\n", offset, data, m_maincpu->safe_pc());
275275
276276   return data;
277277}
r17788r17789
281281   if (offset < 0x100)
282282   {
283283//      if (offset == 0x10)
284//      printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu));
284//      printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, m_maincpu->safe_pc());
285285      switch (offset)
286286      {
287287         case 0x00:
r17788r17789
364364      switch (offset)
365365      {
366366         case 13:   // IFR
367//              printf("%02x to IFR (PC=%x)\n", data, cpu_get_pc(m_maincpu));
367//              printf("%02x to IFR (PC=%x)\n", data, m_maincpu->safe_pc());
368368            if (data & 0x80)
369369            {
370370               data = 0x7f;
r17788r17789
373373            break;
374374
375375         case 14:   // IER
376//              printf("%02x to IER (PC=%x)\n", data, cpu_get_pc(m_maincpu));
376//              printf("%02x to IER (PC=%x)\n", data, m_maincpu->safe_pc());
377377            if (data & 0x80)   // 1 bits write 1s
378378            {
379379               m_rbv_ier |= data & 0x7f;
r17788r17789
440440
441441READ8_MEMBER(mac_state::scciop_r)
442442{
443//  printf("scciop_r @ %x (PC=%x)\n", offset, cpu_get_pc(m_maincpu));
443//  printf("scciop_r @ %x (PC=%x)\n", offset, m_maincpu->safe_pc());
444444   return 0;
445445}
446446
447447WRITE8_MEMBER(mac_state::scciop_w)
448448{
449//  printf("scciop_w %x @ %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu));
449//  printf("scciop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->safe_pc());
450450}
451451
452452READ8_MEMBER(mac_state::swimiop_r)
453453{
454//  printf("swimiop_r @ %x (PC=%x)\n", offset, cpu_get_pc(m_maincpu));
454//  printf("swimiop_r @ %x (PC=%x)\n", offset, m_maincpu->safe_pc());
455455   return 0;
456456}
457457
458458WRITE8_MEMBER(mac_state::swimiop_w)
459459{
460//  printf("swimiop_w %x @ %x (PC=%x)\n", data, offset, cpu_get_pc(m_maincpu));
460//  printf("swimiop_w %x @ %x (PC=%x)\n", data, offset, m_maincpu->safe_pc());
461461}
462462
463463READ8_MEMBER(mac_state::pmac_diag_r)
r17788r17789
478478
479479WRITE8_MEMBER(mac_state::amic_dma_w)
480480{
481//  printf("amic_dma_w: %02x at %x (PC=%x)\n", data, offset+0x1000, cpu_get_pc(m_maincpu));
481//  printf("amic_dma_w: %02x at %x (PC=%x)\n", data, offset+0x1000, m_maincpu->safe_pc());
482482}
483483
484484// 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)
trunk/src/mess/drivers/sgi_ip2.c
r17788r17789
117117      va_start( v, s_fmt );
118118      vsprintf( buf, s_fmt, v );
119119      va_end( v );
120      logerror("%08x: %s", cpu_get_pc(machine.device("maincpu")), buf);
120      logerror("%08x: %s", machine.device("maincpu")->safe_pc(), buf);
121121   }
122122}
123123#else
trunk/src/mess/drivers/cxhumax.c
r17788r17789
150150   UINT32 data = m_scratch_reg;
151151   verboselog( machine(), 9, "(SCRATCH) %08X -> %08X\n", 0xE0400024 + (offset << 2), data);
152152
153   if((cpu_get_pc(m_maincpu)==0xF0003BB8) || (cpu_get_pc(m_maincpu)==0x01003724) || (cpu_get_pc(m_maincpu)==0x00005d8c)) { // HDCI-2000
153   if((m_maincpu->safe_pc()==0xF0003BB8) || (m_maincpu->safe_pc()==0x01003724) || (m_maincpu->safe_pc()==0x00005d8c)) { // HDCI-2000
154154      //we're in disabled debug_printf
155155      unsigned char* buf = (unsigned char *)alloca(200);
156156      unsigned char temp;
trunk/src/mess/drivers/next.c
r17788r17789
7979READ8_MEMBER( next_state::io_r )
8080{
8181   if(!space.debugger_access())
82      printf("io_r %08x (%08x)\n",offset+0x02000000, cpu_get_pc(&space.device()));
82      printf("io_r %08x (%08x)\n",offset+0x02000000, space.device().safe_pc());
8383
8484   if(offset == 0xc0)
8585      return 0;
r17788r17789
9090WRITE8_MEMBER( next_state::io_w )
9191{
9292   if(!space.debugger_access())
93      printf("io_w %08x, %02x (%08x)\n",offset+0x02000000,data, cpu_get_pc(&space.device()));
93      printf("io_w %08x, %02x (%08x)\n",offset+0x02000000,data, space.device().safe_pc());
9494}
9595
9696/* map ROM at 0x01000000-0x0101ffff? */
9797READ32_MEMBER( next_state::rom_map_r )
9898{
9999   if(0 && !space.debugger_access())
100      printf("%08x ROM MAP?\n",cpu_get_pc(&space.device()));
100      printf("%08x ROM MAP?\n",space.device().safe_pc());
101101   return 0x01000000;
102102}
103103
104104READ32_MEMBER( next_state::scr2_r )
105105{
106106   if(0 && !space.debugger_access())
107      printf("%08x\n",cpu_get_pc(&space.device()));
107      printf("%08x\n",space.device().safe_pc());
108108   /*
109109    x--- ---- ---- ---- ---- ---- ---- ---- dsp reset
110110    -x-- ---- ---- ---- ---- ---- ---- ---- dsp block end
r17788r17789
141141WRITE32_MEMBER( next_state::scr2_w )
142142{
143143   if(0 && !space.debugger_access())
144      printf("scr2_w %08x (%08x)\n", data, cpu_get_pc(&space.device()));
144      printf("scr2_w %08x (%08x)\n", data, space.device().safe_pc());
145145   COMBINE_DATA(&scr2);
146146
147147   rtc->ce_w(BIT(scr2, 8));
r17788r17789
456456   }
457457
458458   const char *name = dma_name(slot);
459   logerror("dma_regs_r %s:%d %08x (%08x)\n", name, reg, res, cpu_get_pc(&space.device()));
459   logerror("dma_regs_r %s:%d %08x (%08x)\n", name, reg, res, space.device().safe_pc());
460460
461461   return res;
462462}
r17788r17789
468468
469469   const char *name = dma_name(slot);
470470
471   logerror("dma_regs_w %s:%d %08x (%08x)\n", name, reg, data, cpu_get_pc(&space.device()));
471   logerror("dma_regs_w %s:%d %08x (%08x)\n", name, reg, data, space.device().safe_pc());
472472   switch(reg) {
473473   case 0:
474474      dma_slots[slot].start = data;
r17788r17789
493493
494494   const char *name = dma_name(slot);
495495
496   if(cpu_get_pc(&space.device()) != 0x409bb4e)
497      logerror("dma_ctrl_r %s:%d %02x (%08x)\n", name, reg, dma_slots[slot].state, cpu_get_pc(&space.device()));
496   if(space.device().safe_pc() != 0x409bb4e)
497      logerror("dma_ctrl_r %s:%d %02x (%08x)\n", name, reg, dma_slots[slot].state, space.device().safe_pc());
498498
499499   return reg ? 0 : dma_slots[slot].state << 24;
500500}
r17788r17789
504504   int slot = offset >> 2;
505505   int reg = offset & 3;
506506   const char *name = dma_name(slot);
507   logerror("dma_ctrl_w %s:%d %08x @ %08x (%08x)\n", name, reg, data, mem_mask, cpu_get_pc(&space.device()));
507   logerror("dma_ctrl_w %s:%d %08x @ %08x (%08x)\n", name, reg, data, mem_mask, space.device().safe_pc());
508508   if(!reg) {
509509      if(ACCESSING_BITS_16_23)
510510         dma_do_ctrl_w(slot, data >> 16);
r17788r17789
517517{
518518   const char *name = dma_name(slot);
519519#if 0
520   fprintf(stderr, "dma_ctrl_w %s %02x (%08x)\n", name, data, cpu_get_pc(maincpu));
520   fprintf(stderr, "dma_ctrl_w %s %02x (%08x)\n", name, data, maincpu->safe_pc());
521521
522522   fprintf(stderr, "  ->%s%s%s%s%s%s%s\n",
523523         data & DMA_SETENABLE ? " enable" : "",
r17788r17789
529529         data & DMA_INITBUFTURBO ? " initbufturbo" : "");
530530#endif
531531   if(data & DMA_SETENABLE)
532      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));
532      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());
533533
534534   dma_slot &ds = dma_slots[slot];
535535   if(data & (DMA_RESET|DMA_INITBUF|DMA_INITBUFTURBO)) {
r17788r17789
561561READ32_MEMBER( next_state::scsictrl_r )
562562{
563563   UINT32 res = (scsictrl << 24) | (scsistat << 16);
564   logerror("scsictrl_read %08x @ %08x (%08x)\n", res, mem_mask, cpu_get_pc(&space.device()));
564   logerror("scsictrl_read %08x @ %08x (%08x)\n", res, mem_mask, space.device().safe_pc());
565565   return res;
566566}
567567
r17788r17789
581581            scsictrl & 0x04 ? " flush" : "",
582582            scsictrl & 0x02 ? " reset" : "",
583583            scsictrl & 0x01 ? "wd3392" : "ncr5390",
584            cpu_get_pc(&space.device()));
584            space.device().safe_pc());
585585   }
586586   if(ACCESSING_BITS_16_23) {
587587      scsistat = data >> 16;
588      logerror("SCSIstat %02x (%08x)\n", data, cpu_get_pc(&space.device()));
588      logerror("SCSIstat %02x (%08x)\n", data, space.device().safe_pc());
589589   }
590590}
591591
r17788r17789
608608
609609WRITE32_MEMBER( next_state::fdc_control_w )
610610{
611   logerror("FDC write %02x (%08x)\n", data >> 24, cpu_get_pc(&space.device()));
611   logerror("FDC write %02x (%08x)\n", data >> 24, space.device().safe_pc());
612612}
613613
614614READ32_MEMBER( next_state::fdc_control_r )
r17788r17789
647647
648648READ32_MEMBER( next_state::phy_r )
649649{
650   logerror("phy_r %d %08x (%08x)\n", offset, phy[offset], cpu_get_pc(&space.device()));
650   logerror("phy_r %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc());
651651   return phy[offset] | (0 << 24);
652652}
653653
654654WRITE32_MEMBER( next_state::phy_w )
655655{
656656   COMBINE_DATA(phy+offset);
657   logerror("phy_w %d %08x (%08x)\n", offset, phy[offset], cpu_get_pc(&space.device()));
657   logerror("phy_w %d %08x (%08x)\n", offset, phy[offset], space.device().safe_pc());
658658}
659659
660660void next_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
trunk/src/mess/drivers/apollo.c
r17788r17789
129129      int s = t / osd_ticks_per_second();
130130      int ms = (t % osd_ticks_per_second()) / 1000;
131131
132      sprintf(statebuf, "%d.%03d %s pc=%08x", s, ms, cpu->tag(), cpu_get_previouspc(cpu));
132      sprintf(statebuf, "%d.%03d %s pc=%08x", s, ms, cpu->tag(), cpu->safe_pcbase());
133133   } else {
134134      strcpy(statebuf, "(no context)");
135135   }
r17788r17789
551551WRITE32_MEMBER(apollo_state::apollo_rom_w)
552552{
553553   offs_t address =  offset * 4;
554   offs_t pc = cpu_get_previouspc(&space.device());
554   offs_t pc = space.device().safe_pcbase();
555555
556556   if (pc == 0x00002c1c && address == 0x00000004 && VERBOSE < 2) {
557557      // don't log invalid code in 3500_boot_12191_7.bin
trunk/src/mess/drivers/dc.c
r17788r17789
4444
4545static READ64_HANDLER( dcus_idle_skip_r )
4646{
47   if (cpu_get_pc(&space->device())==0xc0ba52a)
47   if (space->device().safe_pc()==0xc0ba52a)
4848      device_spin_until_time(&space->device(), attotime::from_usec(2500));
4949   //  device_spinuntil_int(&space->device());
5050
r17788r17789
5353
5454static READ64_HANDLER( dcjp_idle_skip_r )
5555{
56   if (cpu_get_pc(&space->device())==0xc0bac62)
56   if (space->device().safe_pc()==0xc0bac62)
5757      device_spin_until_time(&space->device(), attotime::from_usec(2500));
5858   //  device_spinuntil_int(&space->device());
5959
trunk/src/mess/drivers/rvoice.c
r17788r17789
132132READ8_MEMBER(rvoice_state::main_hd63701_internal_registers_r)
133133{
134134   UINT8 data = 0;
135   logerror("main hd637B01Y0: %04x: read from 0x%02X: ", cpu_get_pc(&space.device()), offset);
135   logerror("main hd637B01Y0: %04x: read from 0x%02X: ", space.device().safe_pc(), offset);
136136   switch(offset)
137137   {
138138      case 0x00: // Port 1 DDR
r17788r17789
214214
215215WRITE8_MEMBER(rvoice_state::main_hd63701_internal_registers_w)
216216{
217   logerror("main hd637B01Y0: %04x: write to 0x%02X: ", cpu_get_pc(&space.device()), offset);
217   logerror("main hd637B01Y0: %04x: write to 0x%02X: ", space.device().safe_pc(), offset);
218218   switch(offset)
219219   {
220220      case 0x00: // Port 1 DDR
trunk/src/mess/drivers/pasogo.c
r17788r17789
177177      }
178178
179179      if (log)
180         logerror("%.5x vg230 %02x read %.2x\n",(int) cpu_get_pc(m_maincpu),vg230->index,data);
180         logerror("%.5x vg230 %02x read %.2x\n",(int) m_maincpu->safe_pc(),vg230->index,data);
181181      //    data=machine.root_device().memregion("maincpu")->base()[0x4000+offset];
182182   }
183183   else
r17788r17789
221221      }
222222
223223      if (log)
224         logerror("%.5x vg230 %02x write %.2x\n",(int)cpu_get_pc(m_maincpu),vg230->index,data);
224         logerror("%.5x vg230 %02x write %.2x\n",(int)m_maincpu->safe_pc(),vg230->index,data);
225225   }
226226   else
227227      vg230->index=data;
r17788r17789
288288      ems->mapper[ems->index].address=(ems->mapper[ems->index].data[0]<<14)|((ems->mapper[ems->index].data[1]&0xf)<<22);
289289      ems->mapper[ems->index].on=ems->mapper[ems->index].data[1]&0x80;
290290      ems->mapper[ems->index].type=(ems->mapper[ems->index].data[1]&0x70)>>4;
291      logerror("%.5x ems mapper %d(%05x)on:%d type:%d address:%07x\n",(int)cpu_get_pc(m_maincpu),ems->index, ems->data<<12,
291      logerror("%.5x ems mapper %d(%05x)on:%d type:%d address:%07x\n",(int)m_maincpu->safe_pc(),ems->index, ems->data<<12,
292292         ems->mapper[ems->index].on, ems->mapper[ems->index].type, ems->mapper[ems->index].address );
293293
294294      switch (ems->mapper[ems->index].type)
trunk/src/mess/drivers/x68k.c
r17788r17789
10391039      logerror("FDC: Drive #%i: Drive selection set to %02x\n",data & 0x03,data);
10401040      break;
10411041   default:
1042//      logerror("FDC: [%08x] Wrote %04x to invalid FDC port %04x\n",cpu_get_pc(&space->device()),data,offset);
1042//      logerror("FDC: [%08x] Wrote %04x to invalid FDC port %04x\n",space->device().safe_pc(),data,offset);
10431043      break;
10441044   }
10451045}
r17788r17789
12551255      state->m_sysport.sram_writeprotect = data;
12561256      break;
12571257   default:
1258//      logerror("SYS: [%08x] Wrote %04x to invalid or unimplemented system port %04x\n",cpu_get_pc(&space->device()),data,offset);
1258//      logerror("SYS: [%08x] Wrote %04x to invalid or unimplemented system port %04x\n",space->device().safe_pc(),data,offset);
12591259      break;
12601260   }
12611261}
r17788r17789
12961296
12971297   // Initial settings indicate that IRQs are generated for FM (YM2151), Receive buffer error or full,
12981298    // MFP Timer C, and the power switch
1299//  logerror("MFP: [%08x] Reading offset %i\n",cpu_get_pc(&space->device()),offset);
1299//  logerror("MFP: [%08x] Reading offset %i\n",space->device().safe_pc(),offset);
13001300    switch(offset)
13011301    {
13021302#if 0
r17788r17789
13101310//          ret |= 0x08;  // FM IRQ signal
13111311        if(machine.primary_screen->hpos() > state->m_crtc.width - 32)
13121312            ret |= 0x80;  // Hsync signal
1313//      logerror("MFP: [%08x] Reading offset %i (ret=%02x)\n",cpu_get_pc(&space->device()),offset,ret);
1313//      logerror("MFP: [%08x] Reading offset %i (ret=%02x)\n",space->device().safe_pc(),offset,ret);
13141314        return ret;  // bit 5 is always 1
13151315    case 3:
13161316        return state->m_mfp.iera;
r17788r17789
14771477         // Keyboard control command.
14781478         state->m_mfp.usart.send_buffer = data;
14791479         x68k_keyboard_ctrl_w(state, data);
1480//          logerror("MFP: [%08x] USART Sent data %04x\n",cpu_get_pc(&space->device()),data);
1480//          logerror("MFP: [%08x] USART Sent data %04x\n",space->device().safe_pc(),data);
14811481      }
14821482      break;
14831483   default:
trunk/src/mess/drivers/socrates.c
r17788r17789
268268
269269WRITE8_MEMBER(socrates_state::kbmcu_strobe) // strobe the keyboard MCU
270270{
271   //logerror("0x%04X: kbmcu written with %02X!\n", cpu_get_pc(m_maincpu), data); //if (cpu_get_pc(m_maincpu) != 0x31D)
271   //logerror("0x%04X: kbmcu written with %02X!\n", m_maincpu->safe_pc(), data); //if (m_maincpu->safe_pc() != 0x31D)
272272   // if two writes happen within one frame, reset the keyboard latches
273273   m_kbmcu_rscount++;
274274   if (m_kbmcu_rscount > 1)
trunk/src/mess/drivers/pc8801.c
r17788r17789
18871887
18881888READ8_MEMBER(pc8801_state::upd765_tc_r)
18891889{
1890   //printf("%04x 1\n",cpu_get_pc(m_fdccpu));
1890   //printf("%04x 1\n",m_fdccpu->safe_pc());
18911891
18921892   upd765_tc_w(machine().device("upd765"), 1);
18931893    //TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha.
trunk/src/mess/drivers/gp32.c
r17788r17789
314314      }
315315      break;
316316   }
317   verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, cpu_get_pc( &space.device()));
317   verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( ));
318318   return data;
319319}
320320
r17788r17789
378378WRITE32_MEMBER(gp32_state::s3c240x_lcd_w)
379379{
380380   UINT32 old_value = m_s3c240x_lcd_regs[offset];
381   verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, cpu_get_pc( &space.device()));
381   verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00000 + (offset << 2), data, space.device().safe_pc( ));
382382   COMBINE_DATA(&m_s3c240x_lcd_regs[offset]);
383383   switch (offset)
384384   {
r17788r17789
400400READ32_MEMBER(gp32_state::s3c240x_lcd_palette_r)
401401{
402402   UINT32 data = m_s3c240x_lcd_palette[offset];
403   verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, cpu_get_pc( &space.device()));
403   verboselog( machine(), 9, "(LCD) %08X -> %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( ));
404404   return data;
405405}
406406
407407WRITE32_MEMBER(gp32_state::s3c240x_lcd_palette_w)
408408{
409   verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, cpu_get_pc( &space.device()));
409   verboselog( machine(), 9, "(LCD) %08X <- %08X (PC %08X)\n", 0x14A00400 + (offset << 2), data, space.device().safe_pc( ));
410410   COMBINE_DATA(&m_s3c240x_lcd_palette[offset]);
411411   if (mem_mask != 0xffffffff)
412412   {
r17788r17789
455455READ32_MEMBER(gp32_state::s3c240x_clkpow_r)
456456{
457457   UINT32 data = m_s3c240x_clkpow_regs[offset];
458   verboselog( machine(), 9, "(CLKPOW) %08X -> %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, cpu_get_pc( &space.device()));
458   verboselog( machine(), 9, "(CLKPOW) %08X -> %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( ));
459459   return data;
460460}
461461
462462WRITE32_MEMBER(gp32_state::s3c240x_clkpow_w)
463463{
464   verboselog( machine(), 9, "(CLKPOW) %08X <- %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, cpu_get_pc( &space.device()));
464   verboselog( machine(), 9, "(CLKPOW) %08X <- %08X (PC %08X)\n", 0x14800000 + (offset << 2), data, space.device().safe_pc( ));
465465   COMBINE_DATA(&m_s3c240x_clkpow_regs[offset]);
466466   switch (offset)
467467   {
r17788r17789
522522READ32_MEMBER(gp32_state::s3c240x_irq_r)
523523{
524524   UINT32 data = m_s3c240x_irq_regs[offset];
525   verboselog( machine(), 9, "(IRQ) %08X -> %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, cpu_get_pc( &space.device()));
525   verboselog( machine(), 9, "(IRQ) %08X -> %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( ));
526526   return data;
527527}
528528
529529WRITE32_MEMBER(gp32_state::s3c240x_irq_w)
530530{
531531   UINT32 old_value = m_s3c240x_irq_regs[offset];
532   verboselog( machine(), 9, "(IRQ) %08X <- %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, cpu_get_pc( &space.device()));
532   verboselog( machine(), 9, "(IRQ) %08X <- %08X (PC %08X)\n", 0x14400000 + (offset << 2), data, space.device().safe_pc( ));
533533   COMBINE_DATA(&m_s3c240x_irq_regs[offset]);
534534   switch (offset)
535535   {
r17788r17789
579579READ32_MEMBER(gp32_state::s3c240x_pwm_r)
580580{
581581   UINT32 data = m_s3c240x_pwm_regs[offset];
582   verboselog( machine(), 9, "(PWM) %08X -> %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, cpu_get_pc( &space.device()));
582   verboselog( machine(), 9, "(PWM) %08X -> %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( ));
583583   return data;
584584}
585585
r17788r17789
644644WRITE32_MEMBER(gp32_state::s3c240x_pwm_w)
645645{
646646   UINT32 old_value = m_s3c240x_pwm_regs[offset];
647   verboselog( machine(), 9, "(PWM) %08X <- %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, cpu_get_pc( &space.device()));
647   verboselog( machine(), 9, "(PWM) %08X <- %08X (PC %08X)\n", 0x15100000 + (offset << 2), data, space.device().safe_pc( ));
648648   COMBINE_DATA(&m_s3c240x_pwm_regs[offset]);
649649   switch (offset)
650650   {
r17788r17789
839839READ32_MEMBER(gp32_state::s3c240x_dma_r)
840840{
841841   UINT32 data = m_s3c240x_dma_regs[offset];
842   verboselog( machine(), 9, "(DMA) %08X -> %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, cpu_get_pc( &space.device()));
842   verboselog( machine(), 9, "(DMA) %08X -> %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( ));
843843   return data;
844844}
845845
846846WRITE32_MEMBER(gp32_state::s3c240x_dma_w)
847847{
848848   UINT32 old_value = m_s3c240x_dma_regs[offset];
849   verboselog( machine(), 9, "(DMA) %08X <- %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, cpu_get_pc( &space.device()));
849   verboselog( machine(), 9, "(DMA) %08X <- %08X (PC %08X)\n", 0x14600000 + (offset << 2), data, space.device().safe_pc( ));
850850   COMBINE_DATA(&m_s3c240x_dma_regs[offset]);
851851   switch (offset)
852852   {
r17788r17789
11031103      }
11041104      break;
11051105   }
1106   verboselog( machine(), 9, "(GPIO) %08X -> %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, cpu_get_pc( &space.device()));
1106   verboselog( machine(), 9, "(GPIO) %08X -> %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( ));
11071107   return data;
11081108}
11091109
11101110WRITE32_MEMBER(gp32_state::s3c240x_gpio_w)
11111111{
11121112   COMBINE_DATA(&m_s3c240x_gpio[offset]);
1113   verboselog( machine(), 9, "(GPIO) %08X <- %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, cpu_get_pc( &space.device()));
1113   verboselog( machine(), 9, "(GPIO) %08X <- %08X (PC %08X)\n", 0x15600000 + (offset << 2), data, space.device().safe_pc( ));
11141114   switch (offset)
11151115   {
11161116      // PBCON
r17788r17789
11701170READ32_MEMBER(gp32_state::s3c240x_memcon_r)
11711171{
11721172   UINT32 data = m_s3c240x_memcon_regs[offset];
1173   verboselog( machine(), 9, "(MEMCON) %08X -> %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, cpu_get_pc( &space.device()));
1173   verboselog( machine(), 9, "(MEMCON) %08X -> %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( ));
11741174   return data;
11751175}
11761176
11771177WRITE32_MEMBER(gp32_state::s3c240x_memcon_w)
11781178{
1179   verboselog( machine(), 9, "(MEMCON) %08X <- %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, cpu_get_pc( &space.device()));
1179   verboselog( machine(), 9, "(MEMCON) %08X <- %08X (PC %08X)\n", 0x14000000 + (offset << 2), data, space.device().safe_pc( ));
11801180   COMBINE_DATA(&m_s3c240x_memcon_regs[offset]);
11811181}
11821182
r17788r17789
11861186READ32_MEMBER(gp32_state::s3c240x_usb_host_r)
11871187{
11881188   UINT32 data = m_s3c240x_usb_host_regs[offset];
1189   verboselog( machine(), 9, "(USB H) %08X -> %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, cpu_get_pc( &space.device()));
1189   verboselog( machine(), 9, "(USB H) %08X -> %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( ));
11901190   return data;
11911191}
11921192
11931193WRITE32_MEMBER(gp32_state::s3c240x_usb_host_w)
11941194{
1195   verboselog( machine(), 9, "(USB H) %08X <- %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, cpu_get_pc( &space.device()));
1195   verboselog( machine(), 9, "(USB H) %08X <- %08X (PC %08X)\n", 0x14200000 + (offset << 2), data, space.device().safe_pc( ));
11961196   COMBINE_DATA(&m_s3c240x_usb_host_regs[offset]);
11971197}
11981198
r17788r17789
12111211      }
12121212      break;
12131213   }
1214   verboselog( machine(), 9, "(UART 0) %08X -> %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, cpu_get_pc( &space.device()));
1214   verboselog( machine(), 9, "(UART 0) %08X -> %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( ));
12151215   return data;
12161216}
12171217
12181218WRITE32_MEMBER(gp32_state::s3c240x_uart_0_w)
12191219{
1220   verboselog( machine(), 9, "(UART 0) %08X <- %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, cpu_get_pc( &space.device()));
1220   verboselog( machine(), 9, "(UART 0) %08X <- %08X (PC %08X)\n", 0x15000000 + (offset << 2), data, space.device().safe_pc( ));
12211221   COMBINE_DATA(&m_s3c240x_uart_0_regs[offset]);
12221222}
12231223
r17788r17789
12361236      }
12371237      break;
12381238   }
1239   verboselog( machine(), 9, "(UART 1) %08X -> %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, cpu_get_pc( &space.device()));
1239   verboselog( machine(), 9, "(UART 1) %08X -> %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( ));
12401240   return data;
12411241}
12421242
12431243WRITE32_MEMBER(gp32_state::s3c240x_uart_1_w)
12441244{
1245   verboselog( machine(), 9, "(UART 1) %08X <- %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, cpu_get_pc( &space.device()));
1245   verboselog( machine(), 9, "(UART 1) %08X <- %08X (PC %08X)\n", 0x15004000 + (offset << 2), data, space.device().safe_pc( ));
12461246   COMBINE_DATA(&m_s3c240x_uart_1_regs[offset]);
12471247}
12481248
r17788r17789
12521252READ32_MEMBER(gp32_state::s3c240x_usb_device_r)
12531253{
12541254   UINT32 data = m_s3c240x_usb_device_regs[offset];
1255   verboselog( machine(), 9, "(USB D) %08X -> %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, cpu_get_pc( &space.device()));
1255   verboselog( machine(), 9, "(USB D) %08X -> %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( ));
12561256   return data;
12571257}
12581258
12591259WRITE32_MEMBER(gp32_state::s3c240x_usb_device_w)
12601260{
1261   verboselog( machine(), 9, "(USB D) %08X <- %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, cpu_get_pc( &space.device()));
1261   verboselog( machine(), 9, "(USB D) %08X <- %08X (PC %08X)\n", 0x15200140 + (offset << 2), data, space.device().safe_pc( ));
12621262   COMBINE_DATA(&m_s3c240x_usb_device_regs[offset]);
12631263}
12641264
r17788r17789
12681268READ32_MEMBER(gp32_state::s3c240x_watchdog_r)
12691269{
12701270   UINT32 data = m_s3c240x_watchdog_regs[offset];
1271   verboselog( machine(), 9, "(WDOG) %08X -> %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, cpu_get_pc( &space.device()));
1271   verboselog( machine(), 9, "(WDOG) %08X -> %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( ));
12721272   return data;
12731273}
12741274
12751275WRITE32_MEMBER(gp32_state::s3c240x_watchdog_w)
12761276{
1277   verboselog( machine(), 9, "(WDOG) %08X <- %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, cpu_get_pc( &space.device()));
1277   verboselog( machine(), 9, "(WDOG) %08X <- %08X (PC %08X)\n", 0x15300000 + (offset << 2), data, space.device().safe_pc( ));
12781278   COMBINE_DATA(&m_s3c240x_watchdog_regs[offset]);
12791279}
12801280
r17788r17789
13881388      }
13891389      break;
13901390   }
1391   verboselog( machine(), 9, "(IIC) %08X -> %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, cpu_get_pc( &space.device()));
1391   verboselog( machine(), 9, "(IIC) %08X -> %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( ));
13921392   return data;
13931393}
13941394
13951395WRITE32_MEMBER(gp32_state::s3c240x_iic_w)
13961396{
1397   verboselog( machine(), 9, "(IIC) %08X <- %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, cpu_get_pc( &space.device()));
1397   verboselog( machine(), 9, "(IIC) %08X <- %08X (PC %08X)\n", 0x15400000 + (offset << 2), data, space.device().safe_pc( ));
13981398   COMBINE_DATA(&m_s3c240x_iic_regs[offset]);
13991399   switch (offset)
14001400   {
r17788r17789
15421542      break;
15431543   }
15441544#endif
1545   verboselog( machine(), 9, "(IIS) %08X -> %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, cpu_get_pc( &space.device()));
1545   verboselog( machine(), 9, "(IIS) %08X -> %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( ));
15461546   return data;
15471547}
15481548
15491549WRITE32_MEMBER(gp32_state::s3c240x_iis_w)
15501550{
15511551   UINT32 old_value = m_s3c240x_iis_regs[offset];
1552   verboselog( machine(), 9, "(IIS) %08X <- %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, cpu_get_pc( &space.device()));
1552   verboselog( machine(), 9, "(IIS) %08X <- %08X (PC %08X)\n", 0x15508000 + (offset << 2), data, space.device().safe_pc( ));
15531553   COMBINE_DATA(&m_s3c240x_iis_regs[offset]);
15541554   switch (offset)
15551555   {
r17788r17789
15961596READ32_MEMBER(gp32_state::s3c240x_rtc_r)
15971597{
15981598   UINT32 data = m_s3c240x_rtc_regs[offset];
1599   verboselog( machine(), 9, "(RTC) %08X -> %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, cpu_get_pc( &space.device()));
1599   verboselog( machine(), 9, "(RTC) %08X -> %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( ));
16001600   return data;
16011601}
16021602
16031603WRITE32_MEMBER(gp32_state::s3c240x_rtc_w)
16041604{
1605   verboselog( machine(), 9, "(RTC) %08X <- %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, cpu_get_pc( &space.device()));
1605   verboselog( machine(), 9, "(RTC) %08X <- %08X (PC %08X)\n", 0x15700040 + (offset << 2), data, space.device().safe_pc( ));
16061606   COMBINE_DATA(&m_s3c240x_rtc_regs[offset]);
16071607}
16081608
r17788r17789
16121612READ32_MEMBER(gp32_state::s3c240x_adc_r)
16131613{
16141614   UINT32 data = m_s3c240x_adc_regs[offset];
1615   verboselog( machine(), 9, "(ADC) %08X -> %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, cpu_get_pc( &space.device()));
1615   verboselog( machine(), 9, "(ADC) %08X -> %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( ));
16161616   return data;
16171617}
16181618
16191619WRITE32_MEMBER(gp32_state::s3c240x_adc_w)
16201620{
1621   verboselog( machine(), 9, "(ADC) %08X <- %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, cpu_get_pc( &space.device()));
1621   verboselog( machine(), 9, "(ADC) %08X <- %08X (PC %08X)\n", 0x15800000 + (offset << 2), data, space.device().safe_pc( ));
16221622   COMBINE_DATA(&m_s3c240x_adc_regs[offset]);
16231623}
16241624
r17788r17789
16281628READ32_MEMBER(gp32_state::s3c240x_spi_r)
16291629{
16301630   UINT32 data = m_s3c240x_spi_regs[offset];
1631   verboselog( machine(), 9, "(SPI) %08X -> %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, cpu_get_pc( &space.device()));
1631   verboselog( machine(), 9, "(SPI) %08X -> %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( ));
16321632   return data;
16331633}
16341634
16351635WRITE32_MEMBER(gp32_state::s3c240x_spi_w)
16361636{
1637   verboselog( machine(), 9, "(SPI) %08X <- %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, cpu_get_pc( &space.device()));
1637   verboselog( machine(), 9, "(SPI) %08X <- %08X (PC %08X)\n", 0x15900000 + (offset << 2), data, space.device().safe_pc( ));
16381638   COMBINE_DATA(&m_s3c240x_spi_regs[offset]);
16391639}
16401640
r17788r17789
16441644READ32_MEMBER(gp32_state::s3c240x_mmc_r)
16451645{
16461646   UINT32 data = m_s3c240x_mmc_regs[offset];
1647   verboselog( machine(), 9, "(MMC) %08X -> %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, cpu_get_pc( &space.device()));
1647   verboselog( machine(), 9, "(MMC) %08X -> %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( ));
16481648   return data;
16491649}
16501650
16511651WRITE32_MEMBER(gp32_state::s3c240x_mmc_w)
16521652{
1653   verboselog( machine(), 9, "(MMC) %08X <- %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, cpu_get_pc( &space.device()));
1653   verboselog( machine(), 9, "(MMC) %08X <- %08X (PC %08X)\n", 0x15A00000 + (offset << 2), data, space.device().safe_pc( ));
16541654   COMBINE_DATA(&m_s3c240x_mmc_regs[offset]);
16551655}
16561656
trunk/src/mess/drivers/supracan.c
r17788r17789
212212      va_start( v, s_fmt );
213213      vsprintf( buf, s_fmt, v );
214214      va_end( v );
215      logerror( "%06x: %s: %s", cpu_get_pc(machine.device(tag)), tag, buf );
215      logerror( "%06x: %s: %s", machine.device(tag)->safe_pc(), tag, buf );
216216   }
217217}
218218
trunk/src/mess/drivers/craft.c
r17788r17789
2424      va_start( v, s_fmt );
2525      vsprintf( buf, s_fmt, v );
2626      va_end( v );
27      logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
27      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
2828   }
2929}
3030#else
trunk/src/mess/drivers/bebox.c
r17788r17789
7979   pci_bus_device *device = space->machine().device<pci_bus_device>("pcibus");
8080
8181   // 2e94 is the real address, 2e84 is where the PC appears to be under full DRC
82   if ((cpu_get_pc(&space->device()) == 0xfff02e94) || (cpu_get_pc(&space->device()) == 0xfff02e84))
82   if ((space->device().safe_pc() == 0xfff02e94) || (space->device().safe_pc() == 0xfff02e84))
8383   {
8484      return 0x108000ff;   // indicate slave CPU
8585   }
trunk/src/mess/drivers/vk100.c
r17788r17789
561561{
562562   UINT8 dipswitchLUT[8] = { 1,3,5,7,6,4,2,0 }; // the dipswitches map in a weird order to offsets
563563#ifdef SYSTAT_A_VERBOSE
564   if (cpu_get_pc(m_maincpu) != 0x31D) logerror("0x%04X: SYSTAT_A Read!\n", cpu_get_pc(m_maincpu));
564   if (m_maincpu->safe_pc() != 0x31D) logerror("0x%04X: SYSTAT_A Read!\n", m_maincpu->safe_pc());
565565#endif
566566   return ((m_vgGO?0:1)<<7)|(vram_read(machine())<<3)|(((ioport("SWITCHES")->read()>>dipswitchLUT[offset])&1)?0x4:0)|(m_vsync?0x2:0);
567567}
r17788r17789
585585READ8_MEMBER(vk100_state::SYSTAT_B)
586586{
587587#ifdef SYSTAT_B_VERBOSE
588   logerror("0x%04X: SYSTAT_B Read!\n", cpu_get_pc(m_maincpu));
588   logerror("0x%04X: SYSTAT_B Read!\n", m_maincpu->safe_pc());
589589#endif
590590   return (m_ACTS<<7)|0x7F;
591591}
trunk/src/mess/drivers/esq5505.c
r17788r17789
136136
137137READ16_MEMBER(esq5505_state::es5510_dsp_r)
138138{
139//  logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(&space->device()),offset,es5510_dsp_ram[offset]);
139//  logerror("%06x: DSP read offset %04x (data is %04x)\n",space->device().safe_pc(),offset,es5510_dsp_ram[offset]);
140140
141141   switch(offset)
142142   {
r17788r17789
299299        floppy->ss_w((data & 2)>>1);
300300    }
301301
302//    printf("DUART output: %02x (PC=%x)\n", data, cpu_get_pc(state->m_maincpu));
302//    printf("DUART output: %02x (PC=%x)\n", data, state->m_maincpu->safe_pc());
303303}
304304
305305static void duart_tx(device_t *device, int channel, UINT8 data)
r17788r17789
308308
309309    if (channel == 1)
310310    {
311//        printf("ch %d: [%02x] (PC=%x)\n", channel, data, cpu_get_pc(state->m_maincpu));
311//        printf("ch %d: [%02x] (PC=%x)\n", channel, data, state->m_maincpu->safe_pc());
312312        switch (state->m_system_type)
313313        {
314314            case GENERIC:
trunk/src/mess/drivers/scv.c
r17788r17789
290290
291291WRITE8_MEMBER( scv_state::scv_portc_w )
292292{
293   //logerror("%04x: scv_portc_w: data = 0x%02x\n", cpu_get_pc(machine().device("maincpu")), data );
293   //logerror("%04x: scv_portc_w: data = 0x%02x\n", machine().device("maincpu")->safe_pc(), data );
294294   m_portc = data;
295295
296296   scv_set_banks( machine() );
trunk/src/mess/drivers/ip20.c
r17788r17789
7474      va_start( v, s_fmt );
7575      vsprintf( buf, s_fmt, v );
7676      va_end( v );
77      logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
77      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
7878   }
7979}
8080
r17788r17789
443443// INT/INT2/INT3 interrupt controllers
444444READ32_MEMBER(ip20_state::int_r)
445445{
446   mame_printf_info("INT: read @ ofs %x (mask %x) (PC=%x)\n", offset, mem_mask, cpu_get_pc(&space.device()));
446   mame_printf_info("INT: read @ ofs %x (mask %x) (PC=%x)\n", offset, mem_mask, space.device().safe_pc());
447447   return 0;
448448}
449449
450450WRITE32_MEMBER(ip20_state::int_w)
451451{
452   mame_printf_info("INT: write %x to ofs %x (mask %x) (PC=%x)\n", data, offset, mem_mask, cpu_get_pc(&space.device()));
452   mame_printf_info("INT: write %x to ofs %x (mask %x) (PC=%x)\n", data, offset, mem_mask, space.device().safe_pc());
453453}
454454
455455static ADDRESS_MAP_START( ip204415_map, AS_PROGRAM, 32, ip20_state )
trunk/src/mess/drivers/gba.c
r17788r17789
3535      va_start( v, s_fmt );
3636      vsprintf( buf, s_fmt, v );
3737      va_end( v );
38      logerror( "%08x: %s", cpu_get_pc(machine.device("maincpu")), buf );
38      logerror( "%08x: %s", machine.device("maincpu")->safe_pc(), buf );
3939   }
4040}
4141
r17788r17789
869869            double time, ticks;
870870            int timer = offset-(0x100/4);
871871
872//              printf("Read timer reg %x (PC=%x)\n", timer, cpu_get_pc(&space.device()));
872//              printf("Read timer reg %x (PC=%x)\n", timer, space.device().safe_pc());
873873
874874            // update times for
875875            if (m_timer_regs[timer] & 0x800000)
r17788r17789
16701670
16711671            m_timer_regs[offset] = (m_timer_regs[offset] & ~(mem_mask & 0xFFFF0000)) | (data & (mem_mask & 0xFFFF0000));
16721672
1673//              printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, cpu_get_pc(&space.device()));
1673//              printf("%x to timer %d (mask %x PC %x)\n", data, offset, ~mem_mask, space.device().safe_pc());
16741674
16751675            if (ACCESSING_BITS_0_15)
16761676            {
r17788r17789
18291829      case 0x0200/4:
18301830         if( (mem_mask) & 0x0000ffff )
18311831         {
1832//              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()));
1832//              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());
18331833            m_IE = ( m_IE & ~mem_mask ) | ( data & mem_mask );
18341834#if 0
18351835            if (m_IE & m_IF)
r17788r17789
23182318//          printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %08x\n", offset, ~mem_mask, m_eeprom_state, activecpu_get_pc(), out);
23192319         return out;
23202320   }
2321//  printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, m_eeprom_state, cpu_get_pc(&space.device()), 0);
2321//  printf("eeprom_r: @ %x, mask %08x (state %d) (PC=%x) = %d\n", offset, ~mem_mask, m_eeprom_state, space.device().safe_pc(), 0);
23222322   return 0;
23232323}
23242324
r17788r17789
23302330      data >>= 16;
23312331   }
23322332
2333//  printf("eeprom_w: %x @ %x (state %d) (PC=%x)\n", data, offset, m_eeprom_state, cpu_get_pc(&space.device()));
2333//  printf("eeprom_w: %x @ %x (state %d) (PC=%x)\n", data, offset, m_eeprom_state, space.device().safe_pc());
23342334
23352335   switch (m_eeprom_state)
23362336   {
r17788r17789
23952395
23962396         if (m_eeprom_bits == 0)
23972397         {
2398            mame_printf_verbose("%08x: EEPROM: %02x to %x\n", cpu_get_pc(machine().device("maincpu")), m_eep_data, m_eeprom_addr );
2398            mame_printf_verbose("%08x: EEPROM: %02x to %x\n", machine().device("maincpu")->safe_pc(), m_eep_data, m_eeprom_addr );
23992399            if (m_eeprom_addr >= sizeof( m_gba_eeprom))
24002400            {
24012401               fatalerror( "eeprom: invalid address (%x)\n", m_eeprom_addr);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team