From 211e5f544d3f45242503c58944b16cd62646f72b Mon Sep 17 00:00:00 2001 From: MetalliC <0vetal0@gmail.com> Date: Fri, 9 Sep 2016 12:41:12 +0300 Subject: [PATCH] sms.cpp: more accurate FM Sound Unit behavior [Enik Land] --- src/devices/bus/sg1000_exp/fm_unit.cpp | 16 +++++++++++++--- src/mame/drivers/sms.cpp | 17 ++++++++++++++--- src/mame/machine/sms.cpp | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/devices/bus/sg1000_exp/fm_unit.cpp b/src/devices/bus/sg1000_exp/fm_unit.cpp index 46e7b036704..da3759ca26f 100644 --- a/src/devices/bus/sg1000_exp/fm_unit.cpp +++ b/src/devices/bus/sg1000_exp/fm_unit.cpp @@ -9,6 +9,15 @@ Release data from the Sega Retro project: Year: 1987 Country/region: JP Model code: FM-70 +Notes: + +This emulation is based on Charles MacDonald's analysis of Enri's schematics +of the FM unit hardware. + +Any software that access controllers through IO ports $C0/$C1 instead $DC/$DD +(the game Fushigi no Oshiro Pit Pot is a known example) has control problems +when the FM Sound Unit is attached (real hardware behavior). + **********************************************************************/ #include "fm_unit.h" @@ -69,7 +78,7 @@ void sega_fm_unit_device::device_start() READ8_MEMBER(sega_fm_unit_device::peripheral_r) { - if (offset == 2) + if (offset <= 3) { return m_audio_control & 0x01; } @@ -98,6 +107,7 @@ WRITE8_MEMBER(sega_fm_unit_device::peripheral_w) } break; case 2: // control port + case 3: // mirror m_audio_control = data & 0x01; break; default: @@ -108,11 +118,11 @@ WRITE8_MEMBER(sega_fm_unit_device::peripheral_w) bool sega_fm_unit_device::is_readable(UINT8 offset) { - return (offset == 2) ? true : false; + return (offset <= 3) ? true : false; } bool sega_fm_unit_device::is_writeable(UINT8 offset) { - return (offset <= 2) ? true : false; + return (offset <= 3) ? true : false; } diff --git a/src/mame/drivers/sms.cpp b/src/mame/drivers/sms.cpp index 937b714c4dd..2f12aedb724 100644 --- a/src/mame/drivers/sms.cpp +++ b/src/mame/drivers/sms.cpp @@ -870,8 +870,15 @@ static MACHINE_CONFIG_DERIVED( sms1_kr, sms1_ntsc ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_IO_MAP(smskr_io) + // need to replace the cartridge slot with the Japanese version, so to + // keep the usual media order, remove and reinsert all of them. MCFG_DEVICE_REMOVE("slot") + MCFG_DEVICE_REMOVE("mycard") + MCFG_DEVICE_REMOVE("smsexp") MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr) + MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr) + MCFG_SMS_EXPANSION_ADD("smsexp", sms_expansion_devices, nullptr) + MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000") MCFG_DEVICE_MODIFY("sms_vdp") @@ -890,13 +897,17 @@ static MACHINE_CONFIG_DERIVED( sg1000m3, sms1_ntsc ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_IO_MAP(sg1000m3_io) + // Remove and reinsert all media slots, as done with the sms1_kr config, + // and also replace the expansion slot with the SG-1000 version. MCFG_DEVICE_REMOVE("slot") - MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr) - MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000") - + MCFG_DEVICE_REMOVE("mycard") MCFG_DEVICE_REMOVE("smsexp") + MCFG_SG1000MK3_CARTRIDGE_ADD("slot", sg1000mk3_cart, nullptr) + MCFG_SMS_CARD_ADD("mycard", sms_cart, nullptr) MCFG_SG1000_EXPANSION_ADD("sgexp", sg1000_expansion_devices, nullptr, false) + MCFG_SOFTWARE_LIST_ADD("cart_list2","sg1000") + // Mark III does not have TH connected. MCFG_SMS_CONTROL_PORT_MODIFY(CONTROL1_TAG) MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(NOOP) diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp index 094a8aaa721..a268aa4d936 100644 --- a/src/mame/machine/sms.cpp +++ b/src/mame/machine/sms.cpp @@ -287,7 +287,7 @@ WRITE_LINE_MEMBER(sms_state::sms_csync_callback) { // Timings for Rapid Fire and LED verified by Charles MacDonald. - // Read state is changed at each 256 C-Sync pulses + // Read state is probably changed at each 256 C-Sync pulses if ((m_csync_counter & 0xff) == 0) { m_rapid_read_state ^= 0xff;