diff --git a/src/mame/audio/carnival.c b/src/mame/audio/carnival.c index b749195b75a..978c9f8e7fd 100644 --- a/src/mame/audio/carnival.c +++ b/src/mame/audio/carnival.c @@ -44,7 +44,6 @@ #define PSG_CLOCK (3579545 / 3) /* Hz */ -#define CPU_MUSIC_ID (1) /* music CPU id number */ /* output port 0x01 definitions - sound effect drive outputs */ @@ -237,7 +236,7 @@ WRITE8_HANDLER( carnival_audio_2_w ) if ( bitsGoneHigh & OUT_PORT_2_MUSIC_RESET ) /* reset output is no longer asserted active low */ - cpu_set_input_line(space->machine->cpu[CPU_MUSIC_ID], INPUT_LINE_RESET, PULSE_LINE ); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, PULSE_LINE ); } diff --git a/src/mame/audio/cchasm.c b/src/mame/audio/cchasm.c index 9b11c136862..d6d6290ec3b 100644 --- a/src/mame/audio/cchasm.c +++ b/src/mame/audio/cchasm.c @@ -33,7 +33,7 @@ WRITE8_HANDLER( cchasm_soundlatch4_w ) { sound_flags |= 0x40; soundlatch4_w(space, offset, data); - cpu_set_input_line(space->machine->cpu[0], 1, HOLD_LINE); + cputag_set_input_line(space->machine, "maincpu", 1, HOLD_LINE); } WRITE16_HANDLER( cchasm_io_w ) @@ -52,7 +52,7 @@ WRITE16_HANDLER( cchasm_io_w ) sound_flags |= 0x80; soundlatch2_w (space, offset, data); z80ctc_trg2_w (ctc, 0, 1); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); break; case 2: led = data; @@ -86,7 +86,7 @@ static int output[2]; static void ctc_interrupt (const device_config *device, int state) { - cpu_set_input_line(device->machine->cpu[1], 0, state); + cputag_set_input_line(device->machine, "audiocpu", 0, state); } static WRITE8_DEVICE_HANDLER( ctc_timer_1_w ) diff --git a/src/mame/drivers/cabal.c b/src/mame/drivers/cabal.c index 1ef4f220ec2..fb9f5c2c1e1 100644 --- a/src/mame/drivers/cabal.c +++ b/src/mame/drivers/cabal.c @@ -118,7 +118,7 @@ static WRITE16_HANDLER( cabal_sound_irq_trigger_word_w ) static WRITE16_HANDLER( cabalbl_sound_irq_trigger_word_w ) { - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE ); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE ); } @@ -464,7 +464,7 @@ GFXDECODE_END static void irqhandler(const device_config *device, int irq) { - cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); } static const ym2151_interface cabalbl_ym2151_interface = diff --git a/src/mame/drivers/calchase.c b/src/mame/drivers/calchase.c index 52839345f0e..d9a9083a759 100644 --- a/src/mame/drivers/calchase.c +++ b/src/mame/drivers/calchase.c @@ -215,7 +215,7 @@ 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); + const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; @@ -225,7 +225,7 @@ static DMA8237_MEM_READ( pc_dma_read_byte ) static DMA8237_MEM_WRITE( pc_dma_write_byte ) { - const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) & 0xFF0000; @@ -546,7 +546,7 @@ static IRQ_CALLBACK(irq_callback) static MACHINE_START(calchase) { - cpu_set_irq_callback(machine->cpu[0], irq_callback); + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback); calchase_devices.pit8254 = devtag_get_device( machine, "pit8254" ); calchase_devices.pic8259_1 = devtag_get_device( machine, "pic8259_1" ); @@ -562,7 +562,7 @@ static MACHINE_START(calchase) *************************************************************/ static PIC8259_SET_INT_LINE( calchase_pic8259_1_set_int_line ) { - cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? HOLD_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); } @@ -615,7 +615,7 @@ static MACHINE_RESET(calchase) static void set_gate_a20(running_machine *machine, int a20) { - cpu_set_input_line(machine->cpu[0], INPUT_LINE_A20, a20); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, a20); } static void keyboard_interrupt(running_machine *machine, int state) diff --git a/src/mame/drivers/capbowl.c b/src/mame/drivers/capbowl.c index c9ce9f35d61..f37f0110876 100644 --- a/src/mame/drivers/capbowl.c +++ b/src/mame/drivers/capbowl.c @@ -191,7 +191,7 @@ static WRITE8_HANDLER( track_reset_w ) static WRITE8_HANDLER( capbowl_sndcmd_w ) { - cpu_set_input_line(space->machine->cpu[1], M6809_IRQ_LINE, HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", M6809_IRQ_LINE, HOLD_LINE); soundlatch_w(space, offset, data); } @@ -206,7 +206,7 @@ static WRITE8_HANDLER( capbowl_sndcmd_w ) static void firqhandler(const device_config *device, int irq) { - cpu_set_input_line(device->machine->cpu[1], 1, irq ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 1, irq ? ASSERT_LINE : CLEAR_LINE); } diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c index 59945e7a8be..05205fde323 100644 --- a/src/mame/drivers/cave.c +++ b/src/mame/drivers/cave.c @@ -99,9 +99,9 @@ static UINT8 agallet_vblank_irq; static void update_irq_state(running_machine *machine) { if (vblank_irq || sound_irq || unknown_irq) - cpu_set_input_line(machine->cpu[0], irq_level, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", irq_level, ASSERT_LINE); else - cpu_set_input_line(machine->cpu[0], irq_level, CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", irq_level, CLEAR_LINE); } static TIMER_CALLBACK( cave_vblank_start ) @@ -223,7 +223,7 @@ static WRITE16_HANDLER( sound_cmd_w ) // sound_flag1 = 1; // sound_flag2 = 1; soundlatch_word_w(space,offset,data,mem_mask); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(50)); // Allow the other cpu to reply } @@ -1681,7 +1681,7 @@ static const ymz280b_interface ymz280b_intf = static void irqhandler(const device_config *device, int irq) { - cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); } static const ym2151_interface ym2151_config = @@ -3828,7 +3828,7 @@ static DRIVER_INIT( agallet ) unpack_sprites(machine); // Speed Hack - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb80000, 0xb80001, 0, 0, agallet_irq_cause_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xb80000, 0xb80001, 0, 0, agallet_irq_cause_r); } static DRIVER_INIT( dfeveron ) diff --git a/src/mame/drivers/cbuster.c b/src/mame/drivers/cbuster.c index 32a34af3fad..0933fb93761 100644 --- a/src/mame/drivers/cbuster.c +++ b/src/mame/drivers/cbuster.c @@ -39,17 +39,18 @@ static UINT16 prot; static WRITE16_HANDLER( twocrude_control_w ) { - switch (offset<<1) { + switch (offset << 1) + { case 0: /* DMA flag */ - buffer_spriteram16_w(space,0,0,0xffff); + buffer_spriteram16_w(space, 0, 0, 0xffff); return; case 6: /* IRQ ack */ return; case 2: /* Sound CPU write */ - soundlatch_w(space,0,data & 0xff); - cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE); + soundlatch_w(space, 0, data & 0xff); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); return; case 4: /* Protection, maybe this is a PAL on the board? @@ -69,22 +70,22 @@ static WRITE16_HANDLER( twocrude_control_w ) protection?! */ - if ((data&0xffff)==0x9a00) prot=0; - if ((data&0xffff)==0xaa) prot=0x74; - if ((data&0xffff)==0x0200) prot=0x63<<8; - if ((data&0xffff)==0x9a) prot=0xe; - if ((data&0xffff)==0x55) prot=0x1e; - if ((data&0xffff)==0x0e) {prot=0x0e;twocrude_pri_w(0);} /* start */ - if ((data&0xffff)==0x00) {prot=0x0e;twocrude_pri_w(0);} /* level 0 */ - if ((data&0xffff)==0xf1) {prot=0x36;twocrude_pri_w(1);} /* level 1 */ - if ((data&0xffff)==0x80) {prot=0x2e;twocrude_pri_w(1);} /* level 2 */ - if ((data&0xffff)==0x40) {prot=0x1e;twocrude_pri_w(1);} /* level 3 */ - if ((data&0xffff)==0xc0) {prot=0x3e;twocrude_pri_w(0);} /* level 4 */ - if ((data&0xffff)==0xff) {prot=0x76;twocrude_pri_w(1);} /* level 5 */ + if ((data & 0xffff) == 0x9a00) prot = 0; + if ((data & 0xffff) == 0xaa) prot = 0x74; + if ((data & 0xffff) == 0x0200) prot = 0x63 << 8; + if ((data & 0xffff) == 0x9a) prot = 0xe; + if ((data & 0xffff) == 0x55) prot = 0x1e; + if ((data & 0xffff) == 0x0e) {prot = 0x0e; twocrude_pri_w(0);} /* start */ + if ((data & 0xffff) == 0x00) {prot = 0x0e; twocrude_pri_w(0);} /* level 0 */ + if ((data & 0xffff) == 0xf1) {prot = 0x36; twocrude_pri_w(1);} /* level 1 */ + if ((data & 0xffff) == 0x80) {prot = 0x2e; twocrude_pri_w(1);} /* level 2 */ + if ((data & 0xffff) == 0x40) {prot = 0x1e; twocrude_pri_w(1);} /* level 3 */ + if ((data & 0xffff) == 0xc0) {prot = 0x3e; twocrude_pri_w(0);} /* level 4 */ + if ((data & 0xffff) == 0xff) {prot = 0x76; twocrude_pri_w(1);} /* level 5 */ break; } - logerror("Warning %04x- %02x written to control %02x\n",cpu_get_pc(space->cpu),data,offset); + logerror("Warning %04x- %02x written to control %02x\n", cpu_get_pc(space->cpu), data, offset); } static READ16_HANDLER( twocrude_control_r ) @@ -272,7 +273,7 @@ GFXDECODE_END static void sound_irq(const device_config *device, int state) { - cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */ + cputag_set_input_line(device->machine, "audiocpu", 1, state); /* IRQ 2 */ } static const ym2151_interface ym2151_config = diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c index f731025097c..0dc06041b62 100644 --- a/src/mame/drivers/ccastles.c +++ b/src/mame/drivers/ccastles.c @@ -174,7 +174,7 @@ static TIMER_CALLBACK( clock_irq ) /* assert the IRQ if not already asserted */ if (!irq_state) { - cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); irq_state = 1; } @@ -249,7 +249,7 @@ static MACHINE_START( ccastles ) static MACHINE_RESET( ccastles ) { - cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); irq_state = 0; } @@ -265,7 +265,7 @@ static WRITE8_HANDLER( irq_ack_w ) { if (irq_state) { - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); irq_state = 0; } } diff --git a/src/mame/drivers/cchasm.c b/src/mame/drivers/cchasm.c index d17948e1d87..996c5d24523 100644 --- a/src/mame/drivers/cchasm.c +++ b/src/mame/drivers/cchasm.c @@ -68,7 +68,7 @@ ADDRESS_MAP_END static void cchasm_6840_irq(running_machine *machine, int state) { - cpu_set_input_line(machine->cpu[0], 4, state?ASSERT_LINE:CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 4, state ? ASSERT_LINE : CLEAR_LINE); } static const ptm6840_interface cchasm_6840_intf = { diff --git a/src/mame/drivers/cclimber.c b/src/mame/drivers/cclimber.c index 80a6d93ae1e..46ee950b79f 100644 --- a/src/mame/drivers/cclimber.c +++ b/src/mame/drivers/cclimber.c @@ -211,7 +211,7 @@ static UINT8 toprollr_rombank; static WRITE8_HANDLER( swimmer_sh_soundlatch_w ) { soundlatch_w(space,offset,data); - cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff); + cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); } @@ -248,7 +248,7 @@ static WRITE8_HANDLER(toprollr_rombank_w) static TIMER_CALLBACK( disable_interrupts ) { - cpu_interrupt_enable(machine->cpu[0],0); + cpu_interrupt_enable(cputag_get_cpu(machine, "maincpu"), 0); } diff --git a/src/mame/drivers/centiped.c b/src/mame/drivers/centiped.c index f292b208502..ad30a81d57f 100644 --- a/src/mame/drivers/centiped.c +++ b/src/mame/drivers/centiped.c @@ -446,7 +446,7 @@ static TIMER_DEVICE_CALLBACK( generate_interrupt ) /* IRQ is clocked on the rising edge of 16V, equal to the previous 32V */ if (scanline & 16) - cpu_set_input_line(timer->machine->cpu[0], 0, ((scanline - 1) & 32) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(timer->machine, "maincpu", 0, ((scanline - 1) & 32) ? ASSERT_LINE : CLEAR_LINE); /* do a partial update now to handle sprite multiplexing (Maze Invaders) */ video_screen_update_partial(timer->machine->primary_screen, scanline); @@ -463,7 +463,7 @@ static MACHINE_START( centiped ) static MACHINE_RESET( centiped ) { - cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); dsw_select = 0; control_select = 0; } @@ -480,7 +480,7 @@ static MACHINE_RESET( magworm ) static WRITE8_HANDLER( irq_ack_w ) { - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); } @@ -1976,7 +1976,7 @@ ROM_END static DRIVER_INIT( caterplr ) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); const device_config *device = devtag_get_device(machine, "pokey"); memory_install_readwrite8_device_handler(space, device, 0x1000, 0x100f, 0, 0, caterplr_AY8910_r, caterplr_AY8910_w); memory_install_read8_device_handler(space, device, 0x1780, 0x1780, 0, 0, caterplr_rand_r); @@ -1985,7 +1985,7 @@ static DRIVER_INIT( caterplr ) static DRIVER_INIT( magworm ) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); const device_config *device = devtag_get_device(machine, "pokey"); memory_install_write8_device_handler(space, device, 0x1001, 0x1001, 0, 0, ay8910_address_w); memory_install_readwrite8_device_handler(space, device, 0x1003, 0x1003, 0, 0, ay8910_r, ay8910_data_w); diff --git a/src/mame/drivers/cham24.c b/src/mame/drivers/cham24.c index 6a57af22018..e0a5a2cc839 100644 --- a/src/mame/drivers/cham24.c +++ b/src/mame/drivers/cham24.c @@ -213,7 +213,7 @@ static PALETTE_INIT( cham24 ) static void ppu_irq( const device_config *device, int *ppu_regs ) { - cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE ); + cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE ); } /* our ppu interface */ diff --git a/src/mame/drivers/champbas.c b/src/mame/drivers/champbas.c index ee89c6613b6..89bd8468620 100644 --- a/src/mame/drivers/champbas.c +++ b/src/mame/drivers/champbas.c @@ -130,15 +130,15 @@ static WRITE8_HANDLER( irq_enable_w ) { int bit = data & 1; - cpu_interrupt_enable(space->machine->cpu[0],bit); + cpu_interrupt_enable(cputag_get_cpu(space->machine, "maincpu"), bit); if (!bit) - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); } static TIMER_CALLBACK( exctsccr_fm_callback ) { - cpu_set_input_line_and_vector(machine->cpu[1], 0, HOLD_LINE, 0xff ); + cputag_set_input_line_and_vector(machine, "audiocpu", 0, HOLD_LINE, 0xff); } static MACHINE_START( exctsccr ) diff --git a/src/mame/drivers/chanbara.c b/src/mame/drivers/chanbara.c index 806a118bd14..ec1d53b6091 100644 --- a/src/mame/drivers/chanbara.c +++ b/src/mame/drivers/chanbara.c @@ -312,7 +312,7 @@ static WRITE8_DEVICE_HANDLER(chanbara_ay_out_1_w) static void sound_irq(const device_config *device, int linestate) { - cpu_set_input_line(device->machine->cpu[0],0,linestate); + cputag_set_input_line(device->machine, "maincpu", 0, linestate); } diff --git a/src/mame/drivers/changela.c b/src/mame/drivers/changela.c index b620b8b5cea..f836b2d6561 100644 --- a/src/mame/drivers/changela.c +++ b/src/mame/drivers/changela.c @@ -451,10 +451,10 @@ static INTERRUPT_GEN( chl_interrupt ) cpu_set_input_line_and_vector(device, 0, HOLD_LINE, vector); /* it seems the V8 == Vblank and it is connected to the INT on the 68705 */ - //so we should cause an INT on the cpu 1 here, as well. + //so we should cause an INT on the MCU cpu here, as well. //but only once per frame ! if (vector == 0xdf) /* only on vblank */ - generic_pulse_irq_line(device->machine->cpu[1], 0); + generic_pulse_irq_line(cputag_get_cpu(device->machine, "mcu"), 0); } diff --git a/src/mame/drivers/cheekyms.c b/src/mame/drivers/cheekyms.c index 1727c8225b5..147614cd276 100644 --- a/src/mame/drivers/cheekyms.c +++ b/src/mame/drivers/cheekyms.c @@ -27,7 +27,7 @@ static INPUT_CHANGED( coin_inserted ) { /* this starts a 556 one-shot timer (and triggers a sound effect) */ if (newval) - cpu_set_input_line(field->port->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(field->port->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); } diff --git a/src/mame/drivers/chinagat.c b/src/mame/drivers/chinagat.c index 5a82a8a6db3..196f50aa9e8 100644 --- a/src/mame/drivers/chinagat.c +++ b/src/mame/drivers/chinagat.c @@ -150,13 +150,13 @@ static TIMER_DEVICE_CALLBACK( chinagat_scanline ) /* on the rising edge of VBLK (vcount == F8), signal an NMI */ if (vcount == 0xf8) { - cpu_set_input_line(timer->machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE); + cputag_set_input_line(timer->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); } /* set 1ms signal on rising edge of vcount & 8 */ if (!(vcount_old & 8) && (vcount & 8)) { - cpu_set_input_line(timer->machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE); + cputag_set_input_line(timer->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); } /* adjust for next scanline */ @@ -172,23 +172,23 @@ static WRITE8_HANDLER( chinagat_interrupt_w ) { case 0: /* 3e00 - SND irq */ soundlatch_w( space, 0, data ); - cpu_set_input_line(space->machine->cpu[2], sound_irq, (sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); + cputag_set_input_line(space->machine, "audiocpu", sound_irq, (sound_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); break; case 1: /* 3e01 - NMI ack */ - cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); break; case 2: /* 3e02 - FIRQ ack */ - cpu_set_input_line(space->machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE); break; case 3: /* 3e03 - IRQ ack */ - cpu_set_input_line(space->machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE); break; case 4: /* 3e04 - sub CPU IRQ ack */ - cpu_set_input_line(space->machine->cpu[1], sprite_irq, (sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); + cputag_set_input_line(space->machine, "sub", sprite_irq, (sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE ); break; } } @@ -225,7 +225,7 @@ static READ8_HANDLER( saiyugb1_mcu_command_r ) #if 0 if (saiyugb1_mcu_command == 0x78) { - cpu_suspend(space->machine->cpu[3], SUSPEND_REASON_HALT, 1); /* Suspend (speed up) */ + cputag_suspend(space->machine, "mcu", SUSPEND_REASON_HALT, 1); /* Suspend (speed up) */ } #endif return saiyugb1_mcu_command; @@ -237,7 +237,7 @@ static WRITE8_HANDLER( saiyugb1_mcu_command_w ) #if 0 if (data != 0x78) { - cpu_resume(space->machine->cpu[3], SUSPEND_REASON_HALT); /* Wake up */ + cputag_resume(space->machine, "mcu", SUSPEND_REASON_HALT); /* Wake up */ } #endif } @@ -520,7 +520,7 @@ GFXDECODE_END static void chinagat_irq_handler(const device_config *device, int irq) { - cpu_set_input_line(device->machine->cpu[2], 0, irq ? ASSERT_LINE : CLEAR_LINE ); + cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE ); } static const ym2151_interface ym2151_config = diff --git a/src/mame/drivers/chqflag.c b/src/mame/drivers/chqflag.c index 6ae2cd59dc4..ce27e87b11f 100644 --- a/src/mame/drivers/chqflag.c +++ b/src/mame/drivers/chqflag.c @@ -140,7 +140,7 @@ static READ8_HANDLER( analog_read_r ) static WRITE8_HANDLER( chqflag_sh_irqtrigger_w ) { - cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); } @@ -289,7 +289,7 @@ INPUT_PORTS_END static void chqflag_ym2151_irq_w(const device_config *device, int data) { - cpu_set_input_line(device->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE); + cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } diff --git a/src/mame/drivers/cinemat.c b/src/mame/drivers/cinemat.c index ada891f6241..e2213714e01 100644 --- a/src/mame/drivers/cinemat.c +++ b/src/mame/drivers/cinemat.c @@ -280,7 +280,7 @@ static READ8_HANDLER( qb3_frame_r ) static WRITE8_HANDLER( qb3_ram_bank_w ) { - memory_set_bank(space->machine, 1, cpu_get_reg(space->machine->cpu[0], CCPU_P) & 3); + memory_set_bank(space->machine, 1, cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), CCPU_P) & 3); } @@ -1437,34 +1437,34 @@ ROM_END static DRIVER_INIT( speedfrk ) { - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x03, 0, 0, speedfrk_wheel_r); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x04, 0x06, 0, 0, speedfrk_gear_r); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x00, 0x03, 0, 0, speedfrk_wheel_r); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x04, 0x06, 0, 0, speedfrk_gear_r); } static DRIVER_INIT( sundance ) { - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x0f, 0, 0, sundance_inputs_r); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x00, 0x0f, 0, 0, sundance_inputs_r); } static DRIVER_INIT( tailg ) { - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, mux_select_w); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, mux_select_w); } static DRIVER_INIT( boxingb ) { - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0c, 0x0f, 0, 0, boxingb_dial_r); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, mux_select_w); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x0c, 0x0f, 0, 0, boxingb_dial_r); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, mux_select_w); } static DRIVER_INIT( qb3 ) { - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, qb3_frame_r); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0, qb3_ram_bank_w); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, qb3_frame_r); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0, qb3_ram_bank_w); memory_configure_bank(machine, 1, 0, 4, rambase, 0x100*2); } diff --git a/src/mame/drivers/circusc.c b/src/mame/drivers/circusc.c index 33e8f63a9bb..bbeb1aefc31 100644 --- a/src/mame/drivers/circusc.c +++ b/src/mame/drivers/circusc.c @@ -104,7 +104,7 @@ static READ8_HANDLER( circusc_sh_timer_r ) static WRITE8_HANDLER( circusc_sh_irqtrigger_w ) { - cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff); + cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); } static WRITE8_HANDLER( circusc_coin_counter_w ) diff --git a/src/mame/drivers/cischeat.c b/src/mame/drivers/cischeat.c index 0d9fd4dbbd6..197e6350299 100644 --- a/src/mame/drivers/cischeat.c +++ b/src/mame/drivers/cischeat.c @@ -2520,7 +2520,7 @@ ROM_END static DRIVER_INIT( wildplt ) { - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x080000, 0x087fff, 0, 0, wildplt_vregs_r ); + memory_install_read16_handler(cputag_get_address_space(machine, "cpu1", ADDRESS_SPACE_PROGRAM), 0x080000, 0x087fff, 0, 0, wildplt_vregs_r ); DRIVER_INIT_CALL(f1gpstar); } diff --git a/src/mame/drivers/cliffhgr.c b/src/mame/drivers/cliffhgr.c index 8e4cc1f8299..6a67b334bd2 100644 --- a/src/mame/drivers/cliffhgr.c +++ b/src/mame/drivers/cliffhgr.c @@ -137,7 +137,7 @@ static WRITE8_HANDLER( cliff_coin_counter_w ) static READ8_HANDLER( cliff_irq_ack_r ) { /* deassert IRQ on the CPU */ - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); return 0x00; } @@ -197,14 +197,14 @@ static TIMER_CALLBACK( cliff_irq_callback ) /* if we have a valid code, trigger an IRQ */ if ( phillips_code & 0x800000 ) - cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); timer_adjust_oneshot(irq_timer, video_screen_get_time_until_pos(machine->primary_screen, param, 0), param); } static void vdp_interrupt (running_machine *machine, int state) { - cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE ); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE ); } diff --git a/src/mame/drivers/cloak.c b/src/mame/drivers/cloak.c index ccf46570c1e..72aa5dba060 100644 --- a/src/mame/drivers/cloak.c +++ b/src/mame/drivers/cloak.c @@ -144,12 +144,12 @@ static WRITE8_HANDLER( cloak_custom_w ) static WRITE8_HANDLER( cloak_irq_reset_0_w ) { - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); } static WRITE8_HANDLER( cloak_irq_reset_1_w ) { - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "slave", 0, CLEAR_LINE); } static WRITE8_HANDLER( cloak_nvram_enable_w ) diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c index a3c5a061c84..a9e998ae943 100644 --- a/src/mame/drivers/cloud9.c +++ b/src/mame/drivers/cloud9.c @@ -141,7 +141,7 @@ static TIMER_CALLBACK( clock_irq ) /* assert the IRQ if not already asserted */ if (!irq_state) { - cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); irq_state = 1; } @@ -212,7 +212,7 @@ static MACHINE_START( cloud9 ) static MACHINE_RESET( cloud9 ) { - cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); irq_state = 0; } @@ -228,7 +228,7 @@ static WRITE8_HANDLER( irq_ack_w ) { if (irq_state) { - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); irq_state = 0; } } diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c index 8b2e79e4fb1..088345b0629 100644 --- a/src/mame/drivers/cninja.c +++ b/src/mame/drivers/cninja.c @@ -61,13 +61,13 @@ static UINT16 *cninja_ram; static WRITE16_HANDLER( cninja_sound_w ) { soundlatch_w(space,0,data&0xff); - cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); } static WRITE16_HANDLER( stoneage_sound_w ) { soundlatch_w(space,0,data&0xff); - cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } static TIMER_CALLBACK( interrupt_gen ) @@ -75,18 +75,18 @@ static TIMER_CALLBACK( interrupt_gen ) int scanline = param; /* Save state of scroll registers before the IRQ */ - deco16_raster_display_list[deco16_raster_display_position++]=scanline; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf12_control[1]&0xffff; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf12_control[2]&0xffff; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf12_control[3]&0xffff; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf12_control[4]&0xffff; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf34_control[1]&0xffff; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf34_control[2]&0xffff; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf34_control[3]&0xffff; - deco16_raster_display_list[deco16_raster_display_position++]=deco16_pf34_control[4]&0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = scanline; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf12_control[1] & 0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf12_control[2] & 0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf12_control[3] & 0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf12_control[4] & 0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf34_control[1] & 0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf34_control[2] & 0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf34_control[3] & 0xffff; + deco16_raster_display_list[deco16_raster_display_position++] = deco16_pf34_control[4] & 0xffff; - cpu_set_input_line(machine->cpu[0], (cninja_irq_mask&0x10) ? 3 : 4, ASSERT_LINE); - timer_adjust_oneshot(raster_irq_timer,attotime_never,0); + cputag_set_input_line(machine, "maincpu", (cninja_irq_mask&0x10) ? 3 : 4, ASSERT_LINE); + timer_adjust_oneshot(raster_irq_timer, attotime_never, 0); } static READ16_HANDLER( cninja_irq_r ) @@ -97,8 +97,8 @@ static READ16_HANDLER( cninja_irq_r ) return cninja_scanline; case 2: /* Raster IRQ ACK - value read is not used */ - cpu_set_input_line(space->machine->cpu[0], 3, CLEAR_LINE); - cpu_set_input_line(space->machine->cpu[0], 4, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 3, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 4, CLEAR_LINE); return 0; } @@ -661,12 +661,12 @@ static MACHINE_RESET( cninja ) static void sound_irq(const device_config *device, int state) { - cpu_set_input_line(device->machine->cpu[1],1,state); /* IRQ 2 */ + cputag_set_input_line(device->machine, "audiocpu", 1, state); /* IRQ 2 */ } static void sound_irq2(const device_config *device, int state) { - cpu_set_input_line(device->machine->cpu[1],0,state); + cputag_set_input_line(device->machine, "audiocpu", 0, state); } static WRITE8_DEVICE_HANDLER( sound_bankswitch_w ) @@ -1681,13 +1681,13 @@ static void cninja_patch(running_machine *machine) static DRIVER_INIT( cninja ) { - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1bc0a8, 0x1bc0a9, 0, 0, cninja_sound_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1bc0a8, 0x1bc0a9, 0, 0, cninja_sound_w); cninja_patch(machine); } static DRIVER_INIT( stoneage ) { - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1bc0a8, 0x1bc0a9, 0, 0, stoneage_sound_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1bc0a8, 0x1bc0a9, 0, 0, stoneage_sound_w); } static DRIVER_INIT( mutantf ) diff --git a/src/mame/drivers/cntsteer.c b/src/mame/drivers/cntsteer.c index a84c0f5c00f..38577fad3ce 100644 --- a/src/mame/drivers/cntsteer.c +++ b/src/mame/drivers/cntsteer.c @@ -386,42 +386,42 @@ static WRITE8_HANDLER( cntsteer_background_w ) static WRITE8_HANDLER( gekitsui_sub_irq_ack ) { - cpu_set_input_line(space->machine->cpu[1], M6809_IRQ_LINE, CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", M6809_IRQ_LINE, CLEAR_LINE); } static WRITE8_HANDLER( cntsteer_sound_w ) { soundlatch_w(space,0,data); - cpu_set_input_line(space->machine->cpu[2], 0, HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); } static WRITE8_HANDLER( zerotrgt_ctrl_w ) { /*TODO: check this.*/ logerror("CTRL: %04x: %04x: %04x\n",cpu_get_pc(space->cpu),offset,data); -// if (offset==0) cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); +// if (offset==0) cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE); // Wrong - bits 0 & 1 used on this - if (offset==1) cpu_set_input_line(space->machine->cpu[1], M6809_IRQ_LINE, ASSERT_LINE); -// if (offset==2) cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); + if (offset==1) cputag_set_input_line(space->machine, "audiocpu", M6809_IRQ_LINE, ASSERT_LINE); +// if (offset==2) cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, CLEAR_LINE); } static WRITE8_HANDLER( cntsteer_sub_irq_w ) { - cpu_set_input_line(space->machine->cpu[1], M6809_IRQ_LINE, ASSERT_LINE); + cputag_set_input_line(space->machine, "audiocpu", M6809_IRQ_LINE, ASSERT_LINE); // printf("%02x IRQ\n",data); } static WRITE8_HANDLER( cntsteer_sub_nmi_w ) { // if(data) -// cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); +// cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); // popmessage("%02x",data); } static WRITE8_HANDLER( cntsteer_main_irq_w ) { - cpu_set_input_line(space->machine->cpu[0], M6809_IRQ_LINE, HOLD_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, HOLD_LINE); } /* Convert weird input handling with MAME standards.*/ @@ -588,7 +588,7 @@ INPUT_PORTS_END static INPUT_CHANGED( coin_inserted ) { - cpu_set_input_line(field->port->machine->cpu[1], INPUT_LINE_NMI, newval ? CLEAR_LINE : PULSE_LINE); + cputag_set_input_line(field->port->machine, "audiocpu", INPUT_LINE_NMI, newval ? CLEAR_LINE : PULSE_LINE); } static INPUT_PORTS_START( cntsteer ) diff --git a/src/mame/drivers/cojag.c b/src/mame/drivers/cojag.c index 432607717c4..7496ae8afc2 100644 --- a/src/mame/drivers/cojag.c +++ b/src/mame/drivers/cojag.c @@ -369,8 +369,8 @@ static MACHINE_RESET( cojag ) jaguar_dsp_resume(machine); /* halt the CPUs */ - jaguargpu_ctrl_w(machine->cpu[1], G_CTRL, 0, 0xffffffff); - jaguardsp_ctrl_w(machine->cpu[2], D_CTRL, 0, 0xffffffff); + jaguargpu_ctrl_w(cputag_get_cpu(machine, "gpu"), G_CTRL, 0, 0xffffffff); + jaguardsp_ctrl_w(cputag_get_cpu(machine, "audiocpu"), D_CTRL, 0, 0xffffffff); /* init the sound system */ cojag_sound_reset(machine); @@ -419,8 +419,8 @@ static WRITE32_HANDLER( misc_control_w ) jaguar_dsp_resume(space->machine); /* halt the CPUs */ - jaguargpu_ctrl_w(space->machine->cpu[1], G_CTRL, 0, 0xffffffff); - jaguardsp_ctrl_w(space->machine->cpu[2], D_CTRL, 0, 0xffffffff); + jaguargpu_ctrl_w(cputag_get_cpu(space->machine, "gpu"), G_CTRL, 0, 0xffffffff); + jaguardsp_ctrl_w(cputag_get_cpu(space->machine, "audiocpu"), D_CTRL, 0, 0xffffffff); } /* adjust banking */ @@ -443,13 +443,13 @@ static WRITE32_HANDLER( misc_control_w ) static READ32_HANDLER( gpuctrl_r ) { - return jaguargpu_ctrl_r(space->machine->cpu[1], offset); + return jaguargpu_ctrl_r(cputag_get_cpu(space->machine, "gpu"), offset); } static WRITE32_HANDLER( gpuctrl_w ) { - jaguargpu_ctrl_w(space->machine->cpu[1], offset, data, mem_mask); + jaguargpu_ctrl_w(cputag_get_cpu(space->machine, "gpu"), offset, data, mem_mask); } @@ -462,13 +462,13 @@ static WRITE32_HANDLER( gpuctrl_w ) static READ32_HANDLER( dspctrl_r ) { - return jaguardsp_ctrl_r(space->machine->cpu[2], offset); + return jaguardsp_ctrl_r(cputag_get_cpu(space->machine, "audiocpu"), offset); } static WRITE32_HANDLER( dspctrl_w ) { - jaguardsp_ctrl_w(space->machine->cpu[2], offset, data, mem_mask); + jaguardsp_ctrl_w(cputag_get_cpu(space->machine, "audiocpu"), offset, data, mem_mask); } @@ -1505,14 +1505,14 @@ ROM_END static void cojag_common_init(running_machine *machine, UINT16 gpu_jump_offs, UINT16 spin_pc) { /* copy over the ROM */ - cojag_is_r3000 = (cpu_get_type(machine->cpu[0]) == CPU_R3041BE); + cojag_is_r3000 = (cpu_get_type(cputag_get_cpu(machine, "maincpu")) == CPU_R3041BE); /* install synchronization hooks for GPU */ if (cojag_is_r3000) - memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, 0, 0, gpu_jump_w); + memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, 0, 0, gpu_jump_w); else - memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, 0, 0, gpu_jump_w); - memory_install_read32_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, 0, 0, gpu_jump_r); + memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, 0, 0, gpu_jump_w); + memory_install_read32_handler(cputag_get_address_space(machine, "gpu", ADDRESS_SPACE_PROGRAM), 0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, 0, 0, gpu_jump_r); gpu_jump_address = &jaguar_gpu_ram[gpu_jump_offs/4]; gpu_spin_pc = 0xf03000 + spin_pc; @@ -1527,7 +1527,7 @@ static DRIVER_INIT( area51a ) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - main_speedup = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa02030, 0xa02033, 0, 0, area51_main_speedup_w); + main_speedup = memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa02030, 0xa02033, 0, 0, area51_main_speedup_w); #endif } @@ -1539,7 +1539,7 @@ static DRIVER_INIT( area51 ) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ main_speedup_max_cycles = 120; - main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100062e8, 0x100062eb, 0, 0, cojagr3k_main_speedup_r); + main_speedup = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x100062e8, 0x100062eb, 0, 0, cojagr3k_main_speedup_r); #endif } @@ -1553,7 +1553,7 @@ static DRIVER_INIT( maxforce ) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ main_speedup_max_cycles = 120; - main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000865c, 0x1000865f, 0, 0, cojagr3k_main_speedup_r); + main_speedup = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1000865c, 0x1000865f, 0, 0, cojagr3k_main_speedup_r); #endif } @@ -1567,7 +1567,7 @@ static DRIVER_INIT( area51mx ) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - main_speedup = memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa19550, 0xa19557, 0, 0, area51mx_main_speedup_w); + main_speedup = memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa19550, 0xa19557, 0, 0, area51mx_main_speedup_w); #endif } @@ -1582,7 +1582,7 @@ static DRIVER_INIT( a51mxr3k ) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ main_speedup_max_cycles = 120; - main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x10006f0c, 0x10006f0f, 0, 0, cojagr3k_main_speedup_r); + main_speedup = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x10006f0c, 0x10006f0f, 0, 0, cojagr3k_main_speedup_r); #endif } @@ -1594,7 +1594,7 @@ static DRIVER_INIT( fishfren ) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ main_speedup_max_cycles = 200; - main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x10021b60, 0x10021b63, 0, 0, cojagr3k_main_speedup_r); + main_speedup = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x10021b60, 0x10021b63, 0, 0, cojagr3k_main_speedup_r); #endif } @@ -1607,8 +1607,8 @@ static void init_freeze_common(running_machine *machine, offs_t main_speedup_add /* install speedup for main CPU */ main_speedup_max_cycles = 200; if (main_speedup_addr != 0) - main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), main_speedup_addr, main_speedup_addr + 3, 0, 0, cojagr3k_main_speedup_r); - main_gpu_wait = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0400d900, 0x0400d900 + 3, 0, 0, main_gpu_wait_r); + main_speedup = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), main_speedup_addr, main_speedup_addr + 3, 0, 0, cojagr3k_main_speedup_r); + main_gpu_wait = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0400d900, 0x0400d900 + 3, 0, 0, main_gpu_wait_r); #endif } @@ -1627,7 +1627,7 @@ static DRIVER_INIT( vcircle ) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ main_speedup_max_cycles = 50; - main_speedup = memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x12005b34, 0x12005b37, 0, 0, cojagr3k_main_speedup_r); + main_speedup = memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x12005b34, 0x12005b37, 0, 0, cojagr3k_main_speedup_r); #endif } diff --git a/src/mame/drivers/combatsc.c b/src/mame/drivers/combatsc.c index 2b150a8eac4..40230deb2db 100644 --- a/src/mame/drivers/combatsc.c +++ b/src/mame/drivers/combatsc.c @@ -219,7 +219,7 @@ static WRITE8_HANDLER( protection_clock_w ) static WRITE8_HANDLER( combasc_sh_irqtrigger_w ) { - cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff); + cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); } static READ8_DEVICE_HANDLER( combasc_busy_r ) @@ -249,12 +249,12 @@ static READ8_DEVICE_HANDLER ( combasc_ym2203_r ) static int boost = 1; int status = ym2203_r(device,offset); - if (cpu_get_pc(device->machine->cpu[1]) == 0x334) + if (cpu_get_pc(cputag_get_cpu(device->machine, "audiocpu")) == 0x334) { if (boost) { boost = 0; - timer_adjust_periodic(combasc_interleave_timer, attotime_zero, 0, cpu_clocks_to_attotime(device->machine->cpu[1],80)); + timer_adjust_periodic(combasc_interleave_timer, attotime_zero, 0, cputag_clocks_to_attotime(device->machine, "audiocpu", 80)); } else if (status & 2) { @@ -801,7 +801,7 @@ static DRIVER_INIT( combasct ) static DRIVER_INIT( combasc ) { /* joystick instead of trackball */ - memory_install_read_port_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0404, 0x0404, 0, 0, "IN1"); + memory_install_read_port_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0404, 0x0404, 0, 0, "IN1"); combasc_init_common(machine); } diff --git a/src/mame/drivers/compgolf.c b/src/mame/drivers/compgolf.c index ed3fd70afc7..c07e1f08e2e 100644 --- a/src/mame/drivers/compgolf.c +++ b/src/mame/drivers/compgolf.c @@ -181,7 +181,7 @@ GFXDECODE_END static void sound_irq(const device_config *device, int linestate) { - cpu_set_input_line(device->machine->cpu[0],0,linestate); + cputag_set_input_line(device->machine, "maincpu", 0, linestate); } static const ym2203_interface ym2203_config = diff --git a/src/mame/drivers/contra.c b/src/mame/drivers/contra.c index bc4dd40990f..427d2d40333 100644 --- a/src/mame/drivers/contra.c +++ b/src/mame/drivers/contra.c @@ -53,7 +53,7 @@ static WRITE8_HANDLER( contra_bankswitch_w ) static WRITE8_HANDLER( contra_sh_irqtrigger_w ) { - cpu_set_input_line(space->machine->cpu[1],M6809_IRQ_LINE,HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", M6809_IRQ_LINE, HOLD_LINE); } static WRITE8_HANDLER( contra_coin_counter_w ) diff --git a/src/mame/drivers/coolpool.c b/src/mame/drivers/coolpool.c index b104b8a77b4..afdb096f3e5 100644 --- a/src/mame/drivers/coolpool.c +++ b/src/mame/drivers/coolpool.c @@ -220,7 +220,7 @@ static WRITE16_HANDLER( amerdart_misc_w ) coin_counter_w(0, ~data & 0x0001); coin_counter_w(1, ~data & 0x0002); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "dsp", INPUT_LINE_RESET, (data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); /* bits 10-15 are counted down over time */ if (data & 0x0400) amerdart_iop_echo = 1; @@ -233,7 +233,7 @@ static TIMER_CALLBACK( amerdart_iop_response ) iop_answer = iop_cmd; if (amerdart_iop_echo && iop_cmd != 0x19) { - cpu_set_input_line(machine->cpu[0], 1, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE); return; } amerdart_iop_echo = 0; @@ -271,7 +271,7 @@ static TIMER_CALLBACK( amerdart_iop_response ) break; } - cpu_set_input_line(machine->cpu[0], 1, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE); } @@ -297,7 +297,7 @@ static WRITE16_HANDLER( coolpool_misc_w ) coin_counter_w(0, ~data & 0x0001); coin_counter_w(1, ~data & 0x0002); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "dsp", INPUT_LINE_RESET, (data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); } @@ -313,9 +313,9 @@ static TIMER_CALLBACK( deferred_iop_w ) { iop_cmd = param; cmd_pending = 1; - cpu_set_input_line(machine->cpu[1], 0, HOLD_LINE); /* ??? I have no idea who should generate this! */ - /* the DSP polls the status bit so it isn't strictly */ - /* necessary to also have an IRQ */ + cputag_set_input_line(machine, "dsp", 0, HOLD_LINE); /* ??? I have no idea who should generate this! */ + /* the DSP polls the status bit so it isn't strictly */ + /* necessary to also have an IRQ */ cpuexec_boost_interleave(machine, attotime_zero, ATTOTIME_IN_USEC(50)); } @@ -330,7 +330,7 @@ static WRITE16_HANDLER( coolpool_iop_w ) static READ16_HANDLER( coolpool_iop_r ) { logerror("%08x:IOP read %04x\n",cpu_get_pc(space->cpu),iop_answer); - cpu_set_input_line(space->machine->cpu[0], 1, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 1, CLEAR_LINE); return iop_answer; } @@ -347,16 +347,16 @@ static READ16_HANDLER( coolpool_iop_r ) static READ16_HANDLER( dsp_cmd_r ) { cmd_pending = 0; - logerror("%08x:IOP cmd_r %04x\n",cpu_get_pc(space->cpu),iop_cmd); + logerror("%08x:IOP cmd_r %04x\n", cpu_get_pc(space->cpu), iop_cmd); return iop_cmd; } static WRITE16_HANDLER( dsp_answer_w ) { - logerror("%08x:IOP answer %04x\n",cpu_get_pc(space->cpu),data); + logerror("%08x:IOP answer %04x\n", cpu_get_pc(space->cpu), data); iop_answer = data; - cpu_set_input_line(space->machine->cpu[0], 1, ASSERT_LINE); + cputag_set_input_line(space->machine, "maincpu", 1, ASSERT_LINE); } @@ -955,7 +955,7 @@ ROM_END static DRIVER_INIT( coolpool ) { - memory_install_read16_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, coolpool_input_r); + memory_install_read16_handler(cputag_get_address_space(machine, "dsp", ADDRESS_SPACE_IO), 0x07, 0x07, 0, 0, coolpool_input_r); } diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c index d63392ea945..7408106c5c3 100644 --- a/src/mame/drivers/coolridr.c +++ b/src/mame/drivers/coolridr.c @@ -239,8 +239,8 @@ static INTERRUPT_GEN( system_h1_sub ) static MACHINE_RESET ( coolridr ) { -// cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, ASSERT_LINE); - cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE); +// cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE); + cputag_set_input_line(machine, "soundcpu", INPUT_LINE_HALT, ASSERT_LINE); } @@ -322,7 +322,7 @@ static READ32_HANDLER( coolridr_hack_r ) static DRIVER_INIT( coolridr ) { - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60d88a4, 0x060d88a7, 0, 0, coolridr_hack_r ); + memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x60d88a4, 0x060d88a7, 0, 0, coolridr_hack_r ); } GAME( 1995, coolridr, 0, coolridr, 0, coolridr, ROT0, "Sega", "Cool Riders",GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/cop01.c b/src/mame/drivers/cop01.c index 1ce9aee65bc..b0fdbe66665 100644 --- a/src/mame/drivers/cop01.c +++ b/src/mame/drivers/cop01.c @@ -70,7 +70,7 @@ WRITE8_HANDLER( cop01_vreg_w ); static WRITE8_HANDLER( cop01_sound_command_w ) { soundlatch_w(space,offset,data); - cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff); + cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); } static READ8_HANDLER( cop01_sound_command_r ) diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c index bd3f529b29a..e573df82441 100644 --- a/src/mame/drivers/cosmic.c +++ b/src/mame/drivers/cosmic.c @@ -1570,17 +1570,17 @@ static DRIVER_INIT( cosmicg ) static DRIVER_INIT( devzone ) { - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w); } static DRIVER_INIT( nomnlnd ) { const device_config *dac = devtag_get_device(machine, "dac"); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x5001, 0, 0, nomnlnd_port_0_1_r); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4800, 0x4800, 0, 0, (write8_space_func)SMH_NOP); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w); - memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), dac, 0x480a, 0x480a, 0, 0, dac_w); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5000, 0x5001, 0, 0, nomnlnd_port_0_1_r); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4800, 0x4800, 0, 0, (write8_space_func)SMH_NOP); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4807, 0x4807, 0, 0, cosmic_background_enable_w); + memory_install_write8_device_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), dac, 0x480a, 0x480a, 0, 0, dac_w); } @@ -1598,4 +1598,3 @@ GAME( 1980, panich, panic, panic, panic, 0, ROT270, "Universal", GAME( 1980, panicger, panic, panic, panic, 0, ROT270, "Universal (ADP Automaten license)", "Space Panic (German)", 0 ) GAME( 1980, devzone, 0, devzone, devzone, devzone, ROT270, "Universal", "Devil Zone", GAME_IMPERFECT_SOUND ) GAME( 1980, devzone2, devzone, devzone, devzone2, devzone, ROT270, "Universal", "Devil Zone (easier)", GAME_IMPERFECT_SOUND ) - diff --git a/src/mame/drivers/cowrace.c b/src/mame/drivers/cowrace.c index 25076e4ce41..cc41c12a3e9 100644 --- a/src/mame/drivers/cowrace.c +++ b/src/mame/drivers/cowrace.c @@ -43,7 +43,7 @@ static VIDEO_START( cowrace ) static VIDEO_UPDATE( cowrace ) { - tilemap_draw(bitmap,cliprect, tmap, 0, 0); + tilemap_draw(bitmap, cliprect, tmap, 0, 0); return 0; } @@ -51,7 +51,7 @@ static VIDEO_UPDATE( cowrace ) static WRITE8_HANDLER( cowrace_soundlatch_w ) { soundlatch_w(0, data); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } #endif diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c index c55cc215bc4..6958818e078 100644 --- a/src/mame/drivers/cps1.c +++ b/src/mame/drivers/cps1.c @@ -2736,7 +2736,7 @@ GFXDECODE_END static void cps1_irq_handler_mus(const device_config *device, int irq) { - cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); } static const ym2151_interface ym2151_config = @@ -2892,7 +2892,7 @@ static void m5205_int1(const device_config *device) // sample_buffer1 >>= 4; // sample_select1 ^= 1; // if (sample_select1 == 0) -// cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); +// cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } static void m5205_int2(const device_config *device) @@ -8268,10 +8268,10 @@ static DRIVER_INIT( forgottn ) { /* Forgotten Worlds has a NEC uPD4701AC on the B-board handling dial inputs from the CN-MOWS connector. */ /* The memory mapping is handled by PAL LWIO */ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800040, 0x800041, 0, 0, forgottn_dial_0_reset_w); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800048, 0x800049, 0, 0, forgottn_dial_1_reset_w); - memory_install_read16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800052, 0x800055, 0, 0, forgottn_dial_0_r); - memory_install_read16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80005a, 0x80005d, 0, 0, forgottn_dial_1_r); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x800040, 0x800041, 0, 0, forgottn_dial_0_reset_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x800048, 0x800049, 0, 0, forgottn_dial_1_reset_w); + memory_install_read16_handler (cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x800052, 0x800055, 0, 0, forgottn_dial_0_r); + memory_install_read16_handler (cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x80005a, 0x80005d, 0, 0, forgottn_dial_1_r); DRIVER_INIT_CALL(cps1); } @@ -8280,8 +8280,8 @@ static DRIVER_INIT( sf2ue ) { /* This specific version of SF2 has the CPS-B custom mapped at a different address. */ /* The mapping is handled by a PAL on the B-board */ - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800140, 0x80017f, 0, 0, (read16_space_func)SMH_UNMAP, (write16_space_func)SMH_UNMAP); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8001c0, 0x8001ff, 0, 0, cps1_cps_b_r, cps1_cps_b_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x800140, 0x80017f, 0, 0, (read16_space_func)SMH_UNMAP, (write16_space_func)SMH_UNMAP); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8001c0, 0x8001ff, 0, 0, cps1_cps_b_r, cps1_cps_b_w); DRIVER_INIT_CALL(cps1); } @@ -8289,7 +8289,7 @@ static DRIVER_INIT( sf2ue ) static DRIVER_INIT( sf2hack ) { /* some SF2 hacks have some inputs wired to the LSB instead of MSB */ - memory_install_read16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800018, 0x80001f, 0, 0, cps1_hack_dsw_r); + memory_install_read16_handler (cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x800018, 0x80001f, 0, 0, cps1_hack_dsw_r); DRIVER_INIT_CALL(cps1); } @@ -8322,7 +8322,7 @@ static DRIVER_INIT( pang3 ) { /* Pang 3 is the only non-QSound game to have an EEPROM. */ /* It is mapped in the CPS-B address range so probably is on the C-board. */ - memory_install_readwrite16_handler (cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80017a, 0x80017b, 0, 0, cps1_eeprom_port_r, cps1_eeprom_port_w); + memory_install_readwrite16_handler (cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x80017a, 0x80017b, 0, 0, cps1_eeprom_port_r, cps1_eeprom_port_w); DRIVER_INIT_CALL(cps1); } @@ -8373,11 +8373,11 @@ static DRIVER_INIT( sf2mdt ) rom[i+3] = rom[i+6]; rom[i+6] = tmp; } - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c01a, 0x70c01b, 0, 0, sf2mdt_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c01c, 0x70c01d, 0, 0, sf2mdt_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c01e, 0x70c01f, 0, 0, sf2mdt_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c010, 0x70c011, 0, 0, sf2mdt_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x70c018, 0x70c019, 0, 0, sf2mdt_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x70c01a, 0x70c01b, 0, 0, sf2mdt_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x70c01c, 0x70c01d, 0, 0, sf2mdt_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x70c01e, 0x70c01f, 0, 0, sf2mdt_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x70c010, 0x70c011, 0, 0, sf2mdt_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x70c018, 0x70c019, 0, 0, sf2mdt_r); DRIVER_INIT_CALL(cps1); } diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c index 103f0d65b25..c6ad5177fe9 100644 --- a/src/mame/drivers/cps2.c +++ b/src/mame/drivers/cps2.c @@ -753,7 +753,8 @@ static WRITE16_HANDLER( cps2_eeprom_port_w ) /* bit 7 - */ /* Z80 Reset */ - if (space->machine->cpu[1]) cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x0008) ? CLEAR_LINE : ASSERT_LINE); + if (cputag_get_cpu(space->machine, "audiocpu")) + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, (data & 0x0008) ? CLEAR_LINE : ASSERT_LINE); coin_counter_w(0, data & 0x0001); if( (strncmp(space->machine->gamedrv->name,"pzloop2",8)==0) || @@ -7403,7 +7404,7 @@ static DRIVER_INIT( cps2 ) DRIVER_INIT_CALL(cps2crpt); cps2networkpresent = 0; - cpu_set_clockscale(machine->cpu[0], 0.7375f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */ + cpu_set_clockscale(cputag_get_cpu(machine, "maincpu"), 0.7375f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */ } static DRIVER_INIT( ssf2tb ) @@ -7420,7 +7421,7 @@ static DRIVER_INIT( ssf2tb ) static DRIVER_INIT ( pzloop2 ) { DRIVER_INIT_CALL(cps2); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x804000, 0x804001, 0, 0, joy_or_paddle_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x804000, 0x804001, 0, 0, joy_or_paddle_r); } static UINT16* gigamn2_dummyqsound_ram; @@ -7436,9 +7437,9 @@ static DRIVER_INIT( gigamn2 ) DRIVER_INIT_CALL(cps2); gigamn2_dummyqsound_ram = auto_alloc_array(machine, UINT16, 0x20000/2); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x618000, 0x619fff, 0, 0, gigamn2_dummyqsound_r, gigamn2_dummyqsound_w); // no qsound.. + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x618000, 0x619fff, 0, 0, gigamn2_dummyqsound_r, gigamn2_dummyqsound_w); // no qsound.. memory_set_decrypted_region(space, 0x000000, (length) - 1, &rom[length/4]); - m68k_set_encrypted_opcode_range(machine->cpu[0],0,length); + m68k_set_encrypted_opcode_range(cputag_get_cpu(machine, "maincpu"), 0, length); } diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 96c0aec5263..2d6124a5e9a 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -694,7 +694,7 @@ static DRIVER_INIT( cps3 ) if (!cps3_user5region) cps3_user5region = auto_alloc_array(machine, UINT8, USER5REGION_LENGTH); // set strict verify - sh2drc_set_options(machine->cpu[0], SH2DRC_STRICT_VERIFY); + sh2drc_set_options(cputag_get_cpu(machine, "maincpu"), SH2DRC_STRICT_VERIFY); cps3_decrypt_bios(machine); decrypted_gamerom = auto_alloc_array(machine, UINT32, 0x1000000/4); @@ -706,7 +706,7 @@ static DRIVER_INIT( cps3 ) cps3_0xc0000000_ram_decrypted = auto_alloc_array(machine, UINT32, 0x400/4); - memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), cps3_direct_handler); + memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), cps3_direct_handler); // flash roms @@ -1806,7 +1806,7 @@ static WRITE32_HANDLER( cps3_palettedma_w ) } - cpu_set_input_line(space->machine->cpu[0],10, ASSERT_LINE); + cputag_set_input_line(space->machine, "maincpu", 10, ASSERT_LINE); } @@ -2002,43 +2002,43 @@ static void cps3_process_character_dma(running_machine *machine, UINT32 address) //printf("charDMA start:\n"); - for (i=0;i<0x1000;i+=3) + for (i = 0; i < 0x1000; i += 3) { - UINT32 dat1 = LITTLE_ENDIANIZE_INT32(cps3_char_ram[i+0+(address)]); - UINT32 dat2 = LITTLE_ENDIANIZE_INT32(cps3_char_ram[i+1+(address)]); - UINT32 dat3 = LITTLE_ENDIANIZE_INT32(cps3_char_ram[i+2+(address)]); - UINT32 real_source = (dat3<<1)-0x400000; - UINT32 real_destination = dat2<<3; - UINT32 real_length = (((dat1&0x001fffff)+1)<<3); + UINT32 dat1 = LITTLE_ENDIANIZE_INT32(cps3_char_ram[i + 0 + (address)]); + UINT32 dat2 = LITTLE_ENDIANIZE_INT32(cps3_char_ram[i + 1 + (address)]); + UINT32 dat3 = LITTLE_ENDIANIZE_INT32(cps3_char_ram[i + 2 + (address)]); + UINT32 real_source = (dat3 << 1) - 0x400000; + UINT32 real_destination = dat2 << 3; + UINT32 real_length = (((dat1 & 0x001fffff) + 1) << 3); /* 0x01000000 is the end of list marker, 0x13131313 is our default fill */ - if ((dat1==0x01000000) || (dat1==0x13131313)) break; + if ((dat1 == 0x01000000) || (dat1 == 0x13131313)) break; //printf("%08x %08x %08x real_source %08x (rom %d offset %08x) real_destination %08x, real_length %08x\n", dat1, dat2, dat3, real_source, real_source/0x800000, real_source%0x800000, real_destination, real_length); - if ( (dat1&0x00e00000) ==0x00800000 ) + if ((dat1 & 0x00e00000) == 0x00800000) { /* Sets a table used by the decompression routines */ { /* We should probably copy this, but a pointer to it is fine for our purposes as the data doesn't change */ current_table_address = real_source; } - cpu_set_input_line(machine->cpu[0],10, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 10, ASSERT_LINE); } - else if ( (dat1&0x00e00000) ==0x00400000 ) + else if ((dat1 & 0x00e00000) == 0x00400000) { /* 6bpp DMA decompression - this is used for the majority of sprites and backgrounds */ cps3_do_char_dma( machine, real_source, real_destination, real_length ); - cpu_set_input_line(machine->cpu[0],10, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 10, ASSERT_LINE); } - else if ( (dat1&0x00e00000) ==0x00600000 ) + else if ((dat1 & 0x00e00000) == 0x00600000) { /* 8bpp DMA decompression - this is used on SFIII NG Sean's Stage ONLY */ cps3_do_alt_char_dma( machine, real_source, real_destination, real_length); - cpu_set_input_line(machine->cpu[0],10, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 10, ASSERT_LINE); } else { @@ -2095,12 +2095,12 @@ static WRITE32_HANDLER( cps3_characterdma_w ) static WRITE32_HANDLER( cps3_irq10_ack_w ) { - cpu_set_input_line(space->machine->cpu[0],10, CLEAR_LINE); return; + cputag_set_input_line(space->machine, "maincpu", 10, CLEAR_LINE); return; } static WRITE32_HANDLER( cps3_irq12_ack_w ) { - cpu_set_input_line(space->machine->cpu[0],12, CLEAR_LINE); return; + cputag_set_input_line(space->machine, "maincpu", 12, CLEAR_LINE); return; } static WRITE32_HANDLER( cps3_unk_vidregs_w ) diff --git a/src/mame/drivers/crbaloon.c b/src/mame/drivers/crbaloon.c index 052c57a4687..9345fb5175b 100644 --- a/src/mame/drivers/crbaloon.c +++ b/src/mame/drivers/crbaloon.c @@ -163,7 +163,7 @@ static WRITE8_HANDLER( port_sound_w ) const device_config *sn = devtag_get_device(space->machine, "sn"); /* D0 - interrupt enable - also goes to PC3259 as /HTCTRL */ - cpu_interrupt_enable(space->machine->cpu[0], (data & 0x01) ? TRUE : FALSE); + cpu_interrupt_enable(cputag_get_cpu(space->machine, "maincpu"), (data & 0x01) ? TRUE : FALSE); crbaloon_set_clear_collision_address((data & 0x01) ? TRUE : FALSE); /* D1 - SOUND STOP */ @@ -342,7 +342,7 @@ GFXDECODE_END static MACHINE_RESET( crballoon ) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO); + const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO); const device_config *discrete = devtag_get_device(machine, "discrete"); pc3092_reset(); diff --git a/src/mame/drivers/crgolf.c b/src/mame/drivers/crgolf.c index 46e3682def4..7f3a9b88833 100644 --- a/src/mame/drivers/crgolf.c +++ b/src/mame/drivers/crgolf.c @@ -123,7 +123,7 @@ static WRITE8_HANDLER( unknown_w ) static TIMER_CALLBACK( main_to_sound_callback ) { - cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, ASSERT_LINE); + cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, ASSERT_LINE); main_to_sound_data = param; } @@ -136,7 +136,7 @@ static WRITE8_HANDLER( main_to_sound_w ) static READ8_HANDLER( main_to_sound_r ) { - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, CLEAR_LINE); return main_to_sound_data; } @@ -150,7 +150,7 @@ static READ8_HANDLER( main_to_sound_r ) static TIMER_CALLBACK( sound_to_main_callback ) { - cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); sound_to_main_data = param; } @@ -163,7 +163,7 @@ static WRITE8_HANDLER( sound_to_main_w ) static READ8_HANDLER( sound_to_main_r ) { - cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); return sound_to_main_data; } @@ -581,7 +581,7 @@ ROM_END static DRIVER_INIT( crgolfhi ) { const device_config *msm = devtag_get_device(machine, "msm"); - memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), msm, 0xa000, 0xa003, 0, 0, crgolfhi_sample_w); + memory_install_write8_device_handler(cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM), msm, 0xa000, 0xa003, 0, 0, crgolfhi_sample_w); } diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c index c02b355fe79..fd55e8e5b9c 100644 --- a/src/mame/drivers/crimfght.c +++ b/src/mame/drivers/crimfght.c @@ -36,7 +36,7 @@ static WRITE8_HANDLER( crimfght_coin_w ) static WRITE8_HANDLER( crimfght_sh_irqtrigger_w ) { soundlatch_w(space,offset,data); - cpu_set_input_line_and_vector(space->machine->cpu[1],0,HOLD_LINE,0xff); + cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); } static WRITE8_DEVICE_HANDLER( crimfght_snd_bankswitch_w ) @@ -361,7 +361,7 @@ static MACHINE_RESET( crimfght ) { UINT8 *RAM = memory_region(machine, "maincpu"); - konami_configure_set_lines(machine->cpu[0], crimfght_banking); + konami_configure_set_lines(cputag_get_cpu(machine, "maincpu"), crimfght_banking); /* init the default bank */ memory_set_bankptr(machine, 2, &RAM[0x10000] ); diff --git a/src/mame/drivers/crospang.c b/src/mame/drivers/crospang.c index 750edcecd92..b7e3d10b37a 100644 --- a/src/mame/drivers/crospang.c +++ b/src/mame/drivers/crospang.c @@ -292,7 +292,7 @@ GFXDECODE_END static void irqhandler(const device_config *device, int linestate) { - cpu_set_input_line(device->machine->cpu[1],0,linestate); + cputag_set_input_line(device->machine, "audiocpu", 0, linestate); } static const ym3812_interface ym3812_config = diff --git a/src/mame/drivers/crshrace.c b/src/mame/drivers/crshrace.c index 3dc45c26e07..8b87663a690 100644 --- a/src/mame/drivers/crshrace.c +++ b/src/mame/drivers/crshrace.c @@ -171,7 +171,7 @@ static WRITE16_HANDLER( sound_command_w ) { pending_command = 1; soundlatch_w(space,offset,data & 0xff); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } } @@ -428,7 +428,7 @@ GFXDECODE_END static void irqhandler(const device_config *device, int irq) { - cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); } static const ym2610_interface ym2610_config = diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c index 7025943be5e..cf2bb59501a 100644 --- a/src/mame/drivers/crystal.c +++ b/src/mame/drivers/crystal.c @@ -141,41 +141,41 @@ static UINT32 *ResetPatch; static void IntReq(running_machine *machine, int num) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); UINT32 IntEn=memory_read_dword(space, 0x01800c08); UINT32 IntPend=memory_read_dword(space, 0x01800c0c); - if(IntEn&(1<cpu[0],SE3208_INT,ASSERT_LINE); + IntPend |= (1 << num); + memory_write_dword(space, 0x01800c0c, IntPend); + cputag_set_input_line(machine, "maincpu", SE3208_INT, ASSERT_LINE); } #ifdef IDLE_LOOP_SPEEDUP - FlipCntRead=0; - cpu_resume(machine->cpu[0],SUSPEND_REASON_SPIN); + FlipCntRead = 0; + cputag_resume(machine, "maincpu", SUSPEND_REASON_SPIN); #endif } static READ32_HANDLER(FlipCount_r) { #ifdef IDLE_LOOP_SPEEDUP - UINT32 IntPend=memory_read_dword(space, 0x01800c0c); + UINT32 IntPend = memory_read_dword(space, 0x01800c0c); FlipCntRead++; - if(FlipCntRead>=16 && !IntPend && FlipCount!=0) - cpu_suspend(space->machine->cpu[0],SUSPEND_REASON_SPIN,1); + if(FlipCntRead >= 16 && !IntPend && FlipCount != 0) + cputag_suspend(space->machine, "maincpu", SUSPEND_REASON_SPIN, 1); #endif return ((UINT32) FlipCount)<<16; } static WRITE32_HANDLER(FlipCount_w) { - if(mem_mask&0x00ff0000) + if(mem_mask & 0x00ff0000) { - int fc=(data>>16)&0xff; - if(fc==1) + int fc = (data >> 16) & 0xff; + if(fc == 1) FlipCount++; - else if(fc==0) - FlipCount=0; + else if(fc == 0) + FlipCount = 0; } } @@ -193,36 +193,36 @@ static READ32_HANDLER(Input_r) if(!(Port4 & 0x20) && ((OldPort4^Port4) & 0x20)) IntReq(space->machine, 19); OldPort4 = Port4; - return /*dips*/input_port_read(space->machine, "DSW")|(Port4<<16); + return /*dips*/input_port_read(space->machine, "DSW") | (Port4 << 16); } return 0; } static WRITE32_HANDLER(IntAck_w) { - UINT32 IntPend=memory_read_dword(space, 0x01800c0c); - if(mem_mask&0xff) + UINT32 IntPend = memory_read_dword(space, 0x01800c0c); + if(mem_mask & 0xff) { - IntPend&=~(1<<(data&0x1f)); - memory_write_dword(space, 0x01800c0c,IntPend); + IntPend &= ~(1 << (data & 0x1f)); + memory_write_dword(space, 0x01800c0c, IntPend); if(!IntPend) - cpu_set_input_line(space->machine->cpu[0],SE3208_INT,CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", SE3208_INT, CLEAR_LINE); } - if(mem_mask&0xff00) - IntHigh=(data>>8)&7; + if(mem_mask & 0xff00) + IntHigh = (data >> 8) & 7; } static IRQ_CALLBACK(icallback) { const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM); - UINT32 IntPend=memory_read_dword(space, 0x01800c0c); + UINT32 IntPend = memory_read_dword(space, 0x01800c0c); int i; - for(i=0;i<32;++i) + for(i = 0; i < 32; ++i) { - if(IntPend&(1<cpu[0],icallback); - for (i=0; i<4; i++) + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), icallback); + for (i = 0; i < 4; i++) Timer[i] = timer_alloc(machine, Timercb, (void*)(FPTR)i); PatchReset(); @@ -512,28 +512,28 @@ static MACHINE_RESET(crystal) { int i; - memset(sysregs,0,0x10000); - memset(vidregs,0,0x10000); - FlipCount=0; - IntHigh=0; - cpu_set_irq_callback(machine->cpu[0],icallback); - Bank=0; - memory_set_bankptr(machine, 1,memory_region(machine, "user1")+0); - FlashCmd=0xff; - OldPort4=0; + memset(sysregs, 0, 0x10000); + memset(vidregs, 0, 0x10000); + FlipCount = 0; + IntHigh = 0; + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), icallback); + Bank = 0; + memory_set_bankptr(machine, 1, memory_region(machine, "user1") + 0); + FlashCmd = 0xff; + OldPort4 = 0; - DMActrl[0]=0; - DMActrl[1]=0; + DMActrl[0] = 0; + DMActrl[1] = 0; - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { - Timerctrl[i]=0; - timer_adjust_oneshot(Timer[i],attotime_never,0); + Timerctrl[i] = 0; + timer_adjust_oneshot(Timer[i], attotime_never, 0); } - vr0_snd_set_areas(devtag_get_device(machine, "vrender"), textureram,frameram); + vr0_snd_set_areas(devtag_get_device(machine, "vrender"), textureram, frameram); #ifdef IDLE_LOOP_SPEEDUP - FlipCntRead=0; + FlipCntRead = 0; #endif PatchReset(); @@ -545,95 +545,95 @@ static VIDEO_START(crystal) static UINT16 GetVidReg(const address_space *space, UINT16 reg) { - return memory_read_word(space,0x03000000+reg); + return memory_read_word(space, 0x03000000 + reg); } -static void SetVidReg(const address_space *space, UINT16 reg,UINT16 val) +static void SetVidReg(const address_space *space, UINT16 reg, UINT16 val) { - memory_write_word(space,0x03000000+reg,val); + memory_write_word(space, 0x03000000 + reg, val); } static VIDEO_UPDATE(crystal) { - const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); int DoFlip; - UINT32 B0=0x0; - UINT32 B1=(GetVidReg(space,0x90)&0x8000)?0x400000:0x100000; - UINT16 *Front,*Back; - UINT16 *Visible,*DrawDest; + UINT32 B0 = 0x0; + UINT32 B1 = (GetVidReg(space, 0x90) & 0x8000) ? 0x400000 : 0x100000; + UINT16 *Front, *Back; + UINT16 *Visible, *DrawDest; UINT16 *srcline; int y; - UINT16 head,tail; - UINT32 width=video_screen_get_width(screen); + UINT16 head, tail; + UINT32 width = video_screen_get_width(screen); - if(GetVidReg(space,0x8e)&1) + if(GetVidReg(space, 0x8e) & 1) { - Front=(UINT16*) (frameram+B1/4); - Back=(UINT16*) (frameram+B0/4); + Front = (UINT16*) (frameram + B1 / 4); + Back = (UINT16*) (frameram + B0 / 4); } else { - Front=(UINT16*) (frameram+B0/4); - Back=(UINT16*) (frameram+B1/4); + Front = (UINT16*) (frameram + B0 / 4); + Back = (UINT16*) (frameram + B1 / 4); } - Visible=(UINT16*) Front; - DrawDest=(UINT16 *) frameram; + Visible = (UINT16*) Front; + DrawDest = (UINT16 *) frameram; - if(GetVidReg(space,0x8c)&0x80) - DrawDest=Front; + if(GetVidReg(space, 0x8c) & 0x80) + DrawDest = Front; else - DrawDest=Back; + DrawDest = Back; -// DrawDest=Visible; +// DrawDest = Visible; - srcline=(UINT16 *) DrawDest; + srcline = (UINT16 *) DrawDest; - DoFlip=0; - head=GetVidReg(space,0x82); - tail=GetVidReg(space,0x80); - while((head&0x7ff)!=(tail&0x7ff)) + DoFlip = 0; + head = GetVidReg(space, 0x82); + tail = GetVidReg(space, 0x80); + while((head & 0x7ff) != (tail & 0x7ff)) { - DoFlip=vrender0_ProcessPacket(space,0x03800000+head*64,DrawDest,(UINT8*)textureram); + DoFlip = vrender0_ProcessPacket(space, 0x03800000 + head * 64, DrawDest, (UINT8*)textureram); head++; - head&=0x7ff; + head &= 0x7ff; if(DoFlip) break; } if(DoFlip) - SetVidReg(space,0x8e,GetVidReg(space,0x8e)^1); + SetVidReg(space, 0x8e, GetVidReg(space, 0x8e) ^ 1); srcline=(UINT16 *) Visible; - for(y=0;y<240;y++) - memcpy(BITMAP_ADDR16(bitmap, y, 0), &srcline[y*512], width*2); + for(y = 0; y < 240; y++) + memcpy(BITMAP_ADDR16(bitmap, y, 0), &srcline[y * 512], width * 2); return 0; } static VIDEO_EOF(crystal) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - UINT16 head,tail; - int DoFlip=0; + const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); + UINT16 head, tail; + int DoFlip = 0; - head=GetVidReg(space,0x82); - tail=GetVidReg(space,0x80); - while((head&0x7ff)!=(tail&0x7ff)) + head = GetVidReg(space, 0x82); + tail = GetVidReg(space, 0x80); + while((head & 0x7ff) != (tail & 0x7ff)) { - UINT16 Packet0=memory_read_word(space,0x03800000+head*64); - if(Packet0&0x81) - DoFlip=1; + UINT16 Packet0 = memory_read_word(space, 0x03800000 + head * 64); + if(Packet0 & 0x81) + DoFlip = 1; head++; - head&=0x7ff; + head &= 0x7ff; if(DoFlip) break; } - SetVidReg(space,0x82,head); + SetVidReg(space, 0x82, head); if(DoFlip) { if(FlipCount) @@ -914,4 +914,3 @@ GAME( 2001, crysking, crysbios, crystal, crystal, crysking, ROT0, "Brezzasoft", GAME( 2001, evosocc, crysbios, crystal, crystal, evosocc, ROT0, "Evoga", "Evolution Soccer", 0 ) GAME( 2003, topbladv, crysbios, topbladv,crystal, topbladv, ROT0, "SonoKong / Expotato", "Top Blade V", GAME_NOT_WORKING ) // protection GAME( 2001, officeye, 0, crystal, crystal, officeye, ROT0, "Danbi", "Office Yeo In Cheon Ha (version 1.2)", GAME_NOT_WORKING ) // protection - diff --git a/src/mame/drivers/cubeqst.c b/src/mame/drivers/cubeqst.c index e556967d274..2b9cf55712c 100644 --- a/src/mame/drivers/cubeqst.c +++ b/src/mame/drivers/cubeqst.c @@ -35,14 +35,6 @@ #define CUBEQST_HBLANK 320 #define CUBEQST_VCOUNT 280 -enum cpu_indices -{ - MAIN_CPU = 0, - ROTATE_CPU = 1, - LINE_CPU = 2, - SOUND_CPU = 3, -}; - /************************************* * @@ -118,8 +110,8 @@ static VIDEO_UPDATE( cubeqst ) for (y = cliprect->min_y; y <= cliprect->max_y; ++y) { int i; - int num_entries = cubeqcpu_get_ptr_ram_val(screen->machine->cpu[LINE_CPU], y); - UINT32 *stk_ram = cubeqcpu_get_stack_ram(screen->machine->cpu[LINE_CPU]); + int num_entries = cubeqcpu_get_ptr_ram_val(cputag_get_cpu(screen->machine, "line_cpu"), y); + UINT32 *stk_ram = cubeqcpu_get_stack_ram(cputag_get_cpu(screen->machine, "line_cpu")); UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0); UINT32 pen; @@ -248,10 +240,10 @@ static WRITE16_HANDLER( control_w ) static TIMER_CALLBACK( delayed_bank_swap ) { - cubeqcpu_swap_line_banks(machine->cpu[LINE_CPU]); + cubeqcpu_swap_line_banks(cputag_get_cpu(machine, "line_cpu")); /* TODO: This is a little dubious */ - cubeqcpu_clear_stack(machine->cpu[LINE_CPU]); + cubeqcpu_clear_stack(cputag_get_cpu(machine, "line_cpu")); } @@ -383,22 +375,22 @@ INPUT_PORTS_END static READ16_HANDLER( read_rotram ) { - return cubeqcpu_rotram_r(space->machine->cpu[ROTATE_CPU], offset, mem_mask); + return cubeqcpu_rotram_r(cputag_get_cpu(space->machine, "rotate_cpu"), offset, mem_mask); } static WRITE16_HANDLER( write_rotram ) { - cubeqcpu_rotram_w(space->machine->cpu[ROTATE_CPU], offset, data, mem_mask); + cubeqcpu_rotram_w(cputag_get_cpu(space->machine, "rotate_cpu"), offset, data, mem_mask); } static READ16_HANDLER( read_sndram ) { - return cubeqcpu_sndram_r(space->machine->cpu[SOUND_CPU], offset, mem_mask); + return cubeqcpu_sndram_r(cputag_get_cpu(space->machine, "sound_cpu"), offset, mem_mask); } static WRITE16_HANDLER( write_sndram ) { - cubeqcpu_sndram_w(space->machine->cpu[SOUND_CPU], offset, data, mem_mask); + cubeqcpu_sndram_w(cputag_get_cpu(space->machine, "sound_cpu"), offset, data, mem_mask); } static ADDRESS_MAP_START( m68k_program_map, ADDRESS_SPACE_PROGRAM, 16 ) diff --git a/src/mame/drivers/cvs.c b/src/mame/drivers/cvs.c index bcb3d88618e..af15c870d14 100644 --- a/src/mame/drivers/cvs.c +++ b/src/mame/drivers/cvs.c @@ -100,17 +100,6 @@ Hardware Info -/************************************* - * - * Constants - * - *************************************/ - -#define CVS_MAIN_CPU_INDEX (0) -#define CVS_DAC_CPU_INDEX (1) - - - /************************************* * * Global variables @@ -265,8 +254,8 @@ static INTERRUPT_GEN( cvs_main_cpu_interrupt ) static void cvs_dac_cpu_interrupt(running_machine *machine) { - cpu_set_input_line_vector(machine->cpu[CVS_DAC_CPU_INDEX], 0, 0x03); - cpu_set_input_line(machine->cpu[CVS_DAC_CPU_INDEX], 0, HOLD_LINE); + cpu_set_input_line_vector(cputag_get_cpu(machine, "audiocpu"), 0, 0x03); + cputag_set_input_line(machine, "audiocpu", 0, HOLD_LINE); } diff --git a/src/mame/drivers/cyberbal.c b/src/mame/drivers/cyberbal.c index 842822c0d6f..7c0f22036b5 100644 --- a/src/mame/drivers/cyberbal.c +++ b/src/mame/drivers/cyberbal.c @@ -38,8 +38,8 @@ static void update_interrupts(running_machine *machine) { - cpu_set_input_line(machine->cpu[0], 1, atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE); - cpu_set_input_line(machine->cpu[2], 1, atarigen_video_int_state ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 1, atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(machine, "extra", 1, atarigen_video_int_state ? ASSERT_LINE : CLEAR_LINE); } @@ -49,19 +49,19 @@ static MACHINE_RESET( cyberbal ) atarigen_slapstic_reset(); atarigen_interrupt_reset(update_interrupts); atarigen_scanline_timer_reset(machine->primary_screen, cyberbal_scanline_update, 8); - atarigen_sound_io_reset(machine->cpu[1]); + atarigen_sound_io_reset(cputag_get_cpu(machine, "audiocpu")); cyberbal_sound_reset(machine); - /* CPU 2 doesn't run until reset */ - cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE); + /* Extra CPU (second M68k) doesn't run until reset */ + cputag_set_input_line(machine, "extra", INPUT_LINE_RESET, ASSERT_LINE); } static void cyberb2p_update_interrupts(running_machine *machine) { - cpu_set_input_line(machine->cpu[0], 1, atarigen_video_int_state ? ASSERT_LINE : CLEAR_LINE); - cpu_set_input_line(machine->cpu[0], 3, atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 1, atarigen_video_int_state ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 3, atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE); } @@ -114,7 +114,7 @@ static READ16_HANDLER( sound_state_r ) static WRITE16_HANDLER( p2_reset_w ) { - cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(space->machine, "extra", INPUT_LINE_RESET, CLEAR_LINE); } @@ -972,14 +972,14 @@ static const UINT16 default_eeprom[] = static DRIVER_INIT( cyberbal ) { atarigen_eeprom_default = default_eeprom; - atarigen_slapstic_init(machine->cpu[0], 0x018000, 0, 0); + atarigen_slapstic_init(cputag_get_cpu(machine, "maincpu"), 0x018000, 0, 0); } static DRIVER_INIT( cyberbt ) { atarigen_eeprom_default = default_eeprom; - atarigen_slapstic_init(machine->cpu[0], 0x018000, 0, 116); + atarigen_slapstic_init(cputag_get_cpu(machine, "maincpu"), 0x018000, 0, 116); } diff --git a/src/mame/drivers/cybertnk.c b/src/mame/drivers/cybertnk.c index 07b76db6816..e8e690c6b41 100644 --- a/src/mame/drivers/cybertnk.c +++ b/src/mame/drivers/cybertnk.c @@ -304,7 +304,7 @@ static WRITE16_HANDLER( io_w ) case 0: // sound data if (ACCESSING_BITS_0_7) - cpu_set_input_line(space->machine->cpu[2], 0, HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); else LOG_UNKNOWN_WRITE break; diff --git a/src/mame/machine/carpolo.c b/src/mame/machine/carpolo.c index d8c54d185ca..71777e35901 100644 --- a/src/mame/machine/carpolo.c +++ b/src/mame/machine/carpolo.c @@ -89,7 +89,7 @@ static UINT8 last_wheel_value[4]; static void TTL74148_3S_cb(running_machine *machine) { - cpu_set_input_line(machine->cpu[0], M6502_IRQ_LINE, TTL74148_output_valid_r(TTL74148_3S) ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", M6502_IRQ_LINE, TTL74148_output_valid_r(TTL74148_3S) ? CLEAR_LINE : ASSERT_LINE); } diff --git a/src/mame/video/capbowl.c b/src/mame/video/capbowl.c index 6ceeed5b750..a2e0f3579dc 100644 --- a/src/mame/video/capbowl.c +++ b/src/mame/video/capbowl.c @@ -23,7 +23,7 @@ static offs_t blitter_addr; static void generate_interrupt(running_machine *machine, int state) { - cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, state); + cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, state); } static const struct tms34061_interface tms34061intf = diff --git a/src/mame/video/cchasm.c b/src/mame/video/cchasm.c index 5419a63244f..654a01a7eda 100644 --- a/src/mame/video/cchasm.c +++ b/src/mame/video/cchasm.c @@ -23,7 +23,7 @@ static int xcenter, ycenter; static TIMER_CALLBACK( cchasm_refresh_end ) { - cpu_set_input_line (machine->cpu[0], 2, ASSERT_LINE); + cputag_set_input_line (machine, "maincpu", 2, ASSERT_LINE); } static void cchasm_refresh (running_machine *machine) @@ -114,7 +114,7 @@ WRITE16_HANDLER( cchasm_refresh_control_w ) cchasm_refresh(space->machine); break; case 0xf7: - cpu_set_input_line (space->machine->cpu[0], 2, CLEAR_LINE); + cputag_set_input_line (space->machine, "maincpu", 2, CLEAR_LINE); break; } }