diff --git a/src/mame/audio/dkong.c b/src/mame/audio/dkong.c index d27c44cc84b..27f71ec7f8d 100644 --- a/src/mame/audio/dkong.c +++ b/src/mame/audio/dkong.c @@ -1135,9 +1135,9 @@ static WRITE8_DEVICE_HANDLER( dkong_p1_w ) WRITE8_HANDLER( dkong_audio_irq_w ) { if (data) - cpu_set_input_line(space->machine->cpu[1], 0, ASSERT_LINE); + cputag_set_input_line(space->machine, "soundcpu", 0, ASSERT_LINE); else - cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "soundcpu", 0, CLEAR_LINE); } diff --git a/src/mame/drivers/dacholer.c b/src/mame/drivers/dacholer.c index c30bcce88db..7c5fa81be8b 100644 --- a/src/mame/drivers/dacholer.c +++ b/src/mame/drivers/dacholer.c @@ -70,8 +70,8 @@ static WRITE8_HANDLER( coins_w ) static WRITE8_HANDLER(snd_w) { - soundlatch_w(space,offset,data); - cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE); + soundlatch_w(space, offset, data); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) @@ -379,14 +379,14 @@ static INTERRUPT_GEN( sound_irq ) static void adpcm_int(const device_config *device) { - if(snd_interrupt_enable == 1 || (snd_interrupt_enable ==0 && msm_toggle==1)) + if(snd_interrupt_enable == 1 || (snd_interrupt_enable == 0 && msm_toggle == 1)) { - msm5205_data_w(device,msm_data >> 4); - msm_data<<=4; - msm_toggle^=1; - if (msm_toggle==0) + msm5205_data_w(device, msm_data >> 4); + msm_data <<= 4; + msm_toggle ^= 1; + if (msm_toggle == 0) { - cpu_set_input_line_and_vector(device->machine->cpu[1], 0, HOLD_LINE, 0x38); + cputag_set_input_line_and_vector(device->machine, "audiocpu", 0, HOLD_LINE, 0x38); } } } diff --git a/src/mame/drivers/darius.c b/src/mame/drivers/darius.c index 0b8e602a4ac..1d5254b140e 100644 --- a/src/mame/drivers/darius.c +++ b/src/mame/drivers/darius.c @@ -156,7 +156,7 @@ static void parse_control( running_machine *machine ) /* assumes Z80 sandwiched /* bit 0 enables cpu B */ /* however this fails when recovering from a save state if cpu B is disabled !! */ - cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE); + cputag_set_input_line(machine, "cpub", INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE); } @@ -498,7 +498,7 @@ ADDRESS_MAP_END static void darius_adpcm_int (const device_config *device) { if (nmi_enable) - cpu_set_input_line(device->machine->cpu[3], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(device->machine, "adpcm", INPUT_LINE_NMI, PULSE_LINE); } static const msm5205_interface msm5205_config = @@ -775,7 +775,7 @@ GFXDECODE_END /* handler called by the YM2203 emulator when the internal timers cause an IRQ */ static void irqhandler(const device_config *device, int irq) /* assumes Z80 sandwiched between 68Ks */ { - 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 ym2203_interface ym2203_interface_1 = @@ -1222,4 +1222,3 @@ GAME( 1986, darius, 0, darius, darius, darius, ROT0, "Taito Corpo GAME( 1986, dariusj, darius, darius, dariusj, darius, ROT0, "Taito Corporation", "Darius (Japan)", 0 ) GAME( 1986, dariuso, darius, darius, dariusj, darius, ROT0, "Taito Corporation", "Darius (Japan old version)", 0 ) GAME( 1986, dariuse, darius, darius, dariuse, darius, ROT0, "Taito Corporation", "Darius (Extra) (Japan)", 0 ) - diff --git a/src/mame/drivers/darkseal.c b/src/mame/drivers/darkseal.c index e2a3455700e..a670e18700c 100644 --- a/src/mame/drivers/darkseal.c +++ b/src/mame/drivers/darkseal.c @@ -41,11 +41,11 @@ static WRITE16_HANDLER( darkseal_control_w ) { switch (offset<<1) { case 6: /* DMA flag */ - buffer_spriteram16_w(space,0,0,0xffff); + buffer_spriteram16_w(space, 0, 0, 0xffff); return; case 8: /* Sound CPU write */ - soundlatch_w(space,0,data & 0xff); - cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE); + soundlatch_w(space, 0, data & 0xff); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); return; case 0xa: /* IRQ Ack (VBL) */ return; @@ -231,7 +231,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/dassault.c b/src/mame/drivers/dassault.c index 9f3a88cf16d..9441c2625f5 100644 --- a/src/mame/drivers/dassault.c +++ b/src/mame/drivers/dassault.c @@ -173,16 +173,16 @@ static READ16_HANDLER( dassault_sub_control_r ) static WRITE16_HANDLER( dassault_sound_w ) { - soundlatch_w(space,0,data&0xff); - cpu_set_input_line(space->machine->cpu[2],0,HOLD_LINE); /* IRQ1 */ + soundlatch_w(space, 0, data & 0xff); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); /* IRQ1 */ } /* The CPU-CPU irq controller is overlaid onto the end of the shared memory */ static READ16_HANDLER( dassault_irq_r ) { switch (offset) { - case 0: cpu_set_input_line(space->machine->cpu[0], 5, CLEAR_LINE); break; - case 1: cpu_set_input_line(space->machine->cpu[1], 6, CLEAR_LINE); break; + case 0: cputag_set_input_line(space->machine, "maincpu", 5, CLEAR_LINE); break; + case 1: cputag_set_input_line(space->machine, "sub", 6, CLEAR_LINE); break; } return shared_ram[(0xffc/2)+offset]; /* The values probably don't matter */ } @@ -190,11 +190,11 @@ static READ16_HANDLER( dassault_irq_r ) static WRITE16_HANDLER( dassault_irq_w ) { switch (offset) { - case 0: cpu_set_input_line(space->machine->cpu[0], 5, ASSERT_LINE); break; - case 1: cpu_set_input_line(space->machine->cpu[1], 6, ASSERT_LINE); break; + case 0: cpu_set_input_line(space->machine, "maincpu", 5, ASSERT_LINE); break; + case 1: cpu_set_input_line(space->machine, "sub", 6, ASSERT_LINE); break; } - COMBINE_DATA(&shared_ram[(0xffc/2)+offset]); /* The values probably don't matter */ + COMBINE_DATA(&shared_ram[(0xffc / 2) + offset]); /* The values probably don't matter */ } static WRITE16_HANDLER( shared_ram_w ) @@ -509,7 +509,7 @@ GFXDECODE_END static void sound_irq(const device_config *device, int state) { - cpu_set_input_line(device->machine->cpu[2],1,state); + cputag_set_input_line(device->machine, "audiocpu", 1, state); } static WRITE8_DEVICE_HANDLER( sound_bankswitch_w ) @@ -820,7 +820,7 @@ static DRIVER_INIT( dassault ) free(tmp); /* Save time waiting on vblank bit */ - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, dassault_main_skip); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, dassault_main_skip); } static DRIVER_INIT( thndzone ) @@ -840,7 +840,7 @@ static DRIVER_INIT( thndzone ) free(tmp); /* Save time waiting on vblank bit */ - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, thndzone_main_skip); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3f8000, 0x3f8001, 0, 0, thndzone_main_skip); } /**********************************************************************************/ diff --git a/src/mame/drivers/dblewing.c b/src/mame/drivers/dblewing.c index 7bace883dd2..8547cfdda22 100644 --- a/src/mame/drivers/dblewing.c +++ b/src/mame/drivers/dblewing.c @@ -364,9 +364,9 @@ static WRITE16_HANDLER( dblewing_prot_w ) //printf("%04x\n",dblwings_280_data); return; case 0x380: // sound write - soundlatch_w(space,0,data&0xff); + soundlatch_w(space, 0, data & 0xff); dblewing_sound_irq |= 0x02; - cpu_set_input_line(space->machine->cpu[1],0,(dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); return; case 0x384: dblwings_384_data = data; @@ -461,7 +461,7 @@ static READ8_HANDLER(irq_latch_r) { /* bit 1 of dblewing_sound_irq specifies IRQ command writes */ dblewing_sound_irq &= ~0x02; - cpu_set_input_line(space->machine->cpu[1], 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); return dblewing_sound_irq; } @@ -654,7 +654,7 @@ static void sound_irq(const device_config *device, int state) dblewing_sound_irq |= 0x01; else dblewing_sound_irq &= ~0x01; - cpu_set_input_line(device->machine->cpu[1], 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, (dblewing_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); } static const ym2151_interface ym2151_config = diff --git a/src/mame/drivers/dbz.c b/src/mame/drivers/dbz.c index 4457fc35901..24e227b52e3 100644 --- a/src/mame/drivers/dbz.c +++ b/src/mame/drivers/dbz.c @@ -120,15 +120,15 @@ static WRITE16_HANDLER( dbz_sound_command_w ) static WRITE16_HANDLER( dbz_sound_cause_nmi ) { - 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 void dbz_sound_irq(const device_config *device, int irq) { if (irq) - cpu_set_input_line(device->machine->cpu[1], 0, ASSERT_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, ASSERT_LINE); else - cpu_set_input_line(device->machine->cpu[1], 0, CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, CLEAR_LINE); } static ADDRESS_MAP_START( dbz_map, ADDRESS_SPACE_PROGRAM, 16 ) diff --git a/src/mame/drivers/dcheese.c b/src/mame/drivers/dcheese.c index fdd52487c0d..38430ea1a67 100644 --- a/src/mame/drivers/dcheese.c +++ b/src/mame/drivers/dcheese.c @@ -83,7 +83,7 @@ static IRQ_CALLBACK(irq_callback) void dcheese_signal_irq(running_machine *machine, int which) { irq_state[which] = 1; - update_irq_state(machine->cpu[0]); + update_irq_state(cputag_get_cpu(machine, "maincpu")); } @@ -103,7 +103,7 @@ static INTERRUPT_GEN( dcheese_vblank ) static MACHINE_START( dcheese ) { - cpu_set_irq_callback(machine->cpu[0], irq_callback); + cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), irq_callback); state_save_register_global_array(machine, irq_state); state_save_register_global(machine, soundlatch_full); @@ -145,7 +145,7 @@ static WRITE16_HANDLER( sound_command_w ) { /* write the latch and set the IRQ */ soundlatch_full = 1; - cpu_set_input_line(space->machine->cpu[1], 0, ASSERT_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, ASSERT_LINE); soundlatch_w(space, 0, data & 0xff); } } @@ -162,7 +162,7 @@ static READ8_HANDLER( sound_command_r ) { /* read the latch and clear the IRQ */ soundlatch_full = 0; - 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, 0); } @@ -805,4 +805,3 @@ GAME( 1994, fredmeuk, fredmem, fredmem, fredmem, dcheese, ROT0, "Coastal Amusem GAME( 1994, fredmemj, fredmem, fredmem, fredmem, dcheese, ROT0, "Coastal Amusements", "Fred Flintstones' Memory Match (Japan, High Score version, 3/20/95)", GAME_SUPPORTS_SAVE ) GAME( 1994, fredmemc, fredmem, fredmem, fredmem, dcheese, ROT0, "Coastal Amusements", "Fred Flintstones' Memory Match (Mandarin Chinese, 3/17/95)", GAME_SUPPORTS_SAVE ) GAME( 1994, fredmesp, fredmem, fredmem, fredmem, dcheese, ROT0, "Coastal Amusements", "Fred Flintstones' Memory Match (Spanish, 3/17/95)", GAME_SUPPORTS_SAVE ) - diff --git a/src/mame/drivers/ddayjlc.c b/src/mame/drivers/ddayjlc.c index 61b395816e7..81164a7c457 100644 --- a/src/mame/drivers/ddayjlc.c +++ b/src/mame/drivers/ddayjlc.c @@ -173,7 +173,7 @@ static WRITE8_HANDLER(bg2_w) static WRITE8_HANDLER( sound_w ) { soundlatch_w(space,offset,data); - cpu_set_input_line_and_vector(space->machine->cpu[1], 0, HOLD_LINE, 0xff); + cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff); } static WRITE8_HANDLER( i8257_CH0_w ) diff --git a/src/mame/drivers/ddealer.c b/src/mame/drivers/ddealer.c index c175776496c..45e2e0744ca 100644 --- a/src/mame/drivers/ddealer.c +++ b/src/mame/drivers/ddealer.c @@ -627,7 +627,7 @@ static READ16_HANDLER( ddealer_mcu_r ) static DRIVER_INIT( ddealer ) { - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfe01c, 0xfe01d, 0, 0, ddealer_mcu_r ); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xfe01c, 0xfe01d, 0, 0, ddealer_mcu_r ); } ROM_START( ddealer ) diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index 7ddd461b987..33a1fb1dabe 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -908,7 +908,7 @@ profiler_mark(PROFILER_VIDEO); #endif } - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, irq_vector); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, irq_vector); break; default: @@ -1974,7 +1974,7 @@ static WRITE8_HANDLER( mmpanic_rombank_w ) static WRITE8_HANDLER( mmpanic_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); } static WRITE8_HANDLER( mmpanic_blitter_w ) @@ -7896,7 +7896,7 @@ static DRIVER_INIT( rongrong ) version of the game might be a bootleg with the protection patched. (both sets need this) */ - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60d4, 0x60d4, 0, 0, (read8_space_func)SMH_NOP); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x60d4, 0x60d4, 0, 0, (read8_space_func)SMH_NOP); } /*************************************************************************** diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index 6908ebf5ec4..483b266071a 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -153,11 +153,11 @@ static TIMER_DEVICE_CALLBACK( ddragon_scanline ) /* on the rising edge of VBLK (vcount == F8), signal an NMI */ if (vcount == 0xf8) - cpu_set_input_line(timer->machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE); + cputag_set_input_line(timer->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); /* set 1ms signal on rising edge of vcount & 8 */ if (!(vcount_old & 8) && (vcount & 8)) - cpu_set_input_line(timer->machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE); + cputag_set_input_line(timer->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); } @@ -212,7 +212,7 @@ static WRITE8_HANDLER( ddragon_bankswitch_w ) if (data & 0x10) dd_sub_cpu_busy = 0; else if (dd_sub_cpu_busy == 0) - cpu_set_input_line(space->machine->cpu[1], sprite_irq, (sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE); + cputag_set_input_line(space->machine, "sub", sprite_irq, (sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE); memory_set_bank(space->machine, 1, (data & 0xe0) >> 5); } @@ -287,7 +287,7 @@ static WRITE8_HANDLER( darktowr_bankswitch_w ) if (data & 0x10) dd_sub_cpu_busy = 0; else if (dd_sub_cpu_busy == 0) - cpu_set_input_line(space->machine->cpu[1], sprite_irq, (sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE); + cputag_set_input_line(space->machine, "sub", sprite_irq, (sprite_irq == INPUT_LINE_NMI) ? PULSE_LINE : HOLD_LINE); memory_set_bank(space->machine, 1, newbank); if (newbank == 4 && oldbank != 4) @@ -309,15 +309,15 @@ static WRITE8_HANDLER( ddragon_interrupt_w ) switch (offset) { case 0: /* 380b - NMI ack */ - cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); break; case 1: /* 380c - FIRQ ack */ - cpu_set_input_line(space->machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE); break; case 2: /* 380d - IRQ ack */ - cpu_set_input_line(space->machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE); break; case 3: /* 380e - SND irq */ @@ -334,13 +334,13 @@ static WRITE8_HANDLER( ddragon_interrupt_w ) static WRITE8_HANDLER( ddragon2_sub_irq_ack_w ) { - cpu_set_input_line(space->machine->cpu[1], sprite_irq, CLEAR_LINE ); + cputag_set_input_line(space->machine, "sub", sprite_irq, CLEAR_LINE ); } static WRITE8_HANDLER( ddragon2_sub_irq_w ) { - cpu_set_input_line(space->machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE); } @@ -387,8 +387,8 @@ static WRITE8_HANDLER( ddragon_hd63701_internal_registers_w ) it's quite obvious from the Double Dragon 2 code, below). */ if (data & 3) { - cpu_set_input_line(space->machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE); - cpu_set_input_line(space->machine->cpu[1], sprite_irq, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", sprite_irq, CLEAR_LINE); } } } @@ -413,7 +413,7 @@ static READ8_HANDLER( ddragon_spriteram_r ) static WRITE8_HANDLER( ddragon_spriteram_w ) { - if (space->cpu == space->machine->cpu[1] && offset == 0) + if (space->cpu == cputag_get_cpu(space->machine, "sub") && offset == 0) dd_sub_cpu_busy = 1; ddragon_spriteram[offset] = data; @@ -566,8 +566,8 @@ ADDRESS_MAP_END /* might not be 100% accurate, check bits written */ static WRITE8_HANDLER( ddragnba_port_w ) { - cpu_set_input_line(space->machine->cpu[0],M6809_IRQ_LINE,ASSERT_LINE); - cpu_set_input_line(space->machine->cpu[1],sprite_irq, CLEAR_LINE ); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", sprite_irq, CLEAR_LINE ); } static ADDRESS_MAP_START( ddragnba_sub_portmap, ADDRESS_SPACE_IO, 8 ) @@ -1965,7 +1965,7 @@ static DRIVER_INIT( darktowr ) sound_irq = M6809_IRQ_LINE; ym_irq = M6809_FIRQ_LINE; technos_video_hw = 0; - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3808, 0x3808, 0, 0, darktowr_bankswitch_w); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3808, 0x3808, 0, 0, darktowr_bankswitch_w); } @@ -1977,7 +1977,7 @@ static DRIVER_INIT( toffy ) sound_irq = M6809_IRQ_LINE; ym_irq = M6809_FIRQ_LINE; technos_video_hw = 0; - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x3808, 0x3808, 0, 0, toffy_bankswitch_w); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x3808, 0x3808, 0, 0, toffy_bankswitch_w); /* the program rom has a simple bitswap encryption */ rom = memory_region(machine, "maincpu"); diff --git a/src/mame/drivers/ddragon3.c b/src/mame/drivers/ddragon3.c index eff1efd97fa..cb755c8d699 100644 --- a/src/mame/drivers/ddragon3.c +++ b/src/mame/drivers/ddragon3.c @@ -183,30 +183,30 @@ static WRITE16_HANDLER( ddragon3_io16_w ) break; case 1: /* soundlatch_w */ - soundlatch_w(space,1,reg[1]&0xff); - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE ); + soundlatch_w(space, 1, reg[1] & 0xff); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE ); break; case 2: /* this gets written to on startup and at the end of IRQ6 ** possibly trigger IRQ on sound CPU */ - cpu_set_input_line(space->machine->cpu[0], 6, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 6, CLEAR_LINE); break; case 3: /* this gets written to on startup, ** and at the end of IRQ5 (input port read) */ - cpu_set_input_line(space->machine->cpu[0], 5, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 5, CLEAR_LINE); break; case 4: /* this gets written to at the end of IRQ6 only */ - cpu_set_input_line(space->machine->cpu[0], 6, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 6, CLEAR_LINE); break; default: - logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset,(unsigned)data, cpu_get_pc(space->cpu) ); + logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset, (unsigned)data, cpu_get_pc(space->cpu) ); break; } } @@ -526,7 +526,7 @@ GFXDECODE_END static void dd3_ymirq_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, "audiocpu", 0 , irq ? ASSERT_LINE : CLEAR_LINE ); } static const ym2151_interface ym2151_config = @@ -549,14 +549,14 @@ static TIMER_DEVICE_CALLBACK( ddragon3_scanline ) { if (scanline > 0) video_screen_update_partial(timer->machine->primary_screen, scanline - 1); - cpu_set_input_line(timer->machine->cpu[0], 5, ASSERT_LINE); + cputag_set_input_line(timer->machine, "maincpu", 5, ASSERT_LINE); } /* Vblank is raised on scanline 248 */ if (scanline == 248) { video_screen_update_partial(timer->machine->primary_screen, scanline - 1); - cpu_set_input_line(timer->machine->cpu[0], 6, ASSERT_LINE); + cputag_set_input_line(timer->machine, "maincpu", 6, ASSERT_LINE); } } diff --git a/src/mame/drivers/deadang.c b/src/mame/drivers/deadang.c index a4b67d908b3..e4bacd02059 100644 --- a/src/mame/drivers/deadang.c +++ b/src/mame/drivers/deadang.c @@ -411,8 +411,8 @@ static DRIVER_INIT( ghunter ) seibu_sound_decrypt(machine, "audiocpu", 0x2000); seibu_adpcm_decrypt(machine, "adpcm"); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x80000, 0x80001, 0, 0, ghunter_trackball_low_r); - memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0001, 0, 0, ghunter_trackball_high_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x80000, 0x80001, 0, 0, ghunter_trackball_low_r); + memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xb0000, 0xb0001, 0, 0, ghunter_trackball_high_r); } /* Game Drivers */ diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c index dfbe7121eb9..868177c16c5 100644 --- a/src/mame/drivers/dec0.c +++ b/src/mame/drivers/dec0.c @@ -64,21 +64,21 @@ static int automat_msm5205_vclk_toggle; static WRITE16_HANDLER( dec0_control_w ) { - switch (offset<<1) + switch (offset << 1) { case 0: /* Playfield & Sprite priority */ - dec0_priority_w(space,0,data,mem_mask); + dec0_priority_w(space, 0, data, mem_mask); break; case 2: /* DMA flag */ - dec0_update_sprites_w(space,0,0,mem_mask); + dec0_update_sprites_w(space, 0, 0, mem_mask); break; case 4: /* 6502 sound cpu */ if (ACCESSING_BITS_0_7) { - soundlatch_w(space,0,data & 0xff); - cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE); + soundlatch_w(space, 0, data & 0xff); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } break; @@ -110,18 +110,18 @@ static WRITE16_HANDLER( dec0_control_w ) static WRITE16_HANDLER( automat_control_w ) { - switch (offset<<1) + switch (offset << 1) { case 0xe: /* 6502 sound cpu */ 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); } break; case 12: /* DMA flag */ - dec0_update_sprites_w(space,0,0,mem_mask); + dec0_update_sprites_w(space, 0, 0, mem_mask); break; #if 0 case 8: /* Interrupt ack (VBL - IRQ 6) */ @@ -143,16 +143,17 @@ static WRITE16_HANDLER( automat_control_w ) static WRITE16_HANDLER( slyspy_control_w ) { - switch (offset<<1) { + switch (offset << 1) + { case 0: if (ACCESSING_BITS_0_7) { - soundlatch_w(space,0,data & 0xff); - cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE); + soundlatch_w(space, 0, data & 0xff); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } break; case 2: - dec0_priority_w(space,0,data,mem_mask); + dec0_priority_w(space, 0, data, mem_mask); break; } } @@ -161,8 +162,8 @@ static WRITE16_HANDLER( midres_sound_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); + soundlatch_w(space, 0, data & 0xff); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } } @@ -944,12 +945,12 @@ GFXDECODE_END static void sound_irq(const device_config *device, int linestate) { - cpu_set_input_line(device->machine->cpu[1],0,linestate); /* IRQ */ + cputag_set_input_line(device->machine, "audiocpu", 0, linestate); /* IRQ */ } static void sound_irq2(const device_config *device, int linestate) { - cpu_set_input_line(device->machine->cpu[1],1,linestate); /* IRQ2 */ + cputag_set_input_line(device->machine, "audiocpu", 1, linestate); /* IRQ2 */ } static const ym3812_interface ym3812_config = @@ -974,7 +975,7 @@ static void automat_vclk_cb(const device_config *device) else { msm5205_data_w(device, automat_adpcm_byte >> 4); - cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); } automat_msm5205_vclk_toggle ^= 1; diff --git a/src/mame/drivers/dec8.c b/src/mame/drivers/dec8.c index 18b1735b243..b401f8f7663 100644 --- a/src/mame/drivers/dec8.c +++ b/src/mame/drivers/dec8.c @@ -56,23 +56,23 @@ static int msm5205next; /* Only used by ghostb, gondo, garyoret, other games can control buffering */ static VIDEO_EOF( dec8 ) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); - buffer_spriteram_w(space,0,0); + const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); + buffer_spriteram_w(space, 0, 0); } static READ8_HANDLER( i8751_h_r ) { - return i8751_return>>8; /* MSB */ + return i8751_return >> 8; /* MSB */ } static READ8_HANDLER( i8751_l_r ) { - return i8751_return&0xff; /* LSB */ + return i8751_return & 0xff; /* LSB */ } static WRITE8_HANDLER( i8751_reset_w ) { - i8751_return=0; + i8751_return = 0; } /******************************************************************************/ @@ -81,7 +81,8 @@ static READ8_HANDLER( gondo_player_1_r ) { int val = 1 << input_port_read(space->machine, "AN0"); - switch (offset) { + switch (offset) + { case 0: /* Rotary low byte */ return ~(val & 0xff); case 1: /* Joystick = bottom 4 bits, rotary = top 4 */ @@ -94,7 +95,8 @@ static READ8_HANDLER( gondo_player_2_r ) { int val = 1 << input_port_read(space->machine, "AN1"); - switch (offset) { + switch (offset) + { case 0: /* Rotary low byte */ return ~(val & 0xff); case 1: /* Joystick = bottom 4 bits, rotary = top 4 */ @@ -107,45 +109,47 @@ static READ8_HANDLER( gondo_player_2_r ) static WRITE8_HANDLER( ghostb_i8751_w ) { - i8751_return=0; + i8751_return = 0; - switch (offset) { + switch (offset) + { case 0: /* High byte */ - i8751_value=(i8751_value&0xff) | (data<<8); + i8751_value = (i8751_value & 0xff) | (data << 8); break; case 1: /* Low byte */ - i8751_value=(i8751_value&0xff00) | data; + i8751_value = (i8751_value & 0xff00) | data; break; } - if (i8751_value==0x00aa) i8751_return=0x655; - if (i8751_value==0x021a) i8751_return=0x6e5; /* Ghostbusters ID */ - if (i8751_value==0x021b) i8751_return=0x6e4; /* Meikyuu Hunter G ID */ + if (i8751_value == 0x00aa) i8751_return = 0x655; + if (i8751_value == 0x021a) i8751_return = 0x6e5; /* Ghostbusters ID */ + if (i8751_value == 0x021b) i8751_return = 0x6e4; /* Meikyuu Hunter G ID */ } static WRITE8_HANDLER( srdarwin_i8751_w ) { - static int coins,latch; - i8751_return=0; + static int coins, latch; + i8751_return = 0; - switch (offset) { + switch (offset) + { case 0: /* High byte */ - i8751_value=(i8751_value&0xff) | (data<<8); + i8751_value = (i8751_value & 0xff) | (data << 8); break; case 1: /* Low byte */ - i8751_value=(i8751_value&0xff00) | data; + i8751_value = (i8751_value & 0xff00) | data; break; } - if (i8751_value==0x0000) {i8751_return=0;coins=0;} - if (i8751_value==0x3063) i8751_return=0x9c; /* Protection - Japanese version */ - if (i8751_value==0x306b) i8751_return=0x94; /* Protection - World version */ - if ((i8751_value&0xff00)==0x4000) i8751_return=i8751_value; /* Coinage settings */ - if (i8751_value==0x5000) i8751_return=((coins / 10) << 4) | (coins % 10); /* Coin request */ - if (i8751_value==0x6000) {i8751_value=-1; coins--; } /* Coin clear */ + if (i8751_value == 0x0000) {i8751_return = 0; coins = 0;} + if (i8751_value == 0x3063) i8751_return = 0x9c; /* Protection - Japanese version */ + if (i8751_value == 0x306b) i8751_return = 0x94; /* Protection - World version */ + if ((i8751_value & 0xff00) == 0x4000) i8751_return = i8751_value; /* Coinage settings */ + if (i8751_value == 0x5000) i8751_return =((coins / 10) << 4) | (coins % 10); /* Coin request */ + if (i8751_value == 0x6000) {i8751_value = -1; coins--; } /* Coin clear */ /* Nb: Command 0x4000 for setting coinage options is not supported */ - if ((input_port_read(space->machine, "FAKE") & 1) == 1) latch=1; - if ((input_port_read(space->machine, "FAKE") & 1) != 1 && latch) {coins++; latch=0;} + if ((input_port_read(space->machine, "FAKE") & 1) == 1) latch = 1; + if ((input_port_read(space->machine, "FAKE") & 1) != 1 && latch) {coins++; latch = 0;} /* This next value is the index to a series of tables, each table controls the end of level bad guy, wrong values crash the @@ -183,165 +187,171 @@ bb63 = Square things again but Boss #6 is uncomfirmed as correct. */ - if (i8751_value==0x8000) i8751_return=0xf580 + 0; /* Boss #1: Snake + Bees */ - if (i8751_value==0x8001) i8751_return=0xf580 + 30; /* Boss #2: 4 Corners */ - if (i8751_value==0x8002) i8751_return=0xf580 + 26; /* Boss #3: Clock */ - if (i8751_value==0x8003) i8751_return=0xf580 + 2; /* Boss #4: Pyramid */ - if (i8751_value==0x8004) i8751_return=0xf580 + 6; /* Boss #5: Snake + Head Combo */ - if (i8751_value==0x8005) i8751_return=0xf580 + 24; /* Boss #6: LED Panels */ - if (i8751_value==0x8006) i8751_return=0xf580 + 28; /* Boss #7: Dragon */ - if (i8751_value==0x8007) i8751_return=0xf580 + 32; /* Boss #8: Teleport */ - if (i8751_value==0x8008) i8751_return=0xf580 + 38; /* Boss #9: Octopus (Pincer) */ - if (i8751_value==0x8009) i8751_return=0xf580 + 40; /* Boss #10: Bird */ - if (i8751_value==0x800a) i8751_return=0xf580 + 42; /* End Game(bad address?) */ + if (i8751_value == 0x8000) i8751_return = 0xf580 + 0; /* Boss #1: Snake + Bees */ + if (i8751_value == 0x8001) i8751_return = 0xf580 + 30; /* Boss #2: 4 Corners */ + if (i8751_value == 0x8002) i8751_return = 0xf580 + 26; /* Boss #3: Clock */ + if (i8751_value == 0x8003) i8751_return = 0xf580 + 2; /* Boss #4: Pyramid */ + if (i8751_value == 0x8004) i8751_return = 0xf580 + 6; /* Boss #5: Snake + Head Combo */ + if (i8751_value == 0x8005) i8751_return = 0xf580 + 24; /* Boss #6: LED Panels */ + if (i8751_value == 0x8006) i8751_return = 0xf580 + 28; /* Boss #7: Dragon */ + if (i8751_value == 0x8007) i8751_return = 0xf580 + 32; /* Boss #8: Teleport */ + if (i8751_value == 0x8008) i8751_return = 0xf580 + 38; /* Boss #9: Octopus (Pincer) */ + if (i8751_value == 0x8009) i8751_return = 0xf580 + 40; /* Boss #10: Bird */ + if (i8751_value == 0x800a) i8751_return = 0xf580 + 42; /* End Game(bad address?) */ } static WRITE8_HANDLER( gondo_i8751_w ) { - static int coin1,coin2,latch,snd; - i8751_return=0; + static int coin1, coin2, latch,snd; + i8751_return = 0; - switch (offset) { + switch (offset) + { case 0: /* High byte */ - i8751_value=(i8751_value&0xff) | (data<<8); - if (int_enable) cpu_set_input_line (space->machine->cpu[0], M6809_IRQ_LINE, HOLD_LINE); /* IRQ on *high* byte only */ + i8751_value = (i8751_value & 0xff) | (data << 8); + if (int_enable) + cputag_set_input_line (space->machine, "maincpu", M6809_IRQ_LINE, HOLD_LINE); /* IRQ on *high* byte only */ break; case 1: /* Low byte */ - i8751_value=(i8751_value&0xff00) | data; + i8751_value = (i8751_value & 0xff00) | data; break; } /* Coins are controlled by the i8751 */ - if ((input_port_read(space->machine, "I8751") & 3) == 3) latch=1; - if ((input_port_read(space->machine, "I8751") & 1) != 1 && latch) {coin1++; snd=1; latch=0;} - if ((input_port_read(space->machine, "I8751") & 2) != 2 && latch) {coin2++; snd=1; latch=0;} + if ((input_port_read(space->machine, "I8751") & 3) == 3) latch = 1; + if ((input_port_read(space->machine, "I8751") & 1) != 1 && latch) {coin1++; snd = 1; latch = 0;} + if ((input_port_read(space->machine, "I8751") & 2) != 2 && latch) {coin2++; snd = 1; latch = 0;} /* Work out return values */ - if (i8751_value==0x0000) {i8751_return=0; coin1=coin2=snd=0;} - if (i8751_value==0x038a) i8751_return=0x375; /* Makyou Senshi ID */ - if (i8751_value==0x038b) i8751_return=0x374; /* Gondomania ID */ - if ((i8751_value>>8)==0x04) i8751_return=0x40f; /* Coinage settings (Not supported) */ - if ((i8751_value>>8)==0x05) {i8751_return=0x500 | ((coin1 / 10) << 4) | (coin1 % 10); } /* Coin 1 */ - if ((i8751_value>>8)==0x06 && coin1 && !offset) {i8751_return=0x600; coin1--; } /* Coin 1 clear */ - if ((i8751_value>>8)==0x07) {i8751_return=0x700 | ((coin2 / 10) << 4) | (coin2 % 10); } /* Coin 2 */ - if ((i8751_value>>8)==0x08 && coin2 && !offset) {i8751_return=0x800; coin2--; } /* Coin 2 clear */ + if (i8751_value == 0x0000) {i8751_return = 0; coin1 = coin2 = snd = 0;} + if (i8751_value == 0x038a) i8751_return = 0x375; /* Makyou Senshi ID */ + if (i8751_value == 0x038b) i8751_return = 0x374; /* Gondomania ID */ + if ((i8751_value >> 8) == 0x04) i8751_return = 0x40f; /* Coinage settings (Not supported) */ + if ((i8751_value >> 8) == 0x05) {i8751_return = 0x500 | ((coin1 / 10) << 4) | (coin1 % 10); } /* Coin 1 */ + if ((i8751_value >> 8) == 0x06 && coin1 && !offset) {i8751_return = 0x600; coin1--; } /* Coin 1 clear */ + if ((i8751_value >> 8) == 0x07) {i8751_return = 0x700 | ((coin2 / 10) << 4) | (coin2 % 10); } /* Coin 2 */ + if ((i8751_value >> 8) == 0x08 && coin2 && !offset) {i8751_return = 0x800; coin2--; } /* Coin 2 clear */ /* Commands 0x9xx do nothing */ - if ((i8751_value>>8)==0x0a) {i8751_return=0xa00 | snd; if (snd) snd=0; } + if ((i8751_value >> 8) == 0x0a) {i8751_return = 0xa00 | snd; if (snd) snd = 0; } } static WRITE8_HANDLER( shackled_i8751_w ) { - static int coin1,coin2,latch=0; - i8751_return=0; + static int coin1, coin2, latch = 0; + i8751_return = 0; - switch (offset) { + switch (offset) + { case 0: /* High byte */ - i8751_value=(i8751_value&0xff) | (data<<8); - cpu_set_input_line (space->machine->cpu[1], M6809_FIRQ_LINE, HOLD_LINE); /* Signal main cpu */ + i8751_value = (i8751_value & 0xff) | (data << 8); + cputag_set_input_line(space->machine, "sub", M6809_FIRQ_LINE, HOLD_LINE); /* Signal main cpu */ break; case 1: /* Low byte */ - i8751_value=(i8751_value&0xff00) | data; + i8751_value = (i8751_value & 0xff00) | data; break; } /* Coins are controlled by the i8751 */ - if (/*(input_port_read(space->machine, "IN2") & 3) == 3*/!latch) {latch=1;coin1=coin2=0;} - if ((input_port_read(space->machine, "IN2") & 1) != 1 && latch) {coin1=1; latch=0;} - if ((input_port_read(space->machine, "IN2") & 2) != 2 && latch) {coin2=1; latch=0;} + if (/*(input_port_read(space->machine, "IN2") & 3) == 3*/!latch) {latch = 1; coin1 = coin2 = 0;} + if ((input_port_read(space->machine, "IN2") & 1) != 1 && latch) {coin1 = 1; latch = 0;} + if ((input_port_read(space->machine, "IN2") & 2) != 2 && latch) {coin2 = 1; latch = 0;} - if (i8751_value==0x0050) i8751_return=0; /* Breywood ID */ - if (i8751_value==0x0051) i8751_return=0; /* Shackled ID */ - if (i8751_value==0x0102) i8751_return=0; /* ?? */ - if (i8751_value==0x0101) i8751_return=0; /* ?? */ - if (i8751_value==0x8101) i8751_return=((coin2 / 10) << 4) | (coin2 % 10) | - ((((coin1 / 10) << 4) | (coin1 % 10))<<8); /* Coins */ + if (i8751_value == 0x0050) i8751_return = 0; /* Breywood ID */ + if (i8751_value == 0x0051) i8751_return = 0; /* Shackled ID */ + if (i8751_value == 0x0102) i8751_return = 0; /* ?? */ + if (i8751_value == 0x0101) i8751_return = 0; /* ?? */ + if (i8751_value == 0x8101) i8751_return = ((coin2 / 10) << 4) | (coin2 % 10) | + ((((coin1 / 10) << 4) | (coin1 % 10)) << 8); /* Coins */ } static WRITE8_HANDLER( lastmiss_i8751_w ) { - static int coin,latch=0,snd; - i8751_return=0; + static int coin, latch = 0, snd; + i8751_return = 0; - switch (offset) { + switch (offset) + { case 0: /* High byte */ - i8751_value=(i8751_value&0xff) | (data<<8); - cpu_set_input_line (space->machine->cpu[0], M6809_FIRQ_LINE, HOLD_LINE); /* Signal main cpu */ + i8751_value = (i8751_value & 0xff) | (data << 8); + cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, HOLD_LINE); /* Signal main cpu */ break; case 1: /* Low byte */ - i8751_value=(i8751_value&0xff00) | data; + i8751_value = (i8751_value & 0xff00) | data; break; } - if(offset==0) + if(offset == 0) { /* Coins are controlled by the i8751 */ - if ((input_port_read(space->machine, "IN2") & 3) == 3 && !latch) latch=1; - if ((input_port_read(space->machine, "IN2") & 3) != 3 && latch) {coin++; latch=0;snd=0x400;i8751_return=0x400;return;} - if (i8751_value==0x007a) i8751_return=0x0185; /* Japan ID code */ - if (i8751_value==0x007b) i8751_return=0x0184; /* USA ID code */ - if (i8751_value==0x0001) {coin=snd=0;}//??? - if (i8751_value==0x0000) {i8751_return=0x0184;}//??? - if (i8751_value==0x0401) i8751_return=0x0184; //??? - if ((i8751_value>>8)==0x01) i8751_return=0x0184; /* Coinage setup */ - if ((i8751_value>>8)==0x02) {i8751_return=snd | ((coin / 10) << 4) | (coin % 10); snd=0;} /* Coin return */ - if ((i8751_value>>8)==0x03 && coin) {i8751_return=0; coin--; } /* Coin clear */ + if ((input_port_read(space->machine, "IN2") & 3) == 3 && !latch) latch = 1; + if ((input_port_read(space->machine, "IN2") & 3) != 3 && latch) {coin++; latch = 0; snd = 0x400; i8751_return = 0x400; return;} + if (i8751_value == 0x007a) i8751_return = 0x0185; /* Japan ID code */ + if (i8751_value == 0x007b) i8751_return = 0x0184; /* USA ID code */ + if (i8751_value == 0x0001) {coin = snd = 0;}//??? + if (i8751_value == 0x0000) {i8751_return = 0x0184;}//??? + if (i8751_value == 0x0401) i8751_return = 0x0184; //??? + if ((i8751_value >> 8) == 0x01) i8751_return = 0x0184; /* Coinage setup */ + if ((i8751_value >> 8) == 0x02) {i8751_return = snd | ((coin / 10) << 4) | (coin % 10); snd = 0;} /* Coin return */ + if ((i8751_value >> 8) == 0x03 && coin) {i8751_return = 0; coin--; } /* Coin clear */ } } static WRITE8_HANDLER( csilver_i8751_w ) { - static int coin,latch=0,snd; - i8751_return=0; + static int coin, latch = 0, snd; + i8751_return = 0; - switch (offset) { + switch (offset) + { case 0: /* High byte */ - i8751_value=(i8751_value&0xff) | (data<<8); - cpu_set_input_line (space->machine->cpu[0], M6809_FIRQ_LINE, HOLD_LINE); /* Signal main cpu */ + i8751_value = (i8751_value & 0xff) | (data << 8); + cputag_set_input_line (space->machine, "maincpu", M6809_FIRQ_LINE, HOLD_LINE); /* Signal main cpu */ break; case 1: /* Low byte */ - i8751_value=(i8751_value&0xff00) | data; + i8751_value = (i8751_value & 0xff00) | data; break; } - if(offset==0) + if(offset == 0) { /* Coins are controlled by the i8751 */ - if ((input_port_read(space->machine, "IN2") & 3) == 3 && !latch) latch=1; - if ((input_port_read(space->machine, "IN2") & 3) != 3 && latch) {coin++; latch=0; snd=0x1200; i8751_return=0x1200;return;} + if ((input_port_read(space->machine, "IN2") & 3) == 3 && !latch) latch = 1; + if ((input_port_read(space->machine, "IN2") & 3) != 3 && latch) {coin++; latch = 0; snd = 0x1200; i8751_return = 0x1200; return;} - if (i8751_value==0x054a) {i8751_return=~(0x4a); coin=0; snd=0;} /* Captain Silver (Japan) ID */ - if (i8751_value==0x054c) {i8751_return=~(0x4c); coin=0; snd=0;} /* Captain Silver (World) ID */ - if ((i8751_value>>8)==0x01) i8751_return=0; /* Coinage - Not Supported */ - if ((i8751_value>>8)==0x02) {i8751_return=snd | coin; snd=0; } /* Coin Return */ - if ((i8751_value>>8)==0x03 && coin) {i8751_return=0; coin--;} /* Coin Clear */ + if (i8751_value == 0x054a) {i8751_return = ~(0x4a); coin = 0; snd = 0;} /* Captain Silver (Japan) ID */ + if (i8751_value == 0x054c) {i8751_return = ~(0x4c); coin = 0; snd = 0;} /* Captain Silver (World) ID */ + if ((i8751_value >> 8) == 0x01) i8751_return = 0; /* Coinage - Not Supported */ + if ((i8751_value >> 8) == 0x02) {i8751_return = snd | coin; snd = 0; } /* Coin Return */ + if ((i8751_value >> 8) == 0x03 && coin) {i8751_return = 0; coin--;} /* Coin Clear */ } } static WRITE8_HANDLER( garyoret_i8751_w ) { - static int coin1,coin2,latch; - i8751_return=0; + static int coin1, coin2, latch; + i8751_return = 0; - switch (offset) { + switch (offset) + { case 0: /* High byte */ - i8751_value=(i8751_value&0xff) | (data<<8); + i8751_value = (i8751_value & 0xff) | (data << 8); break; case 1: /* Low byte */ - i8751_value=(i8751_value&0xff00) | data; + i8751_value = (i8751_value & 0xff00) | data; break; } /* Coins are controlled by the i8751 */ if ((input_port_read(space->machine, "I8751") & 3) == 3) latch=1; - if ((input_port_read(space->machine, "I8751") & 1) != 1 && latch) {coin1++; latch=0;} - if ((input_port_read(space->machine, "I8751") & 2) != 2 && latch) {coin2++; latch=0;} + if ((input_port_read(space->machine, "I8751") & 1) != 1 && latch) {coin1++; latch = 0;} + if ((input_port_read(space->machine, "I8751") & 2) != 2 && latch) {coin2++; latch = 0;} /* Work out return values */ - if ((i8751_value>>8)==0x00) {i8751_return=0; coin1=coin2=0;} - if ((i8751_value>>8)==0x01) i8751_return=0x59a; /* ID */ - if ((i8751_value>>8)==0x04) i8751_return=i8751_value; /* Coinage settings (Not supported) */ - if ((i8751_value>>8)==0x05) {i8751_return=0x00 | ((coin1 / 10) << 4) | (coin1 % 10); } /* Coin 1 */ - if ((i8751_value>>8)==0x06 && coin1 && !offset) {i8751_return=0x600; coin1--; } /* Coin 1 clear */ + if ((i8751_value >> 8) == 0x00) {i8751_return = 0; coin1 = coin2 = 0;} + if ((i8751_value >> 8) == 0x01) i8751_return = 0x59a; /* ID */ + if ((i8751_value >> 8) == 0x04) i8751_return = i8751_value; /* Coinage settings (Not supported) */ + if ((i8751_value >> 8) == 0x05) {i8751_return = 0x00 | ((coin1 / 10) << 4) | (coin1 % 10); } /* Coin 1 */ + if ((i8751_value >> 8) == 0x06 && coin1 && !offset) {i8751_return = 0x600; coin1--; } /* Coin 1 clear */ } /******************************************************************************/ @@ -369,10 +379,10 @@ static WRITE8_HANDLER( ghostb_bank_w ) */ bankaddress = 0x10000 + (data >> 4) * 0x4000; - memory_set_bankptr(space->machine, 1,&RAM[bankaddress]); + memory_set_bankptr(space->machine, 1, &RAM[bankaddress]); - if (data&1) int_enable=1; else int_enable=0; - if (data&2) nmi_enable=1; else nmi_enable=0; + if (data & 1) int_enable =1; else int_enable = 0; + if (data & 2) nmi_enable =1; else nmi_enable = 0; flip_screen_set(space->machine, data & 0x08); } @@ -387,36 +397,30 @@ static WRITE8_HANDLER( csilver_control_w ) Bit 0x40 - Unused. Bit 0x80 - Hold subcpu reset line high if clear, else low? (Not needed anyway) */ - memory_set_bankptr(space->machine, 1,&RAM[0x10000 + (data & 0x0f) * 0x4000]); + memory_set_bankptr(space->machine, 1, &RAM[0x10000 + (data & 0x0f) * 0x4000]); } static WRITE8_HANDLER( dec8_sound_w ) { - soundlatch_w(space,0,data); - cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE); -} - -static WRITE8_HANDLER( oscar_sound_w ) -{ - soundlatch_w(space,0,data); - cpu_set_input_line(space->machine->cpu[2],INPUT_LINE_NMI,PULSE_LINE); + soundlatch_w(space, 0, data); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE); } static void csilver_adpcm_int(const device_config *device) { - static int toggle =0; + static int toggle = 0; toggle ^= 1; if (toggle) - cpu_set_input_line(device->machine->cpu[2],M6502_IRQ_LINE,HOLD_LINE); + cpu_set_input_line(device->machine, "audiocpu", M6502_IRQ_LINE, HOLD_LINE); - msm5205_data_w (device,msm5205next>>4); - msm5205next<<=4; + msm5205_data_w(device, msm5205next >> 4); + msm5205next <<= 4; } static READ8_DEVICE_HANDLER( csilver_adpcm_reset_r ) { - msm5205_reset_w(device,0); + msm5205_reset_w(device, 0); return 0; } @@ -429,8 +433,10 @@ static WRITE8_HANDLER( csilver_sound_bank_w ) { UINT8 *RAM = memory_region(space->machine, "audiocpu"); - if (data&8) { memory_set_bankptr(space->machine, 3,&RAM[0x14000]); } - else { memory_set_bankptr(space->machine, 3,&RAM[0x10000]); } + if (data & 8) + memory_set_bankptr(space->machine, 3, &RAM[0x14000]); + else + memory_set_bankptr(space->machine, 3, &RAM[0x10000]); } /******************************************************************************/ @@ -438,18 +444,19 @@ static WRITE8_HANDLER( csilver_sound_bank_w ) static WRITE8_HANDLER( oscar_int_w ) { /* Deal with interrupts, coins also generate NMI to CPU 0 */ - switch (offset) { + switch (offset) + { case 0: /* IRQ2 */ - 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); return; case 1: /* IRC 1 */ - cpu_set_input_line(space->machine->cpu[0],M6809_IRQ_LINE,CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE); return; case 2: /* IRQ 1 */ - cpu_set_input_line(space->machine->cpu[0],M6809_IRQ_LINE,ASSERT_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE); return; case 3: /* IRC 2 */ - 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); return; } } @@ -461,25 +468,27 @@ static WRITE8_HANDLER( shackled_int_w ) /* This is correct, but the cpus in Shackled need an interleave of about 5000! With lower interleave CPU 0 misses an interrupt at the start of the game (The last interrupt has not finished and been ack'd when the new one occurs */ - switch (offset) { + switch (offset) + { case 0: /* CPU 2 - IRQ acknowledge */ - 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); return; case 1: /* CPU 1 - IRQ acknowledge */ - cpu_set_input_line(space->machine->cpu[0],M6809_IRQ_LINE,CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE); return; case 2: /* i8751 - FIRQ acknowledge */ return; case 3: /* IRQ 1 */ - cpu_set_input_line(space->machine->cpu[0],M6809_IRQ_LINE,ASSERT_LINE); + cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE); return; case 4: /* IRQ 2 */ - 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); return; } #endif - switch (offset) { + switch (offset) + { case 0: /* CPU 2 - IRQ acknowledge */ return; case 1: /* CPU 1 - IRQ acknowledge */ @@ -487,10 +496,10 @@ static WRITE8_HANDLER( shackled_int_w ) case 2: /* i8751 - FIRQ acknowledge */ return; case 3: /* IRQ 1 */ - cpu_set_input_line (space->machine->cpu[0], M6809_IRQ_LINE, HOLD_LINE); + cputag_set_input_line (space->machine, "maincpu", M6809_IRQ_LINE, HOLD_LINE); return; case 4: /* IRQ 2 */ - cpu_set_input_line (space->machine->cpu[1], M6809_IRQ_LINE, HOLD_LINE); + cputag_set_input_line (space->machine, "sub", M6809_IRQ_LINE, HOLD_LINE); return; } } @@ -498,8 +507,8 @@ static WRITE8_HANDLER( shackled_int_w ) /******************************************************************************/ static READ8_HANDLER( shackled_sprite_r ) { return spriteram[offset]; } -static WRITE8_HANDLER( shackled_sprite_w ) { spriteram[offset]=data; } -static WRITE8_HANDLER( flip_screen_w ) { flip_screen_set(space->machine, data); } +static WRITE8_HANDLER( shackled_sprite_w ) { spriteram[offset] = data; } +static WRITE8_HANDLER( flip_screen_w ) { flip_screen_set(space->machine, data); } /******************************************************************************/ @@ -612,7 +621,7 @@ static ADDRESS_MAP_START( oscar_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x3c00, 0x3c1f) AM_WRITE(dec8_bac06_0_w) AM_RANGE(0x3c80, 0x3c80) AM_WRITE(buffer_spriteram_w) /* DMA */ AM_RANGE(0x3d00, 0x3d00) AM_WRITE(dec8_bank_w) /* BNKS */ - AM_RANGE(0x3d80, 0x3d80) AM_WRITE(oscar_sound_w) /* SOUN */ + AM_RANGE(0x3d80, 0x3d80) AM_WRITE(dec8_sound_w) /* SOUN */ AM_RANGE(0x3e00, 0x3e00) AM_WRITENOP /* COINCL */ AM_RANGE(0x3e80, 0x3e83) AM_WRITE(oscar_int_w) AM_RANGE(0x4000, 0x7fff) AM_ROMBANK(1) @@ -642,7 +651,7 @@ static ADDRESS_MAP_START( lastmiss_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1807, 0x1807) AM_READWRITE(i8751_l_r, flip_screen_w) AM_RANGE(0x1809, 0x1809) AM_WRITE(lastmiss_scrollx_w) /* Scroll LSB */ AM_RANGE(0x180b, 0x180b) AM_WRITE(lastmiss_scrolly_w) /* Scroll LSB */ - AM_RANGE(0x180c, 0x180c) AM_WRITE(oscar_sound_w) + AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w) AM_RANGE(0x180d, 0x180d) AM_WRITE(lastmiss_control_w) /* Bank switch + Scroll MSB */ AM_RANGE(0x180e, 0x180f) AM_WRITE(lastmiss_i8751_w) AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) @@ -665,7 +674,7 @@ static ADDRESS_MAP_START( lastmiss_sub_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w) AM_RANGE(0x1805, 0x1805) AM_WRITE(buffer_spriteram_w) /* DMA */ AM_RANGE(0x1807, 0x1807) AM_WRITE(flip_screen_w) - AM_RANGE(0x180c, 0x180c) AM_WRITE(oscar_sound_w) + AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w) AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM) AM_WRITE(dec8_videoram_w) AM_RANGE(0x2800, 0x2fff) AM_WRITE(shackled_sprite_w) AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE(2) @@ -687,7 +696,7 @@ static ADDRESS_MAP_START( shackled_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1807, 0x1807) AM_WRITE(flip_screen_w) AM_RANGE(0x1809, 0x1809) AM_WRITE(lastmiss_scrollx_w) /* Scroll LSB */ AM_RANGE(0x180b, 0x180b) AM_WRITE(lastmiss_scrolly_w) /* Scroll LSB */ - AM_RANGE(0x180c, 0x180c) AM_WRITE(oscar_sound_w) + AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w) AM_RANGE(0x180d, 0x180d) AM_WRITE(shackled_control_w) /* Bank switch + Scroll MSB */ AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM) AM_WRITE(dec8_videoram_w) AM_RANGE(0x2800, 0x2fff) AM_READWRITE(shackled_sprite_r, shackled_sprite_w) @@ -712,7 +721,7 @@ static ADDRESS_MAP_START( shackled_sub_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1807, 0x1807) AM_READWRITE(i8751_l_r, flip_screen_w) AM_RANGE(0x1809, 0x1809) AM_WRITE(lastmiss_scrollx_w) /* Scroll LSB */ AM_RANGE(0x180b, 0x180b) AM_WRITE(lastmiss_scrolly_w) /* Scroll LSB */ - AM_RANGE(0x180c, 0x180c) AM_WRITE(oscar_sound_w) + AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w) AM_RANGE(0x180d, 0x180d) AM_WRITE(shackled_control_w) /* Bank switch + Scroll MSB */ AM_RANGE(0x180e, 0x180f) AM_WRITE(shackled_i8751_w) AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) @@ -734,7 +743,7 @@ static ADDRESS_MAP_START( csilver_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0") AM_WRITE(buffer_spriteram_w) /* Dip 1, DMA */ AM_RANGE(0x1807, 0x1807) AM_WRITE(flip_screen_w) AM_RANGE(0x1808, 0x180b) AM_WRITE(dec8_scroll2_w) - AM_RANGE(0x180c, 0x180c) AM_WRITE(oscar_sound_w) + AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w) AM_RANGE(0x180d, 0x180d) AM_WRITE(csilver_control_w) AM_RANGE(0x180e, 0x180f) AM_WRITE(csilver_i8751_w) AM_RANGE(0x1c00, 0x1c00) AM_READ(i8751_h_r) @@ -755,7 +764,7 @@ static ADDRESS_MAP_START( csilver_sub_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1") AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w) AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0") AM_WRITE(buffer_spriteram_w) /* DMA */ - AM_RANGE(0x180c, 0x180c) AM_WRITE(oscar_sound_w) + AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w) AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size) AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE(2) @@ -1823,12 +1832,7 @@ GFXDECODE_END /* handler called by the 3812 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],0,linestate); /* M6502_IRQ_LINE */ -} - -static void oscar_irqhandler(const device_config *device, int linestate) -{ - cpu_set_input_line(device->machine->cpu[2],0,linestate); /* M6502_IRQ_LINE */ + cputag_set_input_line(device->machine, "audiocpu", 0, linestate); /* M6502_IRQ_LINE */ } static const ym3526_interface ym3526_config = @@ -1836,11 +1840,6 @@ static const ym3526_interface ym3526_config = irqhandler }; -static const ym3526_interface oscar_ym3526_interface = -{ - oscar_irqhandler -}; - static const ym3812_interface ym3812_config = { irqhandler @@ -1857,18 +1856,18 @@ static const msm5205_interface msm5205_config = static INTERRUPT_GEN( ghostb_interrupt ) { static int latch[4]; - int i8751_out=input_port_read(device->machine, "I8751"); + int i8751_out = input_port_read(device->machine, "I8751"); /* Ghostbusters coins are controlled by the i8751 */ - if ((i8751_out & 0x8) == 0x8) latch[0]=1; - if ((i8751_out & 0x4) == 0x4) latch[1]=1; - if ((i8751_out & 0x2) == 0x2) latch[2]=1; - if ((i8751_out & 0x1) == 0x1) latch[3]=1; + if ((i8751_out & 0x8) == 0x8) latch[0] = 1; + if ((i8751_out & 0x4) == 0x4) latch[1] = 1; + if ((i8751_out & 0x2) == 0x2) latch[2] = 1; + if ((i8751_out & 0x1) == 0x1) latch[3] = 1; - if (((i8751_out & 0x8) != 0x8) && latch[0]) {latch[0]=0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return=0x8001; } /* Player 1 coin */ - if (((i8751_out & 0x4) != 0x4) && latch[1]) {latch[1]=0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return=0x4001; } /* Player 2 coin */ - if (((i8751_out & 0x2) != 0x2) && latch[2]) {latch[2]=0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return=0x2001; } /* Player 3 coin */ - if (((i8751_out & 0x1) != 0x1) && latch[3]) {latch[3]=0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return=0x1001; } /* Service */ + if (((i8751_out & 0x8) != 0x8) && latch[0]) {latch[0] = 0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return = 0x8001; } /* Player 1 coin */ + if (((i8751_out & 0x4) != 0x4) && latch[1]) {latch[1] = 0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return = 0x4001; } /* Player 2 coin */ + if (((i8751_out & 0x2) != 0x2) && latch[2]) {latch[2] = 0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return = 0x2001; } /* Player 3 coin */ + if (((i8751_out & 0x1) != 0x1) && latch[3]) {latch[3] = 0; cpu_set_input_line(device,M6809_IRQ_LINE,HOLD_LINE); i8751_return = 0x1001; } /* Service */ if (nmi_enable) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); /* VBL */ } @@ -1882,11 +1881,12 @@ static INTERRUPT_GEN( gondo_interrupt ) /* Coins generate NMI's */ static INTERRUPT_GEN( oscar_interrupt ) { - static int latch=1; + static int latch = 1; - if ((input_port_read(device->machine, "IN2") & 0x7) == 0x7) latch=1; - if (latch && (input_port_read(device->machine, "IN2") & 0x7) != 0x7) { - latch=0; + if ((input_port_read(device->machine, "IN2") & 0x7) == 0x7) latch = 1; + if (latch && (input_port_read(device->machine, "IN2") & 0x7) != 0x7) + { + latch = 0; cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); } } @@ -2101,7 +2101,7 @@ static MACHINE_DRIVER_START( oscar ) MDRV_SOUND_ROUTE(3, "mono", 0.20) MDRV_SOUND_ADD("ym2", YM3526, XTAL_12MHz/4) /* verified on pcb */ - MDRV_SOUND_CONFIG(oscar_ym3526_interface) + MDRV_SOUND_CONFIG(ym3526_interface) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) MACHINE_DRIVER_END @@ -2145,7 +2145,7 @@ static MACHINE_DRIVER_START( lastmiss ) MDRV_SOUND_ROUTE(3, "mono", 0.20) MDRV_SOUND_ADD("ym2", YM3526, 3000000) - MDRV_SOUND_CONFIG(oscar_ym3526_interface) + MDRV_SOUND_CONFIG(ym3526_interface) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) MACHINE_DRIVER_END @@ -2189,7 +2189,7 @@ static MACHINE_DRIVER_START( shackled ) MDRV_SOUND_ROUTE(3, "mono", 0.20) MDRV_SOUND_ADD("ym2", YM3526, 3000000) - MDRV_SOUND_CONFIG(oscar_ym3526_interface) + MDRV_SOUND_CONFIG(ym3526_interface) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) MACHINE_DRIVER_END @@ -2234,7 +2234,7 @@ static MACHINE_DRIVER_START( csilver ) MDRV_SOUND_ROUTE(3, "mono", 0.20) MDRV_SOUND_ADD("ym2", YM3526, XTAL_12MHz/4) /* verified on pcb */ - MDRV_SOUND_CONFIG(oscar_ym3526_interface) + MDRV_SOUND_CONFIG(ym3526_interface) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70) MDRV_SOUND_ADD("msm", MSM5205, XTAL_384kHz) /* verified on pcb */ diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index cd5e66e5b56..7160dd7cf96 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -253,16 +253,17 @@ static TIMER_CALLBACK( interrupt_gen ) deco32_raster_display_list[deco32_raster_display_position++]=deco32_pf12_control[3]&0xffff; deco32_raster_display_list[deco32_raster_display_position++]=deco32_pf12_control[4]&0xffff; - cpu_set_input_line(machine->cpu[0], ARM_IRQ_LINE, HOLD_LINE); + cputag_set_input_line(machine, "maincpu", ARM_IRQ_LINE, HOLD_LINE); } static READ32_HANDLER( deco32_irq_controller_r ) { int vblank; - switch (offset) { + switch (offset) + { case 2: /* Raster IRQ ACK - value read is not used */ - cpu_set_input_line(space->machine->cpu[0], ARM_IRQ_LINE, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", ARM_IRQ_LINE, CLEAR_LINE); return 0; case 3: /* Irq controller @@ -316,7 +317,7 @@ static WRITE32_HANDLER( deco32_irq_controller_w ) static WRITE32_HANDLER( deco32_sound_w ) { soundlatch_w(space,0,data & 0xff); - cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); } static READ32_HANDLER( deco32_71_r ) @@ -598,9 +599,9 @@ static WRITE32_HANDLER( tattass_control_w ) /* Sound board reset control */ if (data&0x80) - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, CLEAR_LINE); else - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE); /* bit 0x4 fade cancel? */ /* bit 0x8 ?? */ @@ -647,7 +648,7 @@ static WRITE32_HANDLER( nslasher_prot_w ) /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ soundlatch_w(space,0,(data>>16)&0xff); nslasher_sound_irq |= 0x02; - cpu_set_input_line(space->machine->cpu[1], 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); } } @@ -940,8 +941,8 @@ static WRITE8_HANDLER(deco32_bsmt0_w) static WRITE8_DEVICE_HANDLER(deco32_bsmt1_w) { - bsmt2000_data_w(device, offset^ 0xff, ((bsmt_latch<<8)|data), 0xffff); - cpu_set_input_line(device->machine->cpu[1], M6809_IRQ_LINE, HOLD_LINE); /* BSMT is ready */ + bsmt2000_data_w(device, offset^ 0xff, ((bsmt_latch << 8) | data), 0xffff); + cputag_set_input_line(device->machine, "audiocpu", M6809_IRQ_LINE, HOLD_LINE); /* BSMT is ready */ } static READ8_HANDLER(deco32_bsmt_status_r) @@ -974,7 +975,7 @@ static READ8_HANDLER(latch_r) { /* bit 1 of nslasher_sound_irq specifies IRQ command writes */ nslasher_sound_irq &= ~0x02; - cpu_set_input_line(space->machine->cpu[1], 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); return soundlatch_r(space,0); } @@ -1572,7 +1573,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 void sound_irq_nslasher(const device_config *device, int state) @@ -1582,7 +1583,7 @@ static void sound_irq_nslasher(const device_config *device, int state) nslasher_sound_irq |= 0x01; else nslasher_sound_irq &= ~0x01; - cpu_set_input_line(device->machine->cpu[1], 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE); } static WRITE8_DEVICE_HANDLER( sound_bankswitch_w ) diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c index 3fb3bd05331..75c814763e3 100644 --- a/src/mame/drivers/deco_mlc.c +++ b/src/mame/drivers/deco_mlc.c @@ -177,7 +177,7 @@ static READ32_HANDLER( mlc_scanline_r ) static TIMER_CALLBACK( interrupt_gen ) { // logerror("hit scanline IRQ %d (%08x)\n", video_screen_get_vpos(machine->primary_screen), info.i); - cpu_set_input_line(machine->cpu[0], mainCpuIsArm ? ARM_IRQ_LINE : 1, HOLD_LINE); + cputag_set_input_line(machine, "maincpu", mainCpuIsArm ? ARM_IRQ_LINE : 1, HOLD_LINE); } static WRITE32_HANDLER( mlc_irq_w ) @@ -189,7 +189,7 @@ static WRITE32_HANDLER( mlc_irq_w ) switch (offset*4) { case 0x10: /* IRQ ack. Value written doesn't matter */ - cpu_set_input_line(space->machine->cpu[0], mainCpuIsArm ? ARM_IRQ_LINE : 1, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", mainCpuIsArm ? ARM_IRQ_LINE : 1, CLEAR_LINE); return; case 0x14: /* Prepare scanline interrupt */ timer_adjust_oneshot(raster_irq_timer,video_screen_get_time_until_pos(space->machine->primary_screen, irq_ram[0x14/4], 0),0); @@ -733,14 +733,14 @@ static READ32_HANDLER( avengrgs_speedup_r ) static DRIVER_INIT( avengrgs ) { // init options - sh2drc_set_options(machine->cpu[0], SH2DRC_FASTEST_OPTIONS); + sh2drc_set_options(cputag_get_cpu(machine, "maincpu"), SH2DRC_FASTEST_OPTIONS); // set up speed cheat - sh2drc_add_pcflush(machine->cpu[0], 0x3234); - sh2drc_add_pcflush(machine->cpu[0], 0x32dc); + sh2drc_add_pcflush(cputag_get_cpu(machine, "maincpu"), 0x3234); + sh2drc_add_pcflush(cputag_get_cpu(machine, "maincpu"), 0x32dc); - mainCpuIsArm=0; - memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01089a0, 0x01089a3, 0, 0, avengrgs_speedup_r ); + mainCpuIsArm = 0; + memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x01089a0, 0x01089a3, 0, 0, avengrgs_speedup_r ); descramble_sound(machine); } @@ -749,8 +749,8 @@ static DRIVER_INIT( mlc ) /* The timing in the ARM core isn't as accurate as it should be, so bump up the effective clock rate here to compensate otherwise we have slowdowns in Skull Fung where there probably shouldn't be. */ - cpu_set_clockscale(machine->cpu[0], 2.0f); - mainCpuIsArm=1; + cpu_set_clockscale(cputag_get_cpu(machine, "maincpu"), 2.0f); + mainCpuIsArm = 1; deco156_decrypt(machine); descramble_sound(machine); } diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c index 4fc24cee401..bf3c0d3cb9e 100644 --- a/src/mame/drivers/decocass.c +++ b/src/mame/drivers/decocass.c @@ -1078,7 +1078,7 @@ static DRIVER_INIT( decocrom ) decrypted2[i] = swap_bits_5_6(rom[i]); /* convert charram to a banked ROM */ - memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000, 0xafff, 0, 0, (read8_space_func)SMH_BANK(1), decocass_de0091_w); + memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x6000, 0xafff, 0, 0, (read8_space_func)SMH_BANK(1), decocass_de0091_w); memory_configure_bank(machine, 1, 0, 1, decocass_charram, 0); memory_configure_bank(machine, 1, 1, 1, memory_region(machine, "user3"), 0); memory_configure_bank_decrypted(machine, 1, 0, 1, &decrypted[0x6000], 0); @@ -1086,7 +1086,7 @@ static DRIVER_INIT( decocrom ) memory_set_bank(machine, 1, 0); /* install the bank selector */ - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe900, 0xe900, 0, 0, decocass_e900_w); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe900, 0xe900, 0, 0, decocass_e900_w); } diff --git a/src/mame/drivers/deniam.c b/src/mame/drivers/deniam.c index 688cf49b311..c39dd401cf3 100644 --- a/src/mame/drivers/deniam.c +++ b/src/mame/drivers/deniam.c @@ -57,7 +57,7 @@ static WRITE16_HANDLER( sound_command_w ) if (ACCESSING_BITS_8_15) { soundlatch_w(space,offset,(data >> 8) & 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); } } @@ -223,8 +223,8 @@ GFXDECODE_END static void irqhandler(const device_config *device, int linestate) { /* system 16c doesn't have the sound CPU */ - if (device->machine->cpu[1] != NULL) - cpu_set_input_line(device->machine->cpu[1],0,linestate); + if (cputag_get_cpu(device->machine, "audiocpu") != NULL) + cputag_set_input_line(device->machine, "audiocpu", 0, linestate); } static const ym3812_interface ym3812_config = @@ -406,4 +406,3 @@ GAME( 1996, logicpro, 0, deniam16b, logicpr2, logicpro, ROT0, "Deniam", " GAME( 1996, croquis, logicpro, deniam16b, logicpr2, logicpro, ROT0, "Deniam", "Croquis (Germany)", 0 ) GAME( 1996, karianx, 0, deniam16b, karianx, karianx, ROT0, "Deniam", "Karian Cross (Rev. 1.0)", 0 ) GAME( 1997, logicpr2, 0, deniam16c, logicpr2, logicpro, ROT0, "Deniam", "Logic Pro 2 (Japan)", GAME_IMPERFECT_SOUND ) - diff --git a/src/mame/drivers/deshoros.c b/src/mame/drivers/deshoros.c index 9616df3ce2e..c8f1fb76a18 100644 --- a/src/mame/drivers/deshoros.c +++ b/src/mame/drivers/deshoros.c @@ -146,7 +146,7 @@ INPUT_PORTS_END /*Is it there an IRQ mask?*/ static INTERRUPT_GEN( deshoros_irq ) { - cpu_set_input_line(device->machine->cpu[0], M6809_IRQ_LINE, HOLD_LINE); + cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, HOLD_LINE); } static MACHINE_RESET( deshoros ) diff --git a/src/mame/drivers/destroyr.c b/src/mame/drivers/destroyr.c index 2345dbed54c..ca2142a8c25 100644 --- a/src/mame/drivers/destroyr.c +++ b/src/mame/drivers/destroyr.c @@ -39,7 +39,7 @@ static TIMER_CALLBACK( destroyr_dial_callback ) if (destroyr_potmask[dial]) { - cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); } } @@ -88,7 +88,7 @@ static WRITE8_HANDLER( destroyr_cursor_load_w ) static WRITE8_HANDLER( destroyr_interrupt_ack_w ) { - cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); } diff --git a/src/mame/drivers/dgpix.c b/src/mame/drivers/dgpix.c index 6ac3dfd3f42..44fe1edc0e6 100644 --- a/src/mame/drivers/dgpix.c +++ b/src/mame/drivers/dgpix.c @@ -566,7 +566,7 @@ static DRIVER_INIT( xfiles ) rom[BYTE4_XOR_BE(0x3aa933)] = 0; // protection related ? -// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf0c8b440, 0xf0c8b447, 0, 0, (read32_space_func)SMH_NOP ); +// memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf0c8b440, 0xf0c8b447, 0, 0, (read32_space_func)SMH_NOP ); flash_roms = 2; } @@ -586,7 +586,7 @@ static DRIVER_INIT( kdynastg ) rom[BYTE4_XOR_BE(0x3a45c9)] = 0; // protection related ? -// memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x12341234, 0x12341243, 0, 0, (read32_space_func)SMH_NOP ); +// memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x12341234, 0x12341243, 0, 0, (read32_space_func)SMH_NOP ); flash_roms = 4; } diff --git a/src/mame/drivers/dietgo.c b/src/mame/drivers/dietgo.c index 963d21bb5b7..a7920589489 100644 --- a/src/mame/drivers/dietgo.c +++ b/src/mame/drivers/dietgo.c @@ -164,7 +164,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/discoboy.c b/src/mame/drivers/discoboy.c index 217e797cc6b..1e88868cd17 100644 --- a/src/mame/drivers/discoboy.c +++ b/src/mame/drivers/discoboy.c @@ -203,10 +203,10 @@ static WRITE8_HANDLER( discoboy_port_01_w ) static WRITE8_HANDLER( discoboy_port_03_w ) // sfx? (to sound cpu) { -// printf("unk discoboy_port_03_w %02x\n",data); -// cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,HOLD_LINE); - soundlatch_w(space,0,data); - cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE); +// printf("unk discoboy_port_03_w %02x\n", data); +// cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, HOLD_LINE); + soundlatch_w(space, 0, data); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); } static WRITE8_HANDLER( discoboy_port_06_w ) @@ -542,4 +542,3 @@ ROM_END GAME( 1993, discoboy, 0, discoboy, discoboy, discoboy, ROT270, "Soft Art Co.", "Disco Boy", 0 ) - diff --git a/src/mame/drivers/diverboy.c b/src/mame/drivers/diverboy.c index 8eaa6b72477..0bfe41aa523 100644 --- a/src/mame/drivers/diverboy.c +++ b/src/mame/drivers/diverboy.c @@ -63,7 +63,7 @@ static WRITE16_HANDLER( soundcmd_w ) if (ACCESSING_BITS_0_7) { soundlatch_w(space,0,data & 0xff); - cpu_set_input_line(space->machine->cpu[1],0,HOLD_LINE); + cputag_set_input_line(space->machine, "audiocpu", 0, HOLD_LINE); } } diff --git a/src/mame/drivers/djboy.c b/src/mame/drivers/djboy.c index ef3dccba747..014ac5ca2a7 100644 --- a/src/mame/drivers/djboy.c +++ b/src/mame/drivers/djboy.c @@ -657,7 +657,7 @@ static DRIVER_INIT( djboyj ) static WRITE8_HANDLER( trigger_nmi_on_cpu0 ) { - cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); + cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); } static WRITE8_HANDLER( cpu0_bankswitch_w ) @@ -715,23 +715,23 @@ static WRITE8_HANDLER( cpu1_bankswitch_w ) static WRITE8_HANDLER( trigger_nmi_on_sound_cpu2 ) { - soundlatch_w(space,0,data); - cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_NMI, PULSE_LINE); + soundlatch_w(space, 0, data); + cputag_set_input_line(space->machine, "cpu2", INPUT_LINE_NMI, PULSE_LINE); } /* trigger_nmi_on_sound_cpu2 */ static WRITE8_HANDLER( cpu2_bankswitch_w ) { UINT8 *RAM = memory_region(space->machine, "cpu2"); - if( data<3 ) + if( data < 3 ) { RAM = &RAM[0x04000 * data]; } else { - RAM = &RAM[0x10000 + 0x4000*(data-3)]; + RAM = &RAM[0x10000 + 0x4000 * (data - 3)]; } - memory_set_bankptr(space->machine, 3,RAM); + memory_set_bankptr(space->machine, 3, RAM); } /******************************************************************************/ @@ -1052,4 +1052,3 @@ INPUT_PORTS_END GAME( 1989, djboy, 0, djboy, djboy, djboy, ROT0, "Kaneko (American Sammy license)", "DJ Boy (set 1)", 0) // Sammy & Williams logos in FG ROM GAME( 1989, djboya, djboy, djboy, djboy, djboy, ROT0, "Kaneko (American Sammy license)", "DJ Boy (set 2)", 0) // Sammy & Williams logos in FG ROM GAME( 1989, djboyj, djboy, djboy, djboy, djboyj, ROT0, "Kaneko (Sega license)", "DJ Boy (Japan)", 0 ) // Sega logo in FG ROM - diff --git a/src/mame/drivers/djmain.c b/src/mame/drivers/djmain.c index 5eec882cc38..f8f4c3cd127 100644 --- a/src/mame/drivers/djmain.c +++ b/src/mame/drivers/djmain.c @@ -238,7 +238,7 @@ static WRITE32_HANDLER( v_ctrl_w ) if (pending_vb_int && !DISABLE_VB_INT) { pending_vb_int = 0; - cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_4, HOLD_LINE); + cputag_set_input_line(space->machine, "maincpu", M68K_IRQ_4, HOLD_LINE); } } } @@ -450,12 +450,12 @@ static void ide_interrupt(const device_config *device, int state) if (state != CLEAR_LINE) { //logerror("IDE interrupt asserted\n"); - cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_1, HOLD_LINE); + cputag_set_input_line(device->machine, "maincpu", M68K_IRQ_1, HOLD_LINE); } else { //logerror("IDE interrupt cleared\n"); - cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_1, CLEAR_LINE); + cputag_set_input_line(device->machine, "maincpu", M68K_IRQ_1, CLEAR_LINE); } } diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c index e35ae8f0740..836283ddf25 100644 --- a/src/mame/drivers/dkong.c +++ b/src/mame/drivers/dkong.c @@ -494,19 +494,19 @@ static MACHINE_RESET( drakton ) static READ8_DEVICE_HANDLER( dk_dma_read_byte ) { - const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); return memory_read_byte(space, offset); } static WRITE8_DEVICE_HANDLER( dk_dma_write_byte ) { - const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); memory_write_byte(space, offset, data); } static READ8_DEVICE_HANDLER( hb_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); dkong_state *state = (dkong_state *)device->machine->driver_data; int bucket = state->rev_map[(offset>>10) & 0x1ff]; int addr; @@ -521,7 +521,7 @@ static READ8_DEVICE_HANDLER( hb_dma_read_byte ) static WRITE8_DEVICE_HANDLER( hb_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); dkong_state *state = (dkong_state *)device->machine->driver_data; int bucket = state->rev_map[(offset>>10) & 0x1ff]; int addr; @@ -699,13 +699,13 @@ static WRITE8_HANDLER( dkong3_2a03_reset_w ) { if (data & 1) { - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); - cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(space->machine, "n2a03a", INPUT_LINE_RESET, CLEAR_LINE); + cputag_set_input_line(space->machine, "n2a03b", INPUT_LINE_RESET, CLEAR_LINE); } else { - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); - cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(space->machine, "n2a03a", INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(space->machine, "n2a03b", INPUT_LINE_RESET, ASSERT_LINE); } } @@ -2899,7 +2899,7 @@ static DRIVER_INIT( drakton ) {7,1,4,0,3,6,2,5}, }; - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1) ); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1) ); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little @@ -2921,7 +2921,7 @@ static DRIVER_INIT( strtheat ) {6,3,4,1,0,7,2,5}, }; - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1) ); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, (read8_space_func)SMH_BANK(1) ); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little @@ -2932,8 +2932,8 @@ static DRIVER_INIT( strtheat ) drakton_decrypt_rom(machine, 0x88, 0x1c000, bs[3]); /* custom handlers supporting Joystick or Steering Wheel */ - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7c00, 0x7c00, 0, 0, strtheat_inputport_0_r); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x7c80, 0x7c80, 0, 0, strtheat_inputport_1_r); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x7c00, 0x7c00, 0, 0, strtheat_inputport_0_r); + memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x7c80, 0x7c80, 0, 0, strtheat_inputport_1_r); } /************************************* diff --git a/src/mame/drivers/dlair.c b/src/mame/drivers/dlair.c index c4df401aa9c..4274e2ac1f1 100644 --- a/src/mame/drivers/dlair.c +++ b/src/mame/drivers/dlair.c @@ -84,7 +84,7 @@ static const UINT8 led_map[16] = static void dleuro_interrupt(const device_config *device, int state) { - cpu_set_input_line(device->machine->cpu[0], 0, state); + cputag_set_input_line(device->machine, "maincpu", 0, state); } diff --git a/src/mame/drivers/dogfgt.c b/src/mame/drivers/dogfgt.c index fca4fd62421..77efdce109f 100644 --- a/src/mame/drivers/dogfgt.c +++ b/src/mame/drivers/dogfgt.c @@ -32,12 +32,12 @@ static WRITE8_HANDLER( subirqtrigger_w ) /* bit 0 used but unknown */ if (data & 0x04) - cpu_set_input_line(space->machine->cpu[1],0,ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", 0, ASSERT_LINE); } static WRITE8_HANDLER( sub_irqack_w ) { - cpu_set_input_line(space->machine->cpu[1],0,CLEAR_LINE); + cputag_set_input_line(space->machine, "sub", 0, CLEAR_LINE); } diff --git a/src/mame/drivers/dooyong.c b/src/mame/drivers/dooyong.c index 883e281b313..2cc0642b296 100644 --- a/src/mame/drivers/dooyong.c +++ b/src/mame/drivers/dooyong.c @@ -734,7 +734,7 @@ GFXDECODE_END static void irqhandler(const device_config *device, int irq) { - cpu_set_input_line(device->machine->cpu[1],0,irq ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); } static READ8_DEVICE_HANDLER( unk_r ) diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c index 81b0c9f0b05..6c71735c4ad 100644 --- a/src/mame/drivers/dorachan.c +++ b/src/mame/drivers/dorachan.c @@ -32,14 +32,14 @@ static CUSTOM_INPUT( dorachan_protection_r ) { UINT8 ret = 0; - switch (cpu_get_previouspc(field->port->machine->cpu[0])) + switch (cpu_get_previouspc(cputag_get_cpu(field->port->machine, "maincpu"))) { case 0x70ce: ret = 0xf2; break; case 0x72a2: ret = 0xd5; break; case 0x72b5: ret = 0xcb; break; default: - mame_printf_debug("unhandled $2400 read @ %x\n",cpu_get_previouspc(field->port->machine->cpu[0])); + mame_printf_debug("unhandled $2400 read @ %x\n", cpu_get_previouspc(cputag_get_cpu(field->port->machine, "maincpu"))); break; } diff --git a/src/mame/drivers/dribling.c b/src/mame/drivers/dribling.c index 0b2d3e0288b..925df1d5ddf 100644 --- a/src/mame/drivers/dribling.c +++ b/src/mame/drivers/dribling.c @@ -99,7 +99,7 @@ static WRITE8_DEVICE_HANDLER( misc_w ) /* bit 7 = di */ di = (data >> 7) & 1; if (!di) - cpu_set_input_line(device->machine->cpu[0], 0, CLEAR_LINE); + cputag_set_input_line(device->machine, "maincpu", 0, CLEAR_LINE); /* bit 6 = parata */ @@ -369,4 +369,3 @@ ROM_END GAME( 1983, dribling, 0, dribling, dribling, 0, ROT0, "Model Racing", "Dribbling", GAME_NO_SOUND ) GAME( 1983, driblino, dribling, dribling, dribling, 0, ROT0, "Model Racing (Olympia license)", "Dribbling (Olympia)", GAME_NO_SOUND ) - diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index 68657ad5d43..fa68b447484 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -105,7 +105,7 @@ void sprtmtch_update_irq(running_machine *machine) int irq = ((dynax_sound_irq) ? 0x08 : 0) | ((dynax_vblank_irq) ? 0x10 : 0) | ((dynax_blitter_irq) ? 0x20 : 0) ; - cpu_set_input_line_and_vector(machine->cpu[0], 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */ + cputag_set_input_line_and_vector(machine, "maincpu", 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */ } static WRITE8_HANDLER( dynax_vblank_ack_w ) @@ -145,7 +145,7 @@ void jantouki_update_irq(running_machine *machine) int irq = ((dynax_blitter_irq) ? 0x08 : 0) | ((dynax_blitter2_irq) ? 0x10 : 0) | ((dynax_vblank_irq) ? 0x20 : 0) ; - cpu_set_input_line_and_vector(machine->cpu[0], 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */ + cputag_set_input_line_and_vector(machine, "maincpu", 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */ } static WRITE8_HANDLER( jantouki_vblank_ack_w ) @@ -185,7 +185,7 @@ static void jantouki_sound_update_irq(running_machine *machine) int irq = ((dynax_sound_irq) ? 0x08 : 0) | ((dynax_soundlatch_irq) ? 0x10 : 0) | ((dynax_sound_vblank_irq) ? 0x20 : 0) ; - cpu_set_input_line_and_vector(machine->cpu[1], 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */ + cputag_set_input_line_and_vector(machine, "soundcpu", 0, irq ? ASSERT_LINE : CLEAR_LINE, 0xc7 | irq); /* rst $xx */ } static INTERRUPT_GEN( jantouki_sound_vblank_interrupt ) @@ -408,7 +408,7 @@ static void adpcm_int(const device_config *device) if (toggle) { if (resetkludge) // don't know what's wrong, but NMIs when the 5205 is reset make the game crash - 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); } } static void adpcm_int_cpu1(const device_config *device) @@ -422,7 +422,7 @@ static void adpcm_int_cpu1(const device_config *device) if (toggle) { if (resetkludge) // don't know what's wrong, but NMIs when the 5205 is reset make the game crash - cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE); // cpu1 + cputag_set_input_line(device->machine, "soundcpu", INPUT_LINE_NMI, PULSE_LINE); // cpu1 } } @@ -3980,7 +3980,7 @@ MACHINE_DRIVER_END void mjelctrn_update_irq(running_machine *machine) { dynax_blitter_irq = 1; - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, 0xfa); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, 0xfa); } static INTERRUPT_GEN( mjelctrn_vblank_interrupt ) @@ -4014,7 +4014,7 @@ MACHINE_DRIVER_END void neruton_update_irq(running_machine *machine) { dynax_blitter_irq = 1; - cpu_set_input_line_and_vector(machine->cpu[0], 0, HOLD_LINE, 0x42); + cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, 0x42); } static INTERRUPT_GEN( neruton_vblank_interrupt ) @@ -5600,7 +5600,7 @@ ROM_END static DRIVER_INIT( mjreach ) { - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x10060, 0x10060, 0, 0, yarunara_flipscreen_w); + memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x10060, 0x10060, 0, 0, yarunara_flipscreen_w); } /*************************************************************************** diff --git a/src/mame/machine/dec0.c b/src/mame/machine/dec0.c index 137f53f5ee4..99c6f5fedf7 100644 --- a/src/mame/machine/dec0.c +++ b/src/mame/machine/dec0.c @@ -463,8 +463,8 @@ static emu_timer *i8751_timer; static TIMER_CALLBACK( i8751_callback ) { /* Signal main cpu microcontroller task is complete */ - cpu_set_input_line(machine->cpu[0],5,HOLD_LINE); - i8751_timer=NULL; + cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE); + i8751_timer = NULL; logerror("i8751: Timer called!!!\n"); } @@ -473,11 +473,11 @@ static TIMER_CALLBACK( i8751_callback ) void dec0_i8751_write(running_machine *machine, int data) { /* Writes to this address cause an IRQ to the i8751 microcontroller */ - if (GAME==1) hbarrel_i8751_write(data); - if (GAME==2) baddudes_i8751_write(machine, data); - if (GAME==3) birdtry_i8751_write(machine, data); + if (GAME == 1) hbarrel_i8751_write(data); + if (GAME == 2) baddudes_i8751_write(machine, data); + if (GAME == 3) birdtry_i8751_write(machine, data); - cpu_set_input_line(machine->cpu[0],5,HOLD_LINE); + cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE); /* Simulate the processing time of the i8751, time value is guessed if (i8751_timer) @@ -525,8 +525,8 @@ static WRITE16_HANDLER( robocop_68000_share_w ) robocop_shared_ram[offset]=data&0xff; - if (offset==0x7ff) /* A control address - not standard ram */ - cpu_set_input_line(space->machine->cpu[2],0,HOLD_LINE); + if (offset == 0x7ff) /* A control address - not standard ram */ + cputag_set_input_line(space->machine, "sub", 0, HOLD_LINE); } /******************************************************************************/ @@ -537,24 +537,24 @@ static void h6280_decrypt(running_machine *machine, const char *cputag) UINT8 *RAM = memory_region(machine, cputag); /* Read each byte, decrypt it */ - for (i=0x00000; i<0x10000; i++) - RAM[i]=(RAM[i] & 0x7e) | ((RAM[i] & 0x1) << 7) | ((RAM[i] & 0x80) >> 7); + for (i = 0x00000; i < 0x10000; i++) + RAM[i] = (RAM[i] & 0x7e) | ((RAM[i] & 0x1) << 7) | ((RAM[i] & 0x80) >> 7); } DRIVER_INIT( hippodrm ) { UINT8 *RAM = memory_region(machine, "sub"); - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180000, 0x180fff, 0, 0, hippodrm_68000_share_r, hippodrm_68000_share_w); - memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xffc800, 0xffcfff, 0, 0, sprite_mirror_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x180000, 0x180fff, 0, 0, hippodrm_68000_share_r, hippodrm_68000_share_w); + memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xffc800, 0xffcfff, 0, 0, sprite_mirror_w); h6280_decrypt(machine, "sub"); /* The protection cpu has additional memory mapped protection! */ - RAM[0x189]=0x60; /* RTS prot area */ - RAM[0x1af]=0x60; /* RTS prot area */ - RAM[0x1db]=0x60; /* RTS prot area */ - RAM[0x21a]=0x60; /* RTS prot area */ + RAM[0x189] = 0x60; /* RTS prot area */ + RAM[0x1af] = 0x60; /* RTS prot area */ + RAM[0x1db] = 0x60; /* RTS prot area */ + RAM[0x21a] = 0x60; /* RTS prot area */ } DRIVER_INIT( slyspy ) @@ -564,23 +564,23 @@ DRIVER_INIT( slyspy ) h6280_decrypt(machine, "audiocpu"); /* Slyspy sound cpu has some protection */ - RAM[0xf2d]=0xea; - RAM[0xf2e]=0xea; + RAM[0xf2d] = 0xea; + RAM[0xf2e] = 0xea; } DRIVER_INIT( robocop ) { - memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x180000, 0x180fff, 0, 0, robocop_68000_share_r, robocop_68000_share_w); + memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x180000, 0x180fff, 0, 0, robocop_68000_share_r, robocop_68000_share_w); } DRIVER_INIT( baddudes ) { - GAME=2; + GAME = 2; } DRIVER_INIT( hbarrel ) { - GAME=1; + GAME = 1; { /* Remove this patch once processing time of i8751 is simulated */ UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); rom[0xb68/2] = 0x8008; @@ -589,7 +589,7 @@ rom[0xb68/2] = 0x8008; DRIVER_INIT( hbarrelw ) { - GAME=1; + GAME = 1; { /* Remove this patch once processing time of i8751 is simulated */ UINT16 *rom = (UINT16 *)memory_region(machine, "maincpu"); rom[0xb3e/2] = 0x8008; diff --git a/src/mame/machine/decocass.c b/src/mame/machine/decocass.c index d89b3d39f4d..d1357be1108 100644 --- a/src/mame/machine/decocass.c +++ b/src/mame/machine/decocass.c @@ -103,7 +103,7 @@ WRITE8_HANDLER( decocass_sound_command_w ) decocass_sound_ack |= 0x80; /* remove snd cpu data ack bit. i don't see it in the schems, but... */ decocass_sound_ack &= ~0x40; - cpu_set_input_line(space->machine->cpu[1], M6502_IRQ_LINE, ASSERT_LINE); + cputag_set_input_line(space->machine, "audiocpu", M6502_IRQ_LINE, ASSERT_LINE); } READ8_HANDLER( decocass_sound_data_r ) @@ -131,7 +131,7 @@ READ8_HANDLER( decocass_sound_command_r ) { UINT8 data = soundlatch_r(space, 0); LOG(4,("CPU %s sound command <- $%02x\n", space->cpu->tag, data)); - cpu_set_input_line(space->machine->cpu[1], M6502_IRQ_LINE, CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", M6502_IRQ_LINE, CLEAR_LINE); decocass_sound_ack &= ~0x80; return data; } @@ -140,19 +140,19 @@ TIMER_DEVICE_CALLBACK( decocass_audio_nmi_gen ) { int scanline = param; audio_nmi_state = scanline & 8; - cpu_set_input_line(timer->machine->cpu[1], INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(timer->machine, "audiocpu", INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); } WRITE8_HANDLER( decocass_sound_nmi_enable_w ) { audio_nmi_enabled = 1; - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); } READ8_HANDLER( decocass_sound_nmi_enable_r ) { audio_nmi_enabled = 1; - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); return 0xff; } @@ -172,7 +172,7 @@ WRITE8_HANDLER( decocass_sound_data_ack_reset_w ) WRITE8_HANDLER( decocass_nmi_reset_w ) { - 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 ); } WRITE8_HANDLER( decocass_quadrature_decoder_reset_w ) @@ -246,17 +246,17 @@ WRITE8_HANDLER( decocass_reset_w ) decocass_reset = data; /* CPU #1 active high reset */ - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, data & 0x01); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, data & 0x01); /* on reset also disable audio NMI */ if (data & 1) { audio_nmi_enabled = 0; - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); + cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, (audio_nmi_enabled && audio_nmi_state) ? ASSERT_LINE : CLEAR_LINE); } /* 8041 active low reset */ - cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, (data & 0x08) ^ 0x08); + cputag_set_input_line(space->machine, "mcu", INPUT_LINE_RESET, (data & 0x08) ^ 0x08); } @@ -314,7 +314,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_3_inv_2_r ) if (1 == (offset & 1)) { if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); else data = 0xff; @@ -344,7 +344,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_3_inv_2_r ) } if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); else data = 0xff; @@ -393,7 +393,7 @@ static READ8_HANDLER( decocass_type1_pass_136_r ) if (1 == (offset & 1)) { if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); else data = 0xff; @@ -423,7 +423,7 @@ static READ8_HANDLER( decocass_type1_pass_136_r ) } if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); else data = 0xff; @@ -472,7 +472,7 @@ static READ8_HANDLER( decocass_type1_latch_27_pass_3_inv_2_r ) if (1 == (offset & 1)) { if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); else data = 0xff; @@ -502,7 +502,7 @@ static READ8_HANDLER( decocass_type1_latch_27_pass_3_inv_2_r ) } if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); else data = 0xff; @@ -551,7 +551,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_5_inv_2_r ) if (1 == (offset & 1)) { if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); else data = 0xff; @@ -581,7 +581,7 @@ static READ8_HANDLER( decocass_type1_latch_26_pass_5_inv_2_r ) } if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); else data = 0xff; @@ -632,7 +632,7 @@ static READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r ) if (1 == (offset & 1)) { if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); else data = 0xff; @@ -662,7 +662,7 @@ static READ8_HANDLER( decocass_type1_latch_16_pass_3_inv_1_r ) } if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); else data = 0xff; @@ -725,7 +725,7 @@ static READ8_HANDLER( decocass_type2_r ) else { if (0 == (offset & E5XX_MASK)) - data = upi41_master_r(space->machine->cpu[2], offset); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), offset); else data = offset & 0xff; @@ -762,7 +762,7 @@ static WRITE8_HANDLER( decocass_type2_w ) LOG(3,("PROM:%s D2:%d", type2_xx_latch ? "on" : "off", type2_d2_latch)); } } - upi41_master_w(space->machine->cpu[2], offset & 1, data); + upi41_master_w(cputag_get_cpu(space->machine, "mcu"), offset & 1, data); #ifdef MAME_DEBUG decocass_fno(offset, data); @@ -803,7 +803,7 @@ static READ8_HANDLER( decocass_type3_r ) { if (0 == (offset & E5XX_MASK)) { - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); LOG(4,("%10s 6502-PC: %04x decocass_type3_r(%02x): $%02x <- 8041 STATUS\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data)); } else @@ -824,7 +824,7 @@ static READ8_HANDLER( decocass_type3_r ) { if (0 == (offset & E5XX_MASK)) { - save = upi41_master_r(space->machine->cpu[2], 0); + save = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); switch (type3_swap) { case TYPE3_SWAP_01: @@ -996,7 +996,7 @@ static WRITE8_HANDLER( decocass_type3_w ) } } LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); - upi41_master_w(space->machine->cpu[2], offset, data); + upi41_master_w(cputag_get_cpu(space->machine, "mcu"), offset, data); } /*************************************************************************** @@ -1019,7 +1019,7 @@ static READ8_HANDLER( decocass_type4_r ) { if (0 == (offset & E5XX_MASK)) { - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); LOG(4,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x <- 8041 STATUS\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data)); } else @@ -1042,7 +1042,7 @@ static READ8_HANDLER( decocass_type4_r ) { if (0 == (offset & E5XX_MASK)) { - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); LOG(3,("%10s 6502-PC: %04x decocass_type4_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.')); } else @@ -1082,7 +1082,7 @@ static WRITE8_HANDLER( decocass_type4_w ) } } LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); - upi41_master_w(space->machine->cpu[2], offset, data); + upi41_master_w(cputag_get_cpu(space->machine, "mcu"), offset, data); } /*************************************************************************** @@ -1102,7 +1102,7 @@ static READ8_HANDLER( decocass_type5_r ) { if (0 == (offset & E5XX_MASK)) { - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); LOG(4,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x <- 8041 STATUS\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data)); } else @@ -1122,7 +1122,7 @@ static READ8_HANDLER( decocass_type5_r ) { if (0 == (offset & E5XX_MASK)) { - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); LOG(3,("%10s 6502-PC: %04x decocass_type5_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.')); } else @@ -1159,7 +1159,7 @@ static WRITE8_HANDLER( decocass_type5_w ) } } LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); - upi41_master_w(space->machine->cpu[2], offset, data); + upi41_master_w(cputag_get_cpu(space->machine, "mcu"), offset, data); } /*************************************************************************** @@ -1178,7 +1178,7 @@ static READ8_HANDLER( decocass_nodong_r ) { if (0 == (offset & E5XX_MASK)) { - data = upi41_master_r(space->machine->cpu[2], 1); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 1); LOG(4,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x <- 8041 STATUS\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data)); } else @@ -1191,7 +1191,7 @@ static READ8_HANDLER( decocass_nodong_r ) { if (0 == (offset & E5XX_MASK)) { - data = upi41_master_r(space->machine->cpu[2], 0); + data = upi41_master_r(cputag_get_cpu(space->machine, "mcu"), 0); LOG(3,("%10s 6502-PC: %04x decocass_nodong_r(%02x): $%02x '%c' <- open bus (D0 replaced with latch)\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data, (data >= 32) ? data : '.')); } else @@ -1263,7 +1263,7 @@ WRITE8_HANDLER( decocass_e5xx_w ) if (0 == (offset & E5XX_MASK)) { LOG(3,("%10s 6502-PC: %04x decocass_e5xx_w(%02x): $%02x -> %s\n", attotime_string(timer_get_time(space->machine), 6), cpu_get_previouspc(space->cpu), offset, data, offset & 1 ? "8041-CMND" : "8041-DATA")); - upi41_master_w(space->machine->cpu[2], offset & 1, data); + upi41_master_w(cputag_get_cpu(space->machine, "mcu"), offset & 1, data); #ifdef MAME_DEBUG decocass_fno(offset, data); #endif diff --git a/src/mame/machine/docastle.c b/src/mame/machine/docastle.c index b97694cf17f..5d55ced11ef 100644 --- a/src/mame/machine/docastle.c +++ b/src/mame/machine/docastle.c @@ -81,5 +81,5 @@ WRITE8_HANDLER( docastle_shared1_w ) WRITE8_HANDLER( docastle_nmitrigger_w ) { - cpu_set_input_line(space->machine->cpu[1],INPUT_LINE_NMI,PULSE_LINE); + cputag_set_input_line(space->machine, "slave", INPUT_LINE_NMI, PULSE_LINE); } diff --git a/src/mame/video/dec8.c b/src/mame/video/dec8.c index 95be504bd4d..8aae9dfd07b 100644 --- a/src/mame/video/dec8.c +++ b/src/mame/video/dec8.c @@ -81,9 +81,9 @@ PALETTE_INIT( ghostb ) { int i; - for (i = 0;i < machine->config->total_colors;i++) + for (i = 0; i < machine->config->total_colors; i++) { - int bit0,bit1,bit2,bit3,r,g,b; + int bit0, bit1, bit2, bit3, r, g, b; bit0 = (color_prom[i] >> 0) & 0x01; bit1 = (color_prom[i] >> 1) & 0x01; @@ -101,30 +101,30 @@ PALETTE_INIT( ghostb ) bit3 = (color_prom[i + machine->config->total_colors] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - palette_set_color(machine,i,MAKE_RGB(r,g,b)); + palette_set_color(machine, i, MAKE_RGB(r, g, b)); } } WRITE8_HANDLER( dec8_bac06_0_w ) { - dec8_pf0_control[offset]=data; + dec8_pf0_control[offset] = data; } WRITE8_HANDLER( dec8_bac06_1_w ) { - dec8_pf1_control[offset]=data; + dec8_pf1_control[offset] = data; } WRITE8_HANDLER( dec8_pf0_data_w ) { - dec8_pf0_data[offset]=data; - tilemap_mark_tile_dirty(dec8_pf0_tilemap,offset/2); + dec8_pf0_data[offset] = data; + tilemap_mark_tile_dirty(dec8_pf0_tilemap, offset / 2); } WRITE8_HANDLER( dec8_pf1_data_w ) { - dec8_pf1_data[offset]=data; - tilemap_mark_tile_dirty(dec8_pf1_tilemap,offset/2); + dec8_pf1_data[offset] = data; + tilemap_mark_tile_dirty(dec8_pf1_tilemap, offset / 2); } READ8_HANDLER( dec8_pf0_data_r ) @@ -139,26 +139,26 @@ READ8_HANDLER( dec8_pf1_data_r ) WRITE8_HANDLER( dec8_videoram_w ) { - videoram[offset]=data; + videoram[offset] = data; tilemap_mark_tile_dirty( dec8_fix_tilemap,offset/2 ); } WRITE8_HANDLER( srdarwin_videoram_w ) { - videoram[offset]=data; + videoram[offset] = data; tilemap_mark_tile_dirty( dec8_fix_tilemap,offset ); } #ifdef UNUSED_FUNCTION WRITE8_HANDLER( dec8_scroll1_w ) { - scroll1[offset]=data; + scroll1[offset] = data; } #endif WRITE8_HANDLER( dec8_scroll2_w ) { - scroll2[offset]=data; + scroll2[offset] = data; } WRITE8_HANDLER( srdarwin_control_w ) @@ -166,15 +166,16 @@ WRITE8_HANDLER( srdarwin_control_w ) int bankaddress; UINT8 *RAM = memory_region(space->machine, "maincpu"); - switch (offset) { + switch (offset) + { case 0: /* Top 3 bits - bank switch, bottom 4 - scroll MSB */ bankaddress = 0x10000 + (data >> 5) * 0x4000; - memory_set_bankptr(space->machine, 1,&RAM[bankaddress]); - scroll2[0]=data&0xf; + memory_set_bankptr(space->machine, 1, &RAM[bankaddress]); + scroll2[0] = data & 0xf; return; case 1: - scroll2[1]=data; + scroll2[1] = data; return; } } @@ -190,15 +191,15 @@ WRITE8_HANDLER( lastmiss_control_w ) Bit 0x40 - Y scroll MSB Bit 0x80 - Hold subcpu reset line high if clear, else low */ - memory_set_bankptr(space->machine, 1,&RAM[0x10000 + (data & 0x0f) * 0x4000]); + memory_set_bankptr(space->machine, 1, &RAM[0x10000 + (data & 0x0f) * 0x4000]); - scroll2[0]=(data>>5)&1; - scroll2[2]=(data>>6)&1; + scroll2[0] = (data >> 5) & 1; + scroll2[2] = (data >> 6) & 1; - if (data&0x80) - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); + if (data & 0x80) + cputag_set_input_line(space->machine, "sub", INPUT_LINE_RESET, CLEAR_LINE); else - cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); + cputag_set_input_line(space->machine, "sub", INPUT_LINE_RESET, ASSERT_LINE); } WRITE8_HANDLER( shackled_control_w ) @@ -210,32 +211,33 @@ WRITE8_HANDLER( shackled_control_w ) bankaddress = 0x10000 + (data & 0x0f) * 0x4000; memory_set_bankptr(space->machine, 1,&RAM[bankaddress]); - scroll2[0]=(data>>5)&1; - scroll2[2]=(data>>6)&1; + scroll2[0] = (data >> 5) & 1; + scroll2[2] = (data >> 6) & 1; } WRITE8_HANDLER( lastmiss_scrollx_w ) { - scroll2[1]=data; + scroll2[1] = data; } WRITE8_HANDLER( lastmiss_scrolly_w ) { - scroll2[3]=data; + scroll2[3] = data; } WRITE8_HANDLER( gondo_scroll_w ) { - switch (offset) { + switch (offset) + { case 0x0: - scroll2[1]=data; /* X LSB */ + scroll2[1] = data; /* X LSB */ break; case 0x8: - scroll2[3]=data; /* Y LSB */ + scroll2[3] = data; /* Y LSB */ break; case 0x10: - scroll2[0]=(data>>0)&1; /* Bit 0: X MSB */ - scroll2[2]=(data>>1)&1; /* Bit 1: Y MSB */ + scroll2[0] = (data >> 0) & 1; /* Bit 0: X MSB */ + scroll2[2] = (data >> 1) & 1; /* Bit 1: Y MSB */ /* Bit 2 is also used in Gondo & Garyoret */ break; } @@ -276,7 +278,8 @@ static void draw_sprites1(running_machine* machine, bitmap_t *bitmap, const rect y=(y+16)%0x200; x=256 - x; y=256 - y; - if (flip_screen_get(machine)) { + if (flip_screen_get(machine)) + { y=240-y; x=240-x; if (fx) fx=0; else fx=1; @@ -285,7 +288,8 @@ static void draw_sprites1(running_machine* machine, bitmap_t *bitmap, const rect } /* Y Flip determines order of multi-sprite */ - if (extra && fy) { + if (extra && fy) + { sprite2=sprite; sprite++; } @@ -348,7 +352,8 @@ static void draw_sprites2(running_machine* machine, bitmap_t *bitmap, const rect inc = 1; } - if (flip_screen_get(machine)) { + if (flip_screen_get(machine)) + { y=240-y; x=240-x; if (fx) fx=0; else fx=1; @@ -394,7 +399,8 @@ static void srdarwin_draw_sprites(running_machine* machine, bitmap_t *bitmap, co fx = buffered_spriteram[offs+1] & 0x04; multi = buffered_spriteram[offs+1] & 0x10; - if (flip_screen_get(machine)) { + if (flip_screen_get(machine)) + { sy=240-sy; sx=240-sx; if (fx) fx=0; else fx=1; @@ -424,7 +430,8 @@ static void draw_characters(running_machine* machine, bitmap_t *bitmap, const re { int mx,my,tile,color,offs; - for (offs = 0x800 - 2;offs >= 0;offs -= 2) { + for (offs = 0x800 - 2;offs >= 0;offs -= 2) + { tile=videoram[offs+1]+((videoram[offs]&0xf)<<8); if (!tile) continue; @@ -526,13 +533,16 @@ VIDEO_START( cobracom ) VIDEO_UPDATE( ghostb ) { - if (dec8_pf0_control[0]&0x4) { /* Rowscroll */ + if (dec8_pf0_control[0]&0x4) + { /* Rowscroll */ int offs; tilemap_set_scroll_rows(dec8_pf0_tilemap,512); for (offs = 0;offs < 512;offs+=2) tilemap_set_scrollx( dec8_pf0_tilemap,offs/2, (dec8_pf0_control[0x10]<<8)+dec8_pf0_control[0x11] + (dec8_row[offs]<<8)+dec8_row[offs+1] ); - } else { + } + else + { tilemap_set_scroll_rows(dec8_pf0_tilemap,1); tilemap_set_scrollx( dec8_pf0_tilemap,0, (dec8_pf0_control[0x10]<<8)+dec8_pf0_control[0x11] ); } diff --git a/src/mame/video/decocass.c b/src/mame/video/decocass.c index 5480d1c8c35..972043636ec 100644 --- a/src/mame/video/decocass.c +++ b/src/mame/video/decocass.c @@ -529,7 +529,7 @@ VIDEO_UPDATE( decocass ) rectangle clip; if (0xc0 != (input_port_read(screen->machine, "IN2") & 0xc0)) /* coin slots assert an NMI */ - cpu_set_input_line(screen->machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE); + cputag_set_input_line(screen->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); if (0 == (watchdog_flip & 0x04)) watchdog_reset(screen->machine); diff --git a/src/mame/video/dogfgt.c b/src/mame/video/dogfgt.c index 0a1c5426d07..5a25c4fa199 100644 --- a/src/mame/video/dogfgt.c +++ b/src/mame/video/dogfgt.c @@ -226,7 +226,7 @@ VIDEO_UPDATE( dogfgt ) if (lastflip != flip_screen_get(screen->machine) || lastpixcolor != pixcolor) { - const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM); lastflip = flip_screen_get(screen->machine); lastpixcolor = pixcolor; diff --git a/src/mame/video/dooyong.c b/src/mame/video/dooyong.c index d3b9a6e7975..aa9fcddc161 100644 --- a/src/mame/video/dooyong.c +++ b/src/mame/video/dooyong.c @@ -904,14 +904,14 @@ VIDEO_START( popbingo ) VIDEO_EOF( dooyong ) { - 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); buffer_spriteram_w(space, 0, 0); } VIDEO_EOF( rshark ) { - 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); buffer_spriteram16_w(space, 0, 0, 0xffff); } diff --git a/src/mame/video/dynduke.c b/src/mame/video/dynduke.c index bdd5c120b21..af3af9d9800 100644 --- a/src/mame/video/dynduke.c +++ b/src/mame/video/dynduke.c @@ -244,7 +244,7 @@ VIDEO_UPDATE( dynduke ) VIDEO_EOF( dynduke ) { - 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); - buffer_spriteram16_w(space,0,0,0xffff); // Could be a memory location instead + buffer_spriteram16_w(space, 0, 0, 0xffff); // Could be a memory location instead }