From 3f4f237dde89ea02b5a2724f391e3054cfc659d7 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 9 Sep 2019 14:00:51 -0400 Subject: cbuster.cpp, darkseal.cpp, vaportra.cpp: Add workaround to 6280 core to fix music speed --- src/devices/cpu/h6280/h6280.cpp | 6 +++--- src/devices/cpu/h6280/h6280.h | 5 +++++ src/mame/drivers/cbuster.cpp | 1 + src/mame/drivers/darkseal.cpp | 1 + src/mame/drivers/vaportra.cpp | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp index 32c7a0578fa..02450ff10d2 100644 --- a/src/devices/cpu/h6280/h6280.cpp +++ b/src/devices/cpu/h6280/h6280.cpp @@ -176,6 +176,7 @@ h6280_device::h6280_device(const machine_config &mconfig, const char *tag, devic , m_port_in_cb(*this) , m_port_out_cb(*this) , m_psg(*this, "psg") + , m_timer_scale(1) { // build the opcode table for (int op = 0; op < 256; op++) @@ -344,7 +345,7 @@ void h6280_device::device_reset() /* timer off by default */ m_timer_status = 0; - m_timer_load = 128 * 1024; + m_timer_load = 128 * 1024 * m_timer_scale; m_irq_pending = 0; } @@ -2571,9 +2572,8 @@ WRITE8_MEMBER( h6280_device::timer_w ) switch (offset & 1) { case 0: /* Counter preload */ - //m_timer_load = m_timer_value = ((data & 127) + 1) * 1024; // matches HW behaviour, value is latched only with 0->1 counter enable transition - m_timer_load = ((data & 127) + 1) * 1024; + m_timer_load = ((data & 127) + 1) * 1024 * m_timer_scale; return; case 1: /* Counter enable */ diff --git a/src/devices/cpu/h6280/h6280.h b/src/devices/cpu/h6280/h6280.h index 5e45a0fe7b9..86483beca98 100644 --- a/src/devices/cpu/h6280/h6280.h +++ b/src/devices/cpu/h6280/h6280.h @@ -41,6 +41,9 @@ public: auto port_in_cb() { return m_port_in_cb.bind(); } // K0-7 at Pinout auto port_out_cb() { return m_port_out_cb.bind(); } // O0-7 at Pinout + // hack to fix music speed in some Data East games (core bug, external strapping, DE 45 customization or ???) + void set_timer_scale(int scale) { m_timer_scale = scale; } + /* functions for use by the PSG and joypad port only! */ uint8_t io_get_buffer(); void io_set_buffer(uint8_t); @@ -374,6 +377,8 @@ protected: // other internal states int m_icount; + uint8_t m_timer_scale; + // address spaces address_space *m_program; address_space *m_io; diff --git a/src/mame/drivers/cbuster.cpp b/src/mame/drivers/cbuster.cpp index 9fbe272553a..67c8d2efc10 100644 --- a/src/mame/drivers/cbuster.cpp +++ b/src/mame/drivers/cbuster.cpp @@ -269,6 +269,7 @@ void cbuster_state::twocrude(machine_config &config) H6280(config, m_audiocpu, XTAL(24'000'000)/4); /* Custom chip 45, 6MHz Verified */ m_audiocpu->set_addrmap(AS_PROGRAM, &cbuster_state::sound_map); m_audiocpu->add_route(ALL_OUTPUTS, "mono", 0); // internal sound unused + m_audiocpu->set_timer_scale(2); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(58); diff --git a/src/mame/drivers/darkseal.cpp b/src/mame/drivers/darkseal.cpp index d812725b8cd..f96d2f78420 100644 --- a/src/mame/drivers/darkseal.cpp +++ b/src/mame/drivers/darkseal.cpp @@ -211,6 +211,7 @@ void darkseal_state::darkseal(machine_config &config) H6280(config, m_audiocpu, XTAL(32'220'000)/4); /* Custom chip 45, Audio section crystal is 32.220 MHz */ m_audiocpu->set_addrmap(AS_PROGRAM, &darkseal_state::sound_map); m_audiocpu->add_route(ALL_OUTPUTS, "mono", 0); // internal sound unused + m_audiocpu->set_timer_scale(2); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); diff --git a/src/mame/drivers/vaportra.cpp b/src/mame/drivers/vaportra.cpp index f19667d6b41..f196a9a3650 100644 --- a/src/mame/drivers/vaportra.cpp +++ b/src/mame/drivers/vaportra.cpp @@ -217,6 +217,7 @@ void vaportra_state::vaportra(machine_config &config) H6280(config, m_audiocpu, XTAL(24'000'000)/4); /* Custom chip 45; Audio section crystal is 32.220 MHz but CPU clock is confirmed as coming from the 24MHz crystal (6Mhz exactly on the CPU) */ m_audiocpu->set_addrmap(AS_PROGRAM, &vaportra_state::sound_map); m_audiocpu->add_route(ALL_OUTPUTS, "mono", 0); // internal sound unused + m_audiocpu->set_timer_scale(2); /* video hardware */ BUFFERED_SPRITERAM16(config, m_spriteram); -- cgit v1.2.3