From 0142411b9834bd4dd7f8b00e1b9dcc4f4b73f7a1 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 27 Nov 2008 05:22:51 +0000 Subject: [PATCH] Move cpunum_get_active() removal. --- src/emu/cpu/h83002/h8periph.c | 12 +++--- src/emu/cpu/h83002/h8priv.h | 1 - src/emu/cpu/z180/z180dd.c | 4 +- src/emu/cpu/z180/z180ed.c | 4 +- src/emu/cpu/z180/z180op.c | 10 ++--- src/emu/cpu/z180/z180ops.h | 2 +- src/emu/cpu/z8000/z8000.c | 14 +++---- src/emu/cpu/z8000/z8000ops.c | 30 +++++++-------- src/emu/debug/debugvw.c | 11 +++--- src/emu/machine/6821pia.c | 72 +++++++++++++++++------------------ src/emu/machine/adc083x.c | 2 +- src/emu/machine/ds2401.c | 2 +- src/emu/machine/generic.c | 8 +--- src/emu/machine/i2cmem.c | 2 +- src/emu/machine/pci.c | 8 ++-- src/emu/machine/x76f041.c | 2 +- src/emu/machine/x76f100.c | 2 +- src/emu/mame.c | 4 +- src/mame/drivers/btime.c | 12 +++--- src/mame/drivers/ddragon.c | 2 +- src/mame/drivers/dorachan.c | 2 +- src/mame/drivers/galpani3.c | 8 ++-- src/mame/drivers/jchan.c | 2 +- src/mame/drivers/konamim2.c | 4 +- src/mame/drivers/ksys573.c | 2 +- src/mame/drivers/namcos11.c | 2 +- src/mame/drivers/namcos12.c | 2 +- src/mame/drivers/namcos21.c | 6 +-- src/mame/drivers/neogeo.c | 2 +- src/mame/drivers/polepos.c | 6 +-- src/mame/drivers/route16.c | 2 +- 31 files changed, 116 insertions(+), 126 deletions(-) diff --git a/src/emu/cpu/h83002/h8periph.c b/src/emu/cpu/h83002/h8periph.c index 33d0fd3da3f..ea46628db30 100644 --- a/src/emu/cpu/h83002/h8periph.c +++ b/src/emu/cpu/h83002/h8periph.c @@ -97,7 +97,7 @@ static void h8_itu_refresh_timer(h83xx_state *h8, int tnum) ourTCR = h8->per_regs[tcr[tnum]]; ourTVAL = h8->h8TCNT[tnum]; - period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device->machine->cpu[h8->cpu_number])), tscales[ourTCR & 3] * (65536 - ourTVAL)); + period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device)), tscales[ourTCR & 3] * (65536 - ourTVAL)); if (ourTCR & 4) { @@ -116,7 +116,7 @@ static void h8_itu_sync_timers(h83xx_state *h8, int tnum) ourTCR = h8->per_regs[tcr[tnum]]; // get the time per unit - cycle_time = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device->machine->cpu[h8->cpu_number])), tscales[ourTCR & 3]); + cycle_time = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device)), tscales[ourTCR & 3]); cur = timer_timeelapsed(h8->timer[tnum]); ratio = attotime_to_double(cur) / attotime_to_double(cycle_time); @@ -454,7 +454,7 @@ static void h8_3007_itu_refresh_timer(h83xx_state *h8, int tnum) attotime period; int ourTCR = h8->per_regs[0x68+(tnum*8)]; - period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device->machine->cpu[h8->cpu_number])), tscales[ourTCR & 3]); + period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(h8->device)), tscales[ourTCR & 3]); if (ourTCR & 4) { @@ -746,7 +746,7 @@ UINT8 h8_3007_register1_read8(h83xx_state *h8, UINT32 address) case 0xfee018: return h8->per_regs[0xF8]; // IPRA } - logerror("cpu #%d (PC=%08X): unmapped I/O(1) byte read from %08X\n",cpunum_get_active(),cpu_get_pc(h8->device->machine->activecpu),address); + logerror("cpu '%s' (PC=%08X): unmapped I/O(1) byte read from %08X\n",h8->device->tag,cpu_get_pc(h8->device->machine->activecpu),address); return 0; } @@ -758,7 +758,7 @@ void h8_3007_register1_write8(h83xx_state *h8, UINT32 address, UINT8 val) case 0xfee016: h8_ISR_w(h8, val); return; // ISR case 0xfee018: h8->per_regs[0xF8] = val; return; // IPRA } - logerror("cpu #%d (PC=%08X): unmapped I/O(1) byte write to %08X = %02X\n",cpunum_get_active(),cpu_get_pc(h8->device->machine->activecpu),address,val); + logerror("cpu '%s' (PC=%08X): unmapped I/O(1) byte write to %08X = %02X\n",h8->device->tag,cpu_get_pc(h8->device->machine->activecpu),address,val); } void h8_3007_itu_init(h83xx_state *h8) @@ -779,8 +779,6 @@ void h8_itu_init(h83xx_state *h8) h8->timer[4] = timer_alloc(h8->device->machine, h8itu_timer_4_cb, h8); h8_itu_reset(h8); - - h8->cpu_number = cpunum_get_active(); } void h8_itu_reset(h83xx_state *h8) diff --git a/src/emu/cpu/h83002/h8priv.h b/src/emu/cpu/h83002/h8priv.h index ff112885cb6..3d8f96f36be 100644 --- a/src/emu/cpu/h83002/h8priv.h +++ b/src/emu/cpu/h83002/h8priv.h @@ -39,7 +39,6 @@ struct _h83xx_state emu_timer *timer[5]; - int cpu_number; int mode_8bit; }; extern h83xx_state h8; diff --git a/src/emu/cpu/z180/z180dd.c b/src/emu/cpu/z180/z180dd.c index 582536ce7ab..d1d139e5f06 100644 --- a/src/emu/cpu/z180/z180dd.c +++ b/src/emu/cpu/z180/z180dd.c @@ -1,6 +1,6 @@ OP(illegal,1) { - logerror("Z180 #%d ill. opcode $%02x $%02x\n", - cpunum_get_active(), memory_decrypted_read_byte(Z180.program, (_PCD-1)&0xffff), memory_decrypted_read_byte(Z180.program, _PCD)); + logerror("Z180 '%s' ill. opcode $%02x $%02x\n", + Z180.device->tag, memory_decrypted_read_byte(Z180.program, (_PCD-1)&0xffff), memory_decrypted_read_byte(Z180.program, _PCD)); } /********************************************************** diff --git a/src/emu/cpu/z180/z180ed.c b/src/emu/cpu/z180/z180ed.c index 77d59255c4f..47db30d25d1 100644 --- a/src/emu/cpu/z180/z180ed.c +++ b/src/emu/cpu/z180/z180ed.c @@ -1,7 +1,7 @@ OP(illegal,2) { - logerror("Z180 #%d ill. opcode $ed $%02x\n", - cpunum_get_active(), memory_decrypted_read_byte(Z180.program, (_PCD-1)&0xffff)); + logerror("Z180 '%s' ill. opcode $ed $%02x\n", + Z180.device->tag, memory_decrypted_read_byte(Z180.program, (_PCD-1)&0xffff)); } /********************************************************** diff --git a/src/emu/cpu/z180/z180op.c b/src/emu/cpu/z180/z180op.c index 0fab05c36a0..c93f00b9e1e 100644 --- a/src/emu/cpu/z180/z180op.c +++ b/src/emu/cpu/z180/z180op.c @@ -315,7 +315,7 @@ static void take_interrupt(int irq) else irq_vector = (*Z180.irq_callback)(Z180.device, 0); - LOG(("Z180 #%d single int. irq_vector $%02x\n", cpunum_get_active(), irq_vector)); + LOG(("Z180 '%s' single int. irq_vector $%02x\n", Z180.device->tag, irq_vector)); /* Interrupt mode 2. Call [Z180.I:databyte] */ if( _IM == 2 ) @@ -323,7 +323,7 @@ static void take_interrupt(int irq) irq_vector = (irq_vector & 0xff) + (_I << 8); PUSH( PC ); RM16( irq_vector, &Z180.PC ); - LOG(("Z180 #%d IM2 [$%04x] = $%04x\n",cpunum_get_active() , irq_vector, _PCD)); + LOG(("Z180 '%s' IM2 [$%04x] = $%04x\n",Z180.device->tag , irq_vector, _PCD)); /* CALL opcode timing */ z180_icount -= cc[Z180_TABLE_op][0xcd]; } @@ -331,7 +331,7 @@ static void take_interrupt(int irq) /* Interrupt mode 1. RST 38h */ if( _IM == 1 ) { - LOG(("Z180 #%d IM1 $0038\n",cpunum_get_active() )); + LOG(("Z180 '%s' IM1 $0038\n",Z180.device->tag )); PUSH( PC ); _PCD = 0x0038; /* RST $38 + 'interrupt latency' cycles */ @@ -342,7 +342,7 @@ static void take_interrupt(int irq) /* Interrupt mode 0. We check for CALL and JP instructions, */ /* if neither of these were found we assume a 1 byte opcode */ /* was placed on the databus */ - LOG(("Z180 #%d IM0 $%04x\n",cpunum_get_active() , irq_vector)); + LOG(("Z180 '%s' IM0 $%04x\n",Z180.device->tag , irq_vector)); switch (irq_vector & 0xff0000) { case 0xcd0000: /* call */ @@ -371,7 +371,7 @@ static void take_interrupt(int irq) irq_vector = (_I << 8) + (irq_vector & 0xff); PUSH( PC ); RM16( irq_vector, &Z180.PC ); - LOG(("Z180 #%d INT%d [$%04x] = $%04x\n", cpunum_get_active(), irq, irq_vector, _PCD)); + LOG(("Z180 '%s' INT%d [$%04x] = $%04x\n", Z180.device->tag, irq, irq_vector, _PCD)); /* CALL opcode timing */ z180_icount -= cc[Z180_TABLE_op][0xcd]; } diff --git a/src/emu/cpu/z180/z180ops.h b/src/emu/cpu/z180/z180ops.h index 0ebe91fca0e..c10a126ea5c 100644 --- a/src/emu/cpu/z180/z180ops.h +++ b/src/emu/cpu/z180/z180ops.h @@ -267,7 +267,7 @@ void z180_setOPbase(int pc) * RETN ***************************************************************/ #define RETN { \ - LOG(("Z180 #%d RETN IFF1:%d IFF2:%d\n", cpunum_get_active(), _IFF1, _IFF2)); \ + LOG(("Z180 '%s' RETN IFF1:%d IFF2:%d\n", Z180.device->tag, _IFF1, _IFF2)); \ POP(PC); \ _IFF1 = _IFF2; \ } diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c index 2733c090948..c368759d71c 100644 --- a/src/emu/cpu/z8000/z8000.c +++ b/src/emu/cpu/z8000/z8000.c @@ -351,7 +351,7 @@ INLINE void set_irq(int type) IRQ_REQ = type; break; case Z8000_SYSCALL >> 8: - LOG(("Z8K#%d SYSCALL $%02x\n", cpunum_get_active(), type & 0xff)); + LOG(("Z8K '%s' SYSCALL $%02x\n", Z.device->tag, type & 0xff)); IRQ_REQ = type; break; default: @@ -389,7 +389,7 @@ INLINE void Interrupt(void) IRQ_SRV = IRQ_REQ; IRQ_REQ &= ~Z8000_TRAP; PC = TRAP; - LOG(("Z8K#%d trap $%04x\n", cpunum_get_active(), PC )); + LOG(("Z8K '%s' trap $%04x\n", Z.device->tag, PC )); } else if ( IRQ_REQ & Z8000_SYSCALL ) @@ -401,7 +401,7 @@ INLINE void Interrupt(void) IRQ_SRV = IRQ_REQ; IRQ_REQ &= ~Z8000_SYSCALL; PC = SYSCALL; - LOG(("Z8K#%d syscall $%04x\n", cpunum_get_active(), PC )); + LOG(("Z8K '%s' syscall $%04x\n", Z.device->tag, PC )); } else if ( IRQ_REQ & Z8000_SEGTRAP ) @@ -413,7 +413,7 @@ INLINE void Interrupt(void) IRQ_SRV = IRQ_REQ; IRQ_REQ &= ~Z8000_SEGTRAP; PC = SEGTRAP; - LOG(("Z8K#%d segtrap $%04x\n", cpunum_get_active(), PC )); + LOG(("Z8K '%s' segtrap $%04x\n", Z.device->tag, PC )); } else if ( IRQ_REQ & Z8000_NMI ) @@ -428,7 +428,7 @@ INLINE void Interrupt(void) IRQ_REQ &= ~Z8000_NMI; CHANGE_FCW(fcw); PC = NMI; - LOG(("Z8K#%d NMI $%04x\n", cpunum_get_active(), PC )); + LOG(("Z8K '%s' NMI $%04x\n", Z.device->tag, PC )); } else if ( (IRQ_REQ & Z8000_NVI) && (FCW & F_NVIE) ) @@ -442,7 +442,7 @@ INLINE void Interrupt(void) PC = RDMEM_W( NVI + 2 ); IRQ_REQ &= ~Z8000_NVI; CHANGE_FCW(fcw); - LOG(("Z8K#%d NVI $%04x\n", cpunum_get_active(), PC )); + LOG(("Z8K '%s' NVI $%04x\n", Z.device->tag, PC )); } else if ( (IRQ_REQ & Z8000_VI) && (FCW & F_VIE) ) @@ -456,7 +456,7 @@ INLINE void Interrupt(void) PC = RDMEM_W( VEC00 + 2 * (IRQ_REQ & 0xff) ); IRQ_REQ &= ~Z8000_VI; CHANGE_FCW(fcw); - LOG(("Z8K#%d VI [$%04x/$%04x] fcw $%04x, pc $%04x\n", cpunum_get_active(), IRQ_VEC, VEC00 + VEC00 + 2 * (IRQ_REQ & 0xff), FCW, PC )); + LOG(("Z8K '%s' VI [$%04x/$%04x] fcw $%04x, pc $%04x\n", Z.device->tag, IRQ_VEC, VEC00 + VEC00 + 2 * (IRQ_REQ & 0xff), FCW, PC )); } } diff --git a/src/emu/cpu/z8000/z8000ops.c b/src/emu/cpu/z8000/z8000ops.c index 99fa1abeca9..a10ce9822b0 100644 --- a/src/emu/cpu/z8000/z8000ops.c +++ b/src/emu/cpu/z8000/z8000ops.c @@ -1530,7 +1530,7 @@ static void Z0D_ddN0_1001_imm16(void) static void Z0E_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: ext0e $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: ext0e $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -1544,7 +1544,7 @@ static void Z0E_imm8(void) static void Z0F_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: ext0f $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: ext0f $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -2272,7 +2272,7 @@ static void Z36_0000_0000(void) static void Z36_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvd36 $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvd36 $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -2310,7 +2310,7 @@ static void Z37_ddN0_ssss_imm16(void) static void Z38_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvd38 $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvd38 $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -4347,7 +4347,7 @@ static void Z77_ddN0_ssss_0000_xxxx_0000_0000(void) static void Z78_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvd78 $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvd78 $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -4404,7 +4404,7 @@ static void Z7B_0000_0000(void) PC = POPW( SP ); /* get PC */ IRQ_SRV &= ~tag; /* remove IRQ serviced flag */ CHANGE_FCW(fcw); /* check for user/system mode change */ - LOG(("Z8K#%d IRET tag $%04x, fcw $%04x, pc $%04x\n", cpunum_get_active(), tag, fcw, PC)); + LOG(("Z8K '%s' IRET tag $%04x, fcw $%04x, pc $%04x\n", Z.device->tag, tag, fcw, PC)); } /****************************************** @@ -4489,7 +4489,7 @@ static void Z7D_dddd_0ccc(void) RW(dst) = NSP; break; default: - LOG(("Z8K#%d LDCTL R%d,%d\n", cpunum_get_active(), dst, imm3)); + LOG(("Z8K '%s' LDCTL R%d,%d\n", Z.device->tag, dst, imm3)); } } @@ -4519,7 +4519,7 @@ static void Z7D_ssss_1ccc(void) NSP = RW(src); break; default: - LOG(("Z8K#%d LDCTL %d,R%d\n", cpunum_get_active(), imm3, src)); + LOG(("Z8K '%s' LDCTL %d,R%d\n", Z.device->tag, imm3, src)); } } @@ -4530,7 +4530,7 @@ static void Z7D_ssss_1ccc(void) static void Z7E_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvd7e $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvd7e $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -4826,7 +4826,7 @@ static void Z8D_imm4_0101(void) static void Z8E_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: ext8e $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: ext8e $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -4840,7 +4840,7 @@ static void Z8E_imm8(void) static void Z8F_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: ext8f $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: ext8f $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -4998,7 +4998,7 @@ static void Z9C_dddd_1000(void) static void Z9D_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvd9d $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvd9d $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -5039,7 +5039,7 @@ static void Z9E_0000_cccc(void) static void Z9F_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvd9f $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvd9f $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -5740,7 +5740,7 @@ static void ZB8_ddN0_1100_0000_rrrr_ssN0_0000(void) static void ZB9_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvdb9 $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvdb9 $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; @@ -6398,7 +6398,7 @@ static void ZBE_aaaa_bbbb(void) static void ZBF_imm8(void) { GET_IMM8(0); - LOG(("Z8K#%d %04x: rsvdbf $%02x\n", cpunum_get_active(), PC, imm8)); + LOG(("Z8K '%s' %04x: rsvdbf $%02x\n", Z.device->tag, PC, imm8)); if (FCW & F_EPU) { /* Z8001 EPU code goes here */ (void)imm8; diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index c29cb92ebc6..a4396e381db 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -1081,7 +1081,7 @@ static void registers_update(debug_view *view) const device_config *screen = Machine->primary_screen; /* cannot update if no active CPU */ - if (cpunum_get_active() < 0) + if (Machine->activecpu != NULL) return; total_cycles = cpu_get_total_cycles(Machine->activecpu); @@ -1465,7 +1465,7 @@ static void disasm_generate_bytes(offs_t pcbyte, int numbytes, const cpu_debug_d for the disassembly view -------------------------------------------------*/ -static int disasm_recompute(debug_view *view, offs_t pc, int startline, int lines, int original_cpunum) +static int disasm_recompute(debug_view *view, offs_t pc, int startline, int lines) { debug_view_disasm *dasmdata = view->extra_data; const cpu_debug_data *cpuinfo = cpu_get_debug_data(Machine->cpu[dasmdata->cpunum]); @@ -1622,7 +1622,6 @@ static void disasm_update(debug_view *view) offs_t pc = cpu_get_reg(Machine->cpu[dasmdata->cpunum], REG_PC); offs_t pcbyte = ADDR2BYTE_MASKED(pc, cpuinfo, ADDRESS_SPACE_PROGRAM); debug_view_char *dest = view->viewdata; - int original_cpunum = cpunum_get_active(); int recomputed_this_time = FALSE; EXPRERR exprerr; UINT32 row; @@ -1701,7 +1700,7 @@ recompute: view->left_col = 0; /* recompute from where we last recomputed! */ - disasm_recompute(view, BYTE2ADDR(dasmdata->address[0], cpuinfo, ADDRESS_SPACE_PROGRAM), 0, view->total_rows, original_cpunum); + disasm_recompute(view, BYTE2ADDR(dasmdata->address[0], cpuinfo, ADDRESS_SPACE_PROGRAM), 0, view->total_rows); } else { @@ -1709,7 +1708,7 @@ recompute: view->top_row = 0; view->left_col = 0; - disasm_recompute(view, backpc, 0, view->total_rows, original_cpunum); + disasm_recompute(view, backpc, 0, view->total_rows); } recomputed_this_time = TRUE; } @@ -1726,7 +1725,7 @@ recompute: if (pcbyte == dasmdata->address[effrow]) { /* see if we changed */ - int changed = disasm_recompute(view, pc, effrow, 1, original_cpunum); + int changed = disasm_recompute(view, pc, effrow, 1); if (changed && !recomputed_this_time) { dasmdata->recompute = TRUE; diff --git a/src/emu/machine/6821pia.c b/src/emu/machine/6821pia.c index b4ca8cd2199..a2ca4ca1cea 100644 --- a/src/emu/machine/6821pia.c +++ b/src/emu/machine/6821pia.c @@ -263,7 +263,7 @@ static UINT8 get_in_a_value(running_machine *machine, int which) if (!p->logged_port_a_not_connected && (p->ddr_a != 0xff)) { - logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No port A read handler. Assuming pins 0x%02X not connected\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, p->ddr_a ^ 0xff); + logerror("PIA #%d: Warning! No port A read handler. Assuming pins 0x%02X not connected\n", which, p->ddr_a ^ 0xff); p->logged_port_a_not_connected = TRUE; } } @@ -305,7 +305,7 @@ static UINT8 get_in_b_value(running_machine *machine, int which) { if (!p->logged_port_b_not_connected && (p->ddr_b != 0xff)) { - logerror("cpu #%d (PC=%08X): PIA #%d: Error! No port B read handler. Three-state pins 0x%02X are undefined\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, p->ddr_b ^ 0xff); + logerror("PIA #%d: Error! No port B read handler. Three-state pins 0x%02X are undefined\n", which, p->ddr_b ^ 0xff); p->logged_port_b_not_connected = TRUE; } @@ -378,7 +378,7 @@ static void set_out_ca2(running_machine *machine, int which, int data) else { if (p->out_ca2_needs_pulled) - logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No port CA2 write handler. Previous value has been lost!\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Warning! No port CA2 write handler. Previous value has been lost!\n", which); p->out_ca2_needs_pulled = TRUE; } @@ -405,7 +405,7 @@ static void set_out_cb2(running_machine *machine, int which, int data) else { if (p->out_cb2_needs_pulled) - logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No port CB2 write handler. Previous value has been lost!\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Warning! No port CB2 write handler. Previous value has been lost!\n", which); p->out_cb2_needs_pulled = TRUE; } @@ -442,7 +442,7 @@ static UINT8 port_a_r(running_machine *machine, int which) set_out_ca2(machine, which, TRUE); } - LOG(("cpu #%d (PC=%08X): PIA #%d: port A read = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, ret)); + LOG(("PIA #%d: port A read = %02X\n", which, ret)); return ret; } @@ -454,7 +454,7 @@ static UINT8 ddr_a_r(running_machine *machine, int which) UINT8 ret = p->ddr_a; - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR A read = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, ret)); + LOG(("PIA #%d: DDR A read = %02X\n", which, ret)); return ret; } @@ -478,7 +478,7 @@ static UINT8 port_b_r(running_machine *machine, int which) p->irq_b2 = FALSE; update_interrupts(machine, p); - LOG(("cpu #%d (PC=%08X): PIA #%d: port B read = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, ret)); + LOG(("PIA #%d: port B read = %02X\n", which, ret)); return ret; } @@ -490,7 +490,7 @@ static UINT8 ddr_b_r(running_machine *machine, int which) UINT8 ret = p->ddr_b; - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR B read = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, ret)); + LOG(("PIA #%d: DDR B read = %02X\n", which, ret)); return ret; } @@ -508,7 +508,7 @@ static UINT8 control_a_r(running_machine *machine, int which) pia_set_input_ca1(which, p->intf->in_ca1_func(space, 0)); else if (!p->logged_ca1_not_connected && (!p->in_ca1_pushed)) { - logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA1 read handler. Assuming pin not connected\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Warning! No CA1 read handler. Assuming pin not connected\n", which); p->logged_ca1_not_connected = TRUE; } @@ -516,7 +516,7 @@ static UINT8 control_a_r(running_machine *machine, int which) pia_set_input_ca2(which, p->intf->in_ca2_func(space, 0)); else if ( !p->logged_ca2_not_connected && C2_INPUT(p->ctl_a) && !p->in_ca2_pushed) { - logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No CA2 read handler. Assuming pin not connected\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Warning! No CA2 read handler. Assuming pin not connected\n", which); p->logged_ca2_not_connected = TRUE; } @@ -530,7 +530,7 @@ static UINT8 control_a_r(running_machine *machine, int which) if (p->irq_a2 && C2_INPUT(p->ctl_a)) ret |= PIA_IRQ2; - LOG(("cpu #%d (PC=%08X): PIA #%d: control A read = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, ret)); + LOG(("PIA #%d: control A read = %02X\n", which, ret)); return ret; } @@ -548,7 +548,7 @@ static UINT8 control_b_r(running_machine *machine, int which) pia_set_input_cb1(which, p->intf->in_cb1_func(space, 0)); else if (!p->logged_cb1_not_connected && !p->in_cb1_pushed) { - logerror("cpu #%d (PC=%08X): PIA #%d: Error! no CB1 read handler. Three-state pin is undefined\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Error! no CB1 read handler. Three-state pin is undefined\n", which); p->logged_cb1_not_connected = TRUE; } @@ -556,7 +556,7 @@ static UINT8 control_b_r(running_machine *machine, int which) pia_set_input_cb2(which, p->intf->in_cb2_func(space, 0)); else if (!p->logged_cb2_not_connected && C2_INPUT(p->ctl_b) && !p->in_cb2_pushed) { - logerror("cpu #%d (PC=%08X): PIA #%d: Error! No CB2 read handler. Three-state pin is undefined\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Error! No CB2 read handler. Three-state pin is undefined\n", which); p->logged_cb2_not_connected = TRUE; } @@ -570,7 +570,7 @@ static UINT8 control_b_r(running_machine *machine, int which) if (p->irq_b2 && C2_INPUT(p->ctl_b)) ret |= PIA_IRQ2; - LOG(("cpu #%d (PC=%08X): PIA #%d: control B read = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, ret)); + LOG(("PIA #%d: control B read = %02X\n", which, ret)); return ret; } @@ -641,14 +641,14 @@ static void send_to_out_a_func(running_machine *machine, int which, const char* /* input pins are pulled high */ UINT8 data = get_out_a_value(machine, which); - LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, message, data)); + LOG(("PIA #%d: %s = %02X\n", which, message, data)); if (p->intf->out_a_func) p->intf->out_a_func(space, 0, data); else { if (p->out_a_needs_pulled) - logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No port A write handler. Previous value has been lost!\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Warning! No port A write handler. Previous value has been lost!\n", which); p->out_a_needs_pulled = TRUE; } @@ -664,14 +664,14 @@ static void send_to_out_b_func(running_machine *machine, int which, const char* /* input pins are high-impedance - we just send them as zeros for backwards compatibility */ UINT8 data = get_out_b_value(which); - LOG(("cpu #%d (PC=%08X): PIA #%d: %s = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, message, data)); + LOG(("PIA #%d: %s = %02X\n", which, message, data)); if (p->intf->out_b_func) p->intf->out_b_func(space, 0, data); else { if (p->out_b_needs_pulled) - logerror("cpu #%d (PC=%08X): PIA #%d: Warning! No port B write handler. Previous value has been lost!\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which); + logerror("PIA #%d: Warning! No port B write handler. Previous value has been lost!\n", which); p->out_b_needs_pulled = TRUE; } @@ -694,11 +694,11 @@ static void ddr_a_w(running_machine *machine, int which, UINT8 data) pia6821 *p = &pias[which]; if (data == 0x00) - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR A write = %02X (input mode)\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: DDR A write = %02X (input mode)\n", which, data)); else if (data == 0xff) - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR A write = %02X (output mode)\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: DDR A write = %02X (output mode)\n", which, data)); else - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR A write = %02X (mixed mode)\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: DDR A write = %02X (mixed mode)\n", which, data)); if (p->ddr_a != data) { @@ -737,11 +737,11 @@ static void ddr_b_w(running_machine *machine, int which, UINT8 data) pia6821 *p = &pias[which]; if (data == 0x00) - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR B write = %02X (input mode)\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: DDR B write = %02X (input mode)\n", which, data)); else if (data == 0xff) - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR B write = %02X (output mode)\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: DDR B write = %02X (output mode)\n", which, data)); else - LOG(("cpu #%d (PC=%08X): PIA #%d: DDR B write = %02X (mixed mode)\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: DDR B write = %02X (mixed mode)\n", which, data)); if (p->ddr_b != data) { @@ -760,7 +760,7 @@ static void control_a_w(running_machine *machine, int which, UINT8 data) /* bit 7 and 6 are read only */ data &= 0x3f; - LOG(("cpu #%d (PC=%08X): PIA #%d: control A write = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: control A write = %02X\n", which, data)); /* update the control register */ p->ctl_a = data; @@ -793,7 +793,7 @@ static void control_b_w(running_machine *machine, int which, UINT8 data) /* bit 7 and 6 are read only */ data &= 0x3f; - LOG(("cpu #%d (PC=%08X): PIA #%d: control B write = %02X\n", cpunum_get_active(), safe_cpu_get_pc(machine->activecpu), which, data)); + LOG(("PIA #%d: control B write = %02X\n", which, data)); /* update the control register */ p->ctl_b = data; @@ -879,7 +879,7 @@ void pia_set_input_a(int which, UINT8 data, UINT8 z_mask) assert_always(p->intf->in_a_func == NULL, "pia_set_input_a() called when in_a_func implemented"); - LOG(("cpu #%d (PC=%08X): PIA #%d: set input port A = %02X\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which, data)); + LOG(("PIA #%d: set input port A = %02X\n", which, data)); p->in_a = data; p->port_a_z_mask = z_mask; @@ -919,13 +919,13 @@ void pia_set_input_ca1(int which, int data) /* limit the data to 0 or 1 */ data = data ? TRUE : FALSE; - LOG(("cpu #%d (PC=%08X): PIA #%d: set input CA1 = %d\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which, data)); + LOG(("PIA #%d: set input CA1 = %d\n", which, data)); /* the new state has caused a transition */ if ((p->in_ca1 != data) && ((data && C1_LOW_TO_HIGH(p->ctl_a)) || (!data && C1_HIGH_TO_LOW(p->ctl_a)))) { - LOG(("cpu #%d (PC=%08X): PIA #%d: CA1 triggering\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which)); + LOG(("PIA #%d: CA1 triggering\n", which)); /* mark the IRQ */ p->irq_a1 = TRUE; @@ -966,14 +966,14 @@ void pia_set_input_ca2(int which, int data) /* limit the data to 0 or 1 */ data = data ? 1 : 0; - LOG(("cpu #%d (PC=%08X): PIA #%d: set input CA2 = %d\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which, data)); + LOG(("PIA #%d: set input CA2 = %d\n", which, data)); /* if input mode and the new state has caused a transition */ if (C2_INPUT(p->ctl_a) && (p->in_ca2 != data) && ((data && C2_LOW_TO_HIGH(p->ctl_a)) || (!data && C2_HIGH_TO_LOW(p->ctl_a)))) { - LOG(("cpu #%d (PC=%08X): PIA #%d: CA2 triggering\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which)); + LOG(("PIA #%d: CA2 triggering\n", which)); /* mark the IRQ */ p->irq_a2 = TRUE; @@ -1032,7 +1032,7 @@ void pia_set_input_b(int which, UINT8 data) assert_always(p->intf->in_b_func == NULL, "pia_set_input_b() called when in_b_func implemented"); - LOG(("cpu #%d (PC=%08X): PIA #%d: set input port B = %02X\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which, data)); + LOG(("PIA #%d: set input port B = %02X\n", which, data)); p->in_b = data; p->in_b_pushed = TRUE; @@ -1072,13 +1072,13 @@ void pia_set_input_cb1(int which, int data) /* limit the data to 0 or 1 */ data = data ? 1 : 0; - LOG(("cpu #%d (PC=%08X): PIA #%d: set input CB1 = %d\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which, data)); + LOG(("PIA #%d: set input CB1 = %d\n", which, data)); /* the new state has caused a transition */ if ((p->in_cb1 != data) && ((data && C1_LOW_TO_HIGH(p->ctl_b)) || (!data && C1_HIGH_TO_LOW(p->ctl_b)))) { - LOG(("cpu #%d (PC=%08X): PIA #%d: CB1 triggering\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which)); + LOG(("PIA #%d: CB1 triggering\n", which)); /* mark the IRQ */ p->irq_b1 = 1; @@ -1120,14 +1120,14 @@ void pia_set_input_cb2(int which, int data) /* limit the data to 0 or 1 */ data = data ? 1 : 0; - LOG(("cpu #%d (PC=%08X): PIA #%d: set input CB2 = %d\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which, data)); + LOG(("PIA #%d: set input CB2 = %d\n", which, data)); /* if input mode and the new state has caused a transition */ if (C2_INPUT(p->ctl_b) && (p->in_cb2 != data) && ((data && C2_LOW_TO_HIGH(p->ctl_b)) || (!data && C2_HIGH_TO_LOW(p->ctl_b)))) { - LOG(("cpu #%d (PC=%08X): PIA #%d: CB2 triggering\n", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), which)); + LOG(("PIA #%d: CB2 triggering\n", which)); /* mark the IRQ */ p->irq_b2 = 1; diff --git a/src/emu/machine/adc083x.c b/src/emu/machine/adc083x.c index 20c9fdfd654..7e24583c74d 100644 --- a/src/emu/machine/adc083x.c +++ b/src/emu/machine/adc083x.c @@ -21,7 +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( cpunum_get_active() != -1 ) + if( Machine->activecpu != NULL ) { logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); } diff --git a/src/emu/machine/ds2401.c b/src/emu/machine/ds2401.c index f9a8333a1a7..d54db006b49 100644 --- a/src/emu/machine/ds2401.c +++ b/src/emu/machine/ds2401.c @@ -23,7 +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( cpunum_get_active() != -1 ) + if( Machine->activecpu != NULL ) { logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); } diff --git a/src/emu/machine/generic.c b/src/emu/machine/generic.c index 28d0fa1cad8..e2eefce0602 100644 --- a/src/emu/machine/generic.c +++ b/src/emu/machine/generic.c @@ -615,9 +615,7 @@ void cpu_interrupt_enable(int cpunum, int enabled) WRITE8_HANDLER( interrupt_enable_w ) { - int activecpu = cpunum_get_active(); - assert_always(activecpu >= 0, "interrupt_enable_w() called with no active cpu!"); - cpu_interrupt_enable(activecpu, data); + cpu_interrupt_enable(cpu_get_index(space->cpu), data); } @@ -628,9 +626,7 @@ WRITE8_HANDLER( interrupt_enable_w ) READ8_HANDLER( interrupt_enable_r ) { - int activecpu = cpunum_get_active(); - assert_always(activecpu >= 0, "interrupt_enable_r() called with no active cpu!"); - return interrupt_enable[activecpu]; + return interrupt_enable[cpu_get_index(space->cpu)]; } diff --git a/src/emu/machine/i2cmem.c b/src/emu/machine/i2cmem.c index e64f79a529a..fa102d5ae3b 100644 --- a/src/emu/machine/i2cmem.c +++ b/src/emu/machine/i2cmem.c @@ -35,7 +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( cpunum_get_active() != -1 ) + if( Machine->activecpu != NULL ) { logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); } diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c index 62055a9e108..1f6032b3463 100644 --- a/src/emu/machine/pci.c +++ b/src/emu/machine/pci.c @@ -137,8 +137,8 @@ READ32_HANDLER(pci_32le_r) if (LOG_PCI) { - logerror("pci_32le_r(): CPU #%d pc=0x%08X offset=%d result=0x%08X\n", - cpunum_get_active(), (unsigned) cpu_get_reg(space->cpu, REG_PC), offset, result); + logerror("pci_32le_r(): CPU '%s' pc=0x%08X offset=%d result=0x%08X\n", + space->cpu->tag, (unsigned) cpu_get_reg(space->cpu, REG_PC), offset, result); } return result; } @@ -154,8 +154,8 @@ WRITE32_HANDLER(pci_32le_w) if (LOG_PCI) { - logerror("pci_32le_w(): CPU #%d pc=0x%08X offset=%d data=0x%08X\n", - cpunum_get_active(), (unsigned) cpu_get_reg(space->cpu, REG_PC), offset, data); + logerror("pci_32le_w(): CPU '%s' pc=0x%08X offset=%d data=0x%08X\n", + space->cpu->tag, (unsigned) cpu_get_reg(space->cpu, REG_PC), offset, data); } switch(offset) diff --git a/src/emu/machine/x76f041.c b/src/emu/machine/x76f041.c index 837941e2a68..7487812a512 100644 --- a/src/emu/machine/x76f041.c +++ b/src/emu/machine/x76f041.c @@ -26,7 +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( cpunum_get_active() != -1 ) + if( Machine->activecpu != NULL ) { logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); } diff --git a/src/emu/machine/x76f100.c b/src/emu/machine/x76f100.c index 8382bf84b80..220c5bf76ca 100644 --- a/src/emu/machine/x76f100.c +++ b/src/emu/machine/x76f100.c @@ -24,7 +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( cpunum_get_active() != -1 ) + if( Machine->activecpu != NULL ) { logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); } diff --git a/src/emu/mame.c b/src/emu/mame.c index d1d4cc70b0f..a325febbb9c 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -599,7 +599,7 @@ void mame_schedule_soft_reset(running_machine *machine) mame_pause(machine, FALSE); /* if we're executing, abort out immediately */ - if (cpunum_get_active() >= 0) + if (machine->activecpu != NULL) cpu_eat_cycles(machine->activecpu, 1000000000); } @@ -616,7 +616,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 (cpunum_get_active() >= 0) + if (machine->activecpu != NULL) cpu_eat_cycles(machine->activecpu, 1000000000); } diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index 285525531a0..77669301de9 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -124,7 +124,7 @@ static WRITE8_HANDLER( lnc_w ) else if (offset == 0x9000) { return; } /* SMH_NOP */ else if (offset == 0x9002) { audio_command_w(space,0,data); return; } else if (offset >= 0xb000 && offset <= 0xb1ff) ; - else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpunum_get_active(),cpu_get_pc(space->cpu),data,offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n",space->cpu->tag,cpu_get_pc(space->cpu),data,offset); rambase[offset] = data; @@ -142,7 +142,7 @@ static WRITE8_HANDLER( mmonkey_w ) else if (offset == 0x9000) { return; } /* SMH_NOP */ else if (offset == 0x9002) { audio_command_w(space,0,data); return; } else if (offset >= 0xb000 && offset <= 0xbfff) { mmonkey_protection_w(space,offset - 0xb000, data); return; } - else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpunum_get_active(),cpu_get_pc(space->cpu),data,offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n",space->cpu->tag,cpu_get_pc(space->cpu),data,offset); rambase[offset] = data; @@ -160,7 +160,7 @@ static WRITE8_HANDLER( btime_w ) else if (offset == 0x4002) btime_video_control_w(space,0,data); else if (offset == 0x4003) audio_command_w(space,0,data); else if (offset == 0x4004) bnj_scroll1_w(space,0,data); - else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpunum_get_active(),cpu_get_pc(space->cpu),data,offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n",space->cpu->tag,cpu_get_pc(space->cpu),data,offset); rambase[offset] = data; @@ -179,7 +179,7 @@ static WRITE8_HANDLER( tisland_w ) else if (offset == 0x4004) bnj_scroll1_w(space,0,data); else if (offset == 0x4005) bnj_scroll2_w(space,0,data); // else if (offset == 0x8000) btime_video_control_w(space,0,data); - else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpunum_get_active(),cpu_get_pc(space->cpu),data,offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n",space->cpu->tag,cpu_get_pc(space->cpu),data,offset); rambase[offset] = data; @@ -198,7 +198,7 @@ static WRITE8_HANDLER( zoar_w ) else if (offset == 0x9804) bnj_scroll2_w(space,0,data); else if (offset == 0x9805) bnj_scroll1_w(space,0,data); else if (offset == 0x9806) audio_command_w(space,0,data); - else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpunum_get_active(),cpu_get_pc(space->cpu),data,offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n",space->cpu->tag,cpu_get_pc(space->cpu),data,offset); rambase[offset] = data; @@ -212,7 +212,7 @@ static WRITE8_HANDLER( disco_w ) else if (offset >= 0x8000 && offset <= 0x881f) ; else if (offset == 0x9a00) audio_command_w(space,0,data); else if (offset == 0x9c00) disco_video_control_w(space,0,data); - else logerror("CPU #%d PC %04x: warning - write %02x to unmapped memory address %04x\n",cpunum_get_active(),cpu_get_pc(space->cpu),data,offset); + else logerror("CPU '%s' PC %04x: warning - write %02x to unmapped memory address %04x\n",space->cpu->tag,cpu_get_pc(space->cpu),data,offset); rambase[offset] = data; diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index 08c983d9f13..dced2bcf6fd 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -422,7 +422,7 @@ static READ8_HANDLER( ddragon_spriteram_r ) static WRITE8_HANDLER( ddragon_spriteram_w ) { - if (cpunum_get_active() == 1 && offset == 0) + if (space->cpu == space->machine->cpu[1] && offset == 0) dd_sub_cpu_busy = 1; ddragon_spriteram[offset] = data; diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c index b134323cbbf..e0bf15c69ee 100644 --- a/src/mame/drivers/dorachan.c +++ b/src/mame/drivers/dorachan.c @@ -31,7 +31,7 @@ static CUSTOM_INPUT( dorachan_protection_r ) { UINT8 ret = 0; - if ((cpunum_get_active() >= 0)) + if (field->port->machine->activecpu != NULL) { switch (cpu_get_previouspc(field->port->machine->activecpu)) { diff --git a/src/mame/drivers/galpani3.c b/src/mame/drivers/galpani3.c index 6ea3db59ba5..5d8e90584e3 100644 --- a/src/mame/drivers/galpani3.c +++ b/src/mame/drivers/galpani3.c @@ -528,7 +528,7 @@ GALPANI3_MCU_COM_W(3) static READ16_HANDLER( galpani3_mcu_status_r ) { - logerror("cpu #%d (PC=%06X): read mcu status\n", cpunum_get_active(), cpu_get_previouspc(space->cpu)); + logerror("cpu '%s' (PC=%06X): read mcu status\n", space->cpu->tag, cpu_get_previouspc(space->cpu)); return 0; } @@ -550,7 +550,7 @@ READ16_HANDLER( galpani3_regs1_r ) } default: - logerror("cpu #%d (PC=%06X): galpani3_regs1_r %02x %04x\n", cpunum_get_active(), cpu_get_previouspc(space->cpu), offset, mem_mask); + logerror("cpu '%s' (PC=%06X): galpani3_regs1_r %02x %04x\n", space->cpu->tag, cpu_get_previouspc(space->cpu), offset, mem_mask); break; } @@ -575,7 +575,7 @@ READ16_HANDLER( galpani3_regs2_r ) } default: - logerror("cpu #%d (PC=%06X): galpani3_regs2_r %02x %04x\n", cpunum_get_active(), cpu_get_previouspc(space->cpu), offset, mem_mask); + logerror("cpu '%s' (PC=%06X): galpani3_regs2_r %02x %04x\n", space->cpu->tag, cpu_get_previouspc(space->cpu), offset, mem_mask); break; } @@ -600,7 +600,7 @@ READ16_HANDLER( galpani3_regs3_r ) } default: - logerror("cpu #%d (PC=%06X): galpani3_regs3_r %02x %04x\n", cpunum_get_active(), cpu_get_previouspc(space->cpu), offset, mem_mask); + logerror("cpu '%s' (PC=%06X): galpani3_regs3_r %02x %04x\n", space->cpu->tag, cpu_get_previouspc(space->cpu), offset, mem_mask); break; } diff --git a/src/mame/drivers/jchan.c b/src/mame/drivers/jchan.c index de87d7a5d31..542cf1e4b27 100644 --- a/src/mame/drivers/jchan.c +++ b/src/mame/drivers/jchan.c @@ -286,7 +286,7 @@ JCHAN_MCU_COM_W(3) static READ16_HANDLER( jchan_mcu_status_r ) { - logerror("cpu #%d (PC=%06X): read mcu status\n", cpunum_get_active(), cpu_get_previouspc(space->cpu)); + logerror("cpu '%s' (PC=%06X): read mcu status\n", space->cpu->tag, cpu_get_previouspc(space->cpu)); return 0; } diff --git a/src/mame/drivers/konamim2.c b/src/mame/drivers/konamim2.c index 8380611ed86..74243da4f61 100644 --- a/src/mame/drivers/konamim2.c +++ b/src/mame/drivers/konamim2.c @@ -317,7 +317,7 @@ static WRITE64_HANDLER(unk4_w) { if (data & 0x800000) { - mame_printf_debug("CPU%d: CPU1 IRQ at %08X\n", cpunum_get_active(), cpu_get_pc(space->cpu)); + mame_printf_debug("CPU '%s': CPU1 IRQ at %08X\n", space->cpu->tag, cpu_get_pc(space->cpu)); cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_IRQ0, ASSERT_LINE); } @@ -1075,7 +1075,7 @@ static READ64_HANDLER(cpu_r) if (ACCESSING_BITS_32_63) { - r = (UINT64)(cpunum_get_active() ? 0x80000000 : 0); + r = (UINT64)((space->machine->activecpu != 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 ea890de8892..050d46bb9ef 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -232,7 +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( cpunum_get_active() != -1 ) + if( Machine->activecpu != NULL ) { logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); } diff --git a/src/mame/drivers/namcos11.c b/src/mame/drivers/namcos11.c index dad2eb0193d..d4a085cc8a7 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( "%02x:%08x: %s", cpunum_get_active(), safe_cpu_get_pc(Machine->activecpu), buf ); + logerror( "'%s':%08x: %s", Machine->activecpu->tag, safe_cpu_get_pc(Machine->activecpu), buf ); } } diff --git a/src/mame/drivers/namcos12.c b/src/mame/drivers/namcos12.c index 4772aa4d81d..f2582c3a887 100644 --- a/src/mame/drivers/namcos12.c +++ b/src/mame/drivers/namcos12.c @@ -940,7 +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( cpunum_get_active() != -1 ) + if( Machine->activecpu != NULL ) { logerror( "%08x: %s", cpu_get_pc(Machine->activecpu), buf ); } diff --git a/src/mame/drivers/namcos21.c b/src/mame/drivers/namcos21.c index 97753d0ce5a..f5db261669e 100644 --- a/src/mame/drivers/namcos21.c +++ b/src/mame/drivers/namcos21.c @@ -607,7 +607,7 @@ static WRITE16_HANDLER( dspram16_w ) } else if( namcos2_gametype == NAMCOS21_SOLVALOU && offset == 0x103 && - cpunum_get_active()==0 ) + space->cpu == space->machine->cpu[0] ) { /* hack; synchronization for solvalou */ cpu_yield(space->cpu); } @@ -967,8 +967,8 @@ static WRITE16_HANDLER( pointram_control_w ) /* pointram_control&0x20 : bank for depthcue data */ /* - logerror( "dsp_control_w:%x:%x[%x]:=%04x ", - cpunum_get_active(), + logerror( "dsp_control_w:'%s':%x[%x]:=%04x ", + space->cpu->tag, cpu_get_pc(space->cpu), offset, pointram_control ); diff --git a/src/mame/drivers/neogeo.c b/src/mame/drivers/neogeo.c index a338fbef8ce..a46f84b69db 100644 --- a/src/mame/drivers/neogeo.c +++ b/src/mame/drivers/neogeo.c @@ -592,7 +592,7 @@ static CUSTOM_INPUT( get_audio_result ) { UINT32 ret = audio_result; -// if (LOG_CPU_COMM && (cpunum_get_active() >= 0)) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(machine->activecpu), ret); +// if (LOG_CPU_COMM && (field->port->machine->activecpu != NULL)) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field->port->machine->activecpu), ret); return ret; } diff --git a/src/mame/drivers/polepos.c b/src/mame/drivers/polepos.c index 64a3eb2b449..4aecaa0d61c 100644 --- a/src/mame/drivers/polepos.c +++ b/src/mame/drivers/polepos.c @@ -328,13 +328,11 @@ static WRITE8_HANDLER( polepos_latch_w ) static WRITE16_HANDLER( polepos_z8002_nvi_enable_w ) { - int which = cpunum_get_active(); - data &= 1; - cpu_interrupt_enable(which,data); + cpu_interrupt_enable(cpu_get_index(space->cpu),data); if (!data) - cpu_set_input_line(space->machine->cpu[which], 0, CLEAR_LINE); + cpu_set_input_line(space->cpu, 0, CLEAR_LINE); } diff --git a/src/mame/drivers/route16.c b/src/mame/drivers/route16.c index ecee1d6bc9a..ba3aef4b3cb 100644 --- a/src/mame/drivers/route16.c +++ b/src/mame/drivers/route16.c @@ -899,7 +899,7 @@ static READ8_HANDLER( routex_prot_read ) { if (cpu_get_pc(space->cpu) == 0x2f) return 0xfb; - logerror ("cpu #%d (PC=%08X): unmapped prot read\n", cpunum_get_active(), cpu_get_pc(space->cpu)); + logerror ("cpu '%s' (PC=%08X): unmapped prot read\n", space->cpu->tag, cpu_get_pc(space->cpu)); return 0x00; }