From d87ef8f79b70ca8117b8f365d4836ad4448086f7 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 11 Dec 2008 09:40:22 +0000 Subject: [PATCH] Here's the big one.... Added new function cpuexec_describe_context(machine) which can be used in logerror() and other printf-style functions to return a description of the current CPU/PC given only the machine. Changed several dozen sites to use this instead of directly interrogating the activecpu. Removed all other uses of activecpu throughout the system. Removed activecpu from the machine structure to prevent future abuse. Removed cpu_push_context() and cpu_pop_context(), and all call sites. Voodoo devices now require a CPU to be defined in the configuration in order to know whom to steal cycles from or stall when FIFOs get full. Updated all voodoo users to specify one. CPD1869 devices now also require a CPU to be defined in the configuration, in order to know which CPU's registers to fetch. Updated all cdp1869 users to specify one. Many other small changes to make this all work. --- src/emu/cpu/cop400/410ops.c | 4 - src/emu/cpu/cop400/420ops.c | 12 --- src/emu/cpu/dsp32/dsp32.c | 7 -- src/emu/cpu/e132xs/e132xs.c | 4 - src/emu/cpu/m37710/m37710.c | 2 - src/emu/cpu/m6800/m6800.c | 4 - src/emu/cpu/powerpc/ppccom.c | 4 - src/emu/cpu/sh2/sh2comn.c | 11 --- src/emu/cpu/sh4/sh4comn.c | 14 --- src/emu/cpu/tms32010/tms32010.c | 2 +- src/emu/cpu/tms34010/tms34010.c | 14 --- src/emu/cpuexec.c | 148 +++++++++++++++++++++----------- src/emu/cpuexec.h | 12 ++- src/emu/cpuintrf.c | 98 --------------------- src/emu/cpuintrf.h | 12 +-- src/emu/debug/debugcmd.c | 10 --- src/emu/debug/debugcpu.c | 4 - src/emu/debug/debugvw.c | 18 ---- src/emu/machine/6522via.c | 58 ++++++------- src/emu/machine/6532riot.c | 6 +- src/emu/machine/6840ptm.c | 6 +- src/emu/machine/6850acia.c | 2 +- src/emu/machine/adc083x.c | 9 +- src/emu/machine/at28c16.c | 10 +-- src/emu/machine/ds2401.c | 9 +- src/emu/machine/i2cmem.c | 9 +- src/emu/machine/idectrl.c | 17 ++-- src/emu/machine/intelfsh.c | 4 +- src/emu/machine/ldv1000.c | 8 +- src/emu/machine/msm6242.c | 4 +- src/emu/machine/scsidev.c | 6 +- src/emu/machine/smc91c9x.c | 4 +- src/emu/machine/timekpr.c | 4 +- src/emu/machine/tmp68301.c | 8 +- src/emu/machine/wd33c93.c | 2 +- src/emu/machine/x76f041.c | 9 +- src/emu/machine/x76f100.c | 9 +- src/emu/machine/z80sio.c | 10 +-- src/emu/mame.c | 40 +++++---- src/emu/mame.h | 3 +- src/emu/sound/ay8910.c | 5 +- src/emu/sound/es5506.c | 41 ++++----- src/emu/sound/ics2115.c | 103 +++++++++++----------- src/emu/sound/k053260.c | 3 +- src/emu/sound/nes_apu.c | 2 - src/emu/sound/pokey.c | 3 +- src/emu/sound/psx.c | 3 +- src/emu/sound/rf5c400.c | 4 +- src/emu/sound/saa1099.c | 7 +- src/emu/timer.c | 12 ++- src/emu/video/cdp1869.c | 20 +++-- src/emu/video/cdp1869.h | 1 + src/emu/video/mc6845.c | 2 +- src/emu/video/tms34061.c | 18 ++-- src/emu/video/vooddefs.h | 3 +- src/emu/video/voodoo.c | 145 ++++++++++++++++--------------- src/emu/video/voodoo.h | 4 + src/mame/audio/cage.c | 6 +- src/mame/audio/dcs.c | 26 ++---- src/mame/audio/dkong.c | 2 +- src/mame/audio/exidy.c | 4 +- src/mame/audio/harddriv.c | 8 +- src/mame/audio/leland.c | 10 +-- src/mame/audio/meadows.c | 2 +- src/mame/drivers/alg.c | 8 +- src/mame/drivers/bfcobra.c | 26 +++--- src/mame/drivers/btime.c | 18 ++-- src/mame/drivers/cidelsa.c | 18 ++-- src/mame/drivers/cps3.c | 2 +- src/mame/drivers/crbaloon.c | 2 +- src/mame/drivers/cubeqst.c | 6 -- src/mame/drivers/cubocd32.c | 4 +- src/mame/drivers/ddenlovr.c | 10 +-- src/mame/drivers/dgpix.c | 2 +- src/mame/drivers/dkong.c | 19 +--- src/mame/drivers/dorachan.c | 17 ++-- src/mame/drivers/dribling.c | 6 +- src/mame/drivers/eolith.c | 2 +- src/mame/drivers/eolith16.c | 2 +- src/mame/drivers/eolithsp.c | 10 +-- src/mame/drivers/f-32.c | 2 +- src/mame/drivers/fantland.c | 2 +- src/mame/drivers/filetto.c | 9 +- src/mame/drivers/findout.c | 2 +- src/mame/drivers/firebeat.c | 6 +- src/mame/drivers/fortecar.c | 2 +- src/mame/drivers/gaelco.c | 8 +- src/mame/drivers/galaxian.c | 4 +- src/mame/drivers/galpani2.c | 4 +- src/mame/drivers/galpani3.c | 4 +- src/mame/drivers/gamecstl.c | 13 +-- src/mame/drivers/gticlub.c | 2 + src/mame/drivers/halleys.c | 2 +- src/mame/drivers/hornet.c | 5 ++ src/mame/drivers/hyprduel.c | 2 +- src/mame/drivers/jchan.c | 4 +- src/mame/drivers/karnov.c | 6 +- src/mame/drivers/konamim2.c | 2 +- src/mame/drivers/ksys573.c | 9 +- src/mame/drivers/lockon.c | 36 +------- src/mame/drivers/lordgun.c | 2 +- src/mame/drivers/mario.c | 10 +-- src/mame/drivers/mediagx.c | 39 ++++----- src/mame/drivers/megadriv.c | 32 +++---- src/mame/drivers/metro.c | 4 +- src/mame/drivers/midzeus.c | 2 +- src/mame/drivers/missile.c | 12 +-- src/mame/drivers/mquake.c | 4 +- src/mame/drivers/namcona1.c | 4 +- src/mame/drivers/namcos11.c | 2 +- src/mame/drivers/namcos12.c | 9 +- src/mame/drivers/namcos21.c | 2 +- src/mame/drivers/nbmj9195.c | 8 +- src/mame/drivers/neogeo.c | 2 +- src/mame/drivers/niyanpai.c | 4 +- src/mame/drivers/nwk-tr.c | 1 + src/mame/drivers/pirates.c | 10 +-- src/mame/drivers/psikyo.c | 2 +- src/mame/drivers/seattle.c | 13 ++- src/mame/drivers/taito_l.c | 2 +- src/mame/drivers/taitowlf.c | 13 +-- src/mame/drivers/thunderx.c | 2 +- src/mame/drivers/tigeroad.c | 2 +- src/mame/drivers/tmaster.c | 4 +- src/mame/drivers/tx1.c | 10 +-- src/mame/drivers/vamphalf.c | 24 +++--- src/mame/drivers/vegaeo.c | 2 +- src/mame/drivers/vegas.c | 12 ++- src/mame/drivers/viper.c | 15 ++-- src/mame/drivers/xtheball.c | 4 +- src/mame/drivers/zaccaria.c | 2 +- src/mame/drivers/zn.c | 9 +- src/mame/includes/cidelsa.h | 1 + src/mame/includes/eolithsp.h | 2 +- src/mame/includes/gaelcrpt.h | 2 +- src/mame/machine/amiga.c | 16 ++-- src/mame/machine/cubocd32.c | 2 +- src/mame/machine/dc.c | 4 +- src/mame/machine/dec0.c | 10 +-- src/mame/machine/fddebug.c | 67 ++++++++------- src/mame/machine/gaelcrpt.c | 6 +- src/mame/machine/harddriv.c | 2 +- src/mame/machine/irobot.c | 2 +- src/mame/machine/kaneko16.c | 28 +++--- src/mame/machine/konppc.c | 6 +- src/mame/machine/leland.c | 10 +-- src/mame/machine/midwayic.c | 18 ++-- src/mame/machine/namcoio.c | 32 +++---- src/mame/machine/namcos1.c | 4 +- src/mame/machine/namcos2.c | 76 ++++++++-------- src/mame/machine/naomibd.c | 6 +- src/mame/machine/pitnrun.c | 6 +- src/mame/machine/psx.c | 9 +- src/mame/machine/scramble.c | 4 +- src/mame/machine/segaic16.c | 10 +-- src/mame/machine/slapstic.c | 2 +- src/mame/machine/snes.c | 10 --- src/mame/machine/stvcd.c | 74 ++++++++-------- src/mame/machine/tait8741.c | 16 ++-- src/mame/machine/taitosj.c | 4 - src/mame/machine/tatsumi.c | 17 +--- src/mame/machine/toaplan1.c | 5 +- src/mame/machine/twincobr.c | 16 ++-- src/mame/machine/tx1.c | 6 +- src/mame/machine/wrally.c | 2 +- src/mame/machine/zs01.c | 9 +- src/mame/video/artmagic.c | 8 +- src/mame/video/btoads.c | 4 +- src/mame/video/cidelsa.c | 5 +- src/mame/video/cinemat.c | 2 - src/mame/video/dcheese.c | 2 +- src/mame/video/genesis.c | 4 +- src/mame/video/hd63484.c | 2 +- src/mame/video/jagblit.c | 4 +- src/mame/video/konamiic.c | 14 +-- src/mame/video/leland.c | 12 +-- src/mame/video/neogeo.c | 4 +- src/mame/video/phoenix.c | 2 +- src/mame/video/ppu2c0x.c | 2 +- src/mame/video/psx.c | 9 +- src/mame/video/tia.c | 56 ++++++------ src/mame/video/ygv608.c | 8 +- 182 files changed, 930 insertions(+), 1282 deletions(-) diff --git a/src/emu/cpu/cop400/410ops.c b/src/emu/cpu/cop400/410ops.c index c5287940491..dd667ccdad2 100644 --- a/src/emu/cpu/cop400/410ops.c +++ b/src/emu/cpu/cop400/410ops.c @@ -123,8 +123,6 @@ static TIMER_CALLBACK( cop400_serial_tick ) { cop400_state *cop400 = ptr; - cpu_push_context(cop400->device); - if (BIT(EN, 0)) { /* @@ -194,8 +192,6 @@ static TIMER_CALLBACK( cop400_serial_tick ) SIO = ((SIO << 1) | IN_SI()) & 0x0f; } - - cpu_pop_context(); } INLINE void WRITE_Q(cop400_state *cop400, UINT8 data) diff --git a/src/emu/cpu/cop400/420ops.c b/src/emu/cpu/cop400/420ops.c index 75429b9b10e..3809ab84707 100644 --- a/src/emu/cpu/cop400/420ops.c +++ b/src/emu/cpu/cop400/420ops.c @@ -26,8 +26,6 @@ static TIMER_CALLBACK( cop400_counter_tick ) { cop400_state *cop400 = ptr; - cpu_push_context(cop400->device); - T++; if (T == 0) @@ -40,8 +38,6 @@ static TIMER_CALLBACK( cop400_counter_tick ) cop400->halt = 0; } } - - cpu_pop_context(); } /* IN Latches */ @@ -52,8 +48,6 @@ static TIMER_CALLBACK( cop400_inil_tick ) UINT8 in; int i; - cpu_push_context(cop400->device); - in = IN_IN(); for (i = 0; i < 4; i++) @@ -65,8 +59,6 @@ static TIMER_CALLBACK( cop400_inil_tick ) IL |= (1 << i); } } - - cpu_pop_context(); } /* Microbus */ @@ -76,8 +68,6 @@ static TIMER_CALLBACK( cop400_microbus_tick ) cop400_state *cop400 = ptr; UINT8 in; - cpu_push_context(cop400->device); - in = IN_IN(); if (!BIT(in, 2)) @@ -101,8 +91,6 @@ static TIMER_CALLBACK( cop400_microbus_tick ) cop400->microbus_int = 0; } } - - cpu_pop_context(); } /* Arithmetic Instructions */ diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c index 71b5cb0e5b2..a29004313bc 100644 --- a/src/emu/cpu/dsp32/dsp32.c +++ b/src/emu/cpu/dsp32/dsp32.c @@ -500,8 +500,6 @@ void dsp32c_pio_w(const device_config *device, int reg, int data) UINT16 mask; UINT8 mode; - cpu_push_context(device); - /* look up register and mask */ mode = ((cpustate->pcr >> 8) & 2) | ((cpustate->pcr >> 1) & 1); reg = regmap[mode][reg]; @@ -567,8 +565,6 @@ void dsp32c_pio_w(const device_config *device, int reg, int data) logerror("dsp32_pio_w called on invalid register %d\n", reg); break; } - - cpu_pop_context(); } @@ -583,8 +579,6 @@ int dsp32c_pio_r(const device_config *device, int reg) UINT16 mask, result = 0xffff; UINT8 mode, shift = 0; - cpu_push_context(device); - /* look up register and mask */ mode = ((cpustate->pcr >> 8) & 2) | ((cpustate->pcr >> 1) & 1); reg = regmap[mode][reg]; @@ -643,7 +637,6 @@ int dsp32c_pio_r(const device_config *device, int reg) break; } - cpu_pop_context(); return (result >> shift) & ~mask; } diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index 6d43984eda6..1df44cff5b0 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -635,8 +635,6 @@ static TIMER_CALLBACK( e132xs_timer_callback ) hyperstone_state *cpustate = device->token; int update = param; - cpu_push_context(device); - /* update the values if necessary */ if (update) update_timer_prescale(cpustate); @@ -648,8 +646,6 @@ static TIMER_CALLBACK( e132xs_timer_callback ) /* adjust ourselves for the next time */ else adjust_timer_interrupt(cpustate); - - cpu_pop_context(); } diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index 749f4119722..92b7eed8000 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -264,13 +264,11 @@ static TIMER_CALLBACK( m37710_timer_cb ) int which = param; int curirq = M37710_LINE_TIMERA0 - which; - cpu_push_context(cpustate->device); timer_adjust_oneshot(cpustate->timers[which], cpustate->reload[which], param); cpustate->m37710_regs[m37710_irq_levels[curirq]] |= 0x04; m37710_set_irq_line(cpustate, curirq, PULSE_LINE); cpu_triggerint(cpustate->device); - cpu_pop_context(); } static void m37710_external_tick(m37710i_cpu_struct *cpustate, int timer, int state) diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 45798ba1847..b6c8cae0752 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -665,7 +665,6 @@ static TIMER_CALLBACK(m6800_tx_tick) { m6800_state *cpustate = ptr; - cpu_push_context(cpustate->device); if (cpustate->trcsr & M6800_TRCSR_TE) { // force Port 2 bit 4 as output @@ -734,14 +733,12 @@ static TIMER_CALLBACK(m6800_tx_tick) } m6800_tx(cpustate, cpustate->tx); - cpu_pop_context(); } static TIMER_CALLBACK(m6800_rx_tick) { m6800_state *cpustate =ptr; - cpu_push_context(cpustate->device); if (cpustate->trcsr & M6800_TRCSR_RE) { if (cpustate->trcsr & M6800_TRCSR_WU) @@ -833,7 +830,6 @@ static TIMER_CALLBACK(m6800_rx_tick) } } } - cpu_pop_context(); } #endif diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index c8cf7044435..4653dba3321 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -1376,10 +1376,8 @@ static int ppc4xx_dma_fetch_transmit_byte(powerpc_state *ppc, int dmachan, UINT8 return FALSE; /* fetch the data */ - cpu_push_context(ppc->device); *byte = memory_read_byte(ppc->program, dmaregs[DCR4XX_DMADA0]++); ppc4xx_dma_decrement_count(ppc, dmachan); - cpu_pop_context(); return TRUE; } @@ -1402,10 +1400,8 @@ static int ppc4xx_dma_handle_receive_byte(powerpc_state *ppc, int dmachan, UINT8 return FALSE; /* store the data */ - cpu_push_context(ppc->device); memory_write_byte(ppc->program, dmaregs[DCR4XX_DMADA0]++, byte); ppc4xx_dma_decrement_count(ppc, dmachan); - cpu_pop_context(); return TRUE; } diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index 85bdde5b4d9..95a5a2dad95 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -114,7 +114,6 @@ TIMER_CALLBACK( sh2_timer_callback ) SH2 *sh2 = ptr; UINT16 frc; - cpu_push_context(sh2->device); sh2_timer_resync(sh2); frc = sh2->frc; @@ -135,8 +134,6 @@ TIMER_CALLBACK( sh2_timer_callback ) sh2_recalc_irq(sh2); sh2_timer_activate(sh2); - - cpu_pop_context(); } TIMER_CALLBACK( sh2_dmac_callback ) @@ -144,12 +141,10 @@ TIMER_CALLBACK( sh2_dmac_callback ) int dma = param & 1; SH2 *sh2 = ptr; - cpu_push_context(sh2->device); LOG(("SH2.%d: DMA %d complete\n", cpu_get_index(sh2->device), dma)); sh2->m[0x63+4*dma] |= 2; sh2->dma_timer_active[dma] = 0; sh2_recalc_irq(sh2); - cpu_pop_context(); } static void sh2_dmac_check(SH2 *sh2, int dma) @@ -519,10 +514,7 @@ void sh2_set_frt_input(const device_config *device, int state) return; } - cpu_push_context(device); - if(sh2->frt_input == state) { - cpu_pop_context(); return; } @@ -530,12 +522,10 @@ void sh2_set_frt_input(const device_config *device, int state) if(sh2->m[5] & 0x8000) { if(state == CLEAR_LINE) { - cpu_pop_context(); return; } } else { if(state == ASSERT_LINE) { - cpu_pop_context(); return; } } @@ -545,7 +535,6 @@ void sh2_set_frt_input(const device_config *device, int state) sh2->m[4] |= ICF; logerror("SH2.%d: ICF activated (%x)\n", cpu_get_index(sh2->device), sh2->pc & AM); sh2_recalc_irq(sh2); - cpu_pop_context(); } void sh2_set_irq_line(SH2 *sh2, int irqline, int state) diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index c929aee7337..3cb5f110cac 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -257,7 +257,6 @@ static TIMER_CALLBACK( sh4_refresh_timer_callback ) { SH4 *sh4 = ptr; - cpu_push_context(sh4->device); sh4->m[RTCNT] = 0; sh4_refresh_timer_recompute(sh4); sh4->m[RTCSR] |= 128; @@ -270,7 +269,6 @@ static TIMER_CALLBACK( sh4_refresh_timer_callback ) sh4->m[RTCSR] |= 4; } } - cpu_pop_context(); } static void increment_rtc_time(SH4 *sh4, int mode) @@ -370,7 +368,6 @@ static TIMER_CALLBACK( sh4_rtc_timer_callback ) { SH4 *sh4 = ptr; - cpu_push_context(sh4->device); timer_adjust_oneshot(sh4->rtc_timer, ATTOTIME_IN_HZ(128), 0); sh4->m[R64CNT] = (sh4->m[R64CNT]+1) & 0x7f; if (sh4->m[R64CNT] == 64) @@ -379,7 +376,6 @@ static TIMER_CALLBACK( sh4_rtc_timer_callback ) increment_rtc_time(sh4, 0); //sh4_exception_request(sh4, SH4_INTC_NMI); // TEST } - cpu_pop_context(); } static TIMER_CALLBACK( sh4_timer_callback ) @@ -389,13 +385,11 @@ static TIMER_CALLBACK( sh4_timer_callback ) int which = param; int idx = tcr[which]; - cpu_push_context(sh4->device); sh4->m[tcnt[which]] = sh4->m[tcor[which]]; sh4_timer_recompute(sh4, which); sh4->m[idx] = sh4->m[idx] | 0x100; if (sh4->m[idx] & 0x20) sh4_exception_request(sh4, tuni[which]); - cpu_pop_context(); } static TIMER_CALLBACK( sh4_dmac_callback ) @@ -403,7 +397,6 @@ static TIMER_CALLBACK( sh4_dmac_callback ) SH4 *sh4 = ptr; int channel = param; - cpu_push_context(sh4->device); LOG(("SH4 '%s': DMA %d complete\n", sh4->device->tag, channel)); sh4->dma_timer_active[channel] = 0; switch (channel) @@ -433,7 +426,6 @@ static TIMER_CALLBACK( sh4_dmac_callback ) sh4_exception_request(sh4, SH4_INTC_DMTE3); break; } - cpu_pop_context(); } static int sh4_dma_transfer(SH4 *sh4, int channel, int timermode, UINT32 chcr, UINT32 *sar, UINT32 *dar, UINT32 *dmatcr) @@ -976,10 +968,7 @@ void sh4_set_frt_input(const device_config *device, int state) return; } - cpu_push_context(device); - if(sh4->frt_input == state) { - cpu_pop_context(); return; } @@ -987,12 +976,10 @@ void sh4_set_frt_input(const device_config *device, int state) if(sh4->m[5] & 0x8000) { if(state == CLEAR_LINE) { - cpu_pop_context(); return; } } else { if(state == ASSERT_LINE) { - cpu_pop_context(); return; } } @@ -1004,7 +991,6 @@ void sh4_set_frt_input(const device_config *device, int state) logerror("SH4 '%s': ICF activated (%x)\n", sh4->device->tag, sh4->pc & AM); sh4_recalc_irq(); #endif - cpu_pop_context(); } void sh4_set_irln_input(const device_config *device, int value) diff --git a/src/emu/cpu/tms32010/tms32010.c b/src/emu/cpu/tms32010/tms32010.c index 43ca40d0e09..72201679ef3 100644 --- a/src/emu/cpu/tms32010/tms32010.c +++ b/src/emu/cpu/tms32010/tms32010.c @@ -180,7 +180,7 @@ INLINE void PUSH_STACK(tms32010_state *cpustate, UINT16 data) cpustate->STACK[3] = (data & cpustate->addr_mask); } -inline void UPDATE_AR(tms32010_state *cpustate) +INLINE void UPDATE_AR(tms32010_state *cpustate) { if (cpustate->opcode.b.l & 0x30) { UINT16 tmpAR = cpustate->AR[ARP]; diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index a98c9cbe754..1d9264afbf1 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -898,9 +898,6 @@ static TIMER_CALLBACK( scanline_callback ) int enabled; int master; - /* set the CPU context */ - cpu_push_context(tms->device); - /* fetch the core timing parameters */ current_visarea = video_screen_get_visible_area(tms->screen); enabled = SMART_IOREG(tms, DPYCTL) & 0x8000; @@ -1029,9 +1026,6 @@ static TIMER_CALLBACK( scanline_callback ) /* note that we add !master (0 or 1) as a attoseconds value; this makes no practical difference */ /* but helps ensure that masters are updated first before slaves */ timer_adjust_oneshot(tms->scantimer, attotime_add_attoseconds(video_screen_get_time_until_pos(tms->screen, vcount, 0), !master), cpunum | (vcount << 8)); - - /* restore the context */ - cpu_pop_context(); } @@ -1558,9 +1552,6 @@ void tms34010_host_w(const device_config *cpu, int reg, int data) tms34010_state *tms = cpu->token; unsigned int addr; - /* swap to the target cpu */ - cpu_push_context(cpu); - switch (reg) { /* upper 16 bits of the address */ @@ -1603,9 +1594,6 @@ void tms34010_host_w(const device_config *cpu, int reg, int data) logerror("tms34010_host_control_w called on invalid register %d\n", reg); break; } - - /* swap back */ - cpu_pop_context(); } @@ -1639,9 +1627,7 @@ int tms34010_host_r(const device_config *cpu, int reg) /* read from the address */ addr = (IOREG(tms, REG_HSTADRH) << 16) | IOREG(tms, REG_HSTADRL); - cpu_push_context(cpu); result = TMS34010_RDMEM_WORD(tms, TOBYTE(addr & 0xfffffff0)); - cpu_pop_context(); /* optional postincrement (it says preincrement, but data is preloaded, so it is effectively a postincrement */ diff --git a/src/emu/cpuexec.c b/src/emu/cpuexec.c index 20a6bf7e6c0..c6d97101383 100644 --- a/src/emu/cpuexec.c +++ b/src/emu/cpuexec.c @@ -63,7 +63,6 @@ struct _cpu_class_data cpu_class_header header; /* header containing public data */ /* cycle counting and executing */ - UINT8 executing; /* TRUE if the values below are valid */ int * icount; /* pointer to the icount */ int cycles_running; /* number of cycles we are executing */ int cycles_stolen; /* number of cycles we artificially stole */ @@ -98,6 +97,15 @@ struct _cpu_class_data }; +/* global data stored in the machine */ +/* In mame.h: typedef struct _cpuexec_private cpuexec_private; */ +struct _cpuexec_private +{ + const device_config *executingcpu; /* pointer to the currently executing CPU */ + char statebuf[256]; /* string buffer containing state description */ +}; + + /*************************************************************************** FUNCTION PROTOTYPES @@ -198,6 +206,10 @@ const device_config *cpuexec_create_cpu_device(const cpu_config *config) void cpuexec_init(running_machine *machine) { int cpunum; + + /* allocate global state */ + machine->cpuexec_data = auto_malloc(sizeof(*machine->cpuexec_data)); + memset(machine->cpuexec_data, 0, sizeof(*machine->cpuexec_data)); /* loop over all our CPUs */ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->config->cpu); cpunum++) @@ -350,6 +362,7 @@ static void cpuexec_exit(running_machine *machine) void cpuexec_timeslice(running_machine *machine) { int call_debugger = ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0); + cpuexec_private *global = machine->cpuexec_data; attotime target = timer_next_fire_time(machine); attotime base = timer_get_time(machine); int cpunum, ran; @@ -369,7 +382,8 @@ void cpuexec_timeslice(running_machine *machine) /* loop over non-suspended CPUs */ for (cpunum = 0; machine->cpu[cpunum] != NULL; cpunum++) { - cpu_class_data *classdata = machine->cpu[cpunum]->classtoken; + const device_config *cpu = machine->cpu[cpunum]; + cpu_class_data *classdata = cpu->classtoken; if (classdata->suspend == 0) { attotime delta = attotime_sub(target, classdata->localtime); @@ -384,14 +398,14 @@ void cpuexec_timeslice(running_machine *machine) /* note that this global variable cycles_stolen can be modified */ /* via the call to the cpunum_execute */ classdata->cycles_stolen = 0; - classdata->executing = TRUE; + global->executingcpu = cpu; if (!call_debugger) - ran = cpu_execute(machine->cpu[cpunum], classdata->cycles_running); + ran = cpu_execute(cpu, classdata->cycles_running); else { - debugger_start_cpu_hook(machine->cpu[cpunum], target); - ran = cpu_execute(machine->cpu[cpunum], classdata->cycles_running); - debugger_stop_cpu_hook(machine->cpu[cpunum]); + debugger_start_cpu_hook(cpu, target); + ran = cpu_execute(cpu, classdata->cycles_running); + debugger_stop_cpu_hook(cpu); } #ifdef MAME_DEBUG @@ -399,7 +413,6 @@ void cpuexec_timeslice(running_machine *machine) fatalerror("Negative CPU cycle count!"); #endif /* MAME_DEBUG */ - classdata->executing = FALSE; ran -= classdata->cycles_stolen; profiler_mark(PROFILER_END); @@ -417,6 +430,7 @@ void cpuexec_timeslice(running_machine *machine) } } } + global->executingcpu = NULL; /* update the local times of all CPUs */ for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum] != NULL; cpunum++) @@ -447,19 +461,10 @@ void cpuexec_timeslice(running_machine *machine) } -/*------------------------------------------------- - cpuexec_boost_interleave - temporarily boosts - the interleave factor --------------------------------------------------*/ - -void cpuexec_boost_interleave(running_machine *machine, attotime timeslice_time, attotime boost_duration) -{ - /* ignore timeslices > 1 second */ - if (timeslice_time.seconds > 0) - return; - timer_add_scheduling_quantum(machine, timeslice_time.attoseconds, boost_duration); -} +/*************************************************************************** + GLOBAL HELPERS +***************************************************************************/ /*------------------------------------------------- cputag_get_cpu - return a pointer to the given @@ -478,6 +483,41 @@ const device_config *cputag_get_cpu(running_machine *machine, const char *tag) } +/*------------------------------------------------- + cpuexec_boost_interleave - temporarily boosts + the interleave factor +-------------------------------------------------*/ + +void cpuexec_boost_interleave(running_machine *machine, attotime timeslice_time, attotime boost_duration) +{ + /* ignore timeslices > 1 second */ + if (timeslice_time.seconds > 0) + return; + timer_add_scheduling_quantum(machine, timeslice_time.attoseconds, boost_duration); +} + + +/*------------------------------------------------- + cpuexec_describe_context - return a string + describing which CPUs are currently executing + and their PC +-------------------------------------------------*/ + +const char *cpuexec_describe_context(running_machine *machine) +{ + cpuexec_private *global = machine->cpuexec_data; + const device_config *executingcpu = global->executingcpu; + + /* if we have an executing CPU, output data */ + if (executingcpu != NULL) + sprintf(global->statebuf, "'%s'(%08X)", executingcpu->tag, cpu_get_pc(executingcpu)); + else + strcpy(global->statebuf, "(no context)"); + + return global->statebuf; +} + + /*************************************************************************** CPU SCHEDULING @@ -497,8 +537,7 @@ void cpu_suspend(const device_config *device, int reason, int eatcycles) classdata->nexteatcycles = eatcycles; /* if we're active, synchronize */ - if (classdata->executing) - cpu_abort_timeslice(device); + cpu_abort_timeslice(device); } @@ -515,8 +554,7 @@ void cpu_resume(const device_config *device, int reason) classdata->nextsuspend &= ~reason; /* if we're active, synchronize */ - if (classdata->executing) - cpu_abort_timeslice(device); + cpu_abort_timeslice(device); } @@ -527,8 +565,7 @@ void cpu_resume(const device_config *device, int reason) int cpu_is_executing(const device_config *device) { - cpu_class_data *classdata = get_safe_classtoken(device); - return classdata->executing; + return (device == device->machine->cpuexec_data->executingcpu); } @@ -654,7 +691,7 @@ attotime cpu_get_local_time(const device_config *device) /* if we're active, add in the time from the current slice */ result = classdata->localtime; - if (classdata->executing) + if (device == device->machine->cpuexec_data->executingcpu) { int cycles = classdata->cycles_running - *classdata->icount; result = attotime_add(result, cpu_clocks_to_attotime(device, cycles)); @@ -663,6 +700,21 @@ attotime cpu_get_local_time(const device_config *device) } +/*------------------------------------------------- + cpuexec_override_local_time - overrides the + given time with the executing CPU's local + time, if present (this function is private + to timer.c) +-------------------------------------------------*/ + +attotime cpuexec_override_local_time(running_machine *machine, attotime default_time) +{ + if (machine->cpuexec_data != NULL && machine->cpuexec_data->executingcpu != NULL) + return cpu_get_local_time(machine->cpuexec_data->executingcpu); + return default_time; +} + + /*------------------------------------------------- cpu_get_total_cycles - return the total number of CPU cycles executed on the active @@ -673,7 +725,7 @@ UINT64 cpu_get_total_cycles(const device_config *device) { cpu_class_data *classdata = get_safe_classtoken(device); - if (classdata->executing) + if (device == device->machine->cpuexec_data->executingcpu) return classdata->totalcycles + classdata->cycles_running - *classdata->icount; else return classdata->totalcycles; @@ -690,7 +742,7 @@ void cpu_eat_cycles(const device_config *device, int cycles) cpu_class_data *classdata = get_safe_classtoken(device); /* ignore if not the executing CPU */ - if (!classdata->executing) + if (device != device->machine->cpuexec_data->executingcpu) return; if (cycles > *classdata->icount) @@ -709,7 +761,7 @@ void cpu_adjust_icount(const device_config *device, int delta) cpu_class_data *classdata = get_safe_classtoken(device); /* ignore if not the executing CPU */ - if (!classdata->executing) + if (device != device->machine->cpuexec_data->executingcpu) return; *classdata->icount += delta; @@ -728,7 +780,7 @@ void cpu_abort_timeslice(const device_config *device) int delta; /* ignore if not the executing CPU */ - if (!classdata->executing) + if (device != device->machine->cpuexec_data->executingcpu) return; /* swallow the remaining cycles */ @@ -742,6 +794,19 @@ void cpu_abort_timeslice(const device_config *device) } +/*------------------------------------------------- + cpuexec_abort_timeslice - abort execution + for the current timeslice +-------------------------------------------------*/ + +void cpuexec_abort_timeslice(running_machine *machine) +{ + const device_config *executingcpu = machine->cpuexec_data->executingcpu; + if (executingcpu != NULL) + cpu_abort_timeslice(executingcpu); +} + + /*************************************************************************** SYNCHRONIZATION HELPERS @@ -834,8 +899,7 @@ void cpuexec_trigger(running_machine *machine, int trigger) cpu_class_data *classdata = machine->cpu[cpunum]->classtoken; /* if we're executing, for an immediate abort */ - if (classdata->executing) - cpu_abort_timeslice(machine->cpu[cpunum]); + cpu_abort_timeslice(machine->cpu[cpunum]); /* see if this is a matching trigger */ if (classdata->suspend != 0 && classdata->trigger == trigger) @@ -1153,11 +1217,7 @@ static void on_vblank(const device_config *device, void *param, int vblank_state if (cpu_interested) { if (!(classdata->suspend & (SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))) - { - cpu_push_context(cpudevice); (*config->vblank_interrupt)(cpudevice); - cpu_pop_context(); - } /* if we have more than one interrupt per frame, start the timer now to trigger the rest of them */ if (config->vblank_interrupts_per_frame > 1 && !(classdata->suspend & SUSPEND_REASON_DISABLE)) @@ -1189,11 +1249,7 @@ static TIMER_CALLBACK( trigger_partial_frame_interrupt ) /* call the interrupt handler */ if (!cpu_is_suspended(device, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)) - { - cpu_push_context(device); (*config->vblank_interrupt)(device); - cpu_pop_context(); - } /* more? */ if (classdata->iloops > 1) @@ -1213,11 +1269,7 @@ static TIMER_CALLBACK( trigger_periodic_interrupt ) /* bail if there is no routine */ if (config->timed_interrupt != NULL && !cpu_is_suspended(device, SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)) - { - cpu_push_context(device); (*config->timed_interrupt)(device); - cpu_pop_context(); - } } @@ -1244,9 +1296,6 @@ static TIMER_CALLBACK( empty_event_queue ) cpu_input_data *inputline = &classdata->input[param]; int curevent; - /* swap to the CPU's context */ - cpu_push_context(device); - /* loop over all events */ for (curevent = 0; curevent < inputline->qindex; curevent++) { @@ -1321,9 +1370,6 @@ static TIMER_CALLBACK( empty_event_queue ) } } - /* swap back */ - cpu_pop_context(); - /* reset counter */ inputline->qindex = 0; } diff --git a/src/emu/cpuexec.h b/src/emu/cpuexec.h index cd287ea6947..ba511f4b2ad 100644 --- a/src/emu/cpuexec.h +++ b/src/emu/cpuexec.h @@ -108,9 +108,19 @@ void cpuexec_timeslice(running_machine *machine); /* temporarily boosts the interleave factor */ void cpuexec_boost_interleave(running_machine *machine, attotime timeslice_time, attotime boost_duration); + + +/* ----- global helpers ----- */ + /* return a pointer to the given CPU by tag */ const device_config *cputag_get_cpu(running_machine *machine, const char *tag); +/* abort execution for the current timeslice */ +void cpuexec_abort_timeslice(running_machine *machine); + +/* return a string describing which CPUs are currently executing and their PC */ +const char *cpuexec_describe_context(running_machine *machine); + /* ----- CPU scheduling----- */ @@ -165,7 +175,7 @@ void cpu_eat_cycles(const device_config *device, int cycles); /* apply a +/- to the current icount */ void cpu_adjust_icount(const device_config *device, int delta); -/* aborts the timeslice for the active CPU */ +/* abort execution for the current timeslice, allowing other CPUs to run before we run again */ void cpu_abort_timeslice(const device_config *device); diff --git a/src/emu/cpuintrf.c b/src/emu/cpuintrf.c index cde08ee0764..5bc976b596c 100644 --- a/src/emu/cpuintrf.c +++ b/src/emu/cpuintrf.c @@ -911,9 +911,6 @@ static const struct static cpu_class_header cpu_type_header[CPU_COUNT]; -static const device_config *cpu_context_stack[4]; -static int cpu_context_stack_ptr; - static char temp_string_pool[TEMP_STRING_POOL_ENTRIES][MAX_STRING_LENGTH]; static int temp_string_pool_index; @@ -952,41 +949,6 @@ INLINE cpu_class_header *get_safe_classheader(const device_config *device) } -/*------------------------------------------------- - set_cpu_context - set the current CPU context - swapping out the old one if necessary --------------------------------------------------*/ - -INLINE void set_cpu_context(const device_config *oldcpu, const device_config *newcpu) -{ - cpu_class_header *classheader; - - /* if nothing is changing, quick exit */ - if (oldcpu == newcpu) - return; - - /* swap out the old context if we have one */ - if (oldcpu != NULL) - { - classheader = oldcpu->classtoken; - (*classheader->get_context)(oldcpu->token); - } - - /* swap in the new context if we have one */ - if (newcpu != NULL) - { - /* make this the activecpu */ - newcpu->machine->activecpu = newcpu; - - /* set the memory context and swap in the new */ - classheader = newcpu->classtoken; - (*classheader->set_context)(newcpu->token); - } - else - Machine->activecpu = NULL; -} - - /*************************************************************************** GLOBAL MANAGEMENT @@ -1067,10 +1029,6 @@ void cpuintrf_init(running_machine *machine) for (mapindex = 0; mapindex < CPU_COUNT; mapindex++) if (cpu_type_header[mapindex].get_info == NULL) cpu_type_header[mapindex] = cpu_type_header[CPU_DUMMY]; - - /* reset the context stack */ - memset((void *)&cpu_context_stack[0], 0, sizeof(cpu_context_stack)); - cpu_context_stack_ptr = 0; } @@ -1079,31 +1037,6 @@ void cpuintrf_init(running_machine *machine) LIVE CONTEXT CONTROL ***************************************************************************/ -/*------------------------------------------------- - cpu_push_context - remember the current - context and push a new one on the stack --------------------------------------------------*/ - -void cpu_push_context(const device_config *device) -{ - const device_config *oldcpu = device->machine->activecpu; - cpu_context_stack[cpu_context_stack_ptr++] = oldcpu; - set_cpu_context(oldcpu, device); -} - - -/*------------------------------------------------- - cpu_pop_context - restore a previously saved - context --------------------------------------------------*/ - -void cpu_pop_context(void) -{ - const device_config *device = cpu_context_stack[--cpu_context_stack_ptr]; - set_cpu_context(Machine->activecpu, device); -} - - /*------------------------------------------------- cpu_get_index_slow - find a CPU in the machine by searching @@ -1138,12 +1071,8 @@ void cpu_init(const device_config *device, int index, int clock, cpu_irq_callbac classheader->space[ADDRESS_SPACE_DATA] = memory_find_address_space(device, ADDRESS_SPACE_DATA); classheader->space[ADDRESS_SPACE_IO] = memory_find_address_space(device, ADDRESS_SPACE_IO); - device->machine->activecpu = device; - (*classheader->init)(device, index, clock, irqcallback); (*classheader->get_context)(device->token); - - device->machine->activecpu = NULL; } @@ -1156,11 +1085,7 @@ void cpu_exit(const device_config *device) cpu_class_header *classheader = get_safe_classheader(device); if (classheader->exit != NULL) - { - set_cpu_context(device->machine->activecpu, device); (*classheader->exit)(device); - device->machine->activecpu = NULL; - } } @@ -1174,10 +1099,8 @@ INT64 cpu_get_info_int(const device_config *device, UINT32 state) cpu_class_header *classheader = get_safe_classheader(device); cpuinfo info; - cpu_push_context(device); info.i = 0; (*classheader->get_info)(device, state, &info); - cpu_pop_context(); return info.i; } @@ -1186,10 +1109,8 @@ void *cpu_get_info_ptr(const device_config *device, UINT32 state) cpu_class_header *classheader = get_safe_classheader(device); cpuinfo info; - cpu_push_context(device); info.p = NULL; (*classheader->get_info)(device, state, &info); - cpu_pop_context(); return info.p; } @@ -1198,10 +1119,8 @@ genf *cpu_get_info_fct(const device_config *device, UINT32 state) cpu_class_header *classheader = get_safe_classheader(device); cpuinfo info; - cpu_push_context(device); info.f = NULL; (*classheader->get_info)(device, state, &info); - cpu_pop_context(); return info.f; } @@ -1210,10 +1129,8 @@ const char *cpu_get_info_string(const device_config *device, UINT32 state) cpu_class_header *classheader = get_safe_classheader(device); cpuinfo info; - cpu_push_context(device); info.s = get_temp_string_buffer(); (*classheader->get_info)(device, state, &info); - cpu_pop_context(); return info.s; } @@ -1229,9 +1146,7 @@ void cpu_set_info_int(const device_config *device, UINT32 state, INT64 data) cpuinfo info; info.i = data; - cpu_push_context(device); (*classheader->set_info)(device, state, &info); - cpu_pop_context(); } void cpu_set_info_ptr(const device_config *device, UINT32 state, void *data) @@ -1240,9 +1155,7 @@ void cpu_set_info_ptr(const device_config *device, UINT32 state, void *data) cpuinfo info; info.p = data; - cpu_push_context(device); (*classheader->set_info)(device, state, &info); - cpu_pop_context(); } void cpu_set_info_fct(const device_config *device, UINT32 state, genf *data) @@ -1251,9 +1164,7 @@ void cpu_set_info_fct(const device_config *device, UINT32 state, genf *data) cpuinfo info; info.f = data; - cpu_push_context(device); (*classheader->set_info)(device, state, &info); - cpu_pop_context(); } @@ -1268,9 +1179,7 @@ int cpu_execute(const device_config *device, int cycles) cpu_class_header *classheader = get_safe_classheader(device); int ran; - cpu_push_context(device); ran = (*classheader->execute)(device, cycles); - cpu_pop_context(); return ran; } @@ -1283,9 +1192,7 @@ void cpu_reset(const device_config *device) { cpu_class_header *classheader = get_safe_classheader(device); - cpu_push_context(device); (*classheader->reset)(device); - cpu_pop_context(); } @@ -1300,10 +1207,8 @@ offs_t cpu_get_physical_pc_byte(const device_config *device) const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM); offs_t pc; - cpu_push_context(device); pc = memory_address_to_byte(space, cpu_get_info_int(device, CPUINFO_INT_PC)); memory_address_physical(space, TRANSLATE_FETCH, &pc); - cpu_pop_context(); return pc; } @@ -1318,8 +1223,6 @@ offs_t cpu_dasm(const device_config *device, char *buffer, offs_t pc, const UINT cpu_class_header *classheader = get_safe_classheader(device); offs_t result = 0; - cpu_push_context(device); - /* check for disassembler override */ if (classheader->dasm_override != NULL) result = (*classheader->dasm_override)(device, buffer, pc, oprom, opram); @@ -1365,7 +1268,6 @@ offs_t cpu_dasm(const device_config *device, char *buffer, offs_t pc, const UINT } #endif - cpu_pop_context(); return result; } diff --git a/src/emu/cpuintrf.h b/src/emu/cpuintrf.h index 08390dd5f06..85e56496af1 100644 --- a/src/emu/cpuintrf.h +++ b/src/emu/cpuintrf.h @@ -166,16 +166,16 @@ enum /* get_reg/set_reg constants */ enum { - /* This value is passed to activecpu_get_reg to retrieve the previous + /* This value is passed to cpu_get_reg to retrieve the previous * program counter value, ie. before a CPU emulation started * to fetch opcodes and arguments for the current instrution. */ REG_PREVIOUSPC = CPUINFO_INT_PREVIOUSPC - CPUINFO_INT_REGISTER, - /* This value is passed to activecpu_get_reg to retrieve the current + /* This value is passed to cpu_get_reg to retrieve the current * program counter value. */ REG_PC = CPUINFO_INT_PC - CPUINFO_INT_REGISTER, - /* This value is passed to activecpu_get_reg to retrieve the current + /* This value is passed to cpu_get_reg to retrieve the current * stack pointer value. */ REG_SP = CPUINFO_INT_SP - CPUINFO_INT_REGISTER }; @@ -690,12 +690,6 @@ char *cpuintrf_temp_str(void); /* ----- live context control ----- */ -/* remember the current context and push a new one on the stack */ -void cpu_push_context(const device_config *cpu); - -/* restore the previously saved context */ -void cpu_pop_context(void); - /* find a CPU in the machine by searching */ int cpu_get_index_slow(const device_config *cpu); diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 2e76b1240e1..e267e745406 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -1491,13 +1491,11 @@ static void execute_save(running_machine *machine, int ref, int params, const ch } /* now write the data out */ - cpu_push_context(space->cpu); for (i = offset; i <= endoffset; i++) { UINT8 byte = debug_read_byte(space, i, TRUE); fwrite(&byte, 1, 1, f); } - cpu_pop_context(); /* close the file */ fclose(f); @@ -1550,7 +1548,6 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch } /* now write the data out */ - cpu_push_context(space->cpu); for (i = offset; i <= endoffset; i += 16) { char output[200]; @@ -1659,7 +1656,6 @@ static void execute_dump(running_machine *machine, int ref, int params, const ch /* output the result */ fprintf(f, "%s\n", output); } - cpu_pop_context(); /* close the file */ fclose(f); @@ -1733,7 +1729,6 @@ static void execute_find(running_machine *machine, int ref, int params, const ch } /* now search */ - cpu_push_context(space->cpu); for (i = offset; i <= endoffset; i += data_size[0]) { int suboffset = 0; @@ -1760,7 +1755,6 @@ static void execute_find(running_machine *machine, int ref, int params, const ch debug_console_printf(machine, "Found at %*X\n", space->logaddrchars, (UINT32)memory_byte_to_address(space, i)); } } - cpu_pop_context(); /* print something if not found */ if (found == 0) @@ -1809,7 +1803,6 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch } /* now write the data out */ - cpu_push_context(space->cpu); for (i = 0; i < length; ) { int pcbyte = memory_address_to_byte(space, offset + i) & space->bytemask; @@ -1898,7 +1891,6 @@ static void execute_dasm(running_machine *machine, int ref, int params, const ch /* output the result */ fprintf(f, "%s\n", output); } - cpu_pop_context(); /* close the file */ fclose(f); @@ -2011,7 +2003,6 @@ static void execute_history(running_machine *machine, int ref, int params, const cpuinfo = cpu_get_debug_data(space->cpu); /* loop over lines */ - cpu_push_context(space->cpu); for (i = 0; i < count; i++) { offs_t pc = cpuinfo->pc_history[(cpuinfo->pc_history_index + DEBUG_HISTORY_SIZE - count + i) % DEBUG_HISTORY_SIZE]; @@ -2033,7 +2024,6 @@ static void execute_history(running_machine *machine, int ref, int params, const debug_console_printf(machine, "%0*X: %s\n", space->logaddrchars, pc, buffer); } - cpu_pop_context(); } diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index d0774995e9c..cbbf2dd04fb 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -2350,7 +2350,6 @@ static UINT64 expression_read_address_space(const address_space *space, offs_t a address = memory_address_to_byte(space, address); /* switch contexts and do the read */ - cpu_push_context(space->cpu); switch (size) { case 1: result = debug_read_byte(space, address, TRUE); break; @@ -2358,7 +2357,6 @@ static UINT64 expression_read_address_space(const address_space *space, offs_t a case 4: result = debug_read_dword(space, address, TRUE); break; case 8: result = debug_read_qword(space, address, TRUE); break; } - cpu_pop_context(); } return result; } @@ -2558,7 +2556,6 @@ static void expression_write_address_space(const address_space *space, offs_t ad address = memory_address_to_byte(space, address); /* switch contexts and do the write */ - cpu_push_context(space->cpu); switch (size) { case 1: debug_write_byte(space, address, data, TRUE); break; @@ -2566,7 +2563,6 @@ static void expression_write_address_space(const address_space *space, offs_t ad case 4: debug_write_dword(space, address, data, TRUE); break; case 8: debug_write_qword(space, address, data, TRUE); break; } - cpu_pop_context(); } } diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index 8b24c24621e..54dfe774803 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -1963,9 +1963,6 @@ static void disasm_view_update(debug_view *view) pc = cpu_get_pc(space->cpu); pcbyte = memory_address_to_byte(space, pc) & space->logbytemask; - /* switch to the CPU's context */ - cpu_push_context(space->cpu); - /* if our expression is dirty, fix it */ if (dasmdata->expression.dirty) { @@ -2138,9 +2135,6 @@ recompute: col++; } } - - /* restore the original CPU context */ - cpu_pop_context(); } @@ -2624,10 +2618,6 @@ static void memory_view_update(debug_view *view) /* get positional data */ posdata = &memory_pos_table[memdata->bytes_per_chunk]; - /* switch to the CPU's context */ - if (space != NULL) - cpu_push_context(space->cpu); - /* loop over visible rows */ for (row = 0; row < view->visible.y; row++) { @@ -2696,10 +2686,6 @@ static void memory_view_update(debug_view *view) } } } - - /* restore the context */ - if (memdata->desc->base == NULL) - cpu_pop_context(); } @@ -3019,7 +3005,6 @@ static UINT64 memory_view_read(debug_view_memory *memdata, UINT8 size, offs_t of const address_space *space = memdata->desc->space; UINT64 result = ~(UINT64)0; - cpu_push_context(space->cpu); switch (size) { case 1: result = debug_read_byte(space, offs, !memdata->no_translation); break; @@ -3027,7 +3012,6 @@ static UINT64 memory_view_read(debug_view_memory *memdata, UINT8 size, offs_t of case 4: result = debug_read_dword(space, offs, !memdata->no_translation); break; case 8: result = debug_read_qword(space, offs, !memdata->no_translation); break; } - cpu_pop_context(); return result; } @@ -3061,7 +3045,6 @@ static void memory_view_write(debug_view_memory *memdata, UINT8 size, offs_t off { const address_space *space = memdata->desc->space; - cpu_push_context(space->cpu); switch (size) { case 1: debug_write_byte(space, offs, data, !memdata->no_translation); break; @@ -3069,7 +3052,6 @@ static void memory_view_write(debug_view_memory *memdata, UINT8 size, offs_t off case 4: debug_write_dword(space, offs, data, !memdata->no_translation); break; case 8: debug_write_qword(space, offs, data, !memdata->no_translation); break; } - cpu_pop_context(); return; } diff --git a/src/emu/machine/6522via.c b/src/emu/machine/6522via.c index 9ff4cced61c..cc56102dc26 100644 --- a/src/emu/machine/6522via.c +++ b/src/emu/machine/6522via.c @@ -178,7 +178,7 @@ static void via_set_int (running_machine *machine, int which, int data) v->ifr |= data; #ifdef TRACE_VIA -logerror("6522VIA chip %d: IFR = %02X. PC: %08X\n", which, v->ifr, safe_cpu_get_pc(machine->activecpu)); +logerror("%s:6522VIA chip %d: IFR = %02X\n", cpuexec_describe_context(machine), which, v->ifr); #endif if (v->ier & v->ifr) @@ -187,7 +187,7 @@ logerror("6522VIA chip %d: IFR = %02X. PC: %08X\n", which, v->ifr, safe_cpu_get if (v->intf->irq_func) (*v->intf->irq_func)(machine, ASSERT_LINE); else - logerror("6522VIA chip %d: Interrupt is asserted but there is no callback function. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Interrupt is asserted but there is no callback function\n", cpuexec_describe_context(machine), which); } } @@ -198,7 +198,7 @@ static void via_clear_int (running_machine *machine, int which, int data) v->ifr = (v->ifr & ~data) & 0x7f; #ifdef TRACE_VIA -logerror("6522VIA chip %d: IFR = %02X. PC: %08X\n", which, v->ifr, safe_cpu_get_pc(machine->activecpu)); +logerror("%s:6522VIA chip %d: IFR = %02X\n", cpuexec_describe_context(machine), which, v->ifr); #endif if (v->ifr & v->ier) @@ -208,7 +208,7 @@ logerror("6522VIA chip %d: IFR = %02X. PC: %08X\n", which, v->ifr, safe_cpu_get if (v->intf->irq_func) (*v->intf->irq_func)(machine, CLEAR_LINE); // else -// logerror("6522VIA chip %d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); +// logerror("%s:6522VIA chip %d: Interrupt is cleared but there is no callback function\n", cpuexec_describe_context(machine), which); } } @@ -343,7 +343,7 @@ static TIMER_CALLBACK( via_t1_timeout ) if (v->intf->out_b_func) v->intf->out_b_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port B is being written to but has no handler. %02X\n", cpuexec_describe_context(machine), which, write_data); } if (!(v->ifr & INT_T1)) @@ -411,7 +411,7 @@ int via_read(running_machine *machine, int which, int offset) if (v->intf->in_b_func) v->in_b = v->intf->in_b_func(space, 0); else - logerror("6522VIA chip %d: Port B is being read but has no handler. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Port B is being read but has no handler\n", cpuexec_describe_context(machine), which); } CLR_PB_INT(v, which); @@ -430,7 +430,7 @@ int via_read(running_machine *machine, int which, int offset) if (v->intf->in_a_func) v->in_a = v->intf->in_a_func(space, 0); else - logerror("6522VIA chip %d: Port A is being read but has no handler. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Port A is being read but has no handler\n", cpuexec_describe_context(machine), which); } /* combine input and output values */ @@ -451,7 +451,7 @@ int via_read(running_machine *machine, int which, int offset) if (v->intf->out_ca2_func) v->intf->out_ca2_func(space, 0, 0); else - logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), 0); + logerror("%s:6522VIA chip %d: Port CA2 is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, 0); } } @@ -464,7 +464,7 @@ int via_read(running_machine *machine, int which, int offset) if (v->intf->in_a_func) v->in_a = v->intf->in_a_func(space, 0); else - logerror("6522VIA chip %d: Port A is being read but has no handler. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Port A is being read but has no handler\n", cpuexec_describe_context(machine), which); } /* combine input and output values */ @@ -576,7 +576,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_b_func) v->intf->out_b_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port B is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, write_data); } CLR_PB_INT(v, which); @@ -594,7 +594,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_cb2_func) v->intf->out_cb2_func(space, 0, 0); else - logerror("6522VIA chip %d: Port CB2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), 0); + logerror("%s:6522VIA chip %d: Port CB2 is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, 0); } } break; @@ -609,7 +609,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_a_func) v->intf->out_a_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port A is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port A is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, write_data); } CLR_PA_INT(v, which); @@ -625,7 +625,7 @@ void via_write(running_machine *machine, int which, int offset, int data) v->intf->out_ca2_func(space, 0, 1); } else - logerror("6522VIA chip %d: Port CA2 is being pulsed but has no handler. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Port CA2 is being pulsed but has no handler\n", cpuexec_describe_context(machine), which); /* set CA2 (shouldn't be needed) */ v->out_ca2 = 1; @@ -641,7 +641,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_ca2_func) v->intf->out_ca2_func(space, 0, 0); else - logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), 0); + logerror("%s:6522VIA chip %d: Port CA2 is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, 0); } } @@ -657,7 +657,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_a_func) v->intf->out_a_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port A is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port A is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, write_data); } break; @@ -675,7 +675,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_b_func) v->intf->out_b_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port B is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, write_data); } } break; @@ -693,7 +693,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_a_func) v->intf->out_a_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port A is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port A is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, write_data); } } break; @@ -725,7 +725,7 @@ void via_write(running_machine *machine, int which, int offset, int data) if (v->intf->out_b_func) v->intf->out_b_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port B is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, write_data); } } timer_adjust_oneshot(v->t1, v_cycles_to_time(v, TIMER1_VALUE(v) + IFR_DELAY), which); @@ -766,7 +766,7 @@ void via_write(running_machine *machine, int which, int offset, int data) case VIA_PCR: v->pcr = data; #ifdef TRACE_VIA -logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_cpu_get_pc(machine->activecpu)); +logerror("%s:6522VIA chip %d: PCR = %02X\n", cpuexec_describe_context(machine), which, data); #endif if (CA2_FIX_OUTPUT(data) && CA2_OUTPUT_LEVEL(data) ^ v->out_ca2) @@ -775,7 +775,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_cpu_get_p if (v->intf->out_ca2_func) v->intf->out_ca2_func(space, 0, v->out_ca2); else - logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), v->out_ca2); + logerror("%s:6522VIA chip %d: Port CA2 is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, v->out_ca2); } if (CB2_FIX_OUTPUT(data) && CB2_OUTPUT_LEVEL(data) ^ v->out_cb2) @@ -784,7 +784,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_cpu_get_p if (v->intf->out_cb2_func) v->intf->out_cb2_func(space, 0, v->out_cb2); else - logerror("6522VIA chip %d: Port CB2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), v->out_cb2); + logerror("%s:6522VIA chip %d: Port CB2 is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, v->out_cb2); } break; @@ -806,7 +806,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_cpu_get_p if (v->intf->out_b_func) v->intf->out_b_func(space, 0, write_data); else - logerror("6522VIA chip %d: Port B is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), write_data); + logerror("%s:6522VIA chip %d: Port B is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, write_data); } } if (T1_CONTINUOUS(data)) @@ -831,7 +831,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_cpu_get_p if (v->intf->irq_func) (*v->intf->irq_func)(machine, CLEAR_LINE); // else -// logerror("6522VIA chip %d: Interrupt is cleared but there is no callback function. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); +// logerror("%s:6522VIA chip %d: Interrupt is cleared but there is no callback function\n", cpuexec_describe_context(machine), which); } } else @@ -842,7 +842,7 @@ logerror("6522VIA chip %d: PCR = %02X. PC: %08X\n", which, data, safe_cpu_get_p if (v->intf->irq_func) (*v->intf->irq_func)(machine, ASSERT_LINE); else - logerror("6522VIA chip %d: Interrupt is asserted but there is no callback function. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Interrupt is asserted but there is no callback function\n", cpuexec_describe_context(machine), which); } } break; @@ -880,7 +880,7 @@ void via_set_input_ca1(running_machine *machine, int which, int data) if (data != v->in_ca1) { #ifdef TRACE_VIA -logerror("6522VIA chip %d: CA1 = %02X. PC: %08X\n", which, data, safe_cpu_get_pc(machine->activecpu)); +logerror("%s:6522VIA chip %d: CA1 = %02X\n", cpuexec_describe_context(machine), which, data); #endif if ((CA1_LOW_TO_HIGH(v->pcr) && data) || (CA1_HIGH_TO_LOW(v->pcr) && !data)) { @@ -889,7 +889,7 @@ logerror("6522VIA chip %d: CA1 = %02X. PC: %08X\n", which, data, safe_cpu_get_p if (v->intf->in_a_func) v->in_a = v->intf->in_a_func(space, 0); else - logerror("6522VIA chip %d: Port A is being read but has no handler. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Port A is being read but has no handler\n", cpuexec_describe_context(machine), which); } via_set_int (machine, which, INT_CA1); @@ -907,7 +907,7 @@ logerror("6522VIA chip %d: CA1 = %02X. PC: %08X\n", which, data, safe_cpu_get_p if (v->intf->out_ca2_func) v->intf->out_ca2_func(space, 0, 1); else - logerror("6522VIA chip %d: Port CA2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), 1); + logerror("%s:6522VIA chip %d: Port CA2 is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, 1); } } } @@ -978,7 +978,7 @@ void via_set_input_cb1(running_machine *machine, int which, int data) if (v->intf->in_b_func) v->in_b = v->intf->in_b_func(space, 0); else - logerror("6522VIA chip %d: Port B is being read but has no handler. PC: %08X\n", which, safe_cpu_get_pc(machine->activecpu)); + logerror("%s:6522VIA chip %d: Port B is being read but has no handler\n", cpuexec_describe_context(machine), which); } if (SO_EXT_CONTROL(v->acr) || SI_EXT_CONTROL(v->acr)) via_shift (machine, which); @@ -998,7 +998,7 @@ void via_set_input_cb1(running_machine *machine, int which, int data) if (v->intf->out_cb2_func) v->intf->out_cb2_func(space, 0, 1); else - logerror("6522VIA chip %d: Port CB2 is being written to but has no handler. PC: %08X - %02X\n", which, safe_cpu_get_pc(machine->activecpu), 1); + logerror("%s:6522VIA chip %d: Port CB2 is being written to but has no handler - %02X\n", cpuexec_describe_context(machine), which, 1); } } } diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 0f1824ce7ab..368466e79fd 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -100,7 +100,7 @@ INLINE void update_irqstate(const device_config *device) if (riot->intf->irq_func != NULL) (*riot->intf->irq_func)(device, (state != 0) ? ASSERT_LINE : CLEAR_LINE); else - logerror("6532RIOT chip #%d: no irq callback function. PC: %08X\n", riot->index, safe_cpu_get_pc(device->machine->activecpu)); + logerror("%s:6532RIOT chip #%d: no irq callback function\n", cpuexec_describe_context(device->machine), riot->index); } @@ -263,7 +263,7 @@ WRITE8_DEVICE_HANDLER( riot6532_w ) if (port->out_func != NULL) (*port->out_func)(device, data, olddata); else - logerror("6532RIOT chip %s: Port %c is being written to but has no handler. PC: %08X - %02X\n", device->tag, 'A' + (offset & 1), safe_cpu_get_pc(device->machine->activecpu), data); + logerror("%s:6532RIOT chip %s: Port %c is being written to but has no handler. %02X\n", cpuexec_describe_context(device->machine), device->tag, 'A' + (offset & 1), data); } /* writes to port A need to update the PA7 state */ @@ -332,7 +332,7 @@ READ8_DEVICE_HANDLER( riot6532_r ) update_pa7_state(device); } else - logerror("6532RIOT chip %s: Port %c is being read but has no handler. PC: %08X\n", device->tag, 'A' + (offset & 1), safe_cpu_get_pc(device->machine->activecpu)); + logerror("%s:6532RIOT chip %s: Port %c is being read but has no handler\n", cpuexec_describe_context(device->machine), device->tag, 'A' + (offset & 1)); /* apply the DDR to the result */ val = apply_ddr(port); diff --git a/src/emu/machine/6840ptm.c b/src/emu/machine/6840ptm.c index 5161905f2cb..d5f4faa8c6b 100644 --- a/src/emu/machine/6840ptm.c +++ b/src/emu/machine/6840ptm.c @@ -473,7 +473,7 @@ int ptm6840_read(running_machine *machine, int which, int offset) case PTM_6840_STATUS: { - PLOG(("%06X: MC6840 #%d: Status read = %04X\n", cpu_get_previouspc(machine->activecpu), which, currptr->status_reg)); + PLOG(("%s: MC6840 #%d: Status read = %04X\n", cpuexec_describe_context(machine), which, currptr->status_reg)); currptr->status_read_since_int |= currptr->status_reg & 0x07; val = currptr->status_reg; break; @@ -495,7 +495,7 @@ int ptm6840_read(running_machine *machine, int which, int offset) currptr->lsb_buffer = result & 0xff; - PLOG(("%06X: MC6840 #%d: Counter %d read = %04X\n", cpu_get_previouspc(machine->activecpu), which, idx, result >> 8)); + PLOG(("%s: MC6840 #%d: Counter %d read = %04X\n", cpuexec_describe_context(machine), which, idx, result >> 8)); val = result >> 8; break; } @@ -613,7 +613,7 @@ void ptm6840_write (running_machine *machine, int which, int offset, int data) if (!(currptr->control_reg[idx] & 0x10)) reload_count(machine, which,idx); - PLOG(("%06X:MC6840 #%d: Counter %d latch = %04X\n", cpu_get_previouspc(machine->activecpu), which, idx, currptr->latch[idx])); + PLOG(("%s:MC6840 #%d: Counter %d latch = %04X\n", cpuexec_describe_context(machine), which, idx, currptr->latch[idx])); break; } } diff --git a/src/emu/machine/6850acia.c b/src/emu/machine/6850acia.c index 9ef0582cf3e..64cf43d7ad7 100644 --- a/src/emu/machine/6850acia.c +++ b/src/emu/machine/6850acia.c @@ -422,7 +422,7 @@ WRITE8_DEVICE_HANDLER( acia6850_data_w ) } else { - logerror("ACIA %p: Data write while in reset! (%x)\n", device, cpu_get_previouspc(device->machine->activecpu)); + logerror("%s:ACIA %p: Data write while in reset!\n", cpuexec_describe_context(device->machine), device); } } diff --git a/src/emu/machine/adc083x.c b/src/emu/machine/adc083x.c index 496f9b01efa..8340aadb15f 100644 --- a/src/emu/machine/adc083x.c +++ b/src/emu/machine/adc083x.c @@ -21,14 +21,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/emu/machine/at28c16.c b/src/emu/machine/at28c16.c index 396c3202ce3..674e4dac9c9 100644 --- a/src/emu/machine/at28c16.c +++ b/src/emu/machine/at28c16.c @@ -50,11 +50,11 @@ WRITE8_DEVICE_HANDLER( at28c16_w ) if( c->last_write >= 0 ) { -// logerror( "%08x: at28c16_write( %d, %04x, %02x ) busy\n", cpu_get_pc(machine->activecpu), chip, offset, data ); +// logerror( "%s: at28c16_write( %d, %04x, %02x ) busy\n", cpuexec_describe_context(machine), chip, offset, data ); } else if( c->oe_12v ) { -// logerror( "%08x: at28c16_write( %d, %04x, %02x ) erase\n", cpu_get_pc(machine->activecpu), chip, offset, data ); +// logerror( "%s: at28c16_write( %d, %04x, %02x ) erase\n", cpuexec_describe_context(machine), chip, offset, data ); memset( c->data, 0xff, SIZE_DATA ); memset( c->id, 0xff, SIZE_ID ); c->last_write = 0xff; @@ -62,14 +62,14 @@ WRITE8_DEVICE_HANDLER( at28c16_w ) } else if( offset >= OFFSET_ID && c->a9_12v ) { -// logerror( "%08x: at28c16_write( %d, %04x, %02x ) id\n", cpu_get_pc(machine->activecpu), chip, offset, data ); +// logerror( "%s: at28c16_write( %d, %04x, %02x ) id\n", cpuexec_describe_context(machine), chip, offset, data ); c->id[ offset - OFFSET_ID ] = data; c->last_write = data; timer_adjust_oneshot( c->write_timer, ATTOTIME_IN_USEC( 200 ), 0 ); } else { -// logerror( "%08x: at28c16_write( %d, %04x, %02x ) data\n", cpu_get_pc(machine->activecpu), chip, offset, data ); +// logerror( "%s: at28c16_write( %d, %04x, %02x ) data\n", cpuexec_describe_context(machine), chip, offset, data ); c->data[ offset ] = data; c->last_write = data; timer_adjust_oneshot( c->write_timer, ATTOTIME_IN_USEC( 200 ), 0 ); @@ -93,7 +93,7 @@ READ8_DEVICE_HANDLER( at28c16_r ) } else { -// logerror( "%08x: at28c16_read( %d, %04x ) %02x data\n", cpu_get_pc(machine->activecpu), chip, offset, c->data[ offset ] ); +// logerror( "%s: at28c16_read( %d, %04x ) %02x data\n", cpuexec_describe_context(machine), chip, offset, c->data[ offset ] ); return c->data[ offset ]; } } diff --git a/src/emu/machine/ds2401.c b/src/emu/machine/ds2401.c index b093c67030b..f77162e3a59 100644 --- a/src/emu/machine/ds2401.c +++ b/src/emu/machine/ds2401.c @@ -23,14 +23,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c index 9ead94da52f..bd850f9efaa 100644 --- a/src/emu/machine/i2cmem.c +++ b/src/emu/machine/i2cmem.c @@ -35,14 +35,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index ff11c1f0274..907f4b90f3e 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -1182,7 +1182,7 @@ static UINT32 ide_controller_read(const device_config *device, offs_t offset, in /* logit */ // if (offset != IDE_ADDR_DATA && offset != IDE_ADDR_STATUS_COMMAND && offset != IDE_ADDR_STATUS_CONTROL) - LOG(("%08X:IDE read at %03X, size=%d\n", cpu_get_previouspc(device->machine->activecpu), offset, size)); + LOG(("%s:IDE read at %03X, size=%d\n", cpuexec_describe_context(device->machine), offset, size)); switch (offset) { @@ -1217,7 +1217,7 @@ static UINT32 ide_controller_read(const device_config *device, offs_t offset, in /* if we're at the end of the buffer, handle it */ if (ide->buffer_offset >= IDE_DISK_SECTOR_SIZE) { - LOG(("%08X:IDE completed PIO read\n", cpu_get_previouspc(device->machine->activecpu))); + LOG(("%s:IDE completed PIO read\n", cpuexec_describe_context(device->machine))); continue_read(ide); } } @@ -1264,14 +1264,11 @@ static UINT32 ide_controller_read(const device_config *device, offs_t offset, in if (ide->interrupt_pending) clear_interrupt(ide); } - - /* take a bit of time to speed up people who poll hard */ - cpu_adjust_icount(device->machine->activecpu, -100); break; /* log anything else */ default: - logerror("%08X:unknown IDE read at %03X, size=%d\n", cpu_get_previouspc(device->machine->activecpu), offset, size); + logerror("%s:unknown IDE read at %03X, size=%d\n", cpuexec_describe_context(device->machine), offset, size); break; } @@ -1293,7 +1290,7 @@ static void ide_controller_write(const device_config *device, offs_t offset, int /* logit */ if (offset != IDE_ADDR_DATA) - LOG(("%08X:IDE write to %03X = %08X, size=%d\n", cpu_get_previouspc(device->machine->activecpu), offset, data, size)); + LOG(("%s:IDE write to %03X = %08X, size=%d\n", cpuexec_describe_context(device->machine), offset, data, size)); switch (offset) { @@ -1330,7 +1327,7 @@ static void ide_controller_write(const device_config *device, offs_t offset, int /* if we're at the end of the buffer, handle it */ if (ide->buffer_offset >= IDE_DISK_SECTOR_SIZE) { - LOG(("%08X:IDE completed PIO write\n", cpu_get_previouspc(device->machine->activecpu))); + LOG(("%s:IDE completed PIO write\n", cpuexec_describe_context(device->machine))); if (ide->command != IDE_COMMAND_SECURITY_UNLOCK) continue_write(ide); else @@ -1440,7 +1437,7 @@ static UINT32 ide_bus_master_read(const device_config *device, offs_t offset, in { ide_state *ide = get_safe_token(device); - LOG(("%08X:ide_bus_master_read(%d, %d)\n", cpu_get_previouspc(device->machine->activecpu), offset, size)); + LOG(("%s:ide_bus_master_read(%d, %d)\n", cpuexec_describe_context(device->machine), offset, size)); /* command register */ if (offset == 0) @@ -1469,7 +1466,7 @@ static void ide_bus_master_write(const device_config *device, offs_t offset, int { ide_state *ide = get_safe_token(device); - LOG(("%08X:ide_bus_master_write(%d, %d, %08X)\n", cpu_get_previouspc(device->machine->activecpu), offset, size, data)); + LOG(("%s:ide_bus_master_write(%d, %d, %08X)\n", cpuexec_describe_context(device->machine), offset, size, data)); /* command register */ if (offset == 0) diff --git a/src/emu/machine/intelfsh.c b/src/emu/machine/intelfsh.c index 552cb3af9dd..2a80103b801 100644 --- a/src/emu/machine/intelfsh.c +++ b/src/emu/machine/intelfsh.c @@ -212,7 +212,7 @@ UINT32 intelflash_read(int chip, UINT32 address) break; } -// logerror( "%08x: intelflash_read( %d, %08x ) %08x\n", cpu_get_pc(machine->activecpu), chip, address, data ); +// logerror( "%s: intelflash_read( %d, %08x ) %08x\n", cpuexec_describe_context(machine), chip, address, data ); return data; } @@ -227,7 +227,7 @@ void intelflash_write(int chip, UINT32 address, UINT32 data) } c = &chips[ chip ]; -// logerror( "%08x: intelflash_write( %d, %08x, %08x )\n", cpu_get_pc(machine->activecpu), chip, address, data ); +// logerror( "%s: intelflash_write( %d, %08x, %08x )\n", cpuexec_describe_context(machine), chip, address, data ); switch( c->flash_mode ) { diff --git a/src/emu/machine/ldv1000.c b/src/emu/machine/ldv1000.c index 72ff2fb1241..ceeea0ff6cb 100644 --- a/src/emu/machine/ldv1000.c +++ b/src/emu/machine/ldv1000.c @@ -538,7 +538,7 @@ static WRITE8_DEVICE_HANDLER( ppi0_porta_w ) laserdisc_state *ld = find_ldv1000(device->machine); ld->player->counter_start = data; if (LOG_PORT_IO) - printf("%04X:PORTA.0=%02X\n", cpu_get_pc(device->machine->activecpu), data); + printf("%s:PORTA.0=%02X\n", cpuexec_describe_context(device->machine), data); } @@ -601,7 +601,7 @@ static WRITE8_DEVICE_HANDLER( ppi0_portc_w ) player->portc0 = data; if (LOG_PORT_IO && ((data ^ prev) & 0x0f) != 0) { - printf("%04X:PORTC.0=%02X", cpu_get_pc(device->machine->activecpu), data); + printf("%s:PORTC.0=%02X", cpuexec_describe_context(device->machine), data); if (data & 0x01) printf(" PRELOAD"); if (!(data & 0x02)) printf(" /MULTIJUMP"); if (data & 0x04) printf(" SCANMODE"); @@ -697,7 +697,7 @@ static WRITE8_DEVICE_HANDLER( ppi1_portb_w ) player->portb1 = data; if (LOG_PORT_IO && ((data ^ prev) & 0xff) != 0) { - printf("%04X:PORTB.1=%02X:", cpu_get_pc(device->machine->activecpu), data); + printf("%s:PORTB.1=%02X:", cpuexec_describe_context(device->machine), data); if (!(data & 0x01)) printf(" FOCSON"); if (!(data & 0x02)) printf(" SPDLRUN"); if (!(data & 0x04)) printf(" JUMPTRIG"); @@ -753,7 +753,7 @@ static WRITE8_DEVICE_HANDLER( ppi1_portc_w ) player->portc1 = data; if (LOG_PORT_IO && ((data ^ prev) & 0xcf) != 0) { - printf("%04X:PORTC.1=%02X", cpu_get_pc(device->machine->activecpu), data); + printf("%s:PORTC.1=%02X", cpuexec_describe_context(device->machine), data); if (data & 0x01) printf(" AUD1"); if (data & 0x02) printf(" AUD2"); if (data & 0x04) printf(" AUDEN"); diff --git a/src/emu/machine/msm6242.c b/src/emu/machine/msm6242.c index b89ede04676..201e8c260b3 100644 --- a/src/emu/machine/msm6242.c +++ b/src/emu/machine/msm6242.c @@ -100,7 +100,7 @@ READ8_DEVICE_HANDLER( msm6242_r ) case MSM6242_REG_CF: return msm6242->reg[2]; } - logerror("%04x: MSM6242 unmapped offset %02x read\n", cpu_get_pc(device->machine->activecpu), offset); + logerror("%s: MSM6242 unmapped offset %02x read\n", cpuexec_describe_context(device->machine), offset); return 0; } @@ -141,7 +141,7 @@ WRITE8_DEVICE_HANDLER( msm6242_w ) } } - logerror("%04x: MSM6242 unmapped offset %02x written with %02x\n", cpu_get_pc(device->machine->activecpu), offset, data); + logerror("%s: MSM6242 unmapped offset %02x written with %02x\n", cpuexec_describe_context(device->machine), offset, data); } diff --git a/src/emu/machine/scsidev.c b/src/emu/machine/scsidev.c index 2f58f7fa359..460e1ad420c 100644 --- a/src/emu/machine/scsidev.c +++ b/src/emu/machine/scsidev.c @@ -28,7 +28,7 @@ static int scsidev_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) return 0; default: - logerror( "%08x: SCSIDEV unknown command %02x\n", cpu_get_pc(Machine->activecpu), command[ 0 ] ); + logerror( "%s: SCSIDEV unknown command %02x\n", cpuexec_describe_context(Machine), command[ 0 ] ); return 0; } } @@ -43,7 +43,7 @@ static void scsidev_read_data( SCSIInstance *scsiInstance, UINT8 *data, int data switch( command[ 0 ] ) { default: - logerror( "%08x: SCSIDEV unknown read %02x\n", cpu_get_pc(Machine->activecpu), command[ 0 ] ); + logerror( "%s: SCSIDEV unknown read %02x\n", cpuexec_describe_context(Machine), command[ 0 ] ); break; } } @@ -58,7 +58,7 @@ static void scsidev_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dat switch( command[ 0 ] ) { default: - logerror( "%08x: SCSIDEV unknown write %02x\n", cpu_get_pc(Machine->activecpu), command[ 0 ] ); + logerror( "%s: SCSIDEV unknown write %02x\n", cpuexec_describe_context(Machine), command[ 0 ] ); break; } } diff --git a/src/emu/machine/smc91c9x.c b/src/emu/machine/smc91c9x.c index 338e4b91a07..c70ee86374d 100644 --- a/src/emu/machine/smc91c9x.c +++ b/src/emu/machine/smc91c9x.c @@ -377,7 +377,7 @@ READ16_DEVICE_HANDLER( smc91c9x_r ) } if (LOG_ETHERNET && offset != EREG_BANK) - logerror("%08X:smc91c9x_r(%s) = %04X & %04X\n", cpu_get_pc(device->machine->activecpu), ethernet_regname[offset], result, mem_mask); + logerror("%s:smc91c9x_r(%s) = %04X & %04X\n", cpuexec_describe_context(device->machine), ethernet_regname[offset], result, mem_mask); return result; } @@ -402,7 +402,7 @@ WRITE16_DEVICE_HANDLER( smc91c9x_w ) COMBINE_DATA(&smc->reg[offset]); if (LOG_ETHERNET && offset != 7) - logerror("%08X:smc91c9x_w(%s) = %04X & %04X\n", cpu_get_pc(device->machine->activecpu), ethernet_regname[offset], data, mem_mask); + logerror("%s:smc91c9x_w(%s) = %04X & %04X\n", cpuexec_describe_context(device->machine), ethernet_regname[offset], data, mem_mask); /* handle it */ switch (offset) diff --git a/src/emu/machine/timekpr.c b/src/emu/machine/timekpr.c index acc9846ebbb..2f0f767aeb4 100644 --- a/src/emu/machine/timekpr.c +++ b/src/emu/machine/timekpr.c @@ -266,7 +266,7 @@ WRITE8_DEVICE_HANDLER( timekeeper_w ) data &= ~FLAGS_BL; } -// logerror( "%08x: timekeeper_write( %s, %04x, %02x )\n", cpu_get_pc(machine->activecpu), c->device->tag, offset, data ); +// logerror( "%s: timekeeper_write( %s, %04x, %02x )\n", cpuexec_describe_context(machine), c->device->tag, offset, data ); c->data[ offset ] = data; } @@ -274,7 +274,7 @@ READ8_DEVICE_HANDLER( timekeeper_r ) { timekeeper_state *c = get_safe_token(device); UINT8 data = c->data[ offset ]; -// logerror( "%08x: timekeeper_read( %s, %04x ) %02x\n", cpu_get_pc(machine->activecpu), c->device->tag, offset, data ); +// logerror( "%s: timekeeper_read( %s, %04x ) %02x\n", cpuexec_describe_context(machine), c->device->tag, offset, data ); return data; } diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c index 4d5930b094b..19ec2369a7f 100644 --- a/src/emu/machine/tmp68301.c +++ b/src/emu/machine/tmp68301.c @@ -23,7 +23,7 @@ static void tmp68301_update_timer( running_machine *machine, int i ); static IRQ_CALLBACK(tmp68301_irq_callback) { int vector = tmp68301_irq_vector[irqline]; -// logerror("CPU #0 PC %06X: irq callback returns %04X for level %x\n",cpu_get_pc(machine->activecpu),vector,int_level); +// logerror("%s: irq callback returns %04X for level %x\n",cpuexec_describe_context(machine),vector,int_level); return vector; } @@ -35,7 +35,7 @@ static TIMER_CALLBACK( tmp68301_timer_callback ) UINT16 ICR = tmp68301_regs[0x8e/2+i]; // Interrupt Controller Register (ICR7..9) UINT16 IVNR = tmp68301_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR) -// logerror("CPU #0 PC %06X: callback timer %04X, j = %d\n",cpu_get_pc(machine->activecpu),i,tcount); +// logerror("s: callback timer %04X, j = %d\n",cpuexec_describe_context(machine),i,tcount); if ( (TCR & 0x0004) && // INT !(IMR & (0x100<activecpu),i,duration,max); +// logerror("%s: TMP68301 Timer %d, duration %lf, max %04X\n",cpuexec_describe_context(machine),i,duration,max); if (!(TCR & 0x0002)) // CS { if (attotime_compare(duration, attotime_zero)) timer_adjust_oneshot(tmp68301_timer[i],duration,i); else - logerror("CPU #0 PC %06X: TMP68301 error, timer %d duration is 0\n",cpu_get_pc(machine->activecpu),i); + logerror("%s: TMP68301 error, timer %d duration is 0\n",cpuexec_describe_context(machine),i); } } diff --git a/src/emu/machine/wd33c93.c b/src/emu/machine/wd33c93.c index bdb787bbed1..ca58a3faae6 100644 --- a/src/emu/machine/wd33c93.c +++ b/src/emu/machine/wd33c93.c @@ -294,7 +294,7 @@ static void wd33c93_complete_cmd( UINT8 status ) /* command handlers */ static void wd33c93_invalid_cmd( void ) { - logerror( "Unknown/Unimplemented SCSI controller command: %02x (PC=%x)\n", scsi_data.regs[WD_COMMAND], cpu_get_pc(Machine->activecpu) ); + logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", cpuexec_describe_context(Machine), scsi_data.regs[WD_COMMAND] ); /* complete the command */ wd33c93_complete_cmd( CSR_INVALID ); diff --git a/src/emu/machine/x76f041.c b/src/emu/machine/x76f041.c index d9726d87e26..f36dc2e0fbe 100644 --- a/src/emu/machine/x76f041.c +++ b/src/emu/machine/x76f041.c @@ -26,14 +26,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/emu/machine/x76f100.c b/src/emu/machine/x76f100.c index 75d72a7fee0..6db1f83a8a0 100644 --- a/src/emu/machine/x76f100.c +++ b/src/emu/machine/x76f100.c @@ -24,14 +24,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/emu/machine/z80sio.c b/src/emu/machine/z80sio.c index fb72da6310f..a4c2c02e905 100644 --- a/src/emu/machine/z80sio.c +++ b/src/emu/machine/z80sio.c @@ -340,7 +340,7 @@ WRITE8_DEVICE_HANDLER( z80sio_c_w ) UINT8 old = chan->regs[reg]; if (reg != 0 || (reg & 0xf8)) - VPRINTF(("%04X:sio_reg_w(%c,%d) = %02X\n", cpu_get_pc(device->machine->activecpu), 'A' + ch, reg, data)); + VPRINTF(("%s:sio_reg_w(%c,%d) = %02X\n", cpuexec_describe_context(device->machine), 'A' + ch, reg, data)); /* write a new value to the selected register */ chan->regs[reg] = data; @@ -357,7 +357,7 @@ WRITE8_DEVICE_HANDLER( z80sio_c_w ) switch (data & SIO_WR0_COMMAND_MASK) { case SIO_WR0_COMMAND_CH_RESET: - VPRINTF(("%04X:SIO reset channel %c\n", cpu_get_pc(device->machine->activecpu), 'A' + ch)); + VPRINTF(("%s:SIO reset channel %c\n", cpuexec_describe_context(device->machine), 'A' + ch)); reset_channel(device, ch); break; @@ -424,7 +424,7 @@ READ8_DEVICE_HANDLER( z80sio_c_r ) break; } - VPRINTF(("%04X:sio_reg_r(%c,%d) = %02x\n", cpu_get_pc(device->machine->activecpu), 'A' + ch, reg, chan->status[reg])); + VPRINTF(("%s:sio_reg_r(%c,%d) = %02x\n", cpuexec_describe_context(device->machine), 'A' + ch, reg, chan->status[reg])); return chan->status[reg]; } @@ -446,7 +446,7 @@ WRITE8_DEVICE_HANDLER( z80sio_d_w ) int ch = offset & 1; sio_channel *chan = &sio->chan[ch]; - VPRINTF(("%04X:sio_data_w(%c) = %02X\n", cpu_get_pc(device->machine->activecpu), 'A' + ch, data)); + VPRINTF(("%s:sio_data_w(%c) = %02X\n", cpuexec_describe_context(device->machine), 'A' + ch, data)); /* if tx not enabled, just ignore it */ if (!(chan->regs[5] & SIO_WR5_TX_ENABLE)) @@ -481,7 +481,7 @@ READ8_DEVICE_HANDLER( z80sio_d_r ) sio->int_state[INT_CHA_RECEIVE - 4*ch] &= ~Z80_DAISY_INT; interrupt_check(device); - VPRINTF(("%04X:sio_data_r(%c) = %02X\n", cpu_get_pc(device->machine->activecpu), 'A' + ch, chan->inbuf)); + VPRINTF(("%s:sio_data_r(%c) = %02X\n", cpuexec_describe_context(device->machine), 'A' + ch, chan->inbuf)); return chan->inbuf; } diff --git a/src/emu/mame.c b/src/emu/mame.c index 98e5b7766d6..a5f654f18dd 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -230,6 +230,26 @@ static void logfile_callback(running_machine *machine, const char *buffer); +/*************************************************************************** + CORE IMPLEMENTATION +***************************************************************************/ + +/*------------------------------------------------- + eat_all_cpu_cycles - eat a ton of cycles on + all CPUs to force a quick exit +-------------------------------------------------*/ + +INLINE void eat_all_cpu_cycles(running_machine *machine) +{ + int cpunum; + + for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++) + if (machine->cpu[cpunum] != NULL) + cpu_eat_cycles(machine->cpu[cpunum], 1000000000); +} + + + /*************************************************************************** CORE IMPLEMENTATION ***************************************************************************/ @@ -559,8 +579,7 @@ void mame_schedule_exit(running_machine *machine) mame->exit_pending = TRUE; /* if we're executing, abort out immediately */ - if (machine->activecpu != NULL) - cpu_eat_cycles(machine->activecpu, 1000000000); + eat_all_cpu_cycles(machine); /* if we're autosaving on exit, schedule a save as well */ if (options_get_bool(mame_options(), OPTION_AUTOSAVE) && (machine->gamedrv->flags & GAME_SUPPORTS_SAVE)) @@ -579,8 +598,7 @@ void mame_schedule_hard_reset(running_machine *machine) mame->hard_reset_pending = TRUE; /* if we're executing, abort out immediately */ - if (machine->activecpu != NULL) - cpu_eat_cycles(machine->activecpu, 1000000000); + eat_all_cpu_cycles(machine); } @@ -599,8 +617,7 @@ void mame_schedule_soft_reset(running_machine *machine) mame_pause(machine, FALSE); /* if we're executing, abort out immediately */ - if (machine->activecpu != NULL) - cpu_eat_cycles(machine->activecpu, 1000000000); + eat_all_cpu_cycles(machine); } @@ -616,8 +633,7 @@ void mame_schedule_new_driver(running_machine *machine, const game_driver *drive mame->new_driver_pending = driver; /* if we're executing, abort out immediately */ - if (machine->activecpu != NULL) - cpu_eat_cycles(machine->activecpu, 1000000000); + eat_all_cpu_cycles(machine); } @@ -1732,14 +1748,10 @@ static void handle_save(running_machine *machine) for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++) if (machine->cpu[cpunum] != NULL) { - cpu_push_context(machine->cpu[cpunum]); - /* save the CPU data */ state_save_push_tag(cpunum + 1); state_save_save_continue(machine); state_save_pop_tag(); - - cpu_pop_context(); } /* finish and close */ @@ -1812,14 +1824,10 @@ static void handle_load(running_machine *machine) for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++) if (machine->cpu[cpunum] != NULL) { - cpu_push_context(machine->cpu[cpunum]); - /* load the CPU data */ state_save_push_tag(cpunum + 1); state_save_load_continue(machine); state_save_pop_tag(); - - cpu_pop_context(); } /* finish and close */ diff --git a/src/emu/mame.h b/src/emu/mame.h index f791ff5857c..ce872636026 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -126,6 +126,7 @@ typedef void (*output_callback_func)(void *param, const char *format, va_list ar /* forward type declarations */ typedef struct _mame_private mame_private; +typedef struct _cpuexec_private cpuexec_private; typedef struct _timer_private timer_private; typedef struct _state_private state_private; typedef struct _memory_private memory_private; @@ -148,7 +149,6 @@ struct _running_machine const input_port_config *portconfig; /* points to a list of input port configurations */ /* CPU information */ - const device_config * activecpu; /* active CPU (or NULL) -- deprecated soon */ const device_config * cpu[MAX_CPU]; /* array of CPU devices */ /* game-related information */ @@ -173,6 +173,7 @@ struct _running_machine /* internal core information */ mame_private * mame_data; /* internal data from mame.c */ + cpuexec_private * cpuexec_data; /* internal data from cpuexec.c */ timer_private * timer_data; /* internal data from timer.c */ state_private * state_data; /* internal data from state.c */ memory_private * memory_data; /* internal data from memory.c */ diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c index 64189b0e5ac..e63b81ec0a5 100644 --- a/src/emu/sound/ay8910.c +++ b/src/emu/sound/ay8910.c @@ -104,6 +104,7 @@ has twice the steps, happening twice as fast. #include "deprecat.h" #include "streams.h" #include "cpuintrf.h" +#include "cpuexec.h" #include "ay8910.h" /************************************* @@ -800,7 +801,7 @@ int ay8910_read_ym(void *chip) if (psg->intf->portAread) psg->regs[AY_PORTA] = (*psg->intf->portAread)(space, 0); else - logerror("PC %04x: warning - read 8910 '%s' Port A\n",cpu_get_pc(Machine->activecpu),psg->device->tag); + logerror("%s: warning - read 8910 '%s' Port A\n",cpuexec_describe_context(Machine),psg->device->tag); break; case AY_PORTB: if ((psg->regs[AY_ENABLE] & 0x80) != 0) @@ -808,7 +809,7 @@ int ay8910_read_ym(void *chip) if (psg->intf->portBread) psg->regs[AY_PORTB] = (*psg->intf->portBread)(space, 0); else - logerror("PC %04x: warning - read 8910 '%s' Port B\n",cpu_get_pc(Machine->activecpu),psg->device->tag); + logerror("%s: warning - read 8910 '%s' Port B\n",cpuexec_describe_context(Machine),psg->device->tag); break; } return psg->regs[r]; diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c index e728f511d7e..a21e9e32140 100644 --- a/src/emu/sound/es5506.c +++ b/src/emu/sound/es5506.c @@ -12,6 +12,7 @@ #include "deprecat.h" #include "streams.h" #include "cpuintrf.h" +#include "cpuexec.h" #include "es5506.h" @@ -1564,7 +1565,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo } if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, control=%04x (raw=%04x & %04x)\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff); + fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->control, data, mem_mask ^ 0xffff); break; case 0x01: /* FC */ @@ -1573,7 +1574,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->freqcount = (voice->freqcount & ~0x1fe00) | ((data & 0xff00) << 1); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, freq count=%08x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->freqcount); + fprintf(eslog, "%s:voice %d, freq count=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->freqcount); break; case 0x02: /* STRT (hi) */ @@ -1582,7 +1583,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->start = (voice->start & ~0x7c000000) | ((data & 0x1f00) << 18); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, loop start=%08x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->start); + fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->start); break; case 0x03: /* STRT (lo) */ @@ -1591,7 +1592,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->start = (voice->start & ~0x0003fc00) | ((data & 0xff00) << 2); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, loop start=%08x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->start); + fprintf(eslog, "%s:voice %d, loop start=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->start); break; case 0x04: /* END (hi) */ @@ -1603,7 +1604,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo voice->control |= CONTROL_STOP0; #endif if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, loop end=%08x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->end); + fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->end); break; case 0x05: /* END (lo) */ @@ -1615,7 +1616,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo voice->control |= CONTROL_STOP0; #endif if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, loop end=%08x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->end); + fprintf(eslog, "%s:voice %d, loop end=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->end); break; case 0x06: /* K2 */ @@ -1624,7 +1625,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->k2 = (voice->k2 & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, K2=%04x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->k2); + fprintf(eslog, "%s:voice %d, K2=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->k2); break; case 0x07: /* K1 */ @@ -1633,21 +1634,21 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->k1 = (voice->k1 & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, K1=%04x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->k1); + fprintf(eslog, "%s:voice %d, K1=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->k1); break; case 0x08: /* LVOL */ if (ACCESSING_BITS_8_15) voice->lvol = (voice->lvol & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, left vol=%04x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->lvol); + fprintf(eslog, "%s:voice %d, left vol=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->lvol); break; case 0x09: /* RVOL */ if (ACCESSING_BITS_8_15) voice->rvol = (voice->rvol & ~0xff00) | (data & 0xff00); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, right vol=%04x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->rvol); + fprintf(eslog, "%s:voice %d, right vol=%04x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->rvol); break; case 0x0a: /* ACC (hi) */ @@ -1656,7 +1657,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->accum = (voice->accum & ~0x7c000000) | ((data & 0x1f00) << 18); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, accum=%08x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->accum); + fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->accum); break; case 0x0b: /* ACC (lo) */ @@ -1665,7 +1666,7 @@ INLINE void es5505_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *vo if (ACCESSING_BITS_8_15) voice->accum = (voice->accum & ~0x0003fc00) | ((data & 0xff00) << 2); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, accum=%08x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->accum); + fprintf(eslog, "%s:voice %d, accum=%08x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->accum); break; case 0x0c: /* unused */ @@ -1712,7 +1713,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v ((data << 2) & (CONTROL_CA0 | CONTROL_CA1)); } if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, control=%04x (raw=%04x & %04x)\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->control, data, mem_mask); + fprintf(eslog, "%s:voice %d, control=%04x (raw=%04x & %04x)\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->control, data, mem_mask); break; case 0x01: /* O4(n-1) */ @@ -1721,7 +1722,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o4n1 = (INT16)((voice->o4n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, O4(n-1)=%05x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O4(n-1)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o4n1 & 0x3ffff); break; case 0x02: /* O3(n-1) */ @@ -1730,7 +1731,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o3n1 = (INT16)((voice->o3n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, O3(n-1)=%05x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O3(n-1)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o3n1 & 0x3ffff); break; case 0x03: /* O3(n-2) */ @@ -1739,7 +1740,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o3n2 = (INT16)((voice->o3n2 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, O3(n-2)=%05x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O3(n-2)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o3n2 & 0x3ffff); break; case 0x04: /* O2(n-1) */ @@ -1748,7 +1749,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o2n1 = (INT16)((voice->o2n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, O2(n-1)=%05x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O2(n-1)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff); break; case 0x05: /* O2(n-2) */ @@ -1757,7 +1758,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o2n2 = (INT16)((voice->o2n2 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, O2(n-2)=%05x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff); + fprintf(eslog, "%s:voice %d, O2(n-2)=%05x\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o2n2 & 0x3ffff); break; case 0x06: /* O1(n-1) */ @@ -1766,7 +1767,7 @@ INLINE void es5505_reg_write_high(struct ES5506Chip *chip, struct ES5506Voice *v if (ACCESSING_BITS_8_15) voice->o1n1 = (INT16)((voice->o1n1 & ~0xff00) | (data & 0xff00)); if (LOG_COMMANDS && eslog) - fprintf(eslog, "%06x:voice %d, O1(n-1)=%05x (accum=%08x)\n", cpu_get_previouspc(Machine->activecpu), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum); + fprintf(eslog, "%s:voice %d, O1(n-1)=%05x (accum=%08x)\n", cpuexec_describe_context(Machine), chip->current_page & 0x1f, voice->o2n1 & 0x3ffff, voice->accum); break; case 0x07: @@ -1848,7 +1849,7 @@ static void es5505_reg_write(struct ES5506Chip *chip, offs_t offset, UINT16 data { struct ES5506Voice *voice = &chip->voice[chip->current_page & 0x1f]; -// logerror("%04x:ES5505 write %02x/%02x = %04x & %04x\n", cpu_get_previouspc(Machine->activecpu), chip->current_page, offset, data, mem_mask); +// logerror("%s:ES5505 write %02x/%02x = %04x & %04x\n", cpuexec_describe_context(Machine), chip->current_page, offset, data, mem_mask); /* force an update */ stream_update(chip->stream); diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index 7ba7e449c22..abfee0ce406 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -10,6 +10,7 @@ #include "deprecat.h" #include "streams.h" #include "cpuintrf.h" +#include "cpuexec.h" #include "ics2115.h" #define ICS2115LOGERROR 0 @@ -66,12 +67,6 @@ struct ics2115{ sound_stream * stream; }; -static int caller_get_pc(void) -{ - int pc = cpu_get_pc(Machine->activecpu); - return pc; -} - static void recalc_irq(struct ics2115 *chip) { int i; @@ -201,8 +196,8 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x00: // [osc] Oscillator Configuration if(msb) { chip->voice[chip->osc].conf = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: conf = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].conf, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: conf = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].conf); } break; @@ -212,8 +207,8 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].fc = (chip->voice[chip->osc].fc & 0xff)|(data << 8); else chip->voice[chip->osc].fc = (chip->voice[chip->osc].fc & 0xff00)|data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: fc = %04x (%dHz) (%04x)\n", chip->osc, - chip->voice[chip->osc].fc, chip->voice[chip->osc].fc*33075/1024, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: fc = %04x (%dHz)\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].fc, chip->voice[chip->osc].fc*33075/1024); break; case 0x02: // [osc] Wavesample loop start address 19-4 @@ -221,15 +216,15 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].strth = (chip->voice[chip->osc].strth & 0xff)|(data << 8); else chip->voice[chip->osc].strth = (chip->voice[chip->osc].strth & 0xff00)|data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: strth = %04x (%04x)\n", chip->osc, - chip->voice[chip->osc].strth, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: strth = %04x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].strth); break; case 0x03: // [osc] Wavesample loop start address 3-0.3-0 if(msb) { chip->voice[chip->osc].strtl = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: strtl = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].strtl, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: strtl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].strtl); } break; @@ -238,31 +233,31 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].endh = (chip->voice[chip->osc].endh & 0xff)|(data << 8); else chip->voice[chip->osc].endh = (chip->voice[chip->osc].endh & 0xff00)|data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: endh = %04x (%04x)\n", chip->osc, - chip->voice[chip->osc].endh, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: endh = %04x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].endh); break; case 0x05: // [osc] Wavesample loop end address 3-0.3-0 if(msb) { chip->voice[chip->osc].endl = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: endl = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].endl, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: endl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].endl); } break; case 0x07: // [osc] Volume Start if(msb) { chip->voice[chip->osc].vstart = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: vstart = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].vstart, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vstart = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].vstart); } break; case 0x08: // [osc] Volume End if(msb) { chip->voice[chip->osc].vend = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: vend = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].vend, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vend = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].vend); } break; @@ -271,8 +266,8 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].volacc = (chip->voice[chip->osc].volacc & 0xff)|(data << 8); else chip->voice[chip->osc].volacc = (chip->voice[chip->osc].volacc & 0xff00)|data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: volacc = %04x (%04x)\n", chip->osc, - chip->voice[chip->osc].volacc, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: volacc = %04x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].volacc); break; case 0x0a: // [osc] Wavesample address 19-4 @@ -280,8 +275,8 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].addrh = (chip->voice[chip->osc].addrh & 0xff)|(data << 8); else chip->voice[chip->osc].addrh = (chip->voice[chip->osc].addrh & 0xff00)|data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: addrh = %04x (%04x)\n", chip->osc, - chip->voice[chip->osc].addrh, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: addrh = %04x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].addrh); break; case 0x0b: // [osc] Wavesample address 3-0.8-0 @@ -289,32 +284,32 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) chip->voice[chip->osc].addrl = (chip->voice[chip->osc].addrl & 0xff)|(data << 8); else chip->voice[chip->osc].addrl = (chip->voice[chip->osc].addrl & 0xff00)|data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: addrl = %04x (%04x)\n", chip->osc, - chip->voice[chip->osc].addrl, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: addrl = %04x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].addrl); break; case 0x0c: // [osc] Pan if(msb) { chip->voice[chip->osc].pan = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: pan = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].pan, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: pan = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].pan); } break; case 0x0d: // [osc] Volume Enveloppe Control if(msb) { chip->voice[chip->osc].vctl = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: vctl = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].vctl, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: vctl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].vctl); } break; case 0x10: // [osc] Oscillator Control if(msb) { chip->voice[chip->osc].ctl = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: ctl = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].ctl, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: ctl = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].ctl); if(data == 0) keyon(chip, chip->osc); } @@ -323,15 +318,15 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x11: // [osc] Wavesample static address 27-20 if(msb) { chip->voice[chip->osc].saddr = data; - if (ICS2115LOGERROR) logerror("ICS2115: %2d: saddr = %02x (%04x)\n", chip->osc, - chip->voice[chip->osc].saddr, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: saddr = %02x\n", cpuexec_describe_context(Machine), chip->osc, + chip->voice[chip->osc].saddr); } break; case 0x40: // Timer 1 Preset if(!msb) { chip->timer[0].preset = data; - if (ICS2115LOGERROR) logerror("ICS2115: t1preset = %d (%04x)\n", chip->timer[0].preset, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t1preset = %d\n", cpuexec_describe_context(Machine), chip->timer[0].preset); recalc_timer(chip, 0); } break; @@ -339,7 +334,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x41: // Timer 2 Preset if(!msb) { chip->timer[1].preset = data; - if (ICS2115LOGERROR) logerror("ICS2115: t2preset = %d (%04x)\n", chip->timer[1].preset, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t2preset = %d\n", cpuexec_describe_context(Machine), chip->timer[1].preset); recalc_timer(chip, 1); } break; @@ -347,7 +342,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x42: // Timer 1 Prescaler if(!msb) { chip->timer[0].scale = data; - if (ICS2115LOGERROR) logerror("ICS2115: t1scale = %d (%04x)\n", chip->timer[0].scale, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t1scale = %d\n", cpuexec_describe_context(Machine), chip->timer[0].scale); recalc_timer(chip, 0); } break; @@ -355,7 +350,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x43: // Timer 2 Prescaler if(!msb) { chip->timer[1].scale = data; - if (ICS2115LOGERROR) logerror("ICS2115: t2scale = %d (%04x)\n", chip->timer[1].scale, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: t2scale = %d\n", cpuexec_describe_context(Machine), chip->timer[1].scale); recalc_timer(chip, 1); } break; @@ -363,7 +358,7 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x4a: // IRQ Enable if(!msb) { chip->irq_en = data; - if (ICS2115LOGERROR) logerror("ICS2115: irq_en = %02x (%04x)\n", chip->irq_en, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: irq_en = %02x\n", cpuexec_describe_context(Machine), chip->irq_en); recalc_irq(chip); } break; @@ -371,12 +366,12 @@ static void ics2115_reg_w(struct ics2115 *chip, UINT8 reg, UINT8 data, int msb) case 0x4f: // Oscillator Address being Programmed if(!msb) { chip->osc = data & 31; - if (ICS2115LOGERROR) logerror("ICS2115: oscnumber = %d (%04x)\n", chip->osc, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: oscnumber = %d\n", cpuexec_describe_context(Machine), chip->osc); } break; default: - if (ICS2115LOGERROR) logerror("ICS2115: write %02x, %02x:%d (%04x)\n", reg, data, msb, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: write %02x, %02x:%d\n", cpuexec_describe_context(Machine), reg, data, msb); } } @@ -384,7 +379,7 @@ static UINT16 ics2115_reg_r(struct ics2115 *chip, UINT8 reg) { switch(reg) { case 0x0d: // [osc] Volume Enveloppe Control - if (ICS2115LOGERROR) logerror("ICS2115: %2d: read vctl (%04x)\n", chip->osc, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: read vctl\n", cpuexec_describe_context(Machine), chip->osc); // res = chip->voice[chip->osc].vctl << 8; // may expect |8 on voice irq with &40 == 0 // may expect |8 on reg 0 on voice irq with &80 == 0 @@ -401,40 +396,40 @@ static UINT16 ics2115_reg_r(struct ics2115 *chip, UINT8 reg) res = 0x40 | osc; // 0x40 ? 0x80 ? break; } - if (ICS2115LOGERROR) logerror("ICS2115: read irqv %02x (%04x)\n", res, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read irqv %02x\n", cpuexec_describe_context(Machine), res); return res << 8; } case 0x40: // Timer 0 clear irq - // if (ICS2115LOGERROR) logerror("ICS2115: clear timer 0 (%04x)\n", caller_get_pc()); + // if (ICS2115LOGERROR) logerror("%s:ICS2115: clear timer 0\n", cpuexec_describe_context(Machine)); chip->irq_pend &= ~(1<<0); recalc_irq(chip); return chip->timer[0].preset; case 0x41: // Timer 1 clear irq - if (ICS2115LOGERROR) logerror("ICS2115: clear timer 1 (%04x)\n", caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: clear timer 1\n", cpuexec_describe_context(Machine)); chip->irq_pend &= ~(1<<1); recalc_irq(chip); return chip->timer[1].preset; case 0x43: // Timer status - // if (ICS2115LOGERROR) logerror("ICS2115: read timer status %02x (%04x)\n", chip->irq_pend & 3, caller_get_pc()); + // if (ICS2115LOGERROR) logerror("%s:ICS2115: read timer status %02x\n", cpuexec_describe_context(Machine), chip->irq_pend & 3); return chip->irq_pend & 3; case 0x4a: // IRQ Pending - if (ICS2115LOGERROR) logerror("ICS2115: read irq_pend %02x (%04x)\n", chip->irq_pend, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read irq_pend %02x\n", cpuexec_describe_context(Machine), chip->irq_pend); return chip->irq_pend; case 0x4b: // Address of Interrupting Oscillator - if (ICS2115LOGERROR) logerror("ICS2115: %2d: read intoscaddr (%04x)\n", chip->osc, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: %2d: read intoscaddr\n", cpuexec_describe_context(Machine), chip->osc); return 0x80; case 0x4c: // Chip revision - if (ICS2115LOGERROR) logerror("ICS2115: read revision (%04x)\n", caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read revision\n", cpuexec_describe_context(Machine)); return 0x01; default: - if (ICS2115LOGERROR) logerror("ICS2115: read %02x unmapped (%04x)\n", reg, caller_get_pc()); + if (ICS2115LOGERROR) logerror("%s:ICS2115: read %02x unmapped\n", cpuexec_describe_context(Machine), reg); return 0; } } @@ -488,7 +483,7 @@ READ8_HANDLER( ics2115_r ) break; } } - // if (ICS2115LOGERROR) logerror("ICS2115: read status %02x (%04x)\n", res, caller_get_pc()); + // if (ICS2115LOGERROR) logerror("%s:ICS2115: read status %02x\n", cpuexec_describe_context(Machine), res); return res; } @@ -516,7 +511,7 @@ WRITE8_HANDLER( ics2115_w ) ics2115_reg_w(chip, chip->reg, data, 1); break; } - // if (ICS2115LOGERROR) logerror("ICS2115: wi %d, %02x (%04x)\n", offset, data, caller_get_pc()); + // if (ICS2115LOGERROR) logerror("ICS2115: wi %d, %02x\n", cpuexec_describe_context(Machine), offset, data); } static SND_RESET( ics2115 ) diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index 6ba6437cbe4..e53bd2be625 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -8,6 +8,7 @@ #include "deprecat.h" #include "streams.h" #include "cpuintrf.h" +#include "cpuexec.h" #include "k053260.h" /* 2004-02-28: Fixed ppcm decoding. Games sound much better now.*/ @@ -399,7 +400,7 @@ static UINT8 k053260_read( int chip, offs_t offset ) ic->channels[0].pos += ( 1 << 16 ); if ( offs > ic->rom_size ) { - logerror("%06x: K53260: Attempting to read past rom size in rom Read Mode (offs = %06x, size = %06x).\n",cpu_get_pc(Machine->activecpu),offs,ic->rom_size ); + logerror("%s: K53260: Attempting to read past rom size in rom Read Mode (offs = %06x, size = %06x).\n", cpuexec_describe_context(Machine),offs,ic->rom_size ); return 0; } diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index 352f00348e0..186e400553a 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -601,7 +601,6 @@ INLINE void apu_update(struct nesapu_info *info, stream_sample_t *buffer16, int { int accum; - cpu_push_context( info->APU.dpcm.memory->cpu ); while (samples--) { accum = apu_square(info, &info->APU.squ[0]); @@ -618,7 +617,6 @@ INLINE void apu_update(struct nesapu_info *info, stream_sample_t *buffer16, int *(buffer16++)=accum<<8; } - cpu_pop_context(); } /* READ VALUES FROM REGISTERS */ diff --git a/src/emu/sound/pokey.c b/src/emu/sound/pokey.c index f7ee36a58e0..e7c485e813c 100644 --- a/src/emu/sound/pokey.c +++ b/src/emu/sound/pokey.c @@ -53,6 +53,7 @@ #include "deprecat.h" #include "streams.h" #include "cpuintrf.h" +#include "cpuexec.h" #include "pokey.h" /* @@ -855,7 +856,7 @@ static int pokey_register_r(int chip, int offs) } } else - logerror("PC %04x: warning - read p[chip] #%d POT%d\n", cpu_get_pc(Machine->activecpu), chip, pot); + logerror("%s: warning - read p[chip] #%d POT%d\n", cpuexec_describe_context(Machine), chip, pot); break; case ALLPOT_C: diff --git a/src/emu/sound/psx.c b/src/emu/sound/psx.c index 01a481dd8da..b70e46adc64 100644 --- a/src/emu/sound/psx.c +++ b/src/emu/sound/psx.c @@ -13,6 +13,7 @@ #include "deprecat.h" #include "streams.h" #include "cpuintrf.h" +#include "cpuexec.h" #include "psx.h" #define VERBOSE_LEVEL ( 0 ) @@ -26,7 +27,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/emu/sound/rf5c400.c b/src/emu/sound/rf5c400.c index e4dae140eb3..1a50dd7bda4 100644 --- a/src/emu/sound/rf5c400.c +++ b/src/emu/sound/rf5c400.c @@ -442,11 +442,11 @@ static void rf5c400_w(int chipnum, int offset, UINT16 data) default: { - //mame_printf_debug("rf5c400_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(machine->activecpu)); + //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X\n", cpuexec_describe_context(Machine), data, offset, mem_mask); break; } } - //mame_printf_debug("rf5c400_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(machine->activecpu)); + //mame_printf_debug("%s:rf5c400_w: %08X, %08X, %08X at %08X\n", cpuexec_describe_context(Machine), data, offset, mem_mask); } else { diff --git a/src/emu/sound/saa1099.c b/src/emu/sound/saa1099.c index 7018442acb9..62f5b5533fd 100644 --- a/src/emu/sound/saa1099.c +++ b/src/emu/sound/saa1099.c @@ -66,6 +66,7 @@ #include "sndintrf.h" #include "streams.h" #include "cpuintrf.h" +#include "cpuexec.h" #include "saa1099.h" #include "deprecat.h" #include @@ -334,7 +335,7 @@ static void saa1099_control_port_w( int chip, int reg, int data ) if ((data & 0xff) > 0x1c) { /* Error! */ - logerror("%04x: (SAA1099 #%d) Unknown register selected\n",cpu_get_pc(Machine->activecpu), chip); + logerror("%s: (SAA1099 #%d) Unknown register selected\n",cpuexec_describe_context(Machine), chip); } saa->selected_reg = data & 0x1f; @@ -420,7 +421,7 @@ static void saa1099_write_port_w( int chip, int offset, int data ) int i; /* Synch & Reset generators */ - logerror("%04x: (SAA1099 #%d) -reg 0x1c- Chip reset\n",cpu_get_pc(Machine->activecpu), chip); + logerror("%s: (SAA1099 #%d) -reg 0x1c- Chip reset\n",cpuexec_describe_context(Machine), chip); for (i = 0; i < 6; i++) { saa->channels[i].level = 0; @@ -429,7 +430,7 @@ static void saa1099_write_port_w( int chip, int offset, int data ) } break; default: /* Error! */ - logerror("%04x: (SAA1099 #%d) Unknown operation (reg:%02x, data:%02x)\n",cpu_get_pc(Machine->activecpu), chip, reg, data); + logerror("%s: (SAA1099 #%d) Unknown operation (reg:%02x, data:%02x)\n",cpuexec_describe_context(Machine), chip, reg, data); } } diff --git a/src/emu/timer.c b/src/emu/timer.c index 2b7547b99e2..34a7979e6b2 100644 --- a/src/emu/timer.c +++ b/src/emu/timer.c @@ -129,6 +129,7 @@ static void timer_remove(emu_timer *which); INLINE attotime get_current_time(running_machine *machine) { + extern attotime cpuexec_override_local_time(running_machine *machine, attotime default_time); timer_private *global = machine->timer_data; /* if we're currently in a callback, use the timer's expiration time as a base */ @@ -136,11 +137,8 @@ INLINE attotime get_current_time(running_machine *machine) return global->callback_timer_expire_time; /* if we're executing as a particular CPU, use its local time as a base */ - if (machine->activecpu != NULL) - return cpu_get_local_time(machine->activecpu); - - /* otherwise, return the current global base time */ - return global->basetime; + /* otherwise, return the global base time */ + return cpuexec_override_local_time(machine, global->basetime); } @@ -737,8 +735,8 @@ void timer_adjust_periodic(emu_timer *which, attotime start_delay, INT32 param, /* if this was inserted as the head, abort the current timeslice and resync */ LOG(("timer_adjust_oneshot %s.%s:%d to expire @ %s\n", which->file, which->func, which->line, attotime_string(which->expire, 9))); - if (which == global->activelist && which->machine->activecpu != NULL) - cpu_abort_timeslice(which->machine->activecpu); + if (which == global->activelist) + cpuexec_abort_timeslice(which->machine); } diff --git a/src/emu/video/cdp1869.c b/src/emu/video/cdp1869.c index 2188a5520a1..6d3a2f27331 100644 --- a/src/emu/video/cdp1869.c +++ b/src/emu/video/cdp1869.c @@ -43,6 +43,7 @@ struct _cdp1869_t { const cdp1869_interface *intf; /* interface */ const device_config *screen; /* screen */ + const device_config *cpu; /* CPU */ sound_stream *stream; /* sound output */ /* video state */ @@ -150,9 +151,9 @@ static STATE_POSTLOAD( cdp1869_state_save_postload ) /* CDP1802 X Register */ -static UINT16 cdp1802_get_r_x(running_machine *machine) +static UINT16 cdp1802_get_r_x(cdp1869_t *cdp1869) { - return cpu_get_reg(machine->activecpu, CDP1802_R0 + cpu_get_reg(machine->activecpu, CDP1802_X)); + return cpu_get_reg(cdp1869->cpu, CDP1802_R0 + cpu_get_reg(cdp1869->cpu, CDP1802_X)); } /* Palette Initialization */ @@ -383,7 +384,7 @@ WRITE8_DEVICE_HANDLER( cdp1869_out4_w ) { cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(device->machine); + UINT16 word = cdp1802_get_r_x(cdp1869); /* bit description @@ -422,7 +423,7 @@ WRITE8_DEVICE_HANDLER( cdp1869_out5_w ) { cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(device->machine); + UINT16 word = cdp1802_get_r_x(cdp1869); /* bit description @@ -479,7 +480,7 @@ WRITE8_DEVICE_HANDLER( cdp1869_out6_w ) { cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(device->machine); + UINT16 word = cdp1802_get_r_x(cdp1869); /* bit description @@ -509,7 +510,7 @@ WRITE8_DEVICE_HANDLER( cdp1869_out7_w ) { cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(device->machine); + UINT16 word = cdp1802_get_r_x(cdp1869); /* bit description @@ -799,9 +800,14 @@ static DEVICE_START( cdp1869 ) // get the screen device - cdp1869->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, cdp1869->intf->screen_tag); + cdp1869->screen = devtag_get_device(device->machine, VIDEO_SCREEN, cdp1869->intf->screen_tag); assert(cdp1869->screen != NULL); + // get the CPU device + + cdp1869->cpu = cputag_get_cpu(device->machine, cdp1869->intf->cpu_tag); + assert(cdp1869->cpu != NULL); + // allocate timers if (cdp1869->intf->on_prd_changed != NULL) diff --git a/src/emu/video/cdp1869.h b/src/emu/video/cdp1869.h index f69cba501ce..e897b7d9fd5 100644 --- a/src/emu/video/cdp1869.h +++ b/src/emu/video/cdp1869.h @@ -109,6 +109,7 @@ typedef struct _cdp1869_interface cdp1869_interface; struct _cdp1869_interface { const char *screen_tag; /* screen we are acting on */ + const char *cpu_tag; /* CPU we work together with */ int pixel_clock; /* the dot clock of the chip */ int color_clock; /* the chroma clock of the chip */ diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index 96f54a279d8..96b305f54dd 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -230,7 +230,7 @@ WRITE8_DEVICE_HANDLER( mc6845_register_w ) { mc6845_t *mc6845 = get_safe_token(device); - if (LOG) logerror("M6845 PC %04x: reg 0x%02x = 0x%02x\n", cpu_get_pc(device->machine->activecpu), mc6845->register_address_latch, data); + if (LOG) logerror("%s:M6845 reg 0x%02x = 0x%02x\n", cpuexec_describe_context(device->machine), mc6845->register_address_latch, data); switch (mc6845->register_address_latch) { diff --git a/src/emu/video/tms34061.c b/src/emu/video/tms34061.c index 7693c0477c6..a2fc989d4b1 100644 --- a/src/emu/video/tms34061.c +++ b/src/emu/video/tms34061.c @@ -187,7 +187,7 @@ static void register_w(offs_t offset, UINT8 data) } /* log it */ - if (VERBOSE) logerror("%04X:tms34061 %s = %04x\n", cpu_get_pc(Machine->activecpu), regnames[regnum], tms34061.regs[regnum]); + if (VERBOSE) logerror("%s:tms34061 %s = %04x\n", cpuexec_describe_context(Machine), regnames[regnum], tms34061.regs[regnum]); /* update the state of things */ switch (regnum) @@ -265,7 +265,7 @@ static UINT8 register_r(offs_t offset) } /* log it */ - if (VERBOSE) logerror("%04X:tms34061 %s read = %04X\n", cpu_get_pc(Machine->activecpu), regnames[regnum], result); + if (VERBOSE) logerror("%s:tms34061 %s read = %04X\n", cpuexec_describe_context(Machine), regnames[regnum], result); return (offset & 0x02) ? (result >> 8) : result; } @@ -372,7 +372,7 @@ static void xypixel_w(int offset, UINT8 data) /* mask to the VRAM size */ pixeloffs &= tms34061.vrammask; - if (VERBOSE) logerror("%04X:tms34061 xy (%04x) = %02x/%02x\n", cpu_get_pc(Machine->activecpu), pixeloffs, data, tms34061.latchdata); + if (VERBOSE) logerror("%s:tms34061 xy (%04x) = %02x/%02x\n", cpuexec_describe_context(Machine), pixeloffs, data, tms34061.latchdata); /* set the pixel data */ tms34061.vram[pixeloffs] = data; @@ -428,7 +428,7 @@ void tms34061_w(int col, int row, int func, UINT8 data) offs = ((row << tms34061.intf.rowshift) | col) & tms34061.vrammask; if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; - if (VERBOSE) logerror("%04X:tms34061 direct (%04x) = %02x/%02x\n", cpu_get_pc(Machine->activecpu), offs, data, tms34061.latchdata); + if (VERBOSE) logerror("%s:tms34061 direct (%04x) = %02x/%02x\n", cpuexec_describe_context(Machine), offs, data, tms34061.latchdata); if (tms34061.vram[offs] != data || tms34061.latchram[offs] != tms34061.latchdata) { tms34061.vram[offs] = data; @@ -442,7 +442,7 @@ void tms34061_w(int col, int row, int func, UINT8 data) if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; offs &= tms34061.vrammask; - if (VERBOSE) logerror("%04X:tms34061 shiftreg write (%04x)\n", cpu_get_pc(Machine->activecpu), offs); + if (VERBOSE) logerror("%s:tms34061 shiftreg write (%04x)\n", cpuexec_describe_context(Machine), offs); memcpy(&tms34061.vram[offs], tms34061.shiftreg, (size_t)1 << tms34061.intf.rowshift); memset(&tms34061.latchram[offs], tms34061.latchdata, (size_t)1 << tms34061.intf.rowshift); @@ -454,14 +454,14 @@ void tms34061_w(int col, int row, int func, UINT8 data) if (tms34061.regs[TMS34061_CONTROL2] & 0x0040) offs |= (tms34061.regs[TMS34061_CONTROL2] & 3) << 16; offs &= tms34061.vrammask; - if (VERBOSE) logerror("%04X:tms34061 shiftreg read (%04x)\n", cpu_get_pc(Machine->activecpu), offs); + if (VERBOSE) logerror("%s:tms34061 shiftreg read (%04x)\n", cpuexec_describe_context(Machine), offs); tms34061.shiftreg = &tms34061.vram[offs]; break; /* log anything else */ default: - logerror("Unsupported TMS34061 function %d - PC: %04X\n", func, cpu_get_pc(Machine->activecpu)); + logerror("%s:Unsupported TMS34061 function %d\n", cpuexec_describe_context(Machine), func); break; } } @@ -515,8 +515,8 @@ UINT8 tms34061_r(int col, int row, int func) /* log anything else */ default: - logerror("Unsupported TMS34061 function %d - PC: %04X\n", - func, cpu_get_pc(Machine->activecpu)); + logerror("%s:Unsupported TMS34061 function %d\n", cpuexec_describe_context(Machine), + func); break; } diff --git a/src/emu/video/vooddefs.h b/src/emu/video/vooddefs.h index ca39e5d942d..36e48287f48 100644 --- a/src/emu/video/vooddefs.h +++ b/src/emu/video/vooddefs.h @@ -1671,6 +1671,7 @@ struct _voodoo_state UINT8 index; /* index of board */ const device_config *device; /* pointer to our containing device */ const device_config *screen; /* the screen we are acting on */ + const device_config *cpu; /* the CPU we interact with */ UINT8 type; /* type of system */ UINT8 chipmask; /* mask for which chips are available */ UINT32 freq; /* operating frequency */ @@ -1696,7 +1697,7 @@ struct _voodoo_state voodoo_stats stats; /* internal statistics */ - offs_t last_status_pc; /* PC of last status read (for logging) */ + offs_t last_status_pc; /* PC of last status description (for logging) */ UINT32 last_status_value; /* value of last status read (for logging) */ int next_rasterizer; /* next rasterizer index */ diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index df3cba4a8ef..6334f38ada3 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -1979,7 +1979,7 @@ static void cmdfifo_w(voodoo_state *v, cmdfifo_info *f, offs_t offset, UINT32 da /************************************* * - * Stall the activecpu until we are + * Stall the active cpu until we are * ready * *************************************/ @@ -2057,7 +2057,7 @@ static void stall_cpu(voodoo_state *v, int state, attotime current_time) if (v->pci.stall_callback) (*v->pci.stall_callback)(v->device, TRUE); else - cpu_spinuntil_trigger(v->device->machine->activecpu, v->trigger); + cpu_spinuntil_trigger(v->cpu, v->trigger); /* set a timer to clear the stall */ timer_adjust_oneshot(v->pci.continue_timer, attotime_sub(v->pci.op_end_time, current_time), 0); @@ -3681,7 +3681,7 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) /* bit 31 is not used */ /* eat some cycles since people like polling here */ - cpu_eat_cycles(v->device->machine->activecpu, 1000); + cpu_eat_cycles(v->cpu, 1000); break; /* bit 2 of the initEnable register maps this to dacRead */ @@ -3694,7 +3694,7 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) case vRetrace: /* eat some cycles since people like polling here */ - cpu_eat_cycles(v->device->machine->activecpu, 10); + cpu_eat_cycles(v->cpu, 10); result = video_screen_get_vpos(v->screen); break; @@ -3709,7 +3709,7 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) result = v->fbi.cmdfifo[0].rdptr; /* eat some cycles since people like polling here */ - cpu_eat_cycles(v->device->machine->activecpu, 1000); + cpu_eat_cycles(v->cpu, 1000); break; case cmdFifoAMin: @@ -3745,16 +3745,16 @@ static UINT32 register_r(voodoo_state *v, offs_t offset) int logit = TRUE; /* don't log multiple identical status reads from the same address */ - if (regnum == status) - { - offs_t pc = cpu_get_pc(v->device->machine->activecpu); - if (pc == v->last_status_pc && result == v->last_status_value) - logit = FALSE; - v->last_status_pc = pc; - v->last_status_value = result; - } - if (regnum == cmdFifoRdPtr) - logit = FALSE; + if (regnum == status) + { + offs_t pc = cpu_get_pc(v->cpu); + if (pc == v->last_status_pc && result == v->last_status_value) + logit = FALSE; + v->last_status_pc = pc; + v->last_status_value = result; + } + if (regnum == cmdFifoRdPtr) + logit = FALSE; if (logit) logerror("VOODOO.%d.REG:%s read = %08X\n", v->index, v->regnames[regnum], result); @@ -3930,7 +3930,7 @@ static READ32_DEVICE_HANDLER( banshee_agp_r ) } if (LOG_REGISTERS) - logerror("%08X:banshee_r(AGP:%s)\n", cpu_get_pc(v->device->machine->activecpu), banshee_agp_reg_name[offset]); + logerror("%s:banshee_r(AGP:%s)\n", cpuexec_describe_context(v->device->machine), banshee_agp_reg_name[offset]); return result; } @@ -3949,15 +3949,15 @@ READ32_DEVICE_HANDLER( banshee_r ) else if (offset < 0x100000/4) result = banshee_agp_r(device, offset, mem_mask); else if (offset < 0x200000/4) - logerror("%08X:banshee_r(2D:%X)\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0xfffff); + logerror("%s:banshee_r(2D:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0xfffff); else if (offset < 0x600000/4) result = register_r(v, offset & 0x1fffff/4); else if (offset < 0x800000/4) - logerror("%08X:banshee_r(TEX:%X)\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0x1fffff); + logerror("%s:banshee_r(TEX:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0x1fffff); else if (offset < 0xc00000/4) - logerror("%08X:banshee_r(RES:%X)\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0x3fffff); + logerror("%s:banshee_r(RES:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff); else if (offset < 0x1000000/4) - logerror("%08X:banshee_r(YUV:%X)\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0x3fffff); + logerror("%s:banshee_r(YUV:%X)\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff); else if (offset < 0x2000000/4) { UINT8 temp = v->fbi.lfb_stride; @@ -3980,7 +3980,7 @@ READ32_DEVICE_HANDLER( banshee_fb_r ) if (offset < v->fbi.lfb_base) { - logerror("%08X:banshee_fb_r(%X)\n", cpu_get_pc(device->machine->activecpu), offset*4); + logerror("%s:banshee_fb_r(%X)\n", cpuexec_describe_context(device->machine), offset*4); if (offset*4 <= v->fbi.mask) result = ((UINT32 *)v->fbi.ram)[offset]; } @@ -4005,20 +4005,20 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att)) result = v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]]; if (LOG_REGISTERS) - logerror("%08X:banshee_att_r(%X)\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3c1 & 0x1f]); + logerror("%s:banshee_att_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c1 & 0x1f]); break; /* Input status 0 */ case 0x3c2: /* - bit 7 = Interrupt Status. When its value is ?1?, denotes that an interrupt is pending. - bit 6:5 = Feature Connector. These 2 bits are readable bits from the feature connector. - bit 4 = Sense. This bit reflects the state of the DAC monitor sense logic. - bit 3:0 = Reserved. Read back as 0. - */ + bit 7 = Interrupt Status. When its value is ?1?, denotes that an interrupt is pending. + bit 6:5 = Feature Connector. These 2 bits are readable bits from the feature connector. + bit 4 = Sense. This bit reflects the state of the DAC monitor sense logic. + bit 3:0 = Reserved. Read back as 0. + */ result = 0x00; if (LOG_REGISTERS) - logerror("%08X:banshee_vga_r(%X)\n", cpu_get_pc(device->machine->activecpu), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset); break; /* Sequencer access */ @@ -4026,7 +4026,7 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq)) result = v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]]; if (LOG_REGISTERS) - logerror("%08X:banshee_seq_r(%X)\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3c4 & 0x1f]); + logerror("%s:banshee_seq_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c4 & 0x1f]); break; /* Feature control */ @@ -4034,14 +4034,14 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) result = v->banshee.vga[0x3da & 0x1f]; v->banshee.attff = 0; if (LOG_REGISTERS) - logerror("%08X:banshee_vga_r(%X)\n", cpu_get_pc(device->machine->activecpu), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset); break; /* Miscellaneous output */ case 0x3cc: result = v->banshee.vga[0x3c2 & 0x1f]; if (LOG_REGISTERS) - logerror("%08X:banshee_vga_r(%X)\n", cpu_get_pc(device->machine->activecpu), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset); break; /* Graphics controller access */ @@ -4049,7 +4049,7 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc)) result = v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]]; if (LOG_REGISTERS) - logerror("%08X:banshee_gc_r(%X)\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3ce & 0x1f]); + logerror("%s:banshee_gc_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3ce & 0x1f]); break; /* CRTC access */ @@ -4057,29 +4057,29 @@ static READ8_DEVICE_HANDLER( banshee_vga_r ) if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc)) result = v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]]; if (LOG_REGISTERS) - logerror("%08X:banshee_crtc_r(%X)\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3d4 & 0x1f]); + logerror("%s:banshee_crtc_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3d4 & 0x1f]); break; /* Input status 1 */ case 0x3da: /* - bit 7:6 = Reserved. These bits read back 0. - bit 5:4 = Display Status. These 2 bits reflect 2 of the 8 pixel data outputs from the Attribute - controller, as determined by the Attribute controller index 0x12 bits 4 and 5. - bit 3 = Vertical sync Status. A ?1? indicates vertical retrace is in progress. - bit 2:1 = Reserved. These bits read back 0x2. - bit 0 = Display Disable. When this bit is 1, either horizontal or vertical display end has occurred, - otherwise video data is being displayed. - */ + bit 7:6 = Reserved. These bits read back 0. + bit 5:4 = Display Status. These 2 bits reflect 2 of the 8 pixel data outputs from the Attribute + controller, as determined by the Attribute controller index 0x12 bits 4 and 5. + bit 3 = Vertical sync Status. A ?1? indicates vertical retrace is in progress. + bit 2:1 = Reserved. These bits read back 0x2. + bit 0 = Display Disable. When this bit is 1, either horizontal or vertical display end has occurred, + otherwise video data is being displayed. + */ result = 0x04; if (LOG_REGISTERS) - logerror("%08X:banshee_vga_r(%X)\n", cpu_get_pc(device->machine->activecpu), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset); break; default: result = v->banshee.vga[offset]; if (LOG_REGISTERS) - logerror("%08X:banshee_vga_r(%X)\n", cpu_get_pc(device->machine->activecpu), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", cpuexec_describe_context(device->machine), 0x300+offset); break; } return result; @@ -4103,7 +4103,7 @@ READ32_DEVICE_HANDLER( banshee_io_r ) case io_dacData: result = v->fbi.clut[v->banshee.io[io_dacAddr] & 0x1ff] = v->banshee.io[offset]; if (LOG_REGISTERS) - logerror("%08X:banshee_dac_r(%X)\n", cpu_get_pc(device->machine->activecpu), v->banshee.io[io_dacAddr] & 0x1ff); + logerror("%s:banshee_dac_r(%X)\n", cpuexec_describe_context(device->machine), v->banshee.io[io_dacAddr] & 0x1ff); break; case io_vgab0: case io_vgab4: case io_vgab8: case io_vgabc: @@ -4123,7 +4123,7 @@ READ32_DEVICE_HANDLER( banshee_io_r ) default: result = v->banshee.io[offset]; if (LOG_REGISTERS) - logerror("%08X:banshee_io_r(%s)\n", cpu_get_pc(device->machine->activecpu), banshee_io_reg_name[offset]); + logerror("%s:banshee_io_r(%s)\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset]); break; } @@ -4133,7 +4133,7 @@ READ32_DEVICE_HANDLER( banshee_io_r ) READ32_DEVICE_HANDLER( banshee_rom_r ) { - logerror("%08X:banshee_rom_r(%X)\n", cpu_get_pc(device->machine->activecpu), offset*4); + logerror("%s:banshee_rom_r(%X)\n", cpuexec_describe_context(device->machine), offset*4); return 0xffffffff; } @@ -4227,7 +4227,7 @@ static WRITE32_DEVICE_HANDLER( banshee_agp_w ) } if (LOG_REGISTERS) - logerror("%08X:banshee_w(AGP:%s) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), banshee_agp_reg_name[offset], data, mem_mask); + logerror("%s:banshee_w(AGP:%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_agp_reg_name[offset], data, mem_mask); } @@ -4244,15 +4244,15 @@ WRITE32_DEVICE_HANDLER( banshee_w ) else if (offset < 0x100000/4) banshee_agp_w(device, offset, data, mem_mask); else if (offset < 0x200000/4) - logerror("%08X:banshee_w(2D:%X) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0xfffff, data, mem_mask); + logerror("%s:banshee_w(2D:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0xfffff, data, mem_mask); else if (offset < 0x600000/4) register_w(v, offset & 0x1fffff/4, data); else if (offset < 0x800000/4) - logerror("%08X:banshee_w(TEX:%X) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0x1fffff, data, mem_mask); + logerror("%s:banshee_w(TEX:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0x1fffff, data, mem_mask); else if (offset < 0xc00000/4) - logerror("%08X:banshee_w(RES:%X) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0x3fffff, data, mem_mask); + logerror("%s:banshee_w(RES:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff, data, mem_mask); else if (offset < 0x1000000/4) - logerror("%08X:banshee_w(YUV:%X) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), (offset*4) & 0x3fffff, data, mem_mask); + logerror("%s:banshee_w(YUV:%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), (offset*4) & 0x3fffff, data, mem_mask); else if (offset < 0x2000000/4) { UINT8 temp = v->fbi.lfb_stride; @@ -4282,7 +4282,7 @@ WRITE32_DEVICE_HANDLER( banshee_fb_w ) { if (offset*4 <= v->fbi.mask) COMBINE_DATA(&((UINT32 *)v->fbi.ram)[offset]); - logerror("%08X:banshee_fb_w(%X) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), offset*4, data, mem_mask); + logerror("%s:banshee_fb_w(%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), offset*4, data, mem_mask); } } else @@ -4305,14 +4305,14 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) { v->banshee.vga[0x3c1 & 0x1f] = data; if (LOG_REGISTERS) - logerror("%08X:banshee_vga_w(%X) = %02X\n", cpu_get_pc(device->machine->activecpu), 0x3c0+offset, data); + logerror("%s:banshee_vga_w(%X) = %02X\n", cpuexec_describe_context(device->machine), 0x3c0+offset, data); } else { if (v->banshee.vga[0x3c1 & 0x1f] < ARRAY_LENGTH(v->banshee.att)) v->banshee.att[v->banshee.vga[0x3c1 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%08X:banshee_att_w(%X) = %02X\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3c1 & 0x1f], data); + logerror("%s:banshee_att_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c1 & 0x1f], data); } v->banshee.attff ^= 1; break; @@ -4322,7 +4322,7 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) if (v->banshee.vga[0x3c4 & 0x1f] < ARRAY_LENGTH(v->banshee.seq)) v->banshee.seq[v->banshee.vga[0x3c4 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%08X:banshee_seq_w(%X) = %02X\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3c4 & 0x1f], data); + logerror("%s:banshee_seq_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3c4 & 0x1f], data); break; /* Graphics controller access */ @@ -4330,7 +4330,7 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) if (v->banshee.vga[0x3ce & 0x1f] < ARRAY_LENGTH(v->banshee.gc)) v->banshee.gc[v->banshee.vga[0x3ce & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%08X:banshee_gc_w(%X) = %02X\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3ce & 0x1f], data); + logerror("%s:banshee_gc_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3ce & 0x1f], data); break; /* CRTC access */ @@ -4338,13 +4338,13 @@ static WRITE8_DEVICE_HANDLER( banshee_vga_w ) if (v->banshee.vga[0x3d4 & 0x1f] < ARRAY_LENGTH(v->banshee.crtc)) v->banshee.crtc[v->banshee.vga[0x3d4 & 0x1f]] = data; if (LOG_REGISTERS) - logerror("%08X:banshee_crtc_w(%X) = %02X\n", cpu_get_pc(device->machine->activecpu), v->banshee.vga[0x3d4 & 0x1f], data); + logerror("%s:banshee_crtc_w(%X) = %02X\n", cpuexec_describe_context(device->machine), v->banshee.vga[0x3d4 & 0x1f], data); break; default: v->banshee.vga[offset] = data; if (LOG_REGISTERS) - logerror("%08X:banshee_vga_w(%X) = %02X\n", cpu_get_pc(device->machine->activecpu), 0x3c0+offset, data); + logerror("%s:banshee_vga_w(%X) = %02X\n", cpuexec_describe_context(device->machine), 0x3c0+offset, data); break; } } @@ -4366,7 +4366,7 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) if ((v->banshee.io[offset] ^ old) & 0x2800) v->fbi.clut_dirty = TRUE; if (LOG_REGISTERS) - logerror("%08X:banshee_io_w(%s) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask); break; case io_dacData: @@ -4377,14 +4377,14 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) v->fbi.clut_dirty = TRUE; } if (LOG_REGISTERS) - logerror("%08X:banshee_dac_w(%X) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), v->banshee.io[io_dacAddr] & 0x1ff, data, mem_mask); + logerror("%s:banshee_dac_w(%X) = %08X & %08X\n", cpuexec_describe_context(device->machine), v->banshee.io[io_dacAddr] & 0x1ff, data, mem_mask); break; case io_miscInit0: COMBINE_DATA(&v->banshee.io[offset]); v->fbi.yorigin = (data >> 18) & 0xfff; if (LOG_REGISTERS) - logerror("%08X:banshee_io_w(%s) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask); break; case io_vidScreenSize: @@ -4398,14 +4398,14 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) video_screen_set_visarea(v->screen, 0, v->fbi.width - 1, 0, v->fbi.height - 1); adjust_vblank_timer(v); if (LOG_REGISTERS) - logerror("%08X:banshee_io_w(%s) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask); break; case io_lfbMemoryConfig: v->fbi.lfb_base = (data & 0x1fff) << 10; v->fbi.lfb_stride = ((data >> 13) & 7) + 9; if (LOG_REGISTERS) - logerror("%08X:banshee_io_w(%s) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask); break; case io_vgab0: case io_vgab4: case io_vgab8: case io_vgabc: @@ -4424,7 +4424,7 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) default: COMBINE_DATA(&v->banshee.io[offset]); if (LOG_REGISTERS) - logerror("%08X:banshee_io_w(%s) = %08X & %08X\n", cpu_get_pc(device->machine->activecpu), banshee_io_reg_name[offset], data, mem_mask); + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", cpuexec_describe_context(device->machine), banshee_io_reg_name[offset], data, mem_mask); break; } } @@ -4432,11 +4432,11 @@ WRITE32_DEVICE_HANDLER( banshee_io_w ) /*************************************************************************** - DEVICE INTERFACE + DEVICE INTERFACE ***************************************************************************/ /*------------------------------------------------- - device start callback + device start callback -------------------------------------------------*/ static DEVICE_START( voodoo ) @@ -4456,6 +4456,7 @@ static DEVICE_START( voodoo ) /* validate configuration */ assert(config->screen != NULL); + assert(config->cputag != NULL); assert(config->type >= VOODOO_1 && config->type < MAX_VOODOO_TYPES); assert(config->fbmem > 0); assert(config->type >= VOODOO_BANSHEE || config->tmumem0 > 0); @@ -4539,8 +4540,10 @@ static DEVICE_START( voodoo ) /* set the type, and initialize the chip mask */ v->index = device_list_index(device->machine->config->devicelist, device->type, device->tag); - v->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, config->screen); + v->screen = devtag_get_device(device->machine, VIDEO_SCREEN, config->screen); assert_always(v->screen != NULL, "Unable to find screen attached to voodoo"); + v->cpu = cputag_get_cpu(device->machine, config->cputag); + assert_always(v->cpu != NULL, "Unable to find CPU attached to voodoo"); v->type = config->type; v->chipmask = 0x01; v->attoseconds_per_cycle = ATTOSECONDS_PER_SECOND / v->freq; @@ -4617,7 +4620,7 @@ static DEVICE_START( voodoo ) /*------------------------------------------------- - device exit callback + device exit callback -------------------------------------------------*/ static DEVICE_STOP( voodoo ) @@ -4631,7 +4634,7 @@ static DEVICE_STOP( voodoo ) /*------------------------------------------------- - device reset callback + device reset callback -------------------------------------------------*/ static DEVICE_RESET( voodoo ) @@ -4642,7 +4645,7 @@ static DEVICE_RESET( voodoo ) /*------------------------------------------------- - device set info callback + device set info callback -------------------------------------------------*/ static DEVICE_SET_INFO( voodoo ) @@ -4655,7 +4658,7 @@ static DEVICE_SET_INFO( voodoo ) /*------------------------------------------------- - device get info callback + device get info callback -------------------------------------------------*/ DEVICE_GET_INFO( voodoo ) diff --git a/src/emu/video/voodoo.h b/src/emu/video/voodoo.h index 4bcde1a2289..04ec9332b96 100644 --- a/src/emu/video/voodoo.h +++ b/src/emu/video/voodoo.h @@ -45,6 +45,7 @@ struct _voodoo_config UINT8 tmumem0; UINT8 tmumem1; const char * screen; + const char * cputag; voodoo_vblank_func vblank; voodoo_stall_func stall; }; @@ -83,6 +84,9 @@ struct _voodoo_config #define MDRV_3DFX_VOODOO_STALL(_stall) \ MDRV_DEVICE_CONFIG_DATAPTR(voodoo_config, stall, _stall) +#define MDRV_3DFX_VOODOO_CPU(_cputag) \ + MDRV_DEVICE_CONFIG_DATAPTR(voodoo_config, cputag, _cputag) + #define MDRV_3DFX_VOODOO_MODIFY(_tag) \ MDRV_DEVICE_MODIFY(_tag, VOODOO_GRAPHICS) diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c index 1eb5e1d23ad..689fc011266 100644 --- a/src/mame/audio/cage.c +++ b/src/mame/audio/cage.c @@ -461,13 +461,11 @@ static void update_control_lines(running_machine *machine) } /* set the IOF input lines */ - cpu_push_context(cage_cpu); val = cpu_get_reg(cage_cpu, TMS32031_IOF); val &= ~0x88; if (cpu_to_cage_ready) val |= 0x08; if (cage_to_cpu_ready) val |= 0x80; cpu_set_reg(cage_cpu, TMS32031_IOF, val); - cpu_pop_context(); } @@ -513,7 +511,7 @@ static READ32_HANDLER( cage_io_status_r ) UINT16 main_from_cage_r(const address_space *space) { if (LOG_COMM) - logerror("%06X:main read data = %04X\n", cpu_get_pc(space->machine->activecpu), soundlatch_word_r(space, 0, 0)); + logerror("%s:main read data = %04X\n", cpuexec_describe_context(space->machine), soundlatch_word_r(space, 0, 0)); cage_to_cpu_ready = 0; update_control_lines(space->machine); return soundlatch_word_r(space, 0, 0xffff); @@ -532,7 +530,7 @@ static TIMER_CALLBACK( deferred_cage_w ) void main_to_cage_w(UINT16 data) { if (LOG_COMM) - logerror("%06X:Command to CAGE = %04X\n", cpu_get_pc(Machine->activecpu), data); + logerror("%s:Command to CAGE = %04X\n", cpuexec_describe_context(Machine), data); timer_call_after_resynch(Machine, NULL, data, deferred_cage_w); } diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index 5cdf6f1aa13..230b9c9f808 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -1414,18 +1414,15 @@ WRITE32_HANDLER( dsio_idma_addr_w ) { if (LOG_DCS_TRANSFERS) logerror("%08X:IDMA_addr = %04X\n", cpu_get_pc(space->cpu), data); - cpu_push_context(dcs.cpu); adsp2181_idma_addr_w(dcs.cpu, data); if (data == 0) dsio.start_on_next_write = 2; - cpu_pop_context(); } WRITE32_HANDLER( dsio_idma_data_w ) { UINT32 pc = cpu_get_pc(space->cpu); - cpu_push_context(dcs.cpu); if (ACCESSING_BITS_0_15) { if (LOG_DCS_TRANSFERS) @@ -1438,7 +1435,6 @@ WRITE32_HANDLER( dsio_idma_data_w ) logerror("%08X:IDMA_data_w(%04X) = %04X\n", pc, adsp2181_idma_addr_r(dcs.cpu), data >> 16); adsp2181_idma_data_w(dcs.cpu, data >> 16); } - cpu_pop_context(); if (dsio.start_on_next_write && --dsio.start_on_next_write == 0) { logerror("Starting DSIO CPU\n"); @@ -1450,9 +1446,7 @@ WRITE32_HANDLER( dsio_idma_data_w ) READ32_HANDLER( dsio_idma_data_r ) { UINT32 result; - cpu_push_context(dcs.cpu); result = adsp2181_idma_data_r(dcs.cpu); - cpu_pop_context(); if (LOG_DCS_TRANSFERS) logerror("%08X:IDMA_data_r(%04X) = %04X\n", cpu_get_pc(space->cpu), adsp2181_idma_addr_r(dcs.cpu), result); return result; @@ -1492,7 +1486,7 @@ void dcs_reset_w(int state) /* going high halts the CPU */ if (state) { - logerror("%08x: DCS reset = %d\n", safe_cpu_get_pc(Machine->activecpu), state); + logerror("%s: DCS reset = %d\n", cpuexec_describe_context(Machine), state); /* just run through the init code again */ timer_call_after_resynch(Machine, NULL, 0, dcs_reset); @@ -1537,7 +1531,7 @@ static READ16_HANDLER( fifo_input_r ) static void dcs_delayed_data_w(running_machine *machine, int data) { if (LOG_DCS_IO) - logerror("%08X:dcs_data_w(%04X)\n", cpu_get_pc(machine->activecpu), data); + logerror("%s:dcs_data_w(%04X)\n", cpuexec_describe_context(machine), data); /* boost the interleave temporarily */ cpuexec_boost_interleave(machine, ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5)); @@ -1643,7 +1637,7 @@ int dcs_data_r(void) delayed_ack_w(); if (LOG_DCS_IO) - logerror("%08X:dcs_data_r(%04X)\n", cpu_get_pc(Machine->activecpu), dcs.output_data); + logerror("%s:dcs_data_r(%04X)\n", cpuexec_describe_context(Machine), dcs.output_data); return dcs.output_data; } @@ -1755,7 +1749,6 @@ static void reset_timer(running_machine *machine) { /* Road Burners: @ 28: JMP $0032 18032F, same code at $32 */ - cpu_push_context(dcs.cpu); if (memory_read_dword(dcs.program, 0x18*4) == 0x0c0030 && /* ENA SEC_REG */ memory_read_dword(dcs.program, 0x19*4) == 0x804828 && /* SI = DM($0482) */ memory_read_dword(dcs.program, 0x1a*4) == 0x904828 && /* DM($0482) = SI */ @@ -1764,7 +1757,6 @@ static void reset_timer(running_machine *machine) { dcs.timer_ignore = TRUE; } - cpu_pop_context(); } /* adjust the timer if not optimized */ @@ -1929,13 +1921,11 @@ static TIMER_CALLBACK( dcs_irq ) INT16 buffer[0x400]; int i; - cpu_push_context(dcs.cpu); for (i = 0; i < count; i++) { buffer[i] = memory_read_word(dcs.data, reg * 2); reg += dcs.incs; } - cpu_pop_context(); if (dcs.channels) dmadac_transfer(0, dcs.channels, 1, dcs.channels, (dcs.size / 2) / dcs.channels, buffer); @@ -2128,7 +2118,7 @@ static int preprocess_stage_1(running_machine *machine, UINT16 data) if (data == 0x001a) { if (LOG_DCS_TRANSFERS) - logerror("%08X:DCS Transfer command %04X\n", cpu_get_pc(machine->activecpu), data); + logerror("%s:DCS Transfer command %04X\n", cpuexec_describe_context(machine), data); transfer.state++; if (transfer.hle_enabled) return 1; @@ -2138,7 +2128,7 @@ static int preprocess_stage_1(running_machine *machine, UINT16 data) else if (data == 0x002a) { if (LOG_DCS_TRANSFERS) - logerror("%08X:DCS State change %04X\n", cpu_get_pc(machine->activecpu), data); + logerror("%s:DCS State change %04X\n", cpuexec_describe_context(machine), data); transfer.dcs_state = 1; } @@ -2219,7 +2209,6 @@ static int preprocess_stage_1(running_machine *machine, UINT16 data) if (transfer.hle_enabled) { /* write the new data to memory */ - cpu_push_context(dcs.cpu); if (transfer.type == 0) { if (transfer.writes_left & 1) @@ -2229,7 +2218,6 @@ static int preprocess_stage_1(running_machine *machine, UINT16 data) } else memory_write_word(dcs.data, transfer.start++ * 2, data); - cpu_pop_context(); /* if we're done, start a timer to send the response words */ if (transfer.state == 0) @@ -2266,7 +2254,7 @@ static int preprocess_stage_2(running_machine *machine, UINT16 data) if (data == 0x55d0 || data == 0x55d1) { if (LOG_DCS_TRANSFERS) - logerror("%08X:DCS Transfer command %04X\n", cpu_get_pc(machine->activecpu), data); + logerror("%s:DCS Transfer command %04X\n", cpuexec_describe_context(machine), data); transfer.state++; if (transfer.hle_enabled) return 1; @@ -2276,7 +2264,7 @@ static int preprocess_stage_2(running_machine *machine, UINT16 data) else { if (LOG_DCS_TRANSFERS) - logerror("%08X:Command: %04X\n", cpu_get_pc(machine->activecpu), data); + logerror("%s:Command: %04X\n", cpuexec_describe_context(machine), data); } break; diff --git a/src/mame/audio/dkong.c b/src/mame/audio/dkong.c index f21563c09d1..7bc51781d58 100644 --- a/src/mame/audio/dkong.c +++ b/src/mame/audio/dkong.c @@ -1115,7 +1115,7 @@ static READ8_DEVICE_HANDLER( dkong_tune_r ) } else { - /* printf("rom access at pc = %4x\n",cpu_get_pc(machine->activecpu)); */ + /* printf("%s:rom access\n",cpuexec_describe_context(device->machine)); */ return (state->snd_rom[0x1000+(page & 7)*256+offset]); } } diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c index f18acf47f85..be5b8b9421c 100644 --- a/src/mame/audio/exidy.c +++ b/src/mame/audio/exidy.c @@ -420,11 +420,11 @@ static void r6532_portb_w(const device_config *device, UINT8 newdata, UINT8 oldd if ((olddata & 0x01) && !(newdata & 0x01)) { riot6532_porta_in_set(riot, tms5220_status_r(space, 0), 0xff); - logerror("(%f)%04X:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpu_get_previouspc(device->machine->activecpu), tms5220_status_r(space, 0)); + logerror("(%f)%s:TMS5220 status read = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), tms5220_status_r(space, 0)); } if ((olddata & 0x02) && !(newdata & 0x02)) { - logerror("(%f)%04X:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpu_get_previouspc(device->machine->activecpu), riot6532_porta_out_get(riot)); + logerror("(%f)%s:TMS5220 data write = %02X\n", attotime_to_double(timer_get_time(device->machine)), cpuexec_describe_context(device->machine), riot6532_porta_out_get(riot)); tms5220_data_w(space, 0, riot6532_porta_out_get(riot)); } } diff --git a/src/mame/audio/harddriv.c b/src/mame/audio/harddriv.c index e2e5f699c2c..6d21a810b29 100644 --- a/src/mame/audio/harddriv.c +++ b/src/mame/audio/harddriv.c @@ -258,20 +258,14 @@ WRITE16_HANDLER( hdsnd68k_320ram_w ) READ16_HANDLER( hdsnd68k_320ports_r ) { const address_space *iospace = cpu_get_address_space(hdcpu_sounddsp, ADDRESS_SPACE_IO); - UINT16 result; - cpu_push_context(iospace->cpu); - result = memory_read_word(iospace, (offset & 7) << 1); - cpu_pop_context(); - return result; + return memory_read_word(iospace, (offset & 7) << 1); } WRITE16_HANDLER( hdsnd68k_320ports_w ) { const address_space *iospace = cpu_get_address_space(hdcpu_sounddsp, ADDRESS_SPACE_IO); - cpu_push_context(hdcpu_sounddsp); memory_write_word(iospace, (offset & 7) << 1, data); - cpu_pop_context(); } diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c index ecccbe49283..34e0d70dbd2 100644 --- a/src/mame/audio/leland.c +++ b/src/mame/audio/leland.c @@ -377,7 +377,6 @@ static void leland_80186_dma_update(void *param, stream_sample_t **inputs, strea memset(buffer, 0, length * sizeof(*buffer)); /* loop over DMA buffers */ - cpu_push_context(dmaspace->cpu); for (i = 0; i < 2; i++) { struct dma_state *d = &i80186.dma[i]; @@ -447,7 +446,6 @@ static void leland_80186_dma_update(void *param, stream_sample_t **inputs, strea } } } - cpu_pop_context(); } @@ -614,12 +612,12 @@ void leland_80186_sound_init(void) * *************************************/ -static IRQ_CALLBACK(int_callback) +static IRQ_CALLBACK( int_callback ) { if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", attotime_to_double(timer_get_time(device->machine)), i80186.intr.poll_status & 0x1f); /* clear the interrupt */ - cpu_set_info_int(device->machine->activecpu, CPUINFO_INT_INPUT_STATE + 0, CLEAR_LINE); + cpu_set_info_int(device, CPUINFO_INT_INPUT_STATE + 0, CLEAR_LINE); i80186.intr.pending = 0; /* clear the request and set the in-service bit */ @@ -752,7 +750,7 @@ static void handle_eoi(running_machine *machine, int data) case 0x0d: i80186.intr.in_service &= ~0x20; break; case 0x0e: i80186.intr.in_service &= ~0x40; break; case 0x0f: i80186.intr.in_service &= ~0x80; break; - default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(machine->activecpu), data & 0x1f); + default: logerror("%s:ERROR - 80186 EOI with unknown vector %02X\n", cpuexec_describe_context(machine), data & 0x1f); } if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", attotime_to_double(timer_get_time(machine)), data & 0x1f); } @@ -1709,7 +1707,7 @@ WRITE8_HANDLER( leland_80186_control_w ) static TIMER_CALLBACK( command_lo_sync ) { - if (LOG_COMM) logerror("%04X:Write sound command latch lo = %02X\n", cpu_get_previouspc(machine->activecpu), param); + if (LOG_COMM) logerror("%s:Write sound command latch lo = %02X\n", cpuexec_describe_context(machine), param); sound_command = (sound_command & 0xff00) | param; } diff --git a/src/mame/audio/meadows.c b/src/mame/audio/meadows.c index f2a8168e7fb..fad34320627 100644 --- a/src/mame/audio/meadows.c +++ b/src/mame/audio/meadows.c @@ -67,7 +67,7 @@ void meadows_sh_update(running_machine *machine) /* amplitude is a combination of the upper 4 bits of 0c01 */ /* and bit 4 merged from S2650's flag output */ amp = ((meadows_0c03 & ENABLE_CTR1) == 0) ? 0 : (meadows_0c01 & 0xf0) >> 1; - if( cpu_get_reg(machine->activecpu, S2650_FO) ) + if( cpu_get_reg(machine->cpu[0], S2650_FO) ) amp += 0x80; /* calculate frequency for counter #1 */ /* bit 0..3 of 0c01 are ctr preset */ diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index c787dfb0295..b67060d238d 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -219,7 +219,7 @@ static UINT8 alg_cia_0_porta_r(const device_config *device) static UINT8 alg_cia_0_portb_r(const device_config *device) { - logerror("%06x:alg_cia_0_portb_r\n", cpu_get_pc(device->machine->activecpu)); + logerror("%s:alg_cia_0_portb_r\n", cpuexec_describe_context(device->machine)); return 0xff; } @@ -227,20 +227,20 @@ static UINT8 alg_cia_0_portb_r(const device_config *device) static void alg_cia_0_portb_w(const device_config *device, UINT8 data) { /* parallel port */ - logerror("%06x:alg_cia_0_portb_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); + logerror("%s:alg_cia_0_portb_w(%02x)\n", cpuexec_describe_context(device->machine), data); } static UINT8 alg_cia_1_porta_r(const device_config *device) { - logerror("%06x:alg_cia_1_porta_r\n", cpu_get_pc(device->machine->activecpu)); + logerror("%s:alg_cia_1_porta_r\n", cpuexec_describe_context(device->machine)); return 0xff; } static void alg_cia_1_porta_w(const device_config *device, UINT8 data) { - logerror("%06x:alg_cia_1_porta_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); + logerror("%s:alg_cia_1_porta_w(%02x)\n", cpuexec_describe_context(device->machine), data); } diff --git a/src/mame/drivers/bfcobra.c b/src/mame/drivers/bfcobra.c index 931f1a64619..95793831454 100644 --- a/src/mame/drivers/bfcobra.c +++ b/src/mame/drivers/bfcobra.c @@ -409,9 +409,9 @@ INLINE UINT8* blitter_get_addr(running_machine *machine, UINT32 addr) The Flare One blitter is a simpler design with slightly different parameters and will require hardware tests to figure everything out correctly. */ -static void RunBlit(running_machine *machine) +static void RunBlit(const address_space *space) { -#define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(machine, blitter.program.addr++)) +#define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(space->machine, blitter.program.addr++)) int cycles_used = 0; @@ -439,7 +439,7 @@ static void RunBlit(running_machine *machine) /* This debug is now wrong ! */ if (DEBUG_BLITTER) { - mame_printf_debug("\nBlitter (%x): Running command from 0x%.5x\n\n", cpu_get_previouspc(machine->activecpu), blitter.program.addr - 12); + mame_printf_debug("\n%s:Blitter: Running command from 0x%.5x\n\n", cpuexec_describe_context(device->machine), blitter.program.addr - 12); mame_printf_debug("Command Reg %.2x", blitter.command); mame_printf_debug(" %s %s %s %s %s %s %s\n", blitter.command & CMD_RUN ? "RUN" : " ", @@ -521,7 +521,7 @@ static void RunBlit(running_machine *machine) blitter.source.addr0 -=blitter.step; } - *blitter_get_addr(machine, blitter.dest.addr) = blitter.pattern; + *blitter_get_addr(space->machine, blitter.dest.addr) = blitter.pattern; cycles_used++; } while (--innercnt); @@ -535,7 +535,7 @@ static void RunBlit(running_machine *machine) if (LOOPTYPE == 3 && innercnt == blitter.innercnt) { - srcdata = *(blitter_get_addr(machine, blitter.source.addr & 0xfffff)); + srcdata = *(blitter_get_addr(space->machine, blitter.source.addr & 0xfffff)); blitter.source.loword++; cycles_used++; } @@ -545,7 +545,7 @@ static void RunBlit(running_machine *machine) { if (LOOPTYPE == 0 || LOOPTYPE == 1) { - srcdata = *(blitter_get_addr(machine, blitter.source.addr & 0xfffff)); + srcdata = *(blitter_get_addr(space->machine, blitter.source.addr & 0xfffff)); cycles_used++; if (blitter.modectl & MODE_SSIGN) @@ -560,7 +560,7 @@ static void RunBlit(running_machine *machine) /* Read destination pixel? */ if (LOOPTYPE == 0) { - dstdata = *blitter_get_addr(machine, blitter.dest.addr & 0xfffff); + dstdata = *blitter_get_addr(space->machine, blitter.dest.addr & 0xfffff); cycles_used++; } @@ -629,10 +629,10 @@ static void RunBlit(running_machine *machine) The existing destination pixel is used as a lookup into the table and the colours is replaced. */ - UINT8 dest = *blitter_get_addr(machine, blitter.dest.addr); - UINT8 newcol = *(blitter_get_addr(machine, (blitter.source.addr + dest) & 0xfffff)); + UINT8 dest = *blitter_get_addr(space->machine, blitter.dest.addr); + UINT8 newcol = *(blitter_get_addr(space->machine, (blitter.source.addr + dest) & 0xfffff)); - *blitter_get_addr(machine, blitter.dest.addr) = newcol; + *blitter_get_addr(space->machine, blitter.dest.addr) = newcol; cycles_used += 3; } else @@ -651,7 +651,7 @@ static void RunBlit(running_machine *machine) if (blitter.compfunc & CMPFUNC_LOG0) final_result |= ~result & ~dstdata; - *blitter_get_addr(machine, blitter.dest.addr) = final_result; + *blitter_get_addr(space->machine, blitter.dest.addr) = final_result; cycles_used++; } } @@ -691,7 +691,7 @@ static void RunBlit(running_machine *machine) } while (blitter.command & CMD_RUN); /* Burn Z80 cycles while blitter is in operation */ - cpu_spinuntil_time(machine->activecpu, ATTOTIME_IN_NSEC( (1000000000 / Z80_XTAL)*cycles_used * 2 ) ); + cpu_spinuntil_time(space->cpu, ATTOTIME_IN_NSEC( (1000000000 / Z80_XTAL)*cycles_used * 2 ) ); } @@ -944,7 +944,7 @@ static WRITE8_HANDLER( chipset_w ) blitter.command = data; if (data & CMD_RUN) - RunBlit(space->machine); + RunBlit(space); else mame_printf_debug("Blitter stopped by IO.\n"); diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index 09432f1e545..297d7fff9a2 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -83,7 +83,7 @@ INLINE UINT8 swap_bits_5_6(UINT8 data) } -static void btime_decrypt(running_machine *machine) +static void btime_decrypt(const address_space *space) { UINT8 *src, *src1; int addr, addr1; @@ -95,17 +95,17 @@ static void btime_decrypt(running_machine *machine) /* xxxx xxx1 xxxx x1xx are encrypted. */ /* get the address of the next opcode */ - addr = cpu_get_pc(machine->activecpu); + addr = cpu_get_pc(space->cpu); /* however if the previous instruction was JSR (which caused a write to */ /* the stack), fetch the address of the next instruction. */ - addr1 = cpu_get_previouspc(machine->activecpu); - src1 = (addr1 < 0x9000) ? rambase : memory_region(machine, "main"); + addr1 = cpu_get_previouspc(space->cpu); + src1 = (addr1 < 0x9000) ? rambase : memory_region(space->machine, "main"); if (decrypted[addr1] == 0x20) /* JSR $xxxx */ addr = src1[addr1+1] + 256 * src1[addr1+2]; /* If the address of the next instruction is xxxx xxx1 xxxx x1xx, decode it. */ - src = (addr < 0x9000) ? rambase : memory_region(machine, "main"); + src = (addr < 0x9000) ? rambase : memory_region(space->machine, "main"); if ((addr & 0x0104) == 0x0104) { /* 76543210 -> 65342710 bit rotation */ @@ -164,7 +164,7 @@ static WRITE8_HANDLER( btime_w ) rambase[offset] = data; - btime_decrypt(space->machine); + btime_decrypt(space); } static WRITE8_HANDLER( tisland_w ) @@ -184,7 +184,7 @@ static WRITE8_HANDLER( tisland_w ) rambase[offset] = data; - btime_decrypt(space->machine); + btime_decrypt(space); } static WRITE8_HANDLER( zoar_w ) @@ -202,7 +202,7 @@ static WRITE8_HANDLER( zoar_w ) rambase[offset] = data; - btime_decrypt(space->machine); + btime_decrypt(space); } static WRITE8_HANDLER( disco_w ) @@ -216,7 +216,7 @@ static WRITE8_HANDLER( disco_w ) rambase[offset] = data; - btime_decrypt(space->machine); + btime_decrypt(space); } diff --git a/src/mame/drivers/cidelsa.c b/src/mame/drivers/cidelsa.c index fa72cb4b178..ad9a60a941e 100644 --- a/src/mame/drivers/cidelsa.c +++ b/src/mame/drivers/cidelsa.c @@ -579,7 +579,7 @@ static MACHINE_START( draco ) static MACHINE_RESET( cidelsa ) { - cputag_set_input_line(machine, "main", INPUT_LINE_RESET, PULSE_LINE); + cputag_set_input_line(machine, MAIN_CPU_TAG, INPUT_LINE_RESET, PULSE_LINE); } /* Machine Drivers */ @@ -589,7 +589,7 @@ static MACHINE_DRIVER_START( destryer ) // basic system hardware - MDRV_CPU_ADD("main", CDP1802, DESTRYER_CHR1) + MDRV_CPU_ADD(MAIN_CPU_TAG, CDP1802, DESTRYER_CHR1) MDRV_CPU_PROGRAM_MAP(destryer_map, 0) MDRV_CPU_IO_MAP(destryer_io_map, 0) MDRV_CPU_CONFIG(cidelsa_cdp1802_config) @@ -615,7 +615,7 @@ static MACHINE_DRIVER_START( destryea ) // basic system hardware - MDRV_CPU_ADD("main", CDP1802, DESTRYER_CHR1) + MDRV_CPU_ADD(MAIN_CPU_TAG, CDP1802, DESTRYER_CHR1) MDRV_CPU_PROGRAM_MAP(destryea_map, 0) MDRV_CPU_IO_MAP(destryer_io_map, 0) MDRV_CPU_CONFIG(cidelsa_cdp1802_config) @@ -641,7 +641,7 @@ static MACHINE_DRIVER_START( altair ) // basic system hardware - MDRV_CPU_ADD("main", CDP1802, ALTAIR_CHR1) + MDRV_CPU_ADD(MAIN_CPU_TAG, CDP1802, ALTAIR_CHR1) MDRV_CPU_PROGRAM_MAP(altair_map, 0) MDRV_CPU_IO_MAP(altair_io_map, 0) MDRV_CPU_CONFIG(cidelsa_cdp1802_config) @@ -680,7 +680,7 @@ static MACHINE_DRIVER_START( draco ) // basic system hardware - MDRV_CPU_ADD("main", CDP1802, DRACO_CHR1) + MDRV_CPU_ADD(MAIN_CPU_TAG, CDP1802, DRACO_CHR1) MDRV_CPU_PROGRAM_MAP(draco_map, 0) MDRV_CPU_IO_MAP(draco_io_map, 0) MDRV_CPU_CONFIG(cidelsa_cdp1802_config) @@ -726,7 +726,7 @@ MACHINE_DRIVER_END /* ROMs */ ROM_START( destryer ) - ROM_REGION( 0x10000, "main", 0 ) + ROM_REGION( 0x10000, MAIN_CPU_TAG, 0 ) ROM_LOAD( "des a 2.ic4", 0x0000, 0x0800, CRC(63749870) SHA1(a8eee4509d7a52dcf33049de221d928da3632174) ) ROM_LOAD( "des b 2.ic5", 0x0800, 0x0800, CRC(60604f40) SHA1(32ca95c5b38b0f4992e04d77123d217f143ae084) ) ROM_LOAD( "des c 2.ic6", 0x1000, 0x0800, CRC(a7cdeb7b) SHA1(a5a7748967d4ca89fb09632e1f0130ef050dbd68) ) @@ -735,7 +735,7 @@ ROM_END // this was destroyer2.rom in standalone emu.. ROM_START( destryea ) - ROM_REGION( 0x10000, "main", 0 ) + ROM_REGION( 0x10000, MAIN_CPU_TAG, 0 ) ROM_LOAD( "destryea_1", 0x0000, 0x0800, CRC(421428e9) SHA1(0ac3a1e7f61125a1cd82145fa28cbc4b93505dc9) ) ROM_LOAD( "destryea_2", 0x0800, 0x0800, CRC(55dc8145) SHA1(a0066d3f3ac0ae56273485b74af90eeffea5e64e) ) ROM_LOAD( "destryea_3", 0x1000, 0x0800, CRC(5557bdf8) SHA1(37a9cbc5d25051d3bed7535c58aac937cd7c64e1) ) @@ -743,7 +743,7 @@ ROM_START( destryea ) ROM_END ROM_START( altair ) - ROM_REGION( 0x10000, "main", 0 ) + ROM_REGION( 0x10000, MAIN_CPU_TAG, 0 ) ROM_LOAD( "alt a 1.ic7", 0x0000, 0x0800, CRC(37c26c4e) SHA1(30df7efcf5bd12dafc1cb6e894fc18e7b76d3e61) ) ROM_LOAD( "alt b 1.ic8", 0x0800, 0x0800, CRC(76b814a4) SHA1(e8ab1d1cbcef974d929ef8edd10008f60052a607) ) ROM_LOAD( "alt c 1.ic9", 0x1000, 0x0800, CRC(2569ce44) SHA1(a09597d2f8f50fab9a09ed9a59c50a2bdcba47bb) ) @@ -753,7 +753,7 @@ ROM_START( altair ) ROM_END ROM_START( draco ) - ROM_REGION( 0x10000, "main", 0 ) + ROM_REGION( 0x10000, MAIN_CPU_TAG, 0 ) ROM_LOAD( "dra a 1.ic10", 0x0000, 0x0800, CRC(ca127984) SHA1(46721cf42b1c891f7c88bc063a2149dd3cefea74) ) ROM_LOAD( "dra b 1.ic11", 0x0800, 0x0800, CRC(e4936e28) SHA1(ddbbf769994d32a6bce75312306468a89033f0aa) ) ROM_LOAD( "dra c 1.ic12", 0x1000, 0x0800, CRC(94480f5d) SHA1(8f49ce0f086259371e999d097a502482c83c6e9e) ) diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index efcdb003533..898ab39ff05 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -2604,7 +2604,7 @@ static UINT32 cps3_dma_callback(UINT32 src, UINT32 dst, UINT32 data, int size) } else { - //printf("PC %08x :src %08x, dst %08x, returning %08x\n", cpu_get_pc(machine->activecpu), src, dst, data); + //printf("%s :src %08x, dst %08x, returning %08x\n", cpuexec_describe_context(machine), src, dst, data); } /* I doubt this is endian safe.. needs checking / fixing */ diff --git a/src/mame/drivers/crbaloon.c b/src/mame/drivers/crbaloon.c index 43f22ad0b3e..4190a945420 100644 --- a/src/mame/drivers/crbaloon.c +++ b/src/mame/drivers/crbaloon.c @@ -79,7 +79,7 @@ static CUSTOM_INPUT( pc3092_r ) else ret = 0x00; - if (LOG_PC3092) logerror("%04X: read PC3092 = 0x%02x\n", safe_cpu_get_pc(field->port->machine->activecpu), ret); + if (LOG_PC3092) logerror("%s: read PC3092 = 0x%02x\n", cpuexec_describe_context(field->port->machine), ret); return ret; } diff --git a/src/mame/drivers/cubeqst.c b/src/mame/drivers/cubeqst.c index 36ea1932258..9a0c03fcb33 100644 --- a/src/mame/drivers/cubeqst.c +++ b/src/mame/drivers/cubeqst.c @@ -114,8 +114,6 @@ static VIDEO_UPDATE( cubeqst ) /* Bit 3 selects LD/#GRAPHICS */ bitmap_fill(bitmap, cliprect, colormap[255]); - cpu_push_context(screen->machine->cpu[LINE_CPU]); - /* TODO: Add 1 for linebuffering? */ for (y = cliprect->min_y; y <= cliprect->max_y; ++y) { @@ -173,7 +171,6 @@ static VIDEO_UPDATE( cubeqst ) } } - cpu_pop_context(); return 0; } @@ -248,13 +245,10 @@ static WRITE16_HANDLER( control_w ) static TIMER_CALLBACK( delayed_bank_swap ) { - cpu_push_context(machine->cpu[LINE_CPU]); cubeqcpu_swap_line_banks(machine->cpu[LINE_CPU]); /* TODO: This is a little dubious */ cubeqcpu_clear_stack(machine->cpu[LINE_CPU]); - - cpu_pop_context(); } diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c index 7698a713e5a..5b3dd081f9d 100644 --- a/src/mame/drivers/cubocd32.c +++ b/src/mame/drivers/cubocd32.c @@ -116,14 +116,14 @@ static void cd32_cia_0_porta_w(const device_config *device, UINT8 data) static UINT8 cd32_cia_0_portb_r(const device_config *device) { /* parallel port */ - logerror("%06x:CIA0_portb_r\n", cpu_get_pc(device->machine->activecpu)); + logerror("%s:CIA0_portb_r\n", cpuexec_describe_context(device->machine)); return 0xff; } static void cd32_cia_0_portb_w(const device_config *device, UINT8 data) { /* parallel port */ - logerror("%06x:CIA0_portb_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); + logerror("%s:CIA0_portb_w(%02x)\n", cpuexec_describe_context(device->machine), data); } static ADDRESS_MAP_START( cd32_map, ADDRESS_SPACE_PROGRAM, 32 ) diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index 4cc7f9ddc3b..407fccdf4c3 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -594,8 +594,8 @@ static void blit_vert_line(void) INLINE void log_blit(running_machine *machine, int data) { #if 1 - logerror("%06x: blit src %06x x %03x y %03x flags %02x layer %02x pen %02x penmode %02x w %03x h %03x linelen %03x clip: ctrl %x xy %03x %03x wh %03x %03x\n", - cpu_get_pc(machine->activecpu), + logerror("%s: blit src %06x x %03x y %03x flags %02x layer %02x pen %02x penmode %02x w %03x h %03x linelen %03x clip: ctrl %x xy %03x %03x wh %03x %03x\n", + cpuexec_describe_context(machine), ddenlovr_blit_address,ddenlovr_blit_x,ddenlovr_blit_y,data, ddenlovr_dest_layer,ddenlovr_blit_pen,ddenlovr_blit_pen_mode,ddenlovr_rect_width,ddenlovr_rect_height,ddenlovr_line_length, ddenlovr_clip_ctrl,ddenlovr_clip_x,ddenlovr_clip_y, ddenlovr_clip_width,ddenlovr_clip_height ); @@ -903,7 +903,7 @@ profiler_mark(PROFILER_VIDEO); ; #ifdef MAME_DEBUG popmessage("unknown blitter command %02x",data); - logerror("%06x: unknown blitter command %02x\n", cpu_get_pc(machine->activecpu), data); + logerror("%s: unknown blitter command %02x\n", cpuexec_describe_context(machine), data); #endif } @@ -911,7 +911,7 @@ profiler_mark(PROFILER_VIDEO); break; default: - logerror("%06x: Blitter %d reg %02x = %02x\n", cpu_get_pc(machine->activecpu), blitter, ddenlovr_blit_reg[blitter], data); + logerror("%s: Blitter %d reg %02x = %02x\n", cpuexec_describe_context(machine), blitter, ddenlovr_blit_reg[blitter], data); break; } } @@ -2503,7 +2503,7 @@ static void mjchuuka_get_romdata(running_machine *machine) if (address >= size) { - logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(machine->activecpu), address); + logerror("%s: Error, Blitter address %06X out of range\n", cpuexec_describe_context(machine), address); address %= size; } diff --git a/src/mame/drivers/dgpix.c b/src/mame/drivers/dgpix.c index 2ee1110a802..075528880cf 100644 --- a/src/mame/drivers/dgpix.c +++ b/src/mame/drivers/dgpix.c @@ -179,7 +179,7 @@ static WRITE32_HANDLER( coin_w ) static READ32_HANDLER( vblank_r ) { /* burn a bunch of cycles because this is polled frequently during busy loops */ - cpu_adjust_icount(space->cpu, -100); + cpu_eat_cycles(space->cpu, 100); return input_port_read(space->machine, "VBLANK"); } diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c index 5ca0a74ea33..016abcaf6ca 100644 --- a/src/mame/drivers/dkong.c +++ b/src/mame/drivers/dkong.c @@ -497,21 +497,13 @@ static MACHINE_RESET( drakton ) static READ8_DEVICE_HANDLER( dk_dma_read_byte ) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8 result; - - cpu_push_context(space->cpu); - result = memory_read_byte(space, offset); - cpu_pop_context(); - - return result; + return memory_read_byte(space, offset); } static WRITE8_DEVICE_HANDLER( dk_dma_write_byte ) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(space->cpu); memory_write_byte(space, offset, data); - cpu_pop_context(); } static READ8_DEVICE_HANDLER( hb_dma_read_byte ) @@ -520,18 +512,13 @@ static READ8_DEVICE_HANDLER( hb_dma_read_byte ) dkong_state *state = device->machine->driver_data; int bucket = state->rev_map[(offset>>10) & 0x1ff]; int addr; - UINT8 data; if (bucket<0) fatalerror("hb_dma_read_byte - unmapped access for 0x%02x - bucket 0x%02x\n", offset, bucket); addr = ((bucket<<7) & 0x7c00) | (offset & 0x3ff); - cpu_push_context(space->cpu); - data = memory_read_byte(space, addr); - cpu_pop_context(); - - return data; + return memory_read_byte(space, addr); } static WRITE8_DEVICE_HANDLER( hb_dma_write_byte ) @@ -546,9 +533,7 @@ static WRITE8_DEVICE_HANDLER( hb_dma_write_byte ) addr = ((bucket<<7) & 0x7c00) | (offset & 0x3ff); - cpu_push_context(space->cpu); memory_write_byte(space, addr, data); - cpu_pop_context(); } static READ8_DEVICE_HANDLER( p8257_ctl_r ) diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c index e0bf15c69ee..22d6e03a53e 100644 --- a/src/mame/drivers/dorachan.c +++ b/src/mame/drivers/dorachan.c @@ -31,18 +31,15 @@ static CUSTOM_INPUT( dorachan_protection_r ) { UINT8 ret = 0; - if (field->port->machine->activecpu != NULL) + switch (cpu_get_previouspc(field->port->machine->cpu[0])) { - switch (cpu_get_previouspc(field->port->machine->activecpu)) - { - case 0x70ce: ret = 0xf2; break; - case 0x72a2: ret = 0xd5; break; - case 0x72b5: ret = 0xcb; break; + case 0x70ce: ret = 0xf2; break; + case 0x72a2: ret = 0xd5; break; + case 0x72b5: ret = 0xcb; break; - default: - mame_printf_debug("unhandled $2400 read @ %x\n",cpu_get_previouspc(field->port->machine->activecpu)); - break; - } + default: + mame_printf_debug("unhandled $2400 read @ %x\n",cpu_get_previouspc(field->port->machine->cpu[0])); + break; } return ret; diff --git a/src/mame/drivers/dribling.c b/src/mame/drivers/dribling.c index 7162f48a213..de390d5875e 100644 --- a/src/mame/drivers/dribling.c +++ b/src/mame/drivers/dribling.c @@ -112,7 +112,7 @@ static WRITE8_DEVICE_HANDLER( misc_w ) /* bit 1 = (10) = PC1 */ /* bit 0 = (32) = PC0 */ input_mux = data & 7; - logerror("%04X:misc_w(%02X)\n", cpu_get_previouspc(device->machine->activecpu), data); + logerror("%s:misc_w(%02X)\n", cpuexec_describe_context(device->machine), data); } @@ -126,14 +126,14 @@ static WRITE8_DEVICE_HANDLER( sound_w ) /* bit 2 = folla a */ /* bit 1 = folla m */ /* bit 0 = folla b */ - logerror("%04X:sound_w(%02X)\n", cpu_get_previouspc(device->machine->activecpu), data); + logerror("%s:sound_w(%02X)\n", cpuexec_describe_context(device->machine), data); } static WRITE8_DEVICE_HANDLER( pb_w ) { /* write PB0-7 */ - logerror("%04X:pb_w(%02X)\n", cpu_get_previouspc(device->machine->activecpu), data); + logerror("%s:pb_w(%02X)\n", cpuexec_describe_context(device->machine), data); } diff --git a/src/mame/drivers/eolith.c b/src/mame/drivers/eolith.c index 0afda8cd000..eaf6302bc9c 100644 --- a/src/mame/drivers/eolith.c +++ b/src/mame/drivers/eolith.c @@ -102,7 +102,7 @@ static READ32_HANDLER( eolith_custom_r ) bit 8 = ??? bit 9 = ??? */ - eolith_speedup_read(space->machine); + eolith_speedup_read(space); return (input_port_read(space->machine, "IN0") & ~0x300) | (mame_rand(space->machine) & 0x300); } diff --git a/src/mame/drivers/eolith16.c b/src/mame/drivers/eolith16.c index d67a9fd628d..7569d71fc1d 100644 --- a/src/mame/drivers/eolith16.c +++ b/src/mame/drivers/eolith16.c @@ -44,7 +44,7 @@ static WRITE16_HANDLER( eeprom_w ) static READ16_HANDLER( eolith16_custom_r ) { - eolith_speedup_read(space->machine); + eolith_speedup_read(space); return input_port_read(space->machine, "SPECIAL"); } diff --git a/src/mame/drivers/eolithsp.c b/src/mame/drivers/eolithsp.c index 2d78629d3a2..d75a2583303 100644 --- a/src/mame/drivers/eolithsp.c +++ b/src/mame/drivers/eolithsp.c @@ -17,15 +17,15 @@ static int eolith_speedup_resume_scanline; static int eolith_vblank = 0; static int eolith_scanline = 0; -void eolith_speedup_read(running_machine *machine) +void eolith_speedup_read(const address_space *space) { /* for debug */ -// if ((cpu_get_pc(machine->activecpu)!=eolith_speedup_address) && (eolith_vblank!=1) ) -// printf("%06x eolith speedup_read data %02x\n",cpu_get_pc(machine->activecpu), eolith_vblank); +// if ((cpu_get_pc(space->cpu)!=eolith_speedup_address) && (eolith_vblank!=1) ) +// printf("%s:eolith speedup_read data %02x\n",cpuexec_describe_context(space->machine), eolith_vblank); - if (cpu_get_pc(machine->activecpu)==eolith_speedup_address && eolith_vblank==0 && eolith_scanline < eolith_speedup_resume_scanline) + if (cpu_get_pc(space->cpu)==eolith_speedup_address && eolith_vblank==0 && eolith_scanline < eolith_speedup_resume_scanline) { - cpu_spinuntil_trigger(machine->activecpu, 1000); + cpu_spinuntil_trigger(space->cpu, 1000); } } diff --git a/src/mame/drivers/f-32.c b/src/mame/drivers/f-32.c index 4cfdd36d4b9..32b33450fd1 100644 --- a/src/mame/drivers/f-32.c +++ b/src/mame/drivers/f-32.c @@ -96,7 +96,7 @@ static READ32_HANDLER( f32_input_port_1_r ) { /* burn a bunch of cycles because this is polled frequently during busy loops */ if ((cpu_get_pc(space->cpu) == 0x000379de) || - (cpu_get_pc(space->cpu) == 0x000379cc) ) cpu_adjust_icount(space->cpu, -100); + (cpu_get_pc(space->cpu) == 0x000379cc) ) cpu_eat_cycles(space->cpu, 100); //else printf("PC %08x\n", cpu_get_pc(space->cpu) ); return input_port_read(space->machine, "SYSTEM_P2"); } diff --git a/src/mame/drivers/fantland.c b/src/mame/drivers/fantland.c index 2f6a21a2f27..50aa9c58cd4 100644 --- a/src/mame/drivers/fantland.c +++ b/src/mame/drivers/fantland.c @@ -300,7 +300,7 @@ static void borntofi_adpcm_start(int voice) msm5205_reset_w(voice,0); borntofi_adpcm[voice].playing = 1; borntofi_adpcm[voice].nibble = 0; -// logerror("CPU #0 PC = %04X: adpcm start = %06x, stop = %06x\n", cpu_get_pc(machine->activecpu), borntofi_adpcm[voice].addr[0], borntofi_adpcm[voice].addr[1]); +// logerror("%s: adpcm start = %06x, stop = %06x\n", cpuexec_describe_context(device->machine), borntofi_adpcm[voice].addr[0], borntofi_adpcm[voice].addr[1]); } static void borntofi_adpcm_stop(int voice) diff --git a/src/mame/drivers/filetto.c b/src/mame/drivers/filetto.c index 2312c42b4ae..a61e14210de 100644 --- a/src/mame/drivers/filetto.c +++ b/src/mame/drivers/filetto.c @@ -552,15 +552,10 @@ static UINT8 at_pages[0x10]; static DMA8237_MEM_READ( pc_dma_read_byte ) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8 result; offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); - result = memory_read_byte(space, page_offset + offset); - cpu_pop_context(); - - return result; + return memory_read_byte(space, page_offset + offset); } @@ -570,9 +565,7 @@ static DMA8237_MEM_WRITE( pc_dma_write_byte ) offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); memory_write_byte(space, page_offset + offset, data); - cpu_pop_context(); } static READ8_HANDLER(dma_page_select_r) diff --git a/src/mame/drivers/findout.c b/src/mame/drivers/findout.c index 3567d1597a7..3361d961f2d 100644 --- a/src/mame/drivers/findout.c +++ b/src/mame/drivers/findout.c @@ -102,7 +102,7 @@ static WRITE8_DEVICE_HANDLER( sound_w ) /* bit 7 goes directly to the sound amplifier */ dac_data_w(0,((data & 0x80) >> 7) * 255); -// logerror("%04x: sound_w %02x\n",cpu_get_pc(machine->activecpu),data); +// logerror("%s: sound_w %02x\n",cpuexec_describe_context(device->machine),data); // popmessage("%02x",data); } diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 08e9ef08dfb..f7dd31df5a8 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -579,8 +579,8 @@ static void GCU_w(running_machine *machine, int chip, UINT32 offset, UINT32 data if (reg != 0x70 && chip == 0) { - //printf("gcu%d_w: %08X, %08X, %08X at %08X\n", chip, data, offset, mem_mask, cpu_get_pc(machine->activecpu)); - //logerror("gcu%d_w: %08X, %08X, %08X at %08X\n", chip, data, offset, mem_mask, cpu_get_pc(machine->activecpu)); + //printf("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", cpuexec_describe_context(machine), chip, data, offset, mem_mask); + //logerror("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", ccpuexec_describe_context(machine), hip, data, offset, mem_mask); } switch(reg) @@ -974,7 +974,7 @@ static void atapi_command_reg_w(running_machine *machine, int reg, UINT16 data) if (reg == ATAPI_REG_DATA) { -// printf("ATAPI: packet write %04x at %08X\n", data, cpu_get_pc(machine->activecpu)); +// printf("%s:ATAPI: packet write %04x\n", cpuexec_describe_context(device->machine), data); atapi_data[atapi_data_ptr] = data; atapi_data_ptr++; diff --git a/src/mame/drivers/fortecar.c b/src/mame/drivers/fortecar.c index 38c16cebacd..717807c8bf0 100644 --- a/src/mame/drivers/fortecar.c +++ b/src/mame/drivers/fortecar.c @@ -56,7 +56,7 @@ static WRITE8_DEVICE_HANDLER( ppi0_portc_w ) static READ8_DEVICE_HANDLER( ppi0_portc_r ) { -// popmessage("%04x",cpu_get_pc(machine->activecpu)); +// popmessage("%s",cpuexec_describe_context(device->machine)); return (~(eeprom_read_bit()<<1) & 2); } diff --git a/src/mame/drivers/gaelco.c b/src/mame/drivers/gaelco.c index 2ff97795489..584da4e748c 100644 --- a/src/mame/drivers/gaelco.c +++ b/src/mame/drivers/gaelco.c @@ -556,7 +556,7 @@ static WRITE16_HANDLER( gaelco_vram_encrypted_w ) { // mame_printf_debug("gaelco_vram_encrypted_w!!\n"); - data = gaelco_decrypt(space->machine, offset, data, 0x0f, 0x4228); + data = gaelco_decrypt(space, offset, data, 0x0f, 0x4228); COMBINE_DATA(&gaelco_videoram[offset]); tilemap_mark_tile_dirty(gaelco_tilemap[offset >> 11],((offset << 1) & 0x0fff) >> 2); @@ -567,7 +567,7 @@ static WRITE16_HANDLER(gaelco_encrypted_w) { // mame_printf_debug("gaelco_encrypted_w!!\n"); - data = gaelco_decrypt(space->machine, offset, data, 0x0f, 0x4228); + data = gaelco_decrypt(space, offset, data, 0x0f, 0x4228); COMBINE_DATA(&gaelco_screen[offset]); } @@ -575,7 +575,7 @@ static WRITE16_HANDLER( thoop_vram_encrypted_w ) { // mame_printf_debug("gaelco_vram_encrypted_w!!\n"); - data = gaelco_decrypt(space->machine, offset, data, 0x0e, 0x4228); + data = gaelco_decrypt(space, offset, data, 0x0e, 0x4228); COMBINE_DATA(&gaelco_videoram[offset]); tilemap_mark_tile_dirty(gaelco_tilemap[offset >> 11],((offset << 1) & 0x0fff) >> 2); @@ -585,7 +585,7 @@ static WRITE16_HANDLER(thoop_encrypted_w) { // mame_printf_debug("gaelco_encrypted_w!!\n"); - data = gaelco_decrypt(space->machine, offset, data, 0x0e, 0x4228); + data = gaelco_decrypt(space, offset, data, 0x0e, 0x4228); COMBINE_DATA(&gaelco_screen[offset]); } diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index 98228772b73..732eb4b7380 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -388,13 +388,13 @@ static WRITE8_HANDLER( konami_sound_filter_w ) static WRITE8_DEVICE_HANDLER( konami_portc_0_w ) { - logerror("%04X:ppi0_portc_w = %02X\n", cpu_get_pc(device->machine->activecpu), data); + logerror("%s:ppi0_portc_w = %02X\n", cpuexec_describe_context(device->machine), data); } static WRITE8_DEVICE_HANDLER( konami_portc_1_w ) { - logerror("%04X:ppi1_portc_w = %02X\n", cpu_get_pc(device->machine->activecpu), data); + logerror("%s:ppi1_portc_w = %02X\n", cpuexec_describe_context(device->machine), data); } diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c index 209afe7828e..9b2ac9112a1 100644 --- a/src/mame/drivers/galpani2.c +++ b/src/mame/drivers/galpani2.c @@ -144,7 +144,7 @@ static void galpani2_mcu_nmi(running_machine *machine) mcu_size = (memory_read_byte(srcspace, mcu_address + 8)<<8) + (memory_read_byte(srcspace, mcu_address + 9)<<0) ; - logerror("CPU #0 PC %06X : MCU executes command $A, %04X %02X-> %04x\n",cpu_get_pc(machine->activecpu),mcu_src,mcu_size,mcu_dst); + logerror("%s : MCU executes command $A, %04X %02X-> %04x\n",cpuexec_describe_context(machine),mcu_src,mcu_size,mcu_dst); for( ; mcu_size > 0 ; mcu_size-- ) { @@ -164,7 +164,7 @@ static void galpani2_mcu_nmi(running_machine *machine) memory_write_byte(srcspace,mcu_address+0,0xff); memory_write_byte(srcspace,mcu_address+1,0xff); - logerror("CPU #0 PC %06X : MCU ERROR, unknown command %02X\n",cpu_get_pc(machine->activecpu),mcu_command); + logerror("%s : MCU ERROR, unknown command %02X\n",cpuexec_describe_context(machine),mcu_command); } /* Erase command? */ diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c index 078446782e9..2a8ce0549b2 100644 --- a/src/mame/drivers/galpani3.c +++ b/src/mame/drivers/galpani3.c @@ -441,7 +441,7 @@ static void galpani3_mcu_run(running_machine *machine) UINT16 mcu_offset = mcu_ram[0x0012/2] / 2; /* offset in shared RAM where MCU will write */ UINT16 mcu_subcmd = mcu_ram[0x0014/2]; /* sub-command parameter, happens only for command #4 */ - logerror("(PC=%06X): MCU executed command : %04X %04X\n",cpu_get_pc(machine->activecpu),mcu_command,mcu_offset*2); + logerror("%s: MCU executed command : %04X %04X\n",cpuexec_describe_context(machine),mcu_command,mcu_offset*2); /* the only MCU commands found in program code are: 0x04: protection: provide code/data, @@ -454,7 +454,7 @@ static void galpani3_mcu_run(running_machine *machine) case 0x03: // DSW { mcu_ram[mcu_offset] = input_port_read(machine, "DSW"); - logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (read DSW)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c index 735be086064..1e071a5b343 100644 --- a/src/mame/drivers/gamecstl.c +++ b/src/mame/drivers/gamecstl.c @@ -185,7 +185,7 @@ static UINT8 mxtc_config_r(const device_config *busdevice, const device_config * static void mxtc_config_w(const device_config *busdevice, const device_config *device, int function, int reg, UINT8 data) { -// mame_printf_debug("MXTC: write %d, %02X, %02X at %08X\n", function, reg, data, cpu_get_pc(machine->activecpu)); +// mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", cpuexec_describe_context(busdevice->machine), function, reg, data); switch(reg) { @@ -269,7 +269,7 @@ static UINT8 piix4_config_r(const device_config *busdevice, const device_config static void piix4_config_w(const device_config *busdevice, const device_config *device, int function, int reg, UINT8 data) { -// mame_printf_debug("PIIX4: write %d, %02X, %02X at %08X\n", function, reg, data, cpu_get_pc(machine->activecpu)); +// mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", cpuexec_describe_context(busdevice->machine), function, reg, data); piix4_config_reg[function][reg] = data; } @@ -422,15 +422,10 @@ static WRITE8_HANDLER(at_page8_w) static DMA8237_MEM_READ( pc_dma_read_byte ) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8 result; offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); - result = memory_read_byte(space, page_offset + offset); - cpu_pop_context(); - - return result; + return memory_read_byte(space, page_offset + offset); } @@ -440,9 +435,7 @@ static DMA8237_MEM_WRITE( pc_dma_write_byte ) offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); memory_write_byte(space, page_offset + offset, data); - cpu_pop_context(); } diff --git a/src/mame/drivers/gticlub.c b/src/mame/drivers/gticlub.c index 4efc924a7ae..5289a3f28c2 100644 --- a/src/mame/drivers/gticlub.c +++ b/src/mame/drivers/gticlub.c @@ -979,11 +979,13 @@ static MACHINE_DRIVER_START( hangplt ) MDRV_MACHINE_RESET(hangplt) MDRV_3DFX_VOODOO_1_ADD("voodoo0", STD_VOODOO_1_CLOCK, 2, "left") + MDRV_3DFX_VOODOO_CPU("dsp1") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 2) MDRV_3DFX_VOODOO_TMU_MEMORY(1, 2) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_0) MDRV_3DFX_VOODOO_1_ADD("voodoo1", STD_VOODOO_1_CLOCK, 2, "right") + MDRV_3DFX_VOODOO_CPU("dsp2") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 2) MDRV_3DFX_VOODOO_TMU_MEMORY(1, 2) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_1) diff --git a/src/mame/drivers/halleys.c b/src/mame/drivers/halleys.c index 78ad6e8102f..1c06fc92d0c 100644 --- a/src/mame/drivers/halleys.c +++ b/src/mame/drivers/halleys.c @@ -311,7 +311,7 @@ static void blit(int offset) #if HALLEYS_DEBUG if (0) { - logerror("%04x:[%04x]", cpu_get_pc(machine->activecpu), offset); + logerror("%s:[%04x]", cpuexec_describe_context(machine), offset); for (ecx=0; ecx<16; ecx++) logerror(" %02x", param[ecx]); logerror("\n"); } #endif diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c index aa933ea140f..58dce8b13d4 100644 --- a/src/mame/drivers/hornet.c +++ b/src/mame/drivers/hornet.c @@ -1069,6 +1069,7 @@ static MACHINE_DRIVER_START( hornet ) MDRV_NVRAM_HANDLER( hornet ) MDRV_3DFX_VOODOO_1_ADD("voodoo0", STD_VOODOO_1_CLOCK, 2, "main") + MDRV_3DFX_VOODOO_CPU("dsp") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_0) @@ -1126,10 +1127,12 @@ static MACHINE_DRIVER_START( hornet_2board ) MDRV_3DFX_VOODOO_REMOVE("voodoo0") MDRV_3DFX_VOODOO_1_ADD("voodoo0", STD_VOODOO_1_CLOCK, 2, "left") + MDRV_3DFX_VOODOO_CPU("dsp") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_0) MDRV_3DFX_VOODOO_1_ADD("voodoo1", STD_VOODOO_1_CLOCK, 2, "right") + MDRV_3DFX_VOODOO_CPU("dsp2") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_1) @@ -1156,11 +1159,13 @@ static MACHINE_DRIVER_START( hornet_2board_v2 ) MDRV_3DFX_VOODOO_REMOVE("voodoo0") MDRV_3DFX_VOODOO_2_ADD("voodoo0", STD_VOODOO_2_CLOCK, 2, "left") + MDRV_3DFX_VOODOO_CPU("dsp") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_0) MDRV_3DFX_VOODOO_REMOVE("voodoo1") MDRV_3DFX_VOODOO_2_ADD("voodoo1", STD_VOODOO_2_CLOCK, 2, "right") + MDRV_3DFX_VOODOO_CPU("dsp2") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_1) MACHINE_DRIVER_END diff --git a/src/mame/drivers/hyprduel.c b/src/mame/drivers/hyprduel.c index edd93169aef..34a2710fc60 100644 --- a/src/mame/drivers/hyprduel.c +++ b/src/mame/drivers/hyprduel.c @@ -318,7 +318,7 @@ INLINE void blt_write(const address_space *space, const int tmap, const offs_t o case 2: hyprduel_vram_1_w(space,offs,data,mask); break; case 3: hyprduel_vram_2_w(space,offs,data,mask); break; } -// logerror("CPU #0 PC %06X : Blitter %X] %04X <- %04X & %04X\n",cpu_get_pc(machine->activecpu),tmap,offs,data,mask); +// logerror("%s : Blitter %X] %04X <- %04X & %04X\n",cpuexec_describe_context(space->machine),tmap,offs,data,mask); } diff --git a/src/mame/drivers/jchan.c b/src/mame/drivers/jchan.c index bbf32d6e733..cc7129ab1f5 100644 --- a/src/mame/drivers/jchan.c +++ b/src/mame/drivers/jchan.c @@ -212,7 +212,7 @@ static void jchan_mcu_run(running_machine *machine) UINT16 mcu_offset = mcu_ram[0x0012/2] / 2; /* offset in shared RAM where MCU will write */ UINT16 mcu_subcmd = mcu_ram[0x0014/2]; /* sub-command parameter, happens only for command #4 */ - logerror("CPU #0 (PC=%06X) : MCU executed command: %04X %04X %04X ",cpu_get_pc(machine->activecpu),mcu_command,mcu_offset*2,mcu_subcmd); + logerror("%s : MCU executed command: %04X %04X %04X ",cpuexec_describe_context(machine),mcu_command,mcu_offset*2,mcu_subcmd); /* the only MCU commands found in program code are: @@ -233,7 +233,7 @@ static void jchan_mcu_run(running_machine *machine) case 0x03: // DSW { mcu_ram[mcu_offset] = input_port_read(machine, "DSW"); - logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n",cpu_get_pc(machine->activecpu),mcu_command,mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (read DSW)\n",cpuexec_describe_context(machine),mcu_command,mcu_offset*2); } break; diff --git a/src/mame/drivers/karnov.c b/src/mame/drivers/karnov.c index 2f937b5e9c1..764fe020b89 100644 --- a/src/mame/drivers/karnov.c +++ b/src/mame/drivers/karnov.c @@ -84,7 +84,7 @@ static void karnov_i8751_w(running_machine *machine, int data) if (data==0x401) i8751_return=0x4138; /* ^Whistling wind */ if (data==0x408) i8751_return=0x4276; /* ^Heavy Gates */ -// if (!i8751_return && data!=0x300) logerror("CPU %04x - Unknown Write %02x intel\n",cpu_get_pc(machine->activecpu),data); +// if (!i8751_return && data!=0x300) logerror("%s - Unknown Write %02x intel\n",cpuexec_describe_context(machine),data); cpu_set_input_line(machine->cpu[0],6,HOLD_LINE); /* Signal main cpu task is complete */ i8751_needs_ack=1; @@ -114,7 +114,7 @@ static void wndrplnt_i8751_w(running_machine *machine, int data) case 0x18: i8751_return=0x5341; break; } } -// else logerror("CPU %04x - Unknown Write %02x intel\n",cpu_get_pc(machine->activecpu),data); +// else logerror("%s - Unknown Write %02x intel\n",cpuexec_describe_context(machine),data); /* These are 68k function call addresses - different address for each power-up */ if (data==0x400) i8751_return=0x594; @@ -248,7 +248,7 @@ static void chelnov_i8751_w(running_machine *machine, int data) } } -// logerror("CPU %04x - Unknown Write %02x intel\n",cpu_get_pc(machine->activecpu),data); +// logerror("%s - Unknown Write %02x intel\n",cpuexec_describe_context(machine),data); cpu_set_input_line(machine->cpu[0],6,HOLD_LINE); /* Signal main cpu task is complete */ i8751_needs_ack=1; diff --git a/src/mame/drivers/konamim2.c b/src/mame/drivers/konamim2.c index 2e6405ca4eb..27cccb55110 100644 --- a/src/mame/drivers/konamim2.c +++ b/src/mame/drivers/konamim2.c @@ -1075,7 +1075,7 @@ static READ64_HANDLER(cpu_r) if (ACCESSING_BITS_32_63) { - r = (UINT64)((space->machine->activecpu != space->machine->cpu[0]) ? 0x80000000 : 0); + r = (UINT64)((space->cpu != space->machine->cpu[0]) ? 0x80000000 : 0); //r |= 0x40000000; // sets Video-LowRes !? return r << 32; } diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index ec7ad6ef48b..465321d6296 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -232,14 +232,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/mame/drivers/lockon.c b/src/mame/drivers/lockon.c index eee43180c3b..3f237994195 100644 --- a/src/mame/drivers/lockon.c +++ b/src/mame/drivers/lockon.c @@ -72,51 +72,33 @@ static WRITE16_HANDLER( adrst_w ) static READ16_HANDLER( main_gnd_r ) { const address_space *gndspace = cpu_get_address_space(space->machine->cpu[GROUND_CPU], ADDRESS_SPACE_PROGRAM); - UINT16 result; - - cpu_push_context(gndspace->cpu); - result = memory_read_word(gndspace, V30_GND_ADDR | offset * 2); - cpu_pop_context(); - - return result; + return memory_read_word(gndspace, V30_GND_ADDR | offset * 2); } static WRITE16_HANDLER( main_gnd_w ) { const address_space *gndspace = cpu_get_address_space(space->machine->cpu[GROUND_CPU], ADDRESS_SPACE_PROGRAM); - cpu_push_context(gndspace->cpu); if (ACCESSING_BITS_0_7) memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 0), data); if (ACCESSING_BITS_8_15) memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 1), data >> 8); - - cpu_pop_context(); } static READ16_HANDLER( main_obj_r ) { const address_space *objspace = cpu_get_address_space(space->machine->cpu[OBJECT_CPU], ADDRESS_SPACE_PROGRAM); - UINT16 result; - - cpu_push_context(objspace->cpu); - result = memory_read_word(objspace, V30_OBJ_ADDR | offset * 2); - cpu_pop_context(); - - return result; + return memory_read_word(objspace, V30_OBJ_ADDR | offset * 2); } static WRITE16_HANDLER( main_obj_w ) { const address_space *objspace = cpu_get_address_space(space->machine->cpu[OBJECT_CPU], ADDRESS_SPACE_PROGRAM); - cpu_push_context(objspace->cpu); if (ACCESSING_BITS_0_7) memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 0), data); if (ACCESSING_BITS_8_15) memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 1), data >> 8); - - cpu_pop_context(); } static WRITE16_HANDLER( tst_w ) @@ -126,40 +108,28 @@ static WRITE16_HANDLER( tst_w ) const address_space *gndspace = cpu_get_address_space(space->machine->cpu[GROUND_CPU], ADDRESS_SPACE_PROGRAM); const address_space *objspace = cpu_get_address_space(space->machine->cpu[OBJECT_CPU], ADDRESS_SPACE_PROGRAM); - cpu_push_context(gndspace->cpu); if (ACCESSING_BITS_0_7) memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 0), data); if (ACCESSING_BITS_8_15) memory_write_byte(gndspace, V30_GND_ADDR | (offset * 2 + 1), data >> 8); - cpu_pop_context(); - cpu_push_context(objspace->cpu); if (ACCESSING_BITS_0_7) memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 0), data); if (ACCESSING_BITS_8_15) memory_write_byte(objspace, V30_OBJ_ADDR | (offset * 2 + 1), data >> 8); - cpu_pop_context(); } } static READ16_HANDLER( main_z80_r ) { const address_space *sndspace = cpu_get_address_space(space->machine->cpu[SOUND_CPU], ADDRESS_SPACE_PROGRAM); - UINT16 val; - - cpu_push_context(sndspace->cpu); - val = memory_read_byte(sndspace, offset); - cpu_pop_context(); - - return 0xff00 | val; + return 0xff00 | memory_read_byte(sndspace, offset); } static WRITE16_HANDLER( main_z80_w ) { const address_space *sndspace = cpu_get_address_space(space->machine->cpu[SOUND_CPU], ADDRESS_SPACE_PROGRAM); - cpu_push_context(sndspace->cpu); memory_write_byte(sndspace, offset, data); - cpu_pop_context(); } static WRITE16_HANDLER( inten_w ) diff --git a/src/mame/drivers/lordgun.c b/src/mame/drivers/lordgun.c index 5d04bb30e74..4384029f1c1 100644 --- a/src/mame/drivers/lordgun.c +++ b/src/mame/drivers/lordgun.c @@ -116,7 +116,7 @@ static WRITE8_DEVICE_HANDLER( lordgun_eeprom_w ) if (data & ~0xfd) { // popmessage("EE: %02x", data); - logerror("PC %06X - Unknown EEPROM bit written %02X\n",cpu_get_pc(device->machine->activecpu),data); + logerror("%s - Unknown EEPROM bit written %02X\n",cpuexec_describe_context(device->machine),data); } coin_counter_w(0, data & 0x01); diff --git a/src/mame/drivers/mario.c b/src/mame/drivers/mario.c index 9d7494f2b30..5e1903e0d47 100644 --- a/src/mame/drivers/mario.c +++ b/src/mame/drivers/mario.c @@ -129,21 +129,13 @@ static const z80dma_interface mario_dma = static READ8_DEVICE_HANDLER(mario_dma_read_byte) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8 result; - - cpu_push_context(space->cpu); - result = memory_read_byte(space, offset); - cpu_pop_context(); - - return result; + return memory_read_byte(space, offset); } static WRITE8_DEVICE_HANDLER(mario_dma_write_byte) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(space->cpu); memory_write_byte(space, offset, data); - cpu_pop_context(); } /************************************* diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index e383a367021..bebd0fe2640 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -773,15 +773,10 @@ static WRITE8_HANDLER(at_page8_w) static DMA8237_MEM_READ( pc_dma_read_byte ) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8 result; offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); - result = memory_read_byte(space, page_offset + offset); - cpu_pop_context(); - - return result; + return memory_read_byte(space, page_offset + offset); } @@ -791,9 +786,7 @@ static DMA8237_MEM_WRITE( pc_dma_write_byte ) offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); memory_write_byte(space, page_offset + offset, data); - cpu_pop_context(); } @@ -1132,28 +1125,28 @@ struct _speedup_entry static speedup_entry *speedup_table; static int speedup_count; -INLINE UINT32 generic_speedup(running_machine *machine, speedup_entry *entry) +INLINE UINT32 generic_speedup(const address_space *space, speedup_entry *entry) { - if (cpu_get_pc(machine->activecpu) == entry->pc) + if (cpu_get_pc(space->cpu) == entry->pc) { entry->hits++; - cpu_spinuntil_int(machine->activecpu); + cpu_spinuntil_int(space->cpu); } return main_ram[entry->offset/4]; } -static READ32_HANDLER( speedup0_r ) { return generic_speedup(space->machine, &speedup_table[0]); } -static READ32_HANDLER( speedup1_r ) { return generic_speedup(space->machine, &speedup_table[1]); } -static READ32_HANDLER( speedup2_r ) { return generic_speedup(space->machine, &speedup_table[2]); } -static READ32_HANDLER( speedup3_r ) { return generic_speedup(space->machine, &speedup_table[3]); } -static READ32_HANDLER( speedup4_r ) { return generic_speedup(space->machine, &speedup_table[4]); } -static READ32_HANDLER( speedup5_r ) { return generic_speedup(space->machine, &speedup_table[5]); } -static READ32_HANDLER( speedup6_r ) { return generic_speedup(space->machine, &speedup_table[6]); } -static READ32_HANDLER( speedup7_r ) { return generic_speedup(space->machine, &speedup_table[7]); } -static READ32_HANDLER( speedup8_r ) { return generic_speedup(space->machine, &speedup_table[8]); } -static READ32_HANDLER( speedup9_r ) { return generic_speedup(space->machine, &speedup_table[9]); } -static READ32_HANDLER( speedup10_r ) { return generic_speedup(space->machine, &speedup_table[10]); } -static READ32_HANDLER( speedup11_r ) { return generic_speedup(space->machine, &speedup_table[11]); } +static READ32_HANDLER( speedup0_r ) { return generic_speedup(space, &speedup_table[0]); } +static READ32_HANDLER( speedup1_r ) { return generic_speedup(space, &speedup_table[1]); } +static READ32_HANDLER( speedup2_r ) { return generic_speedup(space, &speedup_table[2]); } +static READ32_HANDLER( speedup3_r ) { return generic_speedup(space, &speedup_table[3]); } +static READ32_HANDLER( speedup4_r ) { return generic_speedup(space, &speedup_table[4]); } +static READ32_HANDLER( speedup5_r ) { return generic_speedup(space, &speedup_table[5]); } +static READ32_HANDLER( speedup6_r ) { return generic_speedup(space, &speedup_table[6]); } +static READ32_HANDLER( speedup7_r ) { return generic_speedup(space, &speedup_table[7]); } +static READ32_HANDLER( speedup8_r ) { return generic_speedup(space, &speedup_table[8]); } +static READ32_HANDLER( speedup9_r ) { return generic_speedup(space, &speedup_table[9]); } +static READ32_HANDLER( speedup10_r ) { return generic_speedup(space, &speedup_table[10]); } +static READ32_HANDLER( speedup11_r ) { return generic_speedup(space, &speedup_table[11]); } static const read32_space_func speedup_handlers[] = { diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index 6c44e06adff..37453cf891a 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -624,7 +624,7 @@ static void megadrive_vdp_set_register(running_machine *machine, int regnum, UIN // if (regnum == 0x0a) // mame_printf_debug("Set HINT Reload Register to %d on scanline %d\n",value, genesis_scanline_counter); -// mame_printf_debug("%06x Setting VDP Register #%02x to %02x\n",cpu_get_pc(machine->activecpu), regnum,value); +// mame_printf_debug("%s: Setting VDP Register #%02x to %02x\n",cpuexec_describe_context(machine), regnum,value); } static void update_megadrive_vdp_code_and_address(void) @@ -719,7 +719,7 @@ static void megadrive_do_insta_68k_to_vram_dma(UINT32 source,int length) if (length==0x00) length = 0xffff; /* This is a hack until real DMA timings are implemented */ - cpu_spinuntil_time(Machine->activecpu, ATTOTIME_IN_NSEC(length*1000/3500)); + cpu_spinuntil_time(Machine->cpu[0], ATTOTIME_IN_NSEC(length*1000/3500)); for (count = 0;count<(length>>1);count++) { @@ -804,7 +804,7 @@ static void handle_dma_bits(running_machine *machine) UINT16 length; source = (MEGADRIVE_REG15_DMASOURCE1 | (MEGADRIVE_REG16_DMASOURCE2<<8) | ((MEGADRIVE_REG17_DMASOURCE3&0xff)<<16))<<1; length = (MEGADRIVE_REG13_DMALENGTH1 | (MEGADRIVE_REG14_DMALENGTH2<<8))<<1; - // mame_printf_debug("%06x 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", cpu_get_pc(machine->activecpu), source, length, megadrive_vdp_address,MEGADRIVE_REG01_DMA_ENABLE, megadrive_vdp_code,MEGADRIVE_REG0F_AUTO_INC); + // mame_printf_debug("%s 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", cpuexec_describe_context(machine), source, length, megadrive_vdp_address,MEGADRIVE_REG01_DMA_ENABLE, megadrive_vdp_code,MEGADRIVE_REG0F_AUTO_INC); } @@ -3634,7 +3634,7 @@ INLINE void overwrite_write(UINT16 *dst, UINT16 d) if (d & 0x000f) { *dst &= ~0x000f; *dst |= d & 0x000f; } } -static UINT32 pm_io(running_machine *machine, int reg, int write, UINT32 d) +static UINT32 pm_io(const address_space *space, int reg, int write, UINT32 d) { if (svp.emu_status & SSP_PMC_SET) { @@ -3648,7 +3648,7 @@ static UINT32 pm_io(running_machine *machine, int reg, int write, UINT32 d) svp.emu_status &= ~SSP_PMC_HAVE_ADDR; } - if (reg == 4 || (cpu_get_reg(machine->activecpu, SSP_ST) & 0x60)) + if (reg == 4 || (cpu_get_reg(space->cpu, SSP_ST) & 0x60)) { #define CADDR ((((mode<<16)&0x7f0000)|addr)<<1) UINT16 *dram = (UINT16 *)svp.dram; @@ -3689,7 +3689,7 @@ static UINT32 pm_io(running_machine *machine, int reg, int write, UINT32 d) int addr = svp.pmac_read[reg]&0xffff; if ((mode & 0xfff0) == 0x0800) // ROM, inc 1, verified to be correct { - UINT16 *ROM = (UINT16 *) memory_region(machine, "main"); + UINT16 *ROM = (UINT16 *) memory_region(space->machine, "main"); svp.pmac_read[reg] += 1; d = ROM[addr|((mode&0xf)<<16)]; } @@ -3718,7 +3718,7 @@ static UINT32 pm_io(running_machine *machine, int reg, int write, UINT32 d) static READ16_HANDLER( read_PM0 ) { - UINT32 d = pm_io(space->machine, 0, 0, 0); + UINT32 d = pm_io(space, 0, 0, 0); if (d != (UINT32)-1) return d; d = svp.XST2; svp.XST2 &= ~2; // ? @@ -3727,14 +3727,14 @@ static READ16_HANDLER( read_PM0 ) static WRITE16_HANDLER( write_PM0 ) { - UINT32 r = pm_io(space->machine, 0, 1, data); + UINT32 r = pm_io(space, 0, 1, data); if (r != (UINT32)-1) return; svp.XST2 = data; // ? } static READ16_HANDLER( read_PM1 ) { - UINT32 r = pm_io(space->machine, 1, 0, 0); + UINT32 r = pm_io(space, 1, 0, 0); if (r != (UINT32)-1) return r; logerror("svp: PM1 acces in non PM mode?\n"); return 0; @@ -3742,14 +3742,14 @@ static READ16_HANDLER( read_PM1 ) static WRITE16_HANDLER( write_PM1 ) { - UINT32 r = pm_io(space->machine, 1, 1, data); + UINT32 r = pm_io(space, 1, 1, data); if (r != (UINT32)-1) return; logerror("svp: PM1 acces in non PM mode?\n"); } static READ16_HANDLER( read_PM2 ) { - UINT32 r = pm_io(space->machine, 2, 0, 0); + UINT32 r = pm_io(space, 2, 0, 0); if (r != (UINT32)-1) return r; logerror("svp: PM2 acces in non PM mode?\n"); return 0; @@ -3757,14 +3757,14 @@ static READ16_HANDLER( read_PM2 ) static WRITE16_HANDLER( write_PM2 ) { - UINT32 r = pm_io(space->machine, 2, 1, data); + UINT32 r = pm_io(space, 2, 1, data); if (r != (UINT32)-1) return; logerror("svp: PM2 acces in non PM mode?\n"); } static READ16_HANDLER( read_XST ) { - UINT32 d = pm_io(space->machine, 3, 0, 0); + UINT32 d = pm_io(space, 3, 0, 0); if (d != (UINT32)-1) return d; return svp.XST; @@ -3772,7 +3772,7 @@ static READ16_HANDLER( read_XST ) static WRITE16_HANDLER( write_XST ) { - UINT32 r = pm_io(space->machine, 3, 1, data); + UINT32 r = pm_io(space, 3, 1, data); if (r != (UINT32)-1) return; svp.XST2 |= 1; @@ -3781,12 +3781,12 @@ static WRITE16_HANDLER( write_XST ) static READ16_HANDLER( read_PM4 ) { - return pm_io(space->machine, 4, 0, 0); + return pm_io(space, 4, 0, 0); } static WRITE16_HANDLER( write_PM4 ) { - pm_io(space->machine, 4, 1, data); + pm_io(space, 4, 1, data); } static READ16_HANDLER( read_PMC ) diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c index 5c8142f81ad..21f5a49929b 100644 --- a/src/mame/drivers/metro.c +++ b/src/mame/drivers/metro.c @@ -187,7 +187,7 @@ static void update_irq_state(running_machine *machine) /* For games that supply an *IRQ Vector* on the data bus */ static IRQ_CALLBACK(metro_irq_callback) { -// logerror("CPU #0 PC %06X: irq callback returns %04X\n",cpu_get_pc(machine->activecpu),metro_irq_vectors[int_level]); +// logerror("%s: irq callback returns %04X\n",cpuexec_describe_context(device->machine),metro_irq_vectors[int_level]); return metro_irq_vectors[irqline]&0xff; } @@ -692,7 +692,7 @@ INLINE void blt_write(const address_space *space, const int tmap, const offs_t o case 2: metro_vram_1_w(space,offs,data,mask); break; case 3: metro_vram_2_w(space,offs,data,mask); break; } -// logerror("CPU #0 PC %06X : Blitter %X] %04X <- %04X & %04X\n",cpu_get_pc(machine->activecpu),tmap,offs,data,mask); +// logerror("%s : Blitter %X] %04X <- %04X & %04X\n",cpuexec_describe_context(space->machine),tmap,offs,data,mask); } diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index 4c0f92c5a51..7e0e15d2e6f 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -166,7 +166,7 @@ static WRITE32_DEVICE_HANDLER( zeus2_timekeeper_w ) if (bitlatch[2] && !cmos_protected) timekeeper_w(device, offset, data); else - logerror("%06X:zeus2_timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", cpu_get_pc(device->machine->activecpu), bitlatch[2], cmos_protected); + logerror("%s:zeus2_timekeeper_w with bitlatch[2] = %d, cmos_protected = %d\n", cpuexec_describe_context(device->machine), bitlatch[2], cmos_protected); cmos_protected = TRUE; } diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index e3d6dc16e00..818197cf5a2 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -547,7 +547,7 @@ INLINE offs_t get_bit3_addr(offs_t pixaddr) } -static void write_vram(running_machine *machine, offs_t address, UINT8 data) +static void write_vram(const address_space *space, offs_t address, UINT8 data) { static const UINT8 data_lookup[4] = { 0x00, 0x0f, 0xf0, 0xff }; offs_t vramaddr; @@ -572,12 +572,12 @@ static void write_vram(running_machine *machine, offs_t address, UINT8 data) videoram[vramaddr] = (videoram[vramaddr] & vrammask) | (vramdata & ~vrammask); /* account for the extra clock cycle */ - cpu_adjust_icount(machine->activecpu, -1); + cpu_adjust_icount(space->cpu, -1); } } -static UINT8 read_vram(running_machine *machine, offs_t address) +static UINT8 read_vram(const address_space *space, offs_t address) { offs_t vramaddr; UINT8 vramdata; @@ -606,7 +606,7 @@ static UINT8 read_vram(running_machine *machine, offs_t address) result &= ~0x20; /* account for the extra clock cycle */ - cpu_adjust_icount(machine->activecpu, -1); + cpu_adjust_icount(space->cpu, -1); } return result; } @@ -665,7 +665,7 @@ static WRITE8_HANDLER( missile_w ) /* if we're in MADSEL mode, write to video RAM */ if (get_madsel(space)) { - write_vram(space->machine, offset, data); + write_vram(space, offset, data); return; } @@ -722,7 +722,7 @@ static READ8_HANDLER( missile_r ) /* if we're in MADSEL mode, read from video RAM */ if (get_madsel(space)) - return read_vram(space->machine, offset); + return read_vram(space, offset); /* otherwise, strip A15 and handle manually */ offset &= 0x7fff; diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index c01465d6152..d7e6c153b9a 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -69,14 +69,14 @@ static void mquake_cia_0_porta_w(const device_config *device, UINT8 data) static UINT8 mquake_cia_0_portb_r(const device_config *device) { /* parallel port */ - logerror("%06x:CIA0_portb_r\n", cpu_get_pc(device->machine->activecpu)); + logerror("%s:CIA0_portb_r\n", cpuexec_describe_context(device->machine)); return 0xff; } static void mquake_cia_0_portb_w(const device_config *device, UINT8 data) { /* parallel port */ - logerror("%06x:CIA0_portb_w(%02x)\n", cpu_get_pc(device->machine->activecpu), data); + logerror("%s:CIA0_portb_w(%02x)\n", cpuexec_describe_context(device->machine), data); } diff --git a/src/mame/drivers/namcona1.c b/src/mame/drivers/namcona1.c index 08c003343ec..f5a3cf3cd25 100644 --- a/src/mame/drivers/namcona1.c +++ b/src/mame/drivers/namcona1.c @@ -639,8 +639,8 @@ static void namcona1_blit( running_machine *machine ) (void)src2; (void)src0; /* - logerror( "0x%08x: blt(%08x,%08x,numBytes=%04x);src=%04x %04x %04x; dst=%04x %04x %04x; gfx=%04x\n", - cpu_get_pc(machine->activecpu), + logerror( "%s: blt(%08x,%08x,numBytes=%04x);src=%04x %04x %04x; dst=%04x %04x %04x; gfx=%04x\n", + cpuexec_describe_context(machine), dst_baseaddr,src_baseaddr,num_bytes, src0,src1,src2, dst0,dst1,dst2, diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c index 94c9dfe8788..44b54d8e36f 100644 --- a/src/mame/drivers/namcos11.c +++ b/src/mame/drivers/namcos11.c @@ -281,7 +281,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - logerror( "'%s':%08x: %s", Machine->activecpu->tag, safe_cpu_get_pc(Machine->activecpu), buf ); + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index c78d3b3d08f..3fa9c2d05be 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -940,14 +940,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c index f5db261669e..c0261ca2085 100644 --- a/src/mame/drivers/namcos21.c +++ b/src/mame/drivers/namcos21.c @@ -569,7 +569,7 @@ ReadWordFromSlaveInput( void ) { mpDspState->slaveBytesAdvertised--; } - logerror( "-%04x(0x%04x) %x\n", data, mpDspState->slaveBytesAvailable, cpu_get_pc(Machine->activecpu) ); + logerror( "%s:-%04x(0x%04x)\n", cpuexec_describe_context(Machine), data, mpDspState->slaveBytesAvailable ); } return data; } /* ReadWordFromSlaveInput */ diff --git a/src/mame/drivers/nbmj9195.c b/src/mame/drivers/nbmj9195.c index aa02fd20f02..bf74dcc1afb 100644 --- a/src/mame/drivers/nbmj9195.c +++ b/src/mame/drivers/nbmj9195.c @@ -239,7 +239,7 @@ static READ8_HANDLER( tmpz84c011_pio_r ) break; default: - logerror("PC %04X: TMPZ84C011_PIO Unknown Port Read %02X\n", cpu_get_pc(space->machine->activecpu), offset); + logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", cpuexec_describe_context(space->machine), offset); portdata = 0xff; break; } @@ -324,7 +324,7 @@ static READ8_HANDLER( tmpz84c011_pio_r ) break; default: - logerror("PC %04X: TMPZ84C011_PIO Unknown Port Read %02X\n", cpu_get_pc(space->machine->activecpu), offset); + logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", cpuexec_describe_context(space->machine), offset); portdata = 0xff; break; } @@ -372,7 +372,7 @@ static WRITE8_HANDLER( tmpz84c011_pio_w ) break; default: - logerror("PC %04X: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpu_get_pc(space->machine->activecpu), offset, data); + logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpuexec_describe_context(space->machine), offset, data); break; } } @@ -410,7 +410,7 @@ static WRITE8_HANDLER( tmpz84c011_pio_w ) break; default: - logerror("PC %04X: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpu_get_pc(space->machine->activecpu), offset, data); + logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpuexec_describe_context(space->machine), offset, data); break; } } diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index 9ac010de5a3..69ab4a8733c 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -919,7 +919,7 @@ static void set_output_latch(running_machine *machine, UINT8 data) led2_value = ~output_data; if (falling_bits & 0xc7) - logerror("PC: %x Unmaped LED write. Data: %x\n", cpu_get_pc(machine->activecpu), falling_bits); + logerror("%s Unmaped LED write. Data: %x\n", cpuexec_describe_context(machine), falling_bits); output_latch = data; diff --git a/src/mame/drivers/niyanpai.c b/src/mame/drivers/niyanpai.c index 41af38f1303..2594b74a82f 100644 --- a/src/mame/drivers/niyanpai.c +++ b/src/mame/drivers/niyanpai.c @@ -106,7 +106,7 @@ static READ8_HANDLER( tmpz84c011_pio_r ) break; default: - logerror("PC %04X: TMPZ84C011_PIO Unknown Port Read %02X\n", cpu_get_pc(space->machine->activecpu), offset); + logerror("%s: TMPZ84C011_PIO Unknown Port Read %02X\n", cpuexec_describe_context(space->machine), offset); portdata = 0xff; break; } @@ -134,7 +134,7 @@ static WRITE8_HANDLER( tmpz84c011_pio_w) break; default: - logerror("PC %04X: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpu_get_pc(space->machine->activecpu), offset, data); + logerror("%s: TMPZ84C011_PIO Unknown Port Write %02X, %02X\n", cpuexec_describe_context(space->machine), offset, data); break; } } diff --git a/src/mame/drivers/nwk-tr.c b/src/mame/drivers/nwk-tr.c index 559a22d8bd0..7a2d11f11a5 100644 --- a/src/mame/drivers/nwk-tr.c +++ b/src/mame/drivers/nwk-tr.c @@ -1114,6 +1114,7 @@ static MACHINE_DRIVER_START( nwktr ) MDRV_MACHINE_RESET(nwktr) MDRV_3DFX_VOODOO_1_ADD("voodoo", STD_VOODOO_1_CLOCK, 2, "main") + MDRV_3DFX_VOODOO_CPU("dsp") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 2) MDRV_3DFX_VOODOO_TMU_MEMORY(1, 2) MDRV_3DFX_VOODOO_VBLANK(voodoo_vblank_0) diff --git a/src/mame/drivers/pirates.c b/src/mame/drivers/pirates.c index 66872d107c2..519f34511c7 100644 --- a/src/mame/drivers/pirates.c +++ b/src/mame/drivers/pirates.c @@ -147,23 +147,23 @@ static CUSTOM_INPUT( prot_r ) // static int prot = 0xa3; int bit; -// logerror("%06x: IN1_r\n",cpu_get_pc(machine->activecpu)); +// logerror("%s: IN1_r\n",cpuexec_describe_context(field->port->machine)); #if 0 /* Pirates protection workaround. It more complicated than this... see code at 602e and 62a6 */ /* For Genix, see 6576 for setting values and 67c2,d3b4 and dbc2 for tests. */ - if (cpu_get_pc(machine->activecpu) == 0x6134) + if (cpu_get_pc(field->port->machine->cpu[0]) == 0x6134) { bit = prot & 1; prot = (prot >> 1) | (bit << 7); } - else if (cpu_get_pc(machine->activecpu) == 0x6020) + else if (cpu_get_pc(field->port->machine->cpu[0]) == 0x6020) bit = 0; - else if (cpu_get_pc(machine->activecpu) == 0x6168) + else if (cpu_get_pc(field->port->machine->cpu[0]) == 0x6168) bit = 0; - else if (cpu_get_pc(machine->activecpu) == 0x61cc) + else if (cpu_get_pc(field->port->machine->cpu[0]) == 0x61cc) bit = 1; else #endif diff --git a/src/mame/drivers/psikyo.c b/src/mame/drivers/psikyo.c index b99027f2679..85ede65d374 100644 --- a/src/mame/drivers/psikyo.c +++ b/src/mame/drivers/psikyo.c @@ -111,7 +111,7 @@ static CUSTOM_INPUT( z80_nmi_r ) /* main CPU might be waiting for sound CPU to finish NMI, so set a timer to give sound CPU a chance to run */ timer_call_after_resynch(field->port->machine, NULL, 0, NULL); -// logerror("PC %06X - Read coin port during Z80 NMI\n", cpu_get_pc(machine->activecpu)); +// logerror("%s - Read coin port during Z80 NMI\n", cpuexec_describe_context(machine)); } return ret; diff --git a/src/mame/drivers/seattle.c b/src/mame/drivers/seattle.c index ef8990caaa2..ed952cfb89e 100644 --- a/src/mame/drivers/seattle.c +++ b/src/mame/drivers/seattle.c @@ -1365,9 +1365,7 @@ static void voodoo_stall(const device_config *device, int stall) galileo.dma_stalled_on_voodoo[which] = FALSE; /* resume execution */ - cpu_push_context(space->cpu); galileo_perform_dma(space, which); - cpu_pop_context(); break; } @@ -1729,11 +1727,19 @@ PCI Mem = 08000000-09FFFFFF */ +static READ32_DEVICE_HANDLER( seattle_ide_r ) +{ + /* note that blitz times out if we don't have this cycle stealing */ + if (offset == 0x3f6/4) + cpu_eat_cycles(device->machine->cpu[0], 100); + return ide_controller32_r(device, offset, mem_mask); +} + static ADDRESS_MAP_START( seattle_map, ADDRESS_SPACE_PROGRAM, 32 ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE(&rambase) // wg3dh only has 4MB; sfrush, blitz99 8MB AM_RANGE(0x08000000, 0x08ffffff) AM_DEVREAD(VOODOO_GRAPHICS, "voodoo", voodoo_r) AM_WRITE(seattle_voodoo_w) - AM_RANGE(0x0a000000, 0x0a0003ff) AM_DEVREADWRITE(IDE_CONTROLLER, "ide", ide_controller32_r, ide_controller32_w) + AM_RANGE(0x0a000000, 0x0a0003ff) AM_DEVREADWRITE(IDE_CONTROLLER, "ide", seattle_ide_r, ide_controller32_w) AM_RANGE(0x0a00040c, 0x0a00040f) AM_NOP // IDE-related, but annoying AM_RANGE(0x0a000f00, 0x0a000f07) AM_DEVREADWRITE(IDE_CONTROLLER, "ide", ide_bus_master32_r, ide_bus_master32_w) AM_RANGE(0x0c000000, 0x0c000fff) AM_READWRITE(galileo_r, galileo_w) @@ -2476,6 +2482,7 @@ static MACHINE_DRIVER_START( seattle_common ) MDRV_IDE_BUS_MASTER_SPACE("main", PROGRAM) MDRV_3DFX_VOODOO_1_ADD("voodoo", STD_VOODOO_1_CLOCK, 2, "main") + MDRV_3DFX_VOODOO_CPU("main") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4) MDRV_3DFX_VOODOO_VBLANK(vblank_assert) MDRV_3DFX_VOODOO_STALL(voodoo_stall) diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c index 0174e423b18..988c042d4c4 100644 --- a/src/mame/drivers/taito_l.c +++ b/src/mame/drivers/taito_l.c @@ -120,7 +120,7 @@ static void palette_notifier(running_machine *machine, int addr) if(addr > 0x200) { -logerror("Large palette ? %03x (%04x)\n", addr, cpu_get_pc(machine->activecpu)); +logerror("%s:Large palette ? %03x\n", cpuexec_describe_context(machine), addr); } else { diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c index 3440cf504a2..18c4d253bae 100644 --- a/src/mame/drivers/taitowlf.c +++ b/src/mame/drivers/taitowlf.c @@ -130,7 +130,7 @@ static UINT8 mxtc_config_r(const device_config *busdevice, const device_config * static void mxtc_config_w(const device_config *busdevice, const device_config *device, int function, int reg, UINT8 data) { -// mame_printf_debug("MXTC: write %d, %02X, %02X at %08X\n", function, reg, data, cpu_get_pc(machine->activecpu)); +// mame_printf_debug("%s:MXTC: write %d, %02X, %02X\n", cpuexec_describe_context(machine), function, reg, data); switch(reg) { @@ -214,7 +214,7 @@ static UINT8 piix4_config_r(const device_config *busdevice, const device_config static void piix4_config_w(const device_config *busdevice, const device_config *device, int function, int reg, UINT8 data) { -// mame_printf_debug("PIIX4: write %d, %02X, %02X at %08X\n", function, reg, data, cpu_get_pc(machine->activecpu)); +// mame_printf_debug("%s:PIIX4: write %d, %02X, %02X\n", cpuexec_describe_context(machine), function, reg, data); piix4_config_reg[function][reg] = data; } @@ -367,15 +367,10 @@ static WRITE8_HANDLER(at_page8_w) static DMA8237_MEM_READ( pc_dma_read_byte ) { const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT8 result; offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); - result = memory_read_byte(space, page_offset + offset); - cpu_pop_context(); - - return result; + return memory_read_byte(space, page_offset + offset); } @@ -385,9 +380,7 @@ static DMA8237_MEM_WRITE( pc_dma_write_byte ) offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; - cpu_push_context(space->cpu); memory_write_byte(space, page_offset + offset, data); - cpu_pop_context(); } diff --git a/src/mame/drivers/thunderx.c b/src/mame/drivers/thunderx.c index ac3ba7b624b..3d28ea51b38 100644 --- a/src/mame/drivers/thunderx.c +++ b/src/mame/drivers/thunderx.c @@ -1024,7 +1024,7 @@ static KONAMI_SETLINES_CALLBACK( thunderx_banking ) UINT8 *RAM = memory_region(device->machine, "main"); int offs; -// logerror("thunderx %04x: bank select %02x\n", cpu_get_pc(machine->activecpu), lines ); +// logerror("thunderx %04x: bank select %02x\n", cpu_get_pc(device->cpu), lines ); offs = 0x10000 + (((lines & 0x0f) ^ 0x08) * 0x2000); if (offs >= 0x28000) offs -= 0x20000; diff --git a/src/mame/drivers/tigeroad.c b/src/mame/drivers/tigeroad.c index 54146e90269..9bf7f61db69 100644 --- a/src/mame/drivers/tigeroad.c +++ b/src/mame/drivers/tigeroad.c @@ -90,7 +90,7 @@ static void f1dream_protection_w(const address_space *space) { int indx; int value = 255; - int prevpc = cpu_get_previouspc(space->machine->activecpu); + int prevpc = cpu_get_previouspc(space->cpu); if (prevpc == 0x244c) { diff --git a/src/mame/drivers/tmaster.c b/src/mame/drivers/tmaster.c index 1b14ffd81d3..71cd95805fd 100644 --- a/src/mame/drivers/tmaster.c +++ b/src/mame/drivers/tmaster.c @@ -345,7 +345,7 @@ static void tmaster_draw(running_machine *machine) addr <<= 1; #if 0 - logerror("%06x: blit w %03x, h %02x, x %03x, y %02x, addr %06x, mode %02x\n", cpu_get_pc(machine->activecpu), + logerror("%s: blit w %03x, h %02x, x %03x, y %02x, addr %06x, mode %02x\n", cpuexec_describe_context(machine), sw,sh,sx,sy, addr, mode ); #endif @@ -369,7 +369,7 @@ static void tmaster_draw(running_machine *machine) case 0x00: // blit with transparency if (addr > size - sw*sh) { - logerror("%06x: blit error, addr %06x out of bounds\n", cpu_get_pc(machine->activecpu),addr); + logerror("%s: blit error, addr %06x out of bounds\n", cpuexec_describe_context(machine),addr); addr = size - sw*sh; } diff --git a/src/mame/drivers/tx1.c b/src/mame/drivers/tx1.c index 88fda77245c..ded4cc5bc36 100644 --- a/src/mame/drivers/tx1.c +++ b/src/mame/drivers/tx1.c @@ -98,21 +98,13 @@ static INTERRUPT_GEN( z80_irq ) static READ16_HANDLER( z80_shared_r ) { const address_space *cpu2space = cpu_get_address_space(space->machine->cpu[2], ADDRESS_SPACE_PROGRAM); - UINT16 result = 0xffff; - - cpu_push_context(cpu2space->cpu); - result = memory_read_byte(cpu2space, offset); - cpu_pop_context(); - - return result; + return memory_read_byte(cpu2space, offset); } static WRITE16_HANDLER( z80_shared_w ) { const address_space *cpu2space = cpu_get_address_space(space->machine->cpu[2], ADDRESS_SPACE_PROGRAM); - cpu_push_context(cpu2space->cpu); memory_write_byte(cpu2space, offset, data & 0xff); - cpu_pop_context(); } diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c index 8e907087b61..6ba21861aab 100644 --- a/src/mame/drivers/vamphalf.c +++ b/src/mame/drivers/vamphalf.c @@ -1136,9 +1136,9 @@ ROM_START( dquizgo2 ) ROM_LOAD( "vrom1", 0x00000, 0x40000, CRC(24d5b55f) SHA1(cb4d3a22440831e37df0a7fe5433bea708d60f31) ) ROM_END -static int irq_active(running_machine *machine) +static int irq_active(const address_space *space) { - UINT32 FCR = cpu_get_reg(machine->activecpu, 27); + UINT32 FCR = cpu_get_reg(space->cpu, 27); if( !(FCR&(1<<29)) ) // int 2 (irq 4) return 1; else @@ -1149,7 +1149,7 @@ static READ16_HANDLER( vamphalf_speedup_r ) { if(cpu_get_pc(space->cpu) == 0x82de) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1162,7 +1162,7 @@ static READ16_HANDLER( misncrft_speedup_r ) { if(cpu_get_pc(space->cpu) == 0xecc8) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1175,7 +1175,7 @@ static READ16_HANDLER( coolmini_speedup_r ) { if(cpu_get_pc(space->cpu) == 0x75f7a) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1188,7 +1188,7 @@ static READ16_HANDLER( suplup_speedup_r ) { if(cpu_get_pc(space->cpu) == 0xaf18a ) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1201,7 +1201,7 @@ static READ16_HANDLER( luplup_speedup_r ) { if(cpu_get_pc(space->cpu) == 0xaefac ) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1214,7 +1214,7 @@ static READ16_HANDLER( luplup29_speedup_r ) { if(cpu_get_pc(space->cpu) == 0xae6c0 ) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1227,7 +1227,7 @@ static READ16_HANDLER( puzlbang_speedup_r ) { if(cpu_get_pc(space->cpu) == 0xae6d2 ) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1240,7 +1240,7 @@ static READ32_HANDLER( wyvernwg_speedup_r ) { if(cpu_get_pc(space->cpu) == 0x10758 ) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1253,7 +1253,7 @@ static READ32_HANDLER( finalgdr_speedup_r ) { if(cpu_get_pc(space->cpu) == 0x1c212 ) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); @@ -1266,7 +1266,7 @@ static READ16_HANDLER( dquizgo2_speedup_r ) { if(cpu_get_pc(space->cpu) == 0xaa622) { - if(irq_active(space->machine)) + if(irq_active(space)) cpu_spinuntil_int(space->cpu); else cpu_eat_cycles(space->cpu, 50); diff --git a/src/mame/drivers/vegaeo.c b/src/mame/drivers/vegaeo.c index b43fe4ab7c4..aafa11c9a4c 100644 --- a/src/mame/drivers/vegaeo.c +++ b/src/mame/drivers/vegaeo.c @@ -76,7 +76,7 @@ static WRITE32_HANDLER( vega_misc_w ) static READ32_HANDLER( vegaeo_custom_read ) { - eolith_speedup_read(space->machine); + eolith_speedup_read(space); return input_port_read(space->machine, "SYSTEM"); } diff --git a/src/mame/drivers/vegas.c b/src/mame/drivers/vegas.c index da994557fc7..7e04d8d282d 100644 --- a/src/mame/drivers/vegas.c +++ b/src/mame/drivers/vegas.c @@ -1293,10 +1293,10 @@ static void vblank_assert(const device_config *device, int state) vblank_state = state; /* if we have stalled DMA, restart */ -// if (dma_pending_on_vblank[0]) { cpu_push_context(machine->cpu[0]); perform_dma(0); cpu_pop_context(); } -// if (dma_pending_on_vblank[1]) { cpu_push_context(machine->cpu[0]); perform_dma(1); cpu_pop_context(); } -// if (dma_pending_on_vblank[2]) { cpu_push_context(machine->cpu[0]); perform_dma(2); cpu_pop_context(); } -// if (dma_pending_on_vblank[3]) { cpu_push_context(machine->cpu[0]); perform_dma(3); cpu_pop_context(); } +// if (dma_pending_on_vblank[0]) { perform_dma(0); } +// if (dma_pending_on_vblank[1]) { perform_dma(1); } +// if (dma_pending_on_vblank[2]) { perform_dma(2); } +// if (dma_pending_on_vblank[3]) { perform_dma(3); } } @@ -2235,6 +2235,7 @@ static MACHINE_DRIVER_START( vegascore ) MDRV_SMC91C94_ADD("ethernet", ethernet_interrupt) MDRV_3DFX_VOODOO_2_ADD("voodoo", STD_VOODOO_2_CLOCK, 2, "main") + MDRV_3DFX_VOODOO_CPU("main") MDRV_3DFX_VOODOO_TMU_MEMORY(0, 4) MDRV_3DFX_VOODOO_TMU_MEMORY(1, 4) MDRV_3DFX_VOODOO_VBLANK(vblank_assert) @@ -2282,6 +2283,7 @@ static MACHINE_DRIVER_START( vegasban ) MDRV_3DFX_VOODOO_REMOVE("voodoo") MDRV_3DFX_VOODOO_BANSHEE_ADD("voodoo", STD_VOODOO_BANSHEE_CLOCK, 16, "main") + MDRV_3DFX_VOODOO_CPU("main") MDRV_3DFX_VOODOO_VBLANK(vblank_assert) MACHINE_DRIVER_END @@ -2292,6 +2294,7 @@ static MACHINE_DRIVER_START( vegasv3 ) MDRV_3DFX_VOODOO_REMOVE("voodoo") MDRV_3DFX_VOODOO_3_ADD("voodoo", STD_VOODOO_3_CLOCK, 16, "main") + MDRV_3DFX_VOODOO_CPU("main") MDRV_3DFX_VOODOO_VBLANK(vblank_assert) MACHINE_DRIVER_END @@ -2305,6 +2308,7 @@ static MACHINE_DRIVER_START( denver ) MDRV_3DFX_VOODOO_REMOVE("voodoo") MDRV_3DFX_VOODOO_3_ADD("voodoo", STD_VOODOO_3_CLOCK, 16, "main") + MDRV_3DFX_VOODOO_CPU("main") MDRV_3DFX_VOODOO_VBLANK(vblank_assert) MACHINE_DRIVER_END diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index bac43532730..93c6ddd1358 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -180,7 +180,7 @@ static READ64_DEVICE_HANDLER(cf_card_data_r) default: { - fatalerror("cf_card_data_r: IDE reg %02X at %08X\n", offset & 0xf, cpu_get_pc(device->machine->activecpu)); + fatalerror("%s:cf_card_data_r: IDE reg %02X\n", cpuexec_describe_context(device->machine), offset & 0xf); } } } @@ -201,7 +201,7 @@ static WRITE64_DEVICE_HANDLER(cf_card_data_w) default: { - fatalerror("cf_card_data_w: IDE reg %02X, %04X at %08X\n", offset & 0xf, (UINT16)(data >> 16), cpu_get_pc(device->machine->activecpu)); + fatalerror("%s:cf_card_data_w: IDE reg %02X, %04X\n", cpuexec_describe_context(device->machine), offset & 0xf, (UINT16)(data >> 16)); } } } @@ -247,7 +247,7 @@ static READ64_DEVICE_HANDLER(cf_card_r) default: { - printf("compact_flash_r: IDE reg %02X at %08X\n", offset & 0xf, cpu_get_pc(device->machine->activecpu)); + printf("%s:compact_flash_r: IDE reg %02X\n", cpuexec_describe_context(device->machine), offset & 0xf); } } } @@ -263,7 +263,7 @@ static READ64_DEVICE_HANDLER(cf_card_r) } else { - fatalerror("compact_flash_r: reg %02X at %08X\n", reg, cpu_get_pc(device->machine->activecpu)); + fatalerror("%s:compact_flash_r: reg %02X\n", cpuexec_describe_context(device->machine), reg); } } } @@ -272,7 +272,7 @@ static READ64_DEVICE_HANDLER(cf_card_r) static WRITE64_DEVICE_HANDLER(cf_card_w) { - //printf("compact_flash_w: %08X%08X, %08X, %08X%08X at %08X\n", (UINT32)(data>>32), (UINT32)(data), offset, (UINT32)(mem_mask >> 32), (UINT32)(mem_mask), cpu_get_pc(machine->activecpu)); + //printf("%s:compact_flash_w: %08X%08X, %08X, %08X%08X\n", cpuexec_describe_context(device->machine), (UINT32)(data>>32), (UINT32)(data), offset, (UINT32)(mem_mask >> 32), (UINT32)(mem_mask)); if (ACCESSING_BITS_16_31) { @@ -310,7 +310,7 @@ static WRITE64_DEVICE_HANDLER(cf_card_w) default: { - fatalerror("compact_flash_w: IDE reg %02X, data %04X at %08X\n", offset & 0xf, (UINT16)((data >> 16) & 0xffff), cpu_get_pc(device->machine->activecpu)); + fatalerror("%s:compact_flash_w: IDE reg %02X, data %04X\n", cpuexec_describe_context(device->machine), offset & 0xf, (UINT16)((data >> 16) & 0xffff)); } } } @@ -336,7 +336,7 @@ static WRITE64_DEVICE_HANDLER(cf_card_w) } default: { - fatalerror("compact_flash_w: reg %02X, data %04X at %08X\n", offset, (UINT16)((data >> 16) & 0xffff), cpu_get_pc(device->machine->activecpu)); + fatalerror("%s:compact_flash_w: reg %02X, data %04X\n", cpuexec_describe_context(device->machine), offset, (UINT16)((data >> 16) & 0xffff)); } } } @@ -612,6 +612,7 @@ static MACHINE_DRIVER_START(viper) MDRV_IDE_CONTROLLER_ADD("ide", ide_interrupt) MDRV_3DFX_VOODOO_3_ADD("voodoo", STD_VOODOO_3_CLOCK, 16, "main") + MDRV_3DFX_VOODOO_CPU("main") /* video hardware */ MDRV_SCREEN_ADD("main", RASTER) diff --git a/src/mame/drivers/xtheball.c b/src/mame/drivers/xtheball.c index f84aabc918e..7ff869d5ef6 100644 --- a/src/mame/drivers/xtheball.c +++ b/src/mame/drivers/xtheball.c @@ -102,7 +102,7 @@ static void xtheball_to_shiftreg(UINT32 address, UINT16 *shiftreg) else if (address >= 0x02000000 && address <= 0x020fffff) memcpy(shiftreg, &vram_fg[TOWORD(address & 0xff000)], TOBYTE(0x1000)); else - logerror("%08X:xtheball_to_shiftreg(%08X)\n", cpu_get_pc(Machine->activecpu), address); + logerror("%s:xtheball_to_shiftreg(%08X)\n", cpuexec_describe_context(Machine), address); } @@ -113,7 +113,7 @@ static void xtheball_from_shiftreg(UINT32 address, UINT16 *shiftreg) else if (address >= 0x02000000 && address <= 0x020fffff) memcpy(&vram_fg[TOWORD(address & 0xff000)], shiftreg, TOBYTE(0x1000)); else - logerror("%08X:xtheball_from_shiftreg(%08X)\n", cpu_get_pc(Machine->activecpu), address); + logerror("%s:xtheball_from_shiftreg(%08X)\n", cpuexec_describe_context(Machine), address); } diff --git a/src/mame/drivers/zaccaria.c b/src/mame/drivers/zaccaria.c index a96af536d4e..f2395ba93b9 100644 --- a/src/mame/drivers/zaccaria.c +++ b/src/mame/drivers/zaccaria.c @@ -71,7 +71,7 @@ static WRITE8_DEVICE_HANDLER( zaccaria_dsw_sel_w ) break; default: - logerror("PC %04x: portsel = %02x\n", cpu_get_pc(device->machine->activecpu), data); + logerror("%s: portsel = %02x\n", cpuexec_describe_context(device->machine), data); break; } } diff --git a/src/mame/drivers/zn.c b/src/mame/drivers/zn.c index 602f2e67193..9c0d06ad4c4 100644 --- a/src/mame/drivers/zn.c +++ b/src/mame/drivers/zn.c @@ -35,14 +35,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/mame/includes/cidelsa.h b/src/mame/includes/cidelsa.h index 20178660971..405740234ae 100644 --- a/src/mame/includes/cidelsa.h +++ b/src/mame/includes/cidelsa.h @@ -4,6 +4,7 @@ #include "cpu/cdp1802/cdp1802.h" #include "video/cdp1869.h" +#define MAIN_CPU_TAG "main" #define DESTRYER_CHR1 3579000.0 // unverified #define DESTRYER_CHR2 XTAL_5_7143MHz #define ALTAIR_CHR1 3579000.0 // unverified diff --git a/src/mame/includes/eolithsp.h b/src/mame/includes/eolithsp.h index 74aa3025c8e..4dca5544b7b 100644 --- a/src/mame/includes/eolithsp.h +++ b/src/mame/includes/eolithsp.h @@ -1,6 +1,6 @@ /*----------- defined in drivers/eolithsp.c -----------*/ -void eolith_speedup_read(running_machine *machine); +void eolith_speedup_read(const address_space *space); void init_eolith_speedup(running_machine *machine); INTERRUPT_GEN( eolith_speedup ); CUSTOM_INPUT( eolith_speedup_getvblank ); diff --git a/src/mame/includes/gaelcrpt.h b/src/mame/includes/gaelcrpt.h index f4b41628fa5..b4422069270 100644 --- a/src/mame/includes/gaelcrpt.h +++ b/src/mame/includes/gaelcrpt.h @@ -1,3 +1,3 @@ /*----------- defined in machine/gaelcrpt.c -----------*/ -UINT16 gaelco_decrypt(running_machine *machine, int offset, int data, int param1, int param2); +UINT16 gaelco_decrypt(const address_space *space, int offset, int data, int param1, int param2); diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index ca4443a005b..3738f81c280 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -952,14 +952,14 @@ static TIMER_CALLBACK( amiga_blitter_proc ) * *************************************/ -static void blitter_setup(void) +static void blitter_setup(const address_space *space) { int ticks, width, height, blittime; /* is there another blitting in progress? */ if (CUSTOM_REG(REG_DMACON) & 0x4000) { - logerror("PC: %08x - This program is playing tricks with the blitter\n", safe_cpu_get_pc(Machine->activecpu) ); + logerror("%s - This program is playing tricks with the blitter\n", cpuexec_describe_context(space->machine) ); return; } @@ -992,7 +992,7 @@ static void blitter_setup(void) if ( CUSTOM_REG(REG_DMACON) & 0x0400 ) { /* simulate the 68k not running while the blit is going */ - cpu_adjust_icount( Machine->activecpu, -(blittime/2) ); + cpu_adjust_icount( space->cpu, -(blittime/2) ); blittime = BLITTER_NASTY_DELAY; } @@ -1005,7 +1005,7 @@ static void blitter_setup(void) CUSTOM_REG(REG_DMACON) |= 0x4000; /* set a timer */ - timer_adjust_oneshot( amiga_blitter_timer, cpu_clocks_to_attotime( Machine->activecpu, blittime ), 0); + timer_adjust_oneshot( amiga_blitter_timer, cpu_clocks_to_attotime( space->cpu, blittime ), 0); } @@ -1289,7 +1289,7 @@ WRITE16_HANDLER( amiga_custom_w ) CUSTOM_REG(REG_BLTSIZH) = data & 0x3f; if ( CUSTOM_REG(REG_BLTSIZV) == 0 ) CUSTOM_REG(REG_BLTSIZV) = 0x400; if ( CUSTOM_REG(REG_BLTSIZH) == 0 ) CUSTOM_REG(REG_BLTSIZH) = 0x40; - blitter_setup(); + blitter_setup(space); break; case REG_BLTSIZV: /* ECS-AGA only */ @@ -1305,7 +1305,7 @@ WRITE16_HANDLER( amiga_custom_w ) { CUSTOM_REG(REG_BLTSIZH) = data & 0x7ff; if ( CUSTOM_REG(REG_BLTSIZH) == 0 ) CUSTOM_REG(REG_BLTSIZH) = 0x800; - blitter_setup(); + blitter_setup(space); } break; @@ -1374,7 +1374,7 @@ WRITE16_HANDLER( amiga_custom_w ) /* if 'blitter-nasty' has been turned on and we have a blit pending, reschedule it */ if ( ( data & 0x400 ) && ( CUSTOM_REG(REG_DMACON) & 0x4000 ) ) - timer_adjust_oneshot( amiga_blitter_timer, cpu_clocks_to_attotime( space->machine->activecpu, BLITTER_NASTY_DELAY ), 0); + timer_adjust_oneshot( amiga_blitter_timer, cpu_clocks_to_attotime( space->cpu, BLITTER_NASTY_DELAY ), 0); break; @@ -1385,7 +1385,7 @@ WRITE16_HANDLER( amiga_custom_w ) CUSTOM_REG(offset) = data; if ( temp & 0x8000 ) /* if we're enabling irq's, delay a bit */ - timer_adjust_oneshot( amiga_irq_timer, cpu_clocks_to_attotime( space->machine->activecpu, AMIGA_IRQ_DELAY_CYCLES ), 0); + timer_adjust_oneshot( amiga_irq_timer, cpu_clocks_to_attotime( space->cpu, AMIGA_IRQ_DELAY_CYCLES ), 0); else /* if we're disabling irq's, process right away */ update_irqs(space->machine); break; diff --git a/src/mame/machine/cubocd32.c b/src/mame/machine/cubocd32.c index 30de51da7ef..1d547cf4dda 100644 --- a/src/mame/machine/cubocd32.c +++ b/src/mame/machine/cubocd32.c @@ -642,7 +642,7 @@ static void akiko_update_cdrom(const address_space *space) if ( cmdbuf[7] == 0x80 ) { - if (LOG_AKIKO_CD) logerror( "AKIKO CD: PC:%06x Data read - start lba: %08x - end lba: %08x\n", safe_cpu_get_pc(space->machine->activecpu), startpos, endpos ); + if (LOG_AKIKO_CD) logerror( "%s:AKIKO CD: Data read - start lba: %08x - end lba: %08x\n", cpuexec_describe_context(space->machine), startpos, endpos ); akiko.cdrom_speed = (cmdbuf[8] & 0x40) ? 2 : 1; akiko.cdrom_lba_start = startpos; akiko.cdrom_lba_end = endpos; diff --git a/src/mame/machine/dc.c b/src/mame/machine/dc.c index 81eeff8da66..966515192cc 100644 --- a/src/mame/machine/dc.c +++ b/src/mame/machine/dc.c @@ -146,7 +146,7 @@ INLINE int decode_reg32_64(running_machine *machine, UINT32 offset, UINT64 mem_m // non 32-bit accesses have not yet been seen here, we need to know when they are if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) { - mame_printf_verbose("Wrong mask! (PC=%x)\n", cpu_get_pc(machine->activecpu)); + mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine)); // debugger_break(machine); } @@ -170,7 +170,7 @@ INLINE int decode_reg3216_64(running_machine *machine, UINT32 offset, UINT64 mem if ((mem_mask != U64(0x0000ffff00000000)) && (mem_mask != U64(0x000000000000ffff)) && (mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) { - mame_printf_verbose("Wrong mask! (PC=%x)\n", cpu_get_pc(machine->activecpu)); + mame_printf_verbose("%s:Wrong mask!\n", cpuexec_describe_context(machine)); // debugger_break(machine); } diff --git a/src/mame/machine/dec0.c b/src/mame/machine/dec0.c index 127f5a6173f..5d75ff8db5a 100644 --- a/src/mame/machine/dec0.c +++ b/src/mame/machine/dec0.c @@ -331,7 +331,7 @@ static void hbarrel_i8751_write(int data) break; case 0x06: /* Controls appearance & placement of special weapons */ i8751_return=weapons_table[level][data&0x1f]; - //logerror("CPU #0 PC %06x: warning - write %02x to i8751, returning %04x\n",cpu_get_pc(machine->activecpu),data,i8751_return); + //logerror("%s: warning - write %02x to i8751, returning %04x\n",cpuexec_describe_context(machine),data,i8751_return); break; case 0xb: /* Initialise the variables? */ i8751_return=0; @@ -358,7 +358,7 @@ static void hbarrel_i8751_write(int data) /* We have to use a state as the microcontroller remembers previous commands */ } -//logerror("CPU #0 PC %06x: warning - write %02x to i8751\n",cpu_get_pc(machine->activecpu),data); +//logerror("%s: warning - write %02x to i8751\n",cpuexec_describe_context(machine),data); } static void baddudes_i8751_write(running_machine *machine, int data) @@ -384,7 +384,7 @@ static void baddudes_i8751_write(running_machine *machine, int data) case 0x75b: i8751_return=0x70f; break; } - if (!i8751_return) logerror("%04x: warning - write unknown command %02x to 8571\n",cpu_get_pc(machine->activecpu),data); + if (!i8751_return) logerror("%s: warning - write unknown command %02x to 8571\n",cpuexec_describe_context(machine),data); } static void birdtry_i8751_write(running_machine *machine, int data) @@ -453,7 +453,7 @@ static void birdtry_i8751_write(running_machine *machine, int data) /*These are activated after a shot (???)*/ case 0x6ca: i8751_return = 0xff; break; case 0x7ff: i8751_return = 0x200; break; - default: logerror("%04x: warning - write unknown command %02x to 8571\n",cpu_get_pc(machine->activecpu),data); + default: logerror("%s: warning - write unknown command %02x to 8571\n",cpuexec_describe_context(machine),data); } } @@ -494,7 +494,7 @@ See the code about 0xb60 (USA version) */ -logerror("CPU #0 PC %06x: warning - write %02x to i8751\n",cpu_get_pc(machine->activecpu),data); +logerror("%s: warning - write %02x to i8751\n",cpuexec_describe_context(machine),data); } diff --git a/src/mame/machine/fddebug.c b/src/mame/machine/fddebug.c index f934316ed92..6ba4a9b10df 100644 --- a/src/mame/machine/fddebug.c +++ b/src/mame/machine/fddebug.c @@ -279,7 +279,7 @@ static void execute_fdcset(running_machine *machine, int ref, int params, const static void execute_fdclist(running_machine *machine, int ref, int params, const char **param); static void execute_fdcsearch(running_machine *machine, int ref, int params, const char **param); -static fd1094_possibility *try_all_possibilities(running_machine *machine, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata); +static fd1094_possibility *try_all_possibilities(const address_space *space, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata); static void tag_possibility(running_machine *machine, fd1094_possibility *possdata, UINT8 status); static void perform_constrained_search(running_machine *machine); @@ -289,8 +289,8 @@ static int does_key_work_for_constraints(const UINT16 *base, UINT8 *key); static UINT32 reconstruct_base_seed(int keybaseaddr, UINT32 startseed); static void build_optable(void); -static int validate_ea(running_machine *machine, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags); -static int validate_opcode(running_machine *machine, UINT32 pc, const UINT8 *opdata, int maxwords); +static int validate_ea(const address_space *space, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags); +static int validate_opcode(const address_space *space, UINT32 pc, const UINT8 *opdata, int maxwords); @@ -431,14 +431,14 @@ INLINE void print_possibilities(running_machine *machine) 0=no, 1=yes, 2=unlikely -----------------------------------------------*/ -INLINE int pc_is_valid(running_machine *machine, UINT32 pc, UINT32 flags) +INLINE int pc_is_valid(const address_space *space, UINT32 pc, UINT32 flags) { /* if we're odd or out of range, fail */ if ((pc & 1) == 1) return 0; if (pc & 0xff000000) return 0; - if (memory_decrypted_read_ptr(cpu_get_address_space(machine->activecpu, ADDRESS_SPACE_PROGRAM), pc) == NULL) + if (memory_decrypted_read_ptr(space, pc) == NULL) return 0; return 1; } @@ -449,11 +449,11 @@ INLINE int pc_is_valid(running_machine *machine, UINT32 pc, UINT32 flags) valid? 0=no, 1=yes, 2=unlikely -----------------------------------------------*/ -INLINE int addr_is_valid(running_machine *machine, UINT32 addr, UINT32 flags) +INLINE int addr_is_valid(const address_space *space, UINT32 addr, UINT32 flags) { /* if this a JMP, the address is a PC */ if (flags & OF_JMP) - return pc_is_valid(machine, addr, flags); + return pc_is_valid(space, addr, flags); /* if we're odd or out of range, fail */ if ((flags & OF_SIZEMASK) != OF_BYTE && (addr & 1) == 1) @@ -462,7 +462,7 @@ INLINE int addr_is_valid(running_machine *machine, UINT32 addr, UINT32 flags) return 0; /* if we're invalid, fail */ - if (strcmp(memory_get_handler_string(cpu_get_address_space(machine->activecpu, ADDRESS_SPACE_PROGRAM), 0, addr), "segaic16_memory_mapper_lsb_r") == 0) + if (strcmp(memory_get_handler_string(space, 0, addr), "segaic16_memory_mapper_lsb_r") == 0) return 2; return 1; @@ -723,7 +723,7 @@ static int instruction_hook(const device_config *device, offs_t curpc) } /* try all possible decodings at the current pc */ - posscount = try_all_possibilities(device->machine, curpc, 0, 0, instrbuffer, keybuffer, posslist) - posslist; + posscount = try_all_possibilities(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), curpc, 0, 0, instrbuffer, keybuffer, posslist) - posslist; if (keydirty) fd1094_regenerate_key(); @@ -890,13 +890,14 @@ static void execute_fdeliminate(running_machine *machine, int ref, int params, c static void execute_fdunlock(running_machine *machine, int ref, int params, const char **param) { + const device_config *cpu = debug_cpu_get_visible_cpu(machine); int reps = keystatus_words / KEY_SIZE; int keyaddr, repnum; UINT64 offset; /* support 0 or 1 parameters */ if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset)) - offset = cpu_get_pc(machine->activecpu); + offset = cpu_get_pc(cpu); keyaddr = addr_to_keyaddr(offset / 2); /* toggle the ignore PC status */ @@ -927,6 +928,7 @@ static void execute_fdunlock(running_machine *machine, int ref, int params, cons static void execute_fdignore(running_machine *machine, int ref, int params, const char **param) { + const device_config *cpu = debug_cpu_get_visible_cpu(machine); UINT64 offset; /* support 0 or 1 parameters */ @@ -937,7 +939,7 @@ static void execute_fdignore(running_machine *machine, int ref, int params, cons return; } if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset)) - offset = cpu_get_pc(machine->activecpu); + offset = cpu_get_pc(cpu); offset /= 2; /* toggle the ignore PC status */ @@ -1031,17 +1033,18 @@ static void execute_fdstate(running_machine *machine, int ref, int params, const static void execute_fdpc(running_machine *machine, int ref, int params, const char **param) { + const device_config *cpu = debug_cpu_get_visible_cpu(machine); UINT64 newpc; /* support 0 or 1 parameters */ if (!debug_command_parameter_number(machine, param[0], &newpc)) - newpc = cpu_get_pc(machine->activecpu); + newpc = cpu_get_pc(cpu); /* set the new PC */ - cpu_set_reg(machine->activecpu, REG_PC, newpc); + cpu_set_reg(cpu, REG_PC, newpc); /* recompute around that */ - instruction_hook(machine->activecpu, newpc); + instruction_hook(cpu, newpc); } @@ -1052,7 +1055,8 @@ static void execute_fdpc(running_machine *machine, int ref, int params, const ch static void execute_fdsearch(running_machine *machine, int ref, int params, const char **param) { - int pc = cpu_get_pc(machine->activecpu); + const address_space *space = cpu_get_address_space(debug_cpu_get_visible_cpu(machine), ADDRESS_SPACE_PROGRAM); + int pc = cpu_get_pc(space->cpu); int length, first = TRUE; UINT8 instrdata[2]; UINT16 decoded; @@ -1090,8 +1094,8 @@ static void execute_fdsearch(running_machine *machine, int ref, int params, cons } /* set this as our current PC and run the instruction hook */ - cpu_set_reg(machine->activecpu, REG_PC, pc); - if (instruction_hook(machine->activecpu, pc)) + cpu_set_reg(space->cpu, REG_PC, pc); + if (instruction_hook(space->cpu, pc)) break; } keystatus[pc/2] |= SEARCH_MASK; @@ -1103,7 +1107,7 @@ static void execute_fdsearch(running_machine *machine, int ref, int params, cons instrdata[1] = decoded; /* get the opcode */ - length = validate_opcode(machine, pc, instrdata, 1); + length = validate_opcode(space, pc, instrdata, 1); if (length < 0) length = -length; if (length == 0) @@ -1177,6 +1181,7 @@ static void execute_fdsearch(running_machine *machine, int ref, int params, cons static void execute_fddasm(running_machine *machine, int ref, int params, const char **param) { + const address_space *space = cpu_get_address_space(debug_cpu_get_visible_cpu(machine), ADDRESS_SPACE_PROGRAM); int origstate = fd1094_set_state(keyregion, -1); const char *filename; int skipped = FALSE; @@ -1263,7 +1268,7 @@ static void execute_fddasm(running_machine *machine, int ref, int params, const if (unknowns > 0) { UINT8 keybuffer[5]; - int posscount = try_all_possibilities(machine, pcaddr * 2, 0, 0, instrbuffer, keybuffer, posslist) - posslist; + int posscount = try_all_possibilities(space, pcaddr * 2, 0, 0, instrbuffer, keybuffer, posslist) - posslist; for (pnum = 0; pnum < posscount; pnum++) if (strcmp(disasm, posslist[pnum].dasm) != 0) { @@ -1383,7 +1388,7 @@ static void execute_fdcsearch(running_machine *machine, int ref, int params, con length -----------------------------------------------*/ -static fd1094_possibility *try_all_possibilities(running_machine *machine, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata) +static fd1094_possibility *try_all_possibilities(const address_space *space, int basepc, int offset, int length, UINT8 *instrbuffer, UINT8 *keybuffer, fd1094_possibility *possdata) { UINT8 keymask, keystat; UINT16 possvalue[4]; @@ -1458,7 +1463,7 @@ static fd1094_possibility *try_all_possibilities(running_machine *machine, int b /* first make sure we are a valid instruction */ if ((possvalue[i] & 0xf000) == 0xa000 || (possvalue[i] & 0xf000) == 0xf000) continue; - length = validate_opcode(machine, basepc, instrbuffer, 1); + length = validate_opcode(space, basepc, instrbuffer, 1); if (length == 0) continue; if (length < 0) @@ -1467,7 +1472,7 @@ static fd1094_possibility *try_all_possibilities(running_machine *machine, int b /* if we're not at our target length, recursively call ourselves */ if (offset < length - 1) - possdata = try_all_possibilities(machine, basepc, offset + 1, length, instrbuffer, keybuffer, possdata); + possdata = try_all_possibilities(space, basepc, offset + 1, length, instrbuffer, keybuffer, possdata); /* otherwise, output what we have */ else @@ -1478,7 +1483,7 @@ static fd1094_possibility *try_all_possibilities(running_machine *machine, int b m68k_disassemble_raw(possdata->dasm, basepc, instrbuffer, instrbuffer, M68K_CPU_TYPE_68000); /* validate the opcode */ - tlen = validate_opcode(machine, basepc, instrbuffer, length); + tlen = validate_opcode(space, basepc, instrbuffer, length); if (tlen == 0) { printf("Eliminated: %s [", possdata->dasm); @@ -2224,7 +2229,7 @@ static void build_optable(void) valid or not, and return the length -----------------------------------------------*/ -static int validate_ea(running_machine *machine, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags) +static int validate_ea(const address_space *space, UINT32 pc, UINT8 modereg, const UINT8 *parambase, UINT32 flags) { UINT32 addr; int valid; @@ -2257,15 +2262,15 @@ static int validate_ea(running_machine *machine, UINT32 pc, UINT8 modereg, const { case 0: /* (xxx).W -- make sure it is not odd for word/long */ addr = (INT16)((parambase[0] << 8) | parambase[1]); - valid = addr_is_valid(machine, addr & 0xffffff, flags); + valid = addr_is_valid(space, addr & 0xffffff, flags); return (valid == 0) ? 1000 : (valid == 2) ? -1 : 1; case 1: /* (xxx).L -- make sure it is not odd for word/long, and make sure upper byte of addr is 0 */ - valid = addr_is_valid(machine, (parambase[0] << 24) | (parambase[1] << 16) | (parambase[2] << 8) | parambase[3], flags); + valid = addr_is_valid(space, (parambase[0] << 24) | (parambase[1] << 16) | (parambase[2] << 8) | parambase[3], flags); return (valid == 0) ? 1000 : (valid == 2) ? -2 : 2; case 2: /* (d16,PC) -- make sure it is not odd for word/long */ - valid = addr_is_valid(machine, pc + (INT16)((parambase[0] << 8) | parambase[1]), flags); + valid = addr_is_valid(space, pc + (INT16)((parambase[0] << 8) | parambase[1]), flags); return (valid == 0) ? 1000 : (valid == 2) ? -1 : 1; case 3: /* (d8,PC,Xn) -- odd displacements are a warning for word/long */ @@ -2294,7 +2299,7 @@ static int validate_ea(running_machine *machine, UINT32 pc, UINT8 modereg, const the length specified -----------------------------------------------*/ -static int validate_opcode(running_machine *machine, UINT32 pc, const UINT8 *opdata, int maxwords) +static int validate_opcode(const address_space *space, UINT32 pc, const UINT8 *opdata, int maxwords) { UINT32 immvalue = 0; int iffy = FALSE; @@ -2371,7 +2376,7 @@ static int validate_opcode(running_machine *machine, UINT32 pc, const UINT8 *opd pc += immvalue; /* if we're odd or out of range, fail */ - valid = pc_is_valid(machine, pc, flags); + valid = pc_is_valid(space, pc, flags); if (valid == 0) return 0; if (valid == 2) @@ -2382,7 +2387,7 @@ static int validate_opcode(running_machine *machine, UINT32 pc, const UINT8 *opd if (flags & (OF_EASRC | OF_EADST)) { int modereg = opcode & 0x003f; - int ealen = validate_ea(machine, pc + offset*2, modereg, &opdata[offset*2], flags); + int ealen = validate_ea(space, pc + offset*2, modereg, &opdata[offset*2], flags); /* if the ea was invalid, forward that result */ if (ealen == 1000) @@ -2403,7 +2408,7 @@ static int validate_opcode(running_machine *machine, UINT32 pc, const UINT8 *opd if (flags & OF_MOVE) { int modereg = ((opcode & 0x01c0) >> 3) | ((opcode & 0x0e00) >> 9); - int ealen = validate_ea(machine, pc + offset*2, modereg, &opdata[offset*2], flags); + int ealen = validate_ea(space, pc + offset*2, modereg, &opdata[offset*2], flags); /* if the ea was invalid, forward that result */ if (ealen == 1000) diff --git a/src/mame/machine/gaelcrpt.c b/src/mame/machine/gaelcrpt.c index 162350ec08a..082f01a4441 100644 --- a/src/mame/machine/gaelcrpt.c +++ b/src/mame/machine/gaelcrpt.c @@ -120,11 +120,11 @@ static int decrypt(int const param1, int const param2, int const enc_prev_word, -UINT16 gaelco_decrypt(running_machine *machine, int offset, int data, int param1, int param2) +UINT16 gaelco_decrypt(const address_space *space, int offset, int data, int param1, int param2) { static int lastpc, lastoffset, lastencword, lastdecword; - int thispc = cpu_get_pc(machine->activecpu); + int thispc = cpu_get_pc(space->cpu); // int savedata = data; /* check if 2nd half of 32 bit */ @@ -146,7 +146,7 @@ UINT16 gaelco_decrypt(running_machine *machine, int offset, int data, int param1 lastdecword = data; -// logerror("%8x : data1 = %4x > %4x @ %8x\n",cpu_get_pc(machine->activecpu),savedata,data,lastoffset); +// logerror("%s : data1 = %4x > %4x @ %8x\n",cpuexec_describe_context(space->machine),savedata,data,lastoffset); } return data; } diff --git a/src/mame/machine/harddriv.c b/src/mame/machine/harddriv.c index 1addf0ba4b7..adb8d161feb 100644 --- a/src/mame/machine/harddriv.c +++ b/src/mame/machine/harddriv.c @@ -1200,7 +1200,7 @@ READ16_HANDLER( hd68k_ds3_gdata_r ) logerror("%06X:hd68k_ds3_gdata_r(%04X)\n", cpu_get_previouspc(space->cpu), ds3_gdata); /* attempt to optimize the transfer if conditions are right */ - if (space->machine->activecpu == space->machine->cpu[0] && pc == hdds3_transfer_pc && + if (space->cpu == space->machine->cpu[0] && pc == hdds3_transfer_pc && !(!ds3_g68flag && ds3_g68irqs) && !(ds3_gflag && ds3_gfirqs)) { UINT32 destaddr = cpu_get_reg(space->cpu, M68K_A1); diff --git a/src/mame/machine/irobot.c b/src/mame/machine/irobot.c index 09d3501d9da..1d9edcf924b 100644 --- a/src/mame/machine/irobot.c +++ b/src/mame/machine/irobot.c @@ -26,7 +26,7 @@ #define IR_CPU_STATE(m) \ logerror(\ - "pc: %4x, scanline: %d\n", cpu_get_previouspc((m)->activecpu), video_screen_get_vpos((m)->primary_screen)) + "%s, scanline: %d\n", cpuexec_describe_context(m), video_screen_get_vpos((m)->primary_screen)) UINT8 irobot_vg_clear; diff --git a/src/mame/machine/kaneko16.c b/src/mame/machine/kaneko16.c index 1260fb20863..7c3dd4067b2 100644 --- a/src/mame/machine/kaneko16.c +++ b/src/mame/machine/kaneko16.c @@ -322,8 +322,8 @@ static void calc3_mcu_run(running_machine *machine) if (mcu_command == 0) return; - logerror("CPU #0 PC %06X : MCU executed command at %04X: %04X\n", - cpu_get_pc(machine->activecpu),calc3_mcu_command_offset*2,mcu_command); + logerror("%s : MCU executed command at %04X: %04X\n", + cpuexec_describe_context(machine),calc3_mcu_command_offset*2,mcu_command); switch (mcu_command) { @@ -728,7 +728,7 @@ void bloodwar_mcu_run(running_machine *machine) mame_fread(f,&kaneko16_mcu_ram[mcu_offset], 128); mame_fclose(f); } - logerror("PC=%06X : MCU executed command: %04X %04X (load NVRAM settings)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; @@ -740,20 +740,20 @@ void bloodwar_mcu_run(running_machine *machine) mame_fwrite(f,&kaneko16_mcu_ram[mcu_offset], 128); mame_fclose(f); } - logerror("PC=%06X : MCU executed command: %04X %04X (save NVRAM settings)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; case 0x03: // DSW { kaneko16_mcu_ram[mcu_offset] = input_port_read(machine, "DSW1"); - logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (read DSW)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; case 0x04: // Protection { - logerror("PC=%06X : MCU executed command: %04X %04X %04X\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2, mcu_data); + logerror("%s : MCU executed command: %04X %04X %04X\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data); toxboy_handle_04_subcommand(machine, mcu_data, kaneko16_mcu_ram); @@ -761,7 +761,7 @@ void bloodwar_mcu_run(running_machine *machine) break; default: - logerror("PC=%06X : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2, mcu_data); + logerror("%s : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data); break; } } @@ -787,7 +787,7 @@ void bonkadv_mcu_run(running_machine *machine) mame_fread(f,&kaneko16_mcu_ram[mcu_offset], 128); mame_fclose(f); } - logerror("PC=%06X : MCU executed command: %04X %04X (load NVRAM settings)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (load NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; @@ -799,7 +799,7 @@ void bonkadv_mcu_run(running_machine *machine) mame_fwrite(f,&kaneko16_mcu_ram[mcu_offset], 128); mame_fclose(f); } - logerror("PC=%06X : MCU executed command: %04X %04X (save NVRAM settings)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (save NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; @@ -811,20 +811,20 @@ void bonkadv_mcu_run(running_machine *machine) mame_fwrite(f, bonkadv_mcu_43, sizeof(bonkadv_mcu_43)); mame_fclose(f); } - logerror("PC=%06X : MCU executed command: %04X %04X (restore default NVRAM settings)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (restore default NVRAM settings)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; case 0x03: // DSW { kaneko16_mcu_ram[mcu_offset] = input_port_read(machine, "DSW1"); - logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2); + logerror("%s : MCU executed command: %04X %04X (read DSW)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2); } break; case 0x04: // Protection { - logerror("PC=%06X : MCU executed command: %04X %04X %04X\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2, mcu_data); + logerror("%s : MCU executed command: %04X %04X %04X\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data); switch(mcu_data) @@ -846,7 +846,7 @@ void bonkadv_mcu_run(running_machine *machine) break; default: - logerror("PC=%06X : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2, mcu_data); + logerror("%s : MCU executed command: %04X %04X %04X (UNKNOWN COMMAND)\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data); break; } } @@ -869,7 +869,7 @@ void gtmr_mcu_run(running_machine *machine) UINT16 mcu_offset = kaneko16_mcu_ram[0x0012/2] / 2; UINT16 mcu_data = kaneko16_mcu_ram[0x0014/2]; - logerror("CPU #0 PC %06X : MCU executed command: %04X %04X %04X\n", cpu_get_pc(machine->activecpu), mcu_command, mcu_offset*2, mcu_data); + logerror("%s : MCU executed command: %04X %04X %04X\n", cpuexec_describe_context(machine), mcu_command, mcu_offset*2, mcu_data); switch (mcu_command >> 8) { diff --git a/src/mame/machine/konppc.c b/src/mame/machine/konppc.c index 32df7ca8480..69caf1a600c 100644 --- a/src/mame/machine/konppc.c +++ b/src/mame/machine/konppc.c @@ -273,7 +273,7 @@ static void dsp_comm_sharc_w(const address_space *space, int board, int offset, } } -// printf("cgboard_dsp_comm_w_sharc: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, cpu_get_pc(machine->activecpu)); +// printf("%s:cgboard_dsp_comm_w_sharc: %08X, %08X, %08X\n", cpuexec_describe_context(space->machine), data, offset, mem_mask); dsp_comm_sharc[board][offset] = data; } @@ -430,7 +430,7 @@ static UINT32 K033906_r(int chip, int reg) case 0x0f: return K033906_reg[chip][0x0f]; // interrupt_line, interrupt_pin, min_gnt, max_lat default: - fatalerror("K033906_r: %d, %08X at %08X", chip, reg, cpu_get_pc(Machine->activecpu)); + fatalerror("%s:K033906_r: %d, %08X", cpuexec_describe_context(Machine), chip, reg); } return 0; } @@ -479,7 +479,7 @@ static void K033906_w(running_machine *machine, int chip, int reg, UINT32 data) break; default: - fatalerror("K033906_w: %d, %08X, %08X at %08X", chip, data, reg, cpu_get_pc(machine->activecpu)); + fatalerror("%s:K033906_w: %d, %08X, %08X", cpuexec_describe_context(machine), chip, data, reg); } } diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c index 3a17e4a03b9..2d294b5d1a4 100644 --- a/src/mame/machine/leland.c +++ b/src/mame/machine/leland.c @@ -607,7 +607,7 @@ void viper_bankswitch(running_machine *machine) address = &master_base[bank_list[alternate_bank & 3]]; if (bank_list[alternate_bank & 3] >= master_length) { - logerror("%04X:Master bank %02X out of range!\n", safe_cpu_get_pc(machine->activecpu), alternate_bank & 3); + logerror("%s:Master bank %02X out of range!\n", cpuexec_describe_context(machine), alternate_bank & 3); address = &master_base[bank_list[0]]; } memory_set_bankptr(machine, 1, address); @@ -628,7 +628,7 @@ void offroad_bankswitch(running_machine *machine) address = &master_base[bank_list[alternate_bank & 7]]; if (bank_list[alternate_bank & 7] >= master_length) { - logerror("%04X:Master bank %02X out of range!\n", safe_cpu_get_pc(machine->activecpu), alternate_bank & 7); + logerror("%s:Master bank %02X out of range!\n", cpuexec_describe_context(machine), alternate_bank & 7); address = &master_base[bank_list[0]]; } memory_set_bankptr(machine, 1, address); @@ -653,7 +653,7 @@ void ataxx_bankswitch(running_machine *machine) address = &master_base[bank_list[master_bank & 15]]; if (bank_list[master_bank & 15] >= master_length) { - logerror("%04X:Master bank %02X out of range!\n", safe_cpu_get_pc(machine->activecpu), master_bank & 15); + logerror("%s:Master bank %02X out of range!\n", cpuexec_describe_context(machine), master_bank & 15); address = &master_base[bank_list[0]]; } memory_set_bankptr(machine, 1, address); @@ -991,7 +991,7 @@ static int keycard_r(running_machine *machine) { int result = 0; - if (LOG_KEYCARDS_FULL) logerror(" (%04X:keycard_r)\n", safe_cpu_get_pc(machine->activecpu)); + if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_r)\n", cpuexec_describe_context(machine)); /* if we have a valid keycard read state, we're reading from the keycard */ if (keycard_state & 0x80) @@ -1015,7 +1015,7 @@ static void keycard_w(running_machine *machine, int data) int new_state = data & 0xb0; int new_clock = data & 0x40; - if (LOG_KEYCARDS_FULL) logerror(" (%04X:keycard_w=%02X)\n", safe_cpu_get_pc(machine->activecpu), data); + if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_w=%02X)\n", cpuexec_describe_context(machine), data); /* check for going active */ if (!keycard_state && new_state) diff --git a/src/mame/machine/midwayic.c b/src/mame/machine/midwayic.c index 31d646a1504..062505af6be 100644 --- a/src/mame/machine/midwayic.c +++ b/src/mame/machine/midwayic.c @@ -208,7 +208,7 @@ UINT8 midway_serial_pic_status_r(void) UINT8 midway_serial_pic_r(void) { - logerror("%08X:security R = %04X\n", safe_cpu_get_pc(Machine->activecpu), serial.buffer); + logerror("%s:security R = %04X\n", cpuexec_describe_context(Machine), serial.buffer); serial.status = 1; return serial.buffer; } @@ -216,7 +216,7 @@ UINT8 midway_serial_pic_r(void) void midway_serial_pic_w(UINT8 data) { - logerror("%08X:security W = %04X\n", safe_cpu_get_pc(Machine->activecpu), data); + logerror("%s:security W = %04X\n", cpuexec_describe_context(Machine), data); /* status seems to reflect the clock bit */ serial.status = (data >> 4) & 1; @@ -308,7 +308,7 @@ UINT8 midway_serial_pic2_status_r(void) result = 1; } - logerror("%06X:PIC status %d\n", safe_cpu_get_pc(Machine->activecpu), result); + logerror("%s:PIC status %d\n", cpuexec_describe_context(Machine), result); return result; } @@ -318,7 +318,7 @@ UINT8 midway_serial_pic2_r(void) UINT8 result = 0; /* PIC data register */ - logerror("%06X:PIC data read (index=%d total=%d latch=%03X) =", safe_cpu_get_pc(Machine->activecpu), pic.index, pic.total, pic.latch); + logerror("%s:PIC data read (index=%d total=%d latch=%03X) =", cpuexec_describe_context(Machine), pic.index, pic.total, pic.latch); /* return the current result */ if (pic.latch & 0xf00) @@ -341,9 +341,9 @@ void midway_serial_pic2_w(running_machine *machine, UINT8 data) /* PIC command register */ if (pic.state == 0) - logerror("%06X:PIC command %02X\n", safe_cpu_get_pc(machine->activecpu), data); + logerror("%s:PIC command %02X\n", cpuexec_describe_context(machine), data); else - logerror("%06X:PIC data %02X\n", safe_cpu_get_pc(machine->activecpu), data); + logerror("%s:PIC data %02X\n", cpuexec_describe_context(machine), data); /* store in the latch, along with a bit to indicate we have data */ pic.latch = (data & 0x00f) | 0x480; @@ -745,7 +745,7 @@ static UINT16 ioasic_fifo_r(const device_config *device) /* main CPU is handling the I/O ASIC interrupt */ if (ioasic.fifo_bytes == 0 && ioasic.has_dcs) { - ioasic.fifo_force_buffer_empty_pc = safe_cpu_get_pc(device->machine->activecpu); + ioasic.fifo_force_buffer_empty_pc = safe_cpu_get_pc(ioasic.dcs_cpu); if (LOG_FIFO) logerror("fifo_r(%04X): FIFO empty, PC = %04X\n", result, ioasic.fifo_force_buffer_empty_pc); } @@ -775,7 +775,7 @@ static UINT16 ioasic_fifo_status_r(const device_config *device) /* sure the FIFO clear bit is set */ if (ioasic.fifo_force_buffer_empty_pc && device == ioasic.dcs_cpu) { - offs_t currpc = safe_cpu_get_pc(device); + offs_t currpc = safe_cpu_get_pc(ioasic.dcs_cpu); if (currpc >= ioasic.fifo_force_buffer_empty_pc && currpc < ioasic.fifo_force_buffer_empty_pc + 0x10) { ioasic.fifo_force_buffer_empty_pc = 0; @@ -801,7 +801,7 @@ void midway_ioasic_fifo_reset_w(running_machine *machine, int state) update_ioasic_irq(machine); } if (LOG_FIFO) - logerror("%08X:fifo_reset(%d)\n", safe_cpu_get_pc(machine->activecpu), state); + logerror("%s:fifo_reset(%d)\n", cpuexec_describe_context(machine), state); } diff --git a/src/mame/machine/namcoio.c b/src/mame/machine/namcoio.c index 4384ec5bd69..c56c3722e03 100644 --- a/src/mame/machine/namcoio.c +++ b/src/mame/machine/namcoio.c @@ -187,7 +187,7 @@ static void namcoio_51XX_write(running_machine *machine,int chip,int data) { data &= 0x07; - LOG(("%04x: custom 51XX write %02x\n",cpu_get_pc(machine->activecpu),data)); + LOG(("%s: custom 51XX write %02x\n",cpuexec_describe_context(machine),data)); if (io[chip].coincred_mode) { @@ -285,7 +285,7 @@ static UINT8 namcoio_51XX_read(running_machine *machine, int chip) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - LOG(("%04x: custom 51XX read\n",cpu_get_pc(machine->activecpu))); + LOG(("%s: custom 51XX read\n",cpuexec_describe_context(machine))); if (io[chip].mode == 0) /* switch mode */ { @@ -878,7 +878,7 @@ static UINT8 namcoio_53XX_digdug_read(running_machine *machine, int chip) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - LOG(("%04x: custom 53XX read\n",cpu_get_pc(machine->activecpu))); + LOG(("%s: custom 53XX read\n",cpuexec_describe_context(machine))); switch ((io[chip].in_count++) % 2) { @@ -893,7 +893,7 @@ static UINT8 namcoio_53XX_polepos_read(running_machine *machine,int chip) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - LOG(("%04x: custom 53XX read\n",cpu_get_pc(machine->activecpu))); + LOG(("%s: custom 53XX read\n",cpuexec_describe_context(machine))); switch ((io[chip].in_count++) % 8) { @@ -916,7 +916,7 @@ static UINT8 namco_06xx_data_read(running_machine *machine, int chipnum) case NAMCOIO_53XX_DIGDUG: return namcoio_53XX_digdug_read(machine, chipnum); case NAMCOIO_53XX_POLEPOS: return namcoio_53XX_polepos_read(machine, chipnum); default: - logerror("%04x: custom IO type %d unsupported read\n",cpu_get_pc(machine->activecpu),io[chipnum].type); + logerror("%s: custom IO type %d unsupported read\n",cpuexec_describe_context(machine),io[chipnum].type); return 0xff; } } @@ -934,7 +934,7 @@ static void namco_06xx_data_write(running_machine *machine,int chipnum,UINT8 dat case NAMCOIO_52XX: namcoio_52xx_write(data); break; case NAMCOIO_54XX: namco_54xx_write(data); break; default: - logerror("%04x: custom IO type %d unsupported write\n",cpu_get_pc(machine->activecpu),io[chipnum].type); + logerror("%s: custom IO type %d unsupported write\n",cpuexec_describe_context(machine),io[chipnum].type); break; } } @@ -949,7 +949,7 @@ static void namco_06xx_read_request(running_machine *machine, int chipnum) case NAMCOIO_50XX: namco_50xx_read_request(machine); break; case NAMCOIO_50XX_2: namco_50xx_2_read_request(machine); break; default: - logerror("%04x: custom IO type %d read_request unsupported\n",cpu_get_pc(machine->activecpu),io[chipnum].type); + logerror("%s: custom IO type %d read_request unsupported\n",cpuexec_describe_context(machine),io[chipnum].type); break; } } @@ -957,11 +957,11 @@ static void namco_06xx_read_request(running_machine *machine, int chipnum) static UINT8 namco_06xx_data_r(running_machine *machine,int chip,int offset) { - LOG(("%04x: 06XX #%d read offset %d\n",cpu_get_pc(machine->activecpu),chip,offset)); + LOG(("%s: 06XX #%d read offset %d\n",cpuexec_describe_context(machine),chip,offset)); if (!(customio_command[chip] & 0x10)) { - logerror("%04x: 06XX #%d read in write mode %02x\n",cpu_get_pc(machine->activecpu),chip,customio_command[chip]); + logerror("%s: 06XX #%d read in write mode %02x\n",cpuexec_describe_context(machine),chip,customio_command[chip]); return 0; } @@ -972,7 +972,7 @@ static UINT8 namco_06xx_data_r(running_machine *machine,int chip,int offset) case 0x4: return namco_06xx_data_read(machine, 4*chip + 2); break; case 0x8: return namco_06xx_data_read(machine, 4*chip + 3); break; default: - logerror("%04x: 06XX #%d read in unsupported mode %02x\n",cpu_get_pc(machine->activecpu),chip,customio_command[chip]); + logerror("%s: 06XX #%d read in unsupported mode %02x\n",cpuexec_describe_context(machine),chip,customio_command[chip]); return 0xff; } } @@ -980,11 +980,11 @@ static UINT8 namco_06xx_data_r(running_machine *machine,int chip,int offset) static void namco_06xx_data_w(running_machine *machine,int chip,int offset,int data) { - LOG(("%04x: 06XX #%d write offset %d = %02x\n",cpu_get_pc(machine->activecpu),chip,offset,data)); + LOG(("%s: 06XX #%d write offset %d = %02x\n",cpuexec_describe_context(machine),chip,offset,data)); if (customio_command[chip] & 0x10) { - logerror("%04x: 06XX #%d write in read mode %02x\n",cpu_get_pc(machine->activecpu),chip,customio_command[chip]); + logerror("%s: 06XX #%d write in read mode %02x\n",cpuexec_describe_context(machine),chip,customio_command[chip]); return; } @@ -995,7 +995,7 @@ static void namco_06xx_data_w(running_machine *machine,int chip,int offset,int d case 0x4: namco_06xx_data_write(machine,4*chip + 2,data); break; case 0x8: namco_06xx_data_write(machine,4*chip + 3,data); break; default: - logerror("%04x: 06XX #%d write in unsupported mode %02x\n",cpu_get_pc(machine->activecpu),chip,customio_command[chip]); + logerror("%s: 06XX #%d write in unsupported mode %02x\n",cpuexec_describe_context(machine),chip,customio_command[chip]); break; } } @@ -1003,13 +1003,13 @@ static void namco_06xx_data_w(running_machine *machine,int chip,int offset,int d static UINT8 namco_06xx_ctrl_r(running_machine *machine, int chip) { - LOG(("%04x: 06XX #%d ctrl_r\n",cpu_get_pc(machine->activecpu),chip)); + LOG(("%s: 06XX #%d ctrl_r\n",cpuexec_describe_context(machine),chip)); return customio_command[chip]; } static void namco_06xx_ctrl_w(running_machine *machine, int chip,int data) { - LOG(("%04x: 06XX #%d command %02x\n",cpu_get_pc(machine->activecpu),chip,data)); + LOG(("%s: 06XX #%d command %02x\n",cpuexec_describe_context(machine),chip,data)); customio_command[chip] = data; @@ -1037,7 +1037,7 @@ static void namco_06xx_ctrl_w(running_machine *machine, int chip,int data) case 0x4: namco_06xx_read_request(machine, 4*chip + 2); break; case 0x8: namco_06xx_read_request(machine, 4*chip + 3); break; default: - logerror("%04x: 06XX #%d read in unsupported mode %02x\n",cpu_get_pc(machine->activecpu),chip,customio_command[chip]); + logerror("%s: 06XX #%d read in unsupported mode %02x\n",cpuexec_describe_context(machine),chip,customio_command[chip]); } } } diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index 14a28d51439..29fae706b97 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -739,8 +739,8 @@ static void namcos1_bankswitch(running_machine *machine, int cpu, offs_t offset, /* unmapped bank warning */ if( namcos1_active_bank[bank].bank_handler_r == unknown_r) { - logerror("CPU #%d PC %04x:warning unknown chip selected bank %x=$%04x\n", cpu , cpu_get_pc(machine->activecpu), bank , chip[bank] ); -// if (chip) popmessage("CPU #%d PC %04x:unknown chip selected bank %x=$%04x", cpu , cpu_get_pc(machine->activecpu), bank , chip[bank] ); + logerror("%s:warning unknown chip selected bank %x=$%04x\n", cpuexec_describe_context(machine), bank , chip[bank] ); +// if (chip) popmessage("%s:unknown chip selected bank %x=$%04x", cpu , cpuexec_describe_context(machine), bank , chip[bank] ); } } diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c index 1dbf6274a8d..88a069f651f 100644 --- a/src/mame/machine/namcos2.c +++ b/src/mame/machine/namcos2.c @@ -474,33 +474,31 @@ static int IsSystem21( void ) } static UINT16 -ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, int bWrite ) +ReadWriteC148( const address_space *space, offs_t offset, UINT16 data, int bWrite ) { offs_t addr = ((offset*2)+0x1c0000)&0x1fe000; + const device_config *altcpu = NULL; UINT16 *pC148Reg = NULL; UINT16 *pC148RegAlt = NULL; UINT16 result = 0; - int altCPU = 0; - switch( cpu ) + if (space->cpu == space->machine->cpu[CPU_MASTER]) { - case CPU_MASTER: pC148Reg = namcos2_68k_master_C148; - altCPU = CPU_SLAVE; + altcpu = space->machine->cpu[CPU_SLAVE]; pC148RegAlt = namcos2_68k_slave_C148; - break; - - case CPU_SLAVE: + } + else if (space->cpu == space->machine->cpu[CPU_SLAVE]) + { pC148Reg = namcos2_68k_slave_C148; - altCPU = CPU_MASTER; + altcpu = space->machine->cpu[CPU_MASTER]; pC148RegAlt = namcos2_68k_master_C148; - break; - - case CPU_GPU: + } + else if (space->cpu == space->machine->cpu[CPU_GPU]) + { pC148Reg = namcos2_68k_gpu_C148; - altCPU = CPU_MASTER; + altcpu = space->machine->cpu[CPU_MASTER]; pC148RegAlt = namcos2_68k_master_C148; - break; } if( bWrite ) @@ -522,20 +520,20 @@ ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, in case 0x1d0000: if( bWrite ) { - cpu_set_input_line(machine->cpu[altCPU], pC148RegAlt[NAMCOS2_C148_CPUIRQ], ASSERT_LINE); - } cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_0], CLEAR_LINE); + cpu_set_input_line(altcpu, pC148RegAlt[NAMCOS2_C148_CPUIRQ], ASSERT_LINE); + } cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_0], CLEAR_LINE); break; case 0x1d2000: - cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_1], CLEAR_LINE); + cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_1], CLEAR_LINE); break; case 0x1d4000: if( bWrite ) { - cpu_set_input_line(machine->cpu[altCPU], pC148RegAlt[NAMCOS2_C148_CPUIRQ], ASSERT_LINE); + cpu_set_input_line(altcpu, pC148RegAlt[NAMCOS2_C148_CPUIRQ], ASSERT_LINE); } - cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_2], CLEAR_LINE); + cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_2], CLEAR_LINE); break; case 0x1d6000: @@ -543,7 +541,7 @@ ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, in { // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); } - cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_CPUIRQ], CLEAR_LINE); + cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_CPUIRQ], CLEAR_LINE); break; case 0x1d8000: /* ack EXIRQ */ @@ -551,7 +549,7 @@ ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, in { // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); } - cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_EXIRQ], CLEAR_LINE); + cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_EXIRQ], CLEAR_LINE); break; case 0x1da000: /* ack POSIRQ */ @@ -559,7 +557,7 @@ ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, in { // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); } - cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_POSIRQ], CLEAR_LINE); + cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_POSIRQ], CLEAR_LINE); break; case 0x1dc000: /* ack SCIRQ */ @@ -567,11 +565,11 @@ ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, in { // mame_printf_debug( "cpu(%d) RAM[0x%06x] = 0x%x\n", cpu, addr, data ); } - cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_SERIRQ], CLEAR_LINE); + cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_SERIRQ], CLEAR_LINE); break; case 0x1de000: /* ack VBLANK */ - cpu_set_input_line(machine->cpu[cpu], pC148Reg[NAMCOS2_C148_VBLANKIRQ], CLEAR_LINE); + cpu_set_input_line(space->cpu, pC148Reg[NAMCOS2_C148_VBLANKIRQ], CLEAR_LINE); break; case 0x1e0000: /* EEPROM Status Register */ @@ -579,42 +577,42 @@ ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, in break; case 0x1e2000: /* Sound CPU Reset control */ - if( cpu == CPU_MASTER ) /* ? */ + if( space->cpu == space->machine->cpu[CPU_MASTER] ) /* ? */ { if( data&0x01 ) { /* Resume execution */ - cpu_set_input_line(machine->cpu[CPU_SOUND], INPUT_LINE_RESET, CLEAR_LINE); - cpu_yield(machine->activecpu); + cpu_set_input_line(space->machine->cpu[CPU_SOUND], INPUT_LINE_RESET, CLEAR_LINE); + cpu_yield(space->cpu); } else { /* Suspend execution */ - cpu_set_input_line(machine->cpu[CPU_SOUND], INPUT_LINE_RESET, ASSERT_LINE); + cpu_set_input_line(space->machine->cpu[CPU_SOUND], INPUT_LINE_RESET, ASSERT_LINE); } if( IsSystem21() ) { //printf( "dspkick=0x%x\n", data ); if( data&4 ) { - namcos21_kickstart(machine, 1); + namcos21_kickstart(space->machine, 1); } } } break; case 0x1e4000: /* Alt 68000 & IO CPU Reset */ - if( cpu == CPU_MASTER ) /* ? */ + if( space->cpu == space->machine->cpu[CPU_MASTER] ) /* ? */ { if( data&0x01 ) { /* Resume execution */ - ResetAllSubCPUs( machine, CLEAR_LINE ); + ResetAllSubCPUs( space->machine, CLEAR_LINE ); /* Give the new CPU an immediate slice of the action */ - cpu_yield(machine->activecpu); + cpu_yield(space->cpu); } else { /* Suspend execution */ - ResetAllSubCPUs( machine, ASSERT_LINE ); + ResetAllSubCPUs( space->machine, ASSERT_LINE ); } } break; @@ -631,32 +629,32 @@ ReadWriteC148( running_machine *machine, int cpu, offs_t offset, UINT16 data, in WRITE16_HANDLER( namcos2_68k_master_C148_w ) { - (void)ReadWriteC148( space->machine, CPU_MASTER, offset, data, 1 ); + (void)ReadWriteC148( space, offset, data, 1 ); } READ16_HANDLER( namcos2_68k_master_C148_r ) { - return ReadWriteC148( space->machine, CPU_MASTER, offset, 0, 0 ); + return ReadWriteC148( space, offset, 0, 0 ); } WRITE16_HANDLER( namcos2_68k_slave_C148_w ) { - (void)ReadWriteC148( space->machine, CPU_SLAVE, offset, data, 1 ); + (void)ReadWriteC148( space, offset, data, 1 ); } READ16_HANDLER( namcos2_68k_slave_C148_r ) { - return ReadWriteC148( space->machine, CPU_SLAVE, offset, 0, 0 ); + return ReadWriteC148( space, offset, 0, 0 ); } WRITE16_HANDLER( namcos2_68k_gpu_C148_w ) { - (void)ReadWriteC148( space->machine, CPU_GPU, offset, data, 1 ); + (void)ReadWriteC148( space, offset, data, 1 ); } READ16_HANDLER( namcos2_68k_gpu_C148_r ) { - return ReadWriteC148( space->machine, CPU_GPU, offset, 0, 0 ); + return ReadWriteC148( space, offset, 0, 0 ); } static TIMER_CALLBACK( namcos2_68k_master_posirq ) diff --git a/src/mame/machine/naomibd.c b/src/mame/machine/naomibd.c index c70448fb9f1..418ee44c4c3 100644 --- a/src/mame/machine/naomibd.c +++ b/src/mame/machine/naomibd.c @@ -230,7 +230,7 @@ READ64_DEVICE_HANDLER( naomibd_r ) } else { - //mame_printf_verbose("ROM: read mask %llx @ %x (PC=%x)\n", mem_mask, offset, activecpu_get_pc()); + //mame_printf_verbose("%s:ROM: read mask %llx @ %x\n", cpuexec_describe_context(machine), mem_mask, offset); } return U64(0xffffffffffffffff); @@ -269,7 +269,7 @@ WRITE64_DEVICE_HANDLER( naomibd_w ) { // ROM_DATA // Doa2 writes here (16 bit decryption key ?) - //mame_printf_verbose("ROM: write %llx to 5f7008 (PC=%x)\n", data, activecpu_get_pc()); + //mame_printf_verbose("%s:ROM: write %llx to 5f7008\n", cpuexec_describe_context(machine), data); } else if ((offset == 15) && ACCESSING_BITS_0_15) { @@ -306,7 +306,7 @@ WRITE64_DEVICE_HANDLER( naomibd_w ) } else { - //mame_printf_verbose("ROM: write %llx to %x, mask %llx (PC=%x)\n", data, offset, mem_mask, activecpu_get_pc()); + //mame_printf_verbose("%s: ROM: write %llx to %x, mask %llx\n", cpuexec_describe_context(machine), data, offset, mem_mask); } } diff --git a/src/mame/machine/pitnrun.c b/src/mame/machine/pitnrun.c index 0b71cef7d0f..cc40c389f7a 100644 --- a/src/mame/machine/pitnrun.c +++ b/src/mame/machine/pitnrun.c @@ -121,15 +121,11 @@ WRITE8_HANDLER( pitnrun_68705_portB_w ) } if (~data & 0x10) { - cpu_push_context(cpu0space->cpu); memory_write_byte(cpu0space, address, portA_out); - cpu_pop_context(); } if (~data & 0x20) { - cpu_push_context(cpu0space->cpu); - portA_in = memory_read_byte(cpu0space, address); - cpu_pop_context(); + portA_in = memory_read_byte(cpu0space, address); } if (~data & 0x40) { diff --git a/src/mame/machine/psx.c b/src/mame/machine/psx.c index 2843b45d5f6..0d6fd657609 100644 --- a/src/mame/machine/psx.c +++ b/src/mame/machine/psx.c @@ -22,14 +22,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu == NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/mame/machine/scramble.c b/src/mame/machine/scramble.c index cf5aa438fc8..97e1f89e0da 100644 --- a/src/mame/machine/scramble.c +++ b/src/mame/machine/scramble.c @@ -86,7 +86,7 @@ static WRITE8_DEVICE_HANDLER( scramble_protection_w ) static READ8_DEVICE_HANDLER( scramble_protection_r ) { - switch (cpu_get_pc(device->machine->activecpu)) + switch (cpu_get_pc(device->machine->cpu[0])) { case 0x00a8: return 0xf0; case 0x00be: return 0xb0; @@ -97,7 +97,7 @@ static READ8_DEVICE_HANDLER( scramble_protection_r ) case 0x1ca2: return 0x00; /* I don't think it's checked */ case 0x1d7e: return 0xb0; default: - logerror("%04x: read protection\n",cpu_get_pc(device->machine->activecpu)); + logerror("%s: read protection\n",cpuexec_describe_context(device->machine)); return 0; } } diff --git a/src/mame/machine/segaic16.c b/src/mame/machine/segaic16.c index 77fcc845ff8..a4ec8b7a9eb 100644 --- a/src/mame/machine/segaic16.c +++ b/src/mame/machine/segaic16.c @@ -240,18 +240,14 @@ static void memory_mapper_w(const address_space *space, struct memory_mapper_chi { const address_space *targetspace = cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM); offs_t addr = (chip->regs[0x0a] << 17) | (chip->regs[0x0b] << 9) | (chip->regs[0x0c] << 1); - cpu_push_context(targetspace->cpu); memory_write_word(targetspace, addr, (chip->regs[0x00] << 8) | chip->regs[0x01]); - cpu_pop_context(); } else if (data == 0x02) { const address_space *targetspace = cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM); offs_t addr = (chip->regs[0x07] << 17) | (chip->regs[0x08] << 9) | (chip->regs[0x09] << 1); UINT16 result; - cpu_push_context(targetspace->cpu); result = memory_read_word(targetspace, addr); - cpu_pop_context(); chip->regs[0x00] = result >> 8; chip->regs[0x01] = result; } @@ -552,7 +548,7 @@ static void divide_w(const address_space *space, int which, offs_t offset, UINT1 int a4 = offset & 8; int a3 = offset & 4; - if (LOG_DIVIDE) logerror("%06X:divide%d_w(%X) = %04X\n", cpu_get_pc(space->machine->activecpu), which, offset, data); + if (LOG_DIVIDE) logerror("%s:divide%d_w(%X) = %04X\n", cpuexec_describe_context(space->machine), which, offset, data); /* only 4 effective write registers */ offset &= 3; @@ -650,7 +646,7 @@ static void timer_interrupt_ack(running_machine *machine, int which) static UINT16 compare_timer_r(const address_space *space, int which, offs_t offset, UINT16 mem_mask) { offset &= 0xf; - if (LOG_COMPARE) logerror("%06X:compare%d_r(%X) = %04X\n", cpu_get_pc(space->machine->activecpu), which, offset, compare_timer[which].regs[offset]); + if (LOG_COMPARE) logerror("%s:compare%d_r(%X) = %04X\n", cpuexec_describe_context(space->machine), which, offset, compare_timer[which].regs[offset]); switch (offset) { case 0x0: return compare_timer[which].regs[0]; @@ -671,7 +667,7 @@ static UINT16 compare_timer_r(const address_space *space, int which, offs_t offs static void compare_timer_w(const address_space *space, int which, offs_t offset, UINT16 data, UINT16 mem_mask) { offset &= 0xf; - if (LOG_COMPARE) logerror("%06X:compare%d_w(%X) = %04X\n", cpu_get_pc(space->machine->activecpu), which, offset, data); + if (LOG_COMPARE) logerror("%s:compare%d_w(%X) = %04X\n", cpuexec_describe_context(space->machine), which, offset, data); switch (offset) { case 0x0: COMBINE_DATA(&compare_timer[which].regs[0]); update_compare(which, 0); break; diff --git a/src/mame/machine/slapstic.c b/src/mame/machine/slapstic.c index 2abd651704e..5698b2c68bd 100644 --- a/src/mame/machine/slapstic.c +++ b/src/mame/machine/slapstic.c @@ -1147,7 +1147,7 @@ static void slapstic_log(running_machine *machine, offs_t offset) fprintf(slapsticlog, "------------------------------------\n"); last_time = time; - fprintf(slapsticlog, "%06X: %04X B=%d ", cpu_get_previouspc(machine->activecpu), offset, current_bank); + fprintf(slapsticlog, "%s: %04X B=%d ", cpuexec_describe_context(machine), offset, current_bank); switch (state) { case DISABLED: diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index a212160b2ef..6d403ab29e3 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -108,7 +108,6 @@ static TIMER_CALLBACK( snes_scanline_tick ) { // make sure we're in the 65816's context since we're messing with the OAM and stuff const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(space->cpu); /* Increase current line - we want to latch on this line during it, not after it */ snes_ppu.beam.current_vert = video_screen_get_vpos(machine->primary_screen); @@ -233,8 +232,6 @@ static TIMER_CALLBACK( snes_scanline_tick ) cpu_set_input_line(machine->cpu[0], G65816_LINE_NMI, CLEAR_LINE ); } - cpu_pop_context(); - timer_adjust_oneshot(snes_scanline_timer, attotime_never, 0); timer_adjust_oneshot(snes_hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, snes_ppu.beam.current_vert, hblank_offset*snes_htmult), 0); } @@ -250,9 +247,6 @@ static TIMER_CALLBACK( snes_hblank_tick ) /* make sure we halt */ timer_adjust_oneshot(snes_hblank_timer, attotime_never, 0); - // we must guarantee the 65816's context for HDMA to work - cpu_push_context(cpu0space->cpu); - /* draw a scanline */ if (snes_ppu.beam.current_vert <= snes_ppu.beam.last_visible_line) { @@ -266,8 +260,6 @@ static TIMER_CALLBACK( snes_hblank_tick ) } } - cpu_pop_context(); - // signal hblank snes_ram[HVBJOY] |= 0x40; @@ -1545,12 +1537,10 @@ static void snes_init_ram(running_machine *machine) /* Init work RAM - 0x55 isn't exactly right but it's close */ /* make sure it happens to the 65816 (CPU 0) */ - cpu_push_context(cpu0space->cpu); for (i = 0; i < (128*1024); i++) { memory_write_byte(cpu0space, 0x7e0000 + i, 0x55); } - cpu_pop_context(); /* Inititialize registers/variables */ snes_ppu.update_windows = 1; diff --git a/src/mame/machine/stvcd.c b/src/mame/machine/stvcd.c index 08cab0cd15c..6a7060c19db 100644 --- a/src/mame/machine/stvcd.c +++ b/src/mame/machine/stvcd.c @@ -380,7 +380,7 @@ static UINT16 cd_readWord(UINT32 addr) hirqreg = rv; -// CDROM_LOG(("RW HIRQ: %04x (PC=%x)\n", rv, cpu_get_pc(machine->activecpu))) +// CDROM_LOG(("%s:RW HIRQ: %04x\n", cpuexec_describe_context(Machine), rv)) return rv; break; @@ -453,7 +453,7 @@ static UINT16 cd_readWord(UINT32 addr) break; default: - CDROM_LOG(("CD: RW %08x (PC=%x)\n", addr, cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: RW %08x\n", cpuexec_describe_context(machine), addr)) return 0xffff; break; } @@ -529,7 +529,7 @@ static UINT32 cd_readLong(UINT32 addr) break; default: - CDROM_LOG(("CD: RL %08x (PC=%x)\n", addr, cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: RL %08x\n", cpuexec_describe_context(machine), addr)) return 0xffff; break; } @@ -543,7 +543,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) { case 0x0008: case 0x000a: -// CDROM_LOG(("WW HIRQ: %04x & %04x => %04x (PC %x)\n", hirqreg, data, hirqreg & data, cpu_get_pc(machine->activecpu))) +// CDROM_LOG(("%s:WW HIRQ: %04x & %04x => %04x\n", cpuexec_describe_context(machine), hirqreg, data, hirqreg & data)) hirqreg &= data; return; case 0x000c: @@ -586,7 +586,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) switch (cr1 & 0xff00) { case 0x0000: - CDROM_LOG(("CD: Get Status (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get Status\n", cpuexec_describe_context(machine))) // values taken from a US saturn with a disc in and the lid closed hirqreg |= CMOK; @@ -598,7 +598,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x0100: - CDROM_LOG(("CD: Get Hardware Info (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get Hardware Info\n", cpuexec_describe_context(machine))) hirqreg |= CMOK; cr1 = cd_stat; cr2 = 0x0201; @@ -607,7 +607,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x200: // Get TOC - CDROM_LOG(("CD: Get TOC (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get TOC\n", cpuexec_describe_context(machine))) cd_readTOC(); cd_stat = CD_STAT_TRANS|CD_STAT_PAUSE; cr2 = 102*2; // TOC length in words (102 entries @ 2 words/4bytes each) @@ -621,7 +621,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) // bios is interested in returns in cr3 and cr4 // cr3 should be data track # // cr4 must be > 1 and < 100 or bios gets angry. - CDROM_LOG(("CD: Get Session Info (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get Session Info\n", cpuexec_describe_context(machine))) cd_readTOC(); switch (cr1 & 0xff) { @@ -652,7 +652,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) // CR1 & 4 = don't confirm mode 2 subheader // CR1 & 8 = retry reading mode 2 sectors // CR1 & 10 = force single-speed - CDROM_LOG(("CD: Initialize CD system (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Initialize CD system\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|DRDY|ESEL); cd_stat = CD_STAT_PAUSE; cd_curfad = 150; @@ -666,7 +666,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) case 0x0600: // end data transfer // returns # of bytes transfered (24 bits) in // low byte of cr1 (MSB) and cr2 (middle byte, LSB) - CDROM_LOG(("CD: End data transfer (PC=%x) (%d bytes xfer'd)\n", cpu_get_pc(machine->activecpu), xferdnum)) + CDROM_LOG(("%s:CD: End data transfer (%d bytes xfer'd)\n", cpuexec_describe_context(machine), xferdnum)) // clear the "transfer" flag cd_stat &= ~CD_STAT_TRANS; @@ -743,7 +743,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x1000: // Play Disk. FAD is in lowest 7 bits of cr1 and all of cr2. - CDROM_LOG(("CD: Play Disk (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Play Disk\n", cpuexec_describe_context(machine))) cd_stat = CD_STAT_PLAY; //|0x80; // set "cd-rom" bit? cd_curfad = ((cr1&0xff)<<16) | cr2; fadstoplay = ((cr3&0xff)<<16) | cr4; @@ -781,7 +781,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x1100: // disk seek - CDROM_LOG(("CD: Disk seek (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Disk seek\n", cpuexec_describe_context(machine))) if (cr1 & 0x80) { temp = (cr1&0x7f)<<16; // get FAD to seek to @@ -827,7 +827,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) // get operation parm = cr3>>8; - CDROM_LOG(("CD: Set CD Device Connection (PC=%x) filter # %x\n", cpu_get_pc(machine->activecpu), parm)) + CDROM_LOG(("%s:CD: Set CD Device Connection filter # %x\n", cpuexec_describe_context(machine), parm)) cddevicenum = parm; @@ -853,7 +853,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) { UINT8 fnum = (cr3>>8)&0xff; - CDROM_LOG(("CD: Set Filter Range (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Set Filter Range\n", cpuexec_describe_context(machine))) filters[fnum].fad = ((cr1 & 0xff)<<16) | cr2; filters[fnum].range = ((cr3 & 0xff)<<16) | cr4; @@ -869,7 +869,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) { UINT8 fnum = (cr3>>8)&0xff; - CDROM_LOG(("CD: Set Filter Subheader conditions (PC=%x) %x => chan %x masks %x fid %x vals %x\n", cpu_get_pc(machine->activecpu), fnum, cr1&0xff, cr2, cr3&0xff, cr4)) + CDROM_LOG(("%s:CD: Set Filter Subheader conditions %x => chan %x masks %x fid %x vals %x\n", cpuexec_describe_context(machine), fnum, cr1&0xff, cr2, cr3&0xff, cr4)) filters[fnum].chan = cr1 & 0xff; filters[fnum].smmask = (cr2>>8)&0xff; @@ -900,7 +900,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) filters[fnum].mode = mode; } - CDROM_LOG(("CD: Set Filter Mode (PC=%x) filt %x mode %x\n", cpu_get_pc(machine->activecpu), fnum, mode)) + CDROM_LOG(("%s:CD: Set Filter Mode filt %x mode %x\n", cpuexec_describe_context(machine), fnum, mode)) hirqreg |= (CMOK|ESEL|DRDY); cr2 = 0x4101; // ctrl/adr in hi byte, track # in low byte cr3 = 0x0100|((cd_curfad>>16)&0xff); @@ -912,7 +912,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) { UINT8 fnum = (cr3>>8)&0xff; - CDROM_LOG(("CD: Set Filter Connection (PC=%x) %x => mode %x parm %04x\n", cpu_get_pc(machine->activecpu), fnum, cr1 & 0xf, cr2)) + CDROM_LOG(("%s:CD: Set Filter Connection %x => mode %x parm %04x\n", cpuexec_describe_context(machine), fnum, cr1 & 0xf, cr2)) // set true condition? if (cr1 & 1) @@ -932,7 +932,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x4800: // Reset Selector - CDROM_LOG(("CD: Reset Selector (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Reset Selector\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|ESEL|DRDY); cr2 = 0x4101; // ctrl/adr in hi byte, track # in low byte cr3 = 0x0100|((cd_curfad>>16)&0xff); @@ -946,7 +946,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) cr3 = 0x1800; cr4 = 200; - CDROM_LOG(("CD: Get Buffer Size = %d (PC=%x)\n", cr2, cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get Buffer Size = %d\n", cr2, cpuexec_describe_context(machine))) hirqreg |= (CMOK|ESEL|DRDY); // DRDY is probably wrong break; @@ -964,7 +964,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) cr4 = partitions[bufnum].numblks; } - CDROM_LOG(("CD: Get Sector Number (PC=%x) (bufno %d) = %d blocks\n", cpu_get_pc(machine->activecpu), bufnum, cr4)) + CDROM_LOG(("%s:CD: Get Sector Number (bufno %d) = %d blocks\n", cpuexec_describe_context(machine), bufnum, cr4)) cr2 = 0; cr3 = 0; @@ -978,7 +978,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) UINT32 sectoffs = cr2; UINT32 numsect = cr4; - CDROM_LOG(("CD: Calculate actual size: buf %x offs %x numsect %x (PC=%x)\n", bufnum, sectoffs, numsect, cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Calculate actual size: buf %x offs %x numsect %x\n", cpuexec_describe_context(machine), bufnum, sectoffs, numsect)) calcsize = 0; if (partitions[bufnum].size != -1) @@ -1003,7 +1003,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x5300: // get actual block size - CDROM_LOG(("CD: Get actual block size (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get actual block size\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|ESEL); cr1 = cd_stat | ((calcsize>>16)&0xff); cr2 = (calcsize & 0xffff); @@ -1012,7 +1012,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x6000: // set sector length - CDROM_LOG(("CD: Set sector length (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Set sector length\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|ESEL|EFLS|SCDQ|DRDY); switch (cr1 & 0xff) @@ -1054,7 +1054,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) UINT32 sectofs = cr2; UINT32 bufnum = cr3>>8; - CDROM_LOG(("CD: Get sector data (PC=%x) (SN %d SO %d BN %d)\n", cpu_get_pc(machine->activecpu), sectnum, sectofs, bufnum)) + CDROM_LOG(("%s:CD: Get sector data (SN %d SO %d BN %d)\n", cpuexec_describe_context(machine), sectnum, sectofs, bufnum)) if (bufnum >= MAX_FILTERS) { @@ -1094,7 +1094,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) UINT32 bufnum = cr3>>8; INT32 i; - CDROM_LOG(("CD: Delete sector data (PC=%x) (SN %d SO %d BN %d)\n", cpu_get_pc(machine->activecpu), sectnum, sectofs, bufnum)) + CDROM_LOG(("%s:CD: Delete sector data (SN %d SO %d BN %d)\n", cpuexec_describe_context(machine), sectnum, sectofs, bufnum)) if (bufnum >= MAX_FILTERS) { @@ -1137,7 +1137,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) UINT32 sectofs = cr2; UINT32 bufnum = cr3>>8; - CDROM_LOG(("CD: Get and delete sector data (PC=%x) (SN %d SO %d BN %d)\n", cpu_get_pc(machine->activecpu), sectnum, sectofs, bufnum)) + CDROM_LOG(("%s:CD: Get and delete sector data (SN %d SO %d BN %d)\n", cpuexec_describe_context(machine), sectnum, sectofs, bufnum)) if (bufnum >= MAX_FILTERS) { @@ -1171,12 +1171,12 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x6700: // get copy error - CDROM_LOG(("CD: Get copy error (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get copy error\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|ESEL|EFLS|SCDQ|DRDY); break; case 0x7000: // change directory - CDROM_LOG(("CD: Change Directory (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Change Directory\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|EFLS); temp = (cr3&0xff)<<16; @@ -1185,7 +1185,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x7100: // Read directory entry - CDROM_LOG(("CD: Read Directory Entry (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Read Directory Entry\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|DRDY); temp = (cr3&0xff)<<16; @@ -1196,7 +1196,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x7200: // Get file system scope - CDROM_LOG(("CD: Get file system scope(PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get file system scope(PC=%x)\n", cpuexec_describe_context(machine))) hirqreg |= (CMOK|DRDY); cr2 = numfiles; // # of files in directory cr3 = 0x0100; // report directory held @@ -1204,7 +1204,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x7300: // Get File Info - CDROM_LOG(("CD: Get File Info (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get File Info\n", cpuexec_describe_context(machine))) cd_stat |= CD_STAT_TRANS; cd_stat &= 0xff00; // clear top byte of return value hirqreg |= (CMOK|DRDY); @@ -1258,7 +1258,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x7400: // Read File - CDROM_LOG(("CD: Read File (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Read File\n", cpuexec_describe_context(machine))) temp = (cr3&0xff)<<16; temp |= cr4; @@ -1289,14 +1289,14 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0x7500: - CDROM_LOG(("CD: Abort File (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Abort File\n", cpuexec_describe_context(machine))) // bios expects "2bc" mask to work against this hirqreg |= (CMOK|EFLS|EHST|ESEL|DCHG|PEND|BFUL|CSCT|DRDY); cd_stat = CD_STAT_PERI|CD_STAT_PAUSE; // force to pause break; case 0xe000: // appears to be copy protection check. needs only to return OK. - CDROM_LOG(("CD: Verify copy protection (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Verify copy protection\n", cpuexec_describe_context(machine))) cd_stat = CD_STAT_PAUSE; cr1 = cd_stat; // necessary to pass cr2 = 0x4; @@ -1306,7 +1306,7 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; case 0xe100: // get disc region - CDROM_LOG(("CD: Get disc region (PC=%x)\n", cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Get disc region\n", cpuexec_describe_context(machine))) cd_stat = CD_STAT_PAUSE; cr1 = cd_stat; // necessary to pass cr2 = 0x4; // (must return this value to pass bios checks) @@ -1314,14 +1314,14 @@ static void cd_writeWord(UINT32 addr, UINT16 data) break; default: - CDROM_LOG(("CD: Unknown command %04x (PC=%x)\n", cr1, cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: Unknown command %04x\n", cr1, cpuexec_describe_context(machine))) hirqreg |= (CMOK); break; } // CDROM_LOG(("ret: %04x %04x %04x %04x %04x\n", hirqreg, cr1, cr2, cr3, cr4)) break; default: - CDROM_LOG(("CD: WW %08x %04x (PC=%x)\n", addr, data, cpu_get_pc(machine->activecpu))) + CDROM_LOG(("%s:CD: WW %08x %04x\n", addr, data, cpuexec_describe_context(machine))) break; } } diff --git a/src/mame/machine/tait8741.c b/src/mame/machine/tait8741.c index e9285eef28d..be1e06bd08b 100644 --- a/src/mame/machine/tait8741.c +++ b/src/mame/machine/tait8741.c @@ -275,7 +275,7 @@ static int I8741_status_r(const address_space *space, int num) { I8741 *st = &taito8741[num]; taito8741_update(space, num); - LOG(("8741-%d ST Read %02x PC=%04x\n",num,st->status,cpu_get_pc(space->machine->activecpu))); + LOG(("%s:8741-%d ST Read %02x\n",cpuexec_describe_context(space->machine),num,st->status)); return st->status; } @@ -285,7 +285,7 @@ static int I8741_data_r(const address_space *space, int num) I8741 *st = &taito8741[num]; int ret = st->toData; st->status &= 0xfe; - LOG(("8741-%d DATA Read %02x PC=%04x\n",num,ret,cpu_get_pc(space->machine->activecpu))); + LOG(("%s:8741-%d DATA Read %02x\n",cpuexec_describe_context(space->machine),num,ret)); /* update chip */ taito8741_update(space, num); @@ -303,7 +303,7 @@ static int I8741_data_r(const address_space *space, int num) static void I8741_data_w(const address_space *space, int num, int data) { I8741 *st = &taito8741[num]; - LOG(("8741-%d DATA Write %02x PC=%04x\n",num,data,cpu_get_pc(space->machine->activecpu))); + LOG(("%s:8741-%d DATA Write %02x\n",cpuexec_describe_context(space->machine),num,data)); st->fromData = data; st->status |= 0x02; /* update chip */ @@ -314,7 +314,7 @@ static void I8741_data_w(const address_space *space, int num, int data) static void I8741_command_w(const address_space *space, int num, int data) { I8741 *st = &taito8741[num]; - LOG(("8741-%d CMD Write %02x PC=%04x\n",num,data,cpu_get_pc(space->machine->activecpu))); + LOG(("%s:8741-%d CMD Write %02x\n",cpuexec_describe_context(space->machine),num,data)); st->fromCmd = data; st->status |= 0x04; /* update chip */ @@ -447,7 +447,7 @@ static void josvolly_8741_w(const address_space *space,int num,int offset,int da if(offset==1) { - LOG(("PC=%04X 8741[%d] CW %02X\n",cpu_get_pc(space->machine->activecpu),num,data)); + LOG(("%s:8741[%d] CW %02X\n",cpuexec_describe_context(space->machine),num,data)); /* read pointer */ mcu->cmd = data; @@ -485,7 +485,7 @@ static void josvolly_8741_w(const address_space *space,int num,int offset,int da else { /* data */ - LOG(("PC=%04X 8741[%d] DW %02X\n",cpu_get_pc(space->machine->activecpu),num,data)); + LOG(("%s:8741[%d] DW %02X\n",cpuexec_describe_context(space->machine),num,data)); mcu->txd = data^0x40; /* parity reverce ? */ mcu->sts |= 0x02; /* TXD busy */ @@ -514,14 +514,14 @@ static INT8 josvolly_8741_r(const address_space *space,int num,int offset) if(mcu->rst) mcu->rxd = (mcu->initReadPort)(space,0); /* port in */ ret = mcu->sts; - LOG(("PC=%04X 8741[%d] SR %02X\n",cpu_get_pc(space->machine->activecpu),num,ret)); + LOG(("%s:8741[%d] SR %02X\n",cpuexec_describe_context(space->machine),num,ret)); } else { /* clear status port */ mcu->sts &= ~0x01; /* RD ready */ ret = mcu->rxd; - LOG(("PC=%04X 8741[%d] DR %02X\n",cpu_get_pc(space->machine->activecpu),num,ret)); + LOG(("%s:8741[%d] DR %02X\n",cpuexec_describe_context(space->machine),num,ret)); mcu->rst = 0; } return ret; diff --git a/src/mame/machine/taitosj.c b/src/mame/machine/taitosj.c index b2a111347ec..e97e08ccc1f 100644 --- a/src/mame/machine/taitosj.c +++ b/src/mame/machine/taitosj.c @@ -219,9 +219,7 @@ WRITE8_HANDLER( taitosj_68705_portB_w ) const address_space *cpu0space = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); LOG(("%04x: 68705 write %02x to address %04x\n",cpu_get_pc(space->cpu),portA_out,address)); - cpu_push_context(cpu0space->cpu); memory_write_byte(cpu0space, address, portA_out); - cpu_pop_context(); /* increase low 8 bits of latched address for burst writes */ address = (address & 0xff00) | ((address + 1) & 0xff); @@ -229,9 +227,7 @@ WRITE8_HANDLER( taitosj_68705_portB_w ) if (~data & 0x20) { const address_space *cpu0space = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(cpu0space->cpu); portA_in = memory_read_byte(cpu0space, address); - cpu_pop_context(); LOG(("%04x: 68705 read %02x from address %04x\n",cpu_get_pc(space->cpu),portA_in,address)); } if (~data & 0x40) diff --git a/src/mame/machine/tatsumi.c b/src/mame/machine/tatsumi.c index e0255ae73b1..7f1b97415bf 100644 --- a/src/mame/machine/tatsumi.c +++ b/src/mame/machine/tatsumi.c @@ -87,7 +87,6 @@ WRITE16_HANDLER( apache3_irq_ack_w ) READ16_HANDLER( apache3_v30_v20_r ) { const address_space *targetspace = cpu_get_address_space(space->machine->cpu[2], ADDRESS_SPACE_PROGRAM); - UINT8 value; /* Each V20 byte maps to a V30 word */ if ((tatsumi_control_word&0xe0)==0xe0) @@ -98,11 +97,7 @@ READ16_HANDLER( apache3_v30_v20_r ) offset+=0x00000; // main ram else logerror("%08x: unmapped read z80 rom %08x\n",cpu_get_pc(space->cpu),offset); - - cpu_push_context(targetspace->cpu); - value = memory_read_byte(targetspace, offset); - cpu_pop_context(); - return value | 0xff00; + return 0xff00 | memory_read_byte(targetspace, offset); } WRITE16_HANDLER( apache3_v30_v20_w ) @@ -115,9 +110,7 @@ WRITE16_HANDLER( apache3_v30_v20_w ) /* Only 8 bits of the V30 data bus are connected - ignore writes to the other half */ if (ACCESSING_BITS_0_7) { - cpu_push_context(targetspace->cpu); memory_write_byte(targetspace, offset, data&0xff); - cpu_pop_context(); } } @@ -158,16 +151,12 @@ WRITE16_HANDLER( apache3_a0000_w ) READ16_HANDLER( roundup_v30_z80_r ) { const address_space *targetspace = cpu_get_address_space(space->machine->cpu[2], ADDRESS_SPACE_PROGRAM); - UINT8 value; /* Each Z80 byte maps to a V30 word */ if (tatsumi_control_word&0x20) offset+=0x8000; /* Upper half */ - cpu_push_context(targetspace->cpu); - value = memory_read_byte(targetspace, offset); - cpu_pop_context(); - return value | 0xff00; + return 0xff00 | memory_read_byte(targetspace, offset); } WRITE16_HANDLER( roundup_v30_z80_w ) @@ -180,9 +169,7 @@ WRITE16_HANDLER( roundup_v30_z80_w ) if (tatsumi_control_word&0x20) offset+=0x8000; /* Upper half of Z80 address space */ - cpu_push_context(targetspace->cpu); memory_write_byte(targetspace, offset, data&0xff); - cpu_pop_context(); } } diff --git a/src/mame/machine/toaplan1.c b/src/mame/machine/toaplan1.c index 24d5e272899..b5beda41cdc 100644 --- a/src/mame/machine/toaplan1.c +++ b/src/mame/machine/toaplan1.c @@ -65,9 +65,7 @@ READ16_HANDLER( demonwld_dsp_r ) UINT16 input_data = 0; switch (main_ram_seg) { case 0xc00000: mainspace = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(mainspace->cpu); input_data = memory_read_word(mainspace, main_ram_seg + dsp_addr_w); - cpu_pop_context(); break; default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); } @@ -84,9 +82,8 @@ WRITE16_HANDLER( demonwld_dsp_w ) switch (main_ram_seg) { case 0xc00000: if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1; mainspace = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(mainspace->cpu); memory_write_word(mainspace, main_ram_seg + dsp_addr_w, data); - cpu_pop_context(); break; + break; default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); } logerror("DSP PC:%04x IO write %04x at %08x (port 1)\n",cpu_get_previouspc(space->cpu),data,main_ram_seg + dsp_addr_w); diff --git a/src/mame/machine/twincobr.c b/src/mame/machine/twincobr.c index dea804716ae..da15b6afc09 100644 --- a/src/mame/machine/twincobr.c +++ b/src/mame/machine/twincobr.c @@ -73,9 +73,8 @@ READ16_HANDLER( twincobr_dsp_r ) case 0x30000: case 0x40000: case 0x50000: mainspace = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(mainspace->cpu); input_data = memory_read_word(mainspace, main_ram_seg + dsp_addr_w); - cpu_pop_context(); break; + break; default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break; } LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",cpu_get_previouspc(space->cpu),input_data,main_ram_seg + dsp_addr_w)); @@ -92,9 +91,8 @@ WRITE16_HANDLER( twincobr_dsp_w ) case 0x30000: if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1; case 0x40000: case 0x50000: mainspace = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(mainspace->cpu); memory_write_word(mainspace, main_ram_seg + dsp_addr_w, data); - cpu_pop_context(); break; + break; default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break; } LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",cpu_get_previouspc(space->cpu),data,main_ram_seg + dsp_addr_w)); @@ -125,10 +123,9 @@ READ16_HANDLER( wardner_dsp_r ) case 0x7000: case 0x8000: case 0xa000: mainspace = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(mainspace->cpu); input_data = memory_read_byte(mainspace, main_ram_seg + (dsp_addr_w + 0)) | (memory_read_byte(mainspace, main_ram_seg + (dsp_addr_w + 1)) << 8); - cpu_pop_context(); break; + break; default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break; } LOG(("DSP PC:%04x IO read %04x at %08x (port 1)\n",cpu_get_previouspc(space->cpu),input_data,main_ram_seg + dsp_addr_w)); @@ -145,10 +142,9 @@ WRITE16_HANDLER( wardner_dsp_w ) case 0x7000: if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1; case 0x8000: case 0xa000: mainspace = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM); - cpu_push_context(mainspace->cpu); memory_write_byte(mainspace, main_ram_seg + (dsp_addr_w + 0), (data & 0xff)); memory_write_byte(mainspace, main_ram_seg + (dsp_addr_w + 1), ((data >> 8) & 0xff)); - cpu_pop_context(); break; + break; default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); break; } LOG(("DSP PC:%04x IO write %04x at %08x (port 1)\n",cpu_get_previouspc(space->cpu),data,main_ram_seg + dsp_addr_w)); @@ -224,7 +220,7 @@ static STATE_POSTLOAD( twincobr_restore_dsp ) static void toaplan0_control_w(running_machine *machine, int offset, int data) { - LOG(("CPU0:%08x Writing %08x to %08x.\n",cpu_get_pc(machine->activecpu),data,toaplan_port_type[toaplan_main_cpu] - offset)); + LOG(("%s:Writing %08x to %08x.\n",cpuexec_describe_context(machine),data,toaplan_port_type[toaplan_main_cpu] - offset)); if (toaplan_main_cpu == 1) { if (data == 0x0c) { data = 0x1c; wardner_sprite_hack=0; } /* Z80 ? */ @@ -278,7 +274,7 @@ WRITE16_HANDLER( twincobr_sharedram_w ) static void toaplan0_coin_dsp_w(const address_space *space, int offset, int data) { if (data > 1) - LOG(("CPU0:%08x Writing %08x to %08x.\n",cpu_get_pc(space->machine->activecpu),data,toaplan_port_type[toaplan_main_cpu] - offset)); + LOG(("%s:Writing %08x to %08x.\n",cpuexec_describe_context(space->machine),data,toaplan_port_type[toaplan_main_cpu] - offset)); switch (data) { case 0x08: coin_counter_w(0,0); break; case 0x09: coin_counter_w(0,1); break; diff --git a/src/mame/machine/tx1.c b/src/mame/machine/tx1.c index f6547761b84..287afaa61ee 100644 --- a/src/mame/machine/tx1.c +++ b/src/mame/machine/tx1.c @@ -195,7 +195,7 @@ static void sn_divide(void) if ( SN74S516.X == 0 ) { - mame_printf_debug("SN74S516 tried to divide by zero (PC=%x)\n", cpu_get_pc(Machine->activecpu)); + mame_printf_debug("%s:SN74S516 tried to divide by zero\n", cpuexec_describe_context(Machine)); SN74S516.ZW.Z = 0xffff; SN74S516.ZW.W = 0xffff; SN74S516.ZWfl = 0; @@ -337,7 +337,7 @@ static void kick_sn74s516(UINT16 *data, const int ins) if (SN74S516.code == 0x6666) { CLEAR_SEQUENCE; - mame_printf_debug("Code 6666: PROMADDR:%x PC:%x\n", math.promaddr, cpu_get_pc(Machine->activecpu)); + mame_printf_debug("%s:Code 6666: PROMADDR:%x\n", cpuexec_describe_context(Machine), math.promaddr); } UPDATE_SEQUENCE; @@ -424,7 +424,7 @@ static void kick_sn74s516(UINT16 *data, const int ins) } math.dbgaddr = math.promaddr; - math.dbgpc = cpu_get_previouspc(Machine->activecpu); + math.dbgpc = cpu_get_previouspc(Machine->cpu[1]); } diff --git a/src/mame/machine/wrally.c b/src/mame/machine/wrally.c index 0575643ffbc..e06333a72d6 100644 --- a/src/mame/machine/wrally.c +++ b/src/mame/machine/wrally.c @@ -20,7 +20,7 @@ WRITE16_HANDLER( wrally_vram_w ) { - data = gaelco_decrypt(space->machine, offset, data, 0x1f, 0x522a); + data = gaelco_decrypt(space, offset, data, 0x1f, 0x522a); COMBINE_DATA(&wrally_videoram[offset]); tilemap_mark_tile_dirty(wrally_pant[(offset & 0x1fff) >> 12], ((offset << 1) & 0x1fff) >> 2); diff --git a/src/mame/machine/zs01.c b/src/mame/machine/zs01.c index 21c6801b972..6ef3c4294b0 100644 --- a/src/mame/machine/zs01.c +++ b/src/mame/machine/zs01.c @@ -22,14 +22,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/mame/video/artmagic.c b/src/mame/video/artmagic.c index 6838ecd01a1..ac950fa3ecf 100644 --- a/src/mame/video/artmagic.c +++ b/src/mame/video/artmagic.c @@ -112,8 +112,8 @@ static void execute_blit(running_machine *machine) static int hit_index; static FILE *f; - logerror("%08X:Blit from %06X to (%d,%d) %dx%d -- %04X %04X %04X %04X %04X %04X %04X %04X\n", - cpu_get_pc(machine->activecpu), offset, x, y, w, h, + logerror("%s:Blit from %06X to (%d,%d) %dx%d -- %04X %04X %04X %04X %04X %04X %04X %04X\n", + cpuexec_describe_context(machine), offset, x, y, w, h, blitter_data[0], blitter_data[1], blitter_data[2], blitter_data[3], blitter_data[4], blitter_data[5], @@ -130,8 +130,8 @@ static void execute_blit(running_machine *machine) hit_list[hit_index++] = offset; fprintf(f, "----------------------\n" - "%08X:Blit from %06X to (%d,%d) %dx%d -- %04X %04X %04X %04X %04X %04X %04X %04X\n", - cpu_get_pc(machine->activecpu), offset, x, y, w, h, + "%s:Blit from %06X to (%d,%d) %dx%d -- %04X %04X %04X %04X %04X %04X %04X %04X\n", + cpuexec_describe_context(machine), offset, x, y, w, h, blitter_data[0], blitter_data[1], blitter_data[2], blitter_data[3], blitter_data[4], blitter_data[5], diff --git a/src/mame/video/btoads.c b/src/mame/video/btoads.c index 577af00a67a..8451efddcfa 100644 --- a/src/mame/video/btoads.c +++ b/src/mame/video/btoads.c @@ -308,7 +308,7 @@ void btoads_to_shiftreg(UINT32 address, UINT16 *shiftreg) } else - logerror("%08X:btoads_to_shiftreg(%08X)\n", cpu_get_pc(Machine->activecpu), address); + logerror("%s:btoads_to_shiftreg(%08X)\n", cpuexec_describe_context(Machine), address); } @@ -333,7 +333,7 @@ void btoads_from_shiftreg(UINT32 address, UINT16 *shiftreg) render_sprite_row(shiftreg, address); else - logerror("%08X:btoads_from_shiftreg(%08X)\n", cpu_get_pc(Machine->activecpu), address); + logerror("%s:btoads_from_shiftreg(%08X)\n", cpuexec_describe_context(Machine), address); } diff --git a/src/mame/video/cidelsa.c b/src/mame/video/cidelsa.c index 899fdea8af1..aac54570883 100644 --- a/src/mame/video/cidelsa.c +++ b/src/mame/video/cidelsa.c @@ -141,7 +141,7 @@ static CDP1869_ON_PRD_CHANGED(cidelsa_prd_changed) // PRD is inverted - cputag_set_input_line(device->machine, "main", INPUT_LINE_IRQ0, !prd); + cputag_set_input_line(device->machine, MAIN_CPU_TAG, INPUT_LINE_IRQ0, !prd); state->cdp1869_prd = !prd; } @@ -157,6 +157,7 @@ static CDP1869_ON_PRD_CHANGED(draco_prd_changed) static CDP1869_INTERFACE( destryer_cdp1869_intf ) { SCREEN_TAG, + MAIN_CPU_TAG, DESTRYER_CHR2, 0, CDP1869_PAL, @@ -171,6 +172,7 @@ static CDP1869_INTERFACE( destryer_cdp1869_intf ) static CDP1869_INTERFACE( altair_cdp1869_intf ) { SCREEN_TAG, + MAIN_CPU_TAG, ALTAIR_CHR2, 0, CDP1869_PAL, @@ -185,6 +187,7 @@ static CDP1869_INTERFACE( altair_cdp1869_intf ) static CDP1869_INTERFACE( draco_cdp1869_intf ) { SCREEN_TAG, + MAIN_CPU_TAG, DRACO_CHR2, 0, CDP1869_PAL, diff --git a/src/mame/video/cinemat.c b/src/mame/video/cinemat.c index 63eb68a932e..4e9e40e0118 100644 --- a/src/mame/video/cinemat.c +++ b/src/mame/video/cinemat.c @@ -225,9 +225,7 @@ VIDEO_UPDATE( cinemat ) VIDEO_UPDATE_CALL(vector); vector_clear_list(); - cpu_push_context(screen->machine->cpu[0]); ccpu_wdt_timer_trigger(screen->machine->cpu[0]); - cpu_pop_context(); return 0; } diff --git a/src/mame/video/dcheese.c b/src/mame/video/dcheese.c index c6e8c6e4b80..6002b67d406 100644 --- a/src/mame/video/dcheese.c +++ b/src/mame/video/dcheese.c @@ -222,7 +222,7 @@ static void do_blit(running_machine *machine) if (blitter_xparam[8] != 0 || blitter_xparam[9] != 0 || blitter_xparam[10] != 0 || blitter_xparam[11] != 0 || blitter_yparam[8] != 0 || blitter_yparam[9] != 0 || blitter_yparam[10] != 0 || blitter_yparam[11] != 0) { - logerror("%06X:blit! (%04X)\n", cpu_get_pc(machine->activecpu), blitter_color[0]); + logerror("%s:blit! (%04X)\n", cpuexec_describe_context(machine), blitter_color[0]); logerror(" %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X - %04X %04X %04X %04X\n", blitter_xparam[0], blitter_xparam[1], blitter_xparam[2], blitter_xparam[3], blitter_xparam[4], blitter_xparam[5], blitter_xparam[6], blitter_xparam[7], diff --git a/src/mame/video/genesis.c b/src/mame/video/genesis.c index 19fe79d61d8..c67f24a12a2 100644 --- a/src/mame/video/genesis.c +++ b/src/mame/video/genesis.c @@ -437,7 +437,7 @@ static int vdp_data_r(running_machine *machine) break; default: /* Illegal read attempt */ - logerror("%06x: VDP illegal read type %02x\n", cpu_get_previouspc(machine->activecpu), vdp_code); + logerror("%s: VDP illegal read type %02x\n", cpuexec_describe_context(machine), vdp_code); read = 0x00; break; } @@ -498,7 +498,7 @@ static void vdp_data_w(running_machine *machine, int data) break; default: /* Illegal write attempt */ - logerror("PC:%06x: VDP illegal write type %02x data %04x\n", cpu_get_previouspc(machine->activecpu), vdp_code, data); + logerror("%s: VDP illegal write type %02x data %04x\n", cpuexec_describe_context(machine), vdp_code, data); break; } diff --git a/src/mame/video/hd63484.c b/src/mame/video/hd63484.c index da5f3f798bb..16493d9b6f2 100644 --- a/src/mame/video/hd63484.c +++ b/src/mame/video/hd63484.c @@ -973,7 +973,7 @@ static void HD63484_command_w(running_machine *machine, UINT16 cmd) { int i; - logerror("PC %05x: HD63484 command %s (%04x) ",cpu_get_pc(machine->activecpu),instruction_name[fifo[0]>>10],fifo[0]); + logerror("%s: HD63484 command %s (%04x) ",cpuexec_describe_context(machine),instruction_name[fifo[0]>>10],fifo[0]); for (i = 1;i < fifo_counter;i++) logerror("%04x ",fifo[i]); logerror("\n"); diff --git a/src/mame/video/jagblit.c b/src/mame/video/jagblit.c index 3c91e43f70d..64b0c81cea9 100644 --- a/src/mame/video/jagblit.c +++ b/src/mame/video/jagblit.c @@ -195,7 +195,7 @@ static void FUNCNAME(UINT32 command, UINT32 a1flags, UINT32 a2flags) { if (LOG_BAD_BLITS) { - logerror("%08X:Blit!\n", cpu_get_previouspc(Machine->activecpu)); + logerror("%s:Blit!\n", cpuexec_describe_context(Machine)); logerror(" a1_base = %08X\n", a1_base); logerror(" a2_base = %08X\n", a2_base); } @@ -275,7 +275,7 @@ static void FUNCNAME(UINT32 command, UINT32 a1flags, UINT32 a2flags) if (LOG_BLITS) { - logerror("%08X:Blit!\n", cpu_get_previouspc(Machine->activecpu)); + logerror("%s:Blit!\n", cpuexec_describe_context(Machine)); logerror(" a1_base = %08X\n", a1_base); logerror(" a1_pitch = %d\n", a1_pitch); logerror(" a1_psize = %d\n", 1 << ((A1FIXED >> 3) & 7)); diff --git a/src/mame/video/konamiic.c b/src/mame/video/konamiic.c index a42e778490a..a0f141c7ed5 100644 --- a/src/mame/video/konamiic.c +++ b/src/mame/video/konamiic.c @@ -2589,7 +2589,7 @@ static int K051960_fetchromdata(running_machine *machine, int byte) addr = (code << 7) | (off1 << 2) | byte; addr &= memory_region_length(machine, K051960_memory_region)-1; -// popmessage("%04x: addr %06x",cpu_get_pc(machine->activecpu),addr); +// popmessage("%s: addr %06x",cpuexec_describe_context(machine),addr); return memory_region(machine, K051960_memory_region)[addr]; } @@ -3135,7 +3135,7 @@ static UINT8 K053244_chip_r (running_machine *machine, int chip, int offset) | ((offset & 3) ^ 1); addr &= memory_region_length(machine, K053245_memory_region[chip])-1; -// popmessage("%04x: offset %02x addr %06x",cpu_get_pc(machine->activecpu),offset&3,addr); +// popmessage("%s: offset %02x addr %06x",cpuexec_describe_context(machine),offset&3,addr); return memory_region(machine, K053245_memory_region[chip])[addr]; } @@ -3146,7 +3146,7 @@ static UINT8 K053244_chip_r (running_machine *machine, int chip, int offset) } else { -//logerror("%04x: read from unknown 053244 address %x\n",cpu_get_pc(machine->activecpu),offset); +//logerror("%s: read from unknown 053244 address %x\n",cpuexec_describe_context(machine),offset); return 0; } } @@ -3166,7 +3166,7 @@ static void K053244_chip_w(int chip, int offset, int data) // popmessage("053244 reg 05 = %02x",data); /* bit 2 = unknown, Parodius uses it */ /* bit 5 = unknown, Rollergames uses it */ -// logerror("%04x: write %02x to 053244 address 5\n",cpu_get_pc(machine->activecpu),data); +// logerror("%s: write %02x to 053244 address 5\n",cpuexec_describe_context(machine),data); break; } case 0x06: @@ -4798,13 +4798,13 @@ static int K051316_rom_r(running_machine *machine, int chip, int offset) if (K051316_bpp[chip] <= 4) addr /= 2; addr &= memory_region_length(machine, K051316_memory_region[chip])-1; -// popmessage("%04x: offset %04x addr %04x",cpu_get_pc(machine->activecpu),offset,addr); +// popmessage("%s: offset %04x addr %04x",cpuexec_describe_context(machine),offset,addr); return memory_region(machine, K051316_memory_region[chip])[addr]; } else { -//logerror("%04x: read 051316 ROM offset %04x but reg 0x0c bit 0 not clear\n",cpu_get_pc(machine->activecpu),offset); +//logerror("%s: read 051316 ROM offset %04x but reg 0x0c bit 0 not clear\n",cpuexec_describe_context(machine),offset); return 0; } } @@ -4829,7 +4829,7 @@ READ8_HANDLER( K051316_rom_2_r ) static void K051316_ctrl_w(int chip,int offset,int data) { K051316_ctrlram[chip][offset] = data; -//if (offset >= 0x0c) logerror("%04x: write %02x to 051316 reg %x\n",cpu_get_pc(machine->activecpu),data,offset); +//if (offset >= 0x0c) logerror("%s: write %02x to 051316 reg %x\n",cpuexec_describe_context(machine),data,offset); } WRITE8_HANDLER( K051316_ctrl_0_w ) diff --git a/src/mame/video/leland.c b/src/mame/video/leland.c index fe99d3355bf..3b06ef32f27 100644 --- a/src/mame/video/leland.c +++ b/src/mame/video/leland.c @@ -208,15 +208,15 @@ static int leland_vram_port_r(const address_space *space, int offset, int num) break; default: - logerror("CPU %s %04x Warning: Unknown video port %02x read (address=%04x)\n", - space->cpu->tag, cpu_get_pc(space->machine->activecpu), offset, addr); + logerror("%s: Warning: Unknown video port %02x read (address=%04x)\n", + cpuexec_describe_context(space->machine), offset, addr); ret = 0; break; } state->addr = addr; if (LOG_COMM && addr >= 0xf000) - logerror("%04X:%s comm read %04X = %02X\n", cpu_get_previouspc(space->machine->activecpu), num ? "slave" : "master", addr, ret); + logerror("%s:%s comm read %04X = %02X\n", cpuexec_describe_context(space->machine), num ? "slave" : "master", addr, ret); return ret; } @@ -243,7 +243,7 @@ static void leland_vram_port_w(const address_space *space, int offset, int data, video_screen_update_partial(space->machine->primary_screen, scanline - 1); if (LOG_COMM && addr >= 0xf000) - logerror("%04X:%s comm write %04X = %02X\n", cpu_get_previouspc(space->machine->activecpu), num ? "slave" : "master", addr, data); + logerror("%s:%s comm write %04X = %02X\n", cpuexec_describe_context(space->machine), num ? "slave" : "master", addr, data); /* based on the low 3 bits of the offset, update the destination */ switch (offset & 7) @@ -294,8 +294,8 @@ static void leland_vram_port_w(const address_space *space, int offset, int data, break; default: - logerror("CPU %s %04x Warning: Unknown video port write (address=%04x value=%02x)\n", - space->cpu->tag, cpu_get_pc(space->machine->activecpu), offset, addr); + logerror("%s:Warning: Unknown video port write (address=%04x value=%02x)\n", + cpuexec_describe_context(space->machine), offset, addr); break; } diff --git a/src/mame/video/neogeo.c b/src/mame/video/neogeo.c index dd38efa79a4..772f762e102 100644 --- a/src/mame/video/neogeo.c +++ b/src/mame/video/neogeo.c @@ -783,7 +783,7 @@ static UINT16 get_video_control(running_machine *machine) ret = (v_counter << 7) | (neogeo_get_auto_animation_counter() & 0x0007); - if (VERBOSE) logerror("PC %06x: video_control read (%04x)\n", cpu_get_pc(machine->activecpu), ret); + if (VERBOSE) logerror("%s: video_control read (%04x)\n", cpuexec_describe_context(machine), ret); return ret; } @@ -792,7 +792,7 @@ static UINT16 get_video_control(running_machine *machine) static void set_video_control(running_machine *machine, UINT16 data) { /* this does much more than this, but I'm not sure exactly what */ - if (VERBOSE) logerror("%06x: video control write %04x\n", cpu_get_pc(machine->activecpu), data); + if (VERBOSE) logerror("%s: video control write %04x\n", cpuexec_describe_context(machine), data); set_auto_animation_speed(data >> 8); set_auto_animation_disabled(data & 0x0008); diff --git a/src/mame/video/phoenix.c b/src/mame/video/phoenix.c index 50552b4790a..b77bc337cce 100644 --- a/src/mame/video/phoenix.c +++ b/src/mame/video/phoenix.c @@ -334,7 +334,7 @@ CUSTOM_INPUT( pleiads_protection_r ) return 1; break; default: - logerror("Unknown protection question %02X at %04X\n", pleiads_protection_question, safe_cpu_get_pc(field->port->machine->activecpu)); + logerror("%s:Unknown protection question %02X\n", cpuexec_describe_context(field->port->machine), pleiads_protection_question); return 0; } } diff --git a/src/mame/video/ppu2c0x.c b/src/mame/video/ppu2c0x.c index 87764628ada..bae3f807fb6 100644 --- a/src/mame/video/ppu2c0x.c +++ b/src/mame/video/ppu2c0x.c @@ -1333,7 +1333,7 @@ void ppu2c0x_spriteram_dma (const address_space *space, int num, const UINT8 pag } // should last 513 CPU cycles. - cpu_adjust_icount(chips[num].machine->activecpu, -513); + cpu_adjust_icount(space->cpu, -513); // ????TODO : need to account for PPU rendering - this is roughly 4.5 scanlines eaten up. // Because the DMA is only useful during vblank, this may not be strictly necessary since diff --git a/src/mame/video/psx.c b/src/mame/video/psx.c index 34db3c948f3..d3b457ded9e 100644 --- a/src/mame/video/psx.c +++ b/src/mame/video/psx.c @@ -34,14 +34,7 @@ INLINE void ATTR_PRINTF(2,3) verboselog( int n_level, const char *s_fmt, ... ) va_start( v, s_fmt ); vsprintf( buf, s_fmt, v ); va_end( v ); - if( Machine->activecpu != NULL ) - { - logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); - } - else - { - logerror( "(timer) : %s", buf ); - } + logerror( "%s: %s", cpuexec_describe_context(Machine), buf ); } } diff --git a/src/mame/video/tia.c b/src/mame/video/tia.c index 268e8c2af70..28848fabb60 100644 --- a/src/mame/video/tia.c +++ b/src/mame/video/tia.c @@ -506,15 +506,15 @@ static int collision_check(UINT8* p1, UINT8* p2, int x1, int x2) } -INLINE int current_x(running_machine *machine) +INLINE int current_x(const address_space *space) { - return 3 * ((cpu_get_total_cycles(machine->activecpu) - frame_cycles) % 76) - 68; + return 3 * ((cpu_get_total_cycles(space->cpu) - frame_cycles) % 76) - 68; } -INLINE int current_y(running_machine *machine) +INLINE int current_y(const address_space *space) { - return (cpu_get_total_cycles(machine->activecpu) - frame_cycles) / 76; + return (cpu_get_total_cycles(space->cpu) - frame_cycles) / 76; } @@ -868,7 +868,7 @@ static WRITE8_HANDLER( VSYNC_w ) { if (!(VSYNC & 2)) { - int curr_y = current_y(space->machine); + int curr_y = current_y(space); if ( curr_y > 5 ) update_bitmap( @@ -882,7 +882,7 @@ static WRITE8_HANDLER( VSYNC_w ) prev_y = 0; prev_x = 0; - frame_cycles += 76 * current_y(space->machine); + frame_cycles += 76 * current_y(space); } } @@ -906,7 +906,7 @@ static WRITE8_HANDLER( VBLANK_w ) static WRITE8_HANDLER( CTRLPF_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); CTRLPF = data; if ( curr_x < 80 ) { @@ -916,7 +916,7 @@ static WRITE8_HANDLER( CTRLPF_w ) static WRITE8_HANDLER( HMP0_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); data &= 0xF0; @@ -948,7 +948,7 @@ static WRITE8_HANDLER( HMP0_w ) static WRITE8_HANDLER( HMP1_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); data &= 0xF0; @@ -980,7 +980,7 @@ static WRITE8_HANDLER( HMP1_w ) static WRITE8_HANDLER( HMM0_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); data &= 0xF0; @@ -1011,7 +1011,7 @@ static WRITE8_HANDLER( HMM0_w ) static WRITE8_HANDLER( HMM1_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); data &= 0xF0; @@ -1042,7 +1042,7 @@ static WRITE8_HANDLER( HMM1_w ) static WRITE8_HANDLER( HMBL_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); data &= 0xF0; @@ -1073,8 +1073,8 @@ static WRITE8_HANDLER( HMBL_w ) static WRITE8_HANDLER( HMOVE_w ) { - int curr_x = current_x(space->machine); - int curr_y = current_y(space->machine); + int curr_x = current_x(space); + int curr_y = current_y(space); HMOVE_started = curr_x; @@ -1204,7 +1204,7 @@ static WRITE8_HANDLER( RSYNC_w ) static WRITE8_HANDLER( NUSIZ0_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); /* Check if relevant bits have changed */ if ( ( data & 7 ) != ( NUSIZ0 & 7 ) ) { @@ -1219,7 +1219,7 @@ static WRITE8_HANDLER( NUSIZ0_w ) /* This copy has started drawing */ if ( p0gfx.size[i] == 1 && nusiz[data & 7][1] > 1 ) { int delay = 1 + ( ( p0gfx.start_pixel[i] + ( curr_x - p0gfx.start_drawing[i] ) ) & 1 ); - update_bitmap( curr_x + delay, current_y(space->machine) ); + update_bitmap( curr_x + delay, current_y(space) ); p0gfx.start_pixel[i] += ( curr_x + delay - p0gfx.start_drawing[i] ); if ( p0gfx.start_pixel[i] > 8 ) p0gfx.start_pixel[i] = 8; @@ -1229,7 +1229,7 @@ static WRITE8_HANDLER( NUSIZ0_w ) if ( delay ) { delay = p0gfx.size[i] - delay; } - update_bitmap( curr_x + delay, current_y(space->machine) ); + update_bitmap( curr_x + delay, current_y(space) ); p0gfx.start_pixel[i] += ( curr_x - p0gfx.start_drawing[i] ) / p0gfx.size[i]; p0gfx.start_drawing[i] = curr_x + delay; } else { @@ -1282,7 +1282,7 @@ static WRITE8_HANDLER( NUSIZ0_w ) static WRITE8_HANDLER( NUSIZ1_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); /* Check if relevant bits have changed */ if ( ( data & 7 ) != ( NUSIZ1 & 7 ) ) { @@ -1297,7 +1297,7 @@ static WRITE8_HANDLER( NUSIZ1_w ) /* This copy has started drawing */ if ( p1gfx.size[i] == 1 && nusiz[data & 7][1] > 1 ) { int delay = 1 + ( ( p0gfx.start_pixel[i] + ( curr_x - p0gfx.start_drawing[i] ) ) & 1 ); - update_bitmap( curr_x + delay, current_y(space->machine) ); + update_bitmap( curr_x + delay, current_y(space) ); p1gfx.start_pixel[i] += ( curr_x + delay - p1gfx.start_drawing[i] ); if ( p1gfx.start_pixel[i] > 8 ) p1gfx.start_pixel[i] = 8; @@ -1307,7 +1307,7 @@ static WRITE8_HANDLER( NUSIZ1_w ) if ( delay ) { delay = p1gfx.size[i] - delay; } - update_bitmap( curr_x + delay, current_y(space->machine) ); + update_bitmap( curr_x + delay, current_y(space) ); p1gfx.start_pixel[i] += ( curr_x - p1gfx.start_drawing[i] ) / p1gfx.size[i]; p1gfx.start_drawing[i] = curr_x + delay; } else { @@ -1405,7 +1405,7 @@ static WRITE8_HANDLER( CXCLR_w ) static WRITE8_HANDLER( RESP0_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); int new_horzP0; /* Check if HMOVE is activated during this line */ @@ -1465,7 +1465,7 @@ static WRITE8_HANDLER( RESP0_w ) static WRITE8_HANDLER( RESP1_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); int new_horzP1; /* Check if HMOVE is activated during this line */ @@ -1525,7 +1525,7 @@ static WRITE8_HANDLER( RESP1_w ) static WRITE8_HANDLER( RESM0_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); int new_horzM0; /* Check if HMOVE is activated during this line */ @@ -1547,7 +1547,7 @@ static WRITE8_HANDLER( RESM0_w ) static WRITE8_HANDLER( RESM1_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); int new_horzM1; /* Check if HMOVE is activated during this line */ @@ -1569,7 +1569,7 @@ static WRITE8_HANDLER( RESM1_w ) static WRITE8_HANDLER( RESBL_w ) { - int curr_x = current_x(space->machine); + int curr_x = current_x(space); /* Check if HMOVE is activated during this line */ if ( HMOVE_started != HMOVE_INACTIVE ) { @@ -1679,7 +1679,7 @@ READ8_HANDLER( tia_r ) if (!(offset & 0x8)) { - update_bitmap(current_x(space->machine), current_y(space->machine)); + update_bitmap(current_x(space), current_y(space)); } switch (offset & 0xF) @@ -1776,8 +1776,8 @@ WRITE8_HANDLER( tia_w ) 0, // HMCLR 0, // CXCLR }; - int curr_x = current_x(space->machine); - int curr_y = current_y(space->machine); + int curr_x = current_x(space); + int curr_y = current_y(space); offset &= 0x3F; diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c index e49dac33149..4b330f05e4c 100644 --- a/src/mame/video/ygv608.c +++ b/src/mame/video/ygv608.c @@ -1431,8 +1431,8 @@ static void SetPostShortcuts( int reg ) UINT8 yTile = ygv608.regs.s.r0 & r0_pny; if (yTile >= ygv608.page_y) - logerror ("setting pny(%d) >= page_y(%d) @ $%X\n", - yTile, ygv608.page_y, cpu_get_pc(Machine->activecpu) ); + logerror ("%s:setting pny(%d) >= page_y(%d)\n", cpuexec_describe_context(Machine), + yTile, ygv608.page_y ); yTile &= (ygv608.page_y - 1); ygv608.regs.s.r0 &= ~r0_pny; ygv608.regs.s.r0 |= yTile; @@ -1444,8 +1444,8 @@ static void SetPostShortcuts( int reg ) UINT8 xTile = ygv608.regs.s.r1 & r1_pnx; if (xTile >= ygv608.page_x) - logerror ("setting pnx(%d) >= page_x(%d) @ $%X\n", - xTile, ygv608.page_x, cpu_get_pc(Machine->activecpu) ); + logerror ("%s:setting pnx(%d) >= page_x(%d)\n", cpuexec_describe_context(Machine), + xTile, ygv608.page_x ); xTile &= (ygv608.page_x - 1); ygv608.regs.s.r1 &= ~r1_pnx; ygv608.regs.s.r1 |= xTile;