From e610aad965c8a57774ff367e518424edc6051ade Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 13 Apr 2013 17:44:51 +0000 Subject: [PATCH] cleanup of duplicates (nw) --- src/mame/drivers/dorachan.c | 7 ++----- src/mame/drivers/jaguar.c | 40 ++++++++++++++++++------------------ src/mame/drivers/toaplan2.c | 31 +++++++++++++--------------- src/mame/includes/jaguar.h | 8 +++----- src/mame/includes/toaplan2.h | 3 --- src/mame/video/jaguar.c | 4 ++-- 6 files changed, 41 insertions(+), 52 deletions(-) diff --git a/src/mame/drivers/dorachan.c b/src/mame/drivers/dorachan.c index 1448e6883f3..3748e268854 100644 --- a/src/mame/drivers/dorachan.c +++ b/src/mame/drivers/dorachan.c @@ -30,7 +30,6 @@ public: UINT8 m_flip_screen; /* devices */ - device_t *m_main_cpu; DECLARE_WRITE8_MEMBER(dorachan_ctrl_w); DECLARE_CUSTOM_INPUT_MEMBER(dorachan_protection_r); DECLARE_CUSTOM_INPUT_MEMBER(dorachan_v128_r); @@ -51,14 +50,14 @@ CUSTOM_INPUT_MEMBER(dorachan_state::dorachan_protection_r) { UINT8 ret = 0; - switch (m_main_cpu->safe_pcbase()) + switch (((device_t*)m_maincpu)->safe_pcbase()) { case 0x70ce: ret = 0xf2; break; case 0x72a2: ret = 0xd5; break; case 0x72b5: ret = 0xcb; break; default: - mame_printf_debug("unhandled $2400 read @ %x\n", m_main_cpu->safe_pcbase()); + mame_printf_debug("unhandled $2400 read @ %x\n", ((device_t*)m_maincpu)->safe_pcbase()); break; } @@ -226,8 +225,6 @@ INPUT_PORTS_END void dorachan_state::machine_start() { - m_main_cpu = m_maincpu; - save_item(NAME(m_flip_screen)); } diff --git a/src/mame/drivers/jaguar.c b/src/mame/drivers/jaguar.c index 543890377fc..4c97ab7587b 100644 --- a/src/mame/drivers/jaguar.c +++ b/src/mame/drivers/jaguar.c @@ -372,7 +372,7 @@ IRQ_CALLBACK_MEMBER(jaguar_state::jaguar_irq_callback) void jaguar_state::machine_reset() { if (!m_is_cojag) - m_main_cpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(jaguar_state::jaguar_irq_callback),this)); + m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(jaguar_state::jaguar_irq_callback),this)); m_protection_check = 0; @@ -380,7 +380,7 @@ void jaguar_state::machine_reset() if (!m_is_r3000) { memcpy(m_shared_ram, m_rom_base, 0x400); // do not increase, or Doom breaks - m_main_cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); } /* configure banks for gfx/sound ROMs */ @@ -866,7 +866,7 @@ READ32_MEMBER(jaguar_state::gpu_jump_r) READ32_MEMBER(jaguar_state::cojagr3k_main_speedup_r) { - UINT64 curcycles = m_main_cpu->total_cycles(); + UINT64 curcycles = m_maincpu->total_cycles(); /* if it's been less than main_speedup_max_cycles cycles since the last time */ if (curcycles - m_main_speedup_last_cycles < m_main_speedup_max_cycles) @@ -940,7 +940,7 @@ READ32_MEMBER(jaguar_state::main_gpu_wait_r) WRITE32_MEMBER(jaguar_state::area51_main_speedup_w) { - UINT64 curcycles = m_main_cpu->total_cycles(); + UINT64 curcycles = m_maincpu->total_cycles(); /* store the data */ COMBINE_DATA(m_main_speedup); @@ -974,7 +974,7 @@ WRITE32_MEMBER(jaguar_state::area51_main_speedup_w) WRITE32_MEMBER(jaguar_state::area51mx_main_speedup_w) { - UINT64 curcycles = m_main_cpu->total_cycles(); + UINT64 curcycles = m_maincpu->total_cycles(); /* store the data */ COMBINE_DATA(&m_main_speedup[offset]); @@ -1737,11 +1737,11 @@ int jaguar_state::quickload(device_image_interface &image, const char *file_type /* Some programs are too lazy to set a stack pointer */ - m_main_cpu->set_state_int(STATE_GENSP, 0x1000); + m_maincpu->set_state_int(STATE_GENSP, 0x1000); m_shared_ram[0]=0x1000; /* Transfer control to image */ - m_main_cpu->set_pc(quickload_begin); + m_maincpu->set_pc(quickload_begin); m_shared_ram[1]=quickload_begin; return IMAGE_INIT_PASS; } @@ -1792,7 +1792,7 @@ int jaguar_state::cart_load(device_image_interface &image) // m_cart_base[0x102] = 1; /* Transfer control to the bios */ - m_main_cpu->set_pc(m_rom_base[1]); + m_maincpu->set_pc(m_rom_base[1]); return IMAGE_INIT_PASS; } @@ -2226,13 +2226,13 @@ void jaguar_state::cojag_common_init(UINT16 gpu_jump_offs, UINT16 spin_pc) m_is_cojag = true; /* copy over the ROM */ - m_is_r3000 = (m_main_cpu->type() == R3041); + m_is_r3000 = (m_maincpu->type() == R3041); /* install synchronization hooks for GPU */ if (m_is_r3000) - m_main_cpu->space(AS_PROGRAM).install_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); else - m_main_cpu->space(AS_PROGRAM).install_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); m_gpu->space(AS_PROGRAM).install_read_handler(0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, read32_delegate(FUNC(jaguar_state::gpu_jump_r), this)); m_gpu_jump_address = &m_gpu_ram[gpu_jump_offs/4]; m_gpu_spin_pc = 0xf03000 + spin_pc; @@ -2251,7 +2251,7 @@ DRIVER_INIT_MEMBER(jaguar_state,area51a) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this)); #endif } @@ -2264,7 +2264,7 @@ DRIVER_INIT_MEMBER(jaguar_state,area51) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2279,7 +2279,7 @@ DRIVER_INIT_MEMBER(jaguar_state,maxforce) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2294,7 +2294,7 @@ DRIVER_INIT_MEMBER(jaguar_state,area51mx) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this)); #endif } @@ -2310,7 +2310,7 @@ DRIVER_INIT_MEMBER(jaguar_state,a51mxr3k) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2323,7 +2323,7 @@ DRIVER_INIT_MEMBER(jaguar_state,fishfren) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 200; - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2336,8 +2336,8 @@ void jaguar_state::init_freeze_common(offs_t main_speedup_addr) /* install speedup for main CPU */ m_main_speedup_max_cycles = 200; if (main_speedup_addr != 0) - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this)); - m_main_gpu_wait = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this)); + m_main_gpu_wait = m_maincpu->space(AS_PROGRAM).install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this)); #endif } @@ -2356,7 +2356,7 @@ DRIVER_INIT_MEMBER(jaguar_state,vcircle) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 50; - m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } diff --git a/src/mame/drivers/toaplan2.c b/src/mame/drivers/toaplan2.c index 8cb836f94fa..7c70fc2258c 100644 --- a/src/mame/drivers/toaplan2.c +++ b/src/mame/drivers/toaplan2.c @@ -369,9 +369,6 @@ To Do / Unknowns: MACHINE_START_MEMBER(toaplan2_state,toaplan2) { - m_main_cpu = m_maincpu; - m_sub_cpu = m_audiocpu; - save_item(NAME(m_mcu_data)); save_item(NAME(m_video_status)); save_item(NAME(m_old_p1_paddle_h)); @@ -384,8 +381,8 @@ static void toaplan2_reset(device_t *device) { toaplan2_state *state = device->machine().driver_data(); - if (state->m_sub_cpu != NULL) - state->m_sub_cpu->execute().set_input_line(INPUT_LINE_RESET, PULSE_LINE); + if (state->m_audiocpu != NULL) + state->m_audiocpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); } @@ -396,7 +393,7 @@ MACHINE_RESET_MEMBER(toaplan2_state,toaplan2) // All games execute a RESET instruction on init, presumably to reset the sound CPU. // This is important for games with common RAM; the RAM test will fail // when leaving service mode if the sound CPU is not reset. - m68k_set_reset_callback(m_main_cpu, toaplan2_reset); + m68k_set_reset_callback(m_maincpu, toaplan2_reset); } @@ -479,7 +476,7 @@ DRIVER_INIT_MEMBER(toaplan2_state,bbakraid) TIMER_CALLBACK_MEMBER(toaplan2_state::toaplan2_raise_irq) { - m_main_cpu->execute().set_input_line(param, HOLD_LINE); + m_maincpu->set_input_line(param, HOLD_LINE); } void toaplan2_state::toaplan2_vblank_irq(int irq_line) @@ -575,7 +572,7 @@ WRITE16_MEMBER(toaplan2_state::toaplan2_v25_coin_word_w) { toaplan2_coin_w(space, offset, data & 0x0f); - m_sub_cpu->execute().set_input_line(INPUT_LINE_RESET, (data & m_v25_reset_line) ? CLEAR_LINE : ASSERT_LINE); + m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & m_v25_reset_line) ? CLEAR_LINE : ASSERT_LINE); } if (ACCESSING_BITS_8_15 && (data & 0xff00) ) { @@ -740,7 +737,7 @@ WRITE16_MEMBER(toaplan2_state::ghox_shared_ram_w) WRITE16_MEMBER(toaplan2_state::fixeight_subcpu_ctrl_w) { - m_sub_cpu->execute().set_input_line(INPUT_LINE_RESET, (data & m_v25_reset_line) ? CLEAR_LINE : ASSERT_LINE); + m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & m_v25_reset_line) ? CLEAR_LINE : ASSERT_LINE); } @@ -847,7 +844,7 @@ WRITE16_MEMBER(toaplan2_state::bgaregga_soundlatch_w) if (ACCESSING_BITS_0_7) { soundlatch_byte_w(space, offset, data & 0xff); - m_sub_cpu->execute().set_input_line(0, HOLD_LINE); + m_audiocpu->set_input_line(0, HOLD_LINE); } } @@ -903,7 +900,7 @@ WRITE16_MEMBER(toaplan2_state::batrider_soundlatch_w) if (ACCESSING_BITS_0_7) { soundlatch_byte_w(space, offset, data & 0xff); - m_sub_cpu->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } } @@ -913,7 +910,7 @@ WRITE16_MEMBER(toaplan2_state::batrider_soundlatch2_w) if (ACCESSING_BITS_0_7) { soundlatch2_byte_w(space, offset, data & 0xff); - m_sub_cpu->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } } @@ -929,20 +926,20 @@ WRITE16_MEMBER(toaplan2_state::batrider_clear_sndirq_w) { // not sure whether this is correct // the 68K writes here during the sound IRQ handler, and nowhere else... - m_main_cpu->execute().set_input_line(m_sndirq_line, CLEAR_LINE); + m_maincpu->set_input_line(m_sndirq_line, CLEAR_LINE); } WRITE8_MEMBER(toaplan2_state::batrider_sndirq_w) { // if batrider_clear_sndirq_w() is correct, should this be ASSERT_LINE? - m_main_cpu->execute().set_input_line(m_sndirq_line, HOLD_LINE); + m_maincpu->set_input_line(m_sndirq_line, HOLD_LINE); } WRITE8_MEMBER(toaplan2_state::batrider_clear_nmi_w) { - m_sub_cpu->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } @@ -2971,8 +2968,8 @@ GFXDECODE_END WRITE_LINE_MEMBER(toaplan2_state::irqhandler) { - if (m_sub_cpu != NULL) // wouldn't tekipaki have problem without this? "mcu" is not generally added - m_sub_cpu->execute().set_input_line(0, state); + if (m_audiocpu != NULL) // wouldn't tekipaki have problem without this? "mcu" is not generally added + m_audiocpu->set_input_line(0, state); } static const ym3812_interface ym3812_config = diff --git a/src/mame/includes/jaguar.h b/src/mame/includes/jaguar.h index cae06a4dd48..88f5af67bfb 100644 --- a/src/mame/includes/jaguar.h +++ b/src/mame/includes/jaguar.h @@ -23,7 +23,7 @@ class jaguar_state : public driver_device public: jaguar_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_main_cpu(*this, "maincpu"), + m_maincpu(*this, "maincpu"), m_gpu(*this, "gpu"), m_dsp(*this, "dsp"), m_dac1(*this, "dac1"), @@ -52,12 +52,11 @@ public: m_main_gpu_wait(NULL), m_joystick_data(0), m_eeprom_bit_count(0), - m_protection_check(0) , - m_maincpu(*this, "maincpu"), + m_protection_check(0) , m_eeprom(*this, "eeprom") { } // devices - required_device m_main_cpu; + required_device m_maincpu; required_device m_gpu; required_device m_dsp; required_device m_dac1; @@ -317,6 +316,5 @@ protected: emu_file *jaguar_nvram_fopen( UINT32 openflags); void jaguar_nvram_load(); void jaguar_nvram_save(); - required_device m_maincpu; optional_device m_eeprom; }; diff --git a/src/mame/includes/toaplan2.h b/src/mame/includes/toaplan2.h index 70d47b4dcf9..ca8b35813d0 100644 --- a/src/mame/includes/toaplan2.h +++ b/src/mame/includes/toaplan2.h @@ -37,9 +37,6 @@ public: optional_shared_ptr m_shared_ram; // 8 bit RAM shared between 68K and sound CPU optional_shared_ptr m_shared_ram16; // Really 8 bit RAM connected to Z180 - device_t *m_main_cpu; - device_t *m_sub_cpu; - UINT16 m_mcu_data; UINT16 m_video_status; INT8 m_old_p1_paddle_h; /* For Ghox */ diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c index e1c8e2dca71..15b628daeca 100644 --- a/src/mame/video/jaguar.c +++ b/src/mame/video/jaguar.c @@ -268,9 +268,9 @@ inline bool jaguar_state::adjust_object_timer(int vc) void jaguar_state::update_cpu_irq() { if ((m_cpu_irq_state & m_gpu_regs[INT1] & 0x1f) != 0) - m_main_cpu->set_input_line(m_is_r3000 ? R3000_IRQ4 : M68K_IRQ_6, ASSERT_LINE); + m_maincpu->set_input_line(m_is_r3000 ? R3000_IRQ4 : M68K_IRQ_6, ASSERT_LINE); else - m_main_cpu->set_input_line(m_is_r3000 ? R3000_IRQ4 : M68K_IRQ_6, CLEAR_LINE); + m_maincpu->set_input_line(m_is_r3000 ? R3000_IRQ4 : M68K_IRQ_6, CLEAR_LINE); }