From 52fa72a778058aa85044f30f489ce6cca76cf548 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Thu, 30 Apr 2009 17:16:48 +0000 Subject: [PATCH] More numbers-to-tags changes. Also, removed two unneeded variables in megadrive-related drivers: genz80.z80_cpunum (it's safer to use the correct tag) genesis_has_z80 (replaced by a check of cputag_get_cpu!=NULL) --- src/mame/audio/mario.c | 2 +- src/mame/audio/meadows.c | 2 +- src/mame/drivers/m10.c | 12 +-- src/mame/drivers/m107.c | 40 ++++---- src/mame/drivers/m63.c | 26 ++--- src/mame/drivers/m72.c | 28 +++--- src/mame/drivers/m92.c | 50 +++++----- src/mame/drivers/macrossp.c | 12 +-- src/mame/drivers/madalien.c | 6 +- src/mame/drivers/madmotor.c | 6 +- src/mame/drivers/magicard.c | 2 +- src/mame/drivers/magmax.c | 4 +- src/mame/drivers/mainevt.c | 2 +- src/mame/drivers/mainsnk.c | 2 +- src/mame/drivers/malzak.c | 2 +- src/mame/drivers/mappy.c | 52 +++++----- src/mame/drivers/mario.c | 4 +- src/mame/drivers/mastboy.c | 13 +-- src/mame/drivers/matmania.c | 8 +- src/mame/drivers/maxaflex.c | 9 +- src/mame/drivers/maygay1b.c | 4 +- src/mame/drivers/maygayv1.c | 14 +-- src/mame/drivers/mayumi.c | 5 +- src/mame/drivers/mazerbla.c | 18 ++-- src/mame/drivers/mcatadv.c | 5 +- src/mame/drivers/meadows.c | 2 +- src/mame/drivers/mediagx.c | 32 ++++--- src/mame/drivers/megadriv.c | 183 +++++++++++++++++------------------- src/mame/drivers/megadriv.h | 1 - src/mame/drivers/megaplay.c | 8 +- src/mame/drivers/megasys1.c | 21 ++--- src/mame/drivers/megatech.c | 36 +++---- src/mame/drivers/megazone.c | 4 +- src/mame/drivers/merit.c | 2 +- src/mame/drivers/meritm.c | 10 +- src/mame/drivers/metlclsh.c | 13 ++- src/mame/drivers/metro.c | 32 +++---- src/mame/drivers/mgolf.c | 4 +- src/mame/drivers/segac2.c | 31 +++--- src/mame/machine/mexico86.c | 10 +- src/mame/video/megasys1.c | 16 ++-- 41 files changed, 361 insertions(+), 372 deletions(-) diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c index 5c2675fb4ea..34bda5ac751 100644 --- a/src/mame/audio/mario.c +++ b/src/mame/audio/mario.c @@ -402,7 +402,7 @@ static SOUND_START( mario ) static SOUND_RESET( mario ) { mario_state *state = (mario_state *)machine->driver_data; - const address_space *space = cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(machine, "audiocpu", ADDRESS_SPACE_PROGRAM); #if USE_8039 set_ea(machine, 1); diff --git a/src/mame/audio/meadows.c b/src/mame/audio/meadows.c index e7a5e1740f5..3e2f501d892 100644 --- a/src/mame/audio/meadows.c +++ b/src/mame/audio/meadows.c @@ -68,7 +68,7 @@ void meadows_sh_update(running_machine *machine) /* amplitude is a combination of the upper 4 bits of 0c01 */ /* and bit 4 merged from S2650's flag output */ amp = ((meadows_0c03 & ENABLE_CTR1) == 0) ? 0 : (meadows_0c01 & 0xf0) >> 1; - if( cpu_get_reg(machine->cpu[0], S2650_FO) ) + if( cpu_get_reg(cputag_get_cpu(machine, "maincpu"), S2650_FO) ) amp += 0x80; /* calculate frequency for counter #1 */ /* bit 0..3 of 0c01 are ctr preset */ diff --git a/src/mame/drivers/m10.c b/src/mame/drivers/m10.c index c1fb4d6a574..659c34daff0 100644 --- a/src/mame/drivers/m10.c +++ b/src/mame/drivers/m10.c @@ -131,7 +131,7 @@ Notes (couriersud) static WRITE8_DEVICE_HANDLER(ic8j1_output_changed) { LOG(("ic8j1: %d %d\n", data, video_screen_get_vpos(device->machine->primary_screen))); - cpu_set_input_line(device->machine->cpu[0], 0, !data ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(device->machine, "maincpu", 0, !data ? CLEAR_LINE : ASSERT_LINE); } static WRITE8_DEVICE_HANDLER(ic8j2_output_changed) @@ -475,7 +475,7 @@ static READ8_HANDLER( m10_a700_r ) static READ8_HANDLER( m11_a700_r ) { //LOG(("rd:%d\n",video_screen_get_vpos(space->machine->primary_screen))); - //cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + //cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); LOG(("clear\n")); ttl74123_clear_w(devtag_get_device(space->machine, "ic8j1"), 0, 0); ttl74123_clear_w(devtag_get_device(space->machine, "ic8j1"), 0, 1); @@ -491,7 +491,7 @@ static READ8_HANDLER( m11_a700_r ) static INPUT_CHANGED( coin_inserted ) { /* coin insertion causes an NMI */ - cpu_set_input_line(field->port->machine->cpu[0], INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(field->port->machine, "maincpu", INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); } @@ -499,16 +499,16 @@ static TIMER_CALLBACK( interrupt_callback ) { if (param==0) { - cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, IREMM10_VBSTART+16, 0), NULL, 1,interrupt_callback); } if (param==1) { - cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, IREMM10_VBSTART+24, 0), NULL, 2,interrupt_callback); } if (param==-1) - cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); } diff --git a/src/mame/drivers/m107.c b/src/mame/drivers/m107.c index 091fba76ab1..8edfe58c10c 100644 --- a/src/mame/drivers/m107.c +++ b/src/mame/drivers/m107.c @@ -75,14 +75,14 @@ static TIMER_CALLBACK( m107_scanline_interrupt ) if (scanline == m107_raster_irq_position) { video_screen_update_partial(machine->primary_screen, scanline); - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, M107_IRQ_2); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M107_IRQ_2); } /* VBLANK interrupt */ else if (scanline == video_screen_get_visible_area(machine->primary_screen)->max_y + 1) { video_screen_update_partial(machine->primary_screen, scanline); - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, M107_IRQ_0); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M107_IRQ_0); } /* adjust for next scanline */ @@ -119,19 +119,19 @@ static TIMER_CALLBACK( setvector_callback ) } if (irqvector & 0x2) /* YM2151 has precedence */ - cpu_set_input_line_vector(machine->cpu[1],0,0x18); + cpu_set_input_line_vector(cputag_get_cpu(machine, "soundcpu"), 0, 0x18); else if (irqvector & 0x1) /* V30 */ - cpu_set_input_line_vector(machine->cpu[1],0,0x19); + cpu_set_input_line_vector(cputag_get_cpu(machine, "soundcpu"), 0, 0x19); if (irqvector == 0) /* no IRQs pending */ - cpu_set_input_line(machine->cpu[1],0,CLEAR_LINE); + cputag_set_input_line(machine, "soundcpu", 0, CLEAR_LINE); else /* IRQ pending */ - cpu_set_input_line(machine->cpu[1],0,ASSERT_LINE); + cputag_set_input_line(machine, "soundcpu", 0, ASSERT_LINE); } static WRITE16_HANDLER( m107_soundlatch_w ) { - timer_call_after_resynch(space->machine, NULL, V30_ASSERT,setvector_callback); + timer_call_after_resynch(space->machine, NULL, V30_ASSERT, setvector_callback); soundlatch_w(space, 0, data & 0xff); // logerror("soundlatch_w %02x\n",data); } @@ -156,7 +156,7 @@ static WRITE16_HANDLER( m107_sound_irq_ack_w ) static WRITE16_HANDLER( m107_sound_status_w ) { COMBINE_DATA(&sound_status); - cpu_set_input_line_and_vector(space->machine->cpu[0], 0, HOLD_LINE, M107_IRQ_3); + cputag_set_input_line_and_vector(space->machine, "maincpu", 0, HOLD_LINE, M107_IRQ_3); } /*****************************************************************************/ @@ -629,13 +629,13 @@ static DRIVER_INIT( firebarr ) { UINT8 *RAM = memory_region(machine, "maincpu"); - memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ - memory_set_bankptr(machine, 1,&RAM[0xa0000]); /* Initial bank */ + memcpy(RAM + 0xffff0, RAM + 0x7fff0, 0x10); /* Start vector */ + memory_set_bankptr(machine, 1, &RAM[0xa0000]); /* Initial bank */ RAM = memory_region(machine, "soundcpu"); - memcpy(RAM+0xffff0,RAM+0x1fff0,0x10); /* Sound cpu Start vector */ + memcpy(RAM + 0xffff0,RAM + 0x1fff0, 0x10); /* Sound cpu Start vector */ - m107_irq_vectorbase=0x20; + m107_irq_vectorbase = 0x20; m107_spritesystem = 1; } @@ -643,13 +643,13 @@ static DRIVER_INIT( dsoccr94 ) { UINT8 *RAM = memory_region(machine, "maincpu"); - memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ - memory_set_bankptr(machine, 1,&RAM[0xa0000]); /* Initial bank */ + memcpy(RAM + 0xffff0, RAM + 0x7fff0, 0x10); /* Start vector */ + memory_set_bankptr(machine, 1, &RAM[0xa0000]); /* Initial bank */ RAM = memory_region(machine, "soundcpu"); - memcpy(RAM+0xffff0,RAM+0x1fff0,0x10); /* Sound cpu Start vector */ + memcpy(RAM + 0xffff0, RAM + 0x1fff0, 0x10); /* Sound cpu Start vector */ - m107_irq_vectorbase=0x80; + m107_irq_vectorbase = 0x80; m107_spritesystem = 0; } @@ -657,14 +657,14 @@ static DRIVER_INIT( wpksoc ) { UINT8 *RAM = memory_region(machine, "maincpu"); - memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ - memory_set_bankptr(machine, 1,&RAM[0xa0000]); /* Initial bank */ + memcpy(RAM + 0xffff0, RAM + 0x7fff0, 0x10); /* Start vector */ + memory_set_bankptr(machine, 1, &RAM[0xa0000]); /* Initial bank */ RAM = memory_region(machine, "soundcpu"); - memcpy(RAM+0xffff0,RAM+0x1fff0,0x10); /* Sound cpu Start vector */ + memcpy(RAM + 0xffff0, RAM + 0x1fff0, 0x10); /* Sound cpu Start vector */ - m107_irq_vectorbase=0x80; + m107_irq_vectorbase = 0x80; m107_spritesystem = 0; } diff --git a/src/mame/drivers/m63.c b/src/mame/drivers/m63.c index 21f0bac2935..4b0c9090e57 100644 --- a/src/mame/drivers/m63.c +++ b/src/mame/drivers/m63.c @@ -323,7 +323,7 @@ static WRITE8_HANDLER( coin_w ) static WRITE8_HANDLER( snd_irq_w ) { - cpu_set_input_line(space->machine->cpu[1], 0, ASSERT_LINE); + cputag_set_input_line(space->machine, "soundcpu", 0, ASSERT_LINE); timer_call_after_resynch(space->machine, NULL, 0, NULL); } @@ -333,15 +333,15 @@ static WRITE8_HANDLER( snddata_w ) const device_config *ay2 = devtag_get_device(space->machine, "ay2"); if ((p2 & 0xf0) == 0xe0) - ay8910_address_w(ay1,0,offset); + ay8910_address_w(ay1, 0, offset); else if ((p2 & 0xf0) == 0xa0) - ay8910_data_w(ay1,0,offset); + ay8910_data_w(ay1, 0, offset); else if (ay2 != NULL && (p1 & 0xe0) == 0x60) - ay8910_address_w(ay2,0,offset); + ay8910_address_w(ay2, 0, offset); else if (ay2 != NULL && (p1 & 0xe0) == 0x40) - ay8910_data_w(ay2,0,offset); + ay8910_data_w(ay2, 0, offset); else if ((p2 & 0xf0) == 0x70 ) - sound_status=offset; + sound_status = offset; } static WRITE8_HANDLER( p1_w ) @@ -352,9 +352,9 @@ static WRITE8_HANDLER( p1_w ) static WRITE8_HANDLER( p2_w ) { p2 = data; - if((p2&0xf0)==0x50) + if((p2 & 0xf0) == 0x50) { - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "soundcpu", 0, CLEAR_LINE); } } @@ -375,10 +375,10 @@ static READ8_HANDLER( irq_r ) static READ8_HANDLER( snddata_r ) { - switch(p2&0xf0) + switch(p2 & 0xf0) { - case 0x60: return soundlatch_r(space,0); ; - case 0x70: return memory_region(space->machine, "user1")[((p1&0x1f)<<8)|offset]; + case 0x60: return soundlatch_r(space, 0); ; + case 0x70: return memory_region(space->machine, "user1")[((p1 & 0x1f) << 8) | offset]; } return 0xff; } @@ -687,7 +687,7 @@ static MACHINE_DRIVER_START( fghtbskt ) MDRV_CPU_PROGRAM_MAP(fghtbskt_map,0) MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse) - MDRV_CPU_ADD("audiocpu", I8039,XTAL_12MHz/4) /* ????? */ + MDRV_CPU_ADD("soundcpu", I8039,XTAL_12MHz/4) /* ????? */ MDRV_CPU_PROGRAM_MAP(i8039_map,0) MDRV_CPU_IO_MAP(i8039_port_map,0) MDRV_CPU_PERIODIC_INT(snd_irq, 60/2) @@ -856,7 +856,7 @@ ROM_START( fghtbskt ) ROM_LOAD( "fb10.6f", 0x8000, 0x2000, CRC(6b47efba) SHA1(cb55c7a9d5afe748c1c88f87dd1909e106932798) ) ROM_LOAD( "fb09.7f", 0xa000, 0x2000, CRC(be69e087) SHA1(be95ecafa494cb0787ee18eb3ecea4ad545a6ae3) ) - ROM_REGION( 0x1000, "audiocpu", 0 ) /* 8039 */ + ROM_REGION( 0x1000, "soundcpu", 0 ) /* 8039 */ ROM_LOAD( "fb07.0b", 0x0000, 0x1000, CRC(50432dbd) SHA1(35a2218ed243bde47dbe06b5a11a65502ba734ea) ) ROM_REGION( 0x2000, "gfx1", ROMREGION_DISPOSE ) diff --git a/src/mame/drivers/m72.c b/src/mame/drivers/m72.c index 4934c62d483..cbe027e52c1 100644 --- a/src/mame/drivers/m72.c +++ b/src/mame/drivers/m72.c @@ -700,9 +700,9 @@ static void install_protection_handler(running_machine *machine, const UINT8 *co protection_ram = auto_alloc_array(machine, UINT16, 0x1000/2); protection_code = code; protection_crc = crc; - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, (read16_space_func)SMH_BANK(1)); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0ffa, 0xb0ffb, 0, 0, protection_r); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, protection_w); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, (read16_space_func)SMH_BANK(1)); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xb0ffa, 0xb0ffb, 0, 0, protection_r); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0fff, 0, 0, protection_w); memory_set_bankptr(machine, 1, protection_ram); } @@ -710,42 +710,42 @@ static DRIVER_INIT( bchopper ) { install_protection_handler(machine, bchopper_code,bchopper_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w); } static DRIVER_INIT( mrheli ) { install_protection_handler(machine, bchopper_code,mrheli_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, bchopper_sample_trigger_w); } static DRIVER_INIT( nspirit ) { install_protection_handler(machine, nspirit_code,nspirit_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w); } static DRIVER_INIT( nspiritj ) { install_protection_handler(machine, nspirit_code,nspiritj_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, nspirit_sample_trigger_w); } static DRIVER_INIT( imgfight ) { install_protection_handler(machine, imgfight_code,imgfight_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, imgfight_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, imgfight_sample_trigger_w); } static DRIVER_INIT( loht ) { install_protection_handler(machine, loht_code,loht_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, loht_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, loht_sample_trigger_w); /* since we skip the startup tests, clear video RAM to prevent garbage on title screen */ memset(m72_videoram2,0,0x4000); @@ -755,33 +755,33 @@ static DRIVER_INIT( xmultipl ) { install_protection_handler(machine, xmultipl_code,xmultipl_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, xmultipl_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, xmultipl_sample_trigger_w); } static DRIVER_INIT( dbreed72 ) { install_protection_handler(machine, dbreed72_code,dbreed72_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, dbreed72_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, dbreed72_sample_trigger_w); } static DRIVER_INIT( airduel ) { install_protection_handler(machine, airduel_code,airduel_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, airduel_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, airduel_sample_trigger_w); } static DRIVER_INIT( dkgenm72 ) { install_protection_handler(machine, dkgenm72_code,dkgenm72_crc); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, dkgenm72_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, dkgenm72_sample_trigger_w); } static DRIVER_INIT( gallop ) { - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, gallop_sample_trigger_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0xc0, 0xc1, 0, 0, gallop_sample_trigger_w); } diff --git a/src/mame/drivers/m92.c b/src/mame/drivers/m92.c index d587a63fdfe..68df6c1832a 100644 --- a/src/mame/drivers/m92.c +++ b/src/mame/drivers/m92.c @@ -254,14 +254,14 @@ static TIMER_CALLBACK( m92_scanline_interrupt ) if (scanline == m92_raster_irq_position) { video_screen_update_partial(machine->primary_screen, scanline); - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, M92_IRQ_2); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M92_IRQ_2); } /* VBLANK interrupt */ else if (scanline == video_screen_get_visible_area(machine->primary_screen)->max_y + 1) { video_screen_update_partial(machine->primary_screen, scanline); - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, M92_IRQ_0); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M92_IRQ_0); } /* adjust for next scanline */ @@ -329,14 +329,14 @@ static TIMER_CALLBACK( setvector_callback ) } if (irqvector & 0x2) /* YM2151 has precedence */ - cpu_set_input_line_vector(machine->cpu[1], 0, 0x18); + cpu_set_input_line_vector(cputag_get_cpu(machine, "soundcpu"), 0, 0x18); else if (irqvector & 0x1) /* V30 */ - cpu_set_input_line_vector(machine->cpu[1], 0, 0x19); + cpu_set_input_line_vector(cputag_get_cpu(machine, "soundcpu"), 0, 0x19); if (irqvector == 0) /* no IRQs pending */ - cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(machine, "soundcpu", 0, CLEAR_LINE); else /* IRQ pending */ - cpu_set_input_line(machine->cpu[1], 0, ASSERT_LINE); + cputag_set_input_line(machine, "soundcpu", 0, ASSERT_LINE); } static WRITE16_HANDLER( m92_soundlatch_w ) @@ -364,7 +364,7 @@ static WRITE16_HANDLER( m92_sound_irq_ack_w ) static WRITE16_HANDLER( m92_sound_status_w ) { COMBINE_DATA(&sound_status); - cpu_set_input_line_and_vector(space->machine->cpu[0], 0, HOLD_LINE, M92_IRQ_3); + cputag_set_input_line_and_vector(space->machine, "maincpu", 0, HOLD_LINE, M92_IRQ_3); } /*****************************************************************************/ @@ -910,7 +910,7 @@ static const ym2151_interface ym2151_config = void m92_sprite_interrupt(running_machine *machine) { - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, M92_IRQ_1); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, M92_IRQ_1); } static MACHINE_DRIVER_START( m92 ) @@ -1968,21 +1968,21 @@ static void init_m92(running_machine *machine, int hasbanks) if (hasbanks) { - memcpy(RAM+0xffff0,RAM+0x7fff0,0x10); /* Start vector */ + memcpy(RAM + 0xffff0, RAM + 0x7fff0, 0x10); /* Start vector */ bankaddress = 0xa0000; /* Initial bank */ set_m92_bank(machine); /* Mirror used by In The Hunt for protection */ - memcpy(RAM+0xc0000,RAM+0x00000,0x10000); - memory_set_bankptr(machine, 2,&RAM[0xc0000]); + memcpy(RAM + 0xc0000, RAM + 0x00000, 0x10000); + memory_set_bankptr(machine, 2, &RAM[0xc0000]); } RAM = memory_region(machine, "soundcpu"); - memcpy(RAM+0xffff0, RAM+0x1fff0, 0x10); /* Sound cpu Start vector */ + memcpy(RAM + 0xffff0, RAM + 0x1fff0, 0x10); /* Sound cpu Start vector */ - m92_game_kludge=0; - m92_irq_vectorbase=0x80; - m92_sprite_buffer_busy=1; + m92_game_kludge = 0; + m92_irq_vectorbase = 0x80; + m92_sprite_buffer_busy = 1; setvector_callback(machine, NULL, VECTOR_INIT); } @@ -2015,13 +2015,13 @@ static DRIVER_INIT( uccops ) static DRIVER_INIT( rtypeleo ) { init_m92(machine, 1); - m92_irq_vectorbase=0x20; + m92_irq_vectorbase = 0x20; } static DRIVER_INIT( rtypelej ) { init_m92(machine, 1); - m92_irq_vectorbase=0x20; + m92_irq_vectorbase = 0x20; } static DRIVER_INIT( majtitl2 ) @@ -2029,9 +2029,9 @@ static DRIVER_INIT( majtitl2 ) init_m92(machine, 1); /* This game has an eprom on the game board */ - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0000, 0xf3fff, 0, 0, m92_eeprom_r, m92_eeprom_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf0000, 0xf3fff, 0, 0, m92_eeprom_r, m92_eeprom_w); - m92_game_kludge=2; + m92_game_kludge = 2; } static DRIVER_INIT( kaiteids ) @@ -2048,10 +2048,10 @@ static DRIVER_INIT( inthunt ) static DRIVER_INIT( lethalth ) { init_m92(machine, 0); - m92_irq_vectorbase=0x20; + m92_irq_vectorbase = 0x20; /* NOP out the bankswitcher */ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x20, 0x21, 0, 0, (write16_space_func)SMH_NOP); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x20, 0x21, 0, 0, (write16_space_func)SMH_NOP); } static DRIVER_INIT( nbbatman ) @@ -2060,13 +2060,13 @@ static DRIVER_INIT( nbbatman ) init_m92(machine, 1); - memcpy(RAM+0x80000,RAM+0x100000,0x20000); + memcpy(RAM + 0x80000, RAM + 0x100000, 0x20000); } static DRIVER_INIT( ssoldier ) { init_m92(machine, 1); - m92_irq_vectorbase=0x20; + m92_irq_vectorbase = 0x20; /* main CPU expects an answer even before writing the first command */ sound_status = 0x80; } @@ -2074,7 +2074,7 @@ static DRIVER_INIT( ssoldier ) static DRIVER_INIT( psoldier ) { init_m92(machine, 1); - m92_irq_vectorbase=0x20; + m92_irq_vectorbase = 0x20; /* main CPU expects an answer even before writing the first command */ sound_status = 0x80; } @@ -2088,7 +2088,7 @@ static DRIVER_INIT( gunforc2 ) { UINT8 *RAM = memory_region(machine, "maincpu"); init_m92(machine, 1); - memcpy(RAM+0x80000,RAM+0x100000,0x20000); + memcpy(RAM + 0x80000, RAM + 0x100000, 0x20000); } /***************************************************************************/ diff --git a/src/mame/drivers/macrossp.c b/src/mame/drivers/macrossp.c index a4b38a58898..caf915d9092 100644 --- a/src/mame/drivers/macrossp.c +++ b/src/mame/drivers/macrossp.c @@ -354,9 +354,9 @@ static WRITE32_HANDLER( macrossp_soundcmd_w ) if (ACCESSING_BITS_16_31) { //logerror("%08x write soundcmd %08x (%08x)\n",cpu_get_pc(space->cpu),data,mem_mask); - soundlatch_word_w(space,0,data >> 16,0xffff); + soundlatch_word_w(space, 0, data >> 16, 0xffff); sndpending = 1; - cpu_set_input_line(space->machine->cpu[1],2,HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", 2, HOLD_LINE); /* spin for a while to let the sound CPU read the command */ cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(50)); } @@ -366,7 +366,7 @@ static READ16_HANDLER( macrossp_soundcmd_r ) { // logerror("%06x read soundcmd\n",cpu_get_pc(space->cpu)); sndpending = 0; - return soundlatch_word_r(space,offset,mem_mask); + return soundlatch_word_r(space, offset, mem_mask); } static INT32 fade_effect,old_fade; @@ -590,7 +590,7 @@ static void irqhandler(const device_config *device, int irq) /* IRQ lines 1 & 4 on the sound 68000 are definitely triggered by the ES5506, but I haven't noticed the ES5506 ever assert the line - maybe only used when developing the game? */ -// cpu_set_input_line(device->cpu[1],1,irq ? ASSERT_LINE : CLEAR_LINE); +// cputag_set_input_line(device, "audiocpu", 1, irq ? ASSERT_LINE : CLEAR_LINE); } static const es5506_interface es5506_config = @@ -763,13 +763,13 @@ static WRITE32_HANDLER( quizmoon_speedup_w ) static DRIVER_INIT( macrossp ) { - memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf10158, 0xf1015b, 0, 0, macrossp_speedup_w ); + memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf10158, 0xf1015b, 0, 0, macrossp_speedup_w ); } static DRIVER_INIT( quizmoon ) { #ifdef UNUSED_FUNCTION - memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00020, 0xf00023, 0, 0, quizmoon_speedup_w ); + memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf00020, 0xf00023, 0, 0, quizmoon_speedup_w ); #endif } diff --git a/src/mame/drivers/madalien.c b/src/mame/drivers/madalien.c index 3829761bb0d..79859b44fc9 100644 --- a/src/mame/drivers/madalien.c +++ b/src/mame/drivers/madalien.c @@ -23,7 +23,7 @@ static UINT8 *shift_lo; static INPUT_CHANGED( coin_inserted ) { /* coin insertion causes an NMI */ - cpu_set_input_line(field->port->machine->cpu[0], INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(field->port->machine, "maincpu", INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE); } @@ -58,14 +58,14 @@ static WRITE8_HANDLER( madalien_output_w ) static WRITE8_HANDLER( madalien_sound_command_w ) { - cpu_set_input_line(space->machine->cpu[1], 0, ASSERT_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, ASSERT_LINE); soundlatch_w(space, offset, data); } static READ8_HANDLER(madalien_sound_command_r ) { - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, CLEAR_LINE); return soundlatch_r(space, offset); } diff --git a/src/mame/drivers/madmotor.c b/src/mame/drivers/madmotor.c index aed4633919e..6e73535cc2c 100644 --- a/src/mame/drivers/madmotor.c +++ b/src/mame/drivers/madmotor.c @@ -35,8 +35,8 @@ static WRITE16_HANDLER( madmotor_sound_w ) { if (ACCESSING_BITS_0_7) { - 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); } } @@ -221,7 +221,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/magicard.c b/src/mame/drivers/magicard.c index 5ba5b605116..1c8f9eeb794 100644 --- a/src/mame/drivers/magicard.c +++ b/src/mame/drivers/magicard.c @@ -411,7 +411,7 @@ static MACHINE_RESET( magicard ) static INTERRUPT_GEN( magicard_irq ) { // if(input_code_pressed(KEYCODE_Z)) -// cpu_set_input_line(device->machine->cpu[0], 1, HOLD_LINE); +// cputag_set_input_line(device->machine, "maincpu", 1, HOLD_LINE); // magicram[0x2004/2]^=0xffff; } diff --git a/src/mame/drivers/magmax.c b/src/mame/drivers/magmax.c index 760e6f9fab9..26a7ac8fb7c 100644 --- a/src/mame/drivers/magmax.c +++ b/src/mame/drivers/magmax.c @@ -49,13 +49,13 @@ static WRITE16_HANDLER( magmax_sound_w ) if (ACCESSING_BITS_0_7) { sound_latch = (data & 0xff) << 1; - cpu_set_input_line(space->machine->cpu[1], 0, ASSERT_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, ASSERT_LINE); } } static READ8_HANDLER( magmax_sound_irq_ack ) { - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, CLEAR_LINE); return 0; } diff --git a/src/mame/drivers/mainevt.c b/src/mame/drivers/mainevt.c index 2f2e48ec6e9..6353c14fcaf 100644 --- a/src/mame/drivers/mainevt.c +++ b/src/mame/drivers/mainevt.c @@ -91,7 +91,7 @@ static WRITE8_HANDLER( mainevt_coin_w ) static WRITE8_HANDLER( mainevt_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( mainevt_sh_busy_r ) diff --git a/src/mame/drivers/mainsnk.c b/src/mame/drivers/mainsnk.c index 8c84976f6f8..c137a92735a 100644 --- a/src/mame/drivers/mainsnk.c +++ b/src/mame/drivers/mainsnk.c @@ -128,7 +128,7 @@ static WRITE8_HANDLER( sound_command_w ) { sound_cpu_busy = 1; soundlatch_w(space, 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); } static READ8_HANDLER( sound_command_r ) diff --git a/src/mame/drivers/malzak.c b/src/mame/drivers/malzak.c index a70cd8fb13a..d1273213609 100644 --- a/src/mame/drivers/malzak.c +++ b/src/mame/drivers/malzak.c @@ -171,7 +171,7 @@ static WRITE8_HANDLER( port40_w ) // Bits 1-3 are all set high upon death, until the game continues // Bit 6 is used only in Malzak II, and is set high after checking // the selected version -// logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n",cpu_get_pc(space->machine->cpu[0]),data); +// logerror("S2650 [0x%04x]: port 0x40 write: 0x%02x\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), data); if(data & 0x40) malzak_bank1 = 1; else diff --git a/src/mame/drivers/mappy.c b/src/mame/drivers/mappy.c index e73073d4f3f..277f052f3db 100644 --- a/src/mame/drivers/mappy.c +++ b/src/mame/drivers/mappy.c @@ -703,15 +703,15 @@ static WRITE8_HANDLER( superpac_latch_w ) switch (offset & 0x0e) { case 0x00: /* INT ON 2 */ - cpu_interrupt_enable(space->machine->cpu[1],bit); + cpu_interrupt_enable(cputag_get_cpu(space->machine, "sub"), bit); if (!bit) - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", 0, CLEAR_LINE); break; case 0x02: /* INT ON */ - 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); break; case 0x04: /* n.c. */ @@ -727,7 +727,7 @@ static WRITE8_HANDLER( superpac_latch_w ) break; case 0x0a: /* SUB RESET */ - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); break; case 0x0c: /* n.c. */ @@ -745,21 +745,21 @@ static WRITE8_HANDLER( phozon_latch_w ) switch (offset & 0x0e) { case 0x00: - cpu_interrupt_enable(space->machine->cpu[1],bit); + cpu_interrupt_enable(cputag_get_cpu(space->machine, "sub"), bit); if (!bit) - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", 0, CLEAR_LINE); break; case 0x02: - 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); break; case 0x04: - cpu_interrupt_enable(space->machine->cpu[2],bit); + cpu_interrupt_enable(cputag_get_cpu(space->machine, "sub2"), bit); if (!bit) - cpu_set_input_line(space->machine->cpu[2], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "sub2", 0, CLEAR_LINE); break; case 0x06: @@ -772,11 +772,11 @@ static WRITE8_HANDLER( phozon_latch_w ) break; case 0x0a: - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); break; case 0x0c: - cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(space->machine, "sub2", INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); break; case 0x0e: @@ -791,15 +791,15 @@ static WRITE8_HANDLER( mappy_latch_w ) switch (offset & 0x0e) { case 0x00: /* INT ON 2 */ - cpu_interrupt_enable(space->machine->cpu[1],bit); + cpu_interrupt_enable(cputag_get_cpu(space->machine, "sub"), bit); if (!bit) - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", 0, CLEAR_LINE); break; case 0x02: /* INT ON */ - 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); break; case 0x04: /* FLIP */ @@ -816,7 +816,7 @@ static WRITE8_HANDLER( mappy_latch_w ) break; case 0x0a: /* SUB RESET */ - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE); break; case 0x0c: /* n.c. */ @@ -830,7 +830,7 @@ static WRITE8_HANDLER( mappy_latch_w ) static MACHINE_RESET( superpac ) { - 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); int i; /* Reset all latches */ @@ -840,7 +840,7 @@ static MACHINE_RESET( superpac ) static MACHINE_RESET( phozon ) { - 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); int i; /* Reset all latches */ @@ -850,7 +850,7 @@ static MACHINE_RESET( phozon ) static MACHINE_RESET( mappy ) { - 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); int i; /* Reset all latches */ @@ -861,10 +861,10 @@ static MACHINE_RESET( mappy ) static INTERRUPT_GEN( mappy_interrupt_1 ) { irq0_line_assert(device); // this also checks if irq is enabled - IMPORTANT! - // so don't replace with cpu_set_input_line(machine->cpu[0], 0, ASSERT_LINE); + // so don't replace with cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); - namcoio_set_irq_line(device->machine,0,PULSE_LINE); - namcoio_set_irq_line(device->machine,1,PULSE_LINE); + namcoio_set_irq_line(device->machine, 0, PULSE_LINE); + namcoio_set_irq_line(device->machine, 1, PULSE_LINE); } @@ -2133,7 +2133,7 @@ static DRIVER_INIT( grobda ) the DAC might be built-in after all. */ const device_config *dac = devtag_get_device(machine, "dac"); - memory_install_write8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), dac, 0x0002, 0x0002, 0, 0, grobda_DAC_w ); + memory_install_write8_device_handler(cputag_get_address_space(machine, "sub", ADDRESS_SPACE_PROGRAM), dac, 0x0002, 0x0002, 0, 0, grobda_DAC_w ); DRIVER_INIT_CALL(58_56); } @@ -2141,7 +2141,7 @@ static DRIVER_INIT( grobda ) static DRIVER_INIT( digdug2 ) { /* appears to not use the watchdog */ - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0, (write8_space_func)SMH_NOP); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0x8000, 0, 0, (write8_space_func)SMH_NOP); DRIVER_INIT_CALL(58_56); } diff --git a/src/mame/drivers/mario.c b/src/mame/drivers/mario.c index 234b6ccd1e2..96dec60f9db 100644 --- a/src/mame/drivers/mario.c +++ b/src/mame/drivers/mario.c @@ -128,13 +128,13 @@ static const z80dma_interface mario_dma = static READ8_DEVICE_HANDLER(mario_dma_read_byte) { - const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); return memory_read_byte(space, offset); } static WRITE8_DEVICE_HANDLER(mario_dma_write_byte) { - const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); memory_write_byte(space, offset, data); } diff --git a/src/mame/drivers/mastboy.c b/src/mame/drivers/mastboy.c index 2d7fe17f94d..59949d3ae24 100644 --- a/src/mame/drivers/mastboy.c +++ b/src/mame/drivers/mastboy.c @@ -641,12 +641,12 @@ static WRITE8_HANDLER( mastboy_msm5205_data_w ) static void mastboy_adpcm_int(const device_config *device) { - msm5205_data_w (device,mastboy_m5205_next); - mastboy_m5205_next>>=4; + msm5205_data_w(device, mastboy_m5205_next); + mastboy_m5205_next >>= 4; mastboy_m5205_part ^= 1; if(!mastboy_m5205_part) - 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); } @@ -661,14 +661,15 @@ static const msm5205_interface msm5205_config = static WRITE8_HANDLER( mastboy_irq0_ack_w ) { mastboy_irq0_ack = data; - if ((data&1)==1) cpu_set_input_line(space->machine->cpu[0],0, CLEAR_LINE); + if ((data & 1) == 1) + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); } static INTERRUPT_GEN( mastboy_interrupt ) { - if ((mastboy_irq0_ack&1)==1) + if ((mastboy_irq0_ack & 1) == 1) { - cpu_set_input_line(device,0, ASSERT_LINE); + cpu_set_input_line(device, 0, ASSERT_LINE); } } diff --git a/src/mame/drivers/matmania.c b/src/mame/drivers/matmania.c index 952c0ad0bcc..0423fb688e3 100644 --- a/src/mame/drivers/matmania.c +++ b/src/mame/drivers/matmania.c @@ -42,13 +42,13 @@ The driver has been updated accordingly. static WRITE8_HANDLER( matmania_sh_command_w ) { soundlatch_w(space,offset,data); - cpu_set_input_line(space->machine->cpu[1],M6502_IRQ_LINE,HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", M6502_IRQ_LINE, HOLD_LINE); } static WRITE8_HANDLER( maniach_sh_command_w ) { - soundlatch_w(space,offset,data); - cpu_set_input_line(space->machine->cpu[1],M6809_IRQ_LINE,HOLD_LINE); + soundlatch_w(space, offset, data); + cputag_set_input_line(space->machine, "audiocpu", M6809_IRQ_LINE, HOLD_LINE); } @@ -355,7 +355,7 @@ MACHINE_DRIVER_END /* handler called by the 3526 emulator when the internal timers cause an IRQ */ static void irqhandler(const device_config *device, int linestate) { - cpu_set_input_line(device->machine->cpu[1],1,linestate); + cputag_set_input_line(device->machine, "audiocpu", 1, linestate); } static const ym3526_interface ym3526_config = diff --git a/src/mame/drivers/maxaflex.c b/src/mame/drivers/maxaflex.c index 5b857effc38..fa1d4e9337f 100644 --- a/src/mame/drivers/maxaflex.c +++ b/src/mame/drivers/maxaflex.c @@ -79,14 +79,14 @@ static WRITE8_HANDLER( mcu_portB_w ) /* clear coin interrupt */ if (data & 0x04) - cpu_set_input_line(space->machine->cpu[1], M6805_IRQ_LINE, CLEAR_LINE ); + cputag_set_input_line(space->machine, "mcu", M6805_IRQ_LINE, CLEAR_LINE ); /* AUDMUTE */ sound_global_enable((data >> 5) & 1); /* RES600 */ if (diff & 0x10) - cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); /* latch for lamps */ if ((diff & 0x40) && !(data & 0x40)) @@ -154,7 +154,7 @@ static TIMER_CALLBACK( mcu_timer_proc ) if ( (tcr & 0x40) == 0 ) { //timer interrupt! - generic_pulse_irq_line(machine->cpu[1], M68705_INT_TIMER); + generic_pulse_irq_line(cputag_get_cpu(machine, "mcu"), M68705_INT_TIMER); } } } @@ -226,7 +226,7 @@ static MACHINE_RESET(supervisor_board) static INPUT_CHANGED( coin_inserted ) { if (!newval) - cpu_set_input_line(field->port->machine->cpu[1], M6805_IRQ_LINE, HOLD_LINE ); + cputag_set_input_line(field->port->machine, "mcu", M6805_IRQ_LINE, HOLD_LINE ); } int atari_input_disabled(void) @@ -542,4 +542,3 @@ GAME( 1982, mf_achas, maxaflex, maxaflex, a600xl, a600xl, ROT0, "Exidy / First S GAME( 1983, mf_brist, maxaflex, maxaflex, a600xl, a600xl, ROT0, "Exidy / First Star Software", "Bristles (Max-A-Flex)", 0 ) GAME( 1983, mf_flip, maxaflex, maxaflex, a600xl, a600xl, ROT0, "Exidy / First Star Software", "Flip & Flop (Max-A-Flex)", 0 ) GAME( 1984, mf_bdash, maxaflex, maxaflex, a600xl, a600xl, ROT0, "Exidy / First Star Software", "Boulder Dash (Max-A-Flex)", 0 ) - diff --git a/src/mame/drivers/maygay1b.c b/src/mame/drivers/maygay1b.c index 5c97c27e85c..0c1ec0fdcf8 100644 --- a/src/mame/drivers/maygay1b.c +++ b/src/mame/drivers/maygay1b.c @@ -465,7 +465,7 @@ static MACHINE_RESET( m1 ) static void duart_irq_handler(const device_config *device, UINT8 state) { - cpu_set_input_line(device->machine->cpu[0], M6809_IRQ_LINE, state?ASSERT_LINE:CLEAR_LINE); + cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, state?ASSERT_LINE:CLEAR_LINE); LOG(("6809 irq%d \n",state)); } @@ -707,7 +707,7 @@ static UINT8 m1_duart_r (const device_config *device) static WRITE8_DEVICE_HANDLER( m1_meter_w ) { int i; - UINT64 cycles = cpu_get_total_cycles(device->machine->cpu[0]); + UINT64 cycles = cputag_get_total_cycles(device->machine, "maincpu"); for (i=0; i<8; i++) if ( data & (1 << i) ) Mechmtr_update(i, cycles, data & (1 << i) ); diff --git a/src/mame/drivers/maygayv1.c b/src/mame/drivers/maygayv1.c index 5db41c830d8..2ab1b207c66 100644 --- a/src/mame/drivers/maygayv1.c +++ b/src/mame/drivers/maygayv1.c @@ -636,7 +636,7 @@ static WRITE16_HANDLER( vsync_int_ctrl ) // Active low if (!(vsync_latch_preset)) - cpu_set_input_line(space->machine->cpu[0], 3, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 3, CLEAR_LINE); } static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) @@ -895,8 +895,8 @@ INPUT_PORTS_END static void duart_irq_handler(const device_config *device, UINT8 vector) { - cpu_set_input_line_and_vector(device->machine->cpu[0], 5, ASSERT_LINE, vector); -// cpu_set_input_line(device->machine->cpu[0], 5, state ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line_and_vector(device->machine, "maincpu", 5, ASSERT_LINE, vector); +// cputag_set_input_line(device->machine, "maincpu", 5, state ? ASSERT_LINE : CLEAR_LINE); }; static int d68681_val; @@ -906,7 +906,7 @@ static void duart_tx(const device_config *device, int channel, UINT8 data) if (channel == 0) { d68681_val = data; - cpu_set_input_line(device->machine->cpu[1], MCS51_RX_LINE, ASSERT_LINE); // ? + cputag_set_input_line(device->machine, "soundcpu", MCS51_RX_LINE, ASSERT_LINE); // ? } }; @@ -969,8 +969,8 @@ static MACHINE_START( maygayv1 ) // duart_68681_init(DUART_CLOCK, duart_irq_handler, duart_tx); - i8051_set_serial_tx_callback(machine->cpu[1], data_from_i8031); - i8051_set_serial_rx_callback(machine->cpu[1], data_to_i8031); + i8051_set_serial_tx_callback(cputag_get_cpu(machine, "soundcpu"), data_from_i8031); + i8051_set_serial_rx_callback(cputag_get_cpu(machine, "soundcpu"), data_to_i8031); } static MACHINE_RESET( maygayv1 ) @@ -985,7 +985,7 @@ static MACHINE_RESET( maygayv1 ) static INTERRUPT_GEN( vsync_interrupt ) { if (vsync_latch_preset) - cpu_set_input_line(device->machine->cpu[0], 3, ASSERT_LINE); + cputag_set_input_line(device->machine, "maincpu", 3, ASSERT_LINE); } diff --git a/src/mame/drivers/mayumi.c b/src/mame/drivers/mayumi.c index a1de06a553a..23f9d1c0daf 100644 --- a/src/mame/drivers/mayumi.c +++ b/src/mame/drivers/mayumi.c @@ -41,8 +41,8 @@ static WRITE8_HANDLER( bank_sel_w ) static MACHINE_RESET( mayumi ) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - bank_sel_w(space,0,0); + const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); + bank_sel_w(space, 0, 0); } static WRITE8_HANDLER( input_sel_w ) @@ -327,4 +327,3 @@ ROM_START( mayumi ) ROM_END GAME( 1988, mayumi, 0, mayumi, mayumi, 0, ROT0, "[Sanritsu] Victory L.L.C.", "Kikiippatsu Mayumi-chan (Japan)", 0 ) - diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c index 6649ffc5900..76305ad4b4e 100644 --- a/src/mame/drivers/mazerbla.c +++ b/src/mame/drivers/mazerbla.c @@ -284,7 +284,7 @@ static WRITE8_HANDLER( cfb_zpu_int_req_set_w ) { zpu_int_vector &= ~2; /* clear D1 on INTA (interrupt acknowledge) */ - cpu_set_input_line(space->machine->cpu[0], 0, ASSERT_LINE); /* main cpu interrupt (comes from CFB (generated at the start of INT routine on CFB) - vblank?) */ + cputag_set_input_line(space->machine, "maincpu", 0, ASSERT_LINE); /* main cpu interrupt (comes from CFB (generated at the start of INT routine on CFB) - vblank?) */ } static READ8_HANDLER( cfb_zpu_int_req_clr ) @@ -292,8 +292,8 @@ static READ8_HANDLER( cfb_zpu_int_req_clr ) zpu_int_vector |= 2; /* clear the INT line when there are no more interrupt requests */ - if (zpu_int_vector==0xff) - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + if (zpu_int_vector == 0xff) + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); return 0; } @@ -1002,7 +1002,7 @@ static TIMER_CALLBACK( delayed_sound_w ) soundlatch = param; /* cause NMI on sound CPU */ - cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, ASSERT_LINE); + cputag_set_input_line(machine, "sub", INPUT_LINE_NMI, ASSERT_LINE); } @@ -1041,11 +1041,11 @@ static INTERRUPT_GEN( sound_interrupt ) static WRITE8_HANDLER( sound_int_clear_w ) { - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", 0, CLEAR_LINE); } static WRITE8_HANDLER( sound_nmi_clear_w ) { - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, CLEAR_LINE); } static WRITE8_DEVICE_HANDLER( gg_led_ctrl_w ) @@ -1362,7 +1362,7 @@ static MACHINE_RESET( mazerbla ) { game_id = MAZERBLA; zpu_int_vector = 0xff; - cpu_set_irq_callback(machine->cpu[0], irq_callback); + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback); } @@ -1371,7 +1371,7 @@ static MACHINE_RESET( greatgun ) UINT8 *rom = memory_region(machine, "sub2"); game_id = GREATGUN; zpu_int_vector = 0xff; - cpu_set_irq_callback(machine->cpu[0], irq_callback); + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback); //patch VCU test @@ -1614,5 +1614,3 @@ ROM_END GAME( 1983, mazerbla, 0, mazerbla, mazerbla, 0, ROT0, "Stern", "Mazer Blazer (set 1)", GAME_IMPERFECT_GRAPHICS |GAME_NO_SOUND | GAME_NOT_WORKING ) GAME( 1983, mzrblzra, mazerbla, mazerbla, mazerbla, 0, ROT0, "Stern", "Mazer Blazer (set 2)", GAME_IMPERFECT_GRAPHICS |GAME_NO_SOUND | GAME_NOT_WORKING ) GAME( 1983, greatgun, 0, greatgun, greatgun, 0, ROT0, "Stern", "Great Guns", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING ) - - diff --git a/src/mame/drivers/mcatadv.c b/src/mame/drivers/mcatadv.c index 3c11048e392..429ab23347f 100644 --- a/src/mame/drivers/mcatadv.c +++ b/src/mame/drivers/mcatadv.c @@ -151,7 +151,7 @@ UINT16* mcatadv_vidregs; static WRITE16_HANDLER( mcat_soundlatch_w ) { soundlatch_w(space, 0, data); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_NMI, PULSE_LINE); } #if 0 // mcat only.. install read handler? @@ -422,7 +422,7 @@ GFXDECODE_END /* Stolen from Psikyo.c */ static void sound_irq( 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, "soundcpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); } static const ym2610_interface mcatadv_ym2610_interface = { @@ -670,4 +670,3 @@ GAME( 1993, catt, mcatadv, mcatadv, mcatadv, mcatadv, ROT0, "Wintechno", " GAME( 1993, nost, 0, nost, nost, mcatadv, ROT270, "Face", "Nostradamus", GAME_NO_COCKTAIL ) GAME( 1993, nostj, nost, nost, nost, mcatadv, ROT270, "Face", "Nostradamus (Japan)", GAME_NO_COCKTAIL ) GAME( 1993, nostk, nost, nost, nost, mcatadv, ROT270, "Face", "Nostradamus (Korea)", GAME_NO_COCKTAIL ) - diff --git a/src/mame/drivers/meadows.c b/src/mame/drivers/meadows.c index f074631d4d1..8b3361aa81b 100644 --- a/src/mame/drivers/meadows.c +++ b/src/mame/drivers/meadows.c @@ -209,7 +209,7 @@ static WRITE8_HANDLER( meadows_audio_w ) static INPUT_CHANGED( coin_inserted ) { - cpu_set_input_line_and_vector(field->port->machine->cpu[0], 0, (newval ? ASSERT_LINE : CLEAR_LINE), 0x82); + cputag_set_input_line_and_vector(field->port->machine, "maincpu", 0, (newval ? ASSERT_LINE : CLEAR_LINE), 0x82); } diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 238258a0e3f..1ae1a242603 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -732,7 +732,8 @@ static READ8_HANDLER(at_page8_r) { UINT8 data = at_pages[offset % 0x10]; - switch(offset % 8) { + switch(offset % 8) + { case 1: data = dma_offset[(offset / 8) & 1][2]; break; @@ -754,7 +755,8 @@ static WRITE8_HANDLER(at_page8_w) { at_pages[offset % 0x10] = data; - switch(offset % 8) { + switch(offset % 8) + { case 1: dma_offset[(offset / 8) & 1][2] = data; break; @@ -773,7 +775,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; @@ -783,7 +785,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; @@ -955,10 +957,10 @@ static MACHINE_RESET(mediagx) { UINT8 *rom = memory_region(machine, "bios"); - cpu_set_irq_callback(machine->cpu[0], irq_callback); + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback); memcpy(bios_ram, rom, 0x40000); - device_reset(machine->cpu[0]); + device_reset(cputag_get_cpu(machine, "maincpu")); dacl = auto_alloc_array(machine, INT16, 65536); dacr = auto_alloc_array(machine, INT16, 65536); @@ -978,12 +980,14 @@ static MACHINE_RESET(mediagx) * *************************************************************/ -static PIC8259_SET_INT_LINE( mediagx_pic8259_1_set_int_line ) { - cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? HOLD_LINE : CLEAR_LINE); +static PIC8259_SET_INT_LINE( mediagx_pic8259_1_set_int_line ) +{ + cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); } -static PIC8259_SET_INT_LINE( mediagx_pic8259_2_set_int_line ) { +static PIC8259_SET_INT_LINE( mediagx_pic8259_2_set_int_line ) +{ pic8259_set_irq_line( mediagx_devices.pic8259_1, 2, interrupt); } @@ -1079,7 +1083,7 @@ MACHINE_DRIVER_END 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) @@ -1092,7 +1096,8 @@ static void ide_interrupt(const device_config *device, int state) pic8259_set_irq_line(mediagx_devices.pic8259_2, 6, state); } -static int mediagx_get_out2(running_machine *machine) { +static int mediagx_get_out2(running_machine *machine) +{ return pit8253_get_output( mediagx_devices.pit8254, 2 ); } @@ -1101,7 +1106,8 @@ static const struct kbdc8042_interface at8042 = KBDC8042_AT386, set_gate_a20, keyboard_interrupt, mediagx_get_out2 }; -static void mediagx_set_keyb_int(running_machine *machine, int state) { +static void mediagx_set_keyb_int(running_machine *machine, int state) +{ pic8259_set_irq_line(mediagx_devices.pic8259_1, 1, state); } @@ -1178,7 +1184,7 @@ static void install_speedups(running_machine *machine, speedup_entry *entries, i speedup_count = count; for (i = 0; i < count; i++) - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), entries[i].offset, entries[i].offset + 3, 0, 0, speedup_handlers[i]); + memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), entries[i].offset, entries[i].offset + 3, 0, 0, speedup_handlers[i]); #ifdef MAME_DEBUG add_exit_callback(machine, report_speedups); diff --git a/src/mame/drivers/megadriv.c b/src/mame/drivers/megadriv.c index 2ab8f541263..6542c76b924 100644 --- a/src/mame/drivers/megadriv.c +++ b/src/mame/drivers/megadriv.c @@ -145,7 +145,6 @@ int segac2_sp_pal_lookup[4]; // hacks for C2 int genvdp_use_cram = 0; // c2 uses it's own palette ram -int genesis_has_z80; int genesis_always_irq6 = 0; // c2 never enables the irq6, different source?? int genesis_other_hacks = 0; // misc hacks @@ -208,7 +207,6 @@ static UINT16 read_next_instruction(const address_space *space) static struct genesis_z80_vars { - int z80_cpunum; int z80_is_reset; int z80_has_bus; int z80_bank_pos; @@ -593,9 +591,9 @@ static void megadrive_vdp_set_register(running_machine *machine, int regnum, UIN if (megadrive_irq4_pending) { if (MEGADRIVE_REG0_IRQ4_ENABLE) - cpu_set_input_line(machine->cpu[0],4,HOLD_LINE); + cputag_set_input_line(machine, "maincpu", 4, HOLD_LINE); else - cpu_set_input_line(machine->cpu[0],4,CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 4, CLEAR_LINE); } /* ??? Fatal Rewind needs this but I'm not sure it's accurate behavior @@ -610,9 +608,9 @@ static void megadrive_vdp_set_register(running_machine *machine, int regnum, UIN if (megadrive_irq6_pending) { if (MEGADRIVE_REG01_IRQ6_ENABLE ) - cpu_set_input_line(machine->cpu[0],6,HOLD_LINE); + cputag_set_input_line(machine, "maincpu", 6, HOLD_LINE); else - cpu_set_input_line(machine->cpu[0],6,CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", 6, CLEAR_LINE); } /* ??? */ @@ -720,7 +718,7 @@ static void megadrive_do_insta_68k_to_vram_dma(running_machine *machine, UINT32 if (length==0x00) length = 0xffff; /* This is a hack until real DMA timings are implemented */ - cpu_spinuntil_time(machine->cpu[0], ATTOTIME_IN_NSEC(length*1000/3500)); + cpu_spinuntil_time(cputag_get_cpu(machine, "maincpu"), ATTOTIME_IN_NSEC(length * 1000 / 3500)); for (count = 0;count<(length>>1);count++) { @@ -2059,7 +2057,7 @@ static void megadrive_io_write_data_port_6button(running_machine *machine, int p if (((megadrive_io_data_regs[portnum]&0x40)==0x00) && ((data&0x40) == 0x40)) { io_stage[portnum]++; - timer_adjust_oneshot(io_timeout[portnum], cpu_clocks_to_attotime(machine->cpu[0],8192), 0); + timer_adjust_oneshot(io_timeout[portnum], cputag_clocks_to_attotime(machine, "maincpu", 8192), 0); } } @@ -2286,14 +2284,14 @@ static WRITE16_HANDLER( megadriv_68k_req_z80_bus ) if (data & 0x0100) { //logerror("%06x: 68000 request z80 Bus (byte MSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_has_bus=0; - cpu_suspend( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT, 1 ); + genz80.z80_has_bus = 0; + cputag_suspend( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT, 1 ); } else { //logerror("%06x: 68000 return z80 Bus (byte MSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_has_bus=1; - cpu_resume( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT ); + genz80.z80_has_bus = 1; + cputag_resume( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT ); } } else if (!ACCESSING_BITS_8_15) // is this valid? @@ -2301,14 +2299,14 @@ static WRITE16_HANDLER( megadriv_68k_req_z80_bus ) if (data & 0x0001) { //logerror("%06x: 68000 request z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_has_bus=0; - cpu_suspend( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT, 1 ); + genz80.z80_has_bus = 0; + cputag_suspend( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT, 1 ); } else { //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_has_bus=1; - cpu_resume( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT ); + genz80.z80_has_bus = 1; + cputag_resume( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT ); } } else // word access @@ -2316,14 +2314,14 @@ static WRITE16_HANDLER( megadriv_68k_req_z80_bus ) if (data & 0x0100) { //logerror("%06x: 68000 request z80 Bus (word access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_has_bus=0; - cpu_suspend( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT, 1 ); + genz80.z80_has_bus = 0; + cputag_suspend( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT, 1 ); } else { //logerror("%06x: 68000 return z80 Bus (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_has_bus=1; - cpu_resume( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT ); + genz80.z80_has_bus = 1; + cputag_resume( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT ); } } } @@ -2335,16 +2333,16 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset ) if (data & 0x0100) { //logerror("%06x: 68000 clear z80 reset (byte MSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_is_reset=0; + genz80.z80_is_reset = 0; if ( genz80.z80_has_bus ) - cpu_resume( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT ); + cputag_resume( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT ); } else { //logerror("%06x: 68000 start z80 reset (byte MSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_is_reset=1; - device_reset( space->machine->cpu[genz80.z80_cpunum] ); - cpu_suspend( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT, 1 ); + genz80.z80_is_reset = 1; + device_reset( cputag_get_cpu(space->machine, "genesis_snd_z80") ); + cputag_suspend( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT, 1 ); devtag_reset(space->machine, "ym"); } } @@ -2353,16 +2351,16 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset ) if (data & 0x0001) { //logerror("%06x: 68000 clear z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_is_reset=0; + genz80.z80_is_reset = 0; if ( genz80.z80_has_bus ) - cpu_resume( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT ); + cputag_resume( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT ); } else { //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_is_reset=1; - device_reset( space->machine->cpu[genz80.z80_cpunum] ); - cpu_suspend( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT, 1 ); + genz80.z80_is_reset = 1; + device_reset( cputag_get_cpu(space->machine, "genesis_snd_z80") ); + cputag_suspend( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT, 1 ); devtag_reset(space->machine, "ym"); } @@ -2372,16 +2370,16 @@ static WRITE16_HANDLER ( megadriv_68k_req_z80_reset ) if (data & 0x0100) { //logerror("%06x: 68000 clear z80 reset (word access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_is_reset=0; + genz80.z80_is_reset = 0; if ( genz80.z80_has_bus ) - cpu_resume( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT ); + cputag_resume( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT ); } else { //logerror("%06x: 68000 start z80 reset (byte LSB access) %04x %04x\n", cpu_get_pc(space->cpu),data,mem_mask); - genz80.z80_is_reset=1; - device_reset( space->machine->cpu[genz80.z80_cpunum] ); - cpu_suspend( space->machine->cpu[genz80.z80_cpunum], SUSPEND_REASON_HALT, 1 ); + genz80.z80_is_reset = 1; + device_reset( cputag_get_cpu(space->machine, "genesis_snd_z80") ); + cputag_suspend( space->machine, "genesis_snd_z80", SUSPEND_REASON_HALT, 1 ); devtag_reset(space->machine, "ym"); } } @@ -3898,14 +3896,14 @@ static void svp_init(running_machine *machine) /* SVP stuff */ svp.dram = auto_alloc_array(machine, UINT8, 0x20000); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x300000, 0x31ffff, 0, 0, (read16_space_func)SMH_BANK(2), (write16_space_func)SMH_BANK(2)); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x300000, 0x31ffff, 0, 0, (read16_space_func)SMH_BANK(2), (write16_space_func)SMH_BANK(2)); memory_set_bankptr(machine, 2, svp.dram ); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15000, 0xa150ff, 0, 0, svp_68k_io_r, svp_68k_io_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa15000, 0xa150ff, 0, 0, svp_68k_io_r, svp_68k_io_w); // "cell arrange" 1 and 2 - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x390000, 0x39ffff, 0, 0, svp_68k_cell1_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3a0000, 0x3affff, 0, 0, svp_68k_cell2_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x390000, 0x39ffff, 0, 0, svp_68k_cell1_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3a0000, 0x3affff, 0, 0, svp_68k_cell2_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x438, 0x438, 0, 0, svp_speedup_r); + memory_install_read16_handler(cputag_get_address_space(machine, "svp", ADDRESS_SPACE_PROGRAM), 0x438, 0x438, 0, 0, svp_speedup_r); svp.iram = auto_alloc_array(machine, UINT8, 0x800); memory_set_bankptr(machine, 3, svp.iram ); @@ -4013,7 +4011,7 @@ VIDEO_UPDATE(megadriv) /* reference */ // time_elapsed_since_crap = timer_timeelapsed(frame_timer); -// xxx = cpu_attotime_to_clocks(screen->machine->cpu[0],time_elapsed_since_crap); +// xxx = cputag_attotime_to_clocks(screen->machine, "maincpu", time_elapsed_since_crap); // mame_printf_debug("update cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.attoseconds>>32),(UINT32)(time_elapsed_since_crap.attoseconds&0xffffffff)); return 0; @@ -5933,22 +5931,23 @@ static TIMER_CALLBACK( scanline_timer_callback ) - if (genesis_has_z80) - { - if (genesis_scanline_counter==megadrive_z80irq_scanline) + if (cputag_get_cpu(machine, "genesis_snd_z80") != NULL) { - if ((genz80.z80_has_bus==1) && (genz80.z80_is_reset==0)) cpu_set_input_line(machine->cpu[1],0,HOLD_LINE); + if (genesis_scanline_counter == megadrive_z80irq_scanline) + { + if ((genz80.z80_has_bus == 1) && (genz80.z80_is_reset == 0)) + cputag_set_input_line(machine, "genesis_snd_z80", 0, HOLD_LINE); + } + if (genesis_scanline_counter == megadrive_z80irq_scanline + 1) + { + cputag_set_input_line(machine, "genesis_snd_z80", 0, CLEAR_LINE); + } } - if (genesis_scanline_counter==megadrive_z80irq_scanline+1) - { - cpu_set_input_line(machine->cpu[1],0,CLEAR_LINE); - } - } } else /* pretend we're still on the same scanline to compensate for rounding errors */ { - genesis_scanline_counter = megadrive_total_scanlines-1; + genesis_scanline_counter = megadrive_total_scanlines - 1; } } @@ -5959,14 +5958,15 @@ static TIMER_CALLBACK( irq6_on_callback ) { // megadrive_irq6_pending = 1; - if (MEGADRIVE_REG01_IRQ6_ENABLE || genesis_always_irq6) cpu_set_input_line(machine->cpu[0],6,HOLD_LINE); + if (MEGADRIVE_REG01_IRQ6_ENABLE || genesis_always_irq6) + cputag_set_input_line(machine, "maincpu", 6, HOLD_LINE); } } static TIMER_CALLBACK( irq4_on_callback ) { //mame_printf_debug("irq4 active on %d\n",genesis_scanline_counter); - cpu_set_input_line(machine->cpu[0],4,HOLD_LINE); + cputag_set_input_line(machine, "maincpu", 4, HOLD_LINE); } /*****************************************************************************************/ @@ -6014,12 +6014,12 @@ MACHINE_RESET( megadriv ) break; } - if (genesis_has_z80) + if (cputag_get_cpu(machine, "genesis_snd_z80") != NULL) { genz80.z80_is_reset = 1; - cpu_set_input_line(machine->cpu[genz80.z80_cpunum], INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_RESET, ASSERT_LINE); genz80.z80_has_bus = 1; - cpu_set_input_line(machine->cpu[genz80.z80_cpunum], INPUT_LINE_HALT, CLEAR_LINE); + cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_HALT, CLEAR_LINE); genz80.z80_bank_pos = 0; genz80.z80_bank_addr = 0; genesis_scanline_counter = -1; @@ -6037,13 +6037,13 @@ MACHINE_RESET( megadriv ) irq4_on_timer = timer_alloc(machine, irq4_on_callback, NULL); timer_adjust_oneshot(frame_timer, attotime_zero, 0); - timer_adjust_oneshot(scanline_timer, attotime_zero, 0); + timer_adjust_oneshot(scanline_timer, attotime_zero, 0); if (genesis_other_hacks) { // set_refresh_rate(megadriv_framerate); - cpu_set_clockscale(machine->cpu[0], 0.9950f); /* Fatal Rewind is very fussy... */ - // cpu_set_clockscale(machine->cpu[0], 0.3800f); /* Fatal Rewind is very fussy... */ + cpu_set_clockscale(cputag_get_cpu(machine, "maincpu"), 0.9950f); /* Fatal Rewind is very fussy... */ + // cpu_set_clockscale(cputag_get_cpu(machine, "maincpu"), 0.3800f); /* Fatal Rewind is very fussy... */ memset(megadrive_ram,0x00,0x10000); } @@ -6102,9 +6102,9 @@ VIDEO_EOF(megadriv) megadrive_sprite_collision=0;//? when to reset this .. megadrive_imode = MEGADRIVE_REG0C_INTERLEAVE; // can't change mid-frame.. megadrive_imode_odd_frame^=1; -// cpu_set_input_line(machine->cpu[1],0,CLEAR_LINE); // if the z80 interrupt hasn't happened by now, clear it.. +// cputag_set_input_line(machine, "genesis_snd_z80", 0, CLEAR_LINE); // if the z80 interrupt hasn't happened by now, clear it.. - if (MD_RESET_BUTTON(machine)) cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE); + if (MD_RESET_BUTTON(machine)) cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE); /* int megadrive_total_scanlines = 262; @@ -6188,7 +6188,7 @@ int megadrive_z80irq_hpos = 320; frametime = ATTOSECONDS_PER_SECOND/megadriv_framerate; time_elapsed_since_crap = timer_timeelapsed(frame_timer); - xxx = cpu_attotime_to_clocks(machine->cpu[0],time_elapsed_since_crap); + xxx = cputag_attotime_to_clocks(machine, "maincpu",time_elapsed_since_crap); //mame_printf_debug("---------- cycles %d, %08x %08x\n",xxx, (UINT32)(time_elapsed_since_crap.attoseconds>>32),(UINT32)(time_elapsed_since_crap.attoseconds&0xffffffff)); //mame_printf_debug("---------- framet %d, %08x %08x\n",xxx, (UINT32)(frametime>>32),(UINT32)(frametime&0xffffffff)); timer_adjust_oneshot(frame_timer, attotime_zero, 0); @@ -6395,11 +6395,9 @@ static void megadriv_init_common(running_machine *machine) if (_genesis_snd_z80_cpu != NULL) { printf("GENESIS Sound Z80 cpu found %d\n", cpu_get_index(_genesis_snd_z80_cpu) ); - genesis_has_z80 = 1; - } - else - { - genesis_has_z80 = 0; + + genz80.z80_prgram = auto_alloc_array(machine, UINT8, 0x2000); + memory_set_bankptr(machine, 1, genz80.z80_prgram ); } /* Look to see if this system has the 32x Master SH2 */ @@ -6438,20 +6436,13 @@ static void megadriv_init_common(running_machine *machine) } - if (genesis_has_z80) - { - genz80.z80_cpunum = 1; - genz80.z80_prgram = auto_alloc_array(machine, UINT8, 0x2000); - memory_set_bankptr(machine, 1, genz80.z80_prgram ); - } - - cpu_set_irq_callback(machine->cpu[0], genesis_int_callback); + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), genesis_int_callback); megadriv_backupram = NULL; megadriv_backupram_length = 0; vdp_get_word_from_68k_mem = vdp_get_word_from_68k_mem_default; - m68k_set_tas_callback(machine->cpu[0], megadriv_tas_callback); + m68k_set_tas_callback(cputag_get_cpu(machine, "maincpu"), megadriv_tas_callback); if ((machine->gamedrv->ipt==ipt_megadri6) || (machine->gamedrv->ipt==ipt_ssf2ghw)) { @@ -6575,28 +6566,28 @@ void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine) const device_config *ym = devtag_get_device(machine, "ym"); /* INIT THE PORTS *********************************************************************************************/ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_IO), 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w); /* catch any addresses that don't get mapped */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); memory_set_bankptr(machine, 1, genz80.z80_prgram ); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); memory_set_bankptr(machine, 6, genz80.z80_prgram ); // not allowed?? -// memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); +// memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1), (write8_space_func)SMH_BANK(1)); - memory_install_readwrite8_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w); - memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w); - memory_install_write8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w); - memory_install_read8_handler (cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data); + memory_install_readwrite8_device_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), ym, 0x4000, 0x4003, 0, 0, ym2612_r, ym2612_w); + memory_install_write8_handler (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, megadriv_z80_z80_bank_w); + memory_install_write8_handler (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6001, 0x6001, 0, 0, megadriv_z80_z80_bank_w); + memory_install_read8_handler (cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x6100, 0x7eff, 0, 0, megadriv_z80_unmapped_read); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x7f00, 0x7fff, 0, 0, megadriv_z80_vdp_read, megadriv_z80_vdp_write); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, z80_read_68k_banked_data, z80_write_68k_banked_data); } // these are tests for 'special case' hardware to make sure I don't break anything while rearranging things @@ -6628,20 +6619,20 @@ DRIVER_INIT( _32x ) if (_32x_adapter_enabled == 0) { - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000000, 0x03fffff, 0, 0, (read16_space_func)SMH_BANK(10), (write16_space_func)SMH_BANK(10)); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000000, 0x03fffff, 0, 0, (read16_space_func)SMH_BANK(10), (write16_space_func)SMH_BANK(10)); memory_set_bankptr(machine, 10, memory_region(machine, "gamecart") ); }; a15100_reg = 0x0000; - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15100, 0xa15101, 0, 0, _32x_68k_a15100_r, _32x_68k_a15100_w); // framebuffer control regs - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15102, 0xa15103, 0, 0, _32x_68k_a15102_r, _32x_68k_a15102_w); // send irq to sh2 - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15104, 0xa15105, 0, 0, _32x_68k_a15104_r, _32x_68k_a15104_w); // 68k BANK rom set - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15106, 0xa15107, 0, 0, _32x_68k_a15106_r, _32x_68k_a15106_w); // dreq stuff + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa15100, 0xa15101, 0, 0, _32x_68k_a15100_r, _32x_68k_a15100_w); // framebuffer control regs + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa15102, 0xa15103, 0, 0, _32x_68k_a15102_r, _32x_68k_a15102_w); // send irq to sh2 + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa15104, 0xa15105, 0, 0, _32x_68k_a15104_r, _32x_68k_a15104_w); // 68k BANK rom set + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa15106, 0xa15107, 0, 0, _32x_68k_a15106_r, _32x_68k_a15106_w); // dreq stuff - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa15120, 0xa1512f, 0, 0, _32x_68k_commsram_r, _32x_68k_commsram_w); // comms reg 0-7 + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa15120, 0xa1512f, 0, 0, _32x_68k_commsram_r, _32x_68k_commsram_w); // comms reg 0-7 - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0a130ec, 0x0a130ef, 0, 0, _32x_68k_MARS_r); // system ID + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0a130ec, 0x0a130ef, 0, 0, _32x_68k_MARS_r); // system ID @@ -6667,8 +6658,8 @@ DRIVER_INIT( _32x ) _32x_240mode = 0; // checking if these help brutal, they don't. - sh2drc_set_options(machine->cpu[2], SH2DRC_COMPATIBLE_OPTIONS); - sh2drc_set_options(machine->cpu[3], SH2DRC_COMPATIBLE_OPTIONS); + sh2drc_set_options(cputag_get_cpu(machine, "32x_master_sh2"), SH2DRC_COMPATIBLE_OPTIONS); + sh2drc_set_options(cputag_get_cpu(machine, "32x_slave_sh2"), SH2DRC_COMPATIBLE_OPTIONS); DRIVER_INIT_CALL(megadriv); } diff --git a/src/mame/drivers/megadriv.h b/src/mame/drivers/megadriv.h index fd6a6b232c4..5e544ccb457 100644 --- a/src/mame/drivers/megadriv.h +++ b/src/mame/drivers/megadriv.h @@ -54,6 +54,5 @@ extern int segac2_bg_pal_lookup[4]; extern int segac2_sp_pal_lookup[4]; extern int genvdp_use_cram; -extern int genesis_has_z80; extern int genesis_always_irq6; extern int genesis_other_hacks; diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c index d53f5278c15..8a5cbe150ea 100644 --- a/src/mame/drivers/megaplay.c +++ b/src/mame/drivers/megaplay.c @@ -633,7 +633,7 @@ static READ8_HANDLER( megaplay_bios_6404_r ) static WRITE8_HANDLER( megaplay_bios_6404_w ) { if(((bios_6404 & 0x0c) == 0x00) && ((data & 0x0c) == 0x0c)) - cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE); + cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE); bios_6404 = data; // logerror("BIOS: 0x6404 write: 0x%02x\n",data); @@ -1000,14 +1000,14 @@ static DRIVER_INIT (megaplay) megplay_stat(machine); /* for now ... */ - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa10000, 0xa1001f, 0, 0, OLD_megaplay_genesis_io_r, OLD_megaplay_genesis_io_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa10000, 0xa1001f, 0, 0, OLD_megaplay_genesis_io_r, OLD_megaplay_genesis_io_w); /* megaplay has ram shared with the bios cpu here */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x2000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); memory_set_bankptr(machine, 7, &ic36_ram[0]); /* instead of a RAM mirror the 68k sees the extra ram of the 2nd z80 too */ - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xa02000, 0xa03fff, 0, 0, megadriv_68k_read_z80_extra_ram, megadriv_68k_write_z80_extra_ram); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa02000, 0xa03fff, 0, 0, megadriv_68k_read_z80_extra_ram, megadriv_68k_write_z80_extra_ram); } /* diff --git a/src/mame/drivers/megasys1.c b/src/mame/drivers/megasys1.c index 795408ea95e..389c6e8af97 100644 --- a/src/mame/drivers/megasys1.c +++ b/src/mame/drivers/megasys1.c @@ -245,7 +245,7 @@ static READ16_HANDLER( ip_select_r ) static WRITE16_HANDLER( ip_select_w ) { COMBINE_DATA(&ip_select); - cpu_set_input_line(space->machine->cpu[0],2,HOLD_LINE); + cputag_set_input_line(space->machine, "maincpu", 2, HOLD_LINE); } @@ -372,7 +372,7 @@ ADDRESS_MAP_END static void megasys1_sound_irq(const device_config *device, int irq) { if (irq) - cpu_set_input_line(device->machine->cpu[1], 4, HOLD_LINE); + cputag_set_input_line(device->machine, "soundcpu", 4, HOLD_LINE); } static READ8_DEVICE_HANDLER( oki_status_r ) @@ -1387,7 +1387,7 @@ static WRITE16_HANDLER( protection_peekaboo_w ) } } - cpu_set_input_line(space->machine->cpu[0],4,HOLD_LINE); + cputag_set_input_line(space->machine, "maincpu", 4, HOLD_LINE); } /************************************* @@ -1609,7 +1609,7 @@ MACHINE_DRIVER_END static void irq_handler(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, "soundcpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); } @@ -3758,13 +3758,13 @@ static DRIVER_INIT( jitsupro ) RAM[0x438/2] = 0x4e71; // /* the sound code writes oki commands to both the lsb and msb */ - memory_install_write16_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), oki1, 0xa0000, 0xa0003, 0, 0, okim6295_both_w); - memory_install_write16_device_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), oki2, 0xc0000, 0xc0003, 0, 0, okim6295_both_w); + memory_install_write16_device_handler(cputag_get_address_space(machine, "soundcpu", ADDRESS_SPACE_PROGRAM), oki1, 0xa0000, 0xa0003, 0, 0, okim6295_both_w); + memory_install_write16_device_handler(cputag_get_address_space(machine, "soundcpu", ADDRESS_SPACE_PROGRAM), oki2, 0xc0000, 0xc0003, 0, 0, okim6295_both_w); } static DRIVER_INIT( peekaboo ) { - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x100000, 0x100001, 0, 0, protection_peekaboo_r, protection_peekaboo_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x100000, 0x100001, 0, 0, protection_peekaboo_r, protection_peekaboo_w); } static DRIVER_INIT( phantasm ) @@ -3809,7 +3809,7 @@ static DRIVER_INIT( soldamj ) astyanax_rom_decode(machine, "maincpu"); /* Sprite RAM is mirrored */ - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8c000, 0x8cfff, 0, 0, soldamj_spriteram16_r, soldamj_spriteram16_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8c000, 0x8cfff, 0, 0, soldamj_spriteram16_r, soldamj_spriteram16_w); } static DRIVER_INIT( soldam ) @@ -3817,7 +3817,7 @@ static DRIVER_INIT( soldam ) phantasm_rom_decode(machine, "maincpu"); /* Sprite RAM is mirrored */ - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8c000, 0x8cfff, 0, 0, soldamj_spriteram16_r, soldamj_spriteram16_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8c000, 0x8cfff, 0, 0, soldamj_spriteram16_r, soldamj_spriteram16_w); } @@ -3841,7 +3841,7 @@ static DRIVER_INIT( monkelf ) UINT16 *ROM = (UINT16*)memory_region(machine, "maincpu"); ROM[0x00744/2] = 0x4e71; - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe0000, 0xe000f, 0, 0, monkelf_input_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe0000, 0xe000f, 0, 0, monkelf_input_r); megasys1_ram += 0x10000/2; @@ -3885,4 +3885,3 @@ GAME( 1993, chimerab, 0, system_C, chimerab, chimerab, ROT0, " GAME( 1993, cybattlr, 0, system_C, cybattlr, cybattlr, ROT90, "Jaleco", "Cybattler", 0 ) GAME( 1993, hayaosi1, 0, system_B_hayaosi1, hayaosi1, hayaosi1, ROT0, "Jaleco", "Hayaoshi Quiz Ouza Ketteisen - The King Of Quiz", GAME_IMPERFECT_GRAPHICS ) GAME( 1993, peekaboo, 0, system_D, peekaboo, peekaboo, ROT0, "Jaleco", "Peek-a-Boo!", 0 ) - diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index 577ac0f0ea8..471fdf3b46c 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -308,7 +308,7 @@ static void megatech_set_genz80_as_sms_standard_ports(running_machine *machine) { /* INIT THE PORTS *********************************************************************************************/ - const address_space *io = cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_IO); + const address_space *io = cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_IO); const device_config *sn = devtag_get_device(machine, "sn"); memory_install_readwrite8_handler(io, 0x0000, 0xffff, 0, 0, z80_unmapped_port_r, z80_unmapped_port_w); @@ -331,24 +331,24 @@ static void megatech_set_genz80_as_sms_standard_map(running_machine *machine) /* INIT THE MEMMAP / BANKING *********************************************************************************/ /* catch any addresses that don't get mapped */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xffff, 0, 0, z80_unmapped_r, z80_unmapped_w); /* fixed rom bank area */ sms_rom = auto_alloc_array(machine, UINT8, 0x400000); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0x0000, 0xbfff, 0, 0, (read8_space_func)SMH_BANK(5), (write8_space_func)SMH_UNMAP); memory_set_bankptr(machine, 5, sms_rom ); memcpy(sms_rom, memory_region(machine, "maincpu"), 0x400000); /* main ram area */ sms_mainram = auto_alloc_array(machine, UINT8, 0x2000); // 8kb of main ram - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0, (read8_space_func)SMH_BANK(6), (write8_space_func)SMH_BANK(6)); memory_set_bankptr(machine, 6, sms_mainram ); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, (read8_space_func)SMH_BANK(7), (write8_space_func)SMH_BANK(7)); memory_set_bankptr(machine, 7, sms_mainram ); memset(sms_mainram,0x00,0x2000); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w); + memory_install_write8_handler(cputag_get_address_space(machine, "genesis_snd_z80", ADDRESS_SPACE_PROGRAM), 0xfffc, 0xffff, 0, 0, mt_sms_standard_rom_bank_w); megatech_set_genz80_as_sms_standard_ports(machine); // smsgg_backupram = NULL; @@ -363,10 +363,10 @@ static void megatech_select_game(running_machine *machine, int gameno) printf("game 0 selected\n"); - cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, ASSERT_LINE); - cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); - 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_RESET, ASSERT_LINE); + cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE); + cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_HALT, ASSERT_LINE); devtag_reset(machine, "ym"); sprintf(tempname, "game%d", gameno); @@ -392,8 +392,8 @@ static void megatech_select_game(running_machine *machine, int gameno) printf("SMS cart!!, CPU not running\n"); current_game_is_sms = 1; megatech_set_genz80_as_sms_standard_map(machine); - cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, CLEAR_LINE); - cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_HALT, CLEAR_LINE); + cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_RESET, CLEAR_LINE); } @@ -402,8 +402,8 @@ static void megatech_select_game(running_machine *machine, int gameno) printf("Genesis Cart, CPU0 running\n"); current_game_is_sms = 0; megatech_set_megadrive_z80_as_megadrive_z80(machine); - cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, CLEAR_LINE); - cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); } else { @@ -412,10 +412,10 @@ static void megatech_select_game(running_machine *machine, int gameno) } else { - cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, ASSERT_LINE); - cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE); - // cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, ASSERT_LINE); - // cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE); + cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_HALT, ASSERT_LINE); + // cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, ASSERT_LINE); + // cputag_set_input_line(machine, "genesis_snd_z80", INPUT_LINE_RESET, ASSERT_LINE); /* no cart.. */ memset(memory_region(machine, "mtbios")+0x8000, 0x00, 0x8000); diff --git a/src/mame/drivers/megazone.c b/src/mame/drivers/megazone.c index 3d879b37a6e..8f20c6d14b3 100644 --- a/src/mame/drivers/megazone.c +++ b/src/mame/drivers/megazone.c @@ -75,13 +75,13 @@ static WRITE8_DEVICE_HANDLER( megazone_portB_w ) static WRITE8_HANDLER( megazone_i8039_irq_w ) { - cpu_set_input_line(space->machine->cpu[2], 0, ASSERT_LINE); + cputag_set_input_line(space->machine, "daccpu", 0, ASSERT_LINE); } static WRITE8_HANDLER( i8039_irqen_and_status_w ) { if ((data & 0x80) == 0) - cpu_set_input_line(space->machine->cpu[2], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "daccpu", 0, CLEAR_LINE); i8039_status = (data & 0x70) >> 4; } diff --git a/src/mame/drivers/merit.c b/src/mame/drivers/merit.c index 3460d95d3e3..a6e7f7595d1 100644 --- a/src/mame/drivers/merit.c +++ b/src/mame/drivers/merit.c @@ -248,7 +248,7 @@ static MC6845_ON_HSYNC_CHANGED(hsync_changed) static MC6845_ON_VSYNC_CHANGED(vsync_changed) { - cpu_set_input_line(device->machine->cpu[0], 0, vsync ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "maincpu", 0, vsync ? ASSERT_LINE : CLEAR_LINE); } static const mc6845_interface mc6845_intf = diff --git a/src/mame/drivers/meritm.c b/src/mame/drivers/meritm.c index 00ff49ba8eb..cd382cbd65c 100644 --- a/src/mame/drivers/meritm.c +++ b/src/mame/drivers/meritm.c @@ -808,13 +808,13 @@ static const ay8910_interface ay8910_config = static WRITE_LINE_DEVICE_HANDLER( meritm_audio_pio_interrupt ) { //logerror( "PIO(0) interrupt line: %d, V = %d, H = %d\n", state, video_screen_get_vpos(0), video_screen_get_hpos(0) ); - cpu_set_input_line(device->machine->cpu[0], 0, state); + cputag_set_input_line(device->machine, "maincpu", 0, state); } static WRITE_LINE_DEVICE_HANDLER( meritm_io_pio_interrupt ) { //logerror( "PIO(1) interrupt line: %d, V = %d, H = %d\n", state, video_screen_get_vpos(0), video_screen_get_hpos(0) ); - cpu_set_input_line(device->machine->cpu[0], 0, state); + cputag_set_input_line(device->machine, "maincpu", 0, state); } @@ -1514,7 +1514,7 @@ static DRIVER_INIT(megat3te) ds1204_init(machine, megat3_ds1204_key, megat3_ds1204_nvram); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w ); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w ); }; @@ -1533,7 +1533,7 @@ static DRIVER_INIT(megat4te) ds1204_init(machine, 0, megat4te_ds1204_nvram); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w ); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w ); }; @@ -1544,7 +1544,7 @@ static DRIVER_INIT(megat4st) ds1204_init(machine, 0, megat4te_ds1204_nvram); - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w ); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xfff8, 0xffff, 0, 0, meritm_ds1644_r, meritm_ds1644_w ); }; diff --git a/src/mame/drivers/metlclsh.c b/src/mame/drivers/metlclsh.c index 355a789a641..c6e7c5fb11e 100644 --- a/src/mame/drivers/metlclsh.c +++ b/src/mame/drivers/metlclsh.c @@ -59,12 +59,12 @@ VIDEO_UPDATE( metlclsh ); static WRITE8_HANDLER( metlclsh_cause_irq ) { - cpu_set_input_line(space->machine->cpu[1],M6809_IRQ_LINE,ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", M6809_IRQ_LINE, ASSERT_LINE); } static WRITE8_HANDLER( metlclsh_ack_nmi ) { - 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); } static ADDRESS_MAP_START( metlclsh_master_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -96,17 +96,17 @@ ADDRESS_MAP_END static WRITE8_HANDLER( metlclsh_cause_nmi2 ) { - cpu_set_input_line(space->machine->cpu[0],INPUT_LINE_NMI,ASSERT_LINE); + cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); } static WRITE8_HANDLER( metlclsh_ack_irq2 ) { - 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( metlclsh_ack_nmi2 ) { - cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, CLEAR_LINE); } static WRITE8_HANDLER( metlclsh_flipscreen_w ) @@ -262,7 +262,7 @@ GFXDECODE_END static void metlclsh_irqhandler(const device_config *device, int linestate) { - cpu_set_input_line(device->machine->cpu[0],M6809_IRQ_LINE,linestate); + cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, linestate); } static const ym3526_interface ym3526_config = @@ -431,4 +431,3 @@ ROM_START( metlclsh ) ROM_END GAME( 1985, metlclsh, 0, metlclsh, metlclsh, 0, ROT0, "Data East", "Metal Clash (Japan)", 0 ) - diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c index 00a84582189..65b60c33f37 100644 --- a/src/mame/drivers/metro.c +++ b/src/mame/drivers/metro.c @@ -155,7 +155,7 @@ static READ16_HANDLER( metro_irq_cause_r ) /* Update the IRQ state based on all possible causes */ static void update_irq_state(running_machine *machine) { - 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); /* Get the pending IRQs (only the enabled ones, e.g. where irq_enable is *0*) */ @@ -170,9 +170,9 @@ static void update_irq_state(running_machine *machine) int i = 0; for (i = 0; i < 8; i++) if (irq & (1 << i)) - irq_level[metro_irq_levels[i]&7] = 1; + irq_level[metro_irq_levels[i] & 7] = 1; for (i = 0; i < 8; i++) - cpu_set_input_line(machine->cpu[0], i, irq_level[i] ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(machine, "maincpu", i, irq_level[i] ? ASSERT_LINE : CLEAR_LINE); } else { @@ -181,7 +181,7 @@ static void update_irq_state(running_machine *machine) source by peeking a register (metro_irq_cause_r) */ int state = (irq ? ASSERT_LINE : CLEAR_LINE); - cpu_set_input_line(machine->cpu[0], irq_line, state); + cputag_set_input_line(machine, "maincpu", irq_line, state); } } @@ -190,13 +190,13 @@ static void update_irq_state(running_machine *machine) static IRQ_CALLBACK(metro_irq_callback) { // logerror("%s: irq callback returns %04X\n",cpuexec_describe_context(device->machine),metro_irq_vectors[int_level]); - return metro_irq_vectors[irqline]&0xff; + return metro_irq_vectors[irqline] & 0xff; } static MACHINE_RESET( metro ) { if (irq_line == -1) - cpu_set_irq_callback(machine->cpu[0], metro_irq_callback); + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), metro_irq_callback); } @@ -321,7 +321,7 @@ static INTERRUPT_GEN( dokyusei_interrupt ) static void ymf278b_interrupt(const device_config *device, int active) { - cpu_set_input_line(device->machine->cpu[0], 2, active); + cputag_set_input_line(device->machine, "maincpu", 2, active); } /*************************************************************************** @@ -337,7 +337,7 @@ static int porta, portb, busy_sndcpu; static int metro_io_callback(const device_config *device, int ioline, int state) { - 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); UINT8 data = 0; @@ -360,7 +360,7 @@ static WRITE16_HANDLER( metro_soundlatch_w ) if (ACCESSING_BITS_0_7) { 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); cpu_spinuntil_int(space->cpu); busy_sndcpu = 1; } @@ -512,7 +512,7 @@ static WRITE8_HANDLER( daitorid_portb_w ) static void metro_sound_irq_handler(const device_config *device, int state) { - cpu_set_input_line(device->machine->cpu[1], UPD7810_INTF2, state ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", UPD7810_INTF2, state ? ASSERT_LINE : CLEAR_LINE); } static const ym2151_interface ym2151_config = @@ -1927,8 +1927,8 @@ ADDRESS_MAP_END static WRITE16_HANDLER( blzntrnd_sound_w ) { - soundlatch_w(space, offset, data>>8); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); + soundlatch_w(space, offset, data >> 8); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } static WRITE8_HANDLER( blzntrnd_sh_bankswitch_w ) @@ -1942,7 +1942,7 @@ static WRITE8_HANDLER( blzntrnd_sh_bankswitch_w ) static void blzntrnd_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 blzntrnd_ym2610_interface = @@ -4646,7 +4646,7 @@ static INTERRUPT_GEN( puzzlet_interrupt ) default: // timer - cpu_set_input_line(device->machine->cpu[0], H8_METRO_TIMER_HACK, HOLD_LINE); + cputag_set_input_line(device->machine, "maincpu", H8_METRO_TIMER_HACK, HOLD_LINE); break; } } @@ -4718,7 +4718,7 @@ static void metro_common(void) static DRIVER_INIT( metro ) { - 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); metro_common(); @@ -4743,7 +4743,7 @@ for (i = 0;i < (0x20000*3)/2;i++) static DRIVER_INIT( daitorid ) { - 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); metro_common(); diff --git a/src/mame/drivers/mgolf.c b/src/mame/drivers/mgolf.c index 860352acba0..f98660d4b5a 100644 --- a/src/mame/drivers/mgolf.c +++ b/src/mame/drivers/mgolf.c @@ -82,7 +82,7 @@ static void update_plunger(running_machine *machine) time_released = timer_get_time(machine); if (!mask) - cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); } else time_pushed = timer_get_time(machine); @@ -98,7 +98,7 @@ static TIMER_CALLBACK( interrupt_callback ) update_plunger(machine); - generic_pulse_irq_line(machine->cpu[0], 0); + generic_pulse_irq_line(cputag_get_cpu(machine, "maincpu"), 0); scanline = scanline + 32; diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index 63872bfd670..03c1476a47f 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -1315,7 +1315,7 @@ INPUT_PORTS_END static void segac2_irq2_interrupt(const device_config *device, int state) { //printf("sound irq %d\n", state); - cpu_set_input_line(device->machine->cpu[0], 2, state ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "maincpu", 2, state ? ASSERT_LINE : CLEAR_LINE); } static const ym3438_interface ym3438_intf = { @@ -1826,12 +1826,11 @@ static void segac2_common_init(running_machine* machine, int (*func)(int in)) prot_func = func; genvdp_use_cram = 0; - genesis_has_z80 = 0; genesis_always_irq6 = 1; genesis_other_hacks = 0; if (upd != NULL) - memory_install_write16_device_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), upd, 0x880000, 0x880001, 0, 0x13fefe, segac2_upd7759_w); + memory_install_write16_device_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), upd, 0x880000, 0x880001, 0, 0x13fefe, segac2_upd7759_w); } @@ -2088,7 +2087,7 @@ static DRIVER_INIT( tfrceacb ) { /* disable the palette bank switching from the protection chip */ segac2_common_init(machine, NULL); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x800000, 0x800001, 0, 0, (write16_space_func)SMH_NOP); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x800000, 0x800001, 0, 0, (write16_space_func)SMH_NOP); } static DRIVER_INIT( borench ) @@ -2176,36 +2175,36 @@ static DRIVER_INIT( pclub ) { segac2_common_init(machine, prot_func_pclub); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); } static DRIVER_INIT( pclubjv2 ) { segac2_common_init(machine, prot_func_pclubjv2); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); } static DRIVER_INIT( pclubjv4 ) { segac2_common_init(machine, prot_func_pclubjv4); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); } static DRIVER_INIT( pclubjv5 ) { segac2_common_init(machine, prot_func_pclubjv5); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880120, 0x880121, 0, 0, printer_r );/*Print Club Vol.1*/ + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, printer_r );/*Print Club Vol.2*/ + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x880124, 0x880125, 0, 0, print_club_camera_w); } diff --git a/src/mame/machine/mexico86.c b/src/mame/machine/mexico86.c index 7c07617495f..c6644b10d41 100644 --- a/src/mame/machine/mexico86.c +++ b/src/mame/machine/mexico86.c @@ -22,11 +22,11 @@ bit 0 = ? (unused?) */ WRITE8_HANDLER( mexico86_f008_w ) { - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 4) ? CLEAR_LINE : ASSERT_LINE); - if (space->machine->cpu[2] != NULL) + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, (data & 4) ? CLEAR_LINE : ASSERT_LINE); + if (cputag_get_cpu(space->machine, "mcu") != NULL) { // mexico 86, knight boy - cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, (data & 2) ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(space->machine, "mcu", INPUT_LINE_RESET, (data & 2) ? CLEAR_LINE : ASSERT_LINE); } else { @@ -318,8 +318,8 @@ WRITE8_HANDLER( mexico86_68705_portB_w ) } if ((ddrB & 0x20) && (data & 0x20) && (~portB_out & 0x20)) { - cpu_set_input_line_vector(space->machine->cpu[0],0,mexico86_protection_ram[0]); - cpu_set_input_line(space->machine->cpu[0], 0, HOLD_LINE); //AT: HOLD_LINE works better in Z80 interrupt mode 1. + cpu_set_input_line_vector(cputag_get_cpu(space->machine, "maincpu"), 0, mexico86_protection_ram[0]); + cputag_set_input_line(space->machine, "maincpu", 0, HOLD_LINE); //AT: HOLD_LINE works better in Z80 interrupt mode 1. } if ((ddrB & 0x40) && (~data & 0x40) && (portB_out & 0x40)) { diff --git a/src/mame/video/megasys1.c b/src/mame/video/megasys1.c index 64c01c36448..be2031b6187 100644 --- a/src/mame/video/megasys1.c +++ b/src/mame/video/megasys1.c @@ -449,13 +449,13 @@ WRITE16_HANDLER( megasys1_vregs_A_w ) case 0x300/2 : megasys1_screen_flag = new_data; if (new_data & 0x10) - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_RESET, ASSERT_LINE); else - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_RESET, CLEAR_LINE); break; case 0x308/2 : soundlatch_word_w(space,0,new_data,0xffff); - cpu_set_input_line(space->machine->cpu[1],4,HOLD_LINE); + cputag_set_input_line(space->machine, "soundcpu", 4, HOLD_LINE); break; default : SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data); @@ -500,17 +500,17 @@ WRITE16_HANDLER( megasys1_vregs_C_w ) case 0x2308/2 : megasys1_screen_flag = new_data; if (new_data & 0x10) - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_RESET, ASSERT_LINE); else - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_RESET, CLEAR_LINE); break; case 0x8000/2 : /* Cybattler reads sound latch on irq 2 */ - soundlatch_word_w(space,0,new_data,0xffff); - cpu_set_input_line(space->machine->cpu[1],2,HOLD_LINE); + soundlatch_word_w(space, 0, new_data, 0xffff); + cputag_set_input_line(space->machine, "soundcpu", 2, HOLD_LINE); break; - default: SHOW_WRITE_ERROR("vreg %04X <- %04X",offset*2,data); + default: SHOW_WRITE_ERROR("vreg %04X <- %04X", offset * 2, data); } }