hexion.cpp: fix music speed by hooking up the INT_TIME callback from the k053252 CCU properly. [Lord Nightmare]

This commit is contained in:
Lord-Nightmare 2017-09-14 16:27:57 -04:00
parent b4eda1ffb3
commit b88f3b7dd2
4 changed files with 27 additions and 8 deletions

View File

@ -72,7 +72,7 @@ k053252_device::k053252_device(const machine_config &mconfig, const char *tag, d
, m_int2_en_cb(*this) , m_int2_en_cb(*this)
, m_int1_ack_cb(*this) , m_int1_ack_cb(*this)
, m_int2_ack_cb(*this) , m_int2_ack_cb(*this)
//, m_int_time_cb(*this) , m_int_time_cb(*this)
, m_offsx(0) , m_offsx(0)
, m_offsy(0) , m_offsy(0)
, m_slave_screen(*this, finder_base::DUMMY_TAG) // ugly, needed to work with the rungun etc. video demux board , 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_int2_en_cb.resolve_safe();
m_int1_ack_cb.resolve_safe(); m_int1_ack_cb.resolve_safe();
m_int2_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_regs));
save_item(NAME(m_hc)); save_item(NAME(m_hc));
@ -244,7 +244,7 @@ WRITE8_MEMBER( k053252_device::write )
res_change(); res_change();
break; 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 0x0e: m_int1_ack_cb(1); break;
case 0x0f: m_int2_ack_cb(1); break; case 0x0f: m_int2_ack_cb(1); break;
} }

View File

@ -22,8 +22,8 @@
#define MCFG_K053252_INT2_ACK_CB(_devcb) \ #define MCFG_K053252_INT2_ACK_CB(_devcb) \
devcb = &k053252_device::set_int2_ack_callback(*device, DEVCB_##_devcb); devcb = &k053252_device::set_int2_ack_callback(*device, DEVCB_##_devcb);
/*#define MCFG_K053252_INT_TIME_CB(_devcb) \ #define MCFG_K053252_INT_TIME_CB(_devcb) \
devcb = &k053252_device::set_int_time_callback(*device, DEVCB_##_devcb); */ devcb = &k053252_device::set_int_time_callback(*device, DEVCB_##_devcb);
#define MCFG_K053252_OFFSETS(_offsx, _offsy) \ #define MCFG_K053252_OFFSETS(_offsx, _offsy) \
k053252_device::set_offsets(*device, _offsx, _offsy); k053252_device::set_offsets(*device, _offsx, _offsy);
@ -41,7 +41,7 @@ public:
template <class Object> static devcb_base &set_int2_en_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int2_en_cb.set_callback(std::forward<Object>(obj)); } template <class Object> static devcb_base &set_int2_en_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int2_en_cb.set_callback(std::forward<Object>(obj)); }
template <class Object> static devcb_base &set_int1_ack_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int1_ack_cb.set_callback(std::forward<Object>(obj)); } template <class Object> static devcb_base &set_int1_ack_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int1_ack_cb.set_callback(std::forward<Object>(obj)); }
template <class Object> static devcb_base &set_int2_ack_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int2_ack_cb.set_callback(std::forward<Object>(obj)); } template <class Object> static devcb_base &set_int2_ack_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int2_ack_cb.set_callback(std::forward<Object>(obj)); }
//template <class Object> static devcb_base &set_int_time_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int_time_cb.set_callback(std::forward<Object>(obj)); } template <class Object> static devcb_base &set_int_time_callback(device_t &device, Object &&obj) { return downcast<k053252_device &>(device).m_int_time_cb.set_callback(std::forward<Object>(obj)); }
static void set_offsets(device_t &device, int offsx, int offsy) { downcast<k053252_device &>(device).m_offsx = offsx; downcast<k053252_device &>(device).m_offsy = offsy; } static void set_offsets(device_t &device, int offsx, int offsy) { downcast<k053252_device &>(device).m_offsx = offsx; downcast<k053252_device &>(device).m_offsy = offsy; }
DECLARE_READ8_MEMBER( read ); // CCU registers DECLARE_READ8_MEMBER( read ); // CCU registers
@ -69,7 +69,7 @@ protected:
devcb_write_line m_int2_en_cb; devcb_write_line m_int2_en_cb;
devcb_write_line m_int1_ack_cb; devcb_write_line m_int1_ack_cb;
devcb_write_line m_int2_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_offsx;
int m_offsy; int m_offsy;

View File

@ -115,6 +115,12 @@ WRITE_LINE_MEMBER(hexion_state::nmi_ack_w)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); 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 ) static ADDRESS_MAP_START( hexion_map, AS_PROGRAM, 8, hexion_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
@ -232,10 +238,19 @@ TIMER_DEVICE_CALLBACK_MEMBER(hexion_state::scanline)
{ {
int scanline = param; int scanline = param;
// z80 /IRQ is connected to the IRQ1(vblank) pin of k053252 CCU
if(scanline == 256) if(scanline == 256)
m_maincpu->set_input_line(0, ASSERT_LINE); 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_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_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_INT1_ACK_CB(WRITELINE(hexion_state, irq_ack_w))
MCFG_K053252_INT2_ACK_CB(WRITELINE(hexion_state, nmi_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 */ /* video hardware */
MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_ADD("screen", RASTER)

View File

@ -22,6 +22,8 @@ public:
int m_rambank; int m_rambank;
int m_pmcbank; int m_pmcbank;
int m_gfxrom_select; int m_gfxrom_select;
int m_ccu_int_time;
int m_ccu_int_time_count;
tilemap_t *m_bg_tilemap[2]; tilemap_t *m_bg_tilemap[2];
DECLARE_WRITE8_MEMBER(coincntr_w); DECLARE_WRITE8_MEMBER(coincntr_w);
@ -32,6 +34,7 @@ public:
DECLARE_WRITE8_MEMBER(gfxrom_select_w); DECLARE_WRITE8_MEMBER(gfxrom_select_w);
DECLARE_WRITE_LINE_MEMBER(irq_ack_w); DECLARE_WRITE_LINE_MEMBER(irq_ack_w);
DECLARE_WRITE_LINE_MEMBER(nmi_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_info0);
TILE_GET_INFO_MEMBER(get_tile_info1); TILE_GET_INFO_MEMBER(get_tile_info1);