From ef6cb6efa143b5fd6e4214f0686746ffceacd37f Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 8 Jul 2023 14:59:47 +0200 Subject: konmedal: add scc enable register --- src/devices/sound/k051649.cpp | 12 ++++++------ src/mame/konami/konmedal.cpp | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp index 18d38ba7cca..66ed018fdb0 100644 --- a/src/devices/sound/k051649.cpp +++ b/src/devices/sound/k051649.cpp @@ -12,16 +12,16 @@ waveform from RAM (32 bytes per waveform, 8 bit signed data). This sound chip is the same as the sound chip in some Konami - megaROM cartridges for the MSX. It is actually well researched - and documented: - - http://bifi.msxnet.org/msxnet/tech/scc.html - - Thanks to Sean Young (sean@mess.org) for some bugfixes. + megaROM cartridges for the MSX. This device only emulates the + sound portion, not the memory mapper. K052539 is more or less equivalent to this chip except channel 5 does not share waveram with channel 4. + References: + - http://bifi.msxnet.org/msxnet/tech/scc.html + - http://bifi.msxnet.org/msxnet/tech/soundcartridge + TODO: - make K052539 a subdevice - test register bits 0-4, not used in any software diff --git a/src/mame/konami/konmedal.cpp b/src/mame/konami/konmedal.cpp index af01aa98f3b..a8bdd86420a 100644 --- a/src/mame/konami/konmedal.cpp +++ b/src/mame/konami/konmedal.cpp @@ -88,6 +88,7 @@ public: m_k053252(*this, "k053252"), m_k052109(*this, "k052109"), m_palette(*this, "palette"), + m_scc_map(*this, "scc_map"), m_ymz(*this, "ymz"), m_oki(*this, "oki"), m_upd7759(*this, "upd"), @@ -128,6 +129,7 @@ private: uint8_t vram_r(offs_t offset); void vram_w(offs_t offset, uint8_t data); void bankswitch_w(uint8_t data); + void scc_enable_w(uint8_t data); void control2_w(uint8_t data); void medalcnt_w(uint8_t data); void lamps_w(uint8_t data); @@ -161,6 +163,7 @@ private: optional_device m_k053252; optional_device m_k052109; required_device m_palette; + memory_view m_scc_map; optional_device m_ymz; optional_device m_oki; optional_device m_upd7759; @@ -168,11 +171,14 @@ private: required_ioport m_outport; output_finder<8> m_lamps; - u8 m_control, m_control2, m_shuri_irq; - int m_ccu_int_time, m_ccu_int_time_count; - int m_avac; - int m_layer_colorbase[4]; - int m_layer_order[4]; + u8 m_control = 0; + u8 m_control2 = 0; + u8 m_shuri_irq = 0; + int m_ccu_int_time = 0; + int m_ccu_int_time_count = 0;; + int m_avac = 0; + int m_layer_colorbase[4] = { }; + int m_layer_order[4] = { }; }; void konmedal_state::control2_w(uint8_t data) @@ -381,6 +387,16 @@ void konmedal_state::bankswitch_w(uint8_t data) m_control = data & 0xf; } +void konmedal_state::scc_enable_w(uint8_t data) +{ + // SCC memory bank register 3, 0x3f to enable access to sound registers + // normally it's safe to ignore this register in arcade drivers, but in this case slimekun relies on it + if ((data & 0x3f) == 0x3f) + m_scc_map.select(0); + else + m_scc_map.disable(); +} + void konmedal_state::medal_main(address_map &map) { map(0x0000, 0x7fff).rom().region("maincpu", 0); @@ -420,8 +436,9 @@ void konmedal_state::ddboy_main(address_map &map) map(0xc703, 0xc703).portr("IN2"); map(0xc800, 0xc80f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)); map(0xcc00, 0xcc00).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0xd000, 0xd000).nopw(); // ??? writes 00 and 3f every frame - map(0xd800, 0xd8ff).m("k051649", FUNC(k051649_device::scc_map)); + map(0xd000, 0xd000).mirror(0x07ff).w(FUNC(konmedal_state::scc_enable_w)); + map(0xd800, 0xdfff).view(m_scc_map); + m_scc_map[0](0xd800, 0xd8ff).mirror(0x0700).m("k051649", FUNC(k051649_device::scc_map)); map(0xe000, 0xffff).rw(FUNC(konmedal_state::vram_r), FUNC(konmedal_state::vram_w)); } @@ -439,8 +456,9 @@ void konmedal_state::shuriboy_main(address_map &map) map(0x8c00, 0x8c00).w(FUNC(konmedal_state::shuri_bank_w)); map(0x8d00, 0x8d00).w(m_upd7759, FUNC(upd7759_device::port_w)); map(0x8e00, 0x8e00).w(FUNC(konmedal_state::lamps_w)); - map(0x9000, 0x9000).nopw(); // writes alternating 00 and 3F - map(0x9800, 0x98ff).m("k051649", FUNC(k051649_device::scc_map)); + map(0x9000, 0x9000).mirror(0x07ff).w(FUNC(konmedal_state::scc_enable_w)); + map(0x9800, 0x9fff).view(m_scc_map); + m_scc_map[0](0x9800, 0x98ff).mirror(0x0700).m("k051649", FUNC(k051649_device::scc_map)); map(0xa000, 0xbfff).bankr("bank1"); map(0xc000, 0xffff).rw(m_k052109, FUNC(k052109_device::read), FUNC(k052109_device::write)); map(0xdd00, 0xdd00).rw(FUNC(konmedal_state::shuri_irq_r), FUNC(konmedal_state::shuri_irq_w)); @@ -797,7 +815,9 @@ MACHINE_START_MEMBER(konmedal_state, shuriboy) void konmedal_state::machine_reset() { - m_control = m_control2 = m_shuri_irq = 0; + m_control = 0; + m_control2 = 0; + m_shuri_irq = 0; m_ccu_int_time_count = 0; m_ccu_int_time = 31; m_avac = 0; @@ -973,7 +993,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(konmedal_state::shuri_scanline) if ((scanline == 240) && (m_shuri_irq & 0x4)) { m_maincpu->set_input_line(0, ASSERT_LINE); - } if ((scanline == 255) && (m_shuri_irq & 0x1)) -- cgit v1.2.3