From e956008352c68af5e7457eb62561479a29da7b8e Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 27 Jan 2019 18:01:14 -0500 Subject: mw8080bw.cpp, 8080bw.cpp: Interrupt modernization (nw) spacecom: Re-guess CPU and video clocks --- src/mame/drivers/8080bw.cpp | 50 ++++++++++++++++++++++++++++--------------- src/mame/drivers/mw8080bw.cpp | 1 + src/mame/includes/8080bw.h | 4 +++- src/mame/includes/mw8080bw.h | 4 +++- src/mame/machine/mw8080bw.cpp | 28 +++++++++++++++--------- 5 files changed, 58 insertions(+), 29 deletions(-) diff --git a/src/mame/drivers/8080bw.cpp b/src/mame/drivers/8080bw.cpp index 48f72e072b4..6650c16c1b7 100644 --- a/src/mame/drivers/8080bw.cpp +++ b/src/mame/drivers/8080bw.cpp @@ -819,20 +819,18 @@ void _8080bw_state::spacecom_io_map(address_map &map) void _8080bw_state::spacecom(machine_config &config) { /* basic machine hardware */ - I8080A(config, m_maincpu, XTAL(18'000'000) / 10); // divider guessed + I8080A(config, m_maincpu, XTAL(18'000'000) / 9); // divider guessed // TODO: move irq handling away from mw8080.c, this game runs on custom hardware m_maincpu->set_addrmap(AS_PROGRAM, &_8080bw_state::spacecom_map); m_maincpu->set_addrmap(AS_IO, &_8080bw_state::spacecom_io_map); + m_maincpu->set_irq_acknowledge_callback(FUNC(_8080bw_state::interrupt_vector)); MCFG_MACHINE_START_OVERRIDE(mw8080bw_state, mw8080bw) MCFG_MACHINE_RESET_OVERRIDE(mw8080bw_state, mw8080bw) /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); - m_screen->set_size(32*8, 32*8); - m_screen->set_visarea(0*8, 32*8-1, 0*8, 28*8-1); + m_screen->set_raw(XTAL(18'000'000) / 3, 384, 0, 256, 260, 0, 224); // parameters guessed m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_spacecom)); PALETTE(config, m_palette, palette_device::MONOCHROME); @@ -1144,6 +1142,7 @@ void _8080bw_state::escmars(machine_config &config) I8080(config, m_maincpu, XTAL(18'000'000) / 10); // divider guessed m_maincpu->set_addrmap(AS_PROGRAM, &_8080bw_state::escmars_map); m_maincpu->set_addrmap(AS_IO, &_8080bw_state::lrescue_io_map); + m_maincpu->set_irq_acknowledge_callback(FUNC(_8080bw_state::interrupt_vector)); MCFG_MACHINE_START_OVERRIDE(_8080bw_state, extra_8080bw) MCFG_MACHINE_RESET_OVERRIDE(_8080bw_state, mw8080bw) @@ -1243,7 +1242,6 @@ void _8080bw_state::cosmicmo(machine_config &config) /* basic machine hardware */ m_maincpu->set_addrmap(AS_IO, &_8080bw_state::cosmicmo_io_map); - m_maincpu->set_vblank_int("screen", FUNC(_8080bw_state::irq0_line_hold)); MCFG_MACHINE_START_OVERRIDE(_8080bw_state,extra_8080bw) @@ -1537,6 +1535,7 @@ void _8080bw_state::schaser(machine_config &config) I8080(config.replace(), m_maincpu, 1996800); /* 19.968MHz / 10 */ m_maincpu->set_addrmap(AS_PROGRAM, &_8080bw_state::schaser_map); m_maincpu->set_addrmap(AS_IO, &_8080bw_state::schaser_io_map); + m_maincpu->set_irq_acknowledge_callback(FUNC(_8080bw_state::interrupt_vector)); WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 255); MCFG_MACHINE_START_OVERRIDE(_8080bw_state,schaser) @@ -1707,6 +1706,14 @@ CUSTOM_INPUT_MEMBER(_8080bw_state::sflush_80_r) return (m_screen->vpos() & 0x80) ? 1 : 0; } +uint8_t _8080bw_state::sflush_in0_r() +{ + // guess at interrupt acknowledgement + if (!machine().side_effects_disabled()) + m_maincpu->set_input_line(0, CLEAR_LINE); + return ioport("IN0")->read(); +} + void _8080bw_state::sflush_map(address_map &map) { map(0x0000, 0x1fff).ram(); @@ -1714,7 +1721,7 @@ void _8080bw_state::sflush_map(address_map &map) map(0x8008, 0x8008).portr("PADDLE"); map(0x8009, 0x8009).r(m_mb14241, FUNC(mb14241_device::shift_result_r)); map(0x800a, 0x800a).portr("IN2"); - map(0x800b, 0x800b).portr("IN0"); + map(0x800b, 0x800b).r(FUNC(_8080bw_state::sflush_in0_r)); map(0x8018, 0x8018).w(m_mb14241, FUNC(mb14241_device::shift_data_w)); map(0x8019, 0x8019).w(m_mb14241, FUNC(mb14241_device::shift_count_w)); map(0x801a, 0x801a).nopw(); @@ -1769,7 +1776,6 @@ void _8080bw_state::sflush(machine_config &config) /* basic machine hardware */ M6800(config.replace(), m_maincpu, 1500000); // ? m_maincpu->set_addrmap(AS_PROGRAM, &_8080bw_state::sflush_map); - m_maincpu->set_vblank_int("screen", FUNC(_8080bw_state::irq0_line_hold)); MCFG_MACHINE_START_OVERRIDE(_8080bw_state,sflush) @@ -1934,14 +1940,17 @@ void _8080bw_state::lupin3a(machine_config &config) /* */ /*******************************************************/ -INTERRUPT_GEN_MEMBER(_8080bw_state::polaris_interrupt) +WRITE_LINE_MEMBER(_8080bw_state::polaris_60hz_w) { - m_polaris_cloud_speed++; - - if (m_polaris_cloud_speed >= 4) /* every 4 frames - this was verified against real machine */ + if (state) { - m_polaris_cloud_speed = 0; - m_polaris_cloud_pos++; + m_polaris_cloud_speed++; + + if (m_polaris_cloud_speed >= 4) /* every 4 frames - this was verified against real machine */ + { + m_polaris_cloud_speed = 0; + m_polaris_cloud_pos++; + } } } @@ -2039,10 +2048,8 @@ void _8080bw_state::polaris(machine_config &config) mw8080bw_root(config); /* basic machine hardware */ - I8080(config.replace(), m_maincpu, 1996800); /* 19.968MHz / 10 */ m_maincpu->set_addrmap(AS_PROGRAM, &_8080bw_state::schaser_map); m_maincpu->set_addrmap(AS_IO, &_8080bw_state::polaris_io_map); - m_maincpu->set_vblank_int("screen", FUNC(_8080bw_state::polaris_interrupt)); WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 255); @@ -2053,6 +2060,7 @@ void _8080bw_state::polaris(machine_config &config) /* video hardware */ m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_polaris)); + m_screen->screen_vblank().set(FUNC(_8080bw_state::polaris_60hz_w)); PALETTE(config, m_palette, palette_device::RBG_3BIT); @@ -2741,6 +2749,7 @@ void _8080bw_state::shuttlei(machine_config &config) // TODO: move irq handling away from mw8080.cpp, this game runs on custom hardware m_maincpu->set_addrmap(AS_PROGRAM, &_8080bw_state::shuttlei_map); m_maincpu->set_addrmap(AS_IO, &_8080bw_state::shuttlei_io_map); + m_maincpu->set_irq_acknowledge_callback(FUNC(_8080bw_state::interrupt_vector)); MCFG_MACHINE_START_OVERRIDE(_8080bw_state, extra_8080bw) MCFG_MACHINE_RESET_OVERRIDE(_8080bw_state, mw8080bw) @@ -2796,6 +2805,12 @@ MACHINE_RESET_MEMBER(_8080bw_state,darthvdr) /* do nothing for now - different interrupt system */ } +IRQ_CALLBACK_MEMBER(_8080bw_state::darthvdr_interrupt_vector) +{ + m_maincpu->set_input_line(0, CLEAR_LINE); + return 0xff; +} + READ8_MEMBER(_8080bw_state::darthvdr_01_r) { uint8_t data = ioport("P2")->read(); @@ -2867,7 +2882,7 @@ void _8080bw_state::darthvdr(machine_config &config) /* basic machine hardware */ m_maincpu->set_addrmap(AS_PROGRAM, &_8080bw_state::darthvdr_map); m_maincpu->set_addrmap(AS_IO, &_8080bw_state::darthvdr_io_map); - m_maincpu->set_vblank_int("screen", FUNC(_8080bw_state::irq0_line_hold)); + m_maincpu->set_irq_acknowledge_callback(FUNC(_8080bw_state::darthvdr_interrupt_vector)); MCFG_MACHINE_START_OVERRIDE(_8080bw_state,darthvdr) MCFG_MACHINE_RESET_OVERRIDE(_8080bw_state,darthvdr) @@ -2877,6 +2892,7 @@ void _8080bw_state::darthvdr(machine_config &config) /* video hardware */ m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invaders)); + m_screen->screen_vblank().set_inputline(m_maincpu, 0, ASSERT_LINE); } diff --git a/src/mame/drivers/mw8080bw.cpp b/src/mame/drivers/mw8080bw.cpp index 86827f050ab..0cea39f2e87 100644 --- a/src/mame/drivers/mw8080bw.cpp +++ b/src/mame/drivers/mw8080bw.cpp @@ -235,6 +235,7 @@ void mw8080bw_state::mw8080bw_root(machine_config &config) /* basic machine hardware */ I8080(config, m_maincpu, MW8080BW_CPU_CLOCK); m_maincpu->set_addrmap(AS_PROGRAM, &mw8080bw_state::main_map); + m_maincpu->set_irq_acknowledge_callback(FUNC(mw8080bw_state::interrupt_vector)); MCFG_MACHINE_START_OVERRIDE(mw8080bw_state,mw8080bw) MCFG_MACHINE_RESET_OVERRIDE(mw8080bw_state,mw8080bw) diff --git a/src/mame/includes/8080bw.h b/src/mame/includes/8080bw.h index ae5afda1711..62d1cc17340 100644 --- a/src/mame/includes/8080bw.h +++ b/src/mame/includes/8080bw.h @@ -78,6 +78,7 @@ public: void init_attackfc(); DECLARE_CUSTOM_INPUT_MEMBER(sflush_80_r); + uint8_t sflush_in0_r(); DECLARE_INPUT_CHANGED_MEMBER(claybust_gun_trigger); DECLARE_CUSTOM_INPUT_MEMBER(claybust_gun_on_r); @@ -121,6 +122,7 @@ private: DECLARE_READ8_MEMBER(darthvdr_01_r); DECLARE_WRITE8_MEMBER(darthvdr_00_w); DECLARE_WRITE8_MEMBER(darthvdr_08_w); + IRQ_CALLBACK_MEMBER(darthvdr_interrupt_vector); DECLARE_WRITE8_MEMBER(ballbomb_01_w); DECLARE_WRITE8_MEMBER(ballbomb_sh_port_1_w); DECLARE_WRITE8_MEMBER(ballbomb_sh_port_2_w); @@ -193,7 +195,7 @@ private: uint32_t screen_update_shuttlei(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_spacecom(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(polaris_interrupt); + DECLARE_WRITE_LINE_MEMBER(polaris_60hz_w); TIMER_DEVICE_CALLBACK_MEMBER(claybust_gun_callback); TIMER_DEVICE_CALLBACK_MEMBER(schaser_effect_555_cb); DECLARE_WRITE8_MEMBER(indianbt_sh_port_3_w); diff --git a/src/mame/includes/mw8080bw.h b/src/mame/includes/mw8080bw.h index 46eb37a4df3..e14515510a5 100644 --- a/src/mame/includes/mw8080bw.h +++ b/src/mame/includes/mw8080bw.h @@ -127,6 +127,8 @@ public: DECLARE_MACHINE_START(mw8080bw); DECLARE_MACHINE_RESET(mw8080bw); + IRQ_CALLBACK_MEMBER(interrupt_vector); + protected: /* device/memory pointers */ @@ -230,7 +232,7 @@ private: uint32_t screen_update_phantom2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_phantom2); TIMER_CALLBACK_MEMBER(maze_tone_timing_timer_callback); - TIMER_CALLBACK_MEMBER(mw8080bw_interrupt_callback); + TIMER_CALLBACK_MEMBER(interrupt_trigger); TIMER_DEVICE_CALLBACK_MEMBER(spcenctr_strobe_timer_callback); DECLARE_WRITE8_MEMBER(midway_tone_generator_lo_w); DECLARE_WRITE8_MEMBER(midway_tone_generator_hi_w); diff --git a/src/mame/machine/mw8080bw.cpp b/src/mame/machine/mw8080bw.cpp index 1d081aa551f..ae8b32dd8ff 100644 --- a/src/mame/machine/mw8080bw.cpp +++ b/src/mame/machine/mw8080bw.cpp @@ -45,19 +45,16 @@ int mw8080bw_state::vysnc_chain_counter_to_vpos( uint8_t counter, int vblank ) } -TIMER_CALLBACK_MEMBER(mw8080bw_state::mw8080bw_interrupt_callback) +TIMER_CALLBACK_MEMBER(mw8080bw_state::interrupt_trigger) { - uint8_t next_counter; - int next_vpos; - int next_vblank; - - /* compute vector and set the interrupt line */ int vpos = m_screen->vpos(); uint8_t counter = vpos_to_vysnc_chain_counter(vpos); - uint8_t vector = 0xc7 | ((counter & 0x40) >> 2) | ((~counter & 0x40) >> 3); - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, vector); + + m_maincpu->set_input_line(0, ASSERT_LINE); /* set up for next interrupt */ + uint8_t next_counter; + int next_vblank; if (counter == MW8080BW_INT_TRIGGER_COUNT_1) { next_counter = MW8080BW_INT_TRIGGER_COUNT_2; @@ -69,14 +66,25 @@ TIMER_CALLBACK_MEMBER(mw8080bw_state::mw8080bw_interrupt_callback) next_vblank = MW8080BW_INT_TRIGGER_VBLANK_1; } - next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_vblank); + int next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_vblank); m_interrupt_timer->adjust(m_screen->time_until_pos(next_vpos)); } +IRQ_CALLBACK_MEMBER(mw8080bw_state::interrupt_vector) +{ + int vpos = m_screen->vpos(); + uint8_t counter = vpos_to_vysnc_chain_counter(vpos); + uint8_t vector = 0xc7 | ((counter & 0x40) >> 2) | ((~counter & 0x40) >> 3); + + m_maincpu->set_input_line(0, CLEAR_LINE); + return vector; +} + + void mw8080bw_state::mw8080bw_create_interrupt_timer( ) { - m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::mw8080bw_interrupt_callback),this)); + m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::interrupt_trigger),this)); } -- cgit v1.2.3