From b88f3b7dd289956634f8717208accc36a816be68 Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Thu, 14 Sep 2017 16:27:57 -0400 Subject: hexion.cpp: fix music speed by hooking up the INT_TIME callback from the k053252 CCU properly. [Lord Nightmare] --- src/devices/machine/k053252.cpp | 6 +++--- src/devices/machine/k053252.h | 8 ++++---- src/mame/drivers/hexion.cpp | 18 +++++++++++++++++- src/mame/includes/hexion.h | 3 +++ 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/devices/machine/k053252.cpp b/src/devices/machine/k053252.cpp index f4ef1d3280d..09f554d9146 100644 --- a/src/devices/machine/k053252.cpp +++ b/src/devices/machine/k053252.cpp @@ -72,7 +72,7 @@ k053252_device::k053252_device(const machine_config &mconfig, const char *tag, d , m_int2_en_cb(*this) , m_int1_ack_cb(*this) , m_int2_ack_cb(*this) - //, m_int_time_cb(*this) + , m_int_time_cb(*this) , m_offsx(0) , m_offsy(0) , m_slave_screen(*this, finder_base::DUMMY_TAG) // ugly, needed to work with the rungun etc. video demux board @@ -90,7 +90,7 @@ void k053252_device::device_start() m_int2_en_cb.resolve_safe(); m_int1_ack_cb.resolve_safe(); m_int2_ack_cb.resolve_safe(); - //m_int_time_cb.resolve_safe(); + m_int_time_cb.resolve_safe(); save_item(NAME(m_regs)); save_item(NAME(m_hc)); @@ -244,7 +244,7 @@ WRITE8_MEMBER( k053252_device::write ) res_change(); break; - //case 0x0d: m_int_time(data); break; + case 0x0d: m_int_time_cb(data); break; case 0x0e: m_int1_ack_cb(1); break; case 0x0f: m_int2_ack_cb(1); break; } diff --git a/src/devices/machine/k053252.h b/src/devices/machine/k053252.h index de2426114f6..bba20112d91 100644 --- a/src/devices/machine/k053252.h +++ b/src/devices/machine/k053252.h @@ -22,8 +22,8 @@ #define MCFG_K053252_INT2_ACK_CB(_devcb) \ devcb = &k053252_device::set_int2_ack_callback(*device, DEVCB_##_devcb); -/*#define MCFG_K053252_INT_TIME_CB(_devcb) \ - devcb = &k053252_device::set_int_time_callback(*device, DEVCB_##_devcb); */ +#define MCFG_K053252_INT_TIME_CB(_devcb) \ + devcb = &k053252_device::set_int_time_callback(*device, DEVCB_##_devcb); #define MCFG_K053252_OFFSETS(_offsx, _offsy) \ k053252_device::set_offsets(*device, _offsx, _offsy); @@ -41,7 +41,7 @@ public: template static devcb_base &set_int2_en_callback(device_t &device, Object &&obj) { return downcast(device).m_int2_en_cb.set_callback(std::forward(obj)); } template static devcb_base &set_int1_ack_callback(device_t &device, Object &&obj) { return downcast(device).m_int1_ack_cb.set_callback(std::forward(obj)); } template static devcb_base &set_int2_ack_callback(device_t &device, Object &&obj) { return downcast(device).m_int2_ack_cb.set_callback(std::forward(obj)); } - //template static devcb_base &set_int_time_callback(device_t &device, Object &&obj) { return downcast(device).m_int_time_cb.set_callback(std::forward(obj)); } + template static devcb_base &set_int_time_callback(device_t &device, Object &&obj) { return downcast(device).m_int_time_cb.set_callback(std::forward(obj)); } static void set_offsets(device_t &device, int offsx, int offsy) { downcast(device).m_offsx = offsx; downcast(device).m_offsy = offsy; } DECLARE_READ8_MEMBER( read ); // CCU registers @@ -69,7 +69,7 @@ protected: devcb_write_line m_int2_en_cb; devcb_write_line m_int1_ack_cb; devcb_write_line m_int2_ack_cb; -// devcb_write8 m_int_time_cb; + devcb_write8 m_int_time_cb; int m_offsx; int m_offsy; diff --git a/src/mame/drivers/hexion.cpp b/src/mame/drivers/hexion.cpp index b25592522e8..c666b4d8bfb 100644 --- a/src/mame/drivers/hexion.cpp +++ b/src/mame/drivers/hexion.cpp @@ -115,6 +115,12 @@ WRITE_LINE_MEMBER(hexion_state::nmi_ack_w) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } +WRITE8_MEMBER(hexion_state::ccu_int_time_w) +{ + logerror("ccu_int_time rewritten with value of %02x\n", data); + m_ccu_int_time = data; +} + static ADDRESS_MAP_START( hexion_map, AS_PROGRAM, 8, hexion_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1") @@ -232,10 +238,19 @@ TIMER_DEVICE_CALLBACK_MEMBER(hexion_state::scanline) { int scanline = param; + // z80 /IRQ is connected to the IRQ1(vblank) pin of k053252 CCU if(scanline == 256) m_maincpu->set_input_line(0, ASSERT_LINE); - else if ((scanline == 85) || (scanline == 170)) //TODO + + // z80 /NMI is connected to the IRQ2 pin of k053252 CCU + // the following code is emulating INT_TIME of the k053252, this code will go away + // when the new konami branch is merged. + m_ccu_int_time_count--; + if (m_ccu_int_time_count <= 0) + { m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_ccu_int_time_count = m_ccu_int_time; + } } @@ -250,6 +265,7 @@ static MACHINE_CONFIG_START( hexion ) MCFG_DEVICE_ADD("k053252", K053252, XTAL_24MHz/2) /* K053252, X0-010(?) @8D, xtal verified, divider not verified */ MCFG_K053252_INT1_ACK_CB(WRITELINE(hexion_state, irq_ack_w)) MCFG_K053252_INT2_ACK_CB(WRITELINE(hexion_state, nmi_ack_w)) + MCFG_K053252_INT_TIME_CB(WRITE8(hexion_state, ccu_int_time_w)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/includes/hexion.h b/src/mame/includes/hexion.h index b20fcc02861..d86ad099504 100644 --- a/src/mame/includes/hexion.h +++ b/src/mame/includes/hexion.h @@ -22,6 +22,8 @@ public: int m_rambank; int m_pmcbank; int m_gfxrom_select; + int m_ccu_int_time; + int m_ccu_int_time_count; tilemap_t *m_bg_tilemap[2]; DECLARE_WRITE8_MEMBER(coincntr_w); @@ -32,6 +34,7 @@ public: DECLARE_WRITE8_MEMBER(gfxrom_select_w); DECLARE_WRITE_LINE_MEMBER(irq_ack_w); DECLARE_WRITE_LINE_MEMBER(nmi_ack_w); + DECLARE_WRITE8_MEMBER(ccu_int_time_w); TILE_GET_INFO_MEMBER(get_tile_info0); TILE_GET_INFO_MEMBER(get_tile_info1); -- cgit v1.2.3